mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 20:28:00 +08:00
PL-7438 Rename UploadComponentSupport to UploadField
This commit is contained in:
parent
5a8f5169c4
commit
b37f256a99
@ -22,14 +22,14 @@ import com.haulmont.chile.core.datatypes.Datatypes;
|
|||||||
import com.haulmont.cuba.client.ClientConfig;
|
import com.haulmont.cuba.client.ClientConfig;
|
||||||
import com.haulmont.cuba.core.global.AppBeans;
|
import com.haulmont.cuba.core.global.AppBeans;
|
||||||
import com.haulmont.cuba.core.global.Configuration;
|
import com.haulmont.cuba.core.global.Configuration;
|
||||||
import com.haulmont.cuba.gui.components.UploadComponentSupport;
|
import com.haulmont.cuba.gui.components.UploadField;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class DesktopAbstractUploadComponent<T extends JComponent>
|
public abstract class DesktopAbstractUploadComponent<T extends JComponent>
|
||||||
extends DesktopAbstractComponent<T>
|
extends DesktopAbstractComponent<T>
|
||||||
implements UploadComponentSupport {
|
implements UploadField {
|
||||||
|
|
||||||
protected static final int BYTES_IN_MEGABYTE = 1048576;
|
protected static final int BYTES_IN_MEGABYTE = 1048576;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class FileEditor extends AbstractEditor<FileDescriptor> {
|
|||||||
|
|
||||||
getDialogOptions().setWidthAuto();
|
getDialogOptions().setWidthAuto();
|
||||||
|
|
||||||
uploadField.setDropZone(new UploadComponentSupport.DropZone(this));
|
uploadField.setDropZone(new UploadField.DropZone(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ import com.haulmont.cuba.core.global.FileStorageException;
|
|||||||
import com.haulmont.cuba.gui.components.AbstractWindow;
|
import com.haulmont.cuba.gui.components.AbstractWindow;
|
||||||
import com.haulmont.cuba.gui.components.Button;
|
import com.haulmont.cuba.gui.components.Button;
|
||||||
import com.haulmont.cuba.gui.components.FileMultiUploadField;
|
import com.haulmont.cuba.gui.components.FileMultiUploadField;
|
||||||
import com.haulmont.cuba.gui.components.UploadComponentSupport;
|
import com.haulmont.cuba.gui.components.UploadField;
|
||||||
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
||||||
import com.haulmont.cuba.gui.theme.ThemeConstants;
|
import com.haulmont.cuba.gui.theme.ThemeConstants;
|
||||||
import com.haulmont.cuba.gui.upload.FileUploadingAPI;
|
import com.haulmont.cuba.gui.upload.FileUploadingAPI;
|
||||||
@ -54,7 +54,7 @@ public class MultiUploader extends AbstractWindow {
|
|||||||
public void init(Map<String, Object> params) {
|
public void init(Map<String, Object> params) {
|
||||||
super.init(params);
|
super.init(params);
|
||||||
|
|
||||||
multiUpload.setDropZone(new UploadComponentSupport.DropZone(this));
|
multiUpload.setDropZone(new UploadField.DropZone(this));
|
||||||
|
|
||||||
getDialogOptions()
|
getDialogOptions()
|
||||||
.setHeight(themeConstants.getInt("cuba.gui.multiupload.height"))
|
.setHeight(themeConstants.getInt("cuba.gui.multiupload.height"))
|
||||||
|
@ -17,10 +17,9 @@
|
|||||||
package com.haulmont.cuba.gui.components;
|
package com.haulmont.cuba.gui.components;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface FileMultiUploadField extends UploadComponentSupport {
|
public interface FileMultiUploadField extends UploadField {
|
||||||
|
|
||||||
String NAME = "multiUpload";
|
String NAME = "multiUpload";
|
||||||
|
|
||||||
|
@ -18,10 +18,9 @@ package com.haulmont.cuba.gui.components;
|
|||||||
|
|
||||||
import com.haulmont.cuba.core.entity.FileDescriptor;
|
import com.haulmont.cuba.core.entity.FileDescriptor;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface FileUploadField extends UploadComponentSupport {
|
public interface FileUploadField extends UploadField {
|
||||||
String NAME = "upload";
|
String NAME = "upload";
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -19,7 +19,7 @@ package com.haulmont.cuba.gui.components;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface UploadComponentSupport extends Component, Component.HasCaption, Component.BelongToFrame, Component.HasIcon {
|
public interface UploadField extends Component, Component.HasCaption, Component.BelongToFrame, Component.HasIcon {
|
||||||
|
|
||||||
abstract class FileUploadEvent {
|
abstract class FileUploadEvent {
|
||||||
private final String fileName;
|
private final String fileName;
|
@ -18,12 +18,12 @@
|
|||||||
package com.haulmont.cuba.gui.components.compatibility;
|
package com.haulmont.cuba.gui.components.compatibility;
|
||||||
|
|
||||||
import com.haulmont.cuba.gui.components.FileUploadField;
|
import com.haulmont.cuba.gui.components.FileUploadField;
|
||||||
import com.haulmont.cuba.gui.components.UploadComponentSupport;
|
import com.haulmont.cuba.gui.components.UploadField;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class FileUploadFieldListenerWrapper implements UploadComponentSupport.FileUploadStartListener,
|
public class FileUploadFieldListenerWrapper implements UploadField.FileUploadStartListener,
|
||||||
UploadComponentSupport.FileUploadFinishListener,
|
UploadField.FileUploadFinishListener,
|
||||||
UploadComponentSupport.FileUploadErrorListener,
|
UploadField.FileUploadErrorListener,
|
||||||
FileUploadField.FileUploadSucceedListener {
|
FileUploadField.FileUploadSucceedListener {
|
||||||
private final FileUploadField.Listener listener;
|
private final FileUploadField.Listener listener;
|
||||||
|
|
||||||
@ -32,17 +32,17 @@ public class FileUploadFieldListenerWrapper implements UploadComponentSupport.Fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fileUploadError(UploadComponentSupport.FileUploadErrorEvent e) {
|
public void fileUploadError(UploadField.FileUploadErrorEvent e) {
|
||||||
listener.uploadFailed(new FileUploadField.Listener.Event(e.getFileName(), e.getCause()));
|
listener.uploadFailed(new FileUploadField.Listener.Event(e.getFileName(), e.getCause()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fileUploadFinish(UploadComponentSupport.FileUploadFinishEvent e) {
|
public void fileUploadFinish(UploadField.FileUploadFinishEvent e) {
|
||||||
listener.uploadFinished(new FileUploadField.Listener.Event(e.getFileName()));
|
listener.uploadFinished(new FileUploadField.Listener.Event(e.getFileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fileUploadStart(UploadComponentSupport.FileUploadStartEvent e) {
|
public void fileUploadStart(UploadField.FileUploadStartEvent e) {
|
||||||
listener.uploadStarted(new FileUploadField.Listener.Event(e.getFileName()));
|
listener.uploadStarted(new FileUploadField.Listener.Event(e.getFileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
package com.haulmont.cuba.gui.components.compatibility;
|
package com.haulmont.cuba.gui.components.compatibility;
|
||||||
|
|
||||||
import com.haulmont.cuba.gui.components.FileMultiUploadField;
|
import com.haulmont.cuba.gui.components.FileMultiUploadField;
|
||||||
import com.haulmont.cuba.gui.components.UploadComponentSupport;
|
import com.haulmont.cuba.gui.components.UploadField;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class MultiUploadFieldListenerWrapper implements UploadComponentSupport.FileUploadStartListener,
|
public class MultiUploadFieldListenerWrapper implements UploadField.FileUploadStartListener,
|
||||||
UploadComponentSupport.FileUploadErrorListener,
|
UploadField.FileUploadErrorListener,
|
||||||
UploadComponentSupport.FileUploadFinishListener,
|
UploadField.FileUploadFinishListener,
|
||||||
FileMultiUploadField.QueueUploadCompleteListener {
|
FileMultiUploadField.QueueUploadCompleteListener {
|
||||||
|
|
||||||
private final FileMultiUploadField.UploadListener listener;
|
private final FileMultiUploadField.UploadListener listener;
|
||||||
@ -33,17 +33,17 @@ public class MultiUploadFieldListenerWrapper implements UploadComponentSupport.F
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fileUploadError(UploadComponentSupport.FileUploadErrorEvent e) {
|
public void fileUploadError(UploadField.FileUploadErrorEvent e) {
|
||||||
//todo rewrite generated body
|
//todo rewrite generated body
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fileUploadFinish(UploadComponentSupport.FileUploadFinishEvent e) {
|
public void fileUploadFinish(UploadField.FileUploadFinishEvent e) {
|
||||||
//todo rewrite generated body
|
//todo rewrite generated body
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fileUploadStart(UploadComponentSupport.FileUploadStartEvent e) {
|
public void fileUploadStart(UploadField.FileUploadStartEvent e) {
|
||||||
//todo rewrite generated body
|
//todo rewrite generated body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class FileMultiUploadFieldLoader extends AbstractComponentLoader<FileMult
|
|||||||
if (StringUtils.isNotEmpty(dropZoneId)) {
|
if (StringUtils.isNotEmpty(dropZoneId)) {
|
||||||
Component dropZone = context.getFrame().getComponent(dropZoneId);
|
Component dropZone = context.getFrame().getComponent(dropZoneId);
|
||||||
if (dropZone instanceof BoxLayout) {
|
if (dropZone instanceof BoxLayout) {
|
||||||
uploadField.setDropZone(new UploadComponentSupport.DropZone((BoxLayout) dropZone));
|
uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ package com.haulmont.cuba.gui.xml.layout.loaders;
|
|||||||
import com.haulmont.cuba.gui.components.BoxLayout;
|
import com.haulmont.cuba.gui.components.BoxLayout;
|
||||||
import com.haulmont.cuba.gui.components.Component;
|
import com.haulmont.cuba.gui.components.Component;
|
||||||
import com.haulmont.cuba.gui.components.FileUploadField;
|
import com.haulmont.cuba.gui.components.FileUploadField;
|
||||||
import com.haulmont.cuba.gui.components.UploadComponentSupport;
|
import com.haulmont.cuba.gui.components.UploadField;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ public class FileUploadFieldLoader extends AbstractComponentLoader<FileUploadFie
|
|||||||
if (StringUtils.isNotEmpty(dropZoneId)) {
|
if (StringUtils.isNotEmpty(dropZoneId)) {
|
||||||
Component dropZone = context.getFrame().getComponent(dropZoneId);
|
Component dropZone = context.getFrame().getComponent(dropZoneId);
|
||||||
if (dropZone instanceof BoxLayout) {
|
if (dropZone instanceof BoxLayout) {
|
||||||
uploadField.setDropZone(new UploadComponentSupport.DropZone((BoxLayout) dropZone));
|
uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ import com.haulmont.chile.core.datatypes.Datatypes;
|
|||||||
import com.haulmont.cuba.client.ClientConfig;
|
import com.haulmont.cuba.client.ClientConfig;
|
||||||
import com.haulmont.cuba.core.global.AppBeans;
|
import com.haulmont.cuba.core.global.AppBeans;
|
||||||
import com.haulmont.cuba.core.global.Configuration;
|
import com.haulmont.cuba.core.global.Configuration;
|
||||||
import com.haulmont.cuba.gui.components.UploadComponentSupport;
|
import com.haulmont.cuba.gui.components.UploadField;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class WebAbstractUploadComponent<T extends com.vaadin.ui.Component>
|
public abstract class WebAbstractUploadComponent<T extends com.vaadin.ui.Component>
|
||||||
extends WebAbstractComponent<T>
|
extends WebAbstractComponent<T>
|
||||||
implements UploadComponentSupport {
|
implements UploadField {
|
||||||
|
|
||||||
protected static final int BYTES_IN_MEGABYTE = 1048576;
|
protected static final int BYTES_IN_MEGABYTE = 1048576;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user