Class TranslationCommand

    • Field Detail

      • xd

        protected int xd
      • yd

        protected int yd
    • Constructor Detail

      • TranslationCommand

        public TranslationCommand​(CommandManager commandManager,
                                  ArrayList<Element> elements)
        Constructor
        Parameters:
        commandManager - - The command manager
        elements - - The array list of the elements
    • Method Detail

      • moveElements

        protected void moveElements​(int x,
                                    int y)
        Move elements by (x, y)
        Parameters:
        x - - The x value of the property name 'x'
        y - - The y value of the property name 'y'
      • move

        public void move​(int x,
                         int y)
        Move elements by (x, y). This method can be called repeatedly as long as the translation has not been committed. The elements are actually moved, so change events are propagated.
        Overrides:
        move in class AbstractTransaction
        Parameters:
        x - - The x value
        y - - The y value
      • doCancel

        protected void doCancel()
        Undo the translation. All elements are moved back to their original position. The translation can only be cancelled as long as it has not been committed.
        Specified by:
        doCancel in class AbstractTransaction
      • getModifiedElement

        public Element getModifiedElement()
        Returns:
        the modified element or its closest relative (sibling or parent) if the element is not displayed.