Search in sources :

Example 6 with CubaFileUpload

use of com.haulmont.cuba.web.toolkit.ui.CubaFileUpload in project cuba by cuba-platform.

the class WebFileUploadField method setDropZone.

@Override
public void setDropZone(DropZone dropZone) {
    super.setDropZone(dropZone);
    if (uploadButton instanceof CubaFileUpload) {
        if (dropZone == null) {
            ((CubaFileUpload) uploadButton).setDropZone(null);
        } else {
            com.haulmont.cuba.gui.components.Component target = dropZone.getTarget();
            if (target instanceof Window.Wrapper) {
                target = ((Window.Wrapper) target).getWrappedWindow();
            }
            Component vComponent = target.unwrapComposition(Component.class);
            ((CubaFileUpload) uploadButton).setDropZone(vComponent);
        }
    }
}
Also used : Window(com.haulmont.cuba.gui.components.Window) FileUploadFieldListenerWrapper(com.haulmont.cuba.gui.components.compatibility.FileUploadFieldListenerWrapper) CubaFileUpload(com.haulmont.cuba.web.toolkit.ui.CubaFileUpload) UploadComponent(com.haulmont.cuba.web.toolkit.ui.UploadComponent) Component(com.vaadin.ui.Component)

Aggregations

CubaFileUpload (com.haulmont.cuba.web.toolkit.ui.CubaFileUpload)6 Component (com.vaadin.ui.Component)4 FileStorageException (com.haulmont.cuba.core.global.FileStorageException)2 Window (com.haulmont.cuba.gui.components.Window)2 FileUploadingAPI (com.haulmont.cuba.gui.upload.FileUploadingAPI)2 CubaAbstractUploadComponent (com.haulmont.cuba.web.toolkit.ui.CubaAbstractUploadComponent)2 UploadComponent (com.haulmont.cuba.web.toolkit.ui.UploadComponent)2 ClientConfig (com.haulmont.cuba.client.ClientConfig)1 Configuration (com.haulmont.cuba.core.global.Configuration)1 Messages (com.haulmont.cuba.core.global.Messages)1 FileUploadFieldListenerWrapper (com.haulmont.cuba.gui.components.compatibility.FileUploadFieldListenerWrapper)1 MultiUploadFieldListenerWrapper (com.haulmont.cuba.gui.components.compatibility.MultiUploadFieldListenerWrapper)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1