Re: Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread Tauren Mills
Noon,

Do you mean the "Default output folder" in Properties-->Java Build
Path-->Source tab?  If so, what did you change it to?  I can't just
delete it as Eclipse says that it is required.

Anyway, it is of no consequence any more.  It seems that I got things
working.  I decided to try to start with a basic wicket quickstart
from maven archetype, enable Maven dependency management on it, and
debugged it.  The quickstart worked just fine and I could edit html
files and they would refresh without stopping the server.

So I compared my project's pom with the quickstart one.  My project's
pom was modeled after another project's pom.  There was a lot of extra
stuff that I didn't need, so I removed it.  After making my pom very
close to the quickstart pom, and then debugging, my project too would
refresh html files. Yay!

I may follow up on this later as I start to add additional plugins and
settings that I removed back into my pom.  But at least I'll now be
able to test things one at a time and isolate what caused the problem.

So thanks everyone for the help!

Tauren



PS - Just in case anyone is trying to do this in the future, here are
the steps I took to get the wicket quickstart working within eclipse
with maven and m2eclipse:

First make sure eclipse, maven, and m2eclipse are installed...

Command line:
cd workspace
mvn archetype:create -DarchetypeGroupId=org.apache.wicket
-DarchetypeArtifactId=wicket-archetype-quickstart
-DarchetypeVersion=1.4-rc1 -DgroupId=test -DartifactId=mytest
cd mytest
mvn eclipse:eclipse

Eclipse:
File->Import
Select General->Existing projects into Workspace
Next
Select root directory "workspace/mytest"
Finish
Right click onto "mytest" project
Select Maven->Enable Dependency Management
Right click onto src/test/java/test/Start.java
Select Debug As -> Java Application

Web browser:
http://localhost:8080/

In Eclipse, edit HomePage.html, save.
Refresh browser, changes are there...






On Thu, Jan 15, 2009 at 10:50 PM, noon  wrote:
>
> I had to remove the "target/classes" folder from the java source paths which
> Maven Eclipse plugin adds (project properties ==> java build path). After
> this, the markup files refreshed as expected.
>
>
> Tauren Mills-2 wrote:
>>
>> Thanks Igor, but I already looked there and the only thing listed in
>> filtered resources is *.launch.
>>
>> Any other ideas?
>>
>> Tauren
>>
>> On Thu, Jan 15, 2009 at 4:05 PM, Igor Vaynberg 
>> wrote:
>>> open the preferences window
>>> in the search box type "filter"
>>> this will show you java/compiler/building panel with
>>> FilteredREsources: textbox, remove *.html
>>>
>>> -igor
>>>
>>> On Thu, Jan 15, 2009 at 4:03 PM, Tauren Mills  wrote:
 Martijn,

 Thanks.  But any clue how or where I do that?  I've been poking around
 the preferences in eclipse and haven't found it.

 Tauren

 On Thu, Jan 15, 2009 at 3:51 PM, Martijn Dashorst
  wrote:
> iirc you have to turn off eclipse's filtering of html files (which is
> turned off default because of javadoc html which usually doesn't want
> to be packaged inside your war/jar)
>
> Martijn
>
> On Fri, Jan 16, 2009 at 12:31 AM, Tauren Mills 
> wrote:
>> Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
>> trying to get my development environment working properly and need
>> your help.
>>
>> Up until now, I've been developing WIcket applications in Eclipse and
>> have not been using maven.  As long as my web.xml is set to
>> development rather than deployment mode, changes I made to HTML files
>> while debugging were immediately applied.
>>
>> Not anymore... I am now managing my projects with maven, having just
>> added a pom file to my project.  I'm using the m2eclipse plugin in
>> Eclipse and enabled dependency management on my project.
>> Unfortunately, now my HTML file changes aren't being recognized any
>> longer even with development mode turned on. I have to stop and start
>> the app to see the HTML changes.
>>
>> My project's maven properties show these goals to invoke on resource
>> changes:  process-resources resources:testResources.
>>
>> My pom includes:
>>
>>
>>src/main/java
>>src/test/java
>>
>>
>>false
>>src/main/resources
>>
>>**
>>
>>
>>
>>false
>>src/main/java
>>
>>**
>>
>>
>>**/*.java
>>
>>
>>
>>...
>>
>>
>> So, I'm wondering, does eclipse not think that a resource has been
>> changed because the HTML files are within src/main/java instead of
>> src/main/resources?  If I

Re: IBehaviors added to ComponentTag not detached

2009-01-15 Thread Jonas
Maybe I'm missing something, but looking at the code again (Wicket 1.3.5),
Component#renderComponentTag(...) seems to be the only place where
Behaviors added to ComponentTags are dealt with. I can't find any code where
they would be added to the Component.
I also verfied again, IBehavior#detach(...) seems never to be called
if the behavior is
added to the ComponentTag. I verified that using a MarkupFilter that adds a
behavior to every tag that would log a debug text if detach (or isEnabled) was
ever called.

Thanks for your time.

Jonas


On Thu, Jan 15, 2009 at 5:19 PM, Igor Vaynberg  wrote:
> behaviors added to componenttag are in turn added to components, so
> they are detached and managed by components no the componenttag they
> are added to.
>
> -igor
>
> On Thu, Jan 15, 2009 at 8:16 AM, Jonas  wrote:
>> While experimenting with MarkupFilters, I noticed that IBehaviors
>> added to ComponentTag using ComponentTag#addBehavior(IBehavior behavior)
>> are never detached. Is that a bug, or just not possible to do?
>> As far as I can see you don't have ComponentTags available anymore
>> when Components are detached...
>> Furthermore, it seems that their enablement is also ignored, they're
>> always treated as enabled in Component#renderComponentTag(...).
>>
>> cheers
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread noon

I had to remove the "target/classes" folder from the java source paths which
Maven Eclipse plugin adds (project properties ==> java build path). After
this, the markup files refreshed as expected.


Tauren Mills-2 wrote:
> 
> Thanks Igor, but I already looked there and the only thing listed in
> filtered resources is *.launch.
> 
> Any other ideas?
> 
> Tauren
> 
> On Thu, Jan 15, 2009 at 4:05 PM, Igor Vaynberg 
> wrote:
>> open the preferences window
>> in the search box type "filter"
>> this will show you java/compiler/building panel with
>> FilteredREsources: textbox, remove *.html
>>
>> -igor
>>
>> On Thu, Jan 15, 2009 at 4:03 PM, Tauren Mills  wrote:
>>> Martijn,
>>>
>>> Thanks.  But any clue how or where I do that?  I've been poking around
>>> the preferences in eclipse and haven't found it.
>>>
>>> Tauren
>>>
>>> On Thu, Jan 15, 2009 at 3:51 PM, Martijn Dashorst
>>>  wrote:
 iirc you have to turn off eclipse's filtering of html files (which is
 turned off default because of javadoc html which usually doesn't want
 to be packaged inside your war/jar)

 Martijn

 On Fri, Jan 16, 2009 at 12:31 AM, Tauren Mills 
 wrote:
> Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
> trying to get my development environment working properly and need
> your help.
>
> Up until now, I've been developing WIcket applications in Eclipse and
> have not been using maven.  As long as my web.xml is set to
> development rather than deployment mode, changes I made to HTML files
> while debugging were immediately applied.
>
> Not anymore... I am now managing my projects with maven, having just
> added a pom file to my project.  I'm using the m2eclipse plugin in
> Eclipse and enabled dependency management on my project.
> Unfortunately, now my HTML file changes aren't being recognized any
> longer even with development mode turned on. I have to stop and start
> the app to see the HTML changes.
>
> My project's maven properties show these goals to invoke on resource
> changes:  process-resources resources:testResources.
>
> My pom includes:
>
>
>src/main/java
>src/test/java
>
>
>false
>src/main/resources
>
>**
>
>
>
>false
>src/main/java
>
>**
>
>
>**/*.java
>
>
>
>...
>
>
> So, I'm wondering, does eclipse not think that a resource has been
> changed because the HTML files are within src/main/java instead of
> src/main/resources?  If I change my CSS files, which are in
> /src/main/webapp, the changes are reflected with a browser refresh.
> But if I change an HTML file, it is not.
>
> How do I configure this to work right?  Everything else seems to be
> working right, just not HTML refreshing.
>
> Thanks,
> Tauren
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



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

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


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

-- 
View this message in context: 
http://www.nabble.com/Wicket-Eclipse-Maven-m2eclipse---HTML-files-not-refreshing-tp21489401p21493513.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: access ServletOutputStream in wicket

2009-01-15 Thread noon

I had some similar issues and I solved them by upgrading the JasperReports
from 2.x to 3.0.0.




novotny wrote:
> 
> Hi,
> 
> Ok I found in wicketstuff, a JRPdfResource  class that does the jasper to
> pdf conversion for me
> and I added code to do this:
> 
> InputStream is = getClass().getResourceAsStream("/test.jasper");
> 
> JRResource pdfResource = new JRPdfResource(is);
> 
> pdfResource.setReportParameters(new HashMap());
> add(new ResourceLink("print", pdfResource));
> 
> But when I run it I get 
> 
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> Unable to serialize class: java.io.ByteArrayInputStream
> Field hierarchy is:
>   2 [class=com.homeaccount.web.loanoptions.MortgageResultsPage, path=2]
> private java.lang.Object org.apache.wicket.MarkupContainer.children
> [class=[Ljava.lang.Object;]
>   private java.lang.Object
> org.apache.wicket.MarkupContainer.children[8]
> [class=org.apache.wicket.markup.html.link.ResourceLink, path=2:print]
> private final org.apache.wicket.Resource
> org.apache.wicket.markup.html.link.ResourceLink.resource
> [class=com.homeaccount.web.jasper.JRPdfResource]
>   private
> com.homeaccount.web.jasper.JRResource$JasperReportFactory
> com.homeaccount.web.jasper.JRResource.jasperReportFactory
> [class=com.homeaccount.web.jasper.JRResource$1]
> final java.io.InputStream
> com.homeaccount.web.jasper.JRResource$1.val$report
> [class=java.io.ByteArrayInputStream] <- field that is not serializable
>   at
> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:349)
>   at
> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
>   at
> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
> 
> I checked and JRResources implements Serializable, is there a way I can
> get Wicket to avoid serializing this?
> 
> I was also thinking maybe I could do something like this:
> 
> add(new Link("print") {
> 
> 
> public void onClick() {
> InputStream is =
> getClass().getResourceAsStream("/test.jasper");
> JRResource pdfStream = new JRPdfResource(is);
> pdfStream.setReportParameters(new HashMap Object>());
> getRequestCycle().setRequestTarget(new
> ResourceStreamRequestTarget(pdfStream).setFileName("test.pdf"));
> }
> });
> 
> But turns out JRResource extends DynamicWebResource and does not implement
> IResourceStream so not sure if this can be made to work...
> 
> Thanks, Jason
> 
> 
> Pills wrote:
>> 
>> Hi,
>> 
>> look at RequestCycle#setRequestTarget and ResourceStreamRequestTarget
>> 
>> 
>> novotny wrote:
>>> Hi,
>>>
>>> I'm learning Jasper to create/display a PDF when a link is clicked and
>>> the
>>> template code I have looks like:
>>>
>>> ServletOutputStream servletOutputStream = response.getOutputStream();
>>> InputStream reportStream =
>>> getServletConfig().getServletContext().getResourceAsStream("/reports/FirstReport.jasper");
>>>   
>>> JasperRunManager.runReportToPdfStream(reportStream,
>>> servletOutputStream, new HashMap(), new
>>> JREmptyDataSource());
>>>
>>> response.setContentType("application/pdf");
>>> servletOutputStream.flush();
>>> servletOutputStream.close();
>>>
>>> How should I acccess the servlet objects, or is there a better way to do
>>> this that is the "wicket way(tm)"?
>>>
>>> Much appreciated, Jason
>>>
>>>   
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/access-ServletOutputStream-in-wicket-tp21487704p21493497.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Go back to previous page when error occurs

2009-01-15 Thread DVD
Hello:

I have a specific goal of set a error handler so that when a page (whether 
bookmarkable or not)
throw exceptions during instantiation, it would go back to the previous page 
(if previous
page does not exist, such as accessed via a bookmark, then go to home page)
at least an error page would have a link to point to the previous page.
I have seen many discussions on how to use pagemap/accesstack/backbutton,etc. 
My need here
is specific and single purpose simplified (only for page creation exception 
handling and only needs to know
the previous page object).  I could not find an simple API for this.  any 
advice would be appreciated.

I wish I could use something  session.getLastCreatedPageObject()
where wicket would always have a ref in each session for the last page object 
it creates successfully,
regardless of bookmarkable or not.

Thank you in advance.

 


Re: I'm intersted in design

2009-01-15 Thread Jonathan Locke


add(Component) has at least these advantages over add(String, Component):

 - most efficiently expresses the semantics of the operation (simplicity)
 - makes the id effectively immutable (reliability)
 - since you can't construct a component without an id, you know by
definition that any Component will have a valid id (consistency,
reliability)
 - other methods that take Component won't need an id parameter (simplicity)

a good rule of thumb: the ideal interface has one method. the ideal method
takes no parameters and returns nothing. the more methods you add to an
interface, the more parameters you add to a method and the more state you
mutate on each method call, the more you are creating both complexity and
specificity which will drag your design down by limiting its ability to be
generalized (extended and reused) while creating weight, bugs, encapsulation
leaks and hard-wired coupling in the process. less is more.


Anton Veretennikov wrote:
> 
>> Because it is imperative in many ways that the component knows it's own
>> ID.
>> Look through the code to see how many times it uses it's ID.
> 
> Do you mean that instance needs to know ID BEFORE it was added?
> If not, add() can internally set ID of component sent as parameter.
> If one child can't have other ID it can be checked in setId().
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/I%27m-intersted-in-design-tp21492078p21493324.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Things I miss in Wicket

2009-01-15 Thread Martin Makundi
> How are you envisioning this working from within an IDE?  This sounds like
> an interesting feature to add.

Context-sensitive auto-complete, quickfix, ..., there are a lot of
examples of suitable functionalities in Eclipse, for example. I have
never implemented those, however.

We could start gathering up a list of most important features and
maybe add them into either some of the existing wicket ide plugins or
roll out a separate helper plugin.

**
Martin

>
> On Thu, Jan 15, 2009 at 8:31 PM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
>> > 3. Pick up components automatically without needing to add them in the
>> Java code:
>> >
>> > add(new LastPostsPanel("lastPostsPanel"));
>> > add(new NewsPanel("newsPanel"));
>> >
>> > This could be matched automatically
>>
>> This should be accomplished using and IDE, not by default. I would not
>> mind an IDE that could match the wicket:id's at when writing.
>>
>> **
>>
>
>
>
> --
> Nick Heudecker
> Professional Wicket Training & Consulting
> http://www.systemmobile.com
>
> Eventful - Intelligent Event Management
> http://www.eventfulhq.com
>

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



Re: Things I miss in Wicket

2009-01-15 Thread Nick Heudecker
How are you envisioning this working from within an IDE?  This sounds like
an interesting feature to add.

On Thu, Jan 15, 2009 at 8:31 PM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> > 3. Pick up components automatically without needing to add them in the
> Java code:
> >
> > add(new LastPostsPanel("lastPostsPanel"));
> > add(new NewsPanel("newsPanel"));
> >
> > This could be matched automatically
>
> This should be accomplished using and IDE, not by default. I would not
> mind an IDE that could match the wicket:id's at when writing.
>
> **
>



-- 
Nick Heudecker
Professional Wicket Training & Consulting
http://www.systemmobile.com

Eventful - Intelligent Event Management
http://www.eventfulhq.com


Re: Things I miss in Wicket

2009-01-15 Thread Martin Makundi
> 3. Pick up components automatically without needing to add them in the Java 
> code:
>
> add(new LastPostsPanel("lastPostsPanel"));
> add(new NewsPanel("newsPanel"));
>
> This could be matched automatically

This should be accomplished using and IDE, not by default. I would not
mind an IDE that could match the wicket:id's at when writing.

**
Martin


>
> I think Wicket could be better without so much redundant copy&paste code...by 
> improving templates
>
> Thanks for listening...
>
> Toby
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Why you should not override isVisible

2009-01-15 Thread Martin Makundi
I consider the current behavior a perfect default. It just might be
useful to have a built in caching mechanism that you can turn on on a
per-component-instance -basis. Whether it is worth the debate is
another question, because it is pretty low-cost to implement one for
your particular need.

**
Martin

2009/1/15 Jonathan Locke :
>
>
> yeah, for full flexibility, you might just link a method in Component to a
> default in IRequestCycleSettings:
>
> boolean getCacheComponentVisibility() { return
> getApplication().getRequestCycleSettings().getCacheComponentVisibility(); }
>
> then you can set a default and override for any individual component (or
> page).
>
>
> Martin Makundi wrote:
>>
>>> you could always work it the other way and have no caching by default but
>>> allow people who know what they're doing to enable it for an application
>>> with something like
>>> IRequestCycleSettings#setCacheComponentVisibility(boolean).
>>
>> This sounds more robust, so long as it can be controlled on a
>> per-request basis (i.e., you can configure it for a specific page and
>> state).
>>
>> And don't forget about isEnabled too though it is more rare ;)
>>
>> **
>> Martin
>>
>>>
>>>
>>> Martin Makundi wrote:

 Well... I would not build in the cache because different components
 could interact in a way that if someone prematurely calls the
 isVisible method, it freezes in the wrong state. It is known, that the
 isVisible is called multiple times for various reasons.

 **
 Martin

 2009/1/15 Jonathan Locke :
>
>
> not sure. it /ought/ to make sense to cache during the render cycle.
> but
> i
> have the eerie sense that this came up before, so maybe there's some
> reason
> why it can't be cached? (although even if there are some odd cases
> where
> it
> can't be, it seems like you could make a workaround for those cases ..)
>
>
> Scott Swank wrote:
>>
>> Is there a reason why the default behavior is not to cache the result
>> of isVisible()?  Are there cases where the result of isVisible() is
>> expected to change over the course of rendering?
>>
>> Would a JIRA w/ code be welcome, or is the current behavior required?
>>
>> Scott
>>
>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> I would be careful not to throw the baby out with the bath water
>>> here.
>>> The
>>> design decision you're making is push versus pull and implementing
>>> isVisible
>>> is often going to be a better design decision because it may be more
>>> clear
>>> that visibility state stays consistent for a given problem. If the
>>> performance actually shows up as a hotspot (don't prematurely
>>> optimize!),
>>> you can always do some appropriate caching of the value and still
>>> have
>>> it
>>> "pulled".
>>>
>>>
>>> Erik van Oosten wrote:

 In the thread "Where to process PageParameters" I was requested to
 explain why I think you should not override isVisible, but rather
 should
 call setVisible in onBeforeRender (slide 100 in my presentation
 http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).

 There are 2 reasons, but only the second one is really important.

 -1- isVisible is called a lot. It is easily called ten times within
 1
 request

 So if you have anything processor intensive going on, it will be a
 performance hit. Just doing a simple expression is of course no
 problem.
 (For fun, just set a breakpoint in something like
 FeedbackPanel#isVisible and request a page that contains one.)

 -2- isVisible can make your model be reloaded multiple times within
 1
 request

 Consider the following case (pseudo code):

   MyPanel(id, personId) {
  super(id, new CompoundPropertyModel(new
 LoadableDetachablePersonModel(personId)));
  add( new Label("address") {
  @Override
  isVisible() {
  return getDefaultModel() != null;
  }
  });
   }


 The label uses the property 'address' of a person to see if the
 label
 should be visible. The person is retrieved by a
 LoadableDetachableModel
 subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).

 During the render phase, isVisible will delegate getting the address
 property to the CPM and this model delegates it to the LDM. LDM will
 load the person from the database only once (well until it is
 detached).

 At the end of the render phase everything will be detached. But now
 something weird happens. The

Re: I'm intersted in design

2009-01-15 Thread Anton Veretennikov
> Because it is imperative in many ways that the component knows it's own ID.
> Look through the code to see how many times it uses it's ID.

Do you mean that instance needs to know ID BEFORE it was added?
If not, add() can internally set ID of component sent as parameter.
If one child can't have other ID it can be checked in setId().

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



Re: I'm intersted in design

2009-01-15 Thread Jeremy Thomerson
Because it is imperative in many ways that the component knows it's own ID.
Look through the code to see how many times it uses it's ID.

Hope this helps.

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

On Thu, Jan 15, 2009 at 9:40 PM, Anton Veretennikov <
anton.veretenni...@gmail.com> wrote:

> Hello all wicket users!
>
> Does anybody know why id is added to component, not to list of children,
> like:
>
> add("someId", childComponent);
>
> Thank you very much.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


I'm intersted in design

2009-01-15 Thread Anton Veretennikov
Hello all wicket users!

Does anybody know why id is added to component, not to list of children, like:

add("someId", childComponent);

Thank you very much.

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



Re: access ServletOutputStream in wicket

2009-01-15 Thread novotny

Hi,

Ok I found in wicketstuff, a JRPdfResource  class that does the jasper to
pdf conversion for me
and I added code to do this:

InputStream is = getClass().getResourceAsStream("/test.jasper");

JRResource pdfResource = new JRPdfResource(is);

pdfResource.setReportParameters(new HashMap());
add(new ResourceLink("print", pdfResource));

But when I run it I get 

org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
Unable to serialize class: java.io.ByteArrayInputStream
Field hierarchy is:
  2 [class=com.homeaccount.web.loanoptions.MortgageResultsPage, path=2]
private java.lang.Object org.apache.wicket.MarkupContainer.children
[class=[Ljava.lang.Object;]
  private java.lang.Object org.apache.wicket.MarkupContainer.children[8]
[class=org.apache.wicket.markup.html.link.ResourceLink, path=2:print]
private final org.apache.wicket.Resource
org.apache.wicket.markup.html.link.ResourceLink.resource
[class=com.homeaccount.web.jasper.JRPdfResource]
  private com.homeaccount.web.jasper.JRResource$JasperReportFactory
com.homeaccount.web.jasper.JRResource.jasperReportFactory
[class=com.homeaccount.web.jasper.JRResource$1]
final java.io.InputStream
com.homeaccount.web.jasper.JRResource$1.val$report
[class=java.io.ByteArrayInputStream] <- field that is not serializable
at
org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:349)
at
org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at
org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)

I checked and JRResources implements Serializable, is there a way I can get
Wicket to avoid serializing this?

I was also thinking maybe I could do something like this:

add(new Link("print") {


public void onClick() {
InputStream is =
getClass().getResourceAsStream("/test.jasper");
JRResource pdfStream = new JRPdfResource(is);
pdfStream.setReportParameters(new HashMap());
getRequestCycle().setRequestTarget(new
ResourceStreamRequestTarget(pdfStream).setFileName("test.pdf"));
}
});

But turns out JRResource extends DynamicWebResource and does not implement
IResourceStream so not sure if this can be made to work...

Thanks, Jason


Pills wrote:
> 
> Hi,
> 
> look at RequestCycle#setRequestTarget and ResourceStreamRequestTarget
> 
> 
> novotny wrote:
>> Hi,
>>
>> I'm learning Jasper to create/display a PDF when a link is clicked and
>> the
>> template code I have looks like:
>>
>> ServletOutputStream servletOutputStream = response.getOutputStream();
>> InputStream reportStream =
>> getServletConfig().getServletContext().getResourceAsStream("/reports/FirstReport.jasper");
>>   
>> JasperRunManager.runReportToPdfStream(reportStream,
>> servletOutputStream, new HashMap(), new
>> JREmptyDataSource());
>>
>> response.setContentType("application/pdf");
>> servletOutputStream.flush();
>> servletOutputStream.close();
>>
>> How should I acccess the servlet objects, or is there a better way to do
>> this that is the "wicket way(tm)"?
>>
>> Much appreciated, Jason
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/access-ServletOutputStream-in-wicket-tp21487704p21491294.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: lucene document property resolve with datatable?

2009-01-15 Thread James Carman
What I would probably do is write a LucenePropertyColumn that extends
AbstractColumn.


On Thu, Jan 15, 2009 at 4:14 PM, Phillip Rhodes
 wrote:
