1 18 19 package org.objectweb.jac.aspects.gui.web; 20 21 import java.io.PrintWriter ; 22 import java.util.List ; 23 import java.util.Vector ; 24 import org.objectweb.jac.core.NameRepository; 25 26 29 public class CollectionSelector extends AbstractView 30 implements JacRequestReader 31 { 32 Vector selection = new Vector (); 33 36 public CollectionSelector(String name) { 37 this.label = name; 38 } 39 40 NameRepository nameRepository = (NameRepository)NameRepository.get(); 41 42 45 public void genHTML(PrintWriter out, Object object) { 46 out.print("<input type=\"checkbox\" name=\""+label+"\" "+ 47 "value=\""+nameRepository.getName(object)+"\""); 48 printAttributes(out); 49 out.println(">"); 50 } 51 52 public void readValue(JacRequest request) { 53 selection.clear(); 54 String [] names = (String [])request.getParameters(label); 55 if (names!=null) { 56 for (int i=0; i<names.length; i++) { 57 selection.add(nameRepository.getObject(names[i])); 58 } 59 } 60 } 61 62 public List getSelection() { 63 return selection; 64 } 65 } 66 67 | Popular Tags |