Drop Down Choice

2011-03-18 Thread Shelli Orton
Hi,

I've been looking for a Wicket drop down widget where one can choose an
item from the list by typing more than the first character.  For
example, if my list contains the following values:

One
Two
Three
Four
Five

typing T would select Two, but typing Th would select Three.  Is
this possible in Wicket?

Thanks!

Shelli

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



RE: Drop Down Choice

2011-03-18 Thread Shelli Orton
Hi,

The wicket.visural.net first example looks like exactly what I need.

Thanks!

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: 18 March 2011 11:05 AM
To: users@wicket.apache.org
Subject: Re: Drop Down Choice

theres this one (though not dropdown)

http://www.wicket-library.com/wicket-examples/ajax/autocompletehttp://w
ww.wicket-library.com/wicket-examples/ajax/autocomplete;jsessionid=FE414
790D6B5E7ACECC809CB9E9C9CEB?0

Or this one if you want a drop down:
http://wicket.visural.net/examples/app/dropdown

-Nino

http://www.wicket-library.com/wicket-examples/ajax/autocomplete;jsessio
nid=FE414790D6B5E7ACECC809CB9E9C9CEB?0

2011/3/18 Shelli Orton shelli.or...@sjrb.ca

 Hi,

 I've been looking for a Wicket drop down widget where one can choose
an
 item from the list by typing more than the first character.  For
 example, if my list contains the following values:

 One
 Two
 Three
 Four
 Five

 typing T would select Two, but typing Th would select Three.
Is
 this possible in Wicket?

 Thanks!

 Shelli

 -
 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



Visural Wicket - Maven

2011-03-18 Thread Shelli Orton
Hi,

Has anybody used Visural Wicket with Maven?  I set up my repositories as
per the information on this page:

http://code.google.com/p/visural-wicket/wiki/MavenSupport

The visural-common pom and jar files downloaded are empty even though
they're not on the server.  However, there isn't a directory for
visural-wicket on the server.

Do I need to manually add the files to my repository?

Thanks,

-Original Message-
From: Shelli Orton 
Sent: 18 March 2011 11:20 AM
To: users@wicket.apache.org
Subject: RE: Drop Down Choice

Hi,

The wicket.visural.net first example looks like exactly what I need.

Thanks!

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: 18 March 2011 11:05 AM
To: users@wicket.apache.org
Subject: Re: Drop Down Choice

theres this one (though not dropdown)

http://www.wicket-library.com/wicket-examples/ajax/autocompletehttp://w
ww.wicket-library.com/wicket-examples/ajax/autocomplete;jsessionid=FE414
790D6B5E7ACECC809CB9E9C9CEB?0

Or this one if you want a drop down:
http://wicket.visural.net/examples/app/dropdown

-Nino

http://www.wicket-library.com/wicket-examples/ajax/autocomplete;jsessio
nid=FE414790D6B5E7ACECC809CB9E9C9CEB?0

2011/3/18 Shelli Orton shelli.or...@sjrb.ca

 Hi,

 I've been looking for a Wicket drop down widget where one can choose
an
 item from the list by typing more than the first character.  For
 example, if my list contains the following values:

 One
 Two
 Three
 Four
 Five

 typing T would select Two, but typing Th would select Three.
Is
 this possible in Wicket?

 Thanks!

 Shelli

 -
 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



Invalid Date Using DatePicker and Short Date Format

2010-11-24 Thread Shelli Orton
Hi,

 

I'm having an issue using a DatePicker and hoping it's a simple fix, but
I can't find it.  I have this code:

 

public class MyPanel extends Panel

{

Label createdDateLabel;

DateTextField createdDateText;

DatePicker createdDatePicker;

 

public MyPanel(String id)

{

super(id);

...

 

createdDateLabel = new Label(createdDateLabel,
ResourceStrings.createdDate);

editForm.add(createdDateLabel);



createdDateText = new DateTextField(createdDateText,

new PropertyModelDate(selectedPoiClliModel,
createdDate),

new TimestampConverter(dd-MM-);

createdDatePicker = new DatePicker();

createdDatePicker.setShowOnFieldClick(true);

createdDateText.add(createdDatePicker);

editForm.add(createdDateText);

...

}

...

}

 

public class TimestampConverter extends PatternDateConverter

{

private static final long serialVersionUID = 1L;

 

public TimestampConverter(String datePattern)

{

super(datePattern, false);

}



@Override

public Timestamp convertToObject(String value, Locale locale)

{

Date time = super.convertToObject(value, locale);

 

return new Timestamp(time.getTime());

}

}

 

The problem is when someone chooses a date from the pop-up calendar in
the application, the time isn't set and I get this error message
displayed:

 

'23-11-2010 HH:mm:ss' is not a valid Date.

 

I would have expected it to be defaulted to 00:00:00.  Is there some way
that I can set this?

 

Thanks for any help!

 



Format Date for PropertyColumn/DefaultDataTable

2010-10-18 Thread Shelli Orton
Hi,

Is there a way to apply a DateConverter to a PropertyColumn used in a
DefaultDataTable (and AjaxFallbackDefaultDataTable)?

Thanks!

Shelli 

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



RE: Format Date for PropertyColumn/DefaultDataTable

2010-10-18 Thread Shelli Orton
Hi,

Thanks for that solution!  After finding the DateLabel in the API, I
extended PropertyColumn to this class:

public class DatePropertyColumnT extends PropertyColumnT
{
private static final long serialVersionUID = 1L;
private DateConverter converter;

public DatePropertyColumn(IModelString displayModel, String
sortProperty,
String propertyExpression, DateConverter converter)
{
super(displayModel, sortProperty, propertyExpression);
this.converter = converter;
}

@SuppressWarnings(unchecked)
@Override
public void populateItem(ItemICellPopulatorT item, String
componentId, IModelT rowModel)
{
item.add(new DateLabel(componentId, (IModelDate)
createLabelModel(rowModel), converter));
}

}

I had to create my own extension of PatternDateConverter to deal with
java.sql.Timestamp values in my model objects:

public class TimestampConverter extends PatternDateConverter
{
private static final long serialVersionUID = 1L;

public TimestampConverter(String datePattern)
{
super(datePattern, false);
}

@Override
public Timestamp convertToObject(String value, Locale locale)
{
Date time = super.convertToObject(value, locale);

return new Timestamp(time.getTime());
}
}

and this is what is passed into the constructur of the
DatePropertyColumn.

Shelli


-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com]
On Behalf Of James Carman
Sent: Monday, October 18, 2010 1:24 PM
To: users@wicket.apache.org
Subject: Re: Format Date for PropertyColumn/DefaultDataTable

We use this for formatting dates, numbers, etc.:

public class MessageFormatColumnT extends PropertyColumnT
{
private final String pattern;

public MessageFormatColumn(IModelString displayModel, String
propertyExpression, String pattern)
{
super(displayModel, propertyExpression);
this.pattern = pattern;
}

public MessageFormatColumn(IModelString displayModel, String
sortProperty, String propertyExpression, String pattern)
{
super(displayModel, sortProperty, propertyExpression);
this.pattern = pattern;
}

@Override
protected IModel? createLabelModel(IModelT itemModel)
{
IModel? superModel = super.createLabelModel(itemModel);
return new ModelString(MessageFormat.format(pattern,
superModel.getObject()));
}
}


On Mon, Oct 18, 2010 at 1:33 PM, Shelli Orton shelli.or...@sjrb.ca
wrote:
 Hi,

 Is there a way to apply a DateConverter to a PropertyColumn used in a
 DefaultDataTable (and AjaxFallbackDefaultDataTable)?

 Thanks!

 Shelli

 -
 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



RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
Thanks for the help.  Your changes got rid of the errors and I can delete 
records now (and the list is updated).  

However, once a record has been selected for edit and either saved or 
cancelled, that same record is always displayed in the edit group when I choose 
another record to edit or even when I try to create a new one.  I can even 
delete the chosen record and it still displays in the edit group.

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Tuesday, October 12, 2010 10:38 AM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

here are the tweaks you need to make this work:

selectedRecordAModel = new PropertyModelRecordA(this, selectedRecordA);

recordAText = new RequiredTextField(recordAText,
new PropertyModel(selectedRecordAModel, name));

 recordBs.setModel(new PropertyModel(selectedRecordAModel, recordB));

have fun

-igor

On Tue, Oct 12, 2010 at 9:03 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 I've been able to create a sample application that exhibits the
 same/similar problems to mine.  The sample makes use of an in-memory
 list for the data versus accessing a database and so there's some
 differences.  However, I believe the problems that this sample exhibits
 have the same root cause as my project (which I believe have something
 to do with how my models are set up...).

 Issues this sample exhibits:

 1. Choose to edit an existing record, then cancel the edit.  Choose
 another/the same record to edit and the selected record is null (error
 message You must select a record to edit is displayed).  Must
 close/open session to reset.

 2. Choose to edit an existing record and save the edit.  Choose
 another/the same record to edit and you get a NPE:

    WicketMessage: Method onFormSubmitted of interface
 org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
 component [MarkupContainer [Component id = selectForm]] threw an
 exception

    Root cause:

    java.lang.NullPointerException
    at
 org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.convertCho
 iceIdToChoice(AbstractSingleSelectChoice.java:247)

 3. Create a new record and try to save it and get
 WicketRuntimeException:

    WicketMessage: Attempted to set property value on a null object.
 Property expression: name Value: New One

    Root cause:

    org.apache.wicket.WicketRuntimeException: Attempted to set property
 value on a null object. Property expression: name Value: New One
    at
 org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.j
 ava:125)

 4. Create a new record and then cancel the add, Choose an existing
 record to edit and the selected record is null (error message You must
 select a record to edit is displayed).  Must close/open session to
 reset.

 As always, all help is greatly appreciated as I am stumped.

 Thanks,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:jcgarc...@gmail.com]
 Sent: Friday, October 08, 2010 1:41 PM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing


 The attachment didn't make it,

 Can you try to extract out the relevant part and creates a quickstart
 project that actually reproduces your issue?


 On Fri, Oct 8, 2010 at 1:41 PM, Shelli Orton [via Apache Wicket] 
 ml-node+2968688-305091622-65...@n4.nabble.comml-node%2B2968688-30509162
 2-65...@n4.nabble.com
 wrote:

 Hi,

 I have been trying different things to see if I could get my code to
 work
 (and understand Wicket models better), but am still stuck.  I have a
 attached the (latest) panel class code which I hope is sufficient to
 help.

 I was reading about different models (both online and the Wicket in
 Action
 book) and thought that perhaps using a CompoundPropertyModel was more
 appropriate and may help with my issues.  Originally, I only declared
 selectedRecordA (line 40) but didn't instantiate it.  The select group
 displayed properly but when I chose a record from the list and tried
 to edit
 it, this exception was thrown:

     WicketMessage: Attempted to set property value on a null object.
 Property expression: recordA Value: Name=A-One
     Root cause:

     org.apache.wicket.WicketRuntimeException: Attempted to set
 property
 value on a null object. Property expression: recordA Value: Name=A-One
         at

 org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.j
 ava:125)

         at

 org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractProperty
 Model.java:169)

         at
 org.apache.wicket.Component.setDefaultModelObject(Component.java:3125)
         

 I set breakpoints on the getSelectedRecordA and setSelectedRecordA
 methods,
 but these aren't called when during the request cycle when the edit
 button
 is clicked.

 I then changed the class so that selectedRecordA is initialized to an
 empty
 instance of RecordA. This got rid of the above error.  However, I
 cannot
 save the edit changes because

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
Hi,

Thanks for file.  Your first email was missing these changes: 

IModelRecordA selectedRecordAModel;  (I had set mine to 
PropertyModelRecordA selectedRecordAModel;)
recordAs.setModel(selectedRecordAModel)

However, even with those changes applied, I still get the same issue of the 
selected record not updating in the edit group.  

I am deploying in Glassfish v3.  Could that have anything to do with my 
problems?

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Tuesday, October 12, 2010 11:35 AM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Thanks for the help.  Your changes got rid of the errors and I can delete 
 records now (and the list is updated).

 However, once a record has been selected for edit and either saved or 
 cancelled, that same record is always displayed in the edit group when I 
 choose another record to edit or even when I try to create a new one.  I can 
 even delete the chosen record and it still displays in the edit group.

works fine here, meaning you did not completely/propery apply my
changes. below is the complete file.

-igor

public class RecordAPanel extends Panel
{
private static final long serialVersionUID = 1L;

RecordAService recordAService;
RecordBService recordBService;

RecordA selectedRecordA = new RecordA();
IModelRecordA selectedRecordAModel;
String unmodifiedRecordA;

boolean isNew = false;

WebMarkupContainer selectGroup;
WebMarkupContainer editGroup;

Form selectForm;
Form editForm;

DropDownChoiceRecordA recordAs;
DropDownChoiceRecordB recordBs;

Button add;
Button edit;
Button save;
Button delete;
Button cancel;

Label editLegendLabel;
String editLegend;
Label recordALabel;
Label recordBLabel;

RequiredTextField recordAText;

@SuppressWarnings({ rawtypes, unchecked })
public RecordAPanel(String id)
{
super(id);

recordAService = ((Application)
RequestCycle.get().getApplication()).getRecordAService();
recordBService = ((Application)
RequestCycle.get().getApplication()).getRecordBService();

selectedRecordAModel = new PropertyModelRecordA(this,
selectedRecordA);
this.setDefaultModel(selectedRecordAModel);

// * Select  Group *

selectGroup = new WebMarkupContainer(selectGroup);
selectForm = new Form(selectForm);

recordAs = new DropDownChoiceRecordA(recordAs);
recordAs.setModel(selectedRecordAModel);
recordAs.setChoices(recordAsModel);
recordAs.setChoiceRenderer(new RecordARenderer());

//recordAs = (DropDownChoiceRecordA) new
DropDownChoiceRecordA(recordAs,
//new PropertyModelRecordA(this,
selectedRecordA),
//recordAsModel,
//new RecordARenderer());

recordAs.setNullValid(false);

selectForm.add(recordAs);

add = new Button(add)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
setSelectedRecordA(new RecordA());
isNew = true;
editLegend = New;
editGroup.setVisible(true);
selectGroup.setVisible(false);
}
};

selectForm.add(add);

edit = new Button(edit)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
if (selectedRecordA == null)
{
info(You must select a record to edit.);
}
else
{
unmodifiedRecordA = selectedRecordA.getName();
isNew = false;
editLegend = Edit;
editGroup.setVisible(true);
selectGroup.setVisible(false);
}
}
};

selectForm.add(edit);

delete = new Button(delete)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
if (selectedRecordA == null)
{
info(You must select a record to delete.);
}
else
{
// Delete the selected record
unmodifiedRecordA = selectedRecordA.getName();
recordAService.delete(selectedRecordA.getName());
selectedRecordA = null;
info(Deleted ' + unmodifiedRecordA + ');

// Force refresh of records list
RecordAPanel.this.recordAsModel.detach();
}
}
};

// Add confirmation dialog box

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
The quickstart was sent to the list this morning at 10:04 MST.  Does it
need to be resent?

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: Tuesday, October 12, 2010 11:52 AM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

No dont think so.. Please provide a quickstart.. I have had property
models
working in 1.2, 1.3, 1.4 and 1.5 so must be error 42:)

2010/10/12 Shelli Orton shelli.or...@sjrb.ca

 Hi,

 Thanks for file.  Your first email was missing these changes:

IModelRecordA selectedRecordAModel;  (I had set mine to
 PropertyModelRecordA selectedRecordAModel;)
recordAs.setModel(selectedRecordAModel)

 However, even with those changes applied, I still get the same issue
of the
 selected record not updating in the edit group.

 I am deploying in Glassfish v3.  Could that have anything to do with
my
 problems?

 Shelli

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Tuesday, October 12, 2010 11:35 AM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing

 On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton shelli.or...@sjrb.ca
 wrote:
  Thanks for the help.  Your changes got rid of the errors and I can
delete
 records now (and the list is updated).
 
  However, once a record has been selected for edit and either saved
or
 cancelled, that same record is always displayed in the edit group when
I
 choose another record to edit or even when I try to create a new one.
I can
 even delete the chosen record and it still displays in the edit group.

 works fine here, meaning you did not completely/propery apply my
 changes. below is the complete file.

 -igor

 public class RecordAPanel extends Panel
 {
private static final long serialVersionUID = 1L;

RecordAService recordAService;
RecordBService recordBService;

RecordA selectedRecordA = new RecordA();
IModelRecordA selectedRecordAModel;
String unmodifiedRecordA;

boolean isNew = false;

WebMarkupContainer selectGroup;
WebMarkupContainer editGroup;

Form selectForm;
Form editForm;

DropDownChoiceRecordA recordAs;
DropDownChoiceRecordB recordBs;

Button add;
Button edit;
Button save;
Button delete;
Button cancel;

Label editLegendLabel;
String editLegend;
Label recordALabel;
Label recordBLabel;

RequiredTextField recordAText;

@SuppressWarnings({ rawtypes, unchecked })
public RecordAPanel(String id)
{
super(id);

recordAService = ((Application)
 RequestCycle.get().getApplication()).getRecordAService();
recordBService = ((Application)
 RequestCycle.get().getApplication()).getRecordBService();

selectedRecordAModel = new PropertyModelRecordA(this,
 selectedRecordA);
this.setDefaultModel(selectedRecordAModel);

// * Select  Group *

selectGroup = new WebMarkupContainer(selectGroup);
selectForm = new Form(selectForm);

recordAs = new DropDownChoiceRecordA(recordAs);
recordAs.setModel(selectedRecordAModel);
recordAs.setChoices(recordAsModel);
recordAs.setChoiceRenderer(new RecordARenderer());

//recordAs = (DropDownChoiceRecordA) new
 DropDownChoiceRecordA(recordAs,
//new PropertyModelRecordA(this,
 selectedRecordA),
//recordAsModel,
//new RecordARenderer());

recordAs.setNullValid(false);

selectForm.add(recordAs);

add = new Button(add)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
setSelectedRecordA(new RecordA());
isNew = true;
editLegend = New;
editGroup.setVisible(true);
selectGroup.setVisible(false);
}
};

selectForm.add(add);

edit = new Button(edit)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
if (selectedRecordA == null)
{
info(You must select a record to edit.);
}
else
{
unmodifiedRecordA = selectedRecordA.getName();
isNew = false;
editLegend = Edit;
editGroup.setVisible(true);
selectGroup.setVisible(false);
}
}
};

selectForm.add(edit);

delete = new Button(delete)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
if (selectedRecordA == null)
{
info(You must select a record to delete.);
}
else

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
He provided an updated RecordAPanel.java class that works on his system.
I updated mine to match his, but still have an issue where once a record
has been selected for edit, that's the only record that is displayed in
the edit group regardless of which record is chosen from the list in the
select group or if I choose to create a new record.

If it's not the code, I was thinking that it might be the app server
doing some caching, but honestly, I'm grasping at straws.

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: Tuesday, October 12, 2010 11:58 AM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

sorry.. Did'nt see it attached.. So did igor provide you with an fixed
quickstart (working on his system).. That did not work on glassfish?

2010/10/12 Shelli Orton shelli.or...@sjrb.ca

 The quickstart was sent to the list this morning at 10:04 MST.  Does
it
 need to be resent?

 Shelli

 -Original Message-
 From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
 Sent: Tuesday, October 12, 2010 11:52 AM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing

 No dont think so.. Please provide a quickstart.. I have had property
 models
 working in 1.2, 1.3, 1.4 and 1.5 so must be error 42:)

 2010/10/12 Shelli Orton shelli.or...@sjrb.ca

  Hi,
 
  Thanks for file.  Your first email was missing these changes:
 
 IModelRecordA selectedRecordAModel;  (I had set mine to
  PropertyModelRecordA selectedRecordAModel;)
 recordAs.setModel(selectedRecordAModel)
 
  However, even with those changes applied, I still get the same issue
 of the
  selected record not updating in the edit group.
 
  I am deploying in Glassfish v3.  Could that have anything to do with
 my
  problems?
 
  Shelli
 
  -Original Message-
  From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
  Sent: Tuesday, October 12, 2010 11:35 AM
  To: users@wicket.apache.org
  Subject: Re: PropertyModel Not Refreshing
 
  On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton
shelli.or...@sjrb.ca
  wrote:
   Thanks for the help.  Your changes got rid of the errors and I can
 delete
  records now (and the list is updated).
  
   However, once a record has been selected for edit and either saved
 or
  cancelled, that same record is always displayed in the edit group
when
 I
  choose another record to edit or even when I try to create a new
one.
 I can
  even delete the chosen record and it still displays in the edit
group.
 
  works fine here, meaning you did not completely/propery apply my
  changes. below is the complete file.
 
  -igor
 
  public class RecordAPanel extends Panel
  {
 private static final long serialVersionUID = 1L;
 
 RecordAService recordAService;
 RecordBService recordBService;
 
 RecordA selectedRecordA = new RecordA();
 IModelRecordA selectedRecordAModel;
 String unmodifiedRecordA;
 
 boolean isNew = false;
 
 WebMarkupContainer selectGroup;
 WebMarkupContainer editGroup;
 
 Form selectForm;
 Form editForm;
 
 DropDownChoiceRecordA recordAs;
 DropDownChoiceRecordB recordBs;
 
 Button add;
 Button edit;
 Button save;
 Button delete;
 Button cancel;
 
 Label editLegendLabel;
 String editLegend;
 Label recordALabel;
 Label recordBLabel;
 
 RequiredTextField recordAText;
 
 @SuppressWarnings({ rawtypes, unchecked })
 public RecordAPanel(String id)
 {
 super(id);
 
 recordAService = ((Application)
  RequestCycle.get().getApplication()).getRecordAService();
 recordBService = ((Application)
  RequestCycle.get().getApplication()).getRecordBService();
 
 selectedRecordAModel = new PropertyModelRecordA(this,
  selectedRecordA);
 this.setDefaultModel(selectedRecordAModel);
 
 // * Select  Group *
 
 selectGroup = new WebMarkupContainer(selectGroup);
 selectForm = new Form(selectForm);
 
 recordAs = new DropDownChoiceRecordA(recordAs);
 recordAs.setModel(selectedRecordAModel);
 recordAs.setChoices(recordAsModel);
 recordAs.setChoiceRenderer(new RecordARenderer());
 
 //recordAs = (DropDownChoiceRecordA) new
  DropDownChoiceRecordA(recordAs,
 //new PropertyModelRecordA(this,
  selectedRecordA),
 //recordAsModel,
 //new RecordARenderer());
 
 recordAs.setNullValid(false);
 
 selectForm.add(recordAs);
 
 add = new Button(add)
 {
 private static final long serialVersionUID = 1L;
 
 public void onSubmit()
 {
 setSelectedRecordA(new RecordA());
 isNew = true;
 editLegend = New;
 editGroup.setVisible(true);
 selectGroup.setVisible(false

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
Hi,

Sorry about the serialization errors.  My real code is using JPA
services/entities and they are serialized.  

There's a number of tabs that need to be written, but I was just trying
to get the one to work before starting the others.  I set up the recordB
panel to make sure I was creating the tabs correctly.  Eventually it's
where recordBs will be CRUDed.

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: Tuesday, October 12, 2010 12:19 PM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

I can confirm the edit issue.. Also what's supposed to happen in recordb
panel?

I might have a chance to look at it a little later..

2010/10/12 Shelli Orton shelli.or...@sjrb.ca

 He provided an updated RecordAPanel.java class that works on his
system.
 I updated mine to match his, but still have an issue where once a
record
 has been selected for edit, that's the only record that is displayed
in
 the edit group regardless of which record is chosen from the list in
the
 select group or if I choose to create a new record.

 If it's not the code, I was thinking that it might be the app server
 doing some caching, but honestly, I'm grasping at straws.

 Shelli

 -Original Message-
 From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
 Sent: Tuesday, October 12, 2010 11:58 AM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing

 sorry.. Did'nt see it attached.. So did igor provide you with an fixed
 quickstart (working on his system).. That did not work on glassfish?

 2010/10/12 Shelli Orton shelli.or...@sjrb.ca

  The quickstart was sent to the list this morning at 10:04 MST.  Does
 it
  need to be resent?
 
  Shelli
 
  -Original Message-
  From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
  Sent: Tuesday, October 12, 2010 11:52 AM
  To: users@wicket.apache.org
  Subject: Re: PropertyModel Not Refreshing
 
  No dont think so.. Please provide a quickstart.. I have had property
  models
  working in 1.2, 1.3, 1.4 and 1.5 so must be error 42:)
 
  2010/10/12 Shelli Orton shelli.or...@sjrb.ca
 
   Hi,
  
   Thanks for file.  Your first email was missing these changes:
  
  IModelRecordA selectedRecordAModel;  (I had set mine to
   PropertyModelRecordA selectedRecordAModel;)
  recordAs.setModel(selectedRecordAModel)
  
   However, even with those changes applied, I still get the same
issue
  of the
   selected record not updating in the edit group.
  
   I am deploying in Glassfish v3.  Could that have anything to do
with
  my
   problems?
  
   Shelli
  
   -Original Message-
   From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
   Sent: Tuesday, October 12, 2010 11:35 AM
   To: users@wicket.apache.org
   Subject: Re: PropertyModel Not Refreshing
  
   On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton
 shelli.or...@sjrb.ca
   wrote:
Thanks for the help.  Your changes got rid of the errors and I
can
  delete
   records now (and the list is updated).
   
However, once a record has been selected for edit and either
saved
  or
   cancelled, that same record is always displayed in the edit group
 when
  I
   choose another record to edit or even when I try to create a new
 one.
  I can
   even delete the chosen record and it still displays in the edit
 group.
  
   works fine here, meaning you did not completely/propery apply my
   changes. below is the complete file.
  
   -igor
  
   public class RecordAPanel extends Panel
   {
  private static final long serialVersionUID = 1L;
  
  RecordAService recordAService;
  RecordBService recordBService;
  
  RecordA selectedRecordA = new RecordA();
  IModelRecordA selectedRecordAModel;
  String unmodifiedRecordA;
  
  boolean isNew = false;
  
  WebMarkupContainer selectGroup;
  WebMarkupContainer editGroup;
  
  Form selectForm;
  Form editForm;
  
  DropDownChoiceRecordA recordAs;
  DropDownChoiceRecordB recordBs;
  
  Button add;
  Button edit;
  Button save;
  Button delete;
  Button cancel;
  
  Label editLegendLabel;
  String editLegend;
  Label recordALabel;
  Label recordBLabel;
  
  RequiredTextField recordAText;
  
  @SuppressWarnings({ rawtypes, unchecked })
  public RecordAPanel(String id)
  {
  super(id);
  
  recordAService = ((Application)
   RequestCycle.get().getApplication()).getRecordAService();
  recordBService = ((Application)
   RequestCycle.get().getApplication()).getRecordBService();
  
  selectedRecordAModel = new PropertyModelRecordA(this,
   selectedRecordA);
  this.setDefaultModel(selectedRecordAModel);
  
  // * Select  Group *
  
  selectGroup = new WebMarkupContainer(selectGroup);
  selectForm = new Form(selectForm);
  
  recordAs = new DropDownChoiceRecordA(recordAs);
  recordAs.setModel

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
This is where my confusion about models may be kicking in.  I thought
that property models (PropertModel or CompoundPropertyModel)
automatically checked if the model object changed.  How do I tell the
model it has?

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: Tuesday, October 12, 2010 12:10 PM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

in your add button you call setSelectedRecordA(new RecordA()) but never
notify the model that a change has occured...

2010/10/12 nino martinez wael nino.martinez.w...@gmail.com

 hmm getting a lot of errors on the services not implementing
 serialization...

 But does seem theres a difference between calling :

 selectedRecordAModel.getObject().getName() and
 RecordAPanel.this.selectedRecordA

 2010/10/12 nino martinez wael nino.martinez.w...@gmail.com

 sorry.. Did'nt see it attached.. So did igor provide you with an fixed
 quickstart (working on his system).. That did not work on glassfish?


 2010/10/12 Shelli Orton shelli.or...@sjrb.ca

 The quickstart was sent to the list this morning at 10:04 MST.  Does
it
 need to be resent?

 Shelli

 -Original Message-
 From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
 Sent: Tuesday, October 12, 2010 11:52 AM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing

 No dont think so.. Please provide a quickstart.. I have had property
 models
 working in 1.2, 1.3, 1.4 and 1.5 so must be error 42:)

 2010/10/12 Shelli Orton shelli.or...@sjrb.ca

  Hi,
 
  Thanks for file.  Your first email was missing these changes:
 
 IModelRecordA selectedRecordAModel;  (I had set mine to
  PropertyModelRecordA selectedRecordAModel;)
 recordAs.setModel(selectedRecordAModel)
 
  However, even with those changes applied, I still get the same
issue
 of the
  selected record not updating in the edit group.
 
  I am deploying in Glassfish v3.  Could that have anything to do
with
 my
  problems?
 
  Shelli
 
  -Original Message-
  From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
  Sent: Tuesday, October 12, 2010 11:35 AM
  To: users@wicket.apache.org
  Subject: Re: PropertyModel Not Refreshing
 
  On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton
shelli.or...@sjrb.ca
  wrote:
   Thanks for the help.  Your changes got rid of the errors and I
can
 delete
  records now (and the list is updated).
  
   However, once a record has been selected for edit and either
saved
 or
  cancelled, that same record is always displayed in the edit group
when
 I
  choose another record to edit or even when I try to create a new
one.
 I can
  even delete the chosen record and it still displays in the edit
group.
 
  works fine here, meaning you did not completely/propery apply my
  changes. below is the complete file.
 
  -igor
 
  public class RecordAPanel extends Panel
  {
 private static final long serialVersionUID = 1L;
 
 RecordAService recordAService;
 RecordBService recordBService;
 
 RecordA selectedRecordA = new RecordA();
 IModelRecordA selectedRecordAModel;
 String unmodifiedRecordA;
 
 boolean isNew = false;
 
 WebMarkupContainer selectGroup;
 WebMarkupContainer editGroup;
 
 Form selectForm;
 Form editForm;
 
 DropDownChoiceRecordA recordAs;
 DropDownChoiceRecordB recordBs;
 
 Button add;
 Button edit;
 Button save;
 Button delete;
 Button cancel;
 
 Label editLegendLabel;
 String editLegend;
 Label recordALabel;
 Label recordBLabel;
 
 RequiredTextField recordAText;
 
 @SuppressWarnings({ rawtypes, unchecked })
 public RecordAPanel(String id)
 {
 super(id);
 
 recordAService = ((Application)
  RequestCycle.get().getApplication()).getRecordAService();
 recordBService = ((Application)
  RequestCycle.get().getApplication()).getRecordBService();
 
 selectedRecordAModel = new PropertyModelRecordA(this,
  selectedRecordA);
 this.setDefaultModel(selectedRecordAModel);
 
 // * Select  Group *
 
 selectGroup = new WebMarkupContainer(selectGroup);
 selectForm = new Form(selectForm);
 
 recordAs = new DropDownChoiceRecordA(recordAs);
 recordAs.setModel(selectedRecordAModel);
 recordAs.setChoices(recordAsModel);
 recordAs.setChoiceRenderer(new RecordARenderer());
 
 //recordAs = (DropDownChoiceRecordA) new
  DropDownChoiceRecordA(recordAs,
 //new PropertyModelRecordA(this,
  selectedRecordA),
 //recordAsModel,
 //new RecordARenderer());
 
 recordAs.setNullValid(false);
 
 selectForm.add(recordAs);
 
 add = new Button(add)
 {
 private static final long serialVersionUID = 1L;
 
 public void onSubmit()
 {
 setSelectedRecordA(new

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
I only explicitly set the selectedRecordA in two places, during the
cancel and add onSubmit methods (I removed the initialization in the
declaration in my code).  As you alluded to earlier, add is done via 

setSelectedRecordA(new RecordA());

and cancel is done via:

RecordAPanel.this.selectedRecordA = null;

I changed cancel to be:

setSelectedRecordA(new RecordA());

but it doesn't seem to make a difference, still get the issue when
cancelling.

Should I be setting the selectedRecordA to null on cancel?  It makes
sense to me and it's what I've done in other applications/frameworks,
but perhaps it's not correct in Wicket...

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: Tuesday, October 12, 2010 3:00 PM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

Think I was going in the wrong direction.. Looking at the error, seems
to
get triggered by pressing the cancel button only..

2010/10/12 Shelli Orton shelli.or...@sjrb.ca

 This is where my confusion about models may be kicking in.  I thought
 that property models (PropertModel or CompoundPropertyModel)
 automatically checked if the model object changed.  How do I tell the
 model it has?

 Shelli

 -Original Message-
 From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
 Sent: Tuesday, October 12, 2010 12:10 PM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing

 in your add button you call setSelectedRecordA(new RecordA()) but
never
 notify the model that a change has occured...

 2010/10/12 nino martinez wael nino.martinez.w...@gmail.com

  hmm getting a lot of errors on the services not implementing
  serialization...
 
  But does seem theres a difference between calling :
 
  selectedRecordAModel.getObject().getName() and
  RecordAPanel.this.selectedRecordA
 
  2010/10/12 nino martinez wael nino.martinez.w...@gmail.com
 
  sorry.. Did'nt see it attached.. So did igor provide you with an
fixed
  quickstart (working on his system).. That did not work on
glassfish?
 
 
  2010/10/12 Shelli Orton shelli.or...@sjrb.ca
 
  The quickstart was sent to the list this morning at 10:04 MST.
Does
 it
  need to be resent?
 
  Shelli
 
  -Original Message-
  From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
  Sent: Tuesday, October 12, 2010 11:52 AM
  To: users@wicket.apache.org
  Subject: Re: PropertyModel Not Refreshing
 
  No dont think so.. Please provide a quickstart.. I have had
property
  models
  working in 1.2, 1.3, 1.4 and 1.5 so must be error 42:)
 
  2010/10/12 Shelli Orton shelli.or...@sjrb.ca
 
   Hi,
  
   Thanks for file.  Your first email was missing these changes:
  
  IModelRecordA selectedRecordAModel;  (I had set mine to
   PropertyModelRecordA selectedRecordAModel;)
  recordAs.setModel(selectedRecordAModel)
  
   However, even with those changes applied, I still get the same
 issue
  of the
   selected record not updating in the edit group.
  
   I am deploying in Glassfish v3.  Could that have anything to do
 with
  my
   problems?
  
   Shelli
  
   -Original Message-
   From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
   Sent: Tuesday, October 12, 2010 11:35 AM
   To: users@wicket.apache.org
   Subject: Re: PropertyModel Not Refreshing
  
   On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton
 shelli.or...@sjrb.ca
   wrote:
Thanks for the help.  Your changes got rid of the errors and I
 can
  delete
   records now (and the list is updated).
   
However, once a record has been selected for edit and either
 saved
  or
   cancelled, that same record is always displayed in the edit
group
 when
  I
   choose another record to edit or even when I try to create a new
 one.
  I can
   even delete the chosen record and it still displays in the edit
 group.
  
   works fine here, meaning you did not completely/propery apply my
   changes. below is the complete file.
  
   -igor
  
   public class RecordAPanel extends Panel
   {
  private static final long serialVersionUID = 1L;
  
  RecordAService recordAService;
  RecordBService recordBService;
  
  RecordA selectedRecordA = new RecordA();
  IModelRecordA selectedRecordAModel;
  String unmodifiedRecordA;
  
  boolean isNew = false;
  
  WebMarkupContainer selectGroup;
  WebMarkupContainer editGroup;
  
  Form selectForm;
  Form editForm;
  
  DropDownChoiceRecordA recordAs;
  DropDownChoiceRecordB recordBs;
  
  Button add;
  Button edit;
  Button save;
  Button delete;
  Button cancel;
  
  Label editLegendLabel;
  String editLegend;
  Label recordALabel;
  Label recordBLabel;
  
  RequiredTextField recordAText;
  
  @SuppressWarnings({ rawtypes, unchecked })
  public RecordAPanel(String id)
  {
  super(id);
  
  recordAService = ((Application)
   RequestCycle.get().getApplication()).getRecordAService

RE: PropertyModel Not Refreshing

2010-10-12 Thread Shelli Orton
I had tried removing that line once before and it does solve the problem
when cancelling an edit of an existing record, but I can't cancel the
add of a new one.  Because I'm using a RequiredTextField, I get a
validation error:

 Field 'recordAText' is required.

Thanks for taking the time to look at this and at least confirming that
there is an issue (and it's not just in my mind).

Shelli

-Original Message-
From: nino martinez wael [mailto:nino.martinez.w...@gmail.com] 
Sent: Tuesday, October 12, 2010 3:26 PM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

going at a hunch I decided to rem out the below:

//cancel.setDefaultFormProcessing(false);

And seems it fixed the problem.. But im too tired to digg further had a
similar situation last week.. And the reason was sound.. Just cant
remember
it now..

2010/10/12 nino martinez wael nino.martinez.w...@gmail.com

 Think I was going in the wrong direction.. Looking at the error, seems
to
 get triggered by pressing the cancel button only..


 2010/10/12 Shelli Orton shelli.or...@sjrb.ca

 This is where my confusion about models may be kicking in.  I thought
 that property models (PropertModel or CompoundPropertyModel)
 automatically checked if the model object changed.  How do I tell the
 model it has?

 Shelli

 -Original Message-
 From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
 Sent: Tuesday, October 12, 2010 12:10 PM
 To: users@wicket.apache.org
 Subject: Re: PropertyModel Not Refreshing

 in your add button you call setSelectedRecordA(new RecordA()) but
never
 notify the model that a change has occured...

 2010/10/12 nino martinez wael nino.martinez.w...@gmail.com

  hmm getting a lot of errors on the services not implementing
  serialization...
 
  But does seem theres a difference between calling :
 
  selectedRecordAModel.getObject().getName() and
  RecordAPanel.this.selectedRecordA
 
  2010/10/12 nino martinez wael nino.martinez.w...@gmail.com
 
  sorry.. Did'nt see it attached.. So did igor provide you with an
fixed
  quickstart (working on his system).. That did not work on
glassfish?
 
 
  2010/10/12 Shelli Orton shelli.or...@sjrb.ca
 
  The quickstart was sent to the list this morning at 10:04 MST.
Does
 it
  need to be resent?
 
  Shelli
 
  -Original Message-
  From: nino martinez wael [mailto:nino.martinez.w...@gmail.com]
  Sent: Tuesday, October 12, 2010 11:52 AM
  To: users@wicket.apache.org
  Subject: Re: PropertyModel Not Refreshing
 
  No dont think so.. Please provide a quickstart.. I have had
property
  models
  working in 1.2, 1.3, 1.4 and 1.5 so must be error 42:)
 
  2010/10/12 Shelli Orton shelli.or...@sjrb.ca
 
   Hi,
  
   Thanks for file.  Your first email was missing these changes:
  
  IModelRecordA selectedRecordAModel;  (I had set mine to
   PropertyModelRecordA selectedRecordAModel;)
  recordAs.setModel(selectedRecordAModel)
  
   However, even with those changes applied, I still get the same
 issue
  of the
   selected record not updating in the edit group.
  
   I am deploying in Glassfish v3.  Could that have anything to do
 with
  my
   problems?
  
   Shelli
  
   -Original Message-
   From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
   Sent: Tuesday, October 12, 2010 11:35 AM
   To: users@wicket.apache.org
   Subject: Re: PropertyModel Not Refreshing
  
   On Tue, Oct 12, 2010 at 10:30 AM, Shelli Orton
 shelli.or...@sjrb.ca
   wrote:
Thanks for the help.  Your changes got rid of the errors and
I
 can
  delete
   records now (and the list is updated).
   
However, once a record has been selected for edit and either
 saved
  or
   cancelled, that same record is always displayed in the edit
group
 when
  I
   choose another record to edit or even when I try to create a
new
 one.
  I can
   even delete the chosen record and it still displays in the edit
 group.
  
   works fine here, meaning you did not completely/propery apply
my
   changes. below is the complete file.
  
   -igor
  
   public class RecordAPanel extends Panel
   {
  private static final long serialVersionUID = 1L;
  
  RecordAService recordAService;
  RecordBService recordBService;
  
  RecordA selectedRecordA = new RecordA();
  IModelRecordA selectedRecordAModel;
  String unmodifiedRecordA;
  
  boolean isNew = false;
  
  WebMarkupContainer selectGroup;
  WebMarkupContainer editGroup;
  
  Form selectForm;
  Form editForm;
  
  DropDownChoiceRecordA recordAs;
  DropDownChoiceRecordB recordBs;
  
  Button add;
  Button edit;
  Button save;
  Button delete;
  Button cancel;
  
  Label editLegendLabel;
  String editLegend;
  Label recordALabel;
  Label recordBLabel;
  
  RequiredTextField recordAText;
  
  @SuppressWarnings({ rawtypes, unchecked })
  public RecordAPanel(String id)
  {
  super(id);
  
  recordAService = ((Application

RE: PropertyModel Not Refreshing

2010-10-08 Thread Shelli Orton
Hi,

I have been trying different things to see if I could get my code to work (and 
understand Wicket models better), but am still stuck.  I have a attached the 
(latest) panel class code which I hope is sufficient to help.

I was reading about different models (both online and the Wicket in Action 
book) and thought that perhaps using a CompoundPropertyModel was more 
appropriate and may help with my issues.  Originally, I only declared 
selectedRecordA (line 40) but didn't instantiate it.  The select group 
displayed properly but when I chose a record from the list and tried to edit 
it, this exception was thrown:

WicketMessage: Attempted to set property value on a null object. Property 
expression: recordA Value: Name=A-One
Root cause:

org.apache.wicket.WicketRuntimeException: Attempted to set property value 
on a null object. Property expression: recordA Value: Name=A-One
at 
org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:125)
at 
org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:169)
at 
org.apache.wicket.Component.setDefaultModelObject(Component.java:3125)


I set breakpoints on the getSelectedRecordA and setSelectedRecordA methods, but 
these aren't called when during the request cycle when the edit button is 
clicked.

I then changed the class so that selectedRecordA is initialized to an empty 
instance of RecordA. This got rid of the above error.  However, I cannot save 
the edit changes because the selectedRecordA is still the empty instance that 
was created in the initialization and the persistence layer throws an 
exception.  This same problem exists if I try to add a new RecordA or try to 
delete an existing one.

If I choose to cancel the edit and then select another record to edit, I get 
the message You must select a record to edit (line 131).  This is because the 
cancel onSubmit sets selectedRecordA to null and choosing the record from the 
DDC is not setting it to the chosen record.

Clearly I am not setting up this CompoundPropertyModel properly so that the 
selectedARecord is set by the model.  Can someone tell me what I'm doing wrong?

All help is greatly appreciated,

Shelli


-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Thursday, October 07, 2010 11:27 AM
To: users@wicket.apache.org
Subject: Re: PropertyModel Not Refreshing

you have posted an incomplete piece of code and somehow from that we
are supposed to guess what is not working? create a quickstart and
provide that.

-igor

On Thu, Oct 7, 2010 at 10:15 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Does nobody have any suggestions?  If I can't get this fixed, I'm going
 to have to write the app in another framework (possibly GWT) and I'd
 really rather not have to do that.

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Wednesday, October 06, 2010 3:52 PM
 To: users@wicket.apache.org
 Subject: PropertyModel Not Refreshing

 Hi,

 First, thanks to all who have been helping me as I am new to Wicket.  I
 am splitting out two issues I am dealing with to try to keep things
 clear.

 I am trying to write a simple app that does CRUD operations on database
 records.  The goal is for the app to make use of a tab panel where each
 tab encapsulates one table from the database.  Each tab panel has two
 groups (WebMarkupContainer).  The first, selectGroup, displays a list
 (DDC) of the current items, and three buttons, add, edit and delete.
 The second, editGroup, is displayed when either the add or edit button
 was clicked on the select group, displays the record attributes and save
 and cancel buttons.  The tab panel has a selectedRecord which is used
 by both groups' components via PropertyModels. Very basic stuff.

 When I choose a record and click the edit button, the record is
 displayed in the edit group properly.  If I then choose cancel, the edit
 group is no longer displayed and the select group DDC selection is null
 as expected. I then choose another record from the list and click the
 edit button and the previous record information is displayed in the edit
 group even though the select group DDC shows the correct/selected
 record.

 This problem also occurs if I first choose to add a new record and then
 cancel the add and then choose to edit a different record.  The DDC
 shows the correct/selected record, but all the attributes in the edit
 group are null/defaults for a new record.

 If I remove the call to setDefaultFormProcessing(false) on the cancel
 button, selecting other records for edit works correctly, but I can't
 cancel a creating a new record if I use a RequiredTextField because the
 form validation fails.

 If I select a record for editing or save the newly created record, I can
 select a different record for edit or create another one correctly.  So
 I must be doing something wrong in the cancel logic. My editForm
 (created in the EditGroup

RE: PropertyModel Not Refreshing

2010-10-07 Thread Shelli Orton
Does nobody have any suggestions?  If I can't get this fixed, I'm going
to have to write the app in another framework (possibly GWT) and I'd
really rather not have to do that.

Shelli

-Original Message-
From: Shelli Orton 
Sent: Wednesday, October 06, 2010 3:52 PM
To: users@wicket.apache.org
Subject: PropertyModel Not Refreshing

Hi,

First, thanks to all who have been helping me as I am new to Wicket.  I
am splitting out two issues I am dealing with to try to keep things
clear.

I am trying to write a simple app that does CRUD operations on database
records.  The goal is for the app to make use of a tab panel where each
tab encapsulates one table from the database.  Each tab panel has two
groups (WebMarkupContainer).  The first, selectGroup, displays a list
(DDC) of the current items, and three buttons, add, edit and delete.
The second, editGroup, is displayed when either the add or edit button
was clicked on the select group, displays the record attributes and save
and cancel buttons.  The tab panel has a selectedRecord which is used
by both groups' components via PropertyModels. Very basic stuff.

When I choose a record and click the edit button, the record is
displayed in the edit group properly.  If I then choose cancel, the edit
group is no longer displayed and the select group DDC selection is null
as expected. I then choose another record from the list and click the
edit button and the previous record information is displayed in the edit
group even though the select group DDC shows the correct/selected
record.

This problem also occurs if I first choose to add a new record and then
cancel the add and then choose to edit a different record.  The DDC
shows the correct/selected record, but all the attributes in the edit
group are null/defaults for a new record.

If I remove the call to setDefaultFormProcessing(false) on the cancel
button, selecting other records for edit works correctly, but I can't
cancel a creating a new record if I use a RequiredTextField because the
form validation fails.

If I select a record for editing or save the newly created record, I can
select a different record for edit or create another one correctly.  So
I must be doing something wrong in the cancel logic. My editForm
(created in the EditGroup constructor) looks like this:

Form editForm = new Form(editForm);

editForm.add(new Label(nameLabel, Name));

editForm.add(new Label(attributeLabel, Attribute));

editForm.add(new RequiredTextFieldString(recordNameText,
new PropertyModelString(MyRecordPanel.this,
selectedRecord.name)));

editForm.add(new DropDownChoiceLir(attributes,
new PropertyModelAttribute(MyRecordPanel.this,
selectedRecord.attribute),
RateCentrePanel.this.getAttributes(),
new AttributeRenderer()));



editForm.add(new Button(cancel)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
MyRecordPanel.this.selectedRecord = null;
editGroup.setVisible(false);
selectGroup.setVisible(true);
}
}.setDefaultFormProcessing(false));

add(editForm);

Other than setting the selectedRecord to null, what should I be doing
differently?

Thanks in advance!

Shelli

-
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: Processing Flow for Button onSubmit and LDM load

2010-10-07 Thread Shelli Orton
Again, does nobody have any suggestions?  If I can't get this fixed, I'm
going to have to write the app in another framework (possibly GWT) and
I'd really rather not have to do that.

Shelli

-Original Message-
From: Shelli Orton 
Sent: Wednesday, October 06, 2010 4:05 PM
To: users@wicket.apache.org
Subject: Processing Flow for Button onSubmit and LDM load

Hi,

Again, thanks to all who have been helping me as I am new to Wicket.  I
am splitting out two issues I am dealing with to try to keep things
clear.

I am trying to write a simple app that does CRUD operations on database
records.  The goal is for the app to make use of a tab panel where each
tab encapsulates one table from the database.  Each tab panel has two
groups (WebMarkupContainer).  The first, selectGroup, displays a list
(DDC) of the current items, and three buttons, add, edit and delete.
The DDC uses a LDM to get the list of records so that changes to the
records are reflected on each request.  

When the save button is clicked the onSubmit method is called, then the
LDM load method and then the detach method (twice).  Therefore the
changes are reflected in the list when the page refreshes.

However, when the delete button is clicked, the LDM load and detach
methods are called and then the button's onSubmit.  Therefore the
changes are not reflected in the list.  This same flow is followed by
the cancel and add buttons, but since there are no changes made, it
doesn't make a practical difference in those cases.

Is it weird that the onSubmit is called before the LDM load and detach
methods for one button and after for another?  Which is the expected
processing flow?  Is there any way to change it so that the delete
process matches the save process?

Thanks in advance!

Shelli

-
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: DropDownChoice/Model Confusion

2010-10-06 Thread Shelli Orton
No, the getList() (called in the LDM load()) is only called once.  For the 
buttons add, edit and delete, the processng is like this:

- ldm.load() (which calls getList())
- button.onSubmit()
- ldm.detach() (called two times)

For the save button, the processing is:

- button.onSubmit()
- ldm.load()
- ldm.detach() (called two times)

I've discovered another anomaly in my code.  When I choose a record and click 
the edit button, the record is displayed in the edit group.  If I then choose 
cancel, the edit group is no longer displayed and the ddc selection is null. I 
then choose another record from the list and edit and the previous record 
information is displayed in the edit group even though the ddc shows the newly 
selected record.

I added get/set for the selectedRecord and set breakpoints, but those methods 
are never called.  Since the edit group components use PropertyModels, 
shouldn't the get method be called each time the page is submitted?

Shelli


-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Tuesday, October 05, 2010 4:50 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion

Is your getList() being called multiple times?

On Tue, Oct 5, 2010 at 6:37 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 I overrode the detach method in my class (which simply calls super.detach()) 
 so I could set a breakpoint and see if it gets called and it does.

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Tuesday, October 05, 2010 2:24 PM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice/Model Confusion

 I don't know how to determine that.

 -Original Message-
 From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
 Behalf Of James Carman
 Sent: Tuesday, October 05, 2010 1:44 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion

 Is it being detached?

 On Tue, Oct 5, 2010 at 3:26 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 No, I'm not using AJAX.  Is there a way to force the LDB to reload?

 Shelli

 -Original Message-
 From: jcgarciam [mailto:jcgarc...@gmail.com]
 Sent: Tuesday, October 05, 2010 12:52 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion


 I dont think it may be related to the hierarchy, are you using AJAX?

 On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
 ml-node+2956527-385265518-65...@n4.nabble.comml-node%2B2956527-38526551
 8-65...@n4.nabble.com
 wrote:

 Hmm, that code sort of works.  When I create or edit a record, the
 list
 is updated.  However, when I delete a record it is not.  My component
 hierarchy is set up like this (hope it makes sense):

 TabPanel
   - SelectForEditForm
     - MyRecords (DDC)
     - Add (Button)
     - Edit (Button)
     - Delete (Button)
   - EditGroup (WebMarkupContainer)
     - EditForm
       - MyRecord Name (TextField)
       - MyRecord Attribute (DDC)
       - Save (Button)
       - Cancel (Button)

 I created the EditGroup so that I can hide/display the edit panel.
 Debugging the application shows that the save button onSubmit is
 called
 before the update of the myRecordsModel LDM and this is why the list
 is
 updated when I create/edit a record. The delete button onSubmit is
 called after the update of the myRecordsModel LDM and that is why a
 deleted record is still visible in the list.

 I think the issue has something to do with the buttons being in
 different places in the component hierarchy. Can you provide any
 guidance on if there's some way to have the LDM updated after the
 delete
 onSubmit?

 Thanks again,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956527i=0]

 Sent: Tuesday, October 05, 2010 9:33 AM
 To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=1
 Subject: Re: DropDownChoice/Model Confusion


 Yes, that should make your DDC to query the list any time it needs to
 re
 render.

 To your 2nd. question in order to set a default or selected value,
 just
 set
 a MyRecord reference to your property, keep in mind that your
 MyRecord
 should implement and equals/hashcode correctly.


 On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=2ml-node%2B2956214
 -1797994

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956527i=3
  wrote:

  Hi,
 
  Thanks for replying.  Just to clarify, do you mean do something like
  this:
 
 
      LoadableDetachableModelListMyRecord myRecordsModel = new
  LoadableDetachableModelListMyRecord()
      {
          @Override
          protected ListMyRecord load()
          {
              return myRecordService.getList();
          }
      };
 
      MyRecord selectedRecord;
 
      form.add(new DropDownChoiceMyRecord(records,
          new PropertyModelMyRecord(this, selectedRecord

RE: DropDownChoice/Model Confusion

2010-10-06 Thread Shelli Orton
The childRecordService is a stateless JPA bean and the getList method
executes a named query on the database.  The logs show that the SQL to
retrieve the list from the db is called every time (i.e. no caching).

Shelli

-Original Message-
From: Daniel Stoch [mailto:daniel.st...@gmail.com] 
Sent: Wednesday, October 06, 2010 1:37 AM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion

The code looks ok. Maybe the problem is in childRecordService:
childRecordService.getList()
when method getList() does not reflect changes until you create a new
session. So maybe the problem is related to your service layer? Have
you checked whet this method returns inside childRecordsModel.load() ?

--
Daniel

On Tue, Oct 5, 2010 at 10:23 PM, Shelli Orton shelli.or...@sjrb.ca
wrote:
 This is what my class basically looks like, hope it helps:

-
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: DropDownChoice/Model Confusion

2010-10-06 Thread Shelli Orton
I don't understand what you mean by between requests.

-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Wednesday, October 06, 2010 9:43 AM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion

I meant between requests

On Wed, Oct 6, 2010 at 11:41 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 No, the getList() (called in the LDM load()) is only called once.  For the 
 buttons add, edit and delete, the processng is like this:

 - ldm.load() (which calls getList())
 - button.onSubmit()
 - ldm.detach() (called two times)

 For the save button, the processing is:

 - button.onSubmit()
 - ldm.load()
 - ldm.detach() (called two times)

 I've discovered another anomaly in my code.  When I choose a record and click 
 the edit button, the record is displayed in the edit group.  If I then choose 
 cancel, the edit group is no longer displayed and the ddc selection is null. 
 I then choose another record from the list and edit and the previous record 
 information is displayed in the edit group even though the ddc shows the 
 newly selected record.

 I added get/set for the selectedRecord and set breakpoints, but those methods 
 are never called.  Since the edit group components use PropertyModels, 
 shouldn't the get method be called each time the page is submitted?

 Shelli


 -Original Message-
 From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
 Behalf Of James Carman
 Sent: Tuesday, October 05, 2010 4:50 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion

 Is your getList() being called multiple times?

 On Tue, Oct 5, 2010 at 6:37 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 I overrode the detach method in my class (which simply calls super.detach()) 
 so I could set a breakpoint and see if it gets called and it does.

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Tuesday, October 05, 2010 2:24 PM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice/Model Confusion

 I don't know how to determine that.

 -Original Message-
 From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
 Behalf Of James Carman
 Sent: Tuesday, October 05, 2010 1:44 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion

 Is it being detached?

 On Tue, Oct 5, 2010 at 3:26 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 No, I'm not using AJAX.  Is there a way to force the LDB to reload?

 Shelli

 -Original Message-
 From: jcgarciam [mailto:jcgarc...@gmail.com]
 Sent: Tuesday, October 05, 2010 12:52 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion


 I dont think it may be related to the hierarchy, are you using AJAX?

 On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
 ml-node+2956527-385265518-65...@n4.nabble.comml-node%2B2956527-38526551
 8-65...@n4.nabble.com
 wrote:

 Hmm, that code sort of works.  When I create or edit a record, the
 list
 is updated.  However, when I delete a record it is not.  My component
 hierarchy is set up like this (hope it makes sense):

 TabPanel
   - SelectForEditForm
     - MyRecords (DDC)
     - Add (Button)
     - Edit (Button)
     - Delete (Button)
   - EditGroup (WebMarkupContainer)
     - EditForm
       - MyRecord Name (TextField)
       - MyRecord Attribute (DDC)
       - Save (Button)
       - Cancel (Button)

 I created the EditGroup so that I can hide/display the edit panel.
 Debugging the application shows that the save button onSubmit is
 called
 before the update of the myRecordsModel LDM and this is why the list
 is
 updated when I create/edit a record. The delete button onSubmit is
 called after the update of the myRecordsModel LDM and that is why a
 deleted record is still visible in the list.

 I think the issue has something to do with the buttons being in
 different places in the component hierarchy. Can you provide any
 guidance on if there's some way to have the LDM updated after the
 delete
 onSubmit?

 Thanks again,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956527i=0]

 Sent: Tuesday, October 05, 2010 9:33 AM
 To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=1
 Subject: Re: DropDownChoice/Model Confusion


 Yes, that should make your DDC to query the list any time it needs to
 re
 render.

 To your 2nd. question in order to set a default or selected value,
 just
 set
 a MyRecord reference to your property, keep in mind that your
 MyRecord
 should implement and equals/hashcode correctly.


 On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=2ml-node%2B2956214
 -1797994

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956527i=3
  wrote:

  Hi,
 
  Thanks for replying.  Just to clarify, do you mean do something like

RE: DropDownChoice/Model Confusion

2010-10-06 Thread Shelli Orton
By removing the call to setDefaultFormProcessing(false) on the cancel button, 
the edit group is now updated as per the selection from the ddc.

However, I'm still having the ldm loading issue.  Can anyone provide any 
insight into why when the save button is clicked that the onSubmit method is 
called before the ldm.load, but the onSubmit is called after the ldm.load for 
the delete button?

Thanks for all the help!

Shelli

-Original Message-
From: Shelli Orton 
Sent: Wednesday, October 06, 2010 9:41 AM
To: users@wicket.apache.org
Subject: RE: DropDownChoice/Model Confusion

No, the getList() (called in the LDM load()) is only called once.  For the 
buttons add, edit and delete, the processng is like this:

- ldm.load() (which calls getList())
- button.onSubmit()
- ldm.detach() (called two times)

For the save button, the processing is:

- button.onSubmit()
- ldm.load()
- ldm.detach() (called two times)

I've discovered another anomaly in my code.  When I choose a record and click 
the edit button, the record is displayed in the edit group.  If I then choose 
cancel, the edit group is no longer displayed and the ddc selection is null. I 
then choose another record from the list and edit and the previous record 
information is displayed in the edit group even though the ddc shows the newly 
selected record.

I added get/set for the selectedRecord and set breakpoints, but those methods 
are never called.  Since the edit group components use PropertyModels, 
shouldn't the get method be called each time the page is submitted?

Shelli


-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Tuesday, October 05, 2010 4:50 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion

Is your getList() being called multiple times?

On Tue, Oct 5, 2010 at 6:37 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 I overrode the detach method in my class (which simply calls super.detach()) 
 so I could set a breakpoint and see if it gets called and it does.

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Tuesday, October 05, 2010 2:24 PM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice/Model Confusion

 I don't know how to determine that.

 -Original Message-
 From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
 Behalf Of James Carman
 Sent: Tuesday, October 05, 2010 1:44 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion

 Is it being detached?

 On Tue, Oct 5, 2010 at 3:26 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 No, I'm not using AJAX.  Is there a way to force the LDB to reload?

 Shelli

 -Original Message-
 From: jcgarciam [mailto:jcgarc...@gmail.com]
 Sent: Tuesday, October 05, 2010 12:52 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion


 I dont think it may be related to the hierarchy, are you using AJAX?

 On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
 ml-node+2956527-385265518-65...@n4.nabble.comml-node%2B2956527-38526551
 8-65...@n4.nabble.com
 wrote:

 Hmm, that code sort of works.  When I create or edit a record, the
 list
 is updated.  However, when I delete a record it is not.  My component
 hierarchy is set up like this (hope it makes sense):

 TabPanel
   - SelectForEditForm
     - MyRecords (DDC)
     - Add (Button)
     - Edit (Button)
     - Delete (Button)
   - EditGroup (WebMarkupContainer)
     - EditForm
       - MyRecord Name (TextField)
       - MyRecord Attribute (DDC)
       - Save (Button)
       - Cancel (Button)

 I created the EditGroup so that I can hide/display the edit panel.
 Debugging the application shows that the save button onSubmit is
 called
 before the update of the myRecordsModel LDM and this is why the list
 is
 updated when I create/edit a record. The delete button onSubmit is
 called after the update of the myRecordsModel LDM and that is why a
 deleted record is still visible in the list.

 I think the issue has something to do with the buttons being in
 different places in the component hierarchy. Can you provide any
 guidance on if there's some way to have the LDM updated after the
 delete
 onSubmit?

 Thanks again,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956527i=0]

 Sent: Tuesday, October 05, 2010 9:33 AM
 To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=1
 Subject: Re: DropDownChoice/Model Confusion


 Yes, that should make your DDC to query the list any time it needs to
 re
 render.

 To your 2nd. question in order to set a default or selected value,
 just
 set
 a MyRecord reference to your property, keep in mind that your
 MyRecord
 should implement and equals/hashcode correctly.


 On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=2ml-node

PropertyModel Not Refreshing

2010-10-06 Thread Shelli Orton
Hi,

First, thanks to all who have been helping me as I am new to Wicket.  I
am splitting out two issues I am dealing with to try to keep things
clear.

I am trying to write a simple app that does CRUD operations on database
records.  The goal is for the app to make use of a tab panel where each
tab encapsulates one table from the database.  Each tab panel has two
groups (WebMarkupContainer).  The first, selectGroup, displays a list
(DDC) of the current items, and three buttons, add, edit and delete.
The second, editGroup, is displayed when either the add or edit button
was clicked on the select group, displays the record attributes and save
and cancel buttons.  The tab panel has a selectedRecord which is used
by both groups' components via PropertyModels. Very basic stuff.

When I choose a record and click the edit button, the record is
displayed in the edit group properly.  If I then choose cancel, the edit
group is no longer displayed and the select group DDC selection is null
as expected. I then choose another record from the list and click the
edit button and the previous record information is displayed in the edit
group even though the select group DDC shows the correct/selected
record.

This problem also occurs if I first choose to add a new record and then
cancel the add and then choose to edit a different record.  The DDC
shows the correct/selected record, but all the attributes in the edit
group are null/defaults for a new record.

If I remove the call to setDefaultFormProcessing(false) on the cancel
button, selecting other records for edit works correctly, but I can't
cancel a creating a new record if I use a RequiredTextField because the
form validation fails.

If I select a record for editing or save the newly created record, I can
select a different record for edit or create another one correctly.  So
I must be doing something wrong in the cancel logic. My editForm
(created in the EditGroup constructor) looks like this:

Form editForm = new Form(editForm);

editForm.add(new Label(nameLabel, Name));

editForm.add(new Label(attributeLabel, Attribute));

editForm.add(new RequiredTextFieldString(recordNameText,
new PropertyModelString(MyRecordPanel.this,
selectedRecord.name)));

editForm.add(new DropDownChoiceLir(attributes,
new PropertyModelAttribute(MyRecordPanel.this,
selectedRecord.attribute),
RateCentrePanel.this.getAttributes(),
new AttributeRenderer()));



editForm.add(new Button(cancel)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
MyRecordPanel.this.selectedRecord = null;
editGroup.setVisible(false);
selectGroup.setVisible(true);
}
}.setDefaultFormProcessing(false));

add(editForm);

Other than setting the selectedRecord to null, what should I be doing
differently?

Thanks in advance!

Shelli

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



Processing Flow for Button onSubmit and LDM load

2010-10-06 Thread Shelli Orton
Hi,

Again, thanks to all who have been helping me as I am new to Wicket.  I
am splitting out two issues I am dealing with to try to keep things
clear.

I am trying to write a simple app that does CRUD operations on database
records.  The goal is for the app to make use of a tab panel where each
tab encapsulates one table from the database.  Each tab panel has two
groups (WebMarkupContainer).  The first, selectGroup, displays a list
(DDC) of the current items, and three buttons, add, edit and delete.
The DDC uses a LDM to get the list of records so that changes to the
records are reflected on each request.  

When the save button is clicked the onSubmit method is called, then the
LDM load method and then the detach method (twice).  Therefore the
changes are reflected in the list when the page refreshes.

However, when the delete button is clicked, the LDM load and detach
methods are called and then the button's onSubmit.  Therefore the
changes are not reflected in the list.  This same flow is followed by
the cancel and add buttons, but since there are no changes made, it
doesn't make a practical difference in those cases.

Is it weird that the onSubmit is called before the LDM load and detach
methods for one button and after for another?  Which is the expected
processing flow?  Is there any way to change it so that the delete
process matches the save process?

Thanks in advance!

Shelli

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



RE: DropDownChoice/Model Confusion

2010-10-05 Thread Shelli Orton
Hi,

Thanks for replying.  Just to clarify, do you mean do something like
this:


LoadableDetachableModelListMyRecord myRecordsModel = new
LoadableDetachableModelListMyRecord()
{
@Override
protected ListMyRecord load()
{
return myRecordService.getList();
}
};

MyRecord selectedRecord;

form.add(new DropDownChoiceMyRecord(records,
new PropertyModelMyRecord(this, selectedRecord),
myRecordsModel,
new MyRecordRenderer()).setNullValid(false));

Shelli

-Original Message-
From: jcgarciam [mailto:jcgarc...@gmail.com] 
Sent: Monday, October 04, 2010 6:27 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion


Hi, instead of passing  getMyRecords() in the constructor wrap it
around
a LoadableDetachableModel and pass that model to the DDC. The difference
is
that your current list is fetch only once at construction of your pages
and
is considered static because its never get called again unless you
triggered
it by entering to a new page instance, while by using a LDM the
component
will ask for it every time it needs to re-render them.


On Mon, Oct 4, 2010 at 6:52 PM, Shelli Orton [via Apache Wicket] 
ml-node+2955144-665570512-65...@n4.nabble.comml-node%2B2955144-66557051
2-65...@n4.nabble.com
 wrote:

 I am writing a (simple?) database CRUD app where I have multiple tab
 panels that encapsulate the different tables in the database.  On a
 panel there's a dropdownchoice which lists the existing records for
that
 table.  There's also create, delete and edit buttons (and and edit
panel
 with save and cancel buttons).  When I create, edit or delete any of
the
 records, the dropdownchoice list doesn't reflect the changes until I
 open a new session.  So my question is how to reload the list after
one
 of these actions is done?

 Currently my dropdownchoice model is set like this:

 MyRecord selectedRecord;
 ...
 form.add(new DropDownChoiceMyRecord(records,
 new PropertyModelMyRecord(this, selectedRecord),
 getMyRecords(), // method that retrieves from the database
(via
 JPA)
 new MyRecordRenderer()).setNullValid(false)); // used to
return
 the display attribute of MyRecord

 I am trying to understand if using a LoadableDetachableModel will do
the
 reload that I want. Also, I don't know how to set the selectedRecord
 using that type of model or if it's even possible.

 Any advice?

 Thanks!

 Shelli

 -
 To unsubscribe, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=2955144i=0
 For additional commands, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=2955144i=1



 --
  View message @

http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio
n-tp2955144p2955144.html
 To start a new topic under Apache Wicket, email

ml-node+1842946-398011874-65...@n4.nabble.comml-node%2B1842946-39801187
4-65...@n4.nabble.com
 To unsubscribe from Apache Wicket, click
herehttp://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?
tpl=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXwxOD
QyOTQ2fDEyNTYxMzc3ODY=.





-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio
n-tp2955144p2955255.html
Sent from the Users forum 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: DropDownChoice/Model Confusion

2010-10-05 Thread Shelli Orton
Hmm, that code sort of works.  When I create or edit a record, the list
is updated.  However, when I delete a record it is not.  My component
hierarchy is set up like this (hope it makes sense):

TabPanel
  - SelectForEditForm
- MyRecords (DDC)
- Add (Button)
- Edit (Button)
- Delete (Button)
  - EditGroup (WebMarkupContainer)
- EditForm
  - MyRecord Name (TextField)
  - MyRecord Attribute (DDC)
  - Save (Button)
  - Cancel (Button)

I created the EditGroup so that I can hide/display the edit panel.
Debugging the application shows that the save button onSubmit is called
before the update of the myRecordsModel LDM and this is why the list is
updated when I create/edit a record. The delete button onSubmit is
called after the update of the myRecordsModel LDM and that is why a
deleted record is still visible in the list.

I think the issue has something to do with the buttons being in
different places in the component hierarchy. Can you provide any
guidance on if there's some way to have the LDM updated after the delete
onSubmit?

Thanks again,
Shelli
 
-Original Message-
From: jcgarciam [mailto:jcgarc...@gmail.com] 
Sent: Tuesday, October 05, 2010 9:33 AM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion


Yes, that should make your DDC to query the list any time it needs to re
render.

To your 2nd. question in order to set a default or selected value, just
set
a MyRecord reference to your property, keep in mind that your
MyRecord
should implement and equals/hashcode correctly.


On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
ml-node+2956214-1797994246-65...@n4.nabble.comml-node%2B2956214-1797994
246-65...@n4.nabble.com
 wrote:

 Hi,

 Thanks for replying.  Just to clarify, do you mean do something like
 this:


 LoadableDetachableModelListMyRecord myRecordsModel = new
 LoadableDetachableModelListMyRecord()
 {
 @Override
 protected ListMyRecord load()
 {
 return myRecordService.getList();
 }
 };

 MyRecord selectedRecord;

 form.add(new DropDownChoiceMyRecord(records,
 new PropertyModelMyRecord(this, selectedRecord),
 myRecordsModel,
 new MyRecordRenderer()).setNullValid(false));

 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
email]http://user/SendEmail.jtp?type=nodenode=2956214i=0]

 Sent: Monday, October 04, 2010 6:27 PM
 To: [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956214i=1
 Subject: Re: DropDownChoice/Model Confusion


 Hi, instead of passing  getMyRecords() in the constructor wrap it
 around
 a LoadableDetachableModel and pass that model to the DDC. The
difference
 is
 that your current list is fetch only once at construction of your
pages
 and
 is considered static because its never get called again unless you
 triggered
 it by entering to a new page instance, while by using a LDM the
 component
 will ask for it every time it needs to re-render them.


 On Mon, Oct 4, 2010 at 6:52 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956214i=2ml-node%2B2955144
-66557051

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956214i=3
  wrote:

  I am writing a (simple?) database CRUD app where I have multiple tab
  panels that encapsulate the different tables in the database.  On a
  panel there's a dropdownchoice which lists the existing records for
 that
  table.  There's also create, delete and edit buttons (and and edit
 panel
  with save and cancel buttons).  When I create, edit or delete any of
 the
  records, the dropdownchoice list doesn't reflect the changes until I
  open a new session.  So my question is how to reload the list after
 one
  of these actions is done?
 
  Currently my dropdownchoice model is set like this:
 
  MyRecord selectedRecord;
  ...
  form.add(new DropDownChoiceMyRecord(records,
  new PropertyModelMyRecord(this, selectedRecord),
  getMyRecords(), // method that retrieves from the database
 (via
  JPA)
  new MyRecordRenderer()).setNullValid(false)); // used to
 return
  the display attribute of MyRecord
 
  I am trying to understand if using a LoadableDetachableModel will do
 the

  reload that I want. Also, I don't know how to set the selectedRecord
  using that type of model or if it's even possible.
 
  Any advice?
 
  Thanks!
 
  Shelli
 
 
-
  To unsubscribe, e-mail: [hidden
 email]http://user/SendEmail.jtp?type=nodenode=2955144i=0
  For additional commands, e-mail: [hidden
 email]http://user/SendEmail.jtp?type=nodenode=2955144i=1
 
 
 
  --
   View message @
 

http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusi
o?by-user=t
 n-tp2955144p2955144.html
  To start a new topic under Apache Wicket

RE: DropDownChoice/Model Confusion

2010-10-05 Thread Shelli Orton
No, I'm not using AJAX.  Is there a way to force the LDB to reload?

Shelli

-Original Message-
From: jcgarciam [mailto:jcgarc...@gmail.com] 
Sent: Tuesday, October 05, 2010 12:52 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion


I dont think it may be related to the hierarchy, are you using AJAX?

On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
ml-node+2956527-385265518-65...@n4.nabble.comml-node%2B2956527-38526551
8-65...@n4.nabble.com
 wrote:

 Hmm, that code sort of works.  When I create or edit a record, the
list
 is updated.  However, when I delete a record it is not.  My component
 hierarchy is set up like this (hope it makes sense):

 TabPanel
   - SelectForEditForm
 - MyRecords (DDC)
 - Add (Button)
 - Edit (Button)
 - Delete (Button)
   - EditGroup (WebMarkupContainer)
 - EditForm
   - MyRecord Name (TextField)
   - MyRecord Attribute (DDC)
   - Save (Button)
   - Cancel (Button)

 I created the EditGroup so that I can hide/display the edit panel.
 Debugging the application shows that the save button onSubmit is
called
 before the update of the myRecordsModel LDM and this is why the list
is
 updated when I create/edit a record. The delete button onSubmit is
 called after the update of the myRecordsModel LDM and that is why a
 deleted record is still visible in the list.

 I think the issue has something to do with the buttons being in
 different places in the component hierarchy. Can you provide any
 guidance on if there's some way to have the LDM updated after the
delete
 onSubmit?

 Thanks again,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
email]http://user/SendEmail.jtp?type=nodenode=2956527i=0]

 Sent: Tuesday, October 05, 2010 9:33 AM
 To: [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956527i=1
 Subject: Re: DropDownChoice/Model Confusion


 Yes, that should make your DDC to query the list any time it needs to
re
 render.

 To your 2nd. question in order to set a default or selected value,
just
 set
 a MyRecord reference to your property, keep in mind that your
 MyRecord
 should implement and equals/hashcode correctly.


 On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956527i=2ml-node%2B2956214
-1797994

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956527i=3
  wrote:

  Hi,
 
  Thanks for replying.  Just to clarify, do you mean do something like
  this:
 
 
  LoadableDetachableModelListMyRecord myRecordsModel = new
  LoadableDetachableModelListMyRecord()
  {
  @Override
  protected ListMyRecord load()
  {
  return myRecordService.getList();
  }
  };
 
  MyRecord selectedRecord;
 
  form.add(new DropDownChoiceMyRecord(records,
  new PropertyModelMyRecord(this, selectedRecord),
  myRecordsModel,
  new MyRecordRenderer()).setNullValid(false));
 
  Shelli
 
  -Original Message-
  From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956214i=0]
 
  Sent: Monday, October 04, 2010 6:27 PM
  To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956214i=1
  Subject: Re: DropDownChoice/Model Confusion
 
 
  Hi, instead of passing  getMyRecords() in the constructor wrap it
  around
  a LoadableDetachableModel and pass that model to the DDC. The
 difference
  is
  that your current list is fetch only once at construction of your
 pages

  and
  is considered static because its never get called again unless you
  triggered
  it by entering to a new page instance, while by using a LDM the
  component
  will ask for it every time it needs to re-render them.
 
 
  On Mon, Oct 4, 2010 at 6:52 PM, Shelli Orton [via Apache Wicket] 
  [hidden email]

http://user/SendEmail.jtp?type=nodenode=2956214i=2ml-node%2B2955144
 -66557051

 
  [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956214i=3
   wrote:
 
   I am writing a (simple?) database CRUD app where I have multiple
tab
   panels that encapsulate the different tables in the database.  On
a
   panel there's a dropdownchoice which lists the existing records
for
  that
   table.  There's also create, delete and edit buttons (and and edit
  panel
   with save and cancel buttons).  When I create, edit or delete any
of
  the
   records, the dropdownchoice list doesn't reflect the changes until
I
   open a new session.  So my question is how to reload the list
after
  one
   of these actions is done?
  
   Currently my dropdownchoice model is set like this:
  
   MyRecord selectedRecord;
   ...
   form.add(new DropDownChoiceMyRecord(records,
   new PropertyModelMyRecord(this, selectedRecord),
   getMyRecords(), // method that retrieves from the database
  (via
   JPA)
   new MyRecordRenderer()).setNullValid(false)); // used to
  return
   the display attribute of MyRecord
  
   I am

RE: DropDownChoice/Model Confusion

2010-10-05 Thread Shelli Orton
{
 
childRecordService.create(selectedChildRecord, user);
info(Created ' +
selectedChildRecord.getName() + ');
}
catch (AlreadyExistsException e)
{
error(selectedChildRecord.getName() + 
already exists.);
}
}
else
{
try
{

 
childRecordService.update(unmodifiedChildRecord, selectedChildRecord,
user);
info(Updated ' +
selectedChildRecord.getName() + ');
}
catch (FailedUpdateException e)
{
log.error(Error updating ' +
selectedChildRecord.getName() + ', e);
error(An error occured during update.
Please contact the system administrator.);
}
catch (DoesNotExistException e)
{
error(' + selectedChildRecord.getName() +
' does not exist.);
}
}

// Update the dropdown list
// TODO how?

// Close the panel
editGroup.setVisible(false);
}
});

editForm.add(new Button(cancel)
{
private static final long serialVersionUID = 1L;

public void onSubmit()
{
selectedChildRecord = null;
editGroup.setVisible(false);
}
}.setDefaultFormProcessing(false));

add(editForm);
}

}

// ***
// These variables/inner classes in the real code live in
// AbstractTabPanel so that they are accessible by all tab panels
// ***

// TODO set to the logged in user
String user = Unknown;

private boolean isNew = false;
private String editLegend;
private EditGroup editGroup;

class ChildRecordRenderer implements IChoiceRendererChildRecord
{
private static final long serialVersionUID = 1L;

// Gets the display value that is visible to the end user.
public Object getDisplayValue(ChildRecord childRecord)
{
return childRecord.getName();
}

// Gets the value that is invisble to the end user, and that is
used as
// the selection id.
public String getIdValue(ChildRecord childRecord, int index)
{
return childRecord.getName();
}
}

class ParentRecordRenderer implements IChoiceRendererParentRecord
{
private static final long serialVersionUID = 1L;

// Gets the display value that is visible to the end user.
public Object getDisplayValue(ParentRecord childRecord)
{
return parentRecord.getName();
}

// Gets the value that is invisble to the end user, and that is
used as
// the selection id.
public String getIdValue(ParentRecord parentRecord, int index)
{
return parentRecord.getName();
}
}

LoadableDetachableModelListChildRecord childRecordsModel = new
LoadableDetachableModelListChildRecord()
{
private static final long serialVersionUID = 1L;

@Override
protected ListChildRecord load()
{
return childRecordService.getList();
}
};
}

-Original Message-
From: jcgarciam [mailto:jcgarc...@gmail.com] 
Sent: Tuesday, October 05, 2010 1:31 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion


There should not need to force the LDB to reload,

Can you share more code?



On Tue, Oct 5, 2010 at 4:27 PM, Shelli Orton [via Apache Wicket] 
ml-node+2956722-1309362030-65...@n4.nabble.comml-node%2B2956722-1309362
030-65...@n4.nabble.com
 wrote:

 No, I'm not using AJAX.  Is there a way to force the LDB to reload?

 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
email]http://user/SendEmail.jtp?type=nodenode=2956722i=0]

 Sent: Tuesday, October 05, 2010 12:52 PM
 To: [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956722i=1
 Subject: Re: DropDownChoice/Model Confusion


 I dont think it may be related to the hierarchy, are you using AJAX?

 On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
http://user/SendEmail.jtp?type=nodenode=2956722i=2ml-node%2B2956527
-38526551

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956722i=3
  wrote:

  Hmm, that code sort of works.  When I create or edit a record, the
 list

  is updated.  However, when I delete a record it is not.  My
component

RE: DropDownChoice/Model Confusion

2010-10-05 Thread Shelli Orton
I don't know how to determine that.

-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Tuesday, October 05, 2010 1:44 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion

Is it being detached?

On Tue, Oct 5, 2010 at 3:26 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 No, I'm not using AJAX.  Is there a way to force the LDB to reload?

 Shelli

 -Original Message-
 From: jcgarciam [mailto:jcgarc...@gmail.com]
 Sent: Tuesday, October 05, 2010 12:52 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion


 I dont think it may be related to the hierarchy, are you using AJAX?

 On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
 ml-node+2956527-385265518-65...@n4.nabble.comml-node%2B2956527-38526551
 8-65...@n4.nabble.com
 wrote:

 Hmm, that code sort of works.  When I create or edit a record, the
 list
 is updated.  However, when I delete a record it is not.  My component
 hierarchy is set up like this (hope it makes sense):

 TabPanel
   - SelectForEditForm
     - MyRecords (DDC)
     - Add (Button)
     - Edit (Button)
     - Delete (Button)
   - EditGroup (WebMarkupContainer)
     - EditForm
       - MyRecord Name (TextField)
       - MyRecord Attribute (DDC)
       - Save (Button)
       - Cancel (Button)

 I created the EditGroup so that I can hide/display the edit panel.
 Debugging the application shows that the save button onSubmit is
 called
 before the update of the myRecordsModel LDM and this is why the list
 is
 updated when I create/edit a record. The delete button onSubmit is
 called after the update of the myRecordsModel LDM and that is why a
 deleted record is still visible in the list.

 I think the issue has something to do with the buttons being in
 different places in the component hierarchy. Can you provide any
 guidance on if there's some way to have the LDM updated after the
 delete
 onSubmit?

 Thanks again,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956527i=0]

 Sent: Tuesday, October 05, 2010 9:33 AM
 To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=1
 Subject: Re: DropDownChoice/Model Confusion


 Yes, that should make your DDC to query the list any time it needs to
 re
 render.

 To your 2nd. question in order to set a default or selected value,
 just
 set
 a MyRecord reference to your property, keep in mind that your
 MyRecord
 should implement and equals/hashcode correctly.


 On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=2ml-node%2B2956214
 -1797994

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956527i=3
  wrote:

  Hi,
 
  Thanks for replying.  Just to clarify, do you mean do something like
  this:
 
 
      LoadableDetachableModelListMyRecord myRecordsModel = new
  LoadableDetachableModelListMyRecord()
      {
          @Override
          protected ListMyRecord load()
          {
              return myRecordService.getList();
          }
      };
 
      MyRecord selectedRecord;
 
      form.add(new DropDownChoiceMyRecord(records,
          new PropertyModelMyRecord(this, selectedRecord),
          myRecordsModel,
          new MyRecordRenderer()).setNullValid(false));
 
  Shelli
 
  -Original Message-
  From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956214i=0]
 
  Sent: Monday, October 04, 2010 6:27 PM
  To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956214i=1
  Subject: Re: DropDownChoice/Model Confusion
 
 
  Hi, instead of passing  getMyRecords() in the constructor wrap it
  around
  a LoadableDetachableModel and pass that model to the DDC. The
 difference
  is
  that your current list is fetch only once at construction of your
 pages

  and
  is considered static because its never get called again unless you
  triggered
  it by entering to a new page instance, while by using a LDM the
  component
  will ask for it every time it needs to re-render them.
 
 
  On Mon, Oct 4, 2010 at 6:52 PM, Shelli Orton [via Apache Wicket] 
  [hidden email]

 http://user/SendEmail.jtp?type=nodenode=2956214i=2ml-node%2B2955144
 -66557051

 
  [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956214i=3
   wrote:
 
   I am writing a (simple?) database CRUD app where I have multiple
 tab
   panels that encapsulate the different tables in the database.  On
 a
   panel there's a dropdownchoice which lists the existing records
 for
  that
   table.  There's also create, delete and edit buttons (and and edit
  panel
   with save and cancel buttons).  When I create, edit or delete any
 of
  the
   records, the dropdownchoice list doesn't reflect the changes until
 I
   open a new session.  So my question is how to reload the list
 after
  one
   of these actions is done?
  
   Currently my

RE: DropDownChoice/Model Confusion

2010-10-05 Thread Shelli Orton
I overrode the detach method in my class (which simply calls super.detach()) so 
I could set a breakpoint and see if it gets called and it does.

Shelli 

-Original Message-
From: Shelli Orton 
Sent: Tuesday, October 05, 2010 2:24 PM
To: users@wicket.apache.org
Subject: RE: DropDownChoice/Model Confusion

I don't know how to determine that.

-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Tuesday, October 05, 2010 1:44 PM
To: users@wicket.apache.org
Subject: Re: DropDownChoice/Model Confusion

Is it being detached?

On Tue, Oct 5, 2010 at 3:26 PM, Shelli Orton shelli.or...@sjrb.ca wrote:
 No, I'm not using AJAX.  Is there a way to force the LDB to reload?

 Shelli

 -Original Message-
 From: jcgarciam [mailto:jcgarc...@gmail.com]
 Sent: Tuesday, October 05, 2010 12:52 PM
 To: users@wicket.apache.org
 Subject: Re: DropDownChoice/Model Confusion


 I dont think it may be related to the hierarchy, are you using AJAX?

 On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] 
 ml-node+2956527-385265518-65...@n4.nabble.comml-node%2B2956527-38526551
 8-65...@n4.nabble.com
 wrote:

 Hmm, that code sort of works.  When I create or edit a record, the
 list
 is updated.  However, when I delete a record it is not.  My component
 hierarchy is set up like this (hope it makes sense):

 TabPanel
   - SelectForEditForm
     - MyRecords (DDC)
     - Add (Button)
     - Edit (Button)
     - Delete (Button)
   - EditGroup (WebMarkupContainer)
     - EditForm
       - MyRecord Name (TextField)
       - MyRecord Attribute (DDC)
       - Save (Button)
       - Cancel (Button)

 I created the EditGroup so that I can hide/display the edit panel.
 Debugging the application shows that the save button onSubmit is
 called
 before the update of the myRecordsModel LDM and this is why the list
 is
 updated when I create/edit a record. The delete button onSubmit is
 called after the update of the myRecordsModel LDM and that is why a
 deleted record is still visible in the list.

 I think the issue has something to do with the buttons being in
 different places in the component hierarchy. Can you provide any
 guidance on if there's some way to have the LDM updated after the
 delete
 onSubmit?

 Thanks again,
 Shelli

 -Original Message-
 From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956527i=0]

 Sent: Tuesday, October 05, 2010 9:33 AM
 To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=1
 Subject: Re: DropDownChoice/Model Confusion


 Yes, that should make your DDC to query the list any time it needs to
 re
 render.

 To your 2nd. question in order to set a default or selected value,
 just
 set
 a MyRecord reference to your property, keep in mind that your
 MyRecord
 should implement and equals/hashcode correctly.


 On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] 
 [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956527i=2ml-node%2B2956214
 -1797994

 [hidden email] http://user/SendEmail.jtp?type=nodenode=2956527i=3
  wrote:

  Hi,
 
  Thanks for replying.  Just to clarify, do you mean do something like
  this:
 
 
      LoadableDetachableModelListMyRecord myRecordsModel = new
  LoadableDetachableModelListMyRecord()
      {
          @Override
          protected ListMyRecord load()
          {
              return myRecordService.getList();
          }
      };
 
      MyRecord selectedRecord;
 
      form.add(new DropDownChoiceMyRecord(records,
          new PropertyModelMyRecord(this, selectedRecord),
          myRecordsModel,
          new MyRecordRenderer()).setNullValid(false));
 
  Shelli
 
  -Original Message-
  From: jcgarciam [mailto:[hidden
 email]http://user/SendEmail.jtp?type=nodenode=2956214i=0]
 
  Sent: Monday, October 04, 2010 6:27 PM
  To: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956214i=1
  Subject: Re: DropDownChoice/Model Confusion
 
 
  Hi, instead of passing  getMyRecords() in the constructor wrap it
  around
  a LoadableDetachableModel and pass that model to the DDC. The
 difference
  is
  that your current list is fetch only once at construction of your
 pages

  and
  is considered static because its never get called again unless you
  triggered
  it by entering to a new page instance, while by using a LDM the
  component
  will ask for it every time it needs to re-render them.
 
 
  On Mon, Oct 4, 2010 at 6:52 PM, Shelli Orton [via Apache Wicket] 
  [hidden email]

 http://user/SendEmail.jtp?type=nodenode=2956214i=2ml-node%2B2955144
 -66557051

 
  [hidden email]
 http://user/SendEmail.jtp?type=nodenode=2956214i=3
   wrote:
 
   I am writing a (simple?) database CRUD app where I have multiple
 tab
   panels that encapsulate the different tables in the database.  On
 a
   panel there's a dropdownchoice which lists the existing records
 for
  that
   table.  There's also create, delete and edit

Confirmation Dialog Not Displayed For Button

2010-10-04 Thread Shelli Orton
Hi,

I have the following code to create a
org.apache.wicket.markup.html.form.Button:

Button delete = new Button(delete)
{
public void onSubmit()
{
// Delete the selected record
}
};

delete.add(new SimpleAttributeModifier(
onclick, return confirm('Delete?');));

form.add(delete);

On my html page I have this:

input wicket:id=delete type=submit value=Delete /

When I run the application and click on the delete button, the dialog
box is not displayed and the onSubmit method is executed.  I checked the
page source and it looks like this:

input wicket:id=delete type=submit value=Delete name=delete
id=delete4 onclick=return confirm('Delete?');/

What am I doing wrong?

Thanks!
Shelli

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



RE: Confirmation Dialog Not Displayed For Button

2010-10-04 Thread Shelli Orton
I am using FF 3.6.10 and there were no javascript errors.  However,
adding the if statement seemed to make the difference as it's now
displaying.

Thanks!

-Original Message-
From: Mathias Nilsson [mailto:wicket.program...@gmail.com] 
Sent: Monday, October 04, 2010 2:51 PM
To: users@wicket.apache.org
Subject: Re: Confirmation Dialog Not Displayed For Button


I ran this in IE7, Firefox and Google Chrome and it worked fine. make
sure
you don't have a javascript error in the page and maybe add 

delete.add(new SimpleAttributeModifier(  onclick, if
(!confirm('Delete?')
){ return false; })); 


-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Confirmation-Dialog-Not-Displ
ayed-For-Button-tp2955022p2955033.html
Sent from the Users forum 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



DropDownChoice/Model Confusion

2010-10-04 Thread Shelli Orton
I am writing a (simple?) database CRUD app where I have multiple tab
panels that encapsulate the different tables in the database.  On a
panel there's a dropdownchoice which lists the existing records for that
table.  There's also create, delete and edit buttons (and and edit panel
with save and cancel buttons).  When I create, edit or delete any of the
records, the dropdownchoice list doesn't reflect the changes until I
open a new session.  So my question is how to reload the list after one
of these actions is done?

Currently my dropdownchoice model is set like this:

MyRecord selectedRecord;
...
form.add(new DropDownChoiceMyRecord(records,
new PropertyModelMyRecord(this, selectedRecord),
getMyRecords(), // method that retrieves from the database (via
JPA)
new MyRecordRenderer()).setNullValid(false)); // used to return
the display attribute of MyRecord

I am trying to understand if using a LoadableDetachableModel will do the
reload that I want. Also, I don't know how to set the selectedRecord
using that type of model or if it's even possible.

Any advice?

Thanks!

Shelli

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



RE: Problem Deploying Wicket/JPA (EclipseLink) App to Glassfish

2010-10-01 Thread Shelli Orton
Found the answer in this post:
http://stackoverflow.com/questions/1617191/deploy-war-through-netbeans-o
nto-glassfish-v3-beta

I needed to change the web.xml version to 2.5

web-app xmlns=http://java.sun.com/xml/ns/javaee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd;
version=2.5

Shelli

-Original Message-
From: Shelli Orton 
Sent: Thursday, September 30, 2010 4:42 PM
To: users@wicket.apache.org
Subject: Problem Deploying Wicket/JPA (EclipseLink) App to Glassfish

Hi,

 

I have a small Wicket app that I can deploy to Glassfish v3 without any
problems.  I also have a JAX-RS webservice that includes a jar file that
contains JPA entity beans and stateless service beans that deploys
successfully.  However, when I try to deploy a different Wicket
application that makes use of the same entity/service jar, I get this
exception:

 

SEVERE: Exception while invoking class
org.glassfish.ejb.startup.EjbDeployer load method

java.lang.RuntimeException: Unable to load EJB module.
DeploymentContext does not contain any EJB  Check archive to ensure
correct packaging for C:\Program
Files\glassfishv3\glassfish\domains\domain1\applications\MyApp

  at
