Re: Why aren't setEnabled and setVisible model based?

2021-05-11 Thread Andrew Geery
You can use a behavior to set whether a component is visible or enabled
based on a model.

The wicketstuff-minis project has two behaviors that do just this:

https://javadoc.io/doc/org.wicketstuff/wicketstuff-minis/latest/org/wicketstuff/minis/behavior/EnabledModelBehavior.html
https://javadoc.io/doc/org.wicketstuff/wicketstuff-minis/latest/org/wicketstuff/minis/behavior/VisibleModelBehavior.html

The behaviors both take a boolean model in their constructor.

In the Behavior#onConfigure method, they use the model value to set whether
the component is enabled or visible.

Thanks
Andrew

On Tue, May 11, 2021 at 3:34 AM Martijn Dashorst 
wrote:

> The primary reason for not using IModel's as control mechanisms for
> visibility and enabling of components is memory usage. Wicket applications
> can have millions of Component instances at any given time in runtime
> memory, and adding 2 references plus the overhead of the IModel objects
> would be quite heavy.
>
> This is also why we didn't opt for lambda's as a basic construct when we
> migrated Wicket to Java 8.
>
> Martijn
>
>
> On Mon, May 10, 2021 at 4:29 PM  wrote:
>
> > So I finally took the plunge and joined the mailing list.
> >
> > I have been using Wicket for well over a year now and am very happy to
> > have stumbled across it. There's just one question that I never really
> > found an answer to. I have searched the users list a couple of times and
> > found that some people are trying to use the 'setVisible' and
> > 'setEnabled' methods with a Model-argument. They want do this in order
> > to dynamically change visibility or access to a component. This idea has
> > also crossed my mind a couple of times.
> >
> > The thing is... Wicket doesn't appear to work that way.
> >
> > When I look at the answers, I see two approaches. One is overriding
> > 'isVisible', the other is to configure visibility from the 'onConfigure'
> > method in the parent component. I tend to use the later.
> >
> > Because I always like to understand how things work, I would like to ask
> > about the reasoning behind this. Why can't 'setVisible' and 'setEnabled'
> > be controlled using IModel arguments? Is there a technical
> > limitation here? Or is it just a quirk?
> >
> > Thanks.
> >
> > Stan
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>


Re: [8.0] TextField with LambdaModel forced to use String

2018-06-16 Thread Andrew Geery
You have to use the TextField constructor that specifies the type of the
model:
https://ci.apache.org/projects/wicket/apidocs/8.x/org/apache/wicket/markup/html/form/TextField.html#TextField-java.lang.String-org.apache.wicket.model.IModel-java.lang.Class-

It should be:

 add(new TextField<>("year", LambdaModel.of(obj::getYear, obj::setYear),
Integer.class));

That one always gets me too...

Thanks
Andrew

On Sat, Jun 16, 2018 at 3:30 AM smallufo  wrote:

> After upgrading to 8.0 , I tried the exciting LambdaModel , try to replace
> the non-TypeSafety PropertyModel
> But I found it cannot handle type intelligently.
> For a TextField , for example :
>
> form.add(new TextField("year", LambdaModel.of(obj::getYear,
> obj::setYear )));
>
> At runtime , it reports Cannot cast from String to Integer.
>
> I have to rewrite getter / setter to String type (and do conversion  in
> setter ) , but the backing field is Integer type. (And change
> TextField to TextField , or <> )
>
> This is pity ...
> Did I miss anything ?
>
> Thanks.
>


Re: Force Model to use getter

2017-12-01 Thread Andrew Geery
How about using an IConverter since the issue is not about the data itself
but the representation of it?

For example, you could create a Label class that overrides the
getConverter() and return a BigDecimalConverter object that overrides
the getNumberFormat method to return something like
DecimalFormat.getCurrencyInstance().

Andrew


On Fri, Dec 1, 2017 at 3:39 PM, sorinev  wrote:

> I added a setter for each property, but it's still not working (tried
> matching field types as well). I guess I'll just have to stick with the
> IModel route, even though I don't like it.
>
> I changed the Doubles to BigDecimal, thanks for the reminder.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Component disabled if it contains data

2016-04-20 Thread Andrew Geery
It sounds like that, in addition to the behavior, you also need a wicket
validator.

Since the validation condition involves two fields, you'll need to
implement an IFormValidator and add it to the containing form [1].

The #getDependentComponents() method should return the two textfields.

In the #validate(Form) method, you'll want to get the converted input from
the two components and check that they're both null/empty or both not
null/not empty [2].  The reason you need to use the converted input on the
form component, not the model, is that Wicket doesn't update the backing
model until the form is valid.

Andrew

[1]
https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/markup/html/form/validation/IFormValidator.html
[2]
https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/markup/html/form/FormComponent.html#getConvertedInput()

On Wed, Apr 20, 2016 at 4:09 AM, Iamuser  wrote:

> Hello,
>
> Thank you all for the help.
>
> Is there a way to only rerender the two components (inputtext fields) and
> not all the page?
>
> So submit should remain like this:
>
> @Override
> protected void onSubmit() {
> //other stuff
> }
>
> The logic is that I should be able to commit changes only if both input
> textfields are filled with data, or if both are empty. If both have data,
> then components should become disabled, if both are empty, then the
> components should remain editable, if only one of them has data then I
> should not be let to submit any change.
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313p4674321.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
>
>


Re: Component disabled if it contains data

2016-04-20 Thread Andrew Geery
Yes, you can do that: simply change the components that you are adding to
the AjaxRequestTarget object to be the form components rather than the
entire form.

You'll need to use something like an AjaxButton so you have access to the
AjaxRequestTarget:

FormComponent c1 = ...
FormComponent c2 = ...
...
new AjaxButton(...) {

  public void onSubmit(AjaxRequestTarget target, Form form) {
 target.add(c1, c2);
  }

}

On Wed, Apr 20, 2016 at 3:21 AM, Iamuser  wrote:

> Hello,
>
> Thank you all for the help.
>
> Is there a way to only rerender the two components (inputtext fields) and
> not all the page?
>
> So submit should remain like this:
>
> @Override
> protected void onSubmit() {
> //other stuff
> }
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313p4674320.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
>
>


Re: Component disabled if it contains data

2016-04-19 Thread Andrew Geery
1. Create a Wicket Behavior that encapsulates your requirement.  Maybe
something like this:

public class DisableWhenFilledBehavior extends Behavior {

@Override
public void onConfigure(Component component) {
component.setEnabled(component.getDefaultModel() == null);
}

}

2. Add the behavior to all of the components in your form.  Something like
this:

Component myComp = new TextField<>("project", new
PropertyModel(getModelObject(),
"project")).add(new DisableWhenFilledBehavior ());

3. After you handle the submission (e.g., persist the values to the db),
ask Wicket to re-render your form (or panel or page).  When Wicket
re-renders the form, it will re-execute
the DisableWhenFilledBehavior#onConfigure method against every component
that the behavior has been added to and, thus, recompute whether each
component is enabled or disabled.

form = new Form<>(...);
...
new AjaxButton(...) {

  public void onSubmit(AjaxRequestTarget target, Form form) {
 // handle the values
 target.add(form);
  }

}

The other nice thing is that if the component is marked as disabled on the
server and the client, for whatever reason, submits a value, Wicket will
ignore it.  The framework is taking care of that for you; you don't need to
worry about it.

Thanks
Andrew

On Tue, Apr 19, 2016 at 1:28 PM, sub es  wrote:

> In my opinion one should always validate inputs coming from a submit even
> if the inputs were disabled. Using tools like firebug, one can easily
> change values of disabled inputs and submit those changed values. Atleast I
> don't know about wicket not submitting disabled inputs, though I would not
> expect that behavior and would not rely on it.
>
> Best regards,
> Edwin
>
>   Ursprüngliche Nachricht
> Von:superbiss...@gmail.com
> Gesendet:19. April 2016 7:18 nachm.
> An:users@wicket.apache.org
> Antworten:users@wicket.apache.org
> Betreff:Component disabled if it contains data
>
> Hello,
> I'm using Wicket 6, with Java 1.7.
> I'm new to Wicket and I would like to know what is the best way to
> implement
> the following:
> -I have a webpage with several input fields bound to a db table, and a
> submit button.
> - two of the fields can be empty when submitting the changes to the db.
> - however, if the fields are filled once, after submitting the page, the
> user should not be allowed anymore to change the values(even if leaves and
> reenters the page for the same registrations)
>
> Could you please tell me what is the best way to achieve this?
>
> What I have done so far is:
> - on the page load, when the wicket components are added to the page, I
> check if the db fields have values, and if they do, then I set the
> components to disabled:
>
> Component myComp = new TextField("project", new
> PropertyModel(getModelObject(), "project"));
> if (getModelObject().getProject() != null)
> myComp.setEnabled(false);
> dtForm.add(myComp ).add(RangeValidator.range(0, 9));
>
> - also on submit, I check if I have a value in my component and if yes, set
> the component to disable:
> if (getModelObject().getProject() != null ){
>  Component myComp  = get("project");
>  if (myComp.isEnabled()){
> myComp.setEnabled(false);
> dtForm.replace(tf);
>  }
> }
>
> what bothers me is that I need to do all the validation again in the submit
> button, every time the submit will be pressed.
>
> Is there a better way?
>
> Thank you
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313.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
>
>


Re: Wicket & Spring Boot

2015-11-13 Thread Andrew Geery
Hi Marc

That's cool!

I made a Wicket + Spring Boot "Getting Started"-style guide a couple of
months ago: https://github.com/ageery/getting-started-guides/tree/wicket.
The code is on the wicket branch in the complete directory.

It's a filterable data table with ajax CRUD functionality, built on Spring
Boot, Spring Data JPA, Wicket 7, Java 8 and Wicket Bootstrap.

It was inspired by the Vaadin + Spring Boot CRUD example:
https://spring.io/guides/gs/crud-with-vaadin/

Andrew


On Thu, Nov 12, 2015 at 5:20 PM, Martin Grigorov 
wrote:

> Hi Marc,
>
> Welcome to the mailing list and thank you for sharing your project with us!
> I have seen some Wicket+SpringBoot apps both in Wicket and Wicket-Bootstrap
> issue trackers but as far as I can see your project doesn't just use SB but
> actually integrates with it.
> I'll keep an eye on it!
>
> P.S. I guess you know that web.de mail client is based on Wicket too ? :-)
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Nov 12, 2015 at 10:56 PM, Marc  wrote:
>
> > Hi all,
> > it's my first post, so I'm hopefully subscribed to the mailing list.
> >
> > Is there currently any Spring Boot integration support?
> >
> > I've started with a Spring Boot Wicket integration:  wicket-spring-boot
> >   .
> >
> > Besides the maven pom.xml you currently only need thisconfiguration
> class:
> > WicketApplication.java
> > <
> >
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/WicketApplication.java
> > >
> > to get a full working wicket application. You only have to execute the
> main
> > method. You should get a default login page and a simple home page.
> Spring
> > security is automatically configured in a default configuration. Within a
> > property file you can switch between deployment or development
> > configruation
> >
> > wicket.configurationType=DEPLOYMENT
> > wicket.compressHTMLEnabled=true  HTMLCompressingConfig.java
> > <
> >
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/HTMLCompressingConfig.java
> > >
> > wicket.statelessCheckerEnabled=true  StatelessCheckerConfig.java
> > <
> >
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/StatelessCheckerConfig.java
> > >
> >
> > My main goal was to learn a bit about Spring Boot but maybe its
> interessing
> > for somone in the Wicket community
> >
> > GreetsMarc
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-Boot-tp4672591.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
> >
> >
>


Re: Access the row index in an AbstractColumn?

2015-04-21 Thread Andrew Geery
See
http://apache-wicket.1842946.n4.nabble.com/DataTable-how-to-make-a-column-showing-the-row-number-td1855450.html
:

public void populateItem(Item cell, String compId, IModel rowModel) {
item.getindex() is cell, ((item)item.getparent()).getindex() is row

On Tue, Apr 21, 2015 at 2:35 PM, Stefan Renz s.r...@efonds.com wrote:

 Hi,

 my client asked me to implement a simple row numbering in a data table.
 What I have is a Panel with a DataTable, with a varying number of
 IColumns. I thought that I could add such a row number column
 implementation in virtually no time, but it turns out that the index
 returned by populateItem's Item argument is not the row number, but the
 column number. I've been looking all around, but I can't seem to be able
 to find the row number index.

 Any idea how to do that in a DataTable AbstractColumn implementation?

 Thanks for your help.

 Bye
 Stefan


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




Re: AjaxLazyLoadPanel

2015-04-20 Thread Andrew Geery
In AjaxLazyLoadPanel#getLazyComponent(String), you should be using the id
parameter, not pList, when creating the PListPanel.

Andrew

@Override
public Component getLazyLoadComponent(String id) {
return new PListPanel(pList, pModel); // change
the first param from pList to id
}

On Mon, Apr 20, 2015 at 11:10 PM, Chris chris...@gmx.at wrote:

 Hi all,

 I am following the example from
 http://www.mkyong.com/wicket/how-do-use-ajaxlazyloadpanel-in-wicket/ but
 get following error:

 Last cause: Cannot replace a component which has not been added:
 id='pList', component=[PListPanel [Component id = pList]]:
 [AjaxLazyLoadPanel [Component id = pList]]

 By the way, is the checking for JavaEnabled valid or still needed? I have
 JavaScript enabled but the method #isJavaEnabled returns false;

 WebClientInfo clientInfo = WebSession.get().getClientInfo();
 if (clientInfo.getProperties().isJavaEnabled()) {
 add(new AjaxLazyLoadPanel(pList, pModel) {
 @Override
 public Component getLazyLoadComponent(String id) {
 return new PListPanel(pList, pModel);
 }
 }).setOutputMarkupId(true);
 } else {
 add(new PListPanel(pList, pModel);
 }

 Thanks, Chris


validating a form that is not visible

2015-01-22 Thread Andrew Geery
I have a top-level form.

The top-level form contains two nested forms.

The nested forms are inside of a TabbedPanel so only one is visible at a
time.

The save button for the top-level form is always visible.  The save button
submits the top-level form and submitting the top-level form also has the
effect of submitting the nested forms.

This all is correct and works as it should.

The issue is that Wicket (correctly) only validates the form that is on the
tab that is visible.  The form that is on the tab that is not visible is
not actually being submitted so it doesn't get validated.

In the past, I've prevented the user from switching tabs if one of the tabs
contained a validation error, but I can't do that in this case.

When the top-level form is submitted, is there a way I can mark both forms
as visible and have Wicket validate both forms?

Thanks
Andrew


Re: validating a form that is not visible

2015-01-22 Thread Andrew Geery
Thanks so much for the info and the pointers!

Andrew

On Thu, Jan 22, 2015 at 7:03 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 e.g.


 https://github.com/reiern70/wicket-bootstrap/blob/master/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java

 On Thu, Jan 22, 2015 at 11:57 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

  Hi,
 
  I think you will need to write custom tabbed panel that hides the tabs
 with
  JS on the client side.
 
  The problem with Wicket's default TabbedPanel is that it sees only one
 tab
  at a time - the active tab.
  I.e. the component tree is something like
  ...form:tabbedPanel:content:nestedFormX:...
  Switching the tabs replaces the content component and thus nestedFormX
  becomes nestedFormY.
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery andrew.ge...@gmail.com
  wrote:
 
   I have a top-level form.
  
   The top-level form contains two nested forms.
  
   The nested forms are inside of a TabbedPanel so only one is visible at
 a
   time.
  
   The save button for the top-level form is always visible.  The save
  button
   submits the top-level form and submitting the top-level form also has
 the
   effect of submitting the nested forms.
  
   This all is correct and works as it should.
  
   The issue is that Wicket (correctly) only validates the form that is on
  the
   tab that is visible.  The form that is on the tab that is not visible
 is
   not actually being submitted so it doesn't get validated.
  
   In the past, I've prevented the user from switching tabs if one of the
  tabs
   contained a validation error, but I can't do that in this case.
  
   When the top-level form is submitted, is there a way I can mark both
  forms
   as visible and have Wicket validate both forms?
  
   Thanks
   Andrew
  
 



 --
 Regards - Ernesto Reinaldo Barreiro



Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Andrew Geery
As a sanity check, is the property file with the property
UploadProgressBar.starting
in the jar file?  Perhaps it didn't get copied over by the Maven build
process into the jar but the IDE was properly copying it over...

Andrew

On Wed, Oct 1, 2014 at 11:38 AM, Garret Wilson gar...@globalmentor.com
wrote:

 On 10/1/2014 12:33 PM, Martin Grigorov wrote:

 Hi,

 Do you by chance manipulate the list of IStringResourceLoader's in
 DEPLOYMENT mode ?


 I don't think I touched anything related to IStringResourceLoader. The
 only thing I've done relating to modes is this:

   //turn on Wicket development mode if in debug mode
   final String wicketConfiguration = Debug.isDebug() ? development :
 deployment;
   filterHolder.setInitParameter(configuration, wicketConfiguration);

 In other words, in embedded Jetty, if we've started up specifying a debug
 mode (using a system variable), then I set the Wicket configuration to
 development; otherwise, I set it to deployment.


 Garret

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




Re: resource encoding troubles

2014-08-28 Thread Andrew Geery
I created a Wicket quickstart (from
http://wicket.apache.org/start/quickstart.html) [this is Wicket 6.16.0] and
made two simple changes:

1) I created a HomePage.properties file, encoded as ISO-8859-1, with a
single line as per the example above: copyright=© 2014 Example, Inc.

2) I added a line to the HomePage.html file as per the example
above: psmallwicket:message key=copyright©
Example/wicket:message/small/p

The content is served as UTF-8 and the copyright symbol is rendered
correctly on the page.

It doesn't look like the problem is in Wicket (at least not in 6.16).  I
guess your next steps would be to verify that you get the same results and,
assuming that you do, start removing things from your page that has the
problem until you find an element that is causing the problem.

Thanks
Andrew


On Thu, Aug 28, 2014 at 5:38 PM, Garret Wilson gar...@globalmentor.com
wrote:

 On 8/28/2014 12:08 PM, Sven Meier wrote:

 ...


  My configuration, as far as I can tell, is correct.

 From what you've written, I'd agree.

 You should create a quickstart. This will easily allow us to find a
 possible bug.


 Better than that, I'd like to trace down the bug, fix it, and file a
 patch. But currently I'm blocked from working with Wicket on Eclipse 
 https://issues.apache.org/jira/browse/WICKET-5649.

 Garret



Re: set table disabled while ajax request is running

2014-01-09 Thread Andrew Geery
The easiest way to do that is to use
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/IAjaxIndicatorAware.html

See
http://wicketinaction.com/2008/12/preventing-double-ajax-requests-in-3-lines-of-code/
for
an example.

Andrew


On Thu, Jan 9, 2014 at 7:07 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 You may show a veil above the table to prevent clicking on elements during
 the ajax call

 Martin Grigorov
 Wicket Training and Consulting


 On Thu, Jan 9, 2014 at 1:01 PM, christoph.ma...@t-systems.com wrote:

  Hello,
 
  in my application I have a table with some custom toolbars. This table
  shows some data from the database if the user clicks an ajax button. But
 if
  the user clicks the button again, the table will be replaced by a new
 table
  with the new data. Here an example:
 
  target.add(page.get(table).replaceWith(getNewTable(newData)));
 
  This works fine. :)
 
  Now the problem. When the user clicks the ajax button again the ajax
  request begins running, but the user is able to click one of toolbars of
  the shown table. So I get an exception: the table.toolbar was not found.
  This is ok because of the replacement with a new table. I want to disable
  the shown table while the ajax request is running. If the request
 detaches
  the old table will be replaced by the new table with enabled toolbars.
 
  I tried to override the onEvent-method of my table. Here you can see the
  code:
  @Override
  public void onEvent(IEvent? event){
  if(event.getPayload() instanceof AjaxRequestTarget){
  AjaxRequestTarget actualRequestTaget =
  (AjaxRequestTarget)event.getPayload();
  actualRequestTaget.addListener(new
  AjaxRequestTarget.AbstractListener(){
  @Override
  public void onBeforeRespond(MapString,Component map,
  AjaxRequestTarget target) {
  setEnabled(false);
  }
  @Override
  public void onAfterRespond(MapString,Component map,
  AjaxRequestTarget.IJavaScriptResponse response) {
  setEnabled(true);
  }
  });
  }
  }
 
  But this didn't work. I can click the toolbars while the request is
  running and then I get the old excetion. The table will be disabled if
 the
  request has finished.
 
  Is there any possibility to realize it?
 
 
 
  Mit freundlichen Grüßen
  Christoph Manig
  Systems Engineer
 
  T-Systems International GmbH
  Systems Integration - SC Travel, Transport  Logistics
  Hoyerswerdaer Str. 18
  01099 Dresden
  tel.:   +49 (0) 351 / 8152 - 188
  fax:+49 (0) 351 / 8152 - 209
  email:  christoph.ma...@t-systems.com
 
 
 
 



Re: Script Error is getting in IE8 while selecting DatePicker in Modal Window

2013-12-16 Thread Andrew Geery
The first thing I would check is that the ModalWindow is wrapped in a
Wicket Form (see the end of the class-level Javadoc for ModalWindow: If
you want to use form in modal window component make sure that you put the
modal window itself in another form).  If it's not, the date picker
doesn't work correctly in IE in a ModalWindow.

...
Form? form = new Form...
add(form);
ModalWindow modal = new ModalWindow(...);
form.add(modal);
...

You probably won't actually use the wrapping Form; it just needs to be
there.

Andrew



On Mon, Dec 16, 2013 at 6:58 AM, wicket_new_user venkyra...@gmail.comwrote:

 Hi,
 i'm getting script error, when trying to provide the Date picker in modal
 window on IE8 browser, this works fine in IE9  IE10 without any issues.

 Script error is getting at the below code in calendar-min.js at line no.
 18, the bold one below from the code.

 try {
 this.oDomContainer.innerHTML=G.join(\n);
 } catch (e) {
 (function(){
 var c=this.oDomContainer;
 if (*c.childNodes*c.childNodes.lengthc.childNodes.length0) {
 while (c.childNodes.length0) {
 c.removeChild(c.childNodes[0]);
 }
 }
 var a=document.createElement(div);
 a.innerHTML = html.join(\n);
 c.appendChild(a);
 })();}


 Note: I'm using wicket 1.5.4.


 Any suggestions on this regard, will help me a lot.

 Thanks in advance
 Venky



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Script-Error-is-getting-in-IE8-while-selecting-DatePicker-in-Modal-Window-tp4663039.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




Re: issue using select2 in a ModalWindow

2013-09-20 Thread Andrew Geery
The problem turned out to be a couple of z-index css properties associated
with the select2 component not being big enough to work with the Wicket
ModalWindow.

Here are the changes I made to made to the select2 css to make it work with
the Wicket ModalWindow.

.select2-drop {
z-index: 30001;
}

.select2-drop-mask {
z-index: 3;
}

The first one is obvious -- if you don't have it the drop-downs open behind
the ModalWindow.  The second one fixes the problem of the drop-down not
closing correctly (e.g., when you click outside of them) in a ModalWindow.

Thanks
Andrew


On Tue, Aug 27, 2013 at 9:20 AM, Andrew Geery andrew.ge...@gmail.comwrote:

 I'm using the fantastic select2 component in my Wicket 6.7 application via
 the Wicket-select2 integration package [
 https://github.com/ivaynberg/wicket-select2/], version 2.2.2.

 It works great on a regular page.  On a page, clicking outside of the
 select2 component causes the component to close.

 However, when used in a Wicket ModalWindow, clicking outside of the
 select2 component (i.e., clicking somewhere else in the ModalWindow) does
 not cause the component to close.  Some issues have been reported around
 this (https://github.com/ivaynberg/wicket-select2/issues/13,
 https://github.com/ivaynberg/wicket-select2/issues/35) and the tickets
 say the issue should be fixed in select 3.3.0.  Version 2.2.2 of the
 wicket-select2 package includes version 3.3.2 of select2.  However, I'm
 still seeing the problem.

 Is anyone else seeing this behavior?  Should the issue be fixed?

 Thanks
 Andrew



issue using select2 in a ModalWindow

2013-08-27 Thread Andrew Geery
I'm using the fantastic select2 component in my Wicket 6.7 application via
the Wicket-select2 integration package [
https://github.com/ivaynberg/wicket-select2/], version 2.2.2.

It works great on a regular page.  On a page, clicking outside of the
select2 component causes the component to close.

However, when used in a Wicket ModalWindow, clicking outside of the select2
component (i.e., clicking somewhere else in the ModalWindow) does not cause
the component to close.  Some issues have been reported around this (
https://github.com/ivaynberg/wicket-select2/issues/13,
https://github.com/ivaynberg/wicket-select2/issues/35) and the tickets say
the issue should be fixed in select 3.3.0.  Version 2.2.2 of the
wicket-select2 package includes version 3.3.2 of select2.  However, I'm
still seeing the problem.

Is anyone else seeing this behavior?  Should the issue be fixed?

Thanks
Andrew


Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior

2013-07-24 Thread Andrew Geery
The problem is the ajax-loader-mask.  As per this posting (
http://stackoverflow.com/questions/12403999/jquery-click-event-doesnt-work-after-change-event),
the click happens (but no js click event yet), the js change event is sent
for the modified form field, Wicket handles the change event, the
ajax-loader-mask is displayed, which causes focus to be lost on the
link/button and the js click event is never fired, so Wicket only gets one
event.  If I remove the IAjaxIndicatorAware.getAjaxIndicatorMarkupId(),
which is supplying the ajax-loader-mask, the two events do get queued
correctly.

The solution is to keep the ajax indicator on the button but to remove it
from the form fields.

Thanks
Andrew



On Wed, Jul 24, 2013 at 2:47 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Tue, Jul 23, 2013 at 6:44 PM, Andrew Geery andrew.ge...@gmail.com
 wrote:

  Just to make sure I'm understanding this correctly, it should be enough
 to
  simply override updateAjaxAttributes on AjaxButton and specify a channel
  that does not have ACTIVE behavior, like this:
 
   @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
  super.updateAjaxAttributes(attributes);
  attributes.setChannel(new AjaxChannel(MyChannel,
  AjaxChannel.Type.DROP));
  }
 

 The default channel type is QUEUE, so it should work by default.
 I cannot say why it doesn't in your case.


 
  Thanks
  Andrew
 
 
  On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   HI,
  
   Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not
   experience this behavior.
   It should work exactly as you expect it.
   Try to put some debug statements with an AjaxCallListener - print to
   console in onBefore() and onBeforeSend(). Add this listener to both
   components - the field and the button.
  
  
   On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com
   wrote:
  
I have a form that is submitted with an AjaxButton.  One of the
 fields
  in
the form uses an AjaxFormComponentUpdatingBehavior to update the
server-side state when a value in the field changes (i.e., it fires
onchange).  If the user changes the field with
the AjaxFormComponentUpdatingBehavior associated with it and then
  clicks
the submit button, the behavior updates the field server side, but
 the
   ajax
button doesn't submit the form.  The user has to click the submit
  button
   a
second time to submit the form.  Is there a way to get the two ajax
behaviors to fire consecutively, rather than forcing the user to
 click
twice?
   
Thanks
Andrew
   
  
 



Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior

2013-07-23 Thread Andrew Geery
Just to make sure I'm understanding this correctly, it should be enough to
simply override updateAjaxAttributes on AjaxButton and specify a channel
that does not have ACTIVE behavior, like this:

 @Override
protected void updateAjaxAttributes(AjaxRequestAttributes
attributes) {
super.updateAjaxAttributes(attributes);
attributes.setChannel(new AjaxChannel(MyChannel,
AjaxChannel.Type.DROP));
}

Thanks
Andrew


On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 HI,

 Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not
 experience this behavior.
 It should work exactly as you expect it.
 Try to put some debug statements with an AjaxCallListener - print to
 console in onBefore() and onBeforeSend(). Add this listener to both
 components - the field and the button.


 On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com
 wrote:

  I have a form that is submitted with an AjaxButton.  One of the fields in
  the form uses an AjaxFormComponentUpdatingBehavior to update the
  server-side state when a value in the field changes (i.e., it fires
  onchange).  If the user changes the field with
  the AjaxFormComponentUpdatingBehavior associated with it and then clicks
  the submit button, the behavior updates the field server side, but the
 ajax
  button doesn't submit the form.  The user has to click the submit button
 a
  second time to submit the form.  Is there a way to get the two ajax
  behaviors to fire consecutively, rather than forcing the user to click
  twice?
 
  Thanks
  Andrew
 



Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior

2013-07-23 Thread Andrew Geery
Looking in the Wicket Debug Window, I do see the name of my channel and I
do see that it is set to Queue (MyChannel|s).

(function(){Wicket.Ajax.ajax({f:form563,u:./1478314?11-1.IBehaviorListener.2-contactDetailsPanel-contactDetailsTabbedPanel-tabbedPanel-panel-modalForm-modal-content-wizard-form-view-wrapper-form-Save,e:click,c:Save564,sc:modal:content:wizard:form:view:wrapper:form:Save,ch:MyChannel|s,m:POST,i:ajax-loader-mask});})();

I'm currently using Wicket 6.7.

Does this not work because either a) it's in a modal window? or b) there is
an ajax-loader-mask?

Thanks
Andrew


On Tue, Jul 23, 2013 at 11:44 AM, Andrew Geery andrew.ge...@gmail.comwrote:

 Just to make sure I'm understanding this correctly, it should be enough to
 simply override updateAjaxAttributes on AjaxButton and specify a channel
 that does not have ACTIVE behavior, like this:

  @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setChannel(new AjaxChannel(MyChannel,
 AjaxChannel.Type.DROP));
 }

 Thanks
 Andrew


 On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 HI,

 Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not
 experience this behavior.
 It should work exactly as you expect it.
 Try to put some debug statements with an AjaxCallListener - print to
 console in onBefore() and onBeforeSend(). Add this listener to both
 components - the field and the button.


 On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com
 wrote:

  I have a form that is submitted with an AjaxButton.  One of the fields
 in
  the form uses an AjaxFormComponentUpdatingBehavior to update the
  server-side state when a value in the field changes (i.e., it fires
  onchange).  If the user changes the field with
  the AjaxFormComponentUpdatingBehavior associated with it and then clicks
  the submit button, the behavior updates the field server side, but the
 ajax
  button doesn't submit the form.  The user has to click the submit
 button a
  second time to submit the form.  Is there a way to get the two ajax
  behaviors to fire consecutively, rather than forcing the user to click
  twice?
 
  Thanks
  Andrew
 





problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior

2013-07-22 Thread Andrew Geery
I have a form that is submitted with an AjaxButton.  One of the fields in
the form uses an AjaxFormComponentUpdatingBehavior to update the
server-side state when a value in the field changes (i.e., it fires
onchange).  If the user changes the field with
the AjaxFormComponentUpdatingBehavior associated with it and then clicks
the submit button, the behavior updates the field server side, but the ajax
button doesn't submit the form.  The user has to click the submit button a
second time to submit the form.  Is there a way to get the two ajax
behaviors to fire consecutively, rather than forcing the user to click
twice?

Thanks
Andrew


Re: Model performance question

2013-06-26 Thread Andrew Geery
The wiki says (https://cwiki.apache.org/WICKET/working-with-wicket-models.html):

Compound models allow containers to share models with their children.
This saves memory, but more importantly, it makes replication of
models much cheaper in a clustered environment.

I think what we're saying in this thread is that PropertyModels
actually have the same benefits as CPM; that is, a CPM doesn't give
you any performance benefits over using a PropertyModel -- there's
less typing with a CPM, but it ends up the same in the end.  Does that
sound right?

Andrew

On Tue, Jun 25, 2013 at 12:02 PM, Bas Gooren b...@iswd.nl wrote:
 Hi,

 It sounds like you know what you are doing, but I just want to check why you
 chose myObject as a variable name in your example?
 If you are properly using detachable models and do not want to serialize a
 large object graph, myObject needs to be a loadable detachable model, and
 not an actual object in your example.
 myLDM or myObjectModel would be a more logical name.

 In my experience it doesn't matter where you create your models, because
 using a compound property model will automatically create propertymodels on
 your nested components anyway. Each component needs its own model anyway, to
 get and set its value.

 Met vriendelijke groet,
 Kind regards,

 Bas Gooren

 Op 25-6-2013 16:20, schreef gmparker2000:

 Considering two alternative ways to set a model:

  ...
  final CompoundPropertyModel myModel = new
 CompoundPropertyModel(myObject);

  control1.setModel(myModel.bind(field1));
  control2.setModel(myModel.bind(field2));
  control3.setModel(myModel.bind(field3));
  ...

 and
  ...
  control1.setModel(new PropertyModel(myObject, field1));
  control2.setModel(new PropertyModel(myObject, field2));
  control3.setModel(new PropertyModel(myObject, field3));
  ...

 are there any performance benefits of one over the other?  I profiled each
 and they appear equivalent from the number of objects created point of
 view.
 I just want to make sure that option two isn't doing something like
 serializing myObject for each control.  It doesn't appear that this is
 happening but wanted to make sure.

 We are binding controls to fairly large nested Java Objects.  Other than
 making sure to use LoadableDetachable models where possible are there any
 other strategies for making sure performance is optimal?  For example,
 would
 setting the model on the form rather than on each control have any
 performance benefit?

 Thanks



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Model-performance-question-tp4659771.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



AjaxLink onclick bubbling up dom in 6.7

2013-04-22 Thread Andrew Geery
Previous to 6.7, when clicking on an AjaxLink which was contained within a
div that had an onclick handler, the onclick did not propagate to the
containing div.  Starting in 6.7, clicking the AjaxLink does propagate the
onclick event up the DOM.  Was this intentional?  I couldn't find a change
log message about this...

Regardless, assuming that I don't want the onclick to propagate up the dom,
how do I prevent this?  I found this:

http://apache-wicket.1842946.n4.nabble.com/stopping-event-bubbling-from-link-to-enclosing-div-td1871321.html

but the class has been removed in 6.

Thanks
Andrew


IE8 error in wicket-date.js when used in a modalwindow

2013-03-29 Thread Andrew Geery
Using the DatePicker in a ModalWindow, I get the error below after
using the calendar widget and closing the modal.  The widget works
fine for me; it's simply throwing a JS error in IE8 (displayed in the
lower lefthand corner of the browser).  I don't see the error in other
browsers.

The problematic line in wicket-date.js is this one:

YAHOO.wicket[cfg.dpJs].hide();

I can avoid the error simply by adding a condition to the if-statement
that is wrapped around the hide method to check that
YAHOO.wicket[cfg.dpJs] is not null:

if (...  YAHOO.wicket[cfg.dpJs]) ...

I'm guessing that this is related to the bug fix for
https://issues.apache.org/jira/browse/WICKET-4975 -- perhaps the
widget is getting destroyed in IE before it can be hidden?

Thanks
Andrew



Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2;
Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Fri, 29 Mar 2013 17:54:46 UTC

Message: 'YAHOO.wicket[...]' is null or not an object
Line: 308
Char: 6
Code: 0
URI: 
http://127.0.0.1:8080/test/wicket/resource/org.apache.wicket.extensions.yui.calendar.DatePicker/wicket-date-ver-1359131272000.js

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



Re: IE8 error in wicket-date.js when used in a modalwindow

2013-03-29 Thread Andrew Geery
Done -- https://issues.apache.org/jira/browse/WICKET-5125

Andrew

On Fri, Mar 29, 2013 at 6:13 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 Please report this in a new issue so that proper action can be taken.


 On Fri, Mar 29, 2013 at 7:06 PM, Andrew Geery andrew.ge...@gmail.comwrote:

 Using the DatePicker in a ModalWindow, I get the error below after
 using the calendar widget and closing the modal.  The widget works
 fine for me; it's simply throwing a JS error in IE8 (displayed in the
 lower lefthand corner of the browser).  I don't see the error in other
 browsers.

 The problematic line in wicket-date.js is this one:

 YAHOO.wicket[cfg.dpJs].hide();

 I can avoid the error simply by adding a condition to the if-statement
 that is wrapped around the hide method to check that
 YAHOO.wicket[cfg.dpJs] is not null:

 if (...  YAHOO.wicket[cfg.dpJs]) ...

 I'm guessing that this is related to the bug fix for
 https://issues.apache.org/jira/browse/WICKET-4975 -- perhaps the
 widget is getting destroyed in IE before it can be hidden?

 Thanks
 Andrew

 

 Webpage error details

 User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2;
 Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
 3.0.4506.2152; .NET CLR 3.5.30729)
 Timestamp: Fri, 29 Mar 2013 17:54:46 UTC

 Message: 'YAHOO.wicket[...]' is null or not an object
 Line: 308
 Char: 6
 Code: 0
 URI:
 http://127.0.0.1:8080/test/wicket/resource/org.apache.wicket.extensions.yui.calendar.DatePicker/wicket-date-ver-1359131272000.js

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




 --
 Regards - Ernesto Reinaldo Barreiro

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



