This is an automated email from the ASF dual-hosted git repository.
wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new a20d55f [STREAMPIPES-220] Add builder method for
requiredFloatParameters, fix render issue in mat-slider
a20d55f is described below
commit a20d55f5a7a4a6d1b5b9b68eff7d01675ccb55ae
Author: Patrick Wiener <[email protected]>
AuthorDate: Thu Sep 3 15:01:07 2020 +0200
[STREAMPIPES-220] Add builder method for requiredFloatParameters, fix
render issue in mat-slider
---
...AbstractConfigurablePipelineElementBuilder.java | 87 ++++++++++++++++------
.../static-free-input.component.html | 3 +-
.../static-free-input.component.ts | 7 ++
3 files changed, 73 insertions(+), 24 deletions(-)
diff --git
a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
index 7d67e4a..ca0948d 100644
---
a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
+++
b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
@@ -488,6 +488,70 @@ public abstract class
AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
+ * @deprecated Use {@link #requiredFloatParameter(Label, Float, Float,
Float)} instead.
+ * Defines a number-based configuration parameter of type float provided by
preprocessing developers at preprocessing
+ * authoring time. In addition, an allowed value range of the expected input
can be assigned.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that
describes why this parameter is needed in a
+ * user-friendly manner.
+ * @param min The minimum value of the allowed value range.
+ * @param max The maximum value of the allowed value range.
+ * @param step The granularity
+ * @return this
+ */
+ public BU requiredFloatParameter(String internalId, String label, String
description, Float min, Float max, Float step) {
+ FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
+ label,
+ description,
+ XSD._double.toString());
+
+ PropertyValueSpecification valueSpecification = new
PropertyValueSpecification(min, max, step);
+ fsp.setValueSpecification(valueSpecification);
+ this.staticProperties.add(fsp);
+
+ return me();
+ }
+
+ /**
+ * Defines a number-based configuration parameter of type float provided by
preprocessing developers at preprocessing
+ * authoring time. In addition, an allowed value range of the expected input
can be assigned.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that
describes why this parameter is needed in a
+ * user-friendly manner.
+ * @param min The minimum value of the allowed value range.
+ * @param max The maximum value of the allowed value range.
+ * @param step The granularity
+ * @return this
+ */
+ public BU requiredFloatParameter(Label label, Float min, Float max, Float
step) {
+ FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label,
XSD._double.toString());
+ PropertyValueSpecification valueSpecification = new
PropertyValueSpecification(min, max, step);
+ fsp.setValueSpecification(valueSpecification);
+ this.staticProperties.add(fsp);
+
+ return me();
+ }
+
+ /**
+ * Defines a number-based configuration parameter of type float provided by
preprocessing developers at preprocessing
+ * authoring time. In addition, an allowed value range of the expected input
can be assigned.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that
describes why this parameter is needed in a
+ * user-friendly manner.
+ * @param defaultValue The default float value.
+ * @param min The minimum value of the allowed value range.
+ * @param max The maximum value of the allowed value range.
+ * @param step The granularity
+ * @return this
+ */
+ public BU requiredFloatParameter(Label label, Float defaultValue, Float min,
Float max, Float step) {
+ FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label,
XSD._double.toString());
+ fsp.setValue(String.valueOf(defaultValue));
+ PropertyValueSpecification valueSpecification = new
PropertyValueSpecification(min, max, step);
+ fsp.setValueSpecification(valueSpecification);
+ this.staticProperties.add(fsp);
+
+ return me();
+ }
+
+ /**
* @deprecated Use {@link #requiredSingleValueSelection(Label, Option...)}
instead.
* @param options An arbitrary number of {@link
org.apache.streampipes.model.staticproperty.Option} elements. Use
* {@link org.apache.streampipes.sdk.helpers.Options} to create option
elements from string values.
@@ -631,29 +695,6 @@ public abstract class
AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- * Defines a number-based configuration parameter of type float provided by
preprocessing developers at preprocessing
- * authoring time. In addition, an allowed value range of the expected input
can be assigned.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that
describes why this parameter is needed in a
- * user-friendly manner.
- * @param min The minimum value of the allowed value range.
- * @param max The maximum value of the allowed value range.
- * @param step The granularity
- * @return this
- */
- public BU requiredFloatParameter(String internalId, String label, String
description, Float min, Float max, Float step) {
- FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._double.toString());
-
- PropertyValueSpecification valueSpecification = new
PropertyValueSpecification(min, max, step);
- fsp.setValueSpecification(valueSpecification);
- this.staticProperties.add(fsp);
-
- return me();
- }
-
- /**
*
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that
describes why this parameter is needed in a
* user-friendly manner.
diff --git
a/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.html
b/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.html
index fbefc7f..4de23d2 100644
---
a/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.html
+++
b/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.html
@@ -35,7 +35,8 @@
<mat-slider thumbLabel formControlName="{{fieldName}}"
[max]="staticProperty.valueSpecification.maxValue"
[min]="staticProperty.valueSpecification.minValue"
- [step]="staticProperty.valueSpecification.step">
+ [step]="staticProperty.valueSpecification.step"
+ [displayWith]="formatLabel">
</mat-slider>
</div>
</div>
diff --git
a/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
b/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
index 0cb54bb..14342cf 100644
---
a/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
+++
b/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
@@ -95,4 +95,11 @@ export class StaticFreeInputComponent
let currentIndex =
this.quillEditorComponent.quillEditor.selection.savedRange.index;
this.quillEditorComponent.quillEditor.insertText(currentIndex, "#" +
runtimeName + "#", "user");
}
+
+ formatLabel(value: number) {
+ if (!Number.isInteger(value)) {
+ value = Number((value).toFixed(1));
+ }
+ return value;
+ }
}
\ No newline at end of file