public PreloaderCallback getPreloaderCallback () { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo); final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error (String file) { System.out.println("error: " + file); } @Override public void update (PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
private void checkLogLabel () { if (log == null) { ((GwtApplication)Gdx.app).log = log = new TextArea(); // It's possible that log functions are called // before the app is initialized. E.g. SoundManager can call log functions before the app is initialized. // Since graphics is null, we're getting errors. The log size will be updated later, in case graphics was null if (Gdx.graphics != null) { log.setSize(Gdx.graphics.getWidth() + "px", "200px"); } else { log.setSize("400px", "200px"); // Dummy value } log.setReadOnly(true); ((GwtApplication)Gdx.app).getRootPanel().add(log); } }
private void checkLogLabel () { if (log == null) { ((GwtApplication)Gdx.app).log = log = new TextArea(); // It's possible that log functions are called // before the app is initialized. E.g. SoundManager can call log functions before the app is initialized. // Since graphics is null, we're getting errors. The log size will be updated later, in case graphics was null if (Gdx.graphics != null) { log.setSize(Gdx.graphics.getWidth() + "px", "200px"); } else { log.setSize("400px", "200px"); // Dummy value } log.setReadOnly(true); ((GwtApplication)Gdx.app).getRootPanel().add(log); } }
public PreloaderCallback getPreloaderCallback () { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo); final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error (String file) { System.out.println("error: " + file); } @Override public void update (PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
} catch (Throwable e) { root.clear(); root.add(getNoWebGLSupportWidget()); return;
} catch (Throwable e) { root.clear(); root.add(getNoWebGLSupportWidget()); return;
public GwtGraphics (Panel root, GwtApplicationConfiguration config) { Canvas canvasWidget = Canvas.createIfSupported(); if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported"); canvas = canvasWidget.getCanvasElement(); root.add(canvasWidget); canvas.setWidth(config.width); canvas.setHeight(config.height); this.config = config; WebGLContextAttributes attributes = WebGLContextAttributes.create(); attributes.setAntialias(config.antialiasing); attributes.setStencil(config.stencil); attributes.setAlpha(config.alpha); attributes.setPremultipliedAlpha(config.premultipliedAlpha); attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer); context = WebGLRenderingContext.getContext(canvas, attributes); context.viewport(0, 0, config.width, config.height); this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context); String versionString = gl.glGetString(GL20.GL_VERSION); String vendorString = gl.glGetString(GL20.GL_VENDOR); String rendererString = gl.glGetString(GL20.GL_RENDERER); glVersion = new GLVersion(Application.ApplicationType.WebGL, versionString, vendorString, rendererString); }
public GwtGraphics (Panel root, GwtApplicationConfiguration config) { Canvas canvasWidget = Canvas.createIfSupported(); if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported"); canvas = canvasWidget.getCanvasElement(); root.add(canvasWidget); canvas.setWidth(config.width); canvas.setHeight(config.height); this.config = config; WebGLContextAttributes attributes = WebGLContextAttributes.create(); attributes.setAntialias(config.antialiasing); attributes.setStencil(config.stencil); attributes.setAlpha(config.alpha); attributes.setPremultipliedAlpha(config.premultipliedAlpha); attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer); context = WebGLRenderingContext.getContext(canvas, attributes); context.viewport(0, 0, config.width, config.height); this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context); String versionString = gl.glGetString(GL20.GL_VERSION); String vendorString = gl.glGetString(GL20.GL_VENDOR); String rendererString = gl.glGetString(GL20.GL_RENDERER); glVersion = new GLVersion(Application.ApplicationType.WebGL, versionString, vendorString, rendererString); }
public void add(IsWidget child) { this.add(asWidgetOrNull(child)); }
public void addError(final String message, final String additionalDetails, final Throwable e) { if (!showErrors) return; contentPanel.add(new HTML("<strong style='background:red;color:white;'>" + message + "</strong>")); final StringBuilder buildTrace = new StringBuilder("<tt style=\"font-size:11px;\"><pre>"); if (e != null) { e.printStackTrace(); buildTrace.append(e.getClass().getName()).append(": ").append(e.getMessage()).append("<br/>"); for (final StackTraceElement ste : e.getStackTrace()) { buildTrace.append(" ").append(ste.toString()).append("<br/>"); } } buildTrace.append("</pre>"); contentPanel.add(new HTML(buildTrace.toString() + "<br/><strong>Additional Details:</strong>" + additionalDetails + "</tt>")); if (!isShowing()) { resize(); show(); center(); } }
@Override public void addFilterConfigWidget(IsWidget widget) { filterDetailsPanel.add(widget); filterExpandIcon.setVisible(true); }
/** * This method initializes a toolbar with common values. * * @param toolbar is a toolbar to be initialized. * @param panel is a top or bottom panel. * @return an initialized toolbar. */ protected GridToolbar prepareToolbar(GridToolbar toolbar, Panel panel) { toolbar.setGridPanel(this); panel.add(toolbar); return toolbar; }
protected void setWidgetForPanel(final Panel panel, final IsWidget widget) { panel.clear(); panel.add(widget); }
protected void addBigCell(Panel panel, String html) { HTML htmlDiv = new HTML(html); htmlDiv.setStyleName("big"); panel.add(htmlDiv); } }
private void attachWidget(Widget widget, String appId, int nodeId) { Element wrapperElement = getWrapperElement(appId, nodeId); Panel wrapper = new AbsolutePanel(wrapperElement) { { onAttach(); } }; wrapper.add(widget); }
private void addFieldSelectorWidget() { helper.setParentIsAList(true); valueEditorWidget = new FieldSelectorWidget(field, helper, this); panel.add(valueEditorWidget); }
@Override public void addFilterReset() { Anchor anchor = new Anchor(LienzoDisplayerConstants.INSTANCE.resetAnchor()); filterPanel.add(anchor); anchor.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { getPresenter().onFilterResetClicked(); } }); }
public void startContainerLayout( Panel container, GwtMetawidget metawidget ) { State state = getState( container, metawidget ); FlexTable flexTable = new FlexTable(); flexTable.setStyleName( mTableStyleName ); container.add( flexTable ); state.formatter = flexTable.getFlexCellFormatter(); }
@Override public void onOpen() { LayoutInstance layoutInstance = layoutGenerator.build(layoutTemplate); mainPanel.clear(); mainPanel.getElement().addClassName("uf-perspective-component"); mainPanel.add(ElementWrapperWidget.getWidget(layoutInstance.getElement())); }