|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.ui.EditForm
A bean providing a generic representation for a complex editing form.
This class defines the "widgets" support within the form, it is expected to be subclassed and given implementations of two methods: generate() for building the form's contents, and process() for handling the forms submitted data.
You only need to implement process() if you intend to post the form data to another page that will use the same EditForm class for processing. This is however recommended, as you keep the knowledge of the semantics of the post data in the same class that generated the form.
Nested Class Summary | |
static class |
EditForm.ActionAppletMultiSelect
|
static class |
EditForm.ActionCheckbox
|
static class |
EditForm.ActionLeftCheckbox
|
static class |
EditForm.ActionRadio
|
static class |
EditForm.ActionSelect
A class describing the contents of a <select> element that will take an action when an item is selected. |
static class |
EditForm.AppletMultiSelect
A class describing a collection of HTML elements that provide a multi-select widget with a box on the left containing available items, a box on the right containing the selected items, and some buttons down the middle to control movment of items between the boxes. |
static class |
EditForm.Button
|
static class |
EditForm.Checkbox
A class describing a single checkbox element. |
static class |
EditForm.CheckboxArray
A class that builds a checkbox array with row and column labels. |
static class |
EditForm.CheckboxTree
|
static class |
EditForm.DatePicker
DatePicker. |
static class |
EditForm.DateRange
A class that builds a date range of the form: title from |
static class |
EditForm.FileUpload
|
static class |
EditForm.FormTable
A class that builds a table with rows of items |
static class |
EditForm.HelpRef
A base class for all of the various editing items that can appear in a form. |
static class |
EditForm.Hidden
A class describing a chunk of hidden data. |
static class |
EditForm.HTMLItem
A wrapper class to embed anything that generates its own html into a form (used for buttons in the user find form currently) |
static class |
EditForm.Item
|
static class |
EditForm.Label
An item that is rendered as a non-editable label. |
static class |
EditForm.LeftCheckbox
A class describing a single checkbox element with the title on the left. |
static class |
EditForm.ListResult
|
static class |
EditForm.MultiSelectPicker
MultiSelectPicker. |
static class |
EditForm.PlainText
This class is a shortcut to get text in columns 2 and 3 of an EditForm It is just like a label except there is no title and the value spans both the title and value columns |
static class |
EditForm.Radio
A class describing a set of elements. |
static class |
EditForm.SectionHead
In a form, this will be a section header. |
static class |
EditForm.Select
A class describing the contents of a <select> element. |
static class |
EditForm.StringComparator
Internal class that implenents the Comparator interface for sorting the rows in the table. |
static class |
EditForm.Text
A class describing the contents of an element. |
static class |
EditForm.TextArea
A class describing the contents of an <textarea> element. |
Field Summary | |
protected static Catalog |
_mc
|
static java.lang.String |
code_id
|
static java.lang.String |
DEFAULT_OBJECT_ATTRIBUTE
The HttpSession attribute name under which we store the object state. |
static java.lang.String |
REQD_FIELD
|
protected static Trace |
trace
|
Constructor Summary | |
EditForm()
|
Method Summary | |
PersistentObject |
createEditObject(javax.servlet.http.HttpSession hs,
javax.servlet.ServletRequest req,
Session ws,
Type type)
Obtain an object for use in generating the form. |
abstract void |
generate(javax.servlet.http.HttpSession httpSession,
javax.servlet.http.HttpServletRequest req,
Session wavesetSession)
Form generation method. |
static java.util.List |
generateRefs(Session s,
java.lang.String[] names,
Type type)
|
static java.lang.String |
genOptions(java.util.ArrayList list,
boolean selected)
|
java.lang.String |
getActiveControl()
|
int |
getAdjacentTitleWidth()
Gets the width of the adjacent title columns. |
static java.lang.String[] |
getAdministrators(Session s,
boolean addCurrentAdmin)
Return a string array of Administrator names |
java.lang.String[] |
getAdminRoles(Session s)
Build a list of the names of Admin Roles available |
java.lang.String[] |
getApplications(Session s)
Build a list of the names of services (e.g. |
static java.lang.String[] |
getApproverAdmins(Session s)
Return a list of Administrator object names that can serve as approvers for an object. |
static java.util.ArrayList |
getAssignedApprovers(Session s,
java.util.List admins)
Turn an arraylist of admin refs into an arraylist of strings - the names of the admins. |
java.lang.String |
getButtonCommand(int b)
Return the form command when this button is selected. |
int |
getButtonCount()
Return the number of buttons. |
java.lang.String |
getButtonHtml(int b,
int tabindex,
Session session)
|
java.lang.String |
getButtonHtml(int b,
Session session)
Returns the HTML representation of a button. |
java.lang.String |
getButtonName(int b)
Return the display name of a button. |
java.lang.String |
getButtonValue(int b)
Return the form value when this button is selected. |
java.lang.String |
getCancelURL()
Get the cancel URL for the form. |
java.lang.String[] |
getCapabilities(Session s)
Build a list of the names of Capabilities available |
EditForm.ListResult |
getDefinitionNames(Session s)
Get the available task definitions. |
PersistentObject |
getEditObject(javax.servlet.http.HttpSession hs,
Session ws,
Type type)
Obtain an object for use in processing the form. |
java.lang.String |
getError()
Get the form error message. |
java.lang.Throwable |
getException()
|
java.lang.String |
getFocussedFieldName()
|
java.lang.String |
getImageDir()
Get the image directory. |
java.util.ArrayList |
getIndentedOrgList(Session s)
|
java.lang.String |
getItemHelpHTML(EditForm.Item i,
javax.servlet.http.HttpServletRequest req)
|
java.lang.String |
getItemHelpHTML(java.lang.String title,
javax.servlet.http.HttpServletRequest req,
Session session)
Get the HTML for an item level help, guessing at the help reference from the label string. |
java.lang.String |
getItemHelpPreHTML(java.lang.String itemName,
javax.servlet.http.HttpServletRequest req,
Session session)
This returns all of the help item tag info, but does not put in the space and title. |
java.util.ArrayList |
getItems()
Get the item list. |
java.lang.String |
getMessage()
Get the optional information message. |
java.lang.String |
getNameParameter()
Get the parameter name where we can find the name of the object to be edited. |
java.lang.String |
getObjectAttribute()
Get the parameter name where we are to store the serialized object. |
static java.util.List |
getOrganizations(Session s)
Build a list of the names of organizations that may be assigned to the user. |
PageInformation |
getPageInformation()
Get the PageInformation object for this page |
java.lang.String |
getParameter(javax.servlet.ServletRequest r,
java.lang.String name)
Return the value of a parameter, converting empty strings to null. |
java.lang.String |
getParentId(javax.servlet.ServletRequest req,
Session session)
Get the parent ID. |
java.lang.String |
getParentIdPath(javax.servlet.ServletRequest req,
Session session)
getParentIdPath gets the parent id from getParentId, then turns that into a path by getting the object and calling getPath. |
static java.lang.String[] |
getPolicies(Session s,
java.lang.String type)
Return a string array of policy names of the specified type. |
static java.lang.String[] |
getPolicies(Session s,
java.lang.String type,
java.lang.String currentPolicy)
Special call to get the policies and if the current policy is not on the list, add it to the list. |
java.lang.String |
getPostURL()
Get the post URL for the form. |
static java.lang.String[] |
getRefNames(Session s,
java.util.List refs)
|
static java.lang.String[] |
getRefNames(Session s,
ObjectRef[] refs)
|
static java.util.List |
getResourceAccountAttributeNames(Resource res)
Return a list of account attribute names in this resources schema map |
java.lang.String[] |
getResources(Session s)
Build a list of the names of resources that may be assigned to the user. |
static java.lang.String[] |
getResources(Session s,
Attribute matchType,
java.lang.String value)
Build a list of the names of resources that match a particular type (like LDAP). |
static java.util.Map |
getResourcesAndTypes(Session s)
Return a map whose key is the resource name and whose value is the type of resource. |
java.lang.String[] |
getRoles(Session s)
Build a list of the names of roles that may be assigned to the user. |
static java.lang.String[] |
getRules(Session s,
java.lang.String subtype)
Return a string array of rule names of the specified subtype. |
static java.lang.String[] |
getRules(Session s,
java.lang.String subtype,
java.lang.String currentRule)
Special call to get the rules and if the current rule is not on the list, add it to the list. |
java.lang.String |
getSubTitle()
|
java.lang.String |
getTitle()
Get the title for the form. |
int |
getTitleWidth()
Gets the width of the title column. |
ObjectGroup[] |
getTopmostOrganizations(Session s)
|
java.lang.String |
getType()
Gets the type of this form. |
static java.lang.String[] |
getUserForms(Session s)
Build a list of the names of user forms that may be assigned to orgs, admins, or users. |
protected java.util.Hashtable |
parseMultiPartFormData(javax.servlet.ServletRequest req)
The meat of the request processing. |
abstract java.lang.String |
process(javax.servlet.http.HttpSession httpSession,
javax.servlet.http.HttpServletRequest req,
Session wavesetSession)
Form processing method. |
void |
releaseEditObject(javax.servlet.http.HttpSession hs,
Session ws)
Release the object being edited. |
java.lang.String |
resolveHelpRef(EditForm.HelpRef h,
javax.servlet.http.HttpServletRequest req)
|
void |
saveAsOrRenameEditObject(javax.servlet.http.HttpSession httpsession,
Session session,
java.lang.String command,
PersistentObject obj,
java.lang.String newname)
Process the edit object according to a given command. |
void |
saveEditObject(javax.servlet.http.HttpSession httpsession,
Session session,
java.lang.String command,
PersistentObject obj)
Process the edit object according to a given command. |
void |
setActiveControl(java.lang.String what)
|
void |
setAdjacentTitleWidth(int w)
Sets the width of the adjacent title columns. |
void |
setButtons(java.util.ArrayList buttons)
Sets the button list. |
void |
setButtons(EditForm.Button[] buttons)
Set the buttons. |
void |
setCancelURL(java.lang.String url)
Set the URL that we will POST to when the generated form is canceled. |
void |
setError(java.lang.String msg)
Set the error message. |
void |
setException(java.lang.Throwable th)
Set an optional exception (so that the stack trace can be put in the page) |
void |
setFocussedFieldName(java.lang.String name)
|
void |
setImageDir(java.lang.String dir)
Set the image directory. |
static void |
setInitialMemberObjectGroups(Session ws,
PersistentObject obj,
boolean allowMultipleOrgs)
If the object has one member object group and it is Top, set it to the top organization (or organizations if allowMultipleOrgs is true) that the current administrator can control. |
void |
setItems(java.util.ArrayList items)
Sets the item list. |
void |
setMessage(java.lang.String msg)
Set the optional information message. |
void |
setNameParameter(java.lang.String name)
Set the parameter name where we can find the name of the object to be edited. |
void |
setObjectAttribute(java.lang.String name)
Set the parameter name where we are to store the serialized object. |
void |
setPageInformation(PageInformation pi)
Set the PageInformation object for this page |
void |
setPostURL(java.lang.String url)
Set the URL that we will POST to when the generated form is submitted. |
void |
setSubTitle(java.lang.String subTitle)
|
void |
setTitle(java.lang.String title)
Set the title for the form. |
void |
setTitleWidth(int w)
Sets the width of the title column. |
void |
setType(java.lang.String type)
Sets the type of this form. |
static PersistentObject |
staticCreateEditObject(javax.servlet.http.HttpSession hs,
javax.servlet.ServletRequest req,
Session ws,
Type type,
java.lang.String attname,
java.lang.String parmname)
|
static PersistentObject |
staticGetEditObject(javax.servlet.http.HttpSession hs,
Session ws,
Type type,
java.lang.String attname)
|
static void |
staticReleaseEditObject(javax.servlet.http.HttpSession hs,
Session ws,
java.lang.String attname)
|
static void |
staticSaveEditObject(javax.servlet.http.HttpSession httpsession,
Session session,
java.lang.String command,
PersistentObject obj,
java.lang.String attname)
|
static void |
staticUpdateEditObject(javax.servlet.http.HttpSession httpsession,
Session session,
java.lang.String command,
PersistentObject obj,
java.lang.String attname)
|
void |
updateEditObject(javax.servlet.http.HttpSession httpsession,
Session session,
java.lang.String command,
PersistentObject obj)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String REQD_FIELD
protected static final Trace trace
protected static Catalog _mc
public static final java.lang.String DEFAULT_OBJECT_ATTRIBUTE
This will be initialized by the form object when it is used for the first time. Once set, all edits will be performed on this object, and the _nameParameter is ignored.
The default is usually ok, you might want to override it in the subclass just in case you need to two edits going on at the same time.
Constructor Detail |
public EditForm()
Method Detail |
public java.lang.String getType()
public java.lang.String getTitle()
public java.lang.String getPostURL()
public java.lang.String getCancelURL()
public java.util.ArrayList getItems()
public java.lang.String getImageDir()
public void setImageDir(java.lang.String dir)
public java.lang.String getObjectAttribute()
public java.lang.String getNameParameter()
public java.lang.String getError()
public java.lang.String getMessage()
public java.lang.String getSubTitle()
public java.lang.String getFocussedFieldName()
public void setFocussedFieldName(java.lang.String name)
public void setActiveControl(java.lang.String what)
public java.lang.String getActiveControl()
public int getButtonCount()
public java.lang.String getButtonName(int b)
public java.lang.String getButtonValue(int b)
public java.lang.String getButtonCommand(int b)
public java.lang.String getButtonHtml(int b, Session session)
public java.lang.String getButtonHtml(int b, int tabindex, Session session)
b
- - the index of the button in the form's _buttons
array.tabindex
- - the tabindex
value of the button.
public java.lang.String getItemHelpHTML(EditForm.Item i, javax.servlet.http.HttpServletRequest req) throws java.io.IOException, WavesetException
java.io.IOException
WavesetException
public java.lang.String getItemHelpHTML(java.lang.String title, javax.servlet.http.HttpServletRequest req, Session session) throws java.io.IOException, WavesetException
java.io.IOException
WavesetException
public java.lang.String getItemHelpPreHTML(java.lang.String itemName, javax.servlet.http.HttpServletRequest req, Session session) throws java.io.IOException, WavesetException
java.io.IOException
WavesetException
public java.lang.String resolveHelpRef(EditForm.HelpRef h, javax.servlet.http.HttpServletRequest req) throws java.io.IOException, WavesetException
java.io.IOException
WavesetException
public PageInformation getPageInformation()
public void setType(java.lang.String type)
Kludge, normally you would subclass EditForm and provide your own generate() method, but we'll wire in a few test forms here.
public void setPostURL(java.lang.String url)
public void setCancelURL(java.lang.String url)
public void setTitle(java.lang.String title)
public void setItems(java.util.ArrayList items)
public void setButtons(java.util.ArrayList buttons)
public void setButtons(EditForm.Button[] buttons)
Normally only called by subclasses.
public int getTitleWidth()
public void setTitleWidth(int w)
Setting this to zero will make the column auto-size.
public int getAdjacentTitleWidth()
public void setAdjacentTitleWidth(int w)
Setting this to zero will make the adjacent title columns auto-size.
public void setObjectAttribute(java.lang.String name)
public void setNameParameter(java.lang.String name)
public void setError(java.lang.String msg)
public void setMessage(java.lang.String msg)
public void setException(java.lang.Throwable th)
public java.lang.Throwable getException()
public void setSubTitle(java.lang.String subTitle)
public void setPageInformation(PageInformation pi)
public abstract void generate(javax.servlet.http.HttpSession httpSession, javax.servlet.http.HttpServletRequest req, Session wavesetSession) throws WavesetException
WavesetException
public abstract java.lang.String process(javax.servlet.http.HttpSession httpSession, javax.servlet.http.HttpServletRequest req, Session wavesetSession) throws WavesetException
The method may return a string, which is treated as a URL fragment for the next page. The calling jsp is expected to obey this.
WavesetException
public PersistentObject createEditObject(javax.servlet.http.HttpSession hs, javax.servlet.ServletRequest req, Session ws, Type type) throws WavesetException
We will first for an object on the session, created by a previous pass through this form. If we don't find one, we'll look for a parameter specifing the name of an object, and store this object in the session. If we don't have an object or a name, we consider it an object creation case and start with an empty object.
WavesetException
public static void setInitialMemberObjectGroups(Session ws, PersistentObject obj, boolean allowMultipleOrgs) throws WavesetException
WavesetException
public static PersistentObject staticCreateEditObject(javax.servlet.http.HttpSession hs, javax.servlet.ServletRequest req, Session ws, Type type, java.lang.String attname, java.lang.String parmname) throws WavesetException
WavesetException
public PersistentObject getEditObject(javax.servlet.http.HttpSession hs, Session ws, Type type) throws WavesetException
The object is expected to exist in the session. Not throwing if it isn't, but that may make sense.
We pass in the waveset session here too, so we can point the object's cache at the session cache. This is almost always what you want, so automatic reference resolution can happen.
WavesetException
public static PersistentObject staticGetEditObject(javax.servlet.http.HttpSession hs, Session ws, Type type, java.lang.String attname) throws WavesetException
WavesetException
public void releaseEditObject(javax.servlet.http.HttpSession hs, Session ws)
Called to process a "cancel" button on a form, might be called for other cleanup too.
public static void staticReleaseEditObject(javax.servlet.http.HttpSession hs, Session ws, java.lang.String attname)
public void updateEditObject(javax.servlet.http.HttpSession httpsession, Session session, java.lang.String command, PersistentObject obj)
public static void staticUpdateEditObject(javax.servlet.http.HttpSession httpsession, Session session, java.lang.String command, PersistentObject obj, java.lang.String attname)
public void saveEditObject(javax.servlet.http.HttpSession httpsession, Session session, java.lang.String command, PersistentObject obj) throws WavesetException
If we see "commit", we'll create or checkin the object and remove it from the session.
If we see cancel, we'll unlock it and remove it from the session.
Anything else is considered to be some other transition event, and we store the new contents of the object.
WavesetException
public static void staticSaveEditObject(javax.servlet.http.HttpSession httpsession, Session session, java.lang.String command, PersistentObject obj, java.lang.String attname) throws WavesetException
WavesetException
public void saveAsOrRenameEditObject(javax.servlet.http.HttpSession httpsession, Session session, java.lang.String command, PersistentObject obj, java.lang.String newname) throws WavesetException
WavesetException
public static java.lang.String genOptions(java.util.ArrayList list, boolean selected)
public java.lang.String getParameter(javax.servlet.ServletRequest r, java.lang.String name)
This is the same as Table.getParameter() and should be moved to some common place.
public ObjectGroup[] getTopmostOrganizations(Session s) throws WavesetException
WavesetException
public java.util.ArrayList getIndentedOrgList(Session s) throws WavesetException
WavesetException
public static java.lang.String[] getPolicies(Session s, java.lang.String type) throws WavesetException
WavesetException
public static java.lang.String[] getAdministrators(Session s, boolean addCurrentAdmin) throws WavesetException
WavesetException
public static java.lang.String[] getPolicies(Session s, java.lang.String type, java.lang.String currentPolicy) throws WavesetException
WavesetException
public static java.lang.String[] getRules(Session s, java.lang.String subtype) throws WavesetException
WavesetException
public static java.lang.String[] getRules(Session s, java.lang.String subtype, java.lang.String currentRule) throws WavesetException
WavesetException
public static java.util.List getOrganizations(Session s) throws WavesetException
WavesetException
public java.lang.String[] getCapabilities(Session s) throws WavesetException
WavesetException
public java.lang.String[] getAdminRoles(Session s) throws WavesetException
WavesetException
public EditForm.ListResult getDefinitionNames(Session s) throws WavesetException
WavesetException
public java.lang.String[] getRoles(Session s) throws WavesetException
WavesetException
public java.lang.String[] getApplications(Session s) throws WavesetException
WavesetException
public java.lang.String[] getResources(Session s) throws WavesetException
WavesetException
public static java.lang.String[] getUserForms(Session s) throws WavesetException
WavesetException
public static java.lang.String[] getResources(Session s, Attribute matchType, java.lang.String value) throws WavesetException
WavesetException
public static java.util.Map getResourcesAndTypes(Session s) throws WavesetException
WavesetException
public static java.util.List getResourceAccountAttributeNames(Resource res) throws WavesetException
WavesetException
public static java.lang.String[] getApproverAdmins(Session s) throws WavesetException
WavesetException
public static java.util.ArrayList getAssignedApprovers(Session s, java.util.List admins)
public static java.util.List generateRefs(Session s, java.lang.String[] names, Type type)
public static java.lang.String[] getRefNames(Session s, java.util.List refs)
public static java.lang.String[] getRefNames(Session s, ObjectRef[] refs)
public java.lang.String getParentId(javax.servlet.ServletRequest req, Session session) throws WavesetException
WavesetException
public java.lang.String getParentIdPath(javax.servlet.ServletRequest req, Session session) throws WavesetException
WavesetException
protected java.util.Hashtable parseMultiPartFormData(javax.servlet.ServletRequest req) throws java.io.IOException, WavesetException
java.io.IOException
WavesetException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |