Java Code Examples for org.eclipse.swt.widgets.Text#setEnabled()

The following examples show how to use org.eclipse.swt.widgets.Text#setEnabled() . 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: VersionGridPropertySectionContribution.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory, ExtensibleGridPropertySection page) {
    context = new EMFDataBindingContext();

    UpdateValueStrategy versionUpdate = new UpdateValueStrategy();
    versionUpdate.setAfterGetValidator(new EmptyInputValidator(Messages.GeneralSection_Version));
    versionUpdate.setBeforeSetValidator(new UTF8InputValidator(Messages.GeneralSection_Version));

    Text text = new Text(composite, GTKStyleHandler.removeBorderFlag(SWT.BORDER));
    text.setLayoutData(GridDataFactory.swtDefaults().hint(160, SWT.DEFAULT).grab(false, false).create());
    if (!GTKStyleHandler.isGTK3()) {
        widgetFactory.adapt(text, true, true);
    }
    text.setEnabled(false);
    
    context.bindValue(WidgetProperties.text(SWT.Modify).observe(text),
    	EMFEditObservables.observeValue(editingDomain, process, ProcessPackage.Literals.ABSTRACT_PROCESS__VERSION), 
    	versionUpdate, 
    	null);
}
 
Example 2
Source File: MappingDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setTabFlags( Button wMainPath, Label wlInputStep, Text wInputStep, Button wbInputStep,
                          Label wlOutputStep, Text wOutputStep, Button wbOutputStep, Label wlDescription,
                          Text wDescription ) {
  boolean mainPath = wMainPath.getSelection();
  wlInputStep.setEnabled( !mainPath );
  wInputStep.setEnabled( !mainPath );
  wbInputStep.setEnabled( !mainPath );
  wlOutputStep.setEnabled( !mainPath );
  wOutputStep.setEnabled( !mainPath );
  wbOutputStep.setEnabled( !mainPath );
  wlDescription.setEnabled( !mainPath );
  wDescription.setEnabled( !mainPath );
}
 
Example 3
Source File: MongoDBDataSetWizardPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createDBNameArea( Composite topArea )
{
	Composite composite = new Composite( topArea, SWT.NONE );
	GridLayout layout = new GridLayout( 2, false );
	layout.horizontalSpacing = 15;
	composite.setLayout( layout );
	composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

	DBNameLabel = new Label( composite, SWT.NONE );
	DBNameLabel.setText( Messages.getString( "MongoDBDataSetWizardPage.label.DBName" ) ); //$NON-NLS-1$

	DBNameText = new Text( composite, SWT.NONE );
	DBNameText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	DBNameText.setEnabled( false );
}
 
Example 4
Source File: BeginnerTaskQuestionPage.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
private Group createNote(final Composite parent, final Question question, boolean visible) {
	final Group notePanel = new Group(parent, SWT.NONE);
	notePanel.setText("Note:");
	final GridLayout gridLayout = new GridLayout();
	notePanel.setLayout(gridLayout);
	final GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false);
	gridData.horizontalSpan = 1;
	notePanel.setLayoutData(gridData);
	final Font boldFont = new Font(notePanel.getDisplay(), new FontData(Constants.ARIAL, 10, SWT.BOLD));
	notePanel.setFont(boldFont);
	notePanel.pack();
	setControl(parent);

	Text note = new Text(notePanel, SWT.MULTI | SWT.WRAP);
	note.setLayoutData(new GridData(GridData.FILL_BOTH));
	String noteText = question.getNote();
	if (noteText.contains("$$$")) {
		noteText = noteText.split("\\$\\$\\$")[1];
	}
	note.setText(noteText);
	note.pack();
	note.setBounds(10, 20, 585, 60);
	note.setSize(note.computeSize(585, SWT.DEFAULT));
	setControl(notePanel);
	note.setEditable(false);
	note.setEnabled(true);
	notePanel.setVisible(visible);
	return notePanel;
}
 
