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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations