Wednesday, August 29, 2012

Re: Request for change of access control of CellTree.BasicStyle

On Wednesday, August 29, 2012 12:29:07 PM UTC-4, Thomas Broyer wrote:

On Wednesday, August 29, 2012 5:42:44 PM UTC+2, Thad wrote:
Maybe I'm not understanding how resources are used or applied, but that is not working for me. If I try the following interface, the resulting CellTree looks like CellTree.Style, not BasicStyle:

  interface TreeBasicResources extends CellTree.Resources {
    @Override
    @Source(value = { CellTree.Style.DEFAULT_CSS, 
        "com/google/gwt/user/cellview/client/CellTreeBasic.css" })
    CellTree.Style cellTreeStyle();
  }
  ...
  Cell Tree myTree = new CellTree(treeModel, null, 
          GWT.<TreeBasicResources> create(TreeBasicResources.class));

You have to create an interface that extends CellTree.Style and use that inerface as the return type of the overridden cellTreeStyle().

In searching the list, I don't see this issue continued in the list after it was marked "AsDesigned". I may come back to this at some point. My current app has one CellTable, one CellTree, and one CellList. However I can see needing several CellTables, each with a very different style--one for database records, one for a to-do list, one with a file hex dump, etc.
 
Also, BasicStyle does not use CellTree.Style.DEFAULT_CSS (that's the whole reason it exists in the first place!)

(that being said, BasicStyle not being public is probably an oversight)


And if it did work, how then to add my change? Extend this interface with another? (All I want is cellTreeItem padding-top/-bottom to be 0px).

Add a CSS file and list it in the @Source annotation.
In your CSS file, only include the cellTreeItem definition. And if you override rules, make sure you list your file after CellTreeBasic.css: CSS cascading rules apply when processing CssResources.

Interesting. Two approaches that I would think would give me the same result look different. See the two screenshots from Firefox (v14 in Linux). The first, tree-override-DEFAULT.png, uses this code:

  interface TreeResources extends CellTree.Resources {
    @Override
    @Source({ CellTree.Style.DEFAULT_CSS, "CellTreePatch.css" })
    CellTree.Style cellTreeStyle();
  }

where CellTreePatch.css is ./com/google/gwt/user/cellview/client/CellTree.css copied and modified.

This is what I started with after realizing I couldn't override BasicStyle. (I'll add that I'm happy with visual result. Now I'm trying to understand what's going on as I expect to be using GWT for a long time.)

The second screen shot, tree-extend-CellTree.Style.png, packs the cells much closer, although CellTreePatch.css is the same:

  public interface ScreenCellTreeStyle extends CellTree.Style {}
  interface TreeResources extends CellTree.Resources {
    @Override
    @Source("CellTreePatch.css")
    ScreenCellTreeStyle cellTreeStyle();
  }

Why wouldn't they be the same?

Also, if CellTreePatch.css is reduced to only the cellTreeItem definition, the app crashes when trying to draw the tree (apparently because the other settings aren't present).

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

No comments:

Post a Comment