com.u2d.element
Class Command

java.lang.Object
  extended by com.u2d.model.AbstractEObject
      extended by com.u2d.model.AbstractComplexEObject
          extended by com.u2d.element.ProgrammingElement
              extended by com.u2d.element.Member
                  extended by com.u2d.element.Command
All Implemented Interfaces:
Searchable, ChangeNotifier, ComplexEObject, EObject, PostChangeNotifier, PropertyChangeNotifier, Typed, Viewable, PersistorListener, AppEventNotifier, Restrictable, ValidationNotifier, java.awt.datatransfer.Transferable, java.io.Serializable
Direct Known Subclasses:
EOCommand, OverloadedEOCmd, QueryCommandAdapter

public abstract class Command
extends Member
implements Restrictable

Author:
Eitan Suez
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.u2d.model.AbstractComplexEObject
AbstractComplexEObject.EditState, AbstractComplexEObject.NullState, AbstractComplexEObject.ReadState, AbstractComplexEObject.TransientState
 
Field Summary
protected  boolean _sensitive
          A sensitive command is one that should be guarded against inadvertant invocation.
 
Fields inherited from class com.u2d.element.Member
_mnemonic, _parent
 
Fields inherited from class com.u2d.element.ProgrammingElement
_label, _name
 
Fields inherited from class com.u2d.model.AbstractComplexEObject
_associations, _changeSupport, _createdOn, _currentState, _editState, _nullState, _readState, _stateMap, _transientState, _type, commandOrderEditState, commandOrderReadState, commandOrderTransientState, readOnly
 
Fields inherited from class com.u2d.model.AbstractEObject
_listenerList, _postListeners, _validationEvent, _validationListenerList, changeEvent
 
Constructor Summary
Command()
           
 
Method Summary
 void allow()
           
 void applyRestriction(Restriction restriction)
           
 boolean equals(java.lang.Object obj)
           
abstract  void execute(java.lang.Object value, EView source)
           
 boolean filter(EObject eo)
           
static SimpleFinder finder(java.lang.String commandName)
           
 void forbid()
           
 User getOwner(ComplexEObject parent)
           
 int hashCode()
           
 boolean isForbidden()
           
 boolean isMinorCommand(EView source)
          Swallow minor commands for maximized views as they should only apply to minimized views (iconview or listitemview)
 boolean isOpenInNonMinimizedContext(EView source)
          basically a guard against grafting the "Open" command on maximized views
 boolean isSensitive()
           
 void liftRestriction(Restriction restriction)
           
 void setOwner(Field ownerField)
           
 void setSensitive(boolean sensitive)
           
 
Methods inherited from class com.u2d.element.Member
getMnemonic, hasMnemonic, member, nameComparator, parent, setMnemonic
 
Methods inherited from class com.u2d.element.ProgrammingElement
deriveLabel, deriveLabel, getLabel, getName, isMeta, label, name, title, toString
 
Methods inherited from class com.u2d.model.AbstractComplexEObject
addAppEventListener, addPropertyChangeListener, addPropertyChangeListener, association, cancelTransition, childFields, cleanCGILibEnhancer, clearEditor, command, command, commands, createInstance, defaultCommand, defaultCommandName, delete, doSave, field, fieldSublist, fireAppEventNotification, fireAppEventNotification, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCreatedOn, getDeleted, getDeletedOn, getExpandableView, getFormView, getIconView, getID, getInequalities, getListItemView, getMainView, getState, getTabBodyView, getTransferData, getTransferDataFlavors, getTreeView, getView, iconLg, iconSm, initialize, isDataFlavorSupported, isEditableState, isEditState, isEmpty, isNullState, isTransientState, log, makeCopy, onBeforeCreate, onBeforeSave, onCreate, onDelete, onLoad, onSave, popState, pushState, removeAppEventListener, removePropertyChangeListener, removePropertyChangeListener, restoreCopy, restoredState, restoreState, save, saveCopy, setEditor, setEditState, setID, setNullState, setReadState, setStartState, setState, setState, setTransientState, setValue, setValue, startState, treeModel, type, validate
 
Methods inherited from class com.u2d.model.AbstractEObject
addChangeListener, addPostChangeListener, addValidationListener, currentUser, field, fireStateChanged, fireValidationException, fireValidationException, hbmPersistor, parentObject, persistor, removeChangeListener, removePostChangeListener, removeValidationListener, setField, vmech
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.u2d.model.EObject
field, parentObject, setField
 
Methods inherited from interface com.u2d.validation.ValidationNotifier
addValidationListener, fireValidationException, fireValidationException, removeValidationListener
 
Methods inherited from interface com.u2d.model.ChangeNotifier
addChangeListener, fireStateChanged, removeChangeListener
 
Methods inherited from interface com.u2d.model.PostChangeNotifier
addPostChangeListener, fireStateChanged, removePostChangeListener
 

Field Detail

_sensitive

protected boolean _sensitive
A sensitive command is one that should be guarded against inadvertant invocation. Its cost is high and undoing is difficult. A ui is advised to make it difficult for an end user to inadvertantly invoke the command.

Constructor Detail

Command

public Command()
Method Detail

execute

public abstract void execute(java.lang.Object value,
                             EView source)
                      throws java.lang.reflect.InvocationTargetException
Throws:
java.lang.reflect.InvocationTargetException

isSensitive

public boolean isSensitive()

setSensitive

public void setSensitive(boolean sensitive)

forbid

public void forbid()

allow

public void allow()

isForbidden

public boolean isForbidden()

applyRestriction

public void applyRestriction(Restriction restriction)
Specified by:
applyRestriction in interface Restrictable

liftRestriction

public void liftRestriction(Restriction restriction)
Specified by:
liftRestriction in interface Restrictable

setOwner

public void setOwner(Field ownerField)

getOwner

public User getOwner(ComplexEObject parent)

finder

public static SimpleFinder finder(java.lang.String commandName)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AbstractComplexEObject

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isOpenInNonMinimizedContext

public boolean isOpenInNonMinimizedContext(EView source)
basically a guard against grafting the "Open" command on maximized views


isMinorCommand

public boolean isMinorCommand(EView source)
Swallow minor commands for maximized views as they should only apply to minimized views (iconview or listitemview)

Returns:
true if command is a minor command and view is not minimized

filter

public boolean filter(EObject eo)