Source Code Cross Referenced for JavaSourceConversionOptions.java in  » Code-Analyzer » Java2Html » de » java2html » options » 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 » Code Analyzer » Java2Html » de.java2html.options 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.java2html.options;
002:
003:        import java.io.IOException;
004:        import java.io.InputStream;
005:        import java.util.Properties;
006:
007:        import de.java2html.properties.ConversionOptionsPropertiesReader;
008:        import de.java2html.util.Ensure;
009:        import de.java2html.util.IllegalConfigurationException;
010:        import de.java2html.util.IoUtilities;
011:
012:        /**
013:         * Conversion options for customizing the output result. You can adjust the
014:         * output style of a {@link de.java2html.converter.AbstractJavaSourceConverter}by
015:         * changing the attributes of this object. The color and font style are defined
016:         * by the {@link de.java2html.options.JavaSourceStyleTable} associated with
017:         * this options.
018:         * 
019:         * @see #setStyleTable(JavaSourceStyleTable)
020:         * @see #getStyleTable()
021:         * @see de.java2html.converter.AbstractJavaSourceConverter
022:         * 
023:         * @author <a href="mailto:markus@jave.de">Markus Gebhard</a>
024:         * 
025:         * <code>Copyright (C) Markus Gebhard 2000-2003
026:         * 
027:         * This program is free software; you can redistribute it and/or
028:         *  * modify it under the terms of the GNU General Public License
029:         *  * as published by the Free Software Foundation; either version 2
030:         *  * of the License, or (at your option) any later version.
031:         * 
032:         * This program is distributed in the hope that it will be useful,
033:         *  * but WITHOUT ANY WARRANTY; without even the implied warranty of
034:         *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
035:         *  * GNU General Public License for more details.
036:         * 
037:         * You should have received a copy of the GNU General Public License
038:         *  * along with this program; if not, write to the Free Software
039:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.</code>
040:         */
041:        public class JavaSourceConversionOptions {
042:            //Attribute names for persistence (e.g. in the eclipse plugin
043:
044:            private static final String PROPERTIES_FILE_NAME = "java2html.properties"; //$NON-NLS-1$
045:            /**
046:             * @deprecated As of Dec 21, 2003 (Markus Gebhard), replaced by
047:             *             {@link IConversionOptionsConstants#TAB_SIZE}
048:             */
049:            public final static String TAB_SIZE = IConversionOptionsConstants.TAB_SIZE;
050:
051:            /**
052:             * @deprecated As of Dec 21, 2003 (Markus Gebhard), replaced by
053:             *             {@link IConversionOptionsConstants#SHOW_LINE_NUMBERS}
054:             */
055:            public final static String SHOW_LINE_NUMBERS = IConversionOptionsConstants.SHOW_LINE_NUMBERS;
056:
057:            /**
058:             * @deprecated As of Dec 21, 2003 (Markus Gebhard), replaced by
059:             *             {@link IConversionOptionsConstants#SHOW_FILE_NAME}
060:             */
061:            public final static String SHOW_FILE_NAME = IConversionOptionsConstants.SHOW_FILE_NAME;
062:
063:            /**
064:             * @deprecated As of Dec 21, 2003 (Markus Gebhard), replaced by
065:             *             {@link IConversionOptionsConstants#SHOW_TABLE_BORDER}
066:             */
067:            public final static String SHOW_TABLE_BORDER = IConversionOptionsConstants.SHOW_TABLE_BORDER;
068:
069:            private static JavaSourceConversionOptions defaultOptions;
070:
071:            public static JavaSourceConversionOptions getRawDefault() {
072:                return new JavaSourceConversionOptions();
073:            }
074:
075:            public static JavaSourceConversionOptions getDefault()
076:                    throws IllegalConfigurationException {
077:                if (defaultOptions == null) {
078:                    defaultOptions = createDefaultOptions();
079:                }
080:                return defaultOptions.getClone();
081:            }
082:
083:            private static JavaSourceConversionOptions createDefaultOptions()
084:                    throws IllegalConfigurationException {
085:                InputStream inputStream = JavaSourceConversionOptions.class
086:                        .getClassLoader().getResourceAsStream(
087:                                PROPERTIES_FILE_NAME);
088:                if (inputStream == null) {
089:                    return new JavaSourceConversionOptions();
090:                }
091:
092:                /* TODO: ClassLoader.getSystemResourceAsStream(PROPERTIES_FILE_NAME)
093:                 instead of
094:                 Java2HtmlConversionOptions.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE_NAME);
095:                 Will have to find out how I can make this compatible when using Java WebStart.
096:                 As far as I know using ClassLoader.getSystemResourceAsStream() will propbably not find 
097:                 resources that are defined in the JNLP file. Maybe I should use 
098:                 ClassLoader.getSystemResourceAsStream as fallback if there is no file found using the other
099:                 classloader... */
100:
101:                Properties properties = new Properties();
102:                try {
103:                    properties.load(inputStream);
104:                    return new ConversionOptionsPropertiesReader()
105:                            .read(properties);
106:                } catch (IOException exception) {
107:                    throw new IllegalConfigurationException(
108:                            "Error loading configuration file '" //$NON-NLS-1$
109:                                    + PROPERTIES_FILE_NAME + "' from classpath", exception); //$NON-NLS-1$
110:                } catch (IllegalArgumentException exception) {
111:                    throw new IllegalConfigurationException(
112:                            "Error loading configuration file '" //$NON-NLS-1$
113:                                    + PROPERTIES_FILE_NAME + "' from classpath", exception); //$NON-NLS-1$
114:                } finally {
115:                    IoUtilities.close(inputStream);
116:                }
117:            }
118:
119:            private JavaSourceStyleTable styleTable = JavaSourceStyleTable
120:                    .getDefault();
121:            private int tabSize = 2;
122:            private boolean showLineNumbers = false;
123:            private boolean showFileName = false;
124:            private boolean showTableBorder = false;
125:
126:            /**
127:             * Flag indication whether html output contains a link to the
128:             * Java2Html-Homepage or not.
129:             */
130:            private boolean showJava2HtmlLink = false;
131:            private boolean addLineAnchors = false;
132:            private String lineAnchorPrefix = ""; //$NON-NLS-1$
133:            private HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
134:
135:            private JavaSourceConversionOptions() {
136:                //nothing to do
137:            }
138:
139:            public boolean equals(Object obj) {
140:                if (!(obj instanceof  JavaSourceConversionOptions)) {
141:                    return false;
142:                }
143:                JavaSourceConversionOptions other = (JavaSourceConversionOptions) obj;
144:                return (other.tabSize == tabSize
145:                        && other.styleTable.equals(styleTable)
146:                        && other.showFileName == showFileName
147:                        && other.showJava2HtmlLink == showJava2HtmlLink
148:                        && other.showLineNumbers == showLineNumbers
149:                        && other.showTableBorder == showTableBorder && other.horizontalAlignment == horizontalAlignment);
150:            }
151:
152:            public int hashCode() {
153:                return styleTable.hashCode() + tabSize;
154:            }
155:
156:            public JavaSourceConversionOptions getClone() {
157:                JavaSourceConversionOptions options = new JavaSourceConversionOptions();
158:                options.styleTable = styleTable.getClone();
159:                options.tabSize = tabSize;
160:                options.showLineNumbers = showLineNumbers;
161:                options.showFileName = showFileName;
162:                options.showJava2HtmlLink = showJava2HtmlLink;
163:                options.showTableBorder = showTableBorder;
164:                options.horizontalAlignment = horizontalAlignment;
165:                return options;
166:            }
167:
168:            public void setStyleTable(JavaSourceStyleTable styleTable) {
169:                Ensure.ensureArgumentNotNull(styleTable);
170:                this .styleTable = styleTable;
171:            }
172:
173:            public JavaSourceStyleTable getStyleTable() {
174:                return styleTable;
175:            }
176:
177:            public int getTabSize() {
178:                return tabSize;
179:            }
180:
181:            public void setTabSize(int tabSize) {
182:                this .tabSize = tabSize;
183:            }
184:
185:            public boolean isShowLineNumbers() {
186:                return showLineNumbers;
187:            }
188:
189:            public void setShowLineNumbers(boolean showLineNumbers) {
190:                this .showLineNumbers = showLineNumbers;
191:            }
192:
193:            public boolean isShowFileName() {
194:                return showFileName;
195:            }
196:
197:            public boolean isShowTableBorder() {
198:                return showTableBorder;
199:            }
200:
201:            public void setShowFileName(boolean showFileName) {
202:                this .showFileName = showFileName;
203:            }
204:
205:            public void setShowTableBorder(boolean showTableBorder) {
206:                this .showTableBorder = showTableBorder;
207:            }
208:
209:            public boolean isAddLineAnchors() {
210:                return addLineAnchors;
211:            }
212:
213:            public String getLineAnchorPrefix() {
214:                return lineAnchorPrefix;
215:            }
216:
217:            public void setAddLineAnchors(boolean addLineAnchors) {
218:                this .addLineAnchors = addLineAnchors;
219:            }
220:
221:            public void setLineAnchorPrefix(String lineAnchorPrefix) {
222:                this .lineAnchorPrefix = lineAnchorPrefix;
223:            }
224:
225:            public HorizontalAlignment getHorizontalAlignment() {
226:                return horizontalAlignment;
227:            }
228:
229:            public void setHorizontalAlignment(
230:                    HorizontalAlignment horizontalAlignment) {
231:                Ensure.ensureArgumentNotNull(horizontalAlignment);
232:                this .horizontalAlignment = horizontalAlignment;
233:            }
234:
235:            public boolean isShowJava2HtmlLink() {
236:                return showJava2HtmlLink;
237:            }
238:
239:            public void setShowJava2HtmlLink(boolean isShowJava2HtmlLink) {
240:                this.showJava2HtmlLink = isShowJava2HtmlLink;
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.