Beispiel #1
0
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    BufferedImage dst = ImageUtil.createBufferedImage(src);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Radius"))) != null)
      setRadius(ImageFilterUtil.toFloatValue(o, "Radius"));
    if ((o = parameters.removeEL(KeyImpl.init("Sides"))) != null)
      setSides(ImageFilterUtil.toIntValue(o, "Sides"));
    if ((o = parameters.removeEL(KeyImpl.init("Bloom"))) != null)
      setBloom(ImageFilterUtil.toFloatValue(o, "Bloom"));
    if ((o = parameters.removeEL(KeyImpl.init("BloomThreshold"))) != null)
      setBloomThreshold(ImageFilterUtil.toFloatValue(o, "BloomThreshold"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + CollectionUtil.getKeyList(parameters, ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Radius, Sides, Bloom, BloomThreshold]");
    }

    return filter(src, dst);
  }
Beispiel #2
0
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    BufferedImage dst = ImageUtil.createBufferedImage(src);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Threshold"))) != null)
      setThreshold(ImageFilterUtil.toIntValue(o, "Threshold"));
    if ((o = parameters.removeEL(KeyImpl.init("Iterations"))) != null)
      setIterations(ImageFilterUtil.toIntValue(o, "Iterations"));
    if ((o = parameters.removeEL(KeyImpl.init("Colormap"))) != null)
      setColormap(ImageFilterUtil.toColormap(o, "Colormap"));
    if ((o = parameters.removeEL(KeyImpl.init("NewColor"))) != null)
      setNewColor(ImageFilterUtil.toColorRGB(o, "NewColor"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + CollectionUtil.getKeyList(parameters, ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Threshold, Iterations, Colormap, NewColor, BlackFunction]");
    }

    return filter(src, dst);
  }
Beispiel #3
0
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    BufferedImage dst = null; // ImageUtil.createBufferedImage(src);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Type"))) != null)
      setType(ImageFilterUtil.toString(o, "Type"));
    if ((o = parameters.removeEL(KeyImpl.init("EdgeAction"))) != null)
      setEdgeAction(ImageFilterUtil.toString(o, "EdgeAction"));
    if ((o = parameters.removeEL(KeyImpl.init("Interpolation"))) != null)
      setInterpolation(ImageFilterUtil.toString(o, "Interpolation"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + List.arrayToList(parameters.keysAsString(), ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Type, EdgeAction, Interpolation]");
    }

    return filter(src, dst);
  }
  private static Struct checkTableFill(DatabaseMetaData md, String dbName, String tableName)
      throws SQLException, PageException {
    Struct rows = new CastableStruct(tableName, Struct.TYPE_LINKED);
    ResultSet columns = md.getColumns(dbName, null, tableName, null);
    // print.o(new QueryImpl(columns,""));
    try {
      String name;
      Object nullable;
      while (columns.next()) {
        name = columns.getString("COLUMN_NAME");

        nullable = columns.getObject("IS_NULLABLE");
        rows.setEL(
            KeyImpl.init(name),
            new ColumnInfo(
                name,
                columns.getInt("DATA_TYPE"),
                columns.getString("TYPE_NAME"),
                columns.getInt("COLUMN_SIZE"),
                Caster.toBooleanValue(nullable)));
      }
    } finally {
      DBUtil.closeEL(columns);
    } // Table susid defined for cfc susid does not exist.

    return rows;
  }
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    BufferedImage dst = ImageUtil.createBufferedImage(src);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Dimensions"))) != null) {
      int[] dim = ImageFilterUtil.toDimensions(o, "Dimensions");
      setDimensions(dim[0], dim[1]);
    }

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + List.arrayToList(parameters.keysAsString(), ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Dimensions]");
    }

    return filter(src, dst);
  }
  private void set(DatasourceConnection dc) {
    if (dc != null) {
      datasource = dc.getDatasource();
      try {
        DatabaseMetaData md = dc.getConnection().getMetaData();
        md.getDatabaseProductName();
        setAdditional(KeyImpl.init("DatabaseName"), md.getDatabaseProductName());
        setAdditional(KeyImpl.init("DatabaseVersion"), md.getDatabaseProductVersion());
        setAdditional(KeyImpl.init("DriverName"), md.getDriverName());
        setAdditional(KeyImpl.init("DriverVersion"), md.getDriverVersion());
        // setAdditional("url",md.getURL());

        setAdditional(KeyConstants._Datasource, dc.getDatasource().getName());

      } catch (SQLException e) {
      }
    }
  }
Beispiel #7
0
 public static void addAdd(ComponentImpl comp, Property prop) {
   Member m =
       comp.getMember(
           ComponentImpl.ACCESS_PRIVATE, KeyImpl.init("add" + getSingularName(prop)), true, false);
   if (!(m instanceof UDF)) {
     UDF udf = new UDFAddProperty(comp, prop);
     comp.registerUDF(udf.getFunctionName(), udf);
   }
 }
Beispiel #8
0
 public static void addSet(ComponentImpl comp, Property prop) {
   Member m =
       comp.getMember(
           ComponentImpl.ACCESS_PRIVATE, KeyImpl.init("set" + prop.getName()), true, false);
   if (!(m instanceof UDF)) {
     UDF udf = new UDFSetterProperty(comp, prop);
     comp.registerUDF(udf.getFunctionName(), udf);
   }
 }
  public Struct getTableInfo(DatasourceConnection dc, String tableName, ORMEngine engine)
      throws PageException {
    Collection.Key keyTableName = KeyImpl.init(tableName);
    Struct columnsInfo = (Struct) tableInfo.get(keyTableName, null);
    if (columnsInfo != null) return columnsInfo;

    columnsInfo = checkTable(dc, tableName, engine);
    tableInfo.setEL(keyTableName, columnsInfo);
    return columnsInfo;
  }
Beispiel #10
0
/** returns the root of this actuell Page Context */
public final class CallStackGet implements Function {

  private static final long serialVersionUID = -5853145189662102420L;
  static final Collection.Key LINE_NUMBER = KeyImpl.init("LineNumber");

  public static Array call(PageContext pc) {
    Array arr = new ArrayImpl();
    _getTagContext(pc, arr, new Exception("Stack trace"), LINE_NUMBER);
    return arr;
  }

  public static void _getTagContext(
      PageContext pc, Array tagContext, Throwable t, Collection.Key lineNumberName) {
    // Throwable root = t.getRootCause();
    Throwable cause = t.getCause();
    if (cause != null) _getTagContext(pc, tagContext, cause, lineNumberName);
    StackTraceElement[] traces = t.getStackTrace();
    UDF[] udfs = ((PageContextImpl) pc).getUDFs();

    int line = 0;
    String template;
    Struct item;
    StackTraceElement trace = null;
    String functionName, methodName;
    int index = udfs.length - 1;
    for (int i = 0; i < traces.length; i++) {
      trace = traces[i];
      template = trace.getFileName();
      if (trace.getLineNumber() <= 0
          || template == null
          || ResourceUtil.getExtension(template, "").equals("java")) continue;
      methodName = trace.getMethodName();
      if (methodName != null && methodName.startsWith("udfCall") && index > -1)
        functionName = udfs[index--].getFunctionName();
      else functionName = "";

      item = new StructImpl();
      line = trace.getLineNumber();
      item.setEL(KeyConstants._function, functionName);
      item.setEL(KeyConstants._template, template);
      item.setEL(lineNumberName, new Double(line));
      tagContext.appendEL(item);
    }
  }
}
 /**
  * @see railo.runtime.type.Objects#callWithNamedValues(railo.runtime.PageContext,
  *     java.lang.String, railo.runtime.type.Struct)
  */
 public Object callWithNamedValues(PageContext pc, String key, Struct args) throws PageException {
   return callWithNamedValues(pc, KeyImpl.init(key), args);
 }
 /**
  * @see railo.runtime.type.Objects#call(railo.runtime.PageContext, java.lang.String,
  *     java.lang.Object[])
  */
 public Object call(PageContext pc, String key, Object[] arguments) throws PageException {
   return call(pc, KeyImpl.init(key), arguments);
 }
Beispiel #13
0
 public static boolean call(PageContext pc, railo.runtime.type.Struct struct, String key) {
   return call(pc, struct, KeyImpl.init(key));
 }
Beispiel #14
0
public final class ComponentScopeThis extends StructSupport implements ComponentScope {

  private ComponentImpl component;
  private static final int access = Component.ACCESS_PRIVATE;
  private static final Collection.Key THIS = KeyImpl.init("this");

  /**
   * constructor of the class
   *
   * @param component
   */
  public ComponentScopeThis(ComponentImpl component) {
    this.component = component;
  }

  /** @see railo.runtime.type.Scope#initialize(railo.runtime.PageContext) */
  public void initialize(PageContext pc) {}

  /** @see railo.runtime.type.Scope#release() */
  public void release() {}

  /** @see railo.runtime.type.Scope#getType() */
  public int getType() {
    return SCOPE_VARIABLES;
  }

  /** @see railo.runtime.type.Scope#getTypeAsString() */
  public String getTypeAsString() {
    return "variables";
  }

  /** @see railo.runtime.type.Collection#size() */
  public int size() {
    return component.size(access) + 1;
  }

  /** @see railo.runtime.type.Collection#keysAsString() */
  public String[] keysAsString() {
    Set keySet = component.keySet(access);
    keySet.add("this");
    String[] arr = new String[keySet.size()];
    Iterator it = keySet.iterator();

    int index = 0;
    while (it.hasNext()) {
      arr[index++] = Caster.toString(it.next(), null);
    }

    return arr;
  }

  public Collection.Key[] keys() {
    Set keySet = component.keySet(access);
    keySet.add("this");
    Collection.Key[] arr = new Collection.Key[keySet.size()];
    Iterator it = keySet.iterator();

    int index = 0;
    while (it.hasNext()) {
      arr[index++] = KeyImpl.toKey(it.next(), null);
    }
    return arr;
  }

  /** @see railo.runtime.type.Collection#remove(railo.runtime.type.Collection.Key) */
  public Object remove(Collection.Key key) throws PageException {
    return component.remove(key);
  }

  /** @see railo.runtime.type.Collection#removeEL(railo.runtime.type.Collection.Key) */
  public Object removeEL(Collection.Key key) {
    return component.removeEL(key);
  }

  /** @see railo.runtime.type.Collection#clear() */
  public void clear() {
    component.clear();
  }

  /** @see railo.runtime.type.Collection#get(railo.runtime.type.Collection.Key) */
  public Object get(Key key) throws PageException {
    if (key.equalsIgnoreCase(THIS)) {
      return component;
    }
    return component.get(access, key);
  }

  /** @see railo.runtime.type.Collection#get(railo.runtime.type.Collection.Key, java.lang.Object) */
  public Object get(Collection.Key key, Object defaultValue) {
    if (key.equalsIgnoreCase(THIS)) {
      return component;
    }
    return component.get(access, key, defaultValue);
  }

  /** @see railo.runtime.type.Collection#set(railo.runtime.type.Collection.Key, java.lang.Object) */
  public Object set(Collection.Key key, Object value) throws PageException {
    return component.set(key, value);
  }

  /**
   * @see railo.runtime.type.Collection#setEL(railo.runtime.type.Collection.Key, java.lang.Object)
   */
  public Object setEL(Collection.Key key, Object value) {
    return component.setEL(key, value);
  }

  /** @see railo.runtime.type.Iteratorable#keyIterator() */
  public Iterator keyIterator() {
    return component.iterator(access);
  }

  /** @see railo.runtime.type.Collection#containsKey(railo.runtime.type.Collection.Key) */
  public boolean containsKey(Key key) {
    return get(key, null) != null;
  }

  /** @see railo.runtime.dump.Dumpable#toDumpData(railo.runtime.PageContext, int) */
  public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    return StructUtil.toDumpTable(this, "Variable Scope (of Component)", pageContext, maxlevel, dp);
    /*DumpTable table = new DumpTable("#5965e4","#9999ff","#000000");
    table.setTitle("Variable Scope (of Component)");


          Iterator it=keyIterator();

          while(it.hasNext()) {
              String key=Caster.toString(it.next(),"");
              table.appendRow(1,new SimpleDumpData(key.toString()),DumpUtil.toDumpData(get(key,null), pageContext,maxlevel,dp));
          }
          return table;*/
  }

  /** @see railo.runtime.op.Castable#castToString() */
  public String castToString() throws PageException {
    return component.castToString();
  }

  /** @see railo.runtime.type.util.StructSupport#castToString(java.lang.String) */
  public String castToString(String defaultValue) {
    return component.castToString(defaultValue);
  }

  /** @see railo.runtime.op.Castable#castToBooleanValue() */
  public boolean castToBooleanValue() throws PageException {
    return component.castToBooleanValue();
  }

  /** @see railo.runtime.op.Castable#castToBoolean(java.lang.Boolean) */
  public Boolean castToBoolean(Boolean defaultValue) {
    return component.castToBoolean(defaultValue);
  }

  /** @see railo.runtime.op.Castable#castToDoubleValue() */
  public double castToDoubleValue() throws PageException {
    return component.castToDoubleValue();
  }

  /** @see railo.runtime.op.Castable#castToDoubleValue(double) */
  public double castToDoubleValue(double defaultValue) {
    return component.castToDoubleValue(defaultValue);
  }

  /** @see railo.runtime.op.Castable#castToDateTime() */
  public DateTime castToDateTime() throws PageException {
    return component.castToDateTime();
  }

  /** @see railo.runtime.op.Castable#castToDateTime(railo.runtime.type.dt.DateTime) */
  public DateTime castToDateTime(DateTime defaultValue) {
    return component.castToDateTime(defaultValue);
  }

  /**
   * @throws PageException
   * @see railo.runtime.op.Castable#compare(boolean)
   */
  public int compareTo(boolean b) throws PageException {
    return component.compareTo(b);
  }

  /** @see railo.runtime.op.Castable#compareTo(railo.runtime.type.dt.DateTime) */
  public int compareTo(DateTime dt) throws PageException {
    return component.compareTo(dt);
  }

  /** @see railo.runtime.op.Castable#compareTo(double) */
  public int compareTo(double d) throws PageException {
    return component.compareTo(d);
  }

  /** @see railo.runtime.op.Castable#compareTo(java.lang.String) */
  public int compareTo(String str) throws PageException {
    return component.compareTo(str);
  }

  /** @see railo.runtime.type.Collection#duplicate(boolean) */
  public Collection duplicate(boolean deepCopy) {

    StructImpl sct = new StructImpl();
    StructImpl.copy(this, sct, deepCopy);
    return sct;
    // return new ComponentScopeThis((ComponentImpl) component.duplicate(deepCopy));
    // return new ComponentScopeThis(component.cloneComponentImpl(deepCopy));
  }

  /**
   * Returns the value of component.
   *
   * @return value component
   */
  public ComponentPro getComponent() {
    return component;
  }

  /**
   * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, java.lang.String,
   *     java.lang.Object)
   */
  public Object get(PageContext pc, String key, Object defaultValue) {
    return component.get(access, key, defaultValue);
  }

  /**
   * @see railo.runtime.type.Objects#get(railo.runtime.PageContext,
   *     railo.runtime.type.Collection.Key, java.lang.Object)
   */
  public Object get(PageContext pc, Collection.Key key, Object defaultValue) {
    return component.get(access, key, defaultValue);
  }

  /** @see railo.runtime.type.Objects#get(railo.runtime.PageContext, java.lang.String) */
  public Object get(PageContext pc, String key) throws PageException {
    return component.get(access, key);
  }

  /**
   * @see railo.runtime.type.Objects#get(railo.runtime.PageContext,
   *     railo.runtime.type.Collection.Key)
   */
  public Object get(PageContext pc, Collection.Key key) throws PageException {
    return component.get(access, key);
  }

  /**
   * @see railo.runtime.type.Objects#set(railo.runtime.PageContext, java.lang.String,
   *     java.lang.Object)
   */
  public Object set(PageContext pc, String propertyName, Object value) throws PageException {
    return component.set(propertyName, value);
  }

  /**
   * @see railo.runtime.type.Objects#set(railo.runtime.PageContext,
   *     railo.runtime.type.Collection.Key, java.lang.Object)
   */
  public Object set(PageContext pc, Collection.Key propertyName, Object value)
      throws PageException {
    return component.set(propertyName, value);
  }

  /**
   * @see railo.runtime.type.Objects#setEL(railo.runtime.PageContext, java.lang.String,
   *     java.lang.Object)
   */
  public Object setEL(PageContext pc, String propertyName, Object value) {
    return component.setEL(propertyName, value);
  }

  /**
   * @see railo.runtime.type.Objects#setEL(railo.runtime.PageContext,
   *     railo.runtime.type.Collection.Key, java.lang.Object)
   */
  public Object setEL(PageContext pc, Collection.Key propertyName, Object value) {
    return component.setEL(propertyName, value);
  }

  /**
   * @see railo.runtime.type.Objects#call(railo.runtime.PageContext, java.lang.String,
   *     java.lang.Object[])
   */
  public Object call(PageContext pc, String key, Object[] arguments) throws PageException {
    return call(pc, KeyImpl.init(key), arguments);
  }

  public Object call(PageContext pc, Collection.Key key, Object[] arguments) throws PageException {
    Member m = component.getMember(access, key, false, false);
    if (m != null) {
      if (m instanceof UDF) return ((UDF) m).call(pc, arguments, false);
      throw ComponentUtil.notFunction(component, key, m.getValue(), access);
    }
    throw ComponentUtil.notFunction(component, key, null, access);
  }

  /**
   * @see railo.runtime.type.Objects#callWithNamedValues(railo.runtime.PageContext,
   *     java.lang.String, railo.runtime.type.Struct)
   */
  public Object callWithNamedValues(PageContext pc, String key, Struct args) throws PageException {
    return callWithNamedValues(pc, KeyImpl.init(key), args);
  }

  public Object callWithNamedValues(PageContext pc, Collection.Key key, Struct args)
      throws PageException {
    Member m = component.getMember(access, key, false, false);
    if (m != null) {
      if (m instanceof UDF) return ((UDF) m).callWithNamedValues(pc, args, false);
      throw ComponentUtil.notFunction(component, key, m.getValue(), access);
    }
    throw ComponentUtil.notFunction(component, key, null, access);
  }

  /** @see railo.runtime.type.Objects#isInitalized() */
  public boolean isInitalized() {
    return component.isInitalized();
  }

  /** @see railo.runtime.ComponentScope#setComponent(railo.runtime.ComponentImpl) */
  public void setComponent(ComponentImpl c) {
    this.component = c;
  }
}
Beispiel #15
0
  public static Object setProperty(Node node, Collection.Key k, Object value, boolean caseSensitive)
      throws PageException {
    Document doc = (node instanceof Document) ? (Document) node : node.getOwnerDocument();

    // Comment
    if (k.equals(XMLCOMMENT)) {
      removeChilds(XMLCaster.toRawNode(node), Node.COMMENT_NODE, false);
      node.appendChild(XMLCaster.toRawNode(XMLCaster.toComment(doc, value)));
    }
    // NS URI
    else if (k.equals(XMLNSURI)) {
      // TODO impl
      throw new ExpressionException("XML NS URI can't be set", "not implemented");
    }
    // Prefix
    else if (k.equals(XMLNSPREFIX)) {
      // TODO impl
      throw new ExpressionException("XML NS Prefix can't be set", "not implemented");
      // node.setPrefix(Caster.toString(value));
    }
    // Root
    else if (k.equals(XMLROOT)) {
      doc.appendChild(XMLCaster.toNode(doc, value));
    }
    // Parent
    else if (k.equals(XMLPARENT)) {
      Node parent = getParentNode(node, caseSensitive);
      Key name = KeyImpl.init(parent.getNodeName());
      parent = getParentNode(parent, caseSensitive);

      if (parent == null)
        throw new ExpressionException(
            "there is no parent element, you are already on the root element");

      return setProperty(parent, name, value, caseSensitive);
    }
    // Name
    else if (k.equals(XMLNAME)) {
      throw new XMLException("You can't assign a new value for the property [xmlname]");
    }
    // Type
    else if (k.equals(XMLTYPE)) {
      throw new XMLException("You can't change type of a xml node [xmltype]");
    }
    // value
    else if (k.equals(XMLVALUE)) {
      node.setNodeValue(Caster.toString(value));
    }
    // Attributes
    else if (k.equals(XMLATTRIBUTES)) {
      Element parent = XMLCaster.toElement(doc, node);
      Attr[] attres = XMLCaster.toAttrArray(doc, value);
      // print.ln("=>"+value);
      for (int i = 0; i < attres.length; i++) {
        if (attres[i] != null) {
          parent.setAttributeNode(attres[i]);
          // print.ln(attres[i].getName()+"=="+attres[i].getValue());
        }
      }
    }
    // Text
    else if (k.equals(XMLTEXT)) {
      removeChilds(XMLCaster.toRawNode(node), Node.TEXT_NODE, false);
      node.appendChild(XMLCaster.toRawNode(XMLCaster.toText(doc, value)));
    }
    // CData
    else if (k.equals(XMLCDATA)) {
      removeChilds(XMLCaster.toRawNode(node), Node.CDATA_SECTION_NODE, false);
      node.appendChild(XMLCaster.toRawNode(XMLCaster.toCDATASection(doc, value)));
    }
    // Children
    else if (k.equals(XMLCHILDREN)) {
      Node[] nodes = XMLCaster.toNodeArray(doc, value);
      removeChilds(XMLCaster.toRawNode(node), Node.ELEMENT_NODE, false);
      for (int i = 0; i < nodes.length; i++) {
        if (nodes[i] == node) throw new XMLException("can't assign a XML Node to himself");
        if (nodes[i] != null) node.appendChild(XMLCaster.toRawNode(nodes[i]));
      }
    } else {
      Node child = XMLCaster.toNode(doc, value);
      if (!k.getString().equalsIgnoreCase(child.getNodeName())) {
        throw new XMLException(
            "if you assign a XML Element to a XMLStruct , assignment property must have same name like XML Node Name",
            "Property Name is "
                + k.getString()
                + " and XML Element Name is "
                + child.getNodeName());
      }
      NodeList list = XMLUtil.getChildNodes(node, Node.ELEMENT_NODE);
      int len = list.getLength();
      Node n;
      for (int i = 0; i < len; i++) {
        n = list.item(i);
        if (nameEqual(n, k.getString(), caseSensitive)) {
          node.replaceChild(XMLCaster.toRawNode(child), XMLCaster.toRawNode(n));
          return value;
        }
      }
      node.appendChild(XMLCaster.toRawNode(child));
    }

    return value;
  }
