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 7074837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:06:21+00:00 2026-05-28T06:06:21+00:00

Basically I want to implement something similar to the the cell-coloring which is defined

  • 0

Basically I want to implement something similar to the the cell-coloring which is defined in the GWT documentation

However I don’t want to specify the style directly on the DIV element but want to assign an obfuscated stylename from my custom CSSResource which I defined for my CellTable.

Here is some code:

I defined a custom Resources interface for my CellTable:

public interface CellTableResources extends Resources {

    @Source({CellTable.Style.DEFAULT_CSS,CellTableStyle.STYLE})
    CellTableStyle cellTableStyle();

    public interface CellTableStyle extends Style {
        String STYLE = "CellTable.css";

        public Sring coloredCell();
    }
}

I pass it to the constructor of my CellTable:

CellTable<XY> table = new CellTable<XY>(15,cellTableResources);

This is how my custom cell looks like.

public class ColorCell extends AbstractCell<String> {

    interface Templates extends SafeHtmlTemplates {

      @SafeHtmlTemplates.Template("<div class=\"{0}\">{1}</div>")
      SafeHtml cell(String classname, SafeHtml value);
    }
    private static Templates templates = GWT.create(Templates.class);

    @Override
    public void render(Context context, String value, SafeHtmlBuilder sb) {
      if (value == null) {
        return;
      }
      // how can I access the CSSResources which I pass to the CellTable
      CellTableResources ressources = ?
      String className = ressources.cellTableStyle().coloredCell();

      SafeHtml safeValue = SafeHtmlUtils.fromString(value);
      SafeHtml rendered = templates.cell(className, safeValue);
      sb.append(rendered);
    }
  }

How can I access my CellTableRessources that I passed to my CellTable in my custom cell?
Here is the important part:

// how can I access the CSSResources which I pass to the CellTable
CellTableResources ressources = ?
String className = ressources.cellTableStyle().coloredCell();

The only solution I come up with is to pass the CellTableRessources to the constructor of my AbstractCell.
Isn’t there a more elegant way (I already have passed it to the CellTable).

I think the main question is:
“How can I access CellTable variables from a Cell or Column?”

  • 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-05-28T06:06:22+00:00Added an answer on May 28, 2026 at 6:06 am

    The problem with a ‘more elegant way’ is that it implies that CellTable’s own styles will be useful elsewhere, which they probably won’t. Even if they provided a getter for style, that would return an instance of type Style, which you would then have to cast to your own style.

    It is best to consider this to be your style, which presents a few options:

    • Keep a reference around so you can access it from within your cell
    • GWT.create a new copy of the client bundle within your cell and call ensureInjected() – it will only actually inject it once, so this really isn’t a problem, just a good practice, esp if someone decides to use your cell without the style on the table itself.
    • And last, break out the styles needed for the cell into their own clientbundle/cssresource, and make them part of the cell itself. This lets you completely break apart the dependency of the cell on even being put in a celltable (as opposed to a celllist or cellbrowser, etc).

    The only tricky part is if the styles on the cell do depend on the styles in the table, in which case this annoying dependency you are dealing with is a good thing – it is requiring you to be aware of that dependency in the styles themselves. If you go for the third (I see this as the cleanest) option but still have this dependency, you can go a step further – declare a style/clientbundle in your cell, but extend it like you are doing to the CellTable’s ClientBundle – and since these are interfaces, you can make one bundle that extends both of these, and is supplied to each table and cell.

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

Sidebar

Related Questions

I basically want to implement something where you can type in any URI (
Basically I want to implement a simple Rails extension to define the seriousness of
I want to implement a version of Benford's law ( http://en.wikipedia.org/wiki/Benford%27s_law ) that basically
I want to implement a workflow system on a new website which i am
I need something like a cookie, but I specifically don't want it going back
I want to do something like the code listed below. Basically, I want to
I basically want to implement a Label and have it constantly showing information to
I basically want to use link_to to link to the index method of a
I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log ...with of course
I basically want to do this in code: PersonList myPersonList; //populate myPersonList here, not

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.