GUI back-end plug-in: work in progress, testers welcome.

  • A back-end plug-in (i.e. a plug-in which does nothing visible by itself, but provides other plug-ins with additional features).


    It is currently used by my plug-ins only and it is required (just once!) to run some of them. Developers of other plug-ins are welcome to use it too!


    Version 0.5.1


    File rwgui_0_5_1.zip updated with the two images missing in the previous release!


    Implemented:


    *) Modal dialogue box, with title bar and close (X) button.
    *) 'Automatic' horizontal, vertical or tabular layout of collections of GuiElements.
    *) Check/radio boxes
    *) Modal menus, with title bar and scrollable if "too long"
    *) Modal menu to select a player
    *) Modal message box (with optional timed auto-closing)
    *) Modeless informational window
    *) Message box
    *) Title bar with optional close button
    *) 11 small icons for basic interface elements (close button, arrows, check and radio buttons)


    0.5.1 change log:


    *) Fixed a possible null pointer exception with GuiVerticalLayout.getItemId()
    *) Simplified image loading
    *) Added GuiLayout.getChildFromId()


    Download link at the bottom of this post. Version 0.5.1 is backward compatible with version 0.5.0, 0.4.0 and 0.3.0.


    Installation (for everybody!)


    Extract the files in the ZIP placing the whole rwgui folder into the plugins folder of RW (if the plugins folder does not exist, just create one). The resulting hierarchy shall be:


    Code
    ── RisingWorld
    ├── plugins
    │ ├── rwgui
    │ │ ├── assets
    │ │ ├── rwgui.jar

    This is all!


    The plug-in has no command, as it is not intended to be invoked by players, but used by other plug-ins.
    ____________________


    Use by other plug-ins (for plug-in developers)


    Warning: This is very experimental work, code is under active development!


    Concept:
    A plug-in which does nothing by itself and rather provides classes and tools for other plug-ins to display and manage GUI 'containers', freeing other developers from the implementation details of (part of?) the GUI and also potentially providing a consistent user experience to players.


    It is a separate plug-in, which needs to be installed only once in RW and which any other plug-in can use without 'including' it in its own package.


    Context:
    There are limitations and some 'dirty code' to work around the current RW API limitations, but I have seen in practice that it is possible for any plug-in to request a GUI object from this new GUI plug-in and to be notified of user selection.


    According to my experience, it also simplifies noticeably some repetitive tasks in GUI implementation.


    Setup:
    1) The rwgui.jar has to be added to the project of your plug-in and then it has to be somewhere in your hard disk. The details of how to add it depend on the specific IDE you are using, but the steps are exactly the same as for the Rising World own PluginAPI.jar which your plug-in should already know about.


    This is only for the compiler to know about rwgui.jar internals; rwgui.jar itself shall not be included in your final .jar or shipped with it in any way.


    2) The rwgui_<version>.zip shall be unZIPped in the Rising World plugins folder (as described in Installation above). This will be the care of the server owner, though: do not include it in your plug-in!


    Documentation: the RWGui_doc.zip contains the Javadoc of the RWGui class and sub-classes in HTML format. Everything needed to use the GUI back-end is there!


    Samples: The following plug-ins use RWGui. Add your plug-in to the list!
    *) GPS
    *) Planks 'n Beams
    *) UPS
    *) simple Bank
    *) Plug-in Central


    Sample sources: the sampleDlgBox_src.zip file contains the sources of a very minimal, but complete, plug-in exemplifying the use of the GuiDialogueBox class.


    Comments and proposals for improvements and extensions are welcome!


    Source code


    The source code of this plug-i is available on github under the Creative Commons by-sa 3.0 license.

  • Perhaps I made it to look too tough?


    To make things lighter, this how is the current Menu component looks-and-feels like; the requesting plug-in sets the title and adds the items and the back-end GUI plug-in displays it, manages user interaction and notifies the requesting plug-in of the user choice;


    *) items are clickable,
    *) the number of items is unlimited, if they does not fit in a certain height, the list can be scrolled up and down through the arrows, which are enabled an disabled automatically;
    *) the [X] button closes the menu without making any choice.



    (in the screen shot, the max height has been greatly reduced to have a smaller and clearer image)


    Really nobody is interested in helping with development and testing?

  • i like the idea it could keep everything looking as if its all been made by the same users, when it comes to the GUI i have very limited skills but very interested in this

    76561198018554331.png


    :thumbsup: Rising Citys @ ip 74.118.138.151:4265 ServerName (Yahgiggles Rising Citys) :thumbsup:


    If at first your code does not work call it version 0.1 with the odd bug :S

  • so as this project sits right now, i wouldn't mind doing some testing. could you fill me in on what you sort of have planned for methods that other mods can call? really I'm just looking to see how communication is planned back and forth.

  • An update version (0.4.0) is available, which fixed a few bugs, re-factors and (hopefully) streamlines the code and add a few details, like the GuiModalWindow base class and the concept of "display stack" (to chain sequences of windows).


    Details and download in the thread top post.


    The full RWGui sources are now available on github.

  • Getting this NullPointerException just before server crashes, happened three times so far since the update.



    Any ideas? Could be us. But not sure.

  • @Miwarre
    Is it possible to create a listView-Window
    with 2 Buttons 'OK' and 'cancel' ?


    Examples:Pic1 / Pic2

    The examples you quote are tree views, which are rather complex to implement. For a simple (non-hierarchical) list, you may insert in your main window a VerticalLayout to which to add the list items and below it a HorizontalLaytout with two labels representing the buttons


    Button are not currently supported as such by RWGui, but you can make the intended meaning and function clear to the user by using GuiLabel's with an appropriate background colour.

  • result


    setBorderColor und setSize
    it does not work:-(

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!