Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Attributes | Package Functions | Package Attributes | Private Member Functions
SharpTools.FunctionListListener Class Reference

Implements help on functions. More...

Inheritance diagram for SharpTools.FunctionListListener:
Inheritance graph
[legend]
Collaboration diagram for SharpTools.FunctionListListener:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void actionPerformed (ActionEvent e)

Static Public Attributes

static Properties translation = SharpTools.translation

Package Functions

 FunctionListListener (JFrame frame, JTable table)

Package Attributes

JFrame frame
JTable table
final ImageIcon helpIcon = new ImageIcon(getClass().getResource("/images/help32.gif"))

Private Member Functions

void showGeneralFunctionHelp ()

Detailed Description

Implements help on functions.

When the user selects a function and he is editing, insert the function name to the editing point; otherwise, pop up a help box to briefly explain the usage of this function.

Definition at line 150 of file HelpOp.java.


Constructor & Destructor Documentation

SharpTools.FunctionListListener.FunctionListListener ( JFrame  frame,
JTable  table 
) [inline, package]

Definition at line 158 of file HelpOp.java.

                                                     {
       this.frame = frame;
       this.table = table;
    }

Member Function Documentation

void SharpTools.FunctionListListener.actionPerformed ( ActionEvent  e) [inline]

Definition at line 163 of file HelpOp.java.

                                               {
       JComboBox cb = (JComboBox)e.getSource();
       String funcName = (String)cb.getSelectedItem();
              
       try {
           if (table.isEditing()) {
              int row = table.getEditingRow();
              int col = table.getEditingRow();
              // get the editor
              JTextField text = ((SharpCellEditor)table.getCellEditor(row, col)).getTextField();

              if (!funcName.equals(translation.getProperty("Functions"))) {
                  // insert our function name
                  text.replaceSelection(funcName+"()");
                  // set caret between parentheses if the user needs to input parameters
                  Function fh = Formula.getFuncHandler(funcName);
                  if (fh != null && fh.requireParams())
                     text.setCaretPosition(text.getCaretPosition()-1);
              }
              else
                  showGeneralFunctionHelp();
              text.requestFocus();
           }         
           else {
              // pop up help message box!
              Function fh = Formula.getFuncHandler(funcName);
              if (fh != null) {
                  
                  String message = "<html><font size=2 color=black><b>"+
                     fh.getUsage()+"</b><p><p>"+fh.getDescription()+"<p></font>";

                  SharpOptionPane.showMessageDialog(frame,
                                                message,
                                                translation.getProperty("Function"),
                                                JOptionPane.INFORMATION_MESSAGE,
                                                helpIcon);
              }
              else
                  showGeneralFunctionHelp();
              
              table.requestFocus();
           }
       }
       catch (Exception exception) {};
       // reset the selection and focus
       cb.setSelectedIndex(0);            
    }

Here is the call graph for this function:

Definition at line 211 of file HelpOp.java.

                                           {
       String message = translation.getProperty("helpmessage");
/*     "<html><font size=2 color=black><b><font size=3>Functions</font></b><p>"+
           "<p>Functions are predefined formulas that perform calculations by"+
           "<p>using specific values, called arguments, in a particular order,"+"<p>or structure.<p>"+
           "<p><b>Arguments</b> Arguments can be numbers or cell references. A cell"+
           "<p>reference can be a single cell or a range of cells.  A single cell can"+
           "<p>use relative addressing (A1) or absolute addressing ($B$5).  A range"+
           "<p>of cell is specified by a pair of diagonal cells (A1:C5, $A$1:$C$5)."+
           "<p>Different functions may have different requirements on the number"+
           "<p>or type of parameters.<p>"+
           "<p><b>Structure</b> The structure of a function begins with the function"+
           "<p>name, followed by an opening parenthesis, the arguments for"+
           "<p>the function separated by commas, and a closing parenthesis."+
           "<p>If the function starts a formula, type an equal sign (=) before"+
           "<p>the function name.  As you are editing a formula that contains"+
           "<p>a function, you can click on a function in this list to insert the"+
           "<p>function name into the cell.<p>"+
           "<p><b>Examples:</b><p>"+
           "<p>=SUM(A10,B5:B10,50,37)"+
           "<p>=AVERAGE($B$5:$B$10)/10</font>";
*/
       SharpOptionPane.showMessageDialog(frame,
                                     message,
                                     "Function",
                                     JOptionPane.INFORMATION_MESSAGE,
                                     helpIcon);

    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 153 of file HelpOp.java.

final ImageIcon SharpTools.FunctionListListener.helpIcon = new ImageIcon(getClass().getResource("/images/help32.gif")) [package]

Definition at line 155 of file HelpOp.java.

Definition at line 154 of file HelpOp.java.

Definition at line 152 of file HelpOp.java.


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