Search in sources :

Example 6 with TextAdapter

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

the class ProcedureQueryView 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);
        }
    };
    queryRoot = Application.getWidgetFactory().createUndoableComboBox();
    queryRoot.setRenderer(CellRenderers.listRendererWithIcons());
    properties = new ProcedureQueryPropertiesPanel(mediator);
    // assemble
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("right:max(80dlu;pref), 3dlu, fill:max(200dlu;pref)", "p, 3dlu, p, 3dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.addSeparator("ProcedureQuery 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("Procedure:", cc.xy(1, 5));
    builder.add(queryRoot, cc.xy(3, 5));
    builder.addLabel("Comment:", cc.xy(1, 7));
    builder.add(comment.getComponent(), cc.xy(3, 7));
    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) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 7 with TextAdapter

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

the class SQLTemplateMainTab 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 SQLTemplateQueryPropertiesPanel(mediator);
    // assemble
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("right:max(80dlu;pref), 3dlu, fill:max(200dlu;pref)", "p, 3dlu, p, 3dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.addSeparator("SQLTemplate 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));
    builder.addLabel("Query Root:", cc.xy(1, 7));
    builder.add(queryRoot, cc.xy(3, 7));
    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 8 with TextAdapter

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

the class SelectPropertiesPanel method initView.

protected void initView() {
    fetchOffset = new TextAdapter(new JTextField(7)) {

        protected void updateModel(String text) {
            setFetchOffset(text);
        }
    };
    fetchLimit = new TextAdapter(new JTextField(7)) {

        protected void updateModel(String text) {
            setFetchLimit(text);
        }
    };
    pageSize = new TextAdapter(new JTextField(7)) {

        protected void updateModel(String text) {
            setPageSize(text);
        }
    };
    cacheStrategy = Application.getWidgetFactory().createUndoableComboBox();
    cacheStrategy.setRenderer(new CacheStrategyRenderer());
    cacheGroups = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setCacheGroups(text);
        }
    };
}
Also used : TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JTextField(javax.swing.JTextField)

Example 9 with TextAdapter

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

the class SelectQueryMainTab method initView.

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

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

        @Override
        protected void updateModel(String text) {
            setQueryQualifier(text);
        }

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

        @Override
        protected void updateModel(String text) {
            setQueryComment(text);
        }
    };
    distinct = new JCayenneCheckBox();
    properties = new ObjectQueryPropertiesPanel(mediator);
    // assemble
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("right:max(80dlu;pref), 3dlu, fill:200dlu", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.addSeparator("SelectQuery 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("Query Root:", cc.xy(1, 5));
    builder.add(queryRoot, cc.xy(3, 5));
    builder.addLabel("Qualifier:", cc.xy(1, 7));
    builder.add(qualifier.getComponent(), cc.xy(3, 7));
    builder.addLabel("Distinct:", cc.xy(1, 9));
    builder.add(distinct, cc.xy(3, 9));
    builder.addLabel("Comment:", cc.xy(1, 11));
    builder.add(comment.getComponent(), cc.xy(3, 11));
    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) ValidatorTextAdapter(org.apache.cayenne.modeler.util.ValidatorTextAdapter) ValidationException(org.apache.cayenne.validation.ValidationException) BorderLayout(java.awt.BorderLayout) ValidatorTextAdapter(org.apache.cayenne.modeler.util.ValidatorTextAdapter) 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 10 with TextAdapter

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

the class PKCustomSequenceGeneratorPanel method initView.

private void initView() {
    JLabel note = new JLabel("* Custom sequences are supported on Oracle and Postgres");
    note.setFont(note.getFont().deriveFont(Font.ITALIC).deriveFont(11f));
    customPKName = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) throws ValidationException {
            setPKName(text);
        }
    };
    customPKSize = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) throws ValidationException {
            setPKSize(text);
        }
    };
    // assemble
    DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("right:70dlu, 3dlu, 20dlu, 3dlu, fill:177dlu", ""));
    builder.setDefaultDialogBorder();
    builder.append("Sequence Name:", customPKName.getComponent(), 3);
    builder.append("Cached PK Size:", customPKSize.getComponent());
    builder.nextLine();
    builder.append("", note, 3);
    setLayout(new BorderLayout());
    add(builder.getPanel(), BorderLayout.CENTER);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) ValidationException(org.apache.cayenne.validation.ValidationException) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) 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