Search in sources :

Example 1 with ValidatorTextAdapter

use of org.apache.cayenne.modeler.util.ValidatorTextAdapter 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)

Aggregations

PanelBuilder (com.jgoodies.forms.builder.PanelBuilder)1 CellConstraints (com.jgoodies.forms.layout.CellConstraints)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 BorderLayout (java.awt.BorderLayout)1 JTextField (javax.swing.JTextField)1 TextAdapter (org.apache.cayenne.modeler.util.TextAdapter)1 ValidatorTextAdapter (org.apache.cayenne.modeler.util.ValidatorTextAdapter)1 JCayenneCheckBox (org.apache.cayenne.swing.components.JCayenneCheckBox)1 ValidationException (org.apache.cayenne.validation.ValidationException)1