There are some utility methods that allow you to create a DataCategory from a
"-" separated String definition. For example:
DataCategory category = DataCategory.parseCategory ("2D grid", true);
Will give a DataCategory with the single component "2D grid". The true
says to make the DataCategory be a display category.
Alternatively:
DataCategory.parseCategory ("GRID-2D-TIME;", false);
will create a non-display DataCategory that can be used by DisplayControl-s
that need gridded, 2 dimensional data with time.
Another utility method takes a String of ";" delimited DataCategory specifications
and returns a List:
List 2dcategories = DataCategory.parseCategories ("2D grid;GRID-2D-TIME;");
Or
List 3dcategories = DataCategory.parseCategories ("3D grid;GRID-3D-TIME;");
Here by default the first category parsed (e.g., "2D grid" and "3D grid") will
be the display categories.
So the {@link ucar.unidata.data.DataChoice} objects, which represent data available from a {@link ucar.unidata.data.DataSource}, hold a list of categories that define the flavor of data. The {@link ucar.unidata.idv.DisplayControl}-s, (well really the {@link ucar.unidata.idv.ControlDescriptor}-s) hold a list of categories which define the flavors of data they are applicable to. The categories that a DisplayControl has can contain regular expression patterns.
To see what display controls are applicable to what categories look at the file:
/ucar/unidata/idv/resources.controls.xml
There you will see entries like:
categories="*-2D-*;*-3D-*"This says that the given DisplayControl is applicable to anything that has 2D or 3D in any of its category components.
The TextDisplayControl has categories:
categories="text;html"which says it is applicable to any category of "text" or "html"
The image sequence control has a single category:
categories="IMAGE-2D-TIME"Which says it will only match data that has the exact category 2d, images with time.