javax.swing.text.MutableAttributeSet.getAttributeNames()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(79)

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

MutableAttributeSet.getAttributeNames介绍

暂无

代码示例

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

/**
 * Returns an enumeration of all keys maped to attribute values values.
 * 
 * @return an Enumeration over attribute keys
 */
public Enumeration getClientPropertyKeysEnumeration() {
  if (clientProperties == null) {
    return PUtil.NULL_ENUMERATION;
  }
  else {
    return clientProperties.getAttributeNames();
  }
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar

public String getLocalName(int index)
{
  Enumeration e = swingset.getAttributeNames();
  int ix = 0;
  while (e.hasMoreElements())
  {
    Object object = e.nextElement();
    if (ix == index)
    {
      return object.toString();
    }
  }
  return null;
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar

public int getIndex(String qName)
{
  Enumeration e = swingset.getAttributeNames();
  int ix = 0;
  while (e.hasMoreElements())
  {
    String name = (String)e.nextElement();
    if (name.equalsIgnoreCase(qName))
    {
      return ix;
    }
  }
  return -1;
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent2-portlets

public String getLocalName(int index)
{
  Enumeration e = swingset.getAttributeNames();
  int ix = 0;
  while (e.hasMoreElements())
  {
    Object object = e.nextElement();
    if (ix == index)
    {
      return object.toString();
    }
  }
  return null;
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent2-portlets

public int getIndex(String qName)
{
  Enumeration e = swingset.getAttributeNames();
  int ix = 0;
  while (e.hasMoreElements())
  {
    String name = (String)e.nextElement();
    if (name.equalsIgnoreCase(qName))
    {
      return ix;
    }
  }
  return -1;
}

代码示例来源:origin: stackoverflow.com

class Page extends HTMLEditorKit.ParserCallback {

  public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
    if (t == HTML.Tag.A) {
      String link = null;
      Enumeration<?> attributeNames = a.getAttributeNames();
      if (attributeNames.nextElement().equals(HTML.Attribute.HREF))
        link = a.getAttribute(HTML.Attribute.HREF).toString();
      //save link some where 
    }
  }
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar

public String getValue(int index)
{
  Enumeration e = swingset.getAttributeNames();
  int ix = 0;
  while (e.hasMoreElements())
  {
    Object object = e.nextElement();
    if (ix == index)
    {
      return (String)swingset.getAttribute(object);
    }
  }
  return null;
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent2-portlets

public String getValue(int index)
{
  Enumeration e = swingset.getAttributeNames();
  int ix = 0;
  while (e.hasMoreElements())
  {
    Object object = e.nextElement();
    if (ix == index)
    {
      return (String)swingset.getAttribute(object);
    }
  }
  return null;
}

代码示例来源:origin: usethesource/rascal

private void storeAttributes(MutableAttributeSet set) {
  attributes.push(new HashMap<java.lang.String,IValue>());
  for (Enumeration<?> names = set.getAttributeNames(); names.hasMoreElements(); ) {				
    Object label = names.nextElement();
    Object value = set.getAttribute(label);
    attributes.peek().put(label.toString(), factory.string(value.toString()));
  }
}

代码示例来源:origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Simple conversion method.
 * @param attributeSet
 * @return Sax CDATA Attributes from the Swing MutableAttributeSet
 */
private Attributes convertToSaxAttributes(
                     MutableAttributeSet attributeSet) {
  Object attrName, attrValue;
  attributes.clear();
  for(Enumeration en = attributeSet.getAttributeNames();
    en.hasMoreElements(); ) {
    attrName = en.nextElement();
    attrValue = attributeSet.getAttribute(attrName);
    attributes.addAttribute("", "", attrName.toString(),
                "CDATA", attrValue.toString());
  }
  return attributes;
}

代码示例来源:origin: org.xmlunit/xmlunit-legacy

/**
 * Simple conversion method.
 * @param attributeSet
 * @return Sax CDATA Attributes from the Swing MutableAttributeSet
 */
private Attributes convertToSaxAttributes(
                     MutableAttributeSet attributeSet) {
  Object attrName, attrValue;
  attributes.clear();
  for(Enumeration en = attributeSet.getAttributeNames();
    en.hasMoreElements(); ) {
    attrName = en.nextElement();
    attrValue = attributeSet.getAttribute(attrName);
    attributes.addAttribute("", "", attrName.toString(),
                "CDATA", attrValue.toString());
  }
  return attributes;
}

代码示例来源:origin: girtel/Net2Plan

@Override
  protected void writeAttributes(AttributeSet attr) throws IOException
  {
    convAttr.removeAttributes(convAttr);
    convertToHTML(attr, convAttr);
    Enumeration names = convAttr.getAttributeNames();
    while (names.hasMoreElements())
    {
      Object name = names.nextElement();
      if (name instanceof HTML.Tag || name instanceof StyleConstants || name == HTML.Attribute.ENDTAG) continue;
      write(" " + name + "=\"" + convAttr.getAttribute(name) + "\"");
    }
  }
}

代码示例来源:origin: org.apache.ws.jaxme/jaxmejs

protected void handleTag(HTML.Tag t, MutableAttributeSet a, int pPos) {
 final String mName = "URLChecker.handleTag";
 logger.finest(mName, "->", new Object[]{t, a, Integer.toString(pPos)});
 String tagName = t.toString().toLowerCase();
 for (Enumeration en = a.getAttributeNames();  en.hasMoreElements();  ) {
  Object attributeNameObj = en.nextElement();
  String attributeName = attributeNameObj.toString().toLowerCase();
  Object o = a.getAttribute(attributeNameObj);
  if (o instanceof String) {
   String attributeValue = (String) o;
   if (tagName.equals("a")) {
    if (attributeName.equals("href")) {
     addLink(tagName, attributeName, attributeValue, pPos, false);
    } else if (attributeName.equals("name")) {
     url.addAnchor(attributeValue);
    }
   } else if (tagName.equals("img")) {
    if (attributeName.equals("src")) {
     addLink(tagName, attributeName, attributeValue, pPos, true);
    }
   }
  } else if (o instanceof Boolean) {
   // Ignore this
  } else {
   handleWarning(url.url, pPos, "Unknown attribute type: " + (o == null ? "null" : o.getClass().getName()));
  }
 }
 logger.finest(mName, "<-");
}
public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pPos) {

代码示例来源:origin: org.apache.maven.doxia/doxia-module-fo

/** {@inheritDoc} */
protected void writeStartTag( Tag t, MutableAttributeSet att, boolean isSimpleTag )
{
  if ( this.tableCaptionXMLWriterStack.isEmpty() )
  {
    super.writeStartTag ( t, att, isSimpleTag );
  }
  else
  {
    String tag = ( getNameSpace() != null ? getNameSpace() + ":" : "" ) + t.toString();
    this.tableCaptionXMLWriterStack.getLast().startElement( tag );
    if ( att != null )
    {
      Enumeration<?> names = att.getAttributeNames();
      while ( names.hasMoreElements() )
      {
        Object key = names.nextElement();
        Object value = att.getAttribute( key );
        this.tableCaptionXMLWriterStack.getLast().addAttribute( key.toString(), value.toString() );
      }
    }
    if ( isSimpleTag )
    {
      this.tableCaptionXMLWriterStack.getLast().endElement();
    }
  }
}

代码示例来源:origin: freeplane/freeplane

@Override
  protected void writeAttributes(final AttributeSet attr) throws IOException {
    if (attr instanceof Element) {
      final Element elem = (Element) attr;
      if (elem.isLeaf() || elem.getName().equalsIgnoreCase("p-implied")) {
        super.writeAttributes(attr);
        return;
      }
    }
    convAttr.removeAttributes(convAttr);
    FixedHTMLWriter.convertToHTML(attr, convAttr);
    final Enumeration<?> names = convAttr.getAttributeNames();
    while (names.hasMoreElements()) {
      final Object name = names.nextElement();
      if (name instanceof HTML.Tag || name instanceof StyleConstants || name == HTML.Attribute.ENDTAG) {
        continue;
      }
      write(" " + name + "=\"" + convAttr.getAttribute(name) + "\"");
    }
  }
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar

private void appendTagToResult(HTML.Tag tag, MutableAttributeSet attrs) 
{
  convertURLS(tag, attrs);
  Enumeration e = attrs.getAttributeNames();
  addToResult("<").addToResult(tag);
  while (e.hasMoreElements())
  {
    Object attr = e.nextElement();
    String value = attrs.getAttribute(attr).toString();
    addToResult(" ").addToResult(attr).addToResult("=\"").
    addToResult(value).addToResult("\"");
  }        
  if (simpleTag)
    addToResult("/>");
  else             
    addToResult(">");
}

代码示例来源:origin: org.apache.portals.applications/apa-webcontent2-portlets

private void appendTagToResult(HTML.Tag tag, MutableAttributeSet attrs) 
{
  convertURLS(tag, attrs);
  Enumeration e = attrs.getAttributeNames();
  addToResult("<").addToResult(tag);
  while (e.hasMoreElements())
  {
    Object attr = e.nextElement();
    String value = attrs.getAttribute(attr).toString();
    addToResult(" ").addToResult(attr).addToResult("=\"").
    addToResult(value).addToResult("\"");
  }        
  if (simpleTag)
    addToResult("/>");
  else             
    addToResult(">");
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

changes.addEdit(new AttributeUndoableEdit(e, sCopy, false));
MutableAttributeSet attr = (MutableAttributeSet) e.getAttributes();
Enumeration aNames = attr.getAttributeNames();
Object value;
Object aName;

相关文章