public void onValueChange(ValueChangeEvent<Boolean> event) {
   if (event.getSource() == regularRolesBtn) {
     if (regularRolesBtn.getValue()) {
       showRoles(REGULAR_ROLES_TYPE);
     }
   } else if (event.getSource() == systemRolesBtn) {
     if (systemRolesBtn.getValue()) {
       showRoles(SYSTEM_ROLES_TYPE);
     }
   } else {
     if (rolesListBox.getSelectedIndex() >= 0) {
       ArrayList<String> selectedLogicalRoles = new ArrayList<String>();
       for (LogicalRoleInfo logicalRoleInfo : logicalRoles.values()) {
         if (logicalRoleInfo.checkBox.getValue()) {
           selectedLogicalRoles.add(logicalRoleInfo.roleName);
         }
       }
       String runtimeRole = rolesListBox.getItemText(rolesListBox.getSelectedIndex());
       List<String> originalRoles = masterRoleMap.get(runtimeRole);
       if (((originalRoles == null) || (originalRoles.size() == 0))
           && (selectedLogicalRoles.size() == 0)) {
         newRoleAssignments.remove(runtimeRole);
       } else if ((originalRoles != null)
           && (originalRoles.containsAll(selectedLogicalRoles))
           && selectedLogicalRoles.containsAll(originalRoles)) {
         newRoleAssignments.remove(runtimeRole);
       } else {
         newRoleAssignments.put(runtimeRole, selectedLogicalRoles);
       }
     }
   }
 }
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {

    if (event.getValue().equals("page1")) {
      goToPage1();
    }

    if (event.getValue().equals("page2")) {
      goToPage2();
    }
  }
Esempio n. 3
0
    /**
     * @see com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(ValueChangeEvent
     *     event)
     */
    public void onValueChange(ValueChangeEvent<String> event) {

      setGhostMode(false);
      if ((m_ghostValue != null) && "".equals(m_textbox.getValue())) {
        m_ghostMode = true;
        setGhostStyleEnabled(true);
        m_textbox.setValue(m_ghostValue);
      }
      if (!event.getValue().equals(m_currentValue)) {
        m_currentValue = event.getValue();
        fireValueChangedEvent();
      }
    }
Esempio n. 4
0
 protected void movePrevious() {
   Slide to = getSlide(_current);
   Slide from = (Slide) _panel.getWidget(0);
   Transition transition = Transition.SLIDE;
   ValueChangeEvent.fire(this, false);
   transition.start(from, to, _panel, true);
 }
Esempio n. 5
0
  /**
   * This is called either when the user loads the page for the first time or when the user switches
   * places.
   *
   * <p>It is not meant to be called directly, but implicit via {@link #go(Class)}
   */
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    Map<String, String> tokens = parseToken(event.getValue());
    if (!tokens.containsKey(null)) {
      GWT.log("History Token has no location - returning to home page");
      goHome();
    } else {
      Class<? extends Activity> mainActivity = getActityFromLocation(tokens);
      if (mainActivity != null) {
        injector.create(
            mainActivity,
            new AsyncCallback<Activity>() {
              @Override
              public void onFailure(Throwable caught) {
                GWT.log("Unable to start requested Presenter", caught);
              }

              @Override
              public void onSuccess(Activity result) {
                display.displayActivity(result);
              }
            });
      } else {
        GWT.log("Unknown location - returning to home page");
        goHome();
        return;
      }
    }
  }
 /** Handles change events from {@link History}. */
 @Override
 public void onValueChange(final ValueChangeEvent<String> event) {
   if (locked) {
     defferedNavigation =
         new Command() {
           @Override
           public void execute() {
             onValueChange(event);
           }
         };
     return;
   }
   if (!getLock()) {
     return;
   }
   String historyToken = event.getValue();
   try {
     if (historyToken.trim().equals("")) {
       unlock();
       revealDefaultPlace();
     } else {
       historyToken = modifyNameToken(historyToken);
       placeHierarchy = tokenFormatter.toPlaceRequestHierarchy(historyToken);
       setPreviousRequestUrl(getCurrentPlaceRequest());
       doRevealPlace(getCurrentPlaceRequest(), true);
     }
   } catch (TokenFormatException e) {
     unlock();
     error(historyToken);
     NavigationEvent.fire(this, null);
   }
 }
