From: <pb...@fe...> - 2012-12-16 20:22:56
|
Author: pboy Date: 2012-12-16 20:22:48 +0000 (Sun, 16 Dec 2012) New Revision: 2391 Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java releases/2.0.0/ccm-navigation/src/WEB-INF/navigation/templates.txt releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionDefinition.java releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/AbstractObjectList.java releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java Log: Added log date format. (backport r2388) (on behalf of quasimodo) Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java 2012-12-16 20:22:48 UTC (rev 2391) @@ -72,7 +72,7 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { - super.validate(e); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 20:22:48 UTC (rev 2391) @@ -182,4 +182,4 @@ localize()); } } -} \ No newline at end of file +} Modified: releases/2.0.0/ccm-navigation/src/WEB-INF/navigation/templates.txt =================================================================== --- releases/2.0.0/ccm-navigation/src/WEB-INF/navigation/templates.txt 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-navigation/src/WEB-INF/navigation/templates.txt 2012-12-16 20:22:48 UTC (rev 2391) @@ -1,4 +1,4 @@ -Navigation Default Index Page,Default Navigation Index Page ordering items in ascending order,/templates/ccm-ldn-navigation/navigation/nav-default.jsp -Navigation Recent Items,List of items ordered with most recent first,/templates/ccm-ldn-navigation/navigation/nav-recent.jsp -Navigation A-Z Items,List of items paginated as A-Z,/templates/ccm-ldn-navigation/navigation/nav-atoz.jsp -Navigation Demo Items Page,Demo items page,/templates/ccm-ldn-navigation/navigation/nav-demo.jsp +Navigation Default Index Page,Default Navigation Index Page ordering items in ascending order,/templates/ccm-navigation/navigation/nav-default.jsp +Navigation Recent Items,List of items ordered with most recent first,/templates/ccm-navigation/navigation/nav-recent.jsp +Navigation A-Z Items,List of items paginated as A-Z,/templates/ccm-navigation/navigation/nav-atoz.jsp +Navigation Demo Items Page,Demo items page,/templates/ccm-navigation/navigation/nav-demo.jsp Modified: releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionDefinition.java =================================================================== --- releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionDefinition.java 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionDefinition.java 2012-12-16 20:22:48 UTC (rev 2391) @@ -195,6 +195,13 @@ m_properties.add(property); } + /** + * Get a collection of objects from the database defined by model or + * null if the requested object type is invalid + * + * @param model + * @return data collection or null + */ public final DataCollection getDataCollection(NavigationModel model) { Assert.isLocked(this); Modified: releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java =================================================================== --- releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java 2012-12-16 20:22:48 UTC (rev 2391) @@ -105,7 +105,8 @@ /** * Sets the context of the traversal adapter used the render the objects - * if {@link #m_specializeObjects} is set to <code>true</code> + * if {@link #m_specializeObjects} is set to + * <code>true</code> * * @param context The adapter context. */ @@ -125,6 +126,7 @@ /** * @param objects * @param pageNumber current page, starting from 1 + * * @return */ public Element generateXML(DataCollection objects, @@ -140,7 +142,7 @@ // Quasimodo: End Element content = Navigation.newElement("objectList"); - + //Return the empty nav:item & nav:paginator tags. // Quasimodo: Why should I??? There is no need for a paginator if there aren't any elements if (!m_navItems) { @@ -203,9 +205,9 @@ paginator.addAttribute("objectCount", new Long(objectCount).toString()); content.addContent(paginator); - + int index = 0; - while (objects.next()) { + while (objects.next()) { DataObject dobj = objects.getDataObject(); ACSObject object = null; if (m_specializeObjects) { @@ -216,8 +218,8 @@ } else { s_log.debug("Specializing successful."); } - } - Element item = Navigation.newElement(content, "item"); + } + Element item = Navigation.newElement(content, "item"); Iterator attributes = m_attributes.iterator(); while (attributes.hasNext()) { @@ -225,13 +227,13 @@ String[] paths = StringUtils.split(name, '.'); outputValue(item, dobj, name, paths, 0); } - + Iterator properties = m_properties.iterator(); while (properties.hasNext()) { DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next(); property.render(objects, item); } - + Element path = Navigation.newElement(item, "path"); path.setText(getStableURL(dobj, object)); //item.addContent(path); @@ -239,9 +241,9 @@ generateItemXML(item, dobj, object, index); index++; - //content.addContent(item); + //content.addContent(item); } - + return content; } @@ -300,12 +302,13 @@ // Quasimodo: BEGIN // Add attributes for date and time Locale negLocale = com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale(); - DateFormat dateFormatter = DateFormat.getDateInstance( - DateFormat.MEDIUM, negLocale); - DateFormat timeFormatter = DateFormat.getTimeInstance( - DateFormat.SHORT, negLocale); + DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, negLocale); + DateFormat longDateFormatter = DateFormat.getDateInstance(DateFormat.LONG, negLocale); + DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, negLocale); attribute.addAttribute("date", dateFormatter.format(date)); + attribute.addAttribute("longDate", longDateFormatter.format(date)); attribute.addAttribute("time", timeFormatter.format(date)); + attribute.addAttribute("monthName", calDate.getDisplayName(Calendar.MONTH, Calendar.LONG, negLocale)); // Quasimodo: END } Modified: releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/AbstractObjectList.java =================================================================== --- releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/AbstractObjectList.java 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/AbstractObjectList.java 2012-12-16 20:22:48 UTC (rev 2391) @@ -21,19 +21,21 @@ import com.arsdigita.kernel.Kernel; import com.arsdigita.navigation.DataCollectionDefinition; import com.arsdigita.navigation.DataCollectionRenderer; - import com.arsdigita.persistence.DataCollection; - import com.arsdigita.persistence.Filter; import com.arsdigita.persistence.FilterFactory; import com.arsdigita.util.Assert; import com.arsdigita.util.UncheckedWrapperException; - import com.arsdigita.xml.Element; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +/** + * Abstract base class for object lists + * + * @author unknown + * @author Sören Bernstein (quasimodo) <sbe...@ze...> + */ public abstract class AbstractObjectList extends AbstractComponent implements ObjectList { @@ -58,6 +60,14 @@ return m_renderer; } + /** + * Get a list of objects from the database which meet a set criteria or + * null if the requested object type is invalid + * + * @param request + * @param response + * @return the object list or null + */ protected DataCollection getObjects(HttpServletRequest request, HttpServletResponse response) { Modified: releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java =================================================================== --- releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java 2012-12-16 20:05:43 UTC (rev 2390) +++ releases/2.0.0/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java 2012-12-16 20:22:48 UTC (rev 2391) @@ -15,22 +15,22 @@ import com.arsdigita.navigation.Navigation; import com.arsdigita.navigation.ui.AbstractObjectList; - import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.Filter; import com.arsdigita.persistence.FilterFactory; - - import com.arsdigita.xml.Element; import java.util.HashMap; import java.util.Iterator; import java.util.Map; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * A complex object list + * + * An object list which will accept SQL filters to customize the content easily. + * + * @author Sören Bernstein <sbe...@qu...> */ public class ComplexObjectList extends AbstractObjectList { @@ -41,42 +41,75 @@ protected Map<String, String> m_customAttributes = new HashMap<String, String>(); + // Getter / Setter + + /** + * Sets a custom name for this list. + * @param name the list name + */ public void setCustomName(String name) { m_customName = name; } + /** + * Gets the costum name for this list. + * @return the list name + */ public String getCustomName() { return m_customName; } /** - * Hinzufügen eines SQL-Filter zur Abfrage - * Verarbeitet einen boolschen Filter, der SQL-konform Formatiert ist. - * Siehe PostgreSQL-Handbuch zur where-Klausel - * @param sqlfilter + * Adds a custom attribute + * + * @param attribute + * @param value */ + public void addCustomAttribute(final String attribute, final String value) { + m_customAttributes.put(attribute, value); + } + + /** + * Gets a custom attribute + * + * @param attribute + * @return + */ + public String getCustomAttribute(final String attribute) { + return m_customAttributes.get(attribute); + } + + + /** + * Add a SQL filter to query. + * This filter can handle wildcards which have to be set with {@link #setParameter(java.lang.String, java.lang.Object)} + * + *See PostgreSQL handbook about where clause + * + * @param sqlfilter the sql filter + */ public void setSQLFilter(String sqlfilter) { m_filter = sqlfilter; } + /** + * Set parameter for for sql filter. + * + * @param parameterName the parameter name of the + * @param value the value attached to the parameter + */ public void setParameter(String parameterName, Object value) { m_filterParameters.put(parameterName, value); } - public String getCustomAttribute(final String attribute) { - return m_customAttributes.get(attribute); - } - - public void addCustomAttribute(final String attribute, final String value) { - m_customAttributes.put(attribute, value); - } - - /* Diese Methode überschreibt die Methode aus der Eltern-Klasse, um - * die SQL-Filter berücksichtigen zu können + /** + * Get all objects for this list. + * + * Overrides the parent class to allow for sql filter */ @Override protected DataCollection getObjects(HttpServletRequest request, @@ -112,7 +145,7 @@ return objects; } - /* Diese Methode wird vom Servlet aufgerufen */ + /* This method will be called by the servlet */ public Element generateXML(HttpServletRequest request, HttpServletResponse response) { Element content = Navigation.newElement("complexObjectList"); |