[OT] Annotating plaintext with markup tags

2010-05-13 Thread Kaspar Fischer
Hi everybody,

I need to annotate spans of a given plaintext with markup tags, for example:

  Tagger t = new Tagger(I need a library to annotate plaintext.);
  // Character indices:  0123456789012345678901234567890123456789
  t.annotate(0, 1, i);
  t.annotate(2, 16, a, href=\#\);
  t.annotate(9, 19, b);
  System.out.println(t.toString());
  // Output:
  // iI/i a href=#need a blibrary/b/ab to/b ...
  // Or even better:
  // iI/i a href=#need a blibrary/b/ab class=split to/b ...

Before reinventing the wheel, does anybody know of a class/library to achieve 
this?

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



Re: Asynchronous construction of page

2010-01-04 Thread Kaspar Fischer

On 02.11.2009, at 22:59, Igor Vaynberg wrote:

 if you want nonblocking you have to make each thing you are trying to
 load asynchronously its own page inside an iframe.
 
 the page itself can only be accessed synchronously, otherwise you
 would have to do your own multithreaded access handling in
 components...which would be horrific.
 
 -igor

I need to bring this topic up once more.

My current solution is to do the background processing in a separate thread and 
install a timer on the page to poll until the panel's content is ready. The 
resulting code is ok but feels heavy and unnatural. I would prefer a simpler 
solution. (I could not use iframes because they CSS does not have enough 
control over them.)

If I understand correctly, several pages can load asynchronously because only 
the state within a page is protected with synchronization. If so, can't one 
introduce a stateless component that lives in its own dummy page? I have the 
hope that if this is done nicely and the dummy page is abstracted away, it 
would feel much more natural to code asynchronous loading.

For example, such a LazyComponent would be constructed with the name of a 
wicket fragment. When rendered, it displays whatever markup has been add()'ed 
to the component (loading). When rendered, it makes an AJAX request to load 
the wicket fragment, which under the hood sits in a dummy page. I don't know 
enough about Wicket right now to code this so I want to ask whether this is 
possible and if yes, how this idea can be improved and whether somebody would 
be available with a few pointers to get me started.

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



Re: Asynchronous construction of page

2009-11-28 Thread Kaspar Fischer
Because the requests will be sequential (a problem in general but not so much 
in my case) and because I have an auto-completion field on the same page. As I 
understand it, having some AjaxLazyLoadPanel's active on my page, the 
auto-completion requests will be queued. So if the loading of the lazy panels 
takes time, the user experiences slow response in the auto-completion field. 
Please correct me if I am wrong.

Kaspar

On 06.11.2009, at 08:47, Pieter Degraeuwe wrote:

 Why don't you use the AjaxLazyLoadPanel for each part the the screen that
 takes some time to load? (see also at
 http://www.roseindia.net/tutorials/wicket/lazy-load.shtml)
 
 Pieter


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



Re: Asynchronous construction of page

2009-11-28 Thread Kaspar Fischer
That's what I ended up doing (basically like 
http://blog.miau.biz/2008/12/wicket-and-slow-running-process-in.html).

I just wanted to explain to Pieter why ...

On 28.11.2009, at 11:27, Johan Compagner wrote:

 load that data in separate threads, dont touch any wicket components
 in those threads
 make a component like ajaxlazyload that polls for that data if still
 not there use a timer of a few seconds to test it again
 
 On 28/11/2009, Kaspar Fischer kaspar.fisc...@dreizak.com wrote:
 Because the requests will be sequential (a problem in general but not so
 much in my case) and because I have an auto-completion field on the same
 page. As I understand it, having some AjaxLazyLoadPanel's active on my page,
 the auto-completion requests will be queued. So if the loading of the lazy
 panels takes time, the user experiences slow response in the auto-completion
 field. Please correct me if I am wrong.
 
 Kaspar
 
 On 06.11.2009, at 08:47, Pieter Degraeuwe wrote:
 
 Why don't you use the AjaxLazyLoadPanel for each part the the screen that
 takes some time to load? (see also at
 http://www.roseindia.net/tutorials/wicket/lazy-load.shtml)
 
 Pieter

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



HybridUrlCodingStrategy to get /path/http://what/ever as /path?q=http://what/ever

2009-11-13 Thread Kaspar Fischer
I am looking for a hybrid URL coding strategy X that when mounted via

  mount(new X(link, LinkPage.class));

maps URLs contained in my URLs, as in

  /link/http://code.google.com/p/salve/wiki/WhySalve

to a PageParameters instance with a single parameter containing the URL: 
http://code.google.com/p/salve/wiki/WhySalve;.

Does anybody have such an implementation and could share it?

I suppose the page id and version need to be stored differently (because URLs 
may end in .2.3, for instance), maybe as 
/link/2.3/http://code.google.com/p/salve/wiki/WhySalve?

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



Re: Asynchronous construction of page

2009-11-04 Thread Kaspar Fischer


On 02.11.2009, at 22:59, Igor Vaynberg wrote:


the page itself can only be accessed synchronously, otherwise you
would have to do your own multithreaded access handling in
components...which would be horrific.


It's definitely not nice and it would be cool if there were some way  
to do this in Wicket without having to spawn a thread from the HTTP  
request itself.


Nonetheless, here's a blog post on handling requests in separate  
threads:


  http://blog.miau.biz/2008/12/wicket-and-slow-running-process-in.html

Kaspar

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



Re: Asynchronous construction of page

2009-11-03 Thread Kaspar Fischer

I will try to use pages in iframes then. Thanks a lot, Igor.
Kaspar

On 02.11.2009, at 22:59, Igor Vaynberg wrote:


if you want nonblocking you have to make each thing you are trying to
load asynchronously its own page inside an iframe.

the page itself can only be accessed synchronously, otherwise you
would have to do your own multithreaded access handling in
components...which would be horrific.

-igor

On Mon, Nov 2, 2009 at 1:32 PM, Kaspar Fischer
kaspar.fisc...@dreizak.com wrote:
I am trying to find out how to load several parts (Wicket panels)  
of a page
in parallel using Ajax. The content of these parts takes long to  
render but
I still want the user to see the other, readily available parts of  
the page,
with the delayed panels appearing when available. Several posts on  
this list
indicate that AjaxLazyLoadPanel's only work synchronously. Is this  
still the
case with the latest version/snapshot of Wicket? Is there maybe  
another

approach available (one that still uses Wicket for the parts)?

Thanks,
Kaspar

-
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



Asynchronous construction of page

2009-11-02 Thread Kaspar Fischer
I am trying to find out how to load several parts (Wicket panels) of a  
page in parallel using Ajax. The content of these parts takes long to  
render but I still want the user to see the other, readily available  
parts of the page, with the delayed panels appearing when available.  
Several posts on this list indicate that AjaxLazyLoadPanel's only work  
synchronously. Is this still the case with the latest version/snapshot  
of Wicket? Is there maybe another approach available (one that still  
uses Wicket for the parts)?


Thanks,
Kaspar

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



OT: Using persistence layer objects for service results?

2009-06-10 Thread Kaspar Fischer
I am looking for a good pattern/methodology to use when coding  
services in small Wicket webapps. I want to use the services from  
Wicket but it will also be exposed via RMI and SOAP/REST. For example,  
a service for Houses and Inhabitants might have methods like this:


  // Returns the houses matching the filter (but not yet the  
inhabitants)

  ListHouse findHouses(House filter);

  // Returns the inhabitants of the given house
  ListInhabitant getInhabitants(int houseId);

The class House exposes an id (for use in the getInhabitants() method)  
and some data (address, etc.). It does not provide the list of  
inhabitants because this list might be huge, might not be needed by  
the caller at all, etc. The service returns lists because this comes  
in handy with Wicket components.


My question: Should the above service return objects (HouseImpl,  
InhabitantImpl) from the persistence layer? Or do you introduce  
another set of public (DTO) classes for exposure in the service?


Ideally, I want to keep things simple and manageable, with little code.

For instance, for the above service one could use a Hibernate mapping  
like


  public class HouseImpl
  {
...

@OneToMany(mappedBy = house, fetch = FetchType.LAZY)
private final CollectionInhabitantImpl inhabitants;
  }

and

  public class InhabitantImpl
  {
...

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, updatable = false)
private HouesImpl house;
  }

and the service can directly return instances of these classes. I have  
used this approach in a project and we have seen these problems:


- There's some code used to properly detach the objects and load all  
exposed data in order to avoid LazyInitializationException's. For  
instance, if House has a list of caretakers and you want them to be  
exposed in the service's House, you may need to tell Hibernate to load  
them first. This code is cumbersome to maintain.


- I am not sure whether this would work with RMI, for example. I  
suppose the Hibernate proxies that exist for some of the members would  
get transmitted and would have to exist at the client end, too...


Therefore: How do you design your services? Is anybody using some  
method in which the service objects are generated (semi-)automatically  
from the persistence layer objects?


Many thanks for your input!
Kaspar

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



Re: HTTP pseudo streaming for Wicket

2009-05-27 Thread Kaspar Fischer

Ok, thanks. I think what you are saying holds for FLV streaming, but MP4
streaming looks more complicated:

  
http://www.longtailvideo.com/support/forum/General-Chat/15793/pseudo-stream-mp4-

It seems, as Jeremey pointed out, that lighttpd can do that. (I am  
looking

for a Tomcat-only solution.)

Kaspar

On 25.05.2009, at 23:13, Matej Knopp wrote:


I'm not sure why there should be any logic regarding mp4 on the
server. I don't know how exactly flash mp4 players work but the player
should be able to request the exact byte offset and length from the
server. Content-Range header basically provides random access to
remote files which should be enough for streaming playback with
seeking.

-Matej

On Mon, May 25, 2009 at 10:00 PM, Kaspar Fischer h...@rapsak.com  
wrote:
Sorry: the link I gave is already outdated; a new version is  
available:


 http://h264.code-shop.com/trac/wiki

P.S. Unfortunately I need a solution for Tomcat as I am hosting at  
a Tomcat

provider.

On 25.05.2009, at 22:57, Kaspar Fischer wrote:

Thanks, Matej, for the pointer. I have not read a lot about MP4  
Pseudo
Streaming but as far as I currently understand it, the server  
needs to
analyse the MP4 file (its meta data, actually) in order to know  
which part

of the file to return -- the latter task can then be done using you
Streamer.java. For instance,


 http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Introduction-Version1

analyses the MP4 file in order to get from a time-input (start  
playing at
00:01:23) to a file offset. Does anymore have or know of Java  
code/port for

the MP4/h264 pseudo-streaming and is willing to share it?

Kaspar

On 13.04.2009, at 21:10, Matej Knopp wrote:


If you want to support http streaming you need to implements
servlet/filter that supports Content-Range and Accept-Range  
headers.

You can take a look at

http://code.google.com/p/brix-cms/source/browse/trunk/brix-core/src/main/java/brix/plugin/site/resource/Streamer.java
to get the idea.

-Matej

On Mon, Apr 13, 2009 at 6:16 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:


I think lighttpd does this - although I've never personally used  
it.  I

just
remember it form some research I was doing on a similar subject.
http://blog.lighttpd.net/articles/2006/03/09/flv-streaming-with-lighttpd

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



On Sat, Apr 11, 2009 at 5:10 AM, Kaspar Fischer h...@rapsak.com  
wrote:


I need to stream H264 .mp4 movies to a Flash video player (JW  
Player)

and
want to support HTTP pseudo streaming, i.e., the user should be  
able to

seek
within the movie. Does anybody know of a Wicket implementation  
for

this,
something like xmoov-php [1] for Java with a corresponding Wicket
component?

The video itself lies in a JackRabbit repository, not directly  
on the

file
system.

Red5 [2] offers streaming and a lot more. However, I need a  
solution

that
also works in low memory situations and from the Red5 specs [2]  
it

seems
that this might be difficult.

Regards,
Kaspar
--

[1] http://xmoov.com/xmoov-php/
[2] http://code.google.com/p/red5/
[3]

http://jira.red5.org/confluence/display/docs/Chapter+11.+System+Requirements+For+Red5

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






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






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




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




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



Re: HTTP pseudo streaming for Wicket

2009-05-25 Thread Kaspar Fischer
Thanks, Matej, for the pointer. I have not read a lot about MP4 Pseudo  
Streaming but as far as I currently understand it, the server needs to  
analyse the MP4 file (its meta data, actually) in order to know which  
part of the file to return -- the latter task can then be done using  
you Streamer.java. For instance,


  http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Introduction-Version1

analyses the MP4 file in order to get from a time-input (start  
playing at 00:01:23) to a file offset. Does anymore have or know of  
Java code/port for the MP4/h264 pseudo-streaming and is willing to  
share it?


Kaspar

On 13.04.2009, at 21:10, Matej Knopp wrote:


If you want to support http streaming you need to implements
servlet/filter that supports Content-Range and Accept-Range headers.
You can take a look at
http://code.google.com/p/brix-cms/source/browse/trunk/brix-core/src/main/java/brix/plugin/site/resource/Streamer.java
to get the idea.

-Matej

On Mon, Apr 13, 2009 at 6:16 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:
I think lighttpd does this - although I've never personally used  
it.  I just

remember it form some research I was doing on a similar subject.
http://blog.lighttpd.net/articles/2006/03/09/flv-streaming-with-lighttpd

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



On Sat, Apr 11, 2009 at 5:10 AM, Kaspar Fischer h...@rapsak.com  
wrote:


I need to stream H264 .mp4 movies to a Flash video player (JW  
Player) and
want to support HTTP pseudo streaming, i.e., the user should be  
able to seek
within the movie. Does anybody know of a Wicket implementation for  
this,
something like xmoov-php [1] for Java with a corresponding Wicket  
component?


The video itself lies in a JackRabbit repository, not directly on  
the file

system.

Red5 [2] offers streaming and a lot more. However, I need a  
solution that
also works in low memory situations and from the Red5 specs [2] it  
seems

that this might be difficult.

Regards,
Kaspar
--

[1] http://xmoov.com/xmoov-php/
[2] http://code.google.com/p/red5/
[3]
http://jira.red5.org/confluence/display/docs/Chapter+11.+System+Requirements+For+Red5

-
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: HTTP pseudo streaming for Wicket

2009-05-25 Thread Kaspar Fischer

Sorry: the link I gave is already outdated; a new version is available:

  http://h264.code-shop.com/trac/wiki

P.S. Unfortunately I need a solution for Tomcat as I am hosting at a  
Tomcat provider.


On 25.05.2009, at 22:57, Kaspar Fischer wrote:

Thanks, Matej, for the pointer. I have not read a lot about MP4  
Pseudo Streaming but as far as I currently understand it, the server  
needs to analyse the MP4 file (its meta data, actually) in order to  
know which part of the file to return -- the latter task can then be  
done using you Streamer.java. For instance,


 http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Introduction-Version1

analyses the MP4 file in order to get from a time-input (start  
playing at 00:01:23) to a file offset. Does anymore have or know of  
Java code/port for the MP4/h264 pseudo-streaming and is willing to  
share it?


Kaspar

On 13.04.2009, at 21:10, Matej Knopp wrote:


If you want to support http streaming you need to implements
servlet/filter that supports Content-Range and Accept-Range headers.
You can take a look at
http://code.google.com/p/brix-cms/source/browse/trunk/brix-core/src/main/java/brix/plugin/site/resource/Streamer.java
to get the idea.

-Matej

On Mon, Apr 13, 2009 at 6:16 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:
I think lighttpd does this - although I've never personally used  
it.  I just

remember it form some research I was doing on a similar subject.
http://blog.lighttpd.net/articles/2006/03/09/flv-streaming-with-lighttpd

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



On Sat, Apr 11, 2009 at 5:10 AM, Kaspar Fischer h...@rapsak.com  
wrote:


I need to stream H264 .mp4 movies to a Flash video player (JW  
Player) and
want to support HTTP pseudo streaming, i.e., the user should be  
able to seek
within the movie. Does anybody know of a Wicket implementation  
for this,
something like xmoov-php [1] for Java with a corresponding Wicket  
component?


The video itself lies in a JackRabbit repository, not directly on  
the file

system.

Red5 [2] offers streaming and a lot more. However, I need a  
solution that
also works in low memory situations and from the Red5 specs [2]  
it seems

that this might be difficult.

Regards,
Kaspar
--

[1] http://xmoov.com/xmoov-php/
[2] http://code.google.com/p/red5/
[3]
http://jira.red5.org/confluence/display/docs/Chapter+11.+System+Requirements+For+Red5

-
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: Tree Table - Update Model

2009-05-14 Thread Kaspar Fischer
What worked for me is replacing the tree component via replaceWith()  
with a new instance of the tree. It's definitely not nice but at least  
it worked.


Kaspar

On 14.05.2009, at 14:55, Peter Diefenthaeler wrote:



Hi every one,
I tried the tree table example and get stuck with two problems.
How can I avoid links in the tree leavlets?
How can I update the tree on a new model. I've generated the tree
information on a database query with a search field. When I press the
search button, I expected the tree to be updated with the new model,  
but it

doesn't work.

suchform.add(new AjaxButton(search)
   {
 private static final long serialVersionUID = 1L;

 @Override
 protected void onSubmit(AjaxRequestTarget target,  
Form

form) {
   suchliste = new SucheDao().search(suchfeld);
   log.debug(#Treffer:  + suchliste.size());;
   tm = createTreeModel(suchliste);
   tree.updateTree();
   target.addComponent(tree);
 }
   });


tm = createTreeModel(suchliste);
tree = new Tree(tree, tm);
tree.setRootLess(true);
tree.getTreeState().collapseAll(););
add(tree.setOutputMarkupId(true)););


Wicket Version 1.3.6

Thanx.

PETER DIEFENTHÄLER
CSC

Sandstr. 7, 80335 München, Germany
CIS Payments  Integration | office: +49 89 5908 6441 | mobile: +49  
172 886

5632 | fax: +49 89 5908 6499 | pdief...@csc.com | www.csc.com


CSC • This is a PRIVATE message. If you are not the intended  
recipient,
please delete without copying and kindly advise us by e-mail of the  
mistake
in delivery.  NOTE: Regardless of content, this e-mail shall not  
operate to
bind CSC to any order or other contract unless pursuant to explicit  
written
agreement or government initiative expressly permitting the use of e- 
mail

for such purpose
•
CSC Deutschland Solutions GmbH • Registered Office: Abraham-Lincoln- 
Park 1,
65189 Wiesbaden, Germany • Board of Directors: Gerhard Fercho  
(Chairman),
Thomas Nebe, Peter Schmidt • Chairman of the Supervisory Board: Guy  
Hains •

Registered in Germany: HRB 22374



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



Re: Tomcat Publishing and Hot-Swapping with Wicket (solved)

2009-05-13 Thread Kaspar Fischer

;-)

If in a soft wall room they hear you taking about tomcat (what kind  
of a cat?), hot-swapping, well, aeh, ... they might keep you a  
little longer...


On 05.05.2009, at 13:23, nino martinez wael wrote:


I like these kind of monologs, I often do them myself also known as
parrot talks :) We both need to remember not to do them too often, if
too often then we end up in a room with soft walls :)

regards Nino

2009/5/4 Kaspar Fischer fisch...@inf.ethz.ch:
I intended to post the following questions but found the answer  
myself,

finally.

I post it anyway in the hope that it helps others.

Kaspar Fischer almost posted the following:

My app takes quite some time to start up, so I don't want changes  
to my
Wicket HTML or Wicket Java files to cause Tomcat to completely  
reload the

web app. Is it (at all) possible that only the changed Wicket
HTML/Java/.properties file get reloaded and the rest (Spring  
beans, etc.)

stays?


Yes. It is working for HTML, Java, and .properties files under  
Eclipse with

WTP and Tomcat.

I am a little confused about the terms used in this context.  
Here's how I

see; please correct me if I am wrong.

- Hotswapping means replacing a given class implementation with  
another

one.
- Publishing (as seen in the server configuration panel in Eclipse  
when
clicking on a Tomcat server in the Servers view) means shutting  
a webapp

down and restarting it, hithout actually shutting Tomcat down.


I can't answer myself on this. But I guess it's more or less fine ;-)


There is also an option Update context paths in the Tomcat Server
configuration panel (under Publishing). Is it related?


It is checked in my set up but I don't know whether it is related.


Finally, *how* can I get Tomcat/Eclipse/Wicket to only reload Wicket
HTML/Java/.properties files that changed? In particular, I am  
unsure whether

I have to:

- Debug instead of Run the server (i.e., click Debug in the  
Eclipse

Servers view)?


With Debug it works.

- Should the server have Automatically publish when resources  
change

selected (in the server's configuration panel in Eclipse)?


I have this checkbox checked.


- What Tomcat Context configuration must I use? I currently have
something like:

   Context docBase=myproject path=/myproject  
reloadable=true

source=org.eclipse.jst.j2ee.server:myproject/


This works for me.

- In the server's configuration panel, in tab Modules, should I  
check

Auto reloading enabled?


No. Otherwise Tomcat reloads the *whole* webapp.


I know that Wicket must be running in development mode.


I think so, too ;-)


Many thanks for any pointers and sharing your settings!


Kaspar, you're welcome.


Kaspar


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



Override properties in Fragments?

2009-05-13 Thread Kaspar Fischer

How can one override properties in Fragments?

Given a component:

  divwicket:message key=foo//div

which I instantiate twice, say, in

  div wicket:id=c1 /
  wicket:fragment id=fragment
div wicket:id=c2 /
  /wicket:fragment/

I can override c1's property foo via

  c1.foo=Bar

but neither c2.foo=Bar nor fragment.c2.foo=Bar work.

What is the property path to access c2's foo?

Kaspar

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



Re: Override properties in Fragments?

2009-05-13 Thread Kaspar Fischer


On 13.05.2009, at 18:40, Jeremy Thomerson wrote:


Good questoin - I'm not sure how that works with wicket:message.  But
I suppose you could easily add a label to the fragment and control the
property key to your label easily


Programmatically, you mean, right? Using Component#getString() for  
instance.


I was curious whether there is a solution where that is not  
necessary...?



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



Tomcat Publishing and Hot-Swapping with Wicket (solved)

2009-05-04 Thread Kaspar Fischer
I intended to post the following questions but found the answer  
myself, finally.


I post it anyway in the hope that it helps others.

Kaspar Fischer almost posted the following:

My app takes quite some time to start up, so I don't want changes to  
my Wicket HTML or Wicket Java files to cause Tomcat to completely  
reload the web app. Is it (at all) possible that only the changed  
Wicket HTML/Java/.properties file get reloaded and the rest (Spring  
beans, etc.) stays?


Yes. It is working for HTML, Java, and .properties files under Eclipse  
with WTP and Tomcat.


I am a little confused about the terms used in this context. Here's  
how I see; please correct me if I am wrong.


- Hotswapping means replacing a given class implementation with  
another one.
- Publishing (as seen in the server configuration panel in Eclipse  
when clicking on a Tomcat server in the Servers view) means  
shutting a webapp down and restarting it, hithout actually shutting  
Tomcat down.


I can't answer myself on this. But I guess it's more or less fine ;-)

There is also an option Update context paths in the Tomcat Server  
configuration panel (under Publishing). Is it related?


It is checked in my set up but I don't know whether it is related.

Finally, *how* can I get Tomcat/Eclipse/Wicket to only reload Wicket  
HTML/Java/.properties files that changed? In particular, I am unsure  
whether I have to:


- Debug instead of Run the server (i.e., click Debug in the  
Eclipse Servers view)?


With Debug it works.

- Should the server have Automatically publish when resources  
change selected (in the server's configuration panel in Eclipse)?


I have this checkbox checked.

- What Tomcat Context configuration must I use? I currently have  
something like:


Context docBase=myproject path=/myproject  
reloadable=true source=org.eclipse.jst.j2ee.server:myproject/


This works for me.

- In the server's configuration panel, in tab Modules, should I  
check Auto reloading enabled?


No. Otherwise Tomcat reloads the *whole* webapp.


I know that Wicket must be running in development mode.


I think so, too ;-)


Many thanks for any pointers and sharing your settings!


Kaspar, you're welcome.


Kaspar


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



Wicketstuff-core issue

2009-05-04 Thread Kaspar Fischer
I have a minor issue with wicket-stuff core. I don't know where to  
report it to, so I hope it's fine if I post here. (Wicket JIRA  
probably isn't the right place and Wicketstuff JIRA does not contain a  
project 'wicketstuff-core'.)


The pom.xml does not work for me with Maven 2.1.0. If I change

   plugin
  groupIdorg.mortbay.jetty/groupId
  artifactIdmaven-jetty-plugin/artifactId
   /plugin

to

   plugin
  groupIdorg.mortbay.jetty/groupId
  artifactIdmaven-jetty-plugin/artifactId
  version6.1.10/version
   /plugin

it works.

Kaspar

P.S. Just to be sure: I found no JAR in the maven repository [1], so  
assume that there are no nightly builds for this project and I have to  
compile myself, right?


[1] 
http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-core/1.4-SNAPSHOT/

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



Re: maven-eclipse-plugin 2.6 will break your wicket projects

2009-04-28 Thread Kaspar Fischer
John, thanks for sharing this. It worked for me with the update from  
Maven 2.0.9 to 2.1.0 on MacOS X.


Kaspar

On 03.04.2009, at 16:42, John Krasnay wrote:


FYI to anyone who's been bitten by this, there's a simple workaround.
Just add the following to your pom.xml:

 build
   plugins
 plugin
   artifactIdmaven-eclipse-plugin/artifactId
   version2.5.1/version
 /plugin
   /plugins
 /build

We did it in our parent POM and it's working fine.

jk





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



How to get property from .properties file for a component class (and not instance)?

2009-04-21 Thread Kaspar Fischer
Is there a way to get a property from a .properties file given its  
name and the class of the component?


All methods I have seen, e.g.,

   
WebApplication 
.get().getResourceSettings().getLocalizer().getString(key, component)


require the property's name and a component instance, not a component  
class. In my particular scenario, I don't want the component hierarchy  
to be taken into account...


I could load the .properties file myself, but I suppose these values  
are somethere (cached) in Wicket.


Thanks,
Kaspar

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



HTTP pseudo streaming for Wicket

2009-04-11 Thread Kaspar Fischer
I need to stream H264 .mp4 movies to a Flash video player (JW Player)  
and want to support HTTP pseudo streaming, i.e., the user should be  
able to seek within the movie. Does anybody know of a Wicket  
implementation for this, something like xmoov-php [1] for Java with a  
corresponding Wicket component?


The video itself lies in a JackRabbit repository, not directly on the  
file system.


Red5 [2] offers streaming and a lot more. However, I need a solution  
that also works in low memory situations and from the Red5 specs [2]  
it seems that this might be difficult.


Regards,
Kaspar
--

[1] http://xmoov.com/xmoov-php/
[2] http://code.google.com/p/red5/
[3] 
http://jira.red5.org/confluence/display/docs/Chapter+11.+System+Requirements+For+Red5

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



Re: Wicket-Extensions Installation

2009-04-01 Thread Kaspar Fischer

On 01.04.2009, at 17:58, Tomáš Mihok wrote:


Hi there,

I would like to ask for a guide or a page explaining installation
process of wicket-extensions. I need especially TabbedPanel and
TabControl. Thx oin advance.


I cannot answer about the existence of the page. -- But if you are  
using Maven, just add a dependency


dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version1.4-SNAPSHOT/version
/dependency

to your pom.xml, with 1.4-SNAPSHOT as shown or the desired version of  
wicket-extensions. Maven will take care of the rest and you will be  
able use TabbedPanel, etc. (You can use http://wicket.apache.org/quickstart.html 
 to get an initial project structure for use with maven; then add the  
above dependency.)


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



[OT] Book/pointers on caching

2009-03-29 Thread Kaspar Fischer
I again and again run into the following problem: My Wicket app  
displays a complex page, and in order to compile the information  
needed for this page, I need to do many database/repository queries  
and/or computations -- so many that it simply takes to long and the  
user has two wait.


Take for instance a page with many news blocks for different topics, a  
recently added content block, polls, the list of all active users,  
etc. Fetching all this data requires tons of queries to the backend.


I understand that I need some caching mechanism. And as many have  
pointed out on this list, it is preferable to not do this in the  
presentation layer (caching Wicket components) but to move the caching  
to the business logic or persistence layer. So my Wicket models still  
make the same calls, like service.find(blabla), but behind the scenes,  
a cache speeds up the access.


The question is just: what are good caching strategies? When to update  
the cache? Should the cache itself know when to invalidate entries?  
Etc. Is there any sample code, articles, or books on this that you can  
recommend?


I liked to read Multitiered architectures in Wicket in Action and  
would enjoy something in this direction: Spring, Hibernate (or db4o),  
services, ...


Thanks a lot,
Kaspar

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



Re: Open Session in View Pattern: some basic questions

2009-03-27 Thread Kaspar Fischer
Igor, this clarified a lot. Many thanks for your very detailed reply.  
Kaspar


On 26.03.2009, at 19:30, Igor Vaynberg wrote:


there are three patterns to transaction management

the default pattern is session-per-transaction. this is not convenient
because after your business logic closes the transaction you can no
longer use the session in the ui.

there are two ways to solve this: either use session-per-request -
which means on first transaction you open a session, and keep it open
for the duration of the requests. transactions share the session and
even after the transactions are done you still have a session. this is
better because after your business logic is done you have the session
you can use for ui with all the stuff from business logic already
loaded. this is what the spring osiv filter does.

the other way is a single transaction-per-request. this means on first
access you create a session and a transaction. all other operations
inside a request run within that one transaction.

the difference between session-per-request and transaction-per-request
is data integrity from the user's perspective. if the user sees an
error page have his changes been saved to the database to some degree?
with transaction-per-request you are guaranteed that if user sees an
error screen none of their changes have been preserved - because
whatever displayed the error screen also rolled back the transaction.
with session-per-request there is no such guarantee. eg the business
logic runs fine and saves the data but an error in the ui causes an
error page. user sees an error - but the data is already saved - a
little inconsistent.

personally i prefer transaction-per-request but afaik there is nothing
baked into spring that will do that so you will have to roll your own.

-igor

On Thu, Mar 26, 2009 at 5:31 AM, Kaspar Fischer  
fisch...@inf.ethz.ch wrote:
I am learning about the OSIV pattern and have so far read the  
introduction
at hibernate.org [1], the Spring JavaDoc for  
OpenSessionInViewFilter [2],

the excellent MysticCoders tutorial [3] that uses Spring's
OpenSessionInViewFilter, and some more.

I have basic questions:

1. Is it correct that there are two variants of the pattern?

In one variant there is a single transaction (and a single session)  
that
gets committed at the end of the request, as described in [1]. If I  
am not
mistaken, James's wicket-advanced application [5] also uses this  
variant.


In the second variant, there is an intermediate commit. We  
therefore have
two transactions (and one or two Hibernate sessions). Examples for  
this are

WicketRAD and the London-Wicket PDF [4].

2. The first variant has the disadvantage that the code handling  
the request
cannot handle errors itself as the commit takes place at the end of  
the

request, in a filter. Correct?

As a concrete example, this means that if my code inserts an item  
that
already exists and does not explicitly check for duplicates, the  
request
will result in a rollback and the default error page. Where I would  
have
preferred to see a feedback message This item already exists. (It  
seems to
me, however, that it is not a good practice to move error checking  
concerns

to the database integrity layer, so the code *should* check for
duplicates...)

4. Which variant(s) doe Spring's OpenSessionInViewFilter support  
and how

does it work?

I do not fully understand the documentation of the class but have the
feeling it implements the second, and you can specify whether you  
want a

single or two Hibernate sessions. I read [3]:

NOTE: This filter will by default not flush the Hibernate Session,  
with the
flush mode set to FlushMode.NEVER. It assumes to be used in  
combination with

service layer transactions that care for the flushing: The active
transaction manager will temporarily change the flush mode to  
FlushMode.AUTO
during a read-write transaction, with the flush mode reset  
toFlushMode.NEVER
at the end of each transaction. If you intend to use this filter  
without

transactions, consider changing the default flush mode (through the
flushMode property).

Here is my understanding of this, assuming I have configured a Spring
transaction manager and use transaction annotations:

When a request starts, a Hibernate session is opened. When the  
first method
with a @Transactional annotation is encountered, a transaction is  
started,
and Hibernate's session is associated with this transaction. When  
the method
exits, the transaction is committed but the session is left open  
(the OSIV

behaviour). At the end of the request, the session is closed. Is this
correct?

Thanks for a reply and sorry for the lengthy post,
Kaspar

--
[1] http://www.hibernate.org/43.html
[2]
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html
[3]
http://www.mysticcoders.com/blog/2009/03/13/5-days-of-wicket-putting-it-all-together/
[4]
http://code.google.com/p

Thanks!

2009-03-27 Thread Kaspar Fischer

Dear list members, contributors and Wicket core developers,

Some time ago we have deployed a website which I have migrated from  
Tapestry 4. The website is using Alfresco CMS as its data repository.  
The front-end and the editor back-end (the latter you cannot see  
without being logged in) were written in Wicket 1.4.


Working with Wicket was a pleasure. Many thanks to the Wicket  
developers and the community for providing such a high-quality  
framework and for the excellent support on this forum.


Cheers,
Kaspar

--

http://78.46.32.164/

PLEASE DO NOT POST THE NAME OF THE WEBSITE/DOMAIN OR ITS PRODUCER  
HERE. I DON'T WANT PEOPLE TO FIND THIS (FIRST) WHEN THEY GOOGLE THE  
WEBSITE NAME.


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



Open Session in View Pattern: some basic questions

2009-03-26 Thread Kaspar Fischer
I am learning about the OSIV pattern and have so far read the  
introduction at hibernate.org [1], the Spring JavaDoc for  
OpenSessionInViewFilter [2], the excellent MysticCoders tutorial [3]  
that uses Spring's OpenSessionInViewFilter, and some more.


I have basic questions:

1. Is it correct that there are two variants of the pattern?

In one variant there is a single transaction (and a single session)  
that gets committed at the end of the request, as described in [1]. If  
I am not mistaken, James's wicket-advanced application [5] also uses  
this variant.


In the second variant, there is an intermediate commit. We therefore  
have two transactions (and one or two Hibernate sessions). Examples  
for this are WicketRAD and the London-Wicket PDF [4].


2. The first variant has the disadvantage that the code handling the  
request cannot handle errors itself as the commit takes place at the  
end of the request, in a filter. Correct?


As a concrete example, this means that if my code inserts an item that  
already exists and does not explicitly check for duplicates, the  
request will result in a rollback and the default error page. Where I  
would have preferred to see a feedback message This item already  
exists. (It seems to me, however, that it is not a good practice to  
move error checking concerns to the database integrity layer, so the  
code *should* check for duplicates...)


4. Which variant(s) doe Spring's OpenSessionInViewFilter support and  
how does it work?


I do not fully understand the documentation of the class but have the  
feeling it implements the second, and you can specify whether you want  
a single or two Hibernate sessions. I read [3]:


NOTE: This filter will by default not flush the Hibernate Session,  
with the flush mode set to FlushMode.NEVER. It assumes to be used in  
combination with service layer transactions that care for the  
flushing: The active transaction manager will temporarily change the  
flush mode to FlushMode.AUTO during a read-write transaction, with the  
flush mode reset toFlushMode.NEVER at the end of each transaction. If  
you intend to use this filter without transactions, consider changing  
the default flush mode (through the flushMode property).


Here is my understanding of this, assuming I have configured a Spring  
transaction manager and use transaction annotations:


When a request starts, a Hibernate session is opened. When the first  
method with a @Transactional annotation is encountered, a transaction  
is started, and Hibernate's session is associated with this  
transaction. When the method exits, the transaction is committed but  
the session is left open (the OSIV behaviour). At the end of the  
request, the session is closed. Is this correct?


Thanks for a reply and sorry for the lengthy post,
Kaspar

--
[1] http://www.hibernate.org/43.html
[2] 
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html
[3] 
http://www.mysticcoders.com/blog/2009/03/13/5-days-of-wicket-putting-it-all-together/
[4] 
http://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-OpenSessionInView.pdfcan=2q=
[5] http://markmail.org/message/ittmrmwsn5l6usx7

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



OT: How to connect Wicket layer to underlying service layer

2009-03-24 Thread Kaspar Fischer
I am trying to figure out the architecture of a prototype application.  
In it, the presentation layer (Wicket) needs to work with a service  
layer to display and edit lists (among other things). The service  
layer also exposes some Web Services via SOAP/REST which I intend to  
use for a Flash/Flex component that will be on the pages served by  
Wicket and will display the lists in a graphical and interactive way.


What options do I have to connect the presentation and middle layer?

- RMI between Wicket and the service layer: This would allow them to  
run separately (e.g., we can work on the presentation without taking  
down the service layer who is running background processes).


- Service layer and Wicket in the same webapp.

- Service layer and Wicket in separate webapps but with Tomcat's  
crossContext set to true.


- Anything else?

Can anybody share some recommendations or experiences?

I am worried that RMI will not only be a performance bottleneck (is  
it?) but also that it will be hard to work with models. Looking at  
wicket-phonebook,


 
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/phonebook/src/main/java/wicket/contrib/phonebook/web/DetachableContactModel.java

