本文整理了Java中javax.swing.text.Element.isLeaf()
方法的一些代码示例,展示了Element.isLeaf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.isLeaf()
方法的具体详情如下:
包路径:javax.swing.text.Element
类名称:Element
方法名:isLeaf
暂无
代码示例来源:origin: freeplane/freeplane
private boolean isSeparateElement(final Element current) {
return !current.isLeaf();
}
代码示例来源:origin: robotframework/SwingLibrary
public boolean isLeaf() {
return element.isLeaf();
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private Element getElementAt( Element parent, int offset )
{
if( parent.isLeaf() )
{
return parent;
}
return getElementAt( parent.getElement( parent.getElementIndex( offset ) ), offset );
}
}
代码示例来源:origin: chatty/chatty
result.append("'").append(text).append("'");
result.append("<br />");
if (e.isLeaf() && e.getParentElement() != null) {
Element parent = e.getParentElement();
int elementIndex = parent.getElementIndex(e.getStartOffset());
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private Element getElementAt( Element parent, int offset )
{
if( parent.isLeaf() )
{
return parent;
}
return getElementAt( parent.getElement( parent.getElementIndex( offset ) ), offset );
}
}
代码示例来源:origin: chatty/chatty
/**
* Output the text of the subelements of the given element.
*
* @param element
*/
public static void debugContents(Element element, StringBuilder b) {
Document doc = element.getDocument();
b.append("[");
if (element.isLeaf()) {
try {
String text = doc.getText(
element.getStartOffset(),
element.getEndOffset() - element.getStartOffset());
b.append("'").append(text).append("'");
} catch (BadLocationException ex) {
System.out.println("Bad location");
}
} else {
for (int i = 0; i < element.getElementCount(); i++) {
Element child = element.getElement(i);
debugContents(child, b);
}
}
b.append("]");
}
代码示例来源:origin: org.netbeans.api/org-openide-text
public Element getParagraphElement(int pos) {
Element e = getDefaultRootElement();
if (e != null && !e.isLeaf()) {
int index = e.getElementIndex(pos);
e = e.getElement(index);
} else {
e = getLeafElement();
}
return e;
}
代码示例来源:origin: freeplane/freeplane
private Element getParentElement(final HTMLDocument doc) {
final Element htmlRoot = doc.getDefaultRootElement();
final Element bodyElement = htmlRoot.getElement(htmlRoot.getElementCount() - 1);
Element parentCandidate = bodyElement;
do {
if (parentCandidate.getElementCount() > 1) {
return parentCandidate;
}
parentCandidate = parentCandidate.getElement(0);
} while (!(parentCandidate.isLeaf() || parentCandidate.getName().equalsIgnoreCase("p-implied")));
return bodyElement;
}
代码示例来源:origin: freeplane/freeplane
private Element getParentElement(final HTMLDocument doc) {
final Element htmlRoot = doc.getDefaultRootElement();
Element parentCandidate = htmlRoot.getElement(htmlRoot.getElementCount() - 1);
do {
if (parentCandidate.getElementCount() > 1) {
return parentCandidate;
}
parentCandidate = parentCandidate.getElement(0);
} while (!(parentCandidate.isLeaf() || parentCandidate.getName().equalsIgnoreCase("p-implied")));
return null;
}
代码示例来源: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: stackoverflow.com
+ "', children: " + element.getElementCount()
+ ", attributes: " + attrSet.getAttributeCount()
+ ", leaf: " + element.isLeaf());
Enumeration attrNames = attrSet.getAttributeNames();
while (attrNames.hasMoreElements()) {
代码示例来源:origin: chatty/chatty
private void clearImages(Element element) {
Long imageId = (Long)element.getAttributes().getAttribute(Attribute.IMAGE_ID);
if (imageId != null) {
kit.clearImage(imageId);
}
if (!element.isLeaf()) {
for (int i=0; i<element.getElementCount(); i++) {
clearImages(element.getElement(i));
}
}
}
代码示例来源:origin: pentaho/pentaho-reporting
if ( elem.isLeaf() ) {
代码示例来源:origin: stackoverflow.com
+ "', children: " + element.getElementCount()
+ ", attributes: " + attrSet.getAttributeCount()
+ ", leaf: " + element.isLeaf());
Enumeration attrNames = attrSet.getAttributeNames();
while (attrNames.hasMoreElements()) {
代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce
if (line.isLeaf()) {
drawElement(lineIndex, line, g, x, y);
} else {
代码示例来源:origin: freeplane/freeplane
for (int i = 0; i < elementCount; i++) {
final Element current = parent.getElement(i);
if(current.isLeaf() && ! current.getName().equals(HTML.Tag.BR.toString()) && i < elementCount - 1)
continue;
final int end = current.getEndOffset();
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public void insertUpdate(final DocumentEvent de)
{
final Document d;
//Runnable r;
d = de.getDocument();
final int i1, i2;
final int l;
i1 = de.getOffset();
i2 = de.getLength();
l = d.getLength();
if (l == i1 + i2)
{
Element e1 = d.getDefaultRootElement();
Element e2 = e1.getElement(e1.getElementIndex(i1));
while (!e2.isLeaf())
e2 = e2.getElement(e2.getElementIndex(i1));
final Element e3 = e2;
AttributeSet as = e3.getAttributes();
if (as.isDefined(tubeSortieFenetre))
if (getCaretPosition() != l)
{
setCaretPosition(l);
}
}
}
代码示例来源:origin: pentaho/pentaho-reporting
private Element process( final javax.swing.text.Element textElement ) throws BadLocationException {
if ( textElement.isLeaf() ) {
final int endOffset = textElement.getEndOffset();
final int startOffset = textElement.getStartOffset();
final String text = textElement.getDocument().getText( startOffset, endOffset - startOffset );
final Element result = new Element();
result.setElementType( LabelType.INSTANCE );
result.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text );
configureStyle( textElement.getAttributes(), result );
return result;
}
final Band band = new Band();
configureStyle( textElement.getAttributes(), band );
configureBand( textElement, band );
final int size = textElement.getElementCount();
for ( int i = 0; i < size; i++ ) {
final Element element = process( textElement.getElement( i ) );
band.addElement( element );
}
return band;
}
代码示例来源:origin: pentaho/pentaho-reporting
if ( textElement.isLeaf() ) {
final AttributeSet attributes = textElement.getAttributes();
if ( HTML.Tag.IMG.equals( attributes.getAttribute( StyleConstants.NameAttribute ) ) ) {
内容来源于网络,如有侵权,请联系作者删除!