PDA

View Full Version : Beta2 - ContentPanel has no setAppearance() method



Konstantin.Scheglov
31 Jan 2012, 8:36 PM
From example:

<gxt:ContentPanel appearance="{accordionLayoutAppearance}" animCollapse="false" bodyStyleName="pad-text" headingText="Settings">
<g:Label text="{dummyTextShort}" />
</gxt:ContentPanel>


But ContentPanel has not setAppearance() method.
And it has no @UiConstructor annotation.
Field "appearance" is set only in construction.
What do I miss?
Is it bug?

gishmo
31 Jan 2012, 10:31 PM
No, this is not a bug.
I think you are looking for a FramePanel.

Konstantin.Scheglov
1 Feb 2012, 6:42 AM
Hm...

1. But example uses ContentPanel. I don't understand how it could work. But I've not tried to compile my Beta2 Explorer example, I use online version.

2. FramePanel extends ContentPanel, but does not add setter for Appearance or @UiConstructor marked constructor.

devlearn
6 Feb 2012, 10:12 AM
Hi,

What is the bottom line in order to create an accordion like presentation ?

The 3.0 demo use a ContentPanel as stated by Konstantin.

The suggestion for using the FramedPanel does not solve the issue as there is no setAppearance() method in the FramedPanel.

I checked the javadoc, but cannot find a suitable component that could work.

Anyone found a possible solution for the accordion ?

Thanks per advance

gishmo
6 Feb 2012, 11:04 AM
Have you checked the constructor?
As far as I know, appearance is always set within the constructor.

So I would try: new ContentPanel(ContentPanelAppearence appearence) ...

devlearn
6 Feb 2012, 11:26 AM
Hi,

Thanks for the answer. I was wonderning how to use the accordion via the UiBinder.

I suppose that in that case a setter is required ?

gishmo
6 Feb 2012, 11:39 AM
I don't use UiBinder .... :-)
But I would look for something like appearence="..." or use addStyleName in the ui.xml ...

Hope that helps.

Konstantin.Scheglov
6 Feb 2012, 12:46 PM
Well, as I told in first message, there is constructor which accepts Appearance, but it is not marked with @UiConstructor, so UiBinder does not use it.

And yes, this is UiBinder.

Colin Alworth
22 Feb 2012, 3:30 PM
I wrote this reply for another thread (http://www.sencha.com/forum/showthread.php?179899-Creating-eclipse-project-for-EXT-GWT-3.0-Samples), and I think Konstantin saw it there, but other users may find this helpful:

There are lots of options when replacing an appearance. If making the change across your entire app, you should be using a replace-with in your module file. If making the change for every instance in a single uibinder class, a zero-arg @UiFactory method can work (or one that takes an appearance arg like this example). If making a change for each instance within a uibinder class, consider creating the instances ahead of time in code, by specifying @UiField(provided = true) and creating the instance in the field.

One more option for occasional reuse - make a subclass of the widget, with a no-arg constructor, calling the super constructor with a specific appearance. This is what is done in FramedPanel for a framed ContentPanel.