mnqmainframe.java
来自「UCS (Ultra Corba Simulator) is one more 」· Java 代码 · 共 1,521 行 · 第 1/5 页
JAVA
1,521 行
public static JTree caseTree;
// Client Output
public static HighlightTextPane clientPane;
public static JScrollPane clientScroll;
// Common Output
public static HighlightTextPane commonPane;
public static JScrollPane commonScroll;
// root string for content tree
public static String CONTENT_ROOT_STRING = "Content_Tree";
// interface tag
private static JTree contentTree;
private static MNQMutableTreeNode currentCasePara;
// This class loader is used to load the servant extension class,
// which is provided by user.
public static URLClassLoader dsiCL;
public static MNQmainFrame frame = null;
// IDL Browser
// public static HighlightTextPane idlPane;
// new idl browser
public static IdlTextEditor idlPane;
public static JButton i_1;
public static JButton i_2;
public static JButton i_3;
public static JButton i_4;
public static JButton i_5;
private static IdlInterface inSelected;
public static String ior_pc = "";
// compiler from sun
private static Main javac = new Main();
/** used for java.util.logging */
private static final Logger LOG = Logger.getLogger(MNQmainFrame.class.getName());
// menu bar
public static JMenuBar menuBar;
public static String[] notiHeader = { "Arrived", "Domain Name", "Type Name", "Event Name",
"Variable Header", "Filterable Data", "Remainder" };
public static DefaultTableModel notiModel;
// Notification Output
public static JPanel notiPane;
public static JTable notiTable;
public static JButton o_1;
public static JButton o_2;
public static JButton o_3;
private static IdlOperation onSelected;
// root string for idl tree
public static String OPERATION_ROOT_STRING = "Operation_Tree";
// IDL Browser tag
private static JTree operationTree;
// root string for parameter tree
public static String PARA_ROOT_STRING = "Input Entry";
public static JTree paraTree;
public static EtcProperties props = GetEtcTool.getProperties();
public static SequencePushConsumerImpl pushConsumer = new SequencePushConsumerImpl();
// root string for result expected tree
public static String RESULT_ROOT_STRING = "Check Entry";
public static JLabel rowLabel;
// servant extension editor
public static HighlightTextPane seEditorPane;
// new written java editor for servant extension
public static JavaTextEditor seEditor;
// public static JTree resultTree;
public static JScrollPane seEditorScroll;
static final long serialVersionUID = -3627131612291651494L;
// Server Output
public static HighlightTextPane serverPane;
public static JScrollPane serverScroll;
public static String SPEC_ROOT_STRING = "All";
public static JTree specTree;
private static CTSequence stSelectedPar = null;
// private static CTSequence stSelectedRes = null;
public static MNQMutableTreeNode top_CaseTree = new MNQMutableTreeNode(CASE_ROOT_STRING);
private static MNQMutableTreeNode top_ParaTree = new MNQMutableTreeNode(PARA_ROOT_STRING);
// private static MNQMutableTreeNode top_ResultTree = new
// MNQMutableTreeNode(RESULT_ROOT_STRING);
public static MNQMutableTreeNode top_SpecTree = new MNQMutableTreeNode(SPEC_ROOT_STRING);
public static void buildParaSibling(MNQMutableTreeNode parent, TypeBase node, JTree tree) {
if (tree == null)
tree = MNQmainFrame.paraTree;
// handle CTDeclaration
if (node instanceof CTDeclaration) {
TypeBase t_sib = ((CTDeclaration) node).t_in;
MNQMutableTreeNode dMTN_sib = new MNQMutableTreeNode(t_sib);
parent.add(dMTN_sib);
t_sib.dmtn = dMTN_sib;
ArgsCellEditor.createTreeCellEditorComponent(dMTN_sib, tree);
buildParaSibling(dMTN_sib, t_sib, tree);
return;
}
// handle CTStruct
if (node instanceof CTStruct) {
CTStruct st = (CTStruct) node;
for (int i = 0; i < st.mems.size(); i++) {
TypeBase t_sib = (TypeBase) st.memType.get(i);
MNQMutableTreeNode dMTN_sib = new MNQMutableTreeNode(t_sib);
parent.add(dMTN_sib);
t_sib.dmtn = dMTN_sib;
t_sib.disName = (String) st.mems.get(i);
ArgsCellEditor.createTreeCellEditorComponent(dMTN_sib, tree);
buildParaSibling(dMTN_sib, t_sib, tree);
}
return;
}
// handle CTArray
if (node instanceof CTArray) {
CTArray at = (CTArray) node;
for (int i = 0; i < at.len; i++) {
TypeBase t_sib = at.t_in.cloneType();
MNQMutableTreeNode dMTN_sib = new MNQMutableTreeNode(t_sib);
parent.add(dMTN_sib);
t_sib.dmtn = dMTN_sib;
ArgsCellEditor.createTreeCellEditorComponent(dMTN_sib, tree);
buildParaSibling(dMTN_sib, t_sib, tree);
}
return;
}
// handle CTExcept
if (node instanceof CTExcept) {
CTExcept et = (CTExcept) node;
for (int i = 0; i < et.mems.size(); i++) {
TypeBase t_sib = (TypeBase) et.memType.get(i);
MNQMutableTreeNode dMTN_sib = new MNQMutableTreeNode(t_sib);
parent.add(dMTN_sib);
t_sib.dmtn = dMTN_sib;
t_sib.disName = (String) et.mems.get(i);
ArgsCellEditor.createTreeCellEditorComponent(dMTN_sib, tree);
buildParaSibling(dMTN_sib, t_sib, tree);
}
return;
}
// handle CTEnum----nothing to do here
// handle CTUnion----nothing to do here
// handle CTSequence----nothing to do here
// handle CTBasic----nothing to do here
// Any other type will be return directly!!!
}
public static void createAndShowGUI(String name) {
// try {
// if (File.separator.equalsIgnoreCase("\\")) {
// UIManager
// .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
// } else {
// UIManager
// .setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
// }
// } catch (Exception e) {
// LOG.severe("Couldn't use system look and feel.");
// }
//
// // Make sure we have nice uix decorations.
// JFrame.setDefaultLookAndFeelDecorated(true);
// Create and set up the window.
frame = new MNQmainFrame();
// WCJ 20070712 Just to test
// frame.checkLicense();
// set the title for this JFrame
frame.setTitle("Ultra Corba Simulator -- " + name);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(frame);
String icon = "/images/mnq.jpg";
frame.setIconImage(Toolkit.getDefaultToolkit()
.getImage(ClassLoader.class.getResource(icon)));
// Display the window.
frame.pack();
// frame.setExtendedState(MAXIMIZED_BOTH);
// The next two lines should be in one line.
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
Dimension size = new Dimension(dim.width * 2 / 3, dim.height * 2 / 3);
frame.setSize(size);
int w = frame.getSize().width;
int h = frame.getSize().height;
int x = (dim.width - w) / 2;
int y = (dim.height - h) / 2;
frame.setBounds(x, y, w, h);
// frame.para_result.setDividerLocation(h / 4);
frame.upsplitPane.setDividerLocation(w / 2);
frame.splitPane.setDividerLocation(h / 2);
// WelcomeScreen.instance().exit();
frame.setVisible(true);
}
public static void expandNode(DefaultMutableTreeNode node, JTree jTree) {
TreeNode[] pathToRoot = node.getPath();
TreePath treePath = new TreePath(pathToRoot);
jTree.expandPath(treePath);
if (node.getChildCount() > 0) {
for (Enumeration e = node.children(); e.hasMoreElements();) {
DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) e.nextElement();
expandNode(childNode, jTree);
}
}
}
public static void initialParaTree(IdlOperation op) {
Object o = Warehouse.node2table.get(op);
if (o == null) {
top_ParaTree = new MNQMutableTreeNode(PARA_ROOT_STRING);
DefaultTreeModel treeModel = new DefaultTreeModel(top_ParaTree);
treeModel.setAsksAllowsChildren(false);
op.dtm = treeModel;
Warehouse.node2table.put(op, treeModel);
// not change the display content in paraTree
// paraTree.setModel(treeModel);
List paras = op.getAllNodes();
for (int i = 0; i < paras.size(); i++) {
Args n_sib = (Args) paras.get(i);
TypeBase tn = n_sib.pt;
MNQMutableTreeNode dMTN_sib = new MNQMutableTreeNode(n_sib);
top_ParaTree.add(dMTN_sib);
n_sib.dmtn = dMTN_sib;
tn.dmtn = dMTN_sib;
ArgsCellEditor.createTreeCellEditorComponent(dMTN_sib, paraTree);
// if (n_sib instanceof OutArgs) continue;
// if (n_sib instanceof InArgs) continue;
buildParaSibling(dMTN_sib, tn, paraTree);
}
} else {
// not change the display content in paraTree
// DefaultTreeModel treeModel = (DefaultTreeModel) o;
// top_ParaTree = (MNQMutableTreeNode)
// treeModel.getRoot();
// paraTree.setModel(treeModel);
}
}
// public static void initialResultTree(IdlOperation op) {
//
// Object o = Warehouse.on2resulttree.get(op);
// if (o == null) {
// top_ResultTree = new MNQMutableTreeNode(RESULT_ROOT_STRING);
// DefaultTreeModel treeModel = new
// DefaultTreeModel(top_ResultTree);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?