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

The following examples show how to use org.eclipse.swt.SWT#RIGHT . 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
private FormData definePosition(int style) {
	checkStyle(style);
	FormData formDataUpperLayer = new FormData();
	if (style == SWT.BOTTOM) {
		formDataUpperLayer.bottom = new FormAttachment(100, 0);
		formDataUpperLayer.left = new FormAttachment(0, 0);
		formDataUpperLayer.right = new FormAttachment(100, 0);
	} else if (style == SWT.TOP) {
		formDataUpperLayer.top = new FormAttachment(0, 0);
		formDataUpperLayer.left = new FormAttachment(0, 0);
		formDataUpperLayer.right = new FormAttachment(100, 0);
	} else if (style == SWT.RIGHT) {
		formDataUpperLayer.top = new FormAttachment(0, 0);
		formDataUpperLayer.right = new FormAttachment(100, 0);
	} else if (style == SWT.LEFT) {
		formDataUpperLayer.top = new FormAttachment(0, 0);
		formDataUpperLayer.left = new FormAttachment(0, 0);
		formDataUpperLayer.right = new FormAttachment(100, 0);
	}

	return formDataUpperLayer;
}
 
Example 2
Source Project: offspring   File: BlockTable.java    License: MIT License 5 votes vote down vote up
public static int getColumnAlignment(int id) {
  switch (id) {
  case COLUMN_HEIGHT:
  case COLUMN_NUMBER_OF_TRANSACTIONS:
  case COLUMN_TOTAL_AMOUNT:
  case COLUMN_TOTAL_FEE:
  case COLUMN_PAYLOAD_LENGTH:
  case COLUMN_VERSION:
  case COLUMN_BASETARGET:
    return SWT.RIGHT;
  }
  return SWT.LEFT;
}
 
Example 3
public static Label createLeftLabel(final Composite parent, final String title, final boolean isSubParameter) {
	final Label label = new Label(parent, SWT.WRAP | SWT.RIGHT);
	label.setBackground(parent.getBackground());
	final GridData d = new GridData(SWT.END, SWT.CENTER, true, true);
	d.minimumWidth = 70;
	if (isSubParameter) {
		d.horizontalIndent = 30;
	}
	label.setLayoutData(d);
	label.setFont(GamaFonts.getLabelfont());
	label.setText(title);
	return label;
}
 
Example 4
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory,
    ExtensibleGridPropertySection extensibleGridPropertySection) {
combo = new Combo(composite, SWT.NONE);
combo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

controlDecoration = new ControlDecoration(combo, SWT.RIGHT | SWT.TOP);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
	.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
controlDecoration.setImage(fieldDecoration.getImage());
controlDecoration.setDescriptionText(Messages.mustBeSet);
controlDecoration.hide();
hint = new ControlDecoration(combo, SWT.LEFT | SWT.TOP);
hint.setImage(Pics.getImage(PicsConstants.hint));
   }
 
Example 5
@Override
protected void fillCoolBar ( final ICoolBarManager coolBar )
{
    final IToolBarManager toolbar = new ToolBarManager ( SWT.FLAT | SWT.RIGHT );
    coolBar.add ( new ToolBarContributionItem ( toolbar, "main" ) );
    toolbar.add ( getAction ( ActionFactory.NEW_WIZARD_DROP_DOWN.getId () ) );
    coolBar.add ( new GroupMarker ( IWorkbenchActionConstants.MB_ADDITIONS ) );
}
 
Example 6
/**
 * Create plus button
 *
 * @param buttonStyle button style
 */
private void createPlusButton(final int buttonStyle) {
	rightButton = new Button(this, buttonStyle | SWT.RIGHT);
	rightButton.setFont(getFont());
	rightButton.setBackground(getBackground());
	rightButton.setCursor(getCursor());
	rightButton.setEnabled(getEnabled());
	rightButton.setFont(getFont());
	rightButton.setForeground(getForeground());
	rightButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
}
 
Example 7
Source Project: nebula   File: RadioGroup.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private int computeButtonStyle(int itemStyle) {
	int buttonStyle = SWT.RADIO | this.buttonStyle;

	final int itemStyleMask = SWT.LEFT | SWT.CENTER | SWT.RIGHT;
	if ((itemStyle & itemStyleMask) != 0) {
		buttonStyle &= ~itemStyleMask;
		buttonStyle |= itemStyle;
	}

	return buttonStyle;
}
 
Example 8
Source Project: nebula   File: VControlPainter.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private static double getX(VControl control, double width) {
	double x;

	if(control.xAlign == SWT.LEFT) {
		x = control.marginLeft;
	} else if(control.xAlign == SWT.RIGHT) {
		x = control.bounds.width - width - control.marginRight;
	} else { // CENTERED / Default
		x = ((control.bounds.width - width) / 2.0);
	}

	x += control.bounds.x;

	return x;
}
 
Example 9
Source Project: birt   File: AreaFigure.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Draws line with specified line style.
 * 
 * @param graphics
 * @param rect
 *            the rectangle to draw
 * @param position
 *            the
 * @param lineStyle
 *            the line style to use
 */
private void drawLine( Graphics graphics, Rectangle rect, int position,
		int lineStyle )
{
	graphics.setLineStyle( lineStyle );
	switch ( position )
	{
		case SWT.LEFT :
			graphics.drawLine( rect.x, rect.y, rect.x, rect.bottom( ) );
			break;
		case SWT.TOP :
			graphics.drawLine( rect.x, rect.y, rect.right( ), rect.y );
			break;
		case SWT.RIGHT :
			graphics.drawLine( rect.right( ),
					rect.y,
					rect.right( ),
					rect.bottom( ) );
			break;
		case SWT.BOTTOM :
			graphics.drawLine( rect.x,
					rect.bottom( ),
					rect.right( ),
					rect.bottom( ) );
			break;
	}
}
 
Example 10
public void createControl( Composite parent ) {
  int margin = Const.MARGIN;
  int middle = props.getMiddlePct();

  // create the composite to hold the widgets
  Composite composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );

  FormLayout compLayout = new FormLayout();
  compLayout.marginHeight = Const.FORM_MARGIN;
  compLayout.marginWidth = Const.FORM_MARGIN;
  composite.setLayout( compLayout );

  wlTNS = new Label( composite, SWT.RIGHT );
  wlTNS.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPageOCI.TNS.Label" ) );
  props.setLook( wlTNS );
  fdlTNS = new FormData();
  fdlTNS.left = new FormAttachment( 0, 0 );
  fdlTNS.right = new FormAttachment( middle, 0 );
  wlTNS.setLayoutData( fdlTNS );
  wTNS = new Text( composite, SWT.SINGLE | SWT.BORDER );
  props.setLook( wTNS );
  fdTNS = new FormData();
  fdTNS.left = new FormAttachment( middle, margin );
  fdTNS.right = new FormAttachment( 100, 0 );
  wTNS.setLayoutData( fdTNS );
  wTNS.addModifyListener( new ModifyListener() {
    public void modifyText( ModifyEvent arg0 ) {
      setPageComplete( false );
    }
  } );

  // set the composite as the control for this page
  setControl( composite );
}
 
Example 11
@Override
public Control getControl(final Point xy) {
    if (xy.x == 1) {
        return new Text(tableTable, SWT.BORDER | SWT.RIGHT);
    }

    return null;
}
 
