This is an automated email from the ASF dual-hosted git repository.
mcasters pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-hop-docs.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 086a5ac HOP-2618 : Metadata plugin dev guide is outdated
new baa8927 Merge pull request #56 from mattcasters/asf-site
086a5ac is described below
commit 086a5ace1590191dafbe60c29169ccd1f8cc71c8
Author: Matt Casters <[email protected]>
AuthorDate: Mon Mar 15 17:12:38 2021 +0100
HOP-2618 : Metadata plugin dev guide is outdated
---
.../modules/ROOT/pages/metadata-plugins.adoc | 25 +++++++++++++++-------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/hop-dev-manual/modules/ROOT/pages/metadata-plugins.adoc
b/hop-dev-manual/modules/ROOT/pages/metadata-plugins.adoc
index a8c81c2..752834e 100644
--- a/hop-dev-manual/modules/ROOT/pages/metadata-plugins.adoc
+++ b/hop-dev-manual/modules/ROOT/pages/metadata-plugins.adoc
@@ -10,7 +10,7 @@ This annotation signals to the Metadata plugin type that
there is something wort
Here are the attributes of the @HopMetadata annotation:
* key : this uniquely identifies the plugin and will be the name of the folder
in which the metadata resides when serialising to JSON (see below)
-* name : a human readable name
+* name : a human-readable name
* description : an extended description
* image : the path to an image which helps identify the metadata in the Hop GUI
@@ -42,19 +42,28 @@ Here are the supported data types:
* POJO : Any class with more @HopMetadataProperty annotations in it.
-== The dialog to edit the metadata
+== An Editor class to edit the metadata
-You also want to have a dialog to edit the metadata. This can be any old SWT
dialog as long as it implements the IMetadataDialog interface it will be picked
up.
+You also want to have a way to edit the metadata in the GUI. This can be done
by extending the class `MetadataEditor<IHopMetadata>`.
-Example:
https://github.com/apache/incubator-hop/blob/2e16685ad80a3bc213d796366316d18f7bfd74d2/ui/src/main/java/org/apache/hop/ui/partition/PartitionSchemaDialog.java#L71[PartitionSchemaDialog.java]
+Example:
https://github.com/apache/incubator-hop/blob/master/ui/src/main/java/org/apache/hop/ui/partition/PartitionSchemaEditor.java[PartitionSchemaEditor.java]
-The path to the Dialog class will be found automatically by looking at the
name of the metadata class and then simply by appending Dialog to it.
-If you prefer to keep metadata and GUI code separate the Hop GUI will also
look in package ```org.apache.hop.ui``` instead of ```org.apache.hop```
+The path to the Editor class will be found automatically by looking at the
name of the metadata plugin class and then simply by appending Editor to it.
+If you prefer to keep metadata and GUI code separate the Hop GUI will also
look in package `org.apache.hop.ui` instead of `org.apache.hop`
Working examples:
-* ```org.apache.hop.path.to.MyMetadata``` ->
```org.apache.hop.path.to.MyMetadataDialog```
-* ```org.apache.hop.my.plugin.MyMetadata``` ->
```org.apache.hop.ui.my.plugin.MyMetadataDialog```
+* `org.apache.hop.path.to.MyMetadata` ->
`org.apache.hop.path.to.MyMetadataEditor`
+* `org.apache.hop.partition.PartitionSchema` ->
`org.apache.hop.ui.partition.PartitionSchemaEditor`
+
+=== Some methods explained
+
+* createControl() : create the various controls on the given parent Composite.
The composite has a FormLayout set.
+* setWidgetsContent(): Using the metadata object (or getMetadata()) you can
set the content on the created controls.
+* getWidgetsContent(): Grab the values of the various controls and modify the
metadata
+* save(): verify settings, grab metadata and call super.save()
+* setFocus(): sets the focus on the metadata dialog or tab. Choose the
control to set the focus to (usually the name).
+* createButtonsForButtonBar(): if you want to add buttons at the bottom to do
things like testing, viewing, ... you can use this method
== Metadata serialisation