Added documentation

git-svn-id: https://svn.libreccm.org/ccm/trunk@2404 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-10-30 08:46:48 +00:00
parent a33d058a3d
commit 2fde32df93
3 changed files with 58 additions and 3 deletions

View File

@ -249,7 +249,8 @@ public interface Component extends Lockable {
* malfunction and produce errors like "Widget ... isn't * malfunction and produce errors like "Widget ... isn't
* associated with any Form" * associated with any Form"
* *
* @pre p != null */ * @pre p != null
*/
void register(Page p); void register(Page p);
/** /**
@ -260,7 +261,8 @@ public interface Component extends Lockable {
* components can implement it as a no-op. * components can implement it as a no-op.
* *
* @pre f != null * @pre f != null
* @pre m != null */ * @pre m != null
*/
void register(Form f, FormModel m); void register(Form f, FormModel m);
/* Properties that will get copied straight to the output, /* Properties that will get copied straight to the output,

View File

@ -26,7 +26,7 @@ import java.util.Iterator;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* A modal container is a container that manages visibility for a set of * ModalContainer is a container that manages visibility for a set of
* components. It allows only one of its children to be visible. One of its * components. It allows only one of its children to be visible. One of its
* children can be selected as the default visible component. If none is * children can be selected as the default visible component. If none is
* selected the child with index equal to zero is used. The modal container * selected the child with index equal to zero is used. The modal container
@ -53,6 +53,19 @@ public class ModalContainer extends SimpleContainer implements Resettable {
super(tagName, xmlns); super(tagName, xmlns);
} }
/**
* Registers state parameters for the page with its model.
*
* Used here to set the visibility of the component.
*
* The super class' method is empty, so the rule "Always call
* <code>super.register</code> when you override <code>register</code>
* doessn't apply here.
*
* @pre p != null
* @param p
*/
@Override
public void register(Page p) { public void register(Page p) {
Assert.isUnlocked(this); Assert.isUnlocked(this);

View File

@ -68,10 +68,50 @@ public class SimpleComponent extends Completable
return result; return result;
} }
/**
* Registers state parameters for the page with its model. Documentation
* from Interface Componment:
*
* A simple component with a state parameter <code>param</code> would do
* the following in the body of this method:
* <pre>
* p.addComponent(this);
* p.addComponentStateParam(this, param);
* </pre>
*
* You should override this method to set the default visibility
* of your component:
*
* <pre>
* public void register(Page p) {
* super.register(p);
* p.setVisibleDefault(childNotInitiallyShown,false);
* p.setVisibleDefault(anotherChild, false);
* }
* </pre>
*
* Always call <code>super.register</code> when you override
* <code>register</code>. Otherwise your component may
* malfunction and produce errors like "Widget ... isn't
* associated with any Form"
*
* @pre p != null
* @param p
*/
public void register(Page p) { public void register(Page p) {
return; return;
} }
/**
* Registers form parameters with the form model for this form.
* This method is only important for {@link FormSection form sections}
* and {@link com.arsdigita.bebop.form.Widget widgets} (components that
* have a connection to an HTML form). Other components can implement it
* as a no-op.
*
* @pre f != null
* @pre m != null
*/
public void register(Form f, FormModel m) { public void register(Form f, FormModel m) {
return; return;
} }