CCM NG: Fixed several JavaDoc warnings.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4601 8810af33-2d31-482b-a856-94f89814c4df
jensp 2017-02-25 17:06:13 +00:00
parent 08fc76d7e6
commit 0a1a82bb87
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.Assert;
import com.arsdigita.util.Lockable; import com.arsdigita.util.Lockable;
import java.util.stream.Stream;
/** /**
* A standard implementation of <code>SingleSelectionModel</code> and * 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. * 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 Unknown
* @author Jens Pelzetter (jensp) * @author Jens Pelzetter (jensp)

View File

@ -30,70 +30,76 @@ import java.util.TooManyListenersException;
* The parent of all Bebop Link classes, this class represents a URL on a page. * 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. * It may contain a label, an image, or any other component.
* *
* <p> The following table lists all Bebop Link classes and suggests * <p>
* when they might be used. * The following table lists all Bebop Link classes and suggests when they might
* be used.
* <p> * <p>
* <table BORDER=3> * <table BORDER=3>
* <tr> * <tr>
* <th>Link Class</th> * <th>Link Class</th>
* <th>Usage</th> * <th>Usage</th>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@link BaseLink}</td> * <td>{@link BaseLink}</td>
* <td>Parent class of Bebop Link classes. Extend this class to * <td>Parent class of Bebop Link classes. Extend this class to build your own
* build your own Link class.</td> * Link class.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@link Link}</td> * <td>{@link Link}</td>
* <td>Link class that manages its own URL variables. Session information * <td>Link class that manages its own URL variables. Session information is
* is added to the target URL for this type.</td> * added to the target URL for this type.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@link ExternalLink}</td> * <td>{@link ExternalLink}</td>
* <td>Link that does not encode the URL with any session information. * <td>Link that does not encode the URL with any session information. Used for
* Used for a link to a page outside the site.</td> * a link to a page outside the site.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@link ControlLink}</td> * <td>{@link ControlLink}</td>
* <td> Used for references within its own page (often * <td> Used for references within its own page (often as fields in a table
* as fields in a table header for sorting a column).</td> * header for sorting a column).</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@link ActionLink}</td> * <td>{@link ActionLink}</td>
* <td>Sets its own control event and runs its own * <td>Sets its own control event and runs its own
* {@link com.arsdigita.bebop.event.ActionListener}s. When the link is clicked, * {@link com.arsdigita.bebop.event.ActionListener}s. When the link is clicked,
* the code in the Listener's <tt>actionPerformed</tt> method runs.</td> * the code in the Listener's <tt>actionPerformed</tt> method runs.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@link ToggleLink}</td> * <td>{@link ToggleLink}</td>
* <td>A link that turns into label when it is selected and * <td>A link that turns into label when it is selected and turns back into a
* turns back into a link when it is unselected.</td> * link when it is unselected.</td>
* </tr> * </tr>
* </table> * </table>
* *
* @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $ * @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $
*/ */
public abstract class BaseLink extends DescriptiveComponent public abstract class BaseLink extends DescriptiveComponent
implements Cloneable { 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 TYPE_ATTR = "type";
private final static String HREF_NO_JAVASCRIPT = "href_no_javascript"; private final static String HREF_NO_JAVASCRIPT = "href_no_javascript";
private final static String HREF = "href"; 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; 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; protected String m_url;
// Use the parent class' property! // Use the parent class' property!
// /** Property to store informational text for the user about the Link, e.g. // /** 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). */ // * how to use it, or when to use it (or not to use it). */
// private GlobalizedMessage m_hint; // private GlobalizedMessage m_hint;
protected String m_noJavascriptURL = null; protected String m_noJavascriptURL = null;
private PrintListener m_printListener; private PrintListener m_printListener;
@ -102,15 +108,16 @@ public abstract class BaseLink extends DescriptiveComponent
private GlobalizedMessage m_confirmMsg; private GlobalizedMessage m_confirmMsg;
/** /**
* Constructor creates a link taking url as the target and display it to * Constructor creates a link taking url as the target and display it to the
* the user at the same time. It is the only allowed way to present the * user at the same time. It is the only allowed way to present the user
* user with a not globlized information. The implementation currently * with a not globlized information. The implementation currently miss-uses
* miss-uses the Label component to display just a not globalized String * the Label component to display just a not globalized String which is
* which is deprecated. * deprecated.
* *
* @param url * @param url
*
* @deprecated use BaseLink(Component,url) instead with a Label using a * @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead * GlobalizedMessage instead
*/ */
public BaseLink(final String url) { public BaseLink(final String url) {
this(new Label(url), url); this(new Label(url), url);
@ -120,7 +127,7 @@ public abstract class BaseLink extends DescriptiveComponent
* Constructor * Constructor
* *
* @param child display component (Label, Image, etc.) * @param child display component (Label, Image, etc.)
* @param url URL to point at * @param url URL to point at
*/ */
public BaseLink(final Component child, final String url) { public BaseLink(final Component child, final String url) {
super(); super();
@ -131,7 +138,7 @@ public abstract class BaseLink extends DescriptiveComponent
/** /**
* Constructor. * Constructor.
* *
* @param child display component (Label, Image, etc.) * @param child display component (Label, Image, etc.)
* @param listener PrintListener, may be used to change either the Display * @param listener PrintListener, may be used to change either the Display
* text or the url within a locked page. * text or the url within a locked page.
*/ */
@ -141,7 +148,8 @@ public abstract class BaseLink extends DescriptiveComponent
addPrintListener(listener); addPrintListener(listener);
} catch (TooManyListenersException e) { } catch (TooManyListenersException e) {
// Can't happen // Can't happen
throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e); throw new UncheckedWrapperException("Too many listeners: " + e
.getMessage(), e);
} }
} }
@ -155,14 +163,14 @@ public abstract class BaseLink extends DescriptiveComponent
} }
// DEPRECATED constructors // DEPRECATED constructors
/** /**
* Constructor. * Constructor.
* *
* @param label as text * @param label as text
* @param url * @param url
*
* @deprecated use BaseLink(Component,url) instead with a Label using a * @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead * GlobalizedMessage instead
*/ */
public BaseLink(final String label, final String url) { public BaseLink(final String label, final String url) {
this(new Label(label), url); this(new Label(label), url);
@ -171,22 +179,24 @@ public abstract class BaseLink extends DescriptiveComponent
/** /**
* Constructor. * Constructor.
* *
* @param label as text * @param label as text
* @param listener PrintListener, may be used to change either the Display * @param listener PrintListener, may be used to change either the Display
* text or the url within a locked page. * 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) { public BaseLink(final String label, final PrintListener listener) {
this(new Label(label), listener); this(new Label(label), listener);
} }
// Class Methods // Class Methods
/** /**
* Clone. * Clone.
* @return *
* @throws CloneNotSupportedException * @return The clone of the object.
*
* @throws CloneNotSupportedException If cloning is not supported.
*/ */
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
@ -196,23 +206,25 @@ public abstract class BaseLink extends DescriptiveComponent
} }
/** /**
* Adds a print listener. * Adds a print listener. Since the <code>PrintListener</code> is expected
* Since the <code>PrintListener</code> is expected to modify the target * to modify the target of the <code>PrintEvent</code>, only one print
* of the <code>PrintEvent</code>, only one print listener can be set * listener can be set for a link.
* for a link.
* *
* @param listener The print listener. Must not <code>null</code>. * @param listener The print listener. Must not <code>null</code>.
* @throws IllegalArgumentException if <code>listener</code> is null. *
* @throws IllegalArgumentException if <code>listener</code> is null.
* @throws TooManyListenersException if a print listener has previously been * @throws TooManyListenersException if a print listener has previously been
* added. * added.
*/ */
public void addPrintListener(final PrintListener listener) public void addPrintListener(final PrintListener listener)
throws IllegalStateException, TooManyListenersException { throws IllegalStateException, TooManyListenersException {
if (listener == null) { 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) { 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; m_printListener = listener;
} }
@ -224,26 +236,31 @@ public abstract class BaseLink extends DescriptiveComponent
* will be thrown. * will be thrown.
* *
* @param listener The listener that was previously added with * @param listener The listener that was previously added with
* <code>addPrintListener</code>. * <code>addPrintListener</code>. Must not be
* Must not be <code>null</code>. * <code>null</code>.
*
* @throws IllegalArgumentException if <code>listener</code> is not the * @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) public void removePrintListener(final PrintListener listener)
throws IllegalArgumentException { throws IllegalArgumentException {
if (listener == null) { if (listener == null) {
throw new IllegalArgumentException("listener can not be null"); throw new IllegalArgumentException("listener can not be null");
} }
if (listener != m_printListener) { 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; m_printListener = null;
} }
/** /**
* Execute the {@link PrintListener} assigned to the link.
* *
* @param state * @param state The current page state
* @return *
* @return The base link after all {@link PrintListener} have been executed.
*/ */
protected BaseLink firePrintEvent(final PageState state) { protected BaseLink firePrintEvent(final PageState state) {
BaseLink l = this; 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, * Retrieves the label component used to display the Link. Typically a
* but may be an other type, e.g. an Image, as well. * Label, but may be an other type, e.g. an Image, as well.
* *
* @return Component used to display the Link. * @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 * 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 * Labels and GlobalizedMessages are used here differently (a
* GlobalizedMessage is here not directly used as a Label by specifying it * GlobalizedMessage is here not directly used as a Label by specifying it
* as an attribugte, inside a Label component). * as an attribute, inside a Label component).
* @param message *
* @param message The text to show.
*/ */
@Override @Override
public void setLabel(final GlobalizedMessage message) { public void setLabel(final GlobalizedMessage message) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
Label label = new Label(message); 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() { public final String getTarget() {
return m_url; return m_url;
@ -315,29 +334,31 @@ public abstract class BaseLink extends DescriptiveComponent
} }
/** /**
* Generate the URL for the link.
* *
* @param state * @param state The current {@link PageState}.
* @param parent * @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: * Generates a DOM fragment:
* <p><pre> *
* &lt;bebop:link href="..." type="..." %bebopAttr;/> * <pre>
* &lt;bebop:link href="..." type="..." %bebopAttr;/&gt;
* </pre> * </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 * The {@code href} attribute contains the target the link should point to.
* control over which kind of link this element represents. The types are * The {@code type} attribute is used to give more fine grained control over
* <code>link</code> for a <code>Link</code>, <code>control</code> for a * which kind of link this element represents. The types are {@code link}
* {@link ControlLink}, and <code>toggle</code> for a {@link ToggleLink}. * for a {@code Link}, {@code control} for a {@link ControlLink}. There may
* There may be additional attributes depending on what type of link this * be additional attributes depending on what type of link this link
* link represents. * represents.
* *
* @see ControlLink#generateXML * @see ControlLink#generateXML
* @see ToggleLink#generateXML
* *
* @param state The current {@link PageState}. * @param state The current {@link PageState}.
* @param parent The XML element to attach the XML to. * @param parent The XML element to attach the XML to.
*/ */
@Override @Override
@ -362,6 +383,7 @@ public abstract class BaseLink extends DescriptiveComponent
* *
* @param state * @param state
* @param sUrl * @param sUrl
*
* @return * @return
*/ */
private String getAbsoluteUrl(final PageState state, final String sUrl) { private String getAbsoluteUrl(final PageState state, final String sUrl) {
@ -398,13 +420,15 @@ public abstract class BaseLink extends DescriptiveComponent
* Sets up no-JavaScript fallback HTML * Sets up no-JavaScript fallback HTML
* *
* @param state The current {@link PageState}. * @param state The current {@link PageState}.
* @param link The link element. * @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; String sURL = null;
if (m_sConfirmMsg.length() > 0 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 //if we want the confirm link, create the link
String sOkUrl = getAbsoluteUrl(state, link.getAttribute(HREF)); String sOkUrl = getAbsoluteUrl(state, link.getAttribute(HREF));
@ -416,9 +440,11 @@ public abstract class BaseLink extends DescriptiveComponent
} }
if (m_sConfirmMsg.length() > 0) { if (m_sConfirmMsg.length() > 0) {
sURL = ConfirmPage.getConfirmUrl(m_sConfirmMsg, sOkUrl, sCancelUrl); sURL = ConfirmPage.getConfirmUrl(m_sConfirmMsg, sOkUrl,
sCancelUrl);
} else if (m_confirmMsg != null) { } else if (m_confirmMsg != null) {
sURL = ConfirmPage.getConfirmUrl(m_confirmMsg.localize().toString(), sOkUrl, sCancelUrl); sURL = ConfirmPage.getConfirmUrl(m_confirmMsg.localize()
.toString(), sOkUrl, sCancelUrl);
} }
} else { } else {
@ -435,15 +461,16 @@ public abstract class BaseLink extends DescriptiveComponent
} }
/** /**
* Adds type-specific XML attributes to the XML element representing * Adds type-specific XML attributes to the XML element representing this
* this link. Subclasses should override this method if they introduce * link. Subclasses should override this method if they introduce more
* more attributes than the ones {@link #generateXML generateXML} * attributes than the ones {@link #generateXML generateXML} produces by
* produces by default. * default.
* *
* @param state The current request * @param state The current request
* @param link The XML element representing this link * @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 * protection for this link</em>. Not for confirmation messages; Should call
* setConfirmation for that. * setConfirmation for that.
* *
* @param value The confirmation link. To not use the value {@code return confirm(} with this * @param value The confirmation link. To not use the value
* method. * {@code return confirm(} with this method.
* *
* @see #setConfirmation * @see #setConfirmation
*/ */
@ -461,8 +488,8 @@ public abstract class BaseLink extends DescriptiveComponent
//use setConfirmation() instead, or else the javascript will break //use setConfirmation() instead, or else the javascript will break
if (value != null) { if (value != null) {
Assert.isTrue(!value.toLowerCase().startsWith("return confirm("), Assert.isTrue(!value.toLowerCase().startsWith("return confirm("),
"Do not use setOnClick() to set confirmation messages. " "Do not use setOnClick() to set confirmation messages. "
+ "Use setCofirmation() instead."); + "Use setCofirmation() instead.");
} }
setAttribute(ON_CLICK, value); setAttribute(ON_CLICK, value);
@ -470,17 +497,17 @@ public abstract class BaseLink extends DescriptiveComponent
/** /**
* Forces the user to click through a confirmation dialog before this link * Forces the user to click through a confirmation dialog before this link
* is followed. The user is prompted with the specified message. If the * is followed. The user is prompted with the specified message. If the user
* user does not does not confirm, the link is not followed. The current * does not does not confirm, the link is not followed. The current
* implementation uses the JavaScript confirm function and the onClick * implementation uses the JavaScript confirm function and the onClick
* attribute. * attribute. If JavaScript is not enabled in the client browser, this
* If JavaScript is not enabled in the client browser, this method will * method will redirect the browser to a Bebop confirmation page rather than
* redirect the browser to a Bebop confirmation page rather than use * use a JavaScript confirmation. Subsequent calls to setOnClick will undo
* a JavaScript confirmation. * the effect of this method.
* Subsequent calls to setOnClick will undo the effect of this method.
* *
* @param message the confirmation message presented to the user. This * @param message the confirmation message presented to the user. This
* message cannot have an apostrophe or back slash. * message cannot have an apostrophe or back slash.
*
* @deprecated Use setConfirmation(final GlobalizedMessage msg) instead * @deprecated Use setConfirmation(final GlobalizedMessage msg) instead
*/ */
public void setConfirmation(final String message) { public void setConfirmation(final String message) {
@ -488,9 +515,10 @@ public abstract class BaseLink extends DescriptiveComponent
//or back slashes //or back slashes
if (Assert.isEnabled()) { if (Assert.isEnabled()) {
final boolean isGoodMessage = message.indexOf("'") == -1 && message.indexOf("\\") == -1; final boolean isGoodMessage = message.indexOf("'") == -1 && message
.indexOf("\\") == -1;
Assert.isTrue(isGoodMessage, Assert.isTrue(isGoodMessage,
"confirmation message cannot contain apostrophe or back slash"); "confirmation message cannot contain apostrophe or back slash");
} }
m_sConfirmMsg = message; m_sConfirmMsg = message;
@ -498,7 +526,8 @@ public abstract class BaseLink extends DescriptiveComponent
/** /**
* Set a GlobalizedMessage as confirmation message * Set a GlobalizedMessage as confirmation message
* @param msg *
* @param msg The text to show for confirming.
*/ */
public void setConfirmation(final GlobalizedMessage msg) { public void setConfirmation(final GlobalizedMessage msg) {
m_confirmMsg = msg; m_confirmMsg = msg;
@ -508,9 +537,10 @@ public abstract class BaseLink extends DescriptiveComponent
* Generate XML output for confirmation links * Generate XML output for confirmation links
* *
* @param state PageState * @param state PageState
* @param link Parent element * @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 a confirmation message is set
if (m_sConfirmMsg.length() > 0 || m_confirmMsg != null) { if (m_sConfirmMsg.length() > 0 || m_confirmMsg != null) {
@ -522,13 +552,15 @@ public abstract class BaseLink extends DescriptiveComponent
if (m_sConfirmMsg.length() > 0) { if (m_sConfirmMsg.length() > 0) {
// then set the onclick attribute for the link with the static message // 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_configMsg is set
} else if (m_confirmMsg != null) { } else if (m_confirmMsg != null) {
//then set the onclick attribute for the link with a globalized message //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() { public final String getNoJavascriptTarget() {
return m_noJavascriptURL; 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 * 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. * 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 * <p>
* listeners, they are not run unless you override {@link #setControlEvent * <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 * setControlEvent}. If you need this behavior, you should use an {@link
* ActionLink}. A control link is hardly ever useful unless it is contained * ActionLink}. A control link is hardly ever useful unless it is contained in
* in an event-generating component like {@link List} or {@link Table}. * 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 * 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 * event <tt>delete</tt> with associated value <tt>42</tt> to be sent to the
* the component <tt>fooComponent</tt> when the user clicks on it: * component <tt>fooComponent</tt> when the user clicks on it:
* *
* <pre> * <pre>
* ControlLink l = new ControlLink("click here") { * ControlLink l = new ControlLink("click here") {
@ -53,13 +55,14 @@ import com.arsdigita.xml.Element;
* }; * };
* </pre> * </pre>
* *
* <p> This requires that <tt>fooComponent</tt> is part of the page * <p>
* hierarchy. The control link <tt>l</tt> does not have to be part of the * This requires that <tt>fooComponent</tt> is part of the page hierarchy. The
* page hierarchy, and may be generated on the fly. (See * control link <tt>l</tt> does not have to be part of the page hierarchy, and
* {@link PageState} for details on control events.) * may be generated on the fly. (See {@link PageState} for details on control
* events.)
* *
* <p>See {@link BaseLink} for a description * <p>
* of all Bebop Link classes. * See {@link BaseLink} for a description of all Bebop Link classes.
* *
* @author Stanislav Freidin * @author Stanislav Freidin
* @author David Lutterkort * @author David Lutterkort
@ -73,14 +76,14 @@ public class ControlLink extends BaseLink {
protected final String TYPE_CONTROL = "control"; protected final String TYPE_CONTROL = "control";
/** /**
* A list of all action listeners. The list is instantiated lazily, and * A list of all action listeners. The list is instantiated lazily, and will
* will therefore be null in most applications. * therefore be null in most applications.
*/ */
private ArrayList m_actionListeners; private ArrayList m_actionListeners;
/** /**
* Constructs a new ControlLink. The link will encapsulates * Constructs a new ControlLink. The link will encapsulates the child
* the child component (which should be a label or an image). * component (which should be a label or an image).
* *
* @param child the component that will be turned into a link * @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 * Adds an <code>ActionListener</code>, which will be run when
* #respond respond} is called. * {@link#respond respond} is called.
* @param 1 a listener to add *
* @param listener The listener to add.
* *
* @pre l != null
* @pre ! isLocked()
* @see #respond respond * @see #respond respond
*/ */
public void addActionListener(ActionListener l) { public void addActionListener(ActionListener listener) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
if ( m_actionListeners == null ) { if (m_actionListeners == null) {
m_actionListeners = new ArrayList(); m_actionListeners = new ArrayList();
} }
m_actionListeners.add(l); m_actionListeners.add(listener);
} }
/** /**
* Removes a previously added <code>ActionListener</code>. * Removes a previously added <code>ActionListener</code>.
* @param 1 the listener to remove *
* @param listener The listener to remove.
*
* @see #addActionListener addActionListener * @see #addActionListener addActionListener
*/ */
public void removeActionListener(ActionListener l) { public void removeActionListener(ActionListener listener) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
if ( m_actionListeners == null ) { if (m_actionListeners == null) {
return; return;
} }
m_actionListeners.remove(l); m_actionListeners.remove(listener);
} }
/** /**
* Fires an <code>ActionEvent</code>, which causes all registered * Fires an <code>ActionEvent</code>, which causes all registered
* <code>ActionListener</code>s to be run. The source of the event * <code>ActionListener</code>s to be run. The source of the event is the
* is the <code>TabbedPane</code>. * <code>TabbedPane</code>.
*
* @param state the current page state * @param state the current page state
* @pre state != null *
* @see #respond respond * @see #respond respond
*/ */
protected void fireActionEvent(PageState state) { protected void fireActionEvent(PageState state) {
@ -141,8 +146,8 @@ public class ControlLink extends BaseLink {
if (m_actionListeners == null) { if (m_actionListeners == null) {
return; return;
} }
for (int i=0; i < m_actionListeners.size(); i++ ) { for (int i = 0; i < m_actionListeners.size(); i++) {
if ( e == null ) { if (e == null) {
e = new ActionEvent(this, state); e = new ActionEvent(this, state);
} }
((ActionListener) m_actionListeners.get(i)).actionPerformed(e); ((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>. * Responds to the incoming request. Fires the <code>ActionEvent</code>.
*
* @param state the current page state * @param state the current page state
*/ */
@Override @Override
@ -159,10 +165,10 @@ public class ControlLink extends BaseLink {
} }
/** /**
* Generates the URL for a link and sets it as the "href" attribute * Generates the URL for a link and sets it as the "href" attribute of the
* of the parent. * parent.
* *
* @param state the current page state * @param state the current page state
* @param parent the parent element * @param parent the parent element
*/ */
@Override @Override

View File

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

View File

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

View File

@ -80,7 +80,6 @@ public interface SingleSelectionModel<T> {
* Clears the selection. * Clears the selection.
* *
* @param state the state of the current request * @param state the state of the current request
* @post ! isSelected(state)
*/ */
void clearSelection(PageState state); void clearSelection(PageState state);
@ -102,8 +101,10 @@ public interface SingleSelectionModel<T> {
/** /**
* Returns the state parameter that will be used to keep track * Returns the state parameter that will be used to keep track
* of the currently selected key. Typically, the implementing * of the currently selected key. Typically, the implementing
* class will simply call:<br> * class will simply call:
* <code><pre>return new StringParameter("foo");</pre></code><br> *
* {@code return new StringParameter("foo");}
*
* This method may return null if a state parameter is not * This method may return null if a state parameter is not
* appropriate in the context of the implementing class. * 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 * Determines where to redirect the client to log in. The system calls
* this method if the user fails to log in and * 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, * @return the URL to which the client should be redirected to log in,
* never null. * 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 * 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. * retrieve the item id.
* *
* <strong> * <strong>
@ -95,24 +95,6 @@ import org.libreccm.core.CcmObjectRepository;
* {@link SingleSelectionModel} may be wrapped. Thus, it becomes possible to use * {@link SingleSelectionModel} may be wrapped. Thus, it becomes possible to use
* the <code>ACSObjectSelectionModel</code> even if the currently selected ID is * the <code>ACSObjectSelectionModel</code> even if the currently selected ID is
* not stored in a state parameter. * 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.SingleSelectionModel
* @see com.arsdigita.bebop.ParameterSingleSelectionModel * @see com.arsdigita.bebop.ParameterSingleSelectionModel
@ -129,10 +111,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
private SingleSelectionModel selectionModel; private SingleSelectionModel selectionModel;
/** /**
* Construct a new <code>ACSObjectSelectionModel</code>. This model will * Construct a new <code>ACSObjectSelectionModel</code>.
* produce instances of <code>ACSObject</code> by automatically
* instantiating the correct Java subclass using the
* {@link DomainObjectFactory}.
* *
* @param parameter The state parameter which should be used to store the * @param parameter The state parameter which should be used to store the
* object ID * object ID
@ -142,10 +121,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
} }
/** /**
* Construct a new <code>ACSObjectSelectionModel</code>. This model will * Construct a new <code>ACSObjectSelectionModel</code>.
* produce instances of <code>ACSObject</code> by automatically
* instantiating the correct Java subclass using the
* {@link DomainObjectFactory}.
* *
* @param parameterName The name of the state parameter which will be used * @param parameterName The name of the state parameter which will be used
* to store the object ID. * to store the object ID.
@ -155,13 +131,10 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
} }
/** /**
* Construct a new <code>ACSObjectSelectionModel</code>. This model will * Construct a new <code>ACSObjectSelectionModel</code>.
* produce instances of <code>ACSObject</code> by automatically
* instantiating the correct Java subclass using the
* {@link DomainObjectFactory}.
* *
* @param model The {@link SingleSelectionModel} which will supply a * @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) { public ACSObjectSelectionModel(final SingleSelectionModel model) {
this(null, null, model); this(null, null, model);
@ -171,8 +144,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Construct a new <code>ACSObjectSelectionModel</code> * Construct a new <code>ACSObjectSelectionModel</code>
* *
* @param javaClass The name of the Java class which represents the object. * @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 * Must be a subclass of {@link CcmObject}. In addition, the class must have
* a constructor with a single {@link OID} parameter. * a constructor with a single {@code id} parameter.
* @param objectType The name of the persistence metadata object type which * @param objectType The name of the persistence metadata object type which
* represents the ACS object. In practice, will often be the same as the * represents the ACS object. In practice, will often be the same as the
* javaClass. * javaClass.
@ -189,8 +162,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Construct a new <code>ACSObjectSelectionModel</code> * Construct a new <code>ACSObjectSelectionModel</code>
* *
* @param javaClass The name of the Java class which represents the object. * @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 * Must be a subclass of {@link CcmObject}. In addition, the class must have
* a constructor with a single {@link OID} parameter. * a constructor with a single {@code id} parameter.
* @param objectType The name of the persistence metadata object type which * @param objectType The name of the persistence metadata object type which
* represents the ACS object. In practice, will often be the same as the * represents the ACS object. In practice, will often be the same as the
* javaClass. * javaClass.
@ -209,8 +182,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Construct a new <code>ACSObjectSelectionModel</code> * Construct a new <code>ACSObjectSelectionModel</code>
* *
* @param javaClass The name of the Java class which represents the object. * @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 * Must be a subclass of {@link CcmObject}. In addition, the class must have
* a constructor with a single {@link OID} parameter. * a constructor with a single {@code id} parameter.
* @param objectType The name of the persistence metadata object type which * @param objectType The name of the persistence metadata object type which
* represents the ACS object. In practice, will often be the same as the * represents the ACS object. In practice, will often be the same as the
* javaClass. * javaClass.
@ -282,7 +255,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
/** /**
* Load the selected object for the first time. Child classes may choose to * 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 * 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. * is the passed-in key.
* *
* @param state the current page state * @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 * @param id The id of the new item - this is ignored and the object will
* have a different id * have a different id
* @return The newly created item * @return The newly created item
* @throws javax.servlet.ServletException * @throws javax.servlet.ServletException If an error occurs.
* @post return != null
* @deprecated This ignores the ID since ACSObject.setID is a no-op * @deprecated This ignores the ID since ACSObject.setID is a no-op
*/ */
public CcmObject createACSObject(final Long id) throws ServletException { 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. * name was supplied in the constructor, an assertion failure will occur.
* *
* @return The newly created item * @return The newly created item
* @throws javax.servlet.ServletException * @throws javax.servlet.ServletException If an error occurs.
* @post return != null
*/ */
public CcmObject createACSObject() throws ServletException { public CcmObject createACSObject() throws ServletException {
Assert.exists(javaClassName, Class.class); Assert.exists(javaClassName, Class.class);
@ -415,7 +386,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Return the key that identifies the selected object. * Return the key that identifies the selected object.
* *
* @param state the current page state * @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. * currently selected object, or null if no object is selected.
* *
*/ */
@ -429,8 +400,6 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
* Clear the selection. * Clear the selection.
* *
* @param state the current page state. * @param state the current page state.
* @post ! isSelected(state)
* @post ! isInitialized(state)
*/ */
@Override @Override
public void clearSelection(final PageState state) { 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 * Return whether an object is locked and thus immutable, or can still be
* modified. * modified.
* *
* @return * @return {@code true} if the object is immutable, {@code false} otherwise.
*/ */
boolean isLocked(); boolean isLocked();

View File

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

View File

@ -18,6 +18,8 @@
*/ */
package org.libreccm.tests.categories; package org.libreccm.tests.categories;
import org.junit.experimental.categories.Category;
/** /**
* A marker interface for use with JUnit's {@link Category} annotation to mark * A marker interface for use with JUnit's {@link Category} annotation to mark
* the tests which should be executed in every case. * 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 * Overwrite this method if you are using another schema than the default
* one. * one.
* *
* @return * @return An string array contains the names of the database schemata used
* by the datasets the test.
*/ */
public String[] getSchemas() { public String[] getSchemas() {
return new String[]{}; return new String[]{};

View File

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

View File

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