use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.
the class JSONFileOutputStep1Form method createOutputSettingArea.
private void createOutputSettingArea() {
Group group = Form.createGroup(this, 1, "Output Setting", 80);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = 150;
group.setLayoutData(data);
Composite compositeButton = Form.startNewDimensionnedGridLayout(group, 1, WIDTH_GRIDDATA_PIXEL, 20);
noFileButton = new Button(compositeButton, SWT.RADIO);
noFileButton.setText("Create manually");
useFileButton = new Button(compositeButton, SWT.RADIO);
useFileButton.setText("Create from a file");
Composite compositeOutput = Form.startNewDimensionnedGridLayout(group, 3, WIDTH_GRIDDATA_PIXEL, 20);
String[] extensions = new String[] { "*.JSON", "*.*", "*" };
jsonFilePath = new LabelledFileField(compositeOutput, "JSON File", extensions);
jsonFilePath.setText("");
EMetadataEncoding[] values = EMetadataEncoding.values();
String[] encodingData = new String[values.length];
for (int j = 0; j < values.length; j++) {
encodingData[j] = values[j].getName();
}
encodingCombo = new LabelledCombo(compositeOutput, "Encording", "Encording", encodingData, 1, true, SWT.NONE);
encodingCombo.setText("");
Composite limitation = new Composite(compositeOutput, SWT.NONE);
limitation.setLayout(new GridLayout(2, false));
labelLimitation = new Label(limitation, SWT.LEFT);
labelLimitation.setText("Limit");
commonNodesLimitation = new Text(limitation, SWT.BORDER);
GridData gd = new GridData(18, 12);
commonNodesLimitation.setLayoutData(gd);
commonNodesLimitation.setText(String.valueOf(TreePopulator.getLimit()));
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, commonNodesLimitation.getText()));
if (!noFileButton.getSelection() && !useFileButton.getSelection()) {
noFileButton.setSelection(true);
}
}
use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tbd-studio-se by Talend.
the class AbstractNoSQLSchemaForm method createComboTableField.
/**
* DOC PLV Comment method "createComboPart".
*/
protected void createComboTableField() {
tableCombo = new LabelledCombo(container, "Based on " + getTableDisplayName(), "", // $NON-NLS-1$ //$NON-NLS-2$
getListTableNames().toArray(new String[0]), 1, true, SWT.NONE);
refreshBtn = new Button(container, SWT.PUSH);
refreshBtn.setImage(ImageProvider.getImage(EImage.REFRESH_ICON));
// $NON-NLS-1$
refreshBtn.setToolTipText(Messages.getString("AbstractNoSQLSchemaForm.RefreshToolTip"));
}
use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tbd-studio-se by Talend.
the class MongoDBConnForm method addConnectionGroup.
/**
* DOC PLV Comment method "addConnectionGroup".
*/
private void addConnectionGroup(Composite composite) {
// create group
// $NON-NLS-1$
connectionGroup = Form.createGroup(composite, 4, Messages.getString("MongoDBConnForm.connection"));
connectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
GridLayout gpGrid = new GridLayout(4, false);
gpGrid.marginWidth = 5;
gpGrid.marginHeight = 5;
connectionGroup.setLayout(gpGrid);
Composite versionComposite = new Composite(connectionGroup, SWT.NONE);
versionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout versionCompLayout = new GridLayout(4, false);
versionCompLayout.marginWidth = 0;
versionCompLayout.marginHeight = 0;
versionComposite.setLayout(versionCompLayout);
// create DB_Version Combo
NoSQLRepositoryFactory repFactory = NoSQLRepositoryFactory.getInstance();
List<String> dbVersions = repFactory.getDBVersions(getConnection().getDbType());
List<String> dbVersionLabels = repositoryTranslator.getLabels(dbVersions);
dbVersionCombo = new LabelledCombo(versionComposite, Messages.getString("MongoDBConnForm.dbVersion"), Messages.getString("MongoDBConnForm.dbVersionTip"), dbVersionLabels.toArray(new String[0]), 3, // $NON-NLS-1$ //$NON-NLS-2$
true);
// create replica button
checkUseReplicaBtn = new Button(versionComposite, SWT.CHECK);
// $NON-NLS-1$
checkUseReplicaBtn.setText(Messages.getString("MongoDBConnForm.useReplicaBtn"));
checkUseReplicaBtn.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 4, 1));
// create connection string
Composite connstrComposite = new Composite(versionComposite, SWT.NONE);
connstrComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout connstrCompLayout = new GridLayout(4, false);
connstrCompLayout.marginWidth = 0;
connstrCompLayout.marginHeight = 0;
connstrComposite.setLayout(versionCompLayout);
checkUseConnStringBtn = new Button(connstrComposite, SWT.CHECK);
// $NON-NLS-1$
checkUseConnStringBtn.setText(Messages.getString("MongoDBConnForm.useConnStringBtn"));
checkUseConnStringBtn.setLayoutData(new GridData(SWT.BEGINNING, SWT.LEFT, false, false, 1, 1));
connStringText = new Text(connstrComposite, SWT.BORDER | SWT.SINGLE);
connStringText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
connStringText.setVisible(false);
// create connection composite
connComposite = new Composite(connectionGroup, SWT.NONE);
connComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout connCompLayout = new GridLayout(4, false);
connCompLayout.marginWidth = 0;
connCompLayout.marginHeight = 0;
connComposite.setLayout(connCompLayout);
// $NON-NLS-1$
serverText = new LabelledText(connComposite, Messages.getString("MongoDBConnForm.server"), 1);
// $NON-NLS-1$
portText = new LabelledText(connComposite, Messages.getString("MongoDBConnForm.port"), 1);
// create replica field
replicaComposite = new Composite(connectionGroup, SWT.NONE);
replicaComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout replicaLayout = new GridLayout();
replicaLayout.marginWidth = 0;
replicaLayout.marginHeight = 0;
replicaComposite.setLayout(replicaLayout);
Composite databaseComposite = new Composite(connectionGroup, SWT.NONE);
databaseComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout dbCompLayout = new GridLayout(4, false);
dbCompLayout.marginWidth = 0;
dbCompLayout.marginHeight = 0;
databaseComposite.setLayout(dbCompLayout);
// $NON-NLS-1$
databaseText = new LabelledText(databaseComposite, Messages.getString("MongoDBConnForm.database"), 3, true);
initReplicaField();
MongoDBReplicaFieldModel model = new MongoDBReplicaFieldModel(replicaList, // $NON-NLS-1$
Messages.getString("MongoDBConnForm.replicaView"));
replicaTableView = new MongoDBReplicaTableView(model, replicaComposite);
final Composite fieldTableEditorComposite = replicaTableView.getMainComposite();
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
gridData.heightHint = 180;
fieldTableEditorComposite.setLayoutData(gridData);
fieldTableEditorComposite.setBackground(null);
}
use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tbd-studio-se by Talend.
the class CassandraConnForm method addConnectionGroup.
/**
* DOC PLV Comment method "addConnectionGroup".
*/
private void addConnectionGroup(Composite composite) {
// create connection group
// $NON-NLS-1$
connectionGroup = Form.createGroup(composite, 4, Messages.getString("CassandraConnForm.connection"));
connectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
GridLayout gpGrid = new GridLayout(4, false);
gpGrid.marginWidth = 5;
gpGrid.marginHeight = 5;
connectionGroup.setLayout(gpGrid);
// create connection composite
Composite connComposite = new Composite(connectionGroup, SWT.NONE);
connComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout connCompLayout = new GridLayout(4, false);
connCompLayout.marginWidth = 0;
connCompLayout.marginHeight = 0;
connComposite.setLayout(connCompLayout);
// create dbVersion and apiType group composite
Composite dbVersionGroupComposite = new Composite(connComposite, SWT.NONE);
dbVersionGroupComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
GridLayout dbVersionGroupCompLayout = new GridLayout(4, false);
dbVersionGroupCompLayout.marginWidth = 0;
dbVersionGroupCompLayout.marginHeight = 0;
dbVersionGroupComposite.setLayout(dbVersionGroupCompLayout);
NoSQLRepositoryFactory repFactory = NoSQLRepositoryFactory.getInstance();
List<String> dbVersions = repFactory.getDBVersions(getConnection().getDbType());
List<String> dbVersionLabels = repositoryTranslator.getLabels(dbVersions);
dbVersionCombo = new LabelledCombo(dbVersionGroupComposite, Messages.getString("CassandraConnForm.dbVersion"), Messages.getString("CassandraConnForm.dbVersionTip"), dbVersionLabels.toArray(new String[0]), 1, // $NON-NLS-1$ //$NON-NLS-2$
true);
String[] apiTypes = ICassandraConstants.API_TYPES;
List<String> apiTypeLabels = repositoryTranslator.getLabels(Arrays.asList(apiTypes));
apiTypeCombo = new LabelledCombo(dbVersionGroupComposite, Messages.getString("CassandraConnForm.apiType"), Messages.getString("CassandraConnForm.apiTypeTip"), apiTypeLabels.toArray(new String[0]), 1, // $NON-NLS-1$ //$NON-NLS-2$
true);
updateAPITypeComboField();
// $NON-NLS-1$
serverText = new LabelledText(connComposite, Messages.getString("CassandraConnForm.server"), 1);
// $NON-NLS-1$
portText = new LabelledText(connComposite, Messages.getString("CassandraConnForm.port"), 1);
updatePortDecoration();
// $NON-NLS-1$
databaseText = new LabelledText(connComposite, Messages.getString("CassandraConnForm.keyspace"), 1, true);
}
use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.
the class JSONFileStep1Form method addFields.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.swt.utils.AbstractForm#addFields()
*/
@Override
protected void addFields() {
// Group File Location
Group group = Form.createGroup(this, 1, "File Settings", 100);
Composite compositeFileLocation = Form.startNewDimensionnedGridLayout(group, 3, WIDTH_GRIDDATA_PIXEL, 100);
GridData gridDataFileLocation = new GridData(GridData.FILL_HORIZONTAL);
gridDataFileLocation.minimumWidth = WIDTH_GRIDDATA_PIXEL;
group.setLayoutData(gridDataFileLocation);
// file Field XSD
// String[] xsdExtensions = { "*.xsd", "*.*", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// fileFieldXsd = new LabelledFileField(compositeFileLocation, Messages.getString("JSONFileStep1.filepathXsd"),
// xsdExtensions);
// checkBox IsGuess
// checkBoxIsGuess = new Button(compositeFileLocation, SWT.CHECK);
// labelIsGuess = new Label(compositeFileLocation, SWT.LEFT);
// GridData gridDataLabel = new GridData();
// gridDataLabel.horizontalSpan = 2;
// labelIsGuess.setLayoutData(gridDataLabel);
// labelIsGuess.setText(Messages.getString("JSONFileStep1.checkBoxIsGuess"));
// file Field JSON
List<String> readbyModeValues = EJsonReadbyMode.getUsableReadbyModeValues();
readbyCombo = new LabelledCombo(compositeFileLocation, "Read By", "Read By", readbyModeValues.toArray(new String[readbyModeValues.size()]), 2, true, SWT.READ_ONLY);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String[] JSONExtensions = { "*.JSON", "*.*", "*" };
fileFieldJSON = new //$NON-NLS-1$
LabelledFileField(//$NON-NLS-1$
compositeFileLocation, //$NON-NLS-1$
"Json", JSONExtensions);
EMetadataEncoding[] values = EMetadataEncoding.values();
String[] encodingData = new String[values.length];
for (int j = 0; j < values.length; j++) {
encodingData[j] = values[j].getName();
}
//$NON-NLS-1$
encodingCombo = new LabelledCombo(compositeFileLocation, "Encoding", "Encoding", encodingData, 1, true, SWT.NONE);
Composite limitation = new Composite(compositeFileLocation, SWT.NONE);
limitation.setLayout(new GridLayout(2, false));
labelLimitation = new Label(limitation, SWT.LEFT);
//$NON-NLS-1$
labelLimitation.setText("Limit");
commonNodesLimitation = new Text(limitation, SWT.BORDER);
GridData gd = new GridData(18, 12);
commonNodesLimitation.setLayoutData(gd);
commonNodesLimitation.setText(String.valueOf(TreePopulator.getLimit()));
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, commonNodesLimitation.getText()));
commonNodesLimitation.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String str = commonNodesLimitation.getText();
if ((!str.matches("\\d+")) || (Integer.valueOf(str) < 0)) {
//$NON-NLS-1$
commonNodesLimitation.setText(String.valueOf(treePopulator.getLimit()));
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, commonNodesLimitation.getText()));
;
} else {
limit = Integer.valueOf(str);
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, limit));
}
String tempxml = null;
if (tempJSONXsdPath != null && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
tempxml = getFilePath4Populate(tempJSONXsdPath);
} else {
tempxml = getFilePath4Populate(fileFieldJSON.getText());
}
switchPopulator(JSONFileStep1Form.this.wizard.getReadbyMode(), tempxml);
checkFieldsValue();
}
});
commonNodesLimitation.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
commonNodesLimitation.setText(String.valueOf(TreePopulator.getLimit()));
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, commonNodesLimitation.getText()));
}
});
// field XmaskPattern
// fieldMaskXPattern = new LabelledText(compositeFileLocation,
// Messages.getString("JSONFileStep1.maskXPattern"));
// Group Schema Viewer
group = Form.createGroup(this, 1, "Schema Viewer", 220);
Composite compositeFileViewer = Form.startNewDimensionnedGridLayout(group, 1, WIDTH_GRIDDATA_PIXEL, 220);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.minimumWidth = WIDTH_GRIDDATA_PIXEL;
// gridData.minimumHeight = 150;
availableJSONTree = new Tree(compositeFileViewer, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
availableJSONTree.setLayoutData(gridData);
if (!isInWizard()) {
// Composite BottomButton
Composite compositeBottomButton = Form.startNewGridLayout(this, 2, false, SWT.CENTER, SWT.CENTER);
// Button Cancel
cancelButton = new UtilsButton(compositeBottomButton, "Cancel", WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
}
addUtilsButtonListeners();
}
Aggregations