Re: Returning XML or HTML

2012-12-06 Thread Martin Grigorov
A simpler solution is:

if (needsXml()) {
   getRequestCycle().replaceAllRequestHandlers(new
TextRequestHandler(text/xml, theXml))
}


On Thu, Dec 6, 2012 at 7:55 AM, Sven Meier s...@meiers.net wrote:

 You'll have to let Wicket know that you wrote the response by yourself.

 With |RestartResponseException| you can switch to another response. In
 your case you could direct the request to a resource first (since your XML
 doesn't seem be component-based) and switch to a page in case of missing
 parameters.

 Sven



 On 12/06/2012 04:49 AM, McDonough, Jonathan wrote:

 Hi all,
 I am trying to create a WebPage that returns either XML or HTML depending
 upon if a parameter is supplied. If the parameter is supplied, return a
 custom XML document. Otherwise return an HTML page with an error message.
 The code I wrote produces these results, which is great. But it is also
 throwing an exception (below) to the console. Does anyone know how to go
 about fixing this?

 I am using Java 6 and Wicket 6.2.0

 Thanks
 Jon

 Here is the code for DocumentPage.java:
  public DocumentPage(final PageParameters parameters) {
  setStatelessHint(true);

  // Get the ID
  final org.apache.wicket.util.string.**StringValue
 idStringValue = parameters.get(0);
  if (idStringValue == null || idStringValue.isEmpty()) {
  add(new Label(errorMsg, Please supply an
 ID));
  return;
  }


  // Get the CTS2 XML from the database
  final String id = idStringValue.toString();


  // Send the output
  add(new Label(errorMsg, ));
  String content = resultentry + id +
 /entry/result;

  RequestCycle.get().**getOriginalResponse().write(**
 content);
  }


 DocumentPage.html:
 html
  head
  titleError/title
  /head

  body
  span wicket:id=errorMsg /
  /body
 /html


 2012-12-05 22:36:32,976 ERROR  [RequestCycle] Error during processing
 error message
 java.lang.**IllegalStateException: Header was already written to
 response!
  at org.apache.wicket.protocol.**http.**
 HeaderBufferingWebResponse.**checkHeader(**HeaderBufferingWebResponse.**
 java:64)
  at org.apache.wicket.protocol.**http.**
 HeaderBufferingWebResponse.**sendError(**HeaderBufferingWebResponse.**
 java:105)
  at org.apache.wicket.request.**http.handler.**
 ErrorCodeRequestHandler.**respond(**ErrorCodeRequestHandler.java:**77)
  at org.apache.wicket.request.**cycle.RequestCycle$**
 HandlerExecutor.respond(**RequestCycle.java:830)
  at org.apache.wicket.request.**RequestHandlerStack.execute(**
 RequestHandlerStack.java:64)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:302)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 processRequest(RequestCycle.**java:225)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 processRequestAndDetach(**RequestCycle.java:281)
  at org.apache.wicket.protocol.**http.WicketFilter.**
 processRequest(WicketFilter.**java:188)
  at org.apache.wicket.protocol.**http.WicketFilter.doFilter(**
 WicketFilter.java:245)
  at org.apache.catalina.core.**ApplicationFilterChain.**
 internalDoFilter(**ApplicationFilterChain.java:**243)
  at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(
 **ApplicationFilterChain.java:**210)
  at org.apache.catalina.core.**StandardWrapperValve.invoke(**
 StandardWrapperValve.java:225)
  at org.apache.catalina.core.**StandardContextValve.invoke(**
 

Re: How to call a Wicket Ajax click event

2012-12-06 Thread Martin Grigorov
Hi,

Wicket 6 uses jQuery.on() to register the event listeners.
If your AjaxSubmitLink listens on 'click' then
jQuery('#theSubmitLinkId').triggerHandler('click') should do it.
Also check the docs of jQuery#trigger


On Thu, Dec 6, 2012 at 1:53 AM, Jered Myers jer...@maplewoodsoftware.comwrote:

 The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am
 trying to get back to the onSubmit on the server side.  I saw
 http://apache-wicket.1842946.**n4.nabble.com/Wicket-6-Ajax-**
 Behaviors-td4654398.htmlhttp://apache-wicket.1842946.n4.nabble.com/Wicket-6-Ajax-Behaviors-td4654398.html,
 but $(mylink).triggerHandler('**click') doesn't seem to be working. Do I
 treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


 On 12/05/2012 03:28 PM, Jered Myers wrote:

 Wicket 6.3

 How do I call a click event on an AjaxLink from via jQuery or JavaScript?
  I have an AjaxLink that I have added to the page and after I run some
 JavaScript, I want to pragmatically click the link with JavaScript.  This
 broke when updating from Wicket 1.5 to 6.  It appears that the onclick
 attribute is no longer on my link and I am not sure how to call the events
 that Wicket has registered in the head.





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


Re: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Raul
Thanks for the reply, I tried to use the component on the form with the
object
CompoundPropertyModel. As follows,

ccc = new CustomerAccountCode(ccc, 
new CompoundPropertyModelAccount(new Account(config.getCcc(;
form.add(ccc);

But this does the same as before, ie load correctly displayed data, but when
you throw the onSubmit form, the model
the ccc.getModelObject() still returns null. 

//New implementation
public class CustomerAccountCode extends
FormComponentPanelAccount {

private FormComponentString entity;
private FormComponentString office;
private FormComponentString dc;
private FormComponentString number;

public CustomerAccountCode(String id, CompoundPropertyModelAccount 
model)
{
super(id, model);

entity = new TextFieldString(entity);
office = new TextFieldString(office);
dc = new TextFieldString(dc);
number = new TextFieldString(number);

AttributeModifier attEntity = new AttributeModifier(name, 
entity);
AttributeModifier attOffice = new AttributeModifier(name, 
office);
AttributeModifier attDc = new AttributeModifier(name, dc);
AttributeModifier attNumber = new AttributeModifier(name, 
number);
add(entity.add(attEntity));
add(office.add(attOffice));
add(dc.add(attDc));
add(number.add(attNumber));
//  add(CustomerAccountCodeValidator.getInstance());

}

@Override
public Component add(final Behavior... behaviors) {
entity.add(behaviors);
office.add(behaviors);
dc.add(behaviors);
number.add(behaviors);
return this;
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-FormComponentPanel-tp4654441p4654545.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: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Karsten Gaul

Hi guys,

I still have no clue. Any suggestions? A work-around would also be much 
appreciated. I need to stay stateless but I definetely need this lazy 
loading as I have to wait for a soap response every 10 mins and for user 
experience issues need to display some loading component/icon as 
provided by AjaxLazyLoadPanel.


Thanks,
Karsten

Am 05.12.2012 09:38, schrieb Karsten Gaul:

Hi,

I'm trying to use the functionality of an AjaxLazyLoadPanel in a 
stateless page but this doesn't seem to work as the injected content 
is not a container and the following exception is thrown:


java.lang.IllegalArgumentException: Component is not a container and 
so does not contain the path componentid:containedcomponentid:


[Component id = content]

 at org.apache.wicket.Component.get(Component.java:4500)
 at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)


I wrote a StatelessAbstractDefaultAjaxBehavior overriding 
geCallbackUrl which I use in my StatelessAjaxLazyLoadPanel.


This doesn't seem to be the way. Anyone have any hints?

Thanks,
Karsten


-
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: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Martin Grigorov
Show us some code and the real exception.


On Thu, Dec 6, 2012 at 11:26 AM, Karsten Gaul karsten.g...@exedio.comwrote:

 Hi guys,

 I still have no clue. Any suggestions? A work-around would also be much
 appreciated. I need to stay stateless but I definetely need this lazy
 loading as I have to wait for a soap response every 10 mins and for user
 experience issues need to display some loading component/icon as provided
 by AjaxLazyLoadPanel.

 Thanks,
 Karsten

 Am 05.12.2012 09:38, schrieb Karsten Gaul:

  Hi,

 I'm trying to use the functionality of an AjaxLazyLoadPanel in a
 stateless page but this doesn't seem to work as the injected content is not
 a container and the following exception is thrown:

 java.lang.**IllegalArgumentException: Component is not a container and
 so does not contain the path componentid:**containedcomponentid:

 [Component id = content]

  at org.apache.wicket.Component.**get(Component.java:4500)
  at org.apache.wicket.**MarkupContainer.get(**
 MarkupContainer.java:354)


 I wrote a StatelessAbstractDefaultAjaxBe**havior overriding
 geCallbackUrl which I use in my StatelessAjaxLazyLoadPanel.

 This doesn't seem to be the way. Anyone have any hints?

 Thanks,
 Karsten


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



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




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


Re: Select2Choice dropdown box is not appeared in correct position

2012-12-06 Thread Thomas Götz
Strange, the select2-with-searchbox class is added by select2.js whenever the 
search input is shown:

//add select2-with-searchbox to the container if search box is shown
$(this.dropdown, this.container)[showSearchInput ? addClass : 
removeClass](select2-with-searchbox);

Do you get any Javascript errors?

   -Tom


On 06.12.2012, at 03:07, Madasamy mcruncher madas...@mcruncher.com wrote:

   we are using wicket-select2 2.0 in our application. A form
 having a Select2Choice field when click this field the search
 dropdown box is not appeared in correct position. But this is
 work fine on my quick start. our application is depending on
 bootstrap css and js.
 
 My observation , select2choice field html code look like in
 
 * myQuickstart
 
  div id=s2id_foo2 class=select2-container style=width: 300px
  a class=select2-choice onclick=return false; href=# tabindex=-1
  div class=select2-drop *select2-with-searchbox* select2-drop-active
 select2-offscreen style=display: block;
  /div
  input id=foo2 type=hidden name=foo value= style=width: 300px;
 display: none; wicket:id=foo
 
 * our application,
 
  div id=s2id_typed class=select2-container style=width: 300px
  a class=select2-choice onclick=return false; href=# tabindex=-1
  div class=select2-drop select2-offscreen style=display: block;
  /div
  input id=typed class=select2-choice-text type=hidden name=type
 value= wicket:id=type style=display: none;
 
 The Css class  *select2-with-searchbox* is not added in our application
 html code.
 
 can you give suggestion to solve this problem?


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



Re: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Karsten Gaul

Trying to:

/// StatelessAbstractDefaultAjaxBehavior ///

@Override
public CharSequence getCallbackUrl(final boolean onlyTargetActivePage)
{
final CharSequence url = 
super.getCallbackUrl(onlyTargetActivePage);

final PageParameters params = getPageParameters();
// NOTE: quick hack to remove old and obsolete random 
parameter from request (see wicket-ajax.js)

if (params!=null  params.containsKey(random))
params.remove(random);
return StatelessEncoder.appendParameters(url, params);
}
 StatelessEncoder appends params to WebRequestEncoder

stateless hint - true

In the StatelessAjaxLazyLoadPanel I'm using this Behavior instead of the 
usual AbstractDefaultAjaxBehavior


/// My Page ///

onInitialize()
{
add( new StatelessAjaxLazyLoadPanel(myContent)
{
private static final long serialVersionUID = 1L;

@Override
public Component getLazyLoadComponent( String markupId )
{
return new MyContentPanel( markupId );
}

@Override
public PageParameters getPageParameters()
{
return pageParameters;
}
} );
}

/// MyContentPanel ///

Form form = new Form(myForm);
form.add( new DropDownChoiceEnum(enumChoice));
add(form);

java.lang.IllegalArgumentException: Component is not a container and so 
does not contain the path myForm:enumChoice:

[Component id = content]
at org.apache.wicket.Component.get(Component.java:4500)
at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)
at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)
at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)
at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)
at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)
at org.apache.wicket.MarkupContainer.get(MarkupContainer.java:354)

Would that be sufficient?

Thanks,
Karsten


Am 06.12.2012 11:30, schrieb Martin Grigorov:

Show us some code and the real exception.


On Thu, Dec 6, 2012 at 11:26 AM, Karsten Gaul karsten.g...@exedio.comwrote:


Hi guys,

I still have no clue. Any suggestions? A work-around would also be much
appreciated. I need to stay stateless but I definetely need this lazy
loading as I have to wait for a soap response every 10 mins and for user
experience issues need to display some loading component/icon as provided
by AjaxLazyLoadPanel.

Thanks,
Karsten

Am 05.12.2012 09:38, schrieb Karsten Gaul:

  Hi,

I'm trying to use the functionality of an AjaxLazyLoadPanel in a
stateless page but this doesn't seem to work as the injected content is not
a container and the following exception is thrown:

java.lang.**IllegalArgumentException: Component is not a container and
so does not contain the path componentid:**containedcomponentid:

[Component id = content]

  at org.apache.wicket.Component.**get(Component.java:4500)
  at org.apache.wicket.**MarkupContainer.get(**
MarkupContainer.java:354)


I wrote a StatelessAbstractDefaultAjaxBe**havior overriding
geCallbackUrl which I use in my StatelessAjaxLazyLoadPanel.

This doesn't seem to be the way. Anyone have any hints?

Thanks,
Karsten


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



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







--
Karsten Gaul
Dipl. Medieninf.
Softwareentwickler

Telefon +49 (351) 4108-135
Fax +49 (351) 4108-5135
karsten.g...@exedio.com
www.exedio.com

exedio GmbH
Buchenstr. 16 B
01097 Dresden
Deutschland

Handelsregister: HRB 22109
Amtsgericht Dresden
Sitz der Gesellschaft: Dresden
Geschäftsführer: Sven-Erik Bornscheuer, Lutz Kirchner, Falk Krause


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



Re: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Tobias Gierke

Hi,

I think you need to override FormComponentPanel#convertInput().

Cheers,
Tobias

Thanks for the reply, I tried to use the component on the form with the
object
CompoundPropertyModel. As follows,

ccc = new CustomerAccountCode(ccc,
new CompoundPropertyModelAccount(new Account(config.getCcc(;
form.add(ccc);

But this does the same as before, ie load correctly displayed data, but when
you throw the onSubmit form, the model
the ccc.getModelObject() still returns null.

//New implementation
public class CustomerAccountCode extends
FormComponentPanelAccount {

private FormComponentString entity;
private FormComponentString office;
private FormComponentString dc;
private FormComponentString number;

public CustomerAccountCode(String id, CompoundPropertyModelAccount 
model)
{
super(id, model);

entity = new TextFieldString(entity);
office = new TextFieldString(office);
dc = new TextFieldString(dc);
number = new TextFieldString(number);

AttributeModifier attEntity = new AttributeModifier(name, 
entity);
AttributeModifier attOffice = new AttributeModifier(name, 
office);
AttributeModifier attDc = new AttributeModifier(name, dc);
AttributeModifier attNumber = new AttributeModifier(name, 
number);
add(entity.add(attEntity));
add(office.add(attOffice));
add(dc.add(attDc));
add(number.add(attNumber));
//  add(CustomerAccountCodeValidator.getInstance());

}

@Override
public Component add(final Behavior... behaviors) {
entity.add(behaviors);
office.add(behaviors);
dc.add(behaviors);
number.add(behaviors);
return this;
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-FormComponentPanel-tp4654441p4654545.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




--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Mobile +49 172 323 06 11 Fax +49 40 688 900 199
Email jan.bast...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Martin Grigorov
On Thu, Dec 6, 2012 at 11:53 AM, Karsten Gaul karsten.g...@exedio.comwrote:

 Trying to:

 /// StatelessAbstractDefaultAjaxBe**havior ///

 @Override
 public CharSequence getCallbackUrl(final boolean onlyTargetActivePage)
 {
 final CharSequence url = super.getCallbackUrl(**
 onlyTargetActivePage);
 final PageParameters params = getPageParameters();
 // NOTE: quick hack to remove old and obsolete random parameter
 from request (see wicket-ajax.js)
 if (params!=null  params.containsKey(random))
 params.remove(random);
 return StatelessEncoder.**appendParameters(url, params);
 }
  StatelessEncoder appends params to WebRequestEncoder

 stateless hint - true

 In the StatelessAjaxLazyLoadPanel I'm using this Behavior instead of the
 usual AbstractDefaultAjaxBehavior

 /// My Page ///

 onInitialize()
 {
 add( new StatelessAjaxLazyLoadPanel(**myContent)


Here we see myContent id.


 {
 private static final long serialVersionUID = 1L;

 @Override
 public Component getLazyLoadComponent( String markupId )
 {
 return new MyContentPanel( markupId );
 }

 @Override
 public PageParameters getPageParameters()
 {
 return pageParameters;
 }
 } );
 }

 /// MyContentPanel ///

 Form form = new Form(myForm);
 form.add( new DropDownChoiceEnum(**enumChoice));
 add(form);

 java.lang.**IllegalArgumentException: Component is not a container and so
 does not contain the path myForm:enumChoice:

 [Component id = content]


Here it complains about content. What is the relation between 'myContent'
and 'content'  component ?

Which component adds the StatelessAjaxLazyLoadPanel ?


  at org.apache.wicket.Component.**get(Component.java:4500)


Put a breakpoint here and see what is in the context. What is 'this', what
in its 'children' member field.
'myForm' has children with 'enumChoice' inside, then 'enumChoce' becomes
'this and you need to see how to get to the lazy load panel and its lazy
load component.


  at org.apache.wicket.**MarkupContainer.get(**
 MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)

 Would that be sufficient?

 Thanks,
 Karsten


 Am 06.12.2012 11:30, schrieb Martin Grigorov:

 Show us some code and the real exception.


 On Thu, Dec 6, 2012 at 11:26 AM, Karsten Gaul karsten.g...@exedio.com**
 wrote:

  Hi guys,

 I still have no clue. Any suggestions? A work-around would also be much
 appreciated. I need to stay stateless but I definetely need this lazy
 loading as I have to wait for a soap response every 10 mins and for user
 experience issues need to display some loading component/icon as provided
 by AjaxLazyLoadPanel.

 Thanks,
 Karsten

 Am 05.12.2012 09:38, schrieb Karsten Gaul:

   Hi,

 I'm trying to use the functionality of an AjaxLazyLoadPanel in a
 stateless page but this doesn't seem to work as the injected content is
 not
 a container and the following exception is thrown:

 java.lang.IllegalArgumentException: Component is not a container
 and
 so does not contain the path componentid:containedcomponentid:

 [Component id = content]

   at org.apache.wicket.Component.get(Component.java:4500)
   at org.apache.wicket.MarkupContainer.get(**
 MarkupContainer.java:354)


 I wrote a StatelessAbstractDefaultAjaxBehavior overriding

 geCallbackUrl which I use in my StatelessAjaxLazyLoadPanel.

 This doesn't seem to be the way. Anyone have any hints?

 Thanks,
 Karsten


 --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 

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


  --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 

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





 --
 Karsten Gaul
 Dipl. Medieninf.
 Softwareentwickler

 Telefon +49 (351) 4108-135
 Fax +49 (351) 4108-5135
 karsten.g...@exedio.com
 www.exedio.com

 exedio GmbH
 Buchenstr. 16 B
 01097 Dresden
 Deutschland

 Handelsregister: HRB 22109
 Amtsgericht Dresden
 Sitz der Gesellschaft: Dresden
 Geschäftsführer: Sven-Erik Bornscheuer, Lutz Kirchner, Falk Krause



 

Re: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Karsten Gaul

Hi Martin,

myContent is the id of the StatelessAjaxLazyLoadPanel which contains a 
constant


private static final String LAZY_LOAD_COMPONENT_ID = content;

which is used in getLazyLoadComponent(String markupId). 'myContent' 
contains the lazy load component 'content'.


StatelessAjaxLazyLoadComponent is added to a WebMarkupContainer which 
itself is added to MyPage.


If you look at the source of AjaxLazyLoadPanel the 'content' (added in 
onBeforeRender) is replaced in the respond method of the Behavior. Could 
that be the reason why it is not a container?


Regards,
Karsten

Am 06.12.2012 12:37, schrieb Martin Grigorov:

On Thu, Dec 6, 2012 at 11:53 AM, Karsten Gaul karsten.g...@exedio.comwrote:


Trying to:

/// StatelessAbstractDefaultAjaxBe**havior ///

@Override
 public CharSequence getCallbackUrl(final boolean onlyTargetActivePage)
 {
 final CharSequence url = super.getCallbackUrl(**
onlyTargetActivePage);
 final PageParameters params = getPageParameters();
 // NOTE: quick hack to remove old and obsolete random parameter
from request (see wicket-ajax.js)
 if (params!=null  params.containsKey(random))
 params.remove(random);
 return StatelessEncoder.**appendParameters(url, params);
 }

StatelessEncoder appends params to WebRequestEncoder

stateless hint - true

In the StatelessAjaxLazyLoadPanel I'm using this Behavior instead of the
usual AbstractDefaultAjaxBehavior

/// My Page ///

onInitialize()
{
 add( new StatelessAjaxLazyLoadPanel(**myContent)


Here we see myContent id.



 {
 private static final long serialVersionUID = 1L;

 @Override
 public Component getLazyLoadComponent( String markupId )
 {
 return new MyContentPanel( markupId );
 }

 @Override
 public PageParameters getPageParameters()
 {
 return pageParameters;
 }
 } );
}

/// MyContentPanel ///

Form form = new Form(myForm);
form.add( new DropDownChoiceEnum(**enumChoice));
add(form);

java.lang.**IllegalArgumentException: Component is not a container and so
does not contain the path myForm:enumChoice:

[Component id = content]


Here it complains about content. What is the relation between 'myContent'
and 'content'  component ?

Which component adds the StatelessAjaxLazyLoadPanel ?



  at org.apache.wicket.Component.**get(Component.java:4500)


Put a breakpoint here and see what is in the context. What is 'this', what
in its 'children' member field.
'myForm' has children with 'enumChoice' inside, then 'enumChoce' becomes
'this and you need to see how to get to the lazy load panel and its lazy
load component.



  at org.apache.wicket.**MarkupContainer.get(**
MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)
 at org.apache.wicket.**MarkupContainer.get(**MarkupContainer.java:354)

Would that be sufficient?

Thanks,
Karsten


Am 06.12.2012 11:30, schrieb Martin Grigorov:


Show us some code and the real exception.


On Thu, Dec 6, 2012 at 11:26 AM, Karsten Gaul karsten.g...@exedio.com**
wrote:

  Hi guys,

I still have no clue. Any suggestions? A work-around would also be much
appreciated. I need to stay stateless but I definetely need this lazy
loading as I have to wait for a soap response every 10 mins and for user
experience issues need to display some loading component/icon as provided
by AjaxLazyLoadPanel.

Thanks,
Karsten

Am 05.12.2012 09:38, schrieb Karsten Gaul:

   Hi,


I'm trying to use the functionality of an AjaxLazyLoadPanel in a
stateless page but this doesn't seem to work as the injected content is
not
a container and the following exception is thrown:

java.lang.IllegalArgumentException: Component is not a container
and
so does not contain the path componentid:containedcomponentid:

[Component id = content]

   at org.apache.wicket.Component.get(Component.java:4500)
   at org.apache.wicket.MarkupContainer.get(**
MarkupContainer.java:354)


I wrote a StatelessAbstractDefaultAjaxBehavior overriding

geCallbackUrl which I use in my StatelessAjaxLazyLoadPanel.

This doesn't seem to be the way. Anyone have any hints?

Thanks,
Karsten


--**
--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apa**che.orghttp://apache.org
users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


  --**

--**-
To unsubscribe, e-mail: 

Re: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Martin Grigorov
On Thu, Dec 6, 2012 at 12:57 PM, Karsten Gaul karsten.g...@exedio.comwrote:

 Hi Martin,

 myContent is the id of the StatelessAjaxLazyLoadPanel which contains a
 constant

 private static final String LAZY_LOAD_COMPONENT_ID = content;

 which is used in getLazyLoadComponent(String markupId). 'myContent'
 contains the lazy load component 'content'.

 StatelessAjaxLazyLoadComponent is added to a WebMarkupContainer which
 itself is added to MyPage.

 If you look at the source of AjaxLazyLoadPanel the 'content' (added in
 onBeforeRender) is replaced in the respond method of the Behavior. Could
 that be the reason why it is not a container?


The default (stateful) version works OK, so the problem seems to be that
when the Ajax call is made a new page is created (this is what stateless
means) and when it tries to find the lazy panel or its component (I'm not
sure which one) it fails to find it.
The debugger will tell you what exactly happens.



 Regards,
 Karsten

 Am 06.12.2012 12:37, schrieb Martin Grigorov:

 On Thu, Dec 6, 2012 at 11:53 AM, Karsten Gaul karsten.g...@exedio.com**
 wrote:

  Trying to:

 /// StatelessAbstractDefaultAjaxBehavior ///


 @Override
  public CharSequence getCallbackUrl(final boolean
 onlyTargetActivePage)
  {
  final CharSequence url = super.getCallbackUrl(**

 onlyTargetActivePage);
  final PageParameters params = getPageParameters();
  // NOTE: quick hack to remove old and obsolete random
 parameter
 from request (see wicket-ajax.js)
  if (params!=null  params.containsKey(random))
  params.remove(random);
  return StatelessEncoder.appendParameters(url, params);

  }

 StatelessEncoder appends params to WebRequestEncoder

 stateless hint - true

 In the StatelessAjaxLazyLoadPanel I'm using this Behavior instead of the
 usual AbstractDefaultAjaxBehavior

 /// My Page ///

 onInitialize()
 {
  add( new StatelessAjaxLazyLoadPanel(myContent)

  Here we see myContent id.


   {
  private static final long serialVersionUID = 1L;

  @Override
  public Component getLazyLoadComponent( String markupId )
  {
  return new MyContentPanel( markupId );
  }

  @Override
  public PageParameters getPageParameters()
  {
  return pageParameters;
  }
  } );
 }

 /// MyContentPanel ///

 Form form = new Form(myForm);
 form.add( new DropDownChoiceEnum(enumChoice));
 add(form);


 java.lang.IllegalArgumentException: Component is not a container
 and so
 does not contain the path myForm:enumChoice:

 [Component id = content]

  Here it complains about content. What is the relation between
 'myContent'
 and 'content'  component ?

 Which component adds the StatelessAjaxLazyLoadPanel ?


at org.apache.wicket.Component.get(Component.java:4500)

  Put a breakpoint here and see what is in the context. What is 'this',
 what
 in its 'children' member field.
 'myForm' has children with 'enumChoice' inside, then 'enumChoce' becomes
 'this and you need to see how to get to the lazy load panel and its lazy
 load component.


at org.apache.wicket.MarkupContainer.get(**
 MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
 MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
 MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
 MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
 MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
 MarkupContainer.java:354)


 Would that be sufficient?

 Thanks,
 Karsten


 Am 06.12.2012 11:30, schrieb Martin Grigorov:

  Show us some code and the real exception.


 On Thu, Dec 6, 2012 at 11:26 AM, Karsten Gaul karsten.g...@exedio.com
 **
 wrote:

   Hi guys,

 I still have no clue. Any suggestions? A work-around would also be much
 appreciated. I need to stay stateless but I definetely need this lazy
 loading as I have to wait for a soap response every 10 mins and for
 user
 experience issues need to display some loading component/icon as
 provided
 by AjaxLazyLoadPanel.

 Thanks,
 Karsten

 Am 05.12.2012 09:38, schrieb Karsten Gaul:

Hi,

  I'm trying to use the functionality of an AjaxLazyLoadPanel in a
 stateless page but this doesn't seem to work as the injected content
 is
 not
 a container and the following exception is thrown:

 java.lang.**IllegalArgumentException: Component is not a
 container
 and
 so does not contain the path componentid:**containedcomponentid:

 [Component id = content]

at org.apache.wicket.Component.**get(Component.java:4500)
at org.apache.wicket.**MarkupContainer.get(**
 MarkupContainer.java:354)


 I wrote a StatelessAbstractDefaultAjaxBe**havior overriding


 geCallbackUrl which I use in my 

Re: stateless AjaxLazyLoadPanel wicket 1.4.21

2012-12-06 Thread Karsten Gaul

The exception is thrown when this = content and path = myForm:enumChoice
It seems the content has no other children as it only contains a parent 
member field


I already tested the stateful version and can confirm it works OK which 
made me hope I could write a similar version for stateless pages as well.


Am 06.12.2012 13:00, schrieb Martin Grigorov:

On Thu, Dec 6, 2012 at 12:57 PM, Karsten Gaul karsten.g...@exedio.comwrote:


Hi Martin,

myContent is the id of the StatelessAjaxLazyLoadPanel which contains a
constant

private static final String LAZY_LOAD_COMPONENT_ID = content;

which is used in getLazyLoadComponent(String markupId). 'myContent'
contains the lazy load component 'content'.

StatelessAjaxLazyLoadComponent is added to a WebMarkupContainer which
itself is added to MyPage.

If you look at the source of AjaxLazyLoadPanel the 'content' (added in
onBeforeRender) is replaced in the respond method of the Behavior. Could
that be the reason why it is not a container?


The default (stateful) version works OK, so the problem seems to be that
when the Ajax call is made a new page is created (this is what stateless
means) and when it tries to find the lazy panel or its component (I'm not
sure which one) it fails to find it.
The debugger will tell you what exactly happens.



Regards,
Karsten

Am 06.12.2012 12:37, schrieb Martin Grigorov:


On Thu, Dec 6, 2012 at 11:53 AM, Karsten Gaul karsten.g...@exedio.com**
wrote:

  Trying to:

/// StatelessAbstractDefaultAjaxBehavior ///


@Override
  public CharSequence getCallbackUrl(final boolean
onlyTargetActivePage)
  {
  final CharSequence url = super.getCallbackUrl(**

onlyTargetActivePage);
  final PageParameters params = getPageParameters();
  // NOTE: quick hack to remove old and obsolete random
parameter
from request (see wicket-ajax.js)
  if (params!=null  params.containsKey(random))
  params.remove(random);
  return StatelessEncoder.appendParameters(url, params);

  }


StatelessEncoder appends params to WebRequestEncoder
stateless hint - true

In the StatelessAjaxLazyLoadPanel I'm using this Behavior instead of the
usual AbstractDefaultAjaxBehavior

/// My Page ///

onInitialize()
{
  add( new StatelessAjaxLazyLoadPanel(myContent)

  Here we see myContent id.


   {

  private static final long serialVersionUID = 1L;

  @Override
  public Component getLazyLoadComponent( String markupId )
  {
  return new MyContentPanel( markupId );
  }

  @Override
  public PageParameters getPageParameters()
  {
  return pageParameters;
  }
  } );
}

/// MyContentPanel ///

Form form = new Form(myForm);
form.add( new DropDownChoiceEnum(enumChoice));
add(form);


java.lang.IllegalArgumentException: Component is not a container
and so
does not contain the path myForm:enumChoice:

[Component id = content]

  Here it complains about content. What is the relation between

'myContent'
and 'content'  component ?

Which component adds the StatelessAjaxLazyLoadPanel ?


at org.apache.wicket.Component.get(Component.java:4500)

  Put a breakpoint here and see what is in the context. What is 'this',

what
in its 'children' member field.
'myForm' has children with 'enumChoice' inside, then 'enumChoce' becomes
'this and you need to see how to get to the lazy load panel and its lazy
load component.


at org.apache.wicket.MarkupContainer.get(**

MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
MarkupContainer.java:354)
  at org.apache.wicket.MarkupContainer.get(
MarkupContainer.java:354)


Would that be sufficient?

Thanks,
Karsten


Am 06.12.2012 11:30, schrieb Martin Grigorov:

  Show us some code and the real exception.


On Thu, Dec 6, 2012 at 11:26 AM, Karsten Gaul karsten.g...@exedio.com

**

wrote:

   Hi guys,


I still have no clue. Any suggestions? A work-around would also be much
appreciated. I need to stay stateless but I definetely need this lazy
loading as I have to wait for a soap response every 10 mins and for
user
experience issues need to display some loading component/icon as
provided
by AjaxLazyLoadPanel.

Thanks,
Karsten

Am 05.12.2012 09:38, schrieb Karsten Gaul:

Hi,

  I'm trying to use the functionality of an AjaxLazyLoadPanel in a

stateless page but this doesn't seem to work as the injected content
is
not
a container and the following exception is thrown:

java.lang.**IllegalArgumentException: Component is not a
container
and
so does not contain the path componentid:**containedcomponentid:


Re: Syncing files with designers

2012-12-06 Thread Edgar Merino
Thanks again for the response. For the first part I had it already 
figured out, but having a concrete example is always helpful.


 We thought the same - but this not manageable with more than 50 files 
in one folder. So we decide to use folders - as already mentioned. 
Perhaps I'll write a tutorial...


How did you manage relative links in markup? With css resources it won't 
be a problem, the designers can add their resources using link 
href=../css/style.css/link and any relative url in it will 
translate to the right path, however this is not true for relative paths 
inside the html document: img src=../img/img.png / for example, will 
be a problem since wicket always resolves relatives paths from the web 
root (or webapp folder).


Do you include the resources you need inside all of your folders so 
relative paths resolve correctly outside and inside the wicket application?



Thanks in advance,
Edgar Merino


On 05/12/12 10:56, Jan Riehn wrote:

Hello Edgar,

 I think I'm missing something: since every WebPage in wicket has 
straight access to resources located in the web root  (that is, every 
path reference in the page's markup is relative to the web root)


Wicket is able to locate resources outside of the web application: 
This could be done by implementing an own IResourceFinder:


public final class FileSystemResourceFinder implements IResourceFinder {
private final Resource resource;

public FileSystemResourceFinder(Resource resource) {
this.resource = resource;
}

@Override
public IResourceStream find(Class? clazz, String pathname) {
try {
final File file = new File(resource.getFile(), pathname);
if (file.exists()) {
return new FileResourceStream(file);
}
} catch (final IOException e) {
// ignore, file couldn't be found
}
return null;
}
}

At least you've to add the resource finder to the resource finders 
list with getResourceSettings().setResourceFinders(resourceFinderList) 
in your applications init method. Alternatively, implement a custom 
ResourceStreamLocator. At first the Locator should use the 
FileSystemResourceFinder - if there's no match the locator should 
fallback to wicket's default resource finder. So far, your application 
is able to locate resources from the local file system.


 I would like to avoid using folders to organise html files so the 
designers can put all the resources they need in their root folder. 
The mechanism you describe, seems to use folders, how are you managing 
this for the designers?


We thought the same - but this not manageable with more than 50 files 
in one folder. So we decide to use folders - as already mentioned. 
Perhaps I'll write a tutorial...



Best regards,

Jan


On 12/05/2012 02:49 PM, Edgar Merino wrote:
Hello Jan, that seems like a good approach. However, I think I'm 
missing something: since every WebPage in wicket has straight access 
to resources located in the web root (that is, every path reference 
in the page's markup is relative to the web root), I would like to 
avoid using folders to organize html files so the designers can put 
all the resources they need in their root folder. The mechanism you 
describe, seems to use folders, how are you managing this for the 
designers?



Edgar Merino


On 04/12/12 04:15, Jan Riehn wrote:

Hello Edgar,

Yes, this is how it works.

For the best separation of the responsibilities, you may store the 
resources outside of the web application (Think about a complete 
physical separation).
We've made a good experience to break-off with wicket's given 
package structure - wicket’s resource localization does not fit with 
a separation of the responsibilities: the web designer has no 
knowledge about the internal package structure and it's not 
resistant against refactoring. Therefore, we use a more technical 
mechanism based on style, variation locale and the filename.


1. prefix/style/variation/locale/filename.extension
2. prefix/style/variation/filename.extension
3. prefix/style/filename.extension
4. prefix/filename.extension
5. filename.extension


Best regards,

Jan

On 12/04/2012 09:04 AM, Edgar Merino wrote:

Hello, I would like our designers to work with a simple folder structure
on our application pages markup, and we would like to avoid including
java source code files with the files we share with them. What is the
best way to do this? I though about implementing a custom
ResourceStreamLocator, so I can for instance name our html files using
the fqcn e.g. my.company.HomePage.html and placing these files in the
default package (under src/main/html for example).

Is this the way to go?

Thanks in advance,
Edgar Merino

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











Re: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Raul
I've tried to override FormComponentPanel#convertInput (),  but in the
execution of this, both the method TextField#getConvertedInput () and
TextField#getModelObject () return null. By the way I'm using Wicket 6.3



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-FormComponentPanel-tp4654441p4654557.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: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Paul Bors
I would suggest overriding FormComponentPanel#convertInput() only if your
domain object can't be easily converted by Wicket given the model you have.

If you're using CompoundPropertyModel and set the model on your
FormComponentPanel then your TextField ID and type should be all you need
for wicket to know which getter/setter to call.

Since you mentioned that you can see the values rendered okay but you can't
change them via your form submit I would ask to see the full picture.

Can you create a quick start and show it to us?
http://wicket.apache.org/start/quickstart.html

Also take a look at FormComponentPanel's direct known subclasses:
DateTimeField, MultiFileUploadField, Multiply

~ Thank you,
  Paul Bors

-Original Message-
From: Raul [mailto:ralva...@netwie.com] 
Sent: Thursday, December 06, 2012 10:35 AM
To: users@wicket.apache.org
Subject: Re: Model is null after submit, using FormComponentPanel

I've tried to override FormComponentPanel#convertInput (),  but in the
execution of this, both the method TextField#getConvertedInput () and
TextField#getModelObject () return null. By the way I'm using Wicket 6.3



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-
FormComponentPanel-tp4654441p4654557.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



WebSockets questions

2012-12-06 Thread Maxim Solodovnik
Hello,

I'm trying to add WebSocketBehavior to our project (Apache Openmeetings
Incubating)

Unfortunately my first attempts were unsuccessful :(

Configuration:
1) custom Tomcat7 (Red5 server on the top of Servlet Engine: Apache
Tomcat/7.0.32 embedded)
2) Sun JDK 1.7.09
3) Ubuntu 12.10
4) Wicket 6.3.0
5) Google Chrome 24.0.1312.32 beta
6) One page architecture with custom HomePageMapper
https://svn.apache.org/repos/asf/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/Application.java

What I did:
1) set org.apache.wicket.protocol.http.Tomcat7WebSocketFilter
2) add new WebSocketBehavior() to the page

Errors:
1) if the page is accessed via
http://localhost:5080/openmeetings/html/#admin/configs URL I get URL has
fragment component
ws://localhost:5080/openmeetings/html/#admin/configspageId=8 error

2) if the page is accessed via http://localhost:5080/openmeetings/html/ I
get
java.lang.IllegalStateException: Request parameter 'pageId' is required!
in the error log

I believe error 1) above is bug, I'm I right?
Maybe anybody can suggest how to handle error 2) ?

I would really appreciate any help :)

-- 
WBR
Maxim aka solomax


Recommended way to hide and show table rows dynamically?

2012-12-06 Thread shimin_q
I have a table that includes only two rows when it is first loaded, but
later, depending on the selected value of the first row, I will need to add
a number of rows to the table.  I assume it is a quite common AJAX task, is
there a recommended way to do this?  My existing way of handing this has run
into an issue where all the DropDownChoice (select option menu on HTML)
components that were dynamically added to the table are unable to display
the selected value after user selection, so I am trying to figure out if it
is due to my existing AJAX code...   (I am using latest wicket 6.3 and
jQuery mobile 1.8.2)

Here is the html portion:


body
div data-role=page data-theme=b
div data-role=header data-theme=b id=header
message

/div
form id=createMPForm wicket:id=createMPForm
  

  
  
  
 
 label for=profileType wicket:id=profileTypeLabel
class=requiredLabelMetaprofile Type/label
 select id=profileType name=profileType
wicket:id=type
  optiondefault/option
