@Test (expected = ScreenNotFoundException.class) public void testPushNotExistentScreen () { ScreenManager<IScreen> manager = this.createScreenManager(); manager.push("not-existent-screen"); }
@Override public void push(String name) { if (name == null) { throw new NullPointerException(TAG_NAME_CANNOT_NULL); } if (name.isEmpty()) { throw new IllegalArgumentException(TAG_NAME_CANNOT_EMPTY); } IScreen screen = this.screens.get(name); if (screen == null) { throw new ScreenNotFoundException( "Couldnt found initialized screen '" + name + "', add screen with method addScreen() first."); } screen.onResume(); screen.onResize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.activeScreens.push(screen); Gdx.app.debug(TAG_SCREENS, "push screen: " + name); }
DefaultScreenManager implements ScreenManager<IScreen> { @Override public void push(String name) { if (name == null) { throw new NullPointerException(TAG_NAME_CANNOT_NULL); } if (name.isEmpty()) { throw new IllegalArgumentException(TAG_NAME_CANNOT_EMPTY); } IScreen screen = this.screens.get(name); if (screen == null) { throw new ScreenNotFoundException( "Couldnt found initialized screen '" + name + "', add screen with method addScreen() first."); } screen.onResume(); screen.onResize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.activeScreens.push(screen); Gdx.app.debug(TAG_SCREENS, "push screen: " + name); } }
DefaultScreenManager implements ScreenManager<IScreen> { @Override public void push(String name) { if (name == null) { throw new NullPointerException(TAG_NAME_CANNOT_NULL); } if (name.isEmpty()) { throw new IllegalArgumentException(TAG_NAME_CANNOT_EMPTY); } IScreen screen = this.screens.get(name); if (screen == null) { throw new ScreenNotFoundException( "Couldnt found initialized screen '" + name + "', add screen with method addScreen() first."); } screen.onResume(); screen.onResize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.activeScreens.push(screen); Gdx.app.debug(TAG_SCREENS, "push screen: " + name); } DefaultScreenManager(); }
DefaultScreenManager implements ScreenManager<IScreen> { @Override public void push(String name) { if (name == null) { throw new NullPointerException(TAG_NAME_CANNOT_NULL); } if (name.isEmpty()) { throw new IllegalArgumentException(TAG_NAME_CANNOT_EMPTY); } IScreen screen = this.screens.get(name); if (screen == null) { throw new ScreenNotFoundException( "Couldnt found initialized screen '" + name + "', add screen with method addScreen() first."); } screen.onResume(); screen.onResize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.activeScreens.push(screen); Gdx.app.debug(TAG_SCREENS, "push screen: " + name); } DefaultScreenManager(); @Override void addScreen(String name, IScreen screen); @Override void removeScreen(String name); @Override void push(String name); @Override void leaveAllAndEnter(String name); @Override IScreen pop(); @Override IScreen getScreenByName(String name); @Override ObjectArrayList<IScreen> listScreens(); @Override ObjectArrayList<IScreen> listActiveScreens(); @Override void resize(int width, int height); @Override void update(); @Override void draw(); @Override void dispose(); }
DefaultScreenManager implements ScreenManager<IScreen> { @Override public void push(String name) { if (name == null) { throw new NullPointerException(TAG_NAME_CANNOT_NULL); } if (name.isEmpty()) { throw new IllegalArgumentException(TAG_NAME_CANNOT_EMPTY); } IScreen screen = this.screens.get(name); if (screen == null) { throw new ScreenNotFoundException( "Couldnt found initialized screen '" + name + "', add screen with method addScreen() first."); } screen.onResume(); screen.onResize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.activeScreens.push(screen); Gdx.app.debug(TAG_SCREENS, "push screen: " + name); } DefaultScreenManager(); @Override void addScreen(String name, IScreen screen); @Override void removeScreen(String name); @Override void push(String name); @Override void leaveAllAndEnter(String name); @Override IScreen pop(); @Override IScreen getScreenByName(String name); @Override ObjectArrayList<IScreen> listScreens(); @Override ObjectArrayList<IScreen> listActiveScreens(); @Override void resize(int width, int height); @Override void update(); @Override void draw(); @Override void dispose();  }