Search in sources :

Example 11 with CollapsiblePanel

use of org.vcell.util.gui.CollapsiblePanel in project vcell by virtualcell.

the class BioModelsNetPanel method initialize.

private void initialize() {
    searchTextField = new JTextField(10);
    searchTextField.putClientProperty("JTextField.variant", "search");
    searchTextField.addActionListener(eventHandler);
    searchButton = new JButton("Search");
    searchButton.addActionListener(eventHandler);
    showAllButton = new JButton("Show All");
    showAllButton.addActionListener(eventHandler);
    importButton = new JButton("Import");
    importButton.addActionListener(eventHandler);
    importButton.setEnabled(false);
    tree = new JTree();
    tree.setCellRenderer(new BioModelsNetTreeCellRenderer());
    treeModel = new BioModelsNetTreeModel();
    tree.setModel(treeModel);
    tree.getSelectionModel().addTreeSelectionListener(eventHandler);
    tree.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            int selRow = tree.getRowForLocation(e.getX(), e.getY());
            if (selRow > -1) {
                if (e.getClickCount() == 1) {
                // for other feature implementation use single mouse click
                } else if (e.getClickCount() == 2) {
                    importFromBioModelsNet();
                }
            }
        }
    });
    CollapsiblePanel searchPanel = new CollapsiblePanel("Search", false);
    searchPanel.getContentPanel().setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    searchPanel.getContentPanel().add(searchTextField, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.insets = new Insets(0, 2, 0, 0);
    searchPanel.getContentPanel().add(searchButton, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.insets = new Insets(0, 2, 0, 0);
    searchPanel.getContentPanel().add(showAllButton, gbc);
    setPreferredSize(new Dimension(475, 300));
    setLayout(new GridBagLayout());
    int gridy = 0;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 0, 4, 0);
    add(searchPanel, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(4, 0, 4, 0);
    gbc.fill = GridBagConstraints.BOTH;
    add(new JScrollPane(tree), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.insets = new Insets(4, 0, 4, 0);
    add(importButton, gbc);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) MouseEvent(java.awt.event.MouseEvent) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) CollapsiblePanel(org.vcell.util.gui.CollapsiblePanel) JTree(javax.swing.JTree)

Example 12 with CollapsiblePanel

use of org.vcell.util.gui.CollapsiblePanel in project vcell by virtualcell.

the class ReactionRuleKineticsPropertiesPanel method initialize.

private void initialize() {
    try {
        setName("KineticsTypeTemplatePanel");
        setLayout(new GridBagLayout());
        setBackground(Color.white);
        isReversibleCheckBox = new JCheckBox("Reversible");
        isReversibleCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        isReversibleCheckBox.addActionListener(eventHandler);
        isReversibleCheckBox.setEnabled(true);
        isReversibleCheckBox.setBackground(Color.white);
        // isReversibleCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        Border border = BorderFactory.createLineBorder(Color.gray);
        Border loweredEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        Border loweredBevelBorder = BorderFactory.createLoweredBevelBorder();
        TitledBorder annotationBorder = BorderFactory.createTitledBorder(loweredEtchedBorder, " Annotation and Pathway Links ");
        annotationBorder.setTitleJustification(TitledBorder.LEFT);
        annotationBorder.setTitlePosition(TitledBorder.TOP);
        annotationBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
        nameTextField = new JTextField();
        nameTextField.setEditable(false);
        nameTextField.addFocusListener(eventHandler);
        nameTextField.addActionListener(eventHandler);
        GridBagConstraints gbc = new java.awt.GridBagConstraints();
        int gridy = 0;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.insets = new java.awt.Insets(2, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_END;
        add(new JLabel("Reaction Name"), gbc);
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.insets = new java.awt.Insets(2, 4, 4, 4);
        gbc.weightx = 1.0;
        gbc.gridwidth = 3;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        add(nameTextField, gbc);
        // --------------------------------------------------------
        JPanel p = new JPanel();
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.weightx = 0;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.WEST;
        gbc.fill = GridBagConstraints.NONE;
        add(p, gbc);
        p.setLayout(new GridBagLayout());
        p.setBackground(Color.white);
        int gridyy = 0;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridyy;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        p.add(isReversibleCheckBox, gbc);
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.anchor = GridBagConstraints.LINE_END;
        gbc.insets = new java.awt.Insets(0, 4, 4, 4);
        add(new JLabel("Kinetic Type"), gbc);
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = gridy;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gbc.weightx = 1.0;
        gbc.insets = new java.awt.Insets(0, 4, 4, 4);
        add(getKineticsTypeComboBox(), gbc);
        getKineticsTypeComboBox().setEnabled(false);
        gbc = new GridBagConstraints();
        gbc.gridx = 3;
        gbc.gridy = gridy;
        gbc.insets = new java.awt.Insets(0, 4, 4, 4);
        add(getJToggleButton(), gbc);
        getJToggleButton().setEnabled(false);
        // getJToggleButton().setVisible(false);
        // --------------------------------------------------------------
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.gridwidth = 4;
        add(getScrollPaneTable().getEnclosingScrollPane(), gbc);
        // 'true' means expanded
        CollapsiblePanel collapsiblePanel = new CollapsiblePanel(" Annotation and Pathway Links ", true);
        collapsiblePanel.getContentPanel().setLayout(new GridBagLayout());
        JPanel jp1 = new JPanel();
        jp1.setLayout(new GridBagLayout());
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.LINE_START;
        JLabel pathwayLink = new JLabel("Linked Pathway Object(s): ");
        jp1.add(pathwayLink, gbc);
        linkedPOScrollPane = new JScrollPane();
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.weightx = 1.0;
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        jp1.add(linkedPOScrollPane, gbc);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.weightx = 1.0;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.LINE_START;
        collapsiblePanel.getContentPanel().add(jp1, gbc);
        annotationTextArea = new javax.swing.JTextArea("", 4, 30);
        annotationTextArea.setLineWrap(true);
        annotationTextArea.setWrapStyleWord(true);
        annotationTextArea.setFont(new Font("monospaced", Font.PLAIN, 11));
        annotationTextArea.setEditable(false);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.weightx = 1.0;
        gbc.weighty = 0.5;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.anchor = GridBagConstraints.SOUTHWEST;
        JScrollPane jp2 = new JScrollPane(annotationTextArea);
        collapsiblePanel.getContentPanel().add(jp2, gbc);
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.gridwidth = 4;
        gbc.weightx = 1.0;
        gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
        add(collapsiblePanel, gbc);
        annotationTextArea.addFocusListener(eventHandler);
        annotationTextArea.addMouseListener(eventHandler);
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) JTextField(javax.swing.JTextField) GridBagConstraints(java.awt.GridBagConstraints) CollapsiblePanel(org.vcell.util.gui.CollapsiblePanel) Font(java.awt.Font) JCheckBox(javax.swing.JCheckBox) JTextArea(javax.swing.JTextArea) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder) EtchedBorder(javax.swing.border.EtchedBorder)

Aggregations

CollapsiblePanel (org.vcell.util.gui.CollapsiblePanel)12 GridBagConstraints (java.awt.GridBagConstraints)11 GridBagLayout (java.awt.GridBagLayout)11 Insets (java.awt.Insets)8 JScrollPane (javax.swing.JScrollPane)6 JCheckBox (javax.swing.JCheckBox)5 JLabel (javax.swing.JLabel)5 JPanel (javax.swing.JPanel)5 JButton (javax.swing.JButton)4 JTextField (javax.swing.JTextField)4 BorderLayout (java.awt.BorderLayout)3 Dimension (java.awt.Dimension)3 Font (java.awt.Font)3 JTree (javax.swing.JTree)3 BioModelNode (cbit.vcell.desktop.BioModelNode)2 MouseAdapter (java.awt.event.MouseAdapter)2 MouseEvent (java.awt.event.MouseEvent)2 JTextArea (javax.swing.JTextArea)2 Border (javax.swing.border.Border)2 EtchedBorder (javax.swing.border.EtchedBorder)2