Re: Howto load StringResources from Database for Iternationalization?

2010-01-29 Thread German Morales
Hoi Martin,

we have a subclass of ComponentStringResourceLoader, overriding
#loadStringResource methods, which we then register in our application #init
method:
   getResourceSettings().addStringResourceLoader(new
YourStringResourceLoader());
and it works well for our needs.

Then you should decide if it's better to load all resources in advance (for
example, on Application #init) or if you want to get them on demand
(performance and memory considerations).
If you wait for calls for loadStringResource to get resources individually,
you will get lots of requests to the database, but then the results should
be cached by wicket, so the next user asking for the resource should have it
already there. On the other hand, you don't load all the stuff in advance.
We prefer for the moment to load all resources first, but we must still
analyze better if this is the best way.

GrĂ¼sse,

German


2010/1/29 Martin U 

> Hello Folks,
>
>
> i don't know if this question was ever done, but i didn't find anything
> suitable for me.
>
> In a huge webapplication which is being in the first steps of
> implementation, we want to use a Database (table) to store there
> any "String Resources" by locale for translation.
>
> I have been jumping through the class-hierarchy for many hours but i
> haven't
> found the right point to "plug-in" a ResourceLoader
> from Database.
>
> There are some different "Interface" of them i could imagine "This is the
> right place" but I am not sure at all.
>
> Have i to Implement my own *IResourceSettings*? I hope not, cause the
> Implementation "Settings" looks very complicated to me.
> or is it enough to implement *IStringResourceLoader*? But then, where can i
> add my own loader to the "Chain" of processing?
>
> Thanks a lot for any hints. Its very urgently to know and to understand if
> wicket is useful for our "wishes" before we really
> decide which framework we "want" to use.
>
> Please apologise for my English, its not my mothers tongue.
>
> - Matty
>


Re: Custom DropDownChoice with css style

2010-01-21 Thread German Morales
Hallo Alexander,

Perhaps you could change this to be a FormComponent (actually inheriting
from FormComponentPanel).
Then, when your ajax call refreshes the "component", the whole div
(containing drop down + span) will be replaced by a new one.
In your version, if i understand correctly, wicket removes the old select
(but not your extra span, of which it is not aware of) and puts the new one
(which puts another span every time).

Regards,

German

2010/1/20 Alexander Monakhov 

> Hi, guys.
>
> I'm trying to implement DropDownChoice that could render  tag with
> possiblity to add style with css.
> What do I mean:
>  tag rendering is OS dependent. So, plain  element is
> always
> ugly. There is no possibility to change arrow, or border of drop down list
> only with css.
> One of the ways to resolve this problem is to add  tag before
> 
> tag to show currently selected value, then apply to it desired background
> and any desired styles and give  tag's opacity zero value. So, drop
> down menu would appear any time user clicks on span element. To push
> selected value to span onChange method for  tag is appropriated.
>
> So, I've created this class:
> 
> public class StyledDropDownChoice extends DropDownChoice {
>
> 
> /*Here goes constructors and StyleDropDownSpan is added as behavior. */
> 
>
>@Override
>protected void onComponentTag( ComponentTag tag ) {
>tag.put( "onChange", "var span = document.getElementById('" +
> getMarkupId()
>+ "-span'); var select = document.getElementById('" +
> getMarkupId()
>+  "'); span.innerHTML = select.options[
> select.selectedIndex ].innerHTML;" );
>//todo move javascript output to renderJavascript( CharSequence,
> String )
>
>super.onComponentTag( tag );
>}
>
>private class StyledDropDownSpan extends AbstractBehavior {
>
>@Override
>public void onComponentTag( Component component, ComponentTag tag )
> {
>replaceComponentTagBody( getMarkupStream(), tag,
>" component.getMarkupId()
>+ "-span\">" + component.getDefaultModelObjectAsString()
>
>+ "" );
>super.onComponentTag( component, tag );
>}
>
>}
>
> }
> 
>
> So, this code works fine with usual drop down choices. But, when I'm trying
> to update list of choice via AJAX call, another span element appear on the
> page. So, I get that  tag is added any time dropdownchoice is
> rendered. Could you help me to resolve this issue?
>
> Best regards, Alexander.
>


Portlet 1.0 on Wicket 1.4?

2009-03-03 Thread German Morales
Hi all,

I've been reading in different threads that Wicket 1.4 already supports
Portlet 2.0 API.
We are already trying it with different success, in different portals.

We have an application being developed in Wicket 1.3.5 (last stable release
so far), and we planned to switch to 1.4.
But customers have yet not migrated to portals with Portlet 2.0 support, and
perhaps they won't in some (long) time.
That means that perhaps we get stuck in wicket 1.3.x, or we have to maintain
2 versions (since wicket 1.4 is not compatible with 1.3).

So i was thinking... what are the chances of getting Portlet-1.0-only
support in Wicket 1.4?
Could the portlet support in wicket 1.4 be separated somehow, so we can plug
Portlet 1.0 for some customers, Portlet 2.0 for others?

Thanks in advance,

German


Re: different modal windows from same link or just multiple links?

2009-01-23 Thread German Morales
Hi Steve,

Excuse me if i'm missing something...

Shouldn't you just provide different panels to the window, depending on your
condition?
That is, inside your onClick(), calling setContent(new YourPanel());

On the code you show, i don't see where you set the content to the window...
are you doing it in advance? (that could be a bad idea).

Regards,

German


2009/1/23 Steve Swinsburg 

> Hi all,
> I have a situation where depending on some circumstances, any one of three
> different modal windows could be activated by clicking a single link, which
> itself changes.
>
> ie add/confirm/remove
>
> but only one can be visible at any one time. I don't want three links. Is
> there any way to do this by setting the onClick handler of the AjaxLink that
> normally just contains:
> final AjaxLink connectionLink = new AjaxLink("connectionLink") {
> public void onClick(AjaxRequestTarget target) {
>  connectionWindow.show(target);
> }
> };
>
> to be dynamically set, ie connectionWindow.show(target); is set at a later
> stage.
>
> Or will I just need multiple modal window placeholders and multiple links
> and just show/hide the relevant ones?
>
> I would also need the connectionWindow.setWindowClosedCallback
> to react differently based on which modal window was closed.
>
> Is there any point in what I am trying to do or should I just suck it up
> and have three links/windows and control visibility? Will I achieve any
> major performance hits by tripling everything?
>
>
> cheers,
> Steve
>
>
>
>
>
>
>


Re: Modal window position - always centred, even on long page

2009-01-23 Thread German Morales
Hi Steve,

I answer quickly with some ideas, perhaps it helps.

It seems that you need a different implementation of the center method
provided by ModalWindow.

You can see the original in modal.js, in the package
org.apache.wicket.extensions.ajax.markup.html.modal.res of the
wicket-extensions.
You should attempt centering the window to the current browser window,
instead of the viewport.

You could provide an own javascript with a content like:

   Wicket.Window.prototype.center = function() {
  // your own version
   };

Hope this helps,

German


2009/1/23 Steve Swinsburg 

> Hi all,
>
> I have a fairly long page making use of Modal Windows, and any ModalWindow
> that I place onto this page always renders in the exact centre of the page
> (vertically). So if the button that opens the window is at the top, you need
> to scroll down to get to the window. Likewise if the button is at the
> bottom, you'll need to scroll up. This is a pain because sometimes the
> screen just dims out but the window is off screen.
>
> How can I control where the Modal Window is placed on the screen
> vertically? Doesn't seem to be any options.
>
> BTW this is inside an iframe which takes up most of the screen (but not
> all). Ideally I'd like the mask to extend over the whole window, not just
> the part that the iframe is in (which it currently does, but I can live with
> that)
>
>
> cheers,
> Steve
>
>
>
>
>


Re: Portlet related issues

2009-01-23 Thread German Morales
Well, i haven't tried but from what i see the images suggestion should
work...

By the way, i see that there is a chance of conflict between our CSSs and
the ones of the portal, and other portlets.

I'm understanding now that it's not that simple to take a working wicket
application and deploying it as a portlet.
Is there anything else we should consider?
(I'm having some trouble with some javascript too, i didn't have time to
check the reason yet).

Additionally, how do i get access to portal services like single sing-on?

Thanks for the help,

German

2009/1/22 German Morales 

