org.w3c.css.sac.SimpleSelector Java Examples

The following examples show how to use org.w3c.css.sac.SimpleSelector. 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;
}
 
Example #3
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public SiblingSelector createDirectAdjacentSelector( final short nodeType,
                                                     final Selector child,
                                                     final SimpleSelector directAdjacent )
  throws
  CSSException {
  return parent.createDirectAdjacentSelector( nodeType, child, directAdjacent );
}
 
Example #4
Source File: CSSDescendantSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CSSDescendantSelector( final SimpleSelector simpleSelector,
                              final Selector anchestorSelector,
                              final boolean childRelation ) {
  this.simpleSelector = simpleSelector;
  this.anchestorSelector = anchestorSelector;
  this.childRelation = childRelation;
}
 
Example #5
Source File: Parser.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @throws ParseException exception during the parse
 */
final public SimpleSelector element_name() throws ParseException {
  Token n;
  switch( ( jj_ntk == -1 ) ? jj_ntk() : jj_ntk ) {
    case IDENT:
      n = jj_consume_token( IDENT );
    {
      if ( true ) {
        return selectorFactory.createElementSelector( null, convertIdent( n.image ) );
      }
    }
    break;
    case NAMESPACE_IDENT:
      n = jj_consume_token( NAMESPACE_IDENT );
    {
      if ( true ) {
        return selectorFactory.createElementSelector( null, convertIdent( n.image ) );
      }
    }
    break;
    case ANY:
      jj_consume_token( ANY );
    {
      if ( true ) {
        return selectorFactory.createElementSelector( null, null );
      }
    }
    break;
    default:
      jj_la1[ 79 ] = jj_gen;
      jj_consume_token( -1 );
      throw new ParseException();
  }
  throw new Error( "Missing return statement in function" );
}
 
Example #6
Source File: SelectorFactoryImpl.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates a direct adjacent selector.
 *
 * @param child    the child selector
 * @param adjacent the direct adjacent selector
 * @return the combinator selector.
 * @throws CSSException If this selector is not supported.
 */
public SiblingSelector createDirectAdjacentSelector( short nodeType,
                                                     Selector child,
                                                     SimpleSelector directAdjacent )
  throws CSSException {
  if ( nodeType != 1 ) {
    throw new CSSException( CSSException.SAC_NOT_SUPPORTED_ERR );
  } else {
    return new DirectAdjacentSelectorImpl( child, directAdjacent );
  }
}
 
Example #7
Source File: CSSSilblingSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CSSSilblingSelector( final short nodeType,
                            final Selector selector,
                            final SimpleSelector silblingSelector ) {
  this.nodeType = nodeType;
  this.selector = selector;
  this.silblingSelector = silblingSelector;
}
 
Example #8
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SimpleSelector createAnyNodeSelector() throws CSSException {
  return parent.createAnyNodeSelector();
}
 
Example #9
Source File: ConditionalSelectorImpl.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Creates a new ConditionalSelectorImpl
 */
public ConditionalSelectorImpl( SimpleSelector simpleSelector,
                                Condition condition ) {
  this.simpleSelector = simpleSelector;
  this.condition = condition;
}
 
Example #10
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public DescendantSelector createChildSelector( final Selector parent,
                                               final SimpleSelector child )
  throws
  CSSException {
  return this.parent.createChildSelector( parent, child );
}
 
Example #11
Source File: CSSNegativeSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CSSNegativeSelector( final SimpleSelector selector ) {
  this.selector = selector;
}
 
Example #12
Source File: CSSNegativeSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the simple selector.
 */
public SimpleSelector getSimpleSelector() {
  return selector;
}
 
Example #13
Source File: CSSDescendantSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SimpleSelector getSimpleSelector() {
  return simpleSelector;
}
 
Example #14
Source File: CSSSilblingSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SimpleSelector getSiblingSelector() {
  return silblingSelector;
}
 
Example #15
Source File: CSSConditionalSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CSSConditionalSelector( final SimpleSelector simpleSelector,
                               final Condition condition ) {
  this.simpleSelector = simpleSelector;
  this.condition = condition;
}
 
Example #16
Source File: CSSConditionalSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the simple selector. <p>The simple selector can't be a <code>ConditionalSelector</code>.</p>
 */
public SimpleSelector getSimpleSelector() {
  return simpleSelector;
}
 
Example #17
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 #18
Source File: CSSConditionalSelector.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public SimpleSelector getSimpleSelector() {
	return simpleSelector;
}
 
Example #19
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SimpleSelector createRootNodeSelector() throws CSSException {
  return parent.createRootNodeSelector();
}
 
Example #20
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public NegativeSelector createNegativeSelector( final SimpleSelector selector ) throws CSSException {
  return parent.createNegativeSelector( selector );
}
 
Example #21
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public DescendantSelector createDescendantSelector( final Selector parent, final SimpleSelector descendant )
  throws CSSException {
  return this.parent.createDescendantSelector( parent, descendant );
}
 
Example #22
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public DescendantSelector createChildSelector( final Selector parent, final SimpleSelector child )
  throws CSSException {
  return this.parent.createChildSelector( parent, child );
}
 
Example #23
Source File: FixNamespaceSelectorFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SiblingSelector createDirectAdjacentSelector( final short nodeType, final Selector child,
    final SimpleSelector directAdjacent ) throws CSSException {
  return parent.createDirectAdjacentSelector( nodeType, child, directAdjacent );
}
 
Example #24
Source File: CSSNegativeSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CSSNegativeSelector( final SimpleSelector selector ) {
  this.selector = selector;
  this.cssSelector = (CSSSelector) selector;
}
 
Example #25
Source File: CSSNegativeSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the simple selector.
 */
public SimpleSelector getSimpleSelector() {
  return selector;
}
 
Example #26
Source File: CSSDescendantSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CSSDescendantSelector( final SimpleSelector simpleSelector, final Selector anchestorSelector,
    final boolean childRelation ) {
  this.simpleSelector = simpleSelector;
  this.anchestorSelector = anchestorSelector;
  this.childRelation = childRelation;
}
 
Example #27
Source File: CSSDescendantSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SimpleSelector getSimpleSelector() {
  return simpleSelector;
}
 
Example #28
Source File: CSSSilblingSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CSSSilblingSelector( final short nodeType, final Selector selector, final SimpleSelector silblingSelector ) {
  this.nodeType = nodeType;
  this.selector = selector;
  this.silblingSelector = silblingSelector;
}
 
Example #29
Source File: CSSSilblingSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SimpleSelector getSiblingSelector() {
  return silblingSelector;
}
 
Example #30
Source File: CSSConditionalSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CSSConditionalSelector( final SimpleSelector simpleSelector, final Condition condition ) {
  this.simpleSelector = simpleSelector;
  this.condition = condition;
}