use of easik.ui.menu.popup.NewSketchAction in project fql by CategoricalData.
the class OverviewInfoTreeUI method buildPopupMenu.
/**
* Creates the popup menu
*/
private void buildPopupMenu() {
_popupMenu.add(_addSketchItem = new JMenuItem(new NewSketchAction(_newPosition, _theFrame.getOverview())));
_popupMenu.add(_addViewItem = new JMenuItem(new NewViewFromTreeAction(_theFrame.getOverview())));
_popupMenu.add(_renameSketchItem = new JMenuItem(new RenameInOverviewFromTreeAction(_theFrame, "Rename Sketch")));
_popupMenu.add(_deleteSketchItem = new JMenuItem(new DeleteFromOverviewFromTreeAction(_theFrame, "Delete Sketch")));
_popupMenu.add(_renameViewItem = new JMenuItem(new RenameInOverviewFromTreeAction(_theFrame, "Rename View")));
_popupMenu.add(_deleteViewItem = new JMenuItem(new DeleteFromOverviewFromTreeAction(_theFrame, "Delete View")));
_infoTree.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent evt) {
if (evt.isPopupTrigger()) {
_infoTree.setSelectionRow(_infoTree.getClosestRowForLocation(evt.getX(), evt.getY()));
_newPosition.setLocation(_theFrame.getOverview().getNewSketchPosition(10));
if (setPopMenuItems()) {
_popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
}
}
}
@Override
public void mouseReleased(MouseEvent evt) {
mousePressed(evt);
}
});
}
use of easik.ui.menu.popup.NewSketchAction 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);
}
use of easik.ui.menu.popup.NewSketchAction 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());
}
}
}
});
}
Aggregations