You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** Adds the given birthday to a person */voidaddBirthday(IndextargetIndex, BirthdaytoAdd) throwsPersonNotFoundException,
DuplicatePersonException;
/java/seedu/address/model/Model.java
/** * Sort the given list according to alphabetical order * @throws NullPointerException if {@code contactList} is null. */BooleansortPersonByName(ArrayList<ReadOnlyPerson> contactList);
}
/** * Represents a birthday field in the address book. * Guarantees: immutable; name is valid as declared in {@link #isValidBirthdayFormat(String)} */publicclassBirthday {
publicstaticfinalStringMESSAGE_BIRTHDAY_CONSTRAINTS = "Birthdays should be numeric in the format "
+ "DD/MM/YY or DD/MM/YYYY.";
publicstaticfinalStringBIRTHDAY_VALIDATION_REGEX = "^(?:(?:31(\\/|-|\\.)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)"
+ "(\\/|-|\\.)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.)0?2\\3"
+ "(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$"
+ "|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$";
publicstaticfinalStringDEFAULT_BIRTHDAY = "No Birthday Added";
privatefinalStringbirthdayNumber;
publicBirthday () {
this.birthdayNumber = DEFAULT_BIRTHDAY; //default value
}
/** * Validates given birthday input. * * @throws IllegalValueException if the given birthday string is invalid. */publicBirthday(Stringbirthday) throwsIllegalValueException {
requireNonNull(birthday);
StringtrimmedBirthday = birthday.trim();
if (!isValidBirthdayFormat(trimmedBirthday)) {
thrownewIllegalValueException(MESSAGE_BIRTHDAY_CONSTRAINTS);
}
this.birthdayNumber = trimmedBirthday;
}
/** * Returns the string value of the birthday */publicStringgetBirthdayNumber() {
returnbirthdayNumber;
}
/** * Returns true if a given string is a valid birthday number. */publicstaticbooleanisValidBirthdayFormat(Stringtest) {
returntest.matches(BIRTHDAY_VALIDATION_REGEX) || test.equalsIgnoreCase(DEFAULT_BIRTHDAY);
}
@Overridepublicbooleanequals(Objectother) {
returnother == this// short circuit if same object
|| (otherinstanceofBirthday// instanceof handles nulls
&& this.birthdayNumber.equals(((Birthday) other).birthdayNumber)); // state check
}
@OverridepublicinthashCode() {
returnbirthdayNumber.hashCode();
}
/** * Format state as text for viewing. */publicStringtoString() {
returnbirthdayNumber;
}
}
/** * Sort the list of contacts by their names */publicclassSortCommandextendsCommand {
publicstaticfinalStringCOMMAND_WORDVAR_1 = "sort";
publicstaticfinalStringCOMMAND_WORDVAR_2 = "st";
publicstaticfinalStringMESSAGE_USAGE = COMMAND_WORDVAR_1
+ " OR "
+ COMMAND_WORDVAR_2
+ ": Sort all contacts by alphabetical order according to their name. "
+ "Command is case-insensitive.";
publicstaticfinalStringMESSAGE_SUCCESS = "All contacts in AddressBook are sorted by name.";
publicstaticfinalStringMESSAGE_ALREADY_SORTED = "The AddressBook is already sorted.";
publicstaticfinalStringMESSAGE_EMPTY_LIST = "There is no contact to be sorted in AddressBook.";
privateArrayList<ReadOnlyPerson> contactList;
publicSortCommand() {
contactList = newArrayList<>();
}
@OverridepublicCommandResultexecute() {
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
BooleanisNotEmpty = model.sortPersonByName(contactList);
if (isNotEmpty == null) {
returnnewCommandResult(MESSAGE_EMPTY_LIST);
} elseif (!isNotEmpty) {
returnnewCommandResult(MESSAGE_ALREADY_SORTED);
}
returnnewCommandResult(MESSAGE_SUCCESS);
}
}
/** * Adds the birthday to the identified persons. */publicclassAddBirthdayCommandextendsUndoableCommand {
publicstaticfinalStringCOMMAND_WORDVAR_1 = "birthday";
publicstaticfinalStringCOMMAND_WORDVAR_2 = "bd";
publicstaticfinalStringMESSAGE_USAGE = COMMAND_WORDVAR_1
+ " OR "
+ COMMAND_WORDVAR_2
+ ": Adds the given birthday to the person identified by the list of index numbers used in the "
+ "last person listing. The format of birthday is in DDMMYY. "
+ "Command is case-sensitive. \n"
+ "Parameters: "
+ "[INDEX] (index must be a positive integer) "
+ "[" + PREFIX_BIRTHDAY + "BIRTHDAY]... (birthday must be integers)\n"
+ "Example 1: "
+ COMMAND_WORDVAR_1
+ " 1 b/240594 \n"
+ "Example 2: "
+ COMMAND_WORDVAR_2.toUpperCase()
+ " 5 b/110696 \n";
publicstaticfinalStringMESSAGE_ADD_BIRTHDAY_SUCCESS = "Added Birthday: %1$s";
publicstaticfinalStringMESSAGE_DUPLICATE_PERSON = "This person already exists in the address book.";
publicstaticfinalStringMESSAGE_DUPLICATE_BIRTHDAY = "A birthday already exists in the given person. "
+ "Please use edit command to make changes to it.";
privatefinalIndextargetIndex;
privatefinalBirthdaytoAdd;
/** * @param targetIndex of the person in the filtered person list to edit * @param toAdd birthday to add to given target index */publicAddBirthdayCommand(IndextargetIndex, BirthdaytoAdd) {
requireNonNull(targetIndex);
requireNonNull(toAdd);
this.targetIndex = targetIndex;
this.toAdd = toAdd;
}
/** * First checks if the target index is not out of bounds and then checks if a birthday exists in them * the given target index of person. If not, add the birthday to the target person. */@OverridepublicCommandResultexecuteUndoableCommand() throwsCommandException {
List<ReadOnlyPerson> lastShownList = model.getFilteredPersonList();
booleanpersonsContainsBirthdayToAdd = true;
if (targetIndex.getZeroBased() >= lastShownList.size()) {
thrownewCommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}
ReadOnlyPersonreadOnlyPerson = lastShownList.get(targetIndex.getZeroBased());
if (Objects.equals(readOnlyPerson.getBirthday().toString(), Birthday.DEFAULT_BIRTHDAY)) {
personsContainsBirthdayToAdd = false;
}
if (personsContainsBirthdayToAdd) {
thrownewCommandException(MESSAGE_DUPLICATE_BIRTHDAY);
}
try {
model.addBirthday(this.targetIndex, this.toAdd);
EventsCenter.getInstance().post(newPopulateBirthdayEvent(model.getFilteredPersonList()));
} catch (DuplicatePersonExceptiondpe) {
thrownewCommandException(MESSAGE_DUPLICATE_PERSON);
} catch (PersonNotFoundExceptionpnfe) {
thrownewAssertionError("The target person cannot be missing");
}
returnnewCommandResult(String.format(MESSAGE_ADD_BIRTHDAY_SUCCESS, toAdd));
}
@Overridepublicbooleanequals(Objectother) {
// short circuit if same objectif (other == this) {
returntrue;
}
// instanceof handles nullsif (!(otherinstanceofAddBirthdayCommand)) {
returnfalse;
}
// state checkAddBirthdayCommande = (AddBirthdayCommand) other;
returntargetIndex.equals(e.targetIndex)
&& toAdd.equals(e.toAdd);
}
}
/** * Parses input arguments and creates a new AddBirthdayCommand object */publicclassAddBirthdayCommandParserimplementsParser<AddBirthdayCommand> {
/** * Parses the given {@code String} of arguments in the context of the AddBirthdayCommand * and returns a AddBirthdayCommand object for execution. * @throws ParseException if the user input does not conform the expected format */publicAddBirthdayCommandparse(Stringargs) throwsParseException {
requireNonNull(args);
ArgumentMultimapargMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_BIRTHDAY);
if (!isPrefixPresent(argMultimap, PREFIX_BIRTHDAY)) {
thrownewParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddBirthdayCommand.MESSAGE_USAGE));
}
try {
StringenteredIndex = argMultimap.getPreamble();
Indexindex = ParserUtil.parseIndex(enteredIndex);
StringbirthdayName = argMultimap.getValue(PREFIX_BIRTHDAY).orElse("");
BirthdaytoAdd = newBirthday(birthdayName);
returnnewAddBirthdayCommand(index, toAdd);
} catch (IllegalValueExceptionive) {
thrownewParseException(ive.getMessage(), ive);
}
}
/** * Returns true if the prefix does not contain empty {@code Optional} values in the given * {@code ArgumentMultimap}. */privatestaticbooleanisPrefixPresent(ArgumentMultimapargumentMultimap, Prefixprefix) {
returnargumentMultimap.getValue(prefix).isPresent();
}
}
/java/seedu/address/logic/parser/ParserUtil.java
/** * Parses a {@code Optional<String> birthday} into an {@code Optional<Birthday>} if {@code birthday} is present. * See header comment of this class regarding the use of {@code Optional} parameters. */publicstaticOptional<Birthday> parseBirthday(Optional<String> birthday) throwsIllegalValueException {
requireNonNull(birthday);
returnbirthday.isPresent() ? Optional.of(newBirthday(birthday.get())) : Optional.empty();
}
/** * Returns the last address value of the field entered {@code prefix}. * Returns default address value when address is entered. */publicOptional<String> getAddressOptionalValue(Prefixprefix) {
List<String> values = getAllValues(prefix);
returnvalues.isEmpty() ? Optional.of(Address.DEFAULT_ADDRESS) : Optional.of(values.get(values.size() - 1));
}
/** * Returns the last email value of the {@code prefix}. * Returns default email value when no email is entered. */publicOptional<String> getEmailOptionalValue(Prefixprefix) {
List<String> values = getAllValues(prefix);
returnvalues.isEmpty() ? Optional.of(Email.DEFAULT_EMAIL) : Optional.of(values.get(values.size() - 1));
}
/** * Returns the last birthday value of {@code prefix}. * Returns default birthday value when no birthday is entered. */publicOptional<String> getBirthdayOptionalValue(Prefixprefix) {
List<String> values = getAllValues(prefix);
returnvalues.isEmpty() ? Optional.of(Birthday.DEFAULT_BIRTHDAY) : Optional.of(values.get(values.size() - 1));
}
/java/seedu/address/storage/XmlAdaptedPerson.java
@XmlElement(required = true)
privateStringbirthday;
@XmlElementprivateList<XmlAdaptedTag> tagged = newArrayList<>();
/** * Constructs an XmlAdaptedPerson. * This is the no-arg constructor that is required by JAXB. */publicXmlAdaptedPerson() {}
/** * Converts a given Person into this class for JAXB use. * * @param source future changes to this will not affect the created XmlAdaptedPerson */publicXmlAdaptedPerson(ReadOnlyPersonsource) {
name = source.getName().fullName;
phone = source.getPhone().value;
email = source.getEmail().value;
address = source.getAddress().value;
/java/seedu/address/storage/XmlAdaptedPerson.java
birthday = source.getBirthday().getBirthdayNumber();
tagged = newArrayList<>();
for (Tagtag : source.getTags()) {
tagged.add(newXmlAdaptedTag(tag));
}
}
/** * Converts this jaxb-friendly adapted person object into the model's Person object. * * @throws IllegalValueException if there were any data constraints violated in the adapted person */publicPersontoModelType() throwsIllegalValueException {
finalList<Tag> personTags = newArrayList<>();
for (XmlAdaptedTagtag : tagged) {
personTags.add(tag.toModelType());
}
finalNamename = newName(this.name);
finalPhonephone = newPhone(this.phone);
finalEmailemail = newEmail(this.email);
finalAddressaddress = newAddress(this.address);
/** * Display the total number of people in the address book * @param totalPeople * @ return a string of the displayed text */publicstaticStringgetTotalPeopleText(inttotalPeople) {
StringdisplayText = totalPeople + " person(s) in UniCity";
returndisplayText;
}
publicvoidsetTotalPeople(inttotalPeople) {
this.totalPeople.setText(getTotalPeopleText(totalPeople));
}
}
/java/seedu/address/ui/PersonCard.java
privatestaticString[] colors = { "red", "blue", "orange", "brown", "purple", "black", "gray", "maroon", "coral",
"blueviolet", "slategrey", "darkseagreen", "darkturquoise", "darkkhaki", "firebrick", "darkcyan" };
privatestaticHashMap<String, String> tagColors = newHashMap<>();
privatestaticinttagNumber = 0;
/** * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. * As a consequence, UI elements' variable names cannot be set to such keywords * or an exception will be thrown by JavaFX during runtime. * * @see <a href="https://github.com/se-edu/addressbook-level4/issues/336">The issue on AddressBook level 4</a> */
/java/seedu/address/ui/PersonCard.java
initTags(person);
/java/seedu/address/ui/PersonCard.java
/** * Binds the individual tags shown for each contact to a different color * so that it is clearer for the user. */privatevoidinitTags(ReadOnlyPersonperson) {
person.getTags().forEach((Tagtag) -> {
LabeltagLabel = newLabel(tag.tagName);
if (tag.tagName.equalsIgnoreCase("friends") || tag.tagName.equalsIgnoreCase("friend")) {
tagLabel.setStyle("-fx-background-color: green");
} else {
tagLabel.setStyle("-fx-background-color: " + getColorForTag(tag.tagName));
}
tags.getChildren().add(tagLabel);
});
}
privateStringgetColorForTag(StringtagValue) {
if (!tagColors.containsKey(tagValue)) {
tagColors.put(tagValue, colors[tagNumber]);
tagNumber++;
}
if (tagNumber >= colors.length) {
tagNumber = 0;
}
returntagColors.get(tagValue);
}
/** * this method is to populate the calendar when there is an add or change in birthday. * @param request */@SubscribeprivatevoidhandleBirthdayEvent(PopulateBirthdayEventrequest) {
logger.info(LogsCenter.getEventHandlingLogMessage(request));
calendarView.populateUpdatedCalendar(request.contactList);
}
/java/seedu/address/ui/ExtendedPersonDisplay.java
/** * Extended person card show more details about a certain contact */publicclassExtendedPersonDisplayextendsUiPart<Region> {
privatestaticfinalStringFXML = "ExtendedPersonDisplay.fxml";
privatefinalLoggerlogger = LogsCenter.getLogger(this.getClass());
@FXMLprivateVBoxcardPane;
@FXMLprivateLabelname;
@FXMLprivateLabelphone;
@FXMLprivateLabelemail;
@FXMLprivateLabeladdress;
@FXMLprivateLabelbirthday;
publicExtendedPersonDisplay() {
super(FXML);
registerAsAnEventHandler(this);
}
/** * Updates the contact details displayed on the extended person display */privatevoidloadMorePersonDetails (ReadOnlyPersonperson) {
name.setText(person.getName().fullName);
phone.setText(person.getPhone().toString());
email.setText(person.getEmail().toString());
address.setText(person.getAddress().toString());
}
/** * Binds the birthday string together for each contact to display in a better format * so that it is clearer for the user. */privatevoidinitBirthdayLabel(ReadOnlyPersonperson) {
StringinitialBirthday = person.getBirthday().getBirthdayNumber();
StringbirthdayToDisplay;
if (!initialBirthday.equals(Birthday.DEFAULT_BIRTHDAY)) {
birthdayToDisplay = generateBirthdayMsg(initialBirthday);
birthday.setText(birthdayToDisplay);
} else {
birthday.setText(initialBirthday);
}
}
/** * Returns the birthday in the format needed for display. */privateStringgenerateBirthdayMsg (StringinitialBirthday) {
HashMap<String, String> findSelectedMonth = initializeMonthHashMap();
String [] splitDates = initialBirthday.split("/", 5);
StringbirthdayToDisplay;
birthdayToDisplay = splitDates[0] + " " + findSelectedMonth.get(splitDates[1]) + " " + splitDates[2];
returnbirthdayToDisplay;
}
/** * Initialize a @HashMap for every integer to the correct month. */privateHashMap<String, String> initializeMonthHashMap () {
HashMap<String, String> monthFormat = newHashMap<>();
monthFormat.put("01", "Jan");
monthFormat.put("02", "Feb");
monthFormat.put("03", "Mar");
monthFormat.put("04", "Apr");
monthFormat.put("05", "May");
monthFormat.put("06", "Jun");
monthFormat.put("07", "Jul");
monthFormat.put("08", "Aug");
monthFormat.put("09", "Sep");
monthFormat.put("10", "Oct");
monthFormat.put("11", "Nov");
monthFormat.put("12", "Dec");
returnmonthFormat;
}
@SubscribeprivatevoidhandlePersonPanelSelectionChangedEvent(PersonPanelSelectionChangedEventevent) {
logger.info(LogsCenter.getEventHandlingLogMessage(event));
initBirthdayLabel(event.getNewSelection().person);
loadMorePersonDetails(event.getNewSelection().person);
}
}
/java/seedu/address/ui/ResultDisplay.java
@SubscribeprivatevoidhandleNewResultAvailableEvent(NewResultAvailableEventevent) {
logger.info(LogsCenter.getEventHandlingLogMessage(event));
Platform.runLater(() -> displayed.setValue(event.message));
if (event.isError) {
setStyleToIndicateCommandFailure();
} else {
setStyleToDefault();
}
}
/** * Sets the {@code ResultDisplay} style to indicate failed command. */privatevoidsetStyleToIndicateCommandFailure() {
ObservableList<String> styleClass = resultDisplay.getStyleClass();
if (styleClass.contains(ERROR_STYLE_CLASS)) {
return;
}
styleClass.add(ERROR_STYLE_CLASS);
}
/** * Sets the {@code ResultDisplay} style to use the default style. */privatevoidsetStyleToDefault() {
resultDisplay.getStyleClass().remove(ERROR_STYLE_CLASS);
}
}
/java/seedu/address/ui/AnchorPaneNode.java
/** * Create an anchor pane that stores additional data. */publicclassAnchorPaneNodeextendsAnchorPane {
privateLocalDatedate;
/** * Create a anchor pane node. Date is not assigned in the constructor. * @param children children of the anchor pane */publicAnchorPaneNode(Node... children) {
super(children);
}
publicLocalDategetDate() {
returndate;
}
publicvoidsetDate (LocalDatedate) {
this.date = date;
}
}
/java/seedu/address/ui/CalendarView.java
/** * The UI Component of the Calendar shown. */publicclassCalendarView {
privatefinalLoggerlogger = LogsCenter.getLogger(CommandBox.class);
privateArrayList<AnchorPaneNode> allCalendarDays = newArrayList<>(35);
privateVBoxview;
privateTextcalendarTitle;
privateYearMonthcurrentYearMonth;
privateObservableList<ReadOnlyPerson> contactList;
privateLogiclogic;
/** * Create a calendar view * @param yearMonth year month to create the calendar from */publicCalendarView(YearMonthyearMonth, ObservableList<ReadOnlyPerson> contactList, Logiclogic) {
this.currentYearMonth = yearMonth;
this.contactList = contactList;
this.logic = logic;
// Create the calendar grid paneGridPanecalendar = newGridPane();
calendar.setPrefSize(600, 400);
// Create rows and columns with anchor panes for the calendarfor (inti = 0; i < 5; i++) {
for (intj = 0; j < 7; j++) {
AnchorPaneNodeap = newAnchorPaneNode();
ap.setPrefSize(200, 200);
calendar.add(ap, j, i);
allCalendarDays.add(ap);
//ap.getStyleClass().add("calendar-color"); does not work yet
}
}
// Days of the week labelsText[] dayNames = newText[]{
newText("Sun"), newText("Mon"), newText("Tue"), newText("Wed"),
newText("Thu"), newText("Fri"), newText("Sat")
};
GridPanedayLabels = newGridPane();
dayLabels.setPrefWidth(600);
Integercol = 0;
for (Texttxt : dayNames) {
txt.setFill(Color.GHOSTWHITE);
AnchorPaneap = newAnchorPane();
ap.setPrefSize(200, 10);
ap.setBottomAnchor(txt, 5.0);
ap.getChildren().add(txt);
dayLabels.add(ap, col++, 0);
}
// Create calendarTitle and buttons to change current monthcalendarTitle = newText();
calendarTitle.setFill(Color.GHOSTWHITE);
ButtonpreviousMonth = newButton("<");
previousMonth.setOnAction(e -> previousMonth());
ButtonnextMonth = newButton(">");
nextMonth.setOnAction(e -> nextMonth());
HBoxtitleBar = newHBox(previousMonth, calendarTitle, nextMonth);
HBox.setMargin(calendarTitle, newInsets(0, 15, 15, 15));
titleBar.setSpacing(10);
titleBar.setAlignment(Pos.BASELINE_CENTER);
// Populate calendar with the appropriate day numberspopulateCalendar(currentYearMonth);
// Create the calendar viewview = newVBox(titleBar, dayLabels, calendar);
VBox.setMargin(titleBar, newInsets(8, 0, 0, 0)); //GOOD TO SET MARGINS, CAN CHANGE THE VALUE
}
/** * Set the days of the calendar to correspond to the appropriate date * @param yearMonth year and month of month to render */publicvoidpopulateCalendar(YearMonthyearMonth) {
// Get the date we want to start with on the calendarLocalDatecalendarDate = LocalDate.of(yearMonth.getYear(), yearMonth.getMonthValue(), 1);
// Dial back the day until it is SUNDAY (unless the month starts on a sunday)while (!calendarDate.getDayOfWeek().toString().equals("SUNDAY")) {
calendarDate = calendarDate.minusDays(1);
}
// Populate the calendar with day numbersfor (AnchorPaneNodeap : allCalendarDays) {
if (ap.getChildren().size() != 0) {
ap.getChildren().remove(0);
}
Texttxt = newText(String.valueOf(calendarDate.getDayOfMonth()));
txt.setFill(Color.GHOSTWHITE);
ap.setDate(calendarDate);
ap.setStyle("calendar-color");
ap.setTopAnchor(txt, 5.0);
ap.setLeftAnchor(txt, 5.0);
//populating birthday of contacts to the calendarStringdateValue = correctDayFormat(calendarDate.getDayOfMonth() + "") + "/"
+ correctMonthFormat(calendarDate.getMonthValue() + "");
StringbirthdayValue = Birthday.DEFAULT_BIRTHDAY;
BooleanbirthdayExist = false;
for (ReadOnlyPersonperson : contactList) {
if (!person.getBirthday().equals(Birthday.DEFAULT_BIRTHDAY)) {
birthdayValue = person.getBirthday().toString();
birthdayExist = true;
}
if (birthdayExist) {
if (dateValue.equals(birthdayValue.substring(0, 5))) {
ap.getChildren();
ap.setStyle("-fx-background-color: #CD5C5C");
ap.setAccessibleText(person.getName().toString());
}
ap.setOnMouseClicked(event -> {
StringfindCommandText = FindCommand.COMMAND_WORDVAR_1 + " " + ap.getAccessibleText();
try {
CommandResultcommandResult = logic.execute(findCommandText);
logger.info("Result: " + commandResult.feedbackToUser);
} catch (CommandException | ParseExceptione) {
logger.info("Invalid command: " + findCommandText);
}
});
}
}
ap.getChildren().add(txt);
calendarDate = calendarDate.plusDays(1);
}
// Change the title of the calendarcalendarTitle.setText(yearMonth.getMonth().toString() + " " + String.valueOf(yearMonth.getYear()));
}
/** * Update CalendarView when a new filter list is created. */publicvoidpopulateUpdatedCalendar (ObservableList<ReadOnlyPerson> contactList) {
this.contactList = contactList;
populateCalendar(currentYearMonth);
}
/** * Move the month back by one. Repopulate the calendar with the correct dates. */publicvoidpreviousMonth() {
currentYearMonth = currentYearMonth.minusMonths(1);
populateCalendar(currentYearMonth);
}
/** * Move the month forward by one. Repopulate the calendar with the correct dates. */publicvoidnextMonth() {
currentYearMonth = currentYearMonth.plusMonths(1);
populateCalendar(currentYearMonth);
}
publicVBoxgetView() {
returnview;
}
/** * Returns the correct format of the day in String format */privateStringcorrectDayFormat(Stringday) {
if (day.length() == 1) {
return"0" + day;
}
returnday;
}
/** * Returns the correct format of the month in String format */privateStringcorrectMonthFormat(Stringmonth) {
if (month.length() == 1) {
return"0" + month;
}
returnmonth;
}
}