当前位置: 首页>>代码示例>>Java>>正文


Java VerifyListener类代码示例

本文整理汇总了Java中org.eclipse.swt.events.VerifyListener的典型用法代码示例。如果您正苦于以下问题:Java VerifyListener类的具体用法?Java VerifyListener怎么用?Java VerifyListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VerifyListener类属于org.eclipse.swt.events包,在下文中一共展示了VerifyListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachKeyValidator

import org.eclipse.swt.events.VerifyListener; //导入依赖的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: addVerifyListnerToOutputEditingSupport

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static void addVerifyListnerToOutputEditingSupport(JoinMappingEditingSupport outputEditingSupport) {
	((Text)outputEditingSupport.getEditor().getControl()).addVerifyListener(new VerifyListener() {
		
		@Override
		public void verifyText(VerifyEvent e) {
			String text=e.text;
			Matcher matcher=Pattern.compile(Constants.REGEX).matcher(text);
			
			if(matcher.matches()){
				e.doit=true;
			}else{
				e.doit=false;
			}
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:WidgetUtility.java

示例3: createJumpPageTextBox

import org.eclipse.swt.events.VerifyListener; //导入依赖的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

示例4: refreshThePaletteBasedOnSearchString

import org.eclipse.swt.events.VerifyListener; //导入依赖的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

示例5: UndoRedoManager

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
/**
 * Constructor. Creates data structures and adds listener to note modifications.
 * 
 * @param note
 */
public UndoRedoManager(final Note note) {
	undoDeque = new ArrayDeque<>();
	redoDeque = new ArrayDeque<>();
	this.note = note;

	// Listen to text modifications.
	note.addVerifyListener(new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent event) {
			// Last modification was due to an undo/redo action: do not record it.
			if (lastActionUndoOrRedo) {
				lastActionUndoOrRedo = false;
				return;
			}
			recordNoteModification(event, note.getStyleRanges());
		}
	});
}
 
开发者ID:PyvesB,项目名称:Notepad4e,代码行数:24,代码来源:UndoRedoManager.java

示例6: createPackageField

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
private void createPackageField(Composite parent) {
  Label packageNameLabel = new Label(parent, SWT.LEAD);
  packageNameLabel.setText(Messages.getString("java.package")); //$NON-NLS-1$
  javaPackageField = new Text(parent, SWT.BORDER);
  javaPackageField.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      revalidate();
    }
  });
  javaPackageField.addVerifyListener(new VerifyListener() {
    @Override
    public void verifyText(VerifyEvent event) {
      // if the user ever changes the package name field, then we never auto-generate again.
      if (!javaPackageProgrammaticUpdate) {
        autoGeneratePackageName = false;
      }
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:AppEngineWizardPage.java

示例7: verifyListenerInteger

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static VerifyListener verifyListenerInteger(final boolean canBeNegative) {

		return new VerifyListener() {
			@Override
			public void verifyText(final VerifyEvent e) {

				// check backspace and del key
				if (e.character == SWT.BS || e.character == SWT.DEL) {
					return;
				}

				// check '-' key
				if (canBeNegative && e.character == '-') {
					return;
				}

				try {
					Integer.parseInt(e.text);
				} catch (final NumberFormatException ex) {
					e.doit = false;
				}
			}
		};
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:25,代码来源:Util.java

示例8: verifyFilenameInput

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static VerifyListener verifyFilenameInput() {

		return new VerifyListener() {
			@Override
			public void verifyText(final VerifyEvent e) {

				// check invalid chars
				for (final char invalidChar : INVALID_FILENAME_CHARS) {
					if (invalidChar == e.character) {
						e.doit = false;
						return;
					}
				}
			}
		};
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:UI.java

示例9: verifyFilePathInput

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static VerifyListener verifyFilePathInput() {

		return new VerifyListener() {
			@Override
			public void verifyText(final VerifyEvent e) {

				// check invalid chars
				for (final char invalidChar : INVALID_FILEPATH_CHARS) {
					if (invalidChar == e.character) {
						e.doit = false;
						return;
					}
				}
			}
		};
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:UI.java

示例10: verifyListenerTypeLong

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static VerifyListener verifyListenerTypeLong() {

		return new VerifyListener() {
			@Override
			public void verifyText(final VerifyEvent e) {
				if (e.text.equals(EMPTY_STRING)) {
					return;
				}
				try {
					Long.parseLong(e.text);
				} catch (final NumberFormatException e1) {
					e.doit = false;
				}
			}
		};
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:UI.java

示例11: verifyListenerInteger

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static VerifyListener verifyListenerInteger(final boolean canBeNegative) {
	return new VerifyListener() {
		public void verifyText(final VerifyEvent e) {

			// check backspace and del key
			if (e.character == SWT.BS || e.character == SWT.DEL) {
				return;
			}

			// check '-' key
			if (canBeNegative && e.character == '-') {
				return;
			}

			try {
				Integer.parseInt(e.text);
			} catch (final NumberFormatException ex) {
				e.doit = false;
			}
		}
	};
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:23,代码来源:Util.java

示例12: main

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public static void main(String [] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout ());
	final Text text0 = new Text (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	final Text text1 = new Text (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	text0.addVerifyListener (new VerifyListener () {
		@Override
		public void verifyText (VerifyEvent event) {
			text1.setTopIndex (text0.getTopIndex ());
			text1.setSelection (event.start, event.end);
			text1.insert (event.text);
		}
	});
	shell.setBounds(10, 10, 200, 200);
	shell.open ();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
 
开发者ID:th-schwarz,项目名称:pmcms,代码行数:22,代码来源:GUIwriteToText.java

示例13: initVerifyListener

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
@Override
	protected void initVerifyListener() {
		VerifyListener verifyListener = new VerifyListener() {
			@Override
			public void verifyText(VerifyEvent e) {

				//TODO:FIXME take out!
				logger.debug("verifyText() "+e.keyCode + ": "+e.character + " - "+ e.text);
				
				// prevent del and backspace on begin and end of line:
				preventDelAndBackspace(e);
				if (e.doit == false)
					return;
				
//				logger.debug("range changed = "+e.start+" / "+e.end+ " e = "+e.toString());
				
				// TEST: print ranges and text of affected lines of replacement:
//				List<Pair<TrpTextLineType, IntRange>> rrs = getReplaceRanges(e);
//				logger.debug("replace ranges for e = "+e);
//				for (Pair<TrpTextLineType, IntRange> pr : rrs) {
//					TrpTextLineType line = pr.getLeft();
//					IntRange range = pr.getRight();
//					String text = line.getUnicodeText().substring(range.offset, range.offset+range.length);
//					logger.debug("range: "+range+" text: "+text);
//				}
				
//				preventChangeOverMultipleLines(e);
//				if (e.doit == false)
//					return;
				
				checkAndReinterpretMultilineInsertions(e);
				if (e.doit == false)
					return;
								
				lastReplacements = getReplaceRanges(e.start, e.end);
			}
		};
		addUserVerifyListener(verifyListener);
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:40,代码来源:LineTranscriptionWidget.java

示例14: initVerifyListener

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
@Override
protected void initVerifyListener() {
	VerifyListener verifyListener = new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent e) {
			if (currentWordObject == null) {
				e.doit = false;
				return;
			}
			// prevent changes over multiple lines:
			preventChangeOverMultipleLines(e);
			if (e.doit == false)
				return;
			
			preventInsertionOfMultipleLines(e);
			if (e.doit == false)
				return;
			
			preventSomeStuff(e);
			if (e.doit == false)
				return;
			
			preventAndReinterpretDeletionOfWholeWord(e);
			if (e.doit == false)
				return;
			
			detectEditOfEmptyWord(e);
			if (e.doit == false)
				return;				
		}
	};
	addUserVerifyListener(verifyListener);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:34,代码来源:WordTranscriptionWidget.java

示例15: LabeledText

import org.eclipse.swt.events.VerifyListener; //导入依赖的package包/类
public LabeledText(Composite parent, String labelText, boolean makeColumnsEqualWidth) {
	super(parent, 0);
	
	this.setLayout(SWTUtil.createGridLayout(2, makeColumnsEqualWidth, 0, 0));
	
	label = new Label(this, 0);
	label.setText(labelText);
	
	text = new Text(this, SWT.BORDER | SWT.SINGLE);
	text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	text.addVerifyListener( new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent e) {
			if (validateToInt) {
				String oldS = text.getText();
			    String newS = oldS.substring(0, e.start) + e.text + oldS.substring(e.end);
				try {
					Integer.parseInt(newS);
					e.doit = true;
				} catch (Exception ex) {
					e.doit = false;
				}
			}
		}
	});
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:28,代码来源:LabeledText.java


注:本文中的org.eclipse.swt.events.VerifyListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。