本文整理匯總了Java中com.google.gwt.dom.client.Document類的典型用法代碼示例。如果您正苦於以下問題:Java Document類的具體用法?Java Document怎麽用?Java Document使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Document類屬於com.google.gwt.dom.client包,在下文中一共展示了Document類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AccessibleCheckBox
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
protected AccessibleCheckBox(Element elem) {
super(DOM.createSpan());
inputElem = InputElement.as(elem);
labelElem = Document.get().createLabelElement();
getElement().appendChild(inputElem);
getElement().appendChild(labelElem);
String uid = DOM.createUniqueId();
inputElem.setPropertyString("id", uid);
labelElem.setHtmlFor(uid);
// Accessibility: setting tab index to be 0 by default, ensuring element
// appears in tab sequence. FocusWidget's setElement method already
// calls setTabIndex, which is overridden below. However, at the time
// that this call is made, inputElem has not been created. So, we have
// to call setTabIndex again, once inputElem has been created.
setTabIndex(0);
}
示例2: getConfig
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
@Override
public GwtApplicationConfiguration getConfig() {
GwtApplicationConfiguration config = new GwtApplicationConfiguration(WIDTH, HEIGHT);
Element element = Document.get().getElementById("embed-html");
VerticalPanel panel = new VerticalPanel();
panel.setWidth("100%");
panel.setHeight("100%");
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
element.appendChild(panel.getElement());
config.rootPanel = panel;
config.width = 2000;
config.height = 2000;
return config;
}
示例3: initModule
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
@Override
protected void initModule(Element element) {
String src = element.getAttribute("src");
int lastSlash = ((src.lastIndexOf("/") > src.lastIndexOf("\\")) ? src.lastIndexOf("/") : src.lastIndexOf("\\"));
String basePath = src.substring(0, lastSlash + 1);
com.google.gwt.dom.client.Element paramNameElement = Document.get().createElement("param");
paramNameElement.setAttribute("name", "movie");
paramNameElement.setAttribute("value", src);
com.google.gwt.dom.client.Element paramBaseElement = Document.get().createElement("param");
paramBaseElement.setAttribute("name", "base");
paramBaseElement.setAttribute("value", basePath);
com.google.gwt.dom.client.Element embedElement = Document.get().createElement("embed");
embedElement.setAttribute("src", src);
embedElement.setAttribute("base", basePath);
panel.getElement().appendChild(paramNameElement);
panel.getElement().appendChild(paramBaseElement);
panel.getElement().appendChild(embedElement);
}
示例4: init
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
@Override
public void init() {
FlowPanel flowPanel = new FlowPanel();
FlashVideo video = FlashVideoFactory.createVideo(source, flowPanel, baseMediaConfiguration.getWidth(), baseMediaConfiguration.getHeight());
flashMedia = video;
if (this.mediaWrapper instanceof SwfMediaWrapper) {
((SwfMediaWrapper) this.mediaWrapper).setMediaWidget(flowPanel);
}
if (baseMediaConfiguration.getNarrationText().trim().length() > 0) {
final TextTrack textTrack = textTrackFactory.getTextTrack(TextTrackKind.SUBTITLES, mediaWrapper);
// FIXME do poprawy gdy narrationScript bedzie zawieral informacje o czasie wyswietlania
// zamiast Double.MAX_VALUE tu powinna sie znalezc wartosc czasowa okreslajaca
// kiedy napis znika poniewaz w tej chwili narrationScript nie posiada takiej informacji
// przypisuje najwieksza dostepna wartosc
textTrack.addCue(new TextTrackCue(Document.get().createUniqueId(), 0, Double.MAX_VALUE, baseMediaConfiguration.getNarrationText()));
eventsBus.addHandlerToSource(MediaEvent.getType(MediaEventTypes.ON_TIME_UPDATE), mediaWrapper, new MediaEventHandler() {
@Override
public void onMediaEvent(MediaEvent event) {
textTrack.setCurrentTime(mediaWrapper.getCurrentTime());
}
}, pageScopeFactory.getCurrentPageScope());
}
super.init();
}
示例5: insertItem
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
/**
* Inserts an item into the list box, specifying its direction and an initial value for the item. If the index is less than zero, or greater than or equal
* to the length of the list, then the item will be appended to the end of the list.
*
* @param item the text of the item to be inserted
* @param dir the item's direction. If {@code null}, the item is displayed in the widget's overall direction, or, if a direction estimator has been set, in
* the item's estimated direction.
* @param value the item's value, to be submitted if it is part of a {@link FormPanel}.
* @param index the index at which to insert it
*/
public void insertItem(String item, Direction dir, String value, int index) {
SelectElement select = getSelectElement();
OptionElement option = Document.get().createOptionElement();
setOptionText(option, item, dir);
option.setValue(value);
int itemCount = select.getLength();
if (index < 0 || index > itemCount) {
index = itemCount;
}
if (index == itemCount) {
select.add(option, null);
} else {
OptionElement before = select.getOptions().getItem(index);
select.add(option, before);
}
}
示例6: ensureInjected
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
/**
* Injects ChartJS if not injected yet.
*/
static void ensureInjected() {
if (!injected) {
// gets resource
Resources res = GWT.create(Resources.class);
// gets source of ChartJS
String source = res.chartJsSource().getText();
// creates a script element
ScriptElement scriptElement = Document.get().createScriptElement();
// sets ID
scriptElement.setId(CHART_JS_SCRIPT_ELEMENT_ID);
// sets the script content with ChartJS source
scriptElement.setInnerText(source);
// appends to the body
Document.get().getBody().appendChild(scriptElement);
injected = true;
}
}
示例7: 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");
}
示例8: createViewerContainer
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
private void createViewerContainer(Document document, DivElement mainContainer) {
viewerContainer = createChildDiv(document, mainContainer, "viewerContainer");
viewerContainer.setTabIndex(0); // keyboard scrolling does not work without this tabindex
viewer = createChildDiv(document, viewerContainer, "viewer");
viewer.addClassName("pdfViewer");
overlayContainer = createChildDiv(document, outerContainer, "overlayContainer");
overlayContainer.addClassName("hidden");
passwordOverlay = createChildDiv(document, overlayContainer, "passwordOverlay");
passwordOverlay.addClassName("container");
passwordOverlay.addClassName("hidden");
createDocumentPropertiesOverlay(document, overlayContainer);
createPrintServiceOverlay(document, overlayContainer);
}
示例9: createPrintServiceOverlay
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
private void createPrintServiceOverlay(Document document, DivElement parent) {
printServiceOverlay = createChildDiv(document, parent, "printServiceOverlay");
printServiceOverlay.addClassName("container");
printServiceOverlay.addClassName("hidden");
DivElement dialog = createChildDiv(document, printServiceOverlay, "dialog");
DivElement row1 = createChildDiv(document, dialog, "row");
SpanElement message = createChildSpan(document, row1, "");
message.setInnerText("Preparing document for printing!");
DivElement row2 = createChildDiv(document, dialog, "row");
createChildProgress(document, row2, 0, 100);
SpanElement relativeProgressSpan = createChildSpan(document, row2, "relative-progress");
relativeProgressSpan.setInnerText("0%");
DivElement row3 = createChildDiv(document, dialog, "row");
printCancel = createChildButton(document, row3, "printCancel");
printCancel.addClassName("overlayButton");
SpanElement printCancelMessage = createChildSpan(document, printCancel, "");
printCancelMessage.setInnerText("Cancel");
}
示例10: testClickLink
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
@DoNotRunWith(Platform.HtmlUnitUnknown)
public void testClickLink() {
AnchorElement anchorElement = Document.get().createAnchorElement();
anchorElement.setHref("#href1");
Document.get().getBody().appendChild(anchorElement);
try {
History.newItem("something_as_base");
addHistoryListenerImpl(
event -> {
assertEquals("href1", event.getValue());
finishTest();
});
delayTestFinish(5000);
NativeEvent clickEvent =
Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false);
anchorElement.dispatchEvent(clickEvent);
} finally {
Document.get().getBody().removeChild(anchorElement);
}
}
示例11: testRevertEmptyElement
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
public void testRevertEmptyElement() {
init();
initEmptyP();
c.insertBefore(root, p, null);
// essentially a noop
assertTrue(p.isConsistent());
p.revertImplementation();
assertTrue(p.isConsistent());
// add some random text node
p.getImplNodelet().appendChild(Document.get().createTextNode("blah"));
p.revertImplementation();
assertEquals(null, p.getImplNodelet().getFirstChild());
p.getImplNodelet().appendChild(ca());
p.revertImplementation();
assertEquals(null, p.getImplNodelet().getFirstChild());
p.getImplNodelet().appendChild(ca());
p.revertImplementation();
assertEquals(null, p.getImplNodelet().getFirstChild());
l.check(0, 0); // calls through revertInner, so none reported
}
示例12: isSupported
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
public static boolean isSupported(FileFormat format)
{
if (tempAudioElement == null)
tempAudioElement = Document.get().createAudioElement();
switch (format)
{
case MP3:
return !tempAudioElement.canPlayType(AudioElement.TYPE_MP3).equals(MediaElement.CANNOT_PLAY);
case WAV:
return !tempAudioElement.canPlayType(AudioElement.TYPE_WAV).equals(MediaElement.CANNOT_PLAY);
case OGG:
return !tempAudioElement.canPlayType(AudioElement.TYPE_OGG).equals(MediaElement.CANNOT_PLAY);
case WEBM:
return !tempAudioElement.canPlayType("audio/webm").equals(MediaElement.CANNOT_PLAY);
}
return false;
}
示例13: gwtSetUp
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
@Override
protected void gwtSetUp() {
SafeHtml dom = EscapeUtils.fromSafeConstant("" + // \u2620
"<div id='base' kind='base'>" + // \u2620
" <div>" + // \u2620
" <div kind='foo' id='foo'>" + // \u2620
" <div kind='unused'>" + // \u2620
" <div kind='bar' id='bar'>" + // \u2620
" <div id='source'></div>" + // \u2620
" </div>" + // \u2620
" </div>" + // \u2620
" </div>" + // \u2620
" </div>" + // \u2620
"</div>");
top = load(dom);
foo = Document.get().getElementById("foo");
bar = Document.get().getElementById("bar");
// Register some handlers.
handlers = new MockHandlers(top);
fooHandler = new MyHandler();
barHandler = new MyHandler();
handlers.register("foo", fooHandler);
handlers.register("bar", barHandler);
}
示例14: testDeleteWithRangeSelectedDeletesRange
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
public void testDeleteWithRangeSelectedDeletesRange() {
FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.DELETE, KeyCodes.KEY_LEFT);
//Event event = Document.get().createKeyPressEvent(
// false, false, false, false, KeyCodes.KEY_BACKSPACE, 0).cast();
Text input = Document.get().createTextNode("ABCDE");
ContentNode node = new ContentTextNode(input, null);
final Point<ContentNode> start = Point.inText(node, 1);
final Point<ContentNode> end = Point.inText(node, 4);
FakeEditorInteractor interactor = setupFakeEditorInteractor(
new FocusedContentRange(start, end));
EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);
interactor.call(FakeEditorInteractor.DELETE_RANGE).nOf(1).withArgs(
start, end, false).returns(start);
handler.handleEvent(fakeEvent);
interactor.checkExpectations();
}
示例15: UploadFormPopup
import com.google.gwt.dom.client.Document; //導入依賴的package包/類
/**
* Creates an upload popup.
*/
public UploadFormPopup() {
form = BINDER.createAndBindUi(this);
PopupChrome chrome = PopupChromeFactory.createPopupChrome();
chrome.enableTitleBar();
popup = PopupFactory.createPopup(null, new CenterPopupPositioner(), chrome, false);
popup.getTitleBar().setTitleText("Upload attachment");
popup.add(form);
iframe = Document.get().createIFrameElement();
iframe.setName("_uploadform" + iframeId++);
// HACK(danilatos): Prevent browser from caching due to whatever reason
iframe.setSrc("/uploadform?nocache=" + Duration.currentTimeMillis());
form.getElement().setAttribute("target", iframe.getName());
onloadRegistration =
DomHelper.registerEventHandler(iframe, "load", new JavaScriptEventListener() {
@Override
public void onJavaScriptEvent(String name, Event event) {
onIframeLoad();
}
});
UIObject.setVisible(iframe, false);
}