|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.ui.graphicGraph.stylesheet.StyleSheet
public class StyleSheet
Implementation of the style sheets that can be stored in the graphic graph.
Nested Class Summary | |
---|---|
class |
StyleSheet.NameSpace
A name space is a tuple (default rule, id rule set, class rule set). |
Field Summary | |
---|---|
Rule |
defaultRule
The top-level default rule. |
StyleSheet.NameSpace |
edgeRules
The default, id and class rules for edges. |
StyleSheet.NameSpace |
graphRules
The default, id and class rules for graphs. |
ArrayList<StyleSheetListener> |
listeners
Set of listeners. |
StyleSheet.NameSpace |
nodeRules
The default, id and class rules for nodes. |
StyleSheet.NameSpace |
spriteRules
The default, id and class rules for sprites. |
Constructor Summary | |
---|---|
StyleSheet()
New style sheet initialised to defaults. |
Method Summary | |
---|---|
void |
addListener(StyleSheetListener listener)
Add a listener for style events. |
void |
addRule(Rule newRule)
Add a new rule with its style. |
void |
clear()
Clear all specific rules and initialise the default rules. |
Rule |
getDefaultEdgeRule()
The default rule for edges. |
Style |
getDefaultEdgeStyle()
The default style for edges. |
Rule |
getDefaultGraphRule()
The default rule for graphs. |
Style |
getDefaultGraphStyle()
The default style for graphs. |
Rule |
getDefaultNodeRule()
The default rule for nodes. |
Style |
getDefaultNodeStyle()
The default style for nodes. |
Rule |
getDefaultSpriteRule()
The default rule for sprites. |
Style |
getDefaultSpriteStyle()
The default style for sprites. |
StyleSheet.NameSpace |
getEdgeStyleNameSpace()
All the rules (default, specific and class) that apply to edges. |
StyleSheet.NameSpace |
getGraphStyleNameSpace()
All the rules (default, specific and class) that apply to graphs. |
StyleSheet.NameSpace |
getNodeStyleNameSpace()
All the rules (default, specific and class) that apply to nodes. |
ArrayList<Rule> |
getRulesFor(Element element)
Get the rules that match a given element. |
StyleSheet.NameSpace |
getSpriteStyleNameSpace()
All the rules (default, specific and class) that apply to sprites. |
String |
getStyleGroupIdFor(Element element,
ArrayList<Rule> rules)
Compute the name of the style group and element will pertain to knowing its styling rules. |
void |
load(String styleSheetValue)
Load a style sheet from an attribute value, the value can either be the contents of the whole style sheet, or begin by "url". |
void |
parseFromFile(String fileName)
Parse a style sheet from a file. |
void |
parseFromString(String styleSheet)
Parse a style sheet from a string. |
void |
parseFromURL(String url)
Parse a style sheet from an URL. |
void |
parseStyleFromString(Selector select,
String styleString)
Parse only one style, create a rule with the given selector, and add this rule. |
void |
removeListener(StyleSheetListener listener)
Remove a previously registered listener. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Rule defaultRule
public StyleSheet.NameSpace graphRules
public StyleSheet.NameSpace nodeRules
public StyleSheet.NameSpace edgeRules
public StyleSheet.NameSpace spriteRules
public ArrayList<StyleSheetListener> listeners
Constructor Detail |
---|
public StyleSheet()
Method Detail |
---|
public Rule getDefaultGraphRule()
public Rule getDefaultNodeRule()
public Rule getDefaultEdgeRule()
public Rule getDefaultSpriteRule()
public Style getDefaultGraphStyle()
public Style getDefaultNodeStyle()
public Style getDefaultEdgeStyle()
public Style getDefaultSpriteStyle()
public StyleSheet.NameSpace getGraphStyleNameSpace()
public StyleSheet.NameSpace getNodeStyleNameSpace()
public StyleSheet.NameSpace getEdgeStyleNameSpace()
public StyleSheet.NameSpace getSpriteStyleNameSpace()
public ArrayList<Rule> getRulesFor(Element element)
element
- The element a rules are searched for.
public String getStyleGroupIdFor(Element element, ArrayList<Rule> rules)
element
- The element.rules
- The styling rules.
getRulesFor(Element)
public void addListener(StyleSheetListener listener)
listener
- The new listener.public void removeListener(StyleSheetListener listener)
listener
- The listener to remove.public void clear()
public void parseFromFile(String fileName) throws IOException
fileName
- Name of the file containing the style sheet.
IOException
- For any kind of I/O error or parse error.public void parseFromURL(String url) throws IOException
url
- Name of the file containing the style sheet.
IOException
- For any kind of I/O error or parse error.public void parseFromString(String styleSheet) throws IOException
styleSheet
- The string containing the whole style sheet.
IOException
- For any kind of I/O error or parse error.public void parseStyleFromString(Selector select, String styleString) throws IOException
select
- The elements for which this style must apply.styleString
- The style string to parse.
IOException
public void load(String styleSheetValue) throws IOException
url('file:///some/path/on/the/file/system')Or
url('http://some/web/url')The loaded style sheet will be merged with the styles already present in the style sheet.
styleSheetValue
- The style sheet name of content.
IOException
- If the loading or parsing of the style sheet failed.public void addRule(Rule newRule)
newRule
- The new rule.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |