Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Spinner


        public void widgetSelected(SelectionEvent e) {
          fMaxCountSpinner.setEnabled(fDeleteNewsByCountCheck.getSelection());
        }
      });

      fMaxCountSpinner = new Spinner(container, SWT.BORDER);
      fMaxCountSpinner.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fMaxCountSpinner.setEnabled(fDeleteNewsByCountCheck.getSelection());
      fMaxCountSpinner.setMinimum(0);
      fMaxCountSpinner.setMaximum(9999);
      fMaxCountSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.CLEAN_UP_NEWS_BY_COUNT_VALUE));
    }

    /* 5.) Delete News with an age > X Days */
    {
      fDeleteNewsByAgeCheck = new Button(container, SWT.CHECK);
      fDeleteNewsByAgeCheck.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fDeleteNewsByAgeCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.CLEAN_UP_NEWS_BY_AGE_STATE));
      fDeleteNewsByAgeCheck.setText("Maximum age of news in days: ");
      fDeleteNewsByAgeCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          fMaxAgeSpinner.setEnabled(fDeleteNewsByAgeCheck.getSelection());
        }
      });

      fMaxAgeSpinner = new Spinner(container, SWT.BORDER);
      fMaxAgeSpinner.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fMaxAgeSpinner.setEnabled(fDeleteNewsByAgeCheck.getSelection());
      fMaxAgeSpinner.setMinimum(1);
      fMaxAgeSpinner.setMaximum(9999);
      fMaxAgeSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.CLEAN_UP_NEWS_BY_AGE_VALUE));
