Re: Model on Select

2009-02-13 Thread Mathias P.W Nilsson

After switching from Select and SelectOption to DropDownChoice it works.
Maybe there is a problem with my Select code or there is a wicket bug.

// Mathias
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p21994805.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-13 Thread jn73



Mathias P.W Nilsson wrote:
 
 The first time my web container is loaded and I access the page all
 dropdowns and Select are set according to the values that my class has(
 new CompoundPropertyModel( new Model( myClass ) ) ). When returning to
 this page a second time the Select is not set. I have tried all that I can
 come up with.
 

I have a similar problem with the Select component. Everything works as
expected until there is a validation error on the form submit. If this
happens the Select components will display a None value in my case, so i
have to re-select items again.

-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p21996211.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-13 Thread Igor Vaynberg
whenever a listview contains form components you have to call
setreuseitems(true).

its in the javadoc, it has been mentioned on this list a thousand times.

its probably on the wiki page somewhere.

-igor

On Thu, Feb 12, 2009 at 3:09 AM, Mathias P.W Nilsson
math...@snyltarna.se wrote:

 Hi,

 I'm using CompoundPropertyModel on a form. When using with SelectOption I
 can't set the selected index.
 The none select option is there to add a none to the list. How can I set
 the selected option in the listview? Any Pointers?

  materialCategoryInformation = new Select(materialCategoryInformation );
materialCategoryInformation.add(new SelectOption(none, new
 Model(/*NULL*/)));
materialCategoryInformation.setRequired(true);
materialCategoryInformation.setOutputMarkupId( true );

ListView materialCategoryList = new ListView( materialCategoryList
 , materialCategoryModel ){
private static final long serialVersionUID = 1L;

@Override
protected void populateItem( final ListItem item ){
item.setRenderBodyOnly( true );
final CodedChainInformation codedInformation =
 (CodedChainInformation) item.getModelObject();

SelectOption option = new SelectOption( option , new 
 Model(
 (Serializable) item.getModelObject() )){
private static final long 
 serialVersionUID = 1L;

@Override
protected void onComponentTagBody( 
 MarkupStream markupStream,
 ComponentTag tag ){
String name = 
 codedInformation.getName();
if( ! codedInformation.isSeparator() )
name = nbsp;nbsp; + name;
replaceComponentTagBody(markupStream, 
 tag, name  );

}
};

item.add( option );

if( codedInformation.isSeparator() ){
option.add( new SimpleAttributeModifier( 
 class , separator
 ));
}else{
option.add( new SimpleAttributeModifier( 
 class , sub ) );
}


}
};
 --
 View this message in context: 
 http://www.nabble.com/Model-on-Select-tp21973981p21973981.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: Model on Select

2009-02-13 Thread Mathias P.W Nilsson

That may be the case but I have already tried that and it does not solve my
problem. 
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p22001539.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-13 Thread Igor Vaynberg
then you are more then welcome to provide a quickstart attached to a jira issue.

-igor

On Fri, Feb 13, 2009 at 9:50 AM, Mathias P.W Nilsson
math...@snyltarna.se wrote:

 That may be the case but I have already tried that and it does not solve my
 problem.
 --
 View this message in context: 
 http://www.nabble.com/Model-on-Select-tp21973981p22001539.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: Model on Select

2009-02-13 Thread Mathias P.W Nilsson

Thanks anyway for your time, but I think I will stick to DropDownChoice for
now. 
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p22001718.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-13 Thread Igor Vaynberg
use the quickstart maven2 archetype to generate a basic project. add
code to it that replicates your problem. zip it up and attach it to a
jira issue.

-igor

On Fri, Feb 13, 2009 at 10:05 AM, Mathias P.W Nilsson
math...@snyltarna.se wrote:

 OK,

 How does that work. Do I extract vital parts or do I make an small test
 project?
 --
 View this message in context: 
 http://www.nabble.com/Model-on-Select-tp21973981p22001847.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: Model on Select

2009-02-13 Thread Mathias P.W Nilsson

Hi again,

I created a small project with wicket extension and here it worked fine,
even if I used setReuseItems( false ).

So the problem must be in my code somewere. 
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p22002751.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-13 Thread Igor Vaynberg
oh oh they are on to us!

-igor

On Fri, Feb 13, 2009 at 2:00 PM, Martin Voigt
martin.vo...@artnology.com wrote:
 This is the reason they *always* want a quickstart ;)

 2009/2/13 Mathias P.W Nilsson math...@snyltarna.se:

 Hi again,

 I created a small project with wicket extension and here it worked fine,
 even if I used setReuseItems( false ).

 So the problem must be in my code somewere.
 --
 View this message in context: 
 http://www.nabble.com/Model-on-Select-tp21973981p22002751.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



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



Model on Select

2009-02-12 Thread Mathias P.W Nilsson

Hi,

I'm using CompoundPropertyModel on a form. When using with SelectOption I
can't set the selected index.
The none select option is there to add a none to the list. How can I set
the selected option in the listview? Any Pointers?

 materialCategoryInformation = new Select(materialCategoryInformation );
materialCategoryInformation.add(new SelectOption(none, new
Model(/*NULL*/)));
materialCategoryInformation.setRequired(true);
materialCategoryInformation.setOutputMarkupId( true );

ListView materialCategoryList = new ListView( materialCategoryList
, materialCategoryModel ){
private static final long serialVersionUID = 1L;

@Override
protected void populateItem( final ListItem item ){
item.setRenderBodyOnly( true );
final CodedChainInformation codedInformation =
(CodedChainInformation) item.getModelObject();

SelectOption option = new SelectOption( option , new 
Model(
(Serializable) item.getModelObject() )){
private static final long 
serialVersionUID = 1L;

@Override
protected void onComponentTagBody( MarkupStream 
markupStream,
ComponentTag tag ){
String name = 
codedInformation.getName();
if( ! codedInformation.isSeparator() )
name = nbsp;nbsp; + name;
replaceComponentTagBody(markupStream, 
tag, name  );

}
};

item.add( option );

if( codedInformation.isSeparator() ){
option.add( new SimpleAttributeModifier( 
class , separator
));
}else{
option.add( new SimpleAttributeModifier( 
class , sub ) );
}


}
};
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p21973981.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-12 Thread Mathias P.W Nilsson

Odd, the first time ever I access the page the select option is set otherwise
it is not.
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p21975007.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Model on Select

2009-02-12 Thread Mathias P.W Nilsson

How is this possible.

The first time my web container is loaded and I access the page all
dropdowns and Select are set according to the values that my class has( new
CompoundPropertyModel( new Model( myClass ) ) ). When returning to this page
a second time the Select is not set. I have tried all that I can come up
with. 

Any pointers? 
-- 
View this message in context: 
http://www.nabble.com/Model-on-Select-tp21973981p21981372.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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