Re: aj Component twice in markup while ax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-29 Thread Nico
I followed Martin's hint and with wicket 6.7.0 I manually changed the 
replacement in the javascript from 

jQuery(element).after($newElement).remove();
to
jQuery(element).replaceWith($newElement);


But I just saw, that in Github 
(https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617)
 replaceWith is now the standard replacement.

Will this appear in Wicket 6.9.0?

Best
Nico


Am 28.05.2013 um 21:12 schrieb Maxim Solodovnik [via Apache Wicket]:

 I also saw this behavior using 6.8.0 
 The component with additional id was replaced, but there was time period 
 when 2 components are present on page 
 
 
 On Wed, May 29, 2013 at 12:12 AM, Heikki Uotinen  
 [hidden email] wrote: 
 
  Hi, 
  
  we had similar issue and could not find jira ticket for this, thus created 
  WICKET-5210 with quickstart. 
  
  Our workaround was changing our jQuery('#someid').. to 
  jQuery('[id=someid]').. to match all same (two) ids. 
  
  Rgds, 
  Heikki 
  
  -Original Message- 
  From: Nico [mailto:[hidden email]] 
  Sent: 15. toukokuuta 2013 11:07 
  To: [hidden email] 
  Subject: Re:aj Component twice in markup while ax refresh in Wicket 6.7 
  (migrated from 1.5.10) 
  
  Hi, 
  
  thanks for you quick replies! I will create the quick start and attach it 
  to a jira ticket. 
  
  Thanks to your hint Martin, for the moment I will use jQuery#replaceWith() 
  to make sure my app runs as expected. 
  
  Best 
  Nico 
  
  
  Am 14.05.2013 um 16:56 schrieb Martin Grigorov-4 [via Apache Wicket]: 
  
   Hi, 
   
   We use 
   https://github.com/apache/wicket/blob/master/wicket-core/src/main/java
   /org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617 
   because 
   it is faster than jQuery#replaceWith(). 
   So yes, there is a small period when both the old and the new are in 
   the DOM. 
   As Sven asked - please create a quicktart and attach it to a ticket so 
   we can see whether we will find a solution or we will have to use the 
   slower way to replace. 
   
   
   On Tue, May 14, 2013 at 4:48 PM, Sven Meier [hidden email] wrote: 
   
Create a quickstart and attach it to a Jira issue please. 

Sven 


On 05/14/2013 04:37 PM, Nico wrote: 

Hi 

I migrated my application from Wicket 1.5.10 to 6.7 

During testing I recognized that during an ajax update 
(replacement) of a component, the markup of the component is twice 
in the HTML markup (the old and the new markup). Thus the execution 
of javascript inside a component may fail due to the fact, that two 
components with the same id are present in the HTML markup. 

EXAMPLE 


*HTML:* 
lt;a wicket:id=quot;testlinkquot;**gt;testlinklt;/agt; 
lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; 
  height: 
100px; border: 1px solid #ccc;quot;gt; 
lt;script type=quot;text/javascript**quot;gt; 
alert(#39;hello#39;); 
lt;/scriptgt; 
lt;/divgt; 

*JAVA:* 
final WebMarkupContainer testbox = new 
WebMarkupContainer(testbox); testbox.setOutputMarkupId(**true); 
add(testbox); 

add(new AjaxLinkVoid(testlink) { 
private static final long serialVersionUID = 1L; 

@Override 
public void onClick(AjaxRequestTarget target) { 
target.add(testbox); 
} 
}); 


So while the ajax update is processed the 'testbox' DIV and its 
javascript are present twice (the old and new DIV). If the 
javascript is a little more complex and for example changes stuff 
inside the DIV, the javascript will change stuff in the old instead 
of the new DIV container. 

My javascript relies on the fact, that an id should always be 
present just once. 

Why is the old DIV not removed first, before the new DIV is 
appended? Can I change this behavior somehow? 

Thanks in advance 
Nico 



-- 
View this message in context: http://apache-wicket.1842946.**
n4.nabble.com/Component-twice-**in-markup-while-ajax-refresh-** 
in-Wicket-6-7-migrated-from-1-**5-10-tp4658789.htmlhttp://apache-w
icket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-re 
fresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html 
Sent from the Users forum mailing list archive at Nabble.com. 

--**--**--- 
-- To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org[hidden email] For 
additional commands, e-mail: [hidden email] 



--**--** 
- To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org[hidden email] For additional 
commands, e-mail: [hidden email] 


   
   
   -- 
   Martin Grigorov 
   Wicket Training

Re: Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-15 Thread Nico
Hi,

thanks for you quick replies! I will create the quick start and attach it to a 
jira ticket.

Thanks to your hint Martin, for the moment I will use jQuery#replaceWith() to 
make sure my app runs as expected.

Best
Nico


Am 14.05.2013 um 16:56 schrieb Martin Grigorov-4 [via Apache Wicket]:

 Hi, 
 
 We use 
 https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617
 because 
 it is faster than jQuery#replaceWith(). 
 So yes, there is a small period when both the old and the new are in the 
 DOM. 
 As Sven asked - please create a quicktart and attach it to a ticket so we 
 can see whether we will find a solution or we will have to use the slower 
 way to replace. 
 
 
 On Tue, May 14, 2013 at 4:48 PM, Sven Meier [hidden email] wrote: 
 
  Create a quickstart and attach it to a Jira issue please. 
  
  Sven 
  
  
  On 05/14/2013 04:37 PM, Nico wrote: 
  
  Hi 
  
  I migrated my application from Wicket 1.5.10 to 6.7 
  
  During testing I recognized that during an ajax update (replacement) of a 
  component, the markup of the component is twice in the HTML markup (the 
  old 
  and the new markup). Thus the execution of javascript inside a component 
  may 
  fail due to the fact, that two components with the same id are present in 
  the HTML markup. 
  
  EXAMPLE 
  
  
  *HTML:* 
  lt;a wicket:id=quot;testlinkquot;**gt;testlinklt;/agt; 
  lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height: 
  100px; border: 1px solid #ccc;quot;gt; 
  lt;script type=quot;text/javascript**quot;gt; 
  alert(#39;hello#39;); 
  lt;/scriptgt; 
  lt;/divgt; 
  
  *JAVA:* 
  final WebMarkupContainer testbox = new WebMarkupContainer(testbox); 
  testbox.setOutputMarkupId(**true); 
  add(testbox); 
  
  add(new AjaxLinkVoid(testlink) { 
  private static final long serialVersionUID = 1L; 
  
  @Override 
  public void onClick(AjaxRequestTarget target) { 
  target.add(testbox); 
  } 
  }); 
  
  
  So while the ajax update is processed the 'testbox' DIV and its javascript 
  are present twice (the old and new DIV). If the javascript is a little 
  more 
  complex and for example changes stuff inside the DIV, the javascript will 
  change stuff in the old instead of the new DIV container. 
  
  My javascript relies on the fact, that an id should always be present just 
  once. 
  
  Why is the old DIV not removed first, before the new DIV is appended? Can 
  I 
  change this behavior somehow? 
  
  Thanks in advance 
  Nico 
  
  
  
  -- 
  View this message in context: http://apache-wicket.1842946.**
  n4.nabble.com/Component-twice-**in-markup-while-ajax-refresh-** 
  in-Wicket-6-7-migrated-from-1-**5-10-tp4658789.htmlhttp://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html
   
  Sent from the Users forum mailing list archive at Nabble.com. 
  
  --**--**- 
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org[hidden 
  email] 
  For additional commands, e-mail: [hidden email] 
  
  
  
  --**--**- 
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org[hidden 
  email] 
  For additional commands, e-mail: [hidden email] 
  
 
 
 
 -- 
 Martin Grigorov 
 Wicket Training  Consulting 
 http://jWeekend.com http://jweekend.com/ 
 
 
 If you reply to this email, your message will be added to the discussion 
 below:
 http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658791.html
 To unsubscribe from Component twice in markup while ajax refresh in Wicket 
 6.7 (migrated from 1.5.10), click here.
 NAML





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658813.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



Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-14 Thread Nico
Hi

I migrated my application from Wicket 1.5.10 to 6.7

During testing I recognized that during an ajax update (replacement) of a
component, the markup of the component is twice in the HTML markup (the old
and the new markup). Thus the execution of javascript inside a component may
fail due to the fact, that two components with the same id are present in
the HTML markup.

EXAMPLE


*HTML:*
lt;a wicket:id=quot;testlinkquot;gt;testlinklt;/agt;
lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height:
100px; border: 1px solid #ccc;quot;gt;
lt;script type=quot;text/javascriptquot;gt;
alert(#39;hello#39;);
lt;/scriptgt;
lt;/divgt;

*JAVA:*
final WebMarkupContainer testbox = new WebMarkupContainer(testbox);
testbox.setOutputMarkupId(true);
add(testbox);

add(new AjaxLinkVoid(testlink) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
target.add(testbox);
}
});


So while the ajax update is processed the 'testbox' DIV and its javascript
are present twice (the old and new DIV). If the javascript is a little more
complex and for example changes stuff inside the DIV, the javascript will
change stuff in the old instead of the new DIV container.

My javascript relies on the fact, that an id should always be present just
once.

Why is the old DIV not removed first, before the new DIV is appended? Can I
change this behavior somehow?

Thanks in advance
Nico



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.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: Wicket 1.5 and OSGi

2010-10-06 Thread Nico Guba

 On 10/3/2010 1:35 PM, Eike Kettner wrote:

Just want to mention that with this change in wicket 1.5, wicket cannot
be used in OSGi environments as easiliy as wicket 1.4. One usually has
to create a wrapped jar somehow. Maybe this is worth to mention on the
migration guide wiki page?

Maybe this project helps reduce the complexity working with OSGI?

http://wiki.ops4j.org/display/ops4j/Pax+Wicket


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



Re: Persistence.xml problem

2010-04-26 Thread Nico Guba
I can assure you that there are no apparent problems/conflicts in using 
EclipseLink alongside Wicket.  I'm doing it constantly :)

It is likely that there is an issue with how your IDE is setup or packages the 
files.  Some tools write their own META-INF directory in a war instead of using 
the one designated in your sources.   That may need some tweaking but it's a 
stab in the dark since my setup is a Maven/Eclipse combo, so I cannot help on 
IDE specific issues.  The principle remains the same though.

It may be worth looking at the actual war archive and see whether the 
persistence.xml file is actually included at the right spot.

Try changing the persistence unit's name and see whether the new name is 
recognised when you instantiate your PersistenceManagerFactory.

Hope this helps

On 25 Apr 2010, at 16:43, Matias Pansa wrote:

 
 No , is ant .
 
 Subject: Re: Persistence.xml problem
 From: ng...@mac.com
 Date: Sun, 25 Apr 2010 15:41:07 +0100
 To: users@wicket.apache.org
 
 Is maven your build system?
 
 On 25 Apr 2010, at 14:46, Matias Pansa wrote:
 
 
 I try clean and build many times with the same result , i try deleting all 
 files manually to , a clean tomcat install and manually deploy the 
 app.Thanks.
 
 
 
 Date: Sun, 25 Apr 2010 13:34:28 +
 From: andre.prase...@gmail.com
 Subject: RE: Persistence.xml problem
 To: users@wicket.apache.org
 
 Try clean and build, you might break your application.
 
 Sent from my Nokia phone
 -Original Message-
 From: Igor Vaynberg
 Sent:  24/04/2010 23:10:15
 Subject:  Re: Persistence.xml problem
 
 wicket has nothing to do with it. maybe your IDE is not updating your
 persistence.xml in the target directory.
 
 -igor
 
 On Sat, Apr 24, 2010 at 7:02 AM, Matias Pansa matute...@hotmail.com 
 wrote:
 
 
 Hi , i'm developing an app under netbeans + wicket + tomcat + 
 wicket-contrib-javaee +eclipselink .
 The problem is that i run the app the first time and everything works 
 fine , but i change the data source in persistence.xml and the app stop 
 working , i change again to the original source and nothing ,  not 
 working , there is no error ,exception , nothing , the app runs on tomcat 
 like everything is ok , but there's no connection to the database , any 
 data is persisted .I just delete persistence.xml and app stil working! 
 ... clean tomcat install and still working without persistence.xml! , i 
 deployed the app war file within netbeans and manually on tomcat's web 
 manager without any persistence and the same result.So i want to know if 
 maybe wicket has something to do with this problem because i try almost 
 everything else , even running the app locally and in the server but 
 nothing happens , i apreciate any help on this.
 
 _
 Organizá una reunión con Hotmail: podés enviar un email a tus amigos y 
 con el Calendario agendar la fecha. Descubrí más.
 http://www.microsoft.com/latam/windows/windowslive/products/calendar.aspx
 
 -
 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
 
   
 _
 Con Hotmail y Calendario organizar reuniones es muy fácil: enviá 
 invitaciones y recibí confirmaciones de asistencia.
 http://www.microsoft.com/latam/windows/windowslive/products/calendar.aspx
 
 -- 
  npg
 
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 _
 Con Hotmail y Calendario organizar reuniones es muy fácil: enviá invitaciones 
 y recibí confirmaciones de asistencia.
 http://www.microsoft.com/latam/windows/windowslive/products/calendar.aspx

-- 
npg





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



Re: Back button

2010-04-25 Thread Nico Guba
Hmmm, does that imply that one of the member variables may be Serializable? 

On 25 Apr 2010, at 05:18, Igor Vaynberg wrote:

 the exception might have caused your page to not be serialized
 properly into the pagestore
 
 -igor
 
 On Sat, Apr 24, 2010 at 6:06 PM, Douglas Ferguson
 doug...@douglasferguson.us wrote:
 I just saw the issue again, but this time it happened right after an 
 exception. I got an except. Hit back and then it complained that the link 
 didn't exist.
 
 D?
 
 On Apr 24, 2010, at 6:58 PM, Douglas Ferguson wrote:
 
 Ah yes..
 
 I am definitely seeing the component not found on page error.
 
 Any tips on how to get a quick start for this? Anybody got any example 
 quickstarts that deal with back button issues?
 
 D/
 
 On Apr 24, 2010, at 6:41 PM, Igor Vaynberg wrote:
 
 then you would get a page-expired error
 
 -igor
 
 On Sat, Apr 24, 2010 at 3:34 PM, Douglas Ferguson
 doug...@douglasferguson.us wrote:
 Well something is happening, because I see it in the production logs and 
 from time to time on my dev machine.
 
 What if the server is restarted?
 
 D/
 
 On Apr 24, 2010, at 11:09 AM, Igor Vaynberg wrote:
 
 that doesnt matter because the url of the link you click contains the
 version number of the page
 
 -igor
 
 On Sat, Apr 24, 2010 at 2:35 AM, Pointbreak
 pointbreak+wicketst...@ml1.net wrote:
 In firefox it doesn't. Firefox reads the page back from it's in memory
 cache, which is the state before you clicked the ajax link. The headers
 should be changed to force firefox to request the page from the server
 (wicket). There are other threads on this subject, and frankly I do not
 understand why the headers are not changed in wicket core.
 
 On Fri, 23 Apr 2010 21:45 -0700, Igor Vaynberg
 igor.vaynb...@gmail.com wrote:
 the back button should roll the page back to the state that contained 
 the
 item
 
 -igor
 
 On Fri, Apr 23, 2010 at 9:28 PM, Douglas Ferguson
 doug...@douglasferguson.us wrote:
 Could this possibly happen if the following occurred.
 
 1) Load a page with a repeater on it
 2) Click on an ajax link that would remove an item from the repeater
 3) Click the back button. Click on the link for the item you removed.
 
 D/
 
 
 On Apr 23, 2010, at 10:32 AM, Martin Asenov wrote:
 
 Would someone assist me on this?
 
 Thank you in advance!
 
 -Original Message-
 From: Martin Asenov [mailto:mase...@velti.com]
 Sent: Friday, April 23, 2010 9:38 AM
 To: users@wicket.apache.org
 Subject: Back button
 
 Hello, everyone!
 
 I've got a page with a repeater with cells - every single cell has a 
 link in it. However, when you go to another page and afterwards 
 press the Back button and click one of the links, the following exc 
 is thrown:
 
 WicketMessage: org.apache.wicket.WicketRuntimeException: component 
 view_holder:view:25:cols:30:trigger_ref not found on page 
 com.company.project.ui.calendar.Calendar[id = 46], listener 
 interface = [RequestListenerInterface name=IBehaviorListener, 
 method=public abstract void 
 org.apache.wicket.behavior.IBehaviorListener.onRequest()]
 
 Wicket was supposed to support the Back button, wasn't it? Or maybe 
 I'm missing something.
 
 Please advice...
 
 Thank you,
 Martin
 
 -
 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
 
 
 -
 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
 
 
 
 -
 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: 

