You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sl...@apache.org on 2009/04/04 20:45:04 UTC
svn commit: r761982 [9/10] - in /myfaces/core/branches/2_0_0/impl/src:
main/java/com/ main/java/org/apache/myfaces/application/
main/java/org/apache/myfaces/config/
main/java/org/apache/myfaces/config/impl/digester/
main/java/org/apache/myfaces/config/...
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,136 @@
+/*
+ * 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.view.facelets.tag.jstl.core;
+
+import javax.el.ELContext;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+
+/**
+ * @version $Id: IteratedValueExpression.java,v 1.2 2008/07/13 19:01:44 rlubke Exp $
+ */
+public final class IteratedValueExpression extends ValueExpression
+{
+
+ private static final long serialVersionUID = 1L;
+
+ private ValueExpression orig;
+
+ private Object value;
+
+ public IteratedValueExpression(ValueExpression orig, Object value)
+ {
+ this.orig = orig;
+ this.value = value;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
+ */
+ public Object getValue(ELContext context)
+ {
+ return value;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
+ */
+ public void setValue(ELContext context, Object value)
+ {
+ context.setPropertyResolved(false);
+ throw new PropertyNotWritableException();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
+ */
+ public boolean isReadOnly(ELContext context)
+ {
+ context.setPropertyResolved(false);
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getType(javax.el.ELContext)
+ */
+ public Class getType(ELContext context)
+ {
+ context.setPropertyResolved(false);
+ return Object.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getExpectedType()
+ */
+ public Class getExpectedType()
+ {
+ return Object.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#getExpressionString()
+ */
+ public String getExpressionString()
+ {
+ return this.orig.getExpressionString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return this.orig.equals(obj);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#hashCode()
+ */
+ public int hashCode()
+ {
+ return this.orig.hashCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#isLiteralText()
+ */
+ public boolean isLiteralText()
+ {
+ return false;
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatus.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatus.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatus.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatus.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,90 @@
+/*
+ * 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.view.facelets.tag.jstl.core;
+
+import java.io.Serializable;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: IterationStatus.java,v 1.4 2008/07/13 19:01:43 rlubke Exp $
+ */
+public final class IterationStatus implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final int index;
+
+ private final boolean first;
+
+ private final boolean last;
+
+ private final Integer begin;
+
+ private final Integer end;
+
+ private final Integer step;
+
+ /**
+ *
+ */
+ public IterationStatus(boolean first, boolean last, int index, Integer begin, Integer end, Integer step)
+ {
+ this.index = index;
+ this.begin = begin;
+ this.end = end;
+ this.step = step;
+ this.first = first;
+ this.last = last;
+ }
+
+ public boolean isFirst()
+ {
+ return this.first;
+ }
+
+ public boolean isLast()
+ {
+ return this.last;
+ }
+
+ public Integer getBegin()
+ {
+ return begin;
+ }
+
+ public Integer getEnd()
+ {
+ return end;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public Integer getStep()
+ {
+ return step;
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatusExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatusExpression.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatusExpression.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IterationStatusExpression.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,141 @@
+/*
+ * 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.view.facelets.tag.jstl.core;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: IterationStatusExpression.java,v 1.4 2008/07/13 19:01:44 rlubke Exp $
+ */
+public final class IterationStatusExpression extends ValueExpression
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final IterationStatus status;
+
+ /**
+ *
+ */
+ public IterationStatusExpression(IterationStatus status)
+ {
+ this.status = status;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
+ */
+ public Object getValue(ELContext context)
+ {
+ return this.status;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
+ */
+ public void setValue(ELContext context, Object value)
+ {
+ throw new UnsupportedOperationException("Cannot set IterationStatus");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
+ */
+ public boolean isReadOnly(ELContext context)
+ {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getType(javax.el.ELContext)
+ */
+ public Class getType(ELContext context)
+ {
+ return IterationStatus.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getExpectedType()
+ */
+ public Class getExpectedType()
+ {
+ return IterationStatus.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#getExpressionString()
+ */
+ public String getExpressionString()
+ {
+ return this.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return this.status.equals(obj);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#hashCode()
+ */
+ public int hashCode()
+ {
+ return this.status.hashCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#isLiteralText()
+ */
+ public boolean isLiteralText()
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return this.status.toString();
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,53 @@
+/*
+ * 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.view.facelets.tag.jstl.core;
+
+import org.apache.myfaces.view.facelets.tag.AbstractTagLibrary;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: JstlCoreLibrary.java,v 1.5 2008/07/13 19:01:43 rlubke Exp $
+ */
+public final class JstlCoreLibrary extends AbstractTagLibrary
+{
+
+ public final static String Namespace = "http://java.sun.com/jstl/core";
+
+ public final static JstlCoreLibrary Instance = new JstlCoreLibrary();
+
+ public JstlCoreLibrary()
+ {
+ super(Namespace);
+
+ this.addTagHandler("if", IfHandler.class);
+
+ this.addTagHandler("forEach", ForEachHandler.class);
+
+ this.addTagHandler("catch", CatchHandler.class);
+
+ this.addTagHandler("choose", ChooseHandler.class);
+
+ this.addTagHandler("when", ChooseWhenHandler.class);
+
+ this.addTagHandler("otherwise", ChooseOtherwiseHandler.class);
+
+ this.addTagHandler("set", SetHandler.class);
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/MappedValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/MappedValueExpression.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/MappedValueExpression.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/MappedValueExpression.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,195 @@
+/*
+ * 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.view.facelets.tag.jstl.core;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: MappedValueExpression.java,v 1.6 2008/07/13 19:01:43 rlubke Exp $
+ */
+public final class MappedValueExpression extends ValueExpression
+{
+ private final static class Entry implements Map.Entry, Serializable
+ {
+ private final Map src;
+ private final Object key;
+
+ public Entry(Map src, Object key)
+ {
+ this.src = src;
+ this.key = key;
+ }
+
+ public Object getKey()
+ {
+ return key;
+ }
+
+ public Object getValue()
+ {
+ return src.get(key);
+ }
+
+ public Object setValue(Object value)
+ {
+ return src.put(key, value);
+ }
+
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final Object key;
+
+ private final ValueExpression orig;
+
+ /**
+ *
+ */
+ public MappedValueExpression(ValueExpression orig, Map.Entry entry)
+ {
+ this.orig = orig;
+ this.key = entry.getKey();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
+ */
+ public Object getValue(ELContext context)
+ {
+ Object base = this.orig.getValue(context);
+ if (base != null)
+ {
+ context.setPropertyResolved(true);
+ return new Entry((Map) base, key);
+
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
+ */
+ public void setValue(ELContext context, Object value)
+ {
+ Object base = this.orig.getValue(context);
+ if (base != null)
+ {
+ context.setPropertyResolved(false);
+ context.getELResolver().setValue(context, base, key, value);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
+ */
+ public boolean isReadOnly(ELContext context)
+ {
+ Object base = this.orig.getValue(context);
+ if (base != null)
+ {
+ context.setPropertyResolved(false);
+ return context.getELResolver().isReadOnly(context, base, key);
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getType(javax.el.ELContext)
+ */
+ public Class getType(ELContext context)
+ {
+ Object base = this.orig.getValue(context);
+ if (base != null)
+ {
+ context.setPropertyResolved(false);
+ return context.getELResolver().getType(context, base, key);
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.ValueExpression#getExpectedType()
+ */
+ public Class getExpectedType()
+ {
+ return Object.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#getExpressionString()
+ */
+ public String getExpressionString()
+ {
+ return this.orig.getExpressionString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return this.orig.equals(obj);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.Expression#hashCode()
+ */
+ public int hashCode()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)eturn new Map.Entry<K, V>
+ *
+ * @see javax.el.Expression#isLiteralText()
+ */
+ public boolean isLiteralText()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/SetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/SetHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/SetHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/SetHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,60 @@
+/*
+ * 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.view.facelets.tag.jstl.core;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+/**
+ * Simplified implementation of c:set
+ *
+ * @author Jacob Hookom
+ * @version $Id: SetHandler.java,v 1.2 2008/07/13 19:01:44 rlubke Exp $
+ */
+public class SetHandler extends TagHandler
+{
+
+ private final TagAttribute var;
+
+ private final TagAttribute value;
+
+ public SetHandler(TagConfig config)
+ {
+ super(config);
+ this.value = this.getRequiredAttribute("value");
+ this.var = this.getRequiredAttribute("var");
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ String varStr = this.var.getValue(ctx);
+ ValueExpression veObj = this.value.getValueExpression(ctx, Object.class);
+ ctx.getVariableMapper().setVariable(varStr, veObj);
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/package.html
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/package.html?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/package.html (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/package.html Sat Apr 4 18:44:59 2009
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ 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.
+
+ $Id: package.html,v 1.3 2008/07/13 19:01:43 rlubke Exp $
+-->
+</head>
+<body bgcolor="white">
+Tag Library for <b>http://java.sun.com/jstl/core</b>.
+See JSTL Core Tag Javadocs for attributes/functionality.
+</body>
+</html>
\ No newline at end of file
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,98 @@
+/*
+ * 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.view.facelets.tag.jstl.fn;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+import org.apache.myfaces.view.facelets.tag.TagLibrary;
+
+/**
+ * Library for JSTL Functions
+ *
+ * @author Jacob Hookom
+ * @version $Id: JstlFnLibrary.java,v 1.3 2008/07/13 19:01:51 rlubke Exp $
+ */
+public class JstlFnLibrary implements TagLibrary
+{
+ public final static String Namespace = "http://java.sun.com/jsp/jstl/functions";
+
+ private final Map<String, Method> fns = new HashMap<String, Method>();
+
+ public JstlFnLibrary()
+ {
+ super();
+ try
+ {
+ Method[] methods = JstlFunction.class.getMethods();
+ for (int i = 0; i < methods.length; i++)
+ {
+ if (Modifier.isStatic(methods[i].getModifiers()))
+ {
+ fns.put(methods[i].getName(), methods[i]);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean containsNamespace(String ns)
+ {
+ return Namespace.equals(ns);
+ }
+
+ public boolean containsTagHandler(String ns, String localName)
+ {
+ return false;
+ }
+
+ public TagHandler createTagHandler(String ns, String localName, TagConfig tag) throws FacesException
+ {
+ return null;
+ }
+
+ public boolean containsFunction(String ns, String name)
+ {
+ if (Namespace.equals(ns))
+ {
+ return this.fns.containsKey(name);
+ }
+
+ return false;
+ }
+
+ public Method createFunction(String ns, String name)
+ {
+ if (Namespace.equals(ns))
+ {
+ return (Method) this.fns.get(name);
+ }
+
+ return null;
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,244 @@
+/*
+ * 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.view.facelets.tag.jstl.fn;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Implementations of JSTL Functions
+ *
+ * @author Jacob Hookom
+ * @version $Id: JstlFunction.java,v 1.6 2009/01/16 20:51:11 rlubke Exp $
+ */
+public final class JstlFunction
+{
+ private JstlFunction()
+ {
+ }
+
+ public static boolean contains(String name, String searchString)
+ {
+ if (name == null || searchString == null)
+ {
+ return false;
+ }
+
+ return -1 != name.indexOf(searchString);
+ }
+
+ public static boolean containsIgnoreCase(String name, String searchString)
+ {
+ if (name == null || searchString == null)
+ {
+ return false;
+ }
+
+ return -1 != name.toUpperCase().indexOf(searchString.toUpperCase());
+ }
+
+ public static boolean endsWith(String name, String searchString)
+ {
+ if (name == null || searchString == null)
+ {
+ return false;
+ }
+
+ return name.endsWith(searchString);
+ }
+
+ public static String escapeXml(String value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ return value.replaceAll("<", "<");
+ }
+
+ public static int indexOf(String name, String searchString)
+ {
+ if (name == null || searchString == null)
+ {
+ return -1;
+ }
+
+ return name.indexOf(searchString);
+ }
+
+ public static String join(String[] a, String delim)
+ {
+ if (a == null || delim == null)
+ {
+ return null;
+ }
+
+ if (a.length == 0)
+ {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder(a.length * (a[0].length() + delim.length()));
+ for (int i = 0; i < a.length; i++)
+ {
+ sb.append(a[i]);
+ if (i < (a.length - 1))
+ {
+ sb.append(delim);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ public static int length(Object obj)
+ {
+ if (obj == null)
+ {
+ return 0;
+ }
+
+ if (obj instanceof Collection)
+ {
+ return ((Collection<?>) obj).size();
+ }
+
+ if (obj.getClass().isArray())
+ {
+ return Array.getLength(obj);
+ }
+
+ if (obj instanceof String)
+ {
+ return ((String) obj).length();
+ }
+
+ if (obj instanceof Map)
+ {
+ return ((Map<?, ?>) obj).size();
+ }
+
+ throw new IllegalArgumentException("Object type not supported: " + obj.getClass().getName());
+ }
+
+ public static String replace(String value, String a, String b)
+ {
+ if (value == null || a == null || b == null)
+ {
+ return null;
+ }
+
+ return value.replaceAll(a, b);
+ }
+
+ public static String[] split(String value, String d)
+ {
+ if (value == null || d == null)
+ {
+ return null;
+ }
+
+ return value.split(d);
+ }
+
+ public static boolean startsWith(String value, String p)
+ {
+ if (value == null || p == null)
+ {
+ return false;
+ }
+
+ return value.startsWith(p);
+ }
+
+ public static String substring(String v, int s, int e)
+ {
+ if (v == null)
+ {
+ return null;
+ }
+
+ return v.substring(s, e);
+ }
+
+ public static String substringAfter(String v, String p)
+ {
+ if (v == null)
+ {
+ return null;
+ }
+
+ int i = v.indexOf(p);
+ if (i >= 0)
+ {
+ return v.substring(i + p.length());
+ }
+
+ return null;
+ }
+
+ public static String substringBefore(String v, String s)
+ {
+ if (v == null)
+ {
+ return null;
+ }
+
+ int i = v.indexOf(s);
+ if (i > 0)
+ {
+ return v.substring(0, i);
+ }
+
+ return null;
+ }
+
+ public static String toLowerCase(String v)
+ {
+ if (v == null)
+ {
+ return null;
+ }
+
+ return v.toLowerCase();
+ }
+
+ public static String toUpperCase(String v)
+ {
+ if (v == null)
+ {
+ return null;
+ }
+
+ return v.toUpperCase();
+ }
+
+ public static String trim(String v)
+ {
+ if (v == null)
+ {
+ return null;
+ }
+
+ return v.trim();
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/package.html
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/package.html?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/package.html (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/package.html Sat Apr 4 18:44:59 2009
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ 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.
+
+ $Id: package.html,v 1.3 2008/07/13 19:01:51 rlubke Exp $
+-->
+</head>
+<body bgcolor="white">
+Tag Library for <b>http://java.sun.com/jstl/functions</b>.
+See JSTL Functions Tag Javadocs for attributes/functionality.
+</body>
+</html>
\ No newline at end of file
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/package.html
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/package.html?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/package.html (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/package.html Sat Apr 4 18:44:59 2009
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ 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.
+
+ $Id: package.html,v 1.3 2008/07/13 19:01:36 rlubke Exp $
+-->
+</head>
+<body bgcolor="white">
+Tags and other objects that define Facelet implementations.
+Includes abstract classes to make the developer's job easier.
+</body>
+</html>
\ No newline at end of file
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRef.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRef.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRef.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRef.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,39 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import javax.faces.component.UIComponentBase;
+
+public final class ComponentRef extends UIComponentBase
+{
+
+ public final static String COMPONENT_TYPE = "facelets.ui.ComponentRef";
+ public final static String COMPONENT_FAMILY = "facelets";
+
+ public ComponentRef()
+ {
+ super();
+ }
+
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRefHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRefHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRefHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ComponentRefHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import javax.faces.view.facelets.ComponentConfig;
+
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentHandler;
+
+public final class ComponentRefHandler extends ComponentHandler
+{
+
+ public final static String Name = "component";
+
+ public ComponentRefHandler(ComponentConfig config)
+ {
+ super(config);
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,169 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.ELException;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+import org.apache.myfaces.view.facelets.TemplateClient;
+import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
+import org.apache.myfaces.view.facelets.tag.TagHandlerUtils;
+
+/**
+ * TODO: REFACTOR - This class could easily use a common parent with DecoratorHandler
+ *
+ * @author Jacob Hookom
+ * @version $Id: CompositionHandler.java,v 1.14 2008/07/13 19:01:42 rlubke Exp $
+ */
+public final class CompositionHandler extends TagHandler implements TemplateClient
+{
+
+ private static final Logger log = Logger.getLogger("facelets.tag.ui.composition");
+
+ public final static String Name = "composition";
+
+ protected final TagAttribute _template;
+
+ protected final Map<String, DefineHandler> _handlers;
+
+ protected final ParamHandler[] _params;
+
+ /**
+ * @param config
+ */
+ public CompositionHandler(TagConfig config)
+ {
+ super(config);
+ _template = getAttribute("template");
+ if (_template != null)
+ {
+ _handlers = new HashMap<String, DefineHandler>();
+ for (DefineHandler handler : TagHandlerUtils.findNextByType(nextHandler, DefineHandler.class))
+ {
+ _handlers.put(handler.getName(), handler);
+ if (log.isLoggable(Level.FINE))
+ {
+ log.fine(tag + " found Define[" + handler.getName() + "]");
+ }
+ }
+
+ Collection<ParamHandler> params = TagHandlerUtils.findNextByType(nextHandler, ParamHandler.class);
+ if (!params.isEmpty())
+ {
+ int i = 0;
+ _params = new ParamHandler[params.size()];
+ for (ParamHandler handler : params)
+ {
+ _params[i++] = handler;
+ }
+ }
+ else
+ {
+ _params = null;
+ }
+ }
+ else
+ {
+ _params = null;
+ _handlers = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ if (_template != null)
+ {
+ VariableMapper orig = ctx.getVariableMapper();
+ if (_params != null)
+ {
+ VariableMapper vm = new VariableMapperWrapper(orig);
+ ctx.setVariableMapper(vm);
+ for (int i = 0; i < _params.length; i++)
+ {
+ _params[i].apply(ctx, parent);
+ }
+ }
+
+ // ctx.extendClient(this);
+ try
+ {
+ ctx.includeFacelet(parent, _template.getValue(ctx));
+ }
+ finally
+ {
+ // ctx.popClient(this);
+ ctx.setVariableMapper(orig);
+ }
+ }
+ else
+ {
+ this.nextHandler.apply(ctx, parent);
+ }
+ }
+
+ public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
+ FaceletException, ELException
+ {
+ if (name != null)
+ {
+ if (_handlers == null)
+ {
+ return false;
+ }
+
+ DefineHandler handler = _handlers.get(name);
+ if (handler != null)
+ {
+ handler.applyDefinition(ctx, parent);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ this.nextHandler.apply(ctx, parent);
+ return true;
+ }
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,147 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.ELException;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+import org.apache.myfaces.view.facelets.TemplateClient;
+import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
+import org.apache.myfaces.view.facelets.tag.TagHandlerUtils;
+
+/**
+ * TODO: REFACTOR - This class could easily use a common parent with CompositionHandler
+ *
+ * @author Jacob Hookom
+ * @version $Id: DecorateHandler.java,v 1.16 2008/07/13 19:01:41 rlubke Exp $
+ */
+public final class DecorateHandler extends TagHandler implements TemplateClient
+{
+
+ private static final Logger log = Logger.getLogger("facelets.tag.ui.decorate");
+
+ private final TagAttribute _template;
+
+ private final Map<String, DefineHandler> _handlers;
+
+ private final ParamHandler[] _params;
+
+ /**
+ * @param config
+ */
+ public DecorateHandler(TagConfig config)
+ {
+ super(config);
+ _template = getRequiredAttribute("template");
+ _handlers = new HashMap<String, DefineHandler>();
+
+ for (DefineHandler handler : TagHandlerUtils.findNextByType(nextHandler, DefineHandler.class))
+ {
+ _handlers.put(handler.getName(), handler);
+ if (log.isLoggable(Level.FINE))
+ {
+ log.fine(tag + " found Define[" + handler.getName() + "]");
+ }
+ }
+
+ Collection<ParamHandler> params = TagHandlerUtils.findNextByType(nextHandler, ParamHandler.class);
+ if (!params.isEmpty())
+ {
+ int i = 0;
+ _params = new ParamHandler[params.size()];
+ for (ParamHandler handler : params)
+ {
+ _params[i++] = handler;
+ }
+ }
+ else
+ {
+ _params = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ VariableMapper orig = ctx.getVariableMapper();
+ if (_params != null)
+ {
+ VariableMapper vm = new VariableMapperWrapper(orig);
+ ctx.setVariableMapper(vm);
+ for (int i = 0; i < _params.length; i++)
+ {
+ _params[i].apply(ctx, parent);
+ }
+ }
+
+ // ctx.pushClient(this);
+ try
+ {
+ ctx.includeFacelet(parent, _template.getValue(ctx));
+ }
+ finally
+ {
+ ctx.setVariableMapper(orig);
+ // ctx.popClient(this);
+ }
+ }
+
+ public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
+ FaceletException, ELException
+ {
+ if (name != null)
+ {
+ DefineHandler handler = _handlers.get(name);
+ if (handler != null)
+ {
+ handler.applyDefinition(ctx, parent);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ this.nextHandler.apply(ctx, parent);
+ return true;
+ }
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DefineHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DefineHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DefineHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DefineHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,78 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: DefineHandler.java,v 1.5 2008/07/13 19:01:41 rlubke Exp $
+ */
+public final class DefineHandler extends TagHandler
+{
+
+ private final String name;
+
+ /**
+ * @param config
+ */
+ public DefineHandler(TagConfig config)
+ {
+ super(config);
+ TagAttribute attr = this.getRequiredAttribute("name");
+ if (!attr.isLiteral())
+ {
+ throw new TagAttributeException(this.tag, attr, "Must be Literal");
+ }
+ this.name = attr.getValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ // no-op
+ // this.nextHandler.apply(ctx, parent);
+ }
+
+ public void applyDefinition(FaceletContext ctx, UIComponent parent) throws IOException, FacesException,
+ FaceletException, ELException
+ {
+ this.nextHandler.apply(ctx, parent);
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,78 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: IncludeHandler.java,v 1.5 2008/07/13 19:01:41 rlubke Exp $
+ */
+public final class IncludeHandler extends TagHandler
+{
+
+ private final TagAttribute src;
+
+ /**
+ * @param config
+ */
+ public IncludeHandler(TagConfig config)
+ {
+ super(config);
+ this.src = this.getRequiredAttribute("src");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ String path = this.src.getValue(ctx);
+ if (path == null || path.length() == 0)
+ {
+ return;
+ }
+ VariableMapper orig = ctx.getVariableMapper();
+ ctx.setVariableMapper(new VariableMapperWrapper(orig));
+ try
+ {
+ this.nextHandler.apply(ctx, null);
+ ctx.includeFacelet(parent, path);
+ }
+ finally
+ {
+ ctx.setVariableMapper(orig);
+ }
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,86 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+import org.apache.myfaces.view.facelets.TemplateClient;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: InsertHandler.java,v 1.7 2008/07/13 19:01:42 rlubke Exp $
+ */
+public final class InsertHandler extends TagHandler implements TemplateClient
+{
+
+ private final String name;
+
+ /**
+ * @param config
+ */
+ public InsertHandler(TagConfig config)
+ {
+ super(config);
+ TagAttribute attr = this.getAttribute("name");
+ if (attr != null)
+ {
+ if (!attr.isLiteral())
+ {
+ throw new TagAttributeException(this.tag, attr, "Must be Literal");
+ }
+ this.name = attr.getValue();
+ }
+ else
+ {
+ this.name = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ this.nextHandler.apply(ctx, parent);
+ }
+
+ public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
+ FaceletException, ELException
+ {
+ if (this.name == name || this.name != null && this.name.equals(name))
+ {
+ this.nextHandler.apply(ctx, parent);
+ return true;
+ }
+ return false;
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ParamHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ParamHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ParamHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/ParamHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,67 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: ParamHandler.java,v 1.6 2008/07/13 19:01:42 rlubke Exp $
+ */
+public class ParamHandler extends TagHandler
+{
+
+ private final TagAttribute name;
+
+ private final TagAttribute value;
+
+ /**
+ * @param config
+ */
+ public ParamHandler(TagConfig config)
+ {
+ super(config);
+ this.name = this.getRequiredAttribute("name");
+ this.value = this.getRequiredAttribute("value");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
+ ELException
+ {
+ String nameStr = this.name.getValue(ctx);
+ ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class);
+ ctx.getVariableMapper().setVariable(nameStr, valueVE);
+ }
+
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,105 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.TagAttribute;
+
+public class RepeatHandler extends ComponentHandler
+{
+
+ public RepeatHandler(ComponentConfig config)
+ {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class<?> type)
+ {
+ MetaRuleset meta = super.createMetaRuleset(type);
+
+ if (!UILibrary.Namespace.equals(this.tag.getNamespace()))
+ {
+ meta.add(new TagMetaData(type));
+ }
+
+ meta.alias("class", "styleClass");
+
+ return meta;
+ }
+
+ private class TagMetaData extends Metadata
+ {
+ private final String[] attrs;
+
+ public TagMetaData(Class<?> type)
+ {
+ Set<String> names = new HashSet<String>();
+ for (TagAttribute attribute : tag.getAttributes().getAll())
+ {
+ if ("class".equals(attribute.getLocalName()))
+ {
+ names.add("styleClass");
+ }
+ else
+ {
+ names.add(attribute.getLocalName());
+ }
+ }
+
+ try
+ {
+ for (PropertyDescriptor descriptor : Introspector.getBeanInfo(type).getPropertyDescriptors())
+ {
+ if (descriptor.getWriteMethod() != null)
+ {
+ names.remove(descriptor.getName());
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // do nothing
+ }
+
+ this.attrs = names.toArray(new String[names.size()]);
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance)
+ {
+ UIComponent component = (UIComponent) instance;
+ Map<String, Object> attrs = component.getAttributes();
+ attrs.put("alias.element", tag.getQName());
+ if (this.attrs.length > 0)
+ {
+ attrs.put("alias.attributes", this.attrs);
+ }
+ }
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,194 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.myfaces.view.facelets.util.DevTools;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: UIDebug.java,v 1.6 2008/07/13 19:01:41 rlubke Exp $
+ */
+public final class UIDebug extends UIComponentBase
+{
+ public static final String COMPONENT_TYPE = "facelets.ui.Debug";
+ public static final String COMPONENT_FAMILY = "facelets";
+ public static final String DEFAULT_HOTKEY = "D";
+
+ private static final String KEY = "facelets.ui.DebugOutput";
+
+ private static long nextId = System.currentTimeMillis();
+
+ private String _hotkey = DEFAULT_HOTKEY;
+
+ public UIDebug()
+ {
+ setTransient(true);
+ setRendered(true);
+ setRendererType(null);
+ }
+
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ public List<UIComponent> getChildren()
+ {
+ return new ArrayList<UIComponent>()
+ {
+ public boolean add(UIComponent o)
+ {
+ throw new IllegalStateException("<ui:debug> does not support children");
+ }
+
+ public void add(int index, UIComponent o)
+ {
+ throw new IllegalStateException("<ui:debug> does not support children");
+ }
+ };
+ }
+
+ public void encodeBegin(FacesContext faces) throws IOException
+ {
+
+ String actionId = faces.getApplication().getViewHandler().getActionURL(faces, faces.getViewRoot().getViewId());
+
+ StringBuilder sb = new StringBuilder(512);
+ sb.append("<script language=\"javascript\" type=\"text/javascript\">\n");
+ sb.append("//<![CDATA[\n");
+ sb
+ .append("function faceletsDebug(URL) { day = new Date(); id = day.getTime(); eval(\"page\" + id + \" = window.open(URL, '\" + id + \"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 240,top = 212');\"); };");
+ sb
+ .append("var faceletsOrigKeyup = document.onkeyup; document.onkeyup = function(e) { if (window.event) e = window.event; if (String.fromCharCode(e.keyCode) == '"
+ + this.getHotkey() + "' & e.shiftKey & e.ctrlKey) faceletsDebug('");
+ sb.append(actionId);
+ sb.append('?');
+ sb.append(KEY);
+ sb.append('=');
+ sb.append(writeDebugOutput(faces));
+ sb.append("'); else if (faceletsOrigKeyup) faceletsOrigKeyup(e); };\n");
+ sb.append("//]]>\n");
+ sb.append("</script>\n");
+
+ ResponseWriter writer = faces.getResponseWriter();
+ writer.write(sb.toString());
+ }
+
+ @SuppressWarnings("unchecked")
+ private static String writeDebugOutput(FacesContext faces) throws IOException
+ {
+ FastWriter fw = new FastWriter();
+ DevTools.debugHtml(fw, faces);
+
+ Map<String, Object> session = faces.getExternalContext().getSessionMap();
+ Map<String, String> debugs = (Map<String, String>) session.get(KEY);
+ if (debugs == null)
+ {
+ debugs = new LinkedHashMap<String, String>()
+ {
+ protected boolean removeEldestEntry(Entry<String, String> eldest)
+ {
+ return (this.size() > 5);
+ }
+ };
+
+ session.put(KEY, debugs);
+ }
+
+ String id = String.valueOf(nextId++);
+
+ debugs.put(id, fw.toString());
+
+ return id;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static String fetchDebugOutput(FacesContext faces, String id)
+ {
+ Map<String, Object> session = faces.getExternalContext().getSessionMap();
+ Map<String, String> debugs = (Map<String, String>) session.get(KEY);
+ if (debugs != null)
+ {
+ return debugs.get(id);
+ }
+
+ return null;
+ }
+
+ public static boolean debugRequest(FacesContext faces)
+ {
+ String id = (String) faces.getExternalContext().getRequestParameterMap().get(KEY);
+ if (id != null)
+ {
+ Object resp = faces.getExternalContext().getResponse();
+ if (!faces.getResponseComplete() && resp instanceof HttpServletResponse)
+ {
+ try
+ {
+ HttpServletResponse httpResp = (HttpServletResponse) resp;
+ String page = fetchDebugOutput(faces, id);
+ if (page != null)
+ {
+ httpResp.setContentType("text/html");
+ httpResp.getWriter().write(page);
+ }
+ else
+ {
+ httpResp.setContentType("text/plain");
+ httpResp.getWriter().write("No Debug Output Available");
+ }
+ httpResp.flushBuffer();
+ faces.responseComplete();
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public String getHotkey()
+ {
+ return _hotkey;
+ }
+
+ public void setHotkey(String hotkey)
+ {
+ _hotkey = (hotkey != null) ? hotkey.toUpperCase() : "";
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java Sat Apr 4 18:44:59 2009
@@ -0,0 +1,59 @@
+/*
+ * 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.view.facelets.tag.ui;
+
+import org.apache.myfaces.view.facelets.component.UIRepeat;
+import org.apache.myfaces.view.facelets.tag.AbstractTagLibrary;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: UILibrary.java,v 1.8 2008/07/13 19:01:42 rlubke Exp $
+ */
+public final class UILibrary extends AbstractTagLibrary
+{
+
+ public final static String Namespace = "http://java.sun.com/jsf/facelets";
+
+ public final static UILibrary Instance = new UILibrary();
+
+ public UILibrary()
+ {
+ super(Namespace);
+
+ this.addTagHandler("include", IncludeHandler.class);
+
+ this.addTagHandler("composition", CompositionHandler.class);
+
+ this.addComponent("component", ComponentRef.COMPONENT_TYPE, null, ComponentRefHandler.class);
+
+ this.addComponent("fragment", ComponentRef.COMPONENT_TYPE, null, ComponentRefHandler.class);
+
+ this.addTagHandler("define", DefineHandler.class);
+
+ this.addTagHandler("insert", InsertHandler.class);
+
+ this.addTagHandler("param", ParamHandler.class);
+
+ this.addTagHandler("decorate", DecorateHandler.class);
+
+ this.addComponent("repeat", UIRepeat.COMPONENT_TYPE, null, RepeatHandler.class);
+
+ this.addComponent("debug", UIDebug.COMPONENT_TYPE, null);
+ }
+}
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/package.html
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/package.html?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/package.html (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/package.html Sat Apr 4 18:44:59 2009
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ 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.
+
+ $Id: package.html,v 1.3 2008/07/13 19:01:41 rlubke Exp $
+-->
+</head>
+<body bgcolor="white">
+Tag Library for <b>http://java.sun.com/jsf/ui</b>.
+See JSF Core Tag Javadocs for attributes/functionality.
+</body>
+</html>
\ No newline at end of file