Search in sources :

Example 66 with JPopupMenu

use of javax.swing.JPopupMenu 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);
}
Also used : ActionManager(org.apache.cayenne.modeler.action.ActionManager) 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)

Example 67 with JPopupMenu

use of javax.swing.JPopupMenu 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 68 with JPopupMenu

use of javax.swing.JPopupMenu in project cayenne by apache.

the class AbstractCallbackMethodsTab method createPopup.

private JPopupMenu createPopup() {
    JPopupMenu popup = new JPopupMenu();
    popup.add(getRemoveCallbackMethodAction().buildMenu());
    popup.addSeparator();
    popup.add(getCopyCallbackMethodAction().buildMenu());
    popup.add(getCutCallbackMethodAction().buildMenu());
    popup.add(getPasteCallbackMethodAction().buildMenu());
    return popup;
}
Also used : JPopupMenu(javax.swing.JPopupMenu)

Example 69 with JPopupMenu

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

Example 70 with JPopupMenu

use of javax.swing.JPopupMenu 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

JPopupMenu (javax.swing.JPopupMenu)203 JMenuItem (javax.swing.JMenuItem)105 ActionEvent (java.awt.event.ActionEvent)61 ActionListener (java.awt.event.ActionListener)46 JMenu (javax.swing.JMenu)28 Point (java.awt.Point)24 Component (java.awt.Component)20 JLabel (javax.swing.JLabel)20 JSeparator (javax.swing.JSeparator)19 JScrollPane (javax.swing.JScrollPane)18 MouseEvent (java.awt.event.MouseEvent)17 JButton (javax.swing.JButton)16 AbstractAction (javax.swing.AbstractAction)15 BorderLayout (java.awt.BorderLayout)13 JPanel (javax.swing.JPanel)13 JTable (javax.swing.JTable)13 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)12 MouseAdapter (java.awt.event.MouseAdapter)11 ArrayList (java.util.ArrayList)11 Icon (javax.swing.Icon)11