You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/10/13 18:56:02 UTC

[incubator-hop] branch master updated: HOP-3375 Fix layout with GuiCompositeWidgets

This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git


The following commit(s) were added to refs/heads/master by this push:
     new f4705ff  HOP-3375 Fix layout with GuiCompositeWidgets
     new ea8192a  Merge pull request #1129 from nadment/HOP-3375
f4705ff is described below

commit f4705ffb8bb8e7b8d81d0cd3a98e001ea9dbe60b
Author: Nicolas Adment <na...@gmail.com>
AuthorDate: Sun Oct 10 21:51:10 2021 +0200

    HOP-3375 Fix layout with GuiCompositeWidgets
---
 .../metadata/CassandraConnectionEditor.java        |  4 +--
 .../mongo/metadata/MongoDbConnectionEditor.java    |  5 ++-
 .../hop/ui/core/database/DatabaseMetaEditor.java   |  7 ++---
 .../hop/ui/core/dialog/EnterOptionsDialog.java     |  2 +-
 .../hop/ui/core/gui/GuiCompositeWidgets.java       | 36 +++++++++++-----------
 .../config/PipelineRunConfigurationEditor.java     | 10 +++---
 .../config/WorkflowRunConfigurationEditor.java     | 10 +++---
 7 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnectionEditor.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnectionEditor.java
index 27b95ce..0660ed7 100644
--- a/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnectionEditor.java
+++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnectionEditor.java
@@ -69,7 +69,7 @@ public class CassandraConnectionEditor extends MetadataEditor<CassandraConnectio
     props.setLook(wlName);
     wlName.setText("Cassandra connection name");
     FormData fdlName = new FormData();
-    fdlName.top = new FormAttachment(0, 0);
+    fdlName.top = new FormAttachment(0, margin * 2);
     fdlName.left = new FormAttachment(0, 0);
     fdlName.right = new FormAttachment(middle, 0);
     wlName.setLayoutData(fdlName);
@@ -83,7 +83,7 @@ public class CassandraConnectionEditor extends MetadataEditor<CassandraConnectio
 
     // Rest of the widgets...
     //
-    widgets = new GuiCompositeWidgets(manager.getVariables(), 18);
+    widgets = new GuiCompositeWidgets(manager.getVariables());
     widgets.createCompositeWidgets(getMetadata(), null, parent, PARENT_WIDGET_ID, wName);
 
     // Set content on the widgets...
diff --git a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java
index e625e53..e7f410a 100644
--- a/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java
+++ b/plugins/transforms/mongodb/src/main/java/org/apache/hop/mongo/metadata/MongoDbConnectionEditor.java
@@ -67,12 +67,11 @@ public class MongoDbConnectionEditor extends MetadataEditor<MongoDbConnection>
 
     // Name...
     //
-    // What's the name
     Label wlName = new Label(parent, SWT.RIGHT);
     props.setLook(wlName);
     wlName.setText("MongoDB Connection name");
     FormData fdlName = new FormData();
-    fdlName.top = new FormAttachment(0, 0);
+    fdlName.top = new FormAttachment(0, margin * 2);
     fdlName.left = new FormAttachment(0, 0);
     fdlName.right = new FormAttachment(middle, 0);
     wlName.setLayoutData(fdlName);
@@ -86,7 +85,7 @@ public class MongoDbConnectionEditor extends MetadataEditor<MongoDbConnection>
 
     // Rest of the widgets...
     //
-    widgets = new GuiCompositeWidgets(manager.getVariables(), 18);
+    widgets = new GuiCompositeWidgets(manager.getVariables());
     widgets.createCompositeWidgets(getMetadata(), null, parent, PARENT_WIDGET_ID, wName);
 
     // Set content on the widgets...
