Class MultiDragAndDropFileUploadEditor
- java.lang.Object
-
- com.hybris.cockpitng.editors.impl.AbstractCockpitEditorRenderer<T>
-
- com.hybris.cockpitng.editor.dndfileupload.AbstractDragAndDropFileUploadEditor<java.util.Collection<FileUploadResult>>
-
- com.hybris.cockpitng.editor.dndfileupload.MultiDragAndDropFileUploadEditor
-
- All Implemented Interfaces:
CockpitEditorRenderer<java.util.Collection<FileUploadResult>>
public class MultiDragAndDropFileUploadEditor extends AbstractDragAndDropFileUploadEditor<java.util.Collection<FileUploadResult>>
Multi file upload editor. Accepted params:- accept - specifies the MIME types of files that the server accepts e.g "audio/|video/|image/*"
- maxsize - defines max file size, if not defined then default system value will be used (property fileUpload.maxSize)
- singleLineMode - when set to true upload content will be displayed in single line
- selectedItemsMaxSize - defines number of uploaded elements when list scroll should be shown
Listbox.setRows(int). Default value: 5.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_MAX_FILE_COUNTstatic intDEFAULT_SELECTED_ITEMS_MAX_SIZEprotected static java.lang.StringEDITOR_CONTAINER_SCLASSprotected static java.lang.StringEDITOR_PREFIXprotected static java.lang.StringFILE_UPLOAD_MAX_FILE_COUNTprotected static java.lang.StringLABEL_DROPCONTENT_TOOLTIP_MULTIprotected static java.lang.StringLABEL_EXCEEDED_MAX_FILES_COUNTprotected static java.lang.StringLABEL_EXCEEDED_MAX_UPLOAD_SIZEprotected static java.lang.StringLABEL_UNSUPPORTED_UPLOADprotected static java.lang.StringPARAM_MAX_ALLOWED_TOTAL_UPLOAD_SIZEprotected static java.lang.StringPARAM_MAX_FILE_COUNTprotected static java.lang.StringPARAM_SELECTED_ITEMS_MAX_SIZE-
Fields inherited from class com.hybris.cockpitng.editor.dndfileupload.AbstractDragAndDropFileUploadEditor
ALLOWED_SIZE_DECIMAL_FORMAT, BYTES_IN_KILOBYTE, DEFAULT_MAX_FILE_SIZE, FILE_UPLOAD_MAX_SIZE, LABEL_DROPCONTENT, LABEL_DROPCONTENT_TOOLTIP, LABEL_UNSUPPORTED_FILETYPE, LABEL_UPLOAD, ON_MAX_FILE_COUNT_EXCEED, PARAM_ACCEPT, PARAM_MAX_SIZE, PARAM_SINGLE_LINE_MODE, UNLIMITED_FILE_SIZE
-
Fields inherited from class com.hybris.cockpitng.editors.impl.AbstractCockpitEditorRenderer
HEADER_LABEL_TOOLTIP, ON_ADD_EVENT, ON_DELETE_EVENT, YW_EDITOR_AREA_LABEL_CONTAINER
-
Fields inherited from interface com.hybris.cockpitng.editors.CockpitEditorRenderer
INITIAL_EDIT_STRING
-
-
Constructor Summary
Constructors Constructor Description MultiDragAndDropFileUploadEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.zkoss.zk.ui.ComponentcreateDropUpload(org.zkoss.zk.ui.Component dropAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)protected org.zkoss.zul.ListboxcreateUploadedFilesList(EditorContext<java.util.Collection<FileUploadResult>> context, EditorListener<java.util.Collection<FileUploadResult>> listener)protected java.util.Optional<org.zkoss.zul.Image>getContentImageWithZoom(org.zkoss.zk.ui.Component container, FileUploadResult fileUploadResult)protected java.lang.StringgetDropAreaConstraintInfo(EditorContext<java.util.Collection<FileUploadResult>> context)protected java.lang.StringgetEditorSclass()protected longgetMaxAllowedTotalUploadSizeInKilobytes(EditorContext<java.util.Collection<FileUploadResult>> context)protected intgetMaxFileCount(EditorContext<java.util.Collection<FileUploadResult>> context)protected intgetSelectedReferencesMaxSize(EditorContext<java.util.Collection<FileUploadResult>> context)protected java.lang.StringgetUpload(EditorContext<java.util.Collection<FileUploadResult>> context)protected voidonMaxFileCountExceed(org.zkoss.zul.Listbox uploadedList, EditorContext<java.util.Collection<FileUploadResult>> context)protected voidonUpload(org.zkoss.zul.Listbox uploadedList, org.zkoss.zk.ui.event.UploadEvent event, EditorContext<java.util.Collection<FileUploadResult>> context, EditorListener<java.util.Collection<FileUploadResult>> listener)voidrender(org.zkoss.zk.ui.Component parent, EditorContext<java.util.Collection<FileUploadResult>> context, EditorListener<java.util.Collection<FileUploadResult>> listener)Creates a new editor component and attaches it to the specifiedComponentcomponent.protected voidrenderUploadedFile(org.zkoss.zul.Listitem item, FileUploadResult data, int index, EditorContext<java.util.Collection<FileUploadResult>> context, java.util.function.BiConsumer<java.lang.Integer,FileUploadResult> onRemoveReference)protected voidshowMaxFileCountExceededMessage(org.zkoss.zk.ui.Component messageAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)protected voidshowTotalAllowedUploadSizeExceededMessage(org.zkoss.zk.ui.Component messageAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)protected voidshowUnsupportedMediaMessage(org.zkoss.zk.ui.Component messageAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)-
Methods inherited from class com.hybris.cockpitng.editor.dndfileupload.AbstractDragAndDropFileUploadEditor
addImageZoomPopup, createFileUpload, createUploadContainer, createUploadContainer, extractUploadedData, getCockpitProperties, getContentImage, getContentTypeImage, getMaxFileSize, getObjectPreviewService, isCorrectFileSize, isSingleLineModeEnabled, isUploadedMediaAcceptable, matchContentType, readableFileSize, showUnsupportedMediaMessage, toFileUploadResult
-
Methods inherited from class com.hybris.cockpitng.editors.impl.AbstractCockpitEditorRenderer
extractEmbeddedEditor, extractEmbeddedType, findAncestorEditor, findEmbeddedEditors, getInitialEditString, getL10nDecorator
-
-
-
-
Field Detail
-
DEFAULT_SELECTED_ITEMS_MAX_SIZE
public static final int DEFAULT_SELECTED_ITEMS_MAX_SIZE
- See Also:
- Constant Field Values
-
EDITOR_PREFIX
protected static final java.lang.String EDITOR_PREFIX
- See Also:
- Constant Field Values
-
EDITOR_CONTAINER_SCLASS
protected static final java.lang.String EDITOR_CONTAINER_SCLASS
- See Also:
- Constant Field Values
-
PARAM_SELECTED_ITEMS_MAX_SIZE
protected static final java.lang.String PARAM_SELECTED_ITEMS_MAX_SIZE
- See Also:
- Constant Field Values
-
LABEL_UNSUPPORTED_UPLOAD
protected static final java.lang.String LABEL_UNSUPPORTED_UPLOAD
- See Also:
- Constant Field Values
-
LABEL_EXCEEDED_MAX_FILES_COUNT
protected static final java.lang.String LABEL_EXCEEDED_MAX_FILES_COUNT
- See Also:
- Constant Field Values
-
LABEL_EXCEEDED_MAX_UPLOAD_SIZE
protected static final java.lang.String LABEL_EXCEEDED_MAX_UPLOAD_SIZE
- See Also:
- Constant Field Values
-
PARAM_MAX_FILE_COUNT
protected static final java.lang.String PARAM_MAX_FILE_COUNT
- See Also:
- Constant Field Values
-
PARAM_MAX_ALLOWED_TOTAL_UPLOAD_SIZE
protected static final java.lang.String PARAM_MAX_ALLOWED_TOTAL_UPLOAD_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_FILE_COUNT
protected static final int DEFAULT_MAX_FILE_COUNT
- See Also:
- Constant Field Values
-
FILE_UPLOAD_MAX_FILE_COUNT
protected static final java.lang.String FILE_UPLOAD_MAX_FILE_COUNT
- See Also:
- Constant Field Values
-
LABEL_DROPCONTENT_TOOLTIP_MULTI
protected static final java.lang.String LABEL_DROPCONTENT_TOOLTIP_MULTI
- See Also:
- Constant Field Values
-
-
Method Detail
-
getEditorSclass
protected java.lang.String getEditorSclass()
- Specified by:
getEditorSclassin classAbstractDragAndDropFileUploadEditor<java.util.Collection<FileUploadResult>>
-
render
public void render(org.zkoss.zk.ui.Component parent, EditorContext<java.util.Collection<FileUploadResult>> context, EditorListener<java.util.Collection<FileUploadResult>> listener)Description copied from interface:CockpitEditorRendererCreates a new editor component and attaches it to the specifiedComponentcomponent.- Parameters:
parent- parent component the editor should be attached tocontext- the context for the editor creationlistener- the listener to notify the rest of the world about value changes and other events
-
onUpload
protected void onUpload(org.zkoss.zul.Listbox uploadedList, org.zkoss.zk.ui.event.UploadEvent event, EditorContext<java.util.Collection<FileUploadResult>> context, EditorListener<java.util.Collection<FileUploadResult>> listener)
-
onMaxFileCountExceed
protected void onMaxFileCountExceed(org.zkoss.zul.Listbox uploadedList, EditorContext<java.util.Collection<FileUploadResult>> context)
-
createUploadedFilesList
protected org.zkoss.zul.Listbox createUploadedFilesList(EditorContext<java.util.Collection<FileUploadResult>> context, EditorListener<java.util.Collection<FileUploadResult>> listener)
-
getSelectedReferencesMaxSize
protected int getSelectedReferencesMaxSize(EditorContext<java.util.Collection<FileUploadResult>> context)
-
renderUploadedFile
protected void renderUploadedFile(org.zkoss.zul.Listitem item, FileUploadResult data, int index, EditorContext<java.util.Collection<FileUploadResult>> context, java.util.function.BiConsumer<java.lang.Integer,FileUploadResult> onRemoveReference)
-
getContentImageWithZoom
protected java.util.Optional<org.zkoss.zul.Image> getContentImageWithZoom(org.zkoss.zk.ui.Component container, FileUploadResult fileUploadResult)
-
showUnsupportedMediaMessage
protected void showUnsupportedMediaMessage(org.zkoss.zk.ui.Component messageAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)
-
showMaxFileCountExceededMessage
protected void showMaxFileCountExceededMessage(org.zkoss.zk.ui.Component messageAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)
-
showTotalAllowedUploadSizeExceededMessage
protected void showTotalAllowedUploadSizeExceededMessage(org.zkoss.zk.ui.Component messageAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)
-
createDropUpload
protected org.zkoss.zk.ui.Component createDropUpload(org.zkoss.zk.ui.Component dropAnchor, EditorContext<java.util.Collection<FileUploadResult>> context)- Overrides:
createDropUploadin classAbstractDragAndDropFileUploadEditor<java.util.Collection<FileUploadResult>>
-
getDropAreaConstraintInfo
protected java.lang.String getDropAreaConstraintInfo(EditorContext<java.util.Collection<FileUploadResult>> context)
- Overrides:
getDropAreaConstraintInfoin classAbstractDragAndDropFileUploadEditor<java.util.Collection<FileUploadResult>>- Parameters:
context- to allow to read l10n data- Returns:
- localized information on allowed file size and number of allowed files (if applicable)
-
getMaxFileCount
protected int getMaxFileCount(EditorContext<java.util.Collection<FileUploadResult>> context)
- Parameters:
context- context object to read configuration- Returns:
- maximal number of uploaded files
-
getMaxAllowedTotalUploadSizeInKilobytes
protected long getMaxAllowedTotalUploadSizeInKilobytes(EditorContext<java.util.Collection<FileUploadResult>> context)
- Parameters:
context- context object to read configuration- Returns:
- maximal allowed upload size in kilobytes
-
getUpload
protected java.lang.String getUpload(EditorContext<java.util.Collection<FileUploadResult>> context)
- Overrides:
getUploadin classAbstractDragAndDropFileUploadEditor<java.util.Collection<FileUploadResult>>
-
-