Re: Dynamically Generated Wicket UI

2010-01-27 Thread Josh Kamau
Hi;

I have looked at wicketwebbeans and it looks impressive. Does it support
wicket 1.4.5 ? the currently available download at googlecode is dated April
2009 .

On Thu, Jan 28, 2010 at 9:32 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> There are several projects out there that use those techniques to
> dynamically build UIs. Here
>
>
> http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.web/src/com/antilia/web/crud
>
> <
> http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.web/src/com/antilia/web/crud
> >I
> just built a CRUD component that generates everything out of an Entity.
> There is also
>
> http://wicketwebbeans.sourceforge.net/
>
> and somewhere on wicket-stuff a
> similar project.
>
> Best,
>
> Ernesto
>
> On Thu, Jan 28, 2010 at 7:03 AM, Josh Kamau  wrote:
>
> > Ernesto
> >
> > two dimensional repeaters? Let me check that out. never thought of it.
> > sounds like a good idea.
> >
> > Josh
> >
> > On Thu, Jan 28, 2010 at 8:56 AM, Ernesto Reinaldo Barreiro <
> > reier...@gmail.com> wrote:
> >
> > > Hi Josh,
> > >
> > >
> > > > How do i layout components dynamically in panel? i.e, there is not
> > markup
> > > > like a table to determine the position?
> > > >
> > > > Using repeaters?
> > >
> > >
> > > > if i write myPanel.add(field1)  and myPanel.add(field2) and i want
> the
> > > > fields to be laid out a) side by side b) one below the other, how do
> i
> > do
> > > > it
> > > > ?
> > > >
> > > >
> > > Using a two dimensional repeater?
> > >
> > > Best,
> > >
> > > Ernesto
> > >
> >
>


Re: wicket osgi (not Pax)

2010-01-27 Thread David Leangen


> I have seen OSGi successfully used with Wicket on production environments...
> With no problems with the serialization  issues you mentioned.

Yes, I am using pax-wicket for this.

What I meant was--as I understood from the original post--the person wanted to 
use wicket in OSGi without using a framework. If that is the case, it is a huge 
headache.


How does Antilla solve the problem? Do they have an elegant solution?



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



Re: AjaxSubmitLink + setResponsePage = feedback message problem on new page

2010-01-27 Thread Wayne Pope
thanks for the explanation. Works perfect now.

much appreciated.

On Wed, Jan 27, 2010 at 8:23 PM, Igor Vaynberg  wrote:
> the former
>
> -igor
>
> On Wed, Jan 27, 2010 at 10:45 AM, Riyad Kalla  wrote:
>> Igor, will FeedbackPanel correctly consume the messages from the session
>> scope and remove them -- or do you have to manually remove them once they've
>> been rendered?
>>
>> On Wed, Jan 27, 2010 at 11:42 AM, Igor Vaynberg 
>> wrote:
>>
>>> the problem is that there is a redirect between your calling info()
>>> and the feedback panel rendering. this is because thats the only way
>>> to do it in ajax  - issue a window.location=...
>>>
>>> if you are doing feedback messages across requests then use
>>> getsession().info(...)
>>>
>>> -igor
>>>
>>> On Wed, Jan 27, 2010 at 10:15 AM, Wayne Pope
>>>  wrote:
>>> > Hello all,
>>> >
>>> > Ok I cannot figure this one out.
>>> > I have a  Page that contains a Form with a AjaxSubmitLink:
>>> >
>>> > AjaxSubmitLink submitLink= new AjaxSubmitLink("submitLink") {
>>> >                       �...@override
>>> >                        protected void onSubmit(AjaxRequestTarget target,
>>> Form form) {
>>> >
>>> >
>>>  info(getString("admin.paymentSuccesfull"));
>>> >
>>>  setResponsePage(Application.get().getHomePage());
>>> >                        }
>>> >
>>> >                       �...@override
>>> >                        protected void onError(AjaxRequestTarget target,
>>> Form form) {
>>> >                                target.addComponent(feedback);
>>> >                        }
>>> >                };
>>> >
>>> >
>>> > On the home page I have a Panel that contains a FeedbackPanel - this
>>> > feedback panel works fine when using elements on that page.
>>> >
>>> > However when submitting the form and displaying the home page I get
>>> > the message in the logs:
>>> >
>>> > Component-targetted feedback message was left unrendered. This could
>>> > be because you are missing a FeedbackPanel on the page.  Message:
>>> > [FeedbackMessage message = " ...
>>> >
>>> > And the message is not displayed.
>>> >
>>> > Any ideas why wicket cannot find the feedback panel in the page? (its
>>> > definitely there in a Panel)
>>> >
>>> > feedback panel is added as such:
>>> > FeedbackPanel feedback = new FeedbackPanel("feedbackPanel");
>>> > add(feedback);
>>> >
>>> >
>>> > many thanks
>>> > Wayne
>>> >
>>> > -
>>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> > For additional commands, e-mail: users-h...@wicket.apache.org
>>> >
>>> >
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: wicket osgi (not Pax)

2010-01-27 Thread Ernesto Reinaldo Barreiro
Take a look at

http://code.google.com/p/antilia/source/browse/#svn/com.antilia.wstarter

http://code.google.com/p/antilia/source/browse/#svn/com.antilia.wstarter.demo



Best,

Ernesto

On Wed, Jan 27, 2010 at 11:31 PM, Jan Juno  wrote:

> Is there a How-to for OSGI and wicket, not from pax
> I managed to install jetty servlet api in equinox...now I have to install
> wicket somehow
>


Re: Dynamically Generated Wicket UI

2010-01-27 Thread Josh Kamau
Adrian;

Thanks. I will check it out

Josh

On Thu, Jan 28, 2010 at 9:24 AM, Adrian Wiesmann wrote:

> Hi there
>
>
> On 1/28/10 6:18 AM, Josh Kamau wrote:
>
>  How do i layout components dynamically in panel? i.e, there is not markup
>> like a table to determine the position?
>>
>> if i write myPanel.add(field1)  and myPanel.add(field2) and i want the
>> fields to be laid out a) side by side b) one below the other, how do i do
>> it
>> ?
>>
>
> As was mentioned before, with repeaters. I am working on Gozer - an OSS UI
> library - which is (the name already implies) heavily borrowing ideas from
> XUL. With Gozer you define your UI model within an XML file. The Wicket
> renderer takes this XML and builds an object tree consisting of Wicket based
> panels. Some of these panels are boxes. Boxes can either be of family xbox
> or vbox. Such boxes either repeat containing child-components horizontally
> or vertically. From what I read about your application, you will probably
> code something similar.
>
> This link contains some info:
>
> http://sourceforge.net/apps/trac/somap/wiki/GozerMain
>
> Talking about Swing there, but the concept is the same. The "form"
> containing the "formfield" in the sample image somewhere in the center of
> the page would be a xbox. Which means a simple vertical repeater which
> renders every formfield below the other. A formfield would be a simple panel
> in Wicket which inherits TextField from Wicket.
>
> Cheers,
> Adrian
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Dynamically Generated Wicket UI

2010-01-27 Thread Ernesto Reinaldo Barreiro
There are several projects out there that use those techniques to
dynamically build UIs. Here

http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.web/src/com/antilia/web/crud

I
just built a CRUD component that generates everything out of an Entity.
There is also

http://wicketwebbeans.sourceforge.net/

and somewhere on wicket-stuff a
similar project.

Best,

Ernesto

On Thu, Jan 28, 2010 at 7:03 AM, Josh Kamau  wrote:

> Ernesto
>
> two dimensional repeaters? Let me check that out. never thought of it.
> sounds like a good idea.
>
> Josh
>
> On Thu, Jan 28, 2010 at 8:56 AM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
>
> > Hi Josh,
> >
> >
> > > How do i layout components dynamically in panel? i.e, there is not
> markup
> > > like a table to determine the position?
> > >
> > > Using repeaters?
> >
> >
> > > if i write myPanel.add(field1)  and myPanel.add(field2) and i want the
> > > fields to be laid out a) side by side b) one below the other, how do i
> do
> > > it
> > > ?
> > >
> > >
> > Using a two dimensional repeater?
> >
> > Best,
> >
> > Ernesto
> >
>


Re: Dynamically Generated Wicket UI

2010-01-27 Thread Adrian Wiesmann

Hi there

On 1/28/10 6:18 AM, Josh Kamau wrote:


How do i layout components dynamically in panel? i.e, there is not markup
like a table to determine the position?

if i write myPanel.add(field1)  and myPanel.add(field2) and i want the
fields to be laid out a) side by side b) one below the other, how do i do it
?


As was mentioned before, with repeaters. I am working on Gozer - an OSS 
UI library - which is (the name already implies) heavily borrowing ideas 
from XUL. With Gozer you define your UI model within an XML file. The 
Wicket renderer takes this XML and builds an object tree consisting of 
Wicket based panels. Some of these panels are boxes. Boxes can either be 
of family xbox or vbox. Such boxes either repeat containing 
child-components horizontally or vertically. From what I read about your 
application, you will probably code something similar.


This link contains some info:

http://sourceforge.net/apps/trac/somap/wiki/GozerMain

Talking about Swing there, but the concept is the same. The "form" 
containing the "formfield" in the sample image somewhere in the center 
of the page would be a xbox. Which means a simple vertical repeater 
which renders every formfield below the other. A formfield would be a 
simple panel in Wicket which inherits TextField from Wicket.


Cheers,
Adrian

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



Re: wicket osgi (not Pax)

2010-01-27 Thread Ernesto Reinaldo Barreiro
I have seen OSGi successfully used with Wicket on production environments...
With no problems with the serialization  issues you mentioned.

Best,

Ernesto

On Thu, Jan 28, 2010 at 1:08 AM, David Leangen  wrote:

>
> > Is there a How-to for OSGI and wicket, not from pax
> > I managed to install jetty servlet api in equinox...now I have to install
> > wicket somehow
>
> Good luck!
>
> Due to serialization issues, it's not an easy problem to solve.
>
> I don't know of any "how-to". All I can say is that you have a long road
> ahead of you.
>
>
> Cheers,
> =David
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Dynamically Generated Wicket UI

2010-01-27 Thread Josh Kamau
Ernesto

two dimensional repeaters? Let me check that out. never thought of it.
sounds like a good idea.

Josh

On Thu, Jan 28, 2010 at 8:56 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Hi Josh,
>
>
> > How do i layout components dynamically in panel? i.e, there is not markup
> > like a table to determine the position?
> >
> > Using repeaters?
>
>
> > if i write myPanel.add(field1)  and myPanel.add(field2) and i want the
> > fields to be laid out a) side by side b) one below the other, how do i do
> > it
> > ?
> >
> >
> Using a two dimensional repeater?
>
> Best,
>
> Ernesto
>


Re: Dynamically Generated Wicket UI

2010-01-27 Thread Ernesto Reinaldo Barreiro
Hi Josh,


> How do i layout components dynamically in panel? i.e, there is not markup
> like a table to determine the position?
>
> Using repeaters?


> if i write myPanel.add(field1)  and myPanel.add(field2) and i want the
> fields to be laid out a) side by side b) one below the other, how do i do
> it
> ?
>
>
Using a two dimensional repeater?

Best,

Ernesto


Re: Dynamically Generated Wicket UI

2010-01-27 Thread Josh Kamau
Eelco;

How do i layout components dynamically in panel? i.e, there is not markup
like a table to determine the position?

if i write myPanel.add(field1)  and myPanel.add(field2) and i want the
fields to be laid out a) side by side b) one below the other, how do i do it
?



regards and thanks.

On Thu, Jan 28, 2010 at 8:11 AM, Eelco Hillenius
wrote:

> >The problem i have is
> > adding components to the Window/tab because there is not existing markup.
>
> Use panels as place holders. They can contain anything you like at
> runtime including nothing at all. Rinse and repeat.
>
> Eelco
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: wicket osgi (not Pax)

2010-01-27 Thread David Leangen

Hi Eelco,

