private Button createDropdownButton(final Composite parent, int id, String label, MouseListener mouseListener) { char textEmbedding = parent.getOrientation() == SWT.LEFT_TO_RIGHT ? '\u202a' : '\u202b'; Button button = createButton(parent, id, textEmbedding + label + '\u202c', false); if (Util.isMac()) { // Button#setOrientation(int) is a no-op on the Mac. Use a Unicode // BLACK DOWN-POINTING SMALL TRIANGLE. button.setText(button.getText() + " \u25BE"); //$NON-NLS-1$ } else { int dropDownOrientation = parent.getOrientation() == SWT.LEFT_TO_RIGHT ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT; button.setOrientation(dropDownOrientation); button.setText(button.getText() + " \u25BE"); //$NON-NLS-1$ button.addMouseListener(mouseListener); } return button; }
private void addTable(){ MouseListener listener = mouseFocusListener(); this.table = new TGTable(this.context, getComposite()); this.table.getColumnNumber().getControl().addMouseListener(listener); this.table.getColumnSoloMute().getControl().addMouseListener(listener); this.table.getColumnName().getControl().addMouseListener(listener); this.table.getColumnInstrument().getControl().addMouseListener(listener); this.table.getColumnCanvas().getControl().addMouseListener(listener); this.table.getColumnCanvas().getControl().addMouseListener(new MouseAdapter() { public void mouseDoubleClick(MouseEvent e) { new TGActionProcessor(TuxGuitar.getInstance().getContext(), TGOpenSongInfoDialogAction.NAME).process(); } }); this.fireUpdate(true); this.loadProperties(); }
private void addServer(Composite parent, final IServerMonitor server) { final Composite composite = new Composite(parent, SWT.NONE); RowLayout layout = new RowLayout(); layout.marginTop = 0; layout.marginBottom = 0; layout.marginLeft = 2; layout.marginRight = 2; composite.setLayout(layout); final Label icon = new Label(composite, SWT.CENTER); final Label text = new Label(composite, SWT.CENTER); text.setText(server.getShortName()); updateStatusIconAndTooltip(server, composite, icon, text); composite.addMouseTrackListener(new CompositeMouseTrackListener(text, icon, server, composite)); composite.addMouseListener(new CompositeMouseListener(text, icon, server, composite)); server.addListener(new CompositeServerMonitorListener(text, icon, server, composite)); final String host = server.getHost(); final int port = server.getPort(); final Option<IServerStatusWidgetListenerProvider> provider = widgetListenerProviders._1().find(matches(host, port)); if (provider.isSome()) { final MouseListener mouseListener = provider.some().getMouseListener(); composite.addMouseListener(mouseListener); icon.addMouseListener(mouseListener); text.addMouseListener(mouseListener); } }
/** * 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 removeMouseListener ( final ChartMouseListener listener ) { final MouseListener proxyListener = this.mouseListenerMap.remove ( listener ); if ( proxyListener != null ) { this.control.removeMouseListener ( proxyListener ); } }
/** * Add a mouse listener to the control and also the <code>titleLabel</code> */ @Override public void addMouseListener(MouseListener listener) { if (null != titleLabel) { titleLabel.addMouseListener(listener); } super.addMouseListener(listener); }
/** * Remove the mouse listener from the control and also the <code>titleLabel</code> */ @Override public void removeMouseListener(MouseListener listener) { if (null != titleLabel) { titleLabel.removeMouseListener(listener); } super.removeMouseListener(listener); }
@Override public void addMouseListener(final MouseListener listener) { composite.addMouseListener(listener); iconComposite.addMouseListener(listener); titleArea.addMouseListener(listener); titleComposite.addMouseListener(listener); colorBar.addMouseListener(listener); iconArea.addMouseListener(listener); }
public void init(){ MouseListener mouseListenerLabel = new MouseListenerLabel(); MouseListener mouseListenerCanvas = new MouseListenerCanvas(); this.row = new Composite(this.table.getRowControl(),SWT.NONE ); this.row.setLayoutData(new GridData(SWT.FILL,SWT.TOP,true,false)); this.number = new CLabel(this.row,SWT.LEFT); this.number.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnNumber(),this.number,true); this.soloMute = new CLabel(this.row,SWT.LEFT); this.soloMute.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnSoloMute(),this.soloMute,true); this.name = new CLabel(this.row,SWT.LEFT); this.name.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnName(),this.name,true); this.instrument = new CLabel(this.row,SWT.LEFT); this.instrument.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnInstrument(),this.instrument,true); this.painter = new Composite(this.row,SWT.DOUBLE_BUFFERED); this.painter.addMouseListener(mouseListenerCanvas); this.painter.addPaintListener(new TGBufferedPainterListenerLocked(this.table.getContext(), new TGTableRowPaintHandle())); this.table.addRowItem(this.table.getColumnCanvas(),this.painter,false); this.row.pack(); }
private MouseListener mouseFocusListener(){ return new MouseAdapter() { public void mouseUp(MouseEvent e) { TGTable table = getTable(); if(table != null){ TGTableRow row = table.getRow( ( getSelectedTrack() - 1 ) ); if( row != null ){ row.getPainter().setFocus(); } } } }; }
/** * Notifies mouse listeners. * * @param type Event type * @param event Mouse event */ protected void notifyMouseListeners(int type, MouseEvent event) { Object[] listeners = mouseListeners.getListeners(); for (Object listener : listeners) { if (type == 1) { ((MouseListener)listener).mouseDown(event); } else if (type == 2) { ((MouseListener)listener).mouseUp(event); } else if (type == 3) { ((MouseListener)listener).mouseDoubleClick(event); } } }
/** * Returns the mouse listener * @return */ private MouseListener getMouseListener() { return new MouseAdapter(){ @Override public void mouseDown(MouseEvent arg0) { Tile<T> tile = getTileAt(arg0.x, arg0.y); if (tile != null && tile.item != selectedItem) { selectedItem = tile.item; redraw(); fireSelectionEvent(tile); } } }; }
/** * Add a mouse listener to the control and also the <code>titleLabel</code> */ public void addMouseListener(MouseListener listener) { if (null != titleLabel) { titleLabel.addMouseListener(listener); } super.addMouseListener(listener); }
/** * Remove the mouse listener from the control and also the <code>titleLabel</code> */ public void removeMouseListener(MouseListener listener) { if (null != titleLabel) { titleLabel.removeMouseListener(listener); } super.removeMouseListener(listener); }
protected void dispatchMouseReleased(MouseEvent me) { List<MouseListener> copy = new ArrayList<MouseListener>(mouseListeners); for (MouseListener ml : copy) { ml.mouseUp(me); } }
private static void addPopupListener(Composite c, MouseListener ml) { for (Control ctrl : c.getChildren()) { if (ctrl instanceof Composite) addPopupListener((Composite) ctrl, ml); else ctrl.addMouseListener(ml); } c.addMouseListener(ml); }
private static void removePopupListener(Composite c, MouseListener ml) { for (Control ctrl : c.getChildren()) { if (ctrl instanceof Composite) removePopupListener((Composite) ctrl, ml); else ctrl.removeMouseListener(ml); } c.removeMouseListener(ml); }
public void init(){ MouseListener mouseListenerLabel = new MouseListenerLabel(); MouseListener mouseListenerCanvas = new MouseListenerCanvas(); PaintListener paintListenerCanvas = new PaintListenerCanvas(); this.row = new Composite(this.table.getRowControl(),SWT.NONE ); this.row.setLayoutData(new GridData(SWT.FILL,SWT.TOP,true,false)); this.number = new CLabel(this.row,SWT.LEFT); this.number.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnNumber(),this.number,true); this.name = new CLabel(this.row,SWT.LEFT); this.name.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnName(),this.name,true); this.instrument = new CLabel(this.row,SWT.LEFT); this.instrument.addMouseListener(mouseListenerLabel); this.table.addRowItem(this.table.getColumnInstrument(),this.instrument,true); this.painter = new Composite(this.row,SWT.DOUBLE_BUFFERED); this.painter.addMouseListener(mouseListenerCanvas); this.painter.addPaintListener(paintListenerCanvas); this.table.addRowItem(this.table.getColumnCanvas(),this.painter,false); this.row.pack(); }
private void addTable(){ MouseListener listener = mouseFocusListener(); this.table = new TGTable(getComposite()); this.table.getColumnNumber().getControl().addMouseListener(listener); this.table.getColumnName().getControl().addMouseListener(listener); this.table.getColumnInstrument().getControl().addMouseListener(listener); this.table.getColumnCanvas().getControl().addMouseListener(listener); this.table.getColumnCanvas().getControl().addMouseListener(new MouseAdapter() { public void mouseDoubleClick(MouseEvent e) { TuxGuitar.instance().getAction(ChangeInfoAction.NAME).process(e); } }); this.fireUpdate(true); this.loadProperties(); }
private MouseListener mouseFocusListener(){ return new MouseAdapter() { public void mouseUp(MouseEvent e) { TGTable table = getTable(); if(table != null){ TGTableRow row = table.getRow( ( getSelectedTrack() - 1 ) ); if(row != null){ row.getPainter().setFocus(); } } } }; }
public SEDemoUIModel(Script modelScript, Project scriptProject, MouseListener listener, AlertHandler deviceChgHandler, boolean editable) { super(scriptProject, listener, deviceChgHandler, editable); if (modelScript == null) { throw new IllegalArgumentException ("Cannot create a SEDemoUIModel with a null Script"); } // Store model for reference script = modelScript; Demonstration demo = script.getDemonstration(); TaskApplication taskApp = demo.getTaskApplication(); task = taskApp.getTask(); design = taskApp.getDesign(); scriptUIModel = new ScriptUIModel(modelScript, scriptProject); setCurrentFrame(demo.getStartFrame()); design.addHandler(this, Design.FrameChange.class, deleteHandler); AlertHandler handleStepDeletion = new StepDeletionHandler(demo); demo.addHandler(this, Demonstration.ScriptStepChange.class, handleStepDeletion); }
public DefaultSEUIModel(Project proj, MouseListener listener, AlertHandler deviceChgHandler, boolean edit) { super(proj); frameNameListener = listener; inputDeviceChangeHandler = deviceChgHandler; editable = edit; }
public void addMouseUpListener(MouseListener listener) { defaultELTLable.addMouseListener(listener); }
public void addMouseListener(MouseListener listener) { label.addMouseListener(listener); }
/** * 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 addMouseListener(final MouseListener listener) { addListener(SWT.MouseDown, new TypedListener(listener)); addListener(SWT.MouseUp, new TypedListener(listener)); addListener(SWT.MouseDoubleClick, new TypedListener(listener)); }
@Override public void removeMouseListener(final MouseListener listener) { removeListener(SWT.MouseDown, listener); removeListener(SWT.MouseUp, listener); removeListener(SWT.MouseDoubleClick, new TypedListener(listener)); }
public void setOkListener( MouseListener okListener){ this.okListener = okListener; }
public MouseListener getMouseListenerLabel() { return this.mouseListenerLabel; }
public void setMouseListenerLabel(MouseListener mouseListenerLabel) { this.mouseListenerLabel = mouseListenerLabel; }
public MouseListener getMouseListenerCanvas() { return this.mouseListenerCanvas; }
public void setMouseListenerCanvas(MouseListener mouseListenerCanvas) { this.mouseListenerCanvas = mouseListenerCanvas; }
public void addUserTextMouseListener(MouseListener l) { mouseListener.add(l); text.addMouseListener(l); }
@Override public void addMouseListener(MouseListener listener) { label.addMouseListener(listener); }
@Override public void removeMouseListener(MouseListener listener) { label.removeMouseListener(listener); }
/************************************************************************** * Override the listener mechanism *************************************************************************/ public void addMouseListener(MouseListener lst) { m_view.addMouseListener(lst); }
/** * Removes a listener from mouse events. * * @Param listener Listener to remove */ public void removeMouseListener(MouseListener listener) { if (mouseListeners != null) { mouseListeners.remove(listener); } }