Ejemplo n.º 1
0
  /** Initializes the control and sets the listeners. */
  private void init() {
    addFocusListener(
        new FocusListener() {

          public void focusGained(FocusEvent e) {
            setBackground(ColorManager.getColor(Variables.FOCUS_COLOR));
          }

          public void focusLost(FocusEvent e) {
            setBackground(ColorManager.getColor(Constants.DEFAULT_COLOR_WHITE));
          }
        });

    localeListener =
        new LocaleChangedListener() {

          public void localeChanged(LocaleChangedEvent event) {
            if (toolTipArgs == null) {
              setToolTipTextForLocaleKey(toolTipKey);
            } else {
              setToolTipTextForLocaleKey(toolTipKey, toolTipArgs);
            }
            bundle = I18n.getGenericI18n().getBundle().getResourceBundle();
            setBundle(i18nPrefix, bundle);
          }
        };
    ApplicationManager.addLocaleChangedListener(localeListener);

    addDisposeListener(
        new DisposeListener() {

          public void widgetDisposed(DisposeEvent e) {
            ApplicationManager.removeLocaleChangedListener(localeListener);
          }
        });
    bundle = I18n.getGenericI18n().getBundle().getResourceBundle();
    setBundle(i18nPrefix, bundle);
  }
Ejemplo n.º 2
0
 /**
  * Constructs a new combo. This constructor should be used in application-UI environment.
  *
  * @param parent The parent.
  * @param style The style.
  * @param type The type.
  * @see com.swtplus.widgets.PCombo
  */
 public XPCombo(Composite parent, int style, ComboType type) {
   super(parent, style, type.getStrategy());
   this.handler = I18n.getGenericI18n();
   init();
 }