CCM NG: Fixed several JavaDoc warnings.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4601 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
jensp 2017-02-25 17:06:13 +00:00
parent b8dfb27d3c
commit ab9f8323f4
15 changed files with 327 additions and 305 deletions

View File

@ -26,7 +26,6 @@ import com.arsdigita.bebop.event.EventListenerList;
import com.arsdigita.util.Assert;
import com.arsdigita.util.Lockable;
import java.util.stream.Stream;
/**
* A standard implementation of <code>SingleSelectionModel</code> and
@ -35,7 +34,7 @@ import java.util.stream.Stream;
*
* jensp: Added generics and Java 8 streams instead of using an iterator.
*
* @param <T>
* @param <T> The type managed by the parameter model.
*
* @author Unknown
* @author Jens Pelzetter (jensp)

View File

@ -30,8 +30,9 @@ import java.util.TooManyListenersException;
* The parent of all Bebop Link classes, this class represents a URL on a page.
* It may contain a label, an image, or any other component.
*
* <p> The following table lists all Bebop Link classes and suggests
* when they might be used.
* <p>
* The following table lists all Bebop Link classes and suggests when they might
* be used.
* <p>
* <table BORDER=3>
* <tr>
@ -40,23 +41,23 @@ import java.util.TooManyListenersException;
* </tr>
* <tr>
* <td>{@link BaseLink}</td>
* <td>Parent class of Bebop Link classes. Extend this class to
* build your own Link class.</td>
* <td>Parent class of Bebop Link classes. Extend this class to build your own
* Link class.</td>
* </tr>
* <tr>
* <td>{@link Link}</td>
* <td>Link class that manages its own URL variables. Session information
* is added to the target URL for this type.</td>
* <td>Link class that manages its own URL variables. Session information is
* added to the target URL for this type.</td>
* </tr>
* <tr>
* <td>{@link ExternalLink}</td>
* <td>Link that does not encode the URL with any session information.
* Used for a link to a page outside the site.</td>
* <td>Link that does not encode the URL with any session information. Used for
* a link to a page outside the site.</td>
* </tr>
* <tr>
* <td>{@link ControlLink}</td>
* <td> Used for references within its own page (often
* as fields in a table header for sorting a column).</td>
* <td> Used for references within its own page (often as fields in a table
* header for sorting a column).</td>
* </tr>
* <tr>
* <td>{@link ActionLink}</td>
@ -66,8 +67,8 @@ import java.util.TooManyListenersException;
* </tr>
* <tr>
* <td>{@link ToggleLink}</td>
* <td>A link that turns into label when it is selected and
* turns back into a link when it is unselected.</td>
* <td>A link that turns into label when it is selected and turns back into a
* link when it is unselected.</td>
* </tr>
* </table>
*
@ -76,24 +77,29 @@ import java.util.TooManyListenersException;
public abstract class BaseLink extends DescriptiveComponent
implements Cloneable {
/** The name of the attribute used in XML to indicate which type of link
* this link represents. */
/**
* The name of the attribute used in XML to indicate which type of link this
* link represents.
*/
private final static String TYPE_ATTR = "type";
private final static String HREF_NO_JAVASCRIPT = "href_no_javascript";
private final static String HREF = "href";
/** Component used to display the link. Typically a Label, may be
* e.g. an image as well. */
/**
* Component used to display the link. Typically a Label, may be e.g. an
* image as well.
*/
protected Component m_child;
/** Property to store the url the Link points to. */
/**
* Property to store the url the Link points to.
*/
protected String m_url;
// Use the parent class' property!
// /** Property to store informational text for the user about the Link, e.g.
// * how to use it, or when to use it (or not to use it). */
// private GlobalizedMessage m_hint;
protected String m_noJavascriptURL = null;
private PrintListener m_printListener;
@ -102,13 +108,14 @@ public abstract class BaseLink extends DescriptiveComponent
private GlobalizedMessage m_confirmMsg;
/**
* Constructor creates a link taking url as the target and display it to
* the user at the same time. It is the only allowed way to present the
* user with a not globlized information. The implementation currently
* miss-uses the Label component to display just a not globalized String
* which is deprecated.
* Constructor creates a link taking url as the target and display it to the
* user at the same time. It is the only allowed way to present the user
* with a not globlized information. The implementation currently miss-uses
* the Label component to display just a not globalized String which is
* deprecated.
*
* @param url
*
* @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead
*/
@ -141,7 +148,8 @@ public abstract class BaseLink extends DescriptiveComponent
addPrintListener(listener);
} catch (TooManyListenersException e) {
// Can't happen
throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e);
throw new UncheckedWrapperException("Too many listeners: " + e
.getMessage(), e);
}
}
@ -155,12 +163,12 @@ public abstract class BaseLink extends DescriptiveComponent
}
// DEPRECATED constructors
/**
* Constructor.
*
* @param label as text
* @param url
*
* @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead
*/
@ -174,19 +182,21 @@ public abstract class BaseLink extends DescriptiveComponent
* @param label as text
* @param listener PrintListener, may be used to change either the Display
* text or the url within a locked page.
* @deprecated use BaseLink(Component,listener) instead with a Label using
* a GlobalizedMessage instead
*
* @deprecated use BaseLink(Component,listener) instead with a Label using a
* GlobalizedMessage instead
*/
public BaseLink(final String label, final PrintListener listener) {
this(new Label(label), listener);
}
// Class Methods
/**
* Clone.
* @return
* @throws CloneNotSupportedException
*
* @return The clone of the object.
*
* @throws CloneNotSupportedException If cloning is not supported.
*/
@Override
public Object clone() throws CloneNotSupportedException {
@ -196,12 +206,12 @@ public abstract class BaseLink extends DescriptiveComponent
}
/**
* Adds a print listener.
* Since the <code>PrintListener</code> is expected to modify the target
* of the <code>PrintEvent</code>, only one print listener can be set
* for a link.
* Adds a print listener. Since the <code>PrintListener</code> is expected
* to modify the target of the <code>PrintEvent</code>, only one print
* listener can be set for a link.
*
* @param listener The print listener. Must not <code>null</code>.
*
* @throws IllegalArgumentException if <code>listener</code> is null.
* @throws TooManyListenersException if a print listener has previously been
* added.
@ -209,10 +219,12 @@ public abstract class BaseLink extends DescriptiveComponent
public void addPrintListener(final PrintListener listener)
throws IllegalStateException, TooManyListenersException {
if (listener == null) {
throw new IllegalArgumentException("Argument listener can not be null");
throw new IllegalArgumentException(
"Argument listener can not be null");
}
if (m_printListener != null) {
throw new TooManyListenersException("Too many listeners. Can only have one");
throw new TooManyListenersException(
"Too many listeners. Can only have one");
}
m_printListener = listener;
}
@ -224,10 +236,12 @@ public abstract class BaseLink extends DescriptiveComponent
* will be thrown.
*
* @param listener The listener that was previously added with
* <code>addPrintListener</code>.
* Must not be <code>null</code>.
* <code>addPrintListener</code>. Must not be
* <code>null</code>.
*
* @throws IllegalArgumentException if <code>listener</code> is not the
* currently registered print listener or is <code>null</code>.
* currently registered print listener or
* is <code>null</code>.
*/
public void removePrintListener(final PrintListener listener)
throws IllegalArgumentException {
@ -235,15 +249,18 @@ public abstract class BaseLink extends DescriptiveComponent
throw new IllegalArgumentException("listener can not be null");
}
if (listener != m_printListener) {
throw new IllegalArgumentException("listener is not registered with this widget");
throw new IllegalArgumentException(
"listener is not registered with this widget");
}
m_printListener = null;
}
/**
* Execute the {@link PrintListener} assigned to the link.
*
* @param state
* @return
* @param state The current page state
*
* @return The base link after all {@link PrintListener} have been executed.
*/
protected BaseLink firePrintEvent(final PageState state) {
BaseLink l = this;
@ -260,8 +277,8 @@ public abstract class BaseLink extends DescriptiveComponent
}
/**
* Retrieves the label component used to display the Link. Typically a Label,
* but may be an other type, e.g. an Image, as well.
* Retrieves the label component used to display the Link. Typically a
* Label, but may be an other type, e.g. an Image, as well.
*
* @return Component used to display the Link.
*/
@ -276,23 +293,25 @@ public abstract class BaseLink extends DescriptiveComponent
/**
* Use a GlobalizedMessage to be used to display the link. It's primary
* purpose is to hide the parent class' method to prevent its usage because
* purpose is to hide the parent class method to prevent its usage because
* Labels and GlobalizedMessages are used here differently (a
* GlobalizedMessage is here not directly used as a Label by specifying it
* as an attribugte, inside a Label component).
* @param message
* as an attribute, inside a Label component).
*
* @param message The text to show.
*/
@Override
public void setLabel(final GlobalizedMessage message) {
Assert.isUnlocked(this);
Label label = new Label(message);
setChild( (Component)label);
setChild((Component) label);
}
/**
* Get the target of the link.
*
* @return
* @return The target URL of the link.
*/
public final String getTarget() {
return m_url;
@ -315,27 +334,29 @@ public abstract class BaseLink extends DescriptiveComponent
}
/**
* Generate the URL for the link.
*
* @param state
* @param parent
* @param state The current {@link PageState}.
* @param parent The parent element of the link.
*/
protected abstract void generateURL(final PageState state, final Element parent);
protected abstract void generateURL(final PageState state,
final Element parent);
/**
* <p>Generates a DOM fragment:
* <p><pre>
* &lt;bebop:link href="..." type="..." %bebopAttr;/>
* Generates a DOM fragment:
*
* <pre>
* &lt;bebop:link href="..." type="..." %bebopAttr;/&gt;
* </pre>
* The <code>href</code> attribute contains the target the link should point
* to. The <code>type</code> attribute is used to give more fine grained
* control over which kind of link this element represents. The types are
* <code>link</code> for a <code>Link</code>, <code>control</code> for a
* {@link ControlLink}, and <code>toggle</code> for a {@link ToggleLink}.
* There may be additional attributes depending on what type of link this
* link represents.
*
* The {@code href} attribute contains the target the link should point to.
* The {@code type} attribute is used to give more fine grained control over
* which kind of link this element represents. The types are {@code link}
* for a {@code Link}, {@code control} for a {@link ControlLink}. There may
* be additional attributes depending on what type of link this link
* represents.
*
* @see ControlLink#generateXML
* @see ToggleLink#generateXML
*
* @param state The current {@link PageState}.
* @param parent The XML element to attach the XML to.
@ -362,6 +383,7 @@ public abstract class BaseLink extends DescriptiveComponent
*
* @param state
* @param sUrl
*
* @return
*/
private String getAbsoluteUrl(final PageState state, final String sUrl) {
@ -400,11 +422,13 @@ public abstract class BaseLink extends DescriptiveComponent
* @param state The current {@link PageState}.
* @param link The link element.
*/
protected void setupNoJavascriptURL(final PageState state, final Element link) {
protected void setupNoJavascriptURL(final PageState state,
final Element link) {
String sURL = null;
if (m_sConfirmMsg.length() > 0
|| (m_confirmMsg != null && m_confirmMsg.localize().toString().length() > 0)) {
|| (m_confirmMsg != null && m_confirmMsg.localize().toString()
.length() > 0)) {
//if we want the confirm link, create the link
String sOkUrl = getAbsoluteUrl(state, link.getAttribute(HREF));
@ -416,9 +440,11 @@ public abstract class BaseLink extends DescriptiveComponent
}
if (m_sConfirmMsg.length() > 0) {
sURL = ConfirmPage.getConfirmUrl(m_sConfirmMsg, sOkUrl, sCancelUrl);
sURL = ConfirmPage.getConfirmUrl(m_sConfirmMsg, sOkUrl,
sCancelUrl);
} else if (m_confirmMsg != null) {
sURL = ConfirmPage.getConfirmUrl(m_confirmMsg.localize().toString(), sOkUrl, sCancelUrl);
sURL = ConfirmPage.getConfirmUrl(m_confirmMsg.localize()
.toString(), sOkUrl, sCancelUrl);
}
} else {
@ -435,15 +461,16 @@ public abstract class BaseLink extends DescriptiveComponent
}
/**
* Adds type-specific XML attributes to the XML element representing
* this link. Subclasses should override this method if they introduce
* more attributes than the ones {@link #generateXML generateXML}
* produces by default.
* Adds type-specific XML attributes to the XML element representing this
* link. Subclasses should override this method if they introduce more
* attributes than the ones {@link #generateXML generateXML} produces by
* default.
*
* @param state The current request
* @param link The XML element representing this link
*/
protected void generateExtraXMLAttributes(final PageState state, final Element link) {
protected void generateExtraXMLAttributes(final PageState state,
final Element link) {
}
/**
@ -451,8 +478,8 @@ public abstract class BaseLink extends DescriptiveComponent
* protection for this link</em>. Not for confirmation messages; Should call
* setConfirmation for that.
*
* @param value The confirmation link. To not use the value {@code return confirm(} with this
* method.
* @param value The confirmation link. To not use the value
* {@code return confirm(} with this method.
*
* @see #setConfirmation
*/
@ -470,17 +497,17 @@ public abstract class BaseLink extends DescriptiveComponent
/**
* Forces the user to click through a confirmation dialog before this link
* is followed. The user is prompted with the specified message. If the
* user does not does not confirm, the link is not followed. The current
* is followed. The user is prompted with the specified message. If the user
* does not does not confirm, the link is not followed. The current
* implementation uses the JavaScript confirm function and the onClick
* attribute.
* If JavaScript is not enabled in the client browser, this method will
* redirect the browser to a Bebop confirmation page rather than use
* a JavaScript confirmation.
* Subsequent calls to setOnClick will undo the effect of this method.
* attribute. If JavaScript is not enabled in the client browser, this
* method will redirect the browser to a Bebop confirmation page rather than
* use a JavaScript confirmation. Subsequent calls to setOnClick will undo
* the effect of this method.
*
* @param message the confirmation message presented to the user. This
* message cannot have an apostrophe or back slash.
*
* @deprecated Use setConfirmation(final GlobalizedMessage msg) instead
*/
public void setConfirmation(final String message) {
@ -488,7 +515,8 @@ public abstract class BaseLink extends DescriptiveComponent
//or back slashes
if (Assert.isEnabled()) {
final boolean isGoodMessage = message.indexOf("'") == -1 && message.indexOf("\\") == -1;
final boolean isGoodMessage = message.indexOf("'") == -1 && message
.indexOf("\\") == -1;
Assert.isTrue(isGoodMessage,
"confirmation message cannot contain apostrophe or back slash");
}
@ -498,7 +526,8 @@ public abstract class BaseLink extends DescriptiveComponent
/**
* Set a GlobalizedMessage as confirmation message
* @param msg
*
* @param msg The text to show for confirming.
*/
public void setConfirmation(final GlobalizedMessage msg) {
m_confirmMsg = msg;
@ -510,7 +539,8 @@ public abstract class BaseLink extends DescriptiveComponent
* @param state PageState
* @param link Parent element
*/
private void exportConfirmAttributes(final PageState state, final Element link) {
private void exportConfirmAttributes(final PageState state,
final Element link) {
// If a confirmation message is set
if (m_sConfirmMsg.length() > 0 || m_confirmMsg != null) {
@ -522,13 +552,15 @@ public abstract class BaseLink extends DescriptiveComponent
if (m_sConfirmMsg.length() > 0) {
// then set the onclick attribute for the link with the static message
link.addAttribute(ON_CLICK, "return confirm(\\'" + m_sConfirmMsg + "\\');");
link.addAttribute(ON_CLICK, "return confirm(\\'" + m_sConfirmMsg
+ "\\');");
// else if m_configMsg is set
} else if (m_confirmMsg != null) {
//then set the onclick attribute for the link with a globalized message
link.addAttribute(ON_CLICK, "return confirm(\\'" + m_confirmMsg.localize() + "\\');");
link.addAttribute(ON_CLICK, "return confirm(\\'" + m_confirmMsg
.localize() + "\\');");
}
}
@ -542,4 +574,5 @@ public abstract class BaseLink extends DescriptiveComponent
public final String getNoJavascriptTarget() {
return m_noJavascriptURL;
}
}

View File

@ -34,16 +34,18 @@ import com.arsdigita.xml.Element;
* com.arsdigita.bebop.table.TableCellRenderer}, where the list or table has
* already set up the events 'tight' for the control link to do the right thing.
*
* <p> <b>Warning:</b> Even though a control link lets you add action
* listeners, they are not run unless you override {@link #setControlEvent
* <p>
* <b>Warning:</b> Even though a control link lets you add action listeners,
* they are not run unless you override {@link #setControlEvent
* setControlEvent}. If you need this behavior, you should use an {@link
* ActionLink}. A control link is hardly ever useful unless it is contained
* in an event-generating component like {@link List} or {@link Table}.
* ActionLink}. A control link is hardly ever useful unless it is contained in
* an event-generating component like {@link List} or {@link Table}.
*
* <p> <b>Example:</b> A control link is mainly useful to send events to other
* <p>
* <b>Example:</b> A control link is mainly useful to send events to other
* components. For example, the following control link will cause a control
* event <tt>delete</tt> with associated value <tt>42</tt> to be sent to
* the component <tt>fooComponent</tt> when the user clicks on it:
* event <tt>delete</tt> with associated value <tt>42</tt> to be sent to the
* component <tt>fooComponent</tt> when the user clicks on it:
*
* <pre>
* ControlLink l = new ControlLink("click here") {
@ -53,13 +55,14 @@ import com.arsdigita.xml.Element;
* };
* </pre>
*
* <p> This requires that <tt>fooComponent</tt> is part of the page
* hierarchy. The control link <tt>l</tt> does not have to be part of the
* page hierarchy, and may be generated on the fly. (See
* {@link PageState} for details on control events.)
* <p>
* This requires that <tt>fooComponent</tt> is part of the page hierarchy. The
* control link <tt>l</tt> does not have to be part of the page hierarchy, and
* may be generated on the fly. (See {@link PageState} for details on control
* events.)
*
* <p>See {@link BaseLink} for a description
* of all Bebop Link classes.
* <p>
* See {@link BaseLink} for a description of all Bebop Link classes.
*
* @author Stanislav Freidin
* @author David Lutterkort
@ -73,14 +76,14 @@ public class ControlLink extends BaseLink {
protected final String TYPE_CONTROL = "control";
/**
* A list of all action listeners. The list is instantiated lazily, and
* will therefore be null in most applications.
* A list of all action listeners. The list is instantiated lazily, and will
* therefore be null in most applications.
*/
private ArrayList m_actionListeners;
/**
* Constructs a new ControlLink. The link will encapsulates
* the child component (which should be a label or an image).
* Constructs a new ControlLink. The link will encapsulates the child
* component (which should be a label or an image).
*
* @param child the component that will be turned into a link
*/
@ -99,41 +102,43 @@ public class ControlLink extends BaseLink {
}
/**
* Adds an <code>ActionListener</code>, which will be run when {@link
* #respond respond} is called.
* @param 1 a listener to add
* Adds an <code>ActionListener</code>, which will be run when
* {@link#respond respond} is called.
*
* @param listener The listener to add.
*
* @pre l != null
* @pre ! isLocked()
* @see #respond respond
*/
public void addActionListener(ActionListener l) {
public void addActionListener(ActionListener listener) {
Assert.isUnlocked(this);
if ( m_actionListeners == null ) {
if (m_actionListeners == null) {
m_actionListeners = new ArrayList();
}
m_actionListeners.add(l);
m_actionListeners.add(listener);
}
/**
* Removes a previously added <code>ActionListener</code>.
* @param 1 the listener to remove
*
* @param listener The listener to remove.
*
* @see #addActionListener addActionListener
*/
public void removeActionListener(ActionListener l) {
public void removeActionListener(ActionListener listener) {
Assert.isUnlocked(this);
if ( m_actionListeners == null ) {
if (m_actionListeners == null) {
return;
}
m_actionListeners.remove(l);
m_actionListeners.remove(listener);
}
/**
* Fires an <code>ActionEvent</code>, which causes all registered
* <code>ActionListener</code>s to be run. The source of the event
* is the <code>TabbedPane</code>.
* <code>ActionListener</code>s to be run. The source of the event is the
* <code>TabbedPane</code>.
*
* @param state the current page state
* @pre state != null
*
* @see #respond respond
*/
protected void fireActionEvent(PageState state) {
@ -141,8 +146,8 @@ public class ControlLink extends BaseLink {
if (m_actionListeners == null) {
return;
}
for (int i=0; i < m_actionListeners.size(); i++ ) {
if ( e == null ) {
for (int i = 0; i < m_actionListeners.size(); i++) {
if (e == null) {
e = new ActionEvent(this, state);
}
((ActionListener) m_actionListeners.get(i)).actionPerformed(e);
@ -151,6 +156,7 @@ public class ControlLink extends BaseLink {
/**
* Responds to the incoming request. Fires the <code>ActionEvent</code>.
*
* @param state the current page state
*/
@Override
@ -159,8 +165,8 @@ public class ControlLink extends BaseLink {
}
/**
* Generates the URL for a link and sets it as the "href" attribute
* of the parent.
* Generates the URL for a link and sets it as the "href" attribute of the
* parent.
*
* @param state the current page state
* @param parent the parent element

View File

@ -89,7 +89,7 @@ abstract public class DescriptiveComponent extends SimpleComponent {
* Generates a (J)DOM fragment for clients to include into their generated
* XML.
*
* @param state
* @param state The current page state.
* @param parent the XML Element instance to add the attributes managed by
* by this class
*/

View File

@ -44,9 +44,9 @@ public class SimpleComponent extends Completable
/**
* The Attribute object is protected to make it easier for the Form Builder
* service to persist the SimpleComponent.
* Locking violation is not a problem since if the SimpleComponent is locked
* then the Attribute object will also be locked.
* service to persist the SimpleComponent. Locking violation is not a
* problem since if the SimpleComponent is locked then the Attribute object
* will also be locked.
*/
protected Attributes m_attr;
@ -55,14 +55,15 @@ public class SimpleComponent extends Completable
/**
* Clones a component. The clone is not locked and has its own set of
* attributes.
*
* @return the clone of a component.
* @throws java.lang.CloneNotSupportedException
* @post ! ((SimpleComponent) return).isLocked()
*
* @throws java.lang.CloneNotSupportedException If cloning is not supported.
*/
@Override
public Object clone() throws CloneNotSupportedException {
SimpleComponent result = (SimpleComponent) super.clone();
if ( m_attr != null ) {
if (m_attr != null) {
result.m_attr = (Attributes) m_attr.clone();
}
result.m_locked = false;
@ -73,15 +74,15 @@ public class SimpleComponent extends Completable
* 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:
* 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:
* You should override this method to set the default visibility of your
* component:
*
* <pre>
* public void register(Page p) {
@ -92,11 +93,9 @@ public class SimpleComponent extends Completable
* </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"
* <code>register</code>. Otherwise your component may malfunction and
* produce errors like "Widget ... isn't associated with any Form"
*
* @pre p != null
* @param p
*/
@Override
@ -105,16 +104,15 @@ public class SimpleComponent extends Completable
}
/**
* 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.
* 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.
*
* @param f The form the register.
* @param m The form model to use with the form.
*
* @param f
* @param m
* @pre f != null
* @pre m != null
*/
@Override
public void register(Form f, FormModel m) {
@ -122,24 +120,29 @@ public class SimpleComponent extends Completable
}
/**
* Does processing that is special to the component
* receiving the click.
* Does processing that is special to the component receiving the click.
*
* @param state the current page state
* @throws javax.servlet.ServletException
* @param state The current page state
*
* @throws javax.servlet.ServletException If an error occurs.
*/
@Override
public void respond(PageState state)
throws javax.servlet.ServletException { }
throws javax.servlet.ServletException {
}
@Override
public Iterator children() {
return Collections.EMPTY_LIST.iterator();
}
/** Adds [J]DOM nodes for this component. Specifically for
* base class SimpleComponent, does nothing.
* @param p
/**
* Adds [J]DOM nodes for this component. Specifically for base class
* SimpleComponent, does nothing.
*
* @param state The current page state.
* @param p The parent element. All elements generated in the method will
* be child elements of {@code p}.
*/
@Override
public void generateXML(PageState state, Element p) {
@ -152,7 +155,7 @@ public class SimpleComponent extends Completable
}
@Override
public void lock () {
public void lock() {
if (m_attr != null) {
m_attr.lock();
}
@ -160,10 +163,10 @@ public class SimpleComponent extends Completable
}
/**
* Unlocks this component. Package visibility is intentional; the
* only time a component should be unlocked is when it's pooled and
* gets locked because it's put into a page. It needs to be unlocked
* when the instance is recycled.
* Unlocks this component. Package visibility is intentional; the only time
* a component should be unlocked is when it's pooled and gets locked
* because it's put into a page. It needs to be unlocked when the instance
* is recycled.
*/
void unlock() {
m_locked = false;
@ -171,9 +174,9 @@ public class SimpleComponent extends Completable
}
/* Working with standard component attributes */
/**
* Gets the class attribute.
*
* @return the class attribute.
*/
@Override
@ -183,6 +186,7 @@ public class SimpleComponent extends Completable
/**
* Sets the class attribute.
*
* @param theClass a valid <a
* href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name">XML name</a>
*/
@ -194,6 +198,7 @@ public class SimpleComponent extends Completable
/**
* Gets the style attribute.
*
* @return the style attribute.
*/
@Override
@ -202,13 +207,13 @@ public class SimpleComponent extends Completable
}
/**
* Sets the style attribute. <code>style</code> should be a valid CSS
* style, since its value will be copied verbatim to the output and
* appear as a <tt>style</tt> attribute in the top level XML or HTML
* output element.
* Sets the style attribute. <code>style</code> should be a valid CSS style,
* since its value will be copied verbatim to the output and appear as a
* <tt>style</tt> attribute in the top level XML or HTML output element.
*
* @param style a valid CSS style description for use in the
* <tt>style</tt> attribute of an HTML tag
*
* @see <a href="#standard">Standard Attributes</a>
*/
@Override
@ -219,7 +224,9 @@ public class SimpleComponent extends Completable
/**
* Gets the <tt>id</tt> attribute.
*
* @return the <tt>id</tt> attribute.
*
* @see #setIdAttr(String id)
*/
@Override
@ -228,14 +235,14 @@ public class SimpleComponent extends Completable
}
/**
* Sets the <tt>id</tt> attribute. <code>id</code>
* should be an <a
* Sets the <tt>id</tt> attribute. <code>id</code> should be an <a
* href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name">XML name</a>
* that is unique within the {@link Page Page} in which this component is
* contained. The value of <code>id</code> is copied literally to the
* output and not used for internal processing.
* contained. The value of <code>id</code> is copied literally to the output
* and not used for internal processing.
*
* @param id a valid XML identifier
*
* @see <a href="#standard">Standard Attributes</a>
*/
@Override
@ -245,14 +252,10 @@ public class SimpleComponent extends Completable
}
/* Methods for attribute management */
/**
* Sets an attribute. Overwrites any old values. These values are used to
* generate attributes for the top level XML or HTML element that is
* output from this component with {@link #generateXML generateXML}.
*
* @pre name != null
* @post getAttribute(name) == value
* generate attributes for the top level XML or HTML element that is output
* from this component with {@link #generateXML generateXML}.
*
* @param name attribute name, case insensitive
* @param value new attribute value
@ -268,11 +271,12 @@ public class SimpleComponent extends Completable
/**
* Gets the value of an attribute.
*
* @pre name != null
*
* @param name attribute name, case insensitive
*
* @return the string value previously set with {@link #setAttribute
* setAttribute}, or <code>null</code> if none was set.
*
* @see #setAttribute
*/
final protected String getAttribute(String name) {
@ -285,17 +289,16 @@ public class SimpleComponent extends Completable
* <code>exportAttributes</code> overwrite attributes with identical names
* that <code>target</code> might already have.
*
* @pre target != null
*
* @param target element to which attributes are added
*
* @see #setAttribute
*/
final protected void exportAttributes(com.arsdigita.xml.Element target) {
if (m_attr != null) {
m_attr.exportAttributes(target);
}
if (KernelConfig.getConfig().isDebugEnabled() ||
BebopConfig.getConfig().getShowClassName()) {
if (KernelConfig.getConfig().isDebugEnabled() || BebopConfig.getConfig()
.getShowClassName()) {
target.addAttribute("bebop:classname", getClass().getName(),
BEBOP_XML_NS);
}
@ -303,6 +306,7 @@ public class SimpleComponent extends Completable
/**
* Returns <code>true</code> if any attributes have been set.
*
* @return <code>true</code> if any attributes have been set;
* <code>false</code> otherwise.
*/
@ -327,13 +331,15 @@ public class SimpleComponent extends Completable
* Supplies a key for parameter name mangling.
*
* @param key the key to mangle
* @return
*
* @return This component.
*/
@Override
public Component setKey(String key) {
Assert.isUnlocked(this);
if (key.charAt(0) >= 0 && key.charAt(0) <= 9) {
throw new IllegalArgumentException("key \"" + key + "\" must not start with a digit.");
throw new IllegalArgumentException("key \"" + key
+ "\" must not start with a digit.");
}
m_key = key;
return this;
@ -341,6 +347,7 @@ public class SimpleComponent extends Completable
/**
* Retrieves a key for parameter name mangling.
*
* @return a key for parameter name mangling.
*/
@Override

View File

@ -80,7 +80,6 @@ public interface SingleSelectionModel<T> {
* Clears the selection.
*
* @param state the state of the current request
* @post ! isSelected(state)
*/
void clearSelection(PageState state);
@ -102,8 +101,10 @@ public interface SingleSelectionModel<T> {
/**
* Returns the state parameter that will be used to keep track
* of the currently selected key. Typically, the implementing
* class will simply call:<br>
* <code><pre>return new StringParameter("foo");</pre></code><br>
* class will simply call:
*
* {@code return new StringParameter("foo");}
*
* This method may return null if a state parameter is not
* appropriate in the context of the implementing class.
*

View File

@ -57,7 +57,9 @@ public interface SecurityHelper {
/**
* Determines where to redirect the client to log in. The system calls
* this method if the user fails to log in and
* <code>requiresLogin(req)</code> is true.
* {@code requiresLogin(req)} is true.
*
* @param req The request for which the login URL is determined.
*
* @return the URL to which the client should be redirected to log in,
* never null.

View File

@ -40,7 +40,7 @@ import org.libreccm.core.CcmObjectRepository;
/**
* Loads a subclass of an ACSObject from the database. By default, uses a
* <del>BigDecimal</del> {@code Long} state parameter in order to store and
* {@code Long} state parameter in order to store and
* retrieve the item id.
*
* <strong>
@ -95,24 +95,6 @@ import org.libreccm.core.CcmObjectRepository;
* {@link SingleSelectionModel} may be wrapped. Thus, it becomes possible to use
* the <code>ACSObjectSelectionModel</code> even if the currently selected ID is
* not stored in a state parameter.
* <p>
* <b>Persistence Details:</b> The default constructor of
* <code>ACSObjectSelectionModel</code> will attempt to use the
* {@link DomainObjectFactory} to automatically instantiate the correct Java
* subclass of {@link ACSObject}. However, it is also possible to use an
* alternate constructor in order to force the
* <code>ACSObjectSelectionModel</code> to manually instantiate the objects:
*
* <blockquote><pre><code>
* ACSObjectSelectionModel model =
* new ACSObjectSelectionModel("com.arsdigita.cms.Article",
* "com.arsdigita.cms.Article", "item_id");
* </code></pre></blockquote>
*
* In this case, the model will attempt to use reflection to instantiate the
* correct subclass of <code>ACSObject</code>. In addition, the supplementary
* constructor makes it possible to create new objects in the database using the
* {@link #createACSObject(BigDecimal)} method.
*
* @see com.arsdigita.bebop.SingleSelectionModel
* @see com.arsdigita.bebop.ParameterSingleSelectionModel
@ -129,10 +111,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
private SingleSelectionModel selectionModel;
/**
* Construct a new <code>ACSObjectSelectionModel</code>. This model will
* produce instances of <code>ACSObject</code> by automatically
* instantiating the correct Java subclass using the
* {@link DomainObjectFactory}.
* Construct a new <code>ACSObjectSelectionModel</code>.
*
* @param parameter The state parameter which should be used to store the
* object ID
@ -142,10 +121,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
}
/**
* Construct a new <code>ACSObjectSelectionModel</code>. This model will
* produce instances of <code>ACSObject</code> by automatically
* instantiating the correct Java subclass using the
* {@link DomainObjectFactory}.
* Construct a new <code>ACSObjectSelectionModel</code>.
*
* @param parameterName The name of the state parameter which will be used
* to store the object ID.
@ -155,13 +131,10 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
}
/**
* Construct a new <code>ACSObjectSelectionModel</code>. This model will
* produce instances of <code>ACSObject</code> by automatically
* instantiating the correct Java subclass using the
* {@link DomainObjectFactory}.
* Construct a new <code>ACSObjectSelectionModel</code>.
*
* @param model The {@link SingleSelectionModel} which will supply a
* {@link BigDecimal} ID of the currently selected object
* {@link Long} ID of the currently selected object
*/
public ACSObjectSelectionModel(final SingleSelectionModel model) {
this(null, null, model);
@ -171,8 +144,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Construct a new <code>ACSObjectSelectionModel</code>
*
* @param javaClass The name of the Java class which represents the object.
* Must be a subclass of {@link ACSObject}. In addition, the class must have
* a constructor with a single {@link OID} parameter.
* Must be a subclass of {@link CcmObject}. In addition, the class must have
* a constructor with a single {@code id} parameter.
* @param objectType The name of the persistence metadata object type which
* represents the ACS object. In practice, will often be the same as the
* javaClass.
@ -189,8 +162,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Construct a new <code>ACSObjectSelectionModel</code>
*
* @param javaClass The name of the Java class which represents the object.
* Must be a subclass of {@link ACSObject}. In addition, the class must have
* a constructor with a single {@link OID} parameter.
* Must be a subclass of {@link CcmObject}. In addition, the class must have
* a constructor with a single {@code id} parameter.
* @param objectType The name of the persistence metadata object type which
* represents the ACS object. In practice, will often be the same as the
* javaClass.
@ -209,8 +182,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Construct a new <code>ACSObjectSelectionModel</code>
*
* @param javaClass The name of the Java class which represents the object.
* Must be a subclass of {@link ACSObject}. In addition, the class must have
* a constructor with a single {@link OID} parameter.
* Must be a subclass of {@link CcmObject}. In addition, the class must have
* a constructor with a single {@code id} parameter.
* @param objectType The name of the persistence metadata object type which
* represents the ACS object. In practice, will often be the same as the
* javaClass.
@ -282,7 +255,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
/**
* Load the selected object for the first time. Child classes may choose to
* override this method in order to load the object in nonstandard ways. The
* default implementation merely instantiates an {@link ACSObject} whose ID
* default implementation merely instantiates an {@link CcmObject} whose ID
* is the passed-in key.
*
* @param state the current page state
@ -345,8 +318,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* @param id The id of the new item - this is ignored and the object will
* have a different id
* @return The newly created item
* @throws javax.servlet.ServletException
* @post return != null
* @throws javax.servlet.ServletException If an error occurs.
* @deprecated This ignores the ID since ACSObject.setID is a no-op
*/
public CcmObject createACSObject(final Long id) throws ServletException {
@ -360,8 +332,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* name was supplied in the constructor, an assertion failure will occur.
*
* @return The newly created item
* @throws javax.servlet.ServletException
* @post return != null
* @throws javax.servlet.ServletException If an error occurs.
*/
public CcmObject createACSObject() throws ServletException {
Assert.exists(javaClassName, Class.class);
@ -415,7 +386,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Return the key that identifies the selected object.
*
* @param state the current page state
* @return the <del>{@link BigDecimal}</del> {@link Long} ID of the
* @return the {@link Long} ID of the
* currently selected object, or null if no object is selected.
*
*/
@ -429,8 +400,6 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Clear the selection.
*
* @param state the current page state.
* @post ! isSelected(state)
* @post ! isInitialized(state)
*/
@Override
public void clearSelection(final PageState state) {

View File

@ -78,7 +78,7 @@ public interface Lockable {
* Return whether an object is locked and thus immutable, or can still be
* modified.
*
* @return
* @return {@code true} if the object is immutable, {@code false} otherwise.
*/
boolean isLocked();

View File

@ -18,6 +18,8 @@
*/
package org.libreccm.tests.categories;
import org.junit.experimental.categories.Category;
/**
* A marker interface for use with JUnit's {@link Category} annotation to mark
* the tests which should be only executed when using one of the Arquillian

View File

@ -18,6 +18,8 @@
*/
package org.libreccm.tests.categories;
import org.junit.experimental.categories.Category;
/**
* A marker interface for use with JUnit's {@link Category} annotation to mark
* the tests which should be executed in every case.

View File

@ -84,7 +84,8 @@ public class DatasetsVerifier {
* Overwrite this method if you are using another schema than the default
* one.
*
* @return
* @return An string array contains the names of the database schemata used
* by the datasets the test.
*/
public String[] getSchemas() {
return new String[]{};

View File

@ -39,14 +39,14 @@ import org.junit.runners.Parameterized;
* public class FooBarTest extends EqualsVerifier {
*
* &#x40;Parameterized.Parameters(name = "{0}")
* public static Collection<Class<?>> data() {
* return Arrays.asList(new Class<?>[] {
* public static Collection&lt;Class&lt;?&gt;&gt; data() {
* return Arrays.asList(new Class&lt;?&gt;[] {
* Foo.class,
* Bar.class
* });
* }
*
* public FooBarTest(final Class<?> entityClass) {
* public FooBarTest(final Class&lt;?&gt; entityClass) {
* super(entityClass);
* }
* }

View File

@ -44,11 +44,11 @@ import java.lang.reflect.Modifier;
* &#x40;RunWith(Parameterized.class)
* &#x40;Category(UnitTest.class) public class FooBarTest extends ToStringVerifier {
*
* &#x40;Parameterized.Parameters(name = "{0}") public static Collection<Class<?>> data() {
* return Arrays.asList(new Class<?>[] { Foo.class, Bar.class });
* &#x40;Parameterized.Parameters(name = "{0}") public static Collection&lt;Class&lt;?&gt;&gt; data() {
* return Arrays.asList(new Class&lt;?&gt;[] { Foo.class, Bar.class });
* }
*
* public FooBarTest(final Class<?> entityClass) {
* public FooBarTest(final Class&lt;?&gt; entityClass) {
* super(entityClass);
* }
* }