Class AbstractView<C extends com.vaadin.flow.component.Component>
- java.lang.Object
-
- org.neotropic.kuwaiba.core.apis.integration.views.AbstractView<C>
-
- Type Parameters:
C
- The class of the visual component returned by this view.
- Direct Known Subclasses:
FiberSplitterView
,MplsView
,ObjectView
,OutsidePlantView
,PhysicalPathView
,PhysicalTreeView
,RackView
,SdhView
,SpliceBoxView
,TopologyView
public abstract class AbstractView<C extends com.vaadin.flow.component.Component> extends Object
Defines the behavior of views that can be plugged and played such as End to End views.- Author:
- Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
-
-
Field Summary
Fields Modifier and Type Field Description protected Properties
properties
The properties associated an instance of the view, typically an id, a name and a description.protected ViewMap
viewMap
The default view map.
-
Constructor Summary
Constructors Constructor Description AbstractView()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AbstractViewEdge
addEdge(BusinessObjectLight businessObject, BusinessObjectLight sourceBusinessObject, BusinessObjectLight targetBusinessObject, Properties properties)
Adds an edge to views that are not generated automatically.abstract AbstractViewNode
addNode(BusinessObjectLight businessObject, Properties properties)
Adds a node to views that are not generated automatically.abstract void
buildFromSavedView(byte[] view)
Builds the view.abstract void
clean()
Cleans the view so some other thing can be painted on the canvas.abstract void
edgeClickListener(ViewEventListener listener)
Adds a listener to the edge click events.abstract byte[]
getAsImage()
Exports the view to a PNG image.abstract C
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)
.ViewMap
getAsViewMap()
Exports the view as a ViewMap (a representation of the view as a set of Java objects related to each other).abstract byte[]
getAsXml()
Exports the view to XML.Properties
getProperties()
The properties associated to an instance of the view, typically an id, a name and a description.abstract void
nodeClickListener(ViewEventListener listener)
Adds a listener to the node click events.abstract void
removeEdge(BusinessObjectLight businessObject)
remove a edge from the viewMapabstract void
removeNode(BusinessObjectLight businessObject)
remove a node from the viewMap
-
-
-
Field Detail
-
viewMap
protected ViewMap viewMap
The default view map. This view map must be created when either#buildEmptyView()
or#buildWithBusinessObject(java.lang.Object)
is called.
-
properties
protected Properties properties
The properties associated an instance of the view, typically an id, a name and a description.
-
-
Method Detail
-
clean
public abstract void clean()
Cleans the view so some other thing can be painted on the canvas. Typically this is used in refresh buttons.
-
getProperties
public Properties getProperties()
The properties associated to an instance of the view, typically an id, a name and a description.- Returns:
- The set or properties.
-
getAsXml
public abstract byte[] getAsXml()
Exports the view to XML. It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.- 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 abstract byte[] getAsImage()
Exports the view to a PNG image. It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.- Returns:
- A byte array with a PNG formatted image of the view.
-
getAsUiElement
public abstract C getAsUiElement() throws InvalidArgumentException
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)
.- Returns:
- An embeddable component (Panel, VerticalLayout, etc)
- Throws:
InvalidArgumentException
- If the component could not be created for some reason (most likely, misconfiguration).
-
getAsViewMap
public ViewMap getAsViewMap()
Exports the view as a ViewMap (a representation of the view as a set of Java objects related to each other). It most likely will have to be called after calling#build()
or#build(java.lang.Object)
.- Returns:
- The view map of the view.
-
buildFromSavedView
public abstract void buildFromSavedView(byte[] view)
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).- Parameters:
view
- The view to be rendered.
-
addNode
public abstract AbstractViewNode addNode(BusinessObjectLight businessObject, Properties properties)
Adds a node to views that are not generated automatically.- 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 abstract AbstractViewEdge addEdge(BusinessObjectLight businessObject, BusinessObjectLight sourceBusinessObject, BusinessObjectLight targetBusinessObject, Properties properties)
Adds an edge to views that are not generated automatically.- 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.
-
removeNode
public abstract void removeNode(BusinessObjectLight businessObject)
remove a node from the viewMap- Parameters:
businessObject
- The business object behind the node to be removed
-
removeEdge
public abstract void removeEdge(BusinessObjectLight businessObject)
remove a edge from the viewMap- Parameters:
businessObject
- The business object behind the edge to be removed
-
nodeClickListener
public abstract void nodeClickListener(ViewEventListener listener)
Adds a listener to the node click events.- Parameters:
listener
- The listener object.
-
edgeClickListener
public abstract void edgeClickListener(ViewEventListener listener)
Adds a listener to the edge click events.- Parameters:
listener
- The listener object.
-
-