Source Code Cross Referenced for SDefaultTableRowSelectionRenderer.java in  » Swing-Library » wings3 » org » wings » table » 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 » Swing Library » wings3 » org.wings.table 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2005 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:        package org.wings.table;
014:
015:        import org.wings.SComponent;
016:        import org.wings.SLabel;
017:        import org.wings.SResourceIcon;
018:        import org.wings.STable;
019:        import javax.swing.*;
020:
021:        /**
022:         * Renderer responsible for the row selection column in cases where the table
023:         * cannot distinguish clicks on cells as selection clicks or editing clicks.
024:         *
025:         * @author <a href="mailto:B.Schmid@eXXcellent.de">Benjamin Schmid</a>
026:         */
027:        public class SDefaultTableRowSelectionRenderer extends SLabel implements 
028:                STableCellRenderer {
029:
030:            public static final SResourceIcon DEFAULT_MULTI_SELECTION_ICON = new SResourceIcon(
031:                    "org/wings/icons/SelectedCheckBox.gif");
032:
033:            public static final SResourceIcon DEFAULT_MULTI_NOT_SELECTION_ICON = new SResourceIcon(
034:                    "org/wings/icons/NotSelectedCheckBox.gif");
035:
036:            public static final SResourceIcon DEFAULT_SINGLE_SELECTION_ICON = new SResourceIcon(
037:                    "org/wings/icons/SelectedRadioButton.gif");
038:
039:            public static final SResourceIcon DEFAULT_SINGLE_NOT_SELECTION_ICON = new SResourceIcon(
040:                    "org/wings/icons/NotSelectedRadioButton.gif");
041:
042:            /**
043:             * Style to use for the foreground for non-selected nodes.
044:             */
045:            protected String nonSelectionStyle;
046:
047:            /**
048:             * Style to use for the foreground for non-selected nodes.
049:             */
050:            protected String selectionStyle;
051:
052:            protected SResourceIcon multiSelectionIcon = DEFAULT_MULTI_SELECTION_ICON;
053:
054:            protected SResourceIcon multiNonSelectionIcon = DEFAULT_MULTI_NOT_SELECTION_ICON;
055:
056:            protected SResourceIcon singleSelectionIcon = DEFAULT_SINGLE_SELECTION_ICON;
057:
058:            protected SResourceIcon singleNonSelectionIcon = DEFAULT_SINGLE_NOT_SELECTION_ICON;
059:
060:            /**
061:             * If set to true render the row selection colum with icons, otherwise simple text.
062:             */
063:            protected boolean useIcons = false;
064:
065:            public SDefaultTableRowSelectionRenderer() {
066:            }
067:
068:            public SComponent getTableCellRendererComponent(STable table,
069:                    Object value, boolean selected, int row, int col) {
070:                if (useIcons) {
071:                    setText(null);
072:                    switch (table.getSelectionMode()) {
073:                    case ListSelectionModel.SINGLE_SELECTION:
074:                        setIcon(selected ? singleSelectionIcon
075:                                : singleNonSelectionIcon);
076:                        break;
077:                    default:
078:                        setIcon(selected ? multiSelectionIcon
079:                                : multiNonSelectionIcon);
080:                        break;
081:                    }
082:                } else {
083:                    setIcon(null);
084:                    setText("" + (row + 1));
085:                }
086:                // style
087:                if (selected) {
088:                    setStyle(selectionStyle);
089:                } else {
090:                    setStyle(nonSelectionStyle);
091:                }
092:
093:                return this ;
094:            }
095:
096:            /**
097:             * Sets the style the cell is drawn with when the cell isn't selected.
098:             */
099:            public void setNonSelectionStyle(String newStyle) {
100:                nonSelectionStyle = newStyle;
101:            }
102:
103:            /**
104:             * Returns the style the cell is drawn with when the cell isn't selected.
105:             */
106:            public String getNonSelectionStyle() {
107:                return nonSelectionStyle;
108:            }
109:
110:            /**
111:             * Sets the style the cell is drawn with when the cell isn't selected.
112:             */
113:            public void setSelectionStyle(String newStyle) {
114:                selectionStyle = newStyle;
115:            }
116:
117:            /**
118:             * Returns the style the cell is drawn with when the cell isn't selected.
119:             */
120:            public String getSelectionStyle() {
121:                return selectionStyle;
122:            }
123:
124:            /**
125:             * @return Icon used for selected rows in multi-selection mode for selected lines
126:             */
127:            public SResourceIcon getMultiSelectionIcon() {
128:                return multiSelectionIcon;
129:            }
130:
131:            /**
132:             * @param multiSelectionIcon Icon used for selected rows in multi-selection mode for selected lines
133:             */
134:            public void setMultiSelectionIcon(SResourceIcon multiSelectionIcon) {
135:                this .multiSelectionIcon = multiSelectionIcon;
136:            }
137:
138:            /**
139:             * @return Icon used for selected rows in multi-selection mode for unselected lines
140:             */
141:            public SResourceIcon getMultiNonSelectionIcon() {
142:                return multiNonSelectionIcon;
143:            }
144:
145:            /**
146:             * @param multiNonSelectionIcon Icon used for selected rows in multi-selection mode for unselected lines
147:             */
148:            public void setMultiNonSelectionIcon(
149:                    SResourceIcon multiNonSelectionIcon) {
150:                this .multiNonSelectionIcon = multiNonSelectionIcon;
151:            }
152:
153:            /**
154:             * @return Icon used for selected rows in single-selection mode tables for selected lines
155:             */
156:            public SResourceIcon getSingleSelectionIcon() {
157:                return singleSelectionIcon;
158:            }
159:
160:            /**
161:             * @param singleSelectionIcon Icon used for selected rows in single-selection mode tables for selected lines
162:             */
163:            public void setSingleSelectionIcon(SResourceIcon singleSelectionIcon) {
164:                this .singleSelectionIcon = singleSelectionIcon;
165:            }
166:
167:            /**
168:             * @return Icon used for selected rows in single-selection mode tables for unselected lines
169:             */
170:            public SResourceIcon getSingleNonSelectionIcon() {
171:                return singleNonSelectionIcon;
172:            }
173:
174:            /**
175:             * @param singleNonSelectionIcon Icon used for selected rows in single-selection mode tables for unselected lines
176:             */
177:            public void setSingleNonSelectionIcon(
178:                    SResourceIcon singleNonSelectionIcon) {
179:                this .singleNonSelectionIcon = singleNonSelectionIcon;
180:            }
181:
182:            /**
183:             * Returns if set to true render the row selection colum with icons, otherwise simple text.
184:             *
185:             * @return if set to true render the row selection colum with icons, otherwise simple text.
186:             */
187:            public boolean isUseIcons() {
188:                return useIcons;
189:            }
190:
191:            /**
192:             * Sets if set to true render the row selection colum with icons, otherwise simple text.
193:             *
194:             * @param useIcons if set to true render the row selection colum with icons, otherwise simple text.
195:             */
196:            public void setUseIcons(boolean useIcons) {
197:                this.useIcons = useIcons;
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.