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

The following examples show how to use org.eclipse.swt.SWT#HORIZONTAL . 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
@Override
protected BreadcrumbViewer createViewer(Composite composite) {
	fViewer= new ProblemBreadcrumbViewer(composite, SWT.HORIZONTAL);

	fViewer.setLabelProvider(createLabelProvider());
	fViewer.setToolTipLabelProvider(createToolTipLabelProvider());

	fViewer.setContentProvider(createContentProvider());
	fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			fBreadcrumbActionGroup.setContext(new ActionContext(fViewer.getSelection()));
		}
	});

	fBreadcrumbActionGroup= new JavaEditorBreadcrumbActionGroup(getJavaEditor(), fViewer);

	fElementChangeListener= new ElementChangeListener();
	JavaCore.addElementChangedListener(fElementChangeListener);

	JavaUIHelp.setHelp(fViewer, IJavaHelpContextIds.JAVA_EDITOR_BREADCRUMB);

	return fViewer;
}
 
Example 2
Source Project: scava   File: DetailsTabView.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public DetailsTabView() {
	super(SWT.NONE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);
	fillLayout.marginWidth = 5;
	fillLayout.marginHeight = 5;
	setLayout(fillLayout);
	
	scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
	scrolledComposite.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			ScrolledComposites.updateOnlyVerticalScrollableComposite(scrolledComposite);
		}
	});
	scrolledComposite.setAlwaysShowScrollBars(true);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
}
 
Example 3
Source Project: nebula   File: PreferenceWindow.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Builds the shell
 */
private void buildShell() {
	shell.setText(ResourceManager.getLabel(ResourceManager.PREFERENCES));
	final GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.marginWidth = gridLayout.marginHeight = 0;
	gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
	shell.setLayout(gridLayout);
	container = new PWTabContainer(shell, SWT.NONE, tabs);
	container.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
	container.build();

	final Label sep = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
	sep.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));

	buildButtons();

}
 
Example 4
Source Project: nebula   File: LinePrintTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void testEquals() {
	LinePrint line1 = new LinePrint(SWT.HORIZONTAL);
	LinePrint line2 = new LinePrint(SWT.HORIZONTAL);
	assertEquals(line1, line2);

	line1 = new LinePrint(SWT.VERTICAL);
	assertFalse(line1.equals(line2));
	line2 = new LinePrint(SWT.VERTICAL);
	assertEquals(line1, line2);

	line1.setRGB(new RGB(127, 127, 127));
	assertFalse(line1.equals(line2));
	line2.setRGB(new RGB(127, 127, 127));
	assertEquals(line1, line2);

	line1.setThickness(2.3);
	assertFalse(line1.equals(line2));
	line2.setThickness(2.3);
	assertEquals(line1, line2);
}
 
Example 5
Source Project: CppStyle   File: CppStylePropertyPage.java    License: MIT License 5 votes vote down vote up
private void createSepeerater(Composite parent) {
	Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
	GridData gridData = new GridData();
	gridData.horizontalAlignment = SWT.FILL;
	gridData.grabExcessHorizontalSpace = true;
	separator.setLayoutData(gridData);
}
 
Example 6
Source Project: nebula   File: RangeSlider.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
 */
@Override
public Point computeSize(final int wHint, final int hHint, final boolean changed) {
	final int width, height;
	checkWidget();
	if (orientation == SWT.HORIZONTAL) {
		if (wHint < 100) {
			width = 100;
		} else {
			width = wHint;
		}

		if (hHint < 30) {
			height = 30;
		} else {
			height = hHint;
		}
	} else {
		if (wHint < 30) {
			width = 30;
		} else {
			width = wHint;
		}

		if (hHint < 100) {
			height = 100;
		} else {
			height = hHint;
		}
	}

	return new Point(width, height);
}
 
Example 7
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.marginTop = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	Control treeControl = createTreeAreaContents(composite);
	createSash(composite, treeControl);

	Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
	GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);

	versep.setLayoutData(verGd);
	versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));

	Composite pageAreaComposite = new Composite(composite, SWT.NONE);
	pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout = new GridLayout(1, true);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	pageAreaComposite.setLayout(layout);

	// Build the Page container
	Composite pageContainer = createPageContainer(pageAreaComposite);
	GridData pageContainerData = new GridData(GridData.FILL_BOTH);
	pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
	pageContainer.setLayoutData(pageContainerData);
	// Build the separator line
	Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
	bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	return composite;
}
 
Example 8
Source Project: ADT_Frontend   File: AbapGitStagingView.java    License: MIT License 5 votes vote down vote up
private void createUnstagedSectionToolbar() {
	Composite unstagedToolbarComposite = this.toolkit.createComposite(this.unstagedSection);
	unstagedToolbarComposite.setBackground(null);
	RowLayoutFactory.fillDefaults().applyTo(unstagedToolbarComposite);
	this.unstagedSection.setTextClient(unstagedToolbarComposite);

	this.unstagedToolbarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
	this.unstagedToolbarManager.add(this.actionStage);
	this.unstagedToolbarManager.add(new Separator());
	this.actionCollapseAllUnstaged = new CollapseAllAction(true);
	this.unstagedToolbarManager.add(this.actionCollapseAllUnstaged);
	this.unstagedToolbarManager.update(true);
	this.unstagedToolbarManager.createControl(unstagedToolbarComposite);
}
 
Example 9
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.marginTop = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	Control treeControl = createTreeAreaContents(composite);
	createSash(composite, treeControl);

	Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
	GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);

	versep.setLayoutData(verGd);
	versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));

	Composite pageAreaComposite = new Composite(composite, SWT.NONE);
	pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout = new GridLayout(1, true);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	pageAreaComposite.setLayout(layout);

	// Build the Page container
	Composite pageContainer = createPageContainer(pageAreaComposite);
	GridData pageContainerData = new GridData(GridData.FILL_BOTH);
	pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
	pageContainer.setLayoutData(pageContainerData);
	// Build the separator line
	Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
	bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	return composite;
}
 
Example 10
/**
 * Creates the field editors. Field editors are abstractions of the common
 * GUI blocks needed to manipulate various types of preferences. Each field
 * editor knows how to save and restore itself.
 */
@Override
public void createFieldEditors() {

    createTitleBar(Messages.BonitaPreferenceDialog_Advanced, Pics.getImage(PicsConstants.preferenceAdvanced), false);

    askSaveDiagramAfterFirstSave = new BooleanFieldEditor(BonitaPreferenceConstants.ASK_RENAME_ON_FIRST_SAVE,
            Messages.askRenameDiagram,
            getFieldEditorParent());
    addField(askSaveDiagramAfterFirstSave);

    showConnectorEditionConfirmation = new BooleanFieldEditor(
            HIDE_CONNECTOR_DEFINITION_CHANGE_WARNING,
            Messages.doNotDisplayConnectorDefConfirmationMessage, getFieldEditorParent());
    addField(showConnectorEditionConfirmation);

    new Label(getFieldEditorParent(), SWT.NONE);
    new Label(getFieldEditorParent(), SWT.NONE);

    final Label separator = new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());

    new Label(getFieldEditorParent(), SWT.NONE);
    new Label(getFieldEditorParent(), SWT.NONE);

    createPreferenceEditorContributions(ADVANCED_CONTRIBUTOR_ID);
}
 
Example 11
Source Project: http4e   File: UrbanSashForm.java    License: Apache License 2.0 5 votes vote down vote up
public int getStyle(){
    int style = super.getStyle();
    style |= getOrientation() == SWT.VERTICAL ? SWT.VERTICAL
            : SWT.HORIZONTAL;
    if ((sashStyle & SWT.SMOOTH) != 0)
        style |= SWT.SMOOTH;
    return style;
}
 
Example 12
Source Project: saros   File: ColorChooser.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * The GUI component used for choosing colors in Preferences -> Saros -> Appearance
 *
 * @param parent
 * @param style
 */
