Changeset 839
- Timestamp:
- 02/05/14 14:16:00 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/WebParser.java
r832 r839 39 39 import org.expeditee.gui.DisplayIO; 40 40 import org.expeditee.gui.Frame; 41 import org.expeditee.gui.FrameGraphics; 41 42 import org.expeditee.gui.FrameIO; 42 43 import org.expeditee.gui.FrameMouseActions; … … 282 283 * The Expeditee frame to output the converted page to 283 284 */ 284 public static void parsePageSimple( JfxBrowser browserWidget, final WebEngine webEngine, final WebView webView, final Frame frame) {285 public static void parsePageSimple(final JfxBrowser browserWidget, final WebEngine webEngine, final WebView webView, final Frame frame) { 285 286 try { 286 browserWidget.setOverlayVisible(true); 287 Platform.runLater(new Runnable() { 288 289 @Override 290 public void run() { 291 browserWidget.setOverlayVisible(true); 292 browserWidget.setWebViewSize(FrameGraphics.getMaxFrameSize().getWidth() * 0.9, FrameGraphics.getMaxFrameSize().getHeight() * 0.9); 293 } 294 }); 287 295 288 296 final Object notifier = new Object(); … … 291 299 final MutableBool rightReached = new MutableBool(false); 292 300 293 final MutableInt pageCount = new MutableInt(0); 301 final MutableInt verticalCount = new MutableInt(0); 302 final MutableInt horizontalCount = new MutableInt(0); 294 303 295 304 final String pageTitle = webEngine.getTitle(); … … 323 332 this.stop(); 324 333 325 pageCount.setValue(pageCount.getValue() + 1);326 327 frameToAddTo = FrameIO.CreateFrame(frameToAddTo.getFramesetName(), pageTitle + " " + pageCount.getValue(), null);334 verticalCount.setValue(verticalCount.getValue() + 1); 335 336 frameToAddTo = FrameIO.CreateFrame(frameToAddTo.getFramesetName(), pageTitle, null); 328 337 329 338 try { … … 369 378 370 379 // Adding thumbnail to the overview page 371 Text thumb = frameset.addText(100, (int) (((((float) thumbWidth / image.getWidth()) * image.getHeight()) + 10) * pageCount.getValue()), "@i: " + out.getName() + " " + thumbWidth, null); 380 Text thumb = frameset.addText((int) (thumbWidth * 1.1 * horizontalCount.getValue()) + 10, 381 (int) ((((float) thumbWidth / image.getWidth()) * image.getHeight()) * 1.1 * verticalCount.getValue()), 382 "@i: " + out.getName() + " " + thumbWidth, 383 null); 384 372 385 thumb.setLink(frameToAddTo.getName()); 373 386 thumb.setBorderColor(Color.lightGray); … … 392 405 393 406 // Button to go to the previous frame/page 394 if ( pageCount.getValue() > 1) {407 if (verticalCount.getValue() > 1) { 395 408 Text previousButton = nextButton.copy(); 396 409 previousButton.setText("Previous"); … … 642 655 643 656 } 657 658 horizontalCount.setValue(horizontalCount.getValue() + 1); 659 verticalCount.setValue(0); 644 660 } 645 661 … … 659 675 } 660 676 661 browserWidget.setOverlayVisible(false); 662 677 Platform.runLater(new Runnable() { 678 679 @Override 680 public void run() { 681 browserWidget.setOverlayVisible(false); 682 browserWidget.rebindWebViewSize(); 683 } 684 }); 663 685 } 664 686 -
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r837 r839 33 33 import javafx.scene.control.ProgressIndicator; 34 34 import javafx.scene.control.TextField; 35 import javafx.scene.effect.BlendMode;36 35 import javafx.scene.input.KeyEvent; 37 36 import javafx.scene.input.MouseButton; 38 37 import javafx.scene.input.MouseEvent; 39 38 import javafx.scene.layout.HBox; 39 import javafx.scene.layout.Pane; 40 40 import javafx.scene.layout.Priority; 41 41 import javafx.scene.layout.StackPane; … … 46 46 47 47 import org.expeditee.gui.DisplayIO; 48 import org.expeditee.gui.FrameGraphics; 48 49 import org.expeditee.gui.FrameMouseActions; 49 50 import org.expeditee.gui.FreeItems; … … 63 64 * @author ngw8 64 65 * @author jts21 66 */ 67 /** 68 * @author ngw8 69 * 65 70 */ 66 71 public class JfxBrowser extends DataFrameWidget { … … 212 217 this._webView.setMaxWidth(Double.MAX_VALUE); 213 218 this._webView.setMaxHeight(Double.MAX_VALUE); 214 HBox.setHgrow(this._webView, Priority.ALWAYS);215 VBox.setVgrow(this._webView, Priority.ALWAYS);216 219 this._webEngine = this._webView.getEngine(); 217 220 218 221 this._urlProgressBar.progressProperty().bind(_webEngine.getLoadWorker().progressProperty()); 219 222 220 vertical.getChildren().addAll(horizontal, this._webView); 223 224 // Pane to hold just the webview. This seems to be the only way to allow the webview to be resized to greater than its parent's 225 // size. This also means that the webview's prefSize must be manually set when the Pane resizes, using the event handlers below 226 Pane browserPane = new Pane(); 227 browserPane.getChildren().add(_webView); 228 229 HBox.setHgrow(browserPane, Priority.ALWAYS); 230 VBox.setVgrow(browserPane, Priority.ALWAYS); 231 232 browserPane.widthProperty().addListener(new ChangeListener<Object>() { 233 234 @Override 235 public void changed(ObservableValue<?> observable, Object oldValue, Object newValue) { 236 JfxBrowser.this._webView.setPrefWidth((Double) newValue); 237 } 238 }); 239 240 browserPane.heightProperty().addListener(new ChangeListener<Object>() { 241 242 @Override 243 public void changed(ObservableValue<?> observable, Object oldValue, Object newValue) { 244 JfxBrowser.this._webView.setPrefHeight((Double) newValue); 245 } 246 }); 247 248 vertical.getChildren().addAll(horizontal, browserPane); 221 249 222 250 this._overlay = new StackPane(); … … 291 319 @Override 292 320 public void handle(ActionEvent e) { 293 321 getFrameNew(); 294 322 } 295 323 }); … … 334 362 public void handle(MouseEvent arg0) { 335 363 JfxBrowser.this._urlField.requestFocus(); 336 364 } 337 365 }); 338 366 … … 774 802 } 775 803 804 /** 805 * Shows/hides a message reading 'Importing page' over the widget 806 * 807 * @param visible 808 */ 776 809 public void setOverlayVisible(final boolean visible) { 777 Platform.runLater(new Runnable() { 778 779 @Override 780 public void run() { 781 JfxBrowser.this._overlay.setVisible(visible); 782 } 783 }); 784 810 this._overlay.setVisible(visible); 811 } 812 813 /** 814 * Sets the size of the webview element of the widget 815 * 816 * @param width 817 * @param height 818 */ 819 public void setWebViewSize(double width, double height) { 820 this._webView.setPrefSize(width, height); 821 } 822 823 /** 824 * Resizes the webview back to the size of its parent element 825 */ 826 public void rebindWebViewSize() { 827 this._webView.getParent().resize(0, 0); 785 828 } 786 829
Note:
See TracChangeset
for help on using the changeset viewer.