Re: Palette Update Behaviour Problem

2009-09-25 Thread Tim Hughes
OK, I changed the code as follows, and I'm getting a null on the  
patentsPalette.getRecorderComponent() method.


PaletteCategory patentsPalette = new PaletteCategory 
(categoryPalette, selected, allCategories, renderer, 10, false);


final Recorder recorder = patentsPalette.getRecorderComponent 
();
recorder.add( new AjaxFormComponentUpdatingBehavior 
( onchange ) {

@Override
protected void onUpdate ( AjaxRequestTarget  
ajaxRequestTarget ) {
selectedDocumentModel.getObject().addCategory 
((Category)recorder.getSelectedChoices().next());

}
});

All of this takes place in the constructor for my form.

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



Palette Behaviour Problems

2009-09-24 Thread Tim Hughes
I'm using a Palette to assign multiple Category objects to a  
Document. When I select a Category, the Palette operates correctly  
on-screen,  but:


1) in debug, the selected choice  is ALWAYS the first item in the  
allCategories list

2) the Category does not seem to get assigned to the Document object

I'm overriding newRecorderComponent in my Palette (code below). What  
am I doing wrong here?


  final Palette...
  {
  @Override
  protected Recorder newRecorderComponent()
  {
  final Recorder recorder = new Recorder(recorder, this);
  recorder.setOutputMarkupId( true );
  recorder.add(new AjaxFormComponentUpdatingBehavior 
(onchange)

  {
  @Override
  protected void onUpdate( AjaxRequestTarget  
ajaxRequestTarget)

  {
  selectedCategory.addCategory((Category) 
recorder.getSelectedChoices().next());

  }
  });
  return recorder;
  }

  };


Thanks!

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



Palette Behaviour Problems

2009-09-24 Thread Tim Hughes
I'm using a Palette to set Category objects to a Document. The  
Palette operates correctly on-screen,  but:


1) in debug, selected choice  is ALWAYS the 1st item in the list
2) the Category does not  get assigned to the Document object

I'm overriding newRecorderComponent in my Palette (code below).

 final Palette...
 {
 @Override
 protected Recorder newRecorderComponent()
 {
 final Recorder recorder = new Recorder(recorder, this);
 recorder.setOutputMarkupId( true );
 recorder.add(new AjaxFormComponentUpdatingBehavior 
(onchange)

 {
 @Override
 protected void onUpdate( AjaxRequestTarget  
ajaxRequestTarget)

 {
 selectedCategory.addCategory((Category) 
recorder.getSelectedChoices().next());

 }
 });
 return recorder;
 }

 };


Thanks!


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



Re: Palette Update Behaviour Problem

2009-09-24 Thread Tim Hughes

Fernando:

I thought that's what I was doing by overriding the  
newRecorderComponent method. Is that not correct?


I made a change to the code (see below) and now it's storing  
Categories in Documents, but:
1) it's always the first Cat in the list of choices that gets set into  
a Doc no matter which Cat I choose
2) when reselecting a given Doc, it still has Cats but they don't  
reflect in the Palette choices


@Override
protected void onUpdate( AjaxRequestTarget ajaxRequestTarget)
{
selectedDocumentModel.getObject().addCategory((Category) 
recorder.getSelectedChoices().next());

}

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



Palette Update Behaviour Problem

2009-09-23 Thread Tim Hughes
I am using a Palette to assign multiple Category objects to a  
Document object. When I select a Category, the Palette seems to  
operate correctly on-screen,  but I'm having two issues:


1) debugging the code, the selected choice (in the onUpdate below)  is  
ALWAYS the first item in the allCategories list
2) this (incorrect) Category is added to the Document, but does not  
seem to stay that way. If I switch to another Document and then come  
back to the original, there are no longer any Categories


I've scoured this list but haven't managed to find something directly  
applicable to this situation. Can anyone assist? What am I doing wrong  
here?


	IChoiceRendererCategory renderer = new ChoiceRendererCategory 
( name );
   final IModel selected = new Model((Serializable) 
selectedDocument.getCategories());

   IModel allCategories = new Model((Serializable)categories);

   final PaletteCategory documentsPalette = new  
PaletteCategory(categoryPalette, selected, allCategories,  
renderer, 10, true)

   {
   @Override
   protected Recorder newRecorderComponent()
   {
   final Recorder recorder = new Recorder(recorder,  
this);

   recorder.setOutputMarkupId( true );
   recorder.add(new AjaxFormComponentUpdatingBehavior 
(onchange)

   {
   @Override
   protected void onUpdate( AjaxRequestTarget  
ajaxRequestTarget)

   {
   selectedCategory.addCategory((Category) 
recorder.getSelectedChoices().next());

   }
   });
   return recorder;
   }

   };


Thanks!

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