I see that the presentation layer has access to the DAO and stores  
id's in its models. With an RMI separation, the DAO is in the middle  
layer and not accessible from the presentation layer. Also,  
transactional boundaries are in the service layer, so I will not be  
able to do something more complex in the presentation layer (which I  
shouldn't do anyway, I guess).


Many thanks for feedback,
Kaspar

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



Re: OT: How to connect Wicket layer to underlying service layer

2009-03-24 Thread Kaspar Fischer

James, Eduardo, Jeremy, thank you very much for your input!

I follow your discussions with great interest.

Can you recommend a book on this sort of questions? I have read books  
on Spring and Hibernate but not from this high-level point of view.


Cheers,
Kaspar


On 24.03.2009, at 17:38, Eduardo Nunes wrote:


Ok I got it. One question, consider that you have this model:

Person 1xN Address

You have a screen that list a detailed view of a person, including a
list of addresses. What approach do you use to implement it?
- A service method that returns a Person entity with eager load of the
list of Addresses? (if you don't need always the addresses this
doesn't make sense)
- A service method that returns a Person entity with lazy load of the
list of Addresses? (it could be a problem in a JEE environment)
- Two service methods, one to return the Person entity and another one
to return the of addresses?

Thanks,
Eduardo S. Nunes

On Tue, Mar 24, 2009 at 1:11 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:

Agree again.

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



On Tue, Mar 24, 2009 at 11:11 AM, James Carman jcar...@carmanconsulting.com

wrote:


On Tue, Mar 24, 2009 at 12:08 PM, Eduardo Nunes  
esnu...@gmail.com wrote:
Yes, I understand you too. What do you do when you have to send a  
set

of entities and a calculation for each entity? you encapsulate it
inside another class?


A domain-driven design advocate would say that the entity knows  
how to

calculate what you need and you can ask it for the calculated value.

-
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



setRequired() final?

2009-03-05 Thread Kaspar Fischer
I have a form component to select items and would like to add lower  
and upper constraints on the number of items that need to be set by  
the user. I added setMin() and setMax() methods and would like to  
override setRequired() to call setMin(1). However,  
FormComponent.setRequired is final. Is there a particular reason for  
this?


Thanks, Kaspar

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



Re: setRequired() final?

2009-03-05 Thread Kaspar Fischer

On 05.03.2009, at 10:49, Kaspar Fischer wrote:

I have a form component to select items and would like to add lower  
and upper constraints on the number of items that need to be set by  
the user. I added setMin() and setMax() methods and would like to  
override setRequired() to call setMin(1). However,  
FormComponent.setRequired is final. Is there a particular reason for  
this?


On second thoughts I think I am mixing two concerns her: requiring  
input and validation. I guess in my case, required is meaningless  
(the list of selected items should not be null). And the constraint on  
the number of items should be added via a validator.


Kaspar

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



Re: setRequired() final?

2009-03-05 Thread Kaspar Fischer

On 05.03.2009, at 15:11, jWeekend wrote:


Kaspar,

+1


:-) Thanks for the feedback. Good to know I'm on the right track.

Kaspar

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



Re: [wicket-rad] Problem creating form

2009-02-28 Thread Kaspar Fischer

On 19.02.2009, at 19:06, Kaspar Fischer wrote:


I am trying to create a form using Wicket-RAD 0.6 and get

 Caused by: java.lang.NoSuchMethodError:  
org.wicketrad.jpa.propertyeditor.CreateBeanForm.add(Lorg/apache/ 
wicket/Component;)Lorg/apache/wicket/MarkupContainer;
	at  
org 
.wicketrad 
.jpa.propertyeditor.CreateBeanForm.init(CreateBeanForm.java:27)
	at  
org 
.wicketrad 
.jpa 
.propertyeditor 
.DefaultCreateBeanForm.init(DefaultCreateBeanForm.java:47)
	at  
org 
.wicketrad 
.jpa 
.propertyeditor 
.DefaultCreateBeanForm.init(DefaultCreateBeanForm.java:35)
	at org.icarbasel.aris.ui.web.pages.ProfilesPage 
$1.init(ProfilesPage.java:11)
	at  
org 
.icarbasel.aris.ui.web.pages.ProfilesPage.init(ProfilesPage.java:11)

... 31 more

Does anybody know where the problem could lie?


For the sake of completeness, this solved it: 
http://www.nabble.com/Re%3A-Wicket-RAD-0.6-with-Wicket-1.4-SNAPSHOT-p22260835.html

Kaspar

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



Re: using a model with DropDownChoice

2009-02-26 Thread Kaspar Fischer

On 26.02.2009, at 22:52, Brill Pappin wrote:

For some reason the DropDownChoice component doesn't have the same  
generics as ListView and it will not accept a model that listview  
will, despite its saying that it will accept an IModel.


Is anyone else having that sort of trouble with DropDownChoice?

- Brill


Can you give us more information on what exactly is not working for you?

DropDownChoice indeed does accept a model, see for instance the  
example in the class description at


  
http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/DropDownChoice.html

This works for me.

Kaspar

--

!-- HTML: --
  select wicket:id=site
optionsite 1/option
optionsite 2/option
  /select
  ul
   li wicket:id=site2wicket:container wicket:id=sitename//li
  /ul

// Code
List SITES = Arrays.asList(new String[] {
The Server Side, Java Lobby, Java.Net
});
form.add(new DropDownChoice(site, SITES));
form.add(new ListView(site2, SITES)
{
  @Override
  protected void populateItem(ListItem item)
  {
item.add(new Label(sitename, item.getModel()));
  }
});


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



Re: [OT] Framework for managing task

2009-02-23 Thread Kaspar Fischer

That seems to be it!

Thanks a lot, Pierre.

Kaspar

On 23.02.2009, at 00:39, Pierre Goupil wrote:


Maybe Quartz is what you want :

http://www.opensymphony.com/quartz/

Regards,

Pierre



On Sun, Feb 22, 2009 at 11:26 PM, Kaspar Fischer  
fisch...@inf.ethz.chwrote:


My Wicket app needs to run tasks in the background and I am looking  
for a
Java framework to persist tasks in the sense that I can submit a  
task and
the framework would ensure that once submitted (transactions?), the  
task
will be run, even if the server is shut down in between and the  
task needs

to be restarted. Also, tasks that support cancellation (à la
java.util.concurrent.ExecutorService) should be cancelled when the  
system

stops. Do you know of anything similar?

Whatever tool I'll end up with I will document the integration with  
Wicket

on the wiki.

Thanks a lot,
Kaspar

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





--
Sans amis était le grand maître des mondes,
Eprouvait manque, ce pour quoi il créa les esprits,
Miroirs bienveillants de sa béatitude.
Mais au vrai, il ne trouva aucun égal,
Du calice du royaume total des âmes
Ecume jusqu'à lui l'infinité.

(Schiller, l'amitié)



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



Re: [OT] Simple file repository?

2009-02-22 Thread Kaspar Fischer
Thank you all very much for your advice. I will take a look at  
JackRabitt and Alfresco.


Kaspar

On 16.02.2009, at 01:45, Fabrizio Giudici wrote:


Kaspar Fischer wrote:
User's of my application will upload, edit, and delete files. For  
this, I'd like to have a simple file repository with the  
following features:


- Files are stored on the file system.
- Files are distributed over several folders (to avoid a single  
folder with 10,000 files, say).

- Support for transactions

Does anybody know of a simple Java library that satisfies these  
requirements?


For example: a Hibernate database with a relation Files holding  
tuples (DocId, FilePath), and a service with:


- id store(stream): creates from the stream a new file on the file  
system and inserts a new tuple into the relation, returns id
- stream edit(id): returns a stream to a temporary copy of the file  
with the given id; updates the corresponding tuple to point to the  
temp file

- void remove(id): removes the corresponding tuple form the relation

... and a background job which deletes dangling files.
I suggest you something implemented on the top of JackRabbit (Java  
Content Repository). You might have a look at Brix, which is a CMS  
based on Wicket and JackRabbit.


--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - We make Java work. Everywhere.
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
fabrizio.giud...@tidalwave.it - mobile: +39 348.150.6941


-
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



[OT] Framework for managing task

2009-02-22 Thread Kaspar Fischer
My Wicket app needs to run tasks in the background and I am looking  
for a Java framework to persist tasks in the sense that I can submit  
a task and the framework would ensure that once submitted  
(transactions?), the task will be run, even if the server is shut down  
in between and the task needs to be restarted. Also, tasks that  
support cancellation (à la java.util.concurrent.ExecutorService)  
should be cancelled when the system stops. Do you know of anything  
similar?


Whatever tool I'll end up with I will document the integration with  
Wicket on the wiki.


Thanks a lot,
Kaspar

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



[wicket-rad] Problem creating form

2009-02-19 Thread Kaspar Fischer
I hope this is the right list for wicket-rad questions? (The one on  
SourceForge is empty.)


I am trying to create a form using Wicket-RAD 0.6 and get

  Caused by: java.lang.NoSuchMethodError:  
org.wicketrad.jpa.propertyeditor.CreateBeanForm.add(Lorg/apache/wicket/ 
Component;)Lorg/apache/wicket/MarkupContainer;
	at  
org 
.wicketrad 
.jpa.propertyeditor.CreateBeanForm.init(CreateBeanForm.java:27)
	at  
org 
.wicketrad 
.jpa 
.propertyeditor 
.DefaultCreateBeanForm.init(DefaultCreateBeanForm.java:47)
	at  
org 
.wicketrad 
.jpa 
.propertyeditor 
.DefaultCreateBeanForm.init(DefaultCreateBeanForm.java:35)
	at org.icarbasel.aris.ui.web.pages.ProfilesPage 
$1.init(ProfilesPage.java:11)
	at  
org.icarbasel.aris.ui.web.pages.ProfilesPage.init(ProfilesPage.java: 
11)

... 31 more

Does anybody know where the problem could lie?

Kaspar

--
My page has markup div wicket:id=form/div and constructor

  public ProfilesPage()
  {
BeanForm? form = new DefaultCreateBeanForm(form, new Profile())
{
  @Override
  protected void afterSubmit()
  {
System.err.println(Done...);
  }

};
add(form);
  }

The Profile class looks like this:

@Table
public class Profile implements IdentifiableLong
{
  @Column
  @Id
  @GeneratedValue
  private Long id;

  @Column(unique = true)
  private String name;

  public Long getId()
  {
return id;
  }

  public void setId(Long id)
  {
this.id = id;
  }

  @FieldOrder(1)
  @TextField
  @Length(min = 5, max = 255)
  @LabelProperty
  public String getName()
  {
return name;
  }

  public void setName(String name)
  {
this.name = name;
  }

}

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



Re: [wicket-rad] Problem creating form

2009-02-19 Thread Kaspar Fischer

On 19.02.2009, at 19:34, wfaler wrote:


Hi,
Wicket RAD is actually not officially part of Wicket, so the right  
forum is

here: http://www.nabble.com/Wicket-RAD-f35257.html


Sorry! I will post a next topic to that forum.

However, looking at your code, what version of Wicket are you using,  
and is

it really on the classpath?


Wicket (1.4-SNAPSHOT) is running fine and I am using Panel.add() at  
several other places. Only when I navigate to a page containing a  
Wicket-RAD form, this message appears.


the add call on the line referred to in the stacktrace is actually  
the add()

method on Component, which should be there.


Yes, I looked this up in your code, but here I got stuck.

I attach my pom.xml; maybe it helps?

Thanks, Kaspar

--

project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance 

	xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd 



modelVersion4.0.0/modelVersion
groupIdorg.myorg.myproject.ui.web/groupId
artifactIdmyproject-web/artifactId
packagingwar/packaging
version1.0-SNAPSHOT/version
namemyproject/name
description/description
repositories
repository
idwicketrad/id
urlhttp://wicket-rad.sourceforge.net/repo/url
releases
enabledtrue/enabled
/releases
snapshots
enabledtrue/enabled
/snapshots
/repository
/repositories

organization
name.../name
url...
/url
/organization

dependencies

!--  WICKET DEPENDENCIES --
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version
!-- scopecompile/scope --
/dependency
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-datetime/artifactId
version${wicket.version}/version
!-- scopecompile/scope --
/dependency
dependency
groupIdorg.wicketstuff/groupId
artifactIdwicket-contrib-tinymce/artifactId
version1.3-SNAPSHOT/version
/dependency
dependency
groupIdorg.wicketstuff/groupId
artifactIdwicketstuff-scriptaculous
/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.wicketstuff/groupId
artifactIdwicketstuff-prototype/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.wicketstuff.jquery/groupId
artifactIdwicketstuff-jquery/artifactId
version1.3-SNAPSHOT/version
/dependency
dependency
groupIdorg.wicketstuff/groupId
artifactIdwicketstuff-rome/artifactId
version1.3-SNAPSHOT/version
/dependency
!--
OPTIONAL dependency 
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version /dependency
--

!-- LOGGING DEPENDENCIES - LOG4J --

dependency
groupIdorg.slf4j/groupId
artifactIdslf4j-log4j12/artifactId
version1.4.2/version
/dependency
dependency
groupIdlog4j/groupId
artifactIdlog4j/artifactId
version1.2.14/version
/dependency

!--  JUNIT DEPENDENCY FOR TESTING --
dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
version3.8.2/version
scopetest/scope
/dependency

!-- Persistence --
dependency
groupIdorg.wicketrad.jpa/groupId
artifactIdwicket-rad-jpa/artifactId
  

Re: [wicket-rad] Problem creating form

2009-02-19 Thread Kaspar Fischer

On 19.02.2009, at 19:42, Kaspar Fischer wrote:


On 19.02.2009, at 19:34, wfaler wrote:


Hi,
Wicket RAD is actually not officially part of Wicket, so the right  
forum is

here: http://www.nabble.com/Wicket-RAD-f35257.html


Sorry! I will post a next topic to that forum.

However, looking at your code, what version of Wicket are you  
using, and is

it really on the classpath?


Wicket (1.4-SNAPSHOT) is running fine and I am using Panel.add() at  
several other places. Only when I navigate to a page containing a  
Wicket-RAD form, this message appears.


the add call on the line referred to in the stacktrace is actually  
the add()

method on Component, which should be there.


Yes, I looked this up in your code, but here I got stuck.


I have checked out Wicket-RAD trunk from SVN and installed it using  
'mvn clean install'. (Looking at the file modification dates in my  
~/.m2/repository/org/wicketrad/, the old jars do get overwritten.) But  
still the same problem.


When I look at the pom.xml in a project created with the archetype http://code.google.com/p/wicketrad-archetype/ 
, I see that there is only a dependency on wicket-rad (and none on  
wicket itself). Could it be that wicket-rad depends on a fixed version  
of Wicket? Does it work with Wicket 1.4-SNAPSHOT?


Many thanks for any pointers,
Kaspar

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



Do wicket:message keys depend on markup hierarchy?

2009-02-18 Thread Kaspar Fischer
IIUC, Wicket offers a way to override message keys of components.  
Consider for instance a page with the following markup


  !-- Page.html contains: --
  div wicket:id=a
  div wicket:id=b

with corresponding Java code

  // in Page constructor
  add(new MyPanel(a));
  add(new MyPanel(b));

If MyPanel.html contains

  wicket:panel
   div wicket:id=somediv
wicket:message key=msg/
   /div
  /wicket:panel

Then I can override the msg in my Page.properties using

  a.somediv.msg=msg a
  b.somediv.msg=msg b

However, if the library designer of MyPanel changes the markup to for  
instance


  wicket:panel
   wicket:message key=msg/
   div wicket:id=somediv
   /div
  /wicket:panel

then I, the user of library MyPanel, am forced to change a.somediv.msg  
to a.msg, etc.


Is there a way around this (without adding code for the  
wicket:message's)?


Kaspar

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



Re: Do wicket:message keys depend on markup hierarchy?

2009-02-18 Thread Kaspar Fischer

Thanks, Nino, for the clarifications.

On 18.02.2009, at 18:10, Nino Martinez wrote:

No. Just bundle the default with panel... You could create your own  
resource loader but seems overkill...


Why do you want it working differently?



I am looking for a different way because I want to make the life  
easier for the users of my components: You could consider somediv  
to be an implementation detail of the component, something that the  
designer of the component might want to change later on (as I did in  
my example). -- If he does, it will, however, require the users of the  
component to change their properties files. This happened to me  
without me realising it until a user informed me that the description  
of a field has suddenly changed from a very useful explanation to  
Enter some text (the default message)...


You could also do it with resource models and labels.. etc the java  
way...


Okay, I see. -- I know this issue is not so important. Still, Wicket  
is such a pleasure to work with as far as coding reusable components  
is concerned, that it would be cool to have an easy way to export  
overridable keys which relieves me from adding lots of models that  
clutter my code. Maybe a wicket:export-message key=msg  
binding=somediv.msg/ or an annotation? Well, just ideas... -- I  
guess the bottomline for me is that I should not use wicket:message  
if I need complete freedom inside my component.


Kaspar

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



[OT] Simple file repository?

2009-02-15 Thread Kaspar Fischer
User's of my application will upload, edit, and delete files. For  
this, I'd like to have a simple file repository with the following  
features:


- Files are stored on the file system.
- Files are distributed over several folders (to avoid a single folder  
with 10,000 files, say).

- Support for transactions

Does anybody know of a simple Java library that satisfies these  
requirements?


For example: a Hibernate database with a relation Files holding  
tuples (DocId, FilePath), and a service with:


- id store(stream): creates from the stream a new file on the file  
system and inserts a new tuple into the relation, returns id
- stream edit(id): returns a stream to a temporary copy of the file  
with the given id; updates the corresponding tuple to point to the  
temp file

- void remove(id): removes the corresponding tuple form the relation

... and a background job which deletes dangling files.

Thanks,
Kaspar

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



Re: [OT] Simple file repository?

2009-02-15 Thread Kaspar Fischer

On 15.02.2009, at 17:57, Martin Makundi wrote:


Why not store files into database as bytearray / blob?


In my case, these are movies and I'll have to run ffmpeg on them to  
convert them to appropriate formats. For this, it is more convenient  
to have them on the file system.


Kaspar

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



Re: [OT] Simple file repository?

2009-02-15 Thread Kaspar Fischer


On 15.02.2009, at 18:00, francesco dicarlo wrote:


Alfresco. And you have also lucene indexing.
Just deploy the repository and upload files via webservice...


That is certainly an option: Alfresco even offers Content  
Transformers; writing one to convert the movies would be easy.


Anything more lightweight?

Thanks,
Kaspar



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



[OT] Java hosting USB stick deployment

2009-02-05 Thread Kaspar Fischer
I am in the midst of deciding on the technology to use for an  
application that must be (i) cheap to host and (ii) must be deployable  
on USB sticks (Windows/Mac), for use in ad hoc networks. Options  
include Wicket/Hibernate/Spring or a PHP framework like Drupal, in  
some web container like e.g. Resin, XAMPP/MAMP, etc.


Does anybody on the list know of very cheap Java hosting  
possibilities? I image most of us on the list are working in the  
enterprise sector but maybe somebody knows of a good deal?


(There was once a rumor that Google would offer something, http://www.oreillynet.com/onjava/blog/2008/05/podraziks_prediction_java_next.html 
, any guesses on this?)


I am also interested in whether people from the list have made  
experiences with running Wicket on USB sticks?


Thanks,
Kaspar

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



Re: Turn off form validation

2009-01-19 Thread Kaspar Fischer

On 19.12.2008, at 13:45, Martijn Dashorst wrote:


Adding a new record to a list should not trigger model updates. It
should just add the thing and repaint the container with the added
item. If you use a (ajax)submit(link|button) you can
setDefaultFormProcessing(false) on the button/link and wicket will not
validate nor update model values, but keep the input of the user so it
can be validated at actual form submission.


Where can I get the input if I do setDefaultFormProcessing(false)  
when, as you say, model values or not updated?



Validation is there to protect your domain objects from invalid data.
Now you want to bypass this?


I agree. I just do not know yet how to realize this in Wicket. Let me  
try to explain: I have a custom form component that allows the user to  
add and remove tags. In order to add a tag, the user enters the tag's  
name and clicks Add. Obviously, when she clicks Add, I do NOT want  
the WHOLE form to be validated, as Add is not the form's Submit,  
but just an intermediate step in the process of filling out the form.  
Still, I want to get the new tag name she entered -- and for this, I  
have to do setDefaultFormProcessing(true). Correct?


Kaspar

P.S. Noon, I think nested forms do not validate so I can't use them.

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



Re: Turn off form validation

2009-01-19 Thread Kaspar Fischer

On 19.01.2009, at 14:25, Hoover, William wrote:


http://cwiki.apache.org/WICKET/conditional-validation.html see
alternative approach


Thanks -- I was actually hoping for something simpler/more elegant?!

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



Re: [OT] wicket users around the world

2008-12-24 Thread Kaspar Fischer

Switzerland, Basel, like Sébastien!

On 11.12.2008, at 19:57, francisco treacy wrote:


to know a little bit more of our great (and vast) community, i was
just wondering if you're keen on sharing where you come from and/or
where you work with wicket...

for instance, here argentinian/belgian working with wicket in  
antibes, france


francisco

-
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



Turn off form validation

2008-12-19 Thread Kaspar Fischer

I have a custom component that allows the user to select one or more
tags. For this, the component has a text field and an AjaxButton Add
to add a tag.

All works fine if I use the component in a form without validation
errors. If, however, a text field has setRequired(true), the
AjaxButton's onSubmit() method is not called (but onError() instead).

In this case, I do not want this behaviour but want form validation
to be disabled for the Add AjaxButton. (I still need to get the
model values updated, though.)

Is there an easy way to achieve this?

I've read about conditional validation,

  http://cwiki.apache.org/WICKET/conditional-validation.html

but as my component does not know about the enclosing form, I am
looking for another solution.

Many thanks,
Kaspar

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



NoSuchMethodError isEnabledInHierarchy() with DatePicker

2008-11-25 Thread Kaspar Fischer
The 1.4-SNAPSHOT version DatePicker seems to have problem with  
isEnabledInHierarchy().

Does anybody know how to fix this?
Thanks,
Kaspar
--
javax.servlet.ServletException: Filter execution threw an exception  
org 
.icarbasel 
.knowledgecenter 
.wicket.infrastructure.EncodingFilter.doFilter(EncodingFilter.java:37)


root cause

java.lang.NoSuchMethodError:  
org.apache.wicket.Component.isEnabledInHierarchy()Z  
org 
.apache 
.wicket.extensions.yui.calendar.DatePicker.isEnabled(DatePicker.java: 
675) org.apache.wicket.Component.isBehaviorAccepted(Component.java: 
3734) org.apache.wicket.Component.renderHead(Component.java:2649)  
org.apache.wicket.markup.html.internal.HtmlHeaderContainer 
$1.component(HtmlHeaderContainer.java:223)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
859)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
874)  
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java: 
899)  
org 
.apache 
.wicket 
.markup 
.html 
.internal 
.HtmlHeaderContainer.renderHeaderSections(HtmlHeaderContainer.java: 
214)  
org 
.apache 
.wicket 
.markup 
.html 
.internal 
.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:138)  
org.apache.wicket.Component.renderComponent(Component.java:2564)  
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1504)  
org.apache.wicket.Component.render(Component.java:2400)  
org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:232)  
org 
.apache 
.wicket 
.markup.resolver.HtmlHeaderResolver.resolve(HtmlHeaderResolver.java: 
78) org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java: 
1414) org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java: 
1520) org.apache.wicket.Page.onRender(Page.java:1501)  
org.apache.wicket.Component.render(Component.java:2400)  
org.apache.wicket.Page.renderPage(Page.java:905)  
org 
.apache 
.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java: 
166)  
org 
.apache 
.wicket 
.request 
.target.component.PageRequestTarget.respond(PageRequestTarget.java:58)  
org 
.apache 
.wicket 
.request 
.AbstractRequestCycleProcessor 
.respond(AbstractRequestCycleProcessor.java:104)  
org 
.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java: 
1179) org.apache.wicket.RequestCycle.step(RequestCycle.java:1250)  
org.apache.wicket.RequestCycle.steps(RequestCycle.java:1351)  
org.apache.wicket.RequestCycle.request(RequestCycle.java:497)  
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java: 
444)  
org 
.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java: 
282)  
org 
.icarbasel 
.knowledgecenter 
.wicket 
.infrastructure 
.KnowledgeCenterFilter.doFilter(KnowledgeCenterFilter.java:51)  
org 
.icarbasel 
.knowledgecenter 
.wicket.infrastructure.EncodingFilter.doFilter(EncodingFilter.java:37)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need AjaxButton's but not its enclosing form's onSubmit() to be called

2008-11-06 Thread Kaspar Fischer

On 06.11.2008, at 09:06, Igor Vaynberg wrote:


take your code out of form.onsubmit and put it into onsubmit of the
button attached to input type=submit, if there isnt one then
attach one.

-igor


Arrg... So simple. And I have been banging my head against this for
an hour now. Thanks, Igor!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Need AjaxButton's but not its enclosing form's onSubmit() to be called

2008-11-05 Thread Kaspar Fischer

I have a form with an onSubmit(). The form contains a AjaxButton
with another onSubmit(). When the later gets called, the former gets
invoked, too. What I want, however, is that the form's onSubmit()
gets called iff the input type=submit-button is clicked, and that
the AjaxButton's onSubmit() is called iff the input type=button-
button is pressed.

How can I achieve this?

I tried calling setDefaultFormProcessing(false) on my AjaxButton,
but that does not update the form values (not what I want). I also
tried form.setDefaultButton(null) or form.setDefaultButton(submit),
which didn't help either.

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Threading problem

2008-10-21 Thread Kaspar Fischer
Thank you very much for this explanation, Igor. Very much appreciated.  
- Kaspar


On 16.10.2008, at 18:14, Igor Vaynberg wrote:

requests from a single session are serialized. but what if your page  
is

stateless and you click the two links fast?

each click spins off a request that now needs a session and because  
they run
concurrently two sessions are created because this is the first  
request that

needs a session.

try doing this in your page's constructor: Session.get().bind();  
this will
force wicket to create a http session when the page renders and will  
avoid

this kind of problem.

-igor

On Thu, Oct 16, 2008 at 9:02 AM, Kaspar Fischer  
[EMAIL PROTECTED]wrote:



I run into a concurrency issue: My pages load fine when I visit
them slowly, one after the other with a pause between clicks.
However, if I click on two links on my page very, very fast, an
exception gets thrown.

My session factory outputs the number of the thread and the hash
code of the session created (in chronological order):

[89213] New [EMAIL PROTECTED]
[11349856] New [EMAIL PROTECTED]

And after that, thread 89213 throws an exception:

Access in thread 89213 to data in session @43f1c from a different  
thread

(11349856)!

It seems that thread 89213 is accessing a session that was created
*later*. How can something like this happen in Wicket when it
handles requests (from a single session) sequentially? Any ideas?

Thanks for any pointer,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Threading problem

2008-10-16 Thread Kaspar Fischer

I run into a concurrency issue: My pages load fine when I visit
them slowly, one after the other with a pause between clicks.
However, if I click on two links on my page very, very fast, an
exception gets thrown.

My session factory outputs the number of the thread and the hash
code of the session created (in chronological order):

  [89213] New [EMAIL PROTECTED]
  [11349856] New [EMAIL PROTECTED]

And after that, thread 89213 throws an exception:

  Access in thread 89213 to data in session @43f1c from a different  
thread (11349856)!


It seems that thread 89213 is accessing a session that was created
*later*. How can something like this happen in Wicket when it
handles requests (from a single session) sequentially? Any ideas?

Thanks for any pointer,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[OT] Process modelling (with Wicket front-end)

2008-10-09 Thread Kaspar Fischer
Can anybody recommend a good process modelling tool that integrates  
with Wicket?


We would like to use such a tool for many activities in our  
organziation:


- We show processes to our end-users as part of our knowledge  
information centre
  website. So we need to present processes, interactively, if  
possible. The website
  (including the CMS front-end) runs on Wicket and ideally, we would  
like to

  edit the processes in a Wicket GUI, too.

- We are starting to provide e-learning solutions and there, too, it  
might be

  helpful to structure a course with a process modeller.

- We use processes internally for certain documents (in Alfresco CMS).

I have slightly touched jBPM as it is used in Alfresco CMS, and I have  
watched
the presentation http://docs.jboss.com/jbpm/v3/demos/movies/jbpm-overview.htm 

given at http://www.jboss.com/products/jbpm. Also, I have read a  
little about
YAWL and heard of BPDM but as I lack experience with these tools/ 
models, I
wonder: What state-of-the-art tools (in Java) are out there, and has  
anybody

managed to get integration with Wicket?

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [XHTML validation] Rootless AbstractTree outputs empty table table .../table

2008-10-02 Thread Kaspar Fischer

I have filed a JIRA improvement ticket for this:

  https://issues.apache.org/jira/browse/WICKET-1856

Kaspar

On 17.09.2008, at 11:12, Kaspar Fischer wrote:


I have a rootless BaseTree and see it output

 table style=display:none id=tree1f_0/tabletable  
class=wicket-tree-content id=tree1f_1tr...


which according to http://validator.w3.org is invalid strict XHTML.  
Looking at the
comment in the code, AbstractTree.onRender(), it appears that the  
indention there is

to output a div and not a table, which would validate:

 div style=display:none id=tree1f_0/divtable class=wicket- 
tree-content id=tree1f_1tr...


Or was there a particular reason to fetch the tagName from the  
markupStream in the

code, instead of just hardcoding it to div?

Thanks,
Kaspar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[XHTML validation] Rootless AbstractTree outputs empty table table .../table

2008-09-17 Thread Kaspar Fischer

I have a rootless BaseTree and see it output

  table style=display:none id=tree1f_0/tabletable  
class=wicket-tree-content id=tree1f_1tr...


which according to http://validator.w3.org is invalid strict XHTML.  
Looking at the
comment in the code, AbstractTree.onRender(), it appears that the  
indention there is

to output a div and not a table, which would validate:

  div style=display:none id=tree1f_0/divtable class=wicket- 
tree-content id=tree1f_1tr...


Or was there a particular reason to fetch the tagName from the  
markupStream in the

code, instead of just hardcoding it to div?

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AjaxFallbackImageButton

2008-09-17 Thread Kaspar Fischer
I am in need for an ImageButton with AJAX fallback capability. I have  
created from AjaxFallbackButton
a component AjaxFallbackImageButton that bases itself not on Button  
but on ImageButton. See below. So

far, this seems to work and maybe others want to use it, too.

Also: Have I overseen an easier way of accomplishing this? Wicket does  
not currently come with

an AjaxFallbackImageButton, and maybe there's a reason for that ...?

Regards,
Kaspar

--
import org.apache.wicket.Resource;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.IAjaxCallDecorator;
import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.ImageButton;
import org.apache.wicket.model.IModel;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.value.ValueMap;

/**
 * An ajax submit image button that will degrade to a normal request  
if ajax is not available or

 * javascript is disabled.
 *
 * @author Jeremy Thomerson (jthomerson)
 * @author Alastair Maw
 */
public abstract class AjaxFallbackImageButton extends ImageButton
{
  private static final long serialVersionUID = 1L;

  private Form? mForm;

  /**
   * Construct, see [EMAIL PROTECTED] ImageButton#ImageButton(String).
   *
   * @param id
   * @param form
   */
  public AjaxFallbackImageButton(String id, Form? form)
  {
super(id);
initialize(form);
  }

  /**
   * Construct, see [EMAIL PROTECTED] ImageButton#ImageButton(String,  
ResourceReference)}.

   *
   * @param id
   * @param resourceReference
   * @param form
   */
  public AjaxFallbackImageButton(String id, ResourceReference  
resourceReference, Form? form)

  {
super(id, resourceReference);
initialize(form);
  }

  /**
   * Construct, see [EMAIL PROTECTED] ImageButton#ImageButton(String,  
ResourceReference, ValueMap)}.

   *
   * @param id
   * @param resourceReference
   * @param resourceParameters
   * @param form
   */
  public AjaxFallbackImageButton(String id, ResourceReference  
resourceReference, ValueMap resourceParameters,

  Form? form)
  {
super(id, resourceReference);
initialize(form);
  }

  /**
   * Construct, see [EMAIL PROTECTED] ImageButton#ImageButton(String, Resource).
   *
   * @param id
   * @param resource
   * @param form
   */
  public AjaxFallbackImageButton(String id, Resource resource, Form? 
 form)

  {
super(id, resource);
initialize(form);
  }

  /**
   * Construct, see [EMAIL PROTECTED] ImageButton#ImageButton(String, IModel)}.
   *
   * @param id
   * @param model
   * @param form
   */
  public AjaxFallbackImageButton(String id, IModelString model,  
Form? form)

  {
super(id, model);
initialize(form);
  }

  /**
   * Construct, see [EMAIL PROTECTED] ImageButton#ImageButton(String, String)}.
   *
   * @param id
   * @param resourceReference
   * @param resourceParameters
   * @param form
   */
  public AjaxFallbackImageButton(String id, String string, Form?  
form)

  {
super(id, string);
initialize(form);
  }

  private void initialize(Form? form)
  {
mForm = form;

add(new AjaxFormSubmitBehavior(form, onclick)
{
  private static final long serialVersionUID = 1L;

  @Override
  protected void onSubmit(AjaxRequestTarget target)
  {
AjaxFallbackImageButton.this.onSubmit(target,  
AjaxFallbackImageButton.this.getForm());

  }

  @Override
  protected void onError(AjaxRequestTarget target)
  {
AjaxFallbackImageButton.this.onError(target,  
AjaxFallbackImageButton.this.getForm());

  }

  @Override
  protected CharSequence getEventHandler()
  {
return new  
AppendingStringBuffer(super.getEventHandler()).append(; return  
false;);

  }

  @Override
  protected IAjaxCallDecorator getAjaxCallDecorator()
  {
return AjaxFallbackImageButton.this.getAjaxCallDecorator();
  }
});
  }

  /**
   * Listener method invoked on form submit with errors
   *
   * @param target
   * @param form
   *
   * TODO 1.3: Make abstract to be consistent with onsubmit()
   */
  protected void onError(AjaxRequestTarget target, Form? form)
  {
// created to override
  }

