private void resetIcon() {
   if (null == product.getIconKey()) {
     icon.setSrc("images/noicon.gif");
     containerPanel.getWidget(0).setVisible(false);
   } else {
     containerPanel.getWidget(0).setVisible(true);
     icon.setSrc(
         "gwt_marketplace/productImage?key=" + product.getId() + "&ik=" + product.getIconKey());
     icon.getStyle().setDisplay(Display.BLOCK);
   }
 }
  public StatusBarWidget() {
    Binder binder = GWT.create(Binder.class);
    HorizontalPanel hpanel = binder.createAndBindUi(this);
    hpanel.setVerticalAlignment(HorizontalPanel.ALIGN_TOP);

    hpanel.setCellWidth(hpanel.getWidget(2), "100%");

    initWidget(hpanel);

    height_ = 16;
  }
 public void updateRow(int row) {
   WalrusInfoWeb walrus = this.walrusList.get(row);
   Grid g = (Grid) this.grid.getWidget(row, 0);
   HorizontalPanel p = (HorizontalPanel) g.getWidget(0, 1);
   walrus.setHost(((TextBox) p.getWidget(0)).getText());
   int widgetStartIndex = 1;
   ArrayList<String> properties = walrus.getProperties();
   for (int i = 0; i < (properties.size() / 4); ++i) {
     if (properties.get(4 * i).startsWith("KEYVALUE"))
       properties.set(4 * i + 2, ((TextBox) g.getWidget(widgetStartIndex + i, 1)).getText());
   }
 }
  /**
   * Add in a collection of buttons assembled as a ToolbarGroup
   *
   * @param group ToolbarGroup to add.
   */
  public void add(ToolbarGroup group) {

    // check to see if there's already a separator added before this group
    if (!(bar.getWidget(bar.getWidgetCount() - 1) instanceof Image)) {
      bar.add(group.getLeadingSeparator());
      bar.setCellVerticalAlignment(group.getLeadingSeparator(), ALIGN_MIDDLE);
    }

    // if the group has a label tag, add it before the buttons
    if (group.getLabel() != null) {
      bar.add(group.getGroupLabel());
      bar.setCellVerticalAlignment(group.getGroupLabel(), ALIGN_MIDDLE);
    }

    // add the buttons to the bar and buttons collection
    for (ToolbarButton btn : group.getButtons()) {
      bar.add(btn.getPushButton());
    }
    bar.add(group.getTrailingSeparator());
    bar.setCellVerticalAlignment(group.getTrailingSeparator(), ALIGN_MIDDLE);
    groups.add(group);
  }
  private void showAddItemAttributeDialog(final VkMenuBarHorizontal menuBar) {
    final DialogBox origDialog = new DialogBox();
    DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE));
    final VerticalPanel dialog = new VerticalPanel();
    origDialog.add(dialog);
    origDialog.setText("Provide html for item name and JS to execute on its click");
    dialog.setWidth("100%");
    dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.MAX_VALUE + "");

    HorizontalPanel nameHp = new HorizontalPanel();
    nameHp.setWidth("100%");
    dialog.add(nameHp);
    nameHp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    nameHp.add(new Label("Name HTML:"));
    nameHp.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    nameHp.setCellWidth(nameHp.getWidget(0), "35%");
    final TextArea nameTextArea = new TextArea();
    nameHp.add(nameTextArea);
    nameTextArea.setSize("300px", "100px");
    Timer t =
        new Timer() {
          @Override
          public void run() {
            VkDesignerUtil.centerDialog(dialog);
            nameTextArea.setFocus(true);
          }
        };
    t.schedule(100);
    HorizontalPanel jsHp = new HorizontalPanel();
    jsHp.setWidth("100%");
    dialog.add(jsHp);
    jsHp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    jsHp.add(new Label("Command Js:"));
    jsHp.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    jsHp.setCellWidth(jsHp.getWidget(0), "35%");
    final VkEventTextArea jsTextArea = new VkEventTextArea();
    jsTextArea.setSize("300px", "100px");
    jsHp.add(jsTextArea);
    HorizontalPanel buttonsPanel = new HorizontalPanel();
    dialog.add(buttonsPanel);
    Button saveButton = new Button("Save");
    buttonsPanel.add(saveButton);
    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            menuBar.getCommandJs().put(menuBar.getItemCount(), jsTextArea.getText());
            addMenuItem(menuBar, nameTextArea.getText(), jsTextArea.getText());
            origDialog.hide();
          }
        });
    Button cancelButton = new Button("Cancel");
    buttonsPanel.add(cancelButton);
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            origDialog.hide();
          }
        });
    origDialog.center();
    origDialog.setPopupPosition(origDialog.getPopupLeft() + 1, origDialog.getPopupTop());
  }
 /**
  * Gets a tab.
  *
  * @param index the index.
  * @return the tab.
  */
 public SimpleTab getTab(final int index) {
   return (SimpleTab) tabDropZone.getWidget(index);
 }
 private String getParameterValue(HorizontalPanel entry) {
   TextBox key = (TextBox) entry.getWidget(2);
   return key.getText();
 }