Re: Problem with Crypted URL

2010-05-27 Thread kugaprakash

We are using Wicket 1.3.5 (Unable to upgrade to latest Wicket release, due to
a CSRF fix needed for a previous release build) and I am doing the
following:


protected IRequestCodingStrategy newRequestCodingStrategy(){
 return new CryptedUrlWebRequestCodingStrategy(new
WebRequestCodingStrategy()){
  @Override
  protected String onError(final Exception ex)
  {
throw new WicketRuntimeException(Session Expired, new
PageExpiredException(Session Expired));
  }
   }

Still does not work, 
In our WebRequestCycleProcessor, we override the respond method and do the
following:
if(e instanceof PageExpiredException || e instanceof HackAttackException){
Session.get().invalidate();
throw new RestartResponseException(new 
SessionExpiryPage());
}

In SessionExpiryPage.html - we have CSS  Logo resources, which is not
getting rendered.

If you happened to resolve this, please let me know.

Any help is much appreciated
Thanks in advance.
Kuga
  
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-Crypted-URL-tp1875435p2232645.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



Re: [PROPOSAL] Application.runAs() Method...

2010-05-27 Thread Emond Papegaaij
In our application we use quartz for long running jobs. These threads have 
access to the application context, which contains the wicket application. In 
the execute method, we locate the application and use Application.set and 
Application.unset to set and remove the application. This is, however, not a 
'public API' and could easily be replaced by wrapping the main body in a 
Runnable and calling Application.wrap. I'm in favor of this wrap method. It 
allows you to set the application on a thread, without having to use non-
public API, and without the try/finally hassle.

I do not care how this method is implemented (that's the beauty of a good API, 
isn't it?). It could store the application in the runnable, or look it up in a 
map, as long as it works reliably, I'm fine with it :)

Emond

On Wednesday 26 May 2010 23:47:43 James Carman wrote:
 Well, this doesn't start any threads or anything.  So, it wouldn't
 immediately allow folks to start up threads.  All this would do is
 create an object that *can* be run in another thread, but have access
 to this Application in it.  Also, this is just a proposal.  I'm just
 wanting folks to give feedback about the idea.  I think this is the
 most flexible way to solve the problem we're seeing folks have.
 
 On Wed, May 26, 2010 at 4:28 PM, Joe Fawzy joewic...@gmail.com wrote:
  Hi
  Please make this configurable(can be disabled) as i am on appengine, they
  does not allow threads
  thanks
  Joe
  
  On Tue, May 25, 2010 at 4:34 PM, James Carman 
ja...@carmanconsulting.comwrote:
  Sorry, subject should be wrap() method, not runAs().
  
  On Tue, May 25, 2010 at 9:33 AM, James Carman
  
  ja...@carmanconsulting.com wrote:
   I've been thinking about this whole idea of needing to access the
   application object in different threads idea.  What if the Application
   class had a method like this:
   
   public Runnable wrap(Runnable task)
   
   Basically, the Application would create a Runnable object that can be
   run within the context of itself (by setting/clearing the ThreadLocal
   variable).  Then, you can use that Runnable anywhere to run a task
   with all of the appropriate Wickety goodness set up for you (except
   for the request cycle of course because you're not executing within a
   request cycle).  Now, what the Application stores in the Runnable
   doesn't have to be the Application itself.  We can set up a static
   MapString,WeakReferenceApplication object on the Application class
   and when an Application is constructed, it registers itself (the key
   could be a UUID.randomUUID().toString()).  Then, we could have a
   method like
   
   public static Application get(String id);
   
   on the Application class to get back the original Application object.
  
  -
  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: Dataview linkedline

2010-05-27 Thread midikem

Hi again, i am a little bit confused.

columns.add(new AbstractColumnTest(null, null) {
private static final long serialVersionUID = 1L;
public void populateItem(ItemICellPopulatorTest item, String
componentId, IModelTest model) {
item.add(new LinkTest(componentId, model) {
private static final long serialVersionUID = 1L;

@Override
public void onClick() {

}
});
   }
});

How do i get to my item without having to create a column first, since i
dont want a column when i want to add a Link to a line in the dataview??
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dataview-linkedline-tp2231274p2232716.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



Re: Dataview linkedline

2010-05-27 Thread Sven Meier

Override DataTable#newRowItem():

@Override
protected ItemFoo newRowItem(String id, int index,
final IModelFoo model) {
ItemFoo item = super.newRowItem(id, index, model);

item.add(new AjaxEventBehavior(onclick) {
@Override
protected void onEvent(AjaxRequestTarget 
target) {
...
}
});

return item;
}
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dataview-linkedline-tp2231274p2232746.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



Re: [PROPOSAL] Application.runAs() Method...

2010-05-27 Thread James Carman
On Thu, May 27, 2010 at 2:34 AM, Emond Papegaaij
emond.papega...@topicus.nl wrote:
 In our application we use quartz for long running jobs. These threads have
 access to the application context, which contains the wicket application. In
 the execute method, we locate the application and use Application.set and
 Application.unset to set and remove the application. This is, however, not a
 'public API' and could easily be replaced by wrapping the main body in a
 Runnable and calling Application.wrap. I'm in favor of this wrap method. It
 allows you to set the application on a thread, without having to use non-
 public API, and without the try/finally hassle.

What happens if you have multiple applications running in the same webapp?


 I do not care how this method is implemented (that's the beauty of a good API,
 isn't it?). It could store the application in the runnable, or look it up in a
 map, as long as it works reliably, I'm fine with it :)

Right, we can figure out how to implement it later, but I think making
this method available would be a huge step in the right direction.

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



NonCachingImage and xhtmlRenderer

2010-05-27 Thread Xavier López
Hi,

I'm trying to use a xhtml to pdf renderer
(https://xhtmlrenderer.dev.goog_1283895835
java.net/) in order to print out a page to PDF.

The page contains a  NonCachingImage, with a barcode, in such a way that the
image gets the following HTML :

?xml version=1.0 encoding=UTF-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN 
 http://www.w3.org/TR/xhtml11/DTD/xhtml11-flat.dtd;
 html xml:lang=ca xmlns=http://www.w3.org/1999/xhtml;
 ...
 img class=floatR
 src=?wicket:interface=:34:barcode::IResourceListener::wicket:antiCache=1274953227999/
 ...
 /html


When parsing the html String into a org.w3c.dom.document, I get the
following exception:

org.xml.sax.SAXParseException: The reference to entity wicket:antiCache
 must end with the ';' delimiter.



I know this is probably not a Wicket issue, and maybe has to do with the DTD
used for validation, or something like that.
I found somewhere this can get solved by changing the '' character in the
URL by 'amp;'. That worked. Now I plan to override NonCachingImage's
onComponentTag to append amp; instead of ''.

That solved, I can't get the image to get rendered in the pdf document, in
the html's DOM I have the img Element with the 'src' atttribute with value
=http://myapp/?wicket:interface=:34:
barcode::IResourceListener::wicket:antiCache=1274953227999, but
Image#onResourceRequested() (which is the callback for that URL) never gets
called during the render phase of the PDF...

I'd really appreciate any hints on this one, I've been looking into the
resources reference but I don't know if I should use it, or which
implementation to use... The image resource is formed from a byte array.

Many thanks,
Xavier López


Re: [PROPOSAL] Application.runAs() Method...

2010-05-27 Thread Emond Papegaaij
On Thursday 27 May 2010 12:41:10 James Carman wrote:
 On Thu, May 27, 2010 at 2:34 AM, Emond Papegaaij
 
 emond.papega...@topicus.nl wrote:
  In our application we use quartz for long running jobs. These threads
  have access to the application context, which contains the wicket
  application. In the execute method, we locate the application and use
  Application.set and Application.unset to set and remove the application.
  This is, however, not a 'public API' and could easily be replaced by
  wrapping the main body in a Runnable and calling Application.wrap. I'm
  in favor of this wrap method. It allows you to set the application on a
  thread, without having to use non- public API, and without the
  try/finally hassle.
 
 What happens if you have multiple applications running in the same webapp?

Well, the answer is pretty simple: we only have one application per webapp. :)

If we wanted to supported multiple applications, we probably would pass the 
application in some way to the jobs (we already pass other information, such 
as the user starting the job).

  I do not care how this method is implemented (that's the beauty of a good
  API, isn't it?). It could store the application in the runnable, or look
  it up in a map, as long as it works reliably, I'm fine with it :)
 
 Right, we can figure out how to implement it later, but I think making
 this method available would be a huge step in the right direction.
 

Agreed.

Emond

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



Re: NonCachingImage and xhtmlRenderer

2010-05-27 Thread Xavier López
Sorry for double-posting, I'm attaching some of the code I'm using:

I havent't mentioned other static styling images are rendering correctly.


byte[] imageByteArray = generateBarCodeImage(...)
 ByteArrayResource resource = new ByteArrayResource(image/jpeg,
 imageByteArray);
 Image barcodeImage= new Image(barcode, resource){
 protected void onComponentTag(ComponentTag tag)
 {
 super.onComponentTag(tag);
 String url = tag.getAttributes().getString(src);
 url = url + ((url.indexOf(?) = 0) ? amp; : ?);
 url = url + wicket:antiCache= +
 System.currentTimeMillis();
 tag.put(src, url);
 }
 };
 barcodeImage.setMarkupId(barcodeImageId);
 barcodeImage.setOutputMarkupId(true);
 add(imatgeCodiBarres);
 .
 link = new Link(printPDF){
 private static final long serialVersionUID = 1L;
 @Override
 public void onClick() {
 try{
 String baseUrl = http://myapp/;;
 // Get the html to render into pdf
 String html = RenderHTMLUtils.renderPage(new
 PrintPage(...));
 DocumentBuilder builder =
 DocumentBuilderFactory.newInstance().newDocumentBuilder();
 Document doc = builder.parse(new
 ByteArrayInputStream(html.getBytes(UTF-8)));


 String src =
 doc.getElementById(barcodeImageId).getAttribute(src);
 src = baseUrl + src;

 doc.getElementById(barcodeImageId).setAttribute(src, src);

 ITextRenderer renderer = new ITextRenderer();
 renderer.setDocument(doc, baseUrl);


 RequestCycle.get().setRequestTarget(EmptyRequestTarget.getInstance());
 WebResponse response = (WebResponse)
 getResponse();
 response.setContentType(application/pdf);
 response.setAttachmentHeader(printout.pdf);
 response.setHeader(Cache-Control,
 max-age=0);
 OutputStream out = response.getOutputStream();
 renderer.layout();
 renderer.createPDF(out);
 }
 catch (Exception e){ }
 }
 };


2010/5/27 Xavier López xavil...@gmail.com

 Hi,

 I'm trying to use a xhtml to pdf renderer 
 (https://xhtmlrenderer.dev.http://goog_1283895835
 java.net/) in order to print out a page to PDF.

 The page contains a  NonCachingImage, with a barcode, in such a way that
 the image gets the following HTML :

 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN 
 http://www.w3.org/TR/xhtml11/DTD/xhtml11-flat.dtd;
 html xml:lang=ca xmlns=http://www.w3.org/1999/xhtml;
 ...
 img class=floatR
 src=?wicket:interface=:34:barcode::IResourceListener::wicket:antiCache=1274953227999/
 ...
 /html


 When parsing the html String into a org.w3c.dom.document, I get the
 following exception:

 org.xml.sax.SAXParseException: The reference to entity wicket:antiCache
 must end with the ';' delimiter.



 I know this is probably not a Wicket issue, and maybe has to do with the
 DTD used for validation, or something like that.
 I found somewhere this can get solved by changing the '' character in the
 URL by 'amp;'. That worked. Now I plan to override NonCachingImage's
 onComponentTag to append amp; instead of ''.

 That solved, I can't get the image to get rendered in the pdf document, in
 the html's DOM I have the img Element with the 'src' atttribute with value
 =http://myapp/?wicket:interface=:34:
 barcode::IResourceListener::wicket:antiCache=1274953227999, but
 Image#onResourceRequested() (which is the callback for that URL) never gets
 called during the render phase of the PDF...

 I'd really appreciate any hints on this one, I've been looking into the
 resources reference but I don't know if I should use it, or which
 implementation to use... The image resource is formed from a byte array.

 Many thanks,
 Xavier López




-- 
Klein bottle for rent--inquire within.


Re: [PROPOSAL] Application.runAs() Method...

2010-05-27 Thread Alex Objelean

Hi James!
It would be a good idea to add this feature to next release, since the
Application won't be stored in InheritableThreadLocal anymore. 

Alex
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PROPOSAL-Application-runAs-Method-tp2230030p2233184.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



resource model partially resolve key

2010-05-27 Thread Fernando Wermus
I got this message,

[Warning: String resource for 'Define el recorrido que harán' not found]

where '*Define el recorrido que harán*' is the string I do want to show
instead of *[Warning: String resource for 'Define el recorrido que harán'
not found]*. It seems that wicket is trying to reevaluate the key twice.

The model that resolves the string is,

public abstract class TituloReadOnlyModel extends AbstractReadOnlyModel{
...
   public Object getObject(){
 if (*someBoolean*){

*Application.get().getResourceSettings().getLocalizer().getString(desafio.crear,
wrappingComponent(), );*
 }else{

*Application.get().getResourceSettings().getLocalizer().getString(recorrido.crear,
wrappingComponent(), );*
 }
   }
   public abstract Component wrappingComponent();
}































-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus


Re: resource model partially resolve key

2010-05-27 Thread Igor Vaynberg
how is the TituloReadOnlyModel  used?

-igor

On Thu, May 27, 2010 at 8:22 AM, Fernando Wermus
fernando.wer...@gmail.com wrote:
 I got this message,

 [Warning: String resource for 'Define el recorrido que harán' not found]

 where '*Define el recorrido que harán*' is the string I do want to show
 instead of *[Warning: String resource for 'Define el recorrido que harán'
 not found]*. It seems that wicket is trying to reevaluate the key twice.

 The model that resolves the string is,

 public abstract class TituloReadOnlyModel extends AbstractReadOnlyModel{
 ...
       public Object getObject(){
             if (*someBoolean*){

 *Application.get().getResourceSettings().getLocalizer().getString(desafio.crear,
 wrappingComponent(), );*
             }else{

 *Application.get().getResourceSettings().getLocalizer().getString(recorrido.crear,
 wrappingComponent(), );*
             }
       }
       public abstract Component wrappingComponent();
 }































 --
 Fernando Wermus.

 www.linkedin.com/in/fernandowermus


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



Force toolbar to update on page refresh

2010-05-27 Thread sahuja

Hi,

I have a DefaultDataTable with a BottomToolbar that I wrote to display the
sum of amounts in each column of the table.

If the underlying data changes, and I press F5 to refresh the browser page,
the table reflects the data change, but the toolbar is not refreshed and
continues to display previous amounts.

Is there a way for me to force the toolbar to re-fetch data from its
DataProvider?

Thanks.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233347.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



Re: Force toolbar to update on page refresh

2010-05-27 Thread Igor Vaynberg
the toolbar does refetch the data on every request, the problem is you
are probably caching the data via an improper use of models.

-igor

On Thu, May 27, 2010 at 8:41 AM, sahuja sadhna.ah...@nisc.coop wrote:

 Hi,

 I have a DefaultDataTable with a BottomToolbar that I wrote to display the
 sum of amounts in each column of the table.

 If the underlying data changes, and I press F5 to refresh the browser page,
 the table reflects the data change, but the toolbar is not refreshed and
 continues to display previous amounts.

 Is there a way for me to force the toolbar to re-fetch data from its
 DataProvider?

 Thanks.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233347.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



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



Re: NonCachingImage and xhtmlRenderer

2010-05-27 Thread Xavier López
Finally, I've managed to dig through the XHtmlRenderer's code, and the IText
dependencies inside, and have encountered the root of the issue :

The problem is raised by the IText Image resource class, which tries to
detect the format of the image by peeking at the first bytes of the stream.
Getting into details, that piece of code receives an InputStream, obtained
from a new URL(source), where 'source' is the value of the 'src' attribute
in the img tag.

I've tried constructing that URL by myself, and peeking at the first bytes,
and have found that they do not match what it should be expected taking into
account the image's format (jpg - 0xFF, 0xD8). Instead, the first bytes
are: 0x3C, 0x21, 0x44, 0x4F.

I'm creating the Wicket image resource with a DynamicImageResource, and I've
checked that, when it's called, it returns the expected first bytes...

DynamicImageResource resource = new DynamicImageResource(jpg) {
@Override
protected byte[] getImageData() {
return generateBarCode();
}
};


And again, when I try this on the link's onClick:

link = new Link(printFullPagament){
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
try{

String srcImg = 
http://myapp/?wicket:interface=:34:
barcode::IResourceListener::wicket:antiCache=1274953227999;
java.io.InputStream is = new
URL(srcImg).openStream();
int c1 = is.read();
int c2 = is.read();
int c3 = is.read();
int c4 = is.read();
...
}

I don't seem to get DynamicImageResource#getImageData, nor any of the
methods it defines (getResourceState()), and get those values on the first
bytes ( 0x3C, 0x21, 0x44, 0x4F)

Does anyone know what may be happening here ?

Thanks a lot,
Xavier Lopez


2010/5/27 Xavier López xavil...@gmail.com

 Sorry for double-posting, I'm attaching some of the code I'm using:

 I havent't mentioned other static styling images are rendering correctly.


 byte[] imageByteArray = generateBarCodeImage(...)
 ByteArrayResource resource = new ByteArrayResource(image/jpeg,
 imageByteArray);
 Image barcodeImage= new Image(barcode, resource){
 protected void onComponentTag(ComponentTag tag)
 {
 super.onComponentTag(tag);
 String url = tag.getAttributes().getString(src);
 url = url + ((url.indexOf(?) = 0) ? amp; : ?);
 url = url + wicket:antiCache= +
 System.currentTimeMillis();
 tag.put(src, url);
 }
 };
 barcodeImage.setMarkupId(barcodeImageId);
 barcodeImage.setOutputMarkupId(true);
 add(imatgeCodiBarres);
 .
 link = new Link(printPDF){
 private static final long serialVersionUID = 1L;
 @Override
 public void onClick() {
 try{
 String baseUrl = http://myapp/;;
 // Get the html to render into pdf
 String html = RenderHTMLUtils.renderPage(new
 PrintPage(...));
 DocumentBuilder builder =
 DocumentBuilderFactory.newInstance().newDocumentBuilder();
 Document doc = builder.parse(new
 ByteArrayInputStream(html.getBytes(UTF-8)));


 String src =
 doc.getElementById(barcodeImageId).getAttribute(src);
 src = baseUrl + src;

 doc.getElementById(barcodeImageId).setAttribute(src, src);

 ITextRenderer renderer = new ITextRenderer();
 renderer.setDocument(doc, baseUrl);


 RequestCycle.get().setRequestTarget(EmptyRequestTarget.getInstance());
 WebResponse response = (WebResponse)
 getResponse();
 response.setContentType(application/pdf);
 response.setAttachmentHeader(printout.pdf);
 response.setHeader(Cache-Control,
 max-age=0);
 OutputStream out = response.getOutputStream();
 renderer.layout();
 renderer.createPDF(out);
 }
 catch (Exception e){ }
 }
 };


 2010/5/27 Xavier López xavil...@gmail.com

 Hi,

 I'm trying to use a xhtml to pdf renderer 
 (https://xhtmlrenderer.dev.http://goog_1283895835
 java.net/) in order to print out a page to PDF.

 The page contains a  NonCachingImage, with a barcode, in such a way that
 the image gets the following HTML :

 ?xml version=1.0 encoding=UTF-8?
 

Re: Force toolbar to update on page refresh

2010-05-27 Thread sahuja

Thanks, Igor. Copied below is the implementation for my toolbar. Could you
please take a look and see if you can spot a problem with it?

public class TotalsToolbar extends AbstractToolbar
{

public TotalsToolbar(final DataTable table, final IDataProvider
dataProvider)
{
super(table);

RepeatingView totals = new RepeatingView(totals);
add(totals);

AbstractReportingBean row =
(AbstractReportingBean)dataProvider.iterator(0, 1).next();
final IColumn[] columns = table.getColumns();
for (int i = 0; i  columns.length; i++)
{
final IColumn column = columns[i];

WebMarkupContainer item = new
WebMarkupContainer(totals.newChildId());
totals.add(item);

WebMarkupContainer total = new WebMarkupContainer(total);

item.add(total);
item.setRenderBodyOnly(true);

String val =
row.getStringForFieldNamed(column.getSortProperty());
if (val == null || val.length() == 0) {
val = nbsp;;
total.add(new Label(value,
val).setEscapeModelStrings(false));
} else
total.add(new Label(value, val));
 
}
}
}

This is how I add the toolbar to my table:

public class GrandTotalsDataTable extends DefaultDataTable {
public GrandTotalsDataTable(String id, final List columns,
ISortableDataProvider sortableDataProvider, IDataProvider
dataProvider,
int rowsPerPage)
{
super(id, columns, sortableDataProvider, rowsPerPage);
addBottomToolbar(new TotalsToolbar(this, dataProvider));
}

}


Thanks.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233368.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



How to test a link in wicket:links

2010-05-27 Thread cat-in-a-hat

Hi,

If I use wicket:link around a link, how can I click on it with
WicketTester.clickLink()? It don't have a wicket:id so what would the path
be?

Thanks/Peter
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-test-a-link-in-wicket-links-tp2233376p2233376.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



Re: Force toolbar to update on page refresh

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 10:53 AM, sahuja sadhna.ah...@nisc.coop wrote:


 Thanks, Igor. Copied below is the implementation for my toolbar. Could you
 please take a look and see if you can spot a problem with it?

 public class TotalsToolbar extends AbstractToolbar
 {

public TotalsToolbar(final DataTable table, final IDataProvider
 dataProvider)
{
super(table);

RepeatingView totals = new RepeatingView(totals);
add(totals);

AbstractReportingBean row =
 (AbstractReportingBean)dataProvider.iterator(0, 1).next();
final IColumn[] columns = table.getColumns();
for (int i = 0; i  columns.length; i++)
{
final IColumn column = columns[i];

WebMarkupContainer item = new
 WebMarkupContainer(totals.newChildId());
totals.add(item);

WebMarkupContainer total = new WebMarkupContainer(total);

item.add(total);
item.setRenderBodyOnly(true);

 *String val =
 row.getStringForFieldNamed(column.getSortProperty());
if (val == null || val.length() == 0) {
val = nbsp;;
total.add(new Label(value,
 val).setEscapeModelStrings(false));
} else
total.add(new Label(value, val));
 *
}
}
 }


You're not using a model for your label - so you are pushing data into it
on creation and never changing the data after it's initially created.  This
is easily learned / proven if you put a breakpoint there where you are
creating your label.

Actually, now that I look at it, you're also not using a model for your
columns in your toolbar.  I'm not sure what your AbstractReportingBean is,
but you will probably also need to change your RepeatingView to something
that takes an IModelList and creates the columns on the fly - or else
you'll get old data.

Here's an example for the Label - but you'll have to do the repeater on your
own.

total.add(new Label(value, new AbstractReadOnlyModelString() {
  String getObject() {
String val = row.getStringForFieldNamed(column.getSortProperty());;
return StringUtils.isEmpty(val) ? nbsp; : val;
  }
});
-- 
Jeremy Thomerson
http://www.wickettraining.com


Jetty, HSQLDB and automatic scanning

2010-05-27 Thread Jakub Skoczen
Hi Everyone,

First of all - this question is not directly concerned with Wicket,
sorry for that. But, I did came across this problem when developing a
small Wicket web app, so I thought someone else here may have had a
similar issue. So here it is: I got tired with the slow
write/compile/deploy process and I switched to using jetty:run (with
scanning interval set to 10s) and incrementally compiling the classes.
Unfortunately, right after jetty detects changes to the compiled class
and tries to redeploy the app I get the following HSQLDB exception:

java.sql.SQLException: The database is already in use by another
process: org.hsqldb.persist.niolockf...@7c137657[...] is presumably
locked by another process.

HSQLDB is run using the in-process mode and the following exception is
thrown both when using memory and file backend. It obviously looks
like HSQLDB is not releasing the lock during the auto redeployment,
maybe Jetty is locking up the thread somehow? Anyways, any ideas will
be greatly appreciated.
-- 

Cheers,
Jakub

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



Re: Force toolbar to update on page refresh

2010-05-27 Thread Igor Vaynberg
you dont need to use models per se as long as you are rebuilding your
component hierarchy on every request. RepeatingView does not do that.
so either use models like Jeremy said, or rebuild the component
hierarchy using a RefreshingView or a ListView

-igor

On Thu, May 27, 2010 at 9:10 AM, Jeremy Thomerson
jer...@wickettraining.com wrote:
 On Thu, May 27, 2010 at 10:53 AM, sahuja sadhna.ah...@nisc.coop wrote:


 Thanks, Igor. Copied below is the implementation for my toolbar. Could you
 please take a look and see if you can spot a problem with it?

 public class TotalsToolbar extends AbstractToolbar
 {

    public TotalsToolbar(final DataTable table, final IDataProvider
 dataProvider)
    {
        super(table);

        RepeatingView totals = new RepeatingView(totals);
        add(totals);

        AbstractReportingBean row =
 (AbstractReportingBean)dataProvider.iterator(0, 1).next();
        final IColumn[] columns = table.getColumns();
        for (int i = 0; i  columns.length; i++)
        {
            final IColumn column = columns[i];

            WebMarkupContainer item = new
 WebMarkupContainer(totals.newChildId());
            totals.add(item);

            WebMarkupContainer total = new WebMarkupContainer(total);

            item.add(total);
            item.setRenderBodyOnly(true);

 *                String val =
 row.getStringForFieldNamed(column.getSortProperty());
                if (val == null || val.length() == 0) {
                    val = nbsp;;
                    total.add(new Label(value,
 val).setEscapeModelStrings(false));
                } else
                    total.add(new Label(value, val));
 *
        }
    }
 }


 You're not using a model for your label - so you are pushing data into it
 on creation and never changing the data after it's initially created.  This
 is easily learned / proven if you put a breakpoint there where you are
 creating your label.

 Actually, now that I look at it, you're also not using a model for your
 columns in your toolbar.  I'm not sure what your AbstractReportingBean is,
 but you will probably also need to change your RepeatingView to something
 that takes an IModelList and creates the columns on the fly - or else
 you'll get old data.

 Here's an example for the Label - but you'll have to do the repeater on your
 own.

 total.add(new Label(value, new AbstractReadOnlyModelString() {
  String getObject() {
    String val = row.getStringForFieldNamed(column.getSortProperty());;
    return StringUtils.isEmpty(val) ? nbsp; : val;
  }
 });
 --
 Jeremy Thomerson
 http://www.wickettraining.com


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



Re: Jetty, HSQLDB and automatic scanning

2010-05-27 Thread Igor Vaynberg
you can add a servlet context listener that looks for the lock file
and nukes it.

alternatively you can use the Start class that comes with wicket
quickstart archetype/project that does what mvn jetty:run but with the
added benefit of allowing hotswapping, and in that class you can add
the code to nuke the lock file.

-igor

On Thu, May 27, 2010 at 9:57 AM, Jakub Skoczen skoc...@gmail.com wrote:
 Hi Everyone,

 First of all - this question is not directly concerned with Wicket,
 sorry for that. But, I did came across this problem when developing a
 small Wicket web app, so I thought someone else here may have had a
 similar issue. So here it is: I got tired with the slow
 write/compile/deploy process and I switched to using jetty:run (with
 scanning interval set to 10s) and incrementally compiling the classes.
 Unfortunately, right after jetty detects changes to the compiled class
 and tries to redeploy the app I get the following HSQLDB exception:

 java.sql.SQLException: The database is already in use by another
 process: org.hsqldb.persist.niolockf...@7c137657[...] is presumably
 locked by another process.

 HSQLDB is run using the in-process mode and the following exception is
 thrown both when using memory and file backend. It obviously looks
 like HSQLDB is not releasing the lock during the auto redeployment,
 maybe Jetty is locking up the thread somehow? Anyways, any ideas will
 be greatly appreciated.
 --

 Cheers,
 Jakub

 -
 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: [PROPOSAL] Application.runAs() Method...

2010-05-27 Thread Sven Meier

Hi all,

I don't think the proposed method is a good idea.

Why add a method to a framework which is not used *by* the framework?
Why can't you just create your own static helper method storing the 
application in an inheritable/non-inheritable thread local?
Why would anyone want to pass a web application object to another 
non-web thread?


My 3 questions.

Sven

On 05/27/2010 04:13 PM, Alex Objelean wrote:

Hi James!
It would be a good idea to add this feature to next release, since the
Application won't be stored in InheritableThreadLocal anymore.

Alex
   



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



Basic page routing

2010-05-27 Thread Mike Quilleash
Hi all,

I'm a new user to wicket.  I'd heard some good things about it so I thought I'd 
try it out for a mini-web project I have.

Using Wicket 1.4.18 and Java 6.  I have an existing application using Spring 
(@Autowired everywhere) and I want to use some of the existing spring beans.

In the short term I've got an existing set of static web pages done by a web 
designer as a template that I want to have the content driven from our DB.  
Wicket seemed like a good choice because it doesn't touch the view file much 
(add some wicket:id attributes).

I've got a basic Application up, running on embedded Jetty server, with a 
welcome page which use @SpringBean to inject a couple of beans.  That all works 
fine.

However I can't figure out how to get URLs other than / to work.  If I go 
http://localhost:9090/ it works ok, I get the welcome page and the Java 
executes.  If I go to http://localhost:9090/HomePage.html it renders the page 
but doesn't invoke the wicket Java component so the label doesn't get rendered 
with the correct text.  I'm sure this is incredibly basic, but how do I get 
this to work properly?

Cheers.


My Application and home page classes below + web.xml.


// application class
public class WebPortalApplication extends WebApplication
{
public Class? extends Page getHomePage()
{
return HomePage.class;
}

@Override
protected void init()
{
ClassPathXmlApplicationContext applicationContext = new 
ClassPathXmlApplicationContext( META-INF/config/spring/web-portal.xml );
applicationContext.start();

addComponentInstantiationListener( new SpringComponentInjector( this, 
applicationContext, false ) );
}
}


// home page
public class HomePage extends WebPage
{
@SpringBean
private HibernateOperations hibernateOperations;

public HomePage()
{
add( new Label( message, Hello World! ) );
}
}



// web.xml
?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app
  PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
  http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
display-nameWicket Examples/display-name
filter
filter-nameHelloWorldApplication/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
  param-nameapplicationClassName/param-name
  param-valuecom.xxx.webportal.WebPortalApplication/param-value
/init-param
/filter
filter-mapping
filter-nameHelloWorldApplication/filter-name
url-pattern/*/url-pattern
/filter-mapping
/web-app


Re: Force toolbar to update on page refresh

2010-05-27 Thread sahuja

Thanks for your suggestions, Jeremy and Igor.

I tried to use a ListView. With that I succeeded in refreshing the toolbar
on a bookmarkable page, but not a page that I navigated through the
Navigation Toolbar.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233646.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



Page in Page

2010-05-27 Thread Christian Märzinger

Hi!

How can I embedd a page in another page?

i have following Homepage

wicket
div id=header class=borderedBlock
table width=100%
header text
br /
header text 2
/table
/div
table width=100%
tr
td id=left class=borderedBlock
ul
div id=treeTablewicket:child //div
/ul
/td
td id=content class=borderedBlock
div id=map2wicket:child //div
/td
/tr
/table
div id=footer class=borderedBlock@ footer footer/div
/wicket

now i try to put a map in the content and a tree table at the left side
Thanks

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



Re: Page in Page

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 2:30 PM, Christian Märzinger 
christian.maerzin...@gmail.com wrote:

 Hi!

 How can I embedd a page in another page?

 i have following Homepage

 wicket
 div id=header class=borderedBlock
 table width=100%
header text
 br /
header text 2
 /table
 /div
 table width=100%
 tr
 td id=left class=borderedBlock
 ul
 div id=treeTablewicket:child //div
 /ul
 /td
 td id=content class=borderedBlock
 div id=map2wicket:child //div
 /td
 /tr
 /table
 div id=footer class=borderedBlock@ footer footer/div
 /wicket

 now i try to put a map in the content and a tree table at the left side
 Thanks

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


Wicket (just like Java) does not support multiple inheritance.  If you're
creating a base page that has two blocks that need to be filled in, you can:

1 - make one of them use the wicket:child tag - like you have done.  pages
that are subclasses will then wrap wicket:extend tags around their content,
and this will appear in the place of the wicket:child tag
2 - then, for the other location, use something like div
wicket:id=tree[tree]/div and in your base page java, do:
add(createTreeForThisPage(tree)), where createTreeForThisPage is defined
as protected abstract Component createTreeForThisPage(String id).  Pages
that extend this base page will be required to return the component for that
location.

Or, you can skip the inheritance and use #2 above for both locations on
the page.

-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: Force toolbar to update on page refresh

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 2:19 PM, sahuja sadhna.ah...@nisc.coop wrote:


 Thanks for your suggestions, Jeremy and Igor.

 I tried to use a ListView. With that I succeeded in refreshing the toolbar
 on a bookmarkable page, but not a page that I navigated through the
 Navigation Toolbar.
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233646.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


is your listview using a model that gets the columns on every repaint?  the
problem that you have is that your columns in your toolbar are only being
generated on the initial construction of the page.  please put a breakpoint
there so that you can see this.  then, try wrapping that in a model that
feeds the list view and watch your break point.  after every navigation
click, you should see the list of columns be regenerated.  if you don't,
it's still broken

-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: Force toolbar to update on page refresh

2010-05-27 Thread sahuja

Jeremy, I am not really sure what you mean by using a model that gets the
columns on every repaint, but here's how I have changed my code now.

public TotalsToolbar(final DataTable table, final IModel
dataProviderModel)
{
super(table);

WebMarkupContainer totals = new WebMarkupContainer(totals);
add(totals);

AbstractReportingBean row =
(AbstractReportingBean)dataProviderModel.getObject();

ListString totalList = new ArrayListString();
final IColumn[] columns = table.getColumns();
for (int i = 0; i  columns.length; i++)
{
   final IColumn column = columns[i];
   String val =
row.getStringForFieldNamed(column.getSortProperty());
   if (val == null || val.length() == 0) {
   val = nbsp;;
   }
   totalList.add(val);
}

ListView listView = new ListView(total, totalList){
protected void populateItem(ListItem item) {
String totalItem = (String) item.getModelObject();
item.add(new Label(value,
totalItem.getValue()).setEscapeModelStrings(false));
}
};

totals.add(listView);
return;
}

I changed the way I was creating my toolbar to use a model wrapped around
the data.

public GrandTotalsDataTable(String id, final List columns,
ISortableDataProvider sortableDataProvider, IDataProvider
dataProvider,
int rowsPerPage)
{
super(id, columns, sortableDataProvider, rowsPerPage);
addBottomToolbar(new TotalsToolbar(this,
dataProvider.model(dataProvider.iterator(0, 1).next(;
}

And, here is my markup for the TotalsToolbar:
wicket:panel
  tr
[span wicket:id=totals
  td wicket:id=total
  [span wicket:id=value[amount][/span
  /td
[/span
  /tr
/wicket:panel

(Changing the '' before span tags to display it).

BTW, I tried to put breakpoints like you suggested, but interestingly when I
hit F5, the debugger doesn't hit any of my code. I do see the table being
updated though...

Thanks.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233773.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



Re: Jetty, HSQLDB and automatic scanning

2010-05-27 Thread Peter Ertl
maybe you should properly shutdown hsqldb in Application#onDestroy() ...

Am 27.05.2010 um 19:00 schrieb Igor Vaynberg:

 you can add a servlet context listener that looks for the lock file
 and nukes it.
 
 alternatively you can use the Start class that comes with wicket
 quickstart archetype/project that does what mvn jetty:run but with the
 added benefit of allowing hotswapping, and in that class you can add
 the code to nuke the lock file.
 
 -igor
 
 On Thu, May 27, 2010 at 9:57 AM, Jakub Skoczen skoc...@gmail.com wrote:
 Hi Everyone,
 
 First of all - this question is not directly concerned with Wicket,
 sorry for that. But, I did came across this problem when developing a
 small Wicket web app, so I thought someone else here may have had a
 similar issue. So here it is: I got tired with the slow
 write/compile/deploy process and I switched to using jetty:run (with
 scanning interval set to 10s) and incrementally compiling the classes.
 Unfortunately, right after jetty detects changes to the compiled class
 and tries to redeploy the app I get the following HSQLDB exception:
 
 java.sql.SQLException: The database is already in use by another
 process: org.hsqldb.persist.niolockf...@7c137657[...] is presumably
 locked by another process.
 
 HSQLDB is run using the in-process mode and the following exception is
 thrown both when using memory and file backend. It obviously looks
 like HSQLDB is not releasing the lock during the auto redeployment,
 maybe Jetty is locking up the thread somehow? Anyways, any ideas will
 be greatly appreciated.
 --
 
 Cheers,
 Jakub
 
 -
 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



DropDownChoice problem

2010-05-27 Thread Matthieu

Hello,


I've a problem with the DropDownChoice (and maybe language?). 

I've a Panel who's rendering perfectly when i set the language in english
and not rendering when i set in french... 


The message from wicket :

WicketMessage: The component(s) below failed to render. A common problem is
that you have 
added a component in code but forgot to reference it in the markup (thus the
component will never be rendered).



1. [Component id = address_city]


Root cause:


org.apache.wicket.WicketRuntimeException: The component(s) below failed to
render. A common problem is that you 
have added a component in code but forgot to reference it in the markup
(thus the component will never be rendered).


1. [Component id = address_city]


My java code is :


final DropDownChoice cityChoice = new DropDownChoice(address_city, new
PropertyModel
(form.getModelObject(), city), cityList); (here you can see the
address_city)


final AjaxFormComponentUpdatingBehavior updatingBehavior2 = new
AjaxFormComponentUpdatingBehavior(

onchange) {

@Override

protected void onUpdate(AjaxRequestTarget target) {

getAddress(form, customer_address, cityChoice, 
the_map);

}

};

cityChoice.add(updatingBehavior2);


form.add(cityChoice);



My html code is :


\span wicket:id=address_border\input

wicket:id=address id=address class=address

title=an address in Belgium type=text /\select
wicket:id=address_city

I don't really understand why, anyone to explain me the problem?


Thank you.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-problem-tp2233814p2233814.html
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: [PROPOSAL] Application.runAs() Method...

2010-05-27 Thread James Carman
On Thu, May 27, 2010 at 2:20 PM, Sven Meier s...@meiers.net wrote:
 Hi all,

 I don't think the proposed method is a good idea.

 Why add a method to a framework which is not used *by* the framework?

Is @SpringBean used *by* the framework?

 Why can't you just create your own static helper method storing the
 application in an inheritable/non-inheritable thread local?

A thread local won't work for what we're trying to do, hence the long,
drawn-out discussion thread(s) we've been having recently.

 Why would anyone want to pass a web application object to another non-web
 thread?

Some folks like to use Wicket as a templating framework so that they
can generate emails with links in them that point to Wicket-managed
pages.

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



Re: Force toolbar to update on page refresh

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 3:55 PM, sahuja sadhna.ah...@nisc.coop wrote:


 Jeremy, I am not really sure what you mean by using a model that gets the
 columns on every repaint, but here's how I have changed my code now.

public TotalsToolbar(final DataTable table, final IModel
 dataProviderModel)
{
super(table);

WebMarkupContainer totals = new WebMarkupContainer(totals);
add(totals);

AbstractReportingBean row =
 (AbstractReportingBean)dataProviderModel.getObject();

ListString totalList = new ArrayListString();
 final IColumn[] columns = table.getColumns();
for (int i = 0; i  columns.length; i++)
{
   final IColumn column = columns[i];
String val =
 row.getStringForFieldNamed(column.getSortProperty());
   if (val == null || val.length() == 0) {
   val = nbsp;;
   }
totalList.add(val);
}

ListView listView = new ListView(total, totalList){
protected void populateItem(ListItem item) {
String totalItem = (String) item.getModelObject();
item.add(new Label(value,
 totalItem.getValue()).setEscapeModelStrings(false));
}
};

totals.add(listView);
return;
}

 I changed the way I was creating my toolbar to use a model wrapped around
 the data.

public GrandTotalsDataTable(String id, final List columns,
ISortableDataProvider sortableDataProvider, IDataProvider
 dataProvider,
int rowsPerPage)
{
super(id, columns, sortableDataProvider, rowsPerPage);
addBottomToolbar(new TotalsToolbar(this,
 dataProvider.model(dataProvider.iterator(0, 1).next(;
}

 And, here is my markup for the TotalsToolbar:
 wicket:panel
  tr
[span wicket:id=totals
  td wicket:id=total
  [span wicket:id=value[amount][/span
  /td
[/span
  /tr
 /wicket:panel

 (Changing the '' before span tags to display it).

 BTW, I tried to put breakpoints like you suggested, but interestingly when
 I
 hit F5, the debugger doesn't hit any of my code. I do see the table being
 updated though...


This is the whole point.  You are only constructing that list of values when
the table is instantiated - which only happens on the initial view.  This is
why you don't hit breakpoints when you click a navigation link.
 Understanding this is key to using Wicket correctly - so make sure that by
the end of this exercise you have learned enough to understand what I'm
saying.

In your constructor, you are creating a list of values.  This is wrong.
 Instead, you need to do this:

IModelListString model = new LoadableDetachableModelListString() {
  ListString load() {
// move all of that list generation code here so that it is re-created
on every request
  }
};
new ListView(idhere, model) {
  // populateItem, etc goes here
}



-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: wicket file upload

2010-05-27 Thread jbrookover

If this mysterious server environment happens to be Google App Engine, there
is already some code floating around (@author uudashr) that manages file
uploads seamlessly with the datastore.

Jake
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2233852.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



RE: Page in Page

2010-05-27 Thread Chris Colman
 Wicket (just like Java) does not support multiple inheritance.  If
you're
 creating a base page that has two blocks that need to be filled in,
you
 can:

I agree that wicket shouldn't support multiple inheritance but I'm not
sure that what is required here is multiple inheritance.

In the wicket parallel universe multiple inheritance would be
represented by  one page extending from multiple base pages but that's
not what is required here and that would indeed be a bad path to trod.

What I have had the need for many times is for a base page to have
multiple overridable 'sections' - one base page but multiple sections
within that page that could be overridden (or not) by pages that extend
that page. This does not represent multiple inheritance. It is the
equivalent of Java allowing multiple overridable methods in a single
base class. In Java classes that extend the base class can override one
or more of the virtual (non final) methods in the base class but the
same rule applies - any class/page can only extend a single base
class/page.

The constraint that wicket has now is that only one section of a page
can be overridden by the 'limit of one' child/extend wicket tags. As
only one overridable section is currently allowed in wicket there is no
need to identify it. If wicket were to allow multiple sections in a base
page to be overridden in derived pages then a simple identification
scheme would be required - much like Java uses method signatures to
identify the methods that are being overridden.

Eg.,

BasePage.html:
body

  div id=container
wicket:section id=header
!-- markup will be used if no derived page overrides it
--.
h1my website/h1.
/wicket:section

hr /

wicket:section id=body
!-- a derived page should override this --
/wicket;section

hr /

!-- footer same for every page - no overriding --
div class=footer
pcopyright 2010 acme corp/p
/div

  /div
/body

WelcomePage.html:
body
!-- happy to use base page's header so no header section
override --

wicket:section id=body
h1Welcome to my website!/h1

My website is the best because it uses wicket!
/wicket:section
/body

Note how I've used the same tag 'section' in both base and extended
pages to avoid the obvious issue that occurs should someone extend the
WelcomePage.html above. Ie. When inheritance is chained over more than
two levels. In that case it becomes very wrong to specify whether a
section is 'overriding' (extend) or can be overridden (child). Much like
in Java inheritance you don't specify each method as being a 'child' or
'extension'. Instead, the mere presence of a method with identical
signature as in a base class indicates that that method is overriding
the base class method. That would seem an obvious model for overridable
markup sections in wicket also.

This idea/issue has been raised a few times before in this list and once
a remarkably small patch was even developed that would enable this to
work.

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



Re: Page in Page

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 5:33 PM, Chris Colman
chr...@stepaheadsoftware.comwrote:

  Wicket (just like Java) does not support multiple inheritance.  If
 you're
  creating a base page that has two blocks that need to be filled in,
 you
  can:

 I agree that wicket shouldn't support multiple inheritance but I'm not
 sure that what is required here is multiple inheritance.

 In the wicket parallel universe multiple inheritance would be
 represented by  one page extending from multiple base pages but that's
 not what is required here and that would indeed be a bad path to trod.

 What I have had the need for many times is for a base page to have
 multiple overridable 'sections' - one base page but multiple sections
 within that page that could be overridden (or not) by pages that extend
 that page. This does not represent multiple inheritance. It is the
 equivalent of Java allowing multiple overridable methods in a single
 base class. In Java classes that extend the base class can override one
 or more of the virtual (non final) methods in the base class but the
 same rule applies - any class/page can only extend a single base
 class/page.

 The constraint that wicket has now is that only one section of a page
 can be overridden by the 'limit of one' child/extend wicket tags. As
 only one overridable section is currently allowed in wicket there is no
 need to identify it. If wicket were to allow multiple sections in a base
 page to be overridden in derived pages then a simple identification
 scheme would be required - much like Java uses method signatures to
 identify the methods that are being overridden.

 Eg.,

 BasePage.html:
 body

  div id=container
wicket:section id=header
!-- markup will be used if no derived page overrides it
 --.
h1my website/h1.
/wicket:section

hr /

wicket:section id=body
!-- a derived page should override this --
/wicket;section

hr /

!-- footer same for every page - no overriding --
div class=footer
pcopyright 2010 acme corp/p
/div

  /div
 /body

 WelcomePage.html:
 body
!-- happy to use base page's header so no header section
 override --

wicket:section id=body
h1Welcome to my website!/h1

My website is the best because it uses wicket!
/wicket:section
 /body

 Note how I've used the same tag 'section' in both base and extended
 pages to avoid the obvious issue that occurs should someone extend the
 WelcomePage.html above. Ie. When inheritance is chained over more than
 two levels. In that case it becomes very wrong to specify whether a
 section is 'overriding' (extend) or can be overridden (child). Much like
 in Java inheritance you don't specify each method as being a 'child' or
 'extension'. Instead, the mere presence of a method with identical
 signature as in a base class indicates that that method is overriding
 the base class method. That would seem an obvious model for overridable
 markup sections in wicket also.

 This idea/issue has been raised a few times before in this list and once
 a remarkably small patch was even developed that would enable this to
 work.

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


And how is your proposed solution any different than the solution that I
gave you (putting div wicket:id=body[body]/div in your markup and
creating an abstract method that child classes must implement)?  It's
exactly the same except that now people would have to learn a new
wicket:section tag.  This doesn't make sense and it strays from Wicket's
just java / just html motto.  The two solutions are functionally the same
and only cosmetically different.

-- 
Jeremy Thomerson
http://www.wickettraining.com


Very interesting question... my boss complain about one of my implementations...

2010-05-27 Thread Victor_Trapiello

Hello guys!

I had a terrible day because one of my bosses complain about how I have done
one task of a project, we had to implement something that updates a field
in the database, my brilliant idea was to create a thread inside the wicket
init method that makes a query to the database every 3 hours and updates the
fields.

My boss said that it is not a good practice and he recomended  to use
something like in Struts called Timers, do we have something like that in
wickets¿?

how can I implement this behaviour without  a thread¿? I mean something that
is executing since my application is deployed and executing a method every N
time!!

thank you very much guys, I go to sleep in Spain it is 1.00 AM and tomorrow
I have to go to work!!

Waiting some feedback

Cheers!!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2233874.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



Re: Very interesting question... my boss complain about one of my implementations...

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 5:46 PM, Victor_Trapiello vic...@trapiello.netwrote:


 Hello guys!

 I had a terrible day because one of my bosses complain about how I have
 done
 one task of a project, we had to implement something that updates a field
 in the database, my brilliant idea was to create a thread inside the wicket
 init method that makes a query to the database every 3 hours and updates
 the
 fields.

 My boss said that it is not a good practice and he recomended  to use
 something like in Struts called Timers, do we have something like that in
 wickets¿?

 how can I implement this behaviour without  a thread¿? I mean something
 that
 is executing since my application is deployed and executing a method every
 N
 time!!

 thank you very much guys, I go to sleep in Spain it is 1.00 AM and tomorrow
 I have to go to work!!

 Waiting some feedback

 Cheers!!
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2233874.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


Does the update to the database have anything to do with the webapp?  Or
is it something totally unrelated?  You don't really give us enough
information to go on.

Struts timers (at least the ones I know of) are for timing how long a
webpage takes to render.  Perhaps he's confused with TimerTasks, which are
in Java, not Struts.

-- 
Jeremy Thomerson
http://www.wickettraining.com


Status of wicket-security

2010-05-27 Thread Marek Šabo
Hi,

I would like to know what's the status of wicket-security. I've been
using it for couple of months but only for simple tasks. I would like to
dig deeper but there is like on getting started and few mailing list
entries.
Is there someone who works on the project or is it fading? If so, what
is the common choice for AA layer in wicket apps besides Spring Security?

Regards,

-- 
Marek Šabo


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



Re: Status of wicket-security

2010-05-27 Thread Jeremy Thomerson
See the second message at this link (the one from Martijn):
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-upgrade-dependent-on-Wicket-Security-1-4-td2031552.html

Jeremy

On Thu, May 27, 2010 at 6:30 PM, Marek Šabo ms...@buk.cvut.cz wrote:

 Hi,

 I would like to know what's the status of wicket-security. I've been
 using it for couple of months but only for simple tasks. I would like to
 dig deeper but there is like on getting started and few mailing list
 entries.
 Is there someone who works on the project or is it fading? If so, what
 is the common choice for AA layer in wicket apps besides Spring Security?

 Regards,

 --
 Marek Šabo


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




-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: Very interesting question... my boss complain about one of my implementations...

2010-05-27 Thread gnul
On Thu, May 27, 2010 at 5:16 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:
 On Thu, May 27, 2010 at 5:46 PM, Victor_Trapiello vic...@trapiello.netwrote:


 Hello guys!

 I had a terrible day because one of my bosses complain about how I have
 done
 one task of a project, we had to implement something that updates a field
 in the database, my brilliant idea was to create a thread inside the wicket
 init method that makes a query to the database every 3 hours and updates
 the
 fields.

 My boss said that it is not a good practice and he recomended  to use
 something like in Struts called Timers, do we have something like that in
 wickets¿?

 how can I implement this behaviour without  a thread¿? I mean something
 that
 is executing since my application is deployed and executing a method every
 N
 time!!

 thank you very much guys, I go to sleep in Spain it is 1.00 AM and tomorrow
 I have to go to work!!

 Waiting some feedback

 Cheers!!
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2233874.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


 Does the update to the database have anything to do with the webapp?  Or
 is it something totally unrelated?  You don't really give us enough
 information to go on.

 Struts timers (at least the ones I know of) are for timing how long a
 webpage takes to render.  Perhaps he's confused with TimerTasks, which are
 in Java, not Struts.

 --
 Jeremy Thomerson
 http://www.wickettraining.com


I also do not understand how the timer is related to the web application.

If you are using some logic to update the database every N time,
then I suggest using Quartz:
  https://quartz.dev.java.net/
  http://www.quartz-scheduler.org/overview/index.html

We implement a quartz task that runs every 15 minutes to pull data
over a third party API and update our database.  Wicket, like any web
application, displays the updated information on the next
[LoadableDetachableModel] data refresh which satisfies our
requirements. (If you use an ApplicationContext (e.g. Spring) you
could even update a local cache / cache cluster (e.g ehcache).)

The only tricky part of Quartz has been deploying it properly on an
application cluster -- to avoid having the same scheduled tasks run
simultaneously.  If you have a backend app server you can purpose
running scheduled tasks on, then it is simple.

 -gnul

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



using injected services in a child thread

2010-05-27 Thread Douglas Ferguson
I'm using 1.4.8 (not the ITL version).

I have pass a runnable to an executer, how can I make use of classes that use 
@Inject?

When I try to do so, it blows up saying There is no application attached to 
current thread pool-13-thread-1

The confusing thing is that I inject 2 DAOs and 1 service. The 2DAOs work just 
fine but the service blows up.

I've tried these combinations:

1) @Inject into the page and then pass the reference to the constructor of the 
runnable
2) Construct the service in the Runnable and call 
@InjectorHolder.getInjector().inject(service)

Neither works.

D/


Re: Very interesting question... my boss complain about one of my implementations...

2010-05-27 Thread Eelco Hillenius
 I had a terrible day because one of my bosses complain about how I have
 done
 one task of a project, we had to implement something that updates a field
 in the database, my brilliant idea was to create a thread inside the wicket
 init method that makes a query to the database every 3 hours and updates
 the
 fields.

I don't think it is horrible, though it sounds a bit like a quick fix.
It doesn't have to do with your web application of course, though
Wicket's application object is a natural place to do bootstrapping.

 Struts timers (at least the ones I know of) are for timing how long a
 webpage takes to render.  Perhaps he's confused with TimerTasks, which are
 in Java, not Struts.

I think that in general using TimerTask is better than just spawning
of a thread.

 If you are using some logic to update the database every N time,
 then I suggest using Quartz:
  https://quartz.dev.java.net/
  http://www.quartz-scheduler.org/overview/index.html

And using Quartz is even better.

 The only tricky part of Quartz has been deploying it properly on an
 application cluster -- to avoid having the same scheduled tasks run
 simultaneously.  If you have a backend app server you can purpose
 running scheduled tasks on, then it is simple.

Quartz does the job, and for my work I created a nice Guice
abstraction for it, but I've never been crazy about the API and
implementation (though it's stable and reasonably efficient). I wonder
if anyone has any real life experience with
http://sna-projects.com/azkaban they want to share?

Eelco

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



Wicket clustering without web server clustering

2010-05-27 Thread DmitryM

Hello, guys

I need your advice for the following case.
The Wicket application I'm working on is supposed to be deployed to Amazon
EC2 cloud. This way standard Tomcat (used as a webapp container) clustering
won't work (cloud doesn't accept multicasts). There is a third-party session
manager available for Tomcat but it still needs sticky sessions from the
load balancer (which is not conceptually good for app scaling).

I tried Hazelcast distributed data support (which allows for TCP unicasts)
as a PageStore implementation (thanks this blog post:
http://wicketbyexample.com/apache-wicket-clustering-with-multiple-options/)
It works fine but needs session clustering (though Hazelcast makes PageStore
available for each webapp instance already which seems to be an overhead.
And I would like to use Hazelcast alone for this kind of 'clustering').

My question is about non-sticky sessions w/o clustering. I can try to extend
SecondLevelCacheSessionStore to get the PageStore/page map etc. from
Hazelcast and stick it to a newly created session (when load balancer
forwards a request to the server which is different from the session's
original server).

But do I need to try to transfer something else except for the PageMap to
the fresh session (the webapp doesn't store anything in the Http session
directly)?

I mean, does Wicket store anything else for its functional purposes in the
Http Session (which I may need to distribute via Hazelcast)?

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-clustering-without-web-server-clustering-tp2234048p2234048.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



custom html page

2010-05-27 Thread msalman

Hi,

Is it possible for a Page to have to have customized html files depending on
certain parameter (user, customer, etc)?  I want to allow users to for a
certain page to be able to provide their own html file for that page or
panel.  So depending on the user or customer id I can pick up the right html
file and use that.  

I tried to do this in the my ResourceStreamLocator extension class but I
can't get the session object there.  I guess that is the place to set the
html location for the application.

I also found this code on the web.  The problem with it is that the
markupStream object passed in is null.

@Override 
protected void onRender(MarkupStream markupStream) 
{ 
markupStream.next(); 
try 
{ 
WebRequestCycle cycle = (WebRequestCycle)RequestCycle.get(); 
ServletRequest request =
cycle.getWebRequest().getHttpServletRequest(); 
ServletResponse response =
cycle.getWebResponse().getHttpServletResponse(); 


ServletContext context =
((WebApplication)getApplication()).getServletContext();
RequestDispatcher rd =
context.getRequestDispatcher(/com/michni/wicket/../specificsupplier_custom.html);
rd.include(request, response);

//context.getRequestDispatcher(/ + getId() +
.html).include(request, response); 
} 
catch (Exception e) 
{ 
throw new WicketRuntimeException(e); 
} 
} 



Any ideas or suggestions please?

Thanks,

-Mohammad
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-html-page-tp2234086p2234086.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



RE: Page in Page

2010-05-27 Thread Chris Colman
I think the concepts are very different. The opinion that they are
effectively the same was raised in the earlier discussion (probably more
than a year ago). 

Your suggestion involved using child/extend for one of the overridable
sections and then doing the other section with 

div wicket:id=body[body]/div

If it's just as good or just as easy to implement using the later option
then why not do both with the later suggestion? The reason they are
different is that the later is not true markup inheritance.

A child/extend section is indeed true markup inheritance, albeit, we're
currently constrained to a single inheritable/overridable section per
page but as was agreed a year ago limiting wicket to a single overidable
section  was an 'arbitrary constraint' and has nothing to do with
maintaining a single inheritance model. A single inheritance model only
imposes the constraint that each page directly extends only one other
page and that constraint is clearly not violated by having multiple
overridable sections.

-Original Message-
From: Jeremy Thomerson [mailto:jer...@wickettraining.com]
Sent: Friday, 28 May 2010 8:40 AM
To: users@wicket.apache.org
Subject: Re: Page in Page

On Thu, May 27, 2010 at 5:33 PM, Chris Colman
chr...@stepaheadsoftware.comwrote:

  Wicket (just like Java) does not support multiple inheritance.  If
 you're
  creating a base page that has two blocks that need to be filled in,
 you
  can:

 I agree that wicket shouldn't support multiple inheritance but I'm
not
 sure that what is required here is multiple inheritance.

 In the wicket parallel universe multiple inheritance would be
 represented by  one page extending from multiple base pages but
that's
 not what is required here and that would indeed be a bad path to
trod.

 What I have had the need for many times is for a base page to have
 multiple overridable 'sections' - one base page but multiple sections
 within that page that could be overridden (or not) by pages that
extend
 that page. This does not represent multiple inheritance. It is the
 equivalent of Java allowing multiple overridable methods in a single
 base class. In Java classes that extend the base class can override
one
 or more of the virtual (non final) methods in the base class but the
 same rule applies - any class/page can only extend a single base
 class/page.

 The constraint that wicket has now is that only one section of a page
 can be overridden by the 'limit of one' child/extend wicket tags. As
 only one overridable section is currently allowed in wicket there is
no
 need to identify it. If wicket were to allow multiple sections in a
base
 page to be overridden in derived pages then a simple identification
 scheme would be required - much like Java uses method signatures to
 identify the methods that are being overridden.

 Eg.,

 BasePage.html:
 body

  div id=container
wicket:section id=header
!-- markup will be used if no derived page overrides
it
 --.
h1my website/h1.
/wicket:section

hr /

wicket:section id=body
!-- a derived page should override this --
/wicket;section

hr /

!-- footer same for every page - no overriding --
div class=footer
pcopyright 2010 acme corp/p
/div

  /div
 /body

 WelcomePage.html:
 body
!-- happy to use base page's header so no header section
 override --

wicket:section id=body
h1Welcome to my website!/h1

My website is the best because it uses wicket!
/wicket:section
 /body

 Note how I've used the same tag 'section' in both base and extended
 pages to avoid the obvious issue that occurs should someone extend
the
 WelcomePage.html above. Ie. When inheritance is chained over more
than
 two levels. In that case it becomes very wrong to specify whether a
 section is 'overriding' (extend) or can be overridden (child). Much
like
 in Java inheritance you don't specify each method as being a 'child'
or
 'extension'. Instead, the mere presence of a method with identical
 signature as in a base class indicates that that method is overriding
 the base class method. That would seem an obvious model for
overridable
 markup sections in wicket also.

 This idea/issue has been raised a few times before in this list and
once
 a remarkably small patch was even developed that would enable this to
 work.

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


And how is your proposed solution any different than the solution that
I
gave you (putting div wicket:id=body[body]/div in your markup and
creating an abstract method that child classes must implement)?  It's
exactly the same except that now people would have to learn a new
wicket:section tag.  This doesn't make sense and it strays from
Wicket's
just 

Re: custom html page

2010-05-27 Thread Martin Makundi
Hi!

You can always get session ((CastToYourSession) Session.get())

Also wicket has few built-in ways to vary the style of your application:
* https://cwiki.apache.org/WICKET/localization-and-skinning-of-applications.html
* 
http://javathoughts.capesugarbird.com/2007/08/branding-wicket-application-take-2.html

**
Martin


2010/5/28 msalman mohammad_sal...@yahoo.com:

 Hi,

 Is it possible for a Page to have to have customized html files depending on
 certain parameter (user, customer, etc)?  I want to allow users to for a
 certain page to be able to provide their own html file for that page or
 panel.  So depending on the user or customer id I can pick up the right html
 file and use that.

 I tried to do this in the my ResourceStreamLocator extension class but I
 can't get the session object there.  I guess that is the place to set the
 html location for the application.

 I also found this code on the web.  The problem with it is that the
 markupStream object passed in is null.

 @Override
    protected void onRender(MarkupStream markupStream)
        {
        markupStream.next();
        try
        {
            WebRequestCycle cycle = (WebRequestCycle)RequestCycle.get();
            ServletRequest request =
 cycle.getWebRequest().getHttpServletRequest();
            ServletResponse response =
 cycle.getWebResponse().getHttpServletResponse();


            ServletContext context =
 ((WebApplication)getApplication()).getServletContext();
            RequestDispatcher rd =
 context.getRequestDispatcher(/com/michni/wicket/../specificsupplier_custom.html);
            rd.include(request, response);

            //context.getRequestDispatcher(/ + getId() +
 .html).include(request, response);
        }
        catch (Exception e)
        {
            throw new WicketRuntimeException(e);
        }
    }



 Any ideas or suggestions please?

 Thanks,

 -Mohammad
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/custom-html-page-tp2234086p2234086.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



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



Re: Page in Page

2010-05-27 Thread Jeremy Thomerson
On Fri, May 28, 2010 at 12:08 AM, Chris Colman chr...@stepaheadsoftware.com
 wrote:

 I think the concepts are very different. The opinion that they are
 effectively the same was raised in the earlier discussion (probably more
 than a year ago).

 Your suggestion involved using child/extend for one of the overridable
 sections and then doing the other section with

 div wicket:id=body[body]/div

 If it's just as good or just as easy to implement using the later option
 then why not do both with the later suggestion? The reason they are
 different is that the later is not true markup inheritance.

 A child/extend section is indeed true markup inheritance, albeit, we're
 currently constrained to a single inheritable/overridable section per
 page but as was agreed a year ago limiting wicket to a single overidable
 section  was an 'arbitrary constraint' and has nothing to do with
 maintaining a single inheritance model. A single inheritance model only
 imposes the constraint that each page directly extends only one other
 page and that constraint is clearly not violated by having multiple
 overridable sections.

 -Original Message-
 From: Jeremy Thomerson [mailto:jer...@wickettraining.com]
 Sent: Friday, 28 May 2010 8:40 AM
 To: users@wicket.apache.org
 Subject: Re: Page in Page
 
 On Thu, May 27, 2010 at 5:33 PM, Chris Colman
 chr...@stepaheadsoftware.comwrote:
 
   Wicket (just like Java) does not support multiple inheritance.  If
  you're
   creating a base page that has two blocks that need to be filled in,
  you
   can:
 
  I agree that wicket shouldn't support multiple inheritance but I'm
 not
  sure that what is required here is multiple inheritance.
 
  In the wicket parallel universe multiple inheritance would be
  represented by  one page extending from multiple base pages but
 that's
  not what is required here and that would indeed be a bad path to
 trod.
 
  What I have had the need for many times is for a base page to have
  multiple overridable 'sections' - one base page but multiple sections
  within that page that could be overridden (or not) by pages that
 extend
  that page. This does not represent multiple inheritance. It is the
  equivalent of Java allowing multiple overridable methods in a single
  base class. In Java classes that extend the base class can override
 one
  or more of the virtual (non final) methods in the base class but the
  same rule applies - any class/page can only extend a single base
  class/page.
 
  The constraint that wicket has now is that only one section of a page
  can be overridden by the 'limit of one' child/extend wicket tags. As
  only one overridable section is currently allowed in wicket there is
 no
  need to identify it. If wicket were to allow multiple sections in a
 base
  page to be overridden in derived pages then a simple identification
  scheme would be required - much like Java uses method signatures to
  identify the methods that are being overridden.
 
  Eg.,
 
  BasePage.html:
  body
 
   div id=container
 wicket:section id=header
 !-- markup will be used if no derived page overrides
 it
  --.
 h1my website/h1.
 /wicket:section
 
 hr /
 
 wicket:section id=body
 !-- a derived page should override this --
 /wicket;section
 
 hr /
 
 !-- footer same for every page - no overriding --
 div class=footer
 pcopyright 2010 acme corp/p
 /div
 
   /div
  /body
 
  WelcomePage.html:
  body
 !-- happy to use base page's header so no header section
  override --
 
 wicket:section id=body
 h1Welcome to my website!/h1
 
 My website is the best because it uses wicket!
 /wicket:section
  /body
 
  Note how I've used the same tag 'section' in both base and extended
  pages to avoid the obvious issue that occurs should someone extend
 the
  WelcomePage.html above. Ie. When inheritance is chained over more
 than
  two levels. In that case it becomes very wrong to specify whether a
  section is 'overriding' (extend) or can be overridden (child). Much
 like
  in Java inheritance you don't specify each method as being a 'child'
 or
  'extension'. Instead, the mere presence of a method with identical
  signature as in a base class indicates that that method is overriding
  the base class method. That would seem an obvious model for
 overridable
  markup sections in wicket also.
 
  This idea/issue has been raised a few times before in this list and
 once
  a remarkably small patch was even developed that would enable this to
  work.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 And how is your proposed solution any different than the solution that
 I
 gave you (putting div wicket:id=body[body]/div in your markup 

Re: Displaying message from ConversionException

2010-05-27 Thread Jeremy Thomerson
On Wed, May 26, 2010 at 3:09 AM, Michal Jedynak m.jedy...@gmail.com wrote:


 Hello.

 Iv'e got a TextField that uses my custom converter which throws several
 ConversionException with different messages.
 How can I display a message of the exception on a page? In my properties
 file I've got a property 'form.component.IConverter' which shows
 message that I define, but I don't know how to put there a message from the
 exception. Variable ${exception} displays a full stack trace of the
 exception.
 Is there a way to get only message from it?

 --
 Michal
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Displaying-message-from-ConversionException-tp2231197p2231197.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


Extend AbstractValidator, call error(final IValidatableT validatable,
final String resourceKey, MapString, Object vars) and build that map with
whatever variables you want to be able to inject into your message.  See how
PatternValidator does it for an example.

-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: change (redirect) the markup html file

2010-05-27 Thread Jeremy Thomerson
On Wed, May 26, 2010 at 8:08 AM, Daniel Aschauer
daniel.ascha...@gmail.comwrote:

 Thanks!

 But, I don't have a setStyle in WebPage-class, there is a
 setStyle-method only in ResourceReference?
 How could I use this?


Sorry, I forgot that setStyle is only on the session for page-level styling.
 I suppose the best bet may be to use that parameter to either refer to
different fragments within the page or else different panels, each with
their own markup.

-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: Wicket clustering without web server clustering

2010-05-27 Thread Jeremy Thomerson
On Thu, May 27, 2010 at 10:40 PM, DmitryM nsk...@aol.com wrote:


 Hello, guys

 I need your advice for the following case.
 The Wicket application I'm working on is supposed to be deployed to Amazon
 EC2 cloud. This way standard Tomcat (used as a webapp container) clustering
 won't work (cloud doesn't accept multicasts). There is a third-party
 session
 manager available for Tomcat but it still needs sticky sessions from the
 load balancer (which is not conceptually good for app scaling).

 I tried Hazelcast distributed data support (which allows for TCP unicasts)
 as a PageStore implementation (thanks this blog post:
 http://wicketbyexample.com/apache-wicket-clustering-with-multiple-options/
 )
 It works fine but needs session clustering (though Hazelcast makes
 PageStore
 available for each webapp instance already which seems to be an overhead.
 And I would like to use Hazelcast alone for this kind of 'clustering').

 My question is about non-sticky sessions w/o clustering. I can try to
 extend
 SecondLevelCacheSessionStore to get the PageStore/page map etc. from
 Hazelcast and stick it to a newly created session (when load balancer
 forwards a request to the server which is different from the session's
 original server).

 But do I need to try to transfer something else except for the PageMap to
 the fresh session (the webapp doesn't store anything in the Http session
 directly)?

 I mean, does Wicket store anything else for its functional purposes in the
 Http Session (which I may need to distribute via Hazelcast)?

 Thanks,
 Dmitry
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-clustering-without-web-server-clustering-tp2234048p2234048.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


A lot of stuff is stored in the session:

https://svn.apache.org/repos/asf/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java


-- 
Jeremy Thomerson
http://www.wickettraining.com