org.w3c.css.sac.ConditionalSelector Java Examples

The following examples show how to use org.w3c.css.sac.ConditionalSelector. 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
private boolean isPseudoElementRule( final CSSStyleRule rule ) {
  final CSSSelector selector = rule.getSelector();
  if ( selector == null ) {
    return false;
  }

  if ( selector.getSelectorType() != Selector.SAC_CONDITIONAL_SELECTOR ) {
    return false;
  }

  final ConditionalSelector cs = (ConditionalSelector) selector;
  final Condition condition = cs.getCondition();
  if ( condition.getConditionType() != Condition.SAC_PSEUDO_CLASS_CONDITION ) {
    return false;
  }
  return true;
}
 
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 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 #3
Source File: SimpleStyleRuleMatcher.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private boolean isPseudoElementRule( final ElementStyleRule rule ) {
  final List<CSSSelector> selectorList = rule.getSelectorList();
  for ( int i = 0; i < selectorList.size(); i += 1 ) {
    final CSSSelector selector = selectorList.get( i );
    if ( selector == null ) {
      continue;
    }

    if ( selector.getSelectorType() != Selector.SAC_CONDITIONAL_SELECTOR ) {
      continue;
    }

    final ConditionalSelector cs = (ConditionalSelector) selector;
    final Condition condition = cs.getCondition();
    if ( condition.getConditionType() != Condition.SAC_PSEUDO_CLASS_CONDITION ) {
      continue;
    }
    return true;
  }
  return false;
}
 
Example #4
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;
}
 
Example #5
Source File: CSSSelectorFactory.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public ConditionalSelector createConditionalSelector(SimpleSelector selector, Condition condition)
		throws CSSException {
	return new CSSConditionalSelector(selector, condition);
}
 
Example #6
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ConditionalSelector createConditionalSelector( final SimpleSelector selector,
                                                      final Condition condition )
  throws CSSException {
  return parent.createConditionalSelector( selector, condition );
}
 
Example #7
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ConditionalSelector createConditionalSelector( final SimpleSelector selector, final Condition condition )
  throws CSSException {
  return parent.createConditionalSelector( selector, condition );
}
 
Example #8
Source File: SelectorFactoryImpl.java    From pentaho-reporting with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Creates a conditional selector.
 *
 * @param selector  a selector.
 * @param condition a condition
 * @return the conditional selector.
 * @throws CSSException If this selector is not supported.
 */
public ConditionalSelector createConditionalSelector( SimpleSelector selector,
                                                      Condition condition )
  throws CSSException {
  return new ConditionalSelectorImpl( selector, condition );
}
 
Example #9
Source File: CSSSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Creates a conditional selector.
 *
 * @param selector  a selector.
 * @param condition a condition
 * @return the conditional selector.
 * @throws CSSException If this selector is not supported.
 */
public ConditionalSelector createConditionalSelector( SimpleSelector selector,
                                                      Condition condition )
  throws CSSException {
  return new CSSConditionalSelector( selector, condition );
}
 
Example #10
Source File: CSSSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Creates a conditional selector.
 *
 * @param selector
 *          a selector.
 * @param condition
 *          a condition
 * @return the conditional selector.
 * @throws CSSException
 *           If this selector is not supported.
 */
public ConditionalSelector createConditionalSelector( final SimpleSelector selector, final Condition condition )
  throws CSSException {
  return new CSSConditionalSelector( selector, condition );
}