Re: Wicket resources (css, js and images)?

2010-12-18 Thread Martin Grigorov
Hi Jeremy,

On Sat, Dec 18, 2010 at 6:53 AM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 Also worth mentioning, there are two other example decorating header
 responses that I committed into core for you to build on:

 1 - ResourceReferenceDependencyInjectingHeaderResponse - which allows
 you to create a IResourceReferenceDependencyConfigurationService which
 defines dependencies for your resource references.  For instance,
 wicket-ajax.js depends on wicket-event.js.  So, everywhere that we
 render a reference to wicket-ajax.js, we must be sure that a reference
 to wicket-event.js is also rendered.  However, with the
 ResourceReferenceDependencyInjectingHeaderResponse, you can make this
 automatic.  This is probably only worth the additional effort if you
 have many such reference dependencies.

 2 - HeaderResponseContainerFilteringHeaderResponse - allows you to
 filter resource references into different buckets.  One of these
 buckets is then rendered into the standard Wicket head location.
 The others can be rendered wherever you want in the page by embedding
 a HeaderResponseFilteredResponseContainer in your page.  This is
 useful if you want CSS to appear in the header and JS just before the
 /body tag in your app (a recommendation by UI experts to decrease
 page load time).  There is a default
 JavascriptFilteredIntoFooterHeaderResponse that performs the described
 header / footer split.

 --
 Jeremy Thomerson
 http://wickettraining.com
 Need a CMS for Wicket?  Use Brix! http://brixcms.org


 On Fri, Dec 17, 2010 at 11:45 PM, Jeremy Thomerson
 jer...@wickettraining.com wrote:
  As Martin mentioned, I added a way for you to decorate all header
  responses in an application.  See
  Application#setHeaderResponseDecorator.  You can use this to create
  your own IHeaderResponse and intercept all calls to render JS / CSS
  references.  Then, you could do smart things like keep all the
  references around until the end of the request (or actually, the
  renderHead traversal), and at that point, build a URL that references
  an aggregate of all requested CSS / JS resources.
 
  As Hielke mentioned, you then have problems because every page has a
  different combo of resources.  So, I provided
  AbstractResourceAggregatingHeaderResponse that provides a framework
  for grouping resource references into aggregate groups.  Now, your
  developer can specify groups for references.  What groups you specify
  are totally up to you.  The idea is that you group things that will be
  on every page into a group, and then the things that change on each
  page into another group.  So, you get to take advantage of the browser
  caching for those things that are on every page.  You can go further
  if you'd like.
 
  So, you could do something like the following to specify groups and
  load orders (things within a certain group may still need to be loaded
  before / after other things in same group).
 
  // example of things that may be shared for all your applications
  across your company, etc...:
  response.renderCSSReference(new
  GroupedAndOrderedResourceReference(ResourceGroup.GLOBAL, 0,
  HomePage.class, footer.css));
  response.renderCSSReference(new
  GroupedAndOrderedResourceReference(ResourceGroup.GLOBAL, 0,
  HomePage.class, header.css));
  // example of something that may be in this single application:
  response.renderCSSReference(new
  GroupedAndOrderedResourceReference(ResourceGroup.APPLICATION, 0,
  HomePage.class, app.css));
 
  I've put together a working quickstart example of this.  You can
  download it and play with it.
  http://wickettraining.com/attachments/resourceaggregation.tar.gz


Do you mind if we use this code for a new wicket-example application ?


 
  With some work, a standard set of aggregation groups could be defined,
  and this could be rolled into core.  If someone wants to spearhead
  that, I would love it and do anything I can to assist.
 
  PS - In an ideal world, you wouldn't even need to specify the groups
  manually.  You could have a smart algorithm that used each request to
  learn what things always appear together.  The algorithm would start
  grouping things that commonly appear together into groups
  automatically.  The first few requests wouldn't really group much, but
  as the requests continue, you would build better and better groups.


