info.magnolia.ui.mediaeditor.data
Class EditHistoryTrackingPropertyImpl

java.lang.Object
  extended by com.vaadin.data.util.AbstractProperty<T>
      extended by com.vaadin.data.util.TransactionalPropertyWrapper<byte[]>
          extended by info.magnolia.ui.mediaeditor.data.EditHistoryTrackingPropertyImpl
All Implemented Interfaces:
com.vaadin.data.Property<byte[]>, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<byte[]>, com.vaadin.data.Property.ValueChangeNotifier, EditHistoryTrackingProperty, Serializable

public class EditHistoryTrackingPropertyImpl
extends com.vaadin.data.util.TransactionalPropertyWrapper<byte[]>
implements EditHistoryTrackingProperty

Property implementation that uses temporary files for storing the intermediate results of data modification. Tracking is done in both direction - steps can undone and redone. Original data is stored in memory and the value can be rolled back to it.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractProperty
com.vaadin.data.util.AbstractProperty.ReadOnlyStatusChangeEvent
 
Nested classes/interfaces inherited from interface info.magnolia.ui.mediaeditor.data.EditHistoryTrackingProperty
EditHistoryTrackingProperty.Listener
 
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.ValueChangeEvent, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer
 
Constructor Summary
EditHistoryTrackingPropertyImpl(byte[] bytes, info.magnolia.i18nsystem.SimpleTranslator i18n)
           
 
Method Summary
 void commit()
          Propagate changes to the original value.
 String getLastDoneActionName()
          Gets the last done action name.
 String getLastUnDoneActionName()
          Gets the last undone action name.
 void purgeHistory()
          Clears modification history which erases all the tracked steps.
 void redo()
          Redo last step.
 void revert()
          Roll back to original value.
 void setCapacity(int depth)
          Sets the amount of steps that can be tracked.
 void setListener(EditHistoryTrackingProperty.Listener listener)
           
 void setValue(byte[] bytes)
           
 void startAction(String actionName)
          Starts an action which will cause a new record to appear in history.
 void undo()
          Undo last step.
 
Methods inherited from class com.vaadin.data.util.TransactionalPropertyWrapper
endTransaction, fireValueChange, getType, getValue, getWrappedProperty, isReadOnly, rollback, setReadOnly, startTransaction
 
Methods inherited from class com.vaadin.data.util.AbstractProperty
addListener, addListener, addReadOnlyStatusChangeListener, addValueChangeListener, fireReadOnlyStatusChange, getListeners, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValueChangeListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vaadin.data.Property
getType, getValue, isReadOnly, setReadOnly
 
Methods inherited from interface com.vaadin.data.Property.ValueChangeNotifier
addListener, addValueChangeListener, removeListener, removeValueChangeListener
 

Constructor Detail

EditHistoryTrackingPropertyImpl

public EditHistoryTrackingPropertyImpl(byte[] bytes,
                                       info.magnolia.i18nsystem.SimpleTranslator i18n)
Method Detail

setListener

public void setListener(EditHistoryTrackingProperty.Listener listener)
Specified by:
setListener in interface EditHistoryTrackingProperty

getLastDoneActionName

public String getLastDoneActionName()
Description copied from interface: EditHistoryTrackingProperty
Gets the last done action name.

Specified by:
getLastDoneActionName in interface EditHistoryTrackingProperty
Returns:
last action name.

getLastUnDoneActionName

public String getLastUnDoneActionName()
Description copied from interface: EditHistoryTrackingProperty
Gets the last undone action name.

Specified by:
getLastUnDoneActionName in interface EditHistoryTrackingProperty
Returns:
last undone action name.

purgeHistory

public void purgeHistory()
Description copied from interface: EditHistoryTrackingProperty
Clears modification history which erases all the tracked steps. After this method call it will be impossible to undo/redo operations.

Specified by:
purgeHistory in interface EditHistoryTrackingProperty

setCapacity

public void setCapacity(int depth)
Description copied from interface: EditHistoryTrackingProperty
Sets the amount of steps that can be tracked. When the limit is reached, the eldest recorded steps are erased.

Specified by:
setCapacity in interface EditHistoryTrackingProperty
Parameters:
depth - amount of steps to be available for undo/redo.

startAction

public void startAction(String actionName)
Description copied from interface: EditHistoryTrackingProperty
Starts an action which will cause a new record to appear in history.

Specified by:
startAction in interface EditHistoryTrackingProperty
Parameters:
actionName - the name of an action.

undo

public void undo()
Description copied from interface: EditHistoryTrackingProperty
Undo last step.

Specified by:
undo in interface EditHistoryTrackingProperty

redo

public void redo()
Description copied from interface: EditHistoryTrackingProperty
Redo last step.

Specified by:
redo in interface EditHistoryTrackingProperty

revert

public void revert()
Description copied from interface: EditHistoryTrackingProperty
Roll back to original value.

Specified by:
revert in interface EditHistoryTrackingProperty

commit

public void commit()
Description copied from interface: EditHistoryTrackingProperty
Propagate changes to the original value.

Specified by:
commit in interface com.vaadin.data.Property.Transactional<byte[]>
Specified by:
commit in interface EditHistoryTrackingProperty
Overrides:
commit in class com.vaadin.data.util.TransactionalPropertyWrapper<byte[]>

setValue

public void setValue(byte[] bytes)
              throws com.vaadin.data.Property.ReadOnlyException
Specified by:
setValue in interface com.vaadin.data.Property<byte[]>
Overrides:
setValue in class com.vaadin.data.util.TransactionalPropertyWrapper<byte[]>
Throws:
com.vaadin.data.Property.ReadOnlyException


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