public class JViewer extends java.lang.Object implements CommandListener, javax.swing.event.ChangeListener, PropertyListener
Modifier and Type | Class and Description |
---|---|
static class |
JViewer.AccelerationFunctionExp
The
JViewer.AccelerationFunctionExp class implements the following function in
[0:JViewer.AccelerationFunctionExp.ZERO_AT ]:
* Math.exp(-x / ) -
Two methods are provided:
JViewer.AccelerationFunctionExp.of(double) : computes the function;
JViewer.AccelerationFunctionExp.inverseOf(double) : computes the inverse of the function. |
protected static class |
JViewer.BarType |
Modifier and Type | Field and Description |
---|---|
protected JTopology |
jtp |
protected javax.swing.JSlider |
slideBar |
protected JViewer.BarType |
slideBarType |
protected TopologySerializerFilenameMatcher |
topologySerializerFilenameMatcher |
protected javax.swing.JFrame |
window |
Constructor and Description |
---|
JViewer(JTopology jtopo)
Creates a windowed viewer encapsulating the specified jtopology.
|
JViewer(JTopology jtopo,
boolean windowed)
Creates a viewer encapsulating the specified jtopology.
|
JViewer(Topology topo)
Creates a windowed viewer for the specified topology.
|
JViewer(Topology topo,
boolean selfContained)
Creates a viewer for the specified topology.
|
Modifier and Type | Method and Description |
---|---|
void |
addSlideBar(JViewer.BarType type,
int value)
Adds a slide bar at the top of the topology.
|
void |
addTopologySerializer(java.lang.String regexp,
TopologySerializer topologySerializer)
Records and links the provided
TopologySerializer to a specific regular expression. |
protected static double |
computeClockSpeed(double maxValue,
double value) |
protected static double |
computeSliderPosition(double maxValue,
double value) |
JTopology |
getJTopology()
Returns the jtopology attached to this viewer.
|
void |
onCommand(java.lang.String command)
Provides a way to react upon command selection.
|
void |
onPropertyChanged(Properties o,
java.lang.String p)
Notifies that a property of this object has changed.
|
void |
removeSlideBar()
Removes the slide bar, if any.
|
void |
setSize(int width,
int height)
Sets the size of the inner jtopology to the specified dimension.
|
void |
setTitle(java.lang.String title)
Sets the title of the corresponding window
|
void |
stateChanged(javax.swing.event.ChangeEvent e) |
protected JTopology jtp
protected javax.swing.JSlider slideBar
protected TopologySerializerFilenameMatcher topologySerializerFilenameMatcher
protected JViewer.BarType slideBarType
protected javax.swing.JFrame window
public JViewer(Topology topo)
topo
- The topology to be drawn and/or manipulated.public JViewer(Topology topo, boolean selfContained)
topo
- The topology to be drawn and/or manipulated.selfContained
- Set this to false to avoid creating a JFrame
(e.g. for embedding the JViewer in your own frame).public JViewer(JTopology jtopo)
jtopo
- The jtopology to be encapsulated.public JViewer(JTopology jtopo, boolean windowed)
jtopo
- The JTopology to be encapsulated.windowed
- Set this to false to avoid creating a JFrame
(e.g. for embedding the JViewer in your own frame).public JTopology getJTopology()
public void setSize(int width, int height)
width
- The desired width, in pixels.height
- The desired height, in pixels.public void setTitle(java.lang.String title)
title
- the new title, as a String
.public void addSlideBar(JViewer.BarType type, int value)
type
- the JViewer.BarType
to add.value
- the value for the slide bar, as an integer.public void removeSlideBar()
public void onCommand(java.lang.String command)
CommandListener
onCommand
in interface CommandListener
command
- the command which has risen.public void addTopologySerializer(java.lang.String regexp, TopologySerializer topologySerializer)
Records and links the provided TopologySerializer
to a specific regular expression.
This couple will be used during Topology
import/export. If the file's name matches the provided regular
expression, the linked TopologySerializer
will be used for (de)serialization.
regexp
- a regular expression matching the file namestopologySerializer
- the TopologySerializer
to be recordedpublic void onPropertyChanged(Properties o, java.lang.String p)
PropertyListener
onPropertyChanged
in interface PropertyListener
o
- The object.p
- The name of the changed property.public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
protected static double computeClockSpeed(double maxValue, double value)
protected static double computeSliderPosition(double maxValue, double value)