Class PlaceManager

java.lang.Object
org.jboss.elemento.router.PlaceManager

public class PlaceManager extends Object
The place manager is the central part of the router. It keeps track of registered places, handles navigation events, and updates the DOM accordingly. The place manager can be customized using builder like methods and has a start() method to show the initial page.

@Route("/home")
public static class HomePage implements Page {

    @Override
    public Iterable<HTMLElement> elements() {
        return Collections.singletonList(div()
                .add(h(1, "Welcome"))
                .add(p().textContent("Hello world!"))
                .element());
    }
}

public static class Application {

    public void entryPoint() {
        body().add(div().id("main"));
        new PlaceManager()
                .root(By.id("main"))
                .register(new Place("/home"), HomePage::new)
                // could also be registered with
                // .register(RoutesImpl.INSTANCE.places())
                .start();
    }
}
See Also: