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/02/12 02:23:58 UTC
svn commit: r743585 [2/3] - in
/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets: ./
compiler/ component/ el/ impl/ tag/ tag/jsf/ tag/jsf/core/ tag/jstl/core/
tag/ui/ util/
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/UIRepeat.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/UIRepeat.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/UIRepeat.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/UIRepeat.java Thu Feb 12 01:23:54 2009
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Map;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.component.EditableValueHolder;
@@ -35,7 +36,6 @@
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
@@ -47,38 +47,40 @@
import javax.faces.model.ScalarDataModel;
import javax.faces.render.Renderer;
-import com.sun.facelets.tag.jsf.ComponentSupport;
-import com.sun.facelets.util.FacesAPI;
-
public class UIRepeat extends UIComponentBase implements NamingContainer
{
-
public static final String COMPONENT_TYPE = "facelets.ui.Repeat";
public static final String COMPONENT_FAMILY = "facelets";
- private final static DataModel EMPTY_MODEL = new ListDataModel(Collections.EMPTY_LIST);
+ private final static DataModel<?> EMPTY_MODEL = new ListDataModel<Object>(Collections.emptyList());
- // our data
- private Object value;
+ private final static SavedState NullState = new SavedState();
- private transient DataModel model;
+ private Map<String, SavedState> _childState;
+
+ // our data
+ private Object _value;
// variables
- private String var;
+ private String _var;
- private String varStatus;
+ //FIXME: varStatus isn't used, should support be added? private String _varStatus;
- private int index = -1;
+ private int _index = -1;
// scoping
- private int offset = -1;
+ private int _offset = -1;
+
+ private int _size = -1;
- private int size = -1;
+ private transient StringBuffer _buffer;
+ private transient DataModel<?> _model;
+ private transient Object _origValue;
public UIRepeat()
{
- this.setRendererType("facelets.ui.Repeat");
+ setRendererType("facelets.ui.Repeat");
}
public String getFamily()
@@ -88,232 +90,227 @@
public int getOffset()
{
- if (this.offset != -1)
+ if (_offset != -1)
{
- return this.offset;
+ return _offset;
}
- ValueBinding vb = this.getValueBinding("offset");
- if (vb != null)
+
+ ValueExpression ve = getValueExpression("offset");
+ if (ve != null)
{
- return ((Integer) vb.getValue(FacesContext.getCurrentInstance())).intValue();
+ return ((Integer)ve.getValue(getFacesContext().getELContext())).intValue();
}
+
return 0;
}
public void setOffset(int offset)
{
- this.offset = offset;
+ _offset = offset;
}
public int getSize()
{
- if (this.size != -1)
+ if (_size != -1)
{
- return this.size;
+ return _size;
}
- ValueBinding vb = this.getValueBinding("size");
- if (vb != null)
+
+ ValueExpression ve = getValueExpression("size");
+ if (ve != null)
{
- return ((Integer) vb.getValue(FacesContext.getCurrentInstance())).intValue();
+ return ((Integer)ve.getValue(getFacesContext().getELContext())).intValue();
}
+
return -1;
}
public void setSize(int size)
{
- this.size = size;
+ _size = size;
}
public String getVar()
{
- return this.var;
+ return _var;
}
public void setVar(String var)
{
- this.var = var;
+ _var = var;
}
- private void resetDataModel()
+ private synchronized void setDataModel(DataModel<?> model)
{
- if (this.isNestedInIterator())
- {
- this.setDataModel(null);
- }
- }
-
- private synchronized void setDataModel(DataModel model)
- {
- this.model = model;
+ _model = model;
}
- private synchronized DataModel getDataModel()
+ @SuppressWarnings("unchecked")
+ private synchronized DataModel<?> getDataModel()
{
- if (this.model == null)
+ if (_model == null)
{
- Object val = this.getValue();
+ Object val = getValue();
if (val == null)
{
- this.model = EMPTY_MODEL;
+ _model = EMPTY_MODEL;
}
else if (val instanceof DataModel)
{
- this.model = (DataModel) val;
+ _model = (DataModel<?>) val;
}
else if (val instanceof List)
{
- this.model = new ListDataModel((List) val);
+ _model = new ListDataModel<Object>((List<Object>) val);
}
else if (Object[].class.isAssignableFrom(val.getClass()))
{
- this.model = new ArrayDataModel((Object[]) val);
+ _model = new ArrayDataModel<Object>((Object[]) val);
}
else if (val instanceof ResultSet)
{
- this.model = new ResultSetDataModel((ResultSet) val);
+ _model = new ResultSetDataModel((ResultSet) val);
}
else
{
- this.model = new ScalarDataModel(val);
+ _model = new ScalarDataModel(val);
}
}
- return this.model;
+ return _model;
}
public Object getValue()
{
- if (this.value == null)
+ if (_value == null)
{
- ValueBinding vb = this.getValueBinding("value");
- if (vb != null)
+ ValueExpression ve = getValueExpression("value");
+ if (ve != null)
{
- return vb.getValue(FacesContext.getCurrentInstance());
+ return ve.getValue(getFacesContext().getELContext());
}
}
- return this.value;
+
+ return _value;
}
public void setValue(Object value)
{
- this.value = value;
- }
-
- private transient StringBuffer buffer;
-
- private StringBuffer getBuffer()
- {
- if (this.buffer == null)
- {
- this.buffer = new StringBuffer();
- }
- this.buffer.setLength(0);
- return this.buffer;
+ _value = value;
}
+ @Override
public String getClientId(FacesContext faces)
{
String id = super.getClientId(faces);
- if (this.index >= 0)
+ if (_index >= 0)
{
- id = this.getBuffer().append(id).append(NamingContainer.SEPARATOR_CHAR).append(this.index).toString();
+ id = _getBuffer().append(id).append(NamingContainer.SEPARATOR_CHAR).append(_index).toString();
}
return id;
}
- private transient Object origValue;
-
- private void captureOrigValue()
+ private void _captureOrigValue()
{
- if (this.var != null)
+ if (_var != null)
{
- FacesContext faces = FacesContext.getCurrentInstance();
- Map attrs = faces.getExternalContext().getRequestMap();
- this.origValue = attrs.get(this.var);
+ _origValue = getFacesContext().getExternalContext().getRequestMap().get(_var);
}
}
- private void restoreOrigValue()
+ private StringBuffer _getBuffer()
{
- if (this.var != null)
+ if (_buffer == null)
{
- FacesContext faces = FacesContext.getCurrentInstance();
- Map attrs = faces.getExternalContext().getRequestMap();
- if (this.origValue != null)
- {
- attrs.put(this.var, this.origValue);
- }
- else
- {
- attrs.remove(this.var);
- }
+ _buffer = new StringBuffer();
}
+
+ _buffer.setLength(0);
+
+ return _buffer;
}
- private Map childState;
-
- private Map getChildState()
+ private Map<String, SavedState> _getChildState()
{
- if (this.childState == null)
+ if (_childState == null)
{
- this.childState = new HashMap();
+ _childState = new HashMap<String, SavedState>();
}
- return this.childState;
+
+ return _childState;
}
- private void saveChildState()
+ private boolean _isIndexAvailable()
{
- if (this.getChildCount() > 0)
- {
-
- FacesContext faces = FacesContext.getCurrentInstance();
+ return getDataModel().isRowAvailable();
+ }
- Iterator itr = this.getChildren().iterator();
- while (itr.hasNext())
+ private boolean _isNestedInIterator()
+ {
+ UIComponent parent = getParent();
+ while (parent != null)
+ {
+ if (parent instanceof UIData || parent instanceof UIRepeat)
{
- this.saveChildState(faces, (UIComponent) itr.next());
+ return true;
}
+ parent = parent.getParent();
}
+ return false;
}
- private void saveChildState(FacesContext faces, UIComponent c)
+ private boolean _keepSaved(FacesContext context)
{
-
- if (c instanceof EditableValueHolder && !c.isTransient())
+ for (String clientId : _getChildState().keySet())
{
- String clientId = c.getClientId(faces);
- SavedState ss = (SavedState) this.getChildState().get(clientId);
- if (ss == null)
+ for (FacesMessage message : context.getMessageList(clientId))
{
- ss = new SavedState();
- this.getChildState().put(clientId, ss);
+ if (message.getSeverity().compareTo(FacesMessage.SEVERITY_ERROR) >= 0)
+ {
+ return true;
+ }
}
- ss.populate((EditableValueHolder) c);
}
+
+ return _isNestedInIterator();
+ }
- // continue hack
- Iterator itr = c.getFacetsAndChildren();
- while (itr.hasNext())
+ private void _resetDataModel()
+ {
+ if (_isNestedInIterator())
{
- saveChildState(faces, (UIComponent) itr.next());
+ setDataModel(null);
}
}
- private void restoreChildState()
+ private void _restoreOrigValue()
{
- if (this.getChildCount() > 0)
+ if (_var != null)
{
+ Map<String, Object> attrs = getFacesContext().getExternalContext().getRequestMap();
+ if (_origValue != null)
+ {
+ attrs.put(_var, _origValue);
+ }
+ else
+ {
+ attrs.remove(_var);
+ }
+ }
+ }
- FacesContext faces = FacesContext.getCurrentInstance();
-
- Iterator itr = this.getChildren().iterator();
- while (itr.hasNext())
+ private void _restoreChildState()
+ {
+ if (getChildCount() > 0)
+ {
+ FacesContext context = getFacesContext();
+ for (UIComponent child : getChildren())
{
- this.restoreChildState(faces, (UIComponent) itr.next());
+ _restoreChildState(context, child);
}
}
}
- private void restoreChildState(FacesContext faces, UIComponent c)
+ private void _restoreChildState(FacesContext faces, UIComponent c)
{
// reset id
String id = c.getId();
@@ -324,7 +321,7 @@
{
EditableValueHolder evh = (EditableValueHolder) c;
String clientId = c.getClientId(faces);
- SavedState ss = (SavedState) this.getChildState().get(clientId);
+ SavedState ss = _getChildState().get(clientId);
if (ss != null)
{
ss.apply(evh);
@@ -336,97 +333,87 @@
}
// continue hack
- Iterator itr = c.getFacetsAndChildren();
+ Iterator<UIComponent> itr = c.getFacetsAndChildren();
while (itr.hasNext())
{
- restoreChildState(faces, (UIComponent) itr.next());
+ _restoreChildState(faces, itr.next());
}
}
- private boolean keepSaved(FacesContext context)
+ private void _saveChildState()
{
-
- Iterator clientIds = this.getChildState().keySet().iterator();
- while (clientIds.hasNext())
+ if (getChildCount() > 0)
{
- String clientId = (String) clientIds.next();
- Iterator messages = context.getMessages(clientId);
- while (messages.hasNext())
+ FacesContext context = getFacesContext();
+ for (UIComponent child : getChildren())
{
- FacesMessage message = (FacesMessage) messages.next();
- if (message.getSeverity().compareTo(FacesMessage.SEVERITY_ERROR) >= 0)
- {
- return (true);
- }
+ _saveChildState(context, child);
}
}
- return (isNestedInIterator());
}
- private boolean isNestedInIterator()
+ private void _saveChildState(FacesContext faces, UIComponent c)
{
- UIComponent parent = this.getParent();
- while (parent != null)
+ if (c instanceof EditableValueHolder && !c.isTransient())
{
- if (parent instanceof UIData || parent instanceof UIRepeat)
+ String clientId = c.getClientId(faces);
+ SavedState ss = (SavedState) _getChildState().get(clientId);
+ if (ss == null)
{
- return true;
+ ss = new SavedState();
+ _getChildState().put(clientId, ss);
}
- parent = parent.getParent();
+
+ ss.populate((EditableValueHolder) c);
+ }
+
+ // continue hack
+ Iterator<UIComponent> itr = c.getFacetsAndChildren();
+ while (itr.hasNext())
+ {
+ _saveChildState(faces, itr.next());
}
- return false;
}
- private void setIndex(int index)
+ private void _setIndex(int index)
{
-
// save child state
- this.saveChildState();
+ _saveChildState();
- this.index = index;
- DataModel localModel = getDataModel();
+ _index = index;
+
+ DataModel<?> localModel = getDataModel();
localModel.setRowIndex(index);
- if (this.index != -1 && this.var != null && localModel.isRowAvailable())
+ if (_index != -1 && _var != null && localModel.isRowAvailable())
{
- FacesContext faces = FacesContext.getCurrentInstance();
- Map attrs = faces.getExternalContext().getRequestMap();
- attrs.put(var, localModel.getRowData());
+ getFacesContext().getExternalContext().getRequestMap().put(_var, localModel.getRowData());
}
// restore child state
- this.restoreChildState();
- }
-
- private boolean isIndexAvailable()
- {
- return this.getDataModel().isRowAvailable();
+ _restoreChildState();
}
public void process(FacesContext faces, PhaseId phase)
{
-
// stop if not rendered
- if (!this.isRendered())
+ if (!isRendered())
return;
// clear datamodel
- this.resetDataModel();
+ _resetDataModel();
// reset index
- this.captureOrigValue();
- this.setIndex(-1);
+ _captureOrigValue();
+ _setIndex(-1);
try
{
// has children
- if (this.getChildCount() > 0)
+ if (getChildCount() > 0)
{
- Iterator itr;
- UIComponent c;
-
- int i = this.getOffset();
- int end = this.getSize();
+ int i = getOffset();
+ int end = getSize();
end = (end >= 0) ? i + end : Integer.MAX_VALUE - 1;
// grab renderer
@@ -437,8 +424,8 @@
renderer = getRenderer(faces);
}
- this.setIndex(i);
- while (i <= end && this.isIndexAvailable())
+ _setIndex(i);
+ while (i <= end && _isIndexAvailable())
{
if (PhaseId.RENDER_RESPONSE.equals(phase) && renderer != null)
@@ -447,37 +434,30 @@
}
else
{
- itr = this.getChildren().iterator();
- while (itr.hasNext())
+ for (UIComponent child : getChildren())
{
- c = (UIComponent) itr.next();
if (PhaseId.APPLY_REQUEST_VALUES.equals(phase))
{
- c.processDecodes(faces);
+ child.processDecodes(faces);
}
else if (PhaseId.PROCESS_VALIDATIONS.equals(phase))
{
- c.processValidators(faces);
+ child.processValidators(faces);
}
else if (PhaseId.UPDATE_MODEL_VALUES.equals(phase))
{
- c.processUpdates(faces);
+ child.processUpdates(faces);
}
else if (PhaseId.RENDER_RESPONSE.equals(phase))
{
- if (FacesAPI.getVersion() >= 12)
- {
- c.encodeAll(faces);
- }
- else
- {
- ComponentSupport.encodeRecursive(faces, c);
- }
+ child.encodeAll(faces);
}
}
}
+
i++;
- this.setIndex(i);
+
+ _setIndex(i);
}
}
}
@@ -487,8 +467,8 @@
}
finally
{
- this.setIndex(-1);
- this.restoreOrigValue();
+ _setIndex(-1);
+ _restoreOrigValue();
}
}
@@ -530,182 +510,193 @@
// return false;
// }
+ @Override
public void processDecodes(FacesContext faces)
{
- if (!this.isRendered())
+ if (!isRendered())
+ {
return;
- this.setDataModel(null);
- if (!this.keepSaved(faces))
- this.childState = null;
- this.process(faces, PhaseId.APPLY_REQUEST_VALUES);
- this.decode(faces);
+ }
+
+ setDataModel(null);
+ if (!_keepSaved(faces))
+ {
+ _childState = null;
+ }
+
+ process(faces, PhaseId.APPLY_REQUEST_VALUES);
+ decode(faces);
}
+ @Override
public void processUpdates(FacesContext faces)
{
- if (!this.isRendered())
+ if (!isRendered())
+ {
return;
- this.resetDataModel();
- this.process(faces, PhaseId.UPDATE_MODEL_VALUES);
+ }
+
+ _resetDataModel();
+ process(faces, PhaseId.UPDATE_MODEL_VALUES);
}
+ @Override
public void processValidators(FacesContext faces)
{
- if (!this.isRendered())
+ if (!isRendered())
+ {
return;
- this.resetDataModel();
- this.process(faces, PhaseId.PROCESS_VALIDATIONS);
+ }
+
+ _resetDataModel();
+ process(faces, PhaseId.PROCESS_VALIDATIONS);
}
- private final static SavedState NullState = new SavedState();
-
// from RI
private final static class SavedState implements Serializable
{
-
- private Object submittedValue;
+ private boolean _localValueSet;
+ private Object _submittedValue;
+ private boolean _valid = true;
+ private Object _value;
private static final long serialVersionUID = 2920252657338389849L;
Object getSubmittedValue()
{
- return (this.submittedValue);
+ return (_submittedValue);
}
void setSubmittedValue(Object submittedValue)
{
- this.submittedValue = submittedValue;
+ _submittedValue = submittedValue;
}
- private boolean valid = true;
-
boolean isValid()
{
- return (this.valid);
+ return (_valid);
}
void setValid(boolean valid)
{
- this.valid = valid;
+ _valid = valid;
}
- private Object value;
-
Object getValue()
{
- return (this.value);
+ return _value;
}
public void setValue(Object value)
{
- this.value = value;
+ _value = value;
}
- private boolean localValueSet;
-
boolean isLocalValueSet()
{
- return (this.localValueSet);
+ return _localValueSet;
}
public void setLocalValueSet(boolean localValueSet)
{
- this.localValueSet = localValueSet;
+ _localValueSet = localValueSet;
}
+ @Override
public String toString()
{
- return ("submittedValue: " + submittedValue + " value: " + value + " localValueSet: " + localValueSet);
+ return ("submittedValue: " + _submittedValue + " value: " + _value + " localValueSet: " + _localValueSet);
}
public void populate(EditableValueHolder evh)
{
- this.value = evh.getValue();
- this.valid = evh.isValid();
- this.submittedValue = evh.getSubmittedValue();
- this.localValueSet = evh.isLocalValueSet();
+ _value = evh.getValue();
+ _valid = evh.isValid();
+ _submittedValue = evh.getSubmittedValue();
+ _localValueSet = evh.isLocalValueSet();
}
public void apply(EditableValueHolder evh)
{
- evh.setValue(this.value);
- evh.setValid(this.valid);
- evh.setSubmittedValue(this.submittedValue);
- evh.setLocalValueSet(this.localValueSet);
+ evh.setValue(_value);
+ evh.setValid(_valid);
+ evh.setSubmittedValue(_submittedValue);
+ evh.setLocalValueSet(_localValueSet);
}
-
}
private final class IndexedEvent extends FacesEvent
{
+ private final FacesEvent _target;
- private final FacesEvent target;
-
- private final int index;
+ private final int _index;
public IndexedEvent(UIRepeat owner, FacesEvent target, int index)
{
super(owner);
- this.target = target;
- this.index = index;
+ _target = target;
+ _index = index;
}
+ @Override
public PhaseId getPhaseId()
{
- return (this.target.getPhaseId());
+ return _target.getPhaseId();
}
+ @Override
public void setPhaseId(PhaseId phaseId)
{
- this.target.setPhaseId(phaseId);
+ _target.setPhaseId(phaseId);
}
public boolean isAppropriateListener(FacesListener listener)
{
- return this.target.isAppropriateListener(listener);
+ return _target.isAppropriateListener(listener);
}
public void processListener(FacesListener listener)
{
- UIRepeat owner = (UIRepeat) this.getComponent();
- int prevIndex = owner.index;
+ UIRepeat owner = (UIRepeat) getComponent();
+ int prevIndex = owner._index;
try
{
- owner.setIndex(this.index);
- if (owner.isIndexAvailable())
+ owner._setIndex(_index);
+ if (owner._isIndexAvailable())
{
- this.target.processListener(listener);
+ _target.processListener(listener);
}
}
finally
{
- owner.setIndex(prevIndex);
+ owner._setIndex(prevIndex);
}
}
public int getIndex()
{
- return index;
+ return _index;
}
public FacesEvent getTarget()
{
- return target;
+ return _target;
}
}
+ @Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
if (event instanceof IndexedEvent)
{
IndexedEvent idxEvent = (IndexedEvent) event;
- this.resetDataModel();
- int prevIndex = this.index;
+ _resetDataModel();
+ int prevIndex = _index;
try
{
- this.setIndex(idxEvent.getIndex());
- if (this.isIndexAvailable())
+ _setIndex(idxEvent.getIndex());
+ if (_isIndexAvailable())
{
FacesEvent target = idxEvent.getTarget();
target.getComponent().broadcast(target);
@@ -713,7 +704,7 @@
}
finally
{
- this.setIndex(prevIndex);
+ _setIndex(prevIndex);
}
}
else
@@ -722,58 +713,68 @@
}
}
+ @Override
public void queueEvent(FacesEvent event)
{
- super.queueEvent(new IndexedEvent(this, event, this.index));
+ super.queueEvent(new IndexedEvent(this, event, _index));
}
+ @SuppressWarnings("unchecked")
+ @Override
public void restoreState(FacesContext faces, Object object)
{
Object[] state = (Object[]) object;
super.restoreState(faces, state[0]);
- this.childState = (Map) state[1];
- this.offset = ((Integer) state[2]).intValue();
- this.size = ((Integer) state[3]).intValue();
- this.var = (String) state[4];
- this.value = state[5];
+ _childState = (Map<String, SavedState>) state[1];
+ _offset = ((Integer) state[2]).intValue();
+ _size = ((Integer) state[3]).intValue();
+ _var = (String) state[4];
+ _value = state[5];
}
+ @Override
public Object saveState(FacesContext faces)
{
Object[] state = new Object[6];
state[0] = super.saveState(faces);
- state[1] = this.childState;
- state[2] = new Integer(this.offset);
- state[3] = new Integer(this.size);
- state[4] = this.var;
- state[5] = this.value;
+ state[1] = _childState;
+ state[2] = new Integer(_offset);
+ state[3] = new Integer(_size);
+ state[4] = _var;
+ state[5] = _value;
return state;
}
+ @Override
public void encodeChildren(FacesContext faces) throws IOException
{
if (!isRendered())
{
return;
}
- this.setDataModel(null);
- if (!this.keepSaved(faces))
+
+ setDataModel(null);
+
+ if (!_keepSaved(faces))
{
- this.childState = null;
+ _childState = null;
}
- this.process(faces, PhaseId.RENDER_RESPONSE);
+
+ process(faces, PhaseId.RENDER_RESPONSE);
}
+ @Override
public boolean getRendersChildren()
{
- Renderer renderer = null;
if (getRendererType() != null)
{
- if (null != (renderer = getRenderer(getFacesContext())))
+ Renderer renderer = getRenderer(getFacesContext());
+ if (renderer != null)
{
return renderer.getRendersChildren();
}
}
+
return true;
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultFunctionMapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultFunctionMapper.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultFunctionMapper.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultFunctionMapper.java Thu Feb 12 01:23:54 2009
@@ -24,7 +24,6 @@
import java.io.ObjectOutput;
import java.lang.reflect.Method;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import javax.el.FunctionMapper;
@@ -42,10 +41,9 @@
*/
public final class DefaultFunctionMapper extends FunctionMapper implements Externalizable
{
-
private static final long serialVersionUID = 1L;
- private Map functions = null;
+ private Map<String, Function> _functions = null;
/*
* (non-Javadoc)
@@ -54,24 +52,26 @@
*/
public Method resolveFunction(String prefix, String localName)
{
- if (this.functions != null)
+ if (_functions != null)
{
- Function f = (Function) this.functions.get(prefix + ":" + localName);
+ Function f = (Function) _functions.get(prefix + ":" + localName);
return f.getMethod();
}
+
return null;
}
public void addFunction(String prefix, String localName, Method m)
{
- if (this.functions == null)
+ if (_functions == null)
{
- this.functions = new HashMap();
+ _functions = new HashMap<String, Function>();
}
+
Function f = new Function(prefix, localName, m);
synchronized (this)
{
- this.functions.put(prefix + ":" + localName, f);
+ _functions.put(prefix + ":" + localName, f);
}
}
@@ -82,7 +82,7 @@
*/
public void writeExternal(ObjectOutput out) throws IOException
{
- out.writeObject(this.functions);
+ out.writeObject(_functions);
}
/*
@@ -90,39 +90,41 @@
*
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
+ @SuppressWarnings("unchecked")
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.functions = (Map) in.readObject();
+ _functions = (Map<String, Function>) in.readObject();
}
+ @Override
public String toString()
{
StringBuffer sb = new StringBuffer(128);
sb.append("FunctionMapper[\n");
- for (Iterator itr = this.functions.values().iterator(); itr.hasNext();)
+ for (Function function : _functions.values())
{
- sb.append(itr.next()).append('\n');
+ sb.append(function).append('\n');
}
sb.append(']');
+
return sb.toString();
}
private static class Function implements Externalizable
{
-
private static final long serialVersionUID = 1L;
- protected transient Method m;
+ protected transient Method _m;
- protected String owner;
+ protected String _owner;
- protected String name;
+ protected String _name;
- protected String[] types;
+ protected String[] _types;
- protected String prefix;
+ protected String _prefix;
- protected String localName;
+ protected String _localName;
/**
*
@@ -137,9 +139,10 @@
{
throw new NullPointerException("Method cannot be null");
}
- this.prefix = prefix;
- this.localName = localName;
- this.m = m;
+
+ _prefix = prefix;
+ _localName = localName;
+ _m = m;
}
public Function()
@@ -154,11 +157,11 @@
*/
public void writeExternal(ObjectOutput out) throws IOException
{
- out.writeUTF((this.prefix != null) ? this.prefix : "");
- out.writeUTF(this.localName);
- out.writeUTF(this.m.getDeclaringClass().getName());
- out.writeUTF(this.m.getName());
- out.writeObject(ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
+ out.writeUTF(_prefix != null ? _prefix : "");
+ out.writeUTF(_localName);
+ out.writeUTF(_m.getDeclaringClass().getName());
+ out.writeUTF(_m.getName());
+ out.writeObject(ReflectionUtil.toTypeNameArray(this._m.getParameterTypes()));
}
/*
@@ -168,44 +171,46 @@
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-
- this.prefix = in.readUTF();
- if ("".equals(this.prefix))
- this.prefix = null;
- this.localName = in.readUTF();
- this.owner = in.readUTF();
- this.name = in.readUTF();
- this.types = (String[]) in.readObject();
+ _prefix = in.readUTF();
+ if ("".equals(_prefix))
+ _prefix = null;
+
+ _localName = in.readUTF();
+ _owner = in.readUTF();
+ _name = in.readUTF();
+ _types = (String[]) in.readObject();
}
public Method getMethod()
{
- if (this.m == null)
+ if (_m == null)
{
try
{
- Class t = ReflectionUtil.forName(this.owner);
- Class[] p = ReflectionUtil.toTypeArray(this.types);
- this.m = t.getMethod(this.name, p);
+ Class<?> t = ReflectionUtil.forName(_owner);
+ Class<?>[] p = ReflectionUtil.toTypeArray(_types);
+ _m = t.getMethod(_name, p);
}
catch (Exception e)
{
e.printStackTrace();
}
}
- return this.m;
+
+ return _m;
}
public boolean matches(String prefix, String localName)
{
- if (this.prefix != null)
+ if (_prefix != null)
{
if (prefix == null)
return false;
- if (!this.prefix.equals(prefix))
+ if (!_prefix.equals(prefix))
return false;
}
- return this.localName.equals(localName);
+
+ return _localName.equals(localName);
}
/*
@@ -213,12 +218,14 @@
*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj)
{
if (obj instanceof Function)
{
- return this.hashCode() == obj.hashCode();
+ return hashCode() == obj.hashCode();
}
+
return false;
}
@@ -227,21 +234,24 @@
*
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode()
{
- return (this.prefix + this.localName).hashCode();
+ return (_prefix + _localName).hashCode();
}
+ @Override
public String toString()
{
StringBuffer sb = new StringBuffer(32);
sb.append("Function[");
- if (this.prefix != null)
+ if (_prefix != null)
{
- sb.append(this.prefix).append(':');
+ sb.append(_prefix).append(':');
}
- sb.append(this.name).append("] ");
- sb.append(this.m);
+ sb.append(_name).append("] ");
+ sb.append(_m);
+
return sb.toString();
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultVariableMapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultVariableMapper.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultVariableMapper.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultVariableMapper.java Thu Feb 12 01:23:54 2009
@@ -36,8 +36,7 @@
*/
public final class DefaultVariableMapper extends VariableMapper
{
-
- private Map vars;
+ private Map<String, ValueExpression> _vars;
public DefaultVariableMapper()
{
@@ -49,10 +48,11 @@
*/
public ValueExpression resolveVariable(String name)
{
- if (this.vars != null)
+ if (_vars != null)
{
- return (ValueExpression) this.vars.get(name);
+ return _vars.get(name);
}
+
return null;
}
@@ -61,11 +61,11 @@
*/
public ValueExpression setVariable(String name, ValueExpression expression)
{
- if (this.vars == null)
+ if (_vars == null)
{
- this.vars = new HashMap();
+ _vars = new HashMap<String, ValueExpression>();
}
- return (ValueExpression) this.vars.put(name, expression);
+
+ return _vars.put(name, expression);
}
-
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/ELText.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/ELText.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/ELText.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/ELText.java Thu Feb 12 01:23:54 2009
@@ -19,7 +19,6 @@
package com.sun.facelets.el;
import java.io.IOException;
-import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
@@ -30,8 +29,6 @@
import javax.el.ValueExpression;
import javax.faces.context.ResponseWriter;
-import com.sun.facelets.util.FastWriter;
-
/**
* Handles parsing EL Strings in accordance with the EL-API Specification. The parser accepts either <code>${..}</code>
* or <code>#{..}</code>.
@@ -91,12 +88,12 @@
return null;
}
- public Class getType(ELContext context)
+ public Class<?> getType(ELContext context)
{
return null;
}
- public Class getExpectedType()
+ public Class<?> getExpectedType()
{
return null;
}
@@ -342,7 +339,7 @@
int vlen = 0;
StringBuffer buff = new StringBuffer(128);
- List text = new ArrayList();
+ List<ELText> text = new ArrayList<ELText>();
ELText t = null;
ValueExpression ve = null;
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/TagValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/TagValueExpression.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/TagValueExpression.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/TagValueExpression.java Thu Feb 12 01:23:54 2009
@@ -57,12 +57,12 @@
this.orig = orig;
}
- public Class getExpectedType()
+ public Class<?> getExpectedType()
{
return this.orig.getExpectedType();
}
- public Class getType(ELContext context)
+ public Class<?> getType(ELContext context)
{
try
{
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/VariableMapperWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/VariableMapperWrapper.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/VariableMapperWrapper.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/VariableMapperWrapper.java Thu Feb 12 01:23:54 2009
@@ -36,9 +36,9 @@
public final class VariableMapperWrapper extends VariableMapper
{
- private final VariableMapper target;
+ private final VariableMapper _target;
- private Map vars;
+ private Map<String, ValueExpression> _vars;
/**
*
@@ -46,7 +46,7 @@
public VariableMapperWrapper(VariableMapper orig)
{
super();
- this.target = orig;
+ _target = orig;
}
/**
@@ -59,14 +59,16 @@
ValueExpression ve = null;
try
{
- if (this.vars != null)
+ if (_vars != null)
{
- ve = (ValueExpression) this.vars.get(variable);
+ ve = (ValueExpression) _vars.get(variable);
}
+
if (ve == null)
{
- return this.target.resolveVariable(variable);
+ return _target.resolveVariable(variable);
}
+
return ve;
}
catch (StackOverflowError e)
@@ -82,10 +84,11 @@
*/
public ValueExpression setVariable(String variable, ValueExpression expression)
{
- if (this.vars == null)
+ if (_vars == null)
{
- this.vars = new HashMap();
+ _vars = new HashMap<String, ValueExpression>();
}
- return (ValueExpression) this.vars.put(variable, expression);
+
+ return _vars.put(variable, expression);
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFacelet.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFacelet.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFacelet.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFacelet.java Thu Feb 12 01:23:54 2009
@@ -39,11 +39,11 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-
-import com.sun.facelets.Facelet;
import javax.faces.webapp.pdl.facelets.FaceletContext;
import javax.faces.webapp.pdl.facelets.FaceletException;
import javax.faces.webapp.pdl.facelets.FaceletHandler;
+
+import com.sun.facelets.Facelet;
import com.sun.facelets.tag.jsf.ComponentSupport;
/**
@@ -59,33 +59,33 @@
private final static String APPLIED_KEY = "com.sun.facelets.APPLIED";
- private final String alias;
+ private final String _alias;
- private final ExpressionFactory elFactory;
+ private final ExpressionFactory _elFactory;
- private final DefaultFaceletFactory factory;
+ private final DefaultFaceletFactory _factory;
- private final long createTime;
+ private final long _createTime;
- private final long refreshPeriod;
+ private final long _refreshPeriod;
- private final Map relativePaths;
+ private final Map<String, URL> _relativePaths;
- private final FaceletHandler root;
+ private final FaceletHandler _root;
- private final URL src;
+ private final URL _src;
public DefaultFacelet(DefaultFaceletFactory factory, ExpressionFactory el, URL src, String alias,
FaceletHandler root)
{
- this.factory = factory;
- this.elFactory = el;
- this.src = src;
- this.root = root;
- this.alias = alias;
- this.createTime = System.currentTimeMillis();
- this.refreshPeriod = this.factory.getRefreshPeriod();
- this.relativePaths = new WeakHashMap();
+ _factory = factory;
+ _elFactory = el;
+ _src = src;
+ _root = root;
+ _alias = alias;
+ _createTime = System.currentTimeMillis();
+ _refreshPeriod = _factory.getRefreshPeriod();
+ _relativePaths = new WeakHashMap<String, URL>();
}
/**
@@ -97,14 +97,14 @@
DefaultFaceletContext ctx = new DefaultFaceletContext(facesContext, this);
this.refresh(parent);
ComponentSupport.markForDeletion(parent);
- this.root.apply(ctx, parent);
+ _root.apply(ctx, parent);
ComponentSupport.finalizeForDeletion(parent);
this.markApplied(parent);
}
private final void refresh(UIComponent c)
{
- if (this.refreshPeriod > 0)
+ if (_refreshPeriod > 0)
{
// finally remove any children marked as deleted
@@ -112,22 +112,22 @@
if (sz > 0)
{
UIComponent cc = null;
- List cl = c.getChildren();
+ List<UIComponent> cl = c.getChildren();
ApplyToken token;
while (--sz >= 0)
{
- cc = (UIComponent) cl.get(sz);
+ cc = cl.get(sz);
if (!cc.isTransient())
{
token = (ApplyToken) cc.getAttributes().get(APPLIED_KEY);
- if (token != null && token.time < this.createTime && token.alias.equals(this.alias))
+ if (token != null && token._time < _createTime && token._alias.equals(_alias))
{
if (log.isLoggable(Level.INFO))
{
DateFormat df = SimpleDateFormat.getTimeInstance();
- log.info("Facelet[" + this.alias + "] was modified @ "
- + df.format(new Date(this.createTime)) + ", flushing component applied @ "
- + df.format(new Date(token.time)));
+ log.info("Facelet[" + _alias + "] was modified @ "
+ + df.format(new Date(_createTime)) + ", flushing component applied @ "
+ + df.format(new Date(token._time)));
}
cl.remove(sz);
}
@@ -138,23 +138,23 @@
// remove any facets marked as deleted
if (c.getFacets().size() > 0)
{
- Collection col = c.getFacets().values();
+ Collection<UIComponent> col = c.getFacets().values();
UIComponent fc;
ApplyToken token;
- for (Iterator itr = col.iterator(); itr.hasNext();)
+ for (Iterator<UIComponent> itr = col.iterator(); itr.hasNext();)
{
- fc = (UIComponent) itr.next();
+ fc = itr.next();
if (!fc.isTransient())
{
token = (ApplyToken) fc.getAttributes().get(APPLIED_KEY);
- if (token != null && token.time < this.createTime && token.alias.equals(this.alias))
+ if (token != null && token._time < _createTime && token._alias.equals(_alias))
{
if (log.isLoggable(Level.INFO))
{
DateFormat df = SimpleDateFormat.getTimeInstance();
- log.info("Facelet[" + this.alias + "] was modified @ "
- + df.format(new Date(this.createTime)) + ", flushing component applied @ "
- + df.format(new Date(token.time)));
+ log.info("Facelet[" + _alias + "] was modified @ "
+ + df.format(new Date(_createTime)) + ", flushing component applied @ "
+ + df.format(new Date(token._time)));
}
itr.remove();
}
@@ -166,18 +166,16 @@
private final void markApplied(UIComponent parent)
{
- if (this.refreshPeriod > 0)
+ if (this._refreshPeriod > 0)
{
- Iterator itr = parent.getFacetsAndChildren();
- UIComponent c;
- Map attr;
- ApplyToken token = new ApplyToken(this.alias, System.currentTimeMillis() + this.refreshPeriod);
+ Iterator<UIComponent> itr = parent.getFacetsAndChildren();
+ ApplyToken token = new ApplyToken(_alias, System.currentTimeMillis() + _refreshPeriod);
while (itr.hasNext())
{
- c = (UIComponent) itr.next();
+ UIComponent c = itr.next();
if (!c.isTransient())
{
- attr = c.getAttributes();
+ Map<String, Object> attr = c.getAttributes();
if (!attr.containsKey(APPLIED_KEY))
{
attr.put(APPLIED_KEY, token);
@@ -194,7 +192,7 @@
*/
public String getAlias()
{
- return this.alias;
+ return _alias;
}
/**
@@ -204,7 +202,7 @@
*/
public ExpressionFactory getExpressionFactory()
{
- return this.elFactory;
+ return _elFactory;
}
/**
@@ -214,7 +212,7 @@
*/
public long getCreateTime()
{
- return this.createTime;
+ return _createTime;
}
/**
@@ -228,11 +226,11 @@
*/
private URL getRelativePath(String path) throws IOException
{
- URL url = (URL) this.relativePaths.get(path);
+ URL url = (URL) _relativePaths.get(path);
if (url == null)
{
- url = this.factory.resolveURL(this.src, path);
- this.relativePaths.put(path, url);
+ url = _factory.resolveURL(_src, path);
+ _relativePaths.put(path, url);
}
return url;
}
@@ -244,7 +242,7 @@
*/
public URL getSource()
{
- return this.src;
+ return _src;
}
/**
@@ -264,7 +262,7 @@
FaceletException, ELException
{
this.refresh(parent);
- this.root.apply(new DefaultFaceletContext(ctx, this), parent);
+ _root.apply(new DefaultFaceletContext(ctx, this), parent);
this.markApplied(parent);
}
@@ -310,15 +308,15 @@
public void include(DefaultFaceletContext ctx, UIComponent parent, URL url) throws IOException, FacesException,
FaceletException, ELException
{
- DefaultFacelet f = (DefaultFacelet) this.factory.getFacelet(url);
+ DefaultFacelet f = (DefaultFacelet) _factory.getFacelet(url);
f.include(ctx, parent);
}
private static class ApplyToken implements Externalizable
{
- public String alias;
+ public String _alias;
- public long time;
+ public long _time;
public ApplyToken()
{
@@ -326,25 +324,25 @@
public ApplyToken(String alias, long time)
{
- this.alias = alias;
- this.time = time;
+ _alias = alias;
+ _time = time;
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
- this.alias = in.readUTF();
- this.time = in.readLong();
+ _alias = in.readUTF();
+ _time = in.readLong();
}
public void writeExternal(ObjectOutput out) throws IOException
{
- out.writeUTF(this.alias);
- out.writeLong(this.time);
+ out.writeUTF(_alias);
+ out.writeLong(_time);
}
}
public String toString()
{
- return this.alias;
+ return _alias;
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletContext.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletContext.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletContext.java Thu Feb 12 01:23:54 2009
@@ -18,19 +18,26 @@
*/
package com.sun.facelets.impl;
-import javax.faces.webapp.pdl.facelets.FaceletContext;
-import javax.faces.webapp.pdl.facelets.FaceletException;
-import com.sun.facelets.TemplateClient;
-import com.sun.facelets.el.DefaultVariableMapper;
-import com.sun.facelets.el.ELAdaptor;
-
-import javax.el.*;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.net.URL;
-import java.util.*;
+import javax.faces.webapp.pdl.facelets.FaceletContext;
+
+import com.sun.facelets.el.DefaultVariableMapper;
/**
* Default FaceletContext implementation.
@@ -45,52 +52,53 @@
final class DefaultFaceletContext extends FaceletContext
{
- private final FacesContext faces;
+ private final FacesContext _faces;
- private final ELContext ctx;
+ private final ELContext _ctx;
- private final DefaultFacelet facelet;
- private final List faceletHierarchy;
+ private final DefaultFacelet _facelet;
+ private final List<DefaultFacelet> _faceletHierarchy;
- private VariableMapper varMapper;
+ private VariableMapper _varMapper;
- private FunctionMapper fnMapper;
+ private FunctionMapper _fnMapper;
- private final Map ids;
- private final Map prefixes;
- private String prefix;
+ private final Map<String, Integer> _ids;
+ private final Map<Integer, Integer> _prefixes;
+ private String _prefix;
+
// TODO: change to StringBuilder when JDK1.5 support is available in Facelets
- private final StringBuffer uniqueIdBuilder = new StringBuffer(30);
+ private final StringBuffer _uniqueIdBuilder = new StringBuffer(30);
public DefaultFaceletContext(DefaultFaceletContext ctx, DefaultFacelet facelet)
{
- this.ctx = ctx.ctx;
- this.faces = ctx.faces;
- this.fnMapper = ctx.fnMapper;
- this.ids = ctx.ids;
- this.prefixes = ctx.prefixes;
- this.varMapper = ctx.varMapper;
- this.faceletHierarchy = new ArrayList(ctx.faceletHierarchy.size() + 1);
- this.faceletHierarchy.addAll(ctx.faceletHierarchy);
- this.faceletHierarchy.add(facelet);
- this.facelet = facelet;
+ _ctx = ctx._ctx;
+ _faces = ctx._faces;
+ _fnMapper = ctx._fnMapper;
+ _ids = ctx._ids;
+ _prefixes = ctx._prefixes;
+ _varMapper = ctx._varMapper;
+ _faceletHierarchy = new ArrayList<DefaultFacelet>(ctx._faceletHierarchy.size() + 1);
+ _faceletHierarchy.addAll(ctx._faceletHierarchy);
+ _faceletHierarchy.add(facelet);
+ _facelet = facelet;
}
public DefaultFaceletContext(FacesContext faces, DefaultFacelet facelet)
{
- this.ctx = ELAdaptor.getELContext(faces);
- this.ids = new HashMap();
- this.prefixes = new HashMap();
- this.faces = faces;
- this.faceletHierarchy = new ArrayList(1);
- this.faceletHierarchy.add(facelet);
- this.facelet = facelet;
- this.varMapper = this.ctx.getVariableMapper();
- if (this.varMapper == null)
+ _ctx = faces.getELContext();
+ _ids = new HashMap<String, Integer>();
+ _prefixes = new HashMap<Integer, Integer>();
+ _faces = faces;
+ _faceletHierarchy = new ArrayList<DefaultFacelet>(1);
+ _faceletHierarchy.add(facelet);
+ _facelet = facelet;
+ _varMapper = _ctx.getVariableMapper();
+ if (_varMapper == null)
{
- this.varMapper = new DefaultVariableMapper();
+ _varMapper = new DefaultVariableMapper();
}
- this.fnMapper = this.ctx.getFunctionMapper();
+ _fnMapper = _ctx.getFunctionMapper();
}
/*
@@ -101,7 +109,7 @@
@Override
public FacesContext getFacesContext()
{
- return this.faces;
+ return _faces;
}
/*
@@ -112,7 +120,7 @@
@Override
public ExpressionFactory getExpressionFactory()
{
- return this.facelet.getExpressionFactory();
+ return _facelet.getExpressionFactory();
}
/*
@@ -124,7 +132,7 @@
public void setVariableMapper(VariableMapper varMapper)
{
// Assert.param("varMapper", varMapper);
- this.varMapper = varMapper;
+ _varMapper = varMapper;
}
/*
@@ -136,7 +144,7 @@
public void setFunctionMapper(FunctionMapper fnMapper)
{
// Assert.param("fnMapper", fnMapper);
- this.fnMapper = fnMapper;
+ _fnMapper = fnMapper;
}
/*
@@ -147,7 +155,7 @@
@Override
public void includeFacelet(UIComponent parent, String relativePath) throws IOException
{
- this.facelet.include(this, parent, relativePath);
+ _facelet.include(this, parent, relativePath);
}
/*
@@ -158,7 +166,7 @@
@Override
public FunctionMapper getFunctionMapper()
{
- return this.fnMapper;
+ return _fnMapper;
}
/*
@@ -169,7 +177,7 @@
@Override
public VariableMapper getVariableMapper()
{
- return this.varMapper;
+ return _varMapper;
}
/*
@@ -179,7 +187,7 @@
*/
public Object getContext(Class key)
{
- return this.ctx.getContext(key);
+ return _ctx.getContext(key);
}
/*
@@ -189,7 +197,7 @@
*/
public void putContext(Class key, Object contextObject)
{
- this.ctx.putContext(key, contextObject);
+ _ctx.putContext(key, contextObject);
}
/*
@@ -201,52 +209,52 @@
public String generateUniqueId(String base)
{
- if (prefix == null)
+ if (_prefix == null)
{
// TODO: change to StringBuilder when JDK1.5 support is available
- StringBuffer builder = new StringBuffer(faceletHierarchy.size() * 30);
- for (int i = 0; i < faceletHierarchy.size(); i++)
+ StringBuffer builder = new StringBuffer(_faceletHierarchy.size() * 30);
+ for (int i = 0; i < _faceletHierarchy.size(); i++)
{
- DefaultFacelet facelet = (DefaultFacelet) faceletHierarchy.get(i);
+ DefaultFacelet facelet = _faceletHierarchy.get(i);
builder.append(facelet.getAlias());
}
Integer prefixInt = new Integer(builder.toString().hashCode());
- Integer cnt = (Integer) prefixes.get(prefixInt);
+ Integer cnt = _prefixes.get(prefixInt);
if (cnt == null)
{
- this.prefixes.put(prefixInt, new Integer(0));
- prefix = prefixInt.toString();
+ _prefixes.put(prefixInt, new Integer(0));
+ _prefix = prefixInt.toString();
}
else
{
int i = cnt.intValue() + 1;
- this.prefixes.put(prefixInt, new Integer(i));
- prefix = prefixInt + "_" + i;
+ _prefixes.put(prefixInt, new Integer(i));
+ _prefix = prefixInt + "_" + i;
}
}
- Integer cnt = (Integer) this.ids.get(base);
+ Integer cnt = _ids.get(base);
if (cnt == null)
{
- this.ids.put(base, new Integer(0));
- uniqueIdBuilder.delete(0, uniqueIdBuilder.length());
- uniqueIdBuilder.append(prefix);
- uniqueIdBuilder.append("_");
- uniqueIdBuilder.append(base);
- return uniqueIdBuilder.toString();
+ _ids.put(base, new Integer(0));
+ _uniqueIdBuilder.delete(0, _uniqueIdBuilder.length());
+ _uniqueIdBuilder.append(_prefix);
+ _uniqueIdBuilder.append("_");
+ _uniqueIdBuilder.append(base);
+ return _uniqueIdBuilder.toString();
}
else
{
int i = cnt.intValue() + 1;
- this.ids.put(base, new Integer(i));
- uniqueIdBuilder.delete(0, uniqueIdBuilder.length());
- uniqueIdBuilder.append(prefix);
- uniqueIdBuilder.append("_");
- uniqueIdBuilder.append(base);
- uniqueIdBuilder.append("_");
- uniqueIdBuilder.append(i);
- return uniqueIdBuilder.toString();
+ _ids.put(base, new Integer(i));
+ _uniqueIdBuilder.delete(0, _uniqueIdBuilder.length());
+ _uniqueIdBuilder.append(_prefix);
+ _uniqueIdBuilder.append("_");
+ _uniqueIdBuilder.append(base);
+ _uniqueIdBuilder.append("_");
+ _uniqueIdBuilder.append(i);
+ return _uniqueIdBuilder.toString();
}
}
@@ -258,9 +266,9 @@
@Override
public Object getAttribute(String name)
{
- if (this.varMapper != null)
+ if (_varMapper != null)
{
- ValueExpression ve = this.varMapper.resolveVariable(name);
+ ValueExpression ve = _varMapper.resolveVariable(name);
if (ve != null)
{
return ve.getValue(this);
@@ -277,16 +285,16 @@
@Override
public void setAttribute(String name, Object value)
{
- if (this.varMapper != null)
+ if (_varMapper != null)
{
if (value == null)
{
- this.varMapper.setVariable(name, null);
+ _varMapper.setVariable(name, null);
}
else
{
- this.varMapper.setVariable(name, this.facelet.getExpressionFactory()
- .createValueExpression(value, Object.class));
+ _varMapper.setVariable(name,
+ _facelet.getExpressionFactory().createValueExpression(value, Object.class));
}
}
}
@@ -299,71 +307,24 @@
@Override
public void includeFacelet(UIComponent parent, URL absolutePath) throws IOException, FacesException, ELException
{
- this.facelet.include(this, parent, absolutePath);
+ _facelet.include(this, parent, absolutePath);
}
@Override
public ELResolver getELResolver()
{
- return this.ctx.getELResolver();
- }
-
- private final static class TemplateManager implements TemplateClient
- {
- private final DefaultFacelet owner;
-
- private final TemplateClient target;
-
- private final boolean root;
-
- private final Set names = new HashSet();
-
- public TemplateManager(DefaultFacelet owner, TemplateClient target, boolean root)
- {
- this.owner = owner;
- this.target = target;
- this.root = root;
- }
-
- public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
- FaceletException, ELException
- {
- String testName = (name != null) ? name : "facelets._NULL_DEF_";
- if (this.names.contains(testName))
- {
- return false;
- }
- else
- {
- this.names.add(testName);
- boolean found = false;
- found = this.target.apply(new DefaultFaceletContext((DefaultFaceletContext) ctx, this.owner), parent,
- name);
- this.names.remove(testName);
- return found;
- }
- }
-
- public boolean equals(Object o)
- {
- // System.out.println(this.owner.getAlias() + " == " +
- // ((DefaultFacelet) o).getAlias());
- return this.owner == o || this.target == o;
- }
-
- public boolean isRoot()
- {
- return this.root;
- }
+ return _ctx.getELResolver();
}
+ @Override
public boolean isPropertyResolved()
{
- return this.ctx.isPropertyResolved();
+ return _ctx.isPropertyResolved();
}
+ @Override
public void setPropertyResolved(boolean resolved)
{
- this.ctx.setPropertyResolved(resolved);
+ _ctx.setPropertyResolved(resolved);
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletFactory.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletFactory.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletFactory.java Thu Feb 12 01:23:54 2009
@@ -30,15 +30,13 @@
import javax.el.ELException;
import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
+import javax.faces.webapp.pdl.facelets.FaceletException;
+import javax.faces.webapp.pdl.facelets.FaceletHandler;
import com.sun.facelets.Facelet;
-import javax.faces.webapp.pdl.facelets.FaceletException;
import com.sun.facelets.FaceletFactory;
-import javax.faces.webapp.pdl.facelets.FaceletHandler;
import com.sun.facelets.compiler.Compiler;
import com.sun.facelets.util.ParameterCheck;
-import com.sun.facelets.util.Resource;
/**
* Default FaceletFactory implementation.
@@ -48,20 +46,19 @@
*/
public final class DefaultFaceletFactory extends FaceletFactory
{
-
protected final static Logger log = Logger.getLogger("facelets.factory");
- private final Compiler compiler;
+ private final Compiler _compiler;
- private Map facelets;
+ private Map<String, DefaultFacelet> _facelets;
- private Map relativeLocations;
+ private Map<String, URL> _relativeLocations;
- private final ResourceResolver resolver;
+ private final ResourceResolver _resolver;
- private final URL baseUrl;
+ private final URL _baseUrl;
- private final long refreshPeriod;
+ private final long _refreshPeriod;
public DefaultFaceletFactory(Compiler compiler, ResourceResolver resolver) throws IOException
{
@@ -72,15 +69,15 @@
{
ParameterCheck.notNull("compiler", compiler);
ParameterCheck.notNull("resolver", resolver);
- this.compiler = compiler;
- this.facelets = new HashMap();
- this.relativeLocations = new HashMap();
- this.resolver = resolver;
- this.baseUrl = resolver.resolveUrl("/");
+ _compiler = compiler;
+ _facelets = new HashMap<String, DefaultFacelet>();
+ _relativeLocations = new HashMap<String, URL>();
+ _resolver = resolver;
+ _baseUrl = resolver.resolveUrl("/");
// this.location = url;
log.fine("Using ResourceResolver: " + resolver);
- this.refreshPeriod = (refreshPeriod >= 0) ? refreshPeriod * 1000 : -1;
- log.fine("Using Refresh Period: " + this.refreshPeriod);
+ _refreshPeriod = (refreshPeriod >= 0) ? refreshPeriod * 1000 : -1;
+ log.fine("Using Refresh Period: " + _refreshPeriod);
}
/*
@@ -90,15 +87,15 @@
*/
public Facelet getFacelet(String uri) throws IOException, FaceletException, FacesException, ELException
{
- URL url = (URL) this.relativeLocations.get(uri);
+ URL url = (URL) _relativeLocations.get(uri);
if (url == null)
{
- url = this.resolveURL(this.baseUrl, uri);
+ url = this.resolveURL(_baseUrl, uri);
if (url != null)
{
- Map newLoc = new HashMap(this.relativeLocations);
+ Map<String, URL> newLoc = new HashMap<String, URL>(_relativeLocations);
newLoc.put(uri, url);
- this.relativeLocations = newLoc;
+ _relativeLocations = newLoc;
}
else
{
@@ -125,7 +122,7 @@
{
if (path.startsWith("/"))
{
- URL url = this.resolver.resolveUrl(path);
+ URL url = _resolver.resolveUrl(path);
if (url == null)
{
throw new FileNotFoundException(path + " Not Found in ExternalContext as a Resource");
@@ -154,15 +151,15 @@
{
ParameterCheck.notNull("url", url);
String key = url.toString();
- DefaultFacelet f = (DefaultFacelet) this.facelets.get(key);
+ DefaultFacelet f = _facelets.get(key);
if (f == null || this.needsToBeRefreshed(f))
{
f = this.createFacelet(url);
- if (this.refreshPeriod != 0)
+ if (_refreshPeriod != 0)
{
- Map newLoc = new HashMap(this.facelets);
+ Map<String, DefaultFacelet> newLoc = new HashMap<String, DefaultFacelet>(_facelets);
newLoc.put(key, f);
- this.facelets = newLoc;
+ _facelets = newLoc;
}
}
return f;
@@ -178,12 +175,12 @@
protected boolean needsToBeRefreshed(DefaultFacelet facelet)
{
// if set to 0, constantly reload-- nocache
- if (this.refreshPeriod == 0)
+ if (_refreshPeriod == 0)
return true;
// if set to -1, never reload
- if (this.refreshPeriod == -1)
+ if (_refreshPeriod == -1)
return false;
- long ttl = facelet.getCreateTime() + this.refreshPeriod;
+ long ttl = facelet.getCreateTime() + _refreshPeriod;
URL url = facelet.getSource();
InputStream is = null;
if (System.currentTimeMillis() > ttl)
@@ -234,11 +231,11 @@
{
log.fine("Creating Facelet for: " + url);
}
- String alias = "/" + url.getFile().replaceFirst(this.baseUrl.getFile(), "");
+ String alias = "/" + url.getFile().replaceFirst(_baseUrl.getFile(), "");
try
{
- FaceletHandler h = this.compiler.compile(url, alias);
- DefaultFacelet f = new DefaultFacelet(this, this.compiler.createExpressionFactory(), url, alias, h);
+ FaceletHandler h = _compiler.compile(url, alias);
+ DefaultFacelet f = new DefaultFacelet(this, _compiler.createExpressionFactory(), url, alias, h);
return f;
}
catch (FileNotFoundException fnfe)
@@ -254,11 +251,11 @@
*/
public Compiler getCompiler()
{
- return this.compiler;
+ return _compiler;
}
public long getRefreshPeriod()
{
- return refreshPeriod;
+ return _refreshPeriod;
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/AbstractTagLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/AbstractTagLibrary.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/AbstractTagLibrary.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/AbstractTagLibrary.java Thu Feb 12 01:23:54 2009
@@ -27,12 +27,9 @@
import javax.el.ELException;
import javax.faces.FacesException;
-import javax.faces.convert.Converter;
-import javax.faces.validator.Validator;
-
-import javax.faces.webapp.pdl.facelets.FaceletContext;
import javax.faces.webapp.pdl.facelets.FaceletException;
import javax.faces.webapp.pdl.facelets.FaceletHandler;
+
import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.ComponentHandler;
import com.sun.facelets.tag.jsf.ConvertHandler;
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeFaceletHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeFaceletHandler.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeFaceletHandler.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeFaceletHandler.java Thu Feb 12 01:23:54 2009
@@ -23,7 +23,6 @@
import javax.el.ELException;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-
import javax.faces.webapp.pdl.facelets.FaceletContext;
import javax.faces.webapp.pdl.facelets.FaceletException;
import javax.faces.webapp.pdl.facelets.FaceletHandler;
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRulesetImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRulesetImpl.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRulesetImpl.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRulesetImpl.java Thu Feb 12 01:23:54 2009
@@ -29,6 +29,7 @@
import java.util.logging.Logger;
import javax.faces.webapp.pdl.facelets.FaceletContext;
+
import com.sun.facelets.util.ParameterCheck;
/**
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaTagHandler.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaTagHandler.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaTagHandler.java Thu Feb 12 01:23:54 2009
@@ -19,6 +19,7 @@
package com.sun.facelets.tag;
import javax.faces.webapp.pdl.facelets.FaceletContext;
+
import com.sun.facelets.util.ParameterCheck;
/**
@@ -29,10 +30,9 @@
*/
public abstract class MetaTagHandler extends TagHandler
{
+ private Class<?> _lastType = Object.class;
- private Class lastType = Object.class;
-
- private Metadata mapper;
+ private Metadata _mapper;
public MetaTagHandler(TagConfig config)
{
@@ -45,7 +45,7 @@
* @param type
* @return
*/
- protected MetaRuleset createMetaRuleset(Class type)
+ protected MetaRuleset createMetaRuleset(Class<?> type)
{
ParameterCheck.notNull("type", type);
return new MetaRulesetImpl(this.tag, type);
@@ -62,13 +62,14 @@
{
if (instance != null)
{
- Class type = instance.getClass();
- if (mapper == null || !this.lastType.equals(type))
+ Class<?> type = instance.getClass();
+ if (_mapper == null || !_lastType.equals(type))
{
- this.lastType = type;
- this.mapper = this.createMetaRuleset(type).finish();
+ _lastType = type;
+ _mapper = this.createMetaRuleset(type).finish();
}
- this.mapper.applyMetadata(ctx, instance);
+
+ _mapper.applyMetadata(ctx, instance);
}
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MethodRule.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MethodRule.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MethodRule.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MethodRule.java Thu Feb 12 01:23:54 2009
@@ -22,10 +22,7 @@
import java.lang.reflect.Method;
import javax.el.MethodExpression;
-import javax.faces.el.MethodBinding;
-
import javax.faces.webapp.pdl.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyMethodBinding;
/**
* Optional Rule for binding Method[Binding|Expression] properties
@@ -38,11 +35,11 @@
private final String methodName;
- private final Class returnTypeClass;
+ private final Class<?> returnTypeClass;
- private final Class[] params;
+ private final Class<?>[] params;
- public MethodRule(String methodName, Class returnTypeClass, Class[] params)
+ public MethodRule(String methodName, Class<?> returnTypeClass, Class<?>[] params)
{
this.methodName = methodName;
this.returnTypeClass = returnTypeClass;
@@ -54,15 +51,7 @@
if (false == name.equals(this.methodName))
return null;
- if (MethodBinding.class.equals(meta.getPropertyType(name)))
- {
- Method method = meta.getWriteMethod(name);
- if (method != null)
- {
- return new MethodBindingMetadata(method, attribute, this.returnTypeClass, this.params);
- }
- }
- else if (MethodExpression.class.equals(meta.getPropertyType(name)))
+ if (MethodExpression.class.equals(meta.getPropertyType(name)))
{
Method method = meta.getWriteMethod(name);
if (method != null)
@@ -74,54 +63,18 @@
return null;
}
- private class MethodBindingMetadata extends Metadata
- {
- private final Method _method;
-
- private final TagAttribute _attribute;
-
- private Class[] _paramList;
-
- private Class _returnType;
-
- public MethodBindingMetadata(Method method, TagAttribute attribute, Class returnType, Class[] paramList)
- {
- _method = method;
- _attribute = attribute;
- _paramList = paramList;
- _returnType = returnType;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- MethodExpression expr = _attribute.getMethodExpression(ctx, _returnType, _paramList);
-
- try
- {
- _method.invoke(instance, new Object[] { new LegacyMethodBinding(expr) });
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
- }
-
private class MethodExpressionMetadata extends Metadata
{
private final Method _method;
private final TagAttribute _attribute;
- private Class[] _paramList;
+ private Class<?>[] _paramList;
- private Class _returnType;
+ private Class<?> _returnType;
- public MethodExpressionMetadata(Method method, TagAttribute attribute, Class returnType, Class[] paramList)
+ public MethodExpressionMetadata(Method method, TagAttribute attribute, Class<?> returnType,
+ Class<?>[] paramList)
{
_method = method;
_attribute = attribute;
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttribute.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttribute.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttribute.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttribute.java Thu Feb 12 01:23:54 2009
@@ -22,8 +22,8 @@
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
-
import javax.faces.webapp.pdl.facelets.FaceletContext;
+
import com.sun.facelets.el.ELText;
import com.sun.facelets.el.TagMethodExpression;
import com.sun.facelets.el.TagValueExpression;
@@ -146,7 +146,7 @@
* parameter type
* @return a MethodExpression instance
*/
- public MethodExpression getMethodExpression(FaceletContext ctx, Class type, Class[] paramTypes)
+ public MethodExpression getMethodExpression(FaceletContext ctx, Class<?> type, Class<?>[] paramTypes)
{
try
{
@@ -235,7 +235,7 @@
* expected return type
* @return Object value of this attribute
*/
- public Object getObject(FaceletContext ctx, Class type)
+ public Object getObject(FaceletContext ctx, Class<?> type)
{
if (this.literal)
{
@@ -280,7 +280,7 @@
* expected return type
* @return ValueExpression instance
*/
- public ValueExpression getValueExpression(FaceletContext ctx, Class type)
+ public ValueExpression getValueExpression(FaceletContext ctx, Class<?> type)
{
try
{
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagHandler.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagHandler.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagHandler.java Thu Feb 12 01:23:54 2009
@@ -85,12 +85,13 @@
* Class type to search for
* @return iterator over instances of FaceletHandlers of the matching type
*/
- protected final Iterator findNextByType(Class type)
+ @SuppressWarnings("unchecked")
+ protected final <T> Iterator<T> findNextByType(Class<T> type)
{
- List found = new ArrayList();
+ List<T> found = new ArrayList<T>();
if (type.isAssignableFrom(this.nextHandler.getClass()))
{
- found.add(this.nextHandler);
+ found.add((T)this.nextHandler);
}
else if (this.nextHandler instanceof CompositeFaceletHandler)
{
@@ -99,7 +100,7 @@
{
if (type.isAssignableFrom(h[i].getClass()))
{
- found.add(h[i]);
+ found.add((T)h[i]);
}
}
}
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/UserTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/UserTagHandler.java?rev=743585&r1=743584&r2=743585&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/UserTagHandler.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/UserTagHandler.java Thu Feb 12 01:23:54 2009
@@ -21,17 +21,17 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
-import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import javax.el.ELException;
import javax.el.VariableMapper;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-
import javax.faces.webapp.pdl.facelets.FaceletContext;
import javax.faces.webapp.pdl.facelets.FaceletException;
+
import com.sun.facelets.TemplateClient;
import com.sun.facelets.el.VariableMapperWrapper;
import com.sun.facelets.tag.ui.DefineHandler;