use of org.eclipse.swt.widgets.ScrollBar in project cogtool by cogtool.
the class StandardDrawingEditor method setScrollIncrements.
protected void setScrollIncrements() {
// Update the scroll bar when the internal content size changes.
org.eclipse.swt.graphics.Point scrollSize = scrollComposite.getSize();
org.eclipse.swt.graphics.Point editorSize = editorComposite.getSize();
if ((scrollSize.x != 0) && (scrollSize.y != 0)) {
ScrollBar horizontal = scrollComposite.getHorizontalBar();
ScrollBar vertical = scrollComposite.getVerticalBar();
// Update the scroll Step after the size info has been set
horizontal.setIncrement((editorSize.x * 10) / scrollSize.x);
vertical.setIncrement((editorSize.y * 10) / scrollSize.y);
horizontal.setPageIncrement(PrecisionUtilities.ceiling(scrollSize.x * 0.75));
vertical.setPageIncrement(PrecisionUtilities.ceiling(scrollSize.y * 0.75));
}
}
use of org.eclipse.swt.widgets.ScrollBar in project tdi-studio-se by Talend.
the class SearchZoneMapper method setPositionOfVerticalScrollBarZone.
private void setPositionOfVerticalScrollBarZone(ScrolledComposite scrollComposite, int scrollBarSelection) {
ScrollBar verticalBar = scrollComposite.getVerticalBar();
verticalBar.setSelection(scrollBarSelection);
scrollComposite.setOrigin(0, scrollBarSelection);
}
use of org.eclipse.swt.widgets.ScrollBar 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;
}
use of org.eclipse.swt.widgets.ScrollBar in project tdi-studio-se by Talend.
the class UIManager method convertPointToReferenceOrigin.
public Point convertPointToReferenceOrigin(final Composite referenceComposite, Point point, Composite child) {
Point returnedPoint = new Point(point.x, point.y);
while (child != referenceComposite) {
Rectangle bounds = child.getBounds();
child = child.getParent();
ScrollBar vScrollBar = child.getVerticalBar();
if (vScrollBar != null) {
returnedPoint.y += vScrollBar.getSelection();
}
returnedPoint.x += bounds.x;
returnedPoint.y += bounds.y;
}
return returnedPoint;
}
use of org.eclipse.swt.widgets.ScrollBar in project tdi-studio-se by Talend.
the class JSONFileStep2Form method setVisible.
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.widgets.Control#setVisible(boolean)
*/
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (super.isVisible()) {
if (this.linker != null) {
this.linker.removeAllLinks();
}
String pathStr = getConnection().getJSONFilePath();
boolean isContextMode = isContextMode();
if (isContextMode) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(), connectionItem.getConnection().getContextName());
pathStr = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, pathStr));
}
exportContextBtn.setEnabled(!isContextMode);
revertContextBtn.setEnabled(isContextMode);
// diffrent from xml , we do not save the content in item , find it in wizard temp
if (EJsonReadbyMode.XPATH.getValue().equals(this.wizard.getReadbyMode()) && (pathStr == null || !new File(pathStr).exists())) {
// initFileContent();
tempJSONXsdPath = JSONUtil.tempJSONXsdPath;
pathStr = tempJSONXsdPath;
}
// fix bug: when the JSON file is changed, the linker doesn't work.
resetStatusIfNecessary();
String tempJson = this.wizard.getTempJsonPath();
this.treePopulator.populateTree(tempJson, treeNode);
ScrollBar verticalBar = availableJSONTree.getVerticalBar();
if (verticalBar != null) {
verticalBar.setSelection(0);
}
if (this.linker == null) {
this.linker = prepareJsonLinker();
} else {
this.linker.init(treePopulator);
this.linker.createLinks();
}
checkFilePathAndManageIt();
if (isContextMode()) {
adaptFormToEditable();
}
}
}
Aggregations