Package de.lessvoid.nifty.screen

Examples of de.lessvoid.nifty.screen.Screen$LocalEndNotify


    LwjglInitHelper.renderLoop(nifty, null);
    LwjglInitHelper.destroy();
  }

  private static Screen createIntroScreen(final Nifty nifty) {
    Screen screen = new ScreenBuilder("start") {{
      controller(new DefaultScreenController() {
        @Override
        public void onStartScreen() {
          nifty.gotoScreen("demo");
        }
View Full Code Here


    return screen;
  }

  private static Screen createDemoScreen(final Nifty nifty) {
    final CommonBuilders common = new CommonBuilders();
    Screen screen = new ScreenBuilder("demo") {{
      controller(new ControlsDemoScreenController(
          "menuButtonListBox", "dialogListBox",
          "menuButtonDropDown", "dialogDropDown",
          "menuButtonTextField", "dialogTextField",
          "menuButtonSlider", "dialogSliderAndScrollbar",
View Full Code Here

      removeScreenInternal(id);
    }
  }

  private void removeScreenInternal(final String id) {
    Screen screen = screens.remove(id);
    if (screen == null ||
        screen.getLayerElements() == null ||
        screen.getLayerElements().size() == 0) {
      return;
    }
    for (int i=0; i<screen.getLayerElements().size(); i++) {
      removeElement(screen, screen.getLayerElements().get(i));
    }
  }
View Full Code Here

   * get a specific screen.
   * @param id the id of the screen to retrieve.
   * @return the screen
   */
  public Screen getScreen(final String id) {
    Screen screen = screens.get(id);
    if (screen == null) {
      log.warning("screen [" + id + "] not found");
      return null;
    }

View Full Code Here

      screen.addPopup(popup, defaultFocusElement);
    }
  }

  private Element createPopupFromType(final PopupType popupTypeParam, final String id) {
    Screen screen = getCurrentScreen();
    LayoutPart layerLayout = rootLayerFactory.createRootLayerLayoutPart(this);
    PopupType popupType = new PopupType(popupTypeParam);
    popupType.prepare(this, screen, screen.getRootElement().getElementType());
    Element element = popupType.create(screen.getRootElement(), this, screen, layerLayout);
    element.setId(id);
    fixupSubIds(element, id);
    if (screen.isBound()) {
      element.layoutElements();
      element.bindControls(screen);
    }
    return element;
  }
View Full Code Here

      final TimeProvider timeProvider) {
    String controller = getAttributes().get("controller");
    ScreenController screenController = resolveScreenController(nifty, controller);
   
    String id = getAttributes().get("id");
    Screen screen = new Screen(nifty, id, screenController, timeProvider);
    screen.setDefaultFocusElement(getAttributes().get("defaultFocusElement"));

    String inputMappingClass = getAttributes().get("inputMapping");
    if (inputMappingClass != null) {
      NiftyInputMapping inputMapping = ClassHelper.getInstance(inputMappingClass, NiftyInputMapping.class);
      if (!(screenController instanceof KeyInputHandler)) {
        log.info("class [" + controller + "] tries to use inputMapping [" + inputMappingClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
      } else {
        screen.addKeyboardInputHandler(inputMapping, KeyInputHandler.class.cast(screenController));
      }
    }
    String inputMappingPreClass = getAttributes().get("inputMappingPre");
    if (inputMappingPreClass != null) {
      NiftyInputMapping inputMapping = ClassHelper.getInstance(inputMappingPreClass, NiftyInputMapping.class);
      if (!(screenController instanceof KeyInputHandler)) {
        log.info("class [" + controller + "] tries to use inputMapping [" + inputMappingPreClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
      } else {
        screen.addPreKeyboardInputHandler(inputMapping, KeyInputHandler.class.cast(screenController));
      }
    }

    Element rootElement = nifty.getRootLayerFactory().createRootLayer("root", nifty, screen, timeProvider);
    screen.setRootElement(rootElement);

    StopWatch stopWatch = new StopWatch(timeProvider);
    stopWatch.start();
    for (LayerType layerType : layers) {
      layerType.prepare(nifty, screen, rootElement.getElementType());
    }
    Logger.getLogger(NiftyLoader.class.getName()).info("internal prepare screen (" + id + ") [" + stopWatch.stop() + "]");

    stopWatch.start();
    for (LayerType layerType : layers) {
      LayoutPart layerLayout = nifty.getRootLayerFactory().createRootLayerLayoutPart(nifty);
      screen.addLayerElement(
          layerType.create(
              rootElement,
              nifty,
              screen,
              layerLayout));
    }
    Logger.getLogger(NiftyLoader.class.getName()).info("internal create screen (" + id + ") [" + stopWatch.stop() + "]");

    screen.processAddAndRemoveLayerElements();
    nifty.addScreen(id, screen);
  }
View Full Code Here

  public void setInputMappingPre(final String inputMappingPre) {
    this.inputMappingPre = inputMappingPre;
  }

  public Screen create(final Nifty nifty) {
    Screen screen = createScreen(nifty);

    addRootElement(nifty, screen);
    addDefaultFocusElement(screen);
    addInputMapping(screen, inputMapping);
    addPreInputMapping(screen, inputMappingPre);
View Full Code Here

    nifty.addScreen(id, screen);
    return screen;
  }

  private Screen createScreen(final Nifty nifty) {
    return new Screen(nifty, id, screenController, nifty.getTimeProvider());
  }
View Full Code Here

    layerBuilders.add(layerBuilder);
  }

  public Screen build(final Nifty nifty) {
    NiftyStopwatch.start();
    Screen screen = creator.create(nifty);

    Element screenRootElement = screen.getRootElement();
    for (LayerBuilder layerBuilder : layerBuilders) {
      layerBuilder.build(nifty, screen, screenRootElement);
    }

    NiftyStopwatch.stop("ScreenBuilder.build ()");
View Full Code Here

            for (int i = 0; i < ((JSONArray) creatures).length(); i++) {
                JSONObject creature = ((JSONArray) creatures).getJSONObject(i);
                model.creatures.add("" + creature.getInt("id"));
            }
            nifty.gotoScreen("creature_select");
            Screen screen = nifty.getScreen("creature_select");
            DropDown niftyControl = screen.findNiftyControl("dropDown", DropDown.class);
            niftyControl.clear();
            niftyControl.addAllItems(model.creatures);
        }
    }
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.screen.Screen$LocalEndNotify

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.