Re: Expire session

2010-08-30 Thread Wilhelmsen Tor Iver
 Still wondering, how to disable concurrent logins with wicket-auth-
 roles...

Can't you cache the sessions and return the cached one from 
Application.newSession() if the same user logs in again? Or invalidate the old 
session?

- Tor Iver


WicketTester and https

2010-08-30 Thread Michael Sparer

 hi,

is there a way to test Pages that have the @RequireHttps annotation? 
currently the code


getTester().startPage(RegisterPage.class);
getTester().assertRenderedPage(RegisterPage.class);

results in this Exception:

junit.framework.AssertionFailedError: page was null
at 
org.apache.wicket.util.tester.WicketTester.assertResult(WicketTester.java:621)
at 
org.apache.wicket.util.tester.WicketTester.assertRenderedPage(WicketTester.java:569)


(using wicket 1.4.10)

I suppose this is due to the redirect it performs. 1 is there a way to 
test @RequireHttps pages and 2 wouldn't make a 
WicketTester.assertRedirect or WicketTester.assertHttpsRedirect would 
make sense for such scenarios?


cheers,

Michael

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



Re: Listview excel

2010-08-30 Thread Martin Makundi
Hi!

Just change  the mime type of the page to application/vnd.ms-excel.

**
Martin

2010/8/30 Altuğ Bilgin Altıntaş alt...@gmail.com:
 Hi all;

 Is it possible to export a ListView to excel. Should i use always Datatable
 ?

 Thanks.


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



Re: autocomplete for AjaxEditableLabel

2010-08-30 Thread Patrick Petermair


Is there a way to enable autocomplete for AjaxEditableLabel (just like 
AutoCompleteTextField)? I was going through AutoCompleteTextField as a 
reference and wrote my own behavior for autocompletion. The new behavior 
works perfectly for a TextField, but not for AjaxEditableLabel.


Answering my own question (in case someone is looking for the same 
functionality through a google search).


AjaxEditableLabel is a panel with a label and textfield component which 
is why adding the autocomplete behavior to it didn't work. I solved it 
by overriding the newEditor() method and adding my behavior to the 
editor in the AjaxEditableLabel panel like so:


AjaxEditableLabelString label = new AjaxEditableLabelString(foo) {

@Override
protected FormComponentString newEditor(final MarkupContainer
  parent, final String componentId, final IModelString model) {

final FormComponent form = super.newEditor(parent, componentId,
   model);
form.add(new MyAutoCompleteBehavior());
return form;
 }
};

Patrick

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



Re: Listview excel

2010-08-30 Thread Altuğ Bilgin Altıntaş
Thanks;

I added table in to WebMarkupContainer and WebMarkupContainer in to
getRequestCycle().setRequestTarget(
new ComponentRequestTarget(table));

It works.



2010/8/30 Martin Makundi martin.maku...@koodaripalvelut.com

 Hi!

 Just change  the mime type of the page to application/vnd.ms-excel.

 **
 Martin

 2010/8/30 Altuğ Bilgin Altıntaş alt...@gmail.com:
  Hi all;
 
  Is it possible to export a ListView to excel. Should i use always
 Datatable
  ?
 
  Thanks.
 

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




Re: WicketTester and https

2010-08-30 Thread Igor Vaynberg
wicket tester is not a complete emulation tool, it is designed for
simple usecases. you are welcome to patch it to support this, but its
probably easier to turn off the httpsrequestcycleprocessor in your
tests so no redirect happens.

-igor

On Mon, Aug 30, 2010 at 4:13 AM, Michael Sparer michael.spa...@gmx.at wrote:
  hi,

 is there a way to test Pages that have the @RequireHttps annotation?
 currently the code

                getTester().startPage(RegisterPage.class);
                getTester().assertRenderedPage(RegisterPage.class);

 results in this Exception:

 junit.framework.AssertionFailedError: page was null
    at
 org.apache.wicket.util.tester.WicketTester.assertResult(WicketTester.java:621)
    at
 org.apache.wicket.util.tester.WicketTester.assertRenderedPage(WicketTester.java:569)

 (using wicket 1.4.10)

 I suppose this is due to the redirect it performs. 1 is there a way to test
 @RequireHttps pages and 2 wouldn't make a WicketTester.assertRedirect or
 WicketTester.assertHttpsRedirect would make sense for such scenarios?

 cheers,

 Michael

 -
 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



Markup for BookMarkable links

2010-08-30 Thread Mike Dee

I'm coming up to speed on Wicket and came across something interesting that
seems somewhat basic.

I see a lot of examples in books and on the web that demonstrate the markup
for a bookmarkable link like this:

   # Search 

The code would be something like this:

  add( new BookmarkablePageLink( searchLink, Search.class ) );

The page appears, with the link.  Clicking on the link does nothing.

Interestingly, removing the HREF attribute works. So the markup is this:

   Search 

Could the problem be:
a) Something in Wicket changed and some of the documentation is out of date?
b) The books and examples are just wrong?
c) Or am I a moron and doing something else wrong?


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Markup-for-BookMarkable-links-tp2400422p2400422.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: OT: Best practices regarding service layers DAOs

2010-08-30 Thread Alexander Morozov

Hi Sebastian,

I think that service layer have to be responsible only for CRUD operations,
but L(list) operations should be built upon JPA-specific _READ-ONLY_ queries
or some kind of DSL (for example, querydsl
http://source.mysema.com/display/querydsl/Querydsl). The last one point
allows to build quite complex queries w/o affecting service layer.

So we have:
1. fine-graned business logic separated by service interface
2. service interface implementation incapsulates CRUD-operation
3. data provider uses specific service interface (in case of simple objects
list) or query dsl

Hopes it helps a little :)
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400436.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: OT: Best practices regarding service layers DAOs

2010-08-30 Thread Brian Topping
This is a very good summary.  I would add one very important consideration that 
is not often obvious until far too late.

If you think you want to eventually use database transactions (and you're 
really missing out on a great thing not to use them), the service method 
interfaces that your view layer uses should *also* be transaction boundaries.  

Why?  

Mostly because frameworks like Spring will allow you to simply throw an 
exception from service layer code to have the transaction automatically rolled 
back.  It's transparent and super effective!

But there's a problem if your view code calls more than one write method in the 
service layer for a single view layer unit of work (such as a form submission). 
 If the first call succeeds and commits it's transaction and the second one 
fails, the second service method can't unroll the commit of the first.  

For this reason, I tend to model my service interfaces very closely to what 
happens in a single unit of work in the user interface.  

Thinking about transaction demarcations like this will take you a long way 
toward developing great service interfaces.

Cheers, Brian

On Aug 30, 2010, at 12:58 PM, Alexander Morozov wrote:

 
 Hi Sebastian,
 
 I think that service layer have to be responsible only for CRUD operations,
 but L(list) operations should be built upon JPA-specific _READ-ONLY_ queries
 or some kind of DSL (for example, querydsl
 http://source.mysema.com/display/querydsl/Querydsl). The last one point
 allows to build quite complex queries w/o affecting service layer.
 
 So we have:
 1. fine-graned business logic separated by service interface
 2. service interface implementation incapsulates CRUD-operation
 3. data provider uses specific service interface (in case of simple objects
 list) or query dsl
 
 Hopes it helps a little :)
 -- 
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400436.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: OT: Best practices regarding service layers DAOs

2010-08-30 Thread Sebastian

Alexander,

If I understand you correctly, you are saying: view-only operations (e.g.
listings, search forms) can access the DAOs directly, and all operations
that modify data should be routed through the service layer?
How do you deal with enforcing security constraints (e.g. user X with role Y
can only see records created by himself)? I'd like to keep such things out
of the view (wicket), so that when I also want to expose say a webservice or
REST interface I do not need to duplicate the constraints checks and
enforcement.

Brian,

I'm using warp-persist (which will be superseded by guice-persist shortly),
which provides transactional semantics comparable to Spring. This is also
one of the reasons I started building services: to have a clear boundary for
transactions.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400503.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



floating div?

2010-08-30 Thread Kurt Heston
I have a really long table with qty values in one of the columns.  
Instead of having a total at the bottom of the page (and requiring the 
user to scroll to see it), I'd like to float a div in the bottom right 
that I can update on the fly as the user changes qty values.


The wicketstuff dojo package had a way to do it, but I don't believe 
it's compatible with 1.4.  Any ideas?


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



Re: [wiQuery] Custom Link to wiQuery Page doest not initialize target page

2010-08-30 Thread Sam Zilverberg
Hi,

I have the same problem, but my page is a non-bookmarkable page which has
only one constructor : public MyPage(Page backpage, ModelT model).

I don't see how setResponsePage can solve the problem for me unless I create
a default constructor.
I'm reluctant to do so because the page is some sort of a edit page in
which the user can edit the passed model object and I don't want this page
to be accessible in anyway but through a link that creates this specific
page for a specific model.

Any help will be greatly appreciated!


OT: Best practices regarding service layers DAOs

