Sets Screen as a Reciever, so it can take draw events from components and transmit them to the panel.
package com.valkryst.VTerminal.component;
import com.valkryst.VRadio.Radio;
+import com.valkryst.VRadio.Receiver;
import com.valkryst.VTerminal.AsciiCharacter;
import com.valkryst.VTerminal.AsciiString;
import com.valkryst.VTerminal.Panel;
@@ -24,7 +25,7 @@ import java.util.*;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@ToString
-public class Screen extends Component {
+public class Screen extends Component implements Receiver<String> {
/** The panel on which the screen is displayed. */
@Getter @Setter private Panel parentPanel;
@@ -58,6 +59,13 @@ public class Screen extends Component {
}
}
+ @Override
+ public void receive(final String event, final String data) {
+ if (event.equals("DRAW")) {
+ transmitDraw();
+ }
+ }
+
private void parseJSON(final @NonNull JSONObject jsonObject) {
final JSONArray components = (JSONArray) jsonObject.get("components");
