List of usage examples for com.vaadin.client Util findConnectorFor
public static ComponentConnector findConnectorFor(Widget widget)
From source file:com.haulmont.cuba.web.toolkit.ui.client.fieldgrouplayout.CubaFieldGroupLayoutComponentSlot.java
License:Apache License
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK) { Element target = Element.as(event.getEventTarget()); ComponentConnector componentConnector = Util.findConnectorFor(getWidget()); if (target == contextHelpIndicatorElement && componentConnector instanceof HasContextHelpConnector) { HasContextHelpConnector connector = (HasContextHelpConnector) componentConnector; if (hasContextHelpIconListeners(componentConnector.getState())) { connector.contextHelpIconClick(event); }/*from w w w . java 2s . c om*/ } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.JQueryFileUploadOverlay.java
License:Apache License
protected static boolean isUnderOverlay(Element dropZoneElement) { Widget dropZoneWidget = WidgetUtil.findWidget(dropZoneElement, null); if (dropZoneWidget == null) return false; ComponentConnector dropZoneConnector = Util.findConnectorFor(dropZoneWidget); if (dropZoneConnector == null) return false; ApplicationConnection ac = dropZoneConnector.getConnection(); List<WindowConnector> windowConnectors = ac.getUIConnector().getSubWindows(); if (windowConnectors == null || windowConnectors.size() == 0) return false; List<VWindow> windows = windowConnectors.stream().map(WindowConnector::getWidget) .collect(Collectors.toList()); Widget dropZoneTopParent = getWidgetTopParent(dropZoneWidget); if (dropZoneTopParent instanceof VWindow) { return modalWindowIsUnderOverlay((VWindow) dropZoneTopParent, windows); } else if (dropZoneTopParent instanceof VUI) { return containsModalWindow(windows); } else {// ww w .ja v a 2 s. c om Widget topParentOwner = ((VOverlay) dropZoneTopParent).getOwner(); Widget ownerParent = getWidgetTopParent(topParentOwner); if (ownerParent instanceof VWindow) { return modalWindowIsUnderOverlay((VWindow) ownerParent, windows); } else { return containsModalWindow(windows); } } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout.CubaOrderedLayoutSlot.java
License:Apache License
@Override public void onClick(ClickEvent event) { Element target = Element.as(event.getNativeEvent().getEventTarget()); ComponentConnector componentConnector = Util.findConnectorFor(getWidget()); if (target == contextHelpIcon && componentConnector instanceof HasContextHelpConnector) { HasContextHelpConnector connector = (HasContextHelpConnector) componentConnector; if (hasContextHelpIconListeners(componentConnector.getState())) { connector.contextHelpIconClick(event); }/* w w w. java 2s. c om*/ } }
From source file:com.haulmont.cuba.web.toolkit.ui.client.tableshared.TableWidgetDelegate.java
License:Apache License
public void scheduleLayoutForChildWidgets() { if (table.scrollBody != null) { // Fix for #VAADIN-12970, relayout cell widgets // Haulmont API ComponentConnector connector = Util.findConnectorFor(table); // may be null if we switch tabs fast if (connector != null) { LayoutManager lm = connector.getLayoutManager(); for (Widget w : table.scrollBody) { HasWidgets row = (HasWidgets) w; for (Widget child : row) { ComponentConnector childConnector = Util.findConnectorFor(child); if (childConnector != null && childConnector.getConnectorId() != null) { if (childConnector instanceof ManagedLayout || childConnector instanceof AbstractLayoutConnector) { lm.setNeedsMeasure(childConnector); }//from ww w .j a v a 2s . c om } } } } } }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.absolutelayout.VDDAbsoluteLayout.java
License:Apache License
/** * Can be used to listen to drag start events, must return true for the drag * to commence. Return false to interrupt the drag: *///w w w . jav a 2s . c o m public boolean dragStart(Widget widget, LayoutDragMode mode) { ComponentConnector layout = Util.findConnectorFor(this); return VDragDropUtil.isDraggingEnabled(layout, widget); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.formlayout.VDDFormLayout.java
License:Apache License
/** * Can be used to listen to drag start events, must return true for the drag * to commence. Return false to interrupt the drag: *//* ww w.j av a2 s. c o m*/ @Override public boolean dragStart(Widget widget, LayoutDragMode mode) { ComponentConnector layout = Util.findConnectorFor(this); return VDragDropUtil.isDraggingEnabled(layout, widget); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.panel.VDDPanel.java
License:Apache License
@Override public boolean dragStart(Widget widget, LayoutDragMode mode) { ComponentConnector layout = Util.findConnectorFor(this); return VDragDropUtil.isDraggingEnabled(layout, widget); }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDDLayoutStateDragImageProvider.java
License:Apache License
@Override public Element getDragImageElement(Widget w) { ComponentConnector component = Util.findConnectorFor(w); Connector dragImage = state.referenceImageComponents.get(component); if (dragImage != null) { return ConnectorMap.get(component.getConnection()).getElement(dragImage.getConnectorId()); }/* w w w . j av a 2 s. com*/ return null; }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragCaptionProvider.java
License:Apache License
public Element getDragCaptionElement(Widget w) { ComponentConnector component = Util.findConnectorFor(w); DDLayoutState state = ((DragAndDropAwareState) root.getState()).getDragAndDropState(); DragCaptionInfo dci = state.dragCaptions.get(component); Document document = Document.get(); Element dragCaptionImage = document.createDivElement(); Element dragCaption = document.createSpanElement(); String dragCaptionText = dci.caption; if (dragCaptionText != null) { if (dci.contentMode == ContentMode.TEXT) { dragCaption.setInnerText(dragCaptionText); } else if (dci.contentMode == ContentMode.HTML) { dragCaption.setInnerHTML(dragCaptionText); } else if (dci.contentMode == ContentMode.PREFORMATTED) { PreElement preElement = document.createPreElement(); preElement.setInnerText(dragCaptionText); dragCaption.appendChild(preElement); }/* w w w . j a v a2s . c o m*/ } String dragIconKey = state.dragCaptions.get(component).iconKey; if (dragIconKey != null) { String resourceUrl = root.getResourceUrl(dragIconKey); Icon icon = component.getConnection().getIcon(resourceUrl); dragCaptionImage.appendChild(icon.getElement()); } dragCaptionImage.appendChild(dragCaption); return dragCaptionImage; }
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragDropUtil.java
License:Apache License
/** * Creates a transferable for the tabsheet * /*from w w w. jav a 2 s. co m*/ * @param tabsheet * The tabsheet the event occurred * @param tab * The tab on which the event occurred * @param event * The event * @param root * The root widget * @return */ private static VTransferable createTabsheetTransferableFromMouseDown(VDDTabSheet tabsheet, TabCaption tab, NativeEvent event) { VTransferable transferable = new VTransferable(); transferable.setDragSource(Util.findConnectorFor(tabsheet)); transferable.setData(Constants.TRANSFERABLE_DETAIL_COMPONENT, tabsheet.getTab(tabsheet.getTabPosition(tab))); transferable.setData(Constants.TRANSFERABLE_DETAIL_INDEX, tabsheet.getTabPosition(tab)); transferable.setData(Constants.TRANSFERABLE_DETAIL_MOUSEDOWN, MouseEventDetailsBuilder.buildMouseEventDetails(event).serialize()); return transferable; }