use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class ContextComposite method createControl.
private void createControl() {
Composite exportComposite = Form.startNewGridLayout(this, 2, true, SWT.CENTER, SWT.CENTER);
GC gc = new GC(exportComposite);
//$NON-NLS-1$
String displayStr = Messages.getString("ContextComposite.exportAsContext");
Point buttonSize = gc.stringExtent(displayStr);
exportContextBtn = new UtilsButton(exportComposite, displayStr, buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
exportContextBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
exportAsContext();
}
});
//$NON-NLS-1$
displayStr = Messages.getString("ContextComposite.revertContext");
buttonSize = gc.stringExtent(displayStr);
revertContextBtn = new UtilsButton(exportComposite, displayStr, buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
gc.dispose();
revertContextBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
revertContext();
}
});
RowLayout layout = (RowLayout) exportComposite.getLayout();
layout.spacing = 20;
exportComposite.setLayout(layout);
refreshContextBtn();
}
use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class FindDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(3, false);
container.setLayout(layout);
Label label = new Label(container, SWT.CENTER);
final Text text = new Text(container, SWT.BORDER);
final Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
group.setText("Direction");
group.setLayout(new RowLayout(SWT.VERTICAL));
final Button forwardButton = new Button(group, SWT.RADIO);
forwardButton.setText("Forward");
forwardButton.setSelection(true);
final Button backwardButton = new Button(group, SWT.RADIO);
backwardButton.setText("Backward");
final Label tempLabel = new Label(container, SWT.NONE);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
selectionLoaction = 0;
tempLabel.setText("");
locationRecord.clear();
firstSearch = true;
}
});
forwardButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
tempLabel.setText("");
}
});
backwardButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
tempLabel.setText("");
}
});
Button findButton = new Button(container, SWT.NONE);
findButton.setText("Find");
findButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (consoleText.getText().length() > 0) {
this.searchString(text.getText());
} else
tempLabel.setText("String not found");
}
private void searchString(String parameter) {
if (!parameter.equals("")) {
if (firstSearch == true) {
findAll(parameter);
firstSearch = false;
}
selectionLoaction = consoleText.getSelection().x;
boolean selected = false;
if (backwardButton.getSelection() == true) {
if (locationRecord.size() > 0) {
for (int i = locationRecord.size() - 1; i >= 0; i--) {
if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() < selectionLoaction) {
selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
selected = true;
break;
}
selected = false;
}
if (selected == false)
tempLabel.setText("String not found");
} else
tempLabel.setText("String not found");
} else {
if (locationRecord.size() > 0) {
for (int i = 0; i < locationRecord.size(); i++) {
if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() > selectionLoaction) {
selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
selected = true;
break;
}
selected = false;
}
if (selected == false)
tempLabel.setText("String not found");
} else
tempLabel.setText("String not found");
}
}
}
private void findAll(String parameter) {
if (!parameter.equals("")) {
int location = -1;
do {
location = consoleText.getText().substring(selectionLoaction).indexOf(parameter);
if (location > -1) {
selectionLoaction = selectionLoaction + location + parameter.length();
locationRecord.add(selectionLoaction);
} else
break;
} while ((selectionLoaction + parameter.length()) <= consoleText.getText().length());
}
}
});
GridData data = new GridData(GridData.CENTER);
data.horizontalSpan = 1;
label.setText("Find: ");
label.setLayoutData(data);
GridData data1 = new GridData(GridData.CENTER);
data1.horizontalSpan = 2;
data1.widthHint = 180;
data1.grabExcessVerticalSpace = true;
text.setLayoutData(data1);
GridData data2 = new GridData(GridData.CENTER);
data2.horizontalSpan = 3;
data2.widthHint = 215;
data2.grabExcessVerticalSpace = true;
group.setLayoutData(data2);
GridData data3 = new GridData(GridData.CENTER);
data3.horizontalSpan = 2;
data3.widthHint = 150;
tempLabel.setLayoutData(data3);
GridData data4 = new GridData(GridData.CENTER);
data4.horizontalSpan = 1;
data4.widthHint = 65;
findButton.setLayoutData(data4);
return container;
}
use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class MergeOrderDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite tableComposite = new Composite(composite, SWT.None);
tableComposite.setLayout(new GridLayout());
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = WIDTH;
gridData.minimumWidth = WIDTH;
gridData.heightHint = HEIGHT;
gridData.minimumHeight = HEIGHT;
tableComposite.setLayoutData(gridData);
final TableViewerCreator tableViewerCreator = new TableViewerCreator(tableComposite);
tableViewerCreator.setBorderVisible(true);
tableViewerCreator.setCheckboxInFirstColumn(false);
tableViewerCreator.setColumnsResizableByDefault(true);
tableViewerCreator.setColumnsSortableByDefault(true);
tableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
Table table = tableViewerCreator.createTable();
table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("MergeOrderDialog.Order"));
column.setModifiable(true);
column.setWidth(50);
//$NON-NLS-1$
column.setToolTipHeader(Messages.getString("MergeOrderDialog.CurrentOrderConnection"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Connection, String>() {
public String get(Connection bean) {
return String.valueOf(connectionList.indexOf(bean) + 1);
}
public void set(Connection bean, String value) {
// bean.setName(value);
}
});
column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("MergeOrderDialog.ConnectionName"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Connection, String>() {
public String get(Connection bean) {
return getDisplayStr(bean);
}
public void set(Connection bean, String value) {
// bean.setName(value);
}
});
column.setModifiable(false);
column.setWidth(200);
tableViewerCreator.init(connectionList);
Composite buttonComposite = new Composite(composite, SWT.None);
buttonComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
Button moveUp = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveUp.setToolTipText(Messages.getString("MergeOrderDialog.MoveUp"));
moveUp.setImage(ImageProvider.getImage(EImage.UP_ICON));
moveUp.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
IStructuredSelection selection = (IStructuredSelection) tableViewerCreator.getTableViewer().getSelection();
Connection connection = (Connection) selection.getFirstElement();
int connId = connectionList.indexOf(connection);
if (connId > 0) {
Collections.swap(connectionList, connId - 1, connId);
tableViewerCreator.getTableViewer().refresh();
}
}
});
Button moveDown = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveDown.setToolTipText(Messages.getString("MergeOrderDialog.MoveDown"));
moveDown.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
if (getMergeNode() != null && getMergeNode().isReadOnly()) {
moveUp.setEnabled(false);
moveDown.setEnabled(false);
}
final int nbConn = getConnectionQty();
moveDown.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
IStructuredSelection selection = (IStructuredSelection) tableViewerCreator.getTableViewer().getSelection();
if (selection.size() > 0) {
Connection connection = (Connection) selection.getFirstElement();
int connId = connectionList.indexOf(connection);
if (connId < (nbConn - 1)) {
Collections.swap(connectionList, connId + 1, connId);
tableViewerCreator.getTableViewer().refresh();
}
}
}
});
return composite;
}
use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class TabFolderEditors method createMetadataEditorTab.
/**
* DOC amaumont Comment method "createMetadataEditor".
*/
private void createMetadataEditorTab() {
CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.schemaEditor"));
SashForm inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
item.setControl(inOutMetaEditorContainer);
CommandStack commandStack = mapperManager.getCommandStack();
inputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
inputMetaEditor.setCurrentDbms(dbmsId);
inputMetaEditor.setShowDbTypeColumn(true, false, true);
inputMetaEditor.setShowDbColumnName(true, false);
inputMetaEditor.setShowPatternColumn(false);
inputMetaEditor.setShowTalendTypeColumn(false);
inputMetaEditor.initGraphicComponents();
inputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
outputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
outputMetaEditor.setCurrentDbms(dbmsId);
outputMetaEditor.setShowDbTypeColumn(true, false, true);
outputMetaEditor.setShowDbColumnName(true, false);
outputMetaEditor.setShowTalendTypeColumn(false);
outputMetaEditor.setShowPatternColumn(false);
outputMetaEditor.initGraphicComponents();
outputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
}
use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class TabFolderEditors method createComponents.
/**
* qzhang Comment method "createComponents".
*/
private void createComponents() {
CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.FunParamTab.TitleText"));
inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
item.setControl(inOutMetaEditorContainer);
createTableView();
item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.PreviewTab.TitleText"));
Composite composite = new Composite(tabFolderEditors, SWT.BORDER);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
createPreview(composite, 700, 210);
item.setControl(composite);
tabFolderEditors.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
lastSelectedTab = tabFolderEditors.getSelectionIndex();
}
});
tabFolderEditors.setSelection(0);
}
Aggregations