Search in sources :

Example 6 with JCayenneCheckBox

use of org.apache.cayenne.swing.components.JCayenneCheckBox 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)

Example 7 with JCayenneCheckBox

use of org.apache.cayenne.swing.components.JCayenneCheckBox 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)

Aggregations

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