Examples of JRFillVariable


Examples of net.sf.jasperreports.engine.fill.JRFillVariable

  /**
   *
   */
  public Object getVariableValue(String variableName) throws JRScriptletException
  {
    JRFillVariable variable = (JRFillVariable)this.variablesMap.get(variableName);
    if (variable == null)
    {
      throw new JRScriptletException("Variable not found : " + variableName);
    }
    return variable.getValue();
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.fill.JRFillVariable

  /**
   *
   */
  public void setVariableValue(String variableName, Object value) throws JRScriptletException
  {
    JRFillVariable variable = (JRFillVariable)this.variablesMap.get(variableName);
    if (variable == null)
    {
      throw new JRScriptletException("Variable not found : " + variableName);
    }
   
    if (value != null && !variable.getValueClass().isInstance(value) )
    {
      throw new JRScriptletException("Incompatible value assigned to variable " + variableName + ". Expected " + variable.getValueClassName() + ".");
    }
   
    variable.setValue(value);
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.fill.JRFillVariable

    for (Iterator it = variablesMap.entrySet().iterator(); it.hasNext();)
    {
      Map.Entry entry = (Map.Entry) it.next();
      String name = (String) entry.getKey();
      JRFillVariable var = (JRFillVariable) entry.getValue();
      JSVariable jsVar = new JSVariable(var, scope);
      scope.put(getVariableVar(name), scope, jsVar);
    }

    if (fieldsMap != null)
View Full Code Here

Examples of net.sf.jasperreports.engine.fill.JRFillVariable

      done=false;
      for (Iterator iterator = allVariables.keySet().iterator(); iterator.hasNext() && done==false;) {
        String varName = (String) iterator.next();
        if(oldModeRetrievingChart==true){
          if(varName.equalsIgnoreCase(CHART_LABEL)){
            JRFillVariable labelValueO = (JRFillVariable) allVariables.get(CHART_LABEL);
            String labelValue = null;
            if(labelValueO.getValue()==null){
              logger.error("CHART_LABEL variable has no value");
              return;
            }
            labelValue=(String)labelValueO.getValue();
           
            // Set other parameters (only not system defined)
            for (Iterator iterator2 = allParameters.keySet().iterator(); iterator2.hasNext();) {
              String namePar = (String) iterator2.next();
              JRFillParameter par=(JRFillParameter)allParameters.get(namePar);
              if(!par.isSystemDefined() && par.getValue()!=null){
                Object val=par.getValue();
                chartParameters.put(namePar, val.toString());
              }
            }

            logger.debug("execute chart with lable "+labelValue);
           
            logger.debug("Calling Service");
            byte[] image=proxy.executeChart(labelValue, chartParameters);
            logger.debug("Back from Service");

            InputStream is=new ByteArrayInputStream(image);

            logger.debug("Input Stream filled, Setting variable");
            if(allVariables.keySet().contains(CHART_IMAGE)){
              this.setVariableValue(CHART_IMAGE, is);
            }
            else{
              logger.error("variable where to set image chart "+CHART_IMAGE+ " not defined");
              return;
            }
            done=true;
          }
        }
        else if(oldModeRetrievingChart==false){
          if(varName.startsWith("sbichart_")){
            logger.debug("Processing variable "+varName);         
            JRFillVariable variable=(JRFillVariable)allVariables.get(varName);
            if(variable.getValue()!=null){
              chartParameters=new HashMap();
//              the realVarName is the name of the target variable!
              String areaValue=varName.substring(9);
              // call a utility function that parse the variable, in the form var1=val1;var2=val2
              String varVal=(String)variable.getValue();
              // Value is defined as chart_label=label;par1=val1;par2=val2;
              Map nameValuePars=parseVariable(varVal);

              // check if there is the main parameters defined:
              // chart_label : indicating the label of the chart that has to be called.
View Full Code Here
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.