Class OrderedLayoutEditPolicy

  • All Implemented Interfaces:
    EditPolicy, RequestConstants
    Direct Known Subclasses:
    FlowLayoutEditPolicy

    public abstract class OrderedLayoutEditPolicy
    extends LayoutEditPolicy
    A LayoutEditPolicy for use with LayoutManagers that take no constraints. Such layout managers typically position children in coordinates based on their order in getChildren(). Therefore, this EditPolicy must perform the inverse mapping. Given a mouse location from the User, the policy must determine the index at which the child[ren] should be added/created.
    Since:
    2.0
    • Constructor Detail

      • OrderedLayoutEditPolicy

        public OrderedLayoutEditPolicy()
    • Method Detail

      • createAddCommand

        protected abstract Command createAddCommand​(EditPart child,
                                                    EditPart after)
        Returns the Command to add the specified child after a reference EditPart. If the reference is null, the child should be added as the first child.
        Parameters:
        child - the child being added
        after - null or a reference EditPart
        Returns:
        a Command to add the child
      • createMoveChildCommand

        protected abstract Command createMoveChildCommand​(EditPart child,
                                                          EditPart after)
        Returns the Command to move the specified child before the given reference EditPart. If the reference is null, the child should be moved in front of all children.

        A move is a change in the order of the children, which indirectly causes a change in location on the screen.

        Parameters:
        child - the child being moved
        after - null or the EditPart that should be after (or to the right of) the child being moved
        Returns:
        a Command to move the child
      • getAddCommand

        protected Command getAddCommand​(Request req)
        This method is overridden from the superclass to calculate the index at which the children should be added. The index is determined by finding a reference EditPart, and adding the new child[ren] after that reference part. null is used to indicate that the child[ren] should be added at the beginning.

        Subclasses must override createAddCommand(EditPart, EditPart), and should not override this method.

        Overrides:
        getAddCommand in class LayoutEditPolicy
        Parameters:
        req - the ADD Request
        Returns:
        A command to perform the ADD.
        See Also:
        LayoutEditPolicy.getAddCommand(Request)
      • getInsertionReference

        protected abstract EditPart getInsertionReference​(Request request)
        Calculates a reference EditPart using the specified Request. The EditPart returned is used to mark the index coming after that EditPart. null is used to indicate the index that comes after no EditPart, that is, it indicates the very last index.
        Parameters:
        request - the Request
        Returns:
        null or a reference EditPart
      • isLayoutHorizontal

        protected boolean isLayoutHorizontal()
        Returns whether the layout container's layout manager has a horizontal orientation or not.
        Returns:
        true if the layout container's layout manager has a horizontal orientation, false otherwise
        Since:
        3.7