public void setCart(ShoppingCart cart) {
   _cart = cart;
   _contentsForm.setCart(_cart);
   _settingsForm.setCart(_cart);
   if (_header != null && cart != null) {
     _header.setHTML("Shopping Cart " + _cart.id());
   }
 }
Пример #2
0
  public ACLFilterItem(CompositeFilterForm form, ACLFilter filter, boolean editable) {
    super(form, filter, editable);
    _hp = new HorizontalPanel();
    _hp.setHeight(22);

    HTML label = new HTML("acl");
    label.setFontSize(11);
    label.setMarginTop(8);
    _hp.add(label);
    _hp.setSpacing(3);

    _formSP = new SimplePanel();
    _formSP.setHeight100();
    _hp.add(_formSP);

    updateForm();
  }
  public ShoppingCartForm(ShoppingCart cart, FormEditMode mode, boolean showHeader) {

    _mode = mode;

    _vp = new VerticalPanel();
    _vp.fitToParent();

    /*
     * header
     */
    if (showHeader) {
      CenteringPanel headerSP = new CenteringPanel();
      headerSP.setWidth100();
      headerSP.setHeight(20);
      headerSP.setBackgroundImage(
          new LinearGradient(
              LinearGradient.Orientation.TOP_TO_BOTTOM,
              ListGridHeader.HEADER_COLOUR_LIGHT,
              ListGridHeader.HEADER_COLOUR_DARK));
      _header = new HTML();
      _header.fitToParent();
      _header.setFontSize(11);
      _header.setFontWeight(FontWeight.BOLD);
      headerSP.setContent(_header);
      _vp.add(headerSP);
    }

    /*
     * tabs
     */
    _tp =
        new TabPanel() {
          protected void activated(int id) {
            _activeTabId = id;
            if (_activeTabId == _contentsTabId) {
              contentsTabActivated();
            }
            if (_activeTabId == _settingsTabId) {
              settingsTabActivated();
            }
          }
        };
    _tp.fitToParent();
    _tp.setBodyBorder(1, BorderStyle.SOLID, new RGB(0x97, 0x97, 0x97));

    /*
     * content tab
     */
    _contentsForm = new ShoppingCartContentsForm(null, _mode);
    _contentsTabId = _tp.addTab(TAB_NAME_CONTENTS, null, _contentsForm.gui());
    addMustBeValid(_contentsForm);

    /*
     * settings tab
     */
    _settingsForm = new ShoppingCartSettingsForm(null, _mode);
    _settingsTabId = _tp.addTab(TAB_NAME_SETTINGS, null, _settingsForm.gui());
    addMustBeValid(_settingsForm);

    _tp.setActiveTabById(_contentsTabId);
    _vp.add(_tp);

    setCart(cart);
  }