public abstract class Selector extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
identifier |
protected static Map |
selectors |
Modifier | Constructor and Description |
---|---|
protected |
Selector(String identifier) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCategory(String category,
CSSStyle defaultStyle)
Declare a new category responding to this selector
|
boolean |
applyStyleForEdge(Object obj,
AttributesReader areader)
Apply the style to an edge using an attributesReder for a category id or null if the category doesn't exist.
|
boolean |
applyStyleForNode(Object obj,
AttributesReader areader)
Apply the style to a node using an attributesReder for a category id or null if the category doesn't exist.
|
Collection |
categories()
A collection of all the categories this selector respond to.
|
void |
flush()
By default this does nothing but subclasses of Selector could use this function to free the cache of category<=>object.
|
String |
getCategory(Object obj)
Return the category corresponding to the object obj or null if it doesn't respond to any.
|
protected abstract String |
getCategoryForEdge(Object obj)
Return the category corresponding to the object obj or null if it doesn't respond to any.
|
protected abstract String |
getCategoryForNode(Object obj)
Return the category corresponding to the object obj or null if it doesn't respond to any.
|
String |
getIdentifer()
Return the identifier for this selector
|
static Selector |
getNewSelector(String identifier)
return a new selector corresponding to an identifier
|
CSSStyle |
getStyle(Object obj)
Get the style for an object using getCategory to determine its category or null if the category doesn't exist or has no category
If possible call getStyleForNode or getStyleForEdge, when you know the type of object
|
CSSStyle |
getStyle(String category)
Get the style for a category id or null if the category doesn't exist.
|
CSSStyle |
getStyleForEdge(Object obj)
Get the style for an edge using getCategory to determine its category or null if the category doesn't exist or has no category
|
CSSStyle |
getStyleForNode(Object obj)
Get the style for a node using getCategory to determine its category or null if the category doesn't exist or has no category
|
protected CSSStyle |
missingCategory(String category)
Called when the category doesn't exist in the map.
|
protected boolean |
missingCategory(String category,
AttributesReader areader)
Called when the category doesn't exist in the map.
|
protected boolean |
missingCategory(String category,
CSSStyle style)
Called when the category doesn't exist in the map.
|
static void |
registerSelector(String identifier,
Class cla)
Register your selector to enable parsing it.
|
abstract void |
resetDefaultStyle()
Reset the categories to their default values.
|
boolean |
respondToEdges()
Indicates if the Selector contains edges styles.
|
boolean |
respondToNodes()
Indicates if the Selector contains nodes styles.
|
boolean |
setStyle(String category,
CSSStyle style)
Set the style for a category id.
|
String |
toCSS() |
String |
toString() |
String |
toString(String category) |
protected Selector(String identifier)
public static void registerSelector(String identifier, Class cla)
identifier
- the identifier of the selectorcla
- the selector's classpublic static Selector getNewSelector(String identifier)
id
- the identifierpublic final String getIdentifer()
public final Collection categories()
public CSSStyle getStyle(String category)
category
- the id of the categorypublic CSSStyle getStyle(Object obj)
obj
- public final CSSStyle getStyleForNode(Object obj)
obj
- a nodepublic final CSSStyle getStyleForEdge(Object obj)
obj
- an edgepublic final boolean setStyle(String category, CSSStyle style)
category
- the id of the categorypublic final boolean applyStyleForNode(Object obj, AttributesReader areader)
obj
- a nodepublic final boolean applyStyleForEdge(Object obj, AttributesReader areader)
obj
- an edgeprotected void addCategory(String category, CSSStyle defaultStyle)
category
- the identifier for this categorydefaultStyle
- its default stylepublic abstract void resetDefaultStyle()
protected CSSStyle missingCategory(String category)
category
- protected boolean missingCategory(String category, AttributesReader areader)
category
- areader
- the areader to apply the corresponding style on.protected boolean missingCategory(String category, CSSStyle style)
category
- style
- the style to save for this categorypublic boolean respondToNodes()
public boolean respondToEdges()
public final String getCategory(Object obj)
obj
- protected abstract String getCategoryForNode(Object obj)
obj
- protected abstract String getCategoryForEdge(Object obj)
obj
- public void flush()
public final String toCSS()
Copyright © 2005–2020. All rights reserved.