You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/09/13 16:41:48 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-235] Add html font format only option as freetext static property

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 20b4e09  [STREAMPIPES-235] Add html font format only option as freetext static property
     new 3402027  Merge remote-tracking branch 'refs/remotes/origin/dev' into dev
20b4e09 is described below

commit 20b4e09157b60c41c814bc008707436d23301d21
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Sun Sep 13 18:41:08 2020 +0200

    [STREAMPIPES-235] Add html font format only option as freetext static property
---
 .../staticproperty/FreeTextStaticProperty.java     | 12 ++++++++++
 ...AbstractConfigurablePipelineElementBuilder.java | 26 ++++++++++++++++++++++
 .../apache/streampipes/vocabulary/StreamPipes.java |  1 +
 .../app/core-model/gen/streampipes-model-client.ts |  2 +-
 ui/src/app/core-model/gen/streampipes-model.ts     |  8 ++++---
 .../static-free-input.component.html               |  3 ++-
 .../static-free-input.component.ts                 |  5 +++++
 7 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/FreeTextStaticProperty.java b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/FreeTextStaticProperty.java
index 1b004f6..a19581e 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/FreeTextStaticProperty.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/staticproperty/FreeTextStaticProperty.java
@@ -53,6 +53,9 @@ public class FreeTextStaticProperty extends StaticProperty {
   @RdfProperty(StreamPipes.HTML_ALLOWED)
   private boolean htmlAllowed;
 
+  @RdfProperty(StreamPipes.HTML_FONT_FORMAT)
+  private boolean htmlFontFormat;
+
   @RdfProperty(StreamPipes.PLACEHOLDERS_SUPPORTED)
   private boolean placeholdersSupported;
 
@@ -74,6 +77,7 @@ public class FreeTextStaticProperty extends StaticProperty {
     }
     this.value = other.getValue();
     this.htmlAllowed = other.isHtmlAllowed();
+    this.htmlFontFormat = other.isHtmlFontFormat();
     this.multiLine = other.isMultiLine();
     this.placeholdersSupported = other.isPlaceholdersSupported();
     this.mapsTo = other.getMapsTo();
@@ -147,6 +151,14 @@ public class FreeTextStaticProperty extends StaticProperty {
     this.htmlAllowed = htmlAllowed;
   }
 
+  public boolean isHtmlFontFormat() {
+    return htmlFontFormat;
+  }
+
+  public void setHtmlFontFormat(boolean htmlFontFormat) {
+    this.htmlFontFormat = htmlFontFormat;
+  }
+
   public boolean isPlaceholdersSupported() {
     return placeholdersSupported;
   }
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 ca0948d..b94aec3 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
@@ -277,6 +277,32 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
     return me();
   }
 
+  /**
+   * Defines a text-based configuration parameter provided by pipeline developers at pipeline authoring time.
+   * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
+   *              user-friendly manner.
+   * @param multiLine Defines whether the input dialog allows multiple lines.
+   * @param placeholdersSupported Defines whether placeholders are supported, i.e., event property field names that
+   *                              are replaced with the actual value at pipeline execution time.
+   * @param htmlFontFormat Defines to only use bold, italic, striked in dialog.
+   * @return this
+   */
+  public BU requiredTextParameter(Label label, boolean multiLine, boolean placeholdersSupported, boolean htmlFontFormat) {
+    FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._string.toString());
+    if (multiLine) {
+      fsp.setMultiLine(true);
+    }
+    if (placeholdersSupported) {
+      fsp.setPlaceholdersSupported(true);
+    }
+    if (htmlFontFormat) {
+      fsp.setHtmlFontFormat(true);
+    }
+    this.staticProperties.add(fsp);
+
+    return me();
+  }
+
 
   /**
    * @deprecated Use {@link #requiredIntegerParameter(Label)} instead
diff --git a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/StreamPipes.java b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/StreamPipes.java
index 8b78f48..ddea3f1 100644
--- a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/StreamPipes.java
+++ b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/StreamPipes.java
@@ -229,6 +229,7 @@ public class StreamPipes {
   public static final String MAPS_TO = NS + "mapsTo";
   public static final String MULTI_LINE = NS + "multiLine";
   public static final String HTML_ALLOWED = NS + "htmlAllowed";
+  public static final String HTML_FONT_FORMAT = NS + "htmlFontFormat";
   public static final String PLACEHOLDERS_SUPPORTED = NS + "placeholdersSupported";
 
   public static final String HAS_ENDPOINT_URL = NS + "endpointUrl";
diff --git a/ui/src/app/core-model/gen/streampipes-model-client.ts b/ui/src/app/core-model/gen/streampipes-model-client.ts
index 568ed77..7e3d9d7 100644
--- a/ui/src/app/core-model/gen/streampipes-model-client.ts
+++ b/ui/src/app/core-model/gen/streampipes-model-client.ts
@@ -19,7 +19,7 @@
 /* tslint:disable */
 /* eslint-disable */
 // @ts-nocheck
