@Test public void emptyMethods() { // Act & Assert Window.enableScrolling(true); Window.moveBy(1, 2); Window.moveTo(3, 4); Window.resizeBy(3, 6); Window.resizeTo(8, 9); Window.scrollTo(2, 4); }
/** This is the entry point method. */ public void onModuleLoad() { // Pointer to CSS manager. It has to go first! GWT.<Resources>create(Resources.class).css().ensureInjected(); // Log messages logger.fine("Loading eMarkingWeb interface"); logger.fine(Navigator.getPlatform()); logger.fine(Navigator.getUserAgent()); logger.fine(Navigator.getAppName()); logger.fine(Navigator.getAppCodeName()); logger.fine(Navigator.getAppVersion()); // List of errors after trying to initialize ArrayList<String> errors = new ArrayList<String>(); // Get id for eMarkingWeb's DIV tag final String eMarkingDivId = "emarking"; if (RootPanel.get(eMarkingDivId) == null) { errors.add("Can not initalize. eMarkingWeb requires an existing DIV tag with id: emarking."); return; } RootPanel.get(eMarkingDivId).add(new Label("Loading")); int draftId = 0; int preferredWidth = 860; boolean showRubric = true; boolean showColors = false; try { // First, if there's a URL parameter, replace the value if (Window.Location.getParameter("id") != null) { draftId = Integer.parseInt(Window.Location.getParameter("id")); } // Validate that the submission id is a positive integer if (draftId <= 0) { errors.add("Submission id must be a non negative integer."); } String cookie_width = Cookies.getCookie("emarking_width"); if (cookie_width != null) { preferredWidth = Integer.parseInt(cookie_width); } // Validate that the preferredWidth is a positive integer greater than 10 if (preferredWidth <= 10) { errors.add("Preferred width should be a positive integer greater than 10."); } // Validate that the preferredWidth is a positive integer greater than 10 if (preferredWidth <= 10) { errors.add("Preferred width should be a positive integer greater than 10."); } String cookie_showrubric = Cookies.getCookie("emarking_showrubric"); if (cookie_showrubric != null) { showRubric = Integer.parseInt(cookie_showrubric) == 1; } String cookie_showcolors = Cookies.getCookie("emarking_showcolors"); if (cookie_showcolors != null) { showColors = Integer.parseInt(cookie_showcolors) == 1; } logger.fine( "ShowRubric: " + showRubric + " Show colors:" + showColors + " Preferred width:" + preferredWidth); } catch (Exception e) { logger.severe(e.getMessage()); errors.add( "Error in HTML for eMarkingWeb can not initalize. Invalid submissionId value (must be integer)."); } // Read div attribute for readonly String moodleurl = null; if (RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl") != null) moodleurl = RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl"); logger.fine("Moodle ajax url: " + moodleurl); if (moodleurl == null) errors.add("Invalid Moodle ajax url"); // If there are errors die with a configuration message if (errors.size() > 0) { Label errorsLabel = new Label(); String text = ""; for (int i = 0; i < errors.size(); i++) { text += "\n" + errors.get(i); } errorsLabel.setText(text); errorsLabel.setTitle("Fatal error while initializing eMarking-Web"); RootPanel.get(eMarkingDivId).clear(); RootPanel.get(eMarkingDivId).add(errorsLabel); } else { // Set eMarking's main interface submission id according to HTML MarkingInterface.setDraftId(draftId); EMarkingConfiguration.setShowRubricOnLoad(showRubric); EMarkingConfiguration.setColoredRubric(showColors); // Ajax URL in moodle AjaxRequest.moodleUrl = moodleurl; // Automagically resize popup to use most of the window int width = screenWidth(); int height = screenHeight(); // Preferred width can not be bigger than the screen if (width < preferredWidth) { preferredWidth = width; } // Resize the popup window and move it to the top left corner Window.resizeTo(preferredWidth, height); Window.moveTo(0, 0); // Initialize eMarking's interface markingInterface = new MarkingInterface(); markingInterfacetwo = new MarkingInterface(); // Add eMarking to the browser RootPanel.get(eMarkingDivId).clear(); RootPanel.get(eMarkingDivId).add(markingInterface); RootPanel.getBodyElement().focus(); } }