FileDocCategorySizeDatePackage
DayFilterWidget.javaAPI DocExample3460Mon Aug 27 20:11:36 BST 2007com.google.gwt.sample.dynatable.client

DayFilterWidget

public class DayFilterWidget extends com.google.gwt.user.client.ui.Composite
A UI Widget that allows a user to filter the days being displayed in the dynamic table.

Fields Summary
private final SchoolCalendarWidget
calendar
private final com.google.gwt.user.client.ui.VerticalPanel
outer
private final DayCheckBoxListener
dayCheckBoxListener
Constructors Summary
public DayFilterWidget(SchoolCalendarWidget calendar)


     
    this.calendar = calendar;
    initWidget(outer);
    setStyleName("DynaTable-DayFilterWidget");
    outer.add(new DayCheckBox("Sunday", 0));
    outer.add(new DayCheckBox("Monday", 1));
    outer.add(new DayCheckBox("Tuesday", 2));
    outer.add(new DayCheckBox("Wednesday", 3));
    outer.add(new DayCheckBox("Thursday", 4));
    outer.add(new DayCheckBox("Friday", 5));
    outer.add(new DayCheckBox("Saturday", 6));

    Button buttonAll = new Button("All", new ClickListener() {
      public void onClick(Widget sender) {
        setAllCheckBoxes(true);
      }
    });

    Button buttonNone = new Button("None", new ClickListener() {
      public void onClick(Widget sender) {
        setAllCheckBoxes(false);
      }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    hp.add(buttonAll);
    hp.add(buttonNone);

    outer.add(hp);
    outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM);
    outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER);
  
Methods Summary
private voidsetAllCheckBoxes(boolean checked)

    for (int i = 0, n = outer.getWidgetCount(); i < n; ++i) {
      Widget w = outer.getWidget(i);
      if (w instanceof DayCheckBox) {
        ((DayCheckBox) w).setChecked(checked);
        dayCheckBoxListener.onClick(w);
      }
    }