Tune samples and update ref docs

- Fix cplayer play logic depending if we pressed
  eject or play.
- Updates to ref docs.
This commit is contained in:
Janne Valkealahti
2015-04-09 12:03:36 +01:00
parent b505016455
commit f776a0acc3
5 changed files with 108 additions and 2 deletions

View File

@@ -196,6 +196,7 @@ public class Application {
@Override
public void execute(StateContext<States, Events> context) {
if (context.getTransition() != null
&& context.getEvent() == Events.PLAY
&& context.getTransition().getTarget().getId() == States.CLOSED
&& context.getExtendedState().getVariables().get(Variables.CD) != null) {
context.getStateMachine().sendEvent(Events.PLAY);

View File

@@ -91,7 +91,7 @@ public class CdPlayer {
}
//tag::snippetB[]
@StatesOnTransition(target = States.CLOSED)
@StatesOnTransition(target = {States.CLOSED, States.IDLE})
public void closed(ExtendedState extendedState) {
Object cd = extendedState.getVariables().get(Variables.CD);
if (cd != null) {