org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:133)

  at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:63)

  at
org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)

snip

 

The same dependent jar files are included in both the Wicket and web
service wars.

 

Does anyone know if this a Wicket/JPA/Glassfish issue or something else?

 

Thanks!

 

Shelli


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



Problem Deploying Wicket/JPA (EclipseLink) App to Glassfish

2010-09-30 Thread Shelli Orton
Hi,

 

I have a small Wicket app that I can deploy to Glassfish v3 without any
problems.  I also have a JAX-RS webservice that includes a jar file that
contains JPA entity beans and stateless service beans that deploys
successfully.  However, when I try to deploy a different Wicket
application that makes use of the same entity/service jar, I get this
exception:

 

SEVERE: Exception while invoking class
org.glassfish.ejb.startup.EjbDeployer load method

java.lang.RuntimeException: Unable to load EJB module.
DeploymentContext does not contain any EJB  Check archive to ensure
correct packaging for C:\Program
Files\glassfishv3\glassfish\domains\domain1\applications\MyApp

  at
org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:133)

  at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:63)

  at
org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)

snip

 

The same dependent jar files are included in both the Wicket and web
service wars.

 

Does anyone know if this a Wicket/JPA/Glassfish issue or something else?

 

Thanks!

 

Shelli



Add Scrollbart to AjaxFallbackDefaultDataTable?

