1 16 package com.google.gwt.sample.dynatable.client; 17 18 import com.google.gwt.user.client.rpc.IsSerializable; 19 20 import java.util.ArrayList ; 21 import java.util.Iterator ; 22 import java.util.List ; 23 24 28 public class Schedule implements IsSerializable { 29 30 33 private List timeSlots = new ArrayList (); 34 35 public Schedule() { 36 } 37 38 public void addTimeSlot(TimeSlot timeSlot) { 39 timeSlots.add(timeSlot); 40 } 41 42 public String getDescription(boolean[] daysFilter) { 43 String s = null; 44 for (Iterator iter = timeSlots.iterator(); iter.hasNext();) { 45 TimeSlot timeSlot = (TimeSlot) iter.next(); 46 if (daysFilter[timeSlot.getDayOfWeek()]) { 47 if (s == null) { 48 s = timeSlot.getDescription(); 49 } else { 50 s += ", " + timeSlot.getDescription(); 51 } 52 } 53 } 54 55 if (s != null) { 56 return s; 57 } else { 58 return ""; 59 } 60 } 61 62 public String toString() { 63 return getDescription(null); 64 } 65 66 } 67 | Popular Tags |