Java Code Examples for org.eclipse.swt.events.FocusListener

The following examples show how to use org.eclipse.swt.events.FocusListener. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: nebula   Source File: MonthCalendar.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void focusGained(FocusEvent e) {
	Day day = (Day) e.widget;
	if (lastSelectedDay != null && lastSelectedDay != day) {
		lastSelectedDay.setFocusState(Day.NO_FOCUS);
		lastSelectedDay.redraw();
	}

	Point coordinates = day.getMonthPosition();
	selectedDay = new MonthCalendarSelectedDay(day.getDate(), coordinates);
	e.data = selectedDay;

	lastSelectedDay = day;

	for (Iterator<FocusListener> focusListenersIter = focusListeners.iterator(); focusListenersIter.hasNext();) {
		FocusListener listener = (FocusListener) focusListenersIter.next();
		listener.focusGained(e);
	}
}
 
Example 2
@Override
protected void createTextControl(final int style,
        final TabbedPropertySheetWidgetFactory widgetFactory) {
    super.createTextControl(style | SWT.READ_ONLY, widgetFactory);
    getTextControl().setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    getTextControl().setMessage(Messages.selectTarget);
    final IConfigurationElement[] configurationElements = BonitaStudioExtensionRegistryManager.getInstance().getConfigurationElements(
            "org.bonitasoft.studio.expression.editor.caretDestroyer");
    if (configurationElements.length == 1) {
        try {
            final FocusListener caretDestroyerFocusListener = (FocusListener) configurationElements[0].createExecutableExtension("class");
            getTextControl().addFocusListener(caretDestroyerFocusListener);
        } catch (final CoreException e1) {
            BonitaStudioLog.error(e1);
        }
    }
}
 
Example 3
Source Project: nebula   Source File: TimeSlice.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Control#addFocusListener
 * 
 * @param listener
 */
public void addCellFocusListener(FocusListener listener) {
	for (Iterator daysIter = columns.iterator(); daysIter.hasNext();) {
		Object dayCandidate = daysIter.next();
		if (dayCandidate instanceof TimeSlot) {
			TimeSlot day = (TimeSlot) dayCandidate;
			day.addFocusListener(listener);
		}
	}
}
 
Example 4
Source Project: nebula   Source File: TimeSlice.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Control#removeFocusListener
 * @param listener
 */
public void removeCellFocusListener(FocusListener listener) {
	for (Iterator daysIter = columns.iterator(); daysIter.hasNext();) {
		Object dayCandidate = daysIter.next();
		if (dayCandidate instanceof TimeSlot) {
			TimeSlot day = (TimeSlot) dayCandidate;
			day.removeFocusListener(listener);
		}
	}
}
 
Example 5
Source Project: nebula   Source File: MonthCalendar.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public void focusLost(FocusEvent e) {
	Day day = (Day) e.widget;
	Point coordinates = day.getMonthPosition();
	e.data = new MonthCalendarSelectedDay(day.getDate(), coordinates);

	for (Iterator<FocusListener> focusListenersIter = focusListeners.iterator(); focusListenersIter.hasNext();) {
		FocusListener listener = (FocusListener) focusListenersIter.next();
		listener.focusLost(e);
	}
}
 
Example 6
Source Project: nebula   Source File: RichTextEditor.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void addFocusListener(FocusListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	this.focusListener.add(listener);
}
 
Example 7
Source Project: nebula   Source File: RichTextEditor.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void removeFocusListener(FocusListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	this.focusListener.remove(listener);
}
 
Example 8
/**
 * {@inheritDoc} This method is not intended to be overridden by subclasses.
 */
public void addFocusListener(final FocusListener listener)
{
	if (fFocusListeners.isEmpty())
	{
		fShellListener = new Listener()
		{

			public void handleEvent(Event event)
			{
				Object[] listeners = fFocusListeners.getListeners();
				for (int i = 0; i < listeners.length; i++)
				{
					FocusListener focusListener = (FocusListener) listeners[i];
					if (event.type == SWT.Activate)
					{
						focusListener.focusGained(new FocusEvent(event));
					}
					else
					{
						focusListener.focusLost(new FocusEvent(event));
					}
				}
			}
		};
		fShell.addListener(SWT.Deactivate, fShellListener);
		fShell.addListener(SWT.Activate, fShellListener);
	}
	fFocusListeners.add(listener);
}
 
