GUI-Api goes FirstSpirit - Dialog Boxes inside the Client

MichaelaReydt
Community Manager
Community Manager
3 3 1,283

A common feature request amongst developers was to create interactive dialogs within the FirstSpirit JavaClient.

This request came true with the FirstSpirit 4.2 R4 release.

Code-Example for the Dialog Boxes stated below:

import de.espirit.firstspirit.agency.OperationAgent;

import de.espirit.firstspirit.ui.operations.RequestOperation;

// get operation agent

operationAgent = context.requireSpecialist(OperationAgent.TYPE);

// get request operation

requestOperation = operationAgent.getOperation(RequestOperation.TYPE);

// configure request operation

no = requestOperation.addAnswer("Oh, you better don't ask!");

waiting = requestOperation.addAnswer("Maybe, maybe not. Who knows?");

yes = requestOperation.addYes();

requestOperation.setInitialAnswer(waiting);

requestOperation.setKind(RequestOperation.Kind.ERROR);

requestOperation.setTitle("Happy Day");

// perform request to open dialog

result = requestOperation.perform("Are you okay?");

if (result == yes) {

    requestOperation = operationAgent.getOperation(RequestOperation.TYPE);

    requestOperation.perform("Oh, really? Then have a nice day ! 🐵 ");

}

Dialog Boxes for the given Code-Example

Start-Box:

box1.png

Result from clicking "Yes":

box2.png

API-Links:

3 Comments
Hachmann
I'm new here

Dieser Beitrag verwendet leider mittlerweile schon wieder deprecated API, oder? Zumindest in der von uns verwendeten Version 4.2.468.50982 funktioniert das leider schon wieder anders.

Schade.

vg

Björn

witt
I'm new here

Welche Teile sollen den deprecreated sein?

Hachmann
I'm new here

Ah, ich habe unbemerkt eine andere Klasse importiert:

    de.espirit.firstspirit.ui.gadgets.aspects.operations.RequestOperation;

Diese ist deprecated. Mit der korrekterweise im Skript verwendeten Klasse:

     de.espirit.firstspirit.ui.operations.RequestOperation;


geht alles klar.

Danke für den Hinweis!

Version history
Last update:
‎05-31-2011 09:36 AM
Updated by: