Changeset 842


Ignore:
Timestamp:
02/05/14 15:28:49 (10 years ago)
Author:
ngw8
Message:

Slight change to web parser next/previous/index button positions.
Added button to return to the page that the JFXBrowser was on.

File:
1 edited

Legend:

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

    r840 r842  
    311311                        frameset.getTitleItem().setSize(14);
    312312
     313                        WebParser.addButton("Return to original frame", frame.getName(), null, 200, frameset, null, 0f, 10f, null);
     314
     315
    313316                        Text link = DisplayIO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(), webEngine.getTitle(), null);
    314317                        link.setLink(frameset.getName());
     
    386389
    387390                                                        // Button to go to the next frame/page
    388                                                         Text nextButton = new Text("Next");
    389 
    390                                                         nextButton.addAction("next");
    391                                                         nextButton.setBorderColor(new Color(0.7f, 0.7f, 0.7f));
    392                                                         nextButton.setBackgroundColor(new Color(0.9f, 0.9f, 0.9f));
    393                                                         nextButton.setThickness(1);
    394                                                         nextButton.setActionMark(false);
    395                                                         nextButton.setWidth(70);
    396                                                         nextButton.setFamily("Roboto Condensed Light");
    397                                                         nextButton.setJustification(Justification.center);
    398                                                         nextButton.setAnchorRight(10f);
    399                                                         nextButton.setAnchorBottom(10f);
    400 
    401                                                         nextButton.setID(frameToAddTo.getNextItemID());
    402                                                         frameToAddTo.addItem(nextButton);
     391                                                        WebParser.addButton("Next", null, "next", 70, frameToAddTo, null, 0f, 10f, null);
    403392
    404393                                                        // Button to go to the previous frame/page
    405                                                         if (verticalCount.getValue() > 1) {
    406                                                                 Text previousButton = nextButton.copy();
    407                                                                 previousButton.setText("Previous");
    408                                                                 previousButton.setAction("previous");
    409                                                                 previousButton.setAnchorRight(180f);
    410                                                                 previousButton.setAnchorBottom(10f);
    411 
    412                                                                 frameToAddTo.addItem(previousButton);
     394                                                        if (verticalCount.getValue() > 1 || horizontalCount.getValue() > 0) {
     395                                                                WebParser.addButton("Previous", null, "previous", 70, frameToAddTo, null, 85f, 10f, null);
    413396                                                        }
    414397
    415398                                                        // Button to return to the index/overview page
    416                                                         Text indexButton = nextButton.copy();
    417                                                         indexButton.setText("Index");
    418                                                         indexButton.setAction(null);
    419                                                         indexButton.setLink(frameset.getName());
    420                                                         indexButton.setLinkMark(false);
    421                                                         indexButton.setAnchorRight(95f);
    422                                                         indexButton.setAnchorBottom(10f);
    423 
    424                                                         frameToAddTo.addItem(indexButton);
     399                                                        WebParser.addButton("Index", frameset.getName(), null, 70, frameToAddTo, null, null, 10f, 5f);
    425400
    426401                                                        FrameIO.SaveFrame(frameToAddTo);
     
    13911366        }
    13921367
     1368        /**
     1369         * Used by the web parser to add Next, Previous, etc. buttons to the converted pages
     1370         *
     1371         * @param text
     1372         *            text to display on the button
     1373         * @param link
     1374         *            Frame that the button will link to
     1375         * @param action
     1376         *            Action to run when button is clicked
     1377         * @param width
     1378         *            Width of the button
     1379         * @param toAddTo
     1380         *            Frame to add the button to
     1381         * @param anchorTop
     1382         * @param anchorRight
     1383         * @param anchorBottom
     1384         * @param anchorLeft
     1385         */
     1386        private static void addButton(String text, String link, String action, int width, Frame toAddTo, Float anchorTop, Float anchorRight, Float anchorBottom, Float anchorLeft) {
     1387                // Button to go to the next frame/page
     1388                Text button = new Text(text);
     1389
     1390                button.setLink(link);
     1391                button.addAction(action);
     1392                button.setBorderColor(new Color(0.7f, 0.7f, 0.7f));
     1393                button.setBackgroundColor(new Color(0.9f, 0.9f, 0.9f));
     1394                button.setThickness(1);
     1395                button.setLinkMark(false);
     1396                button.setActionMark(false);
     1397                button.setFamily("Roboto Condensed Light");
     1398                button.setJustification(Justification.center);
     1399                button.setWidth(width);
     1400
     1401                if (anchorTop != null) {
     1402                        button.setAnchorTop(anchorTop);
     1403                }
     1404
     1405                if (anchorRight != null) {
     1406                        button.setAnchorRight(anchorRight);
     1407                }
     1408
     1409                if (anchorBottom != null) {
     1410                        button.setAnchorBottom(anchorBottom);
     1411                }
     1412
     1413                if (anchorLeft != null) {
     1414                        button.setAnchorLeft(anchorLeft);
     1415                }
     1416
     1417                button.setID(toAddTo.getNextItemID());
     1418                toAddTo.addItem(button);
     1419
     1420        }
     1421
     1422
    13931423        private static class MutableBool {
    13941424                private boolean value;
Note: See TracChangeset for help on using the changeset viewer.