当前位置: 首页>>代码示例>>Java>>正文


Java BRElement类代码示例

本文整理汇总了Java中com.google.gwt.dom.client.BRElement的典型用法代码示例。如果您正苦于以下问题:Java BRElement类的具体用法?Java BRElement怎么用?Java BRElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BRElement类属于com.google.gwt.dom.client包,在下文中一共展示了BRElement类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSpacer

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
/**
 * Get the spacer for the given paragraph.
 * Lazily creates & registers one if not present.
 * If there's one that the browser created, registers it as our own.
 * If the browser put a different one in to the one that we were already
 * using, replace ours with the browser's.
 * @param paragraph
 * @return The spacer
 */
protected BRElement getSpacer(Element paragraph) {
  Node last = paragraph.getLastChild();
  BRElement spacer = paragraph.getPropertyJSO(BR_REF).cast();
  if (spacer == null) {
    // Register our spacer, using one the browser put in if present
    spacer = isSpacer(last) ? last.<BRElement>cast() : Document.get().createBRElement();
    setupSpacer(paragraph, spacer);
  } else if (isSpacer(last) && last != spacer) {
    // The browser put a different one in by itself, so let's use that one
    if (spacer.hasParentElement()) {
      spacer.removeFromParent();
    }
    spacer = last.<BRElement>cast();
    setupSpacer(paragraph, spacer);
  }
  return spacer;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:27,代码来源:ParagraphHelperBr.java

示例2: ensureSpacerIfDoesntEndWithText

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
private void ensureSpacerIfDoesntEndWithText(Element paragraph) {
  Node last = paragraph.getLastChild();
  BRElement spacer = getSpacer(paragraph);
  if (last == spacer) {
    last = last.getPreviousSibling();
  }
  if (last == null || DomHelper.isElement(last)) {
    paragraph.appendChild(spacer);
  } else {
    spacer.removeFromParent();
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:13,代码来源:ParagraphHelperWebkit.java

示例3: isSpacer

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
/**
 * @param n Node to test, or null
 * @return true if n is a spacer <br/>, WHETHER OR NOT we created it
 *   or the browser's native editor created it
 */
protected boolean isSpacer(Node n) {
  if (n == null) {
    return false;
  }
  if (DomHelper.isTextNode(n)) {
    return false;
  }
  Element e = n.cast();
  return e.getTagName().equalsIgnoreCase(BRElement.TAG) && !NodeManager.hasBackReference(e);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:16,代码来源:ParagraphHelperBr.java

示例4: onRemovingChild

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onRemovingChild(Node child, Element paragraph) {
  Node first = paragraph.getFirstChild();
  BRElement spacer = getSpacer(paragraph);
  if (first == null) {
    appendSpacer(paragraph);
  } else if (first != spacer) {
    spacer.removeFromParent();
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:14,代码来源:ParagraphHelperEmptyLineBr.java

示例5: convertToPlainText

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
/**
 * Converts the given {@code HTML} into robot compatible plaintext.
 *
 * @param html the {@code HTML} to convert.
 * @return a plain text version of the given {@code HTML}.
 */
private static String convertToPlainText(String html) {
  StringBuffer result = new StringBuffer();
  Matcher matcher = MARKUP_PATTERN.matcher(html);
  while (matcher.find()) {
    String replacement = "";
    String tag = matcher.group().substring(1, matcher.group().length() - 1).split(" ")[0];
    if (ParagraphElement.TAG.equalsIgnoreCase(tag) || BRElement.TAG.equalsIgnoreCase(tag)) {
      replacement = "\n";
    }
    matcher.appendReplacement(result, replacement);
  }
  matcher.appendTail(result);
  return result.toString();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:Blip.java

示例6: convertToPlainText

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
/**
 * Converts the given {@code HTML} into robot compatible plain text.
 *
 * @param html the text to convert.
 * @return a plain text version of the given html text.
 */
private static String convertToPlainText(String html) {
  StringBuffer result = new StringBuffer();
  Matcher matcher = MARKUP_PATTERN.matcher(html);
  while (matcher.find()) {
    String replacement = "";
    String tag = matcher.group().substring(1, matcher.group().length() - 1).split(" ")[0];
    if (ParagraphElement.TAG.equalsIgnoreCase(tag) || BRElement.TAG.equalsIgnoreCase(tag)) {
      replacement = "\n";
    }
    matcher.appendReplacement(result, replacement);
  }
  matcher.appendTail(result);
  return result.toString();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:21,代码来源:Markup.java

示例7: setupSpacer

import com.google.gwt.dom.client.BRElement; //导入依赖的package包/类
/**
 * Setup the given br element as the paragraph's spacer
 * @param paragraph
 * @param spacer
 */
private void setupSpacer(Element paragraph, BRElement spacer) {
  NodeManager.setTransparency(spacer, Skip.DEEP);
  paragraph.setPropertyJSO(BR_REF, spacer);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:10,代码来源:ParagraphHelperBr.java


注:本文中的com.google.gwt.dom.client.BRElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。