Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

ActionButton Class Reference

Inheritance diagram for ActionButton:

Widget List of all members.

Public Member Functions

 ActionButton (String prefix, Form form)
void loadValues ()
void display (boolean hidden)
void display (String name, int action)
void display (String name, int action, int param)
void display (String name, int action, int param, String attribs)
String gethref (int action, int param)
void dumpScript ()

Protected Member Functions

String getString (int action, int param)
void setThisString (String s)

Package Attributes

int action = 0
int param = 0

Detailed Description

Definition at line 3 of file ActionButton.java.


Constructor & Destructor Documentation

ActionButton::ActionButton String  prefix,
Form  form
[inline]
 

Definition at line 8 of file ActionButton.java.

00009         {
00010           super(prefix, form);
00011         }


Member Function Documentation

void ActionButton::display String  name,
int  action,
int  param,
String  attribs
[inline]
 

Definition at line 66 of file ActionButton.java.

References getString(), Widget::n(), and Widget::p().

00067         {
00068     String n = this.n(getString(action, param));
00069     p("<input type=submit name=\"" + n + "\" value=\"" + name
00070       + "\"" + attribs + ">");
00071         }

void ActionButton::display String  name,
int  action,
int  param
[inline]
 

Definition at line 61 of file ActionButton.java.

References Widget::display().

00062         {
00063           display(name, action, param, "");
00064         }

void ActionButton::display String  name,
int  action
[inline]
 

Definition at line 56 of file ActionButton.java.

References Widget::display().

00057         {
00058           display(name, action, 0, "");
00059         }

void ActionButton::display boolean  hidden  )  [inline]
 

Reimplemented from Widget.

Definition at line 51 of file ActionButton.java.

00052         {
00053           // actions are not persistent
00054         }

void ActionButton::dumpScript  )  [inline]
 

Definition at line 79 of file ActionButton.java.

References Widget::p().

00080   {
00081     p(
00082 ""/*"<!-- Begin ActionButton Script -->\n"+
00083 "<script>\n"+
00084 "<!--\n"+
00085 "  function ActionButton_go(action,object,actionobject)\n"+
00086 "  {\n"+
00087 "    //alert(actionobject.name + \" set to '\" + action + \"'\");\n"+
00088 "    actionobject.value = action + '_' + object;\n"+
00089 "    if (actionobject.form.onsubmit) actionobject.form.onsubmit();\n"+
00090 "    actionobject.form.submit();\n"+
00091 "  }\n"+
00092 "\n"+
00093 "  function ActionButton_sgo(action,object,form,actionelement)\n"+
00094 "  {\n"+
00095 "    //alert(document.forms[form][actionelement]);\n"+
00096 "    ActionButton_go(action,object,document.forms[form][actionelement]);\n"+
00097 "  }\n"+
00098 "// -->\n"+
00099 "</script>\n"+
00100 "<!-- End ActionButton Script -->\n"+
00101 ""*/
00102     );
00103   }

String ActionButton::gethref int  action,
int  param
[inline]
 

Definition at line 73 of file ActionButton.java.

References Widget::form, Form::name, and Widget::prefix.

00074   {
00075     return "javascript:ActionButton_sgo(" + action + ", " + param + ", '"
00076       + form.name + "', '" + prefix + "');";
00077   }

String ActionButton::getString int  action,
int  param
[inline, protected]
 

Definition at line 38 of file ActionButton.java.

00039         {
00040           String s = Integer.toString(action) +  "_" + Integer.toString(param);
00041           return s;
00042         }

void ActionButton::loadValues  )  [inline]
 

Reimplemented from Widget.

Definition at line 13 of file ActionButton.java.

References Widget::form, Widget::n(), Widget::p(), Widget::prefix, Form::req, and setThisString().

00014         {
00015     String s = form.req.getParameter(prefix);
00016     if(s != null && s.length() > 0)
00017       setThisString(s);
00018     else
00019     {
00020       String c = prefix + ".";
00021       int cl = c.length();
00022       
00023       for (Enumeration e = form.req.getParameterNames(); e.hasMoreElements() ;)
00024       {
00025         String n = (String) e.nextElement();
00026         if (n == null) break; 
00027         if (n.length() < cl) continue;       
00028         if (n.substring(0,cl).equals(c))
00029         {
00030           String p = n.substring(cl);
00031           setThisString(p);
00032           break;
00033         }
00034       }
00035     }
00036         }

void ActionButton::setThisString String  s  )  [inline, protected]
 

Definition at line 44 of file ActionButton.java.

References Widget::p().

00045         {
00046           int p = s.lastIndexOf('_');
00047           this.action = Integer.parseInt(s.substring(0,p));
00048           this.param = Integer.parseInt(s.substring(p+1));
00049         }


Member Data Documentation

int ActionButton::action = 0 [package]
 

Definition at line 5 of file ActionButton.java.

int ActionButton::param = 0 [package]
 

Definition at line 6 of file ActionButton.java.


The documentation for this class was generated from the following file:
Generated on Mon Mar 6 23:34:35 2006 by  doxygen 1.4.4