You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/04 00:03:31 UTC
svn commit: r673836 [4/8] - in /myfaces/tomahawk/trunk:
core/src/main/java/org/apache/myfaces/custom/buffer/
core/src/main/java/org/apache/myfaces/custom/calendar/
core/src/main/java/org/apache/myfaces/custom/captcha/
core/src/main/java/org/apache/myfa...
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/application/jsp/JspTilesTwoViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/application/jsp/JspTilesTwoViewHandlerImpl.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/application/jsp/JspTilesTwoViewHandlerImpl.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/application/jsp/JspTilesTwoViewHandlerImpl.java Thu Jul 3 15:03:29 2008
@@ -1,275 +1,275 @@
-package org.apache.myfaces.tomahawk.application.jsp;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tiles.access.TilesAccess;
-import org.apache.tiles.factory.TilesContainerFactory;
-import org.apache.tiles.TilesContainer;
-import org.apache.tiles.TilesException;
-import org.apache.myfaces.shared_tomahawk.webapp.webxml.ServletMapping;
-import org.apache.myfaces.shared_tomahawk.webapp.webxml.WebXml;
-
-import javax.faces.application.ViewHandler;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.FacesException;
-import javax.faces.component.UIViewRoot;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import javax.servlet.ServletResponse;
-import java.io.IOException;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author Martin Marinschek
- * @version $Revision: 472792 $ $Date: 2006-11-09 07:34:47 +0100 (Do, 09 Nov 2006) $
- */
-public class JspTilesTwoViewHandlerImpl
- extends ViewHandler {
- private ViewHandler _viewHandler;
-
- private static final Log log = LogFactory.getLog(JspTilesTwoViewHandlerImpl.class);
- private static final String TILES_DEF_EXT = ".tiles";
-
- private String tilesExtension = TILES_DEF_EXT;
-
- public JspTilesTwoViewHandlerImpl(ViewHandler viewHandler)
- {
- _viewHandler = viewHandler;
- }
-
- private void initContainer(ExternalContext context) {
-
- if(TilesAccess.getContainer(context.getContext())==null) {
- try
- {
- TilesContainerFactory factory = TilesContainerFactory.getFactory(context.getContext());
- TilesContainer container = factory.createTilesContainer(context.getContext());
- TilesAccess.setContainer(context.getContext(),container);
- }
- catch (Exception e)
- {
- throw new FacesException("Error reading tiles definitions : " + e.getMessage(), e);
- }
- }
- }
-
- public void renderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException, FacesException
- {
- if (viewToRender == null)
- {
- log.fatal("viewToRender must not be null");
- throw new NullPointerException("viewToRender must not be null");
- }
-
- ExternalContext externalContext = facesContext.getExternalContext();
-
- String viewId = deriveViewId(externalContext, viewToRender.getViewId());
-
- if(viewId==null) {
- //deriving view-id made clear we are not responsible for this view-id - call the delegate
- _viewHandler.renderView(facesContext, viewToRender);
- return;
- }
-
-
- initContainer(externalContext);
-
- String tilesId = deriveTileFromViewId(viewId);
-
- TilesContainer container = TilesAccess.getContainer(externalContext.getContext());
-
- Object[] requestObjects = {externalContext.getRequest(), externalContext.getResponse()};
-
- if(container.isValidDefinition(tilesId, requestObjects)) {
-
- //propagate our new view-id to wherever it makes sense
- setViewId(viewToRender, viewId, facesContext);
-
- renderTilesView(externalContext, requestObjects, container, viewToRender, viewId, tilesId);
- }
- else {
- //we're not using tiles as no valid definition has been found
- //just call the delegate view-handler to let it do its thing
- _viewHandler.renderView(facesContext, viewToRender);
- }
- }
-
- private void renderTilesView(ExternalContext externalContext, Object[] requestObjects, TilesContainer container, UIViewRoot viewToRender, String viewId, String tilesId) {
- handleCharacterEncoding(viewId, externalContext, viewToRender);
-
- container.startContext(requestObjects);
- try {
- container.render(tilesId,requestObjects);
- } catch (TilesException e) {
- throw new FacesException(e);
- }
- finally {
- container.endContext(requestObjects);
- }
-
- handleCharacterEncodingPostDispatch(externalContext);
- }
-
- private void setViewId(UIViewRoot viewToRender, String viewId, FacesContext facesContext) {
- viewToRender.setViewId(viewId);
- if(facesContext.getViewRoot()!=null) {
- facesContext.getViewRoot().setViewId(viewId);
- }
- }
-
- private String deriveTileFromViewId(String viewId) {
- String tilesId = viewId;
- int idx = tilesId.lastIndexOf('.');
- if (idx > 0)
- {
- tilesId = tilesId.substring(0, idx) + tilesExtension;
- }
- else
- {
- tilesId = tilesId + tilesExtension;
- }
- return tilesId;
- }
-
- private String deriveViewId(ExternalContext externalContext, String viewId) {
- ServletMapping servletMapping = getServletMapping(externalContext);
-
- String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
- String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
- if (servletMapping.isExtensionMapping())
- {
- if (!viewId.endsWith(suffix))
- {
- int dot = viewId.lastIndexOf('.');
- if (dot == -1)
- {
- if (log.isTraceEnabled()) log.trace("Current viewId has no extension, appending default suffix " + suffix);
- return viewId + suffix;
- }
- else
- {
- if (log.isTraceEnabled()) log.trace("Replacing extension of current viewId by suffix " + suffix);
- return viewId.substring(0, dot) + suffix;
- }
- }
-
- //extension-mapped page ends with proper suffix - all ok
- return viewId;
- }
- else if (!viewId.endsWith(suffix))
- {
- // path-mapping used, but suffix is no default-suffix
- return null;
- }
- else {
- //path-mapping used, suffix is default-suffix - all ok
- return viewId;
- }
- }
-
- private void handleCharacterEncodingPostDispatch(ExternalContext externalContext) {
- // handle character encoding as of section 2.5.2.2 of JSF 1.1
- if (externalContext.getRequest() instanceof HttpServletRequest) {
- HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
- HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
- HttpSession session = request.getSession(false);
-
- if (session != null) {
- session.setAttribute(ViewHandler.CHARACTER_ENCODING_KEY, response.getCharacterEncoding());
- }
- }
- }
-
- private void handleCharacterEncoding(String viewId, ExternalContext externalContext, UIViewRoot viewToRender) {
- if (log.isTraceEnabled()) log.trace("Dispatching to " + viewId);
-
- // handle character encoding as of section 2.5.2.2 of JSF 1.1
- if (externalContext.getResponse() instanceof ServletResponse) {
- ServletResponse response = (ServletResponse) externalContext.getResponse();
- response.setLocale(viewToRender.getLocale());
- }
- }
-
- private static ServletMapping getServletMapping(ExternalContext externalContext)
- {
- String servletPath = externalContext.getRequestServletPath();
- String requestPathInfo = externalContext.getRequestPathInfo();
-
- WebXml webxml = WebXml.getWebXml(externalContext);
- List mappings = webxml.getFacesServletMappings();
-
- boolean isExtensionMapping = requestPathInfo == null;
-
- for (int i = 0, size = mappings.size(); i < size; i++)
- {
- ServletMapping servletMapping = (ServletMapping) mappings.get(i);
- if (servletMapping.isExtensionMapping() == isExtensionMapping)
- {
- String urlpattern = servletMapping.getUrlPattern();
- if (isExtensionMapping)
- {
- String extension = urlpattern.substring(1, urlpattern.length());
- if (servletPath.endsWith(extension))
- {
- return servletMapping;
- }
- }
- else
- {
- urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
- // servletPath starts with "/" except in the case where the
- // request is matched with the "/*" pattern, in which case
- // it is the empty string (see Servlet Sepc 2.3 SRV4.4)
- if (servletPath.equals(urlpattern))
- {
- return servletMapping;
- }
- }
- }
- }
- log.error("could not find pathMapping for servletPath = " + servletPath +
- " requestPathInfo = " + requestPathInfo);
- throw new IllegalArgumentException("could not find pathMapping for servletPath = " + servletPath +
- " requestPathInfo = " + requestPathInfo);
- }
-
-
- public Locale calculateLocale(FacesContext context)
- {
- return _viewHandler.calculateLocale(context);
- }
-
- public String calculateRenderKitId(FacesContext context)
- {
- return _viewHandler.calculateRenderKitId(context);
- }
-
- public UIViewRoot createView(FacesContext context, String viewId)
- {
- return _viewHandler.createView(context, viewId);
- }
-
- public String getActionURL(FacesContext context, String viewId)
- {
- return _viewHandler.getActionURL(context, viewId);
- }
-
- public String getResourceURL(FacesContext context, String path)
- {
- return _viewHandler.getResourceURL(context, path);
- }
-
- public UIViewRoot restoreView(FacesContext context, String viewId)
- {
- return _viewHandler.restoreView(context, viewId);
- }
-
- public void writeState(FacesContext context) throws IOException
- {
- _viewHandler.writeState(context);
- }
-
-}
+package org.apache.myfaces.tomahawk.application.jsp;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tiles.access.TilesAccess;
+import org.apache.tiles.factory.TilesContainerFactory;
+import org.apache.tiles.TilesContainer;
+import org.apache.tiles.TilesException;
+import org.apache.myfaces.shared_tomahawk.webapp.webxml.ServletMapping;
+import org.apache.myfaces.shared_tomahawk.webapp.webxml.WebXml;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.FacesException;
+import javax.faces.component.UIViewRoot;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author Martin Marinschek
+ * @version $Revision: 472792 $ $Date: 2006-11-09 07:34:47 +0100 (Do, 09 Nov 2006) $
+ */
+public class JspTilesTwoViewHandlerImpl
+ extends ViewHandler {
+ private ViewHandler _viewHandler;
+
+ private static final Log log = LogFactory.getLog(JspTilesTwoViewHandlerImpl.class);
+ private static final String TILES_DEF_EXT = ".tiles";
+
+ private String tilesExtension = TILES_DEF_EXT;
+
+ public JspTilesTwoViewHandlerImpl(ViewHandler viewHandler)
+ {
+ _viewHandler = viewHandler;
+ }
+
+ private void initContainer(ExternalContext context) {
+
+ if(TilesAccess.getContainer(context.getContext())==null) {
+ try
+ {
+ TilesContainerFactory factory = TilesContainerFactory.getFactory(context.getContext());
+ TilesContainer container = factory.createTilesContainer(context.getContext());
+ TilesAccess.setContainer(context.getContext(),container);
+ }
+ catch (Exception e)
+ {
+ throw new FacesException("Error reading tiles definitions : " + e.getMessage(), e);
+ }
+ }
+ }
+
+ public void renderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException, FacesException
+ {
+ if (viewToRender == null)
+ {
+ log.fatal("viewToRender must not be null");
+ throw new NullPointerException("viewToRender must not be null");
+ }
+
+ ExternalContext externalContext = facesContext.getExternalContext();
+
+ String viewId = deriveViewId(externalContext, viewToRender.getViewId());
+
+ if(viewId==null) {
+ //deriving view-id made clear we are not responsible for this view-id - call the delegate
+ _viewHandler.renderView(facesContext, viewToRender);
+ return;
+ }
+
+
+ initContainer(externalContext);
+
+ String tilesId = deriveTileFromViewId(viewId);
+
+ TilesContainer container = TilesAccess.getContainer(externalContext.getContext());
+
+ Object[] requestObjects = {externalContext.getRequest(), externalContext.getResponse()};
+
+ if(container.isValidDefinition(tilesId, requestObjects)) {
+
+ //propagate our new view-id to wherever it makes sense
+ setViewId(viewToRender, viewId, facesContext);
+
+ renderTilesView(externalContext, requestObjects, container, viewToRender, viewId, tilesId);
+ }
+ else {
+ //we're not using tiles as no valid definition has been found
+ //just call the delegate view-handler to let it do its thing
+ _viewHandler.renderView(facesContext, viewToRender);
+ }
+ }
+
+ private void renderTilesView(ExternalContext externalContext, Object[] requestObjects, TilesContainer container, UIViewRoot viewToRender, String viewId, String tilesId) {
+ handleCharacterEncoding(viewId, externalContext, viewToRender);
+
+ container.startContext(requestObjects);
+ try {
+ container.render(tilesId,requestObjects);
+ } catch (TilesException e) {
+ throw new FacesException(e);
+ }
+ finally {
+ container.endContext(requestObjects);
+ }
+
+ handleCharacterEncodingPostDispatch(externalContext);
+ }
+
+ private void setViewId(UIViewRoot viewToRender, String viewId, FacesContext facesContext) {
+ viewToRender.setViewId(viewId);
+ if(facesContext.getViewRoot()!=null) {
+ facesContext.getViewRoot().setViewId(viewId);
+ }
+ }
+
+ private String deriveTileFromViewId(String viewId) {
+ String tilesId = viewId;
+ int idx = tilesId.lastIndexOf('.');
+ if (idx > 0)
+ {
+ tilesId = tilesId.substring(0, idx) + tilesExtension;
+ }
+ else
+ {
+ tilesId = tilesId + tilesExtension;
+ }
+ return tilesId;
+ }
+
+ private String deriveViewId(ExternalContext externalContext, String viewId) {
+ ServletMapping servletMapping = getServletMapping(externalContext);
+
+ String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+ String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
+ if (servletMapping.isExtensionMapping())
+ {
+ if (!viewId.endsWith(suffix))
+ {
+ int dot = viewId.lastIndexOf('.');
+ if (dot == -1)
+ {
+ if (log.isTraceEnabled()) log.trace("Current viewId has no extension, appending default suffix " + suffix);
+ return viewId + suffix;
+ }
+ else
+ {
+ if (log.isTraceEnabled()) log.trace("Replacing extension of current viewId by suffix " + suffix);
+ return viewId.substring(0, dot) + suffix;
+ }
+ }
+
+ //extension-mapped page ends with proper suffix - all ok
+ return viewId;
+ }
+ else if (!viewId.endsWith(suffix))
+ {
+ // path-mapping used, but suffix is no default-suffix
+ return null;
+ }
+ else {
+ //path-mapping used, suffix is default-suffix - all ok
+ return viewId;
+ }
+ }
+
+ private void handleCharacterEncodingPostDispatch(ExternalContext externalContext) {
+ // handle character encoding as of section 2.5.2.2 of JSF 1.1
+ if (externalContext.getRequest() instanceof HttpServletRequest) {
+ HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
+ HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
+ HttpSession session = request.getSession(false);
+
+ if (session != null) {
+ session.setAttribute(ViewHandler.CHARACTER_ENCODING_KEY, response.getCharacterEncoding());
+ }
+ }
+ }
+
+ private void handleCharacterEncoding(String viewId, ExternalContext externalContext, UIViewRoot viewToRender) {
+ if (log.isTraceEnabled()) log.trace("Dispatching to " + viewId);
+
+ // handle character encoding as of section 2.5.2.2 of JSF 1.1
+ if (externalContext.getResponse() instanceof ServletResponse) {
+ ServletResponse response = (ServletResponse) externalContext.getResponse();
+ response.setLocale(viewToRender.getLocale());
+ }
+ }
+
+ private static ServletMapping getServletMapping(ExternalContext externalContext)
+ {
+ String servletPath = externalContext.getRequestServletPath();
+ String requestPathInfo = externalContext.getRequestPathInfo();
+
+ WebXml webxml = WebXml.getWebXml(externalContext);
+ List mappings = webxml.getFacesServletMappings();
+
+ boolean isExtensionMapping = requestPathInfo == null;
+
+ for (int i = 0, size = mappings.size(); i < size; i++)
+ {
+ ServletMapping servletMapping = (ServletMapping) mappings.get(i);
+ if (servletMapping.isExtensionMapping() == isExtensionMapping)
+ {
+ String urlpattern = servletMapping.getUrlPattern();
+ if (isExtensionMapping)
+ {
+ String extension = urlpattern.substring(1, urlpattern.length());
+ if (servletPath.endsWith(extension))
+ {
+ return servletMapping;
+ }
+ }
+ else
+ {
+ urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
+ // servletPath starts with "/" except in the case where the
+ // request is matched with the "/*" pattern, in which case
+ // it is the empty string (see Servlet Sepc 2.3 SRV4.4)
+ if (servletPath.equals(urlpattern))
+ {
+ return servletMapping;
+ }
+ }
+ }
+ }
+ log.error("could not find pathMapping for servletPath = " + servletPath +
+ " requestPathInfo = " + requestPathInfo);
+ throw new IllegalArgumentException("could not find pathMapping for servletPath = " + servletPath +
+ " requestPathInfo = " + requestPathInfo);
+ }
+
+
+ public Locale calculateLocale(FacesContext context)
+ {
+ return _viewHandler.calculateLocale(context);
+ }
+
+ public String calculateRenderKitId(FacesContext context)
+ {
+ return _viewHandler.calculateRenderKitId(context);
+ }
+
+ public UIViewRoot createView(FacesContext context, String viewId)
+ {
+ return _viewHandler.createView(context, viewId);
+ }
+
+ public String getActionURL(FacesContext context, String viewId)
+ {
+ return _viewHandler.getActionURL(context, viewId);
+ }
+
+ public String getResourceURL(FacesContext context, String path)
+ {
+ return _viewHandler.getResourceURL(context, path);
+ }
+
+ public UIViewRoot restoreView(FacesContext context, String viewId)
+ {
+ return _viewHandler.restoreView(context, viewId);
+ }
+
+ public void writeState(FacesContext context) throws IOException
+ {
+ _viewHandler.writeState(context);
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/tomahawk/application/jsp/JspTilesTwoViewHandlerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/dateformat/TestSimpleDateFormatter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java Thu Jul 3 15:03:29 2008
@@ -1,240 +1,240 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.test;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import junit.framework.TestCase;
-import net.sf.maventaglib.checker.Tag;
-import net.sf.maventaglib.checker.TagAttribute;
-import net.sf.maventaglib.checker.Tld;
-import net.sf.maventaglib.checker.TldParser;
-
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-
-/**
- * Insures the following ...
- * <ul>
- * <li> Tag handlers have setters for all tag attributes</li>
- * <li> All tag handlers are in the classpath</li>
- * <li> Tag handlers do not appear in the TLD more than once</li>
- * <li> Tag handler attributes do not occur mare than once</li>
- * </ul>
- *
- * @author Dennis Byrne
- * @see http://maven-taglib.sourceforge.net/ for dependency download
- */
-
-public abstract class AbstractTagLibTestCase extends TestCase {
- private static Log log = LogFactory.getLog(AbstractTagLibTestCase.class);
-
- protected Tld[] tlds;
-
- protected String[] tldPaths;
-
- private ClassLoader classLoader = getClass().getClassLoader();
-
- /**
- * Unmarshall TLDs to an object model. TLDs are supplied by a subclass.
- */
-
- protected void setUp() throws Exception {
-
- if (tldPaths == null)
- throw new NullPointerException(
- "tldPaths cannot point to null before setUp() is called");
-
- int length = tldPaths.length;
-
- if (length == 0)
- throw new IllegalStateException(
- "tldPaths should have at least one resource path");
-
- tlds = new Tld[length];
-
- for (int t = 0; t < length; t++) {
- String name = tldPaths[t];
-
- InputStream stream = classLoader.getResourceAsStream(name);
-
- if (stream == null)
- throw new NullPointerException(
- "couldn't get an input stream for " + name);
-
- tlds[t] = TldTestUtils.getTld(name, stream);
- stream.close();
- }
- }
-
- public void testUniqueTagTestCase() throws Exception {
-
- for (int lib = 0; lib < tlds.length; lib++) {
- Tld tld = tlds[lib];
- List tagNames = new ArrayList();
- Tag[] tags = tld.getTags();
-
- for (int t = 0; t < tags.length; t++) {
- Tag tag = tags[t];
-
- if (tag == null)
- throw new NullPointerException("tag");
-
- String name = tag.getName();
- String msg = name + " found more than once in " + tldPaths[lib];
- assertFalse(msg, tagNames.contains(name));
- tagNames.add(name);
- } // end t
- } // end lib
- }
-
- public void testUniqueTagAttributes() throws Exception {
-
- for (int lib = 0; lib < tlds.length; lib++) {
- Tld tld = tlds[lib];
- Tag[] tags = tld.getTags();
-
- for (int t = 0; t < tags.length; t++) {
-
- Tag tag = tags[t];
- assertUniqueTagAttributes(tag, tldPaths[lib]);
-
- } // end t
- } // end lib
- }
-
- private void assertUniqueTagAttributes(final Tag tag, final String path) {
-
- List attributeNames = new ArrayList();
- TagAttribute[] atts = tag.getAttributes();
- String tagName = tag.getName();
-
- for (int a = 0; a < atts.length;) {
-
- TagAttribute att = atts[a++];
- String name = att.getAttributeName();
- String msg = " @" + name + " of " + path + ":" + tagName
- + " is duplicated.";
- assertFalse(msg, attributeNames.contains(name));
- attributeNames.add(name);
-
- } // end a
-
- }
-
- /**
- * Make sure the class exists. Make sure there is a setter for each
- * attribute.
- */
-
- public void testSetters() throws Exception {
-
- for (int t = 0; t < tlds.length; t++) {
- Tld tld = tlds[t];
- Tag[] tags = tld.getTags();
-
- for (int s = 0; s < tags.length; s++) {
- Tag tag = tags[s];
- String filename = tld.getFilename();
-
- Object object = TldTestUtils.makeTagClassInstance(tag,
- filename, classLoader);
- log.debug("filename = " + filename + " ; tag = " + tag.getName());
- assertSetters(tag, filename, object);
-
- } // end for tag
- } // end for lib
-
- }
-
- private void assertSetters(final Tag tag, final String path,
- final Object object) {
-
- TagAttribute[] attributes = tag.getAttributes();
- String tagName = tag.getName();
-
- for (int a = 0; a < attributes.length; a++) {
- TagAttribute attribute = attributes[a];
- String name = attribute.getAttributeName();
-
- if (name == null || "".equals(name.trim()))
- throw new IllegalStateException(path + ":" + tagName
- + " has a nameless attribute ");
-
- String msg = path + ":" + tagName + "@" + name
- + " exists, but " + object.getClass().getName()
- + " has no setter.";
-
- assertTrue(msg, PropertyUtils.isWriteable(object, name));
- } // end for attributes
-
- }
-
- private static class TldTestUtils {
- private static Log log = LogFactory.getLog(TldTestUtils.class);
-
- private static DocumentBuilderFactory dbf = DocumentBuilderFactory
- .newInstance();
-
- public static Tld getTld(String name, InputStream stream)
- throws Exception {
- if (stream == null)
- log.error(" input stream is null ");
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(stream);
-
- return TldParser.parse(doc, name);
- }
-
- public static Object makeTagClassInstance(Tag tag, String filename,
- ClassLoader classLoader) throws Exception {
-
- String clazzName = tag.getTagClass();
-
- if (clazzName == null || "".equals(clazzName.trim()))
- throw new NullPointerException(tag.getName()
- + " is missing a tag class.");
-
- try {
-
- Class clazz = classLoader.loadClass(clazzName);
- return clazz.newInstance();
-
- } catch (ClassNotFoundException e) {
- throw new ClassNotFoundException(clazzName);
- } catch (IllegalAccessException ie) {
- throw new IllegalAccessException(clazzName);
- } catch (InstantiationException iste) {
- throw new InstantiationException(clazzName);
- }
-
- }
-
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.test;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+import net.sf.maventaglib.checker.Tag;
+import net.sf.maventaglib.checker.TagAttribute;
+import net.sf.maventaglib.checker.Tld;
+import net.sf.maventaglib.checker.TldParser;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Document;
+
+/**
+ * Insures the following ...
+ * <ul>
+ * <li> Tag handlers have setters for all tag attributes</li>
+ * <li> All tag handlers are in the classpath</li>
+ * <li> Tag handlers do not appear in the TLD more than once</li>
+ * <li> Tag handler attributes do not occur mare than once</li>
+ * </ul>
+ *
+ * @author Dennis Byrne
+ * @see http://maven-taglib.sourceforge.net/ for dependency download
+ */
+
+public abstract class AbstractTagLibTestCase extends TestCase {
+ private static Log log = LogFactory.getLog(AbstractTagLibTestCase.class);
+
+ protected Tld[] tlds;
+
+ protected String[] tldPaths;
+
+ private ClassLoader classLoader = getClass().getClassLoader();
+
+ /**
+ * Unmarshall TLDs to an object model. TLDs are supplied by a subclass.
+ */
+
+ protected void setUp() throws Exception {
+
+ if (tldPaths == null)
+ throw new NullPointerException(
+ "tldPaths cannot point to null before setUp() is called");
+
+ int length = tldPaths.length;
+
+ if (length == 0)
+ throw new IllegalStateException(
+ "tldPaths should have at least one resource path");
+
+ tlds = new Tld[length];
+
+ for (int t = 0; t < length; t++) {
+ String name = tldPaths[t];
+
+ InputStream stream = classLoader.getResourceAsStream(name);
+
+ if (stream == null)
+ throw new NullPointerException(
+ "couldn't get an input stream for " + name);
+
+ tlds[t] = TldTestUtils.getTld(name, stream);
+ stream.close();
+ }
+ }
+
+ public void testUniqueTagTestCase() throws Exception {
+
+ for (int lib = 0; lib < tlds.length; lib++) {
+ Tld tld = tlds[lib];
+ List tagNames = new ArrayList();
+ Tag[] tags = tld.getTags();
+
+ for (int t = 0; t < tags.length; t++) {
+ Tag tag = tags[t];
+
+ if (tag == null)
+ throw new NullPointerException("tag");
+
+ String name = tag.getName();
+ String msg = name + " found more than once in " + tldPaths[lib];
+ assertFalse(msg, tagNames.contains(name));
+ tagNames.add(name);
+ } // end t
+ } // end lib
+ }
+
+ public void testUniqueTagAttributes() throws Exception {
+
+ for (int lib = 0; lib < tlds.length; lib++) {
+ Tld tld = tlds[lib];
+ Tag[] tags = tld.getTags();
+
+ for (int t = 0; t < tags.length; t++) {
+
+ Tag tag = tags[t];
+ assertUniqueTagAttributes(tag, tldPaths[lib]);
+
+ } // end t
+ } // end lib
+ }
+
+ private void assertUniqueTagAttributes(final Tag tag, final String path) {
+
+ List attributeNames = new ArrayList();
+ TagAttribute[] atts = tag.getAttributes();
+ String tagName = tag.getName();
+
+ for (int a = 0; a < atts.length;) {
+
+ TagAttribute att = atts[a++];
+ String name = att.getAttributeName();
+ String msg = " @" + name + " of " + path + ":" + tagName
+ + " is duplicated.";
+ assertFalse(msg, attributeNames.contains(name));
+ attributeNames.add(name);
+
+ } // end a
+
+ }
+
+ /**
+ * Make sure the class exists. Make sure there is a setter for each
+ * attribute.
+ */
+
+ public void testSetters() throws Exception {
+
+ for (int t = 0; t < tlds.length; t++) {
+ Tld tld = tlds[t];
+ Tag[] tags = tld.getTags();
+
+ for (int s = 0; s < tags.length; s++) {
+ Tag tag = tags[s];
+ String filename = tld.getFilename();
+
+ Object object = TldTestUtils.makeTagClassInstance(tag,
+ filename, classLoader);
+ log.debug("filename = " + filename + " ; tag = " + tag.getName());
+ assertSetters(tag, filename, object);
+
+ } // end for tag
+ } // end for lib
+
+ }
+
+ private void assertSetters(final Tag tag, final String path,
+ final Object object) {
+
+ TagAttribute[] attributes = tag.getAttributes();
+ String tagName = tag.getName();
+
+ for (int a = 0; a < attributes.length; a++) {
+ TagAttribute attribute = attributes[a];
+ String name = attribute.getAttributeName();
+
+ if (name == null || "".equals(name.trim()))
+ throw new IllegalStateException(path + ":" + tagName
+ + " has a nameless attribute ");
+
+ String msg = path + ":" + tagName + "@" + name
+ + " exists, but " + object.getClass().getName()
+ + " has no setter.";
+
+ assertTrue(msg, PropertyUtils.isWriteable(object, name));
+ } // end for attributes
+
+ }
+
+ private static class TldTestUtils {
+ private static Log log = LogFactory.getLog(TldTestUtils.class);
+
+ private static DocumentBuilderFactory dbf = DocumentBuilderFactory
+ .newInstance();
+
+ public static Tld getTld(String name, InputStream stream)
+ throws Exception {
+ if (stream == null)
+ log.error(" input stream is null ");
+
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(stream);
+
+ return TldParser.parse(doc, name);
+ }
+
+ public static Object makeTagClassInstance(Tag tag, String filename,
+ ClassLoader classLoader) throws Exception {
+
+ String clazzName = tag.getTagClass();
+
+ if (clazzName == null || "".equals(clazzName.trim()))
+ throw new NullPointerException(tag.getName()
+ + " is missing a tag class.");
+
+ try {
+
+ Class clazz = classLoader.loadClass(clazzName);
+ return clazz.newInstance();
+
+ } catch (ClassNotFoundException e) {
+ throw new ClassNotFoundException(clazzName);
+ } catch (IllegalAccessException ie) {
+ throw new IllegalAccessException(clazzName);
+ } catch (InstantiationException iste) {
+ throw new InstantiationException(clazzName);
+ }
+
+ }
+
+ }
+
}
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java Thu Jul 3 15:03:29 2008
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.test;
-
-/**
- * @author Dennis C. Byrne
- */
-
-public class MyFacesTagLibTestCase extends AbstractTagLibTestCase {
-
- protected static final String META_INF = "META-INF/";
-
- public MyFacesTagLibTestCase(){
-
- // TODO get the sandbox in here
-
- tldPaths = new String[3];
- tldPaths[0] = META_INF + "myfaces_html.tld";
- tldPaths[1] = META_INF + "myfaces_core.tld";
- tldPaths[2] = META_INF + "tomahawk.tld";
- // tldPaths[3] = META_INF + "myfaces_sandbox.tld";
-
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.test;
+
+/**
+ * @author Dennis C. Byrne
+ */
+
+public class MyFacesTagLibTestCase extends AbstractTagLibTestCase {
+
+ protected static final String META_INF = "META-INF/";
+
+ public MyFacesTagLibTestCase(){
+
+ // TODO get the sandbox in here
+
+ tldPaths = new String[3];
+ tldPaths[0] = META_INF + "myfaces_html.tld";
+ tldPaths[1] = META_INF + "myfaces_core.tld";
+ tldPaths[2] = META_INF + "tomahawk.tld";
+ // tldPaths[3] = META_INF + "myfaces_sandbox.tld";
+
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/captcha/CaptchaBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/captcha/CaptchaBean.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/captcha/CaptchaBean.java (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/captcha/CaptchaBean.java Thu Jul 3 15:03:29 2008
@@ -1,68 +1,68 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.examples.captcha;
-
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpSession;
-
-public class CaptchaBean {
-
- public final static String SESSION_KEY_NAME = "mySessionKeyName";
- public final static String CORRECT = "Correct!";
- public final static String WRONG = "Wrong";
-
- String status;
- String value;
-
- public String check() {
-
- // Compare the CAPTCHA value with the user entered value.
- String captchaValue = (String)((HttpSession) FacesContext
- .getCurrentInstance().getExternalContext().getSession(true))
- .getAttribute(SESSION_KEY_NAME);
-
- if(captchaValue.equalsIgnoreCase(value)) {
- status = CORRECT;
- } else {
- status = WRONG;
- }
-
- return "";
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getSessionKeyName() {
- return SESSION_KEY_NAME;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.examples.captcha;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+public class CaptchaBean {
+
+ public final static String SESSION_KEY_NAME = "mySessionKeyName";
+ public final static String CORRECT = "Correct!";
+ public final static String WRONG = "Wrong";
+
+ String status;
+ String value;
+
+ public String check() {
+
+ // Compare the CAPTCHA value with the user entered value.
+ String captchaValue = (String)((HttpSession) FacesContext
+ .getCurrentInstance().getExternalContext().getSession(true))
+ .getAttribute(SESSION_KEY_NAME);
+
+ if(captchaValue.equalsIgnoreCase(value)) {
+ status = CORRECT;
+ } else {
+ status = WRONG;
+ }
+
+ return "";
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getSessionKeyName() {
+ return SESSION_KEY_NAME;
+ }
+}
Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/captcha/CaptchaBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java Thu Jul 3 15:03:29 2008
@@ -1,73 +1,73 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.examples.picklist;
-
-import java.util.ArrayList;
-
-import javax.faces.event.ValueChangeEvent;
-import javax.faces.model.SelectItem;
-
-public class PicklistBean
-{
- private ArrayList testList = new ArrayList();
-
- private String selectedInfo;
-
- public PicklistBean()
- {
- testList.add(new SelectItem("option4", "another option 4"));
- testList.add(new SelectItem("option5", "another option 5"));
- testList.add(new SelectItem("option6", "another option 6"));
- }
-
- public void selectionChanged(ValueChangeEvent evt)
- {
- String[] selectedValues = (String[]) evt.getNewValue();
-
- if (selectedValues.length == 0)
- {
- selectedInfo = "No selected values";
- }
- else
- {
-
- StringBuffer sb = new StringBuffer("Selected values: ");
-
- for (int i = 0; i < selectedValues.length; i++)
- {
- if (i > 0)
- sb.append(", ");
- sb.append(selectedValues[i]);
- }
-
- selectedInfo = sb.toString();
- }
- }
-
- public ArrayList getTestList()
- {
- return testList;
- }
-
- public String getSelectedInfo()
- {
- return selectedInfo;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.examples.picklist;
+
+import java.util.ArrayList;
+
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+public class PicklistBean
+{
+ private ArrayList testList = new ArrayList();
+
+ private String selectedInfo;
+
+ public PicklistBean()
+ {
+ testList.add(new SelectItem("option4", "another option 4"));
+ testList.add(new SelectItem("option5", "another option 5"));
+ testList.add(new SelectItem("option6", "another option 6"));
+ }
+
+ public void selectionChanged(ValueChangeEvent evt)
+ {
+ String[] selectedValues = (String[]) evt.getNewValue();
+
+ if (selectedValues.length == 0)
+ {
+ selectedInfo = "No selected values";
+ }
+ else
+ {
+
+ StringBuffer sb = new StringBuffer("Selected values: ");
+
+ for (int i = 0; i < selectedValues.length; i++)
+ {
+ if (i > 0)
+ sb.append(", ");
+ sb.append(selectedValues[i]);
+ }
+
+ selectedInfo = sb.toString();
+ }
+ }
+
+ public ArrayList getTestList()
+ {
+ return testList;
+ }
+
+ public String getSelectedInfo()
+ {
+ return selectedInfo;
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java Thu Jul 3 15:03:29 2008
@@ -1,95 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.examples.selectOneRow;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.ValueChangeEvent;
-
-import org.apache.myfaces.custom.datascroller.ScrollerActionEvent;
-
-/**
- * DOCUMENT ME!
- * @author Ernst Fastl
- * @version
- */
-public class SelectOneRowList
-{
- private List _list = new ArrayList();
-
- private Long _selectedRowIndex;
-
- public Long getSelectedRowIndex()
- {
- return _selectedRowIndex;
- }
-
- public void setSelectedRowIndex(Long selectedRowIndex)
- {
- _selectedRowIndex = selectedRowIndex;
- }
-
- public String getSelectionMessage()
- {
- if(getSelectedRowIndex()==null)
- {
- return "Currently there is no Row selected!";
- }
- else
- {
- return "Row number: " + _selectedRowIndex.toString() + " selected!";
- }
- }
-
- public SelectOneRowList()
- {
- for (int i = 1; i < 10; i++)
- {
- _list.add(new SimpleCar(i, "Car Type " + i, "blue"));
- _list.add(new SimpleCar(i, "Car Type " + i, "red"));
- _list.add(new SimpleCar(i, "Car Type " + i, "green"));
- _list.add(new SimpleCar(i, "Car Type " + i, "black"));
- _list.add(new SimpleCar(i, "Car Type " + i, "white"));
- }
- }
-
- public List getList()
- {
- return _list;
- }
-
- public void scrollerAction(ActionEvent event)
- {
- ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
- FacesContext.getCurrentInstance().getExternalContext().log(
- "scrollerAction: facet: "
- + scrollerEvent.getScrollerfacet()
- + ", pageindex: "
- + scrollerEvent.getPageIndex());
- }
-
- public void processRowSelection(ValueChangeEvent event)
- {
- Long newVal = (Long) event.getNewValue();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.examples.selectOneRow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+
+import org.apache.myfaces.custom.datascroller.ScrollerActionEvent;
+
+/**
+ * DOCUMENT ME!
+ * @author Ernst Fastl
+ * @version
+ */
+public class SelectOneRowList
+{
+ private List _list = new ArrayList();
+
+ private Long _selectedRowIndex;
+
+ public Long getSelectedRowIndex()
+ {
+ return _selectedRowIndex;
+ }
+
+ public void setSelectedRowIndex(Long selectedRowIndex)
+ {
+ _selectedRowIndex = selectedRowIndex;
+ }
+
+ public String getSelectionMessage()
+ {
+ if(getSelectedRowIndex()==null)
+ {
+ return "Currently there is no Row selected!";
+ }
+ else
+ {
+ return "Row number: " + _selectedRowIndex.toString() + " selected!";
+ }
+ }
+
+ public SelectOneRowList()
+ {
+ for (int i = 1; i < 10; i++)
+ {
+ _list.add(new SimpleCar(i, "Car Type " + i, "blue"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "red"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "green"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "black"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "white"));
+ }
+ }
+
+ public List getList()
+ {
+ return _list;
+ }
+
+ public void scrollerAction(ActionEvent event)
+ {
+ ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
+ FacesContext.getCurrentInstance().getExternalContext().log(
+ "scrollerAction: facet: "
+ + scrollerEvent.getScrollerfacet()
+ + ", pageindex: "
+ + scrollerEvent.getPageIndex());
+ }
+
+ public void processRowSelection(ValueChangeEvent event)
+ {
+ Long newVal = (Long) event.getNewValue();
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java Thu Jul 3 15:03:29 2008
@@ -1,75 +1,75 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.examples.selectOneRow;
-
-import java.io.Serializable;
-
-/**
- * DOCUMENT ME!
- * @author Thomas Spiegl (latest modification by $Author: werpu $)
- * @version $Revision: 371731 $ $Date: 2006-01-24 01:18:44 +0100 (Di, 24 Jän 2006) $
- */
-public class SimpleCar
- implements Serializable
-{
- /**
- * serial id for serialisation versioning
- */
- private static final long serialVersionUID = 1L;
- private int _id;
- private String _type;
- private String _color;
-
- public SimpleCar(int id, String type, String color)
- {
- _id = id;
- _type = type;
- _color = color;
- }
-
- public int getId()
- {
- return _id;
- }
-
- public void setId(int id)
- {
- _id = id;
- }
-
- public String getType()
- {
- return _type;
- }
-
- public void setType(String type)
- {
- _type = type;
- }
-
- public String getColor()
- {
- return _color;
- }
-
- public void setColor(String color)
- {
- _color = color;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.examples.selectOneRow;
+
+import java.io.Serializable;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: werpu $)
+ * @version $Revision: 371731 $ $Date: 2006-01-24 01:18:44 +0100 (Di, 24 Jän 2006) $
+ */
+public class SimpleCar
+ implements Serializable
+{
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private int _id;
+ private String _type;
+ private String _color;
+
+ public SimpleCar(int id, String type, String color)
+ {
+ _id = id;
+ _type = type;
+ _color = color;
+ }
+
+ public int getId()
+ {
+ return _id;
+ }
+
+ public void setId(int id)
+ {
+ _id = id;
+ }
+
+ public String getType()
+ {
+ return _type;
+ }
+
+ public void setType(String type)
+ {
+ _type = type;
+ }
+
+ public String getColor()
+ {
+ return _color;
+ }
+
+ public void setColor(String color)
+ {
+ _color = color;
+ }
+}
Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/subform/SubFormBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/subform/SubFormBean.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/subform/SubFormBean.java (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/subform/SubFormBean.java Thu Jul 3 15:03:29 2008
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.examples.subform;
-
-/**
- *
- * @author Martin Marinschek
- * @version $Revision$ $Date$
- */
-public class SubFormBean
-{
- private String _firstName;
- private String _lastName;
- private String _type;
- private String _make;
-
- public String getFirstName()
- {
- return _firstName;
- }
-
- public void setFirstName(String firstName)
- {
- _firstName = firstName;
- }
-
- public String getLastName()
- {
- return _lastName;
- }
-
- public void setLastName(String lastName)
- {
- _lastName = lastName;
- }
-
- public String getType()
- {
- return _type;
- }
-
- public void setType(String type)
- {
- _type = type;
- }
-
- public String getMake()
- {
- return _make;
- }
-
- public void setMake(String make)
- {
- _make = make;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.examples.subform;
+
+/**
+ *
+ * @author Martin Marinschek
+ * @version $Revision$ $Date$
+ */
+public class SubFormBean
+{
+ private String _firstName;
+ private String _lastName;
+ private String _type;
+ private String _make;
+
+ public String getFirstName()
+ {
+ return _firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ _firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return _lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ _lastName = lastName;
+ }
+
+ public String getType()
+ {
+ return _type;
+ }
+
+ public void setType(String type)
+ {
+ _type = type;
+ }
+
+ public String getMake()
+ {
+ return _make;
+ }
+
+ public void setMake(String make)
+ {
+ _make = make;
+ }
+}
Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/subform/SubFormBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/tree1/Tree1Backer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/tree1/Tree1Backer.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/tree1/Tree1Backer.java (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/tree1/Tree1Backer.java Thu Jul 3 15:03:29 2008
@@ -1,62 +1,62 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.examples.tree1;
-
-import org.apache.myfaces.custom.tree.model.TreeModel;
-import org.apache.myfaces.custom.tree.model.DefaultTreeModel;
-import org.apache.myfaces.custom.tree.DefaultMutableTreeNode;
-
-/**
- * @author Martin Marinschek
- */
-public class Tree1Backer {
-
- private TreeModel treeModel;
-
- public TreeModel getTreeModel() {
- if (treeModel == null) {
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("XY");
- DefaultMutableTreeNode a = new DefaultMutableTreeNode("A");
- root.insert(a);
- DefaultMutableTreeNode b = new DefaultMutableTreeNode("B");
- root.insert(b);
- DefaultMutableTreeNode c = new DefaultMutableTreeNode("C");
- root.insert(c);
-
- DefaultMutableTreeNode node = new DefaultMutableTreeNode("a1");
- a.insert(node);
- node = new DefaultMutableTreeNode("a2 ");
- a.insert(node);
- node = new DefaultMutableTreeNode("b ");
- b.insert(node);
-
- a = node;
- node = new DefaultMutableTreeNode("x1");
- a.insert(node);
- node = new DefaultMutableTreeNode("x2");
- a.insert(node);
- treeModel = new DefaultTreeModel(root);
- }
- return treeModel;
- }
-
- public void setTreeModel(TreeModel treeModel) {
- this.treeModel = treeModel;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.examples.tree1;
+
+import org.apache.myfaces.custom.tree.model.TreeModel;
+import org.apache.myfaces.custom.tree.model.DefaultTreeModel;
+import org.apache.myfaces.custom.tree.DefaultMutableTreeNode;
+
+/**
+ * @author Martin Marinschek
+ */
+public class Tree1Backer {
+
+ private TreeModel treeModel;
+
+ public TreeModel getTreeModel() {
+ if (treeModel == null) {
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("XY");
+ DefaultMutableTreeNode a = new DefaultMutableTreeNode("A");
+ root.insert(a);
+ DefaultMutableTreeNode b = new DefaultMutableTreeNode("B");
+ root.insert(b);
+ DefaultMutableTreeNode c = new DefaultMutableTreeNode("C");
+ root.insert(c);
+
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode("a1");
+ a.insert(node);
+ node = new DefaultMutableTreeNode("a2 ");
+ a.insert(node);
+ node = new DefaultMutableTreeNode("b ");
+ b.insert(node);
+
+ a = node;
+ node = new DefaultMutableTreeNode("x1");
+ a.insert(node);
+ node = new DefaultMutableTreeNode("x2");
+ a.insert(node);
+ treeModel = new DefaultTreeModel(root);
+ }
+ return treeModel;
+ }
+
+ public void setTreeModel(TreeModel treeModel) {
+ this.treeModel = treeModel;
+ }
+}
Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/tree1/Tree1Backer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/DeprecatedAjaxComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/DeprecatedAjaxComponent.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/DeprecatedAjaxComponent.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/DeprecatedAjaxComponent.java Thu Jul 3 15:03:29 2008
@@ -1,32 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.custom.ajax.api;
-
-/**Before the creation of the ppr-architecture, there was a similar effort done - this is deprecated now
- * and should be refactored to use the new architecture.
- *
- * Rule of thumb: only use AjaxComponent if you want to render something different on a partial request
- * if rendering stays the same, use the normal component architecture.
- *
- * @version $Revision: $ $Date: $
- * <p/>
- * @deprecated
- */
-public interface DeprecatedAjaxComponent extends AjaxComponent {
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.custom.ajax.api;
+
+/**Before the creation of the ppr-architecture, there was a similar effort done - this is deprecated now
+ * and should be refactored to use the new architecture.
+ *
+ * Rule of thumb: only use AjaxComponent if you want to render something different on a partial request
+ * if rendering stays the same, use the normal component architecture.
+ *
+ * @version $Revision: $ $Date: $
+ * <p/>
+ * @deprecated
+ */
+public interface DeprecatedAjaxComponent extends AjaxComponent {
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/DeprecatedAjaxComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojolayouts/FloatingPaneBaseRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojolayouts/FloatingPaneBaseRenderer.java?rev=673836&r1=673835&r2=673836&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojolayouts/FloatingPaneBaseRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojolayouts/FloatingPaneBaseRenderer.java Thu Jul 3 15:03:29 2008
@@ -1,129 +1,129 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.myfaces.custom.dojolayouts;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.apache.myfaces.custom.dojo.DojoConfig;
-import org.apache.myfaces.custom.dojo.DojoUtils;
-import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
-
-/**
- * PanelGroup which supports a partialTriggers Attribute similar to the one in Trinidad
- *
- * @JSFRenderer
- * renderKitId = "HTML_BASIC"
- * family = "javax.faces.Output"
- * type = "org.apache.myfaces.FloatingPaneBaseRenderer"
- *
- * @author werpu
- *
- */
-public class FloatingPaneBaseRenderer extends HtmlRenderer {
-
- public void decode(FacesContext context, UIComponent component) {
- super.decode(context, component);
-
- }
-
- protected void encodeJavascriptBegin(FacesContext context, UIComponent component) throws IOException {
- String javascriptLocation = (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
- try {
- if (javascriptLocation != null) {
- DojoUtils.addMainInclude(context, component, javascriptLocation, new DojoConfig());
- } else {
- DojoUtils.addMainInclude(context, component, null, new DojoConfig());
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- String[] requires = { "dojo.widget.*", "dojo.widget.TaskBar", "dojo.widget.LayoutContainer", "dojo.widget.FloatingPane" };
- DojoUtils.addRequire(context, component, requires);
- if (isResizable(component))
- DojoUtils.addRequire(context, component, "dojo.widget.ResizeHandle");
- }
-
- private boolean isResizable(UIComponent component) {
- return ((FloatingPaneBase) component).getResizable() != null && ((FloatingPaneBase) component).getResizable().booleanValue();
- }
-
- public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
-
- if ((context == null) || (component == null)) {
- throw new NullPointerException();
- }
-
- Boolean rendered = (Boolean) component.getAttributes().get("rendered");
-
- if ((rendered != null) && (!rendered.booleanValue()))
- return;
- encodeJavascriptBegin(context, component);
-
- super.encodeBegin(context, component);
-
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.DIV_ELEM, component);
- HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
-
- FloatingPaneBase pane = (FloatingPaneBase) component;
-
- String styleClass = pane.getStyleClass();
- String style = pane.getStyle();
- if (null != styleClass) {
- writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null);
- }
- if (null != style) {
- writer.writeAttribute(HTML.STYLE_ATTR, style, null);
- }
- }
-
- public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
- super.encodeEnd(context, component);
- ResponseWriter writer = context.getResponseWriter();
- writer.endElement(HTML.DIV_ELEM);
- encodeJavascriptEnd(context, component);
- }
-
-
- protected void encodeJavascriptEnd(FacesContext context, UIComponent component) throws IOException {
- FloatingPaneBase pane = (FloatingPaneBase) component;
-
- String[] attributeNames = { "title", "iconSrc", "hasShadow", "constrainToContainer", "taskBarId", "resizable", "titleBarDisplay", "windowState",
- "displayCloseAction", "displayMinimizeAction", "widgetVar", "widgetId" };
-
- if (pane.getModal() != null && pane.getModal().booleanValue())
- DojoUtils.renderWidgetInitializationCode(context, component, "ModalFloatingPane", attributeNames);
- else
- DojoUtils.renderWidgetInitializationCode(context, component, "FloatingPane", attributeNames);
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.myfaces.custom.dojolayouts;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.custom.dojo.DojoConfig;
+import org.apache.myfaces.custom.dojo.DojoUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+
+/**
+ * PanelGroup which supports a partialTriggers Attribute similar to the one in Trinidad
+ *
+ * @JSFRenderer
+ * renderKitId = "HTML_BASIC"
+ * family = "javax.faces.Output"
+ * type = "org.apache.myfaces.FloatingPaneBaseRenderer"
+ *
+ * @author werpu
+ *
+ */
+public class FloatingPaneBaseRenderer extends HtmlRenderer {
+
+ public void decode(FacesContext context, UIComponent component) {
+ super.decode(context, component);
+
+ }
+
+ protected void encodeJavascriptBegin(FacesContext context, UIComponent component) throws IOException {
+ String javascriptLocation = (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+ try {
+ if (javascriptLocation != null) {
+ DojoUtils.addMainInclude(context, component, javascriptLocation, new DojoConfig());
+ } else {
+ DojoUtils.addMainInclude(context, component, null, new DojoConfig());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ String[] requires = { "dojo.widget.*", "dojo.widget.TaskBar", "dojo.widget.LayoutContainer", "dojo.widget.FloatingPane" };
+ DojoUtils.addRequire(context, component, requires);
+ if (isResizable(component))
+ DojoUtils.addRequire(context, component, "dojo.widget.ResizeHandle");
+ }
+
+ private boolean isResizable(UIComponent component) {
+ return ((FloatingPaneBase) component).getResizable() != null && ((FloatingPaneBase) component).getResizable().booleanValue();
+ }
+
+ public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+
+ if ((context == null) || (component == null)) {
+ throw new NullPointerException();
+ }
+
+ Boolean rendered = (Boolean) component.getAttributes().get("rendered");
+
+ if ((rendered != null) && (!rendered.booleanValue()))
+ return;
+ encodeJavascriptBegin(context, component);
+
+ super.encodeBegin(context, component);
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.DIV_ELEM, component);
+ HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
+
+ FloatingPaneBase pane = (FloatingPaneBase) component;
+
+ String styleClass = pane.getStyleClass();
+ String style = pane.getStyle();
+ if (null != styleClass) {
+ writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null);
+ }
+ if (null != style) {
+ writer.writeAttribute(HTML.STYLE_ATTR, style, null);
+ }
+ }
+
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+ super.encodeEnd(context, component);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.endElement(HTML.DIV_ELEM);
+ encodeJavascriptEnd(context, component);
+ }
+
+
+ protected void encodeJavascriptEnd(FacesContext context, UIComponent component) throws IOException {
+ FloatingPaneBase pane = (FloatingPaneBase) component;
+
+ String[] attributeNames = { "title", "iconSrc", "hasShadow", "constrainToContainer", "taskBarId", "resizable", "titleBarDisplay", "windowState",
+ "displayCloseAction", "displayMinimizeAction", "widgetVar", "widgetId" };
+
+ if (pane.getModal() != null && pane.getModal().booleanValue())
+ DojoUtils.renderWidgetInitializationCode(context, component, "ModalFloatingPane", attributeNames);
+ else
+ DojoUtils.renderWidgetInitializationCode(context, component, "FloatingPane", attributeNames);
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+}