Source Code Cross Referenced for HeaderTableRenderer.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » userinterface » 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 » Report » jmagallanes 1.0 » com.calipso.reportgenerator.userinterface 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.userinterface;
002:
003:        import javax.swing.table.TableCellRenderer;
004:        import javax.swing.*;
005:        import javax.swing.border.LineBorder;
006:        import java.awt.*;
007:        import java.net.URL;
008:
009:        /**
010:         * HeaderTableRenderer define las propiedades de los componentes que van a ser ubicados en las tablas
011:         */
012:        public class HeaderTableRenderer extends JPanel implements 
013:                TableCellRenderer {
014:            private JLabel cellLabel;
015:            private Icon collapsedIcon;
016:            private Icon expandedIcon;
017:
018:            /**
019:             * Crea un objeto HeaderTableRenderer
020:             */
021:            public HeaderTableRenderer() {
022:                cellLabel = new JLabel();
023:                setLayout(new BorderLayout());
024:                add(cellLabel, BorderLayout.NORTH);
025:                setBackground(new Color(204, 204, 204));
026:                setBorder(new LineBorder(Color.GRAY, 1));
027:            }
028:
029:            /**
030:             * Setea el valor del JLable cellLabel
031:             * @param value
032:             */
033:            protected void setValue(Object value) {
034:                cellLabel.setText((value == null) ? "" : value.toString());
035:            }
036:
037:            /**
038:             * Retorna el componente a insertar el la tabla
039:             * @param table
040:             * @param value
041:             * @param isCollapsable
042:             * @param isCollapsed
043:             * @return
044:             */
045:            public Component getCellComponent(JTable table, Object value,
046:                    boolean isCollapsable, boolean isCollapsed) {
047:                cellLabel.setFont(table.getFont());
048:                if (isCollapsable) {
049:                    cellLabel.setIcon(getIcon(isCollapsed));
050:                } else {
051:                    cellLabel.setIcon(null);
052:                }
053:                setValue(value);
054:                return this ;
055:            }
056:
057:            /**
058:             * Retorna el ícono de la celda
059:             * @param collapsed
060:             * @return
061:             */
062:            private Icon getIcon(boolean collapsed) {
063:                if (collapsed) {
064:                    return getCollapsedIcon();
065:                } else {
066:                    return getExpandedIcon();
067:                }
068:            }
069:
070:            /**
071:             * Retorna el ancho del ícono
072:             * @return
073:             */
074:            public int getIconWidth() {
075:                return getCollapsedIcon().getIconWidth();
076:            }
077:
078:            /**
079:             * Retorna el alto del ícono
080:             * @return
081:             */
082:            public int getIconHeight() {
083:                return getCollapsedIcon().getIconHeight();
084:            }
085:
086:            /**
087:             * Retorna el ícono expandedIcon
088:             * @return
089:             */
090:            private Icon getExpandedIcon() {
091:                if (expandedIcon == null) {
092:                    ClassLoader loader = this .getClass().getClassLoader();
093:                    URL url = loader
094:                            .getResource("com/calipso/reportgenerator/userinterface/images/collapse.gif");
095:                    expandedIcon = new ImageIcon(url);
096:                }
097:                return expandedIcon;
098:            }
099:
100:            /**
101:             * Retorna el ícono collapsedIcon
102:             * @return
103:             */
104:            private Icon getCollapsedIcon() {
105:                if (collapsedIcon == null) {
106:                    ClassLoader loader = this .getClass().getClassLoader();
107:                    URL url = loader
108:                            .getResource("com/calipso/reportgenerator/userinterface/images/expand.gif");
109:                    collapsedIcon = new ImageIcon(url);
110:                }
111:                return collapsedIcon;
112:            }
113:
114:            /**
115:             * Implementación de la interface TableCellRenderer
116:             * @param table
117:             * @param value
118:             * @param isSelected
119:             * @param hasFocus
120:             * @param row
121:             * @param column
122:             * @return
123:             */
124:            public Component getTableCellRendererComponent(JTable table,
125:                    Object value, boolean isSelected, boolean hasFocus,
126:                    int row, int column) {
127:                return null;
128:            }
129:
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.