Trim nbsp from text field input

2013-09-26 Thread John Krasnay
We recently experienced a bug where someone was able to enter a trailing 
space into a TextField in spite of Wicket's automatic trimming of 
whitespace. Upon further investigation it appears the user had entered a 
non-breaking space, which is not removed by the String.trim() method 
that Wicket uses. It's easy to do this accidentally, e.g. by 
cutting-and-pasting from a web page.


This is not so easy for us to correct, as FormComponent.trim(String) is 
final. We've resorted to overriding FormComponent.getInputAsArray() and 
trimming each string individually.


Should Wicket use a more robust trim method? Or should 
FormComponent.trim(String) at least be made non-final so we adjust it to 
our needs in a less clunky way?


jk

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



Revisit WICKET-2684?

2013-05-22 Thread John Krasnay
WICKET-2684 is titled 'Provide a way to disable "Child component has a 
non-safe child id"'. It was closed as "invalid", but I think I have a 
use-case that wasn't considered when it was closed.


In our application we're moving to an approach of building most of our 
UI by adding panels to RepeatingViews. This allows us to build our pages 
without creating HTML files for each page, making it easy to keep HTML 
patterns consistent across the app.


As part of this strategy we've implemented a series of panels that each 
house a single input control and it's associated label. We might build a 
form like this:


---
FormPanel form = new FormPanel(newPanelId(), new 
CompoundPropertyModel(empModel));

addPanel(form);
form.addPanel(new TextFieldPanel("firstName"));
form.addPanel(new TextFieldPanel("lastName"));
---

"addPanel(...)" is a method we implement on our pages and container 
panels that simply adds the given component to a RepeatingView on the 
parent. The non-numeric child ID warning would be triggered twice here, 
for the text field panels, but these IDs are required for the example to 
work with CompoundPropertyModel.


BTW to use CompoundPropertyModel as shown above, we've created something 
called a DelegateModel:


---
public class DelegateModel implements IModel {

private Component component;

public DelegateModel(Component component) {
this.component = component;
}
public T getObject() {
IModel model = (IModel) component.getDefaultModel();
return model != null ? model.getObject() : null;
}
public void setObject(T object) {
IModel model = (IModel) component.getDefaultModel();
if (model != null) {
model.setObject(object);
}
}
}
---

We then create our TextFieldPanel like this:

---
public TextFieldPanel(String id) {
this(id, null);
}
public TextFieldPanel(String id, IModel model) {
super(id, model);
add(new TextField("field", new DelegateModel(this)));
}
---

This seems to work well, except for the slew of warnings about non-safe 
child IDs.


In WICKET-2684, Igor advised to "use a low-level repeater where you have 
total control - RepeatingView", which we're doing, but later warned "you 
do realize that if you use nonnumeric ids some things will break".


So I have two questions:

1. Is this use-case enough to re-open WICKET-2684 to remove the warning 
(or at least relocate it if, for example, ListView depends on it)? Or 
should I just silence the warning in my log4j config and move on?
2. Is there really something in AbstractRepeater/RepeatingView that 
depends on numeric IDs? I can't see anything myself, but I'd like to 
know in case it interferes with our panel-based approach.


Thanks and sorry for the longish post.

jk


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



Re: Wicket + Eclipse + Tomcat

2010-08-23 Thread John Krasnay

On 10-08-22 08:04 PM, James Carman wrote:

Do you have the maven plugin installed in Eclipse?  I know I needed
that to get it to understand the mavenized web structure.  I'm not an
Eclipse expert, but I seem to remember having to have that.


You don't need the Maven plug-in in Eclipse, and if you do have it 
installed you shouldn't need the mvn eclipse:eclipse step.


jk

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



Re: Wicket + Eclipse + Tomcat

2010-08-22 Thread John Krasnay

On 10-08-21 12:38 PM, Mike Dee wrote:

Here is what I've been trying.  Install Eclipse with Tomcat integration.




mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp
-DarchetypeArtifactId=maven-archetype-webapp

and then generate Eclipse project files

mvn eclipse:eclipse



This is very similar to how I'm working, so there must be something 
wrong. First, what do you mean by "Eclipse with Tomcat Integration"? I 
use the Eclipse JEE version that comes with the Web Tooling Platform 
(WTP), which understands the web-app nature of your project.


Next, look in your pom.xml. You should see something like this...

  
org.apache.maven.plugins
maven-eclipse-plugin

  true
  true
  /myapp
  1.5

  

It's the wtpContextName and wtpversion elements that identify the 
project as a web app, and allow mvn eclipse:eclipse to generate the 
right project structure. Does your pom.xml look OK?


jk

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



Re: Can I develop without recompiling/restarting after every change?

2010-06-06 Thread John Krasnay
On Sun, Jun 06, 2010 at 08:54:18AM +1200, b...@actrix.gen.nz wrote:
> If you study the effects of adding resource paths in Wicket then you
> will find that both methods will co-exist, not negate each other as
> you write.

Yes, I understand that. But you have to put the markup for each
component somewhere. If it's not on the classpath, then you will not be
able to package that component into a JAR for re-use.

> There are environments such as yours and other trivial environments
> where nothing needs to be done at all.

I'm curious as to why you think my environment is trivial. 

> That does not mean that doing
> nothing is best practice. Best practice is something else. A best
> approach in an individual case may be different from best practice,
> and that is why you disagree.

No, we disagree because I think that "doing nothing", i.e. keeping your
component markup on the classpath, *is* the best practice, that is, the
majority opinion on what makes the most sense for most people.

If you feel that the default approach isn't the best practice, then you
are saying that the Wicket designers made a mistake by making this the
default. I disagree strongly with that sentiment.

> Deploy on save would take only milliseconds (with my proposed path
> structure applied) and the session would be preserved if you were
> using GlassFish 3.0 and NetBeans, leading to a performance gain. You
> may not need this functionality, but your setup seems to be slower
> than what is achievable.

I think perhaps we mean different things by "deploy on save". When I say
"deploy" I mean it in the J2EE sense, where the container re-loads my
WAR package. In my case, this re-loads my Spring context and a few dozen
JPA entity beans, which takes up to 15 seconds on my relatively modern
laptop. There is no way rearranging my markup (or running it on a "fully
certified J2EE server") would turn this into milliseconds.

> Yes I am moving markup around. And that (with an additional 3 lines of
> framwork code) leads to a re-definition of best practice for Wicket
> page development as I see it because of two gains:

Look, the only reason I took up this (now too long) thread is your use
of the words "best practice", which implies a broadly held consensus.
Now that you've included "as I see it" I'm happy to let it drop.

jk

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



Re: Can I develop without recompiling/restarting after every change?

2010-06-05 Thread John Krasnay
On Sat, Jun 05, 2010 at 10:13:42AM +1200, b...@actrix.gen.nz wrote:
> Hi,
> 
> My suggestions were meant to be general, and with "best" I actually
> meant in all environments including certified J2EE servers.

I'm aware that's what you meant. That's why I challenged it. I don't
agree that it's the best approach in all environments, and I think your
advice negates one of the best features of Wicket, namely the ability to
package complete Wicket components (including their markup and other
resources) into JAR files for convenient re-use across applications.

Since the OP is a self-confessed "n00b" I wanted to make sure he didn't
miss out on this important point.

> That is because deployment environments may or may not make decisions
> on which way to deploy different file types, or depending on
> directories they are loaded from. Files in the web directory are quite
> obviously candidates for the fastest deployment method.
> 
> If the environment thinks that HTML files need to be deployed in the
> same way as Java files, which is quite likely if they are stored in
> Java packages, then deploy-on-save setups may slow down the
> development process of complex applications due to heavy CPU use.

I think perhaps you're missing the point here. In my development
environment (Eclipse+Tomcat) I *don't* re-deploy on save. That would be
far too slow. But any markup changes I make (and a good portion of the
Java changes, too) are usually picked up by the time I Alt-Tab to my
browser and refresh the page.

I think that was Martijn's point: if you're doing re-deploy on save in
your development environment (as the OP implied he was) then you're
doing it wrong. No amount of moving markup around is goint to change
this.

jk

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



Re: Can I develop without recompiling/restarting after every change?

2010-06-03 Thread John Krasnay
Hrm, perhaps you should have qualified your advice: "If you're using
NetBeans, then for best performance..."

Also, the packaging of markup on the classpath allows you to create
re-usable JARs of components and IMHO is one of the best features of
Wicket. So perhaps the qualification should really be, "If you're using
NetBeans, and you're not planning on packaging your Wicket components in
a re-usable JAR, then for best performance..."

The way your original post is phrased makes it sound like a best
practice, and it implies the Wicket default to fetch markup from the
classpath is inferior. I don't think this is a consensus among the
community.

jk

On Thu, Jun 03, 2010 at 08:57:43PM +1200, b...@actrix.gen.nz wrote:
> Martijn,
> 
> You are making a *lot* of assumptions.
> 
> Not everybody uses Eclipse.
> 
> Nobody in this thread would consider restarts acceptable, still we are
> using this subject.
> 
> HTML files location has to do with performance in the developing
> process depending on how the IDE handles the files.
> 
> Please advise how to configure the NetBeans IDE to redeploy a HTML
> file in a Java package in a J2EE app server with the same speed as
> HTML files in the web directory (milliseconds not seconds).
> 
> 
> Thanks
> 
> Bernard
> 
> 
> 
> 
> On Sun, 30 May 2010 15:23:09 +0200, you wrote:
> 
> >Huh?
> >
> >Storing the HTML in the packages has *nothing* to do with requiring
> >restarts. Only wrongly configured IDEs may cause that.
> >
> >If your HTML doesn't get reloaded when you change it, then you should
> >run Wicket in DEVELOPMENT mode. Also make sure you've configured
> >Eclipse to copy all resources (not just .properties files)
> >
> >The Wicket Quickstart project and using Maven to generate your eclipse
> >project files (mvn eclipse:eclipse) will configure everything
> >correctly.
> >
> >Martijn
> >
> >On Sat, May 29, 2010 at 11:18 PM,   wrote:
> >> Hi,
> >>
> >> For best performance of redeploys in Wicket, consider storing HTML not
> >> in the Java package structure but in the web directory. So if your IDE
> >> and app server allow for hot deployment, then HTML changes deploy much
> >> faster, ie instantly. In your application init(), you add one
> >> statement
> >>
> >> getResourceSettings().addResourceFolder("wicket");
> >>
> >> where "wicket" matches the url-pattern in your filter-mapping in
> >> web.xml.
> >>
> >> PLease see https://issues.apache.org/jira/browse/WICKET-2881 for some
> >> background on how to take this one step further.
> >>
> >> Additionally, with GlassFish V3, you get session preservation on hot
> >> deployment of Java classes.
> >>
> >> You can enable "deploy on save" for convenience.
> >>
> >> If that is not fast enough, you can run your app in debug mode and hot
> >> swap classes after save while you are debugging it.
> >>
> >> All this comes with the NetBeans IDE. You really don't have to worry
> >> about this stuff anymore.
> >>
> >> Regards
> >>
> >> Bernard
> >>
> >>
> >>
> >> On Sat, 29 May 2010 16:12:46 +0100, you wrote:
> >>
> >>>have you tried JRebel? ?I've not used it myself, but there was an
> >>>interview on JavaPosse recently, sounds like it'd be an ideal fit for
> >>>any Wicket developer.
> >>>
> >>>Dan
> >>>
> >>>On 22/07/28164 20:59, David Chang wrote:
>  I am using Tomcat, any tips about how to develop out 
>  recompiling/restarting after every change?
> 
>  Best.
> 
>  --- On Fri, 5/21/10, Jeremy Thomerson ?wrote:
> 
> 
> > From: Jeremy Thomerson
> > Subject: Re: Can I develop without recompiling/restarting after every 
> > change?
> > To: users@wicket.apache.org
> > Date: Friday, May 21, 2010, 12:17 PM
> > the easiest way to do this is to use
> > the Start class (Start.java) from the
> > quickstart to run an embedded jetty instance in your
> > IDE. ?then, if you run
> > it in debug mode, it will hotswap any possible changes (and
> > tell you if you
> > must restart if it's an incompatible change)
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> >
> > On Fri, May 21, 2010 at 10:53 AM, ekallevig
> > wrote:
> >
> >
> >> I'm a front-end developer trying to learn Java (total
> >>
> > n00b) and working on
> >
> >> a
> >> wicket application at work. ?The whole process
> >>
> > feels very slow primarily
> >
> >> because I have to recompile and restart JBoss every
> >>
> > time I make a change.
> >
> >> So I'm wondering what the best way is to avoid having
> >>
> > to do this when
> >
> >> editing .java/.js/.css/.html files during development?
> >>
> > I'd like to just
> >
> >> make
> >> changes and then refresh the browser to test -- is
> >>
> > this possible?
> >
> >> I've seen in the FAQ that you can change the
> >>
> > application settings to
> >
> >> auto-reload markup .html

Re: Can I develop without recompiling/restarting after every change?

2010-05-31 Thread John Krasnay
This is how I work too. It uses the "hot swap" feature of the JVM. It
works if you only change method bodies, but if you make changes to the
class structure (fields, method signatures, etc.) you have to restart
the VM. Apparently jRebel can reload even these kinds of changes.

I'm happy with hot swap, but then again my app only takes ~14 seconds to
restart.

jk

On Sun, May 30, 2010 at 04:22:29PM -0500, Jeremy Thomerson wrote:
> On Sun, May 30, 2010 at 12:05 PM, Alex Objelean 
> wrote:
> 
> >
> > jRebel allows you to change the java code without restarting the server.
> >
> 
> I've not used jRebel, but I commonly run my applications in debug mode in
> Eclipse and do not have to restart the server - even with code changes.  The
> exception is changing a method signature of classes that are already loaded
> - but adding methods, classes, or changing 90% of code does not require a
> restart.  So, what does jRebel add?  Does it eliminate restarts even in
> these cases where the normal debug mode requires one?
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com

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



Re: Easymock question

2009-12-16 Thread John Krasnay
Is UserFactory an interface or an implementation class?

jk

On Wed, Dec 16, 2009 at 09:02:16PM +0100, pieter claassen wrote:
> I am trying to mock my DAO's, but I am not sure if I understand easymock
> correctly.
> 
> In my WicketSession I store a user ID and use this to retrieve the current
> logged in user from the database (by calling Spring injected
> userFactory.getById((String)userId)).
> 
> Below is my setUp() for Junit. But the first expect line actually ends up
> calling the UserFactory.getID() method. Considering that the factory has no
> real connection, this call will obviously fail.
> 
> Here is my question: I thought the mock framework hijacks the actually call
> and replaces the result with the dummy return value? Is there a way to stop
> it from calling the method?
> 
> Thanks,
> Pieter
> 
>  public void setUp() {
> mockContext = new AnnotApplicationContextMock();
> UserFactory mockuserfactory=createMock(UserFactory.class);
> User user=new User();
> expect(mockuserfactory.getID(user)).andReturn(1L);
> expect(mockuserfactory.getById(1L)).andReturn(user);
> replay(mockuserfactory);
> mockContext.putBean("userFactory", mockuserfactory);
> MockWicketApplication webapp = new MockWicketApplication();
> webapp.setMockContext(mockContext);
> tester = new WicketTester(webapp);
> tester.setupRequestAndResponse();
> WicketSession session = (WicketSession) tester.getWicketSession();
> session.setUser(user);
> 
> 
> }
> 
> -- 
> Pieter Claassen
> musmato.com

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



Re: Glue for composing panels

2009-10-29 Thread John Krasnay
On Thu, Oct 29, 2009 at 05:58:02PM -0200, Pedro Santos wrote:
> Nice approach, the only missing is that you hasn't how to prevent your
> component users from call addLeftNavChild after render phase at development
> time. But it is no big deal, since they will get an exception at runtime...
> 

By "component users" do you mean subclasses? They can call it from the 
constructor.

jk

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



Re: Glue for composing panels

2009-10-29 Thread John Krasnay
Rather than having the base class "pull" in components from the subclass,
recently I've been tackling this kind of problem by creating RepeatingViews in
the base class and letting subclasses "push" components in by adding to the
repeating view:


  


public class BasePage extends WebPage {
private RepeatingView leftNavChildren;
public BasePage() {
add(leftNavChildren = new RepeatingView("leftNavChild"));
}
protected void addLeftNavChild(Component child) {
leftNavChildren.add(child);
}
protected String newLeftNavChildId() {
return leftNavChildren.newChildId();
}
}

public class SubPage extends BasePage {
public SubPage() {
addLeftNavChild(new MyNavPanel(newLeftNavChildId()));
}
}

jk

On Thu, Oct 29, 2009 at 01:50:06PM -0500, Frank Silbermann wrote:
> 
> I was discussing glue for composing reusable panels into web pages on
> the blog of Erik van Oosten
> (http://blog.jteam.nl/2009/09/16/wicket-dos-and-donts/).
> 
> I told him that my approach had been to create an abstract base page
> that constructs the common elements while leaving place-holders for
> page-specific panels by defining methods such as:
> 
>   abstract Panel createUpperLeftPanel (String wicketID);
>   abstract Panel createLowerRightPanel(String wicketID);
> 
> and having the base page's constructor say things like:
> 
>   Panel p1 = createUpperLeftPanel("a_wicket_id");
>   add(p1);
>   ...
>   Add( createUpperRightPanel("another_wicket_id") );
> 
> The child page's contribution would be the implementation of the
> abstract methods.
>  
> I explained that I preferred this to mark-up inheritance because I could
> add to the base page in any number places (not just one place), the
> compiler would tell the child-page writer exactly what panels were
> needed, and most importantly, no additional mark-up whatsoever would
> need to be associated with any of the child pages.  (Panel classes used
> by the child page would of course have their associated mark-up.)  
> 
> Eric and others explained what a bad idea it is for constructors to call
> overridable methods -- they execute before the child-page's properties
> have been set.  I usually got away with this, but I admit I was burnt a
> few times.  Recently, I wondered whether there might be a simple fix for
> the constructor-calls-overridable-method problem, such as:
> 
> (a) Move the base page's component tree construction out of the
> constructor, and put it into the method:
> 
>   private void assembleComponents() {
>   ...
>   }
> 
> (b) Add the property:
> 
>   private boolean componentsAssembled = false;
> 
> (c) Override as follows to construct the component tree after the class
> constructors finish:
> 
>   @Override
>   void onBeforeRender() {
>   if ( !componentsAssembled ) {
>   assembleComponents();
>   componentsAssembled = true;
>   }
>   super.onBeforeRender(); // Or whatever else is needed
>   }
> 
> Then component construction would wait until the properties in both the
> parent and the subclass had been set.  I'd no longer have the problem
> associated with calling abstract methods from the constructor.
> 
> Do you see any disadvantages to this approach? Is there a more
> appropriate hook upon which to hang my base page's component-tree
> assembly?
> 
> If it _is_ a good approach, is there any reason the Wicket designers
> chose not to create an overrideable method in the Component class that
> is called just once after constructors terminate, and tell developers
> that this is where the component tree should be created?
> 
> /Frank
> 
> -
> 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: Idiomatic way to reference shared images?

2009-10-22 Thread John Krasnay
On Thu, Oct 22, 2009 at 09:15:35AM +0200, Ceki Gulcu wrote:
> Hi John,
>
> Thank you for your answer. I was already aware of the idiomatic way for  
> referencing packaged resources. It is a nice way for bundling images 
> which are used within a package. My question was about images shared 
> among multiple packages.

Not sure what you mean. The Image/ResourceReference solution works fine across
packages and even across modules, e.g. your images could be part of a shared
library and used by a component in your application.

> Of course the interesting part is that the "help.gif" file is located as 
> a resource of my web-app and *not* part of WEB-INF/lib or 
> WEB-INF/classes.

Ah, I see, you want to put it there. Is there a technical reason for this or is
it just a preference? Seems to me to be a lot less flexible than simply letting
your images live on the classpath, since you lose the ability to later package
the images in a shared JAR.

jk


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



Re: Idiomatic way to reference shared images?

2009-10-21 Thread John Krasnay
On Wed, Oct 21, 2009 at 07:57:12PM +0200, Ceki Gulcu wrote:
> Hello,
>
> I am trying to defined shared images in a Wicket application.
>
> In my prokect, the image file "help.gif" is located under the
> src/main/java/com/foo/ folder of my project. I have created an empty
> class called Images.
>
> package com.foo;
> public class Images {
> }
>
> In the init() method of my web-application, I add help.gif as a shared 
> resource:
>
> public class MyApplication extends WebApplication {
>
>
>   @Override
>   protected void init() {
> ...
> PackageResource pr = PackageResource.get(Images.class, "help.gif");
> sharedResources.add("help.gif", pr);
>   }
> }
>

I normally don't need to do anything in my app's init() method for images.

> In markup, I attempt to access the images as
>
>
>  
>
>

You would use  when the image is in the same package as the
markup. In this case, you would just put in  and Wicket
will re-write the src attribute to the right value. This works well if you like
to preview your markup in a browser.

Since your images are (I think) in a different package, you should get rid of
the  tag.

(Actually, I think using a relative path to the right package in src might
work with , but I never do it that way. See below.)

> Unfortunately, this does not seem to work. However, the following
> markup works just fine but it's too cumbersome to write.
>
>
>  
>
>
> Reading page 229 of the Wicket in Action book, I would have thought
> that the "/resources/help.gif" reference would have worked. Quoting
> from the book:
>
>   The resource is then available through a stable URL (/resources/discounts),
>   independent of components. (page 229)
>
> What is the idiomatic way in Wicket to reference shared images?
>

Here's my idiom. First, in the same package as my images, I create a class that
extends ResourceReference:

public class MyImage extends ResourceReference {
public MyImage(String name) {
super(MyImage.class, name);
}
}

Then, I attach an Image component to the  tag:



add(new Image("smiley", new MyImage("smiley.gif")));

No code needed in Application.init(), and no  tags required.

jk

> Many thanks in advance for your response,
>
> -- 
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for Java.
> http://logback.qos.ch
>
> -
> 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: [offtopic[ how to attach sources to wicket jars when debugging

2009-09-29 Thread John Krasnay
I don't use m2eclipse, but I have this in my pom.xml...

  
org.apache.maven.plugins
maven-eclipse-plugin

  true
  true

  

Seems to do the trick. I would look first at the m2eclipse settings first,
though.

jk

On Tue, Sep 29, 2009 at 11:47:23AM +0400, Vladimir Kovalyuk wrote:
> I believe it must be something extremely simple.
> I set up a project in Eclipse Galileo using m2eclipse from Sonatype.
> I'm trying to debug the wicket class. I set breakpoints and the execution
> stops exactly at those points. The wicket sources are actually attached. I
> can see the source code. But when the execution stops at breakpoint eclipse
> says that there is no sources and variables panel does not show local
> variables.
> 
> Could somebody give me a hint how I can debug wicket sources?

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



Re: Selectively ignoring required fields

2009-09-15 Thread John Krasnay
On Tue, Sep 15, 2009 at 03:10:51PM +0100, Phil Housley wrote:
> 
> A good point, but I don't think it exactly applies in this case.  What
> I really want is for each component to know whether it is required
> within a very small context.  For example, a might have a criteria
> panel (one of the sub-parts of the searcher) set out as follows:
> 
> [x] must be a foo called [_]
> 
> In which case, the sub panel will be in total charge of whether the
> text field is required.
> 

I like to do this as described here:

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

final CheckBox checkBox = new CheckBox("cb");
form.add(checkBox);

TextField foo = new TextField("foo") {
public boolean isRequired() {
return Strings.isTrue(checkBox.getValue());
}
}
form.add(foo);

> On the other hand, maybe that whole criteria panel is deselected, in
> which case I want to be able to stop the whole thing from doing any
> validation at all, so it won't even look at whether the check box is
> checked.
> 

I assume here that the checkbox/radiobutton is implemented at a higher level in
the hierarchy and you don't want the internals of the panel to know about it.
Is that right?

In this case, I usually implement a method on my panel, then delegate the
isRequired method on my form components to this panel method:

public class MyPanel extends Panel {
public MyPanel(String panelId, ...) {
super(panelId);
new TextField("foo") {
public boolean isRequired() {
return MyPanel.this.isRequired();
}
}
}

/** Override to control whether my child components are required */
public boolean isRequired() {
return true;
}
}

You can then just repeat the pattern above, overriding MyPanel.isRequired() and
checking your checkbox/radiobutton there.

jk


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



Re: Changing position of WicketAjaxDebug panel

2009-09-03 Thread John Krasnay
!important is your friend...

a#wicketDebugLink {
  background-color:#44 !important;
  border:medium none !important;
  bottom:0 !important;
  color:white !important;
  opacity:0.8 !important;
  right:0 !important;
  text-decoration:none;
  text-transform:lowercase !important;
}

jk

On Thu, Sep 03, 2009 at 04:47:36PM +0200, Tomek Sniadach wrote:
> Hi,
> is there a possibility to change the position of opener panel? It is fixed
> on the right side with embedded style attributes, so i cannot override it
> with my own css. Unfortunately this is the place, where I have my submit
> button. My workaround is firebug, but it's annoying. Have someone an idea?
> 
> Regards
> Tomek

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



Re: Weird exception

2009-09-02 Thread John Krasnay
OC4J 10.1.3.3
Java 1.5.0_06
Red Hat Linux (not sure of the version)

jk

On Wed, Sep 02, 2009 at 07:31:31PM +0200, nino martinez wael wrote:
> What kind of container are you running it in? And java version etc..?
> 
> 2009/9/2 John Krasnay :
> > We've been getting the following exception intermittently during a
> > performance test:
> >
> > Caused by: java.lang.ClassCastException: [B
> >  at org.apache.wicket.Session.pageMapForName(Session.java:928)
> >  at org.apache.wicket.PageMap.forName(PageMap.java:67)
> >  at org.apache.wicket.Page.init(Page.java:1167)
> >  at org.apache.wicket.Page.(Page.java:236)
> >  at org.apache.wicket.markup.html.WebPage.(WebPage.java:184)
> >  at ca.on.ssha.oneid.web.ui.BasePage.(BasePage.java:52)
> >  at ca.on.ssha.oneid.web.ui.login.LoginPage.(LoginPage.java:45)
> >  ... 29 more
> >
> > We are using Wicket 1.3.5. At Session.java:928 Wicket is trying to cast
> > a session attribute to IPageMap but apparently the attribute value is a
> > byte array. So far we've only seen it on the initial page for the
> > session, such as the login page in the example above.
> >
> > Any ideas?
> >
> > jk
> >
> > -
> > 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



Weird exception

2009-09-02 Thread John Krasnay
We've been getting the following exception intermittently during a
performance test:

Caused by: java.lang.ClassCastException: [B
  at org.apache.wicket.Session.pageMapForName(Session.java:928)
  at org.apache.wicket.PageMap.forName(PageMap.java:67)
  at org.apache.wicket.Page.init(Page.java:1167)
  at org.apache.wicket.Page.(Page.java:236)
  at org.apache.wicket.markup.html.WebPage.(WebPage.java:184)
  at ca.on.ssha.oneid.web.ui.BasePage.(BasePage.java:52)
  at ca.on.ssha.oneid.web.ui.login.LoginPage.(LoginPage.java:45)
  ... 29 more

We are using Wicket 1.3.5. At Session.java:928 Wicket is trying to cast
a session attribute to IPageMap but apparently the attribute value is a
byte array. So far we've only seen it on the initial page for the
session, such as the login page in the example above.

Any ideas?

jk

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



Re: wicket + jquery

2009-09-02 Thread John Krasnay
Yeah, $(document).ready will not re-run upon AJAX changes. I think
jQuery 1.3 has something called "live selectors" that kick in whenever
the DOM changes. Alternatively, you could just attach some Javascript to
the AjaxResponseTarget that initializes qtip for the new elements you're
adding.

jk

On Mon, Aug 31, 2009 at 11:43:58PM +0200, Mostafa Mohamed wrote:
> Hi i'm using the qtip jquery plugin to add tooltips, i use the following 
> script:
> 
> $(document).ready(function()
> {
> $('a[title]').qtip(
> {
> show: {
> when: 'click',
> solo: true
> },
> position: {
> corner: {
> target: 'topRight',
> tooltip: 'bottomLeft'
> }
> },
> style: {
> border: {
> width: 1,
> radius: 0,
> color: 'black'
> },
> padding: 10,
> textAlign: 'center',
> tip: true,
> title: {
> 'border-width': '1px',
> 'border-style': 'solid',
> 'border-color': 'black'
> }
> }
> });
> });
> 
> this will take tip and display a tooltip
> when the link is clicked.
> 
> However in one of my pages, when a user selects something from a drop
> down choice i add a fragment to the page using ajax. when i click on
> the tooltip link in this fragment the tooltip refuses to show. when i
> click on a non-ajax loaded tooltip link, it works just fine. i'm
> guessing it's because of $(document).ready. any clue as to how this
> could be solved? can wicket be of help in something like this?
> 
> -
> 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: Form validation and replaceable panels

2009-08-31 Thread John Krasnay
Oh, sorry, missed that. Thanks!

jk

On Mon, Aug 31, 2009 at 02:40:33PM -0700, Igor Vaynberg wrote:
> later versions of wicket (1.4.0+?) have Component#onRemove()
> 
> -igor
> 
> On Mon, Aug 31, 2009 at 1:42 PM, John Krasnay wrote:
> > Hi folks,
> >
> > I have a wizard-like page with a form, and inside the form I have a
> > panel that I replace as the user moves through the flow. In some cases,
> > I need one of the panels to contribute a form validator to the enclosing
> > form.
> >
> > Adding the validator is simple enough: I just override the panel's
> > onBeforeRender(), find the form, and add the validator. But removing the
> > validator is tricky since there doesn't seem to be a way to have Wicket
> > notify the panel that it has been removed.
> >
> > Currently, I have the page call a "onRemove" method on panels that
> > implement a particular interface, but it would be nice if I didn't need
> > to explicitly do this.
> >
> > Am I missing something?
> >
> > jk
> >
> > -
> > 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



Form validation and replaceable panels

2009-08-31 Thread John Krasnay
Hi folks,

I have a wizard-like page with a form, and inside the form I have a
panel that I replace as the user moves through the flow. In some cases,
I need one of the panels to contribute a form validator to the enclosing
form.

Adding the validator is simple enough: I just override the panel's
onBeforeRender(), find the form, and add the validator. But removing the
validator is tricky since there doesn't seem to be a way to have Wicket
notify the panel that it has been removed.

Currently, I have the page call a "onRemove" method on panels that
implement a particular interface, but it would be nice if I didn't need
to explicitly do this.

Am I missing something?

jk

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



Re: Ajax based filling of form

2009-08-13 Thread John Krasnay
The problem is the CompoundPropertyModel continues to point to the
original Book object. You would have to get rid of the
CompoundPropertyModel and give each FormComponent its own model that is
tolerant to changes to the book member. Something like this would work:

add(new TextField("title", new PropertyModel(this, "book.title")));

jk

On Thu, Aug 13, 2009 at 09:15:50AM +0200, Linda van der Pal wrote:
> Well the model doesn't update. (Not that I'd expect it to.)
> 
> Here's some pieces of my code I deem relevant to the problem.
> 
> 
> if (key == null || key.getIsbn() == null) {
>book = new Book();
> } else {
>book = bookRetriever.getBook(key.getIsbn(), key.getCollectionId());
> }   
> 
> setDefaultModel(new CompoundPropertyModel(book));
> 
> // ...
> 
> isbnField.add(new AjaxFormComponentUpdatingBehavior("onchange") {
>private static final long serialVersionUID = 1L;
> 
>@Override
>protected void onUpdate(final AjaxRequestTarget target) {
>try {
>book = bookRetriever.getBook(isbnField.getInput());
>modelChanged();
>   
>target.addComponent(titleField);
>//...
>    target.addComponent(genrefield);
>} catch (SQLException e) {
>//...
>}
>}
> });
> 
> John Krasnay wrote:
> >Sounds like you're on the right track. What's the problem?
> >
> >jk
> >
> >On Wed, Aug 12, 2009 at 04:27:41PM +0200, Linda van der Pal wrote:
> >  
> >>I have a panel with a form. This form has several fields, one of which 
> >>is the ISBN of a book. The fields are filled by a CompoundPropertyModel 
> >>if the user is editing his previous entry, and they are empty if the 
> >>user is adding a new book. Simply entering data or updating it and then 
> >>submitting already works. But now I want to fetch the data for the other 
> >>fields if the ISBN is already in the database. It is a multi-user 
> >>system, so it is in fact possible that the ISBN is already in there.
> >>
> >>I was thinking of achieving this with AJAX, but I'm not really sure how 
> >>to do it. I was thinking of adding an AjaxFormComponentUpdatingBeavior, 
> >>where all the related fields are added to the target. But as the ISBN is 
> >>part of the model, I don't really now how to get this working. Any hints 
> >>on what direction I should be searching in?
> >>
> >>Regards,
> >>Linda
> >>
> >>-
> >>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
> >  
> >
> >
> >
> >No virus found in this incoming message.
> >Checked by AVG - www.avg.com 
> >Version: 8.5.392 / Virus Database: 270.13.53/2299 - Release Date: 08/12/09 
> >18:12:00
> >
> >  
> 
> 
> -
> 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: how to include head resources below generated component additions to head

2009-08-12 Thread John Krasnay
You can solve this using CSS. Read up on CSS rule specificity.

Suppose your component has a rule like this:

  span.foo { color: red; }

If you want to override that with a rule that comes before it, you can
use !important like this:

  span.foo { color: red !important; }

But IMHO this is overkill. A more flexible way is to increase the
*specificity* of the earlier rule. Generally, this means to add more
terms to the rule:

  html span.foo { color: red; }

CSS considers this more specific than span.foo {...} so it gives it
higher priority, even if span.foo {...} comes later.

jk

On Wed, Aug 12, 2009 at 05:22:07PM +0200, Joe Hudson wrote:
> Hello,
> 
> I would like to override some of the styles of components I am using in my 
> page.  However, when I include a CSS resource at the head of my WebPage 
> component, the incude occurs above all of the component includes.  Is there 
> any way I can specify for an include to be below component includes that I am 
> using inside my WebPage component?
> 
> For example:
> Here is example markup for the web page component
> 
>   
>  
> 
>   
> Using some component here
>   
> 
> 
> The output is something like this:
> 
> 
> 
> 
> 
>  href="styles/style.csshttp://localhost:8080/wicket/styles/style.css>"/>
> 
>  src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.jshttp://localhost:8080/wicket/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js>">
> 
>  src="resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.jshttp://localhost:8080/wicket/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js>">
> 
>  src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.jshttp://localhost:8080/wicket/resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js>">
> 
> ...
> 
> 
> 
> 
> 
>...
> 
> 
> 
> The output that I would like to achieve is something like this:
> 
> 
> 
> 
> 
>  src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.jshttp://localhost:8080/wicket/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js>">
> 
>  src="resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.jshttp://localhost:8080/wicket/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js>">
> 
>  src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.jshttp://localhost:8080/wicket/resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js>">
> 
> ...
> 
>  href="styles/style.csshttp://localhost:8080/wicket/styles/style.css>"/>
> 
> 
> 
> 
> 
> 
> 
> Is there some kind of component or application setting for this?  Thanks very 
> much for the help.
> 
> 
> 
> Joe
> 

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



Re: Ajax based filling of form

2009-08-12 Thread John Krasnay
Sounds like you're on the right track. What's the problem?

jk

On Wed, Aug 12, 2009 at 04:27:41PM +0200, Linda van der Pal wrote:
> I have a panel with a form. This form has several fields, one of which 
> is the ISBN of a book. The fields are filled by a CompoundPropertyModel 
> if the user is editing his previous entry, and they are empty if the 
> user is adding a new book. Simply entering data or updating it and then 
> submitting already works. But now I want to fetch the data for the other 
> fields if the ISBN is already in the database. It is a multi-user 
> system, so it is in fact possible that the ISBN is already in there.
> 
> I was thinking of achieving this with AJAX, but I'm not really sure how 
> to do it. I was thinking of adding an AjaxFormComponentUpdatingBeavior, 
> where all the related fields are added to the target. But as the ISBN is 
> part of the model, I don't really now how to get this working. Any hints 
> on what direction I should be searching in?
> 
> Regards,
> Linda
> 
> -
> 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: Nested forms : don't process inner form when outer form is submitted

2009-08-06 Thread John Krasnay
Oh, is that new? Perhaps my example on the wiki is indeed fubar.

jk

On Thu, Aug 06, 2009 at 08:14:51AM -0700, Igor Vaynberg wrote:
> no, when a form's isenabled() returns false then all of its
> descendants are also disabled. when a formcomponent is disabled it
> adds disabled="disabled" attribute, so you wont be able to use it in
> the browser.
> 
> -igor
> 
> On Thu, Aug 6, 2009 at 7:32 AM, John Krasnay wrote:
> > On Thu, Aug 06, 2009 at 07:09:20AM -0700, nytrus wrote:
> >>
> >> John Krasnay wrote:
> >> >
> >> > The isEnabled method only controls form processing on the server. If you
> >> > can't even type characters in your text field you have something else
> >> > going on at the browser level.
> >> >
> >>
> >> Well usually in a disabled box you cannot type, no matter what browser you
> >> are using.
> >
> > I guess I wasn't clear enough. Returning false from the form's isEnabled
> > method should *not* disable the text field in the browser. It simply
> > disables the default processing for the form. You should still be able
> > to enter a value in the text field, but it won't be validated and the
> > backing model will not be updated.
> >
> > Perhaps you are mistakenly overriding the text field's isEnabled method
> > instead. Note that the text field's isEnabled is queried at render time,
> > well before you know which button was pressed.
> >
> >> Anyway I think we can let the fields enabled but override the isRequired():
> >> if the submitting is the rootform just return false. In this way component
> >> is correctly displayed but validated when submitting the inner form (the 
> >> one
> >> to which it belongs).
> >
> > This might work for you, but be aware it can trip you up too, e.g. other
> > validators on the components will still be invoked and the models for
> > components in the nested form will still be updated.
> >
> > jk
> >
> > -
> > 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: Nested forms : don't process inner form when outer form is submitted

2009-08-06 Thread John Krasnay
On Thu, Aug 06, 2009 at 07:09:20AM -0700, nytrus wrote:
> 
> John Krasnay wrote:
> > 
> > The isEnabled method only controls form processing on the server. If you
> > can't even type characters in your text field you have something else
> > going on at the browser level.
> > 
> 
> Well usually in a disabled box you cannot type, no matter what browser you
> are using.

I guess I wasn't clear enough. Returning false from the form's isEnabled
method should *not* disable the text field in the browser. It simply
disables the default processing for the form. You should still be able
to enter a value in the text field, but it won't be validated and the
backing model will not be updated.

Perhaps you are mistakenly overriding the text field's isEnabled method
instead. Note that the text field's isEnabled is queried at render time,
well before you know which button was pressed.

> Anyway I think we can let the fields enabled but override the isRequired():
> if the submitting is the rootform just return false. In this way component
> is correctly displayed but validated when submitting the inner form (the one
> to which it belongs).

This might work for you, but be aware it can trip you up too, e.g. other
validators on the components will still be invoked and the models for
components in the nested form will still be updated.

jk

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



Re: Nested forms : don't process inner form when outer form is submitted

2009-08-06 Thread John Krasnay
On Thu, Aug 06, 2009 at 02:40:13AM -0700, nytrus wrote:
> 
> In the example, the inner form is enabled only when the submitter button is
> that of itself (i.e. I'm submitting the inner form). In all other cases the
> form is always disabled:

Yes, that is the point.

> I've tried the example and in factthe form is
> totally disabled, I can't fill my textfield and I can't even submit the
> form. Something is wrong with the example?

The isEnabled method only controls form processing on the server. If you
can't even type characters in your text field you have something else
going on at the browser level.

jk

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



Re: Issue with AjaxLinks in ListView

2009-08-02 Thread John Krasnay
On Sat, Aug 01, 2009 at 09:19:05AM -0700, Kuga wrote:
>
> I have not tried replacing to RepeatingView. Will it make a difference?
> 

I have no idea. Why don't you try it?

jk

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



Re: Issue with AjaxLinks in ListView

2009-08-01 Thread John Krasnay
Hi Kuga,

ListView re-creates all its child items on each render, which might be
causing your problems. Try calling setReuseItems(true), or better still,
consider using RepeatingView instead.

jk

On Fri, Jul 31, 2009 at 11:30:57PM -0700, Kuga wrote:
> 
> Hi,
> Thank you for your response,
> here is the ListView code:
> private final class SubMenuListView extends ListView {
> private static final long serialVersionUID = 0L;
> 
> private int selectedIndex = 0;
> 
> private SubMenuListView(final String id, final IModel model) {
> super(id, model);
> }
> 
> private SubMenuListView(final String id, final List list)
> {
> super(id, list);
> }
> 
> /* (non-Javadoc)
>* @see org.apache.wicket.markup.html.list.ListView#newItem(int)
>*/
>   @Override
>   protected ListItem newItem(int index) {
>   // TODO Auto-generated method stub
>   return new ListItem(index, getListItemModel(getModel(), 
> index)){
> 
>   /* (non-Javadoc)
>* @see
> org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
>*/
>   @Override
>   protected void onComponentTag(ComponentTag tag) 
> {   
>   String cssClass = 
> (String)tag.getString("class"); //$NON-NLS-1$
>   if (cssClass == null)
>   {
>   cssClass = " "; //$NON-NLS-1$
>   }   
>   if 
> (((MenuItem)getModelObject()).isSelected())
>   {
>   cssClass = 
> "menu2-selected-long"; //$NON-NLS-1$
>   } else{
>   cssClass = " "; //$NON-NLS-1$
>   }
>   tag.put("class", cssClass.trim()); 
> //$NON-NLS-1$
>   super.onComponentTag(tag);
>   }
>   
>   };
>   }
> 
>   @Override
> protected void populateItem(final ListItem item) {
> final MenuItem menuItem = (MenuItem) item.getModelObject();
> if (menuItem.isSelected()) {
> if(menuLevel.equals(MenuLevel.TOP)) {
> item.add(menuIsSelected); //set CSS class if the
> top-level menu item is selected
> }
> else if(menuLevel.equals(MenuLevel.SECOND)) {
> item.add(menuIsSelectedLong); //set CSS class if the
> second-level menu item is selected
> }
> }
> item.add(new MenuItemFragment(menuItem));
> }
> 
>   /**
>* @param selectedIndex the selectedIndex to set
>*/
>   public void setSelectedIndex(int selectedIndex) {
>   this.selectedIndex = selectedIndex;
>   }
> 
>   /**
>* @return the selectedIndex
>*/
>   public int getSelectedIndex() {
>   return selectedIndex;
>   }
> }
> -- 
> View this message in context: 
> http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24766483.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: DropDownChoice with ID and Value

2009-07-28 Thread John Krasnay
The thing that makes your example awkward (IMHO, of course) is that it
leaves out how the value that the user selects makes its way back into
the app's domain object. The OP said he wants "my model updates with 1,
2, and 3." From that I understand he has some object with an int
property...

class Widget {
private int type;
//...
}

Widget myWidget;

To complete your example, you would have to do the following when the
component was initialized:

- create a variable of type Choice to hold the selection
- loop through the list of choices, finding the one that matches
  myWidget.type and storing it in the variable
- pass a PropertyModel to the DDC pointing to the choice variable

Then, when the form is submitted, the Choice variable would contain a
(possibly different) Choice object, corresponding to the one the user
selected. You would then have to set myWidget.type from the id property
of your choice variable.

In my example, this is all done automatically, since the PropertyModel
points directly to the property to be updated. But this is only possible
if you give DDC a list of objects of the same type as the property.

jk


On Mon, Jul 27, 2009 at 05:13:05PM -0700, Mathias Nilsson wrote:
> 
> Wasn't this more awkward?
> 
> -- 
> View this message in context: 
> http://www.nabble.com/DropDownChoice-with-ID-and-Value-tp24686742p24690478.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: DropDownChoice with ID and Value

2009-07-27 Thread John Krasnay
This is an awkward way to do it, and still doesn't set the selected
value back into his model.

The golden rule of DropDownChoice is: objects in the list must be of the
same type as the model object. If you want your model to be updated with
an int, you have to give DDC a list of Integer. The second rule is that
you use a ChoiceRenderer to convert this value (the int) to a display
value:

class MyDomainClass {
  private int selection;
}

MyDomainClass myobj;

add(new DropDownChoice("ddc", 
new PropertyModel(myobj, "selection"),
Arrays.asList(1, 2, 3),
new ChoiceRenderer() {
public Object getDisplayValue(Object value) {

// value is one of the objects from the list,
// the one that the user selected
Integer i = (Integer) value;

// This function maps 1 to "abc" and so on...
return getName(i);
})
);

jk


On Mon, Jul 27, 2009 at 12:36:39PM -0700, Mathias Nilsson wrote:
> 
> class Choice{
>   private int id; 
>   private Stringvalue;
> 
>   // getters and setters
> }
> 
> List choices = new LinkedList();
> Choice c = new Choice();
> c.setId( 1 );
> c.setValue( "abc" );
> 
> choices.add( c );
> 
> // add the other values
> 
> 
> // The choice with id 1 will be selected.
> DropDownChoice drop = new DropDownChoice( "drop" , new Model( c ) , choices,
> new ChoiceRenderer( "value" , "id" ) );
> 
> -- 
> View this message in context: 
> http://www.nabble.com/DropDownChoice-with-ID-and-Value-tp24686742p24686931.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: Spring and Wicket - is it worth it?

2009-07-23 Thread John Krasnay
Wow, this post generated a short burst of heat but not much light!

I think the problem is your question conflates dependency injection,
XML-based configuration, and the Spring framework. IMHO you have to
consider these separately to understand their relative merits.

Dependency injection is simply that if object A requires object B, it
can assume that it will be given an instance of object B rather than
having to "look up" an instance of object B. This has some very important
advantages:

- it makes for cleaner code, since you don't have to code the lookup.

- it makes your code independent of any particular lookup approach. You
  can change how your business layer is wired together without changing
  all of your code. This is particularly important when trying to create
  libraries to be re-used in different applications.

- it makes your code easier to test, since your test code can manually
  inject stub objects and mocks.

So for me, DI is a big win, regardless of how you do it (Spring, Guice,
or even code in your app startup that instantiates the objects and wires
them together).

I don't find the Spring XML configuration to be that much of a problem,
since most of the apps I work on have no more than a few dozen object
configured there. One thing I like about it, as opposed to some
annotation-based approaches, is that it's external to the objects
themselves, making the objects more flexible. For example, suppose you
had a WidgetDAO that worked with a DataSource. With the Spring XML you
could easily create two different WidgetDAO instances each pointing to a
different datasource. This would not be so easy with an annotation-based
approach.

As for the Spring framework itself, I find it contains a whole bunch of
functionality that I normally need in a business app, such as
declarative transaction management, AOP (e.g. for logging), and sane
wrappers around JDBC, JavaMail, and other difficult APIs. If you're not
using Spring, you usually have to figure out other ways to do these
things.

Hope this helps.

jk

On Wed, Jul 22, 2009 at 06:40:19PM -0700, Dane Laverty wrote:
> Due to the fact that nearly every substantial sample Wicket app is
> Spring-based, I imagine that there's something awesome about using Spring.
> In fact, Wicket is what has finally gotten me to start learning Spring.
> 
> I think I understand the basics of dependency injection -- configure your
> objects in xml files and then inject them into your classes -- but I'm still
> not clear on the advantage of it. I've read quite a ways into "Spring in
> Action", and the author seems to assume that the reader will automatically
> see why xml-based dependency injection is great thing. I must just be
> missing something here. What I love about Wicket is being free from xml
> files. Can anyone give me a concise explanation of how the advantages of
> Spring are worth introducing a new layer into my applications?
> 
> Dane

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



Re: DateField and enabling some days

2009-07-09 Thread John Krasnay
Sorry, I don't know much about Date[Time]Field. Just trying to save you
a few LoC.

jk

On Wed, Jul 08, 2009 at 01:35:13PM -0700, Fernando Wermus wrote:
> thanks for the tip. Is there some way to solve what I commented?
> 
> On Wed, Jul 8, 2009 at 1:25 PM, John Krasnay  wrote:
> 
> > On Wed, Jul 08, 2009 at 01:16:19PM -0700, Fernando Wermus wrote:
> > > Date minDate = new DateTime().plusDays(1).toDate();
> > > SimpleDateFormat format = new SimpleDateFormat("MM/dd/");
> > > widgetProperties.put("mindate", format.format(minDate));
> >
> > FYI with Joda Time this can be reduced to this...
> >
> >  widgetProperties.put("mindate",
> >new DateTime().plusDays(1).toString("MM/dd/"));
> >
> > jk
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> 
> -- 
> Fernando Wermus.
> 
> www.linkedin.com/in/fernandowermus

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



Re: DateField and enabling some days

2009-07-08 Thread John Krasnay
On Wed, Jul 08, 2009 at 01:16:19PM -0700, Fernando Wermus wrote:
> Date minDate = new DateTime().plusDays(1).toDate();
> SimpleDateFormat format = new SimpleDateFormat("MM/dd/");
> widgetProperties.put("mindate", format.format(minDate));

FYI with Joda Time this can be reduced to this...

  widgetProperties.put("mindate", 
new DateTime().plusDays(1).toString("MM/dd/"));

jk


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



Re: Creating a form dynamically

2009-06-19 Thread John Krasnay
I've had good results creating my child components as panels and adding
them to a RepeatingView (instead of ListView). The child panels should
get their IDs from RepeatingView.newChildId().

jk

On Fri, Jun 19, 2009 at 10:14:12AM -0400, James Carman wrote:
> You could use Velocity to dynamically build your markup.
> 
> On Fri, Jun 19, 2009 at 10:10 AM, Ryan LaHue wrote:
> > I'm trying to build a form dynamically and am having a little problem.
> > Basically I have a class that takes a List and then passes
> > them into a ListView for display on screen.  The problem is that they were
> > created elsewhere and I have no control over two things:
> > 1) The order/type of each FormComponent
> > 2) The wicket:id that was chosen for them when the FormComponents were
> > created
> >
> > I think I've solved 1) by creating wrapper classes for each supported
> > FormComponent type... for example, I have a DropDownChoicePanel which simply
> > adds the DropDownChoice it is passed to its html, which is simply a  > wicket:id="component">.  This way I can simply wrap each
> > FormComponent in the list with a panel and add all the panels to my listview
> > rather than the components themselves -- this solves the problem of
> > homogenizing the listview's HTML.
> >
> > But 2) is causing me problems, because unless I require all FormComponents
> > to be given a wicket:id which is prespecified and is the same as that in the
> > DropDownChoicePanel (wicket:id="component") then it will not work.
> >
> > Am I going about this all wrong?  Is there any way I can receive a
> > FormComponent and then change its wicket:id so that it will always be
> > "component" in my ListView?  Or is there a solution for this problem
> > already?
> >
> > Much thanks for any advice.
> >
> 
> -
> 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: Reverse geocoding with wicket contrib gmap2

2009-06-18 Thread John Krasnay
Hehe, when I first saw "reverse geocoding" I read "reverse geolocation",
as in you point to a spot on a Google map and you get teleported there.

Now *there's* a browser feature I'd pay for!

jk

On Thu, Jun 18, 2009 at 06:46:59PM +0300, Jesse Kivialho wrote:
> Well I don't need that much events. The dragging doesn't have to emit an 
> event, just the final dragend (which already exists in the gmap2 project). 
> So the runtime would be more like:
> 
> The end of dragging a marker should emit events (which it does)
> The GCG should pick these up and reverse geocode the lat-long. (which I'm 
> atm doing with the server-side-geocoder)
> The result should be shown in the browser (which I can do with the 
> server-side-geocoder, and I guess with the client-side-geocoder the 
> showing in the browser could be an update of a label in the method which 
> is fired when the dragging is ended).
> 
> So the problem is how the GCG should notice the end of dragging and do the 
> reverse geocoding.

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



Re: JPA EntityManager storage

2009-06-05 Thread John Krasnay
On Fri, Jun 05, 2009 at 04:28:07PM +0200, Frank Tegtmeyer wrote:
> 
> > Don't fall into the trap of premature optimization!
> 
> Hm. Maybe I'm in this trap already.
> But what is wrong with binding a resource directly to the request when 
> it is used exactly for the lifetime of the request? For me this only 
> sounds logical compared to the pragmatic approach using a ThreadLocal 
> object.
> Are there any technical reasons against storing in the request?
> 

I try to keep my UI logic, my business logic, and my persistence
strategy separate. Putting the EntityManager in the Request means you
have to pass the Request around into your business logic layer. By
putting it in a ThreadLocal, the UI and business layers can be
blissfully unaware of its existance.

BTW I use Spring's OpenEntityManagerInViewFilter for this. Works very
well.

jk

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



Re: Apache Tomcat & CSS

2009-05-12 Thread John Krasnay
The problem is likely that you've specified a relative URL to the CSS
file like this...

  

You need to get wicket to rewrite that href so it knows how to serve up
the CSS file. The easiest way to do this is to wrap your link in
wicket:link tags:


  

  

The reference from your stylesheet to n1.gif should work as long as it's
in the same package as your CSS file.

jk

On Tue, May 12, 2009 at 04:01:35PM +0200, Tomáš Mihok wrote:
> Hi there,
> 
> has anyone ever encountered problem with these two? I have a simple 
> application and I wanted to add a css file with  but after 
> deploying nothing happens.
> 
> So I copied the CSS in index.html between 

Re: 60% waste

2009-05-11 Thread John Krasnay
I just use names for form components and css or xpath for non-form
components instead of IDs. Sometimes requires rework if the page
structure changes but otherwise works OK.

jk

On Mon, May 11, 2009 at 08:22:40AM -0700, Douglas Ferguson wrote:
> I should be more clear. Has anybody had problems with wicket ids and using 
> Selenium?
> Was this fixed in v2 (WebDriver)?
> 
> D/
> 
> -Original Message-
> From: Douglas Ferguson [mailto:doug...@douglasferguson.us]
> Sent: Monday, May 11, 2009 9:38 AM
> To: users@wicket.apache.org; mcgreg...@e-card.bg
> Subject: RE: 60% waste
> 
> I thought there was a problem with wicket's random generation of ids.
> 
> D./
> 
> -Original Message-
> From: Martin Grigorov [mailto:mcgreg...@e-card.bg]
> Sent: Monday, May 11, 2009 7:15 AM
> To: users@wicket.apache.org
> Subject: RE: 60% waste
> 
> I'm using quite successfully WebDriver (a.k.a. Selenium 2).
> 
> El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
> > On a side note, does Selenium even work with wicket?
> >
> > Douglas
> >
> > -Original Message-
> > From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> > Sent: Monday, May 11, 2009 12:13 AM
> > To: users@wicket.apache.org
> > Subject: Re: 60% waste
> >
> > unit testing is about testing small isolated bits of functionality in 
> > isolation
> >
> > lets say that you want to test foo(p) { return a(b(c(p))); }
> >
> > what martin is trying to do is to test that foo(q) yields the desired
> > value w, what he should do instead is
> >
> > test a() in isolation to make sure it works
> > test b() in isolation to make sure it works
> > test c() in isolation to make sure it works
> > test that foo() calls a,b,c.
> >
> > if all small tests above pass you are guaranteed that foo() works.
> >
> > -igor
> >
> > On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov  wrote:
> > > Ben Tilford wrote:
> > >>
> > >> Have you looked at selenium? Your not really "unit" testing here.
> > >>
> > >
> > > Hi Ben,
> > >
> > > What do you mean "Your not really "unit" testing here." ?
> > >
> > > MSi
> > >>
> > >> On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov  
> > >> wrote:
> > >>
> > >>
> > >>>
> > >>> Like Martijn said i also strongly recommend to take a look at the
> > >>> jdave-wicket's selectors (http://www.jdave.org/).
> > >>>
> > >>> examples =>
> > >>>
> > >>> http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java
> > >>>
> > >>>
> > >>> with form tester it goes like this =>
> > >>>
> > >>>  form = wicket.newFormTester(selectFirst(Form.class,
> > >>> "form").from(panel).getPageRelativePath());
> > >>>  form.setValue("name", "wicket");
> > >>>  form.setValue("address", "jdave");
> > >>>  form.submit();
> > >>>
> > >>> MSi
> > >>>
> > >>> Martijn Dashorst wrote:
> > >>>
> > >>>
> > 
> >  See jdave-wicket for better test support. Slated to come to you in
> >  Wicket
> >  1.5
> > 
> >  Martijn
> > 
> >  On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
> >   wrote:
> > 
> > 
> > 
> > >
> > > Hi!
> > >
> > > I use TDD: I spend 60% of my time type-checking and path-checking my
> > > wicketTests and components.
> > >
> > > I always have the wrong path and I must prinDocument and iterate to
> > > get it right
> > >
> > > Anybody have the same experience?
> > >
> > > How about introducing type-safety and path-safety/identity into
> > > component hierarchies?
> > >
> > > Can this be done?
> > >
> > > **
> > > Martin
> > >
> > > -
> > > 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
> >
> >
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.ap

Re: DropDownChoice ID's

2009-05-10 Thread John Krasnay
Why do you care what the id's are? Wicket doesn't store the ID anywhere,
it just uses the ID to look up the list element to put into the model.

jk

On Sun, May 10, 2009 at 08:08:30AM -0700, Oblivian wrote:
> 
> After changing genders from List to List, I'm seeing the
> opposite behaviour.  The values are coming across as ['m','f'] but the id's
> are ['0','1']
> 
> Overriding getIdValues() instead of getDisplayValues() seems to work.
> 
> 
> John Krasnay wrote:
> > 
> > The golden rule of DropDownChoice is that the values in the list must be
> > the same as the property you are trying to set. In your case, if you
> > want basicDemographicInfo.gender to be set to "m" or "f", you must pass
> > the DropDownChoice the list [ "m", "f" ]. You'll then need a renderer
> > that produces the appropriate display value:
> > 
> > new ChoiceRender() {
> > public Object getDisplayValue(Object value) {
> > // here, value will be "m" or "f"
> > // look up and return "Male" or "Female" accordingly
> > }
> > }
> > 
> > You shouldn't care about the ID value. The default provided by
> > ChoiceRenderer should be fine.
> > 
> > jk
> > 
> > On Sat, May 09, 2009 at 05:52:29PM -0700, Oblivian wrote:
> >> 
> >> basicDemographicInfo.gender is a String 
> >> and 
> >> genders is List
> >> 
> >> 
> >> 
> >> John Krasnay wrote:
> >> > 
> >> > What is the type of the "gender" property of BasicDemographicInfo?
> >> > 
> >> > jk
> >> > 
> >> > On Sat, May 09, 2009 at 12:39:58PM -0700, Oblivian wrote:
> >> >> 
> >> >> Not sure what I'm doing wrong.  I need a DropDownChoice with ...
> >> >> 
> >> >> Female
> >> >> Male
> >> >> 
> >> >> have a basic class like this ...
> >> >> 
> >> >> public class Gender  implements Serializable {
> >> >> String id;
> >> >> String name;
> >> >> public Gender();
> >> >> public Gender(String id, String name);
> >> >> public String getId();
> >> >> public void setId(String id);
> >> >> public void setName(String name);
> >> >> }
> >> >> 
> >> >> A custom ChoiceRenderer ...
> >> >> 
> >> >> public class GenderChoiceRenderer implements IChoiceRenderer {
> >> >> public Object getDisplayValue(Object arg0) {
> >> >> return  ((Gender) arg0).getName();
> >> >> }
> >> >> 
> >> >> public String getIdValue(Object arg0, int arg1) {
> >> >> // Sometimes this is a String
> >> >> if(arg0 instanceof String){
> >> >> return (String)arg0;
> >> >> }
> >> >> if (Utility.isNull(arg0)){
> >> >> return null;
> >> >> 
> >> >> }
> >> >> // Other times it is not.
> >> >> return ((Gender) arg0).getId();
> >> >> }
> >> >> 
> >> >> }
> >> >> 
> >> >> --
> >> >> Finally in my Form...
> >> >> 
> >> >> add(new DropDownChoice("gender", new PropertyModel(model,
> >> >> "basicDemographicInfo.gender"), genders, new GenderChoiceRender()));
> >> >> 
> >> >> 
> >> >> Viewing the HTML, the id's are correct "m" and "f", however in
> >> onSubmit,
> >> >> I
> >> >> get this.
> >> >> 
> >> >> model.getBasicDemographicInfo().getGender() =
> >> >> com.spinn.sdk.db.model.gen...@30ea3e3c
> >> >> 
> >> >> 
> >> >> 
> >> >> 
> >> >> 
> >> >> Oblivian wrote:
> >> >> > 
> >> >> >  List test = Arrays.asList(new String[] { "A", "B", "C" });
> >> >> >  add(new DropDownChoice("test", test));
> >> &g

Re: DropDownChoice ID's

2009-05-10 Thread John Krasnay
The golden rule of DropDownChoice is that the values in the list must be
the same as the property you are trying to set. In your case, if you
want basicDemographicInfo.gender to be set to "m" or "f", you must pass
the DropDownChoice the list [ "m", "f" ]. You'll then need a renderer
that produces the appropriate display value:

new ChoiceRender() {
public Object getDisplayValue(Object value) {
// here, value will be "m" or "f"
// look up and return "Male" or "Female" accordingly
}
}

You shouldn't care about the ID value. The default provided by
ChoiceRenderer should be fine.

jk

On Sat, May 09, 2009 at 05:52:29PM -0700, Oblivian wrote:
> 
> basicDemographicInfo.gender is a String 
> and 
> genders is List
> 
> 
> 
> John Krasnay wrote:
> > 
> > What is the type of the "gender" property of BasicDemographicInfo?
> > 
> > jk
> > 
> > On Sat, May 09, 2009 at 12:39:58PM -0700, Oblivian wrote:
> >> 
> >> Not sure what I'm doing wrong.  I need a DropDownChoice with ...
> >> 
> >> Female
> >> Male
> >> 
> >> have a basic class like this ...
> >> 
> >> public class Gender  implements Serializable {
> >>String id;
> >>String name;
> >>public Gender();
> >>public Gender(String id, String name);
> >>public String getId();
> >>public void setId(String id);
> >>public void setName(String name);
> >> }
> >> 
> >> A custom ChoiceRenderer ...
> >> 
> >> public class GenderChoiceRenderer implements IChoiceRenderer {
> >>public Object getDisplayValue(Object arg0) {
> >>return  ((Gender) arg0).getName();
> >>}
> >> 
> >>public String getIdValue(Object arg0, int arg1) {
> >>// Sometimes this is a String
> >>if(arg0 instanceof String){
> >>return (String)arg0;
> >>}
> >>if (Utility.isNull(arg0)){
> >>return null;
> >> 
> >>}
> >>// Other times it is not.
> >>return ((Gender) arg0).getId();
> >>}
> >> 
> >> }
> >> 
> >> --
> >> Finally in my Form...
> >> 
> >> add(new DropDownChoice("gender", new PropertyModel(model,
> >> "basicDemographicInfo.gender"), genders, new GenderChoiceRender()));
> >> 
> >> 
> >> Viewing the HTML, the id's are correct "m" and "f", however in onSubmit,
> >> I
> >> get this.
> >> 
> >> model.getBasicDemographicInfo().getGender() =
> >> com.spinn.sdk.db.model.gen...@30ea3e3c
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Oblivian wrote:
> >> > 
> >> >  List test = Arrays.asList(new String[] { "A", "B", "C" });
> >> >  add(new DropDownChoice("test", test));
> >> > 
> >> > How can I make the Id's match the Values?  There coming through as 
> >> > 1,2,3.  I've tried custom ChoiceRenderer, but seem to be missing
> >> > something.
> >> > 
> >> > Any help is appreciated.
> >> > 
> >> > -
> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > For additional commands, e-mail: users-h...@wicket.apache.org
> >> > 
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/DropDownChoice-ID%27s-tp23453868p23463880.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> 
> >> 
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> 
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/DropDownChoice-ID%27s-tp23453868p23466101.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: DropDownChoice ID's

2009-05-09 Thread John Krasnay
What is the type of the "gender" property of BasicDemographicInfo?

jk

On Sat, May 09, 2009 at 12:39:58PM -0700, Oblivian wrote:
> 
> Not sure what I'm doing wrong.  I need a DropDownChoice with ...
> 
> Female
> Male
> 
> have a basic class like this ...
> 
> public class Gender  implements Serializable {
>   String id;
>   String name;
>   public Gender();
>   public Gender(String id, String name);
>   public String getId();
>   public void setId(String id);
>   public void setName(String name);
> }
> 
> A custom ChoiceRenderer ...
> 
> public class GenderChoiceRenderer implements IChoiceRenderer {
>   public Object getDisplayValue(Object arg0) {
>   return  ((Gender) arg0).getName();
>   }
> 
>   public String getIdValue(Object arg0, int arg1) {
>   // Sometimes this is a String
>   if(arg0 instanceof String){
>   return (String)arg0;
>   }
>   if (Utility.isNull(arg0)){
>   return null;
> 
>   }
>   // Other times it is not.
>   return ((Gender) arg0).getId();
>   }
> 
> }
> 
> --
> Finally in my Form...
> 
> add(new DropDownChoice("gender", new PropertyModel(model,
> "basicDemographicInfo.gender"), genders, new GenderChoiceRender()));
> 
> 
> Viewing the HTML, the id's are correct "m" and "f", however in onSubmit, I
> get this.
> 
> model.getBasicDemographicInfo().getGender() =
> com.spinn.sdk.db.model.gen...@30ea3e3c
> 
> 
> 
> 
> 
> Oblivian wrote:
> > 
> >  List test = Arrays.asList(new String[] { "A", "B", "C" });
> >  add(new DropDownChoice("test", test));
> > 
> > How can I make the Id's match the Values?  There coming through as 
> > 1,2,3.  I've tried custom ChoiceRenderer, but seem to be missing
> > something.
> > 
> > Any help is appreciated.
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/DropDownChoice-ID%27s-tp23453868p23463880.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: Example for FormComponentPanel/best-practice for reusable form-components

2009-05-05 Thread John Krasnay
AddressFormComponent should extend Panel, not FormComponentPanel.
FormComponentPanel is used for special cases where you have several
FormComponents that work together to edit a model value, such as a date
editor that has dropdowns for month and day.

On a FormComponentPanel, you have to implement convertValue() to gather
the input from your subcomponents, synthesize them into a single value,
and call setConvertedValue(). Since you never call setConvertedValue(),
your panel pushes null back into your address model.

jk

On Tue, May 05, 2009 at 11:22:44AM -0700, FlyingMustang wrote:
> 
> 
> igor.vaynberg wrote:
> > 
> > show us your code.
> > 
> 
> Ok, I have a class 'Person' with an'Address-Property. My Form-object has a
> simple Model wrapping a Person-object. The constructor creating the Panel
> with the form contains these lines:
> 
> form = new Form("form", new Model());
> personFormComponent = new
> PersonFormComponent("personFormComponent", form.getModel());
> addressFormComponent = new
> AddressFormComponent("addressFormComponent", new
> PropertyModel(this.form.getModel(), "address"));
> 
> form.add(personFormComponent);
> form.add(addressFormComponent);
> 
> After creation of this Panel I call form.setModelObject(...). So the model
> ist not empty. The PersonFormComponent works well as it only sets some
> String-Properties of the Person-Object. But I have trouble with the
> AddressFormComponent which looks like this:
> 
> public class AddressFormComponent extends
> FormComponentPanel {
>   protected TextField cityField, postcodeField, streetField;
>   protected IModel model;
> 
>   public AddressFormComponent(String id, IModel model) {
>   super(id, model);
> 
>   // Model
>   this.model = model;
> 
>   // Straße
>   streetField = new TextField("streetField", new
> PropertyModel(model, "street"));
>   streetField.setRequired(true);
>   streetField.add(StringValidator.lengthBetween(0, 100));
> 
>   // PLZ
>   postcodeField = new TextField("postcodeField", new
> Model(""));
>   postcodeField.setRequired(true);
> 
>   // Stadt
>   cityField = new TextField("cityField", new 
> Model(""));
>   cityField.setRequired(true);
>   cityField.add(StringValidator.lengthBetween(0, 50));
> 
>   this.add(streetField);
>   this.add(postcodeField);
>   this.add(cityField);
>   }
> }
> 
> After submitting the whole form (with an AjaxButton) the Address-Property of
> my Person-Object ist null. Perhaps I did not use the Models correctly ...?
> -- 
> View this message in context: 
> http://www.nabble.com/Example-for-FormComponentPanel-best-practice-for-reusable-form-components-tp23391811p23393211.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: Mutually dependent component and how to update a textfield when a link is clicked

2009-04-21 Thread John Krasnay
Hi Liam,

Check out this page:

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

It has a bunch of recipes for interactions between components, e.g.
requiring a text field only if a checkbox is checked or a certain submit
button was used. Sounds similar to what you need to do.

jk

On Tue, Apr 21, 2009 at 09:40:09AM -0500, Jeremy Thomerson wrote:
> As far as sharing models - just make sure both components' model reads from
> the same backing object - be it the component itself or a domain object.
> 
> As far as submitting the value - basically there are two ways - just like if
> you had a plain HTML page - form submission or javascript that appends the
> value to the end of a GET url.
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Tue, Apr 21, 2009 at 5:21 AM, Liam Clarke-Hutchinson  > wrote:
> 
> > Hi,
> >
> > Come across a few situations where there are two components are
> > reliant on each other, say a checkbox's model value that a textfield
> > uses in its isDisabled method, and the textfield needs the
> > abstractCheckboxModel to re-evaluate a particular value on a given
> > response.
> >
> > For the first bit, we tend to just move the dependency onto a local
> > variable or field, and for the second, we've decided to make the
> > changes on the underlying entity model that they were all holding
> > models on instead, as a workaround, but it's getting a bit dicey - I
> > get the feeling this is the sort of thing that CPMs can help well with
> > - where you've got multiple components needing to share state between
> > them?
> >
> > One last thing, if I have a textfield that I want to post the value to
> > the server of when a link is clicked, and only that textfield for only
> > that link, how do I model this? So far using a small form for each
> > pair and then calling submit only on that form seems to be the way to
> > do it?
> >
> > Regards,
> >
> > Liam Clarke
> >
> > -
> > 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: setConvertedInput - one form component, two fields in the model?

2009-04-21 Thread John Krasnay
Since you're dealing with setConvertedInput I presume you're
implementing FormComponentPanel. In that case, you need a single model
object to encapsulate the idea of a date range. For example, you could
implement your own DateRange class. Pass your panel a model that returns
and accepts instances of DateRange, and set your converted input to an
instance of DateRange.

An alternate way is to use a regular Panel instead of a
FormComponentPanel and pass it two models, one for the start date and
one for the end date. You'll probably want to pass in the encapsulating
Form object too, so you can add a FormValidator to ensure end > start.

jk

On Mon, Apr 20, 2009 at 09:38:46PM -0700, Kurt Heston wrote:
> I guess I also need to ask an even simpler question: can I manage two 
> fields in the same IModel within a single form component?
> 
> Kurt Heston wrote:
> >I'm building a StartAndEndDateTime form component based on Eelco's 
> >DateTimeField.  It is essentially the same as his with the time fields 
> >repeated.
> >
> >The goal is to get my new custom component to update two date fields 
> >in the parent form's model.  Here is what the end of my convertInput() 
> >method look like:
> >
> >   Object mdlObj = getForm().getModelObject();
> >   new PropertyModel(mdlObj, "svcDate").setObject(new Date(date
> >   .getMillis()));
> >   new PropertyModel(mdlObj, "endSvcDate").setObject(new Date(endDate
> >   .getMillis()));
> >
> >   setConvertedInput();
> >
> >
> >I'm doing something wrong with setConvertedInput:
> >
> >
> >ERROR org.apache.wicket.RequestCycle  - Error calling method: public 
> >void MyClass.setSvcDate(java.util.Date) on object: mycl...@e56328
> >
> >
> >If I'm setting two fields in the Model, what should I pass to 
> >setConvertedInput?
> >
> 
> 
> -
> 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: WebApp Freezes

2009-04-15 Thread John Krasnay
Heh, I haven't had to worry about connection leaks since I discovered
Spring's JdbcTemplate and Hibernate, so it didn't even cross my mind. But
yeah, if the app is doing it's own JDBC connection management then that
is very much something J should look at.

jk

On Wed, Apr 15, 2009 at 05:58:11PM +0300, Serkan Camurcuoglu wrote:
> if all your threads are waiting for connections with no thread using a 
> db connection, I suspect that you either leak connections (i.e. forget 
> to free some connections) or each thread uses (requires) multiple 
> connections during a transaction and at some point all threads need at 
> least one more db connection to continue..
> 

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



Re: WebApp Freezes

2009-04-15 Thread John Krasnay
Sounds like you have a thread holding a lock on a critical table and
subsequent threads are lining up behind it waiting for it to finish. You
should check your MySQL to try and figure out who's holding the lock and
why.

Note that the culprit thread need not be hung up in the database. Locks
are held until the transaction commits, so your thread could be hung up
in app code after making a database update but before the transaction is
committed.

jk

On Wed, Apr 15, 2009 at 03:41:07PM +0200, J wrote:
> (Sorry for the empty message. First I tried Gmail, but that doesn't work
> with this mailing list. Then I tried GMX webclient, but that client always
> sends as HTML, which probably caused the message to be stripped to empty.)
> 
> 
> I'm experiencing freezes on a production website.
> 
> Server specs:
> -OS: Linux CentOS
> -Webserver: Tomcat 6
> -MySQL 5 with default settings
> -Frameworks: Wicket 1.4-rc2 (webframework), Spring 2.5.6, Hibernate
> 3.3.1.GA, C3P0 db pooling 0.9.1.2, URLRewriteFilter 3.1.0, Spring
> OpenSessionInViewFilter 
> 
> Problem:
> At some point (about 5 to 24 hours) after a boot, Tomcat seems to stop
> serving requests, although it does create new threads for new incoming
> connections. But since it does not serve those connections, the new
> connections will show and keep showing 0kb transfer. Shortly after that,
> max-thread is reached, so then I'm unable to access any webapp (the main
> website + tomcat manager) running on that Tomcat server. I'm not sure if it
> is able to serve static resources in the short time window where it still
> has some threads free, because the time window is too short to notice when
> it happens.
> 
> Observations:
> -No exceptions or errors in the catalina logs. So no memory problems, since
> no error occurs in the logs
> -Java Thread dump using command: kill -QUIT (see output below), shows the
> text "locked" and "WAITING".
> -Adding c3p0 db pooling idle checks, tests and timeout settings (see below)
> did not help.
> -Using Mysql Administrator GUI shows that after a freeze, there will be 15
> threads, all sleeping. Normally this would return to a minPoolSize of 5, if
> I'm correct, but thats not the case.
> -The freeze continues for hours, and does not recover. I have to restart
> Tomcat.
> 
> 
> I'm suspecting that it has something to do with DB pooling. I'm not sure if
> "locked" and "WAITING" are normal behaviour. But if there is something
> wrong, why doesn't c3p0 recover from it?
> 
> Can somebody shed some light on this? :)
> 
> 
> 
> 
> 
> Configuration:
> 
> === DB pooling in Spring applicationContext.xml 
> 
>name="driverClass">com.mysql.jdbc.Driver
>   
>   
>   x
> 
>   600
>name="idleConnectionTestPeriod">180
>name="testConnectionOnCheckin">true
> 
>   5
>   180
>   15
>   100
>   5
> 
> ===
> 
> 
> = Thread dump part ===
> "http-8080-28" daemon prio=10 tid=0xb4fbb400 nid=0x4ae2 in Object.wait()
> [0xb4316000..0xb4318130]
>java.lang.Thread.State: WAITING (on object monitor)
>   at java.lang.Object.wait(Native Method)
>   at
> com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePo
> ol.java:1315)
>   at
> com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicRe
> sourcePool.java:557)
>   - locked <0x72c74b10> (a
> com.mchange.v2.resourcepool.BasicResourcePool)
>   at
> com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResource
> Pool.java:477)
>   at
> com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C
> 3P0PooledConnectionPool.java:525)
>   at
> com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(Abstract
> PoolBackedDataSource.java:128)
>   at
> org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConn
> ection(LocalDataSourceConnectionProvider.java:81)
>   at
> org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:4
> 23)
>   at
> org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:14
> 4)
>   at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>   at
> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
>   at
> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>   at
> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(Hiber
> nateTransactionManager.java:510)
>   at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.g
> etTransaction(AbstractPlatformTransactionManager.java:350)
>   at
> org.springframework.transaction.interceptor.TransactionAspectSupport.createT
> ransactionIfNecessary(TransactionAspectSupport.java:262)
>   at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Tr
> ansactionInterceptor.java:101)
>   at
> org.springframework.aop.framework.Reflec

Re: serialVersionUID

2009-04-12 Thread John Krasnay
On Sat, Apr 11, 2009 at 11:51:47PM -0500, Luther Baker wrote:
> 
> In fact, unless I am really abiding by serialVersionUID rules (changing it
> explicitly - every time I make a relevant, corresponding change to the
> containing class) - I'm not really gaining any functionality that the
> runtime can't already do. In fact, unless rigorously maintained, it seems I
> could likely end up with two different compiled versions with identical,
> explicit serialVersionUIDs - which surely seems worse then leaving it alone?
> 
> -Luther

Bingo!

jk

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



Re: serialVersionUID

2009-04-11 Thread John Krasnay
On Sat, Apr 11, 2009 at 05:32:51PM -0400, Ben Tilford wrote:
> The purpose of the *public* static final long serialVersionUID is for long
> term storage or situations where you may potentially have made modifications
> to the class that make it incompatible with previous versions (distributed
> apps/clustering).

It only prevents trivial changes (e.g. adding a public method) from
breaking your serialization compatibility. You can still break the
compatibility even with a serialVersionUID, e.g. by renaming a field.
Besides, Wicket page maps are neither long-term storage nor remotely
communicated, so I don't really see the point of putting in the effort.

> I'd say that its easier to just add it in case you ever
> need it, its only 1 line of code.

