home *** CD-ROM | disk | FTP | other *** search
- public class Rollover extends ComponentApp {
- // $FF: renamed from: d DMessageBox
- DMessageBox field_0 = new DMessageBox();
- DDrawPicture cdp;
- String codebase;
- DAssetManager assetMan;
- DImage imageSizer;
- int linkURL;
- String setval;
- String theURL;
- int Gcontext;
- int ImageOver;
- int ImageOut;
- String sepChar;
- int asset1;
- int f_asset1;
- int asset2;
- int f_asset2;
- int asset3;
- int f_asset3;
-
- public String PropertyListener(String Event, String Value, int Get, int propIndex, IDInspector insp) {
- if (Get == 1) {
- if (Event.compareTo("Initial image") == 0) {
- return Integer.toString(this.asset1);
- }
-
- if (Event.compareTo(" Mouse over image") == 0) {
- return Integer.toString(this.asset2);
- }
-
- if (Event.compareTo(" Mouse out image") == 0) {
- return Integer.toString(this.asset3);
- }
-
- if (Event.compareTo("Link URL") == 0) {
- return Integer.toString(this.linkURL);
- }
- } else {
- if (Event.compareTo("Link URL") == 0) {
- this.linkURL = Integer.parseInt(Value, 10);
- }
-
- if (Event.compareTo("Initial image") == 0) {
- if (this.asset1 != 0) {
- this.assetMan.RemoveAsset(this.asset1);
- }
-
- if (this.f_asset1 != 0) {
- this.assetMan.RemoveAsset(this.f_asset1);
- }
-
- int temp_int = Integer.parseInt(Value, 10);
- this.f_asset1 = temp_int;
- this.imageSizer = new DImage();
- this.imageSizer.setImageFile(this.assetMan.GetAssetLocation(temp_int, -1, 1));
- IDSize currentImageSize = this.imageSizer.getSize();
- this.cdp.SetSize(currentImageSize.getWidth(), currentImageSize.getHeight());
- this.asset1 = this.assetMan.AddAsset(this.assetMan.GetAssetLocation(temp_int, 1, 1), "Image\u0000", "/");
- this.changeimage(temp_int);
- }
-
- if (Event.compareTo(" Mouse over image") == 0) {
- if (this.asset2 != 0) {
- this.assetMan.RemoveAsset(this.asset2);
- }
-
- if (this.f_asset2 != 0) {
- this.assetMan.RemoveAsset(this.f_asset2);
- }
-
- int temp_int = Integer.parseInt(Value, 10);
- this.f_asset2 = temp_int;
- this.asset2 = this.assetMan.AddAsset(this.assetMan.GetAssetLocation(temp_int, 1, 1), "Image\u0000", "/");
- this.changeimage(temp_int);
- }
-
- if (Event.compareTo(" Mouse out image") == 0) {
- if (this.asset3 != 0) {
- this.assetMan.RemoveAsset(this.asset3);
- }
-
- if (this.f_asset3 != 0) {
- this.assetMan.RemoveAsset(this.f_asset3);
- }
-
- int temp_int = Integer.parseInt(Value, 10);
- this.f_asset3 = temp_int;
- this.asset3 = this.assetMan.AddAsset(this.assetMan.GetAssetLocation(temp_int, 1, 1), "Image\u0000", "/");
- this.changeimage(temp_int);
- }
-
- this.cdp.Invalidate(true);
- }
-
- if (insp != null) {
- insp.OnPropertyChanged(-1);
- }
-
- return "";
- }
-
- public String getName(DDrawPicture cdp) {
- IDRect rect = cdp.getObjectRect();
- int top = rect.getTop();
- int left = rect.getLeft();
- String val = "A" + top + left;
- return val;
- }
-
- public void changeimage(int image) {
- this.cdp.setImageFile(this.assetMan.GetAssetLocation(image, -1, 1));
- }
-
- public String onInstall(DAssetManager cam, String codebase) {
- this.assetMan = cam;
- this.codebase = codebase;
- return "Picture Rollover";
- }
-
- protected void finalize() {
- this.assetMan.RemoveAsset(this.linkURL);
- this.assetMan.RemoveAsset(this.asset1);
- this.assetMan.RemoveAsset(this.asset2);
- this.assetMan.RemoveAsset(this.asset3);
- this.assetMan.RemoveAsset(this.f_asset1);
- this.assetMan.RemoveAsset(this.f_asset2);
- this.assetMan.RemoveAsset(this.f_asset3);
- }
-
- public int getHeight(DDrawPicture cdp) {
- IDRect rect = cdp.getObjectRect();
- int top = rect.getTop();
- int bottom = rect.getBottom();
- int height = bottom - top;
- return height;
- }
-
- public void onPublish(DAssetManager asm, int context) {
- if (this.asset1 != 0) {
- this.changeimage(this.asset1);
- this.Gcontext = context;
- String imageName = this.getName(this.cdp);
- if (this.asset3 != 0) {
- this.ImageOut = this.asset3;
- } else {
- this.ImageOut = this.asset1;
- }
-
- if (this.asset2 != 0) {
- this.ImageOver = this.asset2;
- } else {
- this.ImageOver = this.asset1;
- }
-
- if (this.linkURL != -1) {
- this.theURL = this.assetMan.GetAssetRelativeLocation(this.linkURL, this.Gcontext, 1);
- } else {
- this.theURL = "";
- }
-
- String script = "\n<script language=\"JavaScript\"><!--\n";
- script = script + "function on" + imageName + "Over() {}\n";
- script = script + "function on" + imageName + "Out() {}\n";
- script = script + "//--></script>\n";
- script = script + "<script language=\"JavaScript1.1\">";
- script = script + "<!--\n";
- script = script + "graphic1" + imageName + " = new Image()\n";
- script = script + "graphic1" + imageName + ".src = '" + this.getLocation(this.ImageOut) + "';\n";
- script = script + "graphic2" + imageName + " = new Image()\n";
- script = script + "graphic2" + imageName + ".src = '" + this.getLocation(this.ImageOver) + "';\n";
- script = script + "function on" + imageName + "Over() {\n";
- script = script + "document." + imageName + ".src=graphic2" + imageName + ".src;\n";
- script = script + "}\n";
- script = script + "function on" + imageName + "Out() {\n";
- script = script + "document." + imageName + ".src=graphic1" + imageName + ".src;\n";
- script = script + "}\n";
- script = script + "//-->";
- script = script + "</script>\n";
- script = script + "<a href=\"";
- if (this.linkURL != 0) {
- script = script + this.theURL + "\"";
- } else {
- script = script + "javascript:on" + imageName + "Over()\" onClick=\"return false\"";
- }
-
- script = script + " target=\"_self\" onMouseOver=\"on" + imageName + "Over(this)\"";
- script = script + " onMouseOut=\"on" + imageName + "Out(this)\">";
- this.cdp.setHTMLBefore(script);
- this.cdp.setHTMLBetween("name=" + imageName);
- this.cdp.setHTMLAfter("</a>");
- }
-
- }
-
- public int getWidth(DDrawPicture cdp) {
- IDRect rect = cdp.getObjectRect();
- int left = rect.getLeft();
- int right = rect.getRight();
- int width = right - left;
- return width;
- }
-
- public void onDrop(IDLayout layout, IDRect r, int fDrop) {
- if (fDrop == 1) {
- this.cdp = new DDrawPicture();
- this.codebase = this.cdp.getCodeBase();
- this.cdp.setImageFile(this.codebase + "rollover.gif");
- this.cdp.SetPositionRect(r.getLeft(), r.getTop(), r.getRight(), r.getBottom());
- this.imageSizer = new DImage();
- this.imageSizer.setImageFile(this.codebase + "rollover.gif");
- IDSize currentImageSize = this.imageSizer.getSize();
- this.cdp.SetSize(currentImageSize.getWidth(), currentImageSize.getHeight());
- this.cdp.SetStyle(1, 1);
- this.cdp.setStretch(2);
- this.cdp.setUsePictureText(false);
- layout.AddObject(this.cdp);
- DFile tempfile = new DFile();
- this.sepChar = tempfile.GetPathChar();
- }
- }
-
- public void onInspect(CStringArray Names, CStringArray Types) {
- Names.Set("Initial image");
- Types.Set("Image\u0000");
- if (this.asset1 != 0) {
- Names.Set(" Mouse over image");
- Types.Set("Image\u0000");
- Names.Set(" Mouse out image");
- Types.Set("Image\u0000");
- }
-
- Names.Set("Link URL");
- Types.Set("Link\u0000");
- }
-
- public String getLocation(int image) {
- String imageURL = this.assetMan.GetAssetLocation(image, this.Gcontext, 1);
- imageURL.replace(' ', '_');
- imageURL.replace('\\', '/');
- if (imageURL.indexOf(":/") > 0) {
- imageURL.replace(':', '|');
- }
-
- if (imageURL.indexOf(".//") == 0) {
- imageURL = "./" + imageURL.substring(3);
- } else {
- imageURL.replace(':', '/');
- }
-
- return imageURL;
- }
- }
-