Class FWClientContext
java.lang.Object
net.simplace.core.FWClientContext
Access of the core (simulation, services) to the client that runs it: the layout
settings and the interaction with the user. The core never opens windows itself; it asks the current context.
This class is the headless context used by console, REST service and wrappers: there is no user, no layout and no
dialog; messages are logged and every question is answered with its default. A graphical client registers its
own subclass with set(FWClientContext) at start-up.
- Author:
- Andreas Enders
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAsks the user for a text, e.g.String[]Lets the user choose a pair of entries from two lists, e.g.intchooseOption(String aTitle, String aPreview, String[] aOptions, int aDefaultIndex) Lets the user choose one of several options.booleandoesScenarioNameExist(String aSystemID, String aName) static FWClientContextget()booleanstatic voidset(FWClientContext aContext) Registers the context of a client.voidShows an information to the user; headless it is logged.voidshowWarning(String aMessage) Shows a warning to the user; headless it is logged.
-
Constructor Details
-
FWClientContext
public FWClientContext()
-
-
Method Details
-
get
- Returns:
- the context in use, never
null
-
set
Registers the context of a client.- Parameters:
aContext- the context;nullrestores the headless context
-
getLocalePrefix
- Returns:
- locale prefix of the client layout (e.g.
de.isdss.LAPClient), ornullwithout layout
-
isDevelopmentMode
public boolean isDevelopmentMode()- Returns:
trueif the client runs in development mode (missing locale entries show their key)
-
getDefaultSystemSettings
-
doesScenarioNameExist
-
showInfo
Shows an information to the user; headless it is logged.- Parameters:
aMessage- the message (may contain HTML)
-
showWarning
Shows a warning to the user; headless it is logged.- Parameters:
aMessage- the message
-
chooseEntryPair
public String[] chooseEntryPair(String aTitle, String aMessage, List<String> aFirstList, List<String> aSecondList) Lets the user choose a pair of entries from two lists, e.g. a key of a resource.- Parameters:
aTitle- title of the questionaMessage- explanationaFirstList- entries of the first listaSecondList- entries of the second list- Returns:
- the chosen entries (first, second), or
nullif nothing was chosen; headless alwaysnull
-
askText
Asks the user for a text, e.g. a user name or a password.- Parameters:
aTitle- title of the questionaMessage- explanationaDefault- preset textaHidden-trueto hide the input (password)- Returns:
- the entered text, or
nullif the question is cancelled; headless alwaysnull
-
chooseOption
Lets the user choose one of several options.- Parameters:
aTitle- title of the questionaPreview- text shown above the choice, e.g. the first lines of a file; may benullaOptions- the optionsaDefaultIndex- index of the preselected option- Returns:
- index of the chosen option; the default index if the question is cancelled and headless
-