Administrator client - pc2ccs/pc2v9 GitHub Wiki

Overview

The Administrator Client module provides functions which allow the Contest Administrator to manage a wide variety of contest configuration settings, including such things as defining contest problems and languages, creating and managing user acccounts, controlling import and export of contest configuration information, and managing the contest clock.

When an Admin Client is first started, it displays a ui/admin/AdministratorView frame containing a JTabbedPane containing two primary tabs: Configure Contest and Run Contest. Each of these tabs in turn holds a variety of individual tabbed panes. The Contest Administrator selects the different tabbed panes to control different aspects of the contest configuration.

Note: it is possible to set up an Admin Client as a "Read-only" or "View-only" client -- meaning the user can SEE all of the contest configuration items visible to a Contest Administrator, but cannot CHANGE the contest configuration. See Read Only Admin for details.

A complete description of every Admin Client tab is beyond the scope of this wiki page, but here is an example of how a typical pane works.

Problems Tab

The Problems tab (on the Configure Contest main tab) contains an instance of class ProblemsPane. This class extends (“is-a”) JPanePlugin and contains three GUI components, created by the initialize() method invoked by its constructor: a message panel (a JPanel containing a JLabel used to display messages); a center panel (a JPanel containing a Multi-Column List Box (MCLB) displaying a grid showing each defined contest problem), and a button panel (a JPanel containing buttons Add, Copy, Edit, Report, and Set Judge’s Data Path).

The initialize() method also creates instances of separate GUI classes EditProblemFrame and EditProblemFrameNew (the latter is only used in debugging mode). EditProblemFrame is a JFrame containing one thing: an instance of class EditProblemPane. EditProblemPane in turn contains the GUI components needed for editing a problem (including creating a new Problem): a message pane at the top; a button pane at the bottom containing buttons Add, Update, Report, Load, Export, and Cancel; and a main tabbed pane containing four tabs: General, Judging Type, Validator, and Data Files.

Note: the buttons on the EditProblemPane button pane are not always visible. If you open the code in a GUI Builder such as “Window Builder Editor” in Eclipse it will show all six buttons; however, which buttons are visible in the running code at any time depends on the state of the system at that time. For example, the “Update” button is not visible when adding a new problem; similarly, the “Add” button is not visible when updating an existing problem.

Pressing the Add button on the ProblemsPane (not the EditProblemPane) invokes a method setProblem(Problem) in the EditProblemFrame, passing null as the Problem value. When setProblem() receives null as the problem value it sets the title of the EditProblemFrame to “Add New Problem”, then invokes method setProblem(Problem) in the EditProblemPane. This method clears the data files on the Data Files tab, then invokes method populateGUI(Problem).

Pressing the Edit button on the ProblemsPane (after selecting a Problem in the MCLB problem grid) invokes method setProblemCopy(Problem,ProblemDataFiles) in the EditProblemFrame, passing to it the selected problem and the corresponding problem data files. setProblemCopy() in turn invokes setProblem(Problem,ProblemDataFiles) in EditProblemPane (analogous to the way the Add button invokes EditProblemPane.setProblem(Problem)). setProblem(Problem,ProblemDataFiles) then clears the data files on the Data Files tab, loads the specified ProblemDataFiles into the Data Files tab, initializes the Data Files tab GUI components by calling method MultipleDataSetPane.populateUI(), and finally calls method populateGUI() in the EditProblemPane. Thus, both the Add button and the Edit button end up calling populateGUI(), passing either null (when adding a new problem) or a specific Problem (when editing an existing problem).

populateGUI() is the method responsible for loading problem into the EditProblemPane GUI. When populateGUI() receives null as the Problem value, it invokes method clearForm() to load the EditProblemPane GUI with the initial defaults used for defining a new problem. If populateGUI() receives a non-null Problem, it instead invokes method setForm() to populate the GUI from the values in the received problem. When the GUI has been populated from a received problem, populateGUI() then invokes method getProblemFromFields() to insure that the resulting populated values are sane (getProblemFromFields() throws Exception InvalidFieldValue if any of the populated values are invalid). Finally, populateGUI() enables the various EditProblemPane components as appropriate, loads the appropriate data file values into the Data Files tab, and makes the “General” tab the currently selected tab.

⚠️ **GitHub.com Fallback** ⚠️