當前位置: 首頁>>代碼示例>>Java>>正文


Java StringValuePresenter類代碼示例

本文整理匯總了Java中com.holonplatform.core.presentation.StringValuePresenter的典型用法代碼示例。如果您正苦於以下問題:Java StringValuePresenter類的具體用法?Java StringValuePresenter怎麽用?Java StringValuePresenter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StringValuePresenter類屬於com.holonplatform.core.presentation包,在下文中一共展示了StringValuePresenter類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderNumber

import com.holonplatform.core.presentation.StringValuePresenter; //導入依賴的package包/類
/**
 * Renders a numeric value type Field
 * @param property Property to render
 * @return Field instance
 */
@SuppressWarnings("unchecked")
protected Field<T> renderNumber(Property<T> property) {
	// Number format

	Class<? extends Number> type = (Class<? extends Number>) property.getType();

	int decimals = property.getConfiguration().getParameter(StringValuePresenter.DECIMAL_POSITIONS).orElse(-1);
	boolean disableGrouping = property.getConfiguration().getParameter(StringValuePresenter.DISABLE_GROUPING)
			.orElse(Boolean.FALSE);

	Locale locale = LocalizationContext.getCurrent().filter(l -> l.isLocalized()).flatMap(l -> l.getLocale())
			.orElse(Locale.getDefault());

	NumberFormat numberFormat = LocalizationContext.getCurrent().filter(l -> l.isLocalized())
			.map((l) -> l.getNumberFormat(type, decimals, disableGrouping))
			.orElse(TypeUtils.isDecimalNumber(property.getType()) ? NumberFormat.getNumberInstance(locale)
					: NumberFormat.getIntegerInstance(locale));

	if (decimals > -1) {
		numberFormat.setMinimumFractionDigits(decimals);
		numberFormat.setMaximumFractionDigits(decimals);
	}
	if (disableGrouping) {
		numberFormat.setGroupingUsed(false);
	}

	return postProcessField(input.number(type).numberFormat(numberFormat).asField(), property);
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:34,代碼來源:DefaultFieldPropertyRenderer.java

示例2: LabelViewComponent

import com.holonplatform.core.presentation.StringValuePresenter; //導入依賴的package包/類
/**
 * Constructor
 * @param type Concrete value type
 */
public LabelViewComponent(Class<? extends T> type) {
	super(type, new Label());
	getLabel().setContentMode(ContentMode.HTML);

	// default converter
	stringConverter = (v) -> StringValuePresenter.getDefault().present(null, v, null);
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:12,代碼來源:LabelViewComponent.java

示例3: present

import com.holonplatform.core.presentation.StringValuePresenter; //導入依賴的package包/類
public void present() {
	String presented = StringValuePresenter.getDefault().present("stringValue"); // <1>
	presented = StringValuePresenter.getDefault().present("stringValue",
			ParameterSet.builder().parameter(StringValuePresenter.MAX_LENGTH, 6).build()); // <2>
	presented = StringValuePresenter.getDefault().present(MyEnum.VALUE1); // <3>
	presented = StringValuePresenter.getDefault().present(new MyEnum[] { MyEnum.VALUE1, MyEnum.VALUE2 }); // <4>
}
 
開發者ID:holon-platform,項目名稱:holon-core,代碼行數:8,代碼來源:ExamplePresenter.java

示例4: present

import com.holonplatform.core.presentation.StringValuePresenter; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public String present(Property property, Object value) {
	ObjectUtils.argumentNotNull(property, "Property must be not null");
	ParameterSet.Builder<?> parameters = ParameterSet.builder().parameters(property.getConfiguration());
	property.getConfiguration().getTemporalType()
			.ifPresent(t -> parameters.parameter(StringValuePresenter.TEMPORAL_TYPE, t));
	return StringValuePresenter.getDefault().present(property.getType(), value, parameters.build());
}
 
開發者ID:holon-platform,項目名稱:holon-core,代碼行數:10,代碼來源:DefaultPropertyValuePresenter.java


注:本文中的com.holonplatform.core.presentation.StringValuePresenter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。