Exemplo n.º 1
0
  private void updateList() {

    group.removeAllComponents();

    if (lists.size() > 0) {
      // Re-Populate view
      // List<TokkaList> lists = ((TokkaUI)getUI()).getLists();
      for (final TokkaList list : lists) {
        HorizontalLayout hl = new HorizontalLayout();
        hl.setWidth("100%");

        Label lbl = new Label(list.getName());
        lbl.setSizeUndefined();
        hl.addComponent(lbl);

        lbl = new Label(list.getUndoneItems() + "/" + list.getTotalItems());
        lbl.setSizeUndefined();
        hl.addComponent(lbl);

        hl.setExpandRatio(hl.getComponent(0), 1);

        hl.addLayoutClickListener(
            new LayoutClickListener() {

              @Override
              public void layoutClick(LayoutClickEvent event) {
                getNavigationManager().navigateTo(new ItemView(list, MainView.this));
              }
            });

        group.addComponent(hl);
      }
    } else {
      group.addComponent(new Label("No items added yet."));
    }
  }