GuiEvent: add JavaDoc (comments only)

accellbaker
Stephen Gold 6 years ago
parent 34b32bf29b
commit 9d6d31d685
  1. 81
      jme3-niftygui/src/main/java/com/jme3/cinematic/events/GuiEvent.java

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009-2012 jMonkeyEngine * Copyright (c) 2009-2019 jMonkeyEngine
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -42,48 +42,97 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* A CinematicEvent associated with a Nifty screen.
* *
* @author Nehon * @author Nehon
*/ */
public class GuiEvent extends AbstractCinematicEvent { public class GuiEvent extends AbstractCinematicEvent {
/**
* message logger for this class
*/
static final Logger log = Logger.getLogger(GuiEvent.class.getName()); static final Logger log = Logger.getLogger(GuiEvent.class.getName());
/**
* name of the associated Nifty screen(not null)
*/
protected String screen; protected String screen;
/**
* associated Nifty instance (not null)
*/
protected Nifty nifty; protected Nifty nifty;
/**
* No-argument constructor needed by SavableClassUtil. Do not invoke
* directly!
*/
public GuiEvent() { public GuiEvent() {
} }
/**
* Instantiate an event with the default initial duration (10) and mode
* (DontLoop).
*
* @param nifty the Nifty instance (not null, alias created)
* @param screen the name of the Nifty screen (not null)
*/
public GuiEvent(Nifty nifty, String screen) { public GuiEvent(Nifty nifty, String screen) {
this.screen = screen; this.screen = screen;
this.nifty = nifty; this.nifty = nifty;
} }
/**
* Instantiate an event the default mode (DontLoop).
*
* @param nifty the Nifty instance (not null, alias created)
* @param screen the name of the Nifty screen (not null)
* @param initialDuration the initial duration (in seconds, ≥0)
*/
public GuiEvent(Nifty nifty, String screen, float initialDuration) { public GuiEvent(Nifty nifty, String screen, float initialDuration) {
super(initialDuration); super(initialDuration);
this.screen = screen; this.screen = screen;
this.nifty = nifty; this.nifty = nifty;
} }
/**
* Instantiate an event with the default initial duration (10).
*
* @param nifty the Nifty instance (not null, alias created)
* @param screen the name of the Nifty screen (not null)
* @param loopMode the loop mode (not null)
*/
public GuiEvent(Nifty nifty, String screen, LoopMode loopMode) { public GuiEvent(Nifty nifty, String screen, LoopMode loopMode) {
super(loopMode); super(loopMode);
this.screen = screen; this.screen = screen;
this.nifty = nifty; this.nifty = nifty;
} }
/**
* Instantiate an event with the specified initial duration and loop mode.
*
* @param nifty the Nifty instance (not null, alias created)
* @param screen the name of the Nifty screen (not null)
* @param initialDuration the initial duration (in seconds, ≥0)
* @param loopMode the loop mode (not null)
*/
public GuiEvent(Nifty nifty, String screen, float initialDuration, LoopMode loopMode) { public GuiEvent(Nifty nifty, String screen, float initialDuration, LoopMode loopMode) {
super(initialDuration, loopMode); super(initialDuration, loopMode);
this.screen = screen; this.screen = screen;
this.nifty = nifty; this.nifty = nifty;
} }
/**
* Invoked when the event is started.
*/
@Override @Override
public void onPlay() { public void onPlay() {
log.log(Level.FINEST, "screen should be {0}", screen); log.log(Level.FINEST, "screen should be {0}", screen);
nifty.gotoScreen(screen); nifty.gotoScreen(screen);
} }
/**
* Invoked when the event is stopped.
*/
@Override @Override
public void onStop() { public void onStop() {
if (nifty.getCurrentScreen() != null) { if (nifty.getCurrentScreen() != null) {
@ -91,22 +140,46 @@ public class GuiEvent extends AbstractCinematicEvent {
} }
} }
/**
* Invoked when the event is paused.
*/
@Override @Override
public void onPause() { public void onPause() {
} }
/**
* Alter the Nifty instance for this event.
*
* @param nifty the new instance (not null)
*/
public void setNifty(Nifty nifty) { public void setNifty(Nifty nifty) {
this.nifty = nifty; this.nifty = nifty;
} }
/**
* Alter the screen for this event.
*
* @param screen the name of the new screen (not null)
*/
public void setScreen(String screen) { public void setScreen(String screen) {
this.screen = screen; this.screen = screen;
} }
/**
* Invoked once per frame, provided the event is playing.
*
* @param tpf the time interval between frames (in seconds, ≥0)
*/
@Override @Override
public void onUpdate(float tpf) { public void onUpdate(float tpf) {
} }
/**
* Serialize this event, for example when saving to a J3O file.
*
* @param ex exporter (not null)
* @throws IOException from exporter
*/
@Override @Override
public void write(JmeExporter ex) throws IOException { public void write(JmeExporter ex) throws IOException {
super.write(ex); super.write(ex);
@ -114,6 +187,12 @@ public class GuiEvent extends AbstractCinematicEvent {
oc.write(screen, "screen", ""); oc.write(screen, "screen", "");
} }
/**
* De-serialize this event, for example when loading from a J3O file.
*
* @param im importer (not null)
* @throws IOException from importer
*/
@Override @Override
public void read(JmeImporter im) throws IOException { public void read(JmeImporter im) throws IOException {
super.read(im); super.read(im);

Loading…
Cancel
Save