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();
}
Aggregations