public class ZestContentViewer extends ContentViewer
WIDGET_DATA_KEY
Constructor and Description |
---|
ZestContentViewer(Module module)
Constructs a new
ZestContentViewer . |
Modifier and Type | Method and Description |
---|---|
protected javafx.embed.swt.FXCanvas |
createCanvas(Composite parent,
int style)
Creates an
FXCanvas inside of the given parent
Composite . |
void |
createControl(Composite parent,
int style)
Creates the control for this
ZestContentViewer inside of the
given parent Composite . |
protected Edge |
createEdge(ILabelProvider labelProvider,
java.lang.Object contentSourceNode,
Node sourceNode,
java.lang.Object contentTargetNode,
Node targetNode)
Constructs and returns a new
Edge connecting the given
sourceNode and targetNode. |
protected Graph |
createEmptyGraph()
Constructs and returns a new
Graph and inserts default attributes
into it:
layout algorithm
|
protected Graph |
createNestedGraph(java.lang.Object contentNestingNode,
IGraphContentProvider graphContentProvider,
ILabelProvider labelProvider)
Creates a
Graph nested in the node represented by the given
contentNestingNode. |
protected Node |
createNode(java.lang.Object contentNode,
IGraphContentProvider graphContentProvider,
ILabelProvider labelProvider)
|
protected void |
createNodesAndEdges(IGraphContentProvider graphContentProvider,
ILabelProvider labelProvider,
Graph graph,
java.lang.Object[] contentNodes)
|
protected Graph |
createRootGraph(IContentProvider contentProvider,
ILabelProvider labelProvider)
|
java.util.Map<java.lang.Object,Node> |
getContentNodeMap()
Returns an unmodifiable view of the content-node-map.
|
IViewer |
getContentViewer()
Returns the
IViewer that displays the contents. |
javafx.embed.swt.FXCanvas |
getControl() |
ILabelProvider |
getLabelProvider() |
ILayoutAlgorithm |
getLayoutAlgorithm()
Returns the
ILayoutAlgorithm that is used for laying out the
contents. |
ISelection |
getSelection() |
protected SelectionModel |
getSelectionModel()
Retrieves the
SelectionModel used by the viewer (
getContentViewer() ) |
protected void |
handleDispose(DisposeEvent event) |
protected void |
inputChanged(java.lang.Object input,
java.lang.Object oldInput) |
void |
refresh() |
void |
setLayoutAlgorithm(ILayoutAlgorithm layoutAlgorithm)
Changes the
ILayoutAlgorithm that is used for laying out the
contents to the given value. |
void |
setSelection(ISelection selection,
boolean reveal) |
protected java.lang.String |
toCssRgb(Color color)
Converts the given
Color into a CSS string:
"rgb(red,green,blue)" . |
getContentProvider, getInput, handleLabelProviderChanged, hookControl, labelProviderChanged, setContentProvider, setInput, setLabelProvider
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
public ZestContentViewer(Module module)
ZestContentViewer
. The given Module
is
saved so that it can be later used to create an Injector
that is
later used for the injection of members and the construction of the
IDomain
.protected javafx.embed.swt.FXCanvas createCanvas(Composite parent, int style)
FXCanvas
inside of the given parent
Composite
. The FXCanvas
serves acs the container for the
JavaFX Scene
which renders the contents.parent
- The parent Composite
.style
- The SWT style bits to be used for the to be created canvas.FXCanvas
inside of the given parent.public void createControl(Composite parent, int style)
ZestContentViewer
inside of the
given parent Composite
.parent
- The parent Composite
.style
- The SWT style for this ZestContentViewer
, which will
be forwarded to its FXCanvas
control.protected Edge createEdge(ILabelProvider labelProvider, java.lang.Object contentSourceNode, Node sourceNode, java.lang.Object contentTargetNode, Node targetNode)
Edge
connecting the given
sourceNode and targetNode. If the labelProvider
implements IGraphAttributesProvider
, then attributes for the edge
are determined using the
IGraphAttributesProvider.getEdgeAttributes(Object, Object)
methods and inserted into the edge.labelProvider
- This viewer's ILabelProvider
for convenience.contentSourceNode
- The content element representing the source node of this edge.sourceNode
- The already created source Node
of this edge.contentTargetNode
- The content element representing the target node of this edge.targetNode
- The already created target Node
of this edge.Edge
.protected Graph createEmptyGraph()
Graph
and inserts default attributes
into it:
Graph
with default attributes.protected Graph createNestedGraph(java.lang.Object contentNestingNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider)
Graph
nested in the node represented by the given
contentNestingNode.contentNestingNode
- The content Object
that represents the nesting node.graphContentProvider
- This viewer's IGraphContentProvider
for convenience.labelProvider
- This viewer's ILabelProvider
for convenience.Graph
.protected Node createNode(java.lang.Object contentNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider)
Node
for the specified contentNode using the
IContentProvider
and ILabelProvider
. Moreover, the new
node is put into the given contentToGraphMap.contentNode
- The content Object
that represents the node.graphContentProvider
- This viewer's IGraphContentProvider
for convenience.labelProvider
- This viewer's ILabelProvider
for convenience.Node
.protected void createNodesAndEdges(IGraphContentProvider graphContentProvider, ILabelProvider labelProvider, Graph graph, java.lang.Object[] contentNodes)
graphContentProvider
- This viewer's IGraphContentProvider
for convenience.labelProvider
- This viewer's ILabelProvider
for convenience.graph
- The Graph
for which nodes and edges are created.contentNodes
- Content elements which represent nodes that are to be created
together with the edges between them.protected Graph createRootGraph(IContentProvider contentProvider, ILabelProvider labelProvider)
contentProvider
- The IContentProvider
for this viewer.labelProvider
- The ILabelProvider
for this viewer.Graph
constructed by using the given
providers.public java.util.Map<java.lang.Object,Node> getContentNodeMap()
public IViewer getContentViewer()
IViewer
that displays the contents.IViewer
that displays the contents.public javafx.embed.swt.FXCanvas getControl()
getControl
in class Viewer
public ILabelProvider getLabelProvider()
getLabelProvider
in class ContentViewer
public ILayoutAlgorithm getLayoutAlgorithm()
ILayoutAlgorithm
that is used for laying out the
contents.ILayoutAlgorithm
that is used for laying out the
contents.public ISelection getSelection()
getSelection
in interface ISelectionProvider
getSelection
in class Viewer
protected SelectionModel getSelectionModel()
SelectionModel
used by the viewer (
getContentViewer()
)SelectionModel
adapted to the viewer (
getContentViewer()
).protected void handleDispose(DisposeEvent event)
handleDispose
in class ContentViewer
protected void inputChanged(java.lang.Object input, java.lang.Object oldInput)
inputChanged
in class Viewer
public void setLayoutAlgorithm(ILayoutAlgorithm layoutAlgorithm)
ILayoutAlgorithm
that is used for laying out the
contents to the given value.layoutAlgorithm
- The new ILayoutAlgorithm
to use.public void setSelection(ISelection selection, boolean reveal)
setSelection
in class Viewer
Copyright (c) 2014 itemis AG and others. All rights reserved.