Example 12
private void addProxyTab() {
  // ////////////////////////
  // START OF POOL TAB///
  // /
  wProxyTab = new CTabItem( wTabFolder, SWT.NONE );
  wProxyTab.setText( BaseMessages.getString( PKG, "SlaveServerDialog.USER_TAB_PROXY" ) );

  FormLayout poolLayout = new FormLayout();
  poolLayout.marginWidth = Const.FORM_MARGIN;
  poolLayout.marginHeight = Const.FORM_MARGIN;

  wProxyComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wProxyComp );
  wProxyComp.setLayout( poolLayout );

  // What's the data tablespace name?
  Label wlProxyHost = new Label( wProxyComp, SWT.RIGHT );
  props.setLook( wlProxyHost );
  wlProxyHost.setText( BaseMessages.getString( PKG, "SlaveServerDialog.ProxyServerName.Label" ) );
  FormData fdlProxyHost = new FormData();
  fdlProxyHost.top = new FormAttachment( 0, 0 );
  fdlProxyHost.left = new FormAttachment( 0, 0 ); // First one in the left top corner
  fdlProxyHost.right = new FormAttachment( middle, -margin );
  wlProxyHost.setLayoutData( fdlProxyHost );

  wProxyHost = new TextVar( slaveServer, wProxyComp, SWT.BORDER | SWT.LEFT | SWT.SINGLE );
  props.setLook( wProxyHost );
  wProxyHost.addModifyListener( lsMod );
  FormData fdProxyHost = new FormData();
  fdProxyHost.top = new FormAttachment( 0, 0 );
  fdProxyHost.left = new FormAttachment( middle, 0 ); // To the right of the label
  fdProxyHost.right = new FormAttachment( 95, 0 );
  wProxyHost.setLayoutData( fdProxyHost );

  // What's the initial pool size
  Label wlProxyPort = new Label( wProxyComp, SWT.RIGHT );
  props.setLook( wlProxyPort );
  wlProxyPort.setText( BaseMessages.getString( PKG, "SlaveServerDialog.ProxyServerPort.Label" ) );
  FormData fdlProxyPort = new FormData();
  fdlProxyPort.top = new FormAttachment( wProxyHost, margin );
  fdlProxyPort.left = new FormAttachment( 0, 0 ); // First one in the left top corner
  fdlProxyPort.right = new FormAttachment( middle, -margin );
  wlProxyPort.setLayoutData( fdlProxyPort );

  wProxyPort = new TextVar( slaveServer, wProxyComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wProxyPort );
  wProxyPort.addModifyListener( lsMod );
  FormData fdProxyPort = new FormData();
  fdProxyPort.top = new FormAttachment( wProxyHost, margin );
  fdProxyPort.left = new FormAttachment( middle, 0 ); // To the right of the label
  fdProxyPort.right = new FormAttachment( 95, 0 );
  wProxyPort.setLayoutData( fdProxyPort );

  // What's the maximum pool size
  Label wlNonProxyHosts = new Label( wProxyComp, SWT.RIGHT );
  props.setLook( wlNonProxyHosts );
  wlNonProxyHosts.setText( BaseMessages.getString( PKG, "SlaveServerDialog.IgnoreProxyForHosts.Label" ) );
  FormData fdlNonProxyHosts = new FormData();
  fdlNonProxyHosts.top = new FormAttachment( wProxyPort, margin );
  fdlNonProxyHosts.left = new FormAttachment( 0, 0 ); // First one in the left top corner
  fdlNonProxyHosts.right = new FormAttachment( middle, -margin );
  wlNonProxyHosts.setLayoutData( fdlNonProxyHosts );

  wNonProxyHosts = new TextVar( slaveServer, wProxyComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wNonProxyHosts );
  wNonProxyHosts.addModifyListener( lsMod );
  FormData fdNonProxyHosts = new FormData();
  fdNonProxyHosts.top = new FormAttachment( wProxyPort, margin );
  fdNonProxyHosts.left = new FormAttachment( middle, 0 ); // To the right of the label
  fdNonProxyHosts.right = new FormAttachment( 95, 0 );
  wNonProxyHosts.setLayoutData( fdNonProxyHosts );

  fdProxyComp = new FormData();
  fdProxyComp.left = new FormAttachment( 0, 0 );
  fdProxyComp.top = new FormAttachment( 0, 0 );
  fdProxyComp.right = new FormAttachment( 100, 0 );
  fdProxyComp.bottom = new FormAttachment( 100, 0 );
  wProxyComp.setLayoutData( fdProxyComp );

  wProxyComp.layout();
  wProxyTab.setControl( wProxyComp );
}
 
Example 13
public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, (CiviOutputMeta) input);

    lsMod = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            ((CiviOutputMeta) input).setChanged();
        }
    };
    backupChanged = ((CiviOutputMeta) input).hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "CiviCrmDialog.Shell.Output.Title"));

    middle = props.getMiddlePct();
    margin = Const.MARGIN;

    /*************************************************
     * STEP NAME ENTRY
     *************************************************/

    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);

    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);

    addOkCancelButtons();
    addConnectionTab();
    addEntityGroup();
    addOutputTab();

    // wGetInputFields.addListener(SWT.Selection, lsGetInputFields);
    /*************************************************
     * // DEFAULT ACTION LISTENERS
     *************************************************/

    lsDef = new SelectionAdapter() {
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });

    // Set the shell size, based upon previous time...
    setSize();

    /*************************************************
     * // POPULATE AND OPEN DIALOG
     *************************************************/

    getData();
    ((CiviOutputMeta) input).setChanged(backupChanged);

    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    return stepname;
}
 
Example 14
private void addResultRowsTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultRowsTarget );
    wlResultRowsTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.OutputRowsSource.Label" ) );
    FormData fdlResultRowsTarget = new FormData();
    fdlResultRowsTarget.top = new FormAttachment( 0, 0 );
    fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultRowsTarget.setLayoutData( fdlResultRowsTarget );

    wOutputRowsSource = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wOutputRowsSource );
    wOutputRowsSource.addModifyListener( lsMod );
    FormData fdResultRowsTarget = new FormData();
    fdResultRowsTarget.width = 250;
    fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 );
    fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right
    wOutputRowsSource.setLayoutData( fdResultRowsTarget );

    wlOutputFields = new Label( wInputComposite, SWT.NONE );
    wlOutputFields.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFields.Label" ) );
    props.setLook( wlOutputFields );
    FormData fdlResultFields = new FormData();
    fdlResultFields.left = new FormAttachment( 0, 0 );
    fdlResultFields.top = new FormAttachment( wOutputRowsSource, 10 );
    wlOutputFields.setLayoutData( fdlResultFields );

    int nrRows = ( transExecutorMeta.getOutputRowsField() != null ? transExecutorMeta.getOutputRowsField().length : 1 );

    ColumnInfo[] ciResultFields =
      new ColumnInfo[] {
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Field" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Type" ),
          ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Length" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Precision" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ), };

    wOutputFields =
      new TableView( transMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
        | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false );

    FormData fdResultFields = new FormData();
    fdResultFields.left = new FormAttachment( 0, 0 );
    fdResultFields.top = new FormAttachment( wlOutputFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wOutputFields.setLayoutData( fdResultFields );
    wOutputFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 15
Source Project: birt   File: JointDataSetPage.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * create bottom composite for page
 * 
 * @param parent
 */
private void createBottomComposite( Composite parent )
{
	// initialize the dialog layout
	parent.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 2;
	parent.setLayout( layout );

	nameLabel = new Label( parent, SWT.RIGHT );
	nameLabel.setText( Messages.getString( "dataset.wizard.label.datasetName" ) );//$NON-NLS-1$
	nameEditor = new Text( parent, SWT.BORDER );
	String name = ReportPlugin.getDefault( )
			.getCustomName( ReportDesignConstants.DATA_SET_ELEMENT );
	if ( name != null )
	{
		nameEditor.setText( Utility.getUniqueDataSetName( name ) );
	}
	else
	// can't get defaut name
	{
		nameEditor.setText( Utility.getUniqueDataSetName( Messages.getString( "dataset.new.defaultName" ) ) );//$NON-NLS-1$			
	}

	nameEditor.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	nameEditor.setToolTipText( Messages.getString( "DataSetBasePage.tooltip" ) ); //$NON-NLS-1$
	nameEditor.addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent e )
		{
			if ( StringUtil.isBlank( nameEditor.getText( ).trim( ) ) )
			{
				setPageMessage( EMPTY_NAME, ERROR );
				setPageComplete( false );
			}
			else if ( isDuplicateName( ) )
			{// name is duplicated
				setPageMessage( DUPLICATE_NAME, ERROR );
				setPageComplete( false );
			}
			else if ( containInvalidCharactor( nameEditor.getText( ) ) )
			{// name contains invalid ".", "/", "\", "!", ";", "," charactor
				String msg = Messages.getFormattedString( "error.invalidName", //$NON-NLS-1$
						new Object[]{
							nameEditor.getText( )
						} );
				setMessage( msg, ERROR );
				setPageComplete( false );
			}
			else
			{// everything is OK
				setPageComplete( canPageComplete( ) );
				setPageMessage( CREATE_PROMPT, NONE );
			}
		}
	} );

}
 
