use of org.talend.repository.hadoopcluster.ui.dynamic.form.labelprovider.DynamicDistributionsLabelProvider in project tbd-studio-se by Talend.
the class DynamicDistributionOptionForm method createControl.
protected void createControl() {
Composite parent = this;
Composite container = createFormContainer(parent);
final int ALIGN_VERTICAL = getAlignVertical();
final int ALIGN_VERTICAL_INNER = getAlignVerticalInner();
final int ALIGN_HORIZON = getAlignHorizon();
final int HORZON_WIDTH = getHorizonWidth();
final int ALIGN_HORIZON_VERSION_LABEL = ALIGN_HORIZON * 2;
newConfigBtn = new Button(container, SWT.RADIO);
// $NON-NLS-1$
newConfigBtn.setText(Messages.getString("DynamicDistributionOptionForm.form.newConfigBtn"));
newConfigBtn.setSelection(true);
FormData formData = new FormData();
formData.top = new FormAttachment(0);
formData.left = new FormAttachment(0);
formData.right = new FormAttachment(100);
newConfigBtn.setLayoutData(formData);
newConfigGroup = new Composite(container, SWT.NONE);
formData = new FormData();
formData.top = new FormAttachment(newConfigBtn, 0, SWT.BOTTOM);
formData.left = new FormAttachment(newConfigBtn, 0, SWT.LEFT);
formData.right = new FormAttachment(newConfigBtn, 0, SWT.RIGHT);
newConfigGroup.setLayoutData(formData);
newConfigGroup.setLayout(new FormLayout());
int refreshButtonWidth = 0;
refreshButton = new Button(newConfigGroup, SWT.PUSH);
// $NON-NLS-1$
refreshButton.setText(Messages.getString("DynamicDistributionOptionForm.form.refresh.label"));
formData = new FormData();
formData.top = new FormAttachment(0, ALIGN_VERTICAL_INNER);
refreshButtonWidth = getNewButtonSize(refreshButton).x;
formData.width = refreshButtonWidth;
formData.right = new FormAttachment(100);
refreshButton.setLayoutData(formData);
Label versionLabel = new Label(newConfigGroup, SWT.NONE);
// $NON-NLS-1$
versionLabel.setText(Messages.getString("DynamicDistributionOptionForm.form.versionLabel.distribution"));
formData = new FormData();
formData.top = new FormAttachment(refreshButton, 0, SWT.CENTER);
formData.right = new FormAttachment(0, HORZON_WIDTH);
versionLabel.setLayoutData(formData);
versionsComboViewer = new ComboViewer(newConfigGroup, SWT.READ_ONLY);
versionsComboViewer.setContentProvider(ArrayContentProvider.getInstance());
versionsComboViewer.setLabelProvider(new LabelProvider());
formData = new FormData();
formData.top = new FormAttachment(refreshButton, 0, SWT.CENTER);
formData.left = new FormAttachment(versionLabel, ALIGN_HORIZON_VERSION_LABEL, SWT.RIGHT);
formData.right = new FormAttachment(refreshButton, -1 * ALIGN_HORIZON, SWT.LEFT);
versionsComboViewer.getControl().setLayoutData(formData);
showOnlyCompatibleBtn = new Button(newConfigGroup, SWT.CHECK);
// $NON-NLS-1$
showOnlyCompatibleBtn.setText(Messages.getString("DynamicDistributionOptionForm.form.showOnlyCompatible.label"));
showOnlyCompatibleBtn.setSelection(true);
formData = new FormData();
formData.top = new FormAttachment(versionsComboViewer.getControl(), ALIGN_VERTICAL_INNER, SWT.BOTTOM);
formData.right = new FormAttachment(versionsComboViewer.getControl(), 0, SWT.RIGHT);
showOnlyCompatibleBtn.setLayoutData(formData);
Label sparkVersionLabel = new Label(newConfigGroup, SWT.NONE);
// $NON-NLS-1$
sparkVersionLabel.setText(Messages.getString("DynamicDistributionOptionForm.form.versionLabel.spark"));
formData = new FormData();
formData.top = new FormAttachment(showOnlyCompatibleBtn, 0, SWT.CENTER);
formData.right = new FormAttachment(versionLabel, 0, SWT.RIGHT);
sparkVersionLabel.setLayoutData(formData);
sparkVersionsComboViewer = new TableComboViewer(newConfigGroup, SWT.READ_ONLY | SWT.BORDER);
sparkVersionsComboViewer.setContentProvider(ArrayContentProvider.getInstance());
sparkVersionsComboViewer.setLabelProvider(new SparkVersionsLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof ESparkVersion) {
return ((ESparkVersion) element).getVersionLabel();
}
return super.getText(element);
}
@Override
protected boolean isSelected(Object element) {
if (selectedSparkVersions.contains(element)) {
return true;
} else {
return false;
}
}
});
TableCombo tableCombo = sparkVersionsComboViewer.getTableCombo();
tableCombo.setClosePopupAfterSelection(false);
tableCombo.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
formData = new FormData();
formData.top = new FormAttachment(sparkVersionLabel, 0, SWT.CENTER);
formData.left = new FormAttachment(versionsComboViewer.getControl(), 0, SWT.LEFT);
// formData.right = new FormAttachment(showOnlyCompatibleBtn, -1 * ALIGN_HORIZON, SWT.LEFT);
formData.width = HORZON_WIDTH;
sparkVersionsComboViewer.getControl().setLayoutData(formData);
editExistingConfigBtn = new Button(container, SWT.RADIO);
// $NON-NLS-1$
editExistingConfigBtn.setText(Messages.getString("DynamicDistributionOptionForm.form.editExistingConfigBtn"));
formData = new FormData();
formData.top = new FormAttachment(newConfigGroup, ALIGN_VERTICAL, SWT.BOTTOM);
formData.left = new FormAttachment(newConfigGroup, 0, SWT.LEFT);
formData.right = new FormAttachment(newConfigGroup, 0, SWT.RIGHT);
editExistingConfigBtn.setLayoutData(formData);
editExistingGroup = new Composite(container, SWT.NONE);
formData = new FormData();
formData.top = new FormAttachment(editExistingConfigBtn, 0, SWT.BOTTOM);
formData.left = new FormAttachment(editExistingConfigBtn, 0, SWT.LEFT);
formData.right = new FormAttachment(editExistingConfigBtn, 0, SWT.RIGHT);
editExistingGroup.setLayoutData(formData);
editExistingGroup.setLayout(new FormLayout());
existingConfigsComboViewer = new ComboViewer(editExistingGroup, SWT.READ_ONLY);
existingConfigsComboViewer.setContentProvider(ArrayContentProvider.getInstance());
existingConfigsComboViewer.setLabelProvider(new DynamicDistributionsLabelProvider());
Label existVersionLabel = new Label(editExistingGroup, SWT.NONE);
// $NON-NLS-1$
existVersionLabel.setText(Messages.getString("DynamicDistributionOptionForm.form.versionLabel.distribution"));
formData = new FormData();
formData.top = new FormAttachment(existingConfigsComboViewer.getControl(), 0, SWT.CENTER);
formData.right = new FormAttachment(0, HORZON_WIDTH);
existVersionLabel.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(0, ALIGN_VERTICAL_INNER);
formData.left = new FormAttachment(existVersionLabel, ALIGN_HORIZON_VERSION_LABEL, SWT.RIGHT);
formData.right = new FormAttachment(100);
existingConfigsComboViewer.getControl().setLayoutData(formData);
importConfigBtn = new Button(container, SWT.RADIO);
// $NON-NLS-1$
importConfigBtn.setText(Messages.getString("DynamicDistributionOptionForm.form.importConfigBtn"));
formData = new FormData();
formData.top = new FormAttachment(editExistingGroup, ALIGN_VERTICAL, SWT.BOTTOM);
formData.left = new FormAttachment(editExistingGroup, 0, SWT.LEFT);
formData.right = new FormAttachment(editExistingGroup, 0, SWT.RIGHT);
importConfigBtn.setLayoutData(formData);
importConfigGroup = new Composite(container, SWT.NONE);
formData = new FormData();
formData.top = new FormAttachment(importConfigBtn, 0, SWT.BOTTOM);
formData.left = new FormAttachment(importConfigBtn, 0, SWT.LEFT);
formData.right = new FormAttachment(importConfigBtn, 0, SWT.RIGHT);
importConfigGroup.setLayoutData(formData);
importConfigGroup.setLayout(new FormLayout());
importConfigText = new Text(importConfigGroup, SWT.BORDER);
importConfigText.setEditable(false);
importConfigBrowseBtn = new Button(importConfigGroup, SWT.PUSH);
// $NON-NLS-1$
importConfigBrowseBtn.setText(Messages.getString("DynamicDistributionOptionForm.form.importConfig.browse"));
formData = new FormData();
formData.top = new FormAttachment(0, ALIGN_VERTICAL_INNER);
formData.left = new FormAttachment(100, -1 * getNewButtonSize(importConfigBrowseBtn).x);
formData.right = new FormAttachment(100);
importConfigBrowseBtn.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(importConfigBrowseBtn, 0, SWT.CENTER);
formData.left = new FormAttachment(0, HORZON_WIDTH + ALIGN_HORIZON_VERSION_LABEL);
formData.right = new FormAttachment(importConfigBrowseBtn, -1 * ALIGN_HORIZON, SWT.LEFT);
importConfigText.setLayoutData(formData);
}
use of org.talend.repository.hadoopcluster.ui.dynamic.form.labelprovider.DynamicDistributionsLabelProvider in project tbd-studio-se by Talend.
the class DynamicDistributionPreferenceForm method createControl.
private void createControl() {
Composite parent = this;
Composite container = createFormContainer(parent);
int ALIGN_HORIZON = getAlignHorizon();
int ALIGN_VERTICAL_INNER = getAlignVerticalInner();
int ALIGN_VERTICAL_INNER2 = ALIGN_VERTICAL_INNER - ALIGN_VERTICAL_INNER / 2;
int ALIGN_VERTICAL = getAlignVertical();
int MARGIN_GROUP = 5;
FormLayout formLayout = new FormLayout();
formLayout.marginTop = MARGIN_GROUP;
formLayout.marginBottom = MARGIN_GROUP;
formLayout.marginLeft = MARGIN_GROUP;
formLayout.marginRight = MARGIN_GROUP;
int distriAlignHorizon = ALIGN_HORIZON;
if (ITalendCorePrefConstants.DYNAMIC_DISTRIBUTION_SETTING == showPart) {
Group group = new Group(container, SWT.NONE);
// $NON-NLS-1$
group.setText(Messages.getString("DynamicDistributionPreferenceForm.group.existing"));
FormData formData = new FormData();
formData.left = new FormAttachment(0);
formData.top = new FormAttachment(0);
formData.right = new FormAttachment(100);
group.setLayoutData(formData);
group.setLayout(formLayout);
Label distributionLabel = new Label(group, SWT.NONE);
// $NON-NLS-1$
distributionLabel.setText(Messages.getString("DynamicDistributionPreferenceForm.label.existing.distribution"));
Point distributionLabelSize = distributionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
distributionCombo = new ComboViewer(group, SWT.READ_ONLY);
distributionCombo.setContentProvider(ArrayContentProvider.getInstance());
distributionCombo.setLabelProvider(new LabelProvider());
formData = new FormData();
formData.top = new FormAttachment(0);
formData.left = new FormAttachment(distributionLabel, distriAlignHorizon, SWT.RIGHT);
formData.right = new FormAttachment(distributionLabel, distriAlignHorizon + 180, SWT.RIGHT);
distributionCombo.getControl().setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(distributionCombo.getControl(), 0, SWT.CENTER);
formData.left = new FormAttachment(0);
formData.width = distributionLabelSize.x;
distributionLabel.setLayoutData(formData);
Label versionLabel = new Label(group, SWT.NONE);
// $NON-NLS-1$
versionLabel.setText(Messages.getString("DynamicDistributionPreferenceForm.label.existing.version"));
formData = new FormData();
formData.top = new FormAttachment(distributionCombo.getControl(), 0, SWT.CENTER);
formData.left = new FormAttachment(distributionCombo.getControl(), ALIGN_HORIZON * 2, SWT.RIGHT);
versionLabel.setLayoutData(formData);
versionCombo = new ComboViewer(group, SWT.READ_ONLY);
deleteBtn = new Button(group, SWT.PUSH);
versionCombo.setContentProvider(ArrayContentProvider.getInstance());
versionCombo.setLabelProvider(new DynamicDistributionsLabelProvider());
formData = new FormData();
formData.top = new FormAttachment(versionLabel, 0, SWT.CENTER);
formData.left = new FormAttachment(versionLabel, ALIGN_HORIZON, SWT.RIGHT);
formData.right = new FormAttachment(deleteBtn, -1 * ALIGN_HORIZON, SWT.LEFT);
versionCombo.getControl().setLayoutData(formData);
// $NON-NLS-1$
deleteBtn.setText(Messages.getString("DynamicDistributionPreferenceForm.label.existing.delete"));
formData = new FormData();
formData.top = new FormAttachment(versionCombo.getControl(), 0, SWT.CENTER);
formData.right = new FormAttachment(100);
formData.width = getNewButtonSize(deleteBtn).x;
deleteBtn.setLayoutData(formData);
buildConfigBtn = new Button(group, SWT.PUSH);
// $NON-NLS-1$
buildConfigBtn.setText(Messages.getString("DynamicDistributionPreferenceForm.button.existing.buildConfig"));
formData = new FormData();
formData.top = new FormAttachment(versionCombo.getControl(), ALIGN_VERTICAL_INNER, SWT.BOTTOM);
formData.left = new FormAttachment(0);
formData.right = new FormAttachment(0, getNewButtonSize(buildConfigBtn).x);
buildConfigBtn.setLayoutData(formData);
} else {
// nexus artifactory setup part
Group nexusSetupGroup = new Group(container, SWT.NONE);
// $NON-NLS-1$
nexusSetupGroup.setText(Messages.getString("DynamicDistributionPreferenceForm.group.dynamicDistribution"));
FormData formData = new FormData();
formData.left = new FormAttachment(0);
formData.top = new FormAttachment(0);
formData.right = new FormAttachment(100);
nexusSetupGroup.setLayoutData(formData);
nexusSetupGroup.setLayout(formLayout);
Label nexusSetupDistriLabel = new Label(nexusSetupGroup, SWT.NONE);
// $NON-NLS-1$
nexusSetupDistriLabel.setText(Messages.getString("DynamicDistributionPreferenceForm.label.nexusSetup.distribution"));
Point nexusSetupDistriLabelSize = nexusSetupDistriLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Label repositoryLabel = new Label(nexusSetupGroup, SWT.NONE);
// $NON-NLS-1$
repositoryLabel.setText(Messages.getString("DynamicDistributionPreferenceForm.label.nexusSetup.repository"));
Point repositoryLabelSize = repositoryLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point distributionLabelSize = nexusSetupDistriLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int labelWidth = distributionLabelSize.x;
if (labelWidth < nexusSetupDistriLabelSize.x) {
labelWidth = nexusSetupDistriLabelSize.x;
}
if (labelWidth < repositoryLabelSize.x) {
labelWidth = repositoryLabelSize.x;
}
setupDistriCombo = new ComboViewer(nexusSetupGroup, SWT.READ_ONLY);
setupDistriCombo.setContentProvider(ArrayContentProvider.getInstance());
setupDistriCombo.setLabelProvider(new LabelProvider());
formData = new FormData();
formData.top = new FormAttachment(0);
formData.left = new FormAttachment(nexusSetupDistriLabel, distriAlignHorizon, SWT.RIGHT);
formData.right = new FormAttachment(nexusSetupDistriLabel, distriAlignHorizon + 180, SWT.RIGHT);
setupDistriCombo.getControl().setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(setupDistriCombo.getControl(), 0, SWT.CENTER);
formData.left = new FormAttachment(0);
formData.width = labelWidth;
nexusSetupDistriLabel.setLayoutData(formData);
overrideDefaultSetupBtn = new Button(nexusSetupGroup, SWT.CHECK);
overrideDefaultSetupBtn.setText(// $NON-NLS-1$
Messages.getString("DynamicDistributionPreferenceForm.label.nexusSetup.overrideDefaultSetup"));
formData = new FormData();
formData.top = new FormAttachment(setupDistriCombo.getControl(), ALIGN_VERTICAL_INNER, SWT.BOTTOM);
formData.left = new FormAttachment(nexusSetupDistriLabel, 0, SWT.LEFT);
overrideDefaultSetupBtn.setLayoutData(formData);
repositoryText = new Text(nexusSetupGroup, SWT.BORDER);
formData = new FormData();
formData.top = new FormAttachment(repositoryText, 0, SWT.CENTER);
formData.left = new FormAttachment(overrideDefaultSetupBtn, 0, SWT.LEFT);
formData.width = labelWidth;
repositoryLabel.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(overrideDefaultSetupBtn, ALIGN_VERTICAL_INNER, SWT.BOTTOM);
formData.left = new FormAttachment(repositoryLabel, ALIGN_HORIZON, SWT.RIGHT);
formData.right = new FormAttachment(100);
repositoryText.setLayoutData(formData);
anonymousBtn = new Button(nexusSetupGroup, SWT.CHECK);
// $NON-NLS-1$
anonymousBtn.setText(Messages.getString("DynamicDistributionPreferenceForm.label.nexusSetup.anonymous"));
formData = new FormData();
formData.top = new FormAttachment(repositoryText, ALIGN_VERTICAL_INNER, SWT.BOTTOM);
formData.left = new FormAttachment(repositoryText, 0, SWT.LEFT);
anonymousBtn.setLayoutData(formData);
Label userLabel = new Label(nexusSetupGroup, SWT.NONE);
// $NON-NLS-1$
userLabel.setText(Messages.getString("DynamicDistributionPreferenceForm.label.nexusSetup.user"));
userText = new Text(nexusSetupGroup, SWT.BORDER);
formData = new FormData();
formData.top = new FormAttachment(anonymousBtn, ALIGN_VERTICAL_INNER2, SWT.BOTTOM);
formData.left = new FormAttachment(anonymousBtn, ALIGN_HORIZON, SWT.RIGHT);
formData.width = 180;
userText.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(userText, 0, SWT.CENTER);
formData.right = new FormAttachment(userText, -1 * ALIGN_HORIZON, SWT.LEFT);
userLabel.setLayoutData(formData);
Label passwordLabel = new Label(nexusSetupGroup, SWT.NONE);
// $NON-NLS-1$
passwordLabel.setText(Messages.getString("DynamicDistributionPreferenceForm.label.nexusSetup.password"));
passwordText = new Text(nexusSetupGroup, SWT.BORDER | SWT.PASSWORD);
formData = new FormData();
formData.top = new FormAttachment(userText, ALIGN_VERTICAL_INNER2, SWT.BOTTOM);
formData.left = new FormAttachment(userText, 0, SWT.LEFT);
formData.right = new FormAttachment(userText, 0, SWT.RIGHT);
passwordText.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(passwordText, 0, SWT.CENTER);
formData.right = new FormAttachment(userLabel, 0, SWT.RIGHT);
passwordLabel.setLayoutData(formData);
checkConnectionBtn = new Button(nexusSetupGroup, SWT.NONE);
checkConnectionBtn.setText(Messages.getString("DynamicDistributionPreferenceForm.button.checkConnection"));
formData = new FormData();
formData.top = new FormAttachment(passwordText, ALIGN_VERTICAL_INNER, SWT.BOTTOM);
formData.right = new FormAttachment(100);
checkConnectionBtn.setLayoutData(formData);
}
}
Aggregations