Example usage for com.vaadin.client ApplicationConnection getUIConnector

List of usage examples for com.vaadin.client ApplicationConnection getUIConnector

Introduction

In this page you can find the example usage for com.vaadin.client ApplicationConnection getUIConnector.

Prototype

public UIConnector getUIConnector() 

Source Link

Document

Gets the main view.

Usage

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 {//  w  w  w  .  j ava 2  s  .co m
        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:org.eclipse.hawkbit.ui.dd.client.criteria.CriterionTestHelper.java

License:Open Source License

static VDragEvent createMockedVDragEvent(String dragSourceId, Widget widget, String theme) {
    VDragEvent dragEvent = createMockedVDragEvent(dragSourceId, widget);
    ApplicationConnection connection = Mockito.mock(ApplicationConnection.class);
    when(dragEvent.getTransferable().getDragSource().getConnection()).thenReturn(connection);
    UIConnector uiConnector = Mockito.mock(UIConnector.class);
    when(connection.getUIConnector()).thenReturn(uiConnector);
    when(uiConnector.getActiveTheme()).thenReturn(theme);

    return dragEvent;
}

From source file:org.vaadin.alump.offlinebuilder.client.offline.OfflineFactory.java

License:Open Source License

public void writeRootState(OfflineUIExtensionState state, ApplicationConnection connection) {
    OfflineStorage.clearAllItems();/* w  ww  . j a va 2s  . com*/
    OfflineStorage.set(generateRootKey(TITLE_KEY), state.title);
    Connector rootConnector = state.offlineRoot;
    OfflineStorage.set(generateRootKey(ROOT_KEY),
            rootConnector != null ? rootConnector.getConnectorId() : null);

    if (rootConnector != null) {
        writeState((OfflineConnector) rootConnector);
    }

    if (connection != null) {
        OfflineStorage.set(generateRootKey(UI_CLASS_KEY),
                connection.getUIConnector().getWidget().getElement().getClassName());
        OfflineStorage.set(generateRootKey(PARENT_CLASS_KEY),
                connection.getUIConnector().getWidget().getElement().getParentElement().getClassName());
    } else {
        OfflineStorage.set(generateRootKey(UI_CLASS_KEY), "");
        OfflineStorage.set(generateRootKey(PARENT_CLASS_KEY), "");
    }
}