Re: Opentip GWT integration

2009-10-02 Thread venki

I think it is not possible to use it..

I don't know about opentip but you are saying that it is a .js file
right??

How can you specify those into your java code.

It is better to search for any GWT related projects for adding tootip
text to widgets...

Try to use the following class to display tool tip.. I am using this
class to display a image whenever mouse is over to widget...

Have a good day


Usage:-

.addMouseListener(new TooltipListener(jasonObject.get
("image")
.isString().stringValue(), 5000, 
"yourcssclass"));






class TooltipListener extends MouseListenerAdapter {
private static final String DEFAULT_TOOLTIP_STYLE = "TooltipPopup";
private static final int DEFAULT_OFFSET_X = 10;
private static final int DEFAULT_OFFSET_Y = 35;

private static class Tooltip extends PopupPanel {
private int delay;

public Tooltip(Widget sender, int offsetX, int offsetY,
final String text, final int delay, final 
String styleName) {
super(true);

this.delay = delay;

// HTML contents = new HTML(text);
Image contents = new Image(text);
add(contents);

int left = sender.getAbsoluteLeft() + offsetX;
int top = sender.getAbsoluteTop() + offsetY;

setPopupPosition(left, top);
setStyleName(styleName);
}

public void show() {
super.show();

Timer t = new Timer() {

public void run() {
Tooltip.this.hide();
}

};
t.schedule(delay);
}
}

private Tooltip tooltip;
private String text;
private String styleName;
private int delay;
private int offsetX = DEFAULT_OFFSET_X;
private int offsetY = DEFAULT_OFFSET_Y;

public TooltipListener(String text, int delay) {
this(text, delay, DEFAULT_TOOLTIP_STYLE);
}

public TooltipListener(String text, int delay, String styleName) {
this.text = text;
this.delay = delay;
this.styleName = styleName;
}

public void onMouseEnter(Widget sender) {
if (tooltip != null) {
tooltip.hide();
}
tooltip = new Tooltip(sender, offsetX, offsetY, text, delay,
styleName);
tooltip.show();
}

public void onMouseLeave(Widget sender) {
if (tooltip != null) {
tooltip.hide();
}
}

public String getStyleName() {
return styleName;
}

public void setStyleName(String styleName) {
this.styleName = styleName;
}

public int getOffsetX() {
return offsetX;
}

public void setOffsetX(int offsetX) {
this.offsetX = offsetX;
}

public int getOffsetY() {
return offsetY;
}

public void setOffsetY(int offsetY) {
this.offsetY = offsetY;
}
}




On Oct 2, 4:10 pm, ledzgio  wrote:
> Hi all,
>
> i'm trying to use the library opentip (www.opentip.org) within GWT,
> this is a .js file library, but i am unable to invoke the right method
> to add a tooltip to a widget..how can i do it?
>
> could you please help me? thanks a lot
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Opentip GWT integration

2009-10-02 Thread ledzgio

Hi all,

i'm trying to use the library opentip (www.opentip.org) within GWT,
this is a .js file library, but i am unable to invoke the right method
to add a tooltip to a widget..how can i do it?

could you please help me? thanks a lot

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---