Java Code Examples for org.eclipse.swt.widgets.Composite#getTabList()

The following examples show how to use org.eclipse.swt.widgets.Composite#getTabList() . 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: VTracker.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private static boolean setFocusFromPrev(Control control) {
	Control c = null;
	Composite parent = control.getParent();
	if(parent == null) {
		c = control;
	} else {
		Control[] ca = parent.getTabList();
		for(int i = 0; i < ca.length; i++) {
			if(ca[i] == control) {
				if(i == ca.length-1) {
					c = ca[0];
				} else {
					c = ca[i+1];
				}
				break;
			}
		}
	}
	if(c != null) {
		c.setFocus();
	}
	return false;
}
 
Example 2
Source File: VTracker.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private static boolean setFocusFromNext(Control control) {
	Control c = null;
	Composite parent = control.getParent();
	if(parent == null) {
		c = control;
	} else {
		Control[] ca = parent.getTabList();
		for(int i = 0; i < ca.length; i++) {
			if(ca[i] == control) {
				if(i == 0) {
					c = ca[ca.length-1];
				} else {
					c = ca[i-1];
				}
				break;
			}
		}
	}
	if(c != null) {
		c.setFocus();
	}
	return false;
}
 
Example 3
Source File: TableRow.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Constructor TableRow.  Construct a TableRow object.
 * 
 * @param parent The table containing this row.
 * @param row The SWT control implementing this row.
 */
public TableRow(InternalCompositeTable parent, Control row) {
	this.parent = parent;
	this.row = row;
	if (row instanceof Composite) {
		Composite rowComposite = (Composite) row;
		columns = rowComposite.getTabList();
	} else {
		columns = new Control[] {row};
	}
	
	recursiveAddListeners(row);
}
 
Example 4
Source File: VTracker.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static void setFocusToNext(Composite comp) {
	if(comp != null) {
		Composite parent = comp.getParent();
		Control[] controls = parent.getTabList();
		if(parent instanceof Shell) {
			for(int i = 0; i < controls.length; i++) {
				if(controls[i] == comp) {
					for(int j = 0; j < controls.length; j++) {
						i++;
						if(i > controls.length-1) {
							i = 0;
						}
						if(controls[i].forceFocus()) {
							return;
						}
					}
				}
			}
		} else {
			for(int i = 0; i < controls.length; i++) {
				if(controls[i] == comp) {
					for( ; i < controls.length-1; i++) {
						if(controls[i+1].forceFocus()) {
							return;
						}
					}
					setFocusToNext(comp.getParent());
				}
			}
		}
	}
}
 
Example 5
Source File: VTracker.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static void setFocusToPrev(Composite comp) {
	if(comp != null) {
		Composite parent = comp.getParent();
		Control[] controls = parent.getTabList();
		if(parent instanceof Shell) {
			for(int i = 0; i < controls.length; i++) {
				if(controls[i] == comp) {
					for(int j = 0; j < controls.length; j++) {
						i--;
						if(i < 0) {
							i = controls.length-1;
						}
						if(controls[i].forceFocus()) {
							return;
						}
					}
				}
			}
		} else {
			for(int i = 0; i < controls.length; i++) {
				if(controls[i] == comp) {
					for(int j=i ; j > 0; j--) {
						if(controls[j-1].forceFocus()) {
							return;
						}
					}
					setFocusToPrev(comp.getParent());
				}
			}
		}
	}
}
 
Example 6
Source File: MarignSection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void setAccessible (final Control control)
{
	if ( control instanceof Composite )
	{
		Composite parent = (Composite)control;
		if ( parent != null && parent.getTabList( ) != null )
		{
			Control[] children = parent.getTabList( );
			for ( int i = 0; i < children.length; i++ )
			{
				setAccessible( children[i] );
			}
		}
	}
	else
	{
		control.getAccessible( )
				.addAccessibleListener( new AccessibleAdapter( ) {

					public void getName( AccessibleEvent e )
					{
						Label lbl = getLabelControl( );
						if ( lbl != null )
						{
							if (control instanceof Text)
							{
								e.result = UIUtil.stripMnemonic( getLabelControl( ).getText( ))
										+ ((Text) control).getText();
							}
						}
					}

				} );
	}
}
 
Example 7
Source File: ComplexUnitSection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void setAccessible( final Control control )
{
	if ( control instanceof Composite )
	{
		Composite parent = (Composite) control;
		if ( parent != null && parent.getTabList( ) != null )
		{
			Control[] children = parent.getTabList( );
			for ( int i = 0; i < children.length; i++ )
			{
				setAccessible( children[i] );
			}
		}
	}
	else
	{
		control.getAccessible( )
				.addAccessibleListener( new AccessibleAdapter( ) {

					public void getName( AccessibleEvent e )
					{
						Label lbl = getLabelControl( );
						if ( lbl != null )
						{
							if (control instanceof Text)
							{
								e.result = UIUtil.stripMnemonic( getLabelControl( ).getText( ) )
									+ ((Text) control).getText( );
							}
						}
					}

				} );
	}
}
 
Example 8
Source File: ColorSection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void setAccessible (final Control control)
{
	if ( control instanceof Composite )
	{
		Composite parent = (Composite)control;
		if ( parent != null && parent.getTabList( ) != null )
		{
			Control[] children = parent.getTabList( );
			for ( int i = 0; i < children.length; i++ )
			{
				setAccessible( children[i] );
			}
		}
	}
	else
	{
		control.getAccessible( )
				.addAccessibleListener( new AccessibleAdapter( ) {

					public void getName( AccessibleEvent e )
					{
						Label lbl = getLabelControl( );
						if ( lbl != null )
						{
							if (control instanceof Button)
							{
								e.result = UIUtil.stripMnemonic( getLabelControl( ).getText( ))
										+ JFaceResources.getString( "ColorSelector.Name" ); //$NON-NLS-1$
							}
							else if (control instanceof Text)
							{
								e.result = UIUtil.stripMnemonic( getLabelControl( ).getText( ))
										+ ((Text) control).getText( );
							}
						}
					}

				} );
	}
}
 
Example 9
Source File: FontSizeSection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void setAccessible( Control control )
{
	if ( control instanceof Composite )
	{
		Composite parent = (Composite)control;
		if ( parent != null && parent.getTabList( ) != null )
		{
			Control[] children = parent.getTabList( );
			for ( int i = 0; i < children.length; i++ )
			{
				setAccessible( children[i] );
			}
		}
	}
	else
	{
		control.getAccessible( )
				.addAccessibleListener( new AccessibleAdapter( ) {

					public void getName( AccessibleEvent e )
					{
						Label lbl = getLabelControl( );
						if ( lbl != null )
						{
							e.result = UIUtil.stripMnemonic( getLabelControl( ).getText( ))
									+ fontSize.getFontSizeValue( );
						}
					}

				} );
	}
}
 
Example 10
Source File: OutputSection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void setAccessible(final Control control)
{
	if ( control instanceof Composite )
	{
		Composite parent = (Composite)control;
		if ( parent != null && parent.getTabList( ) != null )
		{
			Control[] children = parent.getTabList( );
			for ( int i = 0; i < children.length; i++ )
			{
				setAccessible( children[i] );
			}
		}
	}
	else
	{
		control.getAccessible( )
				.addAccessibleListener( new AccessibleAdapter( ) {

					public void getName( AccessibleEvent e )
					{
						if ( control instanceof Text && control.getParent( ) instanceof ExpressionComposite )
						{
							e.result = UIUtil.stripMnemonic(Messages.getString( "VisibilityPage.Label.Expression" )) + ((Text)control).getText( ); //$NON-NLS-1$
						}
					}
				} );
	}
}