Search in sources :

Example 1 with NewViewAction

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

the class ApplicationFrame method buildMenu.

/**
 * Builds the menu
 */
private void buildMenu() {
    final JMenuBar mainMenu;
    final JMenu menuFile;
    final JMenu menuEdit;
    @SuppressWarnings("unused") JMenu menuAction;
    final JMenu menuHelp;
    mainMenu = new JMenuBar();
    // Make the File Menu
    menuFile = new JMenu("File");
    addMenuItem(menuFile, new FileNewOverviewAction(this), KeyEvent.VK_N);
    addMenuItem(menuFile, new FileOpenAction(this), KeyEvent.VK_O);
    menuFile.addSeparator();
    addMenuItem(menuFile, new FileSaveAction(this), KeyEvent.VK_S);
    addMenuItem(menuFile, new FileSaveAsAction(this), KeyEvent.VK_S, InputEvent.SHIFT_DOWN_MASK);
    menuFile.addSeparator();
    _recentFilesMenu = new JMenu("Open recent...");
    menuFile.add(_recentFilesMenu);
    updateRecentFilesMenu();
    menuFile.addSeparator();
    addMenuItem(menuFile, new OverviewDocumentInfoAction(this), KeyEvent.VK_I);
    menuFile.addSeparator();
    addMenuItem(menuFile, new FileQuitAction(this), KeyEvent.VK_Q);
    mainMenu.add(menuFile);
    menuFile.setMnemonic(KeyEvent.VK_F);
    menuEdit = new JMenu("Edit");
    menuEdit.add(new JMenuItem(new NewSketchAction(null, _overview)));
    menuEdit.add(new JMenuItem(new ImportSketchAction(null, _overview)));
    menuEdit.addSeparator();
    menuEdit.add(_NewViewMenuItem = new JMenuItem(new NewViewAction(_overview)));
    mainMenu.add(menuEdit);
    menuEdit.addMenuListener(new MenuListener() {

        @Override
        public void menuSelected(final MenuEvent e1) {
            final Object[] selection = _overview.getSelectionCells();
            _NewViewMenuItem.setEnabled((selection.length == 1) && (selection[0] instanceof SketchNode));
        }

        @Override
        public void menuDeselected(final MenuEvent e1) {
        }

        @Override
        public void menuCanceled(final MenuEvent e1) {
        }
    });
    menuEdit.addSeparator();
    // If
    addMenuItem(menuEdit, _ProgramSettingsItem = new JMenuItem("Preferences"), KeyEvent.VK_E);
    // you
    // change
    // this
    // title,
    // update
    // OSX.java
    _ProgramSettingsItem.setToolTipText("Set Global Easik Properties");
    _ProgramSettingsItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e1) {
            final ProgramSettingsUI myUI = new ProgramSettingsUI(ApplicationFrame.this);
            myUI.showDialog();
        }
    });
    menuEdit.setMnemonic(KeyEvent.VK_E);
    // Create help menu
    menuHelp = new JMenu("Help");
    mainMenu.add(menuHelp);
    menuHelp.setMnemonic(KeyEvent.VK_H);
    menuHelp.add(new HelpAction());
    menuHelp.add(new AboutAction());
    setJMenuBar(mainMenu);
}
Also used : FileNewOverviewAction(easik.ui.menu.FileNewOverviewAction) HelpAction(easik.ui.menu.HelpAction) OverviewDocumentInfoAction(easik.ui.menu.OverviewDocumentInfoAction) NewViewAction(easik.ui.menu.popup.NewViewAction) MenuListener(javax.swing.event.MenuListener) ActionEvent(java.awt.event.ActionEvent) AboutAction(easik.ui.menu.AboutAction) FileSaveAsAction(easik.ui.menu.FileSaveAsAction) SketchNode(easik.overview.vertex.SketchNode) FileSaveAction(easik.ui.menu.FileSaveAction) FileQuitAction(easik.ui.menu.FileQuitAction) ActionListener(java.awt.event.ActionListener) ImportSketchAction(easik.ui.menu.popup.ImportSketchAction) JMenuItem(javax.swing.JMenuItem) NewSketchAction(easik.ui.menu.popup.NewSketchAction) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu) FileOpenAction(easik.ui.menu.FileOpenAction) MenuEvent(javax.swing.event.MenuEvent)

Example 2 with NewViewAction

use of easik.ui.menu.popup.NewViewAction 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

ImportSketchAction (easik.ui.menu.popup.ImportSketchAction)2 NewSketchAction (easik.ui.menu.popup.NewSketchAction)2 NewViewAction (easik.ui.menu.popup.NewViewAction)2 JMenuItem (javax.swing.JMenuItem)2 SketchNode (easik.overview.vertex.SketchNode)1 AboutAction (easik.ui.menu.AboutAction)1 ExportDatabaseAction (easik.ui.menu.ExportDatabaseAction)1 FileNewOverviewAction (easik.ui.menu.FileNewOverviewAction)1 FileOpenAction (easik.ui.menu.FileOpenAction)1 FileQuitAction (easik.ui.menu.FileQuitAction)1 FileSaveAction (easik.ui.menu.FileSaveAction)1 FileSaveAsAction (easik.ui.menu.FileSaveAsAction)1 HelpAction (easik.ui.menu.HelpAction)1 OverviewDocumentInfoAction (easik.ui.menu.OverviewDocumentInfoAction)1 SketchExportAction (easik.ui.menu.SketchExportAction)1 DeleteFromOverviewAction (easik.ui.menu.popup.DeleteFromOverviewAction)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