use of org.talend.designer.dbmap.ui.dnd.DragNDrop in project tdi-studio-se by Talend.
the class DataMapTableView method createComponents.
private void createComponents() {
final Display display = this.getDisplay();
if (WindowSystem.isGTK()) {
Color systemColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
setBackground(new Color(display, systemColor.getRed(), systemColor.getGreen(), systemColor.getBlue()));
setBackgroundMode(SWT.INHERIT_NONE);
} else {
Color listBackground = display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
this.setBackground(listBackground);
}
GridLayout mainLayout = new GridLayout();
int marginMainLayout = 0;
mainLayout.marginLeft = marginMainLayout;
mainLayout.marginRight = marginMainLayout;
mainLayout.marginTop = marginMainLayout;
mainLayout.marginBottom = marginMainLayout;
mainLayout.marginWidth = marginMainLayout;
mainLayout.marginHeight = marginMainLayout;
int spacingMainLayout = 2;
mainLayout.horizontalSpacing = spacingMainLayout;
mainLayout.verticalSpacing = spacingMainLayout;
setLayout(mainLayout);
headerComposite = new Composite(this, SWT.NONE);
GridData headerGridData = new GridData(GridData.FILL_HORIZONTAL);
headerGridData.heightHint = getHeaderHeight();
headerComposite.setLayoutData(headerGridData);
GridLayout headerLayout = new GridLayout();
int margin = 0;
headerLayout.marginLeft = 3;
headerLayout.marginRight = margin;
headerLayout.marginTop = margin;
headerLayout.marginBottom = margin;
headerLayout.marginWidth = margin;
headerLayout.marginHeight = margin;
int spacing = 2;
headerLayout.horizontalSpacing = spacing;
headerLayout.verticalSpacing = spacing;
headerComposite.setLayout(headerLayout);
nameLabel = new Label(headerComposite, SWT.NONE);
nameLabel.setFont(FontProviderMapper.getFont(FontInfo.FONT_SYSTEM_BOLD));
nameLabel.setText(getTitle());
nameLabel.setToolTipText(getTitle());
nameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL));
int rightStyle = toolbarNeedToHaveRightStyle() ? SWT.RIGHT : SWT.NONE;
toolBarActions = new ToolBar(headerComposite, SWT.FLAT | rightStyle);
toolBarActions.setFont(FontProviderMapper.getFont(FontInfo.FONT_SYSTEM));
if (addToolItems()) {
addToolItemSeparator();
}
minimizeButton = new ToolItem(toolBarActions, SWT.PUSH);
realToolbarSize.x += 45;
Point sizeToolBar = toolBarActions.computeSize(SWT.DEFAULT, SWT.DEFAULT);
GridData gridDataToolbar = new GridData();
if (toolbarNeedToHaveRightStyle() && WindowSystem.isWIN32()) {
if (realToolbarSize != null) {
gridDataToolbar.widthHint = realToolbarSize.x;
}
}
if (WindowSystem.isGTK()) {
gridDataToolbar.heightHint = 26;
} else {
// gridDataToolbar.heightHint = 30; // Win32
}
if (WindowSystem.isGTK()) {
toolBarActions.setLayoutData(gridDataToolbar);
} else {
toolBarActions.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL));
}
headerLayout.numColumns = headerComposite.getChildren().length;
centerComposite = new Composite(this, SWT.NONE);
GridData centerData = new GridData(GridData.FILL_BOTH);
centerComposite.setLayoutData(centerData);
GridLayout centerLayout = new GridLayout();
int marginCenterLayout = 0;
centerLayout.marginLeft = marginCenterLayout;
centerLayout.marginRight = marginCenterLayout;
centerLayout.marginTop = marginCenterLayout;
centerLayout.marginBottom = marginCenterLayout;
centerLayout.marginWidth = marginCenterLayout;
centerLayout.marginHeight = marginCenterLayout;
int spacingCenterLayout = 2;
centerLayout.horizontalSpacing = spacingCenterLayout;
centerLayout.verticalSpacing = spacingCenterLayout;
centerComposite.setLayout(centerLayout);
initTableFilters(centerComposite);
createTableForColumns(centerComposite);
new DragNDrop(mapperManager, tableForEntries, true, true);
Composite footerComposite = new Composite(this, SWT.NONE);
GridData footerGridData = new GridData(10, 2);
footerComposite.setLayoutData(footerGridData);
headerComposite.moveAbove(nameLabel);
if (WindowSystem.isGTK()) {
sizeToolBar = toolBarActions.computeSize(SWT.DEFAULT, SWT.DEFAULT);
gridDataToolbar.widthHint = sizeToolBar.x + 20;
headerComposite.layout();
}
}
Aggregations