[izpack-devel] patch: use intance number to customize strings

Dennis Reil Dennis.Reil at reddot.de
Fri Nov 17 08:46:33 CET 2006


Hi Stefan,

You should use the panelid instead. (panel.getMetadata().getPanelid())
That would be much more flexible.

Regards,
   Dennis

> Hi Stefan,
> I do not use multiple instances of one panel class (else I 
> had seen the problem at impl the feature) but it hear good.
> Unfortunately I have nearly no time...
> Please send us your changes as a diff -u (comments as java 
> comments in the files). Simplest you checkout the SVN
> IzPack project and make the diff with SVN.
> 
> Cheers
> 
> Klaus
> 
> >-----Original Message-----
> >From: izpack-devel-bounces at lists.berlios.de
> >[mailto:izpack-devel-bounces at lists.berlios.de]On Behalf Of Stefan
> >Wachter
> >Sent: Thursday, November 16, 2006 2:53 PM
> >To: izpack-devel at lists.berlios.de
> >Subject: [izpack-devel] patch: use intance number to customize strings
> >
> >
> >Hi all,
> >
> >I have several UserInputPanels that should have different 
> >headlines. I looked into the code and 
> >recognized that only a single headline can be configured that 
> >is used for all UserInputPanels. 
> >Therefore I patched the getI18nStringForClass(String subkey) 
> >method in the IzPanel class to consider 
> >instance numbers and added the method getInstanceNumber() with 
> >a default implementation that returns -1:
> >
> >// start code
> >
> >public String getI18nStringForClass(String subkey)
> >{
> >     String retval = null;
> >     Class clazz = this.getClass();
> >     while (retval == null && !clazz.getName().endsWith(".IzPanel"))
> >     {
> >         int instanceNumber = getInstanceNumber();
> >         if (instanceNumber != -1) {
> >             retval = getI18nStringForClass(clazz.getName(), 
> >subkey + "." + instanceNumber, null);
> >             if (retval != null) return retval;
> >         }
> >         retval = getI18nStringForClass(clazz.getName(), subkey, null);
> >         clazz = clazz.getSuperclass();
> >     }
> >     return (retval);
> >}
> >
> >protected int getInstanceNumber() { return -1; }
> >
> >// end code
> >
> >In order to make use of this new flexibility, I overloaded the 
> >getInstanceNumber() method in the 
> >UserInputPanel class returning the instance number of the 
> >UserInputPanel:
> >
> >// start code
> >
> >protected int getInstanceNumber() { return instanceNumber; }
> >
> >// end code
> >
> >Now different headlines can be configured for the various 
> >UserInputPanels. For example:
> >
> ><langpack>
> >   <str id="UserInputPanel.headline.0" txt="Rechnername und Port"/>
> >   <str id="UserInputPanel.headline.1" txt="Shortcuts"/>
> >   <str id="UserInputPanel.headline.2" txt="PolFHa-Server starten"/>
> ></langpack>
> >
> >Is this code of public interest? Will someone integrate it into IzPack?
> >
> >Cheers,
> >--Stefan
> >
> >_______________________________________________
> >izpack-devel mailing list
> >izpack-devel at lists.berlios.de
> >https://lists.berlios.de/mailman/listinfo/izpack-devel
> >
> _______________________________________________
> izpack-devel mailing list
> izpack-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-devel

In unseren kostenlosen Live Demos lernen Sie in 30 Minuten
mehr darüber, wie Sie Ihre Zielgruppen über Website, Intranet
und Portale einfacher, gezielter und kostengünstiger mit
Informationen versorgen. Alle Themen und Anmeldung unter
www.reddot.de/webinare

Check out our Live Demos and learn in just 30 minutes how easily 
and efficiently you can provide information to your target 
groups via Web sites, intranets, and portals. Register now: 
http://www.reddot.com/products_content_management_demos.htm





More information about the izpack-devel mailing list