Search in sources :

Example 1 with JSONShadowProcessPreview

use of org.talend.repository.json.ui.preview.JSONShadowProcessPreview in project tdi-studio-se by Talend.

the class JSONFileStep2Form method addGroupFileViewer.

/**
     * add Field to Group File Viewer.
     * 
     * @param parent
     * @param form
     * @param width
     * @param height
     */
private void addGroupFileViewer(final Composite parent, final int width, int height) {
    // composite JSON File Preview
    // Group previewGroup = Form.createGroup(parent, 1, Messages.getString("FileStep2.groupPreview"), height);
    // //$NON-NLS-1$
    // Composite compositeJSONFilePreviewButton = Form.startNewDimensionnedGridLayout(previewGroup, 4, width,
    // HEIGHT_BUTTON_PIXEL);
    // height = height - HEIGHT_BUTTON_PIXEL - 15;
    tabFolder = new CTabFolder(parent, SWT.BORDER);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    previewTabItem = new CTabItem(tabFolder, SWT.BORDER);
    //$NON-NLS-1$
    previewTabItem.setText("Preview");
    outputTabItem = new CTabItem(tabFolder, SWT.BORDER);
    outputTabItem.setText("Output");
    fileTabItem = new CTabItem(tabFolder, SWT.BORDER);
    fileTabItem.setText("File Viewer");
    Composite previewComposite = Form.startNewGridLayout(tabFolder, 1);
    outputComposite = Form.startNewGridLayout(tabFolder, 1);
    Composite compositeFileViewer = Form.startNewGridLayout(tabFolder, 1);
    // previewGroup.setLayout(new GridLayout());
    Composite preivewButtonPart = new Composite(previewComposite, SWT.NONE);
    preivewButtonPart.setLayout(new GridLayout(3, false));
    preivewButtonPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Preview Button
    previewButton = new Button(preivewButtonPart, SWT.NONE);
    //$NON-NLS-1$
    previewButton.setText("Refresh Preview");
    previewButton.setSize(WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
    XmlArray.setLimitToDefault();
    previewInformationLabel = new Label(previewComposite, SWT.NONE);
    previewInformationLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
    // JSON File Preview
    jsonFilePreview = new JSONShadowProcessPreview(previewComposite, null, width, height - 10);
    jsonFilePreview.newTablePreview();
    // File View
    fileJSONText = new Text(compositeFileViewer, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.minimumWidth = width;
    gridData.minimumHeight = HEIGHT_BUTTON_PIXEL;
    fileJSONText.setLayoutData(gridData);
    fileJSONText.setToolTipText("When Filepath is specified, you can read here the" + " " + TreePopulator.getMaximumRowsToPreview() + " " + "first rows of the file.");
    fileJSONText.setEditable(false);
    fileJSONText.setText("Filepath must be specified to show the Data file");
    previewTabItem.setControl(previewComposite);
    outputTabItem.setControl(outputComposite);
    fileTabItem.setControl(compositeFileViewer);
    tabFolder.setSelection(previewTabItem);
    tabFolder.pack();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) Button(org.eclipse.swt.widgets.Button) UtilsButton(org.talend.commons.ui.swt.formtools.UtilsButton) JSONShadowProcessPreview(org.talend.repository.json.ui.preview.JSONShadowProcessPreview) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

CTabFolder (org.eclipse.swt.custom.CTabFolder)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 StyledText (org.eclipse.swt.custom.StyledText)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 CommandStackForComposite (org.talend.commons.ui.command.CommandStackForComposite)1 UtilsButton (org.talend.commons.ui.swt.formtools.UtilsButton)1 JSONShadowProcessPreview (org.talend.repository.json.ui.preview.JSONShadowProcessPreview)1