org.eclipse.swt.layout.RowData Java Examples

The following examples show how to use org.eclipse.swt.layout.RowData. 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: ColumnBrowserWidget.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a column that displays data
 */
private void createTable() {
	final Table table = new Table(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
	new TableColumn(table, SWT.LEFT);

	table.setLayoutData(new RowData(150, 175));
	columns.add(table);

	addTableListeners(table);

	if (super.getBackground() != null && super.getBackground().getRed() != 240 && super.getBackground().getGreen() != 240 && super.getBackground().getBlue() != 240) {
		table.setBackground(super.getBackground());
	}
	table.setBackgroundImage(super.getBackgroundImage());
	table.setBackgroundMode(super.getBackgroundMode());
	table.setCursor(super.getCursor());
	table.setFont(super.getFont());
	table.setForeground(super.getForeground());
	table.setMenu(super.getMenu());
	table.setToolTipText(super.getToolTipText());

}
 
Example #2
Source File: LaneDescriptionSectionContribution.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory, ExtensibleGridPropertySection page) {

		composite.setLayout(new RowLayout());
		text = widgetFactory.createText(composite, "", SWT.BORDER | SWT.MULTI);
		RowData rd = new RowData();
		rd.width = 300 ;
		rd.height = 60 ;
		text.setLayoutData(rd);
		if (element != null && element.getDocumentation() != null) {
			text.setText(element.getDocumentation());
		}
		
		text.addModifyListener(new ModifyListener() {
			
			public void modifyText(ModifyEvent e) {
				editingDomain.getCommandStack().execute(new SetCommand(editingDomain, element, ProcessPackage.Literals.ELEMENT__DOCUMENTATION, text.getText()));
			}
		});

	}
 
Example #3
Source File: GenericResourceSaveControl.java    From depan with Apache License 2.0 6 votes vote down vote up
public GenericResourceSaveControl(Composite parent, SaveLoadConfig<T> config) {
  super(parent, SWT.NONE);
  this.config = config; 

  setLayout(new RowLayout());

  Button saveButton = new Button(this, SWT.PUSH);
  saveButton.setText(config.getSaveLabel());
  saveButton.setLayoutData(new RowData());

  saveButton.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      handleSave();
    }
  });

}
 
Example #4
Source File: GenericResourceLoadControl.java    From depan with Apache License 2.0 6 votes vote down vote up
public GenericResourceLoadControl(Composite parent, SaveLoadConfig<T> config) {
  super(parent, SWT.NONE);
  this.config = config;

  setLayout(new RowLayout());

  Button loadButton = new Button(this, SWT.PUSH);
  loadButton.setText(config.getLoadLabel());
  loadButton.setLayoutData(new RowData());

  loadButton.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      handleLoad();
    }
  });
}
 
Example #5
Source File: FilterAdvancedComposite.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private Text createValueText ()
{
    final Text t = new Text ( this, SWT.BORDER );
    t.setMessage ( Messages.argument );
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example #6
Source File: FilterAdvancedComposite.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private Combo createAssertionCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    for ( final Assertion assertion : Assertion.values () )
    {
        c.add ( assertion.toString () );
    }
    c.select ( 0 );
    c.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 75;
    c.setLayoutData ( rowData );
    return c;
}
 
Example #7
Source File: FilterAdvancedComposite.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example #8
Source File: ValueComposite.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public ValueComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final boolean isText, final String attribute, final Boolean isDate, final String hdConnectionId, final String hdItemId, final String queryString )
{
    super ( parent, style, format, decimal, isText, attribute );

    this.isDate = isDate;

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.controlImage = new ControlImage ( this, this.registrationManager );
    Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString );

    this.dataLabel = new Label ( this, SWT.NONE );
    final RowData rowData = new RowData ( 80, SWT.DEFAULT );
    this.dataLabel.setAlignment ( SWT.RIGHT );
    this.dataLabel.setLayoutData ( rowData );
    this.dataLabel.setText ( "" ); //$NON-NLS-1$
    new DescriptorLabel ( this, SWT.NONE, format, descriptor );

    if ( descriptor != null )
    {
        this.controlImage.setDetailItem ( descriptor.asItem () );
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
}
 
Example #9
Source File: SeparatorController.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public SeparatorController ( final ControllerManager controllerManager, final ChartContext chartContext, final org.eclipse.scada.ui.chart.model.SeparatorController controller )
{
    final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
    if ( space != null )
    {
        this.label = new Label ( space, SWT.SEPARATOR | SWT.VERTICAL );
        this.label.setLayoutData ( new RowData ( 20, SWT.DEFAULT ) );
        space.layout ();
    }
    else
    {
        this.label = null;
    }
}
 
Example #10
Source File: ProfileManager.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void createAllEntries ()
{
    final Composite extensionSpace = this.extensionSpaceProvider.getExtensionSpace ();
    if ( extensionSpace == null )
    {
        return;
    }

    this.wrapper = new Composite ( extensionSpace, SWT.NONE );
    final RowLayout layout = new RowLayout ( SWT.HORIZONTAL );
    layout.marginTop = layout.marginBottom = 0;
    this.wrapper.setLayout ( layout );

    int i = 0;
    for ( final Profile profile : this.profiles )
    {
        final ProfileEntry entry = createProfileEntry ( profile, i );
        if ( entry != null )
        {
            this.profileEntries.put ( profile.getId (), entry );
        }
        i++;
    }

    final Label sep = new Label ( this.wrapper, SWT.SEPARATOR | SWT.VERTICAL );
    sep.setLayoutData ( new RowData ( SWT.DEFAULT, 20 ) );

    extensionSpace.layout ();
}
 
Example #11
Source File: CameraDirectionGroup.java    From depan with Apache License 2.0 5 votes vote down vote up
public CameraDirectionGroup(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout(SWT.HORIZONTAL));

  Group group = new Group(this, SWT.NONE);
  group.setText("Camera Direction");

  RowLayout row = new RowLayout(SWT.HORIZONTAL);
  row.marginTop = 0;
  row.marginBottom = 0;
  row.marginLeft = 0;
  row.marginRight = 0;
  row.justify = true;
  row.pack = false;
  group.setLayout(row);

  xdirInput = new DirectionInput(group, "X-Dir",
      "Ctrl + Up/Down"
      + "\nShift + Mouse-Left"
      + "\nVertical rotates X");
  xdirInput.setLayoutData(new RowData());
  xdirInput.addModifyListener(INPUT_LISTENER);

  ydirInput = new DirectionInput(group, "Y-Dir", "");
  ydirInput.setLayoutData(new RowData());
  ydirInput.addModifyListener(INPUT_LISTENER);

  zdirInput = new DirectionInput(group, "Z-Dir",
      "Ctrl + Left/Right"
      + "\nShift + Mouse-Left"
      + "\nHorizontal rotates Z");
  zdirInput.setLayoutData(new RowData());
  zdirInput.addModifyListener(INPUT_LISTENER);
}
 
Example #12
Source File: CameraPositionGroup.java    From depan with Apache License 2.0 5 votes vote down vote up
public CameraPositionGroup(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout(SWT.HORIZONTAL));

  Group group = new Group(this, SWT.NONE);
  group.setText("Camera Position");

  RowLayout row = new RowLayout(SWT.HORIZONTAL);
  row.marginTop = 0;
  row.marginBottom = 0;
  row.marginLeft = 0;
  row.marginRight = 0;
  row.justify = true;
  row.pack = false;
  group.setLayout(row);

  xposInput = new PositionInput(group, "X-Pos",
      "Left/Right");
  xposInput.setLayoutData(new RowData());
  xposInput.addModifyListener(INPUT_LISTENER);

  yposInput = new PositionInput(group, "Y-Pos",
      "Up/Down");
  yposInput.setLayoutData(new RowData());
  yposInput.addModifyListener(INPUT_LISTENER);

  zposInput = new PositionInput(group, "Z-Pos",
      "Page-Up/Page-Dn");
  zposInput.setLayoutData(new RowData());
  zposInput.setLimits((int) GLConstants.ZOOM_MAX, (int) (GLConstants.Z_FAR - 1));
  zposInput.addModifyListener(INPUT_LISTENER);
}
 
Example #13
Source File: ToolSeparator.java    From ldparteditor with MIT License 5 votes vote down vote up
public ToolSeparator(Composite parent, int style, boolean isHorizontal) {
    super(parent, style);
    this.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
    if (isHorizontal) {
        this.setLayoutData(new RowData(1, 25));
    } else {
        this.setLayoutData(new RowData(25, 1));
    }
}
 
Example #14
Source File: NewQuestionWizard.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, 0);
    container.setLayout(new RowLayout(SWT.VERTICAL));
    setControl(container);

    Label l1 = new Label(container, 0);
    l1.setText("Question Text");
    textQuestionDescription = new Text(container, SWT.BORDER);
    textQuestionDescription.setLayoutData(new RowData(500, SWT.DEFAULT));

    Group g = new Group(container, 0);
    g.setText("Presets");
    g.setLayout(new RowLayout(SWT.HORIZONTAL));
    createButtonPresetLikert4(g);
    createButtonPresetLikert5(g);

    Label l2 = new Label(container, 0);
    l2.setText("Choices, each line is one possible choice.\nLeave blank if you want free text answers instead.");

    textQuestionChoices = new Text(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    textQuestionChoices.setLayoutData(new RowData(500, textQuestionChoices.getLineHeight() * 6));

    buttonMultipleChoice = new Button(container, SWT.CHECK);
    buttonMultipleChoice.setText("Allow multiple-choice");

    initFromQuestion(initialQuestion);
}
 
Example #15
Source File: CommonConfigurationAttributesPanel.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
private void createUnitsControls(Composite parent, String attr, String label) {
    DataNode dn = DCUtils.findDataNode(parent, true);
    Field unitsField = new UnitField(attr);
    Field numField   = new NumberField(attr);
    dn.addComputedField(numField);
    dn.addComputedField(unitsField);

    createLabel(label, null);

    Composite controlRow = new Composite(parent, SWT.NONE);
    RowLayout rl = new RowLayout();
    rl.marginBottom = rl.marginLeft = rl.marginRight = rl.marginTop = 0;
    rl.center = true;
    controlRow.setLayout(rl);
    GridData gd = createControlGDFill(1);
    controlRow.setLayoutData(gd);

    Composite save = getCurrentParent();
    setCurrentParent(controlRow);

    DCCompositeText text = createDCTextComputed(numField.getName(), new RowData(80, SWT.DEFAULT));
    MultiValidator mv = new MultiValidator();
    mv.add(new StrictNumberValidator(new Double(0), null));
    mv.add(new LengthValidator(0, 7)); // Allow 7 digits
    text.setValidator(mv);

    String[] codes  = { "px", "%" };  //$NON-NLS-1$
    String[] labels = { "Pixels", "Percent" }; // $NLX-CommonConfigurationAttributesPanel.Pixels-1$ $NLX-CommonConfigurationAttributesPanel.Percent-2$

    ILookup lookup = new StringLookup(codes, labels);
    createLabel("Units:", null); // $NLX-CommonConfigurationAttributesPanel.Units-1$
    DCCompositeCombo combo = createComboComputed(unitsField.getName(), lookup, null, true, false);

    unitsField.setControls(text, combo);
    numField.setControls(text, combo);
    setCurrentParent(save);
}
 
Example #16
Source File: ProgressComposite.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public ProgressComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final String attribute, final double max, final double min, final double factor, final int width, final String hdConnectionId, final String hdItemId, final String queryString )
{
    super ( parent, style, format, decimal, false, attribute );

    if ( max != 0 )
    {
        this.max = max;
    }

    if ( min != 0 )
    {
        this.min = min;
    }

    if ( factor != 0 )
    {
        this.factor = factor;
    }

    if ( width > 0 )
    {
        this.width = width;
    }

    addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            ProgressComposite.this.handleDispose ();
        }
    } );

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.progressWidth = this.width - this.textWidth - layout.spacing;
    if ( this.progressWidth < 1 )
    {
        this.progressWidth = 1;
    }

    this.controlImage = new ControlImage ( this, this.registrationManager );
    Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString );

    this.progressBar = new ProgressBar ( this, SWT.NONE );
    //        this.progressBar.setSize ( this.progressWidth, this.textHeight );
    final RowData progressData = new RowData ( this.progressWidth, SWT.DEFAULT );
    this.progressBar.setLayoutData ( progressData );
    final int minimum = (int)Math.round ( this.min );
    final int maximum = (int)Math.round ( this.max );
    this.progressBar.setMinimum ( minimum );
    this.progressBar.setMaximum ( maximum );

    this.text = new Text ( this, SWT.MULTI | SWT.WRAP | SWT.RIGHT );
    //        final RowData rowData = new RowData ( 60, SWT.DEFAULT );
    //        this.font = new Font ( getDisplay (), new FontData ( "Arial", 10, 0 ) ); //$NON-NLS-1$
    //        this.text.setFont ( this.font );
    final RowData rowData = new RowData ( this.textWidth, this.textHeight );
    //        this.dataText.setAlignment ( SWT.RIGHT );
    this.text.setLayoutData ( rowData );
    this.text.setEnabled ( true );
    this.text.setEditable ( false );

    this.text.setText ( "" ); //$NON-NLS-1$
    new DescriptorLabel ( this, SWT.NONE, format, descriptor );

    if ( descriptor != null )
    {
        this.controlImage.setDetailItem ( descriptor.asItem () );
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
}
 
Example #17
Source File: ExportFileDestinationPane.java    From AppleCommander with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create and display the wizard pane.
 * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
 */
public void open() {
	control = new Composite(parent, SWT.NULL);
	control.setLayoutData(layoutData);
	wizard.enableNextButton(false);
	wizard.enableFinishButton(true);
	RowLayout layout = new RowLayout(SWT.VERTICAL);
	layout.justify = true;
	layout.marginBottom = 5;
	layout.marginLeft = 5;
	layout.marginRight = 5;
	layout.marginTop = 5;
	layout.spacing = 3;
	control.setLayout(layout);
	Label label = new Label(control, SWT.WRAP);
	label.setText(textBundle.get("ExportFilePrompt")); //$NON-NLS-1$

	directoryText = new Text(control, SWT.WRAP | SWT.BORDER);
	if (wizard.getDirectory() != null) directoryText.setText(wizard.getDirectory());
	directoryText.setLayoutData(new RowData(parent.getSize().x - 30, -1));
	directoryText.setBackground(new Color(control.getDisplay(), 255,255,255));
	directoryText.setFocus();
	directoryText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			Text text = (Text) event.getSource();
			getWizard().setDirectory(text.getText());
		}
	});
	
	Button button = new Button(control, SWT.PUSH);
	button.setText(textBundle.get("BrowseButton")); //$NON-NLS-1$
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
			directoryDialog.setFilterPath(getDirectoryText().getText());
			directoryDialog.setMessage(
				UiBundle.getInstance().get("ExportFileDirectoryPrompt")); //$NON-NLS-1$
			String directory = directoryDialog.open();
			if (directory != null) {
				getDirectoryText().setText(directory);
			}
		}
	});
}
 
Example #18
Source File: NewProjectDesign.java    From ldparteditor with MIT License 4 votes vote down vote up
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_Container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_Container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    Label lbl_newProject = new Label(cmp_Container, SWT.NONE);
    if (saveAs) {
        lbl_newProject.setText(I18n.PROJECT_SaveProject);
    } else {
        lbl_newProject.setText(I18n.PROJECT_CreateNewProject);
    }

    Label lbl_separator = new Label(cmp_Container, SWT.SEPARATOR | SWT.HORIZONTAL);
    lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Label lbl_projectLocation = new Label(cmp_Container, SWT.NONE);
    lbl_projectLocation.setText(I18n.PROJECT_ProjectLocation);

    Composite cmp_pathChooser1 = new Composite(cmp_Container, SWT.NONE);
    cmp_pathChooser1.setLayout(new RowLayout(SWT.HORIZONTAL));

    Text txt_ldrawPath = new Text(cmp_pathChooser1, SWT.BORDER);
    this.txt_projectPath[0] = txt_ldrawPath;
    txt_ldrawPath.setEditable(false);
    txt_ldrawPath.setLayoutData(new RowData(294, SWT.DEFAULT));
    if (!saveAs || Project.getProjectPath().equals(new File(Project.DEFAULT_PROJECT_PATH).getAbsolutePath())) {
        txt_ldrawPath.setText(""); //$NON-NLS-1$
    } else {
        String authorFolder = WorkbenchManager.getUserSettingState().getAuthoringFolderPath();
        txt_ldrawPath.setText(new File(Project.getProjectPath()).getParent().substring(authorFolder.length()));
    }

    NButton btn_BrowseLdrawPath = new NButton(cmp_pathChooser1, SWT.NONE);
    this.btn_browseProjectPath[0] = btn_BrowseLdrawPath;
    btn_BrowseLdrawPath.setText(I18n.DIALOG_Browse);

    Label lbl_projectName = new Label(cmp_Container, SWT.NONE);
    lbl_projectName.setText(I18n.PROJECT_ProjectName);

    Composite cmp_projectName = new Composite(cmp_Container, SWT.NONE);
    cmp_projectName.setLayout(new RowLayout(SWT.HORIZONTAL));

    Text txt_projectName = new Text(cmp_projectName, SWT.BORDER);
    this.txt_projectName[0] = txt_projectName;
    txt_projectName.setLayoutData(new RowData(294, SWT.DEFAULT));

    if (!txt_ldrawPath.getText().isEmpty() && saveAs) {
        txt_projectName.setText(Project.getProjectName());
    }

    return cmp_Container;
}
 
Example #19
Source File: WorkspaceMergeDialog.java    From MergeProcessor with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void finishedRun() {
	clearCursors();

	if (isConfirmCommit) {
		((RowData) buttonConfirmCommit.getLayoutData()).exclude = false;
		buttonConfirmCommit.setVisible(true);
	}

	if (commitButton.getListeners(SWT.Selection).length > 1) {
		commitButton.setVisible(true);
		((GridData) commitButton.getLayoutData()).exclude = false;
		if (isConfirmCommit) {
			commitButton.setEnabled(false);
		}
	}

	if (openButton.getListeners(SWT.Selection).length > 1) {
		openButton.setVisible(true);
		((GridData) openButton.getLayoutData()).exclude = false;
	}

	if (openWorkingCopyButton.getListeners(SWT.Selection).length > 1) {
		openWorkingCopyButton.setVisible(true);
		((GridData) openWorkingCopyButton.getLayoutData()).exclude = false;
	}

	if (openTortoiseSvnButton.getListeners(SWT.Selection).length > 1) {
		openTortoiseSvnButton.setVisible(true);
		((GridData) openTortoiseSvnButton.getLayoutData()).exclude = false;
	}

	closeButton.setVisible(true);
	((GridData) closeButton.getLayoutData()).exclude = false;

	final Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
	cancelButton.setVisible(false);
	((GridData) cancelButton.getLayoutData()).exclude = true;

	if (warningsTableViewer.getList().getItemCount() > 0) {
		((GridData) warningsTableViewer.getList().getParent().getLayoutData()).exclude = false;
		warningsTableViewer.getList().setVisible(true);
	}

	final Point size = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
	getShell().setSize(size);
	getShell().layout(true, true);
}