| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
package tsukuba_bunko.peko.scenario; |
| 10 |
|
|
| 11 |
|
import org.xml.sax.Attributes; |
| 12 |
|
import org.xml.sax.SAXException; |
| 13 |
|
|
| 14 |
|
import tsukuba_bunko.peko.PekoSystem; |
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
public abstract class ElementHandler { |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
public static final String NAMESPACE_SCENE = "http://tsukuba-bunko.org/ns/psml-scene"; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
0 |
protected SceneContext _context = null; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
0 |
protected ElementHandler _parent = null; |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
0 |
protected boolean _endOfScene = false; |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
protected ElementHandler() |
| 49 |
|
{ |
| 50 |
0 |
super(); |
| 51 |
0 |
} |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
public void setSceneContext( SceneContext context ) |
| 58 |
|
{ |
| 59 |
0 |
_context = context; |
| 60 |
0 |
} |
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
public SceneContext getSceneContext() |
| 67 |
|
{ |
| 68 |
0 |
return _context; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
public void setParentHandler( ElementHandler handler ) |
| 76 |
|
{ |
| 77 |
0 |
_parent = handler; |
| 78 |
0 |
} |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
public ElementHandler getParentHandler() |
| 85 |
|
{ |
| 86 |
0 |
return _parent; |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
protected void setEndOfScene( boolean end ) |
| 94 |
|
{ |
| 95 |
0 |
_endOfScene = end; |
| 96 |
0 |
} |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
public boolean isEndOfScene() |
| 103 |
|
{ |
| 104 |
0 |
return _endOfScene; |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
protected void stop( long wait ) |
| 112 |
|
{ |
| 113 |
0 |
if( _context != null ) { |
| 114 |
0 |
if( _context.getSceneProcessor().isAborted() ) { |
| 115 |
0 |
return; |
| 116 |
|
} |
| 117 |
0 |
tsukuba_bunko.peko.Logger.debug( "[scenario.handler] stop using ElementHandler#stop(wait)." ); |
| 118 |
0 |
PekoSystem.getInstance().getActionControler().stop( wait ); |
| 119 |
|
} |
| 120 |
0 |
} |
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
protected void stop() |
| 126 |
|
{ |
| 127 |
0 |
if( _context != null ) { |
| 128 |
0 |
if( _context.getSceneProcessor().isAborted() ) { |
| 129 |
0 |
return; |
| 130 |
|
} |
| 131 |
0 |
tsukuba_bunko.peko.Logger.debug( "[scenario.handler] stop using ElementHandler#stop()." ); |
| 132 |
0 |
PekoSystem.getInstance().getActionControler().stop(); |
| 133 |
|
} |
| 134 |
0 |
} |
| 135 |
|
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
public void startDocument() |
| 141 |
|
throws SAXException |
| 142 |
|
{ |
| 143 |
0 |
} |
| 144 |
|
|
| 145 |
|
public void endDocument() |
| 146 |
|
throws SAXException |
| 147 |
|
{ |
| 148 |
0 |
} |
| 149 |
|
|
| 150 |
|
public void startElement( String namespaceURI, String localName, String qName, Attributes attrs ) |
| 151 |
|
throws SAXException |
| 152 |
|
{ |
| 153 |
0 |
} |
| 154 |
|
|
| 155 |
|
public void endElement( String namespaceURI, String localName, String qName ) |
| 156 |
|
throws SAXException |
| 157 |
|
{ |
| 158 |
0 |
} |
| 159 |
|
|
| 160 |
|
public void characters( char[] ch, int begin, class="keyword">int length ) |
| 161 |
|
throws SAXException |
| 162 |
|
{ |
| 163 |
0 |
} |
| 164 |
|
} |