use of org.apache.cayenne.modeler.pref.TableColumnPreferences 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.pref.TableColumnPreferences in project cayenne by apache.
the class ResolveDbRelationshipDialog method initView.
/**
* Creates graphical components.
*/
private void initView() {
// create widgets
name = new JTextField(25);
reverseName = new JTextField(25);
addButton = new JButton("Add");
addButton.setEnabled(this.editable);
removeButton = new JButton("Remove");
removeButton.setEnabled(this.editable);
saveButton = new JButton("Done");
cancelButton = new JButton("Cancel");
cancelButton.setEnabled(this.editable);
table = new AttributeTable();
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tablePreferences = new TableColumnPreferences(getClass(), "dbentity/dbjoinTable");
// assemble
getContentPane().setLayout(new BorderLayout());
CellConstraints cc = new CellConstraints();
PanelBuilder builder = new PanelBuilder(new FormLayout("right:max(50dlu;pref), 3dlu, fill:min(150dlu;pref), 3dlu, fill:min(50dlu;pref)", "p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, top:14dlu, 3dlu, top:p:grow"));
builder.setDefaultDialogBorder();
builder.addSeparator("DbRelationship Information", cc.xywh(1, 1, 5, 1));
builder.addLabel("Relationship:", cc.xy(1, 3));
builder.add(name, cc.xywh(3, 3, 1, 1));
builder.addLabel("Reverse Relationship", cc.xy(1, 5));
builder.add(reverseName, cc.xywh(3, 5, 1, 1));
builder.addSeparator("Joins", cc.xywh(1, 7, 5, 1));
builder.add(new JScrollPane(table), cc.xywh(1, 9, 3, 3, "fill, fill"));
JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEADING));
buttons.add(addButton);
buttons.add(removeButton);
builder.add(buttons, cc.xywh(5, 9, 1, 3));
getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
getContentPane().add(PanelFactory.createButtonPanel(new JButton[] { saveButton, cancelButton }), BorderLayout.SOUTH);
}
Aggregations