当前位置: 首页>>代码示例>>Java>>正文


Java RiceKeyConstants.ERROR_PERCENTAGE属性代码示例

本文整理汇总了Java中org.kuali.rice.core.api.util.RiceKeyConstants.ERROR_PERCENTAGE属性的典型用法代码示例。如果您正苦于以下问题:Java RiceKeyConstants.ERROR_PERCENTAGE属性的具体用法?Java RiceKeyConstants.ERROR_PERCENTAGE怎么用?Java RiceKeyConstants.ERROR_PERCENTAGE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.kuali.rice.core.api.util.RiceKeyConstants的用法示例。


在下文中一共展示了RiceKeyConstants.ERROR_PERCENTAGE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAsText

/**
 * This overridden method converts
 * <code>org.kuali.rice.core.api.util.type.KualiPercent</code> objects to the
 * display string.
 *
 * @see java.beans.PropertyEditorSupport#getAsText()
 */
@Override
public String getAsText() {
    Object value = this.getValue();
    // Previously returned N/A
    if (value == null)
        return "";

    String stringValue = "";

    try {
        if (value instanceof KualiDecimal) {

            value = ((KualiDecimal) this.getValue()).bigDecimalValue();
        }
        BigDecimal bigDecValue = (BigDecimal) value;
        bigDecValue = bigDecValue.setScale(PERCENTAGE_SCALE, BigDecimal.ROUND_HALF_UP);
        stringValue = NumberFormat.getInstance().format(bigDecValue.doubleValue());
    } catch (IllegalArgumentException iae) {
        throw new FormatException("formatting", RiceKeyConstants.ERROR_PERCENTAGE, this.getValue().toString(), iae);
    }

    return stringValue +"%";
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:CustomPercentageEditor.java

示例2: getAsText

/**
 * This overridden method converts
 * <code>org.kuali.rice.core.api.util.type.KualiPercent</code> objects to the
 * display string.
 *
 * @see java.beans.PropertyEditorSupport#getAsText()
 */
@Override
public String getAsText() {
    Object value = this.getValue();
    // Previously returned N/A
    if (value == null)
        return "";

    String stringValue = "";
    try {
        if (value instanceof KualiDecimal) {
            value = ((KualiDecimal) this.getValue()).bigDecimalValue();
        }
        BigDecimal bigDecValue = (BigDecimal) value;
        bigDecValue = bigDecValue.setScale(PERCENTAGE_SCALE, BigDecimal.ROUND_HALF_UP);
        stringValue = NumberFormat.getInstance().format(bigDecValue.doubleValue());
    } catch (IllegalArgumentException iae) {
        throw new FormatException("formatting", RiceKeyConstants.ERROR_PERCENTAGE, this.getValue().toString(), iae);
    }

    return stringValue;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:UifPercentageEditor.java

示例3: format

/**
 * Returns a string representation of its argument, formatted as a percentage value.
 *
 * @return a formatted String
 */
@Override
public Object format(Object value) {
    if (value == null) {
        return "N/A";
    }

    String stringValue = "";
    try {
    	if (value instanceof KualiDecimal) {
    		value = ((KualiDecimal)value).bigDecimalValue();
    	}
        BigDecimal bigDecValue = (BigDecimal) value;
        bigDecValue = bigDecValue.setScale(PERCENTAGE_SCALE, BigDecimal.ROUND_HALF_UP);
        stringValue = NumberFormat.getInstance().format(bigDecValue.doubleValue());
    }
    catch (IllegalArgumentException iae) {
    	// begin Kuali Foundation modification
        throw new FormatException("formatting", RiceKeyConstants.ERROR_PERCENTAGE, value.toString(), iae);
    	// end Kuali Foundation modification
    }

    return stringValue + " percent";
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:PercentageFormatter.java


注:本文中的org.kuali.rice.core.api.util.RiceKeyConstants.ERROR_PERCENTAGE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。