Package com.iizigo.prop
Class EditedPropController<PROP extends GProp<?>,PROP_VALUE>
- java.lang.Object
- com.iizigo.prop.EditedPropController<PROP,PROP_VALUE>
- All Implemented Interfaces:
IContainerListenerOwner
public class EditedPropController<PROP extends GProp<?>,PROP_VALUE> extends java.lang.Object implements IContainerListenerOwner
Class used to handle the edited property for property editors. It can represent a single property value or multiple values from several selected properties being edited at once. In the latter case, there could be clashes in the values, i.e. different values.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description EditedPropController(IPropertyEditorController controller, PropertyEditorInfo info, Atom atom, PropCnr[] containers)
Creates the controller instance for a normal property.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assignError(java.lang.String input, java.lang.String message)
Assigns an error to the property.void
assignErrorWithID(java.lang.String errorID, java.lang.String input, java.lang.String message)
Assigns an error to the property.void
assignValue(PROP_VALUE value)
Assigns the value to the properties and clears potential error in the property.void
beginOurEvent()
Begins process for private event.protected PROP
createProp(PROP_VALUE value)
Creates a property without parent.void
dispose()
Disposes of the instance.void
endOurEvent()
Completes processing of private event.GProp<?>[]
getCurrentProperties()
Gets the array of properties edited.PROP_VALUE
getCurrentValue()
Gets the current value from the property, not user input.java.util.HashSet<PROP_VALUE>
getCurrentValues()
Gets the array of values currently used.IEditedPropControllerOwner<PROP,PROP_VALUE>
getOwner()
Gets the owner of this controller.PropCnr[]
getParents()
Gets the parent property containers.int
getSeverity()
Gets the error severity.int
getSeverity(int additional)
Gets the error severity.boolean
hasEventProcessing()
Checks if there is an event already being processed.boolean
isDisposed()
Checks if disposed of.boolean
isExtended()
Gets the extended state: the master is checked in case of aboolean
isPropReadOnly()
Checks if it's read-only, i.e.static boolean
isPropReadOnly(PropCnr pc)
Checks if it's read-only, i.e.void
onContainerUpdated(boolean checkReadOnly)
Called when a change in the container that requires attention occurred.void
refreshExtended()
Refreshes the extended state.void
undefineProperty()
Undefines the property and clears potential error in the property.
Constructor Detail
EditedPropController
public EditedPropController(IPropertyEditorController controller, PropertyEditorInfo info, Atom atom, PropCnr[] containers)
Creates the controller instance for a normal property.
Method Detail
isDisposed
public boolean isDisposed()
Checks if disposed of.
isPropReadOnly
public boolean isPropReadOnly()
Checks if it's read-only, i.e. if the property is extends-private.
isPropReadOnly
public static boolean isPropReadOnly(PropCnr pc)
Checks if it's read-only, i.e. if the property is extends-private.- Parameters:
pc
- Container to check.- Returns:
- true for read-only state, false for normal.
isExtended
public boolean isExtended()
Gets the extended state: the master is checked in case of a- Returns:
- true if all edited properties are extended, false otherwise.
getParents
public PropCnr[] getParents()
Gets the parent property containers.- Returns:
- Array of property containers, at least one in length.
getCurrentProperties
public GProp<?>[] getCurrentProperties()
Gets the array of properties edited.- Returns:
- An array with all properties created for all the parents. An item in the array may be null!
getOwner
public IEditedPropControllerOwner<PROP,PROP_VALUE> getOwner()
Gets the owner of this controller.
createProp
protected PROP createProp(PROP_VALUE value)
Creates a property without parent.
beginOurEvent
public void beginOurEvent()
Begins process for private event.
endOurEvent
public void endOurEvent()
Completes processing of private event.
hasEventProcessing
public boolean hasEventProcessing()
Checks if there is an event already being processed.- Specified by:
hasEventProcessing
in interfaceIContainerListenerOwner
assignValue
public void assignValue(PROP_VALUE value)
Assigns the value to the properties and clears potential error in the property.
undefineProperty
public void undefineProperty()
Undefines the property and clears potential error in the property.
assignError
public void assignError(java.lang.String input, java.lang.String message)
Assigns an error to the property.
assignErrorWithID
public void assignErrorWithID(java.lang.String errorID, java.lang.String input, java.lang.String message)
Assigns an error to the property.
dispose
public void dispose()
Disposes of the instance.
getCurrentValue
public PROP_VALUE getCurrentValue()
Gets the current value from the property, not user input. If several properties are selected, the value is only returned when the value is the same for all properties (otherwise null is returned).- Returns:
- The property value, or null if not defined.
getCurrentValues
public java.util.HashSet<PROP_VALUE> getCurrentValues()
Gets the array of values currently used. Null entries may be present.
onContainerUpdated
public void onContainerUpdated(boolean checkReadOnly)
Called when a change in the container that requires attention occurred. This method is called from the SWT thread.- Specified by:
onContainerUpdated
in interfaceIContainerListenerOwner
refreshExtended
public void refreshExtended()
Refreshes the extended state.
getSeverity
public int getSeverity()
Gets the error severity.
getSeverity
public int getSeverity(int additional)
Gets the error severity.