> Hi Serkan,
>
> Thanks for the answer, i will give it a try and post the results later
>
> German
>
> 2009/1/22 Serkan Camurcuoglu 
>
> 1. To overcome this problem in my application I put my css and image files
>> into the jetspeed layout template directory, for example
>> /jetspeed/decorations/layout/tigris/css/styles.css and modified the template
>> velocity file to include my css file.
>>
>> 2. I think that's normal, and I think it would be impossible to confine
>> the modal window within your portlet div since it's on a different z-index.
>> If you want it to look better, you can try to style the modal window to
>> better suit your portal page.
>>
>> hope this helps..
>>
>> SerkanC
>>
>>
>>
>>
>>
>> German Morales wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to run an existing wicket application as a Portlet.
>>> I've chosen Jetspeed-2, because it's Apache too, and i've also read in
>>> the
>>> list that people working in the Portlet support also work in Jetspeed
>>> development.
>>>
>>> I've got some success, specially following this HowTo:
>>> http://cwiki.apache.org/WICKET/portal-howto.html
>>>
>>> After some effort, my application is basically running.
>>> However, i'm having trouble with some issues:
>>>
>>> 1. CSS references to images (as div backgrounds).
>>>   I've read in some forums and it seems to be generic problem in portals.
>>>   CSS have URLs to images, which the portal does not transform to provide
>>> a
>>> redirection.
>>>   The browser, then asks for the images to the portal server directly, no
>>> redirection is done to the portlet application.
>>>   Any tips on how to solve this?
>>>   (there seems to be a workaround for WebLogic portal:
>>> http://www.gexperts.com/blog/archives/2007/12/entry_20.html)
>>>
>>> 2. ModalWindow
>>>   ModalWindow works by hanging (with javascript) a new div from the body
>>> of
>>> the current document.
>>>   This works wonderful when Wicket is the owner of the page.
>>>   However, the application is now inside a portlet "window", not in the
>>> whole page.
>>>   When ModalWindow hangs from the page as usual, it looks odd... it's
>>> outside the portlet window.
>>>   Any ideas?
>>>
>>> Thanks in advance,
>>>
>>> German
>>>
>>>
>>>
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>


Re: Portlet related issues

2009-01-22 Thread German Morales
Hi Serkan,

Thanks for the answer, i will give it a try and post the results later

German

2009/1/22 Serkan Camurcuoglu 

> 1. To overcome this problem in my application I put my css and image files
> into the jetspeed layout template directory, for example
> /jetspeed/decorations/layout/tigris/css/styles.css and modified the template
> velocity file to include my css file.
>
> 2. I think that's normal, and I think it would be impossible to confine the
> modal window within your portlet div since it's on a different z-index. If
> you want it to look better, you can try to style the modal window to better
> suit your portal page.
>
> hope this helps..
>
> SerkanC
>
>
>
>
>
> German Morales wrote:
>
>> Hi all,
>>
>> I'm trying to run an existing wicket application as a Portlet.
>> I've chosen Jetspeed-2, because it's Apache too, and i've also read in the
>> list that people working in the Portlet support also work in Jetspeed
>> development.
>>
>> I've got some success, specially following this HowTo:
>> http://cwiki.apache.org/WICKET/portal-howto.html
>>
>> After some effort, my application is basically running.
>> However, i'm having trouble with some issues:
>>
>> 1. CSS references to images (as div backgrounds).
>>   I've read in some forums and it seems to be generic problem in portals.
>>   CSS have URLs to images, which the portal does not transform to provide
>> a
>> redirection.
>>   The browser, then asks for the images to the portal server directly, no
>> redirection is done to the portlet application.
>>   Any tips on how to solve this?
>>   (there seems to be a workaround for WebLogic portal:
>> http://www.gexperts.com/blog/archives/2007/12/entry_20.html)
>>
>> 2. ModalWindow
>>   ModalWindow works by hanging (with javascript) a new div from the body
>> of
>> the current document.
>>   This works wonderful when Wicket is the owner of the page.
>>   However, the application is now inside a portlet "window", not in the
>> whole page.
>>   When ModalWindow hangs from the page as usual, it looks odd... it's
>> outside the portlet window.
>>   Any ideas?
>>
>> Thanks in advance,
>>
>> German
>>
>>
>>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Portlet related issues

2009-01-22 Thread German Morales
Hi all,

I'm trying to run an existing wicket application as a Portlet.
I've chosen Jetspeed-2, because it's Apache too, and i've also read in the
list that people working in the Portlet support also work in Jetspeed
development.

I've got some success, specially following this HowTo:
http://cwiki.apache.org/WICKET/portal-howto.html

After some effort, my application is basically running.
However, i'm having trouble with some issues:

1. CSS references to images (as div backgrounds).
   I've read in some forums and it seems to be generic problem in portals.
   CSS have URLs to images, which the portal does not transform to provide a
redirection.
   The browser, then asks for the images to the portal server directly, no
redirection is done to the portlet application.
   Any tips on how to solve this?
   (there seems to be a workaround for WebLogic portal:
http://www.gexperts.com/blog/archives/2007/12/entry_20.html)

2. ModalWindow
   ModalWindow works by hanging (with javascript) a new div from the body of
the current document.
   This works wonderful when Wicket is the owner of the page.
   However, the application is now inside a portlet "window", not in the
whole page.
   When ModalWindow hangs from the page as usual, it looks odd... it's
outside the portlet window.
   Any ideas?

Thanks in advance,

German


Re: Automated testing of Wicket applications

2008-09-12 Thread German Morales
2008/9/12 Jan Stette <[EMAIL PROTECTED]>

> Hi German, thanks for an interesting reply.
>
> Ruby probably wouldn't be appropriate in our environment, but it's still
> interesting to see the principles involved in writing tests using it.  Some
> points I'm not clear about:
>
> When Wicket generates pages, as far as I can tell, the wicket:id that's
> stated in the markup just shows the local wicket:id, not the full path.  So
> how can you refer to the item by the whole path, as in your example?  (Is
> there a way to change which ids are rendered in the markup?)


Yes, the wicket id is not usable to search the components, because wicket
adds some extra characters in runtime.

Normally, the "name" attribute should be good enough, and that's what we are
using.

>From FormComponent#getInputName:
/**
 * Gets the string to be used for the name attribute of the form
element. Generated
 * using the path from the form to the component, excluding the form
itself. ...
 * ...
 */

You should see attributes generated like:
   panel1:panel2:form:panel3:innerForm:whateverElse:YourComponentID

I'm also interested in what you say about using generated attributes.  One
> of the problems we're facing is that our application is highly dynamic, the
> exact structure of a page depends on user configuration and setup.  So I
> was
> thinking about something like using AttributeModifiers to set known ids on
> certain key components on a page.  Is this what you mean by "generated
> attributes"?


Yes, that's a possible way. Also i was mentioning it for components that do
not have a name, like Links.
They are not FormComponents, but you still want to find them.


> Then, to make it all more interesting, there's Ajax.  Our application makes
> heavy use of Ajax, so components come and go on a page in response to Ajax
> updates.  I'm not sure which ids are available for identifying components
> in
> this case.  Looking at pages in FireBug, I can't see wicket:id tags at all,
> but I'm not sure if that's missing something...  Is this something you have
> dealt with in your testing?


>
> Regards,
> Jan
>
>
> 2008/9/12 German Morales <[EMAIL PROTECTED]>
>
> > Hi Jan,
> >
> > We are using Watir, which lets you write tests in ruby.
> >
> > And we are using mainly wicket generated names for identification of
> > components, but sometimes we use generated attributes too (for example
> 
> > does not have name), or just the text in the html.
> >
> > Since the code is all in ruby, it is in theory easy to refactor in case
> of
> > some changes.
> > For example, you can do this:
> >
> >   textfield = ie.text_field(:name,
> "your:very:long:wicket:generated:name")
> >
> > or, in case of page changes...
> >
> >   constant_defined_somewhere = "your:very:long:wicket"
> >   textfield = ie.text_field(:name, constant_defined_somewhere +
> > ":generated:name")
> >
> > then you could fix all tests just changing the constant.
> > Well, this is an explanation of a quick solution to your particular case
> of
> > changing the hierarchy.
> > But the idea is that you have a full (and good) programming language to
> do
> > things "right": refactoring, reuse, and so on.
> >
> > Beware:
> > Watir does not always runs perfectly... the tests are somehow dependent
> on
> > timing, which depends on the machine you run the tests, and other
> factors.
> > This is specially problematic in ajax calls.
> > That means that sometimes we get errors, then we run the same test again
> > and
> > it works.
> >
> > Hope this helps,
> >
> > German
> >
> > 2008/9/12 Jan Stette <[EMAIL PROTECTED]>
> >
> > > This is a bit of a general question: I'd be interested in hearing about
> > how
> > > people do automated tests of their Wicket applications.  I'm thinking
> > about
> > > system tests of the full application, not unit tests.
> > >
> > > There are of course tools like Selenium which let you automate actions
> on
> > a
> > > web application.  My colleagues with experience of this from other
> > > applications tell me that one of the main challenges is to stop test
> > cases
> > > from being very brittle by relying on the details of the generated
> > markup.
> > > It would be nice if it was possible to target components on a page in a
> > way
> > > that related them back to roughly the hierarchy of Wicket components.
>  Or
> > > 

Re: Automated testing of Wicket applications

2008-09-12 Thread German Morales
Actually there are more platforms for watir (
http://wtr.rubyforge.org/platforms.html): FireWatir and SafariWatir.

I gave a quick try to FireWatir some time ago, with no much success, but
they continue working on it.

They mention also "a Watir interface that uses Selenium".


2008/9/12 Peter Thomas <[EMAIL PROTECTED]>
>
> On Fri, Sep 12, 2008 at 8:12 PM, German Morales <[EMAIL PROTECTED]
>wrote:
>
> > Hi Jan,
> >
> > We are using Watir, which lets you write tests in ruby.
> >
>
> For those who don't want to use Ruby, Watij is the Java equivalent of
> Watir.  http://watij.com/
>
> But the problem with both Watij and Watir is that you have to use
Microsoft
> Internet Explorer.  FireFox is not supported.
>
> I use Selenium-RC with JUnit, works fine for me.  I wrote some code to run
> JUnit test methods in guranteed order for functional tests and also
> "clickAndWait".
>
> About the problem of tests being brittle and being able to use the Wicket
> id-s etc. you can look at this wiki page on JMeter and Wicket:
>
>
http://cwiki.apache.org/WICKET/wicket-and-jmeter-with-regular-expressions.html
>
> I haven't tried but maybe you can apply some of the ideas there to
Selenium
> tests.  So if you know the wicket:id beforehand, you could possibly access
> the component you need.
>
> - Peter.
>
> And we are using mainly wicket generated names for identification of
> > components, but sometimes we use generated attributes too (for example

> > does not have name), or just the text in the html.
> >
> > Since the code is all in ruby, it is in theory easy to refactor in case
of
> > some changes.
> > For example, you can do this:
> >
> >   textfield = ie.text_field(:name,
"your:very:long:wicket:generated:name")
> >
> > or, in case of page changes...
> >
> >   constant_defined_somewhere = "your:very:long:wicket"
> >   textfield = ie.text_field(:name, constant_defined_somewhere +
> > ":generated:name")
> >
> > then you could fix all tests just changing the constant.
> > Well, this is an explanation of a quick solution to your particular case
of
> > changing the hierarchy.
> > But the idea is that you have a full (and good) programming language to
do
> > things "right": refactoring, reuse, and so on.
> >
> > Beware:
> > Watir does not always runs perfectly... the tests are somehow dependent
on
> > timing, which depends on the machine you run the tests, and other
factors.
> > This is specially problematic in ajax calls.
> > That means that sometimes we get errors, then we run the same test again
> > and
> > it works.
> >
> > Hope this helps,
> >
> > German
> >
> > 2008/9/12 Jan Stette <[EMAIL PROTECTED]>
> >
> > > This is a bit of a general question: I'd be interested in hearing
about
> > how
> > > people do automated tests of their Wicket applications.  I'm thinking
> > about
> > > system tests of the full application, not unit tests.
> > >
> > > There are of course tools like Selenium which let you automate actions
on
> > a
> > > web application.  My colleagues with experience of this from other
> > > applications tell me that one of the main challenges is to stop test
> > cases
> > > from being very brittle by relying on the details of the generated
> > markup.
> > > It would be nice if it was possible to target components on a page in
a
> > way
> > > that related them back to roughly the hierarchy of Wicket components.
 Or
> > > even better, if individual parts of the page (links, input fields,
> > buttons
> > > etc.) could be identified in a way that didn't break when there were
> > > changes
> > > to the Wicket component hierarchy (say, new grouping components being
> > > inserted higher up in the component tree).
> > >
> > > I realise this isn't the responsibility of Wicket, but are there ways
in
> > > which Wicket can help here, e.g. by generating ids or other attributes
> > > inside the markup in a way that makes it easier to locate items on a
> > page?
> > > Are there other tools than Selenium that people use, that makes things
> > > easier?
> > >
> > > I'm looking forward to hearing about how other Wicket users deal with
> > these
> > > issues!
> > >
> > > Regards,
> > > Jan
> > >
> >


Re: Automated testing of Wicket applications

2008-09-12 Thread German Morales
Hi Jan,

We are using Watir, which lets you write tests in ruby.

And we are using mainly wicket generated names for identification of
components, but sometimes we use generated attributes too (for example 
does not have name), or just the text in the html.

Since the code is all in ruby, it is in theory easy to refactor in case of
some changes.
For example, you can do this:

   textfield = ie.text_field(:name, "your:very:long:wicket:generated:name")

or, in case of page changes...

   constant_defined_somewhere = "your:very:long:wicket"
   textfield = ie.text_field(:name, constant_defined_somewhere +
":generated:name")

then you could fix all tests just changing the constant.
Well, this is an explanation of a quick solution to your particular case of
changing the hierarchy.
But the idea is that you have a full (and good) programming language to do
things "right": refactoring, reuse, and so on.

Beware:
Watir does not always runs perfectly... the tests are somehow dependent on
timing, which depends on the machine you run the tests, and other factors.
This is specially problematic in ajax calls.
That means that sometimes we get errors, then we run the same test again and
it works.

Hope this helps,

German

2008/9/12 Jan Stette <[EMAIL PROTECTED]>

> This is a bit of a general question: I'd be interested in hearing about how
> people do automated tests of their Wicket applications.  I'm thinking about
> system tests of the full application, not unit tests.
>
> There are of course tools like Selenium which let you automate actions on a
> web application.  My colleagues with experience of this from other
> applications tell me that one of the main challenges is to stop test cases
> from being very brittle by relying on the details of the generated markup.
> It would be nice if it was possible to target components on a page in a way
> that related them back to roughly the hierarchy of Wicket components.  Or
> even better, if individual parts of the page (links, input fields, buttons
> etc.) could be identified in a way that didn't break when there were
> changes
> to the Wicket component hierarchy (say, new grouping components being
> inserted higher up in the component tree).
>
> I realise this isn't the responsibility of Wicket, but are there ways in
> which Wicket can help here, e.g. by generating ids or other attributes
> inside the markup in a way that makes it easier to locate items on a page?
> Are there other tools than Selenium that people use, that makes things
> easier?
>
> I'm looking forward to hearing about how other Wicket users deal with these
> issues!
>
> Regards,
> Jan
>


Re: Form values lost in combination of Forms plus ModalWindow

2008-09-11 Thread German Morales
Hi again,

jira issue added:
   https://issues.apache.org/jira/browse/WICKET-1826

I've attached a quickstart project which shows my problem, has detailed
explanation, and also proposes 2 solutions (you must uncomment some code to
see it working). Of course, the solutions work for my particular case, but
as you told me, it is not the way it is supposed to be.

Meanwhile (i guess it can take a while until someone looks into it), could
you at least tell me if there could be any side effect in overriding
isInputNullable for CheckBox, DropDownChoice, and so on? (TextField already
does it).

Thanks again,

German


2008/9/10 Matej Knopp <[EMAIL PROTECTED]>

> On Wed, Sep 10, 2008 at 10:49 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > I don't see any div inside span in my stuff (we have suffered problems
> with
> > this long ago, and we are more careful lately).
> >
> > Besides that, is it ok that the ModalWindow creates its own div at body
> > level? Isn't that the reason of my problem?
> That is intentional. I don't think that should cause you the problems.
>
> -Matej
> >
> > German
> >
> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >
> >> Check if your DOM hierarchy is valid, e.g. if you don't have any 
> >> tag inside  tags.
> >>
> >> -Matej
> >>
> >> On Wed, Sep 10, 2008 at 10:08 PM, German Morales
> >> <[EMAIL PROTECTED]> wrote:
> >> > I think that we are closer to the problem now...
> >> >
> >> > In my case (going back to the original post), the form i'm submitting
> is
> >> > inside a ModalWindow.
> >> >
> >> > I'm using Firebug to see the generated DOM in runtime, and i find this
> >> > (extracted...) before calling the ModalWindow:
> >> >
> >> > 
> >> >window>
> >> >  
> >> >   
> >> >   
> >> > 
> >> >
> >> > after calling the modal window:
> >> >
> >> > 
> >> >window>
> >> >  
> >> >   
> >> >   
> >> >   
> >> >  
> >> >   
> >> > 
> >> >
> >> > I think that it's ok that the second form is rendered as form, since
> it
> >> does
> >> > not have another form outside (to be rendered as div).
> >> > The problem is that ModalWindow inserted a div outside my root form.
> >> > Therefore Wicket.Form.serialize() must be serializing up to that
> second
> >> > form.
> >> >
> >> > I'm looking at the live Modal window example
> >> > http://www.wicket-library.com/wicket-examples/ajax/modal-window.1
> >> > and i see that this behavior of adding a separated div at body level
> is
> >> > "normal", not something strange in my structure.
> >> >
> >> > German
> >> >
> >> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >> >
> >> >> You are right. It calls Wicket.Form.serialize(form) with the nested
> >> >> form, but the serialize method should find parent with  tag
> name
> >> >> and serialize that.
> >> >>
> >> >> -Matej
> >> >>
> >> >>
> >> >> On Wed, Sep 10, 2008 at 9:04 PM, German Morales
> >> >> <[EMAIL PROTECTED]> wrote:
> >> >> > There are no nested form tags, as expected... let me give you more
> >> >> details
> >> >> > i'm discovering:
> >> >> >
> >> >> > The AjaxSubmitLink has something like this...
> >> >> >  function onclick(event) {
> >> >> >   var wcall = wicketSubmitFormById(" < id of my nested form > ");
> >> >> >   return false;
> >> >> >  }
> >> >> >
> >> >> > This calls wicketSubmitFormById, no surprises...
> >> >> >  function wicketSubmitFormById(formId, url, submitButton,
> >> successHandler,
> >> >> > failureHandler, precondition, channel) {
> >> >> >   var call = new Wicket.Ajax.Call(url, successHandler,
> failureHandler,
> >> >> > channel);
> >> >> >   ...
> >> >> >   return call.submitFormById(formId, submitButton);
> >> >> >  }
> >> >> >
> >> >> > which calls submitFormById...
> >> >&g

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
I have a quickstart project, should i send it privately?

2008/9/10 German Morales <[EMAIL PROTECTED]>

> I don't see any div inside span in my stuff (we have suffered problems with
> this long ago, and we are more careful lately).
>
> Besides that, is it ok that the ModalWindow creates its own div at body
> level? Isn't that the reason of my problem?
>
>
> German
>
> 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
>
>> Check if your DOM hierarchy is valid, e.g. if you don't have any 
>> tag inside  tags.
>>
>> -Matej
>>
>> On Wed, Sep 10, 2008 at 10:08 PM, German Morales
>> <[EMAIL PROTECTED]> wrote:
>> > I think that we are closer to the problem now...
>> >
>> > In my case (going back to the original post), the form i'm submitting is
>> > inside a ModalWindow.
>> >
>> > I'm using Firebug to see the generated DOM in runtime, and i find this
>> > (extracted...) before calling the ModalWindow:
>> >
>> > 
>> >   > window>
>> >  
>> >   
>> >   
>> > 
>> >
>> > after calling the modal window:
>> >
>> > 
>> >   > window>
>> >  
>> >   
>> >   
>> >   
>> >  
>> >   
>> > 
>> >
>> > I think that it's ok that the second form is rendered as form, since it
>> does
>> > not have another form outside (to be rendered as div).
>> > The problem is that ModalWindow inserted a div outside my root form.
>> > Therefore Wicket.Form.serialize() must be serializing up to that second
>> > form.
>> >
>> > I'm looking at the live Modal window example
>> > http://www.wicket-library.com/wicket-examples/ajax/modal-window.1
>> > and i see that this behavior of adding a separated div at body level is
>> > "normal", not something strange in my structure.
>> >
>> > German
>> >
>> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
>> >
>> >> You are right. It calls Wicket.Form.serialize(form) with the nested
>> >> form, but the serialize method should find parent with  tag name
>> >> and serialize that.
>> >>
>> >> -Matej
>> >>
>> >>
>> >> On Wed, Sep 10, 2008 at 9:04 PM, German Morales
>> >> <[EMAIL PROTECTED]> wrote:
>> >> > There are no nested form tags, as expected... let me give you more
>> >> details
>> >> > i'm discovering:
>> >> >
>> >> > The AjaxSubmitLink has something like this...
>> >> >  function onclick(event) {
>> >> >   var wcall = wicketSubmitFormById(" < id of my nested form > ");
>> >> >   return false;
>> >> >  }
>> >> >
>> >> > This calls wicketSubmitFormById, no surprises...
>> >> >  function wicketSubmitFormById(formId, url, submitButton,
>> successHandler,
>> >> > failureHandler, precondition, channel) {
>> >> >   var call = new Wicket.Ajax.Call(url, successHandler,
>> failureHandler,
>> >> > channel);
>> >> >   ...
>> >> >   return call.submitFormById(formId, submitButton);
>> >> >  }
>> >> >
>> >> > which calls submitFormById...
>> >> >  submitFormById: function(formId, submitButton) {
>> >> >   var form = Wicket.$(formId);
>> >> >   ...
>> >> >   return this.submitForm(form, submitButton);
>> >> >  }
>> >> >
>> >> > which calls submitForm passing my nested form (i'm debugging with
>> >> Firebug)
>> >> >  // Submits a form using ajax.
>> >> >  // This method serializes a form and sends it as POST body.
>> >> >  submitForm: function(form, submitButton) {
>> >> >   var body = function() {
>> >> > var s = Wicket.Form.serialize(form);
>> >> > if (submitButton != null) {
>> >> >   s += Wicket.Form.encode(submitButton) + "=1";
>> >> > }
>> >> > return s;
>> >> >   }
>> >> >   return this.request.post(body);
>> >> >  }
>> >> >
>> >> > which ultimately calls Wicket.Form.serialize(form) with my nested
>> form,
>> >> not
>> >> > with the root form.
>> >&g

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
I don't see any div inside span in my stuff (we have suffered problems with
this long ago, and we are more careful lately).

Besides that, is it ok that the ModalWindow creates its own div at body
level? Isn't that the reason of my problem?

German

2008/9/10 Matej Knopp <[EMAIL PROTECTED]>

> Check if your DOM hierarchy is valid, e.g. if you don't have any 
> tag inside  tags.
>
> -Matej
>
> On Wed, Sep 10, 2008 at 10:08 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > I think that we are closer to the problem now...
> >
> > In my case (going back to the original post), the form i'm submitting is
> > inside a ModalWindow.
> >
> > I'm using Firebug to see the generated DOM in runtime, and i find this
> > (extracted...) before calling the ModalWindow:
> >
> > 
> >   
> >  
> >   
> >   
> > 
> >
> > after calling the modal window:
> >
> > 
> >   
> >  
> >   
> >   
> >   
> >  
> >   
> > 
> >
> > I think that it's ok that the second form is rendered as form, since it
> does
> > not have another form outside (to be rendered as div).
> > The problem is that ModalWindow inserted a div outside my root form.
> > Therefore Wicket.Form.serialize() must be serializing up to that second
> > form.
> >
> > I'm looking at the live Modal window example
> > http://www.wicket-library.com/wicket-examples/ajax/modal-window.1
> > and i see that this behavior of adding a separated div at body level is
> > "normal", not something strange in my structure.
> >
> > German
> >
> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >
> >> You are right. It calls Wicket.Form.serialize(form) with the nested
> >> form, but the serialize method should find parent with  tag name
> >> and serialize that.
> >>
> >> -Matej
> >>
> >>
> >> On Wed, Sep 10, 2008 at 9:04 PM, German Morales
> >> <[EMAIL PROTECTED]> wrote:
> >> > There are no nested form tags, as expected... let me give you more
> >> details
> >> > i'm discovering:
> >> >
> >> > The AjaxSubmitLink has something like this...
> >> >  function onclick(event) {
> >> >   var wcall = wicketSubmitFormById(" < id of my nested form > ");
> >> >   return false;
> >> >  }
> >> >
> >> > This calls wicketSubmitFormById, no surprises...
> >> >  function wicketSubmitFormById(formId, url, submitButton,
> successHandler,
> >> > failureHandler, precondition, channel) {
> >> >   var call = new Wicket.Ajax.Call(url, successHandler, failureHandler,
> >> > channel);
> >> >   ...
> >> >   return call.submitFormById(formId, submitButton);
> >> >  }
> >> >
> >> > which calls submitFormById...
> >> >  submitFormById: function(formId, submitButton) {
> >> >   var form = Wicket.$(formId);
> >> >   ...
> >> >   return this.submitForm(form, submitButton);
> >> >  }
> >> >
> >> > which calls submitForm passing my nested form (i'm debugging with
> >> Firebug)
> >> >  // Submits a form using ajax.
> >> >  // This method serializes a form and sends it as POST body.
> >> >  submitForm: function(form, submitButton) {
> >> >   var body = function() {
> >> > var s = Wicket.Form.serialize(form);
> >> > if (submitButton != null) {
> >> >   s += Wicket.Form.encode(submitButton) + "=1";
> >> > }
> >> > return s;
> >> >   }
> >> >   return this.request.post(body);
> >> >  }
> >> >
> >> > which ultimately calls Wicket.Form.serialize(form) with my nested
> form,
> >> not
> >> > with the root form.
> >> >
> >> > Am i right?
> >> >
> >> > German
> >> >
> >> > PS: meanwhile i'm trying to produce a quickstart... but i guess it
> will
> >> take
> >> > me some time.
> >> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >> >
> >> >> But that is exactly what should happen. Wicket javascript should find
> >> >> root form element and serialize that. Can you please check in your
> >> >> markup if there are any nested form tags? (shouldn't be).
> >> >

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
I think that we are closer to the problem now...

In my case (going back to the original post), the form i'm submitting is
inside a ModalWindow.

I'm using Firebug to see the generated DOM in runtime, and i find this
(extracted...) before calling the ModalWindow:


   
  
   
   


after calling the modal window:


   
  
   
   
   
  
   


I think that it's ok that the second form is rendered as form, since it does
not have another form outside (to be rendered as div).
The problem is that ModalWindow inserted a div outside my root form.
Therefore Wicket.Form.serialize() must be serializing up to that second
form.

I'm looking at the live Modal window example
http://www.wicket-library.com/wicket-examples/ajax/modal-window.1
and i see that this behavior of adding a separated div at body level is
"normal", not something strange in my structure.

German

2008/9/10 Matej Knopp <[EMAIL PROTECTED]>

> You are right. It calls Wicket.Form.serialize(form) with the nested
> form, but the serialize method should find parent with  tag name
> and serialize that.
>
> -Matej
>
>
> On Wed, Sep 10, 2008 at 9:04 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > There are no nested form tags, as expected... let me give you more
> details
> > i'm discovering:
> >
> > The AjaxSubmitLink has something like this...
> >  function onclick(event) {
> >   var wcall = wicketSubmitFormById(" < id of my nested form > ");
> >   return false;
> >  }
> >
> > This calls wicketSubmitFormById, no surprises...
> >  function wicketSubmitFormById(formId, url, submitButton, successHandler,
> > failureHandler, precondition, channel) {
> >   var call = new Wicket.Ajax.Call(url, successHandler, failureHandler,
> > channel);
> >   ...
> >   return call.submitFormById(formId, submitButton);
> >  }
> >
> > which calls submitFormById...
> >  submitFormById: function(formId, submitButton) {
> >   var form = Wicket.$(formId);
> >   ...
> >   return this.submitForm(form, submitButton);
> >  }
> >
> > which calls submitForm passing my nested form (i'm debugging with
> Firebug)
> >  // Submits a form using ajax.
> >  // This method serializes a form and sends it as POST body.
> >  submitForm: function(form, submitButton) {
> >   var body = function() {
> > var s = Wicket.Form.serialize(form);
> > if (submitButton != null) {
> >   s += Wicket.Form.encode(submitButton) + "=1";
> > }
> > return s;
> >   }
> >   return this.request.post(body);
> >  }
> >
> > which ultimately calls Wicket.Form.serialize(form) with my nested form,
> not
> > with the root form.
> >
> > Am i right?
> >
> > German
> >
> > PS: meanwhile i'm trying to produce a quickstart... but i guess it will
> take
> > me some time.
> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >
> >> But that is exactly what should happen. Wicket javascript should find
> >> root form element and serialize that. Can you please check in your
> >> markup if there are any nested form tags? (shouldn't be).
> >>
> >> -Matej
> >>
> >> On Wed, Sep 10, 2008 at 8:11 PM, German Morales
> >> <[EMAIL PROTECTED]> wrote:
> >> > That would be somehow complicated to produce right now.
> >> >
> >> > To make my question different... why the javascript side sends only
> the
> >> > nested form info (wicketSubmitFormById()) and on wicket side the root
> >> form
> >> > is the one that gets called?
> >> >
> >> > I've already tried and it works ok if i make the nested form do the
> >> > processing instead of the root form.
> >> >protected void onEvent(AjaxRequestTarget target) {
> >> >getForm().onFormSubmitted();  // getRootForm() removed
> >> >
> >> > Another possibility would be that javascript side sends the values for
> >> the
> >> > root form, and then it would be ok that the root form does the
> >> processing.
> >> >
> >> > Thanks,
> >> >
> >> > German
> >> >
> >> >
> >> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >> >
> >> >> I would need a quick start to see where it is going wrong.
> >> >>
> >> >> -Matej
> >> >>
> >> >> On Wed, Sep 10, 2008 at 7:26 PM, German Morales
> >> >> <[EMAIL PROTECTED]> 

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
I'm also reading this...
http://cwiki.apache.org/WICKET/nested-forms.html
which in the case of "all forms enabled, inner form submitted" (3rd row).

the result should be:


Outer: nothing called, but input is preserved

Middle: nothing called, but input is preserved

Inner: onSubmit called

So again, i come to think that onFormSubmitted should be called in the Form
i passed to my ajax submit link, not the root form.
But perhaps i'm missing something?

Thanks for the support,

German

2008/9/10 German Morales <[EMAIL PROTECTED]>

> There are no nested form tags, as expected... let me give you more details
> i'm discovering:
>
> The AjaxSubmitLink has something like this...
>  function onclick(event) {
>var wcall = wicketSubmitFormById(" < id of my nested form > ");
>return false;
>  }
>
> This calls wicketSubmitFormById, no surprises...
>  function wicketSubmitFormById(formId, url, submitButton, successHandler,
> failureHandler, precondition, channel) {
>var call = new Wicket.Ajax.Call(url, successHandler, failureHandler,
> channel);
>...
>return call.submitFormById(formId, submitButton);
>  }
>
> which calls submitFormById...
>  submitFormById: function(formId, submitButton) {
>var form = Wicket.$(formId);
>...
>return this.submitForm(form, submitButton);
>  }
>
> which calls submitForm passing my nested form (i'm debugging with Firebug)
>  // Submits a form using ajax.
>  // This method serializes a form and sends it as POST body.
>  submitForm: function(form, submitButton) {
>var body = function() {
>  var s = Wicket.Form.serialize(form);
>  if (submitButton != null) {
>s += Wicket.Form.encode(submitButton) + "=1";
>  }
>  return s;
>}
>return this.request.post(body);
>  }
>
> which ultimately calls Wicket.Form.serialize(form) with my nested form, not
> with the root form.
>
> Am i right?
>
> German
>
> PS: meanwhile i'm trying to produce a quickstart... but i guess it will
> take me some time.
>
> 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
>
>> But that is exactly what should happen. Wicket javascript should find
>> root form element and serialize that. Can you please check in your
>> markup if there are any nested form tags? (shouldn't be).
>>
>> -Matej
>>
>> On Wed, Sep 10, 2008 at 8:11 PM, German Morales
>> <[EMAIL PROTECTED]> wrote:
>> > That would be somehow complicated to produce right now.
>> >
>> > To make my question different... why the javascript side sends only the
>> > nested form info (wicketSubmitFormById()) and on wicket side the root
>> form
>> > is the one that gets called?
>> >
>> > I've already tried and it works ok if i make the nested form do the
>> > processing instead of the root form.
>> >protected void onEvent(AjaxRequestTarget target) {
>> >getForm().onFormSubmitted();  // getRootForm() removed
>> >
>> > Another possibility would be that javascript side sends the values for
>> the
>> > root form, and then it would be ok that the root form does the
>> processing.
>> >
>> > Thanks,
>> >
>> > German
>> >
>> >
>> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
>> >
>> >> I would need a quick start to see where it is going wrong.
>> >>
>> >> -Matej
>> >>
>> >> On Wed, Sep 10, 2008 at 7:26 PM, German Morales
>> >> <[EMAIL PROTECTED]> wrote:
>> >> > Investigating a little more, my problem seems to be caused by
>> >> > AjaxFormSubmitBehavior#onEvent
>> >> >
>> >> >protected void onEvent(AjaxRequestTarget target) {
>> >> >getForm().getRootForm().onFormSubmitted();
>> >> >
>> >> > which calls onFormSubmitted on the RootForm, and not in the Form i've
>> >> passed
>> >> > to my AjaxSubmitLink.
>> >> >
>> >> > could someone explain me why it does that?
>> >> >
>> >> > In fact, overriding onEvent to call onFormSubmitted on getForm() and
>> not
>> >> in
>> >> > the root form solves my problems... but am i breaking something else?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > German
>> >> >
>> >> >
>> >> > 2008/9/9 German Morales <[EMAIL PROTECTED]>
>> >> >
>> >> >> Hi Mate

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
There are no nested form tags, as expected... let me give you more details
i'm discovering:

The AjaxSubmitLink has something like this...
 function onclick(event) {
   var wcall = wicketSubmitFormById(" < id of my nested form > ");
   return false;
 }

This calls wicketSubmitFormById, no surprises...
 function wicketSubmitFormById(formId, url, submitButton, successHandler,
failureHandler, precondition, channel) {
   var call = new Wicket.Ajax.Call(url, successHandler, failureHandler,
channel);
   ...
   return call.submitFormById(formId, submitButton);
 }

which calls submitFormById...
 submitFormById: function(formId, submitButton) {
   var form = Wicket.$(formId);
   ...
   return this.submitForm(form, submitButton);
 }

which calls submitForm passing my nested form (i'm debugging with Firebug)
 // Submits a form using ajax.
 // This method serializes a form and sends it as POST body.
 submitForm: function(form, submitButton) {
   var body = function() {
 var s = Wicket.Form.serialize(form);
 if (submitButton != null) {
   s += Wicket.Form.encode(submitButton) + "=1";
 }
 return s;
   }
   return this.request.post(body);
 }

which ultimately calls Wicket.Form.serialize(form) with my nested form, not
with the root form.

Am i right?

German

PS: meanwhile i'm trying to produce a quickstart... but i guess it will take
me some time.
2008/9/10 Matej Knopp <[EMAIL PROTECTED]>

> But that is exactly what should happen. Wicket javascript should find
> root form element and serialize that. Can you please check in your
> markup if there are any nested form tags? (shouldn't be).
>
> -Matej
>
> On Wed, Sep 10, 2008 at 8:11 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > That would be somehow complicated to produce right now.
> >
> > To make my question different... why the javascript side sends only the
> > nested form info (wicketSubmitFormById()) and on wicket side the root
> form
> > is the one that gets called?
> >
> > I've already tried and it works ok if i make the nested form do the
> > processing instead of the root form.
> >protected void onEvent(AjaxRequestTarget target) {
> >getForm().onFormSubmitted();  // getRootForm() removed
> >
> > Another possibility would be that javascript side sends the values for
> the
> > root form, and then it would be ok that the root form does the
> processing.
> >
> > Thanks,
> >
> > German
> >
> >
> > 2008/9/10 Matej Knopp <[EMAIL PROTECTED]>
> >
> >> I would need a quick start to see where it is going wrong.
> >>
> >> -Matej
> >>
> >> On Wed, Sep 10, 2008 at 7:26 PM, German Morales
> >> <[EMAIL PROTECTED]> wrote:
> >> > Investigating a little more, my problem seems to be caused by
> >> > AjaxFormSubmitBehavior#onEvent
> >> >
> >> >protected void onEvent(AjaxRequestTarget target) {
> >> >getForm().getRootForm().onFormSubmitted();
> >> >
> >> > which calls onFormSubmitted on the RootForm, and not in the Form i've
> >> passed
> >> > to my AjaxSubmitLink.
> >> >
> >> > could someone explain me why it does that?
> >> >
> >> > In fact, overriding onEvent to call onFormSubmitted on getForm() and
> not
> >> in
> >> > the root form solves my problems... but am i breaking something else?
> >> >
> >> > Thanks,
> >> >
> >> > German
> >> >
> >> >
> >> > 2008/9/9 German Morales <[EMAIL PROTECTED]>
> >> >
> >> >> Hi Matej,
> >> >>
> >> >> Thanks for the answer.
> >> >>
> >> >> I have an AjaxSubmitLink both for opening and closing the modal
> window.
> >> >> Should that make any trouble?
> >> >> In both cases i have data to persist, so it must be a .*Submit.*
> >> component.
> >> >>
> >> >> Also, my problem happens when closing the window, not when opening
> it.
> >> >> I summarize it again:
> >> >> -the browser sends an ajax call with the values in the modal window
> >> >> -but on wicket side the main form of the page is the one that takes
> >> charge
> >> >> -the components on the page then receive the new input, but there's
> >> >> actually nothing coming from the browser for them
> >> >> -some components (text components) handle it well, some not
> (checkbox,
> >> >> dropdownchoice).
> >> >

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
That would be somehow complicated to produce right now.

To make my question different... why the javascript side sends only the
nested form info (wicketSubmitFormById()) and on wicket side the root form
is the one that gets called?

I've already tried and it works ok if i make the nested form do the
processing instead of the root form.
protected void onEvent(AjaxRequestTarget target) {
getForm().onFormSubmitted();  // getRootForm() removed

Another possibility would be that javascript side sends the values for the
root form, and then it would be ok that the root form does the processing.

Thanks,

German


2008/9/10 Matej Knopp <[EMAIL PROTECTED]>

> I would need a quick start to see where it is going wrong.
>
> -Matej
>
> On Wed, Sep 10, 2008 at 7:26 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > Investigating a little more, my problem seems to be caused by
> > AjaxFormSubmitBehavior#onEvent
> >
> >protected void onEvent(AjaxRequestTarget target) {
> >getForm().getRootForm().onFormSubmitted();
> >
> > which calls onFormSubmitted on the RootForm, and not in the Form i've
> passed
> > to my AjaxSubmitLink.
> >
> > could someone explain me why it does that?
> >
> > In fact, overriding onEvent to call onFormSubmitted on getForm() and not
> in
> > the root form solves my problems... but am i breaking something else?
> >
> > Thanks,
> >
> > German
> >
> >
> > 2008/9/9 German Morales <[EMAIL PROTECTED]>
> >
> >> Hi Matej,
> >>
> >> Thanks for the answer.
> >>
> >> I have an AjaxSubmitLink both for opening and closing the modal window.
> >> Should that make any trouble?
> >> In both cases i have data to persist, so it must be a .*Submit.*
> component.
> >>
> >> Also, my problem happens when closing the window, not when opening it.
> >> I summarize it again:
> >> -the browser sends an ajax call with the values in the modal window
> >> -but on wicket side the main form of the page is the one that takes
> charge
> >> -the components on the page then receive the new input, but there's
> >> actually nothing coming from the browser for them
> >> -some components (text components) handle it well, some not (checkbox,
> >> dropdownchoice).
> >> -the misbehaving component get a rawinput of null instead of
> NO_RAW_INPUT,
> >> which then produces the side effect that the component does not get the
> >> value from the model on rendering.
> >>
> >> Please see the doubts section at the end of the original e-mail.
> >>
> >> Thanks again,
> >>
> >> German
> >>
> >> 2008/9/9 Matej Knopp <[EMAIL PROTECTED]>
> >>
> >> The link that shows the modal window must be AjaxButton/SubmitLink.
> >>>
> >>> -Matej
> >>>
> >>> On Tue, Sep 9, 2008 at 11:20 PM, German Morales
> >>> <[EMAIL PROTECTED]> wrote:
> >>> > Hi all,
> >>> >
> >>> > I've a problem with Forms and ModalWindows.
> >>> >
> >>> > I have this stuff:
> >>> > -a page with a main Form (the only one that is rendered as an HTML
> form
> >>> tag)
> >>> > -this my only page, since all inside it is changed by replacing
> panels
> >>> using
> >>> > ajax.
> >>> > -inside some other levels of panels, i have a panel with my content
> (let
> >>> me
> >>> > call it myContentPanel), which has its own (sub) Form (which is
> rendered
> >>> as
> >>> > a div).
> >>> > -myContentPanel has some controls... TextFields, DropDownChoices,
> >>> > CheckBoxes.
> >>> > -myContentPanel has also a link that opens a ModalWindow.
> >>> > -the ModalWindow has its own Form with components, and an
> AjaxSubmitLink
> >>> to
> >>> > close it.
> >>> >
> >>> > Now the problem...
> >>> > 1- I enter to myContentPanel and enter some values in the components.
> >>> > 2- I press the link to open the ModalWindow.
> >>> > 3- I work with the ModalWindow, then press an AjaxSubmitLink to close
> >>> it.
> >>> > 4- When refreshing myContentPanel, the values in some controls is
> lost:
> >>> > CheckBoxes, DropDownChoices, but NOT in TextFields.
> >>> >
> >>> > After some investigation, this is what i've discove

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-10 Thread German Morales
Investigating a little more, my problem seems to be caused by
AjaxFormSubmitBehavior#onEvent

protected void onEvent(AjaxRequestTarget target) {
getForm().getRootForm().onFormSubmitted();

which calls onFormSubmitted on the RootForm, and not in the Form i've passed
to my AjaxSubmitLink.

could someone explain me why it does that?

In fact, overriding onEvent to call onFormSubmitted on getForm() and not in
the root form solves my problems... but am i breaking something else?

Thanks,

German


2008/9/9 German Morales <[EMAIL PROTECTED]>

> Hi Matej,
>
> Thanks for the answer.
>
> I have an AjaxSubmitLink both for opening and closing the modal window.
> Should that make any trouble?
> In both cases i have data to persist, so it must be a .*Submit.* component.
>
> Also, my problem happens when closing the window, not when opening it.
> I summarize it again:
> -the browser sends an ajax call with the values in the modal window
> -but on wicket side the main form of the page is the one that takes charge
> -the components on the page then receive the new input, but there's
> actually nothing coming from the browser for them
> -some components (text components) handle it well, some not (checkbox,
> dropdownchoice).
> -the misbehaving component get a rawinput of null instead of NO_RAW_INPUT,
> which then produces the side effect that the component does not get the
> value from the model on rendering.
>
> Please see the doubts section at the end of the original e-mail.
>
> Thanks again,
>
> German
>
> 2008/9/9 Matej Knopp <[EMAIL PROTECTED]>
>
> The link that shows the modal window must be AjaxButton/SubmitLink.
>>
>> -Matej
>>
>> On Tue, Sep 9, 2008 at 11:20 PM, German Morales
>> <[EMAIL PROTECTED]> wrote:
>> > Hi all,
>> >
>> > I've a problem with Forms and ModalWindows.
>> >
>> > I have this stuff:
>> > -a page with a main Form (the only one that is rendered as an HTML form
>> tag)
>> > -this my only page, since all inside it is changed by replacing panels
>> using
>> > ajax.
>> > -inside some other levels of panels, i have a panel with my content (let
>> me
>> > call it myContentPanel), which has its own (sub) Form (which is rendered
>> as
>> > a div).
>> > -myContentPanel has some controls... TextFields, DropDownChoices,
>> > CheckBoxes.
>> > -myContentPanel has also a link that opens a ModalWindow.
>> > -the ModalWindow has its own Form with components, and an AjaxSubmitLink
>> to
>> > close it.
>> >
>> > Now the problem...
>> > 1- I enter to myContentPanel and enter some values in the components.
>> > 2- I press the link to open the ModalWindow.
>> > 3- I work with the ModalWindow, then press an AjaxSubmitLink to close
>> it.
>> > 4- When refreshing myContentPanel, the values in some controls is lost:
>> > CheckBoxes, DropDownChoices, but NOT in TextFields.
>> >
>> > After some investigation, this is what i've discovered:
>> > -on step 3 (accept and close the ModalWindow), the AjaxSubmitLink calls
>> > (javascript) wicketSubmitFormById passing the ModalWindow's form as
>> > parameter.
>> > -this processes the ModalWindow's form and prepares the values to be
>> sent to
>> > wicket side.
>> > -but when i see the url, it mentions that the form that will be used for
>> the
>> > HTTP request is the page's form (because it's the only real form, i
>> think
>> > this is normal).
>> > -on wicket side, the request processing calls Form#onFormSubmitted,
>> which
>> > calls #inputChanged, which calls a visitor visiting all components... in
>> the
>> > main form!
>> > -this ends up calling FormComponent#inputChanged on the CheckBoxes,
>> > DropDownChoices, TextFields that where in myContentPanel (also for the
>> > controls in the ModalWindow, but that's no surprise).
>> > -given that the javascript only prepared the data for the ModalWindow's
>> > form, the values for the components in myContentPanel is empty.
>> > -looking deeper in #inputChanged, getInputAsArray() gives null for the
>> > components in myContentPanel.
>> > -then, since CheckBox and DropDownChoice answer true to
>> isInputNullable()
>> > (default in FormComponent), the rawInput is set to null, even if i
>> didn't
>> > touch the CheckBoxes/DropDownChoices at all in this call (then losing
>> the
>> > previous value: NO_RAW_INPUT).
>> > -on step 4, whe

Re: Form values lost in combination of Forms plus ModalWindow

2008-09-09 Thread German Morales
Hi Matej,

Thanks for the answer.

I have an AjaxSubmitLink both for opening and closing the modal window.
Should that make any trouble?
In both cases i have data to persist, so it must be a .*Submit.* component.

Also, my problem happens when closing the window, not when opening it.
I summarize it again:
-the browser sends an ajax call with the values in the modal window
-but on wicket side the main form of the page is the one that takes charge
-the components on the page then receive the new input, but there's actually
nothing coming from the browser for them
-some components (text components) handle it well, some not (checkbox,
dropdownchoice).
-the misbehaving component get a rawinput of null instead of NO_RAW_INPUT,
which then produces the side effect that the component does not get the
value from the model on rendering.

Please see the doubts section at the end of the original e-mail.

Thanks again,

German

2008/9/9 Matej Knopp <[EMAIL PROTECTED]>

> The link that shows the modal window must be AjaxButton/SubmitLink.
>
> -Matej
>
> On Tue, Sep 9, 2008 at 11:20 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I've a problem with Forms and ModalWindows.
> >
> > I have this stuff:
> > -a page with a main Form (the only one that is rendered as an HTML form
> tag)
> > -this my only page, since all inside it is changed by replacing panels
> using
> > ajax.
> > -inside some other levels of panels, i have a panel with my content (let
> me
> > call it myContentPanel), which has its own (sub) Form (which is rendered
> as
> > a div).
> > -myContentPanel has some controls... TextFields, DropDownChoices,
> > CheckBoxes.
> > -myContentPanel has also a link that opens a ModalWindow.
> > -the ModalWindow has its own Form with components, and an AjaxSubmitLink
> to
> > close it.
> >
> > Now the problem...
> > 1- I enter to myContentPanel and enter some values in the components.
> > 2- I press the link to open the ModalWindow.
> > 3- I work with the ModalWindow, then press an AjaxSubmitLink to close it.
> > 4- When refreshing myContentPanel, the values in some controls is lost:
> > CheckBoxes, DropDownChoices, but NOT in TextFields.
> >
> > After some investigation, this is what i've discovered:
> > -on step 3 (accept and close the ModalWindow), the AjaxSubmitLink calls
> > (javascript) wicketSubmitFormById passing the ModalWindow's form as
> > parameter.
> > -this processes the ModalWindow's form and prepares the values to be sent
> to
> > wicket side.
> > -but when i see the url, it mentions that the form that will be used for
> the
> > HTTP request is the page's form (because it's the only real form, i think
> > this is normal).
> > -on wicket side, the request processing calls Form#onFormSubmitted, which
> > calls #inputChanged, which calls a visitor visiting all components... in
> the
> > main form!
> > -this ends up calling FormComponent#inputChanged on the CheckBoxes,
> > DropDownChoices, TextFields that where in myContentPanel (also for the
> > controls in the ModalWindow, but that's no surprise).
> > -given that the javascript only prepared the data for the ModalWindow's
> > form, the values for the components in myContentPanel is empty.
> > -looking deeper in #inputChanged, getInputAsArray() gives null for the
> > components in myContentPanel.
> > -then, since CheckBox and DropDownChoice answer true to isInputNullable()
> > (default in FormComponent), the rawInput is set to null, even if i didn't
> > touch the CheckBoxes/DropDownChoices at all in this call (then losing the
> > previous value: NO_RAW_INPUT).
> > -on step 4, when the CheckBox/DropDownChoice wants to get rendered again,
> > onComponentTag calls FormComponent#getValue, which if
> > (NO_RAW_INPUT.equals(rawInput)) uses the Model to get the value (what i
> > would expect), but in my case returns the rawInput (null... ouch).
> >
> > I have fixed it temporaly by overriding isInputNullable in my
> > CheckBoxes/DropDownChoice, but i understand that this is not a very good
> > solution.
> >
> > Some doubts that remain:
> > -is there anything wrong with my structure of forms and panels, which is
> > actually producing these side effects?
> > -if only the values for ModalWindow form are sent to the server, why the
> is
> > onFormSubmitted called on the main page form?
> > -the javadoc in isInputNullable is not very clear for me... do i break
> > something else if i override isInputNullable answering false?
> >
> > Thanks in advance,
> >
> > German
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Form values lost in combination of Forms plus ModalWindow

2008-09-09 Thread German Morales
Hi all,

I've a problem with Forms and ModalWindows.

I have this stuff:
-a page with a main Form (the only one that is rendered as an HTML form tag)
-this my only page, since all inside it is changed by replacing panels using
ajax.
-inside some other levels of panels, i have a panel with my content (let me
call it myContentPanel), which has its own (sub) Form (which is rendered as
a div).
-myContentPanel has some controls... TextFields, DropDownChoices,
CheckBoxes.
-myContentPanel has also a link that opens a ModalWindow.
-the ModalWindow has its own Form with components, and an AjaxSubmitLink to
close it.

Now the problem...
1- I enter to myContentPanel and enter some values in the components.
2- I press the link to open the ModalWindow.
3- I work with the ModalWindow, then press an AjaxSubmitLink to close it.
4- When refreshing myContentPanel, the values in some controls is lost:
CheckBoxes, DropDownChoices, but NOT in TextFields.

After some investigation, this is what i've discovered:
-on step 3 (accept and close the ModalWindow), the AjaxSubmitLink calls
(javascript) wicketSubmitFormById passing the ModalWindow's form as
parameter.
-this processes the ModalWindow's form and prepares the values to be sent to
wicket side.
-but when i see the url, it mentions that the form that will be used for the
HTTP request is the page's form (because it's the only real form, i think
this is normal).
-on wicket side, the request processing calls Form#onFormSubmitted, which
calls #inputChanged, which calls a visitor visiting all components... in the
main form!
-this ends up calling FormComponent#inputChanged on the CheckBoxes,
DropDownChoices, TextFields that where in myContentPanel (also for the
controls in the ModalWindow, but that's no surprise).
-given that the javascript only prepared the data for the ModalWindow's
form, the values for the components in myContentPanel is empty.
-looking deeper in #inputChanged, getInputAsArray() gives null for the
components in myContentPanel.
-then, since CheckBox and DropDownChoice answer true to isInputNullable()
(default in FormComponent), the rawInput is set to null, even if i didn't
touch the CheckBoxes/DropDownChoices at all in this call (then losing the
previous value: NO_RAW_INPUT).
-on step 4, when the CheckBox/DropDownChoice wants to get rendered again,
onComponentTag calls FormComponent#getValue, which if
(NO_RAW_INPUT.equals(rawInput)) uses the Model to get the value (what i
would expect), but in my case returns the rawInput (null... ouch).

I have fixed it temporaly by overriding isInputNullable in my
CheckBoxes/DropDownChoice, but i understand that this is not a very good
solution.

Some doubts that remain:
-is there anything wrong with my structure of forms and panels, which is
actually producing these side effects?
-if only the values for ModalWindow form are sent to the server, why the is
onFormSubmitted called on the main page form?
-the javadoc in isInputNullable is not very clear for me... do i break
something else if i override isInputNullable answering false?

Thanks in advance,

German


Re: Problem rendering not visible Form with OutputMarkupPlaceholderTag

2008-09-01 Thread German Morales
Hi again,

Thanks for the answer.

https://issues.apache.org/jira/browse/WICKET-1815
I just copied the e-mail in a jira issue, is this enough?

Bye,

German


2008/9/1 Matej Knopp <[EMAIL PROTECTED]>

> This looks like a bug/design flaw. Can you please open a jira issue?
> This could be solved by having (yet another) method in component that
> would allow to postprocess the placeholder tag.
> The implementation would  be fairly simple. Or maybe we could call
> onComponentTag and then strip all the attributes. This might be better
> idea as it would be consistent with the behavior when component is
> actually rendered.
>
> -Matej
>
> On Mon, Sep 1, 2008 at 10:11 PM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > We had suffered an strange behavior, which i would like to share for
> > comments.
> > We have a Panel (loaded with ajax) with many Forms inside (because each
> > needs different models).
> > Some of these Forms are only visible under certain conditions, so we
> > overwrote isVisible with the condition.
> > Also, the Panel can be updated, so the Forms have
> > setOutputMarkupPlaceholderTag(true) to make them visible later.
> > That triggered a problem in the rendering of the ajax response.
> >
> > After some investigation, the problem seems to be:
> > -When a Form is visible, Form#onComponentTag replaces the tag "form" by
> > "div" (because it's nor the Root form of the page), this works ok.
> > -When a Form is invisible, Form#onComponentTag is never called. Instead,
> > Component#render builds the response by itself, using
> > markupStream.getTag().getName(), which answers the tag "form".
> > -Then, the ajax response has a mix of "div" and "form". Apparently, all
> goes
> > ok until the first "form" is found, then the parsing goes somehow crazy
> and
> > this first "form" gets lost from the DOM, and the next forms and divs get
> > inserted outside (one level in DOM) the main component being replaced by
> the
> > ajax call.
> >
> > We have found no way to fix it in the Form class itself. Component uses
> > markupStream.getTag() (which answers "form"). That is, it does not ask
> the
> > component for the tag to answer, but instead trusts in the HTML side. And
> we
> > can't change our html to say "div", because Form also checks (when
> visible)
> > that the tag says "form" (checkComponentTag(tag, "form")).
> >
> > The solution was to put the missbehaving forms inside Panels, which do
> not
> > suffer this problem, and then make the panels visible/invisible (also
> with
> > OutputMarkupPlaceholderTag).
> >
> > We have it running now, but we wanted to know if there was some better
> > solution, or perpahs something should be fixed to prevent future
> problems,
> > for example:
> > -inform somehow if a form is being set as invisible with
> > setOutputMarkupPlaceholderTag(true)?
> > -let Component ask itself for the tag to output in case of invisible +
> > setOutputMarkupPlaceholderTag(true), instead of just putting what the
> markup
> > says... then Form could say "no, i want a div here".
> > -other?
> >
> > Thanks in advance,
> >
> > German
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Problem rendering not visible Form with OutputMarkupPlaceholderTag

2008-09-01 Thread German Morales
Hi all,

We had suffered an strange behavior, which i would like to share for
comments.
We have a Panel (loaded with ajax) with many Forms inside (because each
needs different models).
Some of these Forms are only visible under certain conditions, so we
overwrote isVisible with the condition.
Also, the Panel can be updated, so the Forms have
setOutputMarkupPlaceholderTag(true) to make them visible later.
That triggered a problem in the rendering of the ajax response.

After some investigation, the problem seems to be:
-When a Form is visible, Form#onComponentTag replaces the tag "form" by
"div" (because it's nor the Root form of the page), this works ok.
-When a Form is invisible, Form#onComponentTag is never called. Instead,
Component#render builds the response by itself, using
markupStream.getTag().getName(), which answers the tag "form".
-Then, the ajax response has a mix of "div" and "form". Apparently, all goes
ok until the first "form" is found, then the parsing goes somehow crazy and
this first "form" gets lost from the DOM, and the next forms and divs get
inserted outside (one level in DOM) the main component being replaced by the
ajax call.

We have found no way to fix it in the Form class itself. Component uses
markupStream.getTag() (which answers "form"). That is, it does not ask the
component for the tag to answer, but instead trusts in the HTML side. And we
can't change our html to say "div", because Form also checks (when visible)
that the tag says "form" (checkComponentTag(tag, "form")).

The solution was to put the missbehaving forms inside Panels, which do not
suffer this problem, and then make the panels visible/invisible (also with
OutputMarkupPlaceholderTag).

We have it running now, but we wanted to know if there was some better
solution, or perpahs something should be fixed to prevent future problems,
for example:
-inform somehow if a form is being set as invisible with
setOutputMarkupPlaceholderTag(true)?
-let Component ask itself for the tag to output in case of invisible +
setOutputMarkupPlaceholderTag(true), instead of just putting what the markup
says... then Form could say "no, i want a div here".
-other?

Thanks in advance,

German


Re: Rare Style disabling and Ajax Panel Replacement Question

2008-06-20 Thread German Morales
Hi again,

I have come to the following conclusion so far:
-Use detailed CSS specifications is "the" way to avoid #id clashing.
-We will also keep some automatic disabling of CSSs that are no longer in
use... we will try not to rely on this mechanism though, and still use what
i said in the line above. The disabling of not used CSS will not hurt
anyway, and perhaps avoid some unexpected clashing, so why not keeping it
too, as a backup mechanism. We could discard it later too... we will see,
the main solution is the full detailed css as said above.

Thanks all for the help,

German

2008/6/18 Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]>:

>
> German Morales wrote:
>
>> Hi,
>>
>> I'm here with Francisco, discussing this subject.
>>
>> The main difference between the approach is the amount of stuff to write
>> in
>> CSS: With the detailed naming of styles (".DetailPanel-A fieldPersonName")
>> you have to write a lot more in the CSS. That is, for each field in
>> DetailPanelA, you have to go with ".DetailPanelA #fieldWhatever1",
>> ".DetailPanelA #fieldWhatever2", ".DetailPanelA #fieldWhateverN" instead
>> of
>> the shorter versions "#fieldWhatever1", "#fieldWhatever2",
>> "#fieldWhateverN". Therefore, the shorter versions should be, in theory,
>> easier to write and maintain.
>>
>>
> Yeah I see the point. But could'nt at least try to hit the fields by
> selectors: .DetailPanelA fieldset>textarea {color:black}.
>
> But on the otherhand you can have one stylesheet that fits all, that could
> be handy if you ever want todo skinning, by css only(which actually can do
> alot see css zen garden).
>
>> On the other hand, producing this "#fieldWhatever1" allows the conflict
>> between fieldWhatever1 in DetailPanelA and DetailPanelB, which means that
>> we
>> must introduce some "trick" to avoid it.
>>
> Yup popular called clashing.
>
>>  Someone here has found this
>> disabling of CSSs.
>>
> I think this approach are okay doing simple static pages. But once you
> mixin ajax trouble begin to rise, and what happens if you have two of the
> panels clashing in the same page who should win?
>
>>  It is nice because it could be handled in a somehow
>> generic way (allowing producers of DetailPanelN to be un-aware of all this
>> complication), but also we must consider that it adds some extra
>> complexity.
>>
>>
> Yes it does, but on the other hand, it lessen the burden on the css
> designer, so it's a tradoff.
>
>> I'm not completely in favor of one or another approach. The detailed style
>> version is in fact our current solution, and it has the benefit of being
>> simple. But we are trying also the CSS disabling because it has some
>> not-that-bad benefits (CSS simplification, and perhaps the possibility of
>> forget about the CSS conflicts altogether).
>>
>> That's why we would like to hear opinions, and perhaps even more
>> importantly, hear about different approaches, or about hidden traps in our
>> current attempts.
>>
>>
> Understandable.. I too are looking forward to hear different opinions:)
>
>  Thanks in advance,
>>
>> German
>>
>> 2008/6/18 Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]>:
>>
>>
>>
>>> That was my approach exactly but I lack the "arguments" to convince them.
>>> I
>>> managed to send this mail and see if I'll get better ones :-), or at
>>> least
>>> community consensus.
>>>
>>> Maybe if I started a thread I could get some other experiences and
>>> opinions
>>> on the matter.
>>>
>>> Thanks Nino.
>>>
>>> f(t)
>>>
>>> On Wed, Jun 18, 2008 at 1:49 PM, Nino Saturnino Martinez Vazquez Wael <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>>> Hi Francisco
>>>>
>>>> I'd much rather go with more detailed naming of your styles, instead of
>>>> doing complex stuff with dom? Like
>>>>
>>>> .DetailPanel-A-fieldPersonName{
>>>>  position:absolute;
>>>>  left:50px;
>>>>  top: 50px;
>>>> }
>>>>
>>>> Or maybe the problem are more complex than this..?
>>>>
>>>> Francisco Diaz Trepat - gmail wrote:
>>>>
>>>>
>>>>
>>>>> Hi all, its been a while.
>>>>>
>>&

Re: Rare Style disabling and Ajax Panel Replacement Question

2008-06-18 Thread German Morales
Igor,

Yes, in such case the only solution is the full detailed style info.
In our case, however, we talk about panels that always replace each other.
Or at least that is the common case. Perhaps finding cases that does not
follow this rule helps to solve this dilemma.

Thanks for the new point of view,

German

2008/6/18 Igor Vaynberg <[EMAIL PROTECTED]>:

> what happens if you ever need to use both panels on the page
> simultaneously. personally i would stick with the .panela selector
> stylesheets
>
> -igor
>
> On Wed, Jun 18, 2008 at 11:28 AM, German Morales
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I'm here with Francisco, discussing this subject.
> >
> > The main difference between the approach is the amount of stuff to write
> in
> > CSS: With the detailed naming of styles (".DetailPanel-A
> fieldPersonName")
> > you have to write a lot more in the CSS. That is, for each field in
> > DetailPanelA, you have to go with ".DetailPanelA #fieldWhatever1",
> > ".DetailPanelA #fieldWhatever2", ".DetailPanelA #fieldWhateverN" instead
> of
> > the shorter versions "#fieldWhatever1", "#fieldWhatever2",
> > "#fieldWhateverN". Therefore, the shorter versions should be, in theory,
> > easier to write and maintain.
> >
> > On the other hand, producing this "#fieldWhatever1" allows the conflict
> > between fieldWhatever1 in DetailPanelA and DetailPanelB, which means that
> we
> > must introduce some "trick" to avoid it. Someone here has found this
> > disabling of CSSs. It is nice because it could be handled in a somehow
> > generic way (allowing producers of DetailPanelN to be un-aware of all
> this
> > complication), but also we must consider that it adds some extra
> complexity.
> >
> > I'm not completely in favor of one or another approach. The detailed
> style
> > version is in fact our current solution, and it has the benefit of being
> > simple. But we are trying also the CSS disabling because it has some
> > not-that-bad benefits (CSS simplification, and perhaps the possibility of
> > forget about the CSS conflicts altogether).
> >
> > That's why we would like to hear opinions, and perhaps even more
> > importantly, hear about different approaches, or about hidden traps in
> our
> > current attempts.
> >
> > Thanks in advance,
> >
> > German
> >
> > 2008/6/18 Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]
> >:
> >
> >> That was my approach exactly but I lack the "arguments" to convince
> them. I
> >> managed to send this mail and see if I'll get better ones :-), or at
> least
> >> community consensus.
> >>
> >> Maybe if I started a thread I could get some other experiences and
> opinions
> >> on the matter.
> >>
> >> Thanks Nino.
> >>
> >> f(t)
> >>
> >> On Wed, Jun 18, 2008 at 1:49 PM, Nino Saturnino Martinez Vazquez Wael <
> >> [EMAIL PROTECTED]> wrote:
> >>
> >> > Hi Francisco
> >> >
> >> > I'd much rather go with more detailed naming of your styles, instead
> of
> >> > doing complex stuff with dom? Like
> >> >
> >> > .DetailPanel-A-fieldPersonName{
> >> >  position:absolute;
> >> >  left:50px;
> >> >  top: 50px;
> >> > }
> >> >
> >> > Or maybe the problem are more complex than this..?
> >> >
> >> > Francisco Diaz Trepat - gmail wrote:
> >> >
> >> >> Hi all, its been a while.
> >> >>
> >> >> Finally we started migrating other applications from swing to wicket
> >> >> thanks
> >> >> to all your help provided last year.
> >> >>
> >> >> Having said that, I have some colleagues that are looking to develop
> a
> >> way
> >> >> to disable style sheets that are loaded as part of panel replacement.
> >> >>
> >> >> Here is the Scenario:
> >> >>
> >> >> we have a classic web structure: left menu, top header, and center to
> >> >> right
> >> >> "Detail" area.
> >> >>
> >> >> The detail area is replaced by wicket-ajax functions and each panel
> >> >> usually
> >> >> has an overriden renderHead with code similar to this one:
> >> >>
> >> >&g

Re: Rare Style disabling and Ajax Panel Replacement Question

2008-06-18 Thread German Morales
Hi,

I'm here with Francisco, discussing this subject.

The main difference between the approach is the amount of stuff to write in
CSS: With the detailed naming of styles (".DetailPanel-A fieldPersonName")
you have to write a lot more in the CSS. That is, for each field in
DetailPanelA, you have to go with ".DetailPanelA #fieldWhatever1",
".DetailPanelA #fieldWhatever2", ".DetailPanelA #fieldWhateverN" instead of
the shorter versions "#fieldWhatever1", "#fieldWhatever2",
"#fieldWhateverN". Therefore, the shorter versions should be, in theory,
easier to write and maintain.

On the other hand, producing this "#fieldWhatever1" allows the conflict
between fieldWhatever1 in DetailPanelA and DetailPanelB, which means that we
must introduce some "trick" to avoid it. Someone here has found this
disabling of CSSs. It is nice because it could be handled in a somehow
generic way (allowing producers of DetailPanelN to be un-aware of all this
complication), but also we must consider that it adds some extra complexity.

I'm not completely in favor of one or another approach. The detailed style
version is in fact our current solution, and it has the benefit of being
simple. But we are trying also the CSS disabling because it has some
not-that-bad benefits (CSS simplification, and perhaps the possibility of
forget about the CSS conflicts altogether).

That's why we would like to hear opinions, and perhaps even more
importantly, hear about different approaches, or about hidden traps in our
current attempts.

Thanks in advance,

German

2008/6/18 Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]>:

> That was my approach exactly but I lack the "arguments" to convince them. I
> managed to send this mail and see if I'll get better ones :-), or at least
> community consensus.
>
> Maybe if I started a thread I could get some other experiences and opinions
> on the matter.
>
> Thanks Nino.
>
> f(t)
>
> On Wed, Jun 18, 2008 at 1:49 PM, Nino Saturnino Martinez Vazquez Wael <
> [EMAIL PROTECTED]> wrote:
>
> > Hi Francisco
> >
> > I'd much rather go with more detailed naming of your styles, instead of
> > doing complex stuff with dom? Like
> >
> > .DetailPanel-A-fieldPersonName{
> >  position:absolute;
> >  left:50px;
> >  top: 50px;
> > }
> >
> > Or maybe the problem are more complex than this..?
> >
> > Francisco Diaz Trepat - gmail wrote:
> >
> >> Hi all, its been a while.
> >>
> >> Finally we started migrating other applications from swing to wicket
> >> thanks
> >> to all your help provided last year.
> >>
> >> Having said that, I have some colleagues that are looking to develop a
> way
> >> to disable style sheets that are loaded as part of panel replacement.
> >>
> >> Here is the Scenario:
> >>
> >> we have a classic web structure: left menu, top header, and center to
> >> right
> >> "Detail" area.
> >>
> >> The detail area is replaced by wicket-ajax functions and each panel
> >> usually
> >> has an overriden renderHead with code similar to this one:
> >>
> >> cHtmlHeaderContainer.getHeaderResponse().renderCSSReference(new
> >> ResourceReference(
> >>this.getClass(),
> >>this.getClass().getSimpleName() + ".css",
> >>getLocale(),
> >>getStyle()));
> >>
> >>
> >> Because on more than one "detail" panel they use a same field but with
> >> different position (lets say person.name) they are experiencing some
> >> style
> >> collision.
> >>
> >> Lets say that DetailPanel-A and DetailPanel-B show a text-field with the
> >> person.name and displays them in different locations. Surely now we
> have
> >> the
> >> same style name (by class (.) or by id (#) in some versions).
> >>
> >> So we have two .css files.
> >>
> >> *DetailPanel-A.css* with:
> >>
> >> .fieldPersonName{
> >>   position:absolute;
> >>   left:50px;
> >>   top: 50px;
> >> }
> >>
> >> *DetailPanel-B.css* with:
> >>
> >> .fieldPersonName{
> >>   background-color:   yellow;
> >> }
> >>
> >> Now we navigate from DetailPanel-A to DetailPanel-B or viceversa. And
> >> ofcourse the "problem" is that on the DetailPanel-B my field gets moved
> if
> >> I
> >> don't specify otherwise. And some times although we specify it, it will
> >> depend on order and other matters as well. This are the rules of the
> game
> >> and web development has been fine with them.
> >>
> >> But my colleages are proposing a disabling of previously loaded styles,
> >> living DOM with disabled style objects.
> >>
> >> I haven't heard of that kind of practice. And IMHO instead of building a
> >> complex javascript function to disable the style object ( >> rel="stylesheet" type="text/css" charset="utf-8" media="all"
> >> href="someWicketResourceUrl">) on the pages DOM object, we could share
> >> this
> >> with wicket community and find out if we are on the right path. I don't
> >> feel
> >> we are in it.
> >>
> >> Could some please comment on this, or ask anything you need to comment
> on
> >> thi

Re: Link to dynamic pdf (jasperreports)

2007-12-06 Thread German Morales
Hi,

Have you seen this other thread?
http://www.nabble.com/wicket-File-downlaod-tf4874269.html#a13946961

There i've made some suggestions for dynamic generated pdf, with working
code.

Again, i don't know anything of jasper reports, but the person asked that
time liked it.

Also there is in the code the needed call to make it work with the
download dialog.

Bye,

German


It seems that Newgro wrote:
>
> Is this really unsolvable? Please can someone give me a hint?
>
> Thanks
> Per
> --
> View this message in context:
> http://www.nabble.com/Link-to-dynamic-pdf-%28jasperreports%29-tf4936362.html#a14191604
> Sent from the Wicket - User mailing list archive at Nabble.com.



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



Re: wicket File downlaod

2007-11-26 Thread German Morales
Hi,

I have never used jasper reports, but a quick search shows me that you can
also generate the file as a byte[] in memory:

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JasperExportManager.html#exportReportToPdf(net.sf.jasperreports.engine.JasperPrint)

Class JasperExportManager:
public static byte[] exportReportToPdf(JasperPrint jasperPrint) throws
JRException

In such case you could avoid all the trouble with files by using a
DynamicWebResource instead of the WebResource described by Florian.

Here a quick example:

   public class MyDynamicWebResource extends DynamicWebResource {
  protected ResourceState getResourceState() {
 return new ResourceState() {
public String getContentType() {
   return "application/pdf";
}

public byte[] getData() {
   return generatePDFDataUsingJasperOrWhatever();
}
 };
  }

  // this is optional i think
  protected void setHeaders(WebResponse cResponse) {
 super.setHeaders(cResponse);

 cResponse.setAttachmentHeader("test.pdf");
  }
   }

For me this is the most convenient thing to do if you don't need to store
the files for later usage.

Bye,

German


It seems that Florian Sperber wrote:
> Sometime ago this was answered on the list but i cannot find it right
> now :-)
>
> Maybe the following snippets will help you (it's wicket 1.2.6):
>
> WebResource export = new WebResource() {
>   private static final long serialVersionUID = 1L;
>
>   @Override
>   public IResourceStream getResourceStream() {
>   try {
>   return new FileService(f).getResourceStream();
>   } catch (IOException e) {
>   e.printStackTrace();
>   }
>   return null;
>   }
>   @Override
>   protected void setHeaders(WebResponse response) {
>   super.setHeaders(response);
>   response.
>   setAttachmentHeader(attachment.getOriginalFilename());
>   }
> };
> export.setCacheable(false);
>
> ResourceLink dlLink = new ResourceLink("attachmentLink", export);
>
> ...
>
> public class FileService {
>
>   private File file;
>   private String outputName;
>   private String contentType = "";
>
>   public FileService(File file) {
>   this.file = file;
>   this.outputName = this.file.getName();
>   }
>
>   /**
>* sets the output name and returns itself
>* @param outputName
>* @return
>*/
>   public FileService setOutputName(String outputName) {
>   this.outputName = outputName;
>   return FileService.this;
>   }
>
>   /**
>* sets the content type and returns itself
>* @param contentType
>* @return
>*/
>   public FileService setContentType(String contentType) {
>   this.contentType = contentType;
>   return FileService.this;
>   }
>
>
>   public IResourceStream getResourceStream() throws IOException {
>
>   FileInputStream fi = new FileInputStream(this.file);
>
>   return new IResourceStreamImpl(fi, this.contentType,
> this.file.length());
>   }
>
>   /**
>* wrapper which creates the necessary [EMAIL PROTECTED]
> ResourceStreamRequestTarget}
>* @return
>* @throws IOException
>*/
>   public ResourceStreamRequestTarget getResourceStreamRequestTarget()
> throws IOException {
>   return new 
> ResourceStreamRequestTarget(this.getResourceStream()) {
>   public String getFileName() {
>   return (outputName);
>   }
>   };
>   }
>
> }
>
> ...
> public class IResourceStreamImpl implements IResourceStream {
>   private static final long serialVersionUID = 1L;
>
>   private Locale locale = null;
>   private String contentType = null;
>   private InputStream inputStream = null;
>   private long size;
>
>   /**
>* @param fileInputStream
>* @param contentType
>* @param file
>*/
>   public IResourceStreamImpl(InputStream inputStream,
>   String contentType, long size) {
>   this.inputStream = inputStream;
>   this.size = size;
>   this.contentType = contentType;
>   }
>
>   public void close() throws IOException {
>   this.inputStream.close();
>   }
>
>   public InputStream getInputStream() throws
> ResourceStreamNotFoundException {
>   return this.inputStream;
>   }
>
>   public String getContentType() {
>   return (this.contentType);
>   }
>
>   public Locale getLocale() {
>   return (this.locale);
>   }
>
>   public long length() {
>   return this.size;
>   }
>
>   public vo

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread German Morales
So perhaps there's nothing wrong after all?

It seems that Igor Vaynberg wrote:
> when wicket generates the links it appends your browser's locale to them
>
> so the link to foo.css will look like foo_en_us.css for example.
>
> then when the url is requested wicket does the resolution with fallback:
>
> first try foo_en_us.css
> then try foo_en.css
> then try foo.css
>
> so it all still works...
>
> im not sure if there is a way for us to generate a url only with
> foo.css in it, because then wicket has to perform the same kind of
> resolution at url generation time... johan?
>
> -igor
>
>
> On Nov 10, 2007 11:48 AM, German Morales <[EMAIL PROTECTED]>
> wrote:
>> Ok, please give me some time, i will ask someone (who is reading) with
>> Netbeans 6 already installed to help me produce a quickstart.
>>
>> Anyway, i insist that now is all working for me, just that it is strange
>> that it generates the HTML referencing the CSS with full locale and
>> style,
>> and then when the browser ask for the file, it seems that in that moment
>> the look up is done and the correct available file is found. Perhaps
>> that's the way it is supposed to work?
>>
>>
>> German
>>
>> It seems that Johan Compagner wrote:
>> > can you make a test case for this and attach it to an issue in your
>> jira?
>> >
>> > I did fix something in RC1 but i don't know if your case is fixed
>> >
>> > The problem is that when you get or generate an url from a
>> > ResourceReference
>> > first bind() should be called. If that is then a PackageResource then
>> the
>> > ResourceReference
>> > should get the locale of the PackageResource but i see that there
>> could be
>> > some issues with that.
>> >
>> > But what doesn't happen is that the headerresponse doesn't call bind()
>> for
>> > us when you add a resource reference
>> > that should also be fixed
>> >
>> > johan
>> >
>> > On Nov 9, 2007 5:54 PM, German Morales <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> 1.3.0 beta 4
>> >>
>> >> It seems that Johan Compagner wrote:
>> >> > I think i asked this before, but what version of wicket??
>> >> >
>> >> > Normally (in the current wicket 1.3 buids) a ResourceReference to a
>> >> > PackageResource will fallback to the real locale the
>> PackageResource
>> >> is
>> >> > loaded
>> >> > from after the ResourceReference is binded.
>> >> >
>> >> > johan
>> >> >
>> >> > On Nov 9, 2007 3:34 PM, German Morales
>> <[EMAIL PROTECTED]>
>> >> > wrote:
>> >> >
>> >> >> Yes, at least that's what i see when i ask Firefox to show me the
>> >> source
>> >> >> of the page.
>> >> >>
>> >> >> It seems that Johan Compagner wrote:
>> >> >> > But even with bind() it still shows you the locale in the url?
>> >> >> >
>> >> >> > On Nov 9, 2007 3:22 PM, German Morales
>> >> <[EMAIL PROTECTED]>
>> >> >> > wrote:
>> >> >> >
>> >> >> >> Hi again,
>> >> >> >>
>> >> >> >> With your solution, the generated HTML now looks this way:
>> >> >> >>
>> >> >> >> > >> >> >> href="resources/path.to.mypage.MyPage/style_mystyle_mylocale.css"
>> >> />
>> >> >> >>
>> >> >> >> i don't have style_mystyle_mylocale.css, but only
>> >> style_mystyle.css
>> >> >> >>
>> >> >> >> But it works!
>> >> >> >>
>> >> >> >> So it seems that wicket later (when the browser asks for the
>> css)
>> >> >> makes
>> >> >> >> the corresponding look up.
>> >> >> >>
>> >> >> >> Thanks a lot!
>> >> >> >>
>> >> >> >> German
>> >> >> >>
>> >> >> >> PS: just for the record (if someone reads this later), there
>> was a
>> >> >> easy
>> >> >> >> typo in the code below. It should be Application.get() and not
>> >> >&g

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread German Morales
Ok, please give me some time, i will ask someone (who is reading) with
Netbeans 6 already installed to help me produce a quickstart.

Anyway, i insist that now is all working for me, just that it is strange
that it generates the HTML referencing the CSS with full locale and style,
and then when the browser ask for the file, it seems that in that moment
the look up is done and the correct available file is found. Perhaps
that's the way it is supposed to work?

German

It seems that Johan Compagner wrote:
> can you make a test case for this and attach it to an issue in your jira?
>
> I did fix something in RC1 but i don't know if your case is fixed
>
> The problem is that when you get or generate an url from a
> ResourceReference
> first bind() should be called. If that is then a PackageResource then the
> ResourceReference
> should get the locale of the PackageResource but i see that there could be
> some issues with that.
>
> But what doesn't happen is that the headerresponse doesn't call bind() for
> us when you add a resource reference
> that should also be fixed
>
> johan
>
> On Nov 9, 2007 5:54 PM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> 1.3.0 beta 4
>>
>> It seems that Johan Compagner wrote:
>> > I think i asked this before, but what version of wicket??
>> >
>> > Normally (in the current wicket 1.3 buids) a ResourceReference to a
>> > PackageResource will fallback to the real locale the PackageResource
>> is
>> > loaded
>> > from after the ResourceReference is binded.
>> >
>> > johan
>> >
>> > On Nov 9, 2007 3:34 PM, German Morales <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> Yes, at least that's what i see when i ask Firefox to show me the
>> source
>> >> of the page.
>> >>
>> >> It seems that Johan Compagner wrote:
>> >> > But even with bind() it still shows you the locale in the url?
>> >> >
>> >> > On Nov 9, 2007 3:22 PM, German Morales
>> <[EMAIL PROTECTED]>
>> >> > wrote:
>> >> >
>> >> >> Hi again,
>> >> >>
>> >> >> With your solution, the generated HTML now looks this way:
>> >> >>
>> >> >> > >> >> href="resources/path.to.mypage.MyPage/style_mystyle_mylocale.css"
>> />
>> >> >>
>> >> >> i don't have style_mystyle_mylocale.css, but only
>> style_mystyle.css
>> >> >>
>> >> >> But it works!
>> >> >>
>> >> >> So it seems that wicket later (when the browser asks for the css)
>> >> makes
>> >> >> the corresponding look up.
>> >> >>
>> >> >> Thanks a lot!
>> >> >>
>> >> >> German
>> >> >>
>> >> >> PS: just for the record (if someone reads this later), there was a
>> >> easy
>> >> >> typo in the code below. It should be Application.get() and not
>> >> >> Application.bind().
>> >> >>
>> >> >> It seems that Johan Compagner wrote:
>> >> >> > no as i said before
>> >> >> > you have to create the resourcereference with the locale and the
>> >> >> style.
>> >> >> > Those are not automatically picked up from the session. If you
>> >> don't
>> >> >> give
>> >> >> > them in the constructor
>> >> >> > then both are just null
>> >> >> >
>> >> >> > What you could do is this:
>> >> >> >
>> >> >> > ResourceReference reference = new
>> ResourceReference(MyPage.class,
>> >> >> > "style.css",
>> >> >> > locale,style);
>> >> >> > reference.bind(Application.bind());
>> >> >> > cResponse.getHeaderResponse().renderCSSReference(reference);
>> >> >> > johan
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Nov 9, 2007 1:55 PM, German Morales
>> >> <[EMAIL PROTECTED]>
>> >> >> > wrote:
>> >> >> >
>> >> >> >> version 1.3.0-beta4.
>> >> >> >>
>> >> >> >> I insist that the problem must be something different, perhaps
>> in
>

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
1.3.0 beta 4

It seems that Johan Compagner wrote:
> I think i asked this before, but what version of wicket??
>
> Normally (in the current wicket 1.3 buids) a ResourceReference to a
> PackageResource will fallback to the real locale the PackageResource is
> loaded
> from after the ResourceReference is binded.
>
> johan
>
> On Nov 9, 2007 3:34 PM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> Yes, at least that's what i see when i ask Firefox to show me the source
>> of the page.
>>
>> It seems that Johan Compagner wrote:
>> > But even with bind() it still shows you the locale in the url?
>> >
>> > On Nov 9, 2007 3:22 PM, German Morales <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> Hi again,
>> >>
>> >> With your solution, the generated HTML now looks this way:
>> >>
>> >> > >> href="resources/path.to.mypage.MyPage/style_mystyle_mylocale.css" />
>> >>
>> >> i don't have style_mystyle_mylocale.css, but only style_mystyle.css
>> >>
>> >> But it works!
>> >>
>> >> So it seems that wicket later (when the browser asks for the css)
>> makes
>> >> the corresponding look up.
>> >>
>> >> Thanks a lot!
>> >>
>> >> German
>> >>
>> >> PS: just for the record (if someone reads this later), there was a
>> easy
>> >> typo in the code below. It should be Application.get() and not
>> >> Application.bind().
>> >>
>> >> It seems that Johan Compagner wrote:
>> >> > no as i said before
>> >> > you have to create the resourcereference with the locale and the
>> >> style.
>> >> > Those are not automatically picked up from the session. If you
>> don't
>> >> give
>> >> > them in the constructor
>> >> > then both are just null
>> >> >
>> >> > What you could do is this:
>> >> >
>> >> > ResourceReference reference = new ResourceReference(MyPage.class,
>> >> > "style.css",
>> >> > locale,style);
>> >> > reference.bind(Application.bind());
>> >> > cResponse.getHeaderResponse().renderCSSReference(reference);
>> >> > johan
>> >> >
>> >> >
>> >> >
>> >> > On Nov 9, 2007 1:55 PM, German Morales
>> <[EMAIL PROTECTED]>
>> >> > wrote:
>> >> >
>> >> >> version 1.3.0-beta4.
>> >> >>
>> >> >> I insist that the problem must be something different, perhaps in
>> the
>> >> >> way
>> >> >> i pretend it to work. I know about the ResourceStreamLocator, and
>> as
>> >> i
>> >> >> tell it works perfectly for the HTML. The difference is that from
>> my
>> >> >> class
>> >> >> the framework looks automatically for the corresponding HTML, but
>> how
>> >> >> should it work for the CSS?
>> >> >>
>> >> >> Should i declare it in the code?
>> >> >>
>> >> >>   // on renderHead
>> >> >>   cResponse.getHeaderResponse().renderCSSReference(new
>> >> >> ResourceReference(MyPage.class, "style.css"));
>> >> >>
>> >> >> or how?
>> >> >>
>> >> >> What i'm doing is very simple... i'm forcing (for testing) a call
>> to
>> >> >> Session.setStyle("whatever"), then i have MyPage.html and
>> >> >> MyPage_whatever.html (which works fine) and then style.css and
>> >> >> style_whatever.css (which i expect to be used thanks to the code
>> >> above).
>> >> >>
>> >> >> But when i see the generated html, it comes with the content of
>> >> >> MyPage_whatever.html, but the header is generated this way:
>> >> >>
>> >> >> > >> >> href="resources/path.to.mypage.MyPage/style.css" />
>> >> >>
>> >> >> that is, not pointint to style_whatever.css as i expect.
>> >> >>
>> >> >> Thanks for the support,
>> >> >>
>> >> >> German
>> >> >>
>> >> >>
>> >> >> It seems that Johan Compag

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Yes, at least that's what i see when i ask Firefox to show me the source
of the page.

It seems that Johan Compagner wrote:
> But even with bind() it still shows you the locale in the url?
>
> On Nov 9, 2007 3:22 PM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> Hi again,
>>
>> With your solution, the generated HTML now looks this way:
>>
>> > href="resources/path.to.mypage.MyPage/style_mystyle_mylocale.css" />
>>
>> i don't have style_mystyle_mylocale.css, but only style_mystyle.css
>>
>> But it works!
>>
>> So it seems that wicket later (when the browser asks for the css) makes
>> the corresponding look up.
>>
>> Thanks a lot!
>>
>> German
>>
>> PS: just for the record (if someone reads this later), there was a easy
>> typo in the code below. It should be Application.get() and not
>> Application.bind().
>>
>> It seems that Johan Compagner wrote:
>> > no as i said before
>> > you have to create the resourcereference with the locale and the
>> style.
>> > Those are not automatically picked up from the session. If you don't
>> give
>> > them in the constructor
>> > then both are just null
>> >
>> > What you could do is this:
>> >
>> > ResourceReference reference = new ResourceReference(MyPage.class,
>> > "style.css",
>> > locale,style);
>> > reference.bind(Application.bind());
>> > cResponse.getHeaderResponse().renderCSSReference(reference);
>> > johan
>> >
>> >
>> >
>> > On Nov 9, 2007 1:55 PM, German Morales <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> version 1.3.0-beta4.
>> >>
>> >> I insist that the problem must be something different, perhaps in the
>> >> way
>> >> i pretend it to work. I know about the ResourceStreamLocator, and as
>> i
>> >> tell it works perfectly for the HTML. The difference is that from my
>> >> class
>> >> the framework looks automatically for the corresponding HTML, but how
>> >> should it work for the CSS?
>> >>
>> >> Should i declare it in the code?
>> >>
>> >>   // on renderHead
>> >>   cResponse.getHeaderResponse().renderCSSReference(new
>> >> ResourceReference(MyPage.class, "style.css"));
>> >>
>> >> or how?
>> >>
>> >> What i'm doing is very simple... i'm forcing (for testing) a call to
>> >> Session.setStyle("whatever"), then i have MyPage.html and
>> >> MyPage_whatever.html (which works fine) and then style.css and
>> >> style_whatever.css (which i expect to be used thanks to the code
>> above).
>> >>
>> >> But when i see the generated html, it comes with the content of
>> >> MyPage_whatever.html, but the header is generated this way:
>> >>
>> >> > >> href="resources/path.to.mypage.MyPage/style.css" />
>> >>
>> >> that is, not pointint to style_whatever.css as i expect.
>> >>
>> >> Thanks for the support,
>> >>
>> >> German
>> >>
>> >>
>> >> It seems that Johan Compagner wrote:
>> >> > it should fallback just fine..
>> >> > what version of wicket are you using?
>> >> >
>> >> > Because in the ResourceStreamLocator we do now this:
>> >> >
>> >> > public IResourceStream locate(final Class clazz, String path, final
>> >> String
>> >> > style,
>> >> >final Locale locale, final String extension)
>> >> >  {
>> >> >   // Try the various combinations of style, locale and extension to
>> >> find
>> >> >   // the resource.
>> >> >   ResourceNameIterator iter = new ResourceNameIterator(path, style,
>> >> > locale,
>> >> > extension);
>> >> >   while (iter.hasNext())
>> >> >   {
>> >> >String newPath = (String)iter.next();
>> >> >IResourceStream stream = locate(clazz, newPath);
>> >> >if (stream != null)
>> >> >{
>> >> > stream.setLocale(iter.getLocale());
>> >> > return stream;
>> >> >}
>> >> >   }
>> >> >   return null;
>> >> >  }
>> >> >
>>

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Furthermore, now that i understand more about this, i tried again my
original version:

cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, "style.css", getLocale(), getStyle()));

and it also works as expected.

Perhaps i was not expecting it to work because the generated HTML
referenced a file i didn't have, or who knows why.

Thanks again.

German


It seems that German Morales wrote:
> Hi again,
>
> With your solution, the generated HTML now looks this way:
>
>  href="resources/path.to.mypage.MyPage/style_mystyle_mylocale.css" />
>
> i don't have style_mystyle_mylocale.css, but only style_mystyle.css
>
> But it works!
>
> So it seems that wicket later (when the browser asks for the css) makes
> the corresponding look up.
>
> Thanks a lot!
>
> German
>
> PS: just for the record (if someone reads this later), there was a easy
> typo in the code below. It should be Application.get() and not
> Application.bind().
>
> It seems that Johan Compagner wrote:
>> no as i said before
>> you have to create the resourcereference with the locale and the style.
>> Those are not automatically picked up from the session. If you don't
>> give
>> them in the constructor
>> then both are just null
>>
>> What you could do is this:
>>
>> ResourceReference reference = new ResourceReference(MyPage.class,
>> "style.css",
>> locale,style);
>> reference.bind(Application.bind());
>> cResponse.getHeaderResponse().renderCSSReference(reference);
>> johan
>>
>>
>>
>> On Nov 9, 2007 1:55 PM, German Morales <[EMAIL PROTECTED]>
>> wrote:
>>
>>> version 1.3.0-beta4.
>>>
>>> I insist that the problem must be something different, perhaps in the
>>> way
>>> i pretend it to work. I know about the ResourceStreamLocator, and as i
>>> tell it works perfectly for the HTML. The difference is that from my
>>> class
>>> the framework looks automatically for the corresponding HTML, but how
>>> should it work for the CSS?
>>>
>>> Should i declare it in the code?
>>>
>>>   // on renderHead
>>>   cResponse.getHeaderResponse().renderCSSReference(new
>>> ResourceReference(MyPage.class, "style.css"));
>>>
>>> or how?
>>>
>>> What i'm doing is very simple... i'm forcing (for testing) a call to
>>> Session.setStyle("whatever"), then i have MyPage.html and
>>> MyPage_whatever.html (which works fine) and then style.css and
>>> style_whatever.css (which i expect to be used thanks to the code
>>> above).
>>>
>>> But when i see the generated html, it comes with the content of
>>> MyPage_whatever.html, but the header is generated this way:
>>>
>>> >> href="resources/path.to.mypage.MyPage/style.css" />
>>>
>>> that is, not pointint to style_whatever.css as i expect.
>>>
>>> Thanks for the support,
>>>
>>> German
>>>
>>>
>>> It seems that Johan Compagner wrote:
>>> > it should fallback just fine..
>>> > what version of wicket are you using?
>>> >
>>> > Because in the ResourceStreamLocator we do now this:
>>> >
>>> > public IResourceStream locate(final Class clazz, String path, final
>>> String
>>> > style,
>>> >final Locale locale, final String extension)
>>> >  {
>>> >   // Try the various combinations of style, locale and extension to
>>> find
>>> >   // the resource.
>>> >   ResourceNameIterator iter = new ResourceNameIterator(path, style,
>>> > locale,
>>> > extension);
>>> >   while (iter.hasNext())
>>> >   {
>>> >String newPath = (String)iter.next();
>>> >IResourceStream stream = locate(clazz, newPath);
>>> >if (stream != null)
>>> >{
>>> > stream.setLocale(iter.getLocale());
>>> > return stream;
>>> >}
>>> >   }
>>> >   return null;
>>> >  }
>>> >
>>> > johan
>>> >
>>> >
>>> >
>>> > On Nov 9, 2007 1:11 PM, German Morales <[EMAIL PROTECTED]>
>>> > wrote:
>>> >
>>> >> Hi again,
>>> >>
>>> >> Also, the problem is not giving the parameters to the
>>> >> ResourceReferences,
>>> >&

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi again,

With your solution, the generated HTML now looks this way:



i don't have style_mystyle_mylocale.css, but only style_mystyle.css

But it works!

So it seems that wicket later (when the browser asks for the css) makes
the corresponding look up.

Thanks a lot!

German

PS: just for the record (if someone reads this later), there was a easy
typo in the code below. It should be Application.get() and not
Application.bind().

It seems that Johan Compagner wrote:
> no as i said before
> you have to create the resourcereference with the locale and the style.
> Those are not automatically picked up from the session. If you don't give
> them in the constructor
> then both are just null
>
> What you could do is this:
>
> ResourceReference reference = new ResourceReference(MyPage.class,
> "style.css",
> locale,style);
> reference.bind(Application.bind());
> cResponse.getHeaderResponse().renderCSSReference(reference);
> johan
>
>
>
> On Nov 9, 2007 1:55 PM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> version 1.3.0-beta4.
>>
>> I insist that the problem must be something different, perhaps in the
>> way
>> i pretend it to work. I know about the ResourceStreamLocator, and as i
>> tell it works perfectly for the HTML. The difference is that from my
>> class
>> the framework looks automatically for the corresponding HTML, but how
>> should it work for the CSS?
>>
>> Should i declare it in the code?
>>
>>   // on renderHead
>>   cResponse.getHeaderResponse().renderCSSReference(new
>> ResourceReference(MyPage.class, "style.css"));
>>
>> or how?
>>
>> What i'm doing is very simple... i'm forcing (for testing) a call to
>> Session.setStyle("whatever"), then i have MyPage.html and
>> MyPage_whatever.html (which works fine) and then style.css and
>> style_whatever.css (which i expect to be used thanks to the code above).
>>
>> But when i see the generated html, it comes with the content of
>> MyPage_whatever.html, but the header is generated this way:
>>
>> > href="resources/path.to.mypage.MyPage/style.css" />
>>
>> that is, not pointint to style_whatever.css as i expect.
>>
>> Thanks for the support,
>>
>> German
>>
>>
>> It seems that Johan Compagner wrote:
>> > it should fallback just fine..
>> > what version of wicket are you using?
>> >
>> > Because in the ResourceStreamLocator we do now this:
>> >
>> > public IResourceStream locate(final Class clazz, String path, final
>> String
>> > style,
>> >final Locale locale, final String extension)
>> >  {
>> >   // Try the various combinations of style, locale and extension to
>> find
>> >   // the resource.
>> >   ResourceNameIterator iter = new ResourceNameIterator(path, style,
>> > locale,
>> > extension);
>> >   while (iter.hasNext())
>> >   {
>> >String newPath = (String)iter.next();
>> >IResourceStream stream = locate(clazz, newPath);
>> >if (stream != null)
>> >{
>> > stream.setLocale(iter.getLocale());
>> > return stream;
>> >}
>> >   }
>> >   return null;
>> >  }
>> >
>> > johan
>> >
>> >
>> >
>> > On Nov 9, 2007 1:11 PM, German Morales <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> Hi again,
>> >>
>> >> Also, the problem is not giving the parameters to the
>> >> ResourceReferences,
>> >> if i call the full constructor then the ResourceReference works, but
>> the
>> >> problem is that it does not make a look up to see what's available,
>> it
>> >> just goes for the full thing. So, if i call the constructor with the
>> >> session locale and style, what it does is search for the file
>> >> style_mystyle_mylocale.css. This is not my intention, what i want it
>> >> that
>> >> that the framework searches for the style_mystyle_mylocale.css, then
>> if
>> >> not found fall back to style_mystyle.css, style_mylocale.css,
>> style.css
>> >> and so on (i'm not sure of the exact order of look up). So, modifying
>> >> the
>> >> constructor or passing the full parameters is not the solution, i
>> think.
>> >>
>> >>
>> >> Regards,
>> >>
>> >> German
>> >>
>> >> It seems that Johan C

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
version 1.3.0-beta4.

I insist that the problem must be something different, perhaps in the way
i pretend it to work. I know about the ResourceStreamLocator, and as i
tell it works perfectly for the HTML. The difference is that from my class
the framework looks automatically for the corresponding HTML, but how
should it work for the CSS?

Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, "style.css"));

or how?

What i'm doing is very simple... i'm forcing (for testing) a call to
Session.setStyle("whatever"), then i have MyPage.html and
MyPage_whatever.html (which works fine) and then style.css and
style_whatever.css (which i expect to be used thanks to the code above).

But when i see the generated html, it comes with the content of
MyPage_whatever.html, but the header is generated this way:



that is, not pointint to style_whatever.css as i expect.

Thanks for the support,

German


It seems that Johan Compagner wrote:
> it should fallback just fine..
> what version of wicket are you using?
>
> Because in the ResourceStreamLocator we do now this:
>
> public IResourceStream locate(final Class clazz, String path, final String
> style,
>final Locale locale, final String extension)
>  {
>   // Try the various combinations of style, locale and extension to find
>   // the resource.
>   ResourceNameIterator iter = new ResourceNameIterator(path, style,
> locale,
> extension);
>   while (iter.hasNext())
>   {
>String newPath = (String)iter.next();
>IResourceStream stream = locate(clazz, newPath);
>if (stream != null)
>{
> stream.setLocale(iter.getLocale());
> return stream;
>}
>   }
>   return null;
>  }
>
> johan
>
>
>
> On Nov 9, 2007 1:11 PM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> Hi again,
>>
>> Also, the problem is not giving the parameters to the
>> ResourceReferences,
>> if i call the full constructor then the ResourceReference works, but the
>> problem is that it does not make a look up to see what's available, it
>> just goes for the full thing. So, if i call the constructor with the
>> session locale and style, what it does is search for the file
>> style_mystyle_mylocale.css. This is not my intention, what i want it
>> that
>> that the framework searches for the style_mystyle_mylocale.css, then if
>> not found fall back to style_mystyle.css, style_mylocale.css, style.css
>> and so on (i'm not sure of the exact order of look up). So, modifying
>> the
>> constructor or passing the full parameters is not the solution, i think.
>>
>>
>> Regards,
>>
>> German
>>
>> It seems that Johan Compagner wrote:
>>  > if you are creating your own ResourceReferences then you have to give
>> the
>> > style and locale to them
>> > We could enhance the constructors that it does
>> Session.get().getLocale()
>> > and
>> > Session.get().getStyle()
>> > if you dont give them..
>> >
>> > johan
>> >
>> >
>> >
>> > On Nov 9, 2007 10:27 AM, German Morales <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> Hi,
>> >>
>> >> I was thinking (as a last hope) that if this works for the HTMLs, i
>> >> could
>> >> provide different HTMLs that point internally to different CSSs, and
>> it
>> >> should work. But that would be duplicating the HTML just to have the
>> CSS
>> >> changed, and then it's not a good idea.
>> >>
>> >> Perhaps someone can tell me an official way to have localized and
>> styled
>> >> CSSs, the wicket way?
>> >>
>> >> Thanks again,
>> >>
>> >> German
>> >>
>> >> It seems that German Morales wrote:
>> >> > Hi,
>> >> >
>> >> > I use it inside a page.
>> >> >
>> >> > I've tried...
>> >> >
>> >> >// inside the page constructor
>> >> >add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
>> >> > "style.css")));
>> >> >
>> >> > and
>> >> >
>> >> >// inside renderHead
>> >> >cResponse.getHeaderResponse().renderCSSReference(new
>> >> > ResourceReference(MyPage.class, "style.css"));
>> >> >
>> >> >
>> >> > And I don't want to set the style and locale

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi again,

Also, the problem is not giving the parameters to the ResourceReferences,
if i call the full constructor then the ResourceReference works, but the
problem is that it does not make a look up to see what's available, it
just goes for the full thing. So, if i call the constructor with the
session locale and style, what it does is search for the file
style_mystyle_mylocale.css. This is not my intention, what i want it that
that the framework searches for the style_mystyle_mylocale.css, then if
not found fall back to style_mystyle.css, style_mylocale.css, style.css
and so on (i'm not sure of the exact order of look up). So, modifying the
constructor or passing the full parameters is not the solution, i think.


Regards,

German

It seems that Johan Compagner wrote:
> if you are creating your own ResourceReferences then you have to give the
> style and locale to them
> We could enhance the constructors that it does Session.get().getLocale()
> and
> Session.get().getStyle()
> if you dont give them..
>
> johan
>
>
>
> On Nov 9, 2007 10:27 AM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> Hi,
>>
>> I was thinking (as a last hope) that if this works for the HTMLs, i
>> could
>> provide different HTMLs that point internally to different CSSs, and it
>> should work. But that would be duplicating the HTML just to have the CSS
>> changed, and then it's not a good idea.
>>
>> Perhaps someone can tell me an official way to have localized and styled
>> CSSs, the wicket way?
>>
>> Thanks again,
>>
>> German
>>
>> It seems that German Morales wrote:
>> > Hi,
>> >
>> > I use it inside a page.
>> >
>> > I've tried...
>> >
>> >// inside the page constructor
>> >add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
>> > "style.css")));
>> >
>> > and
>> >
>> >// inside renderHead
>> >cResponse.getHeaderResponse().renderCSSReference(new
>> > ResourceReference(MyPage.class, "style.css"));
>> >
>> >
>> > And I don't want to set the style and locale explicitely. What i want
>> is
>> > to deliver the application to a customer, and, if he wants, he adds
>> the
>> > customized page for a locale or style by itself (he could set the
>> style
>> > with a parameter or whatever). And as far as i understand the wicket
>> > approach, that's how it should work automatically. In fact it works
>> > perfecly when i do it for the html of the same page. The difference is
>> > that the html is handled in other way (the framework does it) and when
>> i
>> > try to do it for the CSS of the page i do it (and it doesn't work). So
>> > there must be something i'm not doing properly.
>> >
>> > Or, how should be the way to provide styled CSSs, there is another
>> > aproach?
>> >
>> > thanks and bye,
>> >
>> > German
>> >
>> > It seems that Eelco Hillenius wrote:
>> >>> The problem is that the file is there... just that it doesn't seem
>> to
>> >>> be
>> >>> looking for it.
>> >>>
>> >>> If i force the full constructor:
>> >>>
>> >>> new ResourceReference(MyPage.class, "style.css", getLocale(),
>> >>> getStyle())
>> >>>
>> >>> all works, so the file is correcly found and the name is correct.
>> >>>
>> >>> The problem is when i don't set the locale and style explicitely (as
>> it
>> >>> is
>> >>> supposed to be done):
>> >>>
>> >>> new ResourceReference(MyPage.class, "style.css")
>> >>>
>> >>> then it doesn't find the file. Actually i think it doesn't even try
>> to
>> >>> find it, since as i mention i put a breakpoint in
>> >>> ResourceReference#setStyle() and nobody is calling it. So later
>> >>> internal
>> >>> code to load the resource uses style and locale with null values.
>> >>
>> >> How do you use the resource reference? I think the class was designed
>> >> in such a way that the components that use it (Image for instance)
>> are
>> >> responsible for setting the appropriate locale/ style 'just in time',
>> >> so that switching locales etc works.
>> >>
>> >> Eelco
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>



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



Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi,

Well, i'm not sure to want to be creating the ResourceReferences on my
own. Is there another way to have the same i have for HTML (automatic look
up by the framework for localized and styled versions) but for CSSs?

German

It seems that Johan Compagner wrote:
> if you are creating your own ResourceReferences then you have to give the
> style and locale to them
> We could enhance the constructors that it does Session.get().getLocale()
> and
> Session.get().getStyle()
> if you dont give them..
>
> johan
>
>
>
> On Nov 9, 2007 10:27 AM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> Hi,
>>
>> I was thinking (as a last hope) that if this works for the HTMLs, i
>> could
>> provide different HTMLs that point internally to different CSSs, and it
>> should work. But that would be duplicating the HTML just to have the CSS
>> changed, and then it's not a good idea.
>>
>> Perhaps someone can tell me an official way to have localized and styled
>> CSSs, the wicket way?
>>
>> Thanks again,
>>
>> German
>>
>> It seems that German Morales wrote:
>> > Hi,
>> >
>> > I use it inside a page.
>> >
>> > I've tried...
>> >
>> >// inside the page constructor
>> >add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
>> > "style.css")));
>> >
>> > and
>> >
>> >// inside renderHead
>> >cResponse.getHeaderResponse().renderCSSReference(new
>> > ResourceReference(MyPage.class, "style.css"));
>> >
>> >
>> > And I don't want to set the style and locale explicitely. What i want
>> is
>> > to deliver the application to a customer, and, if he wants, he adds
>> the
>> > customized page for a locale or style by itself (he could set the
>> style
>> > with a parameter or whatever). And as far as i understand the wicket
>> > approach, that's how it should work automatically. In fact it works
>> > perfecly when i do it for the html of the same page. The difference is
>> > that the html is handled in other way (the framework does it) and when
>> i
>> > try to do it for the CSS of the page i do it (and it doesn't work). So
>> > there must be something i'm not doing properly.
>> >
>> > Or, how should be the way to provide styled CSSs, there is another
>> > aproach?
>> >
>> > thanks and bye,
>> >
>> > German
>> >
>> > It seems that Eelco Hillenius wrote:
>> >>> The problem is that the file is there... just that it doesn't seem
>> to
>> >>> be
>> >>> looking for it.
>> >>>
>> >>> If i force the full constructor:
>> >>>
>> >>> new ResourceReference(MyPage.class, "style.css", getLocale(),
>> >>> getStyle())
>> >>>
>> >>> all works, so the file is correcly found and the name is correct.
>> >>>
>> >>> The problem is when i don't set the locale and style explicitely (as
>> it
>> >>> is
>> >>> supposed to be done):
>> >>>
>> >>> new ResourceReference(MyPage.class, "style.css")
>> >>>
>> >>> then it doesn't find the file. Actually i think it doesn't even try
>> to
>> >>> find it, since as i mention i put a breakpoint in
>> >>> ResourceReference#setStyle() and nobody is calling it. So later
>> >>> internal
>> >>> code to load the resource uses style and locale with null values.
>> >>
>> >> How do you use the resource reference? I think the class was designed
>> >> in such a way that the components that use it (Image for instance)
>> are
>> >> responsible for setting the appropriate locale/ style 'just in time',
>> >> so that switching locales etc works.
>> >>
>> >> Eelco
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>



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



Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi,

I was thinking (as a last hope) that if this works for the HTMLs, i could
provide different HTMLs that point internally to different CSSs, and it
should work. But that would be duplicating the HTML just to have the CSS
changed, and then it's not a good idea.

Perhaps someone can tell me an official way to have localized and styled
CSSs, the wicket way?

Thanks again,

German

It seems that German Morales wrote:
> Hi,
>
> I use it inside a page.
>
> I've tried...
>
>// inside the page constructor
>add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
> "style.css")));
>
> and
>
>// inside renderHead
>cResponse.getHeaderResponse().renderCSSReference(new
> ResourceReference(MyPage.class, "style.css"));
>
>
> And I don't want to set the style and locale explicitely. What i want is
> to deliver the application to a customer, and, if he wants, he adds the
> customized page for a locale or style by itself (he could set the style
> with a parameter or whatever). And as far as i understand the wicket
> approach, that's how it should work automatically. In fact it works
> perfecly when i do it for the html of the same page. The difference is
> that the html is handled in other way (the framework does it) and when i
> try to do it for the CSS of the page i do it (and it doesn't work). So
> there must be something i'm not doing properly.
>
> Or, how should be the way to provide styled CSSs, there is another
> aproach?
>
> thanks and bye,
>
> German
>
> It seems that Eelco Hillenius wrote:
>>> The problem is that the file is there... just that it doesn't seem to
>>> be
>>> looking for it.
>>>
>>> If i force the full constructor:
>>>
>>> new ResourceReference(MyPage.class, "style.css", getLocale(),
>>> getStyle())
>>>
>>> all works, so the file is correcly found and the name is correct.
>>>
>>> The problem is when i don't set the locale and style explicitely (as it
>>> is
>>> supposed to be done):
>>>
>>> new ResourceReference(MyPage.class, "style.css")
>>>
>>> then it doesn't find the file. Actually i think it doesn't even try to
>>> find it, since as i mention i put a breakpoint in
>>> ResourceReference#setStyle() and nobody is calling it. So later
>>> internal
>>> code to load the resource uses style and locale with null values.
>>
>> How do you use the resource reference? I think the class was designed
>> in such a way that the components that use it (Image for instance) are
>> responsible for setting the appropriate locale/ style 'just in time',
>> so that switching locales etc works.
>>
>> Eelco
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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



Re: ResourceReference with locale and style, for CSSs

2007-11-08 Thread German Morales
Hi,

I use it inside a page.

I've tried...

   // inside the page constructor
   add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
"style.css")));

and

   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, "style.css"));


And I don't want to set the style and locale explicitely. What i want is
to deliver the application to a customer, and, if he wants, he adds the
customized page for a locale or style by itself (he could set the style
with a parameter or whatever). And as far as i understand the wicket
approach, that's how it should work automatically. In fact it works
perfecly when i do it for the html of the same page. The difference is
that the html is handled in other way (the framework does it) and when i
try to do it for the CSS of the page i do it (and it doesn't work). So
there must be something i'm not doing properly.

Or, how should be the way to provide styled CSSs, there is another aproach?

thanks and bye,

German

It seems that Eelco Hillenius wrote:
>> The problem is that the file is there... just that it doesn't seem to be
>> looking for it.
>>
>> If i force the full constructor:
>>
>> new ResourceReference(MyPage.class, "style.css", getLocale(),
>> getStyle())
>>
>> all works, so the file is correcly found and the name is correct.
>>
>> The problem is when i don't set the locale and style explicitely (as it
>> is
>> supposed to be done):
>>
>> new ResourceReference(MyPage.class, "style.css")
>>
>> then it doesn't find the file. Actually i think it doesn't even try to
>> find it, since as i mention i put a breakpoint in
>> ResourceReference#setStyle() and nobody is calling it. So later internal
>> code to load the resource uses style and locale with null values.
>
> How do you use the resource reference? I think the class was designed
> in such a way that the components that use it (Image for instance) are
> responsible for setting the appropriate locale/ style 'just in time',
> so that switching locales etc works.
>
> Eelco
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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



