Java Code Examples for org.eclipse.swt.layout.GridData#END

The following examples show how to use org.eclipse.swt.layout.GridData#END . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreferenceWindow.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Builds the buttons
 */
private void buildButtons() {
	final Button buttonOK = new Button(shell, SWT.PUSH);
	buttonOK.setText(ResourceManager.getLabel(ResourceManager.OK));
	final GridData gridDataOk = new GridData(GridData.END, GridData.END, true, false);
	gridDataOk.widthHint = 100;
	buttonOK.setLayoutData(gridDataOk);
	buttonOK.addListener(SWT.Selection, e -> {
		returnedValue = true;
		shell.dispose();
	});
	shell.setDefaultButton(buttonOK);

	final Button buttonCancel = new Button(shell, SWT.PUSH);
	buttonCancel.setText(ResourceManager.getLabel(ResourceManager.CANCEL));
	final GridData gridDataCancel = new GridData(GridData.BEGINNING, GridData.END, false, false);
	gridDataCancel.widthHint = 100;
	buttonCancel.setLayoutData(gridDataCancel);
	buttonCancel.addListener(SWT.Selection, e -> {
		returnedValue = false;
		shell.dispose();
	});
}
 
Example 2
Source File: ProgressDialogEx.java    From SWET with MIT License 6 votes vote down vote up
public ProgressController(Composite parent, int style) {
	this.parent = parent;
	display = Display.getCurrent();

	progressTitle = new Label(parent, SWT.NONE);
	progressTitle.setText("Progress");
	GridData titleData = new GridData();
	titleData.horizontalAlignment = GridData.BEGINNING;
	titleData.grabExcessHorizontalSpace = true;
	progressTitle.setLayoutData(titleData);

	progressValue = new Label(parent, SWT.NONE);
	progressValue.setText("0%");
	GridData valueData = new GridData();
	valueData.horizontalAlignment = GridData.END;
	progressValue.setLayoutData(valueData);

	progressBar = new ProgressBar(parent, style);
	GridData progressData = new GridData();
	progressData.horizontalAlignment = GridData.FILL;
	progressData.horizontalSpan = 2;
	progressData.grabExcessHorizontalSpace = true;
	progressBar.setLayoutData(progressData);

}
 
Example 3
Source File: LoginDialog.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Build the login part of the box
 */
private void buildLogin() {
	final Label label = new Label(shell, SWT.NONE);
	final GridData gridData = new GridData(GridData.END, GridData.END, false, false, 1, 1);
	gridData.horizontalIndent = 35;
	gridData.verticalIndent = 15;
	label.setLayoutData(gridData);
	label.setText(ResourceManager.getLabel(ResourceManager.NAME));

	if (autorizedLogin != null && !autorizedLogin.isEmpty()) {
		// Combo
		buildLoginCombo();
	} else {
		// Text
		buildLoginText();
	}

}
 
Example 4
Source File: ButtonFieldEditor.java    From e4macs with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
 */
@Override
protected void doFillIntoGrid(Composite parent, int numColumns) {
	top = parent;
       GridData gd = new GridData();
       gd.horizontalSpan = numColumns;
       gd.horizontalAlignment = GridData.FILL;
       gd.horizontalAlignment = GridData.END;
       gd.grabExcessHorizontalSpace = true;        
       
       button = getButtonControl(parent);
       
       int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
       gd.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
       button.setLayoutData(gd);
}
 
Example 5
Source File: CompositeFactory.java    From erflute with Apache License 2.0 5 votes vote down vote up
public static Button createAddButton(Composite composite) {
    final GridData gridData = new GridData();
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.END;
    gridData.widthHint = DesignResources.BUTTON_WIDTH;

    final Button button = new Button(composite, SWT.NONE);
    button.setText(DisplayMessages.getMessage("label.right.arrow"));
    button.setLayoutData(gridData);

    return button;
}
 
