org.eclipse.swt.widgets.Spinner Java Examples

The following examples show how to use org.eclipse.swt.widgets.Spinner. 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: SeriesSheetImpl.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void initZOrderUI( Composite parent )
{
	spnZOrder = new Spinner( parent, SWT.BORDER );
	{
		GridData gd = new GridData( );
		gd.horizontalAlignment = SWT.CENTER;
		spnZOrder.setLayoutData( gd );
		spnZOrder.setMinimum( 0 );
		spnZOrder.setMaximum( 10 );
		if ( getChart( ) instanceof ChartWithAxes
				&& !( getContext( ).getChartType( ) instanceof BubbleChart )
				&& getChart( ).getDimension( ) == ChartDimension.TWO_DIMENSIONAL_LITERAL )
		{
			// Bubble chart has special z order
			spnZOrder.setSelection( seriesDefn.getZOrder( ) );
			spnZOrder.addSelectionListener( this );
		}
		else
		{
			spnZOrder.setEnabled( false );
		}
		ChartUIUtil.addSpinnerScreenReaderAccessbility( spnZOrder,
				Messages.getString( "SeriesSheetImpl.Label.ZOrder" ) ); //$NON-NLS-1$
	}
}
 
Example #2
Source File: DayDateCombo.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param parent
 * @param text1
 *            the text to display in front of the spinner
 * @param text2
 *            the text to display between spinner and DatePicker
 * @param text1Neg
 *            the text to display in front of the spinner if date is before today
 * @param text2Neg
 *            the text to display between spinner and DatePicker if date is before today
 * @since 3.1
 */
public DayDateCombo(Composite parent, String text1, String text2, String text1Neg,
	String text2Neg){
	super(parent, SWT.NONE);
	
	this.text1 = text1;
	this.text2 = text2;
	this.text1Neg = text1Neg;
	this.text2Neg = text2Neg;
	
	ttNow = new TimeTool();
	ttNow.chop(3);
	setLayout(new RowLayout(SWT.HORIZONTAL));
	frontLabel = UiDesk.getToolkit().createLabel(this, text1);
	spl = new SpinnerListener();
	dl = new DateListener();
	spinner = new Spinner(this, SWT.NONE);
	middleLabel = UiDesk.getToolkit().createLabel(this, text2);
	dp = new DatePickerCombo(this, SWT.NONE);
	setListeners();
}
 
Example #3
Source File: RelationCountFilterEditorControl.java    From depan with Apache License 2.0 6 votes vote down vote up
/**
 * Construct the {@code RangeTool} UI with the given set of options.
 * 
 * @param parent containing window for range tool
 * @param style basic presentation options
 */
public RangeTool(Composite parent, int style,
    String label, RelationCount.RangeData setup) {
  super(parent, style);

  setLayout(new RowLayout());

  Label rangeLabel = new Label(this, SWT.LEFT);
  rangeLabel.setText(label);

  rangeOp = createRangeOp(setup.option);
  loLabel = new Label(this, SWT.LEFT);
  loLimit = new Spinner(this, style);
  hiLabel = new Label(this, SWT.LEFT);
  hiLimit = new Spinner(this, style);
  setLimits(setup);
}
 
Example #4
Source File: SpinnerField.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public SpinnerField(Composite parent, int displayBits, String displayName, int min, int max){
	super(parent, displayBits, displayName);
	final Spinner spinner = new Spinner(this, SWT.NONE);
	spinner.setMaximum(max);
	spinner.setMinimum(min);
	spinner.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e){
			int v = spinner.getSelection();
			textContents = Integer.toString(v);
			fireChangedEvent();
		}
		
	});
	setControl(spinner);
	
}
 
Example #5
Source File: UIHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Retrieves the control from the viewer
 */
public static Control getWidget(Object control) {
	if (control instanceof Viewer) {
		return ((Viewer) control).getControl();
	} else if (control instanceof Text) {
		return (Text) control;
	} else if (control instanceof Button) {
		return (Control) control;
	} else if (control instanceof Spinner) {
		return (Control) control;
	} else if (control instanceof Combo) {
		return (Control) control;
	} else if (control instanceof Control) {
		// why not return the control when object is instanceof control?
		return null;
	}

	return null;
}
 
