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

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

Introduction

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

Prototype

public JLabel append(String textWithMnemonic, Component component) 

Source Link

Document

Adds a text label and component to the panel.

Usage

From source file:ca.sqlpower.architect.swingui.olap.CalculatedMemberEditPanel.java

License:Open Source License

public CalculatedMemberEditPanel(CalculatedMember model) {
    this.calculatedMember = model;
    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 150dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();/*  w  w w  .j  av  a2 s  .  c o  m*/
    builder.append("Name", nameField = new JTextField(model.getName()));
    builder.append("Caption", captionField = new JTextField(model.getCaption()));
    builder.append("Dimension", dimensionField = new JTextField(model.getDimension()));
    builder.append("Visible",
            visibleCheckBox = new JCheckBox("", model.getVisible() == null ? true : model.getVisible()));
    String formula = null;
    if (model.getFormula() != null) {
        formula = model.getFormula();
    } else if (model.getFormulaElement() != null) {
        formula = model.getFormulaElement().getText();
    }
    builder.append("Formula", formulaTextArea = new JTextArea(formula, 4, 50));
    formulaTextArea.setLineWrap(true);
    builder.append("Format", formatField = new JTextField(model.getFormatString()));
    panel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.CubeEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given OLAP Cube.
 * //from   ww w .j av a2s  . c  o  m
 * TODO remove the dbMapping if it is no longer needed as the session will
 * be used from the playpen or remove the session from the view and join
 * entry panel constructors and pass a dbMapping as required instead.
 * 
 * @param cube
 *            The data model of the cube to edit
 */
public CubeEditPanel(Cube cube, final PlayPen playPen, final SQLDatabaseMapping dbMapping)
        throws SQLObjectException {
    this.cube = cube;

    List<SQLTable> tables = OLAPUtil.getAvailableTables(cube);

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Name", nameField = new JTextField(cube.getName()));
    builder.append("Caption", captionField = new JTextField(cube.getCaption()));
    // default measure is optional so we need to add in a null option
    List<Measure> measures = new ArrayList<Measure>(cube.getMeasures());
    measures.add(0, null);
    builder.append("Default Measure", defMeasure = new JComboBox(measures.toArray()));
    defMeasure.setRenderer(new OLAPObjectListCellRenderer());
    for (Measure ms : cube.getMeasures()) {
        if (ms.getName().equals(cube.getDefaultMeasure())) {
            defMeasure.setSelectedItem(ms);
            break;
        }
    }

    final JButton viewEditButton = new JButton(new AbstractAction("Edit...") {
        public void actionPerformed(ActionEvent e) {
            JDialog dialog = DataEntryPanelBuilder.createDataEntryPanelDialog(
                    new ViewEntryPanel(playPen.getSession(), getDatabase(), CubeEditPanel.this), playPen,
                    "View Builder", DataEntryPanelBuilder.OK_BUTTON_LABEL);
            dialog.pack();
            dialog.setVisible(true);
        }
    });

    builder.appendSeparator("Fact Table");
    tableChooser = new JComboBox(new Vector<SQLTable>(tables));

    final JScrollPane selectStatementsPane = new JScrollPane(selectStatements = new JTextArea("", 4, 30));

    Action radioButtonsAction = new AbstractAction() {
        public void actionPerformed(ActionEvent arg0) {
            tableChooser.setEnabled(tableRadioButton.isSelected());
            selectStatementsPane.setEnabled(viewRadioButton.isSelected());
            viewAlias.setEnabled(viewRadioButton.isSelected());
            viewEditButton.setEnabled(viewRadioButton.isSelected());
        }
    };

    tableRadioButton = new JRadioButton();
    tableRadioButton.setAction(radioButtonsAction);
    tableRadioButton.setText("Use Existing Table");
    viewRadioButton = new JRadioButton();
    viewRadioButton.setAction(radioButtonsAction);
    viewRadioButton.setText("Use View");

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(tableRadioButton);
    buttonGroup.add(viewRadioButton);

    DefaultFormBuilder factBuilder = new DefaultFormBuilder(
            new FormLayout("9dlu, 3dlu, pref, 3dlu, pref:grow"));
    builder.append(factBuilder.getPanel(), 3);

    factBuilder.append(tableRadioButton, 5);
    factBuilder.append("", tableChooser, 3);
    factBuilder.append(viewRadioButton, 5);
    factBuilder.append("", new JLabel("Alias"), viewAlias = new JTextField());
    factBuilder.append("", new JLabel("SELECT Statements"), 3);
    factBuilder.append("", selectStatementsPane, 3);

    factBuilder.append("", viewEditButton);
    factBuilder.nextLine();
    selectStatements.setLineWrap(true);
    selectStatements.setEditable(false);

    if (cube.getFact() instanceof View) {
        viewRadioButton.doClick();
        tableRadioButton.setEnabled(false);
        tableChooser.setEnabled(false);

        //XXX There could be multiple SQL objects in a view but we can only edit one at a time right now.
        final List<SQL> selects = ((View) cube.getFact()).getSelects();
        for (SQL sql : selects) {
            if (sql.getDialect() == null || sql.getDialect().equals("generic")) {
                selectStatements.append(sql.getText());
                break;
            }
        }
        if (selectStatements.getText().trim().length() == 0 && !selects.isEmpty()) {
            selectStatements.append(selects.get(0).getText());
        }
    } else if (tables.isEmpty()) {
        tableChooser.addItem("Database has no tables");
        viewRadioButton.doClick();
        tableRadioButton.setEnabled(false);
        tableChooser.setEnabled(false);
    } else {
        SQLTable t = OLAPUtil.tableForCube(cube);
        //if SQLTable t is not found, then either cube.fact is not defined, or cube.fact is a view
        if (tables.contains(t)) {
            tableChooser.setSelectedItem(t);
            tableRadioButton.doClick();
        } else if (cube.getFact() != null) {
            viewRadioButton.doClick();
        } else {
            tableRadioButton.doClick();
        }
    }

    panel = builder.getPanel();

    handler = new FormValidationHandler(status);
    Validator validator = new OLAPObjectNameValidator((OLAPObject) cube.getParent(), cube, false);
    handler.addValidateObject(nameField, validator);
}

From source file:ca.sqlpower.architect.swingui.olap.DimensionEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given OLAP dimension. 
 * /*from   w  w  w .j  av a  2 s . c  om*/
 * @param dimension The dimension to edit
 * @throws SQLObjectException
 *             if digging up the source table results in a database error
 */
public DimensionEditPanel(Dimension dimension) throws SQLObjectException {
    this.dimension = dimension;

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Name", nameField = new JTextField(dimension.getName()));
    builder.append("Caption", captionField = new JTextField(dimension.getCaption()));
    builder.append("Type", typeBox = new JComboBox(DimensionType.values()));

    if (dimension.getType() != null) {
        typeBox.setSelectedItem(DimensionType.valueOf(dimension.getType()));
    } else {
        typeBox.setSelectedItem(DimensionType.StandardDimension);
    }

    handler = new FormValidationHandler(status, true);
    Validator validator = new OLAPObjectNameValidator((OLAPObject) dimension.getParent(), dimension, false);
    handler.addValidateObject(nameField, validator);

    // private dimensions only.
    if (dimension.getParent() instanceof Cube) {
        builder.append("Foreign Key", foreignKeyChooser = new JComboBox());
        handler.addValidateObject(foreignKeyChooser, new NotNullValidator("Foreign key"));

        Cube cube = (Cube) dimension.getParent();
        SQLTable factTable = OLAPUtil.tableForCube(cube);
        if (factTable == null) {
            foreignKeyChooser.addItem("Parent Cube has no fact table");
            foreignKeyChooser.setEnabled(false);
        } else if (factTable.getColumns().isEmpty()) {
            foreignKeyChooser.addItem("Parent Cube Fact table has no columns");
            foreignKeyChooser.setEnabled(false);
        } else {
            foreignKeyChooser.setModel(new SQLObjectComboBoxModel(factTable, SQLColumn.class));
            for (SQLColumn col : factTable.getColumns()) {
                if (col.getName().equals(dimension.getForeignKey())) {
                    foreignKeyChooser.setSelectedItem(col);
                }
            }
        }
    }

    panel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.DimensionUsageEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given dimension usage.
 * //www.  j  av  a  2  s  .  c  o m
 * @param dimensionUsage
 *            usage The data model of the dimension usage to edit
 * @throws SQLObjectException
 *             if digging up the source table results in a database error
 */
public DimensionUsageEditPanel(DimensionUsage dimensionUsage) throws SQLObjectException {
    this.dimensionUsage = dimensionUsage;

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Caption", captionField = new JTextField(dimensionUsage.getCaption()));
    builder.append("Foreign Key", foreignKeyChooser = new JComboBox());

    Cube cube = (Cube) dimensionUsage.getParent();
    SQLTable factTable = OLAPUtil.tableForCube(cube);
    if (factTable == null) {
        foreignKeyChooser.addItem("Parent Cube has no fact table");
        foreignKeyChooser.setEnabled(false);
    } else if (factTable.getColumns().isEmpty()) {
        foreignKeyChooser.addItem("Parent Cube Fact table has no columns");
        foreignKeyChooser.setEnabled(false);
    } else {
        foreignKeyChooser.setModel(new SQLObjectComboBoxModel(factTable, SQLColumn.class));
        for (SQLColumn col : factTable.getColumns()) {
            if (col.getName().equals(dimensionUsage.getForeignKey())) {
                foreignKeyChooser.setSelectedItem(col);
            }
        }
    }

    handler = new FormValidationHandler(status, true);
    handler.addValidateObject(foreignKeyChooser, new NotNullValidator("Foreign key"));

    panel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.HierarchyEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given OLAP Hierarchy. 
 * //w w  w .j  a  v a2 s  . c  o m
 * @param cube The data model of the hierarchy to edit
 */
public HierarchyEditPanel(Hierarchy hierarchy) throws SQLObjectException {
    this.hierarchy = hierarchy;

    List<SQLTable> tables = OLAPUtil.getAvailableTables(hierarchy);

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Name", name = new JTextField(hierarchy.getName()));
    builder.append("Caption", captionField = new JTextField(hierarchy.getCaption()));
    builder.append("Has All", hasAll = new JCheckBox());
    hasAll.setSelected(hierarchy.getHasAll() != null ? hierarchy.getHasAll() : true);
    builder.append("All Level Name", allLevelName = new JTextField(
            hierarchy.getAllLevelName() != null ? hierarchy.getAllLevelName() : "All"));

    builder.append("Table", tableChooser = new JComboBox(new Vector<SQLTable>(tables)));
    builder.append("Primary Key", primaryKey = new JComboBox());

    if (tables.isEmpty()) {
        tableChooser.addItem("Database has no tables");
        tableChooser.setEnabled(false);
        primaryKey.addItem("Table not selected");
        primaryKey.setEnabled(false);
    } else {
        SQLTable t = OLAPUtil.tableForHierarchy(hierarchy);
        if (tables.contains(t)) {
            tableChooser.setSelectedItem(t);
        } else {
            t = (SQLTable) tableChooser.getSelectedItem();
        }
        updateColumns(hierarchy.getPrimaryKey());
    }

    tableChooser.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            updateColumns(null);
        }
    });

    handler = new FormValidationHandler(status, true);
    Validator validator = new OLAPObjectNameValidator((OLAPObject) hierarchy.getParent(), hierarchy, true);
    handler.addValidateObject(name, validator);
    handler.addValidateObject(primaryKey, new NotNullValidator("Primary key"));

    panel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.LevelEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given level of a hierarchy.
 * /*from  w  ww . ja  va2  s.c  om*/
 * @param cube
 *            The data model of the Level to edit
 * @throws SQLObjectException
 *             if digging up the source table results in a database error
 */
public LevelEditPanel(Level level) throws SQLObjectException {
    this.level = level;

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Name", name = new JTextField(level.getName()));
    builder.append("Caption", captionField = new JTextField(level.getCaption()));
    builder.append("Column", columnChooser = new JComboBox());

    if (level.getUniqueMembers() != null) {
        builder.append("Unique Members", uniqueMembers = new JCheckBox("", level.getUniqueMembers()));
    } else {
        builder.append("Unique Members", uniqueMembers = new JCheckBox(""));
    }

    Hierarchy hierarchy = (Hierarchy) level.getParent();

    Dimension dimension = (Dimension) hierarchy.getParent();

    // Currently, the levelType attribute appears to only apply to Time Dimensions
    if (dimension.getType() != null && dimension.getType().equals("TimeDimension")) {
        builder.append("Level Type", levelType = new JComboBox(LevelType.values()));
        if (level.getLevelType() != null) {
            levelType.setSelectedItem(LevelType.valueOf(level.getLevelType()));
        } else {
            levelType.setSelectedItem(LevelType.values()[0]);
        }
    }

    SQLTable dimensionTable = OLAPUtil.tableForHierarchy(hierarchy);

    // if the hierarchy's table was not set, then we try to find it from elsewhere.
    // we'll look through the cubes that reference the hierarchy's parent dimension
    // and if the fact table and foreign keys of those are same through out, we set
    // those values for the hierarchy.
    if (dimensionTable == null) {
        OLAPSession oSession = OLAPUtil.getSession(level);
        Schema sch = oSession.getSchema();
        String parentDimName = hierarchy.getParent().getName();

        boolean valid = true;
        Table fact = null;
        String foreignKey = null;
        for (int i = 0; i < sch.getCubes().size() && valid; i++) {
            Cube c = sch.getCubes().get(i);
            if (c.getFact() == null)
                continue;
            for (CubeDimension cd : c.getDimensions()) {
                if (cd instanceof DimensionUsage) {
                    DimensionUsage du = (DimensionUsage) cd;
                    if (du.getSource().equalsIgnoreCase(parentDimName)) {
                        Table rel = (Table) c.getFact();
                        String fk = du.getForeignKey();

                        if (fk != null) {
                            if (fact == null && foreignKey == null) {
                                fact = rel;
                                foreignKey = fk;
                            } else {
                                if (!fact.getSchema().equalsIgnoreCase(rel.getSchema())
                                        || !fact.getName().equalsIgnoreCase(rel.getName())
                                        || !foreignKey.equalsIgnoreCase(fk)) {
                                    valid = false;
                                }
                            }
                        }

                        break;
                    }
                }
            }
        }

        if (valid && fact != null && foreignKey != null) {
            dimensionTable = OLAPUtil.getSQLTableFromOLAPTable(oSession.getDatabase(), fact);
            Table tab = new Table();
            tab.setSchema(fact.getSchema());
            tab.setName(fact.getName());
            hierarchy.setRelation(tab);
            hierarchy.setPrimaryKey(foreignKey);
        }
    }

    if (dimensionTable == null) {
        columnChooser.addItem("Parent hierarchy has no table");
        columnChooser.setEnabled(false);
    } else if (dimensionTable.getColumns().isEmpty()) {
        columnChooser.addItem("Parent hierarchy table has no columns");
        columnChooser.setEnabled(false);
    } else {
        columnChooser.setModel(new SQLObjectComboBoxModel(dimensionTable, SQLColumn.class));
        for (SQLColumn col : dimensionTable.getColumns()) {
            if (col.getName().equalsIgnoreCase(level.getColumn())) {
                columnChooser.setSelectedItem(col);
            }
        }
    }

    handler = new FormValidationHandler(status, true);
    Validator validator = new OLAPObjectNameValidator((OLAPObject) level.getParent(), level, false);
    handler.addValidateObject(name, validator);
    handler.addValidateObject(columnChooser, new NotNullValidator("Column"));

    builder.appendSeparator("Properties");
    propertiesPanel = new PropertiesEditPanel(dimensionTable, handler);
    builder.append(propertiesPanel, 3);

    panel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.MeasureEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given OLAP Measure. 
 * /*from ww w  .j  av a 2s.  c om*/
 * @param cube The data model of the measure to edit
 * @throws SQLObjectException
 *             if populating the necessary SQLObjects fails
 */
public MeasureEditPanel(Measure measure) throws SQLObjectException {
    this.measure = measure;

    handler = new FormValidationHandler(status, true);
    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Name", name = new JTextField(measure.getName()));
    builder.append("Caption", captionField = new JTextField(measure.getCaption()));

    String[] rolapAggregates = new String[] { "sum", "count", "min", "max", "avg", "distinct-count" };
    builder.append("Aggregator", aggregator = new JComboBox(rolapAggregates));
    if (measure.getAggregator() != null) {
        aggregator.setSelectedItem(measure.getAggregator());
    }

    builder.appendSeparator("Value");

    Action radioButtonsAction = new AbstractAction() {
        public void actionPerformed(ActionEvent arg0) {
            columnChooser.setEnabled(columnRadioButton.isSelected());
            expression.setEnabled(expRadioButton.isSelected());
            handler.performFormValidation();
        }
    };

    columnRadioButton = new JRadioButton();
    columnRadioButton.setAction(radioButtonsAction);
    columnRadioButton.setText("Use Column");
    expRadioButton = new JRadioButton();
    expRadioButton.setAction(radioButtonsAction);
    expRadioButton.setText("Use Expression");

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(columnRadioButton);
    buttonGroup.add(expRadioButton);

    builder.append(columnRadioButton, 3);
    builder.append(columnChooser = new JComboBox(), 3);
    builder.append(expRadioButton, 3);
    builder.append(new JScrollPane(expression = new JTextArea(4, 30)), 3);
    expression.setLineWrap(true);

    Cube parentCube = (Cube) measure.getParent();
    SQLTable cubeTable = OLAPUtil.tableForCube(parentCube);
    boolean enableColumns = false;
    if (cubeTable == null) {
        columnChooser.addItem("Parent Cube has no table");
    } else if (cubeTable.getColumns().isEmpty()) {
        columnChooser.addItem("Parent Cube table has no columns");
    } else {
        columnChooser.setModel(new SQLObjectComboBoxModel(cubeTable, SQLColumn.class));
        columnRadioButton.doClick();
        for (SQLColumn col : cubeTable.getColumns()) {
            if (col.getName().equalsIgnoreCase(measure.getColumn())) {
                columnChooser.setSelectedItem(col);
                break;
            }
        }
        enableColumns = true;
    }
    columnChooser.setEnabled(enableColumns);
    columnRadioButton.setEnabled(enableColumns);

    SQL exp = null;
    MeasureExpression mExp = measure.getMeasureExp();
    if (mExp != null) {
        for (SQL sql : measure.getMeasureExp().getExpressions()) {
            // we only support generic expressions right now.
            if (sql.getDialect() != null && sql.getDialect().equalsIgnoreCase("generic")) {
                exp = sql;
            }
        }
        expRadioButton.doClick();
    }
    expression.setText(exp == null ? "" : exp.getText());

    if (!columnRadioButton.isSelected()) {
        expRadioButton.doClick();
    }

    Validator validator = new OLAPObjectNameValidator((OLAPObject) measure.getParent(), measure, false);
    handler.addValidateObject(name, validator);
    handler.addValidateObject(columnChooser, new NotNullValidator("Value column"));

    panel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.SchemaEditPanel.java

License:Open Source License

public SchemaEditPanel(ArchitectSwingSession session, Schema schema) throws SQLObjectException {
    this.schema = schema;

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();//from w  w w.  java2s  . c  o m

    builder.append(status, 3);
    builder.append("Database",
            databaseBox = new JComboBox(new SQLObjectComboBoxModel(session.getRootObject(), SQLObject.class)));
    OLAPSession osession = OLAPUtil.getSession(schema);
    if (osession.getDatabase() != null) {
        databaseBox.setSelectedItem(osession.getDatabase());
    } else {
        databaseBox.setSelectedItem(session.getTargetDatabase());
    }
    builder.append("Name", nameField = new JTextField(schema.getName()));

    handler = new FormValidationHandler(status);
    handler.addValidateObject(databaseBox, new NotNullValidator("Schema"));

    editorPanel = builder.getPanel();
}

From source file:ca.sqlpower.architect.swingui.olap.VirtualCubeEditPanel.java

License:Open Source License

/**
 * Creates a new property editor for the given OLAP Virtual Cube. 
 * //w w  w . j a  v  a 2 s.  c om
 * @param vCube The data model of the Virtual Cube to edit
 */
public VirtualCubeEditPanel(VirtualCube vCube) {
    this.vCube = vCube;

    FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, 80dlu:grow", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(status, 3);
    builder.append("Name", nameField = new JTextField(vCube.getName()));
    builder.append("Caption", captionField = new JTextField(vCube.getCaption()));

    // default measure is optional so we need to add in a null option
    List<VirtualCubeMeasure> measures = new ArrayList<VirtualCubeMeasure>(vCube.getMeasures());
    measures.add(0, null);
    builder.append("Default Measure", defMeasure = new JComboBox(measures.toArray()));
    defMeasure.setRenderer(new OLAPObjectListCellRenderer());
    for (VirtualCubeMeasure vMs : vCube.getMeasures()) {
        if (vMs.getName().equals(vCube.getDefaultMeasure())) {
            defMeasure.setSelectedItem(vMs);
            break;
        }
    }

    handler = new FormValidationHandler(status);
    Validator validator = new OLAPObjectNameValidator((OLAPObject) vCube.getParent(), vCube, false);
    handler.addValidateObject(nameField, validator);

    panel = builder.getPanel();
}

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

License:Open Source License

public void setup() {
    com.jgoodies.forms.layout.FormLayout layout = new com.jgoodies.forms.layout.FormLayout("pref,4dlu,pref"); //$NON-NLS-1$
    DefaultFormBuilder fb = new DefaultFormBuilder(layout, new JPanel());
    setLayout(layout);//from  w ww .  j  a v  a2s .co m
    fb.append(Messages.getString("ProjectSettingsPanel.snapshotSourceDbOption"), //$NON-NLS-1$
            saveEntireSource = new JCheckBox());
    fb.nextLine();
    fb.appendUnrelatedComponentsGapRow();
    fb.nextLine();

    fb.append(Messages.getString("ProjectSettingsPanel.numCommonProfileValues"), //$NON-NLS-1$
            numberOfFreqValues = new JTextField("", 6));
    fb.nextLine();
    fb.appendUnrelatedComponentsGapRow();
    fb.nextLine();

    fb.append(Messages.getString("ProjectSettingsPanel.profileMode"), //$NON-NLS-1$
            profileMode = new JComboBox(session.getProfileManager().getProfileCreators().toArray()));
    fb.nextLine();
    fb.appendUnrelatedComponentsGapRow();
    fb.nextLine();

    fb.append(new JLabel(Messages.getString("ProjectSettingsPanel.relationshipLineStyle"))); //$NON-NLS-1$
    fb.append(rectilinearRelationships = new JRadioButton(
            Messages.getString("ProjectSettingsPanel.rectilinearLineOption"))); //$NON-NLS-1$

    fb.nextLine();

    fb.append("", directRelationships = new JRadioButton( //$NON-NLS-1$
            Messages.getString("ProjectSettingsPanel.directLineOption")));
    ButtonGroup lineStyleGroup = new ButtonGroup();
    lineStyleGroup.add(rectilinearRelationships);
    lineStyleGroup.add(directRelationships);

    fb.nextLine();
    fb.appendUnrelatedComponentsGapRow();
    fb.nextLine();

    fb.append(new JLabel(Messages.getString("ProjectSettingsPanel.displayPhysicalOrLogical"))); //$NON-NLS-1$
    fb.append(logicalNames = new JRadioButton(Messages.getString("ProjectSettingsPanel.displayLogicalNames"))); //$NON-NLS-1$
    fb.nextLine();

    fb.append("", //$NON-NLS-1$
            physicalNames = new JRadioButton(Messages.getString("ProjectSettingsPanel.displayPhysicalNames")));
    ButtonGroup nameDisplay = new ButtonGroup();
    nameDisplay.add(logicalNames);
    nameDisplay.add(physicalNames);

    fb.nextLine();
    fb.appendUnrelatedComponentsGapRow();
    fb.nextLine();

    fb.append(new JLabel(Messages.getString("ProjectSettingsPanel.visibilityOfRelationshipLabel"))); //$NON-NLS-1$
    fb.append(displayRelationshipLabel = new JRadioButton(
            Messages.getString("ProjectSettingsPanel.displayRelationshipLabel"))); //$NON-NLS-1$

    fb.nextLine();

    fb.append("", hideRelationshipLabel = new JRadioButton( //$NON-NLS-1$
            Messages.getString("ProjectSettingsPanel.hideRelationshipLabel")));
    ButtonGroup DisplayRelationshipLabel = new ButtonGroup();
    DisplayRelationshipLabel.add(displayRelationshipLabel);
    DisplayRelationshipLabel.add(hideRelationshipLabel);

    fb.nextLine();
    fb.appendUnrelatedComponentsGapRow();
    fb.nextLine();

    fb.append(showAll = new JRadioButton(Messages.getString("ProjectSettingsPanel.showAll"))); //$NON-NLS-1$
    fb.append(showPkTag = new JCheckBox(Messages.getString("ProjectSettingsPanel.showPKTags"))); //$NON-NLS-1$

    fb.nextLine();

    fb.append(showPkFkUniqueIndexed = new JRadioButton(
            Messages.getString("ProjectSettingsPanel.showPKFKUniqueIndexed"))); //$NON-NLS-1$
    fb.append(showFkTag = new JCheckBox(Messages.getString("ProjectSettingsPanel.showFKTags"))); //$NON-NLS-1$

    fb.nextLine();

    fb.append(showPkFkUnique = new JRadioButton(Messages.getString("ProjectSettingsPanel.showPKFKUnique"))); //$NON-NLS-1$
    fb.append(showAkTag = new JCheckBox(Messages.getString("ProjectSettingsPanel.showAKTags"))); //$NON-NLS-1$

    fb.nextLine();

    fb.append(showPkFk = new JRadioButton(Messages.getString("ProjectSettingsPanel.showPKFK"))); //$NON-NLS-1$

    fb.nextLine();

    fb.append(showPk = new JRadioButton(Messages.getString("ProjectSettingsPanel.showPK"))); //$NON-NLS-1$

    fb.nextLine();

    ButtonGroup column_show_settings = new ButtonGroup();
    column_show_settings.add(showAll);
    column_show_settings.add(showPkFkUniqueIndexed);
    column_show_settings.add(showPkFkUnique);
    column_show_settings.add(showPkFk);
    column_show_settings.add(showPk);

    fb.setDefaultDialogBorder();
    this.panel = fb.getPanel();
}