Source Code Cross Referenced for ViewerFilter.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) 2000, 2006 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 java.util.ArrayList;
013:
014:        /**
015:         * A viewer filter is used by a structured viewer to
016:         * extract a subset of elements provided by its content provider.
017:         * <p>
018:         * Subclasses must implement the <code>select</code> method
019:         * and may implement the <code>isFilterProperty</code> method.
020:         * </p>
021:         * @see IStructuredContentProvider
022:         * @see StructuredViewer
023:         */
024:        public abstract class ViewerFilter {
025:            /**
026:             * Creates a new viewer filter.
027:             */
028:            protected ViewerFilter() {
029:            }
030:
031:            /**
032:             * Filters the given elements for the given viewer.
033:             * The input array is not modified.
034:             * <p>
035:             * The default implementation of this method calls 
036:             * <code>select</code> on each element in the array, 
037:             * and returns only those elements for which <code>select</code>
038:             * returns <code>true</code>.
039:             * </p>
040:             * @param viewer the viewer
041:             * @param parent the parent element
042:             * @param elements the elements to filter
043:             * @return the filtered elements
044:             */
045:            public Object[] filter(Viewer viewer, Object parent,
046:                    Object[] elements) {
047:                int size = elements.length;
048:                ArrayList out = new ArrayList(size);
049:                for (int i = 0; i < size; ++i) {
050:                    Object element = elements[i];
051:                    if (select(viewer, parent, element)) {
052:                        out.add(element);
053:                    }
054:                }
055:                return out.toArray();
056:            }
057:
058:            /**
059:             * Filters the given elements for the given viewer.
060:             * The input array is not modified.
061:             * <p>
062:             * The default implementation of this method calls 
063:             * {@link #filter(Viewer, Object, Object[])} with the 
064:             * parent from the path. Subclasses may override
065:             * </p>
066:             * @param viewer the viewer
067:             * @param parentPath the path of the parent element
068:             * @param elements the elements to filter
069:             * @return the filtered elements
070:             * @since 3.2
071:             */
072:            public Object[] filter(Viewer viewer, TreePath parentPath,
073:                    Object[] elements) {
074:                return filter(viewer, parentPath.getLastSegment(), elements);
075:            }
076:
077:            /**
078:             * Returns whether this viewer filter would be affected 
079:             * by a change to the given property of the given element.
080:             * <p>
081:             * The default implementation of this method returns <code>false</code>.
082:             * Subclasses should reimplement.
083:             * </p>
084:             *
085:             * @param element the element
086:             * @param property the property
087:             * @return <code>true</code> if the filtering would be affected,
088:             *    and <code>false</code> if it would be unaffected
089:             */
090:            public boolean isFilterProperty(Object element, String property) {
091:                return false;
092:            }
093:
094:            /**
095:             * Returns whether the given element makes it through this filter.
096:             *
097:             * @param viewer the viewer
098:             * @param parentElement the parent element
099:             * @param element the element
100:             * @return <code>true</code> if element is included in the
101:             *   filtered set, and <code>false</code> if excluded
102:             */
103:            public abstract boolean select(Viewer viewer, Object parentElement,
104:                    Object element);
105:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.