Class ElementsDefinitionConstructor

  • public class ElementsDefinitionConstructor
    extends java.lang.Object
    Contains all the relevant logic to bring together all the information which is required to instantiate the workbench elements later. In particular, this is:
    • The relation between views and perspectives (and the view position inside the perspectives)
    • The names of views, perspectives and footers
    • Icons of views perspectives and footers
    As a final result, this class constructs perspective definitions (see perspectives() (which contain view definitions) and footer definitions (see footers()). All of these can be used to instantiate the perspectives (and views) and footers.

    This class uses a WorkbenchElementsRepository to get the collected components as well as to access the factory methods and annotations of the collected elements.

    For deriving information, usually annotations are used. Those annotations are searched in the order as described in BeanInformationRepository.from(Object). Based on this, the following strategies are applied in particular cases:

    • Views: Each bean for which a View annotation is found, is considered as view in MiniFx. The view annotation describes the perspective in which the view is displayed and the position within the view. Both values are optional. If omitted, the view is displayed in the perspective Perspectives.DEFAULT_PERSPECTIVE at the position Perspectives.DEFAULT_POSITION.
    • Icons: They are derived from the Icon annotation (both for views and perspectives). If none is specified, then perspectives will get a default icon and views will have no icon.
    • Names: Names for views are derived in the following order:
      1. If annotated by Name, the value from there is used.
      2. If possible, a name from a name method of the bean is used (see Names.nameFromNameMethod(Object).
      3. The bean name from the spring context
      4. If none of the above is found, the simple class name of the view is used.
    • Order: if an Order annotation is specified for a view (or a perspective) then it is taken into account.
    • Constructor Detail

      • ElementsDefinitionConstructor

        public ElementsDefinitionConstructor​(WorkbenchElementsRepository elementsRepository,
                                             BeanInformationExtractor beanInformationExtractor,
                                             FxNodeFactory fxNodeFactory)
        Constructor which requires an elements repository, which will be used to look up the collected elements as well as annotations on them and factory methods.
        elementsRepository - the repository to use
        beanInformationExtractor - the instance who knows about the information of the beans
        fxNodeFactory - the factory to create java fx nodes
        java.lang.NullPointerException - if the given repository is null
    • Method Detail

      • perspectives

        public java.util.Set<PerspectiveDefinition> perspectives()
        Returns a perspective definition for each perspective used by at least one of the views found in the repository.
        all perspective definitions as derived from the views in the repository
      • footers

        public java.util.Set<FooterDefinition> footers()
        Returns a footer definition for each footer found in the repository
        all footer definitions