Class JmixFileUpload

java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
io.jmix.ui.widget.JmixFileUpload
All Implemented Interfaces:
com.vaadin.event.ConnectorEventListener, com.vaadin.event.ContextClickEvent.ContextClickNotifier, com.vaadin.event.MethodEventSource, com.vaadin.event.SerializableEventListener, com.vaadin.server.ClientConnector, com.vaadin.server.Sizeable, com.vaadin.server.VariableOwner, com.vaadin.shared.Connector, com.vaadin.ui.Component, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.HasContextHelp, com.vaadin.ui.LegacyComponent, UploadComponent, Serializable, EventListener

public class JmixFileUpload extends com.vaadin.ui.AbstractComponent implements com.vaadin.ui.Component.Focusable, UploadComponent, com.vaadin.ui.LegacyComponent
See Also:
  • Field Details

    • receiver

      protected JmixFileUpload.Receiver receiver
      The output of the upload is redirected to this receiver.
    • isUploading

      protected boolean isUploading
    • contentLength

      protected long contentLength
    • mimeTypes

      protected Map<String,String> mimeTypes
    • interrupted

      protected boolean interrupted
    • streamVariable

      protected com.vaadin.server.StreamVariable streamVariable
  • Constructor Details

    • JmixFileUpload

      public JmixFileUpload()
  • Method Details

    • setUploadingErrorHandler

      protected void setUploadingErrorHandler()
    • resetUploadingErrorHandler

      protected void resetUploadingErrorHandler()
    • getState

      protected JmixFileUploadState getState()
      Overrides:
      getState in class com.vaadin.ui.AbstractComponent
    • getState

      protected JmixFileUploadState getState(boolean markAsDirty)
      Overrides:
      getState in class com.vaadin.ui.AbstractComponent
    • getTabIndex

      public int getTabIndex()
      Specified by:
      getTabIndex in interface com.vaadin.ui.Component.Focusable
    • setTabIndex

      public void setTabIndex(int tabIndex)
      Specified by:
      setTabIndex in interface com.vaadin.ui.Component.Focusable
    • getIconAlternateText

      public String getIconAlternateText()
      Returns the icon's alt text.
      Returns:
      String with the alt text
    • setIconAlternateText

      public void setIconAlternateText(String iconAltText)
    • isHtmlContentAllowed

      public boolean isHtmlContentAllowed()
      Return HTML rendering setting
      Returns:
      true if the caption text is to be rendered as HTML, false otherwise
    • setHtmlContentAllowed

      public void setHtmlContentAllowed(boolean htmlContentAllowed)
      Set whether the caption text is rendered as HTML or not. You might need to re-theme button to allow higher content than the original text style.

      If set to true, the captions are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the content is passed to the browser as plain text.

      Parameters:
      htmlContentAllowed - true if caption is rendered as HTML, false otherwise
    • setIcon

      public void setIcon(com.vaadin.server.Resource icon, String iconAltText)
      Sets the component's icon and alt text.

      An alt text is shown when an image could not be loaded, and read by assistive devices.

      Parameters:
      icon - the icon to be shown with the component's caption.
      iconAltText - String to use as alt text
    • isMultiSelect

      public boolean isMultiSelect()
    • setMultiSelect

      public void setMultiSelect(boolean multiSelect)
    • getUnableToUploadFileMessage

      public String getUnableToUploadFileMessage()
    • setUnableToUploadFileMessage

      public void setUnableToUploadFileMessage(String message)
    • getProgressWindowCaption

      public String getProgressWindowCaption()
    • setProgressWindowCaption

      public void setProgressWindowCaption(String progressWindowCaption)
    • getCancelButtonCaption

      public String getCancelButtonCaption()
    • setCancelButtonCaption

      public void setCancelButtonCaption(String cancelButtonCaption)
    • getAccept

      @Nullable public String getAccept()
      Specified by:
      getAccept in interface UploadComponent
    • setAccept

      public void setAccept(@Nullable String accept)
      Note: this is just a hint for browser, user may select files that do not meet this property
      Specified by:
      setAccept in interface UploadComponent
      Parameters:
      accept - mime types, comma separated
    • getPermittedExtensions

      @Nullable public Set<String> getPermittedExtensions()
    • setPermittedExtensions

      public void setPermittedExtensions(@Nullable Set<String> permittedExtensions)
    • getFileSizeLimit

      public double getFileSizeLimit()
    • setFileSizeLimit

      public void setFileSizeLimit(long fileSizeLimit)
      Parameters:
      fileSizeLimit - file size limit in bytes
    • getReceiver

      @Nullable public JmixFileUpload.Receiver getReceiver()
    • setReceiver

      public void setReceiver(@Nullable JmixFileUpload.Receiver receiver)
    • getDropZone

      @Nullable public com.vaadin.ui.Component getDropZone()
    • setDropZone

      public void setDropZone(@Nullable com.vaadin.ui.Component component)
    • setPasteZone

      public void setPasteZone(@Nullable com.vaadin.ui.Component component)
    • getPasteZone

      @Nullable public com.vaadin.ui.Component getPasteZone()
    • getDropZonePrompt

      @Nullable public String getDropZonePrompt()
    • setDropZonePrompt

      public void setDropZonePrompt(@Nullable String dropZonePrompt)
    • setTotalProgressEnabled

      public void setTotalProgressEnabled(boolean totalProgressEnabled)
    • isTotalProgressEnabled

      public boolean isTotalProgressEnabled()
    • setTotalProgressFormat

      public void setTotalProgressFormat(String totalProgressFormat)
    • getTotalProgressFormat

      public String getTotalProgressFormat()
    • getStreamVariable

      protected com.vaadin.server.StreamVariable getStreamVariable()
    • startUpload

      protected void startUpload()
      Go into upload state. This is to prevent double uploading on same component.

      Warning: this is an internal method used by the framework and should not be used by user of the Upload component. Using it results in the Upload component going in wrong state and not working. It is currently public because it is used by another class.

    • interruptUpload

      protected void interruptUpload()
      Interrupts the upload currently being received. The interruption will be done by the receiving thread so this method will return immediately and the actual interrupt will happen a bit later.
    • endUpload

      protected void endUpload()
      Go into state where new uploading can begin.

      Warning: this is an internal method used by the framework and should not be used by user of the Upload component.

    • paintContent

      public void paintContent(com.vaadin.server.PaintTarget target) throws com.vaadin.server.PaintException
      Specified by:
      paintContent in interface com.vaadin.ui.LegacyComponent
      Throws:
      com.vaadin.server.PaintException
    • changeVariables

      public void changeVariables(Object source, Map<String,Object> variables)
      Specified by:
      changeVariables in interface com.vaadin.server.VariableOwner
    • fireStarted

      protected void fireStarted(String fileName, String MIMEType)
    • fireNoInputStream

      protected void fireNoInputStream(String fileName, String MIMEType, long length)
    • fireNoOutputStream

      protected void fireNoOutputStream(String fileName, String MIMEType, long length)
    • fireUploadInterrupted

      protected void fireUploadInterrupted(String fileName, String MIMEType, long length, Exception e)
    • fireUploadSuccess

      protected void fireUploadSuccess(String fileName, String MIMEType, long length)
    • fireFileSizeLimitExceeded

      protected void fireFileSizeLimitExceeded(String fileName)
    • fireFileExtensionNotAllowed

      protected void fireFileExtensionNotAllowed(String fileName)
    • fireQueueUploadFinished

      protected void fireQueueUploadFinished()
    • addStartedListener

      public void addStartedListener(JmixFileUpload.StartedListener listener)
    • removeStartedListener

      public void removeStartedListener(JmixFileUpload.StartedListener listener)
    • addFinishedListener

      public void addFinishedListener(JmixFileUpload.FinishedListener listener)
    • removeFinishedListener

      public void removeFinishedListener(JmixFileUpload.FinishedListener listener)
    • addFailedListener

      public void addFailedListener(JmixFileUpload.FailedListener listener)
    • removeFailedListener

      public void removeFailedListener(JmixFileUpload.FailedListener listener)
    • addSucceededListener

      public void addSucceededListener(JmixFileUpload.SucceededListener listener)
    • removeSucceededListener

      public void removeSucceededListener(JmixFileUpload.SucceededListener listener)
    • addFileSizeLimitExceededListener

      public void addFileSizeLimitExceededListener(JmixFileUpload.FileSizeLimitExceededListener listener)
    • addFileExtensionNotAllowedListener

      public void addFileExtensionNotAllowedListener(JmixFileUpload.FileExtensionNotAllowedListener listener)
    • removeFileExtensionNotAllowedListener

      public void removeFileExtensionNotAllowedListener(JmixFileUpload.FileExtensionNotAllowedListener listener)
    • removeFileSizeLimitExceededListener

      public void removeFileSizeLimitExceededListener(JmixFileUpload.FileSizeLimitExceededListener listener)
    • addQueueUploadFinishedListener

      public void addQueueUploadFinishedListener(JmixFileUpload.QueueFinishedListener listener)
    • removeQueueUploadFinishedListener

      public void removeQueueUploadFinishedListener(JmixFileUpload.QueueFinishedListener listener)
    • focus

      public void focus()
      Specified by:
      focus in interface com.vaadin.ui.Component.Focusable
      Overrides:
      focus in class com.vaadin.ui.AbstractComponent