Search in sources :

Example 1 with ParticipantSignatureShapePanel

use of cbit.vcell.graph.gui.ParticipantSignatureShapePanel in project vcell by virtualcell.

the class ReactionRuleParticipantSignaturePropertiesPanel method initialize.

private void initialize() {
    try {
        shapePanel = new ParticipantSignatureShapePanel() {

            @Override
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                for (Pair<ReactionRulePatternLargeShape, ReactionRulePatternLargeShape> p : ruleShapeList) {
                    ReactionRulePatternLargeShape rp = p.one;
                    rp.paintSelf(g);
                    ReactionRulePatternLargeShape pp = p.two;
                    pp.paintSelf(g);
                }
            }
        };
        shapePanel.setLayout(new GridBagLayout());
        shapePanel.setBackground(Color.white);
        shapePanel.zoomSmaller();
        shapePanel.zoomSmaller();
        shapePanel.zoomSmaller();
        getZoomSmallerButton().setEnabled(true);
        getZoomLargerButton().setEnabled(true);
        scrollPane = new JScrollPane(shapePanel);
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        JPanel optionsPanel = new JPanel();
        optionsPanel.setPreferredSize(new Dimension(140, 200));
        optionsPanel.setLayout(new GridBagLayout());
        getZoomSmallerButton().setEnabled(true);
        getZoomLargerButton().setEnabled(true);
        int gridy = 0;
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.weightx = 0;
        gbc.insets = new Insets(8, 4, 4, 0);
        gbc.anchor = GridBagConstraints.WEST;
        optionsPanel.add(getZoomLargerButton(), gbc);
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.weightx = 0;
        gbc.insets = new Insets(8, 0, 4, 4);
        gbc.anchor = GridBagConstraints.WEST;
        optionsPanel.add(getZoomSmallerButton(), gbc);
        // apparently we don't need a fake 3rd cell to the right
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.gridwidth = 2;
        gbc.weightx = 1;
        // fake cell used for filling all the vertical empty space
        gbc.weighty = 1;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(4, 4, 4, 10);
        optionsPanel.add(new JLabel(""), gbc);
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.SOUTHWEST;
        optionsPanel.add(getShowMoleculeColorButton(), gbc);
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.SOUTHWEST;
        optionsPanel.add(getShowNonTrivialButton(), gbc);
        gridy++;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.SOUTHWEST;
        optionsPanel.add(getShowDifferencesButton(), gbc);
        getShowMoleculeColorButton().setSelected(true);
        getShowNonTrivialButton().setSelected(true);
        getShowDifferencesButton().setSelected(false);
        shapePanel.setShowMoleculeColor(getShowMoleculeColorButton().isSelected());
        shapePanel.setShowNonTrivialOnly(getShowNonTrivialButton().isSelected());
        shapePanel.setShowDifferencesOnly(getShowDifferencesButton().isSelected());
        containerOfScrollPanel = new JPanel();
        containerOfScrollPanel.setLayout(new BorderLayout());
        containerOfScrollPanel.add(optionsPanel, BorderLayout.WEST);
        containerOfScrollPanel.add(scrollPane, BorderLayout.CENTER);
        setLayout(new BorderLayout());
        add(containerOfScrollPanel, BorderLayout.CENTER);
        setBackground(Color.white);
    } 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) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Graphics(java.awt.Graphics) ParticipantSignatureShapePanel(cbit.vcell.graph.gui.ParticipantSignatureShapePanel) BorderLayout(java.awt.BorderLayout) ReactionRulePatternLargeShape(cbit.vcell.graph.ReactionRulePatternLargeShape) Pair(org.vcell.util.Pair)

Aggregations

ReactionRulePatternLargeShape (cbit.vcell.graph.ReactionRulePatternLargeShape)1 ParticipantSignatureShapePanel (cbit.vcell.graph.gui.ParticipantSignatureShapePanel)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 Graphics (java.awt.Graphics)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 Pair (org.vcell.util.Pair)1