@Override public void actionPerformed(ActionEvent e) { // wrap in check box menu item JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(); // this is a hack for solving OVTK-253, makes method not generic checkBox.setSelected(!ViewMenuAction.isContentsDisplayShown()); desktop.actionPerformed(new ActionEvent(checkBox, ActionEvent.ACTION_PERFORMED, e.getActionCommand())); } });
public void perform(OVTK2Desktop desktop) { if (!invisible.isSelected()) { desktop.actionPerformed(new ActionEvent(this, 0, "sync")); // wait here for sync to finish synchronized (this) { while (!desktop.getRunningProcess().equals("none")) { try { this.wait(100); } catch (InterruptedException ie) { ErrorDialog.show(ie); } } } } if (appearance.isSelected()) { // this should not be in a thread desktop.actionPerformed(new ActionEvent(this, 0, "saveappearance")); } } }
@Override public void run() { if (Config.config.getProperty("Autosave.Set") == null || Boolean.valueOf(Config.config.getProperty("Autosave.Set")) == false) return; if (Config.config.getProperty("Autosave.Interval") != null) { int newvalue = Integer.parseInt(Config.config.getProperty("Autosave.Interval")); if (newvalue != minutes) { timer.cancel(); timer = new Timer(); timer.schedule(new AutoSaveTask(viewer), minutes * 1000 * 60); } } // prevent auto-save name from exploding String name = graph.getName(); if (name.startsWith("autosave")) { name = name.substring(9, name.length()); name = name.substring(0, name.lastIndexOf("_")); } // save appearance in autosave function OVTK2Desktop.getInstance().actionPerformed(new ActionEvent(this, 0, "saveappearance")); // construct auto-save filename File file = new File(Config.ovtkDir + File.separator + "autosave_" + name + "_" + System.currentTimeMillis() + ".oxl"); DesktopUtils.saveFile(file, viewer); } }
public void actionPerformed(ActionEvent arg0) { String cmd = arg0.getActionCommand(); // short cut to metadata legend if (cmd.equals("legend")) { // fire action to show legend JCheckBoxMenuItem item = new JCheckBoxMenuItem(); item.setSelected(true); OVTK2Desktop.getInstance().actionPerformed(new ActionEvent(item, ActionEvent.ACTION_PERFORMED, "legend")); } // show main graph else if (cmd.equals("mainGraph")) { try { viewer.setIcon(false); // OVTK-320 viewer.toFront(); } catch (PropertyVetoException e) { System.err.println("De-Iconification was vetoed by property"); } } }
public void run() { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e.getDescription().startsWith("ovtk2://")) { // create event for OVTK2Desktop ActionEvent ae = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, e.getDescription().substring(8)); desktop.actionPerformed(ae); } else if (e.getDescription().equals("close")) { // do nothing } else { Desktop desktop = null; // Before more Desktop API is used, first check // whether the API is supported by this particular // virtual machine (VM) on this particular host. if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); // open href in browser try { desktop.browse(new URI(e.getDescription())); } catch (IOException ioe) { ioe.printStackTrace(); } catch (URISyntaxException use) { use.printStackTrace(); } } else { JOptionPane.showInputDialog(desktop, "Hyperlinks not supported by OS."); } } } } });
item.setSelected(false); OVTK2Desktop desktop = OVTK2Desktop.getInstance(); desktop.actionPerformed(new ActionEvent(item, ActionEvent.ACTION_PERFORMED, AppearanceMenuAction.NODECOLOR)); desktop.actionPerformed(new ActionEvent(item, ActionEvent.ACTION_PERFORMED, AppearanceMenuAction.EDGECOLOR)); desktop.actionPerformed(new ActionEvent(item, ActionEvent.ACTION_PERFORMED, AppearanceMenuAction.NODESHAPE)); desktop.actionPerformed(new ActionEvent(item, ActionEvent.ACTION_PERFORMED, AppearanceMenuAction.EDGESIZE));
desktop.actionPerformed(new ActionEvent(item, ActionEvent.ACTION_PERFORMED, "metagraph"));
private void propagateSelection(ListSelectionModel lsm) { ONDEXJUNGGraph graph = viewer.getONDEXJUNGGraph(); OVTK2GraphMouse mouse = (OVTK2GraphMouse) viewer.getVisualizationViewer().getGraphMouse(); OVTK2PickingMousePlugin picking = mouse.getOVTK2PickingMousePlugin(); PickedState<ONDEXConcept> state = viewer.getVisualizationViewer().getPickedVertexState(); state.clear(); if (!lsm.isSelectionEmpty()) { // Find out which indexes are selected. int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { int index = table.convertRowIndexToModel(i); Integer selection = ((IdLabel) model.getValueAt(index, 0)).getId(); ONDEXConcept node = graph.getConcept(selection); state.pick(node, true); // propagate selection in search results to content info if (picking != null) { for (ActionListener l : picking.getPickingListeners()) { if (l != null) l.actionPerformed(new ActionEvent(node, 0, "putative node pick")); } } } } if (state.getPicked().size() > 1) // fire for zooming into search results OVTK2Desktop.getInstance().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "zoomin")); } }
private void propagateSelection(ListSelectionModel lsm) { ONDEXJUNGGraph graph = viewer.getONDEXJUNGGraph(); OVTK2GraphMouse mouse = (OVTK2GraphMouse) viewer.getVisualizationViewer().getGraphMouse(); OVTK2PickingMousePlugin picking = mouse.getOVTK2PickingMousePlugin(); PickedState<ONDEXConcept> state = viewer.getVisualizationViewer().getPickedVertexState(); state.clear(); if (!lsm.isSelectionEmpty()) { // Find out which indexes are selected. int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { int index = table.convertRowIndexToModel(i); Integer selection = ((IdLabel) model.getValueAt(index, 0)).getId(); ONDEXConcept node = graph.getConcept(selection); state.pick(node, true); // propagate selection in search results to content info if (picking != null) { for (ActionListener l : picking.getPickingListeners()) { if (l != null) l.actionPerformed(new ActionEvent(node, 0, "putative node pick")); } } } } if (state.getPicked().size() > 1) // fire for zooming into search results OVTK2Desktop.getInstance().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "zoomin")); } }
private void propagateSelection(ListSelectionModel lsm) { ONDEXJUNGGraph graph = viewer.getONDEXJUNGGraph(); OVTK2GraphMouse mouse = (OVTK2GraphMouse) viewer.getVisualizationViewer().getGraphMouse(); OVTK2PickingMousePlugin picking = mouse.getOVTK2PickingMousePlugin(); PickedState<ONDEXConcept> state = viewer.getVisualizationViewer().getPickedVertexState(); state.clear(); if (!lsm.isSelectionEmpty()) { // Find out which indexes are selected. int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { int index = table.convertRowIndexToModel(i); Integer selection = ((IdLabel) model.getValueAt(index, 0)).getId(); ONDEXConcept node = graph.getConcept(selection); state.pick(node, true); // propagate selection in search results to content info if (picking != null) { for (ActionListener l : picking.getPickingListeners()) { if (l != null) l.actionPerformed(new ActionEvent(node, 0, "putative node pick")); } } } } if (state.getPicked().size() > 1) // fire for zooming into search results OVTK2Desktop.getInstance().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "zoomin")); } }
desktop.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, OVTK2ToolBar.ZOOMIN));