Skip to content

Commit

Permalink
Implemented Tooltip override
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey_wang committed Jan 31, 2017
1 parent 458c9e6 commit 17655f9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/WHS_planner/Calendar/Calendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ void saveCalendar() {
for (Task currentTask : currentTaskArrayUnparsed) {

if (currentTask.doesExist()) {
System.out.println("Does save!");
String currentTaskTitle = currentTask.Title;
String currentTaskClass = currentTask.Class;

Expand Down
33 changes: 33 additions & 0 deletions src/main/java/WHS_planner/UI/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
import javax.swing.*;
import java.io.File;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.stream.Stream;

class Home extends Pane {

Expand Down Expand Up @@ -126,6 +130,8 @@ class Home extends Pane {
} else{
tooltip.setText("Time left: \n" + timeLeft() + " min");
}

checkForSpecialDayTooltip(tooltip);
});

//Timer updates (60 sec)
Expand All @@ -152,6 +158,8 @@ class Home extends Pane {
} else {
tooltip.setText("Time left: \n" + timeLeft() + " min");
}

checkForSpecialDayTooltip(tooltip);
// VBox parent = (VBox)progressBar.getParent();
// progressBar.setPrefWidth(parent.getWidth());
}));
Expand Down Expand Up @@ -182,6 +190,9 @@ class Home extends Pane {
} else {
tooltip.setText("Time left: \n" + timeLeft() + " min");
}

checkForSpecialDayTooltip(tooltip);

// VBox parent = (VBox)progressBar.getParent();
// progressBar.setPrefWidth(parent.getWidth());
}));
Expand Down Expand Up @@ -351,4 +362,26 @@ private int parseDate(String date) {
min += (hr * 60);
return min;
}

private void checkForSpecialDayTooltip(Tooltip temp){

Calendar now = Calendar.getInstance();

ArrayList<String> bellTimesFile = new ArrayList<>();
try (Stream<String> stream = Files.lines(Paths.get("Documents" + File.separator + "BellTimes.txt"))) {
stream.forEachOrdered(bellTimesFile::add);
}catch (Exception e){
e.printStackTrace();
}

try {
if(bellTimesFile.size()>5) {
if (now.get(Calendar.MONTH) == Integer.parseInt(bellTimesFile.get(0)) - 1 && now.get(Calendar.DAY_OF_MONTH) == Integer.parseInt(bellTimesFile.get(1)) && now.get(Calendar.YEAR) == Integer.parseInt(bellTimesFile.get(2))) {
temp.setText("Today is a special schedule, check 'Bell Schedule' for the updated info!");
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/WHS_planner/UI/MainPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private void initiateDropDown(Button bigButton) {
info.getChildren().add(new Label("Created in HACS under the guidance of Mr.Hopps!\n "));

info.getChildren().add(versionLabel);
info.getChildren().add(new Label("1.1.0\n "));
info.getChildren().add(new Label("1.0.2\n "));
info.getChildren().add(peopleLabel);
String[] names = new String[]{
"Tyler Brient - UI Master, Bug Squasher",
Expand Down

0 comments on commit 17655f9

Please sign in to comment.