2010-08-30 Thread Sebastian

Hi all,

I've been struggling with some design questions in some wicket projects
lately, and hope to get some insights from fellow wicketeers.

Some years ago I started with Databinder as a DAO layer, without a service
layer. This led to UI code building queries or adding Restrictions to a jpa
(hibernate) query.
After working like that on some smaller projects, I came across warp-persist
and started using that (plus guice). Great! many new possibilities.
However, ever since I started using those tools, I have ended up with the
following:

- JPA Entities
- DAO interface per entity, with a (guice-bound) implementation
- UI either calls DAO methods directly for loading data, or specialized
IDataProvider implementation which takes a DAO and allows the UI to add
filters (e.g. a filter based on a search by name field).
- Service layer which is more or less based on the Transaction script
pattern (as described by Martin Fowler); this contains specific use cases,
such as cases where multiple objects need to be dealt with in a separate
transaction (@Transactional)

However, the above gets messy quickly. There are different ways to get to
the data: in some cases the UI calls DAOs directly, and sometimes a service
should be used since it does extra filtering etc.

So lately I started to wonder if I should make the UI only call the service
layer... Which would lead to a lot of extra classes and code which merely
forwards calls to the DAOs. Especially when combined with IDataProvider it
leads to a lot of UI-specific (findByXandY, findCountByXandY) methods in
both the DAO and service layer.

I decided to take a step back and re-evaluate. I only work on projects for
my own firm (so no external projects), and unfortunately do not have access
to people who have experience with these sorts of architectural design
issues. Well, of course there is the option of outsourcing, which I've tried
in a few projects; But let's just say that the resulting apps were by no
means well designed, even though the price was relatively high (small
project, 40.000 euro cost).

Recently I picked up Domain Driven Design by Eric Evans, and I like what I
am reading. Since most of my projects are small, I don't want to add many
layers to make things more complicated. However, I do want separation of
concerns (e.g. a clear boundary/layer for security, transactions). Injecting
services into my entities seems wrong to me, and I certainly don't want to
go the RoR ActiveRecord direction (all logic in entities, been there didn't
like it).

Since the projects are small, the effects of relatively unclean code are
negligible. On the other hand I am a purist (and a perfectionist), eager to
learn and improve; Also, some projects become more and more important (e.g.
handling millions of dollars worth of transactions), and keep on growing. 

Due to lack of experience in bigger projects I feel like I keep on
struggling with this without having a clear focus. It would really help me
to hear from other how they layer their wicket apps and why.

Thanks in advance for reading, and for posting a reply!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400408.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: [wiQuery] Custom Link to wiQuery Page doest not initialize target page

2010-08-30 Thread Ernesto Reinaldo Barreiro
Can you create a quick-start and attach it to a new issue at

http://code.google.com/p/wiquery/issues/list

Regards,

Ernesto

On Mon, May 10, 2010 at 6:17 PM, Jens Zastrow m...@jens-zastrow.de wrote:
 Hi experts,

 The following code (Link-example-code) breaks all of my wiQuery-enabled
 Pages.

 add(new LinkMyObject(link, listItem.getModel()) {
    public void onClick() {
         setResponsePage(new MyPage());
   }
 }

 The specified MyPage() ist entered, but without initializing the
 wiQuery-Subsystem.
 Only after page 'reload' with browser-button everything (js etc.) is loaded
 and initialized.

 This only happens with Links, not with BookmarkablePagelinks.
 I'm using wicket 1.4.8 und wiquery 1.0.1.

 Anybody facing the same problem?

 -
 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: floating div?

2010-08-30 Thread Kurt Heston

The following seems to work until the page refreshes and scrolls to the top:

//
Label lbl = new Label(floatDiv, floaty text) {
  @Override
  protected void onComponentTag(ComponentTag tag) {
tag.put(style, position: absolute; left: 610px; top: 
+ (80 + scrollValue)
+ px; height: 400px; width: 100px; padding: 1em;);
  }

};

AbstractAjaxBehavior beh = new AbstractAjaxBehavior() {
  @Override
  public void onRequest() {
scrollValue = 
Integer.parseInt(getRequest().getParameter(scrollPos));

  }
};
lbl.add(beh);
add(lbl);

WebMarkupContainer body = new WebMarkupContainer(theBody) {

  @Override
  public boolean isTransparentResolver() {
return true;
  }
};
body.add(new SimpleAttributeModifier(onscroll,
var wcall=wicketAjaxPost(' + beh.getCallbackUrl(true)
+ scrollPos='+window.pageYOffset)));
add(body);
//

Not sure yet how to keep the page from scrolling to the top each time 
the callback is made.  Still at it.  Suggestions?


On 08/30/2010 10:51 AM, Kurt Heston wrote:
I have a really long table with qty values in one of the columns.  
Instead of having a total at the bottom of the page (and requiring the 
user to scroll to see it), I'd like to float a div in the bottom right 
that I can update on the fly as the user changes qty values.


The wicketstuff dojo package had a way to do it, but I don't believe 
it's compatible with 1.4.  Any ideas?


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



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



Re: OT: Best practices regarding service layers DAOs

2010-08-30 Thread Alexander Morozov

Brain thank you for comment,

saying about Wicket and transactions, from my point of view, we have 2
posibilities:
1. manage transaction boundaries on per-request way (override
RequestCycle.onBeginRequest(), RequestCycle.onEndRequest(),
RequestCycle.onRuntimeException()) with PlatformTransactionManagement (do
not forget to proper configure TM with
SYNCHRONIZATION_ON_ACTUAL_TRANSACTION)
2. propagate transaction by means of AspectJ and load-time weaving for
actionable wicket subtypes (such as IFormSubmitListener, ILinkListener and
etc.)

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400954.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



Custom AjaxEditableLabel with an X in the upper right corner

2010-08-30 Thread Alec Swan
Hello,

I would like to customize AjaxEditableLabel so that every time it is
rendered it has a letter X in the right-upper corner which allows the
user to remove the label from the screen. I would also like to
customize other components, such as panels, the same way. So, ideally
the solution should be applicable to any type of component.

I would also like to generate the X label at runtime and not have the
web designer create a separate HTML element with a wicket:id for each
X.

Any ideas on how to best approach this?

Thanks,

Alec

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



Re: OT: Best practices regarding service layers DAOs

2010-08-30 Thread Brian Topping
While I haven't (yet) had this opportunity, I can't wait until the day that I 
wrap service interfaces with Web Services and connect it to a mobile UI.  

For that case alone, I focus my strategy on Spring managing the transaction 
with load-time weaving.  

$0.02...  

On Aug 30, 2010, at 10:31 PM, Alexander Morozov wrote:

 
 Brain thank you for comment,
 
 saying about Wicket and transactions, from my point of view, we have 2
 posibilities:
 1. manage transaction boundaries on per-request way (override
 RequestCycle.onBeginRequest(), RequestCycle.onEndRequest(),
 RequestCycle.onRuntimeException()) with PlatformTransactionManagement (do
 not forget to proper configure TM with
 SYNCHRONIZATION_ON_ACTUAL_TRANSACTION)
 2. propagate transaction by means of AspectJ and load-time weaving for
 actionable wicket subtypes (such as IFormSubmitListener, ILinkListener and
 etc.)
 
 -- 
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400954.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: floating div?

2010-08-30 Thread Kurt Heston

I was over-engineering this.  The answer was in wicket-ajax-debug.js:

style=position:fixed; right: 100px; bottom: 100px;...

No ajax required.

On 08/30/2010 05:34 PM, Kurt Heston wrote:
The following seems to work until the page refreshes and scrolls to 
the top:


// 


Label lbl = new Label(floatDiv, floaty text) {
  @Override
  protected void onComponentTag(ComponentTag tag) {
tag.put(style, position: absolute; left: 610px; top: 
+ (80 + scrollValue)
+ px; height: 400px; width: 100px; padding: 1em;);
  }

};

AbstractAjaxBehavior beh = new AbstractAjaxBehavior() {
  @Override
  public void onRequest() {
scrollValue = 
Integer.parseInt(getRequest().getParameter(scrollPos));

  }
};
lbl.add(beh);
add(lbl);

WebMarkupContainer body = new WebMarkupContainer(theBody) {

  @Override
  public boolean isTransparentResolver() {
return true;
  }
};
body.add(new SimpleAttributeModifier(onscroll,
var wcall=wicketAjaxPost(' + beh.getCallbackUrl(true)
+ scrollPos='+window.pageYOffset)));
add(body);
// 



Not sure yet how to keep the page from scrolling to the top each time 
the callback is made.  Still at it.  Suggestions?


On 08/30/2010 10:51 AM, Kurt Heston wrote:
I have a really long table with qty values in one of the columns.  
Instead of having a total at the bottom of the page (and requiring 
the user to scroll to see it), I'd like to float a div in the bottom 
right that I can update on the fly as the user changes qty values.


The wicketstuff dojo package had a way to do it, but I don't believe 
it's compatible with 1.4.  Any ideas?


-
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