Re: RadioGroup selected model value

2013-12-16 Thread Selom
Hi Sven,
Thanks for the clarification  . Now I understand much more.

I tried  out   your code your code  with the following modification.
  



Now when the page is shown , * the object  with value debut2   is
effectively selected  as expected*.

I Thanks you .



-
Selom
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/RadioGroup-selected-model-value-tp4662998p4663034.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: Why org.apache.wicket.pageStore.memory.PageTable isn't public?

2013-12-16 Thread Martin Grigorov
Improved with https://issues.apache.org/jira/browse/WICKET-5444
Thanks !

Martin Grigorov
Wicket Training  Consulting


On Fri, Dec 13, 2013 at 8:31 PM, tomask79 tomas.klou...@embedit.cz wrote:

 Hi Martin,

 ok I will, thanks for answer and apology for kind of angry post..:)

 Best wishes

 Tomas





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Why-org-apache-wicket-pageStore-memory-PageTable-isn-t-public-tp4662987p4663013.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




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

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

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

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


Note: I'm using wicket 1.5.4.


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

Thanks in advance
Venky



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Script-Error-is-getting-in-IE8-while-selecting-DatePicker-in-Modal-Window-tp4663039.html
Sent from the Users forum mailing list archive at Nabble.com.

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



a little question about add(new XComponent(id).setVisible(false))

2013-12-16 Thread Decebal Suiu
Hi

First, the scenario (a  simplified version):
I have a XPage (extends WebPage) and in the constructor of this page I want
to add a YPanel (extends Panel) but depending on a condition.

if (condiiton) {
   add(new YPanel(panel));
} else {
   add(new WebMarkupContainer(panel).setVisible(false));
}

In fact my scneario is a little complicated, with four children (a CartPage
that contains EmptyLabel, CartPanel, LoginPanel, CheckputPanel) and a
compund condition (isEmptyCart, isUserLogged) and in this situation my code
is verbose and a little spaghetti.

The code above resolves my scenario but in my opinion is more readable only
a single line

add(new YPanel(panel).setVisible(condition));

The solution with a single line is more readable but it has an impediment.
For example if in YPanel I want to add 100 labels (hypothetically), I
created 100 label only to add nothing if the condition is not satisfied :) 

The solution is to have a slim constructor for YPanel and to add the
children in a method (something like onInitialize) that depends on component
visibility. I want something like I know that this component is invisible
so don't bother to create the children.

I know about the request cycle (not in details) and that it's impossible for
now, I know that my issue is a philosophical issue but maybe someone has a
good question.

Best regards,
Decebal



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-little-question-about-add-new-XComponent-id-setVisible-false-tp4663041.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: Script Error is getting in IE8 while selecting DatePicker in Modal Window

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

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

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

Andrew



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

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

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

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


 Note: I'm using wicket 1.5.4.


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

 Thanks in advance
 Venky



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Script-Error-is-getting-in-IE8-while-selecting-DatePicker-in-Modal-Window-tp4663039.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: a little question about add(new XComponent(id).setVisible(false))

2013-12-16 Thread vineet semwal
i think what you need is  onbeforerender() and not oninintialize, before
rendering visibility is determined( if curious check the source in
component#internalbeforer()) ,
also i am assuming when you will create/add 100 labels,you will use a
repeater like dataview/listview which creates and adds items in
onbeforerender so if your repeater is not visible, the items/children (and
your labels) will not be created/rendered ...


On Mon, Dec 16, 2013 at 7:26 PM, Decebal Suiu decebal.s...@asf.ro wrote:

 Hi

 First, the scenario (a  simplified version):
 I have a XPage (extends WebPage) and in the constructor of this page I want
 to add a YPanel (extends Panel) but depending on a condition.

 if (condiiton) {
add(new YPanel(panel));
 } else {
add(new WebMarkupContainer(panel).setVisible(false));
 }

 In fact my scneario is a little complicated, with four children (a CartPage
 that contains EmptyLabel, CartPanel, LoginPanel, CheckputPanel) and a
 compund condition (isEmptyCart, isUserLogged) and in this situation my code
 is verbose and a little spaghetti.

 The code above resolves my scenario but in my opinion is more readable only
 a single line

 add(new YPanel(panel).setVisible(condition));

 The solution with a single line is more readable but it has an impediment.
 For example if in YPanel I want to add 100 labels (hypothetically), I
 created 100 label only to add nothing if the condition is not satisfied :)

 The solution is to have a slim constructor for YPanel and to add the
 children in a method (something like onInitialize) that depends on
 component
 visibility. I want something like I know that this component is invisible
 so don't bother to create the children.

 I know about the request cycle (not in details) and that it's impossible
 for
 now, I know that my issue is a philosophical issue but maybe someone has
 a
 good question.

 Best regards,
 Decebal



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/a-little-question-about-add-new-XComponent-id-setVisible-false-tp4663041.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




-- 
regards,

Vineet Semwal


Re: a little question about add(new XComponent(id).setVisible(false))

2013-12-16 Thread Decebal Suiu
I tested with:

public class MyPanel extends Panel {

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

@Override
protected void onBeforeRender() {
super.onBeforeRender();

add(new MyLabel(l1, Label 1));
add(new MyLabel(l2, Label 2));
add(new MyLabel(l3, Label 3));
 }

}

in MyPanel, where MyLabel extends Label with the constructor contains and
debug message:

public MyLabel(String id, String label) {
   super(id, label);

System.out.println(MyLabel.MyLabel(): + id);
}

And yes, the MyLabel constructed is not called if MyPanel is not visible.

My impression was that in onBeforeRender I cannot change the hierarchy (add
children).

The 100 children was a random number that show you that my panel contains
many components :)

Thanks,
Decebal




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-little-question-about-add-new-XComponent-id-setVisible-false-tp4663041p4663045.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Wicket session in a Resource

2013-12-16 Thread Stijn de Witt
Thanks Martin, knowing that it is safe to access the session is a real comfort.

Sorry for responding so late, but due to illness I haven't been in the office 
the end of previous week.

We will look into the patch.

With kind regards,

-Stijn


-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: vrijdag 13 december 2013 11:21
To: users@wicket.apache.org
Cc: Coen Wouters
Subject: Re: Wicket session in a Resource

Hi,

Using IResource instead of a WebPage for JSON response is better.
Using Session.get() in IResource is OK.
Actually IResource is something very similar to normal Servlet.
The benefit is that you have access to the Application, the Session and a 
RequestCycle.

As WICKET-5012 states there is no authentication for resources in 6.x, but we 
added it to Wicket 7.x.
Additionally WICKET-5012 has an attachment that you can add to your application 
and add authentication for the resources.

On Fri, Dec 13, 2013 at 12:13 PM, Stijn de Witt  
stijn.dew...@planonsoftware.com wrote:

 Hi Wicket gurus,

 We are trying to implement JSON RPC in Wicket. At first we had made a 
 WebPage that would respond with application/json... However, we hit a 
 problem here that Wicket parses the parameters of POST requests and 
 puts them in the PageParameters map. From there we can get to the 
 parameters, but it seems the order of the parameters is lost. 
 Furthermore when we get the request inputstream, it is empty already 
 because Wicket ate it up... So we have no way of getting the 
 parameters in the order in which they were passed...

 So we looked for solutions and found this StackOverflow posting 
 suggesting to make a Resource instead:

 http://stackoverflow.com/questions/17874695/wicket-http-post-get-raw-d
 ata-from-servletrequest
 (also see
 http://stackoverflow.com/questions/5466763/how-to-handle-xml-in-body-o
 f-a-post-request-with-a-wicket-page)

 In principle this is ok for us... However there is one caveat; it 
 seems that it is not possible in Wicket 6.x to have a resource being 
 authorized.
 Also see this Wicket issue:
 https://issues.apache.org/jira/browse/WICKET-5012

 We are using Container Managed Authentication. This means the 
 container will intercept all traffic to 'secured' URLs and send them to a 
 login page.
 This is fine for us. However I did notice from debugging that not all 
 code is run when the destination is a Resource that would be run if it 
 was a Page. There is some authorization logic skipped in Wicket that 
 would have run if it was a WebPage... Again this is not really a 
 problem for us, but it does bring up one question: Is it ok to use the 
 Wicket session from a Resource?

 Let me show some code:

 public class PnWebServiceResource extends AbstractResource {
   // ...

   @Override protected ResourceResponse newResourceResponse(Attributes
 aAttributes)
   {
 HttpServletRequest httpRequest = (HttpServletRequest) 
 aAttributes.getRequest().getContainerRequest();

 // Getting a Reader to the request inputstream works. The reader 
 can get the data of the post request.
 // We could not get this to work when we were extending WebPage 
 instead of AbstractResource...
 Reader reader = new
 InputStreamReader(aHttpServletRequest.getInputStream());

 WebSession session = WebSession.get();// -- Is this safe???

 // At this point we use the session. It seems to work for now, but 
 is this reliable?
 // Or maybe we are just 'lucky' that we get the right session here?
   }
 }

 The first lines show how we extend from AbstractResource instead of 
 from WebPage. Then, in newResourceResponse, we can get access to the 
 raw POST body from the HTTP request as long as we specify a mount path 
 without any parameters in it. However, a couple of lines later we 
 access the WebSession and we are wondering whether that is save?

 Also, are we maybe following the wrong approach? Is it possible to 
 make a WebPage that can access the raw POST body of the request? Or 
 maybe just get the PageParameters in a way that guarantees the order 
 is exactly how it was in the POST body? The reason the order is 
 important is that we are trying to do RPC to a Java method and in Java 
 the order of the method arguments is the only info we have at runtime. The 
 names of the arguments are not known.
 So we need to be sure that the parameters are sent to the Java method 
 in the same order as they were listed in the request. Afaik, Wicket's 
 PageParameters do not guarantee this...

 Any help would be greatly appreciated,

 -Stijn







AutoComplete stopped working in 6.12

2013-12-16 Thread Entropy
Converting from 1.4.7 to 6.12.  The page runs, but the autocomplete field has
stopped working.  It never produces an autocomplete, acting as if it were
simply a normal .  More strangely, no code in the containing panel was
changed, nor do I see anything in the migration guide about
AutoCompleteTextField.  I put the page into IE's debugger and no errors were
thrown.

Code snippet:
agcyCombo = new AutoCompleteTextFieldString(code, 
new PropertyModelString(saveCriteria, SearchString)) {
protected IteratorString getChoices(String input) {
if (Strings.isEmpty(input))  {
return Collections.EMPTY_LIST.iterator();
}

ListString curMatchingList = 
CodeFilter.filter(getAgcyFedList(),
input);
if (curMatchingList.size()  MAX_NUM_CHOICE) {
return curMatchingList.subList(0, 
MAX_NUM_CHOICE - 1).iterator();
}
return curMatchingList.iterator();
}
};

wmcAgcy.add(agcyCombo.setLabel(new ModelString(Agency)));
add(wmcAgcy);
return wmcAgcy;
}

HTML snippet:
fieldset id=req
label for=agcyAgency (required):/label
input id=agcy type=text wicket:id=code maxlength=30
value=Agency code and decode /
/fieldset

In the 1.4.7 version of the app, the input field looked like:
input name=agcyPanel:contAgcy:code class=ui-state-error id=code13
type=text maxLength=30 wicketFocusSet=true autocomplete=off
value=D/

In 6.12 it produces:
input name=agcyPanel:contAgcy:code class=ui-state-error id=code13
type=text maxLength=30 wicketFocusSet=true autocomplete=off
value=D/

So no apparent difference, but I don't see an onKeyPress event in either, so
i am not sure where to go to stick a breakpoint for that.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoComplete-stopped-working-in-6-12-tp4663047.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: AutoComplete stopped working in 6.12

2013-12-16 Thread Martin Grigorov
Hi,

Look for : Wicket.Ajax.get( ..., c: agcy, ...) in the generated html for
the page.
Also check whether an Ajax call is made when typing something in the input
field. Better use Firebug or Google Chrome's Dev Tools than IE.

Martin Grigorov
Wicket Training  Consulting


On Mon, Dec 16, 2013 at 9:13 PM, Entropy blmulholl...@gmail.com wrote:

 Converting from 1.4.7 to 6.12.  The page runs, but the autocomplete field
 has
 stopped working.  It never produces an autocomplete, acting as if it were
 simply a normal .  More strangely, no code in the containing panel was
 changed, nor do I see anything in the migration guide about
 AutoCompleteTextField.  I put the page into IE's debugger and no errors
 were
 thrown.

 Code snippet:
 agcyCombo = new AutoCompleteTextFieldString(code,
 new PropertyModelString(saveCriteria, SearchString)) {
 protected IteratorString getChoices(String input) {
 if (Strings.isEmpty(input))  {
 return Collections.EMPTY_LIST.iterator();
 }

 ListString curMatchingList =
 CodeFilter.filter(getAgcyFedList(),
 input);
 if (curMatchingList.size()  MAX_NUM_CHOICE) {
 return curMatchingList.subList(0,
 MAX_NUM_CHOICE - 1).iterator();
 }
 return curMatchingList.iterator();
 }
 };

 wmcAgcy.add(agcyCombo.setLabel(new ModelString(Agency)));
 add(wmcAgcy);
 return wmcAgcy;
 }

 HTML snippet:
 fieldset id=req
 label for=agcyAgency (required):/label
 input id=agcy type=text wicket:id=code maxlength=30
 value=Agency code and decode /
 /fieldset

 In the 1.4.7 version of the app, the input field looked like:
 input name=agcyPanel:contAgcy:code class=ui-state-error id=code13
 type=text maxLength=30 wicketFocusSet=true autocomplete=off
 value=D/

 In 6.12 it produces:
 input name=agcyPanel:contAgcy:code class=ui-state-error id=code13
 type=text maxLength=30 wicketFocusSet=true autocomplete=off
 value=D/

 So no apparent difference, but I don't see an onKeyPress event in either,
 so
 i am not sure where to go to stick a breakpoint for that.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AutoComplete-stopped-working-in-6-12-tp4663047.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: AutoComplete stopped working in 6.12

2013-12-16 Thread Entropy
Solved.

Not long after posting this I found
http://stackoverflow.com/questions/14481767/wicket-autocomplete-in-wicket-6-2-0
which explains that Wicket now includes it's own jQuery...which I'd read,
but hadn't made the connection to this problem.  When I took out the jQuery
base js include, the situation resolved itself.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoComplete-stopped-working-in-6-12-tp4663047p4663049.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



Component render flag inconsistency after exception during Ajax update

2013-12-16 Thread Sam Holmes
Hi
Am using Wicket 1.5.10.

In Component's render() method I note the finally block to ensure
afterRender() is run which always sets FLAG_RENDERING to false, regardless
of what might have occurred during render or afterRender().

However I can't see any similar cleanup code for the
FLAG_PREPARED_FOR_RENDER, set during the beforeRender phase.

Hence if an exception occurs after onBeforeRender() where this flag is set
true, but before markRendering() is called to unset it (and set
FLAG_RENDERING true), I end up with FLAG_PREPARED_FOR_RENDER still set. It
happens when I get an exception during loading an LDM in a child
component's onConfigure() method (model is being loaded so we can set the
child component's visibility based on the model value).

The next time I try and redraw the parent component by ajax I get
unexpected behaviour due to that flag being set.

Should FLAG_PREPARED_FOR_RENDER not get set to false in the finally block
of afterRender()? It seems to fix the problem I'm having...

Thanks
Sam


Re: a little question about add(new XComponent(id).setVisible(false))

2013-12-16 Thread Bas Gooren
I think it's fine to change the hierarchy in onBeforeRender(), as long 
as you do it before calling super.onBeforeRender(), since that calls OBR 
on the children of your panel.
And (you gotta love wicket), this is even made explicit in the source 
code of MarkupContainer#onBeforeRender():


/**
 * Called just before a component is rendered.
 * p
 * strongNOTE/strong: If you override this, you *must* call 
super.onBeforeRender() within

 * your implementation.
 *
 * Because this method is responsible for cascading {@link 
#onBeforeRender()} call to its
 * children it is strongly recommended that super call is made at 
the end of the override.

 * /p
 */

Before we had onInitialize, we would use onBeforeRender() and a boolean 
guard variable (boolean initialized) to accomplish the same thing.


Conclusion, it's fine, as long as you call super.onBeforeRender() at the 
end of your method.


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Decebal Suiu op 16-12-2013 16:50:

I tested with:

public class MyPanel extends Panel {

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

 @Override
 protected void onBeforeRender() {
super.onBeforeRender();

add(new MyLabel(l1, Label 1));
add(new MyLabel(l2, Label 2));
add(new MyLabel(l3, Label 3));
  }

}

in MyPanel, where MyLabel extends Label with the constructor contains and
debug message:

public MyLabel(String id, String label) {
super(id, label);

System.out.println(MyLabel.MyLabel(): + id);
}

And yes, the MyLabel constructed is not called if MyPanel is not visible.

My impression was that in onBeforeRender I cannot change the hierarchy (add
children).

The 100 children was a random number that show you that my panel contains
many components :)

Thanks,
Decebal




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-little-question-about-add-new-XComponent-id-setVisible-false-tp4663041p4663045.html
Sent from the Users forum mailing list archive at Nabble.com.

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





Re: Component render flag inconsistency after exception during Ajax update

2013-12-16 Thread Martin Grigorov
Hi,

Please create a quickstart/test case and attach it to a ticket in JIRA.
Thanks!

Martin Grigorov
Wicket Training  Consulting


On Tue, Dec 17, 2013 at 1:30 AM, Sam Holmes sbhol...@gmail.com wrote:

 Hi
 Am using Wicket 1.5.10.

 In Component's render() method I note the finally block to ensure
 afterRender() is run which always sets FLAG_RENDERING to false, regardless
 of what might have occurred during render or afterRender().

 However I can't see any similar cleanup code for the
 FLAG_PREPARED_FOR_RENDER, set during the beforeRender phase.

 Hence if an exception occurs after onBeforeRender() where this flag is set
 true, but before markRendering() is called to unset it (and set
 FLAG_RENDERING true), I end up with FLAG_PREPARED_FOR_RENDER still set. It
 happens when I get an exception during loading an LDM in a child
 component's onConfigure() method (model is being loaded so we can set the
 child component's visibility based on the model value).

 The next time I try and redraw the parent component by ajax I get
 unexpected behaviour due to that flag being set.

 Should FLAG_PREPARED_FOR_RENDER not get set to false in the finally block
 of afterRender()? It seems to fix the problem I'm having...

 Thanks
 Sam