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


Java Text.addVerifyListener方法代碼示例

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


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

示例1: attachKeyValidator

import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
private void attachKeyValidator(final Text text) {
	text.addVerifyListener(new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent e) {
			txtDecorator.hide();
			String currentText = ((Text) e.widget).getText();
			String newName = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end));
			Matcher matchName = Pattern.compile("[\\@]{1}[\\{]{1}[\\w]*[\\}]{1}||[\\w]*").matcher(newName);
			if(!matchName.matches()){
				text.setToolTipText(Messages.CHARACTERSET);
				txtDecorator=WidgetUtility.addDecorator(text,Messages.CHARACTERSET);
				txtDecorator.setDescriptionText(Messages.CHARACTERSET);
				txtDecorator.show();
				e.doit=false;
			}
			else
			{
				text.setToolTipText("");
				text.setMessage("");
				txtDecorator.hide();
			}
		}
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:25,代碼來源:ParameterGridDialog.java

示例2: createJumpPageTextBox

import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
private void createJumpPageTextBox(Composite composite_3) {
	Text jumpPageTextBox = new Text(composite_3, SWT.BORDER);
	jumpPageTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	jumpPageTextBox.addVerifyListener(new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent e) {
			String currentText = ((Text) e.widget).getText();
			String pageNumberText = currentText.substring(0, e.start) + e.text + currentText.substring(e.end);
			try {
				long pageNumber = Long.valueOf(pageNumberText);
				if (pageNumber < 1) {
					e.doit = false;
				}
			} catch (NumberFormatException ex) {
				if (!pageNumberText.equals(""))
					e.doit = false;
			}
		}
	});

	dataViewerListeners.attachJumpPageListener(jumpPageTextBox);
	windowControls.put(ControlConstants.JUMP_TEXT, jumpPageTextBox);

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

示例3: refreshThePaletteBasedOnSearchString

import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
private void refreshThePaletteBasedOnSearchString(final PaletteRoot paletteRoot,
		final ELTGraphicalEditor editor, final Map<String, PaletteDrawer> categoryPaletteContainer,
		final Text text, final List<Component> componentsConfig, final Composite container) {
	text.addVerifyListener(new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent e) {
			boolean matchFound = false;
			final List<Component> matchingComponents = new ArrayList<>();
			paletteRoot.getChildren().clear();
			String currentText = ((Text) e.widget).getText();
			createPaletteContainers(paletteRoot, categoryPaletteContainer, editor);
			String searchedString = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end))
					.toUpperCase();
				if (StringUtils.isEmpty(searchedString)) {
					showAllContainers(paletteRoot, editor, categoryPaletteContainer, componentsConfig);
				} else {
					showOpenPaletteContainers(paletteRoot.getChildren());
					matchFound = checkSearchedComponentFoundInPalette(editor, categoryPaletteContainer, componentsConfig,
							 matchingComponents, searchedString);
					showMessageWhenComponentNotFound(container, matchFound);
					showMatchingContainers(paletteRoot, categoryPaletteContainer, matchingComponents);
				}
		}
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:26,代碼來源:CustomPaletteViewer.java


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