Source Code Cross Referenced for StyleCellRenderer.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » style » 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 » iReport 2.0.5 » it.businesslogic.ireport.gui.style 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
003:         * http://www.jaspersoft.com.
004:         *
005:         * Unless you have purchased a commercial license agreement from JasperSoft,
006:         * the following license terms apply:
007:         *
008:         * This program is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License version 2 as published by
010:         * the Free Software Foundation.
011:         *
012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014:         * See the GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018:         * or write to:
019:         *
020:         * Free Software Foundation, Inc.,
021:         * 59 Temple Place - Suite 330,
022:         * Boston, MA  USA  02111-1307
023:         *
024:         *
025:         *
026:         *
027:         * StyleCellRenderer.java
028:         * 
029:         * Created on March 22, 2006, 4:44 PM
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui.style;
034:
035:        import it.businesslogic.ireport.JasperTemplate;
036:        import it.businesslogic.ireport.Style;
037:        import it.businesslogic.ireport.Template;
038:        import it.businesslogic.ireport.UndefinedStyle;
039:        import java.awt.Color;
040:        import java.awt.Component;
041:        import javax.swing.DefaultListCellRenderer;
042:        import javax.swing.Icon;
043:        import javax.swing.ImageIcon;
044:        import javax.swing.JComponent;
045:        import javax.swing.JLabel;
046:        import javax.swing.JList;
047:        import javax.swing.JTree;
048:        import javax.swing.tree.DefaultMutableTreeNode;
049:        import javax.swing.tree.DefaultTreeCellRenderer;
050:
051:        /**
052:         *
053:         * @author gtoffoli
054:         */
055:        public class StyleCellRenderer extends DefaultTreeCellRenderer {
056:
057:            static ImageIcon styleIcon;
058:            static ImageIcon undefinedStyleIcon;
059:            static ImageIcon templateIcon;
060:            static ImageIcon linkTemplateIcon;
061:
062:            /** Creates a new instance of StyleCellRenderer */
063:            public StyleCellRenderer() {
064:                super ();
065:                if (styleIcon == null)
066:                    styleIcon = new javax.swing.ImageIcon(
067:                            getClass()
068:                                    .getResource(
069:                                            "/it/businesslogic/ireport/icons/styles/style.png"));
070:                if (undefinedStyleIcon == null)
071:                    undefinedStyleIcon = new javax.swing.ImageIcon(
072:                            getClass()
073:                                    .getResource(
074:                                            "/it/businesslogic/ireport/icons/styles/undefinedStyle.png"));
075:                if (templateIcon == null)
076:                    templateIcon = new javax.swing.ImageIcon(
077:                            getClass()
078:                                    .getResource(
079:                                            "/it/businesslogic/ireport/icons/styles/template.png"));
080:                if (linkTemplateIcon == null)
081:                    linkTemplateIcon = new javax.swing.ImageIcon(
082:                            getClass()
083:                                    .getResource(
084:                                            "/it/businesslogic/ireport/icons/styles/linktemplate.png"));
085:
086:            }
087:
088:            public Component getTreeCellRendererComponent(JTree tree,
089:                    Object node, boolean isSelected, boolean isExpanded,
090:                    boolean isLeaf, int row, boolean cellHasFocus) {
091:                JLabel c = (JLabel) super 
092:                        .getTreeCellRendererComponent(tree, node, isSelected,
093:                                isExpanded, isLeaf, row, cellHasFocus);
094:                //c.setOpaque(false);
095:
096:                ImageIcon icon = getElementIcon(node);
097:                if (icon != null)
098:                    c.setIcon(icon);
099:                return c;
100:            }
101:
102:            protected ImageIcon getElementIcon(Object value) {
103:                DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
104:
105:                this .setForeground(Color.BLACK);
106:
107:                if (node.getUserObject() instanceof  UndefinedStyle)
108:                    this .setForeground(Color.GRAY);
109:
110:                if (node.getUserObject() instanceof  UndefinedStyle)
111:                    return undefinedStyleIcon;
112:                if (node.getUserObject() instanceof  Style)
113:                    return styleIcon;
114:                if (node.getUserObject() instanceof  JasperTemplate) {
115:                    if (((JasperTemplate) node.getUserObject()).getParent() == null)
116:                        return templateIcon;
117:                    else
118:                        return linkTemplateIcon;
119:                }
120:                if (node.getUserObject() instanceof  Template)
121:                    return linkTemplateIcon;
122:                return undefinedStyleIcon;
123:            }
124:
125:            public Color getBackgroundNonSelectionColor() {
126:                return null;
127:            }
128:
129:            public Color getBackground() {
130:                return null;
131:            }
132:
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.