本文整理匯總了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 );
}