MemoryForm.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * Initial developer(s): Michel-Ange ANTON
00022  * --------------------------------------------------------------------------
00023  * $Id: MemoryForm.java,v 1.3 2003/06/20 17:15:41 antonma Exp $
00024  * --------------------------------------------------------------------------
00025  */
00026 
00027 package org.objectweb.jonas.webapp.jonasadmin.monitoring;
00028 
00029 import javax.servlet.http.HttpServletRequest;
00030 
00031 import org.apache.struts.action.ActionError;
00032 import org.apache.struts.action.ActionErrors;
00033 import org.apache.struts.action.ActionForm;
00034 import org.apache.struts.action.ActionMapping;
00035 
00036 public class MemoryForm extends ActionForm {
00037 
00038 // --------------------------------------------------------- Properties Variables
00039 
00040     private int numberOfMeasures = 120;
00041     private int range = 10;
00042     private int widthGraphic;
00043     private int heightGraphic;
00044     private int timerGraphic;
00045 
00046 // --------------------------------------------------------- Public Methods
00047 
00055     public void reset(ActionMapping mapping, HttpServletRequest request) {
00056         numberOfMeasures = 120;
00057         range = 10;
00058         refreshGraphic();
00059     }
00060 
00061     public void refreshGraphic() {
00062         widthGraphic = MemoryGraphServlet.getWidth(numberOfMeasures);
00063         heightGraphic = MemoryGraphServlet.getHeight();
00064         timerGraphic = 1000 * (range + 2);
00065     }
00066 
00077     public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
00078         ActionErrors oErrors = new ActionErrors();
00079         if (numberOfMeasures <= 1) {
00080             oErrors.add("numberOfMeasures"
00081                 , new ActionError("error.monitoring.memory.numberOfMeasures"));
00082         }
00083         if (range < 10) {
00084             oErrors.add("range", new ActionError("error.monitoring.memory.range"));
00085         }
00086         //System.out.println("oErrors.size() = "+oErrors.size());
00087         if (oErrors.size() == 0) {
00088             //System.out.println("sizingGraphic");
00089             refreshGraphic();
00090         }
00091         return oErrors;
00092     }
00093 
00094 // --------------------------------------------------------- Properties Methods
00095 
00096     public int getNumberOfMeasures() {
00097         return numberOfMeasures;
00098     }
00099 
00100     public void setNumberOfMeasures(int numberOfMeasures) {
00101         this.numberOfMeasures = numberOfMeasures;
00102     }
00103 
00104     public int getRange() {
00105         return range;
00106     }
00107 
00108     public void setRange(int range) {
00109         this.range = range;
00110     }
00111 
00112     public int getWidthGraphic() {
00113         return widthGraphic;
00114     }
00115 
00116     public void setWidthGraphic(int widthGraphic) {
00117         this.widthGraphic = widthGraphic;
00118     }
00119 
00120     public int getHeightGraphic() {
00121         return heightGraphic;
00122     }
00123 
00124     public void setHeightGraphic(int heightGraphic) {
00125         this.heightGraphic = heightGraphic;
00126     }
00127 
00128     public int getTimerGraphic() {
00129         return timerGraphic;
00130     }
00131 
00132     public void setTimerGraphic(int timerGraphic) {
00133         this.timerGraphic = timerGraphic;
00134     }
00135 
00136 }

Generated on Tue Feb 15 15:05:29 2005 for JOnAS by  doxygen 1.3.9.1