Search in sources :

Example 11 with ActionManager

use of org.apache.cayenne.modeler.action.ActionManager in project cayenne by apache.

the class ObjEntityAttributeRelationshipTab method initToolBar.

private void initToolBar() {
    toolBar = new JToolBar();
    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();
    Icon ico = ModelerUtil.buildIcon("icon-edit.png");
    resolve.setToolTipText("Edit");
    resolve.setIcon(ico);
    resolve.setDisabledIcon(FilteredIconFactory.createDisabledIcon(ico));
    toolBar.add(resolve).setEnabled(false);
    cut = actionManager.getAction(CutAttributeRelationshipAction.class);
    remove = actionManager.getAction(RemoveAttributeRelationshipAction.class);
    copy = actionManager.getAction(CopyAttributeRelationshipAction.class);
    toolBar.addSeparator();
    toolBar.add(remove.buildButton());
    toolBar.addSeparator();
    toolBar.add(cut.buildButton(1));
    toolBar.add(copy.buildButton(2));
    toolBar.add(actionManager.getAction(PasteAction.class).buildButton(3));
    add(toolBar, BorderLayout.NORTH);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) RemoveAttributeRelationshipAction(org.apache.cayenne.modeler.action.RemoveAttributeRelationshipAction) CopyAttributeRelationshipAction(org.apache.cayenne.modeler.action.CopyAttributeRelationshipAction) JToolBar(javax.swing.JToolBar) Icon(javax.swing.Icon) CutAttributeRelationshipAction(org.apache.cayenne.modeler.action.CutAttributeRelationshipAction)

Example 12 with ActionManager

use of org.apache.cayenne.modeler.action.ActionManager 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 13 with ActionManager

use of org.apache.cayenne.modeler.action.ActionManager in project cayenne by apache.

the class ProcedureParameterTab method init.

protected void init() {
    setLayout(new BorderLayout());
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    ActionManager actionManager = Application.getInstance().getActionManager();
    toolBar.add(actionManager.getAction(CreateProcedureParameterAction.class).buildButton(1));
    removeParameterButton = actionManager.getAction(RemoveProcedureParameterAction.class).buildButton(3);
    toolBar.add(removeParameterButton);
    toolBar.addSeparator();
    Icon up = ModelerUtil.buildIcon("icon-up.png");
    Icon down = ModelerUtil.buildIcon("icon-down.png");
    moveUp = new CayenneAction.CayenneToolbarButton(null, 1);
    moveUp.setIcon(up);
    moveUp.setDisabledIcon(FilteredIconFactory.createDisabledIcon(up));
    moveUp.setToolTipText("Move Parameter Up");
    toolBar.add(moveUp);
    moveDown = new CayenneAction.CayenneToolbarButton(null, 3);
    moveDown.setIcon(down);
    moveDown.setDisabledIcon(FilteredIconFactory.createDisabledIcon(down));
    moveDown.setToolTipText("Move Parameter Down");
    toolBar.add(moveDown);
    toolBar.addSeparator();
    toolBar.add(actionManager.getAction(CutProcedureParameterAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(CopyProcedureParameterAction.class).buildButton(2));
    toolBar.add(actionManager.getAction(PasteAction.class).buildButton(3));
    add(toolBar, BorderLayout.NORTH);
    // Create table with two columns and no rows.
    table = new CayenneTable();
    tablePreferences = new TableColumnPreferences(this.getClass(), "procedure/parameterTable");
    // Create and install a popup
    JPopupMenu popup = new JPopupMenu();
    removeParameterMenu = actionManager.getAction(RemoveProcedureParameterAction.class).buildMenu();
    popup.add(removeParameterMenu);
    popup.addSeparator();
    moveUpMenu = new JMenuItem("Move Parameter Up", up);
    moveDownMenu = new JMenuItem("Move Parameter Down", down);
    popup.add(moveUpMenu);
    popup.add(moveDownMenu);
    popup.addSeparator();
    popup.add(actionManager.getAction(CutProcedureParameterAction.class).buildMenu());
    popup.add(actionManager.getAction(CopyProcedureParameterAction.class).buildMenu());
    popup.add(actionManager.getAction(PasteAction.class).buildMenu());
    TablePopupHandler.install(table, popup);
    add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
    actionManager.setupCutCopyPaste(table, CutProcedureParameterAction.class, CopyProcedureParameterAction.class);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) CayenneTable(org.apache.cayenne.modeler.util.CayenneTable) BorderLayout(java.awt.BorderLayout) JToolBar(javax.swing.JToolBar) Icon(javax.swing.Icon) TableColumnPreferences(org.apache.cayenne.modeler.pref.TableColumnPreferences) JMenuItem(javax.swing.JMenuItem) CayenneAction(org.apache.cayenne.modeler.util.CayenneAction) JPopupMenu(javax.swing.JPopupMenu)

Example 14 with ActionManager

use of org.apache.cayenne.modeler.action.ActionManager in project cayenne by apache.

the class DbEntityAttributeRelationshipTab method initToolBar.

private void initToolBar() {
    toolBar = new JToolBar();
    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();
    Icon ico = ModelerUtil.buildIcon("icon-edit.png");
    resolve.setToolTipText("Database Mapping");
    resolve.setIcon(ico);
    resolve.setDisabledIcon(FilteredIconFactory.createDisabledIcon(ico));
    toolBar.add(resolve).setEnabled(false);
    cut = actionManager.getAction(CutAttributeRelationshipAction.class);
    remove = actionManager.getAction(RemoveAttributeRelationshipAction.class);
    copy = actionManager.getAction(CopyAttributeRelationshipAction.class);
    toolBar.addSeparator();
    toolBar.add(remove.buildButton());
    toolBar.addSeparator();
    toolBar.add(cut.buildButton(1));
    toolBar.add(copy.buildButton(2));
    toolBar.add(actionManager.getAction(PasteAction.class).buildButton(3));
    add(toolBar, BorderLayout.NORTH);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) RemoveAttributeRelationshipAction(org.apache.cayenne.modeler.action.RemoveAttributeRelationshipAction) CopyAttributeRelationshipAction(org.apache.cayenne.modeler.action.CopyAttributeRelationshipAction) JToolBar(javax.swing.JToolBar) Icon(javax.swing.Icon) CutAttributeRelationshipAction(org.apache.cayenne.modeler.action.CutAttributeRelationshipAction)

Example 15 with ActionManager

use of org.apache.cayenne.modeler.action.ActionManager in project cayenne by apache.

the class DbEntityTabbedView method resetRemoveButtons.

/**
 * Reset the remove buttons
 */
private void resetRemoveButtons() {
    ActionManager actionManager = Application.getInstance().getActionManager();
    actionManager.getAction(RemoveAttributeAction.class).setEnabled(false);
    actionManager.getAction(RemoveRelationshipAction.class).setEnabled(false);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) RemoveRelationshipAction(org.apache.cayenne.modeler.action.RemoveRelationshipAction) RemoveAttributeAction(org.apache.cayenne.modeler.action.RemoveAttributeAction)

Aggregations

ActionManager (org.apache.cayenne.modeler.action.ActionManager)16 BorderLayout (java.awt.BorderLayout)9 JPopupMenu (javax.swing.JPopupMenu)7 JToolBar (javax.swing.JToolBar)7 Icon (javax.swing.Icon)6 TableColumnPreferences (org.apache.cayenne.modeler.pref.TableColumnPreferences)6 CayenneTable (org.apache.cayenne.modeler.util.CayenneTable)6 CayenneAction (org.apache.cayenne.modeler.util.CayenneAction)4 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)3 FormLayout (com.jgoodies.forms.layout.FormLayout)3 JTextField (javax.swing.JTextField)3 RemoveAttributeAction (org.apache.cayenne.modeler.action.RemoveAttributeAction)3 TextAdapter (org.apache.cayenne.modeler.util.TextAdapter)3 CopyAttributeRelationshipAction (org.apache.cayenne.modeler.action.CopyAttributeRelationshipAction)2 CutAttributeRelationshipAction (org.apache.cayenne.modeler.action.CutAttributeRelationshipAction)2 RemoveAttributeRelationshipAction (org.apache.cayenne.modeler.action.RemoveAttributeRelationshipAction)2 RemoveCallbackMethodAction (org.apache.cayenne.modeler.action.RemoveCallbackMethodAction)2 RemoveRelationshipAction (org.apache.cayenne.modeler.action.RemoveRelationshipAction)2 BoardTableCellRenderer (org.apache.cayenne.modeler.util.BoardTableCellRenderer)2 ValidationException (org.apache.cayenne.validation.ValidationException)2