Source Code Cross Referenced for LengthBase.java in  » Graphic-Library » fop » org » apache » fop » datatypes » 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.datatypes 
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: LengthBase.java 495371 2007-01-11 21:03:07Z adelmelle $ */
019:
020:        package org.apache.fop.datatypes;
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:        import org.apache.fop.fo.Constants;
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.fo.flow.Character;
029:        import org.apache.fop.fo.flow.ExternalGraphic;
030:        import org.apache.fop.fo.flow.InstreamForeignObject;
031:        import org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager;
032:
033:        /**
034:         * Models a length which can be used as a factor in a percentage length
035:         * calculation
036:         */
037:        public class LengthBase implements  PercentBase {
038:            // Standard kinds of percent-based length
039:            /** constant for a custom percent-based length */
040:            public static final int CUSTOM_BASE = 0;
041:            /** constant for a font-size percent-based length */
042:            public static final int FONTSIZE = 1;
043:            /** constant for an inh font-size percent-based length */
044:            public static final int INH_FONTSIZE = 2;
045:            /** constant for a containing box percent-based length */
046:            public static final int PARENT_AREA_WIDTH = 3;
047:            /** constant for a containing refarea percent-based length */
048:            public static final int CONTAINING_REFAREA_WIDTH = 4;
049:            /** constant for a containing block percent-based length */
050:            public static final int CONTAINING_BLOCK_WIDTH = 5;
051:            /** constant for a containing block percent-based length */
052:            public static final int CONTAINING_BLOCK_HEIGHT = 6;
053:            /** constant for a image intrinsic percent-based length */
054:            public static final int IMAGE_INTRINSIC_WIDTH = 7;
055:            /** constant for a image intrinsic percent-based length */
056:            public static final int IMAGE_INTRINSIC_HEIGHT = 8;
057:            /** constant for a image background position horizontal percent-based length */
058:            public static final int IMAGE_BACKGROUND_POSITION_HORIZONTAL = 9;
059:            /** constant for a image background position vertical percent-based length */
060:            public static final int IMAGE_BACKGROUND_POSITION_VERTICAL = 10;
061:            /** constant for a table-unit-based length */
062:            public static final int TABLE_UNITS = 11;
063:            /** constant for a alignment adjust percent-based length */
064:            public static final int ALIGNMENT_ADJUST = 12;
065:
066:            /**
067:             * logging instance
068:             */
069:            protected static Log log = LogFactory.getLog(LengthBase.class);
070:
071:            /**
072:             * The FO for which this property is to be calculated.
073:             */
074:            protected/* final */FObj fobj;
075:
076:            /**
077:             * One of the defined types of LengthBase
078:             */
079:            private/* final */int baseType;
080:
081:            /** For percentages based on other length properties */
082:            private Length baseLength;
083:
084:            /**
085:             * Constructor
086:             * @param parentFO parent FO for this
087:             * @param plist property list for this
088:             * @param baseType a constant defining the type of teh percent base
089:             * @throws PropertyException In case an problem occurs while evaluating values
090:             */
091:            public LengthBase(PropertyList plist, int baseType)
092:                    throws PropertyException {
093:                this .fobj = plist.getFObj();
094:                this .baseType = baseType;
095:                switch (baseType) {
096:                case FONTSIZE:
097:                    this .baseLength = plist.get(Constants.PR_FONT_SIZE)
098:                            .getLength();
099:                    break;
100:                case INH_FONTSIZE:
101:                    this .baseLength = plist
102:                            .getInherited(Constants.PR_FONT_SIZE).getLength();
103:                    break;
104:                default:
105:                    // TODO: pacify CheckStyle
106:                    // throw new RuntimeException();
107:                    break;
108:                }
109:            }
110:
111:            /**
112:             * @return the dimension of this object (always 1)
113:             */
114:            public int getDimension() {
115:                return 1;
116:            }
117:
118:            /**
119:             * @return the base value of this object (always 1.0)
120:             */
121:            public double getBaseValue() {
122:                return 1.0;
123:            }
124:
125:            /**
126:             * @see org.apache.fop.datatypes.PercentBase#getBaseLength(PercentBaseContext)
127:             */
128:            public int getBaseLength(PercentBaseContext context)
129:                    throws PropertyException {
130:                int baseLen = 0;
131:                if (context != null) {
132:                    if (baseType == FONTSIZE || baseType == INH_FONTSIZE) {
133:                        return baseLength.getValue(context);
134:                    }
135:                    baseLen = context.getBaseLength(baseType, fobj);
136:                } else {
137:                    log.error("getBaseLength called without context");
138:                }
139:                return baseLen;
140:            }
141:
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.