Handle Hibernate transaction in wicket

2008-02-13 Thread Sébastien Piller

Hello,

I'm searching for a best practice to integrate some hibernate 
transaction with Wicket. I'd like to implement the session-per-request 
that is described here 
http://www.hibernate.org/hib_docs/v3/reference/fr/html_single/#tutorial-firstapp-workingpersistence


I think I can commit the transaction and close the session on the 
onAfterRender method. But where is the best place to start it? On the 
first line of the constructor? Or in the onBeforeRender (I think not)? 
Anywhere else?


And what about the ajax queries? I need to recreate a new transaction 
for each ajax request, need I?


Thank you a lot for your think :)

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



Intention of PropertyModel in 1.3

2008-02-13 Thread David Leangen

Hello!

I'm (finally!) migrating to 1.3, so have a few wrinkles to iron out.

Is somebody able to tell me the intention of the PropertyModel? I'm
wondering if something has changed, or if I just wasn't using it
correctly before...


In one of my panels, I use this type of property:

 PropertyModel languageModel = new PropertyModel( this, language );

And in the same class, I have a getter like this:

  public String getLanguage()
  {
  return getSession().getLocale().getLanguage();
  }

There is no setter and no language property.



This used to work in 1.2.6, but now 1.3.1 complains that there is no
setter for this class.

Now, I don't even _want_ a setter, but just to see what happens, I add
in a dummy setter, but wicket still complains that it can't find a
language property.


Am I not using the PropertyModel correctly (i.e. according to what
PropertyModel is intended for)? (If so, this means that I've been using
it incorrectly for many months without noticing, since it used to work.)

Or, should I be using some other type of model for this?


Thanx!
Dave




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



Re: Multiple panels and back button

2008-02-13 Thread Constantin Y

But i am using a custom detachable model to provide data to my repeater. 
Maybe its something else?
I am posting the code which is very simple and may help.

Thanks for your time and congratulations to the whole team for your work in
the 'Wicket in Action'

** the code is part of a quite big series of use cases testing for our
evaluation process, so dont pay attention to issues like thread safe lists
etc.

http://www.nabble.com/file/p15450972/DataPanels.html DataPanels.html 
http://www.nabble.com/file/p15450972/DataPanels%2524DataBrowserPanel.html
DataPanels%24DataBrowserPanel.html 
http://www.nabble.com/file/p15450972/DataPanels%2524DataEditorPanel.html
DataPanels%24DataEditorPanel.html 
http://www.nabble.com/file/p15450972/DataPanels.java DataPanels.java 
http://www.nabble.com/file/p15450972/SimpleDataProvider.java
SimpleDataProvider.java 
http://www.nabble.com/file/p15450972/SimplePojo.java SimplePojo.java 
http://www.nabble.com/file/p15450972/SimplePojoLoadableModel.java
SimplePojoLoadableModel.java 
http://www.nabble.com/file/p15450972/DataFile.java DataFile.java 



igor.vaynberg wrote:
 
 then you are not using the proper model, you should use a detachable
 model to feed your repeater. see LoadableDetachableModel. paste your
 code if you have more questions.
 
 -igor
 
 
 On Feb 12, 2008 12:34 AM, Constantin Y [EMAIL PROTECTED] wrote:

 Hi Igor,

 The problem with the back button is that if i dont setResponsePage(),
 after
 updating (or removing) a record from the list and pressing the back
 button,
 the system displays the exact previous data entry form with the old
 values
 of each record(!).
 If i had made, lets say 10 updates, the system will display all previous
 10
 forms.
 I noticed that the url parameters have a format like
 ?wicket:interface=:1:8::: where the second number changes every time i
 save (or remove) a record. If i press the back button then the second
 count
 decrements by 1 and the previous form is displayed with obsolete of
 course
 data.
 What the user expects by pressing the back button is to return to the
 menu
 (or whichever the caller page was) and not to the previous data entry
 form
 which is quite dangerous.
 This somehow is achieved by setting setResponsePage() inside the onClick
 code.
 I am quite sure that it is not wicket's problem and maybe i have to
 setup
 the whole page in a different way to achieve the behavior i want but i
 cant
 figure it out.

 Thanks again



 igor.vaynberg wrote:
 
  On Feb 8, 2008 7:44 AM, Constantin Y [EMAIL PROTECTED] wrote:
  Everything is ok except the back button.
 
  how is the back button broken exactly?
 
  If i dont setResponsePage(..) in
  the onClick() method of the save button (btnSave) then wicket starts
  versioning(?) of the data entry form.
 
  a) you shouldnt call setresponsepage in onclick
  b) wicket will version the page, whats wrong with that?
 
  On the other hand i dont want to
  reconstruct the while page whenever i edit (or remove) a record.
  What am i missing?
 
  like i said, not sure what is not working...and whatever you posted
  didnt make it
 
  -igor
 
  Thanks a lot
http://www.nabble.com/file/p15357597/DataPanels.java DataPanels.java
  --
  View this message in context:
 
 http://www.nabble.com/Multiple-panels-and-back-button-tp15357597p15357597.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Multiple-panels-and-back-button-tp15357597p15428648.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://www.nabble.com/Multiple-panels-and-back-button-tp15357597p15450972.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Handle Hibernate transaction in wicket

2008-02-13 Thread Igor Vaynberg
see databinder.net

-igor


On Feb 12, 2008 11:59 PM, Sébastien Piller [EMAIL PROTECTED] wrote:
 Hello,

 I'm searching for a best practice to integrate some hibernate
 transaction with Wicket. I'd like to implement the session-per-request
 that is described here
 http://www.hibernate.org/hib_docs/v3/reference/fr/html_single/#tutorial-firstapp-workingpersistence

 I think I can commit the transaction and close the session on the
 onAfterRender method. But where is the best place to start it? On the
 first line of the constructor? Or in the onBeforeRender (I think not)?
 Anywhere else?

 And what about the ajax queries? I need to recreate a new transaction
 for each ajax request, need I?

 Thank you a lot for your think :)

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



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



Re: Reading selected radio in validator

2008-02-13 Thread Igor Vaynberg
you can use getconvertedinput() to get the value that will eventually
be pushed into session.

-igor


On Feb 12, 2008 10:44 PM, Rik van der Kleij [EMAIL PROTECTED] wrote:
 Hi,

 Does someone knows a solution for reading the selected radio button in the
 validate() of a IFormValidator implementation? The problem I have is that
 getOutput() on a form component gives the value out of the HTML because no
 conversion to objects is yet done in the validation step. By the way, I'm
 using this validation in a wizard step of wicket extensions.

 Thanks for any help,
 Rik


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



Re: Switching locales with the same link

2008-02-13 Thread Sebastiaan van Erk

Like in the code given, you can just use :

HomePage.this.getString(header.versionLanguage)

in the anonymous inner class instead of using the trick you mention. 
The reference of the page is *already* passed to the anonymous inner 
class (by java itself, since anonymous inner classes are not and cannot 
be static), now you are actually causing the reference to be stored twice.


Regards,
Sebastiaan

Korsten, Peter, VF-MT wrote:

Dankjewel! :)

I had to tweak the code below a bit, in order to get it working, but
this is what I ended up with:

public HomePage()
{
final Component parentPage = this;
add( new Link( languageSwitch )
{
@Override
public void onClick()
{
String language = parentPage.getString(
header.versionLanguage );
Locale locale = new Locale( language );
this.getSession().setLocale( locale );
}
} );
}

The trick is to pass a reference of the page to the anonymous inner
class.

Incidentally, the languages used will be 'en' and 'mt'...

- Peter 


-Original Message-
From: Erik van Oosten [mailto:[EMAIL PROTECTED] 
Sent: 13 February 2008 10:07

To: users@wicket.apache.org
Subject: Re: Switching locales with the same link

Hi Peter,

Yes, you can do this. Suppose the link is in LocalePanel, then

LocalePanel.properties:
other_locale: nl_NL

LocalePanel_en.properties:
other_locale: en_US

LocalePanel.java:

add(new Link(localeLink, new Model() {
public Object getObject() {
Locale l = new Locale(LocalePanel.this.get(other_locale));
getSession().setLocale(l);
}
});

Or something like that :)

Regards,
 Erik.



Korsten, Peter, VF-MT wrote:
So, is it possible to make a link that takes the language code from 
the properties file as a parameter, and does something along the lines


of getSession().setLocale(new Locale(lc)), where lc is the language 
code from the link?


  



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



There is only one of you for all time.  Fearlessly be yourself.
Life is Now!
---

This email is intended only for the use of individuals to whom it is addressed, 
as it may contain confidential or privileged information. If you are not a 
named addressee, intended recipient, or the person responsible for delivering 
the message to the named addressee, be advised that you have received this 
email in error and that you should not disseminate, distribute, print, copy 
this mail or otherwise divulge its contents. In such instances, please notify 
Vodafone Malta Limited on telephone number +356 9247 and delete this email 
from your system. Since this transmission was affected via email, Vodafone 
Malta Limited cannot guarantee that it is secure or error-free as information 
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or 
contain viruses. Vodafone Malta Limited does not accept liability for any 
errors or omissions in the contents of this message which arise as a result of 
email transmission.

Save the environment for our children - Print e-mail only when necessary.

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



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Switching locales with the same link

2008-02-13 Thread Martijn Dashorst
On 2/13/08, Korsten, Peter, VF-MT [EMAIL PROTECTED] wrote:
 Incidentally, the languages used will be 'en' and 'mt'...

mt == manager talk?

Martijn
-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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



Re: Switching locales with the same link

2008-02-13 Thread Erik van Oosten

Erik van Oosten wrote:

Indeed, that's what I did too.

Hmm, but the rest was crap I now see.
Anyway, glad it got you on the right track.

   Erik.



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



Problem with bad CSS path after validation

2008-02-13 Thread dfernandez


Hello all,

I am having problems with the path that Wicket builds for my CSS sheet. I
have a BasePage which has:

add(HeaderContributor.forCss(css/styles.css));

And a sign-in page that extends this BasePage is mounted like this at the
Application init() method:

mountBookmarkablePage(/aaa/signIn,  SignInPage.class);

The problem is, when I load this page I get a correct CSS path, like this:

link rel=stylesheet type=text/css href=../css/styles.css /

And when I input incorrect data in the form, I get a message in my feedback
panel and I am redirected to the same page, but this time the URL is not
/aaa/signIn, but /?wicket:interface=:5.

This time the page renders correctly, but there is no CSS! And that is
because, if I see the HTML, the link tag for this CSS sheet is:

link rel=stylesheet type=text/css href=../css/styles.css /

Instead of what it should be: css/styles.css

What can be happening here?

In case this helps, I am applying the Wicket filter to /*.

Many thanks,
Daniel.

-- 
View this message in context: 
http://www.nabble.com/Problem-with-bad-CSS-path-after-validation-tp15455620p15455620.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Switching locales with the same link

2008-02-13 Thread Erik van Oosten

Indeed, that's what I did too.

Martijn, mt is Maltese, now that's is something you don't see often in 
the Netherlands :)


   Erik.



Sebastiaan van Erk wrote:

Like in the code given, you can just use :

HomePage.this.getString(header.versionLanguage)

in the anonymous inner class instead of using the trick you mention. 
The reference of the page is *already* passed to the anonymous inner 
class (by java itself, since anonymous inner classes are not and 
cannot be static), now you are actually causing the reference to be 
stored twice.


Regards,
Sebastiaan








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



Re: Wicket Ideal Bandwidth

2008-02-13 Thread Nino Saturnino Martinez Vazquez Wael
That completely depends on your content.. If you use compressed resource 
references etc, clients need to download less, also there are tools to 
shrink your js and css files...


regards Nino

carloc wrote:

Hi guys,

What do you think will be the ideal bandwidth to use when you are using
Wicket?
Will it work good on a 128kbps connection?

what's the beset bandwidth that you could recommend?

carlo
  


--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



js pop appearing behind flash

2008-02-13 Thread mbelarbi

Hi,

I have a js date picker pop up when the calendar icon is clicked, exactly
like this one on the wicket example pages:
http://wicketstuff.org/wicket13/dates/

Mine is used in exactly the same way, I have  [ input type=text
wicket:id=dateTextField / ] on the html side and on the java side, a
datePicker is added to the dateTextField field [ dateTextField.add(new
DatePicker()); ]

Like I said exactly like in the example from wicket. The problem I have is
that I have a flash right under the date text field, and when ever the
calendar icon is clicked the calendar popup is rendered behind the flash.
How do I get it to show ontop of the flash?

Thanks
-- 
View this message in context: 
http://www.nabble.com/js-pop-appearing-behind-flash-tp15456839p15456839.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: Switching locales with the same link

2008-02-13 Thread Korsten, Peter, VF-MT
Yes, you're absolutely right. I got an indication by NetBeans that
something was incorrect, but it was apparently about something else. I'd
never seen this construct before, and it's not exactly like I'm just
starting out with Java.

Again, everybody, thanks for the quick replies.

off-topic
And indeed, 'mt' stands for Malta, an island state in the middle of the
Mediterranean Sea. The language is Semitic in nature, most closely
related to classic Arabic and Lebanese, yet it is written in the Latin
alphabet.

In the seven years I've been living here, since moving from my native
Netherlands, I haven't been able to learn it. But at least I can write
it. I'll drop a line as soon as the project is ready, I suppose you'd
like to see Wicket in action.
/off-topic

- Peter

-Original Message-
From: Sebastiaan van Erk [mailto:[EMAIL PROTECTED] 
Sent: 13 February 2008 11:34
To: users@wicket.apache.org
Subject: Re: Switching locales with the same link

Like in the code given, you can just use :

HomePage.this.getString(header.versionLanguage)

in the anonymous inner class instead of using the trick you mention. 
The reference of the page is *already* passed to the anonymous inner
class (by java itself, since anonymous inner classes are not and cannot
be static), now you are actually causing the reference to be stored
twice.

Regards,
Sebastiaan


There is only one of you for all time.  Fearlessly be yourself.
Life is Now!
---

This email is intended only for the use of individuals to whom it is addressed, 
as it may contain confidential or privileged information. If you are not a 
named addressee, intended recipient, or the person responsible for delivering 
the message to the named addressee, be advised that you have received this 
email in error and that you should not disseminate, distribute, print, copy 
this mail or otherwise divulge its contents. In such instances, please notify 
Vodafone Malta Limited on telephone number +356 9247 and delete this email 
from your system. Since this transmission was affected via email, Vodafone 
Malta Limited cannot guarantee that it is secure or error-free as information 
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or 
contain viruses. Vodafone Malta Limited does not accept liability for any 
errors or omissions in the contents of this message which arise as a result of 
email transmission.

Save the environment for our children - Print e-mail only when necessary.

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



Re: Problem with bad CSS path after validation

2008-02-13 Thread dfernandez



dfernandez wrote:
 
 
 In case this helps, I am applying the Wicket filter to /*.
 
 

But: if I switch the filter-mapping to /app/*... it works!

Is this normal? /* filter mapping is supposed to be allowed, isn't it? The
quickstart application in Wicket in Action uses it...

Regards,
Daniel.


-- 
View this message in context: 
http://www.nabble.com/Problem-with-bad-CSS-path-after-validation-tp15455620p15456852.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Odd behaviour after setGatherExtendedBrowserInfo(true)

2008-02-13 Thread Cristi Manole
Hello,

I wanned to be able to get the browser client size, so I followed the
examples and put
getRequestCycleSettings().setGatherExtendedBrowserInfo(true) in my
Application init method.

I can get the parameters without any problem, but now on the login page,
after I submit, for a few seconds I get a page with a message If you see
this, it means that both javascript and meta-refresh are not support by the
browser configuration. Please click this link to continue to the
original destination. Then I am automatically redirected.

My problem here is that now *some ajax wicket components don't work ok when
i first click then - i have to refresh that page*.

I am certain this is due to extendedbrowserinfo.

*What I want is for that info message NOT to appear and to understand what
is happening and how i could make the links to work as before. *

I'm using firefox with what's activated by default when installed.

Tks in advance,
Cristi


Re: Intention of PropertyModel in 1.3

2008-02-13 Thread Martin Funk
Hi David,

I'm not able to tell you the intention of the PropertyModel.
My guess for coding to your spec in 1.3 would be:

IModel languageModel = new AbstractReadOnlyModel() {
  @Override
  public Object getObject() {
 return getSession().getLocale().getLanguage();  }
};

in your special case you probably could do this too:

IModel languageModel = new PropertyModel(this,
session.locale.language)));

But than your 'readonly' intention might be not that clear.

martin

2008/2/13, David Leangen [EMAIL PROTECTED]:


 Hello!

 I'm (finally!) migrating to 1.3, so have a few wrinkles to iron out.

 Is somebody able to tell me the intention of the PropertyModel? I'm
 wondering if something has changed, or if I just wasn't using it
 correctly before...


 In one of my panels, I use this type of property:

 PropertyModel languageModel = new PropertyModel( this, language );

 And in the same class, I have a getter like this:

   public String getLanguage()
   {
   return getSession().getLocale().getLanguage();
   }

 There is no setter and no language property.



 This used to work in 1.2.6, but now 1.3.1 complains that there is no
 setter for this class.

 Now, I don't even _want_ a setter, but just to see what happens, I add
 in a dummy setter, but wicket still complains that it can't find a
 language property.


 Am I not using the PropertyModel correctly (i.e. according to what
 PropertyModel is intended for)? (If so, this means that I've been using
 it incorrectly for many months without noticing, since it used to work.)

 Or, should I be using some other type of model for this?


 Thanx!
 Dave




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




working on my first wicket web 2.0 scriptaculos component

2008-02-13 Thread Fernando Wermus
Hi all,
 I am working on rtying to reproduce this behavior
http://wiki.script.aculo.us/scriptaculous/show/SortableListsDemo.
Two sortable list which you can reorder de item in it a between them.
This is the html generated by my component, but it seems
not to work. It doesn't call the component back. I was reading on the
net about some constrains in the ids and I think I apply to it.
However, I am still in troubles. The dinamic part works, not the call back.

div id=holder6 wicket:id=holder
div class=node 
ul id=firstlist7 wicket:id=firstlist
li id=firstlistFirstlist_0 
wicket:id=firstlistFirstlist
span wicket:id=nombreLabela/span
/lili id=firstlistFirstlist_1 
wicket:id=firstlistFirstlist
span wicket:id=nombreLabela/span

/li
/ul
/div
div class=node 
ul id=secondlist8 wicket:id=secondlist
li id=secondlistSecondlist_0 
wicket:id=secondlistSecondlist
span wicket:id=nombreLabel2a/span
/lili id=secondlistSecondlist_1 
wicket:id=secondlistSecondlist

span wicket:id=nombreLabel2a/span
/li
/ul
/div
/div
script type=text/javascript
Sortable.create('firstlist7',
{dropOnEmpty:true,containment:['firstlist7','secondlist8'],constraint:false},
{
  onUpdate: function(element) {
wicketAjaxGet('?x=6*%3A1%3Atabs%3Apanel%3Amensajes%3Apanel%3Aholder%3A1%3AIActivePageBehaviorListener%3A0%3A%26amp%3Bwicket%3AignoreIfNotActive%3Dtrue'
+ Sortable.serialize(element)); }
}
);
Sortable.create('secondlist8',
{dropOnEmpty:true,containment:['firstlist7','secondlist8'],constraint:false},
{
  onUpdate: function(element) {
wicketAjaxGet('?x=6*%3A1%3Atabs%3Apanel%3Amensajes%3Apanel%3Aholder%3A1%3AIActivePageBehaviorListener%3A0%3A%26amp%3Bwicket%3AignoreIfNotActive%3Dtrue'
+ Sortable.serialize(element)); }
}
);
/script



-- 
Fernando Wermus.


Re: js pop appearing behind flash

2008-02-13 Thread Martin Funk
Hi,

maybe the sugestion in the first result helps:
http://www.google.com/search?hl=deq=yui+calendar+z-index+flash+ontopbtnG=Google-Suchelr=

mf

2008/2/13, mbelarbi [EMAIL PROTECTED]:


 Hi,

 I have a js date picker pop up when the calendar icon is clicked, exactly
 like this one on the wicket example pages:
 http://wicketstuff.org/wicket13/dates/

 Mine is used in exactly the same way, I have  [ input type=text
 wicket:id=dateTextField / ] on the html side and on the java side, a
 datePicker is added to the dateTextField field [ dateTextField.add(new
 DatePicker()); ]

 Like I said exactly like in the example from wicket. The problem I have is
 that I have a flash right under the date text field, and when ever the
 calendar icon is clicked the calendar popup is rendered behind the flash.
 How do I get it to show ontop of the flash?

 Thanks
 --
 View this message in context:
 http://www.nabble.com/js-pop-appearing-behind-flash-tp15456839p15456839.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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




Opening DynamicWebResource from Button/AjaxButton?

2008-02-13 Thread UPBrandon

In a project I am working on, I wrote a DynamicWebResource that generates a
PDF file and, by setting the Content-Disposition in the header, got it so
that the user is prompted to download the PDF when they click on a
ResourceLink to my PDF-generating resource.

That all works fine but now I need to open the PDF from a button.  I want to
allow the user to select a value in a form and press a button to view
somewhat of a report for the item they selected.  However, there doesn't
appear to be any type of button that would lead a user to my
DynamicWebResource.  Is there any way to have a button do a submit (update
the model) and then lead the user to a resource?

-Brandon
-- 
View this message in context: 
http://www.nabble.com/Opening-DynamicWebResource-from-Button-AjaxButton--tp15459841p15459841.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: wicket-security Custom Access Denied Page

2008-02-13 Thread Warren
I understand that, but what I want to do is create a message on that page
that reads Users in group xxx do not have access to yyy where yyy would be
the name of the principal that triggered the access denied. I need to get
the name of that principal.

 -Original Message-
 From: Maurice Marrink [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 13, 2008 12:12 AM
 To: users@wicket.apache.org
 Subject: Re: wicket-security Custom Access Denied Page


 In the init of your webapp do
 getApplicationSettings().setAccessDeniedPage(MyPage.class)

 This is a wicket setting and not related to the security framework.

 Maurice

 On Feb 12, 2008 7:50 PM, Warren [EMAIL PROTECTED] wrote:
  How do you set-up a custom access denied page that has a message on it
  like Users in group xxx do not have access to yyy? I also want to have
  this page return to the previous page the user was on. I am using
  wicket-security (wasp and swarm).
 
  Thanks,
 
  Warren Bell
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



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



Re: [WicketStuff-Scriptaculous] DragNDrop problem in IE6/IE7.

2008-02-13 Thread Ryan Sonnek
No, i haven't yet.  the problem for me is that I don't have an install
of IE6/7 to test this out on.  I'd be happy to apply any patch that
someone has that has been tested against IE6 and IE7 though.

On Feb 13, 2008 12:54 AM, Edward Yakop [EMAIL PROTECTED] wrote:
 Hi,

 Thanx for the hints :)
 The problem is solved, but I'm not sure whether Ryan has patched the
 scriptaculous code in wicket-stuff svn.

 Regards,
 Edward Yakop


 On Feb 13, 2008 2:10 PM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote:
  Don't know if it is the same issue but I have found  the same problem a
  while ago (refreshing a component via Ajax) and the problem was
  scriptaculous requires to clean up the Droppables  if an element was
  removed from the DOM tree. So, all I did was add a a clearAll
  (JavaScript) method  that delete all the Droppables. something like
 
  var Droppables = {
drops: [],
 
removeAll: function(element) {
  this.drops = [];
},
 
  ..
 
  and then call it before any Ajax request that recreated the DOM tree. So
  that I could safely recreated my component and make them droppables
  again. This worked fine for IE7. For Firefox I never found those
  problems... There was a note on the web page explaining Droppables that
  suggested this idea...
 
  Hope this helps...
 
  Best,
 
  Ernesto
 
 
  Lan Boon Ping wrote:
   Hi,
  
   I have encountered a DragNDrop problem using wicketStuff-scriptaculous
   in IE6/IE7. The DragNDrop only work for the first time, but
   subsequently, the draggable object is no longer draggable. FYI, this
   problem doesn't exist in Firefox and it can be reproduced in
   wicket-contrib-scriptaculous-examples.
  
   Any hints?
  
   Thanks in advance.
  
   Regards
   Boon Ping.
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



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



Re: Wicket Ideal Bandwidth

2008-02-13 Thread UPBrandon

Regardless of what technologies you use on the server side (Wicket, JSF,
Struts, etc.,) the end product that gets transmitted to the user is just
plain old HTML.  Use the same judgment you would use with any other
page/site.  If you have big pages with lots of images and whatnot, you will
either need a faster connection or you would need to be a little more
patient.  :-)

I suppose AJAX might be another consideration.  If you are using AJAX a lot,
you application's responsiveness might depend on your connection.  But even
then, with relatively small responses, responsiveness generally has more to
do with latency than bandwidth.

-Brandon


carloc wrote:
 
 Hi guys,
 
 What do you think will be the ideal bandwidth to use when you are using
 Wicket?
 Will it work good on a 128kbps connection?
 
 what's the beset bandwidth that you could recommend?
 
 carlo
 

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


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



How to Display List in DataTable

2008-02-13 Thread wiki

Hi I have a little problem with displaying list inside datatable.
I have a list of questions and each question has a list of answers.My design
requirement is to  display one question per page(that's why used Data
Provider) and within that page I have to display list of relevant answers.I
have a java classes(User,Questionaire,Questions,Answers) User class has List
of Questionaire and that(Questionaire) has list of questions Then Question
class has a list of Answers.So from Lecturer  WebPage I can click a
questionaire link to go to questionaire Page which display list of
questionaire(using ListView).From questionaire I did manage to display
Questions.Could anybody   know how to embed list in Data Table to display
answers.

Thanks 

public class ShowQuestions extends WebPage

{

//
///** Creates a new instance of ShowQuestions */
//List questions=qaire.getMcssquestion();
//ListView list=new ListView(questionaire,questions)
//{
//protected void populateItem(ListItem item)
//{
//final MCSSQuestion
mcssquestion=(MCSSQuestion)item.getModelObject();
//
//item.setModel(new CompoundPropertyModel(mcssquestion));
//item.add(new Label(questiontext));
//item.add(new Label(questionaire.Title));
//
//
//}
//
//};
//add(list);
//}
public ShowQuestions(final Questionaire qaire)
{

SortableDataProvider provider= new SortableDataProvider()
{
// Return how many rows there are
public int size()
{
return qaire.getMcssquestion().size();
}
// convert each row object as a model
public IModel model(Object object)
{
MCSSQuestion mcss=(MCSSQuestion)object;
return new Model((Serializable) mcss);
}
public Iterator iterator(int first, int count)
{
return qaire.selectEntries(first,count).iterator();
}
};
IColumn[] columns= { new PropertyColumn(new
Model(ID),questiontext)
};

DefaultDataTable datatable=new
DefaultDataTable(eachentry,columns,provider,1);
add(datatable);
}

-- 
View this message in context: 
http://www.nabble.com/How-to-Display-List-in-DataTable-tp15459611p15459611.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: [WicketStuff-Scriptaculous] DragNDrop problem in IE6/IE7.

2008-02-13 Thread Ryan Sonnek
Ok everyone, I think I have a fix checked in.  Before re-rendering the
DraggableTarget on the Ajax response, I call the scriptaculous
Droppables.remove() to cleanup the old reference.

The wicketstuff-scriptaculous-example project should be able to test
and verify this behavior.  If anyone has a spare browser that they can
throw at it to see that it works, I'd appreciate it.

Thank you *everyone* for your contributions.  I never would have
noticed this issue without your help!

On Feb 13, 2008 10:39 AM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
 if you have an example running, i'll be happy to test on safari and
 ie6/7/ff ..


 Ryan Sonnek wrote:
  No, i haven't yet.  the problem for me is that I don't have an install
  of IE6/7 to test this out on.  I'd be happy to apply any patch that
  someone has that has been tested against IE6 and IE7 though.
 
  On Feb 13, 2008 12:54 AM, Edward Yakop [EMAIL PROTECTED] wrote:
 
  Hi,
 
  Thanx for the hints :)
  The problem is solved, but I'm not sure whether Ryan has patched the
  scriptaculous code in wicket-stuff svn.
 
  Regards,
  Edward Yakop
 
 
  On Feb 13, 2008 2:10 PM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] 
  wrote:
 
  Don't know if it is the same issue but I have found  the same problem a
  while ago (refreshing a component via Ajax) and the problem was
  scriptaculous requires to clean up the Droppables  if an element was
  removed from the DOM tree. So, all I did was add a a clearAll
  (JavaScript) method  that delete all the Droppables. something like
 
  var Droppables = {
drops: [],
 
removeAll: function(element) {
  this.drops = [];
},
 
  ..
 
  and then call it before any Ajax request that recreated the DOM tree. So
  that I could safely recreated my component and make them droppables
  again. This worked fine for IE7. For Firefox I never found those
  problems... There was a note on the web page explaining Droppables that
  suggested this idea...
 
  Hope this helps...
 
  Best,
 
  Ernesto
 
 
  Lan Boon Ping wrote:
 
  Hi,
 
  I have encountered a DragNDrop problem using wicketStuff-scriptaculous
  in IE6/IE7. The DragNDrop only work for the first time, but
  subsequently, the draggable object is no longer draggable. FYI, this
  problem doesn't exist in Firefox and it can be reproduced in
  wicket-contrib-scriptaculous-examples.
 
  Any hints?
 
  Thanks in advance.
 
  Regards
  Boon Ping.
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


 -

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



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



Formated integer in TextField

2008-02-13 Thread Marco Aurélio Silva
Hi All

I'm having a problem with TextField on wicket 1.2.6.

I must format the integer numbers, so, when the number is 123456780 it will
be formated as 123,456,789 or 123.456.789 (according to user locale). The
problem is that when I submit the form, the validation fails because
123,456,789 is not a valid integer number.
Is there a way to solve this?
Thanks in advance!
Marco


Re: [WicketStuff-Scriptaculous] DragNDrop problem in IE6/IE7.

2008-02-13 Thread Nino Saturnino Martinez Vazquez Wael
if you have an example running, i'll be happy to test on safari and 
ie6/7/ff ..


Ryan Sonnek wrote:

No, i haven't yet.  the problem for me is that I don't have an install
of IE6/7 to test this out on.  I'd be happy to apply any patch that
someone has that has been tested against IE6 and IE7 though.

On Feb 13, 2008 12:54 AM, Edward Yakop [EMAIL PROTECTED] wrote:
  

Hi,

Thanx for the hints :)
The problem is solved, but I'm not sure whether Ryan has patched the
scriptaculous code in wicket-stuff svn.

