com.ibm.rational.common.test.editor.framework

Class ModelStateManager

  • java.lang.Object
    • com.ibm.rational.common.test.editor.framework.ModelStateManager


  • public final class ModelStateManager
    extends Object

    ModelStateManager

    This class contains several static methods for managing state of model objects. These states are used primarily for conveying visual feedback to user. States are: 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 Detail

      • ModelStateManager

        public ModelStateManager()
    • Method Detail

      • setError

        public static void setError(CBActionElement element,
                    TestEditor editor,
                    IMarker errorMarker)
        Sets error state.
        Parameters:
        element - CBActionElement
        editor - TestEditor
        errorMarker - IMarker created by MarkerUtil.
        See Also:
        MarkerUtil
      • setStatusNew

        public static void setStatusNew(CBActionElement element,
                        TestEditor editor)
        Set new state on model element.
        Parameters:
        element - CBActionElement
        editor - TestEditor
      • setStatusTemp

        public static void setStatusTemp(CBActionElement element,
                         TestEditor editor)
        Sets 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.
        Parameters:
        element - CBActionElement
        editor - TestEditor
      • setStatusTemp

        public static void setStatusTemp(CBActionElement element,
                         TestEditor editor,
                         boolean updateEditor)
        Sets 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.
        Parameters:
        element - CBActionElement
        editor - TestEditor
        updateEditor - boolean
      • isStatusTemp

        public static boolean isStatusTemp(CBActionElement element,
                           TestEditor editor)
        Checks for temp status on the object.
        Parameters:
        element - CBActionElement
        editor - TestEditor
        Returns:
        boolean true object is marked as temp, false otherwise.
      • setStatusModified

        public static Object setStatusModified(CBActionElement element,
                               Object context,
                               TestEditor editor)
        Sets modified state on the model element. Objects that are modified are displayed using italics font. modified state is unset after a test was saved.
        Parameters:
        element - CBActionElement
        context - Object that can be used to identify modification or null.
        editor - TestEditor
        Returns:
        Object if context argument was not null, same object is returned. otherwise new Date() is returned.
      • setStatusModified

        public static Object setStatusModified(CBActionElement element,
                               Object context,
                               TestEditor editor,
                               boolean updateChildrenToo,
                               boolean updateParent)
        Sets modified state on the model element. Objects that are modified are displayed using italics font. modified state is unset after a test was saved.
        Parameters:
        element - CBActionElement
        context - Object that can be used to identify modification or null.
        editor - TestEditor
        updateChildrenToo - 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 refreshes
        Returns:
        Object if context argument was not null, same object is returned. otherwise new Date() is returned.
      • unsetStatusModified

        public static void unsetStatusModified(CBActionElement element,
                               Object context,
                               TestEditor editor)
        Unsets modified state on model element.
        Parameters:
        element - CBActionElement
        context - Object. Same context must be passed to setModifiedStatus. In this version, this argument is unused and reserved.
        editor - TestEditor.
      • getFont

        public static Font getFont(Object element,
                   Font originalFont)
        Returns modified font for the argument element based on the presense of various attributes.
        Parameters:
        element - Object element (must be CBActionlEement)
        originalFont -
        Returns:
        Font or null if no special font is needed.
        See Also:
        IFontProvider.getFont(java.lang.Object)
      • getForeground

        public static Color getForeground(Object element)
        Returns modified foreground color for element based on the presense of various states.
        Parameters:
        element - Object (must be CBActionElement)
        Returns:
        Color or null.
        See Also:
        IColorProvider.getForeground(java.lang.Object)
      • unsetAllErrors

        public static int unsetAllErrors(TestEditor editor)
        Unsets all errors in he Test Editor. Typically called by ErrorcheckingJob prior to invocation. Clients should not need to call this method directly.
        Parameters:
        editor -
        Returns:
        number of errors cleared.
      • isNew

        public static boolean isNew(CBActionElement element)
        Checks if the element has new state.
        Parameters:
        element - CBActionElement
        Returns:
        boolean
      • isModified

        public static boolean isModified(CBActionElement element)
        Checks if the element has modified state.
        Parameters:
        element - CBActionElement
        Returns:
        boolean
      • hasError

        public static boolean hasError(CBActionElement element)
        Checks if the element has error state.
        Parameters:
        element - CBActionElement
        Returns:
        boolean
      • getErrors

        public static IMarker[] getErrors(CBActionElement element)
        Returns errors associated with this element.
        Parameters:
        element - CBActionElement
        Returns:
        boolean List. Returns array of IMarkers if there is no errors.
      • getErrorChildren

        public static CBActionElement[] getErrorChildren(CBActionElement element)
        Parameters:
        element -
        Returns:
        array CBActionElement[] child elements of element that have errors.
IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2013. All rights reserved.