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

The following examples show how to use org.eclipse.swt.SWT#CENTER . 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: arx   File: StyleConfigurationSelection.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 
 *
 * @param configRegistry
 */
protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();

    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectedHeaderFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectedHeaderBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, font);
    
    switch (getConfig().getHorizontalAlignment()) {
        case SWT.LEFT:
            cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT);
            break;
        case SWT.RIGHT:
            cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT);
            break;
        case SWT.CENTER:
            cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER);
            break;
    }
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, selectedHeaderBorderStyle);

    configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_STYLE, 
            cellStyle, 
            DisplayMode.SELECT, 
            GridRegion.COLUMN_HEADER);
    configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_STYLE, 
            cellStyle, 
            DisplayMode.SELECT, 
            GridRegion.CORNER);
    configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_STYLE, 
            cellStyle, 
            DisplayMode.SELECT, 
            GridRegion.ROW_HEADER);
}
 
Example 2
protected Composite createJavaTypeSelection(final Composite parent) {
    final Composite client = new Composite(parent, SWT.NONE);
    client.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create());
    final Label classLabel = new Label(client, SWT.NONE);
    classLabel.setText(Messages.classLabel);
    classLabel.setLayoutData(new GridData(SWT.DEFAULT, SWT.CENTER, false, false));
    classText = new Text(client, SWT.BORDER);
    final GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    classText.setLayoutData(layoutData);
    classText.setEditable(false);
    final Button browseClassesButton = new Button(client, SWT.PUSH);
    browseClassesButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    browseClassesButton.setText(Messages.browseClasses);
    browseClassesButton.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(final Event event) {
            openClassSelectionDialog(classText);
            final Expression defaultValue = data.getDefaultValue();
            final String type = defaultValue.getType();
            String className = classText.getText();
            if (data.isMultiple()) {
                className = List.class.getName();
            }
            if (!defaultValue.isReturnTypeFixed()) {
                returnTypeObservable.setValue(null);
                returnTypeObservable.setValue(className);
            } else {
                final Object value = returnTypeObservable.getValue();
                returnTypeObservable.setValue(null);
                returnTypeObservable.setValue(value);
            }
            if (!type.equals(ExpressionConstants.QUERY_TYPE) && !type.equals(ExpressionConstants.SCRIPT_TYPE)) {
                defaultValue.setType(ExpressionConstants.SCRIPT_TYPE);
            }
        }
    });
    return client;
}
 
Example 3
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);

	Composite langCmp = new Composite(tparent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).hint(450, 100).applyTo(langCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(langCmp);

	isBreakBtn = new Button(langCmp, SWT.CHECK);
	isBreakBtn.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.isBreakBtn"));
	GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, SWT.DEFAULT)
			.applyTo(isBreakBtn);

	Label preLbl = new Label(langCmp, SWT.NONE);
	preLbl.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.preLbl"));

	GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);

	preBreakTxt = new Text(langCmp, SWT.BORDER);
	preBreakTxt.setLayoutData(textData);

	Label afterLbl = new Label(langCmp, SWT.NONE);
	afterLbl.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.afterLbl"));

	afterBreakTxt = new Text(langCmp, SWT.BORDER);
	afterBreakTxt.setLayoutData(textData);

	return tparent;
}
 
Example 4
Source Project: nebula   File: CustomizeManager.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public static int getSwtAlign(XViewerAlign align) {
   if (align == XViewerAlign.Center) {
      return SWT.CENTER;
   } else if (align == XViewerAlign.Right) {
      return SWT.RIGHT;
   }
   return SWT.LEFT;
}
 
Example 5
Source Project: hop   File: LabelText.java    License: Apache License 2.0 5 votes vote down vote up
public LabelText( Composite composite, int textStyle, String labelText, String toolTipText, int middle,
                  int margin ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  this.setLayout( formLayout );

  wText = new Text( this, textStyle );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( 100, 0 );
  wText.setLayoutData( fdText );
  wText.setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );
}
 
Example 6
public static Control create(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.DOUBLE_BUFFERED);
	final GridLayout layout = new GridLayout(1, false);
	layout.horizontalSpacing = 0;
	layout.verticalSpacing = 0;
	layout.marginHeight = 0;
	layout.marginWidth = marginWidth;
	composite.setLayout(layout);
	composite.setBackground(parent.getBackground());
	final GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
	data.widthHint = widthSize;
	data.minimumWidth = widthSize;
	final SimpleSlider slider =
			new SimpleSlider(composite, sliderColor.color(), sliderColor.color(), IGamaColors.BLUE.color());
	slider.setTooltipInterperter(TOOLTIP_PROVIDER);
	slider.setLayoutData(data);
	slider.setSize(widthSize, heightSize);
	slider.specifyHeight(heightSize); // fix the problem of wrong position
	// for the tooltip. Certainly not the best way but it does the trick
	slider.addPositionChangeListener(POSITION_LISTENER);
	slider.setPopupBackground(popupColor);
	slider.updateSlider(getInitialValue(), false);
	slider.setBackground(parent.getBackground());
	slider.addDisposeListener(e -> {
		sliders.remove(slider);
		// DEBUG.OUT("Slider " + slider + " is disposed");
	});
	sliders.add(slider);
	return composite;

}
 
Example 7
protected Composite createSubsection(Composite parent, String label) {
	Group group= new Group(parent, SWT.SHADOW_NONE);
	group.setText(label);
	GridData data= new GridData(SWT.FILL, SWT.CENTER, true, false);
	group.setLayoutData(data);
	GridLayout layout= new GridLayout();
	layout.numColumns= 3;
	group.setLayout(layout);

	return group;
}
 
Example 8
public EquivalentPage() {
	setTitle(Messages.getString("preference.EquivalentPage.title"));
	setPreferenceStore(Activator.getDefault().getPreferenceStore());
	preferenceStore = getPreferenceStore();

	spinnerdata = new GridData();
	spinnerdata.widthHint = 30;
	equiTxtData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
	equiTxtData.widthHint = 50;
	
	phLblData = new GridData(SWT.FILL, SWT.CENTER, true, false);
	
	addImage = Activator.getImageDescriptor("images/addSign.png").createImage();
	deleteimage = Activator.getImageDescriptor("images/deleteSign.png").createImage();
}
 
Example 9
public static Button newPushButton(Composite parent, String label) {
  Button button = new Button(parent, SWT.PUSH);
  button.setText(label);

  PixelConverter converter = new PixelConverter(button);
  int width = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);

  GridData buttonGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
  buttonGridData.widthHint =
      Math.max(width, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);

  button.setLayoutData(buttonGridData);
  return button;
}
 
Example 10
public UserManagementComposite(Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	anwenderGroup = new Group(this, SWT.None);
	anwenderGroup.setText("Anwender");
	mandantGroup = new Group(this, SWT.None);
	mandantGroup.setText("Mandant");
	lblUsername = new Label(anwenderGroup, SWT.None);
	lblUsername.setText("Benutzername");
	txtUSERNAME = new Text(anwenderGroup, SWT.BORDER);
	lblPassword = new Label(anwenderGroup, SWT.None);
	lblPassword.setText("Passwort");
	txtPASSWORD = new Text(anwenderGroup, SWT.BORDER);
	
	anwenderGroup.setLayout(new GridLayout(2, false));
	gdAnwenderGroup = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	anwenderGroup.setLayoutData(gdAnwenderGroup);
	mandantGroup.setLayout(new GridLayout(2, false));
	mandantGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	lblKuerzel = new Label(mandantGroup, SWT.NONE);
	GridData gd_lblKuerzel = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
	gd_lblKuerzel.widthHint = 80;
	lblKuerzel.setLayoutData(gd_lblKuerzel);
	lblKuerzel.setText("Kürzel");
	
	txtKUERZEL = new Text(mandantGroup, SWT.BORDER);
	txtKUERZEL.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	GridData gd_lblUsername = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
	gd_lblUsername.widthHint = 80;
	lblUsername.setLayoutData(gd_lblUsername);
	txtUSERNAME.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	GridData gd_lblPassword = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
	gd_lblPassword.widthHint = 80;
	lblPassword.setLayoutData(gd_lblPassword);
	txtPASSWORD.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	initDataBindings();
}
 
Example 11
Source Project: nebula   File: DateChooser.java    License: Eclipse Public License 2.0 4 votes vote down vote up
Cell(Composite parent, int idx) {
	label = new Label(parent, SWT.CENTER);
	index = idx;
	label.addListener(SWT.MouseDown, listener);
	label.setData(this);
}
 
Example 12
Source Project: arx   File: DialogAbout.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
    parent.setLayout(new GridLayout());

    // Text
    final Label label = new Label(parent, SWT.CENTER | SWT.NONE);
    label.setText(ABOUT);
    label.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    
    // Folder
    CTabFolder folder = new CTabFolder(parent, SWT.BORDER);
    folder.setSimple(false);
    folder.setLayoutData(SWTUtil.createFillGridData());
    
    // License
    CTabItem item1 = new CTabItem(folder, SWT.NULL);
    item1.setText("License"); //$NON-NLS-1$
    final Text license = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    license.setText(LICENSE);
    license.setEditable(false);
    license.setLayoutData(SWTUtil.createFillGridData());
    item1.setControl(license);
    
    // Contributors
    CTabItem item2 = new CTabItem(folder, SWT.NULL);
    item2.setText("Contributors"); //$NON-NLS-1$
    final Text contributors = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    contributors.setText(CONTRIBUTORS);
    contributors.setEditable(false);
    contributors.setLayoutData(SWTUtil.createFillGridData());
    item2.setControl(contributors);
    
    // Information
    CTabItem item3 = new CTabItem(folder, SWT.NULL);
    item3.setText("Links"); //$NON-NLS-1$
    Composite composite3 = new Composite(folder, SWT.BORDER);
    composite3.setBackground(license.getBackground());
    item3.setControl(composite3);
    composite3.setLayout(SWTUtil.createGridLayout(1, false));
    createLink(composite3, "Website: <a>arx.deidentifier.org</a>", "Website", "http://arx.deidentifier.org"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Manual: <a>arx.deidentifier.org/anonymization-tool</a>", "Manual", "http://arx.deidentifier.org/anonymization-tool/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "API: <a>arx.deidentifier.org/api</a>", "API", "http://arx.deidentifier.org/api"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Downloads: <a>arx.deidentifier.org/downloads</a>", "Downloads", "http://arx.deidentifier.org/downloads"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Github: <a>github.com/arx-deidentifier</a>", "Github", "https://github.com/arx-deidentifier"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return parent;
}
 
Example 13
Source Project: jbt   File: BTEditor.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * <code>initialValue</code> may be null.
 */
public VarParameterComposite(Composite parent, int style,
		jbt.tools.bteditor.model.ConceptualBTNode.Parameter parameter, String initialValue,
		boolean initialFromContext, boolean isConstant, String defaultVarText,  BTNode.VarParameter varNodeParameter) {
	
	super(parent, style);
	
	this.varNodeParameter = varNodeParameter;

	this.setLayout(new GridLayout(4, true));

	this.parameter = parameter;

	String tooltip = super.getTooltip(parameter);

	this.nameLabel = new Label(this, SWT.NONE);
	this.nameLabel.setText(this.parameter.getName() + " ("
			+ this.parameter.getType().getReadableType() + ")");
	this.nameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
	this.nameLabel.setToolTipText(tooltip);
	
	this.isConstant = new Button(this, SWT.CHECK);
	this.isConstant.setText("Constant");
	GridData data2 = new GridData(SWT.LEFT, SWT.CENTER, true, false);
	data2.widthHint = DEFAULT_TEXT_FIELD_WIDTH;
	this.isConstant.setLayoutData(data2);
	this.isConstant.setSelection(isConstant);
	this.isConstant.setToolTipText("If activated, the \"Constant\" field is enabled. That means that the parameter is a special key-value type");

	this.variableNameText = new Text(this, SWT.BORDER);
	this.variableNameText.setText(defaultVarText == null ? "" : defaultVarText);
	GridData data3 = new GridData(SWT.FILL, SWT.CENTER, true, false);
	data2.widthHint = DEFAULT_TEXT_FIELD_WIDTH;
	this.variableNameText.setLayoutData(data3);
	this.variableNameText.setToolTipText(tooltip);
	this.variableNameText.setEnabled(!isConstant);
	
	this.valueText = new Text(this, SWT.BORDER);
	this.valueText.setText(initialValue == null ? "" : initialValue);
	GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
	data.widthHint = DEFAULT_TEXT_FIELD_WIDTH;
	this.valueText.setLayoutData(data);
	this.valueText.setToolTipText(tooltip);
	
	Listener listener = new Listener() {
		 
	      public void handleEvent(Event event) {
	      
	    	  variableNameText.setEnabled(!VarParameterComposite.this.isConstant.getSelection());
	    	  setIsConstant(VarParameterComposite.this.isConstant.getSelection());
	      }
	};
	
	this.isConstant.addListener(SWT.Selection, listener);

	if (this.parameter.getContextable()) {
		this.fromContextButton = new Button(this, SWT.CHECK);
		this.fromContextButton.setText("From context");
		this.fromContextButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false));
		this.fromContextButton.setSelection(initialFromContext);
		this.fromContextButton
				.setToolTipText("If activated, the specified value represents the place, in the context, where the value of the variable will be retrieved from");

		if (this.parameter.getType() == ParameterType.OBJECT) {
			this.fromContextButton.setEnabled(false);
			this.fromContextButton.setSelection(true);
		}
	}
}
 
Example 14
protected void buildUI( )
{
	// sets the layout
	FormLayout layout = new FormLayout( );
	layout.marginHeight = WidgetUtil.SPACING;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	setLayout( layout );

	FormData data;

	Label title = new Label( this, SWT.NONE );
	title.setText( DATA_SET_LABEL );

	dataSetName = new Label( this, SWT.NONE );
	data = new FormData( );
	data.left = new FormAttachment( title, 0, SWT.RIGHT );
	data.top = new FormAttachment( title, 0, SWT.CENTER );
	data.right = new FormAttachment( 50 );
	dataSetName.setLayoutData( data );

	// create table and tableViewer
	TableArea tableArea = new TableArea( this, SWT.SINGLE
			| SWT.BORDER
			| SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.FULL_SELECTION, new IBaseTableAreaModifier( ) {

		public boolean editItem( Object element )
		{
			return doEdit( element );
		}

	} );
	table = tableArea.getTable( );
	for ( int i = 0; i < columnNames.length; i++ )
	{
		TableColumn column = new TableColumn( table, SWT.LEFT );
		column.setText( columnNames[i] );
		column.setWidth( 200 );
	}

	// layout table
	data = new FormData( );
	data.top = new FormAttachment( title, 0, SWT.BOTTOM );
	data.left = new FormAttachment( title, 0, SWT.LEFT );
	data.right = new FormAttachment( 100 );
	data.bottom = new FormAttachment( 100 );
	tableArea.setLayoutData( data );

	tableViewer = tableArea.getTableViewer( );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( columnNames );
	tableViewer.setContentProvider( new BindingContentProvider( ) );
	tableViewer.setLabelProvider( new BindingLabelProvider( ) );
}
 
