Source Code Cross Referenced for FlashObject.java in  » Ajax » Laszlo-4.0.10 » org » openlaszlo » iv » flash » api » 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 » Ajax » Laszlo 4.0.10 » org.openlaszlo.iv.flash.api 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: FlashObject.java,v 1.3 2002/07/16 20:17:29 skavish Exp $
003:         *
004:         * ==========================================================================
005:         *
006:         * The JGenerator Software License, Version 1.0
007:         *
008:         * Copyright (c) 2000 Dmitry Skavish (skavish@usa.net). All rights reserved.
009:         *
010:         * Redistribution and use in source and binary forms, with or without
011:         * modification, are permitted provided that the following conditions are met:
012:         *
013:         * 1. Redistributions of source code must retain the above copyright
014:         *    notice, this list of conditions and the following disclaimer.
015:         *
016:         * 2. Redistributions in binary form must reproduce the above copyright
017:         *    notice, this list of conditions and the following disclaimer in
018:         *    the documentation and/or other materials provided with the
019:         *    distribution.
020:         *
021:         * 3. The end-user documentation included with the redistribution, if
022:         *    any, must include the following acknowlegement:
023:         *    "This product includes software developed by Dmitry Skavish
024:         *     (skavish@usa.net, http://www.flashgap.com/)."
025:         *    Alternately, this acknowlegement may appear in the software itself,
026:         *    if and wherever such third-party acknowlegements normally appear.
027:         *
028:         * 4. The name "The JGenerator" must not be used to endorse or promote
029:         *    products derived from this software without prior written permission.
030:         *    For written permission, please contact skavish@usa.net.
031:         *
032:         * 5. Products derived from this software may not be called "The JGenerator"
033:         *    nor may "The JGenerator" appear in their names without prior written
034:         *    permission of Dmitry Skavish.
035:         *
036:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         * DISCLAIMED.  IN NO EVENT SHALL DMITRY SKAVISH OR THE OTHER
040:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         * SUCH DAMAGE.
048:         *
049:         */
050:
051:        package org.openlaszlo.iv.flash.api;
052:
053:        import java.io.PrintStream;
054:
055:        import java.awt.geom.Rectangle2D;
056:
057:        import org.openlaszlo.iv.flash.util.*;
058:        import org.openlaszlo.iv.flash.context.Context;
059:
060:        /**
061:         * Abstract base class for flash objects which can be placed on Flash timeline (usually tags) and generated back
062:         *
063:         * @author Dmitry Skavish
064:         * @see FlashDef
065:         * @see FlashItem
066:         */
067:        public abstract class FlashObject extends FlashItem {
068:
069:            /**
070:             * Defines whether this object is constant for generator processing or not<BR>
071:             * Possible values are:<BR>
072:             * <UL>
073:             * <LI>0 - it is not known yet whether this object is constant or not
074:             * <LI>1 - this object is constant
075:             * <LI>2 - this object is not a constant
076:             *
077:             * @see #isConstant
078:             */
079:            private byte isConstant = (byte) 0;
080:
081:            /**
082:             * Returns tag id of this object
083:             *
084:             * @return tag id of this object
085:             * @see org.openlaszlo.iv.flash.util.Tag
086:             */
087:            public abstract int getTag();
088:
089:            /**
090:             * Collects all dependencies this objects has in given {@link DepsCollector}<br>
091:             * For example object of {@link org.openlaszlo.iv.flash.api.button.Button Button} class depends on objects of
092:             * {@link FlashDef} class, i.e. consists of flash definitions.
093:             * It means that all objects this object depends on have to be generated
094:             * <B>before</B> this object is generated.
095:             *
096:             * @param dc     collector of dependent objects
097:             */
098:            public void collectDeps(DepsCollector dc) {
099:            }
100:
101:            /**
102:             * Collects all possible fonts this object uses (if any)
103:             *
104:             * @param fc     fonts collector
105:             */
106:            public void collectFonts(FontsCollector fc) {
107:            }
108:
109:            /**
110:             * Generates this object to FlashOutput, but first generates all dependencies<br>
111:             * Usually you don't need to override this method<BR>
112:             * Method:<BR>
113:             * <UL>
114:             * <LI>collects all dependencies of this object
115:             * <LI>writes these dependencies first to FlashOutput
116:             * <LI>writes this object itself
117:             * </UL>
118:             *
119:             * @param fob    buffer to write to
120:             * @param dc     dependencies collector
121:             * @see #write
122:             * @see #collectDeps
123:             */
124:            public void generate(FlashOutput fob, DepsCollector dc) {
125:                //Object id = this instanceof FlashDef?(Object)new Integer(((FlashDef)this).getID()):(Object)this;
126:                //System.out.println( "FlashObject.generate: ID="+id );
127:                dc.startCollect();
128:                collectDeps(dc);
129:                IVVector collected = dc.getCollected();
130:                //System.out.println( "generate collected:" );
131:                for (int i = 0; i < collected.size(); i++) {
132:                    FlashObject d = (FlashObject) collected.elementAt(i);
133:                    if (!dc.isGenerated(d)) {
134:                        dc.addGenerated(d);
135:                        d.generate(fob, dc);
136:                    }
137:                }
138:                dc.endCollect();
139:                //System.out.println( "FlashObject.write: ID="+id );
140:                write(fob);
141:            }
142:
143:            /**
144:             * Processes this flash object in specified context and flash file
145:             *
146:             * @param file    flash file
147:             * @param context generator context
148:             * @exception IVException
149:             */
150:            public void process(FlashFile file, Context context)
151:                    throws IVException {
152:            }
153:
154:            /**
155:             * Returns true of this object was processed
156:             *
157:             * @return true of this object was processed
158:             */
159:            public boolean isProcessed() {
160:                return true;
161:            }
162:
163:            /**
164:             * Sets this object as processed
165:             */
166:            public void setProcessed() {
167:            }
168:
169:            /**
170:             * Applies given context to this object<BR>
171:             * If this object is not constant ({@link #isConstant})
172:             * then it may be altered by generator context if it has generator variables
173:             * somewhere inside.<BR>
174:             *
175:             * @param context generator context to be applied to this object
176:             */
177:            public void apply(Context context) {
178:            }
179:
180:            /**
181:             * Returns true if this object is not subject to generator substitutions or commands<BR>
182:             * Override this method if you know the dynamic nature of content of your object and want
183:             * to avoid unneccesary copying or/and execution.<BR>
184:             * Constant objects are not duplicated and are not processed by generator.<BR>
185:             *
186:             * @return true if object is constant
187:             * @see #isConstant
188:             */
189:            protected boolean _isConstant() {
190:                return false;
191:            }
192:
193:            protected void setConstant(boolean is_const) {
194:                isConstant = is_const ? (byte) 1 : (byte) 2;
195:            }
196:
197:            /**
198:             * Returns true if this object is not subject to generator substitutions or commands<BR>
199:             * You usually don't need to override this method, this method is merely a cache for
200:             * {@link #_isConstant} method.
201:             *
202:             * @return true if object is constant
203:             * @see #isConstant
204:             */
205:            public boolean isConstant() {
206:                if (isConstant == (byte) 0) {
207:                    isConstant = _isConstant() ? (byte) 1 : (byte) 2;
208:                }
209:                return isConstant == (byte) 1;
210:            }
211:
212:            /**
213:             * Returns rectangular bounds of this object<BR>
214:             * It's ok to return null if this object does not have any bounds,
215:             * as for example {@link org.openlaszlo.iv.flash.api.action.DoAction}
216:             *
217:             * @return bounds of this object or null
218:             */
219:            public Rectangle2D getBounds() {
220:                return null;
221:            }
222:
223:            public void printContent(PrintStream out, String indent) {
224:                int tag = getTag();
225:                String name;
226:                if (tag >= Tag.tagNames.length || tag < 0)
227:                    name = "Unknown";
228:                else
229:                    name = Tag.tagNames[tag];
230:                out.println(indent + "Tag: 0x" + Util.b2h(getTag()) + " '"
231:                        + name + "'");
232:            }
233:
234:            protected FlashItem copyInto(FlashItem item, ScriptCopier copier) {
235:                super .copyInto(item, copier);
236:                ((FlashObject) item).isConstant = isConstant;
237:                return item;
238:            }
239:
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.