Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/pasteInNewTable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java')
-rw-r--r--sandbox/pasteInNewTable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java
new file mode 100644
index 00000000000..2ce0cb3d417
--- /dev/null
+++ b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.nattable.validator;
+
+import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
+
+/**
+ *
+ * The Validator for Integer
+ *
+ */
+public class IntegerDataValidator extends DataValidator {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.validate.DataValidator#validate(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ * @return
+ */
+ @Override
+ public boolean validate(int columnIndex, int rowIndex, Object newValue) {
+ try {
+ if(newValue != null) {
+ new Integer(newValue.toString());
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+}

Back to the top