org.w3c.css.sac.Condition Java Examples

The following examples show how to use org.w3c.css.sac.Condition. 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: Parser.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * @throws ParseException exception during the parse
 */
final public Condition hash( Condition pred ) throws ParseException {
  Token n;
  n = jj_consume_token( HASH );
  Condition d =
    conditionFactory.createIdCondition( n.image.substring( 1 ) );
  if ( pred == null ) {
    {
      if ( true ) {
        return d;
      }
    }
  } else {
    {
      if ( true ) {
        return conditionFactory.createAndCondition( pred, d );
      }
    }
  }
  throw new Error( "Missing return statement in function" );
}
 
Example #2
Source File: Parser.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * @throws ParseException exception during the parse
 */
final public Condition _class( Condition pred ) throws ParseException {
  Token n;
  Condition c;
  jj_consume_token( DOT );
  n = jj_consume_token( IDENT );
  c = conditionFactory.createClassCondition( null, n.image );
  if ( pred == null ) {
    {
      if ( true ) {
        return c;
      }
    }
  } else {
    {
      if ( true ) {
        return conditionFactory.createAndCondition( pred, c );
      }
    }
  }
  throw new Error( "Missing return statement in function" );
}
 
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: 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 #6
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 #7
Source File: CSSConditionalSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void countConditions
  ( final int[] conditionCounter, final Condition condition ) {
  if ( condition.getConditionType() == Condition.SAC_ID_CONDITION ) {
    conditionCounter[ ID_CONDITION ] += 1;
  } else if ( condition instanceof AttributeCondition ) {
    conditionCounter[ ATTR_CONDITION ] += 1;
  } else if ( condition instanceof CombinatorCondition ) {
    CombinatorCondition c = (CombinatorCondition) condition;
    countConditions( conditionCounter, c.getFirstCondition() );
    countConditions( conditionCounter, c.getSecondCondition() );
  } else {
    conditionCounter[ OTHER_CONDITION ] += 1;
  }
}
 
Example #8
Source File: AndCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the first condition.
 */
public Condition getFirstCondition() {
  return firstCondition;
}
 
Example #9
Source File: AndCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the second condition.
 */
public Condition getSecondCondition() {
  return secondCondition;
}
 
Example #10
Source File: OrCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * An integer indicating the type of <code>Condition</code>.
 */
public short getConditionType() {
  return Condition.SAC_AND_CONDITION;
}
 
Example #11
Source File: OrCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the second condition.
 */
public Condition getSecondCondition() {
  return secondCondition;
}
 
Example #12
Source File: AndCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * An integer indicating the type of <code>Condition</code>.
 */
public short getConditionType() {
  return Condition.SAC_AND_CONDITION;
}
 
Example #13
Source File: NegativeCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Condition getCondition() {
  return condition;
}
 
Example #14
Source File: CSSConditionalSelector.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the condition to be applied on the simple selector.
 */
public Condition getCondition() {
  return condition;
}
 
Example #15
Source File: FixNamespaceConditionFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public NegativeCondition createNegativeCondition( final Condition condition ) throws CSSException {
  return parent.createNegativeCondition( condition );
}
 
Example #16
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 #17
Source File: OrCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the first condition.
 */
public Condition getFirstCondition() {
  return firstCondition;
}
 
Example #18
Source File: AndCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the second condition.
 */
public Condition getSecondCondition() {
  return secondCondition;
}
 
Example #19
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 #20
Source File: NegativeCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Condition getCondition() {
  return condition;
}
 
Example #21
Source File: AndCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * An integer indicating the type of <code>Condition</code>.
 */
public short getConditionType() {
  return Condition.SAC_AND_CONDITION;
}
 
Example #22
Source File: FixNamespaceConditionFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CombinatorCondition createOrCondition( final Condition first, final Condition second ) throws CSSException {
  return parent.createOrCondition( first, second );
}
 
Example #23
Source File: AndCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the first condition.
 */
public Condition getFirstCondition() {
  return firstCondition;
}
 
Example #24
Source File: OrCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * An integer indicating the type of <code>Condition</code>.
 */
public short getConditionType() {
  return Condition.SAC_AND_CONDITION;
}
 
Example #25
Source File: OrCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the second condition.
 */
public Condition getSecondCondition() {
  return secondCondition;
}
 
Example #26
Source File: OrCSSCondition.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns the first condition.
 */
public Condition getFirstCondition() {
  return firstCondition;
}
 
Example #27
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 #28
Source File: FixNamespaceConditionFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Condition createOnlyTypeCondition()
  throws CSSException {
  return parent.createOnlyTypeCondition();
}
 
Example #29
Source File: FixNamespaceConditionFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Condition createOnlyChildCondition()
  throws CSSException {
  return parent.createOnlyChildCondition();
}
 
Example #30
Source File: FixNamespaceConditionFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public NegativeCondition createNegativeCondition( final Condition condition )
  throws CSSException {
  return parent.createNegativeCondition( condition );
}