Hybrid View
-
14 Jan 2013 1:50 AM #1
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:
OrangeButtonCell.css file: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))); } }
Here is how i set this appearance for button:Code:@sprite .over .content { gwt-image: 'buttonBackground'; height: 100%; width: 100%; }
but this changed appearance for all buttons in the application. why is it happening like this?Code:film = new TextButton(new TextButtonCell(new OrangeButtonCellAppearance<String>()), "Films");
Is the code written appropriate?
-
14 Jan 2013 5:20 AM #2
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.
-
16 Jan 2013 4:16 AM #3
thanks sven.
I implemented mentioned interfaces and it worked as expected.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote