当前位置: 首页>>代码示例>>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;未经允许,请勿转载。