gpt4 book ai didi

org.metawidget.util.XmlUtils.getAttributesAsMap()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 22:37:05 27 4
gpt4 key购买 nike

本文整理了Java中org.metawidget.util.XmlUtils.getAttributesAsMap()方法的一些代码示例,展示了XmlUtils.getAttributesAsMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlUtils.getAttributesAsMap()方法的具体详情如下:
包路径:org.metawidget.util.XmlUtils
类名称:XmlUtils
方法名:getAttributesAsMap

XmlUtils.getAttributesAsMap介绍

[英]Gets the DOM attributes of the given Node as a Map.
[中]获取给定节点的DOM属性作为映射。

代码示例

代码示例来源:origin: org.metawidget.modules/metawidget-core

@Override
  protected Map<String, String> getAttributesAsMap( Element element ) {

    return XmlUtils.getAttributesAsMap( element );
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

@Override
  protected Map<String, String> getAttributesAsMap( Element element ) {

    return XmlUtils.getAttributesAsMap( element );
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-core

@Override
  protected Map<String, String> inspectAction( Element toInspect ) {

    if ( ACTION.equals( toInspect.getNodeName() ) ) {
      return XmlUtils.getAttributesAsMap( toInspect );
    }

    return null;
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

@Override
  protected Map<String, String> inspectAction( Element toInspect ) {

    if ( ACTION.equals( toInspect.getNodeName() ) ) {
      return XmlUtils.getAttributesAsMap( toInspect );
    }

    return null;
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-core

@Override
protected Map<String, String> inspectProperty( Element toInspect ) {
  if ( PROPERTY.equals( toInspect.getNodeName() ) ) {
    Map<String, String> attributes = XmlUtils.getAttributesAsMap( toInspect );
    // Warn about some common typos
    if ( attributes.containsKey( "readonly" ) ) {
      throw InspectorException.newException( "Attribute named 'readonly' should be '" + InspectionResultConstants.READ_ONLY + "'" );
    }
    if ( attributes.containsKey( "dontexpand" ) ) {
      throw InspectorException.newException( "Attribute named 'dontexpand' should be '" + InspectionResultConstants.DONT_EXPAND + "'" );
    }
    // All good
    return attributes;
  }
  return null;
}

代码示例来源:origin: org.metawidget.modules/metawidget-core

public static Element importElement( Document document, Element element ) {
  try {
    return (Element) document.importNode( element, true );
  } catch ( DOMException e ) {
    // Note: importNode returns 'DOMException' under Android 1.1_r1
    Element imported = document.createElementNS( element.getNamespaceURI(), element.getNodeName() );
    setMapAsAttributes( imported, getAttributesAsMap( element ) );
    NodeList nodeList = imported.getChildNodes();
    for ( int loop = 0; loop < nodeList.getLength(); loop++ ) {
      Node node = nodeList.item( loop );
      if ( !( node instanceof Element ) ) {
        continue;
      }
      imported.appendChild( importElement( document, (Element) node ) );
    }
    return imported;
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

public static Element importElement( Document document, Element element ) {
  try {
    return (Element) document.importNode( element, true );
  } catch ( DOMException e ) {
    // Note: importNode returns 'DOMException' under Android 1.1_r1
    Element imported = document.createElementNS( element.getNamespaceURI(), element.getNodeName() );
    setMapAsAttributes( imported, getAttributesAsMap( element ) );
    NodeList nodeList = imported.getChildNodes();
    for ( int loop = 0; loop < nodeList.getLength(); loop++ ) {
      Node node = nodeList.item( loop );
      if ( !( node instanceof Element ) ) {
        continue;
      }
      imported.appendChild( importElement( document, (Element) node ) );
    }
    return imported;
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

protected void addColumnTags( TableTag tableTag, Map<String, String> attributes, NodeList elements, MetawidgetTag metawidgetTag ) {
  // For each property...
  int columnsAdded = 0;
  for ( int loop = 0, length = elements.getLength(); loop < length; loop++ ) {
    Node node = elements.item( loop );
    if ( !( node instanceof Element ) ) {
      continue;
    }
    Element element = (Element) node;
    // ...that is visible...
    if ( TRUE.equals( element.getAttribute( HIDDEN ) ) ) {
      continue;
    }
    // ...add a column...
    if ( addColumnTag( tableTag, attributes, XmlUtils.getAttributesAsMap( element ), metawidgetTag ) ) {
      columnsAdded++;
    }
    // ...up to a sensible maximum
    if ( columnsAdded == 5 ) {
      break;
    }
  }
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

@Override
protected Map<String, String> inspectProperty( Element toInspect ) {
  if ( PROPERTY.equals( toInspect.getNodeName() ) ) {
    Map<String, String> attributes = XmlUtils.getAttributesAsMap( toInspect );
    // Warn about some common typos
    if ( attributes.containsKey( "readonly" ) ) {
      throw InspectorException.newException( "Attribute named 'readonly' should be '" + InspectionResultConstants.READ_ONLY + "'" );
    }
    if ( attributes.containsKey( "dontexpand" ) ) {
      throw InspectorException.newException( "Attribute named 'dontexpand' should be '" + InspectionResultConstants.DONT_EXPAND + "'" );
    }
    // All good
    return attributes;
  }
  return null;
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

addColumnComponent( dataTable, attributes, PROPERTY, XmlUtils.getAttributesAsMap( element ), metawidget );

代码示例来源:origin: org.metawidget.modules/metawidget-all

public Element processInspectionResultAsDom( Element inspectionResult, M metawidget, Object toInspect, String type, String... names ) {
  Element entity = XmlUtils.getFirstChildElement( inspectionResult );
  // Sanity check
  String elementName = entity.getNodeName();
  if ( !ENTITY.equals( elementName ) ) {
    throw InspectionResultProcessorException.newException( "Top-level element name should be " + ENTITY + ", not " + elementName );
  }
  Map<String, String> attributes = XmlUtils.getAttributesAsMap( entity );
  processEntity( attributes, metawidget, toInspect, type, names );
  XmlUtils.setMapAsAttributes( entity, attributes );
  processTraits( entity, metawidget, toInspect, type, names );
  return inspectionResult;
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

addColumnComponent( dataTable, attributes, PROPERTY, XmlUtils.getAttributesAsMap( element ), metawidget );

代码示例来源:origin: org.metawidget.modules/metawidget-core

public Element processInspectionResultAsDom( Element inspectionResult, M metawidget, Object toInspect, String type, String... names ) {
  Element entity = XmlUtils.getFirstChildElement( inspectionResult );
  // Sanity check
  String elementName = entity.getNodeName();
  if ( !ENTITY.equals( elementName ) ) {
    throw InspectionResultProcessorException.newException( "Top-level element name should be " + ENTITY + ", not " + elementName );
  }
  Map<String, String> attributes = XmlUtils.getAttributesAsMap( entity );
  processEntity( attributes, metawidget, toInspect, type, names );
  XmlUtils.setMapAsAttributes( entity, attributes );
  processTraits( entity, metawidget, toInspect, type, names );
  return inspectionResult;
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

Map<String, String> attributes = XmlUtils.getAttributesAsMap( trait );
processTrait( attributes, metawidget );
XmlUtils.setMapAsAttributes( trait, attributes );

代码示例来源:origin: org.metawidget.modules.faces/metawidget-faces

childAttributes.putAll( XmlUtils.getAttributesAsMap( inspectionResult.getFirstChild() ) );

代码示例来源:origin: org.metawidget.modules/metawidget-core

Map<String, String> attributes = XmlUtils.getAttributesAsMap( trait );
processTrait( attributes, metawidget );
XmlUtils.setMapAsAttributes( trait, attributes );

代码示例来源:origin: org.metawidget.modules/metawidget-all

childAttributes.putAll( XmlUtils.getAttributesAsMap( inspectionResult.getFirstChild() ) );

代码示例来源:origin: org.metawidget.modules/metawidget-all

Map<String, String> attributes = XmlUtils.getAttributesAsMap( trait );

代码示例来源:origin: org.jboss.forge.addon/scaffold-spi

/**
* Inspects a {@link JavaClass} instance and provides inspection results in return.
*
* @param klass The {@link JavaClass} to inspect.
* @return A list representing inspection results for the {@link JavaClass}. Each list item corresponds to the
*         inspection result for every property of the provided {@link JavaClass}.
*/
public List<Map<String, String>> inspect(JavaClassSource klass)
{
 setupCompositeInspector();
 Element inspectionResult = compositeInspector.inspectAsDom(null, klass.getQualifiedName(), (String[]) null);
 Element inspectedEntity = XmlUtils.getFirstChildElement(inspectionResult);
 Element inspectedProperty = XmlUtils.getFirstChildElement(inspectedEntity);
 List<Map<String, String>> viewPropertyAttributes = new ArrayList<Map<String, String>>();
 while (inspectedProperty != null)
 {
   Map<String, String> propertyAttributes = XmlUtils.getAttributesAsMap(inspectedProperty);
   viewPropertyAttributes.add(propertyAttributes);
   inspectedProperty = XmlUtils.getNextSiblingElement(inspectedProperty);
 }
 return viewPropertyAttributes;
}

代码示例来源:origin: org.jboss.forge/forge-scaffoldx-api

/**
* Inspects a {@link JavaClass} instance and provides inspection results in return.
* 
* @param klass The {@link JavaClass} to inspect.
* @return A list representing inspection results for the {@link JavaClass}. Each list item corresponds to the
*         inspection result for every property of the provided {@link JavaClass}.
*/
public List<Map<String, String>> inspect(JavaClass klass)
{
 setupCompositeInspector();
 Element inspectionResult = compositeInspector.inspectAsDom(null, klass.getQualifiedName(), (String[]) null);
 Element inspectedEntity = XmlUtils.getFirstChildElement(inspectionResult);
 Element inspectedProperty = XmlUtils.getFirstChildElement(inspectedEntity);
 List<Map<String, String>> viewPropertyAttributes = new ArrayList<Map<String, String>>();
 while (inspectedProperty != null)
 {
   Map<String, String> propertyAttributes = XmlUtils.getAttributesAsMap(inspectedProperty);
   viewPropertyAttributes.add(propertyAttributes);
   inspectedProperty = XmlUtils.getNextSiblingElement(inspectedProperty);
 }
 return viewPropertyAttributes;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com