Source Code Cross Referenced for CollapsingBorderModel.java in  » Graphic-Library » fop » org » apache » fop » layoutmgr » table » 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.layoutmgr.table 
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: CollapsingBorderModel.java 433291 2006-08-21 17:18:37Z adelmelle $ */
019:
020:        package org.apache.fop.layoutmgr.table;
021:
022:        import org.apache.fop.fo.Constants;
023:        import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
024:        import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo;
025:
026:        /**
027:         * This class is a superclass for the two collapsing border models defined
028:         * in the XSL 1.0 specification.
029:         */
030:        public abstract class CollapsingBorderModel {
031:
032:            /** before side */
033:            protected static final int BEFORE = CommonBorderPaddingBackground.BEFORE;
034:            /** after side */
035:            protected static final int AFTER = CommonBorderPaddingBackground.AFTER;
036:            /** start side */
037:            protected static final int START = CommonBorderPaddingBackground.START;
038:            /** end side */
039:            protected static final int END = CommonBorderPaddingBackground.END;
040:
041:            /** Flag: current grid unit is either start or end of the table. */
042:            public static final int VERTICAL_START_END_OF_TABLE = 1;
043:
044:            /** Indicates that the cell is/starts in the first row being painted on a particular page */
045:            //public static final int FIRST_ROW_IN_TABLE_PART = 1;
046:            /** Indicates that the cell is/ends in the last row being painted on a particular page */
047:            //public static final int LAST_ROW_IN_TABLE_PART  = 2;
048:            /** Indicates that the cell is/starts in the first row of a body/table-header/table-footer */
049:            //public static final int FIRST_ROW_IN_GROUP      = 4;
050:            /** Indicates that the cell is/end in the last row of a body/table-header/table-footer */
051:            //public static final int LAST_ROW_IN_GROUP       = 8;
052:            //These statics are used singleton-style. No MT issues here.
053:            private static CollapsingBorderModel collapse = null;
054:            private static CollapsingBorderModel collapseWithPrecedence = null;
055:
056:            /**
057:             * @param borderCollapse border collapse control
058:             * @return the border model for the cell
059:             */
060:            public static CollapsingBorderModel getBorderModelFor(
061:                    int borderCollapse) {
062:                switch (borderCollapse) {
063:                case Constants.EN_COLLAPSE:
064:                    if (collapse == null) {
065:                        collapse = new CollapsingBorderModelEyeCatching();
066:                    }
067:                    return collapse;
068:                case Constants.EN_COLLAPSE_WITH_PRECEDENCE:
069:                    if (collapseWithPrecedence == null) {
070:                        //collapseWithPrecedence = new CollapsingBorderModelWithPrecedence();
071:                    }
072:                    return collapseWithPrecedence;
073:                default:
074:                    throw new IllegalArgumentException(
075:                            "Illegal border-collapse mode.");
076:                }
077:            }
078:
079:            /**
080:             * @param side the side on the current cell
081:             * @return the adjacent side on the neighbouring cell
082:             */
083:            public static int getOtherSide(int side) {
084:                switch (side) {
085:                case CommonBorderPaddingBackground.BEFORE:
086:                    return CommonBorderPaddingBackground.AFTER;
087:                case CommonBorderPaddingBackground.AFTER:
088:                    return CommonBorderPaddingBackground.BEFORE;
089:                case CommonBorderPaddingBackground.START:
090:                    return CommonBorderPaddingBackground.END;
091:                case CommonBorderPaddingBackground.END:
092:                    return CommonBorderPaddingBackground.START;
093:                default:
094:                    throw new IllegalArgumentException(
095:                            "Illegal parameter: side");
096:                }
097:            }
098:
099:            /**
100:             * @param side the side to investigate
101:             * @return true if the adjacent cell is before or after
102:             */
103:            protected boolean isVerticalRelation(int side) {
104:                return (side == CommonBorderPaddingBackground.BEFORE || side == CommonBorderPaddingBackground.AFTER);
105:            }
106:
107:            /**
108:             * See rule 4 in 6.7.10 for the collapsing border model.
109:             * @param style the border style to get the preference value for
110:             * @return the preference value of the style
111:             */
112:            public int getPreferenceValue(int style) {
113:                switch (style) {
114:                case Constants.EN_DOUBLE:
115:                    return 0;
116:                case Constants.EN_SOLID:
117:                    return -1;
118:                case Constants.EN_DASHED:
119:                    return -2;
120:                case Constants.EN_DOTTED:
121:                    return -3;
122:                case Constants.EN_RIDGE:
123:                    return -4;
124:                case Constants.EN_OUTSET:
125:                    return -5;
126:                case Constants.EN_GROOVE:
127:                    return -6;
128:                case Constants.EN_INSET:
129:                    return -7;
130:                default:
131:                    throw new IllegalStateException("Illegal border style: "
132:                            + style);
133:                }
134:            }
135:
136:            /**
137:             * Determines the winning BorderInfo.
138:             * @param current grid unit of the current element
139:             * @param neighbour grid unit of the neighbouring element
140:             * @return the winning BorderInfo
141:             */
142:            public abstract BorderInfo determineWinner(GridUnit current,
143:                    GridUnit neighbour, int side, int flags);
144:
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.