Java Code Examples for com.google.gwt.user.client.ui.HorizontalPanel#setWidth()

The following examples show how to use com.google.gwt.user.client.ui.HorizontalPanel#setWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Toolbar.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes and assembles all commands into buttons in the toolbar.
 */
public Toolbar() {
  buttonMap = new HashMap<String, TextButton>();
  dropDownButtonMap = new HashMap<String, DropDownButton>();

  leftButtons = new HorizontalPanel();
  leftButtons.setSpacing(4);

  rightButtons = new HorizontalPanel();
  rightButtons.setSpacing(4);
  rightButtons.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

  HorizontalPanel toolbar = new HorizontalPanel();
  toolbar.add(leftButtons);  // this nesting keeps buttons left aligned
  toolbar.add(rightButtons);
  toolbar.setCellHorizontalAlignment(rightButtons, HorizontalPanel.ALIGN_RIGHT);
  toolbar.setWidth("100%");
  toolbar.setStylePrimaryName("ya-Toolbar");

  initWidget(toolbar);
}
 
Example 2
Source File: GalleryAppBox.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates new Gallery app box.
 */
private GalleryAppBox() {
  gContainer = new FlowPanel();
  final HorizontalPanel container = new HorizontalPanel();
  container.setWidth("100%");
  container.setSpacing(0);
  container.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  HorizontalPanel panel = new HorizontalPanel();
  Image image = new Image();
  image.setResource(Ode.getImageBundle().waitingIcon());
  panel.add(image);
  Label label = new Label();
  label.setText(Ode.getMessages().defaultRpcMessage());
  panel.add(label);
  gContainer.add(panel);
  this.add(gContainer);
}
 
Example 3
Source File: StatusPanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
   * Initializes and assembles all UI elements shown in the status panel.
   */
  public StatusPanel() {
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setWidth("100%");
    hpanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    String tosUrl = Ode.getInstance().getSystemConfig().getTosUrl();
    if (!Strings.isNullOrEmpty(tosUrl)) {
      String appInventorFooter =
          "<a href=\"" + tosUrl + "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>";
      hpanel.add(new HTML(appInventorFooter));
    }

    // This shows the git version and the date of the build
//    String version = GitBuildId.getVersion();
//    String date = GitBuildId.getDate();
//    if (version != null && date != null) {
//      Label buildId = new Label(MESSAGES.gitBuildId(date, version));
//      hpanel.add(buildId);
//      hpanel.setCellHorizontalAlignment(buildId, HorizontalPanel.ALIGN_RIGHT);
//    }

    initWidget(hpanel);
    setStyleName("ode-StatusPanel");
  }
 
Example 4
Source File: BasicToolBar.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void initializew3wPanel() {
	w3wPanel = new HorizontalPanel();
	w3wPanel.setSpacing(5);
	w3wPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	StyleInjector.inject(".w3wPanel { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	w3wPanel.setStyleName("w3wPanel");
	w3wPanel.setWidth("415px");

	wordsLabel = new Label();
	w3wAnchor = new AnchorBuilder().setHref("https://what3words.com/")
			.setText(UIMessages.INSTANCE.what3Words())
			.setTitle("https://what3words.com/").build();
	w3wAnchor.getElement().getStyle().setColor("#FF0000");
	w3wAnchor.setVisible(false);
	w3wPanel.add(w3wAnchor);
	w3wPanel.add(wordsLabel);
}
 
Example 5
Source File: JoinDataDialog.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void createSeparatorPanel() {
	separatorPanel = new HorizontalPanel();
	separatorPanel.setSpacing(1);
	separatorPanel.setWidth("100%");
	separatorPanel.addStyleName(ThemeStyles.get().style().borderTop());
	separatorPanel.addStyleName(ThemeStyles.get().style().borderBottom());
	separatorPanel
			.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	separatorPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	separatorPanel.add(new Label(UIMessages.INSTANCE
			.separator(DEFAULT_CSV_SEPARATOR)));
	separatorTextField = new TextField();
	separatorTextField.setText(DEFAULT_CSV_SEPARATOR);
	separatorTextField.setWidth(30);

	separatorPanel.add(separatorTextField);
}
 
Example 6
Source File: ColumnListEditorView.java    From dashbuilder with Apache License 2.0 6 votes vote down vote up
@Override
public ColumnListEditor.View insert(final int index,
                                    final DataColumnDefEditor.View columnEditorView,
                                    final boolean selected, final boolean enabled,
                                    final String altText) {
    final CheckBox selectedInput = new CheckBox();
    selectedInput.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    selectedInput.getElement().getStyle().setTop(-7, Style.Unit.PX);
    selectedInput.setEnabled(enabled);
    selectedInput.setValue(selected);
    selectedInput.setTitle(altText != null ? altText : "");
    selectedInput.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> event) {
            presenter.onColumnSelect(index, event.getValue());
        }
    });

    final HorizontalPanel panel = new HorizontalPanel();
    panel.setWidth("100%");
    panel.add(selectedInput);
    panel.add(columnEditorView.asWidget());
    container.insert(panel, index);
    return this;
}
 
Example 7
Source File: Ode.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private void initializeGallery() {
  VerticalPanel gVertPanel = (VerticalPanel)deckPanel.getWidget(galleryTabIndex);
  gVertPanel.setWidth("100%");
  gVertPanel.setSpacing(0);
  galleryListToolbar = new GalleryToolbar();
  gVertPanel.add(galleryListToolbar);
  HorizontalPanel appListPanel = new HorizontalPanel();
  appListPanel.setWidth("100%");
  appListPanel.add(GalleryListBox.getGalleryListBox());
  gVertPanel.add(appListPanel);

  VerticalPanel aVertPanel = (VerticalPanel)deckPanel.getWidget(galleryAppTabIndex);
  aVertPanel.setWidth("100%");
  aVertPanel.setSpacing(0);
  galleryPageToolbar = new GalleryToolbar();
  aVertPanel.add(galleryPageToolbar);
  HorizontalPanel appPanel = new HorizontalPanel();
  appPanel.setWidth("100%");
  appPanel.add(GalleryAppBox.getGalleryAppBox());
  aVertPanel.add(appPanel);

  VerticalPanel mPVertPanel = (VerticalPanel)deckPanel.getWidget(moderationPageTabIndex);
  mPVertPanel.setWidth("100%");
  mPVertPanel.setSpacing(0);
  HorizontalPanel moderationPagePanel = new HorizontalPanel();
  moderationPagePanel.setWidth("100%");
  moderationPagePanel.add(ModerationPageBox.getModerationPageBox());
  mPVertPanel.add(moderationPagePanel);

  GalleryListBox.loadGalleryList();
  if (user.isModerator()) {
    ModerationPageBox.loadModerationPage();
  }
  PrivateUserProfileTabPanel.getPrivateUserProfileTabPanel().loadProfileImage();

  galleryInitialized = true;
}
 
Example 8
Source File: JoinDataDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private void getCSVComboPanel() {
	comboPanel = new HorizontalPanel();
	comboPanel.setWidth("100%");
	comboPanel.addStyleName(ThemeStyles.get().style().borderTop());
	comboPanel.setSpacing(5);
	comboPanel.setVisible(false);
	comboPanel.add(new Label(UIMessages.INSTANCE.bindableAttribute()));
	comboPanel.add(csvAttributeCombo);
}
 
Example 9
Source File: JoinDataDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private void createLayerAttributeComboPanel() {
	layerAttributeComboPanel = new HorizontalPanel();
	layerAttributeComboPanel.setWidth("100%");
	layerAttributeComboPanel.addStyleName(ThemeStyles.get().style()
			.borderBottom());
	layerAttributeComboPanel.setSpacing(5);
	layerAttributeComboPanel.setVisible(false);
	layerAttributeComboPanel.add(new Label(UIMessages.INSTANCE
			.layerSchemaToolText()));
	layerAttributeComboPanel.add(layerAttributeCombo);

}
 
Example 10
Source File: WebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text, boolean reverse) {
	super(null);
	iIcon = new Image(resource);
	iIcon.setTitle(title);
	iIcon.setAltText(title);
	if (text != null && !text.isEmpty()) {
		iLabel = new HTML(text, false);
		iPanel = new HorizontalPanel();
		iPanel.setStyleName("icon");
		if (reverse) {
			iPanel.add(iLabel);
			iPanel.add(iIcon);
			iLabel.getElement().getStyle().setPaddingRight(3, Unit.PX);
			iLabel.setWidth("100%");
			iPanel.setWidth("100%");
			iIcon.getElement().getStyle().setFloat(Float.RIGHT);
		} else {
			iPanel.add(iIcon);
			iPanel.add(iLabel);
			iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
		}
		iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
	}
	if (title != null && !title.isEmpty()) {
		iIcon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title);
			}
		});
	}
}
 
Example 11
Source File: HelpDialog.java    From circuitjs1 with GNU General Public License v2.0 4 votes vote down vote up
HelpDialog() {
	super();
	vp = new VerticalPanel();
	setWidget(vp);
	setText(sim.LS("Help"));

	TabPanel tp = new TabPanel();
	vp.add(tp);
	String tab1Title = "EN";
	String tab2Title = "RU";
	String tab3Title = "PL";
	String tab4Title = "DE";
	String tab5Title = "DA";

	      //create tabs 
	tp.add(vpEN = new VerticalPanel(), tab1Title);
	vpEN.setWidth("500px");
	vpEN.add(new HTML("<iframe style=\"border:0;\" src=\"help/EN.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));
	
	tp.add(vpRU = new VerticalPanel(), tab2Title);
	vpRU.setWidth("500px");
	vpRU.add(new HTML("<iframe style=\"border:0;\" src=\"help/RU.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));

	tp.add(vpPL = new VerticalPanel(), tab3Title);
	vpPL.setWidth("500px");
	vpPL.add(new HTML("<iframe style=\"border:0;\" src=\"help/PL.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));

	tp.add(vpDE = new VerticalPanel(), tab4Title);
	vpDE.setWidth("500px");
	vpDE.add(new HTML("<iframe style=\"border:0;\" src=\"help/DE.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));

	tp.add(vpDA = new VerticalPanel(), tab5Title);
	vpDA.setWidth("500px");
	vpDA.add(new HTML("<iframe style=\"border:0;\" src=\"help/DA.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>"));
	
	HorizontalPanel hp = new HorizontalPanel();
	hp.setWidth("100%");
	hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	hp.setStyleName("topSpace");
	
	//select first tab
	tp.selectTab(0);

	//set width if tabpanel
	tp.setWidth("500");
	
	vp.add(hp);
	hp.add(okButton = new Button("OK"));
	okButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			closeDialog();
		}
	});
	center();
	show();
}
 
Example 12
Source File: SimplePaletteItem.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new palette item.
 *
 * @param scd component descriptor for palette item
 * @param dropTargetProvider provider of targets that palette items can be dropped on
 */
public SimplePaletteItem(SimpleComponentDescriptor scd, DropTargetProvider dropTargetProvider) {
  this.dropTargetProvider = dropTargetProvider;
  this.scd = scd;

  componentPrototype = null;

  // Initialize palette item UI
  HorizontalPanel panel = new HorizontalPanel();
  panel.setStylePrimaryName("ode-SimplePaletteItem");

  Image image = scd.getImage();
  image.setStylePrimaryName("ode-SimplePaletteItem-icon");
  panel.add(image);
  panel.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT);
  panel.setCellWidth(image, "30px");

  Label label = new Label(ComponentsTranslation.getComponentName(scd.getName()));
  label.setHorizontalAlignment(Label.ALIGN_LEFT);
  label.addStyleName("ode-SimplePaletteItem-caption");
  panel.add(label);

  HorizontalPanel optPanel = new HorizontalPanel();

  ComponentHelpWidget helpImage = new ComponentHelpWidget(scd);
  optPanel.add(helpImage);
  optPanel.setCellHorizontalAlignment(helpImage, HorizontalPanel.ALIGN_LEFT);

  if (scd.getExternal()) {
    ComponentRemoveWidget deleteImage = new ComponentRemoveWidget(scd);
    optPanel.add(deleteImage);
    optPanel.setCellHorizontalAlignment(deleteImage, HorizontalPanel.ALIGN_RIGHT);
  }

  panel.add(optPanel);
  panel.setCellHorizontalAlignment(optPanel, HorizontalPanel.ALIGN_RIGHT);

  panel.setWidth("100%");
  add(panel);
  setWidth("100%");

  addHandlers();
}
 
Example 13
Source File: Ode.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
private Widget createLoadingWidget(final int pending) {
  final HorizontalPanel container = new HorizontalPanel();
  container.setWidth("100%");
  container.setSpacing(0);
  container.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  HorizontalPanel panel = new HorizontalPanel();
  Image image = new Image();
  image.setResource(IMAGES.waitingIcon());
  panel.add(image);
  Label label = new Label();
  label.setText(MESSAGES.defaultRpcMessage());
  panel.add(label);
  container.add(panel);
  GalleryClient.getInstance().addListener(new GalleryRequestListener() {
    volatile int count = pending;
    private void hideLoadingWidget() {
      if (container.getParent() != null) {
        container.clear();
        container.removeFromParent();
      }
    }
    @Override
    public boolean onAppListRequestCompleted(GalleryAppListResult appsResult, int requestID, boolean refreshable) {
      if ((--count) <= 0) {
        hideLoadingWidget();
        return true;
      }
      return false;
    }
    @Override
    public boolean onCommentsRequestCompleted(List<GalleryComment> comments) {
      if ((--count) <= 0) {
        hideLoadingWidget();
        return true;
      }
      return false;
    }
    @Override
    public boolean onSourceLoadCompleted(UserProject projectInfo) {
      if ((--count) <= 0) {
        hideLoadingWidget();
        return true;
      }
      return false;
    }
  });
  return container;
}
 
Example 14
Source File: HomePage.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
@Override
  public void buildGUI() {
add( ClientUtils.createVerticalEmptyWidget( 30 ) );

final HorizontalPanel greetingsPanel = new HorizontalPanel();
add( greetingsPanel );

if ( sharedApiAccountUserInfo == null ) {
	// Greeting
	if ( apiUserInfo.getLastVisit() == null ) {
		greetingsPanel.add( new Label( "Welcome " ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getUserName() ), "strong" ) );
		greetingsPanel.add( new Label( "!" ) );
	}
	else {
		greetingsPanel.add( new Label( "Welcome back" ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getUserName() ), "strong" ) );
		greetingsPanel.add( new Label( "! Your last visit was at:" ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.createTimestampWidget( apiUserInfo.getLastVisit() ) );
	}
}
else {
	if ( sharedApiAccountUserInfo.isHasApiAccount() )
		greetingsPanel.add( new Label( "You are now viewing the" ) );
	else
		greetingsPanel.add( new Label( "You do NOT have access to the" ) );
	greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 9 ) );
	greetingsPanel.add( ClientUtils.styledWidget( new Label( sharedApiAccountUserInfo.getSharedApiAccount() ), "strong" ) );
	greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 9 ) );
	greetingsPanel.add( new Label( "API account!" ) );
}

// Replay parser engine version
if ( apiUserInfo.getRepParserEngineVer() != null ) {
	add( ClientUtils.createVerticalEmptyWidget( 30 ) );
	final HorizontalPanel rowPanel = new HorizontalPanel();
	rowPanel.add( new Label( "Replay parser engine version:" ) );
	rowPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
	rowPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getRepParserEngineVer() ), "strong" ) );
	add( rowPanel );
}

// Parsing service tester page
add( ClientUtils.createVerticalEmptyWidget( 30 ) );
add( new Anchor( "Parsing Service Tester page", "/parsing_service_tester.html", "_blank" ) );

add( ClientUtils.createVerticalEmptyWidget( 70 ) );

// Footer
final HorizontalPanel linksPanel = new HorizontalPanel();
linksPanel.setWidth( "500px" );
DOM.setStyleAttribute( linksPanel.getElement(), "padding", "2px" );
DOM.setStyleAttribute( linksPanel.getElement(), "borderTop", "1px solid #555555" );
linksPanel.addStyleName( "noWrap" );
linksPanel.add( new Anchor( "About the Service", "https://sites.google.com/site/sc2gears/parsing-service", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 10 ) );
linksPanel.add( new Anchor( "Terms of Service", "https://sites.google.com/site/sc2gears/parsing-service#TOC-Terms-of-Service", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 10 ) );
linksPanel.add( new Anchor( "Privacy Policy", "https://sites.google.com/site/sc2gears/parsing-service#TOC-Privacy-Policy", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 15 ) );
final Label lastLabel = new Label( "© András Belicza, 2011-2014, Icons: Fugue" );
DOM.setStyleAttribute( lastLabel.getElement(), "color", "#555555" );
DOM.setStyleAttribute( lastLabel.getElement(), "paddingTop", "3px" );
linksPanel.add( lastLabel );
linksPanel.setCellWidth( lastLabel, "100%" );
linksPanel.setCellHorizontalAlignment( lastLabel, HasHorizontalAlignment.ALIGN_RIGHT );
for ( int i = linksPanel.getWidgetCount() - 1; i >= 0; i-- )
	DOM.setStyleAttribute( linksPanel.getWidget( i ).getElement(), "fontSize", "80%" );
add( linksPanel );
  }
 
Example 15
Source File: HistoryViewer.java    From swellrt with Apache License 2.0 4 votes vote down vote up
public void buildUI() {

    //
    // Panel Left (document viewer and playback controls)
    //

    panelLeft = new VerticalPanel();
    panelLeft.add(docViewer.getWidget());
    panelLeft.setWidth("100%");
    setCSS(docViewer.getWidget(),
        "padding", "5px",
        "margin", "10px",
        "border", "1px solid darkgray",
        "min-height", "300px");


    panelPlayControl = new VerticalPanel();
    panelLeft.add(panelPlayControl);

    labelShowingRevision = new Label("Base revision #");
    panelPlayControl.add(labelShowingRevision);

    labelBaseRevision = new Label("?");
    panelPlayControl.add(labelBaseRevision);

    panelPlayControl.add(new Label("Diff with revision #"));
    boxTargetRevision = new TextBox();
    boxTargetRevision.setWidth("5em");
    boxTargetRevision.setValue("?");
    panelPlayControl.add(boxTargetRevision);


    btnShowDiff = new Button("Show diffs", new ClickHandler() {
      public void onClick(ClickEvent e) {

        try {
          int targetRevisionIndex = Integer.valueOf(boxTargetRevision.getValue());
          targetRevision = docHistory.getUnsafe(targetRevisionIndex);

          docViewer.removeContentAndUnrender();
          playbackDoc.renderDiff(baseRevision, targetRevision, doc -> {
          });
          docViewer.setContent(playbackDoc.getDocument());

        } catch (NumberFormatException ex) {

        }
      }
    });
    panelPlayControl.add(btnShowDiff);
    panelLeft.add(panelPlayControl);


    //
    // Right panel (history log)
    //

    panelRight = new VerticalPanel();

    DocHistory.Iterator history = docHistory.getIterator();

    traverseAllPrev(history, revision -> {
      panelRight.add(new Button(revision.toString(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
          docViewer.removeContentAndUnrender();
          playbackDoc.render(revision, doc -> {
          });
          docViewer.setContent(playbackDoc.getDocument());
          baseRevision = revision;
          labelBaseRevision.setText("" + baseRevision.getRevisionIndex());
        }

      }));

    });

    //
    //
    //

    HorizontalPanel mainPanel = new HorizontalPanel();
    mainPanel.setWidth("100%");

    mainPanel.add(panelLeft);
    mainPanel.setCellWidth(panelLeft, "75%");

    mainPanel.add(panelRight);
    mainPanel.setCellWidth(panelRight, "25%");

    initWidget(mainPanel);

  }
 
Example 16
Source File: HorizImageListEditorView.java    From dashbuilder with Apache License 2.0 4 votes vote down vote up
@Override
public ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,
                                   final SafeHtml heading, final SafeHtml text, 
                                   final boolean selected, final Command clickCommand) {
    final VerticalPanel panel = new VerticalPanel();
    panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
    panel.setHeight("100%");

    final Image image = new Image(uri);
    image.setWidth(width);
    image.setHeight(height);
    image.addStyleName(style.image());
    final double alpha = selected ? 1 : 0.2;
    image.getElement().setAttribute("style", "filter: alpha(opacity=5);opacity: " + alpha);

    final Tooltip tooltip = new Tooltip();
    tooltip.setTitle( text.asString() );
    tooltip.setWidget(image);
    tooltip.setContainer("body");
    tooltip.setPlacement(Placement.BOTTOM);
    tooltip.setIsAnimated(false);
    tooltip.setShowDelayMs(100);

    final HTML label = new HTML(heading.asString());
    final HorizontalPanel labelPanel = new HorizontalPanel();
    labelPanel.setWidth("100%");
    labelPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    labelPanel.add(label);

    panel.add(tooltip);
    panel.add(labelPanel);        
    mainPanel.add(panel);

    image.addClickHandler(e -> {
        tooltip.hide();
        tooltip.destroy();
        clickCommand.execute();
    });

    return this;
}