List of usage examples for com.vaadin.client UIDL getChildCount
public native int getChildCount() ;
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 w w . j a v a 2s . 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); }
From source file:org.vaadin.tltv.multiscrolltable.client.ui.ContentPanel.java
License:Apache License
public void updateContent(UIDL uidl) { if (uidl == null) { return;/*from w ww. j a va 2 s .c o m*/ } int rowCount = uidl.getChildCount(); int columnCount = (headerContainer != null) ? headerContainer.getColumnCount() : 0; if (rowCount == 0 || columnCount == 0) { return; } for (int i = 0; i < rowCount; i++) { UIDL rowUidl = uidl.getChildUIDL(i); Row row = rowContainer.createRow(i, rowUidl); } updateRowContentTop(); setInternalContentTop(); int[] widths = calculateMinWidthsForColumns(rowContainer.getRows()); // Update headerContainer column widths by the cell widths if (headerContainer != null) { widths = headerContainer.setColumnMinWidths(widths); setColumnMinWidths(rowContainer.getRows(), widths); } rowContainer.setReConstruct(false); }
From source file:org.vaadin.tltv.multiscrolltable.client.ui.HeaderPanel.java
License:Apache License
public void updateContent(UIDL uidl) { if (uidl == null) { return;/* w w w . j a v a2s .c o m*/ } if (uidl.getTag().equals(VCustomScrollTable.TAG_SCROLLCONTENT)) { int childcount = uidl.getChildCount(); if (childcount > 0) { ColumnPanel prev = null; for (int i = 0; i < childcount; i++) { prev = updateContentByGroupUidl(uidl.getChildUIDL(i), 0, i, prev, null); } } } if (reConstruct) { columnCount = 0; if (content.getRowCount() > 0) { columnCount = content.getCellCount(content.getRowCount() - 1); } } reConstruct = false; }
From source file:org.vaadin.tltv.multiscrolltable.client.ui.HeaderPanel.java
License:Apache License
private ColumnPanel updateContentByGroupUidl(UIDL uidl, int level, int index, ColumnPanel prevColumn, ColumnPanel group) {//from w w w . j a va2 s. c o m if (uidl == null) { return null; } String caption = uidl.getStringAttribute(VCustomScrollTable.ATTR_CAPTION); ColumnPanel p = getColumnPanel(level, index, prevColumn, group); updateGroupElement(p); p.getLabel().setText(caption); boolean updateColSpan = false; int childs = uidl.getChildCount(); if (childs <= 0) { return p; } int cellCount = p.getFirstChildIndex(); if (reConstruct) { // When reconstructing, p.getFirstChildIndex() value is not updated // yet. try { cellCount = content.getCellCount(level + 1); } catch (IndexOutOfBoundsException e) { cellCount = 0; } } ColumnPanel prev = null; for (int i = 0; i < childs; i++) { UIDL subUidl = uidl.getChildUIDL(i); if (subUidl.getTag().equals(VCustomScrollTable.TAG_COLUMN)) { prev = updateContentByColumnUidl(subUidl, level + 1, cellCount + i, prev, p); updateColSpan = reConstruct; } else if (subUidl.getTag().equals(VCustomScrollTable.TAG_COLUMNGROUP)) { prev = updateContentByGroupUidl(subUidl, level + 1, i, prev, p); } } if (updateColSpan) { // This needs to be called only for the "leaf" panels. p.setColSpan(childs); } return p; }