public void createTimer(MouseEvent e) { // stop old timer if present.*/ stopTimerForDelayedSelection(); /* Region to check for in the sequel. */ controlRegionForDelayedSelection = getControlRegion(e.getPoint()); timerForDelayedSelection = new Timer(); timerForDelayedSelection.schedule( new timeDelayedSelection(c, e), /* * if the new selection method is not enabled we put 0 to get direct * selection. */ (delayedSelectionEnabled.getValue()) ? timeForDelayedSelection.getValue() : 0); }
public void mouseMoved(MouseEvent e) { logger.finest("Event: mouseMoved"); // Invoked when the mouse button has been moved on a component (with no // buttons down). MainView node = ((MainView) e.getComponent()); boolean isLink = (node).updateCursor(e.getX()); // links are displayed in the status bar: if (isLink) { c.getFrame().out(c.getLinkShortText(node.getNodeView().getModel())); } // test if still in selection region: if (controlRegionForDelayedSelection != null && delayedSelectionEnabled.getValue()) { if (!controlRegionForDelayedSelection.contains(e.getPoint())) { // point is not in the region. start timer again and adjust // region to the current point: createTimer(e); } } }
/** * And a static method to reread this holder. This is used when the selection method is changed * via the option menu. */ public void updateSelectionMethod() { if (timeForDelayedSelection == null) { timeForDelayedSelection = new Tools.IntHolder(); } delayedSelectionEnabled = new Tools.BooleanHolder(); delayedSelectionEnabled.setValue( c.getFrame().getProperty("selection_method").equals("selection_method_direct") ? false : true); /* * set time for delay to infinity, if selection_method equals * selection_method_by_click. */ if (c.getFrame().getProperty("selection_method").equals("selection_method_by_click")) { timeForDelayedSelection.setValue(Integer.MAX_VALUE); } else { timeForDelayedSelection.setValue( Integer.parseInt(c.getFrame().getProperty("time_for_delayed_selection"))); } }