Re: ResourceReference with locale and style, for CSSs

2007-11-08 Thread German Morales
Hi johan,

The problem is that the file is there... just that it doesn't seem to be
looking for it.

If i force the full constructor:

new ResourceReference(MyPage.class, "style.css", getLocale(), getStyle())

all works, so the file is correcly found and the name is correct.

The problem is when i don't set the locale and style explicitely (as it is
supposed to be done):

new ResourceReference(MyPage.class, "style.css")

then it doesn't find the file. Actually i think it doesn't even try to
find it, since as i mention i put a breakpoint in
ResourceReference#setStyle() and nobody is calling it. So later internal
code to load the resource uses style and locale with null values.

I'm not sure if there's something i'm missing, or how it is supposed to be
done.

Thanks,

German


It seems that Johan Compagner wrote:
> they locale and style are used to search for it yes
> they are not forced.. What do you mean with that?
> If the file with that style and locale isn't there it will fallback
>
> johan
>
>
> On Nov 7, 2007 10:50 PM, German Morales <[EMAIL PROTECTED]>
> wrote:
>
>> Hi all,
>>
>> I'm having trouble with localized and styled CSSs.
>>
>> Everything works alright with HTML. For example, wicket finds
>> MyPage_mystyle.html instead of MyPage.html if i've called
>> session.setStyle("mystyle"). But for CSS i can't get it working.
>>
>> i've tried different approaches like:
>>
>>   // inside the page constructor
>>   add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
>> "style.css")));
>>
>>
>>   // inside renderHead
>>   cResponse.getHeaderResponse().renderCSSReference(new
>> ResourceReference(MyPage.class, "style.css"));
>>
>>
>> None of this worked for me. However, it works if I call the full
>> constructor of ResourceReference:
>>
>> new ResourceReference(MyPage.class, "style.css", getLocale(),
>> getStyle())
>>
>> But i'm not supposed to do that, because then the Locale and Style are
>> forced, and i want this only if the file is present. I know some
>> ResourceStreamLocator should be involved in the process, but i don't
>> know
>> how. I see in the ResourceReference javadoc that the framework should be
>> calling the setStyle() method, but i debugged it and it doesn't happen.
>>
>> What am i doing wrong?
>>
>> Thanks in advance,
>>
>> German
>>
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>



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



ResourceReference with locale and style, for CSSs

2007-11-07 Thread German Morales
Hi all,

I'm having trouble with localized and styled CSSs.

Everything works alright with HTML. For example, wicket finds
MyPage_mystyle.html instead of MyPage.html if i've called
session.setStyle("mystyle"). But for CSS i can't get it working.

i've tried different approaches like:

   // inside the page constructor
   add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
"style.css")));


   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, "style.css"));


None of this worked for me. However, it works if I call the full
constructor of ResourceReference:

new ResourceReference(MyPage.class, "style.css", getLocale(), getStyle())

But i'm not supposed to do that, because then the Locale and Style are
forced, and i want this only if the file is present. I know some
ResourceStreamLocator should be involved in the process, but i don't know
how. I see in the ResourceReference javadoc that the framework should be
calling the setStyle() method, but i debugged it and it doesn't happen.

What am i doing wrong?

Thanks in advance,

German



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



Re: AutoCompleteTextfield - how to populate two input fields

2007-10-11 Thread German Morales
Hi again,

Yes, we have something similar to what you describe in your point 2.

The only difference is that we have other structure. What we have is the
following:

-Each locality has an internal ID, a Zip Code, a City and a (swiss) kanton.

-in the html we have a Hidden, which stores the internal ID, and 1 (only)
TextField, which shows Zip Code + City + Canton (For example: "8052
Seebach, ZH").

-then we have an extension as you mention (AutoCompleteTextField,
Renderer, Behavior, JavaScript), which is already working with this
schema. It also contains many fixes over the original
autocompletetextfield (perhaps originated from the extra behavior?).

If this approach is good for you, i can send you our version, plus some
example usages.

Regards,

German


It seems that Oliver Lieven wrote:
>
> Hi,
>
> thanks for your answer.
>
> No, solution didn't work as supposed, mainly because the AutoComplete
> fills
> the input field in the browser with the data (in my case either zipcode or
> city), but doesn't update the model.
>
> To update the model I have to attach some Ajax...Behavior, but this is
> called with the data put into the textfield (i.e. either the selected
> zipcode put into the zipcode field by the autocomplete, *or* the selected
> city from the city field). In the Ajax...Behavior's onUpdate()-method
> neither the city nor the zipcode are enough to determine the value to use
> to
> update the related field.
>
> So I had two other ideas:
>
> 1. in my autocomplete-list I set the "textvalue" to the id of a
> "zipcode-city" combination. When the user selects from the
> autocomplete-list, this id is written into the corresponding input-field.
> The attached AjaxOnChangeBehavior now gets this id, determines the
> zipcode-city, and updates the city and the zipcode field. This works, but
> looks a little strange to the user (e.g. selection of "71254 Ditzingen"
> from
> autocomplete-list writes the id ("1223") into the zipcode-field, this
> issues
> the Ajax-call, which updates both fields with the correct data, i.e.
> zipcode=71254, city=Ditzingen). As I said, works but not pretty.
>
> 2. So I'm currently extended the AutoCompleteTextField, ...Renderer,
> ...Behavior, ..JavaScript to accept a second, "related" field in its
> constructor. I then attach two attributes to the autocomplete-list entries
> (say textvalue and textvalue2), and modified the JavaScript to update both
> fields. This seems to me the best approach to my specific problem, and
> seems
> to work as intended.
>
> Hope my answer was not to confusing...
> regards,
> Oliver
>
>
> German Morales wrote:
>>
>> Hi,
>>
>> Sorry, i'm a little late with my response.
>> Did the suggestion by Nino work?
>>
>> If it works, i would like to know more details about it.
>>
>> If not, we already had a somehow similar problem (Swiss addresses), and
>> we
>> have a different solution already working. Perhaps it can help you too.
>>
>> Regards,
>>
>> German
>>
>>
>> It seems that Nino Saturnino Martinez Vazquez Wael wrote:
>>> NP, waiting with excitement to hear if it works:)
>>>
>>> Oliver Lieven wrote:
>>>> Thanks allot for your efforts and detailed answer! Sounds good, I'll
>>>> give it
>>>> a try.
>>>>
>>>>
>>>> Nino.Martinez wrote:
>>>>
>>>>> No what I meant was that when a user selects something in one  of
>>>>> your
>>>>> auto complete fields  they'll automatickly select something in both,
>>>>> might have been a little scares on information:
>>>>>
>>>>> IModel commonModel=new Model();
>>>>>
>>>>>
>>>>> AbstractModel() Text=new AbstractModel(){
>>>>>
>>>>> getObject{
>>>>> return commonModel.getObject.Text;
>>>>> }
>>>>> setObject(obj){
>>>>> commonModel.setObject(obj)
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> AbstractModel() name=new AbstractModel(){
>>>>>
>>>>> getObject{
>>>>> return commonModel.getObject.name;
>>>>> }
>>>>> setObject(obj){
>>>>> commonModel.setObject(obj)
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> AutoCompleteTextField phoneName = new AutoCompleteTextField(
>>&g

Re: AutoCompleteTextfield - how to populate two input fields

2007-10-11 Thread German Morales
Hi,

Sorry, i'm a little late with my response.
Did the suggestion by Nino work?

If it works, i would like to know more details about it.

If not, we already had a somehow similar problem (Swiss addresses), and we
have a different solution already working. Perhaps it can help you too.

Regards,

German


It seems that Nino Saturnino Martinez Vazquez Wael wrote:
> NP, waiting with excitement to hear if it works:)
>
> Oliver Lieven wrote:
>> Thanks allot for your efforts and detailed answer! Sounds good, I'll
>> give it
>> a try.
>>
>>
>> Nino.Martinez wrote:
>>
>>> No what I meant was that when a user selects something in one  of your
>>> auto complete fields  they'll automatickly select something in both,
>>> might have been a little scares on information:
>>>
>>> IModel commonModel=new Model();
>>>
>>>
>>> AbstractModel() Text=new AbstractModel(){
>>>
>>> getObject{
>>> return commonModel.getObject.Text;
>>> }
>>> setObject(obj){
>>> commonModel.setObject(obj)
>>> }
>>>
>>> }
>>>
>>>
>>> AbstractModel() name=new AbstractModel(){
>>>
>>> getObject{
>>> return commonModel.getObject.name;
>>> }
>>> setObject(obj){
>>> commonModel.setObject(obj)
>>> }
>>>
>>> }
>>>
>>>
>>>
>>> AutoCompleteTextField phoneName = new AutoCompleteTextField(
>>> "phoneName", name,
>>> new BestEffortRendererAutoCompleteRenderer()) {
>>> @Override
>>> protected Iterator getChoices(String input) {
>>>
>>> return findItems(input);
>>> }
>>> };
>>>
>>>
>>> AutoCompleteTextField phoneSeries = new AutoCompleteTextField(
>>> "phoneName", text,
>>> new BestEffortRendererAutoCompleteRenderer()) {
>>> @Override
>>> protected Iterator getChoices(String input) {
>>>
>>> return findItems(input);
>>> }
>>> };
>>>
>>> And ofcourse you need to add the other completefield to the
>>> ajaxresponse...
>>>
>>> Hope this pseudo code works a little better... Was on my way out the
>>> door before...
>>>
>>>
>>> Oliver Lieven wrote:
>>>
 Hi Nino,
 thanks for your fast reply. Yes, a shared PropertyModel would help to
 keep
 both fields synchronized.

 I still can't see how this could help me to determine the value
 selected
 by
 the user.
 The AutoComplete works like

 1. getChoices() is called to populate the autocomplete list with my
 "zipcode
 - city" options
 2. when user selects a value from the autocomplete list, the
 corresponding
 field is set with the "textvalue" (e.g. the 'city' field is filled
 with
 the
 city's name)
 3. because of this update, the city-field's
 AjaxFormComponentUpdatingBehavior.onUpdate() is called
 4. in onUpdate() the getConvertedInput() method returns the city name,
 which
 is insufficient to determine the corresponding zipcode (because of the
 n:1
 relation (city may have many zipcodes)).

 So I'm still looking for a way to determine the exact combination
 selected
 by the user...

 regards,
 Oliver


 Nino.Martinez wrote:


> Quick answer, why not use property models and use both in the fiields
> you mention?
>
> Oliver Lieven wrote:
>
>
>> Hi,
>>
>> in an address edit panel I've got the two AutoCompleteText fields
>> 'zipcode'
>> and 'city'.
>>
>> When a users begins typing into the zipcode-field, the autocomplete
>> shows
>> up
>> and offers valid "zipcode - city" combinations. After selecting a
>> value
>> from
>> the autocomplete the 'zipcode' is set. Same for 'city' field, i.e.
>> after
>> selecting a "zipcode - city" from the city's autocomplete the
>> "city"-field
>> is set accordingly.
>> (Thanks for the great autocomplete-support in Wicket which allows
>> separation
>> of displayvalue and textvalue!)
>>
>> Now to my question: after selection of a "zipcode - city"
>> combination
>> from
>> either autocomplete list I would like to set both fields (zipcode
>> and
>> city).
>> I already attached an AjaxFormComponentUpdatingBehavior which gets
>> called
>> after a selection in the autocomplete list, but it just gets the
>> zipcode/city currently set.
>> Since the zipcode-city relation is 1:n (e.g. Berlin has many
>> zipcodes)
>> I'm
>> wondering if there is a way to access the full selected value (and
>> not
>> only
>> the AbstractAutoCompleteTextRenderer.textvalue set).
>>
>>
>> Thanks for any help and tips!
>> Oliver
>>
>>
>>
>>
>>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>


>>> --

Re: ResourceLink - call back?

2007-08-02 Thread German Morales
Thanks for the hint.

I use now WebResource, but i couldn't find a class implementing
IResourceStream (which you need to use WebResource) that could get my
byte[] and use it directly.

There is a StringResourceStream, but then i ended up creating a String and
then the class internally asks for its byte[]. I'm not sure if this can
cause memory consumption. Normally i wouldn't care too much, but being
full PDFs involved, it could be an issue.

I ended up creating a ByteArrayResourceStream that takes my byte[] and
uses it directly when needed.

Bye,

German

It seems that Eelco Hillenius wrote:
>> To cut the problem from the source... Do you need to have a file in the
>> file system?
>>
>> We are using a DynamicWebResource that answers a PDF directly from
>> memory.
>> Here some code:
>>
>>// we have a method that generates the PDF as a byte[]
>>final byte[] thePDFInBytes = generatePDF();
>>
>>Resource cResource = new DynamicWebResource() {
>>   protected ResourceState getResourceState() {
>>  return new ResourceState() {
>>public String getContentType() {
>>   return "application/pdf";
>>}
>>public byte[] getData() {
>>   return thePDFInBytes;
>>}
>> };
>>   }
>>};
>>
>
> Looks like a fine approach to me. Though it would probably even be
> better if you could just stream it (use WebResource directly).
> ResourceState is a construct that allows for caching, but you probably
> don't need that in this case.
>
> Eelco
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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



Re: ResourceLink - call back?

2007-07-30 Thread German Morales
Hi,

To cut the problem from the source... Do you need to have a file in the
file system?

We are using a DynamicWebResource that answers a PDF directly from memory.
Here some code:

   // we have a method that generates the PDF as a byte[]
   final byte[] thePDFInBytes = generatePDF();

   Resource cResource = new DynamicWebResource() {
  protected ResourceState getResourceState() {
 return new ResourceState() {
   public String getContentType() {
  return "application/pdf";
   }
   public byte[] getData() {
  return thePDFInBytes;
   }
};
  }
   };


In fact we must review this idea yet (we are not sure that it will be our
final approach), but it works.

By the way, it would be nice to hear if this is a good idea or not.

Bye,

German

PS: i just subscribed to the list today, sorry if i'm missing something
too obvious.


It seems that Igor Vaynberg wrote:
> your webresource knows when its done streaming data, so just delete it
> there.
>
> -igor
>
> On 7/30/07, John Carlson <[EMAIL PROTECTED]> wrote:
>>
>> I have a dynamically created pdf report that I make available to the
>> user via a ResourceLink.  In wicket the file is created as a
>> WebResource.  As the report contains sensitive information I want to
>> delete it from the server as soon as it has been downloaded.  I couldn't
>> find any 'onDownloadComplete()' type functions associated with either
>> DownloadLink or ResourceLink.  I would prefer not to bury the link in a
>> modal window that does provide a onClose callback.  Any ideas would be
>> appreciated!
>>
>> john



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