Source Code Cross Referenced for IntroHTML.java in  » IDE-Eclipse » ui » org » eclipse » ui » internal » intro » impl » model » 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 » IDE Eclipse » ui » org.eclipse.ui.internal.intro.impl.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 2005 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.internal.intro.impl.model;
011:
012:        import org.eclipse.ui.internal.intro.impl.model.util.BundleUtil;
013:        import org.eclipse.ui.internal.intro.impl.util.Log;
014:        import org.osgi.framework.Bundle;
015:        import org.w3c.dom.Element;
016:        import org.w3c.dom.NodeList;
017:
018:        /**
019:         * An intro HTML element. Can have text and image as fall back. "type" attribute
020:         * in markup determines if it is inlined or not. if inlined, value of 'src' will
021:         * be treated as a snippet of HTML to emit 'in-place'. If 'embed', a valid
022:         * (full) HTML document will be embedded using HTML 'OBJECT' tag. Ecoding can be
023:         * specified for inline snippets.
024:         */
025:        public class IntroHTML extends AbstractTextElement {
026:
027:            protected static final String TAG_HTML = "html"; //$NON-NLS-1$
028:
029:            private static final String ATT_SRC = "src"; //$NON-NLS-1$
030:            /**
031:             * type must be "inline" or "embed".
032:             */
033:            private static final String ATT_TYPE = "type"; //$NON-NLS-1$
034:            // Default is UTF-8.
035:            private static final String ATT_ENCODING = "encoding"; //$NON-NLS-1$
036:
037:            private String src;
038:            private String html_type;
039:            private String encoding;
040:            private IntroImage introImage;
041:
042:            IntroHTML(Element element, Bundle bundle, String base) {
043:                super (element, bundle);
044:                src = getAttribute(element, ATT_SRC);
045:                html_type = getAttribute(element, ATT_TYPE);
046:                encoding = getAttribute(element, ATT_ENCODING);
047:                if (encoding == null)
048:                    encoding = "UTF-8"; //$NON-NLS-1$
049:                if (html_type != null && !html_type.equalsIgnoreCase("inline") //$NON-NLS-1$
050:                        && !html_type.equalsIgnoreCase("embed")) //$NON-NLS-1$
051:                    // if type is not correct, null it.
052:                    html_type = null;
053:
054:                // description will be null if there is no description element.
055:                introImage = getIntroImage(element, base);
056:
057:                // Resolve.
058:                src = BundleUtil.getResolvedResourceLocation(base, src, bundle);
059:            }
060:
061:            /**
062:             * Retruns the intro image element embedded in this element.
063:             */
064:            private IntroImage getIntroImage(Element element, String base) {
065:                try {
066:                    // There should only be one text element. Since elements where
067:                    // obtained by name, no point validating name.
068:                    NodeList imageElements = element
069:                            .getElementsByTagName(IntroImage.TAG_IMAGE);
070:                    if (imageElements.getLength() == 0)
071:                        // no contributions. done.
072:                        return null;
073:                    IntroImage image = new IntroImage((Element) imageElements
074:                            .item(0), getBundle(), base);
075:                    image.setParent(this );
076:                    return image;
077:                } catch (Exception e) {
078:                    Log.error(e.getMessage(), e);
079:                    return null;
080:                }
081:            }
082:
083:            /**
084:             * Returns the html type. Will be either "inline" or "embed". If not, null
085:             * will be returned as if the attibute was nto defined.
086:             * 
087:             * @return Returns the html type value.
088:             */
089:            public boolean isInlined() {
090:                return (html_type != null && html_type
091:                        .equalsIgnoreCase("inline")) ? true //$NON-NLS-1$
092:                        : false;
093:            }
094:
095:            /**
096:             * @return Returns the src.
097:             */
098:            public String getSrc() {
099:                return src;
100:            }
101:
102:            /**
103:             * @return Returns the encoding of the inlined file. This is not needed for
104:             *         embedded files. Default is UTF-8.
105:             */
106:            public String getInlineEncoding() {
107:                return encoding;
108:            }
109:
110:            /**
111:             * Returns the intro image used as a replacement if this HTML element fails.
112:             * May return null if there is no image child.
113:             * 
114:             * @return Returns the introImage.
115:             */
116:            public IntroImage getIntroImage() {
117:                return introImage;
118:            }
119:
120:            /*
121:             * (non-Javadoc)
122:             * 
123:             * @see org.eclipse.ui.internal.intro.impl.model.IntroElement#getType()
124:             */
125:            public int getType() {
126:                return AbstractIntroElement.HTML;
127:            }
128:
129:            /**
130:             * Deep copy since class has mutable objects.
131:             */
132:            public Object clone() throws CloneNotSupportedException {
133:                IntroHTML clone = (IntroHTML) super .clone();
134:                if (introImage != null) {
135:                    IntroImage cloneIntroImage = (IntroImage) introImage
136:                            .clone();
137:                    cloneIntroImage.setParent(clone);
138:                    clone.introImage = cloneIntroImage;
139:                }
140:                return clone;
141:            }
142:
143:        }
www._ja___v_a_2s___.__c___om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.