Back to index

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

A layout manager for an infix operator which symbol can be rendered as an image. More...

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

List of all members.

Public Member Functions

Display createOperatorDisplay ()
 Returns the display of the operator.
Dimension computeAttributes ()
 Computes the size of the display according to its children size (if any), and its different attributes.
void rebuildDisplay ()
 The display needs to be rebuilt.
void layoutContainer (Container parent)
void initDisplay (Display displayToLay)
 According to the operator, the layout manager has to add some components (e.g.
boolean selectLeftDisplay ()
 Returns true if during the selection, the display which is located to the left of the display that the instance lays, must be selected too.
boolean selectRightDisplay ()
 Returns true if during the selection, the display which is located to the right of the display that the instance lays, must be selected too.
void selectDisplay ()
 Selects the display (and its children if any)
void deselectDisplay ()
 Deselects the display.
void updateLevel (int level)
 Updates the level of the display laid out.
abstract void validateSelection ()
 Checks the validity of the selection.
abstract void validateDeselection (Display display)
 Checks the validity of the deselection.
void addLayoutComponent (String name, Component comp)
 Adds the specified component with the specified name to the layout.
void addLayoutComponent (Component comp, Object constraints)
 Adds the specified component to the layout, using the specified constraint object.
void removeLayoutComponent (Component comp)
 Removes the specified component from the layout.
Dimension minimumLayoutSize (Container parent)
 Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
Dimension preferredLayoutSize (Container parent)
 Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
Dimension maximumLayoutSize (Container target)
 Returns the maximum size of this component.
float getLayoutAlignmentX (Container target)
 Returns the alignment along the x axis.
float getLayoutAlignmentY (Container target)
 Returns the alignment along the y axis.
void invalidateLayout (Container target)
 Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Protected Member Functions

void insertOperatorDisplay ()
 Inserts a display of the operator symbol that the display laid by the instance represents.

Protected Attributes

boolean insertOperatorDisplay = true
 Do we need to insert an operator display ?
int prevNbComponent = 0
 The number of the components already present before an other insertion or removal.
Display displayToLay = null
 The display laid out by the instance.

Private Attributes

ImageSymbol symbolOperator = null
 The symbol we have to insert between each component if necessary.

Detailed Description

A layout manager for an infix operator which symbol can be rendered as an image.

Author:
© 1999 DIRAT Laurent
Version:
2.0 14/12/1999

Definition at line 40 of file ImageInfixOperatorLayout.java.


Member Function Documentation

void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.addLayoutComponent ( String  name,
Component  comp 
) [inline, inherited]

Adds the specified component with the specified name to the layout.

Parameters:
namethe component name
compthe component to be added

Definition at line 189 of file DisplayLayout.java.

                                                                {
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.addLayoutComponent ( Component  comp,
Object  constraints 
) [inline, inherited]

Adds the specified component to the layout, using the specified constraint object.

Parameters:
compthe component to be added
constraintswhere/how the component is added to the layout.

Definition at line 236 of file DisplayLayout.java.

                                                                       {
           if (!(constraints instanceof Display))
              throw new IllegalArgumentException("The component to add must be a Display instance !!!");
    }

Computes the size of the display according to its children size (if any), and its different attributes.

Returns:
the size of the display.

Reimplemented from fr.ove.openmath.jome.ctrlview.bidim.HorizontalLayout.

Definition at line 116 of file InfixOperatorLayout.java.

                                         {
        // On regarde si le nombre de component dans le display a changé depuis
        // la dernière fois. Si oui, il faut contrôler s'il ne faut pas ajouter
        // des display d'opérateur.
        if (insertOperatorDisplay || (prevNbComponent != displayToLay.getComponentCount()))
            insertOperatorDisplay();
            
        return super.computeAttributes();
    }

Here is the call graph for this function:

Returns the display of the operator.

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

Definition at line 49 of file ImageInfixOperatorLayout.java.

                                           {
        if (symbolOperator == null) {
            Operator fts = (Operator) displayToLay.getListener();
            //symbolOperator = new ImageSymbol(fts.getTheOperator(), displayToLay);
            symbolOperator = new ImageSymbol(fts.getResourceIdentifier(), displayToLay);
        }
        
        // On créé un display pour l'opérateur.
        SymbolDisplay operatorDisplay = new SymbolDisplay(displayToLay.getGraphicContext(), symbolOperator);
        operatorDisplay.setIsSymbolOperatorDisplay(true);
        
        return operatorDisplay;
    }

Here is the call graph for this function:

Deselects the display.

Parameters:
thedisplay to deselect.

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.OneFormulaLayout.

Definition at line 107 of file DisplayLayout.java.

                                  {
        displayToLay.deselect();

        SelectionEvent selEvt = new SelectionEvent(displayToLay);
        selEvt.setAction(SelectionEvent.REMOVE, displayToLay);
        displayToLay.fireSelectionEvent(selEvt);
        
        if (displayToLay.getParent() instanceof Display) {
            Display display = (Display) displayToLay.getParent();
            ((DisplayLayout) display.getLayout()).validateDeselection(displayToLay);
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

float fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.getLayoutAlignmentX ( Container  target) [inline, inherited]

Returns the alignment along the x axis.

This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Definition at line 258 of file DisplayLayout.java.

                                                       {
        return 0.0f;
    }
float fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.getLayoutAlignmentY ( Container  target) [inline, inherited]

Returns the alignment along the y axis.

This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Definition at line 269 of file DisplayLayout.java.

                                                       {
        return 0.0f;
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.initDisplay ( Display  displayToLay) [inline, inherited]

According to the operator, the layout manager has to add some components (e.g.

brackets, ...) or has to perform some "re-oganisation" before rendering.
As soon as the layout manager is set to the display, this mehtod MUST be called with the display laid out as parameter. This method serves as well as a registering method. So all sub-classes of the instance MUST call super.initDisplay(displayToLay).

Parameters:
displayToLaythe display laid by the instance

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.EnclosingLayout, fr.ove.openmath.jome.ctrlview.bidim.SuperposedOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.VarDiffLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsArrayLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsToSigmaLayout, fr.ove.openmath.jome.ctrlview.bidim.IntegralLayout, fr.ove.openmath.jome.ctrlview.bidim.Mfd2SubstitutionLayout, fr.ove.openmath.jome.ctrlview.bidim.HorizontalListLayout, fr.ove.openmath.jome.ctrlview.bidim.DifferentiationLayout, fr.ove.openmath.jome.ctrlview.bidim.IntervalLayout, fr.ove.openmath.jome.ctrlview.bidim.LambdaExpLayout, fr.ove.openmath.jome.ctrlview.bidim.BetweenOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.EnumerationLayout, fr.ove.openmath.jome.ctrlview.bidim.FunctionLayout, fr.ove.openmath.jome.ctrlview.bidim.RootLayout, fr.ove.openmath.jome.ctrlview.bidim.LimitLayout, and fr.ove.openmath.jome.ctrlview.bidim.UnaryOperatorLayout.

Definition at line 58 of file DisplayLayout.java.

Here is the caller graph for this function:

Inserts a display of the operator symbol that the display laid by the instance represents.

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.BasicStringInfixOperatorLayout.

Definition at line 61 of file InfixOperatorLayout.java.

                                           {
        Display current, next, displayOperator;
        FormulaTreeStructure fatherFts = (FormulaTreeStructure) displayToLay.getListener();
        FormulaTreeStructure fts;
        int nbComponent = displayToLay.getComponentCount();
        
        // On parcourre tous les components présents dans le display.
        for (int i = 1; i < nbComponent; i++) {
            // la référence sur le component courant
            current = (Display) displayToLay.getComponent(i - 1);
            // la référence sur le suivant
            next = (Display) displayToLay.getComponent(i);
            
            // Si le courant est un display d'opérateur alors on continue
            if (current.isSymbolOperatorDisplay())
                continue;
                
            // Si le suivant n'est pas un display d'opérateur alors 2 cas
            if (!next.isSymbolOperatorDisplay()) {
                // On ajoute un display d'opérateur.
                displayOperator = createOperatorDisplay();
                displayToLay.add(displayOperator, displayOperator, i);
                
                // On met un listener à l'opérateur.
                // En fait, il n'y en a pas besoin, dans le sens où il n'y a pas spécifiquement de fts qui
                // écoute le comportement de ce display. Néanmoins, il s'avère nécessaire qu'il en ait
                // un, par exemple lors de l'iconification, car c'est le display qui reçoit la demande
                // d'iconification qui envoie l'événement correspondant à la FTS. Or si ce display n'a pas
                // d'écouteur, alors pb. Par cohérence, l'écouteur du display d'opérateur, est le fts qui
                // représente cette opération. Par contre, la fts en question, n'écoute pas le display
                // d'opérateur.
                displayOperator.addControlListener(fatherFts);
                i++;
                nbComponent++;
            }
        }
        
        // Mise à jour des rangs des displays
        displayToLay.adjustRank();
        // Mise à jour du nombre de components présents dans le display.
        prevNbComponent = displayToLay.getComponentCount();
        // On n'a plus besoin d'insérer des displays d'opérateur.
        insertOperatorDisplay = false;
        // On fait en sorte que la mise à niveau des displays (opérateurs) soit faite.
        displayToLay.setUpdateLevel(true);
        // On a rajouté un display, on demande le recalcul de tous les ancêtres
        // de l'instance.
        displayToLay.computeAncestorsAttributes();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.invalidateLayout ( Container  target) [inline, inherited]

Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Definition at line 277 of file DisplayLayout.java.

                                                   {
    }
void fr.ove.openmath.jome.ctrlview.bidim.HorizontalLayout.layoutContainer ( Container  parent) [inline, inherited]

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.RequestLayout.

Definition at line 95 of file HorizontalLayout.java.

                                                   {
        int x, y;
        Display display, previous;
        
        int count = parent.getComponentCount();
        for (int i = 0; i < count; i++) {
            display = (Display) parent.getComponent(i);
            display.setSize(display.getPreferredSize());

            if (i == 0)
                x = display.getShiftX();
            else {
                previous = (Display) parent.getComponent(i-1);
                x = previous.getX() + previous.getWidth() + display.getShiftX();
            }

            y = ((Display) parent).getAscent() - display.getAscent() + display.getShiftY();

            display.setLocation(x, y);

            // On place maintenant les éventuels display enfants du display courant
            display.doLayout();
        }
    }

Here is the call graph for this function:

Dimension fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.maximumLayoutSize ( Container  target) [inline, inherited]

Returns the maximum size of this component.

See also:
java.awt.Component::getMinimumSize()
java.awt.Component::getPreferredSize()
LayoutManager

Definition at line 247 of file DisplayLayout.java.

                                                         {
        return preferredLayoutSize(target);
    }

Here is the call graph for this function:

Dimension fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.minimumLayoutSize ( Container  parent) [inline, inherited]

Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.

Parameters:
parentthe component to be laid out
See also:
preferredLayoutSize

Definition at line 205 of file DisplayLayout.java.

                                                         {
        return preferredLayoutSize(parent);
    }

Here is the call graph for this function:

Dimension fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.preferredLayoutSize ( Container  parent) [inline, inherited]

Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.

Parameters:
parentthe component to be laid out
See also:
minimumLayoutSize

Definition at line 216 of file DisplayLayout.java.

                                                           {
        if (((Display) parent).getComputeAttributes())
            return computeAttributes();
        else
            return parent.getSize();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

The display needs to be rebuilt.

We do this.

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

Definition at line 129 of file InfixOperatorLayout.java.

                                 {
        Display tmp;
        int nbDisplay = ((FormulaTreeStructure) displayToLay.getListener()).getNbChildren();
        Display listDisplay[] = new Display[nbDisplay];
        
        int count = displayToLay.getComponentCount();
        for (int i = 0; i < count; i++) {
            tmp = (Display) displayToLay.getComponent(i);
            if (!tmp.isSymbolOperatorDisplay()) {
                // A voir !!!!!
                // Mais il semblerai que bon, sinon à la (re)construction du display il se base
                // sur des anciennes valeurs, et donc pas terrible niveau affichage.
                tmp.setLocation(0, 0);
                listDisplay[((FormulaTreeStructure) tmp.getListener()).getRank()] = tmp;
            }
        }
        
        // ATTENTION : ici, on enlève les displays fils de display, mais on ne les enlève pas de la liste
        // des listeners de la fts qu'il sont en train d'écouter. Exception faite pour les displays d'opérateur.
        displayToLay.removeAllDisplays();
                
        for (int i = 0; i < nbDisplay; i++)
            displayToLay.add(listDisplay[i]);
            
        // On a reconstruit le display, il faut maintenant insérer les displays d'opérateur.
        insertOperatorDisplay = true;
        
        // La taille des displays est probablement différente de ceux qui étaient
        // précédemment. On demande alors le recalcul des display ancêtres.
        displayToLay.computeAncestorsAttributes();
    }

Here is the call graph for this function:

Removes the specified component from the layout.

Parameters:
compthe component ot be removed

Definition at line 196 of file DisplayLayout.java.

                                                      {
    }

Selects the display (and its children if any)

Parameters:
thedisplay to select.

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.OneFormulaLayout.

Definition at line 85 of file DisplayLayout.java.

                                {
        displayToLay.select();
        
        SelectionEvent selEvt = new SelectionEvent(displayToLay);
        // On purge la liste des éléments sélectionnés.
        selEvt.setAction(SelectionEvent.PURGE, null);
        displayToLay.fireSelectionEvent(selEvt);
        selEvt.setAction(SelectionEvent.ADD, displayToLay);
        displayToLay.fireSelectionEvent(selEvt);
        
        Display display = displayToLay;
        if (displayToLay.getParent() instanceof Display) {
            display = (Display) displayToLay.getParent();
            ((DisplayLayout) display.getLayout()).validateSelection();
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if during the selection, the display which is located to the left of the display that the instance lays, must be selected too.

false otherwise.

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.LeftAssocPrefixedUnaryOperatorLayout, and fr.ove.openmath.jome.ctrlview.bidim.StringLayout.

Definition at line 68 of file DisplayLayout.java.

                                       {
        return false;
    }

Here is the caller graph for this function:

Returns true if during the selection, the display which is located to the right of the display that the instance lays, must be selected too.

false otherwise.

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.StringLayout.

Definition at line 77 of file DisplayLayout.java.

                                        {
        return false;
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.updateLevel ( int  level) [inline, inherited]

Updates the level of the display laid out.

Parameters:
displaythe display laid out
levelthe level put to the display.

Reimplemented in fr.ove.openmath.jome.ctrlview.bidim.LimitLayout, fr.ove.openmath.jome.ctrlview.bidim.RootLayout, fr.ove.openmath.jome.ctrlview.bidim.IntegralLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsArrayLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsToSigmaLayout, fr.ove.openmath.jome.ctrlview.bidim.ScriptLayout, and fr.ove.openmath.jome.ctrlview.bidim.AbstractStringLayout.

Definition at line 126 of file DisplayLayout.java.

                                       {
        Display tmp;
        
        if (displayToLay.getUpdateLevel()) {
            // On met le niveau adéquat
            displayToLay.setLevel(level);
            // On scale le display en fonction du niveau
            displayToLay.scaleDisplay();
            // On n'a plus besoin de mettre à jour le niveau de l'instance
            displayToLay.setUpdateLevel(false);
            // Le comportement par défaut est que les displays enfant de l'instance courante
            // ont le même niveau que leur père.
            int count = displayToLay.getComponentCount();
            for (int i = 0; i < count; i++) {
                tmp = (Display) displayToLay.getComponent(i);
                ((DisplayLayout) tmp.getLayout()).updateLevel(level);
            }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

abstract void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.validateDeselection ( Display  display) [pure virtual, inherited]

Checks the validity of the deselection.


Parameters:
displaythe display which just has been deselected.

Implemented in fr.ove.openmath.jome.ctrlview.bidim.SymbolLimLayout, fr.ove.openmath.jome.ctrlview.bidim.IntegralLayout, fr.ove.openmath.jome.ctrlview.bidim.BasicStringInfixOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.RootLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsToSigmaLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsArrayLayout, fr.ove.openmath.jome.ctrlview.bidim.LimitLayout, fr.ove.openmath.jome.ctrlview.bidim.EnclosingLayout, fr.ove.openmath.jome.ctrlview.bidim.VarDiffLayout, fr.ove.openmath.jome.ctrlview.bidim.SuperposedOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.DifferentiationLayout, fr.ove.openmath.jome.ctrlview.bidim.LeftAssocPrefixedUnaryOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.ScriptLayout, fr.ove.openmath.jome.ctrlview.bidim.UnaryOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.BetweenOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.OneFormulaLayout, fr.ove.openmath.jome.ctrlview.bidim.LambdaExpLayout, fr.ove.openmath.jome.ctrlview.bidim.RequestLayout, fr.ove.openmath.jome.ctrlview.bidim.SlotLayout, fr.ove.openmath.jome.ctrlview.bidim.Mfd2SubstitutionLayout, fr.ove.openmath.jome.ctrlview.bidim.BinaryInfixOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.StringLayout, fr.ove.openmath.jome.ctrlview.bidim.SeparatorOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.SymbolLayout, fr.ove.openmath.jome.ctrlview.bidim.SubstitutionLayout, fr.ove.openmath.jome.ctrlview.bidim.DenominatorDiffLayout, and fr.ove.openmath.jome.ctrlview.bidim.VerticalListLayout.

Here is the caller graph for this function:

abstract void fr.ove.openmath.jome.ctrlview.bidim.DisplayLayout.validateSelection ( ) [pure virtual, inherited]

Checks the validity of the selection.

Implemented in fr.ove.openmath.jome.ctrlview.bidim.SymbolLimLayout, fr.ove.openmath.jome.ctrlview.bidim.IntegralLayout, fr.ove.openmath.jome.ctrlview.bidim.RootLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsToSigmaLayout, fr.ove.openmath.jome.ctrlview.bidim.LimitLayout, fr.ove.openmath.jome.ctrlview.bidim.BasicStringInfixOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.MapsArrayLayout, fr.ove.openmath.jome.ctrlview.bidim.EnclosingLayout, fr.ove.openmath.jome.ctrlview.bidim.OneFormulaLayout, fr.ove.openmath.jome.ctrlview.bidim.SuperposedOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.VarDiffLayout, fr.ove.openmath.jome.ctrlview.bidim.LambdaExpLayout, fr.ove.openmath.jome.ctrlview.bidim.RequestLayout, fr.ove.openmath.jome.ctrlview.bidim.DifferentiationLayout, fr.ove.openmath.jome.ctrlview.bidim.UnaryOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.LeftAssocPrefixedUnaryOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.Mfd2SubstitutionLayout, fr.ove.openmath.jome.ctrlview.bidim.ScriptLayout, fr.ove.openmath.jome.ctrlview.bidim.BetweenOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.StringLayout, fr.ove.openmath.jome.ctrlview.bidim.SlotLayout, fr.ove.openmath.jome.ctrlview.bidim.SeparatorOperatorLayout, fr.ove.openmath.jome.ctrlview.bidim.SubstitutionLayout, fr.ove.openmath.jome.ctrlview.bidim.SymbolLayout, fr.ove.openmath.jome.ctrlview.bidim.DenominatorDiffLayout, fr.ove.openmath.jome.ctrlview.bidim.VerticalListLayout, and fr.ove.openmath.jome.ctrlview.bidim.BinaryInfixOperatorLayout.

Here is the caller graph for this function:


Member Data Documentation

The display laid out by the instance.

Definition at line 47 of file DisplayLayout.java.

Do we need to insert an operator display ?

Definition at line 47 of file InfixOperatorLayout.java.

The number of the components already present before an other insertion or removal.

This is necessary to keep in mind this, in order to know if we must parse the list of components to check if we have to insert symbol display or not.

Definition at line 55 of file InfixOperatorLayout.java.

The symbol we have to insert between each component if necessary.

Definition at line 44 of file ImageInfixOperatorLayout.java.


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