Java Code Examples for org.w3c.css.sac.ConditionalSelector#getSimpleSelector()

The following examples show how to use org.w3c.css.sac.ConditionalSelector#getSimpleSelector() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleStyleRuleMatcher.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public boolean isMatchingPseudoElement( final LayoutElement element, final String pseudo ) {
  for ( int i = 0; i < activePseudoStyleRules.length; i++ ) {
    final CSSStyleRule activeStyleRule = activePseudoStyleRules[ i ];

    final CSSSelector selector = activeStyleRule.getSelector();
    final ConditionalSelector cs = (ConditionalSelector) selector;
    final Condition condition = cs.getCondition();

    final AttributeCondition ac = (AttributeCondition) condition;
    if ( ObjectUtilities.equal( ac.getValue(), pseudo ) == false ) {
      continue;
    }

    final SimpleSelector simpleSelector = cs.getSimpleSelector();
    if ( isMatch( element, simpleSelector ) ) {
      return true;
    }
  }
  return false;
}
 
Example 2
Source File: SimpleStyleRuleMatcher.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public boolean isMatchingPseudoElement( final ReportElement element, final String pseudo ) {
  for ( int i = 0; i < activePseudoStyleRules.length; i++ ) {
    final ElementStyleRule activeStyleRule = activePseudoStyleRules[i];
    final List<CSSSelector> selectorList = activeStyleRule.getSelectorList();
    for ( int x = 0; x < selectorList.size(); x += 1 ) {
      final CSSSelector selector = selectorList.get( x );
      if ( selector instanceof ConditionalSelector == false ) {
        continue;
      }

      final ConditionalSelector cs = (ConditionalSelector) selector;
      final Condition condition = cs.getCondition();

      final AttributeCondition ac = (AttributeCondition) condition;
      if ( ObjectUtilities.equal( ac.getValue(), pseudo ) == false ) {
        continue;
      }

      final SimpleSelector simpleSelector = cs.getSimpleSelector();
      if ( isMatch( element, simpleSelector ) ) {
        return true;
      }
    }
  }
  return false;
}