1 26 27 package org.objectweb.jonas.webapp.jonasadmin.monitoring; 28 29 import javax.servlet.http.HttpServletRequest ; 30 31 import org.apache.struts.action.ActionMessage; 32 import org.apache.struts.action.ActionErrors; 33 import org.apache.struts.action.ActionForm; 34 import org.apache.struts.action.ActionMapping; 35 36 public class MemoryForm extends ActionForm { 37 38 40 private int numberOfMeasures = 120; 41 private int range = 10; 42 private int widthGraphic; 43 private int heightGraphic; 44 private int timerGraphic; 45 46 48 54 55 public void reset(ActionMapping mapping, HttpServletRequest request) { 56 numberOfMeasures = 120; 57 range = 10; 58 refreshGraphic(); 59 } 60 61 public void refreshGraphic() { 62 widthGraphic = MemoryGraphServlet.getWidth(numberOfMeasures); 63 heightGraphic = MemoryGraphServlet.getHeight(); 64 timerGraphic = 1000 * (range + 2); 65 } 66 67 77 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 78 ActionErrors oErrors = new ActionErrors(); 79 if (numberOfMeasures <= 1) { 80 oErrors.add("numberOfMeasures" 81 , new ActionMessage("error.monitoring.memory.numberOfMeasures")); 82 } 83 if (range < 10) { 84 oErrors.add("range", new ActionMessage("error.monitoring.memory.range")); 85 } 86 if (oErrors.size() == 0) { 88 refreshGraphic(); 90 } 91 return oErrors; 92 } 93 94 96 public int getNumberOfMeasures() { 97 return numberOfMeasures; 98 } 99 100 public void setNumberOfMeasures(int numberOfMeasures) { 101 this.numberOfMeasures = numberOfMeasures; 102 } 103 104 public int getRange() { 105 return range; 106 } 107 108 public void setRange(int range) { 109 this.range = range; 110 } 111 112 public int getWidthGraphic() { 113 return widthGraphic; 114 } 115 116 public void setWidthGraphic(int widthGraphic) { 117 this.widthGraphic = widthGraphic; 118 } 119 120 public int getHeightGraphic() { 121 return heightGraphic; 122 } 123 124 public void setHeightGraphic(int heightGraphic) { 125 this.heightGraphic = heightGraphic; 126 } 127 128 public int getTimerGraphic() { 129 return timerGraphic; 130 } 131 132 public void setTimerGraphic(int timerGraphic) { 133 this.timerGraphic = timerGraphic; 134 } 135 136 } | Popular Tags |