org.graphstream.ui.graphicGraph.stylesheet
Class Selector

java.lang.Object
  extended by 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
static class Selector.Type
          Types of elements.
 
Field Summary
 String clazz
          If the selector specify a class.
 String id
          If the selector specify an identifier.
 String pseudoClass
          If the selector also specify a pseudo class.
 Selector.Type type
          The kind of element this matcher applies to.
 
Constructor Summary
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.
Selector(Selector other)
          New selector, copy of another.
Selector(String type)
          Utility constructor that assign the correct type to the selector from a string.
 
Method Summary
 String getClazz()
          The class of elements this selector applies to.
 String getId()
          The identifier of the element this selector uniquely applies to.
 String getPseudoClass()
          The pseudo-class of elements this selector applies to.
 Selector.Type getType()
          The kind of elements this selector applies to.
 void setClass(String clazz)
          Specify the class of the elements this selector applies to.
 void setId(String id)
          Specify the identifier of the unique element this selector applies to.
 void setPseudoClass(String pseudoClass)
          Specify the pseudo-class of the elements this selector applies to.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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 Detail

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 Detail

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


Copyright © 2011. All Rights Reserved.