Пример #1
0
  /**
   * Creates a header with the specified appearance.
   *
   * @param appearance the appearance of the header
   */
  public Header(HeaderAppearance appearance) {
    this.appearance = appearance;

    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    this.appearance.render(sb);

    setElement((Element) XDOM.create(sb.toSafeHtml()));

    addStyleName("x-small-editor");

    widgetPanel = new HorizontalPanel();
    widgetPanel.addStyleName("x-panel-toolbar");

    XElement barElem = appearance.getBarElem(getElement());
    barElem.appendChild(widgetPanel.getElement());

    if (tools.size() > 0) {
      for (int i = 0; i < tools.size(); i++) {
        widgetPanel.add(tools.get(i));
      }
    } else {
      widgetPanel.setVisible(false);
    }

    ComponentHelper.setParent(this, widgetPanel);

    appearance.getTextElem(getElement()).setId(getId() + "-label");

    setText(text);

    if (icon != null) {
      setIcon(icon);
    }

    getFocusSupport().setIgnore(true);
  }
Пример #2
0
 /**
  * Sets the header's text.
  *
  * @param text the new text
  */
 public void setText(String text) {
   this.text = text;
   appearance.getTextElem(getElement()).setInnerHTML(text == null ? "&#160;" : text);
 }
Пример #3
0
 @Override
 public void setHTML(String html) {
   appearance.getTextElem(getElement()).setInnerHTML(html);
 }
Пример #4
0
 @Override
 public void setIcon(ImageResource icon) {
   this.icon = icon;
   appearance.setIcon(getElement(), icon);
 }
Пример #5
0
 @Override
 public String getHTML() {
   return appearance.getTextElem(getElement()).getInnerHTML();
 }