本文整理汇总了Java中com.google.gwt.dom.client.HeadingElement类的典型用法代码示例。如果您正苦于以下问题:Java HeadingElement类的具体用法?Java HeadingElement怎么用?Java HeadingElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HeadingElement类属于com.google.gwt.dom.client包,在下文中一共展示了HeadingElement类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractChart
import com.google.gwt.dom.client.HeadingElement; //导入依赖的package包/类
/**
* Initializes HTMl elements (DIV and Canvas).<br>
* It sets also some default behaviors (width in percentage) for resizing
*/
public AbstractChart() {
// creates DIV
div = Document.get().createDivElement();
div.setId(id);
// sets relative position
div.getStyle().setPosition(Position.RELATIVE);
// sets default width values
div.getStyle().setWidth(DEFAULT_PCT_WIDTH, Unit.PCT);
div.getStyle().setHeight(100, Unit.PCT);
// checks if canvas is supported
if (isCanvasSupported) {
// creates a canvas and add to DIV
canvas = Document.get().createCanvasElement();
div.appendChild(canvas);
} else {
// creates a header element
HeadingElement h = Document.get().createHElement(3);
// to show the error message
// because canvas is not supported
h.setInnerText(CANVAS_NOT_SUPPORTED_MESSAGE);
div.appendChild(h);
// resets canvas
canvas = null;
}
// sets DIV as element of the widget
setElement(div);
// injects Chart.js java script source
Injector.ensureInjected();
// creates plugins container
plugins = new Plugins(this);
// creates global options
options = new GlobalOptions(createGlobalOptions(getType().name()));
}
示例2: createHeading
import com.google.gwt.dom.client.HeadingElement; //导入依赖的package包/类
public static HeadingElement createHeading(int n, String value) {
HeadingElement h = Document.get().createHElement(n);
h.setInnerHTML(value);
return h;
}
示例3: updatePreview
import com.google.gwt.dom.client.HeadingElement; //导入依赖的package包/类
private void updatePreview () {
pnlPreview.getElement().removeAllChildren();
Document d = Document.get();
HeadingElement title = d.createHElement(1);
title.setInnerHTML(PostHelper.makeHeading(txtTitle.getValue()));
pnlPreview.getElement().appendChild(title);
User user = SessionController.get().user();
DivElement elDate = d.createDivElement();
if (post != null) {
if (post.published == null) {
elDate.setInnerSafeHtml(PostSummaryCell.Templates.INSTANCE
.notPublished(DateTimeHelper.ago(post.created)));
} else {
elDate.setInnerSafeHtml(PostSummaryCell.Templates.INSTANCE
.publishedDate(DateTimeHelper.ago(post.published)));
}
} else {
elDate.setInnerSafeHtml(PostSummaryCell.Templates.INSTANCE
.notPublished(DateTimeHelper.ago(new Date())));
}
pnlPreview.getElement().appendChild(elDate);
DivElement elAuthor = d.createDivElement();
if (PropertyController.get()
.booleanProperty(PropertyHelper.POST_SHOW_AUTHOR, false)) {
elAuthor.setInnerSafeHtml(PostSummaryCell.Templates.INSTANCE.author(
UriUtils.fromString(
(post != null ? post.author.avatar : user.avatar)
+ "?s=" + UserHelper.AVATAR_HEADER_SIZE
+ "&default=retro"),
UserHelper.handle((post != null ? post.author : user))));
}
pnlPreview.getElement().appendChild(elAuthor);
tagList.getList().clear();
List<String> tags = TagHelper.convertToTagList(txtTags.getValue());
if (tags != null) {
for (String tag : tags) {
tagList.getList().add(new Tag().name(tag));
}
}
DivElement summary = d.createDivElement();
summary.setInnerHTML(markup(txtSummary));
pnlPreview.getElement().appendChild(summary);
DivElement content = d.createDivElement();
content.setInnerHTML(markup(txtContent));
pnlPreview.getElement().appendChild(content);
}