| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package tsukuba_bunko.peko.scenario.stage; |
| 20 |
|
|
| 21 |
|
import org.xml.sax.Attributes; |
| 22 |
|
import org.xml.sax.SAXException; |
| 23 |
|
|
| 24 |
|
import tsukuba_bunko.peko.scenario.HandlerRegistry; |
| 25 |
|
import tsukuba_bunko.peko.scenario.PSMLUtil; |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
public class AtOnceHandler extends StageElementHandler { |
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
0 |
private StageElementHandler _child = null; |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
0 |
private int _level = 0; |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
0 |
private String _effect = null; |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
0 |
private boolean _containsSlideOperation = false; |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
public AtOnceHandler() |
| 60 |
|
{ |
| 61 |
0 |
super(); |
| 62 |
0 |
} |
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
public void startDocument() |
| 69 |
|
{ |
| 70 |
0 |
_child = null; |
| 71 |
0 |
_level = 0; |
| 72 |
0 |
_containsSlideOperation = false; |
| 73 |
0 |
super.startDocument(); |
| 74 |
0 |
} |
| 75 |
|
|
| 76 |
|
public void endDocument() |
| 77 |
|
{ |
| 78 |
0 |
StageCoordinator coordinator = getStageCoordinator(); |
| 79 |
0 |
if( _effect == null ) { |
| 80 |
0 |
coordinator.updateStage(); |
| 81 |
0 |
} |
| 82 |
|
else { |
| 83 |
0 |
if( !coordinator.isSlideVisible() || _containsSlideOperation ) { |
| 84 |
0 |
coordinator.updateStage( _effect ); |
| 85 |
|
} |
| 86 |
|
} |
| 87 |
0 |
super.endDocument(); |
| 88 |
0 |
} |
| 89 |
|
|
| 90 |
|
public void startElement( String namespaceURI, String localName, String qName, Attributes attrs ) |
| 91 |
|
throws SAXException |
| 92 |
|
{ |
| 93 |
0 |
if( _child != null ) { |
| 94 |
0 |
_level++; |
| 95 |
0 |
_child.startElement( namespaceURI, localName, qName, attrs ); |
| 96 |
0 |
} |
| 97 |
0 |
else if( localName.equals("at-once") ) { |
| 98 |
0 |
_effect = PSMLUtil.getAttributeValue( attrs, "effect" ); |
| 99 |
0 |
} |
| 100 |
|
else { |
| 101 |
0 |
HandlerRegistry registry = getSceneContext().getSceneProcessor().getHandlerRegistry(); |
| 102 |
0 |
_child = (StageElementHandler)registry.getElementHandler( namespaceURI, localName ); |
| 103 |
0 |
if( _child instanceof SlideHandler ) { |
| 104 |
0 |
_containsSlideOperation = true; |
| 105 |
|
} |
| 106 |
0 |
if( _child != null ) { |
| 107 |
0 |
_child.setParentHandler( this ); |
| 108 |
0 |
_child.setSceneContext( getSceneContext() ); |
| 109 |
0 |
_child.startDocument(); |
| 110 |
0 |
_level++; |
| 111 |
0 |
_child.startElement( namespaceURI, localName, qName, attrs ); |
| 112 |
|
} |
| 113 |
|
} |
| 114 |
0 |
} |
| 115 |
|
|
| 116 |
|
public void endElement( String namespaceURI, String localName, String qName ) |
| 117 |
|
throws SAXException |
| 118 |
|
{ |
| 119 |
0 |
if( _child != null ) { |
| 120 |
0 |
_level--; |
| 121 |
0 |
_child.endElement( namespaceURI, localName, qName ); |
| 122 |
0 |
if( _level == 0 ) { |
| 123 |
0 |
_child.endDocument(); |
| 124 |
0 |
_child.setParentHandler( null ); |
| 125 |
0 |
_child.setSceneContext( null ); |
| 126 |
0 |
_child = null; |
| 127 |
|
} |
| 128 |
|
} |
| 129 |
0 |
} |
| 130 |
|
} |