Back to index

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

List of all members.

Public Member Functions

 TextDisplay (Viewer v)
Color getBackground ()
synchronized void appendLine0 (String S)
synchronized void appendLine0 (String S, Color c)
synchronized void appendLine (String s)
void append (String S, Color c)
void append (String S, Color c, boolean suddenupdate)
void doUpdate (boolean showlast)
void setText (String s)
synchronized void appendlast (String s, Color c)
void showlast ()
void makeimage ()
synchronized void paint (Graphics g)
void antialias (boolean flag)
 Set Anti-Aliasing on or off, if in Java 1.2 or better and the Parameter "font.smooth" is switched on.
void showLine (ListElement line)
ListElement getline (int y)
void update (Graphics g)
int setVertical (int v)
void verticalUp ()
void verticalDown ()
void verticalPageUp ()
void verticalPageDown ()
int setHorizontal (int v)
void save (PrintWriter fo)
TextPosition getposition (int x, int y)
void unmark ()
void unmark (TextPosition Start, TextPosition End)
void mark (TextPosition Start, TextPosition End)
void showFirst ()
void lostOwnership (Clipboard clip, Transferable cont)
void setTabWidth (int t)
boolean hasFocus ()
void setBackground (Color c)
void componentHidden (ComponentEvent e)
void componentMoved (ComponentEvent e)
void componentResized (ComponentEvent e)
void componentShown (ComponentEvent e)

Public Attributes

int Tabsize = 4
int Offset

Package Functions

void init (Font f)
int[] getwidth (char a[])
int computeVertical ()
int computeVerticalSize ()
void copy (TextPosition Start, TextPosition End)
TextPosition lastpos ()

Package Attributes

ListClass L
Font F = null
FontMetrics FM
Viewer V
int Leading
int Height
int Ascent
int Descent
int LineCount
int TopLineCount
int PageSize
ListElement TopLine
Image I
Graphics IG
int W
int H
boolean LineFinished = true
int Widths []
int HW []
long LastScrollTime
Color Background
int TabWidth = 0

Detailed Description

Definition at line 26 of file TextDisplay.java.


Constructor & Destructor Documentation

Definition at line 47 of file TextDisplay.java.

       {      L=new ListClass();
              F=null;
              V=v;
              LineCount=0;
              TopLineCount=0;
              TopLine=null;
              I=null;
              W=H=0;
              PageSize=10;
              HW=new int[1024];
              addKeyListener(v);
              addComponentListener(this);
       }

Member Function Documentation

void rene.viewer.TextDisplay.antialias ( boolean  flag) [inline]

Set Anti-Aliasing on or off, if in Java 1.2 or better and the Parameter "font.smooth" is switched on.

Parameters:
flag

Definition at line 214 of file TextDisplay.java.

       {      if (Global.getParameter("font.smooth",true))
              {      IG=(Graphics2D)IG;
                     ((Graphics2D)IG).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                            flag?RenderingHints.VALUE_TEXT_ANTIALIAS_ON:
                                   RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.append ( String  S,
Color  c 
) [inline]

Definition at line 108 of file TextDisplay.java.

       {      append(S,c,true);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.append ( String  S,
Color  c,
boolean  suddenupdate 
) [inline]

Definition at line 112 of file TextDisplay.java.

       {      while (true)
              {      int p=S.indexOf('\n');
                     if (p<0)
                     {      appendlast(S,c);
                            LineFinished=false;
                            break;
                     }
                     appendlast(S.substring(0,p),c);
                     LineFinished=true;
                     S=S.substring(p+1);
                     if (S.equals("")) 
                     {      break;
                     }
              }
              if (suddenupdate) doUpdate(true);
              repaint();
       }

Here is the call graph for this function:

synchronized void rene.viewer.TextDisplay.appendlast ( String  s,
Color  c 
) [inline]

Definition at line 147 of file TextDisplay.java.

       {      if (LineFinished || L.last()==null)
              {      Line l;
                     L.append(new ListElement(l=new Line(s,this,c)));
                     LineCount++;
                     if (LineCount==1) TopLine=L.first();
                     if (TabWidth>0) l.expandTabs(TabWidth);
              }
              else
              {      ((Line)L.last().content()).append(s);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.viewer.TextDisplay.appendLine ( String  s) [inline]

Definition at line 103 of file TextDisplay.java.

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.viewer.TextDisplay.appendLine0 ( String  S) [inline]

Definition at line 90 of file TextDisplay.java.

       {      appendLine0(S,Color.black);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.viewer.TextDisplay.appendLine0 ( String  S,
Color  c 
) [inline]

Definition at line 94 of file TextDisplay.java.

       {      Line l;
              L.append(new ListElement(l=new Line(S,this,c)));
              LineCount++;
              if (LineCount==1) TopLine=L.first();
              LineFinished=true;
              if (TabWidth>0) l.expandTabs(TabWidth);
       }

Here is the call graph for this function:

void rene.viewer.TextDisplay.componentHidden ( ComponentEvent  e) [inline]

Definition at line 447 of file TextDisplay.java.

{}
void rene.viewer.TextDisplay.componentMoved ( ComponentEvent  e) [inline]

Definition at line 448 of file TextDisplay.java.

{}
void rene.viewer.TextDisplay.componentResized ( ComponentEvent  e) [inline]

Definition at line 449 of file TextDisplay.java.

       {      V.resized();
       }

Here is the call graph for this function:

void rene.viewer.TextDisplay.componentShown ( ComponentEvent  e) [inline]

Definition at line 452 of file TextDisplay.java.

{}
int rene.viewer.TextDisplay.computeVertical ( ) [inline, package]

Definition at line 257 of file TextDisplay.java.

       {      if (LineCount>0)
               return TopLineCount*1000/LineCount;
           else return 0;
       }

Here is the caller graph for this function:

Definition at line 326 of file TextDisplay.java.

       {      if (LineCount==0) return 100;
              int h=PageSize*2000/LineCount;
              if (h<10) h=10;
              return h;
       }

Here is the caller graph for this function:

void rene.viewer.TextDisplay.copy ( TextPosition  Start,
TextPosition  End 
) [inline, package]

Definition at line 408 of file TextDisplay.java.

       {      if (Start==null || End==null) return;
              TextPosition P1,P2;
              if (Start.before(End)) { P1=Start; P2=End; }
              else if (End.before(Start)) { P1=End; P2=Start; }
              else return;
              String s="";
              ListElement e=P1.L;
              while (e!=null && e!=P2.L)
              {      s=s+((Line)e.content()).getblock()+"\n";
                     e=e.next();
              }
              if (e!=null) s=s+((Line)e.content()).getblock();
              new ClipboardCopy(this,this,s);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.doUpdate ( boolean  showlast) [inline]

Definition at line 131 of file TextDisplay.java.

       {      if (showlast)
              {      long m=System.currentTimeMillis();
                     if (m-LastScrollTime > 10000) showlast();
              }
              repaint();
              V.setVerticalScrollbar();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 74 of file TextDisplay.java.

       {      if (Global.Background!=null) return Global.Background;
              else return SystemColor.window;
       }

Here is the caller graph for this function:

Definition at line 240 of file TextDisplay.java.

       {      if (TopLine==null) return null;
              ListElement e=TopLine;
              int h=Leading+Height;
              if (h==0) return null;
              h=y/h;
              for (int i=0; i<h; i++)
              {      if (e.next()==null) return e;
                     e=e.next();
              }
              return e;
       }

Here is the call graph for this function:

TextPosition rene.viewer.TextDisplay.getposition ( int  x,
int  y 
) [inline]

Definition at line 347 of file TextDisplay.java.

       {      if (L.first()==null) return null;
              if (y<0) return new TextPosition(TopLine,TopLineCount,0);
              if (TopLine==null) return null;
              ListElement e=TopLine;
              int h=Leading+Height;
              if (h==0) return null;
              h=y/h;
              int i;
              for (i=0; i<h; i++)
              {      if (e.next()==null || i==PageSize-1)
                            return new TextPosition(e,TopLineCount+i,
                            ((Line)e.content()).length());
                     e=e.next();
              }
              return new TextPosition(e,TopLineCount+i,
                     ((Line)e.content()).getpos(x,2));
       }

Here is the call graph for this function:

Here is the caller graph for this function:

int [] rene.viewer.TextDisplay.getwidth ( char  a[]) [inline, package]

Definition at line 79 of file TextDisplay.java.

       {      try
              {      for (int i=0; i<a.length; i++)
                     {      if (a[i]<256) HW[i]=Widths[a[i]];
                            else HW[i]=FM.charWidth(a[i]);
                     }
              }
              catch (Exception e) { return HW; }
              return HW;
       }

Here is the caller graph for this function:

Definition at line 438 of file TextDisplay.java.

       {      return V.hasFocus();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.init ( Font  f) [inline, package]

Definition at line 62 of file TextDisplay.java.

       {      F=f;
              FM=getFontMetrics(F);
              Leading=FM.getLeading()+Global.getParameter("fixedfont.spacing",-1);
              Height=FM.getHeight();
              Ascent=FM.getAscent();
              Descent=FM.getDescent();
              Widths=FM.getWidths();
              if (Global.Background!=null) Background=Global.Background;
              else Background=SystemColor.window;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 429 of file TextDisplay.java.

       {      ListElement e=L.last();     
              if (e==null) return null;
              Line l=(Line)e.content();
              return new TextPosition(e,LineCount,l.length());
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.lostOwnership ( Clipboard  clip,
Transferable  cont 
) [inline]

Definition at line 428 of file TextDisplay.java.

{}

Definition at line 173 of file TextDisplay.java.

       {      Dimension D=getSize();
              if (I==null || D.width!=W || D.height!=H)
              {      I=createImage(W=D.width,H=D.height);
                     IG=I.getGraphics();
              }
              IG.setColor(Color.black);
              IG.clearRect(0,0,W,H);
              IG.setFont(F);
              try
              {      PageSize=H/(Height+Leading);
              }
              catch (Exception e) {}
       }

Here is the caller graph for this function:

void rene.viewer.TextDisplay.mark ( TextPosition  Start,
TextPosition  End 
) [inline]

Definition at line 390 of file TextDisplay.java.

       {      if (Start==null || End==null) return;
              TextPosition P1,P2;
              if (Start.before(End)) { P1=Start; P2=End; }
              else if (End.before(Start)) { P1=End; P2=Start; }
              else return;
              ListElement e=P1.L;
              ((Line)e.content()).block(P1.LPos,Line.START);
              if (e!=P2.L) e=e.next();
              while (e!=null && e!=P2.L)
              {      ((Line)e.content()).block(0,Line.FULL);
                     e=e.next();
              }
              if (e!=null) ((Line)e.content()).block(P2.LPos,Line.END);
              repaint();
              requestFocus();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.viewer.TextDisplay.paint ( Graphics  g) [inline]

Definition at line 188 of file TextDisplay.java.

       {      if (F==null) init(getFont());
              makeimage();
              ListElement e=TopLine;
              antialias(true);
              int h=Leading+Ascent;
              int totalh=getSize().height-Descent;
              if (Background==null) Background=getBackground();
              IG.setColor(Background);
              IG.fillRect(0,0,W,H);
              int lines=0;
              while (lines<PageSize && e!=null)
              {      Line l=(Line)e.content();
                     l.draw(IG,2,h);
                     h+=Leading+Height;
                     e=e.next();
                     lines++;
              }
              g.drawImage(I,0,0,this);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.save ( PrintWriter  fo) [inline]

Definition at line 339 of file TextDisplay.java.

       {      ListElement e=L.first();
              while (e!=null)
              {      fo.println(new String(((Line)e.content()).a));
                     e=e.next();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.setBackground ( Color  c) [inline]

Definition at line 442 of file TextDisplay.java.

       {      Background=c;
              super.setBackground(c);
       }

Here is the caller graph for this function:

int rene.viewer.TextDisplay.setHorizontal ( int  v) [inline]

Definition at line 333 of file TextDisplay.java.

       {      Offset=v/5;
              repaint();
              return v;
       }

Here is the caller graph for this function:

void rene.viewer.TextDisplay.setTabWidth ( int  t) [inline]

Definition at line 436 of file TextDisplay.java.

{ TabWidth=t; }

Here is the caller graph for this function:

void rene.viewer.TextDisplay.setText ( String  s) [inline]

Definition at line 140 of file TextDisplay.java.

       {      TopLine=null; TopLineCount=0; LineCount=0;
              L=new ListClass();
              if (!s.equals("")) append(s,Color.black);
              repaint();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

int rene.viewer.TextDisplay.setVertical ( int  v) [inline]

Definition at line 263 of file TextDisplay.java.

       {      if (TopLine==null) return 0;
              int NewTop=LineCount*v/1000;
              if (NewTop>TopLineCount)
              {      for (int i=TopLineCount; i<NewTop; i++)
                     {      if (TopLine.next()==null) break;
                            TopLine=TopLine.next();
                            TopLineCount++;
                     }
                     repaint();
              }
              else if (NewTop<TopLineCount)
              {      for (int i=TopLineCount; i>NewTop; i--)
                     {      if (TopLine.previous()==null) break;
                            TopLine=TopLine.previous();
                            TopLineCount--;
                     }
                     repaint();
              }
              LastScrollTime=System.currentTimeMillis();
              return v;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 424 of file TextDisplay.java.

       {      TopLine=L.first();
       }

Here is the caller graph for this function:

Definition at line 160 of file TextDisplay.java.

       {      ListElement e=L.last();
              if (e==null) return;
              TopLineCount=LineCount;
              for (int i=0; i<PageSize-1; i++)
              {      if (e.previous()==null) break;
                     e=e.previous();
                     TopLineCount--;
              }
              TopLine=e;
              repaint();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file TextDisplay.java.

       {      ListElement e=TopLine;
              int h=Leading+Ascent;
              int totalh=getSize().height-Descent;
              if (Background==null) Background=getBackground();
              int lines=0;
              while (lines<PageSize && e!=null)
              {      if (e==line) return;
                     h+=Leading+Height;
                     e=e.next();
                     lines++;
              }
              if (e==line && TopLine.next()!=null) 
                     TopLine=TopLine.next();
              else TopLine=line;
       }

Here is the call graph for this function:

void rene.viewer.TextDisplay.unmark ( ) [inline]

Definition at line 366 of file TextDisplay.java.

       {      ListElement e=L.first();
              while (e!=null)
              {      ((Line)e.content()).block(0,Line.NONE);
                     e=e.next();
              }
              repaint();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.TextDisplay.unmark ( TextPosition  Start,
TextPosition  End 
) [inline]

Definition at line 375 of file TextDisplay.java.

       {      if (Start==null || End==null) return;
              TextPosition P1,P2;
              if (Start.before(End)) { P1=Start; P2=End; }
              else if (End.before(Start)) { P1=End; P2=Start; }
              else return;
              ListElement e=P1.L;
              while (e!=null && e!=P2.L)
              {      ((Line)e.content()).block(0,Line.NONE);
                     e=e.next();
              }
              if (e!=null) ((Line)e.content()).block(0,Line.NONE);
              repaint();
       }

Here is the call graph for this function:

void rene.viewer.TextDisplay.update ( Graphics  g) [inline]

Definition at line 253 of file TextDisplay.java.

       {      paint(g);
       }

Here is the call graph for this function:

Definition at line 295 of file TextDisplay.java.

       {      if (TopLine==null) return;
              if (TopLine.previous()==null) return;
              TopLine=TopLine.previous();
              TopLineCount--;
              repaint();
              LastScrollTime=System.currentTimeMillis();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 315 of file TextDisplay.java.

       {      if (TopLine==null) return;
              for (int i=0; i<PageSize-1; i++)
              {      if (TopLine.previous()==null) break;
                     TopLine=TopLine.previous();
                     TopLineCount--;
              }
              repaint();
              LastScrollTime=System.currentTimeMillis();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 304 of file TextDisplay.java.

       {      if (TopLine==null) return;
              for (int i=0; i<PageSize-1; i++)
              {      if (TopLine.next()==null) break;
                     TopLine=TopLine.next();
                     TopLineCount++;
              }
              repaint();
              LastScrollTime=System.currentTimeMillis();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 286 of file TextDisplay.java.

       {      if (TopLine==null) return;
              if (TopLine.next()==null) return;
              TopLine=TopLine.next();
              TopLineCount++;
              repaint();
              LastScrollTime=System.currentTimeMillis();
       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 32 of file TextDisplay.java.

Definition at line 44 of file TextDisplay.java.

Definition at line 32 of file TextDisplay.java.

Font rene.viewer.TextDisplay.F = null [package]

Definition at line 29 of file TextDisplay.java.

FontMetrics rene.viewer.TextDisplay.FM [package]

Definition at line 30 of file TextDisplay.java.

Definition at line 38 of file TextDisplay.java.

Definition at line 32 of file TextDisplay.java.

int rene.viewer.TextDisplay.HW[] [package]

Definition at line 42 of file TextDisplay.java.

Image rene.viewer.TextDisplay.I [package]

Definition at line 36 of file TextDisplay.java.

Graphics rene.viewer.TextDisplay.IG [package]

Definition at line 37 of file TextDisplay.java.

ListClass rene.viewer.TextDisplay.L [package]

Definition at line 28 of file TextDisplay.java.

Definition at line 43 of file TextDisplay.java.

Definition at line 32 of file TextDisplay.java.

Definition at line 33 of file TextDisplay.java.

Definition at line 41 of file TextDisplay.java.

Definition at line 40 of file TextDisplay.java.

Definition at line 34 of file TextDisplay.java.

Definition at line 39 of file TextDisplay.java.

Definition at line 45 of file TextDisplay.java.

Definition at line 35 of file TextDisplay.java.

Definition at line 33 of file TextDisplay.java.

Definition at line 31 of file TextDisplay.java.

Definition at line 38 of file TextDisplay.java.

Definition at line 42 of file TextDisplay.java.


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