@@ -221,47 +221,47 @@ private void performSwap(ActionEvent event) {
221
221
swapSchedule2 .getWeek ().getShift (swapDay2 , swapHour2 ).add (swapEmployee1 );
222
222
223
223
// 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 )));
229
231
}
230
232
231
233
private void setupForDrop () {
232
234
_addOrDropButton .setDisable (true );
233
235
_addOrDropContainer .getChildren ().clear ();
234
-
236
+
235
237
List <String > scheduleListNames = new ArrayList <String >();
236
- for (Schedule s :_ui .getSchedules ()) {
238
+ for (Schedule s : _ui .getSchedules ()) {
237
239
scheduleListNames .add (s .getDatesValid ());
238
240
}
239
-
241
+
240
242
javafx .collections .ObservableList <String > scheduleList = FXCollections .observableArrayList (scheduleListNames );
241
243
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
+
244
246
ListView <String > dayListView = new ListView <String >();
245
-
247
+
246
248
scheduleListView .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> {
247
249
_dropSchedule = _ui .getScheduleByName (newValue );
248
250
javafx .collections .ObservableList <String > days = FXCollections
249
251
.observableArrayList (_ui .getDaysList (_dropSchedule ));
250
252
dayListView .setItems (days );
251
- //dayListView.prefHeightProperty().bind(Bindings.size(days).multiply(24));
253
+ // dayListView.prefHeightProperty().bind(Bindings.size(days).multiply(24));
252
254
_employeeToAddOrDrop = null ;
253
255
_addOrDropButton .setDisable (true );
254
256
});
255
257
256
-
257
-
258
258
ListView <String > hourListView = new ListView <String >();
259
259
dayListView .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> {
260
260
_dropDay = Week .dayInt (newValue );
261
261
javafx .collections .ObservableList <String > hours = FXCollections
262
262
.observableArrayList (_ui .getHoursList (_dropSchedule , newValue ));
263
263
hourListView .setItems (hours );
264
- //hourListView.prefHeightProperty().bind(Bindings.size(hours).multiply(24));
264
+ // hourListView.prefHeightProperty().bind(Bindings.size(hours).multiply(24));
265
265
_employeeToAddOrDrop = null ;
266
266
_addOrDropButton .setDisable (true );
267
267
});
@@ -282,7 +282,7 @@ private void setupForDrop() {
282
282
}
283
283
javafx .collections .ObservableList <Label > people = FXCollections .observableArrayList (scheduledEmployees );
284
284
personListView .setItems (people );
285
- //personListView.prefHeightProperty().bind(Bindings.size(people).multiply(24));
285
+ // personListView.prefHeightProperty().bind(Bindings.size(people).multiply(24));
286
286
_employeeToAddOrDrop = null ;
287
287
_addOrDropButton .setDisable (true );
288
288
});
@@ -299,31 +299,28 @@ private void setupForDrop() {
299
299
dayListView .prefHeightProperty ().bind (Bindings .size (scheduleList ).multiply (24 ));
300
300
hourListView .prefHeightProperty ().bind (Bindings .size (scheduleList ).multiply (24 ));
301
301
personListView .prefHeightProperty ().bind (Bindings .size (scheduleList ).multiply (24 ));
302
-
302
+
303
303
_addOrDropContainer .getChildren ().add (scheduleListView );
304
304
_addOrDropContainer .getChildren ().add (dayListView );
305
305
_addOrDropContainer .getChildren ().add (hourListView );
306
306
_addOrDropContainer .getChildren ().add (personListView );
307
307
308
-
309
-
310
308
}
311
309
312
310
private void setupForAdd () {
313
311
_addOrDropButton .setDisable (true );
314
312
_addOrDropContainer .getChildren ().clear ();
315
-
313
+
316
314
List <String > scheduleListNames = new ArrayList <String >();
317
- for (Schedule s :_ui .getSchedules ()) {
315
+ for (Schedule s : _ui .getSchedules ()) {
318
316
scheduleListNames .add (s .getDatesValid ());
319
317
}
320
-
318
+
321
319
javafx .collections .ObservableList <String > scheduleList = FXCollections .observableArrayList (scheduleListNames );
322
320
ListView <String > scheduleListView = new ListView <String >(scheduleList );
323
-
321
+
324
322
ListView <String > dayListView = new ListView <String >();
325
323
326
-
327
324
scheduleListView .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> {
328
325
_addSchedule = _ui .getScheduleByName (newValue );
329
326
javafx .collections .ObservableList <String > days = FXCollections
@@ -336,7 +333,6 @@ private void setupForAdd() {
336
333
337
334
ListView <String > hourListView = new ListView <String >();
338
335
339
-
340
336
dayListView .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> {
341
337
_addDay = Week .dayInt (newValue );
342
338
javafx .collections .ObservableList <String > hours = FXCollections
@@ -348,7 +344,7 @@ private void setupForAdd() {
348
344
});
349
345
350
346
ListView <Label > personListView = new ListView <Label >();
351
-
347
+
352
348
hourListView .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> {
353
349
_addHour = Integer .parseInt (newValue .split (" " )[0 ]);
354
350
if (_addHour < 9 ) {
@@ -403,7 +399,7 @@ private void setupForAdd() {
403
399
dayListView .prefHeightProperty ().bind (Bindings .size (scheduleList ).multiply (24 ));
404
400
hourListView .prefHeightProperty ().bind (Bindings .size (scheduleList ).multiply (24 ));
405
401
personListView .prefHeightProperty ().bind (Bindings .size (scheduleList ).multiply (24 ));
406
-
402
+
407
403
_addOrDropContainer .getChildren ().add (scheduleListView );
408
404
_addOrDropContainer .getChildren ().add (dayListView );
409
405
_addOrDropContainer .getChildren ().add (hourListView );
@@ -421,13 +417,13 @@ private void addDropButtonPress(ActionEvent event) {
421
417
// tell controller to push changes
422
418
if (_addOrDrop .equals ("Add" )) {
423
419
_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 )) + " -- "
426
422
+ (((_addHour + 1 ) % 12 ) == 0 ? 12 : ((_addHour + 1 ) % 12 )));
427
- } else { //it's a drop
423
+ } else { // it's a drop
428
424
_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 )) + " -- "
431
427
+ (((_dropHour + 1 ) % 12 ) == 0 ? 12 : ((_dropHour + 1 ) % 12 )));
432
428
}
433
429
}
0 commit comments