Source Code Cross Referenced for GraphicalDiffVisualizer.java in  » IDE-Netbeans » diff » org » netbeans » modules » diff » builtin » visualizer » 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 Netbeans » diff » org.netbeans.modules.diff.builtin.visualizer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.diff.builtin.visualizer;
043:
044:        import java.awt.Color;
045:        import java.awt.Component;
046:        import java.io.Reader;
047:        import java.io.Serializable;
048:
049:        import org.openide.NotifyDescriptor;
050:        import org.openide.util.NbBundle;
051:
052:        import org.netbeans.api.diff.Difference;
053:        import org.netbeans.spi.diff.DiffVisualizer;
054:        import org.openide.DialogDisplayer;
055:
056:        /**
057:         * The default graphical visualizer of diffs.
058:         *
059:         * @author  Martin Entlicher
060:         */
061:        public class GraphicalDiffVisualizer extends DiffVisualizer implements 
062:                Serializable {
063:
064:            private Color colorAdded = DiffComponent.COLOR_ADDED;
065:            private Color colorMissing = DiffComponent.COLOR_MISSING;
066:            private Color colorChanged = DiffComponent.COLOR_CHANGED;
067:
068:            static final long serialVersionUID = -1135210647457196211L;
069:
070:            /** Creates a new instance of BuiltInDiffVisualizer */
071:            public GraphicalDiffVisualizer() {
072:            }
073:
074:            /**
075:             * Get the display name of this diff visualizer.
076:             */
077:            public String getDisplayName() {
078:                return NbBundle.getMessage(GraphicalDiffVisualizer.class,
079:                        "GraphicalDiffVisualizer.displayName");
080:            }
081:
082:            /**
083:             * Get a short description of this diff visualizer.
084:             */
085:            public String getShortDescription() {
086:                return NbBundle.getMessage(GraphicalDiffVisualizer.class,
087:                        "GraphicalDiffVisualizer.shortDescription");
088:            }
089:
090:            /**
091:             * Some diff visualizers may have built-in the diff calculation. In such a case
092:             * the visualizer does not need any diff provider.
093:             * @return true when it relies on differences supplied, false if not.
094:             *
095:            public boolean needsProvider() {
096:                return true;
097:            }
098:             */
099:
100:            /**
101:             * Show the visual representation of the diff between two files.
102:             * @param diffs The list of differences (instances of {@link Difference}).
103:             *       may be <code>null</code> in case that it does not need diff provider.
104:             * @param fo1 the first FileObject
105:             * @param fo2 the second FileObject compared with the first one.
106:             * @return The TopComponent representing the diff visual representation
107:             *        or null, when the representation is outside the IDE.
108:             *
109:            public Component showDiff(List diffs, FileObject fo1, FileObject fo2) {
110:                DiffComponent diff;
111:                try {
112:                    diff = new DiffComponent(diffs, null, fo1.getMIMEType(),
113:                        fo1.getName(), fo2.getName(),
114:                        fo1.getPackageNameExt('/', '.'), fo2.getPackageNameExt('/', '.'),
115:                        new InputStreamReader(fo1.getInputStream()),
116:                        new InputStreamReader(fo2.getInputStream()));
117:                } catch (FileNotFoundException fnfex) {
118:                    org.openide.TopManager.getDefault().notifyException(fnfex);
119:                    return null;
120:                }
121:                return diff;
122:            }
123:             */
124:
125:            /**
126:             * Show the visual representation of the diff between two sources.
127:             * @param diffs The list of differences (instances of {@link Difference}).
128:             *       may be <code>null</code> in case that it does not need diff provider.
129:             * @param name1 the name of the first source
130:             * @param title1 the title of the first source
131:             * @param r1 the first source
132:             * @param name2 the name of the second source
133:             * @param title2 the title of the second source
134:             * @param r2 the second resource compared with the first one.
135:             * @param MIMEType the mime type of these sources
136:             * @return The TopComponent representing the diff visual representation
137:             *        or null, when the representation is outside the IDE.
138:             */
139:            public Component createView(Difference[] diffs, String name1,
140:                    String title1, Reader r1, String name2, String title2,
141:                    Reader r2, String MIMEType) {
142:                if (diffs.length == 0) {
143:                    DialogDisplayer.getDefault().notify(
144:                            new NotifyDescriptor.Message(NbBundle.getMessage(
145:                                    GraphicalDiffVisualizer.class,
146:                                    "MSG_NoDifference", name1, name2)));
147:                }
148:                DiffComponent diff;
149:                String componentName = name1;
150:                if (name2 != null && name2.length() > 0)
151:                    componentName = NbBundle.getMessage(
152:                            GraphicalDiffVisualizer.class,
153:                            "MSG_TwoFilesDiffTitle", componentName, name2);
154:                diff = new DiffComponent(diffs, componentName, MIMEType, name1,
155:                        name2, title1, title2, r1, r2, new Color[] {
156:                                colorMissing, colorAdded, colorChanged });
157:                return diff;
158:            }
159:
160:            /** Getter for property colorAdded.
161:             * @return Value of property colorAdded.
162:             */
163:            public java.awt.Color getColorAdded() {
164:                return colorAdded;
165:            }
166:
167:            /** Setter for property colorAdded.
168:             * @param colorAdded New value of property colorAdded.
169:             */
170:            public void setColorAdded(java.awt.Color colorAdded) {
171:                this .colorAdded = colorAdded;
172:            }
173:
174:            /** Getter for property colorMissing.
175:             * @return Value of property colorMissing.
176:             */
177:            public java.awt.Color getColorMissing() {
178:                return colorMissing;
179:            }
180:
181:            /** Setter for property colorMissing.
182:             * @param colorMissing New value of property colorMissing.
183:             */
184:            public void setColorMissing(java.awt.Color colorMissing) {
185:                this .colorMissing = colorMissing;
186:            }
187:
188:            /** Getter for property colorChanged.
189:             * @return Value of property colorChanged.
190:             */
191:            public java.awt.Color getColorChanged() {
192:                return colorChanged;
193:            }
194:
195:            /** Setter for property colorChanged.
196:             * @param colorChanged New value of property colorChanged.
197:             */
198:            public void setColorChanged(java.awt.Color colorChanged) {
199:                this.colorChanged = colorChanged;
200:            }
201:
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.