Re: Potential HTTPS redirects bug with deactivated js

2014-02-27 Thread Dmitriy Neretin
Thanks for the response Sven!

Issue created: https://issues.apache.org/jira/browse/WICKET-5522

Dmitriy


2014-02-27 12:22 GMT+01:00 Sven Meier s...@meiers.net:

 Hi Dmitriy,

 this is a bug in WebPageRenderer, so please open a Jira issue.

 A simple non-ajax button exposes the problem too, no need to tinker with
 deactivated JS:

 form.add(new AjaxButton(ajaxGo, form){});
 form.add(new Button(go));

 Please change your quickstart before attaching it to the issue.

 Thanks
 Sven


 On 02/27/2014 11:45 AM, Dmitriy Neretin wrote:

 Hi,

 I'm not sure if that a realy bug, but here is the description:

 Activated JS: Start the quickstart - Press the submit button - See the
 secured page with https!

 Deactivates JS: (NoScript Firefox Plugin): Start the quickstart - Press
 the submit button - See the secured page BUT with HTTP!

 There was no proper https redirect.

 If I change, the rendering strategy to REDIRECT_TO_BUFFER everything
 works fine, but if I change the strategy to ONE_PASS_RENDER the https
 forwarding does't work anymore. But only if I deactivate all scripts...

 The problem is: I should use the ONE_PASS_RENDER strategy and I should
 supoort No-JS :(


 Thanks,
 Dmitriy




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





Re: Potential HTTPS redirects bug with deactivated js

2014-02-27 Thread Dmitriy Neretin
There is a workaround for the problem:

Extend RedirectPage - anotate it with RequireHttps - insert this page
between source (http) and target (https) pages.

The second redirect leads to the https page!

Dmitriy


2014-02-27 13:04 GMT+01:00 Dmitriy Neretin dmitriy.nere...@googlemail.com:

 Thanks for the response Sven!

 Issue created: https://issues.apache.org/jira/browse/WICKET-5522

 Dmitriy


 2014-02-27 12:22 GMT+01:00 Sven Meier s...@meiers.net:

 Hi Dmitriy,

 this is a bug in WebPageRenderer, so please open a Jira issue.

 A simple non-ajax button exposes the problem too, no need to tinker with
 deactivated JS:

 form.add(new AjaxButton(ajaxGo, form){});
 form.add(new Button(go));

 Please change your quickstart before attaching it to the issue.

 Thanks
 Sven


 On 02/27/2014 11:45 AM, Dmitriy Neretin wrote:

 Hi,

 I'm not sure if that a realy bug, but here is the description:

 Activated JS: Start the quickstart - Press the submit button - See the
 secured page with https!

 Deactivates JS: (NoScript Firefox Plugin): Start the quickstart - Press
 the submit button - See the secured page BUT with HTTP!

 There was no proper https redirect.

 If I change, the rendering strategy to REDIRECT_TO_BUFFER everything
 works fine, but if I change the strategy to ONE_PASS_RENDER the https
 forwarding does't work anymore. But only if I deactivate all scripts...

 The problem is: I should use the ONE_PASS_RENDER strategy and I should
 supoort No-JS :(


 Thanks,
 Dmitriy




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






Re: Best way to do authentication in external system

2014-01-16 Thread Dmitriy Neretin
I think the 4-th option will be the best way to do it. As an external
solution you can consider Spring Security or Apache Shiro


2014/1/16 Martin Grigorov mgrigo...@apache.org

 Hi,

 4) Add a Servlet Filter *before* WicketFilter in web.xml
 The new filter will check whether there is an authenticated user or not and
 do whatever is needed

 Martin Grigorov
 Wicket Training and Consulting


 On Thu, Jan 16, 2014 at 9:29 AM, Илья Нарыжный phan...@ydn.ru wrote:

  Guys,
 
  Please advice me. What's the best way to implement authentication in
  external system(support of Single Sign On)? I know 3 variants, but all
 of
  them have different pros and cons.
 
  1) Implement your own IRequestCycleListener. You are intercepting all
  requests, finding out those that should be authenticated externally and
  proceeed with proper operations (commonly redirect to external system).
  2) Implement of IREquestMapper. HttpsMapper can be taken as some kind of
  example.
  3) Override restartResponseAtSignInPage() and redirect to external system
  if required.
 
  So, what is the best one? May be you know more variants?
 
  Thanks,
 
  Ilia
 



Disabling of the Textfields and update of the model

2013-08-01 Thread Dmitriy Neretin
Hi everyone,

I have a problem with textfield enabling/disabling and with update of the
appropriate model.

I have a wizzard with 3 steps:
- Step one: show some info fields
- Step two: let the user edit his info with textfields
- Step three: show the user new info.

Now I built an ajaxcheckbox in the form with input fileds. With the
checkbox I can manage what textfields are enabled or disabled. I made it
like described here :
http://stackoverflow.com/questions/10282232/disable-input-text-in-wicket

But the Problem is, that the model of the disabled fields doesn't update
itself anymore. I have then following situation:

Step 1   Step 2   Step 3

info a  field a new info a
info b  field b new info b
info c  field c - deaktvated   old info c

Is it possible to force the model to update itself? The textfields are in
the form and it is a ususal form handling.

Regards,
Dmitriy


Re: FormComponent independent from the Model/Model object

2013-07-10 Thread Dmitriy Neretin
Thanks to all! I used the Marios approach... The workaroud with another
Model worked perfectly. :)

@Richard: Everything is possible with javasript, but if wicket offers a
huge feature set, I see no need to use js...

Regards,
Dmitriy

