本文整理汇总了Java中com.google.gwt.dom.client.DivElement.appendChild方法的典型用法代码示例。如果您正苦于以下问题:Java DivElement.appendChild方法的具体用法?Java DivElement.appendChild怎么用?Java DivElement.appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.DivElement
的用法示例。
在下文中一共展示了DivElement.appendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TaskList
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
protected TaskList(PageTransitionPanel parent, Controls controls,
Controller controller, TaskList.Resources resources) {
super(parent, controls, resources);
this.controller = controller;
this.resources = resources;
urgentNotImportantTasks = Document.get().createDivElement();
urgentImportantTasks = Document.get().createDivElement();
notUrgentNotImportantTasks = Document.get().createDivElement();
notUrgentImportantTasks = Document.get().createDivElement();
Element container = getContentContainer();
container.appendChild(urgentImportantTasks);
container.appendChild(notUrgentImportantTasks);
container.appendChild(urgentNotImportantTasks);
container.appendChild(notUrgentNotImportantTasks);
userEmail = Document.get().createDivElement();
userEmail.getStyle().setProperty("display", "inline-block");
userEmail.setInnerText("Loading...");
logoutLink = Document.get().createAnchorElement();
DivElement userInfoContainer = Document.get().createDivElement();
userInfoContainer.appendChild(userEmail);
userInfoContainer.appendChild(logoutLink);
userInfoContainer.setClassName(resources.taskListCss().user());
container.appendChild(userInfoContainer);
}
示例2: wrapHotKey
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
private static Element wrapHotKey(String hotKey, String description, boolean global) {
final DivElement containerDiv = Document.get().createDivElement();
final DivElement hotKeyDiv = Document.get().createDivElement();
final DivElement descriptionDiv = Document.get().createDivElement();
hotKeyDiv.setInnerText(hotKey);
descriptionDiv.setInnerText(description);
containerDiv.setClassName("divRow");
hotKeyDiv.setClassName("divCell");
hotKeyDiv.addClassName("hotKey");
descriptionDiv.setClassName("divCell");
descriptionDiv.addClassName("description");
containerDiv.appendChild(hotKeyDiv);
containerDiv.appendChild(descriptionDiv);
return containerDiv;
}
示例3: TaskRow
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
public TaskRow(Element parentElem, Task data) {
super(parentElem);
this.data = data;
Element myElem = getElement();
TaskList.Css css = resources.taskListCss();
myElem.setClassName(css.taskRow());
titleElem = Document.get().createDivElement();
titleElem.setClassName(css.title());
DivElement rightMask = Document.get().createDivElement();
rightMask.setClassName(css.checkBoxContainer());
checkMark = Document.get().createDivElement();
rightMask.appendChild(checkMark);
myElem.appendChild(titleElem);
myElem.appendChild(rightMask);
renderTask();
hookEventListeners();
}
示例4: VSwitch
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
/**
* The constructor should first call super() to initialize the component and
* then handle any initialization relevant to Vaadin.
*/
public VSwitch() {
// Change to proper element or remove if extending another widget
setElement(Document.get().createDivElement());
DivElement el = Document.get().createDivElement();
el.addClassName(CLASSNAME + "-wrapper");
mainElement = Document.get().createDivElement();
// This method call of the Paintable interface sets the component
// style name in DOM tree
mainElement.setClassName(CLASSNAME);
el.appendChild(mainElement);
getElement().appendChild(el);
// build the DOM
slider = Document.get().createDivElement();
slider.setClassName(CLASSNAME + "-slider");
mainElement.appendChild(slider);
updateVisibleState(true); // Set the initial position without animation.
addHandlers();
}
示例5: refresh
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
private void refresh()
{
// Clear any previous items
selectedItems.clear();
lastSelectedIndex = 0;
data.clear();
data.getElement().appendChild(headerRow);
itemDivs = new DivElement[this.showingItems.size()];
for (int i = 0; i < this.showingItems.size(); i++)
{
T item = this.showingItems.get(i);
DivElement itemDiv = Document.get().createDivElement();
itemDiv.addClassName(itemDescriptor.getItemStyle());
String[] values = itemDescriptor.getValues(item);
for (int j = 0; j < values.length; j++)
{
FieldDescriptor<T> f = itemDescriptor.getFields().get(j);
DivElement fieldDiv = Document.get().createDivElement();
fieldDiv.setId(f.getId() + ":" + i);
fieldDiv.addClassName(f.getStyle());
fieldDiv.setInnerText(values[j]);
itemDiv.appendChild(fieldDiv);
}
itemDivs[i] = itemDiv;
}
expando(data, itemDivs);
}
示例6: getJointContainer
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Element getJointContainer(Joint joint) {
Element jointElement;
switch (joint) {
case COLLAPSED:
OMSVGSVGElement svg = treeStyles.iconCollapsed().getSvg();
svg.addClassNameBaseVal(treeStyles.styles().jointContainer());
svg.setWidth(Style.Unit.PX, 16.f);
svg.setHeight(Style.Unit.PX, 16.f);
jointElement = svg.getElement();
break;
case EXPANDED:
OMSVGSVGElement svg1 = treeStyles.iconExpanded().getSvg();
svg1.addClassNameBaseVal(treeStyles.styles().jointContainer());
svg1.setWidth(Style.Unit.PX, 16.f);
svg1.setHeight(Style.Unit.PX, 16.f);
jointElement = svg1.getElement();
break;
default:
OMSVGSVGElement svgsvgElement = OMSVGParser.currentDocument().createSVGSVGElement();
svgsvgElement.addClassNameBaseVal(treeStyles.styles().jointContainer());
svgsvgElement.setWidth(Style.Unit.PX, 16.f);
svgsvgElement.setHeight(Style.Unit.PX, 16.f);
jointElement = svgsvgElement.getElement();
}
DivElement wrapper = Document.get().createDivElement();
wrapper.appendChild(jointElement);
return jointElement;
}
示例7: getPresentableTextContainer
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Element getPresentableTextContainer(Element content) {
DivElement divElement = Document.get().createDivElement();
divElement.setClassName(treeStyles.styles().presentableTextContainer());
divElement.appendChild(content);
return divElement;
}
示例8: getInfoTextContainer
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Element getInfoTextContainer(Element content) {
DivElement divElement = Document.get().createDivElement();
divElement.setClassName(treeStyles.styles().infoTextContainer());
divElement.appendChild(content);
return divElement;
}
示例9: addItem
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
protected void addItem(String iconClass, String id, String name, String description, Command onClicked) {
Element nameEl = onClicked != null ? Document.get().createAnchorElement() : Document.get().createSpanElement();
nameEl.setInnerText(name);
nameEl.setClassName(onClicked != null ? "uf-navtree-widget-non-clicked" : "uf-navtree-widget-non-clickable");
if (description != null && !description.equals(name)) {
nameEl.setTitle(description);
}
SpanElement iconSpan = Document.get().createSpanElement();
iconSpan.setClassName("uf-navtree-widget-icon " + iconClass);
DivElement div = Document.get().createDivElement();
div.appendChild(iconSpan);
div.appendChild(nameEl);
navWidget.appendChild((Node) div);
itemMap.put(id, nameEl);
if (onClicked != null) {
Event.sinkEvents(nameEl, Event.ONCLICK);
Event.setEventListener(nameEl, event -> {
if (Event.ONCLICK == event.getTypeInt()) {
onClicked.execute();
}
});
}
}
示例10: createItemDiv
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
private DivElement createItemDiv(Element[] items) {
DivElement mi = Document.get().createDivElement();
mi.setClassName("list-view-pf-main-info");
mi.getStyle().setPaddingTop(5, Style.Unit.PX);
mi.getStyle().setPaddingBottom(5, Style.Unit.PX);
for (Element item : items) {
mi.appendChild(item);
}
DivElement gi = Document.get().createDivElement();
gi.setClassName("list-group-item");
gi.appendChild(mi);
return gi;
}
示例11: AbstractStepWidget
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
public AbstractStepWidget() {
DivElement bar = DivElement.as(DOM.createDiv());
bar.setClassName(STYLE_BAR);
setElement(bar);
caption = DivElement.as(DOM.createDiv());
caption.setClassName(STYLE_BAR_LABEL);
bar.appendChild(caption);
// hide by default
bar.getStyle().setVisibility(Visibility.HIDDEN);
}
示例12: createLabelledFieldGroup
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
private DivElement createLabelledFieldGroup(String labelText, Element field) {
DivElement fieldGroup = Document.get().createDivElement();
fieldGroup.setClassName(resources.taskDetailsCss().fieldGroup());
DivElement label = Document.get().createDivElement();
label.setInnerText(labelText);
label.setClassName(resources.taskDetailsCss().label());
field.setClassName(resources.taskDetailsCss().field());
fieldGroup.appendChild(label);
fieldGroup.appendChild(field);
return fieldGroup;
}
示例13: CubeePanel
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
public CubeePanel(DivElement element) {
this.element = element;
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
requestLayout();
}
});
this.contentPanel = new Panel();
this.contentPanel.getElement().getStyle().setProperty("pointerEvents", "none");
this.contentPanel.pointerTransparentProperty().set(true);
this.contentPanel.setCubeePanel(this);
element.appendChild(this.contentPanel.getElement());
checkBounds();
requestLayout();
new Timer() {
@Override
public void run() {
EventQueue.getInstance().invokeLater(new Runnable() {
@Override
public void run() {
checkBounds();
}
});
}
}.scheduleRepeating(100);
}
示例14: getVerticalScrollbarWidth
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
private static int getVerticalScrollbarWidth() {
// We only calculate the vertical scroll bar width once, then we store it in the static field
// verticalScrollbarWidth. If the field is non-zero, we don't need to calculate it again.
if (verticalScrollbarWidth == 0) {
// The following code will calculate (on the fly) the width of a vertical scroll bar.
// We'll create two divs, one inside the other and add the outer div to the document body,
// but off-screen where the user won't see it.
// We'll measure the width of the inner div twice: (first) when the outer div's vertical
// scrollbar is hidden and (second) when the outer div's vertical scrollbar is visible.
// The width of inner div will be smaller when outer div's vertical scrollbar is visible.
// By subtracting the two measurements, we can calculate the width of the vertical scrollbar.
// I used code from the following websites as reference material:
// http://jdsharp.us/jQuery/minute/calculate-scrollbar-width.php
// http://www.fleegix.org/articles/2006-05-30-getting-the-scrollbar-width-in-pixels
Document document = Document.get();
// Create an outer div.
DivElement outerDiv = document.createDivElement();
Style outerDivStyle = outerDiv.getStyle();
// Use absolute positioning and set the top/left so that it is off-screen.
// We don't want the user to see anything while we do this calculation.
outerDivStyle.setProperty("position", "absolute");
outerDivStyle.setProperty("top", "-1000px");
outerDivStyle.setProperty("left", "-1000px");
// Set the width and height of the outer div to a fixed size in pixels.
outerDivStyle.setProperty("width", "100px");
outerDivStyle.setProperty("height", "50px");
// Hide the outer div's scrollbar by setting the "overflow" property to "hidden".
outerDivStyle.setProperty("overflow", "hidden");
// Create an inner div and put it inside the outer div.
DivElement innerDiv = document.createDivElement();
Style innerDivStyle = innerDiv.getStyle();
// Set the height of the inner div to be 4 times the height of the outer div so that a
// vertical scrollbar will be necessary (but hidden for now) on the outer div.
innerDivStyle.setProperty("height", "200px");
outerDiv.appendChild(innerDiv);
// Temporarily add the outer div to the document body. It's off-screen so the user won't
// actually see anything.
Element bodyElement = document.getElementsByTagName("body").getItem(0);
bodyElement.appendChild(outerDiv);
// Get the width of the inner div while the outer div's vertical scrollbar is hidden.
int widthWithoutScrollbar = innerDiv.getOffsetWidth();
// Show the outer div's vertical scrollbar by setting the "overflow" property to "auto".
outerDivStyle.setProperty("overflow", "auto");
// Now, get the width of the inner div while the vertical scrollbar is visible.
int widthWithScrollbar = innerDiv.getOffsetWidth();
// Remove the outer div from the document body.
bodyElement.removeChild(outerDiv);
// Calculate the width of the vertical scrollbar by subtracting the two widths.
verticalScrollbarWidth = widthWithoutScrollbar - widthWithScrollbar;
}
return verticalScrollbarWidth;
}
示例15: DataTable
import com.google.gwt.dom.client.DivElement; //导入方法依赖的package包/类
public DataTable()
{
// wrapper Div
wrapper = Document.get().createDivElement();
wrapper.getStyle().setPosition( Position.RELATIVE );
wrapper.setTabIndex( 0 ); // for focusability
// headings table
theadTable = Document.get().createTableElement();
theadTable.setClassName( "table" );
theadTable.getStyle().setWidth( 100, Unit.PCT );
theadTable.getStyle().setTableLayout( TableLayout.FIXED );
headTableColgroup = Document.get().createElement( "colgroup" );
// headings elements
thead = Document.get().createTHeadElement();
theadtr = Document.get().createTRElement();
// main table
table = Document.get().createTableElement();
table.setClassName( "table" );
table.getStyle().setWidth( 100, Unit.PCT );
table.getStyle().setTableLayout( TableLayout.FIXED );
tableColgroup = Document.get().createElement( "colgroup" );
// table body
tbody = Document.get().createTBodyElement();
// wrapper table
wrapperTable = Document.get().createTableElement();
wrapperTable.getStyle().setTableLayout( TableLayout.FIXED );
wrapperTable.getStyle().setWidth( 100, Unit.PCT );
wrapperTable.getStyle().setHeight( 100, Unit.PCT );
TableRowElement tr0 = Document.get().createTRElement();
TableCellElement td0 = Document.get().createTDElement();
DivElement div0 = Document.get().createDivElement();
div0.getStyle().setWidth( 100, Unit.PCT );
TableRowElement tr1 = Document.get().createTRElement();
tr1.getStyle().setHeight( 100, Unit.PCT );
TableCellElement td1 = Document.get().createTDElement();
DivElement div1 = Document.get().createDivElement();
div1.getStyle().setHeight( 100, Unit.PCT );
div1.getStyle().setWidth( 100, Unit.PCT );
div1.getStyle().setPosition( Position.RELATIVE );
DivElement div2 = Document.get().createDivElement();
div2.getStyle().setPosition( Position.ABSOLUTE );
div2.getStyle().setTop( 0, Unit.PX );
div2.getStyle().setLeft( 0, Unit.PX );
div2.getStyle().setRight( 0, Unit.PX );
div2.getStyle().setBottom( 0, Unit.PX );
div2.getStyle().setOverflow( Overflow.AUTO );
// bind together
theadTable.appendChild( headTableColgroup );
theadTable.appendChild( thead.<Node> cast() );
thead.appendChild( theadtr.<Node> cast() );
table.appendChild( tableColgroup );
table.appendChild( tbody.<Node> cast() );
td0.appendChild( div0 );
div0.appendChild( theadTable.<Node> cast() );
div1.appendChild( div2 );
div2.appendChild( table );
td1.appendChild( div1.<Node> cast() );
tr0.appendChild( td0 );
tr1.appendChild( td1 );
wrapperTable.appendChild( tr0 );
wrapperTable.appendChild( tr1 );
wrapper.appendChild( wrapperTable );
customPanel = new CustomPanel( wrapper );
initWidget( customPanel );
setStylePrimaryName( CSS.main() );
}