Changeset 38889
- Timestamp:
- 2024-03-28T22:04:59+13:00 (4 weeks ago)
- Location:
- main/trunk/greenstone3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/DisplayImages.java
r38885 r38889 104 104 if (is_java2_) 105 105 { 106 //app_x_dim_ = (app_.getWidth() == 0) ? xDim_fallback :app_.getWidth();107 //app_y_dim_ = (app_.getHeight() == 0) ? yDim_fallback :app_.getHeight();108 app_x_dim_ = app_.getWidth();109 app_y_dim_ = app_.getHeight();106 //app_x_dim_ = app_.getWidth(); 107 //app_y_dim_ = app_.getHeight(); 108 app_x_dim_ = (app_.getWidth() <= 0) ? app_.X_DIM() : app_.getWidth(); 109 app_y_dim_ = (app_.getHeight() <= 0) ? app_.Y_DIM() : app_.getHeight(); 110 110 111 111 System.err.println("@@@ xDim: " + app_x_dim_); … … 114 114 else 115 115 { 116 app_x_dim_ = app_.X_DIM ;117 app_y_dim_ = app_.Y_DIM ;116 app_x_dim_ = app_.X_DIM(); 117 app_y_dim_ = app_.Y_DIM(); 118 118 } 119 119 -
main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/GsdlCollageApplet.java
r38888 r38889 30 30 public class GsdlCollageApplet extends JApplet { 31 31 static final int EXTRA_HEIGHT = 30; // for status bar or any extra elements 32 static final int X_DIM = 600; 33 static final int Y_DIM = 300; 34 32 private int X_DIM = 600; 33 private int Y_DIM = 300; 34 35 public int X_DIM() { 36 return X_DIM; 37 } 38 public int Y_DIM() { 39 return Y_DIM; 40 } 41 35 42 // To run this GsdlCollageApplet as Application instead of as Applet 36 43 boolean isWebswingApplication = false; // if run as webswing *and* application (not applet) … … 195 202 196 203 isWebswingApplication = appParams.getOrDefault("webswing", "0").equals("1") ? true : false; 204 // Need these parameters set before init(), so that the display works 205 int w = this.getWidth(); 206 if(appParams.get("width") != null) { 207 w = Integer.parseInt(appParams.get("width")); 208 } 209 int h = this.getHeight(); 210 if(appParams.get("height") != null) { 211 h = Integer.parseInt(appParams.get("height")); 212 } 213 // For applet, w and h may now be set to a positive value. But if GsdlCollageApplet 214 // is run as an application, it won't yet be visible and not have a non-zero dimension. 215 // So use defaults here: 216 this.X_DIM = (w <= 0) ? X_DIM : w; 217 this.Y_DIM = (h <= 0) ? Y_DIM : h; 218 197 219 try { 198 220 this.docBaseURL = new URL(appParams.get("baseurl")); … … 619 641 /** 620 642 * After building the GS3 Multimedia collection, try running this Application as: 621 java -cp ./web/applet/GsdlCollageApplet.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet --statusbar 1 --baseurl "http://localhost:8383/greenstone3/" --library library --collection smallbea --gsdlversion 3 --hrefMustHave "library/sites/localsite/collect/smallbea" --documentroot greenstone3 --verbosity 3 --imageType ".jpg%.png" --imageMustNotHave "interfaces/" --classifier "CL2.3" --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --isJava2 auto --bgcolor "#96c29a"643 java -cp ./web/applet/GsdlCollageApplet.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet --statusbar 0 --baseurl "http://localhost:8383/greenstone3/" --library library --collection smallbea --gsdlversion 3 --hrefMustHave "library/sites/localsite/collect/smallbea" --documentroot greenstone3 --verbosity 3 --imageType ".jpg%.png" --imageMustNotHave "interfaces/" --classifier "CL2.3" --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --isJava2 auto --bgcolor "#96c29a" --width 645 --height 780 622 644 */ 623 645 public static void main(String[] args) { … … 630 652 GsdlCollageApplet collageApp = new GsdlCollageApplet(); 631 653 frame.getContentPane().add(collageApp, BorderLayout.CENTER); 632 frame.setSize(X_DIM, Y_DIM); //Y_DIM+EXTRA_HEIGHT);654 //frame.setSize(X_DIM, Y_DIM); //Y_DIM+EXTRA_HEIGHT); 633 655 frame.setVisible(true); 634 656 // https://stackoverflow.com/questions/19433358/difference-between-dispose-and-exit-on-close-in-java … … 638 660 // prepare to run the collage applet as an application 639 661 collageApp.applicationPreInit(args); 640 662 // It's now figured out the dimensions based on anything specified, so set frame size 663 frame.setSize(collageApp.X_DIM(), collageApp.Y_DIM()); //Y_DIM+EXTRA_HEIGHT); 641 664 // status bar code. Not ideal, but had to add it here to get relative dimensions right 642 665 collageApp.setLayout(new BorderLayout()); -
main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-collage.xsl
r38888 r38889 83 83 <link rel="stylesheet" href="/webswing-server/css/style.css" /> 84 84 85 <div id="webswing-collage" class="webswing-element" data-webswing-instance="webswingInstance0" style="width: 645px; height: 780px;">85 <div id="webswing-collage" class="webswing-element" data-webswing-instance="webswingInstance0" style="width: 800px; height: 400px;"> 86 86 <div id="loading" class="ws-modal-container"> 87 87 <div class="ws-login"> … … 163 163 webswingInstance0.options.args += " --imageType " + "\".jpg%.png\""; 164 164 webswingInstance0.options.args += " --classifier \"CL2.3\""; 165 webswingInstance0.options.args += " --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --bgcolor \"#96c29a\""; 165 webswingInstance0.options.args += " --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --bgcolor \"#96c29a\""; 166 167 // Control the width and height of the Java application launched with webswing 168 // by passing width and height params set to the attributes of the webswing element 169 // https://stackoverflow.com/questions/21851633/get-height-from-style-attribute 170 var w = document.getElementById("webswing-collage").style.width; 171 var suffixIndex = 0; 172 if(w) { 173 suffixIndex = w.indexOf("px"); 174 if(suffixIndex>0) { 175 w = w.substring(0, suffixIndex); 176 } 177 webswingInstance0.options.args += " --width " + w; 178 } 179 var h = document.getElementById("webswing-collage").style.height; 180 if(h) { 181 suffixIndex = h.indexOf("px"); 182 if(suffixIndex>0) { 183 h = h.substring(0, suffixIndex); 184 } 185 webswingInstance0.options.args += " --height " + h; 186 } 166 187 167 188 //console.log("args: " + webswingInstance0.options.args);
Note:
See TracChangeset
for help on using the changeset viewer.