diff --git a/modules/desktop/src/com/haulmont/cuba/desktop/gui/components/DesktopFileUploadField.java b/modules/desktop/src/com/haulmont/cuba/desktop/gui/components/DesktopFileUploadField.java index 4abff547dc..ce51ca8d6b 100644 --- a/modules/desktop/src/com/haulmont/cuba/desktop/gui/components/DesktopFileUploadField.java +++ b/modules/desktop/src/com/haulmont/cuba/desktop/gui/components/DesktopFileUploadField.java @@ -775,4 +775,31 @@ public class DesktopFileUploadField extends DesktopAbstractUploadField javaType = metaProperty.getJavaType(); + if (FileDescriptor.class.isAssignableFrom(javaType)) { + return createFileUploadField(datasource, property); + } if (!Collection.class.isAssignableFrom(javaType)) { return createEntityField(datasource, property, mpp); } @@ -114,6 +118,25 @@ public class DataGridEditorFieldFactoryImpl implements DataGridEditorFieldFactor throw new UnsupportedOperationException(exceptionMessage); } + protected Field createFileUploadField(Datasource datasource, String property) { + FileUploadField fileUploadField = (FileUploadField) componentsFactory.createComponent(FileUploadField.NAME); + fileUploadField.setMode(FileUploadField.FileStoragePutMode.IMMEDIATE); + + fileUploadField.setUploadButtonCaption(null); + fileUploadField.setUploadButtonDescription(messages.getMainMessage("upload.submit")); + fileUploadField.setUploadButtonIcon("icons/upload.png"); + + fileUploadField.setClearButtonCaption(null); + fileUploadField.setClearButtonDescription(messages.getMainMessage("upload.clear")); + fileUploadField.setClearButtonIcon("icons/remove.png"); + + fileUploadField.setShowFileName(true); + fileUploadField.setShowClearButton(true); + + fileUploadField.setDatasource(datasource, property); + return fileUploadField; + } + protected Field createUuidField(Datasource datasource, String property) { MaskedField maskedField = componentsFactory.createComponent(MaskedField.class); maskedField.setDatasource(datasource, property); diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/FileUploadField.java b/modules/gui/src/com/haulmont/cuba/gui/components/FileUploadField.java index 64bf2e30e8..015becfef0 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/FileUploadField.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/FileUploadField.java @@ -22,7 +22,7 @@ import javax.annotation.Nullable; import java.io.InputStream; import java.util.UUID; -public interface FileUploadField extends UploadField, Field, Component.Focusable { +public interface FileUploadField extends UploadField, Field, Component.Focusable, Component.Buffered { String NAME = "upload"; /** diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/WebFileUploadField.java b/modules/web/src/com/haulmont/cuba/web/gui/components/WebFileUploadField.java index f195ea6fd6..91b4a50e73 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/WebFileUploadField.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/WebFileUploadField.java @@ -680,4 +680,29 @@ public class WebFileUploadField extends WebAbstractUploadField div { .c-maskedfield, .c-maskedfield-focus, + .c-fileupload .v-button, + .c-fileupload-clear.v-button, + .v-button.c-pickerfield-button, .v-textfield.c-pickerfield-text:focus { border: none; border-radius: 0; @@ -117,12 +120,76 @@ } .v-button.c-pickerfield-button { - border: none; border-left: valo-border($color: $v-textfield-background-color, $border: $v-textfield-border, $strength: 0.5); - background: transparent; - @include box-shadow(none); } + .v-filterselect-button:active:after, + .c-datefield [class*="button"]:active:after, + .c-pickerfield-layout>.v-button:last-child { + border-radius: 0; + } + + .c-fileupload-container { + .v-spacing { + display: none; + } + + .c-fileupload .v-button, + .c-fileupload-clear.v-button { + border-left: valo-border($color: $v-textfield-background-color, $border: $v-textfield-border, $strength: 0.5); + + color: mix($v-textfield-background-color, valo-font-color($v-textfield-background-color)); + + &:hover { + color: valo-font-color($background-color); + } + + &:after, + &:hover:after { + background: transparent; + } + + &:focus:after { + border-color: transparent; + @include box-shadow(none); + } + + &:active:after, + &:active:hover:after { + @if type-of($v-textfield-background-color) == color { + @include valo-button-active-style($v-textfield-background-color); + } + top: 0; + right: 0; + bottom: 0; + left: 0; + } + } + + .c-fileupload .v-button-focus { + &:after { + border-color: transparent; + @include box-shadow(none); + } + } + + .c-fileupload { + &:hover .v-button { + color: valo-font-color($background-color); + } + + &:active, + &:active:hover { + .v-button:after { + @if type-of($v-textfield-background-color) == color { + @include valo-button-active-style($v-textfield-background-color); + } + } + } + } + } + + .c-datefield [class*="button"] { border: none; border-right: valo-border($color: $v-textfield-background-color, $border: $v-textfield-border, $strength: 0.5);