代写program、代做Java编程设计
Laboratory work #4 | Data model in application
Objectives
The goal of this laboratory work is to learn, how to implement GUI application based on an object-oriented method
of task analysis and decomposition involving data models.
Instructions
Create a program capable of managing data items of some domain (see variants). Use different Swing UI controls to
organize graphical user interface. The user should be able to
add new elements of data,
modify selected element of data,
or remove existing elements of data
filter displayed elements from the whole content of the internal collection.
Each element of data consists of a few trivial fields carrying the literal values according to the domain case.
Steps:
1. Create a main class having entry point
2. Implement internal task domain classes
a. Create a class representing domain’s element of data having fields suggested in the variant,
methods for reading and changing values of these fields, constructor for newly created data
element initialization.
b. Create a domain model class having at least field with collection of elements of data and methods
for each operation, described in the variant, including: add new element, remove existing element,
extract subset of elements according to the given condition, change fields of the existing element.
3. Create a class implementing the window displaying the content described below:
a. An area with brief visualization of the data collection without details for each item
(use UI control of JList, JTable and JTree according to your variant, implement data model if needed)
b. An area displaying non-editable details about the element being selected in the collection
(use a number of different UI controls like JLabel, JCheckBox, JRadioButton, JComboBox, JTextField,
JTextArea for each data field of the selected element)
c. An area with a number of buttons, each for a different operation to perform with data or its
representation
4. Implement a logic responsible for performing operations by ActionListeners for each operation-related
button (created during step 3c) so that the window class itself holds a reference to the domain model class
(created during step 2b) and each action event listener uses its methods to perform corresponding internal
operation and update the state of the UI controls. Each variant has clarifications about some operations.
Operations of each (a, b, c, d) kind should be implemented, even if some of them are not mentioned in the
variant explicitly (editing for example):
a. Implement operation for a user to add a new element of data, the element being added should not
be displayed as part of the collection until the user confirms its creation or cancels the operation.
b. Implement operation for a user to edit selected element of data with options to cancel editing or
preserve the modifications.
c. Implement operation for a user to delete selected element of data with confirmation message, so
that it would be possible to cancel the operation.
d. Implement operation for a user to filter the elements being displayed according to some data fields.
Editing operations should continue to work correctly for a data displayed when the filter is in use.
Solution requirements:
 The application process should be correctly terminated when the window being closed.
 Initial window size should be correctly prepared.
 Use layout managers of your choice for automatic UI controls arrangement according to the window being
resized by the user.
 When the program starts, internal collections contain no data. Data persistence is not discussed in this lab.
Variants
Each variant described with four numbers: A, B, C, D.
A – case number, B – main window layout, C – UI control for collection, D – way of editing implementation.
For example, variant “1, 2, 3, 1” means use domain case 1 (contact list), use layout sketch #2 (vertical orientation),
use JTree to visualize and navigate the collection, implement editing operations in the same main window by
switching details view into editable mode.
Main window layout sketches (for step 3):
UI control to use for a brief collection visualization (see step 3a):
Number UI control
1 JList
2 JTable
3 JTree
Lab3, StudentName, #IdNumber
Lab3, StudentName, #IdNumber
Lab3, StudentName, #IdNumber
Collection View
and
filter parameters Details View
Editing operations Delete Edit Add
Collection View
and
filter parameters Details View
Editing ops Delete
Edit Add
Collection View
and
filter parameters
Details View
Editing operations Delete Edit Add
Way of editing implementation:
1. In the same main window by switching details view into editable mode
(see setEditable(..) and setEnabled(..) methods of the UI controls)
2. In the separate dialog window implemented by inheriting from JDialog class
Domain case
1. Contact-list
Operations to support: search for a contact, add new contact, exit from the program.
New contact addition performed by entering the information elements such as: name, surname, telephone number,
email and so on.
Contact searching could be performed by name or by phone number, or by name and surname, or by all fields at
once. After selection of the search mode, user should enter desired string (part of the phone number or such), that
would be used during search, and information of the corresponding conracts should be printed.
2. Todo-list
Operations to support: create todo-item, search todo-items by tags, filter actual todo-items.
Item creation procedure requires item title, description, deadline date and tags. Tags could be handled in UI as one
text field, while being represented as array of separate tags internally.
Search by tags starts from the request of the keywords to search from the user. User enters them using space
separator. Then, if some todo-item has one of the given tags, such item should be filtered.
Actual todo-items output should be performed for the requested number of items considering them in the order of
deadline date growth.
3. Library catalog
Information about book consists of title, author name, annotation, ISBN and publication date.
Operations to support: add book to the catalog, get book information by its ISBN, search book by any keywords.
Search operation should display brief book descriptions (without annotation) in the order of decreasing the number
of keywords found. If a particular keyword found in the annotation, reflect this fact during the output.
4. Playlist manager
Operations to support: search composition by a certain criterion, show all compositions from the playlist, add new
composition to the playlist, remove composition from the playlist.
The search criteria can be: name author of composition or the title of composition.
As a result of the search, the list of the compositions should be shown, having “number – author – title – duration”
for each composition. Removal of composition requires its number. Addition requires entering all information about
the composition.
5. Shopping-list
Shopping list contains list of the purchases performed. Each item has name, comment, amount of credits spent, and
date of purchase.
Operations to support: add new purchase info, remove purchase by its number, print purchases in the specified
range of dates.
6. Cookbook
Each recipe in the cookbook represented with title, brief description, and number of steps to cook.
Operations to support: add new recipe, delete recipe by name, search for the recipe.
Recipe search performed by any word contained in its title, description or steps and results with list of detailed
description of corresponding recipes.
7. Gradebook
Gradebook is the book with information about students’ marks: it helps to the teacher (and student) answer two the
question about the marks by the subjects.
Technically, the book – is a set of records that combines information about the student (name), subject and mark.
Operations to support: add new grade mark item, delete the item by student’s and subject name, search by the
subject (to display marks by this subject for all students).
8. Meteorological log
It is a journal with information about the meteorological data: temperature, pressure, precipitation (rain, snow) in
particular date/time.
Operations to support with the log: add new item, delete the item by date, show the list of data by month.
9. Discount journal
It is a journal with information about your discounts in different markets (like Stocard application for smartphones).
It stores information about the shop, size of discount and the discount’s expiration date.
Operations to support: add new item, delete the item by shop, show the list of your discounts sorted by the
alphabet.
Extra information
Brief overview of some Swing classes to know about:
● Basic containers and windows
JFrame
JDialog
JPanel
JSplitPane
JOptionPane
● Layout managers
BorderLayout
BoxLayout
CardLayout
FlowLayout
GridBagLayout
GridLayout
GroupLayout
SpringLayout
● Basic controls
JLabel
JButton
JCheckBox
JRadioButton
JList
JComboBox
JTextField
JScrollBar
JSlider
● Advanced controls
JScrollPane
JTextArea
JTable
JTree
Brief overview of some IO classes to know about:
● Writer classes
FileWriter
OutputStreamWriter
BufferedWriter
StringWriter
● OutputStream classes
DataOutputStream
BufferedOutputStream
ByteArrayOutputStream
FileOutputStream
PrintStream
● Reader classes
FileReader
InputStreamReader
BufferedReader
StringReader
● InputStream classes
DataInputStream
BufferedInputStream
ByteArrayInputStream
FileInputStream
● Parsing and formatting
Scanner
Formatter
ByteBuffer
● File system management
java.io.File
java.nio.file.Path
java.nio.file.Files

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图