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


Java Document.get方法代码示例

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


在下文中一共展示了Document.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WTPdfViewerWidget

import com.google.gwt.dom.client.Document; //导入方法依赖的package包/类
public WTPdfViewerWidget() {
	Document document = Document.get();
	root = document.createDivElement();
	root.addClassName("loadingInProgress");

	outerContainer = createChildDiv(document, root, "outerContainer");
	createSidebar(document, outerContainer);

	mainContainer = createChildDiv(document, outerContainer, "mainContainer");
	createFindBar(document, mainContainer);
	//the toolbar on the right that opens after click on double arrow on the right
	createSecondaryToolbar(document, mainContainer);
	createMainToolbar(document, mainContainer);

	loadingBar = createChildDiv_withId(document, mainContainer, "loadingBar");
	progress = createChildDiv_withId(document, loadingBar, "progress");

	createViewerContainer(document, mainContainer);
	printContainer = createChildDiv(document, root, "printContainer");

	setElement(root);
	startWebViewerLoad(this);

	setStyleName("wtpdfviewer");
}
 
开发者ID:WhitesteinTechnologies,项目名称:wt-pdf-viewer,代码行数:26,代码来源:WTPdfViewerWidget.java

示例2: parseNode

import com.google.gwt.dom.client.Document; //导入方法依赖的package包/类
/**
 * Parsuje pojedynczy wezel xml-a i generuje reprezentacje w postaci widgeta. Widget jest dodawany do parentElement
 *
 * @param currNode
 * @param parentElement
 * @return
 */
protected com.google.gwt.dom.client.Element parseNode(Node currNode, com.google.gwt.dom.client.Element parentElement) {
    if (currNode.getNodeType() == Node.ELEMENT_NODE) {
        if (options.getIgnoredInlineTags().contains(currNode.getNodeName())) {
            return parentElement;
        } else if (modulesRegistrySocket.isModuleSupported(currNode.getNodeName()) && modulesRegistrySocket.isInlineModule(currNode.getNodeName())) {
            IModule module = modulesRegistrySocket.createModule((Element) currNode);
            if (module instanceof IInlineModule) {
                parenthood.addChild(module);
                ((IInlineModule) module).initModule((Element) currNode, moduleSocket, eventsBus);
                Widget moduleView = ((IInlineModule) module).getView();
                if (moduleView != null) {
                    parentElement.appendChild(moduleView.getElement());
                }
                if (module instanceof IInlineContainerModule) {
                    parenthood.pushParent((IInlineContainerModule) module);
                    parseElementNode(currNode, parentElement);
                    parenthood.popParent();
                }
            }
        } else {
            parseElementNode(currNode, parentElement);
        }
    } else if (currNode.getNodeType() == Node.TEXT_NODE) {
        Document doc = Document.get();
        com.google.gwt.dom.client.SpanElement span = doc.createSpanElement();
        span.appendChild(doc.createTextNode(currNode.getNodeValue()));
        span.setClassName(styleNames.QP_TEXT());
        parentElement.appendChild(span);
    }
    return parentElement;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:39,代码来源:InlineBodyGenerator.java

示例3: onModuleLoad

import com.google.gwt.dom.client.Document; //导入方法依赖的package包/类
public void onModuleLoad() {
	final String linkTxt = Resources.INSTANCE.linkTxt().getText();
	final Document document = Document.get();
	HeadElement headElement = document.getHead();
	if (headElement == null) {
		headElement = document.createHeadElement();
		document.appendChild(headElement);
	}
	LinkElement linkElement = document.createLinkElement();
	linkElement.setType("text/css");
	linkElement.setRel("stylesheet");
	linkElement.setHref(linkTxt);
	headElement.appendChild(linkElement);
}
 
开发者ID:ainslec,项目名称:gwt-promptly,代码行数:15,代码来源:Init.java

示例4: getVerticalScrollbarWidth

import com.google.gwt.dom.client.Document; //导入方法依赖的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;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:62,代码来源:MockForm.java

示例5: setBrowserWindowTitle

import com.google.gwt.dom.client.Document; //导入方法依赖的package包/类
public void setBrowserWindowTitle (String newTitle) {
	if (Document.get() != null) {
		Document.get().setTitle (newTitle);
	}
}
 
开发者ID:dpinney,项目名称:essence,代码行数:6,代码来源:EssenceFrontEnd.java


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