Search in sources :

Example 21 with LabelledText

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

the class HDIInfoForm method addAzureFields.

private void addAzureFields() {
    // $NON-NLS-1$
    Group azureGroup = Form.createGroup(this, 1, Messages.getString("HadoopClusterForm.azureSettings"), 110);
    azureGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    storagePartComposite = new Composite(azureGroup, SWT.NULL);
    GridLayout storagePartLayout = new GridLayout(4, false);
    storagePartLayout.marginWidth = 0;
    storagePartLayout.marginHeight = 0;
    storagePartComposite.setLayout(storagePartLayout);
    storagePartComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    storageCombo = new // $NON-NLS-1$
    LabelledCombo(// $NON-NLS-1$
    storagePartComposite, // $NON-NLS-1$
    Messages.getString("HadoopClusterForm.text.azure.storage"), // $NON-NLS-1$
    Messages.getString("HadoopClusterForm.text.azure.storage.tip"), EHdinsightStorage.getAllHdinsightStorageDisplayNames().toArray(new String[0]), 1, true);
    storageUseTLSBtn = new Button(storagePartComposite, SWT.CHECK);
    // $NON-NLS-1$
    storageUseTLSBtn.setText(Messages.getString("HadoopClusterForm.text.azure.storageUseTLS"));
    storageUseTLSBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
    Composite azurePartComposite = new Composite(azureGroup, SWT.NULL);
    GridLayout azurePartLayout = new GridLayout(4, false);
    azurePartLayout.marginWidth = 0;
    azurePartLayout.marginHeight = 0;
    azurePartComposite.setLayout(azurePartLayout);
    azurePartComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // $NON-NLS-1$
    azureHostnameText = new LabelledText(azurePartComposite, Messages.getString("HadoopClusterForm.text.azure.hostname"), 1);
    azureContainerText = new // $NON-NLS-1$
    LabelledText(// $NON-NLS-1$
    azurePartComposite, // $NON-NLS-1$
    Messages.getString("HadoopClusterForm.text.azure.container"), 1);
    // $NON-NLS-1$
    azureUsernameText = new LabelledText(azurePartComposite, Messages.getString("HadoopClusterForm.text.azure.username"), 1);
    azurePasswordText = new LabelledText(azurePartComposite, Messages.getString("HadoopClusterForm.text.azure.password"), 1, // $NON-NLS-1$
    SWT.PASSWORD | SWT.BORDER | SWT.SINGLE);
    azurePasswordText.getTextControl().setEchoChar('*');
    azureDeployBlobText = new // $NON-NLS-1$
    LabelledText(// $NON-NLS-1$
    azurePartComposite, // $NON-NLS-1$
    Messages.getString("HadoopClusterForm.text.azure.deployBlob"), 1);
}
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) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 22 with LabelledText

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

the class AbstractNoSQLRetrieveSchemaForm method addSchemaFields.

protected void addSchemaFields(Composite parent) {
    // $NON-NLS-1$
    Group schemaGroup = Form.createGroup(parent, 1, Messages.getString("AbstractNoSQLRetrieveSchemaForm.schemaGroup"));
    Composite filterComposite = new Composite(schemaGroup, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    filterComposite.setLayout(gridLayout);
    GridData filterCompGridData = new GridData(GridData.FILL_HORIZONTAL);
    filterComposite.setLayoutData(filterCompGridData);
    // $NON-NLS-1$
    filterText = new LabelledText(filterComposite, Messages.getString("AbstractNoSQLRetrieveSchemaForm.nameFilter"), 1);
    ScrolledComposite scrolledComposite = new ScrolledComposite(schemaGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    schemaViewer = new ContainerCheckedTreeViewer(scrolledComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION) {

        @Override
        protected void doCheckStateChanged(Object element) {
            super.doCheckStateChanged(element);
            performCheckStateChanged((INoSQLSchemaNode) element);
        }
    };
    schemaViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    schemaViewer.setUseHashlookup(true);
    schemaViewer.addFilter(new SchemaViewerFilter());
    schemaTree = schemaViewer.getTree();
    schemaTree.setHeaderVisible(true);
    schemaTree.setLinesVisible(true);
    scrolledComposite.setContent(schemaTree);
    scrolledComposite.setMinSize(schemaTree.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    TreeColumnLayout tcLayout = new TreeColumnLayout();
    scrolledComposite.setLayout(tcLayout);
    TreeColumn column1 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column1.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.name"));
    column1.setWidth(300);
    column1.setResizable(true);
    tcLayout.setColumnData(column1, new ColumnWeightData(40, 150));
    TreeColumn column2 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column2.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.type"));
    column2.setWidth(150);
    column2.setResizable(true);
    tcLayout.setColumnData(column2, new ColumnWeightData(25, 100));
    TreeColumn column3 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column3.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.colNum"));
    column3.setWidth(130);
    column3.setResizable(true);
    tcLayout.setColumnData(column3, new ColumnWeightData(20, 50));
    TreeColumn column4 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column4.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.creationStauts"));
    column4.setWidth(120);
    column4.setResizable(true);
    tcLayout.setColumnData(column4, new ColumnWeightData(15, 70));
    try {
        List<INoSQLSchemaNode> nodes = wizardPageProvider.createSchemaNodes(getConnection());
        NoSQLSelectorTreeViewerProvider viewProvider = new NoSQLSelectorTreeViewerProvider();
        schemaViewer.setContentProvider(viewProvider);
        schemaViewer.setLabelProvider(viewProvider);
        schemaViewer.setInput(nodes);
    } catch (NoSQLExtractSchemaException e) {
        ExceptionHandler.process(e);
    }
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) NoSQLSelectorTreeViewerProvider(org.talend.repository.nosql.ui.provider.NoSQLSelectorTreeViewerProvider) Group(org.eclipse.swt.widgets.Group) INoSQLSchemaNode(org.talend.repository.nosql.model.INoSQLSchemaNode) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) GridLayout(org.eclipse.swt.layout.GridLayout) TreeColumn(org.eclipse.swt.widgets.TreeColumn) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ContainerCheckedTreeViewer(org.eclipse.ui.dialogs.ContainerCheckedTreeViewer) NoSQLExtractSchemaException(org.talend.repository.nosql.exceptions.NoSQLExtractSchemaException)

Example 23 with LabelledText

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

the class HeaderComposite method createComponents.

private void createComponents() {
    this.setLayout(new GridLayout(3, false));
    GridData headerCompositeGridData = new GridData(GridData.FILL_HORIZONTAL);
    this.setLayoutData(headerCompositeGridData);
    //$NON-NLS-N$
    String[] extensions = new String[] { "*.*" };
    fileField = new LabelledFileField(this, "File path:", extensions, 1, SWT.BORDER) {

        protected void setFileFieldValue(String result) {
            if (result != null) {
                getTextControl().setText(TalendTextUtils.addQuotes(PathUtils.getPortablePath(result)));
            }
        }
    };
    fileField.setText(filePath);
    fileField.setEditable(!isRepository);
    final Group group = Form.createGroup(this, 4, "File Setting", 30);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    group.setLayoutData(gridData);
    startChar = new LabelledText(group, "Start character");
    startChar.setText(startCharValue);
    startChar.setEditable(!isRepository);
    endChar = new LabelledText(group, "End character");
    endChar.setText(endCharValue);
    endChar.setEditable(!isRepository);
    addListeners();
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) LabelledFileField(org.talend.commons.ui.swt.formtools.LabelledFileField)

Example 24 with LabelledText

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

the class JSONFileStep3Form method addFields.

@Override
protected void addFields() {
    // Header Fields
    Composite mainComposite = Form.startNewDimensionnedGridLayout(this, 2, WIDTH_GRIDDATA_PIXEL, 60);
    metadataNameText = new LabelledText(mainComposite, "Name");
    metadataCommentText = new LabelledText(mainComposite, "Comment");
    // Group MetaData
    Group groupMetaData = Form.createGroup(this, 1, "Schema", 280);
    Composite compositeMetaData = Form.startNewGridLayout(groupMetaData, 1);
    // Composite Guess
    Composite compositeGuessButton = Form.startNewDimensionnedGridLayout(compositeMetaData, 2, WIDTH_GRIDDATA_PIXEL, 40);
    informationLabel = new Label(compositeGuessButton, SWT.NONE);
    informationLabel.setText("Click Guess button to update the schema below according to your settings" + "                                                  ");
    informationLabel.setSize(500, HEIGHT_BUTTON_PIXEL);
    guessButton = new UtilsButton(compositeGuessButton, "Guess", WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
    guessButton.setToolTipText("Click to update schema preview");
    // Composite MetadataTableEditorView
    Composite compositeTable = Form.startNewDimensionnedGridLayout(compositeMetaData, 1, WIDTH_GRIDDATA_PIXEL, 200);
    compositeTable.setLayout(new FillLayout());
    metadataEditor = new MetadataEmfTableEditor("Description of the Schema");
    tableEditorView = new MetadataEmfTableEditorView(compositeTable, SWT.NONE);
    if (!isInWizard()) {
        // Bottom Button
        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(); changed by hqzhang, need not call here, has been called in setupForm()
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) MetadataEmfTableEditorView(org.talend.core.ui.metadata.editor.MetadataEmfTableEditorView) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor) Label(org.eclipse.swt.widgets.Label) UtilsButton(org.talend.commons.ui.swt.formtools.UtilsButton) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 25 with LabelledText

use of org.talend.commons.ui.swt.formtools.LabelledText 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

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