Source Code Cross Referenced for FxImageMetadataImpl.java in  » J2EE » fleXive » com » flexive » shared » media » impl » 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 » J2EE » fleXive » com.flexive.shared.media.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2008
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.shared.media.impl;
034:
035:        import com.flexive.shared.media.FxImageMetadata;
036:        import com.flexive.shared.media.FxMediaType;
037:        import com.flexive.shared.FxXMLUtils;
038:        import static com.flexive.shared.FxXMLUtils.writeSimpleTag;
039:
040:        import javax.xml.stream.XMLStreamWriter;
041:        import javax.xml.stream.XMLStreamException;
042:        import java.awt.color.ICC_Profile;
043:        import java.util.List;
044:
045:        /**
046:         * Image metadata
047:         *
048:         * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
049:         * @version $Rev
050:         */
051:        public class FxImageMetadataImpl extends FxImageMetadata {
052:            private String mimeType;
053:            private String filename;
054:            private List<FxMetadataItem> metadata;
055:            private int width;
056:            private int height;
057:            private String format;
058:            private String formatDescription;
059:            private String compressionAlgorithm;
060:            private double xResolution;
061:            private double yResolution;
062:            private String colorType;
063:            private boolean usePalette;
064:            private int bpp;
065:            private boolean progressive;
066:            private boolean transparent;
067:            private ICC_Profile icc;
068:
069:            private static final double DEFAULT_RESOLUTION = 72.0d;
070:
071:            public FxImageMetadataImpl(String mimeType, String filename,
072:                    List<FxMetadataItem> metadata, int width, int height,
073:                    String format, String formatDescription,
074:                    String compressionAlgorithm, double xResolution,
075:                    double yResolution, String colorType, boolean usePalette,
076:                    int bpp, boolean progressive, boolean transparent,
077:                    ICC_Profile icc) {
078:                this .mimeType = mimeType;
079:                this .filename = filename;
080:                this .metadata = metadata;
081:                this .width = width;
082:                this .height = height;
083:                this .format = format;
084:                this .formatDescription = formatDescription;
085:                if (compressionAlgorithm != null) {
086:                    if (compressionAlgorithm.startsWith("RLE"))
087:                        compressionAlgorithm = "RLE";
088:                    else if (compressionAlgorithm.startsWith("PNG"))
089:                        compressionAlgorithm = "PNG";
090:                    else if (compressionAlgorithm.startsWith("CCITT Group 3"))
091:                        compressionAlgorithm = "CCITT_GROUP_3 ";
092:                    else if (compressionAlgorithm.startsWith("CCITT Group 4"))
093:                        compressionAlgorithm = "CCITT_GROUP_3 ";
094:                    else if (compressionAlgorithm.equals("CCITT 1D"))
095:                        compressionAlgorithm = "CCITT_GROUP_1D ";
096:                }
097:                this .compressionAlgorithm = compressionAlgorithm;
098:                if (xResolution < 0)
099:                    this .xResolution = DEFAULT_RESOLUTION;
100:                else
101:                    this .xResolution = xResolution;
102:                if (yResolution < 0)
103:                    this .yResolution = DEFAULT_RESOLUTION;
104:                else
105:                    this .yResolution = yResolution;
106:                this .colorType = colorType;
107:                this .usePalette = usePalette;
108:                this .bpp = bpp;
109:                this .progressive = progressive;
110:                this .transparent = transparent;
111:                this .icc = icc;
112:
113:            }
114:
115:            /**
116:             * {@inheritDoc}
117:             */
118:            public FxMediaType getMediaType() {
119:                return FxMediaType.Image;
120:            }
121:
122:            /**
123:             * {@inheritDoc}
124:             */
125:            public String getMimeType() {
126:                return mimeType;
127:            }
128:
129:            /**
130:             * {@inheritDoc}
131:             */
132:            public String getFilename() {
133:                return filename;
134:            }
135:
136:            /**
137:             * {@inheritDoc}
138:             */
139:            public List<FxMetadataItem> getMetadata() {
140:                return metadata;
141:            }
142:
143:            /**
144:             * {@inheritDoc}
145:             */
146:            public int getWidth() {
147:                return width;
148:            }
149:
150:            /**
151:             * {@inheritDoc}
152:             */
153:            public int getHeight() {
154:                return height;
155:            }
156:
157:            /**
158:             * {@inheritDoc}
159:             */
160:            public String getFormat() {
161:                return format;
162:            }
163:
164:            /**
165:             * {@inheritDoc}
166:             */
167:            public String getFormatDescription() {
168:                return formatDescription;
169:            }
170:
171:            /**
172:             * {@inheritDoc}
173:             */
174:            public String getCompressionAlgorithm() {
175:                return compressionAlgorithm;
176:            }
177:
178:            /**
179:             * {@inheritDoc}
180:             */
181:            public double getXResolution() {
182:                return xResolution;
183:            }
184:
185:            /**
186:             * {@inheritDoc}
187:             */
188:            public double getYResolution() {
189:                return yResolution;
190:            }
191:
192:            /**
193:             * {@inheritDoc}
194:             */
195:            public String getColorType() {
196:                return colorType;
197:            }
198:
199:            /**
200:             * {@inheritDoc}
201:             */
202:            public boolean usePalette() {
203:                return usePalette;
204:            }
205:
206:            /**
207:             * {@inheritDoc}
208:             */
209:            public int getBitsPerPixel() {
210:                return bpp;
211:            }
212:
213:            /**
214:             * {@inheritDoc}
215:             */
216:            public boolean isProgressive() {
217:                return progressive;
218:            }
219:
220:            /**
221:             * {@inheritDoc}
222:             */
223:            public boolean isTransparent() {
224:                return transparent;
225:            }
226:
227:            /**
228:             * {@inheritDoc}
229:             */
230:            public boolean hasICC_Profile() {
231:                return icc != null;
232:            }
233:
234:            /**
235:             * {@inheritDoc}
236:             */
237:            public ICC_Profile getICC_Profile() {
238:                return icc;
239:            }
240:
241:            /**
242:             * {@inheritDoc}
243:             */
244:            protected void writeXMLTags(XMLStreamWriter writer)
245:                    throws XMLStreamException {
246:                writer.writeStartElement("imageData");
247:                writeSimpleTag(writer, "width", getWidth(), false);
248:                writeSimpleTag(writer, "height", getHeight(), false);
249:                writeSimpleTag(writer, "bpp", getBitsPerPixel(), false);
250:                writeSimpleTag(writer, "colorType", getColorType(), true);
251:                writeSimpleTag(writer, "compressionAlgorithm",
252:                        getCompressionAlgorithm(), true);
253:                writeSimpleTag(writer, "format", getFormat(), true);
254:                writeSimpleTag(writer, "formatDescription",
255:                        getFormatDescription(), true);
256:                writeSimpleTag(writer, "xResolution", getXResolution(), false);
257:                writeSimpleTag(writer, "yResolution", getYResolution(), false);
258:                writer.writeEndElement();
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.