Usage of GSI-Frame in an application:
The header of GSI-frame uses the following control elements:
- accelerator dropdown box
- language selector box
- date /time label
Additionally a central flashing timer can be used to control the synchronic flashing of all control elements of the GUI synchronically. Since the GSI-Frame also uses the
LanguageTranslator some of those implementations are described twice.
Controlling the control elements:
The following implementations have to be inserted in the application program:
Main program:
Cern-Frame is generated (as before):
ExternalFrame frame = FrameManager.getInstance().getMainFrame(guiText.applicationTitle(), mainPanel);
Then the control elements have to be initialized:
GuiManager.getInstance().initAcceleratorSelector(frame);
GuiManager.getInstance().initGlue(frame);
GuiManager.getInstance().initLanguageSelector(frame, true);
GuiManager.getInstance().initDateTime(frame);
Viewer:
- implements LanguageSelectionListener, AcceleratorSelectionListener
Constructor () :
- Register viewer as listener:
SelectionManager.getInstance().addAcceleratorSelectionListener(this);
GuiManager.getInstance().addLanguageSelectionListener(this);)
- Register controller as listener:
acceleratorZoneSelectorPanel.addAcceleratorZoneSelectorListener(AcceleratorSelectionListener listener);
acceleratorZoneSelectorPanel.getList().addListSelectionListener(ListSelectionListener listener);
initUI():
acceleratorZoneSelectorPanel = new AcceleratorZoneSelectorPanel(true); // Parameter: boolean SupportMultipleSelection
- Implement the languagelistener-method for all control elements of the viewer as follows:
selectedLanguageChanged(String selectedLanguage):
Controller:
- implements AcceleratorZoneSelectorListener, ListSelectionListener
Synchronic flashing (for control elements):
Viewer class:
implements FlashingTimerListener
- has to be added as listener for flashing timer communication (
the viewer has to be registered once, i.e.
when synchronic flashing starts and if the viewer class is not registered at the moment).
- has to be removed as listener from flashing timer communication (
when flashing is finished for all control elements).
- in order to flash synchronously a flag (
Parameter of FlashingTimerListener -method: flashingTimerExpired) is used to set the background colour
(if the flag is set the "first" colour of the two flashing colours of the elements is set, otherwise the second.
--
SigridHeymell - 12 May 2014