Ignore:
Timestamp:
02/05/14 14:16:00 (10 years ago)
Author:
ngw8
Message:

Changes to web parser so that the converted pages are displayed in a grid on the index page, plus the converted pages are set to be 90% of the frame size, rather than just using the displayed size of the webview.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/WebParser.java

    r832 r839  
    3939import org.expeditee.gui.DisplayIO;
    4040import org.expeditee.gui.Frame;
     41import org.expeditee.gui.FrameGraphics;
    4142import org.expeditee.gui.FrameIO;
    4243import org.expeditee.gui.FrameMouseActions;
     
    282283         *            The Expeditee frame to output the converted page to
    283284         */
    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) {
    285286                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                        });
    287295
    288296                        final Object notifier = new Object();
     
    291299                        final MutableBool rightReached = new MutableBool(false);
    292300                       
    293                         final MutableInt pageCount = new MutableInt(0);
     301                        final MutableInt verticalCount = new MutableInt(0);
     302                        final MutableInt horizontalCount = new MutableInt(0);
    294303
    295304                        final String pageTitle = webEngine.getTitle();
     
    323332                                                this.stop();
    324333                                               
    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);
    328337
    329338                                                try {
     
    369378                                                       
    370379                                                        // 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                                                       
    372385                                                        thumb.setLink(frameToAddTo.getName());
    373386                                                        thumb.setBorderColor(Color.lightGray);
     
    392405
    393406                                                        // Button to go to the previous frame/page
    394                                                         if (pageCount.getValue() > 1) {
     407                                                        if (verticalCount.getValue() > 1) {
    395408                                                                Text previousButton = nextButton.copy();
    396409                                                                previousButton.setText("Previous");
     
    642655       
    643656                                }
     657
     658                                horizontalCount.setValue(horizontalCount.getValue() + 1);
     659                                verticalCount.setValue(0);
    644660                        }
    645661
     
    659675                }
    660676
    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                });
    663685        }
    664686
Note: See TracChangeset for help on using the changeset viewer.