Search in sources :

Example 1 with NetworkConstraintsTableModel

use of cbit.vcell.mapping.gui.NetworkConstraintsTableModel in project vcell by virtualcell.

the class NetworkConstraintsPanel method initialize.

private void initialize() {
    seedSpeciesLabel = new JLabel();
    reactionRulesLabel = new JLabel();
    generatedSpeciesLabel = new JLabel();
    generatedReactionsLabel = new JLabel();
    observablesMapLabel = new JLabel("Observables Map");
    somethingInsufficientLabel = new JLabel();
    networkConstraintsTable = new EditorScrollTable();
    networkConstraintsTableModel = new NetworkConstraintsTableModel(networkConstraintsTable);
    networkConstraintsTable.setModel(networkConstraintsTableModel);
    getViewGeneratedSpeciesButton().addActionListener(eventHandler);
    getViewGeneratedReactionsButton().addActionListener(eventHandler);
    getViewObservablesMapButton().addActionListener(eventHandler);
    getRefreshMathButton().addActionListener(eventHandler);
    getCreateModelButton().addActionListener(eventHandler);
    // ------------------------------------------- The 2 group boxes --------------------------
    JPanel leftPanel = new JPanel();
    Border loweredEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    Border loweredBevelBorder = BorderFactory.createLoweredBevelBorder();
    TitledBorder titleTop = BorderFactory.createTitledBorder(loweredEtchedBorder, " Network Constraints ");
    titleTop.setTitleJustification(TitledBorder.LEFT);
    titleTop.setTitlePosition(TitledBorder.TOP);
    TitledBorder titleBottom = BorderFactory.createTitledBorder(loweredEtchedBorder, " Generated Network ");
    titleBottom.setTitleJustification(TitledBorder.LEFT);
    titleBottom.setTitlePosition(TitledBorder.TOP);
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(5, 3, 2, 1);
    add(leftPanel, gbc);
    // ------------------------------------------- Populating the left group box ---------------
    JPanel top = new JPanel();
    JPanel bottom = new JPanel();
    top.setBorder(titleTop);
    bottom.setBorder(titleBottom);
    leftPanel.setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    // top, left, bottom, right
    gbc.insets = new Insets(5, 2, 2, 3);
    leftPanel.add(top, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(5, 2, 2, 3);
    leftPanel.add(bottom, gbc);
    // we may want to use a scroll pane whose viewing area is the JTable to provide similar look with NetGen Console
    JScrollPane p = new JScrollPane(networkConstraintsTable);
    p.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    // --- bottom
    top.setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(5, 4, 4, 10);
    top.add(p, gbc);
    // ------------------------------------------- Populating the right group box ------------
    // --- top
    bottom.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(6, 4, 4, 10);
    bottom.add(generatedSpeciesLabel, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    // gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(6, 4, 4, 10);
    bottom.add(getViewGeneratedSpeciesButton(), gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = gridy;
    // gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(6, 4, 4, 10);
    bottom.add(getRefreshMathButton(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 10);
    bottom.add(generatedReactionsLabel, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 10);
    bottom.add(getViewGeneratedReactionsButton(), gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = gridy;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 10);
    bottom.add(getCreateModelButton(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 10);
    bottom.add(observablesMapLabel, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 10);
    bottom.add(getViewObservablesMapButton(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.gridwidth = 4;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 10);
    bottom.add(somethingInsufficientLabel, gbc);
    networkConstraintsTable.setDefaultRenderer(String.class, new DefaultScrollTableCellRenderer());
}
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) NetworkConstraintsTableModel(cbit.vcell.mapping.gui.NetworkConstraintsTableModel) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) EditorScrollTable(org.vcell.util.gui.EditorScrollTable) TitledBorder(javax.swing.border.TitledBorder) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder) EtchedBorder(javax.swing.border.EtchedBorder)

Aggregations

NetworkConstraintsTableModel (cbit.vcell.mapping.gui.NetworkConstraintsTableModel)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 Border (javax.swing.border.Border)1 EtchedBorder (javax.swing.border.EtchedBorder)1 TitledBorder (javax.swing.border.TitledBorder)1 DefaultScrollTableCellRenderer (org.vcell.util.gui.DefaultScrollTableCellRenderer)1 EditorScrollTable (org.vcell.util.gui.EditorScrollTable)1