Search in sources :

Example 1 with DatabaseWindowPanel

use of cbit.vcell.client.desktop.DatabaseWindowPanel in project vcell by virtualcell.

the class DocumentEditor method initialize.

/**
 * Initialize the class.
 */
private void initialize() {
    try {
        setLayout(new BorderLayout());
        getToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent event) {
                try {
                    switch(event.getID()) {
                        case KeyEvent.KEY_RELEASED:
                            documentEditor_eventDispatched(event);
                            break;
                        case MouseEvent.MOUSE_RELEASED:
                            documentEditor_eventDispatched(event);
                            break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                // consume any exception ... don't screw up the swing event queue.
                }
            }
        }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
        documentEditorTree = new javax.swing.JTree() {

            @Override
            public boolean isPathEditable(TreePath path) {
                Object object = path.getLastPathComponent();
                return (object instanceof BioModelNode) && (((BioModelNode) object).getUserObject() instanceof SimulationContext);
            }
        };
        documentEditorTree.setEditable(true);
        documentEditorTree.setLargeModel(true);
        documentEditorTreeCellEditor = new DocumentEditorTreeCellEditor(documentEditorTree);
        documentEditorTree.setCellEditor(documentEditorTreeCellEditor);
        documentEditorTree.setName("bioModelEditorTree");
        ToolTipManager.sharedInstance().registerComponent(documentEditorTree);
        int rowHeight = documentEditorTree.getRowHeight();
        if (rowHeight < 10) {
            rowHeight = 20;
        }
        documentEditorTree.setRowHeight(rowHeight + 2);
        documentEditorTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        JSplitPane leftSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        databaseWindowPanel = new DatabaseWindowPanel(false, false);
        leftBottomTabbedPane = new JTabbedPaneEnhanced();
        leftBottomTabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        leftBottomTabbedPane.addTab("VCell DB", databaseWindowPanel);
        JScrollPane treePanel = new javax.swing.JScrollPane(documentEditorTree);
        leftSplitPane.setTopComponent(treePanel);
        leftBottomTabbedPane.setMinimumSize(new java.awt.Dimension(198, 148));
        leftSplitPane.setBottomComponent(leftBottomTabbedPane);
        leftSplitPane.setResizeWeight(0.5);
        leftSplitPane.setDividerLocation(300);
        leftSplitPane.setDividerSize(8);
        leftSplitPane.setOneTouchExpandable(true);
        rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        rightSplitPane.setResizeWeight(0.7);
        rightSplitPane.setDividerLocation(400);
        rightSplitPane.setDividerSize(8);
        rightSplitPane.setOneTouchExpandable(true);
        rightBottomEmptyPanel = new JPanel(new GridBagLayout());
        rightBottomEmptyPanel.setBackground(Color.white);
        treeNodeDescriptionLabel = new JLabel(generalTreeNodeDescription);
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.insets = new Insets(10, 10, 4, 4);
        gbc.gridy = 0;
        gbc.weighty = 1.0;
        gbc.weightx = 1.0;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.PAGE_START;
        rightBottomEmptyPanel.add(treeNodeDescriptionLabel, gbc);
        issuePanel = new IssuePanel();
        rightBottomTabbedPane = new JTabbedPaneEnhanced();
        rightBottomTabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        rightBottomEmptyPanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
        issuePanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
        rightBottomTabbedPane.addTab(TAB_TITLE_OBJECT_PROPERTIES, rightBottomEmptyPanel);
        rightBottomTabbedPane.addTab(TAB_TITLE_PROBLEMS, issuePanel);
        rightBottomTabbedPane.setMinimumSize(new java.awt.Dimension(198, 148));
        rightSplitPane.setBottomComponent(rightBottomTabbedPane);
        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        splitPane.setDividerLocation(270);
        splitPane.setOneTouchExpandable(true);
        splitPane.setResizeWeight(0.3);
        splitPane.setDividerSize(8);
        splitPane.setLeftComponent(leftSplitPane);
        splitPane.setRightComponent(rightSplitPane);
        add(splitPane, BorderLayout.CENTER);
        issueManager.addIssueEventListener(eventHandler);
        selectionManager.addPropertyChangeListener(eventHandler);
        databaseWindowPanel.setSelectionManager(selectionManager);
        documentEditorTree.addTreeSelectionListener(eventHandler);
        documentEditorTree.addMouseListener(eventHandler);
        bioModelMetaDataPanel = new BioModelMetaDataPanel();
        bioModelMetaDataPanel.setSelectionManager(selectionManager);
        mathModelMetaDataPanel = new MathModelMetaDataPanel();
        mathModelMetaDataPanel.setSelectionManager(selectionManager);
        geometryMetaDataPanel = new GeometryMetaDataPanel();
        geometryMetaDataPanel.setSelectionManager(selectionManager);
        issuePanel.setSelectionManager(selectionManager);
        issuePanel.setIssueManager(issueManager);
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) AWTEventListener(java.awt.event.AWTEventListener) GeometryMetaDataPanel(cbit.vcell.desktop.GeometryMetaDataPanel) BioModelNode(cbit.vcell.desktop.BioModelNode) JTabbedPaneEnhanced(org.vcell.util.gui.JTabbedPaneEnhanced) BorderLayout(java.awt.BorderLayout) MathModelMetaDataPanel(cbit.vcell.desktop.MathModelMetaDataPanel) AWTEvent(java.awt.AWTEvent) JScrollPane(javax.swing.JScrollPane) BioModelMetaDataPanel(cbit.vcell.desktop.BioModelMetaDataPanel) JLabel(javax.swing.JLabel) JTree(javax.swing.JTree) SimulationContext(cbit.vcell.mapping.SimulationContext) Point(java.awt.Point) TreePath(javax.swing.tree.TreePath) DatabaseWindowPanel(cbit.vcell.client.desktop.DatabaseWindowPanel) JSplitPane(javax.swing.JSplitPane)

Aggregations

DatabaseWindowPanel (cbit.vcell.client.desktop.DatabaseWindowPanel)1 BioModelMetaDataPanel (cbit.vcell.desktop.BioModelMetaDataPanel)1 BioModelNode (cbit.vcell.desktop.BioModelNode)1 GeometryMetaDataPanel (cbit.vcell.desktop.GeometryMetaDataPanel)1 MathModelMetaDataPanel (cbit.vcell.desktop.MathModelMetaDataPanel)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1 AWTEvent (java.awt.AWTEvent)1 BorderLayout (java.awt.BorderLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Point (java.awt.Point)1 AWTEventListener (java.awt.event.AWTEventListener)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSplitPane (javax.swing.JSplitPane)1 JTree (javax.swing.JTree)1 TreePath (javax.swing.tree.TreePath)1 JTabbedPaneEnhanced (org.vcell.util.gui.JTabbedPaneEnhanced)1