Example #1
0
  @Override
  protected LocatableVLayout defaultView() {
    LocatableVLayout vLayout = new LocatableVLayout(this.extendLocatorId("Default"));
    vLayout.setWidth100();

    // TODO: Help icon.
    TitleBar titleBar = new TitleBar(this, MSG.common_title_help());
    vLayout.addMember(titleBar);

    Label label = new Label(MSG.view_helpTop_description());
    label.setPadding(10);
    vLayout.addMember(label);

    return vLayout;
  }
  @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);
  }
  @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);
    }
  }