use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class VersionAuthorSection method createControls.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite,
* org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
*/
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
Composite composite = getWidgetFactory().createFlatFormComposite(parent);
FormData data;
//$NON-NLS-1$
authorText = getWidgetFactory().createText(composite, "");
authorText.setEnabled(false);
data = new FormData();
data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(35, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
authorText.setLayoutData(data);
//$NON-NLS-1$
CLabel authorLabel = getWidgetFactory().createCLabel(composite, Messages.getString("VersionAuthorSection.authorLabel"));
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(authorText, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(authorText, 0, SWT.CENTER);
authorLabel.setLayoutData(data);
//$NON-NLS-1$
lockerText = getWidgetFactory().createText(composite, "");
lockerText.setEnabled(false);
data = new FormData();
data.left = new FormAttachment(37, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(70, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
lockerText.setLayoutData(data);
//$NON-NLS-1$
CLabel lockerLabel = getWidgetFactory().createCLabel(composite, Messages.getString("VersionAuthorSection.lockerLabel"));
data = new FormData();
data.left = new FormAttachment(37, 0);
data.right = new FormAttachment(lockerText, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(lockerText, 0, SWT.CENTER);
lockerLabel.setLayoutData(data);
//$NON-NLS-1$
btnDown = getWidgetFactory().createButton(composite, "m", SWT.PUSH);
data = new FormData();
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
btnDown.setLayoutData(data);
btnDown.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
versionMinorUp();
}
});
//$NON-NLS-1$
btnUp = getWidgetFactory().createButton(composite, "M", SWT.PUSH);
data = new FormData();
data.right = new FormAttachment(btnDown, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
btnUp.setLayoutData(data);
btnUp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
versionMajorUp();
}
});
//$NON-NLS-1$
versionText = getWidgetFactory().createText(composite, "");
versionText.setEnabled(false);
data = new FormData();
data.left = new FormAttachment(lockerText, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(btnUp, -2);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
versionText.setLayoutData(data);
//$NON-NLS-1$
CLabel versionLabel = getWidgetFactory().createCLabel(composite, Messages.getString("VersionAuthorSection.versionLabel"));
data = new FormData();
data.left = new FormAttachment(lockerText, ITabbedPropertyConstants.HSPACE * 3);
data.right = new FormAttachment(versionText, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(versionText, 0, SWT.CENTER);
versionLabel.setLayoutData(data);
addFocusListenerToChildren(composite);
}
use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class SQLPatternComposite method createCodeControl.
/**
* DOC bqian Comment method "createCodeControl".
*
* @param panel
* @param
*/
private void createCodeControl(Composite panel, Control reference) {
codeText = new Text(panel, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
codeText.setEditable(false);
FormData fd = new FormData();
fd.left = new FormAttachment(10, 0);
fd.right = new FormAttachment(90, 0);
fd.top = new FormAttachment(reference, 2);
fd.bottom = new FormAttachment(95, 0);
codeText.setLayoutData(fd);
codeText.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent e) {
if (tableViewer.getTable().getSelection().length == 0) {
return;
}
TableItem item = tableViewer.getTable().getSelection()[0];
if (item == null || item.getText() == null) {
return;
}
String sqlpatternName = item.getText();
SQLPatternItem patternItem = SQLPatternUtils.getSQLPatternItem(SQLPatternComposite.this.element, sqlpatternName);
if (patternItem.isSystem()) {
boolean answer = //$NON-NLS-1$
MessageDialog.openQuestion(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("SQLPatternComposite.TOS"), //$NON-NLS-1$
Messages.getString("SQLPatternComposite.forbidModification"));
if (!answer) {
return;
}
IRepositoryService repositoryService = (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
IElementParameter parameter = element.getElementParameter(EParameterName.SQLPATTERN_DB_NAME.getName());
String dbName = (String) parameter.getValue();
//$NON-NLS-1$
String path = dbName + "/" + RepositoryConstants.USER_DEFINED;
repositoryService.createSqlpattern(path, true);
} else if (sqlPatternAndProject.get(patternItem) != null) {
MessageDialog.openInformation(getShell(), "Information", "Forbid modification on sql template from reference project");
} else {
boolean answer = //$NON-NLS-1$
MessageDialog.openQuestion(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("SQLPatternComposite.TOS"), //$NON-NLS-1$
Messages.getString("SQLPatternComposite.modifySQLPattern"));
if (!answer) {
return;
}
IRepositoryService repositoryService = (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
repositoryService.openSQLPatternEditor(patternItem, false);
}
}
@Override
public void mouseDown(MouseEvent e) {
// do nothing
}
@Override
public void mouseDoubleClick(MouseEvent e) {
mouseUp(e);
}
});
}
use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class HeaderComposite method createComponents.
private void createComponents() {
GridData headerCompositeGridData = new GridData(GridData.FILL_HORIZONTAL);
this.setLayoutData(headerCompositeGridData);
FormLayout formLayout = new FormLayout();
this.setLayout(formLayout);
this.statusLabel = new Label(this, SWT.NONE);
this.iconLabel = new Label(this, SWT.NONE);
FormData iconFormData = new FormData();
Point minSize = statusLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
iconFormData.width = Math.max(15, minSize.x);
iconFormData.left = new FormAttachment(0, 5);
iconLabel.setLayoutData(iconFormData);
iconLabel.setImage(null);
FormData labelFormData = new FormData();
Point iconminSize = statusLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
labelFormData.width = Math.max(1000, iconminSize.x);
labelFormData.left = new FormAttachment(iconLabel, 5);
statusLabel.setLayoutData(labelFormData);
//$NON-NLS-1$
statusLabel.setText("");
}
use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class InsertionIndicator method createComponents.
/**
* DOC amaumont Comment method "createComponents".
*/
private void createComponents() {
leftArrowDraggingIndicator = new Composite(tablesZoneViewParent, SWT.NONE | SWT.NO_BACKGROUND);
leftArrowDraggingIndicator.setVisible(false);
leftArrowDraggingIndicator.setBackgroundMode(SWT.INHERIT_DEFAULT);
FormData formDataLeftArrow = new FormData();
formDataLeftArrow.width = 12;
formDataLeftArrow.height = HEIGHT_INDICATOR;
formDataLeftArrow.left = new FormAttachment(0, 0);
formDataLeftArrow.left = new FormAttachment(0, -formDataLeftArrow.width + 2);
formDataLeftArrow.top = new FormAttachment(0, 0);
leftArrowDraggingIndicator.setLayoutData(formDataLeftArrow);
rightArrowDraggingIndicator = new Composite(tablesZoneViewParent, SWT.NONE | SWT.NO_BACKGROUND);
rightArrowDraggingIndicator.setVisible(false);
rightArrowDraggingIndicator.setBackgroundMode(SWT.INHERIT_DEFAULT);
FormData formDataRightArrow = new FormData();
formDataRightArrow.width = 13;
formDataRightArrow.height = HEIGHT_INDICATOR;
// this property is recalculated at each top changement
formDataRightArrow.left = new FormAttachment(0, 0);
formDataRightArrow.top = new FormAttachment(0, 0);
rightArrowDraggingIndicator.setLayoutData(formDataRightArrow);
addListeners();
}
use of org.eclipse.swt.layout.FormData in project tdi-studio-se by Talend.
the class InsertionIndicator method updatePosition.
/**
* Update position of the indicator at top of <code>itemIndexTarget</code> position of the
* <code>draggableTable</code>.
*
* @param currentTable
* @param itemIndexTarget
*/
public void updatePosition(Table currentTable, int itemIndexTarget) {
// System.out.println(itemIndexTarget);
this.draggableTable = currentTable;
removeTablePaintListener();
if (tablePaintListener == null) {
tablePaintListener = new Listener() {
public void handleEvent(Event event) {
drawIndicatorLineInTable(event);
}
};
}
FormLayout formLayout = tablesZoneViewParent.getLayout();
UIManager uiManager = mapperManager.getUiManager();
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
Display display = tablesZoneViewOutputs.getDisplay();
Point tablePositionRefZone = display.map(currentTable, tablesZoneViewParent, new Point(0, 0));
FormData formDataLeftArrow = (FormData) leftArrowDraggingIndicator.getLayoutData();
FormData formDataRightArrow = (FormData) rightArrowDraggingIndicator.getLayoutData();
ScrollBar verticalBar = currentTable.getVerticalBar();
// System.out.println("verticalBar.getSelection()="+verticalBar.getSelection() + "
// currentTable.getItemHeight()="+currentTable.getItemHeight());
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentTable);
int indicYPositionRefZone = 0;
if (WindowSystem.isGTK()) {
int offsetVerticalBar = -verticalBar.getSelection();
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * (currentTable.getItemHeight() + 2) + offsetVerticalBar;
}
// System.out.println("indicYPositionRefTable="+indicYPositionRefTable);
indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2;
indicYPositionRefZone -= currentTable.getItemHeight() + 1;
// System.out.println("indicYPositionRefZone="+indicYPositionRefZone);
} else {
int offsetVerticalBar = -verticalBar.getSelection() * currentTable.getItemHeight();
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * currentTable.getItemHeight() - 1 + offsetVerticalBar;
}
Point point = currentTable.getDisplay().map(currentTable, tablesZoneViewParent, new Point(0, indicYPositionRefTable));
indicYPositionRefZone = point.y + 5;
}
Rectangle boundsTableView = dataMapTableView.getBounds();
int testValue = boundsTableView.y + boundsTableView.height - formLayout.marginTop - HEIGHT_INDICATOR / 2 - 5;
if (indicYPositionRefZone > testValue) {
indicYPositionRefZone = testValue;
}
currentTable.addListener(SWT.Paint, tablePaintListener);
if (lastIndicYPositionRefZone != indicYPositionRefZone) {
formDataLeftArrow.top.offset = indicYPositionRefZone;
formDataRightArrow.top.offset = indicYPositionRefZone;
formDataRightArrow.left.offset = currentTable.getSize().x + 2;
currentTable.redraw();
tablesZoneViewParent.layout();
}
lastIndicYPositionRefZone = indicYPositionRefZone;
}
Aggregations