Example 6
Source File: CompositeFactory.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public static Button createAddButton(Composite composite) {
	GridData gridData = new GridData();
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = GridData.END;
	gridData.widthHint = Resources.BUTTON_WIDTH;

	Button button = new Button(composite, SWT.NONE);
	button.setText(ResourceString.getResourceString("label.right.arrow"));
	button.setLayoutData(gridData);

	return button;
}
 
Example 7
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static Button createUpButton(final Composite composite) {
    final GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = false;
    gridData.verticalAlignment = GridData.END;
    gridData.grabExcessVerticalSpace = true;
    gridData.widthHint = Resources.SMALL_BUTTON_WIDTH;

    final Button button = new Button(composite, SWT.NONE);
    button.setText(ResourceString.getResourceString("label.up.arrow"));
    button.setLayoutData(gridData);

    return button;
}
 
Example 8
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static Button createAddButton(final Composite composite) {
    final GridData gridData = new GridData();
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.END;
    gridData.widthHint = Resources.BUTTON_ADD_REMOVE_WIDTH;

    final Button button = new Button(composite, SWT.NONE);
    button.setText(ResourceString.getResourceString("label.right.arrow"));
    button.setLayoutData(gridData);

    return button;
}
 
Example 9
Source File: PWChooser.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite)
 */
@Override
public Control build(final Composite parent) {
	final Label label = new Label(parent, SWT.NONE);

	if (getLabel() == null) {
		throw new UnsupportedOperationException("You need to set a label for a directory or a dialog chooser");
	} else {
		label.setText(getLabel());
	}
	addControl(label);
	final GridData labelGridData = new GridData(GridData.END, GridData.BEGINNING, false, false);
	labelGridData.horizontalIndent = getIndent();
	label.setLayoutData(labelGridData);

	final Text text = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
	addControl(text);
	final GridData textGridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
	text.setLayoutData(textGridData);

	final Button button = new Button(parent, SWT.PUSH);
	addControl(button);
	final GridData buttonGridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
	buttonGridData.widthHint = 150;
	button.setText(ResourceManager.getLabel(ResourceManager.CHOOSE) + "...");
	button.setLayoutData(buttonGridData);

	setButtonAction(text, button);

	return button;

}
 
Example 10
Source File: PWWidget.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param alignment the alignment to set (GridData.BEGINNING,
 *            GridData.CENTER, GridData.END, GridData.FILL)
 * @return the widget
 */
public PWWidget setAlignment(final int alignment) {
	if (alignment != GridData.BEGINNING && alignment != GridData.CENTER && alignment != GridData.END && alignment != GridData.FILL) {
		throw new UnsupportedOperationException("Value should be one of the following :GridData.BEGINNING, GridData.CENTER, GridData.END, GridData.FILL");
	}
	this.alignment = alignment;
	return this;
}
 
Example 11
Source File: PWWidget.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Build the label associated to the widget
 * 
 * @param parent parent composite
 * @param verticalAlignment vertical alignment
 */
protected void buildLabel(final Composite parent, final int verticalAlignment) {
	if (getLabel() != null) {
		final Label label = new Label(parent, SWT.NONE);
		label.setText(getLabel());
		final GridData labelGridData = new GridData(GridData.END, verticalAlignment, false, false);
		labelGridData.horizontalIndent = getIndent();
		label.setLayoutData(labelGridData);
		addControl(label);
	}
}
 
Example 12
Source File: TranslationManageDialog.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void initialize(Composite composite) {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 4;

	Group group = new Group(composite, SWT.NONE);
	group.setText(ResourceString
			.getResourceString("label.translation.message"));
	group.setLayout(gridLayout);

	GridData gridData = new GridData();
	gridData.horizontalSpan = 4;

	this.useButton = new Button(group, SWT.CHECK);
	this.useButton.setText(ResourceString
			.getResourceString("label.translation.use"));
	this.useButton.setLayoutData(gridData);

	GridData tableGridData = new GridData();
	tableGridData.heightHint = 200;
	tableGridData.horizontalSpan = 3;
	tableGridData.verticalSpan = 2;

	this.dictionaryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
	this.dictionaryTable.setHeaderVisible(true);
	this.dictionaryTable.setLayoutData(tableGridData);
	this.dictionaryTable.setLinesVisible(true);

	GridData upButtonGridData = new GridData();
	upButtonGridData.grabExcessHorizontalSpace = false;
	upButtonGridData.verticalAlignment = GridData.END;
	upButtonGridData.grabExcessVerticalSpace = true;
	upButtonGridData.widthHint = BUTTON_WIDTH;

	GridData downButtonGridData = new GridData();
	downButtonGridData.grabExcessVerticalSpace = true;
	downButtonGridData.verticalAlignment = GridData.BEGINNING;
	downButtonGridData.widthHint = BUTTON_WIDTH;

	GridData textGridData = new GridData();
	textGridData.widthHint = 150;

	TableColumn tableColumn = new TableColumn(dictionaryTable, SWT.NONE);
	tableColumn.setWidth(30);
	tableColumn.setResizable(false);
	TableColumn tableColumn1 = new TableColumn(dictionaryTable, SWT.NONE);
	tableColumn1.setWidth(230);
	tableColumn1.setResizable(false);
	tableColumn1.setText(ResourceString
			.getResourceString("label.translation.file.name"));
}
 
Example 13
Source File: PTWindowEditor.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.propertytable.editor.PTChooserEditor#openWindow(org.eclipse.nebula.widgets.opal.propertytable.PTWidget,
 *      org.eclipse.swt.widgets.Item, org.eclipse.nebula.widgets.opal.propertytable.PTProperty)
 */
@Override
protected void openWindow(final PTWidget widget, final Item item, final PTProperty property) {
	final Shell shell = new Shell(widget.getWidget().getShell(), SWT.DIALOG_TRIM);
	shell.setLayout(new GridLayout(2, false));
	shell.setText(ResourceManager.getLabel(ResourceManager.EDIT_PROPERTY));

	final Label title = new Label(shell, SWT.NONE);
	final GridData titleLayoutData = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1);
	titleLayoutData.widthHint = 400;
	title.setLayoutData(titleLayoutData);
	final Font font = SWTGraphicUtil.buildFontFrom(title, SWT.BOLD, 16);
	title.setFont(font);
	title.setText(ResourceManager.getLabel(ResourceManager.EDIT_PROPERTY));
	SWTGraphicUtil.addDisposer(title, font);

	createContent(shell, property);

	final Composite composite = new Composite(shell, SWT.NONE);
	composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));

	final GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
	composite.setLayout(gridLayout);

	final Button ok = new Button(composite, SWT.PUSH);
	final GridData okLayoutData = new GridData(GridData.END, GridData.BEGINNING, true, false);
	okLayoutData.widthHint = 150;
	ok.setLayoutData(okLayoutData);
	ok.setText(ResourceManager.getLabel(ResourceManager.OK));
	ok.addListener(SWT.Selection, event -> {
		fillProperty(item, property);
		shell.dispose();
	});

	final Button cancel = new Button(composite, SWT.PUSH);
	final GridData cancelLayoutData = new GridData(GridData.END, GridData.BEGINNING, false, false);
	cancelLayoutData.widthHint = 150;
	cancel.setLayoutData(cancelLayoutData);
	cancel.setText(ResourceManager.getLabel(ResourceManager.CANCEL));
	cancel.addListener(SWT.Selection, event -> {
		shell.dispose();
	});

	shell.setDefaultButton(ok);
	shell.pack();
	SWTGraphicUtil.centerShell(shell);
	shell.open();
}
 
Example 14
Source File: IndexDialog.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
 * This method initializes group1
 * 
 */
private void createGroup1(Composite composite) {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 2;
	gridLayout.verticalSpacing = 20;
	gridLayout.marginHeight = 10;

	GridData upButtonGridData = new GridData();
	upButtonGridData.grabExcessHorizontalSpace = false;
	upButtonGridData.verticalAlignment = GridData.END;
	upButtonGridData.grabExcessVerticalSpace = true;
	upButtonGridData.widthHint = Resources.BUTTON_WIDTH;

	GridData downButtonGridData = new GridData();
	downButtonGridData.grabExcessVerticalSpace = true;
	downButtonGridData.verticalAlignment = GridData.BEGINNING;
	downButtonGridData.widthHint = Resources.BUTTON_WIDTH;

	GridData gridData4 = new GridData();
	gridData4.verticalSpan = 2;

	Group group = new Group(composite, SWT.NONE);
	group.setText(ResourceString
			.getResourceString("label.index.column.list"));
	group.setLayout(gridLayout);
	group.setLayoutData(gridData4);

	this.initializeIndexColumnList(group);

	// indexColumnList = new List(group, SWT.BORDER | SWT.V_SCROLL);
	// indexColumnList.setLayoutData(gridData5);

	this.upButton = new Button(group, SWT.NONE);
	this.upButton.setText(ResourceString
			.getResourceString("label.up.arrow"));
	this.upButton.setLayoutData(upButtonGridData);

	this.downButton = new Button(group, SWT.NONE);
	this.downButton.setText(ResourceString
			.getResourceString("label.down.arrow"));
	this.downButton.setLayoutData(downButtonGridData);
}
 
