use of easik.overview.vertex.SketchNode in project fql by CategoricalData.
the class Overview method initializeOverview.
/**
* When we initialise the overview, we flush out all the data concerning the
* sketch itself.
*
* This methods serves as a "new overview" function.
*/
public void initializeOverview() {
clearSelection();
if (_sketchNodes != null) {
for (SketchNode node : _sketchNodes.values()) {
node.getFrame().dispose();
}
}
if (_viewNodes != null) {
for (ViewNode node : _viewNodes.values()) {
node.getFrame().dispose();
}
}
setFile(null);
_sketchNodes = new HashMap<>();
_viewNodes = new HashMap<>();
_viewEdges = new HashMap<>();
_docInfo = new DocumentInfo(_appFrame);
if (_appFrame.getInfoTreeUI() != null) {
_appFrame.setInfoTreeUI(new OverviewInfoTreeUI(_appFrame));
_appFrame.getInfoTreeUI().refreshTree();
}
OverviewGraphModel model = new OverviewGraphModel(this);
GraphLayoutCache glc = new GraphLayoutCache(model, new DefaultCellViewFactory());
setModel(model);
setGraphLayoutCache(glc);
}
use of easik.overview.vertex.SketchNode in project fql by CategoricalData.
the class Overview method refreshAll.
/**
* Refreshes the overview GUI as well as the GUIs of all Sketches and Views.
*/
public void refreshAll() {
for (SketchNode node : _sketchNodes.values()) {
Sketch s = node.getFrame().getMModel();
s.refresh();
s.updateThumb();
}
for (ViewNode node : _viewNodes.values()) {
View v = node.getMModel();
v.refresh();
v.updateThumb();
}
refresh();
}
use of easik.overview.vertex.SketchNode in project fql by CategoricalData.
the class ApplicationFrame method setSketchPopItems.
/**
*/
public void setSketchPopItems() {
// disable all elements
for (final Component c : _sketchPopupMenu.getComponents()) {
c.setEnabled(false);
}
_OpenSketchManipulatePopDefItem.setVisible(false);
_OpenSketchManipulatePopItem.setVisible(true);
_OpenSketchPopDefItem.setVisible(false);
_OpenSketchPopItem.setVisible(true);
// We always want to be able to delete
_DeleteSketchPopItem.setEnabled(true);
final Object[] currentSelection = _overview.getSelectionCells();
if (currentSelection.length == 1) {
_RenamePopItem.setEnabled(true);
if (((SketchNode) currentSelection[0]).getFrame().getMode() == SketchFrame.Mode.EDIT) {
_NewViewPopItem.setEnabled(true);
}
_ExportSketchPopItem.setEnabled(true);
// Enable sketch export to db
_ExportSketchDatabasePopItem.setEnabled(true);
_ExportSketchDatabasePopItem.setEnabled(true);
// Enable sketch export to image
// _ExportSketchImage.setEnabled(true);
// The the export item to work with current selection
_sketchPopupMenu.remove(_ExportSketchDatabasePopItem);
// _sketchPopupMenu.remove(_ExportSketchImage);
// _ExportSketchImage = new JMenuItem(new
// ExportImageAction<SketchFrame, SketchGraphModel, Sketch,
// EntityNode, SketchEdge>(((SketchNode)
// currentSelection[0]).getFrame()));
_ExportSketchDatabasePopItem = new JMenuItem(new ExportDatabaseAction(this, ((SketchNode) currentSelection[0]).getFrame().getMModel()));
_sketchPopupMenu.add(_ExportSketchDatabasePopItem);
if (((SketchNode) currentSelection[0]).getFrame().getMModel().isSynced()) {
_OpenSketchManipulatePopDefItem.setEnabled(true);
_OpenSketchManipulatePopDefItem.setVisible(true);
_OpenSketchManipulatePopDefItem.setArmed(true);
_OpenSketchManipulatePopItem.setVisible(false);
_OpenSketchPopItem.setEnabled(true);
} else {
_OpenSketchPopDefItem.setEnabled(true);
_OpenSketchPopDefItem.setVisible(true);
_OpenSketchPopDefItem.setArmed(true);
_OpenSketchPopItem.setVisible(false);
_OpenSketchManipulatePopItem.setEnabled(true);
}
}
}
use of easik.overview.vertex.SketchNode 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.overview.vertex.SketchNode in project fql by CategoricalData.
the class RenameInOverviewFromTreeAction method actionPerformed.
/**
* Called when clicked upon, will rename an article.
*
* @param e
* The action event
*/
@Override
public void actionPerformed(ActionEvent e) {
// If there is nothing seleceted then just do nothing
if (_theFrame.getInfoTreeUI().getInfoTree().isSelectionEmpty()) {
System.err.println("'OK'");
return;
}
// Get currently selected object
DefaultMutableTreeNode curSelected = (DefaultMutableTreeNode) _theFrame.getInfoTreeUI().getInfoTree().getSelectionPath().getLastPathComponent();
OverviewVertex nodeToRename;
String originalName = "";
// Check what is currently selected
if (curSelected.getUserObject() instanceof SketchNode) {
nodeToRename = (SketchNode) curSelected.getUserObject();
} else if (curSelected.getUserObject() instanceof ViewNode) {
nodeToRename = (ViewNode) curSelected.getUserObject();
} else {
return;
}
originalName = nodeToRename.getName();
String s = (String) JOptionPane.showInputDialog(_theFrame, "New name:", "Rename", JOptionPane.QUESTION_MESSAGE, null, null, originalName);
if (s != null) {
s = s.trim();
if (s.equals("")) {
JOptionPane.showMessageDialog(_theFrame, "Entity name is empty", "Error", JOptionPane.ERROR_MESSAGE);
} else if (_theFrame.getOverview().isNameUsed(s)) {
JOptionPane.showMessageDialog(_theFrame, "Entity name is already in use", "Error", JOptionPane.ERROR_MESSAGE);
} else {
nodeToRename.setName(s);
_theFrame.getInfoTreeUI().refreshTree();
_theFrame.getOverview().getGraphLayoutCache().reload();
_theFrame.getOverview().repaint();
if (nodeToRename instanceof SketchNode) {
((SketchNode) nodeToRename).getFrame().getMModel().setDirty();
} else if (nodeToRename instanceof ViewNode) {
((ViewNode) nodeToRename).getFrame().getMModel().setDirty();
}
}
}
_theFrame.getOverview().clearSelection();
}
Aggregations