>>> Is there a How-to for OSGI and wicket, not from pax
>>> I managed to install jetty servlet api in equinox...now I have to install
>>> wicket somehow
>> 
>> Good luck!
>> 
>> Due to serialization issues, it's not an easy problem to solve.
>> 
>> I don't know of any "how-to". All I can say is that you have a long road 
>> ahead of you.
> 
> Really? That's disappointing. I thought introducing IClassResolver way
> back when and asking OSGi people to work with that did the trick? How
> come it doesn't?

The IClassResolver does indeed make it possible, but not necessarily easy.

OSGi (or at least "proper" use thereof) is very strict in terms of which 
packages can be seen by which other packages. In many cases, the actual classes 
that are serialized are dependencies of dependencies of depen... you get the 
idea.

The problem that nobody appears to have take the time to solve in a 
satisfactory way is that upon deserialization, the actual classes being 
deserialized are not visible to the bundle that is doing the deserialization, 
so a CNFE is thrown.


Cheers,
=David



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



Re: Dynamically Generated Wicket UI

2010-01-27 Thread Josh Kamau
Sorry . Here it is.

 I would like to generate such a screen.
   I have window properties , Number of tabs on the window, fields in each
tab, position of the fields relative to each other e.g same line , field
length, field type e.g button, textfield, text area, check box etc.

Regards.

On Thu, Jan 28, 2010 at 7:57 AM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Cannot see attachments.. link?
>
> **
> Martin
>
> 2010/1/28 Josh Kamau :
> > Hello guys;
> >
> >  I have this enormous task of  creating a web based UI for our ERP (the
> > opensource Adempiere ERP). The UI is normally generated from the data
> store
> > in the Database. It includes Windows, Tabs , grids, trees etc. I know
> > windows , tabs and tree are not hard to generate. The problem i have is
> > adding components to the Window/tab because there is not existing markup.
> I
> > was thinking of using a RepeatingView and then adding components to it
> based
> > on the data from the Database. How ever, some components are arranged in
> the
> > same line while others are arranged one after the other. Attached is a
> > screenshot. Any ideas?
> >
> >
> > Regards.
> >
> > Josh
> >
>
> -
> 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: Dynamically Generated Wicket UI

2010-01-27 Thread Eelco Hillenius
>The problem i have is
> adding components to the Window/tab because there is not existing markup.

Use panels as place holders. They can contain anything you like at
runtime including nothing at all. Rinse and repeat.

Eelco

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



Re: wicket osgi (not Pax)

2010-01-27 Thread Eelco Hillenius
>> Is there a How-to for OSGI and wicket, not from pax
>> I managed to install jetty servlet api in equinox...now I have to install
>> wicket somehow
>
> Good luck!
>
> Due to serialization issues, it's not an easy problem to solve.
>
> I don't know of any "how-to". All I can say is that you have a long road 
> ahead of you.

Really? That's disappointing. I thought introducing IClassResolver way
back when and asking OSGi people to work with that did the trick? How
come it doesn't?

Cheers,

Eelco

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



Re: Dynamically Generated Wicket UI

2010-01-27 Thread Martin Makundi
Cannot see attachments.. link?

**
Martin

2010/1/28 Josh Kamau :
> Hello guys;
>
>  I have this enormous task of  creating a web based UI for our ERP (the
> opensource Adempiere ERP). The UI is normally generated from the data store
> in the Database. It includes Windows, Tabs , grids, trees etc. I know
> windows , tabs and tree are not hard to generate. The problem i have is
> adding components to the Window/tab because there is not existing markup. I
> was thinking of using a RepeatingView and then adding components to it based
> on the data from the Database. How ever, some components are arranged in the
> same line while others are arranged one after the other. Attached is a
> screenshot. Any ideas?
>
>
> Regards.
>
> Josh
>

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



Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
Sure it is overhead but he wanted to serve images from a folder not
under application
context root directory... Then, you have to serve them somehow? The options
I see are

1-A dedicated servlet?
2-With Wicket... and thats what the code shows... and for sure it can be
done in a simpler way...

A would try to use 1. As then Wicket would not have to serve the images.

Regards,

Ernesto

On Wed, Jan 27, 2010 at 9:43 PM, Riyad Kalla  wrote:

> This seems like adding a large amount of overhead to an image-heavy site
> (e.g. image blog or something), I thought I read in Wicket in Action that
> WicketFilter ignored HTTP requests for non-wicket resources now and passed
> them through to the underlying server to handle avoiding the need to remap
> your wicket URLs to something like /app/* so you could have /images and
> other resources under root and not have them go through the filter.
>
> Is this not the case?
>
> On Wed, Jan 27, 2010 at 1:38 PM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
>
> > Hi Francois,
> >
> > Following example works.
> >
> > 1-Create this class anywhere you want need.
> >
> > package com.antilia.demo.manager.img;
> >
> > import java.io.ByteArrayOutputStream;
> > import java.io.File;
> > import java.io.FileInputStream;
> > import java.io.IOException;
> > import java.io.InputStream;
> > import java.io.OutputStream;
> >
> > import org.apache.wicket.AttributeModifier;
> > import org.apache.wicket.markup.html.image.Image;
> > import org.apache.wicket.markup.html.image.resource.DynamicImageResource;
> > import org.apache.wicket.model.Model;
> > import org.apache.wicket.protocol.http.WebApplication;
> > import org.apache.wicket.protocol.http.WebRequestCycle;
> > import org.apache.wicket.util.file.Folder;
> >
> > /**
> >  *
> >  * @author  Ernesto Reinaldo Barreiro (reier...@gmail.com)
> >  *
> >  */
> > public abstract class MountedImageFactory {
> >
> >
> > static int BUFFER_SIZE = 10*1024;
> >  /**
> > * Copies one stream into the other..
> >  * @param is source Stream
> >  * @param os destination Stream
> >  * */
> > static public void copy(InputStream is, OutputStream os) throws
> IOException
> > {
> > byte[] buf = new byte[BUFFER_SIZE];
> > while (true) {
> > int tam = is.read(buf);
> > if (tam == -1) {
> > return;
> > }
> > os.write(buf, 0, tam);
> > }
> > }
> >  public static  byte[] bytes(InputStream is) throws IOException {
> > ByteArrayOutputStream out = new ByteArrayOutputStream();
> > copy(is, out);
> > return out.toByteArray();
> > }
> >  private static ImageFromFolderWebResource dynamicResource;
> >  private static class ImageFromFolderWebResource extends
> > DynamicImageResource {
> >  private static final long serialVersionUID = 1L;
> >
> >  private File folder;
> >  public ImageFromFolderWebResource(File folder, String mountPoint) {
> > this.folder = folder;
> > WebApplication.get().getSharedResources().add(mountPoint, this);
> > WebApplication.get().mountSharedResource(mountPoint,
> > "org.apache.wicket.Application/"+mountPoint);
> > }
> >  @Override
> > protected byte[] getImageData() {
> > try {
> > String name = WebRequestCycle.get().getRequest().getParameter("name");
> > return bytes(new FileInputStream(new File(getFolder().getAbsolutePath() +
> > System.getProperty("file.separator")+(name;
> > } catch (Exception e) {
> > //TODO: do this properly
> > return null;
> > }
> > }
> >
> > public File getFolder() {
> > return folder;
> > }
> > }
> >  /**
> >  * @return Folder from where images will be retrieved.
> >  */
> > protected abstract Folder getFolder();
> >  /**
> >  * @return the URL to mount the dynamic WEB resource.e.g.
> >  */
> > protected abstract String getMountPoint();
> >  public Image createImage(String id, final String imageName) {
> > if(dynamicResource == null)
> > dynamicResource = new ImageFromFolderWebResource(getFolder(),
> > getMountPoint());
> > return new Image(id) {
> >  private static final long serialVersionUID = 1L;
> >
> > @Override
> > protected void onBeforeRender() {
> > String path = WebRequestCycle.get().getRequest().getURL();
> > path = path.substring(0, path.indexOf('/'));
> > add(new AttributeModifier("src",true, new
> > Model("/"+path+"/"+getMountPoint()+"?name="+imageName)));
> > super.onBeforeRender();
> > }
> > };
> > }
> > }
> >
> > 2- Create a test page.
> >
> > import org.apache.wicket.markup.html.WebPage;
> > import org.apache.wicket.markup.html.image.Image;
> > import org.apache.wicket.util.file.Folder;
> >
> > /**
> >  * @author  Ernesto Reinaldo Barreiro (reier...@gmail.com)
> >  *
> >  */
> > public class TestPage extends WebPage {
> >
> > private static final MountedImageFactory IMAGE_FACTORY = new
> > MountedImageFactory() {
> >  @Override
> > protected Folder getFolder() {
> > return new Folder("C:/temp/images");
> > }
> >  @Override
> > protected String getMountPoint() {
> > return "test";
> > }
> >  };
> >  /**
> >  *
> >  */
> > public TestPage() {
> > Image img = IMAGE_FACTORY.createImage("img", "

Dynamically Generated Wicket UI

2010-01-27 Thread Josh Kamau
Hello guys;

 I have this enormous task of  creating a web based UI for our ERP (the
opensource Adempiere ERP). The UI is normally generated from the data store
in the Database. It includes Windows, Tabs , grids, trees etc. I know
windows , tabs and tree are not hard to generate. The problem i have is
adding components to the Window/tab because there is not existing markup. I
was thinking of using a RepeatingView and then adding components to it based
on the data from the Database. How ever, some components are arranged in the
same line while others are arranged one after the other. Attached is a
screenshot. Any ideas?


Regards.

Josh


Re: dynamically adding components to a ListView

2010-01-27 Thread zdmytriv

Yes, the problem was I had to create container and then on onClick()

target.addComponent(newInteractivePanel);

Thanks everybody



RaBe wrote:
> 
> looks as it has been solved here:
> 
> http://stackoverflow.com/questions/2114351/dynamically-add-components-to-listview-in-wicket/
> 
> bert
> 
> On Sun, Jan 24, 2010 at 13:04, Sven Meier  wrote:
>> Hi,
>>
>> you'll have to tell the request target which components to redraw:
>> Put your list inside a markupcontainer and use addComponent().
>>
>> Sven
>>
>> zdmytriv wrote:
>>>
>>> Could anyone tell me why it doesn't work? Thanks
>>>
>>> InteractivePanelPage.html
>>>
>>> 
>>>    
>>>         # Add Panel 
>>>    
>>>    
>>>        
>>>                
>>>    
>>> 
>>>
>>> InteractivePanelPage.java
>>>
>>> // ... imports
>>> public class InteractivePanelPage extends WebPage {
>>>    public LinkedList interactivePanels = new
>>> LinkedList();
>>>
>>>    private ListView interactiveList;
>>>
>>>    public InteractivePanelPage() {
>>>        add(new AjaxLink("addPanelLink") {
>>>            private static final long serialVersionUID = 1L;
>>>
>>>           �...@override
>>>            public void onClick(AjaxRequestTarget target) {
>>>                try {
>>>                    System.out.println("link clicked");
>>>
>>>                    InteractivePanel newInteractivePanel = new
>>> InteractivePanel(
>>>                            "interactiveItemPanel");
>>>                    newInteractivePanel.setOutputMarkupId(true);
>>>
>>>
>>> interactiveList.getModelObject().add(newInteractivePanel);
>>>                } catch (Exception e) {
>>>                    e.printStackTrace();
>>>                }
>>>            }
>>>        });
>>>
>>>        interactivePanels.add(new
>>> InteractivePanel("interactiveItemPanel"));
>>>
>>>        interactiveList = new
>>> ListView("interactiveListView",
>>>                new PropertyModel>(this,
>>> "interactivePanels")) {
>>>            private static final long serialVersionUID = 1L;
>>>
>>>           �...@override
>>>            protected void populateItem(ListItem item)
>>> {
>>>                item.add(item.getModelObject());
>>>            }
>>>        };
>>>
>>>        interactiveList.setOutputMarkupId(true);
>>>
>>>        add(interactiveList);
>>>    }
>>>
>>>    public List getInteractivePanels() {
>>>        return interactivePanels;
>>>    }
>>> }
>>>
>>> InteractivePanel.html
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> InteractivePanel.java
>>>
>>> // ... imports
>>> public class InteractivePanel extends Panel {
>>>    private static final long serialVersionUID = 1L;
>>>
>>>    public InteractivePanel(String id) {
>>>        super(id);
>>>
>>>        add(new Button("simpleButton"));
>>>    }
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> zkn wrote:
>>>

 On 22.01.2010, at 03:18, vasil.pup...@gmail.com wrote:


>
>
> http://old.nabble.com/dynamically-adding-components-to-a-ListView-td26626657.html
>
> In this post you said "You found it". Could you please post how did
> you
> do it?
>
> Zinovii
>

 in addPanel()

 replaced
 panels.add(panel);

 with

 panels.getModelObject().add(panel);





 On 04.12.2009, at 00:17, zkn wrote:


>
> found it.
>
> On 03.12.2009, at 16:19, zkn wrote:
>
>
>>
>> Hi,
>>
>> I'm trying to dynamically add components to an existing ListView but
>> I
>> can't figure out how to do that. Here is my case:
>>
>> MyPanelContainer  class with markup
>>
>> 
>>        
>>                
>>        
>>         # add panel 
>>
>> and here is how I create the container in the constructor of my page
>>
>> ..
>> MyPanelContainer container = new MyPanelContainer("panels_list_1");
>> List panels = new ArrayList();
>>
>> for (int j = 0; j < 5; j++) {
>>        MyPanel panel = new MyPanel("panel");
>>
>>        .
>>
>>        panels.add(panel);
>> .
>>
>>
>> container.add(new ListView("panels", panels) {
>>        protected void populateItem(ListItem item) {
>>                item.add( item.getModelObject());
>>        }
>> });
>> add(Container);
>> ..
>>
>> This works fine and I can see all  MyPanel inside the container.
>>
>> Now I'm trying to add another MyPanel inside the container on user
>> click. Here is the constructor of MyPanelContainer
>>
>> public MyPanelContainer(String id) {
>>                super(id);
>>                
>>                add(new Link("addPanel") {
>>                               �...@override
>>                                public void onClick() {
>>                                        addPanel();
>>                                }
>>
>>                        });
>> .
>>
>> ..
>> public void addPanel

Re: WicketByExample.com Contest

2010-01-27 Thread Andrew Lombardi
> Hey guys!  Hope everyone is having a wonderful time this week, and that 
> you're able to do some Wicket coding (I always find that puts me in a good 
> mood)!
> 
> I'm committed to seeing content on the WicketByExample.com website grow, and 
> in an effort to see that happen, we're going to hold a little contest:
> 
> 
> 
> For any blog articles posted between now and January 31st, 2010, the article 
> that receives the most comments will win a $100 iTunes Gift Card.
> 
> =
> 
> Assumptions
>   1. Those coming from the same IP addresses / same email address / 
> general spammy nature will not be counted toward the total
>   2. The effort should be to create a discussion, so first post, and 
> "great post" will not be counted toward the total
>   
> =
> 
> We have plans for some neat expansions to WicketByExample, if you have 
> development cycles you can donate toward helping in the development effort, 
> please contact me.
> 
> As always, if you have any thoughts on where you'd like to see the blog 
> going, let me know.


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | and...@mysticcoders.com
2321 E 4th St. Ste C-128, Santa Ana CA 92705
ofc: 714-816-4488
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: http://www.twitter.com/kinabalu

Eco-Tip: Printing e-mails is usually a waste.


This message is for the named person's use only. You must not, directly or 
indirectly, use,
 disclose, distribute, print, or copy any part of this message if you are not 
the intended recipient.




Re: wicket osgi (not Pax)

2010-01-27 Thread David Leangen

> Is there a How-to for OSGI and wicket, not from pax
> I managed to install jetty servlet api in equinox...now I have to install
> wicket somehow

Good luck!

Due to serialization issues, it's not an easy problem to solve.

I don't know of any "how-to". All I can say is that you have a long road ahead 
of you.


Cheers,
=David



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



Re: contributing components

2010-01-27 Thread Riyad Kalla
Sam,
Sounds like some pretty nice new components. Thanks for kicking those back
into the community.

R

On Jan 27, 2010 3:36 PM, "Sam Barrow"  wrote:

I sent an email to this list the other day about releasing my wicket
component toolkit. Anybody know how to go about this?

I have some pretty interesting stuff, like a BeanPanel that displays a
bean's properties in a nice looking key:value format, and another one
that allows you to upload a file, but is abstracted so you can upload
from a file on the local computer or from a web URL.

My most innovative one accepts a list of files as input, and
automatically generates zip/tar.gz/tar.bz2 archive downloads. I'm sure
these will come in useful to many. If anybody knows how to go about this
please let me know.


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


Re: contributing components

2010-01-27 Thread Igor Vaynberg
there is wicketstuff-minis...

-igor

On Wed, Jan 27, 2010 at 2:35 PM, Sam Barrow  wrote:
> I sent an email to this list the other day about releasing my wicket
> component toolkit. Anybody know how to go about this?
>
> I have some pretty interesting stuff, like a BeanPanel that displays a
> bean's properties in a nice looking key:value format, and another one
> that allows you to upload a file, but is abstracted so you can upload
> from a file on the local computer or from a web URL.
>
> My most innovative one accepts a list of files as input, and
> automatically generates zip/tar.gz/tar.bz2 archive downloads. I'm sure
> these will come in useful to many. If anybody knows how to go about this
> please let me know.
>
>
> -
> 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



contributing components

2010-01-27 Thread Sam Barrow
I sent an email to this list the other day about releasing my wicket
component toolkit. Anybody know how to go about this?

I have some pretty interesting stuff, like a BeanPanel that displays a
bean's properties in a nice looking key:value format, and another one
that allows you to upload a file, but is abstracted so you can upload
from a file on the local computer or from a web URL.

My most innovative one accepts a list of files as input, and
automatically generates zip/tar.gz/tar.bz2 archive downloads. I'm sure
these will come in useful to many. If anybody knows how to go about this
please let me know.


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



wicket osgi (not Pax)

2010-01-27 Thread Jan Juno
Is there a How-to for OSGI and wicket, not from pax
I managed to install jetty servlet api in equinox...now I have to install
wicket somehow


Re: Nasty problem with "component not found" and images [solved]

2010-01-27 Thread Steve Swinsburg
Thomas,

Thanks for this. I may also have run into the multiple page load you say this 
might cause. Can you confirm if this is the case for any  appreciate you giving a heads up on this issue. I was likely going to run
> into this at some point anyway ;)
> 
> On Wed, Jan 27, 2010 at 3:46 AM, Thomas Kappler
> wrote:
> 
>> Earlier this month, there was a thread [1] about the "component not found"
>> problem. I can't reply as I wasn't subscribed yet.
>> 
>> [1]
>> http://old.nabble.com/component-xxx:yyy:zzz-not-found-on-page-td27080437.html
>> 
>> I had the same problem recently, and after banging my head against the wall
>> for a while, I figured it out.
>> 
>> I had a RepeatingView on the page that consisted of markup containers that
>> had some text, and some had an external image (hosted outside the wicket
>> app), while others did not. I tought I'd keep it simple and wrote > src="#" /> in the markup. In the Java code, I'd check each item whether it
>> had a URL to an image, and if so, would insert that into the src attribute
>> with an AttributeModifier. For the other items it just stayed at the "#"
>> value.
>> 
>> Now "#" means "the current page", so for each page load, the browser would
>> actually load the page several times, once for each empty . When using
>> ajax, this completely breaks things, of course (besides making the page
>> really slow).
>> 
>> Note that an empty value of src="" can also cause this at least with older
>> versions of Firefox.
>> 
>> Making it so that the  markup is only inserted for actual images
>> solved it.
>> 
>> Maybe that was really dumb, but I thought I'd share it for the mailing list
>> archive.
>> 
>> -- Thomas
>> 
>> --
>> ---
>> Thomas Kapplerthomas.kapp...@isb-sib.ch
>> Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
>> CMU, rue Michel Servet 1
>> 1211 Geneve 4
>> Switzerland  http://www.uniprot.org
>> ---
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 



smime.p7s
Description: S/MIME cryptographic signature


Re: images not under the context root directory

2010-01-27 Thread Riyad Kalla
This seems like adding a large amount of overhead to an image-heavy site
(e.g. image blog or something), I thought I read in Wicket in Action that
WicketFilter ignored HTTP requests for non-wicket resources now and passed
them through to the underlying server to handle avoiding the need to remap
your wicket URLs to something like /app/* so you could have /images and
other resources under root and not have them go through the filter.

Is this not the case?

On Wed, Jan 27, 2010 at 1:38 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Hi Francois,
>
> Following example works.
>
> 1-Create this class anywhere you want need.
>
> package com.antilia.demo.manager.img;
>
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.OutputStream;
>
> import org.apache.wicket.AttributeModifier;
> import org.apache.wicket.markup.html.image.Image;
> import org.apache.wicket.markup.html.image.resource.DynamicImageResource;
> import org.apache.wicket.model.Model;
> import org.apache.wicket.protocol.http.WebApplication;
> import org.apache.wicket.protocol.http.WebRequestCycle;
> import org.apache.wicket.util.file.Folder;
>
> /**
>  *
>  * @author  Ernesto Reinaldo Barreiro (reier...@gmail.com)
>  *
>  */
> public abstract class MountedImageFactory {
>
>
> static int BUFFER_SIZE = 10*1024;
>  /**
> * Copies one stream into the other..
>  * @param is source Stream
>  * @param os destination Stream
>  * */
> static public void copy(InputStream is, OutputStream os) throws IOException
> {
> byte[] buf = new byte[BUFFER_SIZE];
> while (true) {
> int tam = is.read(buf);
> if (tam == -1) {
> return;
> }
> os.write(buf, 0, tam);
> }
> }
>  public static  byte[] bytes(InputStream is) throws IOException {
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> copy(is, out);
> return out.toByteArray();
> }
>  private static ImageFromFolderWebResource dynamicResource;
>  private static class ImageFromFolderWebResource extends
> DynamicImageResource {
>  private static final long serialVersionUID = 1L;
>
>  private File folder;
>  public ImageFromFolderWebResource(File folder, String mountPoint) {
> this.folder = folder;
> WebApplication.get().getSharedResources().add(mountPoint, this);
> WebApplication.get().mountSharedResource(mountPoint,
> "org.apache.wicket.Application/"+mountPoint);
> }
>  @Override
> protected byte[] getImageData() {
> try {
> String name = WebRequestCycle.get().getRequest().getParameter("name");
> return bytes(new FileInputStream(new File(getFolder().getAbsolutePath() +
> System.getProperty("file.separator")+(name;
> } catch (Exception e) {
> //TODO: do this properly
> return null;
> }
> }
>
> public File getFolder() {
> return folder;
> }
> }
>  /**
>  * @return Folder from where images will be retrieved.
>  */
> protected abstract Folder getFolder();
>  /**
>  * @return the URL to mount the dynamic WEB resource.e.g.
>  */
> protected abstract String getMountPoint();
>  public Image createImage(String id, final String imageName) {
> if(dynamicResource == null)
> dynamicResource = new ImageFromFolderWebResource(getFolder(),
> getMountPoint());
> return new Image(id) {
>  private static final long serialVersionUID = 1L;
>
> @Override
> protected void onBeforeRender() {
> String path = WebRequestCycle.get().getRequest().getURL();
> path = path.substring(0, path.indexOf('/'));
> add(new AttributeModifier("src",true, new
> Model("/"+path+"/"+getMountPoint()+"?name="+imageName)));
> super.onBeforeRender();
> }
> };
> }
> }
>
> 2- Create a test page.
>
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.image.Image;
> import org.apache.wicket.util.file.Folder;
>
> /**
>  * @author  Ernesto Reinaldo Barreiro (reier...@gmail.com)
>  *
>  */
> public class TestPage extends WebPage {
>
> private static final MountedImageFactory IMAGE_FACTORY = new
> MountedImageFactory() {
>  @Override
> protected Folder getFolder() {
> return new Folder("C:/temp/images");
> }
>  @Override
> protected String getMountPoint() {
> return "test";
> }
>  };
>  /**
>  *
>  */
> public TestPage() {
> Image img = IMAGE_FACTORY.createImage("img", "test.png");
> add(img);
> }
> }
>
> and the HTML markup
>
> 
> 
> 
>
> 
> 
>
> 3- If you place a "test.png" on your "C:/temp/images" then you should be
> able to see the image when you hit the page.
>
> Hope you can adapt this to your needs?
>
> Regards,
>
> Ernesto
>
> 2010/1/27 François Meillet 
>
> > Thank for yours posts.
> > I try the solutions, but  I can't figure out how to serve images as
> static
> > images.
> > F.
> >
> > Le 27 janv. 2010 à 16:10, Thomas Kappler a écrit :
> >
> > > On 01/27/10 15:57, Jonas wrote:
> > >> Have you tried the following:
> > >>
> > >> WebComponent image = new WebComponent("someWicketId");
> > >> image.add(new SimpleAttributeModifier("src", "http://.jpg";));
> > >> add(image);
> > >

Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
Hi Francois,

Following example works.

1-Create this class anywhere you want need.

package com.antilia.demo.manager.img;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.image.resource.DynamicImageResource;
import org.apache.wicket.model.Model;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebRequestCycle;
import org.apache.wicket.util.file.Folder;

/**
 *
 * @author  Ernesto Reinaldo Barreiro (reier...@gmail.com)
 *
 */
public abstract class MountedImageFactory {


static int BUFFER_SIZE = 10*1024;
 /**
 * Copies one stream into the other..
 * @param is source Stream
 * @param os destination Stream
 * */
static public void copy(InputStream is, OutputStream os) throws IOException
{
byte[] buf = new byte[BUFFER_SIZE];
while (true) {
int tam = is.read(buf);
if (tam == -1) {
return;
}
os.write(buf, 0, tam);
}
}
 public static  byte[] bytes(InputStream is) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
copy(is, out);
return out.toByteArray();
}
 private static ImageFromFolderWebResource dynamicResource;
 private static class ImageFromFolderWebResource extends
DynamicImageResource {
 private static final long serialVersionUID = 1L;

 private File folder;
 public ImageFromFolderWebResource(File folder, String mountPoint) {
this.folder = folder;
WebApplication.get().getSharedResources().add(mountPoint, this);
WebApplication.get().mountSharedResource(mountPoint,
"org.apache.wicket.Application/"+mountPoint);
}
 @Override
protected byte[] getImageData() {
try {
String name = WebRequestCycle.get().getRequest().getParameter("name");
return bytes(new FileInputStream(new File(getFolder().getAbsolutePath() +
System.getProperty("file.separator")+(name;
} catch (Exception e) {
//TODO: do this properly
return null;
}
}

public File getFolder() {
return folder;
}
}
 /**
 * @return Folder from where images will be retrieved.
 */
protected abstract Folder getFolder();
 /**
 * @return the URL to mount the dynamic WEB resource.e.g.
 */
protected abstract String getMountPoint();
 public Image createImage(String id, final String imageName) {
if(dynamicResource == null)
dynamicResource = new ImageFromFolderWebResource(getFolder(),
getMountPoint());
return new Image(id) {
 private static final long serialVersionUID = 1L;

@Override
protected void onBeforeRender() {
String path = WebRequestCycle.get().getRequest().getURL();
path = path.substring(0, path.indexOf('/'));
add(new AttributeModifier("src",true, new
Model("/"+path+"/"+getMountPoint()+"?name="+imageName)));
super.onBeforeRender();
}
};
}
}

2- Create a test page.

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.util.file.Folder;

/**
 * @author  Ernesto Reinaldo Barreiro (reier...@gmail.com)
 *
 */
public class TestPage extends WebPage {

private static final MountedImageFactory IMAGE_FACTORY = new
MountedImageFactory() {
 @Override
protected Folder getFolder() {
return new Folder("C:/temp/images");
}
 @Override
protected String getMountPoint() {
return "test";
}
 };
 /**
 *
 */
public TestPage() {
Image img = IMAGE_FACTORY.createImage("img", "test.png");
add(img);
}
}

and the HTML markup








3- If you place a "test.png" on your "C:/temp/images" then you should be
able to see the image when you hit the page.

Hope you can adapt this to your needs?

Regards,

Ernesto

2010/1/27 François Meillet 

> Thank for yours posts.
> I try the solutions, but  I can't figure out how to serve images as static
> images.
> F.
>
> Le 27 janv. 2010 à 16:10, Thomas Kappler a écrit :
>
> > On 01/27/10 15:57, Jonas wrote:
> >> Have you tried the following:
> >>
> >> WebComponent image = new WebComponent("someWicketId");
> >> image.add(new SimpleAttributeModifier("src", "http://.jpg";));
> >> add(image);
> >>
> >> with markup
> >>
> >> 
> >>
> >>
> >> that should work just fine...
> >>
> >> if you cannot hardcode the image url, you can use the following
> >> instead of SimpleAttributeModifier
> >> image.add(new AttributeModifier("src", true new
> >> AbstractReadOnlyModel() {
> >> public String getObject() {
> >> String url = ... (fetch the image url from anywhere else)
> >> // e.g. '/xxx//image893748.png'
> >> return url;
> >> }
> >> ));
> >
> > Or, maybe a bit nicer, encapsulate it into a component and let the URI
> come from a Model, as usual in Wicket:
> >
> > class ExternalImageUri
> > extends WebComponent
> > {
> >   public ExternalImageUri(String id, IModel uri)
> >   {
> >   super(id, uri);
> >   add(new AttributeModifier("src", true, uri));
> >   }
> >
> >   @Override
> >   prote

Re: AjaxSubmitLink + setResponsePage = feedback message problem on new page

2010-01-27 Thread Igor Vaynberg
the former

-igor

On Wed, Jan 27, 2010 at 10:45 AM, Riyad Kalla  wrote:
> Igor, will FeedbackPanel correctly consume the messages from the session
> scope and remove them -- or do you have to manually remove them once they've
> been rendered?
>
> On Wed, Jan 27, 2010 at 11:42 AM, Igor Vaynberg 
> wrote:
>
>> the problem is that there is a redirect between your calling info()
>> and the feedback panel rendering. this is because thats the only way
>> to do it in ajax  - issue a window.location=...
>>
>> if you are doing feedback messages across requests then use
>> getsession().info(...)
>>
>> -igor
>>
>> On Wed, Jan 27, 2010 at 10:15 AM, Wayne Pope
>>  wrote:
>> > Hello all,
>> >
>> > Ok I cannot figure this one out.
>> > I have a  Page that contains a Form with a AjaxSubmitLink:
>> >
>> > AjaxSubmitLink submitLink= new AjaxSubmitLink("submitLink") {
>> >                       �...@override
>> >                        protected void onSubmit(AjaxRequestTarget target,
>> Form form) {
>> >
>> >
>>  info(getString("admin.paymentSuccesfull"));
>> >
>>  setResponsePage(Application.get().getHomePage());
>> >                        }
>> >
>> >                       �...@override
>> >                        protected void onError(AjaxRequestTarget target,
>> Form form) {
>> >                                target.addComponent(feedback);
>> >                        }
>> >                };
>> >
>> >
>> > On the home page I have a Panel that contains a FeedbackPanel - this
>> > feedback panel works fine when using elements on that page.
>> >
>> > However when submitting the form and displaying the home page I get
>> > the message in the logs:
>> >
>> > Component-targetted feedback message was left unrendered. This could
>> > be because you are missing a FeedbackPanel on the page.  Message:
>> > [FeedbackMessage message = " ...
>> >
>> > And the message is not displayed.
>> >
>> > Any ideas why wicket cannot find the feedback panel in the page? (its
>> > definitely there in a Panel)
>> >
>> > feedback panel is added as such:
>> > FeedbackPanel feedback = new FeedbackPanel("feedbackPanel");
>> > add(feedback);
>> >
>> >
>> > many thanks
>> > Wayne
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

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



Re: AjaxSubmitLink + setResponsePage = feedback message problem on new page

2010-01-27 Thread Riyad Kalla
Igor, will FeedbackPanel correctly consume the messages from the session
scope and remove them -- or do you have to manually remove them once they've
been rendered?

On Wed, Jan 27, 2010 at 11:42 AM, Igor Vaynberg wrote:

> the problem is that there is a redirect between your calling info()
> and the feedback panel rendering. this is because thats the only way
> to do it in ajax  - issue a window.location=...
>
> if you are doing feedback messages across requests then use
> getsession().info(...)
>
> -igor
>
> On Wed, Jan 27, 2010 at 10:15 AM, Wayne Pope
>  wrote:
> > Hello all,
> >
> > Ok I cannot figure this one out.
> > I have a  Page that contains a Form with a AjaxSubmitLink:
> >
> > AjaxSubmitLink submitLink= new AjaxSubmitLink("submitLink") {
> >@Override
> >protected void onSubmit(AjaxRequestTarget target,
> Form form) {
> >
> >
>  info(getString("admin.paymentSuccesfull"));
> >
>  setResponsePage(Application.get().getHomePage());
> >}
> >
> >@Override
> >protected void onError(AjaxRequestTarget target,
> Form form) {
> >target.addComponent(feedback);
> >}
> >};
> >
> >
> > On the home page I have a Panel that contains a FeedbackPanel - this
> > feedback panel works fine when using elements on that page.
> >
> > However when submitting the form and displaying the home page I get
> > the message in the logs:
> >
> > Component-targetted feedback message was left unrendered. This could
> > be because you are missing a FeedbackPanel on the page.  Message:
> > [FeedbackMessage message = " ...
> >
> > And the message is not displayed.
> >
> > Any ideas why wicket cannot find the feedback panel in the page? (its
> > definitely there in a Panel)
> >
> > feedback panel is added as such:
> > FeedbackPanel feedback = new FeedbackPanel("feedbackPanel");
> > add(feedback);
> >
> >
> > many thanks
> > Wayne
> >
> > -
> > 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: AjaxSubmitLink + setResponsePage = feedback message problem on new page

2010-01-27 Thread Igor Vaynberg
the problem is that there is a redirect between your calling info()
and the feedback panel rendering. this is because thats the only way
to do it in ajax  - issue a window.location=...

if you are doing feedback messages across requests then use
getsession().info(...)

-igor

On Wed, Jan 27, 2010 at 10:15 AM, Wayne Pope
 wrote:
> Hello all,
>
> Ok I cannot figure this one out.
> I have a  Page that contains a Form with a AjaxSubmitLink:
>
> AjaxSubmitLink submitLink= new AjaxSubmitLink("submitLink") {
>                       �...@override
>                        protected void onSubmit(AjaxRequestTarget target, 
> Form form) {
>
>                                info(getString("admin.paymentSuccesfull"));
>                                
> setResponsePage(Application.get().getHomePage());
>                        }
>
>                       �...@override
>                        protected void onError(AjaxRequestTarget target, 
> Form form) {
>                                target.addComponent(feedback);
>                        }
>                };
>
>
> On the home page I have a Panel that contains a FeedbackPanel - this
> feedback panel works fine when using elements on that page.
>
> However when submitting the form and displaying the home page I get
> the message in the logs:
>
> Component-targetted feedback message was left unrendered. This could
> be because you are missing a FeedbackPanel on the page.  Message:
> [FeedbackMessage message = " ...
>
> And the message is not displayed.
>
> Any ideas why wicket cannot find the feedback panel in the page? (its
> definitely there in a Panel)
>
> feedback panel is added as such:
> FeedbackPanel feedback = new FeedbackPanel("feedbackPanel");
> add(feedback);
>
>
> many thanks
> Wayne
>
> -
> 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: AjaxSubmitLink + setResponsePage = feedback message problem on new page

2010-01-27 Thread Josh Kamau
Just wondering;

Isnt ajax supposed to update components on the same page? If you want to
redirect to another page then you dont need an ajax link.  Try with a normal
link. Then try without setting response page but add the feedback panel on
the same page.



On Wed, Jan 27, 2010 at 9:15 PM, Wayne Pope <
waynemailingli...@googlemail.com> wrote:

> Hello all,
>
> Ok I cannot figure this one out.
> I have a  Page that contains a Form with a AjaxSubmitLink:
>
> AjaxSubmitLink submitLink= new AjaxSubmitLink("submitLink") {
>@Override
>protected void onSubmit(AjaxRequestTarget target,
> Form form) {
>
>info(getString("admin.paymentSuccesfull"));
>
>  setResponsePage(Application.get().getHomePage());
>}
>
>@Override
>protected void onError(AjaxRequestTarget target,
> Form form) {
>target.addComponent(feedback);
>}
>};
>
>
> On the home page I have a Panel that contains a FeedbackPanel - this
> feedback panel works fine when using elements on that page.
>
> However when submitting the form and displaying the home page I get
> the message in the logs:
>
> Component-targetted feedback message was left unrendered. This could
> be because you are missing a FeedbackPanel on the page.  Message:
> [FeedbackMessage message = " ...
>
> And the message is not displayed.
>
> Any ideas why wicket cannot find the feedback panel in the page? (its
> definitely there in a Panel)
>
> feedback panel is added as such:
> FeedbackPanel feedback = new FeedbackPanel("feedbackPanel");
> add(feedback);
>
>
> many thanks
> Wayne
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


AjaxSubmitLink + setResponsePage = feedback message problem on new page

2010-01-27 Thread Wayne Pope
Hello all,

Ok I cannot figure this one out.
I have a  Page that contains a Form with a AjaxSubmitLink:

AjaxSubmitLink submitLink= new AjaxSubmitLink("submitLink") {
@Override
protected void onSubmit(AjaxRequestTarget target, 
Form form) {

info(getString("admin.paymentSuccesfull"));

setResponsePage(Application.get().getHomePage());
}

@Override
protected void onError(AjaxRequestTarget target, 
Form form) {
target.addComponent(feedback);
}
};


On the home page I have a Panel that contains a FeedbackPanel - this
feedback panel works fine when using elements on that page.

However when submitting the form and displaying the home page I get
the message in the logs:

Component-targetted feedback message was left unrendered. This could
be because you are missing a FeedbackPanel on the page.  Message:
[FeedbackMessage message = " ...

And the message is not displayed.

Any ideas why wicket cannot find the feedback panel in the page? (its
definitely there in a Panel)

feedback panel is added as such:
FeedbackPanel feedback = new FeedbackPanel("feedbackPanel");
add(feedback);


many thanks
Wayne

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



Re: Should Duration be deprecated?

2010-01-27 Thread nmelen...@getsense.com.ar
My keyboard on has 2 keys: 0 and 1.
Thats all i need when i code :)
NM

On Wed, Jan 27, 2010 at 10:32 AM, Chris Colman  wrote:

> While we're on the subject of 1's and 0's:
>
> Did you know this? There are only 10 types of people in the world: Those
> who understand binary, and those who don't.
>
>
> Back in my day we didn't need Tapestry, or Wicket or WebObjects, or even
> Servlets, or for that matter Java! We just coded in plain assembly
> language. And before that we had to just type in 1's and 0's. Sometimes
> we didn't even have 1's. I once had to code for an entire month,
> barefoot, in the dead of winter, using just 0's... but you didn't hear
> me complaining."
>
> Regards,
> Chris Colman
> Step Ahead Software
> http://stepaheadsoftware.com
>
> > you're thinking of windows.
> >
> >
> > Martijn Dashorst wrote:
> > >
> > > On Tue, Jan 26, 2010 at 10:00 PM, Igor Vaynberg
> > 
> > > wrote:
> > >> i thought they were all stored as electrons
> > >
> > > My vote goes to Umpalumpa's shifting miniature pumpkins on scales
> > >
> > > Martijn
> > >
> > > --
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: images not under the context root directory

2010-01-27 Thread François Meillet
Thank for yours posts.
I try the solutions, but  I can't figure out how to serve images as static 
images.
F.

Le 27 janv. 2010 à 16:10, Thomas Kappler a écrit :

> On 01/27/10 15:57, Jonas wrote:
>> Have you tried the following:
>> 
>> WebComponent image = new WebComponent("someWicketId");
>> image.add(new SimpleAttributeModifier("src", "http://.jpg";));
>> add(image);
>> 
>> with markup
>> 
>> 
>> 
>> 
>> that should work just fine...
>> 
>> if you cannot hardcode the image url, you can use the following
>> instead of SimpleAttributeModifier
>> image.add(new AttributeModifier("src", true new
>> AbstractReadOnlyModel() {
>> public String getObject() {
>> String url = ... (fetch the image url from anywhere else)
>> // e.g. '/xxx//image893748.png'
>> return url;
>> }
>> ));
> 
> Or, maybe a bit nicer, encapsulate it into a component and let the URI come 
> from a Model, as usual in Wicket:
> 
> class ExternalImageUri
> extends WebComponent
> {
>   public ExternalImageUri(String id, IModel uri)
>   {
>   super(id, uri);
>   add(new AttributeModifier("src", true, uri));
>   }
>   
>   @Override
>   protected void onComponentTag(ComponentTag tag)
>   {
>   super.onComponentTag(tag);
>   checkComponentTag(tag, "img");
>   }
> }
> 
> 
> This in the Wiki at 
> http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html.
> 
> 
> -- Thomas
> 
> 
>> 2010/1/27 François Meillet:
>>> Hi Wicketers,
>>> 
>>> I have a directory, /xxx/images with uploaded images, which is not under 
>>> the application context root directory.
>>> How can I serve them as static images ?
>>> 
>>> I tried the StaticImage class I found in the forum 
>>> (http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
>>> but it doesn't work for me. It just work if the image files are under the 
>>> context root directory.
>>> 
>>> Thanks for your help.
>>> 
>>> François
>>> 
>>> 
>>> 
>>> 
>>> -
>>> 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
>> 
> 
> 
> -- 
> ---
>  Thomas Kapplerthomas.kapp...@isb-sib.ch
>  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
>  CMU, rue Michel Servet 1
>  1211 Geneve 4
>  Switzerland  http://www.uniprot.org
> ---
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

François Meillet
fm...@meillet.com




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



starting tomcat in pre-integration-test haults build

2010-01-27 Thread Douglas Ferguson
If I start tomcat in the pre-integration-test the build hangs.

Why is this?

D/

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



Re: PasswordTextField not showing the value

2010-01-27 Thread Josh Kamau
Thanks alot.

The getResetPassword() did it.

I am doing a trivial application so i have not encrypted the password. May
be in a real application i will present a window for resetting password and
a separate window for editing the rest of the user details.

Regards.

On Wed, Jan 27, 2010 at 5:34 PM, Jonas  wrote:

> Not sure if that is actually the problem, but have you noticed
> PasswordTextField#getResetPassword() ?
> Its default value is 'true', meaning the value is cleared on every
> rendering.
>
> cheers,
> Jonas
>
> On Wed, Jan 27, 2010 at 3:19 PM, Josh Kamau  wrote:
> >  I have would like to edit an existing user's properties including the
> > password. However, all the other properties are appearing on their
> > corresponding fields except the password field. How do i make it appear?.
> >
> >   here is my component for editing users
> >
> >
> >   public class UserPanel extends Panel {
> >
> >/**
> > *
> > */
> >private static final long serialVersionUID = 3819937222116190372L;
> >
> >@Inject
> >private UserDao userDao;
> >
> >private TextField txtUsername;
> >
> >private PasswordTextField txtPassword;
> >
> >private PasswordTextField txtConfPassword;
> >
> >private User user;
> >
> >public UserPanel(String id, final User user) {
> >super(id);
> >
> >this.user = user;
> >
> >Form frmCreateUser = new Form("frmCreateUser") {
> >
> >/**
> > *
> > */
> >private static final long serialVersionUID = 1L;
> >
> >@Override
> >protected void onSubmit() {
> >if (user.getId() == null) {
> >Long id = userDao.saveUser(this.getModelObject());
> >info("User #" + id + " has been created");
> >} else {
> >Long id = userDao.updateUser(this.getModelObject());
> >info("User #" + id + " has been updated");
> >}
> >}
> >
> >};
> >
> >frmCreateUser.setModel(new Model(user));
> >add(frmCreateUser);
> >
> >txtUsername = new TextField("txtUsername",
> >new PropertyModel(user, "username"));
> >txtPassword = new PasswordTextField("txtPassword",
> >new PropertyModel(user, "password"));
> >txtConfPassword = new PasswordTextField("txtConfPassword",
> >new PropertyModel(user, "password"));
> >
> >
> >frmCreateUser.add(txtUsername);
> >frmCreateUser.add(txtPassword);
> >frmCreateUser.add(txtConfPassword);
> >}
> >
> >   the txtPassword and txtConfPassword fields display empty and so i have
> to
> > provide a password every time i edit the user.
> >
> >  Kindly help
> >
> > Regards
> >
> >  Josh
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: setRequired( false ) does not work on Integer textfield?

2010-01-27 Thread Thierry Leveque
Oups...
"always create "int" even if we specify "xs:integer" in the xsd..."

Of course!!!


Thierry


On Wed, Jan 27, 2010 at 10:55, Thierry Leveque  wrote:

> Yes... Thanks, that what I tought
>
> The problem is that my Pojo object is in fact created by Castor (from an
> xsd), and Castor always create "Integer" even if we specify "xs:int" in the
> xsd...
> Castor add a method call has[name of the field] to replace the null value.
>
> I guess I will have to write my own implementation of PropertyModel that
> will handle that.
>
> Thierry
>
>
>
> On Wed, Jan 27, 2010 at 10:50, Johan Compagner wrote:
>
>> an int (primitive) is always required.
>> We have to set it to something. cant be null
>> if you want to be able to not require it (so null) make it an Integer not
>> int
>>
>>
>> On Wed, Jan 27, 2010 at 16:48, Thierry Leveque 
>> wrote:
>>
>> > Here's what I have in my code:
>> >
>> > TextField lAdaptingHitCountThreshold = new TextField(
>> > "AdaptingHitCountThreshold", new PropertyModel( lMcsConfig,
>> > "Adapting.HitCountThreshold" ) );
>> >
>> > lForm.add( lAdaptingHitCountThreshold.setRequired( false ) );
>> >
>> > But when I execute it, if I do not enter any value in the field, I keep
>> > getting the message "Field 'AdaptingHitCountThreshold' is required."
>> > Why? In my pojo data object (lMcsConfig), the field is really of type
>> > "int",
>> > but it is not required.
>> >
>> > Is there a simple way to make this work? Other than creating my own
>> model?
>> >
>> > Thierry
>> >
>>
>
>


Re: Using AjaxFormSubmitBehavior

2010-01-27 Thread Anna Simbirtsev
I tried changing it to:
System.out.println("Inside contact link's onError is called:" +
contact_form.getModelObject().getContactId());

It prints null.:(

On Wed, Jan 27, 2010 at 5:28 AM, Pedro Santos  wrote:

> How can you make sure that contact_data references to the same data on your
> contact_form model? I guess that is why you having troubles. For instance,
> you are creating the text field using
> new RequiredTextField("contact_id")
> it leads me guess you are using a CompoundPropertyModel on
> your contact_form.
> So change the lines on you onSubmit implementation from:
> System.out.println("Inside contact link's onSubmit is called:" +
> contact_data.getContactId());
> to
> System.out.println("Inside contact link's onSubmit is called:" +
>
> referenceToTheModeWhereIHaveTheContactUsedByForm.getObject().getContactId());
> probably referenceToTheModeWhereIHaveTheContactUsedByForm can be:
> contact_form.getDefaultModel()
>
> On Tue, Jan 26, 2010 at 5:26 PM, Anna Simbirtsev  >wrote:
>
> > I changed it to use AjaxButton instead of AjaxFormSubmitBehavior and it
> > still does not see the values.
> >
> >  > wicket:id="contact_submitbutton" class="button"/>SUBMIT
> >
> > FeedbackPanel contact_feedback = new FeedbackPanel("popup_feedback", new
> > ContainerFeedbackMessageFilter(contact_form));
> >
> > contact_feedback.setOutputMarkupId(true);
> >
> > contact_form.add(new RequiredTextField("contact_id"));
> >
> > contact_form.add(new AjaxButton("contact_submitbutton") {
> > private static final long serialVersionUID =
> > 4192112499051970470L;
> >
> > @Override
> >protected void onSubmit(AjaxRequestTarget target, Form form)
> > {
> >System.out.println("Inside contact link's onSubmit is
> > called:" + contact_data.getContactId());
> >
> >}
> >
> >@SuppressWarnings("unchecked")
> >@Override
> >protected void onError(AjaxRequestTarget target, Form form)
> >{
> >System.out.println("Inside contact link's onError is
> > called.");
> >target.addComponent(contact_feedback);
> >}
> >});
> >
> > On Tue, Jan 26, 2010 at 2:05 PM, Pedro Santos 
> wrote:
> >
> > > Even using AjaxButton? Can you send the code?
> > >
> > > On Tue, Jan 26, 2010 at 4:55 PM, Anna Simbirtsev <
> asimbirt...@gmail.com
> > > >wrote:
> > >
> > > > Thanks, now in my feedback it displays errors that all required
> fields
> > > are
> > > > empty. But the problem is, that even if I put the values in those
> > fields
> > > it
> > > > still does not see them and gives the same errors in the feedback
> > panel.
> > > >
> > > > On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos 
> > > wrote:
> > > >
> > > > > Take a look at the AjaxButton if you need an asynchronous submit,
> and
> > > > > implement your onError handlers with:
> > > > >
> > > > > target.addComponent(
> > > > myFeedbackPanelThatMabyWillShowSomeMessageIfGetUpdated
> > > > > );
> > > > >
> > > > > On Tue, Jan 26, 2010 at 4:34 PM, Anna Simbirtsev <
> > > asimbirt...@gmail.com
> > > > > >wrote:
> > > > >
> > > > > > I have, but maybe its incorrect.
> > > > > >
> > > > > > 
> > > > > >
> > > > > > contact_form.add(new FeedbackPanel("popup_feedback", new
> > > > > > ContainerFeedbackMessageFilter(contact_form) ));
> > > > > >
> > > > > > On Tue, Jan 26, 2010 at 1:32 PM, Pedro Santos <
> pedros...@gmail.com
> > >
> > > > > wrote:
> > > > > >
> > > > > > > Do you have an feedback panel on the model?  If don't, add one
> > and
> > > > see
> > > > > if
> > > > > > > your form don't pass in some validation like on required field.
> > > > > > >
> > > > > > > On Tue, Jan 26, 2010 at 4:07 PM, Anna Simbirtsev <
> > > > > asimbirt...@gmail.com
> > > > > > > >wrote:
> > > > > > >
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > I have a modal window that is used to create a contact and
> > needs
> > > to
> > > > > > > submit
> > > > > > > > data to the server once submit button is called.
> > > > > > > >
> > > > > > > > The submit button is defined as follows:
> > > > > > > >
> > > > > > > >  > > > > type="submit">SUBMIT
> > > > > > > >
> > > > > > > >
> > > > > > > > contact_form.add(new Button("contact_submitbutton").add(new
> > > > > > > > AjaxFormSubmitBehavior(contact_form, "onclick") {
> > > > > > > >
> > > > > > > >private static final long serialVersionUID =
> > > > > > > > 4192112499051970470L;
> > > > > > > >
> > > > > > > >protected void onSubmit(AjaxRequestTarget target)
> > > > > > > >{
> > > > > > > >System.out.println("Inside contact link's
> > onSubmit
> > > > is
> > > > > > > > called" );
> > > > > > > >
> > > > > > > >}
> > > > > > > >
> > > > > > > >@Override
> > > > > > > >protected void onError(AjaxRequestTarget target)
> > > > > > > >{
> > > > > > > >}
> > > > > > > >}));
> > > > > >

Re: setRequired( false ) does not work on Integer textfield?

2010-01-27 Thread Thierry Leveque
Yes... Thanks, that what I tought

The problem is that my Pojo object is in fact created by Castor (from an
xsd), and Castor always create "Integer" even if we specify "xs:int" in the
xsd...
Castor add a method call has[name of the field] to replace the null value.

I guess I will have to write my own implementation of PropertyModel that
will handle that.

Thierry


On Wed, Jan 27, 2010 at 10:50, Johan Compagner  wrote:

> an int (primitive) is always required.
> We have to set it to something. cant be null
> if you want to be able to not require it (so null) make it an Integer not
> int
>
>
> On Wed, Jan 27, 2010 at 16:48, Thierry Leveque  wrote:
>
> > Here's what I have in my code:
> >
> > TextField lAdaptingHitCountThreshold = new TextField(
> > "AdaptingHitCountThreshold", new PropertyModel( lMcsConfig,
> > "Adapting.HitCountThreshold" ) );
> >
> > lForm.add( lAdaptingHitCountThreshold.setRequired( false ) );
> >
> > But when I execute it, if I do not enter any value in the field, I keep
> > getting the message "Field 'AdaptingHitCountThreshold' is required."
> > Why? In my pojo data object (lMcsConfig), the field is really of type
> > "int",
> > but it is not required.
> >
> > Is there a simple way to make this work? Other than creating my own
> model?
> >
> > Thierry
> >
>


Re: Nasty problem with "component not found" and images [solved]

2010-01-27 Thread Riyad Kalla
Thomas, as someone who frequently likes trying "really dumb things" -- I
appreciate you giving a heads up on this issue. I was likely going to run
into this at some point anyway ;)

On Wed, Jan 27, 2010 at 3:46 AM, Thomas Kappler
wrote:

> Earlier this month, there was a thread [1] about the "component not found"
> problem. I can't reply as I wasn't subscribed yet.
>
> [1]
> http://old.nabble.com/component-xxx:yyy:zzz-not-found-on-page-td27080437.html
>
> I had the same problem recently, and after banging my head against the wall
> for a while, I figured it out.
>
> I had a RepeatingView on the page that consisted of markup containers that
> had some text, and some had an external image (hosted outside the wicket
> app), while others did not. I tought I'd keep it simple and wrote  src="#" /> in the markup. In the Java code, I'd check each item whether it
> had a URL to an image, and if so, would insert that into the src attribute
> with an AttributeModifier. For the other items it just stayed at the "#"
> value.
>
> Now "#" means "the current page", so for each page load, the browser would
> actually load the page several times, once for each empty . When using
> ajax, this completely breaks things, of course (besides making the page
> really slow).
>
> Note that an empty value of src="" can also cause this at least with older
> versions of Firefox.
>
> Making it so that the  markup is only inserted for actual images
> solved it.
>
> Maybe that was really dumb, but I thought I'd share it for the mailing list
> archive.
>
> -- Thomas
>
> --
> ---
>  Thomas Kapplerthomas.kapp...@isb-sib.ch
>  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
>  CMU, rue Michel Servet 1
>  1211 Geneve 4
>  Switzerland  http://www.uniprot.org
> ---
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: setRequired( false ) does not work on Integer textfield?

2010-01-27 Thread Johan Compagner
an int (primitive) is always required.
We have to set it to something. cant be null
if you want to be able to not require it (so null) make it an Integer not
int


On Wed, Jan 27, 2010 at 16:48, Thierry Leveque  wrote:

> Here's what I have in my code:
>
> TextField lAdaptingHitCountThreshold = new TextField(
> "AdaptingHitCountThreshold", new PropertyModel( lMcsConfig,
> "Adapting.HitCountThreshold" ) );
>
> lForm.add( lAdaptingHitCountThreshold.setRequired( false ) );
>
> But when I execute it, if I do not enter any value in the field, I keep
> getting the message "Field 'AdaptingHitCountThreshold' is required."
> Why? In my pojo data object (lMcsConfig), the field is really of type
> "int",
> but it is not required.
>
> Is there a simple way to make this work? Other than creating my own model?
>
> Thierry
>


setRequired( false ) does not work on Integer textfield?

2010-01-27 Thread Thierry Leveque
Here's what I have in my code:

TextField lAdaptingHitCountThreshold = new TextField(
"AdaptingHitCountThreshold", new PropertyModel( lMcsConfig,
"Adapting.HitCountThreshold" ) );

lForm.add( lAdaptingHitCountThreshold.setRequired( false ) );

But when I execute it, if I do not enter any value in the field, I keep
getting the message "Field 'AdaptingHitCountThreshold' is required."
Why? In my pojo data object (lMcsConfig), the field is really of type "int",
but it is not required.

Is there a simple way to make this work? Other than creating my own model?

Thierry


Re: images not under the context root directory

2010-01-27 Thread Thomas Kappler

On 01/27/10 15:57, Jonas wrote:

Have you tried the following:

WebComponent image = new WebComponent("someWicketId");
image.add(new SimpleAttributeModifier("src", "http://.jpg";));
add(image);

with markup




that should work just fine...

if you cannot hardcode the image url, you can use the following
instead of SimpleAttributeModifier
image.add(new AttributeModifier("src", true new
AbstractReadOnlyModel() {
 public String getObject() {
 String url = ... (fetch the image url from anywhere else)
 // e.g. '/xxx//image893748.png'
 return url;
 }
));


Or, maybe a bit nicer, encapsulate it into a component and let the URI 
come from a Model, as usual in Wicket:


class ExternalImageUri
extends WebComponent
{
public ExternalImageUri(String id, IModel uri)
{
super(id, uri);
add(new AttributeModifier("src", true, uri));
}

@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
checkComponentTag(tag, "img");
}
}


This in the Wiki at 
http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html.



-- Thomas



2010/1/27 François Meillet:

Hi Wicketers,

I have a directory, /xxx/images with uploaded images, which is not under the 
application context root directory.
How can I serve them as static images ?

I tried the StaticImage class I found in the forum 
(http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
but it doesn't work for me. It just work if the image files are under the 
context root directory.

Thanks for your help.

François




-
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




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
nice trick with the alias... was what I intended to say.

On Wed, Jan 27, 2010 at 4:00 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> this trick with the alias... I has done it mounting a dynamic WebResource
> and streaming back the contents myself. Like in here
>
>
> http://code.google.com/p/antilia/source/browse/trunk/com.antilia.demo.manager/src/com/antilia/demo/manager/img/MyImageMountedFactory.java
>
> Best,
>
> Ernesto
>
>
>
>
>
>
>
> On Wed, Jan 27, 2010 at 3:45 PM, Don Ferguson wrote:
>
>> I used this suggestion to serve images out of a database, and it worked
>> very well:
>>
>>
>> http://dotev.blogspot.com/2009/11/serving-images-and-other-resources-with.html
>>
>>
>>
>> On Jan 27, 2010, at 5:56 AM, Ernesto Reinaldo Barreiro wrote:
>>
>>  Just a couple of ideas...
>>>
>>> -Use a servlet to serve them? You don´t need Wicket for this... and
>>> combine
>>> this with simpleimage?
>>> -With Wicket mount a dynamic web-resource and combine this with
>>> simpleimage?
>>>
>>>
>>> Ernesto
>>>
>>> 2010/1/27 François Meillet 
>>>
>>>  Hi Wicketers,

 I have a directory, /xxx/images with uploaded images, which is not under
 the application context root directory.
 How can I serve them as static images ?

 I tried the StaticImage class I found in the forum (
 http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
 but it doesn't work for me. It just work if the image files are under
 the
 context root directory.

 Thanks for your help.

 François




 -
 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: Serialization test

2010-01-27 Thread Jonas
You can't verify for any IModel if it has been detached, but what works
fine is e.g. checking all LoadableDetachableModel subclasses.
You have to rely on specific IModel implementations that have some kind
of API to check if they have been detached, just like
LoadableDetachableModel#isAttached()

On Wed, Jan 27, 2010 at 3:51 PM, pieter claassen  wrote:
> I want to test the following:
> 1. Whether I have any private members stored on my pages that are not
> a primitive java type, or IModel
> 2. If they are IModels, that I do call onDetach() on them.
>
> Reflection helps me to answer the 1st question but the second one baffles
> me. Any tips on how to verify that I am calling onDetach() on all privately
> stored  IModels?
>
> I notice that Martijn has a presentation on the subject here, but there is
> just not enough code in there for me to get to solution myself.
> http://www.slideshare.net/dashorst/keep-your-wicket-application-in-production
>
> Thanks,
> Pieter
>

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



Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
this trick with the alias... I has done it mounting a dynamic WebResource
and streaming back the contents myself. Like in here

http://code.google.com/p/antilia/source/browse/trunk/com.antilia.demo.manager/src/com/antilia/demo/manager/img/MyImageMountedFactory.java

Best,

Ernesto






On Wed, Jan 27, 2010 at 3:45 PM, Don Ferguson wrote:

> I used this suggestion to serve images out of a database, and it worked
> very well:
>
>
> http://dotev.blogspot.com/2009/11/serving-images-and-other-resources-with.html
>
>
>
> On Jan 27, 2010, at 5:56 AM, Ernesto Reinaldo Barreiro wrote:
>
>  Just a couple of ideas...
>>
>> -Use a servlet to serve them? You don´t need Wicket for this... and
>> combine
>> this with simpleimage?
>> -With Wicket mount a dynamic web-resource and combine this with
>> simpleimage?
>>
>>
>> Ernesto
>>
>> 2010/1/27 François Meillet 
>>
>>  Hi Wicketers,
>>>
>>> I have a directory, /xxx/images with uploaded images, which is not under
>>> the application context root directory.
>>> How can I serve them as static images ?
>>>
>>> I tried the StaticImage class I found in the forum (
>>> http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
>>> but it doesn't work for me. It just work if the image files are under the
>>> context root directory.
>>>
>>> Thanks for your help.
>>>
>>> François
>>>
>>>
>>>
>>>
>>> -
>>> 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: images not under the context root directory

2010-01-27 Thread Jonas
Have you tried the following:

WebComponent image = new WebComponent("someWicketId");
image.add(new SimpleAttributeModifier("src", "http://.jpg";));
add(image);

with markup




that should work just fine...

if you cannot hardcode the image url, you can use the following
instead of SimpleAttributeModifier
image.add(new AttributeModifier("src", true new
AbstractReadOnlyModel() {
public String getObject() {
String url = ... (fetch the image url from anywhere else)
// e.g. '/xxx//image893748.png'
return url;
}
));



2010/1/27 François Meillet :
> Hi Wicketers,
>
> I have a directory, /xxx/images with uploaded images, which is not under the 
> application context root directory.
> How can I serve them as static images ?
>
> I tried the StaticImage class I found in the forum 
> (http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
> but it doesn't work for me. It just work if the image files are under the 
> context root directory.
>
> Thanks for your help.
>
> François
>
>
>
>
> -
> 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: Serialization test

2010-01-27 Thread Marat Radchenko
Force your servlet container to serialize sessions after each request
and add non-serializable field to objects that you don't want to be
serialized.

2010/1/27 pieter claassen :
> I want to test the following:
> 1. Whether I have any private members stored on my pages that are not
> a primitive java type, or IModel
> 2. If they are IModels, that I do call onDetach() on them.
>
> Reflection helps me to answer the 1st question but the second one baffles
> me. Any tips on how to verify that I am calling onDetach() on all privately
> stored  IModels?
>
> I notice that Martijn has a presentation on the subject here, but there is
> just not enough code in there for me to get to solution myself.
> http://www.slideshare.net/dashorst/keep-your-wicket-application-in-production
>
> Thanks,
> Pieter
>

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



Serialization test

2010-01-27 Thread pieter claassen
I want to test the following:
1. Whether I have any private members stored on my pages that are not
a primitive java type, or IModel
2. If they are IModels, that I do call onDetach() on them.

Reflection helps me to answer the 1st question but the second one baffles
me. Any tips on how to verify that I am calling onDetach() on all privately
stored  IModels?

I notice that Martijn has a presentation on the subject here, but there is
just not enough code in there for me to get to solution myself.
http://www.slideshare.net/dashorst/keep-your-wicket-application-in-production

Thanks,
Pieter


Re: images not under the context root directory

2010-01-27 Thread Don Ferguson
I used this suggestion to serve images out of a database, and it  
worked very well:


http://dotev.blogspot.com/2009/11/serving-images-and-other-resources-with.html


On Jan 27, 2010, at 5:56 AM, Ernesto Reinaldo Barreiro wrote:


Just a couple of ideas...

-Use a servlet to serve them? You don´t need Wicket for this... and  
combine

this with simpleimage?
-With Wicket mount a dynamic web-resource and combine this with  
simpleimage?



Ernesto

2010/1/27 François Meillet 


Hi Wicketers,

I have a directory, /xxx/images with uploaded images, which is not  
under

the application context root directory.
How can I serve them as static images ?

I tried the StaticImage class I found in the forum (
http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
but it doesn't work for me. It just work if the image files are  
under the

context root directory.

Thanks for your help.

François




-
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: PasswordTextField not showing the value

2010-01-27 Thread Jonas
Not sure if that is actually the problem, but have you noticed
PasswordTextField#getResetPassword() ?
Its default value is 'true', meaning the value is cleared on every rendering.

cheers,
Jonas

On Wed, Jan 27, 2010 at 3:19 PM, Josh Kamau  wrote:
>  I have would like to edit an existing user's properties including the
> password. However, all the other properties are appearing on their
> corresponding fields except the password field. How do i make it appear?.
>
>   here is my component for editing users
>
>
>   public class UserPanel extends Panel {
>
>    /**
>     *
>     */
>    private static final long serialVersionUID = 3819937222116190372L;
>
>   �...@inject
>    private UserDao userDao;
>
>    private TextField txtUsername;
>
>    private PasswordTextField txtPassword;
>
>    private PasswordTextField txtConfPassword;
>
>    private User user;
>
>    public UserPanel(String id, final User user) {
>        super(id);
>
>        this.user = user;
>
>        Form frmCreateUser = new Form("frmCreateUser") {
>
>            /**
>             *
>             */
>            private static final long serialVersionUID = 1L;
>
>           �...@override
>            protected void onSubmit() {
>                if (user.getId() == null) {
>                    Long id = userDao.saveUser(this.getModelObject());
>                    info("User #" + id + " has been created");
>                } else {
>                    Long id = userDao.updateUser(this.getModelObject());
>                    info("User #" + id + " has been updated");
>                }
>            }
>
>        };
>
>        frmCreateUser.setModel(new Model(user));
>        add(frmCreateUser);
>
>        txtUsername = new TextField("txtUsername",
>                new PropertyModel(user, "username"));
>        txtPassword = new PasswordTextField("txtPassword",
>                new PropertyModel(user, "password"));
>        txtConfPassword = new PasswordTextField("txtConfPassword",
>                new PropertyModel(user, "password"));
>
>
>        frmCreateUser.add(txtUsername);
>        frmCreateUser.add(txtPassword);
>        frmCreateUser.add(txtConfPassword);
>    }
>
>   the txtPassword and txtConfPassword fields display empty and so i have to
> provide a password every time i edit the user.
>
>  Kindly help
>
> Regards
>
>  Josh
>

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



Re: PasswordTextField not showing the value

2010-01-27 Thread Marat Radchenko
You can't edit user password because you only store its hash. Don't you?

2010/1/27 Josh Kamau :
>  I have would like to edit an existing user's properties including the
> password. However, all the other properties are appearing on their
> corresponding fields except the password field. How do i make it appear?.
>
>   here is my component for editing users
>
>
>   public class UserPanel extends Panel {
>
>    /**
>     *
>     */
>    private static final long serialVersionUID = 3819937222116190372L;
>
>   �...@inject
>    private UserDao userDao;
>
>    private TextField txtUsername;
>
>    private PasswordTextField txtPassword;
>
>    private PasswordTextField txtConfPassword;
>
>    private User user;
>
>    public UserPanel(String id, final User user) {
>        super(id);
>
>        this.user = user;
>
>        Form frmCreateUser = new Form("frmCreateUser") {
>
>            /**
>             *
>             */
>            private static final long serialVersionUID = 1L;
>
>           �...@override
>            protected void onSubmit() {
>                if (user.getId() == null) {
>                    Long id = userDao.saveUser(this.getModelObject());
>                    info("User #" + id + " has been created");
>                } else {
>                    Long id = userDao.updateUser(this.getModelObject());
>                    info("User #" + id + " has been updated");
>                }
>            }
>
>        };
>
>        frmCreateUser.setModel(new Model(user));
>        add(frmCreateUser);
>
>        txtUsername = new TextField("txtUsername",
>                new PropertyModel(user, "username"));
>        txtPassword = new PasswordTextField("txtPassword",
>                new PropertyModel(user, "password"));
>        txtConfPassword = new PasswordTextField("txtConfPassword",
>                new PropertyModel(user, "password"));
>
>
>        frmCreateUser.add(txtUsername);
>        frmCreateUser.add(txtPassword);
>        frmCreateUser.add(txtConfPassword);
>    }
>
>   the txtPassword and txtConfPassword fields display empty and so i have to
> provide a password every time i edit the user.
>
>  Kindly help
>
> Regards
>
>  Josh
>

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



PasswordTextField not showing the value

2010-01-27 Thread Josh Kamau
 I have would like to edit an existing user's properties including the
password. However, all the other properties are appearing on their
corresponding fields except the password field. How do i make it appear?.

   here is my component for editing users


   public class UserPanel extends Panel {

/**
 *
 */
private static final long serialVersionUID = 3819937222116190372L;

@Inject
private UserDao userDao;

private TextField txtUsername;

private PasswordTextField txtPassword;

private PasswordTextField txtConfPassword;

private User user;

public UserPanel(String id, final User user) {
super(id);

this.user = user;

Form frmCreateUser = new Form("frmCreateUser") {

/**
 *
 */
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit() {
if (user.getId() == null) {
Long id = userDao.saveUser(this.getModelObject());
info("User #" + id + " has been created");
} else {
Long id = userDao.updateUser(this.getModelObject());
info("User #" + id + " has been updated");
}
}

};

frmCreateUser.setModel(new Model(user));
add(frmCreateUser);

txtUsername = new TextField("txtUsername",
new PropertyModel(user, "username"));
txtPassword = new PasswordTextField("txtPassword",
new PropertyModel(user, "password"));
txtConfPassword = new PasswordTextField("txtConfPassword",
new PropertyModel(user, "password"));


frmCreateUser.add(txtUsername);
frmCreateUser.add(txtPassword);
frmCreateUser.add(txtConfPassword);
}

   the txtPassword and txtConfPassword fields display empty and so i have to
provide a password every time i edit the user.

 Kindly help

Regards

 Josh


Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
Just a couple of ideas...

-Use a servlet to serve them? You don´t need Wicket for this... and combine
this with simpleimage?
-With Wicket mount a dynamic web-resource and combine this with simpleimage?


Ernesto

2010/1/27 François Meillet 

> Hi Wicketers,
>
> I have a directory, /xxx/images with uploaded images, which is not under
> the application context root directory.
> How can I serve them as static images ?
>
> I tried the StaticImage class I found in the forum (
> http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
> but it doesn't work for me. It just work if the image files are under the
> context root directory.
>
> Thanks for your help.
>
> François
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


images not under the context root directory

2010-01-27 Thread François Meillet
Hi Wicketers,

I have a directory, /xxx/images with uploaded images, which is not under the 
application context root directory.
How can I serve them as static images ?

I tried the StaticImage class I found in the forum 
(http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
but it doesn't work for me. It just work if the image files are under the 
context root directory.

Thanks for your help. 

François 




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



RE: Should Duration be deprecated?

2010-01-27 Thread Chris Colman
While we're on the subject of 1's and 0's:

Did you know this? There are only 10 types of people in the world: Those
who understand binary, and those who don't.


Back in my day we didn't need Tapestry, or Wicket or WebObjects, or even
Servlets, or for that matter Java! We just coded in plain assembly
language. And before that we had to just type in 1's and 0's. Sometimes
we didn't even have 1's. I once had to code for an entire month,
barefoot, in the dead of winter, using just 0's... but you didn't hear
me complaining."

Regards,
Chris Colman
Step Ahead Software
http://stepaheadsoftware.com

> you're thinking of windows.
> 
> 
> Martijn Dashorst wrote:
> >
> > On Tue, Jan 26, 2010 at 10:00 PM, Igor Vaynberg
> 
> > wrote:
> >> i thought they were all stored as electrons
> >
> > My vote goes to Umpalumpa's shifting miniature pumpkins on scales
> >
> > Martijn
> >
> > --

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



Re: Should Duration be deprecated?

2010-01-27 Thread Jonathan Locke


you're thinking of windows.


Martijn Dashorst wrote:
> 
> On Tue, Jan 26, 2010 at 10:00 PM, Igor Vaynberg 
> wrote:
>> i thought they were all stored as electrons
> 
> My vote goes to Umpalumpa's shifting miniature pumpkins on scales
> 
> Martijn
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Should-Duration-be-deprecated--tp27323675p27339042.html
Sent from the Wicket - User 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



Nasty problem with "component not found" and images [solved]

2010-01-27 Thread Thomas Kappler
Earlier this month, there was a thread [1] about the "component not 
found" problem. I can't reply as I wasn't subscribed yet.


[1] 
http://old.nabble.com/component-xxx:yyy:zzz-not-found-on-page-td27080437.html


I had the same problem recently, and after banging my head against the 
wall for a while, I figured it out.


I had a RepeatingView on the page that consisted of markup containers 
that had some text, and some had an external image (hosted outside the 
wicket app), while others did not. I tought I'd keep it simple and wrote 
 in the markup. In the Java code, I'd check each item 
whether it had a URL to an image, and if so, would insert that into the 
src attribute with an AttributeModifier. For the other items it just 
stayed at the "#" value.


Now "#" means "the current page", so for each page load, the browser 
would actually load the page several times, once for each empty . 
When using ajax, this completely breaks things, of course (besides 
making the page really slow).


Note that an empty value of src="" can also cause this at least with 
older versions of Firefox.


Making it so that the  markup is only inserted for actual images 
solved it.


Maybe that was really dumb, but I thought I'd share it for the mailing 
list archive.


-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Using AjaxFormSubmitBehavior

2010-01-27 Thread Pedro Santos
How can you make sure that contact_data references to the same data on your
contact_form model? I guess that is why you having troubles. For instance,
you are creating the text field using
new RequiredTextField("contact_id")
it leads me guess you are using a CompoundPropertyModel on
your contact_form.
So change the lines on you onSubmit implementation from:
System.out.println("Inside contact link's onSubmit is called:" +
contact_data.getContactId());
to
System.out.println("Inside contact link's onSubmit is called:" +
referenceToTheModeWhereIHaveTheContactUsedByForm.getObject().getContactId());
probably referenceToTheModeWhereIHaveTheContactUsedByForm can be:
contact_form.getDefaultModel()

On Tue, Jan 26, 2010 at 5:26 PM, Anna Simbirtsev wrote:

> I changed it to use AjaxButton instead of AjaxFormSubmitBehavior and it
> still does not see the values.
>
>  wicket:id="contact_submitbutton" class="button"/>SUBMIT
>
> FeedbackPanel contact_feedback = new FeedbackPanel("popup_feedback", new
> ContainerFeedbackMessageFilter(contact_form));
>
> contact_feedback.setOutputMarkupId(true);
>
> contact_form.add(new RequiredTextField("contact_id"));
>
> contact_form.add(new AjaxButton("contact_submitbutton") {
> private static final long serialVersionUID =
> 4192112499051970470L;
>
> @Override
>protected void onSubmit(AjaxRequestTarget target, Form form)
> {
>System.out.println("Inside contact link's onSubmit is
> called:" + contact_data.getContactId());
>
>}
>
>@SuppressWarnings("unchecked")
>@Override
>protected void onError(AjaxRequestTarget target, Form form)
>{
>System.out.println("Inside contact link's onError is
> called.");
>target.addComponent(contact_feedback);
>}
>});
>
> On Tue, Jan 26, 2010 at 2:05 PM, Pedro Santos  wrote:
>
> > Even using AjaxButton? Can you send the code?
> >
> > On Tue, Jan 26, 2010 at 4:55 PM, Anna Simbirtsev  > >wrote:
> >
> > > Thanks, now in my feedback it displays errors that all required fields
> > are
> > > empty. But the problem is, that even if I put the values in those
> fields
> > it
> > > still does not see them and gives the same errors in the feedback
> panel.
> > >
> > > On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos 
> > wrote:
> > >
> > > > Take a look at the AjaxButton if you need an asynchronous submit, and
> > > > implement your onError handlers with:
> > > >
> > > > target.addComponent(
> > > myFeedbackPanelThatMabyWillShowSomeMessageIfGetUpdated
> > > > );
> > > >
> > > > On Tue, Jan 26, 2010 at 4:34 PM, Anna Simbirtsev <
> > asimbirt...@gmail.com
> > > > >wrote:
> > > >
> > > > > I have, but maybe its incorrect.
> > > > >
> > > > > 
> > > > >
> > > > > contact_form.add(new FeedbackPanel("popup_feedback", new
> > > > > ContainerFeedbackMessageFilter(contact_form) ));
> > > > >
> > > > > On Tue, Jan 26, 2010 at 1:32 PM, Pedro Santos  >
> > > > wrote:
> > > > >
> > > > > > Do you have an feedback panel on the model?  If don't, add one
> and
> > > see
> > > > if
> > > > > > your form don't pass in some validation like on required field.
> > > > > >
> > > > > > On Tue, Jan 26, 2010 at 4:07 PM, Anna Simbirtsev <
> > > > asimbirt...@gmail.com
> > > > > > >wrote:
> > > > > >
> > > > > > > Hello,
> > > > > > >
> > > > > > > I have a modal window that is used to create a contact and
> needs
> > to
> > > > > > submit
> > > > > > > data to the server once submit button is called.
> > > > > > >
> > > > > > > The submit button is defined as follows:
> > > > > > >
> > > > > > >  > > > type="submit">SUBMIT
> > > > > > >
> > > > > > >
> > > > > > > contact_form.add(new Button("contact_submitbutton").add(new
> > > > > > > AjaxFormSubmitBehavior(contact_form, "onclick") {
> > > > > > >
> > > > > > >private static final long serialVersionUID =
> > > > > > > 4192112499051970470L;
> > > > > > >
> > > > > > >protected void onSubmit(AjaxRequestTarget target)
> > > > > > >{
> > > > > > >System.out.println("Inside contact link's
> onSubmit
> > > is
> > > > > > > called" );
> > > > > > >
> > > > > > >}
> > > > > > >
> > > > > > >@Override
> > > > > > >protected void onError(AjaxRequestTarget target)
> > > > > > >{
> > > > > > >}
> > > > > > >}));
> > > > > > >
> > > > > > >
> > > > > > > But nothing happens when I click on the button.
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > Anna
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Pedro Henrique Oliveira dos Santos
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Anna Simbirtsev
> > > > > (416) 729-7331
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Pedro Henrique Oliveira dos Santos
> > > >
> > >
> > >
> > >
> > > --
> > > Anna Simbirtsev
> > > (416) 729-7331
> > >
> >

Re: Page load after an action

2010-01-27 Thread Pedro Santos
It is natural:

1 - model load some data from some source
2 - that source was updated, changed, and the data loaded on the model no
more reflect the data on that source
3 - detach the old loaded data on model
4 - next time any object require the data on model, it will no longer have
the old data (that is no more the same on his source) that was detached. So
it is forced to reload from the updated source, the new data, that now has
an deleted item.

On Tue, Jan 26, 2010 at 2:59 PM, Stéphane Jeanjean <
stephane.jeanj...@softeam.com> wrote:

>
> Thanks Pedro, it's ok now ;-)
>
> I use LoadableDetachableModel to avoid the call to detach() method. It does
> not seem that is the right way. Somebody can explain me why ?
>
> Stéphane
>
>
> Pedro Santos a écrit :
>
>  by calling getDefaultModel inside onClick, you get an reference to the
>> link
>> component model. You need to detach the model on your list view. You has
>> an
>> reference to it on your variable "news". So:
>> news.getDefaultModel().detach()
>> If you need, you can change that variable modifiers or turn it an instance
>> variable for have acess to it inside your onClick implementation.
>>
>> On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean <
>> stephane.jeanj...@softeam.com> wrote:
>>
>>
>>
>>> The behaviour is the same with the following code :(
>>>
>>>
>>>  public void onClick() {
>>>  // TODO : check the refresh issue
>>>  getNewsDao().delete(item.getModelObject());
>>>  ourLogger.debug("News deleted");
>>>  getDefaultModel().detach();
>>>}
>>>
>>>
>>> Pedro Santos a écrit :
>>>
>>>  missing line: call detach method just after delete your item.
>>>
>>>
 On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos 
 wrote:





> Call news.getDefaultModel().detach(), and look for more info about
> detachable models.
>
> http://cwiki.apache.org/WICKET/detachable-models.html
>
> On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean <
> stephane.jeanj...@softeam.com> wrote:
>
>
>
>
>
>> Hi,
>>
>> I don't use Hibernate. My persistence layer uses JDBC.
>>
>> What is strange when I click the delete link, it's the logs order :
>>
>> Loading all news
>> News deleted
>>
>> So it seems that the deletion is done after the data reload :(
>>
>> Stéphane
>>
>>
>> Riyad Kalla a écrit :
>>
>>  Stephane,
>>
>>
>>
>>
>>> I'll let someone smarter than me address the wicket issue of removing
>>> the
>>> item from the ListView and seeing if that helps -- but is there a
>>> chance
>>> you
>>> are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
>>> caching
>>> with your persistence code? I ask because I've seen code like this "I
>>> don't
>>> see my changes until the 2nd refresh!" a lot with folks using 2nd
>>> level
>>> caches and not seeing immediate persistence of those changes.
>>>
>>> On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean <
>>> stephane.jeanj...@softeam.com> wrote:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
PageableListView news =
new PageableListView("list", new NewsModel(), 15){

@Override
protected void populateItem(final ListItem item) {
ourLogger.debug("Getting item value
 "+item.getModelObject().getTitle());

News news = item.getModelObject();
  item.add(new Label("date", new
 Model(news.getDate(;
  Link l = new Link("edit"){

@Override
public void onClick() {
setResponsePage(new
 NewsPage(item.getModelObject()));
  }
 };

item.add(l);
l.add(new Label("title", news.getTitle()));

item.add(new Link("delete", new Model()){

@Override
public void onClick() {
// TODO : check the refresh issue
getNewsDao().delete(item.getModelObject());
ourLogger.debug("News deleted");
  }
  });
  }

  };

add(news);
add(new OrPagingNavigator("navigator", news));
  add(new Bookm

Re: wicket bench in eclipse

2010-01-27 Thread Peter Karich

Why not using the default configuration of the wicket archetype
and let the htmls under main/java ? (configuration over convention ;-))

Then at least in IntelliJ and NetBeans the switch html<-->java works fine.

Regards,
Peter.


Agree with Huake Ingmar. The functionality doesn't overlap at all. My
main reason for wanting the plugin to work is to switch easily between
the html and the java code for the same component. In a maven project
this is particular a hassle because the java code is in packages under
/src/main/java and the html code is in packages under
/src/main/resources. I can't really find a quick way (preferable
single keystroke to flip between them). I also ideally want code
completion on the wicket ids but thats secondary.

regards,
Lionel



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