List of usage examples for com.vaadin.client ApplicationConnection updateComponent
@Deprecated public boolean updateComponent(Widget component, UIDL uidl, boolean manageCaption)
From source file:annis.gui.widgets.gwt.client.ui.VAnnotationGrid.java
License:Apache License
/** * Called whenever an update is received from the server *///from w w w . j a va2s.c o m @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. // It handles sizes, captions, tooltips, etc. automatically. if (client.updateComponent(this, uidl, true)) { // If client.updateComponent returns true there has been no changes and we // do not need to update anything. return; } // Save reference to server connection object to be able to send // user interaction later this.gClient = client; // Save the client side identifier (paintable id) for the widget paintableId = uidl.getId(); try { if (uidl.hasAttribute("escapeHTML")) { this.escapeHTML = uidl.getBooleanAttribute("escapeHTML"); } UIDL rows = uidl.getChildByTagName("rows"); if (rows != null) { // clear all old table cells table.removeAllRows(); highlighted.clear(); position2id.clear(); for (int i = 0; i < rows.getChildCount(); i++) { UIDL row = rows.getChildUIDL(i); if ("row".equals(row.getTag())) { addRow(row, i); } } } // end if rows not null // add end events if necessary to have a nicely aligned regular grid int maxCellCount = 0; for (int row = 0; row < table.getRowCount(); row++) { maxCellCount = Math.max(maxCellCount, getRealColumnCount(row)); } for (int row = 0; row < table.getRowCount(); row++) { int isValue = getRealColumnCount(row); if (isValue < maxCellCount) { int diff = maxCellCount - isValue; table.setHTML(row, table.getCellCount(row) + diff - 1, ""); } } } catch (Exception ex) { VConsole.log(ex); } }
From source file:annis.gui.widgets.gwt.client.ui.VAudioPlayer.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (client.updateComponent(this, uidl, true)) { return;//from www . j av a2s. c o m } super.updateFromUIDL(uidl, client); Style mediaStyle = getMedia().getStyle(); // ensure control visibility if ((mediaStyle.getHeight() == null || "".equals(mediaStyle.getHeight()))) { if (BrowserInfo.get().isChrome()) { mediaStyle.setHeight(32, Style.Unit.PX); } else { mediaStyle.setHeight(25, Style.Unit.PX); } } }
From source file:annis.gui.widgets.gwt.client.ui.VJITWrapper.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. // It handles sizes, captions, tooltips, etc. automatically. if (client.updateComponent(this, uidl, true)) { // If client.updateComponent returns true there has been no changes and we // do not need to update anything. return;/*w w w . ja v a2s . c o m*/ } if (uidl.hasAttribute("visData")) { jsonData = parseStringToJSON(uidl.getStringAttribute("visData")); // setup config for visualization if (uidl.hasAttribute("mappings")) { setupConfig(uidl.getMapAttribute("mappings")); } else { setupConfig(); } if (visualization == null) { visualization = visualizationInit(config.getJavaScriptObject()); } if (jsonData != null) { visualization.render(); } else { GWT.log("jsonData are null"); } } }
From source file:annis.gui.widgets.gwt.client.ui.VMediaPlayerBase.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (client.updateComponent(this, uidl, true)) { return;/* www .j a v a 2s .com*/ } // Save reference to server connection object to be able to send // user interaction later this.gClient = client; // Save the client side identifier (paintable id) for the widget paintableId = uidl.getId(); if (media == null) { VConsole.error("media not set!!!"); return; } if (uidl.hasAttribute(SOURCE_URL)) { registerMetadataLoadedEvent(media); if (uidl.hasAttribute(MIME_TYPE)) { String mimeType = uidl.getStringAttribute(MIME_TYPE); VConsole.log( "canPlayType for \"" + mimeType + "\"value is \"" + media.canPlayType(mimeType) + "\""); // check for correct mime type if (media.canPlayType(uidl.getStringAttribute(MIME_TYPE)).equals(MediaElement.CANNOT_PLAY)) { VConsole.log("CANNOT PLAY!!!"); gClient.updateVariable(paintableId, CANNOT_PLAY, true, true); } else if (media.canPlayType(uidl.getStringAttribute(MIME_TYPE)) .equals(MediaElement.CAN_PLAY_MAYBE)) { gClient.updateVariable(paintableId, MIGHT_NOT_PLAY, true, true); } } media.setSrc(uidl.getStringAttribute(SOURCE_URL)); } if (uidl.hasAttribute(PLAY)) { String[] time = uidl.getStringArrayAttribute(PLAY); if (time != null && time.length > 0) { if (time.length == 1) { try { media.setCurrentTime(Double.parseDouble(time[0])); } catch (NumberFormatException ex) { VConsole.error(ex); } } else if (time.length == 2) { try { media.setCurrentTime(Double.parseDouble(time[0])); setEndTimeOnce(media, Double.parseDouble(time[1])); } catch (NumberFormatException ex) { VConsole.error(ex); } } media.play(); } } else if (uidl.hasAttribute(PAUSE)) { media.pause(); } else if (uidl.hasAttribute(STOP)) { media.pause(); media.setSrc(""); } }
From source file:annis.gui.widgets.gwt.client.ui.VSimpleCanvas.java
License:Apache License
/** * Called whenever an update is received from the server *//*from w w w . j ava 2 s .c o m*/ @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. // It handles sizes, captions, tooltips, etc. automatically. if (client.updateComponent(this, uidl, true)) { // If client.updateComponent returns true there has been no changes and we // do not need to update anything. return; } // Save reference to server connection object to be able to send // user interaction later //this.gClient = client; // Save the client side identifier (paintable id) for the widget //paintableId = uidl.getId(); if (context != null) { Iterator<Object> it = uidl.getChildIterator(); while (it.hasNext()) { UIDL child = (UIDL) it.next(); if ("clear".equals(child.getTag())) { context.clearRect(0, 0, context.getCanvas().getWidth(), context.getCanvas().getHeight()); } else if ("line".equals(child.getTag())) { context.setGlobalAlpha(1.0); context.setLineWidth(1.0); context.setStrokeStyle("black"); context.beginPath(); context.moveTo(child.getIntAttribute("from_x"), child.getIntAttribute("from_y")); context.lineTo(child.getIntAttribute("to_x"), child.getIntAttribute("to_y")); context.closePath(); context.stroke(); } // todo: more commands :) } } }
From source file:com.wcs.wcslib.vaadin.widget.multifileupload.client.VMultiUpload.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (client.updateComponent(this, uidl, true)) { return;//from www.j a va 2 s. c o m } addStyleName(CLASSNAME + "-immediate"); this.client = client; paintableId = uidl.getId(); receiverUri = client.translateVaadinUri(uidl.getStringVariable("target")); submitButton.setText(uidl.getStringAttribute("buttoncaption")); fu.setName(paintableId + "_file"); if (uidl.hasAttribute("enabled")) { if (uidl.getBooleanAttribute("enabled")) { enableUpload(); } else { disableUpload(); } } if (uidl.hasAttribute("maxFileSize")) { maxFileSize = uidl.getLongAttribute("maxFileSize"); } if (uidl.hasAttribute("sizeErrorMsg")) { sizeErrorMsg = uidl.getStringAttribute("sizeErrorMsg"); } if (uidl.hasAttribute("mimeTypeErrorMsg")) { mimeTypeErrorMsg = uidl.getStringAttribute("mimeTypeErrorMsg"); } if (uidl.hasAttribute("acceptFilter")) { getInput().setAccept(uidl.getStringAttribute("acceptFilter")); } if (uidl.hasAttribute("acceptedMimeTypes")) { acceptedMimeTypes = Arrays.asList(uidl.getStringArrayAttribute("acceptedMimeTypes")); } if (uidl.hasAttribute("interruptedFileIds")) { removeFromFileQueue(uidl.getIntArrayAttribute("interruptedFileIds")); } if (uidl.hasAttribute("ready")) { postNextFileFromQueue(); } }
From source file:org.opennms.features.topology.ssh.internal.gwt.client.ui.VTerminal.java
License:Open Source License
/** * The updateFromUIDL method handles all communication from the server and passes * the data along to the GwtTerminal widget which updates the client side view. */// w w w. ja va 2s .com @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. Ensure correct implementation, // and let the containing layout manage caption, etc. if (client.updateComponent(this, uidl, true)) { return; } // Save reference to server connection object to be able to send // user interaction later this.client = client; // Save the UIDL identifier for the component this.uidlId = uidl.getId(); // Check if the server wants the TermHandler to close, if so, send a // response back to the server that it was closed successfully if (uidl.getBooleanVariable("closeClient")) { termHandler.close(); isClosed = true; sendBytes(""); } // Check if the server wants the TermHandler to update manually if (uidl.getBooleanVariable("update")) update(); if (uidl.getBooleanVariable("focus")) { super.focus(); isFocused = true; } // Take the current representation of the Terminal from the server // and set the Inner HTML of the widget dump(uidl.getStringVariable("fromSSH")); }
From source file:org.semanticsoft.vaadinaddons.boundsinfo.client.ui.VBoundsinfoVerticalLayout.java
License:Open Source License
/** * Called whenever an update is received from the server */// w ww .j a v a2 s.c o m public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); // This call should be made first. // It handles sizes, captions, tooltips, etc. automatically. if (client.updateComponent(this, uidl, true)) { // If client.updateComponent returns true there has been no changes // and we // do not need to update anything. return; } // Save reference to server connection object to be able to send // user interaction later this.client = client; // Save the client side identifier (paintable id) for the widget paintableId = uidl.getId(); if (uidl.hasAttribute(VARIABLES)) { ValueMap vmap = uidl.getMapAttribute(VARIABLES); Set<String> indexes = vmap.getKeySet(); for (String index : indexes) { variables.put(index, vmap.getString(index)); } } this.enableBoundsUpdate = uidl.getBooleanAttribute(ENABLE_BOUNDS_UPDATE); if (this.enableBoundsUpdate) updateManager = new BoundsUpdateManager(this, paintableId, client); }