예제 #1
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);
  }
예제 #2
0
 /** @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) */
 @Override
 public void setValue(TaskInboxFilterBean value, boolean fireEvents) {
   if (value.getOwner() == TaskOwnerEnum.any) {
     ownerAny.setValue(true);
   } else if (value.getOwner() == TaskOwnerEnum.mine) {
     ownerMine.setValue(true);
   } else if (value.getOwner() == TaskOwnerEnum.active) {
     ownerActive.setValue(true);
   } else if (value.getOwner() == TaskOwnerEnum.group) {
     ownerGroup.setValue(true);
   }
   priority.setValue(
       value.getPriority() == -1 ? "" : String.valueOf(value.getPriority())); // $NON-NLS-1$
   dateDueFrom.setDateValue(value.getDateDueFrom() == null ? null : value.getDateDueFrom());
   dateDueTo.setDateValue(value.getDateDueTo() == null ? null : value.getDateDueTo());
   TaskInboxFilterBean oldState = this.currentState;
   currentState = value;
   if (fireEvents) {
     ValueChangeEvent.fireIfNotEqual(this, oldState, currentState);
   }
 }