Given Wicket's reliance on component inheritance, adding
serialVersionUID in every place Eclipse complains about it would amount
to hundreds of lines of code on my projects. Java code has enough noise
already.

jk

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



Re: serialVersionUID

2009-04-11 Thread John Krasnay
On Sat, Apr 11, 2009 at 01:31:47PM -0500, Luther Baker wrote:
> Thanks John,
> 
> Let me take this one step farther, just to clarify.
> 
> I know that in a standard web application, the web container can Serialize
> user HttpSessions such that one can shut an application down and upon
> bringing it back up, HttpSession state is restored and, for instance, a user
> might not have to log back in.
> 

Yep. In my development environment (Tomcat) I can often restart without
losing my session.

> This functionality required us to implement Serializable for anything we
> wanted to store in a user's HttpSession. From your response, is it safe to
> say that Wicket doesn't use the HttpSession that way

No, it's not safe to say :-). Wicket does indeed serialize pages and
puts them in the session.

> - or at least, doesn't
> store all these pages and their contents out to Session such that there is
> no requirement from Wicket to use a valid, unique serial id for all these
> anonymous classes?
> 
> Including the PageStore or anything else native to Wicket internals?
> 
> Is there anything, whatsoever that Wicket or Java webapps would require
> proper serial ids for?
> 
> -Luther

You don't need a serialVersionUID for serialization to work (and
certainly not a unique one, or your plan for using 1L wouldn't very
well).

jk

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



Re: serialVersionUID

2009-04-11 Thread John Krasnay
On Sat, Apr 11, 2009 at 08:45:31AM -0500, Luther Baker wrote:
> A quick question - is it generally acceptable to use
> 
> private static final long serialVersionUID = *1L*;
> 
> for most the anonymous inner class I create using Wicket? Specifically, I'm
> asking about using the value (-1).
> 
> I've seen this idiom in the source but wasn't sure if there was some
> rational or serialization concerns I needed to be aware of before generally
> using (-1) everywhere.
> 
> -Luther

An arbitrary constant (1 or -1) works just as well as any other value.

Personally, I've disabled that warning in Eclipse and I don't add
serialVersionUID to any of my Wicket components.

jk

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



Re: Communication between applications, one using wicket

2009-04-09 Thread John Krasnay
On Thu, Apr 09, 2009 at 04:14:43PM +0300, Cristi Manole wrote:
> 
> I used Axis2 before, but at the moment i don't see how it can solve my
> problem - meaning how to update some panel *without* doing some action
> repeatedly until something worth displaying to the user happens.
> 

I don't think anyone has a problem with the polling part of your
solution. Unless your users absolutely can't wait for the polling
interval to find out when the task completes then this is by far the
simplest approach.

Otherwise, you're into some sort of comet solution, where you keep an
HTTP channel open to your server and a thread waiting at the other end
to be woken up and reply the second the task is completed.

jk

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



Re: Communication between applications, one using wicket

2009-04-09 Thread John Krasnay
On Thu, Apr 09, 2009 at 07:48:10AM -0500, David Brown wrote:
> Hello Cristi, this is typically referred to as diparate sytems
> communications issue. In the past I have had some success between such
> sytems using a WSDL and messaging. I did not have a lot of time so I
> opted for the Apache Axis2 framework (http://ws.apache.org/axis2/).
> You will have to do some work but better than developing something
> with low-level Java nuts-and-bolts.

Ugh! I think Cristi's approach of a bookmarkable page is far simpler
than messing with SOAP stacks.

jk

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



Re: Communication between applications, one using wicket

2009-04-09 Thread John Krasnay
Your approach sounds perfectly reasonable to me. What don't you like
about it?

jk

On Thu, Apr 09, 2009 at 10:36:39AM +0300, Cristi Manole wrote:
> Hello,
> 
> I have a wicket application where a user starts an action on another system
> (different machine, outside network). I would like for this specific user to
> receive a response from that system once the action is finished (it takes a
> fair amount of time) and the status of that action.
> 
> My idea is to have inside Wicket application an ajax self updating panel, so
> that the database of the application gets read from time to time. The other
> application would send a "message" to the Wicket application (call some page
> with some page parameters), which would update the specific database table
> with the user who started the action and the response. Once the action is
> finished, the self updating panel (aware of this by reading it in the
> database) becomes visible and it will contain that message to inform the
> user.
> 
> I think my idea is bad. If nothing else I consider it resource savvy.
> 
> How do you guys handle communication between two applications (the other
> application is not written in java) in order to provide the response to the
> user without refreshing the page?
> 
> Thank you very much in advance,
> Cristi Manole

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



Re: Changing form validation depending on submit button.

2009-04-09 Thread John Krasnay
Have a look here:

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

jk

On Thu, Apr 09, 2009 at 02:45:26PM +1000, Ian MacLarty wrote:
> Hi,
> 
> I have a form with two submit buttons.  I want the form to validate
> differently depending on what submit button is pressed (i.e. I want to
> use a different IFormValidator depending on what button is used to
> submit the form).  How would I go about doing this?
> 
> Ian.
> 
> -
> 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: maven-eclipse-plugin 2.6 will break your wicket projects

2009-04-03 Thread John Krasnay
On Fri, Apr 03, 2009 at 04:21:13PM +0100, Gwyn Evans wrote:
> On Fri, Apr 3, 2009 at 3:42 PM, John Krasnay  wrote:
> > FYI to anyone who's been bitten by this, there's a simple workaround.
> 
> Yes - use IDEA!  :-)
> 

What, haven't they "fixed" the maven-idea-plugin yet? Your time's
comin', pal! :-)

jk

-
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-03 Thread John Krasnay
FYI to anyone who's been bitten by this, there's a simple workaround.
Just add the following to your pom.xml:

  

  
maven-eclipse-plugin
2.5.1
  

  

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

jk

On Fri, Apr 03, 2009 at 09:54:36AM -0400, Brill Pappin wrote:
> I think thats a good position.
> 
> I can't image that it was purposely done in order to enforce the maven  
> way, there are just too many people who would have broken builds.
> 
> - Brill
> 
> On 2-Apr-09, at 3:53 PM, Igor Vaynberg wrote:
> 
> >i just want to say one quick thing about this.
> >
> >there are two great things about maven
> >1) it established a convention that eliminated a lot of boilerplate
> >2) it does not force the convention - everything can be overridden and
> >customized by configuring plugins
> >
> >once the authors of maven and or plugins lose sight of (2) and try to
> >force the convention i think most people will simply bail. personally,
> >if this was forced wicket or any other projects i work on would not be
> >using maven.
> >
> >-igor
> >
> >On Thu, Apr 2, 2009 at 12:43 PM, Jeremy Thomerson
> > wrote:
> >>Let's not even start this discussion again, please!
> >>
> >>--
> >>Jeremy Thomerson
> >>http://www.wickettraining.com
> >>
> >>
> >>
> >>On Thu, Apr 2, 2009 at 2:34 PM, Philippe Marschall   
> >>wrote:
> >>
> >>>You simply relied on a bug / undocumented featured. Move your  
> >>>resources
> >>>where the belong into the resources folder.
> >>>
> >>>Cheers
> >>>Philippe
> >>>
> >>
> >
> >-
> >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: eclipse and html extensions in src/main/java

2009-03-22 Thread John Krasnay
Works fine for me without any special configuration. I use the Eclipse
JEE version and HTML files come up in the HTML Editor.

Check which editor is associated with *.html files under Window >
Preferences, then under General/Editors/File Associations.

Eclipse remembers the last editor you used to open a particular file, so
you might have to right-click the file in Package Explorer and select
Open With > HTML Editor.

jk

On Sun, Mar 22, 2009 at 12:24:38PM -0400, Brill Pappin wrote:
> So eclipse is having trouble with the html extension files in the java  
> source directory.
> 
> I set up a demo for Wicket Skunkworks to demo the components we're  
> working on, and I used the "standard wicket pattern" of putting the  
> html alongside the java in order to make things clearer to how must  
> people expect to see a wicket project, however Eclipse is complaining  
> every time I open an HTML resource saying that its expecting a source  
> file:
> 
> An error has occurred. See error log for more details.
> Compilation unit name must end with .java, or one of the  
> registered Java-like extensions
> 
> Aside form registering an HTML extension as a compilation unit, does  
> anyone know how to resolve this annoying issue?
> 
> This is the first time I have run across it because up until now I  
> have kept my resources in src/main/resources.
> 
> - Brill
> 
> -
> 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: How can I share text resources with multiple web applications?

2009-03-20 Thread John Krasnay
+1. Wicket IMHO does it the right way for its particular situation.

Wicket differs from most Java project by the sheer number of resources
and by their 1:1 correspondence with Java classes. Maven, I think, is
optimized more for the more common case where a project has only a
handful of resources that are not tightly bound to particular classes.

jk

On Fri, Mar 20, 2009 at 04:51:38PM +0100, Martijn Dashorst wrote:
> I don't want that. If someone is anal about what maven is expecting,
> then it is their problem. I am in the business of making the best
> wicket development experience, from a Wicket perspective. We're using
> maven as a tool, we're not in the business of supplying maven with new
> users.
> 
> Putting all resources that belong to a component in the same physical
> folder as the component .java file is a best practice for Wicket
> users, even newbies. Doing it in any other way is opening the door to
> the nine hells of Maven usage and resource location.
> 
> I really don't want the archetype to do anything else than it
> currently does, nor document such a way. The Official Wicket Way (tm)
> is to put all source files relating to a single unit of work in one
> package, in the same physical folder. If you decide to do it
> otherwise, it is not The Official Wicket Way. Feel free to disagree,
> but do it somewhere else, and in your own private projects.
> 
> Martijn
> 
> -
> 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: Propper Way to Format Money

2009-02-25 Thread John Krasnay
We keep all our money amounts as ints representing the number of cents.
We have a MoneyField that extends TextField and overrides
getConverter(Class) to return something like this:

public class MoneyConverter implements IConverter {

public Object convertToObject(String value, Locale locale) {
try {
return Math.round(Float.parseFloat(value) * 100);
} catch (NumberFormatException e) {
throw new ConversionException(e)
.setSourceValue(value)
.setResourceKey("MoneyConverter")
}
}

public String convertToString(Object value, Locale locale) {
float amount = ((Number) value).floatValue() / 100;
return String.format("%.2f", amount);
}
}

If you like, you can prepend a dollar sign in convertToString and strip
it in convertToObject.

One thing I want to do but haven't gotten around to is to change the
styling depending on the focus. When the field doesn't have focus it
should be right-aligned, but this is weird when editing, so the idea is
to left-align it while the field has focus.

jk

On Wed, Feb 25, 2009 at 07:20:31PM -0300, Daniel Ferreira Castro wrote:
> I would like an opinion about what is the propper, or more recommended, way
> to format a TextField to show money?
> Should I declare it TextField or TextField?
> 
> And to format it with the money symbol ( Like US$) while you type?  Any
> ideas?
> 
> -- 
> "Two rules to succeed in life:
> 1 - don´t tell people everything you know."
> 
> We shall go on to the end.
> We shall fight in France
> We shall fightover the seas and oceans.
> We shall fight with growing confidence and growing strength in the air.
> We shall defend our island whatever the cost may be
> We shall fight on beaches, we shall fight on the landing grounds,
> We shall fight in the fields and in the streets,
> We shall fight on the hills.
> We shall never surrender.
> Winston Churchill

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



Re: wicket-spring classpath issue

2009-02-24 Thread John Krasnay
IMHO sharing JARs across J2EE apps is not worth the trouble.

- it messes up some JARs (commons-logging is a classic example)

- it forces you to keep your dependent JAR versions in sync across
  applications. This is particularly important in an enterprise
  environment where changing a dependent JAR version may force an
  additional QA cycle.

- it complicates deployment, since you have to remember to put any new
  dependent JARs in the app-server's lib directory instead of just
  dropping the WAR in place.

If you're like me, the memory allocated to the JVM is in the hundreds of
megs, so an additional few megs in the WARs is simply not worth the
effort.

jk

On Tue, Feb 24, 2009 at 04:00:58PM +0200, Alex Parvulescu wrote:
> Hello,
> 
> I have a problem with the wicket - spring integration in wicket 1.4 rc2 , i
> think its similar to https://issues.apache.org/jira/browse/WICKET-1848
> 
> The use case is like this :
> 
> I have 2 simple applications running in a jetty server.
> 
> To keep things simple , i added the spring and wicket libs to the common
> classpath (so the following libs: cglib-nodep-2.1_3.jar,
> commons-logging-1.1.jar , log4j-1.2.13.jar , slf4j-api-1.5.0.jar ,
> slf4j-log4j12-1.5.0.jar , spring-2.5.6.jar , wicket-1.4-rc2.jar ,
> wicket-ioc-1.4-rc2.jar , wicket-spring-1.4-rc2.jar  go into
> $JETTY_HOME/lib/ext/extra-libs )
> That helps me keep the size of the wars lower.
> 
> I think the problem is that by using this common classpath , the wicket
> applications share -some- context.More to the point , I don't think that
> LazyInitProxyFactory is thread safe , or maybe application safe. It appears
> that bean ids from one application are visible in another application thats
> deployed on the same server.
> 

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



Re: AW: AW: Avoid serialization troubles with static members

2009-02-19 Thread John Krasnay
javac is kinda redundant too. Real men sling raw bytecode.

jk

On Thu, Feb 19, 2009 at 12:02:36PM -0600, Jeremy Thomerson wrote:
> vi is not only a tool, but a whole platform, so that would exclude it.
> Personally, I find that
> 
> "echo import org.apache.wicket.*" >> MyClass.java
> "echo import java.util.*" >> MyClass.java
> 
> works best.  :) j/k j/k
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> On Thu, Feb 19, 2009 at 10:40 AM, Igor Vaynberg 
> wrote:
> 
> > so you only use javac, java, and vi? :)
> >
> > -igor
> >
> > On Thu, Feb 19, 2009 at 3:38 AM, Christian Helmbold
> >  wrote:
> > >> then I'd recommend using maven (or similar) :-)
> > >
> > > I try to use only tools I really nead. Sometimes it seems to me that in
> > Java programming most time is spent in frameworks and tools and not in the
> > programming itself. But, yes, I know the JAR hell and time for maven (or
> > Ivy?) has been come to me ...
> > >
> > > Regards,
> > > Christian
> > >
> > >
> > >
> > >
> > >
> > >
> > > -
> > > 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: Avoid serialization troubles with static members