/select 


 
 label for=profileName wicket:id=profileNameLabel
class=requiredLabelMetaprofile 
Name/label
 input name=profileName type=text id=profileName
wicket:id=profileName/ 
  




 
 label for=oxeNode wicket:id=oxeNodeLabel
class=requiredLabelOXE Node/label
select id=oxeNode name=oxeNode wicket:id=oxeNode
  option selectedOXENode/option
/select


 
 label for=range wicket:id=rangeLabel
class=requiredLabelFree Number Range/label
 select name=range id=range wicket:id=range/


 
  label for=deviceType wicket:id=deviceTypeLabel
class=requiredLabelDevice Type/label
 select name=deviceType wicket:id=deviceType
  option selectedSIP Extension/option
/select 

...


Now the Wicket code for these:

profileTypeBox = new DropDownChoiceMetaProfileType(type,
new PropertyModelMetaProfileType(profile, 
type),
Arrays.asList(MetaProfileType.values()),
new IChoiceRendererMetaProfileType() {
private static final long 
serialVersionUID = 1L;
@Override
public Object 
getDisplayValue(MetaProfileType object) {
return object.name();
}
@Override
public String 
getIdValue(MetaProfileType object, int index) {
return object.name();
}
}
);
profileTypeBox.setOutputMarkupId(true);
add(profileTypeBox);
 
