List of usage examples for com.vaadin.client UIDL getChildUIDL
public native UIDL getChildUIDL(int i) ;
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 .ja v a 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(); 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.VAnnotationGrid.java
License:Apache License
private void addRow(UIDL row, int rowNumber) { String caption = row.getStringAttribute("caption"); boolean showNamespace = row.getBooleanAttribute("show-namespace"); String name;/* w w w . ja va 2 s . c o m*/ if (showNamespace) { name = caption; } else { String[] captionSplit = caption.split("::"); name = captionSplit[captionSplit.length - 1]; } boolean showCaption = row.getBooleanAttribute("show-caption"); int startColumn = 0; if (showCaption) { table.setHTML(rowNumber, 0, Util.escapeHTML(name)); formatter.addStyleName(rowNumber, 0, "header"); startColumn = 1; } int colspanOffset = 0; UIDL events = row.getChildByTagName("events"); for (int j = 0; j < events.getChildCount(); j++) { UIDL event = events.getChildUIDL(j); String id = event.getStringAttribute("id"); int left = event.getIntAttribute("left"); int right = event.getIntAttribute("right"); String value = event.getStringAttribute("value"); if (escapeHTML) { value = Util.escapeHTML(value); } // +1 because we also have a caption column, subtract columns we // jumped over by using colspan int col = left + startColumn - colspanOffset; table.setHTML(rowNumber, col, value); if (event.hasAttribute("tooltip")) { Element tdElement = table.getCellFormatter().getElement(rowNumber, col); tdElement.setTitle(event.getStringAttribute("tooltip")); } position2id.put(new Position(rowNumber, col), id); int colspan = right - left + 1; formatter.setColSpan(rowNumber, col, colspan); if (colspan > 1) { colspanOffset += (colspan - 1); } addStyleForEvent(event, rowNumber, col); } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.combobox.CubaComboBoxConnector.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); // We may have actions attached to this text field if (uidl.getChildCount() > 0) { final int cnt = uidl.getChildCount(); for (int i = 0; i < cnt; i++) { UIDL childUidl = uidl.getChildUIDL(i); if (childUidl.getTag().equals("actions")) { if (getWidget().getShortcutActionHandler() == null) { getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client)); }/*ww w . j ava 2 s . co m*/ getWidget().getShortcutActionHandler().updateActionMap(childUidl); } } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.cssactionslayout.CubaCssActionsLayoutConnector.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { final int cnt = uidl.getChildCount(); for (int i = 0; i < cnt; i++) { UIDL childUidl = uidl.getChildUIDL(i); if (childUidl.getTag().equals("actions")) { if (getWidget().getShortcutHandler() == null) { getWidget().setShortcutHandler(new ShortcutActionHandler(uidl.getId(), client)); }/* w w w. j a va 2 s.c om*/ getWidget().getShortcutHandler().updateActionMap(childUidl); } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.datefield.CubaDateFieldConnector.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); getWidget().updateTextState();/*from w w w. ja v a 2 s . co m*/ // We may have actions attached to this text field if (uidl.getChildCount() > 0) { final int cnt = uidl.getChildCount(); for (int i = 0; i < cnt; i++) { UIDL childUidl = uidl.getChildUIDL(i); if (childUidl.getTag().equals("actions")) { if (getWidget().getShortcutActionHandler() == null) { getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client)); } getWidget().getShortcutActionHandler().updateActionMap(childUidl); } } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.table.CubaScrollTableConnector.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); if (uidl.hasVariable("collapsedcolumns")) { getWidget().addStyleName("collapsing-allowed"); } else {// w w w . j av a 2s . com getWidget().removeStyleName("collapsing-allowed"); } // We may have actions attached to this table if (uidl.getChildCount() > 1) { final int cnt = uidl.getChildCount(); for (int i = 1; i < cnt; i++) { UIDL childUidl = uidl.getChildUIDL(i); if (childUidl.getTag().equals("shortcuts")) { if (getWidget().getShortcutActionHandler() == null) { getWidget().setShortcutActionHandler( new CubaTableShortcutActionHandler(uidl.getId(), client, this)); } getWidget().getShortcutActionHandler().updateActionMap(childUidl); } } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.tree.CubaTreeConnector.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); getWidget().setDoubleClickHandling(false); getWidget().nodeCaptionsAsHtml = uidl.getBooleanAttribute("nodeCaptionsAsHtml"); // We may have actions attached to this tree if (uidl.getChildCount() > 1) { final int cnt = uidl.getChildCount(); for (int i = 1; i < cnt; i++) { UIDL childUidl = uidl.getChildUIDL(i); if (childUidl.getTag().equals("shortcuts")) { if (getWidget().getShortcutActionHandler() == null) { getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client)); }// w w w .ja v a2s .c o m getWidget().getShortcutActionHandler().updateActionMap(childUidl); } } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.treetable.CubaTreeTableConnector.java
License:Apache License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); if (uidl.hasVariable("collapsedcolumns")) { getWidget().addStyleName("collapsing-allowed"); } else {//from www. j a v a 2 s. c om getWidget().removeStyleName("collapsing-allowed"); } // We may have actions attached to this table if (uidl.getChildCount() > 1) { final int cnt = uidl.getChildCount(); for (int i = 1; i < cnt; i++) { UIDL childUidl = uidl.getChildUIDL(i); if (childUidl.getTag().equals("shortcuts")) { if (getWidget().getShortcutActionHandler() == null) { getWidget().setShortcutActionHandler( new CubaTableShortcutActionHandler(uidl.getId(), client, this)); } getWidget().getShortcutActionHandler().updateActionMap(childUidl); } } } getWidget().updateTableBodyScroll(); }
From source file:org.eclipse.hawkbit.ui.dd.client.criteria.ViewClientCriterion.java
License:Open Source License
private static VAcceptCriterion getCriteria(final UIDL configuration, final int i) { final UIDL childUIDL = configuration.getChildUIDL(i); return VAcceptCriteria.get(childUIDL.getStringAttribute("name")); }
From source file:org.eclipse.hawkbit.ui.dd.client.criteria.ViewClientCriterion.java
License:Open Source License
@Override // Exception squid:S1604 - GWT 2.7 does not support Java 8 @SuppressWarnings("squid:S1604") public void accept(final VDragEvent drag, final UIDL configuration, final VAcceptCallback callback) { if (isDragStarting(drag)) { final NativePreviewHandler nativeEventHandler = new NativePreviewHandler() { @Override//w ww . j av a2 s .c om public void onPreviewNativeEvent(final NativePreviewEvent event) { if (isEscKey(event) || isMouseUp(event)) { try { hideDropTargetHints(configuration); } finally { nativeEventHandlerRegistration.removeHandler(); } } } }; nativeEventHandlerRegistration = Event.addNativePreviewHandler(nativeEventHandler); setMultiRowDragDecoration(drag); } final int childCount = configuration.getChildCount(); accepted = false; for (int childIndex = 0; childIndex < childCount; childIndex++) { final VAcceptCriterion crit = getCriteria(configuration, childIndex); crit.accept(drag, configuration.getChildUIDL(childIndex), this); if (Boolean.TRUE.equals(accepted)) { callback.accepted(drag); return; } } // if no VAcceptCriterion accepts and the mouse is release, an error // message is shown if (Event.ONMOUSEUP == Event.getTypeInt(drag.getCurrentGwtEvent().getType())) { showErrorNotification(drag); } errorMessage = configuration.getStringAttribute(ERROR_MESSAGE); }