use of org.talend.core.model.metadata.EMetadataEncoding 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.core.model.metadata.EMetadataEncoding in project tdi-studio-se by Talend.
the class MultiSchemasUI method addGroupMultiSchemaSettings.
private void addGroupMultiSchemaSettings(final Composite mainComposite) {
//$NON-NLS-1$
Group group = Form.createGroup(mainComposite, 1, Messages.getString("FileStep2.groupDelimitedFileSettings"), 280);
Composite composite = new Composite(group, SWT.NONE);
GridLayout gridLayout = new GridLayout(4, false);
gridLayout.marginHeight = 1;
composite.setLayout(gridLayout);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(gd);
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(composite, Messages.getString("FileStep2.encoding"), //$NON-NLS-1$
Messages.getString("FileStep2.encodingTip"), encodingData, 3, true, //$NON-NLS-1$
SWT.NONE);
// Field Separator Combo & Text
String[] fieldSeparatorData = getFieldSeparatorStyleSupportByLanguage();
fieldSeparatorCombo = new LabelledCombo(composite, Messages.getString("FileStep2.fieldSeparator"), //$NON-NLS-1$
Messages.getString("FileStep2.fieldSeparatorDelimitedTip"), fieldSeparatorData, 1, true, //$NON-NLS-1$
SWT.READ_ONLY);
//$NON-NLS-1$
fieldSeparatorText = new LabelledText(composite, "", 1, true, SWT.RIGHT);
// Dimension of columb of Separator Text
GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
gridData.minimumWidth = 80;
fieldSeparatorText.setLayoutData(gridData);
// Row Separator Combo & Text
String[] rowSeparatorData = { RowSeparator.STANDART_EOL_LITERAL.getLiteral(), RowSeparator.CUSTOM_STRING_LITERAL.getLiteral() };
rowSeparatorCombo = new LabelledCombo(composite, Messages.getString("FileStep2.rowSeparator"), //$NON-NLS-1$
Messages.getString("FileStep2.rowSeparatorTip"), rowSeparatorData, 1, true, //$NON-NLS-1$
SWT.READ_ONLY);
//$NON-NLS-1$
rowSeparatorText = new LabelledText(composite, "", 1, true, SWT.RIGHT);
useMultiSaparators = new Button(group, SWT.CHECK);
Composite multiComp = new Composite(group, SWT.NONE);
gridLayout = new GridLayout(2, false);
gridLayout.marginHeight = 1;
multiComp.setLayout(gridLayout);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
multiComp.setLayoutData(gd);
useMultiSaparators.setText(Messages.getString("MultiSchemasUI.useMultiSchemabtn"));
//$NON-NLS-1$
multiSeparatorsText = new LabelledText(multiComp, "Multiple Separators", 1, true);
multiSeparatorsText.setEditable(false);
//$NON-NLS-1$
keyValuesText = new LabelledText(multiComp, Messages.getString("MultiSchemasUI.keyValues"), 1, true);
keyValuesText.setEditable(false);
//$NON-NLS-1$
keyIndexText = new LabelledText(multiComp, Messages.getString("MultiSchemasUI.keyIndex"), 1, true);
keyIndexText.setEditable(false);
}
use of org.talend.core.model.metadata.EMetadataEncoding 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