/** * Starts the TestEditor for author with name <Code>FAuthorname</Code> and codebase <Code>home * </Code> and sets it visible. */ private void startEditor() { // Gets the path of the system String path = home.getPath(); String pathttemp = path.substring(1, path.length()); int index = pathttemp.indexOf("/"); index++; // Gets the folder of the TestEditor tool dirname = path.substring(0, index); if (dirname.equals("/TestEditor")) dirname = ""; // Gets the Course object from the server courseVector = getCoursesAndConceptsNames(); // Gets the icons path used by TestEditor. String iconTestEditorAndItemsPath = this.getIconAndItemsPath(); iconTestEditorPath = iconTestEditorAndItemsPath.substring(0, iconTestEditorAndItemsPath.indexOf("\n")); itemsPath = iconTestEditorAndItemsPath.substring(iconTestEditorAndItemsPath.indexOf("\n") + 1); itemsPath = itemsPath.substring(0, itemsPath.indexOf("\n")); // If there is no courses, a error message is showed to the user // and ends the TestEditor if (courseVector == null || courseVector.isEmpty()) { String message = "ERROR: A problem exists with its author user, " + "\n"; message += "it is possible that you exist as author, " + "\n"; message += "but don't have assigned any course, please add courses to its list."; JOptionPane.showMessageDialog(this, message, "Without Courses", JOptionPane.ERROR_MESSAGE); System.exit(0); } // Creates the TestEditor object TestEditor testEditor = new TestEditor( userLogin, userPassword, courseVector, home, this.dirname, this.iconTestEditorPath, this.itemsPath); // Defines its size and location Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int minimumWidth = 800; int minimumHeight = 600; if (minimumWidth > screenSize.width) { minimumWidth = screenSize.width; } if (minimumHeight > screenSize.height) { minimumHeight = screenSize.height; } testEditor.setLocation(0, 0); testEditor.setSize(screenSize.width, screenSize.height); testEditor.setMinimumSize(new Dimension(minimumWidth, minimumHeight)); // Opens it maximized testEditor.setExtendedState(JFrame.MAXIMIZED_BOTH); // Shows to the user testEditor.toFront(); // Puts it on the front testEditor.setVisible(true); }