Re: [1.5 MIGRATION] - Where did StringHeaderContributor / TextTemplateHeaderContributor go?

2014-07-21 Thread Shweta Agrawal
Hi 
I'm facing issue with StringHeaderContribuor will migration from 1.4 to 1.5.
Can you please help me ?
1. I'm using StringHeaderContribuor for Google analytic code 
public class GoogleAnalyticsHeaderContributor extends
StringHeaderContributor {

public GoogleAnalyticsHeaderContributor(BasePage page) {
super (getGAScript (page));
}
2. Adding the StringHeaderContributor component 
this.add(new StringHeaderContributor());

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/1-5-MIGRATION-Where-did-StringHeaderContributor-TextTemplateHeaderContributor-go-tp3263954p4666709.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: [1.5 MIGRATION] - Where did StringHeaderContributor / TextTemplateHeaderContributor go?

2014-07-21 Thread Martin Grigorov
Hi,

This has been simplified.
You should extend Behavior and contribute via #renderHead() method.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Mon, Jul 21, 2014 at 9:12 AM, Shweta Agrawal 
shweta.agra...@lntinfotech.com wrote:

 Hi
 I'm facing issue with StringHeaderContribuor will migration from 1.4 to
 1.5.
 Can you please help me ?
 1. I'm using StringHeaderContribuor for Google analytic code
 public class GoogleAnalyticsHeaderContributor extends
 StringHeaderContributor {

 public GoogleAnalyticsHeaderContributor(BasePage page) {
 super (getGAScript (page));
 }
 2. Adding the StringHeaderContributor component
 this.add(new StringHeaderContributor());

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/1-5-MIGRATION-Where-did-StringHeaderContributor-TextTemplateHeaderContributor-go-tp3263954p4666709.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: StringResourceModel with a defaultValue as model

2014-07-21 Thread Patrick Davids
Hi François,
what I try to do is a bit different... I would like to provide a default 
per component sub-class, before wicket cascades the property files up to 
application.properties.

Something like this:
add(new Label(, new StringResourceModel(key.${someInfoFromBean}, 
Component.this, Model.of(anyBean), new 
StringResourceModel(key.default, Component.this)));

Hi Martin,
ok, this will solve my problem, next.
  In Wicket 7 the API is changed to IModelString with
  https://issues.apache.org/jira/browse/WICKET-4972

kind regards
Patrick

Am 18.07.2014 19:02, schrieb Francois Meillet:
 In your Application.properties
 you add the key key.to.be.good=theValue

 and you can use the StringResourceModel like that

 add( new Label(,  new StringResourceModel(key.to.be.good, null)));


 François Meillet
 Formation Wicket - Développement Wicket





 Le 18 juil. 2014 à 18:14, Patrick Davids patrick.dav...@nubologic.com a 
 écrit :

 Hi all,
 is there any way to implement a StringResourceModel which allows to give
 a defaultValue as model?

 First I tried to override getDefaultModelAsString() of Label. (is final)
 Than I tried to implement an extending
 ModeledDefaultValueStringResourceModel, catching a
 MissingResourceException on getObject() or load() and retrieving my own
 ModelString defaultValue, but everthing is final here, too.

 So, Im not able to achieve this, right now.

 I would like to do this, because I have a dynamic way of giving buttons
 a label depending of my Wizard-subclass (have my own
 SpecialWizardButtonBar).

 And if a button label is not availabe I want to fallback somewhere, but
 the default cannot be a StringResourceModel.

 Can someone help? Or is this a feature request and have to open a ticket?

 kind regards, nice weekend
 PatrickB�CB��[��X��ܚX�KK[XZ[�\�\��][��X��ܚX�P�X��]�\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[�\�\��Z[�X��]�\X�K�ܙ�B�



-- 
Mit freundlichen Grüßen,

Patrick Davids

nuboLOGIC GmbH  Co. KG
Kieler Str. 103-107 • 25474 Bönningstedt

Tel.: +49 40 228539 732
Email: patrick.dav...@nubologic.com

http://www.nubologic.com

Handelsregister: HRA6819 Pi  | Amtsgericht Pinneberg

Geschäftsführung der Verwaltungsgesellschaft
Daniel Fraga Zander

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



Re: StringResourceModel with a defaultValue as model

2014-07-21 Thread Martin Grigorov
On Mon, Jul 21, 2014 at 10:39 AM, Patrick Davids 
patrick.dav...@nubologic.com wrote:

 Hi François,
 what I try to do is a bit different... I would like to provide a default
 per component sub-class, before wicket cascades the property files up to
 application.properties.

 Something like this:
 add(new Label(, new StringResourceModel(key.${someInfoFromBean},
 Component.this, Model.of(anyBean), new
 StringResourceModel(key.default, Component.this)));

 Hi Martin,
 ok, this will solve my problem, next.
   In Wicket 7 the API is changed to IModelString with
   https://issues.apache.org/jira/browse/WICKET-4972


For now you can workaround it with:
 add(new Label(, new StringResourceModel(key.${someInfoFromBean},
Component.this, Model.of(anyBean), new
StringResourceModel(key.default, Component.this).*getObject()*));



 kind regards
 Patrick

 Am 18.07.2014 19:02, schrieb Francois Meillet:
  In your Application.properties
  you add the key key.to.be.good=theValue
 
  and you can use the StringResourceModel like that
 
  add( new Label(,  new StringResourceModel(key.to.be.good,
 null)));
 
 
  François Meillet
  Formation Wicket - Développement Wicket
 
 
 
 
 
  Le 18 juil. 2014 à 18:14, Patrick Davids patrick.dav...@nubologic.com
 a écrit :
 
  Hi all,
  is there any way to implement a StringResourceModel which allows to give
  a defaultValue as model?
 
  First I tried to override getDefaultModelAsString() of Label. (is final)
  Than I tried to implement an extending
  ModeledDefaultValueStringResourceModel, catching a
  MissingResourceException on getObject() or load() and retrieving my own
  ModelString defaultValue, but everthing is final here, too.
 
  So, Im not able to achieve this, right now.
 
  I would like to do this, because I have a dynamic way of giving buttons
  a label depending of my Wizard-subclass (have my own
  SpecialWizardButtonBar).
 
  And if a button label is not availabe I want to fallback somewhere, but
  the default cannot be a StringResourceModel.
 
  Can someone help? Or is this a feature request and have to open a
 ticket?
 
  kind regards, nice weekend
  Patrick
 B�CB� �
 [��X��ܚX�K  K[XZ[ � \�\��][��X��ܚX�P �X��] �\ X� K�ܙ�B��܈ Y  ] [ۘ[  ��[X[�
 �  K[XZ[ � \�\��Z [   �X��] �\ X� K�ܙ�B�
 
 

 --
 Mit freundlichen Grüßen,

 Patrick Davids

 nuboLOGIC GmbH  Co. KG
 Kieler Str. 103-107 • 25474 Bönningstedt

 Tel.: +49 40 228539 732
 Email: patrick.dav...@nubologic.com

 http://www.nubologic.com

 Handelsregister: HRA6819 Pi  | Amtsgericht Pinneberg

 Geschäftsführung der Verwaltungsgesellschaft
 Daniel Fraga Zander

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




[SOLVED] Re: StringResourceModel with a defaultValue as model

2014-07-21 Thread Patrick Davids
Yes, already implemented this way. :-)
Added a todo now, waiting for wicket7 to improve it.
Thanx for the hint anyway...

regards
Patrick

 For now you can workaround it with: add(new Label(, new 
 StringResourceModel(key.${someInfoFromBean},
 Component.this, Model.of(anyBean), new
 StringResourceModel(key.default, Component.this).*getObject()*));



Am 21.07.2014 09:43, schrieb Martin Grigorov:
 For now you can workaround it with:
   add(new Label(, new StringResourceModel(key.${someInfoFromBean},
 Component.this, Model.of(anyBean), new
 StringResourceModel(key.default, Component.this).*getObject()*));


Re: Behavior to modify attributes

2014-07-21 Thread Entropy
 Instead of doing: 
   page.add(new MyBehavior(components)) 
 do 
  Behavior b = AttributeModifier.append(); 
  for (Component c : components) { 
 c.add(b) 
  } 

Certainly that would work,  I am trying to create a re-usable Behavior for
my app that any page wishing to incorporate this feature can add.  I thought
behaviors would be perfect for this, but it seems one event is to early (the
components may not have been all added yet) and another too late (not
allowed to add AttributeModifiers).

I have a common abstract page class from which all my classes extend, and I
certainly could put a method on there, but I'd be relying on the individual
programmer to call the method last in his constructor, rather than relying
on an event which guarantees it.

Seems like there ought to be a goldilocks place to put this...not too early,
not too late.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Behavior-to-modify-attributes-tp487p4666714.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Behavior to modify attributes

2014-07-21 Thread Entropy
Oh, I just tried it in my common page's onBeforeRender.  Evidently I can do
this from the page.onBeforeRender, just not from the behavior
onBeforeRender.  Which is probably what you meant.  Okay, I can work with
that.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Behavior-to-modify-attributes-tp487p4666715.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Behavior to modify attributes

2014-07-21 Thread Martin Grigorov
Hi,

You are using Behavior in a strange way.
component.add(behavior) will call behavior#onBind(component) because Wicket
knows that the behavior is used by this component.
Later when Wicket starts to render the components it calls the Behavior's
methods like: beforeRender(), afterRender(), etc.
What's strange in your approach is that a behavior is added to one
component (the page?!) that is completely unrelated to the main task and it
holds references to some other components which should be manipulated
somehow ...
Better mark these components somehow (annotation, marker interface, base
class, ...) and use IComponentInstantiationListener to add the
AttributeModifier to all such components.

 Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Mon, Jul 21, 2014 at 2:45 PM, Entropy blmulholl...@gmail.com wrote:

  Instead of doing:
page.add(new MyBehavior(components))
  do
   Behavior b = AttributeModifier.append();
   for (Component c : components) {
  c.add(b)
   }

 Certainly that would work,  I am trying to create a re-usable Behavior for
 my app that any page wishing to incorporate this feature can add.  I
 thought
 behaviors would be perfect for this, but it seems one event is to early
 (the
 components may not have been all added yet) and another too late (not
 allowed to add AttributeModifiers).

 I have a common abstract page class from which all my classes extend, and I
 certainly could put a method on there, but I'd be relying on the individual
 programmer to call the method last in his constructor, rather than relying
 on an event which guarantees it.

 Seems like there ought to be a goldilocks place to put this...not too
 early,
 not too late.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Behavior-to-modify-attributes-tp487p4666714.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




DropDownChoice closes on target.add(...)

2014-07-21 Thread Rune Stilling
Hi list

I’m using the TabbedPanel component to show a couple of tabs each of them 
containing a form. The form among other things contains a DropDownChoice. I 
have also set up a AbstractAjaxTimerBehavior instance to do some updates along 
the way. On of the updates i the TabbedPanel, that I add to my target in 
AbstractAjaxTimerBehavior::onTimer.

Now what happens is that if I have selected/pulled down my drop down choice in 
the browser the target.add(tabPanel); instruction makes the drop down roll in 
again, so that I have to click it again. Is there a way I can avoid this by 
setting some flag on the DropDownChoice so that it doesn’t rerender on the 
AjaxRequestTarget.add(tabbePanel)?

Here’s some code:

 tabs.add(new AbstractTab(new ModelString(Filupload)) {
 private static final long serialVersionUID = 1L;
 
 @Override
 public Panel getPanel(String panelId) {
 UploadFormPanel uploadPanel = new 
 UploadFormPanel(panelId, version, editionDirPath, mandatoryInputFiles);
 uploadPanel.setOutputMarkupId(true);
 return uploadPanel;
 }
 });
 
 final TabbedPanel tabPanel = new TabbedPanel(versionTabPanel, 
 tabs);
 tabPanel.setOutputMarkupId(true);
 add(tabPanel);

final AbstractAjaxTimerBehavior timer = new 
 AbstractAjaxTimerBehavior(Duration.milliseconds(1000)) {
 @Override
 public void onTimer(AjaxRequestTarget target) {
 target.add(tabPanel); //Doesn't update panels (so whats 
 the use? Det er nødvendigt for at opdatere PropertyModels, er det ikke?)
   }

I was also considering to add only parts of the tabPanel, but I don’t know how 
to access the uploadPanel in the AbstractTab instance.

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



Re: DropDownChoice closes on target.add(...)

2014-07-21 Thread Patrick Davids
Hi Rune,
for me it looks like the feature of updating parts of your 
UploadFormPanel by using a timer should be a behavior of your 
UploadFormPanel itself.

Put it inside, and you have access the particular container to refresh. 
No need to refresh the whole panel from outside, which side-affects your 
dropdown choice and clicks etc.

kind regards
Patrick

Am 21.07.2014 15:29, schrieb Rune Stilling:
 Hi list

 I’m using the TabbedPanel component to show a couple of tabs each of them 
 containing a form. The form among other things contains a DropDownChoice. I 
 have also set up a AbstractAjaxTimerBehavior instance to do some updates 
 along the way. On of the updates i the TabbedPanel, that I add to my target 
 in AbstractAjaxTimerBehavior::onTimer.

 Now what happens is that if I have selected/pulled down my drop down choice 
 in the browser the target.add(tabPanel); instruction makes the drop down roll 
 in again, so that I have to click it again. Is there a way I can avoid this 
 by setting some flag on the DropDownChoice so that it doesn’t rerender on the 
 AjaxRequestTarget.add(tabbePanel)?

 Here’s some code:

  tabs.add(new AbstractTab(new ModelString(Filupload)) {
  private static final long serialVersionUID = 1L;

  @Override
  public Panel getPanel(String panelId) {
  UploadFormPanel uploadPanel = new 
 UploadFormPanel(panelId, version, editionDirPath, mandatoryInputFiles);
  uploadPanel.setOutputMarkupId(true);
  return uploadPanel;
  }
  });
   
  final TabbedPanel tabPanel = new TabbedPanel(versionTabPanel, 
 tabs);
  tabPanel.setOutputMarkupId(true);
  add(tabPanel);

 final AbstractAjaxTimerBehavior timer = new 
 AbstractAjaxTimerBehavior(Duration.milliseconds(1000)) {
  @Override
  public void onTimer(AjaxRequestTarget target) {
  target.add(tabPanel); //Doesn't update panels (so whats 
 the use? Det er nødvendigt for at opdatere PropertyModels, er det ikke?)
  }

 I was also considering to add only parts of the tabPanel, but I don’t know 
 how to access the uploadPanel in the AbstractTab instance.

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