| /******************************************************************************* |
| * Copyright (c) 2011 Boeing. |
| * 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: |
| * Boeing - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.osee.ats.core.validator; |
| |
| import org.eclipse.osee.ats.api.AtsApi; |
| import org.eclipse.osee.ats.api.IAtsWorkItem; |
| import org.eclipse.osee.ats.api.util.IValueProvider; |
| import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition; |
| import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition; |
| import org.eclipse.osee.ats.api.workdef.WidgetResult; |
| |
| /** |
| * @author Donald G. Dunne |
| */ |
| public class AtsXNumberValidator extends AtsXWidgetValidator { |
| |
| @Override |
| public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, AtsApi atsServices) { |
| WidgetResult result = WidgetResult.Success; |
| String name = widgetDef.getXWidgetName(); |
| |
| if ("XFloatDam".equals(name)) { |
| result = validateWidgetIsRequired(provider, widgetDef, fromStateDef, toStateDef); |
| if (!result.isSuccess()) { |
| return result; |
| } |
| return isValidFloat(provider, widgetDef); |
| } |
| if ("XIntegerDam".equals(name)) { |
| result = validateWidgetIsRequired(provider, widgetDef, fromStateDef, toStateDef); |
| if (!result.isSuccess()) { |
| return result; |
| } |
| return isValidInteger(provider, widgetDef); |
| } |
| return result; |
| } |
| } |