Re: How can i reset the data in TextFields?

2011-06-27 Thread HarryBakker
Hi Igor,

I think i get the idea.

To summarise in my own brief way: Every TextField (among others) has besides
a Model, also an input buffer. This buffer contains what the user typed. It
is also the contents of this buffer that is subject to validation. Only when
validation succeeds, the buffers contents is stored in the Model (after a
successful conversion). It is also the contents of this buffer that is being
displayed on the screen. Therefore, a copy is made from the Model value to
the buffer before display. Can you confirn this summary?

So, in my application, when i press the Cancel button, i want to get rid of
the user input by clearing the buffer, which can be done by a call to
clearInput(). This is probably implemented in Wicket by doing a copy from
the Model to the buffer.

I have implemented it and it works fine!

Thanks for your advice.

Cheers,

-Harry

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-can-i-reset-the-data-in-TextFields-tp3625099p3627166.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Override modal.js functionality because of issue with form inside form

2011-06-27 Thread Brown, Berlin [GCG-PFS]
Either way, if I wanted to override that functionality.  What is a way to do so?

I am going to try adding the modal-override.js javascript 

And then getting rid of the inner form:


Wicket.Window.getMarkup = ...
CustomModal extends ModalWindow
this.add(JavascriptPackageResource.getHeaderContribution(JAVASCRIPT));

With certain browsers, the way we are using browsers does not allow the submit. 
  Works with IE but not in Chrome or Firefox.

form
   modalWindow
 submitButton /
/form

-Original Message-
From: Pedro Santos [mailto:pedros...@gmail.com] 
Sent: Sunday, June 26, 2011 11:27 PM
To: users@wicket.apache.org
Subject: Re: Override modal.js functionality because of issue with form inside 
form

Hi Brown, submit a form inside a modal window should be fine, just make sure 
you have an outer form higher in hierarchy. Nested forms inside a modal window 
works nice even in old versions. It is important because it prevents invalid 
markup like form tag inside form tag.
About improvements in modal window, it is already planned to Wicket 1.6.


On Sun, Jun 26, 2011 at 9:24 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:
 Related bug:
 https://issues.apache.org/jira/browse/WICKET-3146

 

 From: Brown, Berlin [GCG-PFS]
 Sent: Sunday, June 26, 2011 8:23 PM
 To: 'users@wicket.apache.org'
 Subject: Override modal.js functionality because of issue with form 
 inside form


 I am using a dated version of wicket.  I don't know if this is fixed 
 but I wanted to override the functionality in the modal.js from 
 wicket-extensions.

 Basically, I need to remove the inner form that is created by the 
 javascript.  Some of the browsers we are using, the user cannot submit 
 the form from a modal window (maybe our page layout is at fault).

 What is a non-invasive way of doing this (least amount of code changes)?

 It looks like a lot of the methods in the ModalWindow class are 
 private or static, I was thinking of just overriding that class or 
 reimplementing that class and passing my own javascript with modified 
 functionality.

 Here is the javascript I needed to change:

 ...
 res/modal.js
 div class=\wicket-modal\ id=\+idWindow+\ style=\top: 10px;
 left: 10px; width: 100px;\form
 style='background-color:transparent;padding:0px;margin:0px;border-width:
 0px;position:static'+




--
Pedro Henrique Oliveira dos Santos

-
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



Upgrade Wicket to 1.5-RC5.1 - 'Page expired'

2011-06-27 Thread Thomas Franconville

Hi,

Upgrading wicket from 1.5-RC4.2 to 1.5-RC5.1  make my Junit Test down 
with the error 'Page expired'


/**
 * Simple test using the WicketTester
 */
public class TestHomePage
{
private WicketTester tester;

@Before
public void setUp()
{
tester = new WicketTester(new MyApplication());
}

@Test
public void homepageRendersSuccessfully()
{
//start and render the test page
tester.startPage(WelcomePage.class);

//assert rendered page class
tester.assertRenderedPage(RedirectPage.class);
}
}

My application use a CASPageAuthorizationStrategy inspired of 
http://www.lunikon.net/2009/11/24/integrating-cas-and-wicket/



Kind Regards

Thomas


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



Re: Upgrade Wicket to 1.5-RC5.1 - 'Page expired'

2011-06-27 Thread Martin Grigorov
Put a breakpoint in
org.apache.wicket.request.handler.PageProvider.getPageInstance() and
see what happens.
It seems the test tries to retrieve a page from the page store by id
but there is no such.