Example 15
Source Project: hop   File: MetaSelectionLine.java    License: Apache License 2.0 4 votes vote down vote up
public MetaSelectionLine( IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, Composite parentComposite, int flags, String labelText, String toolTipText, boolean leftAlignedLabel ) {
  super( parentComposite, SWT.NONE );
  this.variables = variables;
  this.classLoader = managedClass.getClassLoader();
  this.metadataProvider = metadataProvider;
  this.managedClass = managedClass;
  this.parentComposite = parentComposite;
  this.props = PropsUi.getInstance();
  this.leftAlignedLabel = leftAlignedLabel;

  this.manager = new MetadataManager<>( variables, metadataProvider, managedClass );

  props.setLook( this );

  int middle = props.getMiddlePct();
  int margin = props.getMargin();

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  formLayout.marginTop = 0;
  formLayout.marginBottom = 0;

  this.setLayout( formLayout );

  int labelFlags;
  if (leftAlignedLabel) {
    labelFlags = SWT.NONE | SWT.SINGLE;
  } else {
    labelFlags = SWT.RIGHT | SWT.SINGLE;
  }
  wLabel = new Label( this, labelFlags );
  props.setLook( wLabel );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  if (!leftAlignedLabel) {
    fdLabel.right = new FormAttachment( middle, 0 );
  }
  fdLabel.top = new FormAttachment( 0, margin );
  wLabel.setLayoutData( fdLabel );
  wLabel.setText( labelText );
  wLabel.setToolTipText( toolTipText );

  wManage = new Button( this, SWT.PUSH );
  wManage.setText( BaseMessages.getString( PKG, "System.Button.Manage" ) );
  FormData fdManage = new FormData();
  fdManage.right = new FormAttachment( 100, 0 );
  fdManage.top = new FormAttachment( wLabel, 0, SWT.CENTER );
  wManage.setLayoutData( fdManage );
  wManage.addListener( SWT.Selection, e -> manageMetadata() );

  wNew = new Button( this, SWT.PUSH );
  wNew.setText( BaseMessages.getString( PKG, "System.Button.New" ) );
  FormData fdNew = new FormData();
  fdNew.right = new FormAttachment( wManage, -margin );
  fdNew.top = new FormAttachment( wLabel, 0, SWT.CENTER );
  wNew.setLayoutData( fdNew );
  wNew.addListener( SWT.Selection, e -> newMetadata() );

  wEdit = new Button( this, SWT.PUSH );
  wEdit.setText( BaseMessages.getString( PKG, "System.Button.Edit" ) );
  FormData fdEdit = new FormData();
  fdEdit.right = new FormAttachment( wNew, -margin );
  fdEdit.top = new FormAttachment( wLabel, 0, SWT.CENTER );
  wEdit.setLayoutData( fdEdit );
  wEdit.addListener( SWT.Selection, e -> editMetadata() );

  int textFlags = SWT.SINGLE | SWT.LEFT | SWT.BORDER;
  if ( flags != SWT.NONE ) {
    textFlags = flags;
  }
  wCombo = new ComboVar( this.variables, this, textFlags, toolTipText );
  FormData fdCombo = new FormData();
  if (leftAlignedLabel) {
    fdCombo.left = new FormAttachment( wLabel, margin, SWT.RIGHT );
  } else {
    fdCombo.left = new FormAttachment( middle, margin );
  }
  fdCombo.right = new FormAttachment( wEdit, -margin );
  fdCombo.top = new FormAttachment( wLabel, 0, SWT.CENTER );
  wCombo.setLayoutData( fdCombo );
  wCombo.getCComboWidget().setToolTipText( toolTipText );

  layout( true, true );
}
 
Example 16
Source Project: nebula   File: WeekHeader.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * This method initializes this
 * 
 */
private void initialize() {
	this.setSize(new org.eclipse.swt.graphics.Point(536, 54));
	GridData gridData6 = new GridData();
	gridData6.horizontalAlignment = GridData.FILL;
	gridData6.grabExcessHorizontalSpace = true;
	gridData6.verticalAlignment = GridData.CENTER;
	GridData gridData5 = new GridData();
	gridData5.horizontalAlignment = GridData.FILL;
	gridData5.grabExcessHorizontalSpace = true;
	gridData5.verticalAlignment = GridData.CENTER;
	GridData gridData4 = new GridData();
	gridData4.horizontalAlignment = GridData.FILL;
	gridData4.grabExcessHorizontalSpace = true;
	gridData4.verticalAlignment = GridData.CENTER;
	GridData gridData3 = new GridData();
	gridData3.horizontalAlignment = GridData.FILL;
	gridData3.grabExcessHorizontalSpace = true;
	gridData3.verticalAlignment = GridData.CENTER;
	GridData gridData2 = new GridData();
	gridData2.horizontalAlignment = GridData.FILL;
	gridData2.grabExcessHorizontalSpace = true;
	gridData2.verticalAlignment = GridData.CENTER;
	GridData gridData1 = new GridData();
	gridData1.horizontalAlignment = GridData.FILL;
	gridData1.grabExcessHorizontalSpace = true;
	gridData1.verticalAlignment = GridData.CENTER;
	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.verticalAlignment = GridData.CENTER;
	setLayout(new GridLayout(7, true));
	label = new Label(this, SWT.CENTER);
	label.setBounds(new org.eclipse.swt.graphics.Rectangle(23, 18, 53, 18));
	label.setLayoutData(gridData6);
	label.setText("Monday");
	label1 = new Label(this, SWT.CENTER);
	label1.setBounds(new org.eclipse.swt.graphics.Rectangle(98, 18, 79, 17));
	label1.setLayoutData(gridData5);
	label1.setText("Tuesday");
	label2 = new Label(this, SWT.CENTER);
	label2.setBounds(new org.eclipse.swt.graphics.Rectangle(187, 18, 47, 17));
	label2.setLayoutData(gridData4);
	label2.setText("Wednesday");
	label3 = new Label(this, SWT.CENTER);
	label3.setBounds(new org.eclipse.swt.graphics.Rectangle(256, 17, 67, 17));
	label3.setLayoutData(gridData3);
	label3.setText("Thursday");
	label4 = new Label(this, SWT.CENTER);
	label4.setBounds(new org.eclipse.swt.graphics.Rectangle(338, 17, 62, 20));
	label4.setLayoutData(gridData2);
	label4.setText("Friday");
	label5 = new Label(this, SWT.CENTER);
	label5.setBounds(new org.eclipse.swt.graphics.Rectangle(415, 16, 43, 21));
	label5.setLayoutData(gridData1);
	label5.setText("Saturday");
	label6 = new Label(this, SWT.CENTER);
	label6.setBounds(new org.eclipse.swt.graphics.Rectangle(469, 16, 61, 23));
	label6.setLayoutData(gridData);
	label6.setText("Sunday");

}
 
Example 17
Source Project: nebula   File: ChipsSnippet.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private static void createPushChipsArea() {
	final Label lbl = new Label(shell, SWT.CENTER);
	lbl.setText("Push chips");
	lbl.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	final Composite cmp = new Composite(shell, SWT.NONE);
	cmp.setLayoutData(new GridData(GridData.CENTER, GridData.FILL, false, false));
	cmp.setLayout(new GridLayout(4, false));
	cmp.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));

	final Color checkColor = SWTGraphicUtil.getColorSafely(227, 22, 91);

	final Chips chip1 = new Chips(cmp, SWT.PUSH);
	chip1.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip1.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip1.setChipsBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip1.setBorderColor(checkColor);
	chip1.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip1.setPushedStateBackground(checkColor);
	chip1.setImage(loadImage("icons/bubble1_b.png"));
	chip1.setPushImage(loadImage("icons/bubble1_w.png"));
	chip1.setText("One");

	final Chips chip2 = new Chips(cmp, SWT.PUSH);
	chip2.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip2.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip2.setChipsBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip2.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip2.setPushedStateBackground(checkColor);
	chip2.setImage(loadImage("icons/bubble2_b.png"));
	chip2.setPushImage(loadImage("icons/bubble2_w.png"));
	chip2.setBorderColor(checkColor);

	chip2.setText("Two");

	final Chips chip3 = new Chips(cmp, SWT.PUSH);
	chip3.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip3.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip3.setChipsBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip3.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip3.setPushedStateBackground(checkColor);
	chip3.setImage(loadImage("icons/bubble3_b.png"));
	chip3.setPushImage(loadImage("icons/bubble3_w.png"));
	chip3.setBorderColor(checkColor);
	chip3.setText("Three");

	final Chips chip4 = new Chips(cmp, SWT.PUSH);
	chip4.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip4.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip4.setChipsBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip4.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip4.setPushedStateBackground(checkColor);
	chip4.setImage(loadImage("icons/email_b.png"));
	chip4.setPushImage(loadImage("icons/email_w.png"));
	chip4.setBorderColor(checkColor);
	chip4.setText("Mail");

}
 
Example 18
/**
 * Create contents of the preference page.
 * 
 * @param parent
 */
@Override
public Control createContents(Composite parent){
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));
	
	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	composite.setLayout(new GridLayout(2, false));
	
	Label lblLabNoPathFlagMeansNonPath = new Label(composite, SWT.WRAP);
	lblLabNoPathFlagMeansNonPath
		.setText(Messages.HL7LabImportRulesPreferencePage_lblLabImportRulesHeader_text);
	
	ToolBarManager toolbarmgr = new ToolBarManager();
	toolbarmgr.add(new AddMissingPathFlagMeansNonPathLaboratoryAction());
	toolbarmgr.add(new RemoveMissingPathFlagMeansNonPathLaboratoryAction());
	ToolBar toolbar = toolbarmgr.createControl(composite);
	toolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
	new Label(composite, SWT.NONE);
	
	labMPathMNonPathListViewer = new ListViewer(composite, SWT.BORDER | SWT.V_SCROLL);
	labMPathMNonPathListViewer.setContentProvider(ArrayContentProvider.getInstance());
	labMPathMNonPathListViewer.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object element){
			if (element instanceof Kontakt) {
				return ((Kontakt) element).getLabel();
			}
			return super.getText(element);
		}
	});
	GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
	gridData.heightHint = 80;
	labMPathMNonPathListViewer.getList()
		.setLayoutData(gridData);

	labMPathMNonPathListViewer.setInput(findAllLabsWithPathFlagMissingMeansNonPathologic());
	
	return container;
}
 
Example 19
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	ret.setLayout(new GridLayout(2, false));
	
	Label lu = new Label(ret, SWT.NONE);
	lu.setText(Messages.LoginDialog_0);
	usr = new Text(ret, SWT.BORDER);
	usr.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.LoginDialog_1);
	pwd = new Text(ret, SWT.BORDER | SWT.PASSWORD);
	pwd.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	if (hasUsers == false) {
		usr.setText("Administrator"); //$NON-NLS-1$
		pwd.setText("admin"); //$NON-NLS-1$
	}
	
	if (elexisEnvironmentLoginContributor != null) {
		Button btnLoginElexisEnv = new Button(ret, SWT.NONE);
		GridData gd_btnLoginElexisEnv = new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1);
		btnLoginElexisEnv.setLayoutData(gd_btnLoginElexisEnv);
		btnLoginElexisEnv.setText("Elexis-Environment Login");
		btnLoginElexisEnv.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e){
				setReturnCode(302);
				close();
			}
		});
	}
	
	@SuppressWarnings("unchecked")
	List<ILoginNews> newsModules =
		Extensions.getClasses(ExtensionPointConstantsUi.LOGIN_NEWS, "class");
	
	if (newsModules.size() > 0) {
		Composite cNews = new Composite(ret, SWT.NONE);
		cNews.setLayoutData(SWTHelper.getFillGridData(2, true, 1, true));
		cNews.setLayout(new GridLayout());
		for (ILoginNews lm : newsModules) {
			try {
				Composite comp = lm.getComposite(cNews);
				comp.setLayoutData(SWTHelper.getFillGridData());
			} catch (Exception ex) {
				// Note: This is NOT a fatal error. It just means, that the Newsmodule could not
				// load. Maybe we are offline.
				ExHandler.handle(ex);
				
			}
		}
		
	}
	
	return ret;
}
 
Example 20
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}