Back to index

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

List of all members.

Public Member Functions

void init ()
Color ReturnColor (String RGB)
String ReadApplet (String arg)
void start ()
void stop ()
void destroy ()

Static Public Member Functions

static String replace (String source, String pattern, String replace)
static void main (String argv[])

Public Attributes

String t_line = "Line"
String t_arrow = "Arrow"
String t_rectangle = "Rectangle"
String t_ellipse = "Ellipse"
String t_text = "Text"
String t_circle = "Circle"
String t_destroy = "Delete"
String t_move = "Move"

Package Attributes

Diagram diagram
DiagramControls controls
DiagramDisplay display
MessageArea message
EventConsumer current_event_consumer

Static Package Attributes

static int xsize = 640
static int ysize = 480
static int ygrid = 50
static Color bgcolor = new Color(250,250,250)
static Color textcolor = new Color(255,0,0)
static Color drawcolor = new Color(150,0,250)
static float thickness = 2.0f
static int penfontsize = 16
static String fontfamily = "Helvetica"
static Font penfont = new Font(fontfamily, Font.BOLD, penfontsize)
static Font messagefont = new Font(fontfamily, Font.BOLD,16)
static String t_press = "Press return to finish the text"
static boolean textalign = false
static int textcounter = 0
static int linecounter = 0
static boolean original = false
static boolean draw_line = true
static boolean draw_text = true
static boolean draw_arrow = true
static boolean draw_ellipse = true
static boolean draw_rect = true

Detailed Description

Definition at line 46 of file VrijeInvulVeld.java.


Member Function Documentation

void VrijeInvulVeld.destroy ( ) [inline]

Definition at line 378 of file VrijeInvulVeld.java.

                          {
    }
void VrijeInvulVeld.init ( ) [inline]

Definition at line 85 of file VrijeInvulVeld.java.

                       {
       String param;
       param = getParameter("language");
       if(param != null) {
           if(param.equalsIgnoreCase("nl")){
              t_line="lijn";
              t_arrow="pijl";
              t_rectangle="rechthoek";
              t_ellipse="ellips";
              t_text="tekst";
              t_circle="cirkel";
              t_destroy="wissen";
              t_move="verplaatsen";
              t_press="Druk op enter als de tekst klaar is";
           }
           if(param.equalsIgnoreCase("de")){
              t_line="Linie";
              t_arrow="Pfeil";
              t_rectangle="Rechteck";
              t_ellipse="Ellipse";
              t_text="Text";
              t_circle="Kreis";
              t_destroy="löschen";
              t_move="verlagern";
              t_press="Drücken Sie auf \"Eingabe\" am Ende des Textes";
           }
           if(param.equalsIgnoreCase("fr")){
              t_line="droite";
              t_arrow="flèche";
              t_rectangle="rectangle";
              t_ellipse="ellips";
              t_text="texte";
              t_circle="cercle ";
              t_destroy="effacer";
              t_move="déplacer";
              t_press="Press return to finish the text";
           }
       }
       param = getParameter("line");
       if(param != null){if(param.equalsIgnoreCase("no") || param.equals("0")){draw_line=false;}}
       param = getParameter("rect");
       if(param != null){if(param.equalsIgnoreCase("no") || param.equals("0")){draw_rect=false;}}
       param = getParameter("arrow");
       if(param != null){if(param.equalsIgnoreCase("no") || param.equals("0")){draw_arrow=false;}}
       param = getParameter("text");
       if(param != null){if(param.equalsIgnoreCase("no") || param.equals("0")){draw_text=false;}}
       param = getParameter("ellipse");
       if(param != null){if(param.equalsIgnoreCase("no") || param.equals("0")){draw_ellipse=false;}}
       param = getParameter("penfontsize");
       if(param != null) {penfontsize=Integer.parseInt(param,10); penfont= new Font("Helvetica", Font.BOLD, penfontsize);}
       param = getParameter("penfontfamily");
       if(param != null) {penfont= new Font(param, Font.BOLD, penfontsize);}
       param = getParameter("penfontstyle");
       if(param != null) {
           if(param.equalsIgnoreCase("bold")){penfont= new Font(param, Font.BOLD , penfontsize);}
           else if(param.equalsIgnoreCase("italic")){penfont= new Font(param, Font.ITALIC , penfontsize);}
           else if(param.equalsIgnoreCase("plain")){penfont= new Font(param, Font.PLAIN , penfontsize);}
       }
       param = getParameter("penthickness");
       if(param != null) {thickness=Float.parseFloat(param);}
       param = getParameter("xsize");
       if(param != null) {xsize=Integer.parseInt(param,10);}
       param = getParameter("ysize");
       if(param != null) {ysize=Integer.parseInt(param,10);}
       param = getParameter("textlines");
       if(param != null) {ygrid=Integer.parseInt(param,10);
           if(ygrid>100){ygrid=100;System.out.println("100 lines max !");}
           if(ygrid<0){ygrid=10;System.out.println("positive number textlines !");}
       }
       param = getParameter("textalign");
       if(param == null || param.length()==0){original=true;}else{original=false;if(param.equalsIgnoreCase("vertical")){textalign=true;}else{textalign=false;}}
       resize(xsize,ysize);
       param=getParameter("bgcolor"); // Background color of inputfield "input"
       if (param != null && param.length()>0){bgcolor=ReturnColor(param);}
       param=getParameter("textcolor"); // Background color of inputfield "input"
       if (param != null && param.length()>0){textcolor=ReturnColor(param);}
       param=getParameter("drawcolor"); // Background color of inputfield "input"
       if (param != null && param.length()>0){drawcolor=ReturnColor(param);}
       
       diagram = new Diagram();
       diagram.editor = this;
       // no idea how to tell this class that the names are passed on as params in init...
       add(controls = new DiagramControls(this ,t_line,t_arrow,t_rectangle,t_ellipse,t_text,t_circle,t_destroy,t_move));
       add(display = new DiagramDisplay(this ,thickness,textcolor,drawcolor,penfont));
       current_event_consumer = controls;
       
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static void VrijeInvulVeld.main ( String  argv[]) [inline, static]

Definition at line 381 of file VrijeInvulVeld.java.

                                           {
       /* This more-or-less replicates what happens when we  are run as an applet. */
       Frame f = new Frame();
       VrijeInvulVeld d = new VrijeInvulVeld();
       d.init();
       d.start();
       f.add("Center", d);
       f.show();
    }

Here is the call graph for this function:

String VrijeInvulVeld.ReadApplet ( String  arg) [inline]

Definition at line 193 of file VrijeInvulVeld.java.

                                        {
       String reply="";
       if(arg.equals("1")){
           String line_analysis="";
           int[] text_x=new int[textcounter];
           int[] text_y=new int[textcounter];
           int[] line_x1=new int[linecounter];
           int[] line_y1=new int[linecounter];
           int[] line_x2=new int[linecounter];
           int[] line_y2=new int[linecounter];
           String[] tekst=new String[textcounter];
           int real_text_length=0;String tmp="";
           int real_line_length=0;int x1;int x2;int y1;int y2;
           for(Enumeration e = diagram.elements(); e.hasMoreElements(); ){                                                                            
              DiagramItem item = (DiagramItem)e.nextElement();
              if(item.specify_line_x1() != -1){
                  x1=item.specify_line_x1();
                  y1=item.specify_line_y1();
                  x2=item.specify_line_x2();
                  y2=item.specify_line_y2();
                  if(textalign){//alleen horizontale lijnen
                     if( x1 != x2 && y1 == y2){// avoid line-dots to be send as lines/branches
                         line_x1[real_line_length] = x1;
                         line_y1[real_line_length] = y1;
                         line_x2[real_line_length] = x2;
                         line_y2[real_line_length] = y2;
                         real_line_length++;
                         System.out.println("een horizontale lijn "+real_line_length);
                     }
                  }
                  else
                  {
                     if( y1 != y2 && x1 == x2 ){// avoid line-dots to be send as lines/branches
                         line_x1[real_line_length] = x1;
                         line_y1[real_line_length] = y1;
                         line_x2[real_line_length] = x2;
                         line_y2[real_line_length] = y2;
                         real_line_length++;
                         System.out.println("een vertikale lijn "+real_line_length);
                     }
                  }
              }
              if(item.specify_text() != null){
                  tmp = item.specify_text();
                  // remove the forgotten '_' and we can't use komma's in the reply...replace them by points ?
                  tmp =replace(tmp,"_"," ");
                  tekst[real_text_length] =replace(tmp,",",".");
                  text_x[real_text_length] = item.specify_text_x();
                  text_y[real_text_length] = item.specify_text_y();
                  real_text_length++;
              }
           }
           
           boolean nog_meer = true;int i=0;int s=0;int temp_x;int temp_y;String temp_txt;
           String[] sameline = new String[real_text_length];
           FontMetrics fm =getFontMetrics(penfont);                                                                                       
            int hoogte = fm.getMaxAscent();
           if(textalign){//horizonal probability tree
              while (nog_meer) {
                  nog_meer = false;
                  for ( i=0; i<real_text_length-1; i++ ){
                     if ( text_y[i] < text_y[i+1] ){ sameline[i]="\n";}
                     if ( text_y[i] > text_y[i+1] ){
                         temp_y = text_y[i]; text_y[i] = text_y[i+1];  text_y[i+1] = temp_y;
                         temp_x = text_x[i];  text_x[i] = text_x[i+1];  text_x[i+1] = temp_x;
                         temp_txt = tekst[i];  tekst[i] = tekst[i+1];  tekst[i+1] = temp_txt;
                         nog_meer = true;
                         sameline[i]="\n";
                     }
                     if ( text_y[i] == text_y[i+1] ){
                         sameline[i]=" ";
                         if( text_x[i] > text_x[i+1] ){
                            temp_y = text_y[i]; text_y[i] = text_y[i+1];  text_y[i+1] = temp_y;
                             temp_x = text_x[i]; text_x[i] = text_x[i+1];  text_x[i+1] = temp_x;
                             temp_txt = tekst[i]; tekst[i] = tekst[i+1];  tekst[i+1] = temp_txt;
                            nog_meer = true;
                         }
                     }
                  }
              }
           }
           else
           {//vertical probability tree
              while (nog_meer) {
                  nog_meer = false;
                  for ( i=0; i<real_text_length-1; i++ ){
                     if ( text_x[i] < text_x[i+1] ){ sameline[i]="\n";}
                     if ( text_x[i] > text_x[i+1] ){
                         temp_y = text_y[i]; text_y[i] = text_y[i+1];  text_y[i+1] = temp_y;
                         temp_x = text_x[i];  text_x[i] = text_x[i+1];  text_x[i+1] = temp_x;
                         temp_txt = tekst[i];  tekst[i] = tekst[i+1];  tekst[i+1] = temp_txt;
                         nog_meer = true;
                         sameline[i]="\n";
                     }
                     if ( text_x[i] == text_x[i+1] ){
                         sameline[i]=" ";
                         if( text_y[i] > text_y[i+1] ){
                            temp_y = text_y[i]; text_y[i] = text_y[i+1];  text_y[i+1] = temp_y;
                             temp_x = text_x[i]; text_x[i] = text_x[i+1];  text_x[i+1] = temp_x;
                             temp_txt = tekst[i];  tekst[i] = tekst[i+1];  tekst[i+1] = temp_txt;
                            nog_meer = true;
                         }
                     }
                  }
              }
           
           }
           int wacht=0;
           if(textalign){
              for(i=0;i<real_line_length;i++){
                  y1=line_y1[i];
                  for(s=0;s<real_text_length;s++){
                     if(text_y[s]==y1 ||( text_y[s]<y1 && text_y[s]>y1-hoogte)){
                         wacht=s;
                     }
                  }
                  if(wacht!=0){
                     sameline[wacht]="\n line \n";
                     wacht=0;
                  }
              }
           }
           else
           {
              for(i=0;i<real_line_length;i++){
                  x1=line_x1[i];
                  x2=line_x2[i];
                  y1=line_y1[i];
                  y2=line_y2[1];
                  if(x1<x2+hoogte && x1>x2-hoogte){
                  // dus een "bijna vertikale lijn
                     for(s=0;s<real_text_length;s++){
                         if(text_y[s]==y1 ||( text_y[s]<y1 && text_y[s]>y1-hoogte)){
                            wacht=s;
                         }
                     }
                     if(wacht!=0){
                         sameline[wacht]="\n vertikale line \n";
                         wacht=0;
                     }
                  }
              }
           }

           for(i=0;i<real_text_length;i++){
              if(sameline[i] == null){sameline[i]="\n";}
              reply=reply+tekst[i]+sameline[i];
           }
       }
       else
       {
           //alldata...no special sorting of the text
           for(Enumeration e = diagram.elements(); e.hasMoreElements(); ){                                                                            
              DiagramItem item = (DiagramItem)e.nextElement();
              reply=reply+item.describe()+"\n";
           }
        }

       return reply;
    }

Here is the call graph for this function:

static String VrijeInvulVeld.replace ( String  source,
String  pattern,
String  replace 
) [inline, static]

Definition at line 355 of file VrijeInvulVeld.java.

                                                                               {
       if (source!=null){
           final int len = pattern.length();
           StringBuffer sb = new StringBuffer();
           int found = -1;
           int start = 0;
           while( (found = source.indexOf(pattern, start) ) != -1){
              sb.append(source.substring(start, found));
              sb.append(replace);
              start = found + len;
           }
           sb.append(source.substring(start));
           return sb.toString();
       }
        else return "";
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Color VrijeInvulVeld.ReturnColor ( String  RGB) [inline]

Definition at line 175 of file VrijeInvulVeld.java.

                                        {
       int R=0;int G=0;int B=0;
       RGB=RGB.replace(':',',');RGB=RGB.replace(';',',');
       StringTokenizer q = new StringTokenizer(RGB, ",");
       String k;int rgb;Color kleur;
       for( int a=0; a<3 ; a++){
           k=q.nextToken();
           rgb=Integer.parseInt(k, 10);
           if(rgb<0){rgb=0;}
           if(rgb>255){rgb=255;}
           if(a == 0){R = rgb;}
           else if(a == 1){G = rgb;}
           else if(a == 2){B = rgb;}
       }
       kleur=new Color(R,G,B);
       return kleur;
    }

Here is the caller graph for this function:

void VrijeInvulVeld.start ( ) [inline]

Definition at line 372 of file VrijeInvulVeld.java.

                        {
    }

Here is the caller graph for this function:

void VrijeInvulVeld.stop ( ) [inline]

Definition at line 375 of file VrijeInvulVeld.java.

                       {
    }

Member Data Documentation

Color VrijeInvulVeld.bgcolor = new Color(250,250,250) [static, package]

Definition at line 57 of file VrijeInvulVeld.java.

Definition at line 48 of file VrijeInvulVeld.java.

Definition at line 51 of file VrijeInvulVeld.java.

Definition at line 47 of file VrijeInvulVeld.java.

Definition at line 49 of file VrijeInvulVeld.java.

boolean VrijeInvulVeld.draw_arrow = true [static, package]

Definition at line 80 of file VrijeInvulVeld.java.

Definition at line 81 of file VrijeInvulVeld.java.

boolean VrijeInvulVeld.draw_line = true [static, package]

Definition at line 78 of file VrijeInvulVeld.java.

boolean VrijeInvulVeld.draw_rect = true [static, package]

Definition at line 82 of file VrijeInvulVeld.java.

boolean VrijeInvulVeld.draw_text = true [static, package]

Definition at line 79 of file VrijeInvulVeld.java.

Color VrijeInvulVeld.drawcolor = new Color(150,0,250) [static, package]

Definition at line 59 of file VrijeInvulVeld.java.

String VrijeInvulVeld.fontfamily = "Helvetica" [static, package]

Definition at line 62 of file VrijeInvulVeld.java.

int VrijeInvulVeld.linecounter = 0 [static, package]

Definition at line 76 of file VrijeInvulVeld.java.

Definition at line 50 of file VrijeInvulVeld.java.

Font VrijeInvulVeld.messagefont = new Font(fontfamily, Font.BOLD,16) [static, package]

Definition at line 64 of file VrijeInvulVeld.java.

boolean VrijeInvulVeld.original = false [static, package]

Definition at line 77 of file VrijeInvulVeld.java.

Font VrijeInvulVeld.penfont = new Font(fontfamily, Font.BOLD, penfontsize) [static, package]

Definition at line 63 of file VrijeInvulVeld.java.

int VrijeInvulVeld.penfontsize = 16 [static, package]

Definition at line 61 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_arrow = "Arrow"

Definition at line 66 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_circle = "Circle"

Definition at line 70 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_destroy = "Delete"

Definition at line 71 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_ellipse = "Ellipse"

Definition at line 68 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_line = "Line"

Definition at line 65 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_move = "Move"

Definition at line 72 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_press = "Press return to finish the text" [static, package]

Definition at line 73 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_rectangle = "Rectangle"

Definition at line 67 of file VrijeInvulVeld.java.

String VrijeInvulVeld.t_text = "Text"

Definition at line 69 of file VrijeInvulVeld.java.

boolean VrijeInvulVeld.textalign = false [static, package]

Definition at line 74 of file VrijeInvulVeld.java.

Color VrijeInvulVeld.textcolor = new Color(255,0,0) [static, package]

Definition at line 58 of file VrijeInvulVeld.java.

int VrijeInvulVeld.textcounter = 0 [static, package]

Definition at line 75 of file VrijeInvulVeld.java.

float VrijeInvulVeld.thickness = 2.0f [static, package]

Definition at line 60 of file VrijeInvulVeld.java.

int VrijeInvulVeld.xsize = 640 [static, package]

Definition at line 54 of file VrijeInvulVeld.java.

int VrijeInvulVeld.ygrid = 50 [static, package]

Definition at line 56 of file VrijeInvulVeld.java.

int VrijeInvulVeld.ysize = 480 [static, package]

Definition at line 55 of file VrijeInvulVeld.java.


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