On Mon, Jun 27, 2011 at 12:20 PM, Thomas Franconville
tfranconvi...@tetraedge.com wrote:
 Hi,

 Upgrading wicket from 1.5-RC4.2 to 1.5-RC5.1  make my Junit Test down with
 the error 'Page expired'

 /**
  * Simple test using the WicketTester
  */
 public class TestHomePage
 {
    private WicketTester tester;

    @Before
    public void setUp()
    {
        tester = new WicketTester(new MyApplication());
    }

    @Test
    public void homepageRendersSuccessfully()
    {
        //start and render the test page
        tester.startPage(WelcomePage.class);

        //assert rendered page class
        tester.assertRenderedPage(RedirectPage.class);
    }
 }

 My application use a CASPageAuthorizationStrategy inspired of
 http://www.lunikon.net/2009/11/24/integrating-cas-and-wicket/


 Kind Regards

 Thomas


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





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

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



Re: Upgrade Wicket to 1.5-RC5.1 - 'Page expired'

2011-06-27 Thread Thomas Franconville
yes, It happens in 
org.apache.wicket.request.handler.PageProvider.getPageInstance() ,

but not for the WelcomePage, but the redirection page (RedirectPage).
the CASPageAuthorizationStrategy as we are not authentified a 
org.apache.wicket.RestartResponseAtInterceptPageException with in 
parameter an instance of RedirectPage.
On the second call of PageProvider.getPageInstance, the pageId is of 0, 
an all other parameters are nulls.


The run seems quite different on 1.5-RC4.2 version - There is only one 
call of the method PageProvider.getPageInstance() and it come after the 
CASPageAuthorizationStrategy.isPageAuthorized


Le 27/06/2011 11:24, Martin Grigorov a écrit :

Put a breakpoint in
org.apache.wicket.request.handler.PageProvider.getPageInstance() and
see what happens.
It seems the test tries to retrieve a page from the page store by id
but there is no such.

On Mon, Jun 27, 2011 at 12:20 PM, Thomas Franconville
tfranconvi...@tetraedge.com  wrote:

Hi,

Upgrading wicket from 1.5-RC4.2 to 1.5-RC5.1  make my Junit Test down with
the error 'Page expired'

/**
  * Simple test using the WicketTester
  */
public class TestHomePage
{
private WicketTester tester;

@Before
public void setUp()
{
tester = new WicketTester(new MyApplication());
}

@Test
public void homepageRendersSuccessfully()
{
//start and render the test page
tester.startPage(WelcomePage.class);

//assert rendered page class
tester.assertRenderedPage(RedirectPage.class);
}
}

My application use a CASPageAuthorizationStrategy inspired of
http://www.lunikon.net/2009/11/24/integrating-cas-and-wicket/


Kind Regards

Thomas


-
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: Upgrade Wicket to 1.5-RC5.1 - 'Page expired'

2011-06-27 Thread Martin Grigorov
Please create a quickstart app and attach it to Jira

On Mon, Jun 27, 2011 at 12:49 PM, Thomas Franconville
tfranconvi...@tetraedge.com wrote:
 yes, It happens in
 org.apache.wicket.request.handler.PageProvider.getPageInstance() ,
 but not for the WelcomePage, but the redirection page (RedirectPage).
 the CASPageAuthorizationStrategy as we are not authentified a
 org.apache.wicket.RestartResponseAtInterceptPageException with in parameter
 an instance of RedirectPage.
 On the second call of PageProvider.getPageInstance, the pageId is of 0, an
 all other parameters are nulls.

 The run seems quite different on 1.5-RC4.2 version - There is only one call
 of the method PageProvider.getPageInstance() and it come after the
 CASPageAuthorizationStrategy.isPageAuthorized

 Le 27/06/2011 11:24, Martin Grigorov a écrit :

 Put a breakpoint in
 org.apache.wicket.request.handler.PageProvider.getPageInstance() and
 see what happens.
 It seems the test tries to retrieve a page from the page store by id
 but there is no such.

 On Mon, Jun 27, 2011 at 12:20 PM, Thomas Franconville
 tfranconvi...@tetraedge.com  wrote:

 Hi,

 Upgrading wicket from 1.5-RC4.2 to 1.5-RC5.1  make my Junit Test down
 with
 the error 'Page expired'

 /**
  * Simple test using the WicketTester
  */
 public class TestHomePage
 {
    private WicketTester tester;

    @Before
    public void setUp()
    {
        tester = new WicketTester(new MyApplication());
    }

    @Test
    public void homepageRendersSuccessfully()
    {
        //start and render the test page
        tester.startPage(WelcomePage.class);

        //assert rendered page class
        tester.assertRenderedPage(RedirectPage.class);
    }
 }

 My application use a CASPageAuthorizationStrategy inspired of
 http://www.lunikon.net/2009/11/24/integrating-cas-and-wicket/


 Kind Regards

 Thomas


 -
 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





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

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



GMap2 in a Wiquery Dialog

2011-06-27 Thread Philipp


I am trying to open a Google Map using GMap2 in a WiQuery Dialog modal 
window. The goal is to use the modal window in order to show a large map 
(800 x 500 px).


However, when I open the modal window only the small part of the map is 
shown, whereas the rest is only a grey area. If I open the exact same 
map in a regular panel, and not in a Wiquery Dialog the map is correctly 
shown.


The following screenshot further illustrates this issue:

https://picasaweb.google.com/lh/photo/9iXCzDiZ9R9zGhN56N-mDy7NU3UNAKRLuGErIKOgVvA?feat=directlink


Here is the modal window implementation:

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.ResourceModel;
import org.odlabs.wiquery.ui.dialog.Dialog;

import at.schuzalipo.w7.data.persistence.model.Address;
import at.schuzalipo.w7.web.W7BasePanel;
import at.schuzalipo.w7.web.common.GoogleMapsPanel;

public class ShowLargeMapPanel extends W7BasePanel {


// Modal window
private Dialog modalWindow;

public ShowLargeMapPanel(String id, Address address) {
super(id);


//Add the link for opening the modal window
AjaxLink openLink = new AjaxLink(openLargeLink) {
@Override
public void onClick(AjaxRequestTarget target) {
modalWindow.open(target);
}
};
add(openLink);


// Add the modal window
modalWindow = new Dialog(modal);
modalWindow.setWidth(860);
modalWindow.setHeight(630);
modalWindow.setTitle(new 
ResourceModel(winery.contactdetails.change).getObject());

modalWindow.setModal(true);
add(modalWindow);

//Add the large google panel to the modal window
WebMarkupContainer mapContainer = new 
WebMarkupContainer(mapContainer);
mapContainer.add(new GoogleMapsPanel(largeGoogleMap,address, 
800, 500));

modalWindow.add(mapContainer);


}

}

And the HTML of the modal window:

wicket:panel


a href=# wicket:id=openLargeLinkwicket:message 
key=map.openLarge //a




div wicket:id=modal style=display:none;

div wicket:id=mapContainer
div wicket:id=largeGoogleMap/div
/div
/div


/wicket:panel


As you can see, I add the GoogleMapsPanel in the last few lines.

Here is the code for the GoogleMapsPanel itself:

import java.io.IOException;
import java.util.Locale;

import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.html.panel.Panel;

import wicket.contrib.gmap.GMap2;
import wicket.contrib.gmap.api.GControl;
import wicket.contrib.gmap.api.GLatLng;
import wicket.contrib.gmap.api.GMarker;
import at.schuzalipo.w7.component.countryselector.Country;
import at.schuzalipo.w7.component.countryselector.CountryList;
import at.schuzalipo.w7.data.persistence.model.Address;
import at.schuzalipo.w7.util.Constants;
import at.schuzalipo.w7.util.ServerGeocoder;

/**
 * pGoogleMapsPanel class./p
 *
 * @author marco
 * @version $Id: $
 */
