Back to index

wims  3.65+svn20090927
Public Member Functions | Package Functions | Package Attributes
Text Class Reference
Inheritance diagram for Text:
Inheritance graph
[legend]
Collaboration diagram for Text:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void yield ()
boolean down (int _x, int _y)
boolean up (int _x, int _y)
boolean drag (int _x, int _y)
boolean key (int key)
void yield ()
boolean down (int _x, int _y)
boolean up (int _x, int _y)
boolean drag (int _x, int _y)
boolean key (int key)

Package Functions

 Text ()
 Text (StringTokenizer tok) throws Exception
void create ()
String describe ()
String specify_text ()
int specify_text_x ()
int specify_text_y ()
int specify_line_x1 ()
int specify_line_y1 ()
int specify_line_x2 ()
int specify_line_y2 ()
void draw (Graphics g)
double distance (int _x, int _y)
 Text ()
 Text (StringTokenizer tok) throws Exception
void create ()
String describe ()
String specify_text ()
int specify_text_x ()
int specify_text_y ()
int specify_line_x1 ()
int specify_line_y1 ()
int specify_line_x2 ()
int specify_line_y2 ()
void draw (Graphics g)
double distance (int _x, int _y)
void destroy ()
void destroy ()
void move ()
void move ()

Package Attributes

String text
StringBuffer buffer
Diagram diagram
int state
final int NONE = 0
final int CREATE = 1
final int MOVE = 2
int x
int y
int w
int h
int movex
int movey

Detailed Description

Definition at line 1037 of file KansBoom.java.


Constructor & Destructor Documentation

Text.Text ( ) [inline, package]

Definition at line 1040 of file KansBoom.java.

           {
       x = y = 0;
       buffer = new StringBuffer();
       text = buffer.toString().concat("_");
    }
Text.Text ( StringTokenizer  tok) throws Exception [inline, package]

Definition at line 1046 of file KansBoom.java.

                                               {
       if(tok.countTokens() < 1){throw new IllegalArgumentException();}
           x = (new Integer(tok.nextToken())).intValue();
           y = (new Integer(tok.nextToken())).intValue();
           text = tok.nextToken("\n\r").trim();

    }
Text.Text ( ) [inline, package]

Definition at line 940 of file VrijeInvulVeld.java.

           {
       x = y = 0;
       buffer = new StringBuffer();
       text = buffer.toString().concat("_");
    }
Text.Text ( StringTokenizer  tok) throws Exception [inline, package]

Definition at line 946 of file VrijeInvulVeld.java.

                                               {
       if(tok.countTokens() < 1){throw new IllegalArgumentException();}
           x = (new Integer(tok.nextToken())).intValue();
           y = (new Integer(tok.nextToken())).intValue();
           text = tok.nextToken("\n\r").trim();

    }

Member Function Documentation

void Text.create ( ) [inline, package]

Reimplemented from DiagramItem.

Definition at line 954 of file VrijeInvulVeld.java.

                  {
       super.create();
       diagram.editor.controls.disable();
       //diagram.editor.showStatus("Press return to finish string");
       diagram.editor.showStatus(VrijeInvulVeld.t_press);
       VrijeInvulVeld.textcounter++;
    }
void Text.create ( ) [inline, package]

Reimplemented from DiagramItem.

Definition at line 1054 of file KansBoom.java.

                  {
       super.create();
       diagram.editor.controls.disable();
       //diagram.editor.showStatus("Press return to finish string");
       diagram.editor.showStatus(KansBoom.t_press);
       KansBoom.textcounter++;
    }
String Text.describe ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 968 of file VrijeInvulVeld.java.

                      {
       return "text," + x + "," + y + "," + text;
    }
String Text.describe ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1068 of file KansBoom.java.

                      {
       return "text," + x + "," + y + "," + text;
    }
void DiagramItem.destroy ( ) [inline, package, inherited]

Definition at line 658 of file VrijeInvulVeld.java.

{}
void DiagramItem.destroy ( ) [inline, package, inherited]

Definition at line 758 of file KansBoom.java.

{}

Here is the caller graph for this function:

