/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
/**
*
*/
package org.richfaces.demo.validator;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
/**
* @author asmirnov
*
*/
@ManagedBean
@RequestScoped
public class GraphValidatorBean implements Cloneable {
@Min(0)
@Max(10)
private int first;
@Min(0)
@Max(10)
private int second;
@Min(0)
@Max(10)
private int third;
private String actionResult;
/**
* @return the actionResult
*/
public String getActionResult() {
return actionResult;
}
/**
* @param actionResult the actionResult to set
*/
public void setActionResult(String actionResult) {
this.actionResult = actionResult;
}
/**
* @return the first
*/
public int getFirst() {
return first;
}
/**
* @param first the first to set
*/
public void setFirst(int first) {
this.first = first;
}
/**
* @return the second
*/
public int getSecond() {
return second;
}
/**
* @param second the second to set
*/
public void setSecond(int second) {
this.second = second;
}
/**
* @return the third
*/
public int getThird() {
return third;
}
/**
* @param third the third to set
*/
public void setThird(int third) {
this.third = third;
}
/**
* @return total summ of the list values.
*/
@Max(value = 20, message = "Total value should be less then 20")
public int getSumm() {
return first + second + third;
}
public String action() {
// Persist your data here
setActionResult("Data have been saved");
return null;
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}