public interface IlvCSSSelector
*
is usually also called the universal selector)
followed immediately by zero or more attribute selectors, class selectors,
ID selectors, or pseudo-classes, in any order. The simple selector matches
if all of its components match.
For instance, the CSS rule
node.activity[workload==5]:touched { x: 100; y: 200; }contains the simple selector
node.activity[workload==5]:touched
which has the type selector node
,
the class selector .activity
,
the attribute selector [workload==5]
and the pseudo class selector :touched
.
The CSS rule
#node88:touched { x: 100; y: 200; }contains the simple selector
#node88:touched
, which is
synonymous to *#node88:touched
,
hence it has the type selector *
,
the id selector #node88
,
and the pseudo class selector :touched
.
The full selector of a rule may contain multiple simple selectors, for instance the selector of the rule
#graph88 < node { ... }contains the two simple selectors
#graph88
and node
which matches all objects of type "node" that are children of the object
with id "graph88". The transition between both simple selectors is the
operator "<" which has the meaning is child in the CSS
element hierarchy.IlvCSSRule
Modifier and Type | Field and Description |
---|---|
static int |
BROTHER
Transition type:
The object matching this selector must preceeded immediately by
the sibling object matching the previous selector.
|
static int |
CHILD
Transition type:
The object matching this selector must be a child
of the object matching the previous selector.
|
static int |
DESCENDANT
Transition type:
The object matching this selector must be a descendant
of the object matching the previous selector.
|
Modifier and Type | Method and Description |
---|---|
boolean |
deepEquals(Object obj)
Returns
true if this simple selector is equal to the input
simple selector. |
int |
deepHashCode()
Returns a hash code of this simple selector that is compatible with
deepEquals(Object) . |
IlvCSSAttributeSelector[] |
getAttributeSelectors()
Returns the attribute selectors of the simple selector.
|
String[] |
getClasses()
Returns the CSS class selectors of the simple selector.
|
URL |
getDocumentPath()
Returns the URL of the CSS document that contains the simple selector.
|
String |
getID()
Returns the ID selector of the simple selector.
|
int |
getLineNumber()
Returns the line number of the simple selector in the CSS document
that contains the selector.
|
int |
getPreviousTransition()
Returns the transition type with the previous simple selector.
|
String[] |
getPseudoClasses()
Returns the pseudo-class selectors of the simple selector.
|
String |
getType()
Returns the type selector of the simple selector.
|
void |
printCSS(PrintWriter out,
int indent)
Prints the simple selector using CSS syntax.
|
static final int DESCENDANT
sel1 sel2
getPreviousTransition()
,
Constant Field Valuesstatic final int CHILD
sel1 < sel2
getPreviousTransition()
,
Constant Field Valuesstatic final int BROTHER
sel1 + sel2
getPreviousTransition()
,
Constant Field Valuesint getPreviousTransition()
Example: if the full selector is #graph88 < node
and this selector is the node
part of the full selector,
then the previous transition is "<".
Possible return values are:
DESCENDANT
, BROTHER
and CHILD
.
If this simple selector is the first selector of the full selector, the previous transition can be ignored.
String getType()
null
if no type is defined for this selector,
which is semantically equivalent to the universal selector type, i.e.,
it matches all types.String getID()
null
if no ID is defined in this selector.String[] getClasses()
String[] getPseudoClasses()
IlvCSSAttributeSelector[] getAttributeSelectors()
int getLineNumber()
-1
if the selector is not originated from parsing
a source file.URL getDocumentPath()
null
if the selector is not originated from parsing
a source file.void printCSS(PrintWriter out, int indent)
out
- The output print writer.indent
- The indentation level.boolean deepEquals(Object obj)
true
if this simple selector is equal to the input
simple selector. This compares the type, id, class, pseudo-class and
attribute selectors, but ignores the line number or the document path.int deepHashCode()
deepEquals(Object)
.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.