-// Generated using typescript-generator version 2.23.603 on 2020-06-15 21:49:32.
+// Generated using typescript-generator version 2.24.612 on 2020-09-13 16:47:42.
 
 export class MatchingResultMessage {
     description: string;
diff --git a/ui/src/app/core-model/gen/streampipes-model.ts b/ui/src/app/core-model/gen/streampipes-model.ts
index e7e2bbd..7bbb71f 100644
--- a/ui/src/app/core-model/gen/streampipes-model.ts
+++ b/ui/src/app/core-model/gen/streampipes-model.ts
@@ -19,7 +19,7 @@
 /* tslint:disable */
 /* eslint-disable */
 // @ts-nocheck
-// Generated using typescript-generator version 2.24.612 on 2020-09-08 12:28:17.
+// Generated using typescript-generator version 2.24.612 on 2020-09-13 16:47:40.
 
 export class AbstractStreamPipesEntity {
     "@class": "org.apache.streampipes.model.base.NamedStreamPipesEntity" | "org.apache.streampipes.model.connect.adapter.AdapterDescription" | "org.apache.streampipes.model.connect.adapter.AdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.AdapterStreamDescription" | "org.apache.streampipes.model.connect.adapter.G [...]
@@ -1499,6 +1499,7 @@ export class FormatDescriptionList extends NamedStreamPipesEntity {
 export class FreeTextStaticProperty extends StaticProperty {
     "@class": "org.apache.streampipes.model.staticproperty.FreeTextStaticProperty";
     htmlAllowed: boolean;
+    htmlFontFormat: boolean;
     mapsTo: string;
     multiLine: boolean;
     placeholdersSupported: boolean;
@@ -1519,6 +1520,7 @@ export class FreeTextStaticProperty extends StaticProperty {
         instance.mapsTo = data.mapsTo;
         instance.multiLine = data.multiLine;
         instance.htmlAllowed = data.htmlAllowed;
+        instance.htmlFontFormat = data.htmlFontFormat;
         instance.placeholdersSupported = data.placeholdersSupported;
         instance.valueSpecification = PropertyValueSpecification.fromData(data.valueSpecification);
         return instance;
@@ -1559,9 +1561,9 @@ export class GenericAdapterSetDescription extends AdapterSetDescription implemen
         }
         const instance = target || new GenericAdapterSetDescription();
         super.fromData(data, instance);
-        instance.eventSchema = EventSchema.fromData(data.eventSchema);
         instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription);
         instance.formatDescription = FormatDescription.fromData(data.formatDescription);
+        instance.eventSchema = EventSchema.fromData(data.eventSchema);
         return instance;
     }
 }
@@ -1578,9 +1580,9 @@ export class GenericAdapterStreamDescription extends AdapterStreamDescription im
         }
         const instance = target || new GenericAdapterStreamDescription();
         super.fromData(data, instance);
-        instance.eventSchema = EventSchema.fromData(data.eventSchema);
         instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription);
         instance.formatDescription = FormatDescription.fromData(data.formatDescription);
+        instance.eventSchema = EventSchema.fromData(data.eventSchema);
         return instance;
     }
 }
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 4de23d2..1b9cc72 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
@@ -50,7 +50,8 @@
             </div>
         </div>
         <div fxFlex="100" *ngIf="staticProperty.multiLine">
-            <quill-editor #textEditor formControlName="{{fieldName}}" [modules]="quillModules"></quill-editor>
+            <quill-editor *ngIf="staticProperty.htmlFontFormat" #textEditor formControlName="{{fieldName}}" [modules]="quillModulesFontFormat"></quill-editor>
+            <quill-editor *ngIf="!staticProperty.htmlFontFormat" #textEditor formControlName="{{fieldName}}" [modules]="quillModules"></quill-editor>
         </div>
     </div>
 </div>
\ No newline at end of file
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 14342cf..cec677f 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
@@ -45,6 +45,11 @@ export class StaticFreeInputComponent
     ]
   };
 
+  quillModulesFontFormat: any = {
+    toolbar: [['bold', 'italic', 'underline', 'strike'],
+    ]
+  };
+
   @ViewChild('textEditor', {static: false})
   quillEditorComponent: QuillEditorComponent;