本文整理了Java中javax.swing.text.Element.getName()
方法的一些代码示例,展示了Element.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getName()
方法的具体详情如下:
包路径:javax.swing.text.Element
类名称:Element
方法名:getName
暂无
代码示例来源:origin: spotbugs/spotbugs
@Override
protected void emptyTag(Element elem) throws IOException, BadLocationException {
if ("content".equals(elem.getName())) {
super.emptyTag(elem);
}
}
代码示例来源:origin: spotbugs/spotbugs
@Override
protected void startTag(Element elem) throws IOException {
String name = elem.getName();
startingParagraph = true;
if ("ul".equals(name)) {
super.incrIndent();
write(" ");
} else if ("pre".equals(name)) {
inPre = true;
} else if ("li".equals(name)) {
super.incrIndent();
write("* ");
} /*else if (name.equals("p")) {
}*/
}
代码示例来源:origin: spotbugs/spotbugs
@Override
protected void endTag(Element elem) throws IOException {
String name = elem.getName();
if ("p".equals(name)) {
writeLineSeparator();
indent();
} else if ("pre".equals(name)) {
inPre = false;
} else if ("ul".equals(name)) {
super.decrIndent();
writeLineSeparator();
indent();
} else if ("li".equals(name)) {
super.decrIndent();
writeLineSeparator();
indent();
}
}
代码示例来源:origin: stackoverflow.com
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
代码示例来源:origin: robotframework/SwingLibrary
public String getName() {
return element.getName();
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
public HTML.Tag getHTMLTag(Element e)
{
if(tags.containsKey(e.getName()))
{
return (HTML.Tag)tags.get(e.getName());
}
else
{
return null;
}
}
代码示例来源:origin: com.google.code.findbugs/findbugs
@Override
protected void emptyTag(Element elem) throws IOException, BadLocationException {
if ("content".equals(elem.getName())) {
super.emptyTag(elem);
}
}
代码示例来源:origin: freeplane/freeplane
private Element getStandAloneElement(final Element element) {
final String name = element.getName();
if (name.equals("ul") || name.equals("ol") || name.equals("table") || name.equals("html")) {
return element;
}
return getStandAloneElement(element.getParentElement());
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
/**
* Method for inserting list elements
*/
public void insertListStyle(Element element) throws BadLocationException, IOException {
if (element.getParentElement().getName() == "ol") {
actionListOrdered.actionPerformed(new ActionEvent(new Object(), 0, "newListPoint"));
} else {
actionListUnordered.actionPerformed(new ActionEvent(new Object(), 0, "newListPoint"));
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
/**
* Method to locate a node element by name
*/
private Element locateElementInDocument(StyledDocument doc, String elementName) {
Element[] elements = doc.getRootElements();
for (int i = 0; i < elements.length; i++) {
if (elements[i].getName().equalsIgnoreCase(elementName)) {
return elements[i];
} else {
Element rtnElement = locateChildElementInDocument(elements[i], elementName);
if (rtnElement != null) {
return rtnElement;
}
}
}
return (Element) null;
}
代码示例来源:origin: pentaho/pentaho-reporting
private void configureBand( final javax.swing.text.Element textElement, final Band band ) {
if ( "paragraph".equals( textElement.getName() ) || "section".equals( textElement.getName() ) ) {
band.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, "block" );
band.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float( -100 ) );
} else {
band.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, "inline" );
}
}
}
代码示例来源:origin: freeplane/freeplane
private void addFragment(final HTMLDocument doc, final Element element, final int depth, final int start,
final int end, final LinkedList<TextFragment> htmlFragments)
throws BadLocationException, IOException {
final String paragraphText = doc.getText(start, end - start).trim();
if (paragraphText.length() > 0 || element.getName().equals("img")) {
final StringWriter out = new StringWriter();
new PasteHtmlWriter(out, element, doc, start, end - start).write();
final String string = out.toString();
if (!string.equals("")) {
final String link = LinkController.findLink(string);
final TextFragment htmlFragment = new TextFragment(string, link, depth);
htmlFragments.add(htmlFragment);
}
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
/**
* Traverses nodes for the locating method
*/
private Element locateChildElementInDocument(Element element, String elementName) {
for (int i = 0; i < element.getElementCount(); i++) {
if (element.getElement(i).getName().equalsIgnoreCase(elementName)) {
return element.getElement(i);
}
}
return (Element) null;
}
代码示例来源:origin: com.google.code.findbugs/findbugs
@Override
protected void startTag(Element elem) throws IOException {
String name = elem.getName();
startingParagraph = true;
if ("ul".equals(name)) {
super.incrIndent();
write(" ");
} else if ("pre".equals(name)) {
inPre = true;
} else if ("li".equals(name)) {
super.incrIndent();
write("* ");
} /*else if (name.equals("p")) {
}*/
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
public Element getListItemParent()
{
String listItemTag = HTML.Tag.LI.toString();
Element eleSearch = parent.getExtendedHtmlDoc().getCharacterElement(parent.getCaretPosition());
do
{
if(listItemTag.equals(eleSearch.getName()))
{
return eleSearch;
}
eleSearch = eleSearch.getParentElement();
} while(eleSearch.getName() != HTML.Tag.HTML.toString());
return null;
}
代码示例来源:origin: freeplane/freeplane
@Override
public void write() throws IOException, BadLocationException {
if (element.getName().equals("html")) {
super.write();
return;
}
write("<html>");
super.write();
write("</html>");
}
}
代码示例来源:origin: protegeproject/protege
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new LogParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
return new LabelView(elem);
}
}
代码示例来源:origin: com.google.code.findbugs/findbugs
@Override
protected void endTag(Element elem) throws IOException {
String name = elem.getName();
if ("p".equals(name)) {
writeLineSeparator();
indent();
} else if ("pre".equals(name)) {
inPre = false;
} else if ("ul".equals(name)) {
super.decrIndent();
writeLineSeparator();
indent();
} else if ("li".equals(name)) {
super.decrIndent();
writeLineSeparator();
indent();
}
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!