Re: Scalability

2010-04-12 Thread Nico Guba
I've had excellent results with Glassfish.  The login server for the MMO I 
worked on (swtor.com) has been benchmarked at 32,000 logins per second on a 8 
CPU machine.  The maximum throughput on a simple servlet (nothing dynamic 
though, just static data), was benchmarked at around 70k.

Obviously, obtaining these rates depends on a lot of things,  and we noticed 
that (unsurprisingly) the number of cores has a big impact on maximum 
scalability (32 / 8 = 4k per core). 

If you use an antiquated server that still processes requests on a thread per 
connection model, then your throughput will suffer dramatically.   Any modern 
app server or webserver that has a good non-blocking I/O implementation of the 
reqest/response handler will do.  Servers that come to my mind are tomcat 6, 
glassfish, grizzly...

Hope this helps  happy hacking!

On 11 Apr 2010, at 16:48, François Meillet wrote:

 Hi Wicketers,
 
 1) I need to build a system which can perform
 -6000 different users per day
 and
 -200 concurent users
 
 
 The software used:
 
 wicket
 postgresql (mainly read operations)
 hibernate
 jms
 
 At the beginning there will be 2 computers  (I prefer horizontal scalability).
 What would be your advice for the hardware (hard drive will be 10.000 RPM).
 -processor ?
 -ram
 
 
 2) Also I would appreciate your advice for the server:
 I have the choice for the server: Tomcat + a JMS implementation like HornetQ, 
 or Jboss Application Server. 
 I hesitate between the 2 solutions, as I don't need EJBs, but we never know 
 !!! . 
 
 Have you any advice ?
 
 Thanks 
 François
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

-- 
npg





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



Re: i18n feedbackmessages

2007-10-27 Thread nico

Johan Compagner schrieb:

why aren't you subclassing button and have a button that has that
modifier and use that one on all your forms?
  

doh! thanks, i haven't seen that obvious possibility
..is it right, to check wether the button is enabled in the 
onComponentTag event before putting the attribute?
to use the class simply add it by calling this.add(new 
I18nButton(button.id, new Model(buttontxt.key)); from

within your component.

import org.apache.wicket.Component;
import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.model.IModel;

/**
* Internationalized button class
*/
public class I18nButton extends Button {

   /**
* The attribute modifier for i18n
*/
   private class I18nAttributeModifier extends AbstractBehavior {
  
   private String attribute;

   private String value;
  
   public I18nAttributeModifier(String attribute, String value) {

   this.attribute = attribute;
   this.value = value;
   }
  
   /**
* @see 
org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component,

*  org.apache.wicket.markup.ComponentTag)
*/
   public void onComponentTag(final Component component, final 
ComponentTag tag)

   {
   if (isEnabled(component))
   {
   tag.getAttributes().put(attribute, getString(value));
   }
   }
   }   
  
   public I18nButton(final String id, final IModel model) {

   super(id, model);
   if (model.getObject() instanceof String) {
   String key = (String)model.getObject();
   add(this.new I18nAttributeModifier(value, key));
   } else
   new OperationNotSupportedException(Model needs to contain 
an object of type String.);

   }
}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: i18n feedbackmessages

2007-10-26 Thread nico

Thanks, Johan

With that code you are adding an attribute modifier ever time the button renders
And you did get an exception i guess because you call getString() out of the 
blue inside a construtor of a not fully constructed class.
  

thats why i moved the code to the propably wrong place..

To do that you have to lazy get the string through a model.getObject().
Then also a language change will result that the button will be translated on 
the fly
  
i have implemented the class I18NAttributeModifier which does what you 
proposed, by peeking

at the SimpleAttributeModifier code;

   private class I18NAttributeModifier extends AbstractBehavior {

   private String attribute;
   private String value;
   
   public I18NAttributeModifier(String attribute, String value) {

   this.attribute = attribute;
   this.value = value;
   }
   
   /**
* @see 
org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component,

*  org.apache.wicket.markup.ComponentTag)
*/
   public void onComponentTag(final Component component, final 
ComponentTag tag)

   {
   if (isEnabled(component))
   {
   tag.getAttributes().put(attribute, getString(value));
   }
   }
   }

this modifier is added in the constructor and is a private class to the 
Form i extended from WebPage

which is why the getString() method is available.

however i find this a little bit like a quick fix. how should i modify the
class to be reusable from other forms with a button?

if i also try to keep the localizer in the internal class by calling
getLocalizer() in the constructor of the Form class, and replace
the getString() by localizer.getString() in the onComponentTag event
to be able to externalize I18NAttributeModifier for more common usage,
the resource string is not found - probably because the localizer was 
overwritten after my code getting it in the ctor.


it's a pity that the button needs to be handled in a special way,
is there maybe a way to improve this, or am i doing something wrong?

thanks, regards
nico




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: i18n feedbackmessages

2007-10-24 Thread nico

another issue,
Button.onComponentTag states in its documentation tag:
* bNOTE/b. For a ttlt;buttongt;/tt the ttvalue/tt
* attribute is not rendered, markup needs to be added within the button
* to display the button's label.
* /p
however if i add markup the i18n is gone.
i currently use
   label for=button.sendwicket:message 
key=buttontxt.send /:/label

   input type=submit wicket:id=button.send value= /
however the internationalized string is added as a label.
is there a way to use i18n in the value attribute of the button tag?

all three don't work, i tried to dig the code, but haven't found a way 
to accomplish:
   submitButton = new Button(button.send,new 
Model(getString(buttontxt.send)));

   submitButton.setLabel(new Model(getString(buttontxt.send)));
   add(submitButton);

regards, nico


info(getString(your.key));

Jeremy Thomerson
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]