EMMA Coverage Report (generated Sun Sep 18 11:34:27 PHT 2011)
[all classes][org.apache.maven.continuum.web.view.commons]

COVERAGE SUMMARY FOR SOURCE FILE [DateCell.java]

nameclass, %method, %block, %line, %
DateCell.java0%   (0/1)0%   (0/2)0%   (0/55)0%   (0/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DateCell0%   (0/1)0%   (0/2)0%   (0/55)0%   (0/16)
DateCell (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getCellValue (TableModel, Column): String 0%   (0/1)0%   (0/52)0%   (0/15)

1package org.apache.maven.continuum.web.view.commons;
2 
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 
22import org.codehaus.plexus.util.StringUtils;
23import org.extremecomponents.table.bean.Column;
24import org.extremecomponents.table.cell.DisplayCell;
25import org.extremecomponents.table.core.TableModel;
26import org.extremecomponents.util.ExtremeUtils;
27 
28import java.util.Calendar;
29import java.util.Locale;
30 
31/**
32 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
33 * @version $Id: DateCell.java 765340 2009-04-15 20:22:00Z evenisse $
34 * @deprecated use of cells is discouraged due to lack of i18n and design in java code.
35 *             Use jsp:include instead.
36 */
37public class DateCell
38    extends DisplayCell
39{
40    protected String getCellValue( TableModel tableModel, Column column )
41    {
42        String valueString = column.getPropertyValueAsString();
43 
44        if ( !StringUtils.isEmpty( valueString ) && !"0".equals( valueString ) )
45        {
46            Locale locale = tableModel.getLocale();
47 
48            Object value = column.getPropertyValue();
49 
50            if ( value instanceof Long )
51            {
52                Calendar cal = Calendar.getInstance();
53 
54                cal.setTimeInMillis( (Long) value );
55 
56                value = cal.getTime();
57            }
58 
59            String format = column.getFormat();
60 
61            if ( StringUtils.isEmpty( format ) )
62            {
63                format = "MMM dd, yyyy hh:mm:ss aaa z";
64            }
65 
66            value = ExtremeUtils.formatDate( column.getParse(), format, value, locale );
67 
68            column.setPropertyValue( value );
69 
70            return value.toString();
71        }
72        else
73        {
74            return "&nbsp;";
75        }
76    }
77}

[all classes][org.apache.maven.continuum.web.view.commons]
EMMA 2.0.5312 (C) Vladimir Roubtsov