Class OffsetMoMLChangeRequest


  • public class OffsetMoMLChangeRequest
    extends MoMLChangeRequest
    A mutation request specified in MoML that offsets any objects that are created in the toplevel.

    This class is used by the paste action in Vergil so that the pasted icon does not overlap the original icon. If a BasicGraphFrame can be found, then the position of the mouse is used to determine the offsite. Otherwise, a small offset is used.

    The pasted objects are selected so that the can be moved as a group.

    Since:
    Ptolemy II 6.1
    Version:
    $Id$
    Author:
    Christopher Brooks, based on code from BasicGraphFrame by Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Detail

      • OffsetMoMLChangeRequest

        public OffsetMoMLChangeRequest​(java.lang.Object originator,
                                       NamedObj context,
                                       java.lang.String request)
        Construct a mutation request to be executed in the specified context. The context is typically a Ptolemy II container, such as an entity, within which the objects specified by the MoML code will be placed. This method resets and uses a parser that is a static member of this class. A listener to changes will probably want to check the originator so that when it is notified of errors or successful completion of changes, it can tell whether the change is one it requested. Alternatively, it can call waitForCompletion(). All external references are assumed to be absolute URLs. Whenever possible, use a different constructor that specifies the base.
        Parameters:
        originator - The originator of the change request.
        context - The context in which to execute the MoML.
        request - The mutation request in MoML.
    • Method Detail

      • _postParse

        protected void _postParse​(MoMLParser parser)
        Offset the locations of top level objects that are created by the change request. If a BasicGraphFrame can be found, then the position of the mouse is used to determine the offsite. Otherwise, a small offset is used.
        Overrides:
        _postParse in class MoMLChangeRequest
        Parameters:
        parser - The parser