Package limelight.styles.compiling

Source Code of limelight.styles.compiling.RealStyleAttributeCompilerFactory

//- Copyright © 2008-2011 8th Light, Inc. All Rights Reserved.
//- Limelight and all included source files are distributed under terms of the MIT License.

package limelight.styles.compiling;

import limelight.Context;
import limelight.LimelightException;
import limelight.styles.abstrstyling.*;
import limelight.styles.abstrstyling.StringValue;
import limelight.styles.values.SimpleIntegerValue;

public class RealStyleAttributeCompilerFactory implements StyleAttributeCompilerFactory
{
  public static void install()
  {
    if(Context.instance().styleAttributeCompilerFactory == null)
      Context.instance().styleAttributeCompilerFactory = new RealStyleAttributeCompilerFactory();
  }

  public StyleCompiler compiler(String type, String name)
  {
    StyleCompiler result = null;

    if("string".equals(type))
      result = new StringAttributeCompiler();
    else if("integer".equals(type))
      result = new IntegerAttributeCompiler();
    else if("pixels".equals(type))
      result = new PixelsAttributeCompiler();
    else if("color".equals(type))
      result = new ColorAttributeCompiler();
    else if("on/off".equals(type))
      result = new OnOffAttributeCompiler();
    else if("percentage".equals(type))
      result = new PercentageAttributeCompiler();
    else if("dimension".equals(type))
      result = new DimensionAttributeCompiler();
    else if("noneable simple dimension".equals(type))
      result = new NoneableAttributeCompiler<DimensionValue>(new SimpleDimensionAttributeCompiler());
    else if("degrees".equals(type))
      result = new DegreesAttributeCompiler();
    else if("fill strategy".equals(type))
      result = new FillStrategyAttributeCompiler();
    else if("font style".equals(type))
      result = new FontStyleAttributeCompiler();
    else if("horizontal alignment".equals(type))
      result = new HorizontalAlignmentAttributeCompiler();
    else if("vertical alignment".equals(type))
      result = new VerticalAlignmentAttributeCompiler();
    else if("noneable integer".equals(type))
      result = new NoneableAttributeCompiler<SimpleIntegerValue>(new IntegerAttributeCompiler());
    else if("noneable string".equals(type))
      result = new NoneableAttributeCompiler<StringValue>(new StringAttributeCompiler());
    else if("x-coordinate".equals(type))
      result = new XCoordinateAttributeCompiler();
    else if("y-coordinate".equals(type))
      result = new YCoordinateAttributeCompiler();
    else if("cursor".equals(type))
      result = new CursorAttributeCompiler();
    else
      throw new LimelightException("Unknown StyleAttributeCompiler named " + type);

    result.setName(name);
    result.type = type;
    return result;
  }
}
TOP

Related Classes of limelight.styles.compiling.RealStyleAttributeCompilerFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.