I think we should create a Wiki page with this description and add an entry
in migrate-to-1.5 with a link to that page.
I'll do it later today or tomorrow.


 
  --
  Jeremy Thomerson
  http://wickettraining.com
  Need a CMS for Wicket?  Use Brix! http://brixcms.org
 
  On Thu, Dec 16, 2010 at 4:36 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
  I believe the latest changes by Jeremy added functionality for this.
  Jeremy can you please explain how the
 new org.apache.wicket.markup.html.IHeaderResponseDecorator can be used (is
 being used by your customer) ?
 
  On Wed, Dec 15, 2010 at 9:05 PM, Alex Objelean 
 

Re: Wicket resources (css, js and images)?

2010-12-18 Thread Jeremy Thomerson
On Sat, Dec 18, 2010 at 3:05 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Do you mind if we use this code for a new wicket-example application ?

Go for it!  It was my intention to do so at some point, but I hadn't
actually finished my example until last night when I sent it here to
the list.

 I think we should create a Wiki page with this description and add an entry
 in migrate-to-1.5 with a link to that page.
 I'll do it later today or tomorrow.

Okay, great.  Of course, it's available in 1.4 as well, but I agree on
both counts - the new page and the link in the 1.5 migration page.

-- 
Jeremy Thomerson
http://wickettraining.com
Need a CMS for Wicket?  Use Brix! http://brixcms.org

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



How to programmatically get PlatformTransactionManager of a DAO ?

2010-12-18 Thread smallufo
I am developing a generic CRUD app , that can edit any Spring/JPA entities
with a AbstractDao pattern's implementation , such as UserDaoImpl ,
ForumDaoImpl ...etc

In my wicket page : I have to use @SpringBean to identify which
PlatformTransactionManager to use , such as :

@SpringBean(name=transactionManagerUser)
private PlatformTransactionManager transactionManagerUser;
private TransactionTemplate txTemplate;

public CrudPage(final PageParameters pps , final AbstractDaoT dao)
{

  super(pps);

  txTemplate= new TransactionTemplate(transactionManagerUser);
}

 The problem is , these DAOs are using different transaction managers , such
astransactionManagerUser , transactionManagerForum ...etc.

I cannot hard-code these txManager's name in my code. I have to
programmatically get the dao's txManager . How to achieve that ?

Thanks a lot !

Environments : Spring 3.0.5 , Hibernate-3.6 , JPA2


Re: How to programmatically get PlatformTransactionManager of a DAO ?

2010-12-18 Thread James Carman
Use declarative transaction management instead
 On Dec 18, 2010 10:59 AM, smallufo small...@gmail.com wrote:
 I am developing a generic CRUD app , that can edit any Spring/JPA entities
 with a AbstractDao pattern's implementation , such as UserDaoImpl ,
 ForumDaoImpl ...etc

 In my wicket page : I have to use @SpringBean to identify which
 PlatformTransactionManager to use , such as :

 @SpringBean(name=transactionManagerUser)
 private PlatformTransactionManager transactionManagerUser;
 private TransactionTemplate txTemplate;

 public CrudPage(final PageParameters pps , final AbstractDaoT dao)
 {

 super(pps);

 txTemplate= new TransactionTemplate(transactionManagerUser);
 }

 The problem is , these DAOs are using different transaction managers ,
such
 astransactionManagerUser , transactionManagerForum ...etc.

 I cannot hard-code these txManager's name in my code. I have to
 programmatically get the dao's txManager . How to achieve that ?

 Thanks a lot !

 Environments : Spring 3.0.5 , Hibernate-3.6 , JPA2


Re: How to programmatically get PlatformTransactionManager of a DAO ?

2010-12-18 Thread smallufo
Thanks.
but declarative txManagement add a lot of complexity to XMLs
Is there any other option ?


2010/12/19 James Carman ja...@carmanconsulting.com

 declarative transaction management


Re: How to programmatically get PlatformTransactionManager of a DAO ?

2010-12-18 Thread James Carman
Use annotations
On Dec 18, 2010 11:37 AM, smallufo small...@gmail.com wrote:
 Thanks.
 but declarative txManagement add a lot of complexity to XMLs
 Is there any other option ?


 2010/12/19 James Carman ja...@carmanconsulting.com

 declarative transaction management


