00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
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
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
00087 if (oErrors.size() == 0) {
00088
00089 refreshGraphic();
00090 }
00091 return oErrors;
00092 }
00093
00094
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 }