CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation712
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard544
  private static String createDojoDndType(UIComponent component, String clientId, String dojoType) {
    StringBuilder strBuilder = new StringBuilder();
    strBuilder.append("new ").append(dojoType).append("('").append(clientId).append("'");
    StringBuilder parameter = new StringBuilder();

    Object objHorizontal = component.getAttributes().get("horizontal");
    if (objHorizontal != null) {
      parameter.append("horizontal: ").append(String.valueOf(objHorizontal)).append(",");
    }
    Object objCopyOnly = component.getAttributes().get("copyOnly");
    if (objCopyOnly != null) {
      parameter.append("copyOnly: ").append(String.valueOf(objCopyOnly)).append(",");
    }
    Object objSkipForm = component.getAttributes().get("skipForm");
    if (objSkipForm != null) {
      parameter.append("skipForm: ").append(String.valueOf(objSkipForm)).append(",");
    }
    Object objWithHandles = component.getAttributes().get("withHandles");
    if (objWithHandles != null) {
      parameter.append("withHandles: ").append(String.valueOf(objWithHandles)).append(",");
    }
    Object objAccept = component.getAttributes().get("accept");
    if (objAccept != null) {
      String accept = null;
      if (objAccept instanceof String[]) {
        String[] allowed = (String[]) objAccept;
        if (allowed.length > 1) {
          // TODO replace this
          accept = "'" + allowed[0] + "'";
          for (int i = 1; i < allowed.length; i++) {
            accept += ",'" + allowed[i] + "'";
          }
        }
      } else {
        accept = (String) objAccept;
      }
      parameter.append("accept: [").append(accept).append("],");
    }
    Object objSingular = component.getAttributes().get("singular");
    if (objSingular != null) {
      parameter.append("singular: ").append(String.valueOf(objSingular)).append(",");
    }
    Object objCreator = component.getAttributes().get("creator");
    if (objCreator != null) {
      parameter.append("creator: ").append(String.valueOf(objCreator)).append(",");
    }
    if (parameter.length() > 0) {
      parameter.deleteCharAt(parameter.lastIndexOf(","));
      strBuilder.append(",{").append(parameter).append("}");
    }
    strBuilder.append(");");
    return strBuilder.toString();
  }
FileProjectLine
org/apache/myfaces/tobago/renderkit/RenderUtil.javaTobago Deprecation251
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard245
      LOG.warn("No items found! rendering dummies instead!");
      for (int i = 0; i < indices.length; i++) {
        items.add(new SelectItem(Integer.toString(i), "Item " + i, ""));
      }
    }
    return items;
  }

  public static String currentValue(UIComponent component) {
    String currentValue = null;
    if (component instanceof ValueHolder) {
      Object value;
      if (component instanceof EditableValueHolder) {
        value = ((EditableValueHolder) component).getSubmittedValue();
        if (value != null) {
          return (String) value;
        }
      }

      value = ((ValueHolder) component).getValue();
      if (value != null) {
        Converter converter = ((ValueHolder) component).getConverter();
        if (converter == null) {
          FacesContext context = FacesContext.getCurrentInstance();
          converter = context.getApplication().createConverter(value.getClass());
        }
        if (converter != null) {
          currentValue =
              converter.getAsString(FacesContext.getCurrentInstance(),
                  component, value);
        } else {
          currentValue = value.toString();
        }
      }
    }
    return currentValue;
  }

  public static List<SelectItem> getSelectItems(UIComponent component) {

    ArrayList<SelectItem> list = new ArrayList<SelectItem>();

    for (Object o1 : component.getChildren()) {
      UIComponent kid = (UIComponent) o1;
      if (LOG.isDebugEnabled()) {
        LOG.debug("kid " + kid);
        LOG.debug("kid " + kid.getClass().getName());
      }
      if (kid instanceof UISelectItem) {
        Object value = ((UISelectItem) kid).getValue();
        if (value == null) {
          UISelectItem item = (UISelectItem) kid;
          if (kid instanceof org.apache.myfaces.tobago.component.UISelectItem) {
            list.add(getSelectItem(
                (org.apache.myfaces.tobago.component.UISelectItem) kid));
          } else {
            list.add(new SelectItem(item.getItemValue() == null ? "" : item.getItemValue(),
                item.getItemLabel() != null ? item.getItemLabel() : item.getItemValue().toString(),
                item.getItemDescription()));
          }
        } else if (value instanceof SelectItem) {
          list.add((SelectItem) value);
        } else {
FileProjectLine
org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.javaTobago Core53
org/apache/myfaces/tobago/internal/util/JavascriptWriterUtils.javaTobago Core51
  public JsonWriterUtils(final Writer out, final String characterEncoding) {
    super(out, characterEncoding);
  }

  @Override
  protected void writeEncodedValue(final char[] text, final int start,
      final int length, final boolean isAttribute) throws IOException {

    int localIndex = -1;

    final int end = start + length;
    for (int i = start; i < end; i++) {
      char ch = text[i];
      if (ch >= CHARS_TO_ESCAPE.length || CHARS_TO_ESCAPE[ch] != null) {
        localIndex = i;
        break;
      }
    }
    final Writer out = getOut();

    if (localIndex == -1) {
      // no need to escape
      out.write(text, start, length);
    } else {
      // write until localIndex and then encode the remainder
      out.write(text, start, localIndex);

      final ResponseWriterBuffer buffer = getBuffer();

      for (int i = localIndex; i < end; i++) {
        final char ch = text[i];

        // Tilde or less...
        if (ch < CHARS_TO_ESCAPE.length) {
          if (isAttribute && ch == '&' && (i + 1 < end) && text[i + 1] == '{') {
            // HTML 4.0, section B.7.1: ampersands followed by
            // an open brace don't get escaped
            buffer.addToBuffer('&');
          } else if (CHARS_TO_ESCAPE[ch] != null) {
            buffer.addToBuffer(CHARS_TO_ESCAPE[ch]);
          } else {
            buffer.addToBuffer(ch);
          }
        } else if (isUtf8()) {
          buffer.addToBuffer(ch);
        } else if (ch <= 0xff) {
          // ISO-8859-1 entities: encode as needed
          buffer.flushBuffer();

          out.write('&');
          char[] chars = ISO8859_1_ENTITIES[ch - 0xA0];
          out.write(chars, 0, chars.length);
          out.write(';');
        } else {
          buffer.flushBuffer();

          // Double-byte characters to encode.
          // PENDING: when outputting to an encoding that
          // supports double-byte characters (UTF-8, for example),
          // we should not be encoding
          writeDecRef(ch);
        }
      }

      buffer.flushBuffer();
    }
  }
}
FileProjectLine
org/apache/myfaces/tobago/renderkit/RenderUtil.javaTobago Deprecation140
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard138
  }

  public static String getFormattedValue(
      FacesContext facesContext, UIComponent component) {
    Object value = null;
    if (component instanceof ValueHolder) {
      value = ((ValueHolder) component).getLocalValue();
      if (value == null) {
        value = ((ValueHolder) component).getValue();
      }
    }
    return getFormattedValue(facesContext, component, value);
  }

  // Copy from RendererBase
  public static String getFormattedValue(
      FacesContext context, UIComponent component, Object currentValue)
      throws ConverterException {

    if (currentValue == null) {
      return "";
    }

    if (!(component instanceof ValueHolder)) {
      return currentValue.toString();
    }

    Converter converter = ((ValueHolder) component).getConverter();

    if (converter == null) {
      if (currentValue instanceof String) {
        return (String) currentValue;
      }
      Class converterType = currentValue.getClass();
      converter = context.getApplication().createConverter(converterType);
    }

    if (converter == null) {
      return currentValue.toString();
    } else {
      return converter.getAsString(context, component, currentValue);
    }
  }

  public static Measure calculateStringWidth(FacesContext facesContext, UIComponent component, String text) {
    return calculateStringWidth(facesContext, (Configurable) component, text, "tobago.font.widths");
  }

  public static Measure calculateStringWidth2(FacesContext facesContext, UIComponent component, String text) {
    return calculateStringWidth(facesContext, (Configurable) component, text, "tobago.font2.widths");
  }

  private static Measure calculateStringWidth(
      FacesContext facesContext, Configurable component, String text, String type) {
FileProjectLine
org/apache/myfaces/tobago/renderkit/RenderUtil.javaTobago Deprecation315
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard312
          DebugUtils.addDevelopmentMessage(FacesContext.getCurrentInstance(), message);
        }
      } else if (kid instanceof UISelectItems) {
        Object value = ((UISelectItems) kid).getValue();
        if (LOG.isDebugEnabled()) {
          LOG.debug("value " + value);
          if (value != null) {
            LOG.debug("value " + value.getClass().getName());
          }
        }
        if (value == null) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("value is null");
          }
        } else if (value instanceof SelectItem) {
          list.add((SelectItem) value);
        } else if (value instanceof SelectItem[]) {
          SelectItem[] items = (SelectItem[]) value;
          list.addAll(Arrays.asList(items));
        } else if (value instanceof Collection) {
          for (Object o : ((Collection) value)) {
            list.add((SelectItem) o);
          }
        } else if (value instanceof Map) {
          for (Object key : ((Map) value).keySet()) {
            if (key != null) {
              Object val = ((Map) value).get(key);
              if (val != null) {
                list.add(new SelectItem(val.toString(), key.toString(), null));
              }
            }
          }
        } else {
FileProjectLine
org/apache/myfaces/tobago/component/UILinkCommand.javaTobago Core39
org/apache/myfaces/tobago/component/UIOutput.javaTobago Core39
  Map<String, Object> getAttributes();

  ValueBinding getValueBinding(String name);

  void setValueBinding(String name, ValueBinding binding);

  String getClientId(FacesContext context);

  String getFamily();

  String getId();

  void setId(String id);

  UIComponent getParent();

  void setParent(UIComponent parent);

  boolean isRendered();

  void setRendered(boolean rendered);

  String getRendererType();

  void setRendererType(String rendererType);

  boolean getRendersChildren();

  List<UIComponent> getChildren();

  int getChildCount();

  UIComponent findComponent(String expr);

  Map<String, UIComponent> getFacets();

  UIComponent getFacet(String name);

  Iterator<UIComponent> getFacetsAndChildren();

  void broadcast(javax.faces.event.FacesEvent event) throws AbortProcessingException;

  void decode(FacesContext context);

  void encodeBegin(FacesContext context) throws IOException;

  void encodeChildren(FacesContext context) throws IOException;

  void encodeEnd(FacesContext context) throws IOException;

  void queueEvent(javax.faces.event.FacesEvent event);

  void processRestoreState(FacesContext context, Object state);

  void processDecodes(FacesContext context);

  void processValidators(FacesContext context);

  void processUpdates(FacesContext context);

  Object processSaveState(FacesContext context);

}
FileProjectLine
org/apache/myfaces/tobago/component/UIInput.javaTobago Core38
org/apache/myfaces/tobago/component/UILinkCommand.javaTobago Core39
  Map<String, Object> getAttributes();

  ValueBinding getValueBinding(String name);

  void setValueBinding(String name, ValueBinding binding);

  String getClientId(FacesContext context);

  String getFamily();

  String getId();

  void setId(String id);

  UIComponent getParent();

  void setParent(UIComponent parent);

  boolean isRendered();

  void setRendered(boolean rendered);

  String getRendererType();

  void setRendererType(String rendererType);

  boolean getRendersChildren();

  List<UIComponent> getChildren();

  int getChildCount();

  UIComponent findComponent(String expr);

  Map<String, UIComponent> getFacets();

  UIComponent getFacet(String name);

  Iterator<UIComponent> getFacetsAndChildren();

  void broadcast(javax.faces.event.FacesEvent event) throws AbortProcessingException;

  void decode(FacesContext context);

  void encodeBegin(FacesContext context) throws IOException;

  void encodeChildren(FacesContext context) throws IOException;

  void encodeEnd(FacesContext context) throws IOException;

  void queueEvent(javax.faces.event.FacesEvent event);

  void processRestoreState(FacesContext context, Object state);

  void processDecodes(FacesContext context);

  void processValidators(FacesContext context);

  void processUpdates(FacesContext context);

  Object processSaveState(FacesContext context);
FileProjectLine
org/apache/myfaces/tobago/renderkit/RenderUtil.javaTobago Deprecation216
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard212
    }

    return Measure.valueOf(width);
  }

  public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectOne component) {
    return getItems(component);
  }

  public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectMany component) {
    return getItems(component);
  }

  public static List<SelectItem> getItems(javax.faces.component.UIInput component) {

    List<SelectItem> selectItems = getSelectItems(component);

    String renderRange = (String) component.getAttributes().get(Attributes.RENDER_RANGE_EXTERN);
    if (renderRange == null) {
      renderRange = (String) component.getAttributes().get(Attributes.RENDER_RANGE);
    }
    if (renderRange == null) {
      return selectItems;
    }

    int[] indices = StringUtils.getIndices(renderRange);
    List<SelectItem> items = new ArrayList<SelectItem>(indices.length);

    if (selectItems.size() != 0) {
      for (int indice : indices) {
        items.add(selectItems.get(indice));
      }
    } else {
      LOG.warn("No items found! rendering dummies instead!");
FileProjectLine
org/apache/myfaces/tobago/compat/FacesInvokeOnComponent12.javaTobago JSF Compatibility27
org/apache/myfaces/tobago/compat/FacesUtilsEL.javaTobago JSF Compatibility49
  public static boolean invokeOnComponent(
      FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
    String thisClientId = component.getClientId(context);

    if (clientId.equals(thisClientId)) {
      callback.invokeContextCallback(context, component);
      return true;
    } else if (component instanceof NamingContainer) {
      // This component is a naming container. If the client id shows it's inside this naming container,
      // then process further.
      // Otherwise we know the client id we're looking for is not in this naming container,
      // so for improved performance short circuit and return false.
      if (clientId.startsWith(thisClientId)
          && (clientId.charAt(thisClientId.length()) == NamingContainer.SEPARATOR_CHAR)) {
        if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
          return true;
        }
      }
    } else {
      if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
        return true;
      }
    }

    return false;
  }

  private static boolean invokeOnComponentFacetsAndChildren(
      FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
    for (java.util.Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
      UIComponent child = it.next();

      if (child.invokeOnComponent(context, clientId, callback)) {
        return true;
      }
    }
    return false;
  }
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation569
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard408
        int rowIndex = ((UISheet) partiallyComponent).getRowIndex();
        if (rowIndex >= 0 && clientId.endsWith(Integer.toString(rowIndex))) {
          return clientId.substring(0, clientId.lastIndexOf(NamingContainer.SEPARATOR_CHAR));
        }
      }
      return clientId;
    }
    LOG.error("No Component found for id " + componentId + " search base component " + component.getClientId(context));
    return null;
  }

  /**
   * @deprecated since Tobago 1.5.0.
   */
  @Deprecated
  public static String toStyleString(String key, Integer value) {
    StringBuilder buf = new StringBuilder();
    buf.append(key);
    buf.append(":");
    buf.append(value);
    buf.append("px; ");
    return buf.toString();
  }

  /**
   * @deprecated since Tobago 1.5.0.
   */
  @Deprecated
  public static String toStyleString(String key, String value) {
    StringBuilder buf = new StringBuilder();
    buf.append(key);
    buf.append(":");
    buf.append(value);
    buf.append("; ");
    return buf.toString();
  }

  /**
   * @deprecated since Tobago 1.5.0. Please use getTitleFromTipAndMessages and write it out.
   */
  @Deprecated
  public static void renderTip(UIComponent component, TobagoResponseWriter writer) throws IOException {
FileProjectLine
org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.javaTobago Core50
org/apache/myfaces/tobago/internal/component/AbstractUITabGroupLayout.javaTobago Core31
public abstract class AbstractUITabGroupLayout extends AbstractUILayoutBase implements LayoutManager {

  private static final Logger LOG = LoggerFactory.getLogger(AbstractUIGridLayout.class);

  private boolean horizontalAuto;
  private boolean verticalAuto;

  public void init() {
    for (LayoutComponent component : getLayoutContainer().getComponents()) {
      if (component instanceof LayoutContainer) {
        ((LayoutContainer) component).getLayoutManager().init();
      }
    }
  }

  public void fixRelativeInsideAuto(Orientation orientation, boolean auto) {

    if (orientation == Orientation.HORIZONTAL) {
      horizontalAuto = auto;
    } else {
      verticalAuto = auto;
    }

    for (LayoutComponent component : getLayoutContainer().getComponents()) {
      if (component instanceof LayoutContainer) {
        ((LayoutContainer) component).getLayoutManager().fixRelativeInsideAuto(orientation, auto);
      }
    }
  }

  public void preProcessing(Orientation orientation) {

    // process auto tokens
    IntervalList intervals = new IntervalList();
    for (LayoutComponent component : getLayoutContainer().getComponents()) {

      if (component instanceof LayoutContainer) {
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation457
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard254
      writer.write("new Tobago.ScriptLoader(");
      if (!ajax) {
        writer.write("\n    ");
      }
      writer.write(allScripts);

      if (afterLoadCmds != null && afterLoadCmds.length > 0) {
        writer.write(", ");
        if (!ajax) {
          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) {
            writer.write(first ? "          " : "        + ");
            writer.write("\"");
            String cmd = StringUtils.replace(splitted, "\\", "\\\\");
            cmd = StringUtils.replace(cmd, "\"", "\\\"");
            writer.write(cmd);
            writer.write("\"");
            if (!ajax) {
              writer.write("\n");
            }
            first = false;
          }
        }
      }
      writer.write(");");
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlElements.javaTobago Core20
org/apache/myfaces/tobago/renderkit/html/HtmlConstants.javaTobago Deprecation24
public final class HtmlConstants {

  public static final String A = "a";
  public static final String AREA = "area";
  public static final String B = "b";
  public static final String BASE = "base";
  public static final String BODY = "body";
  public static final String BR = "br";
  public static final String BUTTON = "button";
  public static final String COL = "col";
  public static final String COLGROUP = "colgroup";
  public static final String DIV = "div";
  public static final String FIELDSET = "fieldset";
  public static final String FORM = "form";
  public static final String HEAD = "head";
  public static final String HR = "hr";
  public static final String HTML = "html";
  public static final String IFRAME = "iframe";
  public static final String IMG = "img";
  public static final String INPUT = "input";
  public static final String LABEL = "label";
  public static final String LEGEND = "legend";
  public static final String LI = "li";
  public static final String LINK = "link";
  public static final String META = "meta";
  public static final String OL = "ol";
FileProjectLine
org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.javaTobago Core397
org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.javaTobago Core445
      if (reverseOrder) {
        matches.add(0, result);
      } else {
        matches.add(result);
      }
      if (LOG.isTraceEnabled()) {
        LOG.trace("testing path: {} *", path); // match
      }

      return true;
    } else if (!returnStrings) {
      try {
        path = path.substring(1).replace('/', '.');
        Class clazz = Class.forName(path);
        if (LOG.isTraceEnabled()) {
          LOG.trace("testing path: " + path + " *"); // match
        }
        matches.add(clazz);
        return true;
      } catch (ClassNotFoundException e) {
        // not found
        if (LOG.isTraceEnabled()) {
          LOG.trace("testing path: " + path); // no match
        }
      }
    } else {
      if (LOG.isTraceEnabled()) {
        LOG.trace("testing path: " + path); // no match
      }
    }
    return false;
  }

  private String makePath(
FileProjectLine
org/apache/myfaces/tobago/internal/taglib/TagUtils.javaTobago Core63
org/apache/myfaces/tobago/component/ComponentUtil.javaTobago Deprecation249
        component.getAttributes().put(name, new Integer(value));
      }
    }
  }

  public static void setBooleanProperty(UIComponent component, String name, String value) {
    if (value != null) {
      if (UIComponentTag.isValueReference(value)) {
        component.setValueBinding(name, createValueBinding(value));
      } else {
        component.getAttributes().put(name, Boolean.valueOf(value));
      }
    }
  }

  public static void setStringProperty(UIComponent component, String name, String value) {
    if (value != null) {
      if (UIComponentTag.isValueReference(value)) {
        component.setValueBinding(name, createValueBinding(value));
      } else {
        component.getAttributes().put(name, value);
      }
    }
  }

  public static void setValueForValueBinding(String name, Object value) {
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation137
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard126
  public static void writeLabelWithAccessKey(TobagoResponseWriter writer, LabelWithAccessKey label)
      throws IOException {
    int pos = label.getPos();
    String text = label.getText();
    if (pos == -1) {
      writer.writeText(text);
    } else {
      writer.writeText(text.substring(0, pos));
      writer.startElement(HtmlElements.U, null);
      writer.writeText(Character.toString(text.charAt(pos)));
      writer.endElement(HtmlElements.U);
      writer.writeText(text.substring(pos + 1));
    }
  }

  /** @deprecated since 1.5.7 and 1.6.0 */
  @Deprecated
  public static void setDefaultTransition(FacesContext facesContext, boolean transition)
      throws IOException {
    writeScriptLoader(facesContext, null, new String[]{"Tobago.transition = " + transition + ";"});
  }
FileProjectLine
org/apache/myfaces/tobago/util/EncodeAjaxCallback.javaTobago Core82
org/apache/myfaces/tobago/renderkit/RenderUtil.javaTobago Deprecation109
          encode(facesContext, kid);
        }
      }
      component.encodeEnd(facesContext);
    }
  }

  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);
      }
    }
  }
FileProjectLine
org/apache/myfaces/tobago/event/ValueBindingResetInputActionListener.javaTobago JSF Compatibility44
org/apache/myfaces/tobago/event/ValueExpressionResetInputActionListener.javaTobago JSF Compatibility43
    Object obj = clientIdsExpression.getValue(FacesContext.getCurrentInstance().getELContext());
    String [] clientIds;
    if (obj instanceof String[]) {
      clientIds = (String[]) obj;
    } else if (obj instanceof String) {
      clientIds= StringUtils.split((String) obj, ", ");
    } else {
      LOG.error("Ignore unknown value of " + obj + " for reset.");
      return;
    }
    for (String clientId : clientIds) {
      UIComponent component = FindComponentUtils.findComponent(event.getComponent(), clientId);
      if (component != null) {
        resetChildren(component);
      }
    }
  }

  public boolean isTransient() {
    return false;
  }

  public void restoreState(FacesContext context, Object state) {
    Object[] values = (Object[]) state;
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation781
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard798
    return builder.toString();
  }

  /**
   * @deprecated since Tobago 1.5.0. Please use {@link org.apache.myfaces.tobago.renderkit.css.Classes}.
   */
  @Deprecated
  public static void removeStyleClasses(UIComponent cell) {
    Object obj = cell.getAttributes().get(Attributes.STYLE_CLASS);
    if (obj != null && obj instanceof StyleClasses && cell.getRendererType() != null) {
      StyleClasses styleClasses = (StyleClasses) obj;
      if (!styleClasses.isEmpty()) {
        String rendererName = cell.getRendererType().substring(0, 1).toLowerCase(Locale.ENGLISH)
            + cell.getRendererType().substring(1);
        styleClasses.removeTobagoClasses(rendererName);
      }
      if (styleClasses.isEmpty()) {
        cell.getAttributes().remove(Attributes.STYLE_CLASS);
      }
    }
  }
FileProjectLine
org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.javaTobago Tool Apt652
org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.javaTobago Tool Apt686
  protected void addElement(InterfaceDeclaration decl, List<Element> components, List<Element> renderer,
      Namespace namespace) throws IOException {
    UIComponentTag componentTag = decl.getAnnotation(UIComponentTag.class);
    if (componentTag != null) {
      try {
        Class<?> uiComponentClass = Class.forName(componentTag.uiComponent());
        if (!componentTag.isComponentAlreadyDefined()) {
          Element element = createComponentElement(decl, componentTag, uiComponentClass, namespace);
          if (element != null) {
            if (!containsElement(components, element)) {
              addFacets(componentTag, namespace, element);
              List attributes = new ArrayList();
              List properties = new ArrayList();
              addAttributes(decl, uiComponentClass, properties, attributes, namespace);
FileProjectLine
org/apache/myfaces/tobago/renderkit/RendererBase.javaTobago Core108
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard153
  public static String getFormattedValue(
      FacesContext context, UIComponent component, Object currentValue)
      throws ConverterException {

    if (currentValue == null) {
      return "";
    }

    if (!(component instanceof ValueHolder)) {
      return currentValue.toString();
    }

    Converter converter = ((ValueHolder) component).getConverter();

    if (converter == null) {
      if (currentValue instanceof String) {
        return (String) currentValue;
      }
      Class converterType = currentValue.getClass();
      converter = context.getApplication().createConverter(converterType);
    }

    if (converter == null) {
      return currentValue.toString();
    } else {
      return converter.getAsString(context, component, currentValue);
    }
  }
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation692
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard528
  public static void renderDojoDndItem(UIComponent component, TobagoResponseWriter writer, boolean addStyle)
      throws IOException {
    Object objDndType = component.getAttributes().get("dndType");
    if (objDndType != null) {
      writer.writeAttribute("dndType", String.valueOf(objDndType), false);
    }
    Object objDndData = component.getAttributes().get("dndData");
    if (objDndData != null) {
      writer.writeAttribute("dndData", String.valueOf(objDndData), false);
    }
    if (addStyle && (null != objDndType || null != objDndData)) {
      StyleClasses styles = StyleClasses.ensureStyleClasses(component);
      styles.addFullQualifiedClass("dojoDndItem");
    }
  }
FileProjectLine
org/apache/myfaces/tobago/renderkit/RenderUtil.javaTobago Deprecation114
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard117
  }

  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);
      }
    }
  }

  public static String getFormattedValue(
FileProjectLine
org/apache/myfaces/tobago/util/EncodeAjaxCallback.javaTobago Core87
org/apache/myfaces/tobago/renderkit/util/RenderUtils.javaTobago Theme Standard117
  }

  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);
      }
    }
  }
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.javaTobago Theme Scarborough65
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.javaTobago Theme Scarborough65
    boolean required = select.isRequired();
    // fixme: use CSS, not the Style Attribute for "display"
    style.setDisplay(null);

    writer.startElement(HtmlElements.OL, select);
    writer.writeIdAttribute(id);
    writer.writeStyleAttribute(style);
    writer.writeClassAttribute(Classes.create(select));
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    UIPage page = (UIPage) ComponentUtils.findPage(facesContext, component);
    boolean focus = false;
    if ((!StringUtils.isBlank(page.getFocusId()) && page.getFocusId().equals(id)) || select.isFocus()) {
       focus = true;
    }
    Object value = select.getValue();
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.javaTobago Theme Scarborough102
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.javaTobago Theme Scarborough99
      }
      Integer tabIndex = select.getTabIndex();
      if (tabIndex != null) {
        writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
      }
      HtmlRendererUtils.renderCommandFacet(select, itemId, facesContext, writer);
      writer.endElement(HtmlElements.INPUT);

      String label = item.getLabel();
      if (label != null) {
        writer.startElement(HtmlElements.LABEL, select);
        writer.writeAttribute(HtmlAttributes.FOR, itemId, false);
        writer.writeText(label);
        writer.endElement(HtmlElements.LABEL);
      }

      writer.endElement(HtmlElements.LI);
    }
    writer.endElement(HtmlElements.OL);
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.javaTobago Deprecation95
org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.javaTobago Theme Standard95
  public static void renderFocusId(final FacesContext facesContext, final UIInput component)
      throws IOException {
    if (renderErrorFocusId(facesContext, component)) {
      return;
    }
    if (ComponentUtils.getBooleanAttribute(component, Attributes.FOCUS)) {
      UIPage page = (UIPage) ComponentUtils.findPage(facesContext, component);
      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);
FileProjectLine
org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.javaTobago Core23
org/apache/myfaces/tobago/internal/util/JsonWriterUtils.javaTobago Core24
public final class JsonWriterUtils extends WriterUtils {

  private static final char[][] CHARS_TO_ESCAPE;

  static {
    // init lookup table
    CHARS_TO_ESCAPE = new char[0xA0][];

    for (int i = 0; i < 0x20; i++) {
      CHARS_TO_ESCAPE[i] = EMPTY; // Control characters
    }

    CHARS_TO_ESCAPE['\t'] = "&#09;".toCharArray(); // Horizontal tabulator
    CHARS_TO_ESCAPE['\n'] = "&#10;".toCharArray(); // Line feed
    CHARS_TO_ESCAPE['\r'] = "&#13;".toCharArray(); // Carriage return

    CHARS_TO_ESCAPE['"'] = "&quot;".toCharArray();
    CHARS_TO_ESCAPE['&'] = "&amp;".toCharArray();
    CHARS_TO_ESCAPE['<'] = "&lt;".toCharArray();
    CHARS_TO_ESCAPE['>'] = "&gt;".toCharArray();
    CHARS_TO_ESCAPE['\\'] = "\\\\".toCharArray();
FileProjectLine
org/apache/myfaces/tobago/internal/component/AbstractUIPage.javaTobago Core266
org/apache/myfaces/tobago/internal/component/AbstractUIPanel.javaTobago Core55
    super.encodeEnd(facesContext);
  }

  public void onComponentPopulated(FacesContext facesContext, UIComponent parent) {
    if (getLayoutManager() == null) {
      setLayoutManager(CreateComponentUtils.createAndInitLayout(
          facesContext, ComponentTypes.GRID_LAYOUT, RendererTypes.GRID_LAYOUT, parent));
    }
  }

  public List<LayoutComponent> getComponents() {
    return LayoutUtils.findLayoutChildren(this);
  }

  public LayoutManager getLayoutManager() {
    return (LayoutManager) getFacet(Facets.LAYOUT);
  }

  public void setLayoutManager(LayoutManager layoutManager) {
    getFacets().put(Facets.LAYOUT, (AbstractUILayoutBase) layoutManager);
  }

  public boolean isLayoutChildren() {
    return isRendered();
  }
FileProjectLine
org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.javaTobago Core63
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.javaTobago Theme Scarborough69
    return getResourceManager().getThemeMeasure(facesContext, component, Attributes.ROW_SPACING);
  }

  public Measure getMarginLeft(FacesContext facesContext, Configurable component) {
    return getResourceManager().getThemeMeasure(facesContext, component, Attributes.MARGIN_LEFT);
  }

  public Measure getMarginRight(FacesContext facesContext, Configurable component) {
    return getResourceManager().getThemeMeasure(facesContext, component, Attributes.MARGIN_RIGHT);
  }

  public Measure getMarginTop(FacesContext facesContext, Configurable component) {
    return getResourceManager().getThemeMeasure(facesContext, component, Attributes.MARGIN_TOP);
  }

  public Measure getMarginBottom(FacesContext facesContext, Configurable component) {
    return getResourceManager().getThemeMeasure(facesContext, component, Attributes.MARGIN_BOTTOM);
  }
FileProjectLine
org/apache/myfaces/tobago/apt/TaglibAnnotationVisitor.javaTobago Tool Apt237
org/apache/myfaces/tobago/apt/TobagoAnnotationVisitor.javaTobago Tool Apt86
    BodyContent bodyContent = tag.bodyContent();
    BodyContentDescription contentDescription = decl.getAnnotation(BodyContentDescription.class);
    // TODO more error checking
    if (contentDescription != null) {
      if (bodyContent.equals(BodyContent.JSP)
          && contentDescription.contentType().length() > 0) {
        throw new IllegalArgumentException(
            "contentType " + contentDescription.contentType() + " for bodyContent JSP not allowed!");
      } else if (bodyContent.equals(BodyContent.TAGDEPENDENT)
          && contentDescription.contentType().length() == 0) {
        throw new IllegalArgumentException("contentType should set for tagdependent bodyContent");
      }
    }

    addLeafTextElement(bodyContent.toString(), "body-content", tagElement, document);
FileProjectLine
org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.javaTobago Core56
org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.javaTobago Core55
  public abstract boolean isExecuteSet();

  public int doStartTag() throws JspException {

    // Locate our parent UIComponentTag
    UIComponentTag tag =
        UIComponentTag.getParentUIComponentTag(pageContext);
    if (tag == null) {
      // TODO Message resource i18n
      throw new JspException("Not nested in faces tag");
    }

    if (!tag.getCreated()) {
      return (SKIP_BODY);
    }

    UIComponent component = tag.getComponentInstance();
    if (component == null) {
      // TODO Message resource i18n
      throw new JspException("Component Instance is null");
    }
    if (!(component instanceof ActionSource)) {
      // TODO Message resource i18n
      throw new JspException("Component " + component.getClass().getName() + " is not instanceof ActionSource");
    }
    ActionSource actionSource = (ActionSource) component;
    if (!isExecuteSet()) {
FileProjectLine
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.javaTobago Theme Scarborough87
org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.javaTobago Theme Scarborough87
      boolean checked = item.getValue().equals(value);
      writer.writeAttribute(HtmlAttributes.CHECKED, checked);
      writer.writeNameAttribute(id);
      writer.writeIdAttribute(itemId);
      String formattedValue = RenderUtils.getFormattedValue(facesContext, select, item.getValue());
      writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
      writer.writeAttribute(HtmlAttributes.DISABLED, item.isDisabled() || disabled);
      writer.writeAttribute(HtmlAttributes.READONLY, readonly);
      writer.writeAttribute(HtmlAttributes.REQUIRED, required);
      if (focus) {
        writer.writeAttribute(HtmlAttributes.AUTOFOCUS, true);
        focus = false;
      }
FileProjectLine
org/apache/myfaces/tobago/facelets/FlowLayoutRule.javaTobago Facelets38
org/apache/myfaces/tobago/facelets/GridLayoutRule.javaTobago Facelets43
          return new CellspacingMapper(attribute);
        }
        if (Attributes.MARGIN_LEFT.equals(name)) {
          return new MarginLeftMapper(attribute);
        }
        if (Attributes.MARGIN_TOP.equals(name)) {
          return new MarginTopMapper(attribute);
        }
        if (Attributes.MARGIN_RIGHT.equals(name)) {
          return new MarginRightMapper(attribute);
        }
        if (Attributes.MARGIN_BOTTOM.equals(name)) {
          return new MarginBottomMapper(attribute);
        }
        if (Attributes.MARGIN.equals(name)) {
          return new MarginMapper(attribute);
        }
      }
    }
    return null;
  }

  static final class ColumnSpacingMapper extends Metadata {
FileProjectLine
org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.javaTobago Core127
org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterWrapper.javaTobago Core105
    responseWriter.endDocument();
  }

  public void writeURIAttribute(String name, Object value, String property) throws IOException {
    responseWriter.writeURIAttribute(name, value, property);
  }

  public void writeText(char[] text, int off, int len) throws IOException {
    responseWriter.writeText(text, off, len);
  }

  public void write(char[] chars, int i, int i1) throws IOException {
    responseWriter.write(chars, i, i1);
  }

  public void close() throws IOException {
    responseWriter.close();
  }