double Text.distance ( int  _x,
int  _y 
) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1022 of file VrijeInvulVeld.java.

                                    {
       FontMetrics fm = diagram.editor.display.getGraphics().getFontMetrics();
       int m = y - (fm.getAscent() / 2);
       if(_x < x){return Misc.distance(x, m, _x, _y);}
       int r = x + fm.stringWidth(text);
       if(_x > r){return Misc.distance(r, m, _x, _y);}
       return Math.abs(_y - m);
    }

Here is the call graph for this function:

double Text.distance ( int  _x,
int  _y 
) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1122 of file KansBoom.java.

                                    {
       FontMetrics fm = diagram.editor.display.getGraphics().getFontMetrics();
       int m = y - (fm.getAscent() / 2);
       if(_x < x){return Misc.distance(x, m, _x, _y);}
       int r = x + fm.stringWidth(text);
       if(_x > r){return Misc.distance(r, m, _x, _y);}
       return Math.abs(_y - m);
    }

Here is the call graph for this function:

boolean Text.down ( int  _x,
int  _y 
) [inline]

Reimplemented from DiagramItem.

Definition at line 1031 of file VrijeInvulVeld.java.

                                        {
       switch(state) {
           case CREATE:
           x = _x; y = _y;
           return true;
           
           case MOVE:
           return super.down(_x, _y);
       }
       return false;
    }
boolean Text.down ( int  _x,
int  _y 
) [inline]

Reimplemented from DiagramItem.

Definition at line 1131 of file KansBoom.java.

                                        {
       switch(state) {
           case CREATE:
           x = _x; y = _y;
           return true;
           
           case MOVE:
           return super.down(_x, _y);
       }
       return false;
    }
boolean Text.drag ( int  _x,
int  _y 
) [inline]

Reimplemented from DiagramItem.

Definition at line 1055 of file VrijeInvulVeld.java.

                                        {
       switch(state) {
           case CREATE:
           x = _x; y = _y;
           return true;
           
           case MOVE:
           return super.drag(_x, _y);
       }
       return false;
    }
boolean Text.drag ( int  _x,
int  _y 
) [inline]

Reimplemented from DiagramItem.

Definition at line 1155 of file KansBoom.java.

                                        {
       switch(state) {
           case CREATE:
           x = _x; y = _y;
           return true;
           
           case MOVE:
           return super.drag(_x, _y);
       }
       return false;
    }
void Text.draw ( Graphics  g) [inline, package, virtual]

Implements DiagramItem.

Definition at line 980 of file VrijeInvulVeld.java.

                          {
    //jm.evers
       if(!VrijeInvulVeld.original){
           Graphics2D g2 = (Graphics2D) g;
           int dy=(int) VrijeInvulVeld.ysize / VrijeInvulVeld.ygrid;
           int dx=(int) VrijeInvulVeld.xsize / VrijeInvulVeld.ygrid;
           if(state == 1 || state == 2){//show a temp grid lines
              g2.setColor(VrijeInvulVeld.drawcolor);
              g2.setStroke( new BasicStroke(1.0f));
              if(VrijeInvulVeld.textalign){for(int p=0;p<VrijeInvulVeld.ysize;p=p+dy){g2.drawLine(0,p,VrijeInvulVeld.xsize,p);}}
              else{for(int p=0;p<VrijeInvulVeld.xsize;p=p+dx){g2.drawLine(p,0,p,VrijeInvulVeld.ysize);}}
              g2.setFont(VrijeInvulVeld.penfont);     
           }
           else
           {
              g2.setFont(VrijeInvulVeld.penfont);    
           }
           if(state != 2){ // not while dragging
              if(VrijeInvulVeld.ygrid<50 && VrijeInvulVeld.ygrid>1){
                  if(VrijeInvulVeld.textalign){// then snap to the nearest vertical line...
                     y=dy*((int) (Math.round(y/dy)));
                     if(y<dy){y=dy;}
                     if(y>VrijeInvulVeld.ysize-dy){y=VrijeInvulVeld.ysize-dy;}
                  }
                  else
                  {//snap to the nearest horizontal line...
                     x=dx*((int) (Math.round(x/dx)));
                     if(x<dx){x=dx;}
                     if(x>VrijeInvulVeld.xsize-dx){x=VrijeInvulVeld.xsize-dx;}
                  }
              }
           }
           g2.setColor(VrijeInvulVeld.textcolor);
           g2.setStroke( new BasicStroke(VrijeInvulVeld.thickness));
           g2.drawString(text, x, y);
           g2.setColor(VrijeInvulVeld.drawcolor);
       }
       else
       {
           g.drawString(text, x, y);
       }
    }
void Text.draw ( Graphics  g) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1080 of file KansBoom.java.

                          {
    //jm.evers
       if(!KansBoom.original){
           Graphics2D g2 = (Graphics2D) g;
           int dy=(int) KansBoom.ysize / KansBoom.ygrid;
           int dx=(int) KansBoom.xsize / KansBoom.ygrid;
           if(state == 1 || state == 2){//show a temp grid lines
              g2.setColor(KansBoom.drawcolor);
              g2.setStroke( new BasicStroke(1.0f));
              if(KansBoom.textalign){for(int p=0;p<KansBoom.ysize;p=p+dy){g2.drawLine(0,p,KansBoom.xsize,p);}}
              else{for(int p=0;p<KansBoom.xsize;p=p+dx){g2.drawLine(p,0,p,KansBoom.ysize);}}
              g2.setFont(KansBoom.zoomfont);     
           }
           else
           {
              g2.setFont(KansBoom.penfont);    
           }
           if(state != 2){ // not while dragging
              if(KansBoom.ygrid<50 && KansBoom.ygrid>1){
                  if(KansBoom.textalign){// then snap to the nearest vertical line...
                     y=dy*((int) (Math.round(y/dy)));
                     if(y<dy){y=dy;}
                     if(y>KansBoom.ysize-dy){y=KansBoom.ysize-dy;}
                  }
                  else
                  {//snap to the nearest horizontal line...
                     x=dx*((int) (Math.round(x/dx)));
                     if(x<dx){x=dx;}
                     if(x>KansBoom.xsize-dx){x=KansBoom.xsize-dx;}
                  }
              }
           }
           g2.setColor(KansBoom.textcolor);
           g2.setStroke( new BasicStroke(KansBoom.thickness));
           g2.drawString(text, x, y);
           g2.setColor(KansBoom.drawcolor);
       }
       else
       {
           g.drawString(text, x, y);
       }
    }
boolean Text.key ( int  key) [inline]

Reimplemented from DiagramItem.

Definition at line 1067 of file VrijeInvulVeld.java.

                                {
       char c[] = new char[1];
       switch(state) {
           case CREATE:
           switch(key) {
              case 10:/* LF */

              case 13:/* CR */
              yield();
              if(text.equals("")){
                  diagram.removeElement(this);
                  destroy();
                  diagram.editor.showStatus("String was empty");
              }
              else
                  diagram.editor.showStatus("");
                  return true;
              
              case 8:/* BS */
              case 127:/* DEL */
              int l = buffer.length();
           if(l > 0)
              buffer.setLength(l - 1);
              break;
    
              default:
              buffer.append((char)key);
              break;
           }
           text = buffer.toString().concat("_");
           return true;
       }
       return false;
    }

Here is the call graph for this function:

boolean Text.key ( int  key) [inline]

Reimplemented from DiagramItem.

Definition at line 1167 of file KansBoom.java.

                                {
       char c[] = new char[1];
       switch(state) {
           case CREATE:
           switch(key) {
              case 10:/* LF */

              case 13:/* CR */
              yield();
              if(text.equals("")){
                  diagram.removeElement(this);
                  destroy();
                  diagram.editor.showStatus("String was empty");
              }
              else
                  diagram.editor.showStatus("");
                  return true;
              
              case 8:/* BS */
              case 127:/* DEL */
              int l = buffer.length();
           if(l > 0)
              buffer.setLength(l - 1);
              break;
    
              default:
              buffer.append((char)key);
              break;
           }
           text = buffer.toString().concat("_");
           return true;
       }
       return false;
    }

Here is the call graph for this function:

void DiagramItem.move ( ) [inline, package, inherited]

Definition at line 660 of file VrijeInvulVeld.java.

                {
       state = MOVE;
    }
void DiagramItem.move ( ) [inline, package, inherited]

Definition at line 760 of file KansBoom.java.

                {
       state = MOVE;
    }

Here is the caller graph for this function:

int Text.specify_line_x1 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 974 of file VrijeInvulVeld.java.

{return -1;}
int Text.specify_line_x1 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1074 of file KansBoom.java.

{return -1;}
int Text.specify_line_x2 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 976 of file VrijeInvulVeld.java.

{return -1;}
int Text.specify_line_x2 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1076 of file KansBoom.java.

{return -1;}
int Text.specify_line_y1 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 975 of file VrijeInvulVeld.java.

{return -1;}
int Text.specify_line_y1 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1075 of file KansBoom.java.

{return -1;}
int Text.specify_line_y2 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 977 of file VrijeInvulVeld.java.

{return -1;}
int Text.specify_line_y2 ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1077 of file KansBoom.java.

{return -1;}
String Text.specify_text ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 971 of file VrijeInvulVeld.java.

{return text; }
String Text.specify_text ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1071 of file KansBoom.java.

{return text; }
int Text.specify_text_x ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 972 of file VrijeInvulVeld.java.

{return x; }
int Text.specify_text_x ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1072 of file KansBoom.java.

{return x; }
int Text.specify_text_y ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 973 of file VrijeInvulVeld.java.

{return y; }
int Text.specify_text_y ( ) [inline, package, virtual]

Implements DiagramItem.

Definition at line 1073 of file KansBoom.java.

{return y; }
boolean Text.up ( int  _x,
int  _y 
) [inline]

Reimplemented from DiagramItem.

Definition at line 1043 of file VrijeInvulVeld.java.

                                      {
       switch(state) {
           case CREATE:
           x = _x; y = _y;
           return true;
           
           case MOVE:
           return super.up(_x, _y);    
       }
       return false;
    }
boolean Text.up ( int  _x,
int  _y 
) [inline]

Reimplemented from DiagramItem.

Definition at line 1143 of file KansBoom.java.

                                      {
       switch(state) {
           case CREATE:
           x = _x; y = _y;
           return true;
           
           case MOVE:
           return super.up(_x, _y);    
       }
       return false;
    }
void Text.yield ( ) [inline]

Reimplemented from DiagramItem.

Definition at line 962 of file VrijeInvulVeld.java.

                        {
       super.yield();
       diagram.editor.controls.enable();
       text = buffer.toString();
    }
void Text.yield ( ) [inline]

Reimplemented from DiagramItem.

Definition at line 1062 of file KansBoom.java.

                        {
       super.yield();
       diagram.editor.controls.enable();
       text = buffer.toString();
    }

Here is the caller graph for this function:


Member Data Documentation

StringBuffer Text.buffer [package]

Definition at line 1039 of file KansBoom.java.

final int DiagramItem.CREATE = 1 [package, inherited]

Definition at line 723 of file KansBoom.java.

Diagram DiagramItem.diagram [package, inherited]

Definition at line 721 of file KansBoom.java.

int DiagramItem.h [package, inherited]

Definition at line 724 of file KansBoom.java.

final int DiagramItem.MOVE = 2 [package, inherited]

Definition at line 723 of file KansBoom.java.

int DiagramItem.movex [package, inherited]

Definition at line 725 of file KansBoom.java.

int DiagramItem.movey [package, inherited]

Definition at line 725 of file KansBoom.java.

final int DiagramItem.NONE = 0 [package, inherited]

Definition at line 723 of file KansBoom.java.

int DiagramItem.state [package, inherited]

Definition at line 722 of file KansBoom.java.

String Text.text [package]

Definition at line 1038 of file KansBoom.java.

int DiagramItem.w [package, inherited]

Definition at line 724 of file KansBoom.java.

int DiagramItem.x [package, inherited]

Definition at line 724 of file KansBoom.java.

int DiagramItem.y [package, inherited]

Definition at line 724 of file KansBoom.java.


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