View Javadoc

    1   /*
    2    * All Rights Reserved.
    3    * Copyright (C) 1999-2005 Tsukuba Bunko.
    4    *
    5    * Licensed under the BSD License ("the License"); you may not use
    6    * this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    *       http://www.tsukuba-bunko.org/licenses/LICENSE.txt
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   * $Id: BackgroundHandler.java,v 1.2 2005/08/17 17:40:29 ppoi Exp $
    18   */
    19  package tsukuba_bunko.peko.scenario.stage;
    20
    21  import	org.xml.sax.Attributes;
    22
    23  import	tsukuba_bunko.peko.resource.ResourceManager;
    24
    25  import	tsukuba_bunko.peko.scenario.PSMLUtil;
    26
    27
    28  /***
    29   * <samp>background</samp> を処理する <code>ElementHandler</code> です。
    30   * @author	$Author: ppoi $
    31   * @version	$Revision: 1.2 $
    32   */
    33  public class BackgroundHandler	extends StageElementHandler	{
    34
    35  	/***
    36  	 * <code>BackgroundHandler</code> のインスタンスを作成します。
    37  	 */
    38  	public BackgroundHandler()
    39  	{
    40  		super();
    41  	}
    42
    43
    44  //
    45  //	ContentHandler の実装
    46  //
    47  	public void startElement( String namespaceURI, String localName, String qName, Attributes attrs )
    48  	{
    49  		StageCoordinator	coordinator = getStageCoordinator();
    50  		String	background = PSMLUtil.getAttributeValue( attrs, "image" );
    51  		if( background != null )	{
    52  			coordinator.setBackgroundImage( background );
    53  		}
    54  		else	{
    55  			background = PSMLUtil.getAttributeValue( attrs, "color" );
    56  			coordinator.setBackgroundColor( background );
    57  		}
    58
    59  		String	effect = PSMLUtil.getAttributeValue( attrs, "effect" );
    60  		if( effect == null )	{
    61  			ResourceManager	resources = ResourceManager.getInstance();
    62  			effect = (String)resources.getResource( ResourceIDs.DEFAULT_EFFECT_BACKGROUND, true );
    63  		}
    64  		if( !coordinator.isSlideVisible() )	{
    65  			coordinator.updateStage( effect );
    66  		}
    67  	}
    68  }