- added color customization in render-config.xml - added ability to scale size of Venice logo in footer - added ability to customize size of site logo, as well as add a hyperlink - moved to use of LOG4J 1.1.3, LOG4J now installed in Venice lib directory instead of in JRE extensions directory (only Java extensions should go in JRE extensions directory) - close to requiring JAXP 1.1 (will still work with 1.0 though)
135 lines
3.5 KiB
Java
135 lines
3.5 KiB
Java
/*
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
* (the "License"); you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Venice Web Communities System.
|
|
*
|
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
|
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
package com.silverwrist.venice.servlets.format;
|
|
|
|
import java.io.Writer;
|
|
import java.io.IOException;
|
|
import com.silverwrist.util.StringUtil;
|
|
import com.silverwrist.venice.ValidationException;
|
|
|
|
public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelectors
|
|
{
|
|
private String name;
|
|
private String caption;
|
|
private String caption2;
|
|
private boolean required;
|
|
private String value = null;
|
|
private boolean enabled;
|
|
|
|
protected CDBaseFormFieldReverse(String name, String caption, String caption2, boolean required)
|
|
{
|
|
this.name = name;
|
|
this.caption = caption;
|
|
this.caption2 = caption2;
|
|
this.required = required;
|
|
this.enabled = true;
|
|
|
|
} // end constructor
|
|
|
|
protected CDBaseFormFieldReverse(CDBaseFormFieldReverse other)
|
|
{
|
|
this.name = other.name;
|
|
this.caption = other.caption;
|
|
this.caption2 = other.caption2;
|
|
this.required = other.required;
|
|
this.enabled = true;
|
|
// N.B.: do NOT copy value!
|
|
|
|
} // end constructor
|
|
|
|
protected abstract void renderActualField(Writer out, RenderData rdat)
|
|
throws IOException;
|
|
|
|
protected void validateContents(String value) throws ValidationException
|
|
{ // this is a do-nothing value
|
|
} // end validateContents
|
|
|
|
protected final String getCaption()
|
|
{
|
|
return caption;
|
|
|
|
} // end getCaption
|
|
|
|
public void renderHere(Writer out, RenderData rdat) throws IOException
|
|
{
|
|
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=RIGHT>");
|
|
renderActualField(out,rdat);
|
|
out.write("</TD>\n<TD ALIGN=LEFT><FONT COLOR=\""
|
|
+ rdat.getStdColor(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED) + "\">"
|
|
+ StringUtil.encodeHTML(caption));
|
|
if (caption2!=null)
|
|
out.write(" " + StringUtil.encodeHTML(caption2));
|
|
out.write("</FONT>");
|
|
if (required)
|
|
out.write(rdat.getRequiredBullet());
|
|
out.write("</TD>\n</TR>\n");
|
|
|
|
} // end renderHere
|
|
|
|
public String getName()
|
|
{
|
|
return name;
|
|
|
|
} // end getName
|
|
|
|
public String getValue()
|
|
{
|
|
return value;
|
|
|
|
} // end getValue
|
|
|
|
public void setValue(String value)
|
|
{
|
|
this.value = value;
|
|
|
|
} // end setValue
|
|
|
|
public boolean isRequired()
|
|
{
|
|
return required;
|
|
|
|
} // end isRequired
|
|
|
|
public CDCommandButton findButton(String name)
|
|
{
|
|
return null;
|
|
|
|
} // end findButton
|
|
|
|
public void validate() throws ValidationException
|
|
{
|
|
if (required && enabled && StringUtil.isStringEmpty(value))
|
|
throw new ValidationException("The '" + caption + "' field is required.");
|
|
validateContents(value);
|
|
|
|
} // end validate
|
|
|
|
public boolean isEnabled()
|
|
{
|
|
return enabled;
|
|
|
|
} // end isEnabled
|
|
|
|
public void setEnabled(boolean flag)
|
|
{
|
|
enabled = flag;
|
|
|
|
} // end setEnabled
|
|
|
|
} // end CDBaseFormFieldReverse
|