content: /*
   * Copyright 2009-2014 PrimeTek.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package com.github.adminfaces.showcase.bean;
  
  import org.omnifaces.cdi.ViewScoped;
  import org.primefaces.event.SelectEvent;
  import org.primefaces.event.UnselectEvent;
  
  import javax.annotation.PostConstruct;
  import javax.faces.application.FacesMessage;
  import javax.faces.context.FacesContext;
  import javax.inject.Named;
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.List;
  
  @Named
  @ViewScoped
  public class OrderListMB implements Serializable {
      
  
      private List<String> cities;
      private List<String> themes;
      
      @PostConstruct
      public void init() {
          //Cities
          cities = new ArrayList<String>();
          cities.add("San Francisco");
          cities.add("London");
          cities.add("Paris");
          cities.add("Istanbul");
          cities.add("Berlin");
          cities.add("Barcelona");
          cities.add("Rome");
               
          //Themes
          themes = Arrays.asList("Afterdark","Afternoon","Afterwork","Omega","Bootstrap", "Blitzer");
      }
  
  
      public List<String> getCities() {
          return cities;
      }
  
      public void setCities(List<String> cities) {
          this.cities = cities;
      }
  
      public List<String> getThemes() {
          return themes;
      }
  
      public void setThemes(List<String> themes) {
          this.themes = themes;
      }    
      
      public void onSelect(SelectEvent event) {
          FacesContext context = FacesContext.getCurrentInstance();
          context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Item Selected", event.getObject().toString()));
      }
      
      public void onUnselect(UnselectEvent event) {
          FacesContext context = FacesContext.getCurrentInstance();
          context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Item Unselected", event.getObject().toString()));
      }
      
      public void onReorder() {
          FacesContext context = FacesContext.getCurrentInstance();
          context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "List Reordered", null));
      }
  }
  