Re: How to build a hudson/jenkins like live log viewer?

2011-11-21 Thread James
Thanks everybody. I finally managed to display the content of an active log
file.

As mentioned in the earlier responses, all you need is two labels.

*Markup*:

div id=logData wicket:id=logData/div
div id=nextLog wicket:id=nextLog/div

*Java*:

Create the logData label as you would normally create labels and load the
content of the log file.

Something like this:

private MultiLineLabel createLogData()
{
return new MultiLineLabel(logData, new
LoadableDetachableModelObject()
{
@Override
protected Object load()
{
   try{
return FileUtils.readFiletoString(file);
   }catch(Exception ex){}
   return ;
}
});
}

And now the interesting component nextLog. It might look something like
this:

private Label createNextLog()
{
Label nextLog = new Label(nextLog, new
LoadableDetachableModelObject()
{
@Override
protected Object load()
{
//use a tailing api like Tailer in commons-io or may be
just java.io.RandomAccessFile?
return your 'tail' content goes here;
}
}){

// This is needed because, wicket created dynamic ids for the
nextLog component
@Override
public String getMarkupId(boolean createIfDoesNotExist)
{
return nextLog;
}
};
nextLog.add(new
AjaxSelfUpdatingTimerBehavior(Duration.seconds(REFRESH_INTERVAL))
{
@Override
protected void onPostProcessTarget(AjaxRequestTarget target)
{

   /*
* We are doing the following here:
*   - append the content of nextLog to logData
*   - remove nextLog
*   - insert nextLog after logData.
*/
target.appendJavascript(
$('#logData').append('p' + $('#nextLog').text()
+ '/p'); +
$('#nextLog').remove(); +
$(\div
id='nextLog'\).insertAfter($('#logData')););
}
});
nextLog.setOutputMarkupId(true);
return nextLog;
}

Thank you once again for each and everyone who took their time to give your
thoughts/suggestions. They were precious and I learned a lot by merely
interacting with this wonderful community.

On Mon, Nov 21, 2011 at 1:53 PM, James james.eliye...@gmail.com wrote:

 Thanks Igor. You simplified it to the maximum.
 On Nov 21, 2011 1:36 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:

 a much simplified version:

 div wicket:id=logDatalog contents/div
 div wicket:id=nextLognext log call/div

 no panel needed. add self-updating behavior to next log call and in
 the callback also add

 target.appendjavascript( $('#logdata).append($('#nextlog).content());
 $('#nextlog').remove(); $('#logdata).insertafter($('div
 id='nextlog')); )

 im paraphrasing jquery here, but the is that you repaint the nextog
 div and add javascript that after the repaint you move its contents to
 the logdata div, and then empty the nextlog div. of course the nextlog
 div should be hidden via css

 -igor


 On Sun, Nov 20, 2011 at 7:46 PM, Clint Checketts checke...@gmail.com
 wrote:
  I'd need to look at Tailer to see how it operates. But here is how I'd
 try
  it (it is quick and I don't like the markup, but we'll optimize it
 later:
 
  Create a panel that looks like so (we'll call it LoggingPanel):
 
  wicket:panel
  div wicket:id=logDatalog contents/div
  div wicket:id=nextLognext log call/div
  /wicket:panel
 
  Add a self updating timer behavior so the panel check the Tailer for
  output, if there is data, then update the logData label with it, make
 the
  nextLog component be another LoggingPanel with a
 SelfUpdatingTImerBehavior,
  and stop the timerbehavior on the current panel.
 
  Drawbacks are: the divs keep getting nested, so the markup isn't the
 most
  beautiful, so setRenderBodyOnly(true) might make it nicer.
 
  -Clint
 
  On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com
 wrote:
 
  Thanks Steve. I'll look into the commons-io Tailer.
  But any idea on how to use this with wicket?
 
  On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg 
  steve.swinsb...@gmail.com
   wrote:
 
   I've done something similar to this using the Tailer class from
  commons-io.
  
   cheers,
   Steve
  
  
   On 21/11/2011, at 12:59 PM, James wrote:
  
Dear wicket community,
   
In a project that I'm working on, I need to build a live log
 viewer
  or
dynamic log viewer or refreshable log viewer.
Much like how hudson/jenkins displays the console output.
   
The idea is to dynamically display the new data added to a log file
  along
with the existing content.
   
How to go about doing this? Please throw some light on this.
   
I searched about this in the web, mailing lists but couldn't 

Re: Button with 3 images and issues

2011-11-21 Thread D0m3
Oh sorry, on the forum I used the raw tag and it looks good. What should I
actually use ?
I added spaces, hope it works.



Hello everybody,
I am starting a wicket project for the first time, and I created a button
made of 3 images with html css. Here is my html :

 button class=buttonLeft
   span class=buttonRight
 span class=buttonMid
  my text
 /span
   /span
 /button

I want this button to be disableable. In Java, I only declare 1 AjaxButton,
which is linked to the button tag. When I use setEnabled(false), it only
adds the disabled tag to the button tag. I would need to add the disabled
tag to the 2 other spans.
While searching for an answer, I realized I could either create a custom
component or add a behavior to automatically add the markup necessary to
create this button. Thus, in my html I would only write :

 button wicket:id=myId
   wicket:message key=button.text /wicket:message
 /button

And all the class and span stuff would be added by wicket.
However I have no idea how to do that. beforeRender and afterRender add
markup before and after if I understood correctly, and onComponentTag adds
attributes.
It would be great if you could provide links or hints on how to do that.
Thanks in advance.

Florian

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Button-with-3-images-and-issues-tp4082830p4090888.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: unit testing cookies after redirect

2011-11-21 Thread Martin Grigorov
Hi,

I have also noticed that once but didn't have time to investigate it
further and later I forgot about it ...
Can you create a simple quickstart and attach it to Jira.

On Sun, Nov 20, 2011 at 10:41 PM, kamiseq kami...@gmail.com wrote:
 hej,
 well I tried to follow the cookies in wicket tester.

 starting from the beginning I have page A that while constructing adds new
 cookie to response and throws (as Martin advised) ReplaceHandlerException
 pointing to page B.
 everything goes well and cookies are carried inside original response until
 BaseWicketTester.processRequest(forcedRequest, forcedRequestHandler,
 redirect) - setupNextRequestCycle()

 were new request and new response is created and my cookies info is gone :/
 I guess that cookies from last response should be rewritten to new request,
 right??

 I a bit confused how this works here, I have problems with cooking when Im
 testing it inside jetty so maybe this is something on my side only :/

 any ideas?

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __


 On 9 November 2011 15:01, kamiseq kami...@gmail.com wrote:

 so if this is the last line in my code those two approaches are pretty the
 same

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: AjaxEditableLabel inside of AjaxEditableLabel

2011-11-21 Thread Martin Grigorov
See jQuery#stopPropagation()

On Sun, Nov 20, 2011 at 8:02 PM, Alec Swan alecs...@gmail.com wrote:
 Anybody can help with stopping propagation of events from inner
 editable label to the outer editable label?

 Thanks

 On Fri, Nov 18, 2011 at 3:45 PM, Alec Swan alecs...@gmail.com wrote:
 I am not sure how to stop propagating the event. Could you please
 provide any pointers?

 Here is the relevant code:

 final String keypress = var kc=wicketKeyCode(event); if (kc==27)  +
 cancelCall +
                                 else if (kc!=13) { return true; } else  + 
 saveCall;

 tag.put(onblur, saveCall);
 tag.put(onkeypress, if (Wicket.Browser.isSafari()) { return; };  +
 keypress);
 tag.put(onkeydown, if (!Wicket.Browser.isSafari()) { return; };  +
 keypress);


 On Fri, Nov 18, 2011 at 12:32 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 You'll need to stop the propagation of the event.
 To do that you'll have to override
 org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel.EditorAjaxBehavior.onComponentTag(ComponentTag)

 On Fri, Nov 18, 2011 at 7:48 AM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I have two AjaxEditableLabel components. I use jQuery to place one
 component inside of another when the user views the page. The problem
 is that when the user clicks inside of the inner AjaxEditableLabel it
 goes into edit mode but right after that the outer AjaxEditableLabel
 goes into edit mode.

 How can I prevent the outer AjaxEditableLabel from going into edit mode?

 Thanks,

 Alec

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





 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: URL with root parameters

2011-11-21 Thread Per Newgro
I don't understand the first part of your problem. How do you use the 
images. In other pages? Located in markup?

Some code could really be useful here.

On the second part: How do you call the page? Do you provide the page 
parameters of anchor to constructed page?

Some code could really be useful here to.

Cheers
Per

Am 20.11.2011 23:12, schrieb intmanch:

Hi,

I'm developing an application that uses a parameter on the root url like
this: /param under Wicket 1.5

I mount it like this: mountPage(/${a}, HomePage.class); but my problem
is that then all the resources, images, etc. that I use are not loaded
because I always arrive to the root HomePage code. So I'm force to place my
resources in an external server. Is there another way to do this? Second
point, when I go from my HomePage to other pages the parameters are
displayed, is there a way to hide them?

 Thanks!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/URL-with-root-parameters-tp4089764p4089764.html
Sent from the Users forum mailing list archive at Nabble.com.

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





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



Re: RestartResponseAtInterceptPageException from onClick

2011-11-21 Thread kamiseq
ok thanks for quick replay,

I think there should be more info in javadoc about the intension fo the
exception and continueToOriginalDestination method

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


On 21 November 2011 03:40, Bertrand Guay-Paquet ber...@step.polymtl.cawrote:

 Hi,

 If you need a reference to the referrer, you could simply store the
 current page's PageReference which is available with
 getPage().getPageReference(). Then use setResponsePage(SignInPage.**class)
 to go to the login page. PageReference is a serializable id that can later
 be used in your login form submit method with setResponsePage(pageRef.**
 getPage());

 There is no need for using the exception mechanism for this. Storing in
 the session means that multiple tabs won't work. You might want to send the
 pageRef directly as a parameter to the SignInPage constructor instead, but
 it will make your page stateful.

 Bertrand


 On 20/11/2011 5:59 PM, kamiseq wrote:

 hej,
 I'm just looking form clarification on
 RestartResponseAtInterceptPage**Exception and
 continueToOriginalDestination(**).

 On every page I have a log-in link, and after log in I should be
 redirected
 back to the original destination. I use oauth api that requires that I
 redirect user to external url and then user will be redirected back to my
 service.
 In handler for onClick i have

 new RestartResponseAtInterceptPage**Exception(MainPage.class);
 throw new RedirectToUrlException(url);

 intercept page does not matter as I do not throw the exception I just save
 InterceptData in session so next time I call
 continueToOriginalDestination(**) this data will be used.

 the only problem is that while saving (from
 RestartResponseAtInterceptPage**Exception.InterceptData)

 Request request = RequestCycle.get().getRequest(**);
 data.originalUrl = request.getOriginalUrl();

 originalUrl point to onClick callback and then app loops.

 I could of course save page instance and then redirect to it, but this is
 reinventing the mechanism that wicket already provides, isn't it?
 I know that RestartResponseAtInterceptPage**Exception is used with
 accessing
 protected resources with IUnauthorizedComponentInstanti**ationListener
 and
 then url always points to page and not to handler.

 thanks for any comment on that

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __


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




Re: unit testing cookies after redirect

2011-11-21 Thread kamiseq
ok I ll do it this week

thanks

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


On 21 November 2011 09:52, Martin Grigorov mgrigo...@apache.org wrote:

 Hi,

 I have also noticed that once but didn't have time to investigate it
 further and later I forgot about it ...
 Can you create a simple quickstart and attach it to Jira.

 On Sun, Nov 20, 2011 at 10:41 PM, kamiseq kami...@gmail.com wrote:
  hej,
  well I tried to follow the cookies in wicket tester.
 
  starting from the beginning I have page A that while constructing adds
 new
  cookie to response and throws (as Martin advised) ReplaceHandlerException
  pointing to page B.
  everything goes well and cookies are carried inside original response
 until
  BaseWicketTester.processRequest(forcedRequest, forcedRequestHandler,
  redirect) - setupNextRequestCycle()
 
  were new request and new response is created and my cookies info is gone
 :/
  I guess that cookies from last response should be rewritten to new
 request,
  right??
 
  I a bit confused how this works here, I have problems with cooking when
 Im
  testing it inside jetty so maybe this is something on my side only :/
 
  any ideas?
 
  pozdrawiam
  Paweł Kamiński
 
  kami...@gmail.com
  pkaminski@gmail.com
  __
 
 
  On 9 November 2011 15:01, kamiseq kami...@gmail.com wrote:
 
  so if this is the last line in my code those two approaches are pretty
 the
  same
 
  pozdrawiam
  Paweł Kamiński
 
  kami...@gmail.com
  pkaminski@gmail.com
  __
 
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




Difference b/w SetoutputMarkupId(true) and SetOutputMarkupHolderTag(true?)

2011-11-21 Thread raju.ch
Can anyone tell me the difference b/w SetoutputMarkupId(true) and
SetOutputMarkupHolderTag(true)?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Difference-b-w-SetoutputMarkupId-true-and-SetOutputMarkupHolderTag-true-tp4091035p4091035.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: URL with root parameters

2011-11-21 Thread intmanch
This is the head of my HomePage.html:

html class=ui-mobile
 head
  titletagmagic.com/title
link rel=stylesheet
href=http://www.server.com/acn/site/css/jquery.mobile-1.0a3.min.css; /


 /head

As you can see I've to point the css and js to an external url as if I put
it as a resource in the java package is never loaded. 

For the second part this is the code more or less:

HomePage.java

final PageParameters pp = new PageParameters();
pp.set(campaign, url, 0);
pp.set(box, b.getId(), 1);
Link link = new LinkVoid(linkbox) {
@Override
 public void onClick() {
  setResponsePage(new FeedbackBoxPage(pp));
 }
};

In Application.java

 mountPage(/feedback/, FeedbackBoxPage.class);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/URL-with-root-parameters-tp4089764p4091048.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Difference b/w SetoutputMarkupId(true) and SetOutputMarkupHolderTag(true?)

2011-11-21 Thread Matthias Keller

Hi

setOutputMarkupId sets the id attribute of the HTML tag. This 
generally must be set if the tag shall be updated by AJAX
setOutputMarkupPlaceholderTag has the effect that a *hidden* component 
is still added to the HTML tree but - hidden. This is used, if the 
component is initially not visible (isVisible() == false) and would 
normally not leave a trace in the generated HTML file, thus it cannot be 
set visible by AJAX since it doesn't have a 'handle' to it. So it 
generally must be set to true if the component is to be updated by AJAX 
but is NOT initially visible.


Matt

On 2011-11-21 10:38, raju.ch wrote:

Can anyone tell me the difference b/w SetoutputMarkupId(true) and
SetOutputMarkupHolderTag(true)?




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Difference b/w SetoutputMarkupId(true) and SetOutputMarkupHolderTag(true?)

2011-11-21 Thread Ernesto Reinaldo Barreiro
setOutputMarkupHolderTag(true) is there for the use case where you
want to place an empty element (e.g. an empty div with an ID
assigned to it)  and later on replace it, via AJAX, with real
contents. E.g.

final WebMarkupContainer div = new WebMarkupContainer(div);
 div.setVisible(false);
 div.setOutputMarkupHolderTag(true);
 // contents added to div

will place a

div id=generatedId style=display:none;/div

later on via AJAX you could do

onClick(AjaxRequestTarget target) {
 div.setVisible(true);
 target.add(div);
}

which will produce

div id=generatedIdContents here/div

Regards,

Ernesto

On Mon, Nov 21, 2011 at 10:38 AM, raju.ch raju.challagun...@gmail.com wrote:
 Can anyone tell me the difference b/w SetoutputMarkupId(true) and
 SetOutputMarkupHolderTag(true)?

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Difference-b-w-SetoutputMarkupId-true-and-SetOutputMarkupHolderTag-true-tp4091035p4091035.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: URL with root parameters

2011-11-21 Thread Per Newgro
For the first point: What is the goal? Load the css from external url or 
put it in the application?
The first should work with the link you've provided. If you want to load 
the css from within

the application you have to do some more.

First you have to introduce your css-resouce to the application:
YourApplication.java
  protected void init() {
super.init();
mountResource(acn/site/css/jquery.mobile-1.0a3.min.css, new 
PackageResourceReference(getClass(), res/js/jquery.mobile-1.0a3.min.css));

  }
/YourApplication.java

Hint: You can give the resource key a name not depending on version
(mountResource(acn/site/css/jquery.mobile.css, new 
PackageResourceReference(getClass(), 
res/js/jquery.mobile-1.0a3.min.css));)


Then you have to add the css to your page
YourPage.java
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);

response.renderCSSReference(acn/site/css/jquery.mobile-1.0a3.min.css, 
screen);

}
/YourPage.java

Hint: You don't need the stylesheet-link in markup anymore.

For the second point:
Hiding the parameters is not possible. You could set the parameters to 
the session or store them in a database.
So you could extract them on the other side. Would be interessting to 
get the cause of your requirement (Don't show the parameters)


Cheers
Per

Am 21.11.2011 10:44, schrieb intmanch:

This is the head of my HomePage.html:

html class=ui-mobile
  head
   titletagmagic.com/title
link rel=stylesheet
href=http://www.server.com/acn/site/css/jquery.mobile-1.0a3.min.css; /


  /head

As you can see I've to point the css and js to an external url as if I put
it as a resource in the java package is never loaded.

For the second part this is the code more or less:

HomePage.java

final PageParameters pp = new PageParameters();
pp.set(campaign, url, 0);
pp.set(box, b.getId(), 1);
Link link = new LinkVoid(linkbox) {
 @Override
  public void onClick() {
   setResponsePage(new FeedbackBoxPage(pp));
  }
};

In Application.java

  mountPage(/feedback/, FeedbackBoxPage.class);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/URL-with-root-parameters-tp4089764p4091048.html
Sent from the Users forum mailing list archive at Nabble.com.

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





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



Re: Difference b/w SetoutputMarkupId(true) and SetOutputMarkupHolderTag(true?)

2011-11-21 Thread raju.ch
Thank you very much

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Difference-b-w-SetoutputMarkupId-true-and-SetOutputMarkupHolderTag-true-tp4091035p4091182.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Difference b/w SetoutputMarkupId(true) and SetOutputMarkupHolderTag(true?)

2011-11-21 Thread raju.ch
Thank you very much

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Difference-b-w-SetoutputMarkupId-true-and-SetOutputMarkupHolderTag-true-tp4091035p4091183.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Problem with check / uncheck all using CheckGroupSelector

2011-11-21 Thread massizigao
Hello Carl-Eric,

Thank you for your answer. I already tried the 1) approch. The problem is
that the check and uncheck all is working, but the Set of the selected
values (selectedValues) is not getting populated.
When i use the CheckBox/AjaxCheckBox class the check and uncheck all does
not work but the Set (selectedValues) is populated.

Thank you for any hint!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-check-uncheck-all-using-CheckGroupSelector-tp4083663p4091287.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Can't Reset Form After DropDownChoice OnChange Handled

2011-11-21 Thread Richard W. Adams
The form just has a standard HTML reset button:

input wicket:id=reset-button  type=reset  value=Reset  /

There's no special code associated with the button. Should there be? I 
looked at Wicket in Action, but it doesn't seem to address this issue.

RAM /abr./: Rarely Adequate Memory. 



From:   Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org
Date:   11/17/2011 03:42 PM
Subject:Re: Can't Reset Form After DropDownChoice OnChange Handled



what does your reset code look like?

-igor

On Thu, Nov 17, 2011 at 9:00 AM, aksarben rwada...@up.com wrote:
 I have a drop down choice component, and when the selection changes, I 
udpate
 various form fields by Ajax, in the form as follows:

 *public HistoryDropDown(final String id, final MapK, ? map, final
 Component dateField, final
TrackDetailModel model, final TrackAttribute attribute) {

super(id, map);
final String originalValue = model.getOriginalValue(attribute);
add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = -1;
@Override
protected void onUpdate(final AjaxRequestTarget target) { 
  // When
 selection changes

final String newValue = 
model.getAttributeValue(attribute); // What the
 new choice?
if (newValue.equals(originalValue)) { 
  // If back to original value
dateField.setEnabled(false); 
   // Disable date field
   
 model.restoreOriginalDateAndUser(attribute);// 
Restore original data
} else { 
   // If 
changing to new value
dateField.setEnabled(true);   
  // Enable date field
model.setDefaultDateAndUser(attribute);   
  // Effective date = today
} 
  // 
User = current user
target.addComponent(dateField.getParent());   
  // Re-render fields
}
});
 }
 *
 The updates work fine (the screen re-renders properly), but if I then 
click
 the form's Reset button, nothing happens. I saw some other posts that 
said I
 have to do a form.modelchanged(), but that didn't any effect.

 --
 View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Can-t-Reset-Form-After-DropDownChoice-OnChange-Handled-tp4080685p4080685.html

 Sent from the Users forum mailing list archive at Nabble.com.

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



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




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Models in a FormComponentPanel

2011-11-21 Thread Martin Grigorov
Hi,

See org.apache.wicket.extensions.yui.calendar.DateTimeField.convertInput()
for example

