Re: CheckGroup and back Button problem
I am having the same problem. Does anyone solve it? Thanks in advance. On Thu, May 8, 2008 at 7:59 AM, Steen Larsen steen...@gmail.com wrote: If I instead of item.getModel() for the Check, uses some PropertyModel that evaluates to a String identifier it works fine, but then only the identifier is saved, and not the object, which as I understand it should be the purpose. I haven't looked at the code, but I wander what uuid is exactly as the equals apparently fail on non basic types. Will have a look when I get the time. Thanks for the hint. /Steen 2008/5/8 Thomas Mäder tomlist0...@gmail.com: We seem to have a similar problem with a wizard page. We came across the following code in Check.onComponentTag(..) if (group.hasRawInput()) { final String[] input = group.getInputAsArray(); if (input != null) { for (int i = 0; i input.length; i++) { if (uuid.equals(input[i])) { tag.put(checked, checked); It looks like the Check component is checking for the existence of raw input, but then using the input from the current request (via getInputAsArray()) to render. Sounds fishy! I figure this could be related? Thomas On Wed, May 7, 2008 at 5:27 PM, Steen Larsen steen...@gmail.com wrote: Hi, I have made a CheckGroup vith a ListView of Check's than works fine, except that when it is submitted and I'm on the next page and want to go back through a Wicket Button (not the browsers back button), all the checks are empty even thouch the model behind still contains the selected obejcts. Here is the example code of the first page: public HomePage() { Order order = ((WicketSession) (Session.get())).getOrder(); if (order.getDigitalPackets() == null) order.setDigitalPackets(new ArrayListProduct()); System.err.println(LIST1 = + order.getDigitalPackets()); Form form = new DigitalOrderForm(digitalOrderForm); form.setModel(new CompoundPropertyModel(order)); add(form); ListProduct allProducts = new ArrayListProduct(); for (int i = 0; i 10; i++) { Product p = new Product(); p.setProductKey(i + ); p.setTotalPrice(new BigDecimal(100 + i)); p.setProductName(Product + i); allProducts.add(p); } CheckGroup group = new CheckGroup(digitalPackets); form.add(group); ListView products = new ListView(products, allProducts) { protected void populateItem(ListItem item) { item.add(new Check(check, item.getModel()).setEscapeModelStrings(false)); item.add(new Label(productName, new PropertyModel(item.getModel(), productName))); item.add(new Label(totalPrice, new PropertyModel(item.getModel(), totalPrice))); } }; group.add(products.setReuseItems(true)); } class DigitalOrderForm extends Form { DigitalOrderForm(String s) { super(s); } protected void onSubmit() { Order order = (Order) getModelObject(); System.err.println(LIST2 = + order.getDigitalPackets()); setResponsePage(PageTwo.class); } } The second page is just a back button like this: public PageTwo() { add(new Button(back) { public void onSubmit() { setResponsePage(HomePage.class); } }); } Anybody knows how to get the selected objects shown when you go back like that ? /Steen -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: CheckGroup and back Button problem
We seem to have a similar problem with a wizard page. We came across the following code in Check.onComponentTag(..) if (group.hasRawInput()) { final String[] input = group.getInputAsArray(); if (input != null) { for (int i = 0; i input.length; i++) { if (uuid.equals(input[i])) { tag.put(checked, checked); It looks like the Check component is checking for the existence of raw input, but then using the input from the current request (via getInputAsArray()) to render. Sounds fishy! I figure this could be related? Thomas On Wed, May 7, 2008 at 5:27 PM, Steen Larsen [EMAIL PROTECTED] wrote: Hi, I have made a CheckGroup vith a ListView of Check's than works fine, except that when it is submitted and I'm on the next page and want to go back through a Wicket Button (not the browsers back button), all the checks are empty even thouch the model behind still contains the selected obejcts. Here is the example code of the first page: public HomePage() { Order order = ((WicketSession) (Session.get())).getOrder(); if (order.getDigitalPackets() == null) order.setDigitalPackets(new ArrayListProduct()); System.err.println(LIST1 = + order.getDigitalPackets()); Form form = new DigitalOrderForm(digitalOrderForm); form.setModel(new CompoundPropertyModel(order)); add(form); ListProduct allProducts = new ArrayListProduct(); for (int i = 0; i 10; i++) { Product p = new Product(); p.setProductKey(i + ); p.setTotalPrice(new BigDecimal(100 + i)); p.setProductName(Product + i); allProducts.add(p); } CheckGroup group = new CheckGroup(digitalPackets); form.add(group); ListView products = new ListView(products, allProducts) { protected void populateItem(ListItem item) { item.add(new Check(check, item.getModel()).setEscapeModelStrings(false)); item.add(new Label(productName, new PropertyModel(item.getModel(), productName))); item.add(new Label(totalPrice, new PropertyModel(item.getModel(), totalPrice))); } }; group.add(products.setReuseItems(true)); } class DigitalOrderForm extends Form { DigitalOrderForm(String s) { super(s); } protected void onSubmit() { Order order = (Order) getModelObject(); System.err.println(LIST2 = + order.getDigitalPackets()); setResponsePage(PageTwo.class); } } The second page is just a back button like this: public PageTwo() { add(new Button(back) { public void onSubmit() { setResponsePage(HomePage.class); } }); } Anybody knows how to get the selected objects shown when you go back like that ? /Steen
Re: CheckGroup and back Button problem
If I instead of item.getModel() for the Check, uses some PropertyModel that evaluates to a String identifier it works fine, but then only the identifier is saved, and not the object, which as I understand it should be the purpose. I haven't looked at the code, but I wander what uuid is exactly as the equals apparently fail on non basic types. Will have a look when I get the time. Thanks for the hint. /Steen 2008/5/8 Thomas Mäder [EMAIL PROTECTED]: We seem to have a similar problem with a wizard page. We came across the following code in Check.onComponentTag(..) if (group.hasRawInput()) { final String[] input = group.getInputAsArray(); if (input != null) { for (int i = 0; i input.length; i++) { if (uuid.equals(input[i])) { tag.put(checked, checked); It looks like the Check component is checking for the existence of raw input, but then using the input from the current request (via getInputAsArray()) to render. Sounds fishy! I figure this could be related? Thomas On Wed, May 7, 2008 at 5:27 PM, Steen Larsen [EMAIL PROTECTED] wrote: Hi, I have made a CheckGroup vith a ListView of Check's than works fine, except that when it is submitted and I'm on the next page and want to go back through a Wicket Button (not the browsers back button), all the checks are empty even thouch the model behind still contains the selected obejcts. Here is the example code of the first page: public HomePage() { Order order = ((WicketSession) (Session.get())).getOrder(); if (order.getDigitalPackets() == null) order.setDigitalPackets(new ArrayListProduct()); System.err.println(LIST1 = + order.getDigitalPackets()); Form form = new DigitalOrderForm(digitalOrderForm); form.setModel(new CompoundPropertyModel(order)); add(form); ListProduct allProducts = new ArrayListProduct(); for (int i = 0; i 10; i++) { Product p = new Product(); p.setProductKey(i + ); p.setTotalPrice(new BigDecimal(100 + i)); p.setProductName(Product + i); allProducts.add(p); } CheckGroup group = new CheckGroup(digitalPackets); form.add(group); ListView products = new ListView(products, allProducts) { protected void populateItem(ListItem item) { item.add(new Check(check, item.getModel()).setEscapeModelStrings(false)); item.add(new Label(productName, new PropertyModel(item.getModel(), productName))); item.add(new Label(totalPrice, new PropertyModel(item.getModel(), totalPrice))); } }; group.add(products.setReuseItems(true)); } class DigitalOrderForm extends Form { DigitalOrderForm(String s) { super(s); } protected void onSubmit() { Order order = (Order) getModelObject(); System.err.println(LIST2 = + order.getDigitalPackets()); setResponsePage(PageTwo.class); } } The second page is just a back button like this: public PageTwo() { add(new Button(back) { public void onSubmit() { setResponsePage(HomePage.class); } }); } Anybody knows how to get the selected objects shown when you go back like that ? /Steen
CheckGroup and back Button problem
Hi, I have made a CheckGroup vith a ListView of Check's than works fine, except that when it is submitted and I'm on the next page and want to go back through a Wicket Button (not the browsers back button), all the checks are empty even thouch the model behind still contains the selected obejcts. Here is the example code of the first page: public HomePage() { Order order = ((WicketSession) (Session.get())).getOrder(); if (order.getDigitalPackets() == null) order.setDigitalPackets(new ArrayListProduct()); System.err.println(LIST1 = + order.getDigitalPackets()); Form form = new DigitalOrderForm(digitalOrderForm); form.setModel(new CompoundPropertyModel(order)); add(form); ListProduct allProducts = new ArrayListProduct(); for (int i = 0; i 10; i++) { Product p = new Product(); p.setProductKey(i + ); p.setTotalPrice(new BigDecimal(100 + i)); p.setProductName(Product + i); allProducts.add(p); } CheckGroup group = new CheckGroup(digitalPackets); form.add(group); ListView products = new ListView(products, allProducts) { protected void populateItem(ListItem item) { item.add(new Check(check, item.getModel()).setEscapeModelStrings(false)); item.add(new Label(productName, new PropertyModel(item.getModel(), productName))); item.add(new Label(totalPrice, new PropertyModel(item.getModel(), totalPrice))); } }; group.add(products.setReuseItems(true)); } class DigitalOrderForm extends Form { DigitalOrderForm(String s) { super(s); } protected void onSubmit() { Order order = (Order) getModelObject(); System.err.println(LIST2 = + order.getDigitalPackets()); setResponsePage(PageTwo.class); } } The second page is just a back button like this: public PageTwo() { add(new Button(back) { public void onSubmit() { setResponsePage(HomePage.class); } }); } Anybody knows how to get the selected objects shown when you go back like that ? /Steen