public class GoogleMapsPanel extends Panel {

private static final long serialVersionUID = 1L;
private static final ServerGeocoder geocoder = new ServerGeocoder(
Constants.GMAP_API_KEY);

private GMap2 googleMap;

/**
 * pConstructor for GoogleMapsPanel./p
 *
 * @param id a {@link java.lang.String} object.
 * @param address a {@link 
at.schuzalipo.w7.data.persistence.model.Address} object.

 */
public GoogleMapsPanel(String id, Address address, int width, int 
height) {

super(id);
this.setOutputMarkupId(true);

// specify the google map
googleMap = new GMap2(googleMap, Constants.GMAP_API_KEY);

//Set the size of the map
googleMap.add(new SimpleAttributeModifier(style, width: 
+width+px; height: +height+px;));



googleMap.setDoubleClickZoomEnabled(false);
googleMap.setZoom(10);
googleMap.addControl(GControl.GLargeMapControl);
googleMap.addControl(GControl.GMapTypeControl);
googleMap.addControl(GControl.GScaleControl);


GLatLng latLng = null;
String location;
if (address != null) {

//Get the Englisch name of the country
CountryList countrylist = new CountryList(Locale.ENGLISH);
Country c = 
countrylist.getCountryFromCode(address.getCountry());


location = address.getStreet() + ,  + address.getZip() + 
,  + address.getCity()

+ ,  + c.getName();

}
else {
location = USA;
}


//Try to get the location - as backup we take USA
try {
latLng = geocoder.findAddress(location);
} catch (IOException e) {
try {
latLng = geocoder.findAddress(USA);
googleMap.setZoom(6);
} catch (IOException ex) {
}
}


googleMap.setCenter(latLng);

RE: GMap2 in a Wiquery Dialog

2011-06-27 Thread Hielke Hoeve
This looks like a styling issue as the google layer (controls and
buttons) does fill the window. Have you tried inspecting the html
elements (chrome and firefox+firebug are easiest to use) to see if maybe
one of the html elements in the window have wrong css classes assigned?

Hielke

-Original Message-
From: Philipp [mailto:philipp@gmail.com] 
Sent: maandag 27 juni 2011 12:25
To: users@wicket.apache.org
Subject: GMap2 in a Wiquery Dialog


I am trying to open a Google Map using GMap2 in a WiQuery Dialog modal
window. The goal is to use the modal window in order to show a large map
(800 x 500 px).

However, when I open the modal window only the small part of the map is
shown, whereas the rest is only a grey area. If I open the exact same
map in a regular panel, and not in a Wiquery Dialog the map is correctly
shown.

The following screenshot further illustrates this issue:

https://picasaweb.google.com/lh/photo/9iXCzDiZ9R9zGhN56N-mDy7NU3UNAKRLuG
ErIKOgVvA?feat=directlink


Here is the modal window implementation:

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.ResourceModel;
import org.odlabs.wiquery.ui.dialog.Dialog;

import at.schuzalipo.w7.data.persistence.model.Address;
import at.schuzalipo.w7.web.W7BasePanel; import
at.schuzalipo.w7.web.common.GoogleMapsPanel;

public class ShowLargeMapPanel extends W7BasePanel {


 // Modal window
 private Dialog modalWindow;

 public ShowLargeMapPanel(String id, Address address) {
 super(id);


 //Add the link for opening the modal window
 AjaxLink openLink = new AjaxLink(openLargeLink) {
 @Override
 public void onClick(AjaxRequestTarget target) {
 modalWindow.open(target);
 }
 };
 add(openLink);


 // Add the modal window
 modalWindow = new Dialog(modal);
 modalWindow.setWidth(860);
 modalWindow.setHeight(630);
 modalWindow.setTitle(new
ResourceModel(winery.contactdetails.change).getObject());
 modalWindow.setModal(true);
 add(modalWindow);

 //Add the large google panel to the modal window
 WebMarkupContainer mapContainer = new
WebMarkupContainer(mapContainer);
 mapContainer.add(new GoogleMapsPanel(largeGoogleMap,address,
800, 500));
 modalWindow.add(mapContainer);


 }

}

And the HTML of the modal window:

wicket:panel


a href=# wicket:id=openLargeLinkwicket:message
key=map.openLarge //a



div wicket:id=modal style=display:none;

div wicket:id=mapContainer
div wicket:id=largeGoogleMap/div
/div
/div


/wicket:panel


As you can see, I add the GoogleMapsPanel in the last few lines.

Here is the code for the GoogleMapsPanel itself:

import java.io.IOException;
import java.util.Locale;

import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.html.panel.Panel;

import wicket.contrib.gmap.GMap2;
import wicket.contrib.gmap.api.GControl;
import wicket.contrib.gmap.api.GLatLng;
import wicket.contrib.gmap.api.GMarker;
import at.schuzalipo.w7.component.countryselector.Country;
import at.schuzalipo.w7.component.countryselector.CountryList;
import at.schuzalipo.w7.data.persistence.model.Address;
import at.schuzalipo.w7.util.Constants;
import at.schuzalipo.w7.util.ServerGeocoder;

/**
  * pGoogleMapsPanel class./p
  *
  * @author marco
  * @version $Id: $
  */
public class GoogleMapsPanel extends Panel {

 private static final long serialVersionUID = 1L;
 private static final ServerGeocoder geocoder = new ServerGeocoder(
 Constants.GMAP_API_KEY);

 private GMap2 googleMap;

 /**
  * pConstructor for GoogleMapsPanel./p
  *
  * @param id a {@link java.lang.String} object.
  * @param address a {@link 
at.schuzalipo.w7.data.persistence.model.Address} object.
  */
 public GoogleMapsPanel(String id, Address address, int width, int 
height) {
 super(id);
 this.setOutputMarkupId(true);

 // specify the google map
 googleMap = new GMap2(googleMap, Constants.GMAP_API_KEY);

 //Set the size of the map
 googleMap.add(new SimpleAttributeModifier(style, width: 
+width+px; height: +height+px;));


 googleMap.setDoubleClickZoomEnabled(false);
 googleMap.setZoom(10);
 googleMap.addControl(GControl.GLargeMapControl);
 googleMap.addControl(GControl.GMapTypeControl);
 googleMap.addControl(GControl.GScaleControl);


 GLatLng latLng = null;
 String location;
 if (address != null) {

 //Get the Englisch name of the country
 CountryList countrylist = new CountryList(Locale.ENGLISH);
 Country c = 
countrylist.getCountryFromCode(address.getCountry());

 location = address.getStreet() + ,  + address.getZip() + 
,  

Re: Override modal.js functionality because of issue with form inside form

2011-06-27 Thread Pedro Santos
On Mon, Jun 27, 2011 at 6:06 AM, Brown, Berlin [GCG-PFS]
berlin.br...@primerica.com wrote:
 Either way, if I wanted to override that functionality.  What is a way to do 
 so?

 I am going to try adding the modal-override.js javascript
OK, just add the following lines to the new model-override.js

Wicket.Window.getMarkup = function(...){
   return 'custon markup';
}
it is importante to load modal.js before.


 And then getting rid of the inner form:


 Wicket.Window.getMarkup = ...
 CustomModal extends ModalWindow
 this.add(JavascriptPackageResource.getHeaderContribution(JAVASCRIPT));

 With certain browsers, the way we are using browsers does not allow the 
 submit.   Works with IE but not in Chrome or Firefox.

 form
   modalWindow
     submitButton /
 /form

The modal window markup are turn visible as a body's child, so it is
not true that it will to be inside a form tag.


 -Original Message-
 From: Pedro Santos [mailto:pedros...@gmail.com]
 Sent: Sunday, June 26, 2011 11:27 PM
 To: users@wicket.apache.org
 Subject: Re: Override modal.js functionality because of issue with form 
 inside form

 Hi Brown, submit a form inside a modal window should be fine, just make sure 
 you have an outer form higher in hierarchy. Nested forms inside a modal 
 window works nice even in old versions. It is important because it prevents 
 invalid markup like form tag inside form tag.
 About improvements in modal window, it is already planned to Wicket 1.6.


 On Sun, Jun 26, 2011 at 9:24 PM, Brown, Berlin [GCG-PFS] 
 berlin.br...@primerica.com wrote:
 Related bug:
 https://issues.apache.org/jira/browse/WICKET-3146

 

 From: Brown, Berlin [GCG-PFS]
 Sent: Sunday, June 26, 2011 8:23 PM
 To: 'users@wicket.apache.org'
 Subject: Override modal.js functionality because of issue with form
 inside form


 I am using a dated version of wicket.  I don't know if this is fixed
 but I wanted to override the functionality in the modal.js from
 wicket-extensions.

 Basically, I need to remove the inner form that is created by the
 javascript.  Some of the browsers we are using, the user cannot submit
 the form from a modal window (maybe our page layout is at fault).

 What is a non-invasive way of doing this (least amount of code changes)?

 It looks like a lot of the methods in the ModalWindow class are
 private or static, I was thinking of just overriding that class or
 reimplementing that class and passing my own javascript with modified
 functionality.

 Here is the javascript I needed to change:

 ...
 res/modal.js
 div class=\wicket-modal\ id=\+idWindow+\ style=\top: 10px;
 left: 10px; width: 100px;\form
 style='background-color:transparent;padding:0px;margin:0px;border-width:
 0px;position:static'+




 --
 Pedro Henrique Oliveira dos Santos

 -
 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





-- 
Pedro Henrique Oliveira dos Santos

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



Re: How can i reset the data in TextFields?

2011-06-27 Thread Igor Vaynberg
On Mon, Jun 27, 2011 at 12:54 AM, HarryBakker harmengo...@gmail.com wrote:
 Hi Igor,

 I think i get the idea.

 To summarise in my own brief way: Every TextField (among others) has besides
 a Model, also an input buffer. This buffer contains what the user typed. It
 is also the contents of this buffer that is subject to validation. Only when
 validation succeeds, the buffers contents is stored in the Model (after a
 successful conversion). It is also the contents of this buffer that is being
 displayed on the screen. Therefore, a copy is made from the Model value to
 the buffer before display. Can you confirn this summary?

close enough.

-igor


 So, in my application, when i press the Cancel button, i want to get rid of
 the user input by clearing the buffer, which can be done by a call to
 clearInput(). This is probably implemented in Wicket by doing a copy from
 the Model to the buffer.

 I have implemented it and it works fine!

 Thanks for your advice.

 Cheers,

 -Harry

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-can-i-reset-the-data-in-TextFields-tp3625099p3627166.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



How to List/Iterate Through All Components?

2011-06-27 Thread eugenebalt
Guys, sorry for the stupid question, but I need to know,

How do I list all components on my current page? I expected to see a
Page.getComponents() that would return an Iterator of all my Components, or
a List, but I didn't see a method like that.

Thanks a lot

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-List-Iterate-Through-All-Components-tp3628231p3628231.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to List/Iterate Through All Components?

2011-06-27 Thread Per Newgro

Am 27.06.2011 18:58, schrieb eugenebalt:

Guys, sorry for the stupid question, but I need to know,

How do I list all components on my current page? I expected to see a
Page.getComponents() that would return an Iterator of all my Components, or
a List, but I didn't see a method like that.

Thanks a lot

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-List-Iterate-Through-All-Components-tp3628231p3628231.html
Sent from the Users forum mailing list archive at Nabble.com.

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



MarkupContainer.visitChildren(IVisitor) should do it

Cheers
Per

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



Distinguish between error messages for date

2011-06-27 Thread Anna Simbirtsev
Hi,

I have a date text field and I want to give 2 different error messages for
different errors:
1) invalid date
2) invalid date format


DateTextField myField = new DateTextField(myField,
-MM-dd) {

private static final long serialVersionUID = 1L;

public IConverter getConverter(Class? type)
  {
DateConverter converter = new DateConverter()
{
private static final long serialVersionUID = 1L;

/**
 * @see
org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
 */
@Override
public DateFormat getDateFormat(Locale locale)
{
SimpleDateFormat dateFormat = new
SimpleDateFormat(-MM-dd);
dateFormat.setLenient(false);

return dateFormat;
}
};

return converter;
  }
};
add(myField);

I put this into properties file but it gives same message for both cases.
iprRegistered.IConverter.Date=my message

Thanks


using a different pagemap

2011-06-27 Thread Douglas Ferguson
We are using ResourceStreamRequestTarget for streaming an export. Is there a
way to have this request use a different page map, sorta like the way that
when you open a new tab it uses a different page map?

Douglas


Re: streaming files with wicket

2011-06-27 Thread Douglas Ferguson
Yeah.. I thought of that, but I liked the idea of streaming without hitting
disc.

On Mon, Jun 20, 2011 at 3:55 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 i dont think there is a way once you start streaming with an
 attachment header...

 you can try rendering the page into memory and writing that out
 instead - so then you at least know your page rendered ok.

 -igor

 On Mon, Jun 20, 2011 at 1:50 PM, Douglas Ferguson
 doug...@douglasferguson.us wrote:
  I built a page with markup type = xml and set the content type and
 disposition so that the file will download.
 
  This is great except when there is a fatal exception thrown, my error
 page is getting written to the downloaded file.
 
  Any ideas how make the browser load the error page?
 
  Only thought I had was to stream the file to disc and then send A) stream
 to browser if there is no exception or B) forward to error page.
  But that kinda sucks as it is not truing streaming back to browser.
 
