當前位置: 首頁>>代碼示例>>Java>>正文


Java Table.getSelectionIndices方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Table.getSelectionIndices方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.getSelectionIndices方法的具體用法?Java Table.getSelectionIndices怎麽用?Java Table.getSelectionIndices使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.Table的用法示例。


在下文中一共展示了Table.getSelectionIndices方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteRow

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void deleteRow(){

		Table table = mappingTableViewer.getTable();
		setValueForCellEditor();
		int selectionIndex = table.getSelectionIndex();
		int[] indexs = table.getSelectionIndices();
		if (selectionIndex == -1) {
			WidgetUtility.errorMessage("Select Rows to delete");
		} else {
			table.remove(indexs);
			int itemsRemoved=0;
			for (int index : indexs) {
				mappingTableItemList.remove(index-itemsRemoved);
				if(index-itemsRemoved-1 != -1){
					table.setSelection(index-itemsRemoved-1);
				}else{
					table.setSelection(0);
				}
				itemsRemoved++;
			}
			mappingTableViewer.refresh();
		}
		refreshButtonStatus();
	
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:26,代碼來源:JoinMapDialog.java

示例2: moveRowUp

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowUp(){
	
	Table table = mappingTableViewer.getTable();
	setValueForCellEditor();
	int[] indexes = table.getSelectionIndices();
	for (int index : indexes) {

		if (index > 0) {
			Collections.swap(
					(List<LookupMapProperty>) mappingTableItemList,
					index, index - 1);
			mappingTableViewer.refresh();
		}
	}
	refreshButtonStatus();

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:18,代碼來源:JoinMapDialog.java

示例3: moveRowDown

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowDown(){

		Table table = mappingTableViewer.getTable();
		setValueForCellEditor();
		int[] indexes = table.getSelectionIndices();
		for (int i = indexes.length - 1; i > -1; i--) {

			if (indexes[i] < mappingTableItemList.size() - 1) {
				Collections.swap(
						(List<LookupMapProperty>) mappingTableItemList,
						indexes[i], indexes[i] + 1);
				mappingTableViewer.refresh();

			}
		}
		refreshButtonStatus();
	
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:JoinMapDialog.java

示例4: moveRowDown

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowDown()
{
	Table table = mappingTableViewer.getTable();
	setValueForCellEditor();
	int[] indexes = table.getSelectionIndices();
	for (int i = indexes.length - 1; i > -1; i--) {

		if (indexes[i] < mappingTableItemList.size() - 1) {
			Collections.swap(
					(List<LookupMapProperty>) mappingTableItemList,
					indexes[i], indexes[i] + 1);
			mappingTableViewer.refresh();

		}
	}
	refreshButtonStatus();

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:LookupMapDialog.java

示例5: moveRowUp

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowUp()
{
	Table table = mappingTableViewer.getTable();
	setValueForCellEditor();
	int[] indexes = table.getSelectionIndices();
	for (int index : indexes) {

		if (index > 0) {
			Collections.swap(
					(List<LookupMapProperty>) mappingTableItemList,
					index, index - 1);
			mappingTableViewer.refresh();
		}
	}
	refreshButtonStatus();

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:18,代碼來源:LookupMapDialog.java

示例6: deleteRow

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void deleteRow()
{
	Table table = mappingTableViewer.getTable();
	setValueForCellEditor();
	int selectionIndex = table.getSelectionIndex();
	int[] indexs = table.getSelectionIndices();
	if (selectionIndex == -1) {
		WidgetUtility.errorMessage("Select Rows to delete");
	} else {
		table.remove(indexs);
		int itemsRemoved=0;
		for (int index : indexs) {
			mappingTableItemList.remove(index-itemsRemoved);
			if(index-itemsRemoved-1 != -1){
				table.setSelection(index-itemsRemoved-1);
			}else{
				table.setSelection(0);
			}
			itemsRemoved++;
		}
		mappingTableViewer.refresh();
	}
	component.setLatestChangesInSchema(false);
	refreshButtonStatus();

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:27,代碼來源:LookupMapDialog.java

示例7: selectionListenerAction

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
@Override
	public void selectionListenerAction(
			PropertyDialogButtonBar propertyDialogButtonBar,
			ListenerHelper helpers, Widget... widgets) {

		ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
		Table table =gridDetails.getTableViewer().getTable();
		int temp = table.getSelectionIndex();
		int[] indexs=table.getSelectionIndices();
		if (temp == -1) {
			WidgetUtility.errorMessage("Please Select row to delete");
		} else {
			table.remove(indexs);
			ArrayList tempList= new ArrayList();
			for (int index :indexs) { 
//				PropertyField test =(PropertyField) gridDetails.getGrids().get(index);
//				tempList.add(test);
			}
			 gridDetails.getGrids().removeAll(tempList); 
			
		}		
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:23,代碼來源:ELTTransformDeleteSelectionListener.java

示例8: moveRowUp

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowUp( TableViewer parameterTableViewer ){
	Table table = parameterTableViewer.getTable();
	int[] indexes = table.getSelectionIndices();
	for (int index : indexes) {

		if (index > 0) {
			Collections.swap((List<Parameter>) parameters, index,
					index - 1);
			parameterTableViewer.refresh();

		}
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:14,代碼來源:MultiParameterFileDialog.java

示例9: moveRowDown

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowDown(TableViewer parameterTableViewer){
	Table table = parameterTableViewer.getTable();
	int[] indexes = table.getSelectionIndices();
	for (int i = indexes.length - 1; i > -1; i--) {

		if (indexes[i] < parameters.size() - 1) {
			Collections.swap((List<Parameter>) parameters,
					indexes[i], indexes[i] + 1);
			parameterTableViewer.refresh();

		}
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:14,代碼來源:MultiParameterFileDialog.java

示例10: moveRowUp

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowUp(TableViewer nameValueTableViewer){

		Table table = nameValueTableViewer.getTable();
		int[] indexes = table.getSelectionIndices();
		for (int index : indexes) {

			if (index > 0) {
				Collections.swap(operationClassProperty.getNameValuePropertyList(), index, index - 1);
				nameValueTableViewer.refresh();
				applyButton.setEnabled(true);
			}
		}
	
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:15,代碼來源:ELTOperationClassDialog.java

示例11: moveRowDown

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowDown(TableViewer nameValueTableViewer){

		Table table = nameValueTableViewer.getTable();
		int[] indexes = table.getSelectionIndices();
		for (int i = indexes.length - 1; i > -1; i--) {

			if (indexes[i] < operationClassProperty.getNameValuePropertyList().size() - 1) {
				Collections.swap(operationClassProperty.getNameValuePropertyList(), indexes[i], indexes[i] + 1);
				nameValueTableViewer.refresh();
				applyButton.setEnabled(true);

			}
		}
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:15,代碼來源:ELTOperationClassDialog.java

示例12: moveRowUp

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowUp(TableViewer nameValueTableViewer)
{

	Table table = nameValueTableViewer.getTable();
	int[] indexes = table.getSelectionIndices();
	for (int index : indexes) {

		if (index > 0) {
			Collections.swap(mappingSheetRow.getNameValueProperty(), index, index - 1);
			nameValueTableViewer.refresh();
			applyButton.setEnabled(true);
		}
	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:16,代碼來源:OperationClassDialog.java

示例13: moveRowDown

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void moveRowDown(TableViewer nameValueTableViewer)
{
	Table table = nameValueTableViewer.getTable();
	int[] indexes = table.getSelectionIndices();
	for (int i = indexes.length - 1; i > -1; i--) {

		if (indexes[i] < mappingSheetRow.getNameValueProperty().size() - 1) {
			Collections.swap(mappingSheetRow.getNameValueProperty(), indexes[i], indexes[i] + 1);
			nameValueTableViewer.refresh();
			applyButton.setEnabled(true);

		}
	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:16,代碼來源:OperationClassDialog.java

示例14: deleteRow

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
private void deleteRow(TableViewer parameterTableViewer ){
	Table table = parameterTableViewer.getTable();
	int selectionIndex = table.getSelectionIndex();
	int[] indexs = table.getSelectionIndices();
	if (selectionIndex == -1) {
		WidgetUtility
				.errorMessage(ErrorMessages.SELECT_ROW_TO_DELETE);
	} else {
		table.remove(indexs);
		int itemsRemoved = 0;
		for (int index : indexs) {
			parameters.remove(index - itemsRemoved);
			itemsRemoved++;
		}
		parameterTableViewer.getTable().removeAll();
		parameterTableViewer.refresh();
	}
	
	if(indexs.length == 1 && parameters.size() > 0){//only one item is deleted
		if(parameters.size() == 1){//list contains only one element
			table.select(0);// select the first element
			parameterTableViewer.editElement(parameterTableViewer.getElementAt(0), 0);
		}
		else if(parameters.size() == indexs[0]){//deleted last item 
			table.select(parameters.size() - 1);//select the last element which now at the end of the list
			parameterTableViewer.editElement(parameterTableViewer.getElementAt(parameters.size() - 1), 0);
		}
		else if(parameters.size() > indexs[0]){//deleted element from middle of the list
			table.select( indexs[0] == 0 ? 0 : (indexs[0] - 1) );//select the element from at the previous location
			parameterTableViewer.editElement(parameterTableViewer.getElementAt(indexs[0] == 0 ? 0 : (indexs[0] - 1)), 0);
		}
	}
	else if(indexs.length >= 2){//multiple items are selected for deletion
		if(indexs[0] == 0){//delete from 0 to ...
			if(parameters.size() >= 1){//list contains only one element
				table.select(0);//select the remaining element
				parameterTableViewer.editElement(parameterTableViewer.getElementAt(0), 0);
			}
		}
		else{//delete started from element other than 0th element
			table.select((indexs[0])-1);//select element before the start of selection   
			parameterTableViewer.editElement(parameterTableViewer.getElementAt((indexs[0])-1), 0);
		}
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:46,代碼來源:MultiParameterFileDialog.java

示例15: setCursorOnDeleteRow

import org.eclipse.swt.widgets.Table; //導入方法依賴的package包/類
/**
 * Set the cursor on delete the row from table.
 * @param tableViewer
 * @param gridList
 */
public static void setCursorOnDeleteRow(TableViewer tableViewer, List<?> gridList){
	Table table = tableViewer.getTable();
	int[] indexes = table.getSelectionIndices();
	if (table.getSelectionIndex() == -1) {
		WidgetUtility.errorMessage(ERROR_MESSAGE);
	} else {
		table.remove(indexes);
		List listOfItemsToRemove= new ArrayList();
		for (int index : indexes) { 
			listOfItemsToRemove.add(gridList.get(index));
		}
		gridList.removeAll(listOfItemsToRemove);
		
	//highlight after deletion
	if(indexes.length == 1 && gridList.size() > 0){//only one item is deleted
		if(gridList.size() == 1){//list contains only one element
			table.select(0);// select the first element
			tableViewer.editElement(tableViewer.getElementAt(0), 0);
		}
		else if(gridList.size() == indexes[0]){//deleted last item 
			table.select(gridList.size() - 1);//select the last element which now at the end of the list
			tableViewer.editElement(tableViewer.getElementAt(gridList.size() - 1), 0);
		}
		else if(gridList.size() > indexes[0]){//deleted element from middle of the list
			table.select( indexes[0] == 0 ? 0 : (indexes[0] - 1) );//select the element from at the previous location
			tableViewer.editElement(tableViewer.getElementAt(indexes[0] == 0 ? 0 : (indexes[0] - 1)), 0);
		}
	}
	else if(indexes.length >= 2){//multiple items are selected for deletion
		if(indexes[0] == 0){//delete from 0 to ...
			if(gridList.size() >= 1){//list contains only one element
				table.select(0);//select the remaining element
				tableViewer.editElement(tableViewer.getElementAt(0), 0);
			}
		}
		else{//delete started from element other than 0th element
			table.select((indexes[0])-1);//select element before the start of selection   
			tableViewer.editElement(tableViewer.getElementAt((indexes[0])-1), 0);
		}
	}
  }
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:48,代碼來源:WidgetUtility.java


注:本文中的org.eclipse.swt.widgets.Table.getSelectionIndices方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。