Empyreus / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Ability to create custom screens that extend from the GUIScreen class #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be really useful to be able to add additional functionality to the 
GUIScreen by being able to extend from it. We would require the following 
changes to make this effective

In Window class
1. onKeyPressed(key) method in Window class has to be made public

In GUIScreen class
1. Change "private final Queue<Action> actionToRunInEventThread" to "protected"
2. Change "private boolean update()" to "protected"
3. Change "private void doEventLoop()" to "protected"

With these changes we can ensure that the custom screen class would be able to 
handle events arising from the window.

Original issue reported on code.google.com by m.vino...@gmail.com on 18 Dec 2012 at 11:17

GoogleCodeExporter commented 9 years ago
These classes weren't really written to be overridden so I'm not sure if only 
these changes are going to be enough. But I've added these changes (and a few 
related ones) to the default branch, so please try it out and let us know if 
you need anything else. As previously mentioned, the GUI system is in need of a 
re-write to make it a lot of flexible than it is now; it was only designed for 
dialogs-like programs, but it seems people want to use it for all kinds of 
stuff.

Original comment by mab...@gmail.com on 2 Jan 2013 at 12:34

GoogleCodeExporter commented 9 years ago
The onKeyPressed() method in the Window class needs to have public access(not 
protected) so the custom GUIScreen class can call it. Also the 
actionToRunInEventThread in the GUIScreen class still has private access. It 
needs to be protected.

Also could you also make the constructor of the MessageBox class protected so 
we can extend that?

Original comment by m.vino...@gmail.com on 4 Jan 2013 at 9:29

GoogleCodeExporter commented 9 years ago
That should be done now, on 2.1.x and default branches

Original comment by mab...@gmail.com on 13 Jan 2013 at 9:36

GoogleCodeExporter commented 9 years ago
I see that modified the onKeyPressed method has been modified to protected from 
private. But we would require it to have public access since the GUIScreen 
class accesses it through the Window class. It used to work earlier because the 
GUIScreen and the Window classes were in the same package. But in case of a 
custom GUIScreen class we would need the method to be public so the method can 
be accessed.

Original comment by m.vino...@gmail.com on 13 Jan 2013 at 10:47

GoogleCodeExporter commented 9 years ago
All right, changing it now...

Original comment by mab...@gmail.com on 20 Jan 2013 at 1:51

GoogleCodeExporter commented 9 years ago
We are planning to include these changes here as part of our release. Would you 
be able to do a release of lanterna with these fixes? Currently we are working 
of a SNAPSHOT version that includes these changes.

Original comment by m.vino...@gmail.com on 27 Mar 2013 at 6:57

GoogleCodeExporter commented 9 years ago
I dont think the changes to the GUIScreen class got merged into the 2.1.x 
branch. So the changes are not present in lanterna 2.1.3.

Original comment by m.vino...@gmail.com on 27 Mar 2013 at 7:47

GoogleCodeExporter commented 9 years ago
Okay, I'll see what I can do...

Original comment by mab...@gmail.com on 28 Mar 2013 at 12:20

GoogleCodeExporter commented 9 years ago
I've pushed 2.1.5 to Sonatype, it should synchronize with Maven central within 
24 hours. Please give it a try.

Original comment by mab...@gmail.com on 28 Mar 2013 at 12:39

GoogleCodeExporter commented 9 years ago
Thanks a lot. That was very helpful.

Original comment by m.vino...@gmail.com on 28 Mar 2013 at 2:14