You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2006/01/04 11:11:36 UTC
svn commit: r365878 - in /maven/continuum/trunk/continuum-webapp/src/main:
java/org/apache/maven/continuum/web/view/commons/
java/org/apache/maven/continuum/web/view/commons/DateCell.java
resources/extremecomponents.properties
Author: evenisse
Date: Wed Jan 4 02:11:30 2006
New Revision: 365878
URL: http://svn.apache.org/viewcvs?rev=365878&view=rev
Log:
Add date formatter for extremecomponents table
Added:
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties (with props)
Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java?rev=365878&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java Wed Jan 4 02:11:30 2006
@@ -0,0 +1,66 @@
+package org.apache.maven.continuum.web.view.commons;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Calendar;
+import java.util.Locale;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import org.extremecomponents.table.bean.Column;
+import org.extremecomponents.table.cell.DisplayCell;
+import org.extremecomponents.table.core.BaseModel;
+import org.extremecomponents.util.ExtremeUtils;
+
+/**
+ * Used in Project view
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class DateCell
+ extends DisplayCell
+{
+ public void init(BaseModel model, Column column)
+ {
+ super.init(model, column);
+
+ String valueString = column.getPropertyValueAsString();
+
+ if ( !StringUtils.isEmpty( valueString ) )
+ {
+ Locale locale = model.getTableHandler().getTable().getLocale();
+
+ Object value = column.getPropertyValue();
+
+ if ( value instanceof Long )
+ {
+ Calendar cal = Calendar.getInstance();
+
+ cal.setTimeInMillis( ( (Long) value).longValue() );
+
+ value = cal.getTime();
+ }
+
+ value = ExtremeUtils.formatDate( column.getParse(), column.getFormat(), value, locale );
+
+ column.setValue(value);
+
+ column.setPropertyValue(value);
+ }
+ }
+}
\ No newline at end of file
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/commons/DateCell.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties?rev=365878&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties Wed Jan 4 02:11:30 2006
@@ -0,0 +1,2 @@
+table.format_date=MMM dd, yyyy hh:mm:ss aaa z
+table.cell_date=org.apache.maven.continuum.web.view.commons.DateCell
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/extremecomponents.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"