added an indent= attribute to link items in left menus and fixed another couple

of minor bugs
This commit is contained in:
Eric J. Bowersox 2001-12-03 20:26:51 +00:00
parent 004dcaf7ec
commit 1db18b7fb9
3 changed files with 28 additions and 9 deletions

View File

@ -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.
*

View File

@ -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

View File

@ -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 <link/> if it got here!");
throw new ConfigException("not a <link/> 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 <link/>");
} // 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("<FONT COLOR=\"" + rdat.getStdColor(CONTENT_DISABLED) + "\">");
for (int i=0; i<indent; i++)
out.write("&nbsp;"); // do indent
contents.renderHere(out,rdat);
out.write("</FONT>");
if (enabled)