Example 5
Source File: AbstractNamePropertySectionContribution.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createControl(final Composite composite, final TabbedPropertySheetWidgetFactory widgetFactory,
        final ExtensibleGridPropertySection page) {

    context = new EMFDataBindingContext();

    Composite container = widgetFactory.createPlainComposite(composite,SWT.NONE);
    container.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 3, 3).numColumns(useEditButton() ? 2 : 1).create());
    container.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, true).create());
   

    text = new Text(container, GTKStyleHandler.removeBorderFlag(SWT.BORDER));
    if (!GTKStyleHandler.isGTK3()) {
        widgetFactory.adapt(text, true, true);
    }
    text.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).hint(250, SWT.DEFAULT).create());
    text.setText(element.getName());
    if (useEditButton()) {
        text.setEnabled(false);
    }
    if (!(element instanceof SequenceFlow)) {

        if (useEditButton()) {
            final Button editDiagramNameButton = widgetFactory.createButton(container, Messages.edit, SWT.FLAT);
            editDiagramNameButton.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    editProcessNameAndVersion();
                }
            });
        }

    }
    createBinding(context);
    updatePropertyTabTitle();
}
 
Example 6
Source File: AddOrEditSrxConfigDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridDataFactory.fillDefaults().grab(true, true).hint(500, 500).minSize(500, 500).applyTo(tparent);

	Composite nameCmp = new Composite(tparent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);

	Label nameLbl = new Label(nameCmp, SWT.NONE);
	nameLbl.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.nameLbl"));

	Text nameTxt = new Text(nameCmp, SWT.BORDER);
	nameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	nameTxt.setText(curSrxName);
	nameTxt.setEnabled(false);

	GridData groupData = new GridData(SWT.FILL, SWT.FILL, true, true);
	GridLayout groupLayout = new GridLayout(4, false);

	createLanguageGroup(tparent, groupData, groupLayout);
	createMapGroup(tparent, groupData, groupLayout);
	initListener();

	refreshLangTable(null);
	refreshMapTable(null);

	return tparent;
}
 
Example 7
Source File: AddRemoteServiceDialog.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Wide text input.
 *
 * @param tc the tc
 * @param tip the tip
 * @param listener the listener
 * @return the text
 */
private Text wideTextInput(Composite tc, String tip, DialogModifyListener listener) {
  Text t = newText(tc, SWT.BORDER, tip);
  t.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
  if (listener != null) {
    t.addModifyListener(listener);
  } else {
    t.setEnabled(false);
  }
  return t;
}
 
Example 8
Source File: PopulationEditor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Control createCustomParameterControl(final Composite compo) {
	populationDisplayer = new Text(compo, SWT.READ_ONLY);
	populationDisplayer.setEnabled(false);
	final GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
	populationDisplayer.setLayoutData(data);
	return populationDisplayer;
}
 
Example 9
Source File: MappingDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void setTabFlags( Button wMainPath, Label wlInputTransform, Text wInputTransform, Button wbInputTransform,
                          Label wlOutputTransform, Text wOutputTransform, Button wbOutputTransform, Label wlDescription,
                          Text wDescription ) {
  boolean mainPath = wMainPath.getSelection();
  wlInputTransform.setEnabled( !mainPath );
  wInputTransform.setEnabled( !mainPath );
  wbInputTransform.setEnabled( !mainPath );
  wlOutputTransform.setEnabled( !mainPath );
  wOutputTransform.setEnabled( !mainPath );
  wbOutputTransform.setEnabled( !mainPath );
  wlDescription.setEnabled( !mainPath );
  wDescription.setEnabled( !mainPath );
}
 
Example 10
Source File: ChangeSignatureWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createReturnTypeControl(Composite parent) {
	Composite returnType= new Composite(parent, SWT.NONE);
	returnType.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout= new GridLayout(1, false);
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	returnType.setLayout(layout);

	Label label= new Label(returnType, SWT.NONE);
	label.setText(RefactoringMessages.ChangeSignatureInputPage_return_type);

	final Text text= new Text(returnType, SWT.BORDER);
	text.setText(getChangeMethodSignatureProcessor().getReturnTypeString());
	text.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
	TextFieldNavigationHandler.install(text);

	if (getChangeMethodSignatureProcessor().canChangeNameAndReturnType()) {
		text.addModifyListener(new ModifyListener(){
			public void modifyText(ModifyEvent e) {
				getChangeMethodSignatureProcessor().setNewReturnTypeName(text.getText());
				update(true);
			}
		});
	} else {
		text.setEnabled(false);
	}

	JavaTypeCompletionProcessor processor= new JavaTypeCompletionProcessor(true, true);
	StubTypeContext stubTypeContext= getChangeMethodSignatureProcessor().getStubTypeContext();
	processor.setCompletionContext(stubTypeContext.getCuHandle(), stubTypeContext.getBeforeString(), stubTypeContext.getAfterString());
	ControlContentAssistHelper.createTextContentAssistant(text, processor);
}
 
Example 11
Source File: ChangeSignatureWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createNameControl(Composite parent) {
	Composite name= new Composite(parent, SWT.NONE);
	name.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout= new GridLayout(1, false);
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	name.setLayout(layout);

	Label label= new Label(name, SWT.NONE);
	label.setText(RefactoringMessages.ChangeSignatureInputPage_method_name);

	final Text text= new Text(name, SWT.BORDER);
	text.setText(getChangeMethodSignatureProcessor().getMethodName());
	text.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
	TextFieldNavigationHandler.install(text);

	if (getChangeMethodSignatureProcessor().canChangeNameAndReturnType()) {
		text.addModifyListener(new ModifyListener(){
			public void modifyText(ModifyEvent e) {
				getChangeMethodSignatureProcessor().setNewMethodName(text.getText());
				update(true);
			}
		});
	} else {
		text.setEnabled(false);
	}
}
 
Example 12
Source File: AddOrEditSrxConfigDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridDataFactory.fillDefaults().grab(true, true).hint(500, 500).minSize(500, 500).applyTo(tparent);

	Composite nameCmp = new Composite(tparent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);

	Label nameLbl = new Label(nameCmp, SWT.NONE);
	nameLbl.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.nameLbl"));

	Text nameTxt = new Text(nameCmp, SWT.BORDER);
	nameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	nameTxt.setText(curSrxName);
	nameTxt.setEnabled(false);

	GridData groupData = new GridData(SWT.FILL, SWT.FILL, true, true);
	GridLayout groupLayout = new GridLayout(4, false);

	createLanguageGroup(tparent, groupData, groupLayout);
	createMapGroup(tparent, groupData, groupLayout);
	initListener();

	refreshLangTable(null);
	refreshMapTable(null);

	return tparent;
}
 
Example 13
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected Composite createToolbar2() {
	final Composite t = new Composite(composite, SWT.NONE);
	final GridData d = new GridData(SWT.FILL, SWT.TOP, false, false);
	t.setLayoutData(d);
	t.setBackground(HOVERED_BACKGROUND);
	final GridLayout id =
			GridLayoutFactory.fillDefaults().equalWidth(false).extendedMargins(0, 0, 0, 0).spacing(0, 0).create();
	final GridData gd =
			GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).indent(0, -1).create();
	t.setLayout(id);
	final String unitText = computeUnitLabel();
	if (!unitText.isEmpty()) {
		unitItem = new Text(t, SWT.READ_ONLY | SWT.FLAT);
		unitItem.setText(unitText);
		unitItem.setBackground(HOVERED_BACKGROUND);
		unitItem.setEnabled(false);
	}
	if (isEditable) {
		final int[] codes = this.getToolItems();
		for (final int i : codes) {
			Button item = null;
			switch (i) {
				case REVERT:
					item = createItem(t, "Revert to original value", GamaIcons.create("small.revert").image());
					break;
				case PLUS:
					item = createPlusItem(t);
					break;
				case MINUS:
					item = createItem(t, "Decrement the parameter",
							GamaIcons.create(IGamaIcons.SMALL_MINUS).image());
					break;
				case EDIT:
					item = createItem(t, "Edit the parameter", GamaIcons.create("small.edit").image());
					break;
				case INSPECT:
					item = createItem(t, "Inspect the agent", GamaIcons.create("small.inspect").image());
					break;
				case BROWSE:
					item = createItem(t, "Browse the list of agents", GamaIcons.create("small.browse").image());
					break;
				case CHANGE:
					item = createItem(t, "Choose another agent", GamaIcons.create("small.change").image());
					break;
				case DEFINE:
					item = createItem(t, "Set the parameter to undefined",
							GamaIcons.create("small.undefine").image());
			}
			if (item != null) {
				items[i] = item;
				item.setBackground(HOVERED_BACKGROUND);
				item.setLayoutData(GridDataFactory.copyData(gd));
				;
				item.addSelectionListener(new ItemSelectionListener(i));

			}
		}
	}
	id.numColumns = t.getChildren().length;
	t.layout();
	t.pack();
	return t;

}
 
Example 14
Source File: NewReportPageSupport.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the project location specification controls.
 * 
 * @param group
 *            the parent composite
 * @param enabled
 *            the initial enabled state of the widgets created
 */
private void createUserSpecifiedProjectLocationGroup( Composite group,
		boolean enabled )
{
	Font font = group.getFont( );

	// location label
	locationLabel = new Label( group, SWT.NONE );
	locationLabel.setText( LABEL_DIRECTORY );
	locationLabel.setEnabled( enabled );
	locationLabel.setFont( font );

	// file location entry field
	locationPathField = new Text( group, SWT.BORDER );
	GridData data = new GridData( GridData.FILL_HORIZONTAL );
	data.widthHint = 250;
	locationPathField.setLayoutData( data );
	locationPathField.setEnabled( enabled );
	locationPathField.setFont( font );

	// browse button
	browseButton = new Button( group, SWT.PUSH );
	browseButton.setText( LABEL_BROWSE );
	browseButton.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			handleLocationBrowseButtonPressed( );
		}
	} );

	browseButton.setEnabled( enabled );
	browseButton.setFont( font );
	setButtonLayoutData( browseButton );

	if ( defaultFileLocation != null )
	{
		locationPathField.setText( defaultFileLocation );
	}
	else
	{
		locationPathField.setText( "" );//$NON-NLS-1$
	}
}
 
Example 15
Source File: CustomFiltersDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Overrides method in Dialog
 *
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
@Override
protected Control createDialogArea(Composite parent) {
	initializeDialogUnits(parent);
	// create a composite with standard margins and spacing
	Composite composite= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	composite.setLayout(layout);
	composite.setLayoutData(new GridData(GridData.FILL_BOTH));
	composite.setFont(parent.getFont());
	Composite group= composite;

	// Checkbox
	fEnableUserDefinedPatterns= new Button(group, SWT.CHECK);
	fEnableUserDefinedPatterns.setFocus();
	fEnableUserDefinedPatterns.setText(FilterMessages.CustomFiltersDialog_enableUserDefinedPattern);

	// Pattern	field
	fUserDefinedPatterns= new Text(group, SWT.SINGLE | SWT.BORDER);
	GridData  data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
	data.widthHint= convertWidthInCharsToPixels(59);
	fUserDefinedPatterns.setLayoutData(data);
	String patterns= convertToString(fPatterns, SEPARATOR);
	fUserDefinedPatterns.setText(patterns);
	SWTUtil.setAccessibilityText(fUserDefinedPatterns, FilterMessages.CustomFiltersDialog_name_filter_pattern_description);

	// Info text
	final Label info= new Label(group, SWT.LEFT);
	info.setText(FilterMessages.CustomFiltersDialog_patternInfo);

	// Enabling / disabling of pattern group
	fEnableUserDefinedPatterns.setSelection(fEnablePatterns);
	fUserDefinedPatterns.setEnabled(fEnablePatterns);
	info.setEnabled(fEnablePatterns);
	fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			boolean state= fEnableUserDefinedPatterns.getSelection();
			fUserDefinedPatterns.setEnabled(state);
			info.setEnabled(fEnableUserDefinedPatterns.getSelection());
			if (state)
				fUserDefinedPatterns.setFocus();
		}
	});

	// Filters provided by extension point
	if (fBuiltInFilters.length > 0)
		createCheckBoxList(group);

	applyDialogFont(parent);
	return parent;
}
 
Example 16
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected void setTextFieldEnabled(Key key, boolean enabled) {
	Text text= getTextControl(key);
	Label label= fLabels.get(text);
	text.setEnabled(enabled);
	label.setEnabled(enabled);
}
 
Example 17
Source File: NewDataflowProjectWizardLandingPage.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
  Composite formComposite = new Composite(parent, SWT.NULL);
  formComposite.setLayout(new GridLayout(3, false));
  setControl(formComposite);
  setHelp(formComposite);
  
  groupIdInput = addLabeledText(formComposite, Messages.getString("group.id")); //$NON-NLS-1$
  groupIdInput.setMessage(Messages.getString("example.group.id"));//$NON-NLS-1$
  groupIdInput.setToolTipText(Messages.getString("GROUP_ID_TOOLTIP")); //$NON-NLS-1$
  artifactIdInput = addLabeledText(formComposite, Messages.getString("artifact.id")); //$NON-NLS-1$
  artifactIdInput.setToolTipText(Messages.getString("ARTIFACT_ID_TOOLTIP")); //$NON-NLS-1$

  templateDropdown = addCombo(formComposite,
      Messages.getString("project.template"), true); //$NON-NLS-1$
  for (DataflowProjectArchetype template : DataflowProjectArchetype.values()) {
    templateDropdown.add(template.getLabel());
  }
  templateVersionDropdown = addCombo(formComposite,
      Messages.getString("dataflow.version"), false); //$NON-NLS-1$

  templateDropdown.select(0);
  updateAvailableVersions();

  packageInput = addLabeledText(formComposite, Messages.getString("package")); //$NON-NLS-1$
  packageInput.setToolTipText(Messages.getString("package.tooltip")); //$NON-NLS-1$
  packageInput.setMessage(Messages.getString("example.group.id"));//$NON-NLS-1$

  // Add a labeled text and button for the default location.
  Group locationGroup = new Group(formComposite, SWT.NULL);
  locationGroup.setLayoutData(gridSpan(GridData.FILL_HORIZONTAL, 3));
  locationGroup.setLayout(new GridLayout(3, false));

  useDefaultLocation = addCheckbox(locationGroup,
      Messages.getString("use.default.workspace.location"), true); //$NON-NLS-1$

  addLabel(locationGroup, Messages.getString("location")); //$NON-NLS-1$

  String defaultLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
  locationInput = new Text(locationGroup, SWT.SINGLE | SWT.BORDER);
  locationInput.setText(defaultLocation);
  locationInput.setEnabled(false);
  locationInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  locationInput.setToolTipText(Messages.getString("location.tooltip")); //$NON-NLS-1$

  locationBrowse = ButtonFactory.newPushButton(locationGroup, Messages.getString("browse")); //$NON-NLS-1$
  locationBrowse.setEnabled(false);

  projectNameTemplate = addCombo(formComposite, Messages.getString("name.template"), false); //$NON-NLS-1$
  projectNameTemplate.setToolTipText(Messages.getString("name.template.tooltip")); //$NON-NLS-1$
  projectNameTemplate.add("[artifactId]"); //$NON-NLS-1$
  projectNameTemplate.add("[groupId]-[artifactId]"); //$NON-NLS-1$
  projectNameTemplate.setLayoutData(gridSpan(GridData.FILL_HORIZONTAL, 1));

  // Register all the listeners
  addListeners(defaultLocation);

  formComposite.layout();
  parent.layout();

  AnalyticsPingManager.getInstance().sendPingOnShell(parent.getShell(),
      AnalyticsEvents.DATAFLOW_NEW_PROJECT_WIZARD);
}
 
Example 18
Source File: RangeSliderSnippet.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private static void createDifferentSliders(final Group group) {
	group.setLayout(new GridLayout(3, false));

	final TitledSeparator tsh = new TitledSeparator(group, SWT.NONE);
	tsh.setText("Horizontal Range Slider, between 100 and 1000, increment by 100");
	tsh.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));

	final RangeSlider hRangeSlider = new RangeSlider(group, SWT.HORIZONTAL);
	final GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 2);
	gd.widthHint = 250;
	hRangeSlider.setLayoutData(gd);
	hRangeSlider.setMinimum(100);
	hRangeSlider.setMaximum(1000);
	hRangeSlider.setLowerValue(200);
	hRangeSlider.setUpperValue(800);
	hRangeSlider.setIncrement(100);
	hRangeSlider.setPageIncrement(200);

	final Label hLabelLower = new Label(group, SWT.NONE);
	hLabelLower.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	hLabelLower.setText("Lower Value:");

	final Text hTextLower = new Text(group, SWT.BORDER);
	hTextLower.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	hTextLower.setText(hRangeSlider.getLowerValue() + "   ");
	hTextLower.setEnabled(false);

	final Label hLabelUpper = new Label(group, SWT.NONE);
	hLabelUpper.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	hLabelUpper.setText("Upper Value:");

	final Text hTextUpper = new Text(group, SWT.BORDER);
	hTextUpper.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	hTextUpper.setText(hRangeSlider.getUpperValue() + "   ");
	hTextUpper.setEnabled(false);

	final TitledSeparator tsv = new TitledSeparator(group, SWT.NONE);
	tsv.setText("Vertical Range Slider, between 100 and 1000, increment by 100");
	tsv.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));

	final RangeSlider vRangeSlider = new RangeSlider(group, SWT.VERTICAL);
	final GridData gd2 = new GridData(GridData.CENTER, GridData.FILL, false, false, 1, 2);
	gd2.heightHint = 300;
	vRangeSlider.setLayoutData(gd2);
	vRangeSlider.setMinimum(100);
	vRangeSlider.setMaximum(1000);
	vRangeSlider.setLowerValue(200);
	vRangeSlider.setUpperValue(800);
	vRangeSlider.setIncrement(100);
	vRangeSlider.setPageIncrement(200);

	final Label vLabelLower = new Label(group, SWT.NONE);
	vLabelLower.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	vLabelLower.setText("Lower Value:");

	final Text vTextLower = new Text(group, SWT.BORDER);
	vTextLower.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	vTextLower.setText(vRangeSlider.getLowerValue() + "   ");
	vTextLower.setEnabled(false);

	final Label vLabelUpper = new Label(group, SWT.NONE);
	vLabelUpper.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	vLabelUpper.setText("Upper Value:");

	final Text vTextUpper = new Text(group, SWT.BORDER);
	vTextUpper.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	vTextUpper.setText(vRangeSlider.getUpperValue() + "   ");
	vTextUpper.setEnabled(false);

}
 
