Package ptolemy.vergil.basic
Class OffsetMoMLChangeRequest
- java.lang.Object
-
- ptolemy.kernel.util.ChangeRequest
-
- ptolemy.moml.MoMLChangeRequest
-
- ptolemy.vergil.basic.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 Summary
Constructors Constructor Description OffsetMoMLChangeRequest(java.lang.Object originator, NamedObj context, java.lang.String request)
Construct a mutation request to be executed in the specified context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_postParse(MoMLParser parser)
Offset the locations of top level objects that are created by the change request.protected void
_preParse(MoMLParser parser)
Clear the list of top objects.-
Methods inherited from class ptolemy.moml.MoMLChangeRequest
_execute, getContext, getDeferredToParent, setMergeWithPreviousUndo, setReportErrorsToHandler, setUndoable
-
Methods inherited from class ptolemy.kernel.util.ChangeRequest
addChangeListener, execute, getDescription, getLocality, getSource, isErrorReported, isPersistent, isStructuralChange, removeChangeListener, setDescription, setErrorReported, setListeners, setPersistent, waitForCompletion
-
-
-
-
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 classMoMLChangeRequest
- Parameters:
parser
- The parser
-
_preParse
protected void _preParse(MoMLParser parser)
Clear the list of top objects.- Overrides:
_preParse
in classMoMLChangeRequest
- Parameters:
parser
- The parser
-
-