View Javadoc

1   /*
2   $Id: StringInfixOperatorLayout.java 705 2005-03-21 16:15:35Z guest $
3   */
4   
5   
6   /*
7   Copyright (C) 2001-2002 Mainline Project (I3S - ESSI - CNRS -UNSA)
8   
9   This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13  
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  Lesser General Public License for more details.
18  
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  
23  For further information on the GNU Lesser General Public License,
24  see: http://www.gnu.org/copyleft/lesser.html
25  For further information on this library, contact: mainline@essi.fr
26  */
27  
28  
29  package fr.ove.openmath.jome.ctrlview.bidim;
30  
31  import java.awt.*;
32  import java.util.*;
33  import fr.ove.openmath.jome.ctrlview.bidim.*;
34  import fr.ove.openmath.jome.model.*;
35  
36  /***
37  * A layout manager for an infix operator which symbol can be rendered as a string (e.g. +, *)
38  *
39  * @author © 1999 DIRAT Laurent
40  * @version 2.0  14/12/1999
41  */
42  public abstract class StringInfixOperatorLayout extends InfixOperatorLayout {    
43      /***
44      * Returns the display of the operator
45      */
46      public Display createOperatorDisplay() {
47          Operator fts = (Operator) displayToLay.getListener();
48          // On crÈÈ un display pour l'opÈrateur.
49          String operator = fts.getTheOperator();
50          String value = BidimDisplayAllocator.resourcesManager.getDisplayString(operator);
51          if(value != null)
52          	operator = value;
53          StringDisplay stringDisplay = new StringDisplay(displayToLay.getGraphicContext(), operator, true);
54          
55          return stringDisplay;
56      }
57  }