當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。