protected void init() {
setLayout(new BorderLayout());
JToolBar toolBar = new JToolBar();
ActionManager actionManager = Application.getInstance().getActionManager();
toolBar.add(actionManager
.getAction(CreateProcedureParameterAction.class)
.buildButton());
removeParameterButton = actionManager.getAction(
RemoveProcedureParameterAction.class).buildButton();
toolBar.add(removeParameterButton);
toolBar.addSeparator();
Icon up = ModelerUtil.buildIcon("icon-move_up.gif");
Icon down = ModelerUtil.buildIcon("icon-move_down.gif");
moveUp = new JButton();
moveUp.setIcon(up);
moveUp.setToolTipText("Move Parameter Up");
toolBar.add(moveUp);
moveDown = new JButton();
moveDown.setIcon(down);
moveDown.setToolTipText("Move Parameter Down");
toolBar.add(moveDown);
toolBar.addSeparator();
toolBar.add(actionManager
.getAction(CutProcedureParameterAction.class)
.buildButton());
toolBar.add(actionManager
.getAction(CopyProcedureParameterAction.class)
.buildButton());
toolBar.add(actionManager.getAction(PasteAction.class).buildButton());
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);
}