View Javadoc
1 package com.mlw.fps.controller.stats; 2 3 import java.util.Collection; 4 import java.util.Vector; 5 6 import org.apache.struts.action.ActionForm; 7 import org.apache.struts.action.ActionForward; 8 import org.apache.struts.action.ActionMapping; 9 10 import com.mlw.fps.controller.BaseAction; 11 import com.mlw.fps.model.business.vo.SystemFilters; 12 import com.mlw.fps.view.form.FilterForm; 13 import com.mlw.fps.view.manager.ViewManager; 14 15 /*** 16 * 17 * @author Matthew Wilson 18 * @version $Revision: 1.6 $ 19 */ 20 public class FilterAction extends BaseAction 21 { 22 /*** Creates new PlayerStats 23 */ 24 public FilterAction() 25 { 26 } 27 28 /*** @see com.mlw.fps.controller.BaseAction 29 */ 30 public ActionForward executeAction(ActionMapping mapping, ActionForm form, ViewManager manager) 31 { 32 if( form instanceof FilterForm ) 33 { 34 FilterForm myForm = (FilterForm)form; 35 36 String[] players = myForm.getPlayers(); 37 if(myForm.isPlayerEnabled() && players!=null) 38 { 39 Collection collection = new Vector(); 40 for(int i=0, length=players.length; i<length; i++) 41 { 42 collection.add( players[i] ); 43 } 44 manager.getFilterManager().getSystemFilters().addFilter("players",collection); 45 } 46 else 47 { 48 manager.getFilterManager().getSystemFilters().removeFilter("players"); 49 } 50 51 String[] weapons = myForm.getWeapons(); 52 53 if(myForm.isWeaponEnabled() && weapons!=null ) 54 { 55 Collection collection = new Vector(); 56 for(int i=0, length=weapons.length; i<length; i++) 57 { 58 collection.add( weapons[i] ); 59 } 60 manager.getFilterManager().getSystemFilters().addFilter("weapons",collection); 61 } 62 else 63 { 64 manager.getFilterManager().getSystemFilters().removeFilter("weapons"); 65 } 66 67 String[] maps = myForm.getMaps(); 68 if(myForm.isMapEnabled() && maps!=null ) 69 { 70 Collection collection = new Vector(); 71 for(int i=0, length=maps.length; i<length; i++) 72 { 73 collection.add( maps[i] ); 74 } 75 manager.getFilterManager().getSystemFilters().addFilter("maps",collection); 76 } 77 else 78 { 79 manager.getFilterManager().getSystemFilters().removeFilter("maps"); 80 } 81 82 if( myForm.isDateEnabled() ) 83 { 84 try 85 { 86 String startDate = myForm.getStartDate(); 87 if( startDate!=null && startDate.length() > 0) 88 { 89 manager.getFilterManager().getSystemFilters().addFilter("startDate", SystemFilters.FORMAT.parse(startDate)); 90 } 91 else 92 { 93 manager.getFilterManager().getSystemFilters().removeFilter("startDate"); 94 } 95 96 String endDate = myForm.getEndDate(); 97 if( endDate!=null && endDate.length() > 1 ) 98 { 99 manager.getFilterManager().getSystemFilters().addFilter("endDate", SystemFilters.FORMAT.parse(endDate)); 100 } 101 else 102 { 103 manager.getFilterManager().getSystemFilters().removeFilter("endDate"); 104 } 105 } 106 catch(Exception e) 107 { 108 e.printStackTrace(); 109 } 110 } 111 else 112 { 113 manager.getFilterManager().getSystemFilters().removeFilter("startDate"); 114 manager.getFilterManager().getSystemFilters().removeFilter("endDate"); 115 } 116 117 118 //System.out.println("forward = " + myForm.getForward()); 119 120 if( myForm.getForward() != null && myForm.getForward().length() > 0) 121 { 122 return mapping.findForward(myForm.getForward()); 123 } 124 else 125 { 126 System.out.println("returning \"welcome\"."); 127 return mapping.findForward("welcome"); 128 } 129 } 130 131 return mapping.findForward("default"); 132 } 133 }

This page was automatically generated by Maven