  /**
   * @see  
org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit()

   */
  @Override
  public final void onSubmit()
  {
if (!(getRequestCycle().getRequestTarget() instanceof  
AjaxRequestTarget))

{
  onSubmit(null, getForm());
}
  }

  /**
   *
   * @see org.apache.wicket.markup.html.form.Button#getForm()
   */
  @Override
  public Form? getForm()
  {
return mForm == null ? super.getForm() : mForm;
  }

  /**
   * Callback for the onClick event. If ajax failed and this event  
was generated via a normal

   * submission, the target argument will be null
   *
   * @param target
   *  ajax target if this linked was invoked using 

Re: Wicket 1.3.4 + SWFObject

2008-09-12 Thread Kaspar Fischer


On 11.09.2008, at 13:59, Piller Sébastien wrote:


Hello,

this time I haven't any dummy question :)

I've developped a wicket panel to display a *.swf file with a  
autoinstall feature of the flash player, using SWFObject, and I'm  
ready to share it with the community.


Are you interested?


Hi Sébastien!

I am interested! Could you post the code/markup?

Thanks a lot for sharing,
Kaspar
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Assert that all models are detached at the end of the request?

2008-09-05 Thread Kaspar Fischer
For the sake of completeness, here is the solution I am currently  
using. It uses,
as suggested by Martijn, a custom request cycle and a modified version  
of
SerializableChecker. You have to install the custom request cycle in  
your application

using

  @Override
  public RequestCycle newRequestCycle(Request request, Response  
response)

  {
return new CustomRequestCycle(this, (WebRequest) request,  
(WebResponse) response);

  }

Hope this helps others, too!
Kaspar

// * FILE: CustomRequestCycle.java *
import java.io.NotSerializableException;

import org.apache.wicket.Page;
import org.apache.wicket.Response;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebRequest;
import org.apache.wicket.protocol.http.WebRequestCycle;
import org.apache.wicket.request.target.component.IPageRequestTarget;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A custom request cycle that checks, when in development mode, that  
all models of a page are
 * detached. Currently, only model that are instances of  
LoadableDetachableModel (including

 * subclasses) are checked.
 */
public class CustomRequestCycle extends WebRequestCycle
{
  /** Logging object */
  private static final Logger log =  
LoggerFactory.getLogger(WebRequestCycle.class);


  public CustomRequestCycle(WebApplication application, WebRequest  
request, Response response)

  {
super(application, request, response);
  }

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

if  
(WebApplication 
.DEVELOPMENT 
.equalsIgnoreCase(WebApplication.get().getConfigurationType()))

{
  Page requestPage = getRequest().getPage();
  testDetachedObjects(requestPage);

  if (getRequestTarget() instanceof IPageRequestTarget)
  {
Page responsePage = ((IPageRequestTarget)  
getRequestTarget()).getPage();


if (responsePage != requestPage)
{
  testDetachedObjects(responsePage);
}
  }
}
  }

  private void testDetachedObjects(final Page page)
  {
if (page == null)
{
  return;
}

try
{
  NotSerializableException exception = new  
NotSerializableException(

  Model is not detached when attempting to serialize!);
  DetachedChecker checker = new DetachedChecker(exception);
  checker.writeObject(page);
}
catch (Exception ex)
{
  log.error(Couldn't test/serialize the Page:  + page + ,  
error:  + ex);

}
  }
}


// * FILE: DetachedChecker.java *
import java.io.Externalizable;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.ObjectStreamField;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Date;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;

import org.apache.wicket.Component;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.util.lang.Generics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This is taken from Wicket SerializableChecker.java (SVN r687197)  
and customized slightly
 * (see comments containing KF). See the latter file for all  
details, including terms of
 * use. Notice that this does not replace SerializableChecker; the  
latter is still run.

 */
public final class DetachedChecker extends ObjectOutputStream
{
  /**
   * Exception that is thrown when a non-serializable object was found.
   */
  public static final class WicketNotSerializableException extends  
WicketRuntimeException

  {
private static final long serialVersionUID = 1L;

WicketNotSerializableException(String message, Throwable cause)
{
  super(message, cause);
}
  }

  /**
   * Does absolutely nothing.
   */
  private static class NoopOutputStream extends OutputStream
  {
@Override
public void close()
{
}

@Override
public void flush()
{
}

@Override
public void write(byte[] b)
{
}

@Override
public void write(byte[] b, int i, int l)
{
}

@Override
public void write(int b)
{
}
  }

  private static abstract class ObjectOutputAdaptor implements  
ObjectOutput

  {

public void close() throws IOException
{
}

public void flush() throws IOException
{
}

public void write(byte[] b) throws IOException
{
}

public void write(byte[] b, int off, int len) throws IOException
{
}

public void write(int b) throws IOException
{
}

public void writeBoolean(boolean v) throws IOException
{
}

public void writeByte(int v) throws IOException

Re: Assert that all models are detached at the end of the request?

2008-08-29 Thread Kaspar Fischer

Matijn, thank you for your hint.

I searched on your blog, http://martijndashorst.com/blog/, and Eelco's,
http://day-to-day-stuff.blogspot.com/, but must have searched for the  
wrong

thing (transient, entity, SerializableChecker)...

Anyways, I'd like to do what you suggest, but have a few question:

I guess I have to provide my own implementation of  
IObjectStreamFactory in

order to force my subclass of SerializableChecker to run (in development
mode). For this, do I subclass  
IObjectStreamFactory.DefaultObjectStreamFactory

or WicketObjectStreamFactory?

Where would I install this custom IObjectStreamFactory?

As to SerializableChecker itself, I think my version simply has to  
look for

models in

private void check(Object obj)
{
  if (obj == null)
  {
return;
  }
  Class? cls = obj.getClass();
  nameStack.add(simpleName);
  traceStack.add(new TraceSlot(obj, fieldDescription));
  if (!(obj instanceof Serializable)  (!Proxy.isProxyClass(cls)))
  {
throw new WicketNotSerializableException(
toPrettyPrintedStack(obj.getClass().getName()), exception);
  }
  // NEW
  if (obj instanceof LoadableDetachableModel) {
LoadableDetachableModel m = (LoadableDetachableModel)m;
if (m.isAttached())
{
  throw new IllegalStateException(Model not detached!);
}
  }
  // ...

Regards,
Kaspar

On 29.08.2008, at 08:20, Martijn Dashorst wrote:


you could extend the serializerchecker to check for underached models.
We did something similar checking for non-transient Entity objects.
Iirc the code is either on my blog or Eelco's blog.

Martijn

On 8/28/08, Igor Vaynberg [EMAIL PROTECTED] wrote:
no, there is no easy way to assert that any model has been  
detached,

because they do not keep a flag.

in 1.5 we will implement it so that all fields of a component that
implement idetachable are detached in the end of request via
reflection, so that should help somewhat.

-igor

On Thu, Aug 28, 2008 at 1:57 PM, Kaspar Fischer  
[EMAIL PROTECTED]

wrote:
Is there an easy way to assert that all models are detached at the  
end of

the
request?

It does not look so easy to check this as models do not have  
common base

class
where one could register them for a check...

I often use an additional model in a component and store it as a  
member

field;
if I forgot to detach() this model in the onDetach() handler, I  
would have

a
dangling model. That caused me quite some trouble once and I  
want to

avoid
it in the future.

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Assert that all models are detached at the end of the request?

2008-08-29 Thread Kaspar Fischer

Many, many thanks for this! Very much appreciated. - Kaspar

On 29.08.2008, at 15:15, Martijn Dashorst wrote:


We just do it in CustomRequestCycle#onEndRequest():

@Override
protected void onEndRequest()
{
if (Application.get().isDevelopment())
{
			// controleer of er hibernate objecten in de pagina vastgehouden  
worden.

// eerst de pagina die het request heeft beantwoord

Page requestPage = getRequest().getPage();
testDetachedObjects(requestPage);

// als de response een Page heeft, dan deze controleren 
op de
aanwezigheid van
// hibernate objecten.
if (getRequestTarget() instanceof IPageRequestTarget)
{
Page responsePage = ((IPageRequestTarget)  
getRequestTarget()).getPage();


if (responsePage != requestPage)
{
testDetachedObjects(responsePage);
}
}
}


And:

private void testDetachedObjects(final Page page)
{
if (page == null)
{
return;
}

try
{
			NotSerializableException exception = new  
NotSerializableException();

EntityAndSerializableChecker checker = new
EntityAndSerializableChecker(exception);
checker.writeObject(page);
}
catch (Exception ex)
{
			log.error(Couldn't test/serialize the Page:  + page + , error:  
 + ex);

}
}

--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Assert that all models are detached at the end of the request?

2008-08-28 Thread Kaspar Fischer
Is there an easy way to assert that all models are detached at the end  
of the

request?

It does not look so easy to check this as models do not have common  
base class

where one could register them for a check...

I often use an additional model in a component and store it as a  
member field;
if I forgot to detach() this model in the onDetach() handler, I would  
have a
dangling model. That caused me quite some trouble once and I want to  
avoid

it in the future.

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Image crop and resize component

2008-08-21 Thread Kaspar Fischer

Two questions:

1) Does anybody know of a Wicket component that allows the user to  
select an area of an image?


For example:

  
http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/

I am thinking of a component that takes the image and a rectangle as  
models and alters the rectangle.


2) What Java library would you recommend to extract from the image the  
selected subarea?
Is there even something out there that uses a heuristic to choose  
between PNG and JPEG format

to optimize the filesize and number of colors?

Many thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Generate URL for a Resource depending on component state

2008-08-20 Thread Kaspar Fischer

Igor, thanks a lot for this hint! With it, I found a solution.

For others with similar problems: I create the following resource in  
onBeginRender():


resource = new WebResource()
{
  @Override
  public IResourceStream getResourceStream()
  {
IModelCollectionT model = (IModelCollectionT)  
getDefaultModel();

CollectionT collection = model.getObject();
final String json = generateJson(collection.iterator());
return new StringResourceStream(json, text/x-json);
  }
};
resource.setCacheable(false);
urlConstructor = RequestCycle.get().urlFor(MyPanel.this,  
IResourceListener.INTERFACE); // (*)


(You cannot do this in the constructor, as it turns out, because  
urlFor() calls
getPage() and this is not a good thing in the constructor -- the  
component does

not have a page yet at this stage.)

In addition, I made my component implement IResourceListener with

  public void onResourceRequested()
  {
resource.onResourceRequested();
  }

In this way, a request for the URL (*) will trigger the resource's
onResourceRequested() which in turn outputs the JSON for my JavaScript
component on the browser.

On 13.08.2008, at 00:18, Igor Vaynberg wrote:


see how Link does it, but essentially you call urlfor(component,
listenerinterface)

-igor

On Tue, Aug 12, 2008 at 1:46 PM, Kaspar Fischer  
[EMAIL PROTECTED] wrote:

On 12.08.2008, at 12:42, Kaspar Fischer wrote:

How can I register a resource reference (or, what I actually want:  
just

the
resource) with the component AND get a URL for it?


To rephrase my question and hopefully make it clearer: How can I  
get a URL
for my component which outputs the current value of my component's  
model

(in JSON, XML, or whatever)?

Any ideas?

I know this has come up before,

http://markmail.org/message/yewk64k7i452cjhd

but I could not find any answer...

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IndicatingAjaxLink with BaseTree appends after /td

2008-08-19 Thread Kaspar Fischer


On 19.08.2008, at 12:03, Matej Knopp wrote:


Hi,

This is caused by the fact that component border is rendered
after/before behaviors. We can't really change this for 1.3 because it
could break existing applications. I have changed the rendering order
in trunk (1.4) though.

-Matej


Great! Thanks a lot for looking into this.

Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicketstuff snapshots

2008-08-19 Thread Kaspar Fischer

When/how often are the Wicketstuff snapshots generated? I am using

  dependency
groupIdorg.wicketstuff/groupId
artifactIdwicketstuff-scriptaculous/artifactId
version1.4-SNAPSHOT/version
  /dependency

in my pom.xml but get

 java.lang.NoSuchMethodError:  
org 
.wicketstuff 
.scriptaculous.dragdrop.SortableListView.getModelObject()Ljava/lang/ 
Object;


although the latest SortableListView.java does not contain the text
getModelObject().

I fear I lack some basic knowledge on Maven repos, so appologies
if I am asking something obvious.

Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicketstuff snapshots

2008-08-19 Thread Kaspar Fischer

On 19.08.2008, at 12:45, Martijn Dashorst wrote:

On Tue, Aug 19, 2008 at 12:32 PM, Kaspar Fischer  
[EMAIL PROTECTED] wrote:

When/how often are the Wicketstuff snapshots generated? I am using


Everytime the source code changes for the project, or when Wicket is
updated (depending on the configuration of the projects in Teamcity
(http://wicketstuff.org/teamcity).

Martijn


I see. So this means something with the configuration is wrong (as the
JAR is outdate, see my previous mail).

Loggin into teamcity as guest, I see Problems with VCS connection:

  Failed for the root 'Wicket Stuff 1.4 repository' #3: Checking  
changes for checkout rule 'trunk/wicket-contrib-tinymce=trunk/wicket- 
contrib-tinymce' failed with erorr:  
org.tmatesoft.svn.core.SVNException: svn: PROPFIND request failed on '/ 
svnroot/wicket-stuff/trunk/wicket-contrib-tinymce/src/java/wicket/ 
contrib/tinymce/tiny_mce/langs/tw.js' svn: Network is unreachable


and in addition a build error:

[ERROR] BUILD ERROR
[12:26:40]: [INFO]  


[12:26:40]: [INFO] Failed to resolve artifact.
[12:26:40]:
[12:26:40]: Missing:
[12:26:40]: --
[12:26:40]: 1) org.wicketstuff:wicketstuff-prototype:jar:1.4-SNAPSHOT
[12:26:40]:
[12:26:40]: Try downloading the file manually from the project website.
[12:26:40]:
[12:26:40]: Then, install it using the command:
[12:26:40]: mvn install:install-file -DgroupId=org.wicketstuff - 
DartifactId=wicketstuff-prototype -Dversion=1.4-SNAPSHOT - 
Dpackaging=jar -Dfile=/path/to/file

[12:26:40]:
[12:26:40]: Alternatively, if you host your own repository you can  
deploy the file there:
[12:26:40]: mvn deploy:deploy-file -DgroupId=org.wicketstuff - 
DartifactId=wicketstuff-prototype -Dversion=1.4-SNAPSHOT - 
Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

[12:26:40]:
[12:26:40]: Path to dependency:
[12:26:40]: 1) org.wicketstuff:wicketstuff-scriptaculous:jar:1.4- 
SNAPSHOT

[12:26:40]: 2) org.wicketstuff:wicketstuff-prototype:jar:1.4-SNAPSHOT
[12:26:40]:
[12:26:40]: --
[12:26:40]: 1 required artifact is missing.
[12:26:40]:
[12:26:40]: for artifact:
[12:26:40]: org.wicketstuff:wicketstuff-scriptaculous:jar:1.4-SNAPSHOT
[12:26:40]:
[12:26:40]: from the specified remote repositories:
[12:26:40]: central (http://repo1.maven.org/maven2),
[12:26:40]: wicket-stuff-repository (http://www.wicketstuff.org/maven/repository/ 
)


(I get the same build error if I download the SVN code and do a mvn  
install.)


Can this be fixed in some way?

Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicketstuff snapshots

2008-08-19 Thread Kaspar Fischer
I guess the first error (see below) is not relevant as other projects  
have

it, too.

Regarding the second error: Does anybody have an idea why wicketstuff- 
prototype

makes the build fail?

I can see wicketstuff-prototype in the SVN repo but it is not listed on
http://wicketstuff.org/teamcity/overview.html -- is this normal?

Being a Maven newbie, I am a lost here. Maybe the problem is that the
scriptaculous-pom.xml lists the repo as

  repository
idwicket-stuff-repository/id
nameWicket-Stuff Repository/name
urlhttp://www.wicketstuff.org/maven/repository//url
  /repository

without a

  snapshots
enabledtrue/enabled
  /snapshots

? Too many trees in this forest for me ;-)

On 19.08.2008, at 13:30, Kaspar Fischer wrote:

Loggin into teamcity as guest, I see Problems with VCS connection:

