Package org.structr.web.common

Examples of org.structr.web.common.HtmlProperty


  }

  // ----- protected methods -----
  protected HtmlProperty findOrCreateAttributeKey(String name) {

    HtmlProperty htmlProperty = null;

    synchronized (htmlProperties) {

      htmlProperty = htmlProperties.get(name);
    }

    if (htmlProperty == null) {

      // try to find native html property defined in
      // DOMElement or one of its subclasses
      PropertyKey key = StructrApp.getConfiguration().getPropertyKeyForJSONName(entityType, name, false);

      if (key != null && key instanceof HtmlProperty) {

        htmlProperty = (HtmlProperty) key;

      } else {

        // create synthetic HtmlProperty
        htmlProperty = new HtmlProperty(name);
        htmlProperty.setDeclaringClass(DOMElement.class);
      }

      // cache property
      synchronized (htmlProperties) {
View Full Code Here


  }

  @Override
  public String getAttribute(String name) {

    HtmlProperty htmlProperty = findOrCreateAttributeKey(name);

    return htmlProperty.getProperty(securityContext, this, true);
  }
View Full Code Here

  @Override
  public void setAttribute(final String name, final String value) throws DOMException {

    try {
      HtmlProperty htmlProperty = findOrCreateAttributeKey(name);
      if (htmlProperty != null) {

        htmlProperty.setProperty(securityContext, DOMElement.this, value);
      }

    } catch (FrameworkException fex) {

      throw new DOMException(DOMException.INVALID_STATE_ERR, fex.getMessage());
View Full Code Here

  @Override
  public void removeAttribute(final String name) throws DOMException {

    try {
      HtmlProperty htmlProperty = findOrCreateAttributeKey(name);
      if (htmlProperty != null) {

        htmlProperty.setProperty(securityContext, DOMElement.this, null);
      }

    } catch (FrameworkException fex) {

      throw new DOMException(DOMException.INVALID_STATE_ERR, fex.getMessage());
View Full Code Here

  }

  @Override
  public Attr getAttributeNode(String name) {

    HtmlProperty htmlProperty = findOrCreateAttributeKey(name);
    String value = htmlProperty.getProperty(securityContext, this, true);

    if (value != null) {

      boolean explicitlySpecified = true;
      boolean isId = false;

      if (value.equals(htmlProperty.defaultValue())) {
        explicitlySpecified = false;
      }

      return new DOMAttribute((Page) getOwnerDocument(), this, name, value, explicitlySpecified, isId);
    }
View Full Code Here

TOP

Related Classes of org.structr.web.common.HtmlProperty

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.