Exemple #1
0
  /** @see org.mihalis.opal.preferenceWindow.widgets.PWWidget#check() */
  @Override
  public void check() {
    final Object value = PreferenceWindow.getInstance().getValueFor(getPropertyKey());
    if (value == null) {
      PreferenceWindow.getInstance().setValue(getPropertyKey(), "");
    } else {
      if (!(value instanceof String)) {
        throw new UnsupportedOperationException(
            "The property '"
                + getPropertyKey()
                + "' has to be a String because it is associated to a URL text box");
      }

      final String str = (String) value;
      if (str.equals("")) {
        PreferenceWindow.getInstance().setValue(getPropertyKey(), "");
        return;
      }

      try {
        new URL(str);
      } catch (final MalformedURLException e) {
        throw new UnsupportedOperationException(
            "The property '"
                + getPropertyKey()
                + "' has a value ("
                + value
                + ") that is not an URL");
      }
    }
  }
Exemple #2
0
 /** @see org.mihalis.opal.preferenceWindow.widgets.PWWidget#check() */
 @Override
 public void check() {
   final Object value = PreferenceWindow.getInstance().getValueFor(getPropertyKey());
   if (value == null) {
     PreferenceWindow.getInstance().setValue(getPropertyKey(), new Float(0));
   } else {
     if (!(value instanceof Float)) {
       throw new UnsupportedOperationException(
           "The property '"
               + getPropertyKey()
               + "' has to be a Float because it is associated to a float text widget");
     }
   }
 }
Exemple #3
0
 /** @see org.mihalis.opal.preferenceWindow.enabler.Enabler#isEnabled() */
 @Override
 public boolean isEnabled() {
   final Object propValue = PreferenceWindow.getInstance().getValueFor(this.prop);
   if (this.value == null) {
     return propValue == null;
   }
   return this.value.equals(propValue);
 }