All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.guise.framework.platform.web.WebImageBooleanSelectActionControlViewer Maven / Gradle / Ivy

There is a newer version: 0.5.3
Show newest version
/*
 * Copyright © 2005-2008 GlobalMentor, Inc. 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.guise.framework.platform.web;

import java.io.IOException;
import java.net.URI;

import io.guise.framework.component.*;
import io.guise.framework.event.NavigateActionListener;

/**
 * Strategy for rendering an image select action control as an XHTML <img> inside a <a> element. If a link has a
 * {@link NavigateActionListener} as one of its action listeners, the generated href URI will be that of the listener, and a target
 * attribute will be set of the listener specifies a viewport ID.
 * 

* This view uses the following attributes which are not in XHTML: *

*
    *
  • guise:originalSrc
  • *
  • guise:rolloverSrc
  • *
* @param The type of component being depicted. * @author Garret Wilson */ public class WebImageBooleanSelectActionControlViewer extends WebImageActionControlDepictor { /** * {@inheritDoc} *

* This implementation returns the selected image if the component is selected and there is a selected image. *

* @see ImageComponent#getImageURI() * @see ImageBooleanSelectActionControl#isSelected() * @see ImageBooleanSelectActionControl#getRolloverImageURI() */ @Override protected URI getImageURI() { final C component = getDepictedObject(); //get the component URI image = null; //we'll determine the image final boolean isSelected = component.getValue().booleanValue(); //see if the component is selected if(isSelected) { //if the component is selected image = component.getSelectedImageURI(); //use the selected image if(image == null) { //if there is no selected image image = component.getRolloverImageURI(); //use the rollover image } } if(image == null) { //if the component is not selected, or there is no selected or rollover image image image = component.getImageURI(); //get the normal component image } return image; //return the image we determined } /** * {@inheritDoc} *

* This implementation returns the component's rollover image. *

* @see ImageBooleanSelectActionControl#getRolloverImageURI() */ @Override protected URI getRolloverImageURI() { return getDepictedObject().getRolloverImageURI(); //get the component rollover image } @Override protected void depictBegin() throws IOException { super.depictBegin(); //do the default beginning rendering //TODO del context.writeAttribute(null, "hidefocus", "true"); //hidefocus="true" //TODO add to DTD; put in JavaScript to do this dynamically } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy