java类org.eclipse.swt.widgets.Spinner的实例源码

LimitCharsLogsPreferenceDialog.java 文件源码 项目:convertigo-eclipse 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
WidgetSpinnerInteger.java 文件源码 项目:turnus 阅读 39 收藏 0 点赞 0 评论 0
@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);
            }
        }
    });
}
WidgetSpinnerDecimal.java 文件源码 项目:turnus 阅读 28 收藏 0 点赞 0 评论 0
@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);
            }
        }
    });

}
UIHelper.java 文件源码 项目:tlaplus 阅读 33 收藏 0 点赞 0 评论 0
/**
 * 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;
}
BTSConfigurationDialog.java 文件源码 项目:bts 阅读 31 收藏 0 点赞 0 评论 0
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);
        }
    }
}
BZMenu.java 文件源码 项目:BrailleZephyr 阅读 25 收藏 0 点赞 0 评论 0
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();
}
BZMenu.java 文件源码 项目:BrailleZephyr 阅读 34 收藏 0 点赞 0 评论 0
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();
}
BZMenu.java 文件源码 项目:BrailleZephyr 阅读 34 收藏 0 点赞 0 评论 0
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();
}
BZMenu.java 文件源码 项目:BrailleZephyr 阅读 35 收藏 0 点赞 0 评论 0
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();
}
ServiceConfigurationPage.java 文件源码 项目:monto-eclipse 阅读 32 收藏 0 点赞 0 评论 0
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 -> {
      });
    });
  });
}
RelationCountFilterEditorControl.java 文件源码 项目:depan 阅读 36 收藏 0 点赞 0 评论 0
/**
 * 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);
}
CameraDirectionGroup.java 文件源码 项目:depan 阅读 31 收藏 0 点赞 0 评论 0
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);
    }
  }
CameraPositionGroup.java 文件源码 项目:depan 阅读 29 收藏 0 点赞 0 评论 0
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);
    }
  }
CustomPropertyPeriodField.java 文件源码 项目:SecureBPMN 阅读 29 收藏 0 点赞 0 评论 0
@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));
        }
      }
    }
  }
}
AdvancedColorWidget.java 文件源码 项目:PDFReporter-Studio 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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;
}
CreateGuideAction.java 文件源码 项目:PDFReporter-Studio 阅读 35 收藏 0 点赞 0 评论 0
@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();
        }
    });
}
SWTFactory.java 文件源码 项目:APICloud-Studio 阅读 36 收藏 0 点赞 0 评论 0
/**
 * @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;
}
DialogMPCustom.java 文件源码 项目:mytourbook 阅读 26 收藏 0 点赞 0 评论 0
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();
    }
DialogMPCustom.java 文件源码 项目:mytourbook 阅读 24 收藏 0 点赞 0 评论 0
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();
    }
DialogTourTrackConfig.java 文件源码 项目:mytourbook 阅读 31 收藏 0 点赞 0 评论 0
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;
    }
DialogTourTrackConfig.java 文件源码 项目:mytourbook 阅读 25 收藏 0 点赞 0 评论 0
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;
    }
DialogMap3ColorEditor.java 文件源码 项目:mytourbook 阅读 38 收藏 0 点赞 0 评论 0
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);
    }
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 28 收藏 0 点赞 0 评论 0
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();
    }
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 29 收藏 0 点赞 0 评论 0
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();
    }
SlideoutTourFilter.java 文件源码 项目:mytourbook 阅读 29 收藏 0 点赞 0 评论 0
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();
    }
SlideoutCalendarOptions.java 文件源码 项目:mytourbook 阅读 77 收藏 0 点赞 0 评论 0
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;
    }
UI.java 文件源码 项目:mytourbook 阅读 43 收藏 0 点赞 0 评论 0
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);
    }
UI.java 文件源码 项目:mytourbook 阅读 28 收藏 0 点赞 0 评论 0
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);
                }
            }
        }
    }
DialogMPCustom.java 文件源码 项目:mytourbook 阅读 25 收藏 0 点赞 0 评论 0
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();
    }
BooleanGeneratorPage.java 文件源码 项目:neoscada 阅读 55 收藏 0 点赞 0 评论 0
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 );
}


问题


面经


文章

微信
公众号

扫码关注公众号