Example usage for com.jgoodies.forms.layout FormLayout getRowCount

List of usage examples for com.jgoodies.forms.layout FormLayout getRowCount

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout FormLayout getRowCount.

Prototype

public int getRowCount() 

Source Link

Document

Returns the number of rows in this layout.

Usage

From source file:uk.ac.ebi.mnb.dialog.tools.curate.MetaboliteCurator.java

License:Open Source License

@Override
public JPanel getForm() {

    options = super.getForm();

    FormLayout layout = new FormLayout("p:grow");
    options.setLayout(layout);//from  www . j a v  a 2  s.c om

    for (int i = 0; i < modules.length; i++) {
        CrossreferenceModule module = modules[i];

        layout.appendRow(new RowSpec(Sizes.PREFERRED));

        String moduleDescription = "<html>" + module.getDescription() + " [<b>" + KEY_STROKE_SYMBOL + (i + 1)
                + "</b>]</html>";
        final JComponent component = module.getComponent();
        component.setBackground(getBackground());
        final ExpandableComponentGroup expanding = new ExpandableComponentGroup(moduleDescription, component,
                this);
        // allows quick switching with number keys
        expanding.registerKeyboardAction(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                expanding.toggle();
                options.revalidate();
            }
        }, KeyStroke.getKeyStroke(KEY_STROKE_MASK + " " + Integer.toString(i + 1)),
                JComponent.WHEN_IN_FOCUSED_WINDOW);
        options.add(expanding, cc.xy(1, layout.getRowCount()));
        layout.appendRow(new RowSpec(Sizes.DLUY4));
    }

    return options;

}

From source file:uk.ac.ebi.mnb.importer.xls.wizzard.ReactionColumnChooser.java

License:Open Source License

public ReactionColumnChooser(ExcelHelper helper, ExcelModelProperties properties) {
    super();// www . j a va2  s .com

    this.helper = helper;
    this.properties = properties;

    columns.add("-"); // no selection
    for (char c = 'A'; c <= 'Z'; ++c) {
        columns.add(Character.toString(c));
    }

    start = new JSpinner(new SpinnerNumberModel(1, 1, 4000, 1));
    end = new JSpinner(new SpinnerNumberModel(1, 1, 4000, 1));

    abbreviation = ComboBoxFactory.newComboBox(columns);
    description = ComboBoxFactory.newComboBox(columns);

    equation = ComboBoxFactory.newComboBox(columns);
    classification = ComboBoxFactory.newComboBox(columns);

    subsystem = ComboBoxFactory.newComboBox(columns);
    source = ComboBoxFactory.newComboBox(columns);

    locus = ComboBoxFactory.newComboBox(columns);

    FormLayout layout = new FormLayout("right:p:grow, 4dlu, min, 4dlu, right:p:grow, 4dlu, min", "p");

    // content panel
    setLayout(layout);

    removeAll();

    add(LabelFactory.newFormLabel("Start Row"), cc.xy(1, layout.getRowCount()));
    add(start, cc.xy(3, layout.getRowCount()));
    add(LabelFactory.newFormLabel("End Row"), cc.xy(5, layout.getRowCount()));
    add(end, cc.xy(7, layout.getRowCount()));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    add(new JSeparator(), cc.xyw(1, layout.getRowCount(), 7));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    add(LabelFactory.newFormLabel("Identifier/Abbreviation"), cc.xy(1, layout.getRowCount()));
    add(abbreviation, cc.xy(3, layout.getRowCount()));
    add(LabelFactory.newFormLabel("Name/Description"), cc.xy(5, layout.getRowCount()));
    add(description, cc.xy(7, layout.getRowCount()));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    add(LabelFactory.newFormLabel("Reaction Equation"), cc.xy(1, layout.getRowCount()));
    add(equation, cc.xy(3, layout.getRowCount()));
    add(LabelFactory.newFormLabel("Classification (EC/TC Number)"), cc.xy(5, layout.getRowCount()));
    add(classification, cc.xy(7, layout.getRowCount()));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    add(LabelFactory.newFormLabel("Subsystem/Reaction type"), cc.xy(1, layout.getRowCount()));
    add(subsystem, cc.xy(3, layout.getRowCount()));
    add(LabelFactory.newFormLabel("Source/Reference:"), cc.xy(5, layout.getRowCount()));
    add(source, cc.xy(7, layout.getRowCount()));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    add(LabelFactory.newFormLabel("Locus"), cc.xy(1, layout.getRowCount()));
    add(locus, cc.xy(3, layout.getRowCount()));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    JPanel extra = PanelFactory.createDialogPanel("right:p:grow, 4dlu, min, 4dlu, right:p:grow, 4dlu, min",
            "p, 2dlu, p, 2dlu, p");

    deltaG = ComboBoxFactory.newComboBox(columns);
    deltaGError = ComboBoxFactory.newComboBox(columns);
    minFlux = ComboBoxFactory.newComboBox(columns);
    maxFlux = ComboBoxFactory.newComboBox(columns);
    direction = ComboBoxFactory.newComboBox(columns);

    extra.add(LabelFactory.newFormLabel("Free energy / G"), cc.xy(1, 1));
    extra.add(deltaG, cc.xy(3, 1));
    extra.add(LabelFactory.newFormLabel("Free energy / G (error)"), cc.xy(5, 1));
    extra.add(deltaGError, cc.xy(7, 1));

    extra.add(LabelFactory.newFormLabel("Lower Bound Flux"), cc.xy(1, 3));
    extra.add(minFlux, cc.xy(3, 3));
    extra.add(LabelFactory.newFormLabel("Upper Bound Flux"), cc.xy(5, 3));
    extra.add(maxFlux, cc.xy(7, 3));

    extra.add(LabelFactory.newFormLabel("Direction"), cc.xy(1, 5));
    extra.add(direction, cc.xy(3, 5));

    add(new ExpandableComponentGroup("Extra Columns", extra),
            cc.xyw(1, layout.getRowCount(), 7, CellConstraints.FILL, CellConstraints.FILL));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    add(new JSeparator(), cc.xyw(1, layout.getRowCount(), 7));

    layout.appendRow(new RowSpec(Sizes.DLUY2));
    layout.appendRow(new RowSpec(Sizes.PREFERRED));

    table = new SelectionTable(helper);

    JScrollPane pane = new BorderlessScrollPane(table, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    RowNumberTable rnt = new RowNumberTable(table);
    pane.setRowHeaderView(rnt);
    pane.setCorner(JScrollPane.UPPER_LEFT_CORNER, rnt.getTableHeader());
    pane.setPreferredSize(new Dimension(800, table.getRowHeight() * 10));
    add(pane, cc.xyw(1, layout.getRowCount(), 7));

    // set previous selections
    Preferences pref = Preferences.userNodeForPackage(ReactionColumnChooser.class);
    start.setValue(pref.getInt(properties.getPreferenceKey("rxn.start"), 1));
    end.setValue(pref.getInt(properties.getPreferenceKey("rxn.end"), 10));
    abbreviation.setSelectedIndex(pref.getInt(properties.getPreferenceKey(ABBREVIATION), 0));
    description.setSelectedIndex(pref.getInt(properties.getPreferenceKey(DESCRIPTION), 0));
    equation.setSelectedIndex(pref.getInt(properties.getPreferenceKey(EQUATION), 0));
    classification.setSelectedIndex(pref.getInt(properties.getPreferenceKey(CLASSIFICATION), 0));
    subsystem.setSelectedIndex(pref.getInt(properties.getPreferenceKey(SUBSYSTEM), 0));
    source.setSelectedIndex(pref.getInt(properties.getPreferenceKey(SOURCE), 0));
    locus.setSelectedIndex(pref.getInt(properties.getPreferenceKey(LOCUS), 0));
    minFlux.setSelectedIndex(pref.getInt(properties.getPreferenceKey(MIN_FLUX), 0));
    maxFlux.setSelectedIndex(pref.getInt(properties.getPreferenceKey(MAX_FLUX), 0));
    deltaG.setSelectedIndex(pref.getInt(properties.getPreferenceKey(FREE_ENERGY), 0));
    deltaGError.setSelectedIndex(pref.getInt(properties.getPreferenceKey(FREE_ENERGY_ERROR), 0));
    direction.setSelectedIndex(pref.getInt(properties.getPreferenceKey(DIRECTION), 0));

    // listeners to change table header name
    abbreviation.addActionListener(new TableHeaderChanger(abbreviation, "Abbreviation"));
    description.addActionListener(new TableHeaderChanger(description, "Description"));
    equation.addActionListener(new TableHeaderChanger(equation, "Equation"));
    classification.addActionListener(new TableHeaderChanger(classification, "Classification"));
    source.addActionListener(new TableHeaderChanger(source, "Source"));
    subsystem.addActionListener(new TableHeaderChanger(subsystem, "Subsystem"));

    // Spinner listeners for shading the table
    start.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent ce) {
            table.setStart((Integer) start.getValue());
            repaint();
        }
    });
    end.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent ce) {
            table.setEnd((Integer) end.getValue());
            repaint();
        }
    });

}

From source file:uk.ac.ebi.mnb.view.entity.gene.GenePanel.java

License:Open Source License

/**
 * Appends a JTextPane displaying the product sequence to the basic
 * information panel//ww w .j  av a 2  s.  com
 *
 * @return
 */
@Override
public JPanel getBasicPanel() {

    JPanel panel = super.getBasicPanel();

    FormLayout layout = (FormLayout) panel.getLayout();
    layout.appendRow(new RowSpec(Sizes.PREFERRED));
    sequencePane = new BorderlessScrollPane(sequence);
    sequencePane.setPreferredSize(new Dimension(500, 80));
    panel.add(sequencePane, cc.xyw(1, layout.getRowCount(), 5));

    return panel;

}

From source file:uk.ac.ebi.mnb.view.entity.reaction.ReactionPanel.java

License:Open Source License

@Override
public JPanel getBasicPanel() {

    JPanel panel = super.getBasicPanel();

    FormLayout layout = (FormLayout) panel.getLayout();

    participantXref = PanelFactory.createInfoPanel();

    // add a row/*from  www.ja  v a2s .co  m*/
    layout.appendRow(new RowSpec(RowSpec.CENTER, Sizes.DLUY4, RowSpec.DEFAULT_GROW));
    layout.appendRow(new RowSpec(RowSpec.CENTER, Sizes.PREFERRED, RowSpec.DEFAULT_GROW));
    panel.add(reactionLabel, cc.xyw(1, layout.getRowCount(), layout.getColumnCount(), cc.CENTER, cc.CENTER));

    layout.appendRow(new RowSpec(RowSpec.CENTER, Sizes.PREFERRED, RowSpec.NO_GROW));
    panel.add(participantXref, cc.xyw(1, layout.getRowCount(), layout.getColumnCount(), cc.CENTER, cc.CENTER));

    layout.appendRow(new RowSpec(RowSpec.CENTER, Sizes.PREFERRED, RowSpec.NO_GROW));
    panel.add(editor.getComponent(),
            cc.xyw(1, layout.getRowCount(), layout.getColumnCount(), cc.CENTER, cc.CENTER));

    editor.getComponent().setVisible(false);

    return panel;

}

From source file:uk.ac.ebi.mnb.view.entity.tasks.TaskPanel.java

License:Open Source License

@Override
public JPanel getBasicPanel() {
    JPanel panel = super.getBasicPanel();
    FormLayout layout = (FormLayout) panel.getLayout();
    layout.appendRow(new RowSpec(Sizes.PREFERRED));
    panel.add(command, cc.xyw(1, layout.getRowCount(), 5));
    return panel;
}

From source file:xmet.tools.metadata.editor.views.custom.Panel.java

License:Open Source License

/**
 * Removes the repeated panel./*  www. j a v  a  2  s  .  com*/
 * @param panel the panel
 */
private void removeRepeatedPanel(final Panel panel) {
    panels.remove(panel);
    /* remove everything and reconstruct the panel */
    removeAll();
    /* create and set default layout */
    final FormLayout layout = new FormLayout("$ugap,f:d,$rgap,f:d,$rgap,f:p:grow,$ugap", "$ugap,f:d,$rgap");
    setLayout(layout);
    /* add the Add button */
    final JButton btnAdd = new JButton("Add");
    btnAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent arg0) {
            addRepeatedPanel();
        }

    });
    this.add(btnAdd, CC.xywh(2, 2, 1, 1));
    /* add all repeated panels one by one */
    for (final Panel rPanel : panels) {
        layout.appendRow(RowSpec.decode("$rgap"));
        layout.appendRow(RowSpec.decode("f:d"));
        this.add(rPanel, CC.xywh(2, layout.getRowCount(), layout.getColumnCount() - 2, 1));

        layout.appendRow(RowSpec.decode("$rgap"));
        layout.appendRow(RowSpec.decode("f:d"));
        final JButton btnRemove = new JButton("Remove");
        btnRemove.addActionListener(new RemovePanelAction(rPanel));
        this.add(btnRemove, CC.xywh(2, layout.getRowCount(), 1, 1));
    }
    revalidate();
    this.repaint();
}