private Frame createFrame() { final Frame frame = new Frame(DEFAULT_TEMPLATE_PATH); frame.getElement().setId(DEFAULT_FRAME_NAME); frame.setTitle(UIMessages.INSTANCE.previewTitle()); frame.setWidth("500px"); frame.setHeight("500px"); frame.getElement().getStyle().setBackgroundColor("gray"); frame.setVisible(true); RootPanel.get().add(frame); frame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { frame.getElement().getStyle().setBackgroundColor("white"); zoomPageComboBox.setValue(75); } }); return frame; }
public void setImageUrl(String src, int width, int height) { this.width = width; this.height = height; imageView = new Image(); imageView.setUrl(src); RootPanel.get().add(imageView); imageView.addLoadHandler(new LoadHandler() { @Override public void onLoad(final LoadEvent event) { imageView.removeFromParent(); createCanvasAndAddToView(imageView); if (loadHandler.isPresent()) { loadHandler.get().onLoad(event); } } }); }
protected void handleDoubleClick(TableData.Row row) { VerticalPanel vp = new VerticalPanel(); final Image previewImage = new Image(getFullSizeUrl(row)); final HTML caption = new HTML(getPopUpCaption(row)); String title = getThumbnailDesc(row).replace("<em>", "").replace("</em>", ""); caption.setWidth("320px"); previewImage.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent ev) { caption.setWidth(previewImage.getWidth() + "px"); } }); GwtUtil.setStyle(vp, "margin", "8px"); vp.setCellHorizontalAlignment(previewImage, HasHorizontalAlignment.ALIGN_CENTER); vp.setCellVerticalAlignment(previewImage, HasVerticalAlignment.ALIGN_MIDDLE); vp.add(previewImage); vp.add(caption); PopupPane popupPane = new PopupPane(title, vp, PopupType.STANDARD, false, false); popupPane.show(); }
public void onLoad(LoadEvent ev) { final Image imw = (Image) ev.getSource(); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { public void execute() { if (_imageWidget.getWidgetIndex(imw) > -1) { imw.setPixelSize(_tile._width, _tile._height); ViewPortPt addPt= _plot.getViewPortCoords(new ScreenPt(_tile._x, _tile._y)); _imageWidget.setWidgetPosition(imw, addPt.getIX(), addPt.getIY()); if (!_firstReloadComplete) { onFirstLoadComplete(); _firstReloadComplete = true; } } } }); }
public void startDownloadRequest(String aUrlPrefix, final int aRequestType, Map<String, String> aParams, RequestBuilder.Method aMethod) throws Exception { final Frame frame = new Frame(); frame.setVisible(false); frame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { Timer timer = new Timer() { @Override public void run() { frame.removeFromParent(); } }; timer.schedule(2000); } }); String query = ""; for (Map.Entry<String, String> ent : aParams.entrySet()) { query += param(ent.getKey(), ent.getValue()) + "&"; } query += param(PlatypusHttpRequestParams.TYPE, String.valueOf(aRequestType)); frame.setUrl(apiUrl + aUrlPrefix + "?" + query); RootPanel.get().add(frame); }
public TileSet(String path, int tileSize) { this.tileSize = tileSize; img = new Image(); // TODO add to a hidden block RootPanel.get("resourceLoader").add(img); img.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { imgElement = ImageElement.as(img.getElement()); initImageParameters(imgElement.getWidth(), imgElement.getHeight()); } }); img.setUrl(path); }
public void setHTML(final String html) { if (!isLoaded) { loadHandler = addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { _setHTML(html); } }); } }); } else { _setHTML(html); } }
private void createHiddenFrame(PrintFinishedInfo info) { final Frame frame = new Frame(); frame.setVisible(false); UrlBuilder builder = new UrlBuilder(info.getUrl()); for (String name : info.getParams().keySet()) { builder.addParameter(name, info.getParams().get(name)); } frame.setUrl(builder.toString()); frame.setPixelSize(0, 0); frame.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); frame.getElement().getStyle().setBorderWidth(0, Style.Unit.PX); frame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { frame.removeFromParent(); } }); RootPanel.get().add(frame); }
public void onLoad(LoadEvent event) { loadHandler.removeHandler(); errHandler.removeHandler(); Image img = (Image) event.getSource(); if (img != null) { img.setVisible(true); realWidth = img.getWidth(); realHeight = img.getHeight(); } if (containerId != null && RootPanel.get(containerId) != null) { RootPanel.get(containerId).add(thisInstance); } if (onLoad != null) { onLoad.onLoad(thisInstance); } }
@Test public void checkSetSizeAttachesLoadHandler() { navigatorThumbnailItemView.setItemPxSize(100, 200); final ArgumentCaptor<LoadHandler> loadHandlerArgumentCaptor = ArgumentCaptor.forClass(LoadHandler.class); when(thumbImage.getWidth()).thenReturn(100); when(thumbImage.getHeight()).thenReturn(200); verify(thumbImage).addLoadHandler(loadHandlerArgumentCaptor.capture()); final LoadHandler loadHandler = loadHandlerArgumentCaptor.getValue(); assertNotNull(loadHandler); loadHandler.onLoad(mock(LoadEvent.class)); verify(body).setPixelSize(eq(100), eq(200)); }
public SpritePlateAnimation(String imageUrl, double frameRate, int frameCount, int framesAcross) { m_frameRate = frameRate; m_frameCount = frameCount; m_framesAcross = framesAcross; Image img = new Image(); m_image = ImageElement.as(img.getElement()); img.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { m_loaded = true; m_frameWidth = m_image.getWidth() / m_framesAcross; int framesDown = m_frameCount / m_framesAcross; framesDown += (m_frameCount % m_framesAcross) > 0 ? 1 : 0; m_frameHeight = m_image.getHeight() / framesDown; } }); img.setVisible(false); RootPanel.get().add(img); img.setUrl(imageUrl); }
@Override public void add(final Widget child) { if(child instanceof GalleryImage) { ((GalleryImage) child).addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { if(thumbnailWidth != null) { child.setWidth(thumbnailWidth); } if(thumbnailHeight != null) { child.setHeight(thumbnailHeight); } } }); super.add(child); } else { throw new IllegalArgumentException("Gallery can only contain GalleryImage's."); } }
public void init(final ExternalEmpiriaApi api, final ExternalFrameLoadHandler<T> onLoadHandler) { frame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { T obj = init(frame.getElement(), api); onLoadHandler.onExternalModuleLoaded(obj); } }); }
@PostConstruct public void postConstruct() { canvasStubView.setPanelStyle(styleNameConstants.QP_COLORFILL_IMG()); canvasStubView.setImageLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { canvasStubViewLoded = true; bindView(); } }); }
/** * Creates texture region from byte[]. * <p> * GWT platform requires additional step (as far as i know) to deal with Pixmap. It is need to load Image element * and wait until it is loaded. * * @param bytes Image byte[] representation, not null * @param consumer Consumer where you should deal with region, not null */ public static void createTextureFromBytes(byte[] bytes, final Consumer<TextureRegion> consumer) { String base64 = "data:image/png;base64," + new String(Base64Coder.encode(bytes)); final Image image = new Image(); image.setVisible(false); image.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { ImageElement imageElement = image.getElement().cast(); Pixmap pixmap = new Pixmap(imageElement); Gdx.app.log("ImageHelper", "pixmap: " + pixmap.getWidth() + "/" + pixmap.getHeight()); final int orgWidth = pixmap.getWidth(); final int orgHeight = pixmap.getHeight(); int width = MathUtils.nextPowerOfTwo(orgWidth); int height = MathUtils.nextPowerOfTwo(orgHeight); final Pixmap potPixmap = new Pixmap(width, height, pixmap.getFormat()); potPixmap.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight()); pixmap.dispose(); TextureRegion region = new TextureRegion(new Texture(potPixmap), 0, 0, orgWidth, orgHeight); potPixmap.dispose(); RootPanel.get().remove(image); consumer.accept(region); } }); image.setUrl(base64); RootPanel.get().add(image); }
/** * Enlarges image on page */ private static void createImageDialog(String img) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel DialogBoxContents = new VerticalPanel(); FlowPanel holder = new FlowPanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); ok.setStyleName("DialogBox-button"); // Adds Image Image image = new Image(img); image.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent evt) { dialogBox.center(); } }); image.setStyleName("DialogBox-image"); holder.add(ok); DialogBoxContents.add(image); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.center(); dialogBox.show(); }
/** * Default constructor */ SuggestionMenu() { super(true); debug("VComboBoxMultiselect.SM: constructor()"); addDomHandler(this, LoadEvent.getType()); setScrollEnabled(true); }
@Override public void onLoad(LoadEvent event) { debug("VComboBoxMultiselect.SM: onLoad()"); // Handle icon onload events to ensure shadow is resized // correctly this.delayedImageLoadExecutioner.trigger(); }
/** {@inheritDoc}) */ @Override public void onLoad(LoadEvent e) { if (completed) { return; } cleanUp(); spinner.setVisible(false); imageToLoad.getElement().getStyle().clearVisibility(); imageToLoad.setUrl(url); }
private void initIFrame() { final Frame iframe = new Frame("javascript:\"\""); iframe.getElement().setAttribute("name", id); iframe.getElement().setAttribute("style", "position:absolute;width:0;height:0;border:0"); iframe.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent arg0) { String content = IFrameElement.as(iframe.getElement()).getContentDocument().getBody().getInnerHTML(); if (content != null && !"".equals(content)) formPanel.fireEvent(new SubmitCompleteEvent(content) { }); } }); flowPanel.add(iframe); }
private void getMap() { // canvas size in px final int width = 1121; final int height = 2585; // get the 2D rendering context context = mapCanvas.getContext2d(); // initialize the canvas mapCanvas.setWidth(width + "px"); mapCanvas.setHeight(height + "px"); mapCanvas.setPixelSize(width, height); mapCanvas.setCoordinateSpaceWidth(width); mapCanvas.setCoordinateSpaceHeight(height); container.setWidth(width + "px"); final Image seattleImage = new Image(Resources.INSTANCE.seattleArea()); seattleImage.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { ImageElement imageElement = seattleImage.getElement().cast(); context.drawImage(imageElement, 0, 0); } }); seattleImage.setVisible(false); container.add(seattleImage); }
private void getMap() { // Tacoma map canvas size in px final int width = 1360; final int height = 1204; // get the 2D rendering context context = mapCanvas.getContext2d(); // initialize the canvas mapCanvas.setWidth(width + "px"); mapCanvas.setHeight(height + "px"); mapCanvas.setPixelSize(width, height); mapCanvas.setCoordinateSpaceWidth(width); mapCanvas.setCoordinateSpaceHeight(height); container.setWidth(width + "px"); final Image tacomaImage = new Image(Resources.INSTANCE.tacomaArea()); tacomaImage.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { ImageElement imageElement = tacomaImage.getElement().cast(); context.drawImage(imageElement, 0, 0); } }); tacomaImage.setVisible(false); container.add(tacomaImage); }
public QMap(String imageURL) { mapWidget = new MapWidget(); super.add(mapWidget); final Image image = new Image(imageURL); image.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { mapWidget.bindImage(image); } }); super.add(image); }
public void onLoad(LoadEvent event) { if (big) { object.getIcon().setBigWidht(image.getWidth()); object.getIcon().setBigHeight(image.getHeight()); } else { object.getIcon().setWidht(image.getWidth()); object.getIcon().setHeight(image.getHeight()); } }
public void onLoad(LoadEvent event) { counter--; if (event.getSource()==image) { panel.setSize(String.valueOf(image.getWidth())+"px", String.valueOf(image.getHeight())+"px"); } if (counter<0) { panel.setVisible(true); } }
public void onLoad(LoadEvent event) { if (big) { picture.setBigWidht(imagee.getWidth()); picture.setBigHeight(imagee.getHeight()); } else { picture.setWidht(imagee.getWidth()); picture.setHeight(imagee.getHeight()); } }
/** * Creates the general parameters panel. * * @return The general parameters panel. */ private ContentPanel createGeneralParametersPanel() { final ContentPanel panel = Panels.content(I18N.CONSTANTS.organizationManagementTitle(), CSS_ADMIN_PARAMETERS); generalForm = Forms.panel(150); generalOrganizationNameTextField = Forms.text(I18N.CONSTANTS.organizationManagementOrganizationName(), true); generalForm.add(generalOrganizationNameTextField); generalLogoFileField = Forms.upload(I18N.CONSTANTS.organizationManagementLogoUpload()); generalForm.add(generalLogoFileField); generalLogoPreview = new Image(); final SimplePanel previewWrapper = new SimplePanel(generalLogoPreview); previewWrapper.setStyleName(CSS_PREVIEW_WRAPPER); final AdapterField logoImageField = new AdapterField(previewWrapper); logoImageField.setFieldLabel(I18N.CONSTANTS.organizationManagementActualLogo()); logoImageField.setResizeWidget(false); generalForm.add(logoImageField); generalLogoPreview.addLoadHandler(new LoadHandler() { @Override public void onLoad(final LoadEvent event) { final Pair<Integer, Integer> ratio = ClientUtils.ratio(generalLogoPreview.getWidth(), generalLogoPreview.getHeight(), generalForm.getFieldWidth(), LOGO_IMAGE_HEIGHT); generalLogoPreview.setPixelSize(ratio.left, ratio.right); } }); generalSaveButton = Forms.button(I18N.CONSTANTS.organizationManagementSaveChanges(), IconImageBundle.ICONS.save()); generalForm.addButton(generalSaveButton); panel.add(generalForm); return panel; }
private void loadCustomUIFrame() { String htmlString = HTML_STRING; // String url = GADGET_SERVER_URL + "?url=" + gadgetUrl + "&up_id=divEditor&view=editor"; // url += "&source=" + URL.encodeQueryString(Window.Location.getHref()) + // "&parent=" + URL.encodeQueryString(Window.Location.getHref()) + //// "&container=open&view=home&lang=all&country=ALL&debug=0&nocache=0&sanitize=0" + // "&libs=core%3Acore.io#st=%25st%25" + // ""; htmlString = htmlString // .replace("%url%", url) .replace("\n", "") .replace("\r", ""); String params = gadgetSettings.getAdditionalParams() != null ? gadgetSettings.getAdditionalParams() : ""; params = params.replace("\"", "\\\""); htmlString = htmlString.replace("%s1%", params); this.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { loadEditorNative(getElement(), gadgetSettings.getGadgetHtml(true)); } }); HtmlUtils.writeHtml(getElement(), htmlString); // getElement().setInnerHTML(htmlString); // frame.setUrl("/GadgetCustomUI.html"); //frame.setUrl("/GadgetCustomUI.html?url="+gadgetUrl); }
public void onLoad(LoadEvent event) { loaded = true; if (url != null) { show(url); } }
public ESBGraphicalEditor() { editorFrame = new Frame("/esbeditor/index.html"); editorFrame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { frameLoaded(); } }); editorFrame.setSize("100%", "100%"); }
/** {@inheritDoc}) */ public void onLoad(LoadEvent e) { if (completed) { return; } cleanUp(); spinner.setVisible(false); imageToLoad.getElement().getStyle().clearVisibility(); imageToLoad.setUrl(url); }
private void loadModules() { BusyFeatureConsumer.get().call(true); ModuleServiceConsumer.get().getModules(new AsyncCallback<List<ModuleBean>>() { @Override public void onSuccess(List<ModuleBean> modules) { LOG.info("DynamicHost.onModuleLoad#getModules#onSuccess: modules=" + modules); final ModuleReadyFeatureProvider moduleReadyFeatureProvider = new ModuleReadyFeatureProvider(modules, LOAD_TIMEOUT); moduleReadyFeatureProvider.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { LOG.info("DynamicHost.onModuleLoad#ModuleReadyFeatureProvider.onLoad: unreadyModules=" + moduleReadyFeatureProvider.getUnreadyModules()); BusyFeatureConsumer.get().call(false); onModulesLoaded(moduleReadyFeatureProvider.getReadyModules()); } }); ModuleLoader.INSTANCE.load(modules); } @Override public void onFailure(Throwable caught) { LOG.log(Level.SEVERE, "DynamicHost.onModuleLoad#getModules#onFailure:", caught); BusyFeatureConsumer.get().call(false); onModulesLoaded(null); } }); }
/** * Tworzy obiekt html5/canvas * * @param element * @param moduleSocket */ private void fillCanvas(final Element element, final ModuleSocket moduleSocket) { styles = styleSocket.getStyles(element); Element titleNodes = XMLUtils.getFirstElementWithTagName(element, "title"); final String title = XMLUtils.getTextFromChilds(titleNodes); image.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { canvas.setWidth(image.getWidth() + "px"); canvas.setCoordinateSpaceWidth(image.getWidth()); canvas.setHeight(image.getHeight() + "px"); canvas.setCoordinateSpaceHeight(image.getHeight()); canvas.setTitle(title); mainPanel.setWidth(image.getWidth() + "px"); mainPanel.setHeight(image.getHeight() + "px"); textPanel.setWidth(image.getWidth() + "px"); textPanel.setHeight(image.getHeight() + "px"); // imgelement. Context2d context2d = canvas.getContext2d(); setContextStyle(context2d); NodeList labelList = element.getElementsByTagName("label"); for (int x = 0; x < labelList.getLength(); ++x) { Element label = (Element) labelList.item(x); // ustawiony czas nie obslugujemy w pictureplayer if (getAttributeAsInt(label, "start") != 0) { continue; } Element anchor = getFirstElementWithTagName(label, "anchor"); Element line = getFirstElementWithTagName(label, "line"); Element text = getFirstElementWithTagName(label, "text"); if (line != null) { parseLine(line, context2d); } if (text != null && anchor != null) { textPanel.add(parseText(text, anchor, moduleSocket)); } } mathJaxNative.renderMath(); } }); image.setUrl(element.getAttribute("src")); }
@Override public void onLoad(LoadEvent event) { onLoaded(); }
@Override public void onLoad(LoadEvent event) { this.activeVisualization.onLoad(event); }
public void onLoad(LoadEvent event) { }
@Override public void onLoad(LoadEvent event) { ClientUtils.fine(LOG, "image onLoad: %s", image.getUrl()); scheduleForRender(); }