org.dspace.app.xmlui.wing.element
Class Field

java.lang.Object
  extended by org.dspace.app.xmlui.wing.element.AbstractWingElement
      extended by org.dspace.app.xmlui.wing.element.Field
All Implemented Interfaces:
StructuralElement, WingElement
Direct Known Subclasses:
Button, CheckBox, Composite, File, Hidden, Password, Radio, Select, Text, TextArea

public abstract class Field
extends AbstractWingElement
implements StructuralElement


Field Summary
static String A_DISABLED
          The name of the disabled attribute
static String A_FIELD_TYPE
          The name of the field type attribute
static String A_REQUIRED
          The name of the required attribute
protected  boolean disabled
          Whether this field is disabled
static String E_FIELD
          The name of the field element
protected  List<Error> errors
          Error instructions for this field
protected  List<Field> fields
          All sub fields contained within a composite field
protected  Help help
          Help instructions for this field
protected  List<Instance> instances
          The set of stored values
protected  Label label
          The fields Label
protected  String name
          The field's name
static String OPERATION_ADD
          Possible field behavioral operations
static String OPERATION_DELETE
           
static String[] OPERATIONS
           
protected  List<Option> options
          The value of this field
protected  Params params
          Additional field parameters
protected  String rend
          Any special rendering instructions
protected  boolean required
          Whether this field is required
protected  String type
          The type of field, see TYPES above
static String TYPE_BUTTON
          The possible field types
static String TYPE_CHECKBOX
           
static String TYPE_COMPOSITE
           
static String TYPE_FILE
           
static String TYPE_HIDDEN
           
static String TYPE_PASSWORD
           
static String TYPE_RADIO
           
static String TYPE_SELECT
           
static String TYPE_TEXT
           
static String TYPE_TEXTAREA
           
static String[] TYPES
          All the possible field types collected into one array.
protected  List<Value> values
          The value of this field
 
Fields inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
context
 
Fields inherited from interface org.dspace.app.xmlui.wing.element.StructuralElement
A_ID, A_NAME, A_RENDER
 
Constructor Summary
protected Field(WingContext context, String name, String type, String rend)
          Construct a new field.
 
Method Summary
 Error addError()
          The error elements denotes that the fields value is invalid for the given context.
 void addError(Message message)
          The error elements denotes that the fields value is invalid for the given context.
 void addError(String characters)
          The error elements denotes that the fields value is invalid for the given context.
 void dispose()
          Dispose
protected  void removeValueOfType(String removeType)
          Private function to remove all values of a particular type.
 void setAuthorityControlled()
          Set this field to be authority-controlled.
 void setAuthorityControlled(boolean value)
          Set this field to be authority-controlled.
 void setAuthorityRequired()
          Set this field as authority_required.
 void setAuthorityRequired(boolean value)
          Set this field to either be required or not required as determined by the required parameter.
 void setAutofocus(String value)
          Set the field's autofocus attribute, an HTML5 feature.
 void setChoices(String fieldKey)
          Declare that this field has a value to be chosen from a choice provider (see ChoicesManager).
 void setChoicesClosed()
           
 void setChoicesClosed(boolean value)
          Set whether set of choices is "closed" to just the values in menu, or allows arbitrary user-supplied values.
 void setChoicesPresentation(String value)
          Set the kind of UI presentation requested for this choice, e.g.
 void setDisabled()
          Set this field to be disabled.
 void setDisabled(boolean disabled)
          Set this field to either be disabled or enabled as determined by the disabled parameter.
 Help setHelp()
          The help element provides help instructions to assist the user in using this field.
 void setHelp(Message message)
          The help element provides help instructions to assist the user in using this field.
 void setHelp(String characters)
          The help element provides help instructions to assist the user in using this field.
 Label setLabel()
          The help element provides help instructions to assist the user in using this field.
 void setLabel(Message message)
          The help element provides help instructions to assist the user in using this field.
 void setLabel(String characters)
          The help element provides help instructions to assist the user in using this field.
 void setRequired()
          Set this field as required.
 void setRequired(boolean required)
          Set this field to either be required or not required as determined by the required parameter.
 void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, NamespaceSupport namespaces)
          Translate this element and all contained elements into SAX events.
 
Methods inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
endElement, endElement, getWingContext, greater, lesser, require, require, requireFalse, requireTrue, restrict, sendCharacters, setWingContext, startElement, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

E_FIELD

public static final String E_FIELD
The name of the field element

See Also:
Constant Field Values

A_FIELD_TYPE

public static final String A_FIELD_TYPE
The name of the field type attribute

See Also:
Constant Field Values

A_DISABLED

public static final String A_DISABLED
The name of the disabled attribute

See Also:
Constant Field Values

A_REQUIRED

public static final String A_REQUIRED
The name of the required attribute

See Also:
Constant Field Values

TYPE_BUTTON

public static final String TYPE_BUTTON
The possible field types

See Also:
Constant Field Values

TYPE_CHECKBOX

public static final String TYPE_CHECKBOX
See Also:
Constant Field Values

TYPE_FILE

public static final String TYPE_FILE
See Also:
Constant Field Values

TYPE_HIDDEN

public static final String TYPE_HIDDEN
See Also:
Constant Field Values

TYPE_PASSWORD

public static final String TYPE_PASSWORD
See Also:
Constant Field Values

TYPE_RADIO

public static final String TYPE_RADIO
See Also:
Constant Field Values

TYPE_SELECT

public static final String TYPE_SELECT
See Also:
Constant Field Values

TYPE_TEXT

public static final String TYPE_TEXT
See Also:
Constant Field Values

TYPE_TEXTAREA

public static final String TYPE_TEXTAREA
See Also:
Constant Field Values

TYPE_COMPOSITE

public static final String TYPE_COMPOSITE
See Also:
Constant Field Values

TYPES

public static final String[] TYPES
All the possible field types collected into one array.


OPERATION_ADD

public static final String OPERATION_ADD
Possible field behavioral operations

See Also:
Constant Field Values

OPERATION_DELETE

public static final String OPERATION_DELETE
See Also:
Constant Field Values

OPERATIONS

public static final String[] OPERATIONS

name

protected String name
The field's name


type

protected String type
The type of field, see TYPES above


disabled

protected boolean disabled
Whether this field is disabled


required

protected boolean required
Whether this field is required


rend

protected String rend
Any special rendering instructions


params

protected Params params
Additional field parameters


label

protected Label label
The fields Label


help

protected Help help
Help instructions for this field


errors

protected List<Error> errors
Error instructions for this field


fields

protected List<Field> fields
All sub fields contained within a composite field


options

protected List<Option> options
The value of this field


values

protected List<Value> values
The value of this field


instances

protected List<Instance> instances
The set of stored values

Constructor Detail

Field

protected Field(WingContext context,
                String name,
                String type,
                String rend)
         throws WingException
Construct a new field.

Parameters:
context - (Required) The context this element is contained in, such as where to route SAX events and what i18n catalogue to use.
name - (Required) a non-unique local identifier used to differentiate the element from its siblings within an interactive division. This is the name of the field use when data is submitted back to the server.
type - (Required) Specify the type of field, must be one of the field types defined in the static variable TYPES.
rend - (May be null) a rendering hint used to override the default display of the element.
Throws:
WingException
Method Detail

setRequired

public void setRequired()
Set this field as required.


setRequired

public void setRequired(boolean required)
Set this field to either be required or not required as determined by the required parameter.

Parameters:
required - Determine if the field is required or not.

setDisabled

public void setDisabled()
Set this field to be disabled.


setDisabled

public void setDisabled(boolean disabled)
Set this field to either be disabled or enabled as determined by the disabled parameter.

Parameters:
disabled - Determine if the field is required or not.

setAuthorityControlled

public void setAuthorityControlled()
Set this field to be authority-controlled.


setAuthorityControlled

public void setAuthorityControlled(boolean value)
Set this field to be authority-controlled.

Parameters:
value - true if field is authority-controlled.

setAuthorityRequired

public void setAuthorityRequired()
Set this field as authority_required.


setAuthorityRequired

public void setAuthorityRequired(boolean value)
Set this field to either be required or not required as determined by the required parameter.

Parameters:
value - Determine if the authority control is required or not on this field.

setAutofocus

public void setAutofocus(String value)
Set the field's autofocus attribute, an HTML5 feature. Valid input values to enable autofocus are: autofocus, and empty string.

Parameters:
value - To enable autofocus: "autofocus" or ""

setChoices

public void setChoices(String fieldKey)
Declare that this field has a value to be chosen from a choice provider (see ChoicesManager). Value is a metadata field key naming the field whose choices to use.

Parameters:
fieldKey - pre-determined metadata field key

setChoicesPresentation

public void setChoicesPresentation(String value)
                            throws WingException
Set the kind of UI presentation requested for this choice, e.g. select vs. suggest. Value must match one of the PRESENTATIONS.

Parameters:
value - pre-determined metadata field key
Throws:
WingException

setChoicesClosed

public void setChoicesClosed(boolean value)
Set whether set of choices is "closed" to just the values in menu, or allows arbitrary user-supplied values.

Parameters:
value - true if it is closed

setChoicesClosed

public void setChoicesClosed()

setHelp

public Help setHelp()
             throws WingException
The help element provides help instructions to assist the user in using this field.

Throws:
WingException

setHelp

public void setHelp(String characters)
             throws WingException
The help element provides help instructions to assist the user in using this field.

Parameters:
characters - (May be null) Direct content or a dictionary tag to be inserted into the element.
Throws:
WingException

setHelp

public void setHelp(Message message)
             throws WingException
The help element provides help instructions to assist the user in using this field.

Parameters:
message - (Required) A key into the i18n catalogue for translation into the user's preferred language.
Throws:
WingException

addError

public Error addError()
               throws WingException
The error elements denotes that the fields value is invalid for the given context. The message contained within the error message will provide assistance to the user in correcting the problem.

Throws:
WingException

addError

public void addError(String characters)
              throws WingException
The error elements denotes that the fields value is invalid for the given context. The message contained within the error message will provide assistance to the user in correcting the problem.

Parameters:
characters - (May be null) Direct content or a dictionary tag to be inserted into the element.
Throws:
WingException

addError

public void addError(Message message)
              throws WingException
The error elements denotes that the fields value is invalid for the given context. The message contained within the error message will provide assistance to the user in correcting the problem.

Parameters:
message - (Required) A key into the i18n catalogue for translation into the user's preferred language.
Throws:
WingException

setLabel

public Label setLabel()
               throws WingException
The help element provides help instructions to assist the user in using this field.

Throws:
WingException

setLabel

public void setLabel(String characters)
              throws WingException
The help element provides help instructions to assist the user in using this field.

Parameters:
characters - (May be null) Direct content or a dictionary tag to be inserted into the element.
Throws:
WingException

setLabel

public void setLabel(Message message)
              throws WingException
The help element provides help instructions to assist the user in using this field.

Parameters:
message - (Required) A key into the i18n catalogue for translation into the user's preferred language.
Throws:
WingException

removeValueOfType

protected void removeValueOfType(String removeType)
Private function to remove all values of a particular type.

Parameters:
removeType - The type to be removed.

toSAX

public void toSAX(ContentHandler contentHandler,
                  LexicalHandler lexicalHandler,
                  NamespaceSupport namespaces)
           throws SAXException
Translate this element and all contained elements into SAX events. The events should be routed to the contentHandler found in the WingContext.

Specified by:
toSAX in interface WingElement
Parameters:
contentHandler - (Required) The registered contentHandler where SAX events should be routed too.
lexicalHandler - (Required) The registered lexicalHandler where lexical events (such as CDATA, DTD, etc) should be routed too.
namespaces - (Required) SAX Helper class to keep track of namespaces able to determine the correct prefix for a given namespace URI.
Throws:
SAXException

dispose

public void dispose()
Dispose

Specified by:
dispose in interface WingElement
Overrides:
dispose in class AbstractWingElement


Copyright © 2012 DuraSpace. All Rights Reserved.