Source Code Cross Referenced for ColorProperty.java in  » Graphic-Library » fop » org » apache » fop » fo » properties » 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 » Graphic Library » fop » org.apache.fop.fo.properties 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /* $Id: ColorTypeProperty.java 377045 2006-02-11 20:23:47Z jeremias $ */
019:
020:        package org.apache.fop.fo.properties;
021:
022:        import java.awt.Color;
023:
024:        import org.apache.fop.apps.FOUserAgent;
025:        import org.apache.fop.fo.FObj;
026:        import org.apache.fop.fo.PropertyList;
027:        import org.apache.fop.fo.expr.PropertyException;
028:        import org.apache.fop.util.ColorUtil;
029:
030:        /**
031:         * Superclass for properties that wrap Color values
032:         */
033:        public class ColorProperty extends Property {
034:
035:            /**
036:             * The color represented by this property.
037:             */
038:            protected final Color color;
039:
040:            /**
041:             * Inner class for creating instances of ColorTypeProperty
042:             */
043:            public static class Maker extends PropertyMaker {
044:
045:                /**
046:                 * @param propId the id of the property for which a Maker should be created
047:                 */
048:                public Maker(int propId) {
049:                    super (propId);
050:                }
051:
052:                /**
053:                 * Return a ColorProperty object based on the passed Property object.
054:                 * This method is called if the Property object built by the parser
055:                 * isn't the right type for this property.
056:                 * 
057:                 * @param p
058:                 *            The Property object return by the expression parser
059:                 * @param propertyList
060:                 *            The PropertyList object being built for this FO.
061:                 * @param fo
062:                 *            The parent FO for the FO whose property is being made.
063:                 * @return A Property of the correct type or null if the parsed value
064:                 *         can't be converted to the correct type.
065:                 * @throws PropertyException
066:                 *             for invalid or inconsistent FO input
067:                 * @see org.apache.fop.fo.properties.PropertyMaker#convertProperty(
068:                 *          org.apache.fop.fo.properties.Property,
069:                 *      org.apache.fop.fo.PropertyList, org.apache.fop.fo.FObj)
070:                 */
071:                public Property convertProperty(Property p,
072:                        PropertyList propertyList, FObj fo)
073:                        throws PropertyException {
074:                    if (p instanceof  ColorProperty) {
075:                        return p;
076:                    }
077:                    FObj fobj = (fo == null ? propertyList.getFObj() : fo);
078:                    FOUserAgent ua = (fobj == null ? null : fobj.getUserAgent());
079:                    Color val = p.getColor(ua);
080:                    if (val != null) {
081:                        return new ColorProperty(val);
082:                    }
083:                    return convertPropertyDatatype(p, propertyList, fo);
084:                }
085:
086:            }
087:
088:            /**
089:             * Set the color given a particular String. For a full List of supported
090:             * values please see ColorUtil.
091:             * 
092:             * @param foUserAgent FOP user agent
093:             * @param value RGB value as String to be parsed
094:             * @throws PropertyException if the value can't be parsed
095:             * @see ColorUtil#parseColorString(String)
096:             */
097:            public ColorProperty(FOUserAgent foUserAgent, String value)
098:                    throws PropertyException {
099:                this .color = ColorUtil.parseColorString(foUserAgent, value);
100:            }
101:
102:            /**
103:             * Create a new ColorProperty with a given color.
104:             * 
105:             * @param value the color to use.
106:             */
107:            public ColorProperty(Color value) {
108:                this .color = value;
109:            }
110:
111:            /**
112:             * Returns an AWT instance of this color
113:             * @param foUserAgent FOP user agent
114:             * @return float the AWT color represented by this ColorType instance
115:             */
116:            public Color getColor(FOUserAgent foUserAgent) {
117:                return color;
118:            }
119:
120:            /**
121:             * @see java.lang.Object#toString()
122:             */
123:            public String toString() {
124:                return ColorUtil.colorToString(color);
125:            }
126:
127:            /**
128:             * Can't convert to any other types
129:             * @return this.colorType
130:             */
131:            public ColorProperty getColorProperty() {
132:                return this ;
133:            }
134:
135:            /**
136:             * @return this.colorType cast as an Object
137:             */
138:            public Object getObject() {
139:                return this;
140:            }
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.