Example usage for com.vaadin.client.ui VNotification CENTERED

List of usage examples for com.vaadin.client.ui VNotification CENTERED

Introduction

In this page you can find the example usage for com.vaadin.client.ui VNotification CENTERED.

Prototype

Position CENTERED

To view the source code for com.vaadin.client.ui VNotification CENTERED.

Click Source Link

Usage

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.client.VCustomUpload.java

License:Apache License

private boolean isValidFileSize(VHtml5File file) {
    if (file.getSize() > maxFileSize || file.getSize() <= 0) {
        String formattedErrorMsg = UploadClientUtil.getSizeErrorMessage(sizeErrorMsg, maxFileSize,
                file.getSize(), file.getName());
        VNotification.createNotification(1000, client.getUIConnector().getWidget()).show(formattedErrorMsg,
                VNotification.CENTERED, "warning");
        return false;
    }// ww w.ja  v a  2 s. co  m
    return true;
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.client.VCustomUpload.java

License:Apache License

private boolean isValidMimeType(VHtml5File file) {
    if (acceptedMimeTypes != null && !acceptedMimeTypes.isEmpty()
            && !acceptedMimeTypes.contains(file.getType())) {
        String formattedErrorMsg = UploadClientUtil.getMimeTypeErrorMessage(mimeTypeErrorMsg, file.getName());
        VNotification.createNotification(1000, client.getUIConnector().getWidget()).show(formattedErrorMsg,
                VNotification.CENTERED, "warning");
        return false;
    }//from w  w  w.  j  a  va  2 s .c o m
    return true;
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.client.VMultiUpload.java

License:Apache License

private void submit() {
    if (!enabled) {
        VConsole.log("Submit cancelled (disabled)");
        return;//from ww w . j a  v a 2s.c  om
    }
    int files = getFileCount(fu.getElement());
    List<String> filedetails = new ArrayList<String>();
    StringBuilder errorMsg = new StringBuilder();
    for (int i = 0; i < files; i++) {
        VHtml5File file = getFile(fu.getElement(), i);
        if (!isValidFileSize(file, errorMsg) || !isValidMimeType(file, errorMsg)) {
            continue;
        }

        FileWrapper wrapper = queueFilePost(file);
        filedetails.add(wrapper.serialize());
    }
    client.updateVariable(paintableId, "filequeue", filedetails.toArray(new String[filedetails.size()]), true);

    if (!errorMsg.toString().isEmpty()) {
        VNotification.createNotification(1000, client.getUIConnector().getWidget()).show(errorMsg.toString(),
                VNotification.CENTERED, "warning");
    }
    disableUpload();
}

From source file:org.vaadin.gridfiledownloader.client.GridFileDownloaderConnector.java

License:Apache License

/**
 * Display notification for informing the user that a new download couldn't
 * be triggered because previous download is still processing.
 *///w  ww.  j  av  a  2  s . c  o  m
protected void downloadIgnoredBecauseProcessing() {
    VNotification n = VNotification.createNotification(getState().notificationDelay, grid);
    n.getElement().getStyle().setTextAlign(TextAlign.LEFT);
    n.show("<h1>" + getState().processingCaption + "</h1><br />"
            + getState().processingDescription.replace("\n", "<br/>\n"), VNotification.CENTERED,
            getState().processingNotificationType);
}