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


Java Spinner.getSelection方法代碼示例

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


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

示例1: onSelectRandomSpinnerMax

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void onSelectRandomSpinnerMax(final HashMap<WIDGET_KEY, Widget> paraWidgets) {

		/*
		 * ensure the to value is larger than the from value
		 */
		final Spinner minSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START);
		final Spinner maxSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END);

		final int fromRand = minSpinner.getSelection();
		final int toRand = maxSpinner.getSelection();

		if (toRand <= fromRand) {

			if (toRand < 1) {
				minSpinner.setSelection(0);
				maxSpinner.setSelection(1);
			} else {
				minSpinner.setSelection(toRand - 1);
			}
		}

		updateUICustomUrl();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:24,代碼來源:DialogMPCustom.java

示例2: onSelectRandomSpinnerMin

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void onSelectRandomSpinnerMin(final HashMap<WIDGET_KEY, Widget> paraWidgets) {

		/*
		 * ensure the from value is smaller than the to value
		 */
		final Spinner minSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START);
		final Spinner maxSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END);

		final int fromRand = minSpinner.getSelection();
		final int toRand = maxSpinner.getSelection();

		if (fromRand >= toRand) {

			if (toRand < MAX_RANDOM) {
				maxSpinner.setSelection(fromRand + 1);
			} else {
				minSpinner.setSelection(toRand - 1);
			}
		}

		updateUICustomUrl();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:23,代碼來源:DialogMPCustom.java

示例3: onField_Select_Number_Float

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void onField_Select_Number_Float(final Widget widget) {

		final Spinner spinner = (Spinner) widget;

		final TourFilterProperty filterProperty = (TourFilterProperty) spinner.getData();
		final int fieldNo = (int) spinner.getData(FIELD_NO);

		final double selectedValue = spinner.getSelection();
		final TourFilterFieldConfig fieldConfig = filterProperty.fieldConfig;

		// remove spinner digits
		double fieldValue = selectedValue / Math.pow(10, fieldConfig.numDigits);

		if (fieldConfig.fieldValueConverter != null) {
			fieldValue = fieldConfig.fieldValueConverter.convert_UI_To_Model(fieldValue);
		}

		if (fieldNo == 1) {
			filterProperty.doubleValue1 = fieldValue;
		} else {
			filterProperty.doubleValue2 = fieldValue;
		}

		fireModifyEvent();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:26,代碼來源:SlideoutTourFilter.java

示例4: onField_Select_Number_Integer

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void onField_Select_Number_Integer(final Widget widget) {

		final Spinner spinner = (Spinner) widget;

		final TourFilterProperty filterProperty = (TourFilterProperty) spinner.getData();
		final int fieldNo = (int) spinner.getData(FIELD_NO);

		final int selectedValue = spinner.getSelection();
		final TourFilterFieldConfig fieldConfig = filterProperty.fieldConfig;

		double fieldValue = selectedValue;

		if (fieldConfig.fieldValueConverter != null) {
			fieldValue = fieldConfig.fieldValueConverter.convert_UI_To_Model(fieldValue);
		}

		if (fieldNo == 1) {
			filterProperty.intValue1 = (int) (fieldValue + 0.5);
		} else {
			filterProperty.intValue2 = (int) (fieldValue + 0.5);
		}

		fireModifyEvent();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:25,代碼來源:SlideoutTourFilter.java

示例5: onField_Select_SeasonDay

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void onField_Select_SeasonDay(final Widget widget) {

		final Spinner spinnerDay = (Spinner) widget;

		final TourFilterProperty filterProperty = (TourFilterProperty) spinnerDay.getData();
		final int fieldNo = (int) spinnerDay.getData(FIELD_NO);

		final int selectedDay = spinnerDay.getSelection();

		final MonthDay oldField = fieldNo == 1 //
				? filterProperty.monthDay1
				: filterProperty.monthDay2;
		final int oldMonth = oldField.getMonthValue();

		final MonthDay monthDay = MonthDay.of(oldMonth, selectedDay);

		if (fieldNo == 1) {
			filterProperty.monthDay1 = monthDay;
		} else {
			filterProperty.monthDay2 = monthDay;
		}

		fireModifyEvent();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:25,代碼來源:SlideoutTourFilter.java

示例6: adjustSpinnerValueOnMouseScroll

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
public static void adjustSpinnerValueOnMouseScroll(final MouseEvent event) {

		boolean isCtrlKey;
		boolean isShiftKey;

		if (IS_OSX) {
			isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
			isShiftKey = (event.stateMask & SWT.MOD3) > 0;
			//			isAltKey = (event.stateMask & SWT.MOD3) > 0;
		} else {
			isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
			isShiftKey = (event.stateMask & SWT.MOD2) > 0;
			//			isAltKey = (event.stateMask & SWT.MOD3) > 0;
		}

		// accelerate with Ctrl + Shift key
		int accelerator = isCtrlKey ? 10 : 1;
		accelerator *= isShiftKey ? 5 : 1;

		final Spinner spinner = (Spinner) event.widget;
		final int valueAdjustment = ((event.count > 0 ? 1 : -1) * accelerator);

		final int oldValue = spinner.getSelection();
		spinner.setSelection(oldValue + valueAdjustment);
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:26,代碼來源:UI.java

示例7: setSpinnerSelection

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
/**
 * Set the value of a spinner. For convenience this method takes an object as value, but if the obj is null, or if it
 * is not an Integer the method does nothing. If the displayed value is the same as the one provided, nothing is done
 * (preventing on windows the whole selection of the number).
 * 
 * @param spinner
 * @param obj
 */
public static void setSpinnerSelection(Spinner spinner, Object obj) {
	if (obj == null)
		return;
	if (!(obj instanceof Integer))
		return;
	int num = ((Integer) obj).intValue();
	if (spinner.getSelection() != num) {
		spinner.setSelection(num);
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:19,代碼來源:UIUtil.java

示例8: updateModel_FromUI_Vertices

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
/**
 * Get vertices from UI and sorts them.
 */
private void updateModel_FromUI_Vertices() {

	final ArrayList<RGBVertex> rgbVertices = getRgbVertices();
	final int rgbVertexListSize = rgbVertices.size();
	final ArrayList<RGBVertex> newRgbVertices = new ArrayList<RGBVertex>();

	for (int vertexIndex = 0; vertexIndex < rgbVertexListSize; vertexIndex++) {

		/*
		 * create vertices from UI controls
		 */
		final Spinner spinnerOpacity = _spinnerOpacity[vertexIndex];
		final Spinner spinnerVertexValue = _spinnerVertexValue[vertexIndex];

		final int value = spinnerVertexValue.getSelection();
		final Integer sortId = (Integer) spinnerVertexValue.getData(DATA_KEY_SORT_ID);

		final RGB rgb = _lblVertexColor[vertexIndex].getBackground().getRGB();
		final float opacity = (float) (spinnerOpacity.getSelection() / Map3GradientColorManager.OPACITY_DIGITS_FACTOR);

		final RGBVertex rgbVertex = new RGBVertex(sortId);
		rgbVertex.setValue(value);
		rgbVertex.setRGB(rgb);
		rgbVertex.setOpacity(opacity);

		newRgbVertices.add(rgbVertex);
	}

	// sort vertices by value
	Collections.sort(newRgbVertices);

	// update model
	getProfileImage().setVertices(newRgbVertices);

	_isProntoColorEnabled = _chkProntoColor.getSelection();
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:40,代碼來源:DialogMap3ColorEditor.java

示例9: UpdateInstanceCountAction

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
public UpdateInstanceCountAction(CloudFoundryApplicationsEditorPage editorPage, Spinner instanceSpinner,
		CloudFoundryApplicationModule module) {
	super(editorPage, RefreshArea.DETAIL);
	this.instanceCount = instanceSpinner.getSelection();
	this.module = module;
}
 
開發者ID:eclipse,項目名稱:cft,代碼行數:7,代碼來源:UpdateInstanceCountAction.java

示例10: updateUICustomUrl

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
/**
 * update custom url from url parts
 */
private void updateUICustomUrl() {

	final StringBuilder sb = new StringBuilder();

	for (final PartRow row : PART_ROWS) {

		final HashMap<WIDGET_KEY, Widget> rowWidgets = row.rowWidgets;
		final PartUIItem selectedParaItem = PART_ITEMS.get(row.rowCombo.getSelectionIndex());

		switch (selectedParaItem.partKey) {

		case HTML:

			final Text txtHtml = (Text) rowWidgets.get(WIDGET_KEY.TEXT_HTML);
			sb.append(txtHtml.getText());

			break;

		case RANDOM_INTEGER:

			final Spinner fromSpinner = (Spinner) rowWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START);
			final Spinner toSpinner = (Spinner) rowWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END);

			final int fromValue = fromSpinner.getSelection();
			final int toValue = toSpinner.getSelection();

			sb.append(PARAMETER_LEADING_CHAR);
			sb.append(Integer.toString(fromValue));
			sb.append("..."); //$NON-NLS-1$
			sb.append(Integer.toString(toValue));
			sb.append(PARAMETER_TRAILING_CHAR);

			break;

		case X:
			sb.append(createUI214Parameter(PART_TYPE.X));
			break;

		case Y:
			sb.append(createUI214Parameter(PART_TYPE.Y));
			break;

		case ZOOM:
			sb.append(createUI214Parameter(PART_TYPE.ZOOM));
			break;

		default:
			break;
		}
	}

	_btnShowMap.setEnabled(sb.length() > 5);
	_customUrl = sb.toString();

	_txtCustomUrl.setText(_customUrl);
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:60,代碼來源:DialogMPCustom.java

示例11: update_Model_From_UI_IL

import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
/**
 * Set data from the UI into the model.
 */
private void update_Model_From_UI_IL() {

	if (_selectedIL == null) {
		return;
	}

	_selectedIL.name = _txtIL_ConfigName.getText();
	_selectedIL.description = _txtIL_ConfigDescription.getText();
	_selectedIL.isSaveTour = _chkIL_SaveTour.getSelection();
	_selectedIL.isShowInDashboard = _chkIL_ShowInDashboard.getSelection();

	// last marker
	_selectedIL.isSetLastMarker = _chkIL_SetLastMarker.getSelection();
	_selectedIL.lastMarkerDistance = getSelectedLastMarkerDistance();
	_selectedIL.lastMarkerText = _txtIL_LastMarker.getText();

	// tour type
	final Enum<TourTypeConfig> selectedTourTypeConfig = getSelectedTourTypeConfig();
	_selectedIL.tourTypeConfig = selectedTourTypeConfig;

	/*
	 * Set tour type data
	 */
	if (TourTypeConfig.TOUR_TYPE_CONFIG_BY_SPEED.equals(selectedTourTypeConfig)) {

		final ArrayList<SpeedTourType> speedTourTypes = _selectedIL.speedTourTypes;

		if (_spinnerTT_Speed_AvgSpeed != null) {

			final ArrayList<SpeedTourType> newSpeedTourTypes = new ArrayList<SpeedTourType>();

			for (int speedTTIndex = 0; speedTTIndex < speedTourTypes.size(); speedTTIndex++) {

				final Spinner spinnerAvgSpeed = _spinnerTT_Speed_AvgSpeed[speedTTIndex];
				final Link linkTourType = _linkTT_Speed_TourType[speedTTIndex];

				final SpeedTourType speedTourType = new SpeedTourType();

				speedTourType.avgSpeed = spinnerAvgSpeed.getSelection() * net.tourbook.ui.UI.UNIT_VALUE_DISTANCE;

				final Object tourTypeId = linkTourType.getData(DATA_KEY_TOUR_TYPE_ID);
				if (tourTypeId instanceof Long) {
					speedTourType.tourTypeId = (long) tourTypeId;
				} else {
					speedTourType.tourTypeId = TourDatabase.ENTITY_IS_NOT_SAVED;
				}

				newSpeedTourTypes.add(speedTourType);
			}

			// sort value
			Collections.sort(newSpeedTourTypes);

			// update model
			speedTourTypes.clear();
			speedTourTypes.addAll(newSpeedTourTypes);
		}

		_selectedIL.setupItemImage();

	} else if (TourTypeConfig.TOUR_TYPE_CONFIG_ONE_FOR_ALL.equals(selectedTourTypeConfig)) {

		update_Model_From_UI_OneTourType();

	} else {

		// this is the default

		_selectedIL.setupItemImage();
	}
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:75,代碼來源:DialogEasyImportConfig.java


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