Package org.apache.wicket.util.value

Examples of org.apache.wicket.util.value.IValueMap


   */
  protected boolean analyzeAutolinkCondition(final ComponentTag tag)
  {
    if (tag.getId() == null)
    {
      IValueMap attributes = tag.getAttributes();
      String ref = attributes.getString("href");
      if (checkRef(ref))
      {
        return true;
      }
      ref = attributes.getString("src");
      if (checkRef(ref))
      {
        return true;
      }
    }
View Full Code Here


        }
      }

      // Allows user to add attributes to the <input..> tag
      {
        IValueMap attrs = getAdditionalAttributes(index, choice);
        if (attrs != null)
        {
          for (Map.Entry<String, Object> attr : attrs.entrySet())
          {
            buffer.append(' ')
              .append(attr.getKey())
              .append("=\"")
              .append(attr.getValue())
              .append('"');
          }
        }
      }

      DebugSettings debugSettings = getApplication().getDebugSettings();
      String componentPathAttributeName = debugSettings.getComponentPathAttributeName();
      if (Strings.isEmpty(componentPathAttributeName) && debugSettings.isOutputComponentPath())
      {
        // fallback to the old 'wicketpath'
        componentPathAttributeName = "wicketpath";
      }
      if (Strings.isEmpty(componentPathAttributeName) == false)
      {
        CharSequence path = getPageRelativePath();
        path = Strings.replaceAll(path, "_", "__");
        path = Strings.replaceAll(path, ":", "_");
        buffer.append(' ').append(componentPathAttributeName).append("=\"")
          .append(path)
          .append("_input_")
          .append(index)
          .append('"');
      }

      buffer.append("/>");

      // Add label for radio button
      String display = label;
      if (localizeDisplayValues())
      {
        display = getLocalizer().getString(label, this, label);
      }

      CharSequence escaped = display;
      if (getEscapeModelStrings())
      {
        escaped = Strings.escapeMarkup(display);
      }

      buffer.append("<label for=\"")
        .append(idAttr)
        .append('"');

      // Allows user to add attributes to the <label..> tag
      {
        IValueMap labelAttrs = getAdditionalAttributesForLabel(index, choice);
        if (labelAttrs != null)
        {
          for (Map.Entry<String, Object> attr : labelAttrs.entrySet())
          {
            buffer.append(' ')
                .append(attr.getKey())
                .append("=\"")
                .append(attr.getValue())
View Full Code Here

      buffer.append(idAttr);
      buffer.append('"');

      // Allows user to add attributes to the <input..> tag
      {
        IValueMap attrs = getAdditionalAttributes(index, choice);
        if (attrs != null)
        {
          for (Map.Entry<String, Object> attr : attrs.entrySet())
          {
            buffer.append(' ')
              .append(attr.getKey())
              .append("=\"")
              .append(attr.getValue())
View Full Code Here

      buffer.append(':');
    }

    buffer.append(name);

    final IValueMap attributes = getAttributes();
    if (attributes.size() > 0)
    {
      final Iterator<String> iterator = attributes.keySet().iterator();
      for (; iterator.hasNext();)
      {
        final String key = iterator.next();
        if ((key != null) &&
          ((attributeToBeIgnored == null) || !key.equalsIgnoreCase(attributeToBeIgnored)))
View Full Code Here

   */
  public final void replaceAttributeValue(final Component component, final ComponentTag tag)
  {
    if (isEnabled(component))
    {
      final IValueMap attributes = tag.getAttributes();
      final Object replacementValue = getReplacementOrNull(component);

      if (VALUELESS_ATTRIBUTE_ADD == replacementValue)
      {
        attributes.put(attribute, null);
      }
      else if (VALUELESS_ATTRIBUTE_REMOVE == replacementValue)
      {
        attributes.remove(attribute);
      }
      else
      {
        final String value = toStringOrNull(attributes.get(attribute));
        final String newValue = newValue(value, toStringOrNull(replacementValue));
        if (newValue != null)
        {
          attributes.put(attribute, newValue);
        }
      }
    }
  }
View Full Code Here

   */
  public String getAttribute(String attribute)
  {
    String value = null;

    IValueMap attributeMap = openTag.getAttributes();

    if (attributeMap != null)
    {
      for (String attr : attributeMap.keySet())
      {
        if (attr.equalsIgnoreCase(attribute))
        {
          value = attributeMap.getString(attr);
        }
      }
    }

    return value;
View Full Code Here

        {
          XmlTag xmlTag = elm;

          if (openTag == null)
          {
            IValueMap attributeMap = xmlTag.getAttributes();

            for (Map.Entry<String, Object> entry : attributeMap.entrySet())
            {
              String attr = entry.getKey();
              if (attr.equals(attribute) && value.equals(entry.getValue()))
              {
                if (xmlTag.isOpen())
View Full Code Here

        while ((elm = parser.nextTag()) != null)
        {
          XmlTag xmlTag = elm;
          if (openTag == null)
          {
            IValueMap attributeMap = xmlTag.getAttributes();
            for (Map.Entry<String, Object> entry : attributeMap.entrySet())
            {
              if (entry.getKey().equals(attribute) && value.equals(entry.getValue()))
              {
                if (xmlTag.isOpen())
                {
View Full Code Here

        }
      }

      // Allows user to add attributes to the <input..> tag
      {
        IValueMap attrs = getAdditionalAttributes(index, choice);
        if (attrs != null)
        {
          for (Map.Entry<String, Object> attr : attrs.entrySet())
          {
            buffer.append(' ')
              .append(attr.getKey())
              .append("=\"")
              .append(attr.getValue())
              .append('"');
          }
        }
      }

      if (getApplication().getDebugSettings().isOutputComponentPath())
      {
        CharSequence path = getPageRelativePath();
        path = Strings.replaceAll(path, "_", "__");
        path = Strings.replaceAll(path, ":", "_");
        buffer.append(" wicketpath=\"")
          .append(path)
          .append("_input_")
          .append(index)
          .append('"');
      }

      buffer.append("/>");

      // Add label for radio button
      String display = label;
      if (localizeDisplayValues())
      {
        display = getLocalizer().getString(label, this, label);
      }

      CharSequence escaped = display;
      if (getEscapeModelStrings())
      {
        escaped = Strings.escapeMarkup(display);
      }

      buffer.append("<label for=\"")
        .append(idAttr)
        .append('"');

      // Allows user to add attributes to the <label..> tag
      {
        IValueMap labelAttrs = getAdditionalAttributesForLabel(index, choice);
        if (labelAttrs != null)
        {
          for (Map.Entry<String, Object> attr : labelAttrs.entrySet())
          {
            buffer.append(' ')
                .append(attr.getKey())
                .append("=\"")
                .append(attr.getValue())
View Full Code Here

  }

  @Override
  public void onComponentTag(ComponentTag tag) {
    // get options from the markup
    IValueMap valueMap = tag.getAttributes();

    // Iterate over valid options
    for (String s : optionNames) {
      if (valueMap.containsKey(s)) {
        // if option isn't set programmatically, set value from markup
        if (!attributes.containsKey(s) && !parameters.containsKey(s))
          setValue(s, valueMap.getString(s));
        // remove attribute - they are added in super.onComponentTag()
        // to
        // the right place as attribute or param
        valueMap.remove(s);
      }
    }

    super.onComponentTag(tag);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.value.IValueMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.