本文整理汇总了Java中elemental2.dom.DomGlobal类的典型用法代码示例。如果您正苦于以下问题:Java DomGlobal类的具体用法?Java DomGlobal怎么用?Java DomGlobal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DomGlobal类属于elemental2.dom包,在下文中一共展示了DomGlobal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: componentWillMount
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@Override
protected void componentWillMount()
{
final Props props = props();
_externalWindow = DomGlobal.window.open( "",
props.windowName,
"width=" + props.width + ",height=" + props.height +
",left=" + props.left + ",top=" + props.top );
_externalWindow.addEventListener( "beforeunload", e -> {
final OnCloseCallback onClose = props.onClose;
if ( null != onClose )
{
onClose.onClose();
}
} );
final HTMLDocument document = getWindowDocument();
_element = document.createElement( "div" );
while ( document.body.childNodes.length > 0 )
{
//Unchecked cast as it is from a different window.
document.body.removeChild( Js.uncheckedCast( document.body.childNodes.item( 0 ) ) );
}
document.body.appendChild( _element );
}
开发者ID:react4j,项目名称:react4j,代码行数:25,代码来源:WindowPortal.java
示例2: setHash
import elemental2.dom.DomGlobal; //导入依赖的package包/类
private void setHash( @Nonnull final String hash )
{
if ( 0 == hash.length() )
{
/*
* This code is needed to remove the stray #.
* See https://stackoverflow.com/questions/1397329/how-to-remove-the-hash-from-window-location-url-with-javascript-without-page-r/5298684#5298684
*/
final String url = DomGlobal.window.location.getPathname() + DomGlobal.window.location.getSearch();
DomGlobal.window.history.pushState( "", DomGlobal.document.title, url );
}
else
{
DomGlobal.window.location.setHash( hash );
}
}
开发者ID:arez,项目名称:arez,代码行数:17,代码来源:BrowserLocation.java
示例3: log
import elemental2.dom.DomGlobal; //导入依赖的package包/类
/**
* Log specified message with parameters
*
* @param delta the nesting delta.
* @param message the message.
* @param styling the styling parameter. It is assumed that the message has a %c somewhere in it to identify the start of the styling.
*/
protected void log( @Nonnull final SpyUtil.NestingDelta delta,
@Nonnull final String message,
@CssRules @Nonnull final String styling )
{
if ( SpyUtil.NestingDelta.INCREASE == delta )
{
DomGlobal.console.groupCollapsed( message, styling );
}
else if ( SpyUtil.NestingDelta.DECREASE == delta )
{
DomGlobal.console.log( message, styling );
DomGlobal.console.groupEnd();
}
else
{
DomGlobal.console.log( message, styling );
}
}
开发者ID:arez,项目名称:arez,代码行数:26,代码来源:ConsoleSpyEventProcessor.java
示例4: onModuleLoad
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@Override
public void onModuleLoad()
{
final BrowserLocation browserLocation = BrowserLocation.create();
Arez.context().autorun( true, () -> cleanLocation( browserLocation ) );
Arez.context().autorun( () -> printBrowserLocation( browserLocation ) );
DomGlobal.document.querySelector( "#route_base" ).
addEventListener( "click", e -> browserLocation.changeLocation( "" ) );
DomGlobal.document.querySelector( "#route_slash" ).
addEventListener( "click", e -> browserLocation.changeLocation( "/" ) );
DomGlobal.document.querySelector( "#route_event" ).
addEventListener( "click", e -> browserLocation.changeLocation( "/event" ) );
DomGlobal.document.querySelector( "#route_other" ).
addEventListener( "click", e -> browserLocation.changeLocation( "/other" ) );
}
开发者ID:arez,项目名称:arez,代码行数:18,代码来源:BrowserLocationExample.java
示例5: outputStatus
import elemental2.dom.DomGlobal; //导入依赖的package包/类
private void outputStatus( @Nonnull final ObservablePromise<Response, Object> observablePromise )
{
final ObservablePromise.State state = observablePromise.getState();
final Response response = ObservablePromise.State.FULFILLED == state ? observablePromise.getValue() : null;
final elemental2.core.JsError error =
ObservablePromise.State.REJECTED == state ? Js.cast( observablePromise.getError() ) : null;
final String message =
"Promise State: " + state +
( null != response ? " - Response: " + response.status + ": " + response.statusText : "" ) +
( null != error ? " - Error: " + error.message : "" );
DomGlobal.console.log( message );
DomGlobal.document.querySelector( "#app" ).textContent = message;
}
开发者ID:arez,项目名称:arez,代码行数:14,代码来源:ObservablePromiseExample.java
示例6: onModuleLoad
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@Override
public void onModuleLoad()
{
final IntervalTicker ticker = IntervalTicker.create( 1000 );
final Observer observer = Arez.context().autorun( () -> {
if ( !Disposable.isDisposed( ticker ) )
{
DomGlobal.console.log( "Tick: " + ticker.getTickTime() );
}
else
{
DomGlobal.console.log( "Ticker disposed!" );
}
} );
TimedDisposer.create( Disposable.asDisposable( ticker ), 5500 );
TimedDisposer.create( Disposable.asDisposable( observer ), 7000 );
}
开发者ID:arez,项目名称:arez,代码行数:18,代码来源:TimedDisposerExample.java
示例7: addExample
import elemental2.dom.DomGlobal; //导入依赖的package包/类
private static void addExample(String exampleId, VueFactory exampleVueFactory)
{
// If we find the containing div for this example, we instantiate it
if (DomGlobal.document.getElementById(exampleId) != null)
{
VueComponent exampleInstance = Vue.attach("#" + exampleId, exampleVueFactory);
((JsPropertyMap) DomGlobal.window).set(exampleId, exampleInstance);
}
}
开发者ID:Axellience,项目名称:vue-gwt,代码行数:10,代码来源:VueGwtExamplesService.java
示例8: doUpdate
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@Override
public void doUpdate(Person person) {
try {
PersonService.get()
.update(person);
if (ClientContext.get()
.getPersonSearch() == null) {
eventBus.gotoSearch("",
"");
} else {
eventBus.gotoList(ClientContext.get()
.getPersonSearch()
.getName(),
ClientContext.get()
.getPersonSearch()
.getCity());
}
} catch (PersonException e) {
DomGlobal.window.alert("Panic!");
}
}
开发者ID:mvp4g,项目名称:mvp4g2-examples,代码行数:22,代码来源:DetailPresenter.java
示例9: whenReady
import elemental2.dom.DomGlobal; //导入依赖的package包/类
public static void whenReady(boolean debug, OnloadFn function){
HTMLScriptElement leafletScript = (HTMLScriptElement) DomGlobal.document.createElement("script");
if (debug) {
leafletScript.src = GWT.getModuleName() + "/leaflet/leaflet-src.js";
} else {
leafletScript.src = GWT.getModuleName() + "/leaflet/leaflet.js";
}
leafletScript.type="text/javascript";
HTMLLinkElement leafletStyle = (HTMLLinkElement) DomGlobal.document.createElement("link");
leafletStyle.href=GWT.getModuleName()+"/leaflet/leaflet.css";
leafletStyle.rel="stylesheet";
DomGlobal.document.head.appendChild(leafletScript);
DomGlobal.document.head.appendChild(leafletStyle);
leafletScript.onload = function;
}
开发者ID:gwidgets,项目名称:gwty-leaflet,代码行数:20,代码来源:LeafletResources.java
示例10: testMapZoom
import elemental2.dom.DomGlobal; //导入依赖的package包/类
public void testMapZoom(){
InjectedLeafletResources.whenReady((e) -> {
HTMLElement div = (HTMLElement) DomGlobal.document.createElement("div");
div.id = "test3";
DomGlobal.document.body.appendChild(div);
MapOptions options = new MapOptions.Builder(L.latLng(52.51, 13.40), 12.0, 7.0).dragging(true).maxZoom(20.0).build();
Map map = L.map("test3", options);
assertNotNull(map);
assertEquals(String.valueOf(map.getZoom()), "12");
assertEquals(String.valueOf(map.getMinZoom()), "7");
assertEquals(String.valueOf(map.getMaxZoom()), "20");
//Zoom In method has weird behavior *** Fails
map.zoomOut(5.0, null);
assertEquals("7", map.getZoom().toString());
return null;
});
}
开发者ID:gwidgets,项目名称:gwty-leaflet,代码行数:21,代码来源:MapTest.java
示例11: testMapPan
import elemental2.dom.DomGlobal; //导入依赖的package包/类
public void testMapPan(){
InjectedLeafletResources.whenReady((e) -> {
HTMLElement div = (HTMLElement) DomGlobal.document.createElement("div");
div.id = "test4";
DomGlobal.document.body.appendChild(div);
MapOptions options = new MapOptions.Builder(L.latLng(52.51, 13.40), 12.0, 7.0).maxZoom(20.0).build();
Map map = L.map("test4", options);
assertNotNull(map);
map.panTo(L.latLng(51.51, 13.80), null);
assertEquals(map.getCenter().lat, 51.51);
assertEquals(map.getCenter().lng, 13.80);
return null;
});
}
开发者ID:gwidgets,项目名称:gwty-leaflet,代码行数:17,代码来源:MapTest.java
示例12: testMarkeradd
import elemental2.dom.DomGlobal; //导入依赖的package包/类
public void testMarkeradd(){
InjectedLeafletResources.whenReady((e) -> {
HTMLElement div = (HTMLElement) DomGlobal.document.createElement("div");
div.id = "test6";
DomGlobal.document.body.appendChild(div);
Map map = L.map("test6", null);
MarkerOptions mkOptions = new MarkerOptions.Builder().build();
Marker marker = L.marker(L.latLng(52.51, 13.40), mkOptions);
marker.addTo(map);
assertNotNull(map);
assertNotNull(marker);
assertEquals(marker.getLatLng().lat, 52.51);
assertEquals(marker.getLatLng().lng, 13.40);
return null;
});
}
开发者ID:gwidgets,项目名称:gwty-leaflet,代码行数:21,代码来源:MarkerTest.java
示例13: PlaceService
import elemental2.dom.DomGlobal; //导入依赖的package包/类
public PlaceService(E eventBus) {
super();
this.eventMetaDataMap = new HashMap<>();
this.historyNameMap = new HashMap<>();
this.eventBus = eventBus;
DomGlobal.window.addEventListener("popstate",
(e) -> {
confirmEvent(new NavigationEventCommand(eventBus) {
protected void execute() {
enabled = false;
convertToken(getTokenFromUrl(DomGlobal.window.location.toString()));
enabled = true;
}
});
});
}
开发者ID:mvp4g,项目名称:mvp4g2,代码行数:20,代码来源:PlaceService.java
示例14: place
import elemental2.dom.DomGlobal; //导入依赖的package包/类
/**
* Convert an event and its associated parameters to a token.<br>
*
* @param eventName name of the event to store
* @param param string representation of the objects associated with the event that needs to be
* stored in the token
* @param onlyToken if true, only the token will be generated and browser history won't change
* @return the generated token
*/
public String place(String eventName,
String param,
boolean onlyToken) {
EventMetaData<? extends IsEventBus> metaData = this.eventMetaDataMap.get(eventName);
if (!enabled && !onlyToken) {
return null;
}
String token = tokenize(metaData.getHistoryName(),
param);
// if (converters.get(eventName)
// .isCrawlable()) {
// token = CRAWLABLE + token;
// }
if (!onlyToken) {
DomGlobal.window.history.pushState(param,
"",
PlaceService.URL_SEPARATOR + token);
}
return token;
}
开发者ID:mvp4g,项目名称:mvp4g2,代码行数:30,代码来源:PlaceService.java
示例15: findSelf
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@Override
protected E findSelf(E parent) {
if (el != null) {
return el;
}
// First, look on the document. This is the fastest, IF we are attached
String id = getId();
if (id == null) {
return super.findSelf(parent);
}
el = (E) DomGlobal.document.getElementById(id);
if (el == null && parent != null) {
// If we aren't attached, fallback to the slower querySelector
el = (E) parent.querySelector("#"+id);
}
if (el != null) {
return el;
}
return super.findSelf(parent);
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:21,代码来源:ElementalBuilder.java
示例16: ensureInjected
import elemental2.dom.DomGlobal; //导入依赖的package包/类
static void ensureInjected()
{
if (isVueRouterInjected())
return;
HTMLScriptElement scriptElement =
(HTMLScriptElement) DomGlobal.document.createElement("script");
scriptElement.text = VUE_ROUTER_LIB;
DomGlobal.document.body.appendChild(scriptElement);
}
开发者ID:Axellience,项目名称:vue-router-gwt,代码行数:11,代码来源:VueRouterLibInjector.java
示例17: StateHistory
import elemental2.dom.DomGlobal; //导入依赖的package包/类
public StateHistory() {
DomGlobal.self.addEventListener("popstate", event -> {
PopStateEvent popStateEvent=Js.cast(event);
JsState state=Js.cast(popStateEvent.state);
if (nonNull(state))
inform(state.historyToken, state.title, state.data);
});
}
开发者ID:GwtDomino,项目名称:domino,代码行数:9,代码来源:StateHistory.java
示例18: windowToken
import elemental2.dom.DomGlobal; //导入依赖的package包/类
private String windowToken() {
Location location= Js.cast(DomGlobal.location);
return location.getPathname().substring(1) + location.getSearch();
}
开发者ID:GwtDomino,项目名称:domino,代码行数:5,代码来源:StateHistory.java
示例19: WebScreen
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@Inject
public WebScreen() {
header = DomGlobal.document.querySelector("header");
Element main = DomGlobal.document.querySelector("main");
IncrementalDom.patchOuter(header, Templates::header);
IncrementalDom.patchOuter(main, Templates::main);
userListContainer = main.querySelector(".user-list-container");
}
开发者ID:xemantic,项目名称:github-users-web,代码行数:9,代码来源:WebScreen.java
示例20: postConstruct
import elemental2.dom.DomGlobal; //导入依赖的package包/类
@PostConstruct
final void postConstruct()
{
DomGlobal.window.addEventListener( "hashchange", _listener, false );
//DOC ELIDE START
//DOC ELIDE END
}
开发者ID:arez,项目名称:arez,代码行数:8,代码来源:BrowserLocation.java
注:本文中的elemental2.dom.DomGlobal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论