markup not found exception for fragment which is part of wicket:extend

2013-07-03 Thread Rakesh A
Hi,

I am using Wicket v6.5.0, I've code where wicket fragments are part of
'' tag and I get exception that Markup is not found for the
fragment, same piece of code works in Wicket v1.4.21.

I created & attached a quick start with code similar to my case.

fragmentTest.zip
  

Regards,
Rakesh.A



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/markup-not-found-exception-for-fragment-which-is-part-of-wicket-extend-tp4660037.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



ConfirmAjaxFallbackLink with LoadableDetachableModel

2013-07-03 Thread Vignesh Palanisamy
Hi all,

I have  a ConfirmAjaxFallbackLink which is use to display confirmation
dialog, when a user attempts to delete an item in a datatable.

public abstract class ConfirmAjaxFallbackLink extends AjaxFallbackLink
{
private String confirmMessage;
private IModel confirmMessageModel;


public ConfirmAjaxFallbackLink(String id, String confirmMessage)
{
super(id);
this.confirmMessage = confirmMessage;
}

public ConfirmAjaxFallbackLink(String id, IModel messageModel)
{
super(id, messageModel);
this.confirmMessageModel = messageModel;
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);
AjaxCallListener ajaxCallListener = new AjaxCallListener();
if (confirmMessage != null) {
ajaxCallListener.onPrecondition(new
JavaScriptEventConfirmation(confirmMessage).getBeforeHandler(this));
} else {
ajaxCallListener.onPrecondition(new
JavaScriptEventConfirmation(confirmMessageModel.getObject()).getBeforeHandler(this));
}
attributes.getAjaxCallListeners().add(ajaxCallListener);
}

@Override
public abstract void onClick(AjaxRequestTarget target);
}



it works fine with static message and static model


but i want to load the message dynamically. so i use LoadableDetachableModel

like this

new ConfirmAjaxFallbackLink("deleteItemLink", new
LoadableDetachableModel()
{
@Override
protected String load()
{
List activeUsages =
findActiveUsages();
if (activeUsages.size() > 0) {
return "This item is actively used in "
+activeUsages +", Do you still want to delete it?";
}
return "Do you want delete?"
}
})
{
@Override
public void onClick(AjaxRequestTarget target)
{
onDelete(target);
}
};


But it doesn't load dynamically. while we refresh the page only it loading.


can you have any idea about it.



Thanks,
Vignesh


Re: Feedback message is not available for behaviors added to nested form components

2013-07-03 Thread James Selvakumar
Hi Jesse,

I was not aware of this before. Thanks for the insight
But I do add/remove components to the ListView dynamically.
Will ListView#setReuseItems(true) affect that?


On Wed, Jul 3, 2013 at 3:12 PM, Jesse Long  wrote:

> Hi James,
>
> This is a shortened list of events happening, including only the ones
> affecting you. They are in the order in which they occur.
>
>  * IFormSubmitListener#**onFormSubmitted()
>  * ListView#onBeforeRender()
>  * Page#onRender()
>
> ListView#onBeforeRender() calls ListView#onPopulate(). If you are not
> using ListView#setReuseItems(true), then ListView#onPopulate() removes all
> children of ListView and re-creates them.
>
> So, the children of ListView that are present during Page#onRender() are
> not the same children that were present during 
> IFormSubmitListener#**onFormSubmitted(),
> and hence not the same children that had the feedback messages.
>
> Cheers,
> Jesse
>
>
> On 03/07/2013 02:35, James Selvakumar wrote:
>
>> No.
>>
>>
>> On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:
>>
>>  Are you using listView.setReuseItems(true) ?
>>>
>>> Sven
>>>
>>>
>>> On 07/02/2013 11:13 AM, James Selvakumar wrote:
>>>
>>>  Hi all,

 I've the following component heirarchy:

 form:textField
 form:listView:panel-1:panel1DropDownChoice

 form:submitButton

 I've marked the all the form components as required.

 I also have a behavior that is added to all the form components (via
 IVisitor) which will make the respective feedback messages appear under
 the
 form components.

 It works perfectly for the form component "texField" which is directly
 attached to the form.

 However it doesn't work for for "panel1DropDownChoice".

 I've added some debug messages in the "validate()" method of
 "panel1DropDownChoice" and found that feedback messages are indeed
 generated.

 However from the debug messages in my behavior, I found that feedback
 messages were some how lost.

 This is the behavior I'm using. (Thanks London Wicket users)

 *public class ValidationMsgBehavior extends Behavior

 {
   private static Logger logger =
 LoggerFactory.getLogger(ValidationMsgBehavior.class);


   @Override
   public void afterRender(Component c)
   {
   logger.debug("Preparing to add validation msg for the
 component
 {}", c);
   FormComponent fc = (FormComponent) c;
   if (!fc.isValid()) {
   String error;
   if (fc.hasFeedbackMessage()) {
   logger.debug("Form component {} has feedback
 messages",
 fc);
   error =
 fc.getFeedbackMessages().first(FeedbackMessage.ERROR).

 getMessage().toString();
   } else {
   error = "Your input is invalid.";
   }
   fc.getResponse().write(
   "" + error + "");
   }else{
   logger.debug("Form component {} is valid", fc);
   }
   }
 }*

 Any clues? I've been trying to crack this for a whole day.


  --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>


-- 
Thanks & regards
James Selvakumar
mCruncher


Re: fault in tree view

2013-07-03 Thread Piratenvisier
If you open the stucture in beginners view you have an other sequence of 
nodes than in advanced nested view
Follow the path A AB ABB ABBA ABBB ABBBA ABC ABD AC in advanced nested 
view and try to follow it in beginners view.


Am 03.07.2013 22:53, schrieb Sven Meier:

Hi,

can you please explain how the branch is faulty or 'wrong'?

You can override NestedTree#newContentComponent(String, IModel) to 
decide the representation of a node's content:


  MyNestedTree extends NestedTree {
@Override
public Component newContentComponent(String id, final 
AbstractTree tree, IModel model)

{
return new Folder(id, tree, model)
{
private static final long serialVersionUID = 1L;

@Override
protected MarkupContainer newLinkComponent(String id, 
IModel model)

{
Foo foo = model.getObject();

if (tree.getProvider().hasChildren(foo))
{
return super.newLinkComponent(id, model);
}
else
{
PageParameters parameters = new PageParameters();
parameters.add("foo", foo.getId());

return new BookmarkablePageLink(id, 
tree.getPage().getClass(), parameters);

}
}
};
}
  }

Hope this helps
Sven


On 07/03/2013 10:24 PM, Piratenvisier wrote:

When you look at the tree structure in advanced nested view
there is a wrong branch A AB ABB ABBA ABBB ABBBA ABC ABD AC
I would like to use a tree structure where the nodes are links to 
wicket pages

or where you can open a nodes panel in accordion style

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




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




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



Re: fault in tree view

2013-07-03 Thread Sven Meier

Hi,

can you please explain how the branch is faulty or 'wrong'?

You can override NestedTree#newContentComponent(String, IModel) to 
decide the representation of a node's content:


  MyNestedTree extends NestedTree {
@Override
public Component newContentComponent(String id, final 
AbstractTree tree, IModel model)

{
return new Folder(id, tree, model)
{
private static final long serialVersionUID = 1L;

@Override
protected MarkupContainer newLinkComponent(String id, 
IModel model)

{
Foo foo = model.getObject();

if (tree.getProvider().hasChildren(foo))
{
return super.newLinkComponent(id, model);
}
else
{
PageParameters parameters = new PageParameters();
parameters.add("foo", foo.getId());

return new BookmarkablePageLink(id, 
tree.getPage().getClass(), parameters);

}
}
};
}
  }

Hope this helps
Sven


On 07/03/2013 10:24 PM, Piratenvisier wrote:

When you look at the tree structure in advanced nested view
there is a wrong branch A AB ABB ABBA ABBB ABBBA ABC ABD AC
I would like to use a tree structure where the nodes are links to 
wicket pages

or where you can open a nodes panel in accordion style

-
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: How to call Java Function from JavaScript

2013-07-03 Thread Andun Sameera
Thanks Bas! I have fixed the problem.

On Thu, Jul 4, 2013 at 1:10 AM, Bas Gooren  wrote:

> Wicket's ajax functions require you to load the wicket ajax javascript.
>
> This is handled by the AbstractDefaultAjaxBahavior out of the box.
> However, since you do not call super.renderHead(component,**response) in
> your code, the required javascript files are not loaded.
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 3-7-2013 19:09, schreef Andun Sameera:
>
>  Hi All,
>>
>> I have looked in to this topic in many places and found some ways. In this
>> particular scenario, I have used
>> https://cwiki.apache.org/**confluence/display/WICKET/**
>> Calling+Wicket+from+**Javascriptarticle
>> as the reference.
>>
>> What I did in Java,
>>
>> public class HomePage extends WebPage {
>>  private static final long serialVersionUID = 1L;
>>
>>  public HomePage(final PageParameters parameters) {
>>  super(parameters);
>>
>>
>>  final AbstractDefaultAjaxBehavior behave = new
>> AbstractDefaultAjaxBehavior() {
>>  protected void respond(final AjaxRequestTarget target) {
>>  target.add(new Label("foo", "Yeah I was just called from
>> Javascript!"));
>>  }
>>
>>  public void renderHead(Component component,IHeaderResponse
>> response){
>>
>>  String componentMarkupId = component.getMarkupId();
>>  String callbackUrl = getCallbackUrl().toString();
>>
>>  response.render(**JavaScriptHeaderItem.**forScript("var
>> componentMarkupId='"+**componentMarkupId+"'; var
>> callbackUrl='"+callbackUrl+"';**","values"));
>>  }
>>  };
>>
>>  add(behave);
>>
>>  }
>>
>> }
>>
>> and my HomePage.html,
>>
>> 
>> 
>> 
>> http://ajax.googleapis.**com/ajax/libs/jquery/1.6.1/**
>> jquery.min.js<http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js>
>> ">
>> 
>>  $(function() {
>>  var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' });
>>  alert(wcall);
>>  });
>> 
>> 
>> 
>>
>> What I tried to do is call the get ajax method using the vars I have
>> initialized. But when my page loads, in the firebug console it says,
>>
>> ReferenceError: Wicket is not defined
>> [Break On This Error]
>>
>> var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' });
>>
>> What has gone wrong here ?
>>
>> Is there any other good way to call Java Function from Javascript?
>>
>> Thanks!
>>
>>
>


-- 
Regards
Andun S.L. Gunawardana
Undergraduate
Department of Computer Science And Engineering
University of Moratuwa
Sri Lanka

Blog - http://www.insightforfuture.blogspot.com/
LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703
Twitter -http://twitter.com/AndunSLG


fault in tree view

2013-07-03 Thread Piratenvisier

When you look at the tree structure in advanced nested view
there is a wrong branch A AB ABB ABBA ABBB ABBBA ABC ABD AC
I would like to use a tree structure where the nodes are links to wicket 
pages

or where you can open a nodes panel in accordion style

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



Re: How to call Java Function from JavaScript

2013-07-03 Thread Bas Gooren

Wicket's ajax functions require you to load the wicket ajax javascript.

This is handled by the AbstractDefaultAjaxBahavior out of the box.
However, since you do not call super.renderHead(component,response) in 
your code, the required javascript files are not loaded.


Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 3-7-2013 19:09, schreef Andun Sameera:

Hi All,

I have looked in to this topic in many places and found some ways. In this
particular scenario, I have used
https://cwiki.apache.org/confluence/display/WICKET/Calling+Wicket+from+Javascriptarticle
as the reference.

What I did in Java,

public class HomePage extends WebPage {
 private static final long serialVersionUID = 1L;

 public HomePage(final PageParameters parameters) {
 super(parameters);


 final AbstractDefaultAjaxBehavior behave = new
AbstractDefaultAjaxBehavior() {
 protected void respond(final AjaxRequestTarget target) {
 target.add(new Label("foo", "Yeah I was just called from
Javascript!"));
 }

 public void renderHead(Component component,IHeaderResponse
response){

 String componentMarkupId = component.getMarkupId();
 String callbackUrl = getCallbackUrl().toString();

 response.render(JavaScriptHeaderItem.forScript("var
componentMarkupId='"+componentMarkupId+"'; var
callbackUrl='"+callbackUrl+"';","values"));
 }
 };

 add(behave);

 }

}

and my HomePage.html,




http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
">

 $(function() {
 var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' });
 alert(wcall);
 });




What I tried to do is call the get ajax method using the vars I have
initialized. But when my page loads, in the firebug console it says,

ReferenceError: Wicket is not defined
[Break On This Error]

var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' });

What has gone wrong here ?

Is there any other good way to call Java Function from Javascript?

Thanks!





How to call Java Function from JavaScript

2013-07-03 Thread Andun Sameera
Hi All,

I have looked in to this topic in many places and found some ways. In this
particular scenario, I have used
https://cwiki.apache.org/confluence/display/WICKET/Calling+Wicket+from+Javascriptarticle
as the reference.

What I did in Java,

public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;

public HomePage(final PageParameters parameters) {
super(parameters);


final AbstractDefaultAjaxBehavior behave = new
AbstractDefaultAjaxBehavior() {
protected void respond(final AjaxRequestTarget target) {
target.add(new Label("foo", "Yeah I was just called from
Javascript!"));
}

public void renderHead(Component component,IHeaderResponse
response){

String componentMarkupId = component.getMarkupId();
String callbackUrl = getCallbackUrl().toString();

response.render(JavaScriptHeaderItem.forScript("var
componentMarkupId='"+componentMarkupId+"'; var
callbackUrl='"+callbackUrl+"';","values"));
}
};

add(behave);

}

}

and my HomePage.html,




http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
">

$(function() {
var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' });
alert(wcall);
});




What I tried to do is call the get ajax method using the vars I have
initialized. But when my page loads, in the firebug console it says,

ReferenceError: Wicket is not defined
[Break On This Error]

var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' });

What has gone wrong here ?

Is there any other good way to call Java Function from Javascript?

Thanks!

-- 
Regards
Andun S.L. Gunawardana
Undergraduate
Department of Computer Science And Engineering
University of Moratuwa
Sri Lanka

Blog - http://www.insightforfuture.blogspot.com/
LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703
Twitter -http://twitter.com/AndunSLG


RE: Double validation in textfield

2013-07-03 Thread Lemke, Michael SZ/HZA-ZSW
On Wednesday, July 03, 2013 4:02 PM, Sven Meier wrote:
>
>http://stackoverflow.com/questions/15809225/java-numberformat-ignoring-comma-in-us-locale
>
>i.e. a grouping separator can be at any position *between* digits.

Thanks. Whoever came up with that idea...  Oh well.

Michael

>
>On 07/03/2013 03:45 PM, Lemke, Michael SZ/HZA-ZSW wrote:
>> We've seen some strange behavior with TextField, which you
>> can easily verify on http://www.wicket-library.com/wicket-examples/forminput
>>
>> In an English locale enter into the Double field:
>>
>> 6.5 result: 6.5
>> 6,4 result: 64
>> 6,4 result: 64
>> 6,4, result: '6,4,' is not a valid Double.
>>
>> Why does it accept stuff like 6,4?  I don't think this is expected
>> behavior.
>>
>> Thanks for any insight,
>> Michael
>>


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



Re: Double validation in textfield

2013-07-03 Thread Sven Meier

http://stackoverflow.com/questions/15809225/java-numberformat-ignoring-comma-in-us-locale

i.e. a grouping separator can be at any position *between* digits.

Sven

On 07/03/2013 03:45 PM, Lemke, Michael SZ/HZA-ZSW wrote:

We've seen some strange behavior with TextField, which you
can easily verify on http://www.wicket-library.com/wicket-examples/forminput

In an English locale enter into the Double field:

6.5 result: 6.5
6,4 result: 64
6,4 result: 64
6,4, result: '6,4,' is not a valid Double.

Why does it accept stuff like 6,4?  I don't think this is expected
behavior.

Thanks for any insight,
Michael


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




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



Double validation in textfield

2013-07-03 Thread Lemke, Michael SZ/HZA-ZSW
We've seen some strange behavior with TextField, which you 
can easily verify on http://www.wicket-library.com/wicket-examples/forminput 

In an English locale enter into the Double field:

6.5 result: 6.5
6,4 result: 64
6,4 result: 64
6,4, result: '6,4,' is not a valid Double.

Why does it accept stuff like 6,4?  I don't think this is expected
behavior.

Thanks for any insight,
Michael


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



Re: cryptic error messages [SOLVED]

2013-07-03 Thread Sven Meier

Hi,

the dot is a leftover from the days when Wicket used '.' to separate 
component paths.


I've fixed the exception message to use PATH_SEPARATOR, i.e. ':'

Thanks
Sven

On 07/03/2013 01:17 PM, Lucio Crusca wrote:

I've found that between this line of code:

RepeatingView rv = new RepeatingView("repeatingDocTypes");

and these ones:

for (...)
  addDocTypeBox(rv, docs);

I actually had an extra rv.newChildId() hidden in calls which obviously bumped
the next id value...

Still I can't understand the dot Vs/ column reason, but I guess I can consider
them equivalent, right?


-
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: Save place to set http response status?

2013-07-03 Thread Martin Funk
Besides the 'non' buffering trait of the BufferedWebResponse it is a little
irritating, that the 'setStatus(int)' method doesn't signal if its
execution is not successfull.

Though locking into code like: org.apache.catalina.connector.ResponseFacade
of Tomcat shows that it doesn't signal anything either.
[...]
public void setStatus(int sc) {

if (isCommitted())
return;

response.setStatus(sc);

}
[...]

even the JavaDoc of oracle isn't helpful:
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#setStatus(int)
it only gives a statement on
http://docs.oracle.com/javaee/6/api/javax/servlet/ServletResponse.html#reset()
which should throw a IllegalStateException - if the response has already
been committed
http://docs.oracle.com/javaee/6/api/javax/servlet/ServletResponse.html#isCommitted()

If it were up to me, I'd of course would like to have both.
Wicket guaranteeing that the status can be set up till 'onDetach()'
and also a signal if setStatus was not successfull.
;-)

Martin


2013/7/3 Martin Grigorov 

> Correct.
>
>
> On Wed, Jul 3, 2013 at 10:29 AM, Sven Meier  wrote:
>
> > Yes, WebPageRenderer renders the page into a BufferedWebResponse. But
> > after that it writes it into the response of the RequestCycle:
> >
> > response.writeTo((WebResponse)**requestCycle.getResponse());
> >
>
> By default REDIRECT_TO_BUFFER strategy is used so all this happens in the
> second http request cycle.
> But for all other cases in WebPageRenderer you are right.
>
>
> >
> > That's the point of no return.
> >
> > By default the RequestCycle's response is a ServletWebResponse nested in
> a
> > HeaderBufferingWebResponse. So only headers are buffered until the first
> > content is written.
> >
> > ServletWebResponse#flush() just forwards to
> HttpServletResponse#**flushBuffer(),
> > no buffering involved there.
> >
>
> Yep. No buffering by Wicket, but still the flush is needed for the
> buffering done by the servlet container.
>
>
> >
> > Sven
> >
> >
> >
> > On 07/03/2013 09:19 AM, Martin Grigorov wrote:
> >
> >> On Wed, Jul 3, 2013 at 10:02 AM, Sven Meier  wrote:
> >>
> >>  HttpServletResponse has no data to push until the very end of the
> >>>
>  request cycle.
> 
>   That's not quite right:
> >>> As soon as WebPageRenderer writes the buffered page into the real
> >>> response, Tomcat has something to flush. If it does flush (for whatever
> >>> reason), any additional header set
> >>>
> >>
> >> Can you paste the code that does this in WebPageRenderer ?
> >>
> >> AFAIK org.apache.wicket.protocol.**http.servlet.**
> >> ServletWebResponse#flush()
> >> makes the transfer from the BufferedWebResponse to HttpServletResponse.
> >>
> >>
> >>  in #onEndRequest() might be ignored.
> >>>
> >>> Sven
> >>>
> >>>
> >>>
> >>> On 07/03/2013 03:52 AM, Martin Grigorov wrote:
> >>>
> >>>  Hi,
> 
>  org.apache.wicket.markup.html.WebPage#configureResponse() is a
> good
> 
>  place
>  for this.
> 
>  Wicket buffers the response so Tomcat cannot flush it no matter the
>  size.
>  I.e. the HttpServletResponse has no data to push until the very end of
>  the
>  request cycle.
> 
> 
>  On Tue, Jul 2, 2013 at 5:07 PM, Martin Funk 
>  wrote:
> 
>    Hi there,
> 
> > what is the best place to set http response state?
> >
> > I was trying the 'onSomething' callback methods in
> > IRequestCycleListener
> > Like onEndRequest
> >
> > But sometimes those get ignored
> >
> > The last save place I figured was onAfterRender in the page class,
> but
> > this
> > doesn't feel right.
> >
> > The reason that calls like:
> > ((HttpServletResponse)
> > RequestCycle.get().getResponse().getContainerResponse()).**
> >
> > setStatus(404);
> > in the RequestCycle Listner are ignored seems to be that the
> underlying
> > container, Tomcat 6.0.37 in our case, starts to flush the
> outputstream
> > as
> > the Response becomes big, as in maybe 20k.
> >
> > If the response is small enoug the status, can be set in the
> > 'onDetach()'
> >
> > Anyone any ideas?
> >
> > Martin
> >
> >
> >  --**
> >>> --**-
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<
> http://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
> >
> >
>


Re: Strict date pattern for DateTextField in Wicket

2013-07-03 Thread francois meillet
search StrictPatternDateConverter in the forum

François


On Wed, Jul 3, 2013 at 12:21 PM, Jayakrishnan R  wrote:

> Hi All,
>
> I have a DateTextField component in my application and I want the input of
> date using a predefined pattern. The pattern that I need is "-MM-dd". I
> created the DateTextField using the following code.
>
> DateTextField dtf_ExpiryDate =
> DateTextField.forDatePattern("ExpDate", "-MM-dd");
> dtf_ExpiryDate.add(new DatePicker());
>
> It helps to prevent date input in most of other formats. But it accepts
> input in dd-MM- format and converts it into some weird format. For
> example, *12-06-2013* is automatically converted to *0012-06-20*.
>
> Is there a way to throw an error when the date is given in dd-MM- ?
>
> Javadocs of DateTextField<
> http://wicket.apache.org/apidocs/1.4/org/apache/wicket/datetime/markup/html/form/DateTextField.html
> >says
> that the conversion is done internally using the Joda time parser. Is
> there a way to add more constraints ?
>
> I really don't want the data to be captured as String and add a
> StringValidator to check if it confirms to the pattern using Regex.
>
> Thank you
>
> --
> Thanks & Regards
> JK
>


Re: cryptic error messages [SOLVED]

2013-07-03 Thread Lucio Crusca
I've found that between this line of code:
>RepeatingView rv = new RepeatingView("repeatingDocTypes");

and these ones:
>for (...)
>  addDocTypeBox(rv, docs);

I actually had an extra rv.newChildId() hidden in calls which obviously bumped 
the next id value...

Still I can't understand the dot Vs/ column reason, but I guess I can consider 
them equivalent, right?


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



cryptic error messages

2013-07-03 Thread Lucio Crusca
Hi *,

I have the following markup snippet:


  Orders
  
  

  


which is bound to this code snippet:

[...]
   RepeatingView rv = new RepeatingView("repeatingDocTypes");
   for (...)
 addDocTypeBox(rv, docs);


  private void addDocTypeBox(RepeatingView rv, List docs)
  {
AbstractItem i = new AbstractItem(rv.newChildId());
i.add(new Label("docTypeName", getDocTypeDescription());
RepeatingView rdr = new RepeatingView("repeatingDocRef");
i.add(rdr);

for (Document d: docs)
{
  AbstractItem docsummary = new AbstractItem(rdr.newChildId());
  Link l = new Link("doclink")
  {
 ...
  };
  docsummary.add(l);
  l.add(createSummaryPanel("docid", d));
  rdr.add(docsummary);
}

rv.add(i);
  }

Please note that the two for loops execute just 1 iteration each with my 
current test data.

I get the following exception:

Last cause: Unable to find component with id 'docTypeName' in [AbstractItem 
[Component id = 1]]
Expected: 'footerPanel:repeatingDocTypes:1.docTypeName'.
Found with similar names: 'footerPanel:repeatingDocTypes:2:docTypeName'

which does shed some light on what's going on, but I find it hard to understand 
what do "1.docTypeName" and "2:docTypeName" mean. Where did those "1" and "2" 
come from? What information do they give me in order to spot the bug? Why is 
"1" followed by a dot while "2" is followed by a column?

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



Strict date pattern for DateTextField in Wicket

2013-07-03 Thread Jayakrishnan R
Hi All,

I have a DateTextField component in my application and I want the input of
date using a predefined pattern. The pattern that I need is "-MM-dd". I
created the DateTextField using the following code.

DateTextField dtf_ExpiryDate =
DateTextField.forDatePattern("ExpDate", "-MM-dd");
dtf_ExpiryDate.add(new DatePicker());

It helps to prevent date input in most of other formats. But it accepts
input in dd-MM- format and converts it into some weird format. For
example, *12-06-2013* is automatically converted to *0012-06-20*.

Is there a way to throw an error when the date is given in dd-MM- ?

Javadocs of 
DateTextFieldsays
that the conversion is done internally using the Joda time parser. Is
there a way to add more constraints ?

I really don't want the data to be captured as String and add a
StringValidator to check if it confirms to the pattern using Regex.

Thank you

-- 
Thanks & Regards
JK


Re: wickettester and wizard next step submit response

2013-07-03 Thread ludo_xiv
Thanks a lot.
IT WORKS now.

:)

- Pôvodná správa -
Od: "Paul Bors" 
Komu: users@wicket.apache.org
Odoslané: utorok, 2. júl 2013 20:15:38
Predmet: RE: wickettester and wizard next step submit response

If you read the API docs for the FromTester you'll find out that you can only 
submit it once.
After that you need to grab a new FormTester and submit it again.

As such, on each step of your wizard you should create a new FormTester and 
submit it using the corresponding button, not invoking the Button.onSumit() but 
by calling gormTester.submit(myNextOrFinishButtonPath).

This is a small example on how I complete a wizard step:
private void completeUserGroupDetailsStep(ConsoleWicketTester tester) {
FormTester formTester = getHelper().getWizardFormTester(tester);
tester.setValue(formTester, tester.findComponent("**:name", 
TextField.class),   testUserGroup.getName());
tester.setValue(formTester, tester.findComponent("**:description",  
TextArea.class),testUserGroup.getDescription());
tester.submit(formTester, getHelper().getWizardNextButton(tester), 
false); // same as FormTester.submit()
tester.assertRenderedPage(EditUserGroupPage.class);
tester.assertNoErrorMessage();
tester.cleanupFeedbackMessages();
}

Where tester.submit takes in a reference to a FormTester and invokes its 
sumit() method after a bunch of asserts which I won't bore you with right now. 
However, I'll be nice and share my wizard helper methods to give you an idea :)

/
//   Wizard Methods//
/

/** @see #getWizardFormTester(ConsoleWicketTester, String) */
public FormTester getWizardFormTester(ConsoleWicketTester tester) {
return getWizardFormTester(tester, "wizard");
}
/**
 * Given the Wicket id for the Wizard, return a {@link FormTester} to it
 * @param tester{@link ConsoleWicketTester} within the page 
context
 * @param wizardId  Wicket id for the Wizard
 * @return  The {@link FormTester} for the given Wizard
 */
public FormTester getWizardFormTester(ConsoleWicketTester tester, String 
wizardId) {
Form form = (Form)tester.findComponent("**:"+wizardId+":form", 
Form.class);
return tester.newFormTester(form);
}

/** @see #getWizardPreviousButton(ConsoleWicketTester, String) */
public Button getWizardPreviousButton(ConsoleWicketTester tester) {
return getWizardPreviousButton(tester, "wizard");
}
/**
 * Given the Wicket id for the Wizard, return its {@link PreviousButton}
 * @param tester{@link ConsoleWicketTester} within the page 
context
 * @param wizardId  Wicket id for the Wizard
 * @return  {@link PreviousButton} down cast to a {@link 
Button}
 */
public Button getWizardPreviousButton(ConsoleWicketTester tester, String 
wizardId) {
return 
(PreviousButton)tester.findComponent("**:"+wizardId+":**:buttons:previous", 
PreviousButton.class);
}

/** @see #getWizardCancelButton(ConsoleWicketTester, String) */
public Button getWizardCancelButton(ConsoleWicketTester tester) {
return getWizardCancelButton(tester, "wizard");
}
/**
 * Given the Wicket id for the Wizard, return its {@link CancelButton}
 * @param tester{@link ConsoleWicketTester} within the page 
context
 * @param wizardId  Wicket id for the Wizard
 * @return  {@link CancelButton} down cast to a {@link 
Button}
 */
public Button getWizardCancelButton(ConsoleWicketTester tester, String 
wizardId) {
return 
(CancelButton)tester.findComponent("**:"+wizardId+":**:buttons:cancel", 
CancelButton.class);
}

/** @see #getWizardNextButton(ConsoleWicketTester, String) */
public Button getWizardNextButton(ConsoleWicketTester tester) {
return getWizardNextButton(tester, "wizard");
}
/**
 * Given the Wicket id for the Wizard, return its {@link NextButton}
 * @param tester{@link ConsoleWicketTester} within the page 
context
 * @param wizardId  Wicket id for the Wizard
 * @return  {@link NextButton} down cast to a {@link Button}
 */
public Button getWizardNextButton(ConsoleWicketTester tester, String 
wizardId) {
return 
(NextButton)tester.findComponent("**:"+wizardId+":**:buttons:next", 
NextButton.class);
}

/** @see #getWizardFinishButton(ConsoleWicketTester, String) */
public Button getWizardFinishButton(ConsoleWicketTester tester) {
return getWizardFinishButton(tester, "wizard");
}
/**
 * Given the Wicket id for the Wizard, return its {@link MyFinishButton}
 * @param tester{@link ConsoleWicketTester} within the page 
context
 * @param wizardId  Wicket id for the Wizard
 * @return

Re: Save place to set http response status?

2013-07-03 Thread Martin Grigorov
Correct.


On Wed, Jul 3, 2013 at 10:29 AM, Sven Meier  wrote:

> Yes, WebPageRenderer renders the page into a BufferedWebResponse. But
> after that it writes it into the response of the RequestCycle:
>
> response.writeTo((WebResponse)**requestCycle.getResponse());
>

By default REDIRECT_TO_BUFFER strategy is used so all this happens in the
second http request cycle.
But for all other cases in WebPageRenderer you are right.


>
> That's the point of no return.
>
> By default the RequestCycle's response is a ServletWebResponse nested in a
> HeaderBufferingWebResponse. So only headers are buffered until the first
> content is written.
>
> ServletWebResponse#flush() just forwards to 
> HttpServletResponse#**flushBuffer(),
> no buffering involved there.
>

Yep. No buffering by Wicket, but still the flush is needed for the
buffering done by the servlet container.


>
> Sven
>
>
>
> On 07/03/2013 09:19 AM, Martin Grigorov wrote:
>
>> On Wed, Jul 3, 2013 at 10:02 AM, Sven Meier  wrote:
>>
>>  HttpServletResponse has no data to push until the very end of the
>>>
 request cycle.

  That's not quite right:
>>> As soon as WebPageRenderer writes the buffered page into the real
>>> response, Tomcat has something to flush. If it does flush (for whatever
>>> reason), any additional header set
>>>
>>
>> Can you paste the code that does this in WebPageRenderer ?
>>
>> AFAIK org.apache.wicket.protocol.**http.servlet.**
>> ServletWebResponse#flush()
>> makes the transfer from the BufferedWebResponse to HttpServletResponse.
>>
>>
>>  in #onEndRequest() might be ignored.
>>>
>>> Sven
>>>
>>>
>>>
>>> On 07/03/2013 03:52 AM, Martin Grigorov wrote:
>>>
>>>  Hi,

 org.apache.wicket.markup.html.WebPage#configureResponse() is a good

 place
 for this.

 Wicket buffers the response so Tomcat cannot flush it no matter the
 size.
 I.e. the HttpServletResponse has no data to push until the very end of
 the
 request cycle.


 On Tue, Jul 2, 2013 at 5:07 PM, Martin Funk 
 wrote:

   Hi there,

> what is the best place to set http response state?
>
> I was trying the 'onSomething' callback methods in
> IRequestCycleListener
> Like onEndRequest
>
> But sometimes those get ignored
>
> The last save place I figured was onAfterRender in the page class, but
> this
> doesn't feel right.
>
> The reason that calls like:
> ((HttpServletResponse)
> RequestCycle.get().getResponse().getContainerResponse()).**
>
> setStatus(404);
> in the RequestCycle Listner are ignored seems to be that the underlying
> container, Tomcat 6.0.37 in our case, starts to flush the outputstream
> as
> the Response becomes big, as in maybe 20k.
>
> If the response is small enoug the status, can be set in the
> 'onDetach()'
>
> Anyone any ideas?
>
> Martin
>
>
>  --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Save place to set http response status?

2013-07-03 Thread Sven Meier
Yes, WebPageRenderer renders the page into a BufferedWebResponse. But 
after that it writes it into the response of the RequestCycle:


response.writeTo((WebResponse)requestCycle.getResponse());

That's the point of no return.

By default the RequestCycle's response is a ServletWebResponse nested in 
a HeaderBufferingWebResponse. So only headers are buffered until the 
first content is written.


ServletWebResponse#flush() just forwards to 
HttpServletResponse#flushBuffer(), no buffering involved there.


Sven


On 07/03/2013 09:19 AM, Martin Grigorov wrote:

On Wed, Jul 3, 2013 at 10:02 AM, Sven Meier  wrote:


HttpServletResponse has no data to push until the very end of the

request cycle.


That's not quite right:
As soon as WebPageRenderer writes the buffered page into the real
response, Tomcat has something to flush. If it does flush (for whatever
reason), any additional header set


Can you paste the code that does this in WebPageRenderer ?

AFAIK org.apache.wicket.protocol.http.servlet.ServletWebResponse#flush()
makes the transfer from the BufferedWebResponse to HttpServletResponse.



in #onEndRequest() might be ignored.

Sven



On 07/03/2013 03:52 AM, Martin Grigorov wrote:


Hi,

org.apache.wicket.markup.html.**WebPage#configureResponse() is a good
place
for this.

Wicket buffers the response so Tomcat cannot flush it no matter the size.
I.e. the HttpServletResponse has no data to push until the very end of the
request cycle.


On Tue, Jul 2, 2013 at 5:07 PM, Martin Funk  wrote:

  Hi there,

what is the best place to set http response state?

I was trying the 'onSomething' callback methods in IRequestCycleListener
Like onEndRequest

But sometimes those get ignored

The last save place I figured was onAfterRender in the page class, but
this
doesn't feel right.

The reason that calls like:
((HttpServletResponse)
RequestCycle.get().**getResponse().**getContainerResponse()).**
setStatus(404);
in the RequestCycle Listner are ignored seems to be that the underlying
container, Tomcat 6.0.37 in our case, starts to flush the outputstream as
the Response becomes big, as in maybe 20k.

If the response is small enoug the status, can be set in the 'onDetach()'

Anyone any ideas?

Martin



--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@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: Save place to set http response status?

2013-07-03 Thread Martin Grigorov
On Wed, Jul 3, 2013 at 10:02 AM, Sven Meier  wrote:

> HttpServletResponse has no data to push until the very end of the
>> request cycle.
>>
>
> That's not quite right:
> As soon as WebPageRenderer writes the buffered page into the real
> response, Tomcat has something to flush. If it does flush (for whatever
> reason), any additional header set


Can you paste the code that does this in WebPageRenderer ?

AFAIK org.apache.wicket.protocol.http.servlet.ServletWebResponse#flush()
makes the transfer from the BufferedWebResponse to HttpServletResponse.


> in #onEndRequest() might be ignored.
>
> Sven
>
>
>
> On 07/03/2013 03:52 AM, Martin Grigorov wrote:
>
>> Hi,
>>
>> org.apache.wicket.markup.html.**WebPage#configureResponse() is a good
>> place
>> for this.
>>
>> Wicket buffers the response so Tomcat cannot flush it no matter the size.
>> I.e. the HttpServletResponse has no data to push until the very end of the
>> request cycle.
>>
>>
>> On Tue, Jul 2, 2013 at 5:07 PM, Martin Funk  wrote:
>>
>>  Hi there,
>>>
>>> what is the best place to set http response state?
>>>
>>> I was trying the 'onSomething' callback methods in IRequestCycleListener
>>> Like onEndRequest
>>>
>>> But sometimes those get ignored
>>>
>>> The last save place I figured was onAfterRender in the page class, but
>>> this
>>> doesn't feel right.
>>>
>>> The reason that calls like:
>>> ((HttpServletResponse)
>>> RequestCycle.get().**getResponse().**getContainerResponse()).**
>>> setStatus(404);
>>> in the RequestCycle Listner are ignored seems to be that the underlying
>>> container, Tomcat 6.0.37 in our case, starts to flush the outputstream as
>>> the Response becomes big, as in maybe 20k.
>>>
>>> If the response is small enoug the status, can be set in the 'onDetach()'
>>>
>>> Anyone any ideas?
>>>
>>> Martin
>>>
>>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Feedback message is not available for behaviors added to nested form components

2013-07-03 Thread Jesse Long

Hi James,

This is a shortened list of events happening, including only the ones 
affecting you. They are in the order in which they occur.


 * IFormSubmitListener#onFormSubmitted()
 * ListView#onBeforeRender()
 * Page#onRender()

ListView#onBeforeRender() calls ListView#onPopulate(). If you are not 
using ListView#setReuseItems(true), then ListView#onPopulate() removes 
all children of ListView and re-creates them.


So, the children of ListView that are present during Page#onRender() are 
not the same children that were present during 
IFormSubmitListener#onFormSubmitted(), and hence not the same children 
that had the feedback messages.


Cheers,
Jesse

On 03/07/2013 02:35, James Selvakumar wrote:

No.


On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:


Are you using listView.setReuseItems(true) ?

Sven


On 07/02/2013 11:13 AM, James Selvakumar wrote:


Hi all,

I've the following component heirarchy:

form:textField
form:listView:panel-1:**panel1DropDownChoice
form:submitButton

I've marked the all the form components as required.

I also have a behavior that is added to all the form components (via
IVisitor) which will make the respective feedback messages appear under
the
form components.

It works perfectly for the form component "texField" which is directly
attached to the form.

However it doesn't work for for "panel1DropDownChoice".

I've added some debug messages in the "validate()" method of
"panel1DropDownChoice" and found that feedback messages are indeed
generated.

However from the debug messages in my behavior, I found that feedback
messages were some how lost.

This is the behavior I'm using. (Thanks London Wicket users)

*public class ValidationMsgBehavior extends Behavior

{
  private static Logger logger =
LoggerFactory.getLogger(**ValidationMsgBehavior.class);

  @Override
  public void afterRender(Component c)
  {
  logger.debug("Preparing to add validation msg for the component
{}", c);
  FormComponent fc = (FormComponent) c;
  if (!fc.isValid()) {
  String error;
  if (fc.hasFeedbackMessage()) {
  logger.debug("Form component {} has feedback messages",
fc);
  error =
fc.getFeedbackMessages().**first(FeedbackMessage.ERROR).**
getMessage().toString();
  } else {
  error = "Your input is invalid.";
  }
  fc.getResponse().write(
  "" + error + "");
  }else{
  logger.debug("Form component {} is valid", fc);
  }
  }
}*

Any clues? I've been trying to crack this for a whole day.



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








Re: Save place to set http response status?

2013-07-03 Thread Sven Meier

HttpServletResponse has no data to push until the very end of the
request cycle.


That's not quite right:
As soon as WebPageRenderer writes the buffered page into the real response, 
Tomcat has something to flush. If it does flush (for whatever reason), any 
additional header set in #onEndRequest() might be ignored.

Sven


On 07/03/2013 03:52 AM, Martin Grigorov wrote:

Hi,

org.apache.wicket.markup.html.WebPage#configureResponse() is a good place
for this.

Wicket buffers the response so Tomcat cannot flush it no matter the size.
I.e. the HttpServletResponse has no data to push until the very end of the
request cycle.


On Tue, Jul 2, 2013 at 5:07 PM, Martin Funk  wrote:


Hi there,

what is the best place to set http response state?

I was trying the 'onSomething' callback methods in IRequestCycleListener
Like onEndRequest

But sometimes those get ignored

The last save place I figured was onAfterRender in the page class, but this
doesn't feel right.

The reason that calls like:
((HttpServletResponse)
RequestCycle.get().getResponse().getContainerResponse()).setStatus(404);
in the RequestCycle Listner are ignored seems to be that the underlying
container, Tomcat 6.0.37 in our case, starts to flush the outputstream as
the Response becomes big, as in maybe 20k.

If the response is small enoug the status, can be set in the 'onDetach()'

Anyone any ideas?

Martin




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