Example 9
/**
 * {@inheritDoc} This method is not intended to be overridden by subclasses.
 */
public void removeFocusListener(FocusListener listener)
{
	fFocusListeners.remove(listener);
	if (fFocusListeners.isEmpty())
	{
		fShell.removeListener(SWT.Activate, fShellListener);
		fShell.removeListener(SWT.Deactivate, fShellListener);
		fShellListener = null;
	}
}
 
Example 10
Source Project: birt   Source File: FormatLayoutPeer.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void addFocusListener( FocusListener listener )
{
	if ( cba != null )
	{
		cba.addFocusListener( listener );
	}
	else
	{
		cbb.addFocusListener( listener );
	}
}
 
Example 11
Source Project: openstock   Source File: ChartComposite.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
     * 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);
        }
    }
 
Example 12
Source Project: hop   Source File: CheckBoxVar.java    License: Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wBox.addFocusListener( lsFocus );
}
 
Example 13
Source Project: hop   Source File: TextVar.java    License: Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wText.addFocusListener( lsFocus );
}
 
Example 14
Source Project: hop   Source File: TextVarWarning.java    License: Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wText.addFocusListener( lsFocus );
}
 
Example 15
Source Project: hop   Source File: WarningText.java    License: Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wText.addFocusListener( lsFocus );
}
 
Example 16
Source Project: hop   Source File: ComboVar.java    License: Apache License 2.0 4 votes vote down vote up
public void addFocusListener( FocusListener lsFocus ) {
  wCombo.addFocusListener( lsFocus );
}
 
Example 17
Source Project: nebula   Source File: RichTextEditor.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private void doNotifyFocusGained(FocusEvent event) {
	Object[] listeners = this.focusListener.getListeners();
	for (int i = 0; i < listeners.length; ++i) {
		((FocusListener) listeners[i]).focusGained(event);
	}
}
 
Example 18
Source Project: nebula   Source File: RichTextEditor.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private void doNotifyFocusLost(FocusEvent event) {
	Object[] listeners = this.focusListener.getListeners();
	for (int i = 0; i < listeners.length; ++i) {
		((FocusListener) listeners[i]).focusLost(event);
	}
}
 
Example 19
Source Project: nebula   Source File: CalendarCombo.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public void addFocusListener(FocusListener listener) {
    mComboControl.addFocusListener(listener);
}
 
Example 20
Source Project: nebula   Source File: CalendarCombo.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public void removeFocusListener(FocusListener listener) {
    mComboControl.removeFocusListener(listener);
}
 
Example 21
Source Project: ccu-historian   Source File: ChartComposite.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
     * 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);
        }
    }
 
Example 22
@Override
public void removeFocusListener(FocusListener listener) {
	control.removeFocusListener(listener);
}
 
Example 23
@Override
public void addFocusListener(FocusListener listener) {
	control.addFocusListener(listener);
}
 
Example 24
Source Project: texlipse   Source File: TexInformationControl.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public void addFocusListener(FocusListener listener) {
    shell.addFocusListener(listener);
}
 
Example 25
Source Project: texlipse   Source File: TexInformationControl.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public void removeFocusListener(FocusListener listener) {
    shell.removeFocusListener(listener);
}
 
Example 26
Source Project: SIMVA-SoS   Source File: ChartComposite.java    License: Apache License 2.0 4 votes vote down vote up
/**
     * 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);
        }
    }
 
Example 27
Source Project: typescript.java   Source File: AbstractInformationControl.java    License: MIT License 4 votes vote down vote up
@Override
public void addFocusListener(FocusListener listener) {
	getShell().addFocusListener(listener);
}
 
Example 28
Source Project: typescript.java   Source File: AbstractInformationControl.java    License: MIT License 4 votes vote down vote up
@Override
public void removeFocusListener(FocusListener listener) {
	getShell().removeFocusListener(listener);
}
 
Example 29
@Override
public void addFocusListener(FocusListener listener) {
    getShell().addFocusListener(listener);
}
 
Example 30
@Override
public void removeFocusListener(FocusListener listener) {
    getShell().removeFocusListener(listener);
}