Skip to content

Commit

Permalink
Update Model and Ui portions of DG (#109)
Browse files Browse the repository at this point in the history
* Edit DG for Model and Ui

* Fix link for Ui.java

* Update UML diagram for UiClassDiagram
  • Loading branch information
kwekke authored and t-cheepeng committed Oct 23, 2019
1 parent f7baeb7 commit 87b5595
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 83 deletions.
20 changes: 10 additions & 10 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ The sections below give more details of each component.
.Structure of the UI Component
image::UiClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`]
*API* : link:{repoURL}/src/main/java/seedu/exercise/ui/Ui.java[`Ui.java`]

The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.
The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `ExerciseListPanel`, `ExerciseCard` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.

The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`]

Expand Down Expand Up @@ -115,21 +115,21 @@ NOTE: The lifeline for `DeleteCommandParser` should end at the destroy marker (X
=== Model component

.Structure of the Model Component
image::ModelClassDiagram.png[]
image::BetterModelClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model.java`]
*API* : link:{repoURL}/src/main/java/seedu/exercise/model/Model.java[`Model.java`]

The `Model`,

* stores a `UserPref` object that represents the user's preferences.
* stores the Address Book data.
* exposes an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* stores a `PropertyManager` object that represents the custom properties defined by the user.
* stores the Exercise Book data.
* stores the Exercise Database Book Data
* stores the Regime Book data.
* stores the Schedule Book data.
* exposes an unmodifiable `ObservableList<Exercise>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* does not depend on any of the other three components.

[NOTE]
As a more OOP model, we can store a `Tag` list in `Address Book`, which `Person` can reference. This would allow `Address Book` to only require one `Tag` object per unique `Tag`, instead of each `Person` needing their own `Tag` object. An example of how such a model may look like is given below. +
+
image:BetterModelClassDiagram.png[]

[[Design-Storage]]
=== Storage component
Expand Down
41 changes: 30 additions & 11 deletions docs/diagrams/BetterModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,37 @@ skinparam arrowThickness 1.1
skinparam arrowColor MODEL_COLOR
skinparam classBackgroundColor MODEL_COLOR

AddressBook *-right-> "1" UniquePersonList
AddressBook *-right-> "1" UniqueTagList
UniqueTagList -[hidden]down- UniquePersonList
UniqueTagList -[hidden]down- UniquePersonList
ReadOnlyResourceBook .down.> "{abstract}\nResource"

UniqueTagList *-right-> "*" Tag
UniquePersonList o-right-> Person
ReadOnlyResourceBook o-right-> "1" UniqueResourceList

Person o-up-> "*" Tag
UniqueResourceList o--> "{abstract}\nResource"

Exercise -up-|>"{abstract}\nResource"
Regime -up-|>"{abstract}\nResource"
Schedule -up-|>"{abstract}\nResource"

Exercise *--> "1" Name
Exercise *--> "1" Date
Exercise *--> "1" Calories
Exercise *--> "1" Quantity
Exercise *--> "1" Unit
Exercise *--> "0..*" Muscle
Exercise *--> "0..*" CustomProperty

CustomProperty *--> "1" Prefix
CustomProperty *--> "1" "<<enumeration>>\nParameterType"

enum "<<enumeration>>\nParameterType" {
TEXT,
NUMBER,
DATE
}

Regime *-left-> "1" UniqueResourceList : regimeExercises
Regime *--> "1" Name

Schedule *-right-> "1" Regime
Schedule *--> "1 " Date

Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
@enduml
74 changes: 33 additions & 41 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,44 @@ skinparam arrowColor MODEL_COLOR
skinparam classBackgroundColor MODEL_COLOR

Package Model <<Rectangle>>{
Interface ReadOnlyAddressBook <<Interface>>
Interface Model <<Interface>>
Interface ObservableList <<Interface>>
Class AddressBook
Class ReadOnlyAddressBook
Class Model
Class ModelManager
Class UserPrefs
Class ReadOnlyUserPrefs

Package Person {
Class Person
Class Address
Class Email
Class Name
Class Phone
Class UniquePersonList
}

Package Tag {
Class Tag
}
Interface Model <<Interface>>
Interface ReadOnlyUserPrefs <<Interface>>
Interface ObservableList <<Interface>>

Class Model
Class ModelManager
Class UserPrefs
Class XYZReadOnlyResourceBook
Class XYZUniqueResourceList

Package Resource {
class "{abstract}\nResource"
Class Exercise
Class Regime
Class Schedule
}

Package Property {
Class PropertyManager
}
}

Class HiddenOutside #FFFFFF
HiddenOutside ..> Model

AddressBook .up.|> ReadOnlyAddressBook

ModelManager .up.|> Model
Model .right.> ObservableList
ModelManager o--> "1" AddressBook
ModelManager o-left-> "1" UserPrefs
UserPrefs .up.|> ReadOnlyUserPrefs

AddressBook *--> "1" UniquePersonList
UniquePersonList o--> "*" Person
Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "*" Tag

Name -[hidden]right-> Phone
Phone -[hidden]right-> Address
Address -[hidden]right-> Email

ModelManager -->"1" Person : filtered list

ModelManager o-right-> "1" PropertyManager

Exercise -up-|> "{abstract}\nResource"
Regime -up-|> "{abstract}\nResource"
Schedule -left-|> "{abstract}\nResource"

ModelManager o-left-> "4" XYZReadOnlyResourceBook
XYZReadOnlyResourceBook o--> XYZUniqueResourceList
XYZUniqueResourceList o--> "0..*" "{abstract}\nResource"
ModelManager o-down-> "1" UserPrefs
UserPrefs .right.|> ReadOnlyUserPrefs

@enduml
44 changes: 23 additions & 21 deletions docs/diagrams/UiClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ Class "{abstract}\nUiPart" as UiPart
Class UiManager
Class MainWindow
Class HelpWindow
Class ResultDisplay
Class PersonListPanel
Class PersonCard
Class StatusBarFooter
Class CommandBox
Class ResultDisplay
Class ResolveWindow
Class LeftRightDisplay
Class XYZResourceListPanel
Class XYZResourceCard
}