  D/
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: Distinguish between error messages for date

2011-06-27 Thread Igor Vaynberg
you can write your own converter that distinguishes the two situations
and throws a ConversionException with an appropriate resource key.

-igor

On Mon, Jun 27, 2011 at 10:48 AM, Anna Simbirtsev asimbirt...@gmail.com wrote:
 Hi,

 I have a date text field and I want to give 2 different error messages for
 different errors:
 1) invalid date
 2) invalid date format


 DateTextField myField = new DateTextField(myField,
                -MM-dd) {

            private static final long serialVersionUID = 1L;

            public IConverter getConverter(Class? type)
              {
                DateConverter converter = new DateConverter()
                {
                    private static final long serialVersionUID = 1L;

                    /**
                     * @see
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
                     */
                    @Override
                    public DateFormat getDateFormat(Locale locale)
                    {
                        SimpleDateFormat dateFormat = new
 SimpleDateFormat(-MM-dd);
                        dateFormat.setLenient(false);

                        return dateFormat;
                    }
                };

                return converter;
              }
        };
        add(myField);

 I put this into properties file but it gives same message for both cases.
 iprRegistered.IConverter.Date=my message

 Thanks


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



Re: Wicket and OSGi

2011-06-27 Thread Harald Wellmann
There is now a new module wicket-osgi in wicketstuff/core at Github with 
some glue code to adapt Wicket to OSGi house rules.