> Hi,
> I am trying to display a lucene document as a row in the datatable.
>
> Here is how I am defining my column:
> PropertyColumn col = new PropertyColumn(new Model("Name"),  "get('NAME')", 
> "get('NAME')");
>
> The "get('NAME')" is a call to the document.get(String fieldName) method on 
> the lucene document.
>
> I get the following error message:
> WicketMessage: No get method defined for class: class 
> org.apache.lucene.document.Document expression: get('NAME')
>
>
> Is there a way to get the property resolver to work with the lucene document, 
> or should I give up and write a wrapper for the lucene document?
>
> Thank you!
>
>
>
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: modify domain object but stay on the same page?

2009-01-15 Thread Jeremy Thomerson
If you have properly coded all of your models and subcomponents on the page,
you should be able to do something like:

add(new Link("editPerson", theModelOfThePersonThisLinkWouldEdit) {
  public void onClick() {
// replace the page's model with the model given to this link
getPage().setModel(getModel());
  }
});

There's probably not a huge advantage over just doing:
setResponsePage(new PersonEdit(getModel()));


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

On Thu, Jan 15, 2009 at 6:22 PM, Phillip Rhodes
wrote:

> I have been searching, but all the examples that I come across use a
> standalone page for editing an object.
>
> For example, clicking this link will take the user to a PersonEdit page.
>add(new Link("editPerson") {
>public void onClick() {
>setResponsePage(new PersonEdit(person, peopleList));
>}
>});
>
>
> I also have an edit link, but instead of going to another page, I just want
> a form that I have already have on the page to be updated to the selected
> person.
>
> Should I just still call "setResponsePage" using my current page's
> constructor, or is there a way that I can update the form on my page to be
> bound to a new person?
>
> Right now, in my onClick handler, while I can retrieve the new person, I
> can get the form model to reflect the new person.
>
>
> Day 2 with wicket!
> Phillip
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Why you should not override isVisible

2009-01-15 Thread Scott Swank
We have implemented this, perhaps a dozen times or more across our
application.  For example, there are several payment options whose
relevance is determined by whether the customer owes any money on
their purchase (e.g. as opposed to using a gift card).  These "total
the order and determine visibility" methods were particular hot spots.

@Override
public boolean isVisible() {
if (visible == null)
visible = ((Money) getModelObject()).isPositive();
return visible;
}

While this is an idiosyncratic example, I can vouch for the fact that
performance woes in isVisible() show up in profiling.

On Thu, Jan 15, 2009 at 4:56 PM, Jonathan Locke
 wrote:
>
>
> oh i suppose you also need to reset the value in onBeforeRender(). it's a
> small pain, but how often does this really become a quantifiable problem and
> not just a worry?
>
>
> Jonathan Locke wrote:
>>
>>
>> sure, that's the clean way to do it, but it comes at the expense of
>> possibly breaking user code by surprise.
>>
>> i'm not sure how big of a deal this is. i've heard people talk about it,
>> but i'd be interested in some examples of how performance of this method
>> has been a problem for people. i've never run into it myself and if i did
>> see it in a profiler, i'd probably just cache the value in a Boolean. it's
>> literally just this little bit in your anonymous class:
>>
>> Boolean visible = null;
>> public isVisible() {
>> if (visible == null) {
>> visible = // whatever boolean computation
>> }
>> return visible;
>> }
>>
>> and then it disappears from the profiler and who cares about the rest.
>>
>>
>> Scott Swank wrote:
>>>
>>> My idea what an inversion of that one:
>>>
>>> Add a method to Component, such as isVisibleInternal() [no I don't
>>> love the name] that would cache the results of isVisible().  Then all
>>> code that currently calls isVisible() would be changed to call
>>> isVisibleInternal() instead.  Someone who really wanted non-cached
>>> visibility (seemingly the 1% case) could override isVisibleInternal(),
>>> but everyone else would get caching for free with their current code.
>>>
>>> On Thu, Jan 15, 2009 at 2:35 PM, Jonathan Locke
>>>  wrote:


 well, one simple design that would avoid the reuse problem is:

 Boolean Component#isCachedVisible() { return null; }

 then override to use visibility caching and return true or false.
 if you don't override you get the current functionality.
 of course you need two more bits in Component to support this...
 one for whether isCachedVisible returned non-null and another
 for the value it returned.

>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21490479.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


oh i suppose you also need to reset the value in onBeforeRender(). it's a
small pain, but how often does this really become a quantifiable problem and
not just a worry?


Jonathan Locke wrote:
> 
> 
> sure, that's the clean way to do it, but it comes at the expense of
> possibly breaking user code by surprise. 
> 
> i'm not sure how big of a deal this is. i've heard people talk about it,
> but i'd be interested in some examples of how performance of this method
> has been a problem for people. i've never run into it myself and if i did
> see it in a profiler, i'd probably just cache the value in a Boolean. it's
> literally just this little bit in your anonymous class:
> 
> Boolean visible = null;
> public isVisible() {
> if (visible == null) {
> visible = // whatever boolean computation
> }
> return visible;
> }
> 
> and then it disappears from the profiler and who cares about the rest.
> 
> 
> Scott Swank wrote:
>> 
>> My idea what an inversion of that one:
>> 
>> Add a method to Component, such as isVisibleInternal() [no I don't
>> love the name] that would cache the results of isVisible().  Then all
>> code that currently calls isVisible() would be changed to call
>> isVisibleInternal() instead.  Someone who really wanted non-cached
>> visibility (seemingly the 1% case) could override isVisibleInternal(),
>> but everyone else would get caching for free with their current code.
>> 
>> On Thu, Jan 15, 2009 at 2:35 PM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> well, one simple design that would avoid the reuse problem is:
>>>
>>> Boolean Component#isCachedVisible() { return null; }
>>>
>>> then override to use visibility caching and return true or false.
>>> if you don't override you get the current functionality.
>>> of course you need two more bits in Component to support this...
>>> one for whether isCachedVisible returned non-null and another
>>> for the value it returned.
>>>
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21490479.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


sure, that's the clean way to do it, but it comes at the expense of possibly
breaking user code by surprise. 

i'm not sure how big of a deal this is. i've heard people talk about it, but
i'd be interested in some examples of how performance of this method has
been a problem for people. i've never run into it myself and if i did see it
in a profiler, i'd probably just cache the value in a Boolean. it's
literally just this little bit in your anonymous class:

Boolean visible = null;
public isVisible() {
if (visible == null) {
visible = // whatever boolean computation
}
return visible;
}

and then it disappears from the profiler and who cares about the rest.


Scott Swank wrote:
> 
> My idea what an inversion of that one:
> 
> Add a method to Component, such as isVisibleInternal() [no I don't
> love the name] that would cache the results of isVisible().  Then all
> code that currently calls isVisible() would be changed to call
> isVisibleInternal() instead.  Someone who really wanted non-cached
> visibility (seemingly the 1% case) could override isVisibleInternal(),
> but everyone else would get caching for free with their current code.
> 
> On Thu, Jan 15, 2009 at 2:35 PM, Jonathan Locke
>  wrote:
>>
>>
>> well, one simple design that would avoid the reuse problem is:
>>
>> Boolean Component#isCachedVisible() { return null; }
>>
>> then override to use visibility caching and return true or false.
>> if you don't override you get the current functionality.
>> of course you need two more bits in Component to support this...
>> one for whether isCachedVisible returned non-null and another
>> for the value it returned.
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21490448.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: building extensible components

2009-01-15 Thread Jonathan Locke


no, no, you're on the right track with composition. more simpler classes is
the ideal because it breaks the problem down. if you start to feel like you
have too many classes, you probably need to grow (or maybe refactor) your
package hierarchy.


Loren Cole wrote:
> 
> No that is pretty much what I meant.  The composition solution would
> involve
> and abstract superclass and then for each kind of widget a fairly trivial
> implementation of the superclass, a static panel, and a dynamic panel. 
> It's
> just that all that class proliferation gives me a nasty feeling and I'd
> like
> avoid it if possible.
> 
> Any other ideas?
> 
> Thanks,
> Loren
> 
> 

-- 
View this message in context: 
http://www.nabble.com/building-extensible-components-tp21488696p21490219.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: modify domain object but stay on the same page?

2009-01-15 Thread Igor Vaynberg
if you dont call setresponsepage() the same page is redrawn.

-igor

On Thu, Jan 15, 2009 at 4:22 PM, Phillip Rhodes
 wrote:
> I have been searching, but all the examples that I come across use a
> standalone page for editing an object.
>
> For example, clicking this link will take the user to a PersonEdit page.
>add(new Link("editPerson") {
>public void onClick() {
>setResponsePage(new PersonEdit(person, peopleList));
>}
>});
>
>
> I also have an edit link, but instead of going to another page, I just want
> a form that I have already have on the page to be updated to the selected
> person.
>
> Should I just still call "setResponsePage" using my current page's
> constructor, or is there a way that I can update the form on my page to be
> bound to a new person?
>
> Right now, in my onClick handler, while I can retrieve the new person, I can
> get the form model to reflect the new person.
>
>
> Day 2 with wicket!
> Phillip
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



modify domain object but stay on the same page?

2009-01-15 Thread Phillip Rhodes
I have been searching, but all the examples that I come across use a  
standalone page for editing an object.


For example, clicking this link will take the user to a PersonEdit page.
add(new Link("editPerson") {
public void onClick() {
setResponsePage(new PersonEdit(person,  
peopleList));

}
});


I also have an edit link, but instead of going to another page, I just  
want a form that I have already have on the page to be updated to the  
selected person.


Should I just still call "setResponsePage" using my current page's  
constructor, or is there a way that I can update the form on my page  
to be bound to a new person?


Right now, in my onClick handler, while I can retrieve the new person,  
I can get the form model to reflect the new person.



Day 2 with wicket!
Phillip



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



Re: JavaScriptReference with TextTemplate only returns the first retrieved value

2009-01-15 Thread Igor Vaynberg
sounds like your browser is caching it.

try this:

hit the page
check the value
empty browser cache
refresh the page
see if the value changed...


other then that i hope you know that storing a password in cleartext
inside a js file might not be the best idea :)

-igor

On Thu, Jan 15, 2009 at 4:02 PM, Trent Larson  wrote:
> Some time ago, I wrote the following code to generate a javascript resource
> with values that are unique to each user.  I would have sworn that it
> worked, and that it would return a different value depending on which user
> was logged in.  However, I've just found that it is now always returning the
> same value, whichever value was first retrieved.  Any ideas?
>
> Here's the javascript file (named "sensitive.js"):
>
> function getInfoTraxPassword() {
>  return "${password}";
> }
>
>
>
> Here is the Java code:
>
>HashMap vars = new HashMap();
>vars.put("password", currentUser.getPassword());
>TextTemplateResourceReference ref =
>  new TextTemplateResourceReference(
>  BasePage.class,
>  "sensitive.js",
>  "text/javascript",
>  new Model(vars)){
>  @Override
>  public Time lastModifiedTime() { return Time.now(); }
>};
>add(new JavaScriptReference("sensitiveJavascript", ref));
>
>
> I'm including it in the HTML HEAD this way:
>
>
>
>
> I'm currently running the Java code inside the Page class, and with my
> debugger I see it getting the right value as it steps through the code.  Ask
> me anything else, I dare you!  I swear I've been through every combination
> of logic, but once I hit that javascript file the first time, I can never
> get any other value for the ${password}.  I'm currently using Jetty for the
> app server, with nothing (like Apache) in between.
>
> Any brainstorms are welcome.  Thanks!
> Trent
>

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



Re: Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread Tauren Mills
Thanks Igor, but I already looked there and the only thing listed in
filtered resources is *.launch.

Any other ideas?

Tauren

On Thu, Jan 15, 2009 at 4:05 PM, Igor Vaynberg  wrote:
> open the preferences window
> in the search box type "filter"
> this will show you java/compiler/building panel with
> FilteredREsources: textbox, remove *.html
>
> -igor
>
> On Thu, Jan 15, 2009 at 4:03 PM, Tauren Mills  wrote:
>> Martijn,
>>
>> Thanks.  But any clue how or where I do that?  I've been poking around
>> the preferences in eclipse and haven't found it.
>>
>> Tauren
>>
>> On Thu, Jan 15, 2009 at 3:51 PM, Martijn Dashorst
>>  wrote:
>>> iirc you have to turn off eclipse's filtering of html files (which is
>>> turned off default because of javadoc html which usually doesn't want
>>> to be packaged inside your war/jar)
>>>
>>> Martijn
>>>
>>> On Fri, Jan 16, 2009 at 12:31 AM, Tauren Mills  wrote:
 Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
 trying to get my development environment working properly and need
 your help.

 Up until now, I've been developing WIcket applications in Eclipse and
 have not been using maven.  As long as my web.xml is set to
 development rather than deployment mode, changes I made to HTML files
 while debugging were immediately applied.

 Not anymore... I am now managing my projects with maven, having just
 added a pom file to my project.  I'm using the m2eclipse plugin in
 Eclipse and enabled dependency management on my project.
 Unfortunately, now my HTML file changes aren't being recognized any
 longer even with development mode turned on. I have to stop and start
 the app to see the HTML changes.

 My project's maven properties show these goals to invoke on resource
 changes:  process-resources resources:testResources.

 My pom includes:


src/main/java
src/test/java


false
src/main/resources

**



false
src/main/java

**


**/*.java



...


 So, I'm wondering, does eclipse not think that a resource has been
 changed because the HTML files are within src/main/java instead of
 src/main/resources?  If I change my CSS files, which are in
 /src/main/webapp, the changes are reflected with a browser refresh.
 But if I change an HTML file, it is not.

 How do I configure this to work right?  Everything else seems to be
 working right, just not HTML refreshing.

 Thanks,
 Tauren

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


>>>
>>>
>>>
>>> --
>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>> Apache Wicket 1.3.5 is released
>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread Igor Vaynberg
open the preferences window
in the search box type "filter"
this will show you java/compiler/building panel with
FilteredREsources: textbox, remove *.html

-igor

On Thu, Jan 15, 2009 at 4:03 PM, Tauren Mills  wrote:
> Martijn,
>
> Thanks.  But any clue how or where I do that?  I've been poking around
> the preferences in eclipse and haven't found it.
>
> Tauren
>
> On Thu, Jan 15, 2009 at 3:51 PM, Martijn Dashorst
>  wrote:
>> iirc you have to turn off eclipse's filtering of html files (which is
>> turned off default because of javadoc html which usually doesn't want
>> to be packaged inside your war/jar)
>>
>> Martijn
>>
>> On Fri, Jan 16, 2009 at 12:31 AM, Tauren Mills  wrote:
>>> Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
>>> trying to get my development environment working properly and need
>>> your help.
>>>
>>> Up until now, I've been developing WIcket applications in Eclipse and
>>> have not been using maven.  As long as my web.xml is set to
>>> development rather than deployment mode, changes I made to HTML files
>>> while debugging were immediately applied.
>>>
>>> Not anymore... I am now managing my projects with maven, having just
>>> added a pom file to my project.  I'm using the m2eclipse plugin in
>>> Eclipse and enabled dependency management on my project.
>>> Unfortunately, now my HTML file changes aren't being recognized any
>>> longer even with development mode turned on. I have to stop and start
>>> the app to see the HTML changes.
>>>
>>> My project's maven properties show these goals to invoke on resource
>>> changes:  process-resources resources:testResources.
>>>
>>> My pom includes:
>>>
>>>
>>>src/main/java
>>>src/test/java
>>>
>>>
>>>false
>>>src/main/resources
>>>
>>>**
>>>
>>>
>>>
>>>false
>>>src/main/java
>>>
>>>**
>>>
>>>
>>>**/*.java
>>>
>>>
>>>
>>>...
>>>
>>>
>>> So, I'm wondering, does eclipse not think that a resource has been
>>> changed because the HTML files are within src/main/java instead of
>>> src/main/resources?  If I change my CSS files, which are in
>>> /src/main/webapp, the changes are reflected with a browser refresh.
>>> But if I change an HTML file, it is not.
>>>
>>> How do I configure this to work right?  Everything else seems to be
>>> working right, just not HTML refreshing.
>>>
>>> Thanks,
>>> Tauren
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread Tauren Mills
Martijn,

Thanks.  But any clue how or where I do that?  I've been poking around
the preferences in eclipse and haven't found it.

Tauren

On Thu, Jan 15, 2009 at 3:51 PM, Martijn Dashorst
 wrote:
> iirc you have to turn off eclipse's filtering of html files (which is
> turned off default because of javadoc html which usually doesn't want
> to be packaged inside your war/jar)
>
> Martijn
>
> On Fri, Jan 16, 2009 at 12:31 AM, Tauren Mills  wrote:
>> Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
>> trying to get my development environment working properly and need
>> your help.
>>
>> Up until now, I've been developing WIcket applications in Eclipse and
>> have not been using maven.  As long as my web.xml is set to
>> development rather than deployment mode, changes I made to HTML files
>> while debugging were immediately applied.
>>
>> Not anymore... I am now managing my projects with maven, having just
>> added a pom file to my project.  I'm using the m2eclipse plugin in
>> Eclipse and enabled dependency management on my project.
>> Unfortunately, now my HTML file changes aren't being recognized any
>> longer even with development mode turned on. I have to stop and start
>> the app to see the HTML changes.
>>
>> My project's maven properties show these goals to invoke on resource
>> changes:  process-resources resources:testResources.
>>
>> My pom includes:
>>
>>
>>src/main/java
>>src/test/java
>>
>>
>>false
>>src/main/resources
>>
>>**
>>
>>
>>
>>false
>>src/main/java
>>
>>**
>>
>>
>>**/*.java
>>
>>
>>
>>...
>>
>>
>> So, I'm wondering, does eclipse not think that a resource has been
>> changed because the HTML files are within src/main/java instead of
>> src/main/resources?  If I change my CSS files, which are in
>> /src/main/webapp, the changes are reflected with a browser refresh.
>> But if I change an HTML file, it is not.
>>
>> How do I configure this to work right?  Everything else seems to be
>> working right, just not HTML refreshing.
>>
>> Thanks,
>> Tauren
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



JavaScriptReference with TextTemplate only returns the first retrieved value

2009-01-15 Thread Trent Larson
Some time ago, I wrote the following code to generate a javascript resource
with values that are unique to each user.  I would have sworn that it
worked, and that it would return a different value depending on which user
was logged in.  However, I've just found that it is now always returning the
same value, whichever value was first retrieved.  Any ideas?

Here's the javascript file (named "sensitive.js"):

function getInfoTraxPassword() {
  return "${password}";
}



Here is the Java code:

HashMap vars = new HashMap();
vars.put("password", currentUser.getPassword());
TextTemplateResourceReference ref =
  new TextTemplateResourceReference(
  BasePage.class,
  "sensitive.js",
  "text/javascript",
  new Model(vars)){
  @Override
  public Time lastModifiedTime() { return Time.now(); }
};
add(new JavaScriptReference("sensitiveJavascript", ref));


I'm including it in the HTML HEAD this way:




I'm currently running the Java code inside the Page class, and with my
debugger I see it getting the right value as it steps through the code.  Ask
me anything else, I dare you!  I swear I've been through every combination
of logic, but once I hit that javascript file the first time, I can never
get any other value for the ${password}.  I'm currently using Jetty for the
app server, with nothing (like Apache) in between.

Any brainstorms are welcome.  Thanks!
Trent


Re: Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread Martijn Dashorst
iirc you have to turn off eclipse's filtering of html files (which is
turned off default because of javadoc html which usually doesn't want
to be packaged inside your war/jar)

Martijn

On Fri, Jan 16, 2009 at 12:31 AM, Tauren Mills  wrote:
> Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
> trying to get my development environment working properly and need
> your help.
>
> Up until now, I've been developing WIcket applications in Eclipse and
> have not been using maven.  As long as my web.xml is set to
> development rather than deployment mode, changes I made to HTML files
> while debugging were immediately applied.
>
> Not anymore... I am now managing my projects with maven, having just
> added a pom file to my project.  I'm using the m2eclipse plugin in
> Eclipse and enabled dependency management on my project.
> Unfortunately, now my HTML file changes aren't being recognized any
> longer even with development mode turned on. I have to stop and start
> the app to see the HTML changes.
>
> My project's maven properties show these goals to invoke on resource
> changes:  process-resources resources:testResources.
>
> My pom includes:
>
>
>src/main/java
>src/test/java
>
>
>false
>src/main/resources
>
>**
>
>
>
>false
>src/main/java
>
>**
>
>
>**/*.java
>
>
>
>...
>
>
> So, I'm wondering, does eclipse not think that a resource has been
> changed because the HTML files are within src/main/java instead of
> src/main/resources?  If I change my CSS files, which are in
> /src/main/webapp, the changes are reflected with a browser refresh.
> But if I change an HTML file, it is not.
>
> How do I configure this to work right?  Everything else seems to be
> working right, just not HTML refreshing.
>
> Thanks,
> Tauren
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



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

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



Re: Technologies to use with large scale Wicket application

2009-01-15 Thread Tauren Mills
Francisco,

Thanks for your 2c.

> i personally think hibernate is... the least worse we've got for orms.
> otherwise pretty standard stack that should work fine and has a huge
> userbase. you may also want to check out google guice

I'm pretty sure I'll go with hibernate because of my experience with
it and its large userbase.  I was looking at guice last night and it
might be a good alternative to spring.  However, if I use other
features of spring as well, would it make sense to include both spring
components and guice?

>> Lucene - Awesome!  I have been extremely impressed with Lucene.  It is easy
>> to integrate and astoundingly fast and simple.  It is also very flexible,
>> allowing almost limitless possibilities.  I would recommend it for search as
>> highly as Wicket for view tier.
>
> +1 , i've been using lucene for over a year in 3 different projects
> and it absolutely... rocks

Nice to hear.  I'll definitely be digging into it then.

>>> Salve
>>> Never used it, but it appears many Wicket developers do.  Is it worth
>>> looking into?
>
> you will need salve if you want to inject dependencies out of the
> 'injection tree' - very useful in DataProviders, or LDMs. if you use
> it in your wicket pages then i suppose you don't need to configure the
> component instantiation listener, i wonder if this has some
> performance advantage in favor of salve. hats off to igor for a useful
> and *very* well coded piece of software.

I read up on Salve last night too, and I think I understand what it
does.  However, it seems to add a layer of complexity to the build
process.  Also, if I use Spring, it looks like I could use
@Configurable and get similar results.  I do have very high respect
for any code that Igor has written, so I'm sure there are valid
reasons to use it.  I'll experiment with it some to see if I should
use it.

>>> Terracotta
>>> Never used it, but it looks good for clustering.  I need to figure out
>>> how to build this application in a way that I can run instances not
>>> only locally, but all across the world if necessary.  Thoughts?
>
> first off you should learn what it is and check if you really need it.
>  it's a very smart technology for caching (medium-term data) and
> taking out load off your db. i believe there's a wicket integration
> module.

Ok, will do.  I certainly don't want to complicate things if I don't need to.

>>> jQuery
>>> I've used this a lot and am familiar with it.
>
> neat library with good support for wicket (at least 2 quite good
> integration packages)

> good luck with your venture

Thanks so much!

Tauren


> francisco
>
>
>> On Tue, Jan 13, 2009 at 6:12 PM, Tauren Mills  wrote:
>>
>>> Happy new year!
>>>
>>> My team is in the preliminary stages of designing a large social
>>> wicket web application and I'm trying to identify a good set of
>>> existing tools and technologies that can be leveraged to simplify the
>>> development of this application.  I would love to hear the opinions
>>> and suggestions of other Wicket users.  Note that I want to use open
>>> source tools as much as possible.
>>>
>>> Here are some of the tools that I feel might help.  I realize this is
>>> a big list and may be off-topic, but am still interested in which
>>> technologies other Wicket developers have found work well with a
>>> Wicket app. I would appreciate any comments or opinions of these
>>> technologies as well as suggestions and alternatives that you feel
>>> would be worth my consideration.
>>>
>>> Wicket
>>> I assume no one here will object to this.  I plan to use version 1.4.
>>>
>>> MySQL
>>> First choice for database. I've used it MySQL more than any other
>>> database and it hasn't let me down.
>>>
>>> PostgreSQL
>>> Second choice for database.  I've used it less than MySQL, so
>>> additional time might be required to install, configure, and use it.
>>>
>>> Spring + Hibernate
>>> I'm comfortable with these technologies as I've been using them for a
>>> few years with Wicket.  But I'm certainly open to suggestions,
>>> opinions, etc.
>>>
>>> Hibernate Annotations
>>> Ive been using HBM files, but I'm thinking I should look into getting
>>> rid of my mapping files and put the mapping right into the pojos.  Is
>>> this the right call?
>>>
>>> Salve
>>> Never used it, but it appears many Wicket developers do.  Is it worth
>>> looking into?
>>>
>>> WicketWebBeans
>>> Might use this for rapid back-end UI development.  Besides rolling my
>>> own, are there other tools like this?
>>>
>>> Brix
>>> Jackrabbit
>>> Our application will need some heavy duty CMS features, and this
>>> project looks powerful enough to do the job.  Jackrabbit is used by
>>> Brix to store content.
>>>
>>> Lucene
>>> Hibernate Search
>>> I will need site-wide and data-wide search that encompasses all of the
>>> content on the site as well as the data in the application.  I'm not
>>> sure if these are the best tools for this job, as the content will be
>>> stored in Jackrabbit.  So I need to be able t

Re: building extensible components

2009-01-15 Thread Igor Vaynberg
by "class proliferation" you mean having to extend a base class?

-igor

On Thu, Jan 15, 2009 at 3:40 PM, Loren Cole  wrote:
> No that is pretty much what I meant.  The composition solution would involve
> and abstract superclass and then for each kind of widget a fairly trivial
> implementation of the superclass, a static panel, and a dynamic panel.  It's
> just that all that class proliferation gives me a nasty feeling and I'd like
> avoid it if possible.
>
> Any other ideas?
>
> Thanks,
> Loren
>

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



Re: building extensible components

2009-01-15 Thread Loren Cole
No that is pretty much what I meant.  The composition solution would involve
and abstract superclass and then for each kind of widget a fairly trivial
implementation of the superclass, a static panel, and a dynamic panel.  It's
just that all that class proliferation gives me a nasty feeling and I'd like
avoid it if possible.

Any other ideas?

Thanks,
Loren


Re: Technologies to use with large scale Wicket application

2009-01-15 Thread Tauren Mills
> Theres also Wicketopia, http://wicketopia.sourceforge.net/

Nino -- Good to know, I will check it out.

> Alternatively, you could try Hippo CMS7.  It's also built with Wicket on
> top of a JCR repository, but with some extensions that you might like.
> (workflow, authorization, virtual trees based on facets)  The CMS itself
> features things like a document type editor, allowing you to create
> custom node types from within the cms.  And as its composed of plugins,
> you can reconfigure a running system on the fly.  (and yes, it's all
> APL)  See http://www.onehippo.org/cms7 for details.

Frank -- that is great news!  IIRC, last time I looked at Hippo, there
was just talk of switching to Wicket.  I'm glad to hear that you
actually went ahead and did it.  I'll certainly look into it.

Thanks,
Tauren

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



Wicket/Eclipse/Maven/m2eclipse - HTML files not refreshing

2009-01-15 Thread Tauren Mills
Are there any wicket/eclipse/maven/m2eclipse users out there?  I'm
trying to get my development environment working properly and need
your help.

Up until now, I've been developing WIcket applications in Eclipse and
have not been using maven.  As long as my web.xml is set to
development rather than deployment mode, changes I made to HTML files
while debugging were immediately applied.

Not anymore... I am now managing my projects with maven, having just
added a pom file to my project.  I'm using the m2eclipse plugin in
Eclipse and enabled dependency management on my project.
Unfortunately, now my HTML file changes aren't being recognized any
longer even with development mode turned on. I have to stop and start
the app to see the HTML changes.

My project's maven properties show these goals to invoke on resource
changes:  process-resources resources:testResources.

My pom includes:


src/main/java
src/test/java


false
src/main/resources

**



false
src/main/java

**


