private void setup() {
    // destroy dated tagLayouts
    if (tagLayouts != null) {
      for (LocatableHLayout tagLayout : tagLayouts) {
        removeMember(tagLayout);
        tagLayout.destroy();
      }
    }
    // remove remaining members
    for (Canvas canvas : getMembers()) {
      removeMember(canvas);
    }

    // [re]build

    addMember(tagTitleLabel);

    tagLayouts = createTagLayouts();
    for (LocatableHLayout tagLayout : tagLayouts) {
      addMember(tagLayout);
    }

    if (!readOnly) {
      addMember(addImg);
      tagInputDialog.place(addImg);
    }

    markForRedraw();
  }
  public void refreshCarouselInfo() {
    if (this.showFooter && (this.carouselHolder != null)) {
      if (this.carouselActionDisableOverride) {
        // this.listGrid.setSelectionType(SelectionStyle.NONE);
      } else {
        // this.listGrid.setSelectionType(getDefaultSelectionStyle());
      }

      // int selectionCount = this.listGrid.getSelectedRecords().length;
      for (CarouselActionInfo carouselAction : this.carouselActions) {
        if (carouselAction.actionCanvas
            != null) { // if null, we haven't initialized our buttons yet, so skip this
          boolean enabled =
              (!this.carouselActionDisableOverride && carouselAction.action.isEnabled());
          carouselAction.actionCanvas.setDisabled(!enabled);
        }
      }
      for (Canvas extraWidget : this.extraWidgetsAboveFooter) {
        extraWidget.enable();
        if (extraWidget instanceof CarouselWidget) {
          ((CarouselWidget) extraWidget).refresh(carouselHolder.getMembers());
        }
      }
      for (Canvas extraWidget : this.extraWidgetsInMainFooter) {
        extraWidget.enable();
        if (extraWidget instanceof CarouselWidget) {
          ((CarouselWidget) extraWidget).refresh(carouselHolder.getMembers());
        }
      }

      if (isShowFooterRefresh() && this.refreshButton != null) {
        this.refreshButton.enable();
      }
    }
  }
  @Override
  protected void onInit() {
    super.onInit();

    contents = new LocatableVLayout(extendLocatorId("Contents"));
    contents.setWidth100();
    contents.setHeight100();

    addMember(contents);

    filterForm = new CarouselFilter(this);

    /*
     * carousel filters and search bar are currently mutually exclusive
     */

    if (getSearchSubsystem() == null) {
      configureCarouselFilters();

    } else {
      if (!this.hideSearchBar) {
        final EnhancedSearchBarItem searchFilter =
            new EnhancedSearchBarItem(
                "search", getSearchSubsystem(), getInitialSearchBarSearchText());
        setFilterFormItems(searchFilter);
      }
    }

    carouselHolder = new LocatableHLayout(extendLocatorId("Holder"));
    carouselHolder.setOverflow(Overflow.AUTO);
    carouselHolder.setWidth100();
    contents.addMember(carouselHolder);
  }
  private ArrayList<LocatableHLayout> createTagLayouts() {
    ArrayList<LocatableHLayout> tagLayouts = new ArrayList<LocatableHLayout>(tags.size());

    for (final Tag tag : tags) {
      LocatableHLayout tagLayout = new LocatableHLayout(extendLocatorId(tag.getName()));
      tagLayout.setHeight(18);
      tagLayout.setHeight(16);

      HTMLFlow tagString =
          new HTMLFlow(
              "<nobr><a href=\""
                  + LinkManager.getTagLink(tag.toString())
                  + "\">"
                  + tag.toString()
                  + "</a></nobr>");
      tagString.setAutoWidth();
      tagLayout.addMember(tagString);

      if (!readOnly) {
        final LayoutSpacer spacer = new LayoutSpacer();
        spacer.setHeight(16);
        spacer.setWidth(16);

        final Img remove =
            new LocatableImg(
                tagLayout.extendLocatorId("Remove"), "[skin]/images/actions/remove.png", 16, 16);
        remove.setTooltip(MSG.view_tags_tooltip_1());
        remove.addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent clickEvent) {
                tags.remove(tag);
                save();
              }
            });

        tagLayout.addMember(remove);
        tagLayout.addMember(spacer);
        remove.hide();

        tagLayout.addMouseOverHandler(
            new MouseOverHandler() {
              public void onMouseOver(MouseOverEvent mouseOverEvent) {
                remove.show();
                spacer.hide();
              }
            });
        tagLayout.addMouseOutHandler(
            new MouseOutHandler() {
              public void onMouseOut(MouseOutEvent mouseOutEvent) {
                spacer.show();
                remove.hide();
              }
            });
      }

      tagLayouts.add(tagLayout);
    }

    return tagLayouts;
  }
 protected void buildCarousel(boolean isRefresh) {
   if (null != carouselHolder) {
     carouselHolder.destroyMembers();
   }
 }
 @Override
 public void destroy() {
   SeleniumUtility.destroyMembers(contents);
   super.destroy();
 }
  @Override
  protected void onDraw() {
    try {
      super.onDraw();

      for (Canvas child : contents.getMembers()) {
        contents.removeChild(child);
      }

      // Title
      this.titleCanvas = new HTMLFlow();
      setTitleString(this.titleString);

      if (showTitle) {
        titleLayout = new LocatableHLayout(contents.extendLocatorId("Title"));
        titleLayout.setAutoHeight();
        titleLayout.setAlign(VerticalAlignment.BOTTOM);
        titleLayout.setMembersMargin(4);
        contents.addMember(titleLayout, 0);
      }

      if (null != carouselDetails) {
        contents.addMember(carouselDetails);
      }

      if (filterForm.hasContent()) {
        contents.addMember(filterForm);
      }

      contents.addMember(carouselHolder);

      // Footer

      // A second toolstrip that optionally appears before the main footer - it will contain extra
      // widgets.
      // This is hidden from view unless extra widgets are actually added to the carousel above the
      // main footer.
      this.footerExtraWidgets =
          new LocatableToolStrip(contents.extendLocatorId("FooterExtraWidgets"));
      footerExtraWidgets.setPadding(5);
      footerExtraWidgets.setWidth100();
      footerExtraWidgets.setMembersMargin(15);
      footerExtraWidgets.hide();
      contents.addMember(footerExtraWidgets);

      this.footer = new LocatableToolStrip(contents.extendLocatorId("Footer"));
      footer.setPadding(5);
      footer.setWidth100();
      footer.setMembersMargin(15);
      contents.addMember(footer);

      // The ListGrid has been created and configured
      // Now give subclasses a chance to configure the carousel
      configureCarousel();

      Label carouselInfo = new Label();
      carouselInfo.setWrap(false);
      setCarouselInfo(carouselInfo);

      if (showTitle) {
        drawTitle();
      }

      if (showFooter) {
        drawFooter();
      }
    } catch (Exception e) {
      CoreGUI.getErrorHandler().handleError(MSG.view_table_drawFail(this.toString()), e);
    }
  }