Package com.softsynth.jmsl.score.util
Interface RenderedMessageListener
- All Known Implementing Classes:
SimpleGraphicsRenderedMessageListener
public interface RenderedMessageListener
You can get a call-back from various objects when they are rendered in a
Score. Measure, Staff, and Note all have "userbeans" which can be loaded with
RenderedMessageBean's As a last step of rendering, these objects run through
their userbeans, and for each one which is of type RenderedMessageBean, calls
the bean's execute() method, which in turn iterates through the score's list
of RenderedMessageListener's, calling the execute() method defined in this
interface.
You could use this to load up such objects with commands which have
straightforward interpretations like "drawline 0 0 10 20" but you could also
use commands that make sense to graphics contexts we have not yet anticipated
which have a set of commands that extend beyond, or are simply different than
Java Graphics. There is no notion of syntax checking. The message you set is
up to you, and you must interpret it appropriately with the listener
callback. So you can load up commands like "drawsquiggle 3.14159 dada".
For a simple listener example, @see com.softsynth.jmsl.score.util.SimpleGraphicsRenderedMessageListener
- Author:
- Nick Didkovsky, May 29, 2010
-
Method Summary
Modifier and Type Method Description void
execute(java.lang.String message, Score score, java.lang.Object container, RenderedMessageBean renderedMessageBean, java.awt.Graphics g, java.awt.geom.Point2D p, double zoom)
-
Method Details
-
execute
void execute(java.lang.String message, Score score, java.lang.Object container, RenderedMessageBean renderedMessageBean, java.awt.Graphics g, java.awt.geom.Point2D p, double zoom)- Parameters:
message
- an arbitrary message sent by the object when it is rendered. Could be something easily interpretable like "drawline 0 0 10 20" for example or something personal like "drawsquiggle 3.14159 dada"score
- the JMSL Score containing the sending object.container
- Could be Measure, Staff, or Note. It's the object that contained the bean.renderedMessageBean
- the bean itself that sent the execute() messageg
- Graphics context of the Scorep
- the drawing anchor of the sending object. Presumably you want to draw relative to thiszoom
- the current zoom of the score layout
-