Exemple #1
0
 MenuItem kiesMenuItem() {
   System.out.println();
   for (MenuItem m : MenuItem.values()) {
     System.out.println(m.ordinal() + "\t" + m.getOmschr());
   }
   System.out.println();
   int maxNr = MenuItem.values().length - 1;
   int nr = readInt("maak een keuze uit 0 t/m " + maxNr);
   while (nr < 0 || nr > maxNr) {
     nr = readInt("maak een keuze uit 0 t/m " + maxNr);
   }
   input.nextLine();
   return MenuItem.values()[nr];
 }
 public GenericRepository<Order> createOrderRepository() {
   int numberOfOrders = random.nextInt(3) + 1;
   OrderRepositoryImpl orderRepository = new OrderRepositoryImpl();
   Map<Integer, Order> orderMap = new HashMap<>();
   int initialId = sequentialId;
   int maxId = sequentialId + numberOfOrders;
   for (int i = initialId; i < maxId; i++) {
     int numberOfMeals = random.nextInt(3) + 1;
     MenuItem[] meals = new MenuItem[numberOfMeals];
     for (int j = 0; j < numberOfMeals; j++) {
       int mealNumberInMenu = random.nextInt(MenuItem.values().length);
       meals[j] = MenuItem.values()[mealNumberInMenu];
     }
     orderMap.put(i, produceOrder(meals));
   }
   orderRepository.setOrderResource(orderMap);
   return orderRepository;
 }
  @Inject
  public HeaderView(Binder uiBinder, NavigationListStyle listResources, PlaceManager placeManager) {
    this.placeManager = placeManager;

    CellList<MenuItem> placeList = new CellList<MenuItem>(new EnumCell<MenuItem>(), listResources);
    menuBar = new ValuePicker<MenuItem>(placeList);

    initWidget(uiBinder.createAndBindUi(this));

    menuBar.setAcceptableValues(Arrays.asList(MenuItem.values()));
    menuBar.setValue(MenuItem.MANUFACTURER);

    menuBar.setVisible(false);
    userOptions.setVisible(false);
  }