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);
}
}
Aggregations