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);
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);
// ((GraphicalEditorImplementation)graphicalEditor).pge = pge;
// popupMenu.add(((GraphicalEditorImplementation)graphicalEditor).getPasteFeatureTreeAction());
popupMenu.add(((GraphicalEditorImplementation)graphicalEditor).getUsePatternAction_Base());
// popupMenu = pge.getGraphicalEditorUI().getEditorAreaPopupMenu();
// featureInfoEditor = de.FeatureModellingTool.ElementInfoEditor.Manager.createFeatureInfoEditor();
// featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_MODEL, featureModelNGObject.getInterface(de.FeatureModellingTool.FeatureModel.Manager.FEATURE_MODEL_INTERFACE));
// 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, pge);
// featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.FEATURE_RELATION_MANAGER, featureRelationManager);
// featureInfoEditor.getContext().putValue(de.FeatureModellingTool.ElementInfoEditor.ConstantDefinition.CONTAINER, this);
// deleteAction = (Action) pge.getActionMap().get(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);
//
// popupMenu.add(featureInfoEditor.getEntryAction());
// popupMenu.add(deleteAction);
// popupMenu.add(pge.getCloneFeatureTreeAction());
//
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