Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Package Attributes
rene.viewer.ExtendedViewer Class Reference

An extended Version of the Viewer. More...

Inheritance diagram for rene.viewer.ExtendedViewer:
Inheritance graph
[legend]
Collaboration diagram for rene.viewer.ExtendedViewer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ExtendedViewer ()
void setFont (Font f)
void appendLine (String s)
void newLine ()
void appendLine (String s, Color c)
void append (String s)
void append (String s, Color c)
void doUpdate (boolean showlast)
void update ()
void adjustmentValueChanged (AdjustmentEvent e)
void setVerticalScrollbar ()
void setText (String S)
void save (PrintWriter fo)
void appendLine0 (String s)
void appendLine0 (String s, Color c)
void mouseClicked (MouseEvent e)
void mousePressed (MouseEvent e)
Dimension getPreferredSize ()
Dimension getMinimumSize ()
void mouseReleased (MouseEvent e)
void mouseEntered (MouseEvent e)
void mouseExited (MouseEvent e)
void mouseMoved (MouseEvent e)
void mouseDragged (MouseEvent e)
void actionPerformed (ActionEvent e)
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)
void setTabWidth (int t)
void showFirst ()
void showLast ()
boolean hasFocus ()
void setBackground (Color c)
void up (int n)
void down (int n)
void pageUp ()
void pageDown ()
void paint (Graphics G)
void doAppend (String s)
synchronized void resized ()
void mouseWheelMoved (MouseWheelEvent arg0)

Static Public Member Functions

static void main (String args[])

Package Attributes

TextDisplay TD
Scrollbar Vertical
TextPosition Start
TextPosition End
PopupMenu PM
int X
int Y
Panel P3D
MyVector V
StringBuffer B
boolean Changed = false
boolean Dragging = false
Scrollbar Horizontal

Detailed Description

An extended Version of the Viewer.

It is able to reformat lines, when the area is resized. It has no vertical scrollbar. Text is stored into a separate string buffer, and will be formatted on repaint.

Definition at line 17 of file ExtendedViewer.java.


Constructor & Destructor Documentation

