Back to index

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

List of all members.

Public Member Functions

 ListerPanel (Lister ld, String name)
 ListerPanel (Lister ld)
synchronized void paint (Graphics g)
 Paint routine.
void update (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.
synchronized void dopaint (Graphics g)
 Paint the current text lines on the image.
void setState (int s)
synchronized void add (Element e)
 Add a new line of type rene.lister.Element.
synchronized void up (int n)
synchronized void down (int n)
synchronized void pageUp ()
synchronized void pageDown ()
synchronized void setVerticalPos (double x)
 Set the vertical position.
synchronized void setHorizontalPos (double x)
 Set the horizontal offset.
synchronized void clear ()
 Delete all items from the panel.
synchronized void showLast ()
 Make sure, the last elment displays.
synchronized boolean isSelected (int sel)
 Determine if line sel is selected.
synchronized void toggleSelect (int sel)
 Toggle the line sel to be selected or not.
synchronized void expandSelect (int sel)
 Expand the selection to include sel and all elements in between.
synchronized void select (int sel)
 Selecte an item by number sel.
void addActionListener (ActionListener al)
 Add an action listener for all actions of this panel.
void removeActionListener (ActionListener al)
 Remove an action listener.
void clicked (MouseEvent e)
 React on mouse clicks (single or double, or right click).
Dimension getPreferredSize ()
synchronized Element getElementAt (int n)
synchronized void save (PrintWriter o)
void setListingBackground (Color c)

Public Attributes

Color ListingBackground = null
boolean MultipleSelection = true
boolean EasyMultipleSelection = false
boolean ReportSingleClick = false
boolean RightMouseClick = false

Package Functions

synchronized void init ()
 Initialize the font stuff and set the background of the panel.

Package Attributes

int Top
Image I
int W
int H
Graphics IG
Font F
FontMetrics FM
int Leading
int Height
int Ascent
int Descent
int PageSize
int HOffset
boolean ShowLast
Lister LD
String Name
int State = 0
Vector VAL = new Vector()
MyVector Selected = new MyVector()

Private Attributes

MyVector V

Detailed Description

Definition at line 15 of file ListerPanel.java.


Constructor & Destructor Documentation

rene.lister.ListerPanel.ListerPanel ( Lister  ld,
String  name 
) [inline]

Definition at line 41 of file ListerPanel.java.

              {      LD=ld; Name=name;
                     V=new MyVector();
                     Top=0;
                     Wheel W=new Wheel(this);
                     addMouseWheelListener(W);
                     addMouseListener(new MouseAdapter()
                            {      public void mouseClicked (MouseEvent e)
                                   {      clicked(e);
                                   }
                            }
                     );
              }

Here is the call graph for this function:

Definition at line 55 of file ListerPanel.java.

              {      this(ld,"");
              }

Member Function Documentation

synchronized void rene.lister.ListerPanel.add ( Element  e) [inline]

Add a new line of type rene.lister.Element.

Parameters:
e

Definition at line 167 of file ListerPanel.java.

              {      V.addElement(e);
              }

Here is the caller graph for this function:

void rene.lister.ListerPanel.addActionListener ( ActionListener  al) [inline]

Add an action listener for all actions of this panel.

Parameters:
al

Definition at line 309 of file ListerPanel.java.

              {      VAL.addElement(al);
              }

Here is the caller graph for this function:

void rene.lister.ListerPanel.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 115 of file ListerPanel.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 caller graph for this function:

synchronized void rene.lister.ListerPanel.clear ( ) [inline]

Delete all items from the panel.

Definition at line 219 of file ListerPanel.java.

              {      Selected.removeAllElements();
                     V.removeAllElements();
                     Top=0;
              }

Here is the caller graph for this function:

void rene.lister.ListerPanel.clicked ( MouseEvent  e) [inline]

React on mouse clicks (single or double, or right click).

single: select the item (according multiple mode) cause change action. double: select only this item and cause action. right: popup menu, if possible. In any case, report the result to the action listeners.

Parameters:
e

Definition at line 329 of file ListerPanel.java.

              {      int n=e.getY()/(Leading+Height);
                     if (e.isMetaDown() && RightMouseClick)
                     {      Enumeration en=VAL.elements();
                            while (en.hasMoreElements())
                            {      ((ActionListener)(en.nextElement())).actionPerformed(
                                          new ListerMouseEvent(LD,Name,e));
                            }
                     }
                     else
                     {      if (Top+n>=V.size()) return;
                            int sel=n+Top;
                            if (e.getClickCount()>=2)
                            {      if (!MultipleSelection) Selected.removeAllElements();
                                   select(sel);
                            }
                            else if (MultipleSelection &&
                                          (e.isControlDown() || EasyMultipleSelection || e.isShiftDown()) 
                                          )
                            {      if (e.isControlDown() || EasyMultipleSelection)
                                          toggleSelect(sel);
                                   else if (e.isShiftDown())
                                          expandSelect(sel);
                            }
                            else
                            {      Selected.removeAllElements();
                                   Selected.addElement(new Integer(sel));
                            }
                            Graphics g=getGraphics();
                            paint(g);
                            g.dispose();
                            if (e.getClickCount()>=2 || ReportSingleClick)
                            {      Enumeration en=VAL.elements();
                                   while (en.hasMoreElements())
                                   {      ((ActionListener)(en.nextElement())).actionPerformed(
                                                 new ListerMouseEvent(LD,Name,e));
                                   }
                            }
                     }
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.dopaint ( Graphics  g) [inline]

Paint the current text lines on the image.

Parameters:
g

Definition at line 128 of file ListerPanel.java.

              {      if (ShowLast)
                     {      Top=V.size()-PageSize+1;
                            if (Top<0) Top=0;
                            ShowLast=false;
                     }
                     if (ListingBackground!=null) g.setColor(ListingBackground); 
                     else g.setColor(getBackground());
                     g.fillRect(0,0,W,H);
                     g.setColor(Color.black);
                     int h=Leading+Ascent;
                     int totalh=getSize().height-Descent;
                     int line=Top;
                     if (line<0) return;
                     while (line-Top<PageSize && line<V.size())
                     {      Element el=(Element)V.elementAt(line);
                            if (isSelected(line))
                            {      g.setColor(getBackground().darker());
                                   g.fillRect(0,h-Ascent,W,Height);
                                   g.setColor(Color.black);
                            }
                            Color col=el.getElementColor();
                            if (col!=null) g.setColor(col);
                            else g.setColor(Color.black);
                            g.drawString(el.getElementString(State),2-HOffset,h);
                            h+=Leading+Height;
                            line++;
                     }
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.down ( int  n) [inline]

Implements rene.lister.WheelListener.

Definition at line 180 of file ListerPanel.java.

              {      Top-=n;
                     if (Top<0) Top=0;
                     repaint();
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.expandSelect ( int  sel) [inline]

Expand the selection to include sel and all elements in between.

Parameters:
sel

Definition at line 272 of file ListerPanel.java.

              {      // compute maximal selected index below sel.
                     int max=-1;
                     Enumeration e=Selected.elements();
                     while (e.hasMoreElements())
                     {      int i=((Integer)e.nextElement()).intValue();
                            if (i>max && i<sel) max=i;
                     }
                     if (max>=0)
                     {      for (int i=max+1; i<=sel; i++) select(i);
                            return;
                     }
                     int min=V.size();
                     e=Selected.elements();
                     while (e.hasMoreElements())
                     {      int i=((Integer)e.nextElement()).intValue();
                            if (i<min && i>sel) min=i;
                     }
                     if (min<V.size())
                     {      for (int i=sel; i<=min; i++) select(i);
                     }
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized Element rene.lister.ListerPanel.getElementAt ( int  n) [inline]

Definition at line 374 of file ListerPanel.java.

              {      return (Element)V.elementAt(n);
              }

Here is the caller graph for this function:

Definition at line 370 of file ListerPanel.java.

              {      return new Dimension(200,300);
              }
synchronized void rene.lister.ListerPanel.init ( ) [inline, package]

Initialize the font stuff and set the background of the panel.

Definition at line 94 of file ListerPanel.java.

              {      F=getFont();
                     FM=getFontMetrics(F);
                     Leading=FM.getLeading()+Global.getParameter("fixedfont.spacing",-1);
                     Height=FM.getHeight();
                     Ascent=FM.getAscent();
                     Descent=FM.getDescent();
                     if (Global.Background!=null) setBackground(Global.Background);
                     if (Height+Leading>0)
                            PageSize=H/(Height+Leading);
                     else
                            PageSize=10;
                     antialias(true);
                     Top=0;
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized boolean rene.lister.ListerPanel.isSelected ( int  sel) [inline]

Determine if line sel is selected.

Parameters:
sel
Returns:
selected or not

Definition at line 242 of file ListerPanel.java.

              {      Enumeration e=Selected.elements();
                     while (e.hasMoreElements())
                     {      int n=((Integer)e.nextElement()).intValue();
                            if (n==sel) return true;
                     }
                     return false;
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.pageDown ( ) [inline]

Implements rene.lister.WheelListener.

Definition at line 191 of file ListerPanel.java.

              {      down(PageSize-1);
                     repaint();
              }      

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.pageUp ( ) [inline]

Implements rene.lister.WheelListener.

Definition at line 186 of file ListerPanel.java.

              {      up(PageSize-1);
                     repaint();
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.paint ( Graphics  g) [inline]

Paint routine.

Simply sets up the buffer image, calls dopaint and paints the image to the screen.

Definition at line 64 of file ListerPanel.java.

              {      Dimension d=getSize();
                     if (I==null || I.getWidth(this)!=d.width ||
                                   I.getHeight(this)!=d.height)
                     {      I=createImage(W=d.width,H=d.height);
                            if (I==null) return;
                            IG=I.getGraphics();
                            init();
                     }
                     dopaint(IG);
                     g.drawImage(I,0,0,W,H,this);
                     double vp,vs,hp,hs;
                     if (V.size()>1) vp=(double)Top/V.size();
                     else vp=0;
                     if (V.size()>2*PageSize) vs=(double)PageSize/V.size();
                     else vs=0.5;
                     if (HOffset<10*W) hp=(double)HOffset/(10*W);
                     else hp=0.9;
                     hs=0.1;
                     LD.setScrollbars(vp,vs,hp,hs);
              }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.lister.ListerPanel.removeActionListener ( ActionListener  al) [inline]

Remove an action listener.

Parameters:
al

Definition at line 317 of file ListerPanel.java.

              {      VAL.removeElement(al);
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.save ( PrintWriter  o) [inline]

Definition at line 378 of file ListerPanel.java.

              {      Enumeration e=V.elements();
                     while (e.hasMoreElements())
                     {      Element el=(Element)e.nextElement();
                            o.println(el.getElementString());
                     }
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.select ( int  sel) [inline]

Selecte an item by number sel.

Parameters:
sel

Definition at line 299 of file ListerPanel.java.

              {      if (!isSelected(sel))
                            Selected.addElement(new Integer(sel));
              }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.setHorizontalPos ( double  x) [inline]

Set the horizontal offset.

Parameters:
xofset in percent of 10 times the screen width

Definition at line 211 of file ListerPanel.java.

              {      HOffset=(int)(x*10*W);
                     repaint();
              }

Here is the caller graph for this function:

Definition at line 386 of file ListerPanel.java.

Here is the caller graph for this function:

void rene.lister.ListerPanel.setState ( int  s) [inline]

Definition at line 159 of file ListerPanel.java.

              {      State=s;
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.setVerticalPos ( double  x) [inline]

Set the vertical position.

Used by the scrollbars in the Lister.

Parameters:
xpercentage of text

Definition at line 201 of file ListerPanel.java.

              {      Top=(int)(x*V.size());
                     if (Top>=V.size()) Top=V.size()-1;
                     repaint();
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.showLast ( ) [inline]

Make sure, the last elment displays.

Definition at line 228 of file ListerPanel.java.

              {      ShowLast=true;
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.toggleSelect ( int  sel) [inline]

Toggle the line sel to be selected or not.

Parameters:
sel

Definition at line 255 of file ListerPanel.java.

              {      Enumeration e=Selected.elements();
                     while (e.hasMoreElements())
                     {      Integer i=(Integer)e.nextElement();
                            if (i.intValue()==sel)
                            {      Selected.removeElement(i);
                                   return;
                            }
                     }
                     Selected.addElement(new Integer(sel));
              }

Here is the caller graph for this function:

synchronized void rene.lister.ListerPanel.up ( int  n) [inline]

Implements rene.lister.WheelListener.

Definition at line 173 of file ListerPanel.java.

              {      Top+=n;
                     if (Top>=V.size()) Top=V.size()-1;
                     if (Top<0) Top=0;
                     repaint();
              }

Here is the caller graph for this function:

void rene.lister.ListerPanel.update ( Graphics  g) [inline]

Definition at line 86 of file ListerPanel.java.

              {      paint(g);     
              }

Here is the call graph for this function:


Member Data Documentation

Definition at line 26 of file ListerPanel.java.

Definition at line 26 of file ListerPanel.java.

Definition at line 37 of file ListerPanel.java.

Font rene.lister.ListerPanel.F [package]

Definition at line 24 of file ListerPanel.java.

FontMetrics rene.lister.ListerPanel.FM [package]

Definition at line 25 of file ListerPanel.java.

Definition at line 22 of file ListerPanel.java.

Definition at line 26 of file ListerPanel.java.

Definition at line 28 of file ListerPanel.java.

Image rene.lister.ListerPanel.I [package]

Definition at line 21 of file ListerPanel.java.

Graphics rene.lister.ListerPanel.IG [package]

Definition at line 23 of file ListerPanel.java.

Definition at line 31 of file ListerPanel.java.

Definition at line 26 of file ListerPanel.java.

Definition at line 34 of file ListerPanel.java.

Definition at line 36 of file ListerPanel.java.

String rene.lister.ListerPanel.Name [package]

Definition at line 32 of file ListerPanel.java.

Definition at line 27 of file ListerPanel.java.

Definition at line 38 of file ListerPanel.java.

Definition at line 39 of file ListerPanel.java.

MyVector rene.lister.ListerPanel.Selected = new MyVector() [package]

Definition at line 235 of file ListerPanel.java.

Definition at line 29 of file ListerPanel.java.

int rene.lister.ListerPanel.State = 0 [package]

Definition at line 158 of file ListerPanel.java.

Definition at line 19 of file ListerPanel.java.

MyVector rene.lister.ListerPanel.V [private]

Definition at line 18 of file ListerPanel.java.

Vector rene.lister.ListerPanel.VAL = new Vector() [package]

Definition at line 234 of file ListerPanel.java.

Definition at line 22 of file ListerPanel.java.


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