Java Code Examples for com.google.gwt.user.client.ui.RootPanel.get()

The following are Jave code examples for showing how to use get() of the com.google.gwt.user.client.ui.RootPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gwt-rxjs-jsinterop   File: OnPageTest.java   Source Code and License Vote up 6 votes
@Override
public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get("main");
    final Button button = new Button("Click me");
    rootPanel.add(button);
    
    ObservableEx.fromKeyboardEvent(button.getElement(), "keydown")
            .map(event -> event.ctrlKey)
            .take(5)
            .subscribe(v -> log("ctrlKey " + v));
    
    ObservableEx.fromMouseEvent(button.getElement(), "click")
            .map(event -> event.clientX)
            .take(5)
            .subscribe(v -> log("clientX " + v));        
}
 
Example 2
Project: unitimes   File: AriaStatus.java   Source Code and License Vote up 6 votes
public static AriaStatus getInstance() {
	if (sStatus == null) {
		RootPanel statusPanel = RootPanel.get("UniTimeGWT:AriaStatus");
		if (statusPanel != null && "1".equals(Window.Location.getParameter("aria"))) {
			sStatus = new AriaStatus(statusPanel.getElement(), false);
			sStatus.setStyleName("unitime-VisibleAriaStatus");
		} else {
			sStatus  = new AriaStatus(false);
			RootPanel.get().add(sStatus);
		}
		
		RootPanel.get().addDomHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event) {
   				if (event.getNativeEvent().getKeyCode() == 191 && (event.isControlKeyDown() || event.isAltKeyDown())) {
   					sStatus.setHTML(sStatus.getHTML());
   				}
   			}
   		}, KeyUpEvent.getType());
	}
	return sStatus;
}
 
Example 3
Project: walkaround   File: Walkaround.java   Source Code and License Vote up 6 votes
/** Reveals the log div, and executes a task when done. */
// The async API for this method is intended to support two things: a cool
// spew animation, and also the potential to runAsync the whole LogPanel code.
private static void attachLogPanel() {
  Logs.get().addHandler(domLogger);
  final Panel logHolder = RootPanel.get("logHolder");
  logHolder.setVisible(true);

  // Need one layout and paint cycle after revealing it to start animation.
  // Use high priority to avoid potential starvation by other tasks if a
  // problem is occurring.
  SchedulerInstance.getHighPriorityTimer().scheduleDelayed(new Task() {
    @Override
    public void execute() {
      logHolder.add(domLogger);
      Style waveStyle = Document.get().getElementById(WAVEPANEL_PLACEHOLDER).getStyle();
      Style logStyle = logHolder.getElement().getStyle();
      logStyle.setHeight(250, Unit.PX);
      waveStyle.setBottom(250, Unit.PX);
    }
  }, 50);
}
 
Example 4
Project: empiria.player   File: Player.java   Source Code and License Vote up 5 votes
@Inject
public Player(@Assisted String id, @Assisted JavaScriptObject jsObject, ViewEngine viewEngine, DeliveryEngine deliveryEngine,
              IPlayerContainersAccessor accessor) {
    this.accessor = accessor;
    this.deliveryEngine = deliveryEngine;
    try {
        RootPanel.get(id);
    } catch (Exception e) {
    }
    RootPanel root = RootPanel.get(id);
    viewEngine.mountView(root);
    getAccessor().setPlayerContainer(root);

    deliveryEngine.init(jsObject);
}
 
Example 5
Project: unitimes   File: Client.java   Source Code and License Vote up 5 votes
public void onModuleLoadDeferred() {
	// register triggers
	GWT.runAsync(new RunAsyncCallback() {
		@Override
		public void onSuccess() {
			for (Triggers t: Triggers.values())
				t.register();
			callGwtOnLoadIfExists();
		}
		@Override
		public void onFailure(Throwable reason) {
		}
	});
	
	// load page
	if (RootPanel.get("UniTimeGWT:Body") != null) {
		LoadingWidget.getInstance().show(MESSAGES.waitLoadingPage());
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
			@Override
			public void execute() {
				initPageAsync(Window.Location.getParameter("page"));
			}
		});
	}
	
	// load components
	for (final Components c: Components.values()) {
		final RootPanel p = RootPanel.get(c.id());
		if (p != null) {
			Scheduler.get().scheduleDeferred(new ScheduledCommand() {
				@Override
				public void execute() {
					initComponentAsync(p, c);
				}
			});
		}
		if (p == null && c.isMultiple()) {
			NodeList<Element> x = getElementsByName(c.id());
			if (x != null && x.getLength() > 0)
				for (int i = 0; i < x.getLength(); i++) {
					Element e = x.getItem(i);
					e.setId(DOM.createUniqueId());
					final RootPanel q = RootPanel.get(e.getId());
					Scheduler.get().scheduleDeferred(new ScheduledCommand() {
						@Override
						public void execute() {
							initComponentAsync(q, c);
						}
					});
				}
		}
	}
	
	Window.addWindowClosingHandler(new Window.ClosingHandler() {
		@Override
		public void onWindowClosing(Window.ClosingEvent event) {
			if (isLoadingDisplayed() || LoadingWidget.getInstance().isShowing()) return;
			LoadingWidget.showLoading(MESSAGES.waitPlease());
			iPageLoadingTimer = new Timer() {
				@Override
				public void run() {
					RPC.execute(new IsSessionBusyRpcRequest(), new AsyncCallback<GwtRpcResponseBoolean>() {
						@Override
						public void onFailure(Throwable caught) {
							LoadingWidget.hideLoading();
						}
						@Override
						public void onSuccess(GwtRpcResponseBoolean result) {
							if (result.getValue()) {
								iPageLoadingTimer.schedule(500);
							} else {
								LoadingWidget.hideLoading();
							}
						}
					});
				}
			};
			iPageLoadingTimer.schedule(500);
		}
	});
}
 
Example 6
Project: unitimes   File: Client.java   Source Code and License Vote up 5 votes
public static void reloadMenu() {
	for (final Components c: Components.values()) {
		final RootPanel p = RootPanel.get(c.id());
		if (p != null) {
			for (int i = 0; i < p.getWidgetCount(); i++)
				if (p.getWidget(i) instanceof UniTimeMenu)
					((UniTimeMenu)p.getWidget(i)).reload();
		}
	}
}
 
Example 7
Project: LAS   File: InteractiveDownloadData.java   Source Code and License Vote up 5 votes
public void onModuleLoad() {
	rootPanel = RootPanel.get();
	rootPanel.setSize("400", "700");
	ClientFactory clientFactory = GWT.create(ClientFactory.class);
	EventBus eventBus = clientFactory.getEventBus();
	presenter = new InteractiveDownloadDataViewActivity(clientFactory);
	// view = clientFactory.getView();
	// RootPanel.get().add(view);
	// view.setPresenter(presenter);
	ScrollPanel scrollPanel = new ScrollPanel();
	// scrollPanel.setWidget(view.asWidget());
	rootPanel.add(scrollPanel);
	presenter.start(scrollPanel, eventBus);
}