public final class ModelStateManager extends Object
temporary, new, modified and arror
. When model element's state is set, in some cases
(for example, for modified
state, all element's parents are also marked as
modified
Many of these methods are called internally, when model elements are added to a test or modified.
Clients y call these methods as needed, however in most cases, they should not need to.Constructor and Description |
---|
ModelStateManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
finalize() |
static Color |
getBackground(Object element)
Returns modified background color based on the presense of various type.
|
static IMarker |
getError(CBActionElement element,
String errorId) |
static CBActionElement[] |
getErrorChildren(CBActionElement element) |
static IMarker[] |
getErrors(CBActionElement element)
Returns errors associated with this element.
|
static Font |
getFont(Object element,
Font originalFont)
Returns modified font for the argument
element based on the presense of
various attributes. |
static Color |
getForeground(Object element)
Returns modified foreground color for
element based on the presense of
various states. |
static Image |
getImage(Object object,
Image baseImage,
ExtLabelProvider provider) |
static StyledString.Styler |
getSearhMatchStyler() |
static boolean |
hasError(CBActionElement element)
Checks if the
element has error
state. |
static boolean |
isModified(CBActionElement element)
Checks if the
element has modified state. |
static boolean |
isNew(CBActionElement element)
Checks if the
element has new state. |
static boolean |
isStatusTemp(CBActionElement element,
TestEditor editor)
Checks for
temp status on the object. |
static void |
setError(CBActionElement element,
TestEditor editor,
IMarker errorMarker)
Sets error state.
|
static Object |
setStatusModified(CBActionElement element,
Object context,
TestEditor editor)
Sets
modified state on the model element. |
static Object |
setStatusModified(CBActionElement element,
Object context,
TestEditor editor,
boolean updateChildrenToo,
boolean updateParent)
Sets
modified state on the model element. |
static Object |
setStatusModified(CBTest test,
Object context,
TestEditor editor) |
static void |
setStatusNew(CBActionElement element,
TestEditor editor)
Set
new state on model element. |
static void |
setStatusTemp(CBActionElement element,
TestEditor editor)
Sets
temp status on model element. |
static void |
setStatusTemp(CBActionElement element,
TestEditor editor,
boolean updateEditor)
Sets
temp status on model element. |
static int |
unsetAllErrors(TestEditor editor)
Unsets all errors in he Test Editor.
|
static void |
unsetError(CBActionElement element,
TestEditor editor,
IMarker errorMarker)
Removes error state from model element.
|
static void |
unsetErrors(CBActionElement element,
TestEditor editor) |
static void |
unsetStatusModified(CBActionElement element,
Object context,
TestEditor editor)
Unsets
modified state on model element. |
static void |
unsetStatusNew(CBActionElement element,
Object context,
TestEditor editor)
Clears
new status. |
static void |
unsetStatusTemp(CBActionElement element,
TestEditor editor)
Unsets
temp status. |
static void |
unsetStatusTemp(CBActionElement element,
TestEditor editor,
boolean updateEditor)
Unsets
temp status. |
public static void setError(CBActionElement element, TestEditor editor, IMarker errorMarker)
element
- CBActionElementeditor
- TestEditorerrorMarker
- IMarker created by MarkerUtil.MarkerUtil
public static void unsetErrors(CBActionElement element, TestEditor editor)
public static void unsetError(CBActionElement element, TestEditor editor, IMarker errorMarker)
element
- CBModelElementeditor
- TestEditorerrorMarker
- IMarker. Marker must have been created using MarkerUtil and passed
to setError
method.ModelStateManager.setError(CBActionElement, TestEditor, IMarker)
,
MarkerUtil.removeMarkers(IMarker[], TestEditor)
public static void setStatusNew(CBActionElement element, TestEditor editor)
new
state on model element.element
- CBActionElementeditor
- TestEditorpublic static void unsetStatusNew(CBActionElement element, Object context, TestEditor editor)
new
status. Typically called after test editor is being saved.element
- CBActionElementcontext
- unusededitor
- TestEditorModelStateManager.setStatusNew(CBActionElement, TestEditor)
public static void setStatusTemp(CBActionElement element, TestEditor editor)
temp
status on model element. Objects with temp
status
are displayed using grey color and italic font. These objects are placed in the model
temporary or about to be removed.element
- CBActionElementeditor
- TestEditorpublic static void setStatusTemp(CBActionElement element, TestEditor editor, boolean updateEditor)
temp
status on model element. Objects with temp
status
are displayed using grey color and italic font. These objects are placed in the model
temporary or about to be removed.element
- CBActionElementeditor
- TestEditorupdateEditor
- booleanpublic static void unsetStatusTemp(CBActionElement element, TestEditor editor)
temp
status.element
- CBActionElementeditor
- TestEditorModelStateManager.setStatusTemp(CBActionElement, TestEditor)
public static void unsetStatusTemp(CBActionElement element, TestEditor editor, boolean updateEditor)
temp
status.element
- CBActionElementeditor
- TestEditorupdateEditor
- booleanModelStateManager.setStatusTemp(CBActionElement, TestEditor)
public static boolean isStatusTemp(CBActionElement element, TestEditor editor)
temp
status on the object.element
- CBActionElementeditor
- TestEditortrue
object is marked as temp
, false
otherwise.public static Object setStatusModified(CBActionElement element, Object context, TestEditor editor)
modified
state on the model element. Objects that are modified
are
displayed using italics font. modified
state is unset after a test was saved.element
- CBActionElementcontext
- Object that can be used to identify modification or null
.editor
- TestEditorcontext
argument was not null
, same object is returned.
otherwise new Date()
is returned.public static Object setStatusModified(CBActionElement element, Object context, TestEditor editor, boolean updateChildrenToo, boolean updateParent)
modified
state on the model element. Objects that are modified
are
displayed using italics font. modified
state is unset after a test was saved.element
- CBActionElementcontext
- Object that can be used to identify modification or null
.editor
- TestEditorupdateChildrenToo
- boolean Sets modified
status to all children of the element
updateParent
- boolean Set modified
status to parent. Only considered if updateChidrenToo==true
;
otherwise, the parent is always updated. Pass false
to avoid excessive refreshescontext
argument was not null
, same object is returned.
otherwise new Date()
is returned.public static Object setStatusModified(CBTest test, Object context, TestEditor editor)
public static void unsetStatusModified(CBActionElement element, Object context, TestEditor editor)
modified
state on model element.element
- CBActionElementcontext
- Object. Same context must be passed to setModifiedStatus
. In this version,
this argument is unused and reserved.editor
- TestEditor.public static Font getFont(Object element, Font originalFont)
element
based on the presense of
various attributes.element
- Object element (must be CBActionlEement)originalFont
- null
if no special font is needed.IFontProvider.getFont(java.lang.Object)
public static Color getForeground(Object element)
element
based on the presense of
various states.element
- Object (must be CBActionElement)null
.IColorProvider.getForeground(java.lang.Object)
public static Color getBackground(Object element)
null
IColorProvider.getBackground(java.lang.Object)
protected void finalize() throws Throwable
public static int unsetAllErrors(TestEditor editor)
editor
- public static boolean isNew(CBActionElement element)
element
has new
state.element
- CBActionElementpublic static boolean isModified(CBActionElement element)
element
has modified
state.element
- CBActionElementpublic static boolean hasError(CBActionElement element)
element
has error
state.element
- CBActionElementpublic static IMarker[] getErrors(CBActionElement element)
element
- CBActionElementIMarker
s if there is no errors.public static IMarker getError(CBActionElement element, String errorId)
public static CBActionElement[] getErrorChildren(CBActionElement element)
element
- element
that have errors.public static Image getImage(Object object, Image baseImage, ExtLabelProvider provider)
public static StyledString.Styler getSearhMatchStyler()
© Copyright IBM Corp. 2013. All rights reserved.