2009-02-18 Thread John Krasnay
On Wed, Feb 18, 2009 at 04:45:26PM +, Christian Helmbold wrote:
> I've read http://cwiki.apache.org/WICKET/spring.html and the corresponding 
> section in "Wicket in Action" about the troubles with serialization of 
> injected services.
> 
> "Dependencies often have references to other dependencies in the
> container, and so if one is serialized it will probably serialize a few
> others and can possibly cascade to serializing the entire container."
> (http://cwiki.apache.org/WICKET/spring.html)
> 
> As
> far as I understand this is not a dependency injection specific issue.
> In either case all referenced objects are serialized recursively. So I
> think I have to take care about serialization not only when using
> Spring or Guice.
> 
> Wouldn't it be sufficient to use a static member to hold a reference to a 
> service? i.e.
> 
> public class SomeWicketComponent{
>   private static MyService service;
>   // ...
> }
> 

How would you intialize these? Would you have a static getter, and force
yourself to remember to always use it? Or would you have a static setter
and centralize the initialization code somewhere else? Either way sounds
ugly to me.

> Remains
> the problem with the injection. To solve this the mentioned website
> suggests several ways. The Application Object Approach seems to be most
> wicket like to me. But as mentioned there it is very verbose. Why not
> simply insert a  method to deliver requested beans into the Application
> class? It would look like this:
> 
> class MyApplication extends WebApplication {
>private ApplicationContext ctx = new ClassPathXmlContext("context.xml"); 
> // Spring context
>public Object getBean(String beanName){
>return ctx.getBean(beanName);
>}
> }
> 
> Is
> anything wrong with it?

The problem is you'll end up with code like this sprinkled throughout
your app:

  MyService svc = (MyService) MyApp.getBean("myService");

Let's see, where to start...

- it's ugly
- the cast and the bean name can fail in a way that is only detectable
  at runtime
- it ties all your components to your application class
- it's difficult to test, since you need to mock up a MyApp instance for
  your component to work

> I find it much more elegant than to store a
> reference for each bean in in the application class as suggested on 
> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach.
> 

I don't find either very elegant.

> Maybe the annotation-based approach is a bit more elegant but I don't like 
> annotations much.
> 

What don't you like about them? Annotations are a tool just like any
other part of the language. A carpenter doesn't use a brick because he
"doesn't like hammers much."

> It
> seems to me, that dependency injection (DI) and wicket is not a dream
> team. Do you use DI with Wicket or do you use the "classic" approach
> like Wicket itself does?
> 

I've been very happy with @SpringBean so far.

jk

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



Re: How to make wicket text in a td bold?

2009-02-17 Thread John Krasnay
  Person Name

...somewhere in your CSS...

  td.personname { font-weight: bold; }

jk

On Tue, Feb 17, 2009 at 07:54:36AM -0800, Edwin Ansicodd wrote:
> 
> have info in a table, want to make the text from wicket bold.  How do I do
> this?
> 
>   Person Name
> 
> The above doesn't work.  It's not bold with wicket.  How do I make it bold?
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-make-wicket-text-in-a-td-bold--tp22060100p22060100.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: Wicket source code using Maven

2009-02-17 Thread John Krasnay
I usually put this in my pom.xml so that I don't have to always remember
the command line parameter:

  
org.apache.maven.plugins
maven-eclipse-plugin

  true
  true
  1.5
  blah

  

jk


On Mon, Feb 16, 2009 at 11:30:54PM -0300, Daniel Ferreira Castro wrote:
> Thanks
> 
> On Mon, Feb 16, 2009 at 10:43 PM, Igor Vaynberg 
> wrote:
> 
> > mvn eclipse:eclipse -DdownloadSources=true
> >
> > -igor
> >
> > On Mon, Feb 16, 2009 at 5:38 PM, Daniel Ferreira Castro
> >  wrote:
> > > How to do to be able to download the source code of Wicket throught
> > Maven?
> > >
> > >
> > > I tried to insert it on my project pom, but didn't have success
> > >
> > >
> > >
> > >wicket-snaps
> > >http://wicketstuff.org/maven/repository
> > >
> > >true
> > >
> > >
> > >true
> > >
> > >Wicket
> > >
> > >
> > > --
> > > "Two rules to succeed in life:
> > > 1 - don´t tell people everything you know."
> > > 
> > > We shall go on to the end.
> > > We shall fight in France
> > > We shall fightover the seas and oceans.
> > > We shall fight with growing confidence and growing strength in the air.
> > > We shall defend our island whatever the cost may be
> > > We shall fight on beaches, we shall fight on the landing grounds,
> > > We shall fight in the fields and in the streets,
> > > We shall fight on the hills.
> > > We shall never surrender.
> > > Winston Churchill
> > >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> 
> -- 
> "Two rules to succeed in life:
> 1 - don´t tell people everything you know."
> 
> We shall go on to the end.
> We shall fight in France
> We shall fightover the seas and oceans.
> We shall fight with growing confidence and growing strength in the air.
> We shall defend our island whatever the cost may be
> We shall fight on beaches, we shall fight on the landing grounds,
> We shall fight in the fields and in the streets,
> We shall fight on the hills.
> We shall never surrender.
> Winston Churchill

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



Re: Nested forms : don't process inner form when outer form is submitted

2009-02-10 Thread John Krasnay
Have a look at the bottom of this page:

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

The example shown disables the whole inner form when the outer form is
submitted, meaning the inner form won't even be submitted. If you want
the inner form to be submitted but just not required, remove the
isEnabled override and implement isRequired on your text fields with
similar code.

jk

On Tue, Feb 10, 2009 at 12:33:00AM -0800, Marieke Vandamme wrote:
> 
> Thanks for the suggestions, but I'm still not sure how to implement it.
> My innerform implements IFormVisitorParticipant. I override
> processChildren(), but how do I know which form is getting submitted???
> Because when innerform is submitted, i want to return true, otherwise false. 
> Thanks for any help!! Marieke.
> 
> 
> igor.vaynberg wrote:
> > 
> > try letting your inner form implement IFormVisitorParticipant.
> > 
> > another way is to override isrequired() and check for the submitting
> > component.
> > 
> > -igor
> > 
> > On Mon, Feb 9, 2009 at 3:17 AM, Marieke Vandamme  wrote:
> >>
> >> Hello,
> >>
> >> I've been reading a lot about nested forms and what should happen with
> >> the
> >> inner forms when the outer form gets submitted. But I didn't found out
> >> how
> >> you can implement what i'm trying:
> >>
> >> I have inner form with some RequiredTextFields on it. These are required
> >> when the inner form is processed with an AjaxButton, but not when the
> >> outer
> >> form is submitted.
> >>
> >> How can I do this? Thanks for any help !!! Marieke.
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Nested-forms-%3A-don%27t-process-inner-form-when-outer-form-is-submitted-tp21910941p21910941.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Nested-forms-%3A-don%27t-process-inner-form-when-outer-form-is-submitted-tp21910941p21929547.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: Building a dynamic comma separated link list

2009-01-30 Thread John Krasnay
I did this by subclassing RepeatingView and overriding
AbstractRepeater.renderChild as follows...

public class SeparatorRepeatingView extends RepeatingView {

private boolean firstChildRendered = false;

private String separator = " | ";

public SeparatorRepeatingView(String id, IModel model) {
super(id, model);
}

public SeparatorRepeatingView(String id) {
super(id);
}

@Override
protected void onBeforeRender() {
firstChildRendered = false;
super.onBeforeRender();
}

@Override
protected void renderChild(Component child) {

boolean childVisible = child.isVisible();

if (firstChildRendered && childVisible && separator != null) {
getResponse().write(separator);
}

super.renderChild(child);

if (childVisible) {
firstChildRendered = true;
}
}

public String getSeparator() {
return separator;
}

public void setSeparator(String separator) {
this.separator = separator;
}

}

Unfortunately, ListView marks renderChild as final, so this technique
won't work there.

jk

On Fri, Jan 30, 2009 at 07:52:03AM -0800, Prag wrote:
> 
> I have the same problem.
> Did you find an elegant solution for this?
> 
> 
> 
> pixologe wrote:
> > 
> > Hi everybody,
> > This is probably quite easy, but I do not seem to be able to find an
> > elegant solution for this, so if anyone could give me a hint, I would
> > highly appreciate it...
> > 
> > I'd like to have a comma-separated link list with variable number of items
> > generated by wicket.
> > The link list is not a problem, just a link in the template and a listview
> > applied to it:
> >  # asdf 
> > 
> > But what is a neat way to get the commas inbetween? My idea was to have a
> > template like this:
> >  # asdf ,
> > A listview could be applied to "linklistitem" while "separator" could be
> > set invisible for the last item in the list...
> > 
> > But this seems quite complicated to me, is there something more elegant
> > than this? Perhaps a way to add a String between to items of a listview
> > when the view is being rendered?
> > 
> > Thanks in advance :)
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p21749819.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: migration from jsf to wicket

2009-01-29 Thread John Krasnay
On Thu, Jan 29, 2009 at 12:41:31PM +0200, Martin Makundi wrote:
> > 1) working with many attributes of an object
> > we have some pages where we access many attributes of an object, say we want
> > to show all 20 attributes of a person and all 10 attributes of
> > person.getAddress();
> > in the PersonPage.java i would have to add 30 label (or input) components,
> > 30 lines with nearly identical java code: add(new Label("firstName",
> > person.getName() );
> > isn't it tedious to always keep PersonDetails.java and PersonDetails.html
> > files in sync? in jsf/jsp the changes are only in the jsp/xhtml
> 
> There are few options that come into my mind:
> 1. add(new Label(CONSTANT_FIRST_NAME, person.getName() ); // Now you
> can re-use your constant from WicketTests.
> 2. add(new Label(CONSTANT_FIRST_NAME, new PropertyModel(person,
> Person.NAME_CONSTANT) ); // Now you can re-use your Entity's NAME
> -constant from JPA/ORM/Hibernate queries.
> 3. use CompoundPropertyModels. Yes. You will have to sync the names in
> html and in Java. Maybe someone will develop a nice plugin that
> automates this in the future:
> http://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels
> http://cwiki.apache.org/WICKET/more-on-models.html
> 

RepeatingView can also come in handy...

  RepeatingView rv = new RepeatingView("field");
  add(rv);
  String[] props = { "firstName", "lastName", ... };
  for (String prop : props) {
rv.add(new Label(rv.newChildId(), new PropertyModel(person, prop));
  }

If you have something more complex than a Label, just substitute your
own custom panel.

> > 2) page composition
> You can treat Title just as a Label. See  tag and Wicket
> modularity:
> http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
> http://www.javalobby.org/java/forums/t60926.html
> http://cwiki.apache.org/WICKET/create-dynamic-markup-hierarchies-using-panels.html
> 

One common approach is to use markup inheritance, then have the parent
class expose overridable methods.

  public abstract class BasePage extends WebPage {

public BasePage() {
  add(new Label("title", new AbstractReadOnlyModel() {
public Object getObject() {
  return getPageTitle();
}
  }));
}

public abstract String getPageTitle();
  }

  public class PersonPage extends BasePage {

public PersonPage(PageParameters pp) {
  // load person object based on pp
}

public String getPageTitle() {
  return getPerson().getName();
}
  }

The trick here is to avoid calling the overridable method directly from
the base class constructor (else we'd call PersonPage.getPageTitle
before the person was loaded). That's what the AbstractReadOnlyMethod
thing is about.

> > 3) preview functionality
> > is this right: as soon as we use page composition and components, the
> > preview feature is gone; how do you experienced wicket users handle this? is
> > it usable in a prototype phase - before the html prototype is decomposed
> > into composition parts and components?
> 
> The runtime page hierarchy is ofcourse visible only at runtime, but
> you can preview each panel separately ofcourse (if it makes sense).
> 

It's important to note that everything outside the  tag
(for markup inheritance) or the  tag (for panels) is
ignored by Wicket. You can therefore use this to create a reasonable
harness for previewing...

  

  
  


  My Panel Preview
  
...
  

  

But ultimately the point of a component-based framework is to avoid
copying boilerplate around, so if you're looking for previews of
fully-formed pages you're doing it wrong.

jk

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



Re: AJAX cluster failover help

2009-01-26 Thread John Krasnay
Indeed, 1.3.5 fixed the problem. Thanks again, Igor.

jk

On Mon, Jan 26, 2009 at 01:57:22PM -0500, John Krasnay wrote:
> We're on 1.3.3. I'll try again with 1.3.5.
> 
> Thanks.
> 
> jk
> 
> On Mon, Jan 26, 2009 at 10:41:45AM -0800, Igor Vaynberg wrote:
> > what wicket version are you using?
> > 
> > that registration was missing until 5/9/08, so if your wicket version
> > is earlier then that it might not work properly.
> > 
> > -igor
> > 
> > On Mon, Jan 26, 2009 at 10:36 AM, John Krasnay  wrote:
> > > I'm doing cluster failover testing with my app and I'm running into a
> > > weird failure. The test involves failing the node where my session is
> > > active while performing UI operations.
> > >
> > > On one page in the app, I have an AjaxTabbedPanel. Clicking amongst the
> > > tabs while the failover occurs works flawlessly. There is a brief pause
> > > when the first node finally stops and the load balancer routes me to the
> > > alternate node, but otherwise no errors are apparent.
> > >
> > > On another page, I have an AjaxForm and an AjaxButton that does a search
> > > and updates a ListView on the page with the results. When I do the
> > > failover test while repeatedly searching, I eventually get the following
> > > error:
> > >
> > >  Attempt to access unknown request listener interface
> > >  IActivePageBehaviorListener
> > >
> > > This error comes from
> > > AbstractRequestCycleProcessor.resolveListenerInterfaceTarget, when
> > > RequestListenerInterface.forName can't resolve
> > > IActivePageBehaviorListener into the corresponding
> > > RequestListenerInterface instance. But IActivePageBehaviorListener
> > > should have been registered with RequestListenerInterface when its class
> > > was loaded, which should have happened at least by the time the page was
> > > replicated into the session on the backup node.
> > >
> > > Does anyone have any idea what might be happening here?
> > >
> > > jk
> > >
> > > -
> > > 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: AJAX cluster failover help

2009-01-26 Thread John Krasnay
We're on 1.3.3. I'll try again with 1.3.5.

Thanks.

jk

On Mon, Jan 26, 2009 at 10:41:45AM -0800, Igor Vaynberg wrote:
> what wicket version are you using?
> 
> that registration was missing until 5/9/08, so if your wicket version
> is earlier then that it might not work properly.
> 
> -igor
> 
> On Mon, Jan 26, 2009 at 10:36 AM, John Krasnay  wrote:
> > I'm doing cluster failover testing with my app and I'm running into a
> > weird failure. The test involves failing the node where my session is
> > active while performing UI operations.
> >
> > On one page in the app, I have an AjaxTabbedPanel. Clicking amongst the
> > tabs while the failover occurs works flawlessly. There is a brief pause
> > when the first node finally stops and the load balancer routes me to the
> > alternate node, but otherwise no errors are apparent.
> >
> > On another page, I have an AjaxForm and an AjaxButton that does a search
> > and updates a ListView on the page with the results. When I do the
> > failover test while repeatedly searching, I eventually get the following
> > error:
> >
> >  Attempt to access unknown request listener interface
> >  IActivePageBehaviorListener
> >
> > This error comes from
> > AbstractRequestCycleProcessor.resolveListenerInterfaceTarget, when
> > RequestListenerInterface.forName can't resolve
> > IActivePageBehaviorListener into the corresponding
> > RequestListenerInterface instance. But IActivePageBehaviorListener
> > should have been registered with RequestListenerInterface when its class
> > was loaded, which should have happened at least by the time the page was
> > replicated into the session on the backup node.
> >
> > Does anyone have any idea what might be happening here?
> >
> > jk
> >
> > -
> > 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



AJAX cluster failover help

2009-01-26 Thread John Krasnay
I'm doing cluster failover testing with my app and I'm running into a
weird failure. The test involves failing the node where my session is
active while performing UI operations. 

On one page in the app, I have an AjaxTabbedPanel. Clicking amongst the
tabs while the failover occurs works flawlessly. There is a brief pause
when the first node finally stops and the load balancer routes me to the
alternate node, but otherwise no errors are apparent.

On another page, I have an AjaxForm and an AjaxButton that does a search
and updates a ListView on the page with the results. When I do the
failover test while repeatedly searching, I eventually get the following
error:

  Attempt to access unknown request listener interface
  IActivePageBehaviorListener

This error comes from
AbstractRequestCycleProcessor.resolveListenerInterfaceTarget, when
RequestListenerInterface.forName can't resolve
IActivePageBehaviorListener into the corresponding
RequestListenerInterface instance. But IActivePageBehaviorListener
should have been registered with RequestListenerInterface when its class
was loaded, which should have happened at least by the time the page was
replicated into the session on the backup node.

Does anyone have any idea what might be happening here?

jk

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



Re: Preserving mount point in URLs

2009-01-09 Thread John Krasnay
Cool, thanks. I'll give it a try.

jk

On Fri, Jan 09, 2009 at 08:52:44AM -0800, Igor Vaynberg wrote:
> change the coding strategy to use query string to encode params. see
> querystringcodingstrategy for necessary code.
> 
> -igor
> 

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



Preserving mount point in URLs

2009-01-09 Thread John Krasnay
Hi Wicketeers,

My client has a web security infrastructure in place where a transparent
proxy sits in front of the application server and filters requests based
on URL pattern. I am trying to fit their first Wicket-based application
into this infrastructure. We would like to allow requests based on URL
pattern and authentication level and block all unrecognized requests.

I'm using HybridUrlCodingStrategy to try and preserve the mount point
in subsequent links and form URLs. This works well in some cases, but
falls down when I pass parameters to a page. For example, a page mounted
on "mypage" with no parameters results in a URL like this...

  http://host/myapp/mypage

...and links on the page are rendered like this...

  ?:wicket:interface:...

...which the browser recognizes as something like this...

  http://host/myapp/mypage.4?:wicket:interface:...

...which is great, since we can still implement our security policy
based on the "mypage" portion of the URL. The problem is, if I pass a
parameter to the page, the URL looks like this...

  http://host/myapp/mypage/key/value/

...and links on the page look like this...

  ../../../?:wicket:interface:...
  
...which the browser reduces to this...

  http://host/myapp/?:wicket:interface:...

This is no longer good, because we've lost the mount point. The problem
appears to be the trailing slash added by
AbstractRequestTargetUrlCodingStrategy.appendValue, which triggers an
extra "../" to be added to the link URL. And if the mount point as a
slash inside it, e.g. "foo/bar", then neither case works properly.

It's starting to feel that it will be difficult to preserve the mount
point across requests. I know this has been discussed before on this
list, usually in the context of "pretty" URLs, but I haven't seen a good
solution. Has anyone been able to get something like this to work well?

jk


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



Re: sorry, what do u mean for that?

2009-01-06 Thread John Krasnay
It was a bad joke. You asked for suggestions but didn't explain what
your problem was.

jk

On Tue, Jan 06, 2009 at 07:51:25PM -0800, wch2001 wrote:
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Help%2CDownloadLink%2C-when-file-is-not-existed%2C-not-error-message-tp21307695p21324403.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: anyone has some suggestion? thanks a lot

2009-01-06 Thread John Krasnay
Buy low, sell high?

jk

On Tue, Jan 06, 2009 at 05:55:08PM -0800, wch2001 wrote:
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Help%2CDownloadLink%2C-when-file-is-not-existed%2C-not-error-message-tp21307695p21323395.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: debugging

2008-12-23 Thread John Krasnay
I use Tomcat via the Eclipse WTP. Here are some quick instructions if
you're using Maven:

- add the wtpversion and wtpContextName elements to your
  maven-eclipse-plugin config

  
org.apache.maven.plugins
maven-eclipse-plugin

  true
  true
  2.0
  oneid-web

  

- regenerate your Eclipse project: mvn eclipse:eclipse

- in Eclipse, refresh your project. You should see a little globe in the
  top right corner of your project icon.

- open the Servers view, right click it, and add a Tomcat server. You'll
  have to tell it about your Tomcat install directory.

- right-click your newly created server, select Add and Remove
  Projects..., and add your project to the server.

- start the server by clicking the little bug icon in the Servers view.

I've heard others on this list favour Jetty over Tomcat for reasons of
startup time and hot code replace, but I've not had either problem with
Tomcat. It starts fast (~10 seconds for my app, most of which is
starting up Spring and Hibernate), and hot code replace works unless I'm
changing the "shape" of a class (e.g. adding fields or methods).

jk

On Tue, Dec 23, 2008 at 11:34:41AM +0100, Björn Tietjens wrote:
> Hi,
> 
> I am developing a webapp with wicket on eclipse, deploying as war, using 
> a local tomcat for testing.
> What is the best/easiest way to debug my app with eclipse?
> How can I deploy/start the webapp from within eclipse or how can I  
> attach eclipse to tomcat in order to debug my code?
> 
> Thanx for your help.
> Cheers Björn
> 
> -
> 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: Stateless form action in Wicket

2008-12-13 Thread John Krasnay
See http://en.wikipedia.org/wiki/Post/Redirect/Get

jk

On Fri, Dec 12, 2008 at 07:25:19PM -0800, Vinayak Borkar wrote:
> Hello,
> 
> I am creating a page (say Page A) that contains a stateless form. The 
> stateless form's action leads to page B.
> 
> I observe that in Wicket, the form action is created so that the request 
> is sent back to Page A (An instance of Page A is created when the form 
> is submitted) and then it redirects to Page B. Is that correct ?
> 
> If so, what is the reason for that?
> 
> How do I get Wicket to create the form so that the action goes directly 
> to Page B. i.e. Page A is NOT instantiated on the submission of the form.
> 
> Thanks,
> Vinayak
> 
> -
> 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: [OT] wicket users around the world

2008-12-11 Thread John Krasnay
Toronto, Canada

jk

On Thu, Dec 11, 2008 at 07:57:49PM +0100, 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



Re: Child page with no html

2008-12-11 Thread John Krasnay
On Thu, Dec 11, 2008 at 02:29:04AM -0800, Michael Sparer wrote:
> 
> you could also just request a childId from the super-class, but I think the
> above way is more elegant :-)
> 

More elegant, yes, but also more verbose. Pick your poison, I guess.

jk

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



Re: Child page with no html

2008-12-10 Thread John Krasnay
Careful!  ChildPage.getComponents() is invoked before ChildPage's
constructor. This will trip you up sooner or later.

You can easily fix this with a model:

IModel componentsModel = new AbstractReadOnlyModel() {
public Object getObject() { return getComponents(); }
}

add(new ListView("listview", componentsModel) { ... });

Personally, I prefer to use a RepeatingView in this sort of situation.
Just create the RepeatingView in the base class, then provide an add
method for subclasses to call to add components directly to the
RepeatingView. (I also provide a method that wraps
RepeatingView.newChildId.) This approach avoids the intermediate list,
the anonymous inner ListView subclass, and the problem described above.

jk


On Wed, Dec 10, 2008 at 04:16:31PM -0800, smackie604 wrote:
> 
> Thank you Nino!
> 
> The solution could not have been any easier:)  Here is how I did this incase
> anyone else starts thinking of complicated solutions like myself:
> 
> ParentPage.java
> 
> public abstract class ParentPage extends WebPage
> {
>   public static String COMPONENT_ID = "component";
> 
>   public ParentPage()
>   {
>   add( new ListView( "listview", getComponents() )
>   {
>   protected void populateItem( ListItem item )
>   {
>   item.add( item.getModel().getObject() );
>   }
>   } );
>   }
> 
>   protected abstract List getComponents();
> }
> 
> ParentPage.html
> ---
> 
> 
>   
> 
> 
>   
>   This is a component
>   
> 
> 
> 
> ChildPage.java
> --
> public class ChildPage extends ParentPage
> {
>   protected List getComponents()
>   {
>   List  l = new ArrayList();
>   l.add( new Label(COMPONENT_ID, "Component 1") );
>   l.add( new Label(COMPONENT_ID, "Component 2") );
>   l.add( new Label(COMPONENT_ID, "Component 3") );
>   return l;
>   }
> }
> 
> 
> Nino.Martinez wrote:
> > 
> > Scott,
> > 
> > Think inheritance :)
> > 
> > Just write a super which has abstract methods that returns components 
> > for c1..c4() and thats it.. no need for trickery with 
> > IMarkupResourceStreamProvider ...
> > 
> > Should I elaborate more?
> > 
> > You could also take a look at the wicketstuff accordion thing, it does 
> > something along these lines[1]...
> > 
> > 
> > 1=http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-accordion
> > 
> > regards
> > 
> > smackie604 wrote:
> >> Hi,
> >>
> >> My team has adopted wicket as it's web framework and we have been busy
> >> creating a lot of interesting Panels to build pages for our product.  It
> >> is
> >> turning out that most of the time all the components on the page are
> >> Panels
> >> and we end up with a situation like this:
> >>
> >> MyPage.java
> >> --
> >> public class MyPage extends BasePage
> >> {
> >>   MyPage()
> >>   {
> >> add(SomePanel("c1"));
> >> add(SomePanel("c2"));
> >> add(SomePanel("c3"));
> >> add(SomePanel("c4"));
> >>   }
> >> }
> >>
> >> MyPage.html
> >> ---
> >> 
> >>   
> >>   
> >>   
> >>   
> >> 
> >>
> >> It would be nice if we didn't have to write html files for pages in these
> >> situations and instead just do something like this:
> >>
> >> MyPage.java
> >> --
> >> public class MyPage extends BasePage
> >> {
> >>   MyPage()
> >>   {
> >> addToRepeater(SomePanel("c1"));
> >> addToRepeater(SomePanel("c2"));
> >> addToRepeater(SomePanel("c3"));
> >> addToRepeater(SomePanel("c4"));
> >>   }
> >> }
> >>
> >> Where BasePage will have a method called addToRepeater which just adds
> >> the
> >> component to the repeater. 
> >>
> >> I see we could do some trickery by implementing
> >> IMarkupResourceStreamProvider on the BasePage to force the template of
> >> it's
> >> child classes to always use BasePage.html.  I'm not sure this is the best
> >> way of doing this, does anyone have any comments on using this approach?
> >>
> >> Thanks,
> >>
> >> Scott
> >>   
> > 
> > -- 
> > -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]
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Child-page-with-no-html-tp20945577p20947047.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Re: Wicket Session grows too big real fast

