Search in sources :

Example 1 with OpenSketchAction

use of easik.ui.menu.popup.OpenSketchAction in project fql by CategoricalData.

the class ApplicationFrame method buildPopupMenu.

/**
 * Creates the popup menu
 */
private void buildPopupMenu() {
    _canvasPopupMenu.add(_AddSketchPopItem = new JMenuItem(new NewSketchAction(_popupPosition, _overview)));
    _canvasPopupMenu.add(_ImportSketchPopItem = new JMenuItem(new ImportSketchAction(_popupPosition, _overview)));
    _sketchPopupMenu.add(_OpenSketchPopDefItem = new JMenuItem(new OpenSketchAction(_overview, true)));
    _sketchPopupMenu.add(_OpenSketchManipulatePopDefItem = new JMenuItem(new OpenSketchDataAction(_overview, true)));
    _sketchPopupMenu.add(_OpenSketchPopItem = new JMenuItem(new OpenSketchAction(_overview)));
    _sketchPopupMenu.add(_OpenSketchManipulatePopItem = new JMenuItem(new OpenSketchDataAction(_overview)));
    _sketchPopupMenu.addSeparator();
    _sketchPopupMenu.add(_NewViewPopItem = new JMenuItem(new NewViewAction(_overview)));
    _sketchPopupMenu.addSeparator();
    _sketchPopupMenu.add(_RenamePopItem = new JMenuItem(new RenameInOverviewAction(_overview)));
    _sketchPopupMenu.add(_DeleteSketchPopItem = new JMenuItem(new DeleteFromOverviewAction(_overview)));
    _sketchPopupMenu.addSeparator();
    _sketchPopupMenu.add(_ExportSketchPopItem = new JMenuItem(new SketchExportAction(this)));
    _sketchPopupMenu.add(_ExportSketchDatabasePopItem = new JMenuItem(new ExportDatabaseAction(this, null)));
    // _sketchPopupMenu.add(_ExportSketchImage = new JMenuItem(new
    // ExportImageAction<SketchFrame, SketchGraphModel, Sketch, EntityNode,
    // SketchEdge>(null)));
    _viewPopupMenu.add(_OpenViewPopItem = new JMenuItem(new OpenViewAction(_overview)));
    _viewPopupMenu.add(_RenameViewPopItem = new JMenuItem(new RenameInOverviewAction(_overview)));
    _viewPopupMenu.add(_DeleteViewPopItem = new JMenuItem(new DeleteFromOverviewAction(_overview)));
    _viewPopupMenu.addSeparator();
    // _viewPopupMenu.add(_ExportViewImage = new JMenuItem(new
    // ExportImageAction<ViewFrame, ViewGraphModel, View, QueryNode,
    // View_Edge>(null)));
    _mixedPopupMenu.add(_DeleteMixedPopItem = new JMenuItem(new DeleteFromOverviewAction(_overview)));
    _overview.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(final MouseEvent evt) {
            mouseReleased(evt);
        }

        @Override
        public void mouseReleased(final MouseEvent evt) {
            if (evt.isPopupTrigger()) {
                final Object rightClickedOn = _overview.getFirstCellForLocation(evt.getX(), evt.getY());
                // the current selection
                if (rightClickedOn != null) {
                    final Object[] selection = _overview.getSelectionCells();
                    if (!Arrays.asList(selection).contains(rightClickedOn)) {
                        _overview.setSelectionCell(_overview.getFirstCellForLocation(evt.getX(), evt.getY()));
                    }
                } else {
                    _overview.setSelectionCells(new Object[0]);
                }
                _popupPosition.setLocation(evt.getX(), evt.getY());
                final JPopupMenu menu = setPopMenu();
                if (menu != null) {
                    menu.show(evt.getComponent(), evt.getX(), evt.getY());
                }
            }
        }
    });
}
Also used : SketchExportAction(easik.ui.menu.SketchExportAction) MouseEvent(java.awt.event.MouseEvent) NewViewAction(easik.ui.menu.popup.NewViewAction) DeleteFromOverviewAction(easik.ui.menu.popup.DeleteFromOverviewAction) OpenSketchAction(easik.ui.menu.popup.OpenSketchAction) OpenViewAction(easik.ui.menu.popup.OpenViewAction) MouseAdapter(java.awt.event.MouseAdapter) ExportDatabaseAction(easik.ui.menu.ExportDatabaseAction) JPopupMenu(javax.swing.JPopupMenu) ImportSketchAction(easik.ui.menu.popup.ImportSketchAction) OpenSketchDataAction(easik.ui.menu.popup.OpenSketchDataAction) RenameInOverviewAction(easik.ui.menu.popup.RenameInOverviewAction) JMenuItem(javax.swing.JMenuItem) NewSketchAction(easik.ui.menu.popup.NewSketchAction)

Aggregations

ExportDatabaseAction (easik.ui.menu.ExportDatabaseAction)1 SketchExportAction (easik.ui.menu.SketchExportAction)1 DeleteFromOverviewAction (easik.ui.menu.popup.DeleteFromOverviewAction)1 ImportSketchAction (easik.ui.menu.popup.ImportSketchAction)1 NewSketchAction (easik.ui.menu.popup.NewSketchAction)1 NewViewAction (easik.ui.menu.popup.NewViewAction)1 OpenSketchAction (easik.ui.menu.popup.OpenSketchAction)1 OpenSketchDataAction (easik.ui.menu.popup.OpenSketchDataAction)1 OpenViewAction (easik.ui.menu.popup.OpenViewAction)1 RenameInOverviewAction (easik.ui.menu.popup.RenameInOverviewAction)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 JMenuItem (javax.swing.JMenuItem)1 JPopupMenu (javax.swing.JPopupMenu)1