CCM NG: Fixed several JavaDoc warnings.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4601 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
ed5dee4ee1
commit
d9e70e820f
|
|
@ -934,7 +934,7 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -30,70 +30,76 @@ 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>
|
||||
* <th>Link Class</th>
|
||||
* <th>Usage</th>
|
||||
* <th>Link Class</th>
|
||||
* <th>Usage</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@link BaseLink}</td>
|
||||
* <td>Parent class of Bebop Link classes. Extend this class to
|
||||
* build your own Link class.</td>
|
||||
* <td>{@link BaseLink}</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 Link}</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 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>
|
||||
* </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>{@link ControlLink}</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>
|
||||
* <td>Sets its own control event and runs its own
|
||||
* <td>{@link ActionLink}</td>
|
||||
* <td>Sets its own control event and runs its own
|
||||
* {@link com.arsdigita.bebop.event.ActionListener}s. When the link is clicked,
|
||||
* the code in the Listener's <tt>actionPerformed</tt> method runs.</td>
|
||||
* </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>{@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>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $
|
||||
*/
|
||||
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 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,15 +108,16 @@ 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
|
||||
* GlobalizedMessage instead
|
||||
*/
|
||||
public BaseLink(final String url) {
|
||||
this(new Label(url), url);
|
||||
|
|
@ -120,7 +127,7 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
* Constructor
|
||||
*
|
||||
* @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) {
|
||||
super();
|
||||
|
|
@ -131,7 +138,7 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
/**
|
||||
* 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
|
||||
* text or the url within a locked page.
|
||||
*/
|
||||
|
|
@ -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,14 +163,14 @@ 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
|
||||
* GlobalizedMessage instead
|
||||
*/
|
||||
public BaseLink(final String label, final String url) {
|
||||
this(new Label(label), url);
|
||||
|
|
@ -171,22 +179,24 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param label as text
|
||||
* @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
|
||||
* Clone.
|
||||
*
|
||||
* @return The clone of the object.
|
||||
*
|
||||
* @throws CloneNotSupportedException If cloning is not supported.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
|
|
@ -196,54 +206,61 @@ 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 IllegalArgumentException if <code>listener</code> is null.
|
||||
* @throws TooManyListenersException if a print listener has previously been
|
||||
* added.
|
||||
* added.
|
||||
*/
|
||||
public void addPrintListener(final PrintListener listener)
|
||||
throws IllegalStateException, TooManyListenersException {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a previously added print listener. If the passed in
|
||||
* <code>listener</code> is not the listener that was added with
|
||||
* {@link #addPrintListener addPrintListener}, an IllegalArgumentException
|
||||
* <code>listener</code> is not the listener that was added with
|
||||
* {@link #addPrintListener addPrintListener}, an IllegalArgumentException
|
||||
* will be thrown.
|
||||
*
|
||||
* @param listener The listener that was previously added with
|
||||
* <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>.
|
||||
* @param listener The listener that was previously added with
|
||||
* <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>.
|
||||
*/
|
||||
public void removePrintListener(final PrintListener listener)
|
||||
throws IllegalArgumentException {
|
||||
throws IllegalArgumentException {
|
||||
if (listener == null) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @return
|
||||
* Execute the {@link PrintListener} assigned to the link.
|
||||
*
|
||||
* @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,9 +277,9 @@ 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.
|
||||
*/
|
||||
public final Component getChild() {
|
||||
|
|
@ -275,24 +292,26 @@ 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
|
||||
* Labels and GlobalizedMessages are used here differently (a
|
||||
* 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
|
||||
* 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) {
|
||||
public void setLabel(final GlobalizedMessage message) {
|
||||
Assert.isUnlocked(this);
|
||||
Label label = new Label(message);
|
||||
setChild( (Component)label);
|
||||
setChild((Component) label);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* Get the target of the link.
|
||||
*
|
||||
* @return The target URL of the link.
|
||||
*/
|
||||
public final String getTarget() {
|
||||
return m_url;
|
||||
|
|
@ -315,40 +334,42 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @param parent
|
||||
* Generate the URL for the link.
|
||||
*
|
||||
* @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>
|
||||
* <bebop:link href="..." type="..." %bebopAttr;/>
|
||||
* Generates a DOM fragment:
|
||||
*
|
||||
* <pre>
|
||||
* <bebop:link href="..." type="..." %bebopAttr;/>
|
||||
* </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 state The current {@link PageState}.
|
||||
* @param parent The XML element to attach the XML to.
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(final PageState state, final Element parent) {
|
||||
if (isVisible(state)) {
|
||||
BaseLink target = firePrintEvent(state);
|
||||
|
||||
|
||||
Element link = parent.newChildElement("bebop:link", BEBOP_XML_NS);
|
||||
|
||||
|
||||
target.generateURL(state, link);
|
||||
target.exportConfirmAttributes(state, link);
|
||||
target.exportConfirmAttributes(state, link);
|
||||
//setup the link without javascript
|
||||
target.setupNoJavascriptURL(state, link);
|
||||
target.exportAttributes(link);
|
||||
|
|
@ -359,10 +380,11 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param state
|
||||
* @param sUrl
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getAbsoluteUrl(final PageState state, final String sUrl) {
|
||||
String sReturn = "";
|
||||
|
|
@ -397,14 +419,16 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
/**
|
||||
* Sets up no-JavaScript fallback HTML
|
||||
*
|
||||
* @param state The current {@link PageState}.
|
||||
* @param link The link element.
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
|
|
@ -461,8 +488,8 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
//use setConfirmation() instead, or else the javascript will break
|
||||
if (value != null) {
|
||||
Assert.isTrue(!value.toLowerCase().startsWith("return confirm("),
|
||||
"Do not use setOnClick() to set confirmation messages. "
|
||||
+ "Use setCofirmation() instead.");
|
||||
"Do not use setOnClick() to set confirmation messages. "
|
||||
+ "Use setCofirmation() instead.");
|
||||
}
|
||||
|
||||
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
|
||||
* 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.
|
||||
* message cannot have an apostrophe or back slash.
|
||||
*
|
||||
* @deprecated Use setConfirmation(final GlobalizedMessage msg) instead
|
||||
*/
|
||||
public void setConfirmation(final String message) {
|
||||
|
|
@ -488,9 +515,10 @@ 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");
|
||||
"confirmation message cannot contain apostrophe or back slash");
|
||||
}
|
||||
|
||||
m_sConfirmMsg = message;
|
||||
|
|
@ -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;
|
||||
|
|
@ -506,11 +535,12 @@ public abstract class BaseLink extends DescriptiveComponent
|
|||
|
||||
/**
|
||||
* Generate XML output for confirmation links
|
||||
*
|
||||
*
|
||||
* @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 (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_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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,17 +55,18 @@ 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
|
||||
* @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
* @author Stanislav Freidin
|
||||
* @author David Lutterkort
|
||||
* @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class ControlLink extends BaseLink {
|
||||
|
||||
|
|
@ -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,10 +165,10 @@ 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 state the current page state
|
||||
* @param parent the parent element
|
||||
*/
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -38,15 +38,15 @@ import com.arsdigita.xml.Element;
|
|||
* @version $Id: SimpleComponent.java 1498 2007-03-19 16:22:15Z apevec $
|
||||
*/
|
||||
public class SimpleComponent extends Completable
|
||||
implements Component, Cloneable {
|
||||
implements Component, Cloneable {
|
||||
|
||||
private boolean m_locked;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
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,12 +93,10 @@ 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
|
||||
* @param p
|
||||
*/
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
|
|
@ -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.
|
||||
*
|
||||
* @param state the current page state
|
||||
* @throws javax.servlet.ServletException
|
||||
* Does processing that is special to the component receiving the click.
|
||||
*
|
||||
* @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
|
||||
* <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,16 +252,12 @@ 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}.
|
||||
* 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
|
||||
*
|
||||
* @param name attribute name, case insensitive
|
||||
* @param name attribute name, case insensitive
|
||||
* @param value new attribute value
|
||||
*/
|
||||
final protected void setAttribute(String name, String 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,8 +306,9 @@ 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.
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
final protected boolean hasAttributes() {
|
||||
return m_attr != null;
|
||||
|
|
@ -325,15 +329,17 @@ 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
|
||||
|
|
@ -354,7 +361,7 @@ public class SimpleComponent extends Completable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(PageState s, boolean v) {
|
||||
public void setVisible(PageState s, boolean v) {
|
||||
s.setVisible(this, v);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -57,8 +57,10 @@ 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.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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[]{};
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ import org.junit.runners.Parameterized;
|
|||
* public class FooBarTest extends EqualsVerifier {
|
||||
*
|
||||
* @Parameterized.Parameters(name = "{0}")
|
||||
* public static Collection<Class<?>> data() {
|
||||
* return Arrays.asList(new Class<?>[] {
|
||||
* public static Collection<Class<?>> data() {
|
||||
* return Arrays.asList(new Class<?>[] {
|
||||
* Foo.class,
|
||||
* Bar.class
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* public FooBarTest(final Class<?> entityClass) {
|
||||
* public FooBarTest(final Class<?> entityClass) {
|
||||
* super(entityClass);
|
||||
* }
|
||||
* }
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ import java.lang.reflect.Modifier;
|
|||
* @RunWith(Parameterized.class)
|
||||
* @Category(UnitTest.class) public class FooBarTest extends ToStringVerifier {
|
||||
*
|
||||
* @Parameterized.Parameters(name = "{0}") public static Collection<Class<?>> data() {
|
||||
* return Arrays.asList(new Class<?>[] { Foo.class, Bar.class });
|
||||
* @Parameterized.Parameters(name = "{0}") public static Collection<Class<?>> data() {
|
||||
* return Arrays.asList(new Class<?>[] { Foo.class, Bar.class });
|
||||
* }
|
||||
*
|
||||
* public FooBarTest(final Class<?> entityClass) {
|
||||
* public FooBarTest(final Class<?> entityClass) {
|
||||
* super(entityClass);
|
||||
* }
|
||||
* }
|
||||
|
|
|
|||
Loading…
Reference in New Issue