Example usage for com.jgoodies.forms.builder DefaultFormBuilder getLineGapSpec

List of usage examples for com.jgoodies.forms.builder DefaultFormBuilder getLineGapSpec

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder DefaultFormBuilder getLineGapSpec.

Prototype

@Deprecated
public RowSpec getLineGapSpec() 

Source Link

Document

Returns the row specification that is used to separate component row.

Usage

From source file:ca.sqlpower.architect.swingui.CompareDMPanel.java

License:Open Source License

private void buildUI(SchemaPopulator targetSchemaPop, CatalogPopulator targetCatalogPop,
        SchemaPopulator sourceSchemaPop, CatalogPopulator sourceCatalogPop) {

    progressBar = new JProgressBar();
    progressBar.setIndeterminate(true);/*from   www.  java2s .co  m*/
    progressBar.setVisible(false);

    sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes(session.getDataSources()));
    sqlTypeDropdown.setRenderer(new DDLGeneratorListCellRenderer());
    sqlTypeDropdown.setName("sqlTypeDropDown"); //$NON-NLS-1$
    OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown);
    sqlTypeDropdown.setEnabled(false);
    sqlTypeDropdown.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            startCompareAction.setEnabled(isStartable());
        }
    });
    sqlButton = new JRadioButton();
    sqlButton.setName(OUTPUT_SQL);
    sqlButton.setActionCommand(OUTPUT_SQL);
    sqlButton.setSelected(false);
    sqlButton.addActionListener(listener);

    englishButton = new JRadioButton();
    englishButton.setName("englishButton"); //$NON-NLS-1$
    englishButton.setActionCommand(OUTPUT_ENGLISH);
    englishButton.setSelected(true);
    englishButton.addActionListener(listener);

    liquibaseButton = new JRadioButton();
    liquibaseButton.setName(OUTPUT_LIQUIBASE); //$NON-NLS-1$
    liquibaseButton.setActionCommand(OUTPUT_LIQUIBASE);
    liquibaseButton.setSelected(false);
    liquibaseButton.addActionListener(listener);

    showNoChanges = new JCheckBox();
    showNoChanges.setName("showNoChanges"); //$NON-NLS-1$

    includeIndexes = new JCheckBox(Messages.getString("CompareDMPanel.includeIndexes")); //$NON-NLS-1$
    includeIndexes.setName("includeIndexes"); //$NON-NLS-1$
    includeIndexes.setSelected(false);

    // Group the radio buttons.
    ButtonGroup outputGroup = new ButtonGroup();
    outputGroup.add(sqlButton);
    outputGroup.add(englishButton);
    outputGroup.add(liquibaseButton);

    startCompareAction = new StartCompareAction();
    startCompareAction.setEnabled(false);

    swapSourceTargetAction = new SwapSourceTargetAction();
    swapSourceTargetAction.setEnabled(true);

    buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + // 1-4 //$NON-NLS-1$
            "0:grow, 4dlu, 0:grow, 4dlu," + // 5-8 //$NON-NLS-1$
            "0:grow, 4dlu, pref", // 9-11 //$NON-NLS-1$
            ""); //$NON-NLS-1$
    formLayout.setColumnGroups(new int[][] { { 5, 7, 9, } });
    JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel();
    DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel);
    builder.setDefaultDialogBorder();

    CellConstraints cc = new CellConstraints();

    builder.append(statusComponent, 11);
    builder.nextLine();

    builder.appendSeparator(Messages.getString("CompareDMPanel.olderSeparator")); //$NON-NLS-1$
    builder.nextLine();
    builder.append(""); // takes up blank space //$NON-NLS-1$

    source.buildPartialUI(builder, true, sourceSchemaPop, sourceCatalogPop);

    builder.appendSeparator(Messages.getString("CompareDMPanel.newerSeparator")); //$NON-NLS-1$
    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(""); //$NON-NLS-1$

    target.buildPartialUI(builder, false, targetSchemaPop, targetCatalogPop);

    ActionListener radioButtonActionEnabler = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            startCompareAction.setEnabled(isStartable());
        }
    };
    source.playPenRadio.addActionListener(radioButtonActionEnabler);
    source.physicalRadio.addActionListener(radioButtonActionEnabler);
    source.loadRadio.addActionListener(radioButtonActionEnabler);

    target.playPenRadio.addActionListener(radioButtonActionEnabler);
    target.physicalRadio.addActionListener(radioButtonActionEnabler);
    target.loadRadio.addActionListener(radioButtonActionEnabler);

    JLabel temp;

    builder.appendSeparator(Messages.getString("CompareDMPanel.outpurFormatSeparator")); //$NON-NLS-1$
    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.append(sqlButton);

    JPanel ddlTypePanel = new JPanel(new BorderLayout(3, 3));
    ddlTypePanel.add(temp = new JLabel(Messages.getString("CompareDMPanel.sqlFor")), BorderLayout.WEST); //$NON-NLS-1$
    associate(temp, sqlButton);
    ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator
    // type list
    ddlTypePanel.add(temp = new JLabel(Messages.getString("CompareDMPanel.makeOlderLookLikeNewer")), //$NON-NLS-1$
            BorderLayout.EAST);
    associate(temp, sqlButton);
    builder.append(ddlTypePanel, 3);

    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.append(liquibaseButton);
    temp = builder.append(Messages.getString("CompareDMPanel.liqubaseScript")); //$NON-NLS-1$
    associate(temp, liquibaseButton);

    this.lbOptions = new LiquibaseOptionsPanel();

    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(1);
    builder.nextColumn(2);
    lbOptions.getPanel().setVisible(false);
    builder.append(lbOptions.getPanel(), 9);

    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.append(englishButton);
    temp = builder.append(Messages.getString("CompareDMPanel.englishDescriptions")); //$NON-NLS-1$
    associate(temp, englishButton);

    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.append(showNoChanges);
    temp = builder.append(Messages.getString("CompareDMPanel.suppressSimilarities")); //$NON-NLS-1$
    associate(temp, showNoChanges);
    builder.append(includeIndexes);
    builder.nextLine();

    builder.appendSeparator(Messages.getString("CompareDMPanel.status")); //$NON-NLS-1$
    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow("pref"); //$NON-NLS-1$
    builder.nextLine(2);
    statusLabel = new JLabel(""); //$NON-NLS-1$
    builder.add(statusLabel, cc.xy(5, builder.getRow()));
    builder.add(progressBar, cc.xyw(7, builder.getRow(), 5));

    setLayout(new BorderLayout());
    add(builder.getPanel());
    setPreferredSize(new Dimension(800, 600));
    try {
        restoreSettingsFromProject();
    } catch (SQLObjectException e) {
        logger.warn("Failed to save user CompareDM preferences!", e); //$NON-NLS-1$
    }
}

From source file:net.sf.jhylafax.SendDialog.java

License:Open Source License

private void initializeCoverPanel() {
    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, pref:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    coverPanel = builder.getPanel();/*from   w w  w  .  j a v  a2 s.c  o  m*/
    this.builder.appendRow(builder.getLineGapSpec());
    this.builder.nextLine();
    this.builder.appendRow("fill:pref:grow");
    this.builder.append(coverPanel, 6);

    coverSenderTextField = new JTextField(DEFAULT_COLUMNS);
    coverSenderTextField.setText(Settings.FULLNAME.getValue());
    coverSenderLabel = builder.append("", coverSenderTextField);
    builder.nextLine();

    coverRecepientTextField = new JTextField(DEFAULT_COLUMNS);
    coverRecepientLabel = builder.append("", coverRecepientTextField);
    builder.nextLine();

    coverSubjectTextField = new JTextField(DEFAULT_COLUMNS);
    coverSubjectLabel = builder.append("", coverSubjectTextField);
    builder.nextLine();

    coverCommentTextArea = new JTextArea(3, DEFAULT_COLUMNS);
    coverCommentLabel = builder.append("");
    builder.appendRow("fill:pref:grow"); // second row for text area
    CellConstraints cc = new CellConstraints();
    coverCommentScrollPane = new JScrollPane(coverCommentTextArea);
    builder.add(coverCommentScrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 1, 2));
    builder.nextLine(2);
}

From source file:org.mpn.contacts.PanelBuilderTest.java

License:Open Source License