Definition at line 30 of file ExtendedViewer.java.

       {      TD=new TextDisplay(this);
              setLayout(new BorderLayout());
              add("Center",P3D=new Panel3D(TD));
              add("East",Vertical=new Scrollbar(Scrollbar.VERTICAL,0,100,0,1100));
              Vertical.addAdjustmentListener(this);
              TD.addMouseListener(this);
              TD.addMouseMotionListener(this);
              Start=End=null;
              PM=new PopupMenu();
              MenuItem mi=new MenuItem(Global.name("block.copy","Copy"));
              mi.addActionListener(this);
              PM.add(mi);
              PM.addSeparator();
              mi=new MenuItem(Global.name("block.begin","Begin Block"));
              mi.addActionListener(this);
              PM.add(mi);
              mi=new MenuItem(Global.name("block.end","End Block"));
              mi.addActionListener(this);
              PM.add(mi);
              add(PM);
              Wheel W=new Wheel(this);
              addMouseWheelListener(W);
              V=new MyVector();
              B=new StringBuffer();
       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

void rene.viewer.ExtendedViewer.actionPerformed ( ActionEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 184 of file ExtendedViewer.java.

       {      String o=e.getActionCommand();
              if (o.equals(Global.name("block.copy","Copy"))) TD.copy(Start,End);
              else if (o.equals(Global.name("block.begin","Begin Block")))
              {      TD.unmark(Start,End);
                     Start=TD.getposition(X,Y);
                     Start.oneleft();
                     if (End==null && TD.L.last()!=null)
                     {      End=TD.lastpos();
                     }
                     TD.mark(Start,End);
              }
              else if (o.equals(Global.name("block.end","End Block")))
              {      TD.unmark(Start,End);
                     End=TD.getposition(X,Y);
                     if (Start==null && TD.L.first()!=null)
                     {      Start=new TextPosition(TD.L.first(),0,0);
                     }
                     TD.mark(Start,End);
              }
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.adjustmentValueChanged ( AdjustmentEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 95 of file ExtendedViewer.java.

       {      if (e.getSource()==Vertical)
              {      switch (e.getAdjustmentType())
                     {      case AdjustmentEvent.UNIT_INCREMENT :
                                   TD.verticalUp(); break;
                            case AdjustmentEvent.UNIT_DECREMENT :
                                   TD.verticalDown(); break;
                            case AdjustmentEvent.BLOCK_INCREMENT :
                                   TD.verticalPageUp(); break;
                            case AdjustmentEvent.BLOCK_DECREMENT :
                                   TD.verticalPageDown(); break;
                            default :
                                   int v=Vertical.getValue();
                                   Vertical.setValue(v);
                                   TD.setVertical(v);
                                   return;
                     }
                     setVerticalScrollbar();
              }
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.append ( String  s) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 78 of file ExtendedViewer.java.

       {      B.append(s);
       }

Here is the caller graph for this function:

void rene.viewer.ExtendedViewer.append ( String  s,
Color  c 
) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 82 of file ExtendedViewer.java.

       {      append(s);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from rene.viewer.Viewer.

Definition at line 61 of file ExtendedViewer.java.

       {      B.append(s);
              V.addElement(B.toString());
              B.setLength(0);
              Changed=true;
       }

Here is the caller graph for this function:

void rene.viewer.ExtendedViewer.appendLine ( String  s,
Color  c 
) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 74 of file ExtendedViewer.java.

       {      appendLine(s);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.viewer.ExtendedViewer.appendLine0 ( String  s) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 134 of file ExtendedViewer.java.

       {      appendLine(s);
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.appendLine0 ( String  s,
Color  c 
) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 138 of file ExtendedViewer.java.

       {      appendLine(s);
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.doAppend ( String  s) [inline]

Definition at line 265 of file ExtendedViewer.java.

       {      char a[]=s.toCharArray();
              int w[]=TD.getwidth(a);
              int start=0,end=0;
              int W=TD.getSize().width;
              int goodbreak;
              while (start<a.length && a[start]==' ') start++;
              if (start>=a.length)
              {      TD.appendLine("");
                     return;
              }
              int blanks=0;
              String sblanks="";
              int offset=0;
              if (start>0)
              {      blanks=start;
                     sblanks=new String(a,0,blanks);
                     offset=blanks+w[0];
              }
              while (start<a.length)
              {      int tw=TD.Offset+offset;
                     end=start;
                     goodbreak=start;
                     while (end<a.length && tw<W)
                     {      tw+=w[end]; 
                            if (a[end]==' ')
                                   goodbreak=end;
                            end++;
                     }
                     if (tw<W) goodbreak=end;
                     if (goodbreak==start) goodbreak=end; 
                     if (blanks>0)
                            TD.appendLine(sblanks+new String(a,start,goodbreak-start)); 
                     else
                            TD.appendLine(new String(a,start,goodbreak-start)); 
                     start=goodbreak;
                     while (start<a.length && a[start]==' ') start++;
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from rene.viewer.Viewer.

Definition at line 86 of file ExtendedViewer.java.

       {
       }
void rene.viewer.ExtendedViewer.down ( int  n) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 246 of file ExtendedViewer.java.

       {      for (int i=0; i<n; i++) TD.verticalDown();
              setVerticalScrollbar();
       }

Here is the call graph for this function:

Reimplemented from rene.viewer.Viewer.

Definition at line 160 of file ExtendedViewer.java.

       {      return new Dimension(150,200);
       }

Reimplemented from rene.viewer.Viewer.

Definition at line 157 of file ExtendedViewer.java.

       {      return new Dimension(150,200);
       }

Reimplemented from rene.viewer.Viewer.

Definition at line 233 of file ExtendedViewer.java.

{ return false; }
void rene.viewer.ExtendedViewer.keyPressed ( KeyEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 206 of file ExtendedViewer.java.

{}
void rene.viewer.ExtendedViewer.keyReleased ( KeyEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 208 of file ExtendedViewer.java.

       {      if (e.isControlDown() && e.getKeyCode()==KeyEvent.VK_C
                     && Start!=null && End!=null)
              {      TD.copy(Start,End);
              }
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.keyTyped ( KeyEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 215 of file ExtendedViewer.java.

{}
static void rene.viewer.ExtendedViewer.main ( String  args[]) [inline, static]

Reimplemented from rene.viewer.Viewer.

Definition at line 316 of file ExtendedViewer.java.

       {      CloseFrame f=new CloseFrame();
              f.setLayout(new BorderLayout());
              ExtendedViewer v=new ExtendedViewer();
              f.add("Center",v);
              f.setSize(300,300);
              f.setVisible(true);
              v.append("test1 test test test test test test ");
              v.append("Donaudampfschifffahrtsgesellschaftskapitän ");
              v.append("test2 test test test test test test ");
              v.append("test3 test test test test test test ");
              v.append("test4 test test test test test test ");
              v.append("test5 test test test test test test ");
              v.append("test6 test test test test test test ");
              v.append("test7 test test test test test test ");
              v.append("test8 test test test test test test ");
              v.appendLine("");
              v.appendLine("");
              v.appendLine("  affe affe affe affe affe affe affe test test test test test last");
              v.appendLine("");
              v.appendLine("test affe affe affe test test test test test last ");
              v.appendLine("  ");
              v.appendLine("test test test test affe affe affe test test last");
              v.repaint();
              v.resized();
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.mouseClicked ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 144 of file ExtendedViewer.java.

{}
void rene.viewer.ExtendedViewer.mouseDragged ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 177 of file ExtendedViewer.java.

       {      TD.unmark(Start,End);
              TextPosition h=TD.getposition(e.getX(),e.getY());
              if (h!=null) End=h;
              TD.mark(Start,End);
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.mouseEntered ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 168 of file ExtendedViewer.java.

       {
       }
void rene.viewer.ExtendedViewer.mouseExited ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 172 of file ExtendedViewer.java.

       {
       }
void rene.viewer.ExtendedViewer.mouseMoved ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 176 of file ExtendedViewer.java.

{}
void rene.viewer.ExtendedViewer.mousePressed ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 145 of file ExtendedViewer.java.

       {      if (e.isPopupTrigger() || e.isMetaDown())
              {      PM.show(e.getComponent(),e.getX(),e.getY());
                     X=e.getX(); Y=e.getY();
              }
              else
              {      TD.unmark(Start,End);
                     Start=TD.getposition(e.getX(),e.getY());
                     Start.oneleft();
                     End=null;
              }
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.mouseReleased ( MouseEvent  e) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 164 of file ExtendedViewer.java.

       {      Dragging=false;
       }
void rene.viewer.ExtendedViewer.mouseWheelMoved ( MouseWheelEvent  arg0) [inline]

Definition at line 343 of file ExtendedViewer.java.

                                                         {
       }

Definition at line 68 of file ExtendedViewer.java.

       {      V.addElement(B.toString());
              B.setLength(0);
              Changed=true;
       }      

Reimplemented from rene.viewer.Viewer.

Definition at line 256 of file ExtendedViewer.java.

Here is the call graph for this function:

Reimplemented from rene.viewer.Viewer.

Definition at line 251 of file ExtendedViewer.java.

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.paint ( Graphics  G) [inline]

Definition at line 261 of file ExtendedViewer.java.

       {      super.paint(G);
       }
synchronized void rene.viewer.ExtendedViewer.resized ( ) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 305 of file ExtendedViewer.java.

       {      if (TD.getSize().width<=0) return;
              TD.setText("");
              Enumeration e=V.elements();
              while (e.hasMoreElements())
              {      String s=(String)e.nextElement();
                     doAppend(s);
              }
              TD.repaint();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from rene.viewer.Viewer.

Definition at line 130 of file ExtendedViewer.java.

       {      TD.save(fo);
       }

Here is the call graph for this function:

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

Reimplemented from rene.viewer.Viewer.

Definition at line 235 of file ExtendedViewer.java.

       {      TD.setBackground(c);
              P3D.setBackground(c);
              super.setBackground(c);
       }      

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.setFont ( Font  f) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 57 of file ExtendedViewer.java.

       {      TD.init(f);
       }

Here is the call graph for this function:

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

Reimplemented from rene.viewer.Viewer.

Definition at line 217 of file ExtendedViewer.java.

       {      TD.setTabWidth(t);
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.setText ( String  S) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 122 of file ExtendedViewer.java.

       {      TD.unmark(); Start=End=null;
              TD.setText(S);
              V.removeAllElements();
              B.setLength(0);             
              setVerticalScrollbar();
       }

Here is the call graph for this function:

Reimplemented from rene.viewer.Viewer.

Definition at line 116 of file ExtendedViewer.java.

       {      if (Vertical==null) return;
              int h=TD.computeVerticalSize();
              Vertical.setValues(TD.computeVertical(),h,0,1000+h);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from rene.viewer.Viewer.

Definition at line 221 of file ExtendedViewer.java.

       {      TD.showFirst();
              setVerticalScrollbar();
              TD.repaint();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from rene.viewer.Viewer.

Definition at line 227 of file ExtendedViewer.java.

       {      TD.showlast();
              setVerticalScrollbar();
              TD.repaint();
       }

Here is the call graph for this function:

void rene.viewer.ExtendedViewer.up ( int  n) [inline]

Reimplemented from rene.viewer.Viewer.

Definition at line 241 of file ExtendedViewer.java.

       {      for (int i=0; i<n; i++) TD.verticalUp();
              setVerticalScrollbar();
       }

Here is the call graph for this function:

Definition at line 90 of file ExtendedViewer.java.

       {      resized();
              showFirst();
       }

Here is the call graph for this function:


Member Data Documentation

StringBuffer rene.viewer.ExtendedViewer.B [package]

Definition at line 27 of file ExtendedViewer.java.

Definition at line 28 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 142 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 22 of file ExtendedViewer.java.

Scrollbar rene.viewer.Viewer.Horizontal [package, inherited]

Definition at line 38 of file Viewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 25 of file ExtendedViewer.java.

PopupMenu rene.viewer.ExtendedViewer.PM [package]

Reimplemented from rene.viewer.Viewer.

Definition at line 23 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 22 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 20 of file ExtendedViewer.java.

MyVector rene.viewer.ExtendedViewer.V [package]

Definition at line 26 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 21 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 24 of file ExtendedViewer.java.

Reimplemented from rene.viewer.Viewer.

Definition at line 24 of file ExtendedViewer.java.


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