Restructuring of UI projects
We are currently restructuring the
common-widgets
library.
Goals
- Enable applications to no longer use LSA code/other services code by moving non UI framework dependent code from UI projects into separate projects. This would also enable application services to no longer use UI code.
- Reduce overhead by no longer mixing code of different UI frameworks in projects and classes.
- Provide a base for existing UI libraries written by other departments which also create FCC application.
New project structure
UI project naming guidelines
- Include name of UI framework into artefact names? --> Yes, fx/swing or whatever will be used in the future will be appended.
Projects
common-uilib
Base for all UI projects. May not contain framework-specfic code. Also contains non framework-specific resources like images.
common-uilib-fx
Base for all JavaFX UI projects. Contains all UI related stuff including widgets. This can be generic or general-purpose stuff. Should be structured by content aspects (e.g. bindings, language-dependent-bindings, style helper, common styles).
common-uilib-swing
Base for all Swing UI projects. As Swing code is handled as legacy this library also contains LSA code. There is no 'common-lsa-uilib-swing project.
common-lsa-uilib
Contains UI framework-independent LSA classes dedicated for use in user interfaces.
common-lsa-uilib-fx
Contains JavaFX LSA widgets and utilities.
These projects contain more complex widgets based on the following criteria. Not all have to be met though - it's just a rough guideline
- Simple widgets have just one or a few node classes
- Simple widgets normally don’t add too many dependencies to the library.
- Simple widgets have a high chance to be used in many applications.
- Simple widgets may have an assocuated skin class and maybe a few helper classes but not a complex inner structure.
Examples:
- common-content-widget: Many node classes, associated service to get the contents
- common-schema-widget: Complex inner structure
A SPECIFICWIDGET-fx could be common-gauges-fx or common-chart-fx. This should be used, when the library provides specific node classes of a certain type. There is currently no such library internally.
Refactoring guidelines
- Try not to spread widgets over several projects, if there is only an implementation for one framework.
- Contains JavaFX code and uses LSA --> common-lsa-utils-uilib-fx
- Contains LSA utilities --> common-lsa-utils-lib
- Contains JavaFX code --> common-uilib-fx
- Contains generic UI code -> common-uilib
- Contains non UI framework-related resources (e.g. images) --> common-uilib
- Contains swing code --> common-uilib-swing
- Contains swing code and LSA code --> common-uilib-swing
logger
The logger factory has to be removed from the interface and split into specific classes for swing and fx sharing the common interface
AppLogger
.
accsoft-gui-fx handling (suggestion)
For now we keep this library. We try to add improvements without actually changing accsoft-gui-fx (beside bugfixes). If improvements cannot be performed on top of accsoft-gui-fx, it's also okay to refactor the required classes into our projects, but not more as necessary.
Skripte
Call to action: Adapt your application
Update dependencies
If you use LSA directly in your application
We recommend to depend on
common-lsa-uilib-fx
. An alternative is to depend on
common-lsa-utils-lib
(
fcc-commons git organization) and
common-uilib-fx
. If you get compile errors related to LSA UI code, you probably need
common-lsa-uilib-fx
.
If you don't use LSA
We recommend to depend on
common-uilib-fx
. This is also suitable if your FX-app is divided into an application/application service project structure.
Adapt your non-UI LSA library
If you have used
common-lsa-utils-uilib
in the past, now use
common-lsa-utils-lib
(
fcc-commons git organization).
Logging
Change
private static final AppLogger LOGGER = AppLogger.getFxLogger();
to
private static final AppLogger LOGGER = AppLoggerFactoryFx.getLogger();
Image Constants
Change
final Image copy = ImageLocator.getImage(ImageLocator.IMAGE_COPY);
to
final Image copy = ImageLocator.getImage(ImageLocatorConstants.IMAGE_COPY);
Static imports of common classes
Use find and replace all in your project
# from
# to
import static de.gsi.cs.co.ap.common.dependencies.config.PropertyConfig
import static de.gsi.fcc.commons.common.dependencies.config.PropertyConfig
import static de.gsi.cs.co.ap.common.languagetranslator.bindings.TranslationBindingsUtils
import static de.gsi.fcc.applications.common.uilib.fx.languagetranslator.TranslationBindingsUtils
import static de.gsi.cs.co.ap.common.gui.elements.fx.concurrent.ApplicationTasks
import static de.gsi.fcc.applications.common.uilib.fx.concurrent.ApplicationTasks
import static de.gsi.cs.co.ap.common.languagetranslator.LanguageTranslator
import static de.gsi.fcc.commons.languagetranslator.LanguageTranslator
import static de.gsi.cs.co.ap.common.utils.concurrency.GsiConfigurableThreadFactory
import static de.gsi.fcc.commons.common.utils.concurrency.GsiConfigurableThreadFactory
import static de.gsi.cs.co.ap.common.gui.elements.fx.StyleClassUtils
import static de.gsi.fcc.applications.common.uilib.fx.styles.utils.StyleClassUtils
Refactoring progress
If nothing else is mentioned, repositories are located in the fcc-applications organization. 'Done' means that the refactored master branch is available remotely.
- common-utils
- common-lsa-utils-lib (fcc-commons)
- language-translator-lib
- common-uilib
- common-image-lib
- common-uilib-swing
- cscoap-common-units-ui
- common-lsa-uilib
- common-context-widget-service
- common-lsa-uilib-fx
- common-schema-widget
- common-lsa-uilib-fx
- common-context-widget
- scheduling-app
- bss-control-app
- device-control-app
- parammodi-app
- launcher-app
- fixed-display-launcher-app
- expert-digitizer-app
- expert-storagemodering-app
- masp-app
- ionsource-reactor
- requester-app
Jenkins
New projects added:
- common-uilib-fx
- common-lsa-uilib
- common-lsa-uilib-fx
- common-uilib-swing
- common-lsa-utils-lib (fcc-commons)
Disabled projects:
- common-widgets
- common-appbase
- common-lsa-utils-uilib
Add Jenkins INT tasks for added int branches
Package refactoring
Packages have been refactored for the following projects. The changes have been merged to master.
- common-context-widget
- common-context-widget-service
- common-dependencies
- common-image-lib
- common-lsa-uilib
- common-lsa-uilib-fx
- common-lsa-utils-lib
- common-schema-widget
- common-uilib
- common-uilib-fx
- common-uilib-swing
- common-utils
- common-value-lib
- cscoap-common-units
- cscoap-common-units-ui
- language-translator-lib
Misc
- Make sure int works again based on masters before refactoring
- Adapt reactor
- Adapt mkws-Skript
- Adapt normal JavaFX archetype
- Adapt application service-based archetype
- Adapt create class template (logger factory
- Document using git-filter-repo
- Move and adapt AvailabilityTest from common-image-lib to common-uilib, remove unnecessary images.