From d4c5db24bd63f4fdabf9d751ec003677cd887436 Mon Sep 17 00:00:00 2001 From: cmeng-talend Date: Thu, 11 Dec 2014 14:02:11 +0800 Subject: [PATCH] TDI-29298 fix bug: Several places to improve on displaying when you use a big screen resolution and making text bigger than usual https://jira.talendforge.org/browse/TDI-29298 --- .../properties/ConfigureConnParamDialog.java | 52 ++++++++++++++----- .../controllers/DateController.java | 34 ++++++------ .../controllers/DirectoryController.java | 32 ++++++------ .../controllers/FileController.java | 32 ++++++------ .../MultipleThreadDynamicComposite.java | 2 +- 5 files changed, 92 insertions(+), 60 deletions(-) diff --git a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/ConfigureConnParamDialog.java b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/ConfigureConnParamDialog.java index c6a1a46f839..8be1010ee6f 100644 --- a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/ConfigureConnParamDialog.java +++ b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/ConfigureConnParamDialog.java @@ -21,6 +21,7 @@ import org.eclipse.draw2d.ColorConstants; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.ModifyEvent; @@ -129,22 +130,35 @@ public class ConfigureConnParamDialog extends Dialog { */ @Override protected Control createDialogArea(Composite parent) { - - mainComposite = (Composite) super.createDialogArea(parent); + Composite parentComposite = (Composite) super.createDialogArea(parent); GridLayout gridLayout = new GridLayout(1, true); - // gridLayout.verticalSpacing = 0; + gridLayout.verticalSpacing = 0; + parentComposite.setLayout(gridLayout); + + IContext defaultContext = createContextComposite(parentComposite); + + // Label hLabel = new Label(parentComposite, SWT.SEPARATOR | SWT.HORIZONTAL); + // + // hLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + ScrolledComposite scrolledComposite = new ScrolledComposite(parentComposite, SWT.V_SCROLL | SWT.BORDER); + + mainComposite = new Composite(scrolledComposite, SWT.NONE); + gridLayout = new GridLayout(1, true); + gridLayout.verticalSpacing = 0; mainComposite.setLayout(gridLayout); - IContext defaultContext = createContextComposite(); - - Label hLabel = new Label(mainComposite, SWT.SEPARATOR | SWT.HORIZONTAL); - - hLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - addComponents(defaultContext); + GridData gridData = new GridData(GridData.FILL_BOTH); + scrolledComposite.setLayoutData(gridData); + scrolledComposite.setContent(mainComposite); + scrolledComposite.setExpandHorizontal(true); + scrolledComposite.setExpandVertical(true); + scrolledComposite.setMinSize(mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + contextCombo.addSelectionListener(new SelectionAdapter() { @Override @@ -159,7 +173,7 @@ public class ConfigureConnParamDialog extends Dialog { } } }); - return mainComposite; + return parentComposite; } private final List allParamText = new ArrayList(); @@ -208,7 +222,9 @@ public class ConfigureConnParamDialog extends Dialog { hostComposite.setLayoutData(gridData); Label hostLabel = new Label(hostComposite, SWT.NONE); hostLabel.setText(key.getDisplayName() + ":"); //$NON-NLS-1$ - GridDataFactory.swtDefaults().hint(LABEL_DEFAULT_X, DEFAULT_HEIGHT).applyTo(hostLabel); + // GridDataFactory.swtDefaults().hint(LABEL_DEFAULT_X, DEFAULT_HEIGHT).applyTo(hostLabel); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + hostLabel.setLayoutData(data); Composite fileComposite = new Composite(hostComposite, SWT.NONE); gridLayout = new GridLayout(); @@ -244,6 +260,7 @@ public class ConfigureConnParamDialog extends Dialog { * @see * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) */ + @Override public void widgetDefaultSelected(SelectionEvent e) { } @@ -253,6 +270,7 @@ public class ConfigureConnParamDialog extends Dialog { * * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ + @Override public void widgetSelected(SelectionEvent e) { DirectoryDialog dialog = new DirectoryDialog(mainComposite.getShell(), SWT.NONE); String path = PathExtractor.extractPath(host.getText()); @@ -282,6 +300,7 @@ public class ConfigureConnParamDialog extends Dialog { * * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) */ + @Override public void modifyText(ModifyEvent e) { if (isRequriedValue(key.getName())) { if (host.getText().trim().length() == 0) { @@ -323,7 +342,9 @@ public class ConfigureConnParamDialog extends Dialog { hostComposite.setLayoutData(gridData); Label hostLabel = new Label(hostComposite, SWT.NONE); hostLabel.setText(key.getDisplayName() + ":"); //$NON-NLS-1$ - GridDataFactory.swtDefaults().hint(LABEL_DEFAULT_X, DEFAULT_HEIGHT).applyTo(hostLabel); + // GridDataFactory.swtDefaults().hint(LABEL_DEFAULT_X, DEFAULT_HEIGHT).applyTo(hostLabel); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + hostLabel.setLayoutData(data); Composite fileComposite = new Composite(hostComposite, SWT.NONE); gridLayout = new GridLayout(); @@ -359,6 +380,7 @@ public class ConfigureConnParamDialog extends Dialog { * @see * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) */ + @Override public void widgetDefaultSelected(SelectionEvent e) { } @@ -368,6 +390,7 @@ public class ConfigureConnParamDialog extends Dialog { * * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ + @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(mainComposite.getShell(), SWT.NONE); String path = PathExtractor.extractPath(host.getText()); @@ -397,6 +420,7 @@ public class ConfigureConnParamDialog extends Dialog { * * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) */ + @Override public void modifyText(ModifyEvent e) { if (isRequriedValue(key.getName())) { if (host.getText().trim().length() == 0) { @@ -496,8 +520,8 @@ public class ConfigureConnParamDialog extends Dialog { * * @return */ - private IContext createContextComposite() { - Composite contextComposite = new Composite(mainComposite, SWT.NONE); + private IContext createContextComposite(Composite parent) { + Composite contextComposite = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(2, false); contextComposite.setLayout(gridLayout); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); diff --git a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DateController.java b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DateController.java index 7533c045b59..aaaf3721fba 100644 --- a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DateController.java +++ b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DateController.java @@ -39,6 +39,7 @@ import org.talend.core.model.utils.TalendTextUtils; import org.talend.core.properties.tab.IDynamicProperty; import org.talend.core.ui.CoreUIPlugin; import org.talend.designer.core.i18n.Messages; +import org.talend.designer.core.model.components.EParameterName; import org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand; import org.talend.designer.core.ui.editor.nodes.Node; import org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator; @@ -70,9 +71,23 @@ public class DateController extends AbstractElementPropertySectionController { @Override public Control createControl(Composite subComposite, IElementParameter param, int numInRow, int nbInRow, int top, Control lastControl) { - Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ FormData data; + CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); + data = new FormData(); + if (lastControl != null) { + data.left = new FormAttachment(lastControl, 0); + } else { + data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); + } + data.top = new FormAttachment(0, top); + labelLabel.setLayoutData(data); + if (numInRow != 1) { + labelLabel.setAlignment(SWT.RIGHT); + } + + Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ + btnEdit.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON))); btnEdit.setData(NAME, DATE); @@ -108,18 +123,6 @@ public class DateController extends AbstractElementPropertySectionController { hashCurControls.put(param.getName(), dateText); - CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); - data = new FormData(); - if (lastControl != null) { - data.left = new FormAttachment(lastControl, 0); - } else { - data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); - } - data.top = new FormAttachment(0, top); - labelLabel.setLayoutData(data); - if (numInRow != 1) { - labelLabel.setAlignment(SWT.RIGHT); - } // ************************** data = new FormData(); int currentLabelWidth = STANDARD_LABEL_WIDTH; @@ -143,13 +146,13 @@ public class DateController extends AbstractElementPropertySectionController { data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT); data.right = new FormAttachment(labelLabel, currentDateWidth, SWT.RIGHT); - data.top = new FormAttachment(btnEdit, 0, SWT.CENTER); + data.top = new FormAttachment(labelLabel, 0, SWT.CENTER); cLayout.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(cLayout, 0, SWT.RIGHT); data.right = new FormAttachment(cLayout, STANDARD_BUTTON_WIDTH, SWT.RIGHT); - data.top = new FormAttachment(0, top); + data.top = new FormAttachment(labelLabel, 0, SWT.CENTER); data.height = STANDARD_HEIGHT - 2; btnEdit.setLayoutData(data); @@ -208,6 +211,7 @@ public class DateController extends AbstractElementPropertySectionController { String propertyName = (String) button.getData(PARAMETER_NAME); String date = dateDial.getTalendDateString(); if (!elem.getPropertyValue(propertyName).equals(date)) { + elem.setPropertyValue(EParameterName.UPDATE_COMPONENTS.getName(), Boolean.TRUE); return new PropertyChangeCommand(elem, propertyName, TalendTextUtils.addQuotes(date)); } diff --git a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DirectoryController.java b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DirectoryController.java index c3817061a83..6828577ac45 100644 --- a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DirectoryController.java +++ b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/DirectoryController.java @@ -109,15 +109,29 @@ public class DirectoryController extends AbstractElementPropertySectionControlle public Control createControl(final Composite subComposite, final IElementParameter param, final int numInRow, final int nbInRow, final int top, final Control lastControl) { this.curParameter = param; - Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ FormData data; + CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); + data = new FormData(); + if (lastControl != null) { + data.left = new FormAttachment(lastControl, 0); + } else { + data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); + } + data.top = new FormAttachment(0, top); + labelLabel.setLayoutData(data); + if (numInRow != 1) { + labelLabel.setAlignment(SWT.RIGHT); + } + + Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ + btnEdit.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON))); data = new FormData(); data.left = new FormAttachment(((numInRow * MAX_PERCENT) / nbInRow), -STANDARD_BUTTON_WIDTH); data.right = new FormAttachment(((numInRow * MAX_PERCENT) / nbInRow), 0); - data.top = new FormAttachment(0, top); + data.top = new FormAttachment(labelLabel, 0, SWT.CENTER); data.height = STANDARD_HEIGHT - 2; btnEdit.setLayoutData(data); btnEdit.setData(NAME, DIRECTORY); @@ -153,18 +167,6 @@ public class DirectoryController extends AbstractElementPropertySectionControlle labelText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName()); } - CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); - data = new FormData(); - if (lastControl != null) { - data.left = new FormAttachment(lastControl, 0); - } else { - data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); - } - data.top = new FormAttachment(0, top); - labelLabel.setLayoutData(data); - if (numInRow != 1) { - labelLabel.setAlignment(SWT.RIGHT); - } // ************************** data = new FormData(); int currentLabelWidth = STANDARD_LABEL_WIDTH; @@ -186,7 +188,7 @@ public class DirectoryController extends AbstractElementPropertySectionControlle data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT); } data.right = new FormAttachment(btnEdit, 0); - data.top = new FormAttachment(btnEdit, 0, SWT.CENTER); + data.top = new FormAttachment(labelLabel, 0, SWT.CENTER); cLayout.setLayoutData(data); hashCurControls.put(param.getName(), labelText); diff --git a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/FileController.java b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/FileController.java index b7bea98d09a..36557cb0ce5 100644 --- a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/FileController.java +++ b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/FileController.java @@ -148,15 +148,29 @@ public class FileController extends AbstractElementPropertySectionController { final int nbInRow, final int top, final Control lastControl) { this.setDragAndDropActionBool(); this.curParameter = param; - Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ FormData data; + CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); + data = new FormData(); + if (lastControl != null) { + data.left = new FormAttachment(lastControl, 0); + } else { + data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); + } + data.top = new FormAttachment(0, top); + labelLabel.setLayoutData(data); + if (numInRow != 1) { + labelLabel.setAlignment(SWT.RIGHT); + } + + Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$ + btnEdit.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON))); data = new FormData(); data.left = new FormAttachment(((numInRow * MAX_PERCENT) / nbInRow), -STANDARD_BUTTON_WIDTH); data.right = new FormAttachment(((numInRow * MAX_PERCENT) / nbInRow), 0); - data.top = new FormAttachment(0, top); + data.top = new FormAttachment(labelLabel, 0, SWT.CENTER); data.height = STANDARD_HEIGHT - 2; btnEdit.setLayoutData(data); btnEdit.setData(NAME, FILE); @@ -199,18 +213,6 @@ public class FileController extends AbstractElementPropertySectionController { hashCurControls.put(param.getName(), filePathText); - CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName()); - data = new FormData(); - if (lastControl != null) { - data.left = new FormAttachment(lastControl, 0); - } else { - data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); - } - data.top = new FormAttachment(0, top); - labelLabel.setLayoutData(data); - if (numInRow != 1) { - labelLabel.setAlignment(SWT.RIGHT); - } // ************************** data = new FormData(); int currentLabelWidth = STANDARD_LABEL_WIDTH; @@ -232,7 +234,7 @@ public class FileController extends AbstractElementPropertySectionController { data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT); } data.right = new FormAttachment(btnEdit, 0); - data.top = new FormAttachment(btnEdit, 0, SWT.CENTER); + data.top = new FormAttachment(labelLabel, 0, SWT.CENTER); cLayout.setLayoutData(data); Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); diff --git a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/views/properties/MultipleThreadDynamicComposite.java b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/views/properties/MultipleThreadDynamicComposite.java index 2fb5b5e726f..2f5642c4692 100644 --- a/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/views/properties/MultipleThreadDynamicComposite.java +++ b/main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/views/properties/MultipleThreadDynamicComposite.java @@ -329,7 +329,7 @@ public class MultipleThreadDynamicComposite extends ScrolledComposite implements } } - private static final int DEFAULT_GROUP_HEIGHT = 20; + private static final int DEFAULT_GROUP_HEIGHT = 25; /** * Initialize all components for the defined section for this node.