Search in sources :

Example 1 with NoSQLRepositoryFactory

use of org.talend.repository.nosql.factory.NoSQLRepositoryFactory 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);
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) MongoDBReplicaFieldModel(org.talend.repository.nosql.db.model.mongodb.MongoDBReplicaFieldModel) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) Text(org.eclipse.swt.widgets.Text) NoSQLRepositoryFactory(org.talend.repository.nosql.factory.NoSQLRepositoryFactory)

Example 2 with NoSQLRepositoryFactory

use of org.talend.repository.nosql.factory.NoSQLRepositoryFactory 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);
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) NoSQLRepositoryFactory(org.talend.repository.nosql.factory.NoSQLRepositoryFactory)

Example 3 with NoSQLRepositoryFactory

use of org.talend.repository.nosql.factory.NoSQLRepositoryFactory in project tbd-studio-se by Talend.

the class Neo4jConnForm method addConnectionGroup.

private void addConnectionGroup(Composite composite) {
    // $NON-NLS-1$
    connectionGroup = Form.createGroup(composite, 4, "Connection");
    connectionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout gpLayout = new GridLayout(2, true);
    gpLayout.marginWidth = 5;
    gpLayout.marginHeight = 5;
    connectionGroup.setLayout(gpLayout);
    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);
    getConnection().getAttributes().put(INeo4jAttributes.REMOTE_SERVER, String.valueOf(true));
    authArea = new Composite(connectionGroup, SWT.NONE);
    GridData authParentGd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    authArea.setLayoutData(authParentGd);
    GridLayout authLayout = new GridLayout(4, false);
    authLayout.marginWidth = 0;
    authLayout.marginHeight = 0;
    authArea.setLayout(authLayout);
    setUsernameBtn = new Button(authArea, SWT.CHECK);
    // $NON-NLS-1$
    setUsernameBtn.setText(Messages.getString("Neo4jConnForm.setUsername.label"));
    GridData setUsernameBtnGD = new GridData();
    setUsernameBtnGD.horizontalSpan = 4;
    setUsernameBtn.setLayoutData(setUsernameBtnGD);
    // $NON-NLS-1$
    userText = new LabelledText(authArea, Messages.getString("CassandraConnForm.username"), 1);
    pwdText = new LabelledText(authArea, Messages.getString("CassandraConnForm.password"), 1, // $NON-NLS-1$
    SWT.PASSWORD | SWT.BORDER | SWT.SINGLE);
    pwdText.getTextControl().setEchoChar('*');
    dbComposite = new Composite(connectionGroup, SWT.NONE);
    GridData dbCompGD = new GridData(GridData.FILL_BOTH);
    dbCompGD.horizontalSpan = 2;
    dbComposite.setLayoutData(dbCompGD);
    dbLayout = new StackLayout();
    dbComposite.setLayout(dbLayout);
    localDBComposite = new Composite(dbComposite, SWT.NONE);
    localDBComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout localDBCompLayout = new GridLayout(4, false);
    localDBCompLayout.marginWidth = 0;
    localDBCompLayout.marginHeight = 0;
    localDBComposite.setLayout(localDBCompLayout);
    // $NON-NLS-1$
    dbPathTxt = new LabelledText(localDBComposite, Messages.getString("Neo4jConnForm.dbPath.label"), 2);
    dbPathTxt.getTextControl().setEditable(false);
    browseDbPathBtn = new Button(localDBComposite, SWT.NONE);
    // $NON-NLS-1$
    browseDbPathBtn.setText("...");
    // $NON-NLS-1$
    absPathTxt = new LabelledText(localDBComposite, Messages.getString("Neo4jConnForm.absPath.label"), 2);
    absPathTxt.getTextControl().setEditable(false);
    absPathTxt.setHideWidgets(true);
    remoteDBComposite = new Composite(dbComposite, SWT.NONE);
    remoteDBComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout remoteDBCompLayout = new GridLayout(4, false);
    remoteDBCompLayout.marginWidth = 0;
    remoteDBCompLayout.marginHeight = 0;
    remoteDBComposite.setLayout(remoteDBCompLayout);
    // $NON-NLS-1$
    serverURLTxt = new LabelledText(remoteDBComposite, Messages.getString("Neo4jConnForm.serverURL.label"));
}
Also used : LabelledCombo(org.talend.commons.ui.swt.formtools.LabelledCombo) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) StackLayout(org.eclipse.swt.custom.StackLayout) NoSQLRepositoryFactory(org.talend.repository.nosql.factory.NoSQLRepositoryFactory)

Aggregations

GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 LabelledCombo (org.talend.commons.ui.swt.formtools.LabelledCombo)3 LabelledText (org.talend.commons.ui.swt.formtools.LabelledText)3 NoSQLRepositoryFactory (org.talend.repository.nosql.factory.NoSQLRepositoryFactory)3 Button (org.eclipse.swt.widgets.Button)2 StackLayout (org.eclipse.swt.custom.StackLayout)1 Text (org.eclipse.swt.widgets.Text)1 MongoDBReplicaFieldModel (org.talend.repository.nosql.db.model.mongodb.MongoDBReplicaFieldModel)1