Search in sources :

Example 31 with LabelledText

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

the class SetJDBCDriverPreferencePage method createContents.

@Override
protected Control createContents(Composite parent) {
    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(new GridLayout(3, false));
    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout2 = (GridLayout) mainComposite.getLayout();
    layout2.marginHeight = 0;
    layout2.marginTop = 0;
    layout2.marginBottom = 0;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.horizontalSpan = 3;
    header = new Label(mainComposite, SWT.WRAP);
    header.setLayoutData(gridData);
    // $NON-NLS-1$
    header.setText(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.heard"));
    dbTypeLabel = new Label(mainComposite, SWT.WRAP);
    // $NON-NLS-1$
    dbTypeLabel.setText(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.dbType") + dbType_jdbc);
    dbTypeLabel.setLayoutData(gridData);
    generalJdbcUrlText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.url"), // $NON-NLS-1$
    2);
    String url = getPreferenceStore().getString(URL_KEY);
    generalJdbcUrlText.setText(url != null ? url : PluginConstant.EMPTY_STRING);
    generalJdbcDriverjarText = new LabelledText(mainComposite, // $NON-NLS-1$
    DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.jarfile"), 1);
    String driver = getPreferenceStore().getString(DRIVER_KEY);
    generalJdbcDriverjarText.setText(driver != null ? driver : PluginConstant.EMPTY_STRING);
    browseJarFilesButton = new Button(mainComposite, SWT.NONE);
    // $NON-NLS-1$
    browseJarFilesButton.setText("...");
    generalJdbcClassNameText = new LabelledCombo(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.classname"), "", null, 1, true, // $NON-NLS-1$
    SWT.NONE);
    String className = getPreferenceStore().getString(CLASSNAME_KEY);
    generalJdbcClassNameText.setText(className != null ? className : PluginConstant.EMPTY_STRING);
    browseClassButton = new Button(mainComposite, SWT.NONE);
    // $NON-NLS-1$
    browseClassButton.setText("...");
    generalJdbcUserText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.user"), // $NON-NLS-1$
    2);
    String userName = getPreferenceStore().getString(USERNAME_KEY);
    generalJdbcUserText.setText(userName != null ? userName : PluginConstant.EMPTY_STRING);
    generalJdbcPasswordText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.password"), // $NON-NLS-1$
    2);
    // see
    generalJdbcPasswordText.getTextControl().setEchoChar('*');
    String password = getPreferenceStore().getString(PASSWORD_KEY);
    generalJdbcPasswordText.setText(password != null ? password : PluginConstant.EMPTY_STRING);
    generalMappingFileText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.mapping"), // $NON-NLS-1$
    1);
    String mapFile = getPreferenceStore().getString(MAPFILE_KEY);
    generalMappingFileText.setText(mapFile != null ? mapFile : PluginConstant.EMPTY_STRING);
    generalMappingSelectButton = new Button(mainComposite, SWT.NONE);
    // $NON-NLS-1$
    generalMappingSelectButton.setText("...");
    applyButton = new Button(mainComposite, SWT.CENTER | SWT.BOTTOM);
    // $NON-NLS-1$
    applyButton.setText(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.selectConnectionButton"));
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.CENTER;
    gd.horizontalSpan = 3;
    applyButton.setLayoutData(gd);
    applyButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            CheckedTreeSelectionDialog dialog = createConnSelectDialog();
            dialog.create();
            if (dialog.open() == Window.OK) {
                Object[] selects = dialog.getResult();
                if (selects != null && selects.length > 0) {
                    boolean isConfirm = MessageDialog.openConfirm(dialog.getShell(), // $NON-NLS-1$
                    DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.confirmTitle"), // $NON-NLS-1$
                    DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.confirmContent"));
                    if (!isConfirm) {
                        return;
                    }
                    saveDatabases(selects);
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    browseJarFilesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            SelectDatabaseJarDialog dialog = new SelectDatabaseJarDialog(getShell(), generalJdbcDriverjarText.getText());
            if (dialog.open() == Window.OK) {
                generalJdbcDriverjarText.setText(dialog.getJarsString());
            }
        }
    });
    browseClassButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            generalJdbcClassNameText.removeAll();
            for (String stringToFile : generalJdbcDriverjarText.getText().trim().split(";")) {
                // $NON-NLS-1$
                File file = new File(stringToFile);
                if (file != null) {
                    try {
                        MyURLClassLoader cl = new MyURLClassLoader(file.toURL());
                        Class[] classes = cl.getAssignableClasses(Driver.class);
                        for (Class classe : classes) {
                            generalJdbcClassNameText.add(classe.getName());
                        }
                    } catch (Exception ex) {
                        ExceptionHandler.process(ex);
                    }
                }
            }
            if (generalJdbcClassNameText.getItemCount() > 0) {
                String driverClassName = generalJdbcClassNameText.getItem(0);
                generalJdbcClassNameText.setText(driverClassName);
            }
        }
    });
    generalMappingSelectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            MappingFileSelectDialog dialog = new MappingFileSelectDialog(getShell());
            dialog.open();
            generalMappingFileText.setText(dialog.getSelectId());
        }
    });
    return mainComposite;
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) Composite(org.eclipse.swt.widgets.Composite) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) MyURLClassLoader(org.talend.commons.ui.utils.loader.MyURLClassLoader) Driver(java.sql.Driver) PersistenceException(org.talend.commons.exception.PersistenceException) SelectDatabaseJarDialog(org.talend.repository.ui.wizards.metadata.connection.database.SelectDatabaseJarDialog) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MappingFileSelectDialog(org.talend.metadata.managment.ui.dialog.MappingFileSelectDialog) File(java.io.File) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 32 with LabelledText

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

the class HCatalogForm method addTempletonFields.

private void addTempletonFields() {
    // $NON-NLS-1$
    Group templetonGroup = Form.createGroup(this, 1, Messages.getString("HCatalogForm.templetonSettings"), 110);
    templetonGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ScrolledComposite templetonComposite = new ScrolledComposite(templetonGroup, SWT.V_SCROLL | SWT.H_SCROLL);
    templetonComposite.setExpandHorizontal(true);
    templetonComposite.setExpandVertical(true);
    templetonComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite templetonGroupComposite = Form.startNewGridLayout(templetonComposite, 4);
    GridLayout disGroupCompLayout = (GridLayout) templetonGroupComposite.getLayout();
    disGroupCompLayout.marginHeight = 0;
    disGroupCompLayout.marginTop = 0;
    disGroupCompLayout.marginBottom = 0;
    disGroupCompLayout.marginLeft = 0;
    disGroupCompLayout.marginRight = 0;
    disGroupCompLayout.marginWidth = 0;
    templetonComposite.setContent(templetonGroupComposite);
    // $NON-NLS-1$
    hostText = new LabelledText(templetonGroupComposite, Messages.getString("HCatalogForm.text.host"), 1);
    // $NON-NLS-1$
    portText = new LabelledText(templetonGroupComposite, Messages.getString("HCatalogForm.text.port"), 1);
    // $NON-NLS-1$
    userNameText = new LabelledText(templetonGroupComposite, Messages.getString("HCatalogForm.text.userName"), 1);
    if (isHDI) {
        passwordText = new LabelledText(templetonGroupComposite, Messages.getString("HCatalogForm.text.password"), 1, // $NON-NLS-1$
        SWT.PASSWORD | SWT.BORDER | SWT.SINGLE);
    }
    if (enableKerberos) {
        addKerberosFields(templetonGroupComposite);
    }
}
Also used : 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) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Example 33 with LabelledText

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

the class HCatalogForm method addKerberosFields.

private void addKerberosFields(Composite parent) {
    // $NON-NLS-1$
    krbPrincipalText = new LabelledText(parent, Messages.getString("HCatalogForm.text.krbPrincipal"), 1);
    // $NON-NLS-1$
    krbRealmText = new LabelledText(parent, Messages.getString("HCatalogForm.text.krbRealm"), 1);
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText)

Example 34 with LabelledText

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

the class AbstractNoSQLSchemaForm method createHeaderField.

/**
 * DOC PLV Comment method "createHeaderField".
 *
 * @param gridData
 */
protected void createHeaderField() {
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
    gridData.widthHint = RIGHTCOMPOSITEWIDTH;
    gridData.horizontalSpan = 4;
    Composite composite1 = Form.startNewDimensionnedGridLayout(rightComposite, 4, SWT.DEFAULT, SWT.DEFAULT, false);
    ((GridData) composite1.getLayoutData()).verticalAlignment = GridData.VERTICAL_ALIGN_CENTER;
    // $NON-NLS-1$
    nameText = new LabelledText(composite1, "Name", 3);
    // $NON-NLS-1$
    commentText = new LabelledText(composite1, "Comment", 3);
    typeText = new Label(composite1, SWT.NONE);
    typeText.setLayoutData(gridData);
    GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL);
    gridData1.horizontalSpan = 4;
    container = Form.startNewGridLayout(composite1, 4, false, SWT.CENTER, SWT.TOP);
    container.setLayoutData(gridData1);
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 35 with LabelledText

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

the class HDIInfoForm method addInsightFields.

private void addInsightFields() {
    // $NON-NLS-1$
    Group hdiGroup = Form.createGroup(this, 4, Messages.getString("HadoopClusterForm.hdiSettings"), 110);
    hdiGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // $NON-NLS-1$
    hdiUsernameText = new LabelledText(hdiGroup, Messages.getString("HadoopClusterForm.text.hdi.username"), 1);
    hdiPasswordText = new LabelledText(hdiGroup, Messages.getString("HadoopClusterForm.text.hdi.password"), 1, // $NON-NLS-1$
    SWT.PASSWORD | SWT.BORDER | SWT.SINGLE);
    hdiPasswordText.getTextControl().setEchoChar('*');
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) Group(org.eclipse.swt.widgets.Group) GridData(org.eclipse.swt.layout.GridData)

Aggregations

LabelledText (org.talend.commons.ui.swt.formtools.LabelledText)46 GridData (org.eclipse.swt.layout.GridData)40 Composite (org.eclipse.swt.widgets.Composite)31 GridLayout (org.eclipse.swt.layout.GridLayout)28 Group (org.eclipse.swt.widgets.Group)26 Button (org.eclipse.swt.widgets.Button)21 LabelledCombo (org.talend.commons.ui.swt.formtools.LabelledCombo)11 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)9 UtilsButton (org.talend.commons.ui.swt.formtools.UtilsButton)7 Label (org.eclipse.swt.widgets.Label)6 FillLayout (org.eclipse.swt.layout.FillLayout)5 LabelledFileField (org.talend.commons.ui.swt.formtools.LabelledFileField)5 MetadataEmfTableEditor (org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)5 Text (org.eclipse.swt.widgets.Text)4 MetadataEmfTableEditorView (org.talend.core.ui.metadata.editor.MetadataEmfTableEditorView)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 Point (org.eclipse.swt.graphics.Point)3 NoSQLRepositoryFactory (org.talend.repository.nosql.factory.NoSQLRepositoryFactory)3 ArrayList (java.util.ArrayList)2