Search in sources :

Example 11 with TextAdapter

use of org.apache.cayenne.modeler.util.TextAdapter in project cayenne by apache.

the class DataDomainView method initView.

protected void initView() {
    // create widgets
    this.name = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDomainName(text);
        }
    };
    this.objectValidation = new JCayenneCheckBox();
    this.sharedCache = new JCayenneCheckBox();
    // assemble
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("right:pref, 3dlu, fill:50dlu, 3dlu, fill:47dlu, 3dlu, fill:100", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.addSeparator("DataDomain Configuration", cc.xywh(1, 1, 7, 1));
    builder.addLabel("DataDomain Name:", cc.xy(1, 3));
    builder.add(name.getComponent(), cc.xywh(3, 3, 5, 1));
    builder.addLabel("Object Validation:", cc.xy(1, 5));
    builder.add(objectValidation, cc.xy(3, 5));
    builder.addLabel("Use Shared Cache:", cc.xy(1, 7));
    builder.add(sharedCache, cc.xy(3, 7));
    this.setLayout(new BorderLayout());
    this.add(builder.getPanel(), BorderLayout.CENTER);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) PanelBuilder(com.jgoodies.forms.builder.PanelBuilder) BorderLayout(java.awt.BorderLayout) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JCayenneCheckBox(org.apache.cayenne.swing.components.JCayenneCheckBox) JTextField(javax.swing.JTextField) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 12 with TextAdapter

use of org.apache.cayenne.modeler.util.TextAdapter in project cayenne by apache.

the class DataMapView method initView.

private void initView() {
    // create widgets
    name = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDataMapName(text);
        }
    };
    location = new JLabel();
    nodeSelector = Application.getWidgetFactory().createUndoableComboBox();
    nodeSelector.setRenderer(CellRenderers.listRendererWithIcons());
    updateDefaultCatalog = new JButton("Update...");
    defaultCatalog = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDefaultCatalog(text);
        }
    };
    updateDefaultSchema = new JButton("Update...");
    defaultSchema = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDefaultSchema(text);
        }
    };
    quoteSQLIdentifiers = new JCayenneCheckBox();
    comment = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) throws ValidationException {
            updateComment(text);
        }
    };
    updateDefaultPackage = new JButton("Update...");
    defaultPackage = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDefaultPackage(text);
        }
    };
    updateDefaultSuperclass = new JButton("Update...");
    defaultSuperclass = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDefaultSuperclass(text);
        }
    };
    updateDefaultLockType = new JButton("Update...");
    defaultLockType = new JCayenneCheckBox();
    clientSupport = new JCayenneCheckBox();
    updateDefaultClientPackage = new JButton("Update...");
    defaultClientPackage = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDefaultClientPackage(text);
        }
    };
    updateDefaultClientSuperclass = new JButton("Update...");
    defaultClientSuperclass = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setDefaultClientSuperclass(text);
        }
    };
    // assemble
    FormLayout layout = new FormLayout("right:70dlu, 3dlu, fill:180dlu, 3dlu, fill:120", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.appendSeparator("DataMap Configuration");
    builder.append("DataMap Name:", name.getComponent(), 2);
    builder.append("File:", location, 3);
    builder.append("DataNode:", nodeSelector, 2);
    builder.append("Quote SQL Identifiers:", quoteSQLIdentifiers, 3);
    builder.append("Comment:", comment.getComponent(), 2);
    builder.appendSeparator("Entity Defaults");
    builder.append("DB Catalog:", defaultCatalog.getComponent(), updateDefaultCatalog);
    builder.append("DB Schema:", defaultSchema.getComponent(), updateDefaultSchema);
    builder.append("Java Package:", defaultPackage.getComponent(), updateDefaultPackage);
    builder.append("Custom Superclass:", defaultSuperclass.getComponent(), updateDefaultSuperclass);
    builder.append("Optimistic Locking:", defaultLockType, updateDefaultLockType);
    builder.appendSeparator("Client Class Defaults");
    builder.append("Allow Client Entities:", clientSupport, new JPanel());
    defaultClientPackageLabel = builder.append("Client Java Package:", defaultClientPackage.getComponent(), updateDefaultClientPackage);
    defaultClientSuperclassLabel = builder.append("Custom Superclass:", defaultClientSuperclass.getComponent(), updateDefaultClientSuperclass);
    this.setLayout(new BorderLayout());
    add(builder.getPanel(), BorderLayout.CENTER);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JPanel(javax.swing.JPanel) ValidationException(org.apache.cayenne.validation.ValidationException) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JButton(javax.swing.JButton) JCayenneCheckBox(org.apache.cayenne.swing.components.JCayenneCheckBox) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField)

Aggregations

TextAdapter (org.apache.cayenne.modeler.util.TextAdapter)12 FormLayout (com.jgoodies.forms.layout.FormLayout)11 JTextField (javax.swing.JTextField)11 BorderLayout (java.awt.BorderLayout)10 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)6 PanelBuilder (com.jgoodies.forms.builder.PanelBuilder)5 CellConstraints (com.jgoodies.forms.layout.CellConstraints)5 JCayenneCheckBox (org.apache.cayenne.swing.components.JCayenneCheckBox)5 ValidationException (org.apache.cayenne.validation.ValidationException)5 JLabel (javax.swing.JLabel)3 JToolBar (javax.swing.JToolBar)3 ActionManager (org.apache.cayenne.modeler.action.ActionManager)3 JButton (javax.swing.JButton)2 JPanel (javax.swing.JPanel)2 CardLayout (java.awt.CardLayout)1 Insets (java.awt.Insets)1 ValidatorTextAdapter (org.apache.cayenne.modeler.util.ValidatorTextAdapter)1