org.apache.myfaces.trinidadinternal.image.xml.ImageProviderRequestUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trinidad-impl Show documentation
Show all versions of trinidad-impl Show documentation
Private implementation of the Apache MyFaces Trinidad project
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.trinidadinternal.image.xml;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.ResourceBundle;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.apache.myfaces.trinidad.util.ArrayMap;
import org.apache.myfaces.trinidadinternal.share.xml.ParseContextImpl;
import org.apache.myfaces.trinidadinternal.share.xml.ParserFactory;
import org.apache.myfaces.trinidadinternal.share.xml.ParserManager;
import org.apache.myfaces.trinidadinternal.share.xml.TreeBuilder;
import org.apache.myfaces.trinidadinternal.share.xml.XMLProvider;
import org.apache.myfaces.trinidadinternal.image.ImageConstants;
import org.apache.myfaces.trinidadinternal.image.ImageContext;
import org.apache.myfaces.trinidadinternal.image.ImageProviderRequest;
import org.apache.myfaces.trinidadinternal.image.ImageType;
import org.apache.myfaces.trinidadinternal.image.util.MapArea;
import org.apache.myfaces.trinidadinternal.image.xml.encode.XMLEncoder;
import org.apache.myfaces.trinidadinternal.image.xml.parse.ImageProviderRequestParserFactory;
import org.apache.myfaces.trinidadinternal.image.xml.parse.ColorParserFactory;
import org.apache.myfaces.trinidadinternal.image.xml.parse.FontParserFactory;
import org.apache.myfaces.trinidadinternal.image.xml.parse.ImageMapParserFactory;
import org.apache.myfaces.trinidadinternal.image.xml.parse.TextParserFactory;
/**
* Utility methods for parsing and encoding ImageProviderRequest XML elements.
* @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/image/xml/ImageProviderRequestUtils.java#0 $) $Date: 10-nov-2005.19:03:59 $
*/
public class ImageProviderRequestUtils
{
/**
* Creates an ImageProviderRequest from an InputSource containing a single
* image entry.
*/
public static ImageProviderRequest createImageProviderRequest(
ImageContext context,
XMLProvider provider,
InputSource source
) throws IOException, SAXException
{
return (ImageProviderRequest)_parse(context,
provider,
source,
ImageProviderRequest.class);
}
/**
* Creates an array of ImageProviderRequests from an InputSource
* containing multiple image entries.
*/
public static ImageProviderRequest[] createImageProviderRequests(
ImageContext context,
XMLProvider provider,
InputSource source
) throws IOException, SAXException
{
return (ImageProviderRequest[])_parse(context,
provider,
source,
ImageProviderRequest[].class);
}
/**
* Encodes an request based on the requested image type and
* properties. If an XMLEncoder can not be found for the
* requested ImageType, an IllegalArgumentException is thrown.
*
* @param context The image context
* @param namespaceURI The namespace URI of the root element. If null,
* no namespaceURI is written.
* @param localName The local name of the root element
* @param type The ImageType of the requested image
* @param properties The requested image properties
* @param responseProperties The response properties for the image generated
* for this request. If null, no repsonse properties are encoded.
* @param The PrintWriter to encode the request to
*/
public static void encodeImageProviderRequest(
ImageContext context,
String namespaceURI,
String localName,
ImageType type,
Map