本文整理匯總了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));
}
}
}