本文整理汇总了Java中org.eclipse.birt.report.model.api.ScalarParameterHandle.getPattern方法的典型用法代码示例。如果您正苦于以下问题:Java ScalarParameterHandle.getPattern方法的具体用法?Java ScalarParameterHandle.getPattern怎么用?Java ScalarParameterHandle.getPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.birt.report.model.api.ScalarParameterHandle
的用法示例。
在下文中一共展示了ScalarParameterHandle.getPattern方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParameterValue
import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
/**
* parse parameter value by string value
*
* @param handle
* @param field
* @param value
* @return
* @throws Exception
*/
private Object getParameterValue( ScalarParameterHandle handle,
ParameterField field, String value ) throws Exception
{
// get parameter data type
String dataType = handle.getDataType( );
// if String type, return String value
if ( DesignChoiceConstants.PARAM_TYPE_STRING
.equalsIgnoreCase( dataType ) )
{
return value;
}
// convert parameter to object
String pattern = field.getPattern( );
if ( pattern == null || pattern.length( ) <= 0 )
{
pattern = handle.getPattern( );
}
return DataUtil.validate( handle.getName( ), handle.getDataType( ),
pattern, value, this.locale, this.timeZone, field.isLocale( ) );
}
示例2: formatScalarParameter
import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
/**
* Formats scalar parameter value.
*
* @param handle
* @param inputStr
* @return formatted value.
*/
private static String formatScalarParameter( ScalarParameterHandle handle,
String inputStr ) throws BirtException
{
String pattern = handle.getPattern( );
String category = handle.getCategory( );
if ( pattern == null )
{
if ( isCustom( category ) )
{
return inputStr;
}
pattern = category;
}
String dataType = handle.getDataType( );
if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( dataType ) )
{
Date date = DataTypeUtil.toDate( inputStr, ULocale.US );
DateFormatter formatter = new DateFormatter( pattern );
inputStr = formatter.format( date );
}
else if ( DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( dataType ) )
{
inputStr = new NumberFormatter( pattern ).format( DataTypeUtil.toDouble( inputStr )
.doubleValue( ) );
}
else if ( DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( dataType ) )
{
inputStr = new NumberFormatter( pattern ).format( DataTypeUtil.toBigDecimal( inputStr ) );
}
else if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( dataType ) )
{
inputStr = new StringFormatter( pattern ).format( inputStr );
}
return inputStr;
}
示例3: convertFormatPattern
import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
private String convertFormatPattern( ScalarParameterHandle paraHandle )
{
String formatCategroy = paraHandle.getCategory( );
String formatPattern = paraHandle.getPattern( );
formatPattern = isCustom( formatCategroy ) ? formatPattern
: formatCategroy;
return formatPattern;
}
示例4: ParameterHelper
import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
public ParameterHelper( AbstractScalarParameterHandle param,
ULocale ulocale, TimeZone timezone )
{
this.labelColumnName = getLabelColumnName( param );
this.valueColumnName = getValueColumnName( param );
this.valueType = param.getDataType( );
this.alreadySorted = param.getSortByColumn( ) != null;
this.distinct = param.distinct( );
String sortDirection = param.getSortDirection( );
boolean sortByLabel = "label".equalsIgnoreCase( param.getSortBy( ) );
if ( param instanceof ScalarParameterHandle )
{
parameterType = SCALAR_PARAMETER;
ScalarParameterHandle parameter = (ScalarParameterHandle) param;
this.fixedOrder = parameter.isFixedOrder( );
if ( param.getLabelExpr( ) == null )
{ // if no label expression was set, apply pattern to value column
pattern = parameter.getPattern( );
}
}
else
{
parameterType = FILTER_PARAMETER;
}
if ( !( parameterType == SCALAR_PARAMETER && fixedOrder )
&& !alreadySorted && sortDirection != null )
{
boolean sortDirectionValue = DesignChoiceConstants.SORT_DIRECTION_ASC.equalsIgnoreCase( sortDirection );
Comparator choiceComparator = new SelectionChoiceComparator( sortByLabel,
pattern,
sortDirectionValue,
ulocale );
this.comparator = new DistinctComparatorDecorator( choiceComparator,
distinct );
}
this.converter = new ReportParameterConverter( pattern,
ulocale,
timezone );
}