1. #1
    Ext GWT Premium Member lefke123's Avatar
    Join Date
    Dec 2011
    Location
    Belgium
    Posts
    80
    Vote Rating
    15
    lefke123 will become famous soon enough

      0  

    Default File resources in the base theme, why?

    File resources in the base theme, why?


    When I look in the interfaces of the base theme (com.sencha.gxt.theme.base) there's a lot of resources that belong in the Blue theme, since they're implementation specific IMHO. Sometime when an appearance needs to be overridden, a ton of unwanted code needs to added, like in the following example:

    Code:
    public interface MyTableFrameResources extends ClientBundle, TableFrame.TableFrameResources {
    
    
        @Source({"com/sencha/gxt/theme/blue/client/button/topLeftBorder.gif"})
        @Override
        ImageResource topLeftBorder();
    
    
        @Source({"com/sencha/gxt/theme/blue/client/button/topBorder.gif"})
        @Override
        ImageResource topBorder();
    
        // More...
    }
    What if you do not have any images on your newly implemented theme? Then the above code is obsolete, boilerplate code that has nothing to do with the theme implementation itself ( unless I'm horribly wrong). In fact, to my opinion, the CSS classes don't belong there either.

    I've gone over the base theme (revision #2713), and there's 173 ImageResources that should be in the Blue theme. Plus at minimum another 45 CSS files.

    My question was, why are these resources still in the base theme?
    Additionally, will these interfaces get refactored? If yes, when, if no, why not?

    Hope to know more about this issue.

  2. #2
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    70
    Vote Rating
    6
    mtraynham is on a distinguished road

      0  

    Default


    I as well am doing something similar to this and this is most likely why I can't get my build to work. I have a completely seperate GXT project that is simply a style project, and I have duplicated much of the Blue theme. Yet maven seems to be throwing errors like this:

    [INFO] [ERROR] <no source info>: public static class com.sencha.gxt.theme.blue.client.menu.BlueMenuItemAppearance$BlueMenuItemAppearanceHelper[INFO] extends java.lang.Object
    [INFO] enclosing type : com.sencha.gxt.theme.blue.client.menu.BlueMenuItemAppearance
    [INFO] /* methods */
    [INFO] [unresolved] public void <init>()
    [INFO] public static java.lang.String getMenuParent()
    [INFO]
    [INFO]
    [INFO]
    [INFO] org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding
    [INFO] [ERROR] at CustomCheckMenuItemAppearance_CustomCheckMenuItemResources_ie6_default_StaticClientBundleGenerator.java(57): com.sencha.gxt.theme.blue.client.menu.BlueMenuItemAppearance.BlueMenuItemAppearanceHelper.getMenuParent()
    Although I thought I had no reference to this class at all, it could be that the Base theme is trying to reference it.

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    70
    Vote Rating
    6
    mtraynham is on a distinguished road

      0  

    Default


    Nevermind my comment, found that some CSS files were referencing Java classes.

  4. #4
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    The Base module contains both "base" classes that are intended to be extended by color specific themes, such as Blue and fully implemented "default" classes that are complete as is. So it is expected to see resources such as images and CSS files in the base module.

    If an Appearance has "Base" in its name then it is abstract and must be extended. If an Appearance has "Default" in its name, it is concrete and fully implemented. We reviewed all appearance classes to ensure the standard was used in all cases. These changes went in the commit referenced below.

    For example, our buttons are the same for both the Blue and Gray theme. So in this case, ButtonCellDefaultAppearance, which is in the Base module, is not extended by the color specific themes. We choose to do this rather than "duplicate" resources and code in each color specific theme.

    In your example code, you are implementing TableFrameResources and mention you do not want to use images with TableFrame. This is the wrong approach as TableFrame is specifically designed to work with images. You would be better off creating your own frame type not based on TableFrame. A side note, we plan to add Frame types that use CSS rounded corners and gradients rather than images for browsers that support those features.

    After reviewing your post and source code we realized we had some issues with the use of frames in our appearances. Appearances were tightly bound to certain concrete Frame types, not allowing other Frame types to be used.

    We did a high level refactor of Frames and their usage throughout the library. The changes went in SVN rev 2725. The code is much more flexible and will allow you to choose to use any Frame type any place Frames are used. For example, you could use a custom non-image based Frame type with buttons, panels, windows, etc. You will never be required to implement TableFrameResources.

    Please take a look at my comments and then the code. Hopefully, this post and the code changes will meet your requirements. Let us know how it goes.

  5. #5
    Ext GWT Premium Member lefke123's Avatar
    Join Date
    Dec 2011
    Location
    Belgium
    Posts
    80
    Vote Rating
    15
    lefke123 will become famous soon enough

      0  

    Default


    I understand, but I'm just interested: why not keep the "Default" implementation in a separate module, called Default? As "Base" interfaces has its own Base module as well.

    And it's great that you're looking to replace the images with gradients.

Thread Participants: 2