Source Code Cross Referenced for TableViewerRow.java in  » IDE-Eclipse » jface » org » eclipse » jface » viewers » 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 » IDE Eclipse » jface » org.eclipse.jface.viewers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2006, 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
011:         *     											 - fix in bug: 174355,195908,198035
012:         *******************************************************************************/package org.eclipse.jface.viewers;
013:
014:        import org.eclipse.swt.graphics.Color;
015:        import org.eclipse.swt.graphics.Font;
016:        import org.eclipse.swt.graphics.Image;
017:        import org.eclipse.swt.graphics.Rectangle;
018:        import org.eclipse.swt.widgets.Control;
019:        import org.eclipse.swt.widgets.TableItem;
020:        import org.eclipse.swt.widgets.Widget;
021:
022:        /**
023:         * TableViewerRow is the Table specific implementation of ViewerRow
024:         * @since 3.3
025:         *
026:         */
027:        public class TableViewerRow extends ViewerRow {
028:            private TableItem item;
029:
030:            /**
031:             * Create a new instance of the receiver from item.
032:             * @param item
033:             */
034:            TableViewerRow(TableItem item) {
035:                this .item = item;
036:            }
037:
038:            /* (non-Javadoc)
039:             * @see org.eclipse.jface.viewers.ViewerRow#getBounds(int)
040:             */
041:            public Rectangle getBounds(int columnIndex) {
042:                return item.getBounds(columnIndex);
043:            }
044:
045:            /* (non-Javadoc)
046:             * @see org.eclipse.jface.viewers.ViewerRow#getBounds()
047:             */
048:            public Rectangle getBounds() {
049:                return item.getBounds();
050:            }
051:
052:            /* (non-Javadoc)
053:             * @see org.eclipse.jface.viewers.ViewerRow#getItem()
054:             */
055:            public Widget getItem() {
056:                return item;
057:            }
058:
059:            void setItem(TableItem item) {
060:                this .item = item;
061:            }
062:
063:            /* (non-Javadoc)
064:             * @see org.eclipse.jface.viewers.ViewerRow#getColumnCount()
065:             */
066:            public int getColumnCount() {
067:                return item.getParent().getColumnCount();
068:            }
069:
070:            /* (non-Javadoc)
071:             * @see org.eclipse.jface.viewers.ViewerRow#getBackground(int)
072:             */
073:            public Color getBackground(int columnIndex) {
074:                return item.getBackground(columnIndex);
075:            }
076:
077:            /* (non-Javadoc)
078:             * @see org.eclipse.jface.viewers.ViewerRow#getFont(int)
079:             */
080:            public Font getFont(int columnIndex) {
081:                return item.getFont(columnIndex);
082:            }
083:
084:            /* (non-Javadoc)
085:             * @see org.eclipse.jface.viewers.ViewerRow#getForeground(int)
086:             */
087:            public Color getForeground(int columnIndex) {
088:                return item.getForeground(columnIndex);
089:            }
090:
091:            /* (non-Javadoc)
092:             * @see org.eclipse.jface.viewers.ViewerRow#getImage(int)
093:             */
094:            public Image getImage(int columnIndex) {
095:                return item.getImage(columnIndex);
096:            }
097:
098:            /* (non-Javadoc)
099:             * @see org.eclipse.jface.viewers.ViewerRow#getText(int)
100:             */
101:            public String getText(int columnIndex) {
102:                return item.getText(columnIndex);
103:            }
104:
105:            /* (non-Javadoc)
106:             * @see org.eclipse.jface.viewers.ViewerRow#setBackground(int, org.eclipse.swt.graphics.Color)
107:             */
108:            public void setBackground(int columnIndex, Color color) {
109:                item.setBackground(columnIndex, color);
110:            }
111:
112:            /* (non-Javadoc)
113:             * @see org.eclipse.jface.viewers.ViewerRow#setFont(int, org.eclipse.swt.graphics.Font)
114:             */
115:            public void setFont(int columnIndex, Font font) {
116:                item.setFont(columnIndex, font);
117:            }
118:
119:            /* (non-Javadoc)
120:             * @see org.eclipse.jface.viewers.ViewerRow#setForeground(int, org.eclipse.swt.graphics.Color)
121:             */
122:            public void setForeground(int columnIndex, Color color) {
123:                item.setForeground(columnIndex, color);
124:            }
125:
126:            /* (non-Javadoc)
127:             * @see org.eclipse.jface.viewers.ViewerRow#setImage(int, org.eclipse.swt.graphics.Image)
128:             */
129:            public void setImage(int columnIndex, Image image) {
130:                Image oldImage = item.getImage(columnIndex);
131:                if (oldImage != image) {
132:                    item.setImage(columnIndex, image);
133:                }
134:            }
135:
136:            /* (non-Javadoc)
137:             * @see org.eclipse.jface.viewers.ViewerRow#setText(int, java.lang.String)
138:             */
139:            public void setText(int columnIndex, String text) {
140:                item.setText(columnIndex, text == null ? "" : text); //$NON-NLS-1$
141:            }
142:
143:            /* (non-Javadoc)
144:             * @see org.eclipse.jface.viewers.ViewerRow#getControl()
145:             */
146:            public Control getControl() {
147:                return item.getParent();
148:            }
149:
150:            public ViewerRow getNeighbor(int direction, boolean sameLevel) {
151:                if (direction == ViewerRow.ABOVE) {
152:                    return getRowAbove();
153:                } else if (direction == ViewerRow.BELOW) {
154:                    return getRowBelow();
155:                } else {
156:                    throw new IllegalArgumentException(
157:                            "Illegal value of direction argument."); //$NON-NLS-1$
158:                }
159:            }
160:
161:            private ViewerRow getRowAbove() {
162:                int index = item.getParent().indexOf(item) - 1;
163:
164:                if (index >= 0) {
165:                    return new TableViewerRow(item.getParent().getItem(index));
166:                }
167:
168:                return null;
169:            }
170:
171:            private ViewerRow getRowBelow() {
172:                int index = item.getParent().indexOf(item) + 1;
173:
174:                if (index < item.getParent().getItemCount()) {
175:                    TableItem tmp = item.getParent().getItem(index);
176:                    //TODO NULL can happen in case of VIRTUAL => How do we deal with that
177:                    if (tmp != null) {
178:                        return new TableViewerRow(tmp);
179:                    }
180:                }
181:
182:                return null;
183:            }
184:
185:            public TreePath getTreePath() {
186:                return new TreePath(new Object[] { item.getData() });
187:            }
188:
189:            public Object clone() {
190:                return new TableViewerRow(item);
191:            }
192:
193:            public Object getElement() {
194:                return item.getData();
195:            }
196:
197:            public int getVisualIndex(int creationIndex) {
198:                int[] order = item.getParent().getColumnOrder();
199:
200:                for (int i = 0; i < order.length; i++) {
201:                    if (order[i] == creationIndex) {
202:                        return i;
203:                    }
204:                }
205:
206:                return super .getVisualIndex(creationIndex);
207:            }
208:
209:            public int getCreationIndex(int visualIndex) {
210:                if (item != null && !item.isDisposed() && hasColumns()
211:                        && isValidOrderIndex(visualIndex)) {
212:                    return item.getParent().getColumnOrder()[visualIndex];
213:                }
214:                return super .getCreationIndex(visualIndex);
215:            }
216:
217:            private boolean hasColumns() {
218:                return this .item.getParent().getColumnCount() != 0;
219:            }
220:
221:            private boolean isValidOrderIndex(int currentIndex) {
222:                return currentIndex < this.item.getParent().getColumnOrder().length;
223:            }
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.