use of org.eclipse.swt.layout.RowLayout in project yyl_example by Relucent.
the class MyRowLayout method main.
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
RowLayout rowLayout = new RowLayout();
rowLayout.marginTop = 10;
rowLayout.marginLeft = 5;
rowLayout.spacing = 2;
// true or false
rowLayout.wrap = true;
rowLayout.type = SWT.HORIZONTAL;
//# rowLayout.type = SWT.VERTICAL;
rowLayout.pack = true;
rowLayout.justify = false;
new Button(shell, SWT.NONE).setText("b1");
new Button(shell, SWT.NONE).setText("button2");
Button b = new Button(shell, SWT.NONE);
b.setText("btn3");
RowData rowData = new RowData(50, 50);
b.setLayoutData(rowData);
shell.setLayout(rowLayout);
shell.setText("RowLayout");
shell.setSize(200, 200);
shell.layout();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
use of org.eclipse.swt.layout.RowLayout in project yyl_example by Relucent.
the class MyStackLayout method open.
void open() {
final Display display = Display.getDefault();
final Shell shell = new Shell();
final Composite comp1 = new Composite(shell, SWT.NONE);
final StackLayout stackLayout = new StackLayout();
final Text txt1 = new Text(comp1, SWT.BORDER);
txt1.setText("T1");
final Text txt2 = new Text(comp1, SWT.BORDER);
txt2.setText("T2");
Composite comp2 = new Composite(shell, SWT.NONE);
comp2.setLayout(new RowLayout());
Button btn1 = new Button(comp2, SWT.NONE);
Button btn2 = new Button(comp2, SWT.NONE);
btn1.setText("T1");
btn2.setText("T2");
comp1.setLayout(stackLayout);
stackLayout.topControl = txt1;
btn1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl = txt1;
comp1.layout();
}
});
btn2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl = txt2;
comp1.layout();
}
});
shell.setLayout(new FillLayout());
shell.setText("StackLayout");
shell.setSize(200, 200);
// shell.setMaximized(true);
shell.layout();
shell.open();
while (!shell.isDisposed()) if (!display.readAndDispatch())
display.sleep();
}
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