ImageSlideRegistry.java :  » MVC » simpleframework » net » simpleframework » web » page » component » ui » imageslide » Java Open Source

Java Open Source » MVC » simpleframework 
simpleframework » net » simpleframework » web » page » component » ui » imageslide » ImageSlideRegistry.java
package net.simpleframework.web.page.component.ui.imageslide;

import java.util.Iterator;

import javax.servlet.ServletContext;

import net.simpleframework.web.page.PageParameter;
import net.simpleframework.web.page.component.AbstractComponentBean;
import net.simpleframework.web.page.component.AbstractComponentRegistry;
import net.simpleframework.web.page.component.AbstractComponentRender;
import net.simpleframework.web.page.component.AbstractComponentResourceProvider;

import org.dom4j.Element;

/**
 * LGPLv3
 * 
 * @author (cknet@126.com, 13910090885)
 *         http://code.google.com/p/simpleframework/
 *         http://www.simpleframework.net
 */
public class ImageSlideRegistry extends AbstractComponentRegistry {
  public static final String NAME = "imageSlide";

  public ImageSlideRegistry(final ServletContext servletContext) {
    super(servletContext);
  }

  @Override
  public String getComponentName() {
    return NAME;
  }

  @Override
  protected Class<? extends AbstractComponentBean> getBeanClass() {
    return ImageSlideBean.class;
  }

  @Override
  protected Class<? extends AbstractComponentRender> getRenderClass() {
    return ImageSlideRender.class;
  }

  @Override
  protected Class<? extends AbstractComponentResourceProvider> getResourceProviderClass() {
    return ImageSlideResourceProvider.class;
  }

  @Override
  public AbstractComponentBean createComponentBean(final PageParameter pageParameter,
      final Element component) throws Exception {
    final ImageSlideBean imageSlide = (ImageSlideBean) super.createComponentBean(pageParameter,
        component);
    final Iterator<?> it = component.elementIterator("imageitem");
    while (it.hasNext()) {
      final Element element = (Element) it.next();
      final ImageItem imageItem = new ImageItem(element);
      setChildren(pageParameter, element, imageItem,
          new String[] { "imageUrl", "title", "link" });
      imageSlide.getImageItems().add(imageItem);
    }
    return imageSlide;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.