Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 33467 invoked from network); 4 Jan 2006 10:11:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jan 2006 10:11:49 -0000 Received: (qmail 48246 invoked by uid 500); 4 Jan 2006 10:11:49 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 48228 invoked by uid 500); 4 Jan 2006 10:11:48 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 48217 invoked by uid 99); 4 Jan 2006 10:11:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jan 2006 02:11:48 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 04 Jan 2006 02:11:47 -0800 Received: (qmail 33416 invoked by uid 65534); 4 Jan 2006 10:11:37 -0000 Message-ID: <20060104101137.33414.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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 Date: Wed, 04 Jan 2006 10:11:36 -0000 To: continuum-commits@maven.apache.org From: evenisse@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 Emmanuel Venisse + * @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"