• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reusable WORollover...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reusable WORollover...


  • Subject: Re: Reusable WORollover...
  • From: Nathan Walker <email@hidden>
  • Date: Wed, 22 Jun 2005 11:55:48 -0400

Clive, that is EXACTLY what I needed! Thank you soooo much!

For the board, just be sure to put ^ (carrots) before your binding names in WOBuilder so whatever component you put this into, you can specify the image Names correctly and so forth. I have just gotten into making my components more reusable and more efficient and I just haven't grasped the concept of how to properly do this. But this gives me a LOT better idea. It lies in the valueForBinding("myBinding"); method.

Thanks a million, Clive, you the man !
-Nathan


On Jun 22, 2005, at 11:37 AM, Clive Roberts wrote:

Is the following what you need, it works a treat!  

Don't forget the bindings:
highlightedImage - required - Resources
imageName - required
unhighlightedImage - required - Resources
directActionName - Direct Actions

good luck

Clive Roberts 


// Generated by the WebObjects Wizard Thu Jul 24 08:46:43 GMT 2003
//
// Created by cliveroberts on Thu Apr 01 2004
//

import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;

public class WORollover extends WOComponent {

    public WORollover(WOContext context) {
        super(context);
    }

    /*
    * non synching component
    */
      public boolean synchronizesVariablesWithBindings() {
      return false;
    }

    /*
    * stateless component
    */
    public boolean isStateless() {
        return true;
    }

    public String onMouseOver() {
        String imageName = (String) valueForBinding("imageName");
        return imageName + ".src=""Apple-style-span" face="Monaco" size="2"> + imageName + "_H.src;";
    }
    public String onMouseOut() {

         String imageName = (String) valueForBinding("imageName");
         return imageName + ".src=""Apple-style-span" face="Monaco" size="2"> + imageName + "_U.src;";
    }
    public String scriptString() {
        String imageName = (String) valueForBinding("imageName");
        String unhighlightedImage = (String) valueForBinding("unhighlightedImage");
        String highlightedImage = (String) valueForBinding("highlightedImage");
        WOResourceManager resourceManager = application().resourceManager();
                String unhighlightedImageURL = resourceManager.urlForResourceNamed(unhighlightedImage, null, null, context().request());
                String highlightedImageURL = resourceManager.urlForResourceNamed(highlightedImage, null, null, context().request());
                String scriptString = imageName + "_U = new Image();\n" +  imageName + "_U.src='';\n" + imageName + "_H = new Image();\n" + imageName + "_H.src='';\n";
        return scriptString;
    }
}




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Xcode1.5 won't let me add existing files to project
  • Next by Date: Re: toHTMLString
  • Previous by thread: Workaround: Xcode1.5 won't let me add existing files to project
  • Next by thread: Using Old EOModeler with WO 5.3/xCode 2.1?
  • Index(es):
    • Date
    • Thread