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

The following examples show how to use org.eclipse.swt.widgets.Composite#setBackgroundMode() . 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: MainEntryPoint.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createFooter ( final Composite parent )
{
    final Composite footer = new Composite ( parent, SWT.NONE );

    footer.setLayout ( new RowLayout () );

    footer.setData ( RWT.CUSTOM_VARIANT, "footer" );
    footer.setBackgroundMode ( SWT.INHERIT_DEFAULT );

    final Label label = new Label ( footer, SWT.NONE );
    label.setText ( System.getProperty ( Properties.FOOTER_TEXT, "Eclipse SCADA Admin Console" ) );

    return footer;
}
 
Example 2
Source File: ConnectionDetailsView.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    parent.setBackgroundMode ( SWT.INHERIT_FORCE );
    this.view = new DetailsView ( parent );
    getViewSite ().getWorkbenchWindow ().getSelectionService ().addSelectionListener ( new ISelectionListener () {

        @Override
        public void selectionChanged ( final IWorkbenchPart part, final ISelection selection )
        {
            ConnectionDetailsView.this.view.setSelection ( selection );
        }
    } );
    this.view.setSelection ( getViewSite ().getWorkbenchWindow ().getSelectionService ().getSelection () );
}
 
Example 3
Source File: CodeRecommendationView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create contents of the view part.
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
	super.createPartControl(parent);

	Composite container = new Composite(parent, SWT.NONE);
	container.setBackgroundMode(SWT.INHERIT_FORCE);
	container.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	container.setLayout(new GridLayout(1, false));
	{
		SashForm sashForm = new SashForm(container, SWT.NONE);
		sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		{
			resultsComposite = new Composite(sashForm, SWT.NONE);
			resultsComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			resultsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
			{
				Label lblInitiateACode = new Label(resultsComposite, SWT.NONE);
				lblInitiateACode.setText("Initiate a code recommendation request first, to see the results here");
			}
		}
		{
			previewComposite = new Composite(sashForm, SWT.NONE);
			StackLayout layout = new StackLayout();
			previewComposite.setLayout(layout);
			lblSelectAPattern = new Label(previewComposite, SWT.CENTER);
			lblSelectAPattern.setEnabled(false);
			lblSelectAPattern.setText("Select a pattern to open in preview");
			layout.topControl = lblSelectAPattern;
		}
		sashForm.setWeights(new int[] { 1, 1 });
	}

	createActions();
	initializeToolBar();
	initializeMenu();
}
 
Example 4
Source File: ApiDocumentationView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create contents of the view part.
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NONE);
	super.createPartControl(container);

	StackLayout layout = new StackLayout();
	getComposite().setLayout(layout);

	defaultMessageComposite = new Composite(getComposite(), SWT.NONE);
	defaultMessageComposite.setBackgroundMode(SWT.INHERIT_FORCE);
	defaultMessageComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	defaultMessageComposite.setLayout(new GridLayout(1, false));

	Label lblNewLabel = new Label(defaultMessageComposite, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblNewLabel.setText("Results of API documentation and Q&&A posts will be shown here.");

	resultsScrolledComposite = new ScrolledComposite(getComposite(), SWT.BORDER | SWT.V_SCROLL);
	resultsScrolledComposite.setAlwaysShowScrollBars(true);
	resultsScrolledComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	resultsScrolledComposite.setExpandHorizontal(true);
	resultsScrolledComposite.setExpandVertical(true);

	resultsVerticalList = new VerticalList(resultsScrolledComposite, SWT.NONE);
	resultsVerticalList.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	resultsScrolledComposite.setContent(resultsVerticalList);
	resultsScrolledComposite.setMinSize(resultsVerticalList.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	layout.topControl = defaultMessageComposite;

	createActions();
	initializeToolBar();
	initializeMenu();
}
 
Example 5
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 6
Source File: DataItemToolTip.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Composite createToolTipContentArea ( final Event event, final Composite parent )
{
    parent.setLayout ( new FillLayout () );
    final Composite wrapper = new Composite ( parent, SWT.NONE );

    wrapper.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            DataItemToolTip.this.resourceManager.dispose ();
        }
    } );

    final GridLayout layout = new GridLayout ( 2, false );
    layout.marginHeight = 10;
    layout.marginWidth = 10;
    layout.horizontalSpacing = 20;
    layout.verticalSpacing = 20;

    wrapper.setLayout ( layout );
    wrapper.setBackground ( wrapper.getDisplay ().getSystemColor ( SWT.COLOR_WHITE ) );
    wrapper.setBackgroundMode ( SWT.INHERIT_DEFAULT );

    this.headerLabel = new Label ( wrapper, SWT.NONE );
    this.headerLabel.setText ( this.item.getId () );
    this.headerLabel.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false, 2, 1 ) );
    this.headerLabel.setFont ( JFaceResources.getHeaderFont () );

    final Label warnIcon = new Label ( wrapper, SWT.NONE );
    warnIcon.setLayoutData ( new GridData ( SWT.CENTER, SWT.CENTER, false, false ) );
    warnIcon.setImage ( Activator.getDefault ().getImageRegistry ().get ( Activator.IMG_WARN_BIG ) );

    this.text = new StyledText ( wrapper, SWT.MULTI );
    this.text.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );

    if ( this.currentText != null )
    {
        this.text.setText ( this.currentText.getString () );
        this.text.setStyleRanges ( this.currentText.getStyleRanges () );
    }

    return wrapper;
}
 
