public class WUpload extends FormComponent implements com.vaadin.ui.Upload.FailedListener, com.vaadin.ui.Upload.Receiver, com.vaadin.ui.Upload.SucceededListener, com.vaadin.ui.Upload.StartedListener
form, INTERNAL_STATE_RECORD_PROPERTY
Constructor and Description |
---|
WUpload() |
Modifier and Type | Method and Description |
---|---|
protected com.vaadin.ui.AbstractComponent |
createWidget()
Called once, to create the actual Vaadin component.
|
String |
getAcceptedMimeTypes()
Gets the accepted MIME-Types
|
String |
getButtonCaption() |
com.vaadin.ui.Upload |
getWidget()
Gets the Vaadin representation of this component.
|
boolean |
isImmediate()
Returns the immediate mode of the component.
|
Boolean |
isRequired()
Gets the required flag of this component.
|
void |
localizeAndSetButtonCaption(String caption)
Localizes the caption and sets it to the button.
|
protected void |
onUploadResult(RecordHolder file,
String failureMessage)
Handles the result of the file upload.
|
OutputStream |
receiveUpload(String filename,
String mimeType) |
protected void |
restoreInternalState(Map<String,Object> state)
Restores the UI state of this component which was previously written
by
FormComponent.writeInternalState(Map) . |
void |
setAcceptedMimeTypes(String mimeTypes)
Sets the accepted MIME-Types by this upload component.
|
void |
setImmediate(boolean immediate)
Sets the component's immediate mode to the specified status.
|
void |
setRequired(Boolean required)
Sets the required flag to this component
|
void |
uploadFailed(com.vaadin.ui.Upload.FailedEvent event) |
void |
uploadStarted(com.vaadin.ui.Upload.StartedEvent event) |
void |
uploadSucceeded(com.vaadin.ui.Upload.SucceededEvent event) |
protected void |
writeInternalState(Map<String,Object> state)
Writes the UI state of this component to the provided map.
|
addDataErrorMessage, addStyleName, attach, call, clearDataErrorMessages, createEvent, equals, getCaption, getComponentAlignment, getContextClickHandler, getCustomErrorMessage, getDataErrorMessages, getDescription, getExpandRatio, getHasChildrenAdapter, getHeight, getIcon, getModelingId, getNamespace, getStyleName, getTabIndex, getWidth, hashCode, isEnabled, isReadOnly, isVisible, localize, markAsDirty, preventGC, removeStyleName, restoreState, saveState, setCaption, setComponentAlignment, setContextClickHandler, setContextMenuItems, setCustomErrorMessage, setDescription, setEnabled, setExpandRatio, setHeight, setIcon, setReadOnly, setStyleName, setTabIndex, setVisible, setWidth, toString
protected com.vaadin.ui.AbstractComponent createWidget()
FormComponent
createWidget
in class FormComponent
public com.vaadin.ui.Upload getWidget()
FormComponent
getWidget
in class FormComponent
public void uploadStarted(com.vaadin.ui.Upload.StartedEvent event)
uploadStarted
in interface com.vaadin.ui.Upload.StartedListener
public void uploadFailed(com.vaadin.ui.Upload.FailedEvent event)
uploadFailed
in interface com.vaadin.ui.Upload.FailedListener
public void setAcceptedMimeTypes(String mimeTypes)
mimeTypes
- the accepted MIME-Typespublic String getAcceptedMimeTypes()
public OutputStream receiveUpload(String filename, String mimeType)
receiveUpload
in interface com.vaadin.ui.Upload.Receiver
protected void onUploadResult(RecordHolder file, String failureMessage)
form
and transaction context.file
- failureMessage
- public void uploadSucceeded(com.vaadin.ui.Upload.SucceededEvent event)
uploadSucceeded
in interface com.vaadin.ui.Upload.SucceededListener
public void localizeAndSetButtonCaption(String caption)
caption
- public void setRequired(Boolean required)
required
- public Boolean isRequired()
true
if this component has been marked as required.protected void writeInternalState(Map<String,Object> state)
FormComponent
Many UI attributes such as size, caption, etc. are not held in the records but are stored exclusively in the Vaadin components. In the records the getter/setter methods of such attributes directly delegate to the underlying component. For the purposes of the Save Document/Todo use case the state of such attributes has to be preserved.
Subclasses should override this method. The overriding method should call
super.writeInternalState(state)
to store the state form the super
class as well. The attributes should be written to the provided state
parameter. The type of the values written to the state
can only by
Java representation of LSPS types. That is java.util.Date
,
java.lang.String
, Decimal
, RecordHolder
,
ListHolder
, ... The name of the attributes stored in the map
should be unique and should not collide with the names used by any
of the superclass. It is the responsibility of the overridden method to ensure
that.
Subclasses overriding this method should also override
FormComponent.restoreInternalState(Map)
and restore the state written
by this method.
writeInternalState
in class FormComponent
state
- a map to which this method should write the component's UI state.FormComponent.restoreInternalState(Map)
,
FormComponent.saveState()
protected void restoreInternalState(Map<String,Object> state)
FormComponent
FormComponent.writeInternalState(Map)
.
Subclasses should override and call super.restoreInternalState(state);
restoreInternalState
in class FormComponent
state
- a map of attributes and their valuesFormComponent.writeInternalState(Map)
public String getButtonCaption()
public boolean isImmediate()
Certain operations such as adding a value change listener will set the
component into immediate mode if setImmediate(boolean)
has not
been explicitly called with false.
public void setImmediate(boolean immediate)
immediate
- the boolean value specifying if the component should be in the
immediate mode after the call.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.