Re: Dynamic Select and SelectOptions

2011-02-17 Thread rawe

The solution is to nest the ListViews:
Markup:







 

 
 


Code:

Select select = new Select(selectId);
select.add(new ListView("optGroups", transList) {

@Override
protected void populateItem(ListItem item) {


MyBean myBean = (MyBean) item.getModelObject();
item.add(new OptGroup("optGroup", myBean.getName(), MyBean.getList()));
}
});

add(select);


class OptGroup extends SelectOption {

String label;

List list;

public OptGroup(String id, String label, List list) {
super(id);
this.label = label;
this.list = list;
init();
}

@SuppressWarnings("unchecked")
private void init() {
this.add(new ListView("options", list) {

@Override
protected void populateItem(ListItem item) {
MyBean2 myBean2 = (MyBean2) item.getModelObject();
item.add(new CustomSelectOption("option", 
myBean2.getName()));
}

});
}

protected void onComponentTag(final ComponentTag tag) {
 checkComponentTag(tag, "optgroup");
Select select = (Select) findParent(Select.class);
if (select == null) {
throw new WicketRuntimeException(
"OptGroup component ["
+ getPath()
+ "] cannot 
find its parent Select. All OptGroup components must be
a child of or below in the hierarchy of a Select component.");
}

tag.put("label", label);
}
}

public class CustomSelectOption extends SelectOption {
@SuppressWarnings("unchecked")
public CustomSelectOption(String id, String displayValue) {
super(id, new Model(displayValue));
}

protected void onComponentTagBody(final MarkupStream markupStream, final
ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag,
getDefaultModelObjectAsString());
}
}



-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dynamic-Select-and-SelectOptions-tp1872483p3310381.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



Problem while passing TextField value as parameter to other page

2011-02-17 Thread Jehan
-HelloWorld.Html






---HelloWorld.java

Following is code in constructor---  HelloWorld(
PageParameters
pars)

*Form* frm = *new* *Form("myform")
*

{ *protected* *void* onSubmit() { info("Form submitted"); } };

txtName = *new* TextField("atext");

frm.add(txtName);

Button okButton = *new* *Button("okbutton")
*

{

*public* *void* onSubmit() {

pars.add("aname", txtName.getInput());

setResponsePage(thetest.*class*,pars);

}

};

frm.add(okButton);

add(frm);



when I click OK button I am getting following error


Unexpected RuntimeException

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

Root cause:

java.lang.IllegalStateException: Attempt to set model object on null
model of component: myform:atext
 at org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
 at 
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
 at 
org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
 at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
 at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
 at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
 at 
org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
 at 
org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
 at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
 at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
 at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
 at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
 at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
 at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
 at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
 at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
 at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
 at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
 at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
 at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at org.mortbay.jetty.Server.handle(Server.java:326)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
 at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
 at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
 at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Complete stack:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener
targeted at component [MarkupContainer [Component id = myform]] threw
an exception
 at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193)
 at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
 at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
 at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
 at org.apache.wicket.RequestCycle.step(RequestCyc

Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Bas Gooren

Hi Jehan,

You'll need to provide your TextField with a model where it can 
load/store it's value.


This is easy to do:

new TextField("atext", Model.of(""));

Kind regards,

Bas

Op 17-2-2011 10:56, Jehan schreef:

-HelloWorld.Html






---HelloWorld.java

Following is code in constructor---  HelloWorld(
PageParameters
pars)

*Form* frm = *new* *Form("myform")
*

{ *protected* *void* onSubmit() { info("Form submitted"); } };

txtName = *new* TextField("atext");

frm.add(txtName);

Button okButton = *new* *Button("okbutton")
*

{

*public* *void* onSubmit() {

pars.add("aname", txtName.getInput());

setResponsePage(thetest.*class*,pars);

}

};

frm.add(okButton);

add(frm);



when I click OK button I am getting following error


Unexpected RuntimeException

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

Root cause:

java.lang.IllegalStateException: Attempt to set model object on null
model of component: myform:atext
  at org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
  at 
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
  at 
org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
  at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
  at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
  at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
  at 
org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
  at 
org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
  at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
  at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
  at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
  at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
  at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
  at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
  at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
  at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
  at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
  at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
  at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
  at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
  at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
  at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
  at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
  at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  at org.mortbay.jetty.Server.handle(Server.java:326)
  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
  at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
  at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
  at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Complete stack:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener
targeted at component [MarkupContainer [Component id = myform]] threw
an exception
  at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193)
  at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:7

Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Ernesto Reinaldo Barreiro
I think the problem is there is no model backing your text field.
Maybe you might want to read [1]

Ernesto

1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html

On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:
> -HelloWorld.Html
>
> 
> 
> 
> 
>
> ---HelloWorld.java
>
> Following is code in constructor---  HelloWorld(
> PageParameters
> pars)
>
> *Form* frm = *new* *Form("myform")
> *
>
> { *protected* *void* onSubmit() { info("Form submitted"); } };
>
> txtName = *new* TextField("atext");
>
> frm.add(txtName);
>
> Button okButton = *new* *Button("okbutton")
> *
>
> {
>
> *public* *void* onSubmit() {
>
> pars.add("aname", txtName.getInput());
>
> setResponsePage(thetest.*class*,pars);
>
> }
>
> };
>
> frm.add(okButton);
>
> add(frm);
>
> 
>
> when I click OK button I am getting following error
>
>
> Unexpected RuntimeException
>
>  WicketMessage: Method onFormSubmitted of interface
> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> component [MarkupContainer [Component id = myform]] threw an exception
>
> Root cause:
>
> java.lang.IllegalStateException: Attempt to set model object on null
> model of component: myform:atext
>     at org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
>     at 
> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
>     at 
> org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
>     at 
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
>     at 
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
>     at 
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
>     at 
> org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
>     at 
> org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
>     at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
>     at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
>     at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at 
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
>     at 
> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
>     at 
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>     at 
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
>     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
>     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
>     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
>     at 
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
>     at 
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
>     at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>     at 
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
>     at 
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>     at 
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>     at 
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>     at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
>     at 
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
>     at 
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>     at 
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>     at org.mortbay.jetty.Server.handle(Server.java:326)
>     at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>     at 
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
>     at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
>     at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>     at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>     at 
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>     at 
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
>
> Complete stack:
>
> org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
> interface org.apache.wicket.markup.html.form.IFormSubmitListener
> targeted at component [MarkupContainer [Component id = myform]] threw
> an exception
>     at 
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface

tab index for PagingNavigator

2011-02-17 Thread Tejash Tarun
Hi,

want to attach tab index to PagingNavigator but wondering how ??

Thanks and Regards,
Tejash


Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Jehan
Thanks Bas Gooren,

Passing values other pages using PageParameter is like Query String.

What are other ways in wicket of passing values from one page to other.

On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> I think the problem is there is no model backing your text field.
> Maybe you might want to read [1]
>
> Ernesto
>
> 1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html
>
> On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:
> > -HelloWorld.Html
> >
> > 
> > 
> > 
> > 
> >
> > ---HelloWorld.java
> >
> > Following is code in constructor---  HelloWorld(
> > PageParameters
> > pars)
> >
> > *Form* frm = *new* *Form("myform")
> > *
> >
> > { *protected* *void* onSubmit() { info("Form submitted"); } };
> >
> > txtName = *new* TextField("atext");
> >
> > frm.add(txtName);
> >
> > Button okButton = *new* *Button("okbutton")
> > *
> >
> > {
> >
> > *public* *void* onSubmit() {
> >
> > pars.add("aname", txtName.getInput());
> >
> > setResponsePage(thetest.*class*,pars);
> >
> > }
> >
> > };
> >
> > frm.add(okButton);
> >
> > add(frm);
> >
> > 
> >
> > when I click OK button I am getting following error
> >
> >
> > Unexpected RuntimeException
> >
> >  WicketMessage: Method onFormSubmitted of interface
> > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> > component [MarkupContainer [Component id = myform]] threw an exception
> >
> > Root cause:
> >
> > java.lang.IllegalStateException: Attempt to set model object on null
> > model of component: myform:atext
> > at
> org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
> > at
> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
> > at
> org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
> > at
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
> > at
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
> > at
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
> > at
> org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
> > at
> org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
> > at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
> > at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
> > at
> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
> > at
> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
> > at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> > at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
> > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
> > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
> > at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> > at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
> > at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
> > at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
> > at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
> > at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> > at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> > at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> > at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
> > at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
> > at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> > at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> > at org.mortbay.jetty.Server.handle(Server.java:326)
> > at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
> > at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
> > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
> > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
> > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> > at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPo

Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Bas Gooren

Jehan,

It depends on the URL you want to show to the user. If you want a 
bookmarkable url, you'll need to use page parameters. If the url doesn't 
matter to you, you can simply pass in parameters to the constructor of 
the other page, and then call setResponsePage(  ).


Bas

Op 17-2-2011 11:32, Jehan schreef:

Thanks Bas Gooren,

Passing values other pages using PageParameter is like Query String.

What are other ways in wicket of passing values from one page to other.

On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro<
reier...@gmail.com>  wrote:


I think the problem is there is no model backing your text field.
Maybe you might want to read [1]

Ernesto

1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html

On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:

-HelloWorld.Html






---HelloWorld.java

Following is code in constructor---  HelloWorld(
PageParameters
pars)

*Form* frm = *new* *Form("myform")
*

{ *protected* *void* onSubmit() { info("Form submitted"); } };

txtName = *new* TextField("atext");

frm.add(txtName);

Button okButton = *new* *Button("okbutton")
*

{

*public* *void* onSubmit() {

pars.add("aname", txtName.getInput());

setResponsePage(thetest.*class*,pars);

}

};

frm.add(okButton);

add(frm);



when I click OK button I am getting following error


Unexpected RuntimeException

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

Root cause:

java.lang.IllegalStateException: Attempt to set model object on null
model of component: myform:atext
 at

org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)

 at

org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)

 at

org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)

 at

org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)

 at

org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)

 at

org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)

 at

org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)

 at

org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)

 at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
 at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
 at

org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)

 at java.lang.reflect.Method.invoke(Method.java:597)
 at

org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)

 at

org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)

 at

org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)

 at

org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)

 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
 at

org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)

 at

org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)

 at

org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)

 at

org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)

 at

org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

 at

org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

 at

org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)

 at

org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)

 at

org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)

 at

org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)

 at

org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

 at org.mortbay.jetty.Server.handle(Server.java:326)
 at

org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

 at

org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)

 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
 at

org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.jav

Re: CheckBox and Repeater

2011-02-17 Thread Martin Grigorov
Either use inmethod-grid component or at least see its implementation for
CheckBoxColumn.

https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/inmethod-grid-parent
http://wicketstuff.org/grid-examples/data-grid/item-selection

On Thu, Feb 17, 2011 at 9:47 AM, Alexander Monakhov wrote:

> Hi, guys.
>
> I've got repeater, each row of which is backed by model object. Each
> row has check box, so I can select multiple rows and delete
> appropriated model objects when 'delete' button pressed.
> I have in mind two ways how to implement this. One is to parse raw
> response and retrieve post parameters that indicates which rows were
> selected. Another one is to have a list of check boxes outside of
> repeater and fill this list with any call to populateItem() method.
> When form is submitted, walk throw this list to find which rows were
> selected, then get appropriated models from parent ListItem and remove
> them.
>
> Could you give my advice? Maybe you have another approach to implement
> this?
>
> Best regards, Alexander.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: tab index for PagingNavigator

2011-02-17 Thread Martin Grigorov
override the factory methods for pagination links creation and use
AttributeAppender to assign the attribute

On Thu, Feb 17, 2011 at 12:25 PM, Tejash Tarun  wrote:

> Hi,
>
> want to attach tab index to PagingNavigator but wondering how ??
>
> Thanks and Regards,
> Tejash
>


Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Jehan
I want to pass Object of a class to other page.

On Thu, Feb 17, 2011 at 3:37 PM, Bas Gooren  wrote:

> Jehan,
>
> It depends on the URL you want to show to the user. If you want a
> bookmarkable url, you'll need to use page parameters. If the url doesn't
> matter to you, you can simply pass in parameters to the constructor of the
> other page, and then call setResponsePage(  ).
>
> Bas
>
> Op 17-2-2011 11:32, Jehan schreef:
>
> Thanks Bas Gooren,
>>
>> Passing values other pages using PageParameter is like Query String.
>>
>> What are other ways in wicket of passing values from one page to other.
>>
>> On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro<
>> reier...@gmail.com>  wrote:
>>
>> I think the problem is there is no model backing your text field.
>>> Maybe you might want to read [1]
>>>
>>> Ernesto
>>>
>>> 1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html
>>>
>>> On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:
>>>
 -HelloWorld.Html

 
 
 
 

 ---HelloWorld.java

 Following is code in constructor---  HelloWorld(
 PageParameters
 pars)

 *Form* frm = *new* *Form("myform")
 *

 { *protected* *void* onSubmit() { info("Form submitted"); } };

 txtName = *new* TextField("atext");

 frm.add(txtName);

 Button okButton = *new* *Button("okbutton")
 *

 {

 *public* *void* onSubmit() {

 pars.add("aname", txtName.getInput());

 setResponsePage(thetest.*class*,pars);

 }

 };

 frm.add(okButton);

 add(frm);

 

 when I click OK button I am getting following error


 Unexpected RuntimeException

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

 Root cause:

 java.lang.IllegalStateException: Attempt to set model object on null
 model of component: myform:atext
 at

>>> org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
>>>
 at

>>>
>>> org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
>>>
 at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
 at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
 at

>>> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
>>>
 at java.lang.reflect.Method.invoke(Method.java:597)
 at

>>>
>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
>>>
 at

>>>
>>> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
>>>
 at

>>>
>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>
 at

>>>
>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
>>>
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
 at

>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
>>>
 at

>>>
>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
>>>
 at

>>>
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>>>
 at

>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
>>>
 at

>>>
>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>
 at

>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>>>
 at

>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>>>
 at

>>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppCo

Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Martin Grigorov
public void onEvent() {

Object obj = service.getObject();
OtherPage otherPage = new OtherPage(obj);
setResponsePage(otherPage);
}

On Thu, Feb 17, 2011 at 12:51 PM, Jehan  wrote:

> I want to pass Object of a class to other page.
>
> On Thu, Feb 17, 2011 at 3:37 PM, Bas Gooren  wrote:
>
> > Jehan,
> >
> > It depends on the URL you want to show to the user. If you want a
> > bookmarkable url, you'll need to use page parameters. If the url doesn't
> > matter to you, you can simply pass in parameters to the constructor of
> the
> > other page, and then call setResponsePage(  ).
> >
> > Bas
> >
> > Op 17-2-2011 11:32, Jehan schreef:
> >
> > Thanks Bas Gooren,
> >>
> >> Passing values other pages using PageParameter is like Query String.
> >>
> >> What are other ways in wicket of passing values from one page to other.
> >>
> >> On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro<
> >> reier...@gmail.com>  wrote:
> >>
> >> I think the problem is there is no model backing your text field.
> >>> Maybe you might want to read [1]
> >>>
> >>> Ernesto
> >>>
> >>> 1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html
> >>>
> >>> On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:
> >>>
>  -HelloWorld.Html
> 
>  
>  
>  
>  
> 
>  ---HelloWorld.java
> 
>  Following is code in constructor---  HelloWorld(
>  PageParameters
>  pars)
> 
>  *Form* frm = *new* *Form("myform")
>  *
> 
>  { *protected* *void* onSubmit() { info("Form submitted"); } };
> 
>  txtName = *new* TextField("atext");
> 
>  frm.add(txtName);
> 
>  Button okButton = *new* *Button("okbutton")
>  *
> 
>  {
> 
>  *public* *void* onSubmit() {
> 
>  pars.add("aname", txtName.getInput());
> 
>  setResponsePage(thetest.*class*,pars);
> 
>  }
> 
>  };
> 
>  frm.add(okButton);
> 
>  add(frm);
> 
>  
> 
>  when I click OK button I am getting following error
> 
> 
>  Unexpected RuntimeException
> 
>   WicketMessage: Method onFormSubmitted of interface
>  org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
>  component [MarkupContainer [Component id = myform]] threw an exception
> 
>  Root cause:
> 
>  java.lang.IllegalStateException: Attempt to set model object on null
>  model of component: myform:atext
>  at
> 
> >>> org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
> >>>
>  at org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
>  at org.apache.wicket.markup.html.form.Form.process(Form.java:955)
>  at
> 
> >>> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
> >>>
>  at java.lang.reflect.Method.invoke(Method.java:597)
>  at
> 
> >>>
> >>>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
> >>>
>  at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
>  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
>  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
>  at
> 
> >>>
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
> >>>
>  at
> 
> >>>
> >>>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
> >>>
>  at
> 
> >>>
> >>>
> org

Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Jehan
I am begginer please lettle explain

On Thu, Feb 17, 2011 at 3:56 PM, Martin Grigorov wrote:

> public void onEvent() {
>
>Object obj = service.getObject();
>OtherPage otherPage = new OtherPage(obj);
>setResponsePage(otherPage);
>  }
>
> On Thu, Feb 17, 2011 at 12:51 PM, Jehan  wrote:
>
> > I want to pass Object of a class to other page.
> >
> > On Thu, Feb 17, 2011 at 3:37 PM, Bas Gooren  wrote:
> >
> > > Jehan,
> > >
> > > It depends on the URL you want to show to the user. If you want a
> > > bookmarkable url, you'll need to use page parameters. If the url
> doesn't
> > > matter to you, you can simply pass in parameters to the constructor of
> > the
> > > other page, and then call setResponsePage(  ).
> > >
> > > Bas
> > >
> > > Op 17-2-2011 11:32, Jehan schreef:
> > >
> > > Thanks Bas Gooren,
> > >>
> > >> Passing values other pages using PageParameter is like Query String.
> > >>
> > >> What are other ways in wicket of passing values from one page to
> other.
> > >>
> > >> On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro<
> > >> reier...@gmail.com>  wrote:
> > >>
> > >> I think the problem is there is no model backing your text field.
> > >>> Maybe you might want to read [1]
> > >>>
> > >>> Ernesto
> > >>>
> > >>> 1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html
> > >>>
> > >>> On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:
> > >>>
> >  -HelloWorld.Html
> > 
> >  
> >  
> >  
> >  
> > 
> >  ---HelloWorld.java
> > 
> >  Following is code in constructor---  HelloWorld(
> >  PageParameters
> >  pars)
> > 
> >  *Form* frm = *new* *Form("myform")
> >  *
> > 
> >  { *protected* *void* onSubmit() { info("Form submitted"); } };
> > 
> >  txtName = *new* TextField("atext");
> > 
> >  frm.add(txtName);
> > 
> >  Button okButton = *new* *Button("okbutton")
> >  *
> > 
> >  {
> > 
> >  *public* *void* onSubmit() {
> > 
> >  pars.add("aname", txtName.getInput());
> > 
> >  setResponsePage(thetest.*class*,pars);
> > 
> >  }
> > 
> >  };
> > 
> >  frm.add(okButton);
> > 
> >  add(frm);
> > 
> >  
> > 
> >  when I click OK button I am getting following error
> > 
> > 
> >  Unexpected RuntimeException
> > 
> >   WicketMessage: Method onFormSubmitted of interface
> >  org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> >  component [MarkupContainer [Component id = myform]] threw an
> exception
> > 
> >  Root cause:
> > 
> >  java.lang.IllegalStateException: Attempt to set model object on null
> >  model of component: myform:atext
> >  at
> > 
> > >>>
> org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
> > >>>
> >  at
> org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
> >  at
> org.apache.wicket.markup.html.form.Form.process(Form.java:955)
> >  at
> > 
> > >>>
> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
> > >>>
> >  at java.lang.reflect.Method.invoke(Method.java:597)
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> > >>>
> >  at
> > 
> > >>>
> > >>>
> >
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
> > >>>
> >  

Re: Problem while passing TextField value as parameter to other page

2011-02-17 Thread Jehan
Thanks it is done

On Thu, Feb 17, 2011 at 4:02 PM, Jehan  wrote:

> I am begginer please lettle explain
>
>
> On Thu, Feb 17, 2011 at 3:56 PM, Martin Grigorov wrote:
>
>> public void onEvent() {
>>
>>Object obj = service.getObject();
>>OtherPage otherPage = new OtherPage(obj);
>>setResponsePage(otherPage);
>>  }
>>
>> On Thu, Feb 17, 2011 at 12:51 PM, Jehan  wrote:
>>
>> > I want to pass Object of a class to other page.
>> >
>> > On Thu, Feb 17, 2011 at 3:37 PM, Bas Gooren  wrote:
>> >
>> > > Jehan,
>> > >
>> > > It depends on the URL you want to show to the user. If you want a
>> > > bookmarkable url, you'll need to use page parameters. If the url
>> doesn't
>> > > matter to you, you can simply pass in parameters to the constructor of
>> > the
>> > > other page, and then call setResponsePage(  ).
>> > >
>> > > Bas
>> > >
>> > > Op 17-2-2011 11:32, Jehan schreef:
>> > >
>> > > Thanks Bas Gooren,
>> > >>
>> > >> Passing values other pages using PageParameter is like Query String.
>> > >>
>> > >> What are other ways in wicket of passing values from one page to
>> other.
>> > >>
>> > >> On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro<
>> > >> reier...@gmail.com>  wrote:
>> > >>
>> > >> I think the problem is there is no model backing your text field.
>> > >>> Maybe you might want to read [1]
>> > >>>
>> > >>> Ernesto
>> > >>>
>> > >>> 1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html
>> > >>>
>> > >>> On Thu, Feb 17, 2011 at 10:56 AM, Jehan  wrote:
>> > >>>
>> >  -HelloWorld.Html
>> > 
>> >  
>> >  
>> >  
>> >  
>> > 
>> >  ---HelloWorld.java
>> > 
>> >  Following is code in constructor---
>>  HelloWorld(
>> >  PageParameters
>> >  pars)
>> > 
>> >  *Form* frm = *new* *Form("myform")
>> >  *
>> > 
>> >  { *protected* *void* onSubmit() { info("Form submitted"); } };
>> > 
>> >  txtName = *new* TextField("atext");
>> > 
>> >  frm.add(txtName);
>> > 
>> >  Button okButton = *new* *Button("okbutton")
>> >  *
>> > 
>> >  {
>> > 
>> >  *public* *void* onSubmit() {
>> > 
>> >  pars.add("aname", txtName.getInput());
>> > 
>> >  setResponsePage(thetest.*class*,pars);
>> > 
>> >  }
>> > 
>> >  };
>> > 
>> >  frm.add(okButton);
>> > 
>> >  add(frm);
>> > 
>> >  
>> > 
>> >  when I click OK button I am getting following error
>> > 
>> > 
>> >  Unexpected RuntimeException
>> > 
>> >   WicketMessage: Method onFormSubmitted of interface
>> >  org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
>> >  component [MarkupContainer [Component id = myform]] threw an
>> exception
>> > 
>> >  Root cause:
>> > 
>> >  java.lang.IllegalStateException: Attempt to set model object on
>> null
>> >  model of component: myform:atext
>> >  at
>> > 
>> > >>>
>> org.apache.wicket.Component.setDefaultModelObject(Component.java:3105)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078)
>> > >>>
>> >  at
>> org.apache.wicket.markup.html.form.Form.process(Form.java:1028)
>> >  at
>> org.apache.wicket.markup.html.form.Form.process(Form.java:955)
>> >  at
>> > 
>> > >>>
>> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920)
>> > >>>
>> >  at java.lang.reflect.Method.invoke(Method.java:597)
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >
>> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
>> > >>>
>> >  at
>> > 
>> > >>>
>> > >>>
>> >

Dropdown + Model

2011-02-17 Thread Christian Grobmeier
Hi folks,

coming from the struts world, i need to get used to Wicket models. I
am still unsure if I use them correct, so i would like to ask about
the correctness of my code and hopefully learn more about models.

 super(id, new CompoundPropertyModel(new ValueMap()));

 List options = new ArrayList();
 options.add(new SelectOption("&", "AND"));
 options.add(new SelectOption("!", "OR"));

  ChoiceRenderer choiceRenderer = new
ChoiceRenderer("value", "key");

 PropertyModel propertyModel = new
PropertyModel(getModel(), "parentproject");

DropDownChoice ddc =
 new DropDownChoice(
"parentproject",
propertyModel,
options, choiceRenderer);
add(ddc);

This works well so far.

Now to my questions. I added the compoundPropertyModel to my page in
first line. It means a new ValueMap is available with the getModel()
method. And it means my page is stateful from now on. Correct?

For my DropDownBox I wrapped a specifica part of my CompoundModel,
namely the parentproject. If I imagine, with the call above I use the
key "parentproject" in my ValueMap for a SelectOption object.

Putting this in DropDownChoice, it means my value gets filled into my
getModel() at the slot "parentproject"

That being said, my CompoundPropertyModel is cared about from Wicket
in terms of memory and everything. I don't need to clean up here,
because it will become detached when the game is over.

Its fine to wrap the compoundmodel into a propertymodel in my case,
because I can store my value in the page model and make sure it will
stored at the slot I like.

Are my assumptions correct?

Thanks!

Best regards,
Christian

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



Re: Dynamic Select and SelectOptions

2011-02-17 Thread rawe

It's working fine with IE, safari, Chrome, Opera but not with Firefox (FF)
The  optgroup closing tag is set wrong.
The options are not enclosed in the optgroup tags.

Firebug shows following rendering


Audi
Opel


Thank's for hints!

ralph
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dynamic-Select-and-SelectOptions-tp1872483p3310785.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



Problem using dynamic select with optgroups and Firefox

2011-02-17 Thread rawe


Problem or bug in Firefox when using a dynamic wicket select component.
Firefox can't handle ListView and right placing of optgroup tags!

Please See following thread:
http://apache-wicket.1842946.n4.nabble.com/Dynamic-Select-and-SelectOptions-tc1872483.html#a3310381
http://apache-wicket.1842946.n4.nabble.com/Dynamic-Select-and-SelectOptions-tc1872483.html#a3310381
 

Would be glad if there are any solutions for this problem!

Ralph
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-using-dynamic-select-with-optgroups-and-Firefox-tp3310846p3310846.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 using dynamic select with optgroups and Firefox

2011-02-17 Thread Martin Makundi
Might be easier to make normal drowdownchoice with dynamic choicces model?

2011/2/17 rawe :
>
>
> Problem or bug in Firefox when using a dynamic wicket select component.
> Firefox can't handle ListView and right placing of optgroup tags!
>
> Please See following thread:
> http://apache-wicket.1842946.n4.nabble.com/Dynamic-Select-and-SelectOptions-tc1872483.html#a3310381
> http://apache-wicket.1842946.n4.nabble.com/Dynamic-Select-and-SelectOptions-tc1872483.html#a3310381
>
> Would be glad if there are any solutions for this problem!
>
> Ralph
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Problem-using-dynamic-select-with-optgroups-and-Firefox-tp3310846p3310846.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 using dynamic select with optgroups and Firefox

2011-02-17 Thread rawe

Yes, when just using a list of options a dropdownchoice ist the best way!
But in my case I need a dynamic select with optgoups and dynamic options.

My problem is solved now. I found a css error in my code.
The solution works fine now also with firfox!

ralph
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-using-dynamic-select-with-optgroups-and-Firefox-tp3310846p3310941.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: Just 100K per session? That would be my dream come true! (Anyone here who has tuned session size before?)

2011-02-17 Thread MZemeck
How are you storing/retrieving your photos?  I recently did some session 
size testing and I found the sessions were surprisingly small.  Once I 
removed the detachable model wrapped around an object holding a photo 
(byte array) retrieved from the database my session size shot up 
considerably.




From:   Per 
To: users@wicket.apache.org
Date:   02/16/2011 06:41 AM
Subject:Re: Just 100K per session? That would be my dream come 
true! (Anyone here who has tuned session size before?)




Hi Johan and Igor,

well, on one hand I am using App Engine, and puts are limited to 1MB. 
Even with pagination and limitation of each page to 50 users (totalling 
200Kb in memory for the whole page), I had to limit the pagemap size 
severely to ensure I am always below 1M.  In Wicket 1.5 it's a lot 
easier to write an adaptive EvictionStrategy to control memory usage, so 
I can be more flexible and evict large pages more aggressively than 
smaller ones. Still, displaying say 500 users at once will still not be 
possible if each user-row can take as much as 5K.

But I am not complaining. I knew that App Engine has this limitation, 
and I make my own product specifications, so I can live with it. On the 
plus side, App Engine (due to its restrictions) scales really well, and 
I am not worried if some day thousands of users will use my app 
concurrently. But although a typical server may have many Gigs these 
days, you'd still be in trouble if thousands of users came slurping 40M 
each, that's why I do think that session size remains an important 
consideration. I would strongly recommend anyone not to leave 
optimisation till the very last, but plan ahead and spike some of the 
most complex screens first, since Wicket *is* different in that respect.

Sorry to hear I can't optimise easily, but thanks for the quick 
responses Johan and Igor! Your support on this forum is truly 
legendary!  Will try to figure out the autoAdd() soon :-)
Per


> but if you have it down to 200K then 50 users it is nothing... thats
> 10MB on memory
> If if both where 2X so 400K and 100 users thats still only 40MB in
> memory Thats for a server nothing..
>
>
>
> On Wed, Feb 16, 2011 at 02:10, Per <[hidden email] 
> > wrote:
>
> >
> >
> > So I still haven't solved my memory issues, despite weeks of 
> research and
> > profiling. Reading in the other thread that a session size of 100K 
> or less
> > is achievable, I'll admit defeat now: I have not been able to shrink 
> some of
> > my pages(!) to less than 200K, not to mention the sessions. Despite 
> LDMs,
> > CompoundPropertyModels, and no, there are no domain objects in 
> there, and no
> > finals.
> >
> > What on earth am I doing wrong?
> >
> > My goal is to display a long list of, say, users. Each users should 
> list a
> > few labels (name, position, location, etc) and images to show who's an
> > admin/poweruser. Each user has a profile picture. Each user who is 
> also a
> > manager should have image icons of their subordinates' profile 
pictures
> > (e.g. a nested ListView) And I want 5 or 6 AJAX labels so I can 
quickly
> > lock/unlock users, delete them, give and revoke certain rights.
> >
> > Despite lots of profiling each row is still 4K to 6K. This adds up 
> for even
> > just 50 users. Can this be reduced, at all? I mean, it seems that 56 
> Bytes
> > is the minimum for a Label, 32 for a PropertyModel, 80 for a 
> ListItem, and
> > some 200 for an AjaxLink. 400 for an Image (or alternatively 272 for 
> a label
> > with 2 AttributeAppenders to also render an image), and unless the 
> whole
> > list disappears from the page's object graph, all those small 
> numbers DO add
> > up.
> >
> > My final hope was the RefreshingList, but no, it also keeps the list 
> items
> > stored in the page. What I really would like is a list that does not
> > maintain all its items, but throws them away, just like a LDM throws 
> away
> > the domain object, and just reloads when needed. Okay, that would 
> not work
> > because I want some state in there, but you get my point.
> >
> > I really hope it's something totally obvious I missed.
> >
> > Cheers,
> > Per
> > --
> > View this message in context: 
> 
http://apache-wicket.1842946.n4.nabble.com/Just-100K-per-session-That-would-be-my-dream-come-true-Anyone-here-who-has-tuned-session-size-before-tp3308014p3308014.html
 

> <
http://apache-wicket.1842946.n4.nabble.com/Just-100K-per-session-That-would-be-my-dream-come-true-Anyone-here-who-has-tuned-session-size-before-tp3308014p3308014.html?by-user=t
>
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > -
> > 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] 
> 
>
>
>
> 

Disable Individual Checkboxes in CheckBoxMultipleChoice

2011-02-17 Thread eugenebalt

I have a CheckBoxMultipleChoice in my form, and I need to disable individual
checkboxes (not all), say the 1st and 3rd one. (But I still have to show
them, as disabled.) Does someone have an example of how to do that? 

My field is based on an ArrayList. So each checkbox in the list is
just coming from a string.  


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Disable-Individual-Checkboxes-in-CheckBoxMultipleChoice-tp3311071p3311071.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: Disable Individual Checkboxes in CheckBoxMultipleChoice

2011-02-17 Thread Igor Vaynberg
override protected boolean isDisabled(final E object, int index,
String selected)

-igor

On Thu, Feb 17, 2011 at 8:15 AM, eugenebalt  wrote:
>
> I have a CheckBoxMultipleChoice in my form, and I need to disable individual
> checkboxes (not all), say the 1st and 3rd one. (But I still have to show
> them, as disabled.) Does someone have an example of how to do that?
>
> My field is based on an ArrayList. So each checkbox in the list is
> just coming from a string.
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Disable-Individual-Checkboxes-in-CheckBoxMultipleChoice-tp3311071p3311071.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 access component values within a dynamic table?

2011-02-17 Thread Hans Lesmeister 2



> 
> String htmlCodeInputfield = erzeugeEingabefeld( q );  
>   Label label = new Label( "Input", htmlCodeInputfield );
>   label.setEscapeModelStrings( false );
>   item.add( label );
> 
> 

Use a textfield instead of plain html. Bind it to a "dynamic" model like
PropertyModel and the leave the rest to Wicket. In onSubmit the beans in
your Katalog will contain the entered values. Something like:
item.add(new TextItem("Input", new PropertyModel(q, "antwort")));



> Apart from that how can I tell the components apart within my onSubmit
> method?
> Because of the fact that all have the same wicket:id ("Frage" or "Input")
> how can I access each of them separate?
> 

I think there is no need for that if you use Models the right way. You are
interested in what the user enters aren't you? You don't need to care about
the components and getting/putting data from/to them. That's Wicket's
concern.

In onSubmit, just iterate through your FragenKatalog and you will see that
every instance of Question has the entered answer filled in.

-
-- 

Regards,

Hans


http://www.cantaa.de http://cantaa.de 

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-access-component-values-within-a-dynamic-table-tp3310939p3311134.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



Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
There is a situation when the AjaxFormComponentUpdatingBehavior
deafult functionality fails. When we want to attach this behavior (or
OnChangeAjaxBehavior) to reflect changes inside a Model of
FormComponent which is marked as REQUIRED event if user clears
component input. In such situation AjaxFormComponentUpdatingBehavior
calls validation, FormComponent is not valid so error message is
reported and Model is not updated (I want to update this Model beacuse
the other things on form may depend on it).

My proposition is to extend this behavior to handle such use-cases
when user clears FormComponent input:
1. Do not update a Model and report error message (current and the
default behavior).
2. Update a Model and not report any error messages.
3. Update a Model and report error message.

It can be done by adding to boolean properties to this behavior (they
both be null by default) - feel free to invent a better names ;):
- disabledValidation
- alwaysUpdateModel

The change in code (not tested yet :)):

protected final void onEvent(final AjaxRequestTarget target)
{
final FormComponent formComponent = getFormComponent();

if (getEvent().toLowerCase().equals("onblur") && 
disableFocusOnBlur())
{
target.focusComponent(null);
}

try
{
formComponent.inputChanged();
if (!isDisabledValidation) {
  formComponent.validate();
}
if (formComponent.hasErrorMessage())
{
formComponent.invalid();
if (isAlwaysUpdateModel()) {
if (getUpdateModel())
{
formComponent.updateModel();
}
}
onError(target, null);
}
else
{
formComponent.valid();
if (getUpdateModel())
{
formComponent.updateModel();
}

onUpdate(target);
}
}
catch (RuntimeException e)
{
onError(target, e);

}
}


--
Daniel

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



dynamically create table row, and with each record create radio buttons

2011-02-17 Thread Jehan
Dear all

I want to read  records(userid and username) from database table,
display it in table structure , and with each record display 3 radio
buttons(A,B,C) .

When clicked on button then database table update using userid and
selected radio button value.

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



Dynamic Tag substitution

2011-02-17 Thread Arjun Dhar

Hi,
 Im creating a Decorator/Wrapper Panel that will show EDIT/DELETE options on
the content if the user is authorized to do so.

The markup simply put, is like this:






 DELETE  EDIT 
<***TAG_TYPE***wicket:id='component'
/>







The issue is that the Wrapper by design can consume any Component and
decorate it. However, the TAG type depends on the component inserted. I'd
liek to control that programatically. Is there any way I can do that?

..the corresponding code is like :

public abstract class EditableComponentWrapper extends Panel {
private static final long serialVersionUID = 1191322949129480444L;

private boolean allowDelete, allowEdit;

  public EditableComponentWrapper(String id) {
super( id );
WebMarkupContainer container = new WebMarkupContainer("container");
add(container); 
container.add(addComponent("component"));
  }
  
  /**
   * Add custom Component to the container. Use the id passed to construct
the component.
   * 
   * @param componentId as String
   */
  public abstract Component addComponent(String componentId);
  
  public void onInitialize() {
  super.onInitialize();
  
  addOrReplace(new AjaxLink("delete") { 
@Override
public void onClick(AjaxRequestTarget target) {
onDelete(target);
}
}
.setOutputMarkupId(true)
.setEnabled(allowDelete)
.setVisible(allowDelete));  

   addOrReplace(new AjaxLink("edit") {
@Override
public void onClick(AjaxRequestTarget target) {
onEdit(target); 
}   
}
   .setOutputMarkupId(true)
   .setEnabled(allowEdit)
   .setVisible(allowEdit));
  }
...
...



-
Don't take life too seriously, your'e not getting out it alive anyway!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dynamic-Tag-substitution-tp3311189p3311189.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: Adding pages in clean URLs

2011-02-17 Thread Suraj Chandran
I tried this:

> this.mount("/home", PackageName.forPackage(Main.class.getPackage()));
>
But it doesn't work.
I tried hitting both "/home/Main" and "/home/Main.html".
Any idea guys?

Thanks,
Suraj.

On Thu, Feb 17, 2011 at 12:45 PM, Mike Mander  wrote:

> Is WebApplication.mount(final String path, final PackageName packageName)
> fitting?
>
> Mike
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Dynamic Tag substitution

2011-02-17 Thread Arjun Dhar

One correction I'd make to my own code is instead of allowing to add a
Component; I'd enforce "WebComponent". That would make the case stronger for
using and enforcing HTML tags.

..the issue remains, hwow do I make the markup here dynamic to suit the
"WebComponent" being wrapped! :(

-
Don't take life too seriously, your'e not getting out it alive anyway!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dynamic-Tag-substitution-tp3311189p3311199.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: Disable Individual Checkboxes in CheckBoxMultipleChoice

2011-02-17 Thread eugenebalt

There's no isDisabled in Component, did you mean isEnabled?

How would I have control over individual elements there in that override?

Frankly, slightly longer answers would be very much appreciated. Thanks
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Disable-Individual-Checkboxes-in-CheckBoxMultipleChoice-tp3311071p3311217.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: Disable Individual Checkboxes in CheckBoxMultipleChoice

2011-02-17 Thread eugenebalt

Actually, thanks a lot, I found isDisabled(). Thank you.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Disable-Individual-Checkboxes-in-CheckBoxMultipleChoice-tp3311071p3311227.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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Pedro Santos
I Daniel, how alwaysUpdateModel differs from updateModel? If you have an
required form component that support some clean up logic, it can be coded
inside AjaxFormComponentUpdatingBehavior#onError, and if you need an AJAX
behavior that don't validate the form component, you can
use AjaxEventBehavior instead of AjaxFormComponentUpdatingBehavior.
The code you sent will end up invoking formComponent.valid() for non valid
components, it is problematic.

On Thu, Feb 17, 2011 at 2:51 PM, Daniel Stoch wrote:

> There is a situation when the AjaxFormComponentUpdatingBehavior
> deafult functionality fails. When we want to attach this behavior (or
> OnChangeAjaxBehavior) to reflect changes inside a Model of
> FormComponent which is marked as REQUIRED event if user clears
> component input. In such situation AjaxFormComponentUpdatingBehavior
> calls validation, FormComponent is not valid so error message is
> reported and Model is not updated (I want to update this Model beacuse
> the other things on form may depend on it).
>
> My proposition is to extend this behavior to handle such use-cases
> when user clears FormComponent input:
> 1. Do not update a Model and report error message (current and the
> default behavior).
> 2. Update a Model and not report any error messages.
> 3. Update a Model and report error message.
>
> It can be done by adding to boolean properties to this behavior (they
> both be null by default) - feel free to invent a better names ;):
> - disabledValidation
> - alwaysUpdateModel
>
> The change in code (not tested yet :)):
>
> protected final void onEvent(final AjaxRequestTarget target)
>{
>final FormComponent formComponent = getFormComponent();
>
>if (getEvent().toLowerCase().equals("onblur") &&
> disableFocusOnBlur())
>{
>target.focusComponent(null);
>}
>
>try
>{
>formComponent.inputChanged();
>if (!isDisabledValidation) {
>  formComponent.validate();
>}
>if (formComponent.hasErrorMessage())
>{
>formComponent.invalid();
>if (isAlwaysUpdateModel()) {
>if (getUpdateModel())
>{
>formComponent.updateModel();
>}
>}
>onError(target, null);
>}
>else
>{
>formComponent.valid();
>if (getUpdateModel())
>{
>formComponent.updateModel();
>}
>
>onUpdate(target);
>}
>}
>catch (RuntimeException e)
>{
>onError(target, e);
>
>}
>}
>
>
> --
> Daniel
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos


Re: Adding pages in clean URLs

2011-02-17 Thread Igor Vaynberg
debug it and see why its not matched.

-igor

On Thu, Feb 17, 2011 at 9:12 AM, Suraj Chandran  wrote:
> I tried this:
>
>> this.mount("/home", PackageName.forPackage(Main.class.getPackage()));
>>
> But it doesn't work.
> I tried hitting both "/home/Main" and "/home/Main.html".
> Any idea guys?
>
> Thanks,
> Suraj.
>
> On Thu, Feb 17, 2011 at 12:45 PM, Mike Mander  wrote:
>
>> Is WebApplication.mount(final String path, final PackageName packageName)
>> fitting?
>>
>> Mike
>>
>>
>> -
>> 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: Dynamic Tag substitution

2011-02-17 Thread Igor Vaynberg
override oncomponenttag and call tag.setname()

-igor

On Thu, Feb 17, 2011 at 9:14 AM, Arjun Dhar  wrote:
>
> One correction I'd make to my own code is instead of allowing to add a
> Component; I'd enforce "WebComponent". That would make the case stronger for
> using and enforcing HTML tags.
>
> ..the issue remains, hwow do I make the markup here dynamic to suit the
> "WebComponent" being wrapped! :(
>
> -
> Don't take life too seriously, your'e not getting out it alive anyway!
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Dynamic-Tag-substitution-tp3311189p3311199.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: Adding pages in clean URLs

2011-02-17 Thread Per Newgro

Can u please specify what u mean by "it doesn't work"?
Is url broken, is nothing displayed or ...?

Cheers
Per

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



Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 6:50 PM, Pedro Santos  wrote:
> I Daniel, how alwaysUpdateModel differs from updateModel?

You mean "from getUpdateModel()"? isAlwaysUpdateModel() is called only
when component is invalid, but getUpdateModel() in both cases (for
valid and invalid).

> If you have an
> required form component that support some clean up logic, it can be coded
> inside AjaxFormComponentUpdatingBehavior#onError, and if you need an AJAX
> behavior that don't validate the form component, you can
> use AjaxEventBehavior instead of AjaxFormComponentUpdatingBehavior.


Yes. Of course I can create my own behavior by doing a copy of
original AjaxFormComponentUpdatingBehavior and changing some code
inside onEvent() method. But then I will have my own class hierarchy,
very similar to original one. And always after upgrading Wicket to a
new version I'll have to check if something was changed in original
classes. The second reason to have this in core is that I think these
use-cases are very common.
Placing my code in onError() is not a good solution, because component
is prior marked as invalid and has an error message (which cause
displaying it in FeedbackPanel).

> The code you sent will end up invoking formComponent.valid() for non valid
> components, it is problematic.

You have right. So maybe this code should looks like below (changing
valid state only when validation is enabled):

   {
   formComponent.inputChanged();
   if (!isDisabledValidation) {
 formComponent.validate();
   }
   if (formComponent.hasErrorMessage())
   {
   formComponent.invalid();
   if (isAlwaysUpdateModel()) {
   if (getUpdateModel())
   {
   formComponent.updateModel();
   }
   }
   onError(target, null);
   }
   else
   {
   if (!isDisabledValidation) {
 formComponent.valid();
   }
   if (getUpdateModel())
   {
   formComponent.updateModel();
   }
   onUpdate(target);
   }
   }

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



Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Pedro Santos
Override onError still makes sense for me, if the form component is
required, why to hide the message? If there is some special message
reporting rule, it can be coded inside onError also.

On Thu, Feb 17, 2011 at 5:26 PM, Daniel Stoch wrote:

> On Thu, Feb 17, 2011 at 6:50 PM, Pedro Santos  wrote:
> > I Daniel, how alwaysUpdateModel differs from updateModel?
>
> You mean "from getUpdateModel()"? isAlwaysUpdateModel() is called only
> when component is invalid, but getUpdateModel() in both cases (for
> valid and invalid).
>
> > If you have an
> > required form component that support some clean up logic, it can be coded
> > inside AjaxFormComponentUpdatingBehavior#onError, and if you need an AJAX
> > behavior that don't validate the form component, you can
> > use AjaxEventBehavior instead of AjaxFormComponentUpdatingBehavior.
>
>
> Yes. Of course I can create my own behavior by doing a copy of
> original AjaxFormComponentUpdatingBehavior and changing some code
> inside onEvent() method. But then I will have my own class hierarchy,
> very similar to original one. And always after upgrading Wicket to a
> new version I'll have to check if something was changed in original
> classes. The second reason to have this in core is that I think these
> use-cases are very common.
> Placing my code in onError() is not a good solution, because component
> is prior marked as invalid and has an error message (which cause
> displaying it in FeedbackPanel).
>
> > The code you sent will end up invoking formComponent.valid() for non
> valid
> > components, it is problematic.
>
> You have right. So maybe this code should looks like below (changing
> valid state only when validation is enabled):
>
>   {
>   formComponent.inputChanged();
>   if (!isDisabledValidation) {
> formComponent.validate();
>   }
>   if (formComponent.hasErrorMessage())
>   {
>   formComponent.invalid();
>   if (isAlwaysUpdateModel()) {
>   if (getUpdateModel())
>   {
>   formComponent.updateModel();
>   }
>   }
>   onError(target, null);
>   }
>   else
>   {
>if (!isDisabledValidation) {
>  formComponent.valid();
>   }
>   if (getUpdateModel())
>   {
>   formComponent.updateModel();
>   }
>   onUpdate(target);
>   }
>   }
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos


Wicket Job Opportunity in Belgium (Leuven)

2011-02-17 Thread Maarten Bosteels
Hi everyone,

We are looking for a senior Java Developer, preferably with good knowledge
of Wicket.

You will join a team of 5 enthusiastic developers and are responsible for
the implementation of
new, challenging projects within our existing registration system.

You support best practices such as TDD, continuous integration, design
patterns and continuous refactoring, and you
know how to apply them with the aim of guaranteeing the quality of the
source code.

For more details :
http://www.dns.be/pdf/vacature-senior-developer-jan2011-en.pdf
http://www.dns.be/pdf/vacature-senior-developer-jan2011-nl.pdf

We offer

   - An interesting job with room for your own initiatives, responsibility
   and technical challenges in a
   financially healthy organisation.
   - A pleasant and stimulating work environment, with fun and professional
   colleagues in a great atmosphere.
   - Flexible working hours.
   - The opportunity to improve your knowledge and skills thanks to a
   personal development plan with 12 days of training a year.
   - A very attractive salary supplemented by extra legal benefits: group
   insurance, hospitalisation cover, meal vouchers, 32 holidays, laptop.

Please send your resume to maarten.bosteels (at) dns.be

*Maarten Bosteels*
*Manager Software Development

[image: dnsbe_logo.png]

**DNS.be vzw/asbl*  · Ubicenter  · Philipssite 5 · bus 13 · 3001 Leuven

www.dns.be


Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 9:02 PM, Pedro Santos  wrote:
> Override onError still makes sense for me, if the form component is
> required, why to hide the message?

Because I don't want to show such error message when user clears
(update) this required field but only when he press Submit. And
FeedbackPanel is refreshed automatically, so each message is
immediately shown to the user.

> If there is some special message
> reporting rule, it can be coded inside onError also.

No when component is required, because validation and error reporting
is done prior to call onError() method, and I cannot change that.

--
Daniel

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



Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Igor Vaynberg
if you want to push a null value into a component you marked required
then dont mark it as required. if you have inter-dependent validation
use a formvalidator or override form's onsubmit.

-igor


On Thu, Feb 17, 2011 at 8:51 AM, Daniel Stoch  wrote:
> There is a situation when the AjaxFormComponentUpdatingBehavior
> deafult functionality fails. When we want to attach this behavior (or
> OnChangeAjaxBehavior) to reflect changes inside a Model of
> FormComponent which is marked as REQUIRED event if user clears
> component input. In such situation AjaxFormComponentUpdatingBehavior
> calls validation, FormComponent is not valid so error message is
> reported and Model is not updated (I want to update this Model beacuse
> the other things on form may depend on it).
>
> My proposition is to extend this behavior to handle such use-cases
> when user clears FormComponent input:
> 1. Do not update a Model and report error message (current and the
> default behavior).
> 2. Update a Model and not report any error messages.
> 3. Update a Model and report error message.
>
> It can be done by adding to boolean properties to this behavior (they
> both be null by default) - feel free to invent a better names ;):
> - disabledValidation
> - alwaysUpdateModel
>
> The change in code (not tested yet :)):
>
> protected final void onEvent(final AjaxRequestTarget target)
>        {
>                final FormComponent formComponent = getFormComponent();
>
>                if (getEvent().toLowerCase().equals("onblur") && 
> disableFocusOnBlur())
>                {
>                        target.focusComponent(null);
>                }
>
>                try
>                {
>                        formComponent.inputChanged();
>                        if (!isDisabledValidation) {
>                          formComponent.validate();
>                        }
>                        if (formComponent.hasErrorMessage())
>                        {
>                                formComponent.invalid();
>                                if (isAlwaysUpdateModel()) {
>                                        if (getUpdateModel())
>                                        {
>                                                formComponent.updateModel();
>                                        }
>                                }
>                                onError(target, null);
>                        }
>                        else
>                        {
>                                formComponent.valid();
>                                if (getUpdateModel())
>                                {
>                                        formComponent.updateModel();
>                                }
>
>                                onUpdate(target);
>                        }
>                }
>                catch (RuntimeException e)
>                {
>                        onError(target, e);
>
>                }
>        }
>
>
> --
> Daniel
>
> -
> 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



Erase Previous Error Messages in Feedback Panel after Download

2011-02-17 Thread eugenebalt

I have a FeedbackPanel which may contain previous error messages.

Once the form is successfully submitted, it's not refreshed, and the
previous errors remain on the screen. A browser Download is initiated on
submit, so I lose control of the form.

Is there a way to reach the FeedbackPanel through Ajax and delete the
previous errors, because I can't refresh the form? In this case, how would I
handle Ajax in a SubmitButton?

Any tips appreciated, thanks
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Erase-Previous-Error-Messages-in-Feedback-Panel-after-Download-tp3311648p3311648.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: Erase Previous Error Messages in Feedback Panel after Download

2011-02-17 Thread Igor Vaynberg
target.addcomponent(feedbackpanel);
target.appendjavascript('window.location=');

-igor

On Thu, Feb 17, 2011 at 1:09 PM, eugenebalt  wrote:
>
> I have a FeedbackPanel which may contain previous error messages.
>
> Once the form is successfully submitted, it's not refreshed, and the
> previous errors remain on the screen. A browser Download is initiated on
> submit, so I lose control of the form.
>
> Is there a way to reach the FeedbackPanel through Ajax and delete the
> previous errors, because I can't refresh the form? In this case, how would I
> handle Ajax in a SubmitButton?
>
> Any tips appreciated, thanks
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Erase-Previous-Error-Messages-in-Feedback-Panel-after-Download-tp3311648p3311648.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: Erase Previous Error Messages in Feedback Panel after Download

2011-02-17 Thread eugenebalt

Does this code go in the SubmitButton's onClick Ajax behavior?

What if I don't have a URL? I'm not saving the file anywhere, I'm
immediately exporting it to the browser so the user can do a Save As.

Thanks
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Erase-Previous-Error-Messages-in-Feedback-Panel-after-Download-tp3311648p3311677.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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 10:01 PM, Igor Vaynberg  wrote:
> if you want to push a null value into a component you marked required
> then dont mark it as required.

No, because then I must have my own "customrequired" flags instead of
using the core mechanism. I think this is wrong way.
There is a wrong assumption that when component is marked as required
then I cannot push a null value to its model. Validation should not
allow to submit a form (not allow to further processing). But during
editing process when user fills the form and "updates" componenets
(not "submits" whole form) it should be possible to push null in
models (of course as an option).
The current behavior leads to many boilerplate code which can be avoided.

> if you have inter-dependent validation
> use a formvalidator or override form's onsubmit.

It is not this case here.

--
Daniel

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



Re: Erase Previous Error Messages in Feedback Panel after Download

2011-02-17 Thread Igor Vaynberg
yes, it would go to button's ajax onsubmit.

you are sending the file somehow by redirecting the browser to some url...

-igor

On Thu, Feb 17, 2011 at 1:27 PM, eugenebalt  wrote:
>
> Does this code go in the SubmitButton's onClick Ajax behavior?
>
> What if I don't have a URL? I'm not saving the file anywhere, I'm
> immediately exporting it to the browser so the user can do a Save As.
>
> Thanks
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Erase-Previous-Error-Messages-in-Feedback-Panel-after-Download-tp3311648p3311677.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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Igor Vaynberg
validation is there to make sure the user of the webapp cannot push an
illegal value into a model. it doesnt matter if its just the component
that is being submitted or the entire form. components decide whether
or not a user can push null in by using their required flag. you want
to push null, dont mark the component as required. it is as simple as
that. you can create your own updating behavior that calls
setrequired(false) on the component prior to running validation/model
update if that is what you want. but we will not ship something like
this as part of core because it doesnt generally make sense.

-igor

On Thu, Feb 17, 2011 at 1:33 PM, Daniel Stoch  wrote:
> On Thu, Feb 17, 2011 at 10:01 PM, Igor Vaynberg  
> wrote:
>> if you want to push a null value into a component you marked required
>> then dont mark it as required.
>
> No, because then I must have my own "customrequired" flags instead of
> using the core mechanism. I think this is wrong way.
> There is a wrong assumption that when component is marked as required
> then I cannot push a null value to its model. Validation should not
> allow to submit a form (not allow to further processing). But during
> editing process when user fills the form and "updates" componenets
> (not "submits" whole form) it should be possible to push null in
> models (of course as an option).
> The current behavior leads to many boilerplate code which can be avoided.
>
>> if you have inter-dependent validation
>> use a formvalidator or override form's onsubmit.
>
> It is not this case here.
>
> --
> Daniel
>
> -
> 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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Martin Makundi
Also conditional validation might do it:
https://cwiki.apache.org/WICKET/conditional-validation.html

2011/2/17 Igor Vaynberg :
> validation is there to make sure the user of the webapp cannot push an
> illegal value into a model. it doesnt matter if its just the component
> that is being submitted or the entire form. components decide whether
> or not a user can push null in by using their required flag. you want
> to push null, dont mark the component as required. it is as simple as
> that. you can create your own updating behavior that calls
> setrequired(false) on the component prior to running validation/model
> update if that is what you want. but we will not ship something like
> this as part of core because it doesnt generally make sense.
>
> -igor
>
> On Thu, Feb 17, 2011 at 1:33 PM, Daniel Stoch  wrote:
>> On Thu, Feb 17, 2011 at 10:01 PM, Igor Vaynberg  
>> wrote:
>>> if you want to push a null value into a component you marked required
>>> then dont mark it as required.
>>
>> No, because then I must have my own "customrequired" flags instead of
>> using the core mechanism. I think this is wrong way.
>> There is a wrong assumption that when component is marked as required
>> then I cannot push a null value to its model. Validation should not
>> allow to submit a form (not allow to further processing). But during
>> editing process when user fills the form and "updates" componenets
>> (not "submits" whole form) it should be possible to push null in
>> models (of course as an option).
>> The current behavior leads to many boilerplate code which can be avoided.
>>
>>> if you have inter-dependent validation
>>> use a formvalidator or override form's onsubmit.
>>
>> It is not this case here.
>>
>> --
>> Daniel
>>
>> -
>> 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



FeedbackPanel Message issues

2011-02-17 Thread sheadley3228

In my current project, I am using the feedbackpanel to display both
informational and error messages. When I move to my webpage, i display an
informational message. When I perform a Retrieve using   PageableListView if
no Items are retrieved, I get back a second message. How can I removed the
first message from the queue while maintaining the second message of "not
found".

I have tried:

getSession().cleanupFeedbackMessages();
fb.setOutputMarkupId(true);
add(fb);
info(new ResourceModel("1035").getObject().toString());

to clean the messages before adding the new message, but this did not work.
Any help would be appreciated.


Regards,

sheadley
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FeedbackPanel-Message-issues-tp3311743p3311743.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: FeedbackPanel Message issues

2011-02-17 Thread Igor Vaynberg
try also detaching feedbackpanel's model.

-igor


On Thu, Feb 17, 2011 at 2:10 PM, sheadley3228
 wrote:
>
> In my current project, I am using the feedbackpanel to display both
> informational and error messages. When I move to my webpage, i display an
> informational message. When I perform a Retrieve using   PageableListView if
> no Items are retrieved, I get back a second message. How can I removed the
> first message from the queue while maintaining the second message of "not
> found".
>
> I have tried:
>
> getSession().cleanupFeedbackMessages();
> fb.setOutputMarkupId(true);
> add(fb);
> info(new ResourceModel("1035").getObject().toString());
>
> to clean the messages before adding the new message, but this did not work.
> Any help would be appreciated.
>
>
> Regards,
>
> sheadley
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/FeedbackPanel-Message-issues-tp3311743p3311743.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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg  wrote:
> validation is there to make sure the user of the webapp cannot push an
> illegal value into a model. it doesnt matter if its just the component
> that is being submitted or the entire form. components decide whether
> or not a user can push null in by using their required flag. you want
> to push null, dont mark the component as required. it is as simple as
> that.

But you ommit something: model can contains a null value on startup
and event though a formcomponent has a valid state on the first
render. So passing null to this model later is like resseting its
state to original (null) value :).
Another thing is than I can set null in code and bypass component
validation. So I can push null into this model, but the final
validation will still work.

Maybe I should explain one of use-cases. Let's say we have a form to
enter RSS feed information. There are two TextFields:
- url for RSS feed (urlModel)
- custom RSS feed name (nameModel).
Both are required and both have OnChangeBehavior attached. When user
enter url for RSS the name of it is retrieved and set into nameModel.
But only when nameModel has null object or nameEdited (boolean flag)
is false.
Now user can edit name field (then nameEdited flag is set to true, to
avoid changing this name when user change url).
But when user clears name field nameModel should be updated to null,
but behavior does not allow this (because of validation of required
field).

