Search in sources :

Example 1 with BoardTableCellRenderer

use of org.apache.cayenne.modeler.util.BoardTableCellRenderer 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);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) BoardTableCellRenderer(org.apache.cayenne.modeler.util.BoardTableCellRenderer) CayenneTable(org.apache.cayenne.modeler.util.CayenneTable) BorderLayout(java.awt.BorderLayout) TableColumnPreferences(org.apache.cayenne.modeler.pref.TableColumnPreferences) JPopupMenu(javax.swing.JPopupMenu)

Example 2 with BoardTableCellRenderer

use of org.apache.cayenne.modeler.util.BoardTableCellRenderer 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);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) BoardTableCellRenderer(org.apache.cayenne.modeler.util.BoardTableCellRenderer) CayenneTable(org.apache.cayenne.modeler.util.CayenneTable) BorderLayout(java.awt.BorderLayout) TableColumnPreferences(org.apache.cayenne.modeler.pref.TableColumnPreferences) Icon(javax.swing.Icon) CayenneAction(org.apache.cayenne.modeler.util.CayenneAction) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

BorderLayout (java.awt.BorderLayout)2 JPopupMenu (javax.swing.JPopupMenu)2 ActionManager (org.apache.cayenne.modeler.action.ActionManager)2 TableColumnPreferences (org.apache.cayenne.modeler.pref.TableColumnPreferences)2 BoardTableCellRenderer (org.apache.cayenne.modeler.util.BoardTableCellRenderer)2 CayenneTable (org.apache.cayenne.modeler.util.CayenneTable)2 Icon (javax.swing.Icon)1 CayenneAction (org.apache.cayenne.modeler.util.CayenneAction)1