public ColorChooser(Composite parent, int style) {
  super(parent, style);

  SarosPluginContext.initComponent(this);

  RowLayout layout = new RowLayout(SWT.HORIZONTAL);
  layout.center = true;
  layout.justify = true;
  layout.fill = true;

  setLayout(layout);

  for (int colorId = 0; colorId < SarosAnnotation.SIZE; colorId++) {
    ColorLabel label = createColorLabel(style, colorId);
    label.setPreferredSize(50, 50);
    colorLabels.add(label);
  }

  addDisposeListener(
      new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
          for (ColorLabel colorLabel : colorLabels) ((Color) colorLabel.getData()).dispose();
        }
      });
}
 
Example 13
protected void insertSeparator(int columns)
{
	TableItem item = new TableItem(fTable, SWT.NULL);
	for (int i = 0; i < columns; i++)
	{
		TableEditor editor = new TableEditor(fTable);
		Label label = new Label(fTable, SWT.SEPARATOR | SWT.HORIZONTAL);
		editor.grabHorizontal = true;
		editor.setEditor(label, item, i);
	}
	item.setData(IS_SEPARATOR, true);
}
 
Example 14
/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
	addField(createWorkingFolderFieldEditor());
	addField(createUserFieldEditor());
	addField(createRefreshIntervalFieldEditor());

	String[][] entryNamesAndValues = getLogLevels().stream()
			.map(level -> new String[] { level.getName(), level.getName() }).toArray(String[][]::new);
	ComboFieldEditor comboFieldEditorLogLevel = new ComboFieldEditor(LOG_LEVEL,
			Messages.WorkbenchPreferencePage_LogLevel, entryNamesAndValues, getFieldEditorParent());
	addField(comboFieldEditorLogLevel);

	addField(createWindowLocationFieldEditor());
	addField(createWindowSizeFieldEditor());

	String[][] entrySortColumnNamesAndValues = Arrays.stream(Column.sortedValues())
			.map(column -> new String[] { column.toString(), Integer.toString(column.ordinal()) })
			.toArray(size -> new String[size][]);
	ComboFieldEditor cfeSortColumn = new ComboFieldEditor(SORT_COLUMN,
			Messages.WorkbenchPreferencePage_SortedColumn, entrySortColumnNamesAndValues, getFieldEditorParent());
	addField(cfeSortColumn);

	String[][] entrySortDirectionNamesAndValues = new String[][] {
			{ Messages.WorkbenchPreferencePage_SortDirection_Up, String.valueOf(SWT.UP) },
			{ Messages.WorkbenchPreferencePage_SortDirection_Down, String.valueOf(SWT.DOWN) } };
	ComboFieldEditor cfeSortDirection = new ComboFieldEditor(SORT_DIRECTION,
			Messages.WorkbenchPreferencePage_SortDirection, entrySortDirectionNamesAndValues,
			getFieldEditorParent());
	addField(cfeSortDirection);

	final Label separator = new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL);
	GridDataFactory.fillDefaults().span(3, 1).applyTo(separator);

	addField(new CheckedStringFieldEditor(SFTP_USERNAME, //
			Messages.WorkbenchPreferencePage_SftpUsername, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpUsernameMustntBeEmpty));
	final CheckedStringFieldEditor sftpPassword = new CheckedStringFieldEditor(SFTP_PASSWORD,
			Messages.WorkbenchPreferencePage_SftpPassword, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpPasswordMustntBeEmpty);
	sftpPassword.getTextControl(getFieldEditorParent()).setEchoChar('*');
	addField(sftpPassword);
	addField(new CheckedStringFieldEditor(SFTP_HOST, //
			Messages.WorkbenchPreferencePage_SftpHost, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpHostMustntBeEmpty));
	addField(new CheckedStringFieldEditor(SFTP_MERGEFOLDER, //
			Messages.WorkbenchPreferencePage_SftpMergeFolder, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpMergeFolderMustntBeEmpty));

}
 
