Hybrid View

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    India
    Posts
    14
    Vote Rating
    0
    saurabh0683 is on a distinguished road

      0  

    Default Issue while setting custom appearance for TextButton

    Issue while setting custom appearance for TextButton


    I created custom appearance for TextButton and applied it for one particular button. Here is code:
    Code:
    public class OrangeButtonCellAppearance<C> extends ButtonCellDefaultAppearance<C> {
    
    
        public interface OrangeButtonCellResources extends ButtonCellResources
        {
            @Source({"com/sencha/gxt/theme/base/client/button/ButtonCell.css"})
            ButtonCellStyle style();
        }
    
    
        public interface OrangeButtonTableFrameResources extends ButtonTableFrameResources
        {
            @Source({"com/sencha/gxt/theme/base/client/frame/TableFrame.css",
                    "com/sencha/gxt/theme/base/client/button/ButtonTableFrame.css",
                    "OrangeButtonCell.css"})
            TableFrame.TableFrameStyle style();
    
    
            @Source("orange_bg_bar.png")
            @ImageResource.ImageOptions(repeatStyle = ImageResource.RepeatStyle.Horizontal)
            ImageResource buttonBackground();
        }
    
    
        public OrangeButtonCellAppearance() {
            this(GWT.<OrangeButtonCellResources> create(OrangeButtonCellResources.class));
        }
    
    
        /**
         * Creates a button cell base appearance using the specified resources and
         * templates.
         *
         * @param resources the button cell resources
         */
        public OrangeButtonCellAppearance(OrangeButtonCellResources resources) {
            super(resources, GWT.<ButtonCellTemplates>create(ButtonCellTemplates.class),
                    new TableFrame(GWT.<OrangeButtonTableFrameResources>create(OrangeButtonTableFrameResources.class)));
        }
    }
    OrangeButtonCell.css file:
    Code:
    @sprite .over .content {
      gwt-image: 'buttonBackground';
      height: 100%;
      width: 100%;
    }
    Here is how i set this appearance for button:
    Code:
    film = new TextButton(new TextButtonCell(new OrangeButtonCellAppearance<String>()), "Films");
    but this changed appearance for all buttons in the application. why is it happening like this?
    Is the code written appropriate?

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,715
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      2  

    Default


    You are returning the existing CssResources and just changed the source annotation. However this wont work.

    You need to extend TableFrame.TableFrameStyle and ButtonCellStyle and return this extended interface.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Location
    India
    Posts
    14
    Vote Rating
    0
    saurabh0683 is on a distinguished road

      0  

    Default


    thanks sven.
    I implemented mentioned interfaces and it worked as expected.