Help: GWT Celltable Record (Specific Record Mouseover) ToolTip !!!

1879 views
Skip to first unread message

laxman lingampally

unread,
May 31, 2012, 3:28:03 AM5/31/12
to google-we...@googlegroups.com
Hi all,

i need a GWT celltable record i.e specific record values in Tooltip ,


In my project i have one search Grid(Celltable) it is having five columns, when ever click on serach button it shows number of recods that is fine,

but , i need to show  some infermation ( like status name , id value like that......) in Tooltip like window.

Any idea or any solution ? 

please help  me out.

Thanks for helping. 

Regards
laxman






Rajeshwar Mishra

unread,
May 31, 2012, 7:27:16 AM5/31/12
to google-we...@googlegroups.com
Use  Column<?, SafeHtml> 

Thanks,
Rajeshwar

laxman






--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

laxman lingampally

unread,
May 31, 2012, 12:34:25 PM5/31/12
to google-we...@googlegroups.com
Hi  Rajeshwar ,

Thanks a lot .

thanks for your answer. 

i am given below code , just see and tell me where i am done mistake.


CellTable<Contact> searchGridCellTable = new CellTable<Contact>();

---------------------------------------
.-------------------------------------
// Add a text column to show the dateLogged.
 TextColumn<Contact> dateLogged = new TextColumn<Contact>() {
     @Override
     public String getValue(Contact object) {
       return object.getDateLogged();
     }
   };
  searchGridCellTable.addColumn(dateLogged, SafeHtmlUtils.fromSafeConstant("<span title='tooltip text goes here'>DateLogged</span>"));

------------------------------------------
------------------------------------------------ 

like this. above code showing Tooltip at Header only,

   but i need only specific record. my cellTable having number of Records.
  can you please tell how can i use, i need to show some values in Tooltip ,(only specific record)

please help me out,

if it passible give me sample code for me .


Thanks & Regards
Laxman

Jens

unread,
May 31, 2012, 2:29:25 PM5/31/12
to google-we...@googlegroups.com
Have you actually read what Rajeshwar wrote?

He tolds you to use Column<?, SafeHtml> but your posted code contains TextColumn. Change it to Column<Contact, SafeHtml>, use a SafeHtmlCell for that column and then implement getValue().

-- J.
Message has been deleted

Rajeshwar Mishra

unread,
Jun 1, 2012, 12:13:25 AM6/1/12
to google-we...@googlegroups.com
Please find the sample code.....

private Column< Contact , SafeHtml> column;

 column = new Column< Contact  , SafeHtml>(new SafeHtmlCell()) {

@Override
public SafeHtml getValue( Contact   contact ) {

return getColumnToolTip("column text",     "tooltip text");
}
};




----------------------

private SafeHtml getColumnToolTip(String columnText, StringBuilder toolTipText) {

String htmlConstant = "<html>" + "<head><style>" + "A.tip { TEXT-DECORATION: none; color:#1776B3}" + "A.tip:hover  {CURSOR:default;}" + "A.tip span   {DISPLAY:none}" + "A.tip span p {background:#d30300;color:#fff;font-weight:500;border-radius:5px;padding:5px;font-size:12px}" + "A.tip:hover span {border:1px solid #e6e3e5;DISPLAY: block;Z-INDEX: 1000; PADDING: 0px 10px 0px 10px;" + "POSITION:absolute;float:left;background:#ffffd1;   TEXT-DECORATION: none}" + "</style></head>" + "<body>" + "<a href=\"#\" class=\"tip\">" + "(" + columnText + ")" + "<span>" + toolTipText + "</span></a>" + "</body>" + "</html>";
return new SafeHtmlBuilder().appendHtmlConstant(htmlConstant).toSafeHtml();

}


Thanks,
Rajeshwar
Rajeshwar

laxman





To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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+unsub...@googlegroups.com.

laxman lingampally

unread,
Jun 4, 2012, 3:49:40 AM6/4/12
to google-we...@googlegroups.com
Hi Rajeshwar,


Thanks lot for you helping ,

please find the attached screen this screen ,

In that screen i am  explaining Tooltip, actually Rajeshwar that tooltip shows only One Column ,

But my Requeriment is i need to show when ever move on Mouse  on One Record(one Row) means Celltable having multiple records(rows) right , 

i want to  see when ever move on Mouse to Row at  that  time   i want to show Tooltip window. 

please help me out .asap.

Thanks in advance.


Regards
Laxman



To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/C52hJwAootEJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
ToolTip.png

Jens

unread,
Jun 4, 2012, 5:00:35 AM6/4/12
to google-we...@googlegroups.com
The contact instance in getValue() is your row value. So when you make the generated SafeHtml dependent on the contact you have a different tooltip for each row (= contact) in that column. If you want to show a tooltip in every column you have to do this in every Column.getValue().

-- J.

laxman lingampally

unread,
Jun 4, 2012, 9:13:26 AM6/4/12
to google-we...@googlegroups.com
Hi all,

Thanks a lot Jens and  Rajeshwar , For Helping   me,
As of now Tooltip is Working fine

Regards
Laxman
 

On Mon, Jun 4, 2012 at 2:30 PM, Jens <jens.ne...@gmail.com> wrote:
The contact instance in getValue() is your row value. So when you make the generated SafeHtml dependent on the contact you have a different tooltip for each row (= contact) in that column. If you want to show a tooltip in every column you have to do this in every Column.getValue().

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Julian

unread,
Jun 19, 2012, 11:39:19 AM6/19/12
to Google Web Toolkit
Hi,

i've had the same problem, many thanks to Jens and Rajeshwar for the
solution!

I've extended Column and TextColumn:

public abstract class TooltipColumn<T, C> extends Column<T, C>{
private final Cell<C> cell;

public TooltipColumn(Cell<C> cell) {
super(cell);
this.cell = cell;
}

public abstract SafeHtml getTooltipValue(T object);

@Override
public void render(Context context, T object, SafeHtmlBuilder sb) {
SafeHtmlBuilder mysb = new SafeHtmlBuilder();

cell.render(context, getValue(object), mysb);
mysb.appendHtmlConstant("<span>");
mysb.append(getTooltipValue(object));
mysb.appendHtmlConstant("</span>");
sb.append(mysb.toSafeHtml());
}
}

public abstract class TooltipTextColumn<T> extends TooltipColumn<T,
String> {

/**
* Construct a new TextColumn.
*/
public TooltipTextColumn() {
super(new TextCell());
}

}

CSS:
.CssCellTableCell span {
display:none
}

.CssCellTableCell:hover span {
border:1px solid #e6e3e5;
DISPLAY: block;
Z-INDEX: 1000;
PADDING: 0px 10px 0px 10px;
POSITION:absolute;
float:left;
background:#ffffd1;
TEXT-DECORATION: none
}

Add a Column:

TooltipTextColumn<Todos> aTextColumn = new
TooltipTextColumn<Todos>() {

@Override
public String getValue(Todos object) {
return object.getText();
}

@Override
public SafeHtml getTooltipValue(Todos object) {
return new
SafeHtmlBuilder().appendEscaped(object.getText()).toSafeHtml();
}
};

cellTable.addColumn(aTextColumn, "Text");
Reply all
Reply to author
Forward
0 new messages