[izpack-user] skipPanel() and conditions

43 views
Skip to first unread message

Grant Ingersoll

unread,
Apr 21, 2008, 5:57:37 PM4/21/08
to us...@izpack.codehaus.org
I have a couple of Panels that are not visible to the user, one of
which sets a variable, that then feeds a condition which determines if
the upcoming panel is to be displayed or not. It _appears_ that
conditions are getting evaluated at the start of the chain, but not
after each panel, when skipPanel() is called. It seems skipPanel just
forges ahead with calls to show the next panel, but it does not check
the conditions when skipping. Does anyone's reading of the code
concur with that?

When I debug, I just see that these non-visible skipPanel() Panels are
just added to the stack via the skipPanel() -> switchPanel() methods,
whereas visible Panels go through the navigateNext() flow.

Thanks,
Grant

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Dennis Reil

unread,
Apr 22, 2008, 1:56:40 AM4/22/08
to us...@izpack.codehaus.org
No, that's not correct. Conditions are always checked. You'll have to look at canShow() in InstallerFrame, which does this work.

You should use the debugger (http://blog.reil-online.de/2007/12/how-to-debug-variables-and-conditions.html) to determine if your variable is set correctly and if the condition is evaluated to true if the variable changes.


Regards,
Dennis

-----Ursprüngliche Nachricht-----
Von: Grant Ingersoll [mailto:gsin...@apache.org]
Gesendet: Montag, 21. April 2008 23:58
An: us...@izpack.codehaus.org
Betreff: [izpack-user] skipPanel() and conditions

Grant Ingersoll

unread,
Apr 22, 2008, 7:31:20 AM4/22/08
to us...@izpack.codehaus.org
Thanks for the response, Dennis.

When the code hits the logging debug (Line 827 of InstallerFrame)
statements in the code, the conditions are evaluated and they show the
condition as false, yet the panels are still being executed. I don't
see that canShow() is in the skipPanel execution path (all skipPanel()
really does is call showPanel()) in the code, only in the
navigateNext() and navigatePrevious().

I am calling skipPanel() per the instructions in the user guide at the
end of my panelActivate() method.

I also don't see a debugger window like your blog suggests. I am on
3.11 using the standalone compiler on a Mac and have -DTRACE=true set
(I do see logging info on the console).

Thanks,
Grant

--------------------------
Grant Ingersoll

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ

Dennis Reil

unread,
Apr 22, 2008, 7:47:48 AM4/22/08
to us...@izpack.codehaus.org
You'll have to add the showDebugWindow to your guiprefs.
I think I'll change that in the code to make it optional.


-----Ursprüngliche Nachricht-----
Von: Grant Ingersoll [mailto:gsin...@apache.org]

Gesendet: Dienstag, 22. April 2008 13:31
An: us...@izpack.codehaus.org
Betreff: Re: AW: [izpack-user] skipPanel() and conditions

Dennis Reil

unread,
Apr 22, 2008, 7:55:43 AM4/22/08
to us...@izpack.codehaus.org
Ok, regarding your skipPanel-question:

If skipPanel is called, it will call navigatePrevious or navigateNext which will then call hasNavigateNext or hasNavigatePrevious.
These functions will call canShow..

So it definitely is in the execution path.

Regards,
Dennis

-----Ursprüngliche Nachricht-----
Von: Grant Ingersoll [mailto:gsin...@apache.org]

Gesendet: Dienstag, 22. April 2008 13:31
An: us...@izpack.codehaus.org
Betreff: Re: AW: [izpack-user] skipPanel() and conditions

Thanks for the response, Dennis.

Grant Ingersoll

unread,
Apr 22, 2008, 8:04:05 AM4/22/08
to us...@izpack.codehaus.org
What version of the code are you referring to? My versions are
below. If I do a "Find Usages" on the code, I don't see that they are
called.


In InstallerFrame, my skipPanel() looks like:

public void skipPanel()
{
if (installdata.curPanelNumber < installdata.panels.size() - 1)
{
if (isBack)
{
installdata.curPanelNumber--;
switchPanel(installdata.curPanelNumber + 1);
}
else
{
installdata.curPanelNumber++;
switchPanel(installdata.curPanelNumber - 1);
}

}
}

Is there somewhere else I should be looking?

and switchPanel() looks like:

protected void switchPanel(int last)
{
// refresh dynamic variables every time, a panel switch is done
refreshDynamicVariables();
try
{
if (installdata.curPanelNumber < last)
{
isBack = true;
}
panelsContainer.setVisible(false);
IzPanel panel = (IzPanel)
installdata.panels.get(installdata.curPanelNumber);
IzPanel l_panel = (IzPanel) installdata.panels.get(last);
if (Debug.isTRACE()) {

debugger.switchPanel(panel.getMetadata(),l_panel.getMetadata());
}
Log.getInstance().addDebugMessage(
"InstallerFrame.switchPanel: try switching panel
from {0} to {1} ({2} to {3})",
new String[] { l_panel.getClass().getName(),
panel.getClass().getName(),
Integer.toString(last),
Integer.toString(installdata.curPanelNumber)},
DebugConstants.PANEL_TRACE, null);

// instead of writing data here which leads to duplicated
entries in
// auto-installation script (bug # 4551), let's make data
only immediately before
// writing out that script.
//
l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last));
// No previos button in the first visible panel
if (((Integer)
visiblePanelMapping.get(installdata.curPanelNumber)).intValue() == 0)
{
prevButton.setVisible(false);
lockPrevButton();
unlockNextButton(); // if we push the button back at
the license
// panel
}
// Only the exit button in the last panel.
else if (((Integer)
visiblePanelMapping.get(installdata.panels.size())).intValue() ==
installdata.curPanelNumber)
{
prevButton.setVisible(false);
nextButton.setVisible(false);
lockNextButton();
}
else
{
prevButton.setVisible(true);
nextButton.setVisible(true);
unlockPrevButton();
unlockNextButton();
}
// With VM version >= 1.5 setting default button one time
will not work.
// Therefore we set it every panel switch and that also
later. But in
// the moment it seems so that the quit button will not
used as default button.
// No idea why... (Klaus Bartz, 06.09.25)
SwingUtilities.invokeLater(new Runnable() {

public void run()
{
JButton cdb = null;
String buttonName = "next";
if (nextButton.isEnabled()) {
cdb = nextButton;
quitButton.setDefaultCapable(false);
prevButton.setDefaultCapable(false);
nextButton.setDefaultCapable(true);
} else if (quitButton.isEnabled()) {
cdb = quitButton;
buttonName = "quit";
quitButton.setDefaultCapable(true);
prevButton.setDefaultCapable(false);
nextButton.setDefaultCapable(false);
}
getRootPane().setDefaultButton(cdb);

Log.getInstance().addDebugMessage("InstallerFrame.switchPanel: setting
{0} as default button",
new String[] { buttonName },
DebugConstants.PANEL_TRACE,
null);
}
});

// Change panels container to the current one.
panelsContainer.remove(l_panel);
l_panel.panelDeactivate();
panelsContainer.add(panel);

if (panel.getInitialFocus() != null)
{ // Initial focus hint should be performed after current
panel
// was added to the panels container, else the focus
hint will
// be ignored.
// Give a hint for the initial focus to the system.
final Component inFoc = panel.getInitialFocus();
if (JAVA_SPECIFICATION_VERSION < 1.35)
{
inFoc.requestFocus();
}
else
{ // On java VM version >= 1.5 it works only if
// invoke later will be used.
SwingUtilities.invokeLater(new Runnable() {

public void run()
{
inFoc.requestFocusInWindow();
}
});
}
/*
* On editable text components position the caret to
the end of the cust existent
* text.
*/
if (inFoc instanceof JTextComponent)
{
JTextComponent inText = (JTextComponent) inFoc;
if (inText.isEditable() && inText.getDocument() !
= null)
{

inText.setCaretPosition(inText.getDocument().getLength());
}
}
}
performHeading(panel);
performHeadingCounter(panel);
panel.panelActivate();
panelsContainer.setVisible(true);
Panel metadata = panel.getMetadata();
if ((metadata != null) &&
(!"UNKNOWN".equals(metadata.getPanelid())))
{
loadAndShowImage(((Integer)
visiblePanelMapping.get(installdata.curPanelNumber))
.intValue(), metadata.getPanelid());
}
else
{
loadAndShowImage(((Integer)
visiblePanelMapping.get(installdata.curPanelNumber))
.intValue());
}
isBack = false;
callGUIListener(GUIListener.PANEL_SWITCHED);

Log.getInstance().addDebugMessage("InstallerFrame.switchPanel:
switched", null,
DebugConstants.PANEL_TRACE, null);
}
catch (Exception err)
{
err.printStackTrace();

Dennis Reil

unread,
Apr 22, 2008, 8:20:44 AM4/22/08
to us...@izpack.codehaus.org
I'm looking at the current trunk version which will be 4.0.

public void skipPanel()
{
if (installdata.curPanelNumber < installdata.panels.size() - 1)
{
if (isBack)
{

navigatePrevious(installdata.curPanelNumber);
}
else
{
navigateNext(installdata.curPanelNumber, false);
}
}
}

This was integrated by IzPack-16.

-----Ursprüngliche Nachricht-----
Von: Grant Ingersoll [mailto:gsin...@apache.org]

Gesendet: Dienstag, 22. April 2008 14:04
An: us...@izpack.codehaus.org
Betreff: Re: AW: AW: [izpack-user] skipPanel() and conditions

Grant Ingersoll

unread,
Apr 22, 2008, 8:27:03 AM4/22/08
to us...@izpack.codehaus.org
OK, so it is a bug in the current release. Any thoughts on when 4.0
will be released? Is it considered stable at this point? Is anyone
using it in production?

I can live with the bug for now, it just prevents me from doing some
error handling in certain conditions.

Julien Ponge

unread,
Apr 22, 2008, 8:36:55 AM4/22/08
to us...@izpack.codehaus.org
> OK, so it is a bug in the current release. Any thoughts on when 4.0 will be
> released? Is it considered stable at this point? Is anyone using it in
> production?

Here's the roadmap:
http://jira.codehaus.org/browse/IZPACK?report=com.atlassian.jira.plugin.system.project:roadmap-panel

Brett M. Bergquist

unread,
Apr 22, 2008, 9:07:06 AM4/22/08
to us...@izpack.codehaus.org
I just submitted the patch the other day that fixes that adds the
"hasNavigateNext" and "hasNavigatePrevious" to check for these
conditions. The code also did not take into consideration that were you
are trying to navigate two might not only be available because of a
condition, but the panel might also not be visible. In my case, I have
a hidden panel as the first panel and the "Previous" button was still
being shown at the first visible panel (Hello) but the user should not
be able to navigate back to the hidden panel.

I am using the latest (trunk) for 8 installers that have conditions,
hidden panels, etc. and I'm not having any issues right now. Yesterday
I replaced my 3.11.0 version with patches with the trunk and rebuild all
8 installers and they worked the same as my 3.11.0 with patches so I
think the two are equivalent now.

I think the trunk version is more stable than the 3.11.0 so I would not
hesitate to build it myself and use it.

Reply all
Reply to author
Forward
0 new messages