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

    • 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:

      Source Code

      1. ── RisingWorld
      2. ├── plugins
      3. │ ├── rwgui
      4. │ │ ├── assets
      5. │ │ ├── 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.
      Files
      __________
      My plug-ins: Planks 'n Beams, GPS, UPS, Weather control, Plugin Central, RWGui (GUI back-end), Bank (Money back end)

      The post was edited 11 times, last by Miwarre: Updated 0.5.1 file ().

    • 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?
      __________
      My plug-ins: Planks 'n Beams, GPS, UPS, Weather control, Plugin Central, RWGui (GUI back-end), Bank (Money back end)
    • 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.
      __________
      My plug-ins: Planks 'n Beams, GPS, UPS, Weather control, Plugin Central, RWGui (GUI back-end), Bank (Money back end)

      The post was edited 1 time, last by Miwarre: Add github link ().

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

      Display Spoiler

      Fatal error occurred!
      java.lang.NullPointerException
      at com.vistamaresoft.rwgui.GuiVerticalLayout.getItemId(GuiVerticalLayout.java:134)
      at com.vistamaresoft.rwgui.GuiModalWindow.onTextEntry(GuiModalWindow.java:155)
      at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at pluginapi.PluginEventHandler.triggerEvent(SourceFile:169)
      at E.b.a(SourceFile:2195)
      at E.b.messageReceived(SourceFile:147)
      at de.jiw.network.kernel.KernelAdapter.dispatch(KernelAdapter.java:188)
      at de.jiw.network.message.RawPacket.run(RawPacket.java:54)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)


      Any ideas? Could be us. But not sure.
    • Kryssi_79 wrote:

      @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.
      __________
      My plug-ins: Planks 'n Beams, GPS, UPS, Weather control, Plugin Central, RWGui (GUI back-end), Bank (Money back end)
    • Java Source Code

      1. float fBreite = (this.getWidth() / 2)-4;
      2. GuiLabel buttonOK = new GuiLabel("OK", 0, 0, false);
      3. buttonOK.setBorderColor(0.9f, 0.9f, 0.9f, 0.5f);
      4. buttonOK.setSize(fBreite, 60, false);
      5. hLayout.addChild( buttonOK, 1);
      6. GuiLabel btnCancel = new GuiLabel("cancel", 0, 0, false);
      7. btnCancel.setBorderColor(0.9f, 0.9f, 0.9f, 0);
      8. btnCancel.setSize(fBreite, 60, false);
      9. hLayout.addChild( btnCancel, 2);
      Display All
      result


      setBorderColor und setSize
      it does not work:-(
      es wird alles gut :) früher oder später :D meistens später :evil: ... ich wandle Kaffee in Quelltext um

      aktuelles Java Projekt für RW: [Plugin] UserObjectLoader
    • Users Online 1

      1 Guest