Re: question about page variable in AjaxRequestHandler

2013-03-28 Thread Andrew Geery
Done: https://issues.apache.org/jira/browse/WICKET-5121

Thanks
Andrew

On Thu, Mar 28, 2013 at 4:09 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Thu, Mar 28, 2013 at 3:54 AM, Andrew Geery andrew.ge...@gmail.comwrote:

 I just wanted to confirm that add(Component...) in AjaxRequestHandler
 will only work with (i.e., refresh) components that are on the same
 page as the page associated with the AjaxRequestHandler.

 I had a case where the content of a ModalWindow was a WebPage.  In the
 modal window, there was an AjaxLink where I was trying to update a
 component on the underlying page in the onSubmit method using the
 AjaxRequestHandler object (not directly, in an event handler on the
 underlying page).  However, this didn't work and I noticed that the
 AjaxRequestHandler object referred to the WebPage in the modal window,
 not the page from which the modal was launched.  If I change from
 using a page in the modal to using a panel (and thus the
 AjaxRequestHandler.page refers to the underlying page), the underlying
 page gets properly updated.

 If it is true that an AjaxRequestHandler can only be used to update
 components on the page it is associated with, would it make sense to
 add a warning to either AjaxjRequestHandler or AbstractAjaxResponse if
 a component is added which is not on the page associated with the
 AjaxRequestHander or AbstractAjaxResponse?


 Yes, this is true.
 This is not so common issue but yes, we can log a warning if a component
 for re-render is not in the current page.
 Please file a ticket.



 Thanks
 Andrew

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




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/

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



question about page variable in AjaxRequestHandler

2013-03-27 Thread Andrew Geery
I just wanted to confirm that add(Component...) in AjaxRequestHandler
will only work with (i.e., refresh) components that are on the same
page as the page associated with the AjaxRequestHandler.

I had a case where the content of a ModalWindow was a WebPage.  In the
modal window, there was an AjaxLink where I was trying to update a
component on the underlying page in the onSubmit method using the
AjaxRequestHandler object (not directly, in an event handler on the
underlying page).  However, this didn't work and I noticed that the
AjaxRequestHandler object referred to the WebPage in the modal window,
not the page from which the modal was launched.  If I change from
using a page in the modal to using a panel (and thus the
AjaxRequestHandler.page refers to the underlying page), the underlying
page gets properly updated.

If it is true that an AjaxRequestHandler can only be used to update
components on the page it is associated with, would it make sense to
add a warning to either AjaxjRequestHandler or AbstractAjaxResponse if
a component is added which is not on the page associated with the
AjaxRequestHander or AbstractAjaxResponse?

Thanks
Andrew

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



Re: Multiple select drop down in Wicket

2013-01-15 Thread Andrew Geery
Yes, it is possible.  See https://github.com/ivaynberg/wicket-select2
(http://ivaynberg.github.com/select2/ is the standalone UI piece, if
you're interested).  And it is available via Maven.

Andrew

On Mon, Jan 14, 2013 at 9:17 PM, kshitiz k.agarw...@gmail.com wrote:
 Actually ListMultipleChoice is not that user friendly as compare to multi
 select drop down. Thats why I preferred the later one. Is there any way to
 implement the same in Wicket?



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Multiple-select-drop-down-in-Wicket-tp4655355p4655368.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: question re Component.initModel()

2013-01-04 Thread Andrew Geery
I wanted to follow up about this.  The nested CompoundPropertyModel
address example in the original email does not work, not because of
the visitor in onConfigure(), but because child models are
(potentially) created before parent models.  For example, in the code
below, there is an optimization in the initModel() code that creates
the model backing Label(street1) before the model for the
AddressPanel.  Because of this, Wicket does not know that AddressPanel
is, in fact, a CPM and rather than using it to resolve street1, Wicket
continues to the next parent and resolves street1 against Person.

There are three options for dealing with this:

1) don't use nested CompoundPropertyModels
2) explicitly call getDefaultModel() on the parent (e.g., in
onInitialize()) before the child models are created
3) change how the initModel() method works to create the parent model
before creating child models

I think the best solution is 3 -- I created a JIRA issue with
quickstart for it: https://issues.apache.org/jira/browse/WICKET-4941

Thanks
Andrew

On Wed, Dec 19, 2012 at 10:48 AM, Andrew Geery andrew.ge...@gmail.com wrote:
 I'm dealing with the issue around a nested CompoundPropertyModel not
 resolving its properties against the correct object.

 class Person {
  Address address;
   ...
 }

 class Address {
   String street1;
   ...
 }

 class PersonPanel extends Panel {
   PersonPanel(String id) {
 super(id); // use cpm of parent
 add(new AddressPanel(address));
   }
 }

 class AddressPanel extends Panel {

   AddressPanel(String id) {
 super(id); // use cpm of parent
 add(new Label(street1));
 ...
   }

 }

 When Wicket resolves property street1 it uses the person object
 rather than the address object.  This has been talked about before
 (http://mail-archives.apache.org/mod_mbox/wicket-users/200803.mbox/%3c23eb48360803040850i3022ddbdleca18da7e4f69...@mail.gmail.com%3E);
 the solution is to override the initModel() method in the AddressPanel
 class like this:

 @Override
 protected IModel? initModel() {
 final IModel? model = super.initModel(); // returns original cpm
 return new CompoundPropertyModel(new PropertyModel(model, 
 getId()));
 }

 The issue I'm running into now is that I've added a call to
 visitChildren in AddressPanel.onConfigure.

 My component() method looks like this:

 public void component(final Component object, final
 IVisitVoid visit) {
 Object obj = object.getDefaultModelObject();
 ...
 }

 The issue is that when I call getDefaultModelObject() in the component
 method, the initModel for the AddressPanel has not been called.

 The call stack for the Label looks like this:
 Component.getDefaultModelObject() -
 getDefaultModel() -
 initModel()

 In Component.initModel(), the code iterates through the parents
 looking for a IComponentInheritedModel (CPM).

 It does this by calling getModelImpl() on the parent.  This just
 checks if the model is set on the parent; it doesn't actually create
 it if it doesn't exist (i.e., by calling initModel()).  The issue is
 that because initModel() hasn't been called on the AddressPanel, the
 model for it is null and the initModel call on the Label keeps going
 up the hierarchy looking for a CPM.  This would work if rather than
 calling getModelImpl() the code called getDefaultModel() which has the
 effect of calling initModel() if necessary.

 There's a code comment saying that the getModelImpl() is called
 because getModel() (I think it should be getDefaultModel() now) could
 initialize many inbetween completely useless models.  What are these
 useless inbetween models?  Is that still an issue?  If it's not, could
 the code be changed to call getDefaultModel() on the parent instead?

 The workaround is to make a call to AddressPanel.getDefaultModel()
 before the visitChildren call in onConfigure().

 Thanks
 Andrew

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



Re: question re Component.initModel()

2013-01-04 Thread Andrew Geery
Thanks for the answer, Sven: I'm not a huge CPM fan either; I find
them hard to debug and fragile.

I understand your example of needing to get the model for B and C in
order to get the model for D; however, I guess my ultimate question
is: given that B and C are, in fact, parents of D, won't their models
always have to be acquired eventually during the component rendering?
Isn't all we're really changing just *when* the parent models are
acquired?

Andrew

On Fri, Jan 4, 2013 at 8:16 AM, Sven Meier s...@meiers.net wrote:
 Hi Andrew,


 getModelImpl() is called because getModel() (I think it should be
 getDefaultModel() now) could initialize
 many inbetween completely useless models. What are these useless inbetween
 models? Is that still an issue?

 this still holds. If you have the following hierarchy:

 A - B - C - D

 ... and A has a CompoundPropertyModel and D needs a model. If
 #getDefaultModel() would be called, B and C would acquire a model even they
 don't need it.

 IIRC CompoundPropertyModel has fallen out of favor lately (too much
 magic). Type-safe alternatives are wicket-safemodel or wicket-modelfactory
 (offering magic too ;).

 I still use CPMs fairly often, but always with option 1).

 Sven



 On 01/04/2013 01:12 PM, Andrew Geery wrote:

 I wanted to follow up about this.  The nested CompoundPropertyModel
 address example in the original email does not work, not because of
 the visitor in onConfigure(), but because child models are
 (potentially) created before parent models.  For example, in the code
 below, there is an optimization in the initModel() code that creates
 the model backing Label(street1) before the model for the
 AddressPanel.  Because of this, Wicket does not know that AddressPanel
 is, in fact, a CPM and rather than using it to resolve street1, Wicket
 continues to the next parent and resolves street1 against Person.

 There are three options for dealing with this:

 1) don't use nested CompoundPropertyModels
 2) explicitly call getDefaultModel() on the parent (e.g., in
 onInitialize()) before the child models are created
 3) change how the initModel() method works to create the parent model
 before creating child models

 I think the best solution is 3 -- I created a JIRA issue with
 quickstart for it: https://issues.apache.org/jira/browse/WICKET-4941

 Thanks
 Andrew

 On Wed, Dec 19, 2012 at 10:48 AM, Andrew Geery andrew.ge...@gmail.com
 wrote:

 I'm dealing with the issue around a nested CompoundPropertyModel not
 resolving its properties against the correct object.

 class Person {
   Address address;
...
 }

 class Address {
String street1;
...
 }

 class PersonPanel extends Panel {
PersonPanel(String id) {
  super(id); // use cpm of parent
  add(new AddressPanel(address));
}
 }

 class AddressPanel extends Panel {

AddressPanel(String id) {
  super(id); // use cpm of parent
  add(new Label(street1));
  ...
}

 }

 When Wicket resolves property street1 it uses the person object
 rather than the address object.  This has been talked about before

 (http://mail-archives.apache.org/mod_mbox/wicket-users/200803.mbox/%3c23eb48360803040850i3022ddbdleca18da7e4f69...@mail.gmail.com%3E);
 the solution is to override the initModel() method in the AddressPanel
 class like this:

  @Override
  protected IModel? initModel() {
  final IModel? model = super.initModel(); // returns original
 cpm
  return new CompoundPropertyModel(new PropertyModel(model,
 getId()));
  }

 The issue I'm running into now is that I've added a call to
 visitChildren in AddressPanel.onConfigure.

 My component() method looks like this:

  public void component(final Component object, final
 IVisitVoid visit) {
  Object obj = object.getDefaultModelObject();
  ...
  }

 The issue is that when I call getDefaultModelObject() in the component
 method, the initModel for the AddressPanel has not been called.

 The call stack for the Label looks like this:
 Component.getDefaultModelObject() -
 getDefaultModel() -
 initModel()

 In Component.initModel(), the code iterates through the parents
 looking for a IComponentInheritedModel (CPM).

 It does this by calling getModelImpl() on the parent.  This just
 checks if the model is set on the parent; it doesn't actually create
 it if it doesn't exist (i.e., by calling initModel()).  The issue is
 that because initModel() hasn't been called on the AddressPanel, the
 model for it is null and the initModel call on the Label keeps going
 up the hierarchy looking for a CPM.  This would work if rather than
 calling getModelImpl() the code called getDefaultModel() which has the
 effect of calling initModel() if necessary.

 There's a code comment saying that the getModelImpl() is called
 because getModel() (I think it should be getDefaultModel() now) could
 initialize many inbetween completely useless models.  What are these
 useless

Re: question re Component.initModel()

2013-01-04 Thread Andrew Geery
Good point; I wasn't thinking of Panels.  However, isn't initModel()
really there to deal with CPMs (it's only called when the model for a
component is null)?  And if you're dealing with CPMs, it seems that to
correctly and consistently resolve properties, you have to know what
the parent model is.  So in the case of A - B - C - D, initModel()
will only be called if the model for D is null.  The same for C and B:
their initModel()s will only be called if their models are null.  But
if their models are null, that means we're dealing with a CPM and we
need to instantiate them to know how to resolve the properties in D.

For me, the issue is that initModel() behaves differently depending on
whether getDefaultModel() has been called on the parent (that is,
whether the parent model has been resolved) and that seems to be
inconsistent behavior.

Andrew

On Fri, Jan 4, 2013 at 8:52 AM, Sven Meier s...@meiers.net wrote:
 Hi,

 correct me if I'm wrong, but if B and C are not interested in their model
 (e.g. Panels) then their models will never be accessed.

 Sven


 On 01/04/2013 02:47 PM, Andrew Geery wrote:

 Thanks for the answer, Sven: I'm not a huge CPM fan either; I find
 them hard to debug and fragile.

 I understand your example of needing to get the model for B and C in
 order to get the model for D; however, I guess my ultimate question
 is: given that B and C are, in fact, parents of D, won't their models
 always have to be acquired eventually during the component rendering?
 Isn't all we're really changing just *when* the parent models are
 acquired?

 Andrew

 On Fri, Jan 4, 2013 at 8:16 AM, Sven Meier s...@meiers.net wrote:

 Hi Andrew,


 getModelImpl() is called because getModel() (I think it should be
 getDefaultModel() now) could initialize
 many inbetween completely useless models. What are these useless
 inbetween
 models? Is that still an issue?

 this still holds. If you have the following hierarchy:

 A - B - C - D

 ... and A has a CompoundPropertyModel and D needs a model. If
 #getDefaultModel() would be called, B and C would acquire a model even
 they
 don't need it.

 IIRC CompoundPropertyModel has fallen out of favor lately (too much
 magic). Type-safe alternatives are wicket-safemodel or
 wicket-modelfactory
 (offering magic too ;).

 I still use CPMs fairly often, but always with option 1).

 Sven



 On 01/04/2013 01:12 PM, Andrew Geery wrote:

 I wanted to follow up about this.  The nested CompoundPropertyModel
 address example in the original email does not work, not because of
 the visitor in onConfigure(), but because child models are
 (potentially) created before parent models.  For example, in the code
 below, there is an optimization in the initModel() code that creates
 the model backing Label(street1) before the model for the
 AddressPanel.  Because of this, Wicket does not know that AddressPanel
 is, in fact, a CPM and rather than using it to resolve street1, Wicket
 continues to the next parent and resolves street1 against Person.

 There are three options for dealing with this:

 1) don't use nested CompoundPropertyModels
 2) explicitly call getDefaultModel() on the parent (e.g., in
 onInitialize()) before the child models are created
 3) change how the initModel() method works to create the parent model
 before creating child models

 I think the best solution is 3 -- I created a JIRA issue with
 quickstart for it: https://issues.apache.org/jira/browse/WICKET-4941

 Thanks
 Andrew

 On Wed, Dec 19, 2012 at 10:48 AM, Andrew Geery andrew.ge...@gmail.com
 wrote:

 I'm dealing with the issue around a nested CompoundPropertyModel not
 resolving its properties against the correct object.

 class Person {
Address address;
 ...
 }

 class Address {
 String street1;
 ...
 }

 class PersonPanel extends Panel {
 PersonPanel(String id) {
   super(id); // use cpm of parent
   add(new AddressPanel(address));
 }
 }

 class AddressPanel extends Panel {

 AddressPanel(String id) {
   super(id); // use cpm of parent
   add(new Label(street1));
   ...
 }

 }

 When Wicket resolves property street1 it uses the person object
 rather than the address object.  This has been talked about before


 (http://mail-archives.apache.org/mod_mbox/wicket-users/200803.mbox/%3c23eb48360803040850i3022ddbdleca18da7e4f69...@mail.gmail.com%3E);
 the solution is to override the initModel() method in the AddressPanel
 class like this:

   @Override
   protected IModel? initModel() {
   final IModel? model = super.initModel(); // returns
 original
 cpm
   return new CompoundPropertyModel(new PropertyModel(model,
 getId()));
   }

 The issue I'm running into now is that I've added a call to
 visitChildren in AddressPanel.onConfigure.

 My component() method looks like this:

   public void component(final Component object, final
 IVisitVoid visit) {
   Object obj = object.getDefaultModelObject

question re Component.initModel()

2012-12-19 Thread Andrew Geery
I'm dealing with the issue around a nested CompoundPropertyModel not
resolving its properties against the correct object.

class Person {
 Address address;
  ...
}

class Address {
  String street1;
  ...
}

class PersonPanel extends Panel {
  PersonPanel(String id) {
super(id); // use cpm of parent
add(new AddressPanel(address));
  }
}

class AddressPanel extends Panel {

  AddressPanel(String id) {
super(id); // use cpm of parent
add(new Label(street1));
...
  }

}

When Wicket resolves property street1 it uses the person object
rather than the address object.  This has been talked about before
(http://mail-archives.apache.org/mod_mbox/wicket-users/200803.mbox/%3c23eb48360803040850i3022ddbdleca18da7e4f69...@mail.gmail.com%3E);
the solution is to override the initModel() method in the AddressPanel
class like this:

@Override
protected IModel? initModel() {
final IModel? model = super.initModel(); // returns original cpm
return new CompoundPropertyModel(new PropertyModel(model, getId()));
}

The issue I'm running into now is that I've added a call to
visitChildren in AddressPanel.onConfigure.

My component() method looks like this:

public void component(final Component object, final
IVisitVoid visit) {
Object obj = object.getDefaultModelObject();
...
}

The issue is that when I call getDefaultModelObject() in the component
method, the initModel for the AddressPanel has not been called.

The call stack for the Label looks like this:
Component.getDefaultModelObject() -
getDefaultModel() -
initModel()

In Component.initModel(), the code iterates through the parents
looking for a IComponentInheritedModel (CPM).

It does this by calling getModelImpl() on the parent.  This just
checks if the model is set on the parent; it doesn't actually create
it if it doesn't exist (i.e., by calling initModel()).  The issue is
that because initModel() hasn't been called on the AddressPanel, the
model for it is null and the initModel call on the Label keeps going
up the hierarchy looking for a CPM.  This would work if rather than
calling getModelImpl() the code called getDefaultModel() which has the
effect of calling initModel() if necessary.

There's a code comment saying that the getModelImpl() is called
because getModel() (I think it should be getDefaultModel() now) could
initialize many inbetween completely useless models.  What are these
useless inbetween models?  Is that still an issue?  If it's not, could
the code be changed to call getDefaultModel() on the parent instead?

The workaround is to make a call to AddressPanel.getDefaultModel()
before the visitChildren call in onConfigure().

Thanks
Andrew

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



WicketRuntimeException: Attempted to set property value on a null object

2012-11-30 Thread Andrew Geery
I have a Person Hibernate/JPA entity with an @Embedded address object in it:

@Entity
public class Person {
...
  @Embedded
  private Address address;
...
}

I have a Panel with a Form for editing the Address
(EditAddressFormPanel) and a panel for editing the Person which uses
the Panel for editing (EditPersonFormPanel).

public class EditPersonFormPanel extends Panel {

  public EditPersonFormPanel(String cid, IModelPerson model) {
super(cid, model);
// create the person form
Form form = ...
// add the address form panel to it
form.add(new EditAddressFormPanel(address, new
PropertyModelAddress(model, address));
...
  }

}

This works if the Person.address field is not null.  However, because
of the way that JPA works, the address field will be null if all of
the fields in the class are null.  For example, if a Person object was
persisted without an initial address (i.e., address = null).  When
this happens, 
org.apache.wicket.model.AbstractPropertyModel.getInnermostModelOrObject()
returns null and I ultimately get a WicketRuntimeException: Attempted
to set property value on a null object in PropertyResolver.setValue
because the object is null.

My question is how to deal this this correctly at the model level.  I
think IModel.setObject should create a new object if the incoming
object is null and IModel.getObject should return null if no fields
are set on the object to match how JPA/Hibernate handles this.

How do other people handle this problem?  Is there a good model to
extend from (maybe something like IWrapModel)?  Any examples?

Thanks
Andrew

PS I'm already using EntityModels
(http://wicketinaction.com/2008/09/building-a-smart-entitymodel/)

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



Re: WicketRuntimeException: Attempted to set property value on a null object

2012-11-30 Thread Andrew Geery
The problem with doing that is that Hibernate detects that as a change
(a null object is not the same as an empty object) and does a database
update (see some of the comments on this:
https://issues.jboss.org/browse/HIBERNATE-50).

Andrew

On Fri, Nov 30, 2012 at 5:59 PM, Sven Meier s...@meiers.net wrote:
 d

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



Re: issue refreshing covered panel when modalwindow is open

2012-08-15 Thread Andrew Geery
Thanks for the answer, David.  I do use the technique you use below and it
works well.  However, in your situation, I think you're updating active
content.  In my situation, I have a modal window which is active.  When a
button on the modal window is clicked, the modal window calls the send(...)
method to dispatch an event.  A parent of the modal listens for the event
and closes the modal window.  A grandparent of the modal also listens for
the event and re(adds) the panel the modal window is covering up.  I have
verified that the event handler in both the parent and the grandparent are
being called (parent first and then grandparent).  The modal window is
closed, but the covered over panel is not re-added.  I believe this has
something to do with how Wicket knows whether a component is active
because, if I have the parent panel dispatch an event to the grandparent
panel in the  setWindowClosedCallback method, everything works as expected.

The question is: is there something in Wicket that keeps track of which
components are active and only updates those it believes are active?  The
issue here seems to be that the closing of the modal window and the
updating of the content happen in the same request cycle...

Thanks
Andrew

On Mon, Aug 13, 2012 at 7:09 AM, David JavaDeveloper 
javadeveloper.da...@gmail.com wrote:

 Try to use the replaceWith method on the dataTable component.

 I'm attaching a piece of code where we use this method in (*another *but
 similiar) situation where we need to replace the content of a modal window
 when the selected line (of dataTable) is changed:

 add(new AjaxLinkCampaign(details)
 {
 /**
  *
  */
 private static final long serialVersionUID = 1L;

 @Override
 public void onClick(AjaxRequestTarget target) {
 selectedLine =
 (Campaign)getParent().getDefaultModelObject();

 ZoomCampaign tempZoomCampaign = new
 ZoomCampaign(zoomCampaign, new PropertyModelCampaign(myModel,
 selectedLine));
 zoomCampaign.replaceWith(tempZoomCampaign);
 zoomCampaign = tempZoomCampaign;

 target.add(zoomCampaign);
 zoomCampaign.show(target);

 }
 });

 On Fri, Aug 10, 2012 at 7:54 PM, Andrew Geery andrew.ge...@gmail.com
 wrote:

  I've run into this issue a couple of times and worked around it, but I
  wanted to see if there is a better way of handling it.
 
  I have a form in a panel in a ModalWindow on top of a datatable in a
 page.
   When a user clicks the Save ajax button in the modal window, a done
 event
  is bubbled up from the modal window.  The event contains the
  AjaxRequestTarget from the button.
 
  There are two components that listen for the done event:
 
  (1) the component that launched the ModalWindow -- this listener closes
 the
  modal window
  (2) a component farther up the hierarchy which contains (1) -- this
  listener (re) adds the datatable on the page
 
  I have verified that both listeners are being called and that they are
  called in the order above.  However, the datatable does not get refreshed
  in the browser.
 
  My question is: why didn't my datatable get re-rendered, even though I
 did
  (re) add it to the containing panel?  I think this has something to do
 with
  the datatable not realizing it is visible/active.  Or it may have
 something
  to do with the event system :).  Or perhaps even the AjaxRequestTarget
 from
  the panel in the modal window :).  I'm happy to put in some break points
  and walk through the code if you anyone has ideas of where to look.
 
  The workaround is to have (1) listen for the event and stop the event
  propagation.  Then, in the ModalWindow.setWindowClosedCallback(), send
 the
  event up to (2).  Doing this, the datatable does get properly refreshed.
 
  My followup question is: is this the pattern that should be followed when
  refreshing a panel under a modal window?  Namely, don't try to refresh
 the
  page/panel a ModalWindow is on top of until the covering ModalWindow has
  closed?
 
  Thanks
  Andrew
 



Re: stack traces in serialization caches

2012-08-10 Thread Andrew Geery
I'm using Wicket 1.5.7.  I understand how to turn the stacktraces on and
off (in development more I have both those settings turned on).  My
question is more: the files look like they are indicating an error is
happening, but I don't get a stacktrace at run-time.  For example, if I
have a mismatch between the Java class and the HTML I get a stacktrace at
run-time in development mode.  I'm running in development mode and I'm not
getting any stacktraces.  However, when I look at the wicket-filestore
files I am seeing stacktraces.  My questions are:

(1) Do the stacktraces in the wicket-filestore files indicate that there is
an error? The app seems to work fine, but a stacktrace would indicate an
error to me...
(2) If these are indeed errors, why are the errors on the wicket-filestore
files not being thrown at run-time when running in dev mode?

To make this more concrete, one place I'm seeing the errors is around
ModalWindow components.  Is the stacktrace simply saying that the
ModalWindow is not rendered on the page (which would be true, it is not yet
shown), but that it is present in the page's hierarchy?

Thanks
Andrew

On Fri, Aug 10, 2012 at 3:12 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 Which version of Wicket do you use ?

 See
 org.apache.wicket.settings.IDebugSettings#setLinePreciseReportingOnAddComponentEnabled
 and
 org.apache.wicket.settings.IDebugSettings#setLinePreciseReportingOnNewComponentEnabled.
 When set to true these create an exception and saves its stacktrace as
 String in the Component's meta data. This stacktrace is used to find
 when and where the problem happened.

 These stacktraces are printed only if
 org.apache.wicket.settings.IDebugSettings#getComponentUseCheck()
 returns true.


 On Fri, Aug 10, 2012 at 4:16 AM, Andrew Geery andrew.ge...@gmail.com
 wrote:
  I have a question about why I am seeing stack traces in my
 wicket-filestore
  files.  This question has been asked before (
 
 http://apache-wicket.1842946.n4.nabble.com/Strange-content-serialized-td1933194.html
 ),
  but I don't understand the answer.  When I run the app, I don't get any
  errors -- all of the components render fine.  However, in the files I see
  errors like this:
 
  The webmarkupcontainer with id 'content' that failed to render was added
 
  In the previous thread, the answer was that the error was there because
  there was a discrepancy between the Java hierarchy and the HTML file.
   However, if there was an error, wouldn't I get a run-time error (since I
  am running the app in development mode)?  Why, when there isn't
  a discrepancy, is there a stack trace in the cache?
 
  Thanks
  Andrew



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




issue refreshing covered panel when modalwindow is open

2012-08-10 Thread Andrew Geery
I've run into this issue a couple of times and worked around it, but I
wanted to see if there is a better way of handling it.

I have a form in a panel in a ModalWindow on top of a datatable in a page.
 When a user clicks the Save ajax button in the modal window, a done event
is bubbled up from the modal window.  The event contains the
AjaxRequestTarget from the button.

There are two components that listen for the done event:

(1) the component that launched the ModalWindow -- this listener closes the
modal window
(2) a component farther up the hierarchy which contains (1) -- this
listener (re) adds the datatable on the page

I have verified that both listeners are being called and that they are
called in the order above.  However, the datatable does not get refreshed
in the browser.

My question is: why didn't my datatable get re-rendered, even though I did
(re) add it to the containing panel?  I think this has something to do with
the datatable not realizing it is visible/active.  Or it may have something
to do with the event system :).  Or perhaps even the AjaxRequestTarget from
the panel in the modal window :).  I'm happy to put in some break points
and walk through the code if you anyone has ideas of where to look.