On Mon, Nov 21, 2011 at 5:20 AM, infiniter infini...@gmail.com wrote:
 I've created a FormComponentPanel to represent the current time which
 consists of 3 drop downs for hour and minute and meridiem.
 The model object of the FormComponentPanel is a Date object and the model of
 the drop down represents the selected option, but I need to change the model
 object in my component according to the options chosen from the drop downs.
 How can I do that?








 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Models-in-a-FormComponentPanel-tp4090377p4090377.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



What's replaced org.apache.wicket.request.target.basic.URIRequestTargetUrlCodingStrategy in 1.5?

2011-11-21 Thread Richard Care

Hi Wicketeers,

I want to capture requests to sub-pagesof a specific URL (e.g. 
http://host/root-page/42 as a sub-page of http://host/root-page/) and 
then respond with XML that's based on the current state of the site and 
the tail of the URL (e.g. 42)


I've used URIRequestTargetUrlCodingStrategy as demonstrated in 
http://wicketstuff.org/wicket14/staticpages/but (as with many other 
classes) this has moved/disappeared in Wicket 1.5.


I haven't found any mention of this class in 
https://cwiki.apache.org/WICKET/migration-to-wicket-15.htmland the 
staticpages example above has disappeared from 
http://wicketstuff.org/wicket/index.html


The migration notes do mention 
org.apache.wicket.request.target.coding.QueryStringUrlCodingStrategy so 
it looks like AbstractRequestTargetUrlCodingStrategy has been replaced 
by IRequestHandler and its implementations. As mount() now only takes an 
IRequestMapper I assumes that is also relevant but I would really 
appreciate a pointer as to which of the many classes implementing 
IRequestHandler and IRequestMapper to use.


Thanks in advance.

Regards Richard Care


Re: What's replaced org.apache.wicket.request.target.basic.URIRequestTargetUrlCodingStrategy in 1.5?

2011-11-21 Thread Martin Grigorov
Hi,

**UrlCodingStrategy interface and all its impls were replaced with
IRequestMapper and its impls.
These examples weren't migrated mostly because there were no tests for them.

Read http://wicketinaction.com/2011/07/wicket-1-5-request-mapper/ and
the next two articles for more about IRequestMapper and Co.

Check also https://issues.apache.org/jira/browse/WICKET-4228. This
ticket is a contribution by a user that migrates
CapturingUrlCodingStrategy from the same examples to 1.5. Use it as
inspiration.

The easiest way to see what the new IRequestMapper impls can do is by
checking their unit tests.
I think IRequestMapper is much simpler than IUrlCodingStrategy and it
shouldn't be very hard to implement what you need.

On Mon, Nov 21, 2011 at 4:58 PM, Richard Care
rich...@octaveassociates.co.uk wrote:
 Hi Wicketeers,

 I want to capture requests to sub-pagesof a specific URL (e.g.
 http://host/root-page/42 as a sub-page of http://host/root-page/) and then
 respond with XML that's based on the current state of the site and the tail
 of the URL (e.g. 42)

 I've used URIRequestTargetUrlCodingStrategy as demonstrated in
 http://wicketstuff.org/wicket14/staticpages/but (as with many other classes)
 this has moved/disappeared in Wicket 1.5.

 I haven't found any mention of this class in
 https://cwiki.apache.org/WICKET/migration-to-wicket-15.htmland the
 staticpages example above has disappeared from
 http://wicketstuff.org/wicket/index.html

 The migration notes do mention
 org.apache.wicket.request.target.coding.QueryStringUrlCodingStrategy so it
 looks like AbstractRequestTargetUrlCodingStrategy has been replaced by
 IRequestHandler and its implementations. As mount() now only takes an
 IRequestMapper I assumes that is also relevant but I would really appreciate
 a pointer as to which of the many classes implementing IRequestHandler and
 IRequestMapper to use.

 Thanks in advance.

 Regards Richard Care




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Models in a FormComponentPanel

2011-11-21 Thread infiniter
I cannot replace it at this point of the development... I just need to able
to get accurate date from its model object. Also I really want to learn how
to accomplish this.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Models-in-a-FormComponentPanel-tp4090377p4091990.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Problem with check / uncheck all using CheckGroupSelector

2011-11-21 Thread massizigao
Perhaps it can help:

when using CheckBox or AjaxCheckBox the WICKET AJAX DEBUG is showing this
error:


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-check-uncheck-all-using-CheckGroupSelector-tp4083663p4092093.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Contract opportunity

2011-11-21 Thread Matt Pavlovich
Media Driver has a contract opportunity open for an experienced Wicket 
developer.  This is not a full time position, but we are open to a flexible 
after hours type arrangement.  However, this is a customer facing project and 
making deadlines is crucial.

Requirements:
 * Walk us through the design decision when it comes to working with various 
Wicket Models
 * Ability to gauge level of effort, and accurately meet the deadline with 
agreed upon functionality.
 * Experience building unit tests for Wicket applications
 * Experience running Wicket in an OSGI environment
 * Experience integrating Wicket with AJAX
 * Experience with REST is a bonus

If you are interested, please contact me directly.

Thank you!
Matt Pavlovich
Media Driver

E: m...@mediadriver.com


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



blog: integrating jpa/hibernate into wicket and cdi

2011-11-21 Thread Igor Vaynberg
just wrote a new blog entry on how to integrate jpa with cdi and wicket

https://www.42lines.net/2011/11/21/adding-jpahibernate-into-the-cdi-and-wicket-mix/

-igor

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



Re: unit testing continueToOriginalDestination

2011-11-21 Thread Igor Vaynberg
create a special test page that throws a
RestartResponseAtInterceptPageException with the page you want to
test.

-igor

On Sun, Nov 20, 2011 at 6:29 AM, kamiseq kami...@gmail.com wrote:
 hej,
 Im a bit stuck, I tried to search something but all resources points to
 older version and it seems that in 1.5 a lot ve changed.

 I have a page that does its work and then continueToOriginalDestination or
 it this returns false do some more stuff.
 unit testing the case when it returns false was easy ;] but now I try to
 figure out how to test that my code calls continueToOriginalDestination and
 tries to redirect.

 I tried this
 http://www.mail-archive.com/users@wicket.apache.org/msg09904.html

 but this was for wicket 1.3

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __


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



Re: URLs with page id and Component.isVersioned

2011-11-21 Thread Igor Vaynberg
make your page stateless and it will not have the page id in the url.

-igor

On Sun, Nov 20, 2011 at 2:27 PM, hok ivanvasi...@gmail.com wrote:
 Hello,
 this issue has been discussed previously
 (http://apache-wicket.1842946.n4.nabble.com/Stateful-pages-without-page-Id-in-the-url-td3816663.html).
 If it is safe for a page not to keep it's versions (for exapmle if the whole
 state is in the page paramgers) the page id in the url is not needed
 anymore. Also, as discussed, this will be good for SEO and for Google
 Analytics.
 Is it possible for the page URLs not to include page id if a
 Page.isVersioned() returns false? As far as I can understand, currently, if
 this method returns false a new page will be created every time (even if
 back button is pressed). This will give an easy way for removing page ids
 from the URL when they are not needed. Thanks.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/URLs-with-page-id-and-Component-isVersioned-tp4089805p4089805.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: wicket url encoding: ClassCastException using SunJceCrypt

2011-11-21 Thread lesterburlap

lesterburlap wrote
 
 Caused by: java.lang.ClassCastException:
 com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES cannot be cast to
 javax.crypto.SecretKeyFactorySpi
   at javax.crypto.SecretKeyFactory.getInstance(Unknown Source)
   at
 org.apache.wicket.util.crypt.SunJceCrypt.generateSecretKey(SunJceCrypt.java:119)
 

I'm guessing now that this issue must be a classpath version conflict of
some sort between PBEKeyFactory and SecretKeyFactorySpi.  So, just for
giggles, I went down the route of implementing the Wicket TrivialCrypt,
just to see if I could get URL encrypting to work at all.  That worked fine.  

However, the jsessionid still shows up in the URL, which was the entire
reason I was wanting to encrypt the URL:
http://localhost:8080/app/;jsessionid=1xb3ytqs2y4ch?x=ydXFzcXFxcU

So, dang it.

My whole point here is to prevent the session fixation security
vulnerability with the JSESSIONID cookie being set on a (supposedly
stateless) Login Page.  Calling WebSession.replaceSession() after Login to
generate a new session id does not work for me because of some legacy
authentication junk my Wicket app sits on top of (it relies on the session
id to remain the same, or it totally freaks out).

So, I've suppressed the JSESSIONID cookie from being written when the
stateless Login Page loads (by setting an expired JSESSIONID cookie before
the response is sent).  And also overriding WebApplication.newWebResponse so
that it doesn't encode the jsessionid.  But then that causes wicket to stick
the session id in new URLs after login (I guess because the JSESSIONID
cookie is not present in the login POST data).  

Good times.  I think I have officially been defeated.

LBB

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-url-encoding-ClassCastException-using-SunJceCrypt-tp4090613p4092331.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: unit testing continueToOriginalDestination

2011-11-21 Thread kamiseq
it sounds like a plan ;]

I thought it will be something in wicket tester, thanks for a hint anyway ;]

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


Re: unit testing continueToOriginalDestination

2011-11-21 Thread Igor Vaynberg
We can build it in...open a jira and attach a patch :)

-igor
On Nov 21, 2011 10:51 AM, kamiseq kami...@gmail.com wrote:

 it sounds like a plan ;]

 I thought it will be something in wicket tester, thanks for a hint anyway
 ;]

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __



Re: LoadableDetachableModel getObject not final

2011-11-21 Thread Tito
Hi Igor,

Exactly, that is the reason because I'm proposing to make getObject final.
I think it's not ok to override getObject.

What do you think?

2011/11/18 Igor Vaynberg igor.vaynb...@gmail.com

 getObject() is what defines the contract of load(). if we make it
 overridable the user can then break the load() function - for example
 by not calling it from the override.

 why would you want to override getobject()?

 -igor

 On Fri, Nov 18, 2011 at 10:39 AM, Tito njyt...@gmail.com wrote:
  Hi,
 
  I'm wondering if it is ok not to do 'final' this method.
  Correct me if I'm wrong but I think it is not normal to Override this
  method because we always have to Override load().
 
  It's just a question to know what do you think.
 
  Thanks!
 
  Norberto
 

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




Re: unit testing continueToOriginalDestination

2011-11-21 Thread kamiseq
again sounds like a plan ;]

ok, I will try to do that at the end of the week

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


2011/11/21 Igor Vaynberg igor.vaynb...@gmail.com

 We can build it in...open a jira and attach a patch :)

 -igor
 On Nov 21, 2011 10:51 AM, kamiseq kami...@gmail.com wrote:

  it sounds like a plan ;]
 
  I thought it will be something in wicket tester, thanks for a hint anyway
  ;]
 
  pozdrawiam
  Paweł Kamiński
 
  kami...@gmail.com
  pkaminski@gmail.com
  __
 



Re: LoadableDetachableModel getObject not final

2011-11-21 Thread Igor Vaynberg
ah, lol. I thought it was final now and you wanted to make non final... :)
open a jira...

-igor
On Nov 21, 2011 11:36 AM, Tito njyt...@gmail.com wrote:

 Hi Igor,

 Exactly, that is the reason because I'm proposing to make getObject final.
 I think it's not ok to override getObject.

 What do you think?

 2011/11/18 Igor Vaynberg igor.vaynb...@gmail.com

  getObject() is what defines the contract of load(). if we make it
  overridable the user can then break the load() function - for example
  by not calling it from the override.
 
  why would you want to override getobject()?
 
  -igor
 
  On Fri, Nov 18, 2011 at 10:39 AM, Tito njyt...@gmail.com wrote:
   Hi,
  
   I'm wondering if it is ok not to do 'final' this method.
   Correct me if I'm wrong but I think it is not normal to Override this
   method because we always have to Override load().
  
   It's just a question to know what do you think.
  
   Thanks!
  
   Norberto
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: Can't Reset Form After DropDownChoice OnChange Handled

2011-11-21 Thread Igor Vaynberg
I don't think the browser reset button supports ajax..

-igor
On Nov 21, 2011 5:08 AM, Richard W. Adams rwada...@up.com wrote:

 The form just has a standard HTML reset button:

 input wicket:id=reset-button  type=reset  value=Reset  /

 There's no special code associated with the button. Should there be? I
 looked at Wicket in Action, but it doesn't seem to address this issue.

 RAM /abr./: Rarely Adequate Memory.



 From:   Igor Vaynberg igor.vaynb...@gmail.com
 To: users@wicket.apache.org
 Date:   11/17/2011 03:42 PM
 Subject:Re: Can't Reset Form After DropDownChoice OnChange Handled



 what does your reset code look like?

 -igor

 On Thu, Nov 17, 2011 at 9:00 AM, aksarben rwada...@up.com wrote:
  I have a drop down choice component, and when the selection changes, I
 udpate
  various form fields by Ajax, in the form as follows:
 
  *public HistoryDropDown(final String id, final MapK, ? map, final
  Component dateField, final
 TrackDetailModel model, final TrackAttribute attribute) {
 
 super(id, map);
 final String originalValue = model.getOriginalValue(attribute);
 add(new AjaxFormComponentUpdatingBehavior(onchange) {
 private static final long serialVersionUID = -1;
 @Override
 protected void onUpdate(final AjaxRequestTarget target) {
  // When
  selection changes
 
 final String newValue =
 model.getAttributeValue(attribute); // What the
  new choice?
 if (newValue.equals(originalValue)) {
  // If back to original value
 dateField.setEnabled(false);
   // Disable date field
 
  model.restoreOriginalDateAndUser(attribute);//
 Restore original data
 } else {
   // If
 changing to new value
 dateField.setEnabled(true);
  // Enable date field
 model.setDefaultDateAndUser(attribute);
  // Effective date = today
 }
  //
 User = current user
 target.addComponent(dateField.getParent());
  // Re-render fields
 }
 });
  }
  *
  The updates work fine (the screen re-renders properly), but if I then
 click
  the form's Reset button, nothing happens. I saw some other posts that
 said I
  have to do a form.modelchanged(), but that didn't any effect.
 
  --
  View this message in context:

 http://apache-wicket.1842946.n4.nabble.com/Can-t-Reset-Form-After-DropDownChoice-OnChange-Handled-tp4080685p4080685.html

  Sent from the Users forum mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




 **

 This email and any attachments may contain information that is
 confidential and/or privileged for the sole use of the intended recipient.
  Any use, review, disclosure, copying, distribution or reliance by others,
 and any forwarding of this email or its contents, without the express
 permission of the sender is strictly prohibited by law.  If you are not the
 intended recipient, please contact the sender immediately, delete the
 e-mail and destroy all copies.
 **



RE: ValidationForm.addPropertyValidators sometimes looks for child properties in parent's model

2011-11-21 Thread Jablow, Eric R

Igorbut you can create a testcase, reproducing the bare bits of code in a
testcase just like you did in the email below. the advantage would be
that i would have something i can play with which makes it much easier
to find the problem.

I will work on a quick start tonight, when I'm not at work. But here's what I'd 
like to do, possibly extending Metagen. I have a Report object which includes 
an abstract Document object.  Document has 3 concrete subclasses, Book, 
Article, and Monograph. I have FormComponentPanels for each, which I'd like to 
swap in and out. I've used Metagen to create ReportMeta, DocumentMeta, 
BookMeta, etc.  I'd like to extend Metagen so I can write code like

IModelBook bookModel = 
MetaModel.of(report).get(ReportMeta.document).as(Book.class);

and

IModelString isbnModel = 
MetaModel.of(report).get(ReportMeta.document).as(Book.class).get(BookMeta.isbn);

Since I don't want to modify the MetaModel class on my own, I've written a 
SubClassModel class like so:

private static class SubClassModelT extends MetaModelT {
private static final long serialVersionUID = 
3511732306311269529L;

public SubClassModel(MetaModel? super T superModel, ClassT 
clazz) {
super(superModel);
}

@Override
public T getObject() {
return (T) super.getObject();
}
@Override
public void detach() {
super.detach();
}

public static T MetaModelT as(MetaModel? super T 
superModel, ClassT clazz) {
return new SubClassModelT(superModel, clazz);
}
}
}

Unfortunately, when the validation system gets its hands on this, it throws a 
NPE as it adds the property validators:

Caused by: java.lang.NullPointerException
at 
net.ftlines.wicket.validation.bean.ReflectableProperty.init(ReflectableProperty.java:46)
at 
net.ftlines.wicket.validation.bean.ReflectableProperty.init(ReflectableProperty.java:98)
at 
net.ftlines.wicket.validation.bean.ModelPropertyResolver.resolve(ModelPropertyResolver.java:35)
at 
net.ftlines.wicket.validation.bean.ValidationContext.resolveProperty(ValidationContext.java:80)
at 
net.ftlines.wicket.validation.bean.ValidationForm$1.component(ValidationForm.java:170)
at 
net.ftlines.wicket.validation.bean.ValidationForm$1.component(ValidationForm.java:163)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:143)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:161)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:122)
at 
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:908)
at 
net.ftlines.wicket.validation.bean.ValidationForm.addPropertyValidators(ValidationForm.java:162)
at 
net.ftlines.wicket.validation.bean.ValidationForm.onBeforeRender(ValidationForm.java:155)
at org.apache.wicket.Component.internalBeforeRender(Component.java:981)
at org.apache.wicket.Component.beforeRender(Component.java:1015)
at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1785)
... 52 more

This happens when Model is that SubclassModelBook.

How would you use Metagen for this case?  Is it worth extending it?

Respectfully,
Eric Jablow

This communication, along with any attachments, is covered by federal and state 
law governing electronic communications and may contain company proprietary and 
legally privileged information.  If the reader of this message is not the 
intended recipient, you are hereby notified that any dissemination, 
distribution, use or copying of this message is strictly prohibited.  If you 
have received this in error, please reply immediately to the sender and delete 
this message.  Thank you.


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



Re: Can't Reset Form After DropDownChoice OnChange Handled

2011-11-21 Thread Richard W. Adams
I've been doing a lot of Googling on this topic  found this page, which 
seems to describe exactly the problem I'm having:

http://www.jaxtut.com/Navigation.jsp

It suggests calling resetFromSession(), though it doesn't give an 
implementation  this method doesn't seem to be part of Wicket.

Has anyone found a way to reset the form after the model has changed  the 
form re-rendered thru Ajax? If there isn't a way to do this in Wicket, is 
there a Wicket wish list to add it to?



From:   Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org
Date:   11/21/2011 02:18 PM
Subject:Re: Can't Reset Form After DropDownChoice OnChange Handled



I don't think the browser reset button supports ajax..

-igor
On Nov 21, 2011 5:08 AM, Richard W. Adams rwada...@up.com wrote:

 The form just has a standard HTML reset button:

 input wicket:id=reset-button  type=reset  value=Reset  /

 There's no special code associated with the button. Should there be? I
 looked at Wicket in Action, but it doesn't seem to address this issue.

 RAM /abr./: Rarely Adequate Memory.



 From:   Igor Vaynberg igor.vaynb...@gmail.com
 To: users@wicket.apache.org
 Date:   11/17/2011 03:42 PM
 Subject:Re: Can't Reset Form After DropDownChoice OnChange 
Handled



 what does your reset code look like?

 -igor

 On Thu, Nov 17, 2011 at 9:00 AM, aksarben rwada...@up.com wrote:
  I have a drop down choice component, and when the selection changes, I
 udpate
  various form fields by Ajax, in the form as follows:
 
  *public HistoryDropDown(final String id, final MapK, ? map, final
  Component dateField, final
 TrackDetailModel model, final TrackAttribute attribute) {
 
 super(id, map);
 final String originalValue = model.getOriginalValue(attribute);
 add(new AjaxFormComponentUpdatingBehavior(onchange) {
 private static final long serialVersionUID = -1;
 @Override
 protected void onUpdate(final AjaxRequestTarget target) 
{
  // When
  selection changes
 
 final String newValue =
 model.getAttributeValue(attribute); // What the
  new choice?
 if (newValue.equals(originalValue)) {
  // If back to original value
 dateField.setEnabled(false);
   // Disable date field
 
  model.restoreOriginalDateAndUser(attribute);//
 Restore original data
 } else {
   // If
 changing to new value
 dateField.setEnabled(true);
  // Enable date field
 model.setDefaultDateAndUser(attribute);
  // Effective date = today
 }
  //
 User = current user
 target.addComponent(dateField.getParent());
  // Re-render fields
 }
 });
  }
  *
  The updates work fine (the screen re-renders properly), but if I then
 click
  the form's Reset button, nothing happens. I saw some other posts that
 said I
  have to do a form.modelchanged(), but that didn't any effect.
 
  --
  View this message in context:

 
http://apache-wicket.1842946.n4.nabble.com/Can-t-Reset-Form-After-DropDownChoice-OnChange-Handled-tp4080685p4080685.html


  Sent from the Users forum mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




 **

 This email and any attachments may contain information that is
 confidential and/or privileged for the sole use of the intended 
recipient.
  Any use, review, disclosure, copying, distribution or reliance by 
others,
 and any forwarding of this email or its contents, without the express
 permission of the sender is strictly prohibited by law.  If you are not 
the
 intended recipient, please contact the sender immediately, delete the
 e-mail and destroy all copies.
 **




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Can't Reset Form After DropDownChoice OnChange Handled

2011-11-21 Thread Clint Checketts
Yes, you can reset the form quite easily, with or without Ajax. I haven't
read the rest of the thread, but if you just reset the object that the form
is referencing all the fields would stay in sync and be 'reset'.

-Clint

On Mon, Nov 21, 2011 at 3:30 PM, Richard W. Adams rwada...@up.com wrote:

 I've been doing a lot of Googling on this topic  found this page, which
 seems to describe exactly the problem I'm having:

 http://www.jaxtut.com/Navigation.jsp

 It suggests calling resetFromSession(), though it doesn't give an
 implementation  this method doesn't seem to be part of Wicket.

 Has anyone found a way to reset the form after the model has changed  the
 form re-rendered thru Ajax? If there isn't a way to do this in Wicket, is
 there a Wicket wish list to add it to?



 From:   Igor Vaynberg igor.vaynb...@gmail.com
 To: users@wicket.apache.org
 Date:   11/21/2011 02:18 PM
 Subject:Re: Can't Reset Form After DropDownChoice OnChange Handled



 I don't think the browser reset button supports ajax..

 -igor
 On Nov 21, 2011 5:08 AM, Richard W. Adams rwada...@up.com wrote:

  The form just has a standard HTML reset button:
 
  input wicket:id=reset-button  type=reset  value=Reset  /
 
  There's no special code associated with the button. Should there be? I
  looked at Wicket in Action, but it doesn't seem to address this issue.
 
  RAM /abr./: Rarely Adequate Memory.
 
 
 
  From:   Igor Vaynberg igor.vaynb...@gmail.com
  To: users@wicket.apache.org
  Date:   11/17/2011 03:42 PM
  Subject:Re: Can't Reset Form After DropDownChoice OnChange
 Handled
 
 
 
  what does your reset code look like?
 
  -igor
 
  On Thu, Nov 17, 2011 at 9:00 AM, aksarben rwada...@up.com wrote:
   I have a drop down choice component, and when the selection changes, I
  udpate
   various form fields by Ajax, in the form as follows:
  
   *public HistoryDropDown(final String id, final MapK, ? map, final
   Component dateField, final
  TrackDetailModel model, final TrackAttribute attribute) {
  
  super(id, map);
  final String originalValue = model.getOriginalValue(attribute);
  add(new AjaxFormComponentUpdatingBehavior(onchange) {
  private static final long serialVersionUID = -1;
  @Override
  protected void onUpdate(final AjaxRequestTarget target)
 {
   // When
   selection changes
  
  final String newValue =
  model.getAttributeValue(attribute); // What the
   new choice?
  if (newValue.equals(originalValue)) {
   // If back to original value
  dateField.setEnabled(false);
// Disable date field
  
   model.restoreOriginalDateAndUser(attribute);//
  Restore original data
  } else {
// If
  changing to new value
  dateField.setEnabled(true);
   // Enable date field
  model.setDefaultDateAndUser(attribute);
   // Effective date = today
  }
   //
  User = current user
  target.addComponent(dateField.getParent());
   // Re-render fields
  }
  });
   }
   *
   The updates work fine (the screen re-renders properly), but if I then
  click
   the form's Reset button, nothing happens. I saw some other posts that
  said I
   have to do a form.modelchanged(), but that didn't any effect.
  
   --
   View this message in context:
 
 

 http://apache-wicket.1842946.n4.nabble.com/Can-t-Reset-Form-After-DropDownChoice-OnChange-Handled-tp4080685p4080685.html

 
   Sent from the Users forum mailing list archive at Nabble.com.
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  **
 
  This email and any attachments may contain information that is
  confidential and/or privileged for the sole use of the intended
 recipient.
   Any use, review, disclosure, copying, distribution or reliance by
 others,
  and any forwarding of this email or its contents, without the express
  permission of the sender is strictly prohibited by law.  If you are not
 the
  intended recipient, please contact the sender immediately, delete the
  e-mail and destroy all copies.
  **
 



 **

 This email and any attachments may contain information that is
 

Re: How to get client ip with wicket 1.5

2011-11-21 Thread Paolo
Alle lunedì 21 novembre 2011, François Meillet ha scritto:
 ((ServletWebRequest) 
 RequestCycle.get().getRequest()).getContainerRequest().getRemoteHost()
 
 François
 
getHeader(X-Forwarded-For) return null string!!
I use getRemoteHost() and it works! Thanks to all!!

P.S.
I test it only on localhost (ip 127.0.0.1)

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



Re: LoadableDetachableModel getObject not final

2011-11-21 Thread Tito
Created: https://issues.apache.org/jira/browse/WICKET-4253

Thanks you

2011/11/21 Igor Vaynberg igor.vaynb...@gmail.com

 ah, lol. I thought it was final now and you wanted to make non final... :)
 open a jira...

 -igor
 On Nov 21, 2011 11:36 AM, Tito njyt...@gmail.com wrote:

  Hi Igor,
 
  Exactly, that is the reason because I'm proposing to make getObject
 final.
  I think it's not ok to override getObject.
 
  What do you think?
 
  2011/11/18 Igor Vaynberg igor.vaynb...@gmail.com
 
   getObject() is what defines the contract of load(). if we make it
   overridable the user can then break the load() function - for example
   by not calling it from the override.
  
   why would you want to override getobject()?
  
   -igor
  
   On Fri, Nov 18, 2011 at 10:39 AM, Tito njyt...@gmail.com wrote:
Hi,
   
I'm wondering if it is ok not to do 'final' this method.
Correct me if I'm wrong but I think it is not normal to Override this
method because we always have to Override load().
   
It's just a question to know what do you think.
   
Thanks!
   
Norberto
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 



Re: How to get client ip with wicket 1.5

2011-11-21 Thread Dan Alvizu
getRemoteHost() will return the IP of the client making the last http
request. This is not a problem if your users make requests directly to your
application server, but if you have a reverse proxy like a load balancer,
getRemoteHost() will return the IP of the reverse proxy, which probably
isn't what you're looking for.

It's best practice for the load balancer to preserve this information by
setting the X-Forwarded-For http header, which will be the IP of the
originating request.

http://en.wikipedia.org/wiki/X-Forwarded-For

-Dan

On Mon, Nov 21, 2011 at 4:10 PM, Paolo irresistible...@gmail.com wrote:

 Alle lunedì 21 novembre 2011, François Meillet ha scritto:
  ((ServletWebRequest)
 RequestCycle.get().getRequest()).getContainerRequest().getRemoteHost()
 
  François
 
 getHeader(X-Forwarded-For) return null string!!
 I use getRemoteHost() and it works! Thanks to all!!

 P.S.
 I test it only on localhost (ip 127.0.0.1)

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




Re: wicket url encoding: ClassCastException using SunJceCrypt

2011-11-21 Thread Igor Vaynberg
jsessionid is managed by the servlet container. we cant encrypt it
because its not part of the page path or query string, its in its own
weird ;jsessionid thing that containers mangle in there. maybe your
container has an option to encrypt it, or maybe you can write a plugin
for it that encrypts it...

-igor

On Mon, Nov 21, 2011 at 9:32 AM, lesterburlap nbe...@voyence.com wrote:

 lesterburlap wrote

 Caused by: java.lang.ClassCastException:
 com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES cannot be cast to
 javax.crypto.SecretKeyFactorySpi
       at javax.crypto.SecretKeyFactory.getInstance(Unknown Source)
       at
 org.apache.wicket.util.crypt.SunJceCrypt.generateSecretKey(SunJceCrypt.java:119)


 I'm guessing now that this issue must be a classpath version conflict of
 some sort between PBEKeyFactory and SecretKeyFactorySpi.  So, just for
 giggles, I went down the route of implementing the Wicket TrivialCrypt,
 just to see if I could get URL encrypting to work at all.  That worked fine.

 However, the jsessionid still shows up in the URL, which was the entire
 reason I was wanting to encrypt the URL:
 http://localhost:8080/app/;jsessionid=1xb3ytqs2y4ch?x=ydXFzcXFxcU

 So, dang it.

 My whole point here is to prevent the session fixation security
 vulnerability with the JSESSIONID cookie being set on a (supposedly
 stateless) Login Page.  Calling WebSession.replaceSession() after Login to
 generate a new session id does not work for me because of some legacy
 authentication junk my Wicket app sits on top of (it relies on the session
 id to remain the same, or it totally freaks out).

 So, I've suppressed the JSESSIONID cookie from being written when the
 stateless Login Page loads (by setting an expired JSESSIONID cookie before
 the response is sent).  And also overriding WebApplication.newWebResponse so
 that it doesn't encode the jsessionid.  But then that causes wicket to stick
 the session id in new URLs after login (I guess because the JSESSIONID
 cookie is not present in the login POST data).

 Good times.  I think I have officially been defeated.

 LBB

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/wicket-url-encoding-ClassCastException-using-SunJceCrypt-tp4090613p4092331.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: wicket url encoding: ClassCastException using SunJceCrypt

2011-11-21 Thread lesterburlap

Igor Vaynberg-2 wrote
 
 jsessionid is managed by the servlet container. we cant encrypt it
 because its not part of the page path or query string, its in its own
 weird ;jsessionid thing that containers mangle in there. maybe your
 container has an option to encrypt it, or maybe you can write a plugin
 for it that encrypts it...
 

Yeah, there is no Wicket problem here.  I caught the WebResponse in the
debugger at the end of a request cycle, and there was no jsessionid in
there.  The container is somehow magically pre-pending it to every single
url in the response markup.

For most situations, I think the newish WebSession.replaceSession (post 1.4)
takes care of the session fixation problem.  There's also a Tomcat valve
(post 5.5.29) that issues a new session id after authentication: Valve
className=org.apache.catalina.authenticator.FormAuthenticator
changeSessionIdOnAuthentication=true /

But messing with the session id for me invokes chaos with the underlaying
legacy auth layer I'm dealing with.

Wicket is still awesome, though!

L. Burlap


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-url-encoding-ClassCastException-using-SunJceCrypt-tp4090613p4094435.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Can't Reset Form After DropDownChoice OnChange Handled

2011-11-21 Thread Martin Grigorov
On Mon, Nov 21, 2011 at 11:30 PM, Richard W. Adams rwada...@up.com wrote:
 I've been doing a lot of Googling on this topic  found this page, which
 seems to describe exactly the problem I'm having:

 http://www.jaxtut.com/Navigation.jsp

 It suggests calling resetFromSession(), though it doesn't give an
 implementation  this method doesn't seem to be part of Wicket.

 Has anyone found a way to reset the form after the model has changed  the
 form re-rendered thru Ajax? If there isn't a way to do this in Wicket, is
 there a Wicket wish list to add it to?

All you need is an AjaxButton with .setDefaultFormProcessing(false)
and in its onClick(AjaxRequestTarget target) to do:
getForm().setModelObject(new MyEntity());
target.add(getForm());

i.e. set a new empty model object for the form and all its form components.




 From:   Igor Vaynberg igor.vaynb...@gmail.com
 To:     users@wicket.apache.org
 Date:   11/21/2011 02:18 PM
 Subject:        Re: Can't Reset Form After DropDownChoice OnChange Handled



 I don't think the browser reset button supports ajax..

 -igor
 On Nov 21, 2011 5:08 AM, Richard W. Adams rwada...@up.com wrote:

 The form just has a standard HTML reset button:

 input wicket:id=reset-button  type=reset  value=Reset  /

 There's no special code associated with the button. Should there be? I
 looked at Wicket in Action, but it doesn't seem to address this issue.

 RAM /abr./: Rarely Adequate Memory.



 From:   Igor Vaynberg igor.vaynb...@gmail.com
 To:     users@wicket.apache.org
 Date:   11/17/2011 03:42 PM
 Subject:        Re: Can't Reset Form After DropDownChoice OnChange
 Handled



 what does your reset code look like?

 -igor

 On Thu, Nov 17, 2011 at 9:00 AM, aksarben rwada...@up.com wrote:
  I have a drop down choice component, and when the selection changes, I
 udpate
  various form fields by Ajax, in the form as follows:
 
  *public HistoryDropDown(final String id, final MapK, ? map, final
  Component dateField, final
         TrackDetailModel model, final TrackAttribute attribute) {
 
         super(id, map);
         final String originalValue = model.getOriginalValue(attribute);
         add(new AjaxFormComponentUpdatingBehavior(onchange) {
                 private static final long serialVersionUID = -1;
                 @Override
                 protected void onUpdate(final AjaxRequestTarget target)
 {
              // When
  selection changes
 
                         final String newValue =
 model.getAttributeValue(attribute);     // What the
  new choice?
                         if (newValue.equals(originalValue)) {
                              // If back to original value
                                 dateField.setEnabled(false);
                                       // Disable date field
 
  model.restoreOriginalDateAndUser(attribute);                    //
 Restore original data
                         } else {
                                                               // If
 changing to new value
                                 dateField.setEnabled(true);
                                              // Enable date field
                                 model.setDefaultDateAndUser(attribute);
                              // Effective date = today
                         }
                                                                      //
 User = current user
                         target.addComponent(dateField.getParent());
                              // Re-render fields
         }
     });
  }
  *
  The updates work fine (the screen re-renders properly), but if I then
 click
  the form's Reset button, nothing happens. I saw some other posts that
 said I
  have to do a form.modelchanged(), but that didn't any effect.
 
  --
  View this message in context:


 http://apache-wicket.1842946.n4.nabble.com/Can-t-Reset-Form-After-DropDownChoice-OnChange-Handled-tp4080685p4080685.html


  Sent from the Users forum mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




 **

 This email and any attachments may contain information that is
 confidential and/or privileged for the sole use of the intended
 recipient.
  Any use, review, disclosure, copying, distribution or reliance by
 others,
 and any forwarding of this email or its contents, without the express
 permission of the sender is strictly prohibited by law.  If you are not
 the
 intended recipient, please contact the sender immediately, delete the
 e-mail and destroy all copies.
 **




 **

 This email and any attachments may contain information that is confidential 
 and/or privileged for the sole use of the