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/17 17:41:53 UTC
svn commit: r170613 - in
/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui:
databinding/datagrid/runtime/config/ databinding/datagrid/runtime/sql/
databinding/datagrid/runtime/util/ tags/databinding/datagrid/
Author: ekoneil
Date: Tue May 17 08:41:52 2005
New Revision: 170613
URL: http://svn.apache.org/viewcvs?rev=170613&view=rev
Log:
Javadoc fixes.
Also removes an unused (and useless) JSP function "ensureFilters".
BB: self
DRT: Beehive pass
BVT: NetUI pass
Modified:
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultSortStrategy.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfig.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfigFactory.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java
incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultSortStrategy.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultSortStrategy.java?rev=170613&r1=170612&r2=170613&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultSortStrategy.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultSortStrategy.java Tue May 17 08:41:52 2005
@@ -22,18 +22,40 @@
import org.apache.beehive.netui.util.Bundle;
/**
- *
+ * <p>
+ * Default implementation of a {@link SortStrategy}. This class is used by the default data grid config
+ * object to provide a very simple state machine for cycling through sort directions as they
+ * are changed via URLs from a JSP.
+ * </p>
*/
class DefaultSortStrategy
extends SortStrategy {
+ /**
+ * Package protected constructor.
+ */
DefaultSortStrategy() {
}
+ /**
+ * Get the default sort direction -- {@link SortDirection#ASCENDING}
+ * @return the default sort direction
+ */
public SortDirection getDefaultDirection() {
return SortDirection.ASCENDING;
}
+ /**
+ * <p>
+ * Given a sort direction, get the next sort direction. This implements a simple sort machine
+ * that cycles through the sort directions in the following order:
+ * <pre>
+ * SortDirection.NONE > SortDirection.ASCENDING > SortDirection.DESCENDING > repeat
+ * </pre>
+ * </p>
+ * @param direction the current {@link SortDirection}
+ * @return the next {@link SortDirection}
+ */
public SortDirection nextDirection(SortDirection direction) {
if(direction == SortDirection.NONE)
return SortDirection.ASCENDING;
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfig.java?rev=170613&r1=170612&r2=170613&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfig.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfig.java Tue May 17 08:41:52 2005
@@ -18,15 +18,37 @@
package org.apache.beehive.netui.databinding.datagrid.runtime.sql;
/**
- *
+ * <p>
+ * Configuration JavaBean used in conjunction with the {@link SQLSupport} class to configure
+ * the way in which SQL statements are created. This abstract class can be implemented by
+ * subclasses to provide varying ways of configuring these properties.
+ * </p>
*/
public abstract class SQLSupportConfig {
+ /**
+ * Set the quote character used to quote strings types when embedded inside of SQL statements.
+ * @param quoteChar the quote character
+ */
public abstract void setQuoteChar(String quoteChar);
+ /**
+ * Get the quote character used to wrap string types inside of SQL statements.
+ * @return
+ */
public abstract String getQuoteChar();
+ /**
+ * Set a boolean that enables or disables generating an ESCAPE clause when generating a
+ * LIKE clause into a SQL WHERE filter.
+ * @param supportsLikeEscapeClause boolean to support escaping a LIKE clause
+ */
public abstract void setSupportsLikeEscapeClause(boolean supportsLikeEscapeClause);
+ /**
+ * Get a boolean that enables or disables an ESCAPE clause when generating a
+ * LIKE clause in a SQL statement.
+ * @return <code>true</code> if escaping is enabled; <code>false</code> otherwise.
+ */
public abstract boolean getSupportsLikeEscapeClause();
}
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfigFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfigFactory.java?rev=170613&r1=170612&r2=170613&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfigFactory.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/SQLSupportConfigFactory.java Tue May 17 08:41:52 2005
@@ -21,14 +21,31 @@
import java.sql.SQLException;
/**
- *
+ * <p>
+ * Factory used to create {@link SQLSupportConfig} instances. Clients can request either a JavaBean
+ * on which to manually set properties or a SQLSupportConfig object that is populated via
+ * a {@link DatabaseMetaData} object.
+ * </p>
*/
public final class SQLSupportConfigFactory {
+ /**
+ * Create a default {@link SQLSupportConfig} JavaBean.
+ * @return the sql support config JavaBean
+ */
public static final SQLSupportConfig getInstance() {
return new DefaultSQLSupportConfig();
}
+ /**
+ * Create an instance of a {@link SQLSupportConfig} JavaBean that is created from a
+ * {@link DatabaseMetaData} object. The {@link DatabaseMetaData} instance will be
+ * used to set the SQLSupportConfig JavaBean properties based on the metadata
+ * from the database.
+ * @param databaseMetaData the metadata to use to populate the SQLSupportConfig object
+ * @return the SQLSupportConfig object
+ * @throws SQLException if an error is thrown creating the SQLSupportConfig JavaBean
+ */
public static final SQLSupportConfig getInstance(DatabaseMetaData databaseMetaData)
throws SQLException {
SQLSupportConfig config = new DatabaseMetaDataSQLSupportConfig(databaseMetaData);
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java?rev=170613&r1=170612&r2=170613&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java Tue May 17 08:41:52 2005
@@ -30,26 +30,24 @@
import org.apache.beehive.netui.databinding.datagrid.api.sort.SortDirection;
/**
+ * <p>
+ * This class contains utility methods that are callable as JSP functions by page authors. These are used
+ * to provide utility methods that can be accessed via JSP EL for invoking methods on various data grid
+ * state objects.
+ * </p>
* @netui:jspfunctions
*/
public final class JspFunctions {
- private static final List/*<Filter>*/ DEFAULT_FILTER_LIST;
- private static final Filter DEFAULT_FILTER = DataGridConfigFactory.getInstance().createFilter();
-
- static {
- DEFAULT_FILTER_LIST = new ArrayList/*<Filter>*/();
- DEFAULT_FILTER_LIST.add(DEFAULT_FILTER);
- DEFAULT_FILTER_LIST.add(DEFAULT_FILTER);
- }
-
- private JspFunctions() {
- }
+ private JspFunctions() {}
/**
- * @param sortModel
- * @param sortExpression
- * @return
+ * Given a sort expression, check to see if the sort expression is sorted ascending in a data grid's
+ * {@link SortModel}.
+ * @param sortModel a grid's sort model
+ * @param sortExpression the sort expression
+ * @return return <code>true</code> if a {@link Sort} is found whose sort expression
+ * matches the sort expression given here and whose direction is {@link SortDirection#ASCENDING}.
* @netui:jspfunction name="isSortedAscending"
* signature="boolean isSortedAscending(org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel,java.lang.String)"
*/
@@ -64,9 +62,12 @@
}
/**
- * @param sortModel
- * @param sortExpression
- * @return
+ * Given a sort expression, check to see if the sort expression is sorted descending in a data grid's
+ * {@link SortModel}.
+ * @param sortModel a grid's sort model
+ * @param sortExpression the sort expression
+ * @return return <code>true</code> if a {@link Sort} is found whose sort expression
+ * matches the sort expression given here and whose direction is {@link SortDirection#DESCENDING}.
* @netui:jspfunction name="isSortedDescending"
* signature="boolean isSortedDescending(org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel,java.lang.String)"
*/
@@ -81,9 +82,16 @@
}
/**
- * @param urlBuilder
- * @param sortExpression
- * @return
+ * <p>
+ * Utility method used to build a query parameter map which includes the list of parameters needed to change the
+ * direction of a sort related to the given sort expression. This method uses a {@link DataGridURLBuilder}
+ * instance to call its {@link DataGridURLBuilder#buildSortQueryParamsMap(String)} method from JSP EL.
+ * </p>
+ * @param urlBuilder the data grid URL builder associated with a
+ * {@link org.apache.beehive.netui.databinding.datagrid.api.DataGridState} object that is used to
+ * build lists of query parameters
+ * @param sortExpression the sort expression whose direction to change
+ * @return a {@link Map} of key / value pairs for query parameters
* @netui:jspfunction name="buildQueryParamsMapForSortExpression"
* signature="java.util.Map buildQueryParamsMapForSortExpression(org.apache.beehive.netui.databinding.datagrid.api.DataGridURLBuilder,java.lang.String)"
*/
@@ -92,33 +100,5 @@
return null;
return urlBuilder.buildSortQueryParamsMap(sortExpression);
- }
-
- /**
- * Function that normalizes the data set that is used to render the
- * filter window UI. This function is needed because the NetUI
- * tags require that dataSource expressions evaluate to live values
- * and can't be null.
- *
- * @param jspContext
- * @param attrName
- * @netui:jspfunction name="ensureFilters"
- * signature="void ensureFilters(javax.servlet.jsp.JspContext,java.lang.String)"
- */
- public static void ensureFilters(JspContext jspContext, String attrName) {
- List/*<Filter>*/ filters = (List /*<Filter>*/)jspContext.getAttribute("filters");
- List/*<Filter>*/ pcFilters = new ArrayList/*<Filter>*/();
-
- if(filters == null || filters.size() == 0)
- pcFilters = DEFAULT_FILTER_LIST;
- else if(filters.size() == 1) {
- pcFilters.add(filters.get(0));
- pcFilters.add(DEFAULT_FILTER);
- }
- else pcFilters = filters;
-
- assert pcFilters.size() == 2;
-
- jspContext.setAttribute(attrName, pcFilters);
}
}
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java?rev=170613&r1=170612&r2=170613&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java Tue May 17 08:41:52 2005
@@ -31,17 +31,34 @@
import org.apache.beehive.netui.tags.internal.PageFlowTagUtils;
import org.apache.beehive.netui.util.Bundle;
+/**
+ * <p>
+ * Utility class used for operations related to JSPs.
+ * </p>
+ */
public final class JspUtil {
/* do not construct */
private JspUtil() {
}
+ /**
+ * Attempt to obtain a {@link HttpServletRequest} from a {@link JspContext}.
+ * @param jspContext the jsp context
+ * @return the {@link HttpServletRequest}
+ * @throws IllegalStateException if the {@link JspContext} is unable to provide a {@link HttpServletRequest}
+ */
public static final HttpServletRequest getRequest(JspContext jspContext) {
PageContext pageContext = getPageContext(jspContext);
return (HttpServletRequest)pageContext.getRequest();
}
+ /**
+ * Attempt to convert a {@link JspContext} into a {@link PageContext}.
+ * @param jspContext the jsp context
+ * @return the page context
+ * @throws IllegalStateException if the {@link JspContext} can't be converted into a {@link PageContext}
+ */
public static final PageContext getPageContext(JspContext jspContext) {
if(!(jspContext instanceof PageContext))
throw new IllegalStateException(Bundle.getErrorString("DataGridUtil_IllegalJspContext", new Object[]{(jspContext != null ? jspContext.getClass().getName() : "null")}));
@@ -49,6 +66,20 @@
return (PageContext)jspContext;
}
+ /**
+ * <p>
+ * Utility method used by data grid related classes to create URLs. If both an action name and href are provided,
+ * the action name will be used to construct the URL string.
+ * </p>
+ * @param href the href
+ * @param action the action
+ * @param location the intra page location
+ * @param scope the scope into which to create the URL
+ * @param params a map of parameters to attach to the URL
+ * @param jspContext the jsp context
+ * @return a URL represented as a string. This URL will be correctly encoded by calling {@link HttpServletResponse#encodeURL(String)}
+ * @throws URISyntaxException
+ */
public static final String createURL(String href, String action, String location, String scope, Map params, JspContext jspContext)
throws URISyntaxException {
PageContext pageContext = getPageContext(jspContext);
@@ -75,6 +106,11 @@
return response.encodeURL(uri);
}
+ /**
+ * Get the {@link Locale} from the {@link JspContext}
+ * @param jspContext the jsp context
+ * @return the current locale
+ */
public static final Locale getLocale(JspContext jspContext) {
return InternalUtils.lookupLocale(jspContext);
}
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java?rev=170613&r1=170612&r2=170613&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java Tue May 17 08:41:52 2005
@@ -53,11 +53,12 @@
/**
* <p>
+ * This tag is the top-level data grid tag which renders a data set into an HTML table.
* </p>
* @jsptagref.tagdescription
- *
* @netui:tag name="dataGrid" body-content="scriptless"
- * description="Top-level data grid tag for the data grid tag set. Renders a pageable, sortable, and filterable HTML table containing a data set"
+ * description="Top-level data grid tag for the data grid tag set.
+ * Renders a pageable, sortable, and filterable HTML table containing a data set"
*/
public class DataGrid
extends AbstractDataGridHtmlTag