use of org.eclipse.swt.widgets.ScrollBar in project otertool by wuntee.
the class CTabItemWithHexViewer method addListeners.
private void addListeners(final StyledText txt) {
txt.addMouseWheelListener(new MouseWheelListener() {
public void mouseScrolled(MouseEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
txt.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
public void widgetSelected(SelectionEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
txt.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
txt.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
txt.addCaretListener(new CaretListener() {
public void caretMoved(CaretEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
txt.addDragDetectListener(new DragDetectListener() {
public void dragDetected(DragDetectEvent arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
ScrollBar vbar = txt.getVerticalBar();
if (vbar != null) {
vbar.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
binContent.setTopIndex(txt.getTopIndex());
hexContent.setTopIndex(txt.getTopIndex());
counter.setTopIndex(txt.getTopIndex());
}
});
}
}
use of org.eclipse.swt.widgets.ScrollBar in project tdi-studio-se by Talend.
the class MouseScrolledListener method mouseScrolled.
public void mouseScrolled(MouseEvent e) {
if (scrolledComposite != null && !scrolledComposite.isDisposed()) {
Control content = scrolledComposite.getContent();
if (content != null) {
Point location = content.getLocation();
ScrollBar vBar = scrolledComposite.getVerticalBar();
if (e.count > 0) {
vBar.setSelection(vBar.getSelection() - INCREMENT);
} else {
vBar.setSelection(vBar.getSelection() + INCREMENT);
}
int vSelection = vBar.getSelection();
content.setLocation(location.x, -vSelection);
uiManager.refreshBackground(true, false);
}
}
}
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();
int offsetVerticalBar = -verticalBar.getSelection() * currentTable.getItemHeight();
int indicYPositionRefZone = 0;
if (WindowSystem.isGTK()) {
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * (currentTable.getItemHeight() + 2) + offsetVerticalBar;
}
indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2;
indicYPositionRefZone -= currentTable.getItemHeight() + 1;
} else {
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * currentTable.getItemHeight() - 1 + offsetVerticalBar;
}
indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2 + 4;
}
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentTable);
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 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 SearchZoneMapper method setPositionOfVerticalScrollBarZone.
private void setPositionOfVerticalScrollBarZone(ScrolledComposite scrollComposite, int scrollBarSelection) {
ScrollBar verticalBar = scrollComposite.getVerticalBar();
verticalBar.setSelection(scrollBarSelection);
scrollComposite.setOrigin(0, scrollBarSelection);
}
Aggregations