public abstract class DAWindowingTableComposite extends DATableComposite {
protected Composite scrollComp;
- protected ScrollBar scrollbar;
+ protected ScrollBar vScrollbar;
+ protected ScrollBar hScrollbar;
protected long selectionStartTime = -1;
protected long selectionEndTime = -1;
@Override
protected Grid createGrid(int tableStyle) {
- scrollComp = new Composite(this, SWT.V_SCROLL);
+ scrollComp = new Composite(this, SWT.V_SCROLL | SWT.H_SCROLL);
scrollComp.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
scrollComp.setLayout(new FormLayout());
- scrollbar = scrollComp.getVerticalBar();
- scrollbar.setMaximum(0);
- scrollbar.setMinimum(0);
- scrollbar.setVisible(false);
- scrollbar.addSelectionListener(new SelectionListener() {
+ vScrollbar = scrollComp.getVerticalBar();
+ vScrollbar.setMaximum(0);
+ vScrollbar.setMinimum(0);
+ vScrollbar.setVisible(false);
+
+ vScrollbar.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
- if (previousSelectionScrollIndex != scrollbar.getSelection()) {
+ if (previousSelectionScrollIndex != vScrollbar.getSelection()) {
synchronized (me) {
updateTable();
}
}
});
+ hScrollbar = scrollComp.getHorizontalBar();
+ hScrollbar.setMaximum(0);
+ hScrollbar.setThumb(0);
+ hScrollbar.setVisible(false);
+ hScrollbar.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int currentPosition = hScrollbar.getSelection();
+ int xPosition = -currentPosition;
+ int width = totalColumnSize;
+ int height = table.getHeaderHeight()
+ + (getTableLength() * (getItemHeightSize() + 1)) + 10;
+ table.setBounds(xPosition, 0, width, height);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
return new DAGrid(scrollComp, tableStyle);
}
protected void setTableLayout() {
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
data.left = new FormAttachment(0, 0);
-
if (AnalyzerUtil.isLinux()) {
data.right = new FormAttachment(100, -2);
+ data.bottom = new FormAttachment(100, -2);
} else {
data.right = new FormAttachment(100, 0);
+ data.bottom = new FormAttachment(100, 0);
}
table.setLayoutData(data);
}
}
}
} else if (e.keyCode == SWT.ARROW_UP) {
- int nowScrollBar = scrollbar.getSelection();
+ int nowScrollBar = vScrollbar.getSelection();
int tableSelectionIndex = table.getSelectionIndex();
if (nowScrollBar > 0 && tableSelectionIndex == 0) {
- scrollbar.setSelection(nowScrollBar - 1);
+ vScrollbar.setSelection(nowScrollBar - 1);
setTableSeqNumber(0);
}
} else if (e.keyCode == SWT.ARROW_DOWN) {
- int nowScrollBar = scrollbar.getSelection();
+ int nowScrollBar = vScrollbar.getSelection();
int tableSelectionIndex = table.getSelectionIndex();
if (tableSelectionIndex >= getTableLength()) {
- scrollbar.setSelection(nowScrollBar + 1);
+ vScrollbar.setSelection(nowScrollBar + 1);
setTableSeqNumber(getTableLength());
}
} else if (e.keyCode == SWT.PAGE_UP) {
- int nowScrollBar = scrollbar.getSelection();
+ int nowScrollBar = vScrollbar.getSelection();
int pageChagneInde = getTableLength();
- scrollbar.setSelection(nowScrollBar - pageChagneInde + 1);
+ vScrollbar.setSelection(nowScrollBar - pageChagneInde + 1);
setTableSeqNumber(0);
} else if (e.keyCode == SWT.PAGE_DOWN) {
- int nowScrollBar = scrollbar.getSelection();
+ int nowScrollBar = vScrollbar.getSelection();
int pageChagneInde = getTableLength() - 1;
- scrollbar.setSelection(nowScrollBar + pageChagneInde);
+ vScrollbar.setSelection(nowScrollBar + pageChagneInde);
setTableSeqNumber(getTableLength() - 1);
}
}
/ (itemHeight + 1);
}
+ public void updateHScrollBar(int tableWidth) {
+ System.out.println("width : " + tableWidth);
+ hScrollbar.setMaximum(totalColumnSize);
+ hScrollbar.setThumb(tableWidth);
+ hScrollbar.setVisible(true);
+ }
+
@Override
public void updateTable() {
int itemCount = getItemCount();
return;
}
- scrollbar.setMinimum(0);
- scrollbar.setMaximum(itemCount);
- scrollbar.setThumb(getTableLength());
- scrollbar.setVisible(true);
+ vScrollbar.setMinimum(0);
+ vScrollbar.setMaximum(itemCount);
+ vScrollbar.setThumb(getTableLength());
+ vScrollbar.setVisible(true);
table.removeAll();
if (null != comparator) {
private List<TableInput> makeTableInputFromDB(int itemCount) {
boolean isQueryDB = false;
- int scrollSelection = scrollbar.getSelection();
+ int scrollSelection = vScrollbar.getSelection();
if (previousSelectionScrollIndex != scrollSelection) {
isQueryDB = true;
previousSelectionScrollIndex = scrollSelection;
}
private List<List<String>> getStringDataFromDB(int itemCount) {
- int scrollSelection = scrollbar.getSelection();
+ int scrollSelection = vScrollbar.getSelection();
if (scrollSelection > itemCount) { // change PID
scrollSelection = 0;
}
}
private List<LogData> getLogDataFromDB(int itemCount) {
- int scrollSelection = scrollbar.getSelection();
+ int scrollSelection = vScrollbar.getSelection();
if (scrollSelection > itemCount) { // change PID
scrollSelection = 0;
}
@Override
public void clear() {
super.clear();
- scrollbar.setMaximum(0);
- scrollbar.setMinimum(0);
- scrollbar.setVisible(false);
+ vScrollbar.setMaximum(0);
+ vScrollbar.setMinimum(0);
+ vScrollbar.setVisible(false);
+ hScrollbar.setMaximum(0);
+ hScrollbar.setThumb(0);
+ hScrollbar.setVisible(false);
selectionStartTime = -1;
selectionEndTime = -1;
- // scrollStartSelection = 0;
- // scrollEndSelection = 0;
queriedLogData = null;
queriedStringData = null;
totalItemCount = 0;
int selectionIndex = SqlManager.getInstance().getSelectionIndex(
getDBTableName(), getTimeColumnName(), selectionStartTime,
getSelectQueryCountOption());
- scrollbar.setSelection(selectionIndex - 1);
+ vScrollbar.setSelection(selectionIndex - 1);
}
public void setDataType(boolean isLogData, int timeColumnIndex) {
public int getScrollSelectionIndex(int selection) {
return 1;
}
+
public int searchString(FindProperty findProperty) {
return -1;
}