Example usage for com.vaadin.server Page getCurrent

List of usage examples for com.vaadin.server Page getCurrent

Introduction

In this page you can find the example usage for com.vaadin.server Page getCurrent.

Prototype

public static Page getCurrent() 

Source Link

Document

Gets the Page to which the current uI belongs.

Usage

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java

License:Open Source License

@SuppressWarnings("squid:S3655")
private void processArtifactUpload() {
    final List<String> itemIds = (List<String>) uploadDetailsTable.getItemIds();
    if (preUploadValidation(itemIds)) {
        Boolean refreshArtifactDetailsLayout = false;
        for (final String itemId : itemIds) {
            final String[] itemDet = itemId.split("/");
            final String baseSoftwareModuleNameVersion = itemDet[0];
            final String fileName = itemDet[1];
            final SoftwareModule bSoftwareModule = artifactUploadState.getBaseSwModuleList()
                    .get(baseSoftwareModuleNameVersion);
            for (final CustomFile customFile : uploadLayout.getFileSelected()) {
                final String baseSwModuleNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
                        customFile.getBaseSoftwareModuleName(), customFile.getBaseSoftwareModuleVersion());
                if (customFile.getFileName().equals(fileName)
                        && baseSwModuleNameVersion.equals(baseSoftwareModuleNameVersion)) {
                    createArtifact(itemId, customFile.getFilePath(), customFile.getFileSize(),
                            artifactManagement, bSoftwareModule);
                }//from   w  w  w  .j a  v a 2 s.c  o m
            }
            refreshArtifactDetailsLayout = checkIfArtifactDetailsDisplayed(bSoftwareModule.getId());
        }

        if (refreshArtifactDetailsLayout) {
            uploadLayout.refreshArtifactDetailsLayout(artifactUploadState.getSelectedBaseSwModuleId().get());
        }
        uploadLayout.clearFileList();
        window.close();
        // call upload result window
        currentUploadResultWindow = new UploadResultWindow(uploadResultList, i18n, eventBus);
        UI.getCurrent().addWindow(currentUploadResultWindow.getUploadResultsWindow());
        currentUploadResultWindow.getUploadResultsWindow()
                .addCloseListener(event -> onResultDetailsPopupClose());
        uploadLayout.setResultPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
                Page.getCurrent().getBrowserWindowHeight());
    } else {
        uploadLayout.getUINotification()
                .displayValidationError(uploadLayout.getI18n().getMessage("message.error.noProvidedName"));
    }
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout.java

License:Open Source License

private void displayConfirmWindow(final Button.ClickEvent event) {
    if (event.getComponent().getId().equals(UIComponentIdProvider.UPLOAD_PROCESS_BUTTON)) {
        if (artifactUploadState.getFileSelected().isEmpty()) {
            uiNotification.displayValidationError(i18n.getMessage("message.error.noFileSelected"));
        } else {/*ww  w.j a  va 2  s  .  c  om*/
            currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState, eventBus,
                    artifactManagement);
            UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfirmationWindow());
            setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
                    Page.getCurrent().getBrowserWindowHeight());
        }
    }
}

From source file:org.eclipse.hawkbit.ui.artifacts.UploadArtifactView.java

License:Open Source License

@PostConstruct
void init() {/*from   w  w w  . jav a2  s  .c o  m*/
    buildLayout();
    restoreState();
    checkNoDataAvaialble();
    eventBus.subscribe(this);
    Page.getCurrent().addBrowserWindowResizeListener(this);
    showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
}

From source file:org.eclipse.hawkbit.ui.common.AbstractAcceptCriteria.java

License:Open Source License

/**
 * /*from   ww w. java2 s  .  com*/
 * @param dragEvent
 * @param compsource
 */
protected void showRowCount(final DragAndDropEvent dragEvent, final Table compsource) {
    /* Show the number of rows that are dragging in the drag image */
    final Set<String> targetSelectedList = new HashSet<>((Set<String>) compsource.getValue());
    /**
     * Remove null value if any .
     */
    targetSelectedList.remove(null);

    if (previousRowCount != targetSelectedList.size()) {
        previousRowCount = targetSelectedList.size();
        /*
         * Prepare the hava script to add the <style> tag to the head of the
         * html
         */
        if (!targetSelectedList.contains(dragEvent.getTransferable().getData(SPUIDefinitions.ITEMID))) {
            previousRowCount = 1;
        }
        final String exeJS = HawkbitCommonUtil.getDragRowCountJavaScript(previousRowCount);
        Page.getCurrent().getJavaScript().execute(exeJS);
    }
}

From source file:org.eclipse.hawkbit.ui.distributions.DistributionsView.java

License:Open Source License

@PostConstruct
void init() {//from ww  w . ja va 2s  .c  o m
    buildLayout();
    restoreState();
    checkNoDataAvaialble();
    Page.getCurrent().addBrowserWindowResizeListener(this);
    showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
}

From source file:org.eclipse.hawkbit.ui.distributions.smtable.SwModuleTable.java

License:Open Source License

private void styleTableOnDistSelection() {
    Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.getScriptSMHighlightReset());
    setCellStyleGenerator(new Table.CellStyleGenerator() {
        private static final long serialVersionUID = 1L;

        @Override/*from  w w w.j  a  va  2s .c  o m*/
        public String getStyle(final Table source, final Object itemId, final Object propertyId) {
            return createTableStyle(itemId, propertyId);
        }
    });
}

From source file:org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout.java

License:Open Source License

/**
 * Dynamic styles for window.//from   www.jav  a 2  s. c o  m
 *
 * @param top
 *            int value
 * @param marginLeft
 *            int value
 */
protected void getPreviewButtonColor(final String color) {
    Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.getPreviewButtonColorScript(color));
}

From source file:org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout.java

License:Open Source License

/**
 * Get target style - Dynamically as per the color picked, cannot be done
 * from the static css.//from   w  w w .j  a va2  s . co m
 *
 * @param colorPickedPreview
 */
private static void getTargetDynamicStyles(final String colorPickedPreview) {
    Page.getCurrent().getJavaScript()
            .execute(HawkbitCommonUtil.changeToNewSelectedPreviewColor(colorPickedPreview));
}

From source file:org.eclipse.hawkbit.ui.layouts.AbstractTypeLayout.java

License:Open Source License

private static void getDynamicStyles(final String colorPickedPreview) {
    Page.getCurrent().getJavaScript()
            .execute(HawkbitCommonUtil.changeToNewSelectedPreviewColor(colorPickedPreview));
}

From source file:org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout.java

License:Open Source License

/**
 * Get target style - Dynamically as per the color picked, cannot be done
 * from the static css.//from   w w w  .  ja  v a2s.  co m
 * 
 * @param colorPickedPreview
 */
private void getDynamicStyles(final String colorPickedPreview) {

    Page.getCurrent().getJavaScript()
            .execute(HawkbitCommonUtil.changeToNewSelectedPreviewColor(colorPickedPreview));
}