Changeset 690
- Timestamp:
- 01/14/14 10:09:38 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/MessageBay.java
r689 r690 446 446 public static final class Progress { 447 447 448 private static final String t = "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓";449 private static final String f = "░░░░░░░░░░░░░░░░░░░░";448 private static final String filled = "\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592"; 449 private static final String unfilled = "\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591"; 450 450 451 451 String message; … … 456 456 //this.text.setFont(Font.decode(Text.MONOSPACED_FONT + "-16")); 457 457 this.message = this.text.getText(); 458 this.text.setText(this.message + " [" + f+ "] 0%");458 this.text.setText(this.message + " [" + unfilled + "] 0%"); 459 459 refresh(false, FrameGraphics.createGraphics(), Item.DEFAULT_BACKGROUND); 460 460 } … … 470 470 int p = progress / 5; 471 471 if(isMessageItem(this.text)) { 472 this.text.setText(this.message + " [" + t.substring(0, p) + f.substring(p) + "] " + progress + "%");472 this.text.setText(this.message + " [" + filled.substring(0, p) + unfilled.substring(p) + "] " + progress + "%"); 473 473 refresh(false, FrameGraphics.createGraphics(), Item.DEFAULT_BACKGROUND); 474 474 return true; -
trunk/src/org/expeditee/io/WebParser.java
r688 r690 20 20 import org.expeditee.gui.FrameUtils; 21 21 import org.expeditee.gui.MessageBay; 22 import org.expeditee.gui.MessageBay.Progress; 22 23 import org.expeditee.items.ItemUtils; 23 24 import org.expeditee.items.Justification; … … 131 132 public void run() { 132 133 try { 134 Progress progressBar = MessageBay.displayProgress("Converting web page"); 135 133 136 HTMLBodyElement doc = (HTMLBodyElement) JavaFX.WebEngineExecuteScript.invoke(webEngine, "document.body"); 134 137 135 138 Object window = JavaFX.WebEngineExecuteScript.invoke(webEngine, "window"); 139 140 JavaFX.WebEngineExecuteScript.invoke(webEngine, "" 141 + "var css = 'h1 { background: red; }';" // TODO 142 + "var head = document.head;" 143 + "style = document.createElement('style');" 144 + "style.type = 'text/css';" 145 + "if (style.styleSheet){" 146 + " style.styleSheet.cssText = css;" 147 + "} " 148 + "else {" 149 + " style.appendChild(document.createTextNode(css));" 150 + "}" 151 + "head.appendChild(style);" 152 ); 136 153 137 154 frame.setBackgroundColor(rgbStringToColor((String) JavaFX.JSObjectCall.invoke(JavaFX.JSObjectCall.invoke(window, "getComputedStyle", new Object[] { doc }), "getPropertyValue", … … 168 185 169 186 for (int i = 0; i < contentElementsLength; i++) { 170 System.out.println(i + "/" + contentElementsLength);171 187 // Getting the current HTML element, then making it accessible in JavaScript 172 188 Element currentElement = (Element) JavaFX.JSObjectGetSlot.invoke(contentElements, i); … … 224 240 } 225 241 242 progressBar.set((100 * (i + 1)) / contentElementsLength); 226 243 } 227 244 … … 252 269 253 270 // Bounding rectangle position is relative to the current view, so scroll position must be added to x/y 271 // TODO: This doesn't check if an element or any of its parent elements have position:fixed set - the only 272 // way to check seems to be to walking through the element's parents until the document root is reached 254 273 float x = Float.valueOf(JavaFX.JSObjectGetMember.invoke(bounds, "left").toString()) 255 274 + Float.valueOf(JavaFX.WebEngineExecuteScript.invoke(webEngine, "window.pageXOffset").toString());
Note:
See TracChangeset
for help on using the changeset viewer.