View Javadoc

1   package fr.ove.openmath.jome.ctrlview.bidim;
2   
3   import fr.ove.openmath.jome.ctrlview.bidim.*;
4   import fr.ove.openmath.jome.model.*;
5   
6   /***
7   * The display of a symbol.
8   *
9   * @author © 2000 DIRAT Laurent
10  * @version 2.0  05/01/2000
11  */
12  public class IconDisplay extends SymbolDisplay {
13      /***
14      * The constructor.<BR>
15      * Instanciate a new display, with no displayable symbol associated. The symbol has to be set
16      * by hand.
17      * @param graphicContext the graphic context of the display.
18      */
19      public IconDisplay(GraphicContext graphicContext) {
20          super(graphicContext);
21          IconLayout layout = new IconLayout();
22          layout.initDisplay(this);
23          setLayout(layout);
24      }
25      
26      /***
27      * Builds the display of the formula tree structure.<BR>
28      * This method has to be called when a formula tree structure has been created and the 
29      * displays have not been associated yet.<BR>
30      * As a prerequesit, the instance which call this method MUST have a corresponding instance
31      * (a listener) in the formula tree structure (i.e. the formula tree structure we want to display).<BR>
32      *
33      public void buildDisplay() {
34          Display childDisplay;
35          FormulaTreeStructure ftsChild;
36          Icon fts;
37          int count;
38          SubstitutedDisplayManager iconLM = (SubstitutedDisplayManager) getLayout();
39          
40          // On rÈcupËre l'ÈlÈment de la FTS donc l'instance est le display.
41          fts = (Icon) getListener();
42          if (fts != null) { // Bon malgrË le prÈrequis, on fait le test quand mÍme
43              count = fts.getNbIconified();
44              
45              // On parcourre la liste des fils de la fts, pour leur associer le display qui va bien
46              for (int i = 0; i < count; i++) {
47                  ftsChild = (FormulaTreeStructure) fts.getIconified(i);
48                  // Allocation du display
49                  childDisplay = getDisplayAllocator().allocateDisplay(getGraphicContext(), ftsChild);
50                  // On ajoute le nouveau display dans la liste des displays iconifiÈs
51                  iconLM.addSubstitutedDisplay(childDisplay);
52                  // On descend dans la fts pour poursuivre la construction des display
53                  childDisplay.buildDisplay();
54              }
55          }
56      }
57      */
58  }
59