Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
688a829f
Commit
688a829f
authored
8 years ago
by
Simon Barner
Browse files
Options
Downloads
Patches
Plain Diff
- Add support for BigDecimals
parent
0deacd48
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/PropertySectionBase.java
+50
-2
50 additions, 2 deletions
...tooling/kernel/ui/extension/base/PropertySectionBase.java
with
50 additions
and
2 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/PropertySectionBase.java
+
50
−
2
View file @
688a829f
...
@@ -17,14 +17,18 @@ $Id$
...
@@ -17,14 +17,18 @@ $Id$
+--------------------------------------------------------------------------*/
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.kernel.ui.extension.base
;
package
org.fortiss.tooling.kernel.ui.extension.base
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
NumberToStringConverter
.
fromBigDecimal
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
NumberToStringConverter
.
fromDouble
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
NumberToStringConverter
.
fromDouble
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
NumberToStringConverter
.
fromInteger
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
NumberToStringConverter
.
fromInteger
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
StringToNumberConverter
.
toBigDecimal
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
StringToNumberConverter
.
toDouble
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
StringToNumberConverter
.
toDouble
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
StringToNumberConverter
.
toInteger
;
import
static
org
.
eclipse
.
core
.
databinding
.
conversion
.
StringToNumberConverter
.
toInteger
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
DECORATION_KEY
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
DECORATION_KEY
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
performComplexTextBinding
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
performComplexTextBinding
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
WidgetsFactory
.
createTextWithUndo
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
WidgetsFactory
.
createTextWithUndo
;
import
java.math.BigDecimal
;
import
org.conqat.ide.commons.ui.databinding.validate.NumberPositiveValidator
;
import
org.conqat.ide.commons.ui.databinding.validate.NumberPositiveValidator
;
import
org.conqat.ide.commons.ui.databinding.validate.TextToDoubleValidator
;
import
org.conqat.ide.commons.ui.databinding.validate.TextToDoubleValidator
;
import
org.conqat.ide.commons.ui.databinding.validate.TextToIntegerValidator
;
import
org.conqat.ide.commons.ui.databinding.validate.TextToIntegerValidator
;
...
@@ -63,7 +67,7 @@ import com.ibm.icu.text.NumberFormat;
...
@@ -63,7 +67,7 @@ import com.ibm.icu.text.NumberFormat;
* @author hoelzl
* @author hoelzl
* @author $Author$
* @author $Author$
* @version $Rev$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
5D14BE37F51FE3DB774A7902691F0EEE
* @ConQAT.Rating
YELLOW
Hash:
742920607D7071B83FFCBAC89A37BE31
*/
*/
public
abstract
class
PropertySectionBase
extends
AbstractPropertySection
{
public
abstract
class
PropertySectionBase
extends
AbstractPropertySection
{
...
@@ -91,7 +95,6 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
...
@@ -91,7 +95,6 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
*/
*/
getWidgetFactory
().
createList
(
composite
,
SWT
.
NONE
).
setLayoutData
(
new
GridData
(
1
,
1
));
getWidgetFactory
().
createList
(
composite
,
SWT
.
NONE
).
setLayoutData
(
new
GridData
(
1
,
1
));
getWidgetFactory
().
createLabel
(
composite
,
""
,
SWT
.
NONE
).
setLayoutData
(
new
GridData
(
1
,
1
));
getWidgetFactory
().
createLabel
(
composite
,
""
,
SWT
.
NONE
).
setLayoutData
(
new
GridData
(
1
,
1
));
}
}
/** {@inheritDoc} */
/** {@inheritDoc} */
...
@@ -286,6 +289,51 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
...
@@ -286,6 +289,51 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
dbc
=
new
EMFDataBindingContext
();
dbc
=
new
EMFDataBindingContext
();
}
}
/**
* Binds a positive {@link BigDecimal} value with the default number of a maximum of three
* fraction digits to be used in the String representation.
*/
protected
void
bindPositiveBigDecimalValue
(
Control
text
,
IObservableValue
observedValue
)
{
bindBigDecimalValue
(
text
,
observedValue
,
NumberPositiveValidator
.
INSTANCE
);
}
/**
* Binds a positive {@link BigDecimal} value with a user defined maximum number of fraction
* digits to be used in the String representation.
*/
protected
void
bindPositiveBigDecimalValue
(
Control
text
,
IObservableValue
observedValue
,
int
maxFractionDigits
)
{
bindBigDecimalValue
(
text
,
observedValue
,
NumberPositiveValidator
.
INSTANCE
,
maxFractionDigits
);
}
/**
* Binds a {@link BigDecimal} value with the default number of a maximum of three fraction
* digits to be used in the String representation.
*/
protected
void
bindBigDecimalValue
(
Control
text
,
IObservableValue
observedValue
,
IValidator
numberValidator
)
{
// TextToDoubleValidator checks format of fractional numbers and is hence also suitable for
// BigDecimals
performComplexTextBinding
(
dbc
,
text
,
observedValue
,
fromBigDecimal
(),
toBigDecimal
(),
TextToDoubleValidator
.
INSTANCE
,
numberValidator
);
}
/**
* Binds a BigDecimal value with a user defined maximum number of fraction digits to be
* used in the String representation.
*/
protected
void
bindBigDecimalValue
(
Control
text
,
IObservableValue
observedValue
,
IValidator
numberValidator
,
int
maxFractionDigits
)
{
NumberFormat
nf
=
NumberFormat
.
getNumberInstance
();
nf
.
setMaximumFractionDigits
(
maxFractionDigits
);
// TextToDoubleValidator checks format of fractional numbers and is hence also suitable for
// BigDecimals
performComplexTextBinding
(
dbc
,
text
,
observedValue
,
fromBigDecimal
(
nf
),
toBigDecimal
(
nf
),
TextToDoubleValidator
.
INSTANCE
,
numberValidator
);
}
/**
/**
* Binds a positive double value with the default number of a maximum of three fraction digits
* Binds a positive double value with the default number of a maximum of three fraction digits
* to be used in the String representation.
* to be used in the String representation.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment