org.w3c.css.sac.SACMediaList Java Examples

The following examples show how to use org.w3c.css.sac.SACMediaList. 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: StyleSheetHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Receive notification of a import statement in the style sheet.
 *
 * @param uri                 The URI of the imported style sheet.
 * @param media               The intended destination media for style information.
 * @param defaultNamespaceURI The default namespace URI for the imported style sheet.
 * @throws CSSException Any CSS exception, possibly wrapping another exception.
 */
public void importStyle( String uri,
                         SACMediaList media,
                         String defaultNamespaceURI )
  throws CSSException {
  //  instantiate a new parser and parse the stylesheet.
  final ResourceManager manager = getResourceManager();
  if ( manager == null ) {
    // there is no source set, so we have no resource manager, and thus
    // we do no parsing.
    //
    // This should only be the case if we parse style-values; in that case
    // include-statement are not supported anyway.
    return;
  }
  try {
    CSSParserContext.getContext().setDefaultNamespace( defaultNamespaceURI );
    final ResourceKey key;
    if ( source == null ) {
      key = manager.createKey( uri );
    } else {
      key = manager.deriveKey( source, uri );
    }

    final Resource res = manager.create( key, source, StyleSheet.class );
    if ( res == null ) {
      return;
    }
    final StyleSheet styleSheet = (StyleSheet) res.getResource();
    this.styleSheet.addStyleSheet( styleSheet );
  } catch ( ResourceException e ) {
    // ignore ..
  } finally {
    CSSParserContext.getContext().setStyleKeyRegistry( styleKeyRegistry );
    CSSParserContext.getContext().setSource( getSource() );
    CSSParserContext.getContext().setNamespaces( namespaces );
    CSSParserContext.getContext().setDefaultNamespace( defaultNamespace );
  }
}
 
Example #2
Source File: StyleSheetHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Receive notification of the end of a media statement.
 *
 * @param media The intended destination media for style information.
 * @throws CSSException Any CSS exception, possibly wrapping another exception.
 */
public void endMedia( SACMediaList media )
  throws CSSException {
  parentRules.pop();
  styleSheet.addRule( styleRule );
  styleRule = null;
}
 
Example #3
Source File: CSSDocumentHandler.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void endMedia(SACMediaList arg0) throws CSSException {
	// TODO Auto-generated method stub

}
 
Example #4
Source File: CSSDocumentHandler.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void importStyle(String arg0, SACMediaList arg1, String arg2) throws CSSException {
	// TODO Auto-generated method stub

}
 
Example #5
Source File: CSSDocumentHandler.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void startMedia(SACMediaList arg0) throws CSSException {
	// TODO Auto-generated method stub

}
 
Example #6
Source File: CSSEngine.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <b>SAC</b>: Implements {@link
 * DocumentHandler#importStyle(String,SACMediaList,String)}.
 */
public void importStyle( String uri, SACMediaList media,
		String defaultNamespaceURI ) throws CSSException
{
	throw new InternalError( );
}
 
Example #7
Source File: CSSEngine.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <b>SAC</b>: Implements {@link
 * DocumentHandler#startMedia(SACMediaList)}.
 */
public void startMedia( SACMediaList media ) throws CSSException
{
	throw new InternalError( );
}
 
Example #8
Source File: CSSEngine.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * <b>SAC</b>: Implements {@link
 * DocumentHandler#endMedia(SACMediaList)}.
 */
public void endMedia( SACMediaList media ) throws CSSException
{
	throw new InternalError( );
}
 
Example #9
Source File: CssParser.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void importStyle( String uri, SACMediaList media,
		String defaultNamespaceURI ) throws CSSException
{
	unsupportedRule( uri );
}
 
Example #10
Source File: CssParser.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void startMedia( SACMediaList media ) throws CSSException
{
	unsupportedRule( media.toString( ) );
}
 
Example #11
Source File: StyleSheetHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Receive notification of the beginning of a media statement.
 * <p/>
 * The Parser will invoke this method at the beginning of every media statement in the style sheet. there will be a
 * corresponding endMedia() event for every startElement() event.
 *
 * @param media The intended destination media for style information.
 * @throws CSSException Any CSS exception, possibly wrapping another exception.
 */
public void startMedia( SACMediaList media )
  throws CSSException {
  // ignore for now ..
  styleRule = new CSSMediaRule( styleSheet, getParentRule() );
  parentRules.push( styleRule );

}
 
Example #12
Source File: CssParser.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
public void endMedia( SACMediaList media ) throws CSSException
{

}