Re: Qeustions about SortedSet and ListMultipleChoice (with and without Metagen)

2011-12-10 Thread Igor Vaynberg
quickstart attached to a jira ticket will help

-igor

On Fri, Dec 9, 2011 at 12:15 PM, Jablow, Eric R eric.jab...@mantech.com wrote:
 In my project, for business reasons, we have classes with SortedSet members. 
 The classes and their elements are all Serializable.  I'm having trouble 
 working with a SortedSetMantechControl object; when I try creating a 
 ListMultipleChoiceMantechControl object for it (and putting it into a 
 FormComponentPanelSortedSetMantechControl), I get all sorts of 
 compilation problems.  The MantechControlPanel has constructor:

   public MantechControlPanel(String id,
            IModelSortedSetMantechControl model) {
        super(id, model);
        control = new ListMultipleChoiceMantechControl(
                choices, new SetModelNonICDisseminationControl(choices),
                choiceList, new ChoiceRendererMantechControl(
                        banner));
        add(control);
        onModelChanged();
    }

 The onModelChanged() method has (after I extracted some local objects in a 
 futile attempt to fix things):

    @Override
    protected void onModelChanged() {
        super.onModelChanged();
        if (getModelObject()!= null) {
           control.setModel(getModel());
        }

 The problem is that the control.setModel() expects a Model of a Collection, 
 while getModel() returns a  Model of a SortedSet:

    The method setModel(IModelCollection MantechControl ) in the type 
 FormComponentCollection MantechControl  is not applicable for the 
 arguments (IModelSortedSet MantechControl ). I have good business reasons 
 to use a sorted set, and what I think are good reasons to use a 
 FormComponentPanel and a ListMultipleChoice. But should I do something 
 different?

 Meanwhile, I've created a wicket/metagen quickstart project and am running 
 into a similar problem  there.  I can upload the project somewhere if you 
 want more info.  Here I wrote a class ColorfulPerson that has a String name 
 and a SortedSetColor colors.  In trying to write a FormComponentPanel for 
 this, I have an obvious error at the indicated line:

 public class ColorfulPersonPanel extends FormComponentPanelColorfulPerson {
 private static final long serialVersionUID = -457616015428125432L;
 private final FormComponentString name;
 private final FormComponentCollectionColor colors;
 private ListColor colorChoices = Arrays.asList(Color.values());
 public ColorfulPersonPanel(String id, IModelColorfulPerson model) {
                super(id, model);
                name = new TextFieldString(name, new ModelString());
                add(name);
                colors = new ListMultipleChoiceColor(colors, new 
 SetModelColor(), colorChoices);
                add(colors);
                onModelChanged();
 }
 @Override
 protected void onModelChanged() {
                super.onModelChanged();
                ColorfulPerson colorfulPerson = getModelObject();
                if (colorfulPerson != null) {
                                
 name.setModel(MetaModel.of(colorfulPerson).get(ColorfulPersonMeta.name));
                                
 colors.setModel(MetaModel.of(colorfulPerson).get(ColorfulPersonMeta.colors));
                                // Error as the model is one of 
 SortedSetColor while the ListMultipleChioice expects a model of 
 CollectionColor.

                } else {
                                name.setModelObject(null);
                                colors.setModelObject(null);
                }
 }

 Could there be a MetaModel.as(Class? castingClass) method?

 Respectfully,
 Eric Jablow

 This communication, along with any attachments, is covered by federal and 
 state law governing electronic communications and may contain company 
 proprietary and legally privileged information.  If the reader of this 
 message is not the intended recipient, you are hereby notified that any 
 dissemination, distribution, use or copying of this message is strictly 
 prohibited.  If you have received this in error, please reply immediately to 
 the sender and delete this message.  Thank you.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Qeustions about SortedSet and ListMultipleChoice (with and without Metagen)

2011-12-09 Thread Jablow, Eric R
In my project, for business reasons, we have classes with SortedSet members. 
The classes and their elements are all Serializable.  I'm having trouble 
working with a SortedSetMantechControl object; when I try creating a 
ListMultipleChoiceMantechControl object for it (and putting it into a 
FormComponentPanelSortedSetMantechControl), I get all sorts of compilation 
problems.  The MantechControlPanel has constructor:

   public MantechControlPanel(String id,
IModelSortedSetMantechControl model) {
super(id, model);
control = new ListMultipleChoiceMantechControl(
choices, new SetModelNonICDisseminationControl(choices),
choiceList, new ChoiceRendererMantechControl(
banner));
add(control);
onModelChanged();
}

The onModelChanged() method has (after I extracted some local objects in a 
futile attempt to fix things):

@Override
protected void onModelChanged() {
super.onModelChanged();
if (getModelObject()!= null) {
   control.setModel(getModel());
}

The problem is that the control.setModel() expects a Model of a Collection, 
while getModel() returns a  Model of a SortedSet:

The method setModel(IModelCollection MantechControl ) in the type 
FormComponentCollection MantechControl  is not applicable for the arguments 
(IModelSortedSet MantechControl ). I have good business reasons to use a 
sorted set, and what I think are good reasons to use a FormComponentPanel and a 
ListMultipleChoice. But should I do something different?

Meanwhile, I've created a wicket/metagen quickstart project and am running into 
a similar problem  there.  I can upload the project somewhere if you want more 
info.  Here I wrote a class ColorfulPerson that has a String name and a 
SortedSetColor colors.  In trying to write a FormComponentPanel for this, I 
have an obvious error at the indicated line:

public class ColorfulPersonPanel extends FormComponentPanelColorfulPerson {
private static final long serialVersionUID = -457616015428125432L;
private final FormComponentString name;
private final FormComponentCollectionColor colors;
private ListColor colorChoices = Arrays.asList(Color.values());
public ColorfulPersonPanel(String id, IModelColorfulPerson model) {
super(id, model);
name = new TextFieldString(name, new ModelString());
add(name);
colors = new ListMultipleChoiceColor(colors, new 
SetModelColor(), colorChoices);
add(colors);
onModelChanged();
}
@Override
protected void onModelChanged() {
super.onModelChanged();
ColorfulPerson colorfulPerson = getModelObject();
if (colorfulPerson != null) {

name.setModel(MetaModel.of(colorfulPerson).get(ColorfulPersonMeta.name));

colors.setModel(MetaModel.of(colorfulPerson).get(ColorfulPersonMeta.colors));
// Error as the model is one of 
SortedSetColor while the ListMultipleChioice expects a model of 
CollectionColor.

} else {
name.setModelObject(null);
colors.setModelObject(null);
}
}

Could there be a MetaModel.as(Class? castingClass) method?

Respectfully,
Eric Jablow

This communication, along with any attachments, is covered by federal and state 
law governing electronic communications and may contain company proprietary and 
legally privileged information.  If the reader of this message is not the 
intended recipient, you are hereby notified that any dissemination, 
distribution, use or copying of this message is strictly prohibited.  If you 
have received this in error, please reply immediately to the sender and delete 
this message.  Thank you.