Interface SelectionHandler

  • All Known Implementing Classes:
    AbstractSelectionHandler, DefaultSelectionHandler

    public interface SelectionHandler
    a SelectionHandler allows to manage selection-related behaviours for a given instance of Drawing. Concrete implementation may generally want to store references on selected Element's here. This may be easily carried out by relying on Java's collection framework, hence we have specified some useful methods here for this purpose.
    Since:
    jpicedt 1.3.2
    Version:
    $Id: SelectionHandler.java,v 1.7.2.1 2007/09/02 11:56:17 reynal Exp $
    Author:
    Sylvain Reynal
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addToSelection​(Element e)
      Add the given Element to the current selection
      Element[] asArray()
      Return the selected elements wrapped in an array (may be a convenience call to asCollection)
      java.util.Collection asCollection()
      Return the selected elements wrapped in a Collection
      boolean containsClass​(java.lang.Class clazz)
      Returns whether this selection-handler contains objects that are of the same type of inherit from the given clazz.
      java.util.ArrayList createFilteredCollection​(java.lang.Class clazz)
      Returns a list containing elements in the selection that are of the same type or inherit the given clazz.
      void delete​(Drawing d)
      Delete all selected Element's from the given Drawing
      java.util.Iterator elements()
      Return an iterator over the selected Element's
      boolean isSelected​(Element e, boolean includeAncestors)
      Return whether the given Element is selected or not
      void replaceSelection​(Element e)
      Replace the current selection with the given element.
      void selectAll​(Drawing d)
      Select all Element's belonging to the given Drawing.
      int size()
      Return the number of selected objects
      void unSelect​(Element e)
      Unselect the given Element, ie remove it from the current selection.
      void unSelectAll()
      Unselect all selected Element's
    • Method Detail

      • size

        int size()
        Return the number of selected objects
      • elements

        java.util.Iterator elements()
        Return an iterator over the selected Element's
      • asCollection

        java.util.Collection asCollection()
        Return the selected elements wrapped in a Collection
      • asArray

        Element[] asArray()
        Return the selected elements wrapped in an array (may be a convenience call to asCollection)
      • isSelected

        boolean isSelected​(Element e,
                           boolean includeAncestors)
        Return whether the given Element is selected or not
        Parameters:
        includeAncestors - if true, return true if this Element or one of its ancestors (e.g. a BranchElement) is selected. This may be implemented using reentrance.
      • selectAll

        void selectAll​(Drawing d)
        Select all Element's belonging to the given Drawing.
      • unSelectAll

        void unSelectAll()
        Unselect all selected Element's
      • addToSelection

        void addToSelection​(Element e)
        Add the given Element to the current selection
      • replaceSelection

        void replaceSelection​(Element e)
        Replace the current selection with the given element.
      • unSelect

        void unSelect​(Element e)
        Unselect the given Element, ie remove it from the current selection.
      • delete

        void delete​(Drawing d)
        Delete all selected Element's from the given Drawing
      • createFilteredCollection

        java.util.ArrayList createFilteredCollection​(java.lang.Class clazz)
        Returns a list containing elements in the selection that are of the same type or inherit the given clazz.
      • containsClass

        boolean containsClass​(java.lang.Class clazz)
        Returns whether this selection-handler contains objects that are of the same type of inherit from the given clazz.
        Since:
        jpicedt 1.4pre5