Example 15
public Control createControl( Composite parent )
{
	container = new Composite( parent, SWT.NONE );
	RowLayout layout = new RowLayout( SWT.HORIZONTAL );
	layout.marginBottom = 0;
	layout.marginHeight = 0;
	layout.marginLeft = 0;
	layout.marginRight = 0;
	layout.marginTop = 0;
	layout.marginWidth = 0;
	layout.spacing = 0;
	container.setLayout( layout );

	left = FormWidgetFactory.getInstance( ).createButton( container,
			SWT.TOGGLE,
			false );
	left.setToolTipText( Messages.getString( "TextAlignPropertyDescriptor.0" ) ); //$NON-NLS-1$
	center = FormWidgetFactory.getInstance( ).createButton( container,
			SWT.TOGGLE,
			false );
	center.setToolTipText( Messages.getString( "TextAlignPropertyDescriptor.1" ) ); //$NON-NLS-1$
	right = FormWidgetFactory.getInstance( ).createButton( container,
			SWT.TOGGLE,
			false );
	right.setToolTipText( Messages.getString( "TextAlignPropertyDescriptor.2" ) ); //$NON-NLS-1$
	justify = FormWidgetFactory.getInstance( ).createButton( container,
			SWT.TOGGLE,
			false );
	justify.setToolTipText( Messages.getString( "TextAlignPropertyDescriptor.3" ) ); //$NON-NLS-1$

	Button[] btns = {
			left, center, right, justify,
	};
	// The value is used to present active value and image key.
	String[] values = {
			DesignChoiceConstants.TEXT_ALIGN_LEFT,
			DesignChoiceConstants.TEXT_ALIGN_CENTER,
			DesignChoiceConstants.TEXT_ALIGN_RIGHT,
			DesignChoiceConstants.TEXT_ALIGN_JUSTIFY,
	};
	for ( int i = 0; i < btns.length; i++ )
	{
		btns[i].setData( values[i] );
		btns[i].addSelectionListener( listener );
		btns[i].getAccessible( ).addAccessibleListener(new AccessibleAdapter() {
			public void getName(AccessibleEvent e) {
					Accessible accessible = (Accessible) e.getSource();
					Button item = (Button) accessible.getControl();
					if (item != null) {
						e.result = item.getToolTipText();
					}
			}
		});
	}
	return container;
}
 
Example 16
Source Project: nebula   File: CDateTime.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private void createPickerToolbar(VPanel parent) {
	VPanel tb = new VPanel(parent, SWT.NONE);
	VGridLayout layout = new VGridLayout(3, false);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.horizontalSpacing = 2;
	tb.setLayout(layout);
	tb.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
	tb.setData(CDT.PickerPart, PickerPart.Toolbar);

	VButton b = new VButton(tb, SWT.OK | SWT.NO_FOCUS);
	b.setData(CDT.PickerPart, PickerPart.OkButton);
	b.setToolTipText(Resources.getString("accept.text", locale)); //$NON-NLS-1$
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> setOpen(false));
	b.setHoverBackgroundColor(buttonHoverBackgroundColor);
	b.setHoverBorderColor(buttonHoverBorderColor);
	b.setSelectedBackgroundColor(buttonSelectedBackgroundColor);
	b.setSelectedBorderColor(buttonSelectedBorderColor);

	b = new VButton(tb, SWT.CANCEL | SWT.NO_FOCUS);
	b.setData(CDT.PickerPart, PickerPart.CancelButton);
	b.setToolTipText(Resources.getString("cancel.text", locale)); //$NON-NLS-1$
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> {
		setSelection(cancelDate);
		fireSelectionChanged();
		setOpen(false);
	});
	b.setHoverBackgroundColor(buttonHoverBackgroundColor);
	b.setHoverBorderColor(buttonHoverBorderColor);
	b.setSelectedBackgroundColor(buttonSelectedBackgroundColor);
	b.setSelectedBorderColor(buttonSelectedBorderColor);

	b = new VButton(tb, SWT.NO_FOCUS);
	b.setData(CDT.PickerPart, PickerPart.ClearButton);
	b.setText(Resources.getString("clear.text", locale)); //$NON-NLS-1$
	b.setToolTipText(Resources.getString("clear.text", locale)); //$NON-NLS-1$
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> {
		setOpen(false);
		setSelection(null);
		fireSelectionChanged();
	});
	b.setForeground(parent.getForeground());
	b.setFont(parent.getFont());
	b.setHoverBackgroundColor(buttonHoverBackgroundColor);
	b.setHoverBorderColor(buttonHoverBorderColor);
	b.setSelectedBackgroundColor(buttonSelectedBackgroundColor);
	b.setSelectedBorderColor(buttonSelectedBorderColor);

	VLabel sep = new VLabel(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
	sep.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
}
 
Example 17
protected void buildContent( )
{

	TextPropertyDescriptorProvider nameProvider = new TextPropertyDescriptorProvider( ReportItemHandle.NAME_PROP,
			ReportDesignConstants.EXTENDED_ITEM );
	TextSection nameSection = new TextSection( nameProvider.getDisplayName( ),
			container,
			true );
	nameSection.setProvider( nameProvider );
	nameSection.setLayoutNum( 2 );
	nameSection.setWidth( 200 );
	addSection( CrosstabPageSectionId.CROSSTAB_NAME, nameSection );

	ElementIdDescriptorProvider elementIdProvider = new ElementIdDescriptorProvider( );
	TextSection elementIdSection = new TextSection( elementIdProvider.getDisplayName( ),
			container,
			true );
	elementIdSection.setProvider( elementIdProvider );
	elementIdSection.setWidth( 200 );
	elementIdSection.setLayoutNum( 4 );
	elementIdSection.setGridPlaceholder( 2, true );
	addSection( CrosstabPageSectionId.CROSSTAB_ELEMENT_ID, elementIdSection );

	Section seperatorSection = new SeperatorSection( container,
			SWT.HORIZONTAL );
	addSection( CrosstabPageSectionId.CROSSTAB_SEPERATOR_1,
			seperatorSection );

	layoutMeasuresProvider = new MeasureComboPropertyDescriptorProvider( ICrosstabReportItemConstants.MEASURE_DIRECTION_PROP,
			ICrosstabConstants.CROSSTAB_EXTENSION_NAME );
	layoutMeasureSection = new ComboSection( Messages.getString( "LayoutMeasuresSection.DisplayName" ), //$NON-NLS-1$
			container,
			true );
	layoutMeasureSection.setProvider( layoutMeasuresProvider );
	layoutMeasureSection.setWidth( 200 );
	layoutMeasureSection.setLayoutNum( 2 );
	addSection( CrosstabPageSectionId.LAYOUT_MEASURES, layoutMeasureSection );

	HideMeasureHeaderProvider hideMeasureProvider = new HideMeasureHeaderProvider( ICrosstabReportItemConstants.HIDE_MEASURE_HEADER_PROP,
			ReportDesignConstants.EXTENDED_ITEM );
	CheckSection hideMeasureSection = new CheckSection( container, true );
	hideMeasureSection.setProvider( hideMeasureProvider );
	hideMeasureSection.setLayoutNum( 4 );
	hideMeasureSection.setGridPlaceholder( 2, true );
	addSection( CrosstabPageSectionId.HIDE_MEASURE_HEADER,
			hideMeasureSection );

	SeperatorSection seperator1 = new SeperatorSection( container,
			SWT.HORIZONTAL );
	addSection( CrosstabPageSectionId.CROSSTAB_SEPERATOR_2, seperator1 );

	SimpleComboPropertyDescriptorProvider styleProvider = new SimpleComboPropertyDescriptorProvider( ReportItemHandle.STYLE_PROP,
			ReportDesignConstants.REPORT_ITEM );
	SimpleComboSection styleSection = new SimpleComboSection( styleProvider.getDisplayName( ),
			container,
			true );
	styleSection.setProvider( styleProvider );
	styleSection.setLayoutNum( 2 );
	styleSection.setWidth( 200 );
	addSection( CrosstabPageSectionId.CROSSTAB_STYLE, styleSection );

	ComboPropertyDescriptorProvider displayProvider = new ComboPropertyDescriptorProvider( IStyleModel.DISPLAY_PROP,
			ReportDesignConstants.STYLE_ELEMENT );
	ComboSection displaySection = new ComboSection( displayProvider.getDisplayName( ),
			container,
			true );
	displaySection.setProvider( displayProvider );
	displaySection.setLayoutNum( 4 );
	displaySection.setGridPlaceholder( 2, true );
	displaySection.setWidth( 200 );
	addSection( CrosstabPageSectionId.CROSSTAB_DISPLAY, displaySection );

}
 
Example 18
Source Project: birt   File: CellPage.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public void buildUI( Composite parent  )
{
	super.buildUI( parent );
	container.setLayout( WidgetUtil.createGridLayout( 6 ,15) );

	// Defines providers.

	IDescriptorProvider dropProvider = new ComboPropertyDescriptorProvider( CellHandle.DROP_PROP,
			ReportDesignConstants.CELL_ELEMENT );

	ColorPropertyDescriptorProvider backgroundProvider = new ColorPropertyDescriptorProvider( StyleHandle.BACKGROUND_COLOR_PROP,
			ReportDesignConstants.STYLE_ELEMENT );
	backgroundProvider.enableReset( true );

	ComboPropertyDescriptorProvider vAlignProvider = new ComboPropertyDescriptorProvider( StyleHandle.VERTICAL_ALIGN_PROP,
			ReportDesignConstants.STYLE_ELEMENT );
	vAlignProvider.enableReset( true );

	IDescriptorProvider styleProvider = new SimpleComboPropertyDescriptorProvider( ReportItemHandle.STYLE_PROP,
			ReportDesignConstants.CELL_ELEMENT );

	// Defines sections.

	ComboSection dropSection = new ComboSection( dropProvider.getDisplayName( ),
			container,
			true );

	ColorSection backgroundSection = new ColorSection( backgroundProvider.getDisplayName( ),
			container,
			true );

	ComboSection vAlignSection = new ComboSection( vAlignProvider.getDisplayName( ),
			container,
			true );

	Section seperatorSection = new SeperatorSection( container, SWT.HORIZONTAL );

	SimpleComboSection styleSection = new SimpleComboSection( styleProvider.getDisplayName( ),
			container,
			true );

	// Sets providers.

	dropSection.setProvider( dropProvider );
	backgroundSection.setProvider( backgroundProvider );
	vAlignSection.setProvider( vAlignProvider );
	styleSection.setProvider( styleProvider );

	// Sets widths.

	dropSection.setWidth( 200 );
	backgroundSection.setWidth( 200 );
	vAlignSection.setWidth( 200 );
	styleSection.setWidth( 200 );

	// Sets layout num.

	dropSection.setLayoutNum( 2 );
	backgroundSection.setLayoutNum( 4 );
	vAlignSection.setLayoutNum( 2 );
	styleSection.setLayoutNum( 4 );

	// Sets fill grid num.

	dropSection.setGridPlaceholder( 0, true );
	backgroundSection.setGridPlaceholder( 2, true );
	vAlignSection.setGridPlaceholder( 0, true );
	styleSection.setGridPlaceholder( 2, true );

	// Adds sections into this page.

	ElementIdDescriptorProvider elementIdProvider = new ElementIdDescriptorProvider( );
	TextSection elementIdSection = new TextSection( elementIdProvider.getDisplayName( ),
			container,
			true );
	elementIdSection.setProvider( elementIdProvider );
	elementIdSection.setWidth( 200 );
	elementIdSection.setLayoutNum( 6 );
	elementIdSection.setGridPlaceholder( 4, true );
	addSection( PageSectionId.CELL_ELEMENT_ID, elementIdSection );
	
	addSection( PageSectionId.CELL_DROP, dropSection ); //$NON-NLS-1$
	addSection( PageSectionId.CELL_BACKGROUND, backgroundSection ); //$NON-NLS-1$
	addSection( PageSectionId.CELL_VERTICAL_ALIGN, vAlignSection ); //$NON-NLS-1$
	addSection( PageSectionId.CELL_STYLE, styleSection ); //$NON-NLS-1$
	
	addSection( PageSectionId.CELL_SEPERATOR, seperatorSection ); //$NON-NLS-1$
	

	addFontsSection( );
	


	createSections( );
	layoutSections( );
}
 
Example 19
public SeriesPageBar(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	compositeFirst = new Composite(this, SWT.NONE);
	compositeFirst.setLayout(new GridLayout(2, false));
	compositeFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	
	btnNewButton = new Button(compositeFirst, SWT.NONE);
	btnNewButton.setText("Select Term");
	
	lblSelectedTermIs = new Label(compositeFirst, SWT.CENTER);
	GridData gd_lblSelectedTermIs = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblSelectedTermIs.widthHint = 367;
	lblSelectedTermIs.setLayoutData(gd_lblSelectedTermIs);
	lblSelectedTermIs.setText("No Term Selected");
	btnNewButton.addSelectionListener(this);
	
	
	
	Composite compositeCentre = new Composite(this, SWT.NONE);
	compositeCentre.setLayout(new GridLayout(1, false));
	compositeCentre.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
	
	list = new List(compositeCentre, SWT.BORDER | SWT.V_SCROLL);
	GridData gd_list = new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1);
	gd_list.widthHint = 400;
	list.setLayoutData(gd_list);
	list.setBounds(0, 0, 71, 68);
	list.addSelectionListener(this);
	
	Composite compositeNorth = new Composite(this, SWT.NONE);
	compositeNorth.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	FillLayout fl_compositeNorth = new FillLayout(SWT.HORIZONTAL);
	fl_compositeNorth.marginWidth = 5;
	fl_compositeNorth.spacing = 5;
	compositeNorth.setLayout(fl_compositeNorth);
	
	lblColor = new Label(compositeNorth, SWT.NONE);
	lblColor.setText("Color: ");
	
	btnRadioButtonGrey = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonGrey.setText("Grey");
	btnRadioButtonGrey.addSelectionListener(this);
	
	btnRadioButtonCustom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonCustom.setText("Custom");
	btnRadioButtonCustom.addSelectionListener(this);
	
	btnRadioButtonRandom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonRandom.setSelection(true);
	btnRadioButtonRandom.setText("Random");
	
	btnOneColor = new Button(compositeNorth, SWT.RADIO);
	btnOneColor.setText("One Color");
	btnOneColor.addSelectionListener(this);
	
	btnRadioButtonRandom.addSelectionListener(this);
	
	Composite compositeSouth = new Composite(this, SWT.NONE);
	compositeSouth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	compositeSouth.setLayout(new GridLayout(5, false));
	
	btnCheckButton = new Button(compositeSouth, SWT.CHECK);
	btnCheckButton.setBounds(0, 0, 111, 20);
	btnCheckButton.setText("Show in Chart");
	btnCheckButton.addSelectionListener(this);
	
	labelShowColor = new Label(compositeSouth, SWT.BORDER);
	GridData gd_labelShowColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelShowColor.widthHint = 100;
	labelShowColor.setLayoutData(gd_labelShowColor);
	labelShowColor.setBounds(0, 0, 70, 20);
	labelShowColor.setText(" ");
	labelShowColor.addMouseListener(this);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	
	loadSettings();

}
 
Example 20
Source Project: elexis-3-core   File: SWTHelper.java    License: Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Convenience method to add a separator bar to the composite.
 * <p>
 * The parent composite must have a <code>GridLayout</code>. The separator bar will span all
 * columns of the parent grid layout. <br>
 * <br>
 * Code from: http://www.softwarerevolution.com/blueprints/ The Software Revolution Inc. by
 * Thomas Holland under GPLv3
 * </p>
 * 
 * @param parent
 *            <code>Composite</code>
 */
public static void addSeparator(Composite parent){
	Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
	Layout parentlayout = parent.getLayout();
	if (parentlayout instanceof GridLayout) {
		int columns = ((GridLayout) parentlayout).numColumns;
		GridData gridData = new GridData(SWT.FILL, SWT.NONE, true, false, columns, 1);
		separator.setLayoutData(gridData);
	}
}