View Full Code Here


    /* Specially treat Age */
    else if (field.getId() == INews.AGE_IN_DAYS || field.getId() == INews.AGE_IN_MINUTES) {
      Composite container = new Composite(inputField, SWT.NONE);
      container.setLayout(LayoutUtils.createGridLayout(2, 0, 0));

      final Spinner spinner = new Spinner(container, SWT.BORDER);
      spinner.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      spinner.setMinimum(1);
      spinner.setMaximum(1000000);

      final Combo combo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
      combo.add(Messages.SearchConditionItem_DAYS);
      combo.add(Messages.SearchConditionItem_HOURS);
      combo.add(Messages.SearchConditionItem_MINUTES);

      Listener listener = new Listener() {
        public void handleEvent(Event event) {
          fInputValue = getAgeValue(spinner, combo);

          if (!fInputValue.equals(input))
            fModified = true;
        }
      };
      spinner.addListener(SWT.Modify, listener);
      combo.addListener(SWT.Modify, listener);

      /* Pre-Select input if given */
      Object presetInput = (input == null) ? fInputValue : input;
      if (presetInput != null && presetInput instanceof Integer) {
        Integer inputValue = (Integer) presetInput;

        /* Day */
        if (inputValue >= 0) {
          spinner.setSelection(inputValue);
          combo.select(0);
        }

        /* Hour */
        else if (inputValue % 60 == 0) {
          spinner.setSelection(Math.abs(inputValue) / 60);
          combo.select(1);
        }

        /* Minute */
        else {
          spinner.setSelection(Math.abs(inputValue));
          combo.select(2);
        }
      }

      /* Otherwise use Default */
      else {
        spinner.setSelection(1);
        combo.select(0);
      }

      /* Update Input Value */
      fInputValue = getAgeValue(spinner, combo);
    }

    /* Create new Input Field based on search-value-type */
    else {
      switch (field.getSearchValueType().getId()) {

        /* Type: Boolean */
        case ISearchValueType.BOOLEAN: {
          final Combo combo = new Combo(inputField, SWT.BORDER | SWT.READ_ONLY);
          combo.add(Messages.SearchConditionItem_TRUE);
          combo.add(Messages.SearchConditionItem_FALSE);
          combo.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = Boolean.valueOf(combo.getItem(combo.getSelectionIndex()));

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Pre-Select input if given */
          Object presetInput = (input == null) ? fInputValue : input;
          if (presetInput != null && presetInput instanceof Boolean)
            combo.select(((Boolean) presetInput) ? 0 : 1);
          else
            combo.select(0);

          /* Update Input Value */
          fInputValue = Boolean.valueOf(combo.getItem(combo.getSelectionIndex()));

          break;
        }

          /* Type: Date / Time */
        case ISearchValueType.DATE:
        case ISearchValueType.TIME:
        case ISearchValueType.DATETIME: {
          final Calendar cal = Calendar.getInstance();
          final DateTime datetime = new DateTime(inputField, SWT.DATE | SWT.BORDER);
          datetime.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
              cal.set(Calendar.DATE, datetime.getDay());
              cal.set(Calendar.MONTH, datetime.getMonth());
              cal.set(Calendar.YEAR, datetime.getYear());

              fInputValue = cal.getTime();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Pre-Select input if given */
          Object presetInput = (input == null) ? fInputValue : input;
          if (presetInput != null && presetInput instanceof Date)
            cal.setTime((Date) presetInput);

          datetime.setDay(cal.get(Calendar.DATE));
          datetime.setMonth(cal.get(Calendar.MONTH));
          datetime.setYear(cal.get(Calendar.YEAR));

          /* Update Input Value */
          fInputValue = cal.getTime();

          break;
        }

          /* Type: Enumeration */
        case ISearchValueType.ENUM: {
          final Text text = new Text(inputField, SWT.BORDER);
          text.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = text.getText();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Provide Auto-Complete Field */
          OwlUI.hookAutoComplete(text, field.getSearchValueType().getEnumValues(), true, true);

          /* Pre-Select input if given */
          String inputValue = (input != null ? input.toString() : null);
          if (inputValue != null)
            text.setText(inputValue);

          /* Update Input Value */
          fInputValue = text.getText();

          break;
        }

          /* Type: Number */
        case ISearchValueType.NUMBER:
        case ISearchValueType.INTEGER: {
          final Spinner spinner = new Spinner(inputField, SWT.BORDER);
          spinner.setMinimum(0);
          spinner.setMaximum(1000);
          spinner.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = spinner.getSelection();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Pre-Select input if given */
          Object presetInput = (input == null) ? fInputValue : input;
          if (presetInput != null && presetInput instanceof Integer)
            spinner.setSelection((Integer) presetInput);

          /* Update Input Value */
          fInputValue = spinner.getSelection();

          break;
        }

          /* Type: String */
 
View Full Code Here

        public void widgetSelected(SelectionEvent e) {
          fMaxLastVisitSpinner.setEnabled(fDeleteFeedByLastVisitCheck.getSelection());
        }
      });

      fMaxLastVisitSpinner = new Spinner(container, SWT.BORDER);
      fMaxLastVisitSpinner.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fMaxLastVisitSpinner.setEnabled(fDeleteFeedByLastVisitCheck.getSelection());
      fMaxLastVisitSpinner.setMinimum(1);
      fMaxLastVisitSpinner.setMaximum(999);
      fMaxLastVisitSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.CLEAN_UP_BM_BY_LAST_VISIT_VALUE));

      Label label = new Label(container, SWT.None);
      label.setText(Messages.CleanUpOptionsPage_DAYS);
    }

    /* 2.) Delete Feeds that have not updated in X Days */
    {
      fDeleteFeedByLastUpdateCheck = new Button(container, SWT.CHECK);
      fDeleteFeedByLastUpdateCheck.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fDeleteFeedByLastUpdateCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.CLEAN_UP_BM_BY_LAST_UPDATE_STATE));
      fDeleteFeedByLastUpdateCheck.setText(Messages.CleanUpOptionsPage_DELETE_BY_UPDATE);
      fDeleteFeedByLastUpdateCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          fMaxLastUpdateSpinner.setEnabled(fDeleteFeedByLastUpdateCheck.getSelection());
        }
      });

      fMaxLastUpdateSpinner = new Spinner(container, SWT.BORDER);
      fMaxLastUpdateSpinner.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fMaxLastUpdateSpinner.setEnabled(fDeleteFeedByLastUpdateCheck.getSelection());
      fMaxLastUpdateSpinner.setMinimum(1);
      fMaxLastUpdateSpinner.setMaximum(999);
      fMaxLastUpdateSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.CLEAN_UP_BM_BY_LAST_UPDATE_VALUE));
View Full Code Here

        public void widgetSelected(SelectionEvent e) {
          fMaxCountSpinner.setEnabled(fDeleteNewsByCountCheck.getSelection());
        }
      });

      fMaxCountSpinner = new Spinner(container, SWT.BORDER);
      fMaxCountSpinner.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fMaxCountSpinner.setEnabled(fDeleteNewsByCountCheck.getSelection());
      fMaxCountSpinner.setMinimum(0);
      fMaxCountSpinner.setMaximum(9999);
      fMaxCountSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.CLEAN_UP_NEWS_BY_COUNT_VALUE));
    }

    /* 5.) Delete News with an age > X Days */
    {
      fDeleteNewsByAgeCheck = new Button(container, SWT.CHECK);
      fDeleteNewsByAgeCheck.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fDeleteNewsByAgeCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.CLEAN_UP_NEWS_BY_AGE_STATE));
      fDeleteNewsByAgeCheck.setText(Messages.CleanUpOptionsPage_DELETE_NEWS_BY_AGE);
      fDeleteNewsByAgeCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          fMaxAgeSpinner.setEnabled(fDeleteNewsByAgeCheck.getSelection());
        }
      });

      fMaxAgeSpinner = new Spinner(container, SWT.BORDER);
      fMaxAgeSpinner.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      fMaxAgeSpinner.setEnabled(fDeleteNewsByAgeCheck.getSelection());
      fMaxAgeSpinner.setMinimum(1);
      fMaxAgeSpinner.setMaximum(9999);
      fMaxAgeSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.CLEAN_UP_NEWS_BY_AGE_VALUE));
View Full Code Here

        fUpdateValueSpinner.setEnabled(fUpdateCheck.getSelection());
        fUpdateScopeCombo.setEnabled(fUpdateCheck.getSelection());
      }
    });

    fUpdateValueSpinner = new Spinner(autoReloadContainer, SWT.BORDER);
    fUpdateValueSpinner.setMinimum(1);
    fUpdateValueSpinner.setMaximum(999);
    fUpdateValueSpinner.setEnabled(fUpdateCheck.getSelection());

    long updateInterval = fGlobalScope.getLong(DefaultPreferences.BM_UPDATE_INTERVAL);
View Full Code Here

      public void widgetSelected(SelectionEvent e) {
        fMarkReadAfterSpinner.setEnabled(fMarkReadStateCheck.getSelection());
      }
    });

    fMarkReadAfterSpinner = new Spinner(markReadAfterContainer, SWT.BORDER);
    fMarkReadAfterSpinner.setMinimum(0);
    fMarkReadAfterSpinner.setMaximum(100);
    fMarkReadAfterSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.MARK_READ_IN_MILLIS) / 1000);
    fMarkReadAfterSpinner.setEnabled(fMarkReadStateCheck.getSelection());
View Full Code Here

      public void widgetSelected(SelectionEvent e) {
        fDeleteNewsByCountValue.setEnabled(fDeleteNewsByCountCheck.getSelection());
      }
    });

    fDeleteNewsByCountValue = new Spinner(group, SWT.BORDER);
    fDeleteNewsByCountValue.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    fDeleteNewsByCountValue.setEnabled(fDeleteNewsByCountCheck.getSelection());
    fDeleteNewsByCountValue.setMinimum(0);
    fDeleteNewsByCountValue.setMaximum(99999);
    fDeleteNewsByCountValue.setSelection(fGlobalScope.getInteger(DefaultPreferences.DEL_NEWS_BY_COUNT_VALUE));

    /* Delete by Age */
    fDeleteNewsByAgeCheck = new Button(group, SWT.CHECK);
    fDeleteNewsByAgeCheck.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    fDeleteNewsByAgeCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.DEL_NEWS_BY_AGE_STATE));
    fDeleteNewsByAgeCheck.setText(Messages.FeedsPreferencePage_MAX_AGE);
    fDeleteNewsByAgeCheck.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        fDeleteNewsByAgeValue.setEnabled(fDeleteNewsByAgeCheck.getSelection());
      }
    });

    fDeleteNewsByAgeValue = new Spinner(group, SWT.BORDER);
    fDeleteNewsByAgeValue.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    fDeleteNewsByAgeValue.setEnabled(fDeleteNewsByAgeCheck.getSelection());
    fDeleteNewsByAgeValue.setMinimum(0);
    fDeleteNewsByAgeValue.setMaximum(99999);
    fDeleteNewsByAgeValue.setSelection(fGlobalScope.getInteger(DefaultPreferences.DEL_NEWS_BY_AGE_VALUE));
View Full Code Here

        public void widgetSelected(SelectionEvent e) {
          fLimitNotificationSpinner.setEnabled(fLimitNotificationCheck.getSelection());
        }
      });

      fLimitNotificationSpinner = new Spinner(limitItemsContainer, SWT.BORDER);
      fLimitNotificationSpinner.setMinimum(1);
      fLimitNotificationSpinner.setMaximum(30);
      fLimitNotificationSpinner.setEnabled(fLimitNotificationCheck.getSelection());
      if (notificationLimit > 0)
        fLimitNotificationSpinner.setSelection(notificationLimit);
      else
        fLimitNotificationSpinner.setSelection(notificationLimit * -1);

      label = new Label(limitItemsContainer, SWT.None);
      label.setText(Messages.NotifierPreferencesPage_SHOW_MAX_NEWS_END);

      /* Full Content */
      fShowExcerptCheck = new Button(group, SWT.CHECK);
      fShowExcerptCheck.setText(Messages.NotifierPreferencesPage_SHOW_EXCERPT);
      fShowExcerptCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.SHOW_EXCERPT_IN_NOTIFIER));

      /* Only from Tray */
      fNotificationOnlyFromTray = new Button(group, SWT.CHECK);
      fNotificationOnlyFromTray.setText(Messages.NotifierPreferencesPage_SHOW_WHEN_MINIMIZED);
      fNotificationOnlyFromTray.setSelection(fGlobalScope.getBoolean(DefaultPreferences.SHOW_NOTIFICATION_POPUP_ONLY_WHEN_MINIMIZED));

      /* Close Notifier when opening Item */
      fCloseNotifierOnOpen = new Button(group, SWT.CHECK);
      fCloseNotifierOnOpen.setText(Messages.NotifierPreferencesPage_CLOSE_NOTIFIER_ON_OPEN);
      fCloseNotifierOnOpen.setSelection(fGlobalScope.getBoolean(DefaultPreferences.CLOSE_NOTIFIER_ON_OPEN));

      /* Auto Close Notifier */
      Composite autoCloseContainer = new Composite(group, SWT.None);
      autoCloseContainer.setLayout(LayoutUtils.createGridLayout(3, 0, 0, 0, 2, false));

      fAutoCloseNotifierCheck = new Button(autoCloseContainer, SWT.CHECK);
      fAutoCloseNotifierCheck.setText(Messages.NotifierPreferencesPage_CLOSE_AUTOMATICALLY);
      fAutoCloseNotifierCheck.setSelection(!fGlobalScope.getBoolean(DefaultPreferences.STICKY_NOTIFICATION_POPUP));
      fAutoCloseNotifierCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          fAutoCloseNotifierSpinner.setEnabled(fAutoCloseNotifierCheck.getSelection());
        }
      });

      int notificationAutoCloseValue = fGlobalScope.getInteger(DefaultPreferences.AUTOCLOSE_NOTIFICATION_VALUE);

      fAutoCloseNotifierSpinner = new Spinner(autoCloseContainer, SWT.BORDER);
      fAutoCloseNotifierSpinner.setMinimum(1);
      fAutoCloseNotifierSpinner.setMaximum(99);
      fAutoCloseNotifierSpinner.setEnabled(fAutoCloseNotifierCheck.getSelection());
      fAutoCloseNotifierSpinner.setSelection(notificationAutoCloseValue);

View Full Code Here

        fAutoCloseTabsSpinner.setEnabled(fAutoCloseTabsCheck.getSelection());
        fAlwaysReuseFeedView.setEnabled(!fAutoCloseTabsCheck.getSelection() || fAutoCloseTabsSpinner.getSelection() > 1);
      }
    });

    fAutoCloseTabsSpinner = new Spinner(autoCloseTabsContainer, SWT.BORDER);
    fAutoCloseTabsSpinner.setMinimum(1);
    fAutoCloseTabsSpinner.setMaximum(100);
    fAutoCloseTabsSpinner.setSelection(fEclipseScope.getInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD));
    fAutoCloseTabsSpinner.setEnabled(fAutoCloseTabsCheck.getSelection());
    fAutoCloseTabsSpinner.addSelectionListener(new SelectionAdapter() {
View Full Code Here

   
    yearLabel = new Label(group, SWT.NONE);
    yearLabel.setLayoutData(new GridData());
    yearLabel.setText("Year:");
   
    sYear = new Spinner(group, SWT.BORDER);
    final GridData gridData2 = new GridData(40, SWT.DEFAULT);
    sYear.setLayoutData(gridData2);
    sYear.setMinimum(1900);
    sYear.setMaximum(10000);
   
    label1 = new Label(group, SWT.NONE);
    label1.setText("Month:");
   
    sMonth = new Spinner(group, SWT.BORDER);
    final GridData gridData21 = new GridData(20, SWT.DEFAULT);
    sMonth.setLayoutData(gridData21);
    sMonth.setMinimum(1);
    sMonth.setMaximum(12);
   
    label2 = new Label(group, SWT.NONE);
    label2.setText("Day:");
   
    sDay = new Spinner(group, SWT.BORDER);
    final GridData gridData31 = new GridData(20, SWT.DEFAULT);
    sDay.setLayoutData(gridData31);
    sDay.setMinimum(1);
    sDay.setMaximum(31);
   
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Spinner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.