AutocompleteTextField and object (not just String)

2012-08-01 Thread Daniele Dellafiore
Hi.

I'm sure I'm talking about something that has already been discussed
here and on stackoverflow a lot, but still I haven't found a solution.

I do not understand how AutocompleteTextField works when dealing with
list of objects that are not just strings. Other wicket components
like DropDown has a clear pattern: the renderer is used only for
rendering purpose, there's a model to store selection and a model to
store choices options.

Still, I can't figure out how to do the very same thing with
AutocompleteTextField.

The best I can get is:
TextField codeField = new 
AutoCompleteTextFieldJSONObject(code,
model, JSONObject.class, renderer,
  new AutoCompleteSettings());


I'm using an AbstractAutoCompleteTextRenderer and a PropertyModel
binded to a JSONObject variable.
It all works but when I submit the form, it says me that the selected
string is not a valid JSONObject, so he cannot attach it to the field.

the ITerator returned by AutocompleteTextField.getChoices(String
input) is an Iterator of JSONObject.
I expect that when I submit, the setObject receives the selected
JSONObject, not the String I do render using a specific Renderer.

How can that be done?

Thanks anyone for help.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Visiting children and adding updatingBehavior

2011-12-14 Thread Daniele Dellafiore
Hi. I'm using this code

http://pastebin.com/xezKCjPS

to add a specific behavior to all the FormComponent that are contained in
the WebMarkupContainer container.
It seems to me that it does not really add to all the formComponent for two
reason: I never see the system out in the onUpdate method and also it seems
to me that not all the formComponent that I have are added as for the
second system out.

Maybe I am making the visit wrong...

-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: I18N for bookmarkable urls

2011-10-11 Thread Daniele Dellafiore
 schrieb:
  Hi,
 
  as we need some SEO optimization I want to provide the following
  bookmarkable pages:
 
  http://xxx/impressum
  http://xxx/imprint
 
  the native approach would be somethink like:
 
  mountBookmarkablePage(imprint, ImprintPage.class);
 
  mountBookmarkablePage(impressum, ImprintPage.class);
 
  This looks ugly but works.
  Now I don't know how to create a bookmarkable links having an url in
  the expected language.
 
  if( getLocale().equals(Locale.GERMAN)) {
    //create http://xxx/impressum
  } else {
    // http://xxx/imprint
  }
 
  Obviously the following code does not help:
    add(new BookmarkablePageLink(link, ImprintPage.class));
 
  Does anyone have a good idea?
 
  Best regards,
      Ilja Pavkovic
 
  -
  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


 --
 binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

 Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
 Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

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





-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Re: I18N for bookmarkable urls

2011-10-11 Thread Daniele Dellafiore
Ah, I also tried to llok at MountedMapper that has a protected
newPageParameters() trying to add there a new parameter with locale
but that didn't worked, I couldn't see any moment when the method is
actually called while the application is running

On Tue, Oct 11, 2011 at 11:34 AM, Daniele Dellafiore
dani...@dellafiore.net wrote:
 Yes the solution could work but is no more applicable to Wicket 1.5
 since it now uses Mapper instead of old fashioned Url Coding
 Strategies.

 I've tried to hack around but I've found no point where to add a
 default parameter to all the web pages that's the Locale.
 Also, the BookmarkableLink, for example, should address this issue. If
 al pages are mounted like

 ${language}/products/${category}

 I need the link to take care of this. The whole purpose is for SEO
 reason, we need google to crawl correctly all the website in all of
 the languages. So I've to add language as parameter in all links.
 Of course I can just extend and have my I18NBookmarcableLink. I am
 wondering about a nicer solution. Any ideas?

 On Mon, Oct 26, 2009 at 9:08 PM, Ilja Pavkovic
 ilja.pavko...@binaere-bauten.de wrote:
 Hi,

 a better solution (in my eyes.. :)) is something like:

 import java.util.Locale;

 import org.apache.wicket.IRequestTarget;
 import org.apache.wicket.Page;
 import org.apache.wicket.Session;
 import
 org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy;

 public class I18NBookmarkablePageRequestTargetUrlCodingStrategy extends
 BookmarkablePageRequestTargetUrlCodingStrategy {

        private Locale locale;

        public C extends Page
 I18NBookmarkablePageRequestTargetUrlCodingStrategy(Locale locale, String
 mountPath,
                        ClassC bookmarkablePageClass) {
                this(locale, mountPath, bookmarkablePageClass, null);
        }

        private C extends Page
 I18NBookmarkablePageRequestTargetUrlCodingStrategy(Locale locale, String
 mountPath,
                        ClassC bookmarkablePageClass, String pageMapName) {
                super(mountPath, bookmarkablePageClass, pageMapName);
                this.locale = locale;
        }

        //public IRequestTarget decode(RequestParameters requestParameters)
        public boolean matches(IRequestTarget requestTarget) {
                boolean matches = super.matches(requestTarget);
                if(matches) {
                        matches = locale == null ||
                                                
 locale.equals(Session.get().getLocale()) ||
 // also match en and en_US
                                                
 locale.getLanguage().equals(Session.get().getLocale().getLanguage());
                }
                return matches;
        }
 }

 you can use it with:

                mount(new
 I18NBookmarkablePageRequestTargetUrlCodingStrategy(Locale.GERMAN,startseite,getHomePage()));
                mount(new
 I18NBookmarkablePageRequestTargetUrlCodingStrategy(Locale.ENGLISH,homepage,getHomePage()));


 Be warned: this is only a hack that may break at your site :))

 Am Montag, 26. Oktober 2009 15:25:49 schrieb Bernhard Grünewaldt:
 Hello,

 After thinking a bit I came up with a solution (which many of you might
 call dirty workaround). But since no one else came up with a solution
 I will stick to it until something better will be provided.

 The solution can be found here:

 http://blog.gruenewaldt.net/en/programming/java/apache-wicket-1_4-mounting-
 urls-for-a-multilanguage-setup-i18n-seo/

 Perhaps someone might find that useful.

 Bernhard

 Bernhard Grünewaldt schrieb:
  Hi folks,
 
  Since my app will be english and german aswell, that is something I need
  too. I tried to mount and unmount my pages
  when the locale changes from german to english or vice versa.
  I tried using ResourceModel Strings for the urls, but it's not working
  the way I want it to be. And it would be a massive amount of code for
  something that seems to be so simple.
 
  The problem is, that I want both urls to be accessed via the url like in
  the example:
    http://xxx/impressum
  and
    http://xxx/imprint
  should be accessible not depending on a specific locale setting.
  (Perhaps the locale should change to english or german depending on the
  url when accessed via a browser bookmark with no session)
 
  The problem is, that you can mount a class multiple times, but for
  creating the BookmarkablePageLinks the first one mounted will be used
  for the link. (tested with wicket 1.4.3).
 
  Wouldn't it be cool to have such a mechanism which uses the Locale
  setting to generate links and mount pages.
 
  For example (Just pseudo code):
 
  .mount(
    new HybridUrlCodingStrategy(
      impressum, ImprintPage.class, Locale.GERMAN)
  );
  .mount(
    new HybridUrlCodingStrategy(
      imprint, ImprintPage.class, Locale.ENGLISH)
  );
 
  And when you then generate a url you could use:
 
  add(new BookmarkablePageLinkVoid(
     bookmarked

SelectOption and DropDownChoice

2011-10-10 Thread Daniele Dellafiore
Hi.

I need to add an attribute to an option inside a dropdown. I'd
rather have a DropDownChoice and the ability to add an
AttributeModifier to every option but I can't find a way to acccess
the single options of the drop down.

Instead I've read about solutions that involve SelectOption but I
can't get how SelectOptions and DropDownChoice are related, it seems
in no way. I do not clearly understand SelectOption.
I'd rather keep using a DropDownChoice which have a clear interface to
add options (just pass a list of elements in the constructor) and in
the selection model, which I do not find at all in the SelectOptions.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Mounting external pages to root

2011-10-10 Thread Daniele Dellafiore
Hi.
I have now mounted some internal pages and then all the external are
mounted like:

getRootRequestMapperAsCompound().add(new MountedMapper(cms/${page},
ExternalPage.class) );

What I'd like is that ALL the URL that are not mounted with an
explicit mapper are automatically redirected to ExternalPage.class,
also keeping the ${page} parameter that I use internally in that page.

There's a nice way to do that?

Thanks.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Re: ContextImage and external URL

2011-06-08 Thread Daniele Dellafiore
Do you think that can be good also if I want to let the browser cache some
images? I serve  thumbnails that I do not want to be server every time.

On Tue, Jun 7, 2011 at 11:52 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 use Image with DynamicImageResource which loads the image with
 urlConnection

 On Tue, Jun 7, 2011 at 11:46 PM, Daniele Dellafiore ilde...@gmail.com
 wrote:
  Hi.
 
  I take some user uploaded images from an external service that answer
  at, say, localhost:8181/images
  My wicket app run on localhost:9191/app
  I want to load the images from the first service, and I'd like to use
  a ContextImage that is easy to use:
 
   new ContextImage(picture, images/ + code);
 
  This of course does not work cause the base of the ContextImage points to
 9191.
 
  I could use something else but I like ContextImage, One idea is to
  have something like a filter set up in web.xml that redirect each call
  to /images to a custom url like localhost:8181/images.
 
  What do you think? Also, I really do not have a clear idea on how to
  do that in a nice way, any tip?
 
  --
  Daniele Dellafiore
  http://danieledellafiore.net
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



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

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




-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-27 Thread Daniele Dellafiore
On Tue, Apr 26, 2011 at 9:12 PM, Daan van Etten d...@stuq.nl wrote:

 Op 26 apr 2011, om 16:41 heeft Martin Grigorov het volgende geschreven:


 Not doing anything now because it can break in the future is not a really
 good argument..?
 Anything can break, that's why there are unit tests, release candidates,
 etcetera.
 With some small design improvements (no split packages, 'better' jar(s))
 and a better manifest the 'Wicket OSGI support' will surpass many other
 frameworks or libraries.


This is also my main point to conversation. We're talking about being
somewhere really close to a nice out of the box OSGi support. Why not take a
little effort to make it complete? Also, having packages that span through
different jars is not really good to me, OSGi or not.

Anyway,

Daan, I'm really interested in the classloading problem you had. Actually I
did succeed in making a wicket-spring webapp start and work 100%.
But after the wicket package is reinstalled or just refreshed in the
container, @SpringBean injection stop working with:

java.lang.IllegalArgumentException: Can not set
org.fenotipi.services.StudiService field
org.fenotipi.web.general.HomePage.studiService to
org.apache.wicket.proxy.$Proxy40

Any idea?


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-27 Thread Daniele Dellafiore
On Tue, Apr 26, 2011 at 11:48 PM, Eike Kettner n...@eknet.org wrote:

 Hi Daniele,

 
  This is not as bad as having to package the uber-jar with the war, sure.
  Better than keeping a separate wicket codebase, at least :)
 
  Anyway it's still a custom solution that I, and all wicket developers,
 have
  to do. More over, they have to discover that this has to be done, that
  wicket bundles are working bundles, but not usable.
  Wicket bundles are some sort of raw jars+metadata that can be assemled in
 a
  custom way to become a usable OSGI bundle. Whatever you consider the
  uber-jar solution to go good or not, this is a flaw.

 I totally agree with you. Wicket is such a great web framework and
 people who like to use it with osgi shouldn't have a hard time to get
 both workgin together. The fact that the three wicket modules have osgi
 related meta data but don't work as osgi bundles is really confusing. So
 a distributed uber-jar would be a quick fix for that. People can easily
 deploy wicket to an osgi container.f a day in thread like this to finally
 arrive to the wicket-stuff projects that solves your problem.


Yeah but you know how things really works. You download/maven/something-else
the wicket jars. They do not work in osgi.
Then you start google around, it will take you hours, reading conversation
like this one, before eventually landing to the wicket-stuff page where
there is the solution. If that's the case.

You will be not happy. Of course I can accept the wicket is not intended to
be OSGi compliant explanation and go for the uber-jar in wicket-stuff.
Maybe I want to ask: why wicket can't be OSGi compliant? I consider OSGi to
be an important reference platform nowadays. Let's fill a jira issue and see
what happen.




  I agree that you have to use -util -request  and -core to make wicket
 work,
  but so, if they are so coupled, why to make different bundles at all?
  Alexandros already asked for this.You say modularization helps wicket
  developer.I would agree but what is the difference between the .request
 and
  .util package in -request, -util and in -core?
 
  As Martin pointed out, there are no more implementation of wicket, to
 date.
  So the -core is not a specific implementation of -request and -util.
 Maybe
  just more concret classes?
 
  Again I think that the package that span across different modules is a
  flawed design. For sure it is not OSGi-compliant.

 Again I agree with you. The uber jar is good to get wicket quickly
 running with osgi, but it is more a workaround.  I'm not deep in wicket
 code, but it feels awkward to first package classes in one package and
 than split this package across modules (which is even harder grained).


To me seems like that the split of .util and .request package into separate
bundles is just not complete. This is totally understandable.
I'm not seeing the point of splitting those two packages that, indeed, are
always necessary to run a wicket app, but sure I do not have enough insight
view of the project.
Despite that, it took ten minutes straight to me to renamce -core packages
into .wicket.util and .wicket.request and fix the confusion.
Indeed, mvn test now fails in -core, I did not take any care of those in my
tentative.


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-27 Thread Daniele Dellafiore
On Wed, Apr 27, 2011 at 8:57 AM, Martin Grigorov mgrigo...@apache.orgwrote:


 I'm not against improving the current state. I'm saying that it want
 last long without your help.
 I said several times that the community can create the uber-jar
 project in wicketstuff but so far no one wanted to do it.
 I can do it for you but I wont test it in a real OSGi container. I'm
 just not interested in this.
 But we can apply your patches if they are reasonable.


Let's try. As I told, the first move is to rename into .core.util and
.core.request the packages in -core bundle. This is reasonable? If it is
not, well, I'll go for a issue for 1.6 and move totally on the uber-jar
solution. If it is reasonable, we can proceed.


 About testing - I don't see how unit tests will help to keep it
 working in the future. Any ideas/patches on this matter are welcome!


Eh, this  can totally be done with pax-runner, as integration tests, but
I've not enough experience with this so far.



 My concerns are that we had similar issue with Portlets support. When
 we ran the vote whether to remove the support for Wicket 1.5 few
 people (~ 5) asked to move the related code in wicketstuff so the
 community can support it. Half an year later no one touched it so far.


This is totally reasonable. Let's see which way we can take here.

Regards.


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-26 Thread Daniele Dellafiore
On Tue, Apr 26, 2011 at 11:48 AM, Eike Kettner e...@eknet.org wrote:

 the uber-jar is only concerning wicket, not any war bundle. while it
 would be of course nicer to have all wicket jars as separate bundles
 available out of the box. but one solution I find quite ok is creating
 one bundle out of core, request and util. this will then be a uber-jar
 that brings wicket into the osgi mix. It's just containing the core
 packages of wicket.

 I think the different jars help the wicket developers to cleaner
 dependencies (when creating a class the dependencies make you think
 about where to put it, so you don't create a RequestClass in the core
 package/module, for example) -- please correct me if this is wrong.

 But from the client or user point of view, the jars wicket-core,util and
 request are all kind of core modules. You'll need them all (I think) to
 use wicket. this makes it in my opinion ok to use the one big wicket
 jar. all others (auth-roles etc) are still separate bundles.

 regards
 Eike


This is not as bad as having to package the uber-jar with the war, sure.
Better than keeping a separate wicket codebase, at least :)

Anyway it's still a custom solution that I, and all wicket developers, have
to do. More over, they have to discover that this has to be done, that
wicket bundles are working bundles, but not usable.
Wicket bundles are some sort of raw jars+metadata that can be assemled in a
custom way to become a usable OSGI bundle. Whatever you consider the
uber-jar solution to go good or not, this is a flaw.

I agree that you have to use -util -request  and -core to make wicket work,
but so, if they are so coupled, why to make different bundles at all?
Alexandros already asked for this.You say modularization helps wicket
developer.I would agree but what is the difference between the .request and
.util package in -request, -util and in -core?

As Martin pointed out, there are no more implementation of wicket, to date.
So the -core is not a specific implementation of -request and -util. Maybe
just more concret classes?

Again I think that the package that span across different modules is a
flawed design. For sure it is not OSGi-compliant.

I do not want to bother more, anyway. I'll go for the uber-jar with wicket
1.5. I'll open an issue to fix this flaw so maybe wicket 1.6 will work out
of the box in OSGi.


[osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
Hi.

Whe I try to start my wicket webapp from Karaf, I receive a
NoClassFoundException agains Request.
The problem is that my app imports the package org.apache.wicket.request
from wicke.core bundle that have the package, but not the class.
The fact that the same package is exported from two bundles really does not
fit well in OSGI.

Any possible solution?


-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
I've solved this removing
org.apache.wicket.request

from Export-Package in wicket.core bundle jars.
This works only because I'm not using request.ClientInfo class.
Probablhy during runtime there will be other problems.

From the OSGI perspective, having duplicate packages exported by different
bundles is wrong. Should I fill a issue for this?

On Mon, Apr 25, 2011 at 1:01 PM, Daniele Dellafiore ilde...@gmail.comwrote:

 Hi.

 Whe I try to start my wicket webapp from Karaf, I receive a
 NoClassFoundException agains Request.
 The problem is that my app imports the package org.apache.wicket.request
 from wicke.core bundle that have the package, but not the class.
 The fact that the same package is exported from two bundles really does not
 fit well in OSGI.

 Any possible solution?


 --
 Daniele Dellafiore
 http://danieledellafiore.net




-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
Again, org.apache.wicket.IClusterable is in the -util bundle but the webapp
looks for it in the -core bundle.
There's not workaroiund for this.

I think that the wicket package layout should be changed now that -util and
-request bundles have been detached from -core.

On Mon, Apr 25, 2011 at 2:51 PM, Daniele Dellafiore ilde...@gmail.comwrote:

 I've solved this removing
 org.apache.wicket.request

 from Export-Package in wicket.core bundle jars.
 This works only because I'm not using request.ClientInfo class.
 Probablhy during runtime there will be other problems.

 From the OSGI perspective, having duplicate packages exported by different
 bundles is wrong. Should I fill a issue for this?


 On Mon, Apr 25, 2011 at 1:01 PM, Daniele Dellafiore ilde...@gmail.comwrote:

 Hi.

 Whe I try to start my wicket webapp from Karaf, I receive a
 NoClassFoundException agains Request.
 The problem is that my app imports the package org.apache.wicket.request
 from wicke.core bundle that have the package, but not the class.
 The fact that the same package is exported from two bundles really does
 not fit well in OSGI.

 Any possible solution?


 --
 Daniele Dellafiore
 http://danieledellafiore.net




 --
 Daniele Dellafiore
 http://danieledellafiore.net




-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
it is not.

I'm hacking on the trunk to make that work.
Maybe a quick solution is just change org.apache.wicket to
org.apache.wicket.core in the -core bundle.

Of course there are some default scope classes that works through different
packages but I can just make them public for now.

On Mon, Apr 25, 2011 at 3:18 PM, James Carman ja...@carmanconsulting.comwrote:

 On Mon, Apr 25, 2011 at 10:15 AM, Daniele Dellafiore ilde...@gmail.com
 wrote:
 
  I think that the wicket package layout should be changed now that -util
 and
  -request bundles have been detached from -core.
 

 From an OSGi perspective, we should probably try to make sure that
 packages don't span jar files.  Everything in
 org.apache,wicket.request should be in wicket-request.jar, for
 example.  I don't know if that's the case, currently or not.

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




Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
I did it. Yes, the tough way but I did it.
Now the 1.5RC3 quickstart app just started on my karaf 2.2 with the
1.5-SNAPSHOT I built.

Basically I renamed the .util and .request packages in -core bundle to be
.core.util and .core.request.
I had to make a class public in another package under -request bundle to
make it visible, but it's a minor thing.

I open a bug on jira now... wow, is down :) well, as soon as it get back
online.

On Mon, Apr 25, 2011 at 4:03 PM, Daniele Dellafiore
dani...@dellafiore.netwrote:

 it is not.

 I'm hacking on the trunk to make that work.
 Maybe a quick solution is just change org.apache.wicket to
 org.apache.wicket.core in the -core bundle.

 Of course there are some default scope classes that works through different
 packages but I can just make them public for now.

 On Mon, Apr 25, 2011 at 3:18 PM, James Carman 
 ja...@carmanconsulting.comwrote:

 On Mon, Apr 25, 2011 at 10:15 AM, Daniele Dellafiore ilde...@gmail.com
 wrote:
 
  I think that the wicket package layout should be changed now that -util
 and
  -request bundles have been detached from -core.
 

 From an OSGi perspective, we should probably try to make sure that
 packages don't span jar files.  Everything in
 org.apache,wicket.request should be in wicket-request.jar, for
 example.  I don't know if that's the case, currently or not.

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





Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
Are you referring to this conversation?
http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-rc2-and-aggregate-jar-for-osgi-td3356667.html

If so, I read it and answered that I'm not interested in any solution that
involves the uber-jar. I do not see any advantage in that solution over a
normal war.

I do not find any other advice from you and Eike, maybe you can point me out
the right conversation.


On Mon, Apr 25, 2011 at 6:25 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi Daniele,

 Me and later Eike explained to you in the other thread you started few
 months ago how to solve exactly this problem.
 It seems you didn't read it at all. Please read again the part
 mentioning Wicket 1.5 RC1.

 On Mon, Apr 25, 2011 at 6:30 PM, Daniele Dellafiore
 dani...@dellafiore.net wrote:
  I did it. Yes, the tough way but I did it.
  Now the 1.5RC3 quickstart app just started on my karaf 2.2 with the
  1.5-SNAPSHOT I built.
 
  Basically I renamed the .util and .request packages in -core bundle to be
  .core.util and .core.request.
  I had to make a class public in another package under -request bundle to
  make it visible, but it's a minor thing.
 
  I open a bug on jira now... wow, is down :) well, as soon as it get back
  online.
 
  On Mon, Apr 25, 2011 at 4:03 PM, Daniele Dellafiore
  dani...@dellafiore.netwrote:
 
  it is not.
 
  I'm hacking on the trunk to make that work.
  Maybe a quick solution is just change org.apache.wicket to
  org.apache.wicket.core in the -core bundle.
 
  Of course there are some default scope classes that works through
 different
  packages but I can just make them public for now.
 
  On Mon, Apr 25, 2011 at 3:18 PM, James Carman 
 ja...@carmanconsulting.comwrote:
 
  On Mon, Apr 25, 2011 at 10:15 AM, Daniele Dellafiore 
 ilde...@gmail.com
  wrote:
  
   I think that the wicket package layout should be changed now that
 -util
  and
   -request bundles have been detached from -core.
  
 
  From an OSGi perspective, we should probably try to make sure that
  packages don't span jar files.  Everything in
  org.apache,wicket.request should be in wicket-request.jar, for
  example.  I don't know if that's the case, currently or not.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 



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

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




Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
On Mon, Apr 25, 2011 at 7:20 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 It is the same conversation.
 You need uber-jar. At least one that combines -util, -request and
 -core. Everything else is optional, depending on your app needs.


Ok. As you see I read and answered to that.



 Can you describe what is the problem to use the uber-jar? Or what are
 the benefits to deploy these three jars separately in the OSGi
 container ?


That is basically a war. One of the advantage of OSGI is having separate
bundles for every module, to start, stop, refresh etc.
If I start packaging things in wars/jars, I lose the control of what is
being used. Will be the bundle or the embedded jar? It's a JEE hell, so why
not use a JEE? I want a clean, pure, osgi environment. The other way, I stay
on JEE.

Another advantage of deployng my bundle without any other jars is that my
bundle is 60Kb, the uber-jar more than 1MB, maybe 2. And following this
policy, will grow everytime there's a non-compliant library to deal with.

In the ed, it's more OSGI-like and does not affect at all the rest of the
framework. The only effort is to rename a package, in a major release. It
took almost 10 minutes to do that to me. If problem is retro-compatibility
well... it's a major release, it's a good time, isn't it?




 On Mon, Apr 25, 2011 at 9:08 PM, Daniele Dellafiore
 dani...@dellafiore.net wrote:
  Are you referring to this conversation?
 
 http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-rc2-and-aggregate-jar-for-osgi-td3356667.html
 
  If so, I read it and answered that I'm not interested in any solution
 that
  involves the uber-jar. I do not see any advantage in that solution over a
  normal war.
 
  I do not find any other advice from you and Eike, maybe you can point me
 out
  the right conversation.
 
 
  On Mon, Apr 25, 2011 at 6:25 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
  Hi Daniele,
 
  Me and later Eike explained to you in the other thread you started few
  months ago how to solve exactly this problem.
  It seems you didn't read it at all. Please read again the part
  mentioning Wicket 1.5 RC1.
 
  On Mon, Apr 25, 2011 at 6:30 PM, Daniele Dellafiore
  dani...@dellafiore.net wrote:
   I did it. Yes, the tough way but I did it.
   Now the 1.5RC3 quickstart app just started on my karaf 2.2 with the
   1.5-SNAPSHOT I built.
  
   Basically I renamed the .util and .request packages in -core bundle to
 be
   .core.util and .core.request.
   I had to make a class public in another package under -request bundle
 to
   make it visible, but it's a minor thing.
  
   I open a bug on jira now... wow, is down :) well, as soon as it get
 back
   online.
  
   On Mon, Apr 25, 2011 at 4:03 PM, Daniele Dellafiore
   dani...@dellafiore.netwrote:
  
   it is not.
  
   I'm hacking on the trunk to make that work.
   Maybe a quick solution is just change org.apache.wicket to
   org.apache.wicket.core in the -core bundle.
  
   Of course there are some default scope classes that works through
  different
   packages but I can just make them public for now.
  
   On Mon, Apr 25, 2011 at 3:18 PM, James Carman 
  ja...@carmanconsulting.comwrote:
  
   On Mon, Apr 25, 2011 at 10:15 AM, Daniele Dellafiore 
  ilde...@gmail.com
   wrote:
   
I think that the wicket package layout should be changed now that
  -util
   and
-request bundles have been detached from -core.
   
  
   From an OSGi perspective, we should probably try to make sure that
   packages don't span jar files.  Everything in
   org.apache,wicket.request should be in wicket-request.jar, for
   example.  I don't know if that's the case, currently or not.
  
  
 -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
  
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 



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

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




Re: [osgi] package org.apache.wicket.request exported either from core and request packages

2011-04-25 Thread Daniele Dellafiore
On Mon, Apr 25, 2011 at 8:00 PM, Martin Grigorov mgrigo...@apache.orgwrote:


 On Mon, Apr 25, 2011 at 9:29 PM, Daniele Dellafiore
 dani...@dellafiore.net wrote:

 The idea of OSGi is to have interface and replaceable implementations.
 You can use this to replace Hibernate with EclipseLink as JPA
 implementation, or one JMS implementation with another.
 Can you do that with Wicket ? I don't think so. There is no
 specification, no interfaces. There is just one implementation (well,
 there is also Richard Emberson's work on Scala translation, but I
 wouldn't recommend you to add another new technology in your mix).

 For me you are wasting your time by trying to do it as the OSGi
 specification says.


I'm not using OSGi for that, but for the ability to deploy small packages,
being there libraries, webapp or just some small portion of integration
code, a JMS consumer... small packages, installed quickly, that does not
make any sense in a JEE container.
Also, Karaf offer a nice console and a web console also that I find superior
to any tomcat/jetty out there.

There are many reason for me to switch to OSGi as my default target
environment. And none of this is related to switch implementations.



 
  Another advantage of deployng my bundle without any other jars is that my
  bundle is 60Kb, the uber-jar more than 1MB, maybe 2. And following this
  policy, will grow everytime there's a non-compliant library to deal with.
 
 You need to add all Wicket classes from -util, -request and -core
 anyway. No matter whether you'll deploy the jars one by one or
 all-in-one (uber-jar) the final result will be the same - maybe 2MB.


It's not like this.
It's: one time and only one I install wicket (2MB)
All my app deployments (that in development can a log every day) I deploy a
few KB and reload a single jar in less then a second.
That's the main goal I'm achieving with all this webapp over OSGI thing.



  In the ed, it's more OSGI-like and does not affect at all the rest of the
  framework. The only effort is to rename a package, in a major release. It
  took almost 10 minutes to do that to me. If problem is
 retro-compatibility
  well... it's a major release, it's a good time, isn't it?
 
 It is not a problem to do this in 1.5. We already did it for
 wicket-auth-roles.
 The problem is similar to the one we have with Portlets support - very
 few users and no one of the dev team actually uses this technology.
 So we may apply your findings now but we can quite easy break it few
 days/weeks later by introducing another similar problem without
 noticing it.


I'm  sorry I do not understand what you mean here. You mean that fixing this
issue cannot be a definitive solution?


 My personal opinion is that all this doesn't bring enough value. Using
 the uber-jar solution is much simpler.


It's simpler releasing a package that force the developer to a specific
solution that's not made the osgi way that they have to find out over and
over again rather than renaming a package one time and for all in the distro
and make it work out of the box for everyone?

The uber-jar solution is not documentet anywhere. Even if documented, is
more work that a developer with an OSGi target environment has to do and
more than that, to discover. He will ask: why can I use, to say, spring and
restlet just installing their bundle to Karaf but this does not apply with
Wicket? Cause the wicket bundle are not really osgi compliant. Why? No
reason.

With my solution, wicket webapp over OSGI will work out-of-the-box. And can
be made in a few minutes, as I did.
And there is the advantage to deploy few Kb over 2MB every time.
And there is the advantage of having something that is standard. I do not
mean OSGi compliant, I mean standard in a more pragmatic way: all over
OSGi I use external bundles, with wicket no, different solution, uber-jar.
Why? No reason.


Re: Fwd: wicket 1.5-rc2 and aggregate jar for osgi

2011-04-22 Thread Daniele Dellafiore
Hi, sorry I read your reply only today...
I got basically to the same results yesterday, but I've some problem which I
summarized in the last message in this thread on felix mailing list:

http://old.nabble.com/A-better-life%3A-quick-webapp-deploy-to31334158.html

I'll go into details point by point.

On Fri, Apr 8, 2011 at 3:29 PM, Eike Kettner n...@eknet.org wrote:

 Hi Daniele,

 I might have not understood your concern well enough... But here is what I
 do: I deploy a really small war file (without any deps of course) into the
 osgi container (I use felix...). There is another bundle from pax,
 called pax-web-extender, that listens for war files coming into the
 container and will then register them on the embedded jetty instance.

 I use the following pax bundles:
 * org.ops4j.pax.web.pax-web-extender-war
 * org.ops4j.pax.web.pax-web-jetty-bundle
 * org.ops4j.pax.web.pax-web-jsp   (might be superfluous)


yeah I've everything installed. I do not remember what osgi features
installed this but there is:

[  54] [Active ] [] [   ] [   60] OPS4J Pax Web -
Runtime (1.0.1)
[  55] [Active ] [] [   ] [   60] OPS4J Pax Web - API
(1.0.1)
[  56] [Active ] [] [   ] [   60] OPS4J Pax Web - Jetty
(1.0.1)
[  57] [Active ] [] [   ] [   60] OPS4J Pax Web -
Service SPI (1.0.1)
[  59] [Active ] [] [   ] [   60] OPS4J Pax Web -
Extender - Whiteboard (1.0.1)
[  60] [Active ] [] [   ] [   60] OPS4J Pax Web -
FileInstall Deployer (1.0.1)
[  61] [Active ] [] [   ] [   60] OPS4J Pax Url - war:,
war-i: (1.2.5)
[  62] [Active ] [] [   ] [   60] OPS4J Pax Web -
Extender - WAR (1.0.1)
[  63] [Active ] [] [   ] [   60] OPS4J Pax Web - Jsp
Support (1.0.1)

on Karaf 2.2.0



 Then I use the felix-bundle plugin to create a MANIFEST.MF for my war
 file. It looks like that:

plugins
  plugin
groupIdorg.apache.felix/groupId
artifactIdmaven-bundle-plugin/artifactId
executions
  execution
idbundle-manifest/id
phaseprocess-classes/phase
goals
  goalmanifest/goal
/goals
  /execution
/executions
configuration
  supportedProjectTypes
supportedProjectTypejar/supportedProjectType
supportedProjectTypewar/supportedProjectType
supportedProjectTypebundle/supportedProjectType
  /supportedProjectTypes
  instructions
_include-osgi.bnd/_include
  /instructions
/configuration
  /plugin
  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-war-plugin/artifactId
configuration
  archive
manifestFile
  ${project.build.outputDirectory}/META-INF/MANIFEST.MF
/manifestFile
  /archive
/configuration
  /plugin
/plugins



it's almost the same as mine, also the war-plugin config is identical.
I do not have

   _include-osgi.bnd/_include

but I have this instructions

  _wabsrc/main/webapp/_wab
Web-ContextPath/myApp/Web-ContextPath

There are some more instructions in the osgi.bnd file. You could have
 written them directly in the instructions section of the bundle plugin:

  Bundle-Classpath: ., WEB-INF/classes
  Web-ContextPath: mywebapp
  DynamicImport-Package: *
  Webapp-Context: mywebapp


It seems that maven-bundle-plugin, at least 2.3.4 version, automatically
add  Bundle-Classpath: WEB-INF/classes if the project is a WAR or have a
Webapp-Context (that make the bundle a WAB, as for OSGI in Action), in fact
I do not have that intructions and the war project  Bundle-Classpath:
WEB-INF/classes in the MANIFEST (note, without the dot).
I think also that Webapp-Context has been deprecated in favor of the new
Web-ContextPath you also have.

As for DynamicImport-Package: *
what does this do?

It does not seem you do not have specific Import or Export package
instructions, so you use the maven-bundle-plugin defaults, so every dep is
explicitly written in the MANIFEST right?



 This creates a MANIFEST with Import-Package statements for all your
 dependencies - they are not included in the war file. The war file has
 no /lib folder, just WEB-INF/classes and META-INF/ are there. The bundle
 classpath is extended to include the classes in WEB-INF/classes. I
 use the scope provided for all dependencies.


where do you specify the provided scope? In all the maven deps explicitly?
There is not a way to tell just maven-bundle-plugin to consider everything
as provided just when building the bundle? I think that this is the reason
why you do not have jars in the lib folder, right?



 When the war file is deployed to the osgi container, the pax bundles
 from above will make it available to jetty.


In fact, it seems that if I just manually remove the jars 

Re: Fwd: wicket 1.5-rc2 and aggregate jar for osgi

2011-04-06 Thread Daniele Dellafiore
I'd really like to start my wicket app in a osgi (karaf) container.
My app uses also wicket-spring. What is the best way to do that now, with
wichet 1.5 rc3?

Thanls.

On Wed, Mar 16, 2011 at 2:25 PM, Michael O'Cleirigh 
michael.ocleir...@rivulet.ca wrote:

 Hello,

 The way releases have been working is that I take the current HEAD and then
 change the wicket.version to the current stable and the pom version to the
 next release.

 If you can commit your changes onto the master branch (wicket 1.5-SNAPSHOT)
 then I can create a new 1.5-rc2.1 point release to get the wicket-osgi
 module out into maven central. Just let me know when it works (i.e. mvn
 install works without error)

 You can either fork the repository on github and then do the change and
 file a ticket with a pull request or send a message to the dev list with
 your github username for push/pull access to the wicketstuff repository
 directly.

 Look at the 'Developer Information' section on the wiki here:
 https://github.com/wicketstuff/core/wiki for more details.

 Regards,

 Mike


  ok, I can take the pom from rc1 and adopt it for rc2 - shouldn't be
 problem since you did the work already. If it works and I find some time
 I'll try with github

 thanks and regards,
 eike

 On [Tue, 15.03.2011 22:10], Martin Grigorov wrote:

 Well, wicketstuff is hosted at GitHub and any user can contribute.
 If you have some time and willing to share your work with the community
 you
 can do it yourself.
 Otherwise just create a ticket in wicketstuff's issue tracking system and
 someone of us will do it when we have some time.

 Thanks for testing the RCs ! ;-)

 On Tue, Mar 15, 2011 at 9:21 PM, Eike Kettnern...@eknet.org  wrote:

  Hi Martin,

 thanks for your response and no need to apologize! It's good to have rcX
 candidate releases to play with so issues can be found.

 For me a wicket-osgi dependency would be great! And I really don't care
 about where to download :) I don't think that providing it from
 wicketstuff
 would bother users...

 If you decide to not support osgi out-of-the-box, it's still no problem
 to create an aggregate jar myself. I'd think most osgi users have to do
 this (unfortunately) quite often to add other  no-bundle-jars. But
 with a distributed jar, it's of course a lot easier - I would appreciate
 it (as probably other osgi users would).

 regards,
 Eike

 On [Tue, 15.03.2011 20:43], Martin Grigorov wrote:

 Hi Eike,

 Sorry that we broke OSGi support again.
 The problem was that many users wanted -sources and -javadoc for the
 aggregate .jar and it became a bit complex and confusing.

 I think we can add wicket-osgi project in wicketstuff/core repository

 that

 will do the same we did initially in WICKET-3088 and then you will use
 org.wicketstuff:wicket-osgi dependency instead. We release wicketstuff

 core

 projects few days after Wicket releases.

 Other opinions/suggestions ?

 martin-g

 On Tue, Mar 15, 2011 at 3:05 PM, Eike Kettnern...@eknet.org  wrote:

  Hi,

 I'm using wicket 1.5-RC1 in an OSGi container. There was an issue when
 upgrading related to package names
 (https://issues.apache.org/jira/browse/WICKET-3088)

 Now I tried upgrading to 1.5-rc2 and found that there is no aggregate
 jar file anymore. I then read the discussion-thread [discuss] How to
 resolve wicket aggregate classes / sources jar issues.
 (nabble:



 http://apache-wicket.1842946.n4.nabble.com/discuss-How-to-resolve-wicket-aggregate-classes-sources-jar-issues-td3234420.html
 )

 As it states, the aggregate jar has been removed from the wicket
 distribution. Now, this introduces the very same issues described in
 WICKET-3088 again.

 While I can just repackage wicket myself and create a aggregate jar to
 feed the osgi container, it is first more inconvenient :) and
 secondly,
 there is then no real reason to have the wicket-xxx jars export
 packages, as they won't work in an OSGi container one by one anyways.
 I
 cannot add all single jars to the osgi container, because of the

 clashes

 in export-package.

 so in summary, there is another use case where the aggregate jar is
 really helpful: when using wicket with osgi. But it only is, because
 the single wicket jars export the same packages (for example,
 wicket-request and wicket-core both export
 org.apache.wicket.request.handler).

 Are there any thoughts of adding this aggregate jar to the
 distribution
 back again?

 kind regards,
 eike

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



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

 --
 email: e...@eknet.org   https://www.eknet.org  pgp: 481161A0

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

Re: Fwd: wicket 1.5-rc2 and aggregate jar for osgi

2011-04-06 Thread Daniele Dellafiore
mmm, can't really understand.

Anyway, I wanted to add that the point here is to deploy a jar on karaf, not
a war.
To be honest, the real advantage is to deploy a small jar on karaf that is
far better than a heavy war on a jee container.
My idea is to have karaf with all the wicket, spring and other deps, and
that's the easy part.

Then I need a way to start the WicketFilter in the Karaf context. Normally
the JEE container
looks for the web.xml, that in my case bring to the
SpringWebApplicationFactory and a single spring xml file and from there all
the rest.

But what if no one looks for the web.xml? Can I say to osgi that my jar is a
webapp? Or can I start it by hand in an activator or from another file
loaded by spring?

On Wed, Apr 6, 2011 at 3:57 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 See RC1 o.a.w:wicket:pom.xml
 You'll need to create your own project that will combine the all needed
 .jars as we did in RC1.

 On Wed, Apr 6, 2011 at 2:51 PM, Daniele Dellafiore
 dani...@dellafiore.netwrote:

  I'd really like to start my wicket app in a osgi (karaf) container.
  My app uses also wicket-spring. What is the best way to do that now, with
  wichet 1.5 rc3?
 
  Thanls.
 
  On Wed, Mar 16, 2011 at 2:25 PM, Michael O'Cleirigh 
  michael.ocleir...@rivulet.ca wrote:
 
   Hello,
  
   The way releases have been working is that I take the current HEAD and
  then
   change the wicket.version to the current stable and the pom version to
  the
   next release.
  
   If you can commit your changes onto the master branch (wicket
  1.5-SNAPSHOT)
   then I can create a new 1.5-rc2.1 point release to get the wicket-osgi
   module out into maven central. Just let me know when it works (i.e. mvn
   install works without error)
  
   You can either fork the repository on github and then do the change and
   file a ticket with a pull request or send a message to the dev list
 with
   your github username for push/pull access to the wicketstuff repository
   directly.
  
   Look at the 'Developer Information' section on the wiki here:
   https://github.com/wicketstuff/core/wiki for more details.
  
   Regards,
  
   Mike
  
  
ok, I can take the pom from rc1 and adopt it for rc2 - shouldn't be
   problem since you did the work already. If it works and I find some
 time
   I'll try with github
  
   thanks and regards,
   eike
  
   On [Tue, 15.03.2011 22:10], Martin Grigorov wrote:
  
   Well, wicketstuff is hosted at GitHub and any user can contribute.
   If you have some time and willing to share your work with the
 community
   you
   can do it yourself.
   Otherwise just create a ticket in wicketstuff's issue tracking system
  and
   someone of us will do it when we have some time.
  
   Thanks for testing the RCs ! ;-)
  
   On Tue, Mar 15, 2011 at 9:21 PM, Eike Kettnern...@eknet.org
  wrote:
  
Hi Martin,
  
   thanks for your response and no need to apologize! It's good to have
  rcX
   candidate releases to play with so issues can be found.
  
   For me a wicket-osgi dependency would be great! And I really don't
  care
   about where to download :) I don't think that providing it from
   wicketstuff
   would bother users...
  
   If you decide to not support osgi out-of-the-box, it's still no
  problem
   to create an aggregate jar myself. I'd think most osgi users have to
  do
   this (unfortunately) quite often to add other  no-bundle-jars. But
   with a distributed jar, it's of course a lot easier - I would
  appreciate
   it (as probably other osgi users would).
  
   regards,
   Eike
  
   On [Tue, 15.03.2011 20:43], Martin Grigorov wrote:
  
   Hi Eike,
  
   Sorry that we broke OSGi support again.
   The problem was that many users wanted -sources and -javadoc for
 the
   aggregate .jar and it became a bit complex and confusing.
  
   I think we can add wicket-osgi project in wicketstuff/core
 repository
  
   that
  
   will do the same we did initially in WICKET-3088 and then you will
  use
   org.wicketstuff:wicket-osgi dependency instead. We release
  wicketstuff
  
   core
  
   projects few days after Wicket releases.
  
   Other opinions/suggestions ?
  
   martin-g
  
   On Tue, Mar 15, 2011 at 3:05 PM, Eike Kettnern...@eknet.org
   wrote:
  
Hi,
  
   I'm using wicket 1.5-RC1 in an OSGi container. There was an issue
  when
   upgrading related to package names
   (https://issues.apache.org/jira/browse/WICKET-3088)
  
   Now I tried upgrading to 1.5-rc2 and found that there is no
  aggregate
   jar file anymore. I then read the discussion-thread [discuss] How
  to
   resolve wicket aggregate classes / sources jar issues.
   (nabble:
  
  
  
  
 
 http://apache-wicket.1842946.n4.nabble.com/discuss-How-to-resolve-wicket-aggregate-classes-sources-jar-issues-td3234420.html
   )
  
   As it states, the aggregate jar has been removed from the wicket
   distribution. Now, this introduces the very same issues described
 in
   WICKET-3088 again.
  
   While I can just repackage wicket

Re: Fwd: wicket 1.5-rc2 and aggregate jar for osgi

2011-04-06 Thread Daniele Dellafiore
 yes the idea is not to have the huber jar, it's all about this, is the main
feature :)
some guys in the felix maling list suggested me that's actually possible and
supported, it's called WAB, that's a war without /lib (a partially reverse
recursive achronim for A Better War)

http://old.nabble.com/A-better-life%3A-quick-webapp-deploy-to31334158.html

I'll go for that tomorrow.

On Wed, Apr 6, 2011 at 4:27 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 I'm not an OSGi user but here is what I'll do.

 1) create a new Maven project with packaging type 'pom'
 2) combine all wicket jars in one (uber-jar)
  there are several approaches here:
 1) maven-shade-plugin
 2) the way we did it in RC1 with maven-dependency-plugin: see

 http://repo2.maven.org/maven2/org/apache/wicket/wicket/1.5-RC1/wicket-1.5-RC1.pom

 Here check that works with simple Wicket app (e.g. the quickstart).

 Creating one big jar with all dependendies is against OSGi idea. The goal
 is
 to be able to replace dependencies without restarting, e.g. upgrade the
 service layer without undeploying the presentation.
 But if you still want to do it:  start adding more dependencies to be
 packed
 in the uber jar (spring, hibernate)

 About WicketFilter:
 - you can use embedded Jetty or Guice Filter
 and org.apache.wicket.protocol.http.WicketFilter.FILTER_MAPPING_PARAM (I
 explained this earlier today in another thread)
 - OSGi 4.1+ has the notion of enterprise OSGi and you can use plain OSGi
 gymnastics to do that (I have no experience at all in this)






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



Data-driven gui: generation from XML

2011-03-06 Thread Daniele Dellafiore
Hi.

I am taking on a second project where is a good choice to generate
the gui from data definition, specifically from a xml schema.
The first project was a survey: multiple questions divided into
categories with a text description, multiple answers, free answers
(text or numbers, with range validation), radio buttons or drop down
and so on...
My XML contains the structure, following a schema (not a proper xml
one), the data (questions, answers, ids...) and some extra information
(validation, kind of gui element to use...). Part of the data would
eventually be persisted.

In this new project I have a lot of medical data to present in a
simple crud: you can imagine multiple tabs with 8-10 field each, any
field with a label and a specific validation: numeric range, fixed
allowed values and so on. Having a with the definition would be really
easy, also because I can easily discuss it with my customer or even
make it complete the XML for me. Also, would be easier to create new
apps on new schema with a simple crud already available almost gratis.

The validation part really resamble the JSR for bean validation
(303?). I took a look and the XML looks complicated to me:

field name=licensePlate
constraint annotation=javax.validation.constraints.NotNull/
/field

really?

What I have in mind is:

   page
  tab name=antropometrici
 field name=doce description=codice /
 field name=sex values=F,M /
 field name=weight range=40,150 measure=Kg /
 field name=height range=100,210 measure=cm /
  /tab
   /page


What do you think? Not about specific xml implementation, about the
general idea. Do you have suggestion on the topic?

As a note, there's already a discrepancy in that xml: in the real app
I'd like to use tag that speaks the data language, so like : study
and section instead of page and tab, and eventually remap them
later.
This way I have a single point where all the data schema and it's
validation is provided. The DB schema will be the same and the gui can
be generated in a consistent manner from the same XML, maybe just
adding some more translation.

Thanks.

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Wicket frontend and Restlet backend

2010-10-25 Thread Daniele Dellafiore
Hi.

I have recently used restlet and found it great. Expecially, the REST
approach helps you creating a more well crafted web application.
Now I like to use wicket for the frontend and I wondered how to mix
the two stuff: I wanted to keep the REST API and I'd like the web
client uses the exact same backend.

That is, instead of injecting a service in the web client that
direcyly access the JPA backend, I injected a  client based on
Restlet.
So I make an HTTP call to the backend to persist, read and search the data.

What do you think about such approach? Do you foresee any limitations?

I like it a lot:

Clean separation of responsability: you tend to do stuff better, cause
you firsst think at the REST API for a task, then the web frontend
follow in a natural
I have an app with a REST API that's the same I use internally.
The client starts/stop/restart real faster as long as it is not
connected to any spring/jpa/database connection. It's just wicket.
Mocking is easy for unit testing.
I can develop a second frontend based on the exact same backend
instance, for mobile, new web prototype, another mashup.

What I did not try yet is to make both server and web frontend run on
the same OSGI server.
Any advice on running wicket on a Felix/Karaf instance?

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Reload HTML from deployed war

2010-06-26 Thread Daniele Dellafiore
Hi.

To make easier for my designer to work, I make him modified a deployed
version of the application.
He can edit css and html and see changes live.

Webapp is deployed on a jetty 7.0 container and while the CSS modifications
of the exploded webapp result in a change, when I modify an HTML nothing
changes.

When I run the app in a embedded jetty 6 on my machine, if I change the HTMl
in the target/classes folder, changes occur for real.
I am wondering why the two different behaviors given that on both container
the webapp starts with wicket in Development mode.

Any advice?

-- 
Daniele Dellafiore
http://danieledellafiore.net


Cookie, WebRequest and mount point

2010-03-18 Thread Daniele Dellafiore
Hi.

During the login I set a cookie called login.
It works but when I want to logout, getWebRequest().getCookie(login)
does  not found the cookie so it does not remove it. The user is redirected
to the LoginPage where it still found the original cookie that auto login
the client.

Why? Because the first time I search for the cookie, WebRequest have context
/ while the second time, in the LoginPage, has context /login. The reason is
that the public page, when user land when is not logged in, is mounted this
way:

mountBookmarkablePage(login, LoginPage.class);

this make the cookie be set for WebRequest with context /public.
Logout link instead search for WebRequest with context /, with no cookie, so
it cannot remove the old one and the user is logged out and logged in again
automatically.

In fact, If I do not mount pages, everything works. But I want to have nice
URL. It is not important that landing page is /public, I would prefere that
both landing page and home page (after signing in), have just / context.

How can I achieve this? Any ideas?

Thanks!

-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: Cookie, WebRequest and mount point

2010-03-18 Thread Daniele Dellafiore
is what I have done, I ask my self if is fine.

I have backported the IAuthenticationStrategy and CookieUtils from 1.5 and
CookieUtils initialize the cookie with the path. I have hacked it and it
works. I wonder if I will have any other problem in future.

On Thu, Mar 18, 2010 at 6:34 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 always save your cookies using the / path

 -igor

 On Thu, Mar 18, 2010 at 10:14 AM, Daniele Dellafiore ilde...@gmail.com
 wrote:
  Hi.
 
  During the login I set a cookie called login.
  It works but when I want to logout, getWebRequest().getCookie(login)
  does  not found the cookie so it does not remove it. The user is
 redirected
  to the LoginPage where it still found the original cookie that auto login
  the client.
 
  Why? Because the first time I search for the cookie, WebRequest have
 context
  / while the second time, in the LoginPage, has context /login. The reason
 is
  that the public page, when user land when is not logged in, is mounted
 this
  way:
 
  mountBookmarkablePage(login, LoginPage.class);
 
  this make the cookie be set for WebRequest with context /public.
  Logout link instead search for WebRequest with context /, with no cookie,
 so
  it cannot remove the old one and the user is logged out and logged in
 again
  automatically.
 
  In fact, If I do not mount pages, everything works. But I want to have
 nice
  URL. It is not important that landing page is /public, I would prefere
 that
  both landing page and home page (after signing in), have just / context.
 
  How can I achieve this? Any ideas?
 
  Thanks!
 
  --
  Daniele Dellafiore
  http://danieledellafiore.net
 

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




-- 
Daniele Dellafiore
http://danieledellafiore.net


Load webapp from two different tab result in a 302

2010-03-12 Thread Daniele Dellafiore
Hi.

I cannot open the same webapp in two tab/window on the same machine.
It results in a browser crash if webapp is running in local, in a 302 if is
deployed on a remote server
On local, browser crashes due to the loop that is more clear online.

You can see it here:
http://danieledellafiore.net/artivio-stage/

First time It should open. Then try to open the same URL in another browser
window or tab and see the browser continue to reload the same page, without
never completing it.
If you inspect with firebug, you will see a endless series of 302-200.

I can't figure out how to fix this. Problem is that after the first time the
loop occur, closing tab and reopening site in another does not work. You
need to restart the browser (or jetty).

actually using wicket 1.4.3 over jetty 7.0.0.
It is behind an apache but even accessing to jetty directly have the same
result.

Thanks for any help.

-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: Wicket used for mobile.walmart.com

2010-02-23 Thread Daniele Dellafiore
On Mon, Feb 22, 2010 at 9:50 PM, Riyad Kalla rka...@gmail.com wrote:

 Joachim,

 Very very cool info. A few days ago folks were talking about slides for
 convincing management of Wicket and trying to create some common slides
 for folks to utilize -- information like *this* (Walmart, Wells Fargo) is a
 gold-mine for those business cases for Wicket.


In fact I have immediately changed my presentation about Wicket with this
new one http://docs.google.com/present/view?id=dhccq8r9_77c6dhxjdh ;)

-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: Slides of Wicket and Struts 2

2010-02-18 Thread Daniele Dellafiore
I gather some ideas last week and today I sorted something more coherent.

I will present to technical, Java developer of Java user group in Milano.
I wrote something like a skeleton for the presentation, would love feedback
from everyone
I will have 25-30 minutes, plus questions.
I do not focus on comparison, I do not have enough skill on any other web
framework. Maybe my talk will be followed by one about GWT. So give me some
argument for comparison! :)

Here we go, my work in progress:

http://docs.google.com/View?id=dhccq8r9_73c3hs85g2

-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: Authorization and

2010-02-12 Thread Daniele Dellafiore
I am facing authorization problems this days, as you see in onother message.


when I started to deal with this problem I were also uncomfortable at the
idea to use annotation on components or even specific class (like
SecureComponent). Too much noise in the code and too much interference of
authorization stuff in the operational code.

I wanted to move everything in the AuthorizationStrategy to keep the
panels/page code almost authorizazion unaware.

Actually I think that that target could be achieved only for some simple
situation. My advice is to try using the wicket component.setMetaData. You
can put there you access authorization key and check for it in
AuthorizationStrategy.

This is easy to understand and keep the code clean.


On Fri, Feb 12, 2010 at 9:07 AM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

 We have an app with three user types and two user levels (read  or
 read-write in effect). We want to use these in authorization, and thought
 about an approach using annotations. However, at the point of the Wicket
 auth. interface methods, only class-targeted annotations are visible, and
 that will lead to excessive subclassing (especially since Java does not let
 you annotate anonymous inner classes).

 Would it be a better approach to use behaviorless Behavior objects that
 we add to the relevant components and look for in isActionAuthorized()?

 Med vennlig hilsen

 TOR IVER WILHELMSEN
 Senior systemutvikler
 Arrive AS
 T (+47) 48 16 06 18
 E-post: toriv...@arrive.no
 http://www.arrive.no
 http://servicedesk.arrive.no






-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: images not under the context root directory

2010-02-11 Thread Daniele Dellafiore
Hi.
I am facing the same problem: user upload images and I want to access
from wicket.
Of course, user resources are not going to stay under the webapp context.
I would prefer also to put this images wherever I want in the file
system, not under the container folder as well.

I have taken some more decisions:
1. user upload in a user subfolder. So I have a main pictures folder
and then pictures/user1, pictures/user2 and so on.
2. I do not want to use an external servlet or ask apache. Maybe there
are good reason to to that, but I can just think at performance
reasons.

Too get images from a custom folder in wicket I found only one way: to
subclass DynamiImagerResource. I override:

protected byte[] getImageData() {}

and there I can access any folder I want on my filesystem with
standard java API.
I would write almost the same code in a custom servlet. But with a
servlet that serve and image if called, say, to:

localhost:9090/myApp/pictures/user1/pic1

would expose an interface to directly access the image, while all
resource access code stay in wicket so I have a security issue. This
is also the reason I can't use the solution François Meillet expose,
even if I find a very nice one if one does not have my privacy issue.

My only problem now is that I can't figure out how to get a nice URL
with DynamicWebResource but is the less important of all requirment.

What is your opinion about that? What are potential problems in using
DynamicImageResource to serve an image that is not dynamic, is just
stored in a user related folder?

-- 
Daniele Dellafiore
http://danieledellafiore.net

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



Resource authorisation scenario: dealing with non-application wide permissions

2010-02-11 Thread Daniele Dellafiore
Hi.

Imagine this scenario: a webapp that allows creation of groups of people.
There is the owner, the administrator and the normal user for every group.
Like google groups, yahoo groups, facebook groups, a chat... a lot of
examples :)

If we define permission as string concatenation, I can have group:delete
as permission.
In this scenario the permission is not application wide, but group
specific. Is related to the entity of my domain: Group.

Unfortunately I have no idea how to solve my problem in AuthStrategy, where
I can just access the user, not his particular Role in the specific group of
my webapp, I do not have enough information. I can't know in
isActionAuthorized method what is the group to ask authorization access for
group.delete permission.
If I know which is the group (domain entity) I can ask the user for the role
he has in the group, and see if it's role has group.delete permission.
Or any similar implementation, the point is that I miss an information.

What can be a nice way to solve this problem with Wicket
AuthorizationStrategy?

I have just read a recent article about how to integrate shiro and wicket:
http://blog.tauren.com/2010/01/using-wicket-with-shiro-for.html

My point with that solution is that as far as I know, overriding isVisible()
is a discouraged practice. More over, the visibility control for
authorisation access has better room in the AuthorizationStrategy and if I
remember fine, what change is the isVisibilityAllowed().

I can just figure out to to put that information (the role of the subject in
the group) in the Action, but I have to learn how. Do you think should be a
nice idea? Or maybe I am making my life harder for nothing and setting
visibilityAllowed (or even override that method) would be fine enough?

I think I can save a lot of ifs or a lot of override if I Can figure out a
way to implement it the way I described.

I will sleep on this :)

-- 
Daniele Dellafiore
http://danieledellafiore.net


Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-10 Thread Daniele Dellafiore
yep I do that. Actually, I wrote that article :)

My problem is more subtle here and I have discovered now that is
related to javascript execution order. In fact I open a new thread to
investigate that specific issue. I also try to produce a ExamplePage
to commit on tinymce example project.

On Fri, Oct 9, 2009 at 7:47 PM, Dane Laverty danelave...@gmail.com wrote:
 Did you get the
 response.renderJavascriptReference(TinyMCESettings.javaScriptReference()); ?

 In my code it goes like this (as per
 http://wicketbyexample.com/wicket-tinymce-some-advanced-tips/):

 add(new HeaderContributor(new IHeaderContributor() {
             public void renderHead(IHeaderResponse response) {

 response.renderJavascriptReference(TinyMCESettings.javaScriptReference());
             }
        }));

 Dane

 On Fri, Oct 9, 2009 at 10:17 AM, Daniele Dellafiore ilde...@gmail.comwrote:

 I start from the end: I need fine control over the order javascript is
 executed. What is the javascript to call a refresh on a component like
 is done when I use target.addComponent()?


 From the start.
 I make that work with bgooren suggestion, using the javascript to
 remove the editor. No need to remove the behavior on java side. That
 works for the checkbox that dynamically adds and removes the Rich
 Editor.

 Now, the problem on refreshing a list of fields.
 What happens: to add a new field, click on ADD and I add my ListView
 is added to be refreshed via a target.addComponent(). In doing this,
 the markupId of the component changes, so tinyMce lose reference to
 it's existing editors.

 My solution: on the ADD callback, I remove the editors and let them be
 re-added during repainting. Works? NO!
 Why? because the listView is repainted before the mceControlRemove is
 executed, even if they are added to the same AjaxRequestTarget in the
 ADD callback. So happens that:
 1.  the remove fails because the old component is found no more
 2. after, the submit fails because tinyMCE still have the old editor
 reference.

 -- ;(

 On Mon, Oct 5, 2009 at 11:44 AM, Daniele Dellafiore ilde...@gmail.com
 wrote:
  Hey Bas, thanks for answering.
 
  Unfortunately it does not work.
  Even if I run:
 
                String removeEditor =
 tinyMCE.execCommand('mceRemoveControl',
  false, '
                       + propertyPanel.getValueMarkupId() + ');;
                 target.appendJavascript(removeEditor);
 
  or simply remove the TinyMceBehavior from my TextField, the result is the
  same: mce editor disappear correclty, but remains in tinyMCE.editors list
 so
  Tiny tries to process it in a successive iteration.
 
  I try to find help on tinyMCE forum
 
 
  On Mon, Oct 5, 2009 at 10:59 AM, bgooren b...@iswd.nl wrote:
 
  I'll show you some parts of my code so you get an idea of how I do
 things.
 
  First of all, I have used AjaxEditableLabel from wicket-extensions as a
  starting point.
  TinyMCE's javascripts should always be loaded:
 
  // Preload TinyMCE
         add( new AbstractBehavior()
         {
 
            �...@override
             public void renderHead( IHeaderResponse response )
             {
                 if( !tinyMCELoaded )
                 {
                     response.renderJavascriptReference(
  TinyMCESettings.javaScriptReference() );
 
                     settings = buildTinyMCESettings();
 
                     tinyMCELoaded = true;
                 }
             }
 
         } );
 
  In my case TinyMCE is loaded through an AJAX call:
 
  @SuppressWarnings(unchecked)
    �...@override
     protected void onEdit( AjaxRequestTarget target )
     {
         super.onEdit( target );
 
         final String id = editor.getMarkupId( true );
         final StringBuilder buf = new StringBuilder();
 
         // Load plugins
         buf.append( settings.getLoadPluginJavaScript() ).append( ;\n );
 
         // Initialize tinyMCE
         buf.append( tinyMCE.init({ ).append( settings.toJavaScript(
  Mode.none, Collections.EMPTY_LIST ) ).append(  });\n );
         buf.append( settings.getAdditionalPluginJavaScript() ).append(
  ;\n
  );
 
         // Setup editor
         buf.append( tinyMCE.execCommand('mceAddControl',true,'
 ).append(
  id ).append( '); );
 
         // Request focus on editor
         buf.append( setTimeout( function()
  {tinyMCE.execCommand('mceFocus',true,' ).append( id ).append( ');},
 500
  ); );
 
         target.appendJavascript( buf.toString() );
     }
 
  As you can see I initialize TinyMCE, and then perform an mceAddControl
  command on the textarea I want to convert to a TinyMCE editor.
 
  Finally, I need to switch back to a textarea before unloading, so the
  correct contents are POSTed. To do so, I have added an AjaxCallDecorator
  to
  the close request, and allow implementations to override it:
 
  @Override
     protected IAjaxCallDecorator getCloseDecorator()
     {
         return new AjaxCallDecorator()
         {
 
            �...@override
             public CharSequence decorateScript

Re: AjaxRequestTarget javascript execution order

2009-10-10 Thread Daniele Dellafiore
you are my favourite person in the world today :)

On Sat, Oct 10, 2009 at 3:07 PM, McIlwee, Craig
craig.mcil...@openroadsconsulting.com wrote:
 Have you tried prependJavascript(String) instead of append?  Javadoc:

 Adds javascript that will be evaluated on the client side before components 
 are replaced

 Sounds like what you're looking for if I'm understanding your question 
 correctly.

 Craig
  _

 From: Daniele Dellafiore [mailto:ilde...@gmail.com]
 To: users@wicket.apache.org
 Sent: Sat, 10 Oct 2009 07:51:27 -0400
 Subject: AjaxRequestTarget javascript execution order

 Hi.

  In my application I want to execute some javascript on a component
  that is going to be removed when a parent component is refreshed
  causing him to be removed from DOM.

  What happens is that DOM is refreshed before the script added vua
  target.appendJavascript(mySCript) is executed. So myScript does not
  find the old component.

  I have looked the AjaxRequestTarget.respond(final RequestCycle
  requestCycle) and I have seen that the onDomreadyJavascript is added
  before the appendJavascript. Is this relevant? I guess that the js
  code that refresh DOM is executed even before the onDomReadyJs, right?

  So how may I execute some custom javascript on a AjaxRequestTarget
  that also add a component to be refreshed via ART.addComponent() so
  that my custom js is executed before the DOM is modified?

  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella

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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-09 Thread Daniele Dellafiore
I start from the end: I need fine control over the order javascript is
executed. What is the javascript to call a refresh on a component like
is done when I use target.addComponent()?


From the start.
I make that work with bgooren suggestion, using the javascript to
remove the editor. No need to remove the behavior on java side. That
works for the checkbox that dynamically adds and removes the Rich
Editor.

Now, the problem on refreshing a list of fields.
What happens: to add a new field, click on ADD and I add my ListView
is added to be refreshed via a target.addComponent(). In doing this,
the markupId of the component changes, so tinyMce lose reference to
it's existing editors.

My solution: on the ADD callback, I remove the editors and let them be
re-added during repainting. Works? NO!
Why? because the listView is repainted before the mceControlRemove is
executed, even if they are added to the same AjaxRequestTarget in the
ADD callback. So happens that:
1.  the remove fails because the old component is found no more
2. after, the submit fails because tinyMCE still have the old editor reference.

-- ;(

On Mon, Oct 5, 2009 at 11:44 AM, Daniele Dellafiore ilde...@gmail.com wrote:
 Hey Bas, thanks for answering.

 Unfortunately it does not work.
 Even if I run:

   String removeEditor = tinyMCE.execCommand('mceRemoveControl',
 false, '
  + propertyPanel.getValueMarkupId() + ');;
    target.appendJavascript(removeEditor);

 or simply remove the TinyMceBehavior from my TextField, the result is the
 same: mce editor disappear correclty, but remains in tinyMCE.editors list so
 Tiny tries to process it in a successive iteration.

 I try to find help on tinyMCE forum


 On Mon, Oct 5, 2009 at 10:59 AM, bgooren b...@iswd.nl wrote:

 I'll show you some parts of my code so you get an idea of how I do things.

 First of all, I have used AjaxEditableLabel from wicket-extensions as a
 starting point.
 TinyMCE's javascripts should always be loaded:

 // Preload TinyMCE
        add( new AbstractBehavior()
        {

           �...@override
            public void renderHead( IHeaderResponse response )
            {
                if( !tinyMCELoaded )
                {
                    response.renderJavascriptReference(
 TinyMCESettings.javaScriptReference() );

                    settings = buildTinyMCESettings();

                    tinyMCELoaded = true;
                }
            }

        } );

 In my case TinyMCE is loaded through an AJAX call:

 @SuppressWarnings(unchecked)
   �...@override
    protected void onEdit( AjaxRequestTarget target )
    {
        super.onEdit( target );

        final String id = editor.getMarkupId( true );
        final StringBuilder buf = new StringBuilder();

        // Load plugins
        buf.append( settings.getLoadPluginJavaScript() ).append( ;\n );

        // Initialize tinyMCE
        buf.append( tinyMCE.init({ ).append( settings.toJavaScript(
 Mode.none, Collections.EMPTY_LIST ) ).append(  });\n );
        buf.append( settings.getAdditionalPluginJavaScript() ).append(
 ;\n
 );

        // Setup editor
        buf.append( tinyMCE.execCommand('mceAddControl',true,' ).append(
 id ).append( '); );

        // Request focus on editor
        buf.append( setTimeout( function()
 {tinyMCE.execCommand('mceFocus',true,' ).append( id ).append( ');}, 500
 ); );

        target.appendJavascript( buf.toString() );
    }

 As you can see I initialize TinyMCE, and then perform an mceAddControl
 command on the textarea I want to convert to a TinyMCE editor.

 Finally, I need to switch back to a textarea before unloading, so the
 correct contents are POSTed. To do so, I have added an AjaxCallDecorator
 to
 the close request, and allow implementations to override it:

 @Override
    protected IAjaxCallDecorator getCloseDecorator()
    {
        return new AjaxCallDecorator()
        {

           �...@override
            public CharSequence decorateScript( CharSequence script )
            {
                return tinyMCE.execCommand('mceRemoveControl', false, ' +
 editor.getMarkupId() + '); 
                        + super.decorateOnSuccessScript( script );

                // Call to save contents back to textarea
                // return tinyMCE.get(' + editor.getMarkupId() +
 ').save();  +
                // super.decorateScript( script );
            }

        };
    }

 The above code removes TinyMCE from the given textarea, and saves the HTML
 back into the textarea. I have commented out the call to save(), since it
 was not necessary.

 Bas


 Daniele Dellafiore wrote:
 
  I get what the real problem is: tinyMce saves internally each editor
  that
  is added to a page in a list called, well, editors.
  When I remove the behavior from a textField, I should also call
  tinyMce.remove passing the editors as a parameter.
 
  I will try to do this but any help is appreciated :)
 
  This is for the checkbox that enable/disable

Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-05 Thread Daniele Dellafiore
Hey Bas, thanks for answering.

Unfortunately it does not work.
Even if I run:

  String removeEditor = tinyMCE.execCommand('mceRemoveControl',
false, '
 + propertyPanel.getValueMarkupId() + ');;
   target.appendJavascript(removeEditor);

or simply remove the TinyMceBehavior from my TextField, the result is the
same: mce editor disappear correclty, but remains in tinyMCE.editors list so
Tiny tries to process it in a successive iteration.

I try to find help on tinyMCE forum


On Mon, Oct 5, 2009 at 10:59 AM, bgooren b...@iswd.nl wrote:


 I'll show you some parts of my code so you get an idea of how I do things.

 First of all, I have used AjaxEditableLabel from wicket-extensions as a
 starting point.
 TinyMCE's javascripts should always be loaded:

 // Preload TinyMCE
add( new AbstractBehavior()
{

@Override
public void renderHead( IHeaderResponse response )
{
if( !tinyMCELoaded )
{
response.renderJavascriptReference(
 TinyMCESettings.javaScriptReference() );

settings = buildTinyMCESettings();

tinyMCELoaded = true;
}
}

} );

 In my case TinyMCE is loaded through an AJAX call:

 @SuppressWarnings(unchecked)
@Override
protected void onEdit( AjaxRequestTarget target )
{
super.onEdit( target );

final String id = editor.getMarkupId( true );
final StringBuilder buf = new StringBuilder();

// Load plugins
buf.append( settings.getLoadPluginJavaScript() ).append( ;\n );

// Initialize tinyMCE
buf.append( tinyMCE.init({ ).append( settings.toJavaScript(
 Mode.none, Collections.EMPTY_LIST ) ).append(  });\n );
buf.append( settings.getAdditionalPluginJavaScript() ).append( ;\n
 );

// Setup editor
buf.append( tinyMCE.execCommand('mceAddControl',true,' ).append(
 id ).append( '); );

// Request focus on editor
buf.append( setTimeout( function()
 {tinyMCE.execCommand('mceFocus',true,' ).append( id ).append( ');}, 500
 ); );

target.appendJavascript( buf.toString() );
}

 As you can see I initialize TinyMCE, and then perform an mceAddControl
 command on the textarea I want to convert to a TinyMCE editor.

 Finally, I need to switch back to a textarea before unloading, so the
 correct contents are POSTed. To do so, I have added an AjaxCallDecorator to
 the close request, and allow implementations to override it:

 @Override
protected IAjaxCallDecorator getCloseDecorator()
{
return new AjaxCallDecorator()
{

@Override
public CharSequence decorateScript( CharSequence script )
{
return tinyMCE.execCommand('mceRemoveControl', false, ' +
 editor.getMarkupId() + '); 
+ super.decorateOnSuccessScript( script );

// Call to save contents back to textarea
// return tinyMCE.get(' + editor.getMarkupId() +
 ').save();  +
// super.decorateScript( script );
}

};
}

 The above code removes TinyMCE from the given textarea, and saves the HTML
 back into the textarea. I have commented out the call to save(), since it
 was not necessary.

 Bas


 Daniele Dellafiore wrote:
 
  I get what the real problem is: tinyMce saves internally each editor
  that
  is added to a page in a list called, well, editors.
  When I remove the behavior from a textField, I should also call
  tinyMce.remove passing the editors as a parameter.
 
  I will try to do this but any help is appreciated :)
 
  This is for the checkbox that enable/disable the tinyMce behavior.
 
 
  I have a more subtle situation: I have a list of textFields and a button
  to
  add more. When I add a new field, I refresh the list via AJAX to show the
  new field. But, refreshing the list also causes the html id of any
 element
  in the list to change!
 
  So, when in the end I submit the form, tinyMce cannot find its editors
  anymore cause the parent DIV of the INPUT field that has an associated
  tinyMce editor just changed it's html id.
  Given that the id will change and there is no alternatives, I have to
 find
  a
  way to keep the associations or to clean all editors and recreate them at
  every list refresh.
 
  What is your suggesions?
 
  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella
 
 

 --
 View this message in context:
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.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




-- 
Daniele Dellafiore
http

Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-03 Thread Daniele Dellafiore
I get what the real problem is: tinyMce saves internally each editor that
is added to a page in a list called, well, editors.
When I remove the behavior from a textField, I should also call
tinyMce.remove passing the editors as a parameter.

I will try to do this but any help is appreciated :)

This is for the checkbox that enable/disable the tinyMce behavior.


I have a more subtle situation: I have a list of textFields and a button to
add more. When I add a new field, I refresh the list via AJAX to show the
new field. But, refreshing the list also causes the html id of any element
in the list to change!

So, when in the end I submit the form, tinyMce cannot find its editors
anymore cause the parent DIV of the INPUT field that has an associated
tinyMce editor just changed it's html id.
Given that the id will change and there is no alternatives, I have to find a
way to keep the associations or to clean all editors and recreate them at
every list refresh.

What is your suggesions?


On Wed, Sep 30, 2009 at 5:20 PM, bgooren b...@iswd.nl wrote:


 Well, that's what I meant with preloading. You cannot use TinyMCE if
 you're
 loading its javascripts from your ajax request. If the TinyMCE scripts are
 loaded from the containing page, then it will work (as you say).


 nino martinez wael wrote:
 
  Actually AFAIK the resources just need to be on path, then you can pretty
  much do whatever you want. Could be what your definition of preloading
 are
  :)
 
  I have a panel that are added by ajax so I had to make sure the resources
  used by that panel always where on the containing page.
 
  regards
 
  2009/9/30 bgooren b...@iswd.nl
 
 
  It's not possible to add TinyMCE dynamically due to the way TinyMCE
  works.
  What you can do however, is pre-load TinyMCE, and dynamically
  enable/disable
  it on a component.
 
  Daniele Dellafiore wrote:
  
   Hi. I have a problem with this example code:
  
 tinyMceBehavior = new TinyMceBehavior();
 PropertyModelBoolean richProperty = new PropertyModel(model,
   rich);
 add(new AjaxCheckBox(switchRte, richProperty) {
  
@Override
protected void onUpdate(AjaxRequestTarget target) {
   if (getModelObject()) {
  textArea.add(tinyMceBehavior);
   } else {
  textArea.remove(tinyMceBehavior);
  tinyMceBehavior = new TinyMceBehavior();
   }
   refresh(target);
}
 });
  
   the purpose is to have a checkbox that add and remove the
   TinyMceBehavior from a text area.
   It works fine but I have this problem: when I Submit the form the
   textArea is in after REMOVING the behavior, I have a javascript error:
  
   t.win.document is null
  
   firebug show the error in tiny_mce_src.js at line 5376
  
   if (!r)
  r = isIE ? t.win.document.body.createTextRange() :
   t.win.document.createRange();
  
   I am using tinymce 3.2.7 but the same problem occurs with tinymce used
   in trunk version of wicket-contrib-tinymce.
  
   the effect is that submit does not work.
   if I click on checkbox again, everything continue to work.
   Any idea?
  
   --
   Daniele Dellafiore
   http://blog.ildella.net
   http://twitter.com/ildella
  
   -
   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/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25682644.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
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25683255.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




-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella


[tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread Daniele Dellafiore
Hi. I have a problem with this example code:

  tinyMceBehavior = new TinyMceBehavior();
  PropertyModelBoolean richProperty = new PropertyModel(model, rich);
  add(new AjaxCheckBox(switchRte, richProperty) {

 @Override
 protected void onUpdate(AjaxRequestTarget target) {
if (getModelObject()) {
   textArea.add(tinyMceBehavior);
} else {
   textArea.remove(tinyMceBehavior);
   tinyMceBehavior = new TinyMceBehavior();
}
refresh(target);
 }
  });

the purpose is to have a checkbox that add and remove the
TinyMceBehavior from a text area.
It works fine but I have this problem: when I Submit the form the
textArea is in after REMOVING the behavior, I have a javascript error:

t.win.document is null

firebug show the error in tiny_mce_src.js at line 5376

if (!r)
   r = isIE ? t.win.document.body.createTextRange() :
t.win.document.createRange();

I am using tinymce 3.2.7 but the same problem occurs with tinymce used
in trunk version of wicket-contrib-tinymce.

the effect is that submit does not work.
if I click on checkbox again, everything continue to work.
Any idea?

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: TinyMCE in an Ajax loaded panel

2009-09-30 Thread Daniele Dellafiore
On Thu, Nov 27, 2008 at 5:57 PM, Martijn Lindhout
mlindh...@jointeffort.nl wrote:

 Hi all,

 I searched nabble, but couldn't find any recent posts that brought me a
 solution to this problem:

 I have a page with two panels, a master/detail setup. The master has a list
 of items, the detail a TinyMCE editor. The details panel is invisible until
 the user clicks an item in the master list. The list disappears and the
 detail panel is shown, all using Ajax. The problem is that the TinyMCE
 editor doesn't appear, it's just a normal textarea.

 Has anyone a solution to this problem?

 Thanks

yes, I had this problem and I solved this. I wrote about this here:
http://wicketbyexample.com/wicket-tinymce-some-advanced-tips/

specifically in the paragraph Switching to Rich Text after the page is load

it is all working now but I have a problem with the checkbox that
enable/disable the behavior. I am going to write on this mailing list
for help about that.

--
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread Daniele Dellafiore
that is what I do.

enable disable for me means add/remove to/from a component, while the
javascript is loaded as the page is loaded.

but, after removing the behavior, the save generate that error.
or maybe you mean something different with enable/disable.

On Wed, Sep 30, 2009 at 4:50 PM, bgooren b...@iswd.nl wrote:

 It's not possible to add TinyMCE dynamically due to the way TinyMCE works.
 What you can do however, is pre-load TinyMCE, and dynamically enable/disable
 it on a component.

 Daniele Dellafiore wrote:

 Hi. I have a problem with this example code:

       tinyMceBehavior = new TinyMceBehavior();
       PropertyModelBoolean richProperty = new PropertyModel(model,
 rich);
       add(new AjaxCheckBox(switchRte, richProperty) {

         �...@override
          protected void onUpdate(AjaxRequestTarget target) {
             if (getModelObject()) {
                textArea.add(tinyMceBehavior);
             } else {
                textArea.remove(tinyMceBehavior);
                tinyMceBehavior = new TinyMceBehavior();
             }
             refresh(target);
          }
       });

 the purpose is to have a checkbox that add and remove the
 TinyMceBehavior from a text area.
 It works fine but I have this problem: when I Submit the form the
 textArea is in after REMOVING the behavior, I have a javascript error:

 t.win.document is null

 firebug show the error in tiny_mce_src.js at line 5376

 if (!r)
    r = isIE ? t.win.document.body.createTextRange() :
 t.win.document.createRange();

 I am using tinymce 3.2.7 but the same problem occurs with tinymce used
 in trunk version of wicket-contrib-tinymce.

 the effect is that submit does not work.
 if I click on checkbox again, everything continue to work.
 Any idea?

 --
 Daniele Dellafiore
 http://blog.ildella.net
 http://twitter.com/ildella

 -
 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/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25682644.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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Wicket in Italy

2009-09-30 Thread Daniele Dellafiore
On Wed, Sep 23, 2009 at 7:49 PM, Giovanni pino_o...@yahoo.com wrote:
 Hi,

 are there any Wicketers living in Turin, Italy?

Hi, Milano :)


-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Mount different page for second parameter

2009-09-08 Thread Daniele Dellafiore
I think right now the only way is to use MixedParamUrlCodingStrategy

Mount a page this way:

 mount(new MixedParamUrlCodingStrategy(collection, CollectionPage.class, new 
 String[] { owner }));

so CollectionPage is mounted at: http://localhost:9090/collection/
now in CollectionPage.java you can call:

 parameters.getString(owner)

to get the first parameters that in case URL is
http://localhost:9090/artivio/collection/ildella returns ildella.

As long as MixedParamUrlCodingStrategy accept a String[] comma
separated, you can have as many parameters as you want, without having
the name of the parameters in the URL.

Btw, would be cool to have a mount mechanism that allows to create
REST url in a more intuitive way, as Igor says maybe in 1.5 :)


On Mon, Sep 7, 2009 at 8:27 PM, Vit Rozkovecrozkovec...@email.cz wrote:
 Hallo,
 which encoding strategy should one use if one would like to achieve this:

 http://somesite/somepath/user1/products -- mounted on ProductsPage.class
 http://somesite/somepath/user1/profile -- mounted on ProfilePage.class

 http://somesite/somepath/user2/products -- mounted on ProductsPage.class
 http://somesite/somepath/user2/profile -- mounted on ProfilePage.class

 on ProductsPage.class and ProfilePage.class you know which user acesses the
 page.

 Thank you for any hints.

 Vit

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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Attaching a wicket generated page in a multipart MIME message

2009-09-08 Thread Daniele Dellafiore
Hi. I need to sent something like an HTML newsletter and I am
wondering about a nice way to do this with wicket.
The problem is that I need to generated the rendered page without
sending it to the browser, but keep the page server side, get the
generated HTML as String and include it in a multipart mime message.

Any suggestion?

Thanks!

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Wicket and FileUpload on Google App Engine

2009-09-03 Thread Daniele Dellafiore
Great, seems interesting, I will give this a try. Thanks.

On Sun, Aug 30, 2009 at 6:31 PM, uud ashr uuda...@gmail.com wrote:

 Hi all
 Just want to share.
 If you have problem with file upload on Google App Engine, I just done some
 experiment and it works.
 Use the attached files.
 I didn't create this, I just modify from the existing wicket source code.

 I create new class, GaeSafeServletWebRequest which is subclass of
 ServletWebRequest. Everyting come from here.

 The key is remove the thread that clean the ReferenceQueue. So how to clean
 it? I use something called FileCleaner.reapFiles(2) that will poll the queue
 maximum 2 item. I put those line of code everytime GaeSafeServletWebRequest
 created.

 to use, you only need to override method *newWebRequest* on your wicket
 application

 @Override

 protected WebRequest newWebRequest(final HttpServletRequest
 servletRequest) {

 return new GaeSafeServletWebRequest(servletRequest);

 }


 When you upload something, then write it using *DatastoreOutputStream*, it
 will put all the bytes to GAE (Google App Engine) datastore. This
 OutputStream already handle the over size, so it will create chunk files in
 order to save the big file size.

 Please tell me if it works for you (actually it works for me) and maybe we
 can refine or create the better code. Or maybe we can add this to wicket? So
 wicket can be FULL COMPATIBLE to Google App Engine.

 Regards,
 uudashr


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




-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella


clean way to avoid DynamicWebResource to look for non existing file

2009-09-02 Thread Daniele Dellafiore
Hi all, I use a DynamicWebResource to display images previously uploaded by
user ion the context of my application. I have this DWR subclass:

   class LogoResource extends DynamicImageResource {

  private final IModel logoModel;

  public LogoResource(IModel model) {
 this.logoModel = model;
  }

  @Override
  protected byte[] getImageData() {
 String basePath = upload/images/;
 Object name = logoModel.getObject();
 File file = new File(., basePath + name);
 LoggerFactory.getLogger(getClass()).info(serving file:  + file);
 try {
return IOUtils.toByteArray(new FileInputStream(file));
 } catch (FileNotFoundException e) {
e.printStackTrace();
 } catch (IOException e) {
e.printStackTrace();
 }
 return null;
  }
   }

now, when the file is found, everything is ok.
When it is not, I receive a NullPo9nterException, this is the output when
you can see my log and then the begin of the trace:

INFO  - LogoResource - serving file: ./upload/images/null
ERROR - RequestCycle   -
java.lang.NullPointerException
at java.io.ByteArrayInputStream.init(ByteArrayInputStream.java:89)
at
org.apache.wicket.markup.html.DynamicWebResource$1.getInputStream(DynamicWebResource.java:221)

at
org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.respond(ResourceStreamRequestTarget.java:160)

at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)

at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1267)

This is annoying and, more important, it seems to cause the page not to
reload properly. In fact when after a submit I call a setResponse on the
same page, the page is not reloaded.

At the end of all the exceptions, I get:

WARN  - DataRequestCycle   - Completed exception handling for
request [requestcy...@1ec3ffd thread=10193...@qtp-28693170-2]
INFO  - DataRequestCycle   - Request ended
[requestcy...@1ec3ffdthread=10193106@qtp-28693170-2](time:
33

And the page has the same URL as before, correclty, but not the new
rendering: If I reload the page, I get the new stuff.

In the same page I have other forms, with the same setResponse onSubmit,
that work perfectly.
Do you think that these exceptions could be the problem for the undone
refresh? Or maybe is better to look elsewhere?

And, in any case, there is a clean way to avoid the getImageData to be
called if I do not have a file for the image?

Thanks.

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella


TinyMCE, in place edit with on focus lost and start RTE after a javascript request

2009-07-22 Thread Daniele Dellafiore
Hi everyone, I am trying to get this behavior mixing TinyMCE
wickestuff component and some wicket default ajax features.

I want to press a button, say ADD, that makes a new section appears.
After ADD is pressed, there is a new item in a ListView that contains
a Form that has some TextField and some TextArea with TinyMCEBehavior.
Note: before pressing ADD the first time, there are no form in the
page, and not TextArea and not TinyMCE.

First problem: the RTE appears only after a reload of the page. I
fixed this problem temporary just loading a RTE at the beginning, then
the RTE that appears after the ADD has started working. So, the issue
here is that the Ajax update does not trigger enough thing...

Now, I want to make this RTE a editor in place, I tryed two ways:

1) copy the AjaxEditableLabel code and adapt to a RTE.
Works, and also works with the ADD feature, always given that a
working RTE is loaded when page is loaded. Same problem as before, but
I have the new features
Problem here is that the AjaxEditableLAbel uses a Label to render
text, and Label does not render HTML properly. There is a wicket
component that renders HTML?

2) use the InPlaceEditComponent procvided with TinyMCE.
This solve the problem of the rendering that I have with soluzion one,
but does not have a feature that I love with AjaxEditablLabel: when
the focus is lost, the AEL switch to the label while with InPlaceEdit
I have to press save. Again, I do not need an advanced them for my
RTE, so I do not want the save.

I would like to go with the InPlaceEdit but it give me more problem:
it does not work when I load it after page is loaded, even if another
one has been alreadty rendered.
And I do not understand why there is not a constructor without a model
so that it uses the model of the form like all other component...

Ideally I would like to go with the InPlaceEdit but seen all the
problems I have, the easiest solution is to find a Component that
renders HTML, with this one I have all that I wanted, and go with my
custom implementation.

So what I need is:
1. a component that renders html
2. a solution to make TinyMCE behavior works if rendered after the
page is loaded the first time *without* having another one already
loaded.

Thanks everyone has even read the whole mail :)

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Different parameters passed in test and runtime

2009-07-07 Thread Daniele Dellafiore
in the page MyStartPage...

add(new BookmarkablePageLink(new, MyTargetPage.class, new
PageParameters(action=new)));

in the test:
  tester.startPage(MyStartPage.class);
  tester.clickLink(new);

adding a system out, in the MyTargetPAge constructor, parameters have
this value:

action = [new]

while running the app and clicking on the link in the browser, I get:

artwork = new

this is related to the mount:

  mount(new MixedParamUrlCodingStrategy(artworks, MyTargetPage.class,
new String[] { artwork, action }));

but, it seems that something is wrong here, don't you?

wicket 1.4-rc6

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Too many path parts in page parameters

2009-07-04 Thread Daniele Dellafiore
hi.

I have not tried yet cause is not high priority form me now, but as
long as Igor is right, I expect that the Strategy does not play well
with non absolute URL so you can just change the img src URL.

On Fri, Jul 3, 2009 at 9:19 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:
 After removing all the highslide code, that is not the only thing that goes
 wrong. In my html file I have a panel containing this:

 h3Dataa href=# wicket:id=toggleDataPanelimg
 src=img/plus01.gif//a/h3

 the mixedParamUrlCodingStrategy trips on that too, and I can't see why this
 doesn't work...

 On 2 Jul, at 17:54, Igor Vaynberg wrote:

 your highslide js is making those requests, you may have to change it
 to request images via absolute urls

 -igor

 On Thu, Jul 2, 2009 at 7:22 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:

 I ran the debugger, and the urlPath the mixedParamUrlCodingStrategy gets
 served is /img/info01.gif, which does not make sense. This is just an
 image and nowhere is there a request to open up a new page... After that,
 it
 goes to parse /highslide/graphics/outlines/rounded-white.png , then one
 more and then it renders.

 Any ideas?


 On 2 Jul, at 14:42, Daniele Dellafiore wrote:

 as you can see I posted a similar issue.

 you can start debugging the strategy to see the values of parameters.

 On Thu, Jul 2, 2009 at 10:36 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:

 I have a page which takes one parameter ('id') and build itself from
 there.
 In the debugger it shows that only one parameter is passed, and the
 constructor of the page runs without problems. Somewhere further down
 the
 line however an exception is thrown:

 ERROR - RequestCycle               - Too many path parts, please
 provide
 sufficient number of path parameter names
 java.lang.IllegalArgumentException: Too many path parts, please provide
 sufficient number of path parameter names
      at


 org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy.decodeParameters(MixedParamUrlCodingStrategy.java:167)

 The page is loaded ok, although the markup is changed (references to
 css
 files are prepended with '../' for some weird reason) and all panels
 are
 there and working.

 Any ideas?

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





 --
 Daniele Dellafiore
 http://blog.ildella.net
 http://twitter.com/ildella

 -
 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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Slideshow

2009-07-04 Thread Daniele Dellafiore
yep, that was my idea too even if this force me to introduce
supplementary navigations link outside the Slideshow. This may result
confusing for the user and they will not be as cool as normal
smoothgallery controls.

Anyway, is a cheap and effective solution so probably I go with this,
and I Will try to have a look in the SG forum for people having this
issue.

On Fri, Jul 3, 2009 at 2:05 PM, nino martinez
waelnino.martinez.w...@gmail.com wrote:
 just make an ajax version and use normal pagination..?

 2009/7/2 Daniele Dellafiore ilde...@gmail.com:
 On Mon, Jun 29, 2009 at 2:20 PM, Johannes
 Schneidermaili...@cedarsoft.com wrote:
 Thanks for that hint.
 Do you know how many images wicket-slides/SmoothGallery support? I will
 have galleries with thousands of pictures...

 I do not know how many images it supports but I remember it was quite
 slow to load one hundred images.
 Anyway, send all images to the client in one shot doesn't sound
 reasonable to me.

 I am addressing this issue in the next weeks, if you have some ideas
 we should start talking about some possible implementation.

 --
 Daniele Dellafiore
 http://blog.ildella.net
 http://twitter.com/ildella

 -
 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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: WebPage instantiation before asking the AuthorizationStrategy?

2009-07-04 Thread Daniele Dellafiore
today I have done this
.
I was using a mix of WASP and a custom AuthStrategy. Today I migrated
to 1.4 so I completely remove WASP. Now I have my
AuthorizationStrategy impl with this code:

public boolean isInstantiationAuthorized(Class componentClass) {
  if (componentClass.isAnnotationPresent(AuthenticationRequired.class)
 !isUserAuthenticated()) {
 throw new
RestartResponseAtInterceptPageException(BasicWebApplication.get().getLoginPage());
  }
  return true;
   }

so I have a simple annotation on the pages (before they were
SecureWebPage) and a custom isUserAuthenticated method. If fails, I
redirect to login page like was do, but doing this in the
isInstantiationAuthorized prevent the Page contructor code to be
invoked.

it works :)

On Thu, Jul 2, 2009 at 5:39 PM, Igor Vaynbergigor.vaynb...@gmail.com wrote:
 there is no mechanism in pure java that would allow us to intercept an
 instantiation and execute something before that. we could do that with
 aop but that would force whatever aop solution we choose into your
 projects.

 so we do the next best thing, we call the auth strategy from the Page
 constructor. what this means is that this is called as soon as you
 instantiate the page but *before* any code in any other subclass
 constructors runs. this is why isinstantiationauthorized gets a class
 and not an instance - because the instance is not yet fully
 constructed.

 so the auth code does run *before* your code.

 -igor

 On Thu, Jul 2, 2009 at 3:06 AM, Daniele Dellafioreilde...@gmail.com wrote:
 Hi everyone. I noticed this strange behavior this way. I mounted
 MyPage to /mypage and if IO point to:

 http://localhost:8080/myapp/mypage

 before being authenticated, instead of being redirected to the
 LoginPage I receive a blank page. The reason is in MyPage constructor
 I try to access to the user, that is null so I get a NullPointer.
 Now, the user is never supposed to be null cause MyPage is a
 SecureWebPage so I expect it get instantiated just after being
 authenticated.

 Now, I made some debug and have seen that the constructor of MyPage is
 invoked before any calls to any AuthorizationStrategy method.
 This happens for every page!

 This sounds strange to me, and to you? I expect
 isInstantiationAuthorized to be called before...

 --
 Daniele Dellafiore
 http://blog.ildella.net
 http://twitter.com/ildella

 -
 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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



WebPage instantiation before asking the AuthorizationStrategy?

2009-07-02 Thread Daniele Dellafiore
Hi everyone. I noticed this strange behavior this way. I mounted
MyPage to /mypage and if IO point to:

http://localhost:8080/myapp/mypage

before being authenticated, instead of being redirected to the
LoginPage I receive a blank page. The reason is in MyPage constructor
I try to access to the user, that is null so I get a NullPointer.
Now, the user is never supposed to be null cause MyPage is a
SecureWebPage so I expect it get instantiated just after being
authenticated.

Now, I made some debug and have seen that the constructor of MyPage is
invoked before any calls to any AuthorizationStrategy method.
This happens for every page!

This sounds strange to me, and to you? I expect
isInstantiationAuthorized to be called before...

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



MixedParamUrlCodingStrategy IllegalArgumentException: Too many path parts due to some javascript

2009-07-02 Thread Daniele Dellafiore
Hi everyone. I have integrated highslide JS to my application (well,
the web designer did). Now I have a wicket Page with, in wicket:head

   script type=text/javascript
  hs.registerOverlay({
  overlayId: 'closebutton',
  position: 'top right',
  fade: 2 // fading the semi-transparent overlay looks bad in IE
  });


  hs.graphicsDir = 'highslide/graphics/';
  hs.wrapperClassName = 'borderless';
   /script

now when I load the page I receive a

WARN  - DataRequestCycle   - Handling exception for request
[requestcy...@15efa6a thread=3737...@qtp-18621578-3], exception:
java.lang.IllegalArgumentException: Too many path parts, please
provide sufficient number of path parameter names
java.lang.IllegalArgumentException: Too many path parts, please
provide sufficient number of path parameter names
at 
org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy.decodeParameters(MixedParamUrlCodingStrategy.java:178)


debugging the decodeParameters method, I get that the two parameters
have these values:

urlFragment
 (java.lang.String) /highslide/graphics/outlines/drop-shadow.png
urlParameters
 (java.util.HashMapK,V) {}

Now, I do not understand perfectly how this stuff works, I just did
not expect any javascript to interfer with my URL strategy but it
does.
You have any suggestion?

Ah, everything works perfectly, I just I have this exception.

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Too many path parts in page parameters

2009-07-02 Thread Daniele Dellafiore
as you can see I posted a similar issue.

you can start debugging the strategy to see the values of parameters.

On Thu, Jul 2, 2009 at 10:36 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:
 I have a page which takes one parameter ('id') and build itself from there.
 In the debugger it shows that only one parameter is passed, and the
 constructor of the page runs without problems. Somewhere further down the
 line however an exception is thrown:

 ERROR - RequestCycle               - Too many path parts, please provide
 sufficient number of path parameter names
 java.lang.IllegalArgumentException: Too many path parts, please provide
 sufficient number of path parameter names
        at
 org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy.decodeParameters(MixedParamUrlCodingStrategy.java:167)

 The page is loaded ok, although the markup is changed (references to css
 files are prepended with '../' for some weird reason) and all panels are
 there and working.

 Any ideas?

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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Slideshow

2009-07-02 Thread Daniele Dellafiore
On Mon, Jun 29, 2009 at 2:20 PM, Johannes
Schneidermaili...@cedarsoft.com wrote:
 Thanks for that hint.
 Do you know how many images wicket-slides/SmoothGallery support? I will
 have galleries with thousands of pictures...

I do not know how many images it supports but I remember it was quite
slow to load one hundred images.
Anyway, send all images to the client in one shot doesn't sound
reasonable to me.

I am addressing this issue in the next weeks, if you have some ideas
we should start talking about some possible implementation.

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Detachable Models best practices

2009-07-02 Thread Daniele Dellafiore
I am not sure I completely understood what happens to you.
This sound to me like a problem I had in unit testing pages, when
calling, to say

tester.assertLabel

coused the model.getObject to be called and if model is a LDM, than it
results attached.
So I have to detach the component explicitly after.
Not beautiful, but is a problem I had only on the test side.

Now, maybe you can post some code to see when you occur to call
LDM.getObject during the update.
Sounds really strange to me that your id (the database id?) changes
during an update...

On Mon, Jun 29, 2009 at 6:05 PM, Neil Curzonneil.cur...@gmail.com wrote:
 Hi all,

 Using 1.3.6, I've recently been simplifying some of my wicket code by using
 LoadableDetachableModels and PropertyModels instead of trying to manage
 static models in various ways.

 I had a strange and subtle bug caused by the fact that a form button update
 call into the next layer would take parameters such as the item id being
 changed. To provide this item ID, I ended up resolving the model object,
 which caused the LoadableDetachableModel to be loaded. The problem was that
 this meant that the model was resolved before the update occurred, which
 means that as the page was re rendered, the stale model object was used as
 the source for the components. After the next update, the change made by the
 previous update would be shown.

 The ways that I can think of to fix this are 1. store the parameters needed
 for the update call instead of using the model object to retrieve them or 2.
 call detachModels on the component so that the models will be reloaded (kind
 of crappy performance wise). But there will be no compile errors or runtime
 warnings if I forget either of these, just a slightly stale view of the
 page.

 I'm worried that this bug will creep in again unless I can find a reliable
 way to make sure that any updating event handlers can't accidentally load
 the detachable model as they're updating. Has anybody found a good way to do
 this?

 Thanks
 Neil




-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



jazzyplugin dependency in tinymce wicketstuff cannot be resolved

2009-06-23 Thread Daniele Dellafiore
Hi everyone.

I am trying to build tinymce wicketstuff but it cannot resolve the
jazzyplugin dependency. Without that, it works but I cannot use the
spellchecker feature.

I have searched and cannot find any artifact of jazzyplugin or
jwarehouse, or com.swabunga anywhere on the web.

any hint?

-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Nested form bug?

2009-05-17 Thread Daniele Dellafiore
)
     at
 wicket.quickstart.TakpApplication$2.processEvents(TakpApplication.java:842)
     at
 org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1240)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1319)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1418)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:544)
     at
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:456)
     at
 org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:160)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
     at wicket.quickstart.TakpServlet.service(TakpServlet.java:48)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
     at
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
     at
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
     at
 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
     at
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
     at
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
     at
 org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
     at
 org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
     at
 org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
     at
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
     at org.mortbay.jetty.Server.handle(Server.java:285)
     at
 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
     at
 org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
     at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:627)
     at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
     at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
     at
 org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
     at
 org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
 Caused by: java.lang.IllegalArgumentException: Argument null must
 not be empty or only whitespace.
     at com.myapp.dto.Dummy(Dummy.java:76)

 t. 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





-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

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



Re: Possible to retrieve previous page from PageMap

2009-04-27 Thread Daniele Dellafiore
I have tried to find something but, given that I am using wikcket 1.3
and I do not have PageReferences, the only way I have found to recover
the last page is to pass a parameter with the page name and then found
the last version of that page in the HttpSession pageMap.
Or to keep the reference of the last page in the session.

I can do it but I expect that wicket already have that kind of
mechanism. Doesn't it?

On Tue, Apr 14, 2009 at 8:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 search this forum for pagereference

 -igor

 On Tue, Apr 14, 2009 at 9:28 AM, Daniele Dellafiore ilde...@gmail.com wrote:
 Here is my return to last page problem.

 A detail page has multiple tabs, an AjaxTabbedPanel. Swithing
 between tabs does not put another page in browser history, so
 history.back() is fine.
 I have also a checkbox that trigger enable/disable state of all the
 input of the form. Is an AjaxCheckBox that in the callback refresh the
 form component after changing the enable property. The
 history.back() works, again.

 But, I have a reset button that:
 1. reload the old values in the fields
 2. put the form in a disable state, like at the beginning.

 Now, to achieve this result, the Reset button actually calls a
 setResponsePage(getPage(), getPage().getPageParameters())

 so reloads the current page with original parameters.
 That calls actually make the history grow, so the history.back() is no
 longer useful becouse, in fact, goes to the last version of the actual
 page instead of the previous page.

 Any suggestion?

 I should simply use a document.form.reset() making that the Reset
 button is not a submit button... sounds fine?

 In general, what is the best solution wicket-like? Is something
 REST-like a la gmail, that returns to the /search/myFilter ? Or
 something statefull, so I suppose it should be easy to recover the
 last rendered page with the right version and so on...

 On Fri, Mar 13, 2009 at 5:18 PM, francisco treacy
 francisco.tre...@gmail.com wrote:
 igor, i would agree with you if i wanted to mimic the browser back
 button functionality.

 but i do not. we intensively use panel swapping and we're only
 interested in registering when users click on certain pages (we can
 fine-tune pages which pages should be back-clickable).

 we actually considered using history.go(-1), but if you want your app
 to seriously take into account usability / user experience, it's
 useless -- for instance think panel swapping, or rendering links such
 as back to your search for ice-cream. personally i'm not someone who
 likes complexity just for the sake of it.

 francisco


 On Fri, Mar 13, 2009 at 3:43 PM, Igor Vaynberg igor.vaynb...@gmail.com 
 wrote:
 its really a lot of work to duplicate what the back button in the
 browser already does. or a simple a href=#
 onclick=history.go(-1)back/a will do as well.

 -igor

 On Fri, Mar 13, 2009 at 5:02 AM, francisco treacy
 francisco.tre...@gmail.com wrote:
 to be honest i haven't read the whole thread, but we are also trying
 to achieve roughly the same thing.

 as of wicket 1.4-m1 there is a class called PageId that you may want
 to consider.

 i created a back state holder class that holds a PageId and an
 IModelString for the text of the back link. so for every visited
 page (in the onBeforeRender - could be placed in the base page), we
 set a holder in the session and in our base page we call
 Session.get.getHolder.  pretty simple really.
 as the PageId class is a unique identifier of the page you can use it
 to distinguish between pagemaps, etc. (so navigation doesn't interfere
 between tabs / windows)

 this fulfills our usecase, as this is just a helper link to go back
 where you were. we don't completely rely on this link because we also
 do keep traditional navigation links in our pages.

 however i still need to solve the double click problem, i.e. if a user
 clicks twice on a link, the last rendered page will be the same as the
 one he is in. thus, the back link points to the same page.  it is
 actually quite tricky to get it right, yet i believe possible. i will
 definitely try to avoid the link handing over pageparams in the url
 like in the good old days :)

 i will post it once i get everything working together.

 francisco





 On Fri, Mar 13, 2009 at 10:29 AM, pixologe pixol...@mailinator.com 
 wrote:

 Just a thought which I did not think about when implementing this (thus 
 I had
 to change this stuff all over afterwards), perhaps it helps someone 
 avoiding
 the same mistake:

 The latest rendered page is not neccessarily the page that lead the user 
 to
 the current page.
 I.e. retrieving the last page this way might result in strange behavior 
 if
 the user uses two browser windows or tabs simulaneously. Same applies for
 clicking the browser's back button.

 Thus I had to go back to a rather old-fashioned solution, where every 
 link
 hands over a page param :-/ like in the good old days ;-)





 rolandpeng wrote:

 great! after

Re: sessionsize of requestlogger

2009-04-15 Thread Daniele Dellafiore
On Mon, Jan 12, 2009 at 5:43 PM, carloc carlo_ca...@yahoo.com wrote:

 What Page Does Wicket Store in its HttpSession?
 Is it bad to keep a reference to the previous pages in instance variables of
 new pages?

I am really interested in an answer about this two questions. I am
using 1.3 so I cannot use Page Reference mechanism.

Finally, I cannot find a way to recover the last Page in a non restful
way and as I stated in another mail, history.back does not work in all
conditions (i.e. submit that reload the page instead of calling a
setResponse)

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: wicket:Interface TabbedPanel and INewBrowserWindowListener

2009-04-14 Thread Daniele Dellafiore
It seems to be related to TabbedPanel in fact when I switch to
AjaxTabbedPanel, the parameter is no longer added.

I did some debug and what happens is that in the method
RequestCycle.urlFor(Component, RequestListenerIntercface, ValueMap)
the process goes into the first if branch and the line

target = new BookmarkableListenerInterfaceRequestTarget(...) is called
and the parameters added.

AjaxTabbedPanel solved this.

And also solved another issue I had. In the page with the TabbedPanel
I have a link that executes js history.back();
The intended behavior is to go back to the previous page but with the
TabbedPanel it goes back to the previous tab.
AjaxTAbbedPanel seems to be fully ajaxified so the history.back
returns to the previous rendered Page.

I think that this behavior is also related to the way we mount pages,
with a HybridUrlCodingStrategy. In fact on the location bar we have
the version number of the page and with AjaxTabbedPanel it does not
change while it changes with the TabbedPanel

Related to this I have some other issues but I open a new thread,
leaving this to understand the wicket:interface problem.

I am using wicket 1.3.3.

On Fri, Apr 10, 2009 at 5:44 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 that parameter is only added when wicket thinks you opened a new
 browser window or tab. it has nothing to do with tabbed panel. have
 you done that? this code is based on window.name attribute so if you
 have some js that changes the value it may confuse wicket.

 -igor

 On Fri, Apr 10, 2009 at 8:38 AM, Daniele Dellafiore ilde...@gmail.com wrote:
 Hi everyone, I have this situation: a TabbedPanel with 2 panels each
 containing a form.
 Each panel have aa checkbox that trigger the enable/disable status of
 each component of the form. So I enter the panel, click the enable
 checkbox and then I can edit and save and press a discard button.

 The discard button execute a:

 setResponsePage(getPage().getClass(), getPage().getPageParameters());

 becouse I need to reload the same entity I was editing and tipically I
 have a single parameters that is the ID of the entity.

 The effect is that the page is still in the initial situation, with
 editing disabled and every modification, of course, has not been
 saved.

 This works in the first Tab of the TabbedPanel. In the second, what
 happens is that fields values are reset but they do not go back to
 disabled status. The reason I think is that instead of just the entity
 ID I also found this pageParameter:

 wicket:interface = wicket-7:0:7:INewBrowserWindowListener::

 I am pretty sure that is related to the TabbedPanel but cannot
 understand how. If I remove that parameter, the behavior is what
 expected: page is restarted and I am back to the first tab with fields
 disabled.

 Two question:
 1. when and why that parameter is added? I would like to read more
 about wicket:interface and friends, can you point me to some doc?
 2. What if I would like to reload the page on the same tab I was
 before? You think is better to call a setSelectedTab before the
 setResponsePage or to pass a pageParameter with the number of the
 selected tab? Or what else?

 Thanks.

 --
 Daniele Dellafiore
 http://blog.ildella.net/

 -
 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





-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: Possible to retrieve previous page from PageMap

2009-04-14 Thread Daniele Dellafiore
.


 -
 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





-- 
Daniele Dellafiore
http://blog.ildella.net/

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



BaseWicketTester.clickLink call onBeginRequest two times

2009-03-13 Thread Daniele Dellafiore
Hi.

I am trying to upgrade an application from wicket 1.3.3 to 1.3.4 or .5
some tests I have failse couse the new BaseWicketTester implementation
treat the AjaxLink in a different way that results in
RequestCycle.onBeginRequest to be called two times:

callOnBeginRequest(requestCycle);
processRequestCycle(requestCycle);

In the other statement of the clickLink, this does not happen.

Any idea on why it works this way?

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: BaseWicketTester.clickLink call onBeginRequest two times

2009-03-13 Thread Daniele Dellafiore
On Fri, Mar 13, 2009 at 3:49 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 did you look at the 1.3.4 changelog?

yes and I did not see anything related to this specific issue unless
there are a couple of tickets related to WicketTester.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: BaseWicketTester.clickLink call onBeginRequest two times

2009-03-13 Thread Daniele Dellafiore
On Fri, Mar 13, 2009 at 4:33 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 probably has something to do with one of those wickettester-related issues.

 feel free to open a jira issue and provide a test case.

ok, just want to be sure that is really strange or wrong that
onBeginRequest is called two times in the same click.


 -igor

 On Fri, Mar 13, 2009 at 7:54 AM, Daniele Dellafiore ilde...@gmail.com wrote:
 On Fri, Mar 13, 2009 at 3:49 PM, Igor Vaynberg igor.vaynb...@gmail.com 
 wrote:
 did you look at the 1.3.4 changelog?

 yes and I did not see anything related to this specific issue unless
 there are a couple of tickets related to WicketTester.

 --
 Daniele Dellafiore
 http://blog.ildella.net/

 -
 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





-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: Security in a Spring Wicket layered application

2009-03-13 Thread Daniele Dellafiore
we just finished (yesterday) to implement authorization in a wicket app.

basically, we end up with integration of WASP, Spring Security and a
little beat of SWARM with a home made User-Group-Permission mechanism
that is really simple and string based, and persisted on DB (via
hibernate)

We have an implementation of WaspAuthorizationStrategy with basicalle
login, logoff and this other method implemented:

   @Override
   public boolean isComponentAuthorized(Component component,
WaspAction action) {
  if (component instanceof SecureWebPage) {
 return isUserAuthenticated();
  }
  return checkPermission(component, action);
   }

in our app, authenticated user can see all pages (so the first if),
but some component can have further restrictions,  there is the
second method that goes into out custom permission check. In that
method, we ask spring the Authentication in the session, so we get the
User (a custom class) and from there we can check permissions.

If you are interested, I can write a more specific essay on our implementation.

I am happy with that becouse it integrates with wicket and spring
security using some of the  mechanism and facility but without being a
slave of the framework, so the granularity of authorization is
completely domain-side and so are the permission definitions.

In the end, define a permission on a button you now need just to
change a Button with a SecureButton (that has a very trivial
implementation). Then we create a Permission on the DB (a string) for
that button in some specific Page and assign the Permission to some
group. That's it.

We stayed away from SWARM and its hive replacing it with a  simpler
home made mechanism. We just use the SwarmAction to have the access,
render, enable granularity for components already built in.
Permission implemented the Spring Security interface called
GrantedAuthority, that is the way spring guys calls permissions. In
fact, both are just a string and we are perfectly integrated.

For the point:
. Authorization before being able to run methods in the service layer

I think that spring security is the way to go, it allows use AOP to
restrict a method call, with also filtering and so on. I had not the
change to experiment with it actually, but I know it can for sure :)

On Sun, Mar 8, 2009 at 5:20 PM, Kent Larsson kent.lars...@gmail.com wrote:
 Hi,

 I know there has been some discussion on this. But I've had a hard
 time deciding how this project should use security anyway.

 The application in question is layered into three layers for
 presentation, services and persistence using Wicket, Spring and
 Hibernate.

 What we need:
 - Authentication
 - Authorization on pages, components
 - Authorization before being able to run methods in the service layer
 - Authorization for viewing/editing some domain objects using Access
 Control List's (ACL's)

 I have read Wicket in Action and it's custom security solution has some pros:
 - It's quite easy to understand
 - We have a lot of freedom in how to do authentication and authorization

 And some cons:
 - I don't know how to authorize calls of specific methods, and thus
 - All security will be in the presentation layer
 - It won't be usable if we want security on web services later (which
 we do not need now, so maybe this can be disregarded)

 It would be nice if we could have a common solution to our security
 needs that integrates well with Wicket and Spring. I know that the
 Auth Roles project is out there as well as Swarm. But I don't know
 which will meet our needs and which will most likely be an option to
 us when we later move to Wicket 1.4 or a higher version.

 Best regards,
 Kent

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





-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Refresh an invisible component via ajax

2009-03-13 Thread Daniele Dellafiore
Hi.
Today again I lost some time cause a panel was not being refresh after
being correctly added to AjaxRequestTarget.

The reason is one I already know but forgot: if the panel is invisible
when the page is rendered, it's html is not rendered at all so you are
calling a refresh on a Component without any DOM connection. .

I think that this should result in some sort of exception, instead
wicket (as of 1.3.3) do not tell anything.

Maybe this problem is already being discussed/addressed/solved, I have
searched and found nothing specific. If so, please point me to the
jira issue or something.

Thanks.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



What javascript event trigger component update?

2009-03-06 Thread Daniele Dellafiore
Hi everyone.

I have this problem:

a panel with a list is hided via a jquery hide(). It works but this
panel is also refreshed via a wicket AjaxTimerBehavior.
So when the page is loaded, I call the jquery hide() and at the first
onTimer() the panel is refreshed and become visible.

How can I avoid this *without* any flickering effect?
What is the event that arrives to the component before it is refreshed?

Make this panel visible/invisible can be a solution but I prefer
relying on ajax toolkit to manage this sort of stuff.

Thanks.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: What javascript event trigger component update?

2009-03-06 Thread Daniele Dellafiore
On Fri, Mar 6, 2009 at 3:27 PM, Linda van der Pal
lvd...@heritageagenturen.nl wrote:
 A guess from a newbie would be onBeforeRender

 Regards,
 Linda


no :)

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



serving static images

2009-01-13 Thread Daniele Dellafiore
Hi all.

I am working on a fine way to serve some static images.
Imagine a webapp a la flickr. I have some images to be served inside a
slideshow AND I do not want that the real URL can be visible. In fact,
there is a policy about authorization to see images, so I need my
webapp to validate the request and then serve the images.

So, I cannot use the AttributeModifier and insert the src attribute
to the image. I use a custom DynamicImageResource reading image from
file system this way to implement getImageData()

return IOUtils.toByteArray(new FileInputStream(image));

well, as you can guess, I have privilege problems on accessing file
system within the servlet container cause my images are not stored
under the webapp classpath.

Now, what is for you the best way to solve this?
Configure apache web server to access the directory where image files
are stored and then serve them via wicket? I need to use a
DynamicImageResource due to privacy as told before, so I can open a
connection to httpd via HttpClient or some similar libraries and get
the byte stream?

Any other idea?

Thanks. You can see the slideshow in action here:
http://code.google.com/p/wicket-slides/
I started contributing the project some weeks ago and now it is base
on smoothgallery 2.0, there is also a demo app and a maven2 pom.

The code for loading resources from file is still in my app but I will
publish it there when it will be enough complete.

What about put that project under wicket-stuff? I can check the
original author for permission.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: generalized way to ignore mouse input during screen refresh?

2009-01-10 Thread Daniele Dellafiore
On Fri, Jan 9, 2009 at 10:55 PM, Valentine2008
valentine...@alumni.sfu.ca wrote:

 I created a reusable component, PanelWithAjaxBusyIndicatingMask, which
 extends Panel.

 The functions it has:

 It will add a transparent mask layer to the current page to prevent further
 UI interactivity when there are any busy Ajax activities.

 The mask layer will have an animation gif and a configurable display text
 (the default is: Please wait…).

 Both the display text and the animation gif file are configurable in the
 constructors.

 I am proposing it to the Wicket developers. Hope they will incorporate it
 into the next release.

It seems like the mechanism of blur that happens to background
openign the modal window.

Anyway, it would be great to share the code using wicket stuff, I
think is a better way for some reason: component is immediately
available, many people can use it to provide feedback and let the
component grow, so eventually it can become a standard wicket
component.

getting commit accesso for wicket stuff is not complicated, I guess
some project in wicket-stuff can host your component.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



javascript conflicts

2008-11-27 Thread Daniele Dellafiore
Hi all.

I am using wicket-animator and I have discovered today a conflict with
the wicket default component update via ajax.

If a single component is added to the AjaxRequestTarget and I append a
custom javascript via AjaxRequestTarget.appendJavascript() that affect
the same component, i.e. calling a animator.js function, the animation
does not start but the component is refreshed via the wicket standard
mechanism.

The order is: first I call addComponent and after the appendJavascript.

What I would like is that the component get the update and then my
custom javascript runs.

Any advice?

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



obtain the wicket-modal id in java code

2008-11-26 Thread Daniele Dellafiore
Hi all.

I want to implement a fade effect for the wicket modal window.
What I miss is the id of the div of the modal that has class=wicket-modal.
The id of that div is generated dynamically. When this happens for a
wicket Component I can get it in the code via the getId method but I
do not have a reference in java code to the wicket-modal as a
component.

I have tryed to understand where the id is generated looking in the
javascript code in ModalWindow class but I am not able to figure out
where the id is generated.

Can anyone help?

Without the id I have to traverse the DOM and this can be difficoult
to do in an easy way for all browser. At least, I think so, I am a
little confused about xpath and javascript that is cross browser, I
accept any kind of advice.

Thanks.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: OnChangeAjaxBehavior receives only first input character

2008-11-02 Thread Daniele Dellafiore
I fixed it. The problem is that the copmponent I want to update was
outside the form.

On Tue, Oct 28, 2008 at 3:51 PM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
 Hi Daniele

 Provide your code, java and html cutout, it's clearly not similar then it
 would work..

 Daniele Dellafiore wrote:

 Hi all.

 I am using an OnChangeAjaxBehavior on a textField to filter contents
 of a table.
 My code is very similar to this example:
 http://www.wicket-library.com/wicket-examples/ajax/on-change-ajax-behavior

 The problem I have is that the first input character is received and I
 can get it in the onUpdate method of the Behavior. Then it stops
 sending event, the wicket ajax debug console confirm that nothing is
 sent anymore. If I remove and give the focus back to the field, I
 receive a new character, and only one again.

 Here is the debug console output for the first char I receive.

 INFO: focus removed from
 INFO: focus set on filter5
 INFO:
 INFO: Initiating Ajax POST request on

 ?wicket:interface=:2:authorSearch:form:filter::IBehaviorListener:0:random=0.08630731350941423
 INFO: Invoking pre-call handler(s)...
 INFO: Received ajax response (261 characters)
 INFO:
 ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
 id=authors6 ![CDATA[table id=authors6

 thead


tr class=headers

thspanNome/span/th

/tr


 /thead


 tbody

 /tbody
 /table]]/component/ajax-response
 INFO: Response parsed. Now invoking steps...
 INFO: Response processed successfully.
 INFO: Invoking post-call handler(s)...
 INFO: Calling focus on filter5
 INFO: focus removed from filter5



 --
 -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]





-- 
Daniele Dellafiore
http://blog.ildella.net/

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



OnChangeAjaxBehavior receives only first input character

2008-10-28 Thread Daniele Dellafiore
Hi all.

I am using an OnChangeAjaxBehavior on a textField to filter contents
of a table.
My code is very similar to this example:
http://www.wicket-library.com/wicket-examples/ajax/on-change-ajax-behavior

The problem I have is that the first input character is received and I
can get it in the onUpdate method of the Behavior. Then it stops
sending event, the wicket ajax debug console confirm that nothing is
sent anymore. If I remove and give the focus back to the field, I
receive a new character, and only one again.

Here is the debug console output for the first char I receive.

INFO: focus removed from
INFO: focus set on filter5
INFO:
INFO: Initiating Ajax POST request on
?wicket:interface=:2:authorSearch:form:filter::IBehaviorListener:0:random=0.08630731350941423
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (261 characters)
INFO:
?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
id=authors6 ![CDATA[table id=authors6

thead


tr class=headers

thspanNome/span/th

/tr


/thead


tbody

/tbody
/table]]/component/ajax-response
INFO: Response parsed. Now invoking steps...
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...
INFO: Calling focus on filter5
INFO: focus removed from filter5

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



animations and wicket integration

2008-08-05 Thread Daniele Dellafiore
Hi all.

Simple question: anyone aware of what is the best javascript
animation framework integration with wicket?

animator looks nice, but the js library is not updated since one year,
maybe some other general purpose lib is more advanced now.

Anyway, what I see on animator web site is more than enough for my
needs, so my choice will go to the better wicket stuff integration.
Any advice?

Thanks.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Avoid page serialization

2008-07-10 Thread Daniele Dellafiore
I am wondering if page serialization in wicket is always necessary. I
have read this:

Wicket keeps its tree of components in the session. In a clustered
environment, session data needs to be replicated across the cluster.
This is done by serializing objects in a cluster-node's session and
deserializing them on another cluster-node's session

here: http://cwiki.apache.org/WICKET/spring.html

So I have asked myself: what if I do not have a clustered environment?
Is serialization really needed anyway?

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Testing behavior of a ModalWindows: close, click...

2008-07-10 Thread Daniele Dellafiore
Hi all.

I am trying to test, with WicketTester, a behavior like this, a
classic delete confirmation dialog:

click on link opens a ModalWindow (OK)
check that the Modal is open indeed (OK, with
tester.assertComponentOnAjaxResponse(deleteModal);)
click on a confirm button on the page in the modal, and test that the
element has been deleted (NO!!!)

I cannot find a way to simulate the click becouse I cannot find the
path for the page inside the modal window.
For me it will be enough to close the modal from the test couse the
code that perform the delete is in the CloseCallback.

Is possible with WicketTester or I have to use some other testing framework?

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Binding property of a component

2008-07-08 Thread Daniele Dellafiore
Hi all. My problem is simple: I want to bind a given property (say:
'enabled', or 'visible') of a component to a variable that is on
another object, just like I bind the text value of a TextField with a
String on onother object.

This is becouse I do not like this code:

  Button button =  new Button(save) {
 @Override
 public boolean isEnabled() {
return isEditEnabled();
 }
  };

where isEditEnabled() is a method of the parent Page.
I would like to write something like:

bind(button, enabled, editEnabled)

and put that bind(Component, String, String) method on the page, or on
a static class, doesn't matter.

there is a preferred way to achieve this? A way that involves the use
of the wicket models to bind properties...

Thanks.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: Testing DataTable simulating click on link, checkbox etc...

2008-05-30 Thread Daniele Dellafiore
On Fri, May 30, 2008 at 4:54 AM, Timo Rantalaiho [EMAIL PROTECTED] wrote:
 On Thu, 29 May 2008, Daniele Dellafiore wrote:
 umm, but in example above, what column and row number are grabbed?

 there is a way to show the complete graph of a wicket page hierarchy?

 Yes there is, WicketTester.debugComponentTrees() and I
 think some other way as well.

 However, to get to your checkboxes inside the repeater, I
 recommend using a visitor

wicketTester.getLastRenderedPage().visitChildren(CheckBox.class, new
IVisitor() {
...
});

 instead of relying on the component path, which is very
 fragile. (Direct component path changes when the component
 hierarchy changes, for example if you need to make some div
 of the hierarchy a Wicket component. Repeaters might have
 different number of items, the sorting may change etc.)

 jdave-wicket has the visitor stuff built-in, and you can
 also select the component based on its model object

 CheckBox windShieldSelection = 
 selectFirst(CheckBox.class).which(is(windShield)).from(context);
 wicketTester.executeAjaxEvent(windShieldSelection, onclick);

 or

 ListCheckBox allCheckBoxes = selectAll(CheckBox.class).from(context);

these seem great, a way to write code I like: intentional :)

thanks, i will try jdave and friends.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Testing DataTable simulating click on link, checkbox etc...

2008-05-29 Thread Daniele Dellafiore
Hi.

I want to unit test a DefaultDataTable that have a column with some check boxes
To achieve this, I have a panel defined as:

wicket:panel
input type=checkbox wicket:id=select /
/wicket:panel

and the table is simply:

table wicket:id=table border=0[Table]/table

and I add this column:

AbstractColumn checkBoxColumn = new AbstractColumn(new 
Model(Select)) {
@Override
public void populateItem(Item cellItem, String 
componentId, IModel
rowModel) {
cellItem.add(new CheckBoxPanel(componentId, 
rowModel));
}
};

it works and all but I do not know how to unit test the code.

The problem is to select a desired checkBox via WicketTester.
I have the same problem if I have a link in the table: how to simulate
the click on, say, link at row 5, column 1?

Thanks for advices.

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: Testing DataTable simulating click on link, checkbox etc...

2008-05-29 Thread Daniele Dellafiore
On Thu, May 29, 2008 at 1:03 PM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
 Could'nt you do one of two things:

  1. Give the selector the fully path,  something like
 :tabel:row:column:checkpoxpanel:check
  2. Grab the check by using the full path like above and set the model
 on it..

umm, but in example above, what column and row number are grabbed?

there is a way to show the complete graph of a wicket page hierarchy?



 Daniele Dellafiore wrote:

 Hi.

 I want to unit test a DefaultDataTable that have a column with some check
 boxes
 To achieve this, I have a panel defined as:

 wicket:panel
 input type=checkbox wicket:id=select /
 /wicket:panel

 and the table is simply:

 table wicket:id=table border=0[Table]/table

 and I add this column:

AbstractColumn checkBoxColumn = new AbstractColumn(new
 Model(Select)) {
@Override
public void populateItem(Item cellItem, String
 componentId, IModel
 rowModel) {
cellItem.add(new CheckBoxPanel(componentId,
 rowModel));
}
};

 it works and all but I do not know how to unit test the code.

 The problem is to select a desired checkBox via WicketTester.
 I have the same problem if I have a link in the table: how to simulate
 the click on, say, link at row 5, column 1?

 Thanks for advices.



 --
 -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]





-- 
Daniele Dellafiore
http://blog.ildella.net/

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



testing feedback message without being too rigid

2008-05-29 Thread Daniele Dellafiore
Hi.

If I make an assert like:

tester.assertErrorMessages(new String[] { Field 'code' is required. });

the tests fails on the continuous integrator couse locale on that
machine is IT and the error message is in italian. On my machine it
works. This is a problem, also for I18N.
I would like to write something like

assertErrorMessagesContains(...);

This test will be enough and more less breackable. But I cannot get
the error message in any other way, if I do something like:

FeedbackPanel feedback = (FeedbackPanel)
tester.getComponentFromLastRenderedPage(feedback);
FeedbackMessage feedbackMessage = feedback.getFeedbackMessage();
assertEquals(, feedbackMessage);

the tests fails and tell me that feedbackMessage is null...
Same if I do: renderedPage.getFeedbackMessage();

BTW, the feedback message pass the assertErrorMessages above and at
runtime I can see the message in the 'feedback' field.

How may I get the feedbackPanel messages from a test?

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



mounting large number of url

2007-11-27 Thread Daniele Dellafiore
Hi.

In my app I would like to have a easy url for a user, say:

http://myapp.com/username

to make this, in wicket, I only know the mount url way.
Anyone know about problems in adding a large number of url this way?

Just in case, any alternatives?

Thanks.

-- 
Daniele Dellafiore
http://ildella.wordpress.com/

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