2010-09-29 Thread Shelli Orton
I am using an AjaxFallbackDefaultDataTable and would like to have
vertical and horizontal scrollbars as part of the table component
itself.  One reason for this is we would like to not lose the column
headers when scrolling vertically as we do with the browser scroll bars.

 

Has anybody else come across this need/want and implemented a solution?
Is this doable?

 

Thanks,

Shelli



Save Data as CSV File

2010-09-29 Thread Shelli Orton
I have a data table and would like the user to be able to save the data
locally as a csv file when they click a link or button.  The docs for
DownloadLink state that it will generate a save as dialog which is
exactly what I want, but, it appears to only work with a file that
already exists.  I haven't been able to find any examples of how to use
it, so I could be wrong about that.  I've seen some posts that talk
about using a DynamicWebResource, but I can't find any complete examples
on how to generate/download a file.

What is the best way to download a file generated programmatically in
Wicket?

Thanks,
Shelli

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



RE: Possible to Set Multiple Columns in CheckGroup?

2010-09-28 Thread Shelli Orton
Thanks!

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Monday, September 27, 2010 12:21 PM
To: users@wicket.apache.org
Subject: Re: Possible to Set Multiple Columns in CheckGroup?

since you control the markup of CheckGroup/Check components you can
align them however you like, yourself.

-igor

On Mon, Sep 27, 2010 at 10:04 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Hi,

 Is there a way to set the number of columns that a CheckGroup will
 render the checkboxes?  I have a group with 13 boxes and I would like to
 render it in two columns (one of 7 and one of 6).

 Thanks!

 Shelli

 -
 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



RE: Setting Checked Boxes in CheckGroup

2010-09-28 Thread Shelli Orton
Just wondering if anyone has had a chance to look at the quickstart project and 
could tell me what I'm doing wrong...

Shelli

-Original Message-
From: Shelli Orton 
Sent: Thursday, September 23, 2010 2:24 PM
To: users@wicket.apache.org
Subject: RE: Setting Checked Boxes in CheckGroup

I have attached a sample Eclipse project that exhibits the behaviour.  If 
someone can take the time to look at it and help me solve the problem, it would 
be greatly appreciated.  Please let me know if you need anything else.

Thanks again!

Shelli

-Original Message-
From: Erik van Oosten [mailto:e.vanoos...@grons.nl]
Sent: Thursday, September 23, 2010 12:13 PM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

See http://wicket.apache.org/start/quickstart.html

Use this to create a small application that exhibits the bug.

Regards,
 Erik.


Op 23-09-10 19:26, Shelli Orton schreef:
 What do you mean by quickstart?

 Shelli

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Thursday, September 23, 2010 10:57 AM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 im going to guess something is wrong with your model. hard to tell 
 without a quickstart.

 -igor




--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


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



RE: Setting Checked Boxes in CheckGroup

2010-09-28 Thread Shelli Orton
I added the missing methods and the default selected options are now checked.

Thanks!

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Tuesday, September 28, 2010 9:54 AM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

your SelectOption class is missing equals and hashcode

-igor

On Tue, Sep 28, 2010 at 8:38 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Just wondering if anyone has had a chance to look at the quickstart project 
 and could tell me what I'm doing wrong...

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Thursday, September 23, 2010 2:24 PM
 To: users@wicket.apache.org
 Subject: RE: Setting Checked Boxes in CheckGroup

 I have attached a sample Eclipse project that exhibits the behaviour.  If 
 someone can take the time to look at it and help me solve the problem, it 
 would be greatly appreciated.  Please let me know if you need anything else.

 Thanks again!

 Shelli

 -Original Message-
 From: Erik van Oosten [mailto:e.vanoos...@grons.nl]
 Sent: Thursday, September 23, 2010 12:13 PM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 See http://wicket.apache.org/start/quickstart.html

 Use this to create a small application that exhibits the bug.

 Regards,
     Erik.


 Op 23-09-10 19:26, Shelli Orton schreef:
 What do you mean by quickstart?

 Shelli

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Thursday, September 23, 2010 10:57 AM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 im going to guess something is wrong with your model. hard to tell
 without a quickstart.

 -igor




 --
 Erik van Oosten
 http://www.day-to-day-stuff.blogspot.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



Deploy Wicket App as Liferay Portlet

2010-09-28 Thread Shelli Orton
I am trying to deploy a Wicket application as a portlet in Liferay 5.2.3
bundled with Tomcat 6.0.  I found this which has been very helpful:
http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/browse
r
http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/brows
er 

 

When I tried to add the application to my portal, this error was thrown:

 

Sep 28, 2010 4:42:18 PM org.apache.catalina.core.ApplicationDispatcher
invoke

SEVERE: Servlet.service() for servlet MyApp threw exception

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  at java.lang.String.substring(String.java:1937)

  at
org.apache.wicket.protocol.http.portlet.PortletServletRequestWrapper.mak
eServletPath(PortletServletRequestWrapper.java:71)

...

 

I thought this may have something to do with the url-pattern on my
filter-mapping.  Initially I set my web.xml to have this:

 

filter-mapping

filter-nameMyApp/filter-name

url-pattern/myApp/url-pattern

dispatcherREQUEST/dispatcher

dispatcherINCLUDE/dispatcher

dispatcherFORWARD/dispatcher

/filter-mapping

 

and my portlet.xml to have:

 

portlet

descriptionMy App/description

portlet-nameMyApp/portlet-name

display-nameMyApp/display-name

 
portlet-classorg.apache.wicket.protocol.http.portlet.WicketPortlet/po
rtlet-class

init-param

namewicketFilterPath/name

value/myApp/value

/init-param

...

/portlet

 

 

So, I changed my web.xml to:

 

filter-mapping

filter-nameMyApp/filter-name

url-pattern/myApp/url-pattern

dispatcherREQUEST/dispatcher

dispatcherINCLUDE/dispatcher

dispatcherFORWARD/dispatcher

/filter-mapping

 

and my portlet.xml to:

 

portlet

descriptionMy App/description

portlet-nameMyApp/portlet-name

display-nameMyApp/display-name

 
portlet-classorg.apache.wicket.protocol.http.portlet.WicketPortlet/po
rtlet-class

init-param

namewicketFilterPath/name

value/myApp/value

/init-param

...

/portlet

 

 

Unfortunately, that resulted in this error when trying to deploy the
application (and then it gets undeployed):

 

SEVERE: Exception starting filter MyApp

java.lang.IllegalArgumentException: filter-mapping for WicketFilter
MyApp must start with '/' and end with '*'.

  at
org.apache.wicket.protocol.http.WicketFilter.getFilterPath(WicketFilter.
java:944)

  at
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:682)

  at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFi
lterConfig.java:275)

  at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(Applicatio
nFilterConfig.java:397)

  at
org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilte
rConfig.java:108)

  at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.jav
a:3709)

  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4363
)

  at
org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:11
16)

  at
org.apache.catalina.startup.HostConfig.check(HostConfig.java:1214)

  at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:29
3)

  at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu
pport.java:117)

  at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.j
ava:1337)

  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1601)

  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1610)

  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(
ContainerBase.java:1590)

  at java.lang.Thread.run(Thread.java:619)

 

Does anyone know what could have caused the initial error assuming it
wasn't caused by the url-pattern/wicketFilterPath?

 

Any insight is great appreciated,

 

Shelli



RE: Deploy Wicket App as Liferay Portlet

2010-09-28 Thread Shelli Orton
Of course, as soon as I send this, I find the solution...  

Apparently Wicket portlets require a URL pattern like this:

url-pattern/myApp/*/url-pattern

Shelli

-Original Message-
From: Shelli Orton 
Sent: Tuesday, September 28, 2010 4:50 PM
To: users@wicket.apache.org
Subject: Deploy Wicket App as Liferay Portlet

I am trying to deploy a Wicket application as a portlet in Liferay 5.2.3
bundled with Tomcat 6.0.  I found this which has been very helpful:
http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/browse
r
http://mail-archives.apache.org/mod_mbox/wicket-users/201001.mbox/brows
er 

 

When I tried to add the application to my portal, this error was thrown:

 

Sep 28, 2010 4:42:18 PM org.apache.catalina.core.ApplicationDispatcher
invoke

SEVERE: Servlet.service() for servlet MyApp threw exception

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

  at java.lang.String.substring(String.java:1937)

  at
org.apache.wicket.protocol.http.portlet.PortletServletRequestWrapper.mak
eServletPath(PortletServletRequestWrapper.java:71)

...

 

I thought this may have something to do with the url-pattern on my
filter-mapping.  Initially I set my web.xml to have this:

 

filter-mapping

filter-nameMyApp/filter-name

url-pattern/myApp/url-pattern

dispatcherREQUEST/dispatcher

dispatcherINCLUDE/dispatcher

dispatcherFORWARD/dispatcher

/filter-mapping

 

and my portlet.xml to have:

 

portlet

descriptionMy App/description

portlet-nameMyApp/portlet-name

display-nameMyApp/display-name

 
portlet-classorg.apache.wicket.protocol.http.portlet.WicketPortlet/po
rtlet-class

init-param

namewicketFilterPath/name

value/myApp/value

/init-param

...

/portlet

 

 

So, I changed my web.xml to:

 

filter-mapping

filter-nameMyApp/filter-name

url-pattern/myApp/url-pattern

dispatcherREQUEST/dispatcher

dispatcherINCLUDE/dispatcher

dispatcherFORWARD/dispatcher

/filter-mapping

 

and my portlet.xml to:

 

portlet

descriptionMy App/description

portlet-nameMyApp/portlet-name

display-nameMyApp/display-name

 
portlet-classorg.apache.wicket.protocol.http.portlet.WicketPortlet/po
rtlet-class

init-param

namewicketFilterPath/name

value/myApp/value

/init-param

...

/portlet

 

 

Unfortunately, that resulted in this error when trying to deploy the
application (and then it gets undeployed):

 

SEVERE: Exception starting filter MyApp

java.lang.IllegalArgumentException: filter-mapping for WicketFilter
MyApp must start with '/' and end with '*'.

  at
org.apache.wicket.protocol.http.WicketFilter.getFilterPath(WicketFilter.
java:944)

  at
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:682)

  at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFi
lterConfig.java:275)

  at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(Applicatio
nFilterConfig.java:397)

  at
org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilte
rConfig.java:108)

  at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.jav
a:3709)

  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4363
)

  at
org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:11
16)

  at
org.apache.catalina.startup.HostConfig.check(HostConfig.java:1214)

  at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:29
3)

  at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu
pport.java:117)

  at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.j
ava:1337)

  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1601)

  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1610)

  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(
ContainerBase.java:1590)

  at java.lang.Thread.run(Thread.java:619)

 

Does anyone know what could have caused the initial error assuming it
wasn't caused by the url-pattern/wicketFilterPath?

 

Any insight is great appreciated,

 

Shelli


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



Possible to Set Multiple Columns in CheckGroup?

2010-09-27 Thread Shelli Orton
Hi,

Is there a way to set the number of columns that a CheckGroup will
render the checkboxes?  I have a group with 13 boxes and I would like to
render it in two columns (one of 7 and one of 6).

Thanks!

Shelli

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



RE: Setting Checked Boxes in CheckGroup

2010-09-23 Thread Shelli Orton
Does anybody have a suggestion for this?

Thanks,

Shelli

-Original Message-
From: Shelli Orton 
Sent: Wednesday, September 22, 2010 1:54 PM
To: users@wicket.apache.org
Subject: Setting Checked Boxes in CheckGroup

Hi,

I am trying to use a CheckGroup to manage which columns are used in a
datatable.  I've set up my columns as per the code below.  The
getColumnCheckBoxes method creates the check boxes that will be part of
the group.  The getDefaultColumns defines which columns should be
checked by default.  The default columns are being set, but the boxes
are not being displayed as checked when the page is first loaded.
However, the correct columns are being displayed in the datatable, so
they are being set behind the scenes.

How do I get them to display as checked on page load?

Thanks in advance!

Shelli

CODE:

public class HomePage extends WebPage
{
StringResourceModel columnA = new StringResourceModel(columnA,
this,
null);
StringResourceModel columnB = new StringResourceModel(columnB,
this,
null);   
StringResourceModel columnC = new StringResourceModel(columnC,
this,
null);
StringResourceModel columnD = new StringResourceModel(columnD,
this,
null);

ArrayListSelectOption columnCheckBoxes = null;

CheckGroupSelectOption columnCheckGroup = new
CheckGroupSelectOption(columnCheckGroup,
new ArrayListSelectOption());

@SuppressWarnings(rawtypes)
ListIColumn columns = new ArrayListIColumn();

/**
 * Constructor that is invoked when page is invoked without a
session.
 * 
 * @param parameters Page parameters
 */
