001: /*
002: * Gruntspud
003: *
004: * Copyright (C) 2002 Brett Smith.
005: *
006: * Written by: Brett Smith <t_magicthize@users.sourceforge.net>
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public License
010: * as published by the Free Software Foundation; either version 2 of
011: * the License, or (at your option) any later version.
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU Library General Public License for more details.
016: *
017: * You should have received a copy of the GNU Library General Public
018: * License along with this program; if not, write to the Free Software
019: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020: */
021:
022: package gruntspud.ui.report;
023:
024: import gruntspud.Constants;
025: import gruntspud.GruntspudContext;
026: import gruntspud.GruntspudUtil;
027: import gruntspud.ui.UIUtil;
028:
029: import java.awt.Dimension;
030: import java.awt.Font;
031: import java.awt.GridBagConstraints;
032: import java.awt.GridBagLayout;
033: import java.awt.Insets;
034:
035: import javax.swing.Icon;
036: import javax.swing.JLabel;
037: import javax.swing.UIManager;
038: import javax.swing.table.TableCellRenderer;
039:
040: import org.netbeans.lib.cvsclient.command.FileInfoContainer;
041: import org.netbeans.lib.cvsclient.command.editors.EditorsFileInfoContainer;
042:
043: /**
044: * Description of the Class
045: *
046: *@author magicthize
047: *@created 26 May 2002
048: */
049: public class EditorsFileInfoPane extends FileInfoPane {
050: // Private instance variables
051: private JLabel file;
052:
053: // Private instance variables
054: private JLabel user;
055:
056: // Private instance variables
057: private JLabel date;
058:
059: // Private instance variables
060: private JLabel client;
061:
062: // Private instance variables
063: private JLabel directory;
064: private Icon icon;
065: private String text;
066:
067: /**
068: * Constructor
069: */
070: public EditorsFileInfoPane(GruntspudContext context) {
071: super (context);
072:
073: setLayout(new GridBagLayout());
074:
075: Font valFont = UIManager.getFont("Label.font").deriveFont(
076: Font.BOLD);
077:
078: GridBagConstraints gbc = new GridBagConstraints();
079: gbc.insets = new Insets(3, 3, 3, 3);
080: gbc.anchor = GridBagConstraints.NORTHWEST;
081: gbc.fill = GridBagConstraints.HORIZONTAL;
082:
083: UIUtil.jGridBagAdd(this , new JLabel("File: "), gbc,
084: GridBagConstraints.RELATIVE);
085: gbc.weightx = 1.0;
086: file = new JLabel() {
087: public Dimension getPreferredSize() {
088: return new Dimension(260,
089: super .getPreferredSize().height);
090: }
091: };
092: file.setFont(valFont);
093: UIUtil.jGridBagAdd(this , file, gbc,
094: GridBagConstraints.REMAINDER);
095:
096: gbc.weightx = 0.0;
097: UIUtil.jGridBagAdd(this , new JLabel("Directory: "), gbc,
098: GridBagConstraints.RELATIVE);
099: gbc.weightx = 1.0;
100: directory = new JLabel();
101: directory.setFont(valFont);
102: UIUtil.jGridBagAdd(this , directory, gbc,
103: GridBagConstraints.REMAINDER);
104:
105: gbc.weightx = 0.0;
106: UIUtil.jGridBagAdd(this , new JLabel("User: "), gbc,
107: GridBagConstraints.RELATIVE);
108: gbc.weightx = 1.0;
109: user = new JLabel();
110: user.setFont(valFont);
111: UIUtil.jGridBagAdd(this , user, gbc,
112: GridBagConstraints.REMAINDER);
113:
114: gbc.weightx = 0.0;
115: UIUtil.jGridBagAdd(this , new JLabel("Date: "), gbc,
116: GridBagConstraints.RELATIVE);
117: gbc.weightx = 1.0;
118: date = new JLabel();
119: date.setFont(valFont);
120: UIUtil.jGridBagAdd(this , date, gbc,
121: GridBagConstraints.REMAINDER);
122:
123: gbc.weightx = 0.0;
124: gbc.weighty = 1.0;
125: UIUtil.jGridBagAdd(this , new JLabel("Client: "), gbc,
126: GridBagConstraints.RELATIVE);
127: gbc.weightx = 1.0;
128: client = new JLabel();
129: client.setFont(valFont);
130: UIUtil.jGridBagAdd(this , client, gbc,
131: GridBagConstraints.REMAINDER);
132: }
133:
134: /**
135: * Description of the Method
136: *
137: *@return Description of the Return Value
138: */
139: public Object getInfoValueForInfoContainer(
140: FileInfoContainer container) {
141: EditorsFileInfoContainer info = (EditorsFileInfoContainer) container;
142:
143: return info.getUser();
144: }
145:
146: /**
147: * Description of the Method
148: *
149: *@return Description of the Return Value
150: */
151: public TableCellRenderer getInfoRenderer() {
152: return null;
153: }
154:
155: /**
156: * Description of the Method
157: *
158: *@return Description of the Return Value
159: */
160: public Class getInfoClass() {
161: return null;
162: }
163:
164: /**
165: * Description of the Method
166: *
167: *@return Description of the Return Value
168: */
169: public Icon getActionIcon() {
170: return UIUtil.getCachedIcon(Constants.ICON_TOOL_EDITORS);
171: }
172:
173: /**
174: * Description of the Method
175: *
176: *@return Description of the Return Value
177: */
178: public Icon getActionSmallIcon() {
179: return UIUtil.getCachedIcon(Constants.ICON_TOOL_SMALL_EDITORS);
180: }
181:
182: /**
183: * Description of the Method
184: *
185: *@return Description of the Return Value
186: */
187: public String getActionText() {
188: return "Editors";
189: }
190:
191: /**
192: * Description of the Method
193: *
194: *@return Description of the Return Value
195: */
196: public void setFileInfo(FileInfoContainer container) {
197: EditorsFileInfoContainer info = (EditorsFileInfoContainer) container;
198: file.setText(info.getFile().getName());
199: file.setToolTipText(container.getFile().getAbsolutePath());
200: directory.setText(info.getFile().getParentFile()
201: .getAbsolutePath());
202: user.setText(info.getUser());
203: client.setText(info.getClient());
204: date.setText(GruntspudUtil.formatDate(info.getDate(),
205: getContext()));
206: }
207: }
|