Example 16
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public AxisPageBubble(Composite parent, int style) {
	super(parent, style);
	setLayout(new FillLayout(SWT.VERTICAL));
	
	
	Group xAxisGroup = new Group(this, SWT.NONE);
	xAxisGroup.setText("X -Axis");
	xAxisGroup.setLayout(new GridLayout(2, false));
	
	Label lblTitle = new Label(xAxisGroup, SWT.NONE);
	GridData gd_lblTitle = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
	gd_lblTitle.widthHint = 150;
	lblTitle.setLayoutData(gd_lblTitle);
	lblTitle.setText("Title");
	
	xTitle = new Text(xAxisGroup, SWT.BORDER);
	xTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	Label lblTitleSize = new Label(xAxisGroup, SWT.NONE);
	lblTitleSize.setText("Title Size");
	
	comboTitleSizeX = new Combo(xAxisGroup, SWT.READ_ONLY);
	comboTitleSizeX.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboTitleSizeX.add("12");
	comboTitleSizeX.add("14");
	comboTitleSizeX.add("16");
	comboTitleSizeX.add("18");
	comboTitleSizeX.add("20");
	comboTitleSizeX.add("22");
	comboTitleSizeX.add("24");
	comboTitleSizeX.add("26");
	comboTitleSizeX.add("28");
	comboTitleSizeX.add("36");
	comboTitleSizeX.add("48");
	comboTitleSizeX.add("72");
	comboTitleSizeX.select(0);
	
	Label lblRotation = new Label(xAxisGroup, SWT.NONE);
	lblRotation.setText("Rotation");
	
	Composite composite = new Composite(xAxisGroup, SWT.NONE);
	composite.setLayout(new GridLayout(6, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
	
	btnAutoX = new Button(composite, SWT.RADIO);
	btnAutoX.setText("Auto");
	
	button0 = new Button(composite, SWT.RADIO);
	button0.setText("0\u00B0");
	
	button30 = new Button(composite, SWT.RADIO);
	button30.setText("30\u00B0");
	
	button45 = new Button(composite, SWT.RADIO);
	button45.setText("45\u00B0");
	
	button60 = new Button(composite, SWT.RADIO);
	button60.setText("60\u00B0");
	
	button90 = new Button(composite, SWT.RADIO);
	button90.setText("90\u00B0");
	
	Group yAxisGroup = new Group(this, SWT.NONE);
	yAxisGroup.setText("Y - Axis");
	yAxisGroup.setLayout(new GridLayout(2, false));
	
	Label lblTitle_1 = new Label(yAxisGroup, SWT.NONE);
	GridData gd_lblTitle_1 = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
	gd_lblTitle_1.widthHint = 150;
	lblTitle_1.setLayoutData(gd_lblTitle_1);
	lblTitle_1.setText("Title");
	
	yTitle = new Text(yAxisGroup, SWT.BORDER);
	yTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	Label lblTitleSize_1 = new Label(yAxisGroup, SWT.NONE);
	lblTitleSize_1.setText("Title Size");
	
	comboTitleSizeY = new Combo(yAxisGroup, SWT.READ_ONLY);
	comboTitleSizeY.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboTitleSizeY.add("12");
	comboTitleSizeY.add("14");
	comboTitleSizeY.add("16");
	comboTitleSizeY.add("18");
	comboTitleSizeY.add("20");
	comboTitleSizeY.add("22");
	comboTitleSizeY.add("24");
	comboTitleSizeY.add("26");
	comboTitleSizeY.add("28");
	comboTitleSizeY.add("36");
	comboTitleSizeY.add("48");
	comboTitleSizeY.add("72");
	comboTitleSizeY.select(0);
	
	loadSettings();
}
 
Example 17
public Composite createRadioGroupControl(final Composite composite, final RadioGroup object) {
    final Input input = getConnectorInput(object.getInputName());
    final ConnectorParameter parameter = connectorConfigurationSupport.getConnectorParameter(object.getInputName(),
            object, input);

    if (parameter != null) {
        Label label = null;
        if (object.getOrientation() == Orientation.HORIZONTAL) {
            label = createFieldLabel(composite, SWT.CENTER, object.getId(), input.isMandatory());
        } else {
            label = createFieldLabel(composite, SWT.TOP, object.getId(), input.isMandatory());
        }
        final String desc = messageProvider.getFieldDescription(definition, object.getId());
        if (desc != null && !desc.isEmpty()) {
            final ControlDecoration controlDecoration = new ControlDecoration(label, SWT.RIGHT);
            controlDecoration.setDescriptionText(desc);
            controlDecoration.setImage(Pics.getImage(PicsConstants.hint));
            controlDecoration.setMarginWidth(1);
        }

        final Composite radioCompoiste = new Composite(composite, SWT.NONE);
        radioCompoiste.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(16, 0).create());
        if (object.getOrientation() == Orientation.HORIZONTAL) {
            radioCompoiste.setLayout(GridLayoutFactory.fillDefaults().numColumns(object.getChoices().size()).create());
        } else {
            radioCompoiste.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
        }
        String defaultSelection = input.getDefaultValue();

        ((Expression) parameter.getExpression()).setType(ExpressionConstants.CONSTANT_TYPE);
        ((Expression) parameter.getExpression()).setReturnType(input.getType());
        final String content = ((Expression) parameter.getExpression()).getContent();
        if (defaultSelection == null) {
            defaultSelection = object.getChoices().get(0);
        }
        for (final String choice : object.getChoices()) {
            final Button radioButton = new Button(radioCompoiste, SWT.RADIO);
            radioButton.setText(choice);
            radioButton.setLayoutData(GridDataFactory.fillDefaults().create());
            radioButton.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    if (radioButton.getSelection()) {
                        ((Expression) parameter.getExpression()).setContent(choice);
                        ((Expression) parameter.getExpression()).setName(choice);
                    }
                }
            });
            radioButton.setSelection(false);
            if (content == null && defaultSelection != null && defaultSelection.equals(choice)) {
                radioButton.setSelection(true);
            } else if (content != null && content.equals(choice)) {
                radioButton.setSelection(true);
            }

        }

        return radioCompoiste;
    }
    return null;

}
 
