org.w3c.css.sac.AttributeCondition Java Examples
The following examples show how to use
org.w3c.css.sac.AttributeCondition.
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 |
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 |
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: ConditionFactoryImpl.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates a "begin hyphen" attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified <code>true</code> if the attribute must be specified in the document. * @param value the value of this attribute. * @return A "begin hyphen" attribute condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createBeginHyphenAttributeCondition( String localName, String namespaceURI, boolean specified, String value ) throws CSSException { if ( ( namespaceURI != null ) || specified ) { throw new CSSException( CSSException.SAC_NOT_SUPPORTED_ERR ); } else { return new BeginHyphenAttributeConditionImpl( localName, value ); } }
Example #4
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createPseudoClassCondition( final String namespaceURI, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createPseudoClassCondition( namespaceURI, value ); } else { final String[] ns = StyleSheetParserUtil.parseNamespaceIdent( value ); return parent.createPseudoClassCondition( ns[ 0 ], ns[ 1 ] ); } }
Example #5
Source File: CSSConditionalSelector.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
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 #6
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createBeginHyphenAttributeCondition( final String localName, final String namespaceURI, final boolean specified, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createBeginHyphenAttributeCondition ( localName, namespaceURI, specified, value ); } else { final String[] ns = StyleSheetParserUtil.parseNamespaceIdent( localName ); return parent.createBeginHyphenAttributeCondition( ns[ 1 ], ns[ 0 ], specified, value ); } }
Example #7
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createOneOfAttributeCondition( final String localName, final String namespaceURI, final boolean specified, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createOneOfAttributeCondition ( localName, namespaceURI, specified, value ); } else { final String[] ns = StyleSheetParserUtil.parseNamespaceIdent( localName ); return parent.createOneOfAttributeCondition( ns[ 1 ], ns[ 0 ], specified, value ); } }
Example #8
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createAttributeCondition( final String localName, final String namespaceURI, final boolean specified, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createAttributeCondition( localName, namespaceURI, specified, value ); } else { styleSheetParserUtil = StyleSheetParserUtil.getInstance(); final String[] ns = styleSheetParserUtil.parseNamespaceIdent( localName, namespaceCollection ); return parent.createAttributeCondition( ns[1], ns[0], specified, value ); } }
Example #9
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createAttributeCondition( final String localName, final String namespaceURI, final boolean specified, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createAttributeCondition ( localName, namespaceURI, specified, value ); } else { final String[] ns = StyleSheetParserUtil.parseNamespaceIdent( localName ); return parent.createAttributeCondition( ns[ 1 ], ns[ 0 ], specified, value ); } }
Example #10
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createOneOfAttributeCondition( final String localName, final String namespaceURI, final boolean specified, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createOneOfAttributeCondition( localName, namespaceURI, specified, value ); } else { final String[] ns = styleSheetParserUtil.parseNamespaceIdent( localName, namespaceCollection ); return parent.createOneOfAttributeCondition( ns[1], ns[0], specified, value ); } }
Example #11
Source File: ConditionFactoryImpl.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates a "one of" attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified <code>true</code> if the attribute must be specified in the document. * @param value the value of this attribute. * @return A "one of" attribute condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createOneOfAttributeCondition( String localName, String namespaceURI, boolean specified, String value ) throws CSSException { if ( ( namespaceURI != null ) || specified ) { throw new CSSException( CSSException.SAC_NOT_SUPPORTED_ERR ); } else { return new OneOfAttributeConditionImpl( localName, value ); } }
Example #12
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createBeginHyphenAttributeCondition( final String localName, final String namespaceURI, final boolean specified, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createBeginHyphenAttributeCondition( localName, namespaceURI, specified, value ); } else { final String[] ns = styleSheetParserUtil.parseNamespaceIdent( localName, namespaceCollection ); return parent.createBeginHyphenAttributeCondition( ns[1], ns[0], specified, value ); } }
Example #13
Source File: ConditionFactoryImpl.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * creates an attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified <code>true</code> if the attribute must be specified in the document. * @param value the value of this attribute. * @return An attribute condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createAttributeCondition( String localName, String namespaceURI, boolean specified, String value ) throws CSSException { if ( ( namespaceURI != null ) || specified ) { throw new CSSException( CSSException.SAC_NOT_SUPPORTED_ERR ); } else { return new AttributeConditionImpl( localName, value ); } }
Example #14
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeCondition createPseudoClassCondition( final String namespaceURI, final String value ) throws CSSException { if ( namespaceURI != null ) { return parent.createPseudoClassCondition( namespaceURI, value ); } else { final String[] ns = styleSheetParserUtil.parseNamespaceIdent( value, namespaceCollection ); return parent.createPseudoClassCondition( ns[0], ns[1] ); } }
Example #15
Source File: SimpleStyleRuleMatcher.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private Object queryAttribute( final ReportElement node, final AttributeCondition ac ) { final String namespaceURI = ac.getNamespaceURI(); final Object attr; if ( namespaceURI == null ) { attr = node.getFirstAttribute( ac.getLocalName() ); } else { attr = node.getAttribute( namespaceURI, ac.getLocalName() ); } return attr; }
Example #16
Source File: CSSConditionalSelector.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
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 ) { final CombinatorCondition c = (CombinatorCondition) condition; countConditions( conditionCounter, c.getFirstCondition() ); countConditions( conditionCounter, c.getSecondCondition() ); } else { conditionCounter[OTHER_CONDITION] += 1; } }
Example #17
Source File: CSSConditionFactory.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public AttributeCondition createAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new CSSAttributeCondition(localName, namespaceURI, specified, value); }
Example #18
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public AttributeCondition createIdCondition( final String value ) throws CSSException { return parent.createIdCondition( value ); }
Example #19
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public AttributeCondition createClassCondition( final String namespaceURI, final String value ) throws CSSException { return parent.createClassCondition( namespaceURI, value ); }
Example #20
Source File: CSSConditionFactory.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public AttributeCondition createPseudoClassCondition(String arg0, String arg1) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
Example #21
Source File: CSSConditionFactory.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public AttributeCondition createClassCondition(String namespaceURI, String value) throws CSSException { return new CSSClassCondition(null, "class", value); }
Example #22
Source File: CSSConditionFactory.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public AttributeCondition createBeginHyphenAttributeCondition(String arg0, String arg1, boolean arg2, String arg3) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
Example #23
Source File: CSSConditionFactory.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public AttributeCondition createIdCondition(String arg0) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
Example #24
Source File: CSSConditionFactory.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public AttributeCondition createOneOfAttributeCondition(String arg0, String arg1, boolean arg2, String arg3) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
Example #25
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public AttributeCondition createIdCondition( final String value ) throws CSSException { return parent.createIdCondition( value ); }
Example #26
Source File: FixNamespaceConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public AttributeCondition createClassCondition( final String namespaceURI, final String value ) throws CSSException { return parent.createClassCondition( namespaceURI, value ); }
Example #27
Source File: CSSConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 3 votes |
/** * Creates a "begin hyphen" attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified <code>true</code> if the attribute must be specified in the document. * @param value the value of this attribute. * @return A "begin hyphen" attribute condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createBeginHyphenAttributeCondition( String localName, String namespaceURI, boolean specified, String value ) throws CSSException { return new BeginHyphenAttributeCSSCondition( localName, namespaceURI, specified, value ); }
Example #28
Source File: CSSConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 3 votes |
/** * Creates an attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified <code>true</code> if the attribute must be specified in the document. * @param value the value of this attribute. * @return An attribute condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createAttributeCondition( String localName, String namespaceURI, boolean specified, String value ) throws CSSException { return new AttributeCSSCondition( localName, namespaceURI, specified, value ); }
Example #29
Source File: CSSConditionFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 3 votes |
/** * Creates a "one of" attribute condition * * @param localName the localName of the attribute * @param namespaceURI the namespace URI of the attribute * @param specified <code>true</code> if the attribute must be specified in the document. * @param value the value of this attribute. * @return A "one of" attribute condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createOneOfAttributeCondition( String localName, String namespaceURI, boolean specified, String value ) throws CSSException { return new OneOfAttributeCSSCondition( localName, namespaceURI, specified, value ); }
Example #30
Source File: ConditionFactoryImpl.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 2 votes |
/** * Creates a pseudo class condition * * @param namespaceURI the namespace URI of the attribute * @param value the name of the pseudo class * @return A pseudo class condition * @throws CSSException if this exception is not supported. */ public AttributeCondition createPseudoClassCondition( String namespaceURI, String value ) throws CSSException { return new PseudoClassConditionImpl( value ); }