Regards,
Edward Yakop


On Feb 13, 2008 2:10 PM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote:


Don't know if it is the same issue but I have found  the same problem a
while ago (refreshing a component via Ajax) and the problem was
scriptaculous requires to clean up the Droppables  if an element was
removed from the DOM tree. So, all I did was add a a clearAll
(JavaScript) method  that delete all the Droppables. something like

var Droppables = {
  drops: [],

  removeAll: function(element) {
this.drops = [];
  },

..

and then call it before any Ajax request that recreated the DOM tree. So
that I could safely recreated my component and make them droppables
again. This worked fine for IE7. For Firefox I never found those
problems... There was a note on the web page explaining Droppables that
suggested this idea...

Hope this helps...

Best,

Ernesto


Lan Boon Ping wrote:
  

Hi,

I have encountered a DragNDrop problem using wicketStuff-scriptaculous
in IE6/IE7. The DragNDrop only work for the first time, but
subsequently, the draggable object is no longer draggable. FYI, this
problem doesn't exist in Firefox and it can be reproduced in
wicket-contrib-scriptaculous-examples.

Any hints?

Thanks in advance.

Regards
Boon Ping.

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





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


  

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





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


  


--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Intention of PropertyModel in 1.3

2008-02-13 Thread Igor Vaynberg
hmm, this should still work. mind filing a jira bug with a quickstart?

-igor


On Feb 13, 2008 12:00 AM, David Leangen [EMAIL PROTECTED] wrote:

 Hello!

 I'm (finally!) migrating to 1.3, so have a few wrinkles to iron out.

 Is somebody able to tell me the intention of the PropertyModel? I'm
 wondering if something has changed, or if I just wasn't using it
 correctly before...


 In one of my panels, I use this type of property:

  PropertyModel languageModel = new PropertyModel( this, language );

 And in the same class, I have a getter like this:

   public String getLanguage()
   {
   return getSession().getLocale().getLanguage();
   }

 There is no setter and no language property.



 This used to work in 1.2.6, but now 1.3.1 complains that there is no
 setter for this class.

 Now, I don't even _want_ a setter, but just to see what happens, I add
 in a dummy setter, but wicket still complains that it can't find a
 language property.


 Am I not using the PropertyModel correctly (i.e. according to what
 PropertyModel is intended for)? (If so, this means that I've been using
 it incorrectly for many months without noticing, since it used to work.)

 Or, should I be using some other type of model for this?


 Thanx!
 Dave




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



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



Re: Datastore localisation - Sanity check

2008-02-13 Thread Igor Vaynberg
looks ok.

-igor


On Feb 13, 2008 1:22 AM, Ned Collyer [EMAIL PROTECTED] wrote:

 Hi,

 I want to use my own localisation service.  This allows me to handle the
 properties differently via a GUI from within the app, or from another
 location, and gives customers / implementors a bit more power.

 Thing I'm working on will have components that can be translated and
 customised for many different locales.  These should can be managed the
 clients themselves during runtime.  Ideally, there should be an export
 function from the GUI to extract an appropriately named resource file to
 contribute back into the central code base. (ie, value adding to the
 software as its used more).  Also, if there is nothing in the database, it
 would roll back to the properties files.

 I love the properties files approach, and the way wicket has its property
 overrides determined (eg in ComponentStringResourceLoader).

 What I am planning on doing is extending the ResourceStreamLocator as I can
 use the super calls in a more elegant fashion than extending the
 PropertiesFactory and having to reimplement much of its functionality.
 PropertiesFactory does not appear very

 So I'll end up with something like

 public class MyResourceStreamLocator extends ResourceStreamLocator
 public IResourceStream locate(Class clazz, String path) {
 IResourceStream stream = locateFromDatastore(clazz, path);
 if (stream != null) {
 return stream;
 }

 return super.locate(clazz, path);
 }
 }

 This seems like an elegant approach to datastore localisation which retains
 all of the existing functionality (property resolution, cascade of
 properties files, cache) and gives rollback to standard wicket properties
 files.

 I can easily clear the caches.

 The only downfall I can see is that because it is per file based, I need
 to ensure that if I override any properties in a given file, the entire file
 is in the datastore.

 I believe I could put CSS and JS into the db too.. although this is not
 planned.

 Any thoughts?
 --
 View this message in context: 
 http://www.nabble.com/Datastore-localisation---Sanity-check-tp15451880p15451880.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: Formated integer in TextField

2008-02-13 Thread Igor Vaynberg
you can write a converter that strips any commas/periods from input.
override getconverter() on the textfield.

-igor


On Feb 13, 2008 8:53 AM, Marco Aurélio Silva [EMAIL PROTECTED] wrote:
 Hi All

 I'm having a problem with TextField on wicket 1.2.6.

 I must format the integer numbers, so, when the number is 123456780 it will
 be formated as 123,456,789 or 123.456.789 (according to user locale). The
 problem is that when I submit the form, the validation fails because
 123,456,789 is not a valid integer number.
 Is there a way to solve this?
 Thanks in advance!
 Marco


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



Re: wicket-security Custom Access Denied Page

2008-02-13 Thread Igor Vaynberg
stick that name into requestcycle's metadata, and pull it out in yoru
implementation of access denied page

-igor


On Feb 13, 2008 8:31 AM, Warren [EMAIL PROTECTED] wrote:
 I understand that, but what I want to do is create a message on that page
 that reads Users in group xxx do not have access to yyy where yyy would be
 the name of the principal that triggered the access denied. I need to get
 the name of that principal.


  -Original Message-
  From: Maurice Marrink [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, February 13, 2008 12:12 AM
  To: users@wicket.apache.org
  Subject: Re: wicket-security Custom Access Denied Page
 
 
  In the init of your webapp do
  getApplicationSettings().setAccessDeniedPage(MyPage.class)
 
  This is a wicket setting and not related to the security framework.
 
  Maurice
 
  On Feb 12, 2008 7:50 PM, Warren [EMAIL PROTECTED] wrote:
   How do you set-up a custom access denied page that has a message on it
   like Users in group xxx do not have access to yyy? I also want to have
   this page return to the previous page the user was on. I am using
   wicket-security (wasp and swarm).
  
   Thanks,
  
   Warren Bell
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


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



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



RE: different behaviour explorer/firefox windowclosedcallback

2008-02-13 Thread rik rik
Sorry for the code formatting in the mail... I rewrite it, because I've found 
another information that can be useful...
the code is this:
box.setWindowClosedCallback(new WindowClosedCallback() {  @Override  public 
void onClose(AjaxRequestTarget target) {if (ok){  try {
man.delete(dev);//this removes an item from panelGroupPanel newPanel = 
new GroupPanel();GroupPanel.this.replaceWith(newPanel); 
   target.addComponent(newPanel);  } catch 
(DeEException e) {error(e.getMessage());  }}  }});
 
The new information is that when I enable wicket-ajax-debug frame, using 
firefox there is this:
/span]]/component/ajax-responseINFO: Response parsed. Now invoking 
steps...INFO: Response processed successfully.INFO: Invoking post-call 
handler(s)...INFO: last focus id was not set
but using explorer there is this:
/span]]/component/ajax-responseERROR: Error while parsing response: 
Object requiredINFO: Invoking post-call handler(s)...INFO: Invoking failure 
handler(s)...
Which object is required? I hope that someone can make some similar attempts...
Thanks
 
Rik



 From: [EMAIL PROTECTED] To: users@wicket.apache.org Subject: different 
 behaviour explorer/firefox windowclosedcallback Date: Mon, 11 Feb 2008 
 11:36:56 +  Hi all, I'm using version 1.3.1 I have a ModalWindow and 
 in its method setWindowClosedCallback I pass a WindowClosedCallback and then 
 in its method onClose I replace a panel with another called newPanel and 
 finally I call target.addComponent(newPanel) The code follows  
 box.setWindowClosedCallback(new WindowClosedCallback() { @Override public 
 void onClose(AjaxRequestTarget target) { if (ok){ try { man.delete(dev); 
 //this call changes the panel GroupPanel newPanel = new GroupPanel(); 
 GroupPanel.this.replaceWith(newPanel); target.addComponent(newPanel); } catch 
 (Exception e) { error(e.getMessage()); } } } });  In firefox the code works 
 perfectly, but it does not in explorer, because the panel is not updated Has 
 anyone ever found this same problem? Thanks  Rik  
 _ Scarica 
 GRATIS la versione personalizzata MSN di Internet Explorer 7! 
 http://optimizedie7.msn.com/default.aspx?mkt=it-it
_
Scarica GRATIS le tue emoticon preferite!
http://intrattenimento.it.msn.com/emoticon/

RE: Extending DropDownChoice

2008-02-13 Thread Bruce
Thanks for the information Igor.  Reading now.

Bruce.
-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 13 February, 2008 12:22 AM
To: users@wicket.apache.org
Subject: Re: Extending DropDownChoice

give dropdownchoice a model, and in this model's setobject(object)
save the value into session. also check out the models page on the
wiki, it is important to understand/use models correctly.

-igor


On Feb 12, 2008 11:07 PM, Bruce McGuire [EMAIL PROTECTED] wrote:
 Hi.

 I would like to save the result of a DropDownChoice in my custom session.
 But, I am stumped about how to extend it. I had thought that I would
 @Override the getChoices and onSelectionChanged methods, but Eclipse tells
 me that The method onSelectionChanged(Pool) of type PoolSelect must
 override or implement a supertype method.

 I am stumped on how to extend this, or even if I should. Any pointers to
 tips or best practices would be greatly appreciated.

 In case it is not obvious from the question, I am new to Wicket (but
loving
 it so far).

 Thanks,

 Bruce.


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



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


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



Re: [WicketStuff-Scriptaculous] DragNDrop problem in IE6/IE7.

2008-02-13 Thread Edward Yakop
The reason why this might not work is when we have the following use case:
* We have many draggable target, and when somebody drop to one of the
location, containers that contained the other draggable targets are
also added to ajax request target. Once this happened, none of the
other draggable targets will work.
* The same thing also applies to Droppables, if the container of
droppables are added to the AjaxRequestTarget. These droppables will
no longer work too.

The way that this is fixed at my project is by forcing the user to use
my ajax request target.
I have a hook to ajax request target to listen when components are
added to ajax request target, and do necessary callback to allow the
behaviors to do something. In my case, usually called
Droppables.remove( $( markupId ) ), and for Draggables, since there's
no easy way to potentially need to re-initialize some but not all, I
have to iterate the Draggables.drag array and inovoke
Draggable#destroy.

I would think there probably a better way to handle this without
subclassing AjaxRequestTarget. Will come back to this later.

Regards,
Edward Yakop


On Feb 14, 2008 12:53 AM, Ryan Sonnek [EMAIL PROTECTED] wrote:
 Ok everyone, I think I have a fix checked in.  Before re-rendering the
 DraggableTarget on the Ajax response, I call the scriptaculous
 Droppables.remove() to cleanup the old reference.

 The wicketstuff-scriptaculous-example project should be able to test
 and verify this behavior.  If anyone has a spare browser that they can
 throw at it to see that it works, I'd appreciate it.

 Thank you *everyone* for your contributions.  I never would have
 noticed this issue without your help!

 On Feb 13, 2008 10:39 AM, Nino Saturnino Martinez Vazquez Wael
 [EMAIL PROTECTED] wrote:

  if you have an example running, i'll be happy to test on safari and
  ie6/7/ff ..
 
 
  Ryan Sonnek wrote:
   No, i haven't yet.  the problem for me is that I don't have an install
   of IE6/7 to test this out on.  I'd be happy to apply any patch that
   someone has that has been tested against IE6 and IE7 though.
  
   On Feb 13, 2008 12:54 AM, Edward Yakop [EMAIL PROTECTED] wrote:
  
   Hi,
  
   Thanx for the hints :)
   The problem is solved, but I'm not sure whether Ryan has patched the
   scriptaculous code in wicket-stuff svn.
  
   Regards,
   Edward Yakop
  
  
   On Feb 13, 2008 2:10 PM, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] 
   wrote:
  
   Don't know if it is the same issue but I have found  the same problem a
   while ago (refreshing a component via Ajax) and the problem was
   scriptaculous requires to clean up the Droppables  if an element was
   removed from the DOM tree. So, all I did was add a a clearAll
   (JavaScript) method  that delete all the Droppables. something like
  
   var Droppables = {
 drops: [],
  
 removeAll: function(element) {
   this.drops = [];
 },
  
   ..
  
   and then call it before any Ajax request that recreated the DOM tree. So
   that I could safely recreated my component and make them droppables
   again. This worked fine for IE7. For Firefox I never found those
   problems... There was a note on the web page explaining Droppables that
   suggested this idea...
  
   Hope this helps...
  
   Best,
  
   Ernesto
  
  
   Lan Boon Ping wrote:
  
   Hi,
  
   I have encountered a DragNDrop problem using wicketStuff-scriptaculous
   in IE6/IE7. The DragNDrop only work for the first time, but
   subsequently, the draggable object is no longer draggable. FYI, this
   problem doesn't exist in Firefox and it can be reproduced in
   wicket-contrib-scriptaculous-examples.
  
   Any hints?
  
   Thanks in advance.
  
   Regards
   Boon Ping.
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
  --
  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684
 
 
  -
 
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



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

Re: Odd behaviour after setGatherExtendedBrowserInfo(true)

2008-02-13 Thread Igor Vaynberg
ajax doesnt work because probably the ajax request is redirected to
that page...that page is what gathers all the browser info through
javascript...

please add a jira issue for this, we should detect if the request is
ajax and if it is not do the redirect to the browser detection page...

-igor


On Feb 13, 2008 5:04 AM, Cristi Manole [EMAIL PROTECTED] wrote:
 Hello,

 I wanned to be able to get the browser client size, so I followed the
 examples and put
 getRequestCycleSettings().setGatherExtendedBrowserInfo(true) in my
 Application init method.

 I can get the parameters without any problem, but now on the login page,
 after I submit, for a few seconds I get a page with a message If you see
 this, it means that both javascript and meta-refresh are not support by the
 browser configuration. Please click this link to continue to the
 original destination. Then I am automatically redirected.

 My problem here is that now *some ajax wicket components don't work ok when
 i first click then - i have to refresh that page*.

 I am certain this is due to extendedbrowserinfo.

 *What I want is for that info message NOT to appear and to understand what
 is happening and how i could make the links to work as before. *

 I'm using firefox with what's activated by default when installed.

 Tks in advance,
 Cristi


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



Re: Opening DynamicWebResource from Button/AjaxButton?

2008-02-13 Thread Igor Vaynberg
onsubmit() {
  getrequestcycle().setrequesttarget(new
redirectrequesttarget(urlfor(resourceref)));
}

-igor


On Feb 13, 2008 8:18 AM, UPBrandon [EMAIL PROTECTED] wrote:

 In a project I am working on, I wrote a DynamicWebResource that generates a
 PDF file and, by setting the Content-Disposition in the header, got it so
 that the user is prompted to download the PDF when they click on a
 ResourceLink to my PDF-generating resource.

 That all works fine but now I need to open the PDF from a button.  I want to
 allow the user to select a value in a form and press a button to view
 somewhat of a report for the item they selected.  However, there doesn't
 appear to be any type of button that would lead a user to my
 DynamicWebResource.  Is there any way to have a button do a submit (update
 the model) and then lead the user to a resource?

 -Brandon
 --
 View this message in context: 
 http://www.nabble.com/Opening-DynamicWebResource-from-Button-AjaxButton--tp15459841p15459841.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: How to Display List in DataTable

2008-02-13 Thread Igor Vaynberg
see ListDataProvider

-igor

On Feb 13, 2008 7:44 AM, wiki [EMAIL PROTECTED] wrote:

 Hi I have a little problem with displaying list inside datatable.
 I have a list of questions and each question has a list of answers.My design
 requirement is to  display one question per page(that's why used Data
 Provider) and within that page I have to display list of relevant answers.I
 have a java classes(User,Questionaire,Questions,Answers) User class has List
 of Questionaire and that(Questionaire) has list of questions Then Question
 class has a list of Answers.So from Lecturer  WebPage I can click a
 questionaire link to go to questionaire Page which display list of
 questionaire(using ListView).From questionaire I did manage to display
 Questions.Could anybody   know how to embed list in Data Table to display
 answers.

 Thanks

 public class ShowQuestions extends WebPage

 {

 //
 ///** Creates a new instance of ShowQuestions */
 //List questions=qaire.getMcssquestion();
 //ListView list=new ListView(questionaire,questions)
 //{
 //protected void populateItem(ListItem item)
 //{
 //final MCSSQuestion
 mcssquestion=(MCSSQuestion)item.getModelObject();
 //
 //item.setModel(new CompoundPropertyModel(mcssquestion));
 //item.add(new Label(questiontext));
 //item.add(new Label(questionaire.Title));
 //
 //
 //}
 //
 //};
 //add(list);
 //}
 public ShowQuestions(final Questionaire qaire)
 {

 SortableDataProvider provider= new SortableDataProvider()
 {
 // Return how many rows there are
 public int size()
 {
 return qaire.getMcssquestion().size();
 }
 // convert each row object as a model
 public IModel model(Object object)
 {
 MCSSQuestion mcss=(MCSSQuestion)object;
 return new Model((Serializable) mcss);
 }
 public Iterator iterator(int first, int count)
 {
 return qaire.selectEntries(first,count).iterator();
 }
 };
 IColumn[] columns= { new PropertyColumn(new
 Model(ID),questiontext)
 };

 DefaultDataTable datatable=new
 DefaultDataTable(eachentry,columns,provider,1);
 add(datatable);
 }

 --
 View this message in context: 
 http://www.nabble.com/How-to-Display-List-in-DataTable-tp15459611p15459611.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: working on my first wicket web 2.0 scriptaculos component

2008-02-13 Thread Igor Vaynberg
here is the list of things to try:

are there any javascript errors during callback?
try without encrypted coding strategy
set a break point in wicketfilter and see why it doesnt hit the behavior

-igor


On Feb 13, 2008 6:15 AM, Fernando Wermus [EMAIL PROTECTED] wrote:
 Hi all,
  I am working on rtying to reproduce this behavior
 http://wiki.script.aculo.us/scriptaculous/show/SortableListsDemo.
 Two sortable list which you can reorder de item in it a between them.
 This is the html generated by my component, but it seems
 not to work. It doesn't call the component back. I was reading on the
 net about some constrains in the ids and I think I apply to it.
 However, I am still in troubles. The dinamic part works, not the call back.

 div id=holder6 wicket:id=holder
 div class=node 
 ul id=firstlist7 wicket:id=firstlist
 li id=firstlistFirstlist_0 
 wicket:id=firstlistFirstlist
 span wicket:id=nombreLabela/span
 /lili id=firstlistFirstlist_1 
 wicket:id=firstlistFirstlist
 span wicket:id=nombreLabela/span

 /li
 /ul
 /div
 div class=node 
 ul id=secondlist8 wicket:id=secondlist
 li id=secondlistSecondlist_0 
 wicket:id=secondlistSecondlist
 span 
 wicket:id=nombreLabel2a/span
 /lili id=secondlistSecondlist_1 
 wicket:id=secondlistSecondlist

 span 
 wicket:id=nombreLabel2a/span
 /li
 /ul
 /div
 /div
 script type=text/javascript
 Sortable.create('firstlist7',
 {dropOnEmpty:true,containment:['firstlist7','secondlist8'],constraint:false},
 {
   onUpdate: function(element) {
 wicketAjaxGet('?x=6*%3A1%3Atabs%3Apanel%3Amensajes%3Apanel%3Aholder%3A1%3AIActivePageBehaviorListener%3A0%3A%26amp%3Bwicket%3AignoreIfNotActive%3Dtrue'
 + Sortable.serialize(element)); }
 }
 );
 Sortable.create('secondlist8',
 {dropOnEmpty:true,containment:['firstlist7','secondlist8'],constraint:false},
 {
   onUpdate: function(element) {
 wicketAjaxGet('?x=6*%3A1%3Atabs%3Apanel%3Amensajes%3Apanel%3Aholder%3A1%3AIActivePageBehaviorListener%3A0%3A%26amp%3Bwicket%3AignoreIfNotActive%3Dtrue'
 + Sortable.serialize(element)); }
 }
 );
 /script



 --
 Fernando Wermus.


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



Re: Harnessing Data From Components

2008-02-13 Thread Igor Vaynberg
yes

-igor


On Feb 13, 2008 1:49 AM, carloc [EMAIL PROTECTED] wrote:

 Thanks For The Reply,

 Rating Panel is not a FormComponent right? So am I correct in saying that
 the model gets updated during the Ajax Requests ? Cause every click on the
 button triggers an ajax request.

 Thanks



 igor.vaynberg wrote:
 
  or you can bind the model to a property, and then when a component is
  rendered it will use the value in that property, when it is submitted
  it will set the value to that property - that way it is all completely
  transparent.
 
  see PropertyModel, the wiki has a great page that explains how models
  work...
 
  -igor
 
 
  On Feb 12, 2008 7:02 AM, Maurice Marrink [EMAIL PROTECTED] wrote:
  Data in wicket components is wrapped in models.
  You can ask a component for its model: getModel() and then ask the
  model for its data: getObject().
  Or you can use the shortcut getModelObject() on a component.
  Setting data is done in a similar way.
 
  Maurice
 
 
  On Feb 12, 2008 3:11 PM, carloc [EMAIL PROTECTED] wrote:
  
   hi everyone,
  
   I would like to ask how I could actually get data from the different
   components in the wicket examples...
   For example in the YUI selection or in the RatingPanel...
  
   What will my code look like if I have a submit button and I want to
  know the
   rating?
   (e.g. how many stars were pressed)
  
   I can display the components properly but I can't get data from them...
   Same as with the other examples...
  
   What is the best way to do this?
   --
   View this message in context:
  http://www.nabble.com/Harnessing-Data-From-Components-tp15433918p15433918.html
   Sent from the Wicket - User mailing list archive at Nabble.com.
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context: 
 http://www.nabble.com/Harnessing-Data-From-Components-tp15433918p15452757.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Business/Domain objects used as wicket model object - opinions please

2008-02-13 Thread mfs

Guys,

I would want to know if using your business/domain objects as wicket models
would be a good idea ? 

i remember in an earlier thread i was suggested not to use business-objects
as wicket models, but it would want to hear more opinions..

Thanks in advance..
-- 
View this message in context: 
http://www.nabble.com/Business-Domain-objects-used-as-wicket-model-object---opinions-please-tp15462661p15462661.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Link to last accessed page

2008-02-13 Thread Warren
How do I create a link on a page that will go to the last accessed page no
matter what that page is? I see that WebPage has a method homePageLink. Is
there something simmilar that will return you to the last accessed page? I
also see that the class AccessStackPageMap has a method lastAccessedEntry(),
but I do not know how to get to that method from my page.

Thanks,

Warren


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



Re: Link to last accessed page

2008-02-13 Thread Jeremy Levy
You could just pass the current page to the new page via the constructor.

On Feb 13, 2008 2:06 PM, Warren [EMAIL PROTECTED] wrote:

 How do I create a link on a page that will go to the last accessed page no
 matter what that page is? I see that WebPage has a method homePageLink. Is
 there something simmilar that will return you to the last accessed page? I
 also see that the class AccessStackPageMap has a method
 lastAccessedEntry(),
 but I do not know how to get to that method from my page.

 Thanks,

 Warren


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




Re: Link to last accessed page

2008-02-13 Thread James Carman
How about using the breadcrumb component?  Would that help?

http://wicketstuff.org/wicket13/breadcrumb/

On 2/13/08, Warren [EMAIL PROTECTED] wrote:
 How do I create a link on a page that will go to the last accessed page no
 matter what that page is? I see that WebPage has a method homePageLink. Is
 there something simmilar that will return you to the last accessed page? I
 also see that the class AccessStackPageMap has a method lastAccessedEntry(),
 but I do not know how to get to that method from my page.

 Thanks,

 Warren


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



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



RE: wicket-security Custom Access Denied Page

2008-02-13 Thread Warren
I have started implementing your sugestions and I have a question. When I
overide the method createHive() in PolicyFileHiveFactory do I need to set
useHiveCache(true) if I am extending SimpleCachingHive.

public Hive createHive()
{
// Do I need to do this
super.useHiveCache(true);
BasicHive hive = new MySimpleCachingHive();
...
}

Or should I set this method in my app after I create the factory.

MyPolicyFileHiveFactory factory = new MyPolicyFileHiveFactory();
factory.useHiveCache(true);

Or should I even worry about this?


 -Original Message-
 From: Warren [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 13, 2008 4:30 PM
 To: users@wicket.apache.org
 Subject: RE: wicket-security Custom Access Denied Page


 I think I am following your example correctly. What I will end up with is
 the names of one or more principals that have the permission that was
 denied. Those one or more principals will not belong to the
 current subject.
 Then I can use the names of those principals to construct a message. You
 could end up with a permission that does not belong to any
 principal. Strike
 that, that would mean that no one would be able to access that
 component. I
 will give this a try. I am sure I will have more questions.

 Thanks,

  -Original Message-
  From: Maurice Marrink [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, February 13, 2008 2:56 PM
  To: users@wicket.apache.org
  Subject: Re: wicket-security Custom Access Denied Page
 
 
  It actually is a bit more trickier then that.
  Swarm does not check for principals it checks for permissions.
  The same permission might be shared by multiple principals.
  To get that information you need to dig deep.
  You can't wait for the wicket UnAuthorizedActionException since all it
  will tell you is the component and what wicket action was not
  authorized (although if you have a really simple policy you might
  figure it out with this information).
  Swarm can tell you, but truthfull the api lacks in that area, i'll see
  if i can fix this for 1.3.1.
 
  For now your best bet is probably to Subclass SwarmStrategy, override
  hasPermission(Permission). Most checks use this method but it is
  always possible for a custom ISecurityCheck to bypass this.
  public boolean hasPermission(Permission p)
  {
   if(!super.hasPermission(p)
   {
//now we now the permission and we can find out which
 principals have it
//since the hive api does not give that info we need to use a custom
  hive, more on that later
//for now do something like getHive().getPrincipals(p);
//then we need to get the subject and check if it has any of those
  principals, the one (or more) that are missing are the one(s) we are
  interested in
//use getSubject().getPrincipals()
//store those principals somewhere in the requestcycle
return false;
   }
   return true;
  }
  In order to use this new Strategy you need to extend
  SwarmStrategyFactory and overide newStrategy to return your subclass.
  Then you need to override setupStrategyFactory in your application to
  do setStrategyFactory(new MySwarmStrategyFactory(getHiveKey()));
 
  Next we need to extend our hive so we can ask it which principals
  belong to which permission (offcourse the hive already has this
  information but you can not access it)
  If you are using 1.3.0 rc1 you are probably using the
  SimpleCachingHive, extend it and override 2 methods
  addPrincipal(Principal , Collection ) and addPermission(Principal ,
  Permission )
  to record which principal has which permissions you can use a
  ManyToManyMap for this, it is also used internally the information
  recorded can then be exposed in a method like public SetPrincipal
  getPrincipals(Permission)
  This will duplicate all recordings but your other option is to copy
  BasicHive and SimpleCachingHive entirely and create the getPrincipals
  method.
 
  Either way you will need to use this new hive and to do that we need
  to extend PolicyFileHiveFactory (or SwarmPolicyFileHiveFactory if you
  are using the latest 1.3-snapshots), override the createHive() method.
  You can pretty much copy everything from PolicyFileHiveFactory except
  for the first 5 lines you need to create your own hive there. Also
  while copying you will run into a few private variables but you should
  be able to replace those with there getters (although i might have
  missed some, if that is the case you have to copy the entire class).
  In your application's setupHive method you are already creating the
  hivefactory, simply replace it with this custom one.
 
  And that should do the trick. Sorry the api is not more accommodating
  to your needs i'll see if i can make some improvements anytime soon
  for the 1.3-snapshot (1.3.1), but i also have to release 1.3.0 final
  sometime soon.
 
  Maurice
 
  P.S. i did not cover the part about providing the application with
  your own 

Re: Generating static website

2008-02-13 Thread Igor Vaynberg
there is a switch in DiffUtil somewhere, a system arg you define.

-igor

On Wed, Feb 13, 2008 at 10:29 PM, Martijn Dashorst
[EMAIL PROTECTED] wrote:
 WicketTester knows how to generate all files for unit tests. I don't
  know the how from the top of my head.

  Martijn



  On 2/14/08, David Leangen [EMAIL PROTECTED] wrote:
  
Hello.
  
I've tried searching, so please excuse me if this question has already
been asked. I will add the answer to this on the wiki...
  
  
I would like to develop a static site with Wicket, then save the static
html files on the file system.
  
  
I can think of lots of ways to do this, but is there already a script
out there than can do this for me?
  
  
Thank you!
  
  
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  


  --
  Buy Wicket in Action: http://manning.com/dashorst
  Apache Wicket 1.3.1 is released
  Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1



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



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



Re: Business/Domain objects used as wicket model object - opinions please

2008-02-13 Thread Jonathan Locke


I always wrap my domain objects in a generic loadable detachable wicket
model subclass.  So for User, for example, UserModel extends
MyGenericDetachableModelUser.  This is safer than passing around raw
IModels and also saves casting the return value from getObject() until
Wicket 1.4 generifies everything.  But even in the generic future I find
UserModel a bit nicer than IModelUser.  Furthermore, a detachable model
subclass is a great place to attach DAO functionality (using that locator
idea I blogged about, even).


mfs wrote:
 
 Guys,
 
 I would want to know if using your business/domain objects as wicket
 models would be a good idea ? 
 
 i remember in an earlier thread i was suggested not to use
 business-objects as wicket models, but it would want to hear more
 opinions..
 
 Thanks in advance..
 

-- 
View this message in context: 
http://www.nabble.com/Business-Domain-objects-used-as-wicket-model-object---opinions-please-tp15462661p15475231.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: wicket-security Custom Access Denied Page

2008-02-13 Thread Maurice Marrink
Use cache is default true (i think by the constructor but i don't have
the code with me right now)

So you don't have to worry about that.

Maurice

On Thu, Feb 14, 2008 at 4:04 AM, Warren [EMAIL PROTECTED] wrote:
 I have started implementing your sugestions and I have a question. When I
  overide the method createHive() in PolicyFileHiveFactory do I need to set
  useHiveCache(true) if I am extending SimpleCachingHive.

 public Hive createHive()
 {
 // Do I need to do this
 super.useHiveCache(true);
 BasicHive hive = new MySimpleCachingHive();
 ...
 }

  Or should I set this method in my app after I create the factory.

  MyPolicyFileHiveFactory factory = new MyPolicyFileHiveFactory();
  factory.useHiveCache(true);

  Or should I even worry about this?



   -Original Message-
   From: Warren [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, February 13, 2008 4:30 PM
   To: users@wicket.apache.org


  Subject: RE: wicket-security Custom Access Denied Page
  
  
   I think I am following your example correctly. What I will end up with is
   the names of one or more principals that have the permission that was
   denied. Those one or more principals will not belong to the
   current subject.
   Then I can use the names of those principals to construct a message. You
   could end up with a permission that does not belong to any
   principal. Strike
   that, that would mean that no one would be able to access that
   component. I
   will give this a try. I am sure I will have more questions.
  
   Thanks,
  
-Original Message-
From: Maurice Marrink [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 13, 2008 2:56 PM
To: users@wicket.apache.org
Subject: Re: wicket-security Custom Access Denied Page
   
   
It actually is a bit more trickier then that.
Swarm does not check for principals it checks for permissions.
The same permission might be shared by multiple principals.
To get that information you need to dig deep.
You can't wait for the wicket UnAuthorizedActionException since all it
will tell you is the component and what wicket action was not
authorized (although if you have a really simple policy you might
figure it out with this information).
Swarm can tell you, but truthfull the api lacks in that area, i'll see
if i can fix this for 1.3.1.
   
For now your best bet is probably to Subclass SwarmStrategy, override
hasPermission(Permission). Most checks use this method but it is
always possible for a custom ISecurityCheck to bypass this.
public boolean hasPermission(Permission p)
{
 if(!super.hasPermission(p)
 {
  //now we now the permission and we can find out which
   principals have it
  //since the hive api does not give that info we need to use a custom
hive, more on that later
  //for now do something like getHive().getPrincipals(p);
  //then we need to get the subject and check if it has any of those
principals, the one (or more) that are missing are the one(s) we are
interested in
  //use getSubject().getPrincipals()
  //store those principals somewhere in the requestcycle
  return false;
 }
 return true;
}
In order to use this new Strategy you need to extend
SwarmStrategyFactory and overide newStrategy to return your subclass.
Then you need to override setupStrategyFactory in your application to
do setStrategyFactory(new MySwarmStrategyFactory(getHiveKey()));
   
Next we need to extend our hive so we can ask it which principals
belong to which permission (offcourse the hive already has this
information but you can not access it)
If you are using 1.3.0 rc1 you are probably using the
SimpleCachingHive, extend it and override 2 methods
addPrincipal(Principal , Collection ) and addPermission(Principal ,
Permission )
to record which principal has which permissions you can use a
ManyToManyMap for this, it is also used internally the information
recorded can then be exposed in a method like public SetPrincipal
getPrincipals(Permission)
This will duplicate all recordings but your other option is to copy
BasicHive and SimpleCachingHive entirely and create the getPrincipals
method.
   
Either way you will need to use this new hive and to do that we need
to extend PolicyFileHiveFactory (or SwarmPolicyFileHiveFactory if you
are using the latest 1.3-snapshots), override the createHive() method.
You can pretty much copy everything from PolicyFileHiveFactory except
for the first 5 lines you need to create your own hive there. Also
while copying you will run into a few private variables but you should
be able to replace those with there getters (although i might have
missed some, if that is the case you have to copy the entire class).
In your application's setupHive