Example 7
Source File: ListComponentSectionPage.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Get the parent form and the toolkit
	final ScrolledForm scrolledForm = managedForm.getForm();
	final FormToolkit formToolkit = managedForm.getToolkit();

	// Set a GridLayout with a single column. Remove the default margins.
	GridLayout layout = new GridLayout(1, true);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	scrolledForm.getBody().setLayout(layout);

	// Only create something if there is valid input.
	if (list != null) {

		// Get the parent
		Composite parent = managedForm.getForm().getBody();

		shell = parent.getShell();
		// Create the section and set its layout info
		Section listSection = formToolkit.createSection(parent,
				ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
						| ExpandableComposite.TWISTIE
						| ExpandableComposite.EXPANDED
						| ExpandableComposite.COMPACT);
		listSection.setLayout(new GridLayout(1, false));
		listSection.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Create the section client, which is the client area of the
		// section that will actually render data.
		sectionClient = new Composite(listSection, SWT.FLAT);
		sectionClient.setLayout(new GridLayout(2, false));
		sectionClient.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Fixes section header bug where label color is spammed
		sectionClient.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		// Fixes background color bug for NatTable
		sectionClient.setBackgroundMode(SWT.INHERIT_FORCE);

		// Draws the table and sets that instance variable
		table = new ListComponentNattable(sectionClient, list, true);

		// Create the buttons for add, delete, up, and down
		createButtons();

		// Set the section client.
		listSection.setClient(sectionClient);
	}

	return;
}
 
Example 8
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 9
Source File: ConfigurationSettingsWizardPage.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createLeftColumn(Composite composite) {
  Group leftColumn = new Group(composite, SWT.NONE);
  leftColumn.setLayout(LayoutUtils.createGridLayout(5, 0));
  leftColumn.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_left_column_connection);

  /*
   * prepare network setting composite
   */
  Composite autoconnectComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ELCL_XMPP_CONNECTED);
  autoconnectComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  autoconnectComposite.setLayout(LayoutUtils.createGridLayout(0, 5));
  autoconnectComposite.setBackgroundMode(SWT.INHERIT_NONE);

  /*
   * auto connect
   */
  Label autoConnectLabel = new Label(autoconnectComposite, SWT.WRAP);
  autoConnectLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  autoConnectLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_autoconnect);

  this.autoConnectButton = new Button(autoconnectComposite, SWT.CHECK | SWT.LEFT);
  this.autoConnectButton.setText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_autoconnect);

  /*
   * separator
   */
  new Label(leftColumn, SWT.SEPARATOR | SWT.HORIZONTAL)
      .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

  // Gateway port mapping setting
  Composite gatewayComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ICON_UPNP);
  gatewayComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  gatewayComposite.setLayout(LayoutUtils.createGridLayout(0, 5));
  gatewayComposite.setBackgroundMode(SWT.INHERIT_NONE);

  portmappingLabel = new Label(gatewayComposite, SWT.WRAP);
  portmappingLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  portmappingLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_portmapping);

  this.setupPortmappingButton = new Button(gatewayComposite, SWT.CHECK | SWT.LEFT | SWT.WRAP);
  this.setupPortmappingButton.setText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_portmapping);
  this.setupPortmappingButton.setToolTipText(
      saros.ui.Messages.ConfigurationSettingsWizardPage_button_portmapping_tooltip);
  setupPortmappingButton.setEnabled(false);

  Composite comboCompo = new Composite(gatewayComposite, SWT.TOP | SWT.LEFT);
  RowLayout rowLayout = new RowLayout();
  rowLayout.marginLeft = 16;
  comboCompo.setLayout(rowLayout);
  gatewaysCombo = new Combo(comboCompo, SWT.DROP_DOWN | SWT.READ_ONLY);
  gatewayInfo = new Label(comboCompo, SWT.NONE);
  gatewayInfo.setEnabled(false);

  /*
   * separator
   */
  new Label(leftColumn, SWT.SEPARATOR | SWT.HORIZONTAL)
      .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  /*
   * skype
   */
  Composite skypeComposite =
      new IllustratedComposite(leftColumn, SWT.TOP, ImageManager.ELCL_CONTACT_SKYPE_CALL);
  skypeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
  skypeComposite.setLayout(LayoutUtils.createGridLayout(2, false, 0, 5));
  skypeComposite.setBackgroundMode(SWT.INHERIT_NONE);

  Label skypeLabel = new Label(skypeComposite, SWT.WRAP);
  skypeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
  skypeLabel.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_label_skype);

  Composite skypeUsageComposite = new Composite(skypeComposite, SWT.NONE);
  skypeUsageComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
  skypeUsageComposite.setLayout(LayoutUtils.createGridLayout(2, false, 0, 5));

  this.skypeUsageButton = new Button(skypeUsageComposite, SWT.CHECK);
  this.skypeUsageButton.setText(saros.ui.Messages.ConfigurationSettingsWizardPage_yes_use);

  this.skypeUsernameText = new Text(skypeComposite, SWT.BORDER);
  this.skypeUsernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  return leftColumn;
}