Source Code Cross Referenced for CellNavigationStrategy.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) 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:         ******************************************************************************/package org.eclipse.jface.viewers;
011:
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.widgets.Event;
014:
015:        /**
016:         * This class implementation the strategy how the table is navigated using the
017:         * keyboard.
018:         * 
019:         * <p>
020:         * <b>Subclasses can implement their custom navigation algorithms</b>
021:         * </p>
022:         * 
023:         * @since 3.3
024:         * 
025:         */
026:        public class CellNavigationStrategy {
027:            /**
028:             * is the given event an event which moves the selection to another cell
029:             * 
030:             * @param viewer
031:             *            the viewer we are working for
032:             * @param event
033:             *            the key event
034:             * @return <code>true</code> if a new cell is searched
035:             */
036:            public boolean isNavigationEvent(ColumnViewer viewer, Event event) {
037:                switch (event.keyCode) {
038:                case SWT.ARROW_UP:
039:                case SWT.ARROW_DOWN:
040:                case SWT.ARROW_LEFT:
041:                case SWT.ARROW_RIGHT:
042:                case SWT.HOME:
043:                case SWT.PAGE_DOWN:
044:                case SWT.PAGE_UP:
045:                case SWT.END:
046:                    return true;
047:                default:
048:                    return false;
049:                }
050:            }
051:
052:            /**
053:             * @param viewer
054:             *            the viewer we are working for
055:             * @param cellToCollapse
056:             *            the cell to collapse
057:             * @param event
058:             *            the key event
059:             * @return <code>true</code> if this event triggers collapsing of a node
060:             */
061:            public boolean isCollapseEvent(ColumnViewer viewer,
062:                    ViewerCell cellToCollapse, Event event) {
063:                return false;
064:            }
065:
066:            /**
067:             * @param viewer
068:             *            the viewer we are working for
069:             * @param cellToExpand
070:             *            the cell to expand
071:             * @param event
072:             *            the key event
073:             * @return <code>true</code> if this event triggers expanding of a node
074:             */
075:            public boolean isExpandEvent(ColumnViewer viewer,
076:                    ViewerCell cellToExpand, Event event) {
077:                return false;
078:            }
079:
080:            /**
081:             * @param viewer
082:             *            the viewer working for
083:             * @param cellToExpand
084:             *            the cell the user wants to expand
085:             * @param event
086:             *            the event triggering the expansion
087:             */
088:            public void expand(ColumnViewer viewer, ViewerCell cellToExpand,
089:                    Event event) {
090:
091:            }
092:
093:            /**
094:             * @param viewer
095:             *            the viewer working for
096:             * @param cellToCollapse
097:             *            the cell the user wants to collapse
098:             * @param event
099:             *            the event triggering the expansion
100:             */
101:            public void collapse(ColumnViewer viewer,
102:                    ViewerCell cellToCollapse, Event event) {
103:
104:            }
105:
106:            /**
107:             * @param viewer
108:             *            the viewer we are working for
109:             * @param currentSelectedCell
110:             *            the cell currently selected
111:             * @param event
112:             *            the key event
113:             * @return the cell which is highlighted next or <code>null</code> if the
114:             *         default implementation is taken. E.g. it's fairly impossible to
115:             *         react on PAGE_DOWN requests
116:             */
117:            public ViewerCell findSelectedCell(ColumnViewer viewer,
118:                    ViewerCell currentSelectedCell, Event event) {
119:
120:                switch (event.keyCode) {
121:                case SWT.ARROW_UP:
122:                    if (currentSelectedCell != null) {
123:                        return currentSelectedCell.getNeighbor(
124:                                ViewerCell.ABOVE, false);
125:                    }
126:                    break;
127:                case SWT.ARROW_DOWN:
128:                    if (currentSelectedCell != null) {
129:                        return currentSelectedCell.getNeighbor(
130:                                ViewerCell.BELOW, false);
131:                    }
132:                    break;
133:                case SWT.ARROW_LEFT:
134:                    if (currentSelectedCell != null) {
135:                        return currentSelectedCell.getNeighbor(ViewerCell.LEFT,
136:                                true);
137:                    }
138:                    break;
139:                case SWT.ARROW_RIGHT:
140:                    if (currentSelectedCell != null) {
141:                        return currentSelectedCell.getNeighbor(
142:                                ViewerCell.RIGHT, true);
143:                    }
144:                    break;
145:                }
146:
147:                return null;
148:            }
149:
150:            /**
151:             * This method is consulted to decide whether an event has to be canceled or
152:             * not. By default events who collapse/expand tree-nodes are canceled
153:             * 
154:             * @param viewer
155:             *            the viewer working for
156:             * @param event
157:             *            the event
158:             * @return <code>true</code> if the event has to be canceled
159:             */
160:            public boolean shouldCancelEvent(ColumnViewer viewer, Event event) {
161:                return event.keyCode == SWT.ARROW_LEFT
162:                        || event.keyCode == SWT.ARROW_RIGHT;
163:            }
164:
165:            /**
166:             * This method is called by the framework to initialize this navigation
167:             * strategy object. Subclasses may extend.
168:             */
169:            protected void init() {
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.