use of org.apache.cayenne.modeler.pref.TableColumnPreferences in project cayenne by apache.
the class ObjEntityRelationshipPanel method init.
private void init() {
this.setLayout(new BorderLayout());
ActionManager actionManager = Application.getInstance().getActionManager();
table = new CayenneTable();
table.setDefaultRenderer(String.class, new StringRenderer());
table.setDefaultRenderer(ObjEntity.class, new EntityRenderer());
tablePreferences = new TableColumnPreferences(ObjRelationshipTableModel.class, "objEntity/relationshipTable");
// Create and install a popup
Icon ico = ModelerUtil.buildIcon("icon-edit.png");
resolveMenu = new CayenneAction.CayenneMenuItem("Database Mapping", ico);
JPopupMenu popup = new JPopupMenu();
popup.add(resolveMenu);
popup.add(actionManager.getAction(RemoveAttributeRelationshipAction.class).buildMenu());
popup.addSeparator();
popup.add(actionManager.getAction(CutAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(CopyAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(PasteAction.class).buildMenu());
TablePopupHandler.install(table, popup);
add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
}
use of org.apache.cayenne.modeler.pref.TableColumnPreferences in project cayenne by apache.
the class DbEntityAttributePanel method initView.
private void initView() {
this.setLayout(new BorderLayout());
ActionManager actionManager = Application.getInstance().getActionManager();
// Create table with two columns and no rows.
table = new CayenneTable();
tablePreferences = new TableColumnPreferences(DbAttributeTableModel.class, "attributeTable");
table.setDefaultRenderer(String.class, new BoardTableCellRenderer());
// Create and install a popup
JPopupMenu popup = new JPopupMenu();
popup.add(actionManager.getAction(RemoveAttributeRelationshipAction.class).buildMenu());
popup.addSeparator();
popup.add(actionManager.getAction(CutAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(CopyAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(PasteAction.class).buildMenu());
TablePopupHandler.install(table, popup);
add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
}
use of org.apache.cayenne.modeler.pref.TableColumnPreferences in project cayenne by apache.
the class EmbeddableAttributeTab method init.
private void init() {
this.setLayout(new BorderLayout());
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
ActionManager actionManager = Application.getInstance().getActionManager();
toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
toolBar.addSeparator();
toolBar.add(actionManager.getAction(RemoveAttributeAction.class).buildButton());
toolBar.addSeparator();
toolBar.add(actionManager.getAction(CutAttributeAction.class).buildButton(1));
toolBar.add(actionManager.getAction(CopyAttributeAction.class).buildButton(2));
toolBar.add(actionManager.getAction(PasteAction.class).buildButton(3));
add(toolBar, BorderLayout.NORTH);
table = new CayenneTable();
tablePreferences = new TableColumnPreferences(this.getClass(), "embeddable/attributeTable");
// Create and install a popup
JPopupMenu popup = new JPopupMenu();
popup.add(actionManager.getAction(RemoveAttributeAction.class).buildMenu());
popup.addSeparator();
popup.add(actionManager.getAction(CutAttributeAction.class).buildMenu());
popup.add(actionManager.getAction(CopyAttributeAction.class).buildMenu());
popup.add(actionManager.getAction(PasteAction.class).buildMenu());
TablePopupHandler.install(table, popup);
add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
}
use of org.apache.cayenne.modeler.pref.TableColumnPreferences in project cayenne by apache.
the class DbEntityRelationshipPanel method init.
protected void init() {
this.setLayout(new BorderLayout());
ActionManager actionManager = Application.getInstance().getActionManager();
table = new CayenneTable();
table.setDefaultRenderer(DbEntity.class, CellRenderers.entityTableRendererWithIcons(mediator));
table.setDefaultRenderer(String.class, new BoardTableCellRenderer());
tablePreferences = new TableColumnPreferences(DbRelationshipTableModel.class, "relationshipTable");
// Create and install a popup
Icon ico = ModelerUtil.buildIcon("icon-edit.png");
resolveMenu = new CayenneAction.CayenneMenuItem("Database Mapping", ico);
JPopupMenu popup = new JPopupMenu();
popup.add(resolveMenu);
popup.add(actionManager.getAction(RemoveAttributeRelationshipAction.class).buildMenu());
popup.addSeparator();
popup.add(actionManager.getAction(CutAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(CopyAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(PasteAction.class).buildMenu());
TablePopupHandler.install(table, popup);
add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
}
use of org.apache.cayenne.modeler.pref.TableColumnPreferences in project cayenne by apache.
the class ObjEntityAttributePanel method initView.
private void initView() {
this.setLayout(new BorderLayout());
ActionManager actionManager = Application.getInstance().getActionManager();
table = new CayenneTable();
table.setDefaultRenderer(String.class, new CellRenderer());
tablePreferences = new TableColumnPreferences(ObjAttributeTableModel.class, "objEntity/attributeTable");
// go to SuperEntity from ObjEntity by inheritance icon
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
int row = table.rowAtPoint(e.getPoint());
int col = table.columnAtPoint(e.getPoint());
if (row >= 0 && col == ObjAttributeTableModel.INHERITED) {
if (Boolean.TRUE.equals(table.getValueAt(row, col))) {
ActionManager actionManager = Application.getInstance().getActionManager();
actionManager.getAction(ObjEntityToSuperEntityAction.class).performAction(null);
}
}
}
});
// Create and install a popup
Icon ico = ModelerUtil.buildIcon("icon-edit.png");
resolveMenu = new CayenneAction.CayenneMenuItem("Database Mapping", ico);
JPopupMenu popup = new JPopupMenu();
popup.add(resolveMenu);
popup.add(actionManager.getAction(RemoveAttributeRelationshipAction.class).buildMenu());
popup.addSeparator();
popup.add(actionManager.getAction(CutAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(CopyAttributeRelationshipAction.class).buildMenu());
popup.add(actionManager.getAction(PasteAction.class).buildMenu());
TablePopupHandler.install(table, popup);
add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
}
Aggregations