Skip to content

Commit d56abee

Browse files
fixedTwoErrors
1 parent 3fc0f07 commit d56abee

File tree

3 files changed

+31
-34
lines changed

3 files changed

+31
-34
lines changed

bin/comp110/Controller.class

-195 Bytes
Binary file not shown.

src/comp110/Controller.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ public void storage_get_files_complete(boolean success, String message) {
4848
} catch (Exception e) {
4949
// tell the ui things suck
5050
this.m_ui.setSchedules(null);
51-
Platform.runLater(
52-
() -> this.m_ui.displayMessage("Controller::storage_get_files_complete(): " + e.toString()));
51+
//Only want one error message
52+
/*Platform.runLater(
53+
() -> this.m_ui.displayMessage("Controller::storage_get_files_complete(): " + e.toString()));*/
5354
}
5455
}
5556

src/ui/PerformSwapStage.java

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -221,47 +221,47 @@ private void performSwap(ActionEvent event) {
221221
swapSchedule2.getWeek().getShift(swapDay2, swapHour2).add(swapEmployee1);
222222

223223
// tell controller to push changes
224-
_controller.uiRequestChangeSchedule(_ui.getSchedules(), "SWAPPED: " + swapSchedule1.getDatesValid() + " "+ swapEmployee1.getName() + " "
225-
+ Week.dayString(swapDay1) + " " + ((swapHour1 % 12) == 0 ? 12 : (swapHour1 % 12)) + " -- "
226-
+ (((swapHour1 + 1) % 12) == 0 ? 12 : ((swapHour1 + 1) % 12)) + " with " + swapSchedule2.getDatesValid() + " " + swapEmployee2.getName() + " "
227-
+ Week.dayString(swapDay2) + " " + ((swapHour2 % 12) == 0 ? 12 : (swapHour2 % 12)) + " -- "
228-
+ (((swapHour2 + 1) % 12) == 0 ? 12 : ((swapHour2 + 1) % 12)));
224+
_controller.uiRequestChangeSchedule(_ui.getSchedules(),
225+
"SWAPPED: " + swapSchedule1.getDatesValid() + " " + swapEmployee1.getName() + " "
226+
+ Week.dayString(swapDay1) + " " + ((swapHour1 % 12) == 0 ? 12 : (swapHour1 % 12)) + " -- "
227+
+ (((swapHour1 + 1) % 12) == 0 ? 12 : ((swapHour1 + 1) % 12)) + " with "
228+
+ swapSchedule2.getDatesValid() + " " + swapEmployee2.getName() + " " + Week.dayString(swapDay2)
229+
+ " " + ((swapHour2 % 12) == 0 ? 12 : (swapHour2 % 12)) + " -- "
230+
+ (((swapHour2 + 1) % 12) == 0 ? 12 : ((swapHour2 + 1) % 12)));
229231
}
230232

231233
private void setupForDrop() {
232234
_addOrDropButton.setDisable(true);
233235
_addOrDropContainer.getChildren().clear();
234-
236+
235237
List<String> scheduleListNames = new ArrayList<String>();
236-
for (Schedule s :_ui.getSchedules()) {
238+
for (Schedule s : _ui.getSchedules()) {
237239
scheduleListNames.add(s.getDatesValid());
238240
}
239-
241+
240242
javafx.collections.ObservableList<String> scheduleList = FXCollections.observableArrayList(scheduleListNames);
241243
ListView<String> scheduleListView = new ListView<String>(scheduleList);
242-
//scheduleListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
243-
244+
// scheduleListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
245+
244246
ListView<String> dayListView = new ListView<String>();
245-
247+
246248
scheduleListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
247249
_dropSchedule = _ui.getScheduleByName(newValue);
248250
javafx.collections.ObservableList<String> days = FXCollections
249251
.observableArrayList(_ui.getDaysList(_dropSchedule));
250252
dayListView.setItems(days);
251-
//dayListView.prefHeightProperty().bind(Bindings.size(days).multiply(24));
253+
// dayListView.prefHeightProperty().bind(Bindings.size(days).multiply(24));
252254
_employeeToAddOrDrop = null;
253255
_addOrDropButton.setDisable(true);
254256
});
255257

256-
257-
258258
ListView<String> hourListView = new ListView<String>();
259259
dayListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
260260
_dropDay = Week.dayInt(newValue);
261261
javafx.collections.ObservableList<String> hours = FXCollections
262262
.observableArrayList(_ui.getHoursList(_dropSchedule, newValue));
263263
hourListView.setItems(hours);
264-
//hourListView.prefHeightProperty().bind(Bindings.size(hours).multiply(24));
264+
// hourListView.prefHeightProperty().bind(Bindings.size(hours).multiply(24));
265265
_employeeToAddOrDrop = null;
266266
_addOrDropButton.setDisable(true);
267267
});
@@ -282,7 +282,7 @@ private void setupForDrop() {
282282
}
283283
javafx.collections.ObservableList<Label> people = FXCollections.observableArrayList(scheduledEmployees);
284284
personListView.setItems(people);
285-
//personListView.prefHeightProperty().bind(Bindings.size(people).multiply(24));
285+
// personListView.prefHeightProperty().bind(Bindings.size(people).multiply(24));
286286
_employeeToAddOrDrop = null;
287287
_addOrDropButton.setDisable(true);
288288
});
@@ -299,31 +299,28 @@ private void setupForDrop() {
299299
dayListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
300300
hourListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
301301
personListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
302-
302+
303303
_addOrDropContainer.getChildren().add(scheduleListView);
304304
_addOrDropContainer.getChildren().add(dayListView);
305305
_addOrDropContainer.getChildren().add(hourListView);
306306
_addOrDropContainer.getChildren().add(personListView);
307307

308-
309-
310308
}
311309

312310
private void setupForAdd() {
313311
_addOrDropButton.setDisable(true);
314312
_addOrDropContainer.getChildren().clear();
315-
313+
316314
List<String> scheduleListNames = new ArrayList<String>();
317-
for (Schedule s :_ui.getSchedules()) {
315+
for (Schedule s : _ui.getSchedules()) {
318316
scheduleListNames.add(s.getDatesValid());
319317
}
320-
318+
321319
javafx.collections.ObservableList<String> scheduleList = FXCollections.observableArrayList(scheduleListNames);
322320
ListView<String> scheduleListView = new ListView<String>(scheduleList);
323-
321+
324322
ListView<String> dayListView = new ListView<String>();
325323

326-
327324
scheduleListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
328325
_addSchedule = _ui.getScheduleByName(newValue);
329326
javafx.collections.ObservableList<String> days = FXCollections
@@ -336,7 +333,6 @@ private void setupForAdd() {
336333

337334
ListView<String> hourListView = new ListView<String>();
338335

339-
340336
dayListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
341337
_addDay = Week.dayInt(newValue);
342338
javafx.collections.ObservableList<String> hours = FXCollections
@@ -348,7 +344,7 @@ private void setupForAdd() {
348344
});
349345

350346
ListView<Label> personListView = new ListView<Label>();
351-
347+
352348
hourListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
353349
_addHour = Integer.parseInt(newValue.split(" ")[0]);
354350
if (_addHour < 9) {
@@ -403,7 +399,7 @@ private void setupForAdd() {
403399
dayListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
404400
hourListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
405401
personListView.prefHeightProperty().bind(Bindings.size(scheduleList).multiply(24));
406-
402+
407403
_addOrDropContainer.getChildren().add(scheduleListView);
408404
_addOrDropContainer.getChildren().add(dayListView);
409405
_addOrDropContainer.getChildren().add(hourListView);
@@ -421,13 +417,13 @@ private void addDropButtonPress(ActionEvent event) {
421417
// tell controller to push changes
422418
if (_addOrDrop.equals("Add")) {
423419
_controller.uiRequestChangeSchedule(_ui.getSchedules(),
424-
_addOrDrop.toUpperCase() + ": " + _addSchedule.getDatesValid() + " " + _employeeToAddOrDrop + " " + Week.dayString(_addDay) + " "
425-
+ ((_addHour % 12) == 0 ? 12 : (_addHour % 12)) + " -- "
420+
_addOrDrop.toUpperCase() + ": " + _addSchedule.getDatesValid() + " " + _employeeToAddOrDrop + " "
421+
+ Week.dayString(_addDay) + " " + ((_addHour % 12) == 0 ? 12 : (_addHour % 12)) + " -- "
426422
+ (((_addHour + 1) % 12) == 0 ? 12 : ((_addHour + 1) % 12)));
427-
} else { //it's a drop
423+
} else { // it's a drop
428424
_controller.uiRequestChangeSchedule(_ui.getSchedules(),
429-
_addOrDrop.toUpperCase() + ": " + _dropSchedule.getDatesValid() + " " + _employeeToAddOrDrop + " " + Week.dayString(_dropDay) + " "
430-
+ ((_dropHour % 12) == 0 ? 12 : (_dropHour % 12)) + " -- "
425+
_addOrDrop.toUpperCase() + ": " + _dropSchedule.getDatesValid() + " " + _employeeToAddOrDrop + " "
426+
+ Week.dayString(_dropDay) + " " + ((_dropHour % 12) == 0 ? 12 : (_dropHour % 12)) + " -- "
431427
+ (((_dropHour + 1) % 12) == 0 ? 12 : ((_dropHour + 1) % 12)));
432428
}
433429
}

0 commit comments

Comments
 (0)