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:org.apache.cayenne.modeler.editor.datanode.DBCP2DataSourceView.java

License:Apache License

public DBCP2DataSourceView() {

    propertiesFile = new JTextFieldUndoable();

    // assemble/*from  w w  w  . j  a  v  a  2  s . c o  m*/
    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 a v a2s.c o m*/
    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 w w. j a  v  a  2  s .  c o  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.dbentity.DbEntityTab.java

License:Apache License

private void initView() {

    toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);/*  ww  w  . j  a  va 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(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.dbentity.PKDBGeneratorPanel.java

License:Apache License

private void initView() {

    attributes = new JComboBox<>();
    attributes.setEditable(false);/*  w w w .  ja v a  2  s .c  o  m*/
    attributes.setRenderer(new AttributeRenderer());

    DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("right:70dlu, 3dlu, fill:200dlu", ""));
    builder.setDefaultDialogBorder();
    builder.append("Auto Incremented:", attributes);

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

From source file:org.apache.cayenne.modeler.editor.dbimport.DbImportView.java

License:Apache License

private void createAdvancedOptionsHiderPanel(DefaultFormBuilder builder) {
    JPanel advancedOptionsPanel = new JPanel();
    advancedOptionsPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    JButton hideButton = new JButton("Advanced Options");
    hideButton.setIcon(configPanel.isVisible() ? downArrow : rightArrow);
    hideButton.setBorderPainted(false);/*from   www  .ja v  a2  s .c om*/
    hideButton.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            configPanel.setVisible(!configPanel.isVisible());
            hideButton.setIcon(configPanel.isVisible() ? downArrow : rightArrow);
        }
    });
    advancedOptionsPanel.add(hideButton);

    builder.append(advancedOptionsPanel, ALL_LINE_SPAN);
}

From source file:org.apache.cayenne.modeler.editor.dbimport.ReverseEngineeringConfigPanel.java

License:Apache License

private void buildView() {
    FormLayout panelLayout = new FormLayout(DATA_FIELDS_LAYOUT);
    DefaultFormBuilder panelBuilder = new DefaultFormBuilder(panelLayout);
    panelBuilder.setDefaultDialogBorder();

    panelBuilder.append("Tables with Meaningful PK Pattern:", meaningfulPk.getComponent());
    panelBuilder.append("Strip from table names:", stripFromTableNames.getComponent());
    panelBuilder.append("Skip relationships loading:", skipRelationshipsLoading);
    panelBuilder.append("Skip primary key loading:", skipPrimaryKeyLoading);
    panelBuilder.append("Force datamap catalog:", forceDataMapCatalog);
    panelBuilder.append("Force datamap schema:", forceDataMapSchema);
    panelBuilder.append("Use Java primitive types:", usePrimitives);
    panelBuilder.append("Use java.util.Date type:", useJava7Types);
    panelBuilder.append(strategyCombo);/*  w w  w  .  j a v  a 2 s  .  com*/

    add(panelBuilder.getPanel());
}

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 .  ja v  a  2 s. co  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  w  w  w.  j a va  2  s  .  c o  m*/
        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.
 *//* w  w w  . jav  a  2 s  .com*/
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();
}