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�
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSelector.TypeTypes of elements. -
Field Summary
Fields Modifier and Type Field Description StringclazzIf the selector specify a class.StringidIf the selector specify an identifier.StringpseudoClassIf the selector also specify a pseudo class.Selector.TypetypeThe kind of element this matcher applies to. -
Constructor Summary
Constructors Constructor Description Selector(String type)Utility constructor that assign the correct type to the selector from a string.Selector(Selector other)New selector, copy of another.Selector(Selector.Type type)New selector for a given type of element.Selector(Selector.Type type, String identifier, String clazz)New selector for a given type of element. -
Method Summary
Modifier and Type Method Description StringgetClazz()The class of elements this selector applies to.StringgetId()The identifier of the element this selector uniquely applies to.StringgetPseudoClass()The pseudo-class of elements this selector applies to.Selector.TypegetType()The kind of elements this selector applies to.voidsetClass(String clazz)Specify the class of the elements this selector applies to.voidsetId(String id)Specify the identifier of the unique element this selector applies to.voidsetPseudoClass(String pseudoClass)Specify the pseudo-class of the elements this selector applies to.StringtoString()
-
Field Details
-
type
The kind of element this matcher applies to. -
id
If the selector specify an identifier. -
clazz
If the selector specify a class. -
pseudoClass
If the selector also specify a pseudo class.
-
-
Constructor Details
-
Selector
New selector for a given type of element.- Parameters:
type- The element type of this selector.
-
Selector
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
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
New selector, copy of another.- Parameters:
other- The other selector.
-
-
Method Details
-
setId
Specify the identifier of the unique element this selector applies to.- Parameters:
id- A string that identifies an element of the graph.
-
setClass
Specify the class of the elements this selector applies to.- Parameters:
clazz- A string that matches all elements of a given class.
-
setPseudoClass
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
The kind of elements this selector applies to.- Returns:
- An element type.
-
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
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
The pseudo-class of elements this selector applies to. This can be null.- Returns:
- A pseudo-class name or null.
-
toString
-