diff --git a/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java b/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java
index 8dd2405..530a574 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/database/DatabaseMetaEditor.java
@@ -297,8 +297,7 @@ public class DatabaseMetaEditor extends MetadataEditor<DatabaseMeta> {
     FormData fdDatabaseSpecificComp = new FormData();
     fdDatabaseSpecificComp.left = new FormAttachment(0, 0);
     fdDatabaseSpecificComp.right = new FormAttachment(100, 0);
-    fdDatabaseSpecificComp.top = new FormAttachment(lastControl, 2 * margin);
-    fdDatabaseSpecificComp.bottom = new FormAttachment(100, 0);
+    fdDatabaseSpecificComp.top = new FormAttachment(lastControl, margin);
     wDatabaseSpecificComp.setLayoutData(fdDatabaseSpecificComp);
     lastControl = wDatabaseSpecificComp;
 
@@ -306,7 +305,7 @@ public class DatabaseMetaEditor extends MetadataEditor<DatabaseMeta> {
 
     // Now add the database plugin specific widgets
     //
-    guiCompositeWidgets = new GuiCompositeWidgets(manager.getVariables(), 8); // max 6 lines
+    guiCompositeWidgets = new GuiCompositeWidgets(manager.getVariables());
     guiCompositeWidgets.createCompositeWidgets(
         getMetadata().getIDatabase(),
         null,
@@ -665,7 +664,7 @@ public class DatabaseMetaEditor extends MetadataEditor<DatabaseMeta> {
         new TableView(
             manager.getVariables(),
             wOptionsComp,
-            SWT.NONE,
+            SWT.BORDER,
             optionsColumns,
             databaseMeta.getExtraOptions().size(),
             event -> setChanged(),
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java
index b199393..ccd83ed 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/EnterOptionsDialog.java
@@ -1223,7 +1223,7 @@ public class EnterOptionsDialog extends Dialog {
           props.setLook(wPluginsComp);
           wPluginsComp.setLayout(new FormLayout());
 
-          GuiCompositeWidgets compositeWidgets = new GuiCompositeWidgets(hopGui.getVariables(), 20);
+          GuiCompositeWidgets compositeWidgets = new GuiCompositeWidgets(hopGui.getVariables());
           compositeWidgets.createCompositeWidgets(
               sourceData, null, wPluginsComp, GUI_WIDGETS_PARENT_ID, null);
           compositeWidgets.setWidgetsContents(sourceData, wPluginsComp, GUI_WIDGETS_PARENT_ID);
diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java
index c315af8..c5181c7 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiCompositeWidgets.java
@@ -58,10 +58,10 @@ public class GuiCompositeWidgets {
 
   public GuiCompositeWidgets(IVariables variables, int maxNrItems) {
     this.variables = variables;
-    this.maxNrItems = maxNrItems;
+   // this.maxNrItems = maxNrItems;
     labelsMap = new HashMap<>();
     widgetsMap = new HashMap<>();
-    nrItems = 0;
+   // nrItems = 0;
     compositeWidgetsListener = null;
   }
 
@@ -133,7 +133,7 @@ public class GuiCompositeWidgets {
         if (lastControl == null) {
           fdLabel.top = new FormAttachment(0, props.getMargin());
         } else {
-          fdLabel.top = new FormAttachment(lastControl, props.getMargin());
+          fdLabel.top = new FormAttachment(lastControl, props.getMargin() * 2);
         }
         fdLabel.right = new FormAttachment(Const.MIDDLE_PCT, 0);
         label.setLayoutData(fdLabel);
@@ -194,21 +194,21 @@ public class GuiCompositeWidgets {
     // We might need to add a number of extra lines...
     // Let's just add empty labels..
     //
-    for (; nrItems < maxNrItems; nrItems++) {
-      label = new Label(parent, SWT.RIGHT | SWT.SINGLE);
-      props.setLook(label);
-      label.setText("                                                                    ");
-      FormData fdLabel = new FormData();
-      fdLabel.left = new FormAttachment(0, 0);
-      if (previousControl == null) {
-        fdLabel.top = new FormAttachment(0, 0);
-      } else {
-        fdLabel.top = new FormAttachment(previousControl, props.getMargin());
-      }
-      fdLabel.right = new FormAttachment(Const.MIDDLE_PCT, 0);
-      label.setLayoutData(fdLabel);
-      previousControl = label;
-    }
+//    for (; nrItems < maxNrItems; nrItems++) {
+//      label = new Label(parent, SWT.RIGHT | SWT.SINGLE);
+//      props.setLook(label);
+//      label.setText("                                                                    ");
+//      FormData fdLabel = new FormData();
+//      fdLabel.left = new FormAttachment(0, 0);
+//      if (previousControl == null) {
+//        fdLabel.top = new FormAttachment(0, 0);
+//      } else {
+//        fdLabel.top = new FormAttachment(previousControl, props.getMargin());
+//      }
+//      fdLabel.right = new FormAttachment(Const.MIDDLE_PCT, 0);
+//      label.setLayoutData(fdLabel);
+//      previousControl = label;
+//    }
 
     return previousControl;
   }
diff --git a/ui/src/main/java/org/apache/hop/ui/pipeline/config/PipelineRunConfigurationEditor.java b/ui/src/main/java/org/apache/hop/ui/pipeline/config/PipelineRunConfigurationEditor.java
index 2708154..642d947 100644
--- a/ui/src/main/java/org/apache/hop/ui/pipeline/config/PipelineRunConfigurationEditor.java
+++ b/ui/src/main/java/org/apache/hop/ui/pipeline/config/PipelineRunConfigurationEditor.java
@@ -163,7 +163,7 @@ public class PipelineRunConfigurationEditor extends MetadataEditor<PipelineRunCo
     props.setLook(wlName);
     wlName.setText(BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.name"));
     FormData fdlName = new FormData();
-    fdlName.top = new FormAttachment(0, 0);
+    fdlName.top = new FormAttachment(0, margin * 2);
     fdlName.left = new FormAttachment(0, 0); // First one in the left top corner
     fdlName.right = new FormAttachment(middle, 0);
     wlName.setLayoutData(fdlName);
@@ -181,7 +181,7 @@ public class PipelineRunConfigurationEditor extends MetadataEditor<PipelineRunCo
     wlDescription.setText(
         BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.Description"));
     FormData fdlDescription = new FormData();
-    fdlDescription.top = new FormAttachment(lastControl, margin);
+    fdlDescription.top = new FormAttachment(lastControl, margin * 2);
     fdlDescription.left = new FormAttachment(0, 0); // First one in the left top corner
     fdlDescription.right = new FormAttachment(middle, 0);
     wlDescription.setLayoutData(fdlDescription);
@@ -201,7 +201,7 @@ public class PipelineRunConfigurationEditor extends MetadataEditor<PipelineRunCo
     wlPluginType.setText(
         BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.EngineType"));
     FormData fdlPluginType = new FormData();
-    fdlPluginType.top = new FormAttachment(lastControl, margin);
+    fdlPluginType.top = new FormAttachment(lastControl, margin * 2);
     fdlPluginType.left = new FormAttachment(0, 0); // First one in the left top corner
     fdlPluginType.right = new FormAttachment(middle, 0);
     wlPluginType.setLayoutData(fdlPluginType);
@@ -224,7 +224,7 @@ public class PipelineRunConfigurationEditor extends MetadataEditor<PipelineRunCo
     FormData fdPluginSpecificComp = new FormData();
     fdPluginSpecificComp.left = new FormAttachment(0, 0);
     fdPluginSpecificComp.right = new FormAttachment(100, 0);
-    fdPluginSpecificComp.top = new FormAttachment(lastControl, 3 * margin);
+    fdPluginSpecificComp.top = new FormAttachment(lastControl, margin);
     fdPluginSpecificComp.bottom = new FormAttachment(100, 0);
     wPluginSpecificComp.setLayoutData(fdPluginSpecificComp);
 
@@ -348,7 +348,7 @@ public class PipelineRunConfigurationEditor extends MetadataEditor<PipelineRunCo
     }
 
     if (workingConfiguration.getEngineRunConfiguration() != null) {
-      guiCompositeWidgets = new GuiCompositeWidgets(manager.getVariables(), 25); // max 8 lines
+      guiCompositeWidgets = new GuiCompositeWidgets(manager.getVariables());
       guiCompositeWidgets.createCompositeWidgets(
           workingConfiguration.getEngineRunConfiguration(),
           null,
diff --git a/ui/src/main/java/org/apache/hop/ui/workflow/config/WorkflowRunConfigurationEditor.java b/ui/src/main/java/org/apache/hop/ui/workflow/config/WorkflowRunConfigurationEditor.java
index 8f2e90f..f9f8ec2 100644
--- a/ui/src/main/java/org/apache/hop/ui/workflow/config/WorkflowRunConfigurationEditor.java
+++ b/ui/src/main/java/org/apache/hop/ui/workflow/config/WorkflowRunConfigurationEditor.java
@@ -135,7 +135,7 @@ public class WorkflowRunConfigurationEditor extends MetadataEditor<WorkflowRunCo
     props.setLook(wlName);
     wlName.setText(BaseMessages.getString(PKG, "WorkflowRunConfigurationDialog.label.name"));
     FormData fdlName = new FormData();
-    fdlName.top = new FormAttachment(0, margin);
+    fdlName.top = new FormAttachment(0, margin * 2);
     fdlName.left = new FormAttachment(0, 0); // First one in the left top corner
     fdlName.right = new FormAttachment(middle, 0);
     wlName.setLayoutData(fdlName);
@@ -153,7 +153,7 @@ public class WorkflowRunConfigurationEditor extends MetadataEditor<WorkflowRunCo
     wlDescription.setText(
         BaseMessages.getString(PKG, "WorkflowRunConfigurationDialog.label.Description"));
     FormData fdlDescription = new FormData();
-    fdlDescription.top = new FormAttachment(lastControl, margin);
+    fdlDescription.top = new FormAttachment(lastControl, margin * 2);
     fdlDescription.left = new FormAttachment(0, 0); // First one in the left top corner
     fdlDescription.right = new FormAttachment(middle, 0);
     wlDescription.setLayoutData(fdlDescription);
@@ -173,7 +173,7 @@ public class WorkflowRunConfigurationEditor extends MetadataEditor<WorkflowRunCo
     wlPluginType.setText(
         BaseMessages.getString(PKG, "WorkflowRunConfigurationDialog.label.EngineType"));
     FormData fdlPluginType = new FormData();
-    fdlPluginType.top = new FormAttachment(lastControl, margin);
+    fdlPluginType.top = new FormAttachment(lastControl, margin * 2);
     fdlPluginType.left = new FormAttachment(0, 0); // First one in the left top corner
     fdlPluginType.right = new FormAttachment(middle, 0);
     wlPluginType.setLayoutData(fdlPluginType);
@@ -195,7 +195,7 @@ public class WorkflowRunConfigurationEditor extends MetadataEditor<WorkflowRunCo
     FormData fdPluginSpecificComp = new FormData();
     fdPluginSpecificComp.left = new FormAttachment(0, 0);
     fdPluginSpecificComp.right = new FormAttachment(100, 0);
-    fdPluginSpecificComp.top = new FormAttachment(lastControl, 3 * margin);
+    fdPluginSpecificComp.top = new FormAttachment(lastControl, margin);
     fdPluginSpecificComp.bottom = new FormAttachment(100, 0);
     wPluginSpecificComp.setLayoutData(fdPluginSpecificComp);
 
@@ -227,7 +227,7 @@ public class WorkflowRunConfigurationEditor extends MetadataEditor<WorkflowRunCo
     // Now add the run configuration plugin specific widgets
     //
     if (workingConfiguration.getEngineRunConfiguration() != null) {
-      guiCompositeWidgets = new GuiCompositeWidgets(manager.getVariables(), 8); // max 8 lines
+      guiCompositeWidgets = new GuiCompositeWidgets(manager.getVariables());
       guiCompositeWidgets.createCompositeWidgets(
           workingConfiguration.getEngineRunConfiguration(),
           null,