**/*.java



...


So, I'm wondering, does eclipse not think that a resource has been
changed because the HTML files are within src/main/java instead of
src/main/resources?  If I change my CSS files, which are in
/src/main/webapp, the changes are reflected with a browser refresh.
But if I change an HTML file, it is not.

How do I configure this to work right?  Everything else seems to be
working right, just not HTML refreshing.

Thanks,
Tauren

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



Re: building extensible components

2009-01-15 Thread Thomas Mäder
As I understand it, you have a generic container component, which may
contain different subpanels. You do know that Panels can actually have their
own markup and also markup inheritance (?), so you'd end up with three
classes: the main panel (container) and you add an instance of (sub)classes
2 (the static panel) and 3 (the dynamic panel). Favor composition over
inheritance!
Unless that's totally not what you mean

Thomas

On Thu, Jan 15, 2009 at 11:52 PM, Loren Cole  wrote:

> I'm building an app that will have *lots* of panels that all follow a very
> similar pattern:
>
> They have a form and a static view whose visibility gets toggled when when
> you click edit/cancel|save|delete
> They display a warning if their model is empty
> They pop up a warning when you delete them
> They allow you to edit their model
>
> I've written a few and realized that I am cutting and pasting way too much
> code; so, I want to build an abstract superclass, but am having trouble
> figuring out how.  Hopefully someone here may be able to help.
>
> I need my subclasses to add markup to both the static and form components,
> which I believe rules out markup inheritance because I would have to use
>  twice and can't imagine wicket being able to figure out
> what
> I meant.  The other option I see is to create a panel for both the static
> content and the form, and to extend the superclass to specify which panels
> to include for each, which seems workable but ugly...
> Am I missing something, is there a better way?
>
>
> The super class I want to write would look something like this, I just
> can't
> figure out how to associate the markup:
>
> public abstract class AttributePanel extends Panel {
>WebMarkupContainer staticContainer  = new WebMarkupContainer("static");
>WebMarkupContainer dynamicContainer = new WebMarkupContainer("dynamic");
>AjaxLink editLink;
>Form form;
>Label unprovisioned = new Label("unprovisioned", "No provisioning data
> has been entered for this service, perhaps you should add it now...");;
>Attributable attribute;   //the model
>ComponentFeedbackPanel feedback = new ComponentFeedbackPanel("feedback",
> this);
>String ConfirmationMsg = "You sure?";
>
>public AttributePanel(final String id, final ModelService service) {
>super(id, service);
>
>// add static stuff
>staticContainer.setOutputMarkupId(true)
>.setOutputMarkupPlaceholderTag(true);
>add(staticContainer);
>staticContainer.add(unprovisioned.setVisible(false));
>if (attribute.getRefItemID()==null) {
>unprovisioned.setVisible(true);
>}
>populateStaticContainer(); //add some components specific to the
> subclass
>
>//add dynamic stuff
>dynamicContainer.setOutputMarkupId(true)
>.setOutputMarkupPlaceholderTag(true);
>add(dynamicContainer);
>form = new Form("form");
>form.add(new AjaxButton("submitButton", form) {
>@Override
>protected void onSubmit(AjaxRequestTarget target, Form form) {
>save();
>ServicePanel parent = (ServicePanel)
> findParent(ServicePanel.class);
>parent.addOrReplace(this);
>target.addComponent(parent);
>}
>@Override
>protected void onError(AjaxRequestTarget target, Form form) {
>target.addComponent(feedback);
>}
>});
>feedback.setOutputMarkupId(true);
>form.add(feedback);
>dynamicContainer.add(form);
>populateDynamicContainer();  //add some components specific to the
> subclass
>
>
>// Link to show form
>editLink = new AjaxLink("edit") {
>@Override
>public void onClick(AjaxRequestTarget target) {
>showForm(target);
>}
>};
>staticContainer.add(editLink);
>
>// Link to return to static view without saving any changes
>form.add(new AjaxLink("cancel") {
>public void onClick(AjaxRequestTarget target) {
>hideForm(target);
>}
>});
>
> //link to delete attribute
>form.add(new Link("deprovision") {
> @Override
>public void onClick() {
>deprovision();
>ServicePanel parent = (ServicePanel)
> findParent(ServicePanel.class);
>parent.addOrReplace(this);
>}
> }.add(new SimpleAttributeModifier("onclick", "return confirm('"
> +getConfirmationMsg()+"'); ")));
>}
>
>private void showForm(AjaxRequestTarget target) {
>staticContainer.setVisible(true);
>dynamicContainer.setVisible(false);
>target.addComponent(staticContainer);
>target.addComponent(dynamicContainer);
>}
>
>private void hideForm(AjaxRequestTarget target) {
>staticContainer.setVisible(true);
>dynamicContain

Re: addComponentInstantiationListener method

2009-01-15 Thread mooli

wicket-spring also requires the wicket-ioc binaries on your classpath -
sounds like you're missing that?



rjilani wrote:
> 
> Hi: I am using the following code from wicket wiki to add a
> Springcomponent injector to addComponentInstantiationListener to hook
> spring application context, but the code is not compiling. 
> 
> addComponentInstantiationListener(new SpringComponentInjector(this, ctx));
> 
> When I dug further I found that addComponentInstantiationListener accepts
> a parameter of type IComponentInstantiationListener and
> SpringComponentInjector doesn't implement this interface. Am I missing
> some thing? BTW I am using wicket 1.4 rc1 binaries.
> 
> Regards,
> RJ
> 
>  
> 

-- 
View this message in context: 
http://www.nabble.com/addComponentInstantiationListener-method-tp21318461p21488846.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



building extensible components

2009-01-15 Thread Loren Cole
I'm building an app that will have *lots* of panels that all follow a very
similar pattern:

They have a form and a static view whose visibility gets toggled when when
you click edit/cancel|save|delete
They display a warning if their model is empty
They pop up a warning when you delete them
They allow you to edit their model

I've written a few and realized that I am cutting and pasting way too much
code; so, I want to build an abstract superclass, but am having trouble
figuring out how.  Hopefully someone here may be able to help.

I need my subclasses to add markup to both the static and form components,
which I believe rules out markup inheritance because I would have to use
 twice and can't imagine wicket being able to figure out what
I meant.  The other option I see is to create a panel for both the static
content and the form, and to extend the superclass to specify which panels
to include for each, which seems workable but ugly...
Am I missing something, is there a better way?


The super class I want to write would look something like this, I just can't
figure out how to associate the markup:

public abstract class AttributePanel extends Panel {
WebMarkupContainer staticContainer  = new WebMarkupContainer("static");
WebMarkupContainer dynamicContainer = new WebMarkupContainer("dynamic");
AjaxLink editLink;
Form form;
Label unprovisioned = new Label("unprovisioned", "No provisioning data
has been entered for this service, perhaps you should add it now...");;
Attributable attribute;   //the model
ComponentFeedbackPanel feedback = new ComponentFeedbackPanel("feedback",
this);
String ConfirmationMsg = "You sure?";

public AttributePanel(final String id, final ModelService service) {
super(id, service);

// add static stuff
staticContainer.setOutputMarkupId(true)
.setOutputMarkupPlaceholderTag(true);
add(staticContainer);
staticContainer.add(unprovisioned.setVisible(false));
if (attribute.getRefItemID()==null) {
unprovisioned.setVisible(true);
}
populateStaticContainer(); //add some components specific to the
subclass

//add dynamic stuff
dynamicContainer.setOutputMarkupId(true)
.setOutputMarkupPlaceholderTag(true);
add(dynamicContainer);
form = new Form("form");
form.add(new AjaxButton("submitButton", form) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
save();
ServicePanel parent = (ServicePanel)
findParent(ServicePanel.class);
parent.addOrReplace(this);
target.addComponent(parent);
}
@Override
protected void onError(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
}
});
feedback.setOutputMarkupId(true);
form.add(feedback);
dynamicContainer.add(form);
populateDynamicContainer();  //add some components specific to the
subclass


// Link to show form
editLink = new AjaxLink("edit") {
@Override
public void onClick(AjaxRequestTarget target) {
showForm(target);
}
};
staticContainer.add(editLink);

// Link to return to static view without saving any changes
form.add(new AjaxLink("cancel") {
public void onClick(AjaxRequestTarget target) {
hideForm(target);
}
});

 //link to delete attribute
form.add(new Link("deprovision") {
 @Override
public void onClick() {
deprovision();
ServicePanel parent = (ServicePanel)
findParent(ServicePanel.class);
parent.addOrReplace(this);
}
 }.add(new SimpleAttributeModifier("onclick", "return confirm('"
+getConfirmationMsg()+"'); ")));
}

private void showForm(AjaxRequestTarget target) {
staticContainer.setVisible(true);
dynamicContainer.setVisible(false);
target.addComponent(staticContainer);
target.addComponent(dynamicContainer);
}

private void hideForm(AjaxRequestTarget target) {
staticContainer.setVisible(true);
dynamicContainer.setVisible(false);
target.addComponent(staticContainer);
target.addComponent(dynamicContainer);
}

private String getConfirmationMsg(){
 return ConfirmationMsg;
}

abstract void populateStaticContainer();
abstract void populateDynamicContainer();
abstract boolean save();
abstract boolean deprovision();

}

Thanks!
Loren


Re: Why you should not override isVisible

2009-01-15 Thread Scott Swank
My idea what an inversion of that one:

Add a method to Component, such as isVisibleInternal() [no I don't
love the name] that would cache the results of isVisible().  Then all
code that currently calls isVisible() would be changed to call
isVisibleInternal() instead.  Someone who really wanted non-cached
visibility (seemingly the 1% case) could override isVisibleInternal(),
but everyone else would get caching for free with their current code.

On Thu, Jan 15, 2009 at 2:35 PM, Jonathan Locke
 wrote:
>
>
> well, one simple design that would avoid the reuse problem is:
>
> Boolean Component#isCachedVisible() { return null; }
>
> then override to use visibility caching and return true or false.
> if you don't override you get the current functionality.
> of course you need two more bits in Component to support this...
> one for whether isCachedVisible returned non-null and another
> for the value it returned.
>

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



Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


well, one simple design that would avoid the reuse problem is:

Boolean Component#isCachedVisible() { return null; }

then override to use visibility caching and return true or false.
if you don't override you get the current functionality. 
of course you need two more bits in Component to support this...
one for whether isCachedVisible returned non-null and another
for the value it returned. 


Jonathan Locke wrote:
> 
> 
> this is a really good point. i think i'm -1 on the idea too unless there's
> a good proposal for how to avoid that problem.
> 
> 
> igor.vaynberg wrote:
>> 
>> if we do this then as a reusable component developer you have to
>> always be aware of this default and code with it in mind because it is
>> outside your control yet impacts the behaviors of components. -1 from
>> me.
>> 
>> -igor
>> 
>> On Thu, Jan 15, 2009 at 12:25 PM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> yeah, for full flexibility, you might just link a method in Component to
>>> a
>>> default in IRequestCycleSettings:
>>>
>>> boolean getCacheComponentVisibility() { return
>>> getApplication().getRequestCycleSettings().getCacheComponentVisibility();
>>> }
>>>
>>> then you can set a default and override for any individual component (or
>>> page).
>>>
>>>
>>> Martin Makundi wrote:

> you could always work it the other way and have no caching by default
> but
> allow people who know what they're doing to enable it for an
> application
> with something like
> IRequestCycleSettings#setCacheComponentVisibility(boolean).

 This sounds more robust, so long as it can be controlled on a
 per-request basis (i.e., you can configure it for a specific page and
 state).

 And don't forget about isEnabled too though it is more rare ;)

 **
 Martin

>
>
> Martin Makundi wrote:
>>
>> Well... I would not build in the cache because different components
>> could interact in a way that if someone prematurely calls the
>> isVisible method, it freezes in the wrong state. It is known, that
>> the
>> isVisible is called multiple times for various reasons.
>>
>> **
>> Martin
>>
>> 2009/1/15 Jonathan Locke :
>>>
>>>
>>> not sure. it /ought/ to make sense to cache during the render cycle.
>>> but
>>> i
>>> have the eerie sense that this came up before, so maybe there's some
>>> reason
>>> why it can't be cached? (although even if there are some odd cases
>>> where
>>> it
>>> can't be, it seems like you could make a workaround for those cases
>>> ..)
>>>
>>>
>>> Scott Swank wrote:

 Is there a reason why the default behavior is not to cache the
 result
 of isVisible()?  Are there cases where the result of isVisible() is
 expected to change over the course of rendering?

 Would a JIRA w/ code be welcome, or is the current behavior
 required?

 Scott

 On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
  wrote:
>
>
> I would be careful not to throw the baby out with the bath water
> here.
> The
> design decision you're making is push versus pull and implementing
> isVisible
> is often going to be a better design decision because it may be
> more
> clear
> that visibility state stays consistent for a given problem. If the
> performance actually shows up as a hotspot (don't prematurely
> optimize!),
> you can always do some appropriate caching of the value and still
> have
> it
> "pulled".
>
>
> Erik van Oosten wrote:
>>
>> In the thread "Where to process PageParameters" I was requested
>> to
>> explain why I think you should not override isVisible, but rather
>> should
>> call setVisible in onBeforeRender (slide 100 in my presentation
>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>>
>> There are 2 reasons, but only the second one is really important.
>>
>> -1- isVisible is called a lot. It is easily called ten times
>> within
>> 1
>> request
>>
>> So if you have anything processor intensive going on, it will be
>> a
>> performance hit. Just doing a simple expression is of course no
>> problem.
>> (For fun, just set a breakpoint in something like
>> FeedbackPanel#isVisible and request a page that contains one.)
>>
>> -2- isVisible can make your model be reloaded multiple times
>> within
>> 1
>> request
>>
>> Consider the following case (pseudo code):
>>
>>   MyPanel(id, personId) {
>>  super(id, new CompoundPropertyModel(new
>> LoadableDeta

Re: DropDownChoice missing in IE6 when has AJAX

2009-01-15 Thread Alex . Borba
Sorry I mentioned the AJAX but o didn't tell exactly what is the relation 
with the problem The same page with no AJAX function the problem do 
not occur.

thank you






01/15/2009 04:59 PM
alex.bo...@souzacruz.com.br 




Please respond to
users@wicket.apache.org


To
users@wicket.apache.org
cc

Subject
DropDownChoice missing in IE6 when has AJAX





Hi everybody,

I'm new on wicket and ajax, and now I'm having problems mixing
both. In my page I have some simple DropDownChoice and not related to them
but to a button I have a Modal Window.

The problem is, testing my page on IE6, when I scroll the page
down the dropdown itens get sticked in the same position, giving the
impression that the whole page rolls over it, but if I scroll the page
back they are still missing, another curious fact is even if the missin
component if a click on it, it works, showing my choices there, the
component (border) keep missing. This problem does not occur on FireFox
and I coudn't try it on IE7.

Any suggestion?

Thanks



_
O conteúdo desta mensagem e dos documentos anexos é destinado exclusivamente às 
pessoas indicadas no endereçamento eletrônico e contém informações 
confidenciais e/ou legalmente protegidas. Esta mensagem não representa 
necessariamente as políticas, práticas, intenções ou conclusões da Souza Cruz 
S.A. É expressamente vedado a qualquer pessoa, sem prévia e expressa 
autorização, ler, revelar, distribuir, divulgar, alterar, copiar, reproduzir 
ou, sob qualquer forma, utilizar o todo ou parte desta mensagem ou dos 
documentos a ela anexados. Caso tenha recebido esta mensagem por engano, 
queira, por gentileza, avisar imediatamente seu remetente e eliminar 
completamente do seu sistema. 

The contents of this message and of the attached documents are destined for the 
exclusive use of those persons named in the electronic address and contain 
confidential and / or legally protected information. This message does not 
necessarily represent Souza Cruz´s policies, practices, intentions or 
conclusions. It is strictly forbidden for any person without prior and official 
authorization to read, reveal, distribute, disclose, alter, copy, reproduce, or 
in any form or manner to use either the whole, or part of this message, or the 
attached documents. Should you have received this message and / or the attached 
documents in error, please notify the sender immediately, and delete it / them 
from your system completely.

Re: Why you should not override isVisible

2009-01-15 Thread Martijn Dashorst
A short test didn't uncover any calls to isVisible during detach phase
(1.4). Might need more extensive tests though...

Martijn

On Thu, Jan 15, 2009 at 10:12 PM, Jonathan Locke
 wrote:
>
>
> this is a really good point. i think i'm -1 on the idea too unless there's a
> good proposal for how to avoid that problem.
>
>
> igor.vaynberg wrote:
>>
>> if we do this then as a reusable component developer you have to
>> always be aware of this default and code with it in mind because it is
>> outside your control yet impacts the behaviors of components. -1 from
>> me.
>>
>> -igor
>>
>> On Thu, Jan 15, 2009 at 12:25 PM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> yeah, for full flexibility, you might just link a method in Component to
>>> a
>>> default in IRequestCycleSettings:
>>>
>>> boolean getCacheComponentVisibility() { return
>>> getApplication().getRequestCycleSettings().getCacheComponentVisibility();
>>> }
>>>
>>> then you can set a default and override for any individual component (or
>>> page).
>>>
>>>
>>> Martin Makundi wrote:

> you could always work it the other way and have no caching by default
> but
> allow people who know what they're doing to enable it for an
> application
> with something like
> IRequestCycleSettings#setCacheComponentVisibility(boolean).

 This sounds more robust, so long as it can be controlled on a
 per-request basis (i.e., you can configure it for a specific page and
 state).

 And don't forget about isEnabled too though it is more rare ;)

 **
 Martin

>
>
> Martin Makundi wrote:
>>
>> Well... I would not build in the cache because different components
>> could interact in a way that if someone prematurely calls the
>> isVisible method, it freezes in the wrong state. It is known, that the
>> isVisible is called multiple times for various reasons.
>>
>> **
>> Martin
>>
>> 2009/1/15 Jonathan Locke :
>>>
>>>
>>> not sure. it /ought/ to make sense to cache during the render cycle.
>>> but
>>> i
>>> have the eerie sense that this came up before, so maybe there's some
>>> reason
>>> why it can't be cached? (although even if there are some odd cases
>>> where
>>> it
>>> can't be, it seems like you could make a workaround for those cases
>>> ..)
>>>
>>>
>>> Scott Swank wrote:

 Is there a reason why the default behavior is not to cache the
 result
 of isVisible()?  Are there cases where the result of isVisible() is
 expected to change over the course of rendering?

 Would a JIRA w/ code be welcome, or is the current behavior
 required?

 Scott

 On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
  wrote:
>
>
> I would be careful not to throw the baby out with the bath water
> here.
> The
> design decision you're making is push versus pull and implementing
> isVisible
> is often going to be a better design decision because it may be
> more
> clear
> that visibility state stays consistent for a given problem. If the
> performance actually shows up as a hotspot (don't prematurely
> optimize!),
> you can always do some appropriate caching of the value and still
> have
> it
> "pulled".
>
>
> Erik van Oosten wrote:
>>
>> In the thread "Where to process PageParameters" I was requested to
>> explain why I think you should not override isVisible, but rather
>> should
>> call setVisible in onBeforeRender (slide 100 in my presentation
>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>>
>> There are 2 reasons, but only the second one is really important.
>>
>> -1- isVisible is called a lot. It is easily called ten times
>> within
>> 1
>> request
>>
>> So if you have anything processor intensive going on, it will be a
>> performance hit. Just doing a simple expression is of course no
>> problem.
>> (For fun, just set a breakpoint in something like
>> FeedbackPanel#isVisible and request a page that contains one.)
>>
>> -2- isVisible can make your model be reloaded multiple times
>> within
>> 1
>> request
>>
>> Consider the following case (pseudo code):
>>
>>   MyPanel(id, personId) {
>>  super(id, new CompoundPropertyModel(new
>> LoadableDetachablePersonModel(personId)));
>>  add( new Label("address") {
>>  @Override
>>  isVisible() {
>>  return getDefaultModel() != null;
>>  }
>>  });
>>   }
>>
>>>

Re: Adding wicketstuff-scriptaculous dependency

2009-01-15 Thread rjohara

I am still having troubles adding the wicketstuff-scriptaculous dependency,
even though I had no trouble adding wicketstuff-minis.  After looking at
http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-scriptaculous/1.4-SNAPSHOT/,
I noticed that filenames contain a timestamp.  Could the problem related to
this?  The error I'm receiving from Maven is:

[ERROR] Failed to resolve artifact, possibly due to a repository list that
is not appropriately equipped for this artifact's metadata.

Thanks,
Ryan


rjohara wrote:
> 
>> you need to have a scriptaculous dependency in your project's pom.xml
> 
> Thanks for the response.  I'm having trouble adding the dependency to my
> pom.xml.  Below is my pom.xml dependency definition:
> 
> 
> org.wicketstuff
> wicketstuff-scriptaculous
> 1.4-SNAPSHOT
> 
> 
> Has anyone recently added this dependency successfully?  Any help is
> appreciated.
> 
> Thanks,
> Ryan
> 

-- 
View this message in context: 
http://www.nabble.com/PrototipBehaviour-problems-tp21424534p21488090.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: access ServletOutputStream in wicket

2009-01-15 Thread Sébastien Piller

Hi,

look at RequestCycle#setRequestTarget and ResourceStreamRequestTarget


novotny wrote:

Hi,

I'm learning Jasper to create/display a PDF when a link is clicked and the
template code I have looks like:

ServletOutputStream servletOutputStream = response.getOutputStream();
InputStream reportStream =
getServletConfig().getServletContext().getResourceAsStream("/reports/FirstReport.jasper");
  
JasperRunManager.runReportToPdfStream(reportStream,

servletOutputStream, new HashMap(), new
JREmptyDataSource());

response.setContentType("application/pdf");
servletOutputStream.flush();
servletOutputStream.close();

How should I acccess the servlet objects, or is there a better way to do
this that is the "wicket way(tm)"?

Much appreciated, Jason
   
  



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



Re: access ServletOutputStream in wicket

2009-01-15 Thread Igor Vaynberg
requestcycle.get().getresponse().getoutputstream()

-igor

On Thu, Jan 15, 2009 at 1:54 PM, novotny  wrote:
>
> Hi,
>
> I'm learning Jasper to create/display a PDF when a link is clicked and the
> template code I have looks like:
>
> ServletOutputStream servletOutputStream = response.getOutputStream();
>InputStream reportStream =
> getServletConfig().getServletContext().getResourceAsStream("/reports/FirstReport.jasper");
>
>JasperRunManager.runReportToPdfStream(reportStream,
>servletOutputStream, new HashMap(), new
> JREmptyDataSource());
>
>response.setContentType("application/pdf");
>servletOutputStream.flush();
>servletOutputStream.close();
>
> How should I acccess the servlet objects, or is there a better way to do
> this that is the "wicket way(tm)"?
>
> Much appreciated, Jason
>
> --
> View this message in context: 
> http://www.nabble.com/access-ServletOutputStream-in-wicket-tp21487704p21487704.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Things I miss in Wicket

2009-01-15 Thread Sébastien Piller

Hi,

1) and 2) are already implemented, or something very close exists. 3) 
may be a good improvement, maybe with a new wicket tag 
(). let's see what think 
core developpers


1) you have various way of altering tags and attributes: 
attributemodifiers, attributeappenders, overriding oncomponenttag, 
oncomponenttagbody...
2) you have the special wicket tag "key="resourcekey">[...]" to automatically add labels 
and stringmodels without any java representation




Tobias Marx wrote:

Hi there!

There are some things in Wicket I am missing and I think they could improve the 
framework a lot.

But just some small background first:

In my opinion the most important things in a web application are:

- as few lines of code as possible, as many as really necessary

- separation of design and web application code and logic

- if a webapplication changes in the design or some small items are added this 
should be possible without needing a java developer


Therefore I would like to suggest more intelligent templates in Wicket:

1. Pass parameters inside of wicket components eg:



and make them accessible in the Java code.

This is  a way to customize and reuse components purely by editing templates


2. Make Strings/Labels accessible directly in templatesto avoid redundant 
code like this:

add(new Label("indexTitle", .) and instead allow to add properties directly.

3. Pick up components automatically without needing to add them in the Java 
code:

add(new LastPostsPanel("lastPostsPanel"));
add(new NewsPanel("newsPanel"));

This could be matched automatically

I think Wicket could be better without so much redundant copy&paste code...by 
improving templates

Thanks for listening...

Toby




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


  



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



Re: Things I miss in Wicket

2009-01-15 Thread Igor Vaynberg
On Thu, Jan 15, 2009 at 1:44 PM, Tobias Marx  wrote:
> Hi there!
>
> There are some things in Wicket I am missing and I think they could improve 
> the framework a lot.
>
> But just some small background first:
>
> In my opinion the most important things in a web application are:
>
> - as few lines of code as possible, as many as really necessary

what good is a few lines if they are not maintainable? in wicket we
try to focus on the maintainability of the code first, not on the LOC
it takes to accomplished X. Further in your email you hint at moving
things into markup where everything a string and nothing is validated
by a compiler - this, while might be the quickest and easiest
approach, leads to unmaintainable code down the road. it also defines
behavior in two places instead of one, leading to more confusing code.

> - separation of design and web application code and logic
>
> - if a webapplication changes in the design or some small items are added 
> this should be possible without needing a java developer

this is possible to a large degree in wicket already, keeping in mind
that wicket's definition of "design" is very strict.

> Therefore I would like to suggest more intelligent templates in Wicket:
>
> 1. Pass parameters inside of wicket components eg:
>
> 
>
> and make them accessible in the Java code.

you can do this. override oncomponenttag(tag) {
paramA=tag.getattributes().get("paramA"); }

> This is  a way to customize and reuse components purely by editing templates

like i said earlier, this is not really wicket's philosophy.
everything that affects behavior should be in java.

> 2. Make Strings/Labels accessible directly in templatesto avoid redundant 
> code like this:
>
> add(new Label("indexTitle", .) and instead allow to add properties 
> directly.

see wicket:message tag and attribute.

> 3. Pick up components automatically without needing to add them in the Java 
> code:
>
> add(new LastPostsPanel("lastPostsPanel"));
> add(new NewsPanel("newsPanel"));
>
> This could be matched automatically

you can accomplish this via IComponentResolver, there was a thread
recently on the list about this. getting back to maintainability -
this forces you to put the class name as a string into the template,
what happens when you rename or move that class?

-igor

> I think Wicket could be better without so much redundant copy&paste code...by 
> improving templates
>
> Thanks for listening...
>
> Toby
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



access ServletOutputStream in wicket

2009-01-15 Thread novotny

Hi,

I'm learning Jasper to create/display a PDF when a link is clicked and the
template code I have looks like:

ServletOutputStream servletOutputStream = response.getOutputStream();
InputStream reportStream =
getServletConfig().getServletContext().getResourceAsStream("/reports/FirstReport.jasper");
  
JasperRunManager.runReportToPdfStream(reportStream,
servletOutputStream, new HashMap(), new
JREmptyDataSource());

response.setContentType("application/pdf");
servletOutputStream.flush();
servletOutputStream.close();

How should I acccess the servlet objects, or is there a better way to do
this that is the "wicket way(tm)"?

Much appreciated, Jason
   
-- 
View this message in context: 
http://www.nabble.com/access-ServletOutputStream-in-wicket-tp21487704p21487704.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Things I miss in Wicket

2009-01-15 Thread Tobias Marx
Hi there!

There are some things in Wicket I am missing and I think they could improve the 
framework a lot.

But just some small background first:

In my opinion the most important things in a web application are:

- as few lines of code as possible, as many as really necessary

- separation of design and web application code and logic

- if a webapplication changes in the design or some small items are added this 
should be possible without needing a java developer


Therefore I would like to suggest more intelligent templates in Wicket:

1. Pass parameters inside of wicket components eg:



and make them accessible in the Java code.

This is  a way to customize and reuse components purely by editing templates


2. Make Strings/Labels accessible directly in templatesto avoid redundant 
code like this:

add(new Label("indexTitle", .) and instead allow to add properties directly.

3. Pick up components automatically without needing to add them in the Java 
code:

add(new LastPostsPanel("lastPostsPanel"));
add(new NewsPanel("newsPanel"));

This could be matched automatically

I think Wicket could be better without so much redundant copy&paste code...by 
improving templates

Thanks for listening...

Toby




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



lucene document property resolve with datatable?

2009-01-15 Thread Phillip Rhodes
Hi,
I am trying to display a lucene document as a row in the datatable.

Here is how I am defining my column:
PropertyColumn col = new PropertyColumn(new Model("Name"),  "get('NAME')", 
"get('NAME')");

The "get('NAME')" is a call to the document.get(String fieldName) method on the 
lucene document.

I get the following error message:
WicketMessage: No get method defined for class: class 
org.apache.lucene.document.Document expression: get('NAME')


Is there a way to get the property resolver to work with the lucene document, 
or should I give up and write a wrapper for the lucene document?

Thank you!







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



Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


this is a really good point. i think i'm -1 on the idea too unless there's a
good proposal for how to avoid that problem.


igor.vaynberg wrote:
> 
> if we do this then as a reusable component developer you have to
> always be aware of this default and code with it in mind because it is
> outside your control yet impacts the behaviors of components. -1 from
> me.
> 
> -igor
> 
> On Thu, Jan 15, 2009 at 12:25 PM, Jonathan Locke
>  wrote:
>>
>>
>> yeah, for full flexibility, you might just link a method in Component to
>> a
>> default in IRequestCycleSettings:
>>
>> boolean getCacheComponentVisibility() { return
>> getApplication().getRequestCycleSettings().getCacheComponentVisibility();
>> }
>>
>> then you can set a default and override for any individual component (or
>> page).
>>
>>
>> Martin Makundi wrote:
>>>
 you could always work it the other way and have no caching by default
 but
 allow people who know what they're doing to enable it for an
 application
 with something like
 IRequestCycleSettings#setCacheComponentVisibility(boolean).
>>>
>>> This sounds more robust, so long as it can be controlled on a
>>> per-request basis (i.e., you can configure it for a specific page and
>>> state).
>>>
>>> And don't forget about isEnabled too though it is more rare ;)
>>>
>>> **
>>> Martin
>>>


 Martin Makundi wrote:
>
> Well... I would not build in the cache because different components
> could interact in a way that if someone prematurely calls the
> isVisible method, it freezes in the wrong state. It is known, that the
> isVisible is called multiple times for various reasons.
>
> **
> Martin
>
> 2009/1/15 Jonathan Locke :
>>
>>
>> not sure. it /ought/ to make sense to cache during the render cycle.
>> but
>> i
>> have the eerie sense that this came up before, so maybe there's some
>> reason
>> why it can't be cached? (although even if there are some odd cases
>> where
>> it
>> can't be, it seems like you could make a workaround for those cases
>> ..)
>>
>>
>> Scott Swank wrote:
>>>
>>> Is there a reason why the default behavior is not to cache the
>>> result
>>> of isVisible()?  Are there cases where the result of isVisible() is
>>> expected to change over the course of rendering?
>>>
>>> Would a JIRA w/ code be welcome, or is the current behavior
>>> required?
>>>
>>> Scott
>>>
>>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>>  wrote:


 I would be careful not to throw the baby out with the bath water
 here.
 The
 design decision you're making is push versus pull and implementing
 isVisible
 is often going to be a better design decision because it may be
 more
 clear
 that visibility state stays consistent for a given problem. If the
 performance actually shows up as a hotspot (don't prematurely
 optimize!),
 you can always do some appropriate caching of the value and still
 have
 it
 "pulled".


 Erik van Oosten wrote:
>
> In the thread "Where to process PageParameters" I was requested to
> explain why I think you should not override isVisible, but rather
> should
> call setVisible in onBeforeRender (slide 100 in my presentation
> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>
> There are 2 reasons, but only the second one is really important.
>
> -1- isVisible is called a lot. It is easily called ten times
> within
> 1
> request
>
> So if you have anything processor intensive going on, it will be a
> performance hit. Just doing a simple expression is of course no
> problem.
> (For fun, just set a breakpoint in something like
> FeedbackPanel#isVisible and request a page that contains one.)
>
> -2- isVisible can make your model be reloaded multiple times
> within
> 1
> request
>
> Consider the following case (pseudo code):
>
>   MyPanel(id, personId) {
>  super(id, new CompoundPropertyModel(new
> LoadableDetachablePersonModel(personId)));
>  add( new Label("address") {
>  @Override
>  isVisible() {
>  return getDefaultModel() != null;
>  }
>  });
>   }
>
>
> The label uses the property 'address' of a person to see if the
> label
> should be visible. The person is retrieved by a
> LoadableDetachableModel
> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>
> During the render phase, isVisible will delegate getti

Re: skip item in populateItem of ListView

2009-01-15 Thread Erik van Oosten
Perhaps it would be more natural to use RepeatingView (or 
RefreshingView) in such cases.


Regards,
   Erik.


Steve Swinsburg wrote:

Hi all,

I have a situation whereby certain conditions mean I need to skip an 
item that is being rendered in a ListView.
ie inside the populateItem() method I do some processing and if that 
item fails, it shouldn't be rendered so I'd like to skip to the next 
item.


I know I *could* process the list before it reaches the ListView but 
I'd prefer not to iterate over the list twice.


Is there some way of skipping this item or not showing the item (and 
making sure none of its content is output)?



thanks,
Steve



--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


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



Re: Why you should not override isVisible

2009-01-15 Thread Igor Vaynberg
if we do this then as a reusable component developer you have to
always be aware of this default and code with it in mind because it is
outside your control yet impacts the behaviors of components. -1 from
me.

-igor

On Thu, Jan 15, 2009 at 12:25 PM, Jonathan Locke
 wrote:
>
>
> yeah, for full flexibility, you might just link a method in Component to a
> default in IRequestCycleSettings:
>
> boolean getCacheComponentVisibility() { return
> getApplication().getRequestCycleSettings().getCacheComponentVisibility(); }
>
> then you can set a default and override for any individual component (or
> page).
>
>
> Martin Makundi wrote:
>>
>>> you could always work it the other way and have no caching by default but
>>> allow people who know what they're doing to enable it for an application
>>> with something like
>>> IRequestCycleSettings#setCacheComponentVisibility(boolean).
>>
>> This sounds more robust, so long as it can be controlled on a
>> per-request basis (i.e., you can configure it for a specific page and
>> state).
>>
>> And don't forget about isEnabled too though it is more rare ;)
>>
>> **
>> Martin
>>
>>>
>>>
>>> Martin Makundi wrote:

 Well... I would not build in the cache because different components
 could interact in a way that if someone prematurely calls the
 isVisible method, it freezes in the wrong state. It is known, that the
 isVisible is called multiple times for various reasons.

 **
 Martin

 2009/1/15 Jonathan Locke :
>
>
> not sure. it /ought/ to make sense to cache during the render cycle.
> but
> i
> have the eerie sense that this came up before, so maybe there's some
> reason
> why it can't be cached? (although even if there are some odd cases
> where
> it
> can't be, it seems like you could make a workaround for those cases ..)
>
>
> Scott Swank wrote:
>>
>> Is there a reason why the default behavior is not to cache the result
>> of isVisible()?  Are there cases where the result of isVisible() is
>> expected to change over the course of rendering?
>>
>> Would a JIRA w/ code be welcome, or is the current behavior required?
>>
>> Scott
>>
>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> I would be careful not to throw the baby out with the bath water
>>> here.
>>> The
>>> design decision you're making is push versus pull and implementing
>>> isVisible
>>> is often going to be a better design decision because it may be more
>>> clear
>>> that visibility state stays consistent for a given problem. If the
>>> performance actually shows up as a hotspot (don't prematurely
>>> optimize!),
>>> you can always do some appropriate caching of the value and still
>>> have
>>> it
>>> "pulled".
>>>
>>>
>>> Erik van Oosten wrote:

 In the thread "Where to process PageParameters" I was requested to
 explain why I think you should not override isVisible, but rather
 should
 call setVisible in onBeforeRender (slide 100 in my presentation
 http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).

 There are 2 reasons, but only the second one is really important.

 -1- isVisible is called a lot. It is easily called ten times within
 1
 request

 So if you have anything processor intensive going on, it will be a
 performance hit. Just doing a simple expression is of course no
 problem.
 (For fun, just set a breakpoint in something like
 FeedbackPanel#isVisible and request a page that contains one.)

 -2- isVisible can make your model be reloaded multiple times within
 1
 request

 Consider the following case (pseudo code):

   MyPanel(id, personId) {
  super(id, new CompoundPropertyModel(new
 LoadableDetachablePersonModel(personId)));
  add( new Label("address") {
  @Override
  isVisible() {
  return getDefaultModel() != null;
  }
  });
   }


 The label uses the property 'address' of a person to see if the
 label
 should be visible. The person is retrieved by a
 LoadableDetachableModel
 subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).

 During the render phase, isVisible will delegate getting the address
 property to the CPM and this model delegates it to the LDM. LDM will
 load the person from the database only once (well until it is
 detached).

 At the end of the render phase everything will be detached. But now
 something weird happens. The problem is that isVisible is called
 during
>

Re: Why you should not override isVisible

2009-01-15 Thread Martijn Dashorst
On Thu, Jan 15, 2009 at 9:38 PM, Erik van Oosten  wrote:
> I actually thought they were in English, but I now see that the first few
> are in Dutch. Not sure why I did that. They are not that important, so just
> read on...

You can probably have a good laugh at google translate (or babelfish)
and see what gets lost in translation :)

Martijn

(who had some fun with the translation from dutch to english of the
recent dutch news article  "Naked man with raw trout abuses shoe
salesman")

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



Re: Why you should not override isVisible

2009-01-15 Thread Erik van Oosten
Indeed. If this would no longer be the case, overriding isVisible would 
be no problem (though caching would be nice).


Regards,
   Erik.



Martijn Dashorst wrote:

What is strange is that isvisible is being checked during detach (I
seriously doubt that). That shouldn't be happening: *all* components
should be detached regardless of their visibility.

Martijn
  


--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


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



Re: Why you should not override isVisible

2009-01-15 Thread Martijn Dashorst
What is strange is that isvisible is being checked during detach (I
seriously doubt that). That shouldn't be happening: *all* components
should be detached regardless of their visibility.

Martijn

On Thu, Jan 15, 2009 at 9:29 PM, Jonathan Locke
 wrote:
>
>
> i think the next step is to see what the core team thinks about this. filing
> a ticket couldn't hurt.
>
>
> Jonathan Locke wrote:
>>
>>
>> yeah, for full flexibility, you might just link a method in Component to a
>> default in IRequestCycleSettings:
>>
>> boolean getCacheComponentVisibility() { return
>> getApplication().getRequestCycleSettings().getCacheComponentVisibility();
>> }
>>
>> then you can set a default and override for any individual component (or
>> page).
>>
>>
>> Martin Makundi wrote:
>>>
 you could always work it the other way and have no caching by default
 but
 allow people who know what they're doing to enable it for an application
 with something like
 IRequestCycleSettings#setCacheComponentVisibility(boolean).
>>>
>>> This sounds more robust, so long as it can be controlled on a
>>> per-request basis (i.e., you can configure it for a specific page and
>>> state).
>>>
>>> And don't forget about isEnabled too though it is more rare ;)
>>>
>>> **
>>> Martin
>>>


 Martin Makundi wrote:
>
> Well... I would not build in the cache because different components
> could interact in a way that if someone prematurely calls the
> isVisible method, it freezes in the wrong state. It is known, that the
> isVisible is called multiple times for various reasons.
>
> **
> Martin
>
> 2009/1/15 Jonathan Locke :
>>
>>
>> not sure. it /ought/ to make sense to cache during the render cycle.
>> but
>> i
>> have the eerie sense that this came up before, so maybe there's some
>> reason
>> why it can't be cached? (although even if there are some odd cases
>> where
>> it
>> can't be, it seems like you could make a workaround for those cases
>> ..)
>>
>>
>> Scott Swank wrote:
>>>
>>> Is there a reason why the default behavior is not to cache the result
>>> of isVisible()?  Are there cases where the result of isVisible() is
>>> expected to change over the course of rendering?
>>>
>>> Would a JIRA w/ code be welcome, or is the current behavior required?
>>>
>>> Scott
>>>
>>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>>  wrote:


 I would be careful not to throw the baby out with the bath water
 here.
 The
 design decision you're making is push versus pull and implementing
 isVisible
 is often going to be a better design decision because it may be more
 clear
 that visibility state stays consistent for a given problem. If the
 performance actually shows up as a hotspot (don't prematurely
 optimize!),
 you can always do some appropriate caching of the value and still
 have
 it
 "pulled".


 Erik van Oosten wrote:
>
> In the thread "Where to process PageParameters" I was requested to
> explain why I think you should not override isVisible, but rather
> should
> call setVisible in onBeforeRender (slide 100 in my presentation
> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>
> There are 2 reasons, but only the second one is really important.
>
> -1- isVisible is called a lot. It is easily called ten times within
> 1
> request
>
> So if you have anything processor intensive going on, it will be a
> performance hit. Just doing a simple expression is of course no
> problem.
> (For fun, just set a breakpoint in something like
> FeedbackPanel#isVisible and request a page that contains one.)
>
> -2- isVisible can make your model be reloaded multiple times within
> 1
> request
>
> Consider the following case (pseudo code):
>
>   MyPanel(id, personId) {
>  super(id, new CompoundPropertyModel(new
> LoadableDetachablePersonModel(personId)));
>  add( new Label("address") {
>  @Override
>  isVisible() {
>  return getDefaultModel() != null;
>  }
>  });
>   }
>
>
> The label uses the property 'address' of a person to see if the
> label
> should be visible. The person is retrieved by a
> LoadableDetachableModel
> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>
> During the render phase, isVisible will delegate getting the
> address
> property to the CPM and this model delegates it to the LDM. LDM
>>

Re: Why you should not override isVisible

2009-01-15 Thread Erik van Oosten

Hi Pierre,

I actually thought they were in English, but I now see that the first 
few are in Dutch. Not sure why I did that. They are not that important, 
so just read on...


Regards,
   Erik.


Pierre Goupil wrote:

Good evening,

I'm sorry to bug you, but I'be read the presentation you're talking 
about in this post and was wondering if you have an english-speaking 
commented one available ?


Nice work !

Regards,

Pierre Goupil




--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


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



Re: skip item in populateItem of ListView

2009-01-15 Thread Jeremy Thomerson
ListItem.item.setVisibilityAllowed(false) - should work for you.

On Thu, Jan 15, 2009 at 1:16 PM, Stephen Swinsburg <
s.swinsb...@lancaster.ac.uk> wrote:

>
> I haven't tried that (yet) but once I do the checks I need it to stop
> rendering that item. So the rest of the stuff tahts meant to be rendered
> never gets processed.
> Nevermind I will do the checks before the data even reaches the
> LoadableDetachableModel feeding it.
>
> cheers.
>
>
>
>
> On 15/01/2009, at 5:32 PM, Martin Makundi wrote:
>
>  Sounds like bad design that's going to give you headaches later...
>> nevertheless, did you try setting the listItem.setVisible(false)?
>>
>> **
>> Martin
>>
>> 2009/1/15 Steve Swinsburg :
>>
>>> Hi all,
>>>
>>> I have a situation whereby certain conditions mean I need to skip an item
>>> that is being rendered in a ListView.
>>> ie inside the populateItem() method I do some processing and if that item
>>> fails, it shouldn't be rendered so I'd like to skip to the next item.
>>>
>>> I know I *could* process the list before it reaches the ListView but I'd
>>> prefer not to iterate over the list twice.
>>>
>>> Is there some way of skipping this item or not showing the item (and
>>> making
>>> sure none of its content is output)?
>>>
>>>
>>> thanks,
>>> Steve
>>>
>>>
>>>
>>>
>>>
>>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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


Re: JavaScript and Wicket

2009-01-15 Thread Jeremy Thomerson
Do you mean that you want to call back to Wicket from client-side JS?  If
so, see any of the AbstractAjaxBehavior implementations - you'll see how
they generate a callback to server-side.

On Thu, Jan 15, 2009 at 11:04 AM, Sniffer wrote:

>
> Hi,
> I'm a beginner about Wicket and the main issue which I have is JavaScript
> and Wicket integration. My question is is it possible to pass JavaScript
> variable value to Wicket as Wicket link parameter?
>
> Here are some part of code which I have:
>
> // Set link on data cell
> Link callUpdateWindow = new Link("callUpdateWindow", item.getModel()) {
>public void onClick() {
>}
> };
> String call = String.format("showUpdate('%s');", item.getIndex());
> callUpdateWindow.add(new AttributeModifier("onclick", true, new
> Model(call)));
>
>
> HTML:
>  wicket:id="callUpdateWindow">
>img/icon/dot_green.png
> 
>
> And this is working fine, Wicket set onclick attribute with desired value
> to
> JavaScript function, but then from HTML I don't know how to return
> JavaScript set value to Wicket.
>
> Please any kind of help!
>
> Best regards,
> Aleksandar Cajic
> --
> View this message in context:
> http://www.nabble.com/JavaScript-and-Wicket-tp21481992p21481992.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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


Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


i think the next step is to see what the core team thinks about this. filing
a ticket couldn't hurt.


Jonathan Locke wrote:
> 
> 
> yeah, for full flexibility, you might just link a method in Component to a
> default in IRequestCycleSettings:
> 
> boolean getCacheComponentVisibility() { return
> getApplication().getRequestCycleSettings().getCacheComponentVisibility();
> }
> 
> then you can set a default and override for any individual component (or
> page).
> 
> 
> Martin Makundi wrote:
>> 
>>> you could always work it the other way and have no caching by default
>>> but
>>> allow people who know what they're doing to enable it for an application
>>> with something like
>>> IRequestCycleSettings#setCacheComponentVisibility(boolean).
>> 
>> This sounds more robust, so long as it can be controlled on a
>> per-request basis (i.e., you can configure it for a specific page and
>> state).
>> 
>> And don't forget about isEnabled too though it is more rare ;)
>> 
>> **
>> Martin
>> 
>>>
>>>
>>> Martin Makundi wrote:

 Well... I would not build in the cache because different components
 could interact in a way that if someone prematurely calls the
 isVisible method, it freezes in the wrong state. It is known, that the
 isVisible is called multiple times for various reasons.

 **
 Martin

 2009/1/15 Jonathan Locke :
>
>
> not sure. it /ought/ to make sense to cache during the render cycle.
> but
> i
> have the eerie sense that this came up before, so maybe there's some
> reason
> why it can't be cached? (although even if there are some odd cases
> where
> it
> can't be, it seems like you could make a workaround for those cases
> ..)
>
>
> Scott Swank wrote:
>>
>> Is there a reason why the default behavior is not to cache the result
>> of isVisible()?  Are there cases where the result of isVisible() is
>> expected to change over the course of rendering?
>>
>> Would a JIRA w/ code be welcome, or is the current behavior required?
>>
>> Scott
>>
>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> I would be careful not to throw the baby out with the bath water
>>> here.
>>> The
>>> design decision you're making is push versus pull and implementing
>>> isVisible
>>> is often going to be a better design decision because it may be more
>>> clear
>>> that visibility state stays consistent for a given problem. If the
>>> performance actually shows up as a hotspot (don't prematurely
>>> optimize!),
>>> you can always do some appropriate caching of the value and still
>>> have
>>> it
>>> "pulled".
>>>
>>>
>>> Erik van Oosten wrote:

 In the thread "Where to process PageParameters" I was requested to
 explain why I think you should not override isVisible, but rather
 should
 call setVisible in onBeforeRender (slide 100 in my presentation
 http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).

 There are 2 reasons, but only the second one is really important.

 -1- isVisible is called a lot. It is easily called ten times within
 1
 request

 So if you have anything processor intensive going on, it will be a
 performance hit. Just doing a simple expression is of course no
 problem.
 (For fun, just set a breakpoint in something like
 FeedbackPanel#isVisible and request a page that contains one.)

 -2- isVisible can make your model be reloaded multiple times within
 1
 request

 Consider the following case (pseudo code):

   MyPanel(id, personId) {
  super(id, new CompoundPropertyModel(new
 LoadableDetachablePersonModel(personId)));
  add( new Label("address") {
  @Override
  isVisible() {
  return getDefaultModel() != null;
  }
  });
   }


 The label uses the property 'address' of a person to see if the
 label
 should be visible. The person is retrieved by a
 LoadableDetachableModel
 subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).

 During the render phase, isVisible will delegate getting the
 address
 property to the CPM and this model delegates it to the LDM. LDM
 will
 load the person from the database only once (well until it is
 detached).

 At the end of the render phase everything will be detached. But now
 something weird happens. The problem is that isVisible is called
 during
 the detach phase, on the label /after/ the CPM (and therefore also
 the
 LDM) are detac

Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


yeah, for full flexibility, you might just link a method in Component to a
default in IRequestCycleSettings:

boolean getCacheComponentVisibility() { return
getApplication().getRequestCycleSettings().getCacheComponentVisibility(); }

then you can set a default and override for any individual component (or
page).


Martin Makundi wrote:
> 
>> you could always work it the other way and have no caching by default but
>> allow people who know what they're doing to enable it for an application
>> with something like
>> IRequestCycleSettings#setCacheComponentVisibility(boolean).
> 
> This sounds more robust, so long as it can be controlled on a
> per-request basis (i.e., you can configure it for a specific page and
> state).
> 
> And don't forget about isEnabled too though it is more rare ;)
> 
> **
> Martin
> 
>>
>>
>> Martin Makundi wrote:
>>>
>>> Well... I would not build in the cache because different components
>>> could interact in a way that if someone prematurely calls the
>>> isVisible method, it freezes in the wrong state. It is known, that the
>>> isVisible is called multiple times for various reasons.
>>>
>>> **
>>> Martin
>>>
>>> 2009/1/15 Jonathan Locke :


 not sure. it /ought/ to make sense to cache during the render cycle.
 but
 i
 have the eerie sense that this came up before, so maybe there's some
 reason
 why it can't be cached? (although even if there are some odd cases
 where
 it
 can't be, it seems like you could make a workaround for those cases ..)


 Scott Swank wrote:
>
> Is there a reason why the default behavior is not to cache the result
> of isVisible()?  Are there cases where the result of isVisible() is
> expected to change over the course of rendering?
>
> Would a JIRA w/ code be welcome, or is the current behavior required?
>
> Scott
>
> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>  wrote:
>>
>>
>> I would be careful not to throw the baby out with the bath water
>> here.
>> The
>> design decision you're making is push versus pull and implementing
>> isVisible
>> is often going to be a better design decision because it may be more
>> clear
>> that visibility state stays consistent for a given problem. If the
>> performance actually shows up as a hotspot (don't prematurely
>> optimize!),
>> you can always do some appropriate caching of the value and still
>> have
>> it
>> "pulled".
>>
>>
>> Erik van Oosten wrote:
>>>
>>> In the thread "Where to process PageParameters" I was requested to
>>> explain why I think you should not override isVisible, but rather
>>> should
>>> call setVisible in onBeforeRender (slide 100 in my presentation
>>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>>>
>>> There are 2 reasons, but only the second one is really important.
>>>
>>> -1- isVisible is called a lot. It is easily called ten times within
>>> 1
>>> request
>>>
>>> So if you have anything processor intensive going on, it will be a
>>> performance hit. Just doing a simple expression is of course no
>>> problem.
>>> (For fun, just set a breakpoint in something like
>>> FeedbackPanel#isVisible and request a page that contains one.)
>>>
>>> -2- isVisible can make your model be reloaded multiple times within
>>> 1
>>> request
>>>
>>> Consider the following case (pseudo code):
>>>
>>>   MyPanel(id, personId) {
>>>  super(id, new CompoundPropertyModel(new
>>> LoadableDetachablePersonModel(personId)));
>>>  add( new Label("address") {
>>>  @Override
>>>  isVisible() {
>>>  return getDefaultModel() != null;
>>>  }
>>>  });
>>>   }
>>>
>>>
>>> The label uses the property 'address' of a person to see if the
>>> label
>>> should be visible. The person is retrieved by a
>>> LoadableDetachableModel
>>> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>>>
>>> During the render phase, isVisible will delegate getting the address
>>> property to the CPM and this model delegates it to the LDM. LDM will
>>> load the person from the database only once (well until it is
>>> detached).
>>>
>>> At the end of the render phase everything will be detached. But now
>>> something weird happens. The problem is that isVisible is called
>>> during
>>> the detach phase, on the label /after/ the CPM (and therefore also
>>> the
>>> LDM) are detached. As isVisible retrieves the model from the CPM,
>>> and
>>> therefore from the LDM, it will trigger a reload of the person
>>> inside
>>> the LDM.
>>>
>>> Now, as visibility is often (if not almost always) determined by a
>>> business object (e.g. very often a LDM) I think it 

Re: Why you should not override isVisible

2009-01-15 Thread Martin Makundi
> you could always work it the other way and have no caching by default but
> allow people who know what they're doing to enable it for an application
> with something like
> IRequestCycleSettings#setCacheComponentVisibility(boolean).

This sounds more robust, so long as it can be controlled on a
per-request basis (i.e., you can configure it for a specific page and
state).

And don't forget about isEnabled too though it is more rare ;)

**
Martin

>
>
> Martin Makundi wrote:
>>
>> Well... I would not build in the cache because different components
>> could interact in a way that if someone prematurely calls the
>> isVisible method, it freezes in the wrong state. It is known, that the
>> isVisible is called multiple times for various reasons.
>>
>> **
>> Martin
>>
>> 2009/1/15 Jonathan Locke :
>>>
>>>
>>> not sure. it /ought/ to make sense to cache during the render cycle. but
>>> i
>>> have the eerie sense that this came up before, so maybe there's some
>>> reason
>>> why it can't be cached? (although even if there are some odd cases where
>>> it
>>> can't be, it seems like you could make a workaround for those cases ..)
>>>
>>>
>>> Scott Swank wrote:

 Is there a reason why the default behavior is not to cache the result
 of isVisible()?  Are there cases where the result of isVisible() is
 expected to change over the course of rendering?

 Would a JIRA w/ code be welcome, or is the current behavior required?

 Scott

 On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
  wrote:
>
>
> I would be careful not to throw the baby out with the bath water here.
> The
> design decision you're making is push versus pull and implementing
> isVisible
> is often going to be a better design decision because it may be more
> clear
> that visibility state stays consistent for a given problem. If the
> performance actually shows up as a hotspot (don't prematurely
> optimize!),
> you can always do some appropriate caching of the value and still have
> it
> "pulled".
>
>
> Erik van Oosten wrote:
>>
>> In the thread "Where to process PageParameters" I was requested to
>> explain why I think you should not override isVisible, but rather
>> should
>> call setVisible in onBeforeRender (slide 100 in my presentation
>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>>
>> There are 2 reasons, but only the second one is really important.
>>
>> -1- isVisible is called a lot. It is easily called ten times within 1
>> request
>>
>> So if you have anything processor intensive going on, it will be a
>> performance hit. Just doing a simple expression is of course no
>> problem.
>> (For fun, just set a breakpoint in something like
>> FeedbackPanel#isVisible and request a page that contains one.)
>>
>> -2- isVisible can make your model be reloaded multiple times within 1
>> request
>>
>> Consider the following case (pseudo code):
>>
>>   MyPanel(id, personId) {
>>  super(id, new CompoundPropertyModel(new
>> LoadableDetachablePersonModel(personId)));
>>  add( new Label("address") {
>>  @Override
>>  isVisible() {
>>  return getDefaultModel() != null;
>>  }
>>  });
>>   }
>>
>>
>> The label uses the property 'address' of a person to see if the label
>> should be visible. The person is retrieved by a
>> LoadableDetachableModel
>> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>>
>> During the render phase, isVisible will delegate getting the address
>> property to the CPM and this model delegates it to the LDM. LDM will
>> load the person from the database only once (well until it is
>> detached).
>>
>> At the end of the render phase everything will be detached. But now
>> something weird happens. The problem is that isVisible is called
>> during
>> the detach phase, on the label /after/ the CPM (and therefore also the
>> LDM) are detached. As isVisible retrieves the model from the CPM, and
>> therefore from the LDM, it will trigger a reload of the person inside
>> the LDM.
>>
>> Now, as visibility is often (if not almost always) determined by a
>> business object (e.g. very often a LDM) I think it makes sense to
>> avoid
>> having to think about the situation described above, and just avoid it
>> all together.
>>
>> Note: I observed this behavior in Wicket 1.3 (1.3.3 I think). If it
>> works differently now, I would be very glad to withdraw this
>> recommendation.
>>
>> Regards,
>>  Erik.
>>
>> --
>> Erik van Oosten
>> http://day-to-day-stuff.blogspot.com/
>>
>>
>>
>> -
>> To unsubscribe, 

Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


well yes, it might break existing behavior, that's why i suggested having a
workaround for that. although i would think that well-designed isVisible
methods shouldn't generally have this problem. 

you could always work it the other way and have no caching by default but
allow people who know what they're doing to enable it for an application
with something like
IRequestCycleSettings#setCacheComponentVisibility(boolean).


Martin Makundi wrote:
> 
> Well... I would not build in the cache because different components
> could interact in a way that if someone prematurely calls the
> isVisible method, it freezes in the wrong state. It is known, that the
> isVisible is called multiple times for various reasons.
> 
> **
> Martin
> 
> 2009/1/15 Jonathan Locke :
>>
>>
>> not sure. it /ought/ to make sense to cache during the render cycle. but
>> i
>> have the eerie sense that this came up before, so maybe there's some
>> reason
>> why it can't be cached? (although even if there are some odd cases where
>> it
>> can't be, it seems like you could make a workaround for those cases ..)
>>
>>
>> Scott Swank wrote:
>>>
>>> Is there a reason why the default behavior is not to cache the result
>>> of isVisible()?  Are there cases where the result of isVisible() is
>>> expected to change over the course of rendering?
>>>
>>> Would a JIRA w/ code be welcome, or is the current behavior required?
>>>
>>> Scott
>>>
>>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>>  wrote:


 I would be careful not to throw the baby out with the bath water here.
 The
 design decision you're making is push versus pull and implementing
 isVisible
 is often going to be a better design decision because it may be more
 clear
 that visibility state stays consistent for a given problem. If the
 performance actually shows up as a hotspot (don't prematurely
 optimize!),
 you can always do some appropriate caching of the value and still have
 it
 "pulled".


 Erik van Oosten wrote:
>
> In the thread "Where to process PageParameters" I was requested to
> explain why I think you should not override isVisible, but rather
> should
> call setVisible in onBeforeRender (slide 100 in my presentation
> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>
> There are 2 reasons, but only the second one is really important.
>
> -1- isVisible is called a lot. It is easily called ten times within 1
> request
>
> So if you have anything processor intensive going on, it will be a
> performance hit. Just doing a simple expression is of course no
> problem.
> (For fun, just set a breakpoint in something like
> FeedbackPanel#isVisible and request a page that contains one.)
>
> -2- isVisible can make your model be reloaded multiple times within 1
> request
>
> Consider the following case (pseudo code):
>
>   MyPanel(id, personId) {
>  super(id, new CompoundPropertyModel(new
> LoadableDetachablePersonModel(personId)));
>  add( new Label("address") {
>  @Override
>  isVisible() {
>  return getDefaultModel() != null;
>  }
>  });
>   }
>
>
> The label uses the property 'address' of a person to see if the label
> should be visible. The person is retrieved by a
> LoadableDetachableModel
> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>
> During the render phase, isVisible will delegate getting the address
> property to the CPM and this model delegates it to the LDM. LDM will
> load the person from the database only once (well until it is
> detached).
>
> At the end of the render phase everything will be detached. But now
> something weird happens. The problem is that isVisible is called
> during
> the detach phase, on the label /after/ the CPM (and therefore also the
> LDM) are detached. As isVisible retrieves the model from the CPM, and
> therefore from the LDM, it will trigger a reload of the person inside
> the LDM.
>
> Now, as visibility is often (if not almost always) determined by a
> business object (e.g. very often a LDM) I think it makes sense to
> avoid
> having to think about the situation described above, and just avoid it
> all together.
>
> Note: I observed this behavior in Wicket 1.3 (1.3.3 I think). If it
> works differently now, I would be very glad to withdraw this
> recommendation.
>
> Regards,
>  Erik.
>
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>

 --
 Vi

Re: Why you should not override isVisible

2009-01-15 Thread Martin Makundi
Well... I would not build in the cache because different components
could interact in a way that if someone prematurely calls the
isVisible method, it freezes in the wrong state. It is known, that the
isVisible is called multiple times for various reasons.

**
Martin

2009/1/15 Jonathan Locke :
>
>
> not sure. it /ought/ to make sense to cache during the render cycle. but i
> have the eerie sense that this came up before, so maybe there's some reason
> why it can't be cached? (although even if there are some odd cases where it
> can't be, it seems like you could make a workaround for those cases ..)
>
>
> Scott Swank wrote:
>>
>> Is there a reason why the default behavior is not to cache the result
>> of isVisible()?  Are there cases where the result of isVisible() is
>> expected to change over the course of rendering?
>>
>> Would a JIRA w/ code be welcome, or is the current behavior required?
>>
>> Scott
>>
>> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>>  wrote:
>>>
>>>
>>> I would be careful not to throw the baby out with the bath water here.
>>> The
>>> design decision you're making is push versus pull and implementing
>>> isVisible
>>> is often going to be a better design decision because it may be more
>>> clear
>>> that visibility state stays consistent for a given problem. If the
>>> performance actually shows up as a hotspot (don't prematurely optimize!),
>>> you can always do some appropriate caching of the value and still have it
>>> "pulled".
>>>
>>>
>>> Erik van Oosten wrote:

 In the thread "Where to process PageParameters" I was requested to
 explain why I think you should not override isVisible, but rather should
 call setVisible in onBeforeRender (slide 100 in my presentation
 http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).

 There are 2 reasons, but only the second one is really important.

 -1- isVisible is called a lot. It is easily called ten times within 1
 request

 So if you have anything processor intensive going on, it will be a
 performance hit. Just doing a simple expression is of course no problem.
 (For fun, just set a breakpoint in something like
 FeedbackPanel#isVisible and request a page that contains one.)

 -2- isVisible can make your model be reloaded multiple times within 1
 request

 Consider the following case (pseudo code):

   MyPanel(id, personId) {
  super(id, new CompoundPropertyModel(new
 LoadableDetachablePersonModel(personId)));
  add( new Label("address") {
  @Override
  isVisible() {
  return getDefaultModel() != null;
  }
  });
   }


 The label uses the property 'address' of a person to see if the label
 should be visible. The person is retrieved by a LoadableDetachableModel
 subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).

 During the render phase, isVisible will delegate getting the address
 property to the CPM and this model delegates it to the LDM. LDM will
 load the person from the database only once (well until it is detached).

 At the end of the render phase everything will be detached. But now
 something weird happens. The problem is that isVisible is called during
 the detach phase, on the label /after/ the CPM (and therefore also the
 LDM) are detached. As isVisible retrieves the model from the CPM, and
 therefore from the LDM, it will trigger a reload of the person inside
 the LDM.

 Now, as visibility is often (if not almost always) determined by a
 business object (e.g. very often a LDM) I think it makes sense to avoid
 having to think about the situation described above, and just avoid it
 all together.

 Note: I observed this behavior in Wicket 1.3 (1.3.3 I think). If it
 works differently now, I would be very glad to withdraw this
 recommendation.

 Regards,
  Erik.

 --
 Erik van Oosten
 http://day-to-day-stuff.blogspot.com/



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



>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21483816.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this 

Re: Load / Processing Messages

2009-01-15 Thread Martin Makundi
See:
* 
http://mail-archives.apache.org/mod_mbox/wicket-users/200901.mbox/%3c303141550901100017w3480b326vd1cf21e3efa18...@mail.gmail.com%3e

* 
http://cwiki.apache.org/WICKET/generic-busy-indicator-for-both-ajax-and-non-ajax-submits.html

**
Martin

2009/1/15  :
> Hi all,
>
>Sorry to ask such newbie question, but how could I submit a
> request and while the server process it, which will be send a response to
> the same page, the application friendly locks/freezes the whole page (with
> a load/processing animated gif) so the user could not change anything
> while the processing is not done, and once done it is friendly
> unlocked/unfreezed? I tryed to use the an adaptation of lazy load
> component but was unsucessful.
>
>Does anyone has a cookbook for it? Or a wicket or even a ready
> ajax component I can adapt to that?
>
> Thank you
>
> _
> O conteúdo desta mensagem e dos documentos anexos é destinado exclusivamente 
> às pessoas indicadas no endereçamento eletrônico e contém informações 
> confidenciais e/ou legalmente protegidas. Esta mensagem não representa 
> necessariamente as políticas, práticas, intenções ou conclusões da Souza Cruz 
> S.A. É expressamente vedado a qualquer pessoa, sem prévia e expressa 
> autorização, ler, revelar, distribuir, divulgar, alterar, copiar, reproduzir 
> ou, sob qualquer forma, utilizar o todo ou parte desta mensagem ou dos 
> documentos a ela anexados. Caso tenha recebido esta mensagem por engano, 
> queira, por gentileza, avisar imediatamente seu remetente e eliminar 
> completamente do seu sistema.
>
> The contents of this message and of the attached documents are destined for 
> the exclusive use of those persons named in the electronic address and 
> contain confidential and / or legally protected information. This message 
> does not necessarily represent Souza Cruz´s policies, practices, intentions 
> or conclusions. It is strictly forbidden for any person without prior and 
> official authorization to read, reveal, distribute, disclose, alter, copy, 
> reproduce, or in any form or manner to use either the whole, or part of this 
> message, or the attached documents. Should you have received this message and 
> / or the attached documents in error, please notify the sender immediately, 
> and delete it / them from your system completely.

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



Re: skip item in populateItem of ListView

2009-01-15 Thread Stephen Swinsburg


I haven't tried that (yet) but once I do the checks I need it to stop  
rendering that item. So the rest of the stuff tahts meant to be  
rendered never gets processed.
Nevermind I will do the checks before the data even reaches the  
LoadableDetachableModel feeding it.


cheers.



On 15/01/2009, at 5:32 PM, Martin Makundi wrote:


Sounds like bad design that's going to give you headaches later...
nevertheless, did you try setting the listItem.setVisible(false)?

**
Martin

2009/1/15 Steve Swinsburg :

Hi all,

I have a situation whereby certain conditions mean I need to skip  
an item

that is being rendered in a ListView.
ie inside the populateItem() method I do some processing and if  
that item

fails, it shouldn't be rendered so I'd like to skip to the next item.

I know I *could* process the list before it reaches the ListView  
but I'd

prefer not to iterate over the list twice.

Is there some way of skipping this item or not showing the item  
(and making

sure none of its content is output)?


thanks,
Steve







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




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



Load / Processing Messages

2009-01-15 Thread Alex . Borba
Hi all,

Sorry to ask such newbie question, but how could I submit a 
request and while the server process it, which will be send a response to 
the same page, the application friendly locks/freezes the whole page (with 
a load/processing animated gif) so the user could not change anything 
while the processing is not done, and once done it is friendly 
unlocked/unfreezed? I tryed to use the an adaptation of lazy load 
component but was unsucessful. 

Does anyone has a cookbook for it? Or a wicket or even a ready 
ajax component I can adapt to that?

Thank you 

_
O conteúdo desta mensagem e dos documentos anexos é destinado exclusivamente às 
pessoas indicadas no endereçamento eletrônico e contém informações 
confidenciais e/ou legalmente protegidas. Esta mensagem não representa 
necessariamente as políticas, práticas, intenções ou conclusões da Souza Cruz 
S.A. É expressamente vedado a qualquer pessoa, sem prévia e expressa 
autorização, ler, revelar, distribuir, divulgar, alterar, copiar, reproduzir 
ou, sob qualquer forma, utilizar o todo ou parte desta mensagem ou dos 
documentos a ela anexados. Caso tenha recebido esta mensagem por engano, 
queira, por gentileza, avisar imediatamente seu remetente e eliminar 
completamente do seu sistema. 

The contents of this message and of the attached documents are destined for the 
exclusive use of those persons named in the electronic address and contain 
confidential and / or legally protected information. This message does not 
necessarily represent Souza Cruz´s policies, practices, intentions or 
conclusions. It is strictly forbidden for any person without prior and official 
authorization to read, reveal, distribute, disclose, alter, copy, reproduce, or 
in any form or manner to use either the whole, or part of this message, or the 
attached documents. Should you have received this message and / or the attached 
documents in error, please notify the sender immediately, and delete it / them 
from your system completely.

DropDownChoice missing in IE6 when has AJAX

2009-01-15 Thread Alex . Borba
Hi everybody,

I'm new on wicket and ajax, and now I'm having problems mixing 
both. In my page I have some simple DropDownChoice and not related to them 
but to a button I have a Modal Window. 

The problem is, testing my page on IE6, when I scroll the page 
down the dropdown itens get sticked in the same position, giving the 
impression that the whole page rolls over it, but if I scroll the page 
back they are still missing, another curious fact is even if the missin 
component if a click on it, it works, showing my choices there, the 
component (border) keep missing. This problem does not occur on FireFox 
and I coudn't try it on IE7. 

Any suggestion? 

Thanks

_
O conteúdo desta mensagem e dos documentos anexos é destinado exclusivamente às 
pessoas indicadas no endereçamento eletrônico e contém informações 
confidenciais e/ou legalmente protegidas. Esta mensagem não representa 
necessariamente as políticas, práticas, intenções ou conclusões da Souza Cruz 
S.A. É expressamente vedado a qualquer pessoa, sem prévia e expressa 
autorização, ler, revelar, distribuir, divulgar, alterar, copiar, reproduzir 
ou, sob qualquer forma, utilizar o todo ou parte desta mensagem ou dos 
documentos a ela anexados. Caso tenha recebido esta mensagem por engano, 
queira, por gentileza, avisar imediatamente seu remetente e eliminar 
completamente do seu sistema. 

The contents of this message and of the attached documents are destined for the 
exclusive use of those persons named in the electronic address and contain 
confidential and / or legally protected information. This message does not 
necessarily represent Souza Cruz´s policies, practices, intentions or 
conclusions. It is strictly forbidden for any person without prior and official 
authorization to read, reveal, distribute, disclose, alter, copy, reproduce, or 
in any form or manner to use either the whole, or part of this message, or the 
attached documents. Should you have received this message and / or the attached 
documents in error, please notify the sender immediately, and delete it / them 
from your system completely.

Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


not sure. it /ought/ to make sense to cache during the render cycle. but i
have the eerie sense that this came up before, so maybe there's some reason
why it can't be cached? (although even if there are some odd cases where it
can't be, it seems like you could make a workaround for those cases ..)


Scott Swank wrote:
> 
> Is there a reason why the default behavior is not to cache the result
> of isVisible()?  Are there cases where the result of isVisible() is
> expected to change over the course of rendering?
> 
> Would a JIRA w/ code be welcome, or is the current behavior required?
> 
> Scott
> 
> On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
>  wrote:
>>
>>
>> I would be careful not to throw the baby out with the bath water here.
>> The
>> design decision you're making is push versus pull and implementing
>> isVisible
>> is often going to be a better design decision because it may be more
>> clear
>> that visibility state stays consistent for a given problem. If the
>> performance actually shows up as a hotspot (don't prematurely optimize!),
>> you can always do some appropriate caching of the value and still have it
>> "pulled".
>>
>>
>> Erik van Oosten wrote:
>>>
>>> In the thread "Where to process PageParameters" I was requested to
>>> explain why I think you should not override isVisible, but rather should
>>> call setVisible in onBeforeRender (slide 100 in my presentation
>>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>>>
>>> There are 2 reasons, but only the second one is really important.
>>>
>>> -1- isVisible is called a lot. It is easily called ten times within 1
>>> request
>>>
>>> So if you have anything processor intensive going on, it will be a
>>> performance hit. Just doing a simple expression is of course no problem.
>>> (For fun, just set a breakpoint in something like
>>> FeedbackPanel#isVisible and request a page that contains one.)
>>>
>>> -2- isVisible can make your model be reloaded multiple times within 1
>>> request
>>>
>>> Consider the following case (pseudo code):
>>>
>>>   MyPanel(id, personId) {
>>>  super(id, new CompoundPropertyModel(new
>>> LoadableDetachablePersonModel(personId)));
>>>  add( new Label("address") {
>>>  @Override
>>>  isVisible() {
>>>  return getDefaultModel() != null;
>>>  }
>>>  });
>>>   }
>>>
>>>
>>> The label uses the property 'address' of a person to see if the label
>>> should be visible. The person is retrieved by a LoadableDetachableModel
>>> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>>>
>>> During the render phase, isVisible will delegate getting the address
>>> property to the CPM and this model delegates it to the LDM. LDM will
>>> load the person from the database only once (well until it is detached).
>>>
>>> At the end of the render phase everything will be detached. But now
>>> something weird happens. The problem is that isVisible is called during
>>> the detach phase, on the label /after/ the CPM (and therefore also the
>>> LDM) are detached. As isVisible retrieves the model from the CPM, and
>>> therefore from the LDM, it will trigger a reload of the person inside
>>> the LDM.
>>>
>>> Now, as visibility is often (if not almost always) determined by a
>>> business object (e.g. very often a LDM) I think it makes sense to avoid
>>> having to think about the situation described above, and just avoid it
>>> all together.
>>>
>>> Note: I observed this behavior in Wicket 1.3 (1.3.3 I think). If it
>>> works differently now, I would be very glad to withdraw this
>>> recommendation.
>>>
>>> Regards,
>>>  Erik.
>>>
>>> --
>>> Erik van Oosten
>>> http://day-to-day-stuff.blogspot.com/
>>>
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21483816.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21484456.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Ajax-Update MarkupContaining containing FormComponent without loosing user changes

2009-01-15 Thread Stefan Fußenegger

My suggestions was to actually maintain a minimal JS api in the future. I
don't believe that the very basic utility functions are going to change
between minor versions. So it might be worth thinking about making this API
official. The users would definitely benefit from it - and nobody would have
to write a single line of code. It's just a suggestion, as I think it's at
least worth considering.


igor.vaynberg wrote:
> 
> thats exactly the point. we do not maintain api compatibility of the
> js code, not even between minor versions, so you should not use them
> or depend on them.
> 
> -igor
> 
> On Thu, Jan 15, 2009 at 10:05 AM, Stefan Fußenegger
>  wrote:
>>
>> Even if they are for "wicket's internal use", documentation might be
>> valuable, especially for (wicketstuff) developers who go deeper then
>> regular
>> users. Furthermore, having some basic JS utilities (with documented
>> public
>> API) coming with Wicket would make using Wicket even more fun. I'd bet
>> that
>> a lot of Wicket users implemented Wicket.$('id') or something similar on
>> their own. And I'm not talking about a fully fledged JS framework or
>> library, just some basic stuff to handle common tasks like the whole
>> event
>> stuff or some DOM manipulations. Basically just what's in place already
>> but
>> kept secret for "internal use only".
>>
>> Maybe that's a candidate for the Wicket 1.5 wishlist ...
>>
>>
>> igor.vaynberg wrote:
>>>
>>> On Thu, Jan 15, 2009 at 9:11 AM, Stefan Fußenegger
>>>  wrote:

 I knew it was pseudo code. With "JS library" I meant the stuff
 contained
 in
 wicket-ajax.js, wicket-event.js, wicket-ajax-debug.js.
>>>
>>> those are for wicket's internal use. dont touch :)
>>>
 with replacing border, you meant the server-side concept of a Border,
 right?
 I was talking more of a html related concept (bad description, sorry),
 where
 a border is some markup surrounding some other markup. The later should
 be
 kept untouched by the update. I think it shouldn't be to difficult to
 get
 a
 DOM node by id, remove it or move it somewhere else temporarily, insert
 the
 ajax-retrieve stuff, move the DOM node back to where it was. If the
 implementation is as simple as this, it would be a feature worth
 adding,
 wouldn't it?
>>>
>>> javascript implementation is easy, it is the serverside declaration
>>> and invocation that would be confusing. you are welcome to prototype
>>> it if you want to pursue it further.
>>>
>>> -igor
>>>

 Regards


 igor.vaynberg wrote:
>
> On Thu, Jan 15, 2009 at 12:53 AM, Stefan Fußenegger
>  wrote:
>>
>> Thanks, I'll go for the suggested JS.Is there any documentation of
>> the
>> Wicket
>> JavaScript library available somewhere?
>
> there is no wicket js library, what i gave you was pseudocode.
>
>> However, wouldn't be replacing borders (i.e. keeping parts of the
>> hierarchy)
>> be a nice feature? I'd add a ticket if you agree.
>
> you can replace borders already, the problem here relates to the
> timing of client-server interaction. because you are validating while
> the user is typing the serverside often gets the value that is out of
> date since the user types faster then you can send requests to the
> server. this means that when repainting the component on the
> serverside there is a good chance you will repaint it with the wrong
> value.
>
> currently there is no way to tell a form component to repaint but not
> update its value attribute, and this is not always possible anyways.
>
> -igor
>
>>
>> Regards, Stefan
>>
>>
>> igor.vaynberg wrote:
>>>
>>> the way to do this is to have the div be output there without
>>> class="error" and to append the class to it via
>>> ajaxrequesttarget.appendjavascript("$(divid).addclass('error');");
>>>
>>> that way you do not need to repaint the input tag which is the
>>> problematic part for your usecase.
>>>
>>> -igor
>>>
>>> On Tue, Jan 13, 2009 at 4:49 AM, Stefan Fußenegger
>>>  wrote:

 Hi,

 My HTML looks similar to this:

 Foo

 I want to validate the contents of the field as soon as the user
 starts
 typing. If there is an error, the html should become:

 There was an errorFoo>>> type="text"
 />

 However, if I add the whole hierarchy to the AjaxRequestTarget, the
 changes
 in the text field get lost (Which results in quite weired typing
 behavior).

 Is it possible to skip components from being updated within another
 component? Might storing the value (prependJavascript), updating
 the
 whole
 hierarchy and writing back the stored value (appendJavascript) give
 sa

Re: Why you should not override isVisible

2009-01-15 Thread Scott Swank
Is there a reason why the default behavior is not to cache the result
of isVisible()?  Are there cases where the result of isVisible() is
expected to change over the course of rendering?

Would a JIRA w/ code be welcome, or is the current behavior required?

Scott

On Thu, Jan 15, 2009 at 10:23 AM, Jonathan Locke
 wrote:
>
>
> I would be careful not to throw the baby out with the bath water here. The
> design decision you're making is push versus pull and implementing isVisible
> is often going to be a better design decision because it may be more clear
> that visibility state stays consistent for a given problem. If the
> performance actually shows up as a hotspot (don't prematurely optimize!),
> you can always do some appropriate caching of the value and still have it
> "pulled".
>
>
> Erik van Oosten wrote:
>>
>> In the thread "Where to process PageParameters" I was requested to
>> explain why I think you should not override isVisible, but rather should
>> call setVisible in onBeforeRender (slide 100 in my presentation
>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
>>
>> There are 2 reasons, but only the second one is really important.
>>
>> -1- isVisible is called a lot. It is easily called ten times within 1
>> request
>>
>> So if you have anything processor intensive going on, it will be a
>> performance hit. Just doing a simple expression is of course no problem.
>> (For fun, just set a breakpoint in something like
>> FeedbackPanel#isVisible and request a page that contains one.)
>>
>> -2- isVisible can make your model be reloaded multiple times within 1
>> request
>>
>> Consider the following case (pseudo code):
>>
>>   MyPanel(id, personId) {
>>  super(id, new CompoundPropertyModel(new
>> LoadableDetachablePersonModel(personId)));
>>  add( new Label("address") {
>>  @Override
>>  isVisible() {
>>  return getDefaultModel() != null;
>>  }
>>  });
>>   }
>>
>>
>> The label uses the property 'address' of a person to see if the label
>> should be visible. The person is retrieved by a LoadableDetachableModel
>> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
>>
>> During the render phase, isVisible will delegate getting the address
>> property to the CPM and this model delegates it to the LDM. LDM will
>> load the person from the database only once (well until it is detached).
>>
>> At the end of the render phase everything will be detached. But now
>> something weird happens. The problem is that isVisible is called during
>> the detach phase, on the label /after/ the CPM (and therefore also the
>> LDM) are detached. As isVisible retrieves the model from the CPM, and
>> therefore from the LDM, it will trigger a reload of the person inside
>> the LDM.
>>
>> Now, as visibility is often (if not almost always) determined by a
>> business object (e.g. very often a LDM) I think it makes sense to avoid
>> having to think about the situation described above, and just avoid it
>> all together.
>>
>> Note: I observed this behavior in Wicket 1.3 (1.3.3 I think). If it
>> works differently now, I would be very glad to withdraw this
>> recommendation.
>>
>> Regards,
>>  Erik.
>>
>> --
>> Erik van Oosten
>> http://day-to-day-stuff.blogspot.com/
>>
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21483816.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Why you should not override isVisible

2009-01-15 Thread Jonathan Locke


I would be careful not to throw the baby out with the bath water here. The
design decision you're making is push versus pull and implementing isVisible
is often going to be a better design decision because it may be more clear
that visibility state stays consistent for a given problem. If the
performance actually shows up as a hotspot (don't prematurely optimize!),
you can always do some appropriate caching of the value and still have it
"pulled".


Erik van Oosten wrote:
> 
> In the thread "Where to process PageParameters" I was requested to 
> explain why I think you should not override isVisible, but rather should 
> call setVisible in onBeforeRender (slide 100 in my presentation 
> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf).
> 
> There are 2 reasons, but only the second one is really important.
> 
> -1- isVisible is called a lot. It is easily called ten times within 1 
> request
> 
> So if you have anything processor intensive going on, it will be a 
> performance hit. Just doing a simple expression is of course no problem.
> (For fun, just set a breakpoint in something like 
> FeedbackPanel#isVisible and request a page that contains one.)
> 
> -2- isVisible can make your model be reloaded multiple times within 1 
> request
> 
> Consider the following case (pseudo code):
> 
>   MyPanel(id, personId) {
>  super(id, new CompoundPropertyModel(new
> LoadableDetachablePersonModel(personId)));
>  add( new Label("address") {
>  @Override
>  isVisible() {
>  return getDefaultModel() != null;
>  }
>  });
>   }
> 
> 
> The label uses the property 'address' of a person to see if the label 
> should be visible. The person is retrieved by a LoadableDetachableModel 
> subclass (LDM) and then wrapped by a CompoundPropertyModel (CPM).
> 
> During the render phase, isVisible will delegate getting the address 
> property to the CPM and this model delegates it to the LDM. LDM will 
> load the person from the database only once (well until it is detached).
> 
> At the end of the render phase everything will be detached. But now 
> something weird happens. The problem is that isVisible is called during 
> the detach phase, on the label /after/ the CPM (and therefore also the 
> LDM) are detached. As isVisible retrieves the model from the CPM, and 
> therefore from the LDM, it will trigger a reload of the person inside 
> the LDM.
> 
> Now, as visibility is often (if not almost always) determined by a 
> business object (e.g. very often a LDM) I think it makes sense to avoid 
> having to think about the situation described above, and just avoid it 
> all together.
> 
> Note: I observed this behavior in Wicket 1.3 (1.3.3 I think). If it 
> works differently now, I would be very glad to withdraw this
> recommendation.
> 
> Regards,
>  Erik.
> 
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-you-should-not-override-isVisible-tp21474995p21483816.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Ajax-Update MarkupContaining containing FormComponent without loosing user changes

2009-01-15 Thread Igor Vaynberg
thats exactly the point. we do not maintain api compatibility of the
js code, not even between minor versions, so you should not use them
or depend on them.

-igor

On Thu, Jan 15, 2009 at 10:05 AM, Stefan Fußenegger
 wrote:
>
> Even if they are for "wicket's internal use", documentation might be
> valuable, especially for (wicketstuff) developers who go deeper then regular
> users. Furthermore, having some basic JS utilities (with documented public
> API) coming with Wicket would make using Wicket even more fun. I'd bet that
> a lot of Wicket users implemented Wicket.$('id') or something similar on
> their own. And I'm not talking about a fully fledged JS framework or
> library, just some basic stuff to handle common tasks like the whole event
> stuff or some DOM manipulations. Basically just what's in place already but
> kept secret for "internal use only".
>
> Maybe that's a candidate for the Wicket 1.5 wishlist ...
>
>
> igor.vaynberg wrote:
>>
>> On Thu, Jan 15, 2009 at 9:11 AM, Stefan Fußenegger
>>  wrote:
>>>
>>> I knew it was pseudo code. With "JS library" I meant the stuff contained
>>> in
>>> wicket-ajax.js, wicket-event.js, wicket-ajax-debug.js.
>>
>> those are for wicket's internal use. dont touch :)
>>
>>> with replacing border, you meant the server-side concept of a Border,
>>> right?
>>> I was talking more of a html related concept (bad description, sorry),
>>> where
>>> a border is some markup surrounding some other markup. The later should
>>> be
>>> kept untouched by the update. I think it shouldn't be to difficult to get
>>> a
>>> DOM node by id, remove it or move it somewhere else temporarily, insert
>>> the
>>> ajax-retrieve stuff, move the DOM node back to where it was. If the
>>> implementation is as simple as this, it would be a feature worth adding,
>>> wouldn't it?
>>
>> javascript implementation is easy, it is the serverside declaration
>> and invocation that would be confusing. you are welcome to prototype
>> it if you want to pursue it further.
>>
>> -igor
>>
>>>
>>> Regards
>>>
>>>
>>> igor.vaynberg wrote:

 On Thu, Jan 15, 2009 at 12:53 AM, Stefan Fußenegger
  wrote:
>
> Thanks, I'll go for the suggested JS.Is there any documentation of the
> Wicket
> JavaScript library available somewhere?

 there is no wicket js library, what i gave you was pseudocode.

> However, wouldn't be replacing borders (i.e. keeping parts of the
> hierarchy)
> be a nice feature? I'd add a ticket if you agree.

 you can replace borders already, the problem here relates to the
 timing of client-server interaction. because you are validating while
 the user is typing the serverside often gets the value that is out of
 date since the user types faster then you can send requests to the
 server. this means that when repainting the component on the
 serverside there is a good chance you will repaint it with the wrong
 value.

 currently there is no way to tell a form component to repaint but not
 update its value attribute, and this is not always possible anyways.

 -igor

>
> Regards, Stefan
>
>
> igor.vaynberg wrote:
>>
>> the way to do this is to have the div be output there without
>> class="error" and to append the class to it via
>> ajaxrequesttarget.appendjavascript("$(divid).addclass('error');");
>>
>> that way you do not need to repaint the input tag which is the
>> problematic part for your usecase.
>>
>> -igor
>>
>> On Tue, Jan 13, 2009 at 4:49 AM, Stefan Fußenegger
>>  wrote:
>>>
>>> Hi,
>>>
>>> My HTML looks similar to this:
>>>
>>> Foo
>>>
>>> I want to validate the contents of the field as soon as the user
>>> starts
>>> typing. If there is an error, the html should become:
>>>
>>> There was an errorFoo>> type="text"
>>> />
>>>
>>> However, if I add the whole hierarchy to the AjaxRequestTarget, the
>>> changes
>>> in the text field get lost (Which results in quite weired typing
>>> behavior).
>>>
>>> Is it possible to skip components from being updated within another
>>> component? Might storing the value (prependJavascript), updating the
>>> whole
>>> hierarchy and writing back the stored value (appendJavascript) give
>>> satisfying results.
>>>
>>> What do you think? Any other ideas?
>>>
>>> Thanks, Stefan
>>>
>>> -
>>> ---
>>> Stefan Fußenegger
>>> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21435127.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsu

Re: Ajax-Update MarkupContaining containing FormComponent without loosing user changes

2009-01-15 Thread Stefan Fußenegger

Even if they are for "wicket's internal use", documentation might be
valuable, especially for (wicketstuff) developers who go deeper then regular
users. Furthermore, having some basic JS utilities (with documented public
API) coming with Wicket would make using Wicket even more fun. I'd bet that
a lot of Wicket users implemented Wicket.$('id') or something similar on
their own. And I'm not talking about a fully fledged JS framework or
library, just some basic stuff to handle common tasks like the whole event
stuff or some DOM manipulations. Basically just what's in place already but
kept secret for "internal use only".

Maybe that's a candidate for the Wicket 1.5 wishlist ...


igor.vaynberg wrote:
> 
> On Thu, Jan 15, 2009 at 9:11 AM, Stefan Fußenegger
>  wrote:
>>
>> I knew it was pseudo code. With "JS library" I meant the stuff contained
>> in
>> wicket-ajax.js, wicket-event.js, wicket-ajax-debug.js.
> 
> those are for wicket's internal use. dont touch :)
> 
>> with replacing border, you meant the server-side concept of a Border,
>> right?
>> I was talking more of a html related concept (bad description, sorry),
>> where
>> a border is some markup surrounding some other markup. The later should
>> be
>> kept untouched by the update. I think it shouldn't be to difficult to get
>> a
>> DOM node by id, remove it or move it somewhere else temporarily, insert
>> the
>> ajax-retrieve stuff, move the DOM node back to where it was. If the
>> implementation is as simple as this, it would be a feature worth adding,
>> wouldn't it?
> 
> javascript implementation is easy, it is the serverside declaration
> and invocation that would be confusing. you are welcome to prototype
> it if you want to pursue it further.
> 
> -igor
> 
>>
>> Regards
>>
>>
>> igor.vaynberg wrote:
>>>
>>> On Thu, Jan 15, 2009 at 12:53 AM, Stefan Fußenegger
>>>  wrote:

 Thanks, I'll go for the suggested JS.Is there any documentation of the
 Wicket
 JavaScript library available somewhere?
>>>
>>> there is no wicket js library, what i gave you was pseudocode.
>>>
 However, wouldn't be replacing borders (i.e. keeping parts of the
 hierarchy)
 be a nice feature? I'd add a ticket if you agree.
>>>
>>> you can replace borders already, the problem here relates to the
>>> timing of client-server interaction. because you are validating while
>>> the user is typing the serverside often gets the value that is out of
>>> date since the user types faster then you can send requests to the
>>> server. this means that when repainting the component on the
>>> serverside there is a good chance you will repaint it with the wrong
>>> value.
>>>
>>> currently there is no way to tell a form component to repaint but not
>>> update its value attribute, and this is not always possible anyways.
>>>
>>> -igor
>>>

 Regards, Stefan


 igor.vaynberg wrote:
>
> the way to do this is to have the div be output there without
> class="error" and to append the class to it via
> ajaxrequesttarget.appendjavascript("$(divid).addclass('error');");
>
> that way you do not need to repaint the input tag which is the
> problematic part for your usecase.
>
> -igor
>
> On Tue, Jan 13, 2009 at 4:49 AM, Stefan Fußenegger
>  wrote:
>>
>> Hi,
>>
>> My HTML looks similar to this:
>>
>> Foo
>>
>> I want to validate the contents of the field as soon as the user
>> starts
>> typing. If there is an error, the html should become:
>>
>> There was an errorFoo> type="text"
>> />
>>
>> However, if I add the whole hierarchy to the AjaxRequestTarget, the
>> changes
>> in the text field get lost (Which results in quite weired typing
>> behavior).
>>
>> Is it possible to skip components from being updated within another
>> component? Might storing the value (prependJavascript), updating the
>> whole
>> hierarchy and writing back the stored value (appendJavascript) give
>> satisfying results.
>>
>> What do you think? Any other ideas?
>>
>> Thanks, Stefan
>>
>> -
>> ---
>> Stefan Fußenegger
>> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
>> --
>> View this message in context:
>> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21435127.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>>

Re: Why you should not override isVisible

2009-01-15 Thread Scott Swank
We have done exact that -- a lot.  Driving isVisible() from the state
of the model is very clean, but the performance is potentially awful.
I have wondered whether this should be the default implementation for
Component.isVisible().

Is IVisitor.beforeRender() an appropriate place in the rendering cycle
to make the determination -- i.e.

public abstract class Visibility extends AbstractBehavior {
@Override
public void beforeRender(Component c) {
c.setVisible(isVisible());
}

public abstract boolean isVisible();
}

On Thu, Jan 15, 2009 at 2:45 AM, Martin Makundi
 wrote:
>> -1- isVisible is called a lot. It is easily called ten times within 1
>> request
>
> If you need to optimize, you can use lazy initialization of a boolean
> variable here and reset it in onBeforeRender?
>
>> -2- isVisible can make your model be reloaded multiple times within 1
>> request
>
> If you need to optimize, you can use lazy initialization of a boolean
> variable here and reset it in onBeforeRender?
>
> I consider overriding isVisible a more clean OO approach. Using
> setVisible results in messy non transparent chain of command.
>
> **
> Martin
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Ajax-Update MarkupContaining containing FormComponent without loosing user changes

2009-01-15 Thread Igor Vaynberg
On Thu, Jan 15, 2009 at 9:11 AM, Stefan Fußenegger
 wrote:
>
> I knew it was pseudo code. With "JS library" I meant the stuff contained in
> wicket-ajax.js, wicket-event.js, wicket-ajax-debug.js.

those are for wicket's internal use. dont touch :)

> with replacing border, you meant the server-side concept of a Border, right?
> I was talking more of a html related concept (bad description, sorry), where
> a border is some markup surrounding some other markup. The later should be
> kept untouched by the update. I think it shouldn't be to difficult to get a
> DOM node by id, remove it or move it somewhere else temporarily, insert the
> ajax-retrieve stuff, move the DOM node back to where it was. If the
> implementation is as simple as this, it would be a feature worth adding,
> wouldn't it?

javascript implementation is easy, it is the serverside declaration
and invocation that would be confusing. you are welcome to prototype
it if you want to pursue it further.

-igor

>
> Regards
>
>
> igor.vaynberg wrote:
>>
>> On Thu, Jan 15, 2009 at 12:53 AM, Stefan Fußenegger
>>  wrote:
>>>
>>> Thanks, I'll go for the suggested JS.Is there any documentation of the
>>> Wicket
>>> JavaScript library available somewhere?
>>
>> there is no wicket js library, what i gave you was pseudocode.
>>
>>> However, wouldn't be replacing borders (i.e. keeping parts of the
>>> hierarchy)
>>> be a nice feature? I'd add a ticket if you agree.
>>
>> you can replace borders already, the problem here relates to the
>> timing of client-server interaction. because you are validating while
>> the user is typing the serverside often gets the value that is out of
>> date since the user types faster then you can send requests to the
>> server. this means that when repainting the component on the
>> serverside there is a good chance you will repaint it with the wrong
>> value.
>>
>> currently there is no way to tell a form component to repaint but not
>> update its value attribute, and this is not always possible anyways.
>>
>> -igor
>>
>>>
>>> Regards, Stefan
>>>
>>>
>>> igor.vaynberg wrote:

 the way to do this is to have the div be output there without
 class="error" and to append the class to it via
 ajaxrequesttarget.appendjavascript("$(divid).addclass('error');");

 that way you do not need to repaint the input tag which is the
 problematic part for your usecase.

 -igor

 On Tue, Jan 13, 2009 at 4:49 AM, Stefan Fußenegger
  wrote:
>
> Hi,
>
> My HTML looks similar to this:
>
> Foo
>
> I want to validate the contents of the field as soon as the user starts
> typing. If there is an error, the html should become:
>
> There was an errorFoo type="text"
> />
>
> However, if I add the whole hierarchy to the AjaxRequestTarget, the
> changes
> in the text field get lost (Which results in quite weired typing
> behavior).
>
> Is it possible to skip components from being updated within another
> component? Might storing the value (prependJavascript), updating the
> whole
> hierarchy and writing back the stored value (appendJavascript) give
> satisfying results.
>
> What do you think? Any other ideas?
>
> Thanks, Stefan
>
> -
> ---
> Stefan Fußenegger
> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
> --
> View this message in context:
> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21435127.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



>>>
>>>
>>> -
>>> ---
>>> Stefan Fußenegger
>>> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21473620.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
>
> -
> ---
> Stefan Fußenegger
> http://talk-on-tech.blogsp

Re: skip item in populateItem of ListView

2009-01-15 Thread Martin Makundi
Sounds like bad design that's going to give you headaches later...
nevertheless, did you try setting the listItem.setVisible(false)?

**
Martin

2009/1/15 Steve Swinsburg :
> Hi all,
>
> I have a situation whereby certain conditions mean I need to skip an item
> that is being rendered in a ListView.
> ie inside the populateItem() method I do some processing and if that item
> fails, it shouldn't be rendered so I'd like to skip to the next item.
>
> I know I *could* process the list before it reaches the ListView but I'd
> prefer not to iterate over the list twice.
>
> Is there some way of skipping this item or not showing the item (and making
> sure none of its content is output)?
>
>
> thanks,
> Steve
>
>
>
>
>

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



Re: DropDownChoice with Model and List

2009-01-15 Thread Igor Vaynberg
yep

-igor

On Thu, Jan 15, 2009 at 9:12 AM, Anton Veretennikov
 wrote:
> The main difficulty in implementing DropDownChoice is translation
> of values?
>
> On 1/15/09, Igor Vaynberg  wrote:
>> if you have list you must have imodel that is how the ddc works.
>>
>> you can either create a model that translates string<->t or one that
>> translates list <-> list
>>
>> -igor
>>
>> On Thu, Jan 15, 2009 at 8:52 AM, Anton Veretennikov
>>  wrote:
>>> Good {morning|day|evening}!
>>>
>>> I have a Model with String field "code" and list of objects List
>>> where t.getCode() must be returned to Model.
>>> Several hours I try to make it strict typed with Wicket 1.4. No success :(
>>>
>>> Please, help me!
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



skip item in populateItem of ListView

2009-01-15 Thread Steve Swinsburg

Hi all,

I have a situation whereby certain conditions mean I need to skip an  
item that is being rendered in a ListView.
ie inside the populateItem() method I do some processing and if that  
item fails, it shouldn't be rendered so I'd like to skip to the next  
item.


I know I *could* process the list before it reaches the ListView but  
I'd prefer not to iterate over the list twice.


Is there some way of skipping this item or not showing the item (and  
making sure none of its content is output)?



thanks,
Steve






smime.p7s
Description: S/MIME cryptographic signature


Re: DropDownChoice with Model and List

2009-01-15 Thread Anton Veretennikov
The main difficulty in implementing DropDownChoice is translation
of values?

On 1/15/09, Igor Vaynberg  wrote:
> if you have list you must have imodel that is how the ddc works.
>
> you can either create a model that translates string<->t or one that
> translates list <-> list
>
> -igor
>
> On Thu, Jan 15, 2009 at 8:52 AM, Anton Veretennikov
>  wrote:
>> Good {morning|day|evening}!
>>
>> I have a Model with String field "code" and list of objects List
>> where t.getCode() must be returned to Model.
>> Several hours I try to make it strict typed with Wicket 1.4. No success :(
>>
>> Please, help me!
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Ajax-Update MarkupContaining containing FormComponent without loosing user changes

2009-01-15 Thread Stefan Fußenegger

I knew it was pseudo code. With "JS library" I meant the stuff contained in
wicket-ajax.js, wicket-event.js, wicket-ajax-debug.js.

with replacing border, you meant the server-side concept of a Border, right?
I was talking more of a html related concept (bad description, sorry), where
a border is some markup surrounding some other markup. The later should be
kept untouched by the update. I think it shouldn't be to difficult to get a
DOM node by id, remove it or move it somewhere else temporarily, insert the
ajax-retrieve stuff, move the DOM node back to where it was. If the
implementation is as simple as this, it would be a feature worth adding,
wouldn't it?

Regards 


igor.vaynberg wrote:
> 
> On Thu, Jan 15, 2009 at 12:53 AM, Stefan Fußenegger
>  wrote:
>>
>> Thanks, I'll go for the suggested JS.Is there any documentation of the
>> Wicket
>> JavaScript library available somewhere?
> 
> there is no wicket js library, what i gave you was pseudocode.
> 
>> However, wouldn't be replacing borders (i.e. keeping parts of the
>> hierarchy)
>> be a nice feature? I'd add a ticket if you agree.
> 
> you can replace borders already, the problem here relates to the
> timing of client-server interaction. because you are validating while
> the user is typing the serverside often gets the value that is out of
> date since the user types faster then you can send requests to the
> server. this means that when repainting the component on the
> serverside there is a good chance you will repaint it with the wrong
> value.
> 
> currently there is no way to tell a form component to repaint but not
> update its value attribute, and this is not always possible anyways.
> 
> -igor
> 
>>
>> Regards, Stefan
>>
>>
>> igor.vaynberg wrote:
>>>
>>> the way to do this is to have the div be output there without
>>> class="error" and to append the class to it via
>>> ajaxrequesttarget.appendjavascript("$(divid).addclass('error');");
>>>
>>> that way you do not need to repaint the input tag which is the
>>> problematic part for your usecase.
>>>
>>> -igor
>>>
>>> On Tue, Jan 13, 2009 at 4:49 AM, Stefan Fußenegger
>>>  wrote:

 Hi,

 My HTML looks similar to this:

 Foo

 I want to validate the contents of the field as soon as the user starts
 typing. If there is an error, the html should become:

 There was an errorFoo>>> type="text"
 />

 However, if I add the whole hierarchy to the AjaxRequestTarget, the
 changes
 in the text field get lost (Which results in quite weired typing
 behavior).

 Is it possible to skip components from being updated within another
 component? Might storing the value (prependJavascript), updating the
 whole
 hierarchy and writing back the stored value (appendJavascript) give
 satisfying results.

 What do you think? Any other ideas?

 Thanks, Stefan

 -
 ---
 Stefan Fußenegger
 http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
 --
 View this message in context:
 http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21435127.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>>
>> -
>> ---
>> Stefan Fußenegger
>> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
>> --
>> View this message in context:
>> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21473620.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 


-
---
Stefan Fußenegger
http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
-- 
View this message in context: 
http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21482168.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

JavaScript and Wicket

2009-01-15 Thread Sniffer

Hi,
I'm a beginner about Wicket and the main issue which I have is JavaScript
and Wicket integration. My question is is it possible to pass JavaScript
variable value to Wicket as Wicket link parameter? 

Here are some part of code which I have:

// Set link on data cell
Link callUpdateWindow = new Link("callUpdateWindow", item.getModel()) {
public void onClick() {
}
};
String call = String.format("showUpdate('%s');", item.getIndex());
callUpdateWindow.add(new AttributeModifier("onclick", true, new
Model(call)));


HTML:

img/icon/dot_green.png 


And this is working fine, Wicket set onclick attribute with desired value to
JavaScript function, but then from HTML I don't know how to return
JavaScript set value to Wicket.

Please any kind of help!

Best regards,
Aleksandar Cajic
-- 
View this message in context: 
http://www.nabble.com/JavaScript-and-Wicket-tp21481992p21481992.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: DropDownChoice with Model and List

2009-01-15 Thread Igor Vaynberg
if you have list you must have imodel that is how the ddc works.

you can either create a model that translates string<->t or one that
translates list <-> list

-igor

On Thu, Jan 15, 2009 at 8:52 AM, Anton Veretennikov
 wrote:
> Good {morning|day|evening}!
>
> I have a Model with String field "code" and list of objects List
> where t.getCode() must be returned to Model.
> Several hours I try to make it strict typed with Wicket 1.4. No success :(
>
> Please, help me!
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



DropDownChoice with Model and List

2009-01-15 Thread Anton Veretennikov
Good {morning|day|evening}!

I have a Model with String field "code" and list of objects List
where t.getCode() must be returned to Model.
Several hours I try to make it strict typed with Wicket 1.4. No success :(

Please, help me!

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



Re: Wicket stuff core, archetypes?

2009-01-15 Thread Jonathan Locke


btw, maybe this maven artifact searching thing should be integrated somehow
with an existing wicket search engine?

http://www.google.com/coop/cse?cx=00079654818618231%3Aenjwek-gxxg

is that possible with google custom searches alastair?


Jonathan Locke wrote:
> 
> 
> cool. this definitely looks like the right approach to me (assuming it
> indexes most of the big repos)
> 
>jon
> 
> 
> Rodolfo Hansen wrote:
>> 
>> Yes, you should use the nexus index for the repository
>> http://nexus.sonatype.org/
>> 
>> The indexer api is pretty straight forward:
>> http://docs.codehaus.org/display/M2ECLIPSE/Nexus+Indexer#NexusIndexer-NexusIndexerAPIExample
>> 
>> you could search for artifacts with the appropriate metadata, or search
>> inside the jars for some specific file / class (I think)
>> 
>> On Thu, Jan 15, 2009 at 5:00 AM, francisco treacy <
>> francisco.tre...@gmail.com> wrote:
>> 
>>> wasn't this someone martijn?
>>>
>>> On Tue, Dec 16, 2008 at 8:55 PM, Martijn Dashorst
>>>  wrote:
>>> > For perusing the maven repository, one should contact the guys from
>>> > nexus. They have an api for reading/indexing the repository. Don't
>>> > crawl the repository-that will surely get you banned.
>>>
>>> i replied >
>>>
>>> martijn, banning policies are issued by repository owners. i don't
>>> know which repo you're referring to as "the maven repository".
>>> central? apache?
>>>
>>> i suggested setting up or reusing a repo that would be mainly for
>>> wicket components, and owned by the project/ community. advantages:
>>>
>>>  - we simply don't ban wickethub's crawler
>>>  - we provide guidelines for wicket developers to easily publish their
>>> artifacts (and possibly check if metadata is present, etc)
>>>
>>> as for the rest ('non-compliant'), that would be maintained manually
>>> so no crawling involved.
>>>
>>> francisco
>>>
>>>
>>> On Wed, Jan 14, 2009 at 11:40 PM, Jonathan Locke
>>>  wrote:
>>> >
>>> >
>>> > yeah, you really do need a maven expert's help i think. i was chatting
>>> with
>>> > someone about this and they said something to the effect of: "oh, god
>>> no
>>> > don't crawl the maven repo. you'll get banned." so there's some more
>>> > official way of doing this apparently.
>>> >
>>> >
>>> > francisco treacy-2 wrote:
>>> >>
>>> >> here it is:
>>> >>
>>> >> http://code.google.com/p/wickethub/  (source code for the
>>> >> http://wickethub.org/ webapp)
>>> >>
>>> >> a small piece of code (with not even unit tests so far) but hopefully
>>> >> the way to start addressing our ideas:
>>> >>
>>> 
>>> http://www.nabble.com/idea:-automatic-component-repo-to17979177.html
>>> 
>>> 
>>> http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/ECA681FB-4B9C-4C27-9947-C9901F99E154.html
>>>  http://www.nabble.com/wickethub.org-td20995774.html
>>> >>
>>> >> let me know if you're interested in contributing. i'd particularly
>>> >> like to find a maven power-user(s) who'd like to help implementing
>>> >> some of jon's "automatic component repo" thingy.
>>> >> nino, what about the "archetypes for wicketstuff"?
>>> >>
>>> >> francisco
>>> >>
>>> >>
>>> >> On Sat, Dec 20, 2008 at 9:00 PM, Nino Martinez
>>> >>  wrote:
>>> >>> Ahh, no did'nt follow the thing that far, will read up on it now..
>>> >>>
>>> >>> I'll be looking forward to see some stuff in a couple of weeks :)
>>> >>>
>>> >>> francisco treacy wrote:
>>> 
>>>  hi nino,
>>> 
>>>  have you seen jon's idea of automatic component , and/or
>>> wickethub.org
>>>  thread?  discussion went around providing to wicket component
>>>  developers some sort of archetype that can help to 'standardize'/
>>>  'give more structure'  - also useful to perhaps crawl those
>>> artifacts
>>>  (with metadata) and keep them up-to-date in a sort of registry. it
>>>  would be good to join efforts.
>>> 
>>> 
>>> http://www.nabble.com/idea:-automatic-component-repo-to17979177.html
>>> 
>>> 
>>> http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/ECA681FB-4B9C-4C27-9947-C9901F99E154.html
>>>  http://www.nabble.com/wickethub.org-td20995774.html
>>> 
>>>  i'd really like to really tackle this one, once i'm back from
>>> holidays
>>>  in about 2 weeks. gonna tidy up a bit and open source that
>>> wickethub
>>>  code.
>>> 
>>>  cheers,
>>>  francisco
>>> 
>>> 
>>>  On Sat, Dec 20, 2008 at 9:22 AM, Nino Martinez
>>>   wrote:
>>> 
>>> >
>>> > Hi
>>> >
>>> > I were thinking that it would be nice to have archetypes for
>>> single
>>> > wicketstuff core project and one with a multi module (the stuff
>>> project
>>> > and
>>> > a example one), I guess it would provide event more structure..
>>> >
>>> > WDYT?
>>> >
>>> > regards Nino
>>> >
>>> >
>>> -
>>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> > For additional com

Re: Wicket stuff core, archetypes?

2009-01-15 Thread Jonathan Locke


cool. this definitely looks like the right approach to me (assuming it
indexes most of the big repos)

   jon


Rodolfo Hansen wrote:
> 
> Yes, you should use the nexus index for the repository
> http://nexus.sonatype.org/
> 
> The indexer api is pretty straight forward:
> http://docs.codehaus.org/display/M2ECLIPSE/Nexus+Indexer#NexusIndexer-NexusIndexerAPIExample
> 
> you could search for artifacts with the appropriate metadata, or search
> inside the jars for some specific file / class (I think)
> 
> On Thu, Jan 15, 2009 at 5:00 AM, francisco treacy <
> francisco.tre...@gmail.com> wrote:
> 
>> wasn't this someone martijn?
>>
>> On Tue, Dec 16, 2008 at 8:55 PM, Martijn Dashorst
>>  wrote:
>> > For perusing the maven repository, one should contact the guys from
>> > nexus. They have an api for reading/indexing the repository. Don't
>> > crawl the repository-that will surely get you banned.
>>
>> i replied >
>>
>> martijn, banning policies are issued by repository owners. i don't
>> know which repo you're referring to as "the maven repository".
>> central? apache?
>>
>> i suggested setting up or reusing a repo that would be mainly for
>> wicket components, and owned by the project/ community. advantages:
>>
>>  - we simply don't ban wickethub's crawler
>>  - we provide guidelines for wicket developers to easily publish their
>> artifacts (and possibly check if metadata is present, etc)
>>
>> as for the rest ('non-compliant'), that would be maintained manually
>> so no crawling involved.
>>
>> francisco
>>
>>
>> On Wed, Jan 14, 2009 at 11:40 PM, Jonathan Locke
>>  wrote:
>> >
>> >
>> > yeah, you really do need a maven expert's help i think. i was chatting
>> with
>> > someone about this and they said something to the effect of: "oh, god
>> no
>> > don't crawl the maven repo. you'll get banned." so there's some more
>> > official way of doing this apparently.
>> >
>> >
>> > francisco treacy-2 wrote:
>> >>
>> >> here it is:
>> >>
>> >> http://code.google.com/p/wickethub/  (source code for the
>> >> http://wickethub.org/ webapp)
>> >>
>> >> a small piece of code (with not even unit tests so far) but hopefully
>> >> the way to start addressing our ideas:
>> >>
>>  http://www.nabble.com/idea:-automatic-component-repo-to17979177.html
>> 
>> 
>> http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/ECA681FB-4B9C-4C27-9947-C9901F99E154.html
>>  http://www.nabble.com/wickethub.org-td20995774.html
>> >>
>> >> let me know if you're interested in contributing. i'd particularly
>> >> like to find a maven power-user(s) who'd like to help implementing
>> >> some of jon's "automatic component repo" thingy.
>> >> nino, what about the "archetypes for wicketstuff"?
>> >>
>> >> francisco
>> >>
>> >>
>> >> On Sat, Dec 20, 2008 at 9:00 PM, Nino Martinez
>> >>  wrote:
>> >>> Ahh, no did'nt follow the thing that far, will read up on it now..
>> >>>
>> >>> I'll be looking forward to see some stuff in a couple of weeks :)
>> >>>
>> >>> francisco treacy wrote:
>> 
>>  hi nino,
>> 
>>  have you seen jon's idea of automatic component , and/or
>> wickethub.org
>>  thread?  discussion went around providing to wicket component
>>  developers some sort of archetype that can help to 'standardize'/
>>  'give more structure'  - also useful to perhaps crawl those
>> artifacts
>>  (with metadata) and keep them up-to-date in a sort of registry. it
>>  would be good to join efforts.
>> 
>>  http://www.nabble.com/idea:-automatic-component-repo-to17979177.html
>> 
>> 
>> http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/ECA681FB-4B9C-4C27-9947-C9901F99E154.html
>>  http://www.nabble.com/wickethub.org-td20995774.html
>> 
>>  i'd really like to really tackle this one, once i'm back from
>> holidays
>>  in about 2 weeks. gonna tidy up a bit and open source that wickethub
>>  code.
>> 
>>  cheers,
>>  francisco
>> 
>> 
>>  On Sat, Dec 20, 2008 at 9:22 AM, Nino Martinez
>>   wrote:
>> 
>> >
>> > Hi
>> >
>> > I were thinking that it would be nice to have archetypes for single
>> > wicketstuff core project and one with a multi module (the stuff
>> project
>> > and
>> > a example one), I guess it would provide event more structure..
>> >
>> > WDYT?
>> >
>> > regards Nino
>> >
>> >
>> -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>> >
>> 
>> 
>> -
>>  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>  For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> >>>
>> >>>
>> >>> -
>> >>> To unsubscribe, e-ma

Re: IBehaviors added to ComponentTag not detached

2009-01-15 Thread Igor Vaynberg
behaviors added to componenttag are in turn added to components, so
they are detached and managed by components no the componenttag they
are added to.

-igor

On Thu, Jan 15, 2009 at 8:16 AM, Jonas  wrote:
> While experimenting with MarkupFilters, I noticed that IBehaviors
> added to ComponentTag using ComponentTag#addBehavior(IBehavior behavior)
> are never detached. Is that a bug, or just not possible to do?
> As far as I can see you don't have ComponentTags available anymore
> when Components are detached...
> Furthermore, it seems that their enablement is also ignored, they're
> always treated as enabled in Component#renderComponentTag(...).
>
> cheers
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Ajax-Update MarkupContaining containing FormComponent without loosing user changes

2009-01-15 Thread Igor Vaynberg
On Thu, Jan 15, 2009 at 12:53 AM, Stefan Fußenegger
 wrote:
>
> Thanks, I'll go for the suggested JS.Is there any documentation of the Wicket
> JavaScript library available somewhere?

there is no wicket js library, what i gave you was pseudocode.

> However, wouldn't be replacing borders (i.e. keeping parts of the hierarchy)
> be a nice feature? I'd add a ticket if you agree.

you can replace borders already, the problem here relates to the
timing of client-server interaction. because you are validating while
the user is typing the serverside often gets the value that is out of
date since the user types faster then you can send requests to the
server. this means that when repainting the component on the
serverside there is a good chance you will repaint it with the wrong
value.

currently there is no way to tell a form component to repaint but not
update its value attribute, and this is not always possible anyways.

-igor

>
> Regards, Stefan
>
>
> igor.vaynberg wrote:
>>
>> the way to do this is to have the div be output there without
>> class="error" and to append the class to it via
>> ajaxrequesttarget.appendjavascript("$(divid).addclass('error');");
>>
>> that way you do not need to repaint the input tag which is the
>> problematic part for your usecase.
>>
>> -igor
>>
>> On Tue, Jan 13, 2009 at 4:49 AM, Stefan Fußenegger
>>  wrote:
>>>
>>> Hi,
>>>
>>> My HTML looks similar to this:
>>>
>>> Foo
>>>
>>> I want to validate the contents of the field as soon as the user starts
>>> typing. If there is an error, the html should become:
>>>
>>> There was an errorFoo>> />
>>>
>>> However, if I add the whole hierarchy to the AjaxRequestTarget, the
>>> changes
>>> in the text field get lost (Which results in quite weired typing
>>> behavior).
>>>
>>> Is it possible to skip components from being updated within another
>>> component? Might storing the value (prependJavascript), updating the
>>> whole
>>> hierarchy and writing back the stored value (appendJavascript) give
>>> satisfying results.
>>>
>>> What do you think? Any other ideas?
>>>
>>> Thanks, Stefan
>>>
>>> -
>>> ---
>>> Stefan Fußenegger
>>> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21435127.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
>
> -
> ---
> Stefan Fußenegger
> http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
> --
> View this message in context: 
> http://www.nabble.com/Ajax-Update-MarkupContaining-containing-FormComponent-without-loosing-user-changes-tp21435127p21473620.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



IBehaviors added to ComponentTag not detached

2009-01-15 Thread Jonas
While experimenting with MarkupFilters, I noticed that IBehaviors
added to ComponentTag using ComponentTag#addBehavior(IBehavior behavior)
are never detached. Is that a bug, or just not possible to do?
As far as I can see you don't have ComponentTags available anymore
when Components are detached...
Furthermore, it seems that their enablement is also ignored, they're
always treated as enabled in Component#renderComponentTag(...).

cheers

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



Wicket and voiceXML?

2009-01-15 Thread Nino Martinez

Hi Guys

Have any of you worked with wicket and outputting voice markup?

Im just wanting to hear experiences and ideas etc..

Ps, it's no secret that I've switched from Jayway to Netdesign (nortel 
unit)..



regards Nino

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



RE: Technologies to use with large scale Wicket application

2009-01-15 Thread Frank van Lankvelt
> Brix
> Jackrabbit
> Our application will need some heavy duty CMS features, and 
> this project looks powerful enough to do the job.  Jackrabbit 
> is used by Brix to store content.
> 
Alternatively, you could try Hippo CMS7.  It's also built with Wicket on
top of a JCR repository, but with some extensions that you might like.
(workflow, authorization, virtual trees based on facets)  The CMS itself
features things like a document type editor, allowing you to create
custom node types from within the cms.  And as its composed of plugins,
you can reconfigure a running system on the fly.  (and yes, it's all
APL)  See http://www.onehippo.org/cms7 for details.

Cheers, Frank

  

f.vanlankv...@onehippo.com  www.onehippo.com
Amsterdam Hippo B.V. Oosteinde 11   1017 WT   Amsterdam
+31(0)20-5224466
San Francisco Hippo USA Inc. 101 H Street, suite Q   Petaluma   CA
94952-5100   +1-877-41-HIPPO

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



Re: BEA WebLogic 9.2 cluster

2009-01-15 Thread Matej Knopp
Looks like this is causing problems in SerializedPagesCache

static final Page NO_PAGE = new Page()
{
};

I wonder why the class is not loaded when the other node is initialized.

Please create a JIRA issue.

in the meanwhile, you can try load Class.forName(..) the
org.apache.wicket.protocol.http.pagestore.SerializedPagesCache$SerializedPageWithSession
class in your Application#init.

-Matej


On Thu, Jan 15, 2009 at 8:28 AM, Martin Bednář  wrote:
> Hi,
>
> I have problems with deploying wicket (wicket-1.4m1) application on WebLogic
> 9.2 server cluster (2 nodes).
> Application use spring 2.5.5 for service layer and is configured:
> web.xml:
>
>
>wicket.call-centre
>
> org.apache.wicket.protocol.http.WicketFilter
>
>applicationFactoryClassName
>
> org.apache.wicket.spring.SpringWebApplicationFactory
>
>
>applicationBean
>wicketApplication
>
>
>wicket.configuration
>deployment
>
>
>
>
>wicket.call-centre
>/*
>
>
>
>
> org.springframework.web.context.ContextLoaderListener
>
>
>
>contextConfigLocation
>classpath:applicationContext.xml
>
>
>
> weblogic.xml:
>  
>  replicated_if_clustered
>  
>
> If application deploys on nonclustered environment everything is ok. On
> cluster I got these errors:
>
> <[ACTIVE] ExecuteThread: '0' for queue:
> 'weblogic.kernel.Default (self-tuning)'> <> <> <>
> <1231941794006>   weblogic.cluster.replication.ReplicationManager.create(Lweblogic.rmi.spi.HostID;ILweblogic.cluster.replication.ROID;Lweblogic.cluster.replication.Replicatable;)
>
>  java.lang.ExceptionInInitializerError.
>
> java.lang.ExceptionInInitializerError
>
>  at sun.misc.Unsafe.ensureClassInitialized(Native Method)
>
>  at
> sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
>
>  at
> sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
>
>  at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
>
>  at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
>
>  at java.lang.reflect.Field.getLong(Field.java:527)
>
>  at
> java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1586)
>
>  at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:52)
>
>  at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:408)
>
>  at java.io.ObjectStreamClass.(ObjectStreamClass.java:400)
>
>  at java.io.ObjectStreamClass.lookup0(ObjectStreamClass.java:297)
>
>  at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java)
>
>  at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:531)
>
>  at
> java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
>
>  at
> java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
>
>  at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
>
>  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
>
>  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
>
>  at
> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.readObject(SecondLevelCacheSessionStore.java:412)
>
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>  at java.lang.reflect.Method.invoke(Method.java:585)
>
>  at
> java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
>
>  at
> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
>
>  at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
>
> org.apache.wicket.WicketRuntimeException: There is no application attached
> to current thread [ACTIVE] ExecuteThread: '0' for queue:
> 'weblogic.kernel.Default (self-tuning)'
>
>  at org.apache.wicket.Application.get(Application.java:177)
>
>  at org.apache.wicket.Component.getApplication(Component.java:1282)
>
>  at org.apache.wicket.Component.(Component.java:894)
>
>  at org.apache.wicket.MarkupContainer.(MarkupContainer.java:105)
>
>  at org.apache.wicket.Page.(Page.java:236)
>
>  at
> org.apache.wicket.protocol.http.pagestore.SerializedPagesCache$SerializedPageWithSession$1.(SerializedPagesCache.java:206)
>
>  at
> org.apache.wicket.protocol.http.pagestore.SerializedPagesCache$SerializedPageWithSession.(SerializedPagesCache.java:205)
>
>  at sun.misc.Unsafe.ensureClassInitialized(Native Method)
>
>  at
> sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
>
>  at
> sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
>
>  at java.lang.reflect.Field.acquireFieldAccessor(Field

Re: Wicket stuff core, archetypes?

2009-01-15 Thread Rodolfo Hansen
Yes, you should use the nexus index for the repository
http://nexus.sonatype.org/

The indexer api is pretty straight forward:
http://docs.codehaus.org/display/M2ECLIPSE/Nexus+Indexer#NexusIndexer-NexusIndexerAPIExample

you could search for artifacts with the appropriate metadata, or search
inside the jars for some specific file / class (I think)

On Thu, Jan 15, 2009 at 5:00 AM, francisco treacy <
francisco.tre...@gmail.com> wrote:

> wasn't this someone martijn?
>
> On Tue, Dec 16, 2008 at 8:55 PM, Martijn Dashorst
>  wrote:
> > For perusing the maven repository, one should contact the guys from
> > nexus. They have an api for reading/indexing the repository. Don't
> > crawl the repository-that will surely get you banned.
>
> i replied >
>
> martijn, banning policies are issued by repository owners. i don't
> know which repo you're referring to as "the maven repository".
> central? apache?
>
> i suggested setting up or reusing a repo that would be mainly for
> wicket components, and owned by the project/ community. advantages:
>
>  - we simply don't ban wickethub's crawler
>  - we provide guidelines for wicket developers to easily publish their
> artifacts (and possibly check if metadata is present, etc)
>
> as for the rest ('non-compliant'), that would be maintained manually
> so no crawling involved.
>
> francisco
>
>
> On Wed, Jan 14, 2009 at 11:40 PM, Jonathan Locke
>  wrote:
> >
> >
> > yeah, you really do need a maven expert's help i think. i was chatting
> with
> > someone about this and they said something to the effect of: "oh, god no
> > don't crawl the maven repo. you'll get banned." so there's some more
> > official way of doing this apparently.
> >
> >
> > francisco treacy-2 wrote:
> >>
> >> here it is:
> >>
> >> http://code.google.com/p/wickethub/  (source code for the
> >> http://wickethub.org/ webapp)
> >>
> >> a small piece of code (with not even unit tests so far) but hopefully
> >> the way to start addressing our ideas:
> >>
>  http://www.nabble.com/idea:-automatic-component-repo-to17979177.html
> 
> 
> http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/ECA681FB-4B9C-4C27-9947-C9901F99E154.html
>  http://www.nabble.com/wickethub.org-td20995774.html
> >>
> >> let me know if you're interested in contributing. i'd particularly
> >> like to find a maven power-user(s) who'd like to help implementing
> >> some of jon's "automatic component repo" thingy.
> >> nino, what about the "archetypes for wicketstuff"?
> >>
> >> francisco
> >>
> >>
> >> On Sat, Dec 20, 2008 at 9:00 PM, Nino Martinez
> >>  wrote:
> >>> Ahh, no did'nt follow the thing that far, will read up on it now..
> >>>
> >>> I'll be looking forward to see some stuff in a couple of weeks :)
> >>>
> >>> francisco treacy wrote:
> 
>  hi nino,
> 
>  have you seen jon's idea of automatic component , and/or
> wickethub.org
>  thread?  discussion went around providing to wicket component
>  developers some sort of archetype that can help to 'standardize'/
>  'give more structure'  - also useful to perhaps crawl those artifacts
>  (with metadata) and keep them up-to-date in a sort of registry. it
>  would be good to join efforts.
> 
>  http://www.nabble.com/idea:-automatic-component-repo-to17979177.html
> 
> 
> http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/ECA681FB-4B9C-4C27-9947-C9901F99E154.html
>  http://www.nabble.com/wickethub.org-td20995774.html
> 
>  i'd really like to really tackle this one, once i'm back from holidays
>  in about 2 weeks. gonna tidy up a bit and open source that wickethub
>  code.
> 
>  cheers,
>  francisco
> 
> 
>  On Sat, Dec 20, 2008 at 9:22 AM, Nino Martinez
>   wrote:
> 
> >
> > Hi
> >
> > I were thinking that it would be nice to have archetypes for single
> > wicketstuff core project and one with a multi module (the stuff
> project
> > and
> > a example one), I guess it would provide event more structure..
> >
> > WDYT?
> >
> > regards Nino
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
> 
>  -
>  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>  For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> >>>
> >>>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>
> >>>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users

Re: Technologies to use with large scale Wicket application

2009-01-15 Thread nino martinez wael
Theres also Wicketopia, http://wicketopia.sourceforge.net/

But I think it's a little more incomplete than WWB, but theres couple of
archetypes. And its easy to work with..

2009/1/14 Tauren Mills 

> Thanks for the responses to my OT message,
>
> Daniel -- Thanks for your comments and the link to Wicket RAD.  I'll
> check it out.  I didn't realize WWB doesn't yet support 1.4 and I
> definitely am building this with 1.4.
>
> Jeremy -- It's good to hear that you also recommend these technologies.
>
> I'm really hoping to hear from someone who has used Salve, as I
> believe some of the wicket comitters are using it.
>
> Thanks,
> Tauren
>
>
> On Wed, Jan 14, 2009 at 11:24 AM, Jeremy Thomerson
>  wrote:
> > A few comments from my experience:
> >
> > Wicket - well, of course.  Are there other options?  :)
> >
> > Spring / Hibernate - I have used these on every project I've done in the
> > past four or five years and have been very satisfied with them.
> >
> > Lucene - Awesome!  I have been extremely impressed with Lucene.  It is
> easy
> > to integrate and astoundingly fast and simple.  It is also very flexible,
> > allowing almost limitless possibilities.  I would recommend it for search
> as
> > highly as Wicket for view tier.
> >
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> > On Tue, Jan 13, 2009 at 6:12 PM, Tauren Mills  wrote:
> >
> >> Happy new year!
> >>
> >> My team is in the preliminary stages of designing a large social
> >> wicket web application and I'm trying to identify a good set of
> >> existing tools and technologies that can be leveraged to simplify the
> >> development of this application.  I would love to hear the opinions
> >> and suggestions of other Wicket users.  Note that I want to use open
> >> source tools as much as possible.
> >>
> >> Here are some of the tools that I feel might help.  I realize this is
> >> a big list and may be off-topic, but am still interested in which
> >> technologies other Wicket developers have found work well with a
> >> Wicket app. I would appreciate any comments or opinions of these
> >> technologies as well as suggestions and alternatives that you feel
> >> would be worth my consideration.
> >>
> >> Wicket
> >> I assume no one here will object to this.  I plan to use version 1.4.
> >>
> >> MySQL
> >> First choice for database. I've used it MySQL more than any other
> >> database and it hasn't let me down.
> >>
> >> PostgreSQL
> >> Second choice for database.  I've used it less than MySQL, so
> >> additional time might be required to install, configure, and use it.
> >>
> >> Spring + Hibernate
> >> I'm comfortable with these technologies as I've been using them for a
> >> few years with Wicket.  But I'm certainly open to suggestions,
> >> opinions, etc.
> >>
> >> Hibernate Annotations
> >> Ive been using HBM files, but I'm thinking I should look into getting
> >> rid of my mapping files and put the mapping right into the pojos.  Is
> >> this the right call?
> >>
> >> Salve
> >> Never used it, but it appears many Wicket developers do.  Is it worth
> >> looking into?
> >>
> >> WicketWebBeans
> >> Might use this for rapid back-end UI development.  Besides rolling my
> >> own, are there other tools like this?
> >>
> >> Brix
> >> Jackrabbit
> >> Our application will need some heavy duty CMS features, and this
> >> project looks powerful enough to do the job.  Jackrabbit is used by
> >> Brix to store content.
> >>
> >> Lucene
> >> Hibernate Search
> >> I will need site-wide and data-wide search that encompasses all of the
> >> content on the site as well as the data in the application.  I'm not
> >> sure if these are the best tools for this job, as the content will be
> >> stored in Jackrabbit.  So I need to be able to search jackrabbit and
> >> my data and produce unified search results.  Ideas?
> >>
> >> ACEGI
> >> Spring Security
> >> I haven't used either of these before so I'm not sure if they will
> >> solve my problem:
> >> This application will have many levels of roles and permissions.
> >> Users will belong to groups and can be assigned roles for a group that
> >> allow them to perform actions.  For instance, a standard user that
> >> belongs to a group can only view some data.  But if a user has
> >> additional roles assigned to them, then they will gain the ability to
> >> see other data, edit data, and so forth.  A user can belong to
> >> multiple groups, and may have different roles for each group.
> >>
> >> Shopping Cart
> >> Any good open source wicket shopping carts?  I have a homemade one
> >> that I did for a customer that I plan to start with.  But if something
> >> else exists, I'd love to hear about it.
> >>
> >> Amazon FPS
> >> This system provides a simple API that can be used to help one user
> >> pay another user for service, but allow the infrastructure provider
> >> (me) to take a cut out of the transaction.   It also supports
> >> micro-payments which I could use. The service fits the needs of my
> >> bus

Javarebel wicket plugin

2009-01-15 Thread Jorge Falcão
Hello,

I wrote a simple plugin to use wicket with javarebel and spring

http://code.google.com/p/javarebel-wicket-plugin/

[]'s
Falcão


Voucher for Wicket Training Courses 17-18 & 24-25 Jan

2009-01-15 Thread jWeekend

We had a last minute booking on this weekend's jWeekend 2 day Apache Wicket
training course (17-18 Jan, London). If you or someone you know would like
to attend at such short notice use voucher "JW7062009JAN1725%" (remove
quotes) to book with 25% discount. There are several places available.

It's a new year so the same goes for the Wicket course next weekend, 24-25
Jan, as we have just received a booking from New Zealand. Use
"JW7062009JAN2425%".

There is detailed information on  http://www.jWeekend.com the jWeekend site
. If you have questions see our FAQ or use the Contact Us link. Use the Book
Training link to book and remember to enter the voucher using our Wicket
cart (click the Voucher checkbox to activate discount).

Seval
http://jWeekend.co.uk jWeekend 


-- 
View this message in context: 
http://www.nabble.com/Voucher-for-Wicket-Training-Courses-17-18---24-25-Jan-tp21476305p21476305.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Problem with dynamic insertion to Tree

2009-01-15 Thread PSkarthic

Thanks for your reply
i have been waiting for long time


target.addComponent(this); also does not solved my problem.

if i click a node the child is created under the node but doesn't expanded
but when i click it second time then it expands but with two child.
-- 
View this message in context: 
http://www.nabble.com/Problem-with-dynamic-insertion-to-Tree-tp21474815p21476222.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Problem with dynamic insertion to Tree

2009-01-15 Thread Vitek Tajzich
what about call target.addComponent(this);

?

you have updated tree but you didn't tell wicket to update this component
visually...

V.

2009/1/15 PSkarthic 

>
> I have a problem in inserting/adding nodes dynamically to tree.
>
> When i inserted/added a node on click, the plus icon appears but it is not
> expanded, that is it is not showing the child node i have tried tree.update
> but not worked.
>
> My Code
> protected void onNodeLinkClicked(org.apache.wicket.ajax.AjaxRequestTarget
> target,
>javax.swing.tree.TreeNode node){
>
>MyTreeNode nd = (MyTreeNode)node;
>//nd.add(new DefaultMutableTreeNode("sample"));
>System.out.println(node + "Ajax Clicked");
>nd.insert(new MyTreeNode(node + "child"), 0);
>
>//this.modelChanged();
>//this.nodeExpanded(node);
>this.updateTree();
>
>
>}
>
> Why it is happening like.
>
>
>
> Thanks
> Karthic
> --
> View this message in context:
> http://www.nabble.com/Problem-with-dynamic-insertion-to-Tree-tp21474815p21474815.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Problem with dynamic insertion to Tree

2009-01-15 Thread PSkarthic


Is there anybody to solve this.

I got Stuck here
:working:
I have a problem in inserting/adding nodes dynamically to tree.

When i inserted/added a node on click, the plus icon appears but it is not
expanded, that is it is not showing the child node i have tried tree.update
but not worked.

My Code
protected void onNodeLinkClicked(org.apache.wicket.ajax.AjaxRequestTarget
target,
javax.swing.tree.TreeNode node){
   
MyTreeNode nd = (MyTreeNode)node;
//nd.add(new DefaultMutableTreeNode("sample"));
System.out.println(node + "Ajax Clicked");
nd.insert(new MyTreeNode(node + "child"), 0);
   
//this.modelChanged();
//this.nodeExpanded(node);
this.updateTree();
   
   
}

Why it is happening like.



Thanks
Karthic


-- 
View this message in context: 
http://www.nabble.com/Problem-with-dynamic-insertion-to-Tree-tp21474815p21475834.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Where to process PageParameters

2009-01-15 Thread Erik van Oosten

Michael,

I answered on another thread.

Regards,
Erik.



Michael Sparer wrote:
> 
> Yepp, I also didn't have problems with it as - you're right - I took it at
> face value without thinking about it too much. I thought to avoid problems
> when the traffic of our apps grows and/or explodes I'll do it the save way
> :-) wasn't much effort to change the stuff anyway. 
> 
> But now I'd be interested in hearing Erik's opinion about that - he
> obviously must have had problems with it 
> 
> Michael
> 
-- 
View this message in context: 
http://www.nabble.com/Where-to-process-PageParameters-tp21454742p21475798.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Where to process PageParameters

2009-01-15 Thread behrica

I overwrote as well isVisible() and find this approach logical. I would have
liked to overwrite "setVisible()" as well and throw a
"NotSupportedException" to show clearly that "setVisible" might not work any
longer as exspected for my component.
But setVisible() is final, so I could not overwrite it.

Carsten


Michael Sparer wrote:
> 
> Yepp, I also didn't have problems with it as - you're right - I took it at
> face value without thinking about it too much. I thought to avoid problems
> when the traffic of our apps grows and/or explodes I'll do it the save way
> :-) wasn't much effort to change the stuff anyway. 
> 
> But now I'd be interested in hearing Erik's opinion about that - he
> obviously must have had problems with it 
> 
> Michael
> 
> 
> 
> Martijn Dashorst wrote:
>> 
>> I don't agree with Erik that one shouldn't override isVisible. I
>> haven't seen problems with it in my 4 years of Wicket development. The
>> problem with these types of rules is that they tend to be taken at
>> face value without even thinking about it. Having to maintain the
>> state of the visible flag manually is an anti-pattern in my book.
>> 
>> Martijn
>> 
>> On Thu, Jan 15, 2009 at 10:21 AM, Michael Sparer 
>> wrote:
>>>
>>> Jeremy,
>>>
>>> I used to do some business logic in the overriden isVisible() method too
>>> but
>>> changed that and used setVisible in onBeforeRender. Erik summed that
>>> issue
>>> up in his presentation on
>>> http://www.grons.nl/~erik/pub/20081112%20Effective%20Wicket.pdf (4MB) -
>>> slide 100 is the one containing the isVisible stuff.
>>>
>>> regards,
>>> Michael
>>>
>>>
>>> Jeremy Thomerson-5 wrote:

 Yes - typically it is a good idea to do things like service-layer /
 database
 access inside the model or inside onBeforeRender / isVisible, etc,
 rather
 than doing your business logic and calling setVisible(), etc.

 One of the main reasons for this is that if you don't, your page won't
 work
 properly when you click a link that modifies something on the page -
 because
 it doesn't reconstruct the page, and therefore you don't refresh the
 data
 in
 your components.

 On Wed, Jan 14, 2009 at 11:09 AM, behrica
 wrote:

>
> Hello,
>
> I do something similar in a page constructor, even with accessing the
> service layer. I have the same concerns, if this is correct. In
> general I
> do
> not like if a constructor does any significant (eventually time
> consuming)
> work like database access or other. But I did not find an other
> solution
> neither.
> Maybe it could be "postponed" by using a model which executes the
> needed
> calls to the service layer in an lazy fashion.
>
> Carsten
>
>
> Jonas505 wrote:
> >
> > Thank you for the quick reply.
> >
> > It's already working fine, I was just wondering if it is best
> practice
> to
> > call business logik from the constructor:
> >
> > public PageB(PageParameters p) {
> >   // can throw an exception:
> >   DataSet result = callMyBusinessLogik(p.getString("param1"),
> > p.getString("param2"));
> >   preparePageBComponents(result);
> > }
> >
> > Jonas
> >
> > From: Martijn Dashorst
> > 14 Jan 2009 14:24:21 +0100
> > Subject: Re: Where to process PageParameters
> >
> >> setResponsePage(PageB.class, parameters);
> >>
> >> or use a bookmarkablepagelink
> >>
> >> Martijn
> >>
> >> On Wed, Jan 14, 2009 at 1:06 PM, Jonas505
> 
> >> wrote:
> >> >
> >> > Hello,
> >> >
> >> > I would like to know, where in my WebPage class PageParameters
> should
> >> be
> >> > processed.
> >> >
> >> > I have a page A where you can fill in certain parameters (or
> select
> a
> >> > predefined set of parameters). Then you submit those parameters
> which
> >> are
> >> > given to the business logic to prepare some data. The resulting
> data
> is
> >> > shown on page B. I would like that the user can bookmark page B
> with
> >> those
> >> > parameters encoded in the URL.
> >> >
> >> > This works fine with page B having a constructor taking
> PageParameters.
> >> > However, right now I call the Business-Logik from the constructor
> of
> >> page
> >> B,
> >> > which seems strange. Am I missing something or is this the way to
> go?
> >> >
> >> > Thank you!
> >> > Jonas
> >> > --
> >> > View this message in context:
> >>
> http://www.nabble.com/Where-to-process-PageParameters-tp21454742p21454742.html
> >> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> -
> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > Fo

Re: Why you should not override isVisible

2009-01-15 Thread Erik van Oosten


Martin Makundi wrote:

-1- isVisible is called a lot. It is easily called ten times within 1
request



If you need to optimize, you can use lazy initialization of a boolean
variable here and reset it in onBeforeRender?
  
Yes, you could use lazy evaluation. (You should reset the boolean in an 
overriden detach). However, this approach would not prevent problem 2 
for all cases. As a simple change can let problem 2 occur, I rather have 
one strategy that works always.


BTW onBeforeRender is called before the render phase (surprise), 
isVisible is called /during/ the render phase, detach is called at end 
of the render phase.



-2- isVisible can make your model be reloaded multiple times within 1
request



If you need to optimize, you can use lazy initialization of a boolean
variable here and reset it in onBeforeRender?
  
No, this won't work. The problem occurs because during detach of the 
component hierarchy there are still calls to isVisible (instead of only 
to detach). There are no more callbacks after detach (and that would not 
make sense any way).



I consider overriding isVisible a more clean OO approach. Using
setVisible results in messy non transparent chain of command.
  


Yes, with that I agree.

Regards,
   Erik.

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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



  1   2   >