use of org.talend.commons.ui.swt.formtools.UtilsButton in project tbd-studio-se by Talend.
the class HDFSForm method addCheckFields.
private void addCheckFields() {
Composite checkGroup = new Composite(this, SWT.NONE);
GridLayout checkGridLayout = new GridLayout(1, false);
checkGroup.setLayout(checkGridLayout);
GridData checkGridData = new GridData(GridData.FILL_HORIZONTAL);
checkGridData.minimumHeight = 5;
checkGroup.setLayoutData(checkGridData);
Composite checkButtonComposite = Form.startNewGridLayout(checkGroup, 1, false, SWT.CENTER, SWT.BOTTOM);
GridLayout checkButtonLayout = (GridLayout) checkButtonComposite.getLayout();
checkButtonLayout.marginHeight = 0;
checkButtonLayout.marginTop = 0;
checkButtonLayout.marginBottom = 0;
checkButtonLayout.marginLeft = 0;
checkButtonLayout.marginRight = 0;
checkButtonLayout.marginWidth = 0;
// $NON-NLS-1$
checkConnectionBtn = new UtilsButton(checkButtonComposite, "Check", WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
checkConnectionBtn.setEnabled(false);
}
use of org.talend.commons.ui.swt.formtools.UtilsButton in project tbd-studio-se by Talend.
the class AbstractNoSQLSchemaForm method addTreeNavigator.
private void addTreeNavigator(Composite parent, int width, int height) {
// Group
// $NON-NLS-1$
Group group = Form.createGroup(parent, 1, Messages.getString("AbstractNoSQLSchemaForm.treeSchema"), height);
// ScrolledComposite
ScrolledComposite scrolledCompositeFileViewer = new ScrolledComposite(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
scrolledCompositeFileViewer.setExpandHorizontal(true);
scrolledCompositeFileViewer.setExpandVertical(true);
GridData gridData1 = new GridData(GridData.FILL_BOTH);
gridData1.widthHint = width + 12;
gridData1.heightHint = height;
gridData1.horizontalSpan = 2;
scrolledCompositeFileViewer.setLayoutData(gridData1);
tableViewerCreator = new TableViewerCreator(scrolledCompositeFileViewer);
tableViewerCreator.setHeaderVisible(false);
tableViewerCreator.setColumnsResizableByDefault(false);
tableViewerCreator.setBorderVisible(false);
tableViewerCreator.setLinesVisible(false);
tableViewerCreator.setLayoutMode(LAYOUT_MODE.NONE);
tableViewerCreator.setCheckboxInFirstColumn(false);
tableViewerCreator.setFirstColumnMasked(false);
tableNavigator = tableViewerCreator.createTable();
tableNavigator.setLayoutData(new GridData(GridData.FILL_BOTH));
TableColumn tableColumn = new TableColumn(tableNavigator, SWT.NONE);
// $NON-NLS-1$
tableColumn.setText(Messages.getString("AbstractNoSQLSchemaForm.table"));
tableColumn.setWidth(width + 120);
scrolledCompositeFileViewer.setContent(tableNavigator);
scrolledCompositeFileViewer.setSize(width + 12, height);
GC gc = new GC(group);
// $NON-NLS-1$
String displayStr = Messages.getString("AbstractNoSQLSchemaForm.addSchema");
Point buttonSize = gc.stringExtent(displayStr);
GridData girdData = new GridData(buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
girdData.horizontalAlignment = SWT.CENTER;
// Button Add metadata Table
addTableBtn = new UtilsButton(group, displayStr, girdData);
// $NON-NLS-1$
displayStr = Messages.getString("AbstractNoSQLSchemaForm.removeSchema");
buttonSize = gc.stringExtent(displayStr);
if (buttonSize.x + 12 > girdData.widthHint) {
girdData.widthHint = buttonSize.x + 12;
}
girdData = new GridData(buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
girdData.horizontalAlignment = SWT.CENTER;
removeTableBtn = new UtilsButton(group, displayStr, girdData);
gc.dispose();
}
use of org.talend.commons.ui.swt.formtools.UtilsButton in project tbd-studio-se by Talend.
the class AbstractNoSQLSchemaForm method createGuessSchemaField.
/**
* DOC PLV Comment method "createGuessSchemaPart".
*/
protected void createGuessSchemaField() {
Composite compositeGuessSchemaButton = Form.startNewGridLayout(container, 3, false, SWT.CENTER, SWT.TOP);
GC gc = new GC(compositeGuessSchemaButton);
// $NON-NLS-1$
String displayStr = "Guess Schema";
Point buttonSize = gc.stringExtent(displayStr);
buttonSize = gc.stringExtent(displayStr);
guessSchemaButton = new UtilsButton(compositeGuessSchemaButton, displayStr, buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
// $NON-NLS-1$
guessSchemaButton.setToolTipText(Messages.getString("AbstractNoSQLSchemaForm.GuessSchemaToolTip"));
gc.dispose();
}
use of org.talend.commons.ui.swt.formtools.UtilsButton 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()
}
use of org.talend.commons.ui.swt.formtools.UtilsButton 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();
}
Aggregations