Re: Internationalized Validators

2015-01-26 Thread Christian Schröter

Thank you Tobias,

but this will unfortunately just solve the problem having the same validator 
with different parameters. To add a market specific validator, I still would 
need to switch case the locale.

Any other ideas?

 Hi,
 
 you could place the values in the locale file and parse them.
 
 Integer.parseInt(getString(maxvalue));
 
 kind regards
 
 Tobias
 
 Am 26.01.2015 um 11:01 schrieb Christian Schröter 
 christian.schroe...@1und1.de:
 
 Hey,
 
 I would be interested to know if there is a builtin mechanism to add 
 specific validators for a certain locale.
 
 For example:
 
 de_DE - StringValidator.maximumLength(100)
 en_GB - StringValidator.maximumLength(200);
 en_US - StringValidator.maximumLength(200);
  AnotherValidatorOnlyForUS();
 
 My current solution is a switch-case over the locale to add the correct 
 validators.
 With more locales and more validators this solution feels kind of sloppy.
 
 What does your solution looks like?
 
 
 Cheers,
 Chris
 
 -
 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



Internationalized Validators

2015-01-26 Thread Christian Schröter
Hey,

I would be interested to know if there is a builtin mechanism to add specific 
validators for a certain locale.

For example:

de_DE - StringValidator.maximumLength(100)
en_GB - StringValidator.maximumLength(200);
en_US - StringValidator.maximumLength(200);
 AnotherValidatorOnlyForUS();

My current solution is a switch-case over the locale to add the correct 
validators.
With more locales and more validators this solution feels kind of sloppy.

What does your solution looks like?


Cheers,
Chris


Re: Ajax: listening to specic event in custom

2014-08-22 Thread Christian Schröter
You can listen to a custom event. Just add an new 
AjaxEventBehavior(‚hidden.bs.modal“) {…};
If you are working closely with Bootstrap I recommend to have a look at 
https://github.com/l0rdn1kk0n/wicket-bootstrap

Cheers,
Chris

Am 22.08.2014 um 15:46 schrieb lucast 
lucastol...@hotmail.commailto:lucastol...@hotmail.com:

Dear forum,
I have implemented a custom-made modal window using twitter bootstrap
syntax.

The modal window has a confirm and a cancel ajax link.

Similarly to Wicket's own modal window, I have implemented a
show(AjaxRequestTarget) function that calls



and I have managed to display the modal window no problem.

When I click either confirm/cancel, on AjaxLink.onClick(AjaxRequestTarget) I
close the modal window and I send and event:



on the main panel where the modal window is added to, I catch the events
sent from the modal window by implementing  onEvent(IEvent).

The problem is that on the main panel, upon catching the event, when I
replace the current panel, it hides the modal window but the blocking
greyed-out foreground remains. It therefore blocks the screen from any
usage. I have to refresh the screen for it to go away.


According to the  bootstrap documentation
http://getbootstrap.com/javascript/#modals-usage  , Bootstrap's modal
class exposes a few events for hooking into modal functionality.
One of them is *hidden.bs.modal*: This event is fired when the modal has
finished being hidden from the user (will wait for CSS transitions to
complete).
Example taken from  tutorialrepublic.comhttp://tutorialrepublic.com
http://www.tutorialrepublic.com/codelab.php?topic=bootstrapfile=modal-events

How can I, from the confirm/delete.onClick(AjaxRequestTarget) know when the
modal window has been completely closed before calling ?

I am assuming I need to listen for the *hidden.bs.modal* ajax event. would
that be right? if so, how can I listen for this custom ajax event?

I just want to get rid of the blocking foreground, when the panel has been
successfully replaced.

Thanks in advance. Sorry for the long post.

Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-listening-to-specic-event-in-custom-tp4667138.html
Sent from the Users forum mailing list archive at Nabble.comhttp://Nabble.com.

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




Re: AjaxEventBehavior and arguments

2014-08-13 Thread Christian Schröter
Thanks for the quick reply. Works like a charm!

Please let me know how I can buy you a beer.

Cheers

