Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/webobjects/woextensions/JSAlertPanel.java


1   /*
2    * JSAlertPanel.java
3    * © Copyright 2001 Apple Computer, Inc. All rights reserved.
4    * This a modified version.
5    * Original license: http://www.opensource.apple.com/apsl/
6    */
7   
8   package com.webobjects.woextensions;
9   
10  import com.webobjects.appserver.*;
11  import com.webobjects.foundation.*;
12  
13  public class JSAlertPanel extends JSComponent {
14      
15      public JSAlertPanel(WOContext aContext)  {
16          super(aContext);
17      }
18  
19      public String alertJSMessage() {
20  
21          String theMessage = (String)_WOJExtensionsUtil.valueForBindingOrNull("alertMessage",this);
22  
23              // Put in a default message if one was not provided
24          if (theMessage==null) {
25  
26                      theMessage = "Done.";
27  
28              } else {
29  
30                      // Strip out the tags in the message that will mess things up - like apostrophes and quotes
31              theMessage = NSArray.componentsSeparatedByString(theMessage, "'").componentsJoinedByString("");
32              theMessage = NSArray.componentsSeparatedByString(theMessage, "\"").componentsJoinedByString("");
33              }  
34  
35              // Return the opening string for the Javascript function
36          return "return alert('"+theMessage+"')";
37  
38      }
39  
40      public boolean isImage() {
41  
42             // If the user specified an image name, return YES
43          return (valueForBinding("filename")!=null);
44      }
45  
46      public boolean isText() {
47  
48             // If the user specified a hyperlink string, return YES
49          return (valueForBinding("string")!=null);
50      }
51  
52      public boolean isImageAndText() {
53  
54             // If the user specified a hyperlink string AND and image, return YES
55          return isImage() && isText();
56      }
57  }