Summary:

- wicket-osgi supports bootstrapping a WicketApplication from the OSGi 
service registry, matching a property value specified as a WicketFilter 
init parameter in web.xml.


- OsgiClassResolver supports Wicket page deserialization.

- OsgiComponentInjector lets you inject OSGi services into WIcket 
components by annotating fields with JSR-330 @Inject.


- wicket-bundle, the all-in-one OSGi-compliant packaging of Wicket, now 
has a revised manifest without dynamic imports.


- wicket-ioc-bundle (sibling of wicket-bundle) does the same for 
wicket-ioc, which is required by wicket-osgi.


- wicket-osgi-test-web and wicket-osgi-test-service are two simple test 
bundles for testing the glue code in an OSGi web container (Pax Web). 
The sample uses Aries Blueprint to interact with the service registry, 
but of course you can also use Declarative Services or a BundleActivator.


- To run the sample webapp:

cd wicketstuff-core/jdk-1.5-parent/wicket-osgi-parent
cd wicket-osgi-test-web
mvn install pax:run
Open http://localhost:8080/library in your browser.

- To use wicket-osgi in your own projects, have a look at web.xml and 
LibraryApplication.java in wicket-osgi-test-web, and at the Javadoc in 
wicket-osgi.


All of this is anything but final... Have a look at the code, give it a 
try and let me know that you think.


Thanks,
Harald


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



Re: streaming files with wicket

2011-06-27 Thread Martin Grigorov
Igor's response doesn't mention hitting disk.
You can do it in memory

On Mon, Jun 27, 2011 at 9:17 PM, Douglas Ferguson
doug...@douglasferguson.us wrote:
 Yeah.. I thought of that, but I liked the idea of streaming without hitting
 disc.

 On Mon, Jun 20, 2011 at 3:55 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 i dont think there is a way once you start streaming with an
 attachment header...

 you can try rendering the page into memory and writing that out
 instead - so then you at least know your page rendered ok.

 -igor

 On Mon, Jun 20, 2011 at 1:50 PM, Douglas Ferguson
 doug...@douglasferguson.us wrote:
  I built a page with markup type = xml and set the content type and
 disposition so that the file will download.
 
  This is great except when there is a fatal exception thrown, my error
 page is getting written to the downloaded file.
 
  Any ideas how make the browser load the error page?
 
  Only thought I had was to stream the file to disc and then send A) stream
 to browser if there is no exception or B) forward to error page.
  But that kinda sucks as it is not truing streaming back to browser.
 
  D/
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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






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

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



Re: using a different pagemap

2011-06-27 Thread Martin Grigorov
I guess to not lock the access to that page from Ajax requests.

Douglas: you can use shared resource to do the streaming,

On Mon, Jun 27, 2011 at 9:20 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 pagemaps are for managing page expirations. why would you want to
 stream something in a different pagemap?

 -igor

 On Mon, Jun 27, 2011 at 11:15 AM, Douglas Ferguson
 doug...@buzzstream.com wrote:
 We are using ResourceStreamRequestTarget for streaming an export. Is there a
 way to have this request use a different page map, sorta like the way that
 when you open a new tab it uses a different page map?

 Douglas


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





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

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



Re: Wicket and OSGi

2011-06-27 Thread Attila Király
Good work.

Could you also document the new module on wicketstuff wiki?
https://github.com/wicketstuff/core/wiki

Thanks,
Attila