The workaround is to have (1) listen for the event and stop the event
propagation.  Then, in the ModalWindow.setWindowClosedCallback(), send the
event up to (2).  Doing this, the datatable does get properly refreshed.

My followup question is: is this the pattern that should be followed when
refreshing a panel under a modal window?  Namely, don't try to refresh the
page/panel a ModalWindow is on top of until the covering ModalWindow has
closed?

Thanks
Andrew


Re: Wicket 1.5.7: Links not working in WebSphere 6.1? Wrong redirection?

2012-06-27 Thread Andrew Geery
Use the Wicket servlet, not the filter:

http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-Websphere-6-1-td2309401.html

https://cwiki.apache.org/WICKET/websphere.html

Andrew

On Wed, Jun 27, 2012 at 8:40 AM, Jörn Gersdorf jo...@gersdorf.info wrote:

 Hi all,

 I have an application developped using Wicket 1.5.7. The app has a logout
 link setting the response page in the onClick() callback to some other page
 NotLoggedIn (see code below). This is working fine when the app is
 deployed to Tomcat 6.0 which I'm using in development mode.

 But it fails utterly when the application is being deployed to WebSphere
 6.1 with a 404 due to strange redirections:

 Server interaction in WebSphere 6.1:

   1) Client requests /xyz/?0-1.ILinkListener-logout
   2) Server answers with 302 to
 /xyz/wicket/bookmarkable/de.xyz.pages.nonsecure.NotLoggedIn
 3) Client requests
 /xyz/wicket/bookmarkable/de.xyz.pages.nonsecure.NotLoggedIn
 4) Server answers with 302 to /xyz/de.xyz.pages.nonsecure.NotLoggedIn?0
 (which is wrong! this doesn't exist!)
 5) Client requests /xyz/de.xyz.pages.nonsecure.NotLoggedIn?0
 6) Server answers with 404

 As comparison Server interaction in Tomcat (working):

   1) Client requests /xyz/?0-1.ILinkListener-logout
   2) Server answers with 302 to
 /xyz/wicket/bookmarkable/de.xyz.pages.nonsecure.NotLoggedIn
   3) Client requests
 xyz/wicket/bookmarkable/de.xyz.pages.nonsecure.NotLoggedIn
   4) Server answers with 302 to
 /xyz/wicket/bookmarkable/de.xyz.pages.nonsecure.NotLoggedIn?0
   5) Client requests
 /pms/wicket/bookmarkable/de.xyz.pages.nonsecure.NotLoggedIn?0
   6) Server answers with 200 etc.

 This is the code for setting up the logout link including the original
 redirect to NotLoggedIn.class:

  add(new LinkString(logout, Model.of(Logout)) {
@Override
public void onClick() {
  getSession().invalidate();
  setResponsePage(NotLoggedIn.class);
}
  });

 I'm using WicketFilter in my web.xml, where the filter mapping is
 configured as follows:

  filter-mapping
