Combo

What is it

This model demonstrates how to implement multiple simultaneous grids and grid viewers using Xholon. You can have different grid viewers referencing the same part of the model or have them each referencing different parts of the model.

Running the application will produce 3 grids, Hex Grid, Game of Life, and Tiny Hex Grid. Tiny Hex Grid will show the same information as Hex Grid.

How to use it

Run it:

  • Run the Java application through the Xhn GUI (org.primordion.xholon.app.Xhn.java), and select File --> Open --> GridSamples --> Combo_xhn.xml.
  • The Xholon GUI and three grid viewers will appear. The grid viewers will each display a random initial pattern.
  • Expand the Controller node in the tree viewer.
  • Press the Start node.

Pause and Step the model:

  1. Press Pause to pause and resume the executing model. Press Step to advance the paused model by one time step. Press Start to resume the paused model.

Things to notice

In Combo_xhn.xml there are 3 instances of "GridViewerParams" and each of these has 3 components, for example, "GridViewerParams" value="descendant::HexRow/..,12,Hex Grid">.

  • "descendant::HexRow/.." is an XPath expression (see http://www.w3.org/TR/xpath) that tells the application where the owner of the grid is located in the tree, relative to the root node. You can see a tree of all the rows in the Hex grid, in the Xholon GUI under Model -> CompositeStructureHierarchy -> combo_0 -> hex_1.
  • The next component (12 in this example) specifies the number of pixels per cell.
  • The last component specifies the intended name of the grid.

Things to try

Change the size of the display by editing the number of pixels per cell. For example, change 12 to 8.

Add new grids by copying and pasting the "GridViewerParams" line mentioned above. Remove any grid by commenting out one or more of the lines.

Change any of the colours presented by editing GridPanelCombo.java in src/.org.primordion.xholon.samples.

You can choose hex or square grids. In Combo_ClassDetails, in each of the lines 'config instruction="Ght"' an 'h' produces a hex grid while an 'm' will produce a square grid.