Changeset 1451
- Timestamp:
- 11/04/08 07:51:04 (2 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/dev-brotecs-refactor/org.javarosa.polish.chatterbox.extensions/src/org/javarosa/formmanager/view/chatterbox/widget/GraphWidget.java
r1251 r1451 39 39 40 40 /** Integer->IGraphTemplate */ 41 Map templates = new Map();41 private static Map templates = new Map(); 42 42 43 43 Vector data; … … 45 45 //brotecs:add this; 46 46 //CurrentTemplate currentTemplate=null; 47 WHOWeightTemplate currentTemplate=null; //Brotecs: for WHOWeightTemplate47 IGraphTemplate currentTemplate=null; //Brotecs: for WHOWeightTemplate 48 48 49 49 … … 71 71 72 72 chart.setMaxYScaleFactor(100); 73 chart.setMaxXScaleFactor( 18);73 chart.setMaxXScaleFactor(26); 74 74 } 75 75 … … 81 81 for(int i = 0; i < chartXPointsArray.length; i++) { 82 82 chart.insertItem("", chartYPointsArray[i].intValue(), chartXPointsArray[i].intValue(), 0, 0, 255); 83 //System.out.println("Brotecs::GraphWidget->applyData():chartYPointsArray="+chartYPointsArray[i].intValue()+" chartXPointsArray="+chartXPointsArray[i].intValue());83 //System.out.println("Brotecs::GraphWidget->applyData():chartYPointsArray="+chartYPointsArray[i].intValue()+" chartXPointsArray="+chartXPointsArray[i].intValue()); 84 84 } 85 85 … … 93 93 private void applyTemplate(Vector data) { 94 94 System.out.println("Brotecs::GraphWidget->applyTemplate"); 95 if(currentTemplate .getIsUseTemplate()) {95 if(currentTemplate!=null) { 96 96 System.out.println("Brotecs::GraphWidget->applyTemplate:currentTemplate != null"); 97 Vector lines = currentTemplate.getLines(data );97 Vector lines = currentTemplate.getLines(data,chart); 98 98 if(lines != null) { 99 System.out.println("Brotecs::GraphWidget->applyTemplate:lines != null");99 //System.out.println("Brotecs::GraphWidget->applyTemplate:lines != null"); 100 100 Enumeration en = lines.elements(); 101 101 while(en.hasMoreElements()) { 102 System.out.println("Brotecs::GraphWidget->en.hasMoreElements()");102 //System.out.println("Brotecs::GraphWidget->en.hasMoreElements()"); 103 103 Vector dataPoints = (Vector)en.nextElement(); 104 104 //System.out.println("Brotecs::GraphWidget->datapoints.size()="+dataPoints.size()); … … 112 112 } 113 113 else{ 114 //System.out.println("Brotecs::GraphWidget->applyTemplate:currentTemplate == null");114 System.out.println("Brotecs::GraphWidget->applyTemplate:currentTemplate == null"); 115 115 } 116 116 } … … 123 123 public void registerTemplate(IGraphTemplate template) { 124 124 //System.out.println("Brotecs::GraphWidget->registerTemplate"); 125 templates.put(new Integer(template.getTemplateId()), template); 125 //System.out.println("Brotecs::GraphWidget->registerTemplate Length1; "+templates.size()); 126 templates.put(new Integer(template.getTemplateId()), template); 127 //System.out.println("Brotecs::GraphWidget->registerTemplate Length2; "+templates.size()); 126 128 } 127 129 … … 156 158 protected void setWidgetValue(Object o) { 157 159 //System.out.println("Brotecs::GraphWidget->setWidgetValue"); 158 if(o instanceof Vector /*Brotecs:add this*/ && !c urrentTemplate.getIsUseTemplate()/*brotecs:till*/) {160 if(o instanceof Vector /*Brotecs:add this*/ && !chart.getdefaulttemplate()/*brotecs:till*/) { 159 161 try{//Brotecs: add this 160 162 data = (Vector)o; … … 243 245 244 246 chart.resetData(); 245 applyTemplate(data); //Brotecs: block this247 //applyTemplate(data); //Brotecs: block this 246 248 applyData(); 247 249 } … … 253 255 */ 254 256 protected void updateWidget(QuestionDef question) { 255 //System.out.println("Brotecs::GraphWidget->updateWidget"); 256 //currentTemplate = (WHOWeightTemplate)templates.get(new Integer(question.getDataType())); //Brotecs: block this 257 currentTemplate = new WHOWeightTemplate(); //Brotecs: for WHOWeightTemplate 258 //currentTemplate = new CurrentTemplate(); 259 currentTemplate.setIsUseTemplate(true); 257 System.out.println("Brotecs::GraphWidget->updateWidget"); 258 //currentTemplate = (IGraphTemplate)templates.get(new Integer(question.getDataType())); //Brotecs: for WHOWeightTemplate 259 currentTemplate = (IGraphTemplate)templates.get(new Integer(WHOWeightTemplate.WHO_WEIGHT_TEMPLATE_ID)); //Brotecs: for WHOWeightTemplate 260 /*********Brotecs********************* 261 if(currentTemplate!=null){ 262 currentTemplate.setIsUseTemplate(true); 263 chart.defaulttemplate(true); 264 chart.setMaxYScaleFactor(30); 265 } 266 else{ 267 currentTemplate.setIsUseTemplate(false); 268 }**************************************/ 260 269 chart.resetData(); 261 270 applyTemplate(data);
