Source Code Cross Referenced for ViewerColumn.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 Shindl <tom.schindl@bestsolution.at> - initial API and implementation
011:         * 												  fix for bug 163317, 201905
012:         *******************************************************************************/package org.eclipse.jface.viewers;
013:
014:        import org.eclipse.jface.util.Policy;
015:        import org.eclipse.swt.events.DisposeEvent;
016:        import org.eclipse.swt.events.DisposeListener;
017:        import org.eclipse.swt.widgets.Widget;
018:
019:        /**
020:         * Instances of this class represent a column of a {@link ColumnViewer}. Label
021:         * providers and editing support can be configured for each column separately.
022:         * Concrete subclasses of {@link ColumnViewer} should implement a matching
023:         * concrete subclass of {@link ViewerColumn}.
024:         *
025:         * @since 3.3
026:         *
027:         */
028:        public abstract class ViewerColumn {
029:
030:            private CellLabelProvider labelProvider;
031:
032:            static String COLUMN_VIEWER_KEY = Policy.JFACE + ".columnViewer";//$NON-NLS-1$
033:
034:            private EditingSupport editingSupport;
035:
036:            private ILabelProviderListener listener;
037:
038:            private boolean listenerRegistered = false;
039:
040:            /**
041:             * Create a new instance of the receiver at columnIndex.
042:             *
043:             * @param viewer
044:             *            the viewer the column is part of
045:             * @param columnOwner
046:             *            the widget owning the viewer in case the widget has no columns
047:             *            this could be the widget itself
048:             */
049:            protected ViewerColumn(final ColumnViewer viewer, Widget columnOwner) {
050:                columnOwner.setData(ViewerColumn.COLUMN_VIEWER_KEY, this );
051:                this .listener = new ILabelProviderListener() {
052:
053:                    public void labelProviderChanged(
054:                            LabelProviderChangedEvent event) {
055:                        viewer.handleLabelProviderChanged(event);
056:                    }
057:
058:                };
059:                columnOwner.addDisposeListener(new DisposeListener() {
060:                    public void widgetDisposed(DisposeEvent e) {
061:                        handleDispose(viewer);
062:                    }
063:                });
064:            }
065:
066:            /**
067:             * Return the label provider for the receiver.
068:             *
069:             * @return ViewerLabelProvider
070:             */
071:            /* package */CellLabelProvider getLabelProvider() {
072:                return labelProvider;
073:            }
074:
075:            /**
076:             * Set the label provider for the column. Subclasses may extend but must
077:             * call the super implementation.
078:             *
079:             * @param labelProvider
080:             *            the new {@link CellLabelProvider}
081:             */
082:            public void setLabelProvider(CellLabelProvider labelProvider) {
083:                setLabelProvider(labelProvider, true);
084:            }
085:
086:            /**
087:             * @param labelProvider
088:             * @param registerListener
089:             */
090:            /* package */void setLabelProvider(
091:                    CellLabelProvider labelProvider, boolean registerListener) {
092:                if (listenerRegistered && this .labelProvider != null) {
093:                    this .labelProvider.removeListener(listener);
094:                    listenerRegistered = false;
095:                }
096:
097:                this .labelProvider = labelProvider;
098:
099:                if (registerListener) {
100:                    this .labelProvider.addListener(listener);
101:                    listenerRegistered = true;
102:                }
103:            }
104:
105:            /**
106:             * Return the editing support for the receiver.
107:             *
108:             * @return {@link EditingSupport}
109:             */
110:            /* package */EditingSupport getEditingSupport() {
111:                return editingSupport;
112:            }
113:
114:            /**
115:             * Set the editing support. Subclasses may extend but must call the super
116:             * implementation.
117:             *
118:             * @param editingSupport
119:             *            The {@link EditingSupport} to set.
120:             */
121:            public void setEditingSupport(EditingSupport editingSupport) {
122:                this .editingSupport = editingSupport;
123:            }
124:
125:            /**
126:             * Refresh the cell for the given columnIndex. <strong>NOTE:</strong>the
127:             * {@link ViewerCell} provided to this method is no longer valid after this
128:             * method returns. Do not cache the cell for future use.
129:             *
130:             * @param cell
131:             *            {@link ViewerCell}
132:             */
133:            /* package */void refresh(ViewerCell cell) {
134:                getLabelProvider().update(cell);
135:            }
136:
137:            /**
138:             * Disposes of the label provider (if set), unregisters the listener and
139:             * nulls the references to the label provider and editing support. This
140:             * method is called when the underlying widget is disposed. Subclasses may
141:             * extend but must call the super implementation.
142:             */
143:            protected void handleDispose() {
144:                boolean disposeLabelProvider = listenerRegistered;
145:                CellLabelProvider cellLabelProvider = labelProvider;
146:                setLabelProvider(null, false);
147:                if (disposeLabelProvider) {
148:                    cellLabelProvider.dispose();
149:                }
150:                editingSupport = null;
151:                listener = null;
152:            }
153:
154:            private void handleDispose(ColumnViewer viewer) {
155:                handleDispose();
156:                //viewer.clearLegacyEditingSetup();
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.