View Javadoc

1   package fr.ove.openmath.jome.ctrlview.bidim;
2   
3   import java.awt.*;
4   import fr.ove.openmath.jome.ctrlview.bidim.*;
5   import fr.ove.openmath.jome.ctrlview.bidim.selection.events.SelectionEvent;
6   import fr.ove.openmath.jome.model.*;
7   
8   /***
9   * Layout manager that lays the display of the operator whose symbol is located under its operand
10  *
11  * @author © 1999 DIRAT Laurent
12  * @version 2.0 15/12/1999
13  */
14  public abstract class UnderOperatorLayout extends SuperposedOperatorLayout {
15      /***
16      * Computes the size of the display according to its children size (if any),
17      * and its different attributes.
18      * @return the size of the display.
19      */
20      public Dimension computeAttributes() {
21          // La diffÈrence rÈside dans le fait qu'il faut faire en sorte que le display de l'opÈrateur soit affichÈ
22          // en dessous de l'opÈrande
23          Dimension dim = super.computeAttributes(); 
24          
25          Display displayOperator = (Display) displayToLay.getComponent(0);
26          Display operand = (Display) displayToLay.getComponent(1);
27          
28          int ascent = operand.getAscent();
29          
30          displayToLay.setAscent(ascent);
31          displayToLay.setDescent(dim.height - ascent);
32  
33          // Cette taille l? correspond au dÈcalage qu'il faut appliquer ? la barre de fraction
34          displayOperator.setShiftY(operand.getHeight());
35          // Mais il faut l'enlever au display du numÈrateur
36          operand.setShiftY(-displayOperator.getShiftY() - displayOperator.getHeight());
37          
38          displayToLay.setComputeAttributes(false);
39          
40          return dim;
41  
42      
43      }
44  }