Example #6
Source File: CameraDirectionGroup.java    From depan with Apache License 2.0 6 votes vote down vote up
private void handleDirectionChange(Spinner input) {

    // Ignore bad input
    float value;
    try {
      String text = input.getText();
      value = Float.parseFloat(text);
    } catch (NumberFormatException e) {
      return;
    }

    if (xdirInput.isControl(input)) {
      fireXChanged(value);
    } else if (ydirInput.isControl(input)) {
      fireYChanged(value);
    } else if (zdirInput.isControl(input)) {
      fireZChanged(value);
    }
  }
 
Example #7
Source File: SankeySelectionDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createCutoffSpinner(FormToolkit tk, Composite comp) {
	tk.createLabel(comp, M.DontShowSmallerThen);
	Composite inner = tk.createComposite(comp);
	UI.gridLayout(inner, 2, 10, 0);
	Spinner spinner = new Spinner(inner, SWT.BORDER);
	spinner.setIncrement(100);
	spinner.setMinimum(0);
	spinner.setMaximum(100000);
	spinner.setDigits(3);
	spinner.setSelection((int) (cutoff * 100000));
	spinner.addModifyListener(e -> {
		cutoff = spinner.getSelection() / 100000d;
	});
	tk.adapt(spinner);
	tk.createLabel(inner, "%");
}
 
Example #8
Source File: CameraPositionGroup.java    From depan with Apache License 2.0 6 votes vote down vote up
private void handlePositionChange(Spinner input) {

    // Ignore bad input
    float value;
    try {
      String text = input.getText();
      value = Float.parseFloat(text);
    } catch (NumberFormatException e) {
      return;
    }

    if (xposInput.isControl(input)) {
      fireXChanged(value);
    } else if (yposInput.isControl(input)) {
      fireYChanged(value);
    } else if (zposInput.isControl(input)) {
      fireZChanged(value);
    }
  }
 
Example #9
Source File: AttachMainTab.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
@Override public void createControl(Composite parent) {
	Composite res = new Composite(parent, SWT.NONE);
	res.setLayout(new GridLayout(3, false));
	Label pidLabel = new Label(res, SWT.NONE);
	pidLabel.setText(Messages.AttachMainTab_processId);
	// As pid is volatile, additionally to PID, we should store the
	// CLI param of selected PID to easily discover other PID started
	// with same params.
	pidText = new Spinner(res, SWT.BORDER);
	pidText.setMinimum(0);
	pidText.setMaximum(Integer.MAX_VALUE);
	pidText.setLayoutData(new GridData(120, SWT.DEFAULT));
	pidText.addModifyListener(e -> {
		setDirty(true);
		updateLaunchConfigurationDialog();
	});
	// with Java 9, add a Search button showing a "ProcessSelectionDialog"
	// filtering process using dotnet as command.
	setControl(res);
}
 
Example #10
Source File: AttachTab.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
	resComposite = new Composite(parent, SWT.NONE);
	resComposite.setLayout(new GridLayout(2, false));
	resComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	new Label(resComposite, SWT.NONE).setText(Messages.AttachTab_address);
	this.addressText = new Text(resComposite, SWT.BORDER);
	this.addressText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
	this.addressText.addModifyListener(event -> {
		setDirty(true);
		updateLaunchConfigurationDialog();
	});
	new Label(resComposite, SWT.NONE).setText(Messages.AttachTab_port);
	this.portSpinner = new Spinner(resComposite, SWT.BORDER);
	this.portSpinner.setMinimum(0);
	this.portSpinner.setMaximum(65535);
	this.portSpinner.addModifyListener(e -> {
		setDirty(true);
		updateLaunchConfigurationDialog();
	});
	setControl(resComposite);
}
 
Example #11
Source File: SpinnerTests.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public void testSpinnerFieldNext() throws Exception {
	VNative<Spinner> spinner = tester.getSpinner();
	assertNotNull(spinner);

	int original = tester.getCDateTime().activeField;
	System.out.println(original);

	moveToEdge(tester.getCDateTime(), SWT.RIGHT);
	moveX(-10);

	click(2);

	int active = tester.getCDateTime().activeField;
	System.out.println(active);

	assertTrue(active > original);
}
 
Example #12
Source File: PWSpinner.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite)
 */
@Override
public Control build(final Composite parent) {
	buildLabel(parent, GridData.CENTER);
	final Spinner spinner = new Spinner(parent, SWT.HORIZONTAL | SWT.BORDER);
	addControl(spinner);
	spinner.setMinimum(min);
	spinner.setMaximum(max);
	final Integer originalValue = (Integer) PreferenceWindow.getInstance().getValueFor(getPropertyKey());
	spinner.setSelection(originalValue.intValue());

	spinner.addListener(SWT.Modify, event -> {
		PreferenceWindow.getInstance().setValue(getPropertyKey(), Integer.valueOf(spinner.getSelection()));
	});

	return spinner;
}
 
Example #13
Source File: SWTFactory.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param parent
 * @param min
 * @param max
 * @param hspan
 * @param style
 * @return
 */
public static Spinner createSpinner(Composite parent, int min, int max, int hspan, int style)
{
	Spinner spinner = new Spinner(parent, SWT.BORDER | style);
	spinner.setMinimum(min);
	spinner.setMaximum(max);

	GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false, hspan, 1);
	PixelConverter pc = new PixelConverter(spinner);
	// See http://jira.appcelerator.org/browse/APSTUD-3215
	// We need to add some extra spacing to the MacOSX spinner in order to adjust the size to the way Mac draws
	// spinners.
	int extraWidth = Platform.OS_MACOSX.equals(Platform.getOS()) ? 25 : 0;
	gd.widthHint = pc.convertWidthInCharsToPixels(2) + extraWidth;
	spinner.setLayoutData(gd);
	return spinner;
}
 
Example #14
Source File: GalleryExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createItemParametersGroup(Composite parent) {
	Group dataGroup = createEmptyGroup(parent, "Item parameters");
	dataGroup.setLayout(new RowLayout());

	cItemRenderer = new Combo(dataGroup, SWT.READ_ONLY);
	cItemRenderer.setItems(new String[] { "Icon", "List" });
	cItemRenderer.setText("Icon");
	cItemRenderer.addListener(SWT.Selection, itemRendererParamSelectionListener);

	bItemDropShadow = createButton(dataGroup, SWT.CHECK, "Drop shadow", false, true);

	sItemDropShadowSize = new Spinner(dataGroup, SWT.NONE);
	sItemDropShadowSize.setMinimum(0);
	sItemDropShadowSize.setMaximum(20);
	sItemDropShadowSize.setIncrement(1);
	sItemDropShadowSize.setSelection(5);
	sItemDropShadowSize.addListener(SWT.Selection, itemRendererParamSelectionListener);

	bItemLabel = createButton(dataGroup, SWT.CHECK, "Display labels", false, true);
}
 
Example #15
Source File: GalleryExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createDecoratorsGroup(Composite parent) {
	Group dataGroup = createEmptyGroup(parent, "Decorators");
	dataGroup.setLayout(new RowLayout());

	sDecoratorNumber = new Spinner(dataGroup, SWT.NONE);
	sDecoratorNumber.setMinimum(1);
	sDecoratorNumber.setMaximum(5);
	sDecoratorNumber.setIncrement(1);
	sDecoratorNumber.setSelection(1);
	sDecoratorNumber.addListener(SWT.Selection, contentParamSelectionListener);

	bDecoratorLeft = createButton(dataGroup, SWT.CHECK, "Top Left", false, false);
	bDecoratorLeft.addListener(SWT.Selection, contentParamSelectionListener);
	bDecoratorUp = createButton(dataGroup, SWT.CHECK, "Top Right", false, false);
	bDecoratorUp.addListener(SWT.Selection, contentParamSelectionListener);
	bDecoratorRight = createButton(dataGroup, SWT.CHECK, "Bottom Right", false, false);
	bDecoratorRight.addListener(SWT.Selection, contentParamSelectionListener);
	bDecoratorDown = createButton(dataGroup, SWT.CHECK, "Bottom Left", false, false);
	bDecoratorDown.addListener(SWT.Selection, contentParamSelectionListener);
}
 
