开发者

Balloon-widget for GWT

I'm searching for a开发者_JAVA技巧 balloon-like widget for a GWT application, e.g. like the balloons Google Maps shows when displaying search results on a map.

When searching I only found Javascript widgets, but aren't there any widgets to use in GWT?


Take a look at OverLib. It is an open source javascript lib to show enhanced pop up hint windows. It can be easy integrated into GWT. Plus you have the freedom to create you own HTML pop ups.

Here is a snippet of my over lib helper code (overlib must be unpacked into the public folder of your GWT project). The attributes produced with getSimpleToolTip are just added to your GWT elements:

    public static String getSimpleToolTip(String text, Integer width, Integer height)
 {
  String alt = "onmouseout=\"" + getOnMouseOutAttribute() + "\""; 
  alt = alt + " onmouseover=\"" + getOnMouseOverAttribute(text, width, height) + "\"";
  return alt;
 }

 public static String getOnMouseOutAttribute()
 {
  return "return nd();"; 
 }

 public static String getOnMouseOverAttribute(String text, Integer width, Integer height)
 {
  String out = "return overlib('" + text + "'";
  out = out + ", DELAY, 750";

  if (width != null)
  {
   out = out + ", WIDTH, " + width.toString();
  }

  if (height != null)
  {
   out = out + ", HEIGHT, " + height.toString();
  }

  out = out + ");";

  return out;
 }


In GWT create your own widget with the help of popup panel.Have image like baloon (Image background should be transparent) and set it as a popup panel background.After that depends on your requirement add your results like "A","B",etc... as a label in popup panel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