> you can create your own updating behavior that calls
> setrequired(false) on the component prior to running validation/model
> update if that is what you want. but we will not ship something like
> this as part of core because it doesnt generally make sense.

Probably I'll write my own behavior, because it seems this is the only
solution :).
Maybe it does not make sense from your point of view, but from mine it
does. I think your point of view is sometimes too narrow.

--
Daniel


> On Thu, Feb 17, 2011 at 1:33 PM, Daniel Stoch  wrote:
>> On Thu, Feb 17, 2011 at 10:01 PM, Igor Vaynberg  
>> wrote:
>>> if you want to push a null value into a component you marked required
>>> then dont mark it as required.
>>
>> No, because then I must have my own "customrequired" flags instead of
>> using the core mechanism. I think this is wrong way.
>> There is a wrong assumption that when component is marked as required
>> then I cannot push a null value to its model. Validation should not
>> allow to submit a form (not allow to further processing). But during
>> editing process when user fills the form and "updates" componenets
>> (not "submits" whole form) it should be possible to push null in
>> models (of course as an option).
>> The current behavior leads to many boilerplate code which can be avoided.
>>
>>> if you have inter-dependent validation
>>> use a formvalidator or override form's onsubmit.
>>
>> It is not this case here.
>>
>> --
>> Daniel
>>
>> -
>> 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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Igor Vaynberg
On Thu, Feb 17, 2011 at 2:32 PM, Daniel Stoch  wrote:
> On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg  
> wrote:
>> validation is there to make sure the user of the webapp cannot push an
>> illegal value into a model. it doesnt matter if its just the component
>> that is being submitted or the entire form. components decide whether
>> or not a user can push null in by using their required flag. you want
>> to push null, dont mark the component as required. it is as simple as
>> that.
>
> But you ommit something: model can contains a null value on startup
> and event though a formcomponent has a valid state on the first
> render.

i always said the validation is there to prevent pushing a value into
a model not pulling from it. there is no need to validate the pulled
value since it is set by the developer, not the user of the webapp.

> So passing null to this model later is like resseting its
> state to original (null) value :).

for that we have clearInput() which will dump whatever value has been
entered by the user and pull it again from the model.

> Another thing is than I can set null in code and bypass component
> validation. So I can push null into this model, but the final
> validation will still work.

you as a developer can push the null, correct. the validators are not
there to safeguard the application from the developer.

> Maybe I should explain one of use-cases. Let's say we have a form to
> enter RSS feed information. There are two TextFields:
> - url for RSS feed (urlModel)
> - custom RSS feed name (nameModel).
> Both are required and both have OnChangeBehavior attached. When user
> enter url for RSS the name of it is retrieved and set into nameModel.
> But only when nameModel has null object or nameEdited (boolean flag)
> is false.
> Now user can edit name field (then nameEdited flag is set to true, to
> avoid changing this name when user change url).
> But when user clears name field nameModel should be updated to null,
> but behavior does not allow this (because of validation of required
> field).

what you want can be done in a simple manner. do not mark your field
as required, since it is not. write your own validator that allows
setting the field value to null when the edit flag is set, and fails
when it is not.

>> you can create your own updating behavior that calls
>> setrequired(false) on the component prior to running validation/model
>> update if that is what you want. but we will not ship something like
>> this as part of core because it doesnt generally make sense.
>
> Probably I'll write my own behavior, because it seems this is the only
> solution :).
> Maybe it does not make sense from your point of view, but from mine it
> does. I think your point of view is sometimes too narrow.

my point of view has to be narrow. as developers of the framework we
try to make the 95% usecase as simple as possible, while leaving the
door open for the other rare 5%. unfortunately for you, this is the
other 5%.

-igor


>
> --
> Daniel
>
>
>> On Thu, Feb 17, 2011 at 1:33 PM, Daniel Stoch  wrote:
>>> On Thu, Feb 17, 2011 at 10:01 PM, Igor Vaynberg  
>>> wrote:
 if you want to push a null value into a component you marked required
 then dont mark it as required.
>>>
>>> No, because then I must have my own "customrequired" flags instead of
>>> using the core mechanism. I think this is wrong way.
>>> There is a wrong assumption that when component is marked as required
>>> then I cannot push a null value to its model. Validation should not
>>> allow to submit a form (not allow to further processing). But during
>>> editing process when user fills the form and "updates" componenets
>>> (not "submits" whole form) it should be possible to push null in
>>> models (of course as an option).
>>> The current behavior leads to many boilerplate code which can be avoided.
>>>
 if you have inter-dependent validation
 use a formvalidator or override form's onsubmit.
>>>
>>> It is not this case here.
>>>
>>> --
>>> Daniel
>>>
>>> -
>>> 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
>
>

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



a common component for all my pages which takes lot of time to load

2011-02-17 Thread fachhoch

I need acomponent which I want to show in all my pages , this component
takes time for loading so 
I don't want to contruct this   everytime but create it once  when user logs
in put in his  session and show the same component in all my pages  and also
this componenet should update itself at frequent intervals  in a seperate
thread   .Please advice me , and are there any examples  ?
 
 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-common-component-for-all-my-pages-which-takes-lot-of-time-to-load-tp3311989p3311989.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: a common component for all my pages which takes lot of time to load

2011-02-17 Thread Jeremy Thomerson
On Thu, Feb 17, 2011 at 9:34 PM, fachhoch  wrote:

>
> I need acomponent which I want to show in all my pages , this component
> takes time for loading so
> I don't want to contruct this   everytime but create it once  when user
> logs
> in put in his  session and show the same component in all my pages  and
> also
> this componenet should update itself at frequent intervals  in a seperate
> thread   .Please advice me , and are there any examples  ?
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/a-common-component-for-all-my-pages-which-takes-lot-of-time-to-load-tp3311989p3311989.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
>
>

Don't share components across pages.  It will cause problems.  Most likely,
it is not your component that actually takes a long time to load - it's
probably the data.  You may be loading it in the constructor, but you
shouldn't be.  You should be loading it in a model
(LoadableDetachableModel).  And, you should load it from a service that does
this caching / refreshing for you.  It shouldn't be managed by your UI.

I could be off - but that answer is right 99% of the time for these
questions.  If I'm off, send more details, preferably including code.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


Re: a common component for all my pages which takes lot of time to load

2011-02-17 Thread fachhoch

thanks for the reply , yes it is the model which takes time to load, I did
not start the coding yet  to show you the code  I am   looking for
suggestions.,
write now my idea is to create this model object when user logs in and put
in his session, this panel gets the data from session  and  it will have
AjaxSelfUpdatingTimerBehavior  to  update  itself.
but the difficult part   where  I need advice is how to tell my session to
reload this model at frequent intervals? 
 if this is not a good idea please advice me  with  better way to do .



-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-common-component-for-all-my-pages-which-takes-lot-of-time-to-load-tp3311989p3312016.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: a common component for all my pages which takes lot of time to load

2011-02-17 Thread Jeremy Thomerson
On Thu, Feb 17, 2011 at 10:36 PM, fachhoch  wrote:

>
> thanks for the reply , yes it is the model which takes time to load, I did
> not start the coding yet  to show you the code  I am   looking for
> suggestions.,
> write now my idea is to create this model object when user logs in and put
> in his session, this panel gets the data from session  and  it will have
> AjaxSelfUpdatingTimerBehavior  to  update  itself.
> but the difficult part   where  I need advice is how to tell my session to
> reload this model at frequent intervals?
>  if this is not a good idea please advice me  with  better way to do .
>

I don't think you should be doing this in your UI layer at all.  It'd be
better IMHO as a function of a service that handles caching, uses a least
recently used map, expires caches after X seconds / minutes, optionally
refreshes that cache after X seconds / minutes, etc.  Your UI component
would just get it from this caching / data management service, which should
always be a quick operation after the first retrieval.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


dynamically create table row, and with each record create radio buttons

2011-02-17 Thread Jehan
Dear all

I want to read  records(userid and username) from database table,
display it in table structure , and with each record display 3 radio
buttons(A,B,C) .

When clicked on button then database table update using userid and
selected radio button value.


Re: dynamically create table row, and with each record create radio buttons

2011-02-17 Thread Jeremy Thomerson
See DataTable, Form, and related examples in wicket-examples

On Thu, Feb 17, 2011 at 11:58 AM, Jehan  wrote:

> Dear all
>
> I want to read  records(userid and username) from database table,
> display it in table structure , and with each record display 3 radio
> buttons(A,B,C) .
>
> When clicked on button then database table update using userid and
> selected radio button value.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*