Example #16
Source File: GalleryExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createAnimationGroup(Composite parent) {
	Group animationGroup = createEmptyGroup(parent, "Animation");
	animationGroup.setLayout(new RowLayout());

	bAnimation = createButton(animationGroup, SWT.CHECK, "Animations", false, false);
	bAnimation.addListener(SWT.Selection, groupParamSelectionListener);

	cAnimationMovement = new Combo(animationGroup, SWT.READ_ONLY);
	cAnimationMovement.setItems(new String[] { "ExpoOut", "BounceOut", "ElasticOut", "LinearInOut" });
	cAnimationMovement.setText("ExpoOut");
	cAnimationMovement.addListener(SWT.Selection, groupParamSelectionListener);

	sAnimationDuration = new Spinner(animationGroup, SWT.NONE);
	sAnimationDuration.setMinimum(250);
	sAnimationDuration.setMaximum(5000);
	sAnimationDuration.setIncrement(100);
	sAnimationDuration.setSelection(500);
	sAnimationDuration.addListener(SWT.Selection, groupParamSelectionListener);
}
 
Example #17
Source File: LocationPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createCombos(Composite body, FormToolkit tk) {

		Composite outer = tk.createComposite(body);
		UI.gridLayout(outer, 2, 5, 0);
		Composite comboComp = tk.createComposite(outer);
		UI.gridLayout(comboComp, 2);
		combos = Combo.on(result)
				.onSelected(this::onSelected)
				.withSelection(result.getFlows().iterator().next())
				.create(comboComp, tk);

		Composite cutoffComp = tk.createComposite(outer);
		UI.gridLayout(cutoffComp, 1, 0, 0);
		GridData gd = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
		cutoffComp.setLayoutData(gd);

		Composite checkComp = tk.createComposite(cutoffComp);
		tk.createLabel(checkComp, M.DontShowSmallerThen);
		Spinner spinner = new Spinner(checkComp, SWT.BORDER);
		spinner.setValues(1, 0, 100, 0, 1, 10);
		tk.adapt(spinner);
		tk.createLabel(checkComp, "%");
		Controls.onSelect(spinner, e -> {
			cutoff = (spinner.getSelection()) / 100d;
			refreshSelection();
		});

		UI.gridLayout(checkComp, 5);
		Button zeroCheck = UI.formCheckBox(checkComp, tk, M.ExcludeZeroEntries);
		zeroCheck.setSelection(skipZeros);
		Controls.onSelect(zeroCheck, event -> {
			skipZeros = zeroCheck.getSelection();
			refreshSelection();
		});
	}
 
Example #18
Source File: ControlBindingManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ControlBindingManager(IPreferenceDelegate delegate, IStatusChangeListener listener)
{
	this.checkBoxControls = new HashMap<Button, Object>();
	this.comboControls = new HashMap<Combo, Object>();
	this.textControls = new HashMap<Text, Object>();
	this.radioControls = new HashMap<Button, String>();
	this.spinnerControls = new HashMap<Spinner, Object>();
	this.listControls = new HashMap<CListViewer, Object>();

	this.validatorManager = new ValidatorManager();
	this.dependencyManager = new DependencyManager();

	this.changeListener = listener;
	this.preferenceDelegate = delegate;
}
 
Example #19
Source File: ProcessResultPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createImpactSection(Composite parent) {
	Section section = UI.section(parent, toolkit,
			M.ImpactAssessmentResults);
	UI.gridData(section, true, true);
	Composite composite = toolkit.createComposite(section);
	section.setClient(composite);
	UI.gridLayout(composite, 1);

	Composite container = new Composite(composite, SWT.NONE);
	UI.gridLayout(container, 5);
	UI.gridData(container, true, false);
	UI.formLabel(container, toolkit, M.Process);
	impactProcessCombo = new ProcessViewer(container);
	impactProcessCombo.setInput(processes.values());
	impactProcessCombo.addSelectionChangedListener((selection) -> {
		impactResult.setProcess(selection);
		impactTable.refresh();
	});
	UI.formLabel(container, toolkit, M.DontShowSmallerThen);
	impactSpinner = new Spinner(container, SWT.BORDER);
	impactSpinner.setValues(1, 0, 10000, 2, 1, 100);
	toolkit.adapt(impactSpinner);
	toolkit.createLabel(container, "%");
	Controls.onSelect(impactSpinner, (e) -> {
		impactCutOff = impactSpinner.getSelection();
		impactTable.refresh();
	});
	impactTable = createImpactTable(composite);
}
 
