Skip to content

Commit

Permalink
Fix #2043 : Align connection meta line
Browse files Browse the repository at this point in the history
  • Loading branch information
nadment committed Dec 11, 2022
1 parent 62ec5e7 commit 2bd0890
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ public void createControl(Composite parent) {
FormData fdlName = new FormData();
fdlName.top = new FormAttachment(wIcon, margin);
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
fdlName.right = new FormAttachment(middle, -margin);
wlName.setLayoutData(fdlName);
wName = new Text(parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wName);
FormData fdName = new FormData();
fdName.top = new FormAttachment(wlName, 0, SWT.CENTER);
fdName.left = new FormAttachment(middle, margin);
fdName.left = new FormAttachment(middle, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);

Expand All @@ -113,13 +113,13 @@ public void createControl(Composite parent) {
wlEnabled.setText("Enabled?");
FormData fdlEnabled = new FormData();
fdlEnabled.left = new FormAttachment(0, 0);
fdlEnabled.right = new FormAttachment(middle, 0);
fdlEnabled.right = new FormAttachment(middle, -margin);
fdlEnabled.top = new FormAttachment(lastControl, margin);
wlEnabled.setLayoutData(fdlEnabled);
wEnabled = new Button(parent, SWT.CHECK | SWT.LEFT);
PropsUi.setLook(wEnabled);
FormData fdEnabled = new FormData();
fdEnabled.left = new FormAttachment(middle, margin);
fdEnabled.left = new FormAttachment(middle, 0);
fdEnabled.right = new FormAttachment(100, 0);
fdEnabled.top = new FormAttachment(wlEnabled, 0, SWT.CENTER);
wEnabled.setLayoutData(fdEnabled);
Expand All @@ -130,7 +130,7 @@ public void createControl(Composite parent) {
wlFilename.setText("Filename");
FormData fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.right = new FormAttachment(middle, 0);
fdlFilename.right = new FormAttachment(middle, -margin);
fdlFilename.top = new FormAttachment(lastControl, 2 * margin);
wlFilename.setLayoutData(fdlFilename);

Expand Down Expand Up @@ -164,7 +164,7 @@ public void createControl(Composite parent) {
wFilename = new TextVar(manager.getVariables(), parent, SWT.SINGLE | SWT.BORDER | SWT.LEFT);
PropsUi.setLook(wFilename);
FormData fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, margin);
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.right = new FormAttachment(wboFilename, -margin);
fdFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
wFilename.setLayoutData(fdFilename);
Expand Down Expand Up @@ -194,13 +194,13 @@ public void createControl(Composite parent) {
wlStatusVars.setText("Status variables (, separated)");
FormData fdlStatusVars = new FormData();
fdlStatusVars.left = new FormAttachment(0, 0);
fdlStatusVars.right = new FormAttachment(middle, 0);
fdlStatusVars.right = new FormAttachment(middle, -margin);
fdlStatusVars.top = new FormAttachment(lastControl, 2 * margin);
wlStatusVars.setLayoutData(fdlStatusVars);
wStatusVars = new TextVar(manager.getVariables(), parent, SWT.CHECK | SWT.LEFT);
wStatusVars = new TextVar(manager.getVariables(), parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wStatusVars);
FormData fdStatusVars = new FormData();
fdStatusVars.left = new FormAttachment(middle, margin);
fdStatusVars.left = new FormAttachment(middle, 0);
fdStatusVars.right = new FormAttachment(100, 0);
fdStatusVars.top = new FormAttachment(wlStatusVars, 0, SWT.CENTER);
wStatusVars.setLayoutData(fdStatusVars);
Expand All @@ -213,13 +213,13 @@ public void createControl(Composite parent) {
wlContentVar.setText("Content variable");
FormData fdlContentVar = new FormData();
fdlContentVar.left = new FormAttachment(0, 0);
fdlContentVar.right = new FormAttachment(middle, 0);
fdlContentVar.right = new FormAttachment(middle, -margin);
fdlContentVar.top = new FormAttachment(lastControl, 2 * margin);
wlContentVar.setLayoutData(fdlContentVar);
wContentVar = new TextVar(manager.getVariables(), parent, SWT.CHECK | SWT.LEFT);
wContentVar = new TextVar(manager.getVariables(), parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wContentVar);
FormData fdContentVar = new FormData();
fdContentVar.left = new FormAttachment(middle, margin);
fdContentVar.left = new FormAttachment(middle, 0);
fdContentVar.right = new FormAttachment(100, 0);
fdContentVar.top = new FormAttachment(wlContentVar, 0, SWT.CENTER);
wContentVar.setLayoutData(fdContentVar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void createControl(Composite parent) {
//

middle = props.getMiddlePct();
margin = props.getMargin();
margin = PropsUi.getMargin();

Label wIcon = new Label(parent, SWT.RIGHT);
wIcon.setImage(getImage());
Expand Down Expand Up @@ -259,7 +259,7 @@ private void addGeneralTab() {
FormData fdlConnectionType = new FormData();
fdlConnectionType.top = new FormAttachment(0, margin);
fdlConnectionType.left = new FormAttachment(0, 0); // First one in the left top corner
fdlConnectionType.right = new FormAttachment(middle, 0);
fdlConnectionType.right = new FormAttachment(middle, -margin);
wlConnectionType.setLayoutData(fdlConnectionType);

ToolBar wToolBar = new ToolBar(wGeneralComp, SWT.FLAT | SWT.HORIZONTAL);
Expand All @@ -279,7 +279,7 @@ private void addGeneralTab() {
PropsUi.setLook(wConnectionType);
FormData fdConnectionType = new FormData();
fdConnectionType.top = new FormAttachment(wlConnectionType, 0, SWT.CENTER);
fdConnectionType.left = new FormAttachment(middle, margin); // To the right of the label
fdConnectionType.left = new FormAttachment(middle, 0); // To the right of the label
fdConnectionType.right = new FormAttachment(wToolBar, -margin);
wConnectionType.setLayoutData(fdConnectionType);
Control lastControl = wConnectionType;
Expand All @@ -292,14 +292,14 @@ private void addGeneralTab() {
FormData fdlUsername = new FormData();
fdlUsername.top = new FormAttachment(lastControl, margin * 2); // At the bottom of this tab
fdlUsername.left = new FormAttachment(0, 0); // First one in the left top corner
fdlUsername.right = new FormAttachment(middle, 0);
fdlUsername.right = new FormAttachment(middle, -margin);
wlUsername.setLayoutData(fdlUsername);
wUsername =
new TextVar(manager.getVariables(), wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wUsername);
FormData fdUsername = new FormData();
fdUsername.top = new FormAttachment(wlUsername, 0, SWT.CENTER);
fdUsername.left = new FormAttachment(middle, margin); // To the right of the label
fdUsername.left = new FormAttachment(middle, 0); // To the right of the label
fdUsername.right = new FormAttachment(100, 0);
wUsername.setLayoutData(fdUsername);
lastControl = wUsername;
Expand All @@ -312,15 +312,15 @@ private void addGeneralTab() {
FormData fdlPassword = new FormData();
fdlPassword.top = new FormAttachment(lastControl, margin * 2); // At the bottom of this tab
fdlPassword.left = new FormAttachment(0, 0); // First one in the left top corner
fdlPassword.right = new FormAttachment(middle, 0);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword =
new TextVar(manager.getVariables(), wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wPassword.setEchoChar('*');
PropsUi.setLook(wPassword);
FormData fdPassword = new FormData();
fdPassword.top = new FormAttachment(wlPassword, 0, SWT.CENTER);
fdPassword.left = new FormAttachment(middle, margin); // To the right of the label
fdPassword.left = new FormAttachment(middle, 0); // To the right of the label
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
lastControl = wPassword;
Expand Down Expand Up @@ -367,14 +367,14 @@ public void widgetModified(
FormData fdlManualUrl = new FormData();
fdlManualUrl.top = new FormAttachment(lastControl, margin * 2); // At the bottom of this tab
fdlManualUrl.left = new FormAttachment(0, 0); // First one in the left top corner
fdlManualUrl.right = new FormAttachment(middle, 0);
fdlManualUrl.right = new FormAttachment(middle, -margin);
wlManualUrl.setLayoutData(fdlManualUrl);
wManualUrl =
new TextVar(manager.getVariables(), wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wManualUrl);
FormData fdManualUrl = new FormData();
fdManualUrl.top = new FormAttachment(wlManualUrl, 0, SWT.CENTER);
fdManualUrl.left = new FormAttachment(middle, margin); // To the right of the label
fdManualUrl.left = new FormAttachment(middle, 0); // To the right of the label
fdManualUrl.right = new FormAttachment(100, 0);
wManualUrl.setLayoutData(fdManualUrl);
wManualUrl.addListener(SWT.Modify, e -> enableFields());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ private Control addCompositeWidgets(
FormData fdLabel = new FormData();
fdLabel.left = new FormAttachment(0, 0);
if (lastControl == null) {
fdLabel.top = new FormAttachment(0, props.getMargin());
fdLabel.top = new FormAttachment(0, PropsUi.getMargin());
} else {
fdLabel.top = new FormAttachment(lastControl, props.getMargin() + extraVerticalMargin);
fdLabel.top = new FormAttachment(lastControl, PropsUi.getMargin() + extraVerticalMargin);
}
fdLabel.right = new FormAttachment(props.getMiddlePct(), 0);
fdLabel.right = new FormAttachment(props.getMiddlePct(), -PropsUi.getMargin());
label.setLayoutData(fdLabel);
labelsMap.put(guiElements.getId(), label);
}
Expand Down Expand Up @@ -269,7 +269,7 @@ private Control getMetadataControl(
guiElements.getLabel(),
guiElements.getToolTip(),
false,
false);
true);

widgetsMap.put(guiElements.getId(), metaSelectionLine);

Expand Down Expand Up @@ -573,7 +573,7 @@ private void layoutControlOnRight(
fdControl.top = new FormAttachment(label, 0, SWT.CENTER);
} else {
if (lastControl != null) {
fdControl.top = new FormAttachment(lastControl, props.getMargin());
fdControl.top = new FormAttachment(lastControl, PropsUi.getMargin());
} else {
fdControl.top = new FormAttachment(0, 0);
}
Expand All @@ -585,22 +585,22 @@ private void layoutControlBetweenLabelAndRightControl(
PropsUi props, Control lastControl, Label label, Control control, Control rightControl) {
FormData fdControl = new FormData();
if (label != null) {
fdControl.left = new FormAttachment(props.getMiddlePct(), props.getMargin());
fdControl.left = new FormAttachment(props.getMiddlePct(), 0);
if (rightControl == null) {
fdControl.right = new FormAttachment(100, 0);
} else {
fdControl.right = new FormAttachment(rightControl, -5);
}
fdControl.top = new FormAttachment(label, 0, SWT.CENTER);
} else {
fdControl.left = new FormAttachment(props.getMiddlePct(), props.getMargin());
fdControl.left = new FormAttachment(props.getMiddlePct(), 0);
if (rightControl == null) {
fdControl.right = new FormAttachment(100, 0);
} else {
fdControl.right = new FormAttachment(rightControl, -5);
}
if (lastControl != null) {
fdControl.top = new FormAttachment(lastControl, props.getMargin());
fdControl.top = new FormAttachment(lastControl, PropsUi.getMargin());
} else {
fdControl.top = new FormAttachment(0, 0);
}
Expand All @@ -613,7 +613,7 @@ private void layoutControlBelowLast(PropsUi props, Control lastControl, Control
fdControl.left = new FormAttachment(0, 0);
fdControl.right = new FormAttachment(100, 0);
if (lastControl != null) {
fdControl.top = new FormAttachment(lastControl, props.getMargin());
fdControl.top = new FormAttachment(lastControl, PropsUi.getMargin());
} else {
fdControl.top = new FormAttachment(0, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ public MetaSelectionLine(
fdToolBar.right = new FormAttachment(100, 0);
fdToolBar.top = new FormAttachment(0, 0);
wToolBar.setLayoutData(fdToolBar);
wToolBar.setBackground(GuiResource.getInstance().getColorBackground());
wToolBar.setForeground(GuiResource.getInstance().getColorBackground());
//wToolBar.setBackgroundMode(SWT.INHERIT_DEFAULT);
wToolBar.setBackground(GuiResource.getInstance().getColorGreen());
//wToolBar.setForeground(GuiResource.getInstance().getColorBackground());

// Add more toolbar items from plugins.
//
Expand All @@ -211,7 +212,7 @@ public MetaSelectionLine(
if (leftAlignedLabel) {
fdCombo.left = new FormAttachment(wLabel, margin, SWT.RIGHT);
} else {
fdCombo.left = new FormAttachment(middle, leftAlignedLabel ? 0 : margin);
fdCombo.left = new FormAttachment(middle, 0);
}
fdCombo.right = new FormAttachment(wToolBar, -margin);
fdCombo.top = new FormAttachment(wLabel, 0, SWT.CENTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ public void createControl(Composite parent) {
PropsUi.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.name"));
FormData fdlName = new FormData();
fdlName.top = new FormAttachment(0, margin * 2);
fdlName.top = new FormAttachment(0, margin);
fdlName.left = new FormAttachment(0, 0); // First one in the left top corner
fdlName.right = new FormAttachment(middle, 0);
fdlName.right = new FormAttachment(middle, -margin);
wlName.setLayoutData(fdlName);
wName = new Text(wMainComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wName);
FormData fdName = new FormData();
fdName.top = new FormAttachment(wlName, 0, SWT.CENTER);
fdName.left = new FormAttachment(middle, margin); // To the right of the label
fdName.left = new FormAttachment(middle, 0); // To the right of the label
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
Control lastControl = wName;
Expand All @@ -198,15 +198,15 @@ public void createControl(Composite parent) {
wlDescription.setText(
BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.Description"));
FormData fdlDescription = new FormData();
fdlDescription.top = new FormAttachment(lastControl, margin * 2);
fdlDescription.top = new FormAttachment(lastControl, margin);
fdlDescription.left = new FormAttachment(0, 0); // First one in the left top corner
fdlDescription.right = new FormAttachment(middle, 0);
fdlDescription.right = new FormAttachment(middle, -margin);
wlDescription.setLayoutData(fdlDescription);
wDescription = new Text(wMainComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wDescription);
FormData fdDescription = new FormData();
fdDescription.top = new FormAttachment(wlDescription, 0, SWT.CENTER);
fdDescription.left = new FormAttachment(middle, margin); // To the right of the label
fdDescription.left = new FormAttachment(middle, 0); // To the right of the label
fdDescription.right = new FormAttachment(100, 0);
wDescription.setLayoutData(fdDescription);
lastControl = wDescription;
Expand All @@ -216,15 +216,15 @@ public void createControl(Composite parent) {
wlDefault.setText(
BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.Default"));
FormData fdlDefault = new FormData();
fdlDefault.top = new FormAttachment(lastControl, margin * 2);
fdlDefault.top = new FormAttachment(lastControl, margin);
fdlDefault.left = new FormAttachment(0, 0); // First one in the left top corner
fdlDefault.right = new FormAttachment(middle, 0);
fdlDefault.right = new FormAttachment(middle, -margin);
wlDefault.setLayoutData(fdlDefault);
wDefault = new Button(wMainComp, SWT.CHECK | SWT.LEFT );
PropsUi.setLook(wDefault);
FormData fdDefault = new FormData();
fdDefault.top = new FormAttachment(wlDefault, 0, SWT.CENTER);
fdDefault.left = new FormAttachment(middle, margin); // To the right of the label
fdDefault.left = new FormAttachment(middle, 0); // To the right of the label
fdDefault.right = new FormAttachment(100, 0);
wDefault.setLayoutData(fdDefault);
lastControl = wlDefault;
Expand All @@ -244,7 +244,7 @@ public void createControl(Composite parent) {
PKG, "PipelineRunConfigurationDialog.toolTip.ExecutionInfoLocation"));
PropsUi.setLook(wExecutionInfoLocation);
FormData fdExecutionInfoLocation = new FormData();
fdExecutionInfoLocation.top = new FormAttachment(lastControl, 2*margin);
fdExecutionInfoLocation.top = new FormAttachment(lastControl, margin);
fdExecutionInfoLocation.left = new FormAttachment(0, 0); // To the right of the label
fdExecutionInfoLocation.right = new FormAttachment(100, 0);
wExecutionInfoLocation.setLayoutData(fdExecutionInfoLocation);
Expand Down Expand Up @@ -275,17 +275,17 @@ public void createControl(Composite parent) {
wlPluginType.setText(
BaseMessages.getString(PKG, "PipelineRunConfigurationDialog.label.EngineType"));
FormData fdlPluginType = new FormData();
fdlPluginType.top = new FormAttachment(lastControl, margin * 2);
fdlPluginType.top = new FormAttachment(lastControl, margin);
fdlPluginType.left = new FormAttachment(0, 0); // First one in the left top corner
fdlPluginType.right = new FormAttachment(middle, 0);
fdlPluginType.right = new FormAttachment(middle, -margin);
wlPluginType.setLayoutData(fdlPluginType);
wPluginType =
new ComboVar(manager.getVariables(), wMainComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wPluginType);
wPluginType.setItems(getPluginTypes());
FormData fdPluginType = new FormData();
fdPluginType.top = new FormAttachment(wlPluginType, 0, SWT.CENTER);
fdPluginType.left = new FormAttachment(middle, margin); // To the right of the label
fdPluginType.left = new FormAttachment(middle, 0); // To the right of the label
fdPluginType.right = new FormAttachment(100, 0);
wPluginType.setLayoutData(fdPluginType);
lastControl = wPluginType;
Expand Down
Loading

0 comments on commit 2bd0890

Please sign in to comment.