示例#1
0
 public List<Color> getColors() {
   List<Color> allColors = colors.getColors();
   String searchString = (String) Faces.var("searchString");
   if (searchString == null) return allColors;
   List<Color> result = new ArrayList<Color>();
   for (Object allColor : allColors) {
     Color color = (Color) allColor;
     String colorName = color.getName();
     if (colorName.toUpperCase().indexOf(searchString.toUpperCase()) != -1) result.add(color);
   }
   return result;
 }
示例#2
0
 public List<String> getSuggestedPlants() {
   List<String> suggestedPlants = new ArrayList<String>();
   String typedValue = (String) Faces.var("searchString");
   if (typedValue != null) {
     for (Object myPlant : plants) {
       String plant = (String) myPlant;
       String plantForComparison = plant.toLowerCase();
       String typedValueForComparison = typedValue.toLowerCase();
       if (plantForComparison.startsWith(typedValueForComparison)) suggestedPlants.add(plant);
     }
   } else {
     for (int i = 0; i < plants.size(); i++) {
       if (i % 20 == 0) {
         String plant = plants.get(i);
         suggestedPlants.add(plant);
       }
     }
   }
   return suggestedPlants;
 }
示例#3
0
 private Link getCurrentLink() {
   return Faces.var("link", Link.class);
 }
示例#4
0
 public String removeLink() {
   editedLinks.remove(Faces.var("link", Link.class));
   return "";
 }