Skip to content

Commit f5f8265

Browse files
committed
Refactor ui package
1 parent 3ecf0fb commit f5f8265

26 files changed

+60
-63
lines changed

copyright.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Some code adapted from http://code.makery.ch/library/javafx-8-tutorial/ by Marco Jakob
22

33
Copyright by Susumu Yoshida - http://www.mcdodesign.com/
4-
- address_book_32.png
54
- AddressApp.ico
65

76
Copyright by Jan Jan Kovařík - http://glyphicons.com/

docs/DeveloperGuide.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ image::UiClassDiagram.png[]
7979

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

82-
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.
82+
The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `ItemListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.
8383

8484
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`]
8585

docs/diagrams/ArchitectureSequenceDiagram.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ activate ui UI_COLOR
1313
ui -[UI_COLOR]> logic : execute("delete 1")
1414
activate logic LOGIC_COLOR
1515

16-
logic -[LOGIC_COLOR]> model : deletePerson(p)
16+
logic -[LOGIC_COLOR]> model : deleteItem(p)
1717
activate model MODEL_COLOR
1818

1919
model -[MODEL_COLOR]-> logic

docs/diagrams/BetterModelClassDiagram.puml

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ skinparam arrowThickness 1.1
44
skinparam arrowColor MODEL_COLOR
55
skinparam classBackgroundColor MODEL_COLOR
66

7-
AddressBook *-right-> "1" UniquePersonList
7+
AddressBook *-right-> "1" UniqueItemList
88
AddressBook *-right-> "1" UniqueTagList
9-
UniqueTagList -[hidden]down- UniquePersonList
10-
UniqueTagList -[hidden]down- UniquePersonList
9+
UniqueTagList -[hidden]down- UniqueItemList
10+
UniqueTagList -[hidden]down- UniqueItemList
1111

1212
UniqueTagList *-right-> "*" Tag
13-
UniquePersonList o-right-> Person
13+
UniqueItemList o-right-> Item
1414

15-
Person o-up-> "*" Tag
15+
Item o-up-> "*" Tag
1616

17-
Person *--> Name
18-
Person *--> Phone
19-
Person *--> Email
20-
Person *--> Address
17+
Item *--> Name
18+
Item *--> Phone
19+
Item *--> Email
20+
Item *--> Address
2121
@enduml

docs/diagrams/DeleteSequenceDiagram.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ deactivate AddressBookParser
4848
LogicManager -> DeleteCommand : execute()
4949
activate DeleteCommand
5050

51-
DeleteCommand -> Model : deletePerson(1)
51+
DeleteCommand -> Model : deleteItem(1)
5252
activate Model
5353

5454
Model --> DeleteCommand

docs/diagrams/ModelClassDiagram.puml

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Class ModelManager
1515
Class UserPrefs
1616
Class ReadOnlyUserPrefs
1717

18-
Package Person {
19-
Class Person
18+
Package Item {
19+
Class Item
2020
Class Address
2121
Class Email
2222
Class Name
2323
Class Phone
24-
Class UniquePersonList
24+
Class UniqueItemList
2525
}
2626

2727
Package Tag {
@@ -40,17 +40,17 @@ ModelManager o--> "1" AddressBook
4040
ModelManager o-left-> "1" UserPrefs
4141
UserPrefs .up.|> ReadOnlyUserPrefs
4242

43-
AddressBook *--> "1" UniquePersonList
44-
UniquePersonList o--> "*" Person
45-
Person *--> Name
46-
Person *--> Phone
47-
Person *--> Email
48-
Person *--> Address
49-
Person *--> "*" Tag
43+
AddressBook *--> "1" UniqueItemList
44+
UniqueItemList o--> "*" Item
45+
Item *--> Name
46+
Item *--> Phone
47+
Item *--> Email
48+
Item *--> Address
49+
Item *--> "*" Tag
5050

5151
Name -[hidden]right-> Phone
5252
Phone -[hidden]right-> Address
5353
Address -[hidden]right-> Email
5454

55-
ModelManager -->"1" Person : filtered list
55+
ModelManager -->"1" Item : filtered list
5656
@enduml

docs/diagrams/StorageClassDiagram.puml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ StorageManager o--> AddressBookStorage
1919
JsonUserPrefsStorage .left.|> UserPrefsStorage
2020
JsonAddressBookStorage .left.|> AddressBookStorage
2121
JsonAddressBookStorage .down.> JsonSerializableAddressBookStorage
22-
JsonSerializableAddressBookStorage .right.> JsonSerializablePerson
23-
JsonSerializablePerson .right.> JsonAdaptedTag
22+
JsonSerializableAddressBookStorage .right.> JsonSerializableItem
23+
JsonSerializableItem .right.> JsonAdaptedTag
2424
@enduml

docs/diagrams/UiClassDiagram.puml

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Class UiManager
1111
Class MainWindow
1212
Class HelpWindow
1313
Class ResultDisplay
14-
Class PersonListPanel
15-
Class PersonCard
14+
Class ItemListPanel
15+
Class ItemCard
1616
Class StatusBarFooter
1717
Class CommandBox
1818
}
@@ -33,25 +33,25 @@ UiManager -down-> MainWindow
3333
MainWindow --> HelpWindow
3434
MainWindow *-down-> CommandBox
3535
MainWindow *-down-> ResultDisplay
36-
MainWindow *-down-> PersonListPanel
36+
MainWindow *-down-> ItemListPanel
3737
MainWindow *-down-> StatusBarFooter
3838

39-
PersonListPanel -down-> PersonCard
39+
ItemListPanel -down-> ItemCard
4040

4141
MainWindow -left-|> UiPart
4242

4343
ResultDisplay --|> UiPart
4444
CommandBox --|> UiPart
45-
PersonListPanel --|> UiPart
46-
PersonCard --|> UiPart
45+
ItemListPanel --|> UiPart
46+
ItemCard --|> UiPart
4747
StatusBarFooter --|> UiPart
4848
HelpWindow -down-|> UiPart
4949

50-
PersonCard ..> Model
50+
ItemCard ..> Model
5151
UiManager -right-> Logic
5252
MainWindow -left-> Logic
5353

54-
PersonListPanel -[hidden]left- HelpWindow
54+
ItemListPanel -[hidden]left- HelpWindow
5555
HelpWindow -[hidden]left- CommandBox
5656
CommandBox -[hidden]left- ResultDisplay
5757
ResultDisplay -[hidden]left- StatusBarFooter

docs/diagrams/tracing/LogicSequenceDiagram.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ create ecp
1313
abp -> ecp
1414
abp -> ecp ++: parse(arguments)
1515
create ec
16-
ecp -> ec ++: index, editPersonDescriptor
16+
ecp -> ec ++: index, editItemDescriptor
1717
ec --> ecp --
1818
ecp --> abp --: command
1919
abp --> logic --: command

src/main/java/io/xpire/model/Xpire.java

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ public void resetData(ReadOnlyXpire newData) {
4444
this.setItems(newData.getItemList());
4545
}
4646

47-
//// person-level operations
48-
4947
/**
5048
* Returns true if an item with the same identity as {@code item} exists in xpire.
5149
*/

src/main/java/io/xpire/ui/HelpWindow.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616
public class HelpWindow extends UiPart<Stage> {
1717

18-
public static final String USERGUIDE_URL = "https://se-education.org/addressbook-level3/UserGuide.html";
18+
public static final String USERGUIDE_URL =
19+
"https://github.com/AY1920S1-CS2103T-F11-2/main/blob/master/docs/UserGuide.adoc";
1920
public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL;
2021

2122
private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);

src/main/java/io/xpire/ui/ItemCard.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import javafx.scene.layout.Region;
1111

1212
/**
13-
* An UI component that displays information of a {@code Person}.
13+
* An UI component that displays information of a {@code Item}.
1414
*/
1515
public class ItemCard extends UiPart<Region> {
1616

@@ -21,7 +21,6 @@ public class ItemCard extends UiPart<Region> {
2121
* As a consequence, UI elements' variable names cannot be set to such keywords
2222
* or an exception will be thrown by JavaFX during runtime.
2323
*
24-
* @see <a href="https://github.com/se-edu/addressbook-level4/issues/336">The issue on AddressBook level 4</a>
2524
*/
2625

2726
public final Item item;

src/main/java/io/xpire/ui/ItemListPanel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import javafx.scene.layout.Region;
1212

1313
/**
14-
* Panel containing the list of persons.
14+
* Panel containing the list of items.
1515
*/
1616
public class ItemListPanel extends UiPart<Region> {
1717
private static final String FXML = "ItemListPanel.fxml";

src/main/java/io/xpire/ui/MainWindow.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class MainWindow extends UiPart<Stage> {
4242
private MenuItem helpMenuItem;
4343

4444
@FXML
45-
private StackPane personListPanelPlaceholder;
45+
private StackPane itemListPanelPlaceholder;
4646

4747
@FXML
4848
private StackPane resultDisplayPlaceholder;
@@ -108,7 +108,7 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) {
108108
*/
109109
void fillInnerParts() {
110110
itemListPanel = new ItemListPanel(logic.getFilteredItemList());
111-
personListPanelPlaceholder.getChildren().add(itemListPanel.getRoot());
111+
itemListPanelPlaceholder.getChildren().add(itemListPanel.getRoot());
112112

113113
resultDisplay = new ResultDisplay();
114114
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());

src/main/java/io/xpire/ui/UiManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class UiManager implements Ui {
2020
public static final String ALERT_DIALOG_PANE_FIELD_ID = "alertDialogPane";
2121

2222
private static final Logger logger = LogsCenter.getLogger(UiManager.class);
23-
private static final String ICON_APPLICATION = "/images/address_book_32.png";
23+
private static final String ICON_APPLICATION = "/images/xpire_icon.png";
2424

2525
private Logic logic;
2626
private MainWindow mainWindow;
-4.12 KB
Binary file not shown.
37.9 KB
Loading

src/main/resources/view/DarkTheme.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@
328328
-fx-text-fill: white;
329329
}
330330

331-
#filterField, #personListPanel, #personWebpage {
331+
#filterField, #itemListPanel, #itemWebpage {
332332
-fx-effect: innershadow(gaussian, black, 10, 0, 0, 0);
333333
}
334334

src/main/resources/view/MainWindow.fxml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
<?import javafx.scene.layout.VBox?>
1313

1414
<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
15-
title="Address App" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
15+
title="Xpire" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
1616
<icons>
17-
<Image url="@/images/address_book_32.png" />
17+
<Image url="@/images/xpire_icon.png" />
1818
</icons>
1919
<scene>
2020
<Scene>
@@ -46,11 +46,11 @@
4646
</padding>
4747
</StackPane>
4848

49-
<VBox fx:id="personList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
49+
<VBox fx:id="itemList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
5050
<padding>
5151
<Insets top="10" right="10" bottom="10" left="10" />
5252
</padding>
53-
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
53+
<StackPane fx:id="itemListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
5454
</VBox>
5555

5656
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />

src/test/data/JsonXpireStorageTest/invalidAndValidItemXpire.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"items": [ {
3-
"name": "Valid Person",
3+
"name": "Valid Item",
44
"expiryDate": "18/12/2019"
55
}, {
66
"name": "Item With Invalid expiryDate Field",

src/test/java/io/xpire/commons/util/AppUtilTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class AppUtilTest {
1010

1111
@Test
1212
public void getImage_exitingImage() {
13-
assertNotNull(AppUtil.getImage("/images/address_book_32.png"));
13+
assertNotNull(AppUtil.getImage("/images/xpire_icon.png"));
1414
}
1515

1616
@Test

src/test/java/io/xpire/logic/commands/CommandTestUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public static void assertCommandFailure(Command command, Model actualModel, Stri
118118
assertEquals(expectedFilteredList, actualModel.getFilteredItemList());
119119
}
120120
/**
121-
* Updates {@code model}'s filtered list to show only the person at the given {@code targetIndex} in the
121+
* Updates {@code model}'s filtered list to show only the item at the given {@code targetIndex} in the
122122
* {@code model}'s expiry date tracker.
123123
*/
124124
public static void showItemAtIndex(Model model, Index targetIndex) {

src/test/java/io/xpire/testutil/EditItemDescriptorBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import io.xpire.model.tag.Tag;
1212

1313
/**
14-
* A utility class to help with building EditPersonDescriptor objects.
14+
* A utility class to help with building EditItemDescriptor objects.
1515
*/
1616
public class EditItemDescriptorBuilder {
1717

src/test/java/io/xpire/testutil/ItemBuilder.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io.xpire.model.util.SampleDataUtil;
1111

1212
/**
13-
* A utility class to help with building Person objects.
13+
* A utility class to help with building Item objects.
1414
*/
1515
public class ItemBuilder {
1616

@@ -30,10 +30,10 @@ public ItemBuilder() {
3030
/**
3131
* Initializes the ItemBuilder with the data of {@code itemToCopy}.
3232
*/
33-
public ItemBuilder(Item personToCopy) {
34-
name = personToCopy.getName();
35-
expiryDate = personToCopy.getExpiryDate();
36-
tags = new HashSet<>(personToCopy.getTags());
33+
public ItemBuilder(Item itemToCopy) {
34+
name = itemToCopy.getName();
35+
expiryDate = itemToCopy.getExpiryDate();
36+
tags = new HashSet<>(itemToCopy.getTags());
3737
}
3838

3939
/**

src/test/java/io/xpire/testutil/TestUtil.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ public static Path getFilePathInSandboxFolder(String fileName) {
3333
}
3434

3535
/**
36-
* Returns the middle index of the person in the {@code model}'s person list.
36+
* Returns the middle index of the item in the {@code model}'s item list.
3737
*/
3838
public static Index getMidIndex(Model model) {
3939
return Index.fromOneBased(model.getFilteredItemList().size() / 2);
4040
}
4141

4242
/**
43-
* Returns the last index of the person in the {@code model}'s person list.
43+
* Returns the last index of the item in the {@code model}'s item list.
4444
*/
4545
public static Index getLastIndex(Model model) {
4646
return Index.fromOneBased(model.getFilteredItemList().size());
4747
}
4848

4949
/**
50-
* Returns the person in the {@code model}'s person list at {@code index}.
50+
* Returns the item in the {@code model}'s item list at {@code index}.
5151
*/
5252
public static Item getItem(Model model, Index index) {
5353
return model.getFilteredItemList().get(index.getZeroBased());

src/test/java/io/xpire/testutil/TypicalItems.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import io.xpire.model.item.Item;
99

1010
/**
11-
* A utility class containing a list of {@code Person} objects to be used in tests.
11+
* A utility class containing a list of {@code Item} objects to be used in tests.
1212
*/
1313
public class TypicalItems {
1414

@@ -31,7 +31,7 @@ public class TypicalItems {
3131
private TypicalItems() {} // prevents instantiation
3232

3333
/**
34-
* Returns an {@code AddressBook} with all the typical persons.
34+
* Returns an {@code AddressBook} with all the typical items.
3535
*/
3636
public static Xpire getTypicalExpiryDateTracker() {
3737
Xpire edt = new Xpire();

0 commit comments

Comments
 (0)