Esempio n. 7
0
 /** {@inheritDoc} */
 @Override
 public void setValue(Date value, boolean fireEvents) {
   box.setValue(dtf.format(value));
   if (fireEvents) {
     ValueChangeEvent.fire(this, value);
   }
 }
 @UiHandler("displayNameField")
 protected void handleDisplayNameChange(ValueChangeEvent<String> evt) {
   setDirty(true, EventStrategy.FIRE_EVENTS);
   if (isWellFormed()) {
     ValueChangeEvent.fire(this, getValue());
   }
 }
Esempio n. 9
0
  /** Called whenever any filter value changes. */
  protected void onFilterValueChange() {
    TaskInboxFilterBean newState = new TaskInboxFilterBean();
    int priorityVal = -1;
    if (priority.getValue().trim().length() > 0) {
      try {
        priorityVal = Integer.parseInt(priority.getValue());
      } catch (NumberFormatException nfe) {
      }
    }
    newState
        .setOwner(
            TaskOwnerEnum.valueOf(
                ownerAny.getValue(),
                ownerMine.getValue(),
                ownerActive.getValue(),
                ownerGroup.getValue()))
        .setPriority(priorityVal)
        .setDateDueFrom(dateDueFrom.getDateValue())
        .setDateDueTo(dateDueTo.getDateValue());

    TaskInboxFilterBean oldState = this.currentState;
    this.currentState = newState;
    // Only fire a change event if something actually changed.
    ValueChangeEvent.fireIfNotEqual(this, oldState, currentState);
  }
Esempio n. 10
0
 @Override
 public void setValue(final Date value, final boolean fireEvents) {
   this.value = value;
   if (fireEvents) {
     ValueChangeEvent.fire(this, value);
   }
 }
Esempio n. 11
0
 @Override
 public void setValue(List<M> value, boolean fireEvents) {
   List<M> oldValue = getValue();
   setItems(value);
   if (fireEvents) {
     ValueChangeEvent.fireIfNotEqual(this, oldValue, value);
   }
 }
 @Override
 public void onValueChange(ValueChangeEvent<List<SelectionItem>> event) {
   if (!selectionItemsEditor.isSuppressEvent()) {
     ValueChangeEvent.fire(
         TreeSelectionEditor.this,
         Lists.<SelectionItem>newArrayList(selectionItemsEditor.getCurrentTree()));
   }
 }
Esempio n. 13
0
  public void setValue(Integer value, boolean fireEvents) {

    if (this.value.compareTo(value) != 0) {
      final Integer oldValue = this.value;
      this.value = value;
      render();
      ValueChangeEvent.<Integer>fireIfNotEqual(this, oldValue, value);
    }
  }
Esempio n. 14
0
 public void setValue(int value, boolean fireEvent) {
   if (_value != value) {
     _value = value;
     updateSliderPosition();
     if (fireEvent) {
       ValueChangeEvent.fire(this, _value);
     }
   }
 }
 @Override
 public void setText(final String text) {
   if (!isValidValue(text, false)) {
     final String validValue = makeValidValue(text);
     super.setText(validValue);
     ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this, validValue);
   } else {
     super.setText(text);
   }
 }
  @Override
  public final void onValueChange(ValueChangeEvent<S> valueChangeEvent) {
    S s = valueChangeEvent.getValue();
    setValue(s);
    validate();

    if (getState() != State.Initial) {
      setState(validate() ? State.Valid : State.Invalid);
    }
  }
  /** {@inheritDoc} */
  @Override
  public void setValue(final Date value, final boolean fireEvents) {
    errorHandlerMixin.clearErrors();
    textBox.setValue(value != null ? dateTimeFormat.format(value) : null);
    update(textBox.getElement());

    if (fireEvents) {
      ValueChangeEvent.fire(DatePickerBase.this, value);
    }
  }
 @Override
 public void setValue(final String value, final boolean fireEvents) {
   if (!isValidValue(value, false)) {
     final String validValue = makeValidValue(value);
     super.setValue(validValue, fireEvents);
     ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this, validValue);
   } else {
     super.setValue(value, fireEvents);
   }
 }
 /**
  * This will return immediately if the token passed in the event object isn't the token currently
  * on the History stack, or if the static back variable is true. If those aren't the case it calls
  * stateHandler.validateToken(token) and checks for equality with the token passed in. If they are
  * unequal it calls back() and adds a new item immediately after, then returns. If everything
  * checks out then the method cycles through the list of ClientWidget's and adds those which are
  * related to the page, by calling addWidget().
  */
 public void onValueChange(ValueChangeEvent<String> event) {
   String token = event.getValue();
   if (back || !token.equals(History.getToken())) return;
   String validatedToken = stateHandler.validateToken(token);
   if (!stateHandler.compareTokens(token, validatedToken)) {
     // back(); /* Actually works in Chrome, so I can't use this trick
     History.newItem(validatedToken);
     return;
   }
   for (ClientWidget w : list) if (w.isTokenRelated(validatedToken)) w.addWidgetToRootPanel();
 }
