1 50 51 package org.openlaszlo.iv.flash.api; 52 53 import java.io.PrintStream ; 54 55 import java.awt.geom.Rectangle2D ; 56 57 import org.openlaszlo.iv.flash.util.*; 58 import org.openlaszlo.iv.flash.context.Context; 59 60 67 public abstract class FlashObject extends FlashItem { 68 69 79 private byte isConstant = (byte)0; 80 81 87 public abstract int getTag(); 88 89 98 public void collectDeps( DepsCollector dc ) {} 99 100 105 public void collectFonts( FontsCollector fc ) {} 106 107 122 public void generate( FlashOutput fob, DepsCollector dc ) { 123 dc.startCollect(); 126 collectDeps( dc ); 127 IVVector collected = dc.getCollected(); 128 for( int i=0; i<collected.size(); i++ ) { 130 FlashObject d = (FlashObject) collected.elementAt(i); 131 if( !dc.isGenerated(d) ) { 132 dc.addGenerated(d); 133 d.generate( fob, dc ); 134 } 135 } 136 dc.endCollect(); 137 write( fob ); 139 } 140 141 148 public void process( FlashFile file, Context context ) throws IVException {} 149 150 155 public boolean isProcessed() { 156 return true; 157 } 158 159 162 public void setProcessed() {} 163 164 172 public void apply( Context context ) {} 173 174 183 protected boolean _isConstant() { 184 return false; 185 } 186 187 protected void setConstant( boolean is_const ) { 188 isConstant = is_const? (byte)1: (byte)2; 189 } 190 191 199 public boolean isConstant() { 200 if( isConstant == (byte)0 ) { 201 isConstant = _isConstant()? (byte)1: (byte)2; 202 } 203 return isConstant == (byte)1; 204 } 205 206 213 public Rectangle2D getBounds() { 214 return null; 215 } 216 217 public void printContent( PrintStream out, String indent ) { 218 int tag = getTag(); 219 String name; 220 if( tag >= Tag.tagNames.length || tag < 0 ) name = "Unknown"; 221 else name = Tag.tagNames[tag]; 222 out.println( indent+"Tag: 0x"+Util.b2h(getTag())+" '"+name+"'" ); 223 } 224 225 protected FlashItem copyInto( FlashItem item, ScriptCopier copier ) { 226 super.copyInto( item, copier ); 227 ((FlashObject)item).isConstant = isConstant; 228 return item; 229 } 230 231 } 232 233 | Popular Tags |