com.arsdigita.cms.ui
Class CategoryForm

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.FormSection
              extended bycom.arsdigita.bebop.Form
                  extended bycom.arsdigita.cms.ui.CategoryForm
All Implemented Interfaces:
com.arsdigita.bebop.util.BebopConstants, Cloneable, com.arsdigita.bebop.Component, com.arsdigita.bebop.Container, EventListener, com.arsdigita.bebop.event.FormProcessListener, com.arsdigita.bebop.event.FormValidationListener, com.arsdigita.util.Lockable
Direct Known Subclasses:
LinkForm

public abstract class CategoryForm
extends com.arsdigita.bebop.Form
implements com.arsdigita.bebop.event.FormProcessListener, com.arsdigita.bebop.event.FormValidationListener

This is an abstract class which displays the category assignment UI. Displays two listboxes for assigning categories to items, with two submit buttons to move categories back and forth. The left listbox displays all available categories which have not been assigned to the current item. The right listbox displays all categories assigned to the current item.

Version:
$Id: //cms/dev/src/com/arsdigita/cms/ui/CategoryForm.java#22 $
Author:
Stanislav Freidin (sfreidin@arsdigita.com)

Nested Class Summary
protected static class CategoryForm.CategoryMap
          A convenience method that abstracts SequentialMap to deal with categories
 
Field Summary
static String ASSIGN
           
static String ASSIGNED
           
static String FILLER_OPTION
           
static String FREE
           
static String REMOVE
           
static int SELECT_HEIGHT
           
static int SELECT_WIDTH
           
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.Form
GET, POST
 
Fields inherited from class com.arsdigita.bebop.FormSection
m_formModel, m_panel
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.util.BebopConstants
BEBOP_BORDER, BEBOP_BOXPANEL, BEBOP_CELL, BEBOP_CHECKBOX, BEBOP_CHECKBOXGROUP, BEBOP_COLUMNPANEL, BEBOP_DATE, BEBOP_DATETIME, BEBOP_DHTMLEDITOR, BEBOP_FORMERRORS, BEBOP_FORMWIDGET, BEBOP_GRIDPANEL, BEBOP_LIST, BEBOP_MULTISELECT, BEBOP_OPTION, BEBOP_PAD, BEBOP_PADFRAME, BEBOP_PANELROW, BEBOP_PORTAL, BEBOP_PORTLET, BEBOP_RADIO, BEBOP_RADIOGROUP, BEBOP_SEG_BODY, BEBOP_SEG_HEADER, BEBOP_SEG_PANEL, BEBOP_SEGMENT, BEBOP_SELECT, BEBOP_TABLE, BEBOP_TABLEBODY, BEBOP_TABLEROW, BEBOP_TEXTAREA
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
CategoryForm(String name)
          Construct a new CategoryForm component
 
Method Summary
protected  void addAssignButton(com.arsdigita.bebop.Container c)
           
protected  void addRemoveButton(com.arsdigita.bebop.Container c)
           
protected  void addSubmitButtons(com.arsdigita.bebop.Container c)
           
protected abstract  void assignCategory(com.arsdigita.bebop.PageState s, com.arsdigita.categorization.Category cat)
          Assign a category, moving it from the list on the left to the list on the right
 CategoryForm.CategoryMap getAssignedCategories(com.arsdigita.bebop.PageState s)
           
static String getCategoryPath(com.arsdigita.categorization.Category c)
           
protected  com.arsdigita.categorization.Category getExcludedCategory(com.arsdigita.bebop.PageState s)
          Return a category which should be excluded from the list of free categories.
protected abstract  String getItemURL(com.arsdigita.bebop.PageState state)
          This method returns the URL for the givne item to make sure that the item it is not possible to have two objects in the same category with the same URL.
protected abstract  com.arsdigita.kernel.ACSObject getObject(com.arsdigita.bebop.PageState state)
          This allows the validation code to validate the properties of the object
 com.arsdigita.categorization.Category getRootCategory(com.arsdigita.bebop.PageState state)
          Get the category which will act as the root for the lists of assigned and unassigned categories.
protected abstract  void initAssignedCategories(com.arsdigita.bebop.PageState state, CategoryForm.CategoryMap map)
          Populate a CategoryForm.CategoryMap with all categories which are assigned to the item.
 void process(com.arsdigita.bebop.event.FormSectionEvent e)
           
 void setAssignedCaption(String caption)
          Set the caption of the assigned categories label
 void setUnassignedCaption(String caption)
          Set the caption of the unassigned categories label
protected abstract  void unassignCategory(com.arsdigita.bebop.PageState s, com.arsdigita.categorization.Category cat)
          Unassign a category, moving it from the list on the right to the list on the left
 void validate(com.arsdigita.bebop.event.FormSectionEvent e)
           
 
