Search in sources :

Example 1 with TextAdapter

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

the class ProcedureTab method initView.

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

        @Override
        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);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JCayenneCheckBox(org.apache.cayenne.swing.components.JCayenneCheckBox) JTextField(javax.swing.JTextField)

Example 2 with TextAdapter

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

the class EjbqlQueryMainTab method initView.

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

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

        @Override
        protected void updateModel(String text) {
            setQueryComment(text);
        }
    };
    properties = new EjbqlQueryPropertiesPanel(mediator);
    // assemble
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("right:max(80dlu;pref), 3dlu, fill:max(200dlu;pref)", "p, 3dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.addSeparator("EJBQL Query Settings", cc.xywh(1, 1, 3, 1));
    builder.addLabel("Query Name:", cc.xy(1, 3));
    builder.add(name.getComponent(), cc.xy(3, 3));
    builder.addLabel("Comment:", cc.xy(1, 5));
    builder.add(comment.getComponent(), cc.xy(3, 5));
    this.setLayout(new BorderLayout());
    this.add(builder.getPanel(), BorderLayout.NORTH);
    this.add(properties, 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) JTextField(javax.swing.JTextField) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 3 with TextAdapter

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

the class EmbeddableTab method initView.

private void initView() {
    this.setLayout(new BorderLayout());
    JToolBar toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);
    ActionManager actionManager = Application.getInstance().getActionManager();
    toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
    add(toolBar, BorderLayout.NORTH);
    className = new TextAdapter(new JTextField()) {

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

        @Override
        protected void updateModel(String text) {
            setComment(text);
        }
    };
    FormLayout layout = new FormLayout("right:50dlu, 3dlu, fill:150dlu, 3dlu, fill:100", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append("Class Name:", className.getComponent(), 3);
    builder.append("Comment:", comment.getComponent(), 3);
    add(builder.getPanel(), BorderLayout.CENTER);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) FormLayout(com.jgoodies.forms.layout.FormLayout) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JToolBar(javax.swing.JToolBar) JTextField(javax.swing.JTextField)

Example 4 with TextAdapter

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

the class DbEntityTab method initView.

private void initView() {
    toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);
    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);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel) ValidationException(org.apache.cayenne.validation.ValidationException) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) JTextField(javax.swing.JTextField) ActionManager(org.apache.cayenne.modeler.action.ActionManager) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder)

Example 5 with TextAdapter

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

the class ObjEntityTab method initView.

private void initView() {
    this.setLayout(new BorderLayout());
    JToolBar toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);
    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);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) Insets(java.awt.Insets) ValidationException(org.apache.cayenne.validation.ValidationException) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) JTextField(javax.swing.JTextField) ActionManager(org.apache.cayenne.modeler.action.ActionManager) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) JCayenneCheckBox(org.apache.cayenne.swing.components.JCayenneCheckBox)

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