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