Example 18
/**
 * {@inheritDoc}
 *
 * @see org.pentaho.di.trans.step.StepDialogInterface#open()
 */
public String open() {
  shell = new Shell( getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX );
  props.setLook( shell );

  setShellImage( shell, (StepMetaInterface) input );

  changed = input.hasChanged();

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = Const.FORM_MARGIN;
  formLayout.marginHeight = Const.FORM_MARGIN;

  shell.setLayout( formLayout );
  shell.setText( BaseMessages.getString( PKG, "InfobrightLoaderDialog.Shell.Title" ) );

  middle = props.getMiddlePct();

  int margin = Const.MARGIN;

  /************************************** Step name line ***************************/
  // label
  wlStepname = new Label( shell, SWT.RIGHT );
  wlStepname.setText( BaseMessages.getString( PKG, "InfobrightLoaderDialog.Stepname.Label" ) );
  wlStepname.setLayoutData( standardLabelSpacing( null ) );
  props.setLook( wlStepname );

  // text entry
  wStepname = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  wStepname.setText( stepname );
  wStepname.addModifyListener( lsMod );
  wStepname.setLayoutData( standardInputSpacing( null ) );
  props.setLook( wStepname );

  Control lastControl = addDbConnectionInputs();
  lastControl = addCustomInputs( lastControl );

  addVerticalPadding( 2 * margin );

  /********************************** OK and Cancel buttons **************************/
  addDefaultButtons( margin, lastControl );

  getData();
  input.setChanged( changed );

  shell.open();
  while ( !shell.isDisposed() ) {
    Display display = getParent().getDisplay();

    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return stepname;
}
 
Example 19
Source Project: birt   File: CGridData.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Returns a string containing a concise, human-readable
 * description of the receiver.
 *
 * @return a string representation of the GridData object
 */
public String toString () {
	String hAlign = "";
	switch (horizontalAlignment) {
		case SWT.FILL: hAlign = "SWT.FILL"; break;
		case SWT.BEGINNING: hAlign = "SWT.BEGINNING"; break;
		case SWT.LEFT: hAlign = "SWT.LEFT"; break;
		case SWT.END: hAlign = "SWT.END"; break;
		case END: hAlign = "GridData.END"; break;
		case SWT.RIGHT: hAlign = "SWT.RIGHT"; break;
		case SWT.CENTER: hAlign = "SWT.CENTER"; break;
		case CENTER: hAlign = "GridData.CENTER"; break;
		default: hAlign = "Undefined "+horizontalAlignment; break;
	}
	String vAlign = "";
	switch (verticalAlignment) {
		case SWT.FILL: vAlign = "SWT.FILL"; break;
		case SWT.BEGINNING: vAlign = "SWT.BEGINNING"; break;
		case SWT.TOP: vAlign = "SWT.TOP"; break;
		case SWT.END: vAlign = "SWT.END"; break;
		case END: vAlign = "GridData.END"; break;
		case SWT.BOTTOM: vAlign = "SWT.BOTTOM"; break;
		case SWT.CENTER: vAlign = "SWT.CENTER"; break;
		case CENTER: vAlign = "GridData.CENTER"; break;
		default: vAlign = "Undefined "+verticalAlignment; break;
	}
 	String string = getName()+" {";
 	string += "horizontalAlignment="+hAlign+" ";
 	if (horizontalIndent != 0) string += "horizontalIndent="+horizontalIndent+" ";
 	if (horizontalSpan != 1) string += "horizontalSpan="+horizontalSpan+" ";
 	if (grabExcessHorizontalSpace) string += "grabExcessHorizontalSpace="+grabExcessHorizontalSpace+" ";
 	if (widthHint != SWT.DEFAULT) string += "widthHint="+widthHint+" ";
 	if (minimumWidth != 0) string += "minimumWidth="+minimumWidth+" ";
 	string += "verticalAlignment="+vAlign+" ";
 	if (verticalIndent != 0) string += "verticalIndent="+verticalIndent+" ";
	if (verticalSpan != 1) string += "verticalSpan="+verticalSpan+" ";
 	if (grabExcessVerticalSpace) string += "grabExcessVerticalSpace="+grabExcessVerticalSpace+" ";
 	if (heightHint != SWT.DEFAULT) string += "heightHint="+heightHint+" ";
 	if (minimumHeight != 0) string += "minimumHeight="+minimumHeight+" ";
 	if (exclude) string += "exclude="+exclude+" ";
 	string = string.trim();
 	string += "}";
	return string;
}
 
Example 20
Source Project: birt   File: ImageLabel.java    License: Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Set the alignment of the CLabel. Use the values LEFT, CENTER and RIGHT to
 * align image and text within the available space.
 * 
 * @param align
 *            the alignment style of LEFT, RIGHT or CENTER
 * 
 * @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>
 *                <li>ERROR_INVALID_ARGUMENT - if the value of align is not
 *                one of SWT.LEFT, SWT.RIGHT or SWT.CENTER</li>
 *                </ul>
 */
public void setAlignment( int align )
{
	checkWidget( );
	if ( align != SWT.LEFT && align != SWT.RIGHT && align != SWT.CENTER )
	{
		SWT.error( SWT.ERROR_INVALID_ARGUMENT );
	}
	if ( this.align != align )
	{
		this.align = align;
		redraw( );
	}
}