Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Attributes | Package Attributes
rene.gui.StateDisplay Class Reference

An state display. More...

Inheritance diagram for rene.gui.StateDisplay:
Inheritance graph
[legend]
Collaboration diagram for rene.gui.StateDisplay:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StateDisplay (IconBar bar, String file)
 Initialize the icon and load its image.
void paint (Graphics g)
 Paint a button with an image.
void mousePressed (MouseEvent e)
 User pressed the mouse key over this button.
void mouseReleased (MouseEvent e)
 User released the mouse key again.
void mouseClicked (MouseEvent e)
void processKeyEvent (KeyEvent e)
void showFocus (Graphics g)
void dopaint (Graphics g)
void update (Graphics g)
void pressed (MouseEvent e)
 Overwrite for children!
synchronized void mouseEntered (MouseEvent e)
 Start a thread, that waits for one second, then tells the icon bar to display the proper help text.
void run ()
 A thread to display an icon help.
synchronized void mouseExited (MouseEvent e)
 Tell the run method, that display is no longer necessary, and remove the help text.
int width ()
void setPosition (int x, int y)
Point getPosition ()
void setEnabled (boolean flag)
String getName ()
boolean hasFocus ()
void setFocus (boolean flag)
boolean isSet ()
void unset (boolean flag)
void unset ()

Static Public Attributes

static int Size = 22

Package Attributes

Image IOn
Image IOff
int W
int H
int X
int Y
IconBar Bar
String Name
boolean Enabled
boolean On
boolean Focus = false
boolean MouseOver
boolean MouseDown
boolean Unset
Thread T
boolean Control

Detailed Description

An state display.

Loads two images from a resource and display either of them, depending on the enabled state.

Definition at line 752 of file IconBar.java.


Constructor & Destructor Documentation

rene.gui.StateDisplay.StateDisplay ( IconBar  bar,
String  file 
) [inline]

Initialize the icon and load its image.

Definition at line 759 of file IconBar.java.

       {      super(bar,file);
              try
              {      InputStream in=getClass().getResourceAsStream(
                            Bar.Resource+file+"on"+"."+Global.getParameter("icontype","gif"));
                     int pos=0;
                     int n=in.available();
                     byte b[]=new byte[20000];
                     while (n>0)
                     {      int k=in.read(b,pos,n);
                            if (k<0) break;
                            pos+=k;
                            n=in.available();
                     }
                     in.close();
                     IOn=Toolkit.getDefaultToolkit().createImage(b,0,pos);
                     MediaTracker T=new MediaTracker(bar);
                     T.addImage(IOn,0);
                     in=getClass().getResourceAsStream(
                            Bar.Resource+file+"off"+"."+Global.getParameter("icontype","gif"));
                     pos=0;
                     n=in.available();
                     byte b1[]=new byte[20000];
                     while (n>0)
                     {      int k=in.read(b1,pos,n);
                            if (k<0) break;
                            pos+=k;
                            n=in.available();
                     }
                     in.close();
                     IOff=Toolkit.getDefaultToolkit().createImage(b1,0,pos);
                     T.addImage(IOff,1);
                     T.waitForAll();
                     W=IOn.getWidth(this);
                     H=IOn.getHeight(this);
                     if (Bar.Vertical) X=Size/2-W/2;
                     else X=0;
                     Y=Size/2-H/2;
              }
              catch (Exception e)
              {      IOn=IOff=null;
              }
       }

Here is the call graph for this function:


Member Function Documentation

void rene.gui.BasicIcon.dopaint ( Graphics  g) [inline, inherited]

Reimplemented in rene.gui.MultipleStringIcon, rene.gui.ColorIcon, rene.gui.MultipleIcon, and rene.gui.IconWithGif.

Definition at line 138 of file IconBar.java.

       {
       }

Here is the caller graph for this function:

String rene.gui.BasicIcon.getName ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 277 of file IconBar.java.

       {      return Name;
       }

Here is the caller graph for this function:

Point rene.gui.BasicIcon.getPosition ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 267 of file IconBar.java.

       {      return getLocationOnScreen();
       }
boolean rene.gui.BasicIcon.hasFocus ( ) [inline, inherited]

Definition at line 281 of file IconBar.java.

{ return Focus; }
boolean rene.gui.BasicIcon.isSet ( ) [inline, inherited]

Definition at line 286 of file IconBar.java.

       {      return !Unset;
       }      

Here is the caller graph for this function:

void rene.gui.StateDisplay.mouseClicked ( MouseEvent  e) [inline]

Reimplemented from rene.gui.BasicIcon.

Definition at line 819 of file IconBar.java.

{}     
synchronized void rene.gui.BasicIcon.mouseEntered ( MouseEvent  e) [inline, inherited]

Start a thread, that waits for one second, then tells the icon bar to display the proper help text.

Definition at line 198 of file IconBar.java.

       {      if (T!=null) return;
              if (Enabled) MouseOver=true;
              repaint();
              if (!Global.getParameter("iconbar.showtips",true)) return;
              Control=e.isControlDown();
              T=new Thread(this);
              T.start();
       }

Here is the call graph for this function:

synchronized void rene.gui.BasicIcon.mouseExited ( MouseEvent  e) [inline, inherited]

Tell the run method, that display is no longer necessary, and remove the help text.

Definition at line 250 of file IconBar.java.

       {      T=null;
              MouseOver=false;
              repaint();
              Bar.removeHelp();
       }

Here is the call graph for this function:

void rene.gui.StateDisplay.mousePressed ( MouseEvent  e) [inline]

User pressed the mouse key over this button.

Reimplemented from rene.gui.BasicIcon.

Definition at line 817 of file IconBar.java.

{}
void rene.gui.StateDisplay.mouseReleased ( MouseEvent  e) [inline]

User released the mouse key again.

Reimplemented from rene.gui.BasicIcon.

Definition at line 818 of file IconBar.java.

{ T=null; }
void rene.gui.StateDisplay.paint ( Graphics  g) [inline]

Paint a button with an image.

Reimplemented from rene.gui.BasicIcon.

Definition at line 806 of file IconBar.java.

       {      if (Enabled && IOn!=null)
              {      if (W>getSize().width) g.drawImage(IOn,1,1,Size-2,Size-2,this);
                     else g.drawImage(IOn,X,Y,this);
              }
              else if (!Enabled && IOff!=null)
              {      if (W>getSize().width) g.drawImage(IOff,1,1,Size-2,Size-2,this);
                     else g.drawImage(IOff,X,Y,this);
              }
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.pressed ( MouseEvent  e) [inline, inherited]

Overwrite for children!

Parameters:
eMouse event for determining right button etc.

Reimplemented in rene.gui.OnOffIcon, rene.gui.ToggleIcon, and rene.gui.MultipleIcon.

Definition at line 185 of file IconBar.java.

       {
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.processKeyEvent ( KeyEvent  e) [inline, inherited]

Definition at line 80 of file IconBar.java.

       {      Bar.getKey(e);
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.run ( ) [inline, inherited]

A thread to display an icon help.

Definition at line 211 of file IconBar.java.

       {      try
              {      Thread.sleep(1000);
              }
              catch (Exception e) {}
              if (T!=null)
              {      synchronized(this)
                     {      try
                            {      Point P=getLocationOnScreen();
                                   String help=Global.name("iconhelp."+Name,"");
                                   if (help.equals("") && Name.length()>1)
                                   {      help=Global.name("iconhelp."+
                                                 Name.substring(0,Name.length()-1)+"?","");
                                   }
                                   if (help.equals(""))
                                          help=Bar.getHelp(Name);
                                   if (help.equals(""))
                                          help=Global.name("iconhelp.nohelp","No help available");
                                   if (Control)
                                   {      String hc=Global.name("iconhelp.control."+Name,"");
                                          if (!hc.equals("")) help=hc;
                                   }
                                   Bar.displayHelp(this,help);
                            }
                            catch (Exception e) {}
                     }
                     try
                     {      Thread.sleep(5000);
                     }
                     catch (Exception e) {}
                     if (T!=null) Bar.removeHelp();
                     T=null;
              }
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.setEnabled ( boolean  flag) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 271 of file IconBar.java.

       {      if (Enabled==flag) return;
              Enabled=flag;
              repaint();
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.setFocus ( boolean  flag) [inline, inherited]

Definition at line 282 of file IconBar.java.

{ Focus=flag; repaint(); }  

Here is the caller graph for this function:

void rene.gui.BasicIcon.setPosition ( int  x,
int  y 
) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 263 of file IconBar.java.

       {      setLocation(x,y);
       }
void rene.gui.BasicIcon.showFocus ( Graphics  g) [inline, inherited]

Definition at line 130 of file IconBar.java.

       {      g.setColor(Color.white);
              g.drawRect(4,4,1,1);
              g.drawRect(Size-5,4,1,1);
              g.drawRect(4,Size-5,1,1);
              g.drawRect(Size-5,Size-5,1,1);
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.unset ( boolean  flag) [inline, inherited]

Definition at line 289 of file IconBar.java.

       {      Unset=flag;
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.unset ( ) [inline, inherited]

Reimplemented in rene.gui.ToggleIcon.

Definition at line 292 of file IconBar.java.

       {      unset(true);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.BasicIcon.update ( Graphics  g) [inline, inherited]

Definition at line 142 of file IconBar.java.

       {      paint(g);
       }

Here is the call graph for this function:

int rene.gui.BasicIcon.width ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 259 of file IconBar.java.

       {      return Size;
       }

Here is the caller graph for this function:


Member Data Documentation

IconBar rene.gui.BasicIcon.Bar [package, inherited]

Definition at line 64 of file IconBar.java.

boolean rene.gui.BasicIcon.Control [package, inherited]

Definition at line 192 of file IconBar.java.

boolean rene.gui.BasicIcon.Enabled [package, inherited]

Definition at line 66 of file IconBar.java.

boolean rene.gui.BasicIcon.Focus = false [package, inherited]

Definition at line 68 of file IconBar.java.

int rene.gui.StateDisplay.H [package]

Definition at line 754 of file IconBar.java.

Image rene.gui.StateDisplay.IOff [package]

Definition at line 753 of file IconBar.java.

Image rene.gui.StateDisplay.IOn [package]

Definition at line 753 of file IconBar.java.

boolean rene.gui.BasicIcon.MouseDown [package, inherited]

Definition at line 70 of file IconBar.java.

boolean rene.gui.BasicIcon.MouseOver [package, inherited]

Definition at line 70 of file IconBar.java.

String rene.gui.BasicIcon.Name [package, inherited]

Definition at line 65 of file IconBar.java.

boolean rene.gui.BasicIcon.On [package, inherited]

Definition at line 67 of file IconBar.java.

int rene.gui.BasicIcon.Size = 22 [static, inherited]

Definition at line 69 of file IconBar.java.

Thread rene.gui.BasicIcon.T [package, inherited]

Definition at line 191 of file IconBar.java.

boolean rene.gui.BasicIcon.Unset [package, inherited]

Definition at line 71 of file IconBar.java.

int rene.gui.StateDisplay.W [package]

Definition at line 754 of file IconBar.java.

int rene.gui.StateDisplay.X [package]

Definition at line 754 of file IconBar.java.

int rene.gui.StateDisplay.Y [package]

Definition at line 754 of file IconBar.java.


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