Author: maksimkaszynski
Date: 2008-03-07 07:17:43 -0500 (Fri, 07 Mar 2008)
New Revision: 6620
Added:
trunk/framework/impl/src/test/java/org/ajax4jsf/framework/util/javascript/
trunk/framework/impl/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttrCheckImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttributeTable.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Configuration.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EncodingNameMapper.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EntityTable.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Lexer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/ParsePropertyImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Report.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TagTable.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Tidy.java
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TidyMessage.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxViewRootRenderer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentVariables.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
fixed syntax for J5
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -21,18 +21,18 @@
package org.ajax4jsf.component;
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxContainerBase;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.event.AjaxListener;
@@ -69,7 +69,7 @@
/**
* Listener for call on Ajax Requests
*/
- private MethodBinding ajaxListener = null;
+ private MethodExpression ajaxListener = null;
/**
* Flag for immediate call listeners
@@ -103,7 +103,7 @@
*
* @see org.ajax4jsf.components.custom.ajax.AjaxContainer#getAjaxListener()
*/
- public MethodBinding getAjaxListener() {
+ public MethodExpression getAjaxListener() {
return this.ajaxListener;
}
@@ -112,7 +112,7 @@
*
* @see
ogr.apache.myfaces.custom.ajax.AjaxContainer#setAjaxListener(javax.faces.el.MethodBinding)
*/
- public void setAjaxListener(MethodBinding ajaxListener) {
+ public void setAjaxListener(MethodExpression ajaxListener) {
//
if (log.isDebugEnabled())
{
@@ -130,9 +130,9 @@
if (this.immediateSet) {
return (this.immediate);
}
- ValueBinding vb = component.getValueBinding("immediate");
+ ValueExpression vb = component.getValueExpression("immediate");
if (vb != null) {
- return
(Boolean.TRUE.equals(vb.getValue(FacesContext.getCurrentInstance())));
+ return
(Boolean.TRUE.equals(vb.getValue(FacesContext.getCurrentInstance().getELContext())));
} else {
return (this.immediate);
}
@@ -158,9 +158,9 @@
if (this.selfRenderedSet) {
return (this.selfRendered);
}
- ValueBinding vb = component.getValueBinding("selfRendered");
+ ValueExpression vb = component.getValueExpression("selfRendered");
if (vb != null) {
- return
(Boolean.TRUE.equals(vb.getValue(FacesContext.getCurrentInstance())));
+ return
(Boolean.TRUE.equals(vb.getValue(FacesContext.getCurrentInstance().getELContext())));
} else {
return (this.selfRendered);
}
@@ -227,10 +227,11 @@
}
// Notify the specified action listener method (if any)
- MethodBinding mb = getAjaxListener();
+ MethodExpression mb = getAjaxListener();
if (mb != null) {
FacesContext context = FacesContext.getCurrentInstance();
- mb.invoke(context, new Object[] { event });
+ ELContext elContext = context.getELContext();
+ mb.invoke(elContext, new Object[] { event });
}
// TODO - perform special rendering, withowt RENDER_VIEW phase.
if(isSelfRendered()) {
@@ -266,7 +267,7 @@
// super.restoreState(context, values[0]);
this.immediate = ((Boolean) values[0]).booleanValue();
this.immediateSet = ((Boolean) values[1]).booleanValue();
- this.ajaxListener = (MethodBinding) UIComponentBase.restoreAttachedState(context,
values[2]);
+ this.ajaxListener = (MethodExpression) UIComponentBase.restoreAttachedState(context,
values[2]);
this.selfRendered = ((Boolean) values[3]).booleanValue();
this.selfRenderedSet = ((Boolean) values[4]).booleanValue();
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -24,11 +24,11 @@
import java.io.IOException;
import java.util.NoSuchElementException;
+import javax.el.MethodExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
@@ -96,7 +96,7 @@
*
* @see org.ajax4jsf.framework.ajax.AjaxViewBrige#getAjaxListener()
*/
- public MethodBinding getAjaxListener() {
+ public MethodExpression getAjaxListener() {
return getBrige().getAjaxListener();
}
@@ -452,7 +452,7 @@
*
* @see
org.ajax4jsf.framework.ajax.AjaxViewBrige#setAjaxListener(javax.faces.el.MethodBinding)
*/
- public void setAjaxListener(MethodBinding ajaxListener) {
+ public void setAjaxListener(MethodExpression ajaxListener) {
getBrige().setAjaxListener(ajaxListener);
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -7,7 +7,6 @@
import java.util.Collections;
import java.util.List;
-import javax.faces.context.FacesContext;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -55,7 +54,7 @@
} else if (current instanceof DataModel) {
model = new SequenceDataModel((DataModel) current);
} else if (current instanceof List) {
- model = new SequenceDataModel(new ListDataModel((List) current));
+ model = new SequenceDataModel(new ListDataModel((List<?>) current));
} else if (Object[].class.isAssignableFrom(current.getClass())) {
model = new SequenceDataModel(new ArrayDataModel((Object[]) current));
} else if (current instanceof ResultSet) {
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -29,7 +29,10 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.component.EditableValueHolder;
@@ -39,7 +42,6 @@
import javax.faces.component.UIComponent;
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;
@@ -90,7 +92,7 @@
throws IOException {
setRowKey(context, rowKey);
if (isRowAvailable()) {
- Iterator childIterator = dataChildren();
+ Iterator<UIComponent> childIterator = dataChildren();
while (childIterator.hasNext()) {
UIComponent component = (UIComponent) childIterator.next();
processComponent(context, component, argument);
@@ -112,7 +114,7 @@
public void processComponent(FacesContext context, UIComponent c,
Object argument) {
if (c instanceof UIColumn || c instanceof Column) {
- for (Iterator children = c.getChildren().iterator(); children.hasNext(); ) {
+ for (Iterator<UIComponent> children = c.getChildren().iterator();
children.hasNext(); ) {
UIComponent child = (UIComponent) children.next();
child.processDecodes(context);;
}
@@ -131,7 +133,7 @@
public void processComponent(FacesContext context, UIComponent c,
Object argument) {
if (c instanceof UIColumn || c instanceof Column) {
- for (Iterator children = c.getChildren().iterator(); children.hasNext(); ) {
+ for (Iterator<UIComponent> children = c.getChildren().iterator();
children.hasNext(); ) {
UIComponent child = (UIComponent) children.next();
child.processValidators(context);
}
@@ -150,7 +152,7 @@
public void processComponent(FacesContext context, UIComponent c,
Object argument) {
if (c instanceof UIColumn || c instanceof Column) {
- for (Iterator children = c.getChildren().iterator(); children.hasNext(); ) {
+ for (Iterator<UIComponent> children = c.getChildren().iterator();
children.hasNext(); ) {
UIComponent child = (UIComponent) children.next();
child.processUpdates(context);
}
@@ -165,14 +167,14 @@
* Base client id's of this component, for wich invoked encode... methods.
* Component will save state and serialisable models for this keys only.
*/
- private Set _encoded;
+ private Set<String> _encoded;
/**
* Storage for data model instances with different client id's of this
* component. In case of child for UIData component, this map will keep data
* models for different iterations between phases.
*/
- private Map _modelsMap = new HashMap();
+ private Map<String, ExtendedDataModel> _modelsMap = new HashMap<String,
ExtendedDataModel>();
/**
* Reference for curent data model
@@ -182,7 +184,7 @@
/**
* States of this component for diferent iterations, same as for models.
*/
- private Map _statesMap = new HashMap();
+ private Map<String, DataComponentState> _statesMap = new HashMap<String,
DataComponentState>();
/**
* Reference for current component state.
@@ -204,16 +206,16 @@
/**
* Values of row keys, encoded on ajax response rendering.
*/
- private Set _ajaxKeys = null;
+ private Set<Object> _ajaxKeys = null;
/**
* Internal set of row keys, encoded on ajax response rendering and cleared after
response complete
*/
- private Set _ajaxRequestKeys = null;
+ private Set<Object> _ajaxRequestKeys = null;
private Object _ajaxRowKey = null;
- private Map _ajaxRowKeysMap = new HashMap();
+ private Map<String, Object> _ajaxRowKeysMap = new HashMap<String,
Object>();
/**
* Get name of EL variable for component state.
@@ -378,35 +380,36 @@
*
* @see org.ajax4jsf.ajax.repeat.AjaxDataEncoder#getAjaxKeys()
*/
- public Set getAjaxKeys() {
- Set keys = null;
+ @SuppressWarnings("unchecked")
+ public Set<Object> getAjaxKeys() {
+ Set<Object> keys = null;
if (this._ajaxKeys != null) {
keys = (this._ajaxKeys);
} else {
- ValueBinding vb = getValueBinding("ajaxKeys");
+ ValueExpression vb = getValueExpression("ajaxKeys");
if (vb != null) {
- keys = (Set) (vb.getValue(getFacesContext()));
+ keys = (Set<Object>) (vb.getValue(getFacesContext().getELContext()));
} else if (null != _ajaxRowKey) {
// If none of above exist , use row with submitted AjaxComponent
- keys = new HashSet(1);
+ keys = new HashSet<Object>(1);
keys.add(_ajaxRowKey);
}
}
return keys;
}
- public Set getAllAjaxKeys() {
- Set ajaxKeys = getAjaxKeys();
+ public Set<Object> getAllAjaxKeys() {
+ Set<Object> ajaxKeys = getAjaxKeys();
- Set allAjaxKeys = null;
+ Set<Object> allAjaxKeys = null;
if (ajaxKeys != null) {
- allAjaxKeys = new HashSet();
+ allAjaxKeys = new HashSet<Object>();
allAjaxKeys.addAll(ajaxKeys);
}
if (_ajaxRequestKeys != null) {
if (allAjaxKeys == null) {
- allAjaxKeys = new HashSet();
+ allAjaxKeys = new HashSet<Object>();
}
allAjaxKeys.addAll(_ajaxRequestKeys);
@@ -420,7 +423,7 @@
*
* @see org.ajax4jsf.ajax.repeat.AjaxDataEncoder#setAjaxKeys(java.util.Set)
*/
- public void setAjaxKeys(Set ajaxKeys) {
+ public void setAjaxKeys(Set<Object> ajaxKeys) {
this._ajaxKeys = ajaxKeys;
}
@@ -431,7 +434,7 @@
* java.lang.String, java.util.Set, java.util.Set)
*/
public void encodeAjaxChild(FacesContext context, String path,
- final Set ids, final Set renderedAreas) throws IOException {
+ final Set<String> ids, final Set<String> renderedAreas) throws IOException
{
resetDataModel();
Renderer renderer = getRenderer(context);
@@ -460,7 +463,7 @@
}
};
- Set ajaxKeys = getAllAjaxKeys();
+ Set<Object> ajaxKeys = getAllAjaxKeys();
if (null != ajaxKeys) {
if(_log.isDebugEnabled()){
_log.debug("Component "+getClientId(context)+" Encode children
components for a keys "+ajaxKeys);
@@ -468,13 +471,13 @@
captureOrigValue();
Object savedKey = getRowKey();
setRowKey(context, null);
- Iterator fixedChildren = fixedChildren();
+ Iterator<UIComponent> fixedChildren = fixedChildren();
while (fixedChildren.hasNext()) {
- UIComponent component = (UIComponent) fixedChildren.next();
+ UIComponent component = fixedChildren.next();
ajaxVisitor.processComponent(context, component, null);
}
- for (Iterator iter = ajaxKeys.iterator(); iter.hasNext();) {
- Object key = (Object) iter.next();
+ for (Iterator<Object> iter = ajaxKeys.iterator(); iter.hasNext();) {
+ Object key = iter.next();
ajaxVisitor.process(context, key, null);
}
setRowKey(context,savedKey);
@@ -504,7 +507,7 @@
if (_childrenRenderer == null) {
_childrenRenderer = new AjaxChildrenRenderer() {
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIDataAdaptor.class;
}
@@ -519,9 +522,9 @@
* @return Set of values for clientId's of this component, for wich was
* invoked "encode" methods.
*/
- protected Set getEncodedIds() {
+ protected Set<String> getEncodedIds() {
if (_encoded == null) {
- _encoded = new HashSet();
+ _encoded = new HashSet<String>();
}
return _encoded;
@@ -541,7 +544,7 @@
*/
protected void setupVariable(FacesContext faces, DataModel localModel,
boolean rowSelected) {
- Map attrs = faces.getExternalContext().getRequestMap();
+ Map<String, Object> attrs = faces.getExternalContext().getRequestMap();
if (rowSelected/*&& isRowAvailable()*/) {
// Current row data.
setupVariable(getVar(), attrs, localModel.getRowData());
@@ -562,7 +565,7 @@
* @param attrs
* @param rowData
*/
- private void setupVariable(String var, Map attrs, Object rowData) {
+ private void setupVariable(String var, Map<String, Object> attrs, Object rowData)
{
if (var != null) {
attrs.put(var, rowData);
}
@@ -573,7 +576,7 @@
* @param attrs
* @param rowData
*/
- private void removeVariable(String var, Map attrs) {
+ private void removeVariable(String var, Map<String, Object> attrs) {
if (var != null) {
attrs.remove(var);
}
@@ -647,17 +650,18 @@
DataComponentState state = null;
if (this._currentState == null) {
// Check for binding state to user bean.
- ValueBinding valueBinding = getValueBinding(UIDataAdaptor.COMPONENT_STATE_ATTRIBUTE);
+ ValueExpression valueBinding =
getValueExpression(UIDataAdaptor.COMPONENT_STATE_ATTRIBUTE);
FacesContext facesContext = getFacesContext();
+ ELContext elContext = facesContext.getELContext();
if (null != valueBinding) {
state = (DataComponentState) valueBinding
- .getValue(facesContext);
+ .getValue(elContext);
if (null == state) {
// Create default state
state = createComponentState();
- if (!valueBinding.isReadOnly(facesContext)) {
+ if (!valueBinding.isReadOnly(elContext)) {
// Store created state in user bean.
- valueBinding.setValue(facesContext, state);
+ valueBinding.setValue(elContext, state);
}
}
} else {
@@ -795,7 +799,7 @@
public void captureOrigValue(FacesContext faces) {
String var = getVar();
if (var != null) {
- Map attrs = faces.getExternalContext().getRequestMap();
+ Map<String, Object> attrs = faces.getExternalContext().getRequestMap();
this.origValue = attrs.get(var);
}
}
@@ -816,7 +820,7 @@
public void restoreOrigValue(FacesContext faces) {
String var = getVar();
if (var != null) {
- Map attrs = faces.getExternalContext().getRequestMap();
+ Map<String, Object> attrs = faces.getExternalContext().getRequestMap();
if (this.origValue != null) {
attrs.put(var, this.origValue);
} else {
@@ -828,21 +832,21 @@
/**
* Saved values of {@link EditableValueHolder} fields per iterations.
*/
- private Map childState;
+ private Map<String, Map<String, SavedState>> childState;
/**
* @param faces
* @return Saved values of {@link EditableValueHolder} fields per
* iterations.
*/
- protected Map getChildState(FacesContext faces) {
+ protected Map<String, SavedState> getChildState(FacesContext faces) {
if (this.childState == null) {
- this.childState = new HashMap();
+ this.childState = new HashMap<String, Map<String,SavedState>>();
}
String baseClientId = getBaseClientId(faces);
- Map currentChildState = (Map) childState.get(baseClientId);
+ Map<String, SavedState> currentChildState = childState.get(baseClientId);
if (null == currentChildState) {
- currentChildState = new HashMap();
+ currentChildState = new HashMap<String, SavedState>();
childState.put(baseClientId, currentChildState);
}
return currentChildState;
@@ -856,9 +860,9 @@
*/
protected void saveChildState(FacesContext faces) {
- Iterator itr = dataChildren();
+ Iterator<UIComponent> itr = dataChildren();
while (itr.hasNext()) {
- Map childState = this.getChildState(faces);
+ Map<String, SavedState> childState = this.getChildState(faces);
this.saveChildState(faces, (UIComponent) itr.next(), childState);
}
}
@@ -872,11 +876,11 @@
* @param childState
*/
private void saveChildState(FacesContext faces, UIComponent c,
- Map childState) {
+ Map<String, SavedState> childState) {
if (c instanceof EditableValueHolder && !c.isTransient()) {
String clientId = c.getClientId(faces);
- SavedState ss = (SavedState) childState.get(clientId);
+ SavedState ss = childState.get(clientId);
if (ss == null) {
ss = new SavedState();
childState.put(clientId, ss);
@@ -885,7 +889,7 @@
}
// continue hack
- Iterator itr = c.getChildren().iterator();
+ Iterator<UIComponent> itr = c.getChildren().iterator();
while (itr.hasNext()) {
saveChildState(faces, (UIComponent) itr.next(), childState);
}
@@ -905,9 +909,9 @@
*/
protected void restoreChildState(FacesContext faces) {
- Iterator itr = dataChildren();
+ Iterator<UIComponent> itr = dataChildren();
while (itr.hasNext()) {
- Map childState = this.getChildState(faces);
+ Map<String, SavedState> childState = this.getChildState(faces);
this.restoreChildState(faces, (UIComponent) itr.next(), childState);
}
}
@@ -922,7 +926,7 @@
*
*/
private void restoreChildState(FacesContext faces, UIComponent c,
- Map childState) {
+ Map<String, SavedState> childState) {
// reset id
String id = c.getId();
c.setId(id);
@@ -931,7 +935,7 @@
if (c instanceof EditableValueHolder) {
EditableValueHolder evh = (EditableValueHolder) c;
String clientId = c.getClientId(faces);
- SavedState ss = (SavedState) childState.get(clientId);
+ SavedState ss = childState.get(clientId);
if (ss != null) {
ss.apply(evh);
} else {
@@ -940,7 +944,7 @@
}
// continue hack
- Iterator itr = c.getChildren().iterator();
+ Iterator<UIComponent> itr = c.getChildren().iterator();
while (itr.hasNext()) {
restoreChildState(faces, (UIComponent) itr.next(), childState);
}
@@ -961,12 +965,12 @@
*/
private boolean keepSaved(FacesContext context) {
- Iterator clientIds = this.getChildState(context).keySet().iterator();
+ Iterator<String> clientIds = this.getChildState(context).keySet().iterator();
while (clientIds.hasNext()) {
- String clientId = (String) clientIds.next();
- Iterator messages = context.getMessages(clientId);
+ String clientId = clientIds.next();
+ Iterator<FacesMessage> messages = context.getMessages(clientId);
while (messages.hasNext()) {
- FacesMessage message = (FacesMessage) messages.next();
+ FacesMessage message = messages.next();
if (message.getSeverity()
.compareTo(FacesMessage.SEVERITY_ERROR) >= 0) {
return (true);
@@ -994,9 +998,9 @@
this.captureOrigValue(faces);
this.setRowKey(faces, null);
try {
- Iterator fixedChildren = fixedChildren();
+ Iterator<UIComponent> fixedChildren = fixedChildren();
while (fixedChildren.hasNext()) {
- UIComponent component = (UIComponent) fixedChildren.next();
+ UIComponent component = fixedChildren.next();
visitor.processComponent(faces, component, argument);
}
@@ -1101,7 +1105,7 @@
*
* @return iterator for all components not sensitive for row data.
*/
- protected abstract Iterator fixedChildren();
+ protected abstract Iterator<UIComponent> fixedChildren();
/**
* This method must create iterator for all children components, processed
@@ -1109,7 +1113,7 @@
*
* @return iterator for all components processed per row.
*/
- protected abstract Iterator dataChildren();
+ protected abstract Iterator<UIComponent> dataChildren();
private final static SavedState NullState = new SavedState();
@@ -1315,15 +1319,15 @@
private Object superState;
- private Map componentStates = new HashMap();
+ private Map<String, PerIdState> componentStates = new HashMap<String,
PerIdState>();
- private Set ajaxKeys;
+ private Set<Object> ajaxKeys;
public String rowKeyVar;
public String stateVar;
- private Map childStates;
+ private Map<String, Map<String, SavedState>> childStates;
}
@@ -1356,17 +1360,17 @@
DataState state = (DataState) object;
super.restoreState(faces, state.superState);
this._ajaxKeys = state.ajaxKeys;
- this._statesMap = new HashMap();
+ this._statesMap = new HashMap<String, DataComponentState>();
this._rowKeyVar = state.rowKeyVar;
this._stateVar = state.stateVar;
this.childState = state.childStates;
// Restore serializable models and component states for all rows of
// parent UIData ( single if this
// component not child of iterable )
- for (Iterator iter = state.componentStates.entrySet().iterator(); iter
+ for (Iterator<Entry<String, PerIdState>> iter =
state.componentStates.entrySet().iterator(); iter
.hasNext();) {
- Map.Entry stateEntry = (Map.Entry) iter.next();
- PerIdState idState = (PerIdState) stateEntry.getValue();
+ Entry<String, PerIdState> stateEntry = iter.next();
+ PerIdState idState = stateEntry.getValue();
DataComponentState compState;
if (idState.stateInHolder) {
// TODO - change RichFaces Tree component, for remove reference
@@ -1377,7 +1381,7 @@
} else {
compState = (DataComponentState) idState.componentState;
}
- Object key = stateEntry.getKey();
+ String key = stateEntry.getKey();
this._statesMap.put(key, compState);
this._modelsMap.put(key, idState.model);
}
@@ -1390,17 +1394,16 @@
state.rowKeyVar = this._rowKeyVar;
state.stateVar = this._stateVar;
state.childStates = this.childState;
- Set encodedIds = getEncodedIds();
+ Set<String> encodedIds = getEncodedIds();
// Save all states of component and data model for all valies of
// clientId, encoded in this request.
// this._statesMap.put(getBaseClientId(faces), this._currentState);
// this._modelsMap.put(getBaseClientId(faces), this._currentModel);
- for (Iterator iter = this._statesMap.entrySet().iterator(); iter
+ for (Iterator<Entry<String, DataComponentState>> iter =
this._statesMap.entrySet().iterator(); iter
.hasNext();) {
- Map.Entry stateEntry = (Map.Entry) iter.next();
- DataComponentState dataComponentState = ((DataComponentState) stateEntry
- .getValue());
- Object stateKey = stateEntry.getKey();
+ Entry<String, DataComponentState> stateEntry = iter.next();
+ DataComponentState dataComponentState = stateEntry.getValue();
+ String stateKey = stateEntry.getKey();
if (encodedIds.isEmpty() || encodedIds.contains(stateKey)) {
PerIdState idState = new PerIdState();
// Save component state , depended if implemented interfaces.
@@ -1443,7 +1446,7 @@
*/
public void addRequestKey(Object key) {
if (_ajaxRequestKeys == null) {
- _ajaxRequestKeys = new HashSet();
+ _ajaxRequestKeys = new HashSet<Object>();
}
_ajaxRequestKeys.add(key);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -79,6 +79,7 @@
* @version $Revision: 1.1.2.7 $ $Date: 2007/02/08 19:07:16 $
*
*/
+@SuppressWarnings("deprecation")
public class AjaxContextImpl extends AjaxContext {
public static final String RESOURCES_PROCESSED =
"org.ajax4jsf.framework.HEADER_PROCESSED";
@@ -91,11 +92,12 @@
private static ComponentInvoker invoker;
+ //TODO: what is it?
private static Map contextClasses = new HashMap();
- Set ajaxAreasToRender = new HashSet();
+ Set<String> ajaxAreasToRender = new HashSet<String>();
- Set ajaxRenderedAreas = new LinkedHashSet();
+ Set<String> ajaxRenderedAreas = new LinkedHashSet<String>();
boolean ajaxRequest = false;
@@ -111,9 +113,9 @@
ViewIdHolder viewIdHolder = null;
- Map responseDataMap = new HashMap();
+ Map<String, Object> responseDataMap = new HashMap<String, Object> ();
- Map commonAjaxParameters = new HashMap();
+ Map<String, Object> commonAjaxParameters = new HashMap<String, Object> ();
Object oncomplete = null;
@@ -128,9 +130,9 @@
public void release() {
- ajaxAreasToRender = new HashSet();
+ ajaxAreasToRender = new HashSet<String>();
- ajaxRenderedAreas = new LinkedHashSet();
+ ajaxRenderedAreas = new LinkedHashSet<String>();
ajaxRequest = false;
@@ -146,9 +148,9 @@
viewIdHolder = null;
- responseDataMap = new HashMap();
+ responseDataMap = new HashMap<String, Object>();
- commonAjaxParameters = new HashMap();
+ commonAjaxParameters = new HashMap<String, Object>();
}
@@ -356,7 +358,7 @@
public void processHeadResources(FacesContext context)
throws FacesException {
ExternalContext externalContext = context.getExternalContext();
- Map requestMap = externalContext.getRequestMap();
+ Map<String,Object> requestMap = externalContext.getRequestMap();
if (!Boolean.TRUE.equals(requestMap.get(RESOURCES_PROCESSED))) {
if (null != requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE)) {
if (log.isDebugEnabled()) {
@@ -507,13 +509,13 @@
}
viewResources.collect(context);
- Set scripts = viewResources.getScripts();
+ Set<String> scripts = viewResources.getScripts();
if (scripts.size() > 0) {
if (log.isDebugEnabled()) {
StringBuffer buff = new StringBuffer(
"Scripts for insert into head : \n");
- for (Iterator iter = scripts.iterator(); iter.hasNext();) {
- String script = (String) iter.next();
+ for (Iterator<String> iter = scripts.iterator(); iter.hasNext();) {
+ String script = iter.next();
buff.append(script).append("\n");
}
log.debug(buff.toString());
@@ -521,12 +523,12 @@
requestMap.put(SCRIPTS_PARAMETER, scripts);
}
- Set styles = viewResources.getStyles();
+ Set<String> styles = viewResources.getStyles();
if (styles.size() > 0) {
if (log.isDebugEnabled()) {
StringBuffer buff = new StringBuffer(
"Styles for insert into head : \n");
- for (Iterator iter = styles.iterator(); iter.hasNext();) {
+ for (Iterator<String> iter = styles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
buff.append(style).append("\n");
}
@@ -535,12 +537,12 @@
requestMap.put(STYLES_PARAMETER, styles);
}
- Set usersStyles = viewResources.getUserStyles();
+ Set<String> usersStyles = viewResources.getUserStyles();
if (usersStyles.size() > 0) {
if (log.isDebugEnabled()) {
StringBuffer buff = new StringBuffer(
"User styles for insert into head : \n");
- for (Iterator iter = usersStyles.iterator(); iter.hasNext();) {
+ for (Iterator<String> iter = usersStyles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
buff.append(style).append("\n");
}
@@ -556,12 +558,13 @@
}
}
-
+
+ @SuppressWarnings("deprecation")
public void saveViewState(FacesContext context) throws IOException {
// TODO - for facelets environment, we need to remove transient
// components.
try {
- Application.class.getMethod("getExpressionFactory", null);
+ Application.class.getMethod("getExpressionFactory", (Class<?>) null);
} catch (NoSuchMethodException e) {
// JSF 1.1 !
}
@@ -633,7 +636,7 @@
/**
* @return Returns the ajaxAreasToRender.
*/
- public Set getAjaxAreasToRender() {
+ public Set<String> getAjaxAreasToRender() {
return this.ajaxAreasToRender;
}
@@ -644,7 +647,7 @@
*/
public void addRegionsFromComponent(UIComponent component) {
// First step - find parent ajax view
- Set ajaxRegions = AjaxRendererUtils.getAjaxAreas(component);
+ Set<String> ajaxRegions = AjaxRendererUtils.getAjaxAreas(component);
// if (ajaxRegions == null){
// FacesContext context = FacesContext.getCurrentInstance();
// ajaxRegions = AjaxRendererUtils.getAbsoluteId(context,component);
@@ -654,7 +657,7 @@
component.getId()));
}
if (ajaxRegions != null) {
- for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
+ for (Iterator<String> iter = ajaxRegions.iterator(); iter.hasNext();) {
String id = iter.next().toString();
ajaxAreasToRender.add(convertId(component, id));
}
@@ -698,7 +701,7 @@
/**
* @return Returns the ajaxRenderedAreas.
*/
- public Set getAjaxRenderedAreas() {
+ public Set<String> getAjaxRenderedAreas() {
return ajaxRenderedAreas;
}
@@ -718,7 +721,7 @@
ExternalContext externalContext = context.getExternalContext();
if (null == externalContext.getRequestMap().get(
"javax.servlet.error.exception")) {
- Map requestParameterMap = externalContext
+ Map<String, String> requestParameterMap = externalContext
.getRequestParameterMap();
this.submittedRegionClientId = (String) requestParameterMap
.get(AjaxContainerRenderer.AJAX_PARAMETER_NAME);
@@ -792,7 +795,7 @@
/**
* @return the responseDataMap
*/
- public Map getResponseDataMap() {
+ public Map<String, Object> getResponseDataMap() {
return responseDataMap;
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -24,10 +24,10 @@
*/
public class ViewResources {
- LinkedHashSet scripts = new LinkedHashSet();
- LinkedHashSet styles = new LinkedHashSet();
- LinkedHashSet userScripts = new LinkedHashSet();
- LinkedHashSet userStyles = new LinkedHashSet();
+ LinkedHashSet<String> scripts = new LinkedHashSet<String>();
+ LinkedHashSet<String> styles = new LinkedHashSet<String>();
+ LinkedHashSet<String> userScripts = new LinkedHashSet<String>();
+ LinkedHashSet<String> userStyles = new LinkedHashSet<String>();
boolean processStyles = true;
boolean processScripts = true;
RenderKit renderKit = null;
@@ -58,14 +58,14 @@
if ((processScripts || processStyles ) && renderer instanceof
HeaderResourceProducer) {
HeaderResourceProducer producer = (HeaderResourceProducer) renderer;
if (processScripts) {
- Set set = producer.getHeaderScripts(context, root);
+ Set<String> set = producer.getHeaderScripts(context, root);
if (null != set) {
scripts.addAll(set);
}
}
if (processStyles) {
- Set set = producer.getHeaderStyles(context, root);
+ Set<String> set = producer.getHeaderStyles(context, root);
if (null != set) {
styles.addAll(set);
}
@@ -73,7 +73,7 @@
}
} else if (renderer instanceof UserResourceRenderer) {
UserResourceRenderer producer = (UserResourceRenderer) renderer;
- Set set = producer.getHeaderScripts(context, root);
+ Set<String> set = producer.getHeaderScripts(context, root);
if (null != set) {
userScripts.addAll(set);
}
@@ -84,13 +84,13 @@
}
}
- for (Iterator iter = root.getFacets().values().iterator(); iter
+ for (Iterator<UIComponent> iter = root.getFacets().values().iterator(); iter
.hasNext();) {
- UIComponent child = (UIComponent) iter.next();
+ UIComponent child = iter.next();
processHeadResources(context, child);
}
- for (Iterator iter = root.getChildren().iterator(); iter.hasNext();) {
- UIComponent child = (UIComponent) iter.next();
+ for (Iterator<UIComponent> iter = root.getChildren().iterator(); iter.hasNext();)
{
+ UIComponent child = iter.next();
processHeadResources(context, child);
}
}
@@ -145,21 +145,21 @@
/**
* @return the scripts
*/
- public Set getScripts() {
+ public Set<String> getScripts() {
return scripts;
}
/**
* @return the styles
*/
- public Set getStyles() {
+ public Set<String> getStyles() {
return styles;
}
/**
* @return user styles
*/
- public Set getUserStyles() {
+ public Set<String> getUserStyles() {
return userStyles;
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -308,18 +308,21 @@
out.flush();
}
+ @SuppressWarnings("serial")
static class UnterminatedCommentException extends Exception {
public UnterminatedCommentException(int line,int column) {
super("Unterminated comment at line "+line+" and column
"+column);
}
}
+ @SuppressWarnings("serial")
static class UnterminatedStringLiteralException extends Exception {
public UnterminatedStringLiteralException(int line,int column) {
super("Unterminated string literal at line "+line+" and column
"+column);
}
}
+ @SuppressWarnings("serial")
static class UnterminatedRegExpLiteralException extends Exception {
public UnterminatedRegExpLiteralException(int line,int column) {
super("Unterminated regular expression at line "+line+" and column
"+column);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttrCheckImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttrCheckImpl.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttrCheckImpl.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -77,6 +77,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
/**
@@ -881,7 +882,7 @@
/**
* valid html colors.
*/
- private static final Map COLORS = new HashMap();
+ private static final Map<String, String> COLORS = new HashMap<String,
String>();
static
{
@@ -920,11 +921,11 @@
String given = attval.value;
- Iterator colorIter = COLORS.entrySet().iterator();
+ Iterator<Entry<String, String>> colorIter =
COLORS.entrySet().iterator();
while (colorIter.hasNext())
{
- Map.Entry color = (Map.Entry) colorIter.next();
+ Entry<String,String> color = colorIter.next();
if (given.charAt(0) == '#')
{
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttributeTable.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttributeTable.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/AttributeTable.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -345,7 +345,7 @@
/**
* Map containing all the installed attributes.
*/
- private Map attributeHashtable = new Hashtable();
+ private Map<String, Attribute> attributeHashtable = new Hashtable<String,
Attribute>();
/**
* lookup an installed Attribute.
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Configuration.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Configuration.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Configuration.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -240,7 +240,7 @@
* Map containg all the valid configuration options and the related parser. Tag entry
contains String(option
* name)-Flag instance.
*/
- private static final Map OPTIONS = new HashMap();
+ private static final Map<String, Flag> OPTIONS = new HashMap<String,
Flag>();
/**
* serial version UID for this class.
@@ -772,7 +772,7 @@
*/
public void addProps(Properties p)
{
- Enumeration propEnum = p.propertyNames();
+ Enumeration<?> propEnum = p.propertyNames();
while (propEnum.hasMoreElements())
{
String key = (String) propEnum.nextElement();
@@ -825,7 +825,7 @@
*/
private void parseProps()
{
- Iterator iterator = properties.keySet().iterator();
+ Iterator<Object> iterator = properties.keySet().iterator();
while (iterator.hasNext())
{
@@ -950,10 +950,10 @@
Flag configItem;
// sort configuration options
- List values = new ArrayList(OPTIONS.values());
+ List<Flag> values = new ArrayList<Flag>(OPTIONS.values());
Collections.sort(values);
- Iterator iterator = values.iterator();
+ Iterator<Flag> iterator = values.iterator();
while (iterator.hasNext())
{
@@ -1012,7 +1012,7 @@
/**
* A configuration option.
*/
- static class Flag implements Comparable
+ static class Flag implements Comparable<Flag>
{
/**
@@ -1113,7 +1113,7 @@
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
- public int compareTo(Object o)
+ public int compareTo(Flag o)
{
return this.name.compareTo(((Flag) o).name);
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EncodingNameMapper.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EncodingNameMapper.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EncodingNameMapper.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -90,7 +90,7 @@
/**
* Map containing uppercase alias - {standard iana, standard java}.
*/
- private static Map encodingNameMap = new HashMap();
+ private static Map<String, String[]> encodingNameMap = new HashMap<String,
String[]>();
static
{
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EntityTable.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EntityTable.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/EntityTable.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -354,7 +354,7 @@
/**
* Entity map.
*/
- private Map entityHashtable = new Hashtable();
+ private Map<String, Entity> entityHashtable = new Hashtable<String,
Entity>();
/**
* use getDefaultEntityTable to get an entity table instance.
@@ -443,7 +443,7 @@
{
String name = null;
Entity ent;
- Iterator en = this.entityHashtable.values().iterator();
+ Iterator<Entity> en = this.entityHashtable.values().iterator();
while (en.hasNext())
{
ent = (Entity) en.next();
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Lexer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Lexer.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Lexer.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -372,7 +372,7 @@
/**
* stack.
*/
- protected Stack istack;
+ protected Stack<IStack> istack;
/**
* start of frame.
@@ -412,7 +412,7 @@
/**
* node list.
*/
- private List nodeList;
+ private List<Node> nodeList;
/**
* Instantiates a new Lexer.
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/ParsePropertyImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/ParsePropertyImpl.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/ParsePropertyImpl.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -511,14 +511,14 @@
return "";
}
- List tagList = configuration.tt.findAllDefinedTag(tagType);
+ List<String> tagList = configuration.tt.findAllDefinedTag(tagType);
if (tagList.isEmpty())
{
return "";
}
StringBuffer buffer = new StringBuffer();
- Iterator iterator = tagList.iterator();
+ Iterator<String> iterator = tagList.iterator();
while (iterator.hasNext())
{
buffer.append(iterator.next());
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Report.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Report.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Report.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -84,7 +84,6 @@
import org.ajax4jsf.org.w3c.tidy.TidyMessage.Level;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.NoOpLog;
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TagTable.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TagTable.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TagTable.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -668,7 +668,7 @@
/**
* hashTable containing tags.
*/
- private Map tagHashtable = new Hashtable();
+ private Map<String, Dict> tagHashtable = new Hashtable<String, Dict>();
/**
* Instantiates a new tag table with known tags.
@@ -894,11 +894,11 @@
* @param tagType one of Dict.TAGTYPE_EMPTY | Dict.TAGTYPE_INLINE |
Dict.TAGTYPE_BLOCK | Dict.TAGTYPE_PRE
* @return List containing all the user-defined tag names
*/
- List findAllDefinedTag(short tagType)
+ List<String> findAllDefinedTag(short tagType)
{
- List tagNames = new ArrayList();
+ List<String> tagNames = new ArrayList<String>();
- Iterator iterator = tagHashtable.values().iterator();
+ Iterator<Dict> iterator = tagHashtable.values().iterator();
while (iterator.hasNext())
{
Dict curDictEntry = (Dict) iterator.next();
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Tidy.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Tidy.java 2008-03-07
12:17:26 UTC (rev 6619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/Tidy.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -111,7 +111,7 @@
/**
* Alias for configuration options accepted in command line.
*/
- private static final Map CMDLINE_ALIAS = new HashMap();
+ private static final Map<String, String> CMDLINE_ALIAS = new HashMap<String,
String>();
static
{
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TidyMessage.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TidyMessage.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/org/w3c/tidy/TidyMessage.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -183,7 +183,7 @@
* @author fgiust
* @version $Revision: 1.1.2.1 $ ($Author: alexsmirnov $)
*/
- public static final class Level implements Comparable
+ public static final class Level implements Comparable<Level>
{
/**
@@ -255,7 +255,7 @@
/**
* @see java.lang.Comparable#compareTo(Object)
*/
- public int compareTo(Object object)
+ public int compareTo(Level object)
{
return this.code - ((Level) object).code;
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -65,14 +65,14 @@
* @throws IOException
* @deprecated Use {@link #encodeAjaxChildren(FacesContext,UIComponent,String,Set,Set)}
instead
*/
- public void encodeAjaxChild(FacesContext context, UIComponent component, String path,
Set ids, Set renderedAreas) throws IOException {
+ public void encodeAjaxChild(FacesContext context, UIComponent component, String path,
Set<String> ids, Set<String> renderedAreas) throws IOException {
encodeAjaxChildren(context, component, path, ids, renderedAreas);
}
/* (non-Javadoc)
* @see
org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxChildren(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String, java.util.Set, java.util.Set)
*/
- public void encodeAjaxChildren(FacesContext context, UIComponent component, String path,
Set ids, Set renderedAreas) throws IOException {
+ public void encodeAjaxChildren(FacesContext context, UIComponent component, String path,
Set<String> ids, Set<String> renderedAreas) throws IOException {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(Messages.ENCODE_CHILD_AJAX_INFO,
path, component.getId()));
@@ -81,7 +81,7 @@
if (component instanceof NamingContainer) {
currentPath += component.getId() + NamingContainer.SEPARATOR_CHAR;
}
- for (Iterator it = component.getFacetsAndChildren(); it.hasNext();) {
+ for (Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();)
{
UIComponent element = (UIComponent) it.next();
encodeAjaxComponent(context, element, currentPath, ids, renderedAreas);
}
@@ -90,7 +90,7 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxComponent(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String, java.util.Set, java.util.Set)
*/
- public void encodeAjaxComponent(FacesContext context, UIComponent component, String
currentPath, Set ids, Set renderedAreas) throws IOException {
+ public void encodeAjaxComponent(FacesContext context, UIComponent component, String
currentPath, Set<String> ids, Set<String> renderedAreas) throws IOException {
if (component.isRendered()) { // skip not-rendered components.
boolean found = false;
if (!ids.isEmpty()) {
@@ -145,7 +145,7 @@
}
}
- private Set _specialComponentTypes = null;
+ private Set<String> _specialComponentTypes = null;
/**
* Detect component as special control case - such as messages bundle
@@ -159,7 +159,7 @@
*/
private boolean isSpecialElement(FacesContext context, UIComponent component) {
if (_specialComponentTypes == null) {
- _specialComponentTypes = new HashSet(10);
+ _specialComponentTypes = new HashSet<String>(10);
for (int i = 0; i < SPECIAL_COMPONENTS_TYPES.length; i++) {
_specialComponentTypes.add(SPECIAL_COMPONENTS_TYPES[i]);
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -77,6 +77,7 @@
*
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
+ @SuppressWarnings("unchecked")
protected Class getComponentClass() {
// TODO Auto-generated method stub
return AjaxContainer.class;
@@ -108,8 +109,8 @@
// Iterate over all childrens, render it if nessesary...
log.debug(Messages.getMessage(Messages.RENDER_CHILDREN_AJAX_INFO));
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- Set ids = ajaxContext.getAjaxAreasToRender();
- Set renderedAreas = ajaxContext.getAjaxRenderedAreas();
+ Set<String> ids = ajaxContext.getAjaxAreasToRender();
+ Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
if (((AjaxContainer) component).isRenderRegionOnly()) {
root = component;
} else {
@@ -144,7 +145,7 @@
*/
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
- Map paramMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> paramMap =
context.getExternalContext().getRequestParameterMap();
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(
Messages.DECODE_AJAX_REQUEST_STATUS_INFO, clientId));
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -104,7 +104,7 @@
public static final String AJAX_REGIONS_ATTRIBUTE = "reRender";
- private static final Class OBJECT_ARRAY_CLASS = (new Object[0]).getClass();
+ private static final Class<?> OBJECT_ARRAY_CLASS = (new Object[0]).getClass();
private static final String VALUE_ATTR = "value";
@@ -116,7 +116,7 @@
public static final String AJAX_DELAY_ATTR = "requestDelay";
- private static final Object AJAX_ABORT_ATTR = "ignoreDupResponses";
+ private static final String AJAX_ABORT_ATTR = "ignoreDupResponses";
/**
* Static class - protect constructor TODO - make as subclass of chameleon
@@ -198,12 +198,12 @@
* @param uiComponent
* @return
*/
- public static Map buildEventOptions(FacesContext facesContext,
+ public static Map<String, Object> buildEventOptions(FacesContext facesContext,
UIComponent uiComponent) {
String clientId = uiComponent.getClientId(facesContext);
- Map componentAttributes = uiComponent.getAttributes();
- Map options = new HashMap();
- Map parameters = new HashMap();
+ Map<String, Object> componentAttributes = uiComponent.getAttributes();
+ Map<String, Object> options = new HashMap<String, Object>();
+ Map<String, Object> parameters = new HashMap<String, Object>();
// UIForm form = getNestingForm(uiComponent);
// "input" - if assigned to html input element.
boolean input = (uiComponent instanceof AjaxSupport && uiComponent
@@ -250,8 +250,8 @@
// Add application-wide Ajax parameters
parameters.putAll(ajaxContext.getCommonAjaxParameters());
// add child parameters
- for (Iterator it = uiComponent.getChildren().iterator(); it.hasNext();) {
- UIComponent child = (UIComponent) it.next();
+ for (Iterator<UIComponent> it = uiComponent.getChildren().iterator();
it.hasNext();) {
+ UIComponent child = it.next();
if (child instanceof UIParameter) {
String name = ((UIParameter) child).getName();
Object value = ((UIParameter) child).getValue();
@@ -280,10 +280,10 @@
}
// parameter to render only current list of areas.
if (isAjaxLimitToList(uiComponent)) {
- Set ajaxAreas = getAjaxAreas(uiComponent);
- Set areasIds = new HashSet();
+ Set<? extends Object> ajaxAreas = getAjaxAreas(uiComponent);
+ Set<String> areasIds = new HashSet<String>();
if (null != ajaxAreas) {
- for (Iterator iter = ajaxAreas.iterator(); iter.hasNext();) {
+ for (Iterator<? extends Object> iter = ajaxAreas.iterator(); iter.hasNext();)
{
String id = (String) iter.next();
UIComponent comp = RendererUtils.getInstance().
findComponentFor(uiComponent, id);
@@ -298,10 +298,7 @@
}
String oncomplete = getAjaxOncomplete(uiComponent);
if (null != oncomplete) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("request");
- function.addParameter("event");
- function.addParameter("data");
+ JSFunctionDefinition function = new JSFunctionDefinition("request",
"event", "data");
function.addToBody(oncomplete);
options.put(ONCOMPLETE_ATTR_NAME, function);
@@ -309,10 +306,7 @@
String beforeupdate = getAjaxOnBeforeDomUpdate(uiComponent);
if (null != beforeupdate) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("request");
- function.addParameter("event");
- function.addParameter("data");
+ JSFunctionDefinition function = new JSFunctionDefinition("request",
"event", "data");
function.addToBody(beforeupdate);
options.put(ONBEFOREDOMUPDATE_ATTR_NAME, function);
@@ -474,7 +468,7 @@
* @param uiComponent
* @return List of areas Id's , updated by this component.
*/
- public static Set getAjaxAreas(UIComponent uiComponent) {
+ public static Set<String> getAjaxAreas(UIComponent uiComponent) {
Object areas;
if (uiComponent instanceof AjaxComponent) {
areas = ((AjaxComponent) uiComponent).getReRender();
@@ -495,29 +489,29 @@
* obect for convert to List.
* @return - list of strings.
*/
- public static Set asSet(Object valueToSet) {
+ public static Set<String> asSet(Object valueToSet) {
if (null != valueToSet) {
// Simplest case - set.
if (valueToSet instanceof Set) {
- return (Set) valueToSet;
+ return (Set<String>) valueToSet;
}
// Other collections.
else if (valueToSet instanceof Collection) {
- return new HashSet((Collection) valueToSet);
+ return new HashSet<String>((Collection<String>) valueToSet);
}
// Array
else if (OBJECT_ARRAY_CLASS.isAssignableFrom(valueToSet.getClass())) {
- return new HashSet(Arrays.asList((Object[]) valueToSet));
+ return new HashSet<String>(Arrays.asList((String[]) valueToSet));
}
// Tokenize string.
else if (valueToSet instanceof String) {
String areasString = (String) valueToSet;
if (areasString.indexOf(",") > 0) {
- return new HashSet(Arrays.asList(areasString.trim().split(
+ return new HashSet<String>(Arrays.asList(areasString.trim().split(
"(\\s)*,(\\s)*")));
} else {
- Set areasSet = new HashSet(5);
+ Set<String> areasSet = new HashSet<String>(5);
areasSet.add(areasString.trim());
return areasSet;
}
@@ -700,8 +694,8 @@
UIComponent component) throws IOException {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
ExternalContext externalContext = context.getExternalContext();
- Map requestMap = externalContext.getRequestMap();
- Set rendered = ajaxContext.getAjaxRenderedAreas();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+ Set<String> rendered = ajaxContext.getAjaxRenderedAreas();
StringBuffer senderString = new StringBuffer();
// write special area for list of rendered elements. Client-side
// Java
@@ -719,7 +713,7 @@
component);
out.writeAttribute(HTML.NAME_ATTRIBUTE,
AjaxContainerRenderer.AJAX_UPDATE_HEADER, null);
- for (Iterator it = rendered.iterator(); it.hasNext();) {
+ for (Iterator<String> it = rendered.iterator(); it.hasNext();) {
String id = (String) it.next();
// out.startElement(AJAX_RESULT_TAG, component);
// out.writeText(id,null);
@@ -779,12 +773,12 @@
Messages.OBTAIN_RESPONSE_SET_HEADER_ERROR, e));
}
}
- Map responseDataMap = ajaxContext.getResponseDataMap();
+ Map<String, Object> responseDataMap = ajaxContext.getResponseDataMap();
// Get data serializer instance
AJAXDataSerializer serializer = (AJAXDataSerializer) ServicesUtils
.getServiceInstance(AJAXDataSerializer.SERVICE);
// Put data to JavaScript handlers, inside <span> elements.
- for (Iterator dataIterator = responseDataMap.keySet().iterator(); dataIterator
+ for (Iterator<String> dataIterator = responseDataMap.keySet().iterator();
dataIterator
.hasNext();) {
Object dataKey = dataIterator.next();
out.startElement(HTML.SPAN_ELEM, component);
@@ -881,12 +875,12 @@
*/
private static void loadBundles(FacesContext context, UIComponent component) {
// Iterate over cildrens
- for (Iterator iter = component.getChildren().iterator(); iter.hasNext();) {
+ for (Iterator<UIComponent> iter = component.getChildren().iterator();
iter.hasNext();) {
UIComponent child = (UIComponent) iter.next();
loadCildBundles(context, child);
}
// Iterate over facets
- for (Iterator iter = component.getFacets().values().iterator(); iter
+ for (Iterator<UIComponent> iter = component.getFacets().values().iterator();
iter
.hasNext();) {
UIComponent child = (UIComponent) iter.next();
loadCildBundles(context, child);
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxViewRootRenderer.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxViewRootRenderer.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxViewRootRenderer.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -21,6 +21,8 @@
package org.ajax4jsf.renderkit;
+import javax.faces.component.UIComponent;
+
import org.ajax4jsf.component.AjaxViewRoot;
import org.ajax4jsf.resource.InternetResource;
@@ -67,7 +69,7 @@
*
* @see org.ajax4jsf.renderkit.AjaxContainerRenderer#getComponentClass()
*/
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return AjaxViewRoot.class;
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitFactory.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -125,7 +125,7 @@
/**
* @return
*/
- public Iterator getRenderKitIds() {
+ public Iterator<String> getRenderKitIds() {
return defaultFactory.getRenderKitIds();
}
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitImpl.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ChameleonRenderKitImpl.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -49,14 +49,14 @@
private RenderKit defaultRenderKit = null;
public static final String RENDER_KIT_ID = "AJAX_HTML_BASIC";
- private Map renderers;
+ private Map<String, Renderer> renderers;
//~ Constructors
-------------------------------------------------------------------------------
public ChameleonRenderKitImpl()
{
- renderers = new HashMap();
+ renderers = new HashMap<String, Renderer>();
}
//~ Methods
------------------------------------------------------------------------------------
@@ -73,7 +73,7 @@
public void addRenderer(String family, String rendererType,
Renderer renderer) {
if (renderer instanceof ChameleonRenderer) {
- ChameleonRenderer chameleonRenderer = (ChameleonRenderer) renderer;
+// ChameleonRenderer chameleonRenderer = (ChameleonRenderer) renderer;
// chameleonRenderer.setConfiguration(getConfiguration().getRendererConfiguration(family,rendererType));
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -24,11 +24,11 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import javax.el.MethodNotFoundException;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.faces.el.MethodNotFoundException;
import org.ajax4jsf.Messages;
import org.apache.commons.beanutils.MethodUtils;
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentVariables.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentVariables.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/ComponentVariables.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
+import java.util.Map;
/**
* storing tempates variables
@@ -32,7 +33,11 @@
*/
public class ComponentVariables implements Serializable {
- private transient HashMap variablesMap = new HashMap();
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4310787278096026676L;
+ private transient Map<String, Object> variablesMap = new HashMap<String,
Object>();
/**
* setting variable
@@ -88,6 +93,6 @@
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException{
- variablesMap = new HashMap();
+ variablesMap = new HashMap<String, Object>();
}
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -40,8 +40,8 @@
protected static final String[] EMPTY_ARRAY = {};
private InternetResource prototypeScript =
getResource(PrototypeScript.class.getName());
- public LinkedHashSet getHeaderScripts(FacesContext context, UIComponent component) {
- LinkedHashSet scripts = new LinkedHashSet() ; //
Collections.singleton(ajaxScript.getUri(context, null));
+ public LinkedHashSet<String> getHeaderScripts(FacesContext context, UIComponent
component) {
+ LinkedHashSet<String> scripts = new LinkedHashSet<String>() ; //
Collections.singleton(ajaxScript.getUri(context, null));
scripts.add(prototypeScript.getUri(context, null));
String[] additionalScripts = getAdditionalScripts();
for (int i = 0; i < additionalScripts.length; i++) {
@@ -54,7 +54,7 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.renderkit.HeaderResourceProducer#getHeaderStyles(javax.faces.context.FacesContext)
*/
- public LinkedHashSet getHeaderStyles(FacesContext context, UIComponent component) {
+ public LinkedHashSet<String> getHeaderStyles(FacesContext context, UIComponent
component) {
// TODO Auto-generated method stub
return null;
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-03-07
12:17:26 UTC (rev 6619)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -42,9 +42,6 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptString;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.compiler.TemplateContext;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.Java2Dresource;
@@ -67,7 +64,7 @@
/**
* Substitutions for components properies names and HTML attributes names.
*/
- private static Map substitutions = new HashMap();
+ private static Map<String, String> substitutions = new HashMap<String,
String>();
static {
substitutions.put(HTML.class_ATTRIBUTE, "styleClass");
@@ -357,7 +354,7 @@
public void encodePassThruWithExclusionsArray(FacesContext context,
UIComponent component, String[] exclusions) throws IOException {
ResponseWriter writer = context.getResponseWriter();
- Map attributes = component.getAttributes();
+ Map<String, Object> attributes = component.getAttributes();
Arrays.sort(exclusions);
for (int i = 0; i < HTML.PASS_THRU.length; i++) {
String attribute = HTML.PASS_THRU[i];
@@ -377,7 +374,7 @@
* @param attribute
* @throws IOException
*/
- public void encodePassThruAttribute(FacesContext context, Map attributes,
+ public void encodePassThruAttribute(FacesContext context, Map<String, Object>
attributes,
ResponseWriter writer, String attribute) throws IOException {
Object value = attributeValue(attribute, attributes
.get(getComponentAttributeName(attribute)));
@@ -396,7 +393,7 @@
public void encodeAttributesFromArray(FacesContext context,
UIComponent component, String[] attrs) throws IOException {
ResponseWriter writer = context.getResponseWriter();
- Map attributes = component.getAttributes();
+ Map<String, Object> attributes = component.getAttributes();
for (int i = 0; i < attrs.length; i++) {
String attribute = attrs[i];
encodePassThruAttribute(context, attributes, writer, attribute);
@@ -874,7 +871,7 @@
private UIComponent findUIComponentBelow(UIComponent root, String id) {
UIComponent target = null;
- for (Iterator iter = root.getFacetsAndChildren(); iter.hasNext();) {
+ for (Iterator<UIComponent> iter = root.getFacetsAndChildren(); iter.hasNext();)
{
UIComponent child = (UIComponent) iter.next();
if (child instanceof NamingContainer) {
try {
Added:
trunk/framework/impl/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java
===================================================================
---
trunk/framework/impl/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java
(rev 0)
+++
trunk/framework/impl/src/test/java/org/ajax4jsf/framework/util/javascript/ScriptUtilsTest.java 2008-03-07
12:17:43 UTC (rev 6620)
@@ -0,0 +1,218 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.framework.util.javascript;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.ajax4jsf.javascript.ScriptUtils;
+
+import junit.framework.TestCase;
+
+/**
+ * @author shura
+ *
+ */
+public class ScriptUtilsTest extends TestCase {
+
+ /**
+ * @author shura
+ *
+ */
+ public static class Bean {
+
+ int _integer;
+ boolean _bool;
+ Object _foo;
+
+ /**
+ *
+ */
+ public Bean() {
+ }
+ /**
+ * @param ineger
+ * @param bool
+ * @param foo
+ */
+ public Bean(int ineger, boolean bool, Object foo) {
+ this._integer = ineger;
+ this._bool = bool;
+ this._foo = foo;
+ }
+ /**
+ * @return the bool
+ */
+ public boolean isBool() {
+ return this._bool;
+ }
+ /**
+ * @param bool the bool to set
+ */
+ public void setBool(boolean bool) {
+ this._bool = bool;
+ }
+ /**
+ * @return the ineger
+ */
+ public int getInteger() {
+ return this._integer;
+ }
+ /**
+ * @param ineger the ineger to set
+ */
+ public void setInteger(int ineger) {
+ this._integer = ineger;
+ }
+ /**
+ * @return the foo
+ */
+ public Object getFoo() {
+ return this._foo;
+ }
+ /**
+ * @param foo the foo to set
+ */
+ public void setFoo(Object foo) {
+ this._foo = foo;
+ }
+
+ }
+
+ /**
+ * @param name
+ */
+ public ScriptUtilsTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testStringToScript() {
+ Object obj = "foo";
+ assertEquals("'foo'", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testArrayToScript() {
+ int[] obj = {1,2,3,4,5};
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testTwoDimentionalArrayToScript() {
+ int[][] obj = {{1,2},{3,4}};
+ assertEquals("[[1,2] ,[3,4] ] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testTwoDimentionalStringArrayToScript() {
+ String[][] obj =
{{"one","two"},{"three","four"}};
+ assertEquals("[['one','two'] ,['three','four'] ]
", ScriptUtils.toScript(obj));
+ Map map = new TreeMap();
+ map.put("a", obj);
+ map.put("b", "c");
+ assertEquals("{'a':[['one','two']
,['three','four'] ] ,'b':'c'} ",
ScriptUtils.toScript(map));
+ }
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testListToScript() {
+ List obj = new ArrayList();
+ obj.add(new Integer(1));
+ obj.add(new Integer(2));
+ obj.add(new Integer(3));
+ obj.add(new Integer(4));
+ obj.add(new Integer(5));
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testSetToScript() {
+ Set obj = new TreeSet();
+ obj.add(new Integer(1));
+ obj.add(new Integer(2));
+ obj.add(new Integer(3));
+ obj.add(new Integer(4));
+ obj.add(new Integer(5));
+ assertEquals("[1,2,3,4,5] ", ScriptUtils.toScript(obj));
+ }
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testObjectArrayToScript() {
+ Bean[] obj = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
+ assertEquals("[{'bool':true,'foo':'foo',\'integer\':1}
,{'bool':false,'foo':'bar','integer':2} ] ",
ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testObjectListToScript() {
+ Bean[] array = {new Bean(1,true,"foo"),new Bean(2,false,"bar")};
+ List obj = Arrays.asList(array);
+ assertEquals("[{'bool':true,'foo':'foo',\'integer\':1}
,{'bool':false,'foo':'bar','integer':2} ] ",
ScriptUtils.toScript(obj));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#toScript(java.lang.Object)}.
+ */
+ public void testMapToScript() {
+ TreeMap obj = new TreeMap();
+ obj.put("a", "foo");
+ obj.put("b", "bar");
+ obj.put("c", "baz");
+ assertEquals("{'a':'foo','b':'bar','c':'baz'}
", ScriptUtils.toScript(obj));
+ }
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#addEncodedString(java.lang.StringBuffer,
java.lang.Object)}.
+ */
+ public void testAddEncodedString() {
+ StringBuilder buff = new StringBuilder();
+ ScriptUtils.addEncodedString(buff, "foo");
+ assertEquals("'foo'", buff.toString());
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.javascript.ScriptUtils#addEncoded(java.lang.StringBuffer,
java.lang.Object)}.
+ */
+ public void testAddEncoded() {
+ StringBuilder buff = new StringBuilder();
+ ScriptUtils.addEncoded(buff, "foo\"\'");
+ assertEquals("foo\\\"\\\'", buff.toString());
+ }
+
+
+}