[Bio] / WebApplication / WebComponent.pm Repository:
ViewVC logotype

Diff of /WebApplication/WebComponent.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4, Thu Sep 4 18:59:15 2008 UTC revision 1.5, Thu Feb 5 07:30:55 2009 UTC
# Line 156  Line 156 
156    die "Abstract method 'output' must be implemented in __PACKAGE__.\n";    die "Abstract method 'output' must be implemented in __PACKAGE__.\n";
157  }  }
158    
159    =head3 JavaCall
160    
161        my $string = $comp->JavaCall($name => @parms);
162    
163    Format a call to a java function. The parameters will all be converted to
164    string literals and assembled with the method name.
165    
166    =over 4
167    
168    =item name
169    
170    Name of the Java method to call.
171    
172    =item parms
173    
174    A list of strings. The strings will be converted to Javascript string literals
175    and specified as parameters on the method call.
176    
177    =item RETURN
178    
179    Returns a string that can be used as an event parameter to call the specified
180    Javascript method passing in the specified literal values.
181    
182    =back
183    
184    =cut
185    
186    sub JavaCall {
187        # Get the parameters.
188        my ($self, $name, @parms) = @_;
189        # Quote the strings.
190        my @literals;
191        for my $parm (@parms) {
192            $parm =~ s/\n/\\n/g;
193            $parm =~ s/'/\\'/g;
194            push @literals, "'$parm'";
195        }
196        # Assemble the call.
197        my $retVal = "$name(" . join(", ", @literals) . ")";
198        # Return the result.
199        return $retVal;
200    }
201    
202  1;  1;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3