mnqmainframe.java
来自「UCS (Ultra Corba Simulator) is one more 」· Java 代码 · 共 1,521 行 · 第 1/5 页
JAVA
1,521 行
caseTreeView = new JScrollPane(caseTree);
specTreeView = new JScrollPane(specTree);
// Create the HTML viewing pane.
idlPane = new IdlTextEditor();// new HighlightTextPane();
idlPane.setSelectionColor(Color.RED);
// idlPane.setBackground(new Color(231, 255, 206));
// idlPane.setEditable(false);
htmlView = new JScrollPane(idlPane);
// Create the Log Panel
// Create the whole Down Panel Container
JPanel downPanel = new JPanel();
downPanel.setLayout(new BorderLayout());
// Crate status bar
status = new JLabel("Status Bar");
commonPane = new HighlightTextPane();
commonPane.setBackground(new Color(231, 224, 241));
commonPane.setEditable(false);
clientPane = new HighlightTextPane();
clientPane.setBackground(new Color(231, 224, 241));
clientPane.setEditable(false);
serverPane = new HighlightTextPane();
serverPane.setBackground(new Color(231, 224, 241));
serverPane.setEditable(false);
notiPane = createNotificationPanel();
// // servant extension eiditor pane initialization
// seEditorPane = new HighlightTextPane();
// seEditorPane.setBackground(new Color(231, 224, 241));
// seEditorPane.setEditable(true);
// // add document listener to highlight java syntax
// seEditorPane.getDocument().addDocumentListener(new
// JavaDocumentListener(seEditorPane));
// servant extension eiditor pane initialization
seEditor = new JavaTextEditor();
// Create Tabbed Panel
tabbedOutput = new TabbedPanel();
commonScroll = new JScrollPane(commonPane);
clientScroll = new JScrollPane(clientPane);
serverScroll = new JScrollPane(serverPane);
// servant extension eidtor
// seEditorScroll = new JScrollPane(seEditorPane);
seEditorScroll = new JScrollPane(seEditor);
TitledTab tab_com = new TitledTab("Common Output", null, commonScroll, null);
TitledTab tab_cli = new TitledTab("Client Output", null, clientScroll, null);
TitledTab tab_srv = new TitledTab("Server Output", null, serverScroll, null);
TitledTab tab_se = new TitledTab("Server Extension Editor", null, seEditorScroll, null);
TitledTab tab_ntf = new TitledTab("Notification Output", null, notiPane, null);
tab_com.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_com));
tab_cli.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_cli));
tab_srv.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_srv));
tab_se.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_se));
tab_ntf.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_ntf));
tab_com.getProperties().addSuperObject(titledTabProperties);
tab_cli.getProperties().addSuperObject(titledTabProperties);
tab_srv.getProperties().addSuperObject(titledTabProperties);
tab_se.getProperties().addSuperObject(titledTabProperties);
tab_ntf.getProperties().addSuperObject(titledTabProperties);
tabbedOutput.addTab(tab_com);
tabbedOutput.addTab(tab_cli);
tabbedOutput.addTab(tab_srv);
tabbedOutput.addTab(tab_ntf);
tabbedOutput.addTab(tab_se);
tabbedOutput.getProperties().addSuperObject(theme.getTabbedPanelProperties());
createClearSavePanel();
downPanel.add("Center", tabbedOutput);
downPanel.add("South", status);
// create split panel to store paraTree & resultTree
// para_result = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
// para_result.setTopComponent(paraTreeView);
// para_result.setBottomComponent(resultTreeView);
// Create Tabbed Panel for paraTree&caseTree
treeTab = new TabbedPanel();
// treeTab.setTabAreaComponents(new
// JComponent[]{TabPaneHandler.createMinButton(treeTab,false),TabPaneHandler.createMaxButton(treeTab,false),TabPaneHandler.createCloseTabsButton(treeTab)});
treeTab.setTabAreaComponents(new JComponent[] {
TabPaneHandler.createMinButton(treeTab, false),
TabPaneHandler.createMaxButton(treeTab, false) });
// treeTab.setTabPlacement(JTabbedPane.TOP);
NtfUtil.init(this);
NSUtil.init(this);
TitledTab tab_idlb = new TitledTab("IdlBrowser", null, htmlView, null);
// Disable result tree view
TitledTab tab_ope = new TitledTab("OperationEntry", null, paraTreeView, null);
// TitledTab tab_ope = new TitledTab("OperationEntry", null,
// para_result, null);
TitledTab tab_opf = new TitledTab("OperationFlow", null, caseTreeView, null);
TitledTab tab_spec = new TitledTab("SpecGeneration", null, specTreeView, null);
TitledTab tab_ntfm = new TitledTab("NtfManager", null, NtfUtil.splitPane, null);
TitledTab tab_nsm = new TitledTab("NsManager", null, NSUtil.splitPane, null);
tab_idlb.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_idlb));
tab_ope.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_ope));
tab_opf.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_opf));
tab_spec.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_spec));
tab_ntfm.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_ntfm));
tab_nsm.setHighlightedStateTitleComponent(TabPaneHandler.createCloseTabButton(tab_nsm));
tab_idlb.getProperties().addSuperObject(titledTabProperties);
tab_ope.getProperties().addSuperObject(titledTabProperties);
tab_opf.getProperties().addSuperObject(titledTabProperties);
tab_spec.getProperties().addSuperObject(titledTabProperties);
tab_ntfm.getProperties().addSuperObject(titledTabProperties);
tab_nsm.getProperties().addSuperObject(titledTabProperties);
treeTab.addTab(tab_idlb);
treeTab.addTab(tab_ope);
treeTab.addTab(tab_opf);
treeTab.addTab(tab_spec);
treeTab.addTab(tab_ntfm);
treeTab.addTab(tab_nsm);
treeTab.getProperties().addSuperObject(theme.getTabbedPanelProperties());
// Add the scroll panes to a split pane.
upsplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// upsplitPane.setLeftComponent(jpUL);
upsplitPane.setLeftComponent(content_operation_tab);
upsplitPane.setRightComponent(treeTab);
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setTopComponent(upsplitPane);
splitPane.setBottomComponent(downPanel);
// add menu in this JFrame
addMenu();
// MNQToolBar tbar = setUpToolBar();
JPanel jpanel = new JPanel();
jpanel.setLayout(new BorderLayout());
// jpanel.add(tbar, BorderLayout.CENTER);
getContentPane().setLayout(new BorderLayout());
getContentPane().add("North", jpanel);
getContentPane().add("Center", splitPane);
popupMenu = new JPopupMenu();
addEleMI = new JMenuItem("Add One Element");
addEleMI.addActionListener(this);
delAllEleMI = new JMenuItem("Remove All Elements");
delAllEleMI.addActionListener(this);
delFirstEleMI = new JMenuItem("Remove First Element");
delFirstEleMI.addActionListener(this);
delLastEleMI = new JMenuItem("Remove Last Element");
delLastEleMI.addActionListener(this);
setDsiMenuItem = new JMenuItem("CreateServant");
setDsiMenuItem.addActionListener(this);
removeAllServants = new JMenuItem("RemoveAllServants");
removeAllServants.addActionListener(this);
removeOneServant = new JMenuItem("RemoveOneServant");
removeOneServant.addActionListener(this);
setIorMenuItem = new JMenuItem("SetIorDirectly");
setIorMenuItem.addActionListener(this);
invokeMenuItem = new JMenuItem("Invoke");
invokeMenuItem.addActionListener(this);
saveOpMenuItem = new JMenuItem("SaveOperation");
saveOpMenuItem.addActionListener(this);
loadOpMenuItem = new JMenuItem("LoadOperation");
loadOpMenuItem.addActionListener(this);
// for servant extension
serExtMenuItem = new JMenuItem("ServerExtension");
serExtMenuItem.addActionListener(this);
// for workflow
addTestCaseMenuItem = new JMenuItem("AddOperation");
addTestCaseMenuItem.addActionListener(this);
delTestCaseMenuItem = new JMenuItem("RemoveOperation");
delTestCaseMenuItem.addActionListener(this);
delAllTCMenuItem = new JMenuItem("RemoveAllOperation");
delAllTCMenuItem.addActionListener(this);
saveTestSuitMenuItem = new JMenuItem("SaveOperationFlow");
saveTestSuitMenuItem.addActionListener(this);
replaceParaMenuItem = new JMenuItem("SetDependency");
replaceParaMenuItem.addActionListener(this);
exeTestSuitMenuItem = new JMenuItem("ExecuteOperationFlow");
exeTestSuitMenuItem.addActionListener(this);
expandSelectedCaseNode = new JMenuItem("Expand_Selected_Node");
expandSelectedCaseNode.addActionListener(this);
collapseAllCaseNode = new JMenuItem("Collapse_All_Node");
collapseAllCaseNode.addActionListener(this);
cancelReplaceMenuItem = new JMenuItem("CancelDependency");
cancelReplaceMenuItem.addActionListener(this);
setPatternMenuItem = new JMenuItem("SetMatchCondition");
setPatternMenuItem.addActionListener(this);
autoAddMatchConMenuItem = new JMenuItem("AutomaticAddMatchCondition");
autoAddMatchConMenuItem.addActionListener(this);
cancelAllMatchCondition = new JMenuItem("CancelAllMatchConditionUnderThisNode");
cancelAllMatchCondition.addActionListener(this);
cancelPatternMenuItem = new JMenuItem("CancelMatchCondition");
cancelPatternMenuItem.addActionListener(this);
enableIteratorMenuItem = new JMenuItem("EnableIterator");
enableIteratorMenuItem.addActionListener(this);
cancelIteratorMenuItem = new JMenuItem("CancelIterator");
cancelIteratorMenuItem.addActionListener(this);
openTestSuitMenuItem = new JMenuItem("OpenOperationFlow");
openTestSuitMenuItem.addActionListener(this);
genSpecMenuItem = new JMenuItem("GenerateTestSpec");
genSpecMenuItem.addActionListener(this);
disableInterfaceButton();
disableOperationButton();
// initialize the current diretory
currentDir = CorbaMNQ.projectDir + File.separator + "scripts";
resetURLClassLoader();
}
// Listener for Action
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
if (action.equals("Obtain ior for Sequence PushConsumer")) {
try {
if (ior_pc.equalsIgnoreCase("")) {
String tag = "YellowDuck_Seq_PushConsumer";
Servant servant = pushConsumer;
CorbaMNQ.poa.activate_object_with_id(tag.getBytes(), servant);
org.omg.CORBA.Object o = CorbaMNQ.poa.servant_to_reference(servant);
ior_pc = TypeBase.orb.object_to_string(o);
// enable "Deactive Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(2).setEnabled(true);
// disable "Active Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(1).setEnabled(false);
}
commonPane
.appendln("The following is the Sequence PushConsumer ior string output:");
commonPane.appendln(ior_pc);
commonPane.appendln("");
} catch (Exception ex) {
LoggerTool.logStackTrace(ex, LOG);
}
} else if (action.equals("Active Sequence PushConsumer")) {
try {
String tag = "YellowDuck_Seq_PushConsumer";
Servant servant = pushConsumer;
CorbaMNQ.poa.activate_object_with_id(tag.getBytes(), servant);
org.omg.CORBA.Object o = CorbaMNQ.poa.servant_to_reference(servant);
ior_pc = TypeBase.orb.object_to_string(o);
commonPane.appendln("The Sequence PushConsumer is active.");
commonPane.appendln(ior_pc);
commonPane.appendln("");
// enable "Deactive Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(2).setEnabled(true);
// disable "Active Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(1).setEnabled(false);
} catch (ObjectAlreadyActive ex) {
commonPane.appendln("The Sequence PushConsumer is already active.");
commonPane.appendln("");
// enable "Deactive Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(2).setEnabled(true);
// disable "Active Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(1).setEnabled(false);
} catch (Exception ex) {
LoggerTool.logStackTrace(ex, LOG);
}
} else if (action.equals("Deactive Sequence PushConsumer")) {
if (ior_pc.equalsIgnoreCase(""))
return;
try {
org.omg.CORBA.Object servant = TypeBase.orb.string_to_object(ior_pc);
CorbaMNQ.poa.deactivate_object(CorbaMNQ.poa.reference_to_id(servant));
commonPane.appendln("The Sequence PushConsumer is deactive.");
commonPane.appendln("");
// disable "Deactive Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(2).setEnabled(false);
// enable "Active Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(1).setEnabled(true);
} catch (ObjectNotActive ex) {
commonPane.appendln("The Sequence PushConsumer is already deactive.");
commonPane.appendln("");
// disable "Deactive Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(2).setEnabled(false);
// enable "Active Sequence PushConsumer"
menuBar.getMenu(1).getMenuComponent(1).setEnabled(true);
} catch (Exception ex) {
LoggerTool.logStackTrace(ex, LOG);
}
} else if (action.equals("Start test mode")) {
SequencePushConsumerImpl.startTestMode();
// disable "Start test mode"
menuBar.getMenu(1).getMenuComponent(3).setEnabled(false);
// enable "Stop test mode"
menuBar.getMenu(1).getMenuComponent(4).setEnabled(true);
} else if (action.equals("Stop test mode")) {
SequencePushConsumerImpl.stopTestMode();
// enable "Start test mode"
menuBar.getMenu(1).getMenuComponent(3).setEnabled(true);
// disable "Stop test mode"
menuBar.getMenu(1).getMenuComponent(4).setEnabled(false);
} else if (action.equals("Start sleep mode")) {
SequencePushConsumerImpl.setSleep(true);
commonPane.appendln("SequencePushConsumer enters into <SleepMode>.");
// disable "Start sleep mode"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?