Search in sources :

Example 1 with UploadField

use of com.haulmont.cuba.gui.components.UploadField in project cuba by cuba-platform.

the class FileUploadFieldLoader method loadDropZone.

protected void loadDropZone(UploadField uploadField, Element element) {
    String dropZoneId = element.attributeValue("dropZone");
    if (StringUtils.isNotEmpty(dropZoneId)) {
        Component dropZone = context.getFrame().getComponent(dropZoneId);
        if (dropZone instanceof BoxLayout) {
            uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
        } else if (dropZone != null) {
            log.warn("Unsupported dropZone class {}", dropZone.getClass().getName());
        } else {
            log.warn("Unable to find dropZone component with id: {}", dropZoneId);
        }
    }
    String dropZonePrompt = element.attributeValue("dropZonePrompt");
    if (StringUtils.isNotEmpty(dropZonePrompt)) {
        uploadField.setDropZonePrompt(loadResourceString(dropZonePrompt));
    }
}
Also used : BoxLayout(com.haulmont.cuba.gui.components.BoxLayout) UploadField(com.haulmont.cuba.gui.components.UploadField) FileUploadField(com.haulmont.cuba.gui.components.FileUploadField) Component(com.haulmont.cuba.gui.components.Component)

Example 2 with UploadField

use of com.haulmont.cuba.gui.components.UploadField in project cuba by cuba-platform.

the class AbstractUploadFieldLoader method loadDropZone.

protected void loadDropZone(UploadField uploadField, Element element) {
    String dropZoneId = element.attributeValue("dropZone");
    if (StringUtils.isNotEmpty(dropZoneId)) {
        Component dropZone = context.getFrame().getComponent(dropZoneId);
        if (dropZone instanceof BoxLayout) {
            uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
        } else if (dropZone != null) {
            log.warn("Unsupported dropZone class {}", dropZone.getClass().getName());
        } else {
            log.warn("Unable to find dropZone component with id: {}", dropZoneId);
        }
    }
    String dropZonePrompt = element.attributeValue("dropZonePrompt");
    if (StringUtils.isNotEmpty(dropZonePrompt)) {
        uploadField.setDropZonePrompt(loadResourceString(dropZonePrompt));
    }
}
Also used : BoxLayout(com.haulmont.cuba.gui.components.BoxLayout) UploadField(com.haulmont.cuba.gui.components.UploadField) Component(com.haulmont.cuba.gui.components.Component)

Aggregations

BoxLayout (com.haulmont.cuba.gui.components.BoxLayout)2 Component (com.haulmont.cuba.gui.components.Component)2 UploadField (com.haulmont.cuba.gui.components.UploadField)2 FileUploadField (com.haulmont.cuba.gui.components.FileUploadField)1