protected void init() {
this.setLayout(new BorderLayout());
JToolBar toolBar = new JToolBar();
ActionManager actionManager = Application.getInstance().getActionManager();
toolBar.add(actionManager.getAction(CreateObjEntityAction.class).buildButton());
toolBar
.add(actionManager
.getAction(CreateRelationshipAction.class)
.buildButton());
toolBar.add(actionManager.getAction(DbEntitySyncAction.class).buildButton());
toolBar.add(actionManager.getAction(DbEntityCounterpartAction.class).buildButton());
toolBar.addSeparator();
resolve = new JButton();
Icon ico = ModelerUtil.buildIcon("icon-info.gif");
resolve.setIcon(ico);
resolve.setToolTipText("Database Mapping");
toolBar.add(resolve);
toolBar.addSeparator();
toolBar
.add(actionManager
.getAction(RemoveRelationshipAction.class)
.buildButton());
toolBar.addSeparator();
toolBar.add(actionManager.getAction(CutRelationshipAction.class).buildButton());
toolBar.add(actionManager.getAction(CopyRelationshipAction.class).buildButton());
toolBar.add(actionManager.getAction(PasteAction.class).buildButton());
add(toolBar, BorderLayout.NORTH);
table = new CayenneTable();
table.setDefaultRenderer(DbEntity.class, CellRenderers
.entityTableRendererWithIcons(mediator));
tablePreferences = new TableColumnPreferences(
DbRelationshipTableModel.class,
"relationshipTable");
/**
* Create and install a popup
*/
resolveMenu = new JMenuItem("Database Mapping", ico);
JPopupMenu popup = new JPopupMenu();
popup.add(resolveMenu);
popup.add(actionManager.getAction(RemoveRelationshipAction.class).buildMenu());
popup.addSeparator();
popup.add(actionManager.getAction(CutRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(CopyRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(PasteAction.class).buildMenu());
TablePopupHandler.install(table, popup);
add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
actionManager.setupCutCopyPaste(
table,
CutRelationshipAction.class,
CopyRelationshipAction.class);
}