@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); Label labelDescription = new Label(composite, SWT.WRAP); labelDescription.setText("Limit chars logs"); final Spinner spinnerBox = new Spinner(composite, SWT.WRAP); spinnerBox.setMaximum(MAX_LOG_CHARS); spinnerBox.setMinimum(MIN_LOG_CHARS); spinnerBox.setSelection(limitLogsChars); spinnerBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); spinnerBox.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { limitLogsChars = Integer.parseInt(spinnerBox.getText()); } }); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setLayout(new GridLayout(2, false)); return composite; }
@Override protected void createWidgets(String text, String toolTip, Integer initialValue) { lbl = new Label(this, SWT.NONE); lbl.setText(text); spinner = new Spinner(this, SWT.CHECK); spinner.setToolTipText(toolTip); spinner.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Integer value = spinner.getSelection(); if (value != getValue()) { setValue(value, false); } } }); }
@Override protected void createWidgets(String text, String toolTip, Double initialValue) { lbl = new Label(this, SWT.NONE); lbl.setText(text); spinner = new Spinner(this, SWT.CHECK); spinner.setToolTipText(toolTip); spinner.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { double value = spinner.getSelection() / scale; if (value != getValue()) { setValue(value, false); } } }); }
/** * 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 Control) { // why not return the control when object is instanceof control? return null; } return null; }
private void setSelectedColor(Control control, boolean selection) { if (selection) { control.setForeground(control.getParent().getForeground()); if (!((control instanceof Text) || (control instanceof Combo) || (control instanceof MultiChoice<?>) || (control instanceof Spinner))) { control.setBackground(BACKGROUND_COLOR); } } else { control.setForeground(BTSUIConstants.VIEW_FOREGROUND_DESELECTED_COLOR); control.setBackground(BTSUIConstants.VIEW_BACKGROUND_DESELECTED_COLOR); } if (control instanceof Composite) { for (Control child : ((Composite) control).getChildren()) { setSelectedColor(child, selection); } } }
private LinesPerPageDialog(Shell parentShell) { shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText("Lines per Page"); shell.setLayout(new GridLayout(3, true)); spinner = new Spinner(shell, 0); spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); spinner.setValues(bzStyledText.getLinesPerPage(), 0, 225, 0, 1, 10); spinner.addKeyListener(this); okButton = new Button(shell, SWT.PUSH); okButton.setText("OK"); okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); okButton.addSelectionListener(this); cancelButton = new Button(shell, SWT.PUSH); cancelButton.setText("Cancel"); cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); cancelButton.addSelectionListener(this); shell.pack(); shell.open(); }
private CharsPerLineDialog(Shell parentShell) { shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText("Characters Per Line"); shell.setLayout(new GridLayout(3, true)); spinner = new Spinner(shell, 0); spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); spinner.setValues(bzStyledText.getCharsPerLine(), 0, 27720, 0, 1, 10); spinner.addKeyListener(this); okButton = new Button(shell, SWT.PUSH); okButton.setText("OK"); okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); okButton.addSelectionListener(this); cancelButton = new Button(shell, SWT.PUSH); cancelButton.setText("Cancel"); cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); cancelButton.addSelectionListener(this); shell.pack(); shell.open(); }
private LineMarginBellDialog(Shell parentShell) { shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText("Bell Margin"); shell.setLayout(new GridLayout(3, true)); spinner = new Spinner(shell, 0); spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); spinner.setValues(bzStyledText.getLineMarginBell(), 0, 27720, 0, 1, 10); spinner.addKeyListener(this); okButton = new Button(shell, SWT.PUSH); okButton.setText("OK"); okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); okButton.addSelectionListener(this); cancelButton = new Button(shell, SWT.PUSH); cancelButton.setText("Cancel"); cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); cancelButton.addSelectionListener(this); shell.pack(); shell.open(); }
private PageMarginBellDialog(Shell parentShell) { shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText("Bell Page"); shell.setLayout(new GridLayout(3, true)); spinner = new Spinner(shell, 0); spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); spinner.setValues(bzStyledText.getPageMarginBell(), 0, 27720, 0, 1, 10); spinner.addKeyListener(this); okButton = new Button(shell, SWT.PUSH); okButton.setText("OK"); okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); okButton.addSelectionListener(this); cancelButton = new Button(shell, SWT.PUSH); cancelButton.setText("Cancel"); cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); cancelButton.addSelectionListener(this); shell.pack(); shell.open(); }
public void storeOptionValues() { IPreferenceStore store = getPreferenceStore(); controlMap.forEach((serviceId, optionControlPairs) -> { optionControlPairs.forEach(optionControlPair -> { Option<?> option = optionControlPair.getLeft(); Control control = optionControlPair.getRight(); String storeKey = Activator.getStoreKey(serviceId, option); option.matchVoid(booleanOption -> { store.setValue(storeKey, ((Button) control).getSelection()); }, numberOption -> { store.setValue(storeKey, ((Spinner) control).getSelection()); }, textOption -> { store.setValue(storeKey, ((Text) control).getText()); }, xorOption -> { store.setValue(storeKey, ((Combo) control).getSelectionIndex()); }, optionGroup -> { }); }); }); }
/** * 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); }
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); } }
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); } }
@Override public void refresh() { final String value = getSimpleValueOrDefault(); if (StringUtils.isNotEmpty(value)) { for (final Control childControl : periodControl.getChildren()) { if (childControl instanceof Spinner) { Spinner actualControl = (Spinner) childControl; String periodKey = (String) childControl.getData("PERIOD_KEY"); PeriodPropertyElement element = PeriodPropertyElement.byShortFormat(periodKey); if (element != null) { actualControl.setSelection(ExtensionPropertyUtil.getPeriodPropertyElementFromValue(value, element)); } } } } }
/** * Create a radio button followed by a spinner with a maximum and a minimum value. At the radio * button can be associated a governor. This object define how the color picker area is painted. * This is done because when a button is selected its governor is set into the color picker widget * changing the color space. When a radio button created with this method is selected all the other * are deselected. * * @param parent parent of the controls * @param title content of a label placed as text of the radio button * @param suffix content of a label placed after the spinner * @param governor the governor that is loaded in the color picker widget when the button is selected * @param defaultEnabled true if the radio button is enabled by default, false otherwise * @param min min int value for the spinner * @param max max int value for the spinner * @return the spinner created */ private Spinner createRadio(Composite parent, String title, String suffix, IWidgetGovernor governor, boolean defaultEnabled, int min, int max){ final Button radio = new Button(parent, SWT.RADIO); radioList.add(radio); radio.setText(title); radio.setData(governor); radio.setSelection(defaultEnabled); radio.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (radio.getSelection()){ disableAllRadioExceptOne(radio); colorsSelector.setGovernor((IWidgetGovernor)radio.getData()); } } }); Spinner actualText = new Spinner(parent, SWT.BORDER); actualText.setMinimum(min); actualText.setMaximum(max); actualText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (suffix != null) new Label(parent, SWT.NONE).setText(suffix); else new Label(parent, SWT.NONE); actualText.addModifyListener(valueModifedListener); return actualText; }
@Override protected void createFormContent(IManagedForm mform) { mform.getForm().setText("Guide Position"); FormToolkit toolkit = mform.getToolkit(); mform.getForm().getBody().setLayout(new GridLayout(4, false)); toolkit.createLabel(mform.getForm().getBody(), "Guide Position"); //$NON-NLS-1$ final Spinner width = new Spinner(mform.getForm().getBody(), SWT.BORDER); width.setValues(w, 0, Integer.MAX_VALUE, 0, 1, 10); width.setToolTipText("Guide Position"); width.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { w = width.getSelection(); } }); }
/** * @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; }
private void onSelectRandomSpinnerMax(final HashMap<WIDGET_KEY, Widget> paraWidgets) { /* * ensure the to value is larger than the from value */ final Spinner minSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START); final Spinner maxSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END); final int fromRand = minSpinner.getSelection(); final int toRand = maxSpinner.getSelection(); if (toRand <= fromRand) { if (toRand < 1) { minSpinner.setSelection(0); maxSpinner.setSelection(1); } else { minSpinner.setSelection(toRand - 1); } } updateUICustomUrl(); }
private void onSelectRandomSpinnerMin(final HashMap<WIDGET_KEY, Widget> paraWidgets) { /* * ensure the from value is smaller than the to value */ final Spinner minSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START); final Spinner maxSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END); final int fromRand = minSpinner.getSelection(); final int toRand = maxSpinner.getSelection(); if (fromRand >= toRand) { if (toRand < MAX_RANDOM) { maxSpinner.setSelection(fromRand + 1); } else { minSpinner.setSelection(toRand - 1); } } updateUICustomUrl(); }
private Spinner createUI_Spinner_ColorOpacity(final Composite parent) { final Spinner spinnerOpacity = new Spinner(parent, SWT.BORDER); GridDataFactory.fillDefaults() // .align(SWT.BEGINNING, SWT.FILL) .applyTo(spinnerOpacity); spinnerOpacity.setMinimum(Map3GradientColorManager.OPACITY_MIN); spinnerOpacity.setMaximum(Map3GradientColorManager.OPACITY_MAX); spinnerOpacity.setDigits(Map3GradientColorManager.OPACITY_DIGITS); spinnerOpacity.setIncrement(1); spinnerOpacity.setPageIncrement(10); spinnerOpacity.addSelectionListener(_defaultSelectionListener); spinnerOpacity.addMouseWheelListener(_defaultMouseWheelListener); return spinnerOpacity; }
private Spinner createUI_Spinner_PositionSize(final Composite container) { final Spinner spinnerPositionSize = new Spinner(container, SWT.BORDER); GridDataFactory.fillDefaults() // .align(SWT.BEGINNING, SWT.FILL) .applyTo(spinnerPositionSize); spinnerPositionSize.setMinimum(TourTrackConfigManager.TRACK_POSITION_SIZE_MIN); spinnerPositionSize.setMaximum(TourTrackConfigManager.TRACK_POSITION_SIZE_MAX); spinnerPositionSize.setIncrement(1); spinnerPositionSize.setPageIncrement(50); spinnerPositionSize.addSelectionListener(_defaultSelectionListener); spinnerPositionSize.addMouseWheelListener(_defaultMouseWheelListener); return spinnerPositionSize; }
private void onFieldSelectValue(final Widget widget) { if (_isInUIUpdate) { return; } final Spinner spinner = (Spinner) widget; final Integer vertexIndex = (Integer) spinner.getData(DATA_KEY_VERTEX_INDEX); final RGBVertex vertex = getRgbVertices().get(vertexIndex); // update model vertex.setValue(spinner.getSelection()); updateModel_FromUI_Vertices(); // update UI updateUI_FromModel_Vertices(); onApply(false); }
private void onField_Select_Number_Float(final Widget widget) { final Spinner spinner = (Spinner) widget; final TourFilterProperty filterProperty = (TourFilterProperty) spinner.getData(); final int fieldNo = (int) spinner.getData(FIELD_NO); final double selectedValue = spinner.getSelection(); final TourFilterFieldConfig fieldConfig = filterProperty.fieldConfig; // remove spinner digits double fieldValue = selectedValue / Math.pow(10, fieldConfig.numDigits); if (fieldConfig.fieldValueConverter != null) { fieldValue = fieldConfig.fieldValueConverter.convert_UI_To_Model(fieldValue); } if (fieldNo == 1) { filterProperty.doubleValue1 = fieldValue; } else { filterProperty.doubleValue2 = fieldValue; } fireModifyEvent(); }
private void onField_Select_Number_Integer(final Widget widget) { final Spinner spinner = (Spinner) widget; final TourFilterProperty filterProperty = (TourFilterProperty) spinner.getData(); final int fieldNo = (int) spinner.getData(FIELD_NO); final int selectedValue = spinner.getSelection(); final TourFilterFieldConfig fieldConfig = filterProperty.fieldConfig; double fieldValue = selectedValue; if (fieldConfig.fieldValueConverter != null) { fieldValue = fieldConfig.fieldValueConverter.convert_UI_To_Model(fieldValue); } if (fieldNo == 1) { filterProperty.intValue1 = (int) (fieldValue + 0.5); } else { filterProperty.intValue2 = (int) (fieldValue + 0.5); } fireModifyEvent(); }
private void onField_Select_SeasonDay(final Widget widget) { final Spinner spinnerDay = (Spinner) widget; final TourFilterProperty filterProperty = (TourFilterProperty) spinnerDay.getData(); final int fieldNo = (int) spinnerDay.getData(FIELD_NO); final int selectedDay = spinnerDay.getSelection(); final MonthDay oldField = fieldNo == 1 // ? filterProperty.monthDay1 : filterProperty.monthDay2; final int oldMonth = oldField.getMonthValue(); final MonthDay monthDay = MonthDay.of(oldMonth, selectedDay); if (fieldNo == 1) { filterProperty.monthDay1 = monthDay; } else { filterProperty.monthDay2 = monthDay; } fireModifyEvent(); }
private Spinner createUI_Margin(final Composite parent) { final Spinner spinner = new Spinner(parent, SWT.BORDER); spinner.setMinimum(CalendarProfileManager.DEFAULT_MARGIN_MIN); spinner.setMaximum(CalendarProfileManager.DEFAULT_MARGIN_MAX); spinner.addSelectionListener(_defaultSelectionListener); spinner.addMouseWheelListener(_defaultMouseWheelListener); // ensure that the -- sign is displayed GridDataFactory .fillDefaults() .hint(_pc.convertWidthInCharsToPixels(3), SWT.DEFAULT) .applyTo(spinner); return spinner; }
public static void adjustSpinnerValueOnMouseScroll(final MouseEvent event) { boolean isCtrlKey; boolean isShiftKey; if (IS_OSX) { isCtrlKey = (event.stateMask & SWT.MOD1) > 0; isShiftKey = (event.stateMask & SWT.MOD3) > 0; // isAltKey = (event.stateMask & SWT.MOD3) > 0; } else { isCtrlKey = (event.stateMask & SWT.MOD1) > 0; isShiftKey = (event.stateMask & SWT.MOD2) > 0; // isAltKey = (event.stateMask & SWT.MOD3) > 0; } // accelerate with Ctrl + Shift key int accelerator = isCtrlKey ? 10 : 1; accelerator *= isShiftKey ? 5 : 1; final Spinner spinner = (Spinner) event.widget; final int valueAdjustment = ((event.count > 0 ? 1 : -1) * accelerator); final int oldValue = spinner.getSelection(); spinner.setSelection(oldValue + valueAdjustment); }
public static void setColorForAllChildren(final Control parent, final Color fgColor, final Color bgColor) { parent.setForeground(fgColor); parent.setBackground(bgColor); if (parent instanceof Composite) { final Control[] children = ((Composite) parent).getChildren(); for (final Control child : children) { if (child != null && child.isDisposed() == false // // exclude controls which look ugly && !child.getClass().equals(Combo.class) && !child.getClass().equals(Spinner.class) // ) { setColorForAllChildren(child, fgColor, bgColor); } } } }
private void createTimedGroup ( final Composite parent ) { parent.setLayout ( new GridLayout ( 4, false ) ); new Label ( parent, SWT.NONE ).setText ( Messages.getString ( "BooleanGeneratorPage.timedGroup.beforeDelay" ) ); //$NON-NLS-1$ new Label ( parent, SWT.NONE ).setText ( Messages.getString ( "BooleanGeneratorPage.timedGroup.0to1" ) ); //$NON-NLS-1$ new Label ( parent, SWT.NONE ).setText ( Messages.getString ( "BooleanGeneratorPage.timedGroup.afterDelay" ) ); //$NON-NLS-1$ new Label ( parent, SWT.NONE ).setText ( Messages.getString ( "BooleanGeneratorPage.timedGroup.1to0" ) ); //$NON-NLS-1$ this.startDelaySpinner = new Spinner ( parent, SWT.BORDER ); this.startDelaySpinner.setValues ( 1000, 0, Integer.MAX_VALUE, 0, 100, 1000 ); new Label ( parent, SWT.NONE ).setText ( Messages.getString ( "BooleanGeneratorPage.timedGroup.transition" ) ); //$NON-NLS-1$ this.endDelaySpinner = new Spinner ( parent, SWT.BORDER ); this.endDelaySpinner.setValues ( 1000, 0, Integer.MAX_VALUE, 0, 100, 1000 ); }
/** * This method initializes commun_trigger * */ private void createCommun_trigger() { commun_trigger = new Composite(this, SWT.NONE); GridData gridData1 = new GridData(); gridData1.verticalAlignment = GridData.CENTER; gridData1.horizontalAlignment = GridData.FILL; gridData1.grabExcessHorizontalSpace = true; commun_trigger.setLayoutData(gridData1); GridLayout gridLayout = new GridLayout(); gridLayout.makeColumnsEqualWidth = false; gridLayout.numColumns = 2; commun_trigger.setLayout(gridLayout); type_trigger_label = new Label(commun_trigger, SWT.NONE); type_trigger_label.setText("Type of synchronizer"); createType_trigger_combo(); timeout_label = new Label(commun_trigger, SWT.NONE); timeout_label.setText("Timeout (ms)"); timeout_spin = new Spinner(commun_trigger, SWT.BORDER); timeout_spin.setMinimum(0); timeout_spin.setMaximum(Integer.MAX_VALUE); timeout_spin.setSelection((int) trigger.getTimeout()); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; gridData.grabExcessHorizontalSpace = true; timeout_spin.setLayoutData(gridData); }
protected void fillSynthPolyphonySpinner( Spinner spinner ){ int value = getIntegerValue( MidiSettings.SYNTH_POLYPHONY ); int[] range = getSynth().getIntegerPropertyRange( MidiSettings.SYNTH_POLYPHONY ); if( range.length == 2 && range[0] < range[1] ){ spinner.setMinimum( range[0] ); spinner.setMaximum( range[1] ); spinner.setIncrement(1); spinner.setPageIncrement(1); if( value >= range[0] && value <= range[1] ){ spinner.setSelection( value ); } } }
private Spinner makeSpinner(Composite parent,String label,int value, int min, int max){ this.newLabel(parent,label); Spinner spinner = new Spinner(parent,SWT.BORDER); spinner.setMinimum(min); spinner.setMaximum(max); spinner.setSelection(value); spinner.setLayoutData(getGridData()); return spinner; }
private void loadToolBar(Composite parent){ final Composite composite = new Composite(parent,SWT.NONE); composite.setLayout(new GridLayout(5,false)); composite.setLayoutData(new GridData(SWT.FILL,SWT.TOP,true,false)); this.previous = new Button(composite, SWT.ARROW | SWT.LEFT); this.next = new Button(composite, SWT.ARROW | SWT.RIGHT); this.label = new Label(composite,SWT.NONE); this.label.setText(this.track.getName()); this.label.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,true)); this.fromLabel = new Label(composite,SWT.NONE); this.fromLabel.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,true)); this.from = new Spinner(composite,SWT.BORDER); this.from.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT)); this.from.setMinimum(1); this.from.setMaximum(this.track.countMeasures()); this.from.setSelection(this.track.getLyrics().getFrom()); this.from.setEnabled(this.track.countMeasures() > 1); this.from.addModifyListener(this.listener); this.previous.addSelectionListener(new TGActionProcessorListener(TGLyricEditor.this.context, TGGoPreviousTrackAction.NAME)); this.next.addSelectionListener(new TGActionProcessorListener(TGLyricEditor.this.context, TGGoNextTrackAction.NAME)); }
private void initScaleGroup(final Composite parent) { final GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.FILL; final Group scaleGroup = new Group(parent, SWT.NONE); scaleGroup.setLayoutData(gridData); scaleGroup.setText(ResourceString.getResourceString("label.page.scale.printing")); final GridLayout scaleGroupLayout = new GridLayout(); scaleGroupLayout.marginWidth = 20; scaleGroupLayout.horizontalSpacing = 20; scaleGroupLayout.numColumns = 3; scaleGroup.setLayout(scaleGroupLayout); Label label = new Label(scaleGroup, SWT.NONE); label.setText(ResourceString.getResourceString("label.page.scale")); scaleSpinner = new Spinner(scaleGroup, SWT.BORDER); scaleSpinner.setIncrement(5); scaleSpinner.setMinimum(10); scaleSpinner.setMaximum(400); scaleSpinner.setSelection(100); label = new Label(scaleGroup, SWT.NONE); label.setText("%"); }
private void setMarginSpinner(final Spinner spinner) { spinner.setDigits(1); spinner.setIncrement(5); spinner.setMinimum(0); spinner.setMaximum(1000); spinner.setSelection(20); }
private Spinner createSpinner(Composite parent, String label, boolean isFloat, String propertyName) { Label l = new Label(parent, SWT.LEFT); l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); l.setText(label); Spinner sp = new Spinner(parent, SWT.BORDER); sp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); if (propertyName!=null && !propertyName.isEmpty()) sp.setData("propertyName", propertyName); // set the minimum value to 0.1 sp.setMinimum(0); // set the maximum value to 20 sp.setMaximum((int) 1e6); if (isFloat) { // allow 3 decimal places sp.setDigits(FLOAT_DIGITS); sp.setIncrement(FLOAT_MULTIPLICATOR); // sp.setSelection(FLOAT_MULTIPLICATOR); } else { sp.setIncrement(0); sp.setIncrement(1); // sp.setSelection(1); } sp.setSelection(0); sp.pack(); return sp; }
private void initScaleGroup(Composite parent) { GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.FILL; Group scaleGroup = new Group(parent, SWT.NONE); scaleGroup.setLayoutData(gridData); scaleGroup.setText(ResourceString .getResourceString("label.page.scale.printing")); GridLayout scaleGroupLayout = new GridLayout(); scaleGroupLayout.marginWidth = 20; scaleGroupLayout.horizontalSpacing = 20; scaleGroupLayout.numColumns = 3; scaleGroup.setLayout(scaleGroupLayout); Label label = new Label(scaleGroup, SWT.NONE); label.setText(ResourceString.getResourceString("label.page.scale")); scaleSpinner = new Spinner(scaleGroup, SWT.BORDER); scaleSpinner.setIncrement(5); scaleSpinner.setMinimum(10); scaleSpinner.setMaximum(400); scaleSpinner.setSelection(100); label = new Label(scaleGroup, SWT.NONE); label.setText("%"); }
private void setMarginSpinner(Spinner spinner) { spinner.setDigits(1); spinner.setIncrement(5); spinner.setMinimum(0); spinner.setMaximum(1000); spinner.setSelection(20); }
private void postConstruct(final NumberFormat nf, final RangeContent range) { final int increment = range.getIncrement(); final Spinner spinner = getControl(); spinner.setDigits(nf.getMaximumFractionDigits()); spinner.setMinimum(range.getMinimum()); spinner.setMaximum(range.getMaximum()); spinner.setIncrement(increment); spinner.setPageIncrement(increment * 10); spinner.addMouseWheelListener(_defaultMouseWheelListener); }