com.google.gwt.user.client.ui.RootLayoutPanel Java Examples

The following examples show how to use com.google.gwt.user.client.ui.RootLayoutPanel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CirSim.java    From circuitjs1 with GNU General Public License v2.0 6 votes vote down vote up
public void setCanvasSize(){
  	int width, height;
  	width=(int)RootLayoutPanel.get().getOffsetWidth();
  	height=(int)RootLayoutPanel.get().getOffsetHeight();
  	height=height-MENUBARHEIGHT;
  	width=width-VERTICALPANELWIDTH;
if (cv != null) {
	cv.setWidth(width + "PX");
	cv.setHeight(height + "PX");
	cv.setCoordinateSpaceWidth(width);
	cv.setCoordinateSpaceHeight(height);
}
if (backcv != null) {
	backcv.setWidth(width + "PX");
	backcv.setHeight(height + "PX");
	backcv.setCoordinateSpaceWidth(width);
	backcv.setCoordinateSpaceHeight(height);
}

  	setCircuitArea();
  }
 
Example #2
Source File: CirSim.java    From circuitjs1 with GNU General Public License v2.0 6 votes vote down vote up
public void setiFrameHeight() {
	if (iFrame==null)
		return;
	int i;
	int cumheight=0;
	for (i=0; i < verticalPanel.getWidgetIndex(iFrame); i++) {
		if (verticalPanel.getWidget(i) !=loadFileInput) {
			cumheight=cumheight+verticalPanel.getWidget(i).getOffsetHeight();
			if (verticalPanel.getWidget(i).getStyleName().contains("topSpace"))
					cumheight+=12;
		}
	}
	int ih=RootLayoutPanel.get().getOffsetHeight()-MENUBARHEIGHT-cumheight;
	if (ih<0)
		ih=0;
	iFrame.setHeight(ih+"px");
}
 
Example #3
Source File: ExtendedDockPanel.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * SetWidgetsSize
 */
private void setWidgetsSize() {
	// Calculating real height
	usableHeight = Window.getClientHeight();
	if (Main.get().hasHeaderCustomization) {
		usableHeight -= 72;
		RootLayoutPanel.get().setWidgetTopBottom(Main.get().mainPanel, 72, Style.Unit.PX, 0, Style.Unit.PX);
	}

	// Initialize dockPanel size
	dockPanel.setSize("" + Window.getClientWidth() + "px", "" + usableHeight + "px");

	// The active panel must be the last on initalization because establishes coordenates
	leftBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH, usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));
	rightBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH, usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));

	centerWidth = Window.getClientWidth() - (2 * VERTICAL_BORDER_PANEL_WIDTH);
	centerHeight = usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT);

	topPanel.setWidth("" + Window.getClientWidth() + "px");
	desktop.setSize(centerWidth, centerHeight);
	search.setSize(centerWidth, centerHeight);
	dashboard.setSize(centerWidth, centerHeight);
	administration.setSize(centerWidth, centerHeight);
}
 
Example #4
Source File: App.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@PostConstruct
public void buildUI() {

	OpenLayers.setProxyHost("gwtOpenLayersProxy?targetURL=");
	RootLayoutPanel.get().add(geoMap.getMapWidget());
	RootPanel.get().add(actionBar);
	RootPanel.get().add(linksWidget);
	RootPanel.get().add(zoomStatusWidget);

	logger.info("Map initialize...");
	geoMapInitializer.initialize();
	rasterLayerInitializer.initialize();
	vectorLayerInitializer.initialize();
	widgetInitializer.initialize();
	eventListenerInitializer.initialize();

	showDisclaimer();

	RestClient.setJacksonMarshallingActive(true);
	RootPanel.get("splash").setVisible(false);
}
 
Example #5
Source File: PlaygroundView.java    From caja with Apache License 2.0 6 votes vote down vote up
public PlaygroundView(Playground controller) {
  this.controller = controller;
  this.sourceExamples = new MultiWordSuggestOracle();
  this.policyExamples = new MultiWordSuggestOracle();

  this.playgroundUI =
    new com.google.caja.demos.playground.client.ui.PlaygroundUI(
        sourceExamples, policyExamples);
  RootLayoutPanel.get().add(playgroundUI);
  initSourcePanel();
  initPolicyPanel();
  initFeedbackPanel();
  initExamples();
  initEditor();
  initCaja(true);
  initPlusOne();
  initUnsafe();
}
 
Example #6
Source File: GpsEmulator.java    From android-gps-emulator with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the Map widget and default zoom/position
 */
private void initializeMap() {
   // Create a map centered on Cawker City, KS USA
   final MapOptions opts = MapOptions.newInstance();
   if (opts == null) {
      GWT.log("MapOptions was null");
   }
   final LatLng center = LatLng.newInstance(30.0, 0.00);
   opts.setCenter(center);
   opts.setZoom(2);

   _map = new MapWidget(opts);

   // Register map click handler
   _map.addClickHandler(this);
   RootLayoutPanel.get().add(_map);
}
 
Example #7
Source File: GwtOLPlayground.java    From gwt-ol with Apache License 2.0 6 votes vote down vote up
@Override
public void onModuleLoad() {

    Map<String, Integer> exampleIndexMap = new HashMap<>();

    // choose your example
    TabLayoutPanel tabs = new TabLayoutPanel(27, Style.Unit.PX);

    int index = 0;

    for (OLExampleType example : OLExampleType.values()) {
        tabs.add(new LazyExampleWidget(example), example.name().replace("Example", ""));
        exampleIndexMap.put(example.name(), index);
        index++;
    }
    RootLayoutPanel.get().add(tabs);

    String token = History.getToken();

    if (token != null && exampleIndexMap.containsKey(token)) {
        tabs.selectTab(exampleIndexMap.get(token));
    }
}
 
Example #8
Source File: Console.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void onFailure(BootstrapContext context) {
    LoadingPanel.get().off();

    String cause = "";
    int status = 500;
    if (context.getLastError() != null) {
        cause = context.getLastError().getMessage();
        if (context.getLastError() instanceof DispatchError) {
            status = ((DispatchError) context.getLastError()).getStatusCode();
        }
    }
    if (403 == status) {
        // authorisation error (lack of privileges)
        new InsufficientPrivileges(context.isSsoEnabled()).execute();
    } else {
        // unknown error
        HTMLPanel explanation = new HTMLPanel("<div style='padding-top:150px;padding-left:120px;'><h2>" + CONSTANTS
                .unableToLoadConsole() + "</h2><pre>" + cause + "</pre></div>");
        RootLayoutPanel.get().add(explanation);
    }
}
 
Example #9
Source File: EMLStudio.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * EMLStudio module load method
 */
@Override
public void onModuleLoad() {
	HandlerManager eventBus = new HandlerManager(null);
	LoginController loginController = new LoginController(eventBus);
	AppController appViewer = new AppController(eventBus, loginController);

	appViewer.go(RootLayoutPanel.get());
}
 
Example #10
Source File: GpsEmulator.java    From android-gps-emulator with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the Emulator UI
 */
private void initializeUI() {
   // Create textboxes and set default hostname and port
   _hostname = new TextBox();
   _hostname.setText(DEFAULT_HOST);
   _hostname.getElement().setPropertyString("placeholder", "hostname");
   _port = new TextBox();
   _port.setText(String.valueOf(DEFAULT_PORT));
   _port.getElement().setPropertyString("placeholder", "port");

   // Create button to connect
   _button = new Button("Connect");
   // Create the info/status label, initially not visible
   _info = new InlineLabel();
   _info.setVisible(false);

   // register the button action
   _button.addClickHandler(new ClickHandler() {
      public void onClick(final ClickEvent event) {
         final String hostname = _hostname.getText();
         final int port = Integer.valueOf(_port.getText());
         new PortAsyncCallback(hostname, port).execute();
      }
   });
   
   // Create panel for textbox, button and info label
   final FlowPanel div = new FlowPanel();
   div.setStylePrimaryName("emulator-controls");
   _hostname.setStyleName("emulator-hostname");
   _port.setStyleName("emulator-port");
   _button.setStyleName("emulator-connect");
   _info.setStyleName("emulator-info");
   div.add(_hostname);
   div.add(_port);
   div.add(_button);
   div.add(_info);

   // add the controls before the map so that the div doesn't cover the map
   RootLayoutPanel.get().add(div);
}
 
Example #11
Source File: LoadingPanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static public LoadingPanel get() {
    if (instance == null) {
        instance = new LoadingPanel();
        instance.off();
        RootLayoutPanel.get().add(instance);
    }
    return instance;
}
 
Example #12
Source File: TexturedCube.java    From TGAReader with MIT License 4 votes vote down vote up
public void onModuleLoad() {
	
	Canvas canvas = Canvas.createIfSupported();
	canvas.setStyleName("MyCanvas");
	canvas.setCoordinateSpaceWidth(400);
	canvas.setCoordinateSpaceHeight(400);
	RootLayoutPanel.get().add(canvas);
	
	gl = (WebGLRenderingContext)canvas.getContext("experimental-webgl");
	gl.viewport(0, 0, 400, 400);
	
	WebGLBuffer vertexBuffer = gl.createBuffer();
	gl.bindBuffer(ARRAY_BUFFER, vertexBuffer);
	gl.bufferData(ARRAY_BUFFER, Float32Array.create(VERTICES), STATIC_DRAW);

	WebGLShader vertexShader = gl.createShader(VERTEX_SHADER);
	gl.shaderSource(vertexShader, VERTEX_SHADER_SOURCE);
	gl.compileShader(vertexShader);
	
	WebGLShader fragmentShader = gl.createShader(FRAGMENT_SHADER);
	gl.shaderSource(fragmentShader, FRAGMENT_SHADER_SOURCE);
	gl.compileShader(fragmentShader);
	
	program = gl.createProgram();
	gl.attachShader(program, vertexShader);
	gl.attachShader(program, fragmentShader);
	gl.linkProgram(program);
	
	gl.useProgram(program);
	gl.bindBuffer(ARRAY_BUFFER, vertexBuffer);
	
	WebGLUniformLocation texture = gl.getUniformLocation(program, "texture");
	gl.uniform1i(texture, 0);
	
	int posAttr = gl.getAttribLocation(program, "position");
	gl.vertexAttribPointer(posAttr, 3, FLOAT, false, 5*4, 0);
	gl.enableVertexAttribArray(posAttr);
	
	int texAttr = gl.getAttribLocation(program, "texcoord");
	gl.vertexAttribPointer(texAttr, 2, FLOAT, false, 5*4, 3*4);
	gl.enableVertexAttribArray(texAttr);
	
	for(int i=0; i<TEXTURE_URLS.length; i++) {
		loadTexture(TEXTURE_URLS[i], i);
	}
	
}
 
Example #13
Source File: Application.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onModuleLoad() {
	ApplicationLayout layout = new ApplicationLayout();
	RootLayoutPanel.get().add(layout);
}
 
Example #14
Source File: MainLayoutPresenter.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void onLogout(LogoutEvent event) {
    RootLayoutPanel.get().clear();
}
 
Example #15
Source File: ImageCanvasTest.java    From TGAReader with MIT License 3 votes vote down vote up
public void onModuleLoad() {
	
	panel = new FlowPanel();
	panel.getElement().getStyle().setBackgroundColor("orange");

	for(int i=0; i<TGA_FILES.length; i++) {
		addTGACanvas("images/"+TGA_FILES[i]);
	}
	
	RootLayoutPanel.get().add(new ScrollPanel(panel));
	
}