Class TopologyView
- java.lang.Object
-
- org.neotropic.kuwaiba.core.apis.integration.views.AbstractView<com.vaadin.flow.component.Component>
-
- org.neotropic.kuwaiba.modules.optional.topoman.TopologyView
-
public class TopologyView extends AbstractView<com.vaadin.flow.component.Component>
Custom view implementation for Topology view module with a mxgraph component as canvas.- Author:
- Orlando Paz <orlando.paz@kuwaiba.org>
-
-
Field Summary
Fields Modifier and Type Field Description static String
FREE_SHAPE
Constant to represent the free shapes that can be added to some viewsstatic String
ICON
Constant to represent the free shapes that can be added to some viewsstatic String
SAVED_VIEW_VERSION
The version of the format of the XML document used to store the view in the database.static String
URL_IMG_CLOUD
-
Fields inherited from class org.neotropic.kuwaiba.core.apis.integration.views.AbstractView
properties, viewMap
-
-
Constructor Summary
Constructors Constructor Description TopologyView(MetadataEntityManager mem, ApplicationEntityManager aem, BusinessEntityManager bem, TranslationService ts, ResourceFactory resourceFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractViewEdge
addEdge(BusinessObjectLight businessObject, BusinessObjectLight sourceBusinessObject, BusinessObjectLight targetBusinessObject, Properties properties)
Adds an edge to views that are not generated automatically.AbstractViewNode
addNode(BusinessObjectLight businessObject, Properties properties)
Adds a node to views that are not generated automatically.void
buildFromSavedView(byte[] structure)
Builds the view.void
clean()
Cleans the view so some other thing can be painted on the canvas.void
edgeClickListener(ViewEventListener listener)
Adds a listener to the edge click events.byte[]
getAsImage()
Exports the view to a PNG image.com.vaadin.flow.component.Component
getAsUiElement()
Gets an embeddable visual component that can be rendered in a dashboard.It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.byte[]
getAsXml()
Exports the view to XML.MxGraphCanvas<BusinessObjectLight,BusinessObjectLight>
getMxgraphCanvas()
void
nodeClickListener(ViewEventListener listener)
Adds a listener to the node click events.void
removeEdge(BusinessObjectLight businessObject)
remove a edge from the viewMapvoid
removeNode(BusinessObjectLight businessObject)
remove a node from the viewMapvoid
setMxgraphCanvas(MxGraphCanvas<BusinessObjectLight,BusinessObjectLight> mxgraphCanvas)
void
syncViewMap()
The view map is created originally by calling the#buildWithSavedView(byte[])
method, but it can change due to user interactions, so it's necessary to update it in order to export it in other formats.-
Methods inherited from class org.neotropic.kuwaiba.core.apis.integration.views.AbstractView
getAsViewMap, getProperties
-
-
-
-
Field Detail
-
SAVED_VIEW_VERSION
public static final String SAVED_VIEW_VERSION
The version of the format of the XML document used to store the view in the database.- See Also:
- Constant Field Values
-
FREE_SHAPE
public static final String FREE_SHAPE
Constant to represent the free shapes that can be added to some views- See Also:
- Constant Field Values
-
ICON
public static final String ICON
Constant to represent the free shapes that can be added to some views- See Also:
- Constant Field Values
-
URL_IMG_CLOUD
public static final String URL_IMG_CLOUD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TopologyView
public TopologyView(MetadataEntityManager mem, ApplicationEntityManager aem, BusinessEntityManager bem, TranslationService ts, ResourceFactory resourceFactory)
-
-
Method Detail
-
getMxgraphCanvas
public MxGraphCanvas<BusinessObjectLight,BusinessObjectLight> getMxgraphCanvas()
-
setMxgraphCanvas
public void setMxgraphCanvas(MxGraphCanvas<BusinessObjectLight,BusinessObjectLight> mxgraphCanvas)
-
getAsXml
public byte[] getAsXml()
Description copied from class:AbstractView
Exports the view to XML. It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.- Specified by:
getAsXml
in classAbstractView<com.vaadin.flow.component.Component>
- Returns:
- A byte array with an XML document representing the view. The format of the document must follow the Standard Kuwaiba View Text Format (SKTF)
-
getAsImage
public byte[] getAsImage()
Description copied from class:AbstractView
Exports the view to a PNG image. It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.- Specified by:
getAsImage
in classAbstractView<com.vaadin.flow.component.Component>
- Returns:
- A byte array with a PNG formatted image of the view.
-
getAsUiElement
public com.vaadin.flow.component.Component getAsUiElement()
Description copied from class:AbstractView
Gets an embeddable visual component that can be rendered in a dashboard.It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.- Specified by:
getAsUiElement
in classAbstractView<com.vaadin.flow.component.Component>
- Returns:
- An embeddable component (Panel, VerticalLayout, etc)
-
buildFromSavedView
public void buildFromSavedView(byte[] structure)
Description copied from class:AbstractView
Builds the view. Call this method if no business object is required to build the view. It just loads the elements from an view definition structure (like an XML document).- Specified by:
buildFromSavedView
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
structure
- The view to be rendered.
-
addNode
public AbstractViewNode addNode(BusinessObjectLight businessObject, Properties properties)
Description copied from class:AbstractView
Adds a node to views that are not generated automatically.- Specified by:
addNode
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
businessObject
- The business object behind the node to be added. Nodes that already exist will not be added.properties
- The properties associated to this object, such as the location that will be used to place it or the URL of the icon that will represent the node.- Returns:
- A reference to the newly added node.
-
addEdge
public AbstractViewEdge addEdge(BusinessObjectLight businessObject, BusinessObjectLight sourceBusinessObject, BusinessObjectLight targetBusinessObject, Properties properties)
Description copied from class:AbstractView
Adds an edge to views that are not generated automatically.- Specified by:
addEdge
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
businessObject
- The business object behind the edge to be added. Edges that already exist will not be added.sourceBusinessObject
- The business object behind the source node to the edge to be created.targetBusinessObject
- The business object behind the target node to the edge to be created.properties
- The properties associated to this object, such as the control points of the edge, or its color.- Returns:
- A reference to the newly added edge.
-
syncViewMap
public void syncViewMap()
The view map is created originally by calling the#buildWithSavedView(byte[])
method, but it can change due to user interactions, so it's necessary to update it in order to export it in other formats. This method wipes the existing view map and builds it again from whatever it is on the map currently
-
removeNode
public void removeNode(BusinessObjectLight businessObject)
Description copied from class:AbstractView
remove a node from the viewMap- Specified by:
removeNode
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
businessObject
- The business object behind the node to be removed
-
removeEdge
public void removeEdge(BusinessObjectLight businessObject)
Description copied from class:AbstractView
remove a edge from the viewMap- Specified by:
removeEdge
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
businessObject
- The business object behind the edge to be removed
-
nodeClickListener
public void nodeClickListener(ViewEventListener listener)
Description copied from class:AbstractView
Adds a listener to the node click events.- Specified by:
nodeClickListener
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
listener
- The listener object.
-
edgeClickListener
public void edgeClickListener(ViewEventListener listener)
Description copied from class:AbstractView
Adds a listener to the edge click events.- Specified by:
edgeClickListener
in classAbstractView<com.vaadin.flow.component.Component>
- Parameters:
listener
- The listener object.
-
clean
public void clean()
Description copied from class:AbstractView
Cleans the view so some other thing can be painted on the canvas. Typically this is used in refresh buttons.- Specified by:
clean
in classAbstractView<com.vaadin.flow.component.Component>
-
-