Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:43:56+00:00 2026-06-04T07:43:56+00:00

All is in the question, how can I create a custom cell with a

  • 0

All is in the question, how can I create a custom cell with a canvas on it by using a CellTable in GWT ?

I search a way to transform the canvas into html to append it to the SafeHtmlBuilder parameter of the render method but with no success. Here is the interesting snippet of the custom cell:

public void render(Context context, String value, SafeHtmlBuilder sb) {

    Canvas c = Canvas.createIfSupported();

    // create a text into the canvas using the value parameter
    // something like (this is not important) : 
    c.getContext2d().drawTheText(value);

    // here is the problem, what kind of transformation may I do 
    // to use the canvas in this cell ?
    SafeHtml safeValue = SafeHtmlUtils.fromString(c.?????);
    sb.append(safeValue);
}

EDIT: here is the working solution, thanks to Thomas

sb.append(SafeHtmlUtils.fromTrustedString("<img src=\"" + canvas.toDataUrl() + "\" />"));

note that a template should be used instead of using directly a piece of html code as it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:43:57+00:00Added an answer on June 4, 2026 at 7:43 am

    I think you’ll have to use toDataURL() and build an <img> element to display it.

    Note that you could then reuse the same Canvas instance between invocations of render; just make sure you clear it before reuse.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: How can I determine all processes in the child's Process Tree to kill
The question says it all. I was taking a look at Can a recursive
Can anyone explain me the difference of all and also an another question does
Well, question is in title. Is it possible at all? I can use css
So, i have some question about xml Documents in Java. Can i get all
This question Check all associations before destroy in rails suggests using :dependent => :restrict
I ask the question more specific: Using Netbeans, is there a possibility to create
Hi i am trying to create a custom search for a json array My
Summary Hi All, OK, further into my adventures with custom controls... In summary, here
I'd like to create custom UITableViewCell using an XIB, but I'm not sure how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.