 Failed for the root 'Wicket Stuff 1.4 repository' #3: Checking  
changes for checkout rule 'trunk/wicket-contrib-tinymce=trunk/ 
wicket-contrib-tinymce' failed with erorr:  
org.tmatesoft.svn.core.SVNException: svn: PROPFIND request failed on  
'/svnroot/wicket-stuff/trunk/wicket-contrib-tinymce/src/java/wicket/ 
contrib/tinymce/tiny_mce/langs/tw.js' svn: Network is unreachable


and in addition a build error:

[ERROR] BUILD ERROR
[12:26:40]: [INFO]  


[12:26:40]: [INFO] Failed to resolve artifact.
[12:26:40]:
[12:26:40]: Missing:
[12:26:40]: --
[12:26:40]: 1) org.wicketstuff:wicketstuff-prototype:jar:1.4-SNAPSHOT
[12:26:40]:
[12:26:40]: Try downloading the file manually from the project  
website.

[12:26:40]:
[12:26:40]: Then, install it using the command:
[12:26:40]: mvn install:install-file -DgroupId=org.wicketstuff - 
DartifactId=wicketstuff-prototype -Dversion=1.4-SNAPSHOT - 
Dpackaging=jar -Dfile=/path/to/file

[12:26:40]:
[12:26:40]: Alternatively, if you host your own repository you can  
deploy the file there:
[12:26:40]: mvn deploy:deploy-file -DgroupId=org.wicketstuff - 
DartifactId=wicketstuff-prototype -Dversion=1.4-SNAPSHOT - 
Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

[12:26:40]:
[12:26:40]: Path to dependency:
[12:26:40]: 1) org.wicketstuff:wicketstuff-scriptaculous:jar:1.4- 
SNAPSHOT

[12:26:40]: 2) org.wicketstuff:wicketstuff-prototype:jar:1.4-SNAPSHOT
[12:26:40]:
[12:26:40]: --
[12:26:40]: 1 required artifact is missing.
[12:26:40]:
[12:26:40]: for artifact:
[12:26:40]: org.wicketstuff:wicketstuff-scriptaculous:jar:1.4-SNAPSHOT
[12:26:40]:
[12:26:40]: from the specified remote repositories:
[12:26:40]: central (http://repo1.maven.org/maven2),
[12:26:40]: wicket-stuff-repository (http://www.wicketstuff.org/maven/repository/ 
)


Is the first error the one 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



IndicatingAjaxLink with BaseTree appends after /td

2008-08-18 Thread Kaspar Fischer

I override BaseTree's newLink() to return an IndicatingAjaxLink:

@Override
public MarkupContainer newLink(String id, final ILinkCallback  
callback)

{
  return new IndicatingAjaxLink(id)
  {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target)
{
  callback.onClick(target);
}
  };
}

Strangely, this produces markup like this:

div id=tree1c7
 table style=display:none id=tree1c7_0
 /table
 table class=wicket-tree-content id=tree1c7_1
   tr
td class=half-line
 a class=junction-open href=# id=junctionLink1c8  
onclick=wicketShow('junctionLink1c8--ajax-indicator');var  
wcall=wicketAjaxGet('../?wicket:interface=html:14:left-column: 
1:item:tree:i:1:junctionLink::IBehaviorListener:0:1',function() 
{;wicketHide('junctionLink1c8--ajax- 
indicator');}.bind(this),function() { ;wicketHide('junctionLink1c8-- 
ajax-indicator');}.bind(this), function() {return Wicket.$ 
('junctionLink1c8') != null;}.bind(this));return !wcall;/a

/td
span style=display:none; class=wicket-ajax-indicator  
id=junctionLink1c8--ajax-indicatorimg src=../resources/ 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/indicator.gif  
alt=//span

td
...

Notice that the indicater span output by IndicatingAjaxLink's  
WicketAjaxIndicatorAppender

comes after the /td and not after the /a as I would have expected.

Is this a bug?

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Should AjaxEventBehaviour's not be removed?

2008-08-18 Thread Kaspar Fischer

I need a certain div to appear when the user mouse-overs an image.
For this, i added a behaviour to the image:

add(imageDiv.add(new AjaxEventBehavior(onmouseover)
{
  @Override
  protected void onEvent(AjaxRequestTarget target)
  {
div.setVisible(true);
imageDiv.remove(this);
target.addComponent(div);
target.addComponent(imageDiv);
  }
}));

So I remove the behaviour once the div has been shown.

If I mouse-over the image twice in a row very fast, I get a

  java.lang.IllegalStateException: No behavior listener found with  
behaviorId 0


I suppose that Wicket postpones the second request and when it is  
exectured

later on, the behaviour has already been removed.

What is the best way to have a JS behaviour executed only once?

Thanks in advance,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Customize TinyMCE init settings

2008-08-13 Thread Kaspar Fischer

I am also interested in this.

In the meantime, as a hack, one can add custom settings by overriding  
toJavaScript():


   TinyMCESettings settings = new  
TinyMCESettings(TinyMCESettings.Theme.advanced)

   {
 @Override
 public String toJavaScript(boolean ajax)
 {
   StringBuilder s = new StringBuilder();
   s.append(\n\tcontent_css: \/kc/editor.css\,);
   s.append(super.toJavaScript(ajax));
   return s.toString();
 }
   };

Regards,
Kaspar

On 20.04.2008, at 22:38, Michael Laccetti wrote:


I will take a peek into this to see what can be done.

Mike

-Original Message-
From: Zach Cox [mailto:[EMAIL PROTECTED]
Sent: April 20, 2008 3:19 PM
To: users@wicket.apache.org
Subject: Customize TinyMCE init settings

I'm using the wicket-contrib-tinymce package and need to configure  
some of

the settings that go into the init JavaScript:

tinyMCE.init({
  //settings from TinyMCESettings.toJavaScript are put here });

Specifically I need to set the content_css setting to get the same  
styles in
the editor as on the rest of the site.  Is there any way to  
customize what
goes into that tinyMCE.init call?  I can't see any way other than to  
hack

TinyMCESettings to pieces.

Maybe a public void addInitSetting(String) method would be a good  
addition

to TinyMCESettings?  There are tons of configuration options
(http://wiki.moxiecode.com/index.php/TinyMCE:Configuration) and it  
would be

nice to be able to easily set any of them.

Thanks,
Zach

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Generate URL for a Resource depending on component state

2008-08-12 Thread Kaspar Fischer
I have a component that loads on the browser via JavaScript JSON-data  
from the server.
The data depends on the component's model and needs to be loaded from  
a URL. My
approach so far was to create a subclass DataSource of  
DynamicWebResource, and to do

in my component's constructor:

  MyComponent(String id, Model model)
  {
super(id, model);

final DataSource resource = new DataSource();
resourceReference = new ResourceReference(MyComponent.class,  
something)

{
  @Override
  protected Resource newResource()
  {
return resource;
  }
};
  }

  private class DataSource extends DynamicWebResource
  // uses MyComponent.this.getDefaultModel() to obtain data
  ...

However, this registers my component class (and not the instance) with  
the resource
and all subsequently constructed components still point to the old  
resource.
How can I register a resource reference (or, what I actually want:  
just the

resource) with the component AND get a URL for it?

Thanks very much for any guidance.
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Generate URL for a Resource depending on component state

2008-08-12 Thread Kaspar Fischer

On 12.08.2008, at 12:42, Kaspar Fischer wrote:

How can I register a resource reference (or, what I actually want:  
just the

resource) with the component AND get a URL for it?


To rephrase my question and hopefully make it clearer: How can I get a  
URL

for my component which outputs the current value of my component's model
(in JSON, XML, or whatever)?

Any ideas?

I know this has come up before,

  http://markmail.org/message/yewk64k7i452cjhd

but I could not find any answer...

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: help with css and image background

2008-08-12 Thread Kaspar Fischer

On 08.08.2008, at 22:21, oriana wrote:

I need urgent one since help I have the page of begin and it don't  
want me to
catch the styles of the leaf of styles. I besides that want to put  
an image
of background in a table that on her the texts of autentication come  
and it

neither leaves me. That does it be making wrong??
I am completely new in this and I don't have idea that sew me pass. If
somebody could help me very grateful for that reason.:confused:


I do not really understand the problem you are facing, so please excuse
if my hint is general: Maybe reading a book on the subject helps?

I can recommend Wicket in Action. It is very well written (easy  
English)

and covers a broad range of topics -- maybe also the topic your problem
lies in?

  http://www.manning.com/dashorst/

Regards,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Add markup to ListView's markup

2008-08-09 Thread Kaspar Fischer

On 06.08.2008, at 14:26, Kaspar Fischer wrote:


On 06.08.2008, at 13:15, James Carman wrote:


Why not make a new panel component that has a ListView and a label at
the bottom?


I ended up doing exactly this ...

I need this component in many places, every time with different  
markup for
between li and /li. Therefore I am interested in solutions that  
allow
the user of the component to provide the markup (as users of  
ListView can

do right now).


... and my panel provides an overridable method to allow subclasses
to replace the markup between li and /li (by passing in a Fragment
or so) in case they need it.

Thanks for your help and clarifications, James.
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Add markup to ListView's markup

2008-08-06 Thread Kaspar Fischer
I try to code a subclass of ListView that adds some markup after  
(i.e., at the
bottom of) the list. Markup like a buy all cheeses in this list- 
link, for

example.

  public abstract class NodeListView extends ListViewNode
  {
public NodeListView(String id, IModelListSessionNode model,  
boolean showFooter)

{
  // ...
}
// ...
  }

Ideally, I'd like users of this class to provide the markup, for  
instance:


  ul
   li wicket:id=listwicket:container wicket:id=node//li
  /ul

with code

add(new NodeListView(list, listModel, true)
{
  @Override
  protected void populateItem(ListItemSessionNode item)
  {
item.add(new Label(node, /* ... */));
  }
});

With this approach, is it possible to add markup from within  
NodeListView?

Could a behaviour help (or overriding onRender() if it were not final)?

Another option would be to make NodeListView a Panel with associated  
markup
and have clients of NodeListView pass in a fragment, which is a bit  
unreadable:


  wicket:container wicket:id=list /
  wicket:fragment wicket:id=list-item
   wicket:container wicket:id=node/
  /wicket:fragment

with

  add(new NodeListView(list, listModel, true,
new Fragment(NodeListView.ITEM_ID, list-item, this)));

Any ideas?

Thanks, Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Add markup to ListView's markup

2008-08-06 Thread Kaspar Fischer


On 06.08.2008, at 13:15, James Carman wrote:


Why not make a new panel component that has a ListView and a label at
the bottom?


I need this component in many places, every time with different markup  
for
between li and /li. Therefore I am interested in solutions that  
allow
the user of the component to provide the markup (as users of ListView  
can

do right now).

On Wed, Aug 6, 2008 at 4:08 AM, Kaspar Fischer  
[EMAIL PROTECTED] wrote:
I try to code a subclass of ListView that adds some markup after  
(i.e., at

the
bottom of) the list. Markup like a buy all cheeses in this list- 
link, for

example.

public abstract class NodeListView extends ListViewNode
{
  public NodeListView(String id, IModelListSessionNode model,  
boolean

showFooter)
  {
// ...
  }
  // ...
}

Ideally, I'd like users of this class to provide the markup, for  
instance:


ul
 li wicket:id=listwicket:container wicket:id=node//li
/ul

with code

  add(new NodeListView(list, listModel, true)
  {
@Override
protected void populateItem(ListItemSessionNode item)
{
  item.add(new Label(node, /* ... */));
}
  });

With this approach, is it possible to add markup from within  
NodeListView?
Could a behaviour help (or overriding onRender() if it were not  
final)?


Another option would be to make NodeListView a Panel with  
associated markup

and have clients of NodeListView pass in a fragment, which is a bit
unreadable:

wicket:container wicket:id=list /
wicket:fragment wicket:id=list-item
 wicket:container wicket:id=node/
/wicket:fragment

with

add(new NodeListView(list, listModel, true,
  new Fragment(NodeListView.ITEM_ID, list-item, this)));

Any ideas?

Thanks, Kaspar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to get the remote address (IP)

2008-07-29 Thread Kaspar Fischer

I try to obtain the client's remote address from the session:

  WebClientInfo info = (WebClientInfo) session.getClientInfo();
  final String remoteAddress = info.getProperties().getRemoteAddress();

This results in 0:0:0:0:0:0:0:1%0. Any idea what might be wrong?
Thanks a lot, Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to get the remote address (IP)

2008-07-29 Thread Kaspar Fischer

On 29.07.2008, at 12:53, Hoover, William wrote:


did you try
getRequestCycleSettings().setGatherExtendedBrowserInfo(true); in your
WebApplication?


William, thanks for your answer. I indeed did not set this in my
application. But if I do, I still obtain the same result.

However, isn't there a cheap way to obtain the client's IP?
If possible, I'd like to avoid gathering extended browser info.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Prevent form from being onSubmit()'ed when button is called

2008-07-19 Thread Kaspar Fischer
My form as a onSubmit() implementation and, in addition, contains a  
button. If
I hit the button, both the button and the form's onSubmit() is  
executed as

expected. How can I prevent the form's onSubmit() from being executed?

(I tried using a Link, but this bypasses the form processing  
completely, so

setObject() is not called on my models -- which is not what I want.)

Many thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DefaultAbstractTree or BaseTree?

2008-06-20 Thread Kaspar Fischer

I've read at

  
http://markmail.org/message/3247g6jj2kvclmaw?q=list:org.apache.wicket.users+DefaultAbstractTree

that DefaultAbstractTree will be deprecated in the future. Is this
still the plan?

I am using it to get a tree with folder icons, which none of the
core subclasses of BaseTree does directly.

Thanks,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Slightly OT] Country selection component with a nice GUI

2008-06-14 Thread Kaspar Fischer

Thanks a lot for the hint regarding openlayers!

On 30.05.2008, at 20:43, Nino Saturnino Martinez Vazquez Wael wrote:

I dont think it would be too horrible to whip up such a component  
with openlayers or gmap. Otherwise you could use image maps...


Kaspar Fischer wrote:

Does anybody know of a Wicket-driven country selection component with
a nice visual interface? Something a little more fancy than a drop-
down menu: for instance, a world-map where you can select a region in
a first step and then select the country in a second step ...

Regards,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Plural and singular messages

2008-06-13 Thread Kaspar Fischer
I frequently need to deal with singular and plural versions of  
wicket:message's.

I would like to do something like:

   add(new Label(links, new PluralStringResourceModel(link, this)
{
  @Override
  public boolean isPlural()
  {
return /* some code like: */  
model.getObject().getChildren().size()  1;

  }
}));

and this will use link.plural if isPlural() returns true and link  
otherwise.


Has anybody found an elegant solution for such situations?

P.S. Here is a working implementation (neither efficient nor elegant)  
for

the above approach:

   add(new Label(link, new StringResourceModel(link${plural},
this, new ModelSerializable()
{
  @Override
  public Serializable getObject()
  {
return new Serializable()
{
  public String getPlural()
  {
return model.getObject().getChildren().size()  1 ?  
.plural : ;

  }
};
  }
})));

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Plural and singular messages

2008-06-13 Thread Kaspar Fischer

Thanks a lot, James.

I attach a simple class that makes it a little easier to work with
such messages.

On 13.06.2008, at 15:38, James Carman wrote:


The StringResourceModel uses MessageFormat patterns, so you could try
using a ChoiceFormat-based pattern.  Try this out in a main method
somewhere to get an idea of what happens:

final String pattern = {0,choice,0#none|1#one|2#couple|2many};
System.out.println(MessageFormat.format(pattern, 0));
System.out.println(MessageFormat.format(pattern, 1));
System.out.println(MessageFormat.format(pattern, 2));
System.out.println(MessageFormat.format(pattern, 100));


On Fri, Jun 13, 2008 at 9:22 AM, Kaspar Fischer  
[EMAIL PROTECTED] wrote:

I frequently need to deal with singular and plural versions of
wicket:message's.
I would like to do something like:

 add(new Label(links, new PluralStringResourceModel(link, this)
  {
@Override
public boolean isPlural()
{
  return /* some code like: */
model.getObject().getChildren().size()  1;
}
  }));

and this will use link.plural if isPlural() returns true and link
otherwise.

Has anybody found an elegant solution for such situations?

P.S. Here is a working implementation (neither efficient nor  
elegant) for

the above approach:

 add(new Label(link, new StringResourceModel(link${plural},
  this, new ModelSerializable()
  {
@Override
public Serializable getObject()
{
  return new Serializable()
  {
public String getPlural()
{
  return model.getObject().getChildren().size()  1 ?  
.plural

: ;
}
  };
}
  })));


/**
 * A simple wrapper around StringResourceModel to facilitate working  
with singular, plural, and

 * similar messages.
 * p
 * In the simplest case, you have a property  
ttwebsite=Website{0,choice,0#|1lt;s}/tt and

 * create a label like this:
 * codenew LabelString(website, new  
StringResourceModelWithCount(website, this) { public int getCount()  
{ return size; } })/code.

 *
 * @author hbf
 *
 */
public abstract class StringResourceModelWithCount extends  
StringResourceModel

{
  /**
   * See [EMAIL PROTECTED] StringResourceModel#StringResourceModel()}.
   *
   * @param resourceKey
   * @param component
   * @param model
   */
  public StringResourceModelWithCount(String resourceKey, Component? 
 component, IModel? model)

  {
// Construct
super(resourceKey, component, model, new Object[] { new  
CountExecuter() });


// Initialize
((CountExecuter) getParameters()[0]).target = this;
  }

  /**
   * Shorthand for codeStringResourceModelWithCount(resourceKey,  
component, null)/code.

   *
   * @param resourceKey
   * @param component
   * @param model
   */
  public StringResourceModelWithCount(String resourceKey, Component? 
 component)

  {
this(resourceKey, component, null);
  }

  /**
   * Subclasses should override this to return the number of items.
   *
   * @return
   */
  public abstract int getCount();

  /**
   * Helper class needed to make the actual call to [EMAIL PROTECTED]  
StringResourceModelWithCount#getCount()}.
   * (It is needed because in StringResourceModelWithCount's call  
codesuper(...)/code as we
   * cannot reference the non-static method getCount() during  
construction.)

   */
  private static class CountExecuter extends ModelInteger
  {
private StringResourceModelWithCount target;

@Override
public Integer getObject()
{
  return target.getCount();
}

  }
}


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Plural and singular messages

2008-06-13 Thread Kaspar Fischer

On 13.06.2008, at 16:47, James Carman wrote:


I think you're doing a bit too much work here.  StringResourceModel
allows you to pass in IModel objects as its parameters (check the
javadocs), so you could pass in an IModel that returns your size
parameter that is calculated at runtime.


If you mean that StringResourceModelWithCount is a little overkill,
then: yes, you are of course right; my class is nothing but syntactic
sugar. It makes the class's client code look a little more readable,
I feel.

Or did you mean the code in StringResourceModelWithCount itself?

  public StringResourceModelWithCount(String resourceKey, Component? 
 component, IModel? model)

  {
// Construct
super(resourceKey, component, model, new Object[] { new  
ModelInteger() {


  @Override
  public Integer getObject()
  {
return getCount();
  }

}});
  }

obviously does not work (method referenced at construction time). 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[Slightly OT] Country selection component with a nice GUI

2008-05-30 Thread Kaspar Fischer

Does anybody know of a Wicket-driven country selection component with
a nice visual interface? Something a little more fancy than a drop-
down menu: for instance, a world-map where you can select a region in
a first step and then select the country in a second step ...

Regards,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Busy indicator for AjaxFallbackDefaultDataTable

2008-03-26 Thread Kaspar Fischer

I am using a AjaxFallbackDefaultDataTable data table and would like
the sort links to show an AJAX busy indicator next to the link itself
when it gets clicked. How can I do this?

If this turns out to be a little complicated, I'd also be happy with
a single div somewhere on the page that gets shown during the request.

Thanks!
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to set the initially selected value of a DropDownChoice?

2008-03-20 Thread Kaspar Fischer
Thanks for the helpful link, Martijn. For the sake of completeness,  
here's

what I have ended up with:

  ListString PagerSizesList = Arrays.asList(25, 50, 100);

  ValueMap parameters = // ...
  parameters.put(search-page-size, PagerSizesList.get(0));

  form.setModel(new CompoundPropertyModel(parameters));
  form.add(new DropDownChoice(search-page-size, PagerSizesList));

On 19.03.2008, at 23:29, Martijn Dashorst wrote:


Start by reading this: http://wicket.apache.org/exampledropdownchoice.html

On 3/19/08, Kaspar Fischer [EMAIL PROTECTED] wrote:

How can I set the default value of a required DropDownChoice that
should not have null values?

  private static final ListString PagerSizesList =
Arrays.asList(25, 50, 100);

  // in constructor...
  DropDownChoice pagerSizer = new DropDownChoice(search-page-size,
PagerSizesList);
  add(pagerSizer);

I've tried overriding my DropDownChoice's getDefaultChoice(),

  @Override
  protected CharSequence getDefaultChoice(final Object selected)
  {
return option value=\\ + PagerSizesList.get(0) + /
option;
  }

but this replaces the label of the null string, but does not remove
the null string itself.

Thanks and best wishes,
Kaspar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Page store/session stats?

2008-03-19 Thread Kaspar Fischer

I fear this is a dumb question but I could not find any answer
in the list archive: how can I see how many pages are stored in
the page store and, more importantly, how large (KB) they are?

I have implemented a search page that caches search results in
a session object. I want to test this with respect to memory
usage, to catch errors like mistakenly storing a reference to
the potentially huge result set in the page instance ...

Thanks,
Kaspar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to set the initially selected value of a DropDownChoice?

2008-03-19 Thread Kaspar Fischer

How can I set the default value of a required DropDownChoice that
should not have null values?

  private static final ListString PagerSizesList =  
Arrays.asList(25, 50, 100);


  // in constructor...
  DropDownChoice pagerSizer = new DropDownChoice(search-page-size,  
PagerSizesList);

  add(pagerSizer);

I've tried overriding my DropDownChoice's getDefaultChoice(),

  @Override
  protected CharSequence getDefaultChoice(final Object selected)
  {
return option value=\\ + PagerSizesList.get(0) + / 
option;

  }

but this replaces the label of the null string, but does not remove
the null string itself.

Thanks and best wishes,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DropDownChoice and setNullValid()

2008-03-18 Thread Kaspar Fischer

I am trying to get a DropDownChoice to select either a country or
the option any country.

   searchOptions.add(new DropDownChoice(search-country, countries,  
countriesRenderer)

 .setNullValid(true).setRequired(false)  // (*)
   );

With the second line (*) commented out, the drop-down menu initially
shows

   any country
   Belgium
   ...

Once I select Belgium and submit the form, the any country vanishes
forever. That's the what I expect.

... but: with the line (*), I have the behaviour I need, but instead of
any country I get an empty string:

   empty string
   Belgium
   ...

Meaning, the DropDownChoice does not pick up anymore my entry

  search-country.null=any country

from the .properties file.

Any idea how I can get the any country?
Thanks, Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice and setNullValid()

2008-03-18 Thread Kaspar Fischer


On 18.03.2008, at 16:47, Kai Mütz wrote:

Try
search-country.nullValid=any country


Thanks, works like a charm!
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [vote] Release 1.4 with only generics and stop support for 1.3

2008-03-17 Thread Kaspar Fischer

+1

Regards,
Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Support for option disabled=disabled

2008-03-17 Thread Kaspar Fischer

Is there an easy way to disable items in a DropDownChoice?
I'd like to output something like this:

  option value=12 disabled=disabledItem/option

Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Support for option disabled=disabled

2008-03-17 Thread Kaspar Fischer

Jonas, Gerolf, thanks a lot for your answers! I've just set up my build
environment to use the latest wicket-extensions -- great!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Fallback support for ModalWindow

2008-03-15 Thread Kaspar Fischer

On 14.03.2008, at 18:04, Martijn Dashorst wrote:


it can't. ModalWindow is a javascript component. JavaScript is
necessary for displaying, hiding, positioning, closing, etc. the div
that is the modal window.


I see that it currently works like this.

The fallback solution I was thinking of was: the link to open the  
model window
renders a page which simply contains the windows as an overlayed div.  
(As you
say, the link is therefore a regular link with some JavaScript on it.)  
Of course,
as JS is unavailable, the user will not be able to drag/position it,  
but when

he clicks close, the page is rendered again.

Of course, if JS *is* available, AJAX would be used as it is done now.

P.S. Having the ability to show the modal window without JS might be  
helpful

for http://issues.apache.org/jira/browse/WICKET-12, too (?).

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Newbie question] How to avoid empty boxes?

2008-03-15 Thread Kaspar Fischer

Another possibility:

/**
 * A panel whose visibility is on iff at least one of its  
subcomponents is visible.

 */
public class Envelope extends Panel
{
  private static final long serialVersionUID = -6422145787799831814L;

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

  public Envelope(String id, IModel model)
  {
super(id, model);
  }

  @Override
  public boolean isVisible()
  {
boolean visible = false;

for (IteratorComponent it = iterator(); it.hasNext();)
{
  Component child = it.next();
  if (child.isVisible())
visible = true;
}
return visible  super.isVisible();
  }
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Fallback support for ModalWindow

2008-03-15 Thread Kaspar Fischer

On 15.03.2008, at 17:22, Martijn Dashorst wrote:


According to me, when javascript is turned off, onclick is not fired.



I agree. I'll try to be more precise:

For instance, the link to open the modal window: if it were made a link
with both href and an onClick then the href-link will be taken if JS is
off. This href-link would be such that a page is shown that contains the
modal window as a div on top of the other page content (no JS involved).
On the other hand, if JS is on, the onClick is triggered and the div  
gets

fetched and shown using JS.

Wouldn't this work? I am just trying to give a constructive feedback on
the current ModalWindow implementation where I feel that at least
conceptually the modal window can be shown even without JavaScript.

But obviously you know much more about the internal workings so  
apologies

if my comments do not hit the mark.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Fallback support for ModalWindow

2008-03-14 Thread Kaspar Fischer
Anybody has an idea how the modal window can be made to work when  
JavaScript

is disabled?

On 11.03.2008, at 17:18, Kaspar Fischer wrote:

I am using http://www.wicket-library.com/wicket-examples/ajax/modal-window 
 to
show a modal dialog holding a component. -- First of all, thanks to  
the author

of this extension! It's great, took me only 2 minutes to set it up!

One question I have is whether it is possible to make ModalWindow  
fall back
to an ordinary link to the page showing the modal window if  
JavaScript is

disabled. Does somebody know how to achieve this?

Thanks,
Kaspar



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  1   2   >