User:WikiDan

From Simple English Wikipedia, the free encyclopedia

DVD Collection GUI II is a program written by Dan Campbell in Java that uses a mySQL connection to manipulate the contents of a relational database. The program is designed to hide the user from the technical workings of database functionality, providing only graphical widgets with which to issue commands. As such, it can be used with no awareness of the underlying database software.

History[change | change source]

Prior to DVD Collection GUI II, two earlier programs were produced for managing a DVD collection.

DVD Collection GUI[change | change source]

DVD Collection GUI does not use database functionality, but instead serialisation and file IO. Aside from the difference in its source of data, the program has a similar front end and back end to DVD Collection II, as this was the original task upon which the latter was based.

DVD Collection GUI Mk II[change | change source]

DVD Collection GUI Mk II was the original and unsuccessful version of DVD Collection II. The original purpose of this program was to replicate DVD Collection GUI almost verbatim, with the only difference being a direct replacement of serialisation and file IO code for mySQL interfacing code. The program was operational but unreliable due to runtime errors.

Task Specification[change | change source]

Functionality Requirements[change | change source]

The principle functionality of the program includes:

  • reading details from a database into an object that represents a DVD collection
  • displaying all DVDs in the collection on screen
  • displaying details of the currently selected DVD
  • adding, editing and deleting DVDs from the collection and database
  • sorting the list by title or by each DVD's unique identifier
  • counting the number of DVDs that the user had set as favourites

Code Requirements[change | change source]

The task specifications required that the program be written using a provided class, DVD, as well as being based around the DVD Collection class used in the earlier program DVD Collection GUI. From this, a DVD Collection GUI class was required, plus classes for adding and editing DVDs.

Layout Requirements[change | change source]

The graphical layout of the task was also to be similar to the earlier DVD Collection GUI program; using 3 windows to perform its main operations.

Main Window[change | change source]

The main window was used for viewing, selecting, sorting, counting and deleting DVDs, as well as providing author information. It was required to contain:

  • a title
  • a list displaying all DVDs in the collection, from which the user could select a DVD
  • a non-editable text area displaying the title and release year of the selected DVD
  • a disabled checkbox displaying the favourite status of the selected DVD
  • buttons to sort by title and sort by ID
  • a menu containing one submenu with a Count item (for counting favourites) and another submenu with a Help item (for displaying the program author's name)
  • a button to open the New DVD window
  • a button to open the Edit DVD window
  • a button to delete a selected DVD
New DVD Window[change | change source]

The New DVD window was used to create a new DVD listing from scratch by providing the title, year and status as a favourite. It was required to contain:

  • an editable text field for the DVD's new title
  • an editable text field for the DVD's release year, if known
  • an enabled checkbox to set the DVD's status as a favourite
  • a button to execute the process of creating the new DVD
Edit DVD Window[change | change source]

The Edit DVD window was used to change the title, release year and favourite status of a selected DVD, and was designed to mimic the layout of the New DVD window as much as possible. It was required to contain:

  • an editable text field containing the DVD's title
  • an editable text field containing the DVD's release year
  • an enabled checkbox
  • a label displaying the current DVD's ID value
  • a button to apply the information in the text fields/checkbox to the current DVD

Design[change | change source]

Classes[change | change source]

The task required that at least 5 classes be used: DVDCollectionGUI, DVDCollection, DVDAddFrame, DVDEditFrame, and DVD.

DVDCollectionGUI represents the main window, all of its widgets, and the actions initiated by those widgets. With the exception of the About menu item, all of the operations initiated from the DVDCollectionGUI class are handled by other classes. It instantiates a DVDAddFrame or DVDEditFrame object when the New DVD or Edit Info buttons are pressed, respectively, and invokes DVDCollection class methods when responding to user action on its widgets related to counting, deleting and sorting. Rather than use two buttons for sorting by title and ID, this class only defines 1 sorting button and toggles that button's label and function each time it is pressed.

DVDAddFrame is a class representing a child window. This class contains all widgets of the New DVD window and their functionality. Its main role is to check data hygiene before calling the DVDCollection class using that data. On top of the task requirements, this class also contains an extra text field which is used to report the success status of the most recent attempted DVD addition.

DVDEditFrame is another class representing a child window. This class contains all widgets of the Edit DVD window and their functionality. Its main role is to check data hygiene before calling the DVDCollection class using that data. On top of the task requirements, this class also contains an extra text field which is used to report the success status of the most recent attempted DVD alteration.

DVDCollection represents a collection of all DVDs and provides all functionality involved with altering that collection. As the collection is updated, so too must be the database, and the DVDCollection class was also designed to handle all interfacing between the Java program and the SQL database. It does this invisibly to all other classes.

DVD is a minimal class with fields representing a DVD's properties (ID, title, release year, and status as a favourite) and functionality that only sets or returns those fields' values. A task requirement was that this class be left untouched. To this end, the DVD class does not implement the Serializable interface, meaning that serialisation could not be used for storage, nor the Comparable interface, meaning that DVDs had to be sorted either manually or via database communications. This is noteworthy since the earlier project, DVD Collection GUI, did allow such use of the Comparable interface with its DVD class.

An example that makes use of most of these classes is as follows:

    private void editBtnActionPerformed(java.awt.event.ActionEvent evt) 
    {                                        
        DVDEditFrame editDVDWindow = new DVDEditFrame(this, m_collection, (DVD)dvdJList.getSelectedValue());
    }

The method editBtnActionPerformed is called by the DVDCollectionGUI class each time the user presses the Edit Info button widget in the main window. It creates a new object of the DVDEditFrame class using a reference to a DVD object which contains the data that is being edited, and a reference to the DVDCollection object which contains the methods that can apply the edits made to the collection and database.

Visuals[change | change source]

The program's visual layout was built using the design editor in the Netbeans IDE 7.2. It heads its 3 windows with the palette of a unicorn: cyan, pink and purple.

The New DVD button is adorned with a picture of Sonic the Hedgehog, rendered by Dan Campbell, casting an expression of surprise upon discovering the giant Master Emerald on a grassy hill. Due to sizing issues, the emerald was cropped out for the program.

Colour-coding is used in the status text fields for the New DVD and Edit DVD windows. If there is an error in the given data, the status field presents an error message on a pink background. If the operation was a success, the status field announces "Updated" on a green background. If the data is valid but the database could not be updated correctly, the status field turns a deep red and reports "Database error."

Potential Improvements[change | change source]

There are many areas of design in which DVD Collection GUI II could be improved.

  • The user can open many New DVD windows, despite only being able to use one at a time.
  • Sorting the list of DVDs could be done using a sorting algorithm without having to query the database.
  • The list of DVDs could also be sorted by favourites.
  • New DVDs could check for duplicates that already exist before being added to the database.
  • The impact of database errors could be minimised by allowing changes to still take place in memory and exporting to a file. Currently, if there is a database error the program simply does nothing.
  • The positioning of all three windows uses constants. This could be modified to centre the program more appropriately.





Evaluation[change | change source]

Upon submission for appraisal, the program was met with a final judgement of "Well done - pass!"






Pickerel frog

The pickerel frog is a small frog in North America. It has dark squares on its back. The squares are in lines instead of randomly scattered. Leopard frogs have circular spots. They have an orange or yellow coloration on the inside of their back legs. They are mainly found in the eastern United States, with a little in southern Canada. They have toxic glands in their skin that can kill other frogs.

Related pages[change | change source]


Category:Frogs