Re: Render multiple panels concurrently

2015-06-14 Thread Robert Gründler
Thanks for the hint, i’ll give the FutureModel approach a try.


regards,

robert


On 14 Jun 2015 at 16:09:56, Martin Grigorov (mgrigo...@apache.org) wrote:

Hi,  

I have used [1] for similar task some times ago. I needed to make calls to  
external services which took some time. Wicket renders the components  
sequentially so the total time was the sum of all. By using FutureModel I  
reduced it to the time of the slowest external call.  
There is also a Java version at [2]. I haven't used it though.  

Another approach would be to use ComponentRenderer#renderComponent() that  
uses a temporary page. This way you can render the panels in parallel and  
then use the HTMLs as model objects of Labels  


1.  
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/model/FutureModel.scala
  
2.  
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/minis-parent/minis/src/main/java/org/wicketstuff/minis/model/FutureModel.java
  

Martin Grigorov  
Wicket Training and Consulting  
https://twitter.com/mtgrigorov  

On Sun, Jun 14, 2015 at 12:04 PM, Robert Gründler   
wrote:  

> Hi,  
>  
> our backend application has a page containing ~20 panels which render  
> health-checks of different components in our  
> infrastructure. Each one of these checks can take some time (~ 10 seconds)  
> until it timeouts if the background-component  
> is not reachable.  
>  
> Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due  
> to the fact, that wicket can only run  
> one ajax request at a time on a single page, this can result in extremely  
> long loading times until all panels are displayed.  
>  
> I’ve tried to implement the panel rendering using websockets - but it  
> seems i’m running in the same problem like the concurrent  
> ajax request issue - meaning that when i spawn the loading of the  
> expensive panel in the background, which page instance  
> should i use to render the panel?  
>  
> So my question is: Is there a way to render multiple panels concurrently  
> in wicket? Which each panel having it’s own timeout?  
>  
> regards  
>  
>  
> robert  
>  
>  
>  


Re: Render multiple panels concurrently

2015-06-14 Thread Martin Grigorov
Hi,

I have used [1] for similar task some times ago. I needed to make calls to
external services which took some time. Wicket renders the components
sequentially so the total time was the sum of all. By using FutureModel I
reduced it to the time of the slowest external call.
There is also a Java version at [2]. I haven't used it though.

Another approach would be to use ComponentRenderer#renderComponent() that
uses a temporary page. This way you can render the panels in parallel and
then use the HTMLs as model objects of Labels


1.
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/model/FutureModel.scala
2.
https://github.com/wicketstuff/core/blob/master/jdk-1.7-parent/minis-parent/minis/src/main/java/org/wicketstuff/minis/model/FutureModel.java

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, Jun 14, 2015 at 12:04 PM, Robert Gründler 
wrote:

> Hi,
>
> our backend application has a page containing ~20 panels which render
> health-checks of different components in our
> infrastructure. Each one of these checks can take some time (~ 10 seconds)
> until it timeouts if the background-component
> is not reachable.
>
> Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due
> to the fact, that wicket can only run
> one ajax request at a time on a single page, this can result in extremely
> long loading times until all panels are displayed.
>
> I’ve tried to implement the panel rendering using websockets - but it
> seems i’m running in the same problem like the concurrent
> ajax request issue - meaning that when i spawn the loading of the
> expensive panel in the background, which page instance
> should i use to render the panel?
>
> So my question is: Is there a way to render multiple panels concurrently
> in wicket? Which each panel having it’s own timeout?
>
> regards
>
>
> robert
>
>
>


Re: Render multiple panels concurrently

2015-06-14 Thread Sven Meier

Hi,

Wicket pages are single threaded, so no - you can't render multiple 
panels concurrently.


You should restructure you code so that the health checks are done 
asynchronously. The panels just check for the availability, and render 
some progress indicator as long as no data is available.


Regards
Sven

On 14.06.2015 11:04, Robert Gründler wrote:

Hi,

our backend application has a page containing ~20 panels which render 
health-checks of different components in our
infrastructure. Each one of these checks can take some time (~ 10 seconds) 
until it timeouts if the background-component
is not reachable.

Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due to 
the fact, that wicket can only run
one ajax request at a time on a single page, this can result in extremely long 
loading times until all panels are displayed.

I’ve tried to implement the panel rendering using websockets - but it seems i’m 
running in the same problem like the concurrent
ajax request issue - meaning that when i spawn the loading of the expensive 
panel in the background, which page instance
should i use to render the panel?

So my question is: Is there a way to render multiple panels concurrently in 
wicket? Which each panel having it’s own timeout?

regards


robert






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



Render multiple panels concurrently

2015-06-14 Thread Robert Gründler
Hi,

our backend application has a page containing ~20 panels which render 
health-checks of different components in our
infrastructure. Each one of these checks can take some time (~ 10 seconds) 
until it timeouts if the background-component
is not reachable.

Until now we’ve used AjaxLazyLoadingPanels to render those panels, but due to 
the fact, that wicket can only run
one ajax request at a time on a single page, this can result in extremely long 
loading times until all panels are displayed.

I’ve tried to implement the panel rendering using websockets - but it seems i’m 
running in the same problem like the concurrent
ajax request issue - meaning that when i spawn the loading of the expensive 
panel in the background, which page instance
should i use to render the panel?

So my question is: Is there a way to render multiple panels concurrently in 
wicket? Which each panel having it’s own timeout?

regards


robert




Re: Panels not refreshing when calling AjaxRequestTarget.add(), only in production mode

2015-06-03 Thread Martin Grigorov
Usually you should use a .
If you know that this component cannot have children with block HTML
elements then you can use  too.
Read about block vs inline HTML elements in the web.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jun 3, 2015 at 3:55 PM, lucast  wrote:

> Hi Martin,
> Thank you for your reply.
>
> Yes, you're absolutely right.
>
> I use: ** and it is pretty much
> how I add panels in the HTML code.
>
> What should I use instead, div, span, anything else?
>
> Thank you very much for pointing this out. I have been racking my brain for
> almost 5 days in total!!!
>
> Kind regards,
> Lucas
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Panels-not-refreshing-when-calling-AjaxRequestTarget-add-only-in-production-mode-tp4671035p4671044.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: Panels not refreshing when calling AjaxRequestTarget.add(), only in production mode

2015-06-03 Thread lucast
Hi Martin,
Thank you for your reply.

Yes, you're absolutely right. 

I use: ** and it is pretty much
how I add panels in the HTML code.

What should I use instead, div, span, anything else?

Thank you very much for pointing this out. I have been racking my brain for
almost 5 days in total!!!

Kind regards,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Panels-not-refreshing-when-calling-AjaxRequestTarget-add-only-in-production-mode-tp4671035p4671044.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: Panels not refreshing when calling AjaxRequestTarget.add(), only in production mode

2015-06-03 Thread Martin Grigorov
My guess is that you use  for something that
you update with Ajax.
You should see WARNs in the logs about it even in DEV mode.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jun 3, 2015 at 3:40 PM, lucast  wrote:

> Hi Sven,
> Thank you for your reply.
>
> Yes, I call formComponentPanel#setOutputMarkupPlaceholderTag(true) on all
> elements involved with the AjaxRequestTarget.
>
> I'm still trying to get to the bottom of this.
>
> What I am baffled about is why it doesn't work on production mode when it
> works without any problems in development mode.
>
> when on production mode, on firebug, I get the following error:
>
> *Wicket.Ajax: Wicket.Ajax.Call.processComponent: Component with id [[id29]]
> was not found while trying to perform markup update. Make sure you called
> component.setOutputMarkupId(true) on the component whose markup you are
> trying to update.*
>
> I have called setOutputMarkupPlaceholderTag(true) on the panel I am adding
> to AjaxRequestTarget.
>
> So the question is, has anyone experienced that a panel is refreshed when
> running a wicket app in development mode, and that the panel is not
> refreshed when running a wicket app in production mode?
>
> Thanks, once more,
> Lucas
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Panels-not-refreshing-when-calling-AjaxRequestTarget-add-only-in-production-mode-tp4671035p4671041.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: Panels not refreshing when calling AjaxRequestTarget.add(), only in production mode

2015-06-03 Thread lucast
Hi Sven,
Thank you for your reply.

Yes, I call formComponentPanel#setOutputMarkupPlaceholderTag(true) on all
elements involved with the AjaxRequestTarget.

I'm still trying to get to the bottom of this.

What I am baffled about is why it doesn't work on production mode when it
works without any problems in development mode.

when on production mode, on firebug, I get the following error:

*Wicket.Ajax: Wicket.Ajax.Call.processComponent: Component with id [[id29]]
was not found while trying to perform markup update. Make sure you called
component.setOutputMarkupId(true) on the component whose markup you are
trying to update.*

I have called setOutputMarkupPlaceholderTag(true) on the panel I am adding
to AjaxRequestTarget.

So the question is, has anyone experienced that a panel is refreshed when
running a wicket app in development mode, and that the panel is not
refreshed when running a wicket app in production mode?

Thanks, once more,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Panels-not-refreshing-when-calling-AjaxRequestTarget-add-only-in-production-mode-tp4671035p4671041.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: Panels not refreshing when calling AjaxRequestTarget.add(), only in production mode

2015-06-02 Thread Sven Meier

Do you call formComponentPanel#setOutputMarkupPlaceholderTag(true)?

Sven


On 02.06.2015 17:52, lucast wrote:

Dear Forum,
On a form which is inside a modal window, I have an ajax checkbox where if I
tick the box, I display a number of panels and if the checkbox is not
ticked, I hide said panels.

The functionality works well on development mode and does not work at all on
deployment mode.

I call
FormComponentPanel.setVisible( True/False ); and then,

AjaxRequestTarget.add( FormComponentPanel );

Has anyone experienced anything similar where ajax works on development mode
but not on deployment mode?


Thanks in advance,
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Panels-not-refreshing-when-calling-AjaxRequestTarget-add-only-in-production-mode-tp4671035.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



Panels not refreshing when calling AjaxRequestTarget.add(), only in production mode

2015-06-02 Thread lucast
Dear Forum,
On a form which is inside a modal window, I have an ajax checkbox where if I
tick the box, I display a number of panels and if the checkbox is not
ticked, I hide said panels.

The functionality works well on development mode and does not work at all on
deployment mode.

I call 
FormComponentPanel.setVisible( True/False ); and then,

AjaxRequestTarget.add( FormComponentPanel );

Has anyone experienced anything similar where ajax works on development mode
but not on deployment mode?


Thanks in advance,
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Panels-not-refreshing-when-calling-AjaxRequestTarget-add-only-in-production-mode-tp4671035.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: Using forms defined in panels

2015-02-26 Thread Sven Meier

Hi,

the easiest solution is declare regModel as final, then you can "do something" 
as follows:
 
form.add(new SubmitButton("register") {

public void onSubmit() {
  // do something
  regModel.getObject().getUserName();
}
});

Note that declaring models as final might me dangerous, since the model 
is kept in the component hierarchy but nobody detaches it. This is not 
the case here though, since RegistrationInputPanel will take care of it.


Regards
Sven

On 26.02.2015 09:18, Andrew Hall wrote:

Hi all,
I have a newbie question ...
In the free online guide for Wicket - best practices section,2 listings are 
provided as examples of how to encapsulate components in panels:
(http://wicket.apache.org/guide/guide/bestpractices.html#bestpractices_1)
Listing 3:// Good component
public class RegistrationInputPanel extends Panel{
 public RegistrationInputPanel(String id, IModel regModel) {
 super(id, regModel);
 IModel compound = new 
CompoundPropertyModel form = new Form("form", compound);
 // Correct: Add components to Form over the instance variable
 form.add(new TextField("username"));
 form.add(new TextField("firstname"));
 form.add(new TextField("lastname"));
 add(form);
 }
}
Listing 4:public class RegistrationPage extends Page {
 public RegistrationPage(IModel regModel) {
 Form form = new Form("form");
 form.add(new RegistrationInputPanel("registration", regModel);
 form.add(new SubmitButton("register") {
 public void onSubmit() {
   // do something
 }
 });
 add(form);
 }
}
I infer from this example that it is possible in Wicket to decouple the 
physical definition of a form (listing 3) from the code which is executed when 
a form is submitted (listing 4). I suppose the point is that different pages 
can reuse the same physical form and implement their own form submission logic.
Is it possible for the "// do something" in listing 4 to access the values of "username", 
"firstname" & "lastname" submitted through the form defined in listing 3?
If the answer is yes, then could anyone provide a snippet of code demonstrating 
how to do this? I've had a search and have not found an obvious way!
Thanks,
Andrew. 



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



Using forms defined in panels

2015-02-26 Thread Andrew Hall
Hi all,
I have a newbie question ...
In the free online guide for Wicket - best practices section,2 listings are 
provided as examples of how to encapsulate components in panels:
(http://wicket.apache.org/guide/guide/bestpractices.html#bestpractices_1)
Listing 3:// Good component
public class RegistrationInputPanel extends Panel{
public RegistrationInputPanel(String id, IModel regModel) {
super(id, regModel);
IModel compound = new 
CompoundPropertyModel form = new Form("form", compound);
// Correct: Add components to Form over the instance variable
form.add(new TextField("username"));
form.add(new TextField("firstname"));
form.add(new TextField("lastname"));
add(form);
}
}
Listing 4:public class RegistrationPage extends Page {
public RegistrationPage(IModel regModel) {
Form form = new Form("form");
form.add(new RegistrationInputPanel("registration", regModel);
form.add(new SubmitButton("register") {
public void onSubmit() {
  // do something
}
});
add(form);
}
}
I infer from this example that it is possible in Wicket to decouple the 
physical definition of a form (listing 3) from the code which is executed when 
a form is submitted (listing 4). I suppose the point is that different pages 
can reuse the same physical form and implement their own form submission logic.
Is it possible for the "// do something" in listing 4 to access the values of 
"username", "firstname" & "lastname" submitted through the form defined in 
listing 3?
If the answer is yes, then could anyone provide a snippet of code demonstrating 
how to do this? I've had a search and have not found an obvious way!
Thanks,
Andrew.   

Re: swap panels from child element

2015-02-02 Thread Martin Grigorov
Hi,

You can use Wicket Events -
http://www.wicket-library.com/wicket-examples-6.0.x/events/

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Feb 2, 2015 at 8:25 PM, Grün Christoph 
wrote:

> Andrea - thanks, but how can I access the panels from a child panel within
> the component hierarchy of a page without having to put them in the
> constructor of each child panel?
>
> best regards,
> Chris
>
> > Am 02.02.2015 um 19:02 schrieb Andrea Del Bene :
> >
> > Changing visibility is less complex and if the result looks good I would
> go for it.
> >> Hi,
> >>
> >> I would like to swap panels B and C when the user clicks on a certain
> div element in Subpanel Aa
> >>
> >> The Page consists of following panels:
> >> - Panel A > Subpanel Aa
> >> - Panel B
> >> - Panel C
> >>
> >> How can I access the panels B and C and replace them or change their
> visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target)
> method?
> >> Is it better to replace them or change their visibility?
> >>
> >> Subpanel Aa:
> >> …
> >> WebMarkupContainer div=new WebMarkupContainer(„item");
> >> div.setOutputMarkupId(true);
> >> div.add(new AjaxEventBehavior("onclick") {
> >> protected void onEvent(AjaxRequestTarget target) {
> >>
> >>
> >> }
> >> });
> >> ...
> >>
> >> Thanks,
> >> Chris
> >>
> >>
> >>
> >>
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
>
>


Re: swap panels from child element

2015-02-02 Thread Grün Christoph
Andrea - thanks, but how can I access the panels from a child panel within the 
component hierarchy of a page without having to put them in the constructor of 
each child panel?

best regards,
Chris

> Am 02.02.2015 um 19:02 schrieb Andrea Del Bene :
> 
> Changing visibility is less complex and if the result looks good I would go 
> for it.
>> Hi,
>> 
>> I would like to swap panels B and C when the user clicks on a certain div 
>> element in Subpanel Aa
>> 
>> The Page consists of following panels:
>> - Panel A > Subpanel Aa
>> - Panel B
>> - Panel C
>> 
>> How can I access the panels B and C and replace them or change their 
>> visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) 
>> method?
>> Is it better to replace them or change their visibility?
>> 
>> Subpanel Aa:
>> …
>> WebMarkupContainer div=new WebMarkupContainer(„item");
>> div.setOutputMarkupId(true);
>> div.add(new AjaxEventBehavior("onclick") {
>> protected void onEvent(AjaxRequestTarget target) {
>> 
>> 
>> }
>> });
>> ...
>> 
>> Thanks,
>> Chris
>> 
>> 
>> 
>> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Re: swap panels from child element

2015-02-02 Thread Sven Meier

Hi,

replacing is really easy:

  this.addOrReplace(panel);

... as long as all your panels have an identical Wicket id.

I often prefer this approach over changing visibility because of smaller 
session size (i.e. not keeping unused panels in the component tree) and 
simpler markup (i.e. not requiring a  for each panel).


Your mileage may vary.

Regards
Sven


On 02.02.2015 18:15, Chris wrote:

Hi,

I would like to swap panels B and C when the user clicks on a certain div 
element in Subpanel Aa

The Page consists of following panels:
- Panel A > Subpanel Aa
- Panel B
- Panel C

How can I access the panels B and C and replace them or change their visibility 
from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
Is it better to replace them or change their visibility?

Subpanel Aa:
…
WebMarkupContainer div=new WebMarkupContainer(„item");
div.setOutputMarkupId(true);
div.add(new AjaxEventBehavior("onclick") {
 protected void onEvent(AjaxRequestTarget target) {


 }
});
...

Thanks,
Chris







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



Re: swap panels from child element

2015-02-02 Thread Andrea Del Bene
Changing visibility is less complex and if the result looks good I would 
go for it.

Hi,

I would like to swap panels B and C when the user clicks on a certain div 
element in Subpanel Aa

The Page consists of following panels:
- Panel A > Subpanel Aa
- Panel B
- Panel C

How can I access the panels B and C and replace them or change their visibility 
from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
Is it better to replace them or change their visibility?

Subpanel Aa:
…
WebMarkupContainer div=new WebMarkupContainer(„item");
div.setOutputMarkupId(true);
div.add(new AjaxEventBehavior("onclick") {
 protected void onEvent(AjaxRequestTarget target) {


 }
});
...

Thanks,
Chris







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



swap panels from child element

2015-02-02 Thread Chris
Hi,

I would like to swap panels B and C when the user clicks on a certain div 
element in Subpanel Aa

The Page consists of following panels:
- Panel A > Subpanel Aa
- Panel B
- Panel C

How can I access the panels B and C and replace them or change their visibility 
from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
Is it better to replace them or change their visibility?

Subpanel Aa:
…
WebMarkupContainer div=new WebMarkupContainer(„item");
div.setOutputMarkupId(true);
div.add(new AjaxEventBehavior("onclick") {
protected void onEvent(AjaxRequestTarget target) {


}
});
...

Thanks,
Chris





Re: validation in form component panels in RefreshingView

2015-01-22 Thread lucast
Hi Martin,

I'm sorry to bother you with a second post. 

I have reproduced the behaviour described above in a simple project ( 
refreshingview.zip
<http://apache-wicket.1842946.n4.nabble.com/file/n4669090/refreshingview.zip> 
). Also, I put the mercurial project on bitbucket( hg clone
https://luc...@bitbucket.org/lucast/refreshingview).


The behaviour is as follow. 

Step 1, choose a number (3, for example) from the drop down list. A list of
3 entries of text fields will be displayed.

Step 2, choose a different number (2, for example) from the drop down list.
Only one entry of text field will be displayed. Even though the list model
has 2 entries, not one.

When an entry from the drop down list, located in HomePage is selected,
PersonListFormComponentPanel is updated.

On running the debugger, I noticed that inside
ReuseIfModelsEqualStrategy.getItems(), (line 86), on the bit that compares 
if (oldItem == null), on the first run, oldItem *is* null.
On the second run, *oldItem* *is not*.

That is why PersonRefreshingView.populateItem() is not called the second
time a number is selected from the drop down list.

How can I set *oldItem* to null so that it follows the very same behaviour
as when executed the first time?

If you happen to look inside
PersonListFormComponentPanel.PersonRefreshingView, you will notice that I
have implemented PersonModel, with equals and hashcode functions.


Anyway, this is something I honestly cannot get my head around. I have tried
for days now and I find it most puzzling.

Any tips, or hints in the right direction will be much appreciated.

Thanks, once more,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669090.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: validation in form component panels in RefreshingView

2015-01-22 Thread lucast
Hi Martin,
Thank you for taking the time to reply.

I have implemented hashcode and equals on the object, and the Model class
used inside the RefreshingView and the ListModel class that is passed to the
RefreshingView.


In order to be able to display the right number of entries, I clear the list
inside the ListModel and populate it again with  N numbers of initialized
objects. The variables in those objects are all null. 


This works on the first run but not on the second.

In stepping through the code with debugger, hashcode and equal are called
only for the the actual object and the model object, not for the ListModel.

Since all objects are empty (no variables have been populated) the models
and the actual objects all return the same hash code.

But this surely is of no relevance since I am using a List, not a set. 

I've been looking at this for a while, and perhaps I have lost the sense of
perspective, but I cannot see what I am doing wrong.

Kind regards,
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669088.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: validation in form component panels in RefreshingView

2015-01-22 Thread Martin Grigorov
Hi,

On Thu, Jan 22, 2015 at 3:16 PM, lucast  wrote:

> Thank you, Martin,
>
> I have used ReuseIfModelsEqualStrategy and the validation message side of
> it
> work but now I have a different problem.
>
> When I navigate away from the form panel, update the list of objects and
> navigate back to the FormComponentPanel that holds the RefreshingView, only
> one item from the list gets displayed.
>
> I use a ListModel to pass the list of objects to the FormComponentPanel.
>
> When used for the first time, the RefreshingView calls getItemModels() and
> populateItem(), but after updating the ListModel, RefreshingView only calls
> getItemModels() and *not* populateItem().
>
> Would you happen to know why that is?
>
> If I use DefaultItemReuseStrategy.getInstance() then  getItemModels() and
> populateItem() get called every time. But that just takes me back to square
> 1.
>
> I'm not sure if this is relevant. ReuseIfModelsEqualStrategy documentation
> states that " the model and not the model object needs to implement the
> Object.equals(Object) and Object.hashCode() methods".
>
> I'm terribly sorry but I'm not sure completely understand that statement.
> Would that be something to do with the RefreshingView not displaying all
> items in the list model.
>

This says that your model object has to have proper impls of #equals() and
#hashCode() methods. Just like when you put instances of this class in
HashMap.

I guess this will solve your problem.


>
> On trying to interpret that statement, on RefreshingView.getItemModels(), I
> return an anonymous class that extends ModelIteratorAdapter. And on
> ModelIteratorAdapter.model, I return an custom Model with extends Model Application Object>. It is there that I implement hashcode and equals. But
> the problem still persists.
>
> I hope I'm not making things more confusing by writing extensively, but I
> just wanted to put it out there, in case there was something simple and
> small that I am missing.
>
> Thanks in advance,
> Lucas
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669081.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: validation in form component panels in RefreshingView

2015-01-22 Thread lucast
Thank you, Martin,

I have used ReuseIfModelsEqualStrategy and the validation message side of it
work but now I have a different problem.

When I navigate away from the form panel, update the list of objects and
navigate back to the FormComponentPanel that holds the RefreshingView, only
one item from the list gets displayed.

I use a ListModel to pass the list of objects to the FormComponentPanel.

When used for the first time, the RefreshingView calls getItemModels() and
populateItem(), but after updating the ListModel, RefreshingView only calls
getItemModels() and *not* populateItem(). 

Would you happen to know why that is?

If I use DefaultItemReuseStrategy.getInstance() then  getItemModels() and
populateItem() get called every time. But that just takes me back to square
1.

I'm not sure if this is relevant. ReuseIfModelsEqualStrategy documentation
states that " the model and not the model object needs to implement the
Object.equals(Object) and Object.hashCode() methods".

I'm terribly sorry but I'm not sure completely understand that statement.
Would that be something to do with the RefreshingView not displaying all
items in the list model.

On trying to interpret that statement, on RefreshingView.getItemModels(), I
return an anonymous class that extends ModelIteratorAdapter. And on
ModelIteratorAdapter.model, I return an custom Model with extends Model. It is there that I implement hashcode and equals. But
the problem still persists.

I hope I'm not making things more confusing by writing extensively, but I
just wanted to put it out there, in case there was something simple and
small that I am missing.

Thanks in advance,
Lucas




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669081.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: validation in form component panels in RefreshingView

2015-01-21 Thread Martin Grigorov
org.apache.wicket.markup.repeater.RefreshingView#setItemReuseStrategy(org.apache.wicket.markup.repeater.ReuseIfModelsEqualStrategy#getInstance())

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jan 21, 2015 at 6:59 PM, lucast  wrote:

> Dear forum,
>
> I'm implementing a tabbed panel.
> On first panel, user selects number of items. On second tab, user enters
> details for each item.
>
> I've implemented a RefreshingView so that the number of items on list
> reflects the number of items selected by user.
>
> To bundle all of the fields together I use a form component panel and for
> each entry on the RefreshingView, I add a form component panel.
>
> The text fields have FieldDecorators, as explained on the Apache Wicket
> Cookbook, chapter 3.
>
> The problem is that when I submit the form, the error messages for each
> field are not shown on the text field FieldDecorators.
>
> If I use RepeatingView, error messages are displayed as intended. But my
> list is dynamic.
>
> How can I get the proper validation message displayed inside the form
> component panel, used in a RefreshingView?
>
> Thanks in advance,
> Lucas
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068.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
>
>


validation in form component panels in RefreshingView

2015-01-21 Thread lucast
Dear forum,

I'm implementing a tabbed panel. 
On first panel, user selects number of items. On second tab, user enters
details for each item.

I've implemented a RefreshingView so that the number of items on list
reflects the number of items selected by user.

To bundle all of the fields together I use a form component panel and for
each entry on the RefreshingView, I add a form component panel.

The text fields have FieldDecorators, as explained on the Apache Wicket
Cookbook, chapter 3.

The problem is that when I submit the form, the error messages for each
field are not shown on the text field FieldDecorators.

If I use RepeatingView, error messages are displayed as intended. But my
list is dynamic.

How can I get the proper validation message displayed inside the form
component panel, used in a RefreshingView?

Thanks in advance,
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068.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: replacing panels using replaceWith in wicket

2015-01-20 Thread K
Hi i have been strugguling with this for a while. could you please suggest
changes.

   

Scenario: when i search for a job, if a job exists job is displayed in this
panel and if the job does not exist it is redirected back to the search
panel. i am unable to redirect back to the search panel.


-
K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replacing-panels-using-replaceWith-in-wicket-tp4669020p4669056.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: replacing panels using replaceWith in wicket

2015-01-18 Thread K
thanks Sven

i wanted to know how to get around it. i got the solution for it. 

Using #onInitilize() method to add the jobdetails panel and then use the
replacewith method.

Thanks

-
K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replacing-panels-using-replaceWith-in-wicket-tp4669020p4669022.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: replacing panels using replaceWith in wicket

2015-01-17 Thread Sven Meier

Hi,


AgileJobDetails.this.replaceWith(...)


your AgileJobDetails is not yet added to a parent, yet you're trying to replace 
it with another component.

Check your component hierarchy.

Regards
Sven


On 17.01.2015 16:14, K wrote:

Hi i am trying to navigate between two panels. my code has a condition where
if false it has to go back to the actual panel with parameters which in turn
prints a error msg in feedbackpanel.

i am getting this error when condition is true.

   









Please suggest how to redirect to actual panel.
Thanks

-
K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replacing-panels-using-replaceWith-in-wicket-tp4669020.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



replacing panels using replaceWith in wicket

2015-01-17 Thread K
Hi i am trying to navigate between two panels. my code has a condition where
if false it has to go back to the actual panel with parameters which in turn
prints a error msg in feedbackpanel.

i am getting this error when condition is true.

  

   



   

Please suggest how to redirect to actual panel.
Thanks

-
K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replacing-panels-using-replaceWith-in-wicket-tp4669020.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: Dynamically adding/removing panels to existing form

2014-08-14 Thread login.masater.de
worked like a charm and so easy :D

thank you

> Sven Meier  hat am 13. August 2014 um 20:31 geschrieben:
>
>
> A ListView should do fine:
>
> form.add(new ListView("addresses", new
> PropertyModel>(person, "adresses")) {
> populateItem(ListItem item) {
> item.add(new AddressPanel("address", item.getModel()));
> }
> });
>
> AjaxSubmitLink addLink = new AjaxSubmitLink("addAddress", form) {
> @Override protected void onSubmit(AjaxRequestTarget target, Form
> form) {
> person.newAddress();
>
> target.add(getPage());
> }
> } ;
>
>
> Sven
>
> On 08/13/2014 06:40 PM, login.masater.de wrote:
> > Hi there,
> > I'm new to wicket and got a problem, I searched google and the mailing list
> > for
> > 2 days now but can't find what I'm searching for, here is an reduced example
> > of
> > what I'm trying to do.
> > This is very simplified and not the domain I'm working in, this is just used
> > for
> > ease. I'm using wicket:6:16:0.
> > The Example in short: I have a person with multiple addresses. For the
> > person
> > there is a form with a textfield for the name. Under that textfield is an
> > ajax
> > link to add a panel containing an form for an address. The background-model
> > is a
> > class person with a name string and a list of addresses and an address class
> > with a street/city string.
> > My problem now is how i can dynamically add addresses to that person.
> >
> > Models:
> > ===Person.java===
> > ...
> > private String name;
> > private List addresses;
> > //getter/setter
> > ...
> > ===/Person.java===
> > ===Address.java===
> > ...
> > private String street;
> > private String city;
> > ...
> > //getter/setter
> > 
> > ===/Address.java===
> >
> > ===AddressPanel.java===
> > ...
> > public Address(String id, IModel model) {
> > super(id, model);
> > SetDefaultModel(model);
> > Form form = new Form("form");
> > TextField street = new TextField("street");
> > form.add(street);
> > TextField city = new TextField("city");
> > form.add(city);
> > add(city);
> > }
> > ===/AddressPanel.java===
> > ===AddressPanel.html===
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ===/AddressPanel.html===
> >
> > ===PersonPage.html===
> > 
> > 
> > 
> > 
> > add address
> > 
> > 
> > ===/PersonPage.html===
> > ===PersonPage.java===
> > public class PersonPage extends WebPage {
> > Person person;
> > public PersonPage() {
> > person = new Person();
> > setDefaultModel(new CompoundPropertyModel(person);
> > Form form = new Form("form");
> > TextField name = new TextField("name");
> > form.add(name);
> > add(form);
> >
> > //And here the troube begins, do I use an ListView? If so for AddressPanel
> > I think, but which model do I give to it?
> >
> > AjaxSubmitLink addLink = new AjaxSubmitLink("addAddress", form) {
> > @Override
> > protected void onSubmit(AjaxRequestTarget target, Form form) {
> > // Do I now create a new Address or AddressPanel? If I create an
> > AddressPanel which Model do I use? How is the Address appended to the
> > addresses
> > list in Person?
> > }
> > }
> > }
> > }
> >
> > many thanks in advance
> > Gunnar
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

Re: Dynamically adding/removing panels to existing form

2014-08-13 Thread Sven Meier

A ListView should do fine:

form.add(new ListView("addresses", new 
PropertyModel>(person, "adresses")) {

populateItem(ListItem item) {
  item.add(new AddressPanel("address", item.getModel()));
}
});

AjaxSubmitLink addLink = new AjaxSubmitLink("addAddress", form) {
@Override protected void onSubmit(AjaxRequestTarget target, Form 
form) {

 person.newAddress();

 target.add(getPage());
}
} ;


Sven

On 08/13/2014 06:40 PM, login.masater.de wrote:

Hi there,
I'm new to wicket and got a problem, I searched google and the mailing list for
2 days now but can't find what I'm searching for, here is an reduced example of
what I'm trying to do.
This is very simplified and not the domain I'm working in, this is just used for
ease. I'm using wicket:6:16:0.
The Example in short: I have a person with multiple addresses. For the person
there is a form with a textfield for the name. Under that textfield is an ajax
link to add a panel containing an form for an address. The background-model is a
class person with a name string and a list of addresses and an address class
with a street/city string.
My problem now is how i can dynamically add addresses to that person.

Models:
===Person.java===
...
private String name;
private List addresses;
//getter/setter
...
===/Person.java===
===Address.java===
...
private String street;
private String city;
...
//getter/setter

===/Address.java===

===AddressPanel.java===
...
public Address(String id, IModel model) {
   super(id, model);
   SetDefaultModel(model);
   Form form = new Form("form");
   TextField street = new TextField("street");
   form.add(street);
   TextField city = new TextField("city");
form.add(city);
add(city);
}
===/AddressPanel.java===
===AddressPanel.html===

   
 
   
   
 
   

===/AddressPanel.html===

===PersonPage.html===

 
   
   
   add address
 

===/PersonPage.html===
===PersonPage.java===
public class PersonPage extends WebPage {
 Person person;
 public PersonPage() {
   person = new Person();
   setDefaultModel(new CompoundPropertyModel(person);
   Form form = new Form("form");
   TextField name = new TextField("name");
   form.add(name);
   add(form);

  //And here the troube begins, do I use an ListView? If so for AddressPanel
I think, but which model do I give to it?

   AjaxSubmitLink addLink = new AjaxSubmitLink("addAddress", form) {
 @Override
 protected void onSubmit(AjaxRequestTarget target, Form form) {
   // Do I now create a new Address or AddressPanel? If I create an
AddressPanel which Model do I use? How is the Address appended to the addresses
list in Person?
 }
   }
}
}

many thanks in advance
Gunnar



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



Dynamically adding/removing panels to existing form

2014-08-13 Thread login.masater.de
Hi there,
I'm new to wicket and got a problem, I searched google and the mailing list for
2 days now but can't find what I'm searching for, here is an reduced example of
what I'm trying to do.
This is very simplified and not the domain I'm working in, this is just used for
ease. I'm using wicket:6:16:0.
The Example in short: I have a person with multiple addresses. For the person
there is a form with a textfield for the name. Under that textfield is an ajax
link to add a panel containing an form for an address. The background-model is a
class person with a name string and a list of addresses and an address class
with a street/city string.
My problem now is how i can dynamically add addresses to that person.

Models:
===Person.java===
...
private String name;
private List addresses;
//getter/setter
...
===/Person.java===
===Address.java===
...
private String street;
private String city;
...
//getter/setter

===/Address.java===

===AddressPanel.java===
...
public Address(String id, IModel model) {
  super(id, model);
  SetDefaultModel(model);
  Form form = new Form("form");
  TextField street = new TextField("street");
  form.add(street);
  TextField city = new TextField("city");
   form.add(city);
   add(city);
}
===/AddressPanel.java===
===AddressPanel.html===

  

  
  

  

===/AddressPanel.html===

===PersonPage.html===


  
  
  add address


===/PersonPage.html===
===PersonPage.java===
public class PersonPage extends WebPage {
Person person;
public PersonPage() {
  person = new Person();
  setDefaultModel(new CompoundPropertyModel(person);
  Form form = new Form("form");
  TextField name = new TextField("name");
  form.add(name);
  add(form);

 //And here the troube begins, do I use an ListView? If so for AddressPanel
I think, but which model do I give to it?

  AjaxSubmitLink addLink = new AjaxSubmitLink("addAddress", form) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
  // Do I now create a new Address or AddressPanel? If I create an
AddressPanel which Model do I use? How is the Address appended to the addresses
list in Person?
}
  }
   }
}

many thanks in advance
Gunnar

Re: Adding/Remiving Panels

2014-04-02 Thread David Beer
Hi I have fixed the problem by adding setOutputMarkupPlaceholderTag(true);
to the top component.

Thanks

David


On 2 April 2014 18:55, David Beer  wrote:

> Hi
>
> I am able to remove the panel by accessing the top most component (form)
> and setting visible to false. This removes the panel from the page, however
> I am having difficulty adding the panel back to the page. I get and Ajax
> error saying component id can't be found.
>
> The source is availble here
> https://github.com/dmbeer/wicket-bootstrap-example/tree/master/src/main/java/exampleUserAccountPage
>  and the Panel's there.
>
> The Wicket Ajax Debug Content is as follows;
>
> *INFO: *Received ajax response (1570 characters)
> *INFO: *
>
>  > >
>  *INFO: *Response processed successfully.
> *INFO: *refocus last focused component not needed/allowed
> *INFO: *Received ajax response (2916 characters)
> *INFO: *
>
>  > > >
>  *ERROR: *
> Wicket.Ajax.Call.processComponent: Component with id [[form1c]] was not found 
> while trying to perform markup update. Make sure you called 
> component.setOutputMarkupId(true) on the component whose markup you are 
> trying to update.
>  *INFO: *Response processed successfully.
> *INFO: *refocus last focused component not needed/allowed
>
> How can I re-enable the component.
>
> Thanks
>
> David
>
>
>
>
> On 1 April 2014 12:37, David Beer  wrote:
>
>> Hi Martin
>>
>> Thanks for your information here. So if I had a page which extends from a
>> base page and adds the header footer, then added the content which is
>> basically two column, in order to use a menu on the left to change some of
>> the content on the right I could use a combination of Ajax to swap the
>> content.
>>
>> Thanks
>>
>> David
>>
>>
>>
>> On 1 April 2014 08:04, Martin Grigorov  wrote:
>>
>>> Hi,
>>>
>>>
>>> On Mon, Mar 31, 2014 at 1:53 PM, David Beer 
>>> wrote:
>>>
>>> > Hi All
>>> >
>>> > I am in the process of building a user account page, which will have a
>>> menu
>>> > on the left, and the related content on the right.
>>> >
>>> > I would like the content on the right to be swapped depending on the
>>> > selection on the left. As in the content on the right might well be
>>> > generated by panels or fragments and then added to the page and the
>>> > previous unrelated removed.
>>> >
>>> > Is it better to have all the code added to the html and then hide
>>> certain
>>> > components and then re-enable them on selection and disable them or is
>>> it
>>> > better to use a panels and a page hierarchy and to pass information
>>> between
>>> > panels and parent page.
>>> >
>>>
>>> In my experience I have preferred the second approach - a mix of pages
>>> and
>>> panels.
>>> If you want to replace the right part with Ajax then you need to replace
>>> panels.
>>> If Ajax is not required then you can show a sub page that inherits the
>>> base
>>> layout from a main page and has something custom in the right part.
>>>
>>>
>>> >
>>> > Any thoughts and examples are always appreciated.
>>> >
>>> > Thanks
>>> >
>>> > David
>>> >
>>>
>>
>>
>


Re: Adding/Remiving Panels

2014-04-02 Thread David Beer
Hi

I am able to remove the panel by accessing the top most component (form)
and setting visible to false. This removes the panel from the page, however
I am having difficulty adding the panel back to the page. I get and Ajax
error saying component id can't be found.

The source is availble here
https://github.com/dmbeer/wicket-bootstrap-example/tree/master/src/main/java/exampleUserAccountPage
and the Panel's there.

The Wicket Ajax Debug Content is as follows;

*INFO: *Received ajax response (1570 characters)
*INFO: *

 *INFO: *Response processed successfully.
*INFO: *refocus last focused component not needed/allowed
*INFO: *Received ajax response (2916 characters)
*INFO: *

 *ERROR: *
Wicket.Ajax.Call.processComponent: Component with id [[form1c]] was
not found while trying to perform markup update. Make sure you called
component.setOutputMarkupId(true) on the component whose markup you
are trying to update.
 *INFO: *Response processed successfully.
*INFO: *refocus last focused component not needed/allowed

How can I re-enable the component.

Thanks

David




On 1 April 2014 12:37, David Beer  wrote:

> Hi Martin
>
> Thanks for your information here. So if I had a page which extends from a
> base page and adds the header footer, then added the content which is
> basically two column, in order to use a menu on the left to change some of
> the content on the right I could use a combination of Ajax to swap the
> content.
>
> Thanks
>
> David
>
>
>
> On 1 April 2014 08:04, Martin Grigorov  wrote:
>
>> Hi,
>>
>>
>> On Mon, Mar 31, 2014 at 1:53 PM, David Beer 
>> wrote:
>>
>> > Hi All
>> >
>> > I am in the process of building a user account page, which will have a
>> menu
>> > on the left, and the related content on the right.
>> >
>> > I would like the content on the right to be swapped depending on the
>> > selection on the left. As in the content on the right might well be
>> > generated by panels or fragments and then added to the page and the
>> > previous unrelated removed.
>> >
>> > Is it better to have all the code added to the html and then hide
>> certain
>> > components and then re-enable them on selection and disable them or is
>> it
>> > better to use a panels and a page hierarchy and to pass information
>> between
>> > panels and parent page.
>> >
>>
>> In my experience I have preferred the second approach - a mix of pages and
>> panels.
>> If you want to replace the right part with Ajax then you need to replace
>> panels.
>> If Ajax is not required then you can show a sub page that inherits the
>> base
>> layout from a main page and has something custom in the right part.
>>
>>
>> >
>> > Any thoughts and examples are always appreciated.
>> >
>> > Thanks
>> >
>> > David
>> >
>>
>
>


Re: Adding/Remiving Panels

2014-04-01 Thread David Beer
Hi Martin

Thanks for your information here. So if I had a page which extends from a
base page and adds the header footer, then added the content which is
basically two column, in order to use a menu on the left to change some of
the content on the right I could use a combination of Ajax to swap the
content.

Thanks

David



On 1 April 2014 08:04, Martin Grigorov  wrote:

> Hi,
>
>
> On Mon, Mar 31, 2014 at 1:53 PM, David Beer 
> wrote:
>
> > Hi All
> >
> > I am in the process of building a user account page, which will have a
> menu
> > on the left, and the related content on the right.
> >
> > I would like the content on the right to be swapped depending on the
> > selection on the left. As in the content on the right might well be
> > generated by panels or fragments and then added to the page and the
> > previous unrelated removed.
> >
> > Is it better to have all the code added to the html and then hide certain
> > components and then re-enable them on selection and disable them or is it
> > better to use a panels and a page hierarchy and to pass information
> between
> > panels and parent page.
> >
>
> In my experience I have preferred the second approach - a mix of pages and
> panels.
> If you want to replace the right part with Ajax then you need to replace
> panels.
> If Ajax is not required then you can show a sub page that inherits the base
> layout from a main page and has something custom in the right part.
>
>
> >
> > Any thoughts and examples are always appreciated.
> >
> > Thanks
> >
> > David
> >
>


Re: Adding/Remiving Panels

2014-04-01 Thread Martin Grigorov
Hi,


On Mon, Mar 31, 2014 at 1:53 PM, David Beer  wrote:

> Hi All
>
> I am in the process of building a user account page, which will have a menu
> on the left, and the related content on the right.
>
> I would like the content on the right to be swapped depending on the
> selection on the left. As in the content on the right might well be
> generated by panels or fragments and then added to the page and the
> previous unrelated removed.
>
> Is it better to have all the code added to the html and then hide certain
> components and then re-enable them on selection and disable them or is it
> better to use a panels and a page hierarchy and to pass information between
> panels and parent page.
>

In my experience I have preferred the second approach - a mix of pages and
panels.
If you want to replace the right part with Ajax then you need to replace
panels.
If Ajax is not required then you can show a sub page that inherits the base
layout from a main page and has something custom in the right part.


>
> Any thoughts and examples are always appreciated.
>
> Thanks
>
> David
>


Adding/Remiving Panels

2014-03-31 Thread David Beer
Hi All

I am in the process of building a user account page, which will have a menu
on the left, and the related content on the right.

I would like the content on the right to be swapped depending on the
selection on the left. As in the content on the right might well be
generated by panels or fragments and then added to the page and the
previous unrelated removed.

Is it better to have all the code added to the html and then hide certain
components and then re-enable them on selection and disable them or is it
better to use a panels and a page hierarchy and to pass information between
panels and parent page.

Any thoughts and examples are always appreciated.

Thanks

David


Re: How to get data from Panels

2014-01-19 Thread Paul Bors
Reading your question closer, I think you’re looking for setResponsePage(new 
MyWebPage(objModel, or model, or PageParameters).

Anyway that’s explained in detailed in the guide.

On Jan 19, 2014, at 11:18 PM, Paul Bors  wrote:

> Your question is too generic to answer.
> 
> If you’re new to Wicket that’s okay, I would suggest starting with chapter 12 
> “Wicket forms in detail" of the Wicket free User Guide at:
> http://wicket.apache.org/guide/guide/single.html#chapter11
> 
> You should also read the entire guide to pick up Wicket faster:
> http://wicket.apache.org/start/userguide.html
> 
> ~ Thank you,
>   Paul Bors
> 
> On Jan 19, 2014, at 12:22 PM, Baba  wrote:
> 
>> A panel contain form, after submitting form how to get user input as part of
>> MyWebPage(which extends WebPage)
>> 
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/How-to-get-data-from-Panels-tp4663822.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: How to get data from Panels

2014-01-19 Thread Paul Bors
Your question is too generic to answer.

If you’re new to Wicket that’s okay, I would suggest starting with chapter 12 
“Wicket forms in detail" of the Wicket free User Guide at:
http://wicket.apache.org/guide/guide/single.html#chapter11

You should also read the entire guide to pick up Wicket faster:
http://wicket.apache.org/start/userguide.html

~ Thank you,
   Paul Bors

On Jan 19, 2014, at 12:22 PM, Baba  wrote:

> A panel contain form, after submitting form how to get user input as part of
> MyWebPage(which extends WebPage)
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/How-to-get-data-from-Panels-tp4663822.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: How to get data from Panels

2014-01-19 Thread tertioptus
You do understand the concept of models right?

Depending on that and what exactly you are trying to do, I may be able to
advise you further.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-get-data-from-Panels-tp4663822p4663824.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



How to get data from Panels

2014-01-19 Thread Baba
A panel contain form, after submitting form how to get user input as part of
MyWebPage(which extends WebPage)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-get-data-from-Panels-tp4663822.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: Testing panels

2013-10-20 Thread Jens Jahnke
On Sun, 20 Oct 2013 10:51:25 +0200
Jens Jahnke  wrote:

JJ> Unable to find component with id 'newrelic-header' in
JJ> [NewRelicHeader [Component id = testObject]] Expected:
JJ> 'testObject:newrelic-header'. Found with similar names:
JJ> 'testObject:new-relic-header'

I should stop coding after short nights... :-)
Just another typo (new-relic versus newrelic).

Thanks very much everything works fine now.

Regards,

Jens

-- 
20. Gilbhart 2013, 11:07
Homepage : http://www.jan0sch.de

You know, the difference between this company and
the Titanic is that the Titanic had paying customers.


pgpq_0ofDz33Y.pgp
Description: PGP signature


Re: Testing panels

2013-10-20 Thread Jens Jahnke
On Sun, 20 Oct 2013 10:30:33 +0200
"per.newgro"  wrote:

PN> Die you wrote already the markup file? It should be named
PN> NewRel...Panel.HTML

Argh, thanks for the hint. My markup file was named wrong it read
NewRelicHeaderCode.html. :p

I changed it to NewRelicHeader.html but now I get a different error
message:

Unable to find component with id 'newrelic-header' in [NewRelicHeader 
[Component id = testObject]]
Expected: 'testObject:newrelic-header'.
Found with similar names: 'testObject:new-relic-header'

Regards,

Jens

-- 
20. Gilbhart 2013, 10:49
Homepage : http://www.jan0sch.de

I don't know why anyone would want a computer in their home.
-- Ken Olsen, president of DEC, 1974


pgpBLp4AfgIHa.pgp
Description: PGP signature


Re: Testing panels

2013-10-20 Thread per.newgro
Die you wrote already the markup file? It should be named NewRel...Panel.HTML
Cheers
Per
--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.



Jens Jahnke  schrieb:

Hi,

I'm using wicket 6.11.0 and try to test some panels.
The test code looks like this:

public class NewRelicHeaderTest {
private WicketTester tester;

@Before
public void setUp() throws Exception {
tester = new WicketTester(new MyApplication());
}

@Test
public void testNewRelicHeaderPanel() {
tester.startComponentInPage(new NewRelicHeader("newRelicHeader"));
}
}

But what I get is always an exception:

MarkupNotFoundException: Failed to find markup file associated. NewRelicHeader: 
[NewRelicHeader [Component id = newRelicHeader]]

Is there something I am missing?

Regards,

Jens

--
20. Gilbhart 2013, 09:43
Homepage : http://www.jan0sch.de

You will engage in a profitable business activity.



Testing panels

2013-10-20 Thread Jens Jahnke
Hi,

I'm using wicket 6.11.0 and try to test some panels.
The test code looks like this:

public class NewRelicHeaderTest {
private WicketTester tester;

@Before
public void setUp() throws Exception {
tester = new WicketTester(new MyApplication());
}

@Test
public void testNewRelicHeaderPanel() {
tester.startComponentInPage(new NewRelicHeader("newRelicHeader"));
}
}

But what I get is always an exception:

MarkupNotFoundException: Failed to find markup file associated. NewRelicHeader: 
[NewRelicHeader [Component id = newRelicHeader]]

Is there something I am missing?

Regards,

Jens

-- 
20. Gilbhart 2013, 09:43
Homepage : http://www.jan0sch.de

You will engage in a profitable business activity.


pgpgbRLoIJ7An.pgp
Description: PGP signature


RE: wicket single page application: replacing panels with ajax and back button support

2013-08-25 Thread Colin Rogers
Hi there,

I'm doing something in my code similar to what you are suggesting.

The way I do it is basically, each page that I'm navigation to, I call a method 
'cleverLink' rather than 'setResponsePage'.

'cleverLink' takes in a AjaxRequestTarget. That method then determines whether 
the page is swappable - if it's not it just sets the ResponsePage as normal. 
For the page to be swappable (in my code) the old page and the new page have to 
have the same entity, and be of the same base page class. Otherwise, things 
start breaking down! If the page has the same model, then I create the newPage, 
using the existing pageParameters/model, and simply access each of the main 
components using getters. Then, in the existing page, I replace (titlePanel, 
mainPanel, actionPanel etc.). I then clone these objects using 'WicketObjects' 
utility class (so as not to effect the 'new page') and 'replace' them in the 
existing old page, marking each one for update via the ajax target.

I then use a javascript 'historyPush' event to push the new URL to the browser, 
with the new Page ID from the new page (via getPageId() ), and the available 
pageParameters (there is a Wicket class that is good at resolving 
PageParameters - I can't remember what it is, and haven't my code to look it 
up). In order to get the page URLs is actually a massive pain for Wicket, 
especially if you us a combination of 'X', 'X/Y', 'X/Y/Z' paths. For this I 
have a utility method in my WicketApplication class to hold a map of the paths, 
created when mounting, for easy lookups. I still had problems with paths, and 
resorted to only one level in the end, as it was easier and less error prone.

You'll need to add some code to redirect via javascript, on back button 
presses, to the relevant page - but that is something there are plenty of 
articles on the net about that. It's not very efficient (as a back button press 
does a redirect), but it does work.

The net result is - each page has certain elements updated, and the URL is 
always correct, the back button works as does bookmarking. It's non-trivial and 
very specific to mine/your code, but it does work! Mine works on the basis that 
I only replace certain panels of a page (and leave some) so it has limitations 
when moving from one page, to another, with a different model and or base page.

Hope that is as clear as mud!

I'm sure this is breaking *something* in Wicket's standard model, so any ideas, 
improvements or pointers are welcome!

Cheers,
Col.


From: Maxim Solodovnik [solomax...@gmail.com]
Sent: 26 August 2013 01:22
To: users@wicket.apache.org
Subject: Re: wicket single page application: replacing panels with ajax and 
back button support

we did it in Apache Openmeetings project
https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/

not sure if it can be used as an example :) but it is working :)


On Sun, Aug 25, 2013 at 5:54 PM, Ilkka Seppälä  wrote:

> Hi,
>
> I'm guessing this is a common way to use Wicket but could not find
> solution.
>
> I want to create a single page application where navigation causes panels
> to be replaced with ajax. But the immediate problem that rises is how to
> make these different views bookmarkable and how to make browser's back
> button work as expected (return to previous view with the previous panel).
>
> -Ilkka
>



--
WBR
Maxim aka solomax
EMAIL DISCLAIMER This email message and its attachments are confidential and 
may also contain copyright or privileged material. If you are not the intended 
recipient, you may not forward the email or disclose or use the information 
contained in it. If you have received this email message in error, please 
advise the sender immediately by replying to this email and delete the message 
and any associated attachments. Any views, opinions, conclusions, advice or 
statements expressed in this email message are those of the individual sender 
and should not be relied upon as the considered view, opinion, conclusions, 
advice or statement of this company except where the sender expressly, and with 
authority, states them to be the considered view, opinion, conclusions, advice 
or statement of this company. Every care is taken but we recommend that you 
scan any attachments for viruses.

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



Re: wicket single page application: replacing panels with ajax and back button support

2013-08-25 Thread Maxim Solodovnik
we did it in Apache Openmeetings project
https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/

not sure if it can be used as an example :) but it is working :)


On Sun, Aug 25, 2013 at 5:54 PM, Ilkka Seppälä  wrote:

> Hi,
>
> I'm guessing this is a common way to use Wicket but could not find
> solution.
>
> I want to create a single page application where navigation causes panels
> to be replaced with ajax. But the immediate problem that rises is how to
> make these different views bookmarkable and how to make browser's back
> button work as expected (return to previous view with the previous panel).
>
> -Ilkka
>



-- 
WBR
Maxim aka solomax


wicket single page application: replacing panels with ajax and back button support

2013-08-25 Thread Ilkka Seppälä
Hi,

I'm guessing this is a common way to use Wicket but could not find solution.

I want to create a single page application where navigation causes panels
to be replaced with ajax. But the immediate problem that rises is how to
make these different views bookmarkable and how to make browser's back
button work as expected (return to previous view with the previous panel).

-Ilkka


RE: Problem with swapping panels using Ajax links

2013-07-23 Thread Chris Whitcomb
It seems that on the server that works (WAS 6.1.0.29), it can find the
wicket-event.js:
[7/22/13 13:58:34:585 EDT] 001c SessionContex > 
SessionContext.encodeURL Entry

resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js

On the servers that don't work (WAS 6.1.0.25), it cannot find that file:
[7/18/13 6:55:44:703 EDT] 001f DefaultExtens 3   handleRequest stripping
leading slashes pathInfo --->
resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
[7/18/13 6:55:44:703 EDT] 001f DefaultExtens 3   file does not exist
:/usr/WebSphere/AppServer/profiles/AppSrv01/installedApps/Cell/app.ear/app.war/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js

On the servers that don't work, it is looking for the file in the wrong
location.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-swapping-panels-using-Ajax-links-tp4660211p4660418.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: Problem with swapping panels using Ajax links

2013-07-12 Thread Paul Bors
Okay but in-line editing doesn't necessary mean you need to edit a single
field at a time.

You could have the user hit an Edit button and toggle a bunch of components
from labels to form fields and even toggle the Cancel button's visibility.

As for your code snippet, don't you have to add to the Ajax target the
parent of the panel that was switched out?
target.addComponent(editPanel.getParent());

~ Thank you,
  Paul Bors

-Original Message-
From: Chris Whitcomb [mailto:cwhitc...@osc.state.ny.us] 
Sent: Friday, July 12, 2013 7:30 AM
To: users@wicket.apache.org
Subject: RE: Problem with swapping panels using Ajax links

I like the inline editing - that's pretty nice. However, I'm not sure my
users would.

I swap the panels usng replaceWith:

Page page = getPage();
EditPanel editPanel = new EditPanel(ReadPanel.this.getId(),
selectedDocumentModel); ReadPanel.this.replaceWith(editPanel);
if(target != null){
  target.addComponent(editPanel);
} else {
  setResponsePage(page);
}

There are also 2 level of edit access.  Depending on what group (active
directory) they are in, they may be able to edit all fields or only some.  I
have created 2 edit panels and depending on their group membership,
determine which edit panel to display.

Thanks,
Chris


Paul Bors wrote
> What do you mean by swapping panels?
> 
> Are you using Component.replace()?
> And why would you when you could do all this in-line (the same way as 
> the new version of Jira does it)?
> 
> Try this live example:
> 1) Log on to http://Wicket.Apache.org
> 2) From under the "Learn" left navigation menu select the "Examples" 
> link
> 3) Then the "live action" link on the page that come up
>You will be redirected to http://www.wicket-library.com/
> 4) Now select the "ajax" link for examples using wicket's built-in 
> AJAX
> 5) Select the "Editable Label Example" link that shows a label that 
> can be edited inline via ajax
> 6) Click the "Source code" from the upper right-corner and enjoy the 
> simple example
> 
> Remember that you can always use the AjaxFallback*** counterpart 
> components if you would like to support browsers that don't have JS 
> turned on (isn't this the de-facto now-a-day anyhow?).
> 
> Have fun!





--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Problem-with-swapping-panels-usin
g-Ajax-links-tp4660211p4660229.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: Problem with swapping panels using Ajax links

2013-07-12 Thread Chris Whitcomb
I like the inline editing - that's pretty nice. However, I'm not sure my
users would.

I swap the panels usng replaceWith:

Page page = getPage();
EditPanel editPanel = new EditPanel(ReadPanel.this.getId(),
selectedDocumentModel);
ReadPanel.this.replaceWith(editPanel);
if(target != null){
  target.addComponent(editPanel);
} else {
  setResponsePage(page);
}

There are also 2 level of edit access.  Depending on what group (active
directory) they are in, they may be able to edit all fields or only some.  I
have created 2 edit panels and depending on their group membership,
determine which edit panel to display.

Thanks,
Chris


Paul Bors wrote
> What do you mean by swapping panels?
> 
> Are you using Component.replace()?
> And why would you when you could do all this in-line (the same way as the
> new version of Jira does it)?
> 
> Try this live example:
> 1) Log on to http://Wicket.Apache.org
> 2) From under the "Learn" left navigation menu select the "Examples" link
> 3) Then the "live action" link on the page that come up
>You will be redirected to http://www.wicket-library.com/
> 4) Now select the "ajax" link for examples using wicket's built-in AJAX
> 5) Select the "Editable Label Example" link that shows a label that can be
> edited inline via ajax
> 6) Click the "Source code" from the upper right-corner and enjoy the
> simple
> example
> 
> Remember that you can always use the AjaxFallback*** counterpart
> components
> if you would like to support browsers that don't have JS turned on (isn't
> this the de-facto now-a-day anyhow?).
> 
> Have fun!





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-swapping-panels-using-Ajax-links-tp4660211p4660229.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: Problem with swapping panels using Ajax links

2013-07-11 Thread Paul Bors
What do you mean by swapping panels?

Are you using Component.replace()?
And why would you when you could do all this in-line (the same way as the
new version of Jira does it)?

Try this live example:
1) Log on to http://Wicket.Apache.org
2) From under the "Learn" left navigation menu select the "Examples" link
3) Then the "live action" link on the page that come up
   You will be redirected to http://www.wicket-library.com/
4) Now select the "ajax" link for examples using wicket's built-in AJAX
5) Select the "Editable Label Example" link that shows a label that can be
edited inline via ajax
6) Click the "Source code" from the upper right-corner and enjoy the simple
example

Remember that you can always use the AjaxFallback*** counterpart components
if you would like to support browsers that don't have JS turned on (isn't
this the de-facto now-a-day anyhow?).

Have fun!

-Original Message-
From: Chris Whitcomb [mailto:cwhitc...@osc.state.ny.us] 
Sent: Thursday, July 11, 2013 1:50 PM
To: users@wicket.apache.org
Subject: Problem with swapping panels using Ajax links

I have a page that I swap 2 panels - read and edit.  On the read panel, the
edit button is an AjaxFallbackLink.  In the onClick, I replace the read
panel with the edit panel.

This button works correctly - the panel gets swapped out.

On the edit panel, I have 2 buttons - cancel which is an AjaxFallbackLink
and save which is an AjaxSubmitLink.  Both these buttons after doing the
business logic display the read panel.

I have a sandbox WebSphere server (ver 6.1) that the cancel and save buttons
work on.  When I deploy to our development server (WebSphere 6.1), the
cancel and save buttons don't work.  I have added logging to the onClick to
see where they fail, but all the logging gets output, so all the code runs,
but the read panel never shows on the page.  

I am using IE, but this happens the same way in FireFox.

A am using the wicket filter, not the servlet (I know there are issues with
WebSphere 6.1).  The setting:
com.ibm.ws.webcontainer.invokefilterscompatibility is set to true on both
servers. The panel swapping works as expected if I switch to the servlet,
but that causes other errors (see below).  Using the filter, all
functionality works in my sandbox, just not in our development region.  To
my knowledge, the 2 servers are configured the same (but apparently not).  

In the development region, I have looked at the AJAX Debug window.
First, I clicked on edit document button.  Then I clicked on cancel.  There
is an error when I click the cancel button:  ERROR: Received Ajax response
with code: 404

I see this when I click on edit:
INFO: Initiating Ajax GET request on
?wicket:interface=:8:documentProperties:editDocument::IBehaviorListener:0:&r
andom=0.3593767262126522

I see this when I click on cancel:
INFO: Initiating Ajax GET request on
?wicket:interface=:8:documentProperties:editDocumentProperties:cancelChanges
::IBehaviorListener:0:-1&random=0.9291661442409403

--

In this project, I also have a web service using cxf.  If I switch the
wicket to use the servlet, the web service no longer works.  I'm thinking
that my servlet mappings are conflicting, but no matter which order I put
them in, it doesn't work.

I don't care which problem gets fixed (panel swapping using the filter
setting or the multiple servlets).

I do have a PMR open with IBM, because I have 2 environments with different
results when they should be exactly the same.  I thought I would post here
as well hoping that someone may know what configuration may be causing this
problem.

I am using Wicket 1.4.22.

I didn't post any of the code because I didn't know what you would want to
see.  I also don't think it is a code issue.  I can post my web.xml if you
want to look at my servlet mapping.

Thanks.





--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Problem-with-swapping-panels-usin
g-Ajax-links-tp4660211.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



Problem with swapping panels using Ajax links

2013-07-11 Thread Chris Whitcomb
I have a page that I swap 2 panels - read and edit.  On the read panel, the
edit button is an AjaxFallbackLink.  In the onClick, I replace the read
panel with the edit panel.

This button works correctly - the panel gets swapped out.

On the edit panel, I have 2 buttons - cancel which is an AjaxFallbackLink
and save which is an AjaxSubmitLink.  Both these buttons after doing the
business logic display the read panel.

I have a sandbox WebSphere server (ver 6.1) that the cancel and save buttons
work on.  When I deploy to our development server (WebSphere 6.1), the
cancel and save buttons don't work.  I have added logging to the onClick to
see where they fail, but all the logging gets output, so all the code runs,
but the read panel never shows on the page.  

I am using IE, but this happens the same way in FireFox.

A am using the wicket filter, not the servlet (I know there are issues with
WebSphere 6.1).  The setting:
com.ibm.ws.webcontainer.invokefilterscompatibility is set to true on both
servers. The panel swapping works as expected if I switch to the servlet,
but that causes other errors (see below).  Using the filter, all
functionality works in my sandbox, just not in our development region.  To
my knowledge, the 2 servers are configured the same (but apparently not).  

In the development region, I have looked at the AJAX Debug window.
First, I clicked on edit document button.  Then I clicked on cancel.  There
is an error when I click the cancel button:  ERROR: Received Ajax response
with code: 404

I see this when I click on edit:
INFO: Initiating Ajax GET request on
?wicket:interface=:8:documentProperties:editDocument::IBehaviorListener:0:&random=0.3593767262126522

I see this when I click on cancel:
INFO: Initiating Ajax GET request on
?wicket:interface=:8:documentProperties:editDocumentProperties:cancelChanges::IBehaviorListener:0:-1&random=0.9291661442409403

--

In this project, I also have a web service using cxf.  If I switch the
wicket to use the servlet, the web service no longer works.  I'm thinking
that my servlet mappings are conflicting, but no matter which order I put
them in, it doesn't work.

I don't care which problem gets fixed (panel swapping using the filter
setting or the multiple servlets).

I do have a PMR open with IBM, because I have 2 environments with different
results when they should be exactly the same.  I thought I would post here
as well hoping that someone may know what configuration may be causing this
problem.

I am using Wicket 1.4.22.

I didn't post any of the code because I didn't know what you would want to
see.  I also don't think it is a code issue.  I can post my web.xml if you
want to look at my servlet mapping.

Thanks.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-swapping-panels-using-Ajax-links-tp4660211.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: on models and Panels

2013-03-10 Thread Sven Meier

Hi,

these lines don't make sense:

