Back to index

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

The curly bracket. More...

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

List of all members.

Public Member Functions

 CurlySymbol (boolean isLeftBracket, int heightExtremities, ImageObserver observer)
 The constructor.
void paint (Graphics g)
 The paint method of the object to display.
Dimension getPreferredSize ()
 Returns the preferred size of the display.
void setGraphicContext (GraphicContext graphicContext)
 Sets the graphic context in which the object is.
void setAscent (int ascent)
 Sets the ascent.
int getAscent ()
 Returns the ascent.
void setDescent (int descent)
 Sets the descent.
int getDescent ()
 Returns the descent.
void setShiftX (int shiftX)
 Sets the horizontal shift.
int getShiftX ()
 Returns the horizontal shift.
void setShiftY (int shiftY)
 Sets the vertical shift.
int getShiftY ()
 Returns the vertical shift.
void setAttributes (int ascent, int descent, int shiftX, int shiftY)
 Sets all the attributes.
GraphicContext getGraphicContext ()
 Returns the graphic context of the instance.
void setX (int x)
 Sets the x-location of the instance.
int getX ()
 Returns the x-location of the instance.
void setY (int y)
 Sets the y-location of the instance.
int getY ()
 Returns the y-location of the instance.
void setLocation (int x, int y)
 Sets the location of the instance.
void setLocation (Point location)
 Sets the location of the instance.
Point getLocation ()
 Returns the location of the instance.
int getWidth ()
 Returns the width of the instance.
void setWidth (int width)
 Sets the width of the instance.
int getHeight ()
 Returns the height of the instance.
void setHeight (int height)
 Sets the height of the instance.
Dimension getSize ()
 Returns the size of the instance.
void setSize (int width, int height)
 Sets the size of the instance.
void setSize (Dimension size)
 Sets the size of the instance.

Package Attributes

ImageObserver observer
 Object to be notified as more of the image is converted.

Private Attributes

Image topInit
 The initial images which are parts of the representation of the curly bracket.
Image middleInit
Image bottomInit
Image barInit
Image top
 The scale images of the initials ones.
Image middle
Image bottom
Image bar
int heightExtremities
 The height of the top and the bottom of the symbol.

Detailed Description

The curly bracket.

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

Definition at line 43 of file CurlySymbol.java.


Constructor & Destructor Documentation

fr.ove.openmath.jome.ctrlview.bidim.CurlySymbol.CurlySymbol ( boolean  isLeftBracket,
int  heightExtremities,
ImageObserver  observer 
) [inline]

The constructor.

Parameters:
isLeftBrackettrue if the instance represents a left bracket. false otherwise.
heightExtremitiesthe height of the extremities of the bracket.
observerthe object to be notified as more of the image is converted.

Definition at line 81 of file CurlySymbol.java.

                                                                                             {
        if (isLeftBracket) {
            topInit = ImageLoader.getImage("LeftTopCurl");
            middleInit = ImageLoader.getImage("LeftMiddleCurl");
            bottomInit = ImageLoader.getImage("LeftBottomCurl");
            barInit = ImageLoader.getImage("LeftBarCurl");
        }
        else {
            topInit = ImageLoader.getImage("RightTopCurl");
            middleInit = ImageLoader.getImage("RightMiddleCurl");
            bottomInit = ImageLoader.getImage("RightBottomCurl");
            barInit = ImageLoader.getImage("RightBarCurl");
        }

        this.heightExtremities = heightExtremities;
        this.observer = observer;
    }

Here is the call graph for this function:


Member Function Documentation

Returns the ascent.

Returns:
the ascent.

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

Definition at line 122 of file DisplayableImpl.java.

                           {
        return ascent;
    }

Here is the caller graph for this function:

Returns the descent.

Returns:
the descent.

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

Definition at line 138 of file DisplayableImpl.java.

                            {
        return descent;
    }

Returns the graphic context of the instance.

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

Definition at line 202 of file DisplayableImpl.java.

                                              {
        return graphicContext;
    }

Here is the caller graph for this function:

Returns the height of the instance.

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

Definition at line 291 of file DisplayableImpl.java.

                           {
        return bounds.height;
    }

Here is the caller graph for this function:

Returns the location of the instance.

Returns:
A Point representing the location of the instance.

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

Definition at line 263 of file DisplayableImpl.java.

                               {
        return bounds.getLocation();
    }

Returns the preferred size of the display.

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

Definition at line 127 of file CurlySymbol.java.

                                        {
              MediaTracker tracker = new MediaTracker((Component) observer);
              
              // La hauteur de la partie du milieu est égale à environ 2 fois les extrémités.
              
        // Le -1 signifie que la largeur sera proportionnelle à la hauteur.
        top = topInit.getScaledInstance(-1, heightExtremities, Image.SCALE_SMOOTH);
        tracker.addImage(top, 0);
        middle = middleInit.getScaledInstance(-1, heightExtremities*2, Image.SCALE_SMOOTH);
        tracker.addImage(middle, 0);
        bottom = bottomInit.getScaledInstance(-1, heightExtremities, Image.SCALE_SMOOTH);
        tracker.addImage(bottom, 0);
        bar = barInit.getScaledInstance(-1, heightExtremities, Image.SCALE_SMOOTH);
        tracker.addImage(bar, 0);
        
        // On attend que toutes les images soient chargées.
              try { tracker.waitForAll(); }
              catch (InterruptedException e) {
                  System.out.println(e.toString());
              }
              
        tracker.removeImage(top);
        tracker.removeImage(middle);
        tracker.removeImage(bottom);
        tracker.removeImage(bar);

        return new Dimension(top.getWidth(observer) + 6, getHeight());
    }

Here is the call graph for this function:

Returns the horizontal shift.

Returns:
the horizontal shift.

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

Definition at line 154 of file DisplayableImpl.java.

                           {
        return shiftX;
    }

Returns the vertical shift.

Returns:
the vertical shift.

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

Definition at line 170 of file DisplayableImpl.java.

                           {
        return shiftY;
    }

Returns the size of the instance.

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

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

Definition at line 306 of file DisplayableImpl.java.

                               {
        return bounds.getSize();
    }

Here is the caller graph for this function:

Returns the width of the instance.

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

Definition at line 276 of file DisplayableImpl.java.

                          {
        return bounds.width;
    }

Here is the caller graph for this function:

Returns the x-location of the instance.

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

Definition at line 223 of file DisplayableImpl.java.

                      {
        return bounds.x;
    }

Returns the y-location of the instance.

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

Definition at line 238 of file DisplayableImpl.java.

                      {
        return bounds.y;
    }

The paint method of the object to display.

Parameters:
gthe drawing area of the symbol.

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

Definition at line 103 of file CurlySymbol.java.

                                  {
        int height = getHeight();
        
        // On dessine la partie supérieure de l'accolade
        g.drawImage(top, 3, 0, observer);
        
        // On dessine les "barres", i.e. la partie que l'on va faire croitre pour ajuster correctement
        // la taille de l'accolade
        for (int i = heightExtremities; i < height - heightExtremities; i += heightExtremities)
            g.drawImage(bar, 3, i, observer);
        
        // On dessine la partie inférieure de l'accolade
        g.drawImage(bottom, 3, height - heightExtremities, observer);
        
        // On dessine la partie centrale de l'accolade
        // On essaie de faire en sorte que le milieu de l'accolade se trouve un peu au dessus de la baseline
        // Par exemple, aligné avec le +. La barre horizontale du + se trouve grosso modo à la moitié de
        // son ascent. Il se trouve que c'est la hauteur de middle.
        g.drawImage(middle, 3, getAscent() - middle.getHeight(observer), observer);
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setAscent ( int  ascent) [inline, inherited]

Sets the ascent.

Parameters:
ascentthe new ascent value.

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

Definition at line 114 of file DisplayableImpl.java.

                                      {
        this.ascent = ascent;
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setAttributes ( int  ascent,
int  descent,
int  shiftX,
int  shiftY 
) [inline, inherited]

Sets all the attributes.

Parameters:
ascentthe new ascent value.
descentthe new descent value.
shiftXthe new horizontal shift value.
shiftYthe new vertical shift value.

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

Definition at line 181 of file DisplayableImpl.java.

                                                                               {
        this.ascent = ascent;
        this.descent = descent;
        this.shiftX = shiftX;
        this.shiftY = shiftY;
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setDescent ( int  descent) [inline, inherited]

Sets the descent.

Parameters:
descentthe new descent value.

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

Definition at line 130 of file DisplayableImpl.java.

                                        {
        this.descent = descent;
    }

Here is the caller graph for this function:

Sets the graphic context in which the object is.

Parameters:
graphicContextthe object graphic context. Actually, this methods gives information to the object, notably when its preferred size is required. If the context has changed, the displayable object must be informed. However, in the most part of the time, the whole graphic context won't be necessary to be stored, but only specific and usefull data.

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

Definition at line 164 of file CurlySymbol.java.

                                                                 {
        super.setGraphicContext(graphicContext);
        // Surcharge de cette méthode pour que l'on puisse récupérer en fonction du contexte graphique
        // du symbole, la hauteur des extrémité de l'accolade.
        FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(graphicContext.getFont());
        heightExtremities = fm.getHeight() / 4;
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setHeight ( int  height) [inline, inherited]

Sets the height of the instance.

Parameters:
heightthe height of the instance

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

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

Definition at line 299 of file DisplayableImpl.java.

                                      {
        bounds.height = height;
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setLocation ( int  x,
int  y 
) [inline, inherited]

Sets the location of the instance.

Parameters:
xthe x-location of the instance.
ythe y-location of the instance.

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

Definition at line 247 of file DisplayableImpl.java.

                                          {
        bounds.setLocation(x, y);
    }

Sets the location of the instance.

Parameters:
locationthe location of the instance.

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

Definition at line 255 of file DisplayableImpl.java.

                                            {
        bounds.setLocation(location);
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setShiftX ( int  shiftX) [inline, inherited]

Sets the horizontal shift.

Parameters:
shiftXthe new horizontal shift value.

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

Definition at line 146 of file DisplayableImpl.java.

                                      {
        this.shiftX = shiftX;
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setShiftY ( int  shiftY) [inline, inherited]

Sets the vertical shift.

Parameters:
shiftYthe new vertical shift value.

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

Definition at line 162 of file DisplayableImpl.java.

                                      {
        this.shiftY = shiftY;
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setSize ( int  width,
int  height 
) [inline, inherited]

Sets the size of the instance.

Parameters:
widththe width of the instance.
heightthe height of the instance

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

Definition at line 315 of file DisplayableImpl.java.

                                               {
        bounds.setSize(width, height);
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setSize ( Dimension  size) [inline, inherited]

Sets the size of the instance.

Parameters:
sizethe size of the instance.

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

Definition at line 323 of file DisplayableImpl.java.

                                        {
        bounds.setSize(size);
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setWidth ( int  width) [inline, inherited]

Sets the width of the instance.

Parameters:
widththe width of the instance

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

Definition at line 284 of file DisplayableImpl.java.

                                    {
        bounds.width = width;
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setX ( int  x) [inline, inherited]

Sets the x-location of the instance.

Parameters:
xthe x-location of the instance.

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

Definition at line 216 of file DisplayableImpl.java.

                            {
        bounds.x = x;
    }
void fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl.setY ( int  y) [inline, inherited]

Sets the y-location of the instance.

Parameters:
ythe y-location of the instance.

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

Definition at line 231 of file DisplayableImpl.java.

                            {
        bounds.y = y;
    }

Member Data Documentation

Definition at line 62 of file CurlySymbol.java.

Definition at line 54 of file CurlySymbol.java.

Definition at line 61 of file CurlySymbol.java.

Definition at line 53 of file CurlySymbol.java.

The height of the top and the bottom of the symbol.

Definition at line 67 of file CurlySymbol.java.

Definition at line 60 of file CurlySymbol.java.

Definition at line 52 of file CurlySymbol.java.

Object to be notified as more of the image is converted.

Definition at line 72 of file CurlySymbol.java.

The scale images of the initials ones.

Definition at line 59 of file CurlySymbol.java.

The initial images which are parts of the representation of the curly bracket.


The curly bracket is made of 4 parts : top, middle, bottom and bar.
The top, middle and bottom are unique during the rendering, and according to the height of the bracketted display, mutiple instance of the bar are displayed to give the right size to the curly bracket.

Definition at line 51 of file CurlySymbol.java.


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