You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2020/06/27 21:48:49 UTC
[incubator-streampipes] branch STREAMPIPES-145 updated (acd0f37 ->
02c2dd9)
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a change to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git.
from acd0f37 [STREAMPIPES-145] Improve form validation of static properties
new 932113b [STREAMPIPES-145] Migrate secret static property
new a40f638 [STREAMPIPES-166] Add color picker static property to SDK
new 02c2dd9 [STREAMPIPES-145] Migrate color picker static property
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/streampipes/model/util/Cloner.java | 2 +
...AbstractConfigurablePipelineElementBuilder.java | 30 +++++++
.../sdk/extractor/AbstractParameterExtractor.java | 4 +
ui/src/app/connect/connect.module.ts | 6 --
.../static-color-picker.component.html | 19 ++--
.../static-color-picker.component.ts | 32 +++----
.../static-mapping-nary.component.ts | 6 ++
.../static-property.component.html | 100 ++++++++++++---------
.../static-secret-input.component.html | 18 ++--
.../static-secret-input.component.ts | 36 +++-----
10 files changed, 137 insertions(+), 116 deletions(-)
[incubator-streampipes] 03/03: [STREAMPIPES-145] Migrate color
picker static property
Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 02c2dd98ccfb29fb382e87d9a2975e1b9508b31e
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Sat Jun 27 23:47:52 2020 +0200
[STREAMPIPES-145] Migrate color picker static property
---
.../static-color-picker.component.html | 19 ++--
.../static-color-picker.component.ts | 32 +++----
.../static-mapping-nary.component.ts | 6 ++
.../static-property.component.html | 100 ++++++++++++---------
4 files changed, 80 insertions(+), 77 deletions(-)
diff --git a/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.html b/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.html
index f271259..35f6795 100644
--- a/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.html
+++ b/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.html
@@ -15,22 +15,17 @@
~ limitations under the License.
~
-->
-<div id="formWrapper">
- <div fxFlex="100">
- <p>{{staticProperty.label}}: <br>
- <mat-hint class="description">{{staticProperty.description}}</mat-hint>
- </p>
- </div>
+<div [formGroup]="parentForm" id="formWrapper">
<div fxFlex="100" fxLayout="row">
- <form [formGroup]="colorPickerForm">
<mat-form-field>
- <input matInput id="{{ 'input-' + staticProperty.label.toLowerCase() }}"
- [(colorPicker)]="staticPropertyUtil.asColorPickerStaticProperty(staticProperty).selectedColor"
- formControlName="colorPickerStaticProperty"
- [style.background]="staticPropertyUtil.asColorPickerStaticProperty(staticProperty).selectedColor" required
+ <input matInput
+ [(colorPicker)]="staticProperty.selectedColor"
+ (colorPickerChange)="parentForm.get(staticProperty.internalName).setValue($event)"
+ [cpPosition]="'bottom'"
+ formControlName="{{staticProperty.internalName}}"
+ [style.background]="staticProperty.selectedColor" required
(blur)="emitUpdate()" [cpPresetColors] = "presetColors"/>
</mat-form-field>
- </form>
</div>
</div>
diff --git a/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.ts b/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.ts
index 77fe77a..4767af1 100644
--- a/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.ts
+++ b/ui/src/app/connect/static-properties/static-color-picker/static-color-picker.component.ts
@@ -22,6 +22,7 @@ import {StaticPropertyUtilService} from "../static-property-util.service";
import {FormControl, FormGroup, Validators} from "@angular/forms";
import {AbstractStaticPropertyRenderer} from "../base/abstract-static-property";
import {ColorPickerStaticProperty} from "../../../core-model/gen/streampipes-model";
+import {AbstractValidatedStaticPropertyRenderer} from "../base/abstract-validated-static-property";
@Component({
selector: 'app-static-color-picker',
@@ -29,16 +30,12 @@ import {ColorPickerStaticProperty} from "../../../core-model/gen/streampipes-mod
styleUrls: ['./static-color-picker.component.css']
})
export class StaticColorPickerComponent
- extends AbstractStaticPropertyRenderer<ColorPickerStaticProperty> implements OnInit {
+ extends AbstractValidatedStaticPropertyRenderer<ColorPickerStaticProperty> implements OnInit {
constructor(public staticPropertyUtil: StaticPropertyUtilService){
super();
}
- @Output() updateEmitter: EventEmitter<ConfigurationInfo> = new EventEmitter();
-
- @Output() inputEmitter: EventEmitter<any> = new EventEmitter<any>();
-
inputValue: String;
hasInput: Boolean;
colorPickerForm: FormGroup;
@@ -46,28 +43,19 @@ export class StaticColorPickerComponent
presetColors: Array<any> = ["#39B54A", "#1B1464", "#f44336", "#4CAF50", "#FFEB3B", "#FFFFFF", "#000000"];
ngOnInit() {
- this.colorPickerForm = new FormGroup({
- 'colorPickerStaticProperty': new FormControl(this.inputValue, [
- Validators.required
- ]),
- })
- this.inputEmitter.emit(true);
+ this.addValidator(this.staticProperty.selectedColor, Validators.required);
+ this.enableValidators();
}
- valueChange(inputValue) {
- this.inputValue = inputValue;
- if (inputValue == "" || !inputValue) {
- this.hasInput = false;
- } else {
- this.hasInput = true;
- }
-
- this.inputEmitter.emit(this.hasInput);
+ emitUpdate() {
+ this.updateEmitter.emit(new ConfigurationInfo(this.staticProperty.internalName, this.staticPropertyUtil.asColorPickerStaticProperty(this.staticProperty).selectedColor && this.staticPropertyUtil.asColorPickerStaticProperty(this.staticProperty).selectedColor !== ""));
+ }
+ onStatusChange(status: any) {
}
- emitUpdate() {
- this.updateEmitter.emit(new ConfigurationInfo(this.staticProperty.internalName, this.staticPropertyUtil.asColorPickerStaticProperty(this.staticProperty).selectedColor && this.staticPropertyUtil.asColorPickerStaticProperty(this.staticProperty).selectedColor !== ""));
+ onValueChange(value: any) {
+
}
}
\ No newline at end of file
diff --git a/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts b/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts
index a92e9d2..40e2257 100644
--- a/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts
+++ b/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts
@@ -102,4 +102,10 @@ export class StaticMappingNaryComponent extends StaticMappingComponent<MappingPr
});
}
+ onStatusChange(status: any) {
+ }
+
+ onValueChange(value: any) {
+ }
+
}
\ No newline at end of file
diff --git a/ui/src/app/connect/static-properties/static-property.component.html b/ui/src/app/connect/static-properties/static-property.component.html
index 545c582..76e3524 100644
--- a/ui/src/app/connect/static-properties/static-property.component.html
+++ b/ui/src/app/connect/static-properties/static-property.component.html
@@ -17,62 +17,76 @@
-->
<div fxFlex="100" fxLayout="column">
-<div fxFlex="100">{{staticProperty.label}}</div>
+ <div fxFlex="100">{{staticProperty.label}}</div>
-<app-static-secret-input *ngIf="isSecretStaticProperty(staticProperty)"
- (updateEmitter)="emitUpdate($event)" [staticProperty]="staticProperty" [parentForm]="parentForm">
-</app-static-secret-input>
+ <app-static-secret-input *ngIf="isSecretStaticProperty(staticProperty)"
+ [staticProperty]="staticProperty"
+ [parentForm]="parentForm"
+ (updateEmitter)="emitUpdate($event)">
+ </app-static-secret-input>
-<app-static-free-input *ngIf="isFreeTextStaticProperty(staticProperty)"
- (updateEmitter)="emitUpdate($event)" [staticProperty]="staticProperty" [parentForm]="parentForm">
-</app-static-free-input>
+ <app-static-free-input *ngIf="isFreeTextStaticProperty(staticProperty)"
+ [staticProperty]="staticProperty"
+ [parentForm]="parentForm"
+ (updateEmitter)="emitUpdate($event)">
+ </app-static-free-input>
-<app-static-file-input *ngIf="isFileStaticProperty(staticProperty)"
- (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty" [adapterId]="adapterId">
-</app-static-file-input>
+ <app-static-file-input *ngIf="isFileStaticProperty(staticProperty)"
+ (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"
+ [adapterId]="adapterId">
+ </app-static-file-input>
-<app-static-color-picker *ngIf="isColorPickerStaticProperty(staticProperty)"
- (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty">
-</app-static-color-picker>
+ <app-static-color-picker *ngIf="isColorPickerStaticProperty(staticProperty)"
+ [staticProperty]="staticProperty"
+ [parentForm]="parentForm"
+ (updateEmitter)="emitUpdate($event)">
+ </app-static-color-picker>
-<app-static-runtime-resolvable-any-input *ngIf="isRuntimeResolvableAnyStaticProperty(staticProperty)"
- (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"></app-static-runtime-resolvable-any-input>
+ <app-static-runtime-resolvable-any-input *ngIf="isRuntimeResolvableAnyStaticProperty(staticProperty)"
+ (inputEmitter)="valueChange($event)"
+ [staticProperty]="staticProperty"></app-static-runtime-resolvable-any-input>
-<app-static-runtime-resolvable-oneof-input *ngIf="isRuntimeResolvableOneOfStaticProperty(staticProperty)"
-(inputEmitter)="valueChange($event)" [completedStaticProperty]="completedStaticProperty" [staticProperty]="staticProperty" [staticProperties]="staticProperties" [adapterId]="adapterId"></app-static-runtime-resolvable-oneof-input>
+ <app-static-runtime-resolvable-oneof-input *ngIf="isRuntimeResolvableOneOfStaticProperty(staticProperty)"
+ (inputEmitter)="valueChange($event)"
+ [completedStaticProperty]="completedStaticProperty"
+ [staticProperty]="staticProperty" [staticProperties]="staticProperties"
+ [adapterId]="adapterId"></app-static-runtime-resolvable-oneof-input>
-<app-static-any-input *ngIf="isAnyStaticProperty(staticProperty) && !isRuntimeResolvableAnyStaticProperty(staticProperty)"
- (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"></app-static-any-input>
+ <app-static-any-input
+ *ngIf="isAnyStaticProperty(staticProperty) && !isRuntimeResolvableAnyStaticProperty(staticProperty)"
+ (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty"></app-static-any-input>
-<app-static-one-of-input *ngIf="isOneOfStaticProperty(staticProperty) && !isRuntimeResolvableOneOfStaticProperty(staticProperty)"
- (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty">
-</app-static-one-of-input>
+ <app-static-one-of-input
+ *ngIf="isOneOfStaticProperty(staticProperty) && !isRuntimeResolvableOneOfStaticProperty(staticProperty)"
+ (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty">
+ </app-static-one-of-input>
-<app-static-mapping-unary *ngIf="isMappingPropertyUnary(staticProperty)"
- [eventSchemas]="eventSchemas" (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty" [parentForm]="parentForm">
-</app-static-mapping-unary>
+ <app-static-mapping-unary *ngIf="isMappingPropertyUnary(staticProperty)"
+ [eventSchemas]="eventSchemas" (inputEmitter)="valueChange($event)"
+ [staticProperty]="staticProperty" [parentForm]="parentForm">
+ </app-static-mapping-unary>
-<app-static-mapping-nary *ngIf="isMappingNaryProperty(staticProperty)" [eventSchemas]="eventSchemas"
- (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty">
-</app-static-mapping-nary>
+ <app-static-mapping-nary *ngIf="isMappingNaryProperty(staticProperty)" [eventSchemas]="eventSchemas"
+ (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty">
+ </app-static-mapping-nary>
-<app-static-alternatives *ngIf="isAlternativesStaticProperty(staticProperty)"
- [adapterId]="adapterId" [eventSchemas]="eventSchemas"
- [staticProperty]="staticProperty" class="test fullWidth"
- (inputEmitter)="valueChange($event)">
-</app-static-alternatives>
+ <app-static-alternatives *ngIf="isAlternativesStaticProperty(staticProperty)"
+ [adapterId]="adapterId" [eventSchemas]="eventSchemas"
+ [staticProperty]="staticProperty" class="test fullWidth"
+ (inputEmitter)="valueChange($event)">
+ </app-static-alternatives>
-<app-static-group *ngIf="isGroupStaticProperty(staticProperty)"
- [adapterId]="adapterId" [eventSchemas]="eventSchemas"
- [staticProperty]="staticProperty" class="test fullWidth"
- (inputEmitter)="valueChange($event)">
-</app-static-group>
+ <app-static-group *ngIf="isGroupStaticProperty(staticProperty)"
+ [adapterId]="adapterId" [eventSchemas]="eventSchemas"
+ [staticProperty]="staticProperty" class="test fullWidth"
+ (inputEmitter)="valueChange($event)">
+ </app-static-group>
-<app-static-collection *ngIf="isCollectionStaticProperty(staticProperty)"
- [adapterId]="adapterId" [eventSchemas]="eventSchemas"
- [staticProperty]="staticProperty" class="test fullWidth"
- (inputEmitter)="valueChange($event)" (updateEmitter)="emitUpdate($event)">
-</app-static-collection>
+ <app-static-collection *ngIf="isCollectionStaticProperty(staticProperty)"
+ [adapterId]="adapterId" [eventSchemas]="eventSchemas"
+ [staticProperty]="staticProperty" class="test fullWidth"
+ (inputEmitter)="valueChange($event)" (updateEmitter)="emitUpdate($event)">
+ </app-static-collection>
</div>
<mat-divider></mat-divider>
[incubator-streampipes] 01/03: [STREAMPIPES-145] Migrate secret
static property
Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 932113bed822209c77f34d320488cacbd038aa17
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Sat Jun 27 23:02:33 2020 +0200
[STREAMPIPES-145] Migrate secret static property
---
ui/src/app/connect/connect.module.ts | 6 ----
.../static-property.component.html | 2 +-
.../static-secret-input.component.html | 18 ++++++-----
.../static-secret-input.component.ts | 36 +++++++---------------
4 files changed, 22 insertions(+), 40 deletions(-)
diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts
index e4ea1d6..719c0af 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -46,10 +46,7 @@ import {DragulaModule} from 'ng2-dragula';
import {AdapterStartedDialog} from './new-adapter/component/adapter-started-dialog.component';
import {DataTypesService} from './schema-editor/data-type.service';
import {StaticFreeInputComponent} from './static-properties/static-free-input/static-free-input.component';
-import {StaticNumberInputComponent} from './static-properties/static-number-input/static-number-input.component';
import {StaticPropertyUtilService} from './static-properties/static-property-util.service';
-import {StaticTextInputComponent} from './static-properties/static-text-input/static-text-input.component';
-import {StaticUrlInputComponent} from './static-properties/static-url-input/static-url-input.component';
import {TransformationRuleService} from './transformation-rule.service';
import {StaticSecretInputComponent} from "./static-properties/static-secret-input/static-secret-input.component";
@@ -133,9 +130,6 @@ import {xsService} from "../NS/XS.service";
AdapterStartedDialog,
AdapterExportDialog,
AdapterUploadDialog,
- StaticNumberInputComponent,
- StaticUrlInputComponent,
- StaticTextInputComponent,
StaticFreeInputComponent,
StaticSecretInputComponent,
StaticFileInputComponent,
diff --git a/ui/src/app/connect/static-properties/static-property.component.html b/ui/src/app/connect/static-properties/static-property.component.html
index 476c4f5..545c582 100644
--- a/ui/src/app/connect/static-properties/static-property.component.html
+++ b/ui/src/app/connect/static-properties/static-property.component.html
@@ -20,7 +20,7 @@
<div fxFlex="100">{{staticProperty.label}}</div>
<app-static-secret-input *ngIf="isSecretStaticProperty(staticProperty)"
- (updateEmitter)="emitUpdate($event)" (inputEmitter)="valueChange($event)" [staticProperty]="staticProperty">
+ (updateEmitter)="emitUpdate($event)" [staticProperty]="staticProperty" [parentForm]="parentForm">
</app-static-secret-input>
<app-static-free-input *ngIf="isFreeTextStaticProperty(staticProperty)"
diff --git a/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.html b/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.html
index e9cd9cf..6568b61 100644
--- a/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.html
+++ b/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.html
@@ -16,19 +16,21 @@
~
-->
-<div id="formWrapper" fxFlex="100" fxLayout="column">
+<div [formGroup]="parentForm" id="formWrapper" fxFlex="100" fxLayout="column">
<div fxFlex="100" fxLayout="row">
- <form [formGroup]="secretForm" fxFlex="100">
<mat-form-field fxFlex >
- <input type="password" fxFlex id="{{ 'input-' + staticProperty.label.toLowerCase() }}" matInput [placeholder]="staticProperty.label" [(ngModel)]="staticPropertyUtil.asSecretStaticProperty(staticProperty).value"
- formControlName="secretStaticProperty" (ngModelChange)="valueChange(staticPropertyUtil.asSecretStaticProperty(staticProperty).value)"
- required (blur)="emitUpdate()">
+ <input type="password"
+ fxFlex
+ formControlName="{{staticProperty.internalName}}"
+ matInput
+ [placeholder]="staticProperty.label"
+ required
+ (blur)="emitUpdate()">
<mat-hint>{{staticProperty.description}}</mat-hint>
- <mat-error *ngIf="!hasInput">
- {{staticProperty.errorMessage}}
+ <mat-error *ngIf="!fieldValid">
+ {{errorMessage}}
</mat-error>
</mat-form-field>
- </form>
</div>
</div>
\ No newline at end of file
diff --git a/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.ts b/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.ts
index 0aff985..058c70e 100644
--- a/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.ts
+++ b/ui/src/app/connect/static-properties/static-secret-input/static-secret-input.component.ts
@@ -22,6 +22,7 @@ import {StaticPropertyUtilService} from '../static-property-util.service';
import {ConfigurationInfo} from "../../model/message/ConfigurationInfo";
import {SecretStaticProperty} from "../../../core-model/gen/streampipes-model";
import {AbstractStaticPropertyRenderer} from "../base/abstract-static-property";
+import {AbstractValidatedStaticPropertyRenderer} from "../base/abstract-validated-static-property";
@Component({
selector: 'app-static-secret-input',
@@ -29,7 +30,7 @@ import {AbstractStaticPropertyRenderer} from "../base/abstract-static-property";
styleUrls: ['./static-secret-input.component.css']
})
export class StaticSecretInputComponent
- extends AbstractStaticPropertyRenderer<SecretStaticProperty> implements OnInit {
+ extends AbstractValidatedStaticPropertyRenderer<SecretStaticProperty> implements OnInit {
constructor(public staticPropertyUtil: StaticPropertyUtilService){
super();
@@ -37,37 +38,22 @@ export class StaticSecretInputComponent
@Output() updateEmitter: EventEmitter<ConfigurationInfo> = new EventEmitter();
- @Output() inputEmitter: EventEmitter<any> = new EventEmitter<any>();
-
- inputValue: String;
- hasInput: Boolean;
- secretForm: FormGroup;
- private errorMessage = "Please enter a valid Text";
-
ngOnInit() {
- this.secretForm = new FormGroup({
- 'secretStaticProperty': new FormControl(this.inputValue, [
- Validators.required
- ]),
- })
+ this.addValidator(this.staticProperty.value, Validators.required);
+ this.enableValidators();
}
- valueChange(inputValue) {
- this.inputValue = inputValue;
- this.staticPropertyUtil.asSecretStaticProperty(this.staticProperty).encrypted = false;
- if (inputValue == "" || !inputValue) {
- this.hasInput = false;
- } else {
- this.hasInput = true;
- }
-
- this.inputEmitter.emit(this.hasInput);
+ emitUpdate() {
+ this.updateEmitter.emit(new ConfigurationInfo(this.staticProperty.internalName, this.staticPropertyUtil.asFreeTextStaticProperty(this.staticProperty).value && this.staticPropertyUtil.asFreeTextStaticProperty(this.staticProperty).value !== ""));
+ }
+ onStatusChange(status: any) {
}
- emitUpdate() {
- this.updateEmitter.emit(new ConfigurationInfo(this.staticProperty.internalName, this.staticPropertyUtil.asFreeTextStaticProperty(this.staticProperty).value && this.staticPropertyUtil.asFreeTextStaticProperty(this.staticProperty).value !== ""));
+ onValueChange(value: any) {
+ this.staticProperty.value = value;
+ this.staticProperty.encrypted=false;
}
}
\ No newline at end of file
[incubator-streampipes] 02/03: [STREAMPIPES-166] Add color picker
static property to SDK
Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit a40f6388828e065aa697905ea202a00d425ea7ff
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Sat Jun 27 23:34:40 2020 +0200
[STREAMPIPES-166] Add color picker static property to SDK
---
.../org/apache/streampipes/model/util/Cloner.java | 2 ++
...AbstractConfigurablePipelineElementBuilder.java | 30 ++++++++++++++++++++++
.../sdk/extractor/AbstractParameterExtractor.java | 4 +++
3 files changed, 36 insertions(+)
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java b/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java
index 7d3b871..ee0ca20 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/util/Cloner.java
@@ -120,6 +120,8 @@ public class Cloner {
return new FileStaticProperty((FileStaticProperty) o);
} else if (o instanceof CodeInputStaticProperty) {
return new CodeInputStaticProperty((CodeInputStaticProperty) o);
+ } else if (o instanceof ColorPickerStaticProperty) {
+ return new ColorPickerStaticProperty((ColorPickerStaticProperty) o);
} else {
return new StaticPropertyAlternative((StaticPropertyAlternative) o);
}
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 57646ed..7d67e4a 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
@@ -169,6 +169,36 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
return me();
}
+ /**
+ * Assigns a new color picker parameter which is required by the pipeline
+ * element.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
+ * user-friendly manner.
+ *
+ * @return
+ */
+ public BU requiredColorParameter(Label label) {
+ ColorPickerStaticProperty csp = new ColorPickerStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
+ this.staticProperties.add(csp);
+
+ return me();
+ }
+
+ /**
+ * Assigns a new color picker parameter which is required by the pipeline
+ * element.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
+ * user-friendly manner.
+ * @param defaultColor The default color, encoded as an HTML color code
+ * @return
+ */
+ public BU requiredColorParameter(Label label, String defaultColor) {
+ ColorPickerStaticProperty csp = new ColorPickerStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
+ csp.setSelectedColor(defaultColor);
+ this.staticProperties.add(csp);
+
+ return me();
+ }
/**
* @deprecated Use {@link #requiredTextParameter(Label, String)}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
index e80577b..ab2c51d 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
@@ -92,6 +92,10 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
return getStaticPropertyByName(internalName,CodeInputStaticProperty.class).getValue();
}
+ public String selectedColor(String internalName) {
+ return getStaticPropertyByName(internalName, ColorPickerStaticProperty.class).getSelectedColor();
+ }
+
public String fileContentsAsString(String internalName) throws IOException {
String filename =
getStaticPropertyByName(internalName, FileStaticProperty.class).getLocationPath();