Exemplo n.º 1
0
  @NiftyEventSubscriber(id = "timeControl")
  public void setTime(final String id, final DropDownSelectionChangedEvent event) {
    String time = (String) event.getSelection();
    SimpleDateFormat dateformat = new SimpleDateFormat("HH");
    int hour;
    if ("Now".equals(time)) {
      hour = Integer.parseInt(dateformat.format(new Date()));

    } else {
      hour = Integer.parseInt(time.split(":")[0]);
    }
    System.out.println("Set time of flight:" + hour);
    dayLightWeatherManager.setHour(hour);
  }
Exemplo n.º 2
0
  @NiftyEventSubscriber(id = "html-select")
  public void onHtmlSelectChanged(
      final String id, final DropDownSelectionChangedEvent<String> event) {
    try {
      generator.generate(
          readHTMLFile(event.getSelection()), screen, screen.findElementByName("parent"));

      // for debugging purpose we could output the screen as a text structure
      //      System.out.println(screen.debugOutput());
    } catch (IOException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }