Package org.apache.wicket.util.value

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


          {
            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


          if (elm instanceof XmlTag)
          {
            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

      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.equals(replacementValue))
      {
        attributes.put(attribute, null);
      }
      else if (VALUELESS_ATTRIBUTE_REMOVE.equals(replacementValue))
      {
        attributes.remove(attribute);
      }
      else
      {
        if (attributes.containsKey(attribute))
        {
          final String value = toStringOrNull(attributes.get(attribute));
          if (pattern == null || value.matches(pattern))
          {
            final String newValue = newValue(value, toStringOrNull(replacementValue));
            if (newValue != null)
            {
              attributes.put(attribute, newValue);
            }
          }
        }
        else if (addAttributeIfNotPresent)
        {
          final String newValue = newValue(null, toStringOrNull(replacementValue));
          if (newValue != null)
          {
            attributes.put(attribute, newValue);
          }
        }
      }
    }
  }
View Full Code Here

  @Override
  protected void onComponentTag(final ComponentTag tag)
  {
    super.onComponentTag(tag);

    IValueMap attributes = tag.getAttributes();

    if (minimum != null)
    {
      attributes.put("min", Objects.stringValue(minimum));
    }
    else
    {
      attributes.remove("min");
    }

    if (maximum != null)
    {
      attributes.put("max", Objects.stringValue(maximum));
    }
    else
    {
      attributes.remove("max");
    }
  }
View Full Code Here

  @Override
  protected void onComponentTag(final ComponentTag tag)
  {
    super.onComponentTag(tag);

    IValueMap attributes = tag.getAttributes();

    if (minimum != null)
    {
      attributes.put("min", Objects.stringValue(minimum));
    }
    else
    {
      attributes.remove("min");
    }

    if (maximum != null)
    {
      attributes.put("max", Objects.stringValue(maximum));
    }
    else
    {
      attributes.remove("max");
    }

    if (step != null)
    {
      if (step.doubleValue() == ANY)
      {
        attributes.put("step", "any");
      }
      else
      {
        attributes.put("step", Objects.stringValue(step));
      }
    }
    else
    {
      attributes.remove("step");
    }
  }
View Full Code Here

      {
        escaped = Strings.escapeMarkup(display);
      }

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

      switch (labelPosition)
      {
        case BEFORE:

          buffer.append("<label for=\"")
              .append(idAttr)
              .append('"')
              .append(extraLabelAttributes)
              .append('>')
              .append(escaped)
              .append("</label>");
          break;
        case WRAP_BEFORE:
          buffer.append("<label")
              .append(extraLabelAttributes)
              .append('>')
              .append(escaped)
              .append(' ');
          break;
        case WRAP_AFTER:
          buffer.append("<label")
              .append(extraLabelAttributes)
              .append('>');
          break;
      }

      // Add radio tag
      buffer.append("<input name=\"")
        .append(getInputName())
        .append('"')
        .append(" type=\"radio\"")
        .append((isSelected(choice, index, selected) ? " checked=\"checked\"" : ""))
        .append((enabled ? "" : " disabled=\"disabled\""))
        .append(" value=\"")
        .append(id)
        .append("\" id=\"")
        .append(idAttr)
        .append('"');

      // Should a roundtrip be made (have onSelectionChanged called)
      // when the option is clicked?
      if (wantOnSelectionChangedNotifications())
      {
        CharSequence url = urlFor(IOnChangeListener.INTERFACE, new PageParameters());

        Form<?> form = findParent(Form.class);
        if (form != null)
        {
          buffer.append(" onclick=\"")
            .append(form.getJsForInterfaceUrl(url))
            .append(";\"");
        }
        else
        {
          // NOTE: do not encode the url as that would give
          // invalid JavaScript
          buffer.append(" onclick=\"window.location.href='")
            .append(url)
            .append((url.toString().indexOf('?') > -1 ? '&' : '?') + getInputName())
            .append('=')
            .append(id)
            .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

  protected void onComponentTag(ComponentTag tag)
  {
    checkComponentTag(tag, "select");

    super.onComponentTag(tag);
    IValueMap attrs = tag.getAttributes();

    attrs.put("multiple", "multiple");
    attrs.put("size", getPalette().getRows());

    if (!palette.isPaletteEnabled())
    {
      attrs.put("disabled", "disabled");
    }


    // A piece of javascript to avoid serializing the options during AJAX
    // serialization.
View Full Code Here

   */
  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

   */
  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.equals(replacementValue))
      {
        attributes.put(attribute, null);
      }
      else if (VALUELESS_ATTRIBUTE_REMOVE.equals(replacementValue))
      {
        attributes.remove(attribute);
      }
      else
      {
        if (attributes.containsKey(attribute))
        {
          final String value = toStringOrNull(attributes.get(attribute));
          if (pattern == null || value.matches(pattern))
          {
            final String newValue = newValue(value, toStringOrNull(replacementValue));
            if (newValue != null)
            {
              attributes.put(attribute, getContextRelativeValue(newValue));
            }
          }
        }
        else if (addAttributeIfNotPresent)
        {
          final String newValue = newValue(null, toStringOrNull(replacementValue));
          if (newValue != null)
          {
            attributes.put(attribute, getContextRelativeValue(newValue));
          }
        }
      }
    }
  }
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.