From a5d40fd2306bb0335ea3a5a8dc6b1633439e6113 Mon Sep 17 00:00:00 2001 From: Nicolas Adment <39568358+nadment@users.noreply.github.com> Date: Sun, 31 May 2026 00:21:24 +0200 Subject: [PATCH] Fix layout issue transfo "Synchronize after merge" #7201 --- .../SynchronizeAfterMergeDialog.java | 88 +++++-------------- .../messages/messages_en_US.properties | 3 - 2 files changed, 20 insertions(+), 71 deletions(-) diff --git a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java index 31fc05fb9e..e33d9cc88a 100644 --- a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java +++ b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java @@ -37,6 +37,7 @@ import org.apache.hop.pipeline.transform.ITransformMeta; import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.ui.core.ConstUi; +import org.apache.hop.ui.core.FormDataBuilder; import org.apache.hop.ui.core.PropsUi; import org.apache.hop.ui.core.database.dialog.DatabaseExplorerDialog; import org.apache.hop.ui.core.database.dialog.SqlEditor; @@ -65,7 +66,6 @@ import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; @@ -144,7 +144,7 @@ public String open() { ModifyListener lsMod = e -> input.setChanged(); ModifyListener lsTableMod = - arg0 -> { + event -> { input.setChanged(); setTableFieldCombo(); }; @@ -200,13 +200,9 @@ private void addAdvancedTab( BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.AdvancedTab.TabTitle")); Composite wAdvancedComp = new Composite(wTabFolder, SWT.NONE); + wAdvancedComp.setLayout(props.createFormLayout()); PropsUi.setLook(wAdvancedComp); - FormLayout advancedLayout = new FormLayout(); - advancedLayout.marginWidth = 3; - advancedLayout.marginHeight = 3; - wAdvancedComp.setLayout(advancedLayout); - // /////////////////////////////// // START OF OPERATION ORDER GROUP // // /////////////////////////////// @@ -216,10 +212,8 @@ private void addAdvancedTab( wOperationOrder.setText( BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.OperationOrder.Label")); - FormLayout originFilesgroupLayout = new FormLayout(); - originFilesgroupLayout.marginWidth = 10; - originFilesgroupLayout.marginHeight = 10; - wOperationOrder.setLayout(originFilesgroupLayout); + wOperationOrder.setLayout(props.createFormLayout()); + wOperationOrder.setLayoutData(new FormDataBuilder().top().left().fullWidth().result()); Label wlOperationField = new Label(wOperationOrder, SWT.RIGHT); wlOperationField.setText( @@ -227,7 +221,7 @@ private void addAdvancedTab( PropsUi.setLook(wlOperationField); FormData fdlOperationField = new FormData(); fdlOperationField.left = new FormAttachment(0, 0); - fdlOperationField.top = new FormAttachment(wTableField, margin); + fdlOperationField.top = new FormAttachment(0, 0); fdlOperationField.right = new FormAttachment(middle, -margin); wlOperationField.setLayoutData(fdlOperationField); wOperationField = new CCombo(wOperationOrder, SWT.BORDER | SWT.READ_ONLY); @@ -236,7 +230,7 @@ private void addAdvancedTab( wOperationField.addModifyListener(lsMod); FormData fdOperationField = new FormData(); fdOperationField.left = new FormAttachment(middle, 0); - fdOperationField.top = new FormAttachment(wTableField, margin); + fdOperationField.top = new FormAttachment(0, 0); fdOperationField.right = new FormAttachment(100, 0); wOperationField.setLayoutData(fdOperationField); wOperationField.addFocusListener( @@ -343,23 +337,10 @@ public void focusGained(FocusEvent e) { fdPerformLookup.right = new FormAttachment(100, 0); wbPerformLookup.setLayoutData(fdPerformLookup); - FormData fdOperationOrder = new FormData(); - fdOperationOrder.left = new FormAttachment(0, margin); - fdOperationOrder.top = new FormAttachment(wSpacer, margin); - fdOperationOrder.right = new FormAttachment(100, -margin); - wOperationOrder.setLayoutData(fdOperationOrder); - // /////////////////////////////////////////////////////////// // / END OF Operation order GROUP // /////////////////////////////////////////////////////////// - FormData fdAdvancedComp = new FormData(); - fdAdvancedComp.left = new FormAttachment(0, 0); - fdAdvancedComp.top = new FormAttachment(0, 0); - fdAdvancedComp.right = new FormAttachment(100, 0); - fdAdvancedComp.bottom = new FormAttachment(100, 0); - wAdvancedComp.setLayoutData(fdAdvancedComp); - wAdvancedComp.layout(); wAdvancedTab.setControl(wAdvancedComp); PropsUi.setLook(wAdvancedComp); @@ -372,20 +353,16 @@ private void addUpdatesTab(CTabFolder wTabFolder, ModifyListener lsMod) { BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.UpdatesTab.TabTitle")); Composite wUpdatesComp = new Composite(wTabFolder, SWT.NONE); + wUpdatesComp.setLayout(props.createFormLayout()); PropsUi.setLook(wUpdatesComp); - FormLayout updatesLayout = new FormLayout(); - updatesLayout.marginWidth = 3; - updatesLayout.marginHeight = 3; - wUpdatesComp.setLayout(updatesLayout); - // THE UPDATE/INSERT TABLE Label wlReturn = new Label(wUpdatesComp, SWT.NONE); wlReturn.setText(BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.UpdateFields.Label")); PropsUi.setLook(wlReturn); FormData fdlReturn = new FormData(); fdlReturn.left = new FormAttachment(0, 0); - fdlReturn.top = new FormAttachment(wKey, margin); + fdlReturn.top = new FormAttachment(0, 0); wlReturn.setLayoutData(fdlReturn); int upInsCols = 3; @@ -433,7 +410,7 @@ private void addUpdatesTab(CTabFolder wTabFolder, ModifyListener lsMod) { fdReturn.left = new FormAttachment(0, 0); fdReturn.top = new FormAttachment(wlReturn, margin); fdReturn.right = new FormAttachment(100, 0); - fdReturn.bottom = new FormAttachment(wbGetLU, -2 * margin); + fdReturn.bottom = new FormAttachment(wbGetLU, -margin); wReturn.setLayoutData(fdReturn); Button wbDoMapping = new Button(wUpdatesComp, SWT.PUSH); @@ -443,7 +420,9 @@ private void addUpdatesTab(CTabFolder wTabFolder, ModifyListener lsMod) { fdDoMapping.top = new FormAttachment(wbGetLU, margin); fdDoMapping.right = new FormAttachment(100, 0); wbDoMapping.setLayoutData(fdDoMapping); - wbDoMapping.addListener(SWT.Selection, arg0 -> generateMappings()); + wbDoMapping.addListener(SWT.Selection, event -> generateMappings()); + + setButtonPositions(new Button[] {wbGetLU, wbDoMapping}, margin, null); // // Search the fields in the background @@ -470,14 +449,6 @@ private void addUpdatesTab(CTabFolder wTabFolder, ModifyListener lsMod) { }; new Thread(runnable).start(); - FormData fdUpdatesComp = new FormData(); - fdUpdatesComp.left = new FormAttachment(0, 0); - fdUpdatesComp.top = new FormAttachment(0, 0); - fdUpdatesComp.right = new FormAttachment(100, 0); - fdUpdatesComp.bottom = new FormAttachment(100, 0); - wUpdatesComp.setLayoutData(fdUpdatesComp); - - wUpdatesComp.layout(); wUpdatesTab.setControl(wUpdatesComp); PropsUi.setLook(wUpdatesComp); } @@ -488,19 +459,15 @@ private void addKeysTab(CTabFolder wTabFolder, ModifyListener lsMod) { wKeysTab.setText(BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.KeysTab.TabTitle")); Composite wKeysComp = new Composite(wTabFolder, SWT.NONE); + wKeysComp.setLayout(props.createFormLayout()); PropsUi.setLook(wKeysComp); - FormLayout keysLayout = new FormLayout(); - keysLayout.marginWidth = 3; - keysLayout.marginHeight = 3; - wKeysComp.setLayout(keysLayout); - Label wlKey = new Label(wKeysComp, SWT.NONE); wlKey.setText(BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.Keys.Label")); PropsUi.setLook(wlKey); FormData fdlKey = new FormData(); fdlKey.left = new FormAttachment(0, 0); - fdlKey.top = new FormAttachment(wTableField, margin); + fdlKey.top = new FormAttachment(0, 0); wlKey.setLayoutData(fdlKey); int nrKeyCols = 4; @@ -551,27 +518,16 @@ private void addKeysTab(CTabFolder wTabFolder, ModifyListener lsMod) { wGet = new Button(wKeysComp, SWT.PUSH); wGet.setText(BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.GetFields.Button")); - fdGet = new FormData(); - fdGet.left = new FormAttachment(0, 0); - fdGet.bottom = new FormAttachment(100, -2 * margin); - wGet.setLayoutData(fdGet); wGet.addListener(SWT.Selection, e -> get()); + setButtonPositions(new Button[] {wGet}, margin, null); FormData fdKey = new FormData(); fdKey.left = new FormAttachment(0, 0); fdKey.top = new FormAttachment(wlKey, margin); fdKey.right = new FormAttachment(100, 0); - fdKey.bottom = new FormAttachment(wGet, -2 * margin); + fdKey.bottom = new FormAttachment(wGet, -margin); wKey.setLayoutData(fdKey); - FormData fdKeysComp = new FormData(); - fdKeysComp.left = new FormAttachment(0, 0); - fdKeysComp.top = new FormAttachment(0, 0); - fdKeysComp.right = new FormAttachment(100, 0); - fdKeysComp.bottom = new FormAttachment(100, 0); - wKeysComp.setLayoutData(fdKeysComp); - - wKeysComp.layout(); wKeysTab.setControl(wKeysComp); PropsUi.setLook(wKeysComp); } @@ -588,15 +544,11 @@ private void addGeneralTab( BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.GeneralTab.TabTitle")); Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE); + wGeneralComp.setLayout(props.createFormLayout()); PropsUi.setLook(wGeneralComp); - FormLayout generalLayout = new FormLayout(); - generalLayout.marginWidth = 3; - generalLayout.marginHeight = 3; - wGeneralComp.setLayout(generalLayout); - // Connection line - wConnection = addConnectionLine(wGeneralComp, wSpacer, input.getConnection(), lsMod); + wConnection = addConnectionLine(wGeneralComp, null, input.getConnection(), lsMod); wConnection.addSelectionListener(lsSelection); // Schema line... @@ -639,7 +591,7 @@ private void addGeneralTab( wbTable = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); PropsUi.setLook(wbTable); - wbTable.setText(BaseMessages.getString(PKG, "SynchronizeAfterMergeDialog.Browse.Button")); + wbTable.setText(BaseMessages.getString(PKG, "System.Button.Browse")); FormData fdbTable = new FormData(); fdbTable.right = new FormAttachment(100, 0); fdbTable.top = new FormAttachment(wbSchema, margin); diff --git a/plugins/transforms/synchronizeaftermerge/src/main/resources/org/apache/hop/pipeline/transforms/synchronizeaftermerge/messages/messages_en_US.properties b/plugins/transforms/synchronizeaftermerge/src/main/resources/org/apache/hop/pipeline/transforms/synchronizeaftermerge/messages/messages_en_US.properties index ba35104ef0..09168ae297 100644 --- a/plugins/transforms/synchronizeaftermerge/src/main/resources/org/apache/hop/pipeline/transforms/synchronizeaftermerge/messages/messages_en_US.properties +++ b/plugins/transforms/synchronizeaftermerge/src/main/resources/org/apache/hop/pipeline/transforms/synchronizeaftermerge/messages/messages_en_US.properties @@ -62,7 +62,6 @@ SynchronizeAfterMergeDialog.AvailableSchemas.Message=Please select a schema name SynchronizeAfterMergeDialog.AvailableSchemas.Title=Available schemas SynchronizeAfterMergeDialog.Batch.Label=Use batch update SynchronizeAfterMergeDialog.Batch.Tooltip=Use batch update for inserts and updates -SynchronizeAfterMergeDialog.Browse.Button=&Browse... SynchronizeAfterMergeDialog.ColumnInfo.Comparator=Comparator SynchronizeAfterMergeDialog.ColumnInfo.StreamField=Stream field SynchronizeAfterMergeDialog.ColumnInfo.StreamField1=Stream field1 @@ -111,7 +110,6 @@ SynchronizeAfterMergeDialog.OrderUpdate.ToolTip=If the operation field contain's SynchronizeAfterMergeDialog.PerformLookup.Label=Perform lookup SynchronizeAfterMergeDialog.PerformLookup.Tooltip=Perform lookup before updating or deleting.\nIf the record is missing, Apache Hop will throw an exception. SynchronizeAfterMergeDialog.Shell.Title=Synchronize after merge -SynchronizeAfterMergeDialog.SQL.Button=\ &SQL SynchronizeAfterMergeDialog.SQLError.DialogTitle=ERROR SynchronizeAfterMergeDialog.TableField.Label=Tablename field SynchronizeAfterMergeDialog.TablenameInField.Label=Tablename is defined in a field @@ -119,7 +117,6 @@ SynchronizeAfterMergeDialog.TablenameInField.Tooltip=Tablename is defined in a f SynchronizeAfterMergeDialog.TargetSchema.Label=Target schema SynchronizeAfterMergeDialog.TargetTable.Label=Target table SynchronizeAfterMergeDialog.TransformMeta.Title=CombinationLookup -SynchronizeAfterMergeDialog.TransformName.Label=Transform name SynchronizeAfterMergeDialog.UpdateFields.Label=Update fields\: SynchronizeAfterMergeMeta.CheckResult.AllFieldsFoundInInput=All fields found in the input stream. SynchronizeAfterMergeMeta.CheckResult.AllFieldsFoundInInput2=All insert/update fields found in the input stream.