Thank you Jens for your hint. I couldn't see any getConsumedEvents() so I used onBrowserEvent and it working ok.
On Friday, June 13, 2014 9:10:40 AM UTC+10, Jens wrote:
-- private class HeaderCell extends AbstractCell<String> { private String text; public HeaderCell(String text) { /* * Let the parent class know that our cell responds to click events and * keydown events. */ //super("click", "keydown"); super("mouseover"); this.text=text; } @Override public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) { // Check that the value is not null. if (value == null) { return; } // Call the super handler, which handlers the enter key. super.onBrowserEvent(context, parent, value, event, valueUpdater); if ("mouseover".equals(event.getType())) { SafeHtmlBuilder sb=new SafeHtmlBuilder(); sb.appendHtmlConstant("<b>"); sb.appendHtmlConstant("<font color=\"blue\">"); sb.appendEscaped(text); sb.appendHtmlConstant("</font></b>"); meaningMessagesPopup.setWidget(new HTML(sb.toSafeHtml())); int left = event.getClientX() -140; int top = event.getClientY() +30; meaningMessagesPopup.setPopupPosition(left, top); // Show the popup meaningMessagesPopup.show(); } else if ("mouseout".equals(event.getType())) { meaningMessagesPopup.hide(); } } @Override public void render(Context context, String value, SafeHtmlBuilder sb) { /* * Always do a null check on the value. Cell widgets can pass null to * cells if the underlying data contains a null, or if the data arrives * out of order. */ if (value == null) { return; } sb.appendEscaped(value); } } Then
Header<String> nameColumnHeader = new Header<String>(new HeaderCell("my Text...")) { @Override public String getValue() { return "Name"; } }; table.addColumn(nameColumn, nameColumnHeader); On Friday, June 13, 2014 9:10:40 AM UTC+10, Jens wrote:
ClickableTextCell only listens for click and keydown events so Header.onBrowserEvent() will never be called for mouseover events. You must create your own Cell class (possibly extending any of GWTs cells) and call the super constructor AbstractCell(String... consumedEvents) if possible or override AbstractCell.getConsumedEvents(). Also you can use BrowserEvents.MOUSEOVER as a predefined constant.-- J.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment