use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createReportField.
/* private void createInfoField(Composite parent) {
infoComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportLayout.marginWidth = 0;
reportLayout.marginHeight = 0;
infoComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(50, 0);
reportData.bottom = new FormAttachment(100, -5);
infoComposite.setLayoutData(reportData);
Group group = new Group(infoComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 0;
groupLayout.marginHeight = 0;
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
group.setText("Run job Informations");
infoField = new Text(group, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
infoField.setEditable(false);
infoField.setBackground(group.getBackground());
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
infoField.setLayoutData(data);
}*/
private void createReportField(Composite parent) {
reportComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(0, 0);
reportData.bottom = new FormAttachment(100, -5);
reportComposite.setLayoutData(reportData);
Group group = new Group(reportComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
//$NON-NLS-1$
group.setText("Job execution information");
reportField = new StyledText(group, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
//may be CoreUIPlugin.setCSSClass can do this globally ,check later
reportField.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(93, 0);
reportField.setLayoutData(data);
displayReportField();
//export button
Button exportButton = new Button(group, SWT.PUSH);
//$NON-NLS-1$
exportButton.setText("Export");
FormData exportData = new FormData();
exportData.left = new FormAttachment(100, -70);
exportData.right = new FormAttachment(100, 0);
exportData.bottom = new FormAttachment(100, -1);
exportButton.setLayoutData(exportData);
exportButton.setEnabled(true);
exportButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (messageManager == null || messageManager.getMessages().size() < 1) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "No log to export.");
return;
}
UnboundedFifoBuffer messages = messageManager.getMessages();
Iterator iterator = messages.iterator();
StringBuilder content = new StringBuilder();
while (iterator.hasNext()) {
ReportMessage message = (ReportMessage) iterator.next();
content.append(message.getContent());
}
if (isMonitoring) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "Waiting for job done.");
return;
}
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
//$NON-NLS-1$
dialog.setFilterPath(".");
String fileName = dialog.open();
if (fileName != null) {
FileWriter writer = null;
try {
writer = new FileWriter(fileName);
writer.write(content.toString());
} catch (IOException e1) {
e1.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class SaveChartSetAsDialog method createDeleteButton.
/**
* Creates the delete button.
*
* @param parent The parent composite
*/
private void createDeleteButton(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
deleteButton = new Button(composite, SWT.PUSH);
deleteButton.setText(Messages.deleteButtonLabel);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
deleteButton.setLayoutData(gridData);
deleteButton.setEnabled(false);
deleteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) chartSetViewer.getSelection();
String element = (String) selection.getFirstElement();
chartSets.remove(element);
chartSetViewer.setInput(chartSets.toArray(new String[chartSets.size()]));
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class JSONFileSelectWizardPage method addListeners.
private void addListeners() {
inputModeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
isInputModel = true;
((JSONFileConnection) connectionItem.getConnection()).setInputModel(true);
}
});
outputModeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
isInputModel = false;
((JSONFileConnection) connectionItem.getConnection()).setInputModel(false);
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class UseDynamicJobSelectionDialog method createSelectionButton.
/**
* DOC hcw Comment method "createSelectionButton".
*
* @param itemComposite
*/
private void createSelectionButton(Composite itemComposite) {
Composite buttonComposite = new Composite(itemComposite, SWT.NONE);
GridLayoutFactory.swtDefaults().margins(0, 25).applyTo(buttonComposite);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(buttonComposite);
Button selectAll = new Button(buttonComposite, SWT.PUSH);
// selectAll.setText(DataTransferMessages.DataTransfer_selectAll);
//$NON-NLS-1$
selectAll.setText(Messages.getString("DataTransferMessages.DataTransfer_selectAll"));
selectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.setAllChecked(true);
}
});
setButtonLayoutData(selectAll);
Button deselectAll = new Button(buttonComposite, SWT.PUSH);
// deselectAll.setText(DataTransferMessages.DataTransfer_deselectAll);
//$NON-NLS-1$
deselectAll.setText(Messages.getString("DataTransferMessages.DataTransfer_deselectAll"));
deselectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.setAllChecked(false);
}
});
setButtonLayoutData(deselectAll);
Button expandBtn = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
expandBtn.setText(Messages.getString("UseDynamicJobSelectionDialog.expandBtnText"));
expandBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.expandAll();
}
});
setButtonLayoutData(expandBtn);
Button collapseBtn = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
collapseBtn.setText(Messages.getString("UseDynamicJobSelectionDialog.collapseBtnText"));
collapseBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.collapseAll();
}
});
setButtonLayoutData(collapseBtn);
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class ComponentRefController method createControl.
@Override
public Control createControl(final Composite subComposite, final IElementParameter param, final int numInRow, final int nbInRow, final int top, final Control lastControl) {
DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, cbCtrl);
if (param.isRequired()) {
FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false);
}
if (param.isRepositoryValueUsed()) {
FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
//$NON-NLS-1$
decoration.setDescription(Messages.getString("ComboController.valueFromRepository"));
dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.BOTTOM, false);
}
Control cLayout = dField.getLayoutControl();
CCombo combo = (CCombo) dField.getControl();
FormData data;
combo.setEditable(false);
cLayout.setBackground(subComposite.getBackground());
combo.setEnabled(!param.isReadOnly());
GenericElementParameter gParam = (GenericElementParameter) param;
ComponentReferenceProperties props = (ComponentReferenceProperties) gParam.getWidget().getContent();
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (!(event.getSource() instanceof CCombo)) {
return;
}
Command cmd = createComboCommand(event, gParam, props);
executeCommand(cmd);
}
});
combo.setData(PARAMETER_NAME, param.getName());
int nbLines = param.getNbLines();
if (nbLines > 5) {
combo.setVisibleItemCount(nbLines);
}
if (elem instanceof Node) {
combo.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
}
CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, Messages.getString("ComponentRefController.connectionLabel"));
data = new FormData();
if (lastControl != null) {
data.left = new FormAttachment(lastControl, 0);
} else {
data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0);
}
data.top = new FormAttachment(0, top);
labelLabel.setLayoutData(data);
if (numInRow != 1) {
labelLabel.setAlignment(SWT.RIGHT);
}
data = new FormData();
int currentLabelWidth = STANDARD_LABEL_WIDTH;
GC gc = new GC(labelLabel);
Point labelSize = gc.stringExtent(Messages.getString("ComponentRefController.connectionLabel"));
gc.dispose();
if ((labelSize.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth) {
currentLabelWidth = labelSize.x + ITabbedPropertyConstants.HSPACE;
}
if (numInRow == 1) {
if (lastControl != null) {
data.left = new FormAttachment(lastControl, currentLabelWidth);
} else {
data.left = new FormAttachment(0, currentLabelWidth);
}
} else {
data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT);
}
data.top = new FormAttachment(0, top);
cLayout.setLayoutData(data);
// **********************
hashCurControls.put(param.getName(), combo);
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
dynamicProperty.setCurRowSize(initialSize.y + ITabbedPropertyConstants.VSPACE);
return cLayout;
}
Aggregations