[izpack-changes] r1649 - izpack-src/trunk/src/lib/com/izforge/izpack/installer
noreply at berlios.de
noreply at berlios.de
Fri Nov 24 14:14:51 CET 2006
Author: bartzkau
Date: 2006-11-24 14:14:50 +0100 (Fri, 24 Nov 2006)
New Revision: 1649
Modified:
izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallData.java
izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java
Log:
Hack for using panel metadata (the Panel object used by the
current IzPanel) also in the constructor.
getI18nStringForClass supports now panelids if exist.
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallData.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallData.java 2006-11-24 12:00:46 UTC (rev 1648)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallData.java 2006-11-24 13:14:50 UTC (rev 1649)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import com.izforge.izpack.GUIPrefs;
+import com.izforge.izpack.Panel;
/**
* Encloses information about the install process. This class is implemented as a singleton which
@@ -39,6 +40,12 @@
/** The GUI preferences. */
public GUIPrefs guiPrefs;
+
+ /** Contains at IzPanel constructor call the related Panel object. This is a hack
+ * to allow usage of the meta data stored in the Panel object during construction of
+ * the IzPanel. Do not use this member at an other place.
+ */
+ public Panel currentPanel;
/** The buttons highlighting color. */
public Color buttonsHColor = new Color(230, 230, 230);
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java 2006-11-24 12:00:46 UTC (rev 1648)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java 2006-11-24 13:14:50 UTC (rev 1649)
@@ -315,9 +315,11 @@
praefix = "";
objectClass = Class.forName(praefix + className);
constructor = objectClass.getDeclaredConstructor(paramsClasses);
+ installdata.currentPanel = p; // A hack to use meta data in IzPanel constructor
+ // Do not call constructor of IzPanel or it's derived at an other place else
+ // metadata will be not set.
object = constructor.newInstance(params);
panel = (IzPanel) object;
- panel.setMetadata(p);
installdata.panels.add(panel);
if (panel.isHidden())
visiblePanelMapping.add(count, new Integer(-1));
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java 2006-11-24 12:00:46 UTC (rev 1648)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java 2006-11-24 13:14:50 UTC (rev 1649)
@@ -309,6 +309,16 @@
this.idata = idata;
this.parent = parent;
+ // To get the Panel object via idata is a hack because InstallData will
+ // be hold global data, not panel specific data. But the Panel object will
+ // be needed in the constructor of some derived classes. And to expand the
+ // constructor is also not a good way because all derived classes have to
+ // change then the signature. Also the custem IzPanels elswhere. Therefore
+ // this hack...
+ // Problems with this hack will be exist if more than one threads calls the
+ // constructors of derived clases. This is not the case.
+ this.metadata = idata.currentPanel;
+ idata.currentPanel = null;
initLayoutHelper( );
}
@@ -497,8 +507,21 @@
StringBuffer buf = new StringBuffer();
buf.append(curClassName).append(".").append(subkey);
String fullkey = buf.toString();
- String retval = parent.langpack.getString(fullkey);
+ String panelid = null;
+ if( getMetadata() != null )
+ {
+ panelid = getMetadata().getPanelid();
+ }
+ String retval = null;
+ if (panelid != null)
+ {
+ buf.append(".");
+ buf.append(panelid);
+ retval = parent.langpack.getString(buf.toString());
+ }
if (retval == null || retval.startsWith(fullkey))
+ retval = parent.langpack.getString(fullkey);
+ if (retval == null || retval.startsWith(fullkey))
{
if (alternateClass == null) return (null);
buf.delete(0, buf.length());
More information about the izpack-changes
mailing list