Skip to content

Commit

Permalink
Merge 733f960 into abdc0d6
Browse files Browse the repository at this point in the history
  • Loading branch information
CranstonYeo committed Apr 13, 2020
2 parents abdc0d6 + 733f960 commit 5292f58
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 85 deletions.
2 changes: 1 addition & 1 deletion docs/diagrams/SnoozeReminderActivityDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ start
'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([all prefixes present])
if () then ([all prefixes present and unique])
:Parse prefixes;
if () then ([all prefixes formatted correctly])
:Check if duration provided
Expand Down
Binary file modified docs/images/SnoozeReminderActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 21 additions & 11 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
import seedu.address.commons.core.Messages;
import seedu.address.logic.Logic;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.consults.ListConsultCommand;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.commands.mods.ListModCommand;
import seedu.address.logic.commands.mods.ViewModInfoCommand;
import seedu.address.logic.commands.students.FindStudentCommand;
import seedu.address.logic.commands.students.FindStudentMatricNumberCommand;
import seedu.address.logic.commands.students.ListStudentCommand;
import seedu.address.logic.commands.tutorials.ListTutorialCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.event.tutorial.Tutorial;
import seedu.address.ui.calendar.CalendarWindow;
Expand Down Expand Up @@ -187,7 +194,7 @@ void fillInnerParts() {
}

void setSplitPane() {
splitPanePlaceholder.lookupAll(".split-pane-divider").stream()
splitPanePlaceholder.lookupAll(".split-pane-divider")
.forEach(div -> div.setMouseTransparent(true));
}

Expand Down Expand Up @@ -223,27 +230,30 @@ public void handleHelp() {
*/
@FXML
public void handleList(String commandText) {
if (commandText.contains(" ")) {
commandText = commandText.substring(0, commandText.indexOf(" "));
}
switch(commandText.split(" ", 2)[0]) {

switch(commandText) {
case "listStudent":
case "findStudent":
case ListStudentCommand.COMMAND_WORD:
case FindStudentCommand.COMMAND_WORD:
case FindStudentMatricNumberCommand.COMMAND_WORD:
firstTabPanePlaceholder.getSelectionModel().select(0);
break;
case "listTutorial":

case ListTutorialCommand.COMMAND_WORD:
firstTabPanePlaceholder.getSelectionModel().select(1);
break;
case "listMod":

case ListModCommand.COMMAND_WORD:
firstTabPanePlaceholder.getSelectionModel().select(2);
break;
case "listConsult":

case ListConsultCommand.COMMAND_WORD:
secondTabPanePlaceholder.getSelectionModel().select(0);
break;
case "viewModInfo":

case ViewModInfoCommand.COMMAND_WORD:
secondTabPanePlaceholder.getSelectionModel().select(2);
break;

default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/ui/calendar/CalendarWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public void hide() {
*/
public void show() {
logger.fine("Showing Calendar Window.");
fillDays();
getRoot().show();
getRoot().centerOnScreen();
}
Expand All @@ -177,6 +178,7 @@ public void close() {
* Focuses on the Calendar window.
*/
public void focus() {
fillDays();
getRoot().requestFocus();
}

Expand Down
79 changes: 6 additions & 73 deletions src/main/java/seedu/address/ui/reminder/ReminderListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import java.util.logging.Logger;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.fxml.FXML;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.MultipleSelectionModel;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
import seedu.address.commons.core.LogsCenter;
import seedu.address.model.reminder.Reminder;
Expand All @@ -28,7 +28,10 @@ public ReminderListPanel(ObservableList<Reminder> reminderList) {
super(FXML);
reminderListView.setItems(reminderList);
reminderListView.setCellFactory(listView -> new ReminderListViewCell());
reminderListView.setSelectionModel(new DisableSelectionModel<Reminder>());

// Prevent ReminderListPanel from being selected with a mouse click
reminderListView.addEventFilter(MouseEvent.MOUSE_PRESSED, Event::consume);
reminderListView.setFocusTraversable(false);
}

/**
Expand All @@ -47,74 +50,4 @@ protected void updateItem(Reminder reminder, boolean empty) {
}
}
}

/**
* Custom {@code SelectionModel} that prevents {@code ReminderCard} from being selected with a mouse click.
*/
public class DisableSelectionModel<T> extends MultipleSelectionModel<T> {

@Override
public ObservableList<Integer> getSelectedIndices() {
return FXCollections.emptyObservableList();
}

@Override
public ObservableList<T> getSelectedItems() {
return FXCollections.emptyObservableList();
}

@Override
public void selectIndices(int index, int... indices) {
}

@Override
public void selectAll() {
}

@Override
public void selectFirst() {
}

@Override
public void selectLast() {
}

@Override
public void clearAndSelect(int index) {
}

@Override
public void select(int index) {
}

@Override
public void select(T obj) {
}

@Override
public void clearSelection(int index) {
}

@Override
public void clearSelection() {
}

@Override
public boolean isSelected(int index) {
return false;
}

@Override
public boolean isEmpty() {
return true;
}

@Override
public void selectPrevious() {
}

@Override
public void selectNext() {
}
}
}

0 comments on commit 5292f58

Please sign in to comment.