Example #20
Source File: ProcessResultPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createFlowSection(Composite parent) {
	Section section = UI.section(parent, toolkit,
			M.FlowContributionsToProcessResults);
	UI.gridData(section, true, true);
	Composite comp = toolkit.createComposite(section);
	section.setClient(comp);
	UI.gridLayout(comp, 1);

	Composite container = new Composite(comp, SWT.NONE);
	UI.gridData(container, true, false);
	UI.gridLayout(container, 5);
	UI.formLabel(container, toolkit, M.Process);
	flowProcessViewer = new ProcessViewer(container);
	flowProcessViewer.setInput(processes.values());
	flowProcessViewer.addSelectionChangedListener((selection) -> {
		flowResult.setProcess(selection);
		inputTable.refresh();
		outputTable.refresh();
	});

	UI.formLabel(container, toolkit, M.DontShowSmallerThen);
	flowSpinner = new Spinner(container, SWT.BORDER);
	flowSpinner.setValues(1, 0, 10000, 2, 1, 100);
	toolkit.adapt(flowSpinner);
	toolkit.createLabel(container, "%");
	Controls.onSelect(flowSpinner, (e) -> {
		flowCutOff = flowSpinner.getSelection();
		inputTable.refresh();
		outputTable.refresh();
	});

	Composite resultContainer = new Composite(comp, SWT.NONE);
	resultContainer.setLayout(new GridLayout(2, true));
	UI.gridData(resultContainer, true, true);
	UI.formLabel(resultContainer, M.Inputs);
	UI.formLabel(resultContainer, M.Outputs);
	inputTable = createFlowTable(resultContainer);
	outputTable = createFlowTable(resultContainer);
}
 
Example #21
Source File: Bug320656.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void testSpinnerSelection() throws Exception {
	VNative<Spinner> spinner = tester.getSpinner();
	assertNotNull(spinner);

	long original = tester.getSelection().getTime();

	moveToEdge(tester.getCDateTime(), SWT.RIGHT | SWT.TOP);
	// sleep(5000);
	// System.out.println(tester.getSelection().getTime());
	moveX(-15);
	moveY(5);
	// sleep(5000);
	click();
	// System.out.println(tester.getSelection().getTime());
	long time = tester.getSelection().getTime();
	assertTrue("Difference = " + (original - time), time == original + (60 * 60 * 1000));

	keyPress(SWT.ARROW_RIGHT);
	moveToEdge(tester.getCDateTime(), SWT.RIGHT | SWT.BOTTOM);
	moveX(-15);
	moveY(-8);
	click();
	original = time;
	time = tester.getSelection().getTime();
	assertTrue("Difference = " + (original - time), time == original - (60 * 1000));

}
 
Example #22
Source File: NumberInput.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create an empty number input with a default increment of 5, a minimum of 5 and a maximum of
 * 1440 (which happens to be the number of minutes in a day)
 * 
 * @param parent
 * @param label
 *            the label to display on top of the input field
 */
public NumberInput(Composite parent, String label){
	super(parent, SWT.NONE);
	setLayout(new GridLayout());
	new Label(this, SWT.NONE).setText(label);
	inp = new Spinner(this, SWT.NONE);
	inp.setMinimum(5);
	inp.setMaximum(1440);
	inp.setIncrement(5);
}
 
Example #23
Source File: SpinnerField.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void push(){
	UiDesk.syncExec(new Runnable() {
		public void run(){
			Spinner spinner = (Spinner) ctl;
			spinner.setSelection(Integer.parseInt(textContents));
		}
	});
}
 
Example #24
Source File: ChartSpinner.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void placeComponents( int styles, boolean enabled, String label, String endLabel ) 
{
	int colNum = 1;
	if ( label != null )
		colNum++;
	if ( endLabel != null )
		colNum++;
	GridLayout gl = new GridLayout( );
	gl.numColumns = colNum;
	gl.makeColumnsEqualWidth = false;
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginLeft = 0;
	gl.marginRight = 0;
	gl.marginTop = 0;
	gl.marginWidth = 0;
	this.setLayout( gl );
	if ( label != null )
	{
		lblLabel = new Label( this, SWT.NONE );
		lblLabel.setText( label );
	}
	spinner = new Spinner( this, styles );
	GridData gd = new GridData( GridData.FILL_BOTH );
	spinner.setLayoutData( gd );
	setEnabled( enabled );
	if ( endLabel != null )
	{
		lblEndLabel = new Label( this, SWT.NONE );
		lblEndLabel.setText( endLabel );
	}
}
 
