info.magnolia.ui.mediaeditor.field.image
Class ImageMediaField

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractField<T>
              extended by com.vaadin.ui.CustomField<byte[]>
                  extended by info.magnolia.ui.mediaeditor.field.image.ImageMediaField
All Implemented Interfaces:
com.vaadin.data.Buffered, com.vaadin.data.BufferedValidatable, com.vaadin.data.Property<byte[]>, com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer, com.vaadin.data.Validatable, com.vaadin.event.Action.ShortcutNotifier, com.vaadin.event.MethodEventSource, com.vaadin.server.ClientConnector, com.vaadin.server.Sizeable, com.vaadin.shared.Connector, com.vaadin.ui.Component, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Field<byte[]>, com.vaadin.ui.HasComponents, Scalable, MediaField, Serializable, Iterable<com.vaadin.ui.Component>
Direct Known Subclasses:
CropField, ViewImageField

public abstract class ImageMediaField
extends com.vaadin.ui.CustomField<byte[]>
implements MediaField, Scalable

Base class for image-editing fields.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField
com.vaadin.ui.AbstractField.FocusShortcut, com.vaadin.ui.AbstractField.ReadOnlyStatusChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Field
com.vaadin.ui.Field.ValueChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered
com.vaadin.data.Buffered.SourceException
 
Nested classes/interfaces inherited from interface com.vaadin.data.Property
com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyException, com.vaadin.data.Property.ReadOnlyStatusChangeEvent, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<T>, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
 
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
com.vaadin.server.Sizeable.Unit
 
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener
 
Field Summary
protected static String DEFAULT_FORMAT
           
protected  org.apache.log4j.Logger log
           
protected static String TEMP_FILE_NAME_BASE
           
 
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
ImageMediaField()
           
 
Method Summary
 void applyChanges()
           
protected abstract  com.vaadin.ui.Component createImage()
           
protected  com.vaadin.server.StreamResource createResourceFromValue()
           
protected  InputStream createStreamSource(BufferedImage img, String formatName)
           
 void execute()
           
protected  BufferedImage executeImageModification()
           
protected  String generateTempFileName()
           
 Class<byte[]> getType()
           
protected  com.vaadin.ui.Component initContent()
           
abstract  void refreshImageSource()
           
 void revertChanges()
           
 void scaleToActualSize()
           
 void scaleToFit()
           
protected  void setInternalValue(byte[] newValue)
           
 
Methods inherited from class com.vaadin.ui.CustomField
attach, getContent, iterator, setHeight, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractField
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, beforeClientResponse, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getState, getTabIndex, getValidators, getValue, isBuffered, isEmpty, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, shouldHideErrors, toString, validate, validate, valueChange
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isConnectorEnabled, isEnabled, isImmediate, isVisible, removeListener, removeShortcutListener, removeStyleName, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth
 
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hasListeners, isAttached, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.Field
getRequiredError, isRequired, setRequired, setRequiredError
 
Methods inherited from interface com.vaadin.data.BufferedValidatable
isInvalidCommitted, setInvalidCommitted
 
Methods inherited from interface com.vaadin.data.Buffered
commit, discard, isBuffered, isModified, setBuffered
 
Methods inherited from interface com.vaadin.data.Validatable
addValidator, getValidators, isInvalidAllowed, isValid, removeAllValidators, removeValidator, setInvalidAllowed, validate
 
Methods inherited from interface com.vaadin.data.Property
getValue, isReadOnly, setReadOnly, setValue
 
Methods inherited from interface com.vaadin.data.Property.ValueChangeNotifier
addListener, addValueChangeListener, removeListener, removeValueChangeListener
 
Methods inherited from interface com.vaadin.data.Property.ValueChangeListener
valueChange
 
Methods inherited from interface com.vaadin.data.Property.Viewer
getPropertyDataSource, setPropertyDataSource
 
Methods inherited from interface com.vaadin.ui.Component.Focusable
focus, getTabIndex, setTabIndex
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
 
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
 

Field Detail

DEFAULT_FORMAT

protected static final String DEFAULT_FORMAT
See Also:
Constant Field Values

TEMP_FILE_NAME_BASE

protected static final String TEMP_FILE_NAME_BASE
See Also:
Constant Field Values

log

protected org.apache.log4j.Logger log
Constructor Detail

ImageMediaField

public ImageMediaField()
Method Detail

initContent

protected com.vaadin.ui.Component initContent()
Specified by:
initContent in class com.vaadin.ui.CustomField<byte[]>

createImage

protected abstract com.vaadin.ui.Component createImage()

setInternalValue

protected void setInternalValue(byte[] newValue)
Overrides:
setInternalValue in class com.vaadin.ui.AbstractField<byte[]>

scaleToActualSize

public void scaleToActualSize()
Specified by:
scaleToActualSize in interface Scalable

scaleToFit

public void scaleToFit()
Specified by:
scaleToFit in interface Scalable

getType

public Class<byte[]> getType()
Specified by:
getType in interface com.vaadin.data.Property<byte[]>
Specified by:
getType in class com.vaadin.ui.AbstractField<byte[]>

applyChanges

public void applyChanges()
Specified by:
applyChanges in interface MediaField

revertChanges

public void revertChanges()
Specified by:
revertChanges in interface MediaField

execute

public void execute()

executeImageModification

protected BufferedImage executeImageModification()
                                          throws IOException
Throws:
IOException

refreshImageSource

public abstract void refreshImageSource()

generateTempFileName

protected String generateTempFileName()

createResourceFromValue

protected com.vaadin.server.StreamResource createResourceFromValue()

createStreamSource

protected InputStream createStreamSource(BufferedImage img,
                                         String formatName)
                                  throws IOException
Throws:
IOException


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.