Class AbstractDotElement

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.util.EventListener, DotElement
    Direct Known Subclasses:
    DotEdge, DotNode

    public abstract class AbstractDotElement
    extends java.lang.Object
    implements DotElement
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMouseListener​(java.awt.event.MouseListener l)
      Please note that in the current implementation, only a click on a drawn pixel of an element is registered as a click (due to Bezier curves for edges and irregular shapes for nodes).
      void addSelectionListener​(DotElementSelectionListener listener)
      Add a selection/deselection listener.
      protected java.lang.String escapeString​(java.lang.String value)  
      java.lang.String getId()  
      java.lang.String getLabel()  
      java.lang.String getOption​(java.lang.String key)  
      java.util.Set<java.lang.String> getOptionKeySet()  
      java.util.List<DotElementSelectionListener> getSelectionListeners()  
      boolean isSelectable()
      Please note that in the current implementation, only a click on a drawn pixel of an element is registered as a click (due to Bezier curves for edges and irregular shapes for nodes).
      java.lang.String labelToString()  
      void mouseClicked​(java.awt.event.MouseEvent e)  
      void mouseEntered​(java.awt.event.MouseEvent e)  
      void mouseExited​(java.awt.event.MouseEvent e)  
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseReleased​(java.awt.event.MouseEvent e)  
      void setLabel​(java.lang.String label)  
      void setOption​(java.lang.String key, java.lang.String value)  
      void setSelectable​(boolean selectable)
      Sets whether this node can be selected.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractDotElement

        public AbstractDotElement()
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface DotElement
      • getLabel

        public java.lang.String getLabel()
        Specified by:
        getLabel in interface DotElement
      • setLabel

        public void setLabel​(java.lang.String label)
        Specified by:
        setLabel in interface DotElement
      • labelToString

        public java.lang.String labelToString()
      • escapeString

        protected java.lang.String escapeString​(java.lang.String value)
      • setOption

        public void setOption​(java.lang.String key,
                              java.lang.String value)
        Specified by:
        setOption in interface DotElement
      • getOption

        public java.lang.String getOption​(java.lang.String key)
        Specified by:
        getOption in interface DotElement
        Returns:
        the value of the option if it was set, otherwise null.
      • getOptionKeySet

        public java.util.Set<java.lang.String> getOptionKeySet()
        Specified by:
        getOptionKeySet in interface DotElement
        Returns:
        the set of options that is set (keys)
      • addMouseListener

        public void addMouseListener​(java.awt.event.MouseListener l)
        Description copied from interface: DotElement
        Please note that in the current implementation, only a click on a drawn pixel of an element is registered as a click (due to Bezier curves for edges and irregular shapes for nodes). Thus, only if a user clicks on the border or label of a node, the click is registered. The same holds for mouseEnter and mouseExit events: these are based on drawn pixels. To avoid this problem, give each node a fill using node.setOption("fillcolor", "#FFFFFF") and node.setOption("style", "filled").
        Specified by:
        addMouseListener in interface DotElement
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • setSelectable

        public void setSelectable​(boolean selectable)
        Description copied from interface: DotElement
        Sets whether this node can be selected. Please note that in the current implementation, only a click on a drawn pixel of an element is registered as a click (due to Bezier curves for edges and irregular shapes for nodes). Thus, only if a user clicks on the border or label of a node, the click is registered. To avoid this problem, give each node a fill using node.setOption("fillcolor", "#FFFFFF") and node.setOption("style", "filled").
        Specified by:
        setSelectable in interface DotElement
      • isSelectable

        public boolean isSelectable()
        Description copied from interface: DotElement
        Please note that in the current implementation, only a click on a drawn pixel of an element is registered as a click (due to Bezier curves for edges and irregular shapes for nodes). Thus, only if a user clicks on the border or label of a node, the click is registered. To avoid this problem, give each node a fill using node.setOption("fillcolor", "#FFFFFF") and node.setOption("style", "filled").
        Specified by:
        isSelectable in interface DotElement
        Returns:
        whether the element is selectable.
      • addSelectionListener

        public void addSelectionListener​(DotElementSelectionListener listener)
        Description copied from interface: DotElement
        Add a selection/deselection listener. Side-effect: enables selection of the element. Thread-safe. Please note that in the current implementation, only a click on a drawn pixel of an element is registered as a click (due to Bezier curves for edges and irregular shapes for nodes). Thus, only if a user clicks on the border or label of a node, the click is registered. To avoid this problem, give each node a fill using node.setOption("fillcolor", "#FFFFFF") and node.setOption("style", "filled").
        Specified by:
        addSelectionListener in interface DotElement