codeAutoComplete = new AutoCompleteTextField(
"code",
new PropertyModel(codeModel.getObject(), 
"code"),
getAutocompleteRenderer()) {


If codeModel contains a Code instance, why are binding the autocomplete 
on a "code" property of the code object? It should the following:


codeAutoComplete = new AutoCompleteTextField(
"code",
codeModel,
getAutocompleteRenderer()) {

Sven

On 03/10/2013 02:41 PM, grazia wrote:

I have a panel containing an autocomplete. The autocomplete contains its own
converter.
The model of the page that contains the autocomplete-panel should be updated
to the converted object of the autocomplete, and it does, but (here it shows
my lack of wicket knowledge) somehow it gets set once with the full
converted object, and once with an object where only the name field of the
object has been set (the rest being null).

Here is a skeleton of the code (Panel and page where it is used)

public class NewPanel extends Panel {

final Component targetComponent;
final AutoCompleteTextField codeAutoComplete;

public NewPanel(final String id,
final IModel codeModel, final Component 
component) {
super(id);
this.targetComponent = component;

codeAutoComplete = new AutoCompleteTextField(
"code",
new PropertyModel(codeModel.getObject(), 
"code"),
getAutocompleteRenderer()) {

@Override
protected Iterator getChoices(String input) {
  (...)
 }
   @Override
public final IConverter getConverter(Class type) {
return new IConverter() { (...) }
   };
   codeAutoComplete.add(new
AjaxFormComponentUpdatingBehavior(
"onchange") {

private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget target) {

codeModel.setObject(codeAutoComplete.getConvertedInput());
target.add(targetComponent);

}
});
codeAutoComplete.setType(Code.class);
add(codeAutoComplete);

}

public class NewCodeAssociationPage extends WebPage {

private IModel pascodeModel = new Model(new Code());
final Set codeList = new HashSet();

final IModel> associatedCodes = new
LoadableDetachableModel>() {
@Override
protected List load() {
(...)
};
};

final IModel> availableCodes = new
LoadableDetachableModel>() {

@Override
protected List load() {
if (codeModel.getObject() != null) {
codeList.add(codeModel.getObject());
}
codeList.addAll(associatedCodes.getObject());
return new ArrayList(codeList);
}
};
public NewCodeAssociationPage() {


final Form form = new Form("form");
final Palette palette = new Palette("palette",
associatedCodes, availableCodes,
new ChoiceRenderer("code", "codeId"), 25, 
false);
palette.setOutputMarkupId(true);

final NewCodePanel codePanel = new NewCodePanel(
"codeAutoCompletePanel", codeModel, palette);
}

}

THe set codeList in the NewCodeAssociationPage ends up containing a
"converted" Code object ( so, something looking like
Code[code=ABCDE,codeId=30] AND also the same just with the code name
specified: Code[code=ABCDE,codeId=null] So, it ends up showing twice in my
palette.
THere is something incorrect I do with the autocomplete panel and the model,
and I have not understood what it is. I would greatly appreciate any pointer
in the right direction.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/on-models-and-Panels-tp4657131.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



on models and Panels

2013-03-10 Thread grazia

I have a panel containing an autocomplete. The autocomplete contains its own
converter. 
The model of the page that contains the autocomplete-panel should be updated
to the converted object of the autocomplete, and it does, but (here it shows
my lack of wicket knowledge) somehow it gets set once with the full
converted object, and once with an object where only the name field of the
object has been set (the rest being null).

Here is a skeleton of the code (Panel and page where it is used)

public class NewPanel extends Panel {

final Component targetComponent;
final AutoCompleteTextField codeAutoComplete;

public NewPanel(final String id,
final IModel codeModel, final Component 
component) {
super(id);
this.targetComponent = component;

codeAutoComplete = new AutoCompleteTextField(
"code",
new PropertyModel(codeModel.getObject(), 
"code"),
getAutocompleteRenderer()) {

@Override
protected Iterator getChoices(String input) {
 (...)
}
   @Override
public final IConverter getConverter(Class type) {
return new IConverter() { (...) }
  };
  codeAutoComplete.add(new
AjaxFormComponentUpdatingBehavior(
"onchange") {

private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget target) {

codeModel.setObject(codeAutoComplete.getConvertedInput());
target.add(targetComponent);

}
});
codeAutoComplete.setType(Code.class);
add(codeAutoComplete);

}

public class NewCodeAssociationPage extends WebPage {

private IModel pascodeModel = new Model(new Code());
final Set codeList = new HashSet();

final IModel> associatedCodes = new
LoadableDetachableModel>() {
@Override
protected List load() {
(...)
};
};

final IModel> availableCodes = new
LoadableDetachableModel>() {

@Override
protected List load() {
if (codeModel.getObject() != null) {
codeList.add(codeModel.getObject());
}
codeList.addAll(associatedCodes.getObject());
return new ArrayList(codeList);
}
};
public NewCodeAssociationPage() {


final Form form = new Form("form");
final Palette palette = new Palette("palette",
associatedCodes, availableCodes,
new ChoiceRenderer("code", "codeId"), 25, 
false);
palette.setOutputMarkupId(true);

final NewCodePanel codePanel = new NewCodePanel(
"codeAutoCompletePanel", codeModel, palette);
}

}

THe set codeList in the NewCodeAssociationPage ends up containing a
"converted" Code object ( so, something looking like
Code[code=ABCDE,codeId=30] AND also the same just with the code name
specified: Code[code=ABCDE,codeId=null] So, it ends up showing twice in my
palette. 
THere is something incorrect I do with the autocomplete panel and the model,
and I have not understood what it is. I would greatly appreciate any pointer
in the right direction. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/on-models-and-Panels-tp4657131.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: i18n in reusable panels / markup traversing question

2013-02-28 Thread Patrick Davids
Hi Sebastian,
thanx, this way it works.

kind regards
Patrick

Am 28.02.2013 10:19, schrieb Sébastien Gautrin:
> Hello,
>
> For your property discovery mechanism, I'm not sure I really see how
> this works (sounds interesting though). However, what you want for
> traversing the component hierarchy upon initializing your panel is to
> delay the initialization after the panel has been added.
>
> And there is a method defined in Component exactly for this purpose:
> onInitialize() (well this is on wicket 1.5, but I don't think it has
> changed in wicket 6). Basically you would do in this method (don't
> forget to call super.onInitialize() though) whatever you would otherwise
> have done in the constructor but requires access to the component
> hierarchy.
>
> 
> This method is meant to be used as an alternative to initialize
> components. Usually the component's constructor is used for this task,
> but sometimes a component cannot be initialized in isolation, it may
> need to access its parent component or its markup in order to fully
> initialize. This method is invoked once per component's lifecycle when a
> path exists from this component to the Page thus providing the component
> with an atomic callback when the component's environment is built out.
> 
>
> Hope this helps.
>
> On Thu 28 Feb 2013 09:53:12 CET, Patrick Davids wrote:
>> Hi all,
>> I have a question concerning resuable panels, translation and the markup
>> traversing.
>>
>> e.g. I have a page, which has its own property file providing
>> translation for a delete button.
>> This page deletes, lets say "Cars", so the buttons label should "delete
>> car".
>>
>> On this page is a resuable panel for the delete action. Opening a
>> dialog... ask the user, to be sure etc. and here also, the headline
>> should be "delete car"
>>
>> So, the panel should try to find the nearest label "delete" in the
>> markup hierarchy.
>>
>> But: I always run into problems finding these labels, because the
>> component (on its init) is not part of a markup hierarchy, yet.
>> Cannot find key exception...
>>
>> What I dont want to do is, giving all page specific texts and
>> translation to the reusable delete panel.
>> Doing so I loose this great wicket feature, just traversing the hierachy
>> tring to find the nearest matching translation.
>>
>> What I'm doing wrong? How can I handle this in a best way?
>> Must be something easy, I just cannot see...
>>
>> kind regards
>> Patrick
>> -
>> 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
>

-- 
Mit freundlichen Grüßen,

Patrick Davids

NuboIT GmbH & Co. KG
Kieler Str. 103-107 • 25474 Bönningstedt

Email: patrick.dav...@nuboit.de

Handelsregister: HRA6819 Pi  | Amtsgericht Pinneberg

Geschäftsführung der Verwaltungsgesellschaft
Daniel Fraga Zander

HRB10145Pi | Amtsgericht Pinneberg

Re: i18n in reusable panels / markup traversing question

2013-02-28 Thread Sébastien Gautrin

Hello,

For your property discovery mechanism, I'm not sure I really see how 
this works (sounds interesting though). However, what you want for 
traversing the component hierarchy upon initializing your panel is to 
delay the initialization after the panel has been added.


And there is a method defined in Component exactly for this purpose: 
onInitialize() (well this is on wicket 1.5, but I don't think it has 
changed in wicket 6). Basically you would do in this method (don't 
forget to call super.onInitialize() though) whatever you would 
otherwise have done in the constructor but requires access to the 
component hierarchy.



This method is meant to be used as an alternative to initialize 
components. Usually the component's constructor is used for this task, 
but sometimes a component cannot be initialized in isolation, it may 
need to access its parent component or its markup in order to fully 
initialize. This method is invoked once per component's lifecycle when 
a path exists from this component to the Page thus providing the 
component with an atomic callback when the component's environment is 
built out.



Hope this helps.

On Thu 28 Feb 2013 09:53:12 CET, Patrick Davids wrote:

Hi all,
I have a question concerning resuable panels, translation and the markup
traversing.

e.g. I have a page, which has its own property file providing
translation for a delete button.
This page deletes, lets say "Cars", so the buttons label should "delete
car".

On this page is a resuable panel for the delete action. Opening a
dialog... ask the user, to be sure etc. and here also, the headline
should be "delete car"

So, the panel should try to find the nearest label "delete" in the
markup hierarchy.

But: I always run into problems finding these labels, because the
component (on its init) is not part of a markup hierarchy, yet.
Cannot find key exception...

What I dont want to do is, giving all page specific texts and
translation to the reusable delete panel.
Doing so I loose this great wicket feature, just traversing the hierachy
tring to find the nearest matching translation.

What I'm doing wrong? How can I handle this in a best way?
Must be something easy, I just cannot see...

kind regards
Patrick
-
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



i18n in reusable panels / markup traversing question

2013-02-28 Thread Patrick Davids
Hi all,
I have a question concerning resuable panels, translation and the markup 
traversing.

e.g. I have a page, which has its own property file providing 
translation for a delete button.
This page deletes, lets say "Cars", so the buttons label should "delete 
car".

On this page is a resuable panel for the delete action. Opening a 
dialog... ask the user, to be sure etc. and here also, the headline 
should be "delete car"

So, the panel should try to find the nearest label "delete" in the 
markup hierarchy.

But: I always run into problems finding these labels, because the 
component (on its init) is not part of a markup hierarchy, yet.
Cannot find key exception...

What I dont want to do is, giving all page specific texts and 
translation to the reusable delete panel.
Doing so I loose this great wicket feature, just traversing the hierachy 
tring to find the nearest matching translation.

What I'm doing wrong? How can I handle this in a best way?
Must be something easy, I just cannot see...

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



Re: Pages, Panels, and Dependency Injection

2013-01-29 Thread William Speirs
@Martin sounds like session is the way to go because passing something as a
page parameter means that the user could just simply change the ID to
whatever they want... never trust the client :-)

@Chris interesting project, I'll have to take a look.

Thank you both!

Bill-


On Tue, Jan 29, 2013 at 8:13 PM, Chris Colman
wrote:

> Webapps are excellent candidates for injecting into the 'thread' rather
> than providing every injectable class with its own special constructor
> (a lot of boring, mechanical work and problem not as run time efficient)
> and then setting up XML or annotations to configure the inject
> mechanisms.
>
> A simple servlet filter "injects" (attaches to) the thread on the way in
> to servicing the request and detaches from the thread on the way out.
>
> We created a very lightweight framework that uses thread injection for
> this purpose and it works magically and requires no special changes to
> UI or model code to work. It's called expojo (expose POJOs) and it's at
> expojo.com
>
> A 'ModelExposer' object is always available to any active thread via a
> call to ModelExposer.get(). The ModelExposer provides repositories (kind
> of like 'look up' DAOs that contain your query methods for your
> particular ORM) and services (DAOs that can make changes to the model).
> So from anywhere in your code you have access to all the repository and
> services you will every need.
>
> It's not the way Spring or Guice do it but it works really well and
> doesn't need any XML or annotations at all and doesn't require you
> change your model or UI objects.
>
> The exPOJO servlet also implements 'open session/persistence manager in
> view' so you can avoid all those nasty 'lazy load' exceptions with ease.
>
>
>
> >-Original Message-
> >From: Bill Speirs [mailto:bill.spe...@gmail.com]
> >Sent: Tuesday, 29 January 2013 12:28 PM
> >To: users@wicket.apache.org
> >Subject: Re: Pages, Panels, and Dependency Injection
> >
> >Still struggling with how to do this. Martin, I understand that most
> people
> >will simply call new PanelA and new PanelB inside their MyPage code
> instead
> >of trying to inject them. However, how does one setup a page that
> requires
> >some service (DAO for example) and that might optionally require a
> >UserBean.
> >
> >So without using DI, I'd simply have 2 constructors:
> >
> >MyPage(DAO myDao)
> >
> >MyPage(DAO myDao, UserBean currentUser)
> >
> >But I cannot create that second constructor as I don't have anything to
> >bind (using Guice terms) UserBean to.
> >
> >Am I required to make a factory for MyPage at that point? Is it
> bad/wrong
> >to pass the UserBean into the constructor via a response page:
> >
> >setResponsePage(new MyPage(new DAO(), currentUser));
> >
> >Thanks...
> >
> >Bill-
> >
> >
> >On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov
> >wrote:
> >
> >> Hi,
> >>
> >> Most of the time people inject services to their components.
> >>
> >> To test just components you can use
> WicketTester#startComponentInPage()
> >> methods.
> >>
> >>
> >> On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
> >> wrote:
> >>
> >> > I'm having trouble understanding how to inject components into a
> page
> >so
> >> > that the page will be easy to unit test later. Say I have a page
> that
> >> > contains two panels. I can easily use constructor injection to
> inject
> >> these
> >> > panels into the page:
> >> >
> >> > class MyPage extends WebPage {
> >> > @Inject
> >> > public MyPage(PanelA a, PanelB b) { ... }
> >> > }
> >> >
> >> > The problem is that all Panels require an id during
> construction.[1]
> >How
> >> do
> >> > I supply the id to my Panels? I could simply construct every PanelA
> >with
> >> an
> >> > id of "panela" and every PanelB with an id of "panel", but that
> doesn't
> >> > seem very flexible. What do other people do in this situation? The
> hope
> >> > would be to pass mocked panels into the page during unit testing,
> >> > the separately test each panel.
> >> >
> >> > What if instead of a panel it was a button where the onSubmit
> method
> >must
> >> > be specified by overriding the method. How does one go about
> injecting
> >> such
> >> > a component so that it's still easy to test later in unit tests?
> >> >
> >> > All thoughts and/or best practices are greatly welcomed. For
> reference
> >> I'm
> >> > using Guice as my dependency injection framework and
> >> > GuiceWebApplicationFactory to inject components into pages.
> >> >
> >> > Thanks...
> >> >
> >> > Bill-
> >> >
> >> > [1]
> >> >
> >> >
> >>
> >http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ma
> rkup
> >/html/panel/Panel.html
> >> >
> >>
> >>
> >>
> >> --
> >> 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
>
>


RE: Pages, Panels, and Dependency Injection

2013-01-29 Thread Chris Colman
Webapps are excellent candidates for injecting into the 'thread' rather
than providing every injectable class with its own special constructor
(a lot of boring, mechanical work and problem not as run time efficient)
and then setting up XML or annotations to configure the inject
mechanisms.

A simple servlet filter "injects" (attaches to) the thread on the way in
to servicing the request and detaches from the thread on the way out.

We created a very lightweight framework that uses thread injection for
this purpose and it works magically and requires no special changes to
UI or model code to work. It's called expojo (expose POJOs) and it's at
expojo.com

A 'ModelExposer' object is always available to any active thread via a
call to ModelExposer.get(). The ModelExposer provides repositories (kind
of like 'look up' DAOs that contain your query methods for your
particular ORM) and services (DAOs that can make changes to the model).
So from anywhere in your code you have access to all the repository and
services you will every need.

It's not the way Spring or Guice do it but it works really well and
doesn't need any XML or annotations at all and doesn't require you
change your model or UI objects.

The exPOJO servlet also implements 'open session/persistence manager in
view' so you can avoid all those nasty 'lazy load' exceptions with ease.



>-Original Message-
>From: Bill Speirs [mailto:bill.spe...@gmail.com]
>Sent: Tuesday, 29 January 2013 12:28 PM
>To: users@wicket.apache.org
>Subject: Re: Pages, Panels, and Dependency Injection
>
>Still struggling with how to do this. Martin, I understand that most
people
>will simply call new PanelA and new PanelB inside their MyPage code
instead
>of trying to inject them. However, how does one setup a page that
requires
>some service (DAO for example) and that might optionally require a
>UserBean.
>
>So without using DI, I'd simply have 2 constructors:
>
>MyPage(DAO myDao)
>
>MyPage(DAO myDao, UserBean currentUser)
>
>But I cannot create that second constructor as I don't have anything to
>bind (using Guice terms) UserBean to.
>
>Am I required to make a factory for MyPage at that point? Is it
bad/wrong
>to pass the UserBean into the constructor via a response page:
>
>setResponsePage(new MyPage(new DAO(), currentUser));
>
>Thanks...
>
>Bill-
>
>
>On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov
>wrote:
>
>> Hi,
>>
>> Most of the time people inject services to their components.
>>
>> To test just components you can use
WicketTester#startComponentInPage()
>> methods.
>>
>>
>> On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
>> wrote:
>>
>> > I'm having trouble understanding how to inject components into a
page
>so
>> > that the page will be easy to unit test later. Say I have a page
that
>> > contains two panels. I can easily use constructor injection to
inject
>> these
>> > panels into the page:
>> >
>> > class MyPage extends WebPage {
>> > @Inject
>> > public MyPage(PanelA a, PanelB b) { ... }
>> > }
>> >
>> > The problem is that all Panels require an id during
construction.[1]
>How
>> do
>> > I supply the id to my Panels? I could simply construct every PanelA
>with
>> an
>> > id of "panela" and every PanelB with an id of "panel", but that
doesn't
>> > seem very flexible. What do other people do in this situation? The
hope
>> > would be to pass mocked panels into the page during unit testing,
>> > the separately test each panel.
>> >
>> > What if instead of a panel it was a button where the onSubmit
method
>must
>> > be specified by overriding the method. How does one go about
injecting
>> such
>> > a component so that it's still easy to test later in unit tests?
>> >
>> > All thoughts and/or best practices are greatly welcomed. For
reference
>> I'm
>> > using Guice as my dependency injection framework and
>> > GuiceWebApplicationFactory to inject components into pages.
>> >
>> > Thanks...
>> >
>> > Bill-
>> >
>> > [1]
>> >
>> >
>>
>http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ma
rkup
>/html/panel/Panel.html
>> >
>>
>>
>>
>> --
>> 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



Re: Pages, Panels, and Dependency Injection

2013-01-29 Thread Martin Grigorov
Hi,

Most people use the session approach. Keep an id (private key) as a field
in the Wicket Session and load the real object on demand when needed.

Similar solution is to make your bean Session scoped. The DI framework
cares to extract it from the session for you.

Some people prefer to be as stateless as possible and avoid using the
session if possible. In this case you can use setResponsePage(Class,
PageParameters) and transfer the id as a request parameter from page to
page.

The "problem" with setResponsePage(Page) is that it makes the page stateful
and the "ugly" ?pageId appears in the url. If this doesn't bother you then
it is very simple solution for your problem.



On Tue, Jan 29, 2013 at 2:40 PM, Bill Speirs  wrote:

> OK... but how do I pass the current UserBean from one page to another? I
> cannot bind it to Guice as I don't know what it is when I'm setting up my
> Guice Module.
>
> Currently I used setRedirectPage(new MyPage(currentUser)). From what I
> understand you're saying I can switch to setRedirectPage(MyPage.class), but
> then how do I set the UserBean "property" for that instance?
>
> Should these types of values be passed via the session instead? So I simply
> use setRedirectPage(MyPage.class), then inside that class get the current
> user from the session?
>
> The overall question is, what is the best practice for passing values to a
> WebPage from another WebPage via setRedirectPage()? Should you create a new
> instance of the page, or let Wicket do it via reflection? And if Wicket is
> doing it, then how do I "inject" the value?
>
> Thanks...
>
> Bill-
>
>
> On Tue, Jan 29, 2013 at 2:50 AM, Martin Grigorov  >wrote:
>
> > Hi,
> >
> > You can do something like:
> >
> > class MyPage extends WebPage {
> >
> > @Inject private DAO dao;
> >
> > @Inject @Nullable private UserBean currentUser;
> >
> > ... // use dao or currentUser anywhere in your class
> >
> > }
> >
> > And Guice will try to inject these beans if they are defined in a Guice
> > module.
> > See https://code.google.com/p/google-guice/wiki/UseNullable
> >
> >
> > On Tue, Jan 29, 2013 at 2:27 AM, Bill Speirs 
> > wrote:
> >
> > > Still struggling with how to do this. Martin, I understand that most
> > people
> > > will simply call new PanelA and new PanelB inside their MyPage code
> > instead
> > > of trying to inject them. However, how does one setup a page that
> > requires
> > > some service (DAO for example) and that might optionally require a
> > > UserBean.
> > >
> > > So without using DI, I'd simply have 2 constructors:
> > >
> > > MyPage(DAO myDao)
> > >
> > > MyPage(DAO myDao, UserBean currentUser)
> > >
> > > But I cannot create that second constructor as I don't have anything to
> > > bind (using Guice terms) UserBean to.
> > >
> > > Am I required to make a factory for MyPage at that point? Is it
> bad/wrong
> > > to pass the UserBean into the constructor via a response page:
> > >
> > > setResponsePage(new MyPage(new DAO(), currentUser));
> > >
> > > Thanks...
> > >
> > > Bill-
> > >
> > >
> > > On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov  > > >wrote:
> > >
> > > > Hi,
> > > >
> > > > Most of the time people inject services to their components.
> > > >
> > > > To test just components you can use
> WicketTester#startComponentInPage()
> > > > methods.
> > > >
> > > >
> > > > On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
> > > > wrote:
> > > >
> > > > > I'm having trouble understanding how to inject components into a
> page
> > > so
> > > > > that the page will be easy to unit test later. Say I have a page
> that
> > > > > contains two panels. I can easily use constructor injection to
> inject
> > > > these
> > > > > panels into the page:
> > > > >
> > > > > class MyPage extends WebPage {
> > > > > @Inject
> > > > > public MyPage(PanelA a, PanelB b) { ... }
> > > > > }
> > > > >
> > > > > The problem is that all Panels require an id during
> construction.[1]
> > > How
> > > > do
> > > > > I supply the id to my Panels? I could simply construct every PanelA
> > > with
> > > > an

Re: Pages, Panels, and Dependency Injection

2013-01-29 Thread Bill Speirs
OK... but how do I pass the current UserBean from one page to another? I
cannot bind it to Guice as I don't know what it is when I'm setting up my
Guice Module.

Currently I used setRedirectPage(new MyPage(currentUser)). From what I
understand you're saying I can switch to setRedirectPage(MyPage.class), but
then how do I set the UserBean "property" for that instance?

Should these types of values be passed via the session instead? So I simply
use setRedirectPage(MyPage.class), then inside that class get the current
user from the session?

The overall question is, what is the best practice for passing values to a
WebPage from another WebPage via setRedirectPage()? Should you create a new
instance of the page, or let Wicket do it via reflection? And if Wicket is
doing it, then how do I "inject" the value?

Thanks...

Bill-


On Tue, Jan 29, 2013 at 2:50 AM, Martin Grigorov wrote:

> Hi,
>
> You can do something like:
>
> class MyPage extends WebPage {
>
> @Inject private DAO dao;
>
> @Inject @Nullable private UserBean currentUser;
>
> ... // use dao or currentUser anywhere in your class
>
> }
>
> And Guice will try to inject these beans if they are defined in a Guice
> module.
> See https://code.google.com/p/google-guice/wiki/UseNullable
>
>
> On Tue, Jan 29, 2013 at 2:27 AM, Bill Speirs 
> wrote:
>
> > Still struggling with how to do this. Martin, I understand that most
> people
> > will simply call new PanelA and new PanelB inside their MyPage code
> instead
> > of trying to inject them. However, how does one setup a page that
> requires
> > some service (DAO for example) and that might optionally require a
> > UserBean.
> >
> > So without using DI, I'd simply have 2 constructors:
> >
> > MyPage(DAO myDao)
> >
> > MyPage(DAO myDao, UserBean currentUser)
> >
> > But I cannot create that second constructor as I don't have anything to
> > bind (using Guice terms) UserBean to.
> >
> > Am I required to make a factory for MyPage at that point? Is it bad/wrong
> > to pass the UserBean into the constructor via a response page:
> >
> > setResponsePage(new MyPage(new DAO(), currentUser));
> >
> > Thanks...
> >
> > Bill-
> >
> >
> > On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov  > >wrote:
> >
> > > Hi,
> > >
> > > Most of the time people inject services to their components.
> > >
> > > To test just components you can use WicketTester#startComponentInPage()
> > > methods.
> > >
> > >
> > > On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
> > > wrote:
> > >
> > > > I'm having trouble understanding how to inject components into a page
> > so
> > > > that the page will be easy to unit test later. Say I have a page that
> > > > contains two panels. I can easily use constructor injection to inject
> > > these
> > > > panels into the page:
> > > >
> > > > class MyPage extends WebPage {
> > > > @Inject
> > > > public MyPage(PanelA a, PanelB b) { ... }
> > > > }
> > > >
> > > > The problem is that all Panels require an id during construction.[1]
> > How
> > > do
> > > > I supply the id to my Panels? I could simply construct every PanelA
> > with
> > > an
> > > > id of "panela" and every PanelB with an id of "panel", but that
> doesn't
> > > > seem very flexible. What do other people do in this situation? The
> hope
> > > > would be to pass mocked panels into the page during unit testing,
> > > > the separately test each panel.
> > > >
> > > > What if instead of a panel it was a button where the onSubmit method
> > must
> > > > be specified by overriding the method. How does one go about
> injecting
> > > such
> > > > a component so that it's still easy to test later in unit tests?
> > > >
> > > > All thoughts and/or best practices are greatly welcomed. For
> reference
> > > I'm
> > > > using Guice as my dependency injection framework and
> > > > GuiceWebApplicationFactory to inject components into pages.
> > > >
> > > > Thanks...
> > > >
> > > > Bill-
> > > >
> > > > [1]
> > > >
> > > >
> > >
> >
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html
> > > >
> > >
> > >
> > >
> > > --
> > > Martin Grigorov
> > > jWeekend
> > > Training, Consulting, Development
> > > http://jWeekend.com <http://jweekend.com/>
> > >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Re: Pages, Panels, and Dependency Injection

2013-01-28 Thread Martin Grigorov
Hi,

You can do something like:

class MyPage extends WebPage {

@Inject private DAO dao;

@Inject @Nullable private UserBean currentUser;

... // use dao or currentUser anywhere in your class

}

And Guice will try to inject these beans if they are defined in a Guice
module.
See https://code.google.com/p/google-guice/wiki/UseNullable


On Tue, Jan 29, 2013 at 2:27 AM, Bill Speirs  wrote:

> Still struggling with how to do this. Martin, I understand that most people
> will simply call new PanelA and new PanelB inside their MyPage code instead
> of trying to inject them. However, how does one setup a page that requires
> some service (DAO for example) and that might optionally require a
> UserBean.
>
> So without using DI, I'd simply have 2 constructors:
>
> MyPage(DAO myDao)
>
> MyPage(DAO myDao, UserBean currentUser)
>
> But I cannot create that second constructor as I don't have anything to
> bind (using Guice terms) UserBean to.
>
> Am I required to make a factory for MyPage at that point? Is it bad/wrong
> to pass the UserBean into the constructor via a response page:
>
> setResponsePage(new MyPage(new DAO(), currentUser));
>
> Thanks...
>
> Bill-
>
>
> On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov  >wrote:
>
> > Hi,
> >
> > Most of the time people inject services to their components.
> >
> > To test just components you can use WicketTester#startComponentInPage()
> > methods.
> >
> >
> > On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
> > wrote:
> >
> > > I'm having trouble understanding how to inject components into a page
> so
> > > that the page will be easy to unit test later. Say I have a page that
> > > contains two panels. I can easily use constructor injection to inject
> > these
> > > panels into the page:
> > >
> > > class MyPage extends WebPage {
> > > @Inject
> > > public MyPage(PanelA a, PanelB b) { ... }
> > > }
> > >
> > > The problem is that all Panels require an id during construction.[1]
> How
> > do
> > > I supply the id to my Panels? I could simply construct every PanelA
> with
> > an
> > > id of "panela" and every PanelB with an id of "panel", but that doesn't
> > > seem very flexible. What do other people do in this situation? The hope
> > > would be to pass mocked panels into the page during unit testing,
> > > the separately test each panel.
> > >
> > > What if instead of a panel it was a button where the onSubmit method
> must
> > > be specified by overriding the method. How does one go about injecting
> > such
> > > a component so that it's still easy to test later in unit tests?
> > >
> > > All thoughts and/or best practices are greatly welcomed. For reference
> > I'm
> > > using Guice as my dependency injection framework and
> > > GuiceWebApplicationFactory to inject components into pages.
> > >
> > > Thanks...
> > >
> > > Bill-
> > >
> > > [1]
> > >
> > >
> >
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html
> > >
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
> >
>



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


Re: Pages, Panels, and Dependency Injection

2013-01-28 Thread Bill Speirs
Still struggling with how to do this. Martin, I understand that most people
will simply call new PanelA and new PanelB inside their MyPage code instead
of trying to inject them. However, how does one setup a page that requires
some service (DAO for example) and that might optionally require a UserBean.

So without using DI, I'd simply have 2 constructors:

MyPage(DAO myDao)

MyPage(DAO myDao, UserBean currentUser)

But I cannot create that second constructor as I don't have anything to
bind (using Guice terms) UserBean to.

Am I required to make a factory for MyPage at that point? Is it bad/wrong
to pass the UserBean into the constructor via a response page:

setResponsePage(new MyPage(new DAO(), currentUser));

Thanks...

Bill-


On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov wrote:

> Hi,
>
> Most of the time people inject services to their components.
>
> To test just components you can use WicketTester#startComponentInPage()
> methods.
>
>
> On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
> wrote:
>
> > I'm having trouble understanding how to inject components into a page so
> > that the page will be easy to unit test later. Say I have a page that
> > contains two panels. I can easily use constructor injection to inject
> these
> > panels into the page:
> >
> > class MyPage extends WebPage {
> > @Inject
> > public MyPage(PanelA a, PanelB b) { ... }
> > }
> >
> > The problem is that all Panels require an id during construction.[1] How
> do
> > I supply the id to my Panels? I could simply construct every PanelA with
> an
> > id of "panela" and every PanelB with an id of "panel", but that doesn't
> > seem very flexible. What do other people do in this situation? The hope
> > would be to pass mocked panels into the page during unit testing,
> > the separately test each panel.
> >
> > What if instead of a panel it was a button where the onSubmit method must
> > be specified by overriding the method. How does one go about injecting
> such
> > a component so that it's still easy to test later in unit tests?
> >
> > All thoughts and/or best practices are greatly welcomed. For reference
> I'm
> > using Guice as my dependency injection framework and
> > GuiceWebApplicationFactory to inject components into pages.
> >
> > Thanks...
> >
> > Bill-
> >
> > [1]
> >
> >
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Re: ResizableBehavior multiple resizable panels on a page

2013-01-27 Thread Pieter Claassen
Thanks, that did the job.

Pieter

On Sun, Jan 27, 2013 at 5:35 PM, Sebastien  wrote:

> Hi Pieter,
>
> If you have multiple panel, they all have the same html-id (#resizable).
> (and so jquery statement $("#resizable") will only take the first one)
>
> What you need is to have different (rendered) html ids for each panels. So,
> you can simply do:
> add(new ResizableBehavior("#" + this.setOutputMarkupId(true).getMarkupId(),
> options));
>
> Which can be shortened as:
> add(new ResizableBehavior(JQueryWidget.getSelector(this), options));
>
> Hope this helps,
> Sebastien.
>
> On Sun, Jan 27, 2013 at 5:19 PM, Pieter Claassen 
> wrote:
>
> > I have multiple panels on a page, each once constructed as follows:
> >
> > * public EditableQuestionPanel(String id, final QuestionBaseWebModel
> > questionBaseWebModel, final TemplateWebModel templateWebModel, final
> > QuestionEditPanel panel) {*
> > *super(id);*
> > *Options options = new Options();*
> > *options.set("minWidth", 350);*
> > *options.set("minHeight", 85);*
> > *add(new ResizableBehavior("#resizable",options));*
> >
> > Here is the HTML for each panel.
> >
> > **
> > **
> > **
> > **
> > **
> > **
> > **
> > * *
> > **
> > **
> > **
> >
> >
> > I want them each to be resizable but only the first panel ever is.
> >
> > I am using wicket-jquery-ui. Any idea what I am doing wrong here. Do I
> have
> > to give each pane a unique html id attribute?
> >
> > Pieter
> >
>



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claas...@musmato.com
  t: +31 877 848259
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -


Re: ResizableBehavior multiple resizable panels on a page

2013-01-27 Thread Sebastien
Hi Pieter,

If you have multiple panel, they all have the same html-id (#resizable).
(and so jquery statement $("#resizable") will only take the first one)

What you need is to have different (rendered) html ids for each panels. So,
you can simply do:
add(new ResizableBehavior("#" + this.setOutputMarkupId(true).getMarkupId(),
options));

Which can be shortened as:
add(new ResizableBehavior(JQueryWidget.getSelector(this), options));

Hope this helps,
Sebastien.

On Sun, Jan 27, 2013 at 5:19 PM, Pieter Claassen  wrote:

> I have multiple panels on a page, each once constructed as follows:
>
> * public EditableQuestionPanel(String id, final QuestionBaseWebModel
> questionBaseWebModel, final TemplateWebModel templateWebModel, final
> QuestionEditPanel panel) {*
> *super(id);*
> *Options options = new Options();*
> *options.set("minWidth", 350);*
> *options.set("minHeight", 85);*
> *add(new ResizableBehavior("#resizable",options));*
>
> Here is the HTML for each panel.
>
> **
> **
> **
> **
> **
> **
> **
> * *
> **
> **
> **
>
>
> I want them each to be resizable but only the first panel ever is.
>
> I am using wicket-jquery-ui. Any idea what I am doing wrong here. Do I have
> to give each pane a unique html id attribute?
>
> Pieter
>


ResizableBehavior multiple resizable panels on a page

2013-01-27 Thread Pieter Claassen
I have multiple panels on a page, each once constructed as follows:

* public EditableQuestionPanel(String id, final QuestionBaseWebModel
questionBaseWebModel, final TemplateWebModel templateWebModel, final
QuestionEditPanel panel) {*
*super(id);*
*Options options = new Options();*
*options.set("minWidth", 350);*
*options.set("minHeight", 85);*
*add(new ResizableBehavior("#resizable",options));*

Here is the HTML for each panel.

**
**
**
**
**
**
**
* *
**
**
**


I want them each to be resizable but only the first panel ever is.

I am using wicket-jquery-ui. Any idea what I am doing wrong here. Do I have
to give each pane a unique html id attribute?

Pieter


Re: update panels inside webmarkupcontainer

2013-01-14 Thread Jochen Mader
As long as you are not holding references on your own it will be
collected after a replaceWith.

On deleting pages: You could use DefaultPageStore.removePage but I am
not sure if that's a really good idea. Wicket is pretty good in
managing what's in the store and you should rely on its behavior as
much as possible.


On Sun, Jan 13, 2013 at 12:41 AM, fachhoch  wrote:
> Thanks for your reply, I am assuming if I  use component.replacewith will
> the old component is replaced with the new componenet and the old is no more
> in the component tree so will be gc colected , sure I am not holding any
> references  top it.
> second if I move out of this page  to some other page   can i delete all
> version of this page from pagemap ?
> if so please tell me how .
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279p4655319.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: update panels inside webmarkupcontainer

2013-01-12 Thread fachhoch
Thanks for your reply, I am assuming if I  use component.replacewith will
the old component is replaced with the new componenet and the old is no more
in the component tree so will be gc colected , sure I am not holding any
references  top it.
second if I move out of this page  to some other page   can i delete all
version of this page from pagemap ?
if so please tell me how .



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279p4655319.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: update panels inside webmarkupcontainer

2013-01-12 Thread Sven Meier

Hi,

all components not connected to the component tree will be garbage 
collected - of course only if you don't collect them in a data structure 
by yourself:
There have been people attaching a single behavior to multiple 
components, the behavior holding all bound components in a collection 
... go figure :/.


Sven

On 01/12/2013 02:31 PM, fachhoch wrote:

Plz help me   understand this , as the page is stateful   will it keep
references to all the  new MyContainer("id")?

clicking on this link creates a new container everytime, if all the
Mycontainer instances are gc collected not  a problem but if the instances
are stored   it will definetly increase session size , I am trying to reduce
session size and not to increase it with unnessary  objects.
Please advice me.







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279p4655316.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: update panels inside webmarkupcontainer

2013-01-12 Thread fachhoch
Plz help me   understand this , as the page is stateful   will it keep
references to all the  new MyContainer("id")?

clicking on this link creates a new container everytime, if all the
Mycontainer instances are gc collected not  a problem but if the instances
are stored   it will definetly increase session size , I am trying to reduce 
session size and not to increase it with unnessary  objects.
Please advice me.







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279p4655316.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: update panels inside webmarkupcontainer

2013-01-11 Thread fachhoch
I have A Container I added it   to the page constructor using 

on ajaxrequest


after the above code  will the oldComponent  be garbage collected as its no
longer being used?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279p4655290.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: update panels inside webmarkupcontainer

2013-01-11 Thread Martin Grigorov
See org.apache.wicket.Component#replaceWith()


On Fri, Jan 11, 2013 at 3:09 AM, fachhoch  wrote:

> I have a container with two  fragments these fragments are added with some
> conditional logic,
> if the condition is not satisfied I add empty panel
> on ajax update of this container I wan to call the logic again and add
> the
> right component either fragment or empty panel please advice how to?
> I can do this with a list view repaint will recreate the list view , but is
> there any other way ?
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279.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
>
>


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


update panels inside webmarkupcontainer

2013-01-10 Thread fachhoch
I have a container with two  fragments these fragments are added with some
conditional logic,
if the condition is not satisfied I add empty panel 
on ajax update of this container I wan to call the logic again and add   the
right component either fragment or empty panel please advice how to?
I can do this with a list view repaint will recreate the list view , but is
there any other way ?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/update-panels-inside-webmarkupcontainer-tp4655279.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: Pages, Panels, and Dependency Injection

2012-11-30 Thread Martin Grigorov
Hi,

Most of the time people inject services to their components.

To test just components you can use WicketTester#startComponentInPage()
methods.


On Fri, Nov 30, 2012 at 3:18 AM, William Speirs  wrote:

> I'm having trouble understanding how to inject components into a page so
> that the page will be easy to unit test later. Say I have a page that
> contains two panels. I can easily use constructor injection to inject these
> panels into the page:
>
> class MyPage extends WebPage {
> @Inject
> public MyPage(PanelA a, PanelB b) { ... }
> }
>
> The problem is that all Panels require an id during construction.[1] How do
> I supply the id to my Panels? I could simply construct every PanelA with an
> id of "panela" and every PanelB with an id of "panel", but that doesn't
> seem very flexible. What do other people do in this situation? The hope
> would be to pass mocked panels into the page during unit testing,
> the separately test each panel.
>
> What if instead of a panel it was a button where the onSubmit method must
> be specified by overriding the method. How does one go about injecting such
> a component so that it's still easy to test later in unit tests?
>
> All thoughts and/or best practices are greatly welcomed. For reference I'm
> using Guice as my dependency injection framework and
> GuiceWebApplicationFactory to inject components into pages.
>
> Thanks...
>
> Bill-
>
> [1]
>
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html
>



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


Pages, Panels, and Dependency Injection

2012-11-29 Thread William Speirs
I'm having trouble understanding how to inject components into a page so
that the page will be easy to unit test later. Say I have a page that
contains two panels. I can easily use constructor injection to inject these
panels into the page:

class MyPage extends WebPage {
@Inject
public MyPage(PanelA a, PanelB b) { ... }
}

The problem is that all Panels require an id during construction.[1] How do
I supply the id to my Panels? I could simply construct every PanelA with an
id of "panela" and every PanelB with an id of "panel", but that doesn't
seem very flexible. What do other people do in this situation? The hope
would be to pass mocked panels into the page during unit testing,
the separately test each panel.

What if instead of a panel it was a button where the onSubmit method must
be specified by overriding the method. How does one go about injecting such
a component so that it's still easy to test later in unit tests?

All thoughts and/or best practices are greatly welcomed. For reference I'm
using Guice as my dependency injection framework and
GuiceWebApplicationFactory to inject components into pages.

Thanks...

Bill-

[1]
http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html


RE: dynamic control of location of panels on page

2012-08-09 Thread oggie
If everything is in panels, and all panels have proper CSS, wouldn't they
automatically wrap properly, no matter what order they were in?

So if I added the panels to the container in the order I wanted, isn't it
just ensuring the css for those panels is correct and that they will line up
properly and wrap properly?

 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/dynamic-control-of-location-of-panels-on-page-tp4651043p4651085.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: dynamic control of location of panels on page

2012-08-07 Thread Paul Bors
Well, if you use a repeater it will go through its model in the order you
added the items to it.
If you want to control where on the page they go, then you would need some
kind of dynamic template or overlay.

For that I used HTML tables with North, South, Center, East, West table
cells and I add the container to all 5 cells but hide the ones that I don't
want to see.
It's a bit extensive as the page map grows, but it works and it should be
okay to get you started on a better solution :)

For some other dynamic components I used Velocity as their template:
http://en.wikipedia.org/wiki/Apache_Velocity

This is the Wicket project on it:
http://wicket.apache.org/learn/projects/velocity.html

~ Thank you,
  Paul Bors

-Original Message-
From: oggie [mailto:gog...@gmail.com] 
Sent: Tuesday, August 07, 2012 4:01 PM
To: users@wicket.apache.org
Subject: dynamic control of location of panels on page

Let's say we want to have a number of widgets on the page. But we want to be
able to dynamically define what widgets are shown, and in what order they
appear on the page.

So I can create a bunch of panels, each with their own html, and add those
panels to a container to display on the screen. But how do I  control the
order of them? If I put them in a list, will they be drawn in the order they
were added to the list?

I'm following this example:
https://cwiki.apache.org/WICKET/page-with-dynamic-components.html wicket
dynamic content 

Will this type of solution work even if the widgets are of different widths?
Can we still control the layout in the html if we never know what widgets
are shown?

I hope I explained it properly.



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/dynamic-control-of-location-of-pa
nels-on-page-tp4651043.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



dynamic control of location of panels on page

2012-08-07 Thread oggie
Let's say we want to have a number of widgets on the page. But we want to be
able to dynamically define what widgets are shown, and in what order they
appear on the page.

So I can create a bunch of panels, each with their own html, and add those
panels to a container to display on the screen. But how do I  control the
order of them? If I put them in a list, will they be drawn in the order they
were added to the list?

I'm following this example:
https://cwiki.apache.org/WICKET/page-with-dynamic-components.html wicket
dynamic content 

Will this type of solution work even if the widgets are of different widths?
Can we still control the layout in the html if we never know what widgets
are shown?

I hope I explained it properly.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/dynamic-control-of-location-of-panels-on-page-tp4651043.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: using links in feedback panels

2012-06-13 Thread Martin Grigorov
Hi,

You can extend FeedbackPanel and add a AttributeModifier("onclick",
"...") to the Label that is used for the feedback message.
Use plain JavaScript to focus the form component. This will be easier
and better for the user experience.

On Wed, Jun 13, 2012 at 11:04 PM, Carter, Isaac
 wrote:
> Does anyone know if it's possible to have an error message in a feedback 
> panel "link" to the error that caused it?   Such as the user has filled in a 
> given number of fields and puts in the wrong data in one field...an error 
> message is presented in a feedback paneluser  clicks on the error message 
> and it takes them directly to the field that contains the error.  That's the 
> scenario I have in mind.
>
> Suggestions anyone?
>
> Thanks,
>
> Isaac Carter
>
> 
> This e-mail and any attachments are intended only for the use of the 
> addressee(s) named herein and may contain proprietary information. If you are 
> not the intended recipient of this e-mail or believe that you received this 
> email in error, please take immediate action to notify the sender of the 
> apparent error by reply e-mail; permanently delete the e-mail and any 
> attachments from your computer; and do not disseminate, distribute, use, or 
> copy this message and any attachments.



-- 
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



using links in feedback panels

2012-06-13 Thread Carter, Isaac
Does anyone know if it's possible to have an error message in a feedback panel 
"link" to the error that caused it?   Such as the user has filled in a given 
number of fields and puts in the wrong data in one field...an error message is 
presented in a feedback paneluser  clicks on the error message and it takes 
them directly to the field that contains the error.  That's the scenario I have 
in mind.

Suggestions anyone?

Thanks,

Isaac Carter


This e-mail and any attachments are intended only for the use of the 
addressee(s) named herein and may contain proprietary information. If you are 
not the intended recipient of this e-mail or believe that you received this 
email in error, please take immediate action to notify the sender of the 
apparent error by reply e-mail; permanently delete the e-mail and any 
attachments from your computer; and do not disseminate, distribute, use, or 
copy this message and any attachments.


RE: Event handling and swapping panels

2012-03-28 Thread Jeffrey Schneller
Thank you Igor and Francois!!  This solved my problem and it is working 
perfectly now.



-Original Message-
From: Francois Meillet [mailto:qq...@gmail.com] 
Sent: Wednesday, March 28, 2012 4:45 PM
To: users@wicket.apache.org
Subject: Re: Event handling and swapping panels

Unless you override the onEvent method for each panel (MyPanel1, MyPanel2 and 
MyPanel3) , only the first working panel will manage the event.

one solution would be : 

public class Admin extends WebPage {

@Override
public void onEvent(IEvent event) {
super.onEvent(event);

if (event.getPayload() instanceof MyPanelEvent) {
MyPanelEvent yourEvent = (MyPanelEvent) event.getPayload();
showSelectedPanel(yourEvent.getTarget(), yourEvent);
} else {
// your code here
}
}


 private void showSelectedPanel(AjaxRequestTarget target, MyPanelEvent e) {

Component replacement;
switch (e.getType()) {
case PANEL1:
replacement = new MyPanel1("workingPanel");
//
break;
case PANEL2:
replacement = new MyPanel2("workingPanel");
break;
case PANEL3:
replacement = new MyPanel3("workingPanel");
break;
default:
replacement = Test333.this.workingPanel;
break;
}
Admin.this.workingPanel.replaceWith(replacement); 
Admin.this.workingPanel = replacement; 
replacement.setOutputMarkupId(true);
target.add(replacement);
target.appendJavaScript("alert('Panel changed to: " + e.getType() + 
"');");
}

public void init() {

workingPanel = new PanelAAA("workingPanel");
workingPanel.setOutputMarkupId(true);
add(workingPanel);

AjaxLink p1Link = new AjaxLink("p1Link") {
@Override
public void onClick(AjaxRequestTarget target) {
log.debug("onClick");
send(getPage(), Broadcast.BREADTH, new YourEvent(target, 
YourEvent.Type.PANEL1));
}
};
p1Link.setOutputMarkupId(true);
p1Link.setMarkupId("p1Link");
add(p1Link);

AjaxLink p2Link = new AjaxLink("p2Link") {
@Override
public void onClick(AjaxRequestTarget target) {
log.debug("onClick");
send(getPage(), Broadcast.BREADTH, new YourEvent(target, 
YourEvent.Type.PANEL2));
}
};
p2Link.setOutputMarkupId(true);
p2Link.setMarkupId("p2Link");
add(p2Link);

AjaxLink p3Link = new AjaxLink("p3Link") {
@Override
public void onClick(AjaxRequestTarget target) {
log.debug("onClick");
send(getPage(), Broadcast.BREADTH, new YourEvent(target, 
YourEvent.Type.PANEL3));
}
};
p3Link.setOutputMarkupId(true);
p3Link.setMarkupId("p3Link");
add(p3Link);
}

}


François


Le 28 mars 2012 à 22:35, Jeffrey Schneller a écrit :

> Only problem is that it is not working.   The panels never update to the new 
> panels.  I can see that the onEvent fires as the javascript alert is shown.  
> But the javascript is only shown the first time I click a link.  After the 
> first click, all the links call their onClick method and send the event out 
> but the event is never picked up.  Does every panel need to have its own 
> onEvent method to listen for the events.  
> 
> If so, I think the old method of handling ajax is going to be easier.
> 
> 
> -Original Message-
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Wednesday, March 28, 2012 3:49 PM
> To: users@wicket.apache.org
> Subject: Re: Event handling and swapping panels
> 
> that is correct
> 
> -igor
> 
> On Wed, Mar 28, 2012 at 12:41 PM, Jeffrey Schneller 
>  wrote:
>> Here it is:
>> 
>> 
>> public class Admin extends WebPage {
>> 
>>private Component workingPanel;
>> 
>>public Admin() {
>>super();
>>init();
>>}
>> 
>>@Override
>>public void renderHead(IHeaderResponse response) {
>>response.renderCSSReference("css/admin.css");
>>super.renderHead(response);
>>}
>> 
>>public void init() {
>>workingPanel = new MyEmptyPanel("workingPanel") {
>>@Override
>>public void onEvent(IEvent event) {
>>   

Re: Event handling and swapping panels

2012-03-28 Thread Francois Meillet
Unless you override the onEvent method for each panel (MyPanel1, MyPanel2 and 
MyPanel3) ,
only the first working panel will manage the event.

one solution would be : 

public class Admin extends WebPage {

@Override
public void onEvent(IEvent event) {
super.onEvent(event);

if (event.getPayload() instanceof MyPanelEvent) {
MyPanelEvent yourEvent = (MyPanelEvent) event.getPayload();
showSelectedPanel(yourEvent.getTarget(), yourEvent);
} else {
// your code here
}
}


 private void showSelectedPanel(AjaxRequestTarget target, MyPanelEvent e) {

Component replacement;
switch (e.getType()) {
case PANEL1:
replacement = new MyPanel1("workingPanel");
//
break;
case PANEL2:
replacement = new MyPanel2("workingPanel");
break;
case PANEL3:
replacement = new MyPanel3("workingPanel");
break;
default:
replacement = Test333.this.workingPanel;
break;
}
Admin.this.workingPanel.replaceWith(replacement); 
Admin.this.workingPanel = replacement; 
replacement.setOutputMarkupId(true);
target.add(replacement);
target.appendJavaScript("alert('Panel changed to: " + e.getType() + 
"');");
}

public void init() {

workingPanel = new PanelAAA("workingPanel");
workingPanel.setOutputMarkupId(true);
add(workingPanel);

AjaxLink p1Link = new AjaxLink("p1Link") {
@Override
public void onClick(AjaxRequestTarget target) {
log.debug("onClick");
send(getPage(), Broadcast.BREADTH, new YourEvent(target, 
YourEvent.Type.PANEL1));
}
};
p1Link.setOutputMarkupId(true);
p1Link.setMarkupId("p1Link");
add(p1Link);

AjaxLink p2Link = new AjaxLink("p2Link") {
@Override
public void onClick(AjaxRequestTarget target) {
log.debug("onClick");
send(getPage(), Broadcast.BREADTH, new YourEvent(target, 
YourEvent.Type.PANEL2));
}
};
p2Link.setOutputMarkupId(true);
p2Link.setMarkupId("p2Link");
add(p2Link);

AjaxLink p3Link = new AjaxLink("p3Link") {
@Override
public void onClick(AjaxRequestTarget target) {
log.debug("onClick");
send(getPage(), Broadcast.BREADTH, new YourEvent(target, 
YourEvent.Type.PANEL3));
}
};
p3Link.setOutputMarkupId(true);
p3Link.setMarkupId("p3Link");
add(p3Link);
}

}


François


Le 28 mars 2012 à 22:35, Jeffrey Schneller a écrit :

> Only problem is that it is not working.   The panels never update to the new 
> panels.  I can see that the onEvent fires as the javascript alert is shown.  
> But the javascript is only shown the first time I click a link.  After the 
> first click, all the links call their onClick method and send the event out 
> but the event is never picked up.  Does every panel need to have its own 
> onEvent method to listen for the events.  
> 
> If so, I think the old method of handling ajax is going to be easier.
> 
> 
> -Original Message-
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
> Sent: Wednesday, March 28, 2012 3:49 PM
> To: users@wicket.apache.org
> Subject: Re: Event handling and swapping panels
> 
> that is correct
> 
> -igor
> 
> On Wed, Mar 28, 2012 at 12:41 PM, Jeffrey Schneller 
>  wrote:
>> Here it is:
>> 
>> 
>> public class Admin extends WebPage {
>> 
>>private Component workingPanel;
>> 
>>public Admin() {
>>super();
>>init();
>>}
>> 
>>@Override
>>public void renderHead(IHeaderResponse response) {
>>response.renderCSSReference("css/admin.css");
>>super.renderHead(response);
>>}
>> 
>>public void init() {
>>workingPanel = new MyEmptyPanel("workingPanel") {
>>@Override
>>public void onEvent(IEvent event) {
>>if (event.getPayload() instanceof 
>> MyPanelEvent) {
>>MyPanelEvent e = (MyPanelEvent) 
>> event.getPayload();
>>AjaxRequestTarget target = 
>> e.getTarget();
>>

Re: Event handling and swapping panels

2012-03-28 Thread Igor Vaynberg
yes, every panel has to have onevent. in this case the panel that has
onevent is replaced by a panel that doesnt, so it no longer receives
the event. what you should do is put the onevent in the page, not in
the panel.

-igor

On Wed, Mar 28, 2012 at 1:35 PM, Jeffrey Schneller
 wrote:
> Only problem is that it is not working.   The panels never update to the new 
> panels.  I can see that the onEvent fires as the javascript alert is shown.  
> But the javascript is only shown the first time I click a link.  After the 
> first click, all the links call their onClick method and send the event out 
> but the event is never picked up.  Does every panel need to have its own 
> onEvent method to listen for the events.
>
> If so, I think the old method of handling ajax is going to be easier.
>
>
> -Original Message-
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Wednesday, March 28, 2012 3:49 PM
> To: users@wicket.apache.org
> Subject: Re: Event handling and swapping panels
>
> that is correct
>
> -igor
>
> On Wed, Mar 28, 2012 at 12:41 PM, Jeffrey Schneller 
>  wrote:
>> Here it is:
>>
>>
>> public class Admin extends WebPage {
>>
>>        private Component workingPanel;
>>
>>        public Admin() {
>>                super();
>>                init();
>>        }
>>
>>        @Override
>>        public void renderHead(IHeaderResponse response) {
>>                response.renderCSSReference("css/admin.css");
>>                super.renderHead(response);
>>        }
>>
>>        public void init() {
>>                workingPanel = new MyEmptyPanel("workingPanel") {
>>                        @Override
>>                        public void onEvent(IEvent event) {
>>                                if (event.getPayload() instanceof
>> MyPanelEvent) {
>>                                        MyPanelEvent e = (MyPanelEvent)
>> event.getPayload();
>>                                        AjaxRequestTarget target =
>> e.getTarget();
>>
>>                                        Component replacement;
>>                                        switch (e.getType()) {
>>                                        case MyPanelEvent.PANEL1:
>>                                                replacement = new
>> MyPanel1(this.getId());
>>                                                break;
>>                                        case MyPanelEvent.PANEL2:
>>                                                replacement = new
>> MyPanel2(this.getId());
>>                                                break;
>>                                        case MyPanelEvent.PANEL3:
>>                                                replacement = new
>> MyPanel3(this.getId());
>>                                                break;
>>                                        default:
>>                                                replacement =
>> Admin.this.workingPanel;
>>                                                break;
>>                                        }
>>
>>                                        
>> Admin.this.workingPanel.replaceWith(replacement);       // IS THIS RIGHT?
>>                                        Admin.this.workingPanel = 
>> replacement;                  // IS THIS RIGHT?
>>                                        this.setOutputMarkupId(true);
>>                                        target.add(this);
>>
>> target.appendJavaScript("alert('Panel changed to: " + e.getType() +
>> "');");     // place-holder for future javascript to be called
>>                                }
>>                                super.onEvent(event);
>>                        }
>>                };
>>                workingPanel.setOutputMarkupId(true);
>>                add(workingPanel);
>>
>>                AjaxLink p1Link = new AjaxLink("p1Link") {
>>                        @Override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                send(getPage(), Broadcast.BREADTH, new
>> MyPanelEvent(target, MyPanelEvent.PANEL1));
>>                        }
>>                };
>>                p1Link.setOutputMarkupId(true);
>>                p1Link.setMarkupId("p1Link");
>>                add(p1Link);
>>
>>                AjaxLink p2Link = new AjaxLink("p2Link") {
>>                        @Override
>>                   

RE: Event handling and swapping panels

2012-03-28 Thread Jeffrey Schneller
Only problem is that it is not working.   The panels never update to the new 
panels.  I can see that the onEvent fires as the javascript alert is shown.  
But the javascript is only shown the first time I click a link.  After the 
first click, all the links call their onClick method and send the event out but 
the event is never picked up.  Does every panel need to have its own onEvent 
method to listen for the events.  

If so, I think the old method of handling ajax is going to be easier.


-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Wednesday, March 28, 2012 3:49 PM
To: users@wicket.apache.org
Subject: Re: Event handling and swapping panels

that is correct

-igor

On Wed, Mar 28, 2012 at 12:41 PM, Jeffrey Schneller 
 wrote:
> Here it is:
>
>
> public class Admin extends WebPage {
>
>        private Component workingPanel;
>
>        public Admin() {
>                super();
>                init();
>        }
>
>        @Override
>        public void renderHead(IHeaderResponse response) {
>                response.renderCSSReference("css/admin.css");
>                super.renderHead(response);
>        }
>
>        public void init() {
>                workingPanel = new MyEmptyPanel("workingPanel") {
>                        @Override
>                        public void onEvent(IEvent event) {
>                                if (event.getPayload() instanceof 
> MyPanelEvent) {
>                                        MyPanelEvent e = (MyPanelEvent) 
> event.getPayload();
>                                        AjaxRequestTarget target = 
> e.getTarget();
>
>                                        Component replacement;
>                                        switch (e.getType()) {
>                                        case MyPanelEvent.PANEL1:
>                                                replacement = new 
> MyPanel1(this.getId());
>                                                break;
>                                        case MyPanelEvent.PANEL2:
>                                                replacement = new 
> MyPanel2(this.getId());
>                                                break;
>                                        case MyPanelEvent.PANEL3:
>                                                replacement = new 
> MyPanel3(this.getId());
>                                                break;
>                                        default:
>                                                replacement = 
> Admin.this.workingPanel;
>                                                break;
>                                        }
>
>                                        
> Admin.this.workingPanel.replaceWith(replacement);       // IS THIS RIGHT?
>                                        Admin.this.workingPanel = replacement; 
>                  // IS THIS RIGHT?
>                                        this.setOutputMarkupId(true);
>                                        target.add(this);
>                                        
> target.appendJavaScript("alert('Panel changed to: " + e.getType() + 
> "');");     // place-holder for future javascript to be called
>                                }
>                                super.onEvent(event);
>                        }
>                };
>                workingPanel.setOutputMarkupId(true);
>                add(workingPanel);
>
>                AjaxLink p1Link = new AjaxLink("p1Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL1));
>                        }
>                };
>                p1Link.setOutputMarkupId(true);
>                p1Link.setMarkupId("p1Link");
>                add(p1Link);
>
>                AjaxLink p2Link = new AjaxLink("p2Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL2));
>                        }
>                };
>                p2Link.setOutputMarkupId(true);
>                p2Link.setMarkupId("p2Link");
>                add(p2Link);
>
>                AjaxLink p3Link = new AjaxLink("p3Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, My

Re: Event handling and swapping panels

2012-03-28 Thread Igor Vaynberg
that is correct

-igor

On Wed, Mar 28, 2012 at 12:41 PM, Jeffrey Schneller
 wrote:
> Here it is:
>
>
> public class Admin extends WebPage {
>
>        private Component workingPanel;
>
>        public Admin() {
>                super();
>                init();
>        }
>
>        @Override
>        public void renderHead(IHeaderResponse response) {
>                response.renderCSSReference("css/admin.css");
>                super.renderHead(response);
>        }
>
>        public void init() {
>                workingPanel = new MyEmptyPanel("workingPanel") {
>                        @Override
>                        public void onEvent(IEvent event) {
>                                if (event.getPayload() instanceof 
> MyPanelEvent) {
>                                        MyPanelEvent e = (MyPanelEvent) 
> event.getPayload();
>                                        AjaxRequestTarget target = 
> e.getTarget();
>
>                                        Component replacement;
>                                        switch (e.getType()) {
>                                        case MyPanelEvent.PANEL1:
>                                                replacement = new 
> MyPanel1(this.getId());
>                                                break;
>                                        case MyPanelEvent.PANEL2:
>                                                replacement = new 
> MyPanel2(this.getId());
>                                                break;
>                                        case MyPanelEvent.PANEL3:
>                                                replacement = new 
> MyPanel3(this.getId());
>                                                break;
>                                        default:
>                                                replacement = 
> Admin.this.workingPanel;
>                                                break;
>                                        }
>
>                                        
> Admin.this.workingPanel.replaceWith(replacement);       // IS THIS RIGHT?
>                                        Admin.this.workingPanel = replacement; 
>                  // IS THIS RIGHT?
>                                        this.setOutputMarkupId(true);
>                                        target.add(this);
>                                        target.appendJavaScript("alert('Panel 
> changed to: " + e.getType() + "');");     // place-holder for future 
> javascript to be called
>                                }
>                                super.onEvent(event);
>                        }
>                };
>                workingPanel.setOutputMarkupId(true);
>                add(workingPanel);
>
>                AjaxLink p1Link = new AjaxLink("p1Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL1));
>                        }
>                };
>                p1Link.setOutputMarkupId(true);
>                p1Link.setMarkupId("p1Link");
>                add(p1Link);
>
>                AjaxLink p2Link = new AjaxLink("p2Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL2));
>                        }
>                };
>                p2Link.setOutputMarkupId(true);
>                p2Link.setMarkupId("p2Link");
>                add(p2Link);
>
>                AjaxLink p3Link = new AjaxLink("p3Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL3));
>                        }
>                };
>                p3Link.setOutputMarkupId(true);
>                p3Link.setMarkupId("p3Link");
>                add(p3Link);
>        }
> }
>
> -Original Message-
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Wednesday, March 28, 2012 3:29 PM
> To: users@wicket.apache.org
> Subject: Re: Event handling and swapping panels
>
> paste your entire panel/page class...
>
> -igor
>
> On Wed, Mar 28, 2012 at 12:15 PM, Jeffrey Schneller 
>  wrote:
>> Thanks.  But what does OuterPanelClass refer to in my example?
>>
>&g

RE: Event handling and swapping panels

2012-03-28 Thread Jeffrey Schneller
Here it is:


public class Admin extends WebPage {

private Component workingPanel;

public Admin() {
super();
init();
}

@Override
public void renderHead(IHeaderResponse response) {
response.renderCSSReference("css/admin.css");
super.renderHead(response);
}

public void init() {
workingPanel = new MyEmptyPanel("workingPanel") {
@Override
public void onEvent(IEvent event) {
if (event.getPayload() instanceof MyPanelEvent) 
{
MyPanelEvent e = (MyPanelEvent) 
event.getPayload();
AjaxRequestTarget target = 
e.getTarget();

Component replacement;
switch (e.getType()) {
case MyPanelEvent.PANEL1: 
replacement = new 
MyPanel1(this.getId());
break;
case MyPanelEvent.PANEL2: 
replacement = new 
MyPanel2(this.getId());
break;
case MyPanelEvent.PANEL3: 
replacement = new 
MyPanel3(this.getId());
break;
default:
replacement = 
Admin.this.workingPanel;
break;
}


Admin.this.workingPanel.replaceWith(replacement);   // IS THIS RIGHT?
Admin.this.workingPanel = replacement;  
// IS THIS RIGHT?
this.setOutputMarkupId(true);
target.add(this);
target.appendJavaScript("alert('Panel 
changed to: " + e.getType() + "');"); // place-holder for future javascript 
to be called
}
super.onEvent(event);
}
};
workingPanel.setOutputMarkupId(true);
add(workingPanel);

AjaxLink p1Link = new AjaxLink("p1Link") {
@Override
public void onClick(AjaxRequestTarget target) {
send(getPage(), Broadcast.BREADTH, new 
MyPanelEvent(target, MyPanelEvent.PANEL1));  
}
};
p1Link.setOutputMarkupId(true);
p1Link.setMarkupId("p1Link");
add(p1Link);

AjaxLink p2Link = new AjaxLink("p2Link") {
@Override
public void onClick(AjaxRequestTarget target) {
send(getPage(), Broadcast.BREADTH, new 
MyPanelEvent(target, MyPanelEvent.PANEL2));
}
};
p2Link.setOutputMarkupId(true);
p2Link.setMarkupId("p2Link");
add(p2Link);

AjaxLink p3Link = new AjaxLink("p3Link") {
@Override
public void onClick(AjaxRequestTarget target) {
send(getPage(), Broadcast.BREADTH, new 
MyPanelEvent(target, MyPanelEvent.PANEL3));
}
};
p3Link.setOutputMarkupId(true);
p3Link.setMarkupId("p3Link");
add(p3Link);
}
}

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Wednesday, March 28, 2012 3:29 PM
To: users@wicket.apache.org
Subject: Re: Event handling and swapping panels

paste your entire panel/page class...

-igor

On Wed, Mar 28, 2012 at 12:15 PM, Jeffrey Schneller 
 wrote:
> Thanks.  But what does OuterPanelClass refer to in my example?
>
> I don't think either of these are right:
>
> MyEmptyPanel.this.panel.replaceWith(replacement);
> -or-
> MyPage.this.panel.replaceWith(replacement);
>
> Or do I need to define workingPanel as a private member of my page class and 
> then have:
>
> MyPage.this.workingPanel.replaceWith(replacement);
> MyPage.this.workingPanel = replacement;
>
>
>
>
>
>
> -Original Message-
&

Re: Event handling and swapping panels

2012-03-28 Thread Igor Vaynberg
paste your entire panel/page class...

-igor

On Wed, Mar 28, 2012 at 12:15 PM, Jeffrey Schneller
 wrote:
> Thanks.  But what does OuterPanelClass refer to in my example?
>
> I don't think either of these are right:
>
> MyEmptyPanel.this.panel.replaceWith(replacement);
> -or-
> MyPage.this.panel.replaceWith(replacement);
>
> Or do I need to define workingPanel as a private member of my page class and 
> then have:
>
> MyPage.this.workingPanel.replaceWith(replacement);
> MyPage.this.workingPanel = replacement;
>
>
>
>
>
>
> -Original Message-
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Wednesday, March 28, 2012 3:07 PM
> To: users@wicket.apache.org
> Subject: Re: Event handling and swapping panels
>
> OuterPanelClass.this.panel.replaceWith(replacement);
> OuterPanelClass.this.panel=replacement;
>
> -igor
>
> On Wed, Mar 28, 2012 at 11:33 AM, Jeffrey Schneller 
>  wrote:
>> I want to swap panels using the event model in 1.5.  This is very similar to 
>> the panel swapping code (wicket 1.4.x)  found in the Apache Wicket Cookbook 
>> but uses the event model instead.  The problem is I can't set the panel 
>> equal to its replacement, like you would in 1.4.x.  This is found on the 
>> line marked * THIS IS NOT POSSIBLE *.
>>
>> How would you go about doing this?  Is it even possible?
>>
>> Component workingPanel = new MyEmptyPanel("workingPanel") {
>>                @Override
>>                public void onEvent(IEvent event) {
>>                                                if (event.getPayload()
>> instanceof MyPanelEvent) {
>>
>> MyPanelEvent e = (MyPanelEvent) event.getPayload();
>>
>>                                                Component replacement;
>>                                                                switch
>> (e.getType()) {
>>
>>                                                                case 
>> MyPanelEvent.PANEL1:
>>
>> replacement = new MyFirstPanel(this.getId());
>>                                                                break;
>>                                                default:
>>
>> replacement = this;
>>                                                                break;
>>                                                                }
>>
>> this.replaceWith(replacement);
>>                                                this. = replacement;
>> // ** THIS IS NOT POSSIBLE - HOW WOULD I DO THIS ***
>>
>> this.setOutputMarkupId(true);
>>                                                AjaxRequestTarget
>> target = e.getTarget();
>>                                                target.add(this);
>>                                }
>>                                super.onEvent(event);
>>                }
>> workingPanel.setOutputMarkupId(true);
>> add(workingPanel);
>>
>> AjaxLink firsttab = new AjaxLink("firsttab") {
>>                @Override
>>                public void onClick(AjaxRequestTarget target) {
>>                                send(getPage(), Broadcast.BREADTH, new
>> MyPanelEvent (target, MyPanelEvent.PANEL1));
>>                }
>> };
>> firsttab.setOutputMarkupId(true);
>> firsttab.setMarkupId("firsttab ");
>> add(firsttab);
>>
>
> -
> 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: Event handling and swapping panels

2012-03-28 Thread Jeffrey Schneller
Thanks.  But what does OuterPanelClass refer to in my example? 

I don't think either of these are right:

MyEmptyPanel.this.panel.replaceWith(replacement);
-or-
MyPage.this.panel.replaceWith(replacement);

Or do I need to define workingPanel as a private member of my page class and 
then have:

MyPage.this.workingPanel.replaceWith(replacement);
MyPage.this.workingPanel = replacement;






-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Wednesday, March 28, 2012 3:07 PM
To: users@wicket.apache.org
Subject: Re: Event handling and swapping panels

OuterPanelClass.this.panel.replaceWith(replacement);
OuterPanelClass.this.panel=replacement;

-igor

On Wed, Mar 28, 2012 at 11:33 AM, Jeffrey Schneller 
 wrote:
> I want to swap panels using the event model in 1.5.  This is very similar to 
> the panel swapping code (wicket 1.4.x)  found in the Apache Wicket Cookbook 
> but uses the event model instead.  The problem is I can't set the panel equal 
> to its replacement, like you would in 1.4.x.  This is found on the line 
> marked * THIS IS NOT POSSIBLE *.
>
> How would you go about doing this?  Is it even possible?
>
> Component workingPanel = new MyEmptyPanel("workingPanel") {
>                @Override
>                public void onEvent(IEvent event) {
>                                                if (event.getPayload() 
> instanceof MyPanelEvent) {
>                                                                
> MyPanelEvent e = (MyPanelEvent) event.getPayload();
>
>                                                Component replacement;
>                                                                switch 
> (e.getType()) {
>
>                                                                case 
> MyPanelEvent.PANEL1:
>                                                                               
>  
> replacement = new MyFirstPanel(this.getId());
>                                                                break;
>                                                default:
>                                                                
> replacement = this;
>                                                                break;
>                                                                }
>                                                
> this.replaceWith(replacement);
>                                                this. = replacement;           
>             
> // ** THIS IS NOT POSSIBLE - HOW WOULD I DO THIS ***
>                                                
> this.setOutputMarkupId(true);
>                                                AjaxRequestTarget 
> target = e.getTarget();
>                                                target.add(this);
>                                }
>                                super.onEvent(event);
>                }
> workingPanel.setOutputMarkupId(true);
> add(workingPanel);
>
> AjaxLink firsttab = new AjaxLink("firsttab") {
>                @Override
>                public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent (target, MyPanelEvent.PANEL1));
>                }
> };
> firsttab.setOutputMarkupId(true);
> firsttab.setMarkupId("firsttab ");
> add(firsttab);
>

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



Re: Event handling and swapping panels

2012-03-28 Thread Igor Vaynberg
OuterPanelClass.this.panel.replaceWith(replacement);
OuterPanelClass.this.panel=replacement;

-igor

On Wed, Mar 28, 2012 at 11:33 AM, Jeffrey Schneller
 wrote:
> I want to swap panels using the event model in 1.5.  This is very similar to 
> the panel swapping code (wicket 1.4.x)  found in the Apache Wicket Cookbook 
> but uses the event model instead.  The problem is I can't set the panel equal 
> to its replacement, like you would in 1.4.x.  This is found on the line 
> marked * THIS IS NOT POSSIBLE *.
>
> How would you go about doing this?  Is it even possible?
>
> Component workingPanel = new MyEmptyPanel("workingPanel") {
>                @Override
>                public void onEvent(IEvent event) {
>                                                if (event.getPayload() 
> instanceof MyPanelEvent) {
>                                                                MyPanelEvent e 
> = (MyPanelEvent) event.getPayload();
>
>                                                Component replacement;
>                                                                switch 
> (e.getType()) {
>
>                                                                case 
> MyPanelEvent.PANEL1:
>                                                                               
>  replacement = new MyFirstPanel(this.getId());
>                                                                break;
>                                                default:
>                                                                replacement = 
> this;
>                                                                break;
>                                                                }
>                                                this.replaceWith(replacement);
>                                                this. = replacement;           
>             // ** THIS IS NOT POSSIBLE - HOW WOULD I DO THIS ***
>                                                this.setOutputMarkupId(true);
>                                                AjaxRequestTarget target = 
> e.getTarget();
>                                                target.add(this);
>                                }
>                                super.onEvent(event);
>                }
> workingPanel.setOutputMarkupId(true);
> add(workingPanel);
>
> AjaxLink firsttab = new AjaxLink("firsttab") {
>                @Override
>                public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent (target, MyPanelEvent.PANEL1));
>                }
> };
> firsttab.setOutputMarkupId(true);
> firsttab.setMarkupId("firsttab ");
> add(firsttab);
>


Event handling and swapping panels

2012-03-28 Thread Jeffrey Schneller
I want to swap panels using the event model in 1.5.  This is very similar to 
the panel swapping code (wicket 1.4.x)  found in the Apache Wicket Cookbook but 
uses the event model instead.  The problem is I can't set the panel equal to 
its replacement, like you would in 1.4.x.  This is found on the line marked 
* THIS IS NOT POSSIBLE *.

How would you go about doing this?  Is it even possible?

Component workingPanel = new MyEmptyPanel("workingPanel") {
@Override
public void onEvent(IEvent event) {
if (event.getPayload() 
instanceof MyPanelEvent) {
MyPanelEvent e 
= (MyPanelEvent) event.getPayload();

Component replacement;
switch 
(e.getType()) {

case 
MyPanelEvent.PANEL1:

replacement = new MyFirstPanel(this.getId());
break;
default:
replacement = 
this;
break;
}
this.replaceWith(replacement);
this. = replacement;
   // ** THIS IS NOT POSSIBLE - HOW WOULD I DO THIS ***
this.setOutputMarkupId(true);
AjaxRequestTarget target = 
e.getTarget();
target.add(this);
}
super.onEvent(event);
}
workingPanel.setOutputMarkupId(true);
add(workingPanel);

AjaxLink firsttab = new AjaxLink("firsttab") {
@Override
public void onClick(AjaxRequestTarget target) {
send(getPage(), Broadcast.BREADTH, new 
MyPanelEvent (target, MyPanelEvent.PANEL1));
}
};
firsttab.setOutputMarkupId(true);
firsttab.setMarkupId("firsttab ");
add(firsttab);



RE: Control panels through Ajax

2012-03-14 Thread Wilhelmsen Tor Iver
> I´m really new to web programming, so how should that solve my Problem? If I 
> got it right the mediator does only know the colleagues which would be Panels 
> in my case. But the methods of these colleague Panels are hidden because of 
> inheritance (myPanel is child of Panel). Could you describe this solution a 
> bit deeper?

In general terms:

class A extends Panel {

private ABMediator mediator;

//...
add(new AjaxLink("theLink") {
public void onClick(AjaxRequestTarget target) {
mediator.callIntoB(target);
});
}
}

class B extends Panel {

// ...

public methodForTheMediator(AjaxRequestTarget target) {
// Do something
target.addComponent(someBComponent);
}
}

class ABMediator {
private A a;
private B b;

// ...

public void callIntoB(AjaxRequestTarget target) {
b. methodForTheMediator(target);
}
}

You could also leave out passing around the target and instead get it using 
AjaxRequestTarget.get(). As you see, the method invoked on B is public in this 
case.

- Tor Iver


Re: Control panels through Ajax

2012-03-14 Thread Martin Grigorov
Hi,

I think the best approach is to share models between the panels
combined with events.
I.e. Panel A uses the model to decide which node is the selected one
in the Tree. Panel B uses the model to decide what details to show for
this node.
If Panel A has a reference to Panel B then you can just do:
target.add(panelB). But if there is no direct reference then you can
use the Event system in Wicket 1.5. See
http://www.wicket-library.com/wicket-examples/events/ for an example.
Wicket sends automatically an event with the AjaxRequestTarget as a
payload for each Ajax request. You may use it or you may fire your own
event with your own payload additionally.

On Wed, Mar 14, 2012 at 2:17 PM, Alexander Zotter
 wrote:
>
>
> Hi,
>
>
>
> I´m trying to achieve a 4 Panel Page, which has a navigating panel (which is
> a wicket tree basically) and a detailpanel which should show detail for the
> selected element.
>
>
>
> My problem is how to redirect the ajax target from one Panel to the other.
> Are there any best practice examples, because I´ve been searching for a
> while now and wasn´t able to get panelbased ajax architecture examples.
>
>
>
> Thx
>
>
>



-- 
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



RE: Control panels through Ajax

2012-03-14 Thread saschisch87

Wilhelmsen Tor Iver wrote
> 
>> My problem is how to redirect the ajax target from one Panel to the
>> other.
> 
> If Panel A needs to invoke anything in Panel B then Panel A should have a
> reference to Panel B (or to a mediator object that knows about it), and
> send the AjaxRequestTarget (which applies to the entire Page's component
> structure) so that (the mediator or) Panel B can add the required
> component to it.
> 
> http://en.wikipedia.org/wiki/Mediator_pattern
> 
> 

I´m really new to web programming, so how should that solve my Problem? If I
got it right the mediator does only know the colleagues which would be
Panels in my case. But the methods of these colleague Panels are hidden
because of inheritance (myPanel is child of Panel). Could you describe this
solution a bit deeper?

thx for your fast reply btw

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Control-panels-through-Ajax-tp4471697p4471741.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: Control panels through Ajax

2012-03-14 Thread Wilhelmsen Tor Iver
> My problem is how to redirect the ajax target from one Panel to the other.

If Panel A needs to invoke anything in Panel B then Panel A should have a 
reference to Panel B (or to a mediator object that knows about it), and send 
the AjaxRequestTarget (which applies to the entire Page's component structure) 
so that (the mediator or) Panel B can add the required component to it.

http://en.wikipedia.org/wiki/Mediator_pattern

- Tor Iver

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



Control panels through Ajax

2012-03-14 Thread Alexander Zotter
 

Hi,

 

I´m trying to achieve a 4 Panel Page, which has a navigating panel (which is
a wicket tree basically) and a detailpanel which should show detail for the
selected element.

 

My problem is how to redirect the ajax target from one Panel to the other.
Are there any best practice examples, because I´ve been searching for a
while now and wasn´t able to get panelbased ajax architecture examples.

 

Thx

 



Re: Multiple Feedback panels in a page

2012-02-10 Thread Gabriel Landon
Maybe you should use ContainerFeedbackMessageFilter instead of
ComponentFeedbackMessageFilter.

Regards,

Gabriel.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Multiple-Feedback-panels-in-a-page-tp4377392p4377960.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



Multiple Feedback panels in a page

2012-02-10 Thread sudeivas
Hello,
I do have a page which contains several widgets and each widget is a
panel. I need to add different feedback panel for each of these widgets. I
tried using something like below,

final Form form = new Form("form"); 

ComponentFeedbackMessageFilter filter = new
ComponentFeedbackMessageFilter(form); 

FeedbackPanel feedback = new FeedbackPanel("feedback", filter); 
feedback.setEscapeModelStrings(false); 
add(feedback); 

Then use form.error(message) . Also added markup for feedback in .html file. 

Even I tried with ContainerFeedbackMessageFilter but nothing is working. I
am currently using wicket - 1.5.3. I am getting the message in all the
feedback panels in the page. Am I doing something wrong? 

Any information on this will be helpful.

Thanks,
Suresh

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Multiple-Feedback-panels-in-a-page-tp4377392p4377392.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 Feedback panels and Hibernate Validation

2012-01-27 Thread Wooldridge, Keith A
No luck with this.  I tried checking message.getReporter() and it's always the 
form instead of the field.

Keith Wooldridge


-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Friday, January 27, 2012 3:24 AM
To: users@wicket.apache.org
Subject: Re: Wicket Feedback panels and Hibernate Validation

Hi,

On Thu, Jan 26, 2012 at 10:36 PM, Wooldridge, Keith A
 wrote:
> I'm trying to create a custom hibernate validator , based on bradhouse's 
> solution in this StackOverflow 
> thread<http://stackoverflow.com/questions/1972933/cross-field-validation-with-hibernate-validator-jsr-303>.
>   I'm passing in the field name that I would like the error message to be 
> associated with to addNode.  Unfortunately, my ComponentFeedbackMessageFilter 
> that is associated with the field in wicket does not know that the message 
> was directed to it.  I know wicket is getting the validation error from 
> Hibernate, because it shows up in my unfiltered feedback panel.
>
> Could it be that I'm adding the feedback messages from a Behavior instead of 
> from a FeedbackPanel directly?  The core of the Behavior, where the messages 
> get attached , is this:
>
> @Override
> public void afterRender(Component component) {
>      FormComponent fc = (FormComponent)component;
>      Response r = component.getResponse();
>
>      FeedbackMessages messages = fc.getSession().getFeedbackMessages();
>
>      if (messages.hasMessageFor(component)) {
>            r.write("");
>            IFeedbackMessageFilter filter = new 
> ComponentFeedbackMessageFilter(component);
>            for (FeedbackMessage message : messages.messages(filter)) {

Try instead with:
 for (FeedbackMessage message : messages.messagesForComponent)

and then for each message:
message.markRendered();

>                  r.write("                  r.write(message.getLevelAsString().toUpperCase());
>                  r.write("\">");
>                  
> r.write(Strings.escapeMarkup(message.getMessage().toString()));
>                  r.write("");
>            }
>            r.write("");
>      }
>      r.write("");
> }
>
> Thanks,
>
> Keith Wooldridge
>
>



-- 
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



Re: Wicket Feedback panels and Hibernate Validation

2012-01-27 Thread Martin Grigorov
Hi,

On Thu, Jan 26, 2012 at 10:36 PM, Wooldridge, Keith A
 wrote:
> I'm trying to create a custom hibernate validator , based on bradhouse's 
> solution in this StackOverflow 
> thread.
>   I'm passing in the field name that I would like the error message to be 
> associated with to addNode.  Unfortunately, my ComponentFeedbackMessageFilter 
> that is associated with the field in wicket does not know that the message 
> was directed to it.  I know wicket is getting the validation error from 
> Hibernate, because it shows up in my unfiltered feedback panel.
>
> Could it be that I'm adding the feedback messages from a Behavior instead of 
> from a FeedbackPanel directly?  The core of the Behavior, where the messages 
> get attached , is this:
>
> @Override
> public void afterRender(Component component) {
>      FormComponent fc = (FormComponent)component;
>      Response r = component.getResponse();
>
>      FeedbackMessages messages = fc.getSession().getFeedbackMessages();
>
>      if (messages.hasMessageFor(component)) {
>            r.write("");
>            IFeedbackMessageFilter filter = new 
> ComponentFeedbackMessageFilter(component);
>            for (FeedbackMessage message : messages.messages(filter)) {

Try instead with:
 for (FeedbackMessage message : messages.messagesForComponent)

and then for each message:
message.markRendered();

>                  r.write("                  r.write(message.getLevelAsString().toUpperCase());
>                  r.write("\">");
>                  
> r.write(Strings.escapeMarkup(message.getMessage().toString()));
>                  r.write("");
>            }
>            r.write("");
>      }
>      r.write("");
> }
>
> Thanks,
>
> Keith Wooldridge
>
>



-- 
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



Wicket Feedback panels and Hibernate Validation

2012-01-26 Thread Wooldridge, Keith A
I'm trying to create a custom hibernate validator , based on bradhouse's 
solution in this StackOverflow 
thread.
  I'm passing in the field name that I would like the error message to be 
associated with to addNode.  Unfortunately, my ComponentFeedbackMessageFilter 
that is associated with the field in wicket does not know that the message was 
directed to it.  I know wicket is getting the validation error from Hibernate, 
because it shows up in my unfiltered feedback panel.

Could it be that I'm adding the feedback messages from a Behavior instead of 
from a FeedbackPanel directly?  The core of the Behavior, where the messages 
get attached , is this:

@Override
public void afterRender(Component component) {
  FormComponent fc = (FormComponent)component;
  Response r = component.getResponse();

  FeedbackMessages messages = fc.getSession().getFeedbackMessages();

  if (messages.hasMessageFor(component)) {
r.write("");
IFeedbackMessageFilter filter = new 
ComponentFeedbackMessageFilter(component);
for (FeedbackMessage message : messages.messages(filter)) {
  r.write("");
  
r.write(Strings.escapeMarkup(message.getMessage().toString()));
  r.write("");
}
r.write("");
  }
  r.write("");
}

Thanks,

Keith Wooldridge




Re: Internationalization on panels

2011-12-16 Thread Martin Grigorov
See DropDownChoice's constructors.
Use the one that accepts a IModel instead of List.
In #getObject() make the proper sorting.

On Fri, Dec 16, 2011 at 5:42 PM, cosmindumy  wrote:
> Can you give me a short example? I don't understand what you mean.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4205110.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
>



-- 
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



  1   2   3   4   5   6   >