Search in sources :

Example 1 with LabelledCombo

use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.

the class MultiSchemasUI method addGroupEscapeChar.

private void addGroupEscapeChar(final Composite mainComposite) {
    // Composite Escape Char
    //$NON-NLS-1$
    Group group = Form.createGroup(mainComposite, 3, Messages.getString("FileStep2.groupEscapeCharSettings"), 100);
    // CSV or Positionel Radio
    csvRadio = new Button(group, SWT.RADIO);
    csvRadio.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            getConnection().setCsvOption(csvRadio.getSelection());
            if (csvRadio.getSelection()) {
                getConnection().setSplitRecord(false);
            }
        }
    });
    //$NON-NLS-1$
    csvRadio.setText(Messages.getString("FileStep2.csv"));
    delimitedRadio = new Button(group, SWT.RADIO);
    //$NON-NLS-1$
    delimitedRadio.setText(Messages.getString("FileStep2.delimited"));
    GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
    gridData.horizontalSpan = 2;
    delimitedRadio.setLayoutData(gridData);
    getConnection().setCsvOption(false);
    delimitedRadio.setSelection(true);
    // escape Char Combo
    escapeCharCombo = new LabelledCombo(group, Messages.getString("FileStep2.escapeChar"), //$NON-NLS-1$
    Messages.getString("FileStep2.escapeCharTip"), ESCAPE_CHAR_DATA, 1, false, //$NON-NLS-1$
    SWT.READ_ONLY);
    escapeCharFlag = new Label(group, SWT.NONE);
    //$NON-NLS-1$
    escapeCharFlag.setText("    ");
    // Text Enclosure Combo
    textEnclosureCombo = new LabelledCombo(group, Messages.getString("FileStep2.textEnclosure"), //$NON-NLS-1$
    Messages.getString("FileStep2.textEnclosureTip"), TEXT_ENCLOSURE_DATA, 1, false, //$NON-NLS-1$
    SWT.READ_ONLY);
    textEnclosureFlag = new Label(group, SWT.NONE);
    //$NON-NLS-1$
    textEnclosureFlag.setText("    ");
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) Group(org.eclipse.swt.widgets.Group) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 2 with LabelledCombo

use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.

the class FTPForm method addFields.

/*
     * (non-Javadoc)
     *
     * @see org.talend.repository.ui.swt.utils.AbstractForm#addFields()
     */
@Override
protected void addFields() {
    Group ftpParameterGroup = new Group(this, SWT.NULL);
    //$NON-NLS-1$
    ftpParameterGroup.setText("Server");
    GridLayout ftpParameterLayout = new GridLayout();
    ftpParameterLayout.numColumns = 2;
    ftpParameterGroup.setLayout(ftpParameterLayout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    ftpParameterGroup.setLayoutData(gridData);
    //$NON-NLS-1$
    ftpUsernameText = new LabelledText(ftpParameterGroup, Messages.getString("FTPForm_ftpUsernameText"), true);
    ftpPasswordText = new LabelledText(ftpParameterGroup, Messages.getString("FTPForm_ftpPasswordText"), 1, //$NON-NLS-1$
    SWT.BORDER | SWT.PASSWORD);
    //$NON-NLS-1$
    ftpHostText = new LabelledText(ftpParameterGroup, Messages.getString("FTPForm_ftpHostText"), true);
    //$NON-NLS-1$
    ftpPortText = new LabelledText(ftpParameterGroup, Messages.getString("FTPForm_ftpPortText"), true);
    encodingComp = new Composite(ftpParameterGroup, SWT.NONE);
    GridData encodingCompGD = new GridData(SWT.FILL, SWT.CENTER, true, false);
    encodingCompGD.horizontalSpan = 2;
    encodingComp.setLayoutData(encodingCompGD);
    GridLayout encodingCompLayout = new GridLayout(4, false);
    encodingCompLayout.marginWidth = 0;
    encodingComp.setLayout(encodingCompLayout);
    fnEncodingBtn = new Button(encodingComp, SWT.CHECK);
    //$NON-NLS-1$
    fnEncodingBtn.setText("Filename encoding");
    fnEncodingBtnGD = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    fnEncodingBtn.setLayoutData(fnEncodingBtnGD);
    List<String> codeList = new ArrayList<String>();
    codeList.add(ENCODING);
    //$NON-NLS-1$
    codeList.add("UTF-8");
    codeList.add(CUSTOM);
    //$NON-NLS-1$ //$NON-NLS-2$
    encodeCombo = new LabelledCombo(encodingComp, "Encoding", "", codeList);
    if (getConnection().getEcoding() == null || "".equals(getConnection().getEcoding())) {
        //$NON-NLS-1$
        encodeCombo.setText(ENCODING);
        getConnection().setEcoding(encodeCombo.getText());
    }
    customText = new Text(encodingComp, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.horizontalSpan = 1;
    customText.setLayoutData(gd);
    List<String> connList = new ArrayList<String>();
    //$NON-NLS-1$
    connList.add("Passive");
    //$NON-NLS-1$
    connList.add("Active");
    //$NON-NLS-1$ //$NON-NLS-2$
    connModelCombo = new LabelledCombo(ftpParameterGroup, Messages.getString("FTPForm_conn_model"), "", connList);
    if (getConnection().getMode() == null || "".equals(getConnection().getMode())) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        connModelCombo.setText(Messages.getString("FTPForm_passive"));
        getConnection().setMode(connModelCombo.getText());
    }
    buildGroup = new Group(this, SWT.NULL);
    //$NON-NLS-1$
    buildGroup.setText("Parameter");
    GridLayout layoutGroup = new GridLayout(1, false);
    buildGroup.setLayout(layoutGroup);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    buildGroup.setLayoutData(gridData);
    Composite checkButtonCom = new Composite(buildGroup, SWT.NONE);
    layoutGroup = new GridLayout(2, false);
    checkButtonCom.setLayout(layoutGroup);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    checkButtonCom.setLayoutData(gridData);
    sftpSuppBut = new Button(checkButtonCom, SWT.CHECK);
    //$NON-NLS-1$
    sftpSuppBut.setText(Messages.getString("FTPForm_sftp_suport"));
    ftpsSuppBut = new Button(checkButtonCom, SWT.CHECK);
    //$NON-NLS-1$
    ftpsSuppBut.setText(Messages.getString("FTPForm_ftps_support"));
    String[] methodComboStr = { PUBLIC_KEY, PASSWORD };
    tetsCom = new Composite(buildGroup, SWT.NONE);
    layoutGroup = new GridLayout(1, false);
    tetsCom.setLayout(layoutGroup);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    tetsCom.setLayoutData(gridData);
    sftpChildCom = new Composite(tetsCom, SWT.NONE);
    layoutGroup = new GridLayout(3, false);
    sftpChildCom.setLayout(layoutGroup);
    sftpChildComGridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.minimumWidth = 300;
    gridData.minimumHeight = 120;
    gridData.widthHint = 300;
    gridData.heightHint = 110;
    sftpChildCom.setLayoutData(sftpChildComGridData);
    methodCombo = new LabelledCombo(sftpChildCom, Messages.getString("FTPForm_authen_method"), "", methodComboStr, 2, false, //$NON-NLS-1$ //$NON-NLS-2$
    SWT.NONE);
    // file Field
    //$NON-NLS-1$
    String[] extensions = { "*.*" };
    //$NON-NLS-1$
    privatekeyText = new LabelledFileField(sftpChildCom, Messages.getString("FTPForm_privatekeyText"), extensions);
    passphraseText = new LabelledText(sftpChildCom, Messages.getString("FTPForm_passphraseText"), 1, //$NON-NLS-1$
    SWT.BORDER | SWT.PASSWORD);
    ftpsChildCom = new Composite(tetsCom, SWT.NONE);
    layoutGroup = new GridLayout(3, false);
    ftpsChildCom.setLayout(layoutGroup);
    ftpsChildComGridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.minimumWidth = 300;
    gridData.minimumHeight = 120;
    gridData.widthHint = 300;
    gridData.heightHint = 90;
    ftpsChildCom.setLayoutData(ftpsChildComGridData);
    //$NON-NLS-1$
    keyFileText = new LabelledFileField(ftpsChildCom, Messages.getString("FTPForm_keyFileText"), extensions);
    keyPasswordText = new LabelledText(ftpsChildCom, Messages.getString("FTPForm_keyPasswordText"), 1, //$NON-NLS-1$
    SWT.BORDER | SWT.PASSWORD);
    proxyCom = new Composite(buildGroup, SWT.NONE);
    layoutGroup = new GridLayout(1, false);
    proxyCom.setLayout(layoutGroup);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    proxyCom.setLayoutData(gridData);
    useSocksBut = new Button(proxyCom, SWT.CHECK);
    //$NON-NLS-1$
    useSocksBut.setText(Messages.getString("FTPForm_sccks_proxy"));
    proxyChildCom = new Composite(proxyCom, SWT.NONE);
    layoutGroup = new GridLayout(2, false);
    proxyChildCom.setLayout(layoutGroup);
    proxyChildComGridData = new GridData(GridData.FILL_HORIZONTAL);
    proxyChildCom.setLayoutData(proxyChildComGridData);
    //$NON-NLS-1$
    proxyHostText = new LabelledText(proxyChildCom, Messages.getString("FTPForm_proxyHostText"), true);
    //$NON-NLS-1$
    proxyPortText = new LabelledText(proxyChildCom, Messages.getString("FTPForm_proxyPortText"), true);
    //$NON-NLS-1$
    proxyUsernameText = new LabelledText(proxyChildCom, Messages.getString("FTPForm_proxyUsernameText"), true);
    proxyPasswordText = new LabelledText(proxyChildCom, Messages.getString("FTPForm_proxyPasswordText"), 1, //$NON-NLS-1$
    SWT.BORDER | SWT.PASSWORD);
    checkFieldsValue();
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) LabelledFileField(org.talend.commons.ui.swt.formtools.LabelledFileField) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 3 with LabelledCombo

use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.

the class ConnectionFormComposite method fillBean.

private void fillBean(boolean cleanDynamicValue) {
    if (connection != null) {
        if (getRepository() != null) {
            connection.setRepositoryId(getRepository().getId());
            Map<String, String> connFields = new HashMap<String, String>();
            Map<String, LabelText> map = dynamicControls.get(getRepository());
            for (String fieldKey : map.keySet()) {
                if (cleanDynamicValue) {
                    map.get(fieldKey).setText("");
                }
                connFields.put(fieldKey, map.get(fieldKey).getText());
            }
            Map<String, LabelledCombo> map2 = dynamicChoices.get(getRepository());
            for (String fieldKey : map2.keySet()) {
                for (DynamicChoiceBean dynamicChoiceBean : getRepository().getChoices()) {
                    if (dynamicChoiceBean.getId().equals(fieldKey)) {
                        int selectionIndex = map2.get(fieldKey).getCombo().getSelectionIndex();
                        connFields.put(fieldKey, dynamicChoiceBean.getChoiceValue(selectionIndex));
                    }
                }
            }
            connection.setDynamicFields(connFields);
        }
        connection.setName(nameText.getText());
        connection.setDescription(descriptionText.getText());
        connection.setUser(userText.getText());
        connection.setPassword(passwordText.getText());
        connection.setWorkSpace(workSpaceText.getText());
        connectionsListComposite.refresh(connection);
    }
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) HashMap(java.util.HashMap) LabelText(org.talend.commons.ui.swt.formtools.LabelText) DynamicChoiceBean(org.talend.core.repository.model.DynamicChoiceBean)

Example 4 with LabelledCombo

use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.

the class ConnectionFormComposite method fillFields.

private void fillFields() {
    if (connection != null) {
        removeListeners();
        String repositoryId = connection.getRepositoryId();
        if (repositoryId == null || "".equals(repositoryId)) {
            if (getRepository() != null) {
                connection.setRepositoryId(getRepository().getId());
            } else {
                connection.setRepositoryId(RepositoryConstants.REPOSITORY_LOCAL_ID);
            }
        }
        IRepositoryFactory repositoriyById = RepositoryFactoryProvider.getRepositoriyById(repositoryId);
        repositoryCombo.setSelection(new StructuredSelection(new Object[] { repositoriyById }));
        if (getRepository() != null) {
            Map<String, LabelText> map = dynamicControls.get(getRepository());
            for (String fieldKey : map.keySet()) {
                LabelText current = map.get(fieldKey);
                String string = connection.getDynamicFields().get(fieldKey);
                //$NON-NLS-1$
                current.setText(string == null ? "" : string);
            }
            Map<String, LabelledCombo> map2 = dynamicChoices.get(getRepository());
            for (String fieldKey : map2.keySet()) {
                Combo combo = map2.get(fieldKey).getCombo();
                String value = connection.getDynamicFields().get(fieldKey);
                combo.deselectAll();
                for (DynamicChoiceBean dynamicChoiceBean : getRepository().getChoices()) {
                    if (dynamicChoiceBean.getId().equals(fieldKey)) {
                        combo.select(dynamicChoiceBean.getChoiceIndex(value));
                    }
                }
            }
        }
        //$NON-NLS-1$
        nameText.setText((connection.getName() == null ? "" : connection.getName()));
        //$NON-NLS-1$
        descriptionText.setText((connection.getDescription() == null ? "" : connection.getDescription()));
        //$NON-NLS-1$
        userText.setText((connection.getUser() == null ? "" : connection.getUser()));
        //$NON-NLS-1$
        passwordText.setText((connection.getPassword() == null ? "" : connection.getPassword()));
        workSpaceText.setText(//$NON-NLS-1$
        ("".equals(connection.getWorkSpace()) || connection.getWorkSpace() == null) ? getRecentWorkSpace() : connection.getWorkSpace());
        addListeners();
    }
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) IRepositoryFactory(org.talend.core.repository.model.IRepositoryFactory) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) LabelText(org.talend.commons.ui.swt.formtools.LabelText) Combo(org.eclipse.swt.widgets.Combo) LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) DynamicChoiceBean(org.talend.core.repository.model.DynamicChoiceBean)

Example 5 with LabelledCombo

use of org.talend.commons.ui.swt.formtools.LabelledCombo in project tdi-studio-se by Talend.

the class CreateSandboxProjectDialog method createProjectInfors.

private void createProjectInfors(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // url
    Composite urlComp = new Composite(composite, SWT.NONE);
    urlComp.setLayout(new GridLayout(3, false));
    urlComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    //$NON-NLS-1$
    urlText = new LabelledText(urlComp, Messages.getString("CreateSandboxProjectDialog.UrlTitle"));
    // if (existedBeforeConn()) {
    // urlText.setText(getExistedBeforeConnURL());
    // }
    checkBtn = new Button(urlComp, SWT.PUSH);
    //$NON-NLS-1$
    checkBtn.setText(Messages.getString("CreateSandboxProjectDialog.CheckTitle"));
    projectGroup = new Group(composite, SWT.NONE);
    //$NON-NLS-1$
    projectGroup.setText(Messages.getString("CreateSandboxProjectDialog.Settings"));
    projectGroup.setLayout(new GridLayout(2, false));
    projectGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    projectLabelText = new LabelledText(projectGroup, Messages.getString("CreateSandboxProjectDialog.ProjectLabel"), 1, //$NON-NLS-1$
    SWT.SINGLE);
    GridData layoutData = new GridData();
    layoutData.widthHint = 180;
    layoutData.minimumWidth = 180;
    projectLabelText.setLayoutData(layoutData);
    projectLabelText.getTextControl().setEditable(false);
    languageCombo = new LabelledCombo(projectGroup, Messages.getString("NewProjectWizardPage.language"), null, new String[] { //$NON-NLS-1$
    ECodeLanguage.JAVA.getName() });
    layoutData = new GridData();
    layoutData.widthHint = 100;
    layoutData.minimumWidth = 100;
    languageCombo.getCombo().setLayoutData(layoutData);
    // default for java
    languageCombo.select(0);
    // user
    createUserInfors(projectGroup);
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Aggregations

LabelledCombo (org.talend.commons.ui.swt.formtools.LabelledCombo)23 GridData (org.eclipse.swt.layout.GridData)16 Button (org.eclipse.swt.widgets.Button)14 Composite (org.eclipse.swt.widgets.Composite)13 GridLayout (org.eclipse.swt.layout.GridLayout)12 LabelledText (org.talend.commons.ui.swt.formtools.LabelledText)11 Group (org.eclipse.swt.widgets.Group)9 Label (org.eclipse.swt.widgets.Label)5 Text (org.eclipse.swt.widgets.Text)5 LabelText (org.talend.commons.ui.swt.formtools.LabelText)5 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)4 ArrayList (java.util.ArrayList)3 Combo (org.eclipse.swt.widgets.Combo)3 LabelledFileField (org.talend.commons.ui.swt.formtools.LabelledFileField)3 EMetadataEncoding (org.talend.core.model.metadata.EMetadataEncoding)3 NoSQLRepositoryFactory (org.talend.repository.nosql.factory.NoSQLRepositoryFactory)3 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2