Search in sources :

Example 1 with NavigationListener

use of delta.games.lotro.maps.ui.NavigationListener in project lotro-tools by dmorcellet.

the class MainLinkEditor method main.

/**
 * Main method for this test.
 * @param args Not used.
 */
public static void main(String[] args) {
    File rootDir = new File("../lotro-maps-db");
    final MapsManager mapsManager = new MapsManager(rootDir);
    mapsManager.load();
    Filter<Marker> filter = new Filter<Marker>() {

        public boolean accept(Marker item) {
            return false;
        }
    };
    MapBundle bundle = mapsManager.getMapByKey("breeland");
    MapCanvas canvas = new MapCanvas(mapsManager);
    final NavigationManager navigationManager = new NavigationManager(canvas);
    NavigationListener listener = new NavigationListener() {

        public void mapChangeRequest(String key) {
            navigationManager.setMap(mapsManager.getMapByKey(key).getMap());
        }
    };
    navigationManager.setNavigationListener(listener);
    /*LinkCreationInterator interactor=*/
    new LinkCreationInterator(mapsManager, canvas);
    canvas.setFilter(filter);
    String key = bundle.getKey();
    canvas.setMap(key);
    navigationManager.setMap(bundle.getMap());
    JFrame f = new JFrame();
    String title = bundle.getLabel();
    f.setTitle(title);
    f.getContentPane().add(canvas);
    f.pack();
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
Also used : MapsManager(delta.games.lotro.maps.data.MapsManager) NavigationManager(delta.games.lotro.maps.ui.NavigationManager) MapCanvas(delta.games.lotro.maps.ui.MapCanvas) Filter(delta.common.utils.collections.filters.Filter) JFrame(javax.swing.JFrame) NavigationListener(delta.games.lotro.maps.ui.NavigationListener) Marker(delta.games.lotro.maps.data.Marker) MapBundle(delta.games.lotro.maps.data.MapBundle) File(java.io.File)

Aggregations

Filter (delta.common.utils.collections.filters.Filter)1 MapBundle (delta.games.lotro.maps.data.MapBundle)1 MapsManager (delta.games.lotro.maps.data.MapsManager)1 Marker (delta.games.lotro.maps.data.Marker)1 MapCanvas (delta.games.lotro.maps.ui.MapCanvas)1 NavigationListener (delta.games.lotro.maps.ui.NavigationListener)1 NavigationManager (delta.games.lotro.maps.ui.NavigationManager)1 File (java.io.File)1 JFrame (javax.swing.JFrame)1