Example #25
Source File: CameraDirectionGroup.java    From depan with Apache License 2.0 5 votes vote down vote up
private Spinner setupDirection(Composite parent) {
  Spinner result = new Spinner(parent, SWT.NONE);
  result.setMinimum(-180);
  result.setMaximum(180);
  result.setIncrement(1);
  result.setPageIncrement(10);
  return result;
}
 
Example #26
Source File: DateUtil.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public static Long getWidgetMillisecondAsLong(Spinner yearSpinner,Spinner monthSpinner,Spinner daySpinner, Spinner hourSpinner,Spinner minutesSpinner,Spinner secondsSpinner) {
	
	
	long duration = 0;
	
	if(yearSpinner != null && !yearSpinner.isDisposed()){
		duration = (long)((long)yearSpinner.getSelection()*(long)3600000*(long)24*(long)30*(long)12) ;
	}
	
	if(monthSpinner != null && !monthSpinner.isDisposed()){
		duration += (long)((long)monthSpinner.getSelection()*(long)3600000* (long)24* (long) 30) ;
	}
	
	if(daySpinner != null && !daySpinner.isDisposed()){
		duration +=  (long)((long)daySpinner.getSelection()*(long)(3600000*(long)24)) ;
	}
	
	if(hourSpinner != null && !hourSpinner.isDisposed()){
		duration +=  (long)((long)hourSpinner.getSelection()*(long)(3600000)) ;
	}
	
	if(minutesSpinner != null && !minutesSpinner.isDisposed()){
		duration +=  (long)((long)minutesSpinner.getSelection()*(long)(60000)) ;
	}
	
	if(secondsSpinner != null && !secondsSpinner.isDisposed()){
		duration +=  (long)((long)secondsSpinner.getSelection()*(long)(1000)) ;
	}
	
	return duration;

}
 
Example #27
Source File: PageSettingDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void setMarginSpinner(Spinner spinner) {
    spinner.setDigits(1);
    spinner.setIncrement(5);
    spinner.setMinimum(0);
    spinner.setMaximum(1000);
    spinner.setSelection(20);
}
 
Example #28
Source File: ControlBindingManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void initSpinners()
{
	Iterator<Spinner> it = spinnerControls.keySet().iterator();
	while (it.hasNext())
	{
		final Spinner spinner = it.next();
		final Object key = spinnerControls.get(spinner);
		String value = preferenceDelegate.getString(key);
		if (!StringUtil.isEmpty(value))
		{
			spinner.setSelection(Integer.parseInt(value));
		}
	}
}
 
Example #29
Source File: SpinnerNumberField.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static Spinner createFieldSpinner(FieldWidget<Integer> field, Composite parent, int style) {
	final Spinner spinner = new Spinner(parent, style);
	spinner.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			field.setFieldValueFromControl(spinner.getSelection());
		}
	});
	return spinner;
}
 
Example #30
Source File: ChartUIUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Add specified description to composite to support Screen Reader tool.
 * 
 * @param composite composite
 * @param description description
 */
public static void addScreenReaderAccessbility( Control composite,
		final String description )
{
	if ( composite == null )
	{
		// if control component is null, do nothing.
		return;
	}
	if ( description != null )
	{
		if ( composite instanceof Spinner )
		{
			addSpinnerScreenReaderAccessbility( (Spinner) composite, description );
		}
		else
		{
			composite.getAccessible( )
					.addAccessibleListener( new AccessibleAdapter( ) {

						public void getName( AccessibleEvent e )
						{
							e.result = description.replaceAll( "&", IConstants.EMPTY_STRING ) //$NON-NLS-1$
									.replaceAll( ":", IConstants.EMPTY_STRING ) //$NON-NLS-1$
									.replaceAll( "\\*", IConstants.EMPTY_STRING ); //$NON-NLS-1$
						}
					} );
		}
		
	}
}