package de.FeatureModellingTool;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JToolBar;
import javax.swing.KeyStroke;
import javax.swing.WindowConstants;
import manager.IllegalParameterException;
import manager.ManagerInterface;
import org.jdesktop.swingx.JXFrame;
import org.jdesktop.swingx.JXHyperlink;
import applet.WebConstantDefinition;
import research.Drawing;
import cn.edu.pku.sei.dockingui.ConstantDefinition;
import cn.edu.pku.sei.dockingui.ConstantDefinition.AreaStyle;
import cn.edu.pku.sei.dockingui.ConstantDefinition.Position;
import cn.edu.pku.sei.dockingui.model.DockingUIComponent;
import cn.edu.pku.sei.dockingui.model.DockingUILayout;
import cn.edu.pku.sei.dockingui.model.DockingUIStyleConfigurator;
import component.FComponent;
import de.FeatureModellingTool.Connector.Import;
import de.FeatureModellingTool.Connector.View_IDMap.View_IDMap;
import de.FeatureModellingTool.Customize.CustomizationModel;
import de.FeatureModellingTool.Customize.ui.CustomizationExplorerImplementation;
import de.FeatureModellingTool.DictEditor.DictEditor;
import de.FeatureModellingTool.Documentation.Documentation;
import de.FeatureModellingTool.ElementInfoEditor.ConstraintInfoEditor;
import de.FeatureModellingTool.ElementInfoEditor.ElementPropertiesView2;
import de.FeatureModellingTool.ElementInfoEditor.FeatureDescriptionEditor;
import de.FeatureModellingTool.ElementInfoEditor.FeatureInfoEditor;
import de.FeatureModellingTool.ElementInfoEditor.InteractionInfoEditor;
import de.FeatureModellingTool.ElementLocating.ElementLocating;
import de.FeatureModellingTool.FeatureModel.CompositeConstraintEditor;
import de.FeatureModellingTool.FeatureModel.ConstraintModel;
import de.FeatureModellingTool.FeatureModel.ConstraintModelEditor;
import de.FeatureModellingTool.FeatureModel.FeatureEditor;
import de.FeatureModellingTool.FeatureModel.FeatureModel;
import de.FeatureModellingTool.FeatureModel.FeatureModelEditor;
import de.FeatureModellingTool.FeatureModel.FeatureModelPropertyEditor;
import de.FeatureModellingTool.FeatureModel.FeatureRelationManager;
import de.FeatureModellingTool.FeatureModel.GroupConstraintEditor;
import de.FeatureModellingTool.FeatureModel.InteractionEditor;
import de.FeatureModellingTool.FeatureModel.InteractionModel;
import de.FeatureModellingTool.FeatureModel.InteractionModelEditor;
import de.FeatureModellingTool.FeatureModel.ResourceComponentEditor;
import de.FeatureModellingTool.FeatureModel.VPConstraintEditor;
import de.FeatureModellingTool.GraphicalEditor.DrawingViewContainer;
import de.FeatureModellingTool.GraphicalEditor.ElementLocator;
import de.FeatureModellingTool.GraphicalEditor.GraphicalEditor;
import de.FeatureModellingTool.GraphicalEditor.GraphicalEditorImplementation;
import de.FeatureModellingTool.InfoExplorer.InfoExplorer;
import de.FeatureModellingTool.InfoExplorer2.InfoExplorer2Implementation;
import de.FeatureModellingTool.ModelChecker.ModelChecker;
import de.FeatureModellingTool.ModelChecker.ModelCheckerUI;
import de.FeatureModellingTool.PLModelChecker.PLModelChecker;
import de.FeatureModellingTool.PLModelChecker.PLModelCheckerImplementation;
import de.FeatureModellingTool.PLModelChecker.PLModelCheckerUI;
import de.FeatureModellingTool.Pattern.UI.PatternExplorerImplementation;
import de.FeatureModellingTool.Pattern.UI.PatternGraphicalEditor;
import de.FeatureModellingTool.PatternBase.PatternBase;
import de.FeatureModellingTool.PLModelChecker.RelationAnalysis.ModelGenerateAction;
import de.FeatureModellingTool.ProjectManager.Project;
import de.FeatureModellingTool.ProjectManager.ProjectManager;
import de.reuse.GUIUtility;
import de.reuse.GroupMap;
import javax.swing.JButton;
import javax.swing.SwingConstants;
/**
* author: zhangwei
* Date: 2003-6-6
* Time: 11:40:16
*/
class FeatureModellingFrame extends JXFrame {
private String defaultTitle = "Feature Modeling Tool";
//����ʵ����Ŀ
protected static int instanceCount = 0;
protected final Action aboutAction = new AboutAction("����...");
//�ļ�ѡ��Ի���
protected static final JFileChooser fileChooser = new JFileChooser();
//�˵�
private JMenuBar menuBar = null;
//������
protected JToolBar toolBar = null;
//UI�������
protected JPanel uiPanel = null;
//UI���ɹ���
protected DockingUIComponent dockingUI = null;
//����ģ�����
private FComponent featureModelNGObject = null;
//����ģ��
private FeatureModel featureModel = null;
//�����༭��
private FeatureEditor featureEditor = null;
//����ģ�ͱ༭��
private FeatureModelEditor featureModelEditor = null;
//����ģ�����Ա༭��
private FeatureModelPropertyEditor featureModelPropertyEditor = null;
//������ϵ������
private FeatureRelationManager featureRelationManager = null;
//Լ��ģ��
private ConstraintModel constraintModel = null;
//Լ��ģ�ͱ༭��
private ConstraintModelEditor constraintModelEditor = null;
//PLԼ����ϵ�༭��
private CompositeConstraintEditor plConstraintEditor = null;
//groupԼ����ϵ�༭��
private GroupConstraintEditor gConstraintEditor = null;
//vpԼ����ϵ�༭��
private VPConstraintEditor vpConstraintEditor = null;
//��Դ�����༭��
private ResourceComponentEditor resourceComponentEditor = null;
//����ģ��
private InteractionModel interactionModel = null;
//�����༭��
private InteractionEditor interactionEditor = null;
//����ģ�ͱ༭��
private InteractionModelEditor interactionModelEditor = null;
//gh start
private CustomizationModel customizationModel = null;
//gh end
//ͼԪ�༭�������
private FComponent graphicalEditorNGObject = null;
//ͼԪ�༭��
private GraphicalEditor graphicalEditor = null;
//ͼԪ�༭��UI
private FComponent graphicalEditorUI = null;
//ͼԪ�༭��Action�б�
private FComponent graphicalEditorActionMap = null;
//DrawingView����
private DrawingViewContainer drawingViewContainer = null;
//DropTargetListener
private DropTargetListener graphicalEditorDropTargetListener = null;
//ElementLocator
private ElementLocator elementLocator = null;
//��Ŀ������
private ProjectManager projectManager = null;
//�������Ա༭����
private FeatureInfoEditor featureInfoEditor = null;
//Լ�����Ա༭����
private ConstraintInfoEditor constraintInfoEditor = null;
//���������༭����
private FeatureDescriptionEditor featureDescriptionEditor = null;
//�������Ա༭����
private InteractionInfoEditor interactionInfoEditor = null;
//ģ��������Ϣ�����
private FComponent infoExplorerNGObject = null;
//ģ����Ϣ��������
private InfoExplorer infoExplorer = null;
//ģ����Ϣ��������UI
private JComponent infoExplorerUI = null;
//ģ�ͼ�鹹��
private ModelChecker modelChecker = null;
//ģ�ͼ�鹹��UI
private ModelCheckerUI modelCheckerUI = null;
//ģ�ͼ�鹹��2
private PLModelChecker plModelChecker = null;
private PLModelChecker plModelCheckerOptimized = null;
//ģ�ͼ�鹹��UI2
private PLModelCheckerUI plModelCheckerUI = null;
private PLModelCheckerUI plModelCheckerUIOptimized = null;
//����ʵ乹��
//private DictEditor dictEditor = null;
//�ĵ�������
//private Documentation documentation = null;
//������Ϣ����
private GroupMap informationMap = null;
//Action����
//�½���Ŀ
private Action newProjectAction = null;
//����Ŀ
private Action openProjectAction = null;
//����Ŀ����
private Action modifyProjectPropertiesAction = null;
//������Ŀ
private Action saveProjectAction = null;
//�����Ŀ
private Action saveAsProjectAction = null;
//�ر���Ŀ
private Action closeProjectAction = null;
//�½���ͼ
private Action newViewAction = null;
//�ر���ͼ
private Action closeViewAction = null;
//����ͼ
private Action openViewAction = null;
//ɾ����ͼ
private Action removeViewAction = null;
//�����ͼ
private Action exportViewAction = null;
//����ͼ����
private Action changeViewNameAction = null;
//ͼԪ������ֲ�
//��˶���
private Action leftAlignAction = null;
//��ֱ����
private Action vertAlignAction = null;
//�Ҷ˶���
private Action rightAlignAction = null;
//���˶���
private Action topAlignAction = null;
//ˮƽ����
private Action horiAlignAction = null;
//�˶���
private Action botAlignAction = null;
//����ֲ�
private Action vertDistAction = null;
//����ֲ�
private Action horiDistAction = null;
//ͼԪ�༭
//ͼԪɾ��
private Action deleteAction = null;
//ͼԪ����
private Action copyAction = null;
//ͼԪ����
private Action cutAction = null;
//ͼԪճ��
private Action pasteAction = null;
//ͼԪճ��Ϊ����
private Action pasteAsLinkAction = null;
//ȫ��ѡ��ͼԪ
private Action selectAllAction = null;
//����ѡ��ͼԪ
private Action toggleSelectAction = null;
//�����ײ�
private Action sendToBackAction = null;
//��������
private Action sendToFrontAction = null;
//�ı������ɫ
private Action changeFillColorAction = null;
//�ı�߿���ɫ
private Action changeFrameColorAction = null;
//�ı�������ɫ
private Action changeTextColorAction = null;
//Ԫ�ض�λ����
private ElementLocating elementLocating = null;
//connector between GraohicalEditor and Documentation
private FComponent view_IDMapFC = null;
private Import view_IDMapImport = null;
private View_IDMap view_IDMapExport = null;
protected void customizeCloseOperation() {
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new CustomizedWindowAdapter());
}
/**
* �������Ҫ����һ����Ŀ�ļ����ڴ��ڵĹرհ�ť������ʱ��ϵͳ��ȡ�Ĵ�����
* ����������Ҫ�����У�
* 1.�����ǰ��Ŀû�б����̣������û��Ƿ���̡�
* 2.�����ǰ��Ŀ����һ�δ��̺����ݷ����˱仯�������û��Ƿ��ĺ������
* 3.��1��2���������ʱ�������û�������δ��ڹر��¼���
*/
protected class CustomizedWindowAdapter extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
//����1������closeProjectAction
if(closeProjectAction != null && closeProjectAction.isEnabled()){
closeProjectAction.actionPerformed(null);
return;
}
//����2�������
//����3�������
setVisible(false);
dispose();
System.out.println("there are " + (instanceCount) + " frames now.");
if (instanceCount <= 0) {
System.exit(0);
}
}
}
@Override
public void dispose() {
super.dispose();
instanceCount--;
}
protected class ProjectManagerContextChangeListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (de.FeatureModellingTool.ProjectManager.ConstantDefinition.CLOSE_REQUEST.equals(propertyName)) {
Boolean value = (Boolean) e.getNewValue();
if ((value != null) && (value.booleanValue())) {
setVisible(false);
dispose();
if (instanceCount <= 0) {
System.exit(0);
}
}
}
}
}
/**
* ȱʡ������: �ù���������һ������Ŀ��������ģ���ڣ��ȴ��û���һ���IJ������磬�½���Ŀ������Ŀ�ȶ�����
*/
public FeatureModellingFrame() {
this.setTitle(defaultTitle);
/**
* ʵ����(instancing):
* 1.������Ŀ������
* 2.��ȡ��Ŀ���������е�Actions������
*/
projectManager = de.FeatureModellingTool.ProjectManager.Manager.createProjectManager(-1);
projectManager.getContext().addContextChangeListener(new ProjectManagerContextChangeListener());
newProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.NEW_PROJECT_ACTION);
openProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.OPEN_PROJECT_ACTION);
saveProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_PROJECT_ACTION);
saveAsProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_AS_PROJECT_ACTION);
closeProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CLOSE_PROJECT_ACTION);
modifyProjectPropertiesAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.MODIFY_PROJECT_PROPERTIES_ACTION);
newViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.NEW_VIEW_ACTION);
closeViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CLOSE_VIEW_ACTION);
openViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.OPEN_VIEW_ACTION);
removeViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.REMOVE_VIEW_ACTION);
exportViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.EXPORT_VIEW_ACTION);
changeViewNameAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CHANGE_VIEW_NAME_ACTION);
/**
* ��������װ(semantic composing):
* �����Ŀ�����¼����������ü������ڼ������½���Ŀ�¼������һ����װӦ�ó���
*/
newProjectAction.addPropertyChangeListener(new NewProjectCreatedEventListener());
openProjectAction.addPropertyChangeListener(new ProjectOpenedEventListener());
/**
* UI��װ(UI composing):
* 1.����ǰJFrame��������ӵ���Ŀ�������Ļ�����
* 2.���ļ�ѡ��Ի����������ӵ���Ŀ�������Ļ�����
*/
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.UI_FRAME, this);
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.FILE_CHOOSER, fileChooser);
/**
* ���ɹ�����
*/
toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.add(newProjectAction).setBorderPainted(false);
toolBar.add(openProjectAction).setBorderPainted(false);
toolBar.add(modifyProjectPropertiesAction).setBorderPainted(false);
toolBar.add(saveProjectAction).setBorderPainted(false);
toolBar.addSeparator();
toolBar.add(newViewAction).setBorderPainted(false);
toolBar.add(removeViewAction).setBorderPainted(false);
toolBar.add(exportViewAction).setBorderPainted(false);
toolBar.add(changeViewNameAction).setBorderPainted(false);
getContentPane().add(toolBar, BorderLayout.NORTH);
/**
* ���ɲ˵�
*/
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("��Ŀ����");
fileMenu.add(newProjectAction);
fileMenu.add(openProjectAction);
fileMenu.add(modifyProjectPropertiesAction);
fileMenu.addSeparator();
fileMenu.add(newViewAction);
//fileMenu.add(closeViewAction);
//fileMenu.add(openViewAction);
fileMenu.add(removeViewAction);
fileMenu.add(exportViewAction);
fileMenu.add(changeViewNameAction);
fileMenu.addSeparator();
fileMenu.add(saveProjectAction);
fileMenu.add(saveAsProjectAction);
fileMenu.add(closeProjectAction);
JMenu helpMenu = new JMenu("����");
helpMenu.add(aboutAction);
menuBar.add(fileMenu);
//JMenu m1 = new JMenu("����");
//JMenu m2 = new JMenu("UI����");
//m1.setEnabled(false);
//m2.setEnabled(false);
//menuBar.add(m1);
//menuBar.add(m2);
menuBar.add(helpMenu);
this.setJMenuBar(menuBar);
//���ô�������Ļ�ϵ�λ��
GUIUtility.displayOnScreen(this);
instanceCount++;
customizeCloseOperation();
}
/**
* �ù�������ȡһ����Ŀ��������װ�ص���ǰ������
*
* @param projectManager
* @throws MalformedURLException
*/
public FeatureModellingFrame(ProjectManager projectManager){
//this.setBackground(background);
this.setTitle(defaultTitle);
this.projectManager = projectManager;
projectManager.getContext().addContextChangeListener(new ProjectManagerContextChangeListener());
Project project = (Project) projectManager.getContext().getValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.PROJECT);
/**
* ʵ����(instancing):
* 1.��ȡ��Ŀ���������е�Actions������
* 2.��ȡ����ģ��ʵ������ȡ�����༭��������ģ�ͱ༭��������ģ�����Ա༭��,������ϵ������������
* 3.����ͼԪ�༭��ʵ������ȡͼԪ�༭UI��������ȡͼԪ�༭�����б������
* 4.����ģ��Ԫ�����Ա༭��������ȡ��UI����
* 5.����ģ����Ϣ��������������ȡ��UI����
*/
newProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.NEW_PROJECT_ACTION);
openProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.OPEN_PROJECT_ACTION);
saveProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_PROJECT_ACTION);
saveAsProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_AS_PROJECT_ACTION);
closeProjectAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CLOSE_PROJECT_ACTION);
modifyProjectPropertiesAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.MODIFY_PROJECT_PROPERTIES_ACTION);
newViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.NEW_VIEW_ACTION);
closeViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CLOSE_VIEW_ACTION);
openViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.OPEN_VIEW_ACTION);
removeViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.REMOVE_VIEW_ACTION);
exportViewAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.EXPORT_VIEW_ACTION);
changeViewNameAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CHANGE_VIEW_NAME_ACTION);
featureModelNGObject = (FComponent) projectManager.getContext().getValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.FEATURE_MODEL);
informationMap = (GroupMap) projectManager.getContext().getValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.INFOMATION_MAP);
//new way
featureModel = (FeatureModel) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.FEATURE_MODEL_INTERFACE);
featureEditor = (FeatureEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.FEATURE_EDITOR_INTERFACE);
featureModelEditor = (FeatureModelEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.FEATURE_MODEL_EDITOR_INTERFACE);
featureModelPropertyEditor = (FeatureModelPropertyEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.FEATURE_MODEL_PROPERTY_EDITOR_INTERFACE);
featureRelationManager = (FeatureRelationManager) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.FEATURE_RELATION_MANAGER_INTERFACE);
constraintModel = (ConstraintModel) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.CONSTRAINT_MODEL_INTERFACE);
constraintModelEditor = (ConstraintModelEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.CONSTRAINT_MODEL_EDITOR_INTERFACE);
plConstraintEditor = (CompositeConstraintEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.PL_CONSTRAINT_EDITOR_INTERFACE);
gConstraintEditor = (GroupConstraintEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.GROUP_CONSTRAINT_EDITOR_INTERFACE);
vpConstraintEditor = (VPConstraintEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.VP_CONSTRAINT_EDITOR_INTERFACE);
interactionModel = (InteractionModel) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.INTERACTION_MODEL_INTERFACE);
resourceComponentEditor = (ResourceComponentEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.RESOURCE_COMPONENT_EDITOR_INTERFACE);
interactionEditor = (InteractionEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.INTERACTION_EDITOR_INTERFACE);
interactionModelEditor = (InteractionModelEditor) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.INTERACTION_MODEL_EDITOR_INTERFACE);
//gh start
customizationModel = (CustomizationModel) featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.CUSTOMIZATION_MODEL_INTERFACE);
//gh end
//
Drawing[] drawingArray = (Drawing[]) projectManager.getContext().getValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.DRAWING_ARRAY);
//new way
ManagerInterface mi = de.FeatureModellingTool.GraphicalEditor.Manager.getInstance();
mi.getContext().putValue(de.FeatureModellingTool.GraphicalEditor.Manager.DRAWING_ARRAY_CONTEXT, drawingArray);
try {
graphicalEditorNGObject = (FComponent) mi.getInstance(de.FeatureModellingTool.GraphicalEditor.Manager.GRAPHICAL_EDITOR_NAME, FComponent.class);
} catch (IllegalParameterException ipe) {
}
graphicalEditor = (GraphicalEditor) graphicalEditorNGObject.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.GRAPHICAL_EDITOR_INTERFACE);
graphicalEditorUI = (FComponent) graphicalEditorNGObject.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.GRAPHICAL_EDITOR_UI_NAME);
graphicalEditorActionMap = (FComponent) graphicalEditorNGObject.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.ACTIONS_NAME);
drawingViewContainer = (DrawingViewContainer) graphicalEditorNGObject.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.DRAWING_VIEW_CONTAINER_INTERFACE);
graphicalEditorDropTargetListener = (DropTargetListener) graphicalEditorNGObject.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.DROP_TARGET_LISTENER_INTERFACE);
elementLocator = (ElementLocator) graphicalEditorNGObject.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.ELEMENT_LOCATOR_INTERFACE);
//
leftAlignAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.LEFT_ALIGN);
vertAlignAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.VERTICAL_ALIGN);
rightAlignAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.RIGHT_ALIGN);
topAlignAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.TOP_ALIGN);
horiAlignAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.HORIZONTAL_ALIGN);
botAlignAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.BOTTOM_ALIGN);
vertDistAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.VERTICAL_DISTRIBUTE);
horiDistAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.HORIZONTAL_DISTRIBUTE);
deleteAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_DELETE_ACTION);
deleteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
deleteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
deleteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
deleteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
deleteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL, interactionModel);
deleteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
copyAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_COPY_ACTION);
copyAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
copyAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
copyAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
copyAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
copyAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL, interactionModel);
copyAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
cutAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_CUT_ACTION);
cutAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
cutAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
cutAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
cutAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
cutAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL, interactionModel);
cutAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
pasteAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_PASTE_ACTION);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_EDITOR, featureEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.PL_CONSTRAINT_EDITOR, plConstraintEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.GROUP_CONSTRAINT_EDITOR, gConstraintEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.VP_CONSTRAINT_EDITOR, vpConstraintEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL, interactionModel);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
pasteAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.RESOURCE_COMPONENT_EDITOR, resourceComponentEditor);
pasteAsLinkAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_PASTE_AS_LINK_ACTION);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_EDITOR, featureEditor);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL, interactionModel);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
pasteAsLinkAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.RESOURCE_COMPONENT_EDITOR, resourceComponentEditor);
selectAllAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_SELECT_ALL_ACTION);
toggleSelectAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FIGURE_TOGGLE_SELECT_ACTION);
sendToBackAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.SEND_TO_BACK);
sendToFrontAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.SEND_TO_FRONT);
changeFillColorAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FILL_COLOR_CAHNGE_ACTION);
changeFrameColorAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.FRAME_COLOR_CAHNGE_ACTION);
changeTextColorAction = (Action) graphicalEditorActionMap.getInterface(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.TEXT_COLOR_CAHNGE_ACTION);
changeFillColorAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.UI_FRAME, this);
changeFrameColorAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.UI_FRAME, this);
changeTextColorAction.putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.UI_FRAME, this);
featureInfoEditor = de.FeatureModellingTool.ElementInfoEditor.Manager.createFeatureInfoEditor();
featureDescriptionEditor = de.FeatureModellingTool.ElementInfoEditor.Manager.createFeatureDescriptionEditor();
constraintInfoEditor = de.FeatureModellingTool.ElementInfoEditor.Manager.createConstraintInfoEditor();
interactionInfoEditor = de.FeatureModellingTool.ElementInfoEditor.Manager.createInteractionInfoEditor();
/** old way
* infoExplorer = de.FeatureModellingTool.InfoExplorer.Manager.createInfoExplorer();
* infoExplorerUI = de.FeatureModellingTool.InfoExplorer.Manager.getInfoExplorerUI(infoExplorer);
**/
//new way
try {
infoExplorerNGObject = (FComponent) de.FeatureModellingTool.InfoExplorer.Manager.getInstance().getInstance(de.FeatureModellingTool.InfoExplorer.Manager.INFOEXPLORER_NAME, FComponent.class);
} catch (IllegalParameterException ipe) {
}
infoExplorer = (InfoExplorer) infoExplorerNGObject.getInterface(de.FeatureModellingTool.InfoExplorer.Manager.INFOEXPLORER_INTERFACE);
infoExplorerUI = (JComponent) infoExplorerNGObject.getInterface(de.FeatureModellingTool.InfoExplorer.Manager.JCOMPONENT_INTERFACE);
modelChecker = de.FeatureModellingTool.ModelChecker.Manager.createModelChecker();
modelCheckerUI = de.FeatureModellingTool.ModelChecker.Manager.getModelCheckerUI(modelChecker);
plModelChecker = de.FeatureModellingTool.PLModelChecker.Manager.createModelChecker(false);
((PLModelCheckerImplementation)plModelChecker).SetCustomizationModel(customizationModel);//yh
customizationModel.addPropertyChangeListener(((PLModelCheckerImplementation)plModelChecker).GetCustomizationChangeListener());
plModelCheckerUI = de.FeatureModellingTool.PLModelChecker.Manager.getModelCheckerUI(plModelChecker);
plModelCheckerOptimized = de.FeatureModellingTool.PLModelChecker.Manager.createModelChecker(true);
((PLModelCheckerImplementation)plModelCheckerOptimized).SetCustomizationModel(customizationModel);//yh
customizationModel.addPropertyChangeListener(((PLModelCheckerImplementation)plModelCheckerOptimized).GetCustomizationChangeListener());
plModelCheckerUIOptimized = de.FeatureModellingTool.PLModelChecker.Manager.getModelCheckerUI(plModelCheckerOptimized);
//dictEditor = de.FeatureModellingTool.DictEditor.Manager.createDictEditor();
//documentation = de.FeatureModellingTool.Documentation.Manager.createDocumentation();
elementLocating = de.FeatureModellingTool.ElementLocating.Manager.createElementLocating();
mi = de.FeatureModellingTool.Connector.View_IDMap.Manager.getInstance();
try {
view_IDMapFC = (FComponent) mi.getInstance(de.FeatureModellingTool.Connector.View_IDMap.ConstantDefinition.VIEW_ID_MAP_NAME, FComponent.class);
} catch (IllegalParameterException ipe) {
System.out.println("error when getting view_IDMapFC");
}
view_IDMapImport = (Import) view_IDMapFC.getInterface(de.FeatureModellingTool.Connector.ConstantDefinition.IMPORT_INTERFACE);
view_IDMapExport = (View_IDMap) view_IDMapFC.getInterface(de.FeatureModellingTool.Connector.View_IDMap.ConstantDefinition.VIEW_ID_MAP_INTERFACE);
/**
* ��������װ(semantic composing):
* 1.�����Ŀ�����¼�������
* 2.������ģ�ͣ������༭��������ģ�ͱ༭����ӵ�ͼԪ�༭���Ļ�����
* 3.������ģ�ͣ�����ģ�����Ա༭����ͼԪ�༭�������б���ӵ���Ŀ�������Ļ�����
* 4.������ģ�ͣ������༭��������ģ�ͱ༭��,ͼԪ�༭����ӵ�ģ��Ԫ�ر༭���Ļ�����
* 5.������ģ����ӵ�ģ����Ϣ���������Ļ�����
* 6.������ģ����ӵ�ģ�ͼ�鹹���Ļ�����
*/
newProjectAction.addPropertyChangeListener(new NewProjectCreatedEventListener());
openProjectAction.addPropertyChangeListener(new ProjectOpenedEventListener());
graphicalEditor.getContext().putValue(GraphicalEditor.FEATURE_MODEL, featureModel);
graphicalEditor.getContext().putValue(GraphicalEditor.FEATURE_EDITOR, featureEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.FEATURE_MODEL_EDITOR, featureModelEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.FEATURE_RELATION_MANAGER, featureRelationManager);
graphicalEditor.getContext().putValue(GraphicalEditor.CONSTRAINT_MODEL, constraintModel);
graphicalEditor.getContext().putValue(GraphicalEditor.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.PL_CONSTRAINT_EDITOR, plConstraintEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.GROUP_CONSTRAINT_EDITOR, gConstraintEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.VP_CONSTRAINT_EDITOR, vpConstraintEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.INTERACTION_MODEL, interactionModel);
graphicalEditor.getContext().putValue(GraphicalEditor.RESOURCE_COMPONENT_EDITOR, resourceComponentEditor);
graphicalEditor.getContext().putValue(GraphicalEditor.INTERACTION_MODEL_EDITOR, interactionModelEditor);
//gh start
GraphicalEditorImplementation gei = (GraphicalEditorImplementation)graphicalEditor;
customizationModel.addPropertyChangeListener(gei.getCurrentCustomizationVersionChangeLisenter());
//gh end
//featureRelationManager
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.GRAPHICAL_EDITOR_ACTION_MAP, graphicalEditorActionMap);
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.DRAWING_VIEW_CONTAINER, drawingViewContainer);
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.FEATURE_MODEL_PROPERTY_EDITOR, featureModelPropertyEditor);
featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_EDITOR, featureEditor);
featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.GRAPHICAL_EDITOR, graphicalEditor);
featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_RELATION_MANAGER, featureRelationManager);
featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONTAINER, this);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.COMPOSITE_CONSTRAINT_EDITOR, plConstraintEditor);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.GROUP_CONSTRAINT_EDITOR, gConstraintEditor);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.VP_CONSTRAINT_EDITOR, vpConstraintEditor);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.GRAPHICAL_EDITOR, graphicalEditor);
constraintInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONTAINER, this);
featureDescriptionEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
featureDescriptionEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.GRAPHICAL_EDITOR, graphicalEditor);
featureDescriptionEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONTAINER, this);
featureDescriptionEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.INFOMATION_MAP, informationMap);
interactionInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.INTERACTION_MODEL, interactionModel);
interactionInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.INTERACTION_EDITOR, interactionEditor);
interactionInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.GRAPHICAL_EDITOR, graphicalEditor);
interactionInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONTAINER, this);
infoExplorer.getContext().putValue(de.FeatureModellingTool.InfoExplorer.ConstantDefinition.FEATURE_MODEL, featureModel);
infoExplorer.getContext().putValue(de.FeatureModellingTool.InfoExplorer.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
infoExplorer.getContext().putValue(de.FeatureModellingTool.InfoExplorer.ConstantDefinition.INTERACTION_MODEL, interactionModel);
modelChecker.getContext().putValue(de.FeatureModellingTool.ModelChecker.ConstantDefinition.FEATURE_MODEL, featureModel);
modelChecker.getContext().putValue(de.FeatureModellingTool.ModelChecker.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
plModelChecker.getContext().putValue(de.FeatureModellingTool.ModelChecker.ConstantDefinition.FEATURE_MODEL, featureModel);
plModelChecker.getContext().putValue(de.FeatureModellingTool.ModelChecker.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
plModelCheckerOptimized.getContext().putValue(de.FeatureModellingTool.ModelChecker.ConstantDefinition.FEATURE_MODEL, featureModel);
plModelCheckerOptimized.getContext().putValue(de.FeatureModellingTool.ModelChecker.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
//dictEditor.getContext().putValue(de.FeatureModellingTool.DictEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
elementLocating.getContext().putValue(de.FeatureModellingTool.ElementLocating.ConstantDefinition.INFO_EXPLORER, infoExplorer);
elementLocating.getContext().putValue(de.FeatureModellingTool.ElementLocating.ConstantDefinition.ELEMENT_LOCATOR, elementLocator);
view_IDMapImport.getContext().putValue(de.FeatureModellingTool.Connector.View_IDMap.ConstantDefinition.DRAWING_VIEW_CONTAINER, drawingViewContainer);
//documentation.getContext().putValue(de.FeatureModellingTool.Documentation.ConstantDefinition.FEATURE_MODEL, featureModel);
//documentation.getContext().putValue(de.FeatureModellingTool.Documentation.ConstantDefinition.VIEW_ID_MAP, view_IDMapExport);
/**
* UI��װ(UI composing):
* 1.����ǰJFrame��������ӵ���Ŀ�������Ļ�����
* 2.����ǰJFrame��������ӵ��ĵ���������Ļ�����
* 3.����һ������ͼԪ�༭����UI����壬�����������UI���ɹ�������������
* 4.����ͼ���Ź�����ӵ���������
* 5.��ģ��Ԫ�����Ա༭��UI��ӵ�UI���ɹ������²����� //
* 6.��ģ����Ϣ����UI������ӵ�UI���ɹ�����������
* 7.��ģ�ͼ��UI������ӵ�UI���ɹ������²�����
* 8.��װͼԪ�༭����UI�ĵ���ʽ�˵�
*/
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.UI_FRAME, this);
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.FILE_CHOOSER, fileChooser);
//documentation.getContext().putValue(de.FeatureModellingTool.Documentation.ConstantDefinition.UI_FRAME, this);
//documentation.getContext().putValue(de.FeatureModellingTool.Documentation.ConstantDefinition.FILE_CHOOSER, fileChooser);
JPanel drawingArea = new JPanel();
drawingArea.setLayout(new BorderLayout());
drawingArea.add((JComponent) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.EDITOR_AREA_INTERFACE), BorderLayout.CENTER);
((JToolBar) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.TOOL_BAR_INTERFACE)).setOrientation(SwingConstants.VERTICAL);
((JToolBar) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.TOOL_BAR_INTERFACE)).setFloatable(false);
drawingArea.add((JToolBar) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.TOOL_BAR_INTERFACE), BorderLayout.WEST);
JComponent viewArea = (JComponent) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.EDITOR_AREA_INTERFACE);
viewArea.registerKeyboardAction(copyAction, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK, false), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
viewArea.registerKeyboardAction(pasteAction, KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK, false), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
viewArea.registerKeyboardAction(cutAction, KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK, false), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
viewArea.registerKeyboardAction(deleteAction, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
/***
* uiPanel = new JPanel();
dockingUI = new DockingUIComponent(uiPanel);
DockingUILayout layout = dockingUI.getDockingUILayout();
DockingUIStyleConfigurator configurator = dockingUI.getDockingUIConfigurator();
configurator.setDockingBarVisible(ConstantDefinition.Position.TOP, false);
configurator.setDockingBarVisible(ConstantDefinition.Position.RIG, false);
configurator.setCenterAreaDockingBarPosition(ConstantDefinition.Position.RIG);
configurator.setDockingBarStyle(ConstantDefinition.Position.LEF, ConstantDefinition.EndPoint.TAIL, ConstantDefinition.DockingBarStyle.EXTENDING);
configurator.setDockingBarStyle(ConstantDefinition.Position.BOT, ConstantDefinition.EndPoint.HEAD, ConstantDefinition.DockingBarStyle.EXTENDING);
configurator.setAreaStyle(Position.LEF, AreaStyle.MULTIPLE);
configurator.setAreaStyle(Position.BOT, AreaStyle.MULTIPLE);
*/
uiPanel = new JPanel();
dockingUI = new DockingUIComponent(uiPanel);
DockingUILayout layout = dockingUI.getDockingUILayout();
DockingUIStyleConfigurator configurator = dockingUI.getDockingUIConfigurator();
configurator.setDockingBarVisible(ConstantDefinition.Position.TOP, false);
configurator.setDockingBarVisible(ConstantDefinition.Position.RIG, false);
configurator.setCenterAreaDockingBarPosition(ConstantDefinition.Position.RIG);
configurator.setDockingBarStyle(ConstantDefinition.Position.LEF, ConstantDefinition.EndPoint.TAIL, ConstantDefinition.DockingBarStyle.EXTENDING);
configurator.setDockingBarStyle(ConstantDefinition.Position.BOT, ConstantDefinition.EndPoint.HEAD, ConstantDefinition.DockingBarStyle.EXTENDING);
configurator.setAreaStyle(Position.LEF, AreaStyle.MULTIPLE);
configurator.setAreaStyle(Position.BOT, AreaStyle.MULTIPLE);
Icon icon = null ;
try{
icon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"window16.png"));
}catch(Exception e){
e.printStackTrace();
}
layout.addWindow(drawingArea, "����ģ�ͱ༭��", icon, ConstantDefinition.Position.CEN, true);
infoExplorerUI.setBorder(BorderFactory.createEmptyBorder());
infoExplorerUI.setOpaque(false);
JScrollPane scrollInfoExplorerUI = new JScrollPane(infoExplorerUI);
scrollInfoExplorerUI.setBorder(BorderFactory.createEmptyBorder());
scrollInfoExplorerUI.getViewport().setBackground(Color.white);
//scrollinfoExplorerUI.setMaximumSize(scrollinfoExplorerUI.getPreferredSize());
layout.addWindow(scrollInfoExplorerUI, "��Ϣ���", icon, ConstantDefinition.Position.LEF, true);
//--��treetable�ķ�ʽ���������
//--����ʵ����
InfoExplorer2Implementation ie2 = new InfoExplorer2Implementation();
//--�������װ����װ��������Ľӿ�
ie2.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
ie2.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
///---ע��Ԫ�ض�λ
elementLocating.getContext().putValue(de.FeatureModellingTool.ElementLocating.ConstantDefinition.INFO_EXPLORER2, ie2);
//--UI����װ��������UI���ɵ����������
JScrollPane scrollInfoExplorer2UI = new JScrollPane(ie2.getExplorerComponent());
scrollInfoExplorer2UI.setBorder(BorderFactory.createEmptyBorder());
scrollInfoExplorer2UI.getViewport().setBackground(Color.white);
layout.addWindow(scrollInfoExplorer2UI, "feature tree", icon, ConstantDefinition.Position.LEF, false);
/**
//gh start
CustomizationExplorerImplementation cei = new CustomizationExplorerImplementation();
//--�������װ����װ��������Ľӿ�
cei.getContext().putValue(de.FeatureModellingTool.Customize.ConstantDefinition.CUSTOMIZATION_MODEL , customizationModel);
cei.getContext().putValue(de.FeatureModellingTool.Customize.ConstantDefinition.CONTAINER , this);
cei.getContext().putValue("fm" , featureModel);
cei.getContext().putValue("fe" , featureEditor);
cei.getContext().putValue("fme" , featureModelEditor);
cei.getContext().putValue("cm" , constraintModel);
cei.getContext().putValue("cme" , constraintModelEditor);
cei.getContext().putValue("cce" , plConstraintEditor);
cei.getContext().putValue("gce" , gConstraintEditor);
cei.getContext().putValue("dvs" , this.drawingViewContainer.getAllDrawingViews());
//--UI����װ��������UI���ɵ����������
JScrollPane ceiUI = new JScrollPane(cei.getExplorerComponent());
ceiUI.setBorder(BorderFactory.createEmptyBorder());
layout.addWindow(ceiUI, "ģ�Ͷ���", icon, ConstantDefinition.Position.LEF, false);
// cei.getConstraintExplorer().getContext().putValue(de.FeatureModellingTool.Customize.ConstantDefinition.FEATURE_MODEL , featureModel);
// cei.getConstraintExplorer().getContext().putValue(de.FeatureModellingTool.Customize.ConstantDefinition.CONSTRAINT_MODEL , constraintModel);
ceiUI = new JScrollPane(cei.getConstraintExplorer(featureModel , constraintModel).getExplorerComponent());
ceiUI.setBorder(BorderFactory.createEmptyBorder());
layout.addWindow(ceiUI , "Լ�������", icon, ConstantDefinition.Position.CEN, false);
// layout.addWindow(ceiUI, "customization", icon, ConstantDefinition.Position.LEF, true);
ModelGenerateAction mga = new ModelGenerateAction(featureModel , featureModelEditor , featureEditor , constraintModel , constraintModelEditor , gConstraintEditor , plConstraintEditor);
//gh end
**/
/**
layout.addWindow(modelCheckerUI.getCheckerComponent(), "ģ�ͼ��-�汾1", icon, ConstantDefinition.Position.BOT, false);
plModelCheckerUI.getCheckerComponent().setBorder(BorderFactory.createEmptyBorder());
JScrollPane scrollModelCheckerUI = new JScrollPane(plModelCheckerUI.getCheckerComponent());
scrollModelCheckerUI.setBorder(BorderFactory.createEmptyBorder());
layout.addWindow(scrollModelCheckerUI, "ģ�ͼ��-�汾2", icon, ConstantDefinition.Position.BOT, false);
**/
plModelCheckerUIOptimized.getCheckerComponent().setBorder(BorderFactory.createEmptyBorder());
JScrollPane scrollModelCheckerUIOptimized = new JScrollPane(plModelCheckerUIOptimized.getCheckerComponent());
scrollModelCheckerUIOptimized.setBorder(BorderFactory.createEmptyBorder());
layout.addWindow(scrollModelCheckerUIOptimized, "ģ�ͼ��-�汾���Ż���", icon, ConstantDefinition.Position.BOT, true);
/*
JComponent GUILogger = new StdInterceptingPane(true, true);
GUILogger.setBorder(BorderFactory.createEmptyBorder());
capricePanel.add(GUILogger, null, "������Ϣ", SwingConstants.SOUTH);
*/
//--Ԫ��������ͼ
//--����ʵ����
ElementPropertiesView2 elementProperties = new ElementPropertiesView2();
//--�������װ
elementProperties.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL, featureModel);
graphicalEditor.addPropertyChangeListener(elementProperties);
//--UI����װ
JScrollPane propertiesPane = new JScrollPane(elementProperties);
layout.addWindow(propertiesPane, "Ԫ������", icon, ConstantDefinition.Position.BOT, true);
getContentPane().add(uiPanel, BorderLayout.CENTER);
/**
* UIDefaults u = UIManager.getDefaults();
* Enumeration elements = u.keys();
* for (; elements.hasMoreElements();) {
* Object o = elements.nextElement();
* System.out.println(o + ":" + u.get(o));
* }
**/
//���ɹ�����
toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.add(newProjectAction).setBorderPainted(false);
toolBar.add(openProjectAction).setBorderPainted(false);
toolBar.add(modifyProjectPropertiesAction).setBorderPainted(false);
toolBar.add(saveProjectAction).setBorderPainted(false);
toolBar.addSeparator();
toolBar.add(newViewAction).setBorderPainted(false);
toolBar.add(changeViewNameAction).setBorderPainted(false);
toolBar.add(removeViewAction).setBorderPainted(false);
toolBar.add(exportViewAction).setBorderPainted(false);
toolBar.addSeparator();
toolBar.add((JComponent) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.SCALE_COMPONENT_INTERFACE));
getContentPane().add(toolBar, BorderLayout.NORTH);
/**
* ���ɲ˵�
*
*/
//����ʽ�˵�
JPopupMenu popupMenu = (JPopupMenu) graphicalEditorUI.getInterface(de.FeatureModellingTool.GraphicalEditor.Manager.EDITOR_AREA_POPUP_MENU_INTERFACE);
JMenu editMenuP = new JMenu("�༭");
editMenuP.add(selectAllAction);
editMenuP.add(toggleSelectAction);
editMenuP.addSeparator();
editMenuP.add(sendToBackAction);
editMenuP.add(sendToFrontAction);
editMenuP.addSeparator();
editMenuP.add(cutAction);
editMenuP.add(copyAction);
editMenuP.add(pasteAction);
editMenuP.add(pasteAsLinkAction);
editMenuP.addSeparator();
editMenuP.add(deleteAction);
//cutAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK, true));
//copyAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK, true));
//pasteAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK, true));
JMenu alignMenuP = new JMenu("������ֲ�");
alignMenuP.add(leftAlignAction);
alignMenuP.add(vertAlignAction);
alignMenuP.add(rightAlignAction);
alignMenuP.addSeparator();
alignMenuP.add(topAlignAction);
alignMenuP.add(horiAlignAction);
alignMenuP.add(botAlignAction);
alignMenuP.addSeparator();
alignMenuP.add(vertDistAction);
alignMenuP.add(horiDistAction);
JMenu attributeMenuP = new JMenu("ͼԪ��ʽ");
attributeMenuP.add(changeFillColorAction);
attributeMenuP.add(changeFrameColorAction);
attributeMenuP.add(changeTextColorAction);
popupMenu.add(featureInfoEditor.getEntryAction());
//popupMenu.add(featureDescriptionEditor.getEntryAction());
popupMenu.add(constraintInfoEditor.getEntryAction());
popupMenu.add(interactionInfoEditor.getEntryAction());
popupMenu.addSeparator();
popupMenu.add(editMenuP);
popupMenu.add(alignMenuP);
popupMenu.add(attributeMenuP);
//gh start
JMenu customizationMenu = new JMenu("����");
customizationMenu.add(gei.getCustomizationUndecideAction());
customizationMenu.add(gei.getCustomizationSelectAction());
customizationMenu.add(gei.getCustomizationUnselectAction());
popupMenu.add(customizationMenu);
//gh end
//�����ڲ˵�
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("��Ŀ����");
fileMenu.add(newProjectAction);
fileMenu.add(openProjectAction);
fileMenu.add(modifyProjectPropertiesAction);
fileMenu.addSeparator();
fileMenu.add(saveProjectAction);
fileMenu.add(saveAsProjectAction);
fileMenu.add(closeProjectAction);
JMenu viewMenu = new JMenu("��ͼ����");
viewMenu.add(newViewAction);
viewMenu.add(changeViewNameAction);
//fileMenu.add(closeViewAction);
//fileMenu.add(openViewAction);
viewMenu.add(removeViewAction);
viewMenu.addSeparator();
viewMenu.add(exportViewAction);
/**
* JMenu editMenu = new JMenu("�༭");
* editMenu.add(selectAllAction);
* editMenu.add(toggleSelectAction);
* editMenu.addSeparator();
* editMenu.add(sendToBackAction);
* editMenu.add(sendToFrontAction);
* editMenu.addSeparator();
* editMenu.add(cutAction);
* editMenu.add(copyAction);
* editMenu.add(pasteAction);
* editMenu.add(pasteAsLinkAction);
* editMenu.addSeparator();
* editMenu.add(deleteAction);
*
* JMenu alignMenu = new JMenu("������ֲ�");
* alignMenu.add(leftAlignAction);
* alignMenu.add(vertAlignAction);
* alignMenu.add(rightAlignAction);
* alignMenu.addSeparator();
* alignMenu.add(topAlignAction);
* alignMenu.add(horiAlignAction);
* alignMenu.add(botAlignAction);
* alignMenu.addSeparator();
* alignMenu.add(vertDistAction);
* alignMenu.add(horiDistAction);
*
* JMenu attributeMenu = new JMenu("ͼԪ��ʽ");
* attributeMenu.add(changeFillColorAction);
* attributeMenu.add(changeFrameColorAction);
* attributeMenu.add(changeTextColorAction);
**/
JMenu toolMenu = new JMenu("����");
//toolMenu.add(mga);
toolMenu.add(modelChecker.getEntryAction());
toolMenu.add(plModelChecker.getEntryAction());
toolMenu.add(plModelCheckerOptimized.getEntryAction());
//toolMenu.add(dictEditor.getEntryAction());
//toolMenu.add(documentation.getEntryAction());
JMenu uiMenu = dockingUI.getMenuConfigurator();
JMenu helpMenu = new JMenu("����");
helpMenu.add(aboutAction);
menuBar.add(fileMenu);
menuBar.add(viewMenu);
menuBar.add(toolMenu);
menuBar.add(uiMenu);
menuBar.add(helpMenu);
this.setJMenuBar(menuBar);
//���infoExplorerUI��drag��
DragSource dragSource = DragSource.getDefaultDragSource();
DragGestureListener infoExplorerUIDragGestureListener = (DragGestureListener) infoExplorerNGObject.getInterface(de.FeatureModellingTool.InfoExplorer.Manager.DRAGGESTURELISTENER_INTERFACE);
dragSource.createDefaultDragGestureRecognizer(infoExplorerUI, DnDConstants.ACTION_LINK, infoExplorerUIDragGestureListener);
//
//���graphicalEditor��drop��
DropTarget dropTarget = new DropTarget(null, DnDConstants.ACTION_LINK, graphicalEditorDropTargetListener, true, null);
graphicalEditor.getContext().putValue(de.FeatureModellingTool.GraphicalEditor.ConstantDefinition.DROP_TARGET, dropTarget);
//
GUIUtility.displayOnScreen(this);
instanceCount++;
customizeCloseOperation();
/**
//gh pattern begin
PatternBase pb = de.FeatureModellingTool.PatternBase.Manager.createPatternBase();
pb = pb.load();
PatternGraphicalEditor pge = new PatternGraphicalEditor(this , pb);
graphicalEditor.getContext().putValue(de.FeatureModellingTool.Pattern.ConstantDefinition.PATTERN_BASE , pb);
graphicalEditor.getContext().putValue("CONTAINER" , this);
layout.addWindow(pge.getEditorArea() , "ģ��༭��" , icon , ConstantDefinition.Position.CEN, false);
//popupMenu.add(((GraphicalEditorImplementation)graphicalEditor).getUsePatternAction_Base());
PatternExplorerImplementation pei = new PatternExplorerImplementation();
//--�������װ����װ��������Ľӿ�
pei.getContext().putValue(de.FeatureModellingTool.Pattern.ConstantDefinition.PATTERN_BASE , pb);
//--UI����װ��������UI���ɵ����������
JScrollPane peiUI = new JScrollPane(pei.getExplorerComponent());
peiUI.setBorder(BorderFactory.createEmptyBorder());
peiUI.getViewport().setBackground(Color.white);
layout.addWindow(peiUI, "Pattern", icon, ConstantDefinition.Position.LEF, false);
pei.addPropertyChangeListener(de.FeatureModellingTool.Pattern.ConstantDefinition.CURRENT_TEMPLATE , pge.getCurrentTemplateChangeListener());
//gh pattern end
**/
}
protected class NewProjectCreatedEventListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (de.FeatureModellingTool.ProjectManager.ConstantDefinition.PROJECT_CREATED.equals(propertyName)) {
ProjectManager newProjectManager = (ProjectManager) e.getNewValue();
Project currentProject = (Project) projectManager.getContext().getValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.PROJECT);
FeatureModellingFrame instance = null ;
try{
instance = new FeatureModellingFrame(newProjectManager);
}catch(Exception se){
se.printStackTrace();
}
if (currentProject == null)
instance.setBounds(FeatureModellingFrame.this.getBounds());
instance.setVisible(true);
instance.invalidate();
if (currentProject == null) {
FeatureModellingFrame.this.setVisible(false);
FeatureModellingFrame.this.dispose();
}
}
}
}
protected class ProjectOpenedEventListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (de.FeatureModellingTool.ProjectManager.ConstantDefinition.PROJECT_OPENED.equals(propertyName)) {
ProjectManager pm = (ProjectManager) e.getNewValue();
Project currentProject = (Project) projectManager.getContext().getValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.PROJECT);
if (currentProject == null) {
Rectangle rect = FeatureModellingFrame.this.getBounds();
FeatureModellingFrame instance = new FeatureModellingFrame(pm);
instance.setBounds(rect);
FeatureModellingFrame.this.dispose();
instance.setVisible(true);
} else {
FeatureModellingFrame instance = new FeatureModellingFrame(pm);
instance.setVisible(true);
}
}
}
}
private class AboutAction extends AbstractAction {
static final String ABOUTMSG = " ������ɱ�����ѧ-����ʵ���������������ʵ���ң�\n �����о�С���д. \n http://www.sei.pku.edu.cn/belljointlab/dr.jsp";
final JXHyperlink hlink = new JXHyperlink();
public AboutAction(String title) {
super(title);
}
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(FeatureModellingFrame.this, ABOUTMSG, (String) this.getValue(Action.NAME), JOptionPane.INFORMATION_MESSAGE);
}
}
}