Example 15
Source File: SynchronizePlatformPage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 4 votes vote down vote up
public void createControl( Composite parent )
{
	final Composite container = new Composite(parent, SWT.NONE);
	{
		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		layout.verticalSpacing = 12;
		container.setLayout(layout);

		GridData data = new GridData();
		data.verticalAlignment = GridData.FILL;
		data.grabExcessVerticalSpace = true;
		data.horizontalAlignment = GridData.FILL;
		container.setLayoutData(data);
	}
	
	Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
	boolean fixClasspathIssuesPref = preferences.getBoolean(ImportPlatformPage.FIX_CLASS_PATH_ISSUES_PREFERENCE, true);
	boolean removeHybrisBuilderPref = preferences.getBoolean(ImportPlatformPage.REMOVE_HYBRIS_BUILDER_PREFERENCE, true);
	boolean createWorkingSetsPref = preferences.getBoolean(ImportPlatformPage.CREATE_WORKING_SETS_PREFERENCE, true);
	boolean useMultiThreadPref = preferences.getBoolean(ImportPlatformPage.USE_MULTI_THREAD_PREFERENCE, true);
	boolean skipJarScanningPref = preferences.getBoolean(ImportPlatformPage.SKIP_JAR_SCANNING_PREFERENCE, true);
	
	GridData gdFillHorizontal = new GridData(GridData.FILL_HORIZONTAL);
	gdFillHorizontal.horizontalSpan=2;
	
	GridData gdAlignRight = new GridData(GridData.FILL_HORIZONTAL);
	gdAlignRight.horizontalAlignment = GridData.END;
	
	Label generalOptionsLabel = new Label( container, 0 );
	generalOptionsLabel.setText( "General Options" );
	generalOptionsLabel.setToolTipText("General Options");
	generalOptionsLabel.setLayoutData(gdFillHorizontal);

	fixClasspathIssuesButton = new Button( container, 32 );
	fixClasspathIssuesButton.setSelection( fixClasspathIssuesPref );
	fixClasspathIssuesButton.setLayoutData(gdAlignRight);
	
	Label fixClasspathIssuesLabel = new Label( container, 0 );
	fixClasspathIssuesLabel.setText( "Fix classpath issues (recommended)" );
	fixClasspathIssuesLabel.setToolTipText("This will try to fix the project classpath by using the classpath used by the hybris platform and also fixing a number of other common classpath issues");
	//fixClasspathIssuesLabel.setLayoutData(gdFillHorizontal);
	
	removeHybrisItemsXmlGeneratorButton = new Button( container, 32 );
	removeHybrisItemsXmlGeneratorButton.setSelection( removeHybrisBuilderPref );
	removeHybrisItemsXmlGeneratorButton.setLayoutData(gdAlignRight);
	
	Label removeHybrisItemsXmlGeneratorLabel = new Label( container, 0 );
	removeHybrisItemsXmlGeneratorLabel.setText( "Remove Hybris Builder (recommended)" );
	removeHybrisItemsXmlGeneratorLabel.setToolTipText("The Hybris Builder will run a build to generate classes on every items.xml save. This generally slows down development and it's usually better to generate the classes by running a build manually");
	//removeHybrisItemsXmlGeneratorLabel.setLayoutData(gdFillHorizontal);
	
	createWorkingSetsButton = new Button( container, 32 );
	createWorkingSetsButton.setSelection( createWorkingSetsPref );
	createWorkingSetsButton.setLayoutData(gdAlignRight);
	
	Label createWorkingSetsLabel = new Label( container, 0 );
	createWorkingSetsLabel.setText( "Update Working Sets" );
	createWorkingSetsLabel.setToolTipText("Create from directories of extensions (e.g. ext-commerce)");
	//createWorkingSetsLabel.setLayoutData(gdFillHorizontal);

	Label optimzeStartupSettings = new Label( container, 0 );
	optimzeStartupSettings.setText( "Optimize Tomcat Startup Time" );
	optimzeStartupSettings.setToolTipText("Optimize Tomcat Startup Time");
	optimzeStartupSettings.setLayoutData(gdFillHorizontal);
	
	useMultiThreadButton = new Button( container, 32 );
	useMultiThreadButton.setSelection( useMultiThreadPref );
	useMultiThreadButton.setLayoutData(gdAlignRight);
	
	Label useMultiThreadLabel = new Label( container, 0 );
	useMultiThreadLabel.setText( "Tomcat Start/Stop with multi-thread" );
	useMultiThreadLabel.setToolTipText("Configure the Tomcat server.xml to set startStopThreads=0");
	//useMultiThreadLabel.setLayoutData(gdFillHorizontal);
	
	skipJarScanningButton = new Button( container, 32 );
	skipJarScanningButton.setSelection( skipJarScanningPref );
	skipJarScanningButton.setLayoutData(gdAlignRight);
	
	Label skipJarScanningLabel = new Label( container, 0 );
	skipJarScanningLabel.setText( "Tomcat Start with skipping TLD Jar scanning" );
	skipJarScanningLabel.setToolTipText("Configure the Tomcat catalina.properties to set the value of org.apache.catalina.startup.ContextConfig.jarsToSkip");
	//skipJarScanningLabel.setLayoutData(gdFillHorizontal);
	
	setControl( parent );
	setPageComplete( true );
}
 
