Java Code Examples for org.eclipse.swt.SWT#Modify

The following examples show how to use org.eclipse.swt.SWT#Modify . 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 File: TextAreaWidget.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Text newText(final Composite textContainer) {
    final Text text = new Text(textContainer, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
    text.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    final Listener scrollBarListener = event -> {
        final Text t = (Text) event.widget;
        final Rectangle r1 = t.getClientArea();
        final Rectangle r2 = t.computeTrim(r1.x, r1.y, r1.width, r1.height);
        final Point p = t.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
        t.getVerticalBar().setVisible(r2.height <= p.y);
        if (event.type == SWT.Modify) {
            t.getParent().layout(true);
            t.showSelection();
        }
    };
    text.addListener(SWT.Resize, scrollBarListener);
    text.addListener(SWT.Modify, scrollBarListener);
    return text;
}
 
Example 2
Source File: ChartExpressionButton.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void notifyChangeEvent( )
{
	String newExpr = eHelper.getExpression( );
	String newType = eHelper.getExpressionType( );
	Event event = new Event( );
	event.widget = eb.getControl( );
	event.detail = SWT.Modify;
	String[] data = new String[4];
	data[0] = lastExpr.getExpression( );
	data[1] = newExpr;
	data[2] = lastExpr.getType( );
	data[3] = newType;
	event.data = data;

	for ( Listener listener : listeners )
	{
		listener.handleEvent( event );
	}

	save( );
}
 
Example 3
Source File: FormatSpecifierComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void handleEvent( Event event )
{
	if ( event.type == SWT.Selection )
	{
		widgetSelected( new SelectionEvent( event ) );
	}
	else if ( event.type == SWT.Modify )
	{
		modifyText( new ModifyEvent( event ) );
	}
	updatePreview( );
}
 
Example 4
Source File: PatientDetailView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
	if (event.type != SWT.Modify)
		return;
	if (t.getLineCount() != lines) {
		lines = t.getLineCount();

		t.setSize(t.getSize().x, lines * (int) t.getFont().getFontData()[0].height);
		scrldfrm.reflow(true);
	}
}
 
Example 5
Source File: ClientCustomTextComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleEvent(Event event){
	if (event.type != SWT.Modify)
		return;
	if (txtClientCustomText.getLineCount() != lines) {
		lines = txtClientCustomText.getLineCount();
		
		txtClientCustomText.setSize(txtClientCustomText.getSize().x, lines
			* (int) txtClientCustomText.getFont().getFontData()[0].height);
	}
	scrldfrm.reflow(true);
}
 
Example 6
Source File: SelectTypeDialog.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
  if (event.widget == typeNameUI && event.type == SWT.Modify) {
    typeName = typeNameUI.getText(); 
    displayFilteredTypes(typeName);
  }
  
  else if (event.widget == matchingTypesUI && event.type == SWT.Selection) {
    displayNameSpacesForSelectedItem(
            (Map.Entry)(matchingTypesUI.getSelection()[0].getData()));
  }
  super.handleEvent(event);
}
 
Example 7
Source File: ExpressionButtonUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void notifyExpressionChangeEvent( String oldExpression,
		String newExpression )
{
	if ( listener != null )
	{
		Event event = new Event( );
		event.widget = button.getControl( );
		event.data = new String[]{
				oldExpression, newExpression
		};
		event.detail = SWT.Modify;
		listener.handleEvent( event );
	}
	control.setFocus( );
}
 
Example 8
Source File: PatternImageEditorDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void notifyListeners( )
{
	Event event = new Event( );
	event.type = SWT.Modify;

	for ( Listener listener : listeners )
	{
		listener.handleEvent( event );
	}
}
 
Example 9
Source File: PatternImageEditorDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void handleEvent( Event event )
{
	switch ( event.type )
	{
		case SWT.MouseDown :
			int index = computeIndex( event.x, event.y );
			select( index );
			break;
		case SWT.Modify :
			redraw( );
			itemFrame.doRedraw( );
			break;
	}
}
 
Example 10
Source File: ChartExpressionButtonUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void notifyExpressionChangeEvent( String oldExpression,
		String newExpression )
{
	if ( listener != null )
	{
		Event event = new Event( );
		event.widget = button.getControl( );
		event.data = new String[]{
				oldExpression, newExpression
		};
		event.detail = SWT.Modify;
		listener.handleEvent( event );
	}
}
 
Example 11
Source File: WizardNewFilePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleEvent(Event event)
{
	// Hook into the event handling to get the typed file name.
	// In case we have a template for that, the canFlipToNextPage method call will show the Next button
	if (event.type == SWT.Modify)
	{
		collectTemplates();
	}
	super.handleEvent(event);
}
 
Example 12
Source File: BaseCombo.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void createText(int style) {
	textListener = new Listener() {
		public void handleEvent(Event event) {
			switch (event.type) {
			case SWT.KeyDown:
				if (event.stateMask == SWT.CTRL && event.keyCode == ' ') {
					event.doit = false;
					setOpen(true);
				}
				break;
			case SWT.Modify:
				Event e = new Event();
				e.time = event.time;
				setModifyEventProperties(e);
				notifyListeners(SWT.Modify, e);
				break;
			}
		}
	};

	int mask = SWT.TRAIL | SWT.LEAD;
	int textStyle = SWT.SINGLE | (style & mask);
	if (!win32 && (style & SWT.BORDER) != 0) {
		textStyle |= SWT.BORDER;
	}

	text = VNative.create(Text.class, panel, textStyle);
	addTextListener();
}
 
Example 13
Source File: FormattedTextObservableValue.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public FormattedTextObservableValue(final FormattedText formattedText) {
	this(SWTObservables.getRealm(formattedText.getControl().getDisplay()), formattedText, SWT.Modify);
}
 
Example 14
Source File: CCombo.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Constructs a new instance of this class given its parent
 * and a style value describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in
 * class <code>SWT</code> which is applicable to instances of this
 * class, or must be built by <em>bitwise OR</em>'ing together 
 * (that is, using the <code>int</code> "|" operator) two or more
 * of those <code>SWT</code> style constants. The class description
 * lists the style constants that are applicable to the class.
 * Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a widget which will be the parent of the new instance (cannot be null)
 * @param style the style of widget to construct
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
 * </ul>
 *
 * @see SWT#BORDER
 * @see SWT#READ_ONLY
 * @see SWT#FLAT
 * @see Widget#getStyle()
 */
public CCombo (Composite parent, int style) {
	super (parent, style = checkStyle (style));
	
	int textStyle = SWT.SINGLE;
	if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY;
	if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
	text = new Text (this, textStyle);
	int arrowStyle = SWT.ARROW | SWT.DOWN;
	if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT;
	arrow = new Button (this, arrowStyle);

	listener = new Listener () {
		public void handleEvent (Event event) {
			if (popup == event.widget) {
				popupEvent (event);
				return;
			}
			if (text == event.widget) {
				textEvent (event);
				return;
			}
			if (list == event.widget) {
				listEvent (event);
				return;
			}
			if (arrow == event.widget) {
				arrowEvent (event);
				return;
			}
			if (CCombo.this == event.widget) {
				comboEvent (event);
				return;
			}

		}
	};
	
	
	int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
	for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
	
	int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn, SWT.FocusOut};
	for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
	
	int [] arrowEvents = {SWT.Selection, SWT.FocusIn, SWT.FocusOut};
	for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener);
	
	createPopup(null, -1);
	initAccessible();
	
}
 
Example 15
Source File: DurationCompositeObservableValue.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public DurationCompositeObservableValue(){
	super(SWT.Modify);
}
 
Example 16
Source File: AddFeatureDialog.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
public void handleEvent(Event event) {
  super.handleEvent(event);
  if (event.type == SWT.Modify && event.widget == featureRangeNameUI)
    manageVisibleFields();
}
 
Example 17
Source File: CDateTimeValueProperty.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 
 */
public CDateTimeValueProperty() {
	super(new int[] { SWT.Selection, SWT.Modify });
}
 
Example 18
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * The CTreeCombo class represents a selectable user interface object
 * that combines a text field and a tree and issues notification
 * when an item is selected from the tree.
 * <p>
 * Note that although this class is a subclass of <code>Composite</code>,
 * it does not make sense to add children to it, or set a layout on it.
 * </p>
 * <dl>
 * <dt><b>Styles:</b>
 * <dd>BORDER, READ_ONLY, FLAT</dd>
 * <dt><b>Events:</b>
 * <dd>DefaultSelection, Modify, Selection, Verify</dd>
 * </dl>
 */
public CTreeCombo(Composite parent, int style) {
	super(parent, style = checkStyle(style));

	int textStyle = SWT.SINGLE;
	if ((style & SWT.READ_ONLY) != 0) {
		textStyle |= SWT.READ_ONLY;
	}
	if ((style & SWT.FLAT) != 0) {
		textStyle |= SWT.FLAT;
	}
	text = new Text(this, textStyle);
	int arrowStyle = SWT.ARROW | SWT.DOWN;
	if ((style & SWT.FLAT) != 0) {
		arrowStyle |= SWT.FLAT;
	}
	arrow = new Button(this, arrowStyle);

	listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			if (popup == event.widget) {
				popupEvent(event);
				return;
			}
			if (text == event.widget) {
				textEvent(event);
				return;
			}
			if (tree == event.widget) {
				treeEvent(event);
				return;
			}
			if (arrow == event.widget) {
				arrowEvent(event);
				return;
			}
			if (CTreeCombo.this == event.widget) {
				comboEvent(event);
				return;
			}
			if (getShell() == event.widget) {
				getDisplay().asyncExec(new Runnable() {
					@Override
					public void run() {
						if (isDisposed()) {
							return;
						}
						handleFocus(SWT.FocusOut);
					}
				});
			}
		}
	};
	filter = (event) -> {
		final Shell shell = ((Control) event.widget).getShell();
		if (shell == CTreeCombo.this.getShell()) {
			handleFocus(SWT.FocusOut);
		}
	};

	final int[] comboEvents = { SWT.Dispose, SWT.FocusIn, SWT.Move, SWT.Resize };
	for (int i = 0; i < comboEvents.length; i++) {
		addListener(comboEvents[i], listener);
	}

	final int[] textEvents = { SWT.DefaultSelection, SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.MouseDoubleClick, SWT.MouseWheel, SWT.Traverse, SWT.FocusIn, SWT.Verify };
	for (int i = 0; i < textEvents.length; i++) {
		text.addListener(textEvents[i], listener);
	}

	final int[] arrowEvents = { SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.FocusIn };
	for (int i = 0; i < arrowEvents.length; i++) {
		arrow.addListener(arrowEvents[i], listener);
	}

	createPopup(null, null);
	initAccessible();
}