Source Code Cross Referenced for CVSFileNodeTable.java in  » Source-Control » gruntspud » gruntspud » ui » view » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Source Control » gruntspud » gruntspud.ui.view 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.view;
023:
024:        import gruntspud.CVSFileNode;
025:        import gruntspud.Constants;
026:        import gruntspud.Gruntspud;
027:        import gruntspud.GruntspudContext;
028:        import gruntspud.SortCriteria;
029:        import gruntspud.ui.CVSFileNodeFileSizeTableCellRenderer;
030:        import gruntspud.ui.IconTableCellRenderer;
031:        import gruntspud.ui.ListSearch;
032:        import gruntspud.ui.ListSearchListener;
033:        import gruntspud.ui.SortableTableHeader;
034:        import gruntspud.ui.UIUtil;
035:
036:        import java.awt.Component;
037:        import java.awt.Dimension;
038:        import java.awt.Rectangle;
039:
040:        import javax.swing.Icon;
041:        import javax.swing.JTable;
042:        import javax.swing.JViewport;
043:        import javax.swing.event.ChangeEvent;
044:        import javax.swing.event.ChangeListener;
045:
046:        /**
047:         *  Description of the Class
048:         *
049:         *@author     magicthize
050:         *@created    26 May 2002
051:         */
052:        public class CVSFileNodeTable extends JTable implements 
053:                ListSearchListener {
054:            //
055:            private GruntspudContext context;
056:            private String tableGeometryPropertyPrefix;
057:            private ListSearch listSearch;
058:
059:            /**
060:             *  Constructor for the CVSFileNodeTable object
061:             */
062:            public CVSFileNodeTable(String tableGeometryPropertyPrefix) {
063:                super ();
064:                this .tableGeometryPropertyPrefix = tableGeometryPropertyPrefix;
065:            }
066:
067:            /**
068:             * DOCUMENT ME!
069:             *
070:             * @param context DOCUMENT ME!
071:             * @param model DOCUMENT ME!
072:             * @param sortCriteria DOCUMENT ME!
073:             * @param textMask DOCUMENT ME!
074:             */
075:            public void init(GruntspudContext context,
076:                    CVSFileNodeTableModel model, SortCriteria sortCriteria,
077:                    String textMask) {
078:                this .context = context;
079:
080:                int insets = context.getHost().getFileRendererInsets().top
081:                        + context.getHost().getFileRendererInsets().bottom;
082:                Icon icon = context.getHost().getIcon(
083:                        Constants.ICON_TOOL_SMALL_DEFAULT_FOLDER_OPEN);
084:                int rh = Math.max(insets
085:                        + (icon == null ? 0 : icon.getIconHeight()),
086:                        16 + insets);
087:                setRowHeight(rh);
088:                setModel(model);
089:                setShowGrid(false);
090:                setAutoResizeMode(0);
091:                setDefaultRenderer(Icon.class, new IconTableCellRenderer());
092:                getColumnModel().getColumn(7).setCellRenderer(
093:                        new CVSFileNodeFileSizeTableCellRenderer());
094:                CVSFileNodeTableCellRenderer renderer = new CVSFileNodeTableCellRenderer(
095:                        textMask);
096:                setDefaultRenderer(CVSFileNode.class, renderer);
097:                renderer
098:                        .setHighlight(context
099:                                .getHost()
100:                                .getBooleanProperty(
101:                                        Constants.OPTIONS_DISPLAY_HIGHLIGHT_READ_ONLY_AND_MISSING_FILES,
102:                                        true));
103:                setTableHeader(new SortableTableHeader(context.getHost(), this ,
104:                        sortCriteria));
105:                ((SortableTableHeader) getTableHeader())
106:                        .addChangeListener(new ChangeListener() {
107:                            public void stateChanged(ChangeEvent evt) {
108:                                CVSFileNodeTable.this .context.getViewManager()
109:                                        .refilterAndResort();
110:                            }
111:                        });
112:
113:                //		setAutoscrolls(false);                                              ;
114:                UIUtil.restoreTableMetrics(this , tableGeometryPropertyPrefix,
115:                        new int[] { 24, 24, 128, 96, 64, 128, 48, 64, 72, 72,
116:                                96 }, context);
117:                if (Gruntspud.is14())
118:                    listSearch = new ListSearch(this , this );
119:            }
120:
121:            public void cleanUp() {
122:                if (listSearch != null)
123:                    listSearch.removeSearch();
124:            }
125:
126:            //    public int getRowHeight(int r) {
127:            //        return context.getHost().getIcon(
128:            //            Constants.ICON_TOOL_SMALL_DEFAULT_FOLDER_CLOSED).getIconHeight() + 2;
129:            //    }
130:
131:            /**
132:             * DOCUMENT ME!
133:             *
134:             * @param searchText DOCUMENT ME!
135:             */
136:            public void searchUpdated(String searchText) {
137:                CVSFileNode n = getRootNode();
138:                CVSFileNode s = getSelectedFileNode();
139:
140:                if (n != null) {
141:                    int c = ((CVSFileNodeTableModel) getModel()).getRowCount();
142:
143:                    for (int i = 0; i < c; i++) {
144:                        CVSFileNode f = ((CVSFileNodeTableModel) getModel())
145:                                .getFileNodeAt(i);
146:
147:                        if (f.getName().toLowerCase().startsWith(
148:                                searchText.toLowerCase())) {
149:                            if (n != f) {
150:                                setSelectedFileNode(f);
151:
152:                            }
153:                            scrollRectToVisible(getCellRect(i, 0, true));
154:
155:                            break;
156:                        }
157:                    }
158:                }
159:            }
160:
161:            /**
162:             * DOCUMENT ME!
163:             */
164:            public void searchCancelled() {
165:            }
166:
167:            /**
168:             * DOCUMENT ME!
169:             */
170:            public void searchComplete(String searchText) {
171:                searchUpdated(searchText);
172:            }
173:
174:            /**
175:             * DOCUMENT ME!
176:             *
177:             * @return DOCUMENT ME!
178:             */
179:            public CVSFileNode getRootNode() {
180:                return ((CVSFileNodeTableModel) getModel()).getRootNode();
181:            }
182:
183:            /**
184:             * DOCUMENT ME!
185:             *
186:             * @param root DOCUMENT ME!
187:             */
188:            public void setRootNode(CVSFileNode root) {
189:                ((CVSFileNodeTableModel) getModel()).setRootNode(root);
190:            }
191:
192:            /**
193:             * DOCUMENT ME!
194:             */
195:            public void saveColumnPositions() {
196:                UIUtil.saveTableMetrics(this , tableGeometryPropertyPrefix,
197:                        context);
198:            }
199:
200:            /**
201:             *  Gets the selectedFileNode attribute of the CVSFileNodeTable object
202:             *
203:             *@return    The selectedFileNode value
204:             */
205:            public CVSFileNode getSelectedFileNode() {
206:                return (getSelectedRowCount() < 1) ? null
207:                        : ((CVSFileNodeTableModel) getModel())
208:                                .getFileNodeAt(getSelectedRow());
209:            }
210:
211:            /**
212:             *  Gets the selectedFileNodes attribute of the CVSFileNodeTable object
213:             *
214:             *@return    The selectedFileNodes value
215:             */
216:            public CVSFileNode[] getSelectedFileNodes() {
217:                int[] r = getSelectedRows();
218:                CVSFileNode[] n = new CVSFileNode[r.length];
219:
220:                for (int i = 0; i < r.length; i++) {
221:                    n[i] = ((CVSFileNodeTableModel) getModel())
222:                            .getFileNodeAt(r[i]);
223:
224:                }
225:                return n;
226:            }
227:
228:            /**
229:             *  Sets the selectedFileNode attribute of the CVSFileNodeTable object
230:             *
231:             *@param  node  The new selectedFileNode value
232:             */
233:            public void setSelectedFileNode(CVSFileNode node) {
234:                setSelectedFileNodes((node == null) ? null
235:                        : new CVSFileNode[] { node });
236:            }
237:
238:            /**
239:             *  Sets the selectedFileNodes attribute of the CVSFileNodeTable object
240:             *
241:             *@param  nodes  The new selectedFileNodes value
242:             */
243:            public void setSelectedFileNodes(CVSFileNode[] nodes) {
244:                getSelectionModel().clearSelection();
245:
246:                if (nodes != null) {
247:                    for (int i = 0; i < nodes.length; i++) {
248:                        if (nodes[i] != null) {
249:                            int j = ((CVSFileNodeTableModel) getModel())
250:                                    .indexOf(nodes[i]);
251:
252:                            if (j != -1) {
253:                                getSelectionModel().addSelectionInterval(j, j);
254:                                if (i == 0) {
255:                                    Rectangle r = getCellRect(j, 0, true);
256:                                    scrollRectToVisible(r);
257:                                }
258:                            }
259:                        }
260:                    }
261:                }
262:            }
263:
264:            /**
265:             *  Gets the preferredScrollableViewportSize attribute of the
266:             *  CVSFileNodeTable object
267:             *
268:             *@return    The preferredScrollableViewportSize value
269:             */
270:            public Dimension getPreferredScrollableViewportSize() {
271:                return new Dimension(576, super 
272:                        .getPreferredScrollableViewportSize().height);
273:            }
274:
275:            /**
276:             *  Gets the scrollableTracksViewportHeight attribute of the
277:             *  CVSFileNodeTable object
278:             *
279:             *@return    The scrollableTracksViewportHeight value
280:             */
281:            public boolean getScrollableTracksViewportHeight() {
282:                Component parent = getParent();
283:
284:                if (parent instanceof  JViewport) {
285:                    return parent.getHeight() > getPreferredSize().height;
286:                } else {
287:
288:                    return false;
289:                }
290:            }
291:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.