Esempio n. 20
0
  /**
   * Processes the hyperlink clicks
   *
   * @param event The event of the hyperlink click
   */
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    ViewEnum view = ViewEnum.HOME;
    try {
      view = ViewEnum.valueOf(event.getValue());

    } catch (IllegalArgumentException e) {
      return;
    }
    setBody(view);
  }
  @UiHandler("switchBuild")
  void onSwitch(ValueChangeEvent<String> event) {
    if ("MAVEN".equals(event.getValue())) {
      this.buildGradlePanel.setVisible(false);
      this.buildMavenPanel.setVisible(true);

    } else {
      this.buildGradlePanel.setVisible(true);
      this.buildMavenPanel.setVisible(false);
    }
  }
Esempio n. 22
0
 private void checkForChange() {
   String sval = getValue();
   boolean isDefault = StringUtils.areEqual(sval, getFieldDef().getDefaultValueAsString());
   // do not validate default
   if (isDefault || validate()) {
     if (!ComparisonUtil.equals(_lastInput, sval)) {
       ValueChangeEvent.fire(this, sval);
       _lastInput = sval;
     }
   }
 }
  public void setValue(T value, boolean fireEvents) {
    final T oldValue = getValue();

    this.currentValue = value;
    for (Entry<T, RadioButton> entry : radios.entrySet()) {
      entry.getValue().setValue(entry.getKey().equals(this.currentValue));
    }

    if (fireEvents) {
      ValueChangeEvent.fireIfNotEqual(this, oldValue, this.currentValue);
    }
  }
Esempio n. 24
0
 @Override
 public void setValue(Date value, boolean fireEvents) {
   this.value = value;
   if (value != null) {
     dateBox.setText(DF.format(value));
   } else {
     dateBox.setText(null);
   }
   if (fireEvents) {
     ValueChangeEvent.fire(this, value);
   }
 }
 @Override
 public void setValue(List<? extends Suggestion> value, boolean fireEvents) {
   clear();
   if (value != null) {
     for (Suggestion suggestion : value) {
       addItem(suggestion);
     }
   }
   if (fireEvents) {
     ValueChangeEvent.fire(this, getValue());
   }
 }
Esempio n. 26
0
  @Override
  public void setValue(List<ArtifactCommentBean> value, boolean fireEvents) {
    this.value = value;

    for (ArtifactCommentBean commentBean : value) {
      createComment(commentBean);
    }

    if (fireEvents) {
      ValueChangeEvent.fire(this, value);
    }
  }
 /** {@inheritDoc} */
 @Override
 public HandlerRegistration addValueChangeHandler(
     final ValueChangeHandler<Date> dateValueChangeHandler) {
   textBox.addValueChangeHandler(
       new ValueChangeHandler<String>() {
         @Override
         public void onValueChange(ValueChangeEvent<String> event) {
           ValueChangeEvent.fire(DatePickerBase.this, getValue());
         }
       });
   return addHandler(dateValueChangeHandler, ValueChangeEvent.getType());
 }
Esempio n. 28
0
  public void setValue(Integer value, boolean fireEvents) {

    percent = value;

    setColor();

    percentage.setText(Integer.toString(value) + " %");
    bar.getStyle().setWidth(value, Unit.PCT);

    if (fireEvents) {
      ValueChangeEvent.fire(this, value);
    }
  }
  protected void setValue(Long value, boolean updateTextBox, boolean fireEvents) {
    if (updateTextBox) {
      syncTextToValue(value);
    }

    // keep track of the last known value so that we only fire
    // when it's different.
    Long oldValue = lastKnownValue;
    lastKnownValue = value;

    if (fireEvents && !isSameValue(oldValue, value)) {
      ValueChangeEvent.fire(this, getValue());
    }
  }
Esempio n. 30
0
  @Override
  public final Presenter onValueChange(ValueChangeEvent<String> event) {
    final String token = event.getValue();

    if (token != null) {
      if (token.equals(getListAction())) {
        return createListPresenter();
      } else if (token.equals(getAddAction())) {
        return createAddPresenter();
      } else if (token.equals(getEditAction())) {
        return createEditPresenter(null);
      }
    }
    return null;
  }