Example 16
Source File: TranslationManageDialog.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void initialize(final Composite composite) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;

    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    final Group group = new Group(composite, SWT.NONE);
    group.setLayoutData(gridData);
    group.setText(ResourceString.getResourceString("label.translation.message"));
    group.setLayout(gridLayout);

    useButton = new Button(group, SWT.CHECK);
    useButton.setText(ResourceString.getResourceString("label.translation.use"));

    final GridData tableGridData = new GridData();
    tableGridData.heightHint = 200;
    tableGridData.horizontalSpan = 1;
    tableGridData.verticalSpan = 2;
    tableGridData.horizontalAlignment = GridData.FILL;
    tableGridData.grabExcessHorizontalSpace = true;

    dictionaryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
    dictionaryTable.setHeaderVisible(true);
    dictionaryTable.setLayoutData(tableGridData);
    dictionaryTable.setLinesVisible(true);

    final GridData upButtonGridData = new GridData();
    upButtonGridData.grabExcessHorizontalSpace = false;
    upButtonGridData.verticalAlignment = GridData.END;
    upButtonGridData.grabExcessVerticalSpace = true;
    upButtonGridData.widthHint = BUTTON_WIDTH;

    final GridData downButtonGridData = new GridData();
    downButtonGridData.grabExcessVerticalSpace = true;
    downButtonGridData.verticalAlignment = GridData.BEGINNING;
    downButtonGridData.widthHint = BUTTON_WIDTH;

    final GridData textGridData = new GridData();
    textGridData.widthHint = 150;

    final TableColumn tableColumn = new TableColumn(dictionaryTable, SWT.NONE);
    tableColumn.setWidth(30);
    tableColumn.setResizable(false);
    final TableColumn tableColumn1 = new TableColumn(dictionaryTable, SWT.NONE);
    tableColumn1.setWidth(230);
    tableColumn1.setResizable(false);
    tableColumn1.setText(ResourceString.getResourceString("label.translation.file.name"));
}
 
Example 17
Source File: MainWalkerGroupManageDialog.java    From erflute with Apache License 2.0 4 votes vote down vote up
private void createCategoryGroup(Composite composite) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;

    final Group group = new Group(composite, SWT.NONE);
    group.setText(DisplayMessages.getMessage("label.category.message"));
    group.setLayout(gridLayout);

    CompositeFactory.filler(group, 4);

    final GridData tableGridData = new GridData();
    tableGridData.heightHint = 200;
    tableGridData.horizontalSpan = 3;
    tableGridData.verticalSpan = 2;

    this.categoryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
    categoryTable.setHeaderVisible(true);
    categoryTable.setLayoutData(tableGridData);
    categoryTable.setLinesVisible(true);

    final GridData upButtonGridData = new GridData();
    upButtonGridData.grabExcessHorizontalSpace = false;
    upButtonGridData.verticalAlignment = GridData.END;
    upButtonGridData.grabExcessVerticalSpace = true;
    upButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    final GridData downButtonGridData = new GridData();
    downButtonGridData.grabExcessVerticalSpace = true;
    downButtonGridData.verticalAlignment = GridData.BEGINNING;
    downButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    this.upButton = new Button(group, SWT.NONE);
    upButton.setText(DisplayMessages.getMessage("label.up.arrow"));
    upButton.setLayoutData(upButtonGridData);

    this.downButton = new Button(group, SWT.NONE);
    downButton.setText(DisplayMessages.getMessage("label.down.arrow"));
    downButton.setLayoutData(downButtonGridData);

    final GridData textGridData = new GridData();
    textGridData.widthHint = 150;

    this.categoryNameText = new Text(group, SWT.BORDER);
    categoryNameText.setLayoutData(textGridData);

    final GridData buttonGridData = new GridData();
    buttonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    this.addCategoryButton = new Button(group, SWT.NONE);
    addCategoryButton.setLayoutData(buttonGridData);
    addCategoryButton.setText(DisplayMessages.getMessage("label.button.add"));

    this.updateCategoryButton = new Button(group, SWT.NONE);
    updateCategoryButton.setLayoutData(buttonGridData);
    updateCategoryButton.setText(DisplayMessages.getMessage("label.button.update"));

    this.deleteCategoryButton = new Button(group, SWT.NONE);
    deleteCategoryButton.setLayoutData(buttonGridData);
    deleteCategoryButton.setText(DisplayMessages.getMessage("label.button.delete"));

    final TableColumn tableColumn = new TableColumn(categoryTable, SWT.NONE);
    tableColumn.setWidth(30);
    tableColumn.setResizable(false);
    final TableColumn tableColumn1 = new TableColumn(categoryTable, SWT.NONE);
    tableColumn1.setWidth(230);
    tableColumn1.setResizable(false);
    tableColumn1.setText(DisplayMessages.getMessage("label.category.name"));
}
 
Example 18
Source File: VGroupManageDialog.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
private void createCategoryGroup(Composite composite) {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 4;

	Group group = new Group(composite, SWT.NONE);
	group.setText(ResourceString
			.getResourceString("label.category.message"));
	group.setLayout(gridLayout);

	CompositeFactory.filler(group, 4);

	GridData tableGridData = new GridData();
	tableGridData.heightHint = 200;
	tableGridData.horizontalSpan = 3;
	tableGridData.verticalSpan = 2;

	this.categoryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
	this.categoryTable.setHeaderVisible(true);
	this.categoryTable.setLayoutData(tableGridData);
	this.categoryTable.setLinesVisible(true);

	GridData upButtonGridData = new GridData();
	upButtonGridData.grabExcessHorizontalSpace = false;
	upButtonGridData.verticalAlignment = GridData.END;
	upButtonGridData.grabExcessVerticalSpace = true;
	upButtonGridData.widthHint = Resources.BUTTON_WIDTH;

	GridData downButtonGridData = new GridData();
	downButtonGridData.grabExcessVerticalSpace = true;
	downButtonGridData.verticalAlignment = GridData.BEGINNING;
	downButtonGridData.widthHint = Resources.BUTTON_WIDTH;

	this.upButton = new Button(group, SWT.NONE);
	this.upButton.setText(ResourceString
			.getResourceString("label.up.arrow"));
	this.upButton.setLayoutData(upButtonGridData);

	this.downButton = new Button(group, SWT.NONE);
	this.downButton.setText(ResourceString
			.getResourceString("label.down.arrow"));
	this.downButton.setLayoutData(downButtonGridData);

	GridData textGridData = new GridData();
	textGridData.widthHint = 150;

	this.categoryNameText = new Text(group, SWT.BORDER);
	this.categoryNameText.setLayoutData(textGridData);

	GridData buttonGridData = new GridData();
	buttonGridData.widthHint = Resources.BUTTON_WIDTH;

	this.addCategoryButton = new Button(group, SWT.NONE);
	this.addCategoryButton.setLayoutData(buttonGridData);
	this.addCategoryButton.setText(ResourceString
			.getResourceString("label.button.add"));

	this.updateCategoryButton = new Button(group, SWT.NONE);
	this.updateCategoryButton.setLayoutData(buttonGridData);
	this.updateCategoryButton.setText(ResourceString
			.getResourceString("label.button.update"));

	this.deleteCategoryButton = new Button(group, SWT.NONE);
	this.deleteCategoryButton.setLayoutData(buttonGridData);
	this.deleteCategoryButton.setText(ResourceString
			.getResourceString("label.button.delete"));

	TableColumn tableColumn = new TableColumn(categoryTable, SWT.NONE);
	tableColumn.setWidth(30);
	tableColumn.setResizable(false);
	TableColumn tableColumn1 = new TableColumn(categoryTable, SWT.NONE);
	tableColumn1.setWidth(230);
	tableColumn1.setResizable(false);
	tableColumn1.setText(ResourceString
			.getResourceString("label.category.name"));
}
 
