You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/06 23:32:59 UTC
svn commit: r168663 - in /incubator/beehive/trunk/netui/src:
tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/
tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/
util/org/apache/beehive/netui/util/iterator/
Author: ekoneil
Date: Fri May 6 14:32:58 2005
New Revision: 168663
URL: http://svn.apache.org/viewcvs?rev=168663&view=rev
Log:
NetUI Javadoc.
BB: self
DRT: NetUI pass
Modified:
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateCodec.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridURLBuilder.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/RenderPager.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/ArrayIterator.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/AtomicObjectIterator.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/EnumerationIterator.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/IteratorFactory.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/MapIterator.java
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateCodec.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateCodec.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateCodec.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateCodec.java Fri May 6 14:32:58 2005
@@ -20,32 +20,81 @@
import javax.servlet.ServletRequest;
/**
- *
+ * <p>
+ * This abstract base class acts as a service that exposes state information to a
+ * data grid.
+ * </p>
+ * <p>
+ * Implementations of the DataGridStateCodec should be request scoped and are not
+ * meant to be serialized. Implementations can hold references to the {@link ServletRequest}.
+ * In order to maintain a data grid's state across a request in a Java object,
+ * the {@link DataGridState} object should be used.
+ * </p>
*/
public abstract class DataGridStateCodec {
private ServletRequest _request;
private String _gridName;
+ /**
+ * Set the {@link ServletRequest}. The ServletRequest can be used by implementations to
+ * discover information contained in request URL or searched for request attributes.
+ *
+ * @param request the current request
+ */
public void setServletRequest(ServletRequest request) {
_request = request;
}
+ /**
+ * Get the current servlet request with which this DataGridStateCodec is associated.
+ *
+ * @return the {@link ServletRequest}
+ */
public ServletRequest getServletRequest() {
return _request;
}
+ /**
+ * Set the data grid name with which this DataGridStateCodec is associated.
+ *
+ * @param gridName the data grid's name
+ */
public void setGridName(String gridName) {
_gridName = gridName;
}
+ /**
+ * Get the data grid name with which this DataGridStateCodec is associated.
+ *
+ * @return the data grid's name
+ */
public String getGridName() {
return _gridName;
}
+ /**
+ * Get the {@link DataGridState} for a data grid. This object contains the state
+ * which the data grid will use during rendering.
+ *
+ * @return the current {@link DataGridState} object
+ */
public abstract DataGridState getDataGridState();
+ /**
+ * Set the @{link DataGridState} object. This allows a client to apply a prior
+ * {@link DataGridState} object in order to explicitly set the data grid's state
+ * to a previously create set of objects.
+ *
+ * @param state the new {@link DataGridState}
+ */
public abstract void setDataGridState(DataGridState state);
+ /**
+ * Get a {@link DataGridURLBuilder} which can build be used to build URLs for
+ * a data grid's current state.
+ *
+ * @return the {@link DataGridURLBuilder} for the data grid's state
+ */
public abstract DataGridURLBuilder getDataGridURLBuilder();
}
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java Fri May 6 14:32:58 2005
@@ -25,18 +25,42 @@
import org.apache.beehive.netui.util.Bundle;
/**
- *
+ * <p>
+ * Factory class used to construct instances of {@link DataGridState} objects. This
+ * class is used by the data grid and other clients to obtain the state for a data grid
+ * with a given name.
+ * </p>
+ * <p>
+ * Data grid state information is scoped by a unique data grid String name. This name
+ * should be unique for a particular scope in a request. For all factory methods that
+ * take a data grid name as a parameter, the value of the <code>name</code> attribute
+ * should match the value of the
+ * {@link org.apache.beehive.netui.tags.databinding.datagrid.DataGrid#setName(String)}
+ * attribute for the data grid whose state to lookup.
+ * </p>
*/
public final class DataGridStateFactory {
private static final String KEY = DataGridStateFactory.class.getName() + "REQUEST_KEY";
private static final DataGridConfig DEFAULT_DATA_GRID_CONFIG = DataGridConfigFactory.getInstance();
+ /**
+ * Get an instance of a DataGridStateFactory given a {@link JspContext}.
+ *
+ * @param jspContext the current {@link JspContext}
+ * @return an instance of the factory
+ */
public static final DataGridStateFactory getInstance(JspContext jspContext) {
assert jspContext instanceof PageContext;
return getInstance(((PageContext)jspContext).getRequest());
}
+ /**
+ * Get an instance of a DataGridStateFactory given a {@link ServletRequest}.
+ *
+ * @param request the current {@link ServletRequest}
+ * @return an instance of the factory
+ */
public static final DataGridStateFactory getInstance(ServletRequest request) {
Object obj = request.getAttribute(KEY);
if(obj != null) {
@@ -58,14 +82,35 @@
_cache = new HashMap/*<String, DataGridStateCodec>*/();
}
+ /**
+ * <p>
+ * Lookup a {@link DataGridState} object given a data grid identifier.
+ * </p>
+ * <p>
+ * This method will use the default {@link DataGridConfig} object when returning a data grid specific
+ * implementation of the {@link DataGridState} object. In order to specify a {@link DataGridConfig},
+ * the {@link DataGridStateFactory#getDataGridState(String, DataGridConfig)} can be supplied
+ * with a specific data grid configuration.
+ * </p>
+ *
+ * @param name the name of a data grid.
+ * @return the {@link DataGridState} for the data grid with the given name
+ */
public final DataGridState getDataGridState(String name) {
return getDataGridState(name, DEFAULT_DATA_GRID_CONFIG);
}
- public final DataGridURLBuilder getDataGridURLBuilder(String name) {
- return getDataGridURLBuilder(name, DEFAULT_DATA_GRID_CONFIG);
- }
-
+ /**
+ * <p>
+ * Lookup a {@link DataGridState} object given a data grid identifier and a specific
+ * {@link DataGridConfig} object.
+ * </p>
+ *
+ * @param name the name of the data grid
+ * @param config the {@link DataGridConfig} object to use when creating the
+ * grid's {@link DataGridState} object.
+ * @return
+ */
public final DataGridState getDataGridState(String name, DataGridConfig config) {
if(config == null)
throw new IllegalArgumentException(Bundle.getErrorString("DataGridStateFactory_nullDataGridConfig"));
@@ -75,6 +120,35 @@
return state;
}
+ /**
+ * <p>
+ * Lookup a {@link DataGridURLBuilder} object given a data grid identifier.
+ * </p>
+ * <p>
+ * This method will use the default {@link DataGridConfig} object when returning a data grid specific
+ * implementation of the {@link DataGridURLBuilder} object. In order to specify a {@link DataGridConfig},
+ * the {@link DataGridStateFactory#getDataGridURLBuilder(String, DataGridConfig)} can be supplied
+ * with a specific data grid configuration.
+ * </p>
+ *
+ * @param name the name of the data grid
+ * @return the {@link DataGridURLBuilder} for the data grid with the given name
+ */
+ public final DataGridURLBuilder getDataGridURLBuilder(String name) {
+ return getDataGridURLBuilder(name, DEFAULT_DATA_GRID_CONFIG);
+ }
+
+ /**
+ * <p>
+ * Lookup a {@link DataGridURLBuilder} object given a data grid identifier and a specific
+ * {@link DataGridConfig} object.
+ * </p>
+ *
+ * @param name the name of the data grid
+ * @param config the {@link DataGridConfig} object to use when creating the
+ * grid's {@link DataGridURLBuilder} object.
+ * @return
+ */
public final DataGridURLBuilder getDataGridURLBuilder(String name, DataGridConfig config) {
if(config == null)
throw new IllegalArgumentException(Bundle.getErrorString("DataGridStateFactory_nullDataGridConfig"));
@@ -84,6 +158,16 @@
return builder;
}
+ /**
+ * <p>
+ * Convenience method that allows a {@link DataGridState} object from a client to
+ * be attached to the factory. This allows subsequent calls to retrieve this same {@link DataGridState}
+ * instance.
+ * </p>
+ *
+ * @param name the name of the data grid
+ * @param state the {@link DataGridState} object to attach
+ */
public final void attachDataGridState(String name, DataGridState state) {
DataGridStateCodec codec = lookupCodec(name, DEFAULT_DATA_GRID_CONFIG);
codec.setDataGridState(state);
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridURLBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridURLBuilder.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridURLBuilder.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/DataGridURLBuilder.java Fri May 6 14:32:58 2005
@@ -20,23 +20,92 @@
import java.util.Map;
/**
- *
+ * <p>
+ * This abstract class provides methods that are used to build maps of URL parameters
+ * containing current ahd future data grid state. These are useful for building
+ * anchors and other kinds of requests that when clicked / submitted can move to
+ * the next or previous page of data or change the state of sorts or filters for
+ * a data grid.
+ * </p>
+ * <p>
+ * Subclasses are free to implement the contents of the parameter map with whatever
+ * parameter key / values that make sense for a particular data grid. For example,
+ * some data grids may encode sort, filter, and paging information in the URL. Others
+ * may add information about row selection and not add sort / filter parameters. Be
+ * sure to check the documentation for a specific DataGridURLBuilder subclass to
+ * find out what specific parameters are available in the parameter maps.
+ * </p>
+ * <p>
+ * Parameter maps produced by methods on this class should contain key / value pairs
+ * where the key is of type <code>String</code> and the values are of type
+ * <code>String[]</code>. The parameter maps should also include all of the
+ * additional "current" URL parameters in order to maintain the "current" view
+ * state and modifying only state associated with a single data grid. Subclasses are
+ * free to change this behavior.
+ * </p>
*/
public abstract class DataGridURLBuilder {
+ /**
+ * Get a {@link Map} containing the current state of the data grid.
+ * @return the parameter map
+ */
public abstract Map getQueryParams();
+ /**
+ * Get a parameter map that contains the grid's current state with a
+ * value that will set the current to the first page.
+ *
+ * @return the parameter map
+ */
public abstract Map getQueryParamsForFirstPage();
+ /**
+ * Get a parameter map that contains the grid's current state with a
+ * value that will set the current page to the previous page.
+ *
+ * @return the parameter map
+ */
public abstract Map getQueryParamsForPreviousPage();
+ /**
+ * Get a parameter map that contains the grid's current state with a
+ * value that will set the current page to the next page.
+ *
+ * @return the parameter map
+ */
public abstract Map getQueryParamsForNextPage();
+ /**
+ * Get a parameter map that contains the grid's current state with a
+ * value that will set the current page to the last page.
+ *
+ * @return the parameter map
+ */
public abstract Map getQueryParamsForLastPage();
+ /**
+ * Get a String array that contains the values which can be used to
+ * reach any page in the data grid.
+ *
+ * @return an array of the query parameter values for each page
+ */
public abstract String[] getPagerParamValues();
+ /**
+ * Get the String for the pager query parameter key.
+ *
+ * @return the query parameter key for accessing the current page from the URL
+ */
public abstract String getPagerRowQueryParamKey();
+ /**
+ * Get a parameter map that contains the grid's current state with the
+ * sort matching the given <code>sortExpression</code> switched to the
+ * next available sort direction.
+ *
+ * @param sortExpression the sort expression whose sort value to change
+ * @return the parameter map
+ */
public abstract Map buildSortQueryParamsMap(String sortExpression);
}
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java Fri May 6 14:32:58 2005
@@ -33,7 +33,7 @@
import org.apache.beehive.netui.util.logging.Logger;
/**
- *
+ * Abstract base class that provides support for rendering HTML table cells to tag subclasses.
*/
public abstract class AbstractCell
extends AbstractDataGridHtmlTag {
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java Fri May 6 14:32:58 2005
@@ -33,8 +33,15 @@
import org.apache.beehive.netui.tags.IHtmlI18n;
/**
- * @jsptagref.tagdescription Renders a column of images in a data grid.
- * @netui:tag name="imageCell" description="Renders a column of images in a NetUI data grid" body-content="scriptless"
+ * Data grid cell that renders an HTML <image> tag containing the tag's <code>source</code> attribute. The
+ * span cell is rendered inside of an HTML table <td>. The image cell supports various nested tags including
+ * those that augment the available attribute set via the NetUI {@link org.apache.beehive.netui.tags.IAttributeConsumer}
+ * interface.
+ * </p>
+ *
+ * @jsptagref.tagdescription Data grid cell that renders an HTML <image> tag with the image source specified by
+ * the tag's <code>source</code> attribute.
+ * @netui:tag name="imageCell" description="" body-content="scriptless"
*/
public class ImageCell
extends AbstractHtmlTableCell
@@ -46,135 +53,140 @@
private ImageCellModel _imageCellModel = new ImageCellModel();
private ImageTag.State _imageState = _imageCellModel.getImageState();
+ /**
+ * The name of this tag; this value is used for error reporting.
+ *
+ * @return the String name of this tag
+ */
public String getTagName() {
return "ImageCell";
}
/**
- * Sets the onClick javascript event.
+ * Sets the onClick javascript event on the image tag.
*
* @param onClick - the onClick event.
- * @jsptagref.attributedescription The onClick JavaScript event.
+ * @jsptagref.attributedescription The onClick javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onClick</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onClick JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onClick javascript event on the image tag."
*/
public void setOnClick(String onClick) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONCLICK, onClick);
}
/**
- * Sets the onDblClick javascript event.
+ * Sets the onDblClick javascript event on the image tag.
*
* @param onDblClick - the onDblClick event.
- * @jsptagref.attributedescription The onDblClick JavaScript event.
+ * @jsptagref.attributedescription The onDblClick javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onDblClick</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onDblClick JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onDblClick javascript event on the image tag."
*/
public void setOnDblClick(String onDblClick) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONDBLCLICK, onDblClick);
}
/**
- * Sets the onKeyDown javascript event.
+ * Sets the onKeyDown javascript event on the image tag.
*
* @param onKeyDown - the onKeyDown event.
- * @jsptagref.attributedescription The onKeyDown JavaScript event.
+ * @jsptagref.attributedescription The onKeyDown javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onKeyDown</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onKeyDown JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onKeyDown javascript event on the image tag."
*/
public void setOnKeyDown(String onKeyDown) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONKEYDOWN, onKeyDown);
}
/**
- * Sets the onKeyUp javascript event.
+ * Sets the onKeyUp javascript event on the image tag.
*
* @param onKeyUp - the onKeyUp event.
- * @jsptagref.attributedescription The onKeyUp JavaScript event.
+ * @jsptagref.attributedescription The onKeyUp javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onKeyUp</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onKeyUp JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onKeyUp javascript event on the image tag."
*/
public void setOnKeyUp(String onKeyUp) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONKEYUP, onKeyUp);
}
/**
- * Sets the onKeyPress javascript event.
+ * Sets the onKeyPress javascript event on the image tag.
*
* @param onKeyPress - the onKeyPress event.
- * @jsptagref.attributedescription The onKeyPress JavaScript event.
+ * @jsptagref.attributedescription The onKeyPress javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onKeyPress</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onKeyPress JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onKeyPress javascript event on the image tag."
*/
public void setOnKeyPress(String onKeyPress) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONKEYPRESS, onKeyPress);
}
/**
- * Sets the onMouseDown javascript event.
+ * Sets the onMouseDown javascript event on the image tag.
*
* @param onMouseDown - the onMouseDown event.
- * @jsptagref.attributedescription The onMouseDown JavaScript event.
+ * @jsptagref.attributedescription The onMouseDown javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onMouseDown</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onMouseDown JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onMouseDown javascript event on the image tag."
*/
public void setOnMouseDown(String onMouseDown) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEDOWN, onMouseDown);
}
/**
- * Sets the onMouseUp javascript event.
+ * Sets the onMouseUp javascript event on the image tag.
*
* @param onMouseUp - the onMouseUp event.
- * @jsptagref.attributedescription The onMouseUp JavaScript event.
+ * @jsptagref.attributedescription The onMouseUp javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onMouseUp</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onMouseUp JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onMouseUp javascript event on the image tag."
*/
public void setOnMouseUp(String onMouseUp) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEUP, onMouseUp);
}
/**
- * Sets the onMouseMove javascript event.
+ * Sets the onMouseMove javascript event on the image tag.
*
* @param onMouseMove - the onMouseMove event.
- * @jsptagref.attributedescription The onMouseMove JavaScript event.
+ * @jsptagref.attributedescription The onMouseMove javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onMouseMove</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onMouseMove JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onMouseMove javascript event on the image tag."
*/
public void setOnMouseMove(String onMouseMove) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEMOVE, onMouseMove);
}
/**
- * Sets the onMouseOut javascript event.
+ * Sets the onMouseOut javascript event on the image tag.
*
* @param onMouseOut - the onMouseOut event.
- * @jsptagref.attributedescription The onMouseOut JavaScript event.
+ * @jsptagref.attributedescription The onMouseOut javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onMouseOut</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOut JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOut javascript event on the image tag."
*/
public void setOnMouseOut(String onMouseOut) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEOUT, onMouseOut);
}
/**
- * Sets the onMouseOver javascript event.
+ * Sets the onMouseOver javascript event on the image tag.
*
* @param onMouseOver - the onMouseOver event.
- * @jsptagref.attributedescription The onMouseOver JavaScript event.
+ * @jsptagref.attributedescription The onMouseOver javascript event on the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_onMouseOver</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOver JavaScript event."
+ * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOver javascript event on the image tag."
*/
public void setOnMouseOver(String onMouseOver) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEOVER, onMouseOver);
@@ -238,13 +250,12 @@
}
/**
- * Sets the lang attribute for the HTML element.
+ * Sets the dir attribute for the HTML image tag.
* @param dir
- * @jsptagref.attributedescription The dir.
+ * @jsptagref.attributedescription The dir for the image tag.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_dir</i>
- * @netui:attribute required="false" rtexprvalue="true"
- * description="The dir."
+ * @netui:attribute required="false" rtexprvalue="true" description="The dir attribhte on the image tag."
*/
public void setDir(String dir)
{
@@ -252,10 +263,12 @@
}
/**
+ * Set the image source to render on the HTML image tag.
+ *
* @jsptagref.attributedescription The source of the image to display.
* @jsptagref.databindable Read Only
* @jsptagref.attributesyntaxvalue <i>literal_or_expression_src</i>
- * @netui:attribute required="true" rtexprvalue="true"
+ * @netui:attribute required="true" rtexprvalue="true" description="The image source to render on the HTML image tag"
*/
public void setSrc(String src) {
_imageState.src = src;
@@ -288,84 +301,113 @@
}
/**
- * @jsptagref.attributedescription Integer. The width of the border around the image.
+ * Set the vertical spacing around the image.
+ *
+ * @jsptagref.attributedescription The width of the border around the image.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>integer_border</i>
- * @netui:attribute required="false" rtexprvalue="true"
+ * @netui:attribute required="false" rtexprvalue="true" description="The vertical spacing around the image"
*/
public void setVspace(String vspace) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.VSPACE, vspace);
}
/**
- * @netui:attribute required="false" rtexprvalue="true"
+ * Set the border attribute for the image.
+ *
+ * @jsptagref.attributedescription The border attribute of the image.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>height</i>
+ * @netui:attribute required="false" rtexprvalue="true" description="The border attribute for the image"
*/
public void setBorder(String border) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.BORDER, border);
}
/**
- * @jsptagref.attributedescription Integer. The height of the image to be displayed in pixels.
+ * Set the height of the image to display.
+ *
+ * @jsptagref.attributedescription The height of the image to be displayed.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>integer_height</i>
- * @netui:attribute required="false" rtexprvalue="true"
+ * @netui:attribute required="false" rtexprvalue="true" description="The height attribute for the image."
*/
public void setHeight(String height) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.HEIGHT, height);
}
/**
- * @jsptagref.attributedescription Integer. The width of the image to be displayed in pixels.
+ * Set the width of the image to display.
+ *
+ * @jsptagref.attributedescription The width of the image to be displayed.
* @jsptagref.databindable false
- * @jsptagref.attributesyntaxvalue <i>integer_width</i>
- * @netui:attribute required="false" rtexprvalue="true"
+ * @jsptagref.attributesyntaxvalue <i>width</i>
+ * @netui:attribute required="false" rtexprvalue="true" description="The width attribute for the image"
*/
public void setWidth(String width) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.WIDTH, width);
}
/**
- * Sets the property to specify the longdesc of the image.
+ * Sets the property to specify the longdesc of the image tag.
*
* @param longdesc - the longdesc attribute
- * @jsptagref.attributedescription The alternative text of the image
+ * @jsptagref.attributedescription The alternative text of the image tag
* @jsptagref.databindable Read Only
* @jsptagref.attributesyntaxvalue <i>string_longdesc</i>
- * @netui:attribute required="false" rtexprvalue="true" description="The longdesc of the image."
+ * @netui:attribute required="false" rtexprvalue="true" description="The longdesc of the image tag."
*/
public void setLongdesc(String longdesc) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.LONGDESC, longdesc);
}
/**
- * Sets the property to specify the alt text of the image.
+ * Sets the property to specify the alt text of the image tag.
*
* @param alt - the image alignment.
- * @jsptagref.attributedescription The alternative text of the image
+ * @jsptagref.attributedescription The alternative text of the image tag
* @jsptagref.databindable Read Only
* @jsptagref.attributesyntaxvalue <i>string_alt</i>
- * @netui:attribute required="false" rtexprvalue="true"
- * description="The alternative text of the image."
+ * @netui:attribute required="false" rtexprvalue="true" description="The alternative text for the image tag."
*/
public void setAlt(String alt) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.ALT, alt);
}
/**
- * Set the name of the tagId for the image.
+ * Set the name of the tagId for the image tag.
*
- * @param tagId - the the name of the tagId for the image.
+ * @param tagId - the the name of the tagId for the image tag.
* @jsptagref.attributedescription The tagId.
* @jsptagref.databindable false
* @jsptagref.attributesyntaxvalue <i>string_tagId</i>
* @netui:attribute required="false" rtexprvalue="true"
- * description="String value. Sets the id (or name) attribute of the rendered HTML tag. "
+ * description="String value. Sets the id (or name) attribute of the rendered HTML image tag."
*/
public void setTagId(String tagId)
throws JspException {
applyIndexedTagId(_imageState, tagId);
}
+ /**
+ * <p>
+ * Implementation of {@link org.apache.beehive.netui.tags.IAttributeConsumer} interface. This
+ * allows a page author to add additional attributes to the HTML rendered by this tag. The attribute
+ * facets which can be consumed include:
+ * <ul>
+ * <li><code>image</code> -- attributes set using this facet will be rendered as HTML attributes on the
+ * rendered HTML <image> tag.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * This tag also accepts facets supported by {@link AbstractHtmlTableCell#setAttribute(String, String, String)}
+ * </p>
+ *
+ * @param name the name of the attribute
+ * @param value the value of the attribute
+ * @param facet the facet for the attribute; this value must be match one of the facets supported by the JSP tags
+ * @throws JspException thrown when the given facet String is not recognized as a valid facet name
+ */
public void setAttribute(String name, String value, String facet)
throws JspException {
if(facet == null || facet.equals(IMAGE_FACET_NAME))
@@ -374,6 +416,12 @@
super.setAttribute(name, value, facet);
}
+ /**
+ * Render the cell's contents. This method implements support for executing the image cell's decorator.
+ *
+ * @param appender the {@link AbstractRenderAppender} used to collect the rendered output
+ * @param jspFragmentOutput the String result of having evaluated the image cell's {@link javax.servlet.jsp.tagext.JspFragment}
+ */
protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
/* render any JavaScript needed to support framework features */
if (_imageState.id != null) {
@@ -388,5 +436,4 @@
protected CellModel internalGetCellModel() {
return _imageCellModel;
}
-}
-
+}
\ No newline at end of file
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/RenderPager.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/RenderPager.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/RenderPager.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/RenderPager.java Fri May 6 14:32:58 2005
@@ -23,17 +23,50 @@
import org.apache.beehive.netui.util.Bundle;
/**
- * @jsptagref.tagdescription Renders a pager in a specific spot inside of a data grid.
+ * <p>
+ * Data grid tag used to render the grid's pager at a specific location in a JSP. By default,
+ * the data grid renders its pager in a fixed location. In order to change the location of the pager,
+ * this tag can be used to move the rendered pager or to render multiple pagers. For example, to render
+ * a pager in both the grid's header and footer, the tag can be used as:
+ * <pre>
+ * <netui-data:header>
+ * ....
+ * <netui-data;renderPager/>
+ * ....
+ * </netui-data:header>
+ * <netui-data:footer>
+ * ....
+ * <netui-data;renderPager/>
+ * ....
+ * </netui-data:footer>
+ * </pre>
+ * </p>
+ *
+ * @jsptagref.tagdescription Data grid tag used to render the grid's pager at a specific location in a JSP.
* @netui:tag name="renderPager" body-content="empty"
- * description="Tag for rendering a pager in a specific spot inside of a data grid tag"
+ * description="Data grid tag used to render the grid's pager at a specific location in a JSP."
*/
public class RenderPager
extends AbstractDataGridHtmlTag {
+ /**
+ * The tag's name; this is used for NetUI tag error reporting.
+ *
+ * @return the tag's name
+ */
public String getTagName() {
return "RenderPager";
}
+ /**
+ * <p>
+ * Tag rendering method that renders the data grid's registered
+ * {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.PagerRenderer} into the
+ * page's output.
+ * </p>
+ *
+ * @throws JspException when an error occurs rendering or no {@link DataGridTagModel} can be found.
+ */
public void doTag()
throws JspException {
Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/ArrayIterator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/ArrayIterator.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/ArrayIterator.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/ArrayIterator.java Fri May 6 14:32:58 2005
@@ -36,8 +36,6 @@
public class ArrayIterator
implements Iterator {
- private static final Logger logger = Logger.getInstance(ArrayIterator.class);
-
/**
* The array object supplied to the iterator
*/
Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/AtomicObjectIterator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/AtomicObjectIterator.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/AtomicObjectIterator.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/AtomicObjectIterator.java Fri May 6 14:32:58 2005
@@ -44,8 +44,7 @@
public boolean hasNext() {
if(_nextCalled || _object == null)
return false;
- else
- return true;
+ else return true;
}
public Object next() {
Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/EnumerationIterator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/EnumerationIterator.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/EnumerationIterator.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/EnumerationIterator.java Fri May 6 14:32:58 2005
@@ -24,7 +24,7 @@
import org.apache.beehive.netui.util.Bundle;
/**
- * An {@link java.util.Iterator} implementation an {@link java.util.Enumeration}.
+ * This class implements the {@link java.util.Iterator} interface for an {@link java.util.Enumeration}.
*/
public class EnumerationIterator
implements Iterator {
@@ -38,15 +38,13 @@
public boolean hasNext() {
if(_enum == null)
return false;
- else
- return _enum.hasMoreElements();
+ else return _enum.hasMoreElements();
}
public Object next() {
if(_enum == null || hasNext() == false)
throw new NoSuchElementException(Bundle.getErrorString("IteratorFactory_Iterator_noSuchElement"));
- else
- return _enum.nextElement();
+ else return _enum.nextElement();
}
public void remove() {
Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/IteratorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/IteratorFactory.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/IteratorFactory.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/IteratorFactory.java Fri May 6 14:32:58 2005
@@ -32,26 +32,29 @@
import org.apache.beehive.netui.util.logging.Logger;
/**
- * <code>IteratorFactory</code> provides a way to create an
- * <code>Iterator</code> for different kinds of objects. The supported types
- * are:
+ * <p>
+ * This class provides a factory that can create an {@link Iterator} for various types
+ * of Java objects. Supported types include:
* <ul>
- * <li><code>java.util.Iterator</code></li>
- * <li><code>java.util.Collection</code></li>
- * <li><code>java.util.Map</code></li>
- * <li><code>javax.sql.RowSet</code></li>
- * <li><code>java.util.Enumeration</code></li>
+ * <li>{@link java.util.Iterator</li>
+ * <li>{@link java.util.Collection}</li>
+ * <li>{@link java.util.Map}</li>
+ * <li>{@link java.sql.ResultSet}</li>
+ * <li>{@link javax.sql.RowSet}</li>
+ * <li>{@link java.util.Enumeration}</li>
* <li>Any Java Object array</li>
* </ul>
* <p/>
- * If a <code>java.util.Iterator</code> is supplied, the
- * <code>Iterator</code> will simply be returned to the caller.
- * <p/>
+ * <p>
* If an object type not listed above is supplied the object will be wrapped in
- * an iterator that has a single item, the provided object.
+ * an iterator that contains only the provided object.
+ * </p>
*/
public class IteratorFactory {
+ /**
+ * Convenience field for accessing an empty {@link Iterator}.
+ */
public static final Iterator EMPTY_ITERATOR = Collections.EMPTY_LIST.iterator();
private static final Logger LOGGER = Logger.getInstance(IteratorFactory.class);
@@ -74,21 +77,16 @@
}
/**
- * Create a new <code>Iterator</code> for the supplied object. If the
- * passed object is null, this method will return null;
+ * Create a new {@link Iterator} for the supplied object.
*
* @param object the object to build an iterator from
- * @return an iterator for the supplied object or <code>null</code>
+ * @return an {@link Iterator} for the <code>object</code> or <code>null</code> if the value is null.
*/
public static final Iterator createIterator(Object object) {
- if(LOGGER.isDebugEnabled())
- LOGGER.debug("Trying to make an iterator for class: " + (object == null ? "null" : object.getClass().getName()));
+ LOGGER.debug("Create an iterator for class: " + (object == null ? "null" : object.getClass().getName()));
- if(object == null) {
- // if the object is null we will return a null. The caller will
- // have to grab the EMPTY_ITERATOR if it wants to handle this.
+ if(object == null)
return null;
- }
if(object instanceof Iterator) {
return (Iterator)object;
@@ -160,24 +158,17 @@
Class type = Class.forName(className);
plant = (IteratorPlant)type.newInstance();
} catch(ClassNotFoundException cnf) {
- if(LOGGER.isWarnEnabled())
- LOGGER.warn("Could not create an IteratorPlant for type \"" + className + "\" because the implementation class could not be found.");
-
+ LOGGER.warn("Could not create an IteratorPlant for type \"" + className + "\" because the implementation class could not be found.");
continue;
} catch(Exception e) {
assert e instanceof InstantiationException || e instanceof IllegalAccessException;
-
- if(LOGGER.isWarnEnabled())
- LOGGER.warn("Could not create an IteratorPlant for type \"" + className + "\" because an error occurred creating the plant. Cause: " + e, e);
+ LOGGER.warn("Could not create an IteratorPlant for type \"" + className + "\" because an error occurred creating the plant. Cause: " + e, e);
continue;
}
if(ITERATOR_FACTORIES.containsKey(name)) {
- if(LOGGER.isWarnEnabled())
- LOGGER.warn("Overwriting a previously defined IteratorPlant named \"" + name +
- "\" with a new IteratorPlant of type \"" + className + "\"");
- } else if(LOGGER.isInfoEnabled())
- LOGGER.info("Adding an IteratorPlant named \"" + name + "\" with implementation \"" + className + "\"");
+ LOGGER.warn("Overwriting a previously defined IteratorPlant named \"" + name + "\" with a new IteratorPlant of type \"" + className + "\"");
+ } else LOGGER.info("Adding an IteratorPlant named \"" + name + "\" with implementation \"" + className + "\"");
ITERATOR_FACTORIES.put(name, plant);
}
Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/MapIterator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/MapIterator.java?rev=168663&r1=168662&r2=168663&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/MapIterator.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/iterator/MapIterator.java Fri May 6 14:32:58 2005
@@ -24,9 +24,8 @@
import org.apache.beehive.netui.util.Bundle;
/**
- * <code>MapIterator</code> provides an <code>Iterator</code> over map values.
- * <code>MapIterator</code> iterates over the sequence of values stored in the
- * map.
+ * This class implements the {@link Iterator} interface for accessing the set of
+ * values stored in a {@link Map}.
*/
public class MapIterator
implements Iterator {
@@ -36,6 +35,10 @@
*/
private Iterator _mapIterator = null;
+ /**
+ * Create the {@link Iterator} for the given {@link Map}
+ * @param map
+ */
public MapIterator(Map map) {
if(map == null)
return;
@@ -43,18 +46,32 @@
_mapIterator = map.values().iterator();
}
+ /**
+ * Advance to the next value in the {@link Map}.
+ *
+ * @return <code>true</code> if there is a next item; <code>false</code> otherwise
+ */
public boolean hasNext() {
if(_mapIterator == null)
return false;
else return _mapIterator.hasNext();
}
+ /**
+ * Advance to the next item in the {@link Map}
+ *
+ * @return the next item
+ * @throws NoSuchElementException if the map has no more elements
+ */
public Object next() {
if(_mapIterator == null)
throw new NoSuchElementException(Bundle.getErrorString("IteratorFactory_Iterator_noSuchElement"));
else return _mapIterator.next();
}
+ /**
+ * Remove the current item in the iterator.
+ */
public void remove() {
if(_mapIterator == null)
throw new UnsupportedOperationException(Bundle.getErrorString("IteratorFactory_Iterator_removeUnsupported", new Object[]{this.getClass().getName()}));