You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/11/15 18:11:10 UTC

svn commit: r1542331 [26/28] - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/ tobago-core/src/main/java/org/apache/myfaces/tobago/application/ tobago-core/src/main/java/org/apache/myfaces/tobago/compat/ tobago-core/...

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Fri Nov 15 17:10:58 2013
@@ -80,8 +80,8 @@ public final class HtmlRendererUtils {
     if (ComponentUtils.isError(input)) {
       if (!FacesContext.getCurrentInstance().getExternalContext().getRequestMap().containsKey(ERROR_FOCUS_KEY)) {
         FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(ERROR_FOCUS_KEY, Boolean.TRUE);
-        TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-        String id = input.getClientId(facesContext);        
+        final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+        final String id = input.getClientId(facesContext);
         writer.writeJavascript("Tobago.errorFocusId = '" + id + "';");
         return true;
       } else {
@@ -91,8 +91,9 @@ public final class HtmlRendererUtils {
     return FacesContext.getCurrentInstance().getExternalContext().getRequestMap().containsKey(ERROR_FOCUS_KEY);
   }
 
-  public static void renderFocus(String clientId, boolean focus, boolean error, FacesContext facesContext,
-      TobagoResponseWriter writer) throws IOException {
+  public static void renderFocus(
+      final String clientId, final boolean focus, final boolean error, final FacesContext facesContext,
+      final TobagoResponseWriter writer) throws IOException {
     final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
     if (!requestMap.containsKey(FOCUS_KEY)
         && (clientId.equals(FacesContextUtils.getFocusId(facesContext)) || focus || error)) {
@@ -114,13 +115,13 @@ public final class HtmlRendererUtils {
       return;
     }
     if (ComponentUtils.getBooleanAttribute(component, Attributes.FOCUS)) {
-      UIPage page = (UIPage) ComponentUtils.findPage(facesContext, component);
-      String id = component.getClientId(facesContext);
+      final UIPage page = (UIPage) ComponentUtils.findPage(facesContext, component);
+      final String id = component.getClientId(facesContext);
       if (!StringUtils.isBlank(page.getFocusId()) && !page.getFocusId().equals(id)) {
         LOG.warn("page focusId = \"" + page.getFocusId() + "\" ignoring new value \""
             + id + "\"");
       } else {
-        TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+        final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
         writer.writeJavascript("Tobago.focusId = '" + id + "';");
       }
     }
@@ -130,20 +131,20 @@ public final class HtmlRendererUtils {
    * @deprecated Since Tobago 2.0.0
    */
   @Deprecated
-  public static void createCssClass(FacesContext facesContext, UIComponent component) {
-    String rendererName = getRendererName(facesContext, component);
+  public static void createCssClass(final FacesContext facesContext, final UIComponent component) {
+    final String rendererName = getRendererName(facesContext, component);
     Deprecation.LOG.error("Can't render style class for renderer " + rendererName);
   }
 
-  public static String getRendererName(FacesContext facesContext, UIComponent component) {
-    String rendererType = component.getRendererType();
+  public static String getRendererName(final FacesContext facesContext, final UIComponent component) {
+    final String rendererType = component.getRendererType();
     return rendererType.substring(0, 1).toLowerCase(Locale.ENGLISH) + rendererType.substring(1);
   }
 
-  public static void writeLabelWithAccessKey(TobagoResponseWriter writer, LabelWithAccessKey label)
+  public static void writeLabelWithAccessKey(final TobagoResponseWriter writer, final LabelWithAccessKey label)
       throws IOException {
-    int pos = label.getPos();
-    String text = label.getText();
+    final int pos = label.getPos();
+    final String text = label.getText();
     if (pos == -1) {
       writer.writeText(text);
     } else {
@@ -157,19 +158,19 @@ public final class HtmlRendererUtils {
 
   /** @deprecated since 1.5.7 and 2.0.0 */
   @Deprecated
-  public static void setDefaultTransition(FacesContext facesContext, boolean transition)
+  public static void setDefaultTransition(final FacesContext facesContext, final boolean transition)
       throws IOException {
     writeScriptLoader(facesContext, null, new String[]{"Tobago.transition = " + transition + ";"});
   }
 
   public static void addClickAcceleratorKey(
-      FacesContext facesContext, String clientId, char key)
+      final FacesContext facesContext, final String clientId, final char key)
       throws IOException {
     //addClickAcceleratorKey(facesContext, clientId, key, null);
   }
 
   public static void addClickAcceleratorKey(
-      FacesContext facesContext, String clientId, char key, String modifier)
+      final FacesContext facesContext, final String clientId, final char key, final String modifier)
       throws IOException {
     //String str
     //    = createOnclickAcceleratorKeyJsStatement(clientId, key, modifier);
@@ -177,26 +178,26 @@ public final class HtmlRendererUtils {
   }
 
   public static void addAcceleratorKey(
-      FacesContext facesContext, String func, char key) throws IOException {
+      final FacesContext facesContext, final String func, final char key) throws IOException {
     //addAcceleratorKey(facesContext, func, key, null);
   }
 
   public static void addAcceleratorKey(
-      FacesContext facesContext, String func, char key, String modifier)
+      final FacesContext facesContext, final String func, final char key, final String modifier)
       throws IOException {
-    String str = createAcceleratorKeyJsStatement(func, key, modifier);
+    final String str = createAcceleratorKeyJsStatement(func, key, modifier);
     writeScriptLoader(facesContext, null, new String[]{str});
   }
 
   public static String createOnclickAcceleratorKeyJsStatement(
-      String clientId, char key, String modifier) {
-    String func = "Tobago.clickOnElement('" + clientId + "');";
+      final String clientId, final char key, final String modifier) {
+    final String func = "Tobago.clickOnElement('" + clientId + "');";
     return createAcceleratorKeyJsStatement(func, key, modifier);
   }
 
   public static String createAcceleratorKeyJsStatement(
-      String func, char key, String modifier) {
-    StringBuilder buffer = new StringBuilder("new Tobago.AcceleratorKey(function() {");
+      final String func, final char key, final String modifier) {
+    final StringBuilder buffer = new StringBuilder("new Tobago.AcceleratorKey(function() {");
     buffer.append(func);
     if (!func.endsWith(";")) {
       buffer.append(';');
@@ -215,22 +216,23 @@ public final class HtmlRendererUtils {
    * @deprecated Please use setter;
    */
   @Deprecated
-  public static void removeStyleAttribute(UIComponent component, String name) {
+  public static void removeStyleAttribute(final UIComponent component, final String name) {
     Deprecation.LOG.error("HtmlRendererUtils.removeStyleAttribute() no longer supported. Use setter.");
   }
 
   @Deprecated
-  public static void createHeaderAndBodyStyles(FacesContext facesContext, UIComponent component) {
+  public static void createHeaderAndBodyStyles(final FacesContext facesContext, final UIComponent component) {
     Deprecation.LOG.error("HtmlRendererUtils.createHeaderAndBodyStyles() no longer supported");
   }
 
   @Deprecated
-  public static void createHeaderAndBodyStyles(FacesContext facesContext, UIComponent component, boolean width) {
+  public static void createHeaderAndBodyStyles(
+      final FacesContext facesContext, final UIComponent component, final boolean width) {
     Deprecation.LOG.error("HtmlRendererUtils.createHeaderAndBodyStyles() no longer supported");
   }
 
-  public static String createSrc(String src, String ext) {
-    int dot = src.lastIndexOf('.');
+  public static String createSrc(final String src, final String ext) {
+    final int dot = src.lastIndexOf('.');
     if (dot == -1) {
       LOG.warn("Image src without extension: '" + src + "'");
       return src;
@@ -239,9 +241,9 @@ public final class HtmlRendererUtils {
     }
   }
 
-  public static TobagoResponseWriter getTobagoResponseWriter(FacesContext facesContext) {
+  public static TobagoResponseWriter getTobagoResponseWriter(final FacesContext facesContext) {
 
-    ResponseWriter writer = facesContext.getResponseWriter();
+    final ResponseWriter writer = facesContext.getResponseWriter();
     if (writer instanceof TobagoResponseWriter) {
       return (TobagoResponseWriter) writer;
     } else {
@@ -253,7 +255,7 @@ public final class HtmlRendererUtils {
    * @deprecated Since Tobago 2.0.0. Because of CSP.
    */
   @Deprecated
-  public static void writeScriptLoader(FacesContext facesContext, String script)
+  public static void writeScriptLoader(final FacesContext facesContext, final String script)
       throws IOException {
     writeScriptLoader(facesContext, new String[]{script}, null);
   }
@@ -262,9 +264,10 @@ public final class HtmlRendererUtils {
    * @deprecated Since Tobago 2.0.0. Because of CSP.
    */
   @Deprecated
-  public static void writeScriptLoader(FacesContext facesContext, String[] scripts, String[] afterLoadCmds)
+  public static void writeScriptLoader(
+      final FacesContext facesContext, final String[] scripts, final String[] afterLoadCmds)
       throws IOException {
-    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
     if (scripts != null) {
       LOG.error("Scripts argument for writeScriptLoader not supported anymore!");
     }
@@ -272,7 +275,7 @@ public final class HtmlRendererUtils {
     if (scripts != null) {
       allScripts = ResourceManagerUtils.getScriptsAsJSArray(facesContext, scripts);
     }
-    boolean ajax = FacesContextUtils.isAjax(facesContext);
+    final boolean ajax = FacesContextUtils.isAjax(facesContext);
     writer.startJavascript();
     // XXX fix me if scripts != null
     if (ajax || scripts != null) {
@@ -288,9 +291,9 @@ public final class HtmlRendererUtils {
           writer.write("\n");
         }
         boolean first = true;
-        for (String afterLoadCmd : afterLoadCmds) {
-          String[] splittedStrings = StringUtils.split(afterLoadCmd, '\n'); // split on <CR> to have nicer JS
-          for (String splitted : splittedStrings) {
+        for (final String afterLoadCmd : afterLoadCmds) {
+          final String[] splittedStrings = StringUtils.split(afterLoadCmd, '\n'); // split on <CR> to have nicer JS
+          for (final String splitted : splittedStrings) {
             writer.write(first ? "          " : "        + ");
             writer.write("\"");
             String cmd = StringUtils.replace(splitted, "\\", "\\\\");
@@ -306,7 +309,7 @@ public final class HtmlRendererUtils {
       }
       writer.write(");");
     } else {
-    for (String afterLoadCmd : afterLoadCmds) {
+    for (final String afterLoadCmd : afterLoadCmds) {
       writer.write(afterLoadCmd);
     }
     }
@@ -318,8 +321,8 @@ public final class HtmlRendererUtils {
    */
   @Deprecated
   public static void writeStyleLoader(
-      FacesContext facesContext, String[] styles) throws IOException {
-    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+      final FacesContext facesContext, final String[] styles) throws IOException {
+    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     writer.startJavascript();
     writer.write("Tobago.ensureStyleFiles(");
@@ -328,12 +331,12 @@ public final class HtmlRendererUtils {
     writer.endJavascript();
   }
 
-  public static String getTitleFromTipAndMessages(FacesContext facesContext, UIComponent component) {
-    String messages = ComponentUtils.getFacesMessageAsString(facesContext, component);
+  public static String getTitleFromTipAndMessages(final FacesContext facesContext, final UIComponent component) {
+    final String messages = ComponentUtils.getFacesMessageAsString(facesContext, component);
     return HtmlRendererUtils.addTip(messages, component.getAttributes().get(Attributes.TIP));
   }
 
-  public static String addTip(String title, Object tip) {
+  public static String addTip(String title, final Object tip) {
     if (tip != null) {
       if (title != null && title.length() > 0) {
         title += " :: ";
@@ -345,26 +348,27 @@ public final class HtmlRendererUtils {
     return title;
   }
 
-  public static void renderSelectItems(UIInput component, List<SelectItem> items, Object[] values,
-      TobagoResponseWriter writer, FacesContext facesContext) throws IOException {
+  public static void renderSelectItems(final UIInput component, final List<SelectItem> items, final Object[] values,
+      final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
     renderSelectItems(component, items, values, null, writer, facesContext);
 
   }
 
-  public static void renderSelectItems(UIInput component, List<SelectItem> items, Object[] values, Boolean onlySelected,
-      TobagoResponseWriter writer, FacesContext facesContext) throws IOException {
+  public static void renderSelectItems(
+      final UIInput component, final List<SelectItem> items, final Object[] values, final Boolean onlySelected,
+      final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
 
     if (LOG.isDebugEnabled()) {
       LOG.debug("value = '" + Arrays.toString(values) + "'");
     }
-    for (SelectItem item : items) {
+    for (final SelectItem item : items) {
       if (item instanceof SelectItemGroup) {
         writer.startElement(HtmlElements.OPTGROUP, null);
         writer.writeAttribute(HtmlAttributes.LABEL, item.getLabel(), true);
         if (item.isDisabled()) {
           writer.writeAttribute(HtmlAttributes.DISABLED, true);
         }
-        SelectItem[] selectItems = ((SelectItemGroup) item).getSelectItems();
+        final SelectItem[] selectItems = ((SelectItemGroup) item).getSelectItems();
         renderSelectItems(component, Arrays.asList(selectItems), values, onlySelected, writer, facesContext);
         writer.endElement(HtmlElements.OPTGROUP);
       } else {
@@ -374,7 +378,7 @@ public final class HtmlRendererUtils {
         if (itemValue instanceof String && values != null && values.length > 0 && !(values[0] instanceof String)) {
           itemValue = ComponentUtils.getConvertedValue(facesContext, component, (String) itemValue);
         }
-        boolean contains = RenderUtils.contains(values, itemValue);
+        final boolean contains = RenderUtils.contains(values, itemValue);
         if (onlySelected != null) {
           if (onlySelected) {
             if (!contains) {
@@ -387,10 +391,10 @@ public final class HtmlRendererUtils {
           }
         }
         writer.startElement(HtmlElements.OPTION, null);
-        String formattedValue = RenderUtils.getFormattedValue(facesContext, component, itemValue);
+        final String formattedValue = RenderUtils.getFormattedValue(facesContext, component, itemValue);
         writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
         if (item instanceof org.apache.myfaces.tobago.model.SelectItem) {
-          String image = ((org.apache.myfaces.tobago.model.SelectItem) item).getImage();
+          final String image = ((org.apache.myfaces.tobago.model.SelectItem) item).getImage();
           if (image != null) {
             final Style style = new Style();
             style.setBackgroundImage("url('"
@@ -416,14 +420,15 @@ public final class HtmlRendererUtils {
     }
   }
 
-  public static String getComponentIds(FacesContext context, UIComponent component, String[] componentId) {
-    StringBuilder sb = new StringBuilder();
-    for (String id : componentId) {
+  public static String getComponentIds(
+      final FacesContext context, final UIComponent component, final String[] componentId) {
+    final StringBuilder sb = new StringBuilder();
+    for (final String id : componentId) {
       if (!StringUtils.isBlank(id)) {
         if (sb.length() > 0) {
           sb.append(",");
         }
-        String clientId = getComponentId(context, component, id);
+        final String clientId = getComponentId(context, component, id);
         if (clientId != null) {
           sb.append(clientId);
         }
@@ -433,11 +438,11 @@ public final class HtmlRendererUtils {
   }
 
   public static String[] getComponentIdsAsList(
-      FacesContext context, UIComponent component, String[] componentId) {
-    List<String> result = new ArrayList<String>(componentId.length);
-    for (String id : componentId) {
+      final FacesContext context, final UIComponent component, final String[] componentId) {
+    final List<String> result = new ArrayList<String>(componentId.length);
+    for (final String id : componentId) {
       if (!StringUtils.isBlank(id)) {
-        String clientId = getComponentId(context, component, id);
+        final String clientId = getComponentId(context, component, id);
         if (clientId != null) {
           result.add(clientId);
         }
@@ -446,12 +451,13 @@ public final class HtmlRendererUtils {
     return (String[]) result.toArray(new String[result.size()]);
   }
 
-  public static String getComponentId(FacesContext context, UIComponent component, String componentId) {
-    UIComponent partiallyComponent = ComponentUtils.findComponent(component, componentId);
+  public static String getComponentId(
+      final FacesContext context, final UIComponent component, final String componentId) {
+    final UIComponent partiallyComponent = ComponentUtils.findComponent(component, componentId);
     if (partiallyComponent != null) {
-      String clientId = partiallyComponent.getClientId(context);
+      final String clientId = partiallyComponent.getClientId(context);
       if (partiallyComponent instanceof UISheet) {
-        int rowIndex = ((UISheet) partiallyComponent).getRowIndex();
+        final int rowIndex = ((UISheet) partiallyComponent).getRowIndex();
         if (rowIndex >= 0 && clientId.endsWith(Integer.toString(rowIndex))) {
           return clientId.substring(0, clientId.lastIndexOf(UINamingContainer.getSeparatorChar(context)));
         }
@@ -466,8 +472,8 @@ public final class HtmlRendererUtils {
    * @deprecated since Tobago 1.5.0.
    */
   @Deprecated
-  public static String toStyleString(String key, Integer value) {
-    StringBuilder buf = new StringBuilder();
+  public static String toStyleString(final String key, final Integer value) {
+    final StringBuilder buf = new StringBuilder();
     buf.append(key);
     buf.append(":");
     buf.append(value);
@@ -479,8 +485,8 @@ public final class HtmlRendererUtils {
    * @deprecated since Tobago 1.5.0.
    */
   @Deprecated
-  public static String toStyleString(String key, String value) {
-    StringBuilder buf = new StringBuilder();
+  public static String toStyleString(final String key, final String value) {
+    final StringBuilder buf = new StringBuilder();
     buf.append(key);
     buf.append(":");
     buf.append(value);
@@ -492,10 +498,10 @@ public final class HtmlRendererUtils {
    * @deprecated since Tobago 1.5.0. Please use getTitleFromTipAndMessages and write it out.
    */
   @Deprecated
-  public static void renderTip(UIComponent component, TobagoResponseWriter writer) throws IOException {
-    Object objTip = component.getAttributes().get(Attributes.TIP);
+  public static void renderTip(final UIComponent component, final TobagoResponseWriter writer) throws IOException {
+    final Object objTip = component.getAttributes().get(Attributes.TIP);
     if (objTip != null) {
-      String tip = String.valueOf(objTip);
+      final String tip = String.valueOf(objTip);
       writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
     }
   }
@@ -503,37 +509,38 @@ public final class HtmlRendererUtils {
   /**
    * @deprecated since Tobago 1.5.0. Please use getTitleFromTipAndMessages and write it out.
    */
-  public static void renderImageTip(UIComponent component, TobagoResponseWriter writer) throws IOException {
-    Object objTip = component.getAttributes().get(Attributes.TIP);
+  public static void renderImageTip(final UIComponent component, final TobagoResponseWriter writer) throws IOException {
+    final Object objTip = component.getAttributes().get(Attributes.TIP);
     if (objTip != null) {
-      String tip = String.valueOf(objTip);
+      final String tip = String.valueOf(objTip);
       writer.writeAttribute(HtmlAttributes.ALT, tip, true);
     } else {
       writer.writeAttribute(HtmlAttributes.ALT, "", false);
     }
   }
 
-  public static String getJavascriptString(String str) {
+  public static String getJavascriptString(final String str) {
     if (str != null) {
       return "\"" + str + "\"";
     }
     return null;
   }
 
-  public static String getRenderedPartiallyJavascriptArray(FacesContext facesContext, UICommand command) {
+  public static String getRenderedPartiallyJavascriptArray(final FacesContext facesContext, final UICommand command) {
     if (command == null) {
       return null;
     }
     return getRenderedPartiallyJavascriptArray(facesContext, command, command);
   }
 
-  public static String getRenderedPartiallyJavascriptArray(FacesContext facesContext, UIComponent searchBase,
-      SupportsRenderedPartially supportsRenderedPartially) {
-    String[] list = supportsRenderedPartially.getRenderedPartially();
+  public static String getRenderedPartiallyJavascriptArray(
+      final FacesContext facesContext, final UIComponent searchBase,
+      final SupportsRenderedPartially supportsRenderedPartially) {
+    final String[] list = supportsRenderedPartially.getRenderedPartially();
     if (list == null || list.length == 0) {
       return null;
     }
-    StringBuilder strBuilder = new StringBuilder();
+    final StringBuilder strBuilder = new StringBuilder();
     strBuilder.append("[");
     for (int i = 0; i < list.length; i++) {
       if (i != 0) {
@@ -547,8 +554,8 @@ public final class HtmlRendererUtils {
     return strBuilder.toString();
   }
 
-  public static String getJavascriptArray(String[] list) {
-    StringBuilder strBuilder = new StringBuilder();
+  public static String getJavascriptArray(final String[] list) {
+    final StringBuilder strBuilder = new StringBuilder();
     strBuilder.append("[");
     for (int i = 0; i < list.length; i++) {
       if (i != 0) {
@@ -562,53 +569,69 @@ public final class HtmlRendererUtils {
     return strBuilder.toString();
   }
 
-  public static void renderDojoDndSource(FacesContext context, UIComponent component)
+  /**
+   * will be removed in later versions
+   * @deprecated since 2.0.0
+   */
+  @Deprecated
+  public static void renderDojoDndSource(final FacesContext context, final UIComponent component)
       throws IOException {
-    Object objDojoType = component.getAttributes().get("dojoType");
+    final Object objDojoType = component.getAttributes().get("dojoType");
     if (null != objDojoType && (objDojoType.equals("dojo.dnd.Source") || objDojoType.equals("dojo.dnd.Target"))) {
       FacesContextUtils.addOnloadScript(context, createDojoDndType(component,
           component.getClientId(context), String.valueOf(objDojoType)));
     }
   }
 
-  public static void renderDojoDndItem(UIComponent component, TobagoResponseWriter writer, boolean addStyle)
+  /**
+   * will be removed in later versions
+   * @deprecated since 2.0.0
+   */
+  @Deprecated
+  public static void renderDojoDndItem(
+      final UIComponent component, final TobagoResponseWriter writer, final boolean addStyle)
       throws IOException {
-    Object objDndType = component.getAttributes().get("dndType");
+    final Object objDndType = component.getAttributes().get("dndType");
     if (objDndType != null) {
       writer.writeAttribute("dndType", String.valueOf(objDndType), false);
     }
-    Object objDndData = component.getAttributes().get("dndData");
+    final Object objDndData = component.getAttributes().get("dndData");
     if (objDndData != null) {
       writer.writeAttribute("dndData", String.valueOf(objDndData), false);
     }
   }
 
-  private static String createDojoDndType(UIComponent component, String clientId, String dojoType) {
-    StringBuilder strBuilder = new StringBuilder();
+  /**
+   * will be removed in later versions
+   * @deprecated since 2.0.0
+   */
+  @Deprecated
+  public static String createDojoDndType(final UIComponent component, final String clientId, final String dojoType) {
+    final StringBuilder strBuilder = new StringBuilder();
     strBuilder.append("new ").append(dojoType).append("('").append(clientId).append("'");
-    StringBuilder parameter = new StringBuilder();
+    final StringBuilder parameter = new StringBuilder();
 
-    Object objHorizontal = component.getAttributes().get("horizontal");
+    final Object objHorizontal = component.getAttributes().get("horizontal");
     if (objHorizontal != null) {
       parameter.append("horizontal: ").append(String.valueOf(objHorizontal)).append(",");
     }
-    Object objCopyOnly = component.getAttributes().get("copyOnly");
+    final Object objCopyOnly = component.getAttributes().get("copyOnly");
     if (objCopyOnly != null) {
       parameter.append("copyOnly: ").append(String.valueOf(objCopyOnly)).append(",");
     }
-    Object objSkipForm = component.getAttributes().get("skipForm");
+    final Object objSkipForm = component.getAttributes().get("skipForm");
     if (objSkipForm != null) {
       parameter.append("skipForm: ").append(String.valueOf(objSkipForm)).append(",");
     }
-    Object objWithHandles = component.getAttributes().get("withHandles");
+    final Object objWithHandles = component.getAttributes().get("withHandles");
     if (objWithHandles != null) {
       parameter.append("withHandles: ").append(String.valueOf(objWithHandles)).append(",");
     }
-    Object objAccept = component.getAttributes().get("accept");
+    final Object objAccept = component.getAttributes().get("accept");
     if (objAccept != null) {
       String accept = null;
       if (objAccept instanceof String[]) {
-        String[] allowed = (String[]) objAccept;
+        final String[] allowed = (String[]) objAccept;
         if (allowed.length > 1) {
           // TODO replace this
           accept = "'" + allowed[0] + "'";
@@ -621,11 +644,11 @@ public final class HtmlRendererUtils {
       }
       parameter.append("accept: [").append(accept).append("],");
     }
-    Object objSingular = component.getAttributes().get("singular");
+    final Object objSingular = component.getAttributes().get("singular");
     if (objSingular != null) {
       parameter.append("singular: ").append(String.valueOf(objSingular)).append(",");
     }
-    Object objCreator = component.getAttributes().get("creator");
+    final Object objCreator = component.getAttributes().get("creator");
     if (objCreator != null) {
       parameter.append("creator: ").append(String.valueOf(objCreator)).append(",");
     }
@@ -637,27 +660,28 @@ public final class HtmlRendererUtils {
     return strBuilder.toString();
   }
 
-  public static void renderCommandFacet(UIComponent component, FacesContext facesContext,
-      TobagoResponseWriter writer) throws IOException {
+  public static void renderCommandFacet(final UIComponent component, final FacesContext facesContext,
+      final TobagoResponseWriter writer) throws IOException {
     renderCommandFacet(component, component.getClientId(facesContext), facesContext, writer);
   }
 
   public static void renderCommandFacet(
-      UIComponent component, String id, FacesContext facesContext, TobagoResponseWriter writer) throws IOException {
+      final UIComponent component, final String id, final FacesContext facesContext, final TobagoResponseWriter writer)
+      throws IOException {
     if (ComponentUtils.getBooleanAttribute(component, Attributes.READONLY)
         || ComponentUtils.getBooleanAttribute(component, Attributes.DISABLED)) {
       return;
     }
     CommandMap commandMap = null;
-    Map<String, UIComponent> facets = component.getFacets();
-    for (Map.Entry<String, UIComponent> entry : facets.entrySet()) {
-      UIComponent facetComponent = entry.getValue();
+    final Map<String, UIComponent> facets = component.getFacets();
+    for (final Map.Entry<String, UIComponent> entry : facets.entrySet()) {
+      final UIComponent facetComponent = entry.getValue();
       if (facetComponent.isRendered()
           && (facetComponent instanceof AbstractUICommand || facetComponent instanceof UIForm)) {
         if (commandMap == null) {
           commandMap = new CommandMap();
         }
-        String key = entry.getKey();
+        final String key = entry.getKey();
         commandMap.addCommand(key, new Command(facesContext, entry.getValue(), id));
       }
     }
@@ -666,16 +690,16 @@ public final class HtmlRendererUtils {
     }
   }
 
-  public static boolean renderSheetCommands(UISheet sheet, FacesContext facesContext,
-                                         TobagoResponseWriter writer) throws IOException {
+  public static boolean renderSheetCommands(final UISheet sheet, final FacesContext facesContext,
+                                         final TobagoResponseWriter writer) throws IOException {
     CommandMap commandMap = null;
-    for (UIComponent child : sheet.getChildren()) {
+    for (final UIComponent child : sheet.getChildren()) {
       if (child instanceof UIColumnEvent) {
-        UIColumnEvent columnEvent = (UIColumnEvent) child;
+        final UIColumnEvent columnEvent = (UIColumnEvent) child;
         if (columnEvent.isRendered()) {
-          UIComponent selectionChild = child.getChildren().get(0);
+          final UIComponent selectionChild = child.getChildren().get(0);
           if (selectionChild != null && selectionChild instanceof AbstractUICommand && selectionChild.isRendered()) {
-            UICommand action = (UICommand) selectionChild;
+            final UICommand action = (UICommand) selectionChild;
             if (commandMap == null) {
               commandMap = new CommandMap();
             }
@@ -692,19 +716,21 @@ public final class HtmlRendererUtils {
   }
 
 
-  public static void checkForCommandFacet(UIComponent component, FacesContext facesContext, TobagoResponseWriter writer)
+  public static void checkForCommandFacet(
+      final UIComponent component, final FacesContext facesContext, final TobagoResponseWriter writer)
       throws IOException {
     checkForCommandFacet(component, Arrays.asList(component.getClientId(facesContext)), facesContext, writer);
   }
 
-  public static void checkForCommandFacet(UIComponent component, List<String> clientIds, FacesContext facesContext,
-      TobagoResponseWriter writer) throws IOException {
+  public static void checkForCommandFacet(
+      final UIComponent component, final List<String> clientIds, final FacesContext facesContext,
+      final TobagoResponseWriter writer) throws IOException {
     if (ComponentUtils.getBooleanAttribute(component, Attributes.READONLY)
         || ComponentUtils.getBooleanAttribute(component, Attributes.DISABLED)) {
       return;
     }
-    Map<String, UIComponent> facets = component.getFacets();
-    for (Map.Entry<String, UIComponent> entry : facets.entrySet()) {
+    final Map<String, UIComponent> facets = component.getFacets();
+    for (final Map.Entry<String, UIComponent> entry : facets.entrySet()) {
       if (entry.getValue() instanceof UICommand) {
         addCommandFacet(clientIds, entry, facesContext, writer);
       }
@@ -712,10 +738,10 @@ public final class HtmlRendererUtils {
   }
 
   private static void addCommandFacet(
-      List<String> clientIds, Map.Entry<String, UIComponent> facetEntry,
-      FacesContext facesContext, TobagoResponseWriter writer)
+      final List<String> clientIds, final Map.Entry<String, UIComponent> facetEntry,
+      final FacesContext facesContext, final TobagoResponseWriter writer)
       throws IOException {
-    for (String clientId : clientIds) {
+    for (final String clientId : clientIds) {
       writeScriptForClientId(clientId, facetEntry, facesContext, writer);
     }
   }
@@ -725,8 +751,8 @@ public final class HtmlRendererUtils {
    */
   @Deprecated
   private static void writeScriptForClientId(
-      String clientId, Map.Entry<String, UIComponent> facetEntry,
-      FacesContext facesContext, TobagoResponseWriter writer) throws IOException {
+      final String clientId, final Map.Entry<String, UIComponent> facetEntry,
+      final FacesContext facesContext, final TobagoResponseWriter writer) throws IOException {
     if (facetEntry.getValue() instanceof UICommand
         && ((UICommand) facetEntry.getValue()).getRenderedPartially().length > 0) {
       writer.startJavascript();
@@ -745,7 +771,7 @@ public final class HtmlRendererUtils {
       writer.write("};");
       writer.endJavascript();
     } else {
-      UIComponent facetComponent = facetEntry.getValue();
+      final UIComponent facetComponent = facetEntry.getValue();
 
       writer.startJavascript();
       writer.write("var element = Tobago.element(\"");
@@ -775,8 +801,9 @@ public final class HtmlRendererUtils {
    * @deprecated since 2.0.0. JavaScript should not be rendered in the page. See CSP.
    */
   @Deprecated
-  public static String createSubmitAction(String clientId, boolean transition, String target, String focus) {
-    StringBuilder builder = new StringBuilder();
+  public static String createSubmitAction(
+      final String clientId, final boolean transition, final String target, final String focus) {
+    final StringBuilder builder = new StringBuilder();
     builder.append("Tobago.submitAction(this,'");
     builder.append(clientId);
     builder.append("',{");
@@ -807,11 +834,12 @@ public final class HtmlRendererUtils {
    * @deprecated since Tobago 1.5.0. Please use {@link org.apache.myfaces.tobago.renderkit.css.Classes}.
    */
   @Deprecated
-  public static void removeStyleClasses(UIComponent cell) {
+  public static void removeStyleClasses(final UIComponent cell) {
     Deprecation.LOG.warn("cell = '" + cell + "'");
   }
 
-  public static void encodeContextMenu(FacesContext facesContext, TobagoResponseWriter writer, UIComponent parent)
+  public static void encodeContextMenu(
+      final FacesContext facesContext, final TobagoResponseWriter writer, final UIComponent parent)
       throws IOException {
     final UIComponent contextMenu = FacetUtils.getContextMenu(parent);
     if (contextMenu != null) {
@@ -822,14 +850,15 @@ public final class HtmlRendererUtils {
     }
   }
 
-    public static void addAcceleratorKey(FacesContext facesContext, UIComponent component, Character accessKey) {
-      String clientId = component.getClientId(facesContext);
-      String jsStatement = createOnclickAcceleratorKeyJsStatement(clientId, accessKey, null);
-      FacesContextUtils.addMenuAcceleratorScript(facesContext, jsStatement);
-    }
+  public static void addAcceleratorKey(
+      final FacesContext facesContext, final UIComponent component, final Character accessKey) {
+    final String clientId = component.getClientId(facesContext);
+    final String jsStatement = createOnclickAcceleratorKeyJsStatement(clientId, accessKey, null);
+    FacesContextUtils.addMenuAcceleratorScript(facesContext, jsStatement);
+  }
 
   public static void writeDataAttributes(
-      FacesContext context, TobagoResponseWriter writer, UIComponent component)
+      final FacesContext context, final TobagoResponseWriter writer, final UIComponent component)
       throws IOException {
 
     final Map<Object, Object> dataAttributes = ComponentUtils.getDataAttributes(component);
@@ -839,7 +868,7 @@ public final class HtmlRendererUtils {
 
     final ELContext elContext = context.getELContext();
 
-    for (Map.Entry<Object, Object> entry : dataAttributes.entrySet()) {
+    for (final Map.Entry<Object, Object> entry : dataAttributes.entrySet()) {
       final Object mapKey = entry.getKey();
       final String name = mapKey instanceof ValueExpression
           ? ((ValueExpression) mapKey).getValue(elContext).toString() : mapKey.toString();

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java Fri Nov 15 17:10:58 2013
@@ -29,14 +29,12 @@ import org.apache.myfaces.tobago.layout.
 import org.apache.myfaces.tobago.model.ExpandedState;
 import org.apache.myfaces.tobago.model.SelectedState;
 import org.apache.myfaces.tobago.model.TreePath;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.util.DebugUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,7 +56,6 @@ import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -78,11 +75,11 @@ public class RenderUtils {
     // to prevent instantiation
   }
 
-  public static boolean contains(Object[] list, Object value) {
+  public static boolean contains(final Object[] list, final Object value) {
     if (list == null) {
       return false;
     }
-    for (Object aList : list) {
+    for (final Object aList : list) {
       if (aList != null && aList.equals(value)) {
         return true;
       }
@@ -90,18 +87,19 @@ public class RenderUtils {
     return false;
   }
 
-  public static void encodeChildren(FacesContext facesContext, UIComponent panel) throws IOException {
-    for (UIComponent child : panel.getChildren()) {
+  public static void encodeChildren(final FacesContext facesContext, final UIComponent panel) throws IOException {
+    for (final UIComponent child : panel.getChildren()) {
       encode(facesContext, child);
     }
   }
 
-  public static void encode(FacesContext facesContext, UIComponent component) throws IOException {
+  public static void encode(final FacesContext facesContext, final UIComponent component) throws IOException {
     encode(facesContext, component, null);
   }
 
   public static void encode(
-      FacesContext facesContext, UIComponent component, List<? extends Class<? extends UIComponent>> only)
+      final FacesContext facesContext, final UIComponent component,
+      final List<? extends Class<? extends UIComponent>> only)
       throws IOException {
 
     if (only != null && !matchFilter(component, only)) {
@@ -116,7 +114,7 @@ public class RenderUtils {
       if (component.getRendersChildren()) {
         component.encodeChildren(facesContext);
       } else {
-        for (UIComponent child : component.getChildren()) {
+        for (final UIComponent child : component.getChildren()) {
           encode(facesContext, child, only);
         }
       }
@@ -124,8 +122,9 @@ public class RenderUtils {
     }
   }
 
-  private static boolean matchFilter(UIComponent component, List<? extends Class<? extends UIComponent>> only) {
-    for (Class<? extends UIComponent> clazz : only) {
+  private static boolean matchFilter(
+      final UIComponent component, final List<? extends Class<? extends UIComponent>> only) {
+    for (final Class<? extends UIComponent> clazz : only) {
       if (clazz.isAssignableFrom(component.getClass())) {
         return true;
       }
@@ -133,29 +132,16 @@ public class RenderUtils {
     return false;
   }
 
-  public static void prepareRendererAll(FacesContext facesContext, UIComponent component) throws IOException {
-    if (!component.isRendered()) {
-      return;
-    }
-    RendererBase renderer = ComponentUtils.getRenderer(facesContext, component);
-    boolean prepareRendersChildren = false;
-    if (renderer != null) {
-      renderer.prepareRender(facesContext, component);
-      prepareRendersChildren = renderer.getPrepareRendersChildren();
-    }
-    if (prepareRendersChildren) {
-      renderer.prepareRendersChildren(facesContext, component);
-    } else {
-      Iterator it = component.getFacetsAndChildren();
-      while (it.hasNext()) {
-        UIComponent child = (UIComponent) it.next();
-        prepareRendererAll(facesContext, child);
-      }
-    }
+  /**
+   * @deprecated since 2.0.0, please use EncodeUtils.prepareRendererAll()
+   */
+  @Deprecated
+  public static void prepareRendererAll(final FacesContext facesContext, final UIComponent component)
+      throws IOException {
+    EncodeUtils.prepareRendererAll(facesContext, component);
   }
 
-  public static String getFormattedValue(
-      FacesContext facesContext, UIComponent component) {
+  public static String getFormattedValue(final FacesContext facesContext, final UIComponent component) {
     Object value = null;
     if (component instanceof ValueHolder) {
       value = ((ValueHolder) component).getLocalValue();
@@ -168,7 +154,7 @@ public class RenderUtils {
 
   // Copy from RendererBase
   public static String getFormattedValue(
-      FacesContext context, UIComponent component, Object currentValue)
+      final FacesContext context, final UIComponent component, final Object currentValue)
       throws ConverterException {
 
     if (currentValue == null) {
@@ -185,7 +171,7 @@ public class RenderUtils {
       if (currentValue instanceof String) {
         return (String) currentValue;
       }
-      Class converterType = currentValue.getClass();
+      final Class converterType = currentValue.getClass();
       converter = context.getApplication().createConverter(converterType);
     }
 
@@ -196,16 +182,18 @@ public class RenderUtils {
     }
   }
 
-  public static Measure calculateStringWidth(FacesContext facesContext, UIComponent component, String text) {
+  public static Measure calculateStringWidth(
+      final FacesContext facesContext, final UIComponent component, final String text) {
     return calculateStringWidth(facesContext, (Configurable) component, text, "tobago.font.widths");
   }
 
-  public static Measure calculateStringWidth2(FacesContext facesContext, UIComponent component, String text) {
+  public static Measure calculateStringWidth2(
+      final FacesContext facesContext, final UIComponent component, final String text) {
     return calculateStringWidth(facesContext, (Configurable) component, text, "tobago.font2.widths");
   }
 
   private static Measure calculateStringWidth(
-      FacesContext facesContext, Configurable component, String text, String type) {
+      final FacesContext facesContext, final Configurable component, final String text, final String type) {
     if (text == null) {
       return Measure.ZERO;
     }
@@ -213,15 +201,15 @@ public class RenderUtils {
     int defaultCharWidth = 10;
     try {
       defaultCharWidth = ResourceManagerUtils.getThemeMeasure(facesContext, component, "fontWidth").getPixel();
-    } catch (NullPointerException e) {
+    } catch (final NullPointerException e) {
       LOG.warn("no value for 'fontWidth' for type '" + component.getRendererType() + "' found in theme-config");
     }
 
-    String fontWidths = ResourceManagerUtils.getProperty(facesContext, "tobago", type);
+    final String fontWidths = ResourceManagerUtils.getProperty(facesContext, "tobago", type);
 
-    for (char c : text.toCharArray()) {
+    for (final char c : text.toCharArray()) {
       if (c >= 32 && c < 128) { // "normal" char in precomputed range
-        int begin = (c - 32) * 2;
+        final int begin = (c - 32) * 2;
         width += Integer.parseInt(fontWidths.substring(begin, begin + 2), 16);
       } else {
         width += defaultCharWidth;
@@ -233,17 +221,17 @@ public class RenderUtils {
     return Measure.valueOf(width);
   }
 
-  public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectOne component) {
+  public static List<SelectItem> getItemsToRender(final javax.faces.component.UISelectOne component) {
     return getItems(component);
   }
 
-  public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectMany component) {
+  public static List<SelectItem> getItemsToRender(final javax.faces.component.UISelectMany component) {
     return getItems(component);
   }
 
-  public static List<SelectItem> getItems(javax.faces.component.UIInput component) {
+  public static List<SelectItem> getItems(final javax.faces.component.UIInput component) {
 
-    List<SelectItem> selectItems = getSelectItems(component);
+    final List<SelectItem> selectItems = getSelectItems(component);
 
     String renderRange = (String) component.getAttributes().get(Attributes.RENDER_RANGE_EXTERN);
     if (renderRange == null) {
@@ -253,11 +241,11 @@ public class RenderUtils {
       return selectItems;
     }
 
-    int[] indices = StringUtils.getIndices(renderRange);
-    List<SelectItem> items = new ArrayList<SelectItem>(indices.length);
+    final int[] indices = StringUtils.getIndices(renderRange);
+    final List<SelectItem> items = new ArrayList<SelectItem>(indices.length);
 
     if (selectItems.size() != 0) {
-      for (int indice : indices) {
+      for (final int indice : indices) {
         items.add(selectItems.get(indice));
       }
     } else {
@@ -269,7 +257,7 @@ public class RenderUtils {
     return items;
   }
 
-  public static String currentValue(UIComponent component) {
+  public static String currentValue(final UIComponent component) {
     String currentValue = null;
     if (component instanceof ValueHolder) {
       Object value;
@@ -284,7 +272,7 @@ public class RenderUtils {
       if (value != null) {
         Converter converter = ((ValueHolder) component).getConverter();
         if (converter == null) {
-          FacesContext context = FacesContext.getCurrentInstance();
+          final FacesContext context = FacesContext.getCurrentInstance();
           converter = context.getApplication().createConverter(value.getClass());
         }
         if (converter != null) {
@@ -299,19 +287,19 @@ public class RenderUtils {
     return currentValue;
   }
 
-  public static List<SelectItem> getSelectItems(UIComponent component) {
+  public static List<SelectItem> getSelectItems(final UIComponent component) {
 
-    ArrayList<SelectItem> list = new ArrayList<SelectItem>();
+    final ArrayList<SelectItem> list = new ArrayList<SelectItem>();
 
-    for (UIComponent child : component.getChildren()) {
+    for (final UIComponent child : component.getChildren()) {
       if (LOG.isDebugEnabled()) {
         LOG.debug("kid " + child);
         LOG.debug("kid " + child.getClass().getName());
       }
       if (child instanceof UISelectItem) {
-        Object value = ((UISelectItem) child).getValue();
+        final Object value = ((UISelectItem) child).getValue();
         if (value == null) {
-          UISelectItem item = (UISelectItem) child;
+          final UISelectItem item = (UISelectItem) child;
           if (child instanceof org.apache.myfaces.tobago.component.UISelectItem) {
             list.add(getSelectItem(
                 (org.apache.myfaces.tobago.component.UISelectItem) child));
@@ -330,7 +318,7 @@ public class RenderUtils {
           DebugUtils.addDevelopmentMessage(FacesContext.getCurrentInstance(), message);
         }
       } else if (child instanceof UISelectItems) {
-        Object value = ((UISelectItems) child).getValue();
+        final Object value = ((UISelectItems) child).getValue();
         if (LOG.isDebugEnabled()) {
           LOG.debug("value " + value);
           if (value != null) {
@@ -344,16 +332,16 @@ public class RenderUtils {
         } else if (value instanceof SelectItem) {
           list.add((SelectItem) value);
         } else if (value instanceof SelectItem[]) {
-          SelectItem[] items = (SelectItem[]) value;
+          final SelectItem[] items = (SelectItem[]) value;
           list.addAll(Arrays.asList(items));
         } else if (value instanceof Collection) {
-          for (Object o : ((Collection) value)) {
+          for (final Object o : ((Collection) value)) {
             list.add((SelectItem) o);
           }
         } else if (value instanceof Map) {
-          for (Object key : ((Map) value).keySet()) {
+          for (final Object key : ((Map) value).keySet()) {
             if (key != null) {
-              Object val = ((Map) value).get(key);
+              final Object val = ((Map) value).get(key);
               if (val != null) {
                 list.add(new SelectItem(val.toString(), key.toString(), null));
               }
@@ -372,7 +360,7 @@ public class RenderUtils {
     return list;
   }
 
-  private static SelectItem getSelectItem(org.apache.myfaces.tobago.component.UISelectItem component) {
+  private static SelectItem getSelectItem(final org.apache.myfaces.tobago.component.UISelectItem component) {
     return
         new org.apache.myfaces.tobago.model.SelectItem(component.getItemValue() == null ? "" : component.getItemValue(),
             component.getItemLabel(), component.getItemDescription(),
@@ -380,7 +368,7 @@ public class RenderUtils {
   }
 
 
-  public static void decodedStateOfTreeData(FacesContext facesContext, AbstractUIData data) {
+  public static void decodedStateOfTreeData(final FacesContext facesContext, final AbstractUIData data) {
 
     if (!data.isTreeModel()) {
       return;
@@ -402,16 +390,16 @@ public class RenderUtils {
       final TreePath path = data.getPath();
 
       // selected
-        final SelectedState selectedState = data.getSelectedState();
-        final boolean oldSelected = selectedState.isSelected(path);
-        final boolean newSelected = selectedIndices.contains(rowIndex);
-        if (newSelected != oldSelected) {
-          if (newSelected) {
-            selectedState.select(path);
-          } else {
-            selectedState.unselect(path);
-          }
+      final SelectedState selectedState = data.getSelectedState();
+      final boolean oldSelected = selectedState.isSelected(path);
+      final boolean newSelected = selectedIndices.contains(rowIndex);
+      if (newSelected != oldSelected) {
+        if (newSelected) {
+          selectedState.select(path);
+        } else {
+          selectedState.unselect(path);
         }
+      }
 
       // expanded
       if (expandedIndices != null) {
@@ -431,7 +419,8 @@ public class RenderUtils {
     data.setRowIndex(-1);
   }
 
-  private static List<Integer> decodeIndices(FacesContext facesContext, AbstractUIData data, String suffix) {
+  private static List<Integer> decodeIndices(
+      final FacesContext facesContext, final AbstractUIData data, final String suffix) {
     String string = null;
     final String key = data.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + suffix;
     try {
@@ -439,25 +428,27 @@ public class RenderUtils {
       if (string != null) {
         return StringUtils.parseIntegerList(string);
       }
-    } catch (Exception e) {
+    } catch (final Exception e) {
       // should not happen
       LOG.warn("Can't parse " + suffix + ": '" + string + "' from parameter '" + key + "'", e);
     }
     return null;
   }
 
-  public static void writeScrollPosition(FacesContext facesContext, TobagoResponseWriter writer, UIComponent component)
+  public static void writeScrollPosition(
+      final FacesContext facesContext, final TobagoResponseWriter writer, final UIComponent component)
       throws IOException {
     Integer[] scrollPosition = (Integer[]) component.getAttributes().get(Attributes.SCROLL_POSITION);
     if (scrollPosition == null) {
       final String key = component.getClientId(facesContext) + SCROLL_POSTFIX;
       scrollPosition = parseScrollPosition(facesContext.getExternalContext().getRequestParameterMap().get(key));
     }
-    writeScrollPosition(facesContext,  writer, component, scrollPosition);
+    writeScrollPosition(facesContext, writer, component, scrollPosition);
   }
-  
+
   public static void writeScrollPosition(
-      FacesContext facesContext, TobagoResponseWriter writer, UIComponent component, Integer[] scrollPosition)
+      final FacesContext facesContext, final TobagoResponseWriter writer, final UIComponent component,
+      final Integer[] scrollPosition)
       throws IOException {
     final String clientId = component.getClientId(facesContext);
     writer.startElement(HtmlElements.INPUT, null);
@@ -465,7 +456,7 @@ public class RenderUtils {
     writer.writeNameAttribute(clientId + SCROLL_POSTFIX);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
     if (scrollPosition != null) {
-      String scroll = scrollPosition[0] + ";" + scrollPosition[1];
+      final String scroll = scrollPosition[0] + ";" + scrollPosition[1];
       writer.writeAttribute(HtmlAttributes.VALUE, scroll, false);
     } else {
       writer.writeAttribute(HtmlAttributes.VALUE, "", false);
@@ -474,11 +465,11 @@ public class RenderUtils {
     writer.endElement(HtmlElements.INPUT);
   }
 
-  public static void decodeScrollPosition(FacesContext facesContext, UIComponent component) {
-    String key = component.getClientId(facesContext) + SCROLL_POSTFIX;
-    String value = facesContext.getExternalContext().getRequestParameterMap().get(key);
+  public static void decodeScrollPosition(final FacesContext facesContext, final UIComponent component) {
+    final String key = component.getClientId(facesContext) + SCROLL_POSTFIX;
+    final String value = facesContext.getExternalContext().getRequestParameterMap().get(key);
     if (value != null) {
-      Integer[] scrollPosition = parseScrollPosition(value);
+      final Integer[] scrollPosition = parseScrollPosition(value);
       if (scrollPosition != null) {
         //noinspection unchecked
         component.getAttributes().put(Attributes.SCROLL_POSITION, scrollPosition);
@@ -486,18 +477,18 @@ public class RenderUtils {
     }
   }
 
-  public static Integer[] parseScrollPosition(String value) {
+  public static Integer[] parseScrollPosition(final String value) {
     Integer[] position = null;
     if (!StringUtils.isBlank(value)) {
-      int sep = value.indexOf(";");
+      final int sep = value.indexOf(";");
       if (LOG.isInfoEnabled()) {
         LOG.info("value = \"" + value + "\"  sep = " + sep + "");
       }
       if (sep == -1) {
         throw new NumberFormatException(value);
       }
-      int left = Integer.parseInt(value.substring(0, sep));
-      int top = Integer.parseInt(value.substring(sep + 1));
+      final int left = Integer.parseInt(value.substring(0, sep));
+      final int top = Integer.parseInt(value.substring(sep + 1));
       position = new Integer[2];
       position[0] = left;
       position[1] = top;
@@ -505,7 +496,7 @@ public class RenderUtils {
     return position;
   }
 
-  public static String generateUrl(FacesContext facesContext, AbstractUICommandBase component) {
+  public static String generateUrl(final FacesContext facesContext, final AbstractUICommandBase component) {
 
     final Application application = facesContext.getApplication();
     final ViewHandler viewHandler = application.getViewHandler();
@@ -514,7 +505,7 @@ public class RenderUtils {
     String url = null;
 
     if (component.getResource() != null) {
-      boolean jsfResource = component.isJsfResource();
+      final boolean jsfResource = component.isJsfResource();
       url = ResourceManagerUtils.getPageWithoutContextPath(facesContext, component.getResource());
       if (url != null) {
         if (jsfResource) {
@@ -529,7 +520,7 @@ public class RenderUtils {
       }
     } else if (component.getLink() != null) {
 
-      String link = component.getLink();
+      final String link = component.getLink();
       if (link.startsWith("/")) { // internal absolute link
         url = viewHandler.getActionURL(facesContext, link);
         url = externalContext.encodeActionURL(url);
@@ -539,11 +530,11 @@ public class RenderUtils {
         url = externalContext.encodeResourceURL(link);
       }
 
-      StringBuilder builder = new StringBuilder(url);
+      final StringBuilder builder = new StringBuilder(url);
       boolean firstParameter = !url.contains("?");
-      for (UIComponent child : component.getChildren()) {
+      for (final UIComponent child : component.getChildren()) {
         if (child instanceof UIParameter) {
-          UIParameter parameter = (UIParameter) child;
+          final UIParameter parameter = (UIParameter) child;
           if (firstParameter) {
             builder.append("?");
             firstParameter = false;
@@ -552,7 +543,7 @@ public class RenderUtils {
           }
           builder.append(parameter.getName());
           builder.append("=");
-          Object value = parameter.getValue();
+          final Object value = parameter.getValue();
           // TODO encoding
           builder.append(value != null ? URLDecoder.decode(value.toString()) : null);
         }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/html/JsonUtilsUnitTest.java Fri Nov 15 17:10:58 2013
@@ -34,13 +34,13 @@ public class JsonUtilsUnitTest extends A
 
   @Test
   public void empty() {
-    CommandMap map = new CommandMap();
+    final CommandMap map = new CommandMap();
     Assert.assertEquals("{}", JsonUtils.encode(map));
   }
 
   @Test
   public void click() {
-    CommandMap map = new CommandMap();
+    final CommandMap map = new CommandMap();
     map.setClick(new Command(null, null, null, null, new String[0], null, null, null, null, null));
     final String expected = "{'click':{}}".replaceAll("'", "\"");
     Assert.assertEquals(expected, JsonUtils.encode(map));
@@ -48,7 +48,7 @@ public class JsonUtilsUnitTest extends A
 
   @Test
   public void change() {
-    CommandMap map = new CommandMap();
+    final CommandMap map = new CommandMap();
     map.addCommand("change", new Command(null, null, null, null, new String[0], null, null, null, null, null));
     final String expected = "{'change':{}}".replaceAll("'", "\"");
     Assert.assertEquals(expected, JsonUtils.encode(map));
@@ -56,7 +56,7 @@ public class JsonUtilsUnitTest extends A
 
   @Test
   public void two() {
-    CommandMap map = new CommandMap();
+    final CommandMap map = new CommandMap();
     map.addCommand("click", new Command(null, null, "target", null, new String[0], null, null, null, null, null));
     map.addCommand("change", new Command(null, null, null, null, new String[0], null, null, null, null, null));
     final String expected = "{'click':{'target':'target'},'change':{}}".replaceAll("'", "\"");
@@ -65,7 +65,7 @@ public class JsonUtilsUnitTest extends A
 
   @Test
   public void transition() {
-    CommandMap commandMap = new CommandMap();
+    final CommandMap commandMap = new CommandMap();
     commandMap.setClick(new Command(null, false, null, null, new String[0], null, null, null, null, null));
     final String expected = "{'click':{'transition':false}}".replaceAll("'", "\"");
     Assert.assertEquals(expected, JsonUtils.encode(commandMap));
@@ -73,7 +73,7 @@ public class JsonUtilsUnitTest extends A
 
   @Test
   public void more() {
-    CommandMap map = new CommandMap();
+    final CommandMap map = new CommandMap();
     final AbstractUICommandBase command = (AbstractUICommandBase)
         CreateComponentUtils.createComponent(facesContext, ComponentTypes.BUTTON, RendererTypes.BUTTON, "command");
     command.getAttributes().put(Attributes.POPUP_CLOSE, "immediate");

Modified: myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/AbstractThemeMojo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/AbstractThemeMojo.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/AbstractThemeMojo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/AbstractThemeMojo.java Fri Nov 15 17:10:58 2013
@@ -49,8 +49,8 @@ public abstract class AbstractThemeMojo 
     return project;
   }
 
-  protected String[] getThemeFiles(File sourceDir) {
-    DirectoryScanner scanner = new DirectoryScanner();
+  protected String[] getThemeFiles(final File sourceDir) {
+    final DirectoryScanner scanner = new DirectoryScanner();
     scanner.setBasedir(sourceDir);
     scanner.setIncludes(INCLUDES);
     scanner.setExcludes(EXCLUDES);

Modified: myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java Fri Nov 15 17:10:58 2013
@@ -71,20 +71,20 @@ public class IndexThemeMojo extends Abst
       getLog().info("Not creating " + tobagoResourcesFile.getName() + " as the project has no outputDirectory");
       return;
     }
-    StaleCheckDirectoryScanner scanner = new StaleCheckDirectoryScanner(tobagoResourcesFile.lastModified());
+    final StaleCheckDirectoryScanner scanner = new StaleCheckDirectoryScanner(tobagoResourcesFile.lastModified());
     scanner.setBasedir(outputDirectory);
     scanner.setIncludes(getIncludes());
     scanner.setExcludes(getExcludes());
     scanner.scan();
 
-    String[] fileNames = scanner.getIncludedFiles();
+    final String[] fileNames = scanner.getIncludedFiles();
     if (fileNames != null && fileNames.length == 0) {
       getLog().info("Skipping create resource file " + tobagoResourcesFile.getName() + ". No resources found");
       return;
     }
 
     if (!scanner.isUp2date) {
-      File metaInf = tobagoResourcesFile.getParentFile();
+      final File metaInf = tobagoResourcesFile.getParentFile();
       if (!metaInf.exists()) {
         if (!metaInf.mkdirs()) {
           getLog().error("Error creating directory " + metaInf.getName());
@@ -92,16 +92,16 @@ public class IndexThemeMojo extends Abst
       }
       BufferedWriter bufferedWriter = null;
       try {
-        StringWriter stringWriter = new StringWriter();
+        final StringWriter stringWriter = new StringWriter();
         bufferedWriter = new BufferedWriter(stringWriter);
-        for (String file : scanner.getIncludedFiles()) {
+        for (final String file : scanner.getIncludedFiles()) {
           bufferedWriter.append('/');
           bufferedWriter.append(file);
           bufferedWriter.newLine();
         }
         bufferedWriter.flush();
         FileUtils.fileWrite(tobagoResourcesFile, "utf-8", stringWriter.toString());
-      } catch (IOException e) {
+      } catch (final IOException e) {
         getLog().error("Error creating resource file " + tobagoResourcesFile.getName(), e);
       } finally {
         IOUtil.close(bufferedWriter);
@@ -119,13 +119,13 @@ public class IndexThemeMojo extends Abst
     private long lastModified;
     private boolean isUp2date = true;
 
-    private StaleCheckDirectoryScanner(long lastModified) {
+    private StaleCheckDirectoryScanner(final long lastModified) {
       this.lastModified = lastModified;
     }
 
     @Override
-    protected boolean isSelected(String name, File file) {
-      long lastModified = file.lastModified();
+    protected boolean isSelected(final String name, final File file) {
+      final long lastModified = file.lastModified();
       if (lastModified > this.lastModified) {
         isUp2date = false;
       }

Modified: myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java Fri Nov 15 17:10:58 2013
@@ -83,21 +83,21 @@ public class UnPackThemeMojo extends Abs
   private boolean ignoreVersioned;
 
 
-  private String getThemeDescriptor(File jarFile) throws MojoExecutionException {
+  private String getThemeDescriptor(final File jarFile) throws MojoExecutionException {
     ZipFile zip = null;
     try {
       zip = new ZipFile(jarFile);
-      Enumeration files = zip.getEntries();
+      final Enumeration files = zip.getEntries();
       while (files.hasMoreElements()) {
-        ZipEntry nextEntry = (ZipEntry) files.nextElement();
+        final ZipEntry nextEntry = (ZipEntry) files.nextElement();
         if (nextEntry == null || nextEntry.isDirectory()) {
           continue;
         }
-        String name = nextEntry.getName();
+        final String name = nextEntry.getName();
         if (name.equals("META-INF/tobago-theme.xml") || name.equals("META-INF/tobago-config.xml")) {
           XmlStreamReader xsr = null;
           try {
-            StringWriter stringWriter = new StringWriter();
+            final StringWriter stringWriter = new StringWriter();
             xsr = ReaderFactory.newXmlReader(zip.getInputStream(nextEntry));
             IOUtil.copy(xsr, stringWriter);
             return stringWriter.toString();
@@ -106,13 +106,13 @@ public class UnPackThemeMojo extends Abs
           }
         }
       }
-    } catch (IOException e) {
+    } catch (final IOException e) {
       throw new MojoExecutionException("Error find ThemeDescriptor in " + jarFile, e);
     } finally {
       if (zip != null) {
         try {
           zip.close();
-        } catch (IOException e) {
+        } catch (final IOException e) {
           // ignore
         }
       }
@@ -122,24 +122,24 @@ public class UnPackThemeMojo extends Abs
 
   public void execute() throws MojoExecutionException {
     try {
-      Iterator artifacts =  getProject().getRuntimeClasspathElements().iterator();
+      final Iterator artifacts =  getProject().getRuntimeClasspathElements().iterator();
       if (!workDirectory.exists()) {
         workDirectory.mkdirs();
       }
       while (artifacts.hasNext()) {
 
-        String artifact = (String) artifacts.next();
+        final String artifact = (String) artifacts.next();
         if (getLog().isDebugEnabled()) {
           getLog().debug("Testing jar "+ artifact);
         }
 
-        File file = new File(artifact);
+        final File file = new File(artifact);
         if (file.isFile() && artifact.endsWith(".jar")) {
-          String descriptor = getThemeDescriptor(file);
+          final String descriptor = getThemeDescriptor(file);
           if (descriptor != null) {
 
-            String name = file.getName();
-            File tempLocation = new File(workDirectory, name.substring(0, name.length() - 4));
+            final String name = file.getName();
+            final File tempLocation = new File(workDirectory, name.substring(0, name.length() - 4));
             boolean process = false;
             if (!tempLocation.exists()) {
               tempLocation.mkdirs();
@@ -153,18 +153,18 @@ public class UnPackThemeMojo extends Abs
                 String version = null;
                 String resourcePath = null;
                 try {
-                  Xpp3Dom xpp3Dom = Xpp3DomBuilder.build(new StringReader(descriptor));
-                  Xpp3Dom themeDefinitions = xpp3Dom.getChild("theme-definitions");
+                  final Xpp3Dom xpp3Dom = Xpp3DomBuilder.build(new StringReader(descriptor));
+                  final Xpp3Dom themeDefinitions = xpp3Dom.getChild("theme-definitions");
                   if (themeDefinitions != null && !ignoreVersioned) {
-                    for (Xpp3Dom themeDefinition : themeDefinitions.getChildren()) {
-                      Xpp3Dom versionedDom = themeDefinition.getChild("versioned");
+                    for (final Xpp3Dom themeDefinition : themeDefinitions.getChildren()) {
+                      final Xpp3Dom versionedDom = themeDefinition.getChild("versioned");
                       if (versionedDom != null) {
-                        boolean versioned = Boolean.parseBoolean(versionedDom.getValue());
+                        final boolean versioned = Boolean.parseBoolean(versionedDom.getValue());
                         if (versioned) {
-                          Xpp3Dom resourcePathDom = themeDefinition.getChild("resource-path");
+                          final Xpp3Dom resourcePathDom = themeDefinition.getChild("resource-path");
                           resourcePath = resourcePathDom.getValue();
-                          Properties properties = new Properties();
-                          String metaInf = tempLocation + "/META-INF/MANIFEST.MF";
+                          final Properties properties = new Properties();
+                          final String metaInf = tempLocation + "/META-INF/MANIFEST.MF";
                           properties.load(new ByteArrayInputStream(FileUtils.fileRead(metaInf).getBytes()));
                           version = properties.getProperty("Implementation-Version");
                           if (version == null) {
@@ -175,9 +175,9 @@ public class UnPackThemeMojo extends Abs
                       }
                     }
                   }
-                } catch (IOException e) {
+                } catch (final IOException e) {
                   getLog().error(e);
-                } catch (XmlPullParserException e) {
+                } catch (final XmlPullParserException e) {
                   getLog().error(e);
                 }
                 if (getLog().isDebugEnabled()) {
@@ -185,46 +185,45 @@ public class UnPackThemeMojo extends Abs
                   getLog().debug("Version: " + version);
                   getLog().debug("ResourcePath: " + resourcePath);
                 }
-                String[] fileNames = getThemeFiles(tempLocation);
-                for (int i = 0, fileNamesLength = fileNames.length; i < fileNamesLength; i++) {
-                  String fileName = fileNames[i];
-                  File fromFile = new File(tempLocation, fileName);
+                final String[] fileNames = getThemeFiles(tempLocation);
+                for (final String fileName : fileNames) {
+                  final File fromFile = new File(tempLocation, fileName);
                   String toFileName = fileName;
                   if (resourcePath != null && version != null && toFileName.startsWith(resourcePath)
-                          && !fileName.endsWith("blank.html")) {
-                    toFileName = resourcePath + "/" + version + "/" +toFileName.substring(resourcePath.length()+1);
+                      && !fileName.endsWith("blank.html")) {
+                    toFileName = resourcePath + "/" + version + "/" + toFileName.substring(resourcePath.length() + 1);
                   }
                   if (getLog().isDebugEnabled()) {
                     getLog().debug("Copy file " + fromFile + " to: " + toFileName);
                   }
-                  File toFile = new File(webappDirectory, toFileName);
+                  final File toFile = new File(webappDirectory, toFileName);
                   try {
                     FileUtils.copyFile(fromFile, toFile);
-                  } catch (IOException e) {
+                  } catch (final IOException e) {
                     throw new MojoExecutionException("Error copy file: " + fromFile + " to: " + toFile, e);
                   }
                 }
-              } catch (NoSuchArchiverException e) {
+              } catch (final NoSuchArchiverException e) {
                 getLog().info("Skip unpacking dependency file with unknown extension: " + file.getPath());
               }
             }
           }
         }
       }
-    } catch (DependencyResolutionRequiredException drre) {
+    } catch (final DependencyResolutionRequiredException drre) {
       throw new MojoExecutionException(drre.getMessage(), drre);
     }
   }
 
-  private void unpack(File file, File location)
+  private void unpack(final File file, final File location)
       throws MojoExecutionException, NoSuchArchiverException {
-    String archiveExt = FileUtils.getExtension(file.getAbsolutePath()).toLowerCase(Locale.ENGLISH);
+    final String archiveExt = FileUtils.getExtension(file.getAbsolutePath()).toLowerCase(Locale.ENGLISH);
     try {
-      UnArchiver unArchiver = archiverManager.getUnArchiver(archiveExt);
+      final UnArchiver unArchiver = archiverManager.getUnArchiver(archiveExt);
       unArchiver.setSourceFile(file);
       unArchiver.setDestDirectory(location);
       unArchiver.extract();
-    } catch (ArchiverException e) {
+    } catch (final ArchiverException e) {
       throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e);
     }
   }

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java Fri Nov 15 17:10:58 2013
@@ -43,7 +43,7 @@ public enum DynamicExpression {
   private boolean valueExpression;
   private boolean methodExpression;
 
-  DynamicExpression(boolean required, boolean valueExpression, boolean methodExpression) {
+  DynamicExpression(final boolean required, final boolean valueExpression, final boolean methodExpression) {
     this.required = required;
     this.valueExpression = valueExpression;
     this.methodExpression = methodExpression;

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSniplet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSniplet.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSniplet.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSniplet.java Fri Nov 15 17:10:58 2013
@@ -30,14 +30,14 @@ public class CodeSniplet {
   private int lineStart;
   private int lineEnd;
 
-  public CodeSniplet(String id, String fileName, int lineStart) {
+  public CodeSniplet(final String id, final String fileName, final int lineStart) {
     this.id = id;
     this.fileName = fileName;
     this.code = new ArrayList<String>();
     this.lineStart = lineStart;
   }
 
-  public void addLine(String line) {
+  public void addLine(final String line) {
     code.add(line);
   }
 
@@ -45,16 +45,16 @@ public class CodeSniplet {
     return id;
   }
 
-  public void setId(String id) {
+  public void setId(final String id) {
     this.id = id;
   }
 
-  public StringBuffer getCode(boolean stripLeadingSpaces) {
+  public StringBuffer getCode(final boolean stripLeadingSpaces) {
     int minSpaces = -1;
     for (int i = 0; i < code.size(); i++) {
-      String s = code.get(i);
+      final String s = code.get(i);
       for (int j = 0; j < s.length(); j++) {
-        char c = s.charAt(j);
+        final char c = s.charAt(j);
         if (!Character.isWhitespace(c)) {
           if (minSpaces == -1 || j < minSpaces) {
             minSpaces = j;
@@ -63,9 +63,9 @@ public class CodeSniplet {
         }
       }
     }
-    StringBuffer sb = new StringBuffer();
+    final StringBuffer sb = new StringBuffer();
     for (int i = 0; i < code.size(); i++) {
-      String s = code.get(i);
+      final String s = code.get(i);
       if (stripLeadingSpaces && s.length() > minSpaces && minSpaces != -1) {
         sb.append(s.substring(minSpaces));
       } else {
@@ -82,7 +82,7 @@ public class CodeSniplet {
     return fileName;
   }
 
-  public void setFileName(String fileName) {
+  public void setFileName(final String fileName) {
     this.fileName = fileName;
   }
 
@@ -90,7 +90,7 @@ public class CodeSniplet {
     return lineStart;
   }
 
-  public void setLineStart(int lineStart) {
+  public void setLineStart(final int lineStart) {
     this.lineStart = lineStart;
   }
 
@@ -98,7 +98,7 @@ public class CodeSniplet {
     return lineEnd;
   }
 
-  public void setLineEnd(int lineEnd) {
+  public void setLineEnd(final int lineEnd) {
     this.lineEnd = lineEnd;
   }
 

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSnipletExtractTask.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSnipletExtractTask.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSnipletExtractTask.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/ant/sniplet/CodeSnipletExtractTask.java Fri Nov 15 17:10:58 2013
@@ -84,7 +84,7 @@ public class CodeSnipletExtractTask exte
     return outputFileNamePattern;
   }
 
-  public void setOutputFileNamePattern(String outputFileNamePattern) {
+  public void setOutputFileNamePattern(final String outputFileNamePattern) {
     this.outputFileNamePattern = outputFileNamePattern;
   }
 
@@ -92,11 +92,11 @@ public class CodeSnipletExtractTask exte
     return outputDir;
   }
 
-  public void setOutputDir(File outputDir) {
+  public void setOutputDir(final File outputDir) {
     this.outputDir = outputDir;
   }
 
-  public void addConfiguredFileSet(FileSet fileSet) {
+  public void addConfiguredFileSet(final FileSet fileSet) {
     this.fileSets.add(fileSet);
   }
 
@@ -104,29 +104,29 @@ public class CodeSnipletExtractTask exte
     return stripLeadingSpaces;
   }
 
-  public void setStripLeadingSpaces(boolean stripLeadingSpaces) {
+  public void setStripLeadingSpaces(final boolean stripLeadingSpaces) {
     this.stripLeadingSpaces = stripLeadingSpaces;
   }
 
   public void execute() throws BuildException {
     for (int k = 0; k < fileSets.size(); k++) {
-      FileSet fileSet = fileSets.get(k);
-      DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
+      final FileSet fileSet = fileSets.get(k);
+      final DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
       dirScanner.scan();
-      String[] includedFiles = dirScanner.getIncludedFiles();
+      final String[] includedFiles = dirScanner.getIncludedFiles();
       for (int i = 0; i < includedFiles.length; i++) {
-        String fileS = includedFiles[i];
+        final String fileS = includedFiles[i];
         LineNumberReader in = null;
         try {
           in = new LineNumberReader(new FileReader(fileSet.getDir(getProject())
               + File.separator + fileS));
           String line = in.readLine();
           while (line != null) {
-            Matcher startMatcher = startPattern.matcher(line);
+            final Matcher startMatcher = startPattern.matcher(line);
             if (startMatcher.matches()) {
               startSniplet(startMatcher.group(1), fileS, in.getLineNumber());
             } else {
-              Matcher endMatcher = endPattern.matcher(line);
+              final Matcher endMatcher = endPattern.matcher(line);
               if (endMatcher.matches()) {
                 endSniplet(endMatcher.group(1), fileS, in.getLineNumber());
               } else {
@@ -136,7 +136,7 @@ public class CodeSnipletExtractTask exte
             line = in.readLine();
           }
           for (int j = 0; j < sniplets.size(); j++) {
-            CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(j);
+            final CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(j);
             if (codeSniplet.getLineEnd() == 0) {
               codeSniplet.setLineEnd(in.getLineNumber());
               log("Unclosed sniplet '" + codeSniplet.getId() + "' in file '" + codeSniplet.getFileName() + "' at line '"
@@ -145,13 +145,13 @@ public class CodeSnipletExtractTask exte
           }
           createOutput();
           sniplets = new ArrayList<CodeSniplet>();
-        } catch (IOException e) {
+        } catch (final IOException e) {
           throw new BuildException(e);
         } finally {
           if (in != null) {
             try {
               in.close();
-            } catch (IOException e) {
+            } catch (final IOException e) {
               throw new BuildException(e);
             }
           }
@@ -162,33 +162,33 @@ public class CodeSnipletExtractTask exte
 
   private void createOutput() throws FileNotFoundException {
     for (int i = 0; i < sniplets.size(); i++) {
-      CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
-      String fileName = codeSniplet.getId() + ".snip";
-      File file = new File(outputDir, fileName);
-      PrintWriter out = new PrintWriter(new FileOutputStream(file));
-      StringBuffer code = codeSniplet.getCode(stripLeadingSpaces);
+      final CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
+      final String fileName = codeSniplet.getId() + ".snip";
+      final File file = new File(outputDir, fileName);
+      final PrintWriter out = new PrintWriter(new FileOutputStream(file));
+      final StringBuffer code = codeSniplet.getCode(stripLeadingSpaces);
       out.print(code);
       out.close();
       log("Wrote: " + file.getName(), Project.MSG_INFO);
     }
   }
 
-  private void startSniplet(String id, String fileName, int lineNumber) {
+  private void startSniplet(final String id, final String fileName, final int lineNumber) {
     for (int i = 0; i < sniplets.size(); i++) {
-      CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
+      final CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
       if (codeSniplet.getId().equals(id)) {
         throw new BuildException("Duplicate sniplet declaration '" + id + "' in file '" + fileName + "' at line '"
             + lineNumber + "'. First declaration was in file '" + codeSniplet.getFileName() + "' at line '"
             + codeSniplet.getLineStart() + "'.");
       }
     }
-    CodeSniplet codeSniplet = new CodeSniplet(id, fileName, lineNumber);
+    final CodeSniplet codeSniplet = new CodeSniplet(id, fileName, lineNumber);
     sniplets.add(codeSniplet);
   }
 
-  private void endSniplet(String id, String fileName, int lineNumber) {
+  private void endSniplet(final String id, final String fileName, final int lineNumber) {
     for (int i = 0; i < sniplets.size(); i++) {
-      CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
+      final CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
       if (codeSniplet.getId().equals(id)) {
         codeSniplet.setLineEnd(lineNumber);
         return;
@@ -198,9 +198,9 @@ public class CodeSnipletExtractTask exte
         + "' found.");
   }
 
-  private void addLine(String line) {
+  private void addLine(final String line) {
     for (int i = 0; i < sniplets.size(); i++) {
-      CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
+      final CodeSniplet codeSniplet = (CodeSniplet) sniplets.get(i);
       if (codeSniplet.getLineEnd() == 0) {
         codeSniplet.addLine(line);
         log("Adding: " + line + " -> " + codeSniplet.getFileName() + ":" + codeSniplet.getId(), Project.MSG_DEBUG);

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java?rev=1542331&r1=1542330&r2=1542331&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java Fri Nov 15 17:10:58 2013
@@ -28,7 +28,7 @@ public final class AnnotationUtils {
   private AnnotationUtils() {
   }
 
-  public static String componentType(UIComponentTag componentTag) {
+  public static String componentType(final UIComponentTag componentTag) {
     final String s = componentTag.componentType();
     if (s != null && s.length() > 0) {
       return s;
@@ -37,7 +37,7 @@ public final class AnnotationUtils {
     }
   }
 
-  public static String generatedTagName(TypeElement typeElement) {
+  public static String generatedTagName(final TypeElement typeElement) {
     final String s = typeElement.getQualifiedName().toString();
     return s.replace(".component.", ".");
   }