Class Selector

java.lang.Object
org.graphstream.ui.graphicGraph.stylesheet.Selector

public class Selector
extends Object
A selector is the part of a CSS rule that defines to which element a style applies in the graph.
Author:
Antoine Dutot, Yoann Pign�
  • Field Details

    • type

      public Selector.Type type
      The kind of element this matcher applies to.
    • id

      public String id
      If the selector specify an identifier.
    • clazz

      public String clazz
      If the selector specify a class.
    • pseudoClass

      public String pseudoClass
      If the selector also specify a pseudo class.
  • Constructor Details

    • Selector

      public Selector​(Selector.Type type)
      New selector for a given type of element.
      Parameters:
      type - The element type of this selector.
    • Selector

      public Selector​(Selector.Type type, String identifier, String clazz)
      New selector for a given type of element. This constructor allows to specify either an identifier or a class to restrict this selector. If the identifier is given, the class will never be used (as identifiers are finer than classes). If the identifier is null the class will be used. The identifier allow to select only one element by its name. The class allows to select several elements.
      Parameters:
      type - The element type of this selector.
      identifier - The element name.
      clazz - The element class.
    • Selector

      public Selector​(String type)
      Utility constructor that assign the correct type to the selector from a string. The type must be "node", "edge", "graph", or "sprite".
      Parameters:
      type - Either "node", "edge", "graph" or "sprite".
    • Selector

      public Selector​(Selector other)
      New selector, copy of another.
      Parameters:
      other - The other selector.
  • Method Details

    • setId

      public void setId​(String id)
      Specify the identifier of the unique element this selector applies to.
      Parameters:
      id - A string that identifies an element of the graph.
    • setClass

      public void setClass​(String clazz)
      Specify the class of the elements this selector applies to.
      Parameters:
      clazz - A string that matches all elements of a given class.
    • setPseudoClass

      public void setPseudoClass​(String pseudoClass)
      Specify the pseudo-class of the elements this selector applies to.
      Parameters:
      pseudoClass - A string that matches all elements of a given pseudo-class.
    • getType

      public Selector.Type getType()
      The kind of elements this selector applies to.
      Returns:
      An element type.
    • getId

      public String getId()
      The identifier of the element this selector uniquely applies to. This can be null if this selector is general.
      Returns:
      The identifier or null if the selector is general.
    • getClazz

      public String getClazz()
      The class of elements this selector applies to. This can be null if this selector is general.
      Returns:
      A class name or null if the selector is general.
    • getPseudoClass

      public String getPseudoClass()
      The pseudo-class of elements this selector applies to. This can be null.
      Returns:
      A pseudo-class name or null.
    • toString

      public String toString()
      Overrides:
      toString in class Object