filter-namewicketFilter/filter-name
url-pattern/*/url-pattern
  /filter-mapping

 Thanks for any help!

 Best regards,
 Jörn



interesting issues with Wicket and Javassist

2012-06-22 Thread Andrew Geery
I've recently run across a couple of issues where a proxy'ed class (using
Javassist from Hibernate) has messed up Wicket.  When a class is proxy'ed
by Javassist, the class you have (say, Person) isn't really a Person class
but something like Person_$$_Javassist_48.

I had registered a converter with my Wicket app to provide a string
representation of a Person object.  I then had a datatable of Accounts
where one of the columns was a Person object (account.person).  When the
table displayed, the Person was correctly displayed using the converter.
 However, when I edited an account row (using a ModalWindow on the same
page via) and then re-added the datatable to the panel to the target, the
Person converter was not called; instead, the toString() method on the
Person object was called because Wicket was using the default converter
(toString()).

Looking more into the issue, the problem was that my LDM for the account
was only fetching the account data and the person data was marked as being
fetched lazily.  In my LDM, I did call account.getPerson() to force
Hibernate to load the association.  The Person object was populated but the
type of the object was still something like Person_$$_Javassist_48.  The
fix was to change the query that loaded the account row to also load the
person data.  Doing this, the person object was not proxied and Wicket used
the correct converter.  Otherwise, Wicket looks up the class
Person_$$_Javassist_48 and doesn't find a custom converter.

My question is: should Wicket have realized that the proxy'ed Person object
was actually a Person class and called the appropriate converter?  Looking
at this --
http://stackoverflow.com/questions/1139611/loading-javassist-ed-hibernate-entity
--
it looks like there is not a generic way of handling this, without
explicitly checking for something like a HibernateProxy.

Perhaps the answer is simply: make sure that proxies don't end up in the UI
layer?

Andrew


Re: Feedback next to each input field on form

2012-06-12 Thread Andrew Geery
Another great resource is _Apache Wicket Cookbook_ by Igor:
http://www.amazon.com/Apache-Wicket-Cookbook-Igor-Vaynberg/dp/1849511608.
Chapter three has a good discussion around what you're trying to do.

Andrew

On Tue, Jun 12, 2012 at 3:23 PM, srinash avisrid...@gmail.com wrote:

 Thank you both for the inputs. I will take a look and get back with my
 progress i guess.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Feedback-next-to-each-input-field-on-form-tp4649886p4649892.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




Re: reloading of HTML and classes

2012-04-20 Thread Andrew Geery
An issue I ran into with having Wicket reload the html files in development
mode is that it doesn't seem to work if the path to the html files has
spaces in it.  For example, running under Eclipse with the workspace in
c:\Documents and Settings\... html reloading did not work.  Taking the
exact same configuration but putting the workspace directly on the c:\
drive (e.g., c:\workspace), the htm reloading works perfectly.

Hope that helps.
Andrew

On Tue, Apr 10, 2012 at 2:45 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Sun, Apr 8, 2012 at 5:38 AM, Bernard bht...@gmail.com wrote:
  Hi,
 
  The HTML part is covered if your IDE copies HTML files to the
  deployment directory when you save them. Wicket will then pick up this
  change and reload the corresponding pages. This works for existing
  markup but not for new markup that was missing.


 https://github.com/wicketstuff/core/tree/master/jdk-1.7-parent/wicketstuff-wicket7
 provides an extension of Wicket's default
 ModificationWatcher that uses JDK7 NIO2 WatchService. This should help
 for this problem.

 
  The Java classes part can only be handled with debugging, JRebel or a
  complete re-deployment. There is no hot-deployment of individual
  classes in GlassFish (I don't know whether any other server supports
  this). However GlassFish has session preservation so the re-deploy
  process is seamless. To further speed up the deployment, one can copy
  most libraries (including Wicket) into the GlassFish domain's lib dir
  instead of copying them on every deployment.
 
  The Deploy on Save feature is only useful for mini applications - it
  is too slow.
 
  Bernard
 
 
  On Fri, 06 Apr 2012 16:48:11 +0200, you wrote:
 
 
 I've been fighting this for the past two days, but I'm not succeeding.
 I'm using Wicket 1.5.5 on GlassFish 3.1.2 and that runs without a problem.
 I have configured
 

 filter-classorg.apache.wicket.protocol.http.ReloadingWicketFilter/filter-class
 
 to reload the classes, but that is not working. The only way to reload
 the class file is by using JRebel.
 
 Also Wicket reports that it runs in DEVELOPMENT mode, but it is not
 reloading the HTML files. In an attempting to resolve that I explicitely
 configured
 
  getResourceSettings().setDefaultCacheDuration(Duration.ONE_SECOND);
 
 but that does not make a difference. The only way I can get it to work
 somewhat, is to add my own ResourceFinder directly on the src folder:
 
  getResourceSettings().setResourceFinder(new IResourceFinder()
  {
  @Override
  public IResourceStream find(Class? clazz, String pathname)
  {
  File f = new File(C:/Documents and Settings/User/My
 Documents/s2m/sources/components/service/src/main/java/ + pathname);
  if (f.exists())
  {
  return new FileResourceStream( f );
  }
  return null;
  }
  });
  getResourceSettings().setUseDefaultOnMissingResource(true);
 
 But still the source are not reloaded reliably. I figure if the cache
 expires, a new call to the resource finder should be done, correct?
 
 Is there any debugging of these autoreload features, so I can see what
 Wicket is doing?
 
 Tom
 
 
 
 
 
 -
 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
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




It is a better practice to push changes to state rather than pull

2012-04-16 Thread Andrew Geery
In the Javadoc for the Component#onConfigure() method, it states (in a
paragraph dealing with setting whether a component is visible and/or
enabled): It is a better practice to push changes to state rather than
pull. [
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/Component.html#onConfigure()
].

My reading of this sentence is that it is contrasting state change, where
changes should be pushed to the component, with data change, where changes
are pulled by the component from the model (i.e,  change the model, not the
component).

Does that sound correct?  Are there state changes other than being visible
and being enabled that should be done in onConfigure?

Thanks
Andrew


Re: Wicket 1.5 - Generic JSON Response

2012-04-12 Thread Andrew Geery
If you have a number of JSON end-points, the best architecture would
probably be to use Spring MVC to do the JSON handling, and then map the
Spring MVC paths into your web app using the Wicket filter ignore paths
option (
https://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-
).

Thanks
Andrew

On Thu, Apr 12, 2012 at 8:47 AM, Ahijah darren.gr...@gmail.com wrote:


 Martin Grigorov-4 wrote
 
  On Thu, Apr 12, 2012 at 7:38 AM, Ahijah lt;darren.greer@gt; wrote:
 
  mountResource(/Feed2, new MyResourceReference());
 
  class MyResourceReference extends ResourceReference {
public IResource getResource() { return new MyResource(); }
  }
 

 Thanks Martin!  For everyone else's reference, the final code that is
 working looks like this:

 --Feed.class
 public class Feed extends AbstractResource {

private static final long serialVersionUID = 1L;

 protected ResourceResponse newResourceResponse(Attributes a) {
 ResourceResponse r = new ResourceResponse();
r.setContentType(application/json);
r.setWriteCallback(new WriteCallback() {
public void writeData(Attributes a) {


 a.getResponse().write([{\id\:111,\title\:\MainEvent\,\start\:\2012-04-10T07:00:00\,\end\:\2012-04-10T09:30:00\,\url\:\?EventID=111\,\allDay\:false}]);
 }
});
return r;
}

 }
 ---End Feed.class--

 --Application.class
@Override
protected void init() {
super.init();
mountResource(/Feed, new FeedReference());
}

public class FeedReference extends ResourceReference {
public FeedReference() {
super(FeedReference.class, feed);
}
public IResource getResource() { return new Feed(); }
}
 ---End Application.class-

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-Generic-JSON-Response-tp4550807p4551752.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




Re: 404 error using Wicket 1.5.4 and Websphere 6.1

2012-04-11 Thread Andrew Geery
Wicket 1.5 requires servlet 2.5 [
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-%2528RC1%2529UpgradedtoServletAPI2.5
],
but WAS 6.1 only supports J2EE 1.4 (servlet 2.4) [
http://en.wikipedia.org/wiki/IBM_WebSphere_Application_Server#Version_6.1 ],
so I wouldn't expect Wicket 1.5 to work on WAS 6.1.

Andrew

On Wed, Apr 11, 2012 at 7:50 AM, rawe ralph.wey...@dachser.com wrote:

 Yes, also when a redirect is a normal operation it seems that
 Websphere 6.1 cannot handle it.
 see also the known problem with glassfish:
 https://issues.apache.org/jira/browse/WICKET-2732
 https://issues.apache.org/jira/browse/WICKET-2732

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/404-error-using-Wicket-1-5-4-and-Websphere-6-1-tp4548356p4548678.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




Re: AjaxRequestTarget.add(component) not replacing component, but duplicating it

2012-04-05 Thread Andrew Geery
You are correct: Chosen was indeed adding additional markup that was
throwing off Wicket's ability to replace the form control.

The workaround was to call jquery,remove to fix/clean up the DOM before
Wicket attempted to replace the tag in the renderOnDomReadyJavaScript
method of the behavior.

The select2 project looks great!  I can't wait to use it.

Thanks
Andrew

On Fri, Mar 30, 2012 at 2:42 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 Check what additional markup if generated by Chosen. It transforms
 select to more complex HTML structure.
 Then you'll have more information what should be done to replace the
 whole thing, not just to provide new select as what Wicket would do
 by default.

 I can also recommend you to take a look at
 http://ivaynberg.github.com/select2 . Soon-ish this will have Wicket
 wrapper component created by the Master (Igor Vaynberg).

 On Fri, Mar 30, 2012 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com
 wrote:
  I have a ListMultipleChoice component (Wicket 1.5.4) with a Behavior
 added
  to it to enable the use of the Chosen (
 http://harvesthq.github.com/chosen/ )
  JS library.  Everything works fine until I attempt to add() the component
  to a page in an AjaxRequestTarget.  Rather than replacing the component
 in
  the DOM, the add call creates a duplicate component.  Looking in the
 DOM, I
  end up with multiple divs with the same id.
 
  I'm guessing there is some weird interaction between the Chosen JS
 library
  and the Wicket AJAX library.  Has anyone seen anything like this before?
 
  Thanks
  Andrew



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




AjaxRequestTarget.add(component) not replacing component, but duplicating it

2012-03-29 Thread Andrew Geery
I have a ListMultipleChoice component (Wicket 1.5.4) with a Behavior added
to it to enable the use of the Chosen ( http://harvesthq.github.com/chosen/ )
JS library.  Everything works fine until I attempt to add() the component
to a page in an AjaxRequestTarget.  Rather than replacing the component in
the DOM, the add call creates a duplicate component.  Looking in the DOM, I
end up with multiple divs with the same id.

I'm guessing there is some weird interaction between the Chosen JS library
and the Wicket AJAX library.  Has anyone seen anything like this before?

Thanks
Andrew


Re: weird interaction between ModalWindow and jQuery mousedown binding

2012-03-14 Thread Andrew Geery
Line 749 of modal.js seems to have the answer that, yes, mousedown events
don't bubble out of a ModalWindow -- am I reading that correctly?

div class=\w_content_1\ onmousedown=\if (Wicket.Browser.isSafari()) {
event.ignore = true; } else { Wicket.stopEvent(event); } \+

Thanks
Andrew

On Wed, Mar 14, 2012 at 4:34 PM, Andrew Geery andrew.ge...@gmail.comwrote:

 I'm using the jQuery Multiselector (
 http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ ) with
 Wicket 1.4.19 (via jqWicket 0.6).  The multi-selector was straightforward
 to integrate with Wicket and use on a regular page.

 Using it in a ModalWindow was a little trickier because you have to
 manually add the JS + CSS to the header of the ModalWindow (which jqWicket
 takes care of for you on a regular page).

  Here's my problem:

 When I click outside of a multi-selector component on a regular page, the
 multiselector closes.  However, when I click outside of a multi-selector in
 the containing ModalWindow, it does not.

 I've traced the problem back to the following line in the multiselector
 (the self.close() method simply closes/rolls up the multiselector options):

$(document).bind('mousedown.multiselect', function (e) {
 if (self._isOpen  !$.contains(self.menu[0], e.target) 
 !$.contains(self.button[0], e.target)  e.target !== self.button[0]) {
 self.close();
 }
});

 I've verified that the mousedown bind does indeed happen in both the
 regular page and in the ModalWindow.

 The difference is that, on a regular page, the handler function is called
 when I click anywhere on the page (i.e., jQuery detects the mousdown
 event).  However, in the ModalWindow, the handler is not called when I
 click in the ModalWindow (i.e., jQuery does not detect the mousedown event
 in the context of the ModalWindow).  To make things more interesting, the
 handler is called if I click on the page *outside* of the ModalWindow.

 Is there anything in a ModalWindow that would make jQuery bind not work
 for mousedown events that target the ModalWindow itself?

 Thanks
 Andrew




Re: Wicket webshere 7

2012-01-23 Thread Andrew Geery
I've had a very similar problem with WAS 6.1 (basic functionality would
work but AJAX functionality did not).  The solution was simply to use the
Wicket servlet instead of the filter -- see
https://cwiki.apache.org/WICKET/websphere.html.  What made it hard to debug
was the fact that the Wicket filter implementation did work for aspects on
WAS, but it didn't work for AJAX calls.

HTH
Andrew

On Mon, Jan 23, 2012 at 12:23 PM, matteus matteu...@hotmail.com wrote:


 Yes, my application is running with the filter  Wicket Filter.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-websphere-7-tp4310810p4321364.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




Re: Spring secury + auth-roles authentication and authorization: access denied

2011-11-08 Thread Andrew Geery
See this:

http://apache-wicket.1842946.n4.nabble.com/Acegi-and-Wicket-auth-roles-td1846051.html

I would be willing to bet the problem is the order of your filter-mappings
in the web.xml -- Spring Security has to be first.

Andrew

On Tue, Nov 8, 2011 at 8:05 PM, James Carman
jcar...@carmanconsulting.comwrote:

 Take a look at wicketopia's example app.  It has spring security
 integration.

 Sent from tablet device.  Please excuse typos and brevity.
 On Nov 7, 2011 11:24 AM, massizigao fha...@online.de wrote: