sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 23636 - http://anonsvn.icesoft.org/repo / icefaces2 / trunk / icefaces / compat / components / src / main / java / com / icesoft / faces / component / ext / renderkit / GroupRenderer.java
Unified Diff View - GroupRenderer.java
/icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/GroupRenderer.java @ revision 23635
/icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/GroupRenderer.java @ revision 23636
@@ -32,12 +32,12 @@ package com.icesoft.faces.component.ext.renderkit; +import com.icesoft.faces.component.ExtendedAttributeConstants; import com.icesoft.faces.component.dragdrop.DndEvent; import com.icesoft.faces.component.dragdrop.DragEvent; import com.icesoft.faces.component.dragdrop.DropEvent; import com.icesoft.faces.component.ext.HtmlPanelGroup; import com.icesoft.faces.component.menupopup.MenuPopupHelper; -import com.icesoft.faces.component.ExtendedAttributeConstants; import com.icesoft.faces.component.util.DelimitedProperties; import com.icesoft.faces.context.DOMContext; import com.icesoft.faces.context.effects.CurrentStyle; @@ -48,6 +48,7 @@ import com.icesoft.faces.renderkit.dom_html_basic.PassThruAttributeRenderer; import com.icesoft.faces.util.CoreUtils; import com.icesoft.faces.utils.DnDCache; +import com.icesoft.util.pooling.ClientIdPool; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; @@ -59,14 +60,9 @@ import javax.faces.context.FacesContext; import javax.faces.el.MethodBinding; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; -import com.icesoft.util.pooling.ClientIdPool; - public class GroupRenderer         extends com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer { @@ -78,16 +74,16 @@     // Basically, everything is excluded     private static final String[] PASSTHRU_EXCLUDE = -        new String[] { HTML.STYLE_ATTR }; - - +            new String[]{HTML.STYLE_ATTR}; + +     private static final String[] PASSTHRU_JS_EVENTS = LocalEffectEncoder.maskEvents(             ExtendedAttributeConstants.getAttributes( -                ExtendedAttributeConstants.ICE_PANELGROUP)); +                    ExtendedAttributeConstants.ICE_PANELGROUP));     private static final String[] passThruAttributes =             ExtendedAttributeConstants.getAttributes( -                ExtendedAttributeConstants.ICE_PANELGROUP, -                new String[][] {PASSTHRU_EXCLUDE, PASSTHRU_JS_EVENTS}); +                    ExtendedAttributeConstants.ICE_PANELGROUP, +                    new String[][]{PASSTHRU_EXCLUDE, PASSTHRU_JS_EVENTS});     public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)             throws IOException { @@ -112,9 +108,9 @@                     // Drag an drop needs some hidden fields                     UIComponent form = findForm(uiComponent);                     String formId = form.getClientId(facesContext); - -                    FormRenderer.addHiddenField(facesContext, ClientIdPool.get(formId+HIDDEN_FILED)); - + +                    FormRenderer.addHiddenField(facesContext, ClientIdPool.get(formId + HIDDEN_FILED)); +                 }             } @@ -125,24 +121,24 @@                         (HtmlPanelGroup) uiComponent, facesContext);                 StringBuffer dropCall = new StringBuffer();                 String call = addJavascriptCalls(uiComponent, dndType, null, facesContext, dropCall); - +                 String clientId = uiComponent.getClientId(facesContext);                 Element script = domContext.createElement(HTML.SCRIPT_ELEM); -                script.setAttribute(HTML.ID_ATTR, ClientIdPool.get(clientId+"script")); -                script.appendChild(domContext.createTextNode(dropCall.toString())); +                script.setAttribute(HTML.ID_ATTR, ClientIdPool.get(clientId + "script")); +                script.appendChild(domContext.createTextNodeUnescaped(dropCall.toString()));                 rootSpan.appendChild(script); -                Map rendererJavascriptDraggable =new HashMap(); +                Map rendererJavascriptDraggable = new HashMap();                 rendererJavascriptDraggable.put(HTML.ONMOUSEOUT_ATTR,                         "Ice.Scriptaculous.Draggable.removeMe(this.id);"); -                rendererJavascriptDraggable.put(HTML.ONMOUSEMOVE_ATTR, call ); -                rendererJavascriptDraggable.put(HTML.ONMOUSEOVER_ATTR, dropCall.toString()); - +                rendererJavascriptDraggable.put(HTML.ONMOUSEMOVE_ATTR, call); +                rendererJavascriptDraggable.put(HTML.ONMOUSEOVER_ATTR, dropCall.toString()); +                 LocalEffectEncoder.encode( -                        facesContext, uiComponent, PASSTHRU_JS_EVENTS, -                                    rendererJavascriptDraggable, rootSpan, null); +                        facesContext, uiComponent, PASSTHRU_JS_EVENTS, +                        rendererJavascriptDraggable, rootSpan, null);             } else {                 LocalEffectEncoder.encode( -                        facesContext, uiComponent, PASSTHRU_JS_EVENTS, null, rootSpan, null); +                        facesContext, uiComponent, PASSTHRU_JS_EVENTS, null, rootSpan, null);             } @@ -167,14 +163,14 @@                     extraStyle += "height:" + scrollHeight + ";overflow:auto;";                 } else {                     extraStyle += "width:" + scrollWidth + ";height:" + -                                  scrollHeight + ";overflow:auto;"; +                            scrollHeight + ";overflow:auto;";                 }             }             CurrentStyle.apply(facesContext, uiComponent, null, extraStyle);             MenuPopupHelper.renderMenuPopupHandler(facesContext, uiComponent, rootSpan); -            PassThruAttributeRenderer.renderNonBooleanHtmlAttributes(uiComponent, -                                            rootSpan, passThruAttributes); +            PassThruAttributeRenderer.renderNonBooleanHtmlAttributes(uiComponent, +                    rootSpan, passThruAttributes);             domContext.stepInto(uiComponent);             // domContext.stepOver();         } catch (Exception e) { @@ -211,8 +207,8 @@         if ("DRAG".equalsIgnoreCase(dndType)) {             calls += DragDrop.addDragable(uiComponent.getClientId(facesContext), -                                          handleId, dragOptions, dragMask, -                                          facesContext); +                    handleId, dragOptions, dragMask, +                    facesContext);         } else if ("drop".equalsIgnoreCase(dndType)) {             dropCall.append(DragDrop.addDroptarget( @@ -221,14 +217,14 @@         } else if ("dragdrop".equalsIgnoreCase(dndType)) {             calls += DragDrop.addDragable(uiComponent.getClientId(facesContext), -                                          handleId, dragOptions, dragMask, -                                          facesContext); +                    handleId, dragOptions, dragMask, +                    facesContext);             dropCall.append(DragDrop.addDroptarget(                     uiComponent, null, facesContext,                     dropMask, hoverClass));         } else {             throw new IllegalArgumentException("Value [" + dndType + -                                               "] is not valid for dndType. Please use drag or drop"); +                    "] is not valid for dndType. Please use drag or drop");         }         return calls;     } @@ -294,30 +290,30 @@                     System.out.println();                 } */ - +                 Map requestMap = context.getExternalContext().getRequestParameterMap(); - +                 UIComponent form = findForm(component);                 String formId = form.getClientId(context); -                String hdnFld = ClientIdPool.get(formId+HIDDEN_FILED); +                String hdnFld = ClientIdPool.get(formId + HIDDEN_FILED);                 if (!requestMap.containsKey(hdnFld)) return;                 String value = String.valueOf(requestMap.get(hdnFld));                 DelimitedProperties delimitedProperties = new DelimitedProperties(value); - +                 String fieldName = clientId + STATUS;                 String status = delimitedProperties.get(fieldName); - +                 if (status == null) {                     if (log.isTraceEnabled()) {                         log.trace("Drag Drop Status for ID [" + -                                  panel.getClientId(context) + -                                  "] Field Name [" + fieldName + -                                  "] is null. Returning"); +                                panel.getClientId(context) + +                                "] Field Name [" + fieldName + +                                "] is null. Returning");                     }                     return;                 }                 String targetID = delimitedProperties.get(clientId + DROP); - +                 Object targetDragValue = null;                 Object targetDropValue = null; @@ -325,8 +321,8 @@                     DnDCache dndCache = DnDCache.getInstance(context, false);                     if ("drop".equals(dndType)) {                         targetDragValue = dndCache.getDragValue(targetID); -                        targetDropValue = dndCache.getDropValue(panel.getClientId(context)); -                    } else { +                        targetDropValue = dndCache.getDropValue(panel.getClientId(context)); +                    } else {                         targetDragValue = dndCache.getDragValue(panel.getClientId(context));                         targetDropValue = dndCache.getDropValue(targetID);                     } @@ -334,8 +330,8 @@                 if (log.isTraceEnabled()) {                     log.trace("Dnd Event Client ID [" + -                              component.getClientId(context) + "] Target ID [" + -                              targetID + "] Status [" + status + "]"); +                            component.getClientId(context) + "] Target ID [" + +                            targetID + "] Status [" + status + "]");                 } @@ -353,7 +349,7 @@                     panel.getAttributes().put("dragged", Boolean.TRUE);                 }                 if (panel.getDragListener() == null && -                    panel.getDropListener() == null) { +                        panel.getDropListener() == null) {                     return;                 } @@ -361,16 +357,16 @@                 if (listener != null) {                     DragEvent event = new DragEvent(component, type, targetID, -                                                    targetDragValue, -                                                    targetDropValue); +                            targetDragValue, +                            targetDropValue);                     panel.queueEvent(event);                 }                 listener = panel.getDropListener();                 if (listener != null) {                     DropEvent event = new DropEvent(component, type, targetID, -                                                    targetDragValue, -                                                    targetDropValue); +                            targetDragValue, +                            targetDropValue);                     panel.queueEvent(event);                 }             } @@ -397,10 +393,10 @@         String formId = form.getClientId(facesContext);         String clientId = uiComponent.getClientId(facesContext);         return formId -               + NamingContainer.SEPARATOR_CHAR -               + UIViewRoot.UNIQUE_ID_PREFIX -               + clientId -               + name; +                + NamingContainer.SEPARATOR_CHAR +                + UIViewRoot.UNIQUE_ID_PREFIX +                + clientId +                + name;     }     protected String getDndType(UIComponent uiComponent) { @@ -410,7 +406,7 @@         String droppable =                 (String) uiComponent.getAttributes().get("dropTarget");         if ("true".equalsIgnoreCase(draggable) && -            "true".equalsIgnoreCase(droppable)) { +                "true".equalsIgnoreCase(droppable)) {             dndType = "dragdrop";         } else if ("true".equalsIgnoreCase(draggable)) {             dndType = "DRAG";


feed icon

sventon 2.5.1