Search in sources :

Example 1 with UploadField

use of io.jmix.ui.component.UploadField in project jmix by jmix-framework.

the class FileUploadFieldLoader method loadDropZone.

protected void loadDropZone(UploadField uploadField, Element element) {
    String dropZoneId = element.attributeValue("dropZone");
    if (StringUtils.isNotEmpty(dropZoneId)) {
        Component dropZone = findComponent(dropZoneId);
        if (dropZone instanceof BoxLayout) {
            uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
        } else if (dropZone != null) {
            throw new GuiDevelopmentException("Unsupported dropZone class " + dropZone.getClass().getName(), context);
        } else {
            throw new GuiDevelopmentException("Unable to find dropZone component with id: " + dropZoneId, context);
        }
    }
    String dropZonePrompt = element.attributeValue("dropZonePrompt");
    if (StringUtils.isNotEmpty(dropZonePrompt)) {
        uploadField.setDropZonePrompt(loadResourceString(dropZonePrompt));
    }
}
Also used : BoxLayout(io.jmix.ui.component.BoxLayout) SingleFileUploadField(io.jmix.ui.component.SingleFileUploadField) UploadField(io.jmix.ui.component.UploadField) FileUploadField(io.jmix.ui.component.FileUploadField) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) Component(io.jmix.ui.component.Component)

Example 2 with UploadField

use of io.jmix.ui.component.UploadField in project jmix by jmix-framework.

the class FileMultiUploadFieldLoader method loadDropZone.

protected void loadDropZone(UploadField uploadField, Element element) {
    String dropZoneId = element.attributeValue("dropZone");
    if (StringUtils.isNotEmpty(dropZoneId)) {
        Component dropZone = findComponent(dropZoneId);
        if (dropZone instanceof BoxLayout) {
            uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
        } else if (dropZone != null) {
            throw new GuiDevelopmentException("Unsupported dropZone class " + dropZone.getClass().getName(), context);
        } else {
            throw new GuiDevelopmentException("Unable to find dropZone component with id: " + dropZoneId, context);
        }
    }
    String dropZonePrompt = element.attributeValue("dropZonePrompt");
    if (StringUtils.isNotEmpty(dropZonePrompt)) {
        uploadField.setDropZonePrompt(loadResourceString(dropZonePrompt));
    }
}
Also used : BoxLayout(io.jmix.ui.component.BoxLayout) UploadField(io.jmix.ui.component.UploadField) FileMultiUploadField(io.jmix.ui.component.FileMultiUploadField) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) Component(io.jmix.ui.component.Component)

Aggregations

GuiDevelopmentException (io.jmix.ui.GuiDevelopmentException)2 BoxLayout (io.jmix.ui.component.BoxLayout)2 Component (io.jmix.ui.component.Component)2 UploadField (io.jmix.ui.component.UploadField)2 FileMultiUploadField (io.jmix.ui.component.FileMultiUploadField)1 FileUploadField (io.jmix.ui.component.FileUploadField)1 SingleFileUploadField (io.jmix.ui.component.SingleFileUploadField)1