public JComponent buildPanel() {
    //        initComponents();
    JLabel name1Field = new JLabel("name1Field");
    JTextPane comment1Area = new JTextPane();
    JTextPane comment2Area = new JTextPane();
    JTextPane comment3Area = new JTextPane();
    JTextField name2Field = new JTextField();
    JTextField name3Field = new JTextField();

    FormLayout layout = new FormLayout("right:pref, 3dlu, default:grow", "");
    DefaultFormBuilder formBuilder = new DefaultFormBuilder(layout);
    formBuilder.setDefaultDialogBorder();
    formBuilder.setRowGroupingEnabled(true);

    CellConstraints cc = new CellConstraints();

    // In this approach, we add a gap and a custom row.
    // The advantage of this approach is, that we can express
    // the row spec and comment area cell constraints freely.
    // The disadvantage is the misalignment of the leading label.
    // Also the row's height may be inconsistent with other rows.
    formBuilder.appendSeparator("Single Custom Row");
    formBuilder.append("Name", name1Field);
    formBuilder.appendRow(formBuilder.getLineGapSpec());
    formBuilder.appendRow(new RowSpec("top:31dlu")); // Assumes line is 14, gap is 3
    formBuilder.nextLine(2);//from w w w  .ja  va 2 s  . c o  m
    formBuilder.append("Comment");
    formBuilder.add(new JScrollPane(comment1Area),
            cc.xy(formBuilder.getColumn(), formBuilder.getRow(), "fill, fill"));
    formBuilder.nextLine();

    // In this approach, we append a standard row with gap before it.
    // The advantage is, that the leading label is aligned well.
    // The disadvantage is that the comment area now spans
    // multiple cells and is slightly less flexible.
    // Also the row's height may be inconsistent with other rows.
    formBuilder.appendSeparator("Standard + Custom Row");
    formBuilder.append("Name", name2Field);
    formBuilder.append("Comment");
    formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3
    formBuilder.add(new JScrollPane(comment2Area),
            cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 1, 2));
    formBuilder.nextLine(2);

    // In this approach, we append two standard rows with associated gaps.
    // The advantage is, that the leading label is aligned well,
    // and the height is consistent with other rows.
    // The disadvantage is that the comment area now spans
    // multiple cells and is slightly less flexible.
    formBuilder.appendSeparator("Two Standard Rows");
    formBuilder.append("Name", name3Field);
    formBuilder.append("Comment");
    formBuilder.nextLine();
    formBuilder.append("");
    formBuilder.nextRow(-2);
    formBuilder.add(new JScrollPane(comment3Area),
            cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 1, 3));
    formBuilder.nextLine(3);

    JTable jtable1 = new JTable(
            new Object[][] { { "a", "b", "c" }, { "1", "2", "3" }, { "q", "w", "e" }, { "a", "b", "c" },
                    { "1", "2", "3" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" },
                    { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, },
            new Object[] { "Text1", "Column2", "Apples" });

    JTable jtable2 = new JTable(
            new Object[][] { { "a", "b", "c" }, { "1", "2", "3" }, { "q", "w", "e" }, { "a", "b", "c" },
                    { "1", "2", "3" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" },
                    { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, },
            new Object[] { "Tex", "Colum_", "_Apples" });

    formBuilder.appendSeparator("Table1");
    formBuilder.nextLine();
    formBuilder.append("Comment");
    //        formBuilder.nextRow(-2);
    formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3
    formBuilder.add(new JScrollPane(jtable1), cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 1, 2));
    formBuilder.nextLine();

    formBuilder.nextLine();
    formBuilder.appendSeparator("Table2");
    formBuilder.nextLine();
    //        formBuilder.append("Comment");
    formBuilder.appendRow(new RowSpec("100px"));
    //        formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3
    //        formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3
    //        formBuilder.nextRow(-2);
    //        formBuilder.nextLine(2);
    //        formBuilder.nextLine();
    //        formBuilder.nextLine();
    //        formBuilder.nextLine();
    formBuilder.add(new JScrollPane(jtable2), cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 3, 1));

    return formBuilder.getPanel();
}

From source file:org.tsho.dmc2.ui.bifurcation.BifVerticalAxisForm.java

License:Open Source License

private void createForm(String[] labels) {

    boolean debug = false;

    FormLayout layout = new FormLayout(
            //"l:9dlu:n, r:p:g, l:4dlu:n, c:49dlu:n,  l:9dlu:n",
            FormHelper.JGOODIES_SHORT_COLUMN_SPECS, "");

    DefaultFormBuilder builder;
    if (debug)//from   ww w . java2  s.co m
        builder = new DefaultFormBuilder(new FormDebugPanel(), layout);
    else
        builder = new DefaultFormBuilder(this, layout);

    builder.setDefaultDialogBorder();
    builder.setLeadingColumnOffset(1);

    builder.appendSeparator("Vertical axis");
    builder.nextLine();

    builder.appendRow(builder.getLineGapSpec());
    builder.nextLine(1);

    box1 = new JComboBox(labels);
    builder.append("variable", box1);
    builder.nextLine();

    //        box2 = new JComboBox(labels);
    //        box2.addItemListener(myListener);
    //        builder.append("Range axis", box2);
    //        builder.nextLine();
    //
    //        int box1Width = box1.getPreferredSize().width;
    //        int box1Height = box1.getPreferredSize().height;
    //        int box2Width = box2.getPreferredSize().width;
    //        int box2Height = box2.getPreferredSize().height;
    //        
    //        int max = (box1Width > box2Width ? box1Width : box2Width);
    //        box1.setPreferredSize(new Dimension(max, box1Height));
    //        box2.setPreferredSize(new Dimension(max, box2Height));

    if (debug) {
        setLayout(new BorderLayout());
        add(builder.getContainer());
        FormDebugUtils.dumpAll(builder.getPanel());
    }
}

From source file:org.tsho.dmc2.ui.coweb.CowebAlgorithmForm.java

License:Open Source License

private void createForm(boolean step) {
    boolean debug = false;

    FormLayout layout = new FormLayout(
            //"l:9dlu:n, r:p:g, l:4dlu:n, c:49dlu:n,  l:9dlu:n",
            FormHelper.JGOODIES_SHORT_COLUMN_SPECS, "");

    DefaultFormBuilder builder;

    if (debug)/* w  ww .ja v a  2  s.  co m*/
        builder = new DefaultFormBuilder(new FormDebugPanel(), layout);
    else
        builder = new DefaultFormBuilder(this, layout);

    builder.setDefaultDialogBorder();
    builder.setLeadingColumnOffset(1);

    builder.appendSeparator("Algorithm");
    builder.nextLine();

    builder.appendRow(builder.getLineGapSpec());
    builder.nextLine();

    builder.append(LABEL_POWER_SIZE, fieldPower);
    builder.nextLine();

    builder.appendRow(builder.getLineGapSpec());
    builder.appendRow(builder.getLineGapSpec());
    builder.nextLine(2);

    if (step) {
        builder.append(LABEL_STEP_SIZE, fieldStepSize);
        builder.nextLine();

        builder.appendRow(builder.getLineGapSpec());
        builder.appendRow(builder.getLineGapSpec());
        builder.nextLine(2);
    }

    builder.append(LABEL_TRANSIENTS, fieldTransients);
    builder.nextLine();

    builder.append(LABEL_ITERATIONS, fieldIterations);
    builder.nextLine();

    if (debug) {
        setLayout(new BorderLayout());
        add(builder.getContainer());
        FormDebugUtils.dumpAll(builder.getPanel());
    }
}

From source file:org.tsho.dmc2.ui.InfoPanel.java

License:Open Source License

public InfoPanel(Model model) {
    super();//from w  ww  .ja v a  2  s .com

    String modelName = null;
    String modelType = null;
    String modelDesc = null;
    String modelText = null;
    String modelDim = null;
    String modelPar = null;

    if (model != null) {
        modelName = model.getName();

        if (model instanceof SimpleMap) {
            modelType = "discrete";
        } else if (model instanceof ODE) {
            modelType = "continuous";
        } else {
            modelType = "undefined (error)";
        }
        //modelDesc = model.getDescription();
        modelDesc = null;
        modelText = model.getModelText();
        modelDim = Integer.toString(model.getNVar());
        modelPar = Integer.toString(model.getNPar());
    }

    //DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();

    FormLayout layout = new FormLayout(
            //              "l:9dlu:n, l:p:n, l:4dlu:n, l:90dlu:n, l:8dlu:n", 
            "l:9dlu:n, l:p:n, l:4dlu:n, l:p:g, l:8dlu:n", "");

    DefaultFormBuilder builder = new DefaultFormBuilder(this, layout);
    CellConstraints cc = new CellConstraints();

    builder.setDefaultDialogBorder();
    builder.setLeadingColumnOffset(1);

    builder.appendSeparator("Model specification");

    JTextArea textField = new JTextArea(modelName);
    textField.setEditable(false);
    textField.setLineWrap(true);
    builder.append("Name:", textField);

    textField = new JTextArea(modelType);
    textField.setEditable(false);
    textField.setLineWrap(true);
    builder.append("Type:", textField);

    textField = new JTextArea(modelDim);
    textField.setEditable(false);
    textField.setLineWrap(true);
    builder.append("Dimension:", textField);

    textField = new JTextArea(modelPar);
    textField.setEditable(false);
    textField.setLineWrap(true);
    builder.append("Parameters:", textField);

    String str;
    if (model instanceof InvertibleMap) {
        str = "yes";
    } else {
        str = "no";
    }
    textField = new JTextArea(str);
    textField.setEditable(false);
    textField.setLineWrap(true);
    builder.append("Has inverse:", textField);

    if (model instanceof DifferentiableMap) {
        str = "yes";
    } else {
        str = "no";
    }
    textField = new JTextArea(str);
    textField.setEditable(false);
    textField.setLineWrap(true);
    builder.append("Has jacobian:", textField);

    if (modelDesc != null) {
        builder.appendSeparator("Model description");

        textField = new JTextArea(modelDesc);
        textField.setEditable(false);
        textField.setLineWrap(true);
        textField.setWrapStyleWord(true);
        builder.appendRow(builder.getLineGapSpec());
        builder.appendRow("t:p:n");
        builder.nextLine(2);
        //builder.append("Model description:");
        builder.add(textField, cc.xywh(builder.getColumn(), builder.getRow(), 3, 1));

        builder.nextLine();
    }

    if (modelText != null) {
        builder.appendSeparator("Model text");

        JPanel panel = new JPanel(new BorderLayout());
        JTextArea area = new JTextArea(modelText);
        area.setLineWrap(false);
        //area.setWrapStyleWord(true);
        area.setCaretPosition(0);
        area.setEditable(false);
        panel.add(new JScrollPane(area));
        builder.appendRow(builder.getLineGapSpec());
        builder.appendRow("t:50dlu:g");
        builder.nextLine(2);
        //builder.append("Model description:");
        builder.add(panel, cc.xywh(builder.getColumn(), builder.getRow(), 3, 1));

        builder.nextLine();
    }

    builder.appendSeparator("Memory");

    final JTextArea maxMem = new JTextArea("1");
    maxMem.setEditable(false);
    maxMem.setLineWrap(true);
    builder.append("Max memory:", maxMem);

    final JTextArea totMem = new JTextArea();
    totMem.setEditable(false);
    totMem.setLineWrap(true);
    builder.append("Total memory:", totMem);

    final JTextArea freeMem = new JTextArea();
    freeMem.setEditable(false);
    freeMem.setLineWrap(true);
    builder.append("Free memory:", freeMem);

    // TODO kludge
    if (showMemoryThread != null) {
        showMemoryThread.interrupt();
    }

    // TODO change this to a swing timer
    showMemoryThread = new Thread("showMemory") {
        public void run() {
            Runtime runtime;
            do {
                runtime = Runtime.getRuntime();
                maxMem.setText(Long.toString(runtime.maxMemory() / (1024 * 1024)) + " MB");
                totMem.setText(Long.toString(runtime.totalMemory() / (1024 * 1024)) + " MB");
                freeMem.setText(Long.toString(runtime.freeMemory() / (1024 * 1024)) + " MB");

                if (Thread.interrupted()) {
                    break;
                }
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    break;
                }
            } while (true);
        }
    };

    showMemoryThread.start();
}

From source file:org.tsho.dmc2.ui.WindowsSizePanel.java

License:Open Source License

/**
 *
 *//*w ww .j a  v a  2  s .  com*/
public WindowsSizePanel(int width, int height) {
    super();

    hModel = new SpinnerNumberModel(width, 0, Integer.MAX_VALUE, 10);
    vModel = new SpinnerNumberModel(height, 0, Integer.MAX_VALUE, 10);
    wSpinner.setModel(hModel);
    hSpinner.setModel(vModel);

    checkBox = new JCheckBox();
    checkBox.addItemListener(this);

    if (DEFAULT_CHECKBOX_SELECTED == true) {
        checkBox.setSelected(true);
    }

    FormLayout layout = new FormLayout("right:max(40dlu;pref), 3dlu, fill:min(30dlu;pref), 20dlu", "");

    DefaultFormBuilder builder;

    builder = new DefaultFormBuilder(this, layout);

    builder.setDefaultDialogBorder();

    builder.appendSeparator("Plot dimensions");
    builder.nextLine();

    builder.appendRow(builder.getLineGapSpec());
    builder.nextLine();

    builder.append("Width", wSpinner);
    builder.nextLine();

    builder.append("Height", hSpinner);
    builder.nextLine();

    builder.append("Square", checkBox);
    builder.nextLine();
}