king
I'm new here

GUI-Handling in FirstSpirit module service/project app. configuration

Hi FirstSpirit Community,

is there a possibility to implement opening an individual modal Swing dialog within the FirstSpirit service or project component configuration?

Maybe, the FirstSpirit module framework currently does not allow it?!?

AdminClient_services_configuration.jpg

The target should be:

- implementing a FirstSpirit service or project component in a FirstSpirit module that could be started directly in the AdminClient (not called via a BeanShell or executable-Class script in the JavaClient)

- currently, just FirstSpirit service components could be started within the AdminClient

- is there a possibility to open a new Swing GUI dialog on the AdminClient-side to configure the start mechanism and maybe download the generated result of the service (like it is done when exporting a project)?

0 Kudos
11 Replies
gockel
Crownpeak employee

As described in chapter 3.9.1.3 of the documentation FirstSpirit Manual for Developers it is possible to define a configuration class in the module.xml of your service.

<service>

    <name>MyService</name>

    <description>A Service example implemenation</description>

    <class>de.espirit.firstspirit.opt.examples.service.MyServiceImpl</class>

    <configurable>de.espirit.firstspirit.opt.examples.service.MyServiceConfigPanel</configurable>

    <resources>

        <resource name="myservicelib">lib/my-service-@VERSION@.jar</resource>

        <resource>my-service.conf</resource>

    </resources>

</service>

The class MyServiceConfigPanel implements the Configuration interface. You can implement your individual swing components in the the method #getGui.

You can find the complete MyService-Example-Source in the MODDEV4x_modexamples.zip referenced here.

0 Kudos

Hi Sebastian,

of course - that's clear. 😉

But what we wanna implement is not our own config panel - it's a special GUI when pressing the button "Dienst starten".

We are quite sure, that's not possible up to now - is it?

0 Kudos
gockel
Crownpeak employee

But what we wanna implement is not our own config panel - it's a special GUI when pressing the button "Dienst starten".

We are quite sure, that's not possible up to now - is it?

Correct, that isn't possible.

0 Kudos

is there a possibility to open a new Swing GUI dialog on the  AdminClient-side to configure the start mechanism and maybe download the  generated result of the service

Perhaps you could describe your use case with some more details? I do not understand why the GUI must be opened on "service start" and what the download thing is about.

Peter
0 Kudos

Perhaps you could describe your use case with some more details? I do not understand why the GUI must be opened on "service start" and what the download thing is about.

yes, of course:

We want to implement a FirstSpirit module functionality, that could be started just within the FirstSpirit AdminClient (neither within a scheduling configuration nor in the JavaClient using a BeanShell/Executable-Class wrapper). But it should provide its own individual GUI, e.g.:

- to enable the possibility to activate a download functionality (this might be useful when data is written/exported on server-side)

- to individually configure the  "start"-process of the implementation or to provide a progress-bar when it's a long-running task.

Is that possible?

Up to now, there seems just a way to realize that using a JavaClient BeanShell/ExecutableClass-Wrapper that opens a Swing-Dialog and provides the above described functionality. Currently, the FirstSpirit module framework does not support opening GUIs when pressing other buttons than "configure" / "konfigurieren".

Or is there a way to do that?

0 Kudos

I guess the reason for you to insist on the AdminClient is because the functionality is targeted to a special user group?

You could either use the provided connection of the ServerEnvironment to achieve your target - keep in mind that the "start" of your "process" mustn't be the start of the FirstSpirit service but could just be a function of the (running) service.

Another way to achieve your goal is to implement a WebApp - you could install it to the preview application of a "fake project", which is only accessible by your desired user group. Then you can make some fancy html interface Smiley Wink

Peter

Hi Peter,

thanx for the provided solutions.

To follow the first flavor, might it be possible to provide some pseudo-code to get a better understanding how you would realize opening a separate GUI via the connection of the "ServerEnvironment" interface.

0 Kudos

Just pseudo code Smiley Wink

import de.espirit.firstspirit.module.Configuration;

import de.espirit.firstspirit.module.ServerEnvironment;

import java.awt.Frame;

import javax.swing.JComponent;

public class ExampleConfiguration<E extends ServerEnvironment> implements Configuration<E> {


    private E _environment;


    public boolean hasGui() {

        return true;

    }

    public JComponent getGui(final Frame masterFrame) {

        // create a dialog, the "business logic" utilzes the provided connection to communicate with services for

        // downloading functions etc.

        return new MyFancyDialog(masterFrame, _environment.getConnection());

    }

    public void init(final String moduleName, final String componentName, final E environment) {

        _environment = environment;

    }

    public E getEnvironment() {

        return _environment;

    }

    // more code..

}

Peter
0 Kudos

Hi Peter,

the above Swing modal Dialog "MyFancyDialog" is embedded within the "ModuleConfigurationDialog", right?

If that would be the case, might it be possible to react on the "Ok"-button individually? Because, we found out, that the FirstSpirit framework prevents that by using:

//pseudocode

if(source.equals(okaybutton)) {

   configuration.store();

   setVisible(false);

}

Or do I misunderstand something?

0 Kudos