profileTypeBox.add(new 
AjaxFormComponentUpdatingBehavior(onChange) {
private static final long serialVersionUID = 1L;
protected void onUpdate(AjaxRequestTarget target) {
resetFieldsPerProfileType(target);
//add any component that will be called in 
resetFieldsPerProfileType()
target.add(oxeNodeAsteriskImg);
target.add(oxeNodeLabel);
target.add(oxeNodeBox);
target.add(rangeAsteriskImg);
target.add(rangeLabel);
target.add(freeNumRangeBox);
target.add(deviceTypeAsteriskImg);
target.add(deviceTypeLabel);
target.add(deviceTypeBox);
//...
};
});

//...
oxeNodeModel = new 
LoadableDetachableModelListlt;String() {
private static final long serialVersionUID = 1L;
@Override
protected ListString load() {
try {
ListString names = null;
if ((profile!=null)  
(profile.getType().equals(MetaProfileType.OXE)
|| profile.getType().equals(MetaProfileType.OXE_WITH_OT)))
names = 
getOXENodeList();
if (names == null)
 

Re: Recommended way to hide and show table rows dynamically?

2012-12-06 Thread William Speirs
This might be of zero use to you, but I had something similar where I was
exposing a table row by button/link. I created a somewhat generic solution
and posted it here: https://github.com/wspeirs/wicket-details-table

Bill-


On Thu, Dec 6, 2012 at 12:40 PM, shimin_q smq...@hotmail.com wrote:

 I have a table that includes only two rows when it is first loaded, but
 later, depending on the selected value of the first row, I will need to add
 a number of rows to the table.  I assume it is a quite common AJAX task, is
 there a recommended way to do this?  My existing way of handing this has
 run
 into an issue where all the DropDownChoice (select option menu on HTML)
 components that were dynamically added to the table are unable to display
 the selected value after user selection, so I am trying to figure out if it
 is due to my existing AJAX code...   (I am using latest wicket 6.3 and
 jQuery mobile 1.8.2)

 Here is the html portion:


 body
 div data-role=page data-theme=b
 div data-role=header data-theme=b id=header
 message

 /div
 form id=createMPForm wicket:id=createMPForm






  label for=profileType wicket:id=profileTypeLabel
 class=requiredLabelMetaprofile Type/label
  select id=profileType name=profileType
 wicket:id=type
   optiondefault/option
 /select



  label for=profileName wicket:id=profileNameLabel
 class=requiredLabelMetaprofile
 Name/label
  input name=profileName type=text id=profileName
 wicket:id=profileName/






  label for=oxeNode wicket:id=oxeNodeLabel
 class=requiredLabelOXE Node/label
 select id=oxeNode name=oxeNode wicket:id=oxeNode
   option selectedOXENode/option
 /select



  label for=range wicket:id=rangeLabel
 class=requiredLabelFree Number Range/label
  select name=range id=range wicket:id=range/



   label for=deviceType wicket:id=deviceTypeLabel
 class=requiredLabelDevice Type/label
  select name=deviceType wicket:id=deviceType
   option selectedSIP Extension/option
 /select

 ...


 Now the Wicket code for these:

 profileTypeBox = new
 DropDownChoiceMetaProfileType(type,
 new
 PropertyModelMetaProfileType(profile, type),
 Arrays.asList(MetaProfileType.values()),
 new IChoiceRendererMetaProfileType() {
 private static final long
 serialVersionUID = 1L;
 @Override
 public Object
 getDisplayValue(MetaProfileType object) {
 return object.name();
 }
 @Override
 public String
 getIdValue(MetaProfileType object, int index) {
 return object.name();
 }
 }
 );
 profileTypeBox.setOutputMarkupId(true);
 add(profileTypeBox);

 profileTypeBox.add(new
 AjaxFormComponentUpdatingBehavior(onChange) {
 private static final long serialVersionUID = 1L;
 protected void onUpdate(AjaxRequestTarget target) {
 resetFieldsPerProfileType(target);
 //add any component that will be called in
 resetFieldsPerProfileType()
 target.add(oxeNodeAsteriskImg);
 target.add(oxeNodeLabel);
 target.add(oxeNodeBox);
 target.add(rangeAsteriskImg);
 target.add(rangeLabel);
 target.add(freeNumRangeBox);
 target.add(deviceTypeAsteriskImg);
 target.add(deviceTypeLabel);
 target.add(deviceTypeBox);
 //...
 };
 });

 //...
 oxeNodeModel = new
 LoadableDetachableModelListString() {
 private static final long serialVersionUID
 = 1L;
 @Override
 protected ListString load() {
 try {
 ListString names = null;
 if ((profile!=null) 
 (profile.getType().equals(MetaProfileType.OXE)
 || 

Re: How to call a Wicket Ajax click event

2012-12-06 Thread Jered Myers
I am able to make this work in a Quickstart, so there must be something 
else wrong.  Thanks for the response Martin.


Here is code if anybody wants an example:
Java:
AjaxLinkVoid standardAjaxLink = new 
AjaxLinkVoid(standardAjaxLink)

{
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target)
{
target.appendJavaScript(alert('The standard ajax link 
has been clicked'););

}
};
standardAjaxLink.setOutputMarkupId(true);
add(standardAjaxLink);

FormVoid form = new FormVoid(pageForm);
add(form);

AjaxSubmitLink ajaxSubmitLink = new 
AjaxSubmitLink(ajaxSubmitLink)

{
private static final long serialVersionUID = 1L;

@Override
public void onSubmit(AjaxRequestTarget target, Form? form)
{
target.appendJavaScript(alert('The ajax submit link 
has been subimtted'););

}
};
form.add(ajaxSubmitLink);

HTML:
script
function clickTheAjaxLink() {
$(a[linkType=standard]).triggerHandler(click);
}
function clickTheAjaxSubmitLink() {
$(a[linkType=submit]).triggerHandler(click);
}
/script
a href=# onclick=clickTheAjaxLink();Click the Ajax 
Link/a a wicket:id=standardAjaxLink linktype=standardStandard 
Ajax Link/a

br /br /
a href=# onclick=clickTheAjaxSubmitLink();Click the 
Ajax Submit Link/a

form wicket:id=pageForm
input type=text value=Some Data/input
a wicket:id=ajaxSubmitLink linktype=submitSubmit 
Form/a

/form

On 12/06/2012 12:16 AM, Martin Grigorov wrote:

Hi,

Wicket 6 uses jQuery.on() to register the event listeners.
If your AjaxSubmitLink listens on 'click' then
jQuery('#theSubmitLinkId').triggerHandler('click') should do it.
Also check the docs of jQuery#trigger


On Thu, Dec 6, 2012 at 1:53 AM, Jered Myers jer...@maplewoodsoftware.comwrote:


The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am
trying to get back to the onSubmit on the server side.  I saw
http://apache-wicket.1842946.**n4.nabble.com/Wicket-6-Ajax-**
Behaviors-td4654398.htmlhttp://apache-wicket.1842946.n4.nabble.com/Wicket-6-Ajax-Behaviors-td4654398.html,
but $(mylink).triggerHandler('**click') doesn't seem to be working. Do I
treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


On 12/05/2012 03:28 PM, Jered Myers wrote:


Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or JavaScript?
  I have an AjaxLink that I have added to the page and after I run some
JavaScript, I want to pragmatically click the link with JavaScript.  This
broke when updating from Wicket 1.5 to 6.  It appears that the onclick
attribute is no longer on my link and I am not sure how to call the events
that Wicket has registered in the head.







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



Re: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Joachim Schrod
Paul Bors wrote:
 I would suggest overriding FormComponentPanel#convertInput() only if your
 domain object can't be easily converted by Wicket given the model you have.
 
 If you're using CompoundPropertyModel and set the model on your
 FormComponentPanel then your TextField ID and type should be all you need
 for wicket to know which getter/setter to call.

Really? That's not possible in an 1.4-based application, IMHO.

FormComponentPanel is a FormComponent, i.e., it participates in
conversion, validation, and update Model. When that
FormComponentPanel has an associated model, e.g., a
CompoundPropertyModel, its getInputAsArray() will return null, null
will be stored as convertedInput, and updateModel() will set the
CompoundPropertyModel's object to that null value.

When sub-widgets of a FormComponentPanel do all the work necessary,
and the FormComponentPanel has a model of its own, I often override
updateModel() to be an empty method, to prevent the behavior named
above from happening.

Best,
Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



Potential XSS-Vulnerability due to the way Wicket renders JavaScript in CDATA blocks?

2012-12-06 Thread spam2...@meeque.de
Hello List,


I must admit, I don't follow here too closely. But I've searched the
archive and Wicket's Jira, and have not found much discussion regarding
this Issue. So let me elaborate...


A partner pointed me to a XSS vulnerability in one of our websites built
with Wicket. The respective page uses a lot of custom JS code, and some
of it interacts with the backend, too. We use
AbstractDefaultAjaxBehavior.getCallbackUrl() to build the respective
URLs. This apparently includes URL-parameters that were used to access
the original page, no matter if these parameters are needed by the
Wicket application or not. Hence an attacker can manipulate theses URLs,
and render them into the page. 

In Wicket 1.5. that caused injection trouble when such a tampered URL
contains the closing of an XML CDATA block, i.e. the characters ]].
We're currently migrating the website to Wicket 6 (great work on the JS
integration there btw.) where this kind of injection does not work.
Apparently, the URLs that are returned by
AbstractDefaultAjaxBehavior.getCallbackUrl() are already sanitized. So
no more problem for us here. 


However, that all started me thinking. And in the end I could construct
a similar XSS vulnerability, even with Wicket 6.0. Here's an example,
using an IHeaderResponse:

response.render( new OnDomReadyHeaderItem( var foo = 'Injecting CDATA
section end-tag ... ]] /scripth1... in order to break out of script
block/h1' ) );

Of course, the above is just a demo, using a static string. However, it
might aswell contain dynamic data constructed from user input. Point
being, it is a string of perfectly legitimate JavaScript code. So
JS-escaping wouldn't help much. Still it introduces a serious XSS
vulnerability IMHO.

Btw, the documentation of OnDomReadyHeaderItem merely speaks of
JavaScript -- it does not mention anything about encoding it. So as a
caller I assumed, OnDomReadyHeaderItem (or more generally Wicket) would
take care of proper escaping. 

Also, I don't think OnDomReadyHeaderItem is the only way to reproduce
this. I suspect such injection is possible almost anywhere Wicket
renders JavaScript. In particular, Wicket code ads its own
![CDATA[ ... ]] markers around JS code-blocks in HTML. So shouldn't it
also make sure, that these code-blocks don't contain the charactes ]]
themselves? And somehow escape them, if needed?


Sorry, if all of that has already been discussed. I noticed a long time
ago that Wicket uses CDATA blocks for JS code. And I always assumed
Wicket would take appropriate measures to prevent code from breaking out
of these blocks. So I'm a little worried about my discovery. 


Regards,
Michael


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



AjaxLazyLoadingPanel finished event?

2012-12-06 Thread pkc
Hi Everyone,

I need to update a feedback panel with some info after a lazy load panel
finishes getting its data.  I was looking for a method like onPanelLoaded(
AjaxRequestTarget target ) but didn't see anything so not sure how to get
my feedback panel refreshed.

Thanks for any tips.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLazyLoadingPanel-finished-event-tp4654565.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: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Raul
I created a quickstart, Where I can upload it for what you may see?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-FormComponentPanel-tp4654441p4654566.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: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Paul Bors
Assuming that you don't set a model for the FormComponet won't Wicket fail
back to the CompountPropertyModel of the form?

Who will perform the conversion then?

I only override FormComponentPanel#convertInput() when I force my clients to
provide the model for my FormComponentPanel and even then I delegate the
call to another form component :)

e.g.

/**
 * {@link FormComponentPanel} that hosts the label and form component with a
shared model.br
 * The label can be aligned around the form field given the {@link LABEL}
value constants.
 * 
 * @param F, M
 *  F = The form field type (e.g. TextField, CheckBox etc.)
 *  M = The model object type of the form field
 */
public class LabeledFormFieldF extends LabeledWebMarkupContainer, M
extends FormComponentPanelM {
...
public LabeledFormField(String id, IModelM model, ...) {
...
}
...
/**
 * Propagate changes into the real valid model via the
FormComponentPanel.convertInput() method.
 * {@inheritDoc}
 */
@Override
@SuppressWarnings(unchecked)
protected void convertInput() {
FormComponent? formComponent = ...
if(formComponent != null) {
setConvertedInput((M)formComponent.getConvertedInput());
}
}
...
}

Above class warps around all the form field I use to ensure that
accessibility is supported.

I did so per the recommendation of Wicket:
http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/
html/form/FormComponentPanel.html

It is recommended that you override FormComponent.convertInput() and let it
set the value that represents the compound value of the nested components.
Often, this goes hand-in-hand with overriding Component.onBeforeRender(),
where you would analyze the model value, break it up and distribute the
appropriate values over the child components.

But if you have a CompoundPropertyModel, do you really need to do all this
conversion?
Wouldn't the form component wrapped inside the panel handle it itself?

I had to delegate the call because I don't always use a
CompoundProeprtyModel.

~ Thank you,
  Paul Bors

-Original Message-
From: Joachim Schrod [mailto:jsch...@acm.org] 
Sent: Thursday, December 06, 2012 2:05 PM
To: users@wicket.apache.org
Subject: Re: Model is null after submit, using FormComponentPanel

Paul Bors wrote:
 I would suggest overriding FormComponentPanel#convertInput() only if 
 your domain object can't be easily converted by Wicket given the model you
have.
 
 If you're using CompoundPropertyModel and set the model on your 
 FormComponentPanel then your TextField ID and type should be all you 
 need for wicket to know which getter/setter to call.

Really? That's not possible in an 1.4-based application, IMHO.

FormComponentPanel is a FormComponent, i.e., it participates in conversion,
validation, and update Model. When that FormComponentPanel has an associated
model, e.g., a CompoundPropertyModel, its getInputAsArray() will return
null, null will be stored as convertedInput, and updateModel() will set the
CompoundPropertyModel's object to that null value.

When sub-widgets of a FormComponentPanel do all the work necessary, and the
FormComponentPanel has a model of its own, I often override
updateModel() to be an empty method, to prevent the behavior named above
from happening.

Best,
Joachim

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.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: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Paul Bors
Clean it, zip it and just publish it somewhere where you can post the URL in
a reply to this thread :)

~ Thank you,
  Paul Bors

-Original Message-
From: Raul [mailto:ralva...@netwie.com] 
Sent: Thursday, December 06, 2012 3:32 PM
To: users@wicket.apache.org
Subject: RE: Model is null after submit, using FormComponentPanel

I created a quickstart, Where I can upload it for what you may see?



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-
FormComponentPanel-tp4654441p4654566.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



Deleting Cookies

2012-12-06 Thread Corbin, James
I have a ListView that renders items that are populated from user cookie data.  
The ListView contains a clear action that is supposed to delete the cookies 
then refresh the ListView so it reflects that the cookie data was removed.  I 
have code that executes the deletion of the cookies (works), then I turn around 
and detach the ListView's model which triggers a rereading of the cookie data.  
For some reason (probably works as designed), when the model is detach and 
reloads the cookies, they are still present.
If I then force a page refresh, cookie data is in fact removed and the ListView 
is empty.

Is there a way to attain this?  Am I missing something?  I really don't want to 
have to reload the page to see that the cookie data has been removed.

J.D.




Re: Deleting Cookies

2012-12-06 Thread Sebastien
Hi,

Be sure to use a LoadableDetachableModel
Also, maybe you set ListView#*setReuseItems* to true (because the ListView
is in a form)? You can set it to false if you have no validation and then
you will get fresh data (see ListView javadoc)

Hope this helps,
Sebastien.

On Thu, Dec 6, 2012 at 11:09 PM, Corbin, James jcor...@iqnavigator.comwrote:

 I have a ListView that renders items that are populated from user cookie
 data.  The ListView contains a clear action that is supposed to delete
 the cookies then refresh the ListView so it reflects that the cookie data
 was removed.  I have code that executes the deletion of the cookies
 (works), then I turn around and detach the ListView's model which triggers
 a rereading of the cookie data.  For some reason (probably works as
 designed), when the model is detach and reloads the cookies, they are still
 present.
 If I then force a page refresh, cookie data is in fact removed and the
 ListView is empty.

 Is there a way to attain this?  Am I missing something?  I really don't
 want to have to reload the page to see that the cookie data has been
 removed.

 J.D.





Re: Deleting Cookies

2012-12-06 Thread Corbin, James
The ListView is not in a form, which is why I am leaving the default for
setReuseItems to false.
I am using a LoadableDetachableModel and verified the load that rereads
the cookies, does in fact get called after I delete them (reset method
call below).  If I break in the load of the detachable model, it is
reading that there are still values for the cookies I deleted in the
previous step.

Basically, here is the body of my Ajax Link's onClick,

RecentlyViewedItemsCollection c = new
RecentlyViewedItemsCollection(util.getCurrentUser());
c.reset(); // this actually deletes all the 
cookies
getModel().detach(); // this forces the 
detachable model to call its
load, which attempts to re-read specific cookies that should no longer
exist

target.add(RecentlyViewedItemsPanel.this.get(itemContainer)); //
lastly, I refresh the parent (WebMarkupContainer) of the ListView

I would have expected that when the model's load method is called that it
would see that the cookies were removed, but it still finds them.

J.D.








On 12/6/12 3:29 PM, Sebastien seb...@gmail.com wrote:

Hi,

Be sure to use a LoadableDetachableModel
Also, maybe you set ListView#*setReuseItems* to true (because the ListView
is in a form)? You can set it to false if you have no validation and then
you will get fresh data (see ListView javadoc)

Hope this helps,
Sebastien.

On Thu, Dec 6, 2012 at 11:09 PM, Corbin, James
jcor...@iqnavigator.comwrote:

 I have a ListView that renders items that are populated from user cookie
 data.  The ListView contains a clear action that is supposed to delete
 the cookies then refresh the ListView so it reflects that the cookie
data
 was removed.  I have code that executes the deletion of the cookies
 (works), then I turn around and detach the ListView's model which
triggers
 a rereading of the cookie data.  For some reason (probably works as
 designed), when the model is detach and reloads the cookies, they are
still
 present.
 If I then force a page refresh, cookie data is in fact removed and the
 ListView is empty.

 Is there a way to attain this?  Am I missing something?  I really don't
 want to have to reload the page to see that the cookie data has been
 removed.

 J.D.






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



Re: Deleting Cookies

2012-12-06 Thread Sebastien
Well, I think it is because this is the same listview that is redisplayed,
not the new one.
The cause is that you did not add the new listview to its parent.

But, I would have done a little bit differently because:
1/ You do not have to recreate the listview in ajaxlink's onclick. just
clear cookies and reattach the listview's parent-container
2/ You do not have - generally speaking - to detach you model yourself and,
moreover, it is not interesting to do it in the same request cycle. It
should be end at the end of the previous cycle. The use of a LDM does this
for you.

So: just one ListView with a LDM, and it should be good.
If it's still not, maybe the persistence of the cookie update is a little
bit slow and IO-async... But I (means myself) could not help in a such
case.

Best regards,
Sebastien.


On Thu, Dec 6, 2012 at 11:41 PM, Corbin, James jcor...@iqnavigator.comwrote:

 The ListView is not in a form, which is why I am leaving the default for
 setReuseItems to false.
 I am using a LoadableDetachableModel and verified the load that rereads
 the cookies, does in fact get called after I delete them (reset method
 call below).  If I break in the load of the detachable model, it is
 reading that there are still values for the cookies I deleted in the
 previous step.

 Basically, here is the body of my Ajax Link's onClick,

 RecentlyViewedItemsCollection c = new
 RecentlyViewedItemsCollection(util.getCurrentUser());
 c.reset(); // this actually deletes all
 the cookies
 getModel().detach(); // this forces the
 detachable model to call its
 load, which attempts to re-read specific cookies that should no longer
 exist

 target.add(RecentlyViewedItemsPanel.this.get(itemContainer)); //
 lastly, I refresh the parent (WebMarkupContainer) of the ListView

 I would have expected that when the model's load method is called that it
 would see that the cookies were removed, but it still finds them.

 J.D.








 On 12/6/12 3:29 PM, Sebastien seb...@gmail.com wrote:

 Hi,
 
 Be sure to use a LoadableDetachableModel
 Also, maybe you set ListView#*setReuseItems* to true (because the ListView
 is in a form)? You can set it to false if you have no validation and then
 you will get fresh data (see ListView javadoc)
 
 Hope this helps,
 Sebastien.
 
 On Thu, Dec 6, 2012 at 11:09 PM, Corbin, James
 jcor...@iqnavigator.comwrote:
 
  I have a ListView that renders items that are populated from user cookie
  data.  The ListView contains a clear action that is supposed to delete
  the cookies then refresh the ListView so it reflects that the cookie
 data
  was removed.  I have code that executes the deletion of the cookies
  (works), then I turn around and detach the ListView's model which
 triggers
  a rereading of the cookie data.  For some reason (probably works as
  designed), when the model is detach and reloads the cookies, they are
 still
  present.
  If I then force a page refresh, cookie data is in fact removed and the
  ListView is empty.
 
  Is there a way to attain this?  Am I missing something?  I really don't
  want to have to reload the page to see that the cookie data has been
  removed.
 
  J.D.
 
 
 



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




Re: Deleting Cookies

2012-12-06 Thread Corbin, James
Hi Sebastian,

Thanks for your feedback.  I wasn't recreating (semantics?) the Listview,
I was just refreshing it via ajax so it updates with the model changes.
What do you mean by reattach the listview's parent-container?  Do you
mean remove the listview and re-add it in the onbeforerender?

J.D.



On 12/6/12 4:16 PM, Sebastien seb...@gmail.com wrote:

Well, I think it is because this is the same listview that is redisplayed,
not the new one.
The cause is that you did not add the new listview to its parent.

But, I would have done a little bit differently because:
1/ You do not have to recreate the listview in ajaxlink's onclick. just
clear cookies and reattach the listview's parent-container
2/ You do not have - generally speaking - to detach you model yourself
and,
moreover, it is not interesting to do it in the same request cycle. It
should be end at the end of the previous cycle. The use of a LDM does this
for you.

So: just one ListView with a LDM, and it should be good.
If it's still not, maybe the persistence of the cookie update is a little
bit slow and IO-async... But I (means myself) could not help in a such
case.

Best regards,
Sebastien.


On Thu, Dec 6, 2012 at 11:41 PM, Corbin, James
jcor...@iqnavigator.comwrote:

 The ListView is not in a form, which is why I am leaving the default for
 setReuseItems to false.
 I am using a LoadableDetachableModel and verified the load that rereads
 the cookies, does in fact get called after I delete them (reset method
 call below).  If I break in the load of the detachable model, it is
 reading that there are still values for the cookies I deleted in the
 previous step.

 Basically, here is the body of my Ajax Link's onClick,

 RecentlyViewedItemsCollection c = new
 RecentlyViewedItemsCollection(util.getCurrentUser());
 c.reset(); // this actually deletes all
 the cookies
 getModel().detach(); // this forces the
 detachable model to call its
 load, which attempts to re-read specific cookies that should no longer
 exist

 target.add(RecentlyViewedItemsPanel.this.get(itemContainer)); //
 lastly, I refresh the parent (WebMarkupContainer) of the ListView

 I would have expected that when the model's load method is called that
it
 would see that the cookies were removed, but it still finds them.

 J.D.








 On 12/6/12 3:29 PM, Sebastien seb...@gmail.com wrote:

 Hi,
 
 Be sure to use a LoadableDetachableModel
 Also, maybe you set ListView#*setReuseItems* to true (because the
ListView
 is in a form)? You can set it to false if you have no validation and
then
 you will get fresh data (see ListView javadoc)
 
 Hope this helps,
 Sebastien.
 
 On Thu, Dec 6, 2012 at 11:09 PM, Corbin, James
 jcor...@iqnavigator.comwrote:
 
  I have a ListView that renders items that are populated from user
cookie
  data.  The ListView contains a clear action that is supposed to
delete
  the cookies then refresh the ListView so it reflects that the cookie
 data
  was removed.  I have code that executes the deletion of the cookies
  (works), then I turn around and detach the ListView's model which
 triggers
  a rereading of the cookie data.  For some reason (probably works as
  designed), when the model is detach and reloads the cookies, they are
 still
  present.
  If I then force a page refresh, cookie data is in fact removed and
the
  ListView is empty.
 
  Is there a way to attain this?  Am I missing something?  I really
don't
  want to have to reload the page to see that the cookie data has been
  removed.
 
  J.D.
 
 
 



 -
 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: Deleting Cookies

2012-12-06 Thread Sebastien
Oops, you are right: I misread. I though you was recreating the listview,
sorry for he confusion!

Also, reattach the listview's parent-container simply means what you
already do by:
target.add(RecentlyViewedItemsPanel.this.get(itemContainer));
(this is because it is not possible to reattach the listview directly but
you already knew that)

Well, as I said earlier, maybe is it a cookie/IO issue. I mean: the fact of
deleting and persisting changes in the cookie may be IO-asynchronous and
then the model is updated before changes are persisted...
I hope someone can help you on that subject...

Best regards,
Sebastien.

On Fri, Dec 7, 2012 at 12:28 AM, Corbin, James jcor...@iqnavigator.comwrote:

 Hi Sebastian,

 Thanks for your feedback.  I wasn't recreating (semantics?) the Listview,
 I was just refreshing it via ajax so it updates with the model changes.
 What do you mean by reattach the listview's parent-container?  Do you
 mean remove the listview and re-add it in the onbeforerender?

 J.D.



 On 12/6/12 4:16 PM, Sebastien seb...@gmail.com wrote:

 Well, I think it is because this is the same listview that is redisplayed,
 not the new one.
 The cause is that you did not add the new listview to its parent.
 
 But, I would have done a little bit differently because:
 1/ You do not have to recreate the listview in ajaxlink's onclick. just
 clear cookies and reattach the listview's parent-container
 2/ You do not have - generally speaking - to detach you model yourself
 and,
 moreover, it is not interesting to do it in the same request cycle. It
 should be end at the end of the previous cycle. The use of a LDM does this
 for you.
 
 So: just one ListView with a LDM, and it should be good.
 If it's still not, maybe the persistence of the cookie update is a little
 bit slow and IO-async... But I (means myself) could not help in a such
 case.
 
 Best regards,
 Sebastien.
 
 
 On Thu, Dec 6, 2012 at 11:41 PM, Corbin, James
 jcor...@iqnavigator.comwrote:
 
  The ListView is not in a form, which is why I am leaving the default for
  setReuseItems to false.
  I am using a LoadableDetachableModel and verified the load that rereads
  the cookies, does in fact get called after I delete them (reset method
  call below).  If I break in the load of the detachable model, it is
  reading that there are still values for the cookies I deleted in the
  previous step.
 
  Basically, here is the body of my Ajax Link's onClick,
 
  RecentlyViewedItemsCollection c = new
  RecentlyViewedItemsCollection(util.getCurrentUser());
  c.reset(); // this actually deletes all
  the cookies
  getModel().detach(); // this forces the
  detachable model to call its
  load, which attempts to re-read specific cookies that should no longer
  exist
 
  target.add(RecentlyViewedItemsPanel.this.get(itemContainer)); //
  lastly, I refresh the parent (WebMarkupContainer) of the ListView
 
  I would have expected that when the model's load method is called that
 it
  would see that the cookies were removed, but it still finds them.
 
  J.D.
 
 
 
 
 
 
 
 
  On 12/6/12 3:29 PM, Sebastien seb...@gmail.com wrote:
 
  Hi,
  
  Be sure to use a LoadableDetachableModel
  Also, maybe you set ListView#*setReuseItems* to true (because the
 ListView
  is in a form)? You can set it to false if you have no validation and
 then
  you will get fresh data (see ListView javadoc)
  
  Hope this helps,
  Sebastien.
  
  On Thu, Dec 6, 2012 at 11:09 PM, Corbin, James
  jcor...@iqnavigator.comwrote:
  
   I have a ListView that renders items that are populated from user
 cookie
   data.  The ListView contains a clear action that is supposed to
 delete
   the cookies then refresh the ListView so it reflects that the cookie
  data
   was removed.  I have code that executes the deletion of the cookies
   (works), then I turn around and detach the ListView's model which
  triggers
   a rereading of the cookie data.  For some reason (probably works as
   designed), when the model is detach and reloads the cookies, they are
  still
   present.
   If I then force a page refresh, cookie data is in fact removed and
 the
   ListView is empty.
  
   Is there a way to attain this?  Am I missing something?  I really
 don't
   want to have to reload the page to see that the cookie data has been
   removed.
  
   J.D.
  
  
  
 
 
 
  -
  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: Returning XML or HTML

2012-12-06 Thread McDonough, Jonathan
That worked! Thanks a lot Martin 

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Thursday, December 06, 2012 3:10 AM
To: users@wicket.apache.org
Subject: Re: Returning XML or HTML

A simpler solution is:

if (needsXml()) {
   getRequestCycle().replaceAllRequestHandlers(new
TextRequestHandler(text/xml, theXml))
}


On Thu, Dec 6, 2012 at 7:55 AM, Sven Meier s...@meiers.net wrote:

 You'll have to let Wicket know that you wrote the response by yourself.

 With |RestartResponseException| you can switch to another response. In
 your case you could direct the request to a resource first (since your XML
 doesn't seem be component-based) and switch to a page in case of missing
 parameters.

 Sven



 On 12/06/2012 04:49 AM, McDonough, Jonathan wrote:

 Hi all,
 I am trying to create a WebPage that returns either XML or HTML depending
 upon if a parameter is supplied. If the parameter is supplied, return a
 custom XML document. Otherwise return an HTML page with an error message.
 The code I wrote produces these results, which is great. But it is also
 throwing an exception (below) to the console. Does anyone know how to go
 about fixing this?

 I am using Java 6 and Wicket 6.2.0

 Thanks
 Jon

 Here is the code for DocumentPage.java:
  public DocumentPage(final PageParameters parameters) {
  setStatelessHint(true);

  // Get the ID
  final org.apache.wicket.util.string.**StringValue
 idStringValue = parameters.get(0);
  if (idStringValue == null || idStringValue.isEmpty()) {
  add(new Label(errorMsg, Please supply an
 ID));
  return;
  }


  // Get the CTS2 XML from the database
  final String id = idStringValue.toString();


  // Send the output
  add(new Label(errorMsg, ));
  String content = resultentry + id +
 /entry/result;

  RequestCycle.get().**getOriginalResponse().write(**
 content);
  }


 DocumentPage.html:
 html
  head
  titleError/title
  /head

  body
  span wicket:id=errorMsg /
  /body
 /html


 2012-12-05 22:36:32,976 ERROR  [RequestCycle] Error during processing
 error message
 java.lang.**IllegalStateException: Header was already written to
 response!
  at org.apache.wicket.protocol.**http.**
 HeaderBufferingWebResponse.**checkHeader(**HeaderBufferingWebResponse.**
 java:64)
  at org.apache.wicket.protocol.**http.**
 HeaderBufferingWebResponse.**sendError(**HeaderBufferingWebResponse.**
 java:105)
  at org.apache.wicket.request.**http.handler.**
 ErrorCodeRequestHandler.**respond(**ErrorCodeRequestHandler.java:**77)
  at org.apache.wicket.request.**cycle.RequestCycle$**
 HandlerExecutor.respond(**RequestCycle.java:830)
  at org.apache.wicket.request.**RequestHandlerStack.execute(**
 RequestHandlerStack.java:64)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:302)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 executeExceptionRequestHandler**(RequestCycle.java:311)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 processRequest(RequestCycle.**java:225)
  at org.apache.wicket.request.**cycle.RequestCycle.**
 processRequestAndDetach(**RequestCycle.java:281)
  at org.apache.wicket.protocol.**http.WicketFilter.**
 processRequest(WicketFilter.**java:188)
  at org.apache.wicket.protocol.**http.WicketFilter.doFilter(**
 WicketFilter.java:245)
  at org.apache.catalina.core.**ApplicationFilterChain.**
 internalDoFilter(**ApplicationFilterChain.java:**243)
  at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(
 

Re: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Joachim Schrod
Paul Bors wrote:
 Assuming that you don't set a model for the FormComponet won't Wicket fail
 back to the CompountPropertyModel of the form?

Yes, for sure. But you explicitly recommended:

 If you're using CompoundPropertyModel and set the model on your
 FormComponentPanel then your TextField ID and type should be all
you
 need for wicket to know which getter/setter to call.

I.e., you told Raul that he should set the FormComponentPanel's
model. And then he risks getting null values set in his model at
the panel level.

Please note, that I don't argue for or against storing
CompountPropertyModels in FormComponetPanels. I have many places in
my applications where storing models is sensible and where the
form's CompountPropertyModel is not the right thing, design-wise.
And the other way round, too.

As a common use case, consider when a FormComponentPanel is
actually a reusable model that may be used in several situations. A
recent example of mine is a component that handles address input
and validation for a person. The base model, available as a
CompountPropertyModel at form level, has several persons. So the
FormComponentPanel gets passed the right person model (actually,
the address model from that person model -- a person might have
several addresses!) and uses it.

And in such cases, one has to take care that the FormComponent
processing lifecycle is properly adapted to such situation.

 Who will perform the conversion then?

As I've written, quite often it's not the conversion that's the
problem, but the updateModel() call that stores
FormComponent.convertedInput into the model object. To repeat: On
the panel level, no input is available, and convertInput() stores
that as null in FormComponent.convertedInput. You need to prevent
usage of that stored field in updateModel(), otherwise your model
object will end up to be null. Overriding convertInput() is of no
use here, if there *is no input* that can be converted.

Thus quite clearly, overriding FormComponentPanel#convertInput() is
only sensible if you do something with the input values of
sub-components, beyond storing them, and if you can compute
something that you can place into convertedInput. If it's just
about storing and you use a CompountPropertyModel, overriding
FormComponentPanel#updateModel() is adequate and sufficient.

I hope this makes my arguments clearer. It probably won't help
Raul, though. :-(

Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



Re: Deleting Cookies

2012-12-06 Thread Joachim Schrod
Corbin, James wrote:
 The ListView is not in a form, which is why I am leaving the default for
 setReuseItems to false.
 I am using a LoadableDetachableModel and verified the load that rereads
 the cookies, does in fact get called after I delete them (reset method
 call below).  If I break in the load of the detachable model, it is
 reading that there are still values for the cookies I deleted in the
 previous step.
 
 Basically, here is the body of my Ajax Link's onClick,
 
 RecentlyViewedItemsCollection c = new
 RecentlyViewedItemsCollection(util.getCurrentUser());
   c.reset(); // this actually deletes all the 
 cookies
   getModel().detach(); // this forces the 
 detachable model to call its
 load, which attempts to re-read specific cookies that should no longer
   exist
   
 target.add(RecentlyViewedItemsPanel.this.get(itemContainer)); //
 lastly, I refresh the parent (WebMarkupContainer) of the ListView
 
 I would have expected that when the model's load method is called that it
 would see that the cookies were removed, but it still finds them.
 

Have you confirmed that the cookie store is updated on AJAX
requests? (a) are the updated cookies sent, and (b) are they made
available properly for your app code; i.e., don't use some
previously cached values?

I'd wireshark the request and then step through the cookie
gathering code to check what values are sent in the AJAX request
and where the load() method gets its values from.

Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

2012-12-06 Thread cknafl
I am trying some hacks now to get the application work well and I am looking
forward to just have wicket in my application :)

I don't even know why overriding getDefaultNameSpace(){ return ;} doesn't
work. The resources js or css cannot be found anymore, so the will be
searched in /wicket/wicket/ I guess...
Well, some kind of strange things happening here...

Regards and thanks for the help!
Christoph



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654579.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