Package hirondelle.web4j.request

Examples of hirondelle.web4j.request.Formats


   is not actually used to render the result.
  */
  public String getMessage(Locale aLocale, TimeZone aTimeZone){
    String result = null;
    Translator translator = BuildImpl.forTranslator();
    Formats formats = new Formats(aLocale, aTimeZone);
    if( fParams.isEmpty() ){
      result = translator.get(fText, aLocale);
    }
    else {
      String localizedPattern = translator.get(fText, aLocale);
      List<String> formattedParams = new ArrayList<String>();
      for (Object param : fParams){
        if ( param instanceof RequestParameter ){
          RequestParameter reqParam = (RequestParameter)param;
          String translatedParamName = translator.get(reqParam.getName(), aLocale);
          formattedParams.add( translatedParamName );
        }
        else {
          //this will escape any special HTML chars in params :
          formattedParams.add( formats.objectToTextForReport(param).toString() );
        }
      }
      result = populateParamsIntoCustomFormat(localizedPattern, formattedParams);
    }
    return result;
View Full Code Here


    }
  }
 
  private BigDecimal parseBigDecimal(String aUserInputValue, Locale aLocale, TimeZone aTimeZone) throws ModelCtorException {
    BigDecimal result = null;
    Formats formats = new Formats(aLocale, aTimeZone);
    Pattern pattern = formats.getDecimalInputFormat();
    if ( Util.matches(pattern, aUserInputValue)) {
      //BigDecimal ctor only takes '.' as decimal sign, never ','         
      result = new BigDecimal(aUserInputValue.replace(',', '.'));
    }
    else {
View Full Code Here

  }
 
  private Decimal parseDecimal(String aUserInputValue, Locale aLocale, TimeZone aTimeZone) throws ModelCtorException {
    Decimal result = null;
    BigDecimal amount = null;
    Formats formats = new Formats(aLocale, aTimeZone);
    Pattern pattern = formats.getDecimalInputFormat();
    if ( Util.matches(pattern, aUserInputValue)) {
      //BigDecimal ctor only takes '.' as decimal sign, never ','         
      amount = new BigDecimal(aUserInputValue.replace(',', '.'));
      try {
         result = new Decimal(amount);
View Full Code Here

   @param aParams parameters for the <tt>SELECT</tt> statement, in the same order as in the underlying <tt>SELECT</tt> statement
  */
  public static List<Map<String, SafeText>> formatted(Class<?>[] aTargetClasses, Locale aLocale, TimeZone aTimeZone, SqlId aSqlId, DynamicCriteria aCriteria, Object... aParams) throws DAOException {
    List<Map<String, SafeText>> result = new ArrayList<Map<String, SafeText>>();
    //any date columns must be formatted in a Locale-sensitive manner
    Formats formats = new Formats(aLocale, aTimeZone);
    ModelBuilder<Map<String, SafeText>> builder = new ReportBuilder(aTargetClasses, formats);
    SqlFetcher fetcher = getFetcher(aSqlId, aCriteria, aParams);
    fetcher.fetchObjects(builder, result);
    return result;
  }
View Full Code Here

    }
    public boolean isModelObjectPresent() {
      return false;
    }
    public Formats getFormats(){
      return new Formats(new Locale("en"), TimeZone.getTimeZone("GMT"));
    }
View Full Code Here

    }
    public Object getModelObject(){
      return fBean;
    }
    public Formats getFormats(){
      return new Formats(new Locale("en"), TimeZone.getTimeZone("GMT") );
    }
View Full Code Here

    }
    public Object getModelObject(){
      return null;
    }
    public Formats getFormats(){
      return new Formats(new Locale("en"), TimeZone.getTimeZone("GMT") );
    }
View Full Code Here

      return fModel;
    }
    public Formats getFormats(){
      Locale locale = BuildImpl.forLocaleSource().get(getRequest());
      TimeZone timeZone = BuildImpl.forTimeZoneSource().get(getRequest());
      return new Formats(locale, timeZone);
    }
View Full Code Here

TOP

Related Classes of hirondelle.web4j.request.Formats

Copyright © 2018 www.massapicom. 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.