package com.ht.svg.action;

import org.w3c.dom.Element;
import org.w3c.dom.events.Event;

/**
 * the abstract class of the load view action
 * 
 * @author ITRIS, Jordi SUC
 */
public class LoadView extends AbstractActionListener {

	/**
	 * the string names
	 */
	protected static final String targetAttributeName = "target",
			viewAttributeName = "view",
			closePopupDialogValue = "/**closePopupDialog**/",
			quitValue = "/**quit**/",
			returnToPreviousValue = "/**returnToPrevious**/",
			popupTargetOption = "popupTarget";

	/**
	 * the constructor of the class
	 * 
	 * @param actionElement
	 *            the dom element defining the action
	 */
	public LoadView(Element actionElement) {

		super(actionElement);
		String viewPath = actionElement.getAttribute(viewAttributeName);
	}

	@Override
	public void performAction(Event event) {
		// TODO: 未实现

		String targetId = actionElement.getAttribute(targetAttributeName);

		String viewPath = actionElement.getAttribute(viewAttributeName);

		if (viewPath.equals(quitValue)) {
			// 退出系统
			// getActionsHandler().getSVGCanvas().getAnimationsHandler().
			// fireQuitProgramRequest();
		} else if (viewPath.equals(closePopupDialogValue)) {
			// 关闭窗口

		} else if (viewPath.equals(returnToPreviousValue)) {
			// displaying the previously displayed picture
			// picture.getMainDisplay().getAnimationsHandler().
			// fireReturnToLastViewRequest(targetId);
		} else {

			if (targetId.equals(popupTargetOption)) {

			} else {

				// String uri =
				// ConfigurationDocument.INSTANCE.getSVGProjectPath() +
				// viewPath.replace('/', '-') + Toolkit.SVGZ_FILE_EXTENSION;
			}
		}
	}
}
