Package limelight.model.api

Examples of limelight.model.api.Player


  @Test
  public void playerCanAddEvents() throws Exception
  {
    final Document doc = Xml.stringToDoc("<player class='SamplePlayer'><onMouseClicked>sampleAction</onMouseClicked></player>");
    final Player player = new JavaPlayer("foo", "/testProduction/aScene/players/foo.xml", samplePlayerClass, doc.getDocumentElement(), "limelight.ui.events.panel.");

    Object playerObj = player.cast(prop);

    assertEquals("SamplePlayer", playerObj.getClass().getName());
    assertEquals(1, prop.getEventHandler().getActions(MouseClickedEvent.class).size());
    new MouseClickedEvent(0, null, 1).dispatch(prop);
    assertEquals(1, samplePlayerClass.getField("invocations").get(lastSamplePlayer()));
View Full Code Here


  @Test
  public void onCastEvent() throws Exception
  {
    final Document doc = Xml.stringToDoc("<player class='SamplePlayer'><onCast>sampleActionWithEvent</onCast></player>");
    final Player player = new JavaPlayer("foo", "/testProduction/aScene/players/foo.xml", samplePlayerClass, doc.getDocumentElement(), "limelight.ui.events.panel.");

    player.cast(prop);

    assertEquals(0, prop.getEventHandler().getActions(CastEvent.class).size());
    assertEquals(1, samplePlayerClass.getField("invocations").get(lastSamplePlayer()));
    assertEquals(CastEvent.class, samplePlayerClass.getField("event").get(lastSamplePlayer()).getClass());
  }
View Full Code Here

  @Test
  public void applyOptions() throws Exception
  {
    final Thing thing = new Thing();
    prop.getBackstage().put("thing", thing);
    final Player player = new JavaPlayer("thing", "path", null, null, null);

    Map<String, Object> result = player.applyOptions(prop, Opts.with("value", 1234));
    assertEquals(0, result.size());
    assertEquals(1234, thing.value);
  }
View Full Code Here

  public void cachesKnownPlayers() throws Exception
  {
    JavaProductionTest.writeSamplePlayerTo(fs.outputStream("/testProduction/classes/SamplePlayer.class"));
    fs.createTextFile("/testProduction/aScene/players/foo.xml", "<player class='SamplePlayer'/>");

    final Player player1 = recruiter.recruitPlayer("foo", "/testProduction/aScene/players");
    final Player player2 = recruiter.recruitPlayer("foo", "/testProduction/aScene/players");

    assertSame(player1, player2);
  }
View Full Code Here

    builtinPlayerRecruiter = new JavaPlayerRecruiter(ClassLoader.getSystemClassLoader());
  }

  public Player castRole(PropPanel panel, String playerName, PlayerRecruiter playerRecruiter)
  {
    Player result;

    final Scene scene = panel.getRoot();
    final String scenePlayersPath = Context.fs().pathTo(scene.getPath(), "players");
    result = castFrom(panel, playerName, playerRecruiter, scenePlayersPath);
View Full Code Here

  private Player castFrom(PropPanel panel, String playerName, PlayerRecruiter playerRecruiter, String playersPath)
  {
    String normalizedName = StringUtil.spearCase(playerName);
    if(playerRecruiter.canRecruit(normalizedName, playersPath))
    {
      final Player player = playerRecruiter.recruitPlayer(normalizedName, playersPath);
      player.cast(panel);
      panel.addPlayer(player);
      return player;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of limelight.model.api.Player

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.