Am 13.08.2014 um 09:05 schrieb Martin Grigorov mgrigo...@apache.org:

 Hi,
 
 You can use AjaxEventBehavior as with any other event type.
 The 'data' is reachable thru: attrs.event.extraData:
 
 new AjaxEventBehavior(customEvent) {
 
  @Override protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes)
  {
 super.updateAjaxAttributes(attributes);
 attributes.getDynamicExtraParameters().add(return [{\name\:
 \value\, \value\: attrs.event.extraData.value}]);
  }
 
  @Override public void onEvent(AjaxRequestTarget target) {
StringValue valueValue =
 getRequest().getRequestParameters().getParameterValue(value);

  }
 
 }
 
 On Wed, Aug 13, 2014 at 1:07 AM, Christian Schröter 
 christian.schroe...@1und1.de wrote:
 
 Hey everyone,
 
 I'm having diffculties to find a solution for a common issue, at least in
 my opinion ^^
 Hopefully someone can help me.
 
 I'm using a third party JS libary. This lib fires custom events.
 
 $('#id').on('customEvent', function(event, data) {...});
 
 In Wicket I would like to add a listener for this specific event (like the
 AjaxEventBehavior) and also retrieving the arguments within the callback
 function.
 Is there an easy way to do this?
 
 
 Cheers,
 Christian
 
 
 Here is what works so far but I don't think this is the best solution.
 
 StringBuffer script = new StringBuffer();
 script.append(var value = data.value;);
 
 script.append(getCallbackFunctionBody(CallbackParameter.explicit(value)));
 
 response.render(new OnEventHeaderItem(' + component.getMarkupId() + ',
 customEvent, script.toString()) {
@Override
public CharSequence getCompleteJavaScript() {
StringBuilder result = new StringBuilder();
result.append(Wicket.Event.add()
.append(getTarget())
.append(, \)
.append(getEvent())
.append(\, function(event, data) { )
.append(getJavaScript())
.append(;}););
return result;
}
 });
 


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



AjaxEventBehavior and arguments

2014-08-12 Thread Christian Schröter
Hey everyone,

I'm having diffculties to find a solution for a common issue, at least in my 
opinion ^^
Hopefully someone can help me.

I'm using a third party JS libary. This lib fires custom events.

$('#id').on('customEvent', function(event, data) {...});

In Wicket I would like to add a listener for this specific event (like the 
AjaxEventBehavior) and also retrieving the arguments within the callback 
function.
Is there an easy way to do this?


Cheers,
Christian


Here is what works so far but I don't think this is the best solution.

StringBuffer script = new StringBuffer();
script.append(var value = data.value;);
script.append(getCallbackFunctionBody(CallbackParameter.explicit(value)));

response.render(new OnEventHeaderItem(' + component.getMarkupId() + ', 
customEvent, script.toString()) {
@Override
public CharSequence getCompleteJavaScript() {
StringBuilder result = new StringBuilder();
result.append(Wicket.Event.add()
.append(getTarget())
.append(, \)
.append(getEvent())
.append(\, function(event, data) { )
.append(getJavaScript())
.append(;}););
return result;
}
});


Behavior and property files

2014-06-23 Thread Christian Schröter
Hi,

I would like to build a self-contained Behavior including some translations 
(property files). 
All I can think of is doing something like this within the behavior class:

@Override
public void bind(Component c) {
c.getString(„key“);
}

Unfortunately this is anything but a self-contained behavior. Does anyone has a 
better idea to solve my problem?

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



Re: Behavior and property files

2014-06-23 Thread Christian Schröter
A BehaviorA.properties would solve perfectly my problem. Is there a way to 
register a BehaviorA.properties file?

Am 23.06.2014 um 17:15 schrieb Ernesto Reinaldo Barreiro reier...@gmail.com:

 @Martin,
 
 He probably means there is no way to attach properties to a behavior: Like
 PaneA.class and PanelA.properties? I do not think BehaviorA.class and
 BehaviorA.properties will work. Or am I mistaken?
 
 @Christian
 
 Or do you mean something different?
 
 
 
 
 On Mon, Jun 23, 2014 at 5:11 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
 Hi,
 
 c.getString() is just a shortcut to
 Application.get().getResourceSettings().getLocalizer().getString() methods.
 
 Martin Grigorov
 Wicket Training and Consulting
 
 
 On Mon, Jun 23, 2014 at 5:55 PM, Christian Schröter 
 christian.schroe...@1und1.de wrote:
 
 Hi,
 
 I would like to build a self-contained Behavior including some
 translations (property files).
 All I can think of is doing something like this within the behavior
 class:
 
 @Override
 public void bind(Component c) {
c.getString(„key“);
 }
 
 Unfortunately this is anything but a self-contained behavior. Does anyone
 has a better idea to solve my problem?
 
 Cheers,
 Chris
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 -- 
 Regards - Ernesto Reinaldo Barreiro


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



AW: Link

2013-11-11 Thread Christian Schröter
Hey,

For a simple solution just overwrite onComponentTag().
But I think there a already complete components addressing this issue.

   @Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
if (getPage().getPageClass() == Fault.class) {
// inline style
tag.put(style, color: red;);
// css class
tag.put(class, active);
}
}

Cheers,
Christian

Von: christoph.ma...@t-systems.com [mailto:christoph.ma...@t-systems.com]
Gesendet: Montag, 11. November 2013 11:23
An: users@wicket.apache.org
Betreff: Link

Hello,

there are 4 links at the top of my page.
[cid:eda0a64b-ce32-4c04-b1b1-cc10df635636]
Every link should forward to another page. But the User couldn't see on which 
page he is. I want to change the color of the links depending on the page which 
the user has chosen. How can I realize this? I implemented the links like this:

Link faultLink = new Link(faultLink) {
@Override
public void onClick() {
setResponsePage(Fault.class);
}
};

Christoph




AW: Loading content of IFrames only when displayed

2013-10-24 Thread Christian Schröter
Now why didn't I think oft hat. Thank you Martin.

Maybe we can remove the final declaration in the next release (if there is no 
objections)

Cheers,

Christian

-Ursprüngliche Nachricht-
Von: Martin Grigorov [mailto:mgrigo...@apache.org] 
Gesendet: Montag, 21. Oktober 2013 10:18
An: users@wicket.apache.org
Betreff: Re: Loading content of IFrames only when displayed

Hi,

You can use custom Behavior that removes the 'url' attribute in its
#onComponentTag() and adds 'data-url' instead.
Component#onComponentTag() is executed before Behavior#onComponentTag() so it 
should work OK.


On Thu, Oct 17, 2013 at 5:29 PM, Christian Schröter  
christian.schroe...@1und1.de wrote:

 Hello,

 I'm using the InlineFrame class to display an IFrame. Now the IFrame 
 is added in a dialog prompt, which is not visible by default. The user 
 has to click a certain link to see the IFrame in the dialog prompt.

 Unfortunately the browser loads the URL defined in the source 
 attribute, no matter if the IFrame is visible or not. In my opinion, 
 it would be better to load the content only if the iframe is visible.

 A solution to achieve this goal is explained here:
 http://stackoverflow.com/**questions/13437091/is-it-**
 possible-to-not-load-an-**iframe-in-a-hidden-div-until-**
 the-div-is-displayedhttp://stackoverflow.com/questions/13437091/is-it
 -possible-to-not-load-an-iframe-in-a-hidden-div-until-the-div-is-displ
 ayed

 But for some reason the onComponentTag(ComonentTag tag) is declared 
 final in the InlineFrame class.
 I don't understand why the method is final and I'm a bit clueless how 
 to proceed.

 Hopefully someone can help me.

 Thanks,
 Christian



Loading content of IFrames only when displayed

2013-10-17 Thread Christian Schröter

Hello,

I'm using the InlineFrame class to display an IFrame. Now the IFrame is 
added in a dialog prompt, which is not visible by default. The user has 
to click a certain link to see the IFrame in the dialog prompt.


Unfortunately the browser loads the URL defined in the source attribute, 
no matter if the IFrame is visible or not. In my opinion, it would be 
better to load the content only if the iframe is visible.


A solution to achieve this goal is explained here: 
http://stackoverflow.com/questions/13437091/is-it-possible-to-not-load-an-iframe-in-a-hidden-div-until-the-div-is-displayed


But for some reason the onComponentTag(ComonentTag tag) is declared 
final in the InlineFrame class.
I don't understand why the method is final and I'm a bit clueless how to 
proceed.


Hopefully someone can help me.

Thanks,
Christian