com.arsdigita.formbuilder.ui
Class ControlEditor

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.TextStylable
              extended bycom.arsdigita.bebop.BlockStylable
                  extended bycom.arsdigita.bebop.SimpleContainer
                      extended bycom.arsdigita.formbuilder.ui.ControlEditor
All Implemented Interfaces:
Cloneable, Component, Container, Lockable

public class ControlEditor
extends SimpleContainer

This class provides a basic UI component for editing the controls on a persistent form. It is designed to be dropped into any page without requiring any significant additional infrasructure


Field Summary
 
Fields inherited from class com.arsdigita.bebop.SimpleContainer
versionId
 
Fields inherited from class com.arsdigita.bebop.BlockStylable
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
ControlEditor(String app, SingleSelectionModel form)
          Constructor.
ControlEditor(String app, SingleSelectionModel form, boolean wantFormSection)
          Constructor.
 
Method Summary
protected  void addEditableComponent(Container container, Component child)
           
protected  boolean addItemEditObserver(PageState state)
          Allows subclasses to control when to add the edit/move/delete links
protected  SingleSelectionModel getFormModel()
           
protected  PersistentComponentFactory getFormSection(PageState state, BigDecimal sectionID)
           
 void register(Page page)
          Registers state parameters for the page with its model.
 void respond(PageState state)
          Responds to the request.
 void setFormSectionModelBuilder(PrintListener l)
          Sets the form section model builder for populating the drop down list of form sections.
 
Methods inherited from class com.arsdigita.bebop.SimpleContainer
add, add, children, contains, generateChildrenXML, generateParent, generateXML, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size
 
Methods inherited from class com.arsdigita.bebop.BlockStylable
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment
 
Methods inherited from class com.arsdigita.bebop.TextStylable
setBackgroundColor, setColor
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, lock, register, 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, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked, lock
 

Constructor Detail

ControlEditor

public ControlEditor(String app,
                     SingleSelectionModel form)
Constructor. Creates a new control editor widget, for editing the form specified in the single selection model. The key returned by the single selection model should be an instance of the BigDecimal class.

Parameters:
app - the application type
form - the form to edit

ControlEditor

public ControlEditor(String app,
                     SingleSelectionModel form,
                     boolean wantFormSection)
Constructor. Creates a new control editor widget, for editing the form specified in the single selection model. The key returned by the single selection model should be an instance of the BigDecimal class. This constructor also allows the programmer to turn on the use of form sections, although they must also call the setFormSectionModelBuilder method to populate the list box.

Parameters:
app - the application type
form - the form to edit
Method Detail

addEditableComponent

protected void addEditableComponent(Container container,
                                    Component child)

getFormSection

protected PersistentComponentFactory getFormSection(PageState state,
                                                    BigDecimal sectionID)

setFormSectionModelBuilder

public void setFormSectionModelBuilder(PrintListener l)
Sets the form section model builder for populating the drop down list of form sections. The model builder is actually a PrintListener, which should add new Options to the select box

Parameters:
l - the print listener for populating the list

respond

public void respond(PageState state)
             throws javax.servlet.ServletException
Description copied from interface: Component

Responds to the request. This method is only called if the request was made from a link or form that the component put on the page in the PageState.stateAsURL() previous request.

No output should be generated on the HTTP response. The component can store intermediate results in the state by calling setAttribute.

This method is called before any output is printed to the HTTP response so that the component can forward to a different page and thereby commit the response.

Specified by:
respond in interface Component
Overrides:
respond in class SimpleComponent
Parameters:
state - the current page state
Throws:
javax.servlet.ServletException

getFormModel

protected SingleSelectionModel getFormModel()

register

public void register(Page page)
Description copied from interface: Component
Registers state parameters for the page with its model. A simple component with a state parameter param would do the following in the body of this method:
   p.addComponent(this);
   p.addComponentStateParam(this, param);
 
You should override this method to set the default visibility of your component:
 public void register(Page p) {
     super.register(p);
     p.setVisibleDefault(childNotInitiallyShown,false);
     p.setVisibleDefault(anotherChild, false);
 }
 
Always call super.register when you override register. Otherwise your component may malfunction and produce errors like "Widget ... isn't associated with any Form"

Specified by:
register in interface Component
Overrides:
register in class SimpleComponent

addItemEditObserver

protected boolean addItemEditObserver(PageState state)
Allows subclasses to control when to add the edit/move/delete links



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