Methods inherited from class com.arsdigita.bebop.Form
addMagicTag, excludeParameterFromExport, generateErrors, generateXML, generateXMLSansState, getAction, getFormData, getName, getProcessInvisible, isRedirecting, process, register, respond, setAction, setEncType, setFormData, setMethod, setName, setOnReset, setOnSubmit, setProcessInvisible, setRedirecting, toString, traverse
 
Methods inherited from class com.arsdigita.bebop.FormSection
add, add, addCancelListener, addInitListener, addProcessListener, addSubmissionListener, addValidationListener, children, contains, createInitListener, createProcessListener, createSubmissionListener, createValidationListener, fireCancel, fireInit, fireProcess, fireSubmitted, fireValidate, forwardInit, forwardProcess, forwardSubmission, forwardValidation, get, getModel, getPanel, indexOf, isEmpty, lock, register, removeCancelListener, removeInitListener, removeProcessListener, removeSubmissionListener, removeValidationListener, size
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

FREE

public static final String FREE
See Also:
Constant Field Values

ASSIGNED

public static final String ASSIGNED
See Also:
Constant Field Values

ASSIGN

public static final String ASSIGN
See Also:
Constant Field Values

REMOVE

public static final String REMOVE
See Also:
Constant Field Values

SELECT_WIDTH

public static final int SELECT_WIDTH
See Also:
Constant Field Values

SELECT_HEIGHT

public static final int SELECT_HEIGHT
See Also:
Constant Field Values

FILLER_OPTION

public static final String FILLER_OPTION
Constructor Detail

CategoryForm

public CategoryForm(String name)
Construct a new CategoryForm component

Parameters:
name - the name of the form
Method Detail

addSubmitButtons

protected void addSubmitButtons(com.arsdigita.bebop.Container c)

addAssignButton

protected void addAssignButton(com.arsdigita.bebop.Container c)

addRemoveButton

protected void addRemoveButton(com.arsdigita.bebop.Container c)

setUnassignedCaption

public void setUnassignedCaption(String caption)
Set the caption of the unassigned categories label

Parameters:
caption - the new caption

setAssignedCaption

public void setAssignedCaption(String caption)
Set the caption of the assigned categories label

Parameters:
caption - the new caption

getAssignedCategories

public CategoryForm.CategoryMap getAssignedCategories(com.arsdigita.bebop.PageState s)
Parameters:
s - the page state
Returns:
a CategoryForm.CategoryMap of all assigned categories

initAssignedCategories

protected abstract void initAssignedCategories(com.arsdigita.bebop.PageState state,
                                               CategoryForm.CategoryMap map)
Populate a CategoryForm.CategoryMap with all categories which are assigned to the item. Child classes should override this method to do the right thing.

Parameters:
map - The sequential map of all categories which are assigned to the current item. Overridden method should repeatedly call map.addCategory(someCategory);
state - The page state

assignCategory

protected abstract void assignCategory(com.arsdigita.bebop.PageState s,
                                       com.arsdigita.categorization.Category cat)
Assign a category, moving it from the list on the left to the list on the right

Parameters:
s - the page state
cat - the category to assign

unassignCategory

protected abstract void unassignCategory(com.arsdigita.bebop.PageState s,
                                         com.arsdigita.categorization.Category cat)
Unassign a category, moving it from the list on the right to the list on the left

Parameters:
s - the page state
cat - the category to unassign

getItemURL

protected abstract String getItemURL(com.arsdigita.bebop.PageState state)
This method returns the URL for the givne item to make sure that the item it is not possible to have two objects in the same category with the same URL.

Parameters:
state - The Page State

getObject

protected abstract com.arsdigita.kernel.ACSObject getObject(com.arsdigita.bebop.PageState state)
This allows the validation code to validate the properties of the object


getRootCategory

public com.arsdigita.categorization.Category getRootCategory(com.arsdigita.bebop.PageState state)
Get the category which will act as the root for the lists of assigned and unassigned categories. The default implementation returns the root category for the content section. Child classes should override this method if they wish to provide an alternate root category.

Parameters:
state - the page state
Returns:
the root category which should be used to populate the lists of assigned and unassigned categories

getExcludedCategory

protected com.arsdigita.categorization.Category getExcludedCategory(com.arsdigita.bebop.PageState s)
Return a category which should be excluded from the list of free categories. It is permissible to return null

Parameters:
s - the page state
Returns:
a category whose subtree will not be shown in the category list

process

public void process(com.arsdigita.bebop.event.FormSectionEvent e)
             throws com.arsdigita.bebop.FormProcessException
Specified by:
process in interface com.arsdigita.bebop.event.FormProcessListener
Throws:
com.arsdigita.bebop.FormProcessException

validate

public void validate(com.arsdigita.bebop.event.FormSectionEvent e)
              throws com.arsdigita.bebop.FormProcessException
Specified by:
validate in interface com.arsdigita.bebop.event.FormValidationListener
Throws:
com.arsdigita.bebop.FormProcessException

getCategoryPath

public static String getCategoryPath(com.arsdigita.categorization.Category c)
Returns:
the full path to a category


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC