Ejemplo n.º 1
0
 /** Called after construction and injection. */
 @SuppressWarnings("unchecked")
 @PostConstruct
 protected void postConstruct() {
   ownerAny.setValue(true);
   ClickHandler clearFilterHandler =
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           setValue(new TaskInboxFilterBean(), true);
         }
       };
   clearFilters.addClickHandler(clearFilterHandler);
   @SuppressWarnings("rawtypes")
   ValueChangeHandler valueChangeHandler =
       new ValueChangeHandler() {
         @Override
         public void onValueChange(ValueChangeEvent event) {
           onFilterValueChange();
         }
       };
   ClickHandler clickHandler =
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           onFilterValueChange();
         }
       };
   ownerAny.addClickHandler(clickHandler);
   ownerMine.addClickHandler(clickHandler);
   ownerGroup.addClickHandler(clickHandler);
   ownerActive.addClickHandler(clickHandler);
   priority.addValueChangeHandler(valueChangeHandler);
   dateDueFrom.addValueChangeHandler(valueChangeHandler);
   dateDueTo.addValueChangeHandler(valueChangeHandler);
 }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
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);
   }
 }