I've upgraded to the latest release which was built on 03/19/10 at 3:06am. It appears to break my SectionHeaderClickHandler as the ID's I assign to my SectionStackSections are being overwritten. I use the ID's in this handler to determine which SectionStackSection was clicked, as I previously had another issue using the SectionHeaderClickEvent.getSection() value when attempting to determine which one was clicked. Here's a sample of the code:
Code:
public class NavigatorSectionStack extends SectionStack
{
private static NavigatorSectionStack instance = null;
protected final String EXPANDED_IMAGE_URL = "pinned.png";
protected Img smartFoldersExpandedImg;
protected Img myCartExpandedImg;
/**
* @return
*/
public static NavigatorSectionStack getInstance()
{
if (instance == null)
{
instance = new NavigatorSectionStack();
}
return (instance);
}
/**
*
*/
private NavigatorSectionStack()
{
setVisibilityMode(VisibilityMode.MUTEX);
setShowExpandControls(Boolean.FALSE);
setWidth("100%");
setHeight("208px");
// Smart Folders section...
smartFoldersExpandedImg = new Img(EXPANDED_IMAGE_URL, 20, 20);
smartFoldersExpandedImg.setMargin(new Integer(2));
smartFoldersExpandedImg.setPadding(new Integer(0));
smartFoldersExpandedImg.setImageType(ImageStyle.NORMAL);
smartFoldersExpandedImg.setVisible(false);
imgHTML = Canvas.imgHTML("smartfolders.png");
title = "<span>" + imgHTML + " Smart Folders</span>";
final SectionStackSection smartFoldersSection = new SectionStackSection(title);
smartFoldersSection.setID("Smart Folders");
smartFoldersSection.setControls(smartFoldersExpandedImg);
smartFoldersSection.setExpanded(Boolean.FALSE);
addSection(smartFoldersSection);
// My Cart section...
myCartExpandedImg = new Img(EXPANDED_IMAGE_URL, 20, 20);
myCartExpandedImg.setMargin(new Integer(2));
myCartExpandedImg.setPadding(new Integer(0));
myCartExpandedImg.setImageType(ImageStyle.NORMAL);
myCartExpandedImg.setVisible(false);
imgHTML = Canvas.imgHTML("mybasket.png");
title = "<span>" + imgHTML + " My Cart</span>";
final SectionStackSection myCartSection = new SectionStackSection(title);
myCartSection.setID("My Cart");
myCartSection.setControls(myCartExpandedImg);
myCartSection.setExpanded(Boolean.FALSE);
addSection(myCartSection);
addSectionHeaderClickHandler(new SectionHeaderClickHandler()
{
public void onSectionHeaderClick(SectionHeaderClickEvent event)
{
if (event != null)
{
event.cancel();
smartFoldersExpandedImg.setVisible(false);
myCartExpandedImg.setVisible(false);
if (event.getSection() != null)
{
String sectionID = event.getSection().getID();
if (sectionID != null)
{
if (sectionID.equals(smartFoldersSection.getID()))
{
// TODO: Change header to use orange gradiants...
smartFoldersExpandedImg.setVisible(true);
NavigatorCanvas.getInstance().showCard("smartFolders");
}
else if (sectionID.equals(myCartSection.getID()))
{
// TODO: Change header to use orange gradiants...
myCartExpandedImg.setVisible(true);
NavigatorCanvas.getInstance().showCard("myCart");
}
}
}
}
}
});
}
}
Comment