2008-11-26 Thread John Krasnay
If the previous page is bookmarkable you don't need to keep a reference
to the page instance; instead, just re-create the page parameters and
call setResponsePage(pageClass, parameters) when the user clicks Cancel.

jk

On Wed, Nov 26, 2008 at 01:35:11AM -0800, jhp wrote:
> 
> Well, yes references to pages seems to be given as constructor arguments to
> several pages. The idea is that if 'Cancel' is clicked, application goes
> back to previous page. The possibility to go back more than one page is not
> necessary. Is the correct way to implement cancle with some javascript that
> does something like user clicking previous page?
> 
> Jukka
> 
> 
> Martijn Dashorst wrote:
> > 
> > With Wicket 1.3 only one page should be stored in session. You should
> > check if you don't keep references between pages -> that would result
> > in 1+N pages (with N being the number of pages you reference in your
> > page).
> > 
> > Other than that: using LDM's and DataView/DataProvider instead of
> > ListView will help considerably.
> > 
> > Martijn
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Wicket-Session-grows-too-big-real-fast-tp20697077p20697523.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> 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: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread John Krasnay
On Thu, Nov 20, 2008 at 07:18:11PM +0100, Peter Ertl wrote:
> for SubPanel the ctor is called that order
> 
> - 
> - Panel
> - BasePanel
  calls MarkupContainer.add()
  calls SubPanel.onComponentAdd() (before SubPanel ctor!)
> - SubPanel
> 
> so the fields will be initialized, eh?!
> 
> 
> Am 20.11.2008 um 16:32 schrieb John Krasnay:
> 
> >Here's the problem (also with sketchy pseudo code :)
> >
> >public class BasePanel extends Panel {
> >   public BasePanel(String id) {
> >   super(id);
> >   add(new Label("foo", ...));
> >   }
> >}
> >
> >public class SubPanel extends BasePanel {
> >   @Override
> >   public void onComponentAdd(Component child) {
> >   // oops, called from BasePanel ctor
> >   // my fields aren't initialized yet
> >   }
> >}
> >
> >jk

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



Re: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread John Krasnay
Here's the problem (also with sketchy pseudo code :)

public class BasePanel extends Panel {
public BasePanel(String id) {
super(id);
add(new Label("foo", ...));
}
}

public class SubPanel extends BasePanel {
@Override
public void onComponentAdd(Component child) {
// oops, called from BasePanel ctor
// my fields aren't initialized yet
}
}

jk

On Thu, Nov 20, 2008 at 12:38:39PM +0100, Peter Ertl wrote:
> I was thinking about something like this:
> 
> [warning, sketchy pseudo code will follow]
> 
>  method org.apache.wicket.MarkupContainer.add(Component... children) :
> 
>-> call empty overridable method onComponentAdd(Component child)  
> for each component
>-> add component
> 
>protected void onComponentAdd(Component child) { /* overridable */ }
> 
> 
> 
> Am 20.11.2008 um 12:30 schrieb John Krasnay:
> 
> >Yeah, I thought about that. The problem is add() is usually called  
> >from
> >a component's constructor, so you would have a case of a constructor
> >(indirectly) calling a non-final method,
> >
> >jk
> >
> >On Thu, Nov 20, 2008 at 11:27:39AM +0100, Peter Ertl wrote:
> >>Wouldn't it be more powerful to override / hook into the process of
> >>adding a component of a container?
> >>
> >>Something like that ...
> >>
> >>new WebMarkupContainer(id)
> >>{
> >> @Override
> >> public void onComponentAdd(Component child)
> >> {
> >>   // check the sealed flag, decorate the child, throw exception, or
> >>do [whatever]
> >> }
> >>}
> >>
> >>
> >>
> >>
> >>Am 20.11.2008 um 05:25 schrieb John Krasnay:
> >>
> >>>Hi folks,
> >>>
> >>>In my current Wicket app I have a panel that contains a vertically
> >>>stacked list of sub-panels. Because the precise list of sub-panels  
> >>>is
> >>>not known until runtime, I've implemented this with a RepeatingView.
> >>>My
> >>>parent panel has the following methods that I use to build the  
> >>>list of
> >>>sub-panels ("rv" is my RepeatingView instance):
> >>>
> >>>public void addSubPanel(Panel subPanel) { rv.add(subPanel); }
> >>>public String newSubPanelId() { return rv.newChildId(); }
> >>>
> >>>I use this same pattern in a number of other instances such as menus
> >>>and
> >>>button bars.
> >>>
> >>>The problem is that I often mistakenly call add instead of
> >>>addSubPanel,
> >>>which of course fails at render time with an exception that I always
> >>>find hard to decipher.
> >>>
> >>>It would be nice if there was a way to "seal" a MarkupContainer  
> >>>once I
> >>>had populated it such that any subsequent call to add, remove, or
> >>>replace would fail immediately with an exception. This would make it
> >>>much easier to find out where I had made the mistake.
> >>>
> >>>Does anyone else think this would be a worthwhile feature?
> >>>
> >>>jk
> >>>
> >>>-
> >>>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]
> 
> 
> -
> 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: Feature idea: sealed flag on MarkupContainer

2008-11-20 Thread John Krasnay
Yeah, I thought about that. The problem is add() is usually called from
a component's constructor, so you would have a case of a constructor
(indirectly) calling a non-final method,

jk

On Thu, Nov 20, 2008 at 11:27:39AM +0100, Peter Ertl wrote:
> Wouldn't it be more powerful to override / hook into the process of  
> adding a component of a container?
> 
> Something like that ...
> 
> new WebMarkupContainer(id)
> {
>   @Override
>   public void onComponentAdd(Component child)
>   {
> // check the sealed flag, decorate the child, throw exception, or  
> do [whatever]
>   }
> }
> 
> 
> 
> 
> Am 20.11.2008 um 05:25 schrieb John Krasnay:
> 
> >Hi folks,
> >
> >In my current Wicket app I have a panel that contains a vertically
> >stacked list of sub-panels. Because the precise list of sub-panels is
> >not known until runtime, I've implemented this with a RepeatingView.  
> >My
> >parent panel has the following methods that I use to build the list of
> >sub-panels ("rv" is my RepeatingView instance):
> >
> > public void addSubPanel(Panel subPanel) { rv.add(subPanel); }
> > public String newSubPanelId() { return rv.newChildId(); }
> >
> >I use this same pattern in a number of other instances such as menus  
> >and
> >button bars.
> >
> >The problem is that I often mistakenly call add instead of  
> >addSubPanel,
> >which of course fails at render time with an exception that I always
> >find hard to decipher.
> >
> >It would be nice if there was a way to "seal" a MarkupContainer once I
> >had populated it such that any subsequent call to add, remove, or
> >replace would fail immediately with an exception. This would make it
> >much easier to find out where I had made the mistake.
> >
> >Does anyone else think this would be a worthwhile feature?
> >
> >jk
> >
> >-
> >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]



Feature idea: sealed flag on MarkupContainer

2008-11-19 Thread John Krasnay
Hi folks,

In my current Wicket app I have a panel that contains a vertically
stacked list of sub-panels. Because the precise list of sub-panels is
not known until runtime, I've implemented this with a RepeatingView. My
parent panel has the following methods that I use to build the list of
sub-panels ("rv" is my RepeatingView instance):

  public void addSubPanel(Panel subPanel) { rv.add(subPanel); }
  public String newSubPanelId() { return rv.newChildId(); }

I use this same pattern in a number of other instances such as menus and
button bars.

The problem is that I often mistakenly call add instead of addSubPanel,
which of course fails at render time with an exception that I always
find hard to decipher.

It would be nice if there was a way to "seal" a MarkupContainer once I
had populated it such that any subsequent call to add, remove, or
replace would fail immediately with an exception. This would make it
much easier to find out where I had made the mistake.

Does anyone else think this would be a worthwhile feature?

jk

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



Re: Markup for a component interior

2008-11-18 Thread John Krasnay
You'll need to do something like this inside your border:

  form.add(getBodyContainer());

See the Border javadoc for a more detailed explanation.

jk

On Tue, Nov 18, 2008 at 04:56:09PM -0200, Adriano dos Santos Fernandes wrote:
> John Krasnay escreveu:
> >You probably want to implement a Border instead of extending Form.
> Border is exactly what I was looking for. But I'm having problems 
> [Cannot modify component hierarchy after render phase has started (page 
> version cant change then anymore)] with component hierarchies.
> 
> My border markup has a  and  is inside 
> it. Is it Border suitable for this usage?
> 
> 
> Adriano
> 
> 
> -
> 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: Markup for a component interior

2008-11-18 Thread John Krasnay
You probably want to implement a Border instead of extending Form.

jk

On Tue, Nov 18, 2008 at 01:36:06PM -0200, Adriano dos Santos Fernandes wrote:
> I have a generic Form component (extends Form) and it adds child 
> components to this. But where I place this form, I need to specify more 
> content for the form interior. Kind of:
> 
> 
>tags put by the Form class
> 
>tags put by who inserted the class on the page
> 
> 
> In my prototype code, I have all the markup inside the page, and I add 
> the form to it. But as I'm going to create more pages, I don't want to 
> duplicate the markup. I feel my case is not for page inheritance. In 
> fact, I'm already using page inheritance for generic layout.
> 
> Any advice why I could do it?
> 
> 
> Adriano
> 
> 
> -
> 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: Incremental migration from JSP-based applications to Wicket?

2008-11-05 Thread John Krasnay
On Wed, Nov 05, 2008 at 11:49:02AM -0500, Susan Liebeskind wrote:
> Igor Vaynberg wrote:
> >i think the best way to migrate an app is to migrate it a
> >page/pageflow at a time. running wicket inside a jsp or jsp inside
> >wicket is always going to have gotchas you will have to work around.
> >
> >  
> Agreed, and you just have to live with some quirks/gotchas while you go 
> through the migration. 
> 
> But I'm just looking for a sense of how people start actually using 
> Wicket. Do you have any feel for the ratio of new development in Wicket 
> vs. migration old apps to Wicket, just based on the traffic you've seen 
> go by on the list over the years?
> 
> Again, I know this is a non-scientific survey and not something that can 
> be really quantified.
> 
> Susan

I migrated an application from SpringMVC/Freemarker (no JSP) to Wicket
over a period of several weeks. I basically did it as Igor suggested, a
page[flow] at a time; some URLs went to the old pages, some to the new.

The biggest issue I can recall is with feedback panels. If we raised a
feedback message (e.g. Session.get().info("Record saved.")) then
redirected to a non-Wicket page, the user wouldn't see the message until
they later hit a Wicket page. I'm sure we could have worked something up
to display Wicket feedback messages from non-Wicket pages but we
completed the migration before it became much of an issue.

jk

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



Re: Hot deployment / Server restart

2008-10-30 Thread John Krasnay
You can fix this through Eclipse too...

- double-click your Tomcat server in your Servers view
- select the Modules tab on the resulting editor page
- select your application module and click Edit
- de-select "Auto reloading enabled" and click OK
- save the editor page and restart Tomcat

jk

On Thu, Oct 30, 2008 at 10:40:40AM +0100, Witold Czaplewski wrote:
> In your context.xml did you set the attribute reloadable on true?
> 
> On true catalina monitors classes in /WEB-INF/classes for
> changes and automatically reloads the application.
> 
> 
> Am Thu, 30 Oct 2008 02:31:08 -0700 (PDT)
> schrieb geke <[EMAIL PROTECTED]>:
> 
> > 
> > No I´m working with Tomcat 6.0
> > 
> > 
> > 
> > francisco treacy-2 wrote:
> > > 
> > > i suggest you use the jetty container for development. you can find
> > > a perfect working example in the wicket quickstart archetype:
> > > http://wicket.apache.org/quickstart.html
> > > 
> > > francisco
> > > 
> > > On Thu, Oct 30, 2008 at 10:11 AM, geke <[EMAIL PROTECTED]>
> > > wrote:
> > >>
> > >> My IDE is eclipse-jee-ganymede.
> > >> Where can I find such information?
> > >>
> > >>
> > >>
> > >> martin-g wrote:
> > >>>
> > >>> Wicket doesn't control the lifecycle of the web container.
> > >>> There is something else that triggers the restart (maybe the
> > >>> IDE ?!).
> > >>>
> > >>> On Thu, 2008-10-30 at 01:46 -0700, geke wrote:
> >  Hi,
> > 
> >  on every change in my HTML or Java file the tomcat 6.0 server
> >  restarts completely, for example if I change the css
> >  definitions. This is annoying
> >  and primarily time-consuming.
> >  Is there a possibility that the server only restarts, if for
> >  example the
> >  method signature in the java file or a tag with wicket:id in the
> >  HTML file
> >  changes, and I although see the last changes in the websites?
> >  The less the server restarts the better.
> > 
> > >>>
> > >>>
> > >>> -
> > >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>>
> > >>>
> > >>>
> > >>
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/Hot-deployment---Server-restart-tp20242820p20243162.html
> > >> Sent from the Wicket - User mailing list archive at Nabble.com.
> > >>
> > >>
> > >> -
> > >> 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]
> 

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



Re: Trying to create a calendar - need some guidance

2008-10-23 Thread John Krasnay
Uh, yeah, that's what I meant to say, just use a GridView :-)

jk

On Thu, Oct 23, 2008 at 05:14:42PM -0700, Igor Vaynberg wrote:
> all you need is a gridview. set columns to 7 and generate 30 items...
> 
> -igor
> 
> On Thu, Oct 23, 2008 at 1:47 PM, V. Jenks <[EMAIL PROTECTED]> wrote:
> >
> > Hi all.
> >
> > I'm trying to build a component-ized calendar that will be the centerpiece
> > of a new application I'm working on.  I built one this morning in JSP and
> > was able to do it with very little code.  I kept it simple and I'm hoping I
> > can retro-fit the logic into a wicket page cleanly, without too much
> > trouble.  I'm a little stuck because in my JSP, I simply loop through the
> > days and print until Saturday is reached, then I break to a new table row
> > and continue.  Doing this in Wicket seems tough because if I use a ListView,
> > I can't be as flexible as far as throwing in a new row while looping and
> > outputting table cells.
> >
> > Here's the rough idea I came up with today in JSP, can someone give me some
> > pointers?
> >
> > <%@ page contentType="text/html" pageEncoding="UTF-8" %>
> > <%@ page import="java.util.*" %>
> >  > "http://www.w3.org/TR/html4/loose.dtd";>
> > <%
> >  //get parameters to change date
> >  String monthParam = request.getParameter("month");
> >  String yearParam = request.getParameter("year");
> >
> >  //create calendar object
> >  Calendar cal = Calendar.getInstance();
> >  cal.setFirstDayOfWeek(Calendar.SUNDAY); //set first day to Sunday
> >
> >  if (monthParam != null)
> >cal.set(Calendar.MONTH, (Integer.valueOf(monthParam)-1));
> >
> >  if (yearParam != null)
> >cal.set(Calendar.YEAR, Integer.valueOf(yearParam));
> >
> >  //get total number of days in month
> >  int numDaysInMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
> >
> >  //get current month name in English
> >  String monthName = cal.getDisplayName(Calendar.MONTH, Calendar.LONG,
> > Locale.ENGLISH);
> >
> >  //get current year
> >  int year = cal.get(Calendar.YEAR);
> >
> >  //get array of day names
> >  String[] headers = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
> > %>
> > 
> >  
> >
> >Calendarama!
> >  
> >  
> >
> >  
> >
> ><%= monthName + " " + year %>
> >  
> >  
> >
> ><%
> >  for (int i=0; i<7; i++)
> >  {
> >%>
> ><%= headers[i] %>
> ><%
> >  }
> >%>
> >  
> >  
> >  
> ><%
> >  for (int i=1; i<=numDaysInMonth; i++)
> >  {
> >//re-set calendar day in context of loop
> >cal.set(Calendar.DAY_OF_MONTH, i);
> >
> >//get the day number of the week
> >int day = cal.get(Calendar.DAY_OF_WEEK);
> >
> >//days without numbers count
> >int blankDays = 0;
> >
> >//blank days before 1st of month?
> >if (i == 1 && day > 1)
> >{
> >  blankDays = day - i; //get count
> >
> >  //loop through count and print blank day
> >  for (int x=1; x<=blankDays; x++)
> >  {
> >%>
> >   
> ><%
> >  }
> >}
> >%>
> >  <%= i %>
> ><%
> >if (day == Calendar.SATURDAY)
> >{
> >%>
> >  
> >  
> ><%
> >}
> >
> >//blank days after last day of month?
> >if (i == numDaysInMonth && day < 7)
> >{
> >  blankDays = 7 - day; //get count
> >
> >  //loop through count and print blank day
> >  for (int x=1; x<=blankDays; x++)
> >  {
> >%>
> >   
> ><%
> >  }
> >}
> >  }
> >%>
> >  
> >
> >  
> > 
> >
> > --
> > View this message in context: 
> > http://www.nabble.com/Trying-to-create-a-calendar---need-some-guidance-tp20138860p20138860.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > -
> > 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: Trying to create a calendar - need some guidance

2008-10-23 Thread John Krasnay
ListView is good if you already have a list of things you want to
display. For this kind of iteration you'd be better off with a
RepeatingView. Here's how I might tackle it:

- create a top-level panel to hold the calendar. The markup would
  contain your table element, and would have a RepeatingView attached
  to a tr element

- create a panel representing the row, which has a RepeatingView
  attached to a td element.

- create a panel representing a day.

- put your loop in the ctor of the top-level panel. Start by creating a
  row panel and adding it to the first RepeatingView. Then for each day,
  create a day panel and add it to the repeating view in the row. When
  you get to the Saturday, just create a new row panel as the "current"
  one, add it to the first RepeatingView, and continue on your way.

Now for the cool part: you could put the part where you create the day
panel into an overrideable method. Then you could re-use the component to
generate all kinds of different calendars by simply subclassing and
returning different kinds of day panels.

jk

On Thu, Oct 23, 2008 at 01:47:26PM -0700, V. Jenks wrote:
> 
> Hi all.
> 
> I'm trying to build a component-ized calendar that will be the centerpiece
> of a new application I'm working on.  I built one this morning in JSP and
> was able to do it with very little code.  I kept it simple and I'm hoping I
> can retro-fit the logic into a wicket page cleanly, without too much
> trouble.  I'm a little stuck because in my JSP, I simply loop through the
> days and print until Saturday is reached, then I break to a new table row
> and continue.  Doing this in Wicket seems tough because if I use a ListView,
> I can't be as flexible as far as throwing in a new row while looping and
> outputting table cells.
> 
> Here's the rough idea I came up with today in JSP, can someone give me some
> pointers?
> 
> <%@ page contentType="text/html" pageEncoding="UTF-8" %>
> <%@ page import="java.util.*" %>
>  "http://www.w3.org/TR/html4/loose.dtd";>
> <%
>   //get parameters to change date
>   String monthParam = request.getParameter("month");
>   String yearParam = request.getParameter("year");
>   
>   //create calendar object
>   Calendar cal = Calendar.getInstance();
>   cal.setFirstDayOfWeek(Calendar.SUNDAY); //set first day to Sunday
>   
>   if (monthParam != null)
> cal.set(Calendar.MONTH, (Integer.valueOf(monthParam)-1));
>   
>   if (yearParam != null)
> cal.set(Calendar.YEAR, Integer.valueOf(yearParam));
> 
>   //get total number of days in month
>   int numDaysInMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
> 
>   //get current month name in English
>   String monthName = cal.getDisplayName(Calendar.MONTH, Calendar.LONG,
> Locale.ENGLISH);
> 
>   //get current year
>   int year = cal.get(Calendar.YEAR);
>   
>   //get array of day names
>   String[] headers = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
> %>
> 
>   
> 
> Calendarama!
>   
>   
> 
>   
> 
> <%= monthName + " " + year %>
>   
>   
> 
> <%
>   for (int i=0; i<7; i++)
>   {
> %>
> <%= headers[i] %>
> <%
>   }
> %>
>   
>   
>   
> <%
>   for (int i=1; i<=numDaysInMonth; i++)
>   {
> //re-set calendar day in context of loop
> cal.set(Calendar.DAY_OF_MONTH, i);
> 
> //get the day number of the week
> int day = cal.get(Calendar.DAY_OF_WEEK);
> 
> //days without numbers count
> int blankDays = 0;
> 
> //blank days before 1st of month?
> if (i == 1 && day > 1)
> {
>   blankDays = day - i; //get count
> 
>   //loop through count and print blank day
>   for (int x=1; x<=blankDays; x++)
>   {
> %>
>    
> <%
>   }
> }
> %>
>   <%= i %>
> <%
> if (day == Calendar.SATURDAY)
> {
> %>
>   
>   
> <%
> }  
> 
> //blank days after last day of month?
> if (i == numDaysInMonth && day < 7)
> {
>   blankDays = 7 - day; //get count
> 
>   //loop through count and print blank day
>   for (int x=1; x<=blankDays; x++)
>   {
> %>
>    
> <%
>   }
> }
>   }
> %>
>   
> 
>   
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Trying-to-create-a-calendar---need-some-guidance-tp20138860p20138860.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


Re: Interfaces for component hierarchies (e.g. Buttons)?

2008-10-08 Thread John Krasnay
Hi Martin,

Programmatically generating the markup as you've done below is not
really "the Wicket way", which is probably why you're bumping up against
other Wicket design decisions. I've solved similar problems using a
RepeatingView as follows:

ButtonPanel.html



  



ButtonPanel.java

public class ButtonPanel extends Panel {
private RepeatingView buttons;
public ButtonPanel(String id) {
super(id);
buttons = new RepeatingView("button");
}
public void addButton(Button button) {
buttons.add(button);
}
public String newButtonId() {
return buttons.newChildId();
}
}

Then you can add whatever types of buttons you want:

ButtonPanel buttons = new ButtonPanel("buttons");
buttons.add(new Button(buttons.newButtonId()) { ... });
buttons.add(new AjaxButton(buttons.newButtonId()) { ... });

The CSS classes you add can be applied via AttributeAppender behaviors.

jk

On Wed, Oct 08, 2008 at 09:11:11AM +0200, Martin Dietze wrote:
> On Tue, October 07, 2008, Jeremy Thomerson wrote:
> 
> > Maybe supply some code as an example of what you're doing.  I really didn't
> > understand your scenario below.
> 
> See the code below. I use a button panel which allows me to setup form
> buttons in different ways within a page class hierarchy, i.e. an edit page 
> inherits from a create page but has a button more. Now I want to be able
> to add ajax buttons to the button panel.
> 
> public class MyButton extends Button {
> private final String buttonType;
> public static enum ButtonType {
> BUTTON("button"),
> SUBMIT("submit"),
> RESET("reset");
> private final String buttonType;
> private ButtonType(String buttonType) {
> this.buttonType = buttonType;
> }
> public String getButtonType() {
> return this.buttonType;
> }
> }
> public MyButton(String id, IModel model, ButtonType buttonType) {
> super(id, model);
> this.buttonType = buttonType.getButtonType();
> }
> public String getButtonType() {
> return this.buttonType;
> }
> }
> 
> public class ButtonPanel extends Panel implements 
> IMarkupResourceStreamProvider {
> private static final String CSS_CLASS = "buttonPanel";
> private final String cssClass;
> private List buttons;
> public ButtonPanel(String id, List buttons, String 
> cssClass) {
> super(id);
> this.buttons = buttons;
> this.cssClass = cssClass;
> if (buttons != null && buttons.size() > 0) {
> for (ButtonWithType b : buttons) {
> add(b);
> }
> }
> }
> @Override
> public IResourceStream getMarkupResourceStream(MarkupContainer container, 
> Class containerClass) {
> StringBuilder result = new StringBuilder();
> result.append("  \n");
> int i = 0;
> for (ButtonWithType b : this.buttons) {
> result.append(" button leftButton" : " button") + "\">\n");
> result.append("   result.append(" type=\"" + b.getButtonType() + "\" 
> class=\"" + this.cssClass + "\" />\n");
> result.append("\n");
> ++i;
> }
> result.append("  \n");
> return new StringResourceStream("\n"
> + result.toString();
> + "\n");
> 
> }
> }
> 
> 
> Martin
> 
> -- 
> --- / http://herbert.the-little-red-haired-girl.org / -
> =+= 
> Wer bist du, ungezaehltes Frauenzimmer? Du bist - bist du? - Die Leute sagen, 
> du waerest - lass sie sagen, sie wissen nicht, wie der Kirchturm steht. 
> 
> -
> 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: force page reload

2008-10-06 Thread John Krasnay
On Mon, Oct 06, 2008 at 07:36:03PM -0200, francisco treacy wrote:
> thanks for your help, serkan.
> 
> cool, this works. as a workaround nevertheless:
> 
> -i wouldn't want my app to check every single request the existence of
> a parameter which i am going to use in only *one* page anyway
> -what if i have this param passed to another page that doesn't expect
> it? this could easily introduce new bugs
> 
> isn't there another easy way to force reloading / not "caching" a
> page? why isn't setHeaders having any effect? should be
> straightforward - what am i missing here?
> 
> thanks again anyone for some pointers!
> 
> francisco
> 

It seems to me a bit strange to use markup variant for this. You could
have your callback page forward to the correct page like this:

public CallbackPage(PageParameters params) {
if (params.getString("DATA").equals("good)) {
setResponsePage(PaymentGoodPage.class);
} else {
setResponsePage(TryAgainPage.class);
}
}

Alternatively, you could instantiate an appropriate panel in your page:

public CallbackPage(PageParameters params) {
if (params.getString("DATA").equals("good)) {
add(new PaymentGoodPanel("responsePanel"));
} else {
add(new TryAgainPanel("responsePanel"));
}
}


jk

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



Re: which browser is preferrable for Wicket 1.3

2008-10-03 Thread John Krasnay
Hehe, welcome to Web development my friend!

IE6 is very old, and it contains a large number of rendering quirks that
are not present in "modern" browsers (FireFox, Safari, Opera). IE7 is
much better, but IE6 still commands a large segment of the browser
market.

I would suggest developing for a modern browser such as FireFox, then
testing on IE6 and IE7 and putting workarounds for the things they mess
up. There are entire web sites dedicated to documenting IE quirks and
their workarounds. http://positioniseverything.net is a good one.

Note that this is almost certainly *not* a Wicket issue, since Wicket
generates the same markup regardless of browsers. If you have questions
about specific rendering issues, you might want to ask on a site that
deals with browser rendering issues.

Hope this helps.

jk


On Fri, Oct 03, 2008 at 06:20:41AM -0700, newbie_to_wicket wrote:
> 
> Hi,
> I'm facing some issues with browser ( IE and Mozilla Firefox ) ..
> 
> In Internet Explorer everything is working fine but in Firefox some css
> issues ( components are not displaying in accurate position  ) are there. 
> 
> did any body come across this kind of problem earlier , if you have the
> solution please help me 
> 
> I want to work the pages correctly in both IE and Firefox, this is my
> project requirement.:confused:
> 
> thanks
> J
> 
> -- 
> View this message in context: 
> http://www.nabble.com/which-browser-is-preferrable-for-Wicket-1.3-tp19797602p19797602.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> 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: Hooking AJAX requests

2008-09-25 Thread John Krasnay
Perfect! Works like a charm.

Thanks much.

jk

On Thu, Sep 25, 2008 at 09:07:26PM +0200, Matej Knopp wrote:
> You can do it in javascript using
> Wicket.Ajax.registerPostCallHandler(yourhandler);
> 
> -Matej
> 
> On Thu, Sep 25, 2008 at 9:04 PM, John Krasnay <[EMAIL PROTECTED]> wrote:
> > Hi folks,
> >
> > I'm trying to integrate the Dean Edwards IE7.js script
> > (http://dean.edwards.name/IE7/) into my Wicket app. For those that don't
> > know, IE7.js helps IE6 implement certain CSS rules that it doesn't
> > support natively (min-height, :first-child, :hover, ...)
> >
> > I've created a behavior that renders the proper header text to load
> > IE7.js. I add this behavior to my base page class and everything works
> > will until I do an AJAX operation. Any of the updated components lose
> > their IE7.js specialness.
> >
> > Apparently, there's a script, ie7-recalc.js, that implements a recalc()
> > method I can call to clean up after AJAX updates. The problem is that
> > I'd like to have this script run after *any* AJAX update to my page
> > without tweaking the AjaxRequestTarget in each of my AJAX components.
> >
> > Is there a way that my behavior, applied at page level, can hook any
> > AJAX call and inject JavaScript to call that recalc() method?
> >
> > jk
> >
> > -
> > 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]



Hooking AJAX requests

2008-09-25 Thread John Krasnay
Hi folks,

I'm trying to integrate the Dean Edwards IE7.js script
(http://dean.edwards.name/IE7/) into my Wicket app. For those that don't
know, IE7.js helps IE6 implement certain CSS rules that it doesn't
support natively (min-height, :first-child, :hover, ...)

I've created a behavior that renders the proper header text to load
IE7.js. I add this behavior to my base page class and everything works
will until I do an AJAX operation. Any of the updated components lose
their IE7.js specialness.

Apparently, there's a script, ie7-recalc.js, that implements a recalc()
method I can call to clean up after AJAX updates. The problem is that
I'd like to have this script run after *any* AJAX update to my page
without tweaking the AjaxRequestTarget in each of my AJAX components.

Is there a way that my behavior, applied at page level, can hook any
AJAX call and inject JavaScript to call that recalc() method?

jk

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



Re: Add more than one component to an Item (repeaters)

2008-09-25 Thread John Krasnay
I keep a little library of these (LinkPanel, BookmarkablePageLinkPanel,
etc.) that are all just a link containing a label. It would be nice if
they were part of Wicket proper. Does anyone else think so?

jk

On Thu, Sep 25, 2008 at 12:10:17PM +0200, Nino Saturnino Martinez Vazquez Wael 
wrote:
> I did it once this way:
> 
> 
> AjaxLinkPanel.java
> 
> public abstract class AjaxLinkPanel extends Panel {
>public AjaxLinkPanel(String id, String title) {
>super(id);
>AjaxLink link = new AjaxLink("ajaxLink") {
>@Override
>public void onClick(AjaxRequestTarget target) {
>onClicked(target);
>}
>};
>link.add(new Label("title",title));
>add(link);
> 
>}
> 
>protected abstract void onClicked(AjaxRequestTarget target);
> 
> }
> 
> AjaxLinkPanel.html
> 
>   
> wicket:id="title">
> 
>
> 
> 
> 
> AjaxFallbackDefaultDataTable
> 
>columns
>.add(new AbstractColumn(new 
> StringResourceModel("action", null)) {
>public void populateItem(Item cellItem, String 
> componentId,
>IModel model) {
> 
> ...
>}
>};
>cellItem.add(link);
>}
>});
> 
> 
> 
> 
> Alexandre Lenoir wrote:
> >You can create your own component that involves many subcomponents and add
> >it to your datatable. Too simple?
> >
> >On Thu, Sep 25, 2008 at 11:28 AM, Nino Saturnino Martinez Vazquez Wael <
> >[EMAIL PROTECTED]> wrote:
> >
> >  
> >>Do it as a panel..?
> >>
> >>
> >>Edgar Merino wrote:
> >>
> >>
> >>>Hello,
> >>>
> >>>  I've got a DataTable that needs to add to each of its Items a Link and 
> >>>  a
> >>>Label, since I've only get one componentId from the populateItem(Item
> >>>cellItem, String componentId, IModel model) method, I don't know what to 
> >>>do
> >>>to be able to accomplish what I need.
> >>>
> >>>  This is what I need:
> >>>
> >>>public void populateItem(Item cellItem, String componentId, IModel model)
> >>>{
> >>>  Link link = new Link(componentId) {
> >>> public void onClick() {
> >>>//do Something
> >>> }
> >>>  }
> >>>  link.add(new Label("WHAT SHOULD I PUT HERE"), "label");
> >>>
> >>>  cellItem.add(link);
> >>>}
> >>>
> >>>  I hope someone can give me a hint on what to do, thank you in advance.
> >>>
> >>>Edgar Merino
> >>>
> >>>-
> >>>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]
> >>
> >>
> >>
> >
> >  
> 
> -- 
> -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]



Re: Discussion on "Wicket Interface Speed-Up"

2008-09-03 Thread John Krasnay
On Wed, Sep 03, 2008 at 04:34:34PM +0100, Al Maw wrote:
> 
> I'd even go so far as to remove the need for HeaderContributor code entirely
> in 80% of the cases.
> Wicket could automatically pick up css and js files that are named the same
> as your component.
>   MyComponent.java
>   MyComponent.html
>   MyComponent.properties
> So why not:
>   MyComponent.css
>   MyComponent.js
> ?
> 
> Heck, you could even include i18n for dealing with language-specific layout
> issues:
>   MyComponent_jp.css
> 
> Regards,
> 
> Al

+1. I even tried this once since it seemed like such an intuitive thing.

jk

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



Re: Transactions not working :/

2008-08-29 Thread John Krasnay
On Fri, Aug 29, 2008 at 09:26:19PM +0200, Markus wrote:
> 
> throw new Exception("xxx");
> 

>From the Spring doco:

Note however that the Spring Framework's transaction infrastructure code
will, by default, only mark a transaction for rollback in the case of
runtime, unchecked exceptions; that is, when the thrown exception is an
instance or subclass of RuntimeException.

IOW, try throwing RuntimeException instead.

jk

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



Re: AbstractDefaultAjaxBehavior.findIndicatorId()

2008-08-29 Thread John Krasnay
On Fri, Aug 29, 2008 at 09:38:20PM +0300, Timo Rantalaiho wrote:
> On Fri, 22 Aug 2008, John Krasnay wrote:
> > It's sometimes awkward to implement an AJAX indicator the standard way,
> > by implementing IAjaxIndicatorAware, since it forces me to use an
> > explicit class where I otherwise would have used an anonymous inner
> > class. I actually have this code in one of my classes:
> 
> There's still the kludge of making a named local inner class
> 
> Form myForm = new Form("foo", model);
> TextField myField = new TextField("bar");
> class BarsBehavior extends AjaxFormChoiceComponentUpdatingBehavior 
> implements IAjaxIndicatorAware {
> ...
> }
> myField.add(new BarsBehavior());
> ...

You can do that?! Wow, learn something new every day.

Thanks for the tip.

jk

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



  1   2   >