Re: Announcing the Topicus Dashboard

2010-12-18 Thread Martijn Dashorst
On Fri, Dec 17, 2010 at 7:49 PM, Joe Lambe jla...@atlassian.com wrote:
 @Martijn  - I work at Atlassian and was one of the organizers of the
 campaign.  Thanks for your *awesome* entry and I appreciate your critiques
 below. :)

Thanks for having the competition! It was fun to be part of it and we
used it as a nice deadline for our wallboard. It was really the icing
on the cake for us developing the wallboard.

 P.S. It doesn't look like you filled out the
 https://atlassian.wufoo.com/forms/the-ultimate-wallboard-tshirt/ Ultimate
 Wallboard t-shirt form  - I'd be willing to let you enter late if you want a
 shirt - but you'll have to hustle and get it in today!

Thanks for reminding me! I just filled in the form with some
suggestions as well :)

Martijn

ps. you really don't want to hear me sing!

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



Re: Announcing the Topicus Dashboard

2010-12-18 Thread Joe Lambe


Martijn Dashorst wrote:
 
 
 Thanks for having the competition! It was fun to be part of it and we
 used it as a nice deadline for our wallboard. It was really the icing
 on the cake for us developing the wallboard.
 
 Glad to hear it. We've got more to come so stay tuned!
 
 Thanks for reminding me! I just filled in the form with some
 suggestions as well :)
 
 Thanks! I can't promise we'll take all suggestions seriously (*cough*
 American Idol *cough*). :)
 
 
 -
 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://apache-wicket.1842946.n4.nabble.com/Announcing-the-Topicus-Dashboard-tp3058300p3093943.html
Sent from the Users forum 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: Announcing the Topicus Dashboard

2010-12-18 Thread James Carman
On Dec 18, 2010 2:35 PM, Joe Lambe jla...@atlassian.com

  Thanks! I can't promise we'll take all suggestions seriously (*cough*
  American Idol *cough*). :)
 

I didn't think that not allowing voting until all submissions are in was
such a bad idea.  Wow that sentence hurt my brain.


Assigning a new Session does not change Session.ID

2010-12-18 Thread RainbirdTheElder

Hello Wicket community,

I'm relatively new to Wicket and I have a problem that I have not been 
able to solve so far by means of Google and crawling through the user 
mailing list archive.


What I want to do is change or replace the current Session of somebody 
using my Wicket web application.
After having found this discussion 
(https://issues.apache.org/jira/browse/WICKET-1767), the task at hand 
was pretty simple.


Here's how I do it:

...
private void assignNewSession() {

log.debug(Assigning new session to user.);
RequestCycle.get().getSession().replaceSession();
}
...

This also works perfectly if I try it out in a browser. I can see, that 
the session ID changes, as soon as this code has been executed.


What I have not been able to do so far, however, is finding a way to 
Unit-test, if the session has really been changed.

If I, for instance, include the following lines in the method above:

...
private void assignNewSession() {

log.debug(Assigning new session to user.);

Session oldSession = RequestCycle.get().getSession();
String oldSessionID = oldSession.getId();

// same way of replacing session as above
RequestCycle.get().getSession().replaceSession();

Session newSession = RequestCycle.get().getSession();
String newSessionID = newSession.getId();

System.out.println(oldSession == newSession);
System.out.println(oldSessionID == newSessionID);
}
...

then I will find that the ID of the Session I'm getting from the 
RequestCycle has not changed at all. The oldSession and newSession 
objects are even the same object.



So, my question is:

Why does the code replacing the Session work when executed within the 
browser? But why can't I seem to reproduce the replacement of the 
session or a change in the session id with that piece of code?
Does the session stay the same within one request cycle, and will it 
only change when the next request is issued (a difference I can see 
between the code above and running the same thing in a browser)?


I would be very grateful if you could try to explain this behavior to me 
in order to give me a better understanding of what Wicket is doing here 
and why, with my approach, I don't seem to be able to generate the 
result expected by me.


Also, if you could probably point out any way that I could actually use 
to unit-test the replacement of a session, that would be very helpful.



Thanks in advance,

Andreas Maly




Assigning a new Session does not change Session.ID

2010-12-18 Thread RainbirdTheElder

Hello Wicket community,

I'm relatively new to Wicket and I have a problem that I have not been 
able to solve so far by means of Google and crawling through the user 
mailing list archive.


What I want to do is change or replace the current Session of somebody 
using my Wicket web application.
After having found this discussion 
(https://issues.apache.org/jira/browse/WICKET-1767), the task at hand 
was pretty simple.


Here's how I do it:

...
private void assignNewSession() {

log.debug(Assigning new session to user.);
RequestCycle.get().getSession().replaceSession();
}
...

This also works perfectly if I try it out in a browser. I can see, that 
the session ID changes, as soon as this code has been executed.


What I have not been able to do so far, however, is finding a way to 
Unit-test, if the session has really been changed.

If I, for instance, include the following lines in the method above:

...
private void assignNewSession() {

log.debug(Assigning new session to user.);

Session oldSession = RequestCycle.get().getSession();
String oldSessionID = oldSession.getId();

// same way of replacing session as above
RequestCycle.get().getSession().replaceSession();

Session newSession = RequestCycle.get().getSession();
String newSessionID = newSession.getId();

System.out.println(oldSession == newSession);
System.out.println(oldSessionID == newSessionID);
}
...

then I will find that the ID of the Session I'm getting from the 
RequestCycle has not changed at all. The oldSession and newSession 
objects are even the same object.



So, my question is:

Why does the code replacing the Session work when executed within the 
browser? But why can't I seem to reproduce the replacement of the 
session or a change in the session id with that piece of code?
Does the session stay the same within one request cycle, and will it 
only change when the next request is issued (a difference I can see 
between the code above and running the same thing in a browser)?


I would be very grateful if you could try to explain this behavior to me 
in order to give me a better understanding of what Wicket is doing here 
and why, with my approach, I don't seem to be able to generate the 
result expected by me.


Also, if you could probably point out any way that I could actually use 
to unit-test the replacement of a session, that would be very helpful.



Thanks in advance,

Andreas Maly




Re: Assigning a new Session does not change Session.ID

2010-12-18 Thread James Carman
On Sat, Dec 18, 2010 at 4:02 PM, RainbirdTheElder
rainbirdtheel...@gmx.de wrote:

 I would be very grateful if you could try to explain this behavior to me in
 order to give me a better understanding of what Wicket is doing here and
 why, with my approach, I don't seem to be able to generate the result
 expected by me.


Use the source, Luke!  That's the great thing about open source.  You
can read it to see what's going on and perhaps learn something along
the way.  You'd be surprised what kind of tricks you can pick up by
reading other people's code.  So, I'd say start working your way
through it to try to see what it does.  If you still can't figure it
out, by all means, ping the list again.

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



Re: Assigning a new Session does not change Session.ID

2010-12-18 Thread RainbirdTheElder



Use the source, Luke!  That's the great thing about open source.  You
can read it to see what's going on and perhaps learn something along
the way.  You'd be surprised what kind of tricks you can pick up by
reading other people's code.  So, I'd say start working your way
through it to try to see what it does.  If you still can't figure it
out, by all means, ping the list again.


I'm sorry, I forgot to mention in my first post that I already dug quite 
deep into the code and had a look at quite a bit of code from the 
Session, RequestCycle and what not classes. I definitely agree with you, 
that one can learn lots of things from other people's code. So I did 
from diggin in the Wicket code. I'd say, I understood quite a few pieces 
of that code, but however it did not help me to grasp the bigger picture 
in terms of how it all plays together.
I also got to confess, that I don't have much experience yet with web 
programming, so I stopped digging into the code about when I left Wicket 
and got down to e.g. HttpRequests.
So if anybody could give me that bigger picture, nudge me in the right 
direction, or tell me what crucial point I have been missing, I'd still 
be very thankful.


Cheers,

Andreas Maly

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