Re: Page.onPageAttached() never gets called in 1.5?

2011-03-07 Thread Igor Vaynberg
inside the listener you have access to the page.

move the creation of inner panels to the onInitialize() method, where
you are also guaranteed access to the page object.

problem solved.

-igor


On Mon, Mar 7, 2011 at 3:33 PM, Robin Shine  wrote:
> In the listener method, I had to replace some panels (and those panels in 
> turn creates other panels). Since getPage() can not be invoked in component 
> constructors, it will be necessary to pass the page instance retrieved in 
> listener method as one of component constructor param in order to access page 
> instance there.
> This might not be a common use case. Anyway, thanks for the extensive 
> infrastructure of Wicket, I can call the onPageAttahched() method by myself 
> by subclassing PersistentManagementPage.
> Regards
> Robin
>
> --- On Tue, 3/8/11, Igor Vaynberg  wrote:
>
> From: Igor Vaynberg 
> Subject: Re: Page.onPageAttached() never gets called in 1.5?
> To: users@wicket.apache.org
> Cc: "Robin Shine" 
> Date: Tuesday, March 8, 2011, 12:02 AM
>
> i dont seem to understand the entire usecase here, if you are running
> code inside a listener then you can get page via getpage()...
>
> -igor
>
> On Mon, Mar 7, 2011 at 12:33 AM, Robin Shine  wrote:
>> Hi Igor,
>> Thanks for the response. "onConfigure" gets called only when the page has to 
>> be rendered. Previously "onPageAttached" can serve as a hook point when page 
>> is loaded from page store even if it is not rendered, for example, when 
>> invoking listener interface on components contained in the page. Although I 
>> can override PagePersistentManager to call the hook by myself, but keeping 
>> this in Wicket 1.5 would be very convenient for some use cases, for example 
>> to get current page instance in component constructor without passing page 
>> instance as a constructor param.
>> Robin
>> --- On Mon, 3/7/11, Igor Vaynberg  wrote:
>>
>> From: Igor Vaynberg 
>> Subject: Re: Page.onPageAttached() never gets called in 1.5?
>> To: users@wicket.apache.org
>> Cc: "Robin Shine" 
>> Date: Monday, March 7, 2011, 1:27 PM
>>
>> i think this method should be removed from Page, for code that needs
>> access to a page you can use onInitialize() for one-time code and
>> onConfigure() for every request.
>>
>> -igor
>>
>> On Sun, Mar 6, 2011 at 7:33 PM, Robin Shine  wrote:
>>> Hi All,
>>> We rely on this method to store the page instance being processed into a 
>>> thread local so that we can easily get current page even from component 
>>> constructors. In 1.4 this method is invoked after page is retrieved from 
>>> session store for example when click an ajax link on the page. However in 
>>> 1.5 it never gets called. Is this expected behavior or should I go ahead to 
>>> create a bug?
>>> ThanksRobin
>>
>
> -
> 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: Page.onPageAttached() never gets called in 1.5?

2011-03-07 Thread Robin Shine
In the listener method, I had to replace some panels (and those panels in turn 
creates other panels). Since getPage() can not be invoked in component 
constructors, it will be necessary to pass the page instance retrieved in 
listener method as one of component constructor param in order to access page 
instance there. 
This might not be a common use case. Anyway, thanks for the extensive 
infrastructure of Wicket, I can call the onPageAttahched() method by myself by 
subclassing PersistentManagementPage. 
Regards
Robin

--- On Tue, 3/8/11, Igor Vaynberg  wrote:

From: Igor Vaynberg 
Subject: Re: Page.onPageAttached() never gets called in 1.5?
To: users@wicket.apache.org
Cc: "Robin Shine" 
Date: Tuesday, March 8, 2011, 12:02 AM

i dont seem to understand the entire usecase here, if you are running
code inside a listener then you can get page via getpage()...

-igor

On Mon, Mar 7, 2011 at 12:33 AM, Robin Shine  wrote:
> Hi Igor,
> Thanks for the response. "onConfigure" gets called only when the page has to 
> be rendered. Previously "onPageAttached" can serve as a hook point when page 
> is loaded from page store even if it is not rendered, for example, when 
> invoking listener interface on components contained in the page. Although I 
> can override PagePersistentManager to call the hook by myself, but keeping 
> this in Wicket 1.5 would be very convenient for some use cases, for example 
> to get current page instance in component constructor without passing page 
> instance as a constructor param.
> Robin
> --- On Mon, 3/7/11, Igor Vaynberg  wrote:
>
> From: Igor Vaynberg 
> Subject: Re: Page.onPageAttached() never gets called in 1.5?
> To: users@wicket.apache.org
> Cc: "Robin Shine" 
> Date: Monday, March 7, 2011, 1:27 PM
>
> i think this method should be removed from Page, for code that needs
> access to a page you can use onInitialize() for one-time code and
> onConfigure() for every request.
>
> -igor
>
> On Sun, Mar 6, 2011 at 7:33 PM, Robin Shine  wrote:
>> Hi All,
>> We rely on this method to store the page instance being processed into a 
>> thread local so that we can easily get current page even from component 
>> constructors. In 1.4 this method is invoked after page is retrieved from 
>> session store for example when click an ajax link on the page. However in 
>> 1.5 it never gets called. Is this expected behavior or should I go ahead to 
>> create a bug?
>> ThanksRobin
>

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



Re: Run a standalone wicket app

2011-03-07 Thread Martin Funk
if you want to use maven look for 
mvn jetty:run
wicket-quickstart and wicket-examples are set up to run that way.

if you are looking for something like:
java -jar .war

the export function 'Runnable Jar File Export' might be something of help

mf


Am 07.03.2011 um 18:26 schrieb Mauro Ciancio:

> Hello all,
> I'd like to create a jar with a wicket application inside that can be
> run from the command line as it were a desktop application. I'm using
> maven and jetty and it would be great if jetty could start and listen
> on a port.
> 
> Any hints or links would be really appreciated.
> 
> Thanks in advance.
> Regards.
> -- 
> Mauro Ciancio
> http://about.me/maurociancio
> 
> -
> 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: 1.5 IEventSink adapted as behavior

2011-03-07 Thread Bertrand Guay-Paquet
Ok I created 
WICKET-3516 "Add 
behaviors to the event processing chain"


On 07/03/2011 2:35 PM, Igor Vaynberg wrote:

hrm. add an rfe to add behaviors to event chain.

-igor

On Mon, Mar 7, 2011 at 11:21 AM, Bertrand Guay-Paquet
  wrote:

Hello,

I am currently using the new inter-component events system to communicate
between components. My primary use is to "bubble up" requests (ajax
requests, switch panel events) to parent components. This enables decoupling
inner panels so they can be reused more easily in other panels.

I am now in a situation where I want to provide the same IEventSink
"behavior" to multiple component types. No problem, I'll just create a
Behavior for this I thought. The problem is that Behaviors are not included
in the processing of IEvents.

So, maybe IEventSink should be a special behavior that can be added to any
Component instead of (or in addition to) an interface? What do you think?


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



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



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



Re: 1.5 IEventSink adapted as behavior

2011-03-07 Thread Igor Vaynberg
hrm. add an rfe to add behaviors to event chain.

-igor

On Mon, Mar 7, 2011 at 11:21 AM, Bertrand Guay-Paquet
 wrote:
> Hello,
>
> I am currently using the new inter-component events system to communicate
> between components. My primary use is to "bubble up" requests (ajax
> requests, switch panel events) to parent components. This enables decoupling
> inner panels so they can be reused more easily in other panels.
>
> I am now in a situation where I want to provide the same IEventSink
> "behavior" to multiple component types. No problem, I'll just create a
> Behavior for this I thought. The problem is that Behaviors are not included
> in the processing of IEvents.
>
> So, maybe IEventSink should be a special behavior that can be added to any
> Component instead of (or in addition to) an interface? What do you think?
>
>
> -
> 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



1.5 IEventSink adapted as behavior

2011-03-07 Thread Bertrand Guay-Paquet

Hello,

I am currently using the new inter-component events system to 
communicate between components. My primary use is to "bubble up" 
requests (ajax requests, switch panel events) to parent components. This 
enables decoupling inner panels so they can be reused more easily in 
other panels.


I am now in a situation where I want to provide the same IEventSink 
"behavior" to multiple component types. No problem, I'll just create a 
Behavior for this I thought. The problem is that Behaviors are not 
included in the processing of IEvents.


So, maybe IEventSink should be a special behavior that can be added to 
any Component instead of (or in addition to) an interface? What do you 
think?



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



Re: Run a standalone wicket app

2011-03-07 Thread jcgarciam
Check the QuickStart application it has a Start.java, it will be a good
starting point.

On Mon, Mar 7, 2011 at 2:35 PM, Brown, Berlin [GCG-PFS] [via Apache Wicket]
 wrote:

> That is a more a jetty question.  Research the server jetty classes.
> ...
>
> import org.mortbay.jetty.Connector;
> import org.mortbay.jetty.Server;
> import org.mortbay.jetty.bio.SocketConnector;
> import org.mortbay.jetty.webapp.WebAppContext;
>
> Server server = new Server();
> server.start();
>
>
> -Original Message-
> From: Mauro Ciancio [mailto:[hidden 
> email]]
>
> Sent: Monday, March 07, 2011 12:26 PM
> To: Wicket Mailing List
> Subject: Run a standalone wicket app
>
> Hello all,
> I'd like to create a jar with a wicket application inside that can be
> run from the command line as it were a desktop application. I'm using
> maven and jetty and it would be great if jetty could start and listen on
> a port.
>
> Any hints or links would be really appreciated.
>
> Thanks in advance.
> Regards.
> --
> Mauro Ciancio
> http://about.me/maurociancio
>
> -
> To unsubscribe, e-mail: [hidden 
> email]
> For additional commands, e-mail: [hidden 
> email]
>
>
>
>
> -
> To unsubscribe, e-mail: [hidden 
> email]
> For additional commands, e-mail: [hidden 
> email]
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/Run-a-standalone-wicket-app-tp3339521p3339536.html
>  To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65...@n4.nabble.com
> To unsubscribe from Apache Wicket, click 
> here.
>
>



-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
--Anyone who has never made a mistake has never tried anything new.--


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Run-a-standalone-wicket-app-tp3339521p3339545.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: Run a standalone wicket app

2011-03-07 Thread Bertrand Guay-Paquet
Have a look at the Wicket quickstart project under 
src/test/java/com/mycompany/Start.java.


There is a main() method there that does exactly what you describe.

On 07/03/2011 12:34 PM, Brown, Berlin [GCG-PFS] wrote:

That is a more a jetty question.  Research the server jetty classes.
...

import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;

Server server = new Server();
server.start();


-Original Message-
From: Mauro Ciancio [mailto:maurocian...@gmail.com]
Sent: Monday, March 07, 2011 12:26 PM
To: Wicket Mailing List
Subject: Run a standalone wicket app

Hello all,
I'd like to create a jar with a wicket application inside that can be
run from the command line as it were a desktop application. I'm using
maven and jetty and it would be great if jetty could start and listen on
a port.

Any hints or links would be really appreciated.

Thanks in advance.
Regards.
--
Mauro Ciancio
http://about.me/maurociancio

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




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




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



RE: Run a standalone wicket app

2011-03-07 Thread Brown, Berlin [GCG-PFS]
That is a more a jetty question.  Research the server jetty classes.
...

import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;

Server server = new Server();
server.start();
 

-Original Message-
From: Mauro Ciancio [mailto:maurocian...@gmail.com] 
Sent: Monday, March 07, 2011 12:26 PM
To: Wicket Mailing List
Subject: Run a standalone wicket app

Hello all,
I'd like to create a jar with a wicket application inside that can be
run from the command line as it were a desktop application. I'm using
maven and jetty and it would be great if jetty could start and listen on
a port.

Any hints or links would be really appreciated.

Thanks in advance.
Regards.
--
Mauro Ciancio
http://about.me/maurociancio

-
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



Run a standalone wicket app

2011-03-07 Thread Mauro Ciancio
Hello all,
I'd like to create a jar with a wicket application inside that can be
run from the command line as it were a desktop application. I'm using
maven and jetty and it would be great if jetty could start and listen
on a port.

Any hints or links would be really appreciated.

Thanks in advance.
Regards.
-- 
Mauro Ciancio
http://about.me/maurociancio

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



Re: Page.onPageAttached() never gets called in 1.5?

2011-03-07 Thread Igor Vaynberg
i dont seem to understand the entire usecase here, if you are running
code inside a listener then you can get page via getpage()...

-igor

On Mon, Mar 7, 2011 at 12:33 AM, Robin Shine  wrote:
> Hi Igor,
> Thanks for the response. "onConfigure" gets called only when the page has to 
> be rendered. Previously "onPageAttached" can serve as a hook point when page 
> is loaded from page store even if it is not rendered, for example, when 
> invoking listener interface on components contained in the page. Although I 
> can override PagePersistentManager to call the hook by myself, but keeping 
> this in Wicket 1.5 would be very convenient for some use cases, for example 
> to get current page instance in component constructor without passing page 
> instance as a constructor param.
> Robin
> --- On Mon, 3/7/11, Igor Vaynberg  wrote:
>
> From: Igor Vaynberg 
> Subject: Re: Page.onPageAttached() never gets called in 1.5?
> To: users@wicket.apache.org
> Cc: "Robin Shine" 
> Date: Monday, March 7, 2011, 1:27 PM
>
> i think this method should be removed from Page, for code that needs
> access to a page you can use onInitialize() for one-time code and
> onConfigure() for every request.
>
> -igor
>
> On Sun, Mar 6, 2011 at 7:33 PM, Robin Shine  wrote:
>> Hi All,
>> We rely on this method to store the page instance being processed into a 
>> thread local so that we can easily get current page even from component 
>> constructors. In 1.4 this method is invoked after page is retrieved from 
>> session store for example when click an ajax link on the page. However in 
>> 1.5 it never gets called. Is this expected behavior or should I go ahead to 
>> create a bug?
>> ThanksRobin
>

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



Re: Checkbox in DataTable header

2011-03-07 Thread jomarl
We did this by implementing getHeader(String componentId) in a custom
CheckBoxColumn that implements IColumn to return a new panel that renders a
checkbox. 

Note that we are are using custromized DataTable, but the code below should
be enough to demonstrate how to add a checkbox in the column header. It's a
bit dated and could be improved, but you get the idea.

CheckboxColum extends ICustomColumn { 
  ..
  ..
  @Override
   public Component getHeader(String componentId) {
  return new CheckboxHeader(this, componentId);
   }
}

public class CheckboxHeader extends Panel {
private CheckboxColumn checkboxColumn;

public CheckboxHeader(CheckboxColumn checkboxColumn, String id) {
super(id);
this.checkboxColumn = checkboxColumn;
}

@Override
protected void onBeforeRender() {
if (!hasBeenRendered()) {
//refactor: simplify this
add(new HeadCheckboxPanel("checkbox", checkboxColumn));
add(new EmptySpacerTag("spacer"));
}
super.onBeforeRender();
}

private class EmptySpacerTag extends WebMarkupContainer {

public EmptySpacerTag(String id) {
super(id);
}

@Override
public boolean isVisible() {
return !checkboxColumn.getDataTable().isAllowSelectMultiple();
}

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
processTitleTag(tag);
}

private void processTitleTag(ComponentTag tag) {
if (checkboxColumn.getHeaderTooltipModel() != null) {
Object object =
checkboxColumn.getHeaderTooltipModel().getObject();
if (object != null) {
tag.put("title", object.toString());
}
}
}
}

public class HeadCheckboxPanel extends Panel {
private ICustomColumn column;

public HeadCheckboxPanel(String id, final CheckboxColumn checkboxColumn)
{
super(id);
this.column = checkboxColumn;
}

@Override
protected void onBeforeRender() {
if (!hasBeenRendered()) {
add(new SelectAllCheckboxTag("checkbox"));
}
super.onBeforeRender();
}

@Override
public boolean isVisible() {
return column.getDataTable().isAllowSelectMultiple();
}

private class SelectAllCheckboxTag extends WebMarkupContainer {

public SelectAllCheckboxTag(String id) {
super(id);
}

@Override
protected void onBeforeRender() {
if (!hasBeenRendered()) {
add(new CheckboxOnclickEventBehavior());
}
super.onBeforeRender();
}

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
processCheckedTag(tag);
}

private void processCheckedTag(ComponentTag tag) {
if (column.getDataTable().isAallVisibleItemsSelected()) {
tag.put("checked", "checked");
}
}
}

private class CheckboxOnclickEventBehavior extends
AjaxFormSubmitEventAdapterBehavior {

public CheckboxOnclickEventBehavior() {
super(HeadCheckboxPanel.this.column.getDataTable().getForm(),
"onclick");
}

@Override
protected void onEvent(AjaxRequestTarget target) {

preserveFormComponentInput();

boolean checked =
Strings.toBoolean(getRequest().getParameter("checked"));
if (checked) {
column.getDataTable().selectAllVisibleItems();
} else {
column.getDataTable().resetSelectedItems();
}
column.getDataTable().update();
}

@Override
public CharSequence getCallbackUrl() {
return super.getCallbackUrl() + "&checked='+this.checked+'";
}

@Override
protected CharSequence getPreconditionScript() {
return
"window.setTimeout(function(){this.checked=!this.checked}.bind(this),0);" +
super.getPreconditionScript();
}

@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new CancelEventIfNoAjaxDecorator();
}

private void preserveFormComponentInput() {
Form form = getForm();
form.visitFormComponentsPostOrder(new
PreserveFormComponentInputvisitor());
}
}
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Checkbox-in-DataTable-header-tp3335032p3339269.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: Checkbox in DataTable header

2011-03-07 Thread knecht
Yes, I know about these components, I used classes CheckBoxColumn and
CheckBoxModel classes from Wicket phonebook example. What I fail at is
adding that simple checkbox to DataTable column header. So I am looking for
advice or example of this. HeadersToolbar  in DefaultDataTable doesn't
accept it, or I am doing something wrong.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Checkbox-in-DataTable-header-tp3335032p3338552.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: Page.onPageAttached() never gets called in 1.5?

2011-03-07 Thread Robin Shine
Hi Igor, 
Thanks for the response. "onConfigure" gets called only when the page has to be 
rendered. Previously "onPageAttached" can serve as a hook point when page is 
loaded from page store even if it is not rendered, for example, when invoking 
listener interface on components contained in the page. Although I can override 
PagePersistentManager to call the hook by myself, but keeping this in Wicket 
1.5 would be very convenient for some use cases, for example to get current 
page instance in component constructor without passing page instance as a 
constructor param.
Robin
--- On Mon, 3/7/11, Igor Vaynberg  wrote:

From: Igor Vaynberg 
Subject: Re: Page.onPageAttached() never gets called in 1.5?
To: users@wicket.apache.org
Cc: "Robin Shine" 
Date: Monday, March 7, 2011, 1:27 PM

i think this method should be removed from Page, for code that needs
access to a page you can use onInitialize() for one-time code and
onConfigure() for every request.

-igor

On Sun, Mar 6, 2011 at 7:33 PM, Robin Shine  wrote:
> Hi All,
> We rely on this method to store the page instance being processed into a 
> thread local so that we can easily get current page even from component 
> constructors. In 1.4 this method is invoked after page is retrieved from 
> session store for example when click an ajax link on the page. However in 1.5 
> it never gets called. Is this expected behavior or should I go ahead to 
> create a bug?
> ThanksRobin