Example 19
Source File: CategoryManageDialog.java    From erflute with Apache License 2.0 4 votes vote down vote up
private void createCategoryGroup(Composite composite) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;

    final Group group = new Group(composite, SWT.NONE);
    group.setText(DisplayMessages.getMessage("label.category.message"));
    group.setLayout(gridLayout);

    CompositeFactory.filler(group, 4);

    final GridData tableGridData = new GridData();
    tableGridData.heightHint = 200;
    tableGridData.horizontalSpan = 3;
    tableGridData.verticalSpan = 2;

    this.categoryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
    categoryTable.setHeaderVisible(true);
    categoryTable.setLayoutData(tableGridData);
    categoryTable.setLinesVisible(true);

    final GridData upButtonGridData = new GridData();
    upButtonGridData.grabExcessHorizontalSpace = false;
    upButtonGridData.verticalAlignment = GridData.END;
    upButtonGridData.grabExcessVerticalSpace = true;
    upButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    final GridData downButtonGridData = new GridData();
    downButtonGridData.grabExcessVerticalSpace = true;
    downButtonGridData.verticalAlignment = GridData.BEGINNING;
    downButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    this.upButton = new Button(group, SWT.NONE);
    upButton.setText(DisplayMessages.getMessage("label.up.arrow"));
    upButton.setLayoutData(upButtonGridData);

    this.downButton = new Button(group, SWT.NONE);
    downButton.setText(DisplayMessages.getMessage("label.down.arrow"));
    downButton.setLayoutData(downButtonGridData);

    final GridData textGridData = new GridData();
    textGridData.widthHint = 150;

    this.categoryNameText = new Text(group, SWT.BORDER);
    categoryNameText.setLayoutData(textGridData);

    final GridData buttonGridData = new GridData();
    buttonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    addCategoryButton = new Button(group, SWT.NONE);
    addCategoryButton.setLayoutData(buttonGridData);
    addCategoryButton.setText(DisplayMessages.getMessage("label.button.add"));

    updateCategoryButton = new Button(group, SWT.NONE);
    updateCategoryButton.setLayoutData(buttonGridData);
    updateCategoryButton.setText(DisplayMessages.getMessage("label.button.update"));

    deleteCategoryButton = new Button(group, SWT.NONE);
    deleteCategoryButton.setLayoutData(buttonGridData);
    deleteCategoryButton.setText(DisplayMessages.getMessage("label.button.delete"));

    final TableColumn tableColumn = new TableColumn(categoryTable, SWT.NONE);
    tableColumn.setWidth(30);
    tableColumn.setResizable(false);
    final TableColumn tableColumn1 = new TableColumn(categoryTable, SWT.NONE);
    tableColumn1.setWidth(230);
    tableColumn1.setResizable(false);
    tableColumn1.setText(DisplayMessages.getMessage("label.category.name"));
}
 
Example 20
Source File: PWRow.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.preferencewindow.PWContainer#build(org.eclipse.swt.widgets.Composite)
 */
@Override
public void build(final Composite parent) {
	final int size = this.widgets.size();
	int columIndex = 0;
	for (int i = 0; i < size; i++) {
		final PWWidget widget = this.widgets.get(i);
		final Control control = widget.checkAndBuild(parent);
		if (control != null && control.getLayoutData() == null) {
			final int colSpan;
			final boolean grabExcessSpace;
			final int alignment;
			if (size == 1) {
				if (widget.isSingleWidget()) {
					colSpan = this.parentNumberOfColums;
				} else {
					colSpan = this.parentNumberOfColums - widget.getNumberOfColumns() + 1;
				}
				grabExcessSpace = true;
			} else {
				if (i == size - 1) {
					colSpan = this.parentNumberOfColums - columIndex;
					grabExcessSpace = widget.isGrabExcessSpace();
				} else {
					colSpan = 1;
					grabExcessSpace = widget instanceof PWButton && i == 0 ? true : widget.isGrabExcessSpace();
				}
			}
			columIndex += widget.getNumberOfColumns();

			if (i == 0 && grabExcessSpace && size > 1) {
				if (widget instanceof PWLabel || widget instanceof PWButton) {
					alignment = GridData.END;
				} else {
					alignment = GridData.BEGINNING;
				}
			} else {
				alignment = widget.getAlignment();
			}

			final GridData gd = new GridData(alignment, GridData.BEGINNING, grabExcessSpace, false, colSpan, 1);
			gd.horizontalIndent = widget.getIndent();
			gd.widthHint = widget.getWidth();
			if (widget.getHeight() != -1) {
				gd.heightHint = widget.getHeight();
			}
			control.setLayoutData(gd);
		}
	}
}