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

The following examples show how to use org.eclipse.swt.widgets.Composite#setBackground() . 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: KeyAssistDialog.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the content area for the key assistant. This creates a table and
 * places it inside the composite. The composite will contain a list of all
 * the key bindings.
 * 
 * @param parent
 *            The parent composite to contain the dialog area; must not be
 *            <code>null</code>.
 */
@Override
protected final Control createDialogArea(final Composite parent) {
    // First, register the shell type with the context support
    registerShellType();

    // Create a composite for the dialog area.
    final Composite composite = new Composite(parent, SWT.NONE);
    final GridLayout compositeLayout = new GridLayout();
    compositeLayout.marginHeight = 0;
    compositeLayout.marginWidth = 0;
    composite.setLayout(compositeLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setBackground(parent.getBackground());

    // Layout the partial matches.
    if (keybindingToActionInfo.isEmpty()) {
        createEmptyDialogArea(composite);
    } else {
        createTableDialogArea(composite);
    }
    return composite;
}
 
Example 2
Source File: GamaPreferencesView.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private void buildContentsFor(final CTabItem tab, final Map<String, List<Pref>> entries) {
	final ParameterExpandBar viewer = new ParameterExpandBar(tab.getParent(), SWT.V_SCROLL);
	contents.add(viewer);
	final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
	viewer.setLayoutData(data);
	// ?
	viewer.computeSize(tab.getBounds().x, SWT.DEFAULT);
	//
	viewer.setSpacing(5);
	tab.setControl(viewer);
	for (final String groupName : entries.keySet()) {
		final ParameterExpandItem item = new ParameterExpandItem(viewer, entries.get(groupName), SWT.NONE, null);
		item.setText(groupName);
		item.setColor(new GamaColor(230, 230, 230, 255));
		final Composite compo = new Composite(viewer, SWT.NONE);
		compo.setBackground(viewer.getBackground());
		buildGroupContents(compo, entries.get(groupName), NB_DIVISIONS);
		item.setControl(compo);
		item.setHeight(compo.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
		item.setExpanded(true);
	}

}
 
Example 3
Source File: ComboBoxCellEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Control createControl( Composite parent )
{

	Font font = parent.getFont( );
	Color bg = parent.getBackground( );

	editor = new Composite( parent, getStyle( ) );
	editor.setFont( font );
	editor.setBackground( bg );
	editor.setLayout( new FillLayout( ) );

	createContents( editor );
	updateContents( value );

	setValueValid( true );

	return editor;
}
 
Example 4
Source File: ClassFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createComposite(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	composite.setBackground(fBackgroundColor);
	//		composite.addMouseListener(new MouseAdapter() {
	//			public void mousePressed(MouseEvent e) {
	//				((Control) e.widget).setFocus();
	//			}
	//		});
	return composite;
}
 
Example 5
Source File: ConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void runConfigurationSectionLayout( Class<?> PKG, String prefix ) {
  cRunConfiguration = new Composite( cContainer, SWT.NONE );
  cRunConfiguration.setLayout( new FormLayout() );
  props.setLook( cRunConfiguration );
  FormData fdLocal = new FormData();
  fdLocal.top = new FormAttachment( 0, Const.FORM_MARGIN );
  fdLocal.right = new FormAttachment( 100, -Const.FORM_MARGIN );
  fdLocal.left = new FormAttachment( 0, Const.FORM_MARGIN );

  cRunConfiguration.setBackground( shell.getBackground() ); // the default looks ugly
  cRunConfiguration.setLayoutData( fdLocal );

  Label wlRunConfiguration = new Label( cRunConfiguration, SWT.LEFT );
  props.setLook( wlRunConfiguration );
  wlRunConfiguration.setText( "Run configuration:" );
  FormData fdlRunConfiguration = new FormData();
  fdlRunConfiguration.top = new FormAttachment( 0 );
  fdlRunConfiguration.left = new FormAttachment( 0 );
  wlRunConfiguration.setLayoutData( fdlRunConfiguration );

  wRunConfiguration = new CCombo( cRunConfiguration, SWT.BORDER );
  props.setLook( wRunConfiguration );
  FormData fdRunConfiguration = new FormData();
  fdRunConfiguration.width = 200;
  fdRunConfiguration.top = new FormAttachment( wlRunConfiguration, Const.FORM_MARGIN );
  fdRunConfiguration.left = new FormAttachment( 0 );
  wRunConfiguration.setLayoutData( fdRunConfiguration );
}
 
Example 6
Source File: SimulationSpeedContributionItem.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: ExecutionContextLabelProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected static Composite createEditorComposite(TreeItem currentItem) {
	Composite comp = new Composite(currentItem.getParent(), SWT.INHERIT_DEFAULT);
	comp.setBackground(currentItem.getBackground());
	comp.setBackgroundMode(SWT.INHERIT_DEFAULT);
	GridLayout layout = new GridLayout(2, false);
	layout.marginHeight = 0;
	layout.marginWidth = 3;
	comp.setLayout(layout);
	return comp;
}
 
Example 8
Source File: DialogLogoCmp.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(){
	GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 70).applyTo(this);
	GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).applyTo(this);
	Color textBgColor = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
	this.setBackground(textBgColor);
	
	Composite leftLogoCmp = new Composite(this, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(leftLogoCmp);
	leftLogoCmp.setBackground(textBgColor);
	GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 0, 8, 0).applyTo(leftLogoCmp);
	
	titileLbl = new Label(leftLogoCmp, SWT.NONE);
	titileLbl.setText(title == null ? "" : title);
	titileLbl.setBackground(textBgColor);
	titileLbl.setFont(JFaceResources.getBannerFont());
	
	tipTxt = new Label(leftLogoCmp, SWT.WRAP);
	tipTxt.setText(message == null ? "" : message);
	GridDataFactory.fillDefaults().grab(true, true).indent(8, 4).applyTo(tipTxt);
	tipTxt.setBackground(textBgColor);
	tipTxt.setToolTipText(message == null ? "" : message);
	tipTxt.setFont(JFaceResources.getDialogFont());
	
	rightLogoCmp = new Composite(this, SWT.NONE);
	rightLogoCmp.setBackground(textBgColor);
	GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).grab(false, true).applyTo(rightLogoCmp);
	if(logo!=null){
		rightLogoCmp.setBackgroundImage(logo);			
	}
}
 
Example 9
Source File: PageSettingDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
protected void initComponent(Composite parent) {
    parent.setBackground(ColorConstants.white);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    parent.setLayout(layout);

    initDirectionGroup(parent);
    initScaleGroup(parent);
    initSizeGroup(parent);
}
 
Example 10
Source File: LayeredDisplayDecorator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public void createSidePanel(final SashForm form) {

		sidePanel = new Composite(form, SWT.BORDER);
		final GridLayout layout = new GridLayout(1, true);
		layout.horizontalSpacing = 0;
		layout.verticalSpacing = 0;
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		sidePanel.setLayout(layout);
		sidePanel.setBackground(IGamaColors.WHITE.color());
	}
 
Example 11
Source File: XSPEditorUtil.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
static public Composite createSectionChild(Section parent, int cols) {
 Composite child = new Composite(parent, SWT.NONE);
 child.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false));
 child.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
 GridLayout lcgl = new GridLayout(cols, false);
 lcgl.horizontalSpacing = 20;
 lcgl.marginWidth = 0;
 child.setLayout(lcgl);
 return child;
}
 
Example 12
Source File: PopulationInspectView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private void createMenus(final Composite parent) {
	final ScrolledComposite scroll = new ScrolledComposite(parent, SWT.V_SCROLL);
	scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	attributesMenu = new Composite(scroll, SWT.NONE);
	scroll.setContent(attributesMenu);
	final GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.verticalSpacing = 1;
	attributesMenu.setLayout(layout);
	attributesMenu.setBackground(IGamaColors.WHITE.color());
	fillAttributeMenu();
}
 
Example 13
Source File: Tester.java    From ColorMixer with MIT License 5 votes vote down vote up
private void setResultColor(Color colorA, Color colorB, Composite resultColorComposite, Label resultColor){
	KMColor mix = new KMColor(new java.awt.Color(colorA.getRed(), colorA.getGreen(), colorA.getBlue()));
	mix.mix(new java.awt.Color(colorB.getRed(), colorB.getGreen(), colorB.getBlue()));
	java.awt.Color result = mix.getColor();
	resultColorComposite.setBackground(new Color(Display.getCurrent(), result.getRed(), result.getGreen(), result.getBlue()));
	resultColor.setText("R: " + result.getRed() + ", G: " + result.getGreen() + ", B: " + result.getBlue());
}
 
Example 14
Source File: SkypeStyleChatDisplay.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
public SkypeStyleChatDisplay(Composite parent, int style, Color backgroundColor) {
  super(parent, style);

  contentComposite = new Composite(this, SWT.NONE);
  contentComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
  setContent(contentComposite);
  setExpandHorizontal(true);
  setExpandVertical(true);
  getVerticalBar().setIncrement(50);

  // Focus content composite on activation to enable scrolling.
  addListener(
      SWT.Activate,
      new Listener() {
        @Override
        public void handleEvent(Event e) {
          contentComposite.setFocus();
        }
      });

  setBackgroundMode(SWT.INHERIT_DEFAULT);
  contentComposite.setBackground(backgroundColor);

  /*
   * NO LAYOUT needed, because ScrolledComposite sets it's own
   * automatically
   */
  GridLayout gridLayout = new GridLayout(1, false);
  contentComposite.setLayout(gridLayout);

  /*
   * Scroll to bottom if resized
   */
  addListener(
      SWT.Resize,
      new Listener() {
        @Override
        public void handleEvent(Event event) {
          refresh();
        }
      });
}
 
Example 15
Source File: HsPreferenceDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout parentcomLayout = new GridLayout();
	parentcomLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	parentcomLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	parentcomLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	parentcomLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	composite.setLayout(parentcomLayout);
	composite.setLayoutData(new GridData(GridData.FILL_BOTH));
	applyDialogFont(composite);

	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

	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);

	super.setPageContainer(pageContainer);
	// 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 16
Source File: AboutDialog.java    From devstudio-tooling-ei with Apache License 2.0 4 votes vote down vote up
protected void createButtonsForButtonBar(Composite parent) {
	parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
	button.setFocus();
}
 
Example 17
Source File: MOOSEFormEditor.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the content used for the plant view.
 * 
 * @param section
 *            The {@code Section} that should contain the plant view.
 * @param toolkit
 *            The {@code FormToolkit} used to decorate widgets as necessary.
 */
private void populatePlantViewSection(Section section,
		FormToolkit toolkit) {
	// Get the background color to use later.
	Color background = section.getBackground();

	// Create an analysis composite to contain a ToolBar and an
	// analysis-based view.
	Composite analysisComposite = new Composite(section, SWT.NONE);
	analysisComposite.setBackground(background);
	analysisComposite.setLayout(new GridLayout(1, false));
	// Set the overall client of the plant view's Section.
	section.setClient(analysisComposite);

	// Create a ToolBarManager so we can add JFace Actions to it.
	ToolBarManager toolBarManager = new ToolBarManager(SWT.RIGHT);
	// Fill the ToolBar with customized controls.
	fillPlantViewToolBar(toolBarManager);
	toolBarManager.update(true);
	// Add it to the view.
	ToolBar toolBar = toolBarManager.createControl(analysisComposite);
	toolBar.setBackground(background);
	toolBar.setLayoutData(
			new GridData(SWT.FILL, SWT.BEGINNING, true, false));

	// Create the plant composite.
	TreeComposite components = findComponentBlock();
	factory.setTree(components);
	PlantComposite plant = factory.getPlant();
	
	//Get the factory and create a plant view from the composite
	ViewFactory viewFactory = new ViewFactory();
	viewFactory.setVizServiceFactory((BasicVizServiceFactory) VizServiceFactoryHolder.getFactory());
	plantView = viewFactory.createPlantView(plant);

	// Render the plant view in the analysis Composite.
	Composite plantComposite = plantView.createComposite(analysisComposite);
	plantComposite.setBackground(background);
	plantComposite
			.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	// Make sure the factory/plant is reset when the plant view is disposed.
	plantComposite.addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent e) {
			factory.setTree(new TreeComposite());
		}
	});

	return;
}
 
Example 18
Source File: XSPGenPage.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
private void createXPageLibraries(Composite parent){
    Section advancedSection = XSPEditorUtil.createSection(toolkit, parent, "XPage Libraries", 1, 1);  // $NLX-XSPGenPage.XPageLibraries-1$
    treeComposite = new Composite(advancedSection, SWT.NONE);
    treeComposite.setLayoutData(SWTLayoutUtils.createGDFillNoGrab());
    treeComposite.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    treeComposite.setLayout(SWTLayoutUtils.createLayoutNoMarginDefaultSpacing(1));
    
    new Label(treeComposite, SWT.NONE).setText("Select the libraries of extended XPage controls to use\nin this application.");  // $NLX-XSPGenPage.SelectthelibrariesofextendedXPage-1$
    
    CustomTree tree = new CustomTree(treeComposite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, "xsp.libraries"); // $NON-NLS-1$
    tree.setLayoutData(SWTLayoutUtils.createGDFillHorizontal());
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    tree.setRows(4);
    CustomTreeColumn col = new CustomTreeColumn(tree, SWT.NONE, "lib.id.col"); // $NON-NLS-1$
    col.setText("Library ID"); // $NLX-XSPGenPage.LibraryID-1$
    col.setWidthUnit(CustomTreeColumn.UNIT_REMAINDER);
    /*
     * Create a checkbox viewer that allows the user to select which xsp
     * libraries this application will depend upon
     */
    _xpageLibraries = new CheckboxTreeViewer(tree);
    _xpageLibraries.setLabelProvider(new XPageLibraryLabelProvider());
    _xpageLibraries.setContentProvider(new XPageLibraryContentProvider());
    _xpageLibraries.setColumnProperties(new String[]{"ID"}); //For future reference - when editing - we need to check against the ids set here! $NON-NLS-1$
        
    XSPEditorUtil.createLabel(treeComposite, "When running on the Web, the libraries must be available on the\nserver. When running on the Notes client, the library plug-ins must\nbe installed on the client.", 1); // $NLX-XSPGenPage.WhenrunningontheWebthelibrariesmu-1$
    
    Composite twoCols = new Composite(treeComposite, SWT.NONE);
    twoCols.setLayout(SWTLayoutUtils.createLayoutNoMarginNoSpacing(2));
    twoCols.setLayoutData(SWTLayoutUtils.createGDFillHorizontalNoGrab());
    
    missingLibrariesImg = new Label(twoCols, SWT.NONE);
    GridData data = new GridData();
    data.verticalAlignment = SWT.BEGINNING;
    data.verticalIndent = 3;
    missingLibrariesImg.setLayoutData(data);
    
    missingLibrariesTxt = new Label(twoCols, SWT.NONE);
    data = GridDataFactory.copyData(data);
    data.horizontalIndent = 5;
    data.verticalIndent = 0;
    missingLibrariesTxt.setLayoutData(data);
    
    advancedSection.setClient(treeComposite);
    
    SWTUtils.setBackgroundColor(treeComposite);
}
 
Example 19
Source File: TreePropertySection.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This operation draws the (initial) controls in the properties view based
 * on the input. In this case, there are initially no widgets to prepare.
 */
@Override
public void createControls(Composite parent,
		TabbedPropertySheetPage aTabbedPropertySheetPage) {
	super.createControls(parent, aTabbedPropertySheetPage);

	// Get the default background color.
	Color backgroundColor = parent.getBackground();

	// Create a section for the data composites.
	section = getWidgetFactory().createSection(parent,
			ExpandableComposite.SHORT_TITLE_BAR | Section.DESCRIPTION);
	section.setText("Node properties");
	section.setDescription("All properties available for "
			+ "this node can be modified here.");
	section.setBackground(backgroundColor);

	// Create the Composite that contains all DataComponentComposites.
	final Composite client = new Composite(section, SWT.NONE);
	GridLayout clientLayout = new GridLayout(2, false);
	// Set the margins and spacing based on the tabbed property constants.
	clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN;
	clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN;
	clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE;
	clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE;
	client.setLayout(clientLayout);

	// Make the background of the section client white unless ICE is in
	// debug mode.
	if (System.getProperty("DebugICE") == null) {
		client.setBackground(backgroundColor);
	} else {
		client.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	}

	// Set the client area for the section.
	section.setClient(client);

	// Get the property viewer's ScrolledComposite and its first Composite
	// (its "client" Composite).
	scrollCompositeClient = section.getParent().getParent().getParent()
			.getParent();
	scrollComposite = (ScrolledComposite) scrollCompositeClient.getParent();

	// Add a listener to resize the Section's properties and update the
	// ScrollComposite's minimum bounds correctly based on the displayed
	// properties.
	scrollComposite.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			resizePropertyView();
		}
	});

	// Create the type Combo Composite.
	typeComposite = createTypeComposite(client);
	GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
	gridData.horizontalSpan = 2;
	typeComposite.setLayoutData(gridData);
	// Refresh the contents of the type Combo and its containing Composite.
	refreshTypeWidgets();

	// Create the table of properties.
	tableViewer = createTableViewer(client);
	// Set the table's layout data so it occupies all spare space in the
	// property section client.
	tableViewer.getControl()
			.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	// Create the add/delete buttons.
	Composite buttonComposite = createButtons(client);
	// The button Composite shouldn't grab any space. Align it along the
	// center and top of the space to the right of the table.
	buttonComposite
			.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));

	return;
}
 
Example 20
Source File: HsPreferenceDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout parentcomLayout = new GridLayout();
	parentcomLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	parentcomLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	parentcomLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	parentcomLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	composite.setLayout(parentcomLayout);
	composite.setLayoutData(new GridData(GridData.FILL_BOTH));
	applyDialogFont(composite);

	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

	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);

	super.setPageContainer(pageContainer);
	// 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;
}