Package org.minifx.workbench.spring
Class ElementsDefinitionConstructor
- java.lang.Object
-
- org.minifx.workbench.spring.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
perspectives()
(which contain view definitions) and footer definitions (seefooters()
). 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 perspectivePerspectives.DEFAULT_PERSPECTIVE
at the positionPerspectives.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:
- If annotated by
Name
, the value from there is used. - If possible, a name from a name method of the bean is used (see
Names.nameFromNameMethod(Object)
. - The bean name from the spring context
- If none of the above is found, the simple class name of the view is used.
- If annotated by
- Order: if an
Order
annotation is specified for a view (or a perspective) then it is taken into account.
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DisplayProperties
displayPropertiesFrom(java.lang.Object view, Purpose purpose)
java.util.Set<FooterDefinition>
footers()
Returns a footer definition for each footer found in the repositoryjava.util.Set<PerspectiveDefinition>
perspectives()
Returns a perspective definition for each perspective used by at least one of the views found in the repository.java.util.Set<ToolbarItemDefinition>
toolbarItems()
-
-
-
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.- Parameters:
elementsRepository
- the repository to usebeanInformationExtractor
- the instance who knows about the information of the beansfxNodeFactory
- the factory to create java fx nodes- Throws:
java.lang.NullPointerException
- if the given repository isnull
-
-
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.- Returns:
- 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- Returns:
- all footer definitions
-
toolbarItems
public java.util.Set<ToolbarItemDefinition> toolbarItems()
-
displayPropertiesFrom
public DisplayProperties displayPropertiesFrom(java.lang.Object view, Purpose purpose)
-
-