You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VTooltip.java 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.client;
  17. import com.google.gwt.aria.client.LiveValue;
  18. import com.google.gwt.aria.client.RelevantValue;
  19. import com.google.gwt.aria.client.Roles;
  20. import com.google.gwt.dom.client.Element;
  21. import com.google.gwt.dom.client.Style.Display;
  22. import com.google.gwt.event.dom.client.BlurEvent;
  23. import com.google.gwt.event.dom.client.BlurHandler;
  24. import com.google.gwt.event.dom.client.DomEvent;
  25. import com.google.gwt.event.dom.client.FocusEvent;
  26. import com.google.gwt.event.dom.client.FocusHandler;
  27. import com.google.gwt.event.dom.client.KeyDownEvent;
  28. import com.google.gwt.event.dom.client.KeyDownHandler;
  29. import com.google.gwt.event.dom.client.MouseDownEvent;
  30. import com.google.gwt.event.dom.client.MouseDownHandler;
  31. import com.google.gwt.event.dom.client.MouseMoveEvent;
  32. import com.google.gwt.event.dom.client.MouseMoveHandler;
  33. import com.google.gwt.user.client.DOM;
  34. import com.google.gwt.user.client.Event;
  35. import com.google.gwt.user.client.Timer;
  36. import com.google.gwt.user.client.Window;
  37. import com.google.gwt.user.client.ui.FlowPanel;
  38. import com.google.gwt.user.client.ui.RootPanel;
  39. import com.google.gwt.user.client.ui.Widget;
  40. import com.vaadin.client.ui.VOverlay;
  41. /**
  42. * TODO open for extension
  43. */
  44. public class VTooltip extends VOverlay {
  45. private static final String CLASSNAME = "v-tooltip";
  46. private static final int MARGIN = 4;
  47. public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN
  48. | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEMOVE
  49. | Event.ONCLICK;
  50. VErrorMessage em = new VErrorMessage();
  51. Element description = DOM.createDiv();
  52. private TooltipInfo currentTooltipInfo = new TooltipInfo(" ");
  53. private boolean closing = false;
  54. private boolean opening = false;
  55. // Open next tooltip faster. Disabled after 2 sec of showTooltip-silence.
  56. private boolean justClosed = false;
  57. private String uniqueId = DOM.createUniqueId();
  58. private int maxWidth;
  59. // Delays for the tooltip, configurable on the server side
  60. private int openDelay;
  61. private int quickOpenDelay;
  62. private int quickOpenTimeout;
  63. private int closeTimeout;
  64. /**
  65. * Used to show tooltips; usually used via the singleton in
  66. * {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be
  67. * called after instantiating.
  68. *
  69. * @see ApplicationConnection#getVTooltip()
  70. */
  71. public VTooltip() {
  72. super(false, false, true);
  73. setStyleName(CLASSNAME);
  74. FlowPanel layout = new FlowPanel();
  75. setWidget(layout);
  76. layout.add(em);
  77. DOM.setElementProperty(description, "className", CLASSNAME + "-text");
  78. DOM.appendChild(layout.getElement(), description);
  79. setSinkShadowEvents(true);
  80. // When a tooltip is shown, the content of the tooltip changes. With a
  81. // tooltip being a live-area, this change is notified to a assistive
  82. // device.
  83. Roles.getTooltipRole().set(getElement());
  84. Roles.getTooltipRole().setAriaLiveProperty(getElement(),
  85. LiveValue.ASSERTIVE);
  86. Roles.getTooltipRole().setAriaRelevantProperty(getElement(),
  87. RelevantValue.ADDITIONS);
  88. }
  89. /**
  90. * Show the tooltip with the provided info for assistive devices.
  91. *
  92. * @param info
  93. * with the content of the tooltip
  94. */
  95. public void showAssistive(TooltipInfo info) {
  96. updatePosition(null, true);
  97. setTooltipText(info);
  98. showTooltip();
  99. }
  100. /**
  101. * Initialize the tooltip overlay for assistive devices.
  102. *
  103. * @param info
  104. * with the content of the tooltip
  105. * @since 7.2.4
  106. */
  107. public void initializeAssistiveTooltips() {
  108. updatePosition(null, true);
  109. setTooltipText(new TooltipInfo(" "));
  110. showTooltip();
  111. hideTooltip();
  112. description.getParentElement().getStyle().clearWidth();
  113. }
  114. private void setTooltipText(TooltipInfo info) {
  115. if (info.getErrorMessage() != null && !info.getErrorMessage().isEmpty()) {
  116. em.setVisible(true);
  117. em.updateMessage(info.getErrorMessage());
  118. } else {
  119. em.setVisible(false);
  120. }
  121. if (info.getTitle() != null && !info.getTitle().isEmpty()) {
  122. description.setInnerHTML(info.getTitle());
  123. /*
  124. * Issue #11871: to correctly update the offsetWidth of description
  125. * element we need to clear style width of it's parent DIV from old
  126. * value (in some strange cases this width=[tooltip MAX_WIDTH] after
  127. * tooltip text has been already updated to new shortly value:
  128. *
  129. * <div class="popupContent"> <div style="width: 500px;"> <div
  130. * class="v-errormessage" aria-hidden="true" style="display: none;">
  131. * <div class="gwt-HTML"> </div> </div> <div
  132. * class="v-tooltip-text">This is a short tooltip</div> </div>
  133. *
  134. * and it leads to error during calculation offsetWidth (it is
  135. * native GWT method getSubPixelOffsetWidth()) of description
  136. * element")
  137. */
  138. description.getParentElement().getStyle().clearWidth();
  139. description.getStyle().clearDisplay();
  140. } else {
  141. description.setInnerHTML("");
  142. description.getStyle().setDisplay(Display.NONE);
  143. }
  144. currentTooltipInfo = info;
  145. }
  146. /**
  147. * Show a popup containing the currentTooltipInfo
  148. *
  149. */
  150. private void showTooltip() {
  151. if (currentTooltipInfo.hasMessage()) {
  152. // Issue #8454: With IE7 the tooltips size is calculated based on
  153. // the last tooltip's position, causing problems if the last one was
  154. // in the right or bottom edge. For this reason the tooltip is moved
  155. // first to 0,0 position so that the calculation goes correctly.
  156. setPopupPosition(0, 0);
  157. setPopupPositionAndShow(new PositionCallback() {
  158. @Override
  159. public void setPosition(int offsetWidth, int offsetHeight) {
  160. if (offsetWidth > getMaxWidth()) {
  161. setWidth(getMaxWidth() + "px");
  162. // Check new height and width with reflowed content
  163. offsetWidth = getOffsetWidth();
  164. offsetHeight = getOffsetHeight();
  165. }
  166. int x = getFinalX(offsetWidth);
  167. int y = getFinalY(offsetHeight);
  168. setPopupPosition(x, y);
  169. sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT);
  170. }
  171. /**
  172. * Return the final X-coordinate of the tooltip based on cursor
  173. * position, size of the tooltip, size of the page and necessary
  174. * margins.
  175. *
  176. * @param offsetWidth
  177. * @return The final X-coordinate
  178. */
  179. private int getFinalX(int offsetWidth) {
  180. int x = 0;
  181. int widthNeeded = 10 + MARGIN + offsetWidth;
  182. int roomLeft = tooltipEventMouseX;
  183. int roomRight = Window.getClientWidth() - roomLeft;
  184. if (roomRight > widthNeeded) {
  185. x = tooltipEventMouseX + 10 + Window.getScrollLeft();
  186. } else {
  187. x = tooltipEventMouseX + Window.getScrollLeft() - 10
  188. - offsetWidth;
  189. }
  190. if (x + offsetWidth + MARGIN - Window.getScrollLeft() > Window
  191. .getClientWidth()) {
  192. x = Window.getClientWidth() - offsetWidth - MARGIN
  193. + Window.getScrollLeft();
  194. }
  195. if (tooltipEventMouseX != EVENT_XY_POSITION_OUTSIDE) {
  196. // Do not allow x to be zero, for otherwise the tooltip
  197. // does not close when the mouse is moved (see
  198. // isTooltipOpen()). #15129
  199. int minX = Window.getScrollLeft() + MARGIN;
  200. x = Math.max(x, minX);
  201. }
  202. return x;
  203. }
  204. /**
  205. * Return the final Y-coordinate of the tooltip based on cursor
  206. * position, size of the tooltip, size of the page and necessary
  207. * margins.
  208. *
  209. * @param offsetHeight
  210. * @return The final y-coordinate
  211. *
  212. */
  213. private int getFinalY(int offsetHeight) {
  214. int y = 0;
  215. int heightNeeded = 10 + MARGIN + offsetHeight;
  216. int roomAbove = tooltipEventMouseY;
  217. int roomBelow = Window.getClientHeight() - roomAbove;
  218. if (roomBelow > heightNeeded) {
  219. y = tooltipEventMouseY + 10 + Window.getScrollTop();
  220. } else {
  221. y = tooltipEventMouseY + Window.getScrollTop() - 10
  222. - offsetHeight;
  223. }
  224. if (y + offsetHeight + MARGIN - Window.getScrollTop() > Window
  225. .getClientHeight()) {
  226. y = tooltipEventMouseY - 5 - offsetHeight
  227. + Window.getScrollTop();
  228. if (y - Window.getScrollTop() < 0) {
  229. // tooltip does not fit on top of the mouse either,
  230. // put it at the top of the screen
  231. y = Window.getScrollTop();
  232. }
  233. }
  234. if (tooltipEventMouseY != EVENT_XY_POSITION_OUTSIDE) {
  235. // Do not allow y to be zero, for otherwise the tooltip
  236. // does not close when the mouse is moved (see
  237. // isTooltipOpen()). #15129
  238. int minY = Window.getScrollTop() + MARGIN;
  239. y = Math.max(y, minY);
  240. }
  241. return y;
  242. }
  243. });
  244. } else {
  245. hide();
  246. }
  247. }
  248. /**
  249. * For assistive tooltips to work correctly we must have the tooltip visible
  250. * and attached to the DOM well in advance. For this reason both isShowing
  251. * and isVisible return false positives. We can't override either of them as
  252. * external code may depend on this behavior.
  253. *
  254. * @return boolean
  255. */
  256. public boolean isTooltipOpen() {
  257. return super.isShowing() && super.isVisible() && getPopupLeft() > 0
  258. && getPopupTop() > 0;
  259. }
  260. private void closeNow() {
  261. hide();
  262. setWidth("");
  263. closing = false;
  264. justClosedTimer.schedule(getQuickOpenTimeout());
  265. justClosed = true;
  266. }
  267. private Timer showTimer = new Timer() {
  268. @Override
  269. public void run() {
  270. opening = false;
  271. showTooltip();
  272. }
  273. };
  274. private Timer closeTimer = new Timer() {
  275. @Override
  276. public void run() {
  277. closeNow();
  278. }
  279. };
  280. private Timer justClosedTimer = new Timer() {
  281. @Override
  282. public void run() {
  283. justClosed = false;
  284. }
  285. };
  286. public void hideTooltip() {
  287. if (opening) {
  288. showTimer.cancel();
  289. opening = false;
  290. }
  291. if (!isAttached()) {
  292. return;
  293. }
  294. if (closing) {
  295. // already about to close
  296. return;
  297. }
  298. if (isTooltipOpen()) {
  299. closeTimer.schedule(getCloseTimeout());
  300. closing = true;
  301. }
  302. }
  303. @Override
  304. public void hide() {
  305. em.updateMessage("");
  306. description.setInnerHTML("");
  307. updatePosition(null, true);
  308. setPopupPosition(tooltipEventMouseX, tooltipEventMouseY);
  309. }
  310. private int EVENT_XY_POSITION_OUTSIDE = -5000;
  311. private int tooltipEventMouseX;
  312. private int tooltipEventMouseY;
  313. public void updatePosition(Event event, boolean isFocused) {
  314. tooltipEventMouseX = getEventX(event, isFocused);
  315. tooltipEventMouseY = getEventY(event, isFocused);
  316. }
  317. private int getEventX(Event event, boolean isFocused) {
  318. return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM
  319. .eventGetClientX(event);
  320. }
  321. private int getEventY(Event event, boolean isFocused) {
  322. return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM
  323. .eventGetClientY(event);
  324. }
  325. @Override
  326. public void onBrowserEvent(Event event) {
  327. final int type = DOM.eventGetType(event);
  328. // cancel closing event if tooltip is mouseovered; the user might want
  329. // to scroll of cut&paste
  330. if (type == Event.ONMOUSEOVER) {
  331. // Cancel closing so tooltip stays open and user can copy paste the
  332. // tooltip
  333. closeTimer.cancel();
  334. closing = false;
  335. }
  336. }
  337. /**
  338. * Replace current open tooltip with new content
  339. */
  340. public void replaceCurrentTooltip() {
  341. if (closing) {
  342. closeTimer.cancel();
  343. closeNow();
  344. justClosedTimer.cancel();
  345. justClosed = false;
  346. }
  347. showTooltip();
  348. opening = false;
  349. }
  350. private class TooltipEventHandler implements MouseMoveHandler,
  351. KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler {
  352. /**
  353. * Current element hovered
  354. */
  355. private com.google.gwt.dom.client.Element currentElement = null;
  356. /**
  357. * Marker for handling of tooltip through focus
  358. */
  359. private boolean handledByFocus;
  360. /**
  361. * Locate the tooltip for given element
  362. *
  363. * @param element
  364. * Element used in search
  365. * @return TooltipInfo if connector and tooltip found, null if not
  366. */
  367. private TooltipInfo getTooltipFor(Element element) {
  368. ApplicationConnection ac = getApplicationConnection();
  369. ComponentConnector connector = Util.getConnectorForElement(ac,
  370. RootPanel.get(), element);
  371. // Try to find first connector with proper tooltip info
  372. TooltipInfo info = null;
  373. while (connector != null) {
  374. info = connector.getTooltipInfo(element);
  375. if (info != null && info.hasMessage()) {
  376. break;
  377. }
  378. if (!(connector.getParent() instanceof ComponentConnector)) {
  379. connector = null;
  380. info = null;
  381. break;
  382. }
  383. connector = (ComponentConnector) connector.getParent();
  384. }
  385. if (connector != null && info != null) {
  386. assert connector.hasTooltip() : "getTooltipInfo for "
  387. + Util.getConnectorString(connector)
  388. + " returned a tooltip even though hasTooltip claims there are no tooltips for the connector.";
  389. return info;
  390. }
  391. return null;
  392. }
  393. /**
  394. * Handle hide event
  395. *
  396. */
  397. private void handleHideEvent() {
  398. hideTooltip();
  399. }
  400. @Override
  401. public void onMouseMove(MouseMoveEvent mme) {
  402. handleShowHide(mme, false);
  403. }
  404. @Override
  405. public void onMouseDown(MouseDownEvent event) {
  406. handleHideEvent();
  407. }
  408. @Override
  409. public void onKeyDown(KeyDownEvent event) {
  410. handleHideEvent();
  411. }
  412. /**
  413. * Displays Tooltip when page is navigated with the keyboard.
  414. *
  415. * Tooltip is not visible. This makes it possible for assistive devices
  416. * to recognize the tooltip.
  417. */
  418. @Override
  419. public void onFocus(FocusEvent fe) {
  420. handleShowHide(fe, true);
  421. }
  422. /**
  423. * Hides Tooltip when the page is navigated with the keyboard.
  424. *
  425. * Removes the Tooltip from page to make sure assistive devices don't
  426. * recognize it by accident.
  427. */
  428. @Override
  429. public void onBlur(BlurEvent be) {
  430. handledByFocus = false;
  431. handleHideEvent();
  432. }
  433. private void handleShowHide(DomEvent domEvent, boolean isFocused) {
  434. Event event = Event.as(domEvent.getNativeEvent());
  435. Element element = Element.as(event.getEventTarget());
  436. // We can ignore move event if it's handled by move or over already
  437. if (currentElement == element && handledByFocus == true) {
  438. return;
  439. }
  440. // If the parent (sub)component already has a tooltip open and it
  441. // hasn't changed, we ignore the event.
  442. // TooltipInfo contains a reference to the parent component that is
  443. // checked in it's equals-method.
  444. if (currentElement != null && isTooltipOpen()) {
  445. TooltipInfo newTooltip = getTooltipFor(element);
  446. if (currentTooltipInfo != null
  447. && currentTooltipInfo.equals(newTooltip)) {
  448. return;
  449. }
  450. }
  451. TooltipInfo info = getTooltipFor(element);
  452. if (info == null) {
  453. handleHideEvent();
  454. } else {
  455. if (closing) {
  456. closeTimer.cancel();
  457. closing = false;
  458. }
  459. if (isTooltipOpen()) {
  460. closeNow();
  461. }
  462. setTooltipText(info);
  463. updatePosition(event, isFocused);
  464. // Schedule timer for showing the tooltip according to if it
  465. // was recently closed or not.
  466. int timeout = justClosed ? getQuickOpenDelay() : getOpenDelay();
  467. if (timeout == 0) {
  468. showTooltip();
  469. } else {
  470. showTimer.schedule(timeout);
  471. opening = true;
  472. }
  473. }
  474. handledByFocus = isFocused;
  475. currentElement = element;
  476. }
  477. }
  478. private final TooltipEventHandler tooltipEventHandler = new TooltipEventHandler();
  479. /**
  480. * Connects DOM handlers to widget that are needed for tooltip presentation.
  481. *
  482. * @param widget
  483. * Widget which DOM handlers are connected
  484. */
  485. public void connectHandlersToWidget(Widget widget) {
  486. Profiler.enter("VTooltip.connectHandlersToWidget");
  487. widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
  488. widget.addDomHandler(tooltipEventHandler, MouseDownEvent.getType());
  489. widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
  490. widget.addDomHandler(tooltipEventHandler, FocusEvent.getType());
  491. widget.addDomHandler(tooltipEventHandler, BlurEvent.getType());
  492. Profiler.leave("VTooltip.connectHandlersToWidget");
  493. }
  494. /**
  495. * Returns the unique id of the tooltip element.
  496. *
  497. * @return String containing the unique id of the tooltip, which always has
  498. * a value
  499. */
  500. public String getUniqueId() {
  501. return uniqueId;
  502. }
  503. @Override
  504. public void setPopupPositionAndShow(PositionCallback callback) {
  505. if (isAttached()) {
  506. callback.setPosition(getOffsetWidth(), getOffsetHeight());
  507. } else {
  508. super.setPopupPositionAndShow(callback);
  509. }
  510. }
  511. /**
  512. * Returns the time (in ms) the tooltip should be displayed after an event
  513. * that will cause it to be closed (e.g. mouse click outside the component,
  514. * key down).
  515. *
  516. * @return The close timeout (in ms)
  517. */
  518. public int getCloseTimeout() {
  519. return closeTimeout;
  520. }
  521. /**
  522. * Sets the time (in ms) the tooltip should be displayed after an event that
  523. * will cause it to be closed (e.g. mouse click outside the component, key
  524. * down).
  525. *
  526. * @param closeTimeout
  527. * The close timeout (in ms)
  528. */
  529. public void setCloseTimeout(int closeTimeout) {
  530. this.closeTimeout = closeTimeout;
  531. }
  532. /**
  533. * Returns the time (in ms) during which {@link #getQuickOpenDelay()} should
  534. * be used instead of {@link #getOpenDelay()}. The quick open delay is used
  535. * when the tooltip has very recently been shown, is currently hidden but
  536. * about to be shown again.
  537. *
  538. * @return The quick open timeout (in ms)
  539. */
  540. public int getQuickOpenTimeout() {
  541. return quickOpenTimeout;
  542. }
  543. /**
  544. * Sets the time (in ms) that determines when {@link #getQuickOpenDelay()}
  545. * should be used instead of {@link #getOpenDelay()}. The quick open delay
  546. * is used when the tooltip has very recently been shown, is currently
  547. * hidden but about to be shown again.
  548. *
  549. * @param quickOpenTimeout
  550. * The quick open timeout (in ms)
  551. */
  552. public void setQuickOpenTimeout(int quickOpenTimeout) {
  553. this.quickOpenTimeout = quickOpenTimeout;
  554. }
  555. /**
  556. * Returns the time (in ms) that should elapse before a tooltip will be
  557. * shown, in the situation when a tooltip has very recently been shown
  558. * (within {@link #getQuickOpenDelay()} ms).
  559. *
  560. * @return The quick open delay (in ms)
  561. */
  562. public int getQuickOpenDelay() {
  563. return quickOpenDelay;
  564. }
  565. /**
  566. * Sets the time (in ms) that should elapse before a tooltip will be shown,
  567. * in the situation when a tooltip has very recently been shown (within
  568. * {@link #getQuickOpenDelay()} ms).
  569. *
  570. * @param quickOpenDelay
  571. * The quick open delay (in ms)
  572. */
  573. public void setQuickOpenDelay(int quickOpenDelay) {
  574. this.quickOpenDelay = quickOpenDelay;
  575. }
  576. /**
  577. * Returns the time (in ms) that should elapse after an event triggering
  578. * tooltip showing has occurred (e.g. mouse over) before the tooltip is
  579. * shown. If a tooltip has recently been shown, then
  580. * {@link #getQuickOpenDelay()} is used instead of this.
  581. *
  582. * @return The open delay (in ms)
  583. */
  584. public int getOpenDelay() {
  585. return openDelay;
  586. }
  587. /**
  588. * Sets the time (in ms) that should elapse after an event triggering
  589. * tooltip showing has occurred (e.g. mouse over) before the tooltip is
  590. * shown. If a tooltip has recently been shown, then
  591. * {@link #getQuickOpenDelay()} is used instead of this.
  592. *
  593. * @param openDelay
  594. * The open delay (in ms)
  595. */
  596. public void setOpenDelay(int openDelay) {
  597. this.openDelay = openDelay;
  598. }
  599. /**
  600. * Sets the maximum width of the tooltip popup.
  601. *
  602. * @param maxWidth
  603. * The maximum width the tooltip popup (in pixels)
  604. */
  605. public void setMaxWidth(int maxWidth) {
  606. this.maxWidth = maxWidth;
  607. }
  608. /**
  609. * Returns the maximum width of the tooltip popup.
  610. *
  611. * @return The maximum width the tooltip popup (in pixels)
  612. */
  613. public int getMaxWidth() {
  614. return maxWidth;
  615. }
  616. }