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

Quick Search    Search Deep

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


1   /*
2    * JSImageFlyover.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  import java.util.Random;
13  
14  public class JSImageFlyover extends JSComponent {
15      public String uniqueID;
16     
17      public JSImageFlyover(WOContext aContext)  {
18          super(aContext);
19      }
20  
21      public void appendToResponse(WOResponse response, WOContext context) {
22          // We need to give each image a unique name, with considerations that there might be
23          // more than one ImageFlyover per page.
24  
25          StringBuffer uniqueIDBuffer = new StringBuffer("ImageFlyover");
26          uniqueIDBuffer.append(context.contextID());
27          uniqueIDBuffer.append("_");
28          uniqueIDBuffer.append(context.elementID().replace('.', '_'));
29          uniqueID = uniqueIDBuffer.toString();
30          super.appendToResponse(response, context);
31  
32      }
33  
34      protected String _url(String binding) {
35          String aFilename = (String)_WOJExtensionsUtil.valueForBindingOrNull(binding,this);
36          String source = application().resourceManager().urlForResourceNamed(aFilename, framework(), session().languages(), context().request());
37          return source;
38      }
39      
40      public String mouseOver() {
41          // What to do when the mouse moves over the image ...
42          // Return the image source name
43          return uniqueID+".src='"+_url("selectedImage")+"'";
44      }
45  
46      public String mouseOut() {
47          // What to do when the mouse moves off the image ...
48          // Return the image source name
49          return uniqueID+".src='"+_url("unselectedImage")+"'";
50      }
51  
52      public String imageLocation() {
53          // Return the base image (what the hyperlink starts with) to the WOImage
54          return _url("unselectedImage");
55      }
56  }