Password Field Question

2009-09-10 Thread jpalmer1026





I have the below snippet of code used to allow the user to change their password by typing their old password and then typing in their new password twice. Not sure why but I'm getting the following exception when the code is executed:WicketMessage: No get method defined for class: class org.cityofchicago.dor.ezdec.domain.security.EzdecUser _expression_: controlPasswordThings were working fine until I moved the password stuff to the WebMarkupContainer.Any suggestions would be greatly appreciated.PasswordTextField oldPasswordField = new PasswordTextField("oldPassword", new Model()) { @Override public void validate() { if (!MD5Helper.toMD5(getInput()).equals(EzdecSession.getCurrentUser().getPassword())) { error(new IValidationError() { @Override public String getErrorMessage(IErrorMessageSource arg0) { return "Old password does not match password on file. Please ensure caps lock is not on and try again."; } }); } } };// form.add(oldPasswordField); PasswordTextField passwordField1 = new PasswordTextField("password"); passwordField1.add(StringValidator.lengthBetween(6, 50));// form.add(passwordField1); PasswordTextField passwordField2 = new PasswordTextField("controlPassword"); passwordField2.setModel(passwordField1.getModel()); passwordField2.setResetPassword(false);// form.add(passwordField2); form.add(new EqualPasswordInputValidator(passwordField1, passwordField2)); WebMarkupContainer passwordWmc = new WebMarkupContainer("passwordWmc") { @Override public boolean isVisible() { if ((!EzdecSession.getCurrentUser().equals(user))  (EzdecSession.getCurrentUser().isAnyAdministratorUser())) { return false; } else { return true; } } }; passwordWmc.add(oldPasswordField); passwordWmc.add(passwordField1); passwordWmc.add(passwordField2);  form.add(passwordWmc);






Re: Password Field Question

2009-09-10 Thread jpalmer1026

Thanks. Worked great!


Pedro Santos-6 wrote:
 
   PasswordTextField passwordField1 = new PasswordTextField(password);
   PasswordTextField passwordField2 = new
 PasswordTextField(controlPassword);
 on these lines you are creating components with null model, and on wicket
 models can be inherited from components higher in the hierarchy. I think
 in
 your case, these components have an parent component with an
 IComponentInheritedModel, probably an CompoundPropertyModel. You can't
 pass
 an new Model() to these PasswordTextField and will not get this
 exception...
 
 
 
 On Thu, Sep 10, 2009 at 1:21 PM, jpalmer1...@mchsi.com wrote:
 
  I have the below snippet of code used to allow the user to change their
 password by typing their old password and then typing in their new
 password
 twice. Not sure why but I'm getting the following exception when the code
 is
 executed:

 WicketMessage: No get method defined for class: class
 org.cityofchicago.dor.ezdec.domain.security.EzdecUser expression:
 controlPassword

 Things were working fine until I moved the password stuff to the
 WebMarkupContainer.

 Any suggestions would be greatly appreciated.

 PasswordTextField oldPasswordField = new PasswordTextField(oldPassword,
 new Model()) {
 @Override
 public void validate() {
 if
 (!MD5Helper.toMD5(getInput()).equals(EzdecSession.getCurrentUser().getPassword()))
 {
 error(new IValidationError() {
 @Override
 public String getErrorMessage(IErrorMessageSource
 arg0) {
 return Old password does not match password
 on
 file. Please ensure caps lock is not on and try again.;
 }
 });
 }
 }
 };
 //form.add(oldPasswordField);

 PasswordTextField passwordField1 = new
 PasswordTextField(password);
 passwordField1.add(StringValidator.lengthBetween(6, 50));
 //form.add(passwordField1);

 PasswordTextField passwordField2 = new
 PasswordTextField(controlPassword);
 passwordField2.setModel(passwordField1.getModel());
 passwordField2.setResetPassword(false);
 //form.add(passwordField2);

 form.add(new EqualPasswordInputValidator(passwordField1,
 passwordField2));

 WebMarkupContainer passwordWmc = new
 WebMarkupContainer(passwordWmc) {

 @Override
 public boolean isVisible() {
 if ((!EzdecSession.getCurrentUser().equals(user)) 
 (EzdecSession.getCurrentUser().isAnyAdministratorUser())) {
 return false;
 } else {
 return true;
 }
 }

 };

 passwordWmc.add(oldPasswordField);
 passwordWmc.add(passwordField1);
 passwordWmc.add(passwordField2);

 form.add(passwordWmc);

 
 

-- 
View this message in context: 
http://www.nabble.com/Password-Field-Question-tp25386498p25387687.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



CheckBoxMultipleChoice Component

2009-09-10 Thread jpalmer1026





Wondering if there is a way in Wicket to conditionally disable a particular element from a list of choices in a CheckboxMultipleChoice component? Anyone know if this is possible?







Setting th

2009-09-04 Thread jpalmer1026





I have a form with a RadioChoice component. I'd like to use the value selected in that component ("yes" or "no") to set the isRequired property of another component. Wondering what method I need to call on the RadioChoice component that will allow me to get the value that the user selected? 







Setting Datasource at Runtime

2009-09-03 Thread jpalmer1026





I'm using Wicket to develop an app and have stumbled upon a roadblock.
I'd like the user to be able to select their desired datasource at
runtime, as opposed to hardcoding the datasource in the persistence.xml
file (we're using Spring and JPA). I feel like this should be
reasonably simple to do, but I haven't been able to come up with a
solution. Does anyone know of a way to do this?







Formatting TextField Value

2009-08-26 Thread jpalmer1026





I'd like convert TextField values to display with 2 decimal places but for some reason they are getting displayed without any decimal places. The model that is being used is returning values such as 0.00, but they are getting displayed like 0 in the TextField. Any ideas?







ListView Validation

2009-08-17 Thread jpalmer1026





I'm trying to display a validation message for an item contained in a list view but the validation message isn't getting displayed. Is there something special that needs to be done to display validation messages for list view items?







Dynamically set isRequired() field on a componentn

2009-07-24 Thread jpalmer1026





I'm trying to dynamically set the isRequired() field for a component, but not sure how to do so. For example, in the following example, I'd like to set the streetAddress component to be required if the pin1 field has data entered for it. My first attempt (which doesn't work since it's binding statically) is as follows:PINTextField pin1 = new PINTextField("pin1", new PropertyModel(propertyUse, "otherPropertyPin1")); pin1.add(StringValidator.maximumLength(20)); commonQuestionsWMC.add(pin1);streetAddress1.add(StringValidator.maximumLength(35)).setRequired(isCommonQuestionsVisible); streetAddress1.setRequired(StringUtils.isNotBlank(pin1.getValue())); commonQuestionsWMC.add(streetAddress1);






Error Message Not Getting Removed

2009-07-20 Thread jpalmer1026





I have a form that's using an AjaxSubmitLink to show / hide a panel. I have overriden the onError() method to add a feedbackPanel to the page to display any error messages that may exist. The problem I'm having is the error messages are remaining on the screen even after the problem is fixed. Any suggestions? My code is as follows:final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") { @Override public void onSubmit(AjaxRequestTarget target, Form form) { Declaration declaration = (Declaration) form.getModelObject(); ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin()); if (pid == null) { form.error("No PIN found for PIN " + declaration.getPin()); } else { InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel("verifyPanel", pid); parent.addOrReplace(decVerifyPanel); parent.setVisible(true); this.setEnabled(false); pinText.setEnabled(false); reenterPinLink.setVisible(true); button.setVisible(true); target.addComponent(this); target.addComponent(parent); target.addComponent(reenterPinLink); target.addComponent(button); target.addComponent(pinText); } } @Override public void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedback); } };






Re: Error Message Not Getting Removed

2009-07-20 Thread jpalmer1026

Whoops. My bad. Thanks!


Mathias Nilsson wrote:
 
 I don't see that you have added the feedback in the onSubmit method
 
 You should do
 
 @Override
 onsubmit(  ){
   target.addComponent( feedback );
 }
 

-- 
View this message in context: 
http://www.nabble.com/Error-Message-Not-Getting-Removed-tp24574168p24574877.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



PageableListView Question

2009-07-15 Thread jpalmer1026





I'm trying to populate a PageableListView based on the value selected from a DropDownChoice, but am not sure how to do this. I feel like I'm pretty close, so I've attached what I've done so far with the hopes that someone might be able to lend a hand. My code is as follows:public class DeclarationsAwaitingRecordingPage extends BaseWebPage { private static final ListCounty COUNTIES = Arrays.asList(County.values()); @SpringBean private IDeclarationService declarationService; public class DeclarationsAwaitingRecordingModel extends LoadableDetachableModel { private County county; public DeclarationsAwaitingRecordingModel(County county) { this.county = county; } @Override protected Object load() { ListNonRecordedDeclarationRecord declarations = declarationService.findDeclarationsAwaitingRecording(county); return declarations; } } public DeclarationsAwaitingRecordingPage() { super(); add(new Label("reportDate", new SimpleDateFormat("MM/dd/yy").format(new Date(; Form form = new Form("form", new DeclarationsAwaitingRecordingModel(County.COOK)) { @Override protected void onSubmit() { } }; PageableListViewDeclaration declarations = new PageableListView( "declarations", declarationService.findDeclarationsAwaitingRecording(County.COOK), 25) { @Override protected void populateItem(ListItem item) { NonRecordedDeclarationRecord record = (NonRecordedDeclarationRecord) item.getModelObject(); item.add(new Label("decNumber", record.getDeclaration().getTxNumber())); item.add(new Label("propTransferDate", new SimpleDateFormat("MM//dd/").format(record.getDeclaration().getPropertyTransferDate().toString(; item.add(new Label("daysPastDue", record.getDaysPastDue() == null ? "" : record.getDaysPastDue().toString())); Stamp stamp = record.getStamp(); String stampAuthorizer = null; String stampNumber = null; if (stamp != null) { stampAuthorizer = stamp.getStampPurchaser().getAccount().getName(); stampNumber = stamp.getFraudDetectionNumber(); } item.add(new Label("stampAuthorizer", stampAuthorizer == null ? "" : stampAuthorizer)); item.add(new Label("stampNumber", stampNumber == null ? "" : stampNumber)); item.add(new CurrencyLabel("countyAmount", record.getCountyAmount())); item.add(new CurrencyLabel("stateAmount", record.getStateAmount())); } }; add(form); form.add(new DropDownChoice("counties", COUNTIES)); form.add(new PagingNavigator("navigator", declarations)); form.add(declarations); }}






Re: Converter Problem

2009-07-08 Thread jpalmer1026

The DateTime I was referring to is in the
org.apache.wicket.datetime.DateConverter class, so I have no way of
modifying it. Any other ideas?


Stijn Maller wrote:
 
 Looking at your datepattern you should be using LocalDate instead of
 DateTime, as you don't have a time or a timezone anyway. IMVHO this should
 solve all your problems.
 

-- 
View this message in context: 
http://www.nabble.com/Converter-Problem-tp24378227p24392990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Converter Problem

2009-07-08 Thread jpalmer1026

The DateTime I was referring to is in the
org.apache.wicket.datetime.DateConverter class, so I have no way of
modifying it. Any other ideas?


Stijn Maller wrote:
 
 Looking at your datepattern you should be using LocalDate instead of
 DateTime, as you don't have a time or a timezone anyway. IMVHO this should
 solve all your problems.
 

-- 
View this message in context: 
http://www.nabble.com/Converter-Problem-tp24378227p24392993.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Converter Problem

2009-07-08 Thread jpalmer1026

For what it's worth, I added the following Calendar code to the end of the
method, which fixed the problem, but I'm thinking there has to be a better
way to handle this.

public Date convertToObject(String value, Locale locale) {
final Pattern pattern = Pattern.compile(REGEX_PATTERN);
if (StringUtils.isNotBlank(value) 
!pattern.matcher(value).matches()) {
throw new ConversionException(Invalid date format);
}
Date d = super.convertToObject(value, locale);
Calendar c = Calendar.getInstance();
c.setTime(d);
c.add(Calendar.HOUR, 8);
c.set(Calendar.HOUR, 0);
return c.getTime();
}


jpalmer1026 wrote:
 
 
 The DateTime I was referring to is in the
 org.apache.wicket.datetime.DateConverter class, so I have no way of
 modifying it. Any other ideas?
 
 
 Stijn Maller wrote:
 
 Looking at your datepattern you should be using LocalDate instead of
 DateTime, as you don't have a time or a timezone anyway. IMVHO this
 should
 solve all your problems.
 
 
 -- 
 View this message in context:
 http://www.nabble.com/Converter-Problem-tp24378227p24392993.html
 Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Converter-Problem-tp24378227p24399351.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Converter Problem

2009-07-07 Thread jpalmer1026





I am having issues with a custom component that I created. The component's function is to ensure that the date entered adheres to the format "^(\\d{2})/(\\d{2})/(\\d{4})$" The problem, though, is when the form that contains the component is submitted, the date is converted to the previous day's date. For example, if a date of 07/07/2009 is entered, the value that gets submitted is 07/06/2009 at 19:00 CDT. My code (2 classes) is as follows:public class CustomDateTextField extends TextField { public CustomDateTextField(String id, IModel model, Class type) { super(id, model, type); add(new EzdecDatePicker()); } public CustomDateTextField(String id, IModel model) { super(id, model); add(new EzdecDatePicker()); } public CustomDateTextField(String id, Class type) { super(id, type); add(new EzdecDatePicker()); } public CustomDateTextField(String id) { super(id); add(new EzdecDatePicker()); } @Override public IConverter getConverter(Class? type) { return new StrictPatternDateConverter(); }}public class StrictPatternDateConverter extends PatternDateConverter { public static final String REGEX_PATTERN = "^(\\d{2})/(\\d{2})/(\\d{4})$"; public StrictPatternDateConverter() { super("MM/dd/", false); } @Override public Date convertToObject(String value, Locale locale) { final Pattern pattern = Pattern.compile(REGEX_PATTERN); if (StringUtils.isNotBlank(value)  !pattern.matcher(value).matches()) { throw new ConversionException("Invalid date format"); } return super.convertToObject(value, locale); }}






Re: Converter Problem

2009-07-07 Thread jpalmer1026

I was thinking the same thing but, as you pointed out, I explicitly set it to
false, so I'm not sure why it's behaving this way. I tried setting it to
true just as an experiment but the results were the same. Has anyone else
seen this?


Stefan Malmesjö wrote:
 
 Could this have anything to do with applyTimeZoneDifference in 
 PatterDateConverter? It looks like you set it to false, so it shouldn't, 
 but still... it fits the description pretty well...
 /Stefan
 
 On 2009-07-07 19:44, jpalmer1...@mchsi.com wrote:
 I am having issues with a custom component that I created. The 
 component's function is to ensure that the date entered adheres to the 
 format ^(\\d{2})/(\\d{2})/(\\d{4})$ The problem, though, is when the 
 form that contains the component is submitted, the date is converted 
 to the previous day's date. For example, if a date of 07/07/2009 is 
 entered, the value that gets submitted is 07/06/2009 at 19:00 CDT. My 
 code (2 classes) is as follows:

 public class CustomDateTextField extends TextField {

 public CustomDateTextField(String id, IModel model, Class type) {
 super(id, model, type);
 add(new EzdecDatePicker());
 }

 public CustomDateTextField(String id, IModel model) {
 super(id, model);
 add(new EzdecDatePicker());
 }

 public CustomDateTextField(String id, Class type) {
 super(id, type);
 add(new EzdecDatePicker());
 }

 public CustomDateTextField(String id) {
 super(id);
 add(new EzdecDatePicker());
 }

 @Override
 public IConverter getConverter(Class? type) {
 return new StrictPatternDateConverter();
 }
 }

 public class StrictPatternDateConverter extends PatternDateConverter {

 public static final String REGEX_PATTERN =
 ^(\\d{2})/(\\d{2})/(\\d{4})$;

 public StrictPatternDateConverter() {
 super(MM/dd/, false);
 }

 @Override
 public Date convertToObject(String value, Locale locale) {
 final Pattern pattern = Pattern.compile(REGEX_PATTERN);
 if (StringUtils.isNotBlank(value)  
 !pattern.matcher(value).matches()) {
 throw new ConversionException(Invalid date format);
 }
 return super.convertToObject(value, locale);
 }
 }
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Converter-Problem-tp24378227p24378982.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Converter Problem

2009-07-07 Thread jpalmer1026

I did a little bit of digging and it appears that the problem is in the
convertToObject() in the org.apache.wicket.datetime.DateConverter class.
Specifically, the return date.ToDate() line in the following code:

if (applyTimeZoneDifference)
{
TimeZone zone = getClientTimeZone();
...
}
else
{
try
{
DateTime date = format.parseDateTime(value);
return date.toDate();
}
}


jpalmer1026 wrote:
 
 I was thinking the same thing but, as you pointed out, I explicitly set it
 to false, so I'm not sure why it's behaving this way. I tried setting it
 to true just as an experiment but the results were the same. Has anyone
 else seen this?
 
 
 Stefan Malmesjö wrote:
 
 Could this have anything to do with applyTimeZoneDifference in 
 PatterDateConverter? It looks like you set it to false, so it shouldn't, 
 but still... it fits the description pretty well...
 /Stefan
 
 On 2009-07-07 19:44, jpalmer1...@mchsi.com wrote:
 I am having issues with a custom component that I created. The 
 component's function is to ensure that the date entered adheres to the 
 format ^(\\d{2})/(\\d{2})/(\\d{4})$ The problem, though, is when the 
 form that contains the component is submitted, the date is converted 
 to the previous day's date. For example, if a date of 07/07/2009 is 
 entered, the value that gets submitted is 07/06/2009 at 19:00 CDT. My 
 code (2 classes) is as follows:

 public class CustomDateTextField extends TextField {

 public CustomDateTextField(String id, IModel model, Class type) {
 super(id, model, type);
 add(new EzdecDatePicker());
 }

 public CustomDateTextField(String id, IModel model) {
 super(id, model);
 add(new EzdecDatePicker());
 }

 public CustomDateTextField(String id, Class type) {
 super(id, type);
 add(new EzdecDatePicker());
 }

 public CustomDateTextField(String id) {
 super(id);
 add(new EzdecDatePicker());
 }

 @Override
 public IConverter getConverter(Class? type) {
 return new StrictPatternDateConverter();
 }
 }

 public class StrictPatternDateConverter extends PatternDateConverter {

 public static final String REGEX_PATTERN =
 ^(\\d{2})/(\\d{2})/(\\d{4})$;

 public StrictPatternDateConverter() {
 super(MM/dd/, false);
 }

 @Override
 public Date convertToObject(String value, Locale locale) {
 final Pattern pattern = Pattern.compile(REGEX_PATTERN);
 if (StringUtils.isNotBlank(value)  
 !pattern.matcher(value).matches()) {
 throw new ConversionException(Invalid date format);
 }
 return super.convertToObject(value, locale);
 }
 }
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Converter-Problem-tp24378227p24381041.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Model Question

2009-07-06 Thread jpalmer1026





I have the following code to allow the user to select the date that a report is to be generated for. For some reason, though, whatever date is selected from the textfield, the previous date is being used. For example, if the user inputs 07/06/2009 into the dateTextField, 07/05/2009 is being used. I'm assuming this is because I'm using the wrong model, so any assistance would be greatly appreciated.public class AccountingDashboardPage extends EzdecBaseWebPage { private Date date; public AccountingDashboardPage(Date date) { if (date == null) { this.date = new Date(); } Form form = new Form("accountingDashboardForm", new PropertyModel(this, "date")) { @Override protected void onSubmit() { Date d = (Date)getModelObject(); setResponsePage(new AccountingDashboardPage(d)); } }; add(form);  EzdecDateTextField reportDate = new EzdecDateTextField("stampDate", form.getModel()); reportDate.setModelValue(new String[]{new SimpleDateFormat("MM/dd/").format(date).toString()}); form.add(reportDate);   }}






Hibernate LazyInitializationException

2009-06-25 Thread jpalmer1026





I am getting an "org.hibernate.LazyInitializationException - could not initialize proxy - no Session" exception when I try to load an object stored in session. I understand but I am not certain about how to fix it with Wicket. In reviewing the Wicket In Action book, it looks like the way to handle this is to use a LoadableDetachableModel, which I tried. The model is as follows:public class DetachableUserModel extends LoadableDetachableModelEzdecUser { @SpringBean private ISecurityService securityService;  private final String email; public DetachableUserModel(EzdecUser u) { this(u.getEmail()); } public DetachableUserModel(String email) { if (email == null) { throw new IllegalArgumentException(); } this.email = email; System.out.println("email is " + email); InjectorHolder.getInjector().inject(this); } @Override public int hashCode() { return email.hashCode(); } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } else if (obj == null) { return false; } else if (obj instanceof DetachableUserModel) { DetachableUserModel other = (DetachableUserModel) obj; return email.equals(other.email); } return false; } @Override protected EzdecUser load() { EzdecUser u = securityService.findUserByEmail(email); return u; }}The relevant section of the code where I am using the model is as follows:public UpdateUserProfilePage() { this(EzdecSession.getCurrentUser()); } public UpdateUserProfilePage(EzdecUser user) { this(new DetachableUserModel(user)); } private UpdateUserProfilePage(DetachableUserModel userModel) { this.user = (EzdecUser)userModel.getObject(); setup(); }Anyone have any suggestions on how I can fix this?






Re: Hibernate LazyInitializationException

2009-06-25 Thread jpalmer1026

How do you recommend holding the model in the page? In other words, what is
the alternative code to  this.user = (EzdecUser)userModel.getObject();?


Martin Sachs wrote:
 
 hi
 
 you used   this.user = (EzdecUser)userModel.getObject(); This would
 hold in page and not initialized on next request.
 You have to hold the model in the page.
 
 We have also found an alternative way. You can write a simple Aspect
 with AspectJ to reinit all proxies. This can easily done with
 hibernateSession.lock(NONE).
 Create pointcuts to each getter which is returning a proxy and init the
 proxies.
 
 Martin
 
 
 
 
 jpalmer1...@mchsi.com schrieb:
 I am getting an org.hibernate.LazyInitializationException - could not
 initialize proxy - no Session exception when I try to load an object
 stored in session. I understand but I am not certain about how to fix
 it with Wicket. In reviewing the Wicket In Action book, it looks like
 the way to handle this is to use a LoadableDetachableModel, which I
 tried. The model is as follows:

 public class DetachableUserModel extends
 LoadableDetachableModelEzdecUser {

 @SpringBean
 private ISecurityService securityService;

 private final String email;

 public DetachableUserModel(EzdecUser u) {
 this(u.getEmail());
 }

 public DetachableUserModel(String email) {
 if (email == null) {
 throw new IllegalArgumentException();
 }
 this.email = email;
 System.out.println(email is  + email);
 InjectorHolder.getInjector().inject(this);
 }

 @Override
 public int hashCode() {
 return email.hashCode();
 }

 @Override
 public boolean equals(final Object obj) {
 if (obj == this) {
 return true;
 } else if (obj == null) {
 return false;
 } else if (obj instanceof DetachableUserModel) {
 DetachableUserModel other = (DetachableUserModel) obj;
 return email.equals(other.email);
 }
 return false;
 }

 @Override
 protected EzdecUser load() {
 EzdecUser u = securityService.findUserByEmail(email);
 return u;
 }

 }

 The relevant section of the code where I am using the model is as
 follows:

  public UpdateUserProfilePage() {
 this(EzdecSession.getCurrentUser());
 }

 public UpdateUserProfilePage(EzdecUser user) {
 this(new DetachableUserModel(user));
 }

 private UpdateUserProfilePage(DetachableUserModel userModel) {
 this.user = (EzdecUser)userModel.getObject();
 setup();
 }

 Anyone have any suggestions on how I can fix this?

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

-- 
View this message in context: 
http://www.nabble.com/Hibernate-LazyInitializationException-tp24204249p24204789.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



AjaxSubmitLink

2009-06-19 Thread jpalmer1026





I am trying to use an AjaxSubmitLink to show a panel when a button is clicked. I am receiving the following error when I try to submit the form:Wicket.Ajax.Call.processComponent: Component with id [[verifyPanelWmc9]] a was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update.My code is as follows:public class InitiateDeclarationPage extends EzdecBaseWebPage { @SpringBean private IDeclarationService declarationService; public InitiateDeclarationPage() { final Declaration declaration = new Declaration(EzdecSession.getCurrentUser().getAccount(), EzdecSession.getCurrentUser(), "", County.COOK, State.ILLINOIS); add(new FeedbackPanel("feedback")); final Form form = new Form("initiateDeclarationForm", new CompoundPropertyModelDeclaration(declaration));  form.add(new Button("submitButton") { @Override public void onSubmit() { Declaration declaration = (Declaration) form.getModelObject(); declaration.setStatus(Status.OPEN); ParcelIdentification pin = declarationService.findParcelIdentification(declaration.getPin()); if (pin == null) { error("No PIN found for PIN " + getFormattedPIN(declaration.getPin())); } else { if (declarationService.initiateDeclaration(declaration)) { EzdecSession.get().info("Declaration " + declaration.getTxNumber() + " created"); setResponsePage(new DeclarationPage(declaration, 0, pin)); } else { error("Creating declaration with PIN: " + declaration.getPin()); } } } }); final EzdecRequiredTextField pinText = new EzdecRequiredTextField("pin"); form.add(pinText);  form.add(new DropDownChoice("county", Arrays.asList(County.values())) .setRequired(true) .setEnabled(false)); final WebMarkupContainer parent = new WebMarkupContainer("verifyPanelWmc");// parent.setOutputMarkupId(true); parent.setVisible(false); form.add(parent); AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") { @Override public void onSubmit(AjaxRequestTarget target, Form form) { Declaration declaration = (Declaration) form.getModelObject(); ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin()); if (pid == null) { error("No PIN found for PIN " + declaration.getPin()); } else {// parent.setOutputMarkupId(true); InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel("verifyPanel", pid); decVerifyPanel.setOutputMarkupId(true); decVerifyPanel.setVisible(true); parent.add(decVerifyPanel); parent.setVisible(true); target.addComponent(decVerifyPanel);// target.addComponent(parent); } } }; form.add(verifyPinLink); add(form); }}Anyone know how I can get around this?






Feedback Messages Not Getting Displayed When Using AjaxSubmitLink

2009-06-19 Thread jpalmer1026





I am using an AjaxSubmitLink to submit form data. Using this, however, is preventing feedback messages from being displayed. My code is as follows:public class InitiateDeclarationPage extends EzdecBaseWebPage { @SpringBean private IDeclarationService declarationService; AjaxFallbackLink reenterPinLink; public InitiateDeclarationPage() { final Declaration declaration = new Declaration(EzdecSession.getCurrentUser().getAccount(), EzdecSession.getCurrentUser(), "", County.COOK, State.ILLINOIS);// final FeedbackPanel feedback = new FeedbackPanel("feedback");// feedback.setOutputMarkupId(true);// add(feedback); add(new FeedbackPanel("feedback")); final Form form = new Form("initiateDeclarationForm", new CompoundPropertyModelDeclaration(declaration));  form.add(new Button("submitButton") { @Override public void onSubmit() { Declaration declaration = (Declaration) form.getModelObject(); declaration.setStatus(Status.OPEN); ParcelIdentification pin = declarationService.findParcelIdentification(declaration.getPin()); if (pin == null) { error("No PIN found for PIN " + getFormattedPIN(declaration.getPin())); } else { if (declarationService.initiateDeclaration(declaration)) { EzdecSession.get().info("Declaration " + declaration.getTxNumber() + " created"); setResponsePage(new DeclarationPage(declaration, 0, pin)); } else { error("Creating declaration with PIN: " + declaration.getPin()); } } } }); final PINTextField pinText = new PINTextField("pin"); pinText.setRequired(true); pinText.setOutputMarkupId(true); form.add(pinText);  form.add(new DropDownChoice("county", Arrays.asList(County.values())) .setRequired(true) .setEnabled(false)); final WebMarkupContainer parent = new WebMarkupContainer("verifyPanelWmc"); parent.setOutputMarkupPlaceholderTag(true); parent.setVisible(false); form.add(parent); final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") { @Override public void onSubmit(AjaxRequestTarget target, Form form) { Declaration declaration = (Declaration) form.getModelObject(); ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin()); if (pid == null) { error("No PIN found for PIN " + declaration.getPin()); } else { InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel("verifyPanel", pid); parent.addOrReplace(decVerifyPanel); parent.setVisible(true); this.setEnabled(false); reenterPinLink.setVisible(true); target.addComponent(this); target.addComponent(parent); target.addComponent(reenterPinLink); } } }; form.add(verifyPinLink); reenterPinLink = new AjaxFallbackLink("reenterPinLink") { @Override public void onClick(AjaxRequestTarget target) { this.setOutputMarkupPlaceholderTag(true); parent.setVisible(false); verifyPinLink.setEnabled(true); target.addComponent(parent); target.addComponent(verifyPinLink); target.addComponent(pinText); target.focusComponent(pinText); this.setVisible(false); target.addComponent(this); } }; form.add(reenterPinLink); add(form); }}Does anyone know how to fix this?






Re: Feedback Messages Not Getting Displayed When Using AjaxSubmitLink

2009-06-19 Thread jpalmer1026

I called target.addComponent for the feedbackpanel but still no luck. My
updated code is as follows:

 final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink(verifyPinLink) {
@Override
public void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
onError(target, form);

Declaration declaration = (Declaration)
form.getModelObject();
ParcelIdentification pid =
declarationService.findParcelIdentification(declaration.getPin());
if (pid == null) {
error(No PIN found for PIN  + declaration.getPin());
} else {
InitiateDeclarationVerifyPanel decVerifyPanel = new
InitiateDeclarationVerifyPanel(verifyPanel, pid);
parent.addOrReplace(decVerifyPanel);
parent.setVisible(true);
this.setEnabled(false);
reenterPinLink.setVisible(true);
target.addComponent(this);
target.addComponent(parent);
target.addComponent(reenterPinLink);
}
}
};

Erik van Oosten wrote:
 
 You did not call target.addComponent for the feedbackpanel or any of its 
 parents.
 
 Regards,
 Erik.
 
 
 jpalmer1...@mchsi.com schreef:
 I am using an AjaxSubmitLink to submit form data. Using this, however, 
 is preventing feedback messages from being displayed.

 My code is as follows:

 public class InitiateDeclarationPage extends EzdecBaseWebPage {
 @SpringBean
 private IDeclarationService declarationService;

 AjaxFallbackLink reenterPinLink;

 public InitiateDeclarationPage() {
 final Declaration declaration = new 
 Declaration(EzdecSession.getCurrentUser().getAccount(),
 EzdecSession.getCurrentUser(), , County.COOK, 
 State.ILLINOIS);
 //final FeedbackPanel feedback = new FeedbackPanel(feedback);
 //feedback.setOutputMarkupId(true);
 //add(feedback);
 add(new FeedbackPanel(feedback));

 final Form form = new Form(initiateDeclarationForm, new 
 CompoundPropertyModelDeclaration(declaration));

 form.add(new Button(submitButton) {
 @Override
 public void onSubmit() {
 Declaration declaration = (Declaration) 
 form.getModelObject();
 declaration.setStatus(Status.OPEN);
 ParcelIdentification pin = 
 declarationService.findParcelIdentification(declaration.getPin());
 if (pin == null) {
 error(No PIN found for PIN  + 
 getFormattedPIN(declaration.getPin()));
 } else {
 if 
 (declarationService.initiateDeclaration(declaration)) {
 EzdecSession.get().info(Declaration  + 
 declaration.getTxNumber() +  created);
 setResponsePage(new 
 DeclarationPage(declaration, 0, pin));
 } else {
 error(Creating declaration with PIN:  + 
 declaration.getPin());
 }
 }
 }
 });

 final PINTextField pinText = new PINTextField(pin);
 pinText.setRequired(true);
 pinText.setOutputMarkupId(true);
 form.add(pinText);

 form.add(new DropDownChoice(county, 
 Arrays.asList(County.values()))
  .setRequired(true)
  .setEnabled(false));

 final WebMarkupContainer parent = new 
 WebMarkupContainer(verifyPanelWmc);
 parent.setOutputMarkupPlaceholderTag(true);
 parent.setVisible(false);
 form.add(parent);

 final AjaxSubmitLink verifyPinLink = new 
 AjaxSubmitLink(verifyPinLink) {
 @Override
 public void onSubmit(AjaxRequestTarget target, Form form) {
 Declaration declaration = (Declaration) 
 form.getModelObject();
 ParcelIdentification pid = 
 declarationService.findParcelIdentification(declaration.getPin());
 if (pid == null) {
 error(No PIN found for PIN  +
 declaration.getPin());
 } else {
 InitiateDeclarationVerifyPanel decVerifyPanel = 
 new InitiateDeclarationVerifyPanel(verifyPanel, pid);
 parent.addOrReplace(decVerifyPanel);
 parent.setVisible(true);
 this.setEnabled(false);
 reenterPinLink.setVisible(true);
 target.addComponent(this);
 target.addComponent(parent);
 target.addComponent(reenterPinLink);
 }
 }
 };

 form.add(verifyPinLink);

 reenterPinLink = new AjaxFallbackLink(reenterPinLink) {
 @Override
 public void onClick(AjaxRequestTarget target) {
 

Re: Feedback Messages Not Getting Displayed When Using AjaxSubmitLink

2009-06-19 Thread jpalmer1026

Actually, validation messages are now getting displayed for validation
performed on components but I am still unable to get error messages that I
have added to be displayed. For example, in the following code, I need a way
to display the line No PIN found for PIN but I am not sure how to do that.
Any ideas?

final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink(verifyPinLink) {
@Override
public void onSubmit(AjaxRequestTarget target, Form form) {
//target.addComponent(feedback);
//onError(target, form);

Declaration declaration = (Declaration)
form.getModelObject();
ParcelIdentification pid =
declarationService.findParcelIdentification(declaration.getPin());
if (pid == null) {
error(No PIN found for PIN  + declaration.getPin());
} else {
InitiateDeclarationVerifyPanel decVerifyPanel = new
InitiateDeclarationVerifyPanel(verifyPanel, pid);
parent.addOrReplace(decVerifyPanel);
parent.setVisible(true);
this.setEnabled(false);
reenterPinLink.setVisible(true);
target.addComponent(this);
target.addComponent(parent);
target.addComponent(reenterPinLink);
}
}

@Override
public void onError(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
}
};


jpalmer1026 wrote:
 
 I called target.addComponent for the feedbackpanel but still no luck. My
 updated code is as follows:
 
  final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink(verifyPinLink)
 {
 @Override
 public void onSubmit(AjaxRequestTarget target, Form form) {
 target.addComponent(feedback);
 onError(target, form);
 
 Declaration declaration = (Declaration)
 form.getModelObject();
 ParcelIdentification pid =
 declarationService.findParcelIdentification(declaration.getPin());
 if (pid == null) {
 error(No PIN found for PIN  + declaration.getPin());
 } else {
 InitiateDeclarationVerifyPanel decVerifyPanel = new
 InitiateDeclarationVerifyPanel(verifyPanel, pid);
 parent.addOrReplace(decVerifyPanel);
 parent.setVisible(true);
 this.setEnabled(false);
 reenterPinLink.setVisible(true);
 target.addComponent(this);
 target.addComponent(parent);
 target.addComponent(reenterPinLink);
 }
 }
 };
 
 Erik van Oosten wrote:
 
 You did not call target.addComponent for the feedbackpanel or any of its 
 parents.
 
 Regards,
 Erik.
 
 
 jpalmer1...@mchsi.com schreef:
 I am using an AjaxSubmitLink to submit form data. Using this, however, 
 is preventing feedback messages from being displayed.

 My code is as follows:

 public class InitiateDeclarationPage extends EzdecBaseWebPage {
 @SpringBean
 private IDeclarationService declarationService;

 AjaxFallbackLink reenterPinLink;

 public InitiateDeclarationPage() {
 final Declaration declaration = new 
 Declaration(EzdecSession.getCurrentUser().getAccount(),
 EzdecSession.getCurrentUser(), , County.COOK, 
 State.ILLINOIS);
 //final FeedbackPanel feedback = new FeedbackPanel(feedback);
 //feedback.setOutputMarkupId(true);
 //add(feedback);
 add(new FeedbackPanel(feedback));

 final Form form = new Form(initiateDeclarationForm, new 
 CompoundPropertyModelDeclaration(declaration));

 form.add(new Button(submitButton) {
 @Override
 public void onSubmit() {
 Declaration declaration = (Declaration) 
 form.getModelObject();
 declaration.setStatus(Status.OPEN);
 ParcelIdentification pin = 
 declarationService.findParcelIdentification(declaration.getPin());
 if (pin == null) {
 error(No PIN found for PIN  + 
 getFormattedPIN(declaration.getPin()));
 } else {
 if 
 (declarationService.initiateDeclaration(declaration)) {
 EzdecSession.get().info(Declaration  + 
 declaration.getTxNumber() +  created);
 setResponsePage(new 
 DeclarationPage(declaration, 0, pin));
 } else {
 error(Creating declaration with PIN:  + 
 declaration.getPin());
 }
 }
 }
 });

 final PINTextField pinText = new PINTextField(pin);
 pinText.setRequired(true);
 pinText.setOutputMarkupId(true);
 form.add(pinText