Beispiel #1
0
  public void reconfigure() {
    // First destroy the old tooltip
    destroy();

    // Setup the new tooltip
    if (container != null && selector != null) {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          selector,
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs,
          container);
    } else if (container != null) {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs,
          container);
    } else if (selector != null) {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          selector,
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs);
    } else {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs);
    }
  }
  /**
   * Reconfigures the tooltip, must be called when altering any tooltip after it has already been
   * shown
   */
  public void reconfigure() {
    // First destroy the old tooltip
    destroy();

    // add RootPanel click handler
    clickHandler =
        RootPanel.get()
            .addDomHandler(
                new ClickHandler() {
                  @Override
                  public void onClick(ClickEvent event) {
                    Tooltip.this.hide();
                  }
                },
                ClickEvent.getType());

    // prepare template
    String template = null;
    if (alternateTemplate == null) {
      template = DEFAULT_TEMPLATE.replace("{0}", getTooltipClassNames()); // $NON-NLS-1$
      template = template.replace("{1}", getTooltipArrowClassNames()); // $NON-NLS-1$
      template = template.replace("{2}", getTooltipInnerClassNames()); // $NON-NLS-1$
    } else {
      template = alternateTemplate;
    }

    // TODO clean this up

    // Setup the new tooltip
    if (container != null && selector != null) {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          selector,
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs,
          container,
          template);
    } else if (container != null) {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs,
          container,
          template);
    } else if (selector != null) {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          selector,
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs,
          template);
    } else {
      tooltip(
          widget.getElement(),
          isAnimated,
          isHTML,
          placement.getCssName(),
          title,
          trigger.getCssName(),
          showDelayMs,
          hideDelayMs,
          template);
    }
  }