@SuppressWarnings(rawtypes)
public HomePage(final PageParameters parameters)
{
@SuppressWarnings(serial)
Form queryForm = new Form(queryForm)
{
@Override
protected void onSubmit()
{
// do stuff
}
};

add(queryForm);

// Create column selection boxes
columnCheckGroup.add(new
CheckGroupSelector(columnCheckGroupSelector));

@SuppressWarnings({ unchecked, serial })
ListView checkBoxes = new ListView(columnCheckGroup,
getColumnCheckBoxes())
{
@SuppressWarnings(unchecked)
protected void populateItem(ListItem item)
{
item.add(new Check(columnCheckbox, item.getModel()));
item.add(new Label(displayValue,
new PropertyModel(item.getModel(),
displayValue)));
}

};

if (columnCheckGroup.getModelObject().isEmpty())
{
columnCheckGroup.setModelObject(this.getDefaultColumns());
}

columnCheckGroup.add(checkBoxes);
queryForm.add(columnCheckGroup);

// more init stuff...

}

public ArrayListSelectOption getColumnCheckBoxes()
{
if (columnCheckBoxes == null)
{
columnCheckBoxes = new ArrayListSelectOption();

columnCheckBoxes.add(new SelectOption(columnA,
this.columnA.getObject()));
columnCheckBoxes.add(new SelectOption(columnB,
this.columnB.getObject()));
columnCheckBoxes.add(new SelectOption(columnC,
this.columnC.getObject()));
columnCheckBoxes.add(new SelectOption(columnD,
this.columnD.getObject()));
}

return columnCheckBoxes;
}

/*
By default, columns A and B are selected
*/
private ArrayListSelectOption getDefaultColumns()
{
ArrayListSelectOption defaultColumns = new
ArrayListSelectOption();

defaultColumns.add(new SelectOption(columnA,
this.columnA.getObject()));
defaultColumns.add(new SelectOption(columnB,
this.columnB.getObject()));

return defaultColumns;
}

class SelectOption implements Serializable
{
private static final long serialVersionUID = 1L;

private String propertyValue;
private String displayValue;

/**
 * Utility class for storing property and display values for
option 
 * widgets (e.g. drop down lists, check boxes).
 */
public SelectOption(String propertyValue, String displayValue)
{
this.propertyValue = propertyValue;
this.displayValue = displayValue;
}

// getters/setters 
}
}


-
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: Setting Checked Boxes in CheckGroup

2010-09-23 Thread Shelli Orton
What do you mean by quickstart?

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Thursday, September 23, 2010 10:57 AM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

im going to guess something is wrong with your model. hard to tell
without a quickstart.

-igor

On Thu, Sep 23, 2010 at 9:25 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Does anybody have a suggestion for this?

 Thanks,

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Wednesday, September 22, 2010 1:54 PM
 To: users@wicket.apache.org
 Subject: Setting Checked Boxes in CheckGroup

 Hi,

 I am trying to use a CheckGroup to manage which columns are used in a
 datatable.  I've set up my columns as per the code below.  The
 getColumnCheckBoxes method creates the check boxes that will be part of
 the group.  The getDefaultColumns defines which columns should be
 checked by default.  The default columns are being set, but the boxes
 are not being displayed as checked when the page is first loaded.
 However, the correct columns are being displayed in the datatable, so
 they are being set behind the scenes.

 How do I get them to display as checked on page load?

 Thanks in advance!

 Shelli

 CODE:

 public class HomePage extends WebPage
 {
    StringResourceModel columnA = new StringResourceModel(columnA,
            this,
            null);
    StringResourceModel columnB = new StringResourceModel(columnB,
            this,
            null);
    StringResourceModel columnC = new StringResourceModel(columnC,
            this,
            null);
    StringResourceModel columnD = new StringResourceModel(columnD,
            this,
            null);

    ArrayListSelectOption columnCheckBoxes = null;

    CheckGroupSelectOption columnCheckGroup = new
 CheckGroupSelectOption(columnCheckGroup,
            new ArrayListSelectOption());

   �...@suppresswarnings(rawtypes)
    ListIColumn columns = new ArrayListIColumn();

    /**
     * Constructor that is invoked when page is invoked without a
 session.
     *
     * @param parameters Page parameters
     */
   �...@suppresswarnings(rawtypes)
    public HomePage(final PageParameters parameters)
    {
       �...@suppresswarnings(serial)
        Form queryForm = new Form(queryForm)
        {
           �...@override
            protected void onSubmit()
            {
                // do stuff
            }
        };

        add(queryForm);

        // Create column selection boxes
        columnCheckGroup.add(new
 CheckGroupSelector(columnCheckGroupSelector));

       �...@suppresswarnings({ unchecked, serial })
        ListView checkBoxes = new ListView(columnCheckGroup,
                getColumnCheckBoxes())
        {
           �...@suppresswarnings(unchecked)
            protected void populateItem(ListItem item)
            {
                item.add(new Check(columnCheckbox, item.getModel()));
                item.add(new Label(displayValue,
                        new PropertyModel(item.getModel(),
 displayValue)));
            }

        };

        if (columnCheckGroup.getModelObject().isEmpty())
        {
            columnCheckGroup.setModelObject(this.getDefaultColumns());
        }

        columnCheckGroup.add(checkBoxes);
        queryForm.add(columnCheckGroup);

        // more init stuff...

    }

    public ArrayListSelectOption getColumnCheckBoxes()
    {
        if (columnCheckBoxes == null)
        {
            columnCheckBoxes = new ArrayListSelectOption();

            columnCheckBoxes.add(new SelectOption(columnA,
 this.columnA.getObject()));
            columnCheckBoxes.add(new SelectOption(columnB,
 this.columnB.getObject()));
            columnCheckBoxes.add(new SelectOption(columnC,
 this.columnC.getObject()));
            columnCheckBoxes.add(new SelectOption(columnD,
 this.columnD.getObject()));
        }

        return columnCheckBoxes;
    }

    /*
        By default, columns A and B are selected
    */
    private ArrayListSelectOption getDefaultColumns()
    {
        ArrayListSelectOption defaultColumns = new
 ArrayListSelectOption();

        defaultColumns.add(new SelectOption(columnA,
 this.columnA.getObject()));
        defaultColumns.add(new SelectOption(columnB,
 this.columnB.getObject()));

        return defaultColumns;
    }

    class SelectOption implements Serializable
    {
        private static final long serialVersionUID = 1L;

        private String propertyValue;
        private String displayValue;

        /**
         * Utility class for storing property and display values for
 option
         * widgets (e.g. drop down lists, check boxes).
         */
        public SelectOption(String propertyValue, String displayValue)
        {
            this.propertyValue = propertyValue;
            this.displayValue = displayValue;
        }

        // getters/setters

Setting Checked Boxes in CheckGroup

2010-09-22 Thread Shelli Orton
Hi,

I am trying to use a CheckGroup to manage which columns are used in a
datatable.  I've set up my columns as per the code below.  The
getColumnCheckBoxes method creates the check boxes that will be part of
the group.  The getDefaultColumns defines which columns should be
checked by default.  The default columns are being set, but the boxes
are not being displayed as checked when the page is first loaded.
However, the correct columns are being displayed in the datatable, so
they are being set behind the scenes.

How do I get them to display as checked on page load?

Thanks in advance!

Shelli

CODE:

public class HomePage extends WebPage
{
StringResourceModel columnA = new StringResourceModel(columnA,
this,
null);
StringResourceModel columnB = new StringResourceModel(columnB,
this,
null);   
StringResourceModel columnC = new StringResourceModel(columnC,
this,
null);
StringResourceModel columnD = new StringResourceModel(columnD,
this,
null);

ArrayListSelectOption columnCheckBoxes = null;

CheckGroupSelectOption columnCheckGroup = new
CheckGroupSelectOption(columnCheckGroup,
new ArrayListSelectOption());

@SuppressWarnings(rawtypes)
ListIColumn columns = new ArrayListIColumn();

/**
 * Constructor that is invoked when page is invoked without a
session.
 * 
 * @param parameters Page parameters
 */
@SuppressWarnings(rawtypes)
public HomePage(final PageParameters parameters)
{
@SuppressWarnings(serial)
Form queryForm = new Form(queryForm)
{
@Override
protected void onSubmit()
{
// do stuff
}
};

add(queryForm);

// Create column selection boxes
columnCheckGroup.add(new
CheckGroupSelector(columnCheckGroupSelector));

@SuppressWarnings({ unchecked, serial })
ListView checkBoxes = new ListView(columnCheckGroup,
getColumnCheckBoxes())
{
@SuppressWarnings(unchecked)
protected void populateItem(ListItem item)
{
item.add(new Check(columnCheckbox, item.getModel()));
item.add(new Label(displayValue,
new PropertyModel(item.getModel(),
displayValue)));
}

};

if (columnCheckGroup.getModelObject().isEmpty())
{
columnCheckGroup.setModelObject(this.getDefaultColumns());
}

columnCheckGroup.add(checkBoxes);
queryForm.add(columnCheckGroup);

// more init stuff...

}

public ArrayListSelectOption getColumnCheckBoxes()
{
if (columnCheckBoxes == null)
{
columnCheckBoxes = new ArrayListSelectOption();

columnCheckBoxes.add(new SelectOption(columnA,
this.columnA.getObject()));
columnCheckBoxes.add(new SelectOption(columnB,
this.columnB.getObject()));
columnCheckBoxes.add(new SelectOption(columnC,
this.columnC.getObject()));
columnCheckBoxes.add(new SelectOption(columnD,
this.columnD.getObject()));
}

return columnCheckBoxes;
}

/*
By default, columns A and B are selected
*/
private ArrayListSelectOption getDefaultColumns()
{
ArrayListSelectOption defaultColumns = new
ArrayListSelectOption();

defaultColumns.add(new SelectOption(columnA,
this.columnA.getObject()));
defaultColumns.add(new SelectOption(columnB,
this.columnB.getObject()));

return defaultColumns;
}

class SelectOption implements Serializable
{
private static final long serialVersionUID = 1L;

private String propertyValue;
private String displayValue;

/**
 * Utility class for storing property and display values for
option 
 * widgets (e.g. drop down lists, check boxes).
 */
public SelectOption(String propertyValue, String displayValue)
{
this.propertyValue = propertyValue;
this.displayValue = displayValue;
}

// getters/setters 
}
}


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



PropertyModel getObject returns null

2010-09-22 Thread Shelli Orton
Hi,

I followed the example on this page
https://cwiki.apache.org/WICKET/simple-sortable-datatable-example.html
to create a SortableDataProvider.  I am running into a
NullPointerException when my Comparator class' compare method is invoked
at 

int result = model1.getObject().compareTo(model2.getObject());

My class is exactly the same as the example code except for the type of
objects passed in to the method and used in Type.

The model1.getObject() is returning null.  I have confirmed in debugging
that model1 has both a valid expression and target set.

How does the object get set in a PropertyModel?

Thanks in advance!

Shelli

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



RE: Dynamic Column Datatable - Example

2010-09-22 Thread Shelli Orton
(option.getPropertyValue(),
this,
null),
option.getPropertyValue(),
option.getPropertyValue()));
}

if(datatable != null)
{
datatable.remove();
}

datatable = new DefaultDataTable(datatable,
columns,
dataProvider,
20);

add(datatable);
}



private ArrayListSelectOption getColumnCheckBoxes()
{
if (columnCheckBoxes == null)
{
columnCheckBoxes = new ArrayListSelectOption();

columnCheckBoxes.add(new SelectOption(columnA,
this.columnA.getObject()));
columnCheckBoxes.add(new SelectOption(columnB,
this.columnB.getObject()));
columnCheckBoxes.add(new SelectOption(columnC,
this.columnC.getObject()));
columnCheckBoxes.add(new SelectOption(columnD,
this.columnD.getObject()));
}

return columnCheckBoxes;
}

/*
By default, columns A and B are selected
*/
private ArrayListSelectOption getDefaultColumns()
{
ArrayListSelectOption defaultColumns = new
ArrayListSelectOption();

defaultColumns.add(new SelectOption(columnA,
this.columnA.getObject()));
defaultColumns.add(new SelectOption(columnB,
this.columnB.getObject()));

return defaultColumns;
}

class SelectOption implements Serializable
{
private static final long serialVersionUID = 1L;

private String propertyValue;
private String displayValue;

/**
 * Utility class for storing property and display values for
option 
 * widgets (e.g. drop down lists, check boxes).
 */
public SelectOption(String propertyValue, String displayValue)
{
this.propertyValue = propertyValue;
this.displayValue = displayValue;
}

// getters/setters 
}
}

-Original Message-
From: Shelli Orton 
Sent: Tuesday, September 21, 2010 10:49 AM
To: users@wicket.apache.org
Subject: Dynamic Column Datatable - Example

Hi,

 

I think what I need to do is fairly common.  I have a number of
checkboxes that users can select to determine which columns they want
displayed in a datatable.

 

I've been searching for an example of a dynamic datatable and haven't
been able to find one.  I've seen references to a solution in 2008 mail
archives that suggest it might be implemented in 1.4
(http://www.mail-archive.com/users@wicket.apache.org/msg10528.html).
Can anyone confirm that it has been or not?  In either case, is there an
example that someone can point me to?

 

Thanks in advance!

 

Shelli


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



RE: PropertyModel getObject returns null

2010-09-22 Thread Shelli Orton
I figured out what was happening.  The object returned by getObject is
the property value, not the model object (I'm still wrapping my head
around Wicket terminology/architecture).  I found this example of a
compare method that deals with nulls:

class DataRecordComparator implements ComparatorDataRecord,
Serializable
{
private static final long serialVersionUID = 1L;

@SuppressWarnings({ rawtypes, unchecked })
public int compare(final DataRecord o1, final DataRecord o2)
{
PropertyModelComparable model1 = new
PropertyModelComparable(o1,
getSort().getProperty());
PropertyModelComparable model2 = new
PropertyModelComparable(o2,
getSort().getProperty());

int result = 0;

if (model1.getObject() == null  model2.getObject() ==
null)
{
result = 0;
}
else if (model1.getObject() == null)
{
result = 1;
}
else if (model2.getObject() == null)
{
result = -1;
}
else
{
result = ((Comparable)
model1.getObject()).compareTo(model2.getObject());
}
if (!getSort().isAscending())
{
result = -result;
}

return result;
}
}


-Original Message-
From: Shelli Orton 
Sent: Wednesday, September 22, 2010 2:42 PM
To: users@wicket.apache.org
Subject: PropertyModel getObject returns null

Hi,

I followed the example on this page
https://cwiki.apache.org/WICKET/simple-sortable-datatable-example.html
to create a SortableDataProvider.  I am running into a
NullPointerException when my Comparator class' compare method is invoked
at 

int result = model1.getObject().compareTo(model2.getObject());

My class is exactly the same as the example code except for the type of
objects passed in to the method and used in Type.

The model1.getObject() is returning null.  I have confirmed in debugging
that model1 has both a valid expression and target set.

How does the object get set in a PropertyModel?

Thanks in advance!

Shelli

-
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



Dynamic Column Datatable - Example

2010-09-21 Thread Shelli Orton
Hi,

 

I think what I need to do is fairly common.  I have a number of
checkboxes that users can select to determine which columns they want
displayed in a datatable.

 

I've been searching for an example of a dynamic datatable and haven't
been able to find one.  I've seen references to a solution in 2008 mail
archives that suggest it might be implemented in 1.4
(http://www.mail-archive.com/users@wicket.apache.org/msg10528.html).
Can anyone confirm that it has been or not?  In either case, is there an
example that someone can point me to?

 

Thanks in advance!

 

Shelli