Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix UI bugs #123

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public CommandResult execute(Model model) throws CommandException {
}
UUID fullOriginUuid = model.getFullUuid(originUuid);
UUID fullTargetUuid = model.getFullUuid(targetUuid);
if (fullOriginUuid == null || originUuid == null) {
throw new CommandException(("you have not added the contacts of the people you are looking for!"));
}
if (fullOriginUuid == fullTargetUuid) {
throw new CommandException("anySearch must be performed between two different persons.");
}
Expand Down
21 changes: 15 additions & 6 deletions src/main/java/seedu/address/ui/PersonList.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,30 @@
*/
public PersonList(ObservableList<Person> personList, ObservableList<Relationship> relationships) {
super(FXML);
setPersonListCardItems(personList, relationships);
setPersonListCardItems(personList, relationships, "No Contacts Found :< !"

Check warning on line 30 in src/main/java/seedu/address/ui/PersonList.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonList.java#L30

Added line #L30 was not covered by tests
+ "Start Adding Contacts with AddPerson !!!");
}

/**
* Constructor To intialise an empty Section
*/
public PersonList() {
public PersonList(String text) {
super(FXML);
displayPlaceholderText("You Have To Use AnySearch First!");
displayPlaceholderText(text);

Check warning on line 39 in src/main/java/seedu/address/ui/PersonList.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonList.java#L39

Added line #L39 was not covered by tests
}
public void setPersonListCardItems(ObservableList<Person> personList, ObservableList<Relationship> relationships) {

/**
* set items in personList Section
* @param personList
* @param relationships
* @param text
*/
public void setPersonListCardItems(ObservableList<Person> personList, ObservableList<Relationship> relationships,
String text) {
personListCardVbox.getChildren().clear();
personListScrollPane.setVvalue(0);
if (personList.size() == 0) {
displayPlaceholderText("You Have No Contacts, Start Adding Them!");
displayPlaceholderText(text);

Check warning on line 53 in src/main/java/seedu/address/ui/PersonList.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonList.java#L53

Added line #L53 was not covered by tests
return;
}
for (Person p: personList) {
Expand All @@ -56,7 +65,7 @@
}
private void displayPlaceholderText(String text) {
CustomPlaceholder customPlaceholder = new CustomPlaceholder(
text, 20);
text, 30);
personListCardVbox.getChildren().add(customPlaceholder.getRoot());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*
*/
public void update(ObservableList<Person> personList, ObservableList<Relationship> relationships) {
this.personList.setPersonListCardItems(personList, relationships);
this.personList.setPersonListCardItems(personList, relationships, "No Contacts Found :< ! "

Check warning on line 34 in src/main/java/seedu/address/ui/personlistsection/AllContactsSection.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/personlistsection/AllContactsSection.java#L34

Added line #L34 was not covered by tests
+ "Start Adding Contacts with AddPerson !!!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@
*/
public AnyListSection() {
super(FXML);
this.personList = new PersonList();
this.personList = new PersonList("You Have To Use AnySearch First");

Check warning on line 29 in src/main/java/seedu/address/ui/personlistsection/AnyListSection.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/personlistsection/AnyListSection.java#L29

Added line #L29 was not covered by tests
this.treeMapFlowPane = new TreeMapFlowPane();
personListPlaceHolder.getChildren().add(this.personList.getRoot());
treeMapPlaceHolder.getChildren().add(this.treeMapFlowPane.getRoot());
treeMapPlaceHolder.setVisible(false);
treeMapPlaceHolder.setManaged(false);

Check warning on line 34 in src/main/java/seedu/address/ui/personlistsection/AnyListSection.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/personlistsection/AnyListSection.java#L33-L34

Added lines #L33 - L34 were not covered by tests
}
/**
* Updates the sorted modules in the ModuleListSection.
*
*/
public void update(ObservableList<Person> personList, ObservableList<Relationship> relationships) {
this.personList.setPersonListCardItems(personList, relationships);
this.personList.setPersonListCardItems(personList, relationships, "No Contacts Related "

Check warning on line 41 in src/main/java/seedu/address/ui/personlistsection/AnyListSection.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/personlistsection/AnyListSection.java#L41

Added line #L41 was not covered by tests
+ "to this Person Found !!\n"
+ "Start Adding Relations With AddRelation");
treeMapPlaceHolder.setVisible(true);
treeMapPlaceHolder.setManaged(true);

Check warning on line 45 in src/main/java/seedu/address/ui/personlistsection/AnyListSection.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/personlistsection/AnyListSection.java#L44-L45

Added lines #L44 - L45 were not covered by tests
this.treeMapFlowPane.updateFlowPane(personList, relationships);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class TreeMapFlowPane extends UiPart<Region> {
*/
public TreeMapFlowPane() {
super(FXML);
addEmptyPlaceholderText("Use Any Search First!");
}

/**
Expand Down
Binary file added src/main/resources/images/gene-ie.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 removed src/main/resources/images/genie.png
Binary file not shown.
Binary file added src/main/resources/images/no-results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 19 additions & 11 deletions src/main/resources/view/CustomPlaceHolder.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@

<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Priority?>
<?import javafx.scene.layout.VBox?>

<HBox fx:id="placeholderContainer" alignment="CENTER" fillHeight="true" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1" styleClass="placeholder_container">
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<VBox fx:id="placeholderVbox" alignment="CENTER" maxHeight="Infinity" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<stylesheets>
<URL value="@custom-placeholder.css" />
</stylesheets>
<!-- Left Decorative Label -->
<HBox fx:id="leftDecoration" HBox.hgrow="ALWAYS" maxWidth="Infinity" alignment="CENTER" styleClass="placeholder_deco"/>

<!-- Middle Label with Placeholder -->
<Label fx:id="placeholderText" HBox.hgrow="NEVER" styleClass="placeholder_text"/>

<!-- Right Decorative Label -->
<HBox fx:id="rightDecoration" HBox.hgrow="ALWAYS" maxWidth="Infinity" alignment="CENTER" styleClass="placeholder_deco"/>
</HBox>
<ImageView fitHeight="200" fitWidth="200" preserveRatio="true" styleClass="main-window_navbar_image">
<image>
<Image url="@/images/no-results.png"/> <!-- Replace "your_image.png" with your image path -->
</image>
</ImageView>
<HBox fx:id="placeholderContainer" alignment="CENTER" maxWidth="550" prefWidth="550" maxHeight="Infinity" styleClass="placeholder_container">
<children>
<HBox fx:id="leftDecoration" HBox.hgrow="ALWAYS" maxWidth="Infinity" alignment="CENTER" styleClass="placeholder_deco"/>
<!-- Middle Label with Placeholder -->
<Label fx:id="placeholderText" HBox.hgrow="NEVER" styleClass="placeholder_text" maxHeight="Infinity" maxWidth="550" alignment="CENTER" wrapText="true"/>
<!-- Right Decorative Label -->
<HBox fx:id="rightDecoration" HBox.hgrow="ALWAYS" maxWidth="Infinity" alignment="CENTER" styleClass="placeholder_deco"/>
</children>
</HBox>
</VBox>
8 changes: 4 additions & 4 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?import javafx.scene.image.ImageView?>

<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="GENE-nie" minWidth="400" minHeight="750" onCloseRequest="#handleExit">
title="GENE-nie" minWidth="400" minHeight="780" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/genie_32x32.png" />
</icons>
Expand All @@ -33,15 +33,15 @@
<MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="Help" styleClass="menu-bar_item"/>
</Menu>
</MenuBar>
<HBox styleClass="main-window_navbar" fx:id="mainWindowNavBar">
<HBox styleClass="main-window_navbar" fx:id="mainWindowNavBar" alignment="CENTER">
<HBox styleClass="main-window_navbar_image-container">
<ImageView fitHeight="150" fitWidth="150" preserveRatio="true" styleClass="main-window_navbar_image">
<image>
<Image url="@/images/genie.png"/> <!-- Replace "your_image.png" with your image path -->
<Image url="@/images/gene-ie.png"/> <!-- Replace "your_image.png" with your image path -->
</image>
</ImageView>
</HBox>
<HBox styleClass="main-window_navbar-panel" alignment="CENTER" HBox.hgrow="ALWAYS" fx:id="mainWindowNavBarButtonPlaceholder"/>
<HBox styleClass="main-window_navbar-panel" alignment="CENTER" fx:id="mainWindowNavBarButtonPlaceholder"/>
</HBox>
<HBox alignment="CENTER" spacing="20" fx:id="mainWindowBody" VBox.vgrow="ALWAYS">
<VBox fx:id="displaySectionPlaceholder" alignment="CENTER"/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/display-section/NavBarButton.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<URL value="@nav-bar-button.css" />
</stylesheets>

<Button fx:id="footerButton" styleClass="footer-button, h1" />
<Button fx:id="footerButton" styleClass="footer-button" />
</VBox>

15 changes: 8 additions & 7 deletions src/main/resources/view/display-section/nav-bar-button.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
.footer-button-container {
-fx-cursor: hand;
-fx-border-radius: 5;
-fx-background-radius: 5;
-fx-max-height: 100;
-fx-border-radius: 20;
-fx-background-radius: 20;
-fx-max-height: 60;
-fx-padding: 0 5 0 5;
}
.footer-button-container-selected {
-fx-scale-x: 1.1;
-fx-scale-y: 1.1;
-fx-background-color: -rose-red;
}
.footer-button {
-fx-font-family: 'Raleway SemiBold Italic';
-fx-font-family: 'Raleway SemiBold';
-fx-text-fill: -rose-red;
-fx-background-color: transparent;
-font-weight: 700;
-fx-font-size: 20;
}
.footer-button-selected {
-fx-text-fill: -white;
}

.footer-button-container:hover,
.footer-button-selected-deco,
.footer-button:hover {
-fx-opacity: 0.75;
.footer-button-selected-deco {
-fx-opacity: 0.9;
-fx-translate-y: -3;
-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 15, 0.0, 5, 10);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<VBox fx:id="personListVbox" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="400.0" stylesheets="@person-list.css" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1" alignment="CENTER">
<children>
<ScrollPane id="personListContainerId" fx:id="personListScrollPane" hbarPolicy="NEVER" minHeight="500.0" minViewportHeight="500.0" styleClass="personList_container" stylesheets="@person-list.css" vbarPolicy="ALWAYS">
<ScrollPane id="personListContainerId" fx:id="personListScrollPane" hbarPolicy="NEVER" minHeight="500.0" minViewportHeight="500.0" styleClass="personList_container" stylesheets="@person-list.css" vbarPolicy="ALWAYS" fitToWidth="true">
<content>
<VBox fillWidth="true" fx:id="personListCardVbox" alignment="CENTER" maxHeight="1.7976931348623157E308" minHeight="500.0" minWidth="550.0" styleClass="personList_vbox_container" stylesheets="@person-list.css" spacing="10" VBox.vgrow="ALWAYS">
<effect>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/view/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
-fx-text-fill: -black;
}
.main-window_navbar {
-fx-padding: 40 150 0 100;
-fx-spacing: 120;
-fx-padding: 20;
-fx-spacing: 80;
}
.main-window_navbar_image-container {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public void testListFilteredCorrectlyForInvalidAnySearch() throws CommandExcepti
assertEquals("No Relationship pathway found", result.getFeedbackToUser());
}
@Test
public void testInputsNotInAddressBook() {
AnySearchCommand anySearchCommand1 = new AnySearchCommand("0020", "0020");
assertCommandFailure(anySearchCommand1, model, "you have not added the contacts "
+ "of the people you are looking for!");
}
@Test
void testEqualsSameObject() {
AnySearchCommand command = new AnySearchCommand("uuid1", "uuid2");
assertTrue(command.equals(command));
Expand Down
Loading