Changeset 38890
- Timestamp:
- 2024-03-29T22:29:25+13:00 (4 weeks ago)
- Location:
- main/trunk/greenstone3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/GsdlCollageApplet.java
r38889 r38890 1 1 package org.greenstone.applet.GsdlCollageApplet; 2 3 import org.webswing.toolkit.api.WebswingUtil; 2 4 3 5 //import java.applet.Applet; 4 6 import javax.swing.JApplet; 5 //import javax.swing.SwingUtilities; 7 import java.awt.event.MouseAdapter; 8 import java.awt.event.MouseEvent; 9 import java.awt.event.MouseListener; 6 10 import java.awt.event.WindowAdapter; 7 11 import java.awt.event.WindowEvent; … … 33 37 private int Y_DIM = 300; 34 38 35 public int X_DIM() {36 return X_DIM;37 }38 public int Y_DIM() {39 return Y_DIM;40 }41 42 39 // To run this GsdlCollageApplet as Application instead of as Applet 43 40 boolean isWebswingApplication = false; // if run as webswing *and* application (not applet) … … 99 96 100 97 101 98 /** Gets the set, calculated or default width (x dimension) of the applet/application */ 99 public int X_DIM() { 100 return X_DIM; 101 } 102 /** Gets the set, calculated or default height (y dimension) of the applet/application */ 103 public int Y_DIM() { 104 return Y_DIM; 105 } 106 102 107 /** Gets verbosity */ 103 108 public int verbosity() { return verbosity_; } … … 152 157 //} 153 158 159 this.addMouseListener(new CollageMouseAdapter()); 154 160 } 155 161 … … 432 438 image_url = image_url + classifierSuffix; 433 439 } 434 435 /*436 if(library != null && site != null && collection_param != null) {437 String gs3CollImgPath = library + "/sites/" + site + "/collect/" + collection_param;438 if(href_musthave == null) {439 href_musthave = gs3CollImgPath;440 } else {441 href_musthave += "%" + gs3CollImgPath;442 }443 if(verbosity_ >= 3) {444 System.err.println("href_musthave includes gs3CollImgPath: " + gs3CollImgPath);445 }446 }447 */448 440 } 449 441 } … … 466 458 return this.statusBar; 467 459 } 468 460 461 protected class CollageMouseAdapter extends MouseAdapter { 469 462 470 463 /** Goes to the url associated with the image that is clicked on screen<br> 471 464 * Displays the url containing the image in a new window */ 472 public boolean mouseDown(Event event, int x, int y) 465 //public boolean mouseDown(Event event, int x, int y) 466 public void mousePressed(MouseEvent e) 473 467 { 468 469 System.err.println("Mouse pressed"); 470 int x = e.getX(); 471 int y = e.getY(); 472 474 473 // determines which image was clicked on 475 CollageImage cimage = display_thread_.clickedOnImage(x,y);474 CollageImage cimage = GsdlCollageApplet.this.display_thread_.clickedOnImage(x,y); 476 475 // if they were clicking on an image (as opposed to background) 477 476 if (cimage != null) … … 491 490 from_url = new URL(cimage.from_url_ + "#" + cimage.name_); 492 491 } 493 getAppletContext().showDocument(from_url,"gsdlDoc"); 492 493 if(isRunAsApplet) { 494 GsdlCollageApplet.this.getAppletContext().showDocument(from_url,"gsdlDoc"); 495 } else if(isWebswingApplication) { 496 WebswingUtil.getWebswingApi().sendActionEvent("openURL", 497 from_url.toString() + " - " +"gsdlDoc", 498 null); // window name is gsdlDoc 499 } else { 500 System.err.println("@@@GsdlCollageApplet.CollageMouseAdapter.mousePressed()" 501 + "\n\topening url " + from_url + "\n\t" 502 + "for non-applet and non-webswing application is not yet implemented."); 503 } 494 504 } 495 catch (MalformedURLException e) { 496 e.printStackTrace(); 497 } 498 499 } 500 return true; 505 catch (MalformedURLException ex) { 506 ex.printStackTrace(); 507 } 508 509 } 510 //return true; 511 } 501 512 } 502 513 … … 662 673 // It's now figured out the dimensions based on anything specified, so set frame size 663 674 frame.setSize(collageApp.X_DIM(), collageApp.Y_DIM()); //Y_DIM+EXTRA_HEIGHT); 675 664 676 // status bar code. Not ideal, but had to add it here to get relative dimensions right 665 677 collageApp.setLayout(new BorderLayout()); -
main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/MyAffineTransform.java
r38853 r38890 21 21 22 22 double scale_factor = 1.0; 23 24 //to avoid attempting to divide by 0 25 // TODO: Why is it even 0? I had initialised app_x/y_dim_ with fallback to ensure non-0 26 // Hard to debug, as I've seen it happen only once. 27 //if(DisplayImages.app_x_dim_ == 0 || DisplayImages.app_y_dim_ == 0) { 28 // return scale_factor; 29 //} 23 30 24 31 // three quarters of the application width & height -
main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-collage.xsl
r38889 r38890 120 120 var url = data; 121 121 // check if a target tab/window name has been specified 122 // Any better way of passing more than1 string between Java and JavaScript?122 // TODO: Any better way of passing > 1 string between Java and JavaScript? 123 123 var index = url.indexOf(" - "); 124 124 if (index !== -1) { 125 125 var target = url.substring(index+3); // skip past " - " to get target name 126 url = url.substring(0, index); 127 // Note that target window name is not the same as target window title 128 // https://stackoverflow.com/questions/8051811/how-to-show-window-title-using-window-open 126 129 window.open(url, target); 127 130 } else { -
main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-phind.xsl
r38872 r38890 119 119 var url = data; 120 120 // check if a target tab/window name has been specified 121 // Any better way of passing more than1 string between Java and JavaScript?121 // TODO: Any better way of passing > 1 string between Java and JavaScript? 122 122 var index = url.indexOf(" - "); 123 123 if (index !== -1) { 124 124 var target = url.substring(index+3); // skip past " - " to get target name 125 url = url.substring(0, index); 125 126 window.open(url, target); 126 127 } else {
Note:
See TracChangeset
for help on using the changeset viewer.