EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.dialog]

COVERAGE SUMMARY FOR SOURCE FILE [SnapshotDetailPanel.java]

nameclass, %method, %block, %line, %
SnapshotDetailPanel.java100% (1/1)100% (2/2)100% (138/138)100% (28/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SnapshotDetailPanel100% (1/1)100% (2/2)100% (138/138)100% (28/28)
SnapshotDetailPanel (Board, Snapshot, Image): void 100% (1/1)100% (122/122)100% (24/24)
setDateFormat (String): void 100% (1/1)100% (16/16)100% (4/4)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.dialog;
16 
17import java.awt.Image;
18import java.text.SimpleDateFormat;
19 
20import javax.swing.ImageIcon;
21import javax.swing.JFormattedTextField;
22import javax.swing.JLabel;
23import javax.swing.JScrollPane;
24import javax.swing.JTextField;
25import javax.swing.text.DateFormatter;
26 
27import net.sourceforge.hiveboard.Board;
28import net.sourceforge.hiveboard.Snapshot;
29 
30import zappini.designgridlayout.DesignGridLayout;
31import zappini.designgridlayout.Row;
32 
33public class SnapshotDetailPanel extends AbstractBoardPanel
34{
35        static private final String        NAME = "snapshot";
36        
37        public SnapshotDetailPanel(Board board, Snapshot snapshot, Image picture)
38        {
39                super(NAME);
40                _board = board;
41 
42                _lblBoard.setName(NAME + "-board-label");
43                _txfBoard.setName(NAME + "-board");
44                _lblDate.setName(NAME + "-date-label");
45                _txfDate.setName(NAME + "-date");
46                _pictLabel.setName(NAME + "-picture");
47 
48                _txfBoard.setEnabled(false);
49                _txfDate.setEnabled(false);
50 
51                _txfBoard.setText(board.getName());
52                _txfDate.setValue(snapshot.getDate());
53                _pictLabel.setIcon(new ImageIcon(picture));
54 
55                DesignGridLayout layout = new DesignGridLayout(this); 
56                setLayout(layout);
57                layout.row().label(_lblBoard).add(_txfBoard);
58                layout.row().label(_lblDate).add(_txfDate).add(Row.EMPTY);
59                layout.row().center().add(new JScrollPane(_pictLabel));
60        }
61        
62        public void setDateFormat(String dateFormat)
63        {
64                Object value = _txfDate.getValue();
65                _dateFormatter.setFormat(new SimpleDateFormat(dateFormat));
66                // We have to reset the value to force the application of the new format
67                _txfDate.setValue(value);
68        }
69 
70        private final JLabel                                _lblBoard = new JLabel();
71        private final JTextField                        _txfBoard = new JTextField();
72        private final JLabel                                _lblDate = new JLabel();
73        private final DateFormatter                        _dateFormatter = new DateFormatter();
74        private final JFormattedTextField        _txfDate = new JFormattedTextField(_dateFormatter);
75        private final JLabel                                _pictLabel = new JLabel();
76}

[all classes][net.sourceforge.hiveboard.dialog]
EMMA 2.0.5312 (C) Vladimir Roubtsov