2013/7/10 Paul Bors p...@bors.ws

 You don't want an empty model either, just declare a class field and use a
 PropertyModel instead.

 Like so:

  public class MyPanel {
// Add the field and its getter/setter (not shown here)
private boolean myCheckBoxState;

public MyPanel(id, IModelMyObj model){
  super(id, new CompoundPropertyModelMyObj(model);
  
  FormMyObj form = new Form(id, model);
  // Specify a different model for your form fields that are
 independent of MyObj
  form.add(new AjaxCheckBox(anyStupidId, new
 PropertyModelMyPanel(myCheckBoxState, MyPanel.this));
  add(form);
}

  }

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Joachim Schrod [mailto:jsch...@acm.org]
 Sent: Tuesday, July 09, 2013 6:27 PM
 To: users@wicket.apache.org
 Subject: Re: FormComponent independent from the Model/Model object

 Dmitriy Neretin wrote:
  Hi everyone,
 
  I have a dummy question:
 
  If I have a panel with a form (not everything is my code) -
 
  public class MyPanel{
 
public MyPanel(id, IModelMyObj model){
  super(id, new CompoundPropertyModelMyObj(model);
  
  FormMyObj form = new Form(id, model);
  form.add(new AjaxCheckBox(anyStupidId);
  add(form);
 
   }
 
  }
 
  And I want to add a Component (AjaxCheckBox) to the form above, but
  this component shouldn't have anything to do with a model object.

 Why don't you construct it with an empty model object, i.e., with new
 Model()? Then the CPM from the panel is not accessed.

 Joachim

 --
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Joachim Schrod, Roedermark, Germany
 Email: jsch...@acm.org


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



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




FormComponent independent from the Model/Model object

2013-07-09 Thread Dmitriy Neretin
Hi everyone,

I have a dummy question:

If I have a panel with a form (not everything is my code) -

public class MyPanel{

  public MyPanel(id, IModelMyObj model){
super(id, new CompoundPropertyModelMyObj(model);

FormMyObj form = new Form(id, model);
form.add(new AjaxCheckBox(anyStupidId);
add(form);

 }

}

And I want to add a Component (AjaxCheckBox) to the form above, but this
component shouldn't have anything to do with a model object. It's purpose
is just a change the state of the input fields. If I check the box the
field should be deactivated and vice versa. Nothing more.

My problem is, that Wicket thinks (and I even know  why :)) the
anyStupidId is a field of MyObj and tries to change the value... Well,
the checkbox should be inside of the form, but I don't know if is it
possible to make this checkbox independent from the Model handling... How
can I tell wicket, hey dude, anyStupidId has nothing to do with MyObj, it
is really just a stupid id

Regards,
Dmitriy


Re: Empy choices durring unit tests with DropDownChoice

2013-06-18 Thread Dmitriy Neretin
:)) You should better dive into your new project :))

It didn't work... And I don't have any idea why...

The constructor (id, myModel, choicesModel, renderer) didn't work too :))
But the example is too complicated to discuss it here. But it works fine if
I use this:

(id, choisesModel, renderer) and then getConvertedValue (in the overriden
submit of the form above )

Dmitriy

2013/6/18 martin.dilger martin.dil...@googlemail.com

 Dmitriy, Dmitriy...:)

 Never ever call getObject() on your LoadableDetachable Model in the
 Constructor of your Component (I taught you better!!:)).

 Should be:
 new DropDownChoice(aWicketId, yourModel,new ChoicesModel(),
 myOwnChoicesRenderer)

 Mind the second Parameter, as this is your Model that gets Populated on
 Selection, try this.

 You should further check whether you service has been called
 Mockito.verify(myService).getChoicesList()





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Empy-choices-durring-unit-tests-with-DropDownChoice-tp4659540p4659583.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




Empy choices durring unit tests with DropDownChoice

2013-06-17 Thread Dmitriy Neretin
Hi everyone!

I have a little problem. When I unit test a wicket panel with a
DropDownChoice I can't get the choices list into dropdown... So, that is
how I use it:

a) ... new DropDownChoice(aWicketId, new ChoicesModel.getObject(),
myOwnChoicesRenderer)

b) The choices Model ist a loadabledetachablemodel. In the load Method a
have a service call, that returns a list of choices:

load(){
   myService.getChoicesList()
}

c) In the unit test itself I start the panel with:

Mockito.when(myService.getChoicesList()).thenReturn(mockedChoicesList)

tester.startComponentInThePage(MyPanel.class)...

and somewhere on the bottom of the test:

tester.getComponentFromLastRenderedPage(dropDownId).getChoices and ...
nothing happens... The mocked choices are away...

Can somebody explain me, what do I wrong?

Regards,
Dmitriy


Re: How to unit test AttributeModifier

2013-05-09 Thread Dmitriy Neretin
Thanks to all! It works now!
Am 08.05.2013 14:39 schrieb Kees van Dieren i...@squins.com:

 Another option is to use the TagTester:

 TagTester tester = wicketTester.getTagByWicketId(containerId);

 tester.getAttribute(name); // returns: anyDynamicValue




 Best regards / Met vriendelijke groet,

 Kees van Dieren
 Squins IT Solutions BV
 Oranjestraat 30
 2983 HS Ridderkerk
 The Netherlands
 Mobile: +31 (0)6 30413841
 www.squins.com
 Chamber of commerce Rotterdam: 24435103


 2013/5/8 Martin Grigorov mgrigo...@apache.org

  Also check AttributeModifierTest in wicket-core/src/test/java/..
 
 
  On Tue, May 7, 2013 at 5:31 PM, Igor Vaynberg igor.vaynb...@gmail.com
  wrote:
 
   attribute modifiers are behaviors, so use
   component.getbehavior(AttributeModifier.class) to get it.
  
   -igor
  
   On Tue, May 7, 2013 at 8:24 AM, Dmitriy Neretin
   dmitriy.nere...@googlemail.com wrote:
Hello,
   
Is it possible to unit test an AttributeModifier?
   
I have a simple component:
   
WebMarkupContainer container = new WebMarkupContainer(containerId);
container.add(new AttributeModifier(name, anyDynamicValue));
   
In the unit test:
   
WebMarkupContainer container = (WebMarkupContainer)
tester.getComponentFromLastRenderedPage(containerId);
   
Is it possible to get the modifier above? I can see it in the object
   state
(while debugging) but I have no idea how to get it to test an
anyDynamicValue...
   
Any ideas?
   
Regards,
   
Dmitriy
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 
 
  --
  Martin Grigorov
  Wicket Training  Consulting
  http://jWeekend.com http://jweekend.com/
 



How to unit test AttributeModifier

2013-05-07 Thread Dmitriy Neretin
Hello,

Is it possible to unit test an AttributeModifier?

I have a simple component:

WebMarkupContainer container = new WebMarkupContainer(containerId);
container.add(new AttributeModifier(name, anyDynamicValue));

In the unit test:

WebMarkupContainer container = (WebMarkupContainer)
tester.getComponentFromLastRenderedPage(containerId);

Is it possible to get the modifier above? I can see it in the object state
(while debugging) but I have no idea how to get it to test an
anyDynamicValue...

Any ideas?

Regards,

Dmitriy


Re: Problem with markup inheritance in Wicket 6

2013-02-06 Thread Dmitriy Neretin
Hi guys,

you are absolutely right. There wasn't a bug... I just overseen that there
were some changes. Other developers introduced another component with
appropriate html tag in the super class so I didn't see that.

Regards,
Dmitriy

2013/2/1 Martin Grigorov mgrigo...@apache.org

 Hi,

 I think there are no changes in this area.
 Do you extend/inherit the markup or completely override it ?
 I expect to see wicket:extend instead of wicket:panel in
 MyNewPanel.html.
 Create a quickstart and attach it to a ticket in Jira please.


 On Fri, Feb 1, 2013 at 2:12 PM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hi Folks,
 
  I have another problem during Wicket 6 migration. This time it is a
 problem
  with markup inheritance.
 
  I have an old wicket panel and appropriate markup file:
  MyOldGoodWicketPanel  MyOldGoodWicketPanel.html
 
  Markup file looks like this:
 
  wicket:panel
   ... stuff ...
  /wicket:panel
 
  Some months ago I needed for the same Panel another Markup, so what I
 did:
 
  class MyNewPanel extends MyOldGoodWicketPanel {
  almost the same stuff
  }
 
  and an appropriate markup file:
 
  MyNewPanel.html with following markup:
 
  wicket:panel
   ... other stuff ...
  /wicket:panel
 
  It worked pretty well in the Wicket 1.5, but now I get Exceptions, that
 the
  components from the super class (MyOldGoodWicketPanel) are not found in
 the
  subclass/ in the markup file of the sublclass...
 
  Can somebody explain me what happened?
 
  Regards,
  Dmitriy
 



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



Re: FeedbackMessage from FormComponent in Wicket 6

2013-02-01 Thread Dmitriy Neretin
Thank You!

But I still don't really understand the error handling. For example I
implement the IValidator interface and if I fount an error how can I
register it in wicket 6 approach?

Old way:
if(ab){
  error(validatable)
}

New way: validatable.error(new ValidationError(this)); - is it right?


2013/1/31 Martin Grigorov mgrigo...@apache.org

 Hi,

 formComponent.getFeedbackMessages().getFirst(level)


 On Thu, Jan 31, 2013 at 5:14 PM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hi folks,
 
  We are migrating from Wicket 1.5 to 1.6
 
  Here is an example what we did in 1.5:
  formComponent.getFeedbackMessage().getMessage().toString()
 
  So, the FormComponent class doesn't have the method getFeedbackMessage()
  anymore. But getFeedbackMessages()... Can somebody show/explain me how I
  can get the formComponent feedback message with new approach?
 
  Regards,
  Dmitriy
 



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



Problem with markup inheritance in Wicket 6

2013-02-01 Thread Dmitriy Neretin
Hi Folks,

I have another problem during Wicket 6 migration. This time it is a problem
with markup inheritance.

I have an old wicket panel and appropriate markup file:
MyOldGoodWicketPanel  MyOldGoodWicketPanel.html

Markup file looks like this:

wicket:panel
 ... stuff ...
/wicket:panel

Some months ago I needed for the same Panel another Markup, so what I did:

class MyNewPanel extends MyOldGoodWicketPanel {
almost the same stuff
}

and an appropriate markup file:

MyNewPanel.html with following markup:

wicket:panel
 ... other stuff ...
/wicket:panel

It worked pretty well in the Wicket 1.5, but now I get Exceptions, that the
components from the super class (MyOldGoodWicketPanel) are not found in the
subclass/ in the markup file of the sublclass...

Can somebody explain me what happened?

Regards,
Dmitriy


FeedbackMessage from FormComponent in Wicket 6

2013-01-31 Thread Dmitriy Neretin
Hi folks,

We are migrating from Wicket 1.5 to 1.6

Here is an example what we did in 1.5:
formComponent.getFeedbackMessage().getMessage().toString()

So, the FormComponent class doesn't have the method getFeedbackMessage()
anymore. But getFeedbackMessages()... Can somebody show/explain me how I
can get the formComponent feedback message with new approach?

Regards,
Dmitriy


Re: Strange behavior of TextField and AjaxFormComponentUpdatingBehavior

2012-11-28 Thread Dmitriy Neretin
Hi,

thank you for idea again :) But I have another question now. This textfield
belongs to wicket panel. And I don't really understand where should I place
script/script tags. Is it enough to place it in the panel.html or
should I define it in some other location?

Dmitriy

2012/11/27 Sven Meier s...@meiers.net

 oncklick


 ... or onclick ?

 I'd recommend a javascript only solution without round-trip to the server.

 http://stackoverflow.com/**questions/2851794/clear-text-**
 onclick-textfieldhttp://stackoverflow.com/questions/2851794/clear-text-onclick-textfield

 Sven


 On 11/27/2012 05:09 PM, Dmitriy Neretin wrote:

 Hi wicket-users,

 I have a question about a combination of the TextField and
 AjaxFormComponentUpdatingBehav**ior.

 I have a text field with content. Just to indicate what user should enter.
 For example a day text filed, which already contains following DD.
 I do it by following:
dayField.setModel(Model.of(**DD));

 My idea now is to delete this text automatically. For example with
 oncklick event. What I did is:

 dayField.add(new AjaxFormComponentUpdatingBehav**ior(oncklick){

  onUpdate(){
 doSomeStuff
 }
 });

 So, the problem now is it doesn't work at first time! For example I click
 in the field, delete the text, insert another text, leave the field. Click
 in the filed again and only then onUpdate method performs. But it doesn't
 perform at first time and I don't understand why...

 Can somebody help me?

 Regards,
 Dmitriy



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




Re: Strange behavior of TextField and AjaxFormComponentUpdatingBehavior

2012-11-28 Thread Dmitriy Neretin
Thank you guys, but unfortunately I have some constraints related to the
layout etc. and I can't avoid them...

Dmitriy

2012/11/28 Cedric Gatay gata...@gmail.com

 For the placeholder thing you can use the standard HTML5 way with a
 polyfill such as the following (with Modernizr it will only be loaded if
 the client need it) :
 https://github.com/ginader/HTML5-placeholder-polyfill
 __
 Cedric Gatay
 http://www.bloggure.info | http://cedric.gatay.fr |
 @Cedric_Gatayhttp://twitter.com/Cedric_Gatay



 On Wed, Nov 28, 2012 at 10:32 AM, Sébastien Gautrin 
 sebastien.gaut...@gmail.com wrote:

  Actually I'd recommend not puting the placeholder in the input itself,
  assuming you don't have to support old browsers that most other now have
  stopped supporting a few years back. Depending on the browser of your
  users, you can:
  - use the html5 placeholder attribute (best way to do that, but you won't
  support ie  10)
  - have the placeholder appear in the input while it's not; one nice
  technique is to use a label/span that you will move above the input with
  css (using position attribute and z-index); then you have a little
  javascript that will simply change the opacity of that placeholder
  depending on conditions: with an initial opacity of 1, you can put it at
  0.5 when the user focus the field, and at 0 once he entered anything.
  Advantages of that compared to putting the placeholder in the input is
 you
  don't have to worry about the placeholder value being actually submitted
 by
  the client, and that you won't have any bloat to have the placeholder
 back
  if the user empty the field.
 
  Note that for the second option, you need opacity, and thus either IE8+
 or
  have the proprietary ms syntax for that (IE5-7 using filter:
  alpha(opacity=50);, IE8 using -ms-filter:progid:**
  DXImageTransform.Microsoft.**Alpha(Opacity=50);)
 
 
  Sven Meier wrote:
 
  oncklick
 
 
  ... or onclick ?
 
  I'd recommend a javascript only solution without round-trip to the
 server.
 
  http://stackoverflow.com/**questions/2851794/clear-text-**
  onclick-textfield
 http://stackoverflow.com/questions/2851794/clear-text-onclick-textfield
 
  Sven
 
  On 11/27/2012 05:09 PM, Dmitriy Neretin wrote:
 
  Hi wicket-users,
 
  I have a question about a combination of the TextField and
  AjaxFormComponentUpdatingBehav**ior.
 
  I have a text field with content. Just to indicate what user should
  enter.
  For example a day text filed, which already contains following DD.
  I do it by following:
 dayField.setModel(Model.of(**DD));
 
  My idea now is to delete this text automatically. For example with
  oncklick event. What I did is:
 
  dayField.add(new AjaxFormComponentUpdatingBehav**ior(oncklick){
 
   onUpdate(){
  doSomeStuff
  }
  });
 
  So, the problem now is it doesn't work at first time! For example I
 click
  in the field, delete the text, insert another text, leave the field.
  Click
  in the filed again and only then onUpdate method performs. But it
 doesn't
  perform at first time and I don't understand why...
 
  Can somebody help me?
 
  Regards,
  Dmitriy
 
 
 
 
 --**--**-
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org
 users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
  --**--**-
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org
 users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Strange behavior of TextField and AjaxFormComponentUpdatingBehavior

2012-11-27 Thread Dmitriy Neretin
Hi wicket-users,

I have a question about a combination of the TextField and
AjaxFormComponentUpdatingBehavior.

I have a text field with content. Just to indicate what user should enter.
For example a day text filed, which already contains following DD.
I do it by following:
  dayField.setModel(Model.of(DD));

My idea now is to delete this text automatically. For example with
oncklick event. What I did is:

dayField.add(new AjaxFormComponentUpdatingBehavior(oncklick){

onUpdate(){
   doSomeStuff
}
});

So, the problem now is it doesn't work at first time! For example I click
in the field, delete the text, insert another text, leave the field. Click
in the filed again and only then onUpdate method performs. But it doesn't
perform at first time and I don't understand why...

Can somebody help me?

Regards,
Dmitriy


Strange behavior of AutoCompleteTextField choice list and mouse

2012-11-20 Thread Dmitriy Neretin
Hello everybody!

I have a strange behavior of a text field above. When I see a choice list
and try to select an entry with a enter key - no problem. But when I try to
select an entry with a mouse - no chance! The selected entry doesn't appear
in the text field...

I added to the filed AjaxFormComponentUpdatingBehavior and it listens on
event onchange

I use Wicket 1.5.5

Regards,
Dmitriy


(String)RessourceModel and Location of resources in the *.props files

2012-10-22 Thread Dmitriy Neretin
Hello everybody,

I have a little problem. I use in my webpages ressource models. For example:

public class MyPage{
 ...
 add(new Label(id, new ResourceModel(myResourceKey));
 ...

I also have a MyPage.properties where I placed following
String: myResourceKey=Hello World! But I get whole the time Runtime
Exceptions Resource not fount etc...
When I put the string above in the MyApplication.properties - no problems...

First question is: why is it so? Why does wicket can't find my resource key
in the apropriate property but in the *aplication.properties?
Second question is: Is it possible to change this resolution way? I have
already tried the StringResourceModel but with no success...

Please Help!

Regards,
Dmitriy


Anchor and Link between different Wicket Pages

2012-09-26 Thread Dmitriy Neretin
Hi Folks,

I don't really unterstand how to do it.

I have two Wicket Pages: Page1 and Page2

On the Page1 I define the Label, wich will be contain the anchor id. So
now I want to define a link on the Page1, wich will get
setResponsePage(Page1) but I also want that the user will be forwarded to
the anchor on the Page1!

What I don't understand ist how to do it in a right way :)? hot to set
link.setAnchor(anchorComponentFromThePage1)???

Thank You!


Re: Anchor and Link between different Wicket Pages

2012-09-26 Thread Dmitriy Neretin
Thank You!

Well I have the second case. What I don't really understand is how to get
the '#anchor'?

I defined on the Page1 an anchor (Wicket Label with markupid). On the Page2
I define the BookmarkablePageLink with overriden getURL Method where I
return #anchor + super.getURL().

My problem is that I don't understand how to translate my anchor-label
from the page1 into #anchor to append it to the CharSequence!

Regards, Dmitriy

2012/9/26 Martin Grigorov mgrigo...@apache.org

 Hi,

 Case 1) both the link and the anchor  are in the same page (Page1)
 To be able to use Link#setAnchor(Component) you need to use a Label
 component for the anchor and pass it to link: link.setAnchor(label)

 Case 2) the link is in Page1 and the anchor in is Page2
 Use a BookmarkablePageLink and override its #getURL() method and just
 append '#anchor' to the returned url from super.getURL();

 On Wed, Sep 26, 2012 at 11:18 AM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Hi Folks,
 
  I don't really unterstand how to do it.
 
  I have two Wicket Pages: Page1 and Page2
 
  On the Page1 I define the Label, wich will be contain the anchor id. So
  now I want to define a link on the Page1, wich will get
  setResponsePage(Page1) but I also want that the user will be forwarded to
  the anchor on the Page1!
 
  What I don't understand ist how to do it in a right way :)? hot to set
  link.setAnchor(anchorComponentFromThePage1)???
 
  Thank You!



 --
 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: Anchor and Link between different Wicket Pages

2012-09-26 Thread Dmitriy Neretin
You know, you are a wicket god :) Thanks and have a nice day!

2012/9/26 Martin Grigorov mgrigo...@apache.org

 On Wed, Sep 26, 2012 at 2:31 PM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Thank You!
 
  Well I have the second case. What I don't really understand is how to get
  the '#anchor'?
 
  I defined on the Page1 an anchor (Wicket Label with markupid). On the
 Page2
  I define the BookmarkablePageLink with overriden getURL Method where I
  return #anchor + super.getURL().

 This should be: super.getURL() + #anchor;

 The value of 'anchor' can be :
 1) passed as request parameter to Page2 (setResponsePage(Page2.class,
 paramsWithTheAnchor)
 2) passed as a pure object to Page2 (setResponsePage(new
 Page2(label.getMarkupId(
 3) a predefined value
 in Page1.java: label.setMarkupId(Constants.ANCHOR_VALUE)
 in Page2: super.getURL() + # + Constants.ANCHOR_VALUE;

 
  My problem is that I don't understand how to translate my anchor-label
  from the page1 into #anchor to append it to the CharSequence!
 
  Regards, Dmitriy
 
  2012/9/26 Martin Grigorov mgrigo...@apache.org
 
  Hi,
 
  Case 1) both the link and the anchor  are in the same page (Page1)
  To be able to use Link#setAnchor(Component) you need to use a Label
  component for the anchor and pass it to link: link.setAnchor(label)
 
  Case 2) the link is in Page1 and the anchor in is Page2
  Use a BookmarkablePageLink and override its #getURL() method and just
  append '#anchor' to the returned url from super.getURL();
 
  On Wed, Sep 26, 2012 at 11:18 AM, Dmitriy Neretin
  dmitriy.nere...@googlemail.com wrote:
   Hi Folks,
  
   I don't really unterstand how to do it.
  
   I have two Wicket Pages: Page1 and Page2
  
   On the Page1 I define the Label, wich will be contain the anchor
 id. So
   now I want to define a link on the Page1, wich will get
   setResponsePage(Page1) but I also want that the user will be
 forwarded to
   the anchor on the Page1!
  
   What I don't understand ist how to do it in a right way :)? hot to set
   link.setAnchor(anchorComponentFromThePage1)???
  
   Thank You!
 
 
 
  --
  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
 
 



 --
 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: ChangeListener for the RadioGroup Component

2012-06-15 Thread Dmitriy Neretin
Thanks!

Can you describe how can I use the AjaxFormChoiceComponentUpdatingBehavior()
with the label?

2012/6/15 Martin Grigorov mgrigo...@apache.org

 Hi,

 #onSelectionChanged() works only if you override
 #wantOnSelectionChanged() to return true.
 Otherwise you can also use AjaxFormChoiceComponentUpdatingBehavior()
 and update the label with Ajax.

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




Re: ChangeListener for the RadioGroup Component

2012-06-15 Thread Dmitriy Neretin
Thanks! It was really helpful! But I am only to 99% ready :)

There is a little problem in your code example:

if I make so:
label.setDefaultModelObject(sites.getModelObject());

I get a compiler error: Cannot refer to a non-final variable sites inside
an inner class... Is there any workaround for this?

Thank you!


2012/6/15 Martin Grigorov mgrigo...@apache.org

 Something like:

 final Label label = ...
 RadioChoiceString sites = new RadioChoiceString(site, SITES);
sites.add(new AjaxFormChoiceComponentUpdatingBehavior()
{
@Override
protected void onUpdate(AjaxRequestTarget target)
{

 label.setDefaultModelObject(sites.getModelObject());
target.add(label);
}
});

 On Fri, Jun 15, 2012 at 11:25 AM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Thanks!
 
  Can you describe how can I use the
 AjaxFormChoiceComponentUpdatingBehavior()
  with the label?
 
  2012/6/15 Martin Grigorov mgrigo...@apache.org
 
  Hi,
 
  #onSelectionChanged() works only if you override
  #wantOnSelectionChanged() to return true.
  Otherwise you can also use AjaxFormChoiceComponentUpdatingBehavior()
  and update the label with Ajax.
 
  -
  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: ChangeListener for the RadioGroup Component

2012-06-15 Thread Dmitriy Neretin
Perfect! Thank you!

2012/6/15 Martin Grigorov mgrigo...@apache.org

 either make 'sites' final or use Wicket events (
 http://www.wicket-library.com/wicket-examples/events/ )

 On Fri, Jun 15, 2012 at 12:42 PM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Thanks! It was really helpful! But I am only to 99% ready :)
 
  There is a little problem in your code example:
 
  if I make so:
  label.setDefaultModelObject(sites.getModelObject());
 
  I get a compiler error: Cannot refer to a non-final variable sites
 inside
  an inner class... Is there any workaround for this?
 
  Thank you!
 
 
  2012/6/15 Martin Grigorov mgrigo...@apache.org
 
  Something like:
 
  final Label label = ...
  RadioChoiceString sites = new RadioChoiceString(site, SITES);
 sites.add(new AjaxFormChoiceComponentUpdatingBehavior()
 {
 @Override
 protected void onUpdate(AjaxRequestTarget target)
 {
 
  label.setDefaultModelObject(sites.getModelObject());
 target.add(label);
 }
 });
 
  On Fri, Jun 15, 2012 at 11:25 AM, Dmitriy Neretin
  dmitriy.nere...@googlemail.com wrote:
   Thanks!
  
   Can you describe how can I use the
  AjaxFormChoiceComponentUpdatingBehavior()
   with the label?
  
   2012/6/15 Martin Grigorov mgrigo...@apache.org
  
   Hi,
  
   #onSelectionChanged() works only if you override
   #wantOnSelectionChanged() to return true.
   Otherwise you can also use AjaxFormChoiceComponentUpdatingBehavior()
   and update the label with Ajax.
  
   -
   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
 
 



 --
 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




Panel update after Ajax Submit

2011-03-01 Thread Dmitriy Neretin
Hello everybody!

Hope someone can help me. I don't really understand, what I should add as
ajax target :(

So, I have an abstract class Index where I add all my panels (3) and it is
my masterlayout. I add the panels in the index class like this:

add(new ShoppingCartPanel(id, anotherMehod);

The appropriate Markup has just following tags (ShoppingCartPanel.html):
wicket:panel
 Content
/wicketpanel

In the other Page (that inherits from Index) I have implemented the
AjaxSubmitLink:

add(new AjaxSubmitLink(addtocart) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(?);

What I want is, when the link is activated the panel should be updated...

First: I don't really understand what I have add to the addComponent()
method ?
Second: Where schould I set setOutputMarupId(true) ?

Thank You!


Re: Panel update after Ajax Submit

2011-03-01 Thread Dmitriy Neretin
Thanks for reply,

If you want to refresh the panel, call setOutputMarkupId(true)  on the panel
 , then add the panel to the target.


Does it mean I should call setOutputMarkUpId(true) in the constructor of the
panel? If I do so, the layout of the panel is destroyed.


 If the Ajax Link  is on the same panel, you can call
 this.setOutputMarkupId(true) , and you can also add MyPanel.this to the
 target.


No, the link is not on the same panel. This is actually the point that I
don't really understand. What should I add, if the link not on the panel.


 The point is , what ever you want to refresh via ajax must have
 outputMarkupId set to true.

 Hope that helps.

 Josh.

 On Tue, Mar 1, 2011 at 11:51 AM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hello everybody!
 
  Hope someone can help me. I don't really understand, what I should add as
  ajax target :(
 
  So, I have an abstract class Index where I add all my panels (3) and it
 is
  my masterlayout. I add the panels in the index class like this:
 
  add(new ShoppingCartPanel(id, anotherMehod);
 
  The appropriate Markup has just following tags (ShoppingCartPanel.html):
  wicket:panel
   Content
  /wicketpanel
 
  In the other Page (that inherits from Index) I have implemented the
  AjaxSubmitLink:
 
  add(new AjaxSubmitLink(addtocart) {
 @Override
 protected void onSubmit(AjaxRequestTarget target, Form form) {
 target.addComponent(?);
 
  What I want is, when the link is activated the panel should be updated...
 
  First: I don't really understand what I have add to the addComponent()
  method ?
  Second: Where schould I set setOutputMarupId(true) ?
 
  Thank You!
 



Re: Panel update after Ajax Submit

2011-03-01 Thread Dmitriy Neretin
No, the panel is outside! What I just want, is that the panel shows me the
result of the submit.
But I did it :)

Hier is my solution:

1. Call in the constructor of the panel setOutputMarkUpId(true);
2. Instantiate the panel Class in the abstract Class (masterlayout) as field
and return it back with a simple getter.
3. In the AjaxSubmitLink: target.addComponent(call the getter from an
abstract class);

I don't know, if it was right, but it works now :)

What do the experts mean?

On 1 March 2011 14:04, Pedro Santos pedros...@gmail.com wrote:

 Hi, if you update the panel within the form, you need to update it's submit
 link component outside this panel also.
 onsubmit(target){
  target.addComponent(formPanel);
  target.addComponent(submitLinkNotNestedInsideTheFormPanel);
 }

 On Tue, Mar 1, 2011 at 9:51 AM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Thanks for reply,
 
  If you want to refresh the panel, call setOutputMarkupId(true)  on the
  panel
   , then add the panel to the target.
  
 
  Does it mean I should call setOutputMarkUpId(true) in the constructor of
  the
  panel? If I do so, the layout of the panel is destroyed.
 
 
   If the Ajax Link  is on the same panel, you can call
   this.setOutputMarkupId(true) , and you can also add MyPanel.this to the
   target.
  
 
  No, the link is not on the same panel. This is actually the point that I
  don't really understand. What should I add, if the link not on the panel.
 
 
   The point is , what ever you want to refresh via ajax must have
   outputMarkupId set to true.
  
   Hope that helps.
  
   Josh.
  
   On Tue, Mar 1, 2011 at 11:51 AM, Dmitriy Neretin 
   dmitriy.nere...@googlemail.com wrote:
  
Hello everybody!
   
Hope someone can help me. I don't really understand, what I should
 add
  as
ajax target :(
   
So, I have an abstract class Index where I add all my panels (3) and
 it
   is
my masterlayout. I add the panels in the index class like this:
   
add(new ShoppingCartPanel(id, anotherMehod);
   
The appropriate Markup has just following tags
  (ShoppingCartPanel.html):
wicket:panel
 Content
/wicketpanel
   
In the other Page (that inherits from Index) I have implemented the
AjaxSubmitLink:
   
add(new AjaxSubmitLink(addtocart) {
   @Override
   protected void onSubmit(AjaxRequestTarget target, Form
 form)
  {
   target.addComponent(?);
   
What I want is, when the link is activated the panel should be
  updated...
   
First: I don't really understand what I have add to the
 addComponent()
method ?
Second: Where schould I set setOutputMarupId(true) ?
   
Thank You!
   
  
 



 --
 Pedro Henrique Oliveira dos Santos



Re: Question about Unit Testing with custom Session

2011-02-09 Thread Dmitriy Neretin
Thank you for reply,

yes! And I get then another exception :)

Cannot resolve ServletContextResource without ServletContext

Does andybody know how can I get/set the servletContext?

Dmitriy

On 8 February 2011 18:01, Igor Vaynberg igor.vaynb...@gmail.com wrote:

 did you call context.refresh() ? like the error message said?

 -igor

 On Tue, Feb 8, 2011 at 1:31 AM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Hi,
 
  my complete setUp looks like this:
 
  @Before
 public void setUp() {
 MworldWicketApplication wicketWebApp = new
 MworldWicketApplication()
  {
 
 ApplicationContext ctx = new XmlWebApplicationContext();
 
 @Override
 public void init() {
 addComponentInstantiationListener(new
  SpringComponentInjector(this, ctx, true));
 }
 };
 
 tester = new WicketTester(wicketWebApp);
 pageParams = new HashMapString, String();
 }
 
  So the wickettester instance is created after the Appllication class is
  overriden. Even if I extract the wickettester creation from setup and
 will
  make it in each test (it is actually the same) I have the same problem.
 
  After debuggin the tests I have seen that my appcontext instance was
 created
  and the .xml file was correctly recognized :( But I still get the
  exception...
 
  On 8 February 2011 07:37, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 
  make sure your setup() code runs before wicket tester instance is
 created.
 
  -igor
 
  On Mon, Feb 7, 2011 at 7:41 AM, Dmitriy Neretin
 
 
 

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




Re: Question about Unit Testing with custom Session

2011-02-09 Thread Dmitriy Neretin
Hi,

thank you! Now I know how to get the ServletContext :) But it didn't solve
the main problem. This time I got following exception:

IOException parsing XML document from ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/applicationContext.xml]

This is the right path. The xml file is there. It also schouldn't be a
problem with file system permissions :(

On 9 February 2011 12:57, Attila Király kiralyattila...@gmail.com wrote:

 Hi,

 Try this in your application's #init() method (before calling #refresh() on
 ctx)

 ctx.setServletContext(getServletContext());

 Attila

 2011/2/9 Dmitriy Neretin dmitriy.nere...@googlemail.com

  Thank you for reply,
 
  yes! And I get then another exception :)
 
  Cannot resolve ServletContextResource without ServletContext
 
  Does andybody know how can I get/set the servletContext?
 
  Dmitriy
 
  On 8 February 2011 18:01, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 
   did you call context.refresh() ? like the error message said?
  
   -igor
  
   On Tue, Feb 8, 2011 at 1:31 AM, Dmitriy Neretin
   dmitriy.nere...@googlemail.com wrote:
Hi,
   
my complete setUp looks like this:
   
@Before
   public void setUp() {
   MworldWicketApplication wicketWebApp = new
   MworldWicketApplication()
{
   
   ApplicationContext ctx = new XmlWebApplicationContext();
   
   @Override
   public void init() {
   addComponentInstantiationListener(new
SpringComponentInjector(this, ctx, true));
   }
   };
   
   tester = new WicketTester(wicketWebApp);
   pageParams = new HashMapString, String();
   }
   
So the wickettester instance is created after the Appllication class
 is
overriden. Even if I extract the wickettester creation from setup and
   will
make it in each test (it is actually the same) I have the same
 problem.
   
After debuggin the tests I have seen that my appcontext instance was
   created
and the .xml file was correctly recognized :( But I still get the
exception...
   
On 8 February 2011 07:37, Igor Vaynberg igor.vaynb...@gmail.com
  wrote:
   
make sure your setup() code runs before wicket tester instance is
   created.
   
-igor
   
On Mon, Feb 7, 2011 at 7:41 AM, Dmitriy Neretin
   
   
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 



 --
 I would rather write programs to write programs than write programs.



Re: Question about Unit Testing with custom Session

2011-02-09 Thread Dmitriy Neretin
Thank you it finally works! :)

But what I still don't understand: the problem appeared after I inserted
following in the custom session constructor:

InjectorHolder.getInjector().inject(this);

And why it worked with only one WicketTester constructor parameter (new
MyApplication)? And after Spring integration there schould be 2 parameters?

Thank you!

P.S. My assertion for ServletContext looks like this:

Assert.assertNotNull(tester.getServletSession().getServletContext().getContext(WEB-INF/web.xml));

On 9 February 2011 14:27, Attila Király kiralyattila...@gmail.com wrote:

 The problem is that your test is not actualy running in a servlet
 container,
 only in a wicket mocked servlet context. To access webapp resources in the
 test you have to specify in the second parameter of WicketTester
 constructor
 where your web app's root is. Like this (in a maven project):

 WicketTester tester = new WicketTester(new MockApplication(),
 target/my-webapp-name);

 Assert.assertNotNull(tester.getServletContext().getResource(WEB-INF/web.xml));

 Attila

 2011/2/9 Dmitriy Neretin dmitriy.nere...@googlemail.com

  Hi,
 
  thank you! Now I know how to get the ServletContext :) But it didn't
 solve
  the main problem. This time I got following exception:
 
  IOException parsing XML document from ServletContext resource
  [/WEB-INF/applicationContext.xml]; nested exception is
  java.io.FileNotFoundException: Could not open ServletContext resource
  [/WEB-INF/applicationContext.xml]
 
  This is the right path. The xml file is there. It also schouldn't be a
  problem with file system permissions :(
 
  On 9 February 2011 12:57, Attila Király kiralyattila...@gmail.com
 wrote:
 
   Hi,
  
   Try this in your application's #init() method (before calling
 #refresh()
  on
   ctx)
  
   ctx.setServletContext(getServletContext());
  
   Attila
  
   2011/2/9 Dmitriy Neretin dmitriy.nere...@googlemail.com
  
Thank you for reply,
   
yes! And I get then another exception :)
   
Cannot resolve ServletContextResource without ServletContext
   
Does andybody know how can I get/set the servletContext?
   
Dmitriy
   
On 8 February 2011 18:01, Igor Vaynberg igor.vaynb...@gmail.com
  wrote:
   
 did you call context.refresh() ? like the error message said?

 -igor

 On Tue, Feb 8, 2011 at 1:31 AM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Hi,
 
  my complete setUp looks like this:
 
  @Before
 public void setUp() {
 MworldWicketApplication wicketWebApp = new
 MworldWicketApplication()
  {
 
 ApplicationContext ctx = new
 XmlWebApplicationContext();
 
 @Override
 public void init() {
 addComponentInstantiationListener(new
  SpringComponentInjector(this, ctx, true));
 }
 };
 
 tester = new WicketTester(wicketWebApp);
 pageParams = new HashMapString, String();
 }
 
  So the wickettester instance is created after the Appllication
  class
   is
  overriden. Even if I extract the wickettester creation from setup
  and
 will
  make it in each test (it is actually the same) I have the same
   problem.
 
  After debuggin the tests I have seen that my appcontext instance
  was
 created
  and the .xml file was correctly recognized :( But I still get the
  exception...
 
  On 8 February 2011 07:37, Igor Vaynberg igor.vaynb...@gmail.com
 
wrote:
 
  make sure your setup() code runs before wicket tester instance
 is
 created.
 
  -igor
 
  On Mon, Feb 7, 2011 at 7:41 AM, Dmitriy Neretin
 
 
 


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


   
  
  
  
   --
   I would rather write programs to write programs than write programs.
  
 



Re: Question about Unit Testing with custom Session

2011-02-08 Thread Dmitriy Neretin
Hi,

my complete setUp looks like this:

@Before
public void setUp() {
MworldWicketApplication wicketWebApp = new MworldWicketApplication()
{

ApplicationContext ctx = new XmlWebApplicationContext();

@Override
public void init() {
addComponentInstantiationListener(new
SpringComponentInjector(this, ctx, true));
}
};

tester = new WicketTester(wicketWebApp);
pageParams = new HashMapString, String();
}

So the wickettester instance is created after the Appllication class is
overriden. Even if I extract the wickettester creation from setup and will
make it in each test (it is actually the same) I have the same problem.

After debuggin the tests I have seen that my appcontext instance was created
and the .xml file was correctly recognized :( But I still get the
exception...

On 8 February 2011 07:37, Igor Vaynberg igor.vaynb...@gmail.com wrote:

 make sure your setup() code runs before wicket tester instance is created.

 -igor

 On Mon, Feb 7, 2011 at 7:41 AM, Dmitriy Neretin




Question about Unit Testing with custom Session

2011-02-07 Thread Dmitriy Neretin
Hello everybody,

After integration with spring I have following problem:

if I add following to my CustomSession:

InjectorHolder.getInjector().inject(this); (because I store some spring
beans in the custom session)

My WicketTester doesn't work anymore. I get this exception:
BeanFactory not initialized or already closed - call 'refresh' before
accessing beans via the ApplicationContext

What I have done in my Unit Tests:

@Before
public void setUp() {
MworldWicketApplication wicketWebApp = new MworldWicketApplication()
{

ApplicationContext ctx = new XmlWebApplicationContext();

@Override
public void init() {
addComponentInstantiationListener(new
SpringComponentInjector(this, ctx, true));
}
};

And I don't really understand what to do now :)

Can somebody help me?

P. S. The Application works. Affected are only unit tests


Re: Question about Unit Testing with custom Session

2011-02-07 Thread Dmitriy Neretin
Hi,

of course. The point is if I delete this:

InjectorHolder.getInjector().inject(this);

from my session class everything works fine :(

On 7 February 2011 15:27, Martijn Dashorst martijn.dasho...@gmail.comwrote:

 Did you provide the application to the wicket tester?

 WicketTester tester = new WicketTester(myapp);

 Martijn

 On Mon, Feb 7, 2011 at 2:10 PM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Hello everybody,
 
  After integration with spring I have following problem:
 
  if I add following to my CustomSession:
 
  InjectorHolder.getInjector().inject(this); (because I store some spring
  beans in the custom session)
 
  My WicketTester doesn't work anymore. I get this exception:
  BeanFactory not initialized or already closed - call 'refresh' before
  accessing beans via the ApplicationContext
 
  What I have done in my Unit Tests:
 
  @Before
 public void setUp() {
 MworldWicketApplication wicketWebApp = new
 MworldWicketApplication()
  {
 
 ApplicationContext ctx = new XmlWebApplicationContext();
 
 @Override
 public void init() {
 addComponentInstantiationListener(new
  SpringComponentInjector(this, ctx, true));
 }
 };
 
  And I don't really understand what to do now :)
 
  Can somebody help me?
 
  P. S. The Application works. Affected are only unit tests
 



 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com

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




Re: WicketTester and the test of image visibility

2011-02-04 Thread Dmitriy Neretin
Could you provide me a simple exmaplte how can I do that?

Thank you!

On 3 February 2011 18:33, Igor Vaynberg igor.vaynb...@gmail.com wrote:

 visibility can be triggered from a lot of places, isvisible() only
 checks the visibility flag. the best way to test it is to see if the
 image tag appears in the rendered markup.

 -igor

 On Thu, Feb 3, 2011 at 1:16 AM, Dmitriy Neretin
 dmitriy.nere...@googlemail.com wrote:
  Hello everybody!
 
  Is the WicketTester method isVisible() the right solution to test if the
  Image is shown on the webpage?
 
  Thank you!
 

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




WicketTester and the test of image visibility

2011-02-03 Thread Dmitriy Neretin
Hello everybody!

Is the WicketTester method isVisible() the right solution to test if the
Image is shown on the webpage?

Thank you!


Problem with Wickettester and Maven

2011-02-01 Thread Dmitriy Neretin
Hello everybody,

I have problems with unit testing.
All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't any
problems. Just create a new UnitTest with WicketTester and it worked pretty
fine. Today I changed the project infrastructure to Maven with surifire
plug-in. The problem is following: usual unit test will be executet without
failures but not the tests with wickettester. Surifire report showed me
following exception:

java.lang.
NoClassDefFoundError: javax/servlet/http/HttpSession
   at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
   at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
   at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
   at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
   at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
   at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
   at $Proxy0.invoke(Unknown Source)
   at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
   at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
   at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSession
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   ... 30 more

The test itself is very simple: it checkt if the start page will be
rendered. Nothing more.

Any ideas?

Thank you!


Re: Problem with Wickettester and Maven

2011-02-01 Thread Dmitriy Neretin
I don't really understand how to do that?

On 1 February 2011 14:46, Pedro Santos pedros...@gmail.com wrote:

 You need to add the test or provided scope servlet-api dependency in your
 project pom

 On Tue, Feb 1, 2011 at 11:11 AM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hello everybody,
 
  I have problems with unit testing.
  All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't
 any
  problems. Just create a new UnitTest with WicketTester and it worked
 pretty
  fine. Today I changed the project infrastructure to Maven with surifire
  plug-in. The problem is following: usual unit test will be executet
 without
  failures but not the tests with wickettester. Surifire report showed me
  following exception:
 
  java.lang.
  NoClassDefFoundError: javax/servlet/http/HttpSession
at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
 
 
 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
 
 
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
 
 
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
 
 
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
 
 
 org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at
  org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
  Caused by: java.lang.ClassNotFoundException:
 javax.servlet.http.HttpSession
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 30 more
 
  The test itself is very simple: it checkt if the start page will be
  rendered. Nothing more.
 
  Any ideas?
 
  Thank you!
 



 --
 Pedro Henrique Oliveira dos Santos



Re: Problem with Wickettester and Maven

2011-02-01 Thread Dmitriy Neretin
Oh sorry!!! It works now! Thank you!

I should add this to my pom:

dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.4/version
scopeprovided/scope
/dependency

On 1 February 2011 14:51, Dmitriy Neretin dmitriy.nere...@googlemail.comwrote:

 I don't really understand how to do that?


 On 1 February 2011 14:46, Pedro Santos pedros...@gmail.com wrote:

 You need to add the test or provided scope servlet-api dependency in your
 project pom

 On Tue, Feb 1, 2011 at 11:11 AM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hello everybody,
 
  I have problems with unit testing.
  All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't
 any
  problems. Just create a new UnitTest with WicketTester and it worked
 pretty
  fine. Today I changed the project infrastructure to Maven with surifire
  plug-in. The problem is following: usual unit test will be executet
 without
  failures but not the tests with wickettester. Surifire report showed me
  following exception:
 
  java.lang.
  NoClassDefFoundError: javax/servlet/http/HttpSession
at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
 
 
 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
 
 
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
 
 
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
 
 
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
 
 
 org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at
  org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
  Caused by: java.lang.ClassNotFoundException:
 javax.servlet.http.HttpSession
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 30 more
 
  The test itself is very simple: it checkt if the start page will be
  rendered. Nothing more.
 
  Any ideas?
 
  Thank you!
 



 --
 Pedro Henrique Oliveira dos Santos





Question about the Page state

2010-12-28 Thread Dmitriy Neretin
Hello everybody,

The question isn't really simple :)
So, the official documentation says (
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/RequestCycle.html):

1) A page that does not yet exist in a user Session may be encoded as a URL
that references the not-yet-created page by class name.

/[Application]?bookmarkablePage=[classname][param]=[value] [...]

2) Stateful pages (that have already been requested by a user) will be
present in the user's Session and can be referenced securely with a
session-relative number:

/[Application]?wicket:interface=[pageMapName]:[pageId]:

...

Does it actually mean, that in the second situation the page isn't
bookmarkable?

But my question is: where is the state of the page stored? In the Session?
In the pageMap? Where is the pageMap stored and when is it created?

I hope somebody could help me :)

Thanks!


Re: Question about the Page state

2010-12-28 Thread Dmitriy Neretin
Thank you! I am quite happy with it :)

Bye

On 28 December 2010 21:34, Martin Grigorov mgrigo...@apache.org wrote:

 Hi Dmitri,

 I suggest you to take a look at these two pages:
 https://cwiki.apache.org/WICKET/page-maps.html
 https://cwiki.apache.org/WICKET/page-maps.html

 https://cwiki.apache.org/WICKET/request-cycle-and-request-cycle-processor.html

 
 https://cwiki.apache.org/WICKET/request-cycle-and-request-cycle-processor.html
 
 martin-g

 On Tue, Dec 28, 2010 at 9:27 PM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hello everybody,
 
  The question isn't really simple :)
  So, the official documentation says (
  http://wicket.apache.org/apidocs/1.4/org/apache/wicket/RequestCycle.html
 ):
 
  1) A page that does not yet exist in a user Session may be encoded as a
 URL
  that references the not-yet-created page by class name.
 
  /[Application]?bookmarkablePage=[classname][param]=[value] [...]
 
  2) Stateful pages (that have already been requested by a user) will be
  present in the user's Session and can be referenced securely with a
  session-relative number:
 
  /[Application]?wicket:interface=[pageMapName]:[pageId]:
 
  ...
 
  Does it actually mean, that in the second situation the page isn't
  bookmarkable?
 
  But my question is: where is the state of the page stored? In the
 Session?
  In the pageMap? Where is the pageMap stored and when is it created?
 
  I hope somebody could help me :)
 
  Thanks!