Search in sources :

Example 1 with EMetadataEncoding

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);
    }
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) LabelledFileField(org.talend.commons.ui.swt.formtools.LabelledFileField) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) EMetadataEncoding(org.talend.core.model.metadata.EMetadataEncoding)

Example 2 with EMetadataEncoding

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);
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) EMetadataEncoding(org.talend.core.model.metadata.EMetadataEncoding) Point(org.eclipse.swt.graphics.Point)

Example 3 with EMetadataEncoding

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();
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) Tree(org.eclipse.swt.widgets.Tree) UtilsButton(org.talend.commons.ui.swt.formtools.UtilsButton) FocusListener(org.eclipse.swt.events.FocusListener) EMetadataEncoding(org.talend.core.model.metadata.EMetadataEncoding)

Aggregations

GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 Group (org.eclipse.swt.widgets.Group)3 LabelledCombo (org.talend.commons.ui.swt.formtools.LabelledCombo)3 EMetadataEncoding (org.talend.core.model.metadata.EMetadataEncoding)3 Button (org.eclipse.swt.widgets.Button)2 Label (org.eclipse.swt.widgets.Label)2 Text (org.eclipse.swt.widgets.Text)2 LabelledText (org.talend.commons.ui.swt.formtools.LabelledText)2 FocusEvent (org.eclipse.swt.events.FocusEvent)1 FocusListener (org.eclipse.swt.events.FocusListener)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 Point (org.eclipse.swt.graphics.Point)1 Tree (org.eclipse.swt.widgets.Tree)1 CommandStackForComposite (org.talend.commons.ui.command.CommandStackForComposite)1 LabelledFileField (org.talend.commons.ui.swt.formtools.LabelledFileField)1 UtilsButton (org.talend.commons.ui.swt.formtools.UtilsButton)1