2011/6/27 Harald Wellmann harald.wellm...@gmx.de

 There is now a new module wicket-osgi in wicketstuff/core at Github with
 some glue code to adapt Wicket to OSGi house rules.

 Summary:

 - wicket-osgi supports bootstrapping a WicketApplication from the OSGi
 service registry, matching a property value specified as a WicketFilter init
 parameter in web.xml.

 - OsgiClassResolver supports Wicket page deserialization.

 - OsgiComponentInjector lets you inject OSGi services into WIcket
 components by annotating fields with JSR-330 @Inject.

 - wicket-bundle, the all-in-one OSGi-compliant packaging of Wicket, now has
 a revised manifest without dynamic imports.

 - wicket-ioc-bundle (sibling of wicket-bundle) does the same for
 wicket-ioc, which is required by wicket-osgi.

 - wicket-osgi-test-web and wicket-osgi-test-service are two simple test
 bundles for testing the glue code in an OSGi web container (Pax Web). The
 sample uses Aries Blueprint to interact with the service registry, but of
 course you can also use Declarative Services or a BundleActivator.

 - To run the sample webapp:

 cd wicketstuff-core/jdk-1.5-**parent/wicket-osgi-parent
 cd wicket-osgi-test-web
 mvn install pax:run
 Open http://localhost:8080/library in your browser.

 - To use wicket-osgi in your own projects, have a look at web.xml and
 LibraryApplication.java in wicket-osgi-test-web, and at the Javadoc in
 wicket-osgi.

 All of this is anything but final... Have a look at the code, give it a try
 and let me know that you think.

 Thanks,
 Harald


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




Re: Wicket and OSGi

2011-06-27 Thread Martin Grigorov
I also reviewed the code - good job!

I saw that you basically copy/pasted DefaultClassResolver to
OsgiClassResolver with minor modifications.
I think it will be better if we make DCR easier to extend so there is
no need to copy/paste its code.

On Mon, Jun 27, 2011 at 10:53 PM, Attila Király
kiralyattila...@gmail.com wrote:
 Good work.

 Could you also document the new module on wicketstuff wiki?
 https://github.com/wicketstuff/core/wiki

 Thanks,
 Attila

 2011/6/27 Harald Wellmann harald.wellm...@gmx.de

 There is now a new module wicket-osgi in wicketstuff/core at Github with
 some glue code to adapt Wicket to OSGi house rules.

 Summary:

 - wicket-osgi supports bootstrapping a WicketApplication from the OSGi
 service registry, matching a property value specified as a WicketFilter init
 parameter in web.xml.

 - OsgiClassResolver supports Wicket page deserialization.

 - OsgiComponentInjector lets you inject OSGi services into WIcket
 components by annotating fields with JSR-330 @Inject.

 - wicket-bundle, the all-in-one OSGi-compliant packaging of Wicket, now has
 a revised manifest without dynamic imports.

 - wicket-ioc-bundle (sibling of wicket-bundle) does the same for
 wicket-ioc, which is required by wicket-osgi.

 - wicket-osgi-test-web and wicket-osgi-test-service are two simple test
 bundles for testing the glue code in an OSGi web container (Pax Web). The
 sample uses Aries Blueprint to interact with the service registry, but of
 course you can also use Declarative Services or a BundleActivator.

 - To run the sample webapp:

 cd wicketstuff-core/jdk-1.5-**parent/wicket-osgi-parent
 cd wicket-osgi-test-web
 mvn install pax:run
 Open http://localhost:8080/library in your browser.

 - To use wicket-osgi in your own projects, have a look at web.xml and
 LibraryApplication.java in wicket-osgi-test-web, and at the Javadoc in
 wicket-osgi.

 All of this is anything but final... Have a look at the code, give it a try
 and let me know that you think.

 Thanks,
 Harald


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






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

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



Re: Wicket and OSGi

2011-06-27 Thread Harald Wellmann

Am 27.06.2011 22:13, schrieb Martin Grigorov:

I also reviewed the code - good job!



Thanks :-)


I saw that you basically copy/pasted DefaultClassResolver to
OsgiClassResolver with minor modifications.
I think it will be better if we make DCR easier to extend so there is
no need to copy/paste its code.



Actually, I'm no longer sure it is needed at all... The 
OsgiClassResolver uses the bundle class loader of the WAB, accessed via 
the current Application class.


The DefaultClassResolver uses the ThreadContextClassLoader, or its own 
classloader as a fallback.


I'd noticed before that my sample works on Jetty even without the 
OsgiClassResolver, and the same is true on GlassFish 3.1.


Sahoo from the GlassFish team pointed out to me that any Servlet 
container is required to set the TCCL to the application classloader 
(see Servlet Spec 3.0, section 10.7.2) for loading resources and for any 
application callbacks.


If everyone agrees that this covers all use cases where Wicket needs to 
load stuff from user bundles, then I think it's safe to scrap the 
OsgiClassResolver and let the unmodified DefaultClassResolver do the job.


Could you also document the new module on wicketstuff wiki?
https://github.com/wicketstuff/core/wiki


Sure - that's the next thing on my list...

I'm also planning to add some Surefire tests based on Pax Exam.

Cheers,
Harald

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