package Model <<Rectangle>> {
Expand All @@ -30,31 +31,32 @@ HiddenOutside ..> Ui

UiManager .left.|> Ui
UiManager -down-> MainWindow
MainWindow --> HelpWindow
MainWindow *-down-> CommandBox
MainWindow *-down-> ResultDisplay
MainWindow *-down-> PersonListPanel
MainWindow *-down-> StatusBarFooter

PersonListPanel -down-> PersonCard
MainWindow *--> HelpWindow
MainWindow *--> CommandBox
MainWindow *--> ResultDisplay
MainWindow *--> ResolveWindow
MainWindow *--> "4" XYZResourceListPanel
XYZResourceListPanel *--> XYZResourceCard

MainWindow -left-|> UiPart

HelpWindow --|> UiPart
ResultDisplay --|> UiPart
CommandBox --|> UiPart
PersonListPanel --|> UiPart
PersonCard --|> UiPart
StatusBarFooter --|> UiPart
HelpWindow -down-|> UiPart
ResolveWindow --|> UiPart
LeftRightDisplay --|> UiPart
XYZResourceListPanel --|> UiPart
XYZResourceCard --|> UiPart


PersonCard ..> Model
UiManager -right-> Logic
MainWindow -left-> Logic
XYZResourceCard ..> Model
UiManager --> Logic
MainWindow -right-> Logic

PersonListPanel -[hidden]left- HelpWindow
HelpWindow -[hidden]left- CommandBox
CommandBox -[hidden]left- ResultDisplay
ResultDisplay -[hidden]left- StatusBarFooter
ResolveWindow -> LeftRightDisplay

HelpWindow -[hidden]- CommandBox
CommandBox -[hidden]- ResultDisplay
MainWindow -[hidden]-|> UiPart
@enduml
Binary file modified docs/images/BetterModelClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/ModelClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/UiClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87b5595

Please sign in to comment.