Package org.fordprefect.struts2jscalendarplugin.views

Source Code of org.fordprefect.struts2jscalendarplugin.views.JSCalendarTagLibrary

/*
*  This file is part of Struts2JSCalendarPlugin.
*
*  Struts2JSCalendarPlugin is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Lesser General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  Foobar is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with Struts2JSCalendarPlugin.  If not, see <http://www.gnu.org/licenses/>.
*
*  This work is based on the webwork datepicker plugin copyright (c) 2002-2006 by OpenSymphony
*
*  Copyright � 2007 - 2010 by Derik Vercueil, Philipp Leusmann
*/
package org.fordprefect.struts2jscalendarplugin.views;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.views.TagLibrary;
import org.apache.struts2.views.freemarker.tags.TagModel;
import org.fordprefect.struts2jscalendarplugin.views.freemarker.tags.HeadModel;
import org.fordprefect.struts2jscalendarplugin.views.freemarker.tags.JSCalendarModel;
import org.fordprefect.struts2jscalendarplugin.views.velocity.components.HeadDirective;
import org.fordprefect.struts2jscalendarplugin.views.velocity.components.JSCalendarDirective;

import com.opensymphony.xwork2.util.ValueStack;

public class JSCalendarTagLibrary implements TagLibrary {

  public static final String JSCALENDAR_TAG_NAME = "jscalendar";
  public static final String HEAD_TAG_NAME = "head";

  public Object getFreemarkerModels(ValueStack valueStack,
      HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    Map<String, TagModel> models = new HashMap<String, TagModel>(2);
    models.put(HEAD_TAG_NAME, new HeadModel(valueStack, httpServletRequest,
        httpServletResponse));
    models.put(JSCALENDAR_TAG_NAME, new JSCalendarModel(valueStack,
        httpServletRequest, httpServletResponse));

    return models;
  }

  @SuppressWarnings("unchecked")
  public List<Class> getVelocityDirectiveClasses() {
    Class[] directives = new Class[] { HeadDirective.class,
        JSCalendarDirective.class };
    return Arrays.asList(directives);
  }
}
TOP

Related Classes of org.fordprefect.struts2jscalendarplugin.views.JSCalendarTagLibrary

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.