use of org.eclipse.swt.widgets.TableItem in project cubrid-manager by CUBRID.
the class SqlmapCellModifier method modify.
@SuppressWarnings("unchecked")
@Override
public void modify(Object element, String property, Object value) {
if (!(element instanceof TableItem)) {
return;
}
TableItem tableItem = (TableItem) element;
Map<String, String> data = (Map<String, String>) tableItem.getData();
parentView.changeUseCondition(data.get("1"), (Boolean) value);
parentView.refreshView();
}
use of org.eclipse.swt.widgets.TableItem in project cubrid-manager by CUBRID.
the class SelectedLoactionComparator method getSelectedLocation.
/**
* Get selected table item's point
*
* @param table
* @param x
* @param y
* @return
*/
private Point getSelectedLocation(Table table, int x, int y) {
Point pt = new Point(x, y);
TableItem item = table.getItem(pt);
/*While the Table style is not full selection, the performance is low*/
if (item == null) {
int columnCount = table.getColumnCount();
for (TableItem temp : table.getItems()) {
for (int i = 0; i < columnCount; i++) {
if (temp.getBounds(i).contains(pt)) {
item = temp;
break;
}
}
}
}
if (item == null) {
return null;
}
int columnCount = table.getColumnCount();
for (int col = 0; col < columnCount; col++) {
Rectangle rect = item.getBounds(col);
if (rect.contains(pt)) {
int row = table.indexOf(item);
return new Point(col, row);
}
}
return null;
}
use of org.eclipse.swt.widgets.TableItem in project cubrid-manager by CUBRID.
the class SelectedLoactionComparator method drawSelectedItem.
/**
* Draw selected item by location
*
* @param location
*/
private void drawSelectedItem(Point location, boolean isNotify) {
int colLen = table.getColumnCount();
TableItem item = table.getItem(location.y);
for (int x = 0; x < colLen; x++) {
if (x == location.x || location.x == 0) {
item.setBackground(x, selectedCellBG);
} else if (!selectedList.contains(new Point(x, location.y))) {
item.setBackground(x, unSelectedCellBG);
}
}
table.deselectAll();
if (isNotify) {
fireSelectionChanged();
}
}
use of org.eclipse.swt.widgets.TableItem in project cubrid-manager by CUBRID.
the class SelectedLoactionComparator method setSelection.
public void setSelection(TableItem item, int column) {
selectedList.clear();
int rowIndex = -1;
if (item != null && table.getColumnCount() > column) {
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i++) {
TableItem tempItem = items[i];
if (tempItem.equals(item)) {
rowIndex = i;
break;
}
}
if (rowIndex >= 0) {
tableCursor.setSelection(rowIndex, column);
addSelectPoint(new Point(column, rowIndex), true);
drawSelectedItems(true);
}
}
}
use of org.eclipse.swt.widgets.TableItem in project cubrid-manager by CUBRID.
the class BrokerParameterDialog method performOk.
/**
* Executes tasks
*/
private void performOk() {
TableItem[] items = paraTable.getItems();
for (TableItem item : items) {
String key = item.getText(0).trim();
if (key.length() != 0) {
if (key.equals(ConfConstants.LONG_QUERY_TIME) || key.equals(ConfConstants.LONG_TRANSACTION_TIME)) {
String newVal = item.getText(2).trim();
if (isQueryOrTransTimeUseMs) {
double dVal = Double.parseDouble(newVal) / 1000;
newVal = Double.toString(dVal);
}
brokerMap.put(key, newVal);
} else {
brokerMap.put(key, item.getText(2).trim());
}
}
}
brokerMap.put("0", nameTxt.getText().trim());
brokerMap.put("1", brokerMap.get(ConfConstants.BROKER_PORT));
String brokerName = nameTxt.getText().trim();
boolean state = refreshBtn.getSelection();
String interval = intervalTxt.getText().trim();
if (null == brokerIntervalSetting) {
brokerIntervalSetting = new BrokerIntervalSetting();
brokerIntervalSetting.setBrokerName(brokerName);
}
brokerIntervalSetting.setInterval(interval);
brokerIntervalSetting.setOn(state);
}
Aggregations