@Override public void handleEvent(Event event) { if ( !slider_mouse_down[0]){ int pos = privacy_scale.getSelection(); int level = ((pos+5)/10); setPrivacyLevel( level ); } } });
/** {@inheritDoc} */ @Override public int getSelection() { return scale.getSelection(); } }
/** {@inheritDoc} */ public int getSelection() { return scale.getSelection(); } }
/** {@inheritDoc} */ public int getSelection() { return scale.getSelection(); } }
/** * Gets the default selection of the "Example" widgets. */ @Override int getDefaultSelection () { return scale1.getSelection(); }
@Override int doGetIntValue(Object source) { return ((Scale) source).getSelection(); }
@Override public void widgetSelected(SelectionEvent e) { Double newValue = (double) scale.getSelection(); if (!newValue.equals(value)){ inputChangedTo((double) scale.getSelection(), false); } } });
@Override public void mouseUp( MouseEvent e ) { int pos = privacy_scale.getSelection(); int level = ((pos+5)/10); if ( level*10 != pos ){ privacy_scale.setSelection( level*10 ); } setPrivacyLevel( level ); slider_mouse_down[0] = false; }
Scale scale = new Scale(shell, SWT.BORDER); scale.setMaximum(10 * 10); Label speedLabel = new Label(shell, SWT.NONE); speedLabel.setText("time"); scale.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { speedLabel.setText((scale.getSelection() / 10f) + ""); } });
/** * {@inheritDoc} */ @Override public Map<IPreferenceGroup, Object> eventFired() { Sensitivity sensitivity = Sensitivity.fromOrd(slider.getSelection()); Map<IPreferenceGroup, Object> preferenceControlMap = new HashMap<>(); preferenceControlMap.put(PreferenceId.SamplingRate.SLIDER_ID, sensitivity); // get the actual selected divider mode button and set the specific id if (timeframeModeButton.getSelection()) { preferenceControlMap.put(PreferenceId.SamplingRate.DIVIDER_ID, PreferenceId.SamplingRate.TIMEFRAME_DIVIDER_ID); } return preferenceControlMap; }
public String getControlValueRaw() { return ( (SliderT) control ).getListItem().get( slider.getSelection() ).getEnumID(); }
@Override public void widgetSelected(SelectionEvent e) { int alpha = scale.getSelection() * 255/100; spinner.setSelection(alpha); theme.setAlpha(alpha); } });
private void writeSelection( final Scale scale ) throws IOException { Integer newValue = new Integer( scale.getSelection() ); String prop = PROP_SELECTION; Integer defValue = DEFAULT_SELECTION; if( WidgetLCAUtil.hasChanged( scale, prop, newValue, defValue ) ) { JSWriter writer = JSWriter.getWriterFor( scale ); writer.set( prop, newValue ); } }
@Override protected void doStore() { getPreferenceStore() .setValue(getPreferenceName(), scale.getSelection()); }
@Override protected void doStore() { getPreferenceStore() .setValue(getPreferenceName(), scale.getSelection()); }
protected void doStore() { getPreferenceStore() .setValue(getPreferenceName(), scale.getSelection()); }
public EventBased(Composite parent, int initialValue) { super(parent, initialValue); this.value = initialValue; inputField.addListener(SWT.Modify, e -> { try { int parsed = Integer.parseInt(inputField.getText()); setValue(parsed); } catch (Exception error) { outputField.setText(msgForError(error)); } }); scale.addListener(SWT.Selection, e -> { setValue(scale.getSelection()); }); }
@Override public void preserveValues( Scale scale ) { preserveProperty( scale, PROP_MINIMUM, scale.getMinimum() ); preserveProperty( scale, PROP_MAXIMUM, scale.getMaximum() ); preserveProperty( scale, PROP_SELECTION, scale.getSelection() ); preserveProperty( scale, PROP_INCREMENT, scale.getIncrement() ); preserveProperty( scale, PROP_PAGE_INCREMENT, scale.getPageIncrement() ); }
@Override public void renderChanges( Scale scale ) throws IOException { ControlLCAUtil.renderChanges( scale ); WidgetLCAUtil.renderCustomVariant( scale ); renderProperty( scale, PROP_MINIMUM, scale.getMinimum(), DEFAULT_MINIMUM ); renderProperty( scale, PROP_MAXIMUM, scale.getMaximum(), DEFAULT_MAXIMUM ); renderProperty( scale, PROP_SELECTION, scale.getSelection(), DEFAULT_SELECTION ); renderProperty( scale, PROP_INCREMENT, scale.getIncrement(), DEFAULT_INCREMENT ); renderProperty( scale, PROP_PAGE_INCREMENT, scale.getPageIncrement(), DEFAULT_PAGE_INCREMENT ); renderListenSelection( scale ); renderClientListeners( scale ); }
@Test public void testControl() { InteractiveTest.testCoat("Should show the YCbCr plane at various values of Y", cmp -> { Layouts.setGrid(cmp); Scale scale = new Scale(cmp, SWT.HORIZONTAL); scale.setMinimum(0); scale.setMaximum(255); scale.setSelection(128); Layouts.setGridData(scale).grabHorizontal(); ColorPicker colors = new ColorPicker(cmp); Layouts.setGridData(colors).grabAll(); scale.addListener(SWT.Selection, e -> { colors.setY(scale.getSelection()); }); }); } }