Problem solved, thank you everyone,
a special thank to hy

On Wednesday, August 29, 2018 at 6:52:36 PM UTC+2, hy wrote:
>
> Create a class that renders anchor like below:
>
> public class CustomAnchorCell
>         extends ClickableTextCell {
>
>     private String itsHref = "";
>     private boolean isEnabled = true;
>
>     public CustomAnchorCell(String inHref) {
>         super();
>         itsHref = inHref;
>     }
>
>     public CustomAnchorCell() {
>         super();
>         itsHref = "";
>     }
>
>     public CustomAnchorCell(String inHref, boolean inEnabled) {
>         this(inHref);
>         isEnabled = inEnabled;
>     }
>
>     @Override
>     protected void render(Context context, SafeHtml value, SafeHtmlBuilder 
> sb) {
>         if (value != null) {
>             String theElementStart = "";
>             String theElementEnd = "";
>             if (isEnabled) {
>                 theElementStart = "<a href='" + itsHref + "'";
>                 theElementEnd = "</a>";
>             } else {
>                 theElementStart = "<span";
>                 theElementEnd = "</span>";
>             }
>             sb.appendHtmlConstant(theElementStart + " class='" + itsClassName 
> + "'>")
>                     .append(value)
>                     .appendHtmlConstant(theElementEnd);
>         }
>     }
>
>     public void setHref(String inHref) {
>         itsHref = inHref;
>     }
>
>     public void setEnabled(boolean inEnabled) {
>         isEnabled = inEnabled;
>     }
>
>     public void setClassName(String inClassName) {
>         itsClassName = inClassName;
>     }
> }
>
>
>
> Use it like this:
>
> Column<Report, String> theReport = new Column< Report, String>(new 
> CustomAnchorCell()) {
>     @Override
>     public String getValue(Report object) {
>         return "Hello New Tab";
>     }
>
>     @Override
>     public void render(Cell.Context context, Report object, SafeHtmlBuilder 
> sb) {
>         CustomAnchorCell theCustomAnchorCell = (CustomAnchorCell) getCell();
>         theCustomAnchorCell.setHref("_your new tab url_");
>         theCustomAnchorCell.setClassName(*"_your custom css class name_"*);
>
>         super.render(context, object, sb);
>     }
> };
>
>
>
> On Wednesday, August 29, 2018 at 10:50:25 AM UTC-4, Ousti Driss wrote:
>>
>> What I want is when you click on the cell a new tab opens with the url 
>> you clicked,
>> my string url column is filled with the response I get from the servlet
>> can you please give me more details on the alternative response.
>>
>> On Wednesday, August 29, 2018 at 3:45:27 PM UTC+2, Thomas Broyer wrote:
>>>
>>> If you want to display text as-is (e.g. not a link), then you can use a 
>>> ClickableTextCell (see it live, with source code, in 
>>> http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwCellSampler),
>>>  
>>> the FieldUpdater will be called when the cell is clicked.
>>> Alternatively, you could use a TextCell with a custom SafeHtmlRenderer 
>>> that would wrap the URL in a link (easiest would probably be to implement 
>>> this using a SafeHtmlTemplates: pass the URL as input –you'll want to pass 
>>> it as a SafeUri, constructed using UriUtils.fromString()–, use it to 
>>> construct something like <a href="{0}" target="_blank">{0}</a>)
>>>
>>> On Tuesday, August 28, 2018 at 6:00:00 PM UTC+2, Ousti Driss wrote:
>>>>
>>>> Hey everyone,
>>>>
>>>> I'm writing the code of a simple web app using gwt, I have a Celltable 
>>>> all its columns are String type,
>>>> one of the columns is a url column , I want to make this column 
>>>> clickable, which means once you click on a cell
>>>> of this column, you are redicted to the url shown, is that possible?
>>>> i tried to add an anchor column to the table, but I got error messages 
>>>> while defining this column when I call the getValue method, the type of 
>>>> return should be a string!!
>>>> Is there a way to do such a thing?
>>>>
>>>> Thank you :) 
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to