From 1db18b7fb9d7ca802451af89f3a03398b5266557 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Mon, 3 Dec 2001 20:26:51 +0000 Subject: [PATCH] added an indent= attribute to link items in left menus and fixed another couple of minor bugs --- .../util/ServletMultipartHandler.java | 6 +++++ .../format/CDEmailAddressFormField.java | 4 +-- .../servlets/format/menus/LinkItem.java | 27 ++++++++++++++----- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/com/silverwrist/util/ServletMultipartHandler.java b/src/com/silverwrist/util/ServletMultipartHandler.java index ce1ffe6..0f88f7c 100644 --- a/src/com/silverwrist/util/ServletMultipartHandler.java +++ b/src/com/silverwrist/util/ServletMultipartHandler.java @@ -467,6 +467,12 @@ public final class ServletMultipartHandler } // end getParamNames + public final boolean hasParameter(String name) + { + return param_byname.containsKey(name); + + } // end hasParameter + /** * Returns whether or not the parameter with the specified name is a file parameter. * diff --git a/src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java b/src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java index 0d4881a..4ab51d7 100644 --- a/src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java +++ b/src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java @@ -58,10 +58,10 @@ public class CDEmailAddressFormField extends CDTextFormField *-------------------------------------------------------------------------------- */ - public Object clone() + public CDFormField duplicate() { return new CDEmailAddressFormField(this); - } // end clone + } // end duplicate } // end class CDEmailAddressFormField diff --git a/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java b/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java index 9d12b5a..21f41e4 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java +++ b/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java @@ -27,6 +27,7 @@ import com.silverwrist.venice.except.ConfigException; import com.silverwrist.venice.servlets.format.ColorSelectors; import com.silverwrist.venice.servlets.format.ComponentRender; import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.util.XMLLoader; class LinkItem implements ComponentRender, ColorSelectors { @@ -52,6 +53,7 @@ class LinkItem implements ComponentRender, ColorSelectors private boolean enabled = true; // is this item enabled? private String target = null; // target window for the link private String on_click = null; // onClick JavaScript for the link + private int indent = 0; // how many spaces do we indent this link? private ComponentRender contents; // what does this link contain? (image vs. text) /*-------------------------------------------------------------------------------- @@ -61,15 +63,11 @@ class LinkItem implements ComponentRender, ColorSelectors LinkItem(Element elt) throws ConfigException { - if (!(elt.getNodeName().equals("link"))) - { // just some shorts-checking here to make sure the element is OK - logger.fatal("huh?!? this should have been a if it got here!"); - throw new ConfigException("not a element"); - - } // end if + XMLLoader loader = XMLLoader.get(); + loader.configVerifyNodeName(elt,"link"); + href = loader.configGetAttribute(elt,"href"); DOMElementHelper h = new DOMElementHelper(elt); - href = elt.getAttribute("href"); if (h.hasAttribute("type")) { // get the "type" and check it type = elt.getAttribute("type").trim().toLowerCase(); @@ -100,6 +98,18 @@ class LinkItem implements ComponentRender, ColorSelectors if (h.hasAttribute("disabled")) enabled = false; + if (h.hasAttribute("indent")) + { // load the "indent" attribute, make sure it's not less than 0 + indent = loader.configGetAttributeInt(elt,"indent"); + if (indent<0) + { // whoops - this is an error! + logger.fatal("indent=\"" + indent + "\" is not a valid value"); + throw new ConfigException("invalid indent= attribute of "); + + } // end if + + } // end if + // load the contents Element x = h.getSubElement("image"); if (x!=null) @@ -116,6 +126,7 @@ class LinkItem implements ComponentRender, ColorSelectors this.enabled = other.enabled; this.target = other.target; this.on_click = StringUtil.replaceAllVariables(other.on_click,vars); + this.indent = other.indent; this.contents = other.contents; } // end constructor @@ -145,6 +156,8 @@ class LinkItem implements ComponentRender, ColorSelectors } // end if else // write the "disabled" indicator out.write(""); + for (int i=0; i"); if (enabled)