本文整理汇总了Java中org.eclipse.swt.widgets.Table.getColumnCount方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getColumnCount方法的具体用法?Java Table.getColumnCount怎么用?Java Table.getColumnCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Table
的用法示例。
在下文中一共展示了Table.getColumnCount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
public static void handleEvent(Event event) {
Table table = (Table) event.widget;
int columnCount = table.getColumnCount();
if (columnCount == 0)
return;
Rectangle area = table.getClientArea();
int totalAreaWdith = area.width;
int lineWidth = table.getGridLineWidth();
int totalGridLineWidth = (columnCount - 1) * lineWidth;
int totalColumnWidth = 0;
for (TableColumn column : table.getColumns()) {
totalColumnWidth = totalColumnWidth + column.getWidth();
}
int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth);
TableColumn lastCol = table.getColumns()[columnCount - 1];
lastCol.setWidth(diff + lastCol.getWidth());
}
示例2: selectAllInTable
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void selectAllInTable(TableViewer debugDataViewer, TableCursor tableCursor){
Table table = debugDataViewer.getTable();
TableItem[] tableItems = table.getItems();
int recordCount = 0;
for(int rowIndex = 0; rowIndex < tableItems.length; rowIndex++){
TableItem tableItem = tableItems[rowIndex];
for(int colIndex = 1; colIndex <= table.getColumnCount(); colIndex++){
if(StringUtils.containsIgnoreCase(tableItem.getText(colIndex), findText.getText())){
label.setVisible(false);
tableItem.setBackground(colIndex, Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
recordCount++;
}
}
findColIndex=1;
}
findRowIndex = 0;
findColIndex = 0;
if(recordCount > 0){
label.setVisible(true);
label.setText("Match count - " + recordCount);
}else{ label.setVisible(false); }
}
示例3: isExistInTable
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private boolean isExistInTable(TableViewer tableViewer, String text){
boolean isDataExist = false;
Table table = tableViewer.getTable();
TableItem[] tableItems = table.getItems();
for(int i=0;i<tableItems.length;i++){
TableItem tableItem = tableItems[i];
for(int j=1;j <= table.getColumnCount()-1;j++){
if(StringUtils.containsIgnoreCase(tableItem.getText(j), text)){
label.setVisible(false);
isDataExist = true;
return isDataExist;
}else{
label.setVisible(true);
label.setText(labelText);
isDataExist = false;
}
}
}
return isDataExist;
}
示例4: createColumns
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void createColumns() {
Table table = tableViewer.getTable();
while (table.getColumnCount() > 0) {
table.getColumns()[0].dispose();
}
for (ColumnInfo columnInfo : columnInfos) {
createTableViewerColumn(columnInfo);
}
// Set the column saved order
table.setColumnOrder(columnOrder);
}
示例5: refresh
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
/**
* Refresh the Table Viewer
*/
private void refresh() {
listViewer.refresh();
Table table = listViewer.getTable();
for (int i = 0, n = table.getColumnCount(); i < n; i++) {
table.getColumn(i).pack();
}
}
示例6: setTableLayoutToMappingTable
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void setTableLayoutToMappingTable(Table table) {
TableColumnLayout layout = new TableColumnLayout();
mappingTableViewer.getControl().getParent().setLayout(layout);
for (int columnIndex = 0, n = table.getColumnCount(); columnIndex < n; columnIndex++) {
table.getColumn(columnIndex).pack();
}
for (int i = 0; i < mappingTableViewer.getTable().getColumnCount(); i++) {
layout.setColumnData(mappingTableViewer.getTable().getColumn(i),
new ColumnWeightData(1));
}
}
示例7: forwardTableTraverse
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void forwardTableTraverse(TableViewer debugDataViewer, TableCursor tableCursor){
TableItem previousSelectedTableItem = null;
if(debugDataViewer.getData("SELECTED_ROW_INDEX")!=null){
previousSelectedTableItem = debugDataViewer.getTable().getItem((int) debugDataViewer.getData("SELECTED_ROW_INDEX"));
findColIndex++;
}
Table table = debugDataViewer.getTable();
TableItem[] tableItems = table.getItems();
if(findColIndex == prevColSelection && findRowIndex == prevRowSelection){
findColIndex++;
}
if(findRowIndex < 0){
findRowIndex = 0;
}
for(;findRowIndex<tableItems.length;){
TableItem tableItem = tableItems[findRowIndex];
for(;findColIndex <= table.getColumnCount();findColIndex++){
if(StringUtils.containsIgnoreCase(tableItem.getText(findColIndex), findText.getText())){
if(prevColSelection > 0){
previousSelectedTableItem.setBackground(prevColSelection, Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
}
label.setVisible(false);
table.showItem(tableItem);
table.showColumn(table.getColumn(findColIndex));
tableCursor.setSelection(findRowIndex, findColIndex);
tableCursor.setVisible(false);
tableItem.setBackground(findColIndex, Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex);
debugDataViewer.setData("SEELCTED_COLUMN_INDEX", findColIndex);
prevColSelection = findColIndex;
return;
}
}
findRowIndex++;
findColIndex=1;
if(findRowIndex >= tableItems.length){ findRowIndex = 0;}
}
}
示例8: reverseTableTraverse
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void reverseTableTraverse(TableViewer debugDataViewer, TableCursor tableCursor){
TableItem previousSelectedTableItem = null;
if(debugDataViewer.getData("SELECTED_ROW_INDEX")!=null){
previousSelectedTableItem = debugDataViewer.getTable().getItem((int) debugDataViewer.getData("SELECTED_ROW_INDEX"));
findColIndex -= 1;
}
if(findRowIndex < 0){
findRowIndex = debugDataViewer.getTable().getItems().length - 1;
}
Table table = debugDataViewer.getTable();
TableItem[] tableItems = table.getItems();
for(; findRowIndex >=0; findRowIndex--){
TableItem tableItem = tableItems[findRowIndex];
for( ; findColIndex > 0 ;findColIndex--){
if(StringUtils.containsIgnoreCase(tableItem.getText(findColIndex), findText.getText())){
if(prevColSelection > 0){
previousSelectedTableItem.setBackground(prevColSelection, Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
}
label.setVisible(false);
table.showItem(tableItem);
table.showColumn(table.getColumn(findColIndex));
tableCursor.setSelection(findRowIndex, findColIndex);
tableCursor.setVisible(false);
tableItem.setBackground(findColIndex,Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
if(findColIndex<=0){debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex-1);}else{
debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex);
}
debugDataViewer.setData("SEELCTED_COLUMN_INDEX", findColIndex);
prevColSelection = findColIndex;
prevRowSelection = findRowIndex;
return ;
}
}
if(findColIndex <= 0){ findColIndex = table.getColumnCount();}
if(findRowIndex == 0){ findRowIndex = tableItems.length; }
}
}
示例9: clearTableItemBgColor
import org.eclipse.swt.widgets.Table; //导入方法依赖的package包/类
private void clearTableItemBgColor(TableViewer debugDataViewer){
if(debugDataViewer == null){
return;
}
Table table = debugDataViewer.getTable();
TableItem[] tableItems = table.getItems();
for(int i=0;i<tableItems.length;i++){
TableItem tableItem = tableItems[i];
for(int j=1;j <= table.getColumnCount()-1;j++){
tableItem.getText(j);
tableItem.setBackground(j, Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
}
}
}