NetBeans: The Definitive Guide
by Tim Boudreau, Jesse Glick, Simeon Greene, Vaughn Spurlin, Jack J. Woehr
Chapter 22. Creating a Structural View of the Score
So far the user is able to edit score files as text and play them. But of course the purpose of an IDE is to make it easier for you to work with files in a variety of ways—editing as text is perhaps the most important, but the other ways generally involve working with the file structurally. For example, when you are working with Java sources in the IDE, you can see the structure of the source file mirrored in the Explorer (and can make edits there if you wish). Furthermore, many tools manipulate Java sources in the IDE—some, like the import management wizard, are provided by the Java module itself; some may be provided by other modules or even integrated applications such as UML modeling. Having the structural definition of the source enables these tools to cooperate, rather than all having to work with raw textual sources.
For our support for score files, we will travel a similar route. Rather than building different tools that each need to understand the score file text format, there will be a programmatic description of the structure of a score; the data object representing the score will have the responsibility of maintaining this alternate view of the score.
Creating a ScoreCookie to Represent a Sequence of Notes
To expose this new capability to
clients,
we will need a cookie that describes it and an implementation of
which will be attached to the score object. Let us take a look at
this Cookie (in Example 22-1), which ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access