Example 19
Source File: RangeSliderSnippet.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private static void createDisabledSliders(final Group group) {
	group.setLayout(new GridLayout(3, false));

	final TitledSeparator tsh = new TitledSeparator(group, SWT.NONE);
	tsh.setText("Horizontal Range Slider, disabled");
	tsh.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));

	final RangeSlider hRangeSlider = new RangeSlider(group, SWT.HORIZONTAL);
	final GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 2);
	gd.widthHint = 250;
	hRangeSlider.setLayoutData(gd);
	hRangeSlider.setMinimum(0);
	hRangeSlider.setMaximum(100);
	hRangeSlider.setLowerValue(0);
	hRangeSlider.setUpperValue(60);
	hRangeSlider.setEnabled(false);

	final Label hLabelLower = new Label(group, SWT.NONE);
	hLabelLower.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	hLabelLower.setText("Lower Value:");

	final Text hTextLower = new Text(group, SWT.BORDER);
	hTextLower.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	hTextLower.setText(hRangeSlider.getLowerValue() + "   ");
	hTextLower.setEnabled(false);

	final Label hLabelUpper = new Label(group, SWT.NONE);
	hLabelUpper.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	hLabelUpper.setText("Upper Value:");

	final Text hTextUpper = new Text(group, SWT.BORDER);
	hTextUpper.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	hTextUpper.setText(hRangeSlider.getUpperValue() + "   ");
	hTextUpper.setEnabled(false);

	final TitledSeparator tsv = new TitledSeparator(group, SWT.NONE);
	tsv.setText("Vertical Range Slider, disabled");
	tsv.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));

	final RangeSlider vRangeSlider = new RangeSlider(group, SWT.VERTICAL);
	final GridData gd2 = new GridData(GridData.CENTER, GridData.FILL, false, false, 1, 2);
	gd2.heightHint = 300;
	vRangeSlider.setLayoutData(gd2);
	vRangeSlider.setEnabled(false);

	final Label vLabelLower = new Label(group, SWT.NONE);
	vLabelLower.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	vLabelLower.setText("Lower Value:");

	final Text vTextLower = new Text(group, SWT.BORDER);
	vTextLower.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	vTextLower.setText(vRangeSlider.getLowerValue() + "   ");
	vTextLower.setEnabled(false);

	final Label vLabelUpper = new Label(group, SWT.NONE);
	vLabelUpper.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));
	vLabelUpper.setText("Upper Value:");

	final Text vTextUpper = new Text(group, SWT.BORDER);
	vTextUpper.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
	vTextUpper.setText(vRangeSlider.getUpperValue() + "   ");
	vTextUpper.setEnabled(false);

}
 
Example 20
Source File: SnippetCheckBoxGroup.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
	final FillLayout layout1 = new FillLayout(SWT.VERTICAL);
	layout1.marginWidth = layout1.marginHeight = 10;
	shell.setLayout(layout1);

	// Displays the group
	final CheckBoxGroup group = new CheckBoxGroup(shell, SWT.NONE);
	group.setLayout(new GridLayout(4, false));
	group.setText("Use proxy server");

	final Composite content = group.getContent();

	final Label lblServer = new Label(content, SWT.NONE);
	lblServer.setText("Server:");
	lblServer.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtServer = new Text(content, SWT.NONE);
	txtServer.setText("proxy.host.com");
	txtServer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblPort = new Label(content, SWT.NONE);
	lblPort.setText("Port:");
	lblPort.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtPort = new Text(content, SWT.NONE);
	txtPort.setText("1234");
	txtPort.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblUser = new Label(content, SWT.NONE);
	lblUser.setText("User ID:");
	lblUser.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtUser = new Text(content, SWT.NONE);
	txtUser.setText("MyName");
	txtUser.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblPassword = new Label(content, SWT.NONE);
	lblPassword.setText("Password:");
	lblPassword.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtPassword = new Text(content, SWT.PASSWORD);
	txtPassword.setText("password");
	txtPassword.setEnabled(false);
	txtPassword.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	// Open the shell
	shell.setSize(640, 360);
	SWTGraphicUtil.centerShell(shell);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}