Skip to content

Commit

Permalink
Merge branch 'master' of github.com:se-edu/addressbook-level4
Browse files Browse the repository at this point in the history
  • Loading branch information
okkhoy committed Feb 27, 2019
2 parents f1c3d39 + 3a8f0b7 commit e297742
Show file tree
Hide file tree
Showing 162 changed files with 1,665 additions and 1,960 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: java
matrix:
include:
- jdk: oraclejdk9
- jdk: oraclejdk8

script: >-
./config/travis/run-checks.sh &&
travis_retry ./gradlew clean checkstyleMain checkstyleTest headless allTests coverage coveralls asciidoctor copyDummySearchPage
./gradlew clean checkstyleMain checkstyleTest headless allTests coverage coveralls asciidoctor
deploy:
skip_cleanup: true
Expand All @@ -17,7 +17,7 @@ deploy:
addons:
apt:
packages:
- oracle-java9-installer
- oracle-java8-installer

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ endif::[]

* Some parts of this sample application were inspired by the excellent http://code.makery.ch/library/javafx-8-tutorial/[Java FX tutorial] by
_Marco Jakob_.
* Libraries used: https://github.com/TestFX/TestFX[TextFX], https://bitbucket.org/controlsfx/controlsfx/[ControlsFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/google/guava[Guava], https://github.com/junit-team/junit5[JUnit5]
* Libraries used: https://github.com/TestFX/TestFX[TestFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/junit-team/junit5[JUnit5]

== Licence : link:LICENSE[MIT]

4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ build_script:
- gradlew.bat --no-daemon assemble checkstyleMain checkstyleTest

test_script:
- appveyor-retry gradlew.bat --no-daemon headless allTests
- gradlew.bat --no-daemon headless allTests

environment:
JAVA_HOME: C:\Program Files\Java\jdk9 # Use 64-bit Java
JAVA_HOME: C:\Program Files\Java\jdk1.8.0 # Use 64-bit Java

# Files/folders to preserve between builds to speed them up
cache:
Expand Down
35 changes: 4 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,11 @@ plugins {
id 'application'
}

if (JavaVersion.current() == JavaVersion.VERSION_1_10
&& System.getProperty('os.name').startsWith('Windows')) {
logger.warn('''\
==============================================================================
*********************************** WARNING **********************************
==============================================================================
You seem to be running Gradle with JDK 10 on Windows.
JDK 10 on Windows will fail to run tests in headless mode due to a JavaFX bug.
You are highly recommended to use JDK 9!
==============================================================================
'''.stripIndent())
}

// Specifies the entry point of the application
mainClassName = 'seedu.address.MainApp'

sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

repositories {
mavenCentral()
Expand All @@ -58,25 +45,16 @@ dependencies {
String testFxVersion = '4.0.12-alpha'
String jUnitVersion = '5.1.0'

implementation group: 'org.controlsfx', name: 'controlsfx', version: '8.40.11'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'
implementation group: 'com.google.guava', name: 'guava', version: '19.0'
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.8'
implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.0'
implementation group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0'
implementation group: 'javax.activation', name: 'activation', version: '1.1.1'

testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.testfx', name: 'testfx-core', version: testFxVersion, {
exclude group: 'org.testfx', module: 'testfx-internal-java8'
}
testImplementation group: 'org.testfx', name: 'testfx-core', version: testFxVersion
testImplementation group: 'org.testfx', name: 'testfx-junit', version: testFxVersion

testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: jUnitVersion

testRuntimeOnly group: 'org.testfx', name: 'testfx-internal-java9', version: testFxVersion
testRuntimeOnly group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-9+181'
testRuntimeOnly group: 'org.testfx', name: 'openjfx-monocle', version: '8u76-b04'
testRuntimeOnly group:'org.junit.vintage', name:'junit-vintage-engine', version: jUnitVersion
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: jUnitVersion
}
Expand Down Expand Up @@ -236,11 +214,6 @@ task deployOfflineDocs(type: Copy) {
}
}

task copyDummySearchPage(type: Copy) {
from 'docs/DummySearchPage.html'
into "${buildDir}/docs/html5"
}

deployOfflineDocs.dependsOn asciidoctor
processResources.dependsOn deployOfflineDocs

Expand Down
19 changes: 19 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,25 @@
<property name="severity" value="warning"/>
</module>

<!-- Checks that non-whitespace characters are separated by no more than one whitespace character.
a = 1; // Allowed
a = 1; // Not allowed (more than one space before =)
-->
<module name="SingleSpaceSeparator">
<!-- Validate whitespace surrounding comments as well.
a = 1; // Allowed (single space before start of comment)
a = 1; /* Allowed (single space before start of comment) */
/* Allowed (single space after end of comment) */ a = 1;
a = 1; // Not allowed (more than one space before start of comment)
a = 1; /* Not allowed (more than one space before start of comment) */
/* Not allowed (more than one space after end of comment) */ a = 1;
This doesn't validate whitespace within comments so a comment /* like this */ is allowed.
-->
<property name="validateComments" value="true"/>
</module>

<!--
JAVADOC CHECKS
-->
Expand Down
63 changes: 27 additions & 36 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT`

=== Prerequisites

. *JDK `9`* or later
. *JDK `8`* (revision `1.8.0_201` or later)
+
[NOTE]
Only JDK 8 is supported. +
This app will not work with later major JDK releases such as JDK 9, 10, 11, etc.
+
[WARNING]
JDK `10` on Windows will fail to run tests in <<UsingGradle#Running-Tests, headless mode>> due to a https://github.com/javafxports/openjdk-jfx/issues/66[JavaFX bug].
Windows developers are highly recommended to use JDK `9`.

. *IntelliJ* IDE
+
[NOTE]
Expand Down Expand Up @@ -116,9 +116,9 @@ The `.pptx` files used to create diagrams in this document can be found in the l
* At app launch: Initializes the components in the correct sequence, and connects them up with each other.
* At shut down: Shuts down the components and invokes cleanup method where necessary.

<<Design-Commons,*`Commons`*>> represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.
<<Design-Commons,*`Commons`*>> represents a collection of classes used by multiple other components.
The following class plays an important role at the architecture level:

* `EventsCenter` : This class (written using https://github.com/google/guava/wiki/EventBusExplained[Google's Event Bus library]) is used by components to communicate with other components using events (i.e. a form of _Event Driven_ design)
* `LogsCenter` : Used by many classes to write log messages to the App's log file.

The rest of the App consists of four components.
Expand All @@ -139,24 +139,13 @@ For example, the `Logic` component (see the class diagram given below) defines i
image::LogicClassDiagram.png[width="800"]

[discrete]
==== Events-Driven nature of the design
==== How the architecture components interact with each other

The _Sequence Diagram_ below shows how the components interact for the scenario where the user issues the command `delete 1`.
The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete 1`.

.Component interactions for `delete 1` command (part 1)
.Component interactions for `delete 1` command
image::SDforDeletePerson.png[width="800"]

[NOTE]
Note how the `Model` simply raises a `AddressBookChangedEvent` when the Address Book data are changed, instead of asking the `Storage` to save the updates to the hard disk.

The diagram below shows how the `EventsCenter` reacts to that event, which eventually results in the updates being saved to the hard disk and the status bar of the UI being updated to reflect the 'Last Updated' time.

.Component interactions for `delete 1` command (part 2)
image::SDforDeletePersonEventHandling.png[width="800"]

[NOTE]
Note how the event is propagated through the `EventsCenter` to the `Storage` and `UI` without `Model` having to be coupled to either of them. This is an example of how this Event Driven approach helps us reduce direct coupling between components.

The sections below give more details of each component.

[[Design-Ui]]
Expand All @@ -174,8 +163,7 @@ The `UI` component uses JavaFx UI framework. The layout of these UI parts are de
The `UI` component,

* Executes user commands using the `Logic` component.
* Binds itself to some data in the `Model` so that the UI can auto-update when data in the `Model` change.
* Responds to events raised from various parts of the App and updates the UI accordingly.
* Listens for changes to `Model` data so that the UI can be updated with the modified data.

[[Design-Logic]]
=== Logic component
Expand All @@ -189,8 +177,9 @@ link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]

. `Logic` uses the `AddressBookParser` class to parse the user command.
. This results in a `Command` object which is executed by the `LogicManager`.
. The command execution can affect the `Model` (e.g. adding a person) and/or raise events.
. The command execution can affect the `Model` (e.g. adding a person).
. The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`.
. In addition, the `CommandResult` object can also instruct the `Ui` to perform certain actions, such as displaying help to the user.

Given below is the Sequence Diagram for interactions within the `Logic` component for the `execute("delete 1")` API call.

Expand Down Expand Up @@ -228,7 +217,7 @@ image::StorageClassDiagram.png[width="800"]
The `Storage` component,

* can save `UserPref` objects in json format and read it back.
* can save the Address Book data in xml format and read it back.
* can save the Address Book data in json format and read it back.

[[Design-Commons]]
=== Common classes
Expand Down Expand Up @@ -344,7 +333,7 @@ We are using `java.util.logging` package for logging. The `LogsCenter` class is
[[Implementation-Configuration]]
=== Configuration

Certain properties of the application can be controlled (e.g App name, logging level) through the configuration file (default: `config.json`).
Certain properties of the application can be controlled (e.g user prefs file location, logging level) through the configuration file (default: `config.json`).

== Documentation

Expand Down Expand Up @@ -528,9 +517,11 @@ Here are the steps to create a new release.

=== Managing Dependencies

A project often depends on third-party libraries. For example, Address Book depends on the http://wiki.fasterxml.com/JacksonHome[Jackson library] for XML parsing. Managing these _dependencies_ can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives. +
a. Include those libraries in the repo (this bloats the repo size) +
b. Require developers to download those libraries manually (this creates extra work for developers)
A project often depends on third-party libraries. For example, Address Book depends on the https://github.com/FasterXML/jackson[Jackson library] for JSON parsing. Managing these _dependencies_ can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives:

[loweralpha]
. Include those libraries in the repo (this bloats the repo size)
. Require developers to download those libraries manually (this creates extra work for developers)

[[GetStartedProgramming]]
[appendix]
Expand Down Expand Up @@ -678,7 +669,7 @@ Do take a look at <<Design-Storage>> before attempting to modify the `Storage` c
****
* Hint
** Add the API method in link:{repoURL}/src/main/java/seedu/address/storage/AddressBookStorage.java[`AddressBookStorage`] interface.
** Implement the logic in link:{repoURL}/src/main/java/seedu/address/storage/StorageManager.java[`StorageManager`] and link:{repoURL}/src/main/java/seedu/address/storage/XmlAddressBookStorage.java[`XmlAddressBookStorage`] class.
** Implement the logic in link:{repoURL}/src/main/java/seedu/address/storage/StorageManager.java[`StorageManager`] and link:{repoURL}/src/main/java/seedu/address/storage/JsonAddressBookStorage.java[`JsonAddressBookStorage`] class.
* Solution
** See this https://github.com/se-edu/addressbook-level4/pull/594[PR] for the full solution.
****
Expand Down Expand Up @@ -763,18 +754,18 @@ Now we have the `Remark` class, we need to actually use it inside link:{repoURL}

. Add `getRemark()` in link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`].
. You may assume that the user will not be able to use the `add` and `edit` commands to modify the remarks field (i.e. the person will be created without a remark).
. Modify link:{repoURL}/src/main/java/seedu/address/model/util/SampleDataUtil.java/[`SampleDataUtil`] to add remarks for the sample data (delete your `addressBook.xml` so that the application will load the sample data when you launch it.)
. Modify link:{repoURL}/src/main/java/seedu/address/model/util/SampleDataUtil.java/[`SampleDataUtil`] to add remarks for the sample data (delete your `data/addressbook.json` so that the application will load the sample data when you launch it.)

===== [Step 6] Storage: Add `Remark` field to `XmlAdaptedPerson` class
We now have `Remark` s for `Person` s, but they will be gone when we exit the application. Let's modify link:{repoURL}/src/main/java/seedu/address/storage/XmlAdaptedPerson.java[`XmlAdaptedPerson`] to include a `Remark` field so that it will be saved.
===== [Step 6] Storage: Add `Remark` field to `JsonAdaptedPerson` class
We now have `Remark` s for `Person` s, but they will be gone when we exit the application. Let's modify link:{repoURL}/src/main/java/seedu/address/storage/JsonAdaptedPerson.java[`JsonAdaptedPerson`] to include a `Remark` field so that it will be saved.

**Main:**

. Add a new Xml field for `Remark`.
. Add a new JSON field for `Remark`.

**Tests:**

. Fix `invalidAndValidPersonAddressBook.xml`, `typicalPersonsAddressBook.xml`, `validAddressBook.xml` etc., such that the XML tests will not fail due to a missing `<remark>` element.
. Fix `invalidAndValidPersonAddressBook.json`, `typicalPersonsAddressBook.json`, `validAddressBook.json` etc., such that the JSON tests will not fail due to a missing `remark` field.

===== [Step 6b] Test: Add withRemark() for `PersonBuilder`
Since `Person` can now have a `Remark`, we should add a helper method to link:{repoURL}/src/test/java/seedu/address/testutil/PersonBuilder.java[`PersonBuilder`], so that users are able to create remarks when building a link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`].
Expand Down Expand Up @@ -882,7 +873,7 @@ _{More to be added}_
[appendix]
== Non Functional Requirements

. Should work on any <<mainstream-os,mainstream OS>> as long as it has Java `9` or higher installed.
. Should work on any <<mainstream-os,mainstream OS>> as long as it has Java `8` (revision `1.8.0_201` or higher) installed.
. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.

Expand Down
32 changes: 0 additions & 32 deletions docs/DummySearchPage.html

This file was deleted.

Loading

0 comments on commit e297742

Please sign in to comment.