@Override public void addMouseMoveListener ( final ChartMouseMoveListener listener ) { removeMouseMoveListener ( listener ); final MouseMoveListener proxyListener = new MouseMoveListener () { @Override public void mouseMove ( final MouseEvent e ) { listener.onMouseMove ( convertState ( e ) ); } }; final MouseMoveListener oldListener = this.mouseMoveListenerMap.put ( listener, proxyListener ); if ( oldListener != null ) { this.control.removeMouseMoveListener ( oldListener ); } this.control.addMouseMoveListener ( proxyListener ); }
/** * Returns the mouse motion listener * @return */ private MouseMoveListener getMouseMoveListener() { return new MouseMoveListener(){ @Override public void mouseMove(MouseEvent arg0) { // Check Tile<T> tile = getTileAt(arg0.x, arg0.y); T item = tile == null ? null : tile.item; // Break if (item == activeItem)return; // Set activeItem = item; redraw(); String tooltip = activeItem != null ? tooltipDecorator.decorate(activeItem) : null; Tiles.this.setToolTipText(tooltip); } }; }
/** Ctor */ public Model(Rev rev, String modelName, Composite parent) { super(parent, SWT.NONE); this.rev = rev; this.modelName = modelName; addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { lastMouseX = e.x; lastMouseY = e.y; enablePopupMenu(); } }); }
/** * Return the array of DeviceManagers that are available per the * constructor parameters. The InputDevices instantiated will be * initialized with SWT UI toolkit event listeners. * * @return the array of DeviceManagers. If no DeviceManagers are * available, an empty (size 0) array is returned. */ public DeviceManager[] getDeviceManagers( ) { List managerList = createDevices( ); DeviceManager[] manager = (DeviceManager[])managerList.toArray( new DeviceManager[managerList.size( )] ); Control control = (Control)canvas; for ( int i = 0; i < manager.length; i++ ) { InputDevice[] device = manager[i].getDevices( ); for ( int j = 0; j < device.length; j++ ) { InputDevice dev = device[j]; if ( dev instanceof MouseListener ) { control.addMouseListener( (MouseListener)dev ); } if ( dev instanceof MouseMoveListener ) { control.addMouseMoveListener( (MouseMoveListener)dev ); } if ( dev instanceof Listener ) { control.addListener( SWT.MouseWheel, (Listener)dev ); } if ( dev instanceof KeyListener ) { control.addKeyListener( (KeyListener)dev ); } } } return( manager ); }
@Override public void removeMouseMoveListener ( final ChartMouseMoveListener listener ) { final MouseMoveListener proxyListener = this.mouseMoveListenerMap.remove ( listener ); if ( proxyListener != null ) { if ( !this.control.isDisposed () ) { this.control.removeMouseMoveListener ( proxyListener ); } } }
private MouseMoveListener getMouseListner(final Text extSchemaPathText){ final MouseMoveListener listner = new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { String paramValue = Utils.INSTANCE.getParamValue(extSchemaPathText.getText()); finalParamPath = Utils.INSTANCE.getParamFilePath(extSchemaPathText.getText(), paramValue, extSchemaPathText); while(ParameterUtil.containsParameter(finalParamPath, '/')){ paramValue = Utils.INSTANCE.getParamValue(extSchemaPathText.getToolTipText()); finalParamPath = Utils.INSTANCE.getParamFilePath(extSchemaPathText.getToolTipText(), paramValue, extSchemaPathText); } } }; return listner; }
private MouseMoveListener getMouseListner(final StyledText extSchemaPathText) { final MouseMoveListener listner = new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { String paramValue = Utils.INSTANCE.getParamValueForRunSql(extSchemaPathText.getText()); finalParamPath = Utils.INSTANCE.getParamFilePath(paramValue, extSchemaPathText); } }; return listner; }
/** * Creates a generic tooltip for the table * @param table */ public static void createGenericTooltip(final Table table) { table.addMouseMoveListener(new MouseMoveListener() { private TableItem current = null; public void mouseMove(MouseEvent arg0) { TableItem item = table.getItem(new Point(arg0.x, arg0.y)); if (item != null && item != current) { current = item; StringBuilder builder = new StringBuilder(); builder.append("("); //$NON-NLS-1$ int columns = item.getParent().getColumnCount(); for (int i = 0; i < columns; i++) { String value = item.getText(i); if (value != null && !value.equals("")) { //$NON-NLS-1$ builder.append(value); if (i < columns - 1) { builder.append(", "); //$NON-NLS-1$ } } else if (item.getData(String.valueOf(i)) != null && item.getData(String.valueOf(i)) instanceof Double) { builder.append(getPrettyString(((Double) item.getData(String.valueOf(i))).doubleValue() * 100d) + "%"); //$NON-NLS-1$ if (i < columns - 1) { builder.append(", "); //$NON-NLS-1$ } } } builder.append(")"); //$NON-NLS-1$ table.setToolTipText(builder.toString()); } } }); }
public void init(){ b.setVisible(false); //windowLocation.reMoveWindow(this); addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { // TODO Auto-generated method stub if(slider != null && !slider.isDisposed()){ if(e.x >= getClientArea().width-slider.getSize().x-30){ slider.setVisible(true); }else slider.setVisible(false); } } }); setImage(b.getImage()); setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); setStyledTextWidth(Integer.valueOf(b.appProperties.getProperty("WritingView_TextX", String.valueOf(windowLocation.returnScreenWidth()- windowLocation.returnScreenWidth()/4)))); createContents(); //setMaximized(true); if(b.tv != null){ b.tv.getTextWidget().setParent(this); //b.tv.getTextWidget().setMargins(130, 10, 110, 0); b.blackTextArea.writingView(); setStyledTextLayout(x); } addSlider(); }
public static void addTooltipText(final NButton btn, final String text, final TextTask t) { btn.addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { btn.setToolTipText(text + " (" + textTaskKeyMap.get(t) +")"); //$NON-NLS-1$ //$NON-NLS-2$ } }); }
public static void addTooltipText(final NButton btn, final String text, final Task t) { btn.addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { btn.setToolTipText(text + " (" + taskKeyMap.get(t) +")"); //$NON-NLS-1$ //$NON-NLS-2$ } }); }
protected GroupScaleTimelineMarkerTooltip(Display display, int style, ScaleTimelineMarkerEditPart scaleTimelineMarkerEditPart) { super(display, style, scaleTimelineMarkerEditPart, null); // passing in null as the violationTracker // add a mouse move listener, to clear out a child violation when applicable mouseMoveListener = new MouseMoveListener() { @Override public void mouseMove(MouseEvent e) { if (solitaryScaleTimelineMarkerTooltip != null && !solitaryScaleTimelineMarkerTooltip.shell.isDisposed()) { Composite localComposite = GroupScaleTimelineMarkerTooltip.this.getMainComposite(); Point displayPoint = localComposite.toDisplay(e.x, e.y); displayPoint = solitaryScaleTimelineMarkerTooltip.shell.toControl(displayPoint); if (!solitaryScaleTimelineMarkerTooltip.shell.getBounds().contains(displayPoint)) { // navigated off a child, onto the parent solitaryScaleTimelineMarkerTooltip.shell.dispose(); } } } }; this.mainComposite.addMouseMoveListener(mouseMoveListener); Control[] controls = violationsComposite.getChildren(); for(Control control : controls) { control.addMouseMoveListener(mouseMoveListener); } }
protected void dispatchMouseMoved(MouseEvent me) { List<MouseMoveListener> copy = new ArrayList<MouseMoveListener>( mouseMoveListeners); for (MouseMoveListener ml : copy) { ml.mouseMove(me); } }
/** * Handle mouse moves * * @return */ private MouseMoveListener createMouseMoveHandler() { return new MouseMoveListener() { @Override public void mouseMove(MouseEvent me) { if (drag) { dragOffset += me.y - dragY; double newValue = dragValue - dragOffset / sensitivity; if (newValue < 0d) { dragOffset = (int) (dragValue * sensitivity); newValue = 0d; } else if (newValue > 1d) { dragOffset = (int) (dragValue * sensitivity - sensitivity); newValue = 1d; } if (value != newValue) { value = newValue; fireSelectionEvent(); redraw(); } getDisplay().setCursorLocation(screenX, screenY); } } }; }
/** * Creates a generic tooltip for the table * @param table */ public static void createGenericTooltip(final Table table) { table.addMouseMoveListener(new MouseMoveListener() { private TableItem current = null; @Override public void mouseMove(MouseEvent arg0) { TableItem item = table.getItem(new Point(arg0.x, arg0.y)); if (item != null && item != current) { current = item; StringBuilder builder = new StringBuilder(); builder.append("("); //$NON-NLS-1$ int columns = item.getParent().getColumnCount(); for (int i = 0; i < columns; i++) { String value = item.getText(i); if (value != null && !value.equals("")) { //$NON-NLS-1$ builder.append(value); if (i < columns - 1) { builder.append(", "); //$NON-NLS-1$ } } else if (item.getData(String.valueOf(i)) != null && item.getData(String.valueOf(i)) instanceof Double) { builder.append(getPrettyString(((Double) item.getData(String.valueOf(i))).doubleValue() * 100d) + "%"); //$NON-NLS-1$ if (i < columns - 1) { builder.append(", "); //$NON-NLS-1$ } } } builder.append(")"); //$NON-NLS-1$ table.setToolTipText(builder.toString()); } } }); }
/** * Add a mouse handler for mouse move and click events * * @param mouseState */ public void addMouseHandler(MenuListener mouseState, MouseMoveListener moveListener) { if (mouseState != null) { addMouseListener(mouseState); } if (moveListener != null) { addMouseMoveListener(moveListener); } }
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(EventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); // } // else if (listener instanceof DragDetectListener) { // this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); // } // else if (listener instanceof MenuDetectListener) { // this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); // } else if (listener instanceof MouseWheelListener) { // this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
@Override public void addMouseMoveListener(final MouseMoveListener listener) { addListener(SWT.MouseMove, new TypedListener(listener)); }
@Override public void removeMouseMoveListener(final MouseMoveListener listener) { removeListener(SWT.MouseMove, listener); }
/************************************************************************** * Override the listener mechanism *************************************************************************/ public void addMouseMoveListener(MouseMoveListener lst) { m_view.addMouseMoveListener(lst); }
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(EventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); } else if (listener instanceof DragDetectListener) { this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); } else if (listener instanceof MenuDetectListener) { this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); } else if (listener instanceof MouseWheelListener) { this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
public void addMouseMoveListener(MouseMoveListener listener) { this.mouseMoveListeners.add(listener); }
public void addMouseMoveListener(MouseMoveListener listener){ this.text.addMouseMoveListener(listener); }
public void removeMouseMoveListener(MouseMoveListener listener){ this.text.removeMouseMoveListener(listener); }
/** * Adds the listener to the collection of listeners who will be notified * when the mouse moves, by sending it one of the messages defined in the * <code>MouseMoveListener</code> interface. * * @param listener * the listener which should be notified * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * * @see MouseMoveListener * @see #removeMouseMoveListener */ public void addMouseMoveListener(MouseMoveListener listener) { super.addMouseMoveListener(listener); checkWidget(); if (listener == null) error(SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener(listener); addListener(SWT.MouseMove, typedListener); }
/** * Removes the listener from the collection of listeners who will be * notified when the mouse moves. * * @param listener * the listener which should no longer be notified * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * * @see MouseMoveListener * @see #addMouseMoveListener */ public void removeMouseMoveListener(MouseMoveListener listener) { checkWidget(); if (listener == null) error(SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook(SWT.MouseMove, listener); }
public void addMouseMoveListener(MouseMoveListener listener) { tree.addMouseMoveListener(listener); }
public void removeMouseMoveListener(MouseMoveListener listener) { tree.removeMouseMoveListener(listener); }