private Object getDecimalTemplateValue( IDecimalPropertyDescriptor propertyDescriptor) { double templateValue = DEF_DISP_MAX_VALUE; if (propertyDescriptor.getMaxValue() != null) { templateValue = propertyDescriptor.getMaxValue().doubleValue(); } int maxFractionDigit = DEF_DISP_MAX_FRACTION_DIGIT; if (propertyDescriptor.getMaxFractionDigit() != null) { maxFractionDigit = propertyDescriptor.getMaxFractionDigit().intValue(); } double decimalPart = 0; for (int i = 1; i <= maxFractionDigit; i++) { decimalPart += Math.pow(10.0D, -i); } templateValue += decimalPart; return new Double(templateValue); }
private ULCNumberDataType createDecimalDataType( IDecimalPropertyDescriptor propertyDescriptor, Locale locale, NumberFormat format) { ULCNumberDataType numberDataType = new ULCNumberDataType(locale); if (propertyDescriptor.getMaxFractionDigit() != null) { numberDataType.setMaxFractionDigits(propertyDescriptor .getMaxFractionDigit().intValue()); } numberDataType.setMin(propertyDescriptor.getMinValue()); numberDataType.setMax(propertyDescriptor.getMaxValue()); numberDataType.setGroupingUsed(format.isGroupingUsed()); return numberDataType; }
private IView<JComponent> createDecimalPropertyView( IDecimalPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { if (propertyDescriptor instanceof IPercentPropertyDescriptor) { return createPercentPropertyView( (IPercentPropertyDescriptor) propertyDescriptor, actionHandler, locale); } JTextField viewComponent = createJTextField(); IFormatter formatter = createDecimalFormatter(propertyDescriptor, locale); JFormattedFieldConnector connector = new JFormattedFieldConnector( propertyDescriptor.getName(), viewComponent, formatter); connector.setExceptionHandler(actionHandler); adjustSizes(viewComponent, formatter, getDecimalTemplateValue(propertyDescriptor)); return constructView(viewComponent, null, connector); }
actionHandler, locale); if (propertyViewDescriptor.isReadOnly()) { connector = getConnectorFactory().createFormattedValueConnector(propertyDescriptor.getName(), formatter); if (propertyViewDescriptor.getAction() != null && actionHandler.isAccessGranted( propertyViewDescriptor.getAction())) { } else { if (isNumberServerParse() || getOverloadedPattern(propertyViewDescriptor, propertyDescriptor) != null) { connector = getConnectorFactory().createFormattedValueConnector(propertyDescriptor.getName(), formatter); viewComponent = createRTextField(propertyViewDescriptor); } else { connector = getConnectorFactory().createValueConnector(propertyDescriptor.getName()); viewComponent = createRDecimalField(propertyViewDescriptor); ((RDecimalComponent) viewComponent).setMaxFractionDigit(propertyDescriptor.getMaxFractionDigit());
private NumberFormat createDecimalFormat( IDecimalPropertyDescriptor propertyDescriptor, Locale locale) { NumberFormat format = NumberFormat.getNumberInstance(locale); if (propertyDescriptor.getMaxFractionDigit() != null) { format.setMaximumFractionDigits(propertyDescriptor.getMaxFractionDigit() .intValue()); } else { format.setMaximumFractionDigits(DEF_DISP_MAX_FRACTION_DIGIT); } format.setMinimumFractionDigits(format.getMaximumFractionDigits()); return format; }
private IView<SComponent> createDecimalPropertyView( IDecimalPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { if (propertyDescriptor instanceof IPercentPropertyDescriptor) { return createPercentPropertyView( (IPercentPropertyDescriptor) propertyDescriptor, actionHandler, locale); } STextField viewComponent = createSTextField(); IFormatter formatter = createDecimalFormatter(propertyDescriptor, locale); SFormattedFieldConnector connector = new SFormattedFieldConnector( propertyDescriptor.getName(), viewComponent, formatter); connector.setExceptionHandler(actionHandler); adjustSizes(viewComponent, formatter, getDecimalTemplateValue(propertyDescriptor)); return constructView(viewComponent, null, connector); }
private NumberFormat createDecimalFormat( IDecimalPropertyDescriptor propertyDescriptor, Locale locale) { NumberFormat format = NumberFormat.getNumberInstance(locale); if (propertyDescriptor.getMaxFractionDigit() != null) { format.setMaximumFractionDigits(propertyDescriptor.getMaxFractionDigit() .intValue()); } else { format.setMaximumFractionDigits(DEF_DISP_MAX_FRACTION_DIGIT); } format.setMinimumFractionDigits(format.getMaximumFractionDigits()); return format; }
private Object getDecimalTemplateValue( IDecimalPropertyDescriptor propertyDescriptor) { double templateValue = DEF_DISP_MAX_VALUE; if (propertyDescriptor.getMaxValue() != null) { templateValue = propertyDescriptor.getMaxValue().doubleValue(); } int maxFractionDigit = DEF_DISP_MAX_FRACTION_DIGIT; if (propertyDescriptor.getMaxFractionDigit() != null) { maxFractionDigit = propertyDescriptor.getMaxFractionDigit().intValue(); } double decimalPart = 0; for (int i = 1; i <= maxFractionDigit; i++) { decimalPart += Math.pow(10.0D, -i); } templateValue += decimalPart; return new Double(templateValue); }
if (propertyViewDescriptor.isReadOnly()) { viewComponent = createSLabel(true); connector = new SLabelConnector(propertyDescriptor.getName(), (SLabel) viewComponent); ((SLabelConnector) connector).setFormatter(formatter); } else { viewComponent = createSTextField(); connector = new SFormattedFieldConnector(propertyDescriptor.getName(), (STextField) viewComponent, formatter); adjustSizes(propertyViewDescriptor, viewComponent, formatter,
private NumberFormat createDecimalFormat( IDecimalPropertyDescriptor propertyDescriptor, Locale locale) { NumberFormat format = NumberFormat.getNumberInstance(locale); if (propertyDescriptor.getMaxFractionDigit() != null) { format.setMaximumFractionDigits(propertyDescriptor.getMaxFractionDigit() .intValue()); } else { format.setMaximumFractionDigits(DEF_DISP_MAX_FRACTION_DIGIT); } format.setMinimumFractionDigits(format.getMaximumFractionDigits()); return format; }
private Object getDecimalTemplateValue( IDecimalPropertyDescriptor propertyDescriptor) { double templateValue = DEF_DISP_MAX_VALUE; if (propertyDescriptor.getMaxValue() != null) { templateValue = propertyDescriptor.getMaxValue().doubleValue(); } int maxFractionDigit = DEF_DISP_MAX_FRACTION_DIGIT; if (propertyDescriptor.getMaxFractionDigit() != null) { maxFractionDigit = propertyDescriptor.getMaxFractionDigit().intValue(); } double decimalPart = 0; for (int i = 0; i < maxFractionDigit; i++) { decimalPart += Math.pow(10.0D, -i); } templateValue += decimalPart; return new Double(templateValue); }
viewComponent = createJLabel(propertyViewDescriptor, true); connector = new JLabelConnector(propertyDescriptor.getName(), (JLabel) viewComponent); ((JLabelConnector) connector).setFormatter(formatter); } else { viewComponent = createJTextField(propertyViewDescriptor); connector = new JFormattedFieldConnector(propertyDescriptor.getName(), (JTextField) viewComponent, formatter);
format = NumberFormat.getNumberInstance(locale); ((NumberFormat) format).setMaximumFractionDigits(((IDecimalPropertyDescriptor) sd).getMaxFractionDigit()); ((NumberFormat) format).setMinimumFractionDigits(((IDecimalPropertyDescriptor) sd).getMaxFractionDigit());
private IView<ULCComponent> createDecimalPropertyView( IDecimalPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { if (propertyDescriptor instanceof IPercentPropertyDescriptor) { return createPercentPropertyView( (IPercentPropertyDescriptor) propertyDescriptor, actionHandler, locale); } ULCTextField viewComponent = createULCTextField(); NumberFormat format = createDecimalFormat(propertyDescriptor, locale); viewComponent.setDataType(createDecimalDataType(propertyDescriptor, locale, format)); ULCTextFieldConnector connector = new ULCTextFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); adjustSizes(viewComponent, createFormatter(format), getDecimalTemplateValue(propertyDescriptor)); return constructView(viewComponent, null, connector); }