![]() ![]() As users should be able to create arbitrary shapes using the full power of JavaFX, there needs to be a way to tell the system which properties are important for saving. Many of them can be recovered/calculated from the domain object or some defaults. But not every property of a node has to be saved. Instead, it uses a reflective method to serialize the JavaFX scenegraph directly in JSON notation. PersistenceįXDiagram does not have its own diagram model. Domain object providers are registered to the XRootin order to be resolvable. It can store additional information needed to resolve/retrieve the object, such as a database connection or a classpath. Whether this method is reentrant or not depends on the specific implementation.Ī DomainObjectProvider converts between the real domain object and its descriptor. It will open an appropriate transaction execute the given lambda close the transaction and return the result. The DomainObjectDescriptorImpl.withDomainObject method. To allow the use of domain objects that can only be safely read in a transaction, there is to EMF or to database objects, and we need a way to persist arbitrary kinds of domain objects when we store the diagram. This indirection is necessary for two reasons: It is often not a good idea to store hard references e.g. Domain Objectsīoth XNodeand XConnection store a reference to a domain object by means of a DomainObjectDescriptor. A behavior usually registers event listeners and binds to Java properties. They are registered in the doActviate method. The shape can have any number of behaviors. BehaviorĪ Behavior is a piece of user interaction provided by an XShape. CoreExtensions offers methods to navigate to the root or the diagram of a shape. These are usually imported as import static extension and add functionality to JavaFX based classes, e.g. The package de. contains classes with static helper methods. Examples: double String Side ObservableList connections = ObservableMap fixedButtons = boolean isActive For more details have a look at the generated Java code. This will automatically create a getter and setter with the plain Java type as well as a method to access the JavaFX property. FxPropertyįXDiagram defines a number of so called active annotations, which allow to participate in the Xtend to Java transpilation step. It holds an overlay heads up display, the menu or services like the domain object providers. The shape is removed from the scenegraph.The shape is activated ( activate) to react to user actions.The shape is connected to a diagram ( initializeGraphics).The graphical node is created ( createNode).XShape is the superclass of XNode and XConnection. There is usually no need to extend XConnection. The can have XConnectionLabels which are by default layouted tangent to the line and a source and target decoration. XConnections can either be polylines or quadratic/cubic Bézier splines. The class hierarchy will point you to a lot of examples. Diagrams can only be nested when they are contained in nodes (see OpenableDiagramNode).Ĭlients usually implement their own subclasses of XNode for custom graphics and behavior. XDiagram#nodes and XDiagram#connections are life collections: When an element is added/removed, it is automatically added/removed to/from the JavaFX scenegraph. ![]() JavaFX is based on abstract classes, so all for the scenegraph inherit from .Ī XDiagramis a container for XNodes and XConnections. The baseclasses for the nodes of the scenegraph are located in the de.re package. This section describes some basic concepts you should be familiar with when developing with FXDiagram. ![]()
0 Comments
Leave a Reply. |