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

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

Introduction

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

Prototype

public JComponent appendSeparator(String text) 

Source Link

Document

Adds a separator with the given text that spans all columns.

Usage

From source file:org.apache.cayenne.modeler.editor.datanode.AdapterView.java

License:Apache License

public AdapterView() {
    this.customAdapter = new JTextFieldUndoable();

    // assemble/* w  w w . ja  va2s .  c  o  m*/

    DefaultFormBuilder topPanelBuilder = new DefaultFormBuilder(
            new FormLayout("right:pref, 3dlu, fill:200dlu", ""));
    topPanelBuilder.setDefaultDialogBorder();

    topPanelBuilder.appendSeparator("DbAdapter Configuration");
    topPanelBuilder.append("Custom Adapter (optional):", customAdapter);

    setLayout(new BorderLayout());
    add(topPanelBuilder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.datanode.CustomDataSourceView.java

License:Apache License

public CustomDataSourceView() {

    locationHint = new JTextFieldUndoable();

    // assemble//from w ww.j a  va  2 s. com
    FormLayout layout = new FormLayout("right:80dlu, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("Custom Configuration");

    builder.append("Location Hint:", locationHint);

    this.setLayout(new BorderLayout());
    this.add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.datanode.DBCP2DataSourceView.java

License:Apache License

public DBCP2DataSourceView() {

    propertiesFile = new JTextFieldUndoable();

    // assemble/*  ww w . j a  v  a  2  s  . c om*/
    FormLayout layout = new FormLayout("right:80dlu, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("Apache DBCP2 Configuration");

    builder.append("DBCP2 Properties File:", propertiesFile);

    setLayout(new BorderLayout());
    add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.datanode.DBCPDataSourceView.java

License:Apache License

public DBCPDataSourceView() {

    propertiesFile = new JTextFieldUndoable();

    // assemble//from  w  ww .j av a 2 s  .c  om
    FormLayout layout = new FormLayout("right:80dlu, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("Apache DBCP Configuration");

    builder.append("DBCP Properties File:", propertiesFile);

    setLayout(new BorderLayout());
    add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.datanode.JNDIDataSourceView.java

License:Apache License

public JNDIDataSourceView() {

    jndiPath = new JTextFieldUndoable();

    // assemble/*from  w  ww.  j av a 2s.co  m*/
    FormLayout layout = new FormLayout("right:80dlu, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("JNDI Configuration");

    builder.append("JNDI Location:", jndiPath);

    this.setLayout(new BorderLayout());
    this.add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.datanode.MainDataNodeView.java

License:Apache License

public MainDataNodeView() {

    // create widgets
    this.dataNodeName = new JTextFieldUndoable();

    this.factories = Application.getWidgetFactory().createUndoableComboBox();

    factories.addActionListener(this::showWarningMessage);

    this.localDataSources = Application.getWidgetFactory().createUndoableComboBox();

    this.schemaUpdateStrategy = Application.getWidgetFactory().createUndoableComboBox();
    this.dataSourceDetailLayout = new CardLayout();
    this.dataSourceDetail = new JPanel(dataSourceDetailLayout);

    this.configLocalDataSources = new JButton("...");
    this.configLocalDataSources.setToolTipText("configure local DataSource");

    // assemble/*  w w w . ja  v  a  2 s  .  c  o  m*/

    DefaultFormBuilder topPanelBuilder = new DefaultFormBuilder(
            new FormLayout("right:80dlu, 3dlu, fill:177dlu, 3dlu, fill:20dlu", ""));
    topPanelBuilder.setDefaultDialogBorder();

    topPanelBuilder.appendSeparator("DataNode Configuration");
    topPanelBuilder.append("DataNode Name:", getDataNodeName(), 3);
    topPanelBuilder.append("Schema Update Strategy:", schemaUpdateStrategy, 3);

    DefaultFormBuilder builderForLabel = new DefaultFormBuilder(new FormLayout("right:199dlu"));
    JLabel label = new JLabel("You can enter custom class implementing SchemaUpdateStrategy");
    Font font = new Font(getFont().getName(), Font.PLAIN, getFont().getSize() - 2);
    label.setFont(font);
    builderForLabel.append(label);

    topPanelBuilder.append("", builderForLabel.getPanel(), 3);
    topPanelBuilder.append("Local DataSource (opt.):", localDataSources, configLocalDataSources);
    topPanelBuilder.append("DataSource Factory:", factories, 3);

    setLayout(new BorderLayout());
    add(topPanelBuilder.getPanel(), BorderLayout.NORTH);
    add(dataSourceDetail, BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.dbentity.DbEntityTab.java

License:Apache License

private void initView() {

    toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);/*ww  w . jav  a2  s .c om*/
    ActionManager actionManager = Application.getInstance().getActionManager();

    toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(CreateRelationshipAction.class).buildButton(3));
    toolBar.addSeparator();

    toolBar.add(actionManager.getAction(CreateObjEntityFromDbAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(DbEntitySyncAction.class).buildButton(2));
    toolBar.add(actionManager.getAction(DbEntityCounterpartAction.class).buildButton(3));
    toolBar.addSeparator();

    toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());

    // create widgets
    name = new TextAdapter(new JTextField()) {
        protected void updateModel(String text) {
            setEntityName(text);
        }
    };

    catalogLabel = new JLabel("Catalog:");
    catalog = new TextAdapter(new JTextField()) {
        protected void updateModel(String text) throws ValidationException {
            setCatalog(text);
        }
    };

    schemaLabel = new JLabel("Schema:");
    schema = new TextAdapter(new JTextField()) {
        protected void updateModel(String text) throws ValidationException {
            setSchema(text);
        }
    };

    qualifier = new TextAdapter(new JTextField()) {
        protected void updateModel(String qualifier) {
            setQualifier(qualifier);
        }
    };

    comment = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) throws ValidationException {
            setComment(text);
        }
    };

    pkGeneratorType = new JComboBox<>();
    pkGeneratorType.setEditable(false);
    pkGeneratorType.setModel(new DefaultComboBoxModel<>(PK_GENERATOR_TYPES));

    pkGeneratorDetailLayout = new CardLayout();
    pkGeneratorDetail = new JPanel(pkGeneratorDetailLayout);
    pkGeneratorDetail.add(new PKDefaultGeneratorPanel(mediator), PK_DEFAULT_GENERATOR);
    pkGeneratorDetail.add(new PKDBGeneratorPanel(mediator), PK_DB_GENERATOR);
    pkGeneratorDetail.add(new PKCustomSequenceGeneratorPanel(mediator), PK_CUSTOM_SEQUENCE_GENERATOR);

    // assemble
    FormLayout layout = new FormLayout("right:pref, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("DbEntity Configuration");
    builder.append("DbEntity Name:", name.getComponent());
    builder.append(catalogLabel, catalog.getComponent());
    builder.append(schemaLabel, schema.getComponent());
    builder.append("Qualifier:", qualifier.getComponent());
    builder.append("Comment:", comment.getComponent());

    builder.appendSeparator("Primary Key");
    builder.append("PK Generation Strategy:", pkGeneratorType);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    mainPanel.add(builder.getPanel(), BorderLayout.NORTH);
    mainPanel.add(pkGeneratorDetail, BorderLayout.CENTER);

    setLayout(new BorderLayout());
    add(toolBar, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.ObjEntityTab.java

License:Apache License

private void initView() {
    this.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);// w  w w . java  2  s. c  o m
    ActionManager actionManager = Application.getInstance().getActionManager();

    toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(CreateRelationshipAction.class).buildButton(3));
    toolBar.addSeparator();
    toolBar.add(actionManager.getAction(ObjEntitySyncAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(ObjEntityCounterpartAction.class).buildButton(3));
    toolBar.addSeparator();
    toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());

    add(toolBar, BorderLayout.NORTH);

    // create widgets
    name = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setEntityName(text);
        }
    };
    superClassName = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setSuperClassName(text);
        }
    };
    className = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setClassName(text);
        }
    };
    qualifier = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setQualifier(text);
        }
    };

    dbEntityCombo = Application.getWidgetFactory().createComboBox();
    superEntityCombo = Application.getWidgetFactory().createComboBox();

    AutoCompletion.enable(dbEntityCombo);
    AutoCompletion.enable(superEntityCombo);

    readOnly = new JCayenneCheckBox();

    optimisticLocking = new JCayenneCheckBox();

    // borderless clickable button used as a label
    tableLabel = new JButton("Table/View:");
    tableLabel.setBorderPainted(false);
    tableLabel.setHorizontalAlignment(SwingConstants.LEFT);
    tableLabel.setFocusPainted(false);
    tableLabel.setMargin(new Insets(0, 0, 0, 0));
    tableLabel.setBorder(null);

    isAbstract = new JCayenneCheckBox();
    serverOnly = new JCayenneCheckBox();

    comment = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) throws ValidationException {
            setComment(text);
        }
    };
    clientClassName = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setClientClassName(text);
        }
    };
    clientSuperClassName = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setClientSuperClassName(text);
        }
    };

    // assemble
    FormLayout layout = new FormLayout("right:pref, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("ObjEntity Configuration");
    builder.append("ObjEntity Name:", name.getComponent());
    builder.append("Inheritance:", superEntityCombo);
    builder.append(tableLabel, dbEntityCombo);
    isAbstractLabel = builder.append("Abstract class:", isAbstract);
    builder.append("Comment:", comment.getComponent());
    builder.appendSeparator();

    builder.append("Java Class:", className.getComponent());

    superclassLabel = builder.append("Superclass:", superClassName.getComponent());
    builder.append("Qualifier:", qualifier.getComponent());
    builder.append("Read-Only:", readOnly);
    builder.append("Optimistic Locking:", optimisticLocking);

    clientSeparator = builder.appendSeparator("Java Client");
    serverOnlyLabel = builder.append("Not for Client Use:", serverOnly);
    clientClassNameLabel = builder.append("Client Java Class:", clientClassName.getComponent());
    clientSuperClassNameLabel = builder.append("Client Superclass:", clientSuperClassName.getComponent());

    add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.editor.ProcedureTab.java

License:Apache License

private void initView() {
    // create widgets

    this.name = new TextAdapter(new JTextField()) {
        @Override/*from ww  w.  j  av  a  2s.com*/
        protected void updateModel(String text) {
            setProcedureName(text);
        }
    };

    this.schema = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setSchema(text);
        }
    };

    this.catalog = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setCatalog(text);
        }
    };

    this.comment = new TextAdapter(new JTextField()) {
        @Override
        protected void updateModel(String text) {
            setComment(text);
        }
    };

    this.returnsValue = new JCayenneCheckBox();
    this.returnsValue.setToolTipText("first parameter will be used as return value");

    FormLayout layout = new FormLayout("right:pref, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("Stored Procedure Configuration");
    builder.append("Procedure Name:", name.getComponent());
    builder.append("Catalog:", catalog.getComponent());
    builder.append("Schema:", schema.getComponent());
    builder.append("Returns Value:", returnsValue);
    builder.append("Comment:", comment.getComponent());

    this.setLayout(new BorderLayout());
    this.add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.apache.cayenne.modeler.util.PanelFactory.java

License:Apache License

/** 
 * Create panel with aligned labels on the right and fields on the left.
 *//*from   www.  jav a2  s  .  c  o  m*/
public static JPanel createForm(String title, Component[] leftComponents, Component[] rightComponents) {

    if (leftComponents.length != rightComponents.length) {
        throw new IllegalArgumentException("Arrays must be the same size, instead got " + leftComponents.length
                + "and " + rightComponents.length);
    }

    int numRows = leftComponents.length;
    if (numRows == 0) {
        throw new IllegalArgumentException("Zero components.");
    }

    FormLayout layout = new FormLayout("right:100, 3dlu, left:300", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    if (title != null) {
        builder.appendSeparator(title);
    }

    for (int i = 0; i < numRows; i++) {
        builder.append(leftComponents[i], rightComponents[i]);
        builder.nextLine();
    }

    return builder.getPanel();
}