public void setCart(ShoppingCart cart) {
   _cart = cart;
   _contentsForm.setCart(_cart);
   _settingsForm.setCart(_cart);
   if (_header != null && cart != null) {
     _header.setHTML("Shopping Cart " + _cart.id());
   }
 }
  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);
  }
 public void refreshSettings() {
   _settingsForm.refresh();
 }
 public void applySettings(boolean saveToUserSelfSettings, ObjectMessageResponse<Null> rh) {
   _settingsForm.applySettings(saveToUserSelfSettings, rh);
 }
 public boolean isSettingsValid() {
   return _settingsForm.valid().valid();
 }
 public void addSettingsChangeLisenter(StateChangeListener scl) {
   if (_settingsForm != null) {
     _settingsForm.addChangeListener(scl);
   }
 }
 public boolean settingsChanged() {
   return _settingsForm == null ? false : _settingsForm.changed();
 }
 public void updateSettings() {
   _settingsForm.refresh();
 }