fixed a minort bug in graphic menu handling

This commit is contained in:
Eric J. Bowersox 2001-11-12 23:42:56 +00:00
parent 81c7109152
commit c059e09615

View File

@ -62,12 +62,24 @@ public class LeftMenu implements ComponentRender
static class Separator implements ComponentRender
{
private ComponentRender cr;
Separator()
{ // do nothing
{
this.cr = null;
} // end constructor
Separator(ComponentRender cr)
{
this.cr = cr;
} // end constructor
public void renderHere(Writer out, RenderData rdat) throws IOException
{
if (cr!=null)
cr.renderHere(out,rdat);
out.write("<BR>\n");
} // end renderHere
@ -80,7 +92,7 @@ public class LeftMenu implements ComponentRender
*/
private static Category logger = Category.getInstance(LeftMenu.class);
private static final Separator separator_singleton = new Separator();
private static final Separator separator_singleton = new Separator(null);
/*--------------------------------------------------------------------------------
* Attributes
@ -117,13 +129,13 @@ public class LeftMenu implements ComponentRender
else if (n.getNodeName().equals("text"))
{ // add a text item
DOMElementHelper h = new DOMElementHelper((Element)n);
menu_items.add(new TextItem(h.getElementText()));
menu_items.add(new Separator(new TextItem(h.getElementText())));
} // end else if
else if (n.getNodeName().equals("link"))
menu_items.add(new LinkItem((Element)n));
else if (n.getNodeName().equals("image"))
menu_items.add(new ImageItem((Element)n));
menu_items.add(new Separator(new ImageItem((Element)n)));
else
{ // menu definition has an unknown item
logger.fatal("unknown element <" + n.getNodeName() + "/> inside <menudef/>");