Source Code Cross Referenced for Bookmark.java in  » Graphic-Library » fop » org » apache » fop » fo » pagination » bookmarks » 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.pagination.bookmarks 
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 $ */
019:
020:        package org.apache.fop.fo.pagination.bookmarks;
021:
022:        import java.util.ArrayList;
023:        import org.xml.sax.Locator;
024:        import org.apache.fop.apps.FOPException;
025:        import org.apache.fop.fo.FObj;
026:        import org.apache.fop.fo.FONode;
027:        import org.apache.fop.fo.PropertyList;
028:        import org.apache.fop.fo.ValidationException;
029:        import org.apache.fop.fo.properties.CommonAccessibility;
030:
031:        /**
032:         * The fo:bookmark formatting object, first introduced in the 
033:         * XSL 1.1 WD.  Prototype version only, subject to change as
034:         * XSL 1.1 WD evolves.
035:         */
036:        public class Bookmark extends FObj {
037:            private BookmarkTitle bookmarkTitle;
038:            private ArrayList childBookmarks = new ArrayList();
039:
040:            // The value of properties relevant for this FO
041:            private CommonAccessibility commonAccessibility;
042:            private String internalDestination;
043:            private String externalDestination;
044:            private boolean bShow = true; // from starting-state property
045:
046:            /**
047:             * Create a new bookmark object.
048:             *
049:             * @param parent the parent fo node
050:             */
051:            public Bookmark(FONode parent) {
052:                super (parent);
053:            }
054:
055:            /**
056:             * @see org.apache.fop.fo.FObj#bind(PropertyList)
057:             */
058:            public void bind(PropertyList pList) throws FOPException {
059:                commonAccessibility = pList.getAccessibilityProps();
060:                externalDestination = pList.get(PR_EXTERNAL_DESTINATION)
061:                        .getString();
062:                internalDestination = pList.get(PR_INTERNAL_DESTINATION)
063:                        .getString();
064:                bShow = (pList.get(PR_STARTING_STATE).getEnum() == EN_SHOW);
065:
066:                // per spec, internal takes precedence if both specified        
067:                if (internalDestination.length() > 0) {
068:                    externalDestination = null;
069:                } else if (externalDestination.length() == 0) {
070:                    // slightly stronger than spec "should be specified"
071:                    attributeError("Missing attribute:  Either external-destination or "
072:                            + "internal-destination must be specified.");
073:                } else {
074:                    attributeWarning("external-destination property not currently supported");
075:                }
076:            }
077:
078:            /**
079:             * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
080:                XSL/FOP: (bookmark-title, bookmark*)
081:             */
082:            protected void validateChildNode(Locator loc, String nsURI,
083:                    String localName) throws ValidationException {
084:                if (FO_URI.equals(nsURI) && localName.equals("bookmark-title")) {
085:                    if (bookmarkTitle != null) {
086:                        tooManyNodesError(loc, "fo:bookmark-title");
087:                    }
088:                } else if (FO_URI.equals(nsURI) && localName.equals("bookmark")) {
089:                    if (bookmarkTitle == null) {
090:                        nodesOutOfOrderError(loc, "fo:bookmark-title",
091:                                "fo:bookmark");
092:                    }
093:                } else {
094:                    invalidChildError(loc, nsURI, localName);
095:                }
096:            }
097:
098:            /**
099:             * @see org.apache.fop.fo.FONode#endOfNode
100:             */
101:            protected void endOfNode() throws FOPException {
102:                if (bookmarkTitle == null) {
103:                    missingChildElementError("(bookmark-title, bookmark*)");
104:                }
105:            }
106:
107:            /**
108:             * @see org.apache.fop.fo.FONode#addChildNode(FONode)
109:             */
110:            protected void addChildNode(FONode obj) {
111:                if (obj instanceof  BookmarkTitle) {
112:                    bookmarkTitle = (BookmarkTitle) obj;
113:                } else if (obj instanceof  Bookmark) {
114:                    childBookmarks.add(obj);
115:                }
116:            }
117:
118:            /**
119:             * Get the bookmark title for this bookmark
120:             *
121:             * @return the bookmark title string or an empty string if not found
122:             */
123:            public String getBookmarkTitle() {
124:                return bookmarkTitle == null ? "" : bookmarkTitle.getTitle();
125:            }
126:
127:            public String getInternalDestination() {
128:                return internalDestination;
129:            }
130:
131:            public String getExternalDestination() {
132:                return externalDestination;
133:            }
134:
135:            /**
136:             * Determines if this fo:bookmark's subitems should be initially displayed
137:             * or hidden, based on the starting-state property set on this FO.
138:             *
139:             * @return true if this bookmark's starting-state is "show", false if "hide".
140:             */
141:            public boolean showChildItems() {
142:                return bShow;
143:            }
144:
145:            public ArrayList getChildBookmarks() {
146:                return childBookmarks;
147:            }
148:
149:            /** @see org.apache.fop.fo.FONode#getLocalName() */
150:            public String getLocalName() {
151:                return "bookmark";
152:            }
153:
154:            /**
155:             * @see org.apache.fop.fo.FObj#getNameId()
156:             */
157:            public int getNameId() {
158:                return FO_BOOKMARK;
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.