Back to index

wims  3.65+svn20090927
Public Member Functions | Static Private Attributes
fr.ove.openmath.jome.ctrlview.bidim.BidimDisplayAllocator Class Reference

This class instanciates the right display according to the specified formula tree sturcture. More...

Inheritance diagram for fr.ove.openmath.jome.ctrlview.bidim.BidimDisplayAllocator:
Inheritance graph
[legend]
Collaboration diagram for fr.ove.openmath.jome.ctrlview.bidim.BidimDisplayAllocator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Display allocateDisplay (GraphicContext graphicContext, FormulaTreeStructure fts)
 Instanciates and creates the right display according to the specified formula tree structure.

Static Private Attributes

static BidimLayoutAllocator layoutAllocator = new BidimLayoutAllocator()
 The display layout allocator.
static BidimResourcesManager resourcesManager = new BidimResourcesManager("fr.ove.openmath.jome.ctrlview.bidim.resources")
 The resources manager for the displays.

Detailed Description

This class instanciates the right display according to the specified formula tree sturcture.

This is an abstract class. It must be inherited to be specialized.

Author:
© 1999 DIRAT Laurent
Version:
2.0 01/07/1999

Definition at line 44 of file BidimDisplayAllocator.java.


Member Function Documentation

Instanciates and creates the right display according to the specified formula tree structure.

Parameters:
ftsthe formula tree structure which need a display.

Implements fr.ove.openmath.jome.ctrlview.bidim.DisplayAllocator.

Definition at line 60 of file BidimDisplayAllocator.java.

                                                                                            {
        Display display = null;
        
        String ftsId = fts.getResourceIdentifier();
        String idDisplay = resourcesManager.getIdDisplay(ftsId);
        
        // Si il y a un problème de display, alors on met le display par défaut
        idDisplay = (idDisplay == null) ? "default" : idDisplay;
        
        //System.out.println("ftsId = " + ftsId + "\t\t idDisplay = " + idDisplay);
        
        if (idDisplay.equals("constant")) {
            // Allocation d'un StringDisplay
            display = new StringDisplay(graphicContext, ((Constant) fts).getValue(), false);
            
            // Le display créé écoute la fts qui lui correspond
            display.addControlListener(fts);
            // Et vice et versa.
            fts.addModelListener(display);
        }
        else if (idDisplay.equals("symbol")) {
            // Allocation d'un SymbolDisplay
            display = new SymbolDisplay(graphicContext);
            // Allocation dudit symbole
            ImageSymbol symbol = new ImageSymbol(/*fts.getSymbolName*/fts.getValue(), display);
            // Affection du symbole
            ((SymbolDisplay) display).setSymbol(symbol);
            
            // Le display créé écoute la fts qui lui correspond
            display.addControlListener(fts);
            // Et vice et versa.
            fts.addModelListener(display);
        }
        else if (idDisplay.equals("icon")) {
            if (((Icon) fts).isSubstitution()) {
                // Allocation d'un SubstitutionDisplay
                display = new SubstitutionDisplay(graphicContext, ((Icon) fts).getIconName());
            }
            else {
                // Allocation d'un SymbolDisplay
                display = new IconDisplay(graphicContext);
                // Allocation de l'icone
                ImageSymbol icon = new ImageSymbol(fts.getIconName(), display);
                // Affection du symbole (i.e. de l'icone)
                ((SymbolDisplay) display).setSymbol(icon);
            }
            
            // Le display créé écoute la fts qui lui correspond
            display.addControlListener(fts);
            // Et vice et versa.
            fts.addModelListener(display);
        }
        else {
            // Dans tous les autres cas, allocation d'un BidimDisplay
            display = new BidimDisplay(graphicContext);
            
            // Le display créé écoute la fts qui lui correspond
            display.addControlListener(fts);
            // Et vice et versa.
            fts.addModelListener(display);
            
            // Allocation du layout manager qui va bien
            String layoutName = resourcesManager.getLayoutManager(ftsId);
            layoutName = (layoutName == null) ? resourcesManager.getLayoutManager("defaultLM") : layoutName;
            
            //System.out.println("layoutName = " + layoutName);
            
            DisplayLayout layout = layoutAllocator.allocateLayout(layoutName);
            display.setLayout(layout);
            layout.initDisplay(display);
        }
        
        return display;
    }

Here is the call graph for this function:


Member Data Documentation

The display layout allocator.

Definition at line 48 of file BidimDisplayAllocator.java.

The resources manager for the displays.

Definition at line 53 of file BidimDisplayAllocator.java.


The documentation for this class was generated from the following file: