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�ĵ���ʽ�˵�
*/
// Baipeng
projectManager
.getContext()
.putValue(
de.FeatureModellingTool.ProjectManager.ConstantDefinition.UI_JPANEL,
this);
projectManager
.getContext()
.putValue(
de.FeatureModellingTool.ProjectManager.ConstantDefinition.FILE_CHOOSER,
fileChooser);
projectManager
.getContext()
.putValue(
de.FeatureModellingTool.ProjectManager.ConstantDefinition.MODEL_CHOOSER,
modelChooser);
documentation
.getContext()
.putValue(
de.FeatureModellingTool.Documentation.ConstantDefinition.UI_JPANEL,
this);
documentation
.getContext()
.putValue(
de.FeatureModellingTool.Documentation.ConstantDefinition.FILE_CHOOSER,
fileChooser);
documentation
.getContext()
.putValue(
de.FeatureModellingTool.Documentation.ConstantDefinition.MODEL_CHOOSER,
modelChooser);
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);
Icon icon = new ImageIcon(getClass().getResource(
"resources/window16.png"));
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
// //modelCheckerUI.getCheckerComponent().setBorder(BorderFactory.createEmptyBorder());
// JScrollPane scrollModelCheckerUI = new
// JScrollPane(modelCheckerUI.getCheckerComponent());
// scrollModelCheckerUI.setBorder(BorderFactory.createEmptyBorder());
layout.addWindow(modelCheckerUI.getCheckerComponent(), "ģ�ͼ��-�汾1",
icon, ConstantDefinition.Position.BOT, true);
plModelCheckerUI.getCheckerComponent().setBorder(
BorderFactory.createEmptyBorder());
JScrollPane scrollModelCheckerUI = new JScrollPane(plModelCheckerUI
.getCheckerComponent());
scrollModelCheckerUI.setBorder(BorderFactory.createEmptyBorder());
layout.addWindow(scrollModelCheckerUI, "ģ�ͼ��-�汾2", icon,
ConstantDefinition.Position.BOT, true);
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);
add(uiPanel, BorderLayout.CENTER); // Baipeng
/**
* 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(openProjectFromDBAction).setBorderPainted(false);
toolBar.add(modifyProjectPropertiesAction).setBorderPainted(false);
toolBar.add(saveProjectAction).setBorderPainted(false);
toolBar.add(saveProjectToDBAction).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));
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
// �����ڲ˵�
JMenuBar menuBar = new JMenuBar();