Beispiel #16
0
 public Object get(String key, Object defaultValue) {
   return get(KeyImpl.init(key), defaultValue);
 }
 /**
  * @see railo.runtime.type.Objects#set(railo.runtime.PageContext, java.lang.String,
  *     java.lang.Object)
  */
 public Object set(PageContext pc, String propertyName, Object value) throws PageException {
   return set(KeyImpl.init(propertyName), value);
 }
Beispiel #18
0
  public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
    BufferedImage dst = ImageUtil.createBufferedImage(src);
    Object o;
    if ((o = parameters.removeEL(KeyImpl.init("Amount"))) != null)
      setAmount(ImageFilterUtil.toFloatValue(o, "Amount"));
    if ((o = parameters.removeEL(KeyImpl.init("Exposure"))) != null)
      setExposure(ImageFilterUtil.toFloatValue(o, "Exposure"));
    if ((o = parameters.removeEL(KeyImpl.init("ColorSource"))) != null)
      setColorSource(ImageFilterUtil.toColorRGB(o, "ColorSource"));
    if ((o = parameters.removeEL(KeyImpl.init("Material"))) != null)
      setMaterial(ImageFilterUtil.toLightFilter$Material(o, "Material"));
    if ((o = parameters.removeEL(KeyImpl.init("BumpFunction"))) != null)
      setBumpFunction(ImageFilterUtil.toFunction2D(o, "BumpFunction"));
    if ((o = parameters.removeEL(KeyImpl.init("BumpHeight"))) != null)
      setBumpHeight(ImageFilterUtil.toFloatValue(o, "BumpHeight"));
    if ((o = parameters.removeEL(KeyImpl.init("BumpSoftness"))) != null)
      setBumpSoftness(ImageFilterUtil.toFloatValue(o, "BumpSoftness"));
    if ((o = parameters.removeEL(KeyImpl.init("BumpShape"))) != null)
      setBumpShape(ImageFilterUtil.toIntValue(o, "BumpShape"));
    if ((o = parameters.removeEL(KeyImpl.init("ViewDistance"))) != null)
      setViewDistance(ImageFilterUtil.toFloatValue(o, "ViewDistance"));
    if ((o = parameters.removeEL(KeyImpl.init("EnvironmentMap"))) != null)
      setEnvironmentMap(ImageFilterUtil.toBufferedImage(o, "EnvironmentMap"));
    if ((o = parameters.removeEL(KeyImpl.init("BumpSource"))) != null)
      setBumpSource(ImageFilterUtil.toIntValue(o, "BumpSource"));
    if ((o = parameters.removeEL(KeyImpl.init("DiffuseColor"))) != null)
      setDiffuseColor(ImageFilterUtil.toColorRGB(o, "DiffuseColor"));

    // check for arguments not supported
    if (parameters.size() > 0) {
      throw new FunctionException(
          ThreadLocalPageContext.get(),
          "ImageFilter",
          3,
          "parameters",
          "the parameter"
              + (parameters.size() > 1 ? "s" : "")
              + " ["
              + CollectionUtil.getKeyList(parameters, ", ")
              + "] "
              + (parameters.size() > 1 ? "are" : "is")
              + " not allowed, only the following parameters are supported [Amount, Exposure, ColorSource, Material, BumpFunction, BumpHeight, BumpSoftness, BumpShape, ViewDistance, EnvironmentMap, BumpSource, DiffuseColor]");
    }

    return filter(src, dst);
  }
Beispiel #19
0
 public Object get(String key) throws PageException {
   return get(KeyImpl.init(key));
 }