Skip to content

Commit 6e21c51

Browse files
committed
Update test, rename FrontTab to GamesTab
1 parent eb07ab1 commit 6e21c51

File tree

9 files changed

+52
-26
lines changed

9 files changed

+52
-26
lines changed

src/main/java/nsusbloader/Controllers/FrontController.java renamed to src/main/java/nsusbloader/Controllers/GamesController.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import java.util.List;
4545
import java.util.ResourceBundle;
4646

47-
public class FrontController implements Initializable {
47+
public class GamesController implements Initializable {
4848
@FXML
4949
private AnchorPane usbNetPane;
5050

@@ -353,6 +353,7 @@ public void notifyThreadStarted(boolean isActive, EModule type){
353353
usbNetPane.setDisable(isActive);
354354
return;
355355
}
356+
356357
selectNspBtn.setDisable(isActive);
357358
selectSplitNspBtn.setDisable(isActive);
358359
btnUpStopImage.getStyleClass().clear();
@@ -362,16 +363,17 @@ public void notifyThreadStarted(boolean isActive, EModule type){
362363

363364
uploadStopBtn.setOnAction(e-> stopBtnAction());
364365
uploadStopBtn.setText(resourceBundle.getString("btn_Stop"));
365-
uploadStopBtn.getStyleClass().clear();
366+
uploadStopBtn.getStyleClass().remove("buttonUp");
366367
uploadStopBtn.getStyleClass().add("buttonStop");
367-
return;
368368
}
369-
btnUpStopImage.getStyleClass().add("regionUpload");
369+
else {
370+
btnUpStopImage.getStyleClass().add("regionUpload");
370371

371-
uploadStopBtn.setOnAction(e-> uploadBtnAction());
372-
uploadStopBtn.setText(resourceBundle.getString("btn_Upload"));
373-
uploadStopBtn.getStyleClass().clear();
374-
uploadStopBtn.getStyleClass().add("buttonUp");
372+
uploadStopBtn.setOnAction(e-> uploadBtnAction());
373+
uploadStopBtn.setText(resourceBundle.getString("btn_Upload"));
374+
uploadStopBtn.getStyleClass().remove("buttonStop");
375+
uploadStopBtn.getStyleClass().add("buttonUp");
376+
}
375377
}
376378
/**
377379
* Crunch. This function called from NSTableViewController

src/main/java/nsusbloader/Controllers/NSLMainController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class NSLMainController implements Initializable {
4141
public ProgressBar progressBar; // Accessible from Mediator
4242

4343
@FXML
44-
public FrontController FrontTabController; // Accessible from Mediator | todo: incapsulate
44+
public GamesController GamesTabController; // Accessible from Mediator | todo: incapsulate
4545
@FXML
4646
private SettingsController SettingsTabController;
4747
@FXML
@@ -103,8 +103,8 @@ public SettingsController getSettingsCtrlr(){
103103
return SettingsTabController;
104104
}
105105

106-
public FrontController getFrontCtrlr(){
107-
return FrontTabController;
106+
public GamesController getGamesCtrlr(){
107+
return GamesTabController;
108108
}
109109

110110
public SplitMergeController getSmCtrlr(){
@@ -118,7 +118,7 @@ public SplitMergeController getSmCtrlr(){
118118
* Save preferences before exit
119119
* */
120120
public void exit(){
121-
FrontTabController.updatePreferencesOnExit();
121+
GamesTabController.updatePreferencesOnExit();
122122
SettingsTabController.updatePreferencesOnExit();
123123
SplitMergeTabController.updatePreferencesOnExit(); // NOTE: This shit above should be re-written to similar pattern
124124
RcmTabController.updatePreferencesOnExit();

src/main/java/nsusbloader/Controllers/NSTableViewController.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
import javafx.collections.ObservableList;
2525
import javafx.fxml.FXML;
2626
import javafx.fxml.Initializable;
27-
import javafx.scene.SnapshotParameters;
2827
import javafx.scene.control.*;
2928
import javafx.scene.control.cell.CheckBoxTableCell;
3029
import javafx.scene.control.cell.PropertyValueFactory;
3130
import javafx.scene.input.*;
32-
import javafx.scene.paint.Paint;
3331
import nsusbloader.MediatorControl;
3432
import nsusbloader.NSLDataTypes.EFileStatus;
3533

@@ -59,7 +57,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
5957
if (keyEvent.getCode() == KeyCode.DELETE && !MediatorControl.getInstance().getTransferActive()) {
6058
rowsObsLst.removeAll(table.getSelectionModel().getSelectedItems());
6159
if (rowsObsLst.isEmpty())
62-
MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(true); // TODO: change to something better
60+
MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(true); // TODO: change to something better
6361
table.refresh();
6462
} else if (keyEvent.getCode() == KeyCode.SPACE) {
6563
for (NSLRowModel item : table.getSelectionModel().getSelectedItems()) {
@@ -177,13 +175,13 @@ protected void updateItem(Long length, boolean empty) {
177175
deleteMenuItem.setOnAction(actionEvent -> {
178176
rowsObsLst.remove(row.getItem());
179177
if (rowsObsLst.isEmpty())
180-
MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(true); // TODO: change to something better
178+
MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(true); // TODO: change to something better
181179
table.refresh();
182180
});
183181
MenuItem deleteAllMenuItem = new MenuItem(resourceBundle.getString("tab1_table_contextMenu_Btn_DeleteAll"));
184182
deleteAllMenuItem.setOnAction(actionEvent -> {
185183
rowsObsLst.clear();
186-
MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(true); // TODO: change to something better
184+
MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(true); // TODO: change to something better
187185
table.refresh();
188186
});
189187
contextMenu.getItems().addAll(deleteMenuItem, deleteAllMenuItem);
@@ -228,7 +226,7 @@ public void setFile(File file){
228226
}
229227
else {
230228
rowsObsLst.add(new NSLRowModel(file, true));
231-
MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(false); // TODO: change to something better
229+
MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(false); // TODO: change to something better
232230
}
233231
table.refresh();
234232
}
@@ -248,7 +246,7 @@ public void setFiles(List<File> newFiles){
248246
else {
249247
for (File file: newFiles)
250248
rowsObsLst.add(new NSLRowModel(file, true));
251-
MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(false); // TODO: change to something better
249+
MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(false); // TODO: change to something better
252250
}
253251
//rowsObsLst.get(0).setMarkForUpload(true);
254252
table.refresh();

src/main/java/nsusbloader/MediatorControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void setController(NSLMainController controller){
4141

4242
public synchronized void setBgThreadActive(boolean isActive, EModule appModuleType) {
4343
isTransferActive.set(isActive);
44-
mainCtrler.getFrontCtrlr().notifyThreadStarted(isActive, appModuleType);
44+
mainCtrler.getGamesCtrlr().notifyThreadStarted(isActive, appModuleType);
4545
mainCtrler.getSmCtrlr().notifySmThreadStarted(isActive, appModuleType);
4646
mainCtrler.getRcmCtrlr().notifyThreadStarted(isActive, appModuleType);
4747
mainCtrler.getNXDTabController().notifyThreadStarted(isActive, appModuleType);

src/main/java/nsusbloader/ModelControllers/MessagesConsumer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import nsusbloader.MediatorControl;
2727
import nsusbloader.NSLDataTypes.EFileStatus;
2828
import nsusbloader.NSLDataTypes.EModule;
29-
import nsusbloader.NSLDataTypes.EMsgType;
3029

3130
import java.util.ArrayList;
3231
import java.util.HashMap;
@@ -62,7 +61,7 @@ public class MessagesConsumer extends AnimationTimer {
6261
this.progressBar = MediatorControl.getInstance().getContoller().progressBar;
6362

6463
this.statusMap = statusMap;
65-
this.tableViewController = MediatorControl.getInstance().getContoller().FrontTabController.tableFilesListController;
64+
this.tableViewController = MediatorControl.getInstance().getContoller().GamesTabController.tableFilesListController;
6665

6766
this.oneLinerStatus = oneLinerStatus;
6867

src/main/resources/FrontTab.fxml renamed to src/main/resources/GamesTab.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<?import javafx.scene.layout.VBox?>
1717
<?import javafx.scene.shape.SVGPath?>
1818

19-
<AnchorPane fx:id="usbNetPane" onDragDropped="#handleDrop" onDragOver="#handleDragOver" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="nsusbloader.Controllers.FrontController">
19+
<AnchorPane fx:id="usbNetPane" onDragDropped="#handleDrop" onDragOver="#handleDragOver" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="nsusbloader.Controllers.GamesController">
2020
<children>
2121
<VBox layoutX="10.0" layoutY="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
2222
<children>

src/main/resources/NSLMain.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Steps to roll NXDT functionality back:
2323
<tabs>
2424
<Tab closable="false">
2525
<content>
26-
<fx:include fx:id="FrontTab" source="FrontTab.fxml" VBox.vgrow="ALWAYS" />
26+
<fx:include fx:id="GamesTab" source="GamesTab.fxml" VBox.vgrow="ALWAYS" />
2727
</content>
2828
<graphic>
2929
<SVGPath content="M 19.953125 -0.00390625 C 19.945025 0.86963499 19.665113 1.3200779 19.117188 1.6679688 C 18.569261 2.0158596 17.688291 2.2107818 16.572266 2.2636719 C 14.340723 2.369428 11.22952 1.9408017 8.0175781 1.7636719 L 8.015625 1.7636719 C 5.8083004 1.6301338 3.850269 1.7145428 2.421875 2.328125 C 1.7074522 2.6350131 1.1147008 3.0945958 0.765625 3.7402344 C 0.41654922 4.3858729 0.3309909 5.1840438 0.50976562 6.0957031 L 0.515625 6.1269531 L 0.52539062 6.1582031 C 0.74516874 6.8214776 1.3043008 7.2559352 1.9550781 7.46875 C 2.6058554 7.6815648 3.3739015 7.7273729 4.2304688 7.703125 C 5.9436032 7.6546292 8.0253788 7.3082908 10.042969 7.1230469 C 12.060559 6.9378029 14.005763 6.9298258 15.349609 7.4511719 C 16.693456 7.972518 17.5 8.8951351 17.5 11 L 13.023438 11 L 10.837891 11 L 1 11 C 0.156581 11 -0.10111662 11.623241 -0.10351562 12.189453 C -0.10591562 12.759114 -0.10321863 13.218366 -0.10351562 13.919922 C -0.10353762 13.969822 -0.10345962 13.990156 -0.10351562 14.042969 C -0.10332363 14.492063 -0.10337263 14.807528 -0.10351562 15.150391 C -0.10359462 15.343113 -0.10438363 15.566512 -0.10351562 15.771484 C -0.10347763 15.861874 -0.10364063 15.971437 -0.10351562 16.064453 C -0.10316562 16.324274 -0.10337563 16.550139 -0.10351562 16.880859 C -0.10353662 16.930759 -0.10345962 16.951094 -0.10351562 17.003906 C -0.10317063 17.257044 -0.10337962 17.473987 -0.10351562 17.794922 C -0.10353762 17.844822 -0.10345962 17.863203 -0.10351562 17.916016 C -0.10380362 18.172294 -0.10461563 18.463892 -0.10351562 18.732422 C -0.10363862 18.825442 -0.10347763 18.935007 -0.10351562 19.025391 C -0.10359462 19.218111 -0.10438363 19.441511 -0.10351562 19.646484 C -0.10337262 19.98934 -0.10332563 20.306746 -0.10351562 20.755859 C -0.10353662 20.805759 -0.10345962 20.826093 -0.10351562 20.878906 C -0.10321564 21.580432 -0.10591562 22.037789 -0.10351562 22.607422 C -0.10111563 23.173608 0.156706 23.796875 1 23.796875 L 10.833984 23.796875 L 13.019531 23.796875 L 22.857422 23.796875 C 23.70084 23.796875 23.958538 23.17361 23.960938 22.607422 C 23.963338 22.037788 23.960642 21.580432 23.960938 20.878906 C 23.960959 20.829006 23.96088 20.808672 23.960938 20.755859 C 23.960749 20.306747 23.960795 19.989341 23.960938 19.646484 C 23.961015 19.453769 23.961803 19.230374 23.960938 19.025391 C 23.9609 18.935011 23.961059 18.825438 23.960938 18.732422 C 23.96059 18.472592 23.960799 18.246723 23.960938 17.916016 C 23.960959 17.866116 23.96088 17.847735 23.960938 17.794922 C 23.960642 17.093366 23.963337 16.63411 23.960938 16.064453 C 23.96106 15.971433 23.960898 15.861868 23.960938 15.771484 C 23.961015 15.578768 23.961803 15.355372 23.960938 15.150391 C 23.960797 14.807528 23.960748 14.492063 23.960938 14.042969 C 23.960959 13.993069 23.96088 13.972735 23.960938 13.919922 C 23.960642 13.218366 23.963337 12.759114 23.960938 12.189453 C 23.958538 11.623242 23.700715 11 22.857422 11 L 18.5 11 C 18.5 8.6048649 17.347496 7.152482 15.710938 6.5175781 C 14.074378 5.8826742 12.017906 5.9371971 9.9511719 6.1269531 C 7.8844382 6.3167092 5.7997949 6.6578708 4.2011719 6.703125 C 3.4018604 6.7257521 2.725744 6.6699978 2.265625 6.5195312 C 1.8171096 6.3728594 1.6083191 6.1804127 1.4941406 5.859375 C 1.3628245 5.141091 1.4300216 4.6115935 1.6445312 4.2148438 C 1.8648981 3.8072608 2.2462454 3.4910124 2.8164062 3.2460938 C 3.9567281 2.7562562 5.8156963 2.6320489 7.9570312 2.7617188 L 7.9589844 2.7617188 C 11.116926 2.9357557 14.220255 3.3773586 16.619141 3.2636719 C 17.818583 3.2068289 18.856796 3.0180713 19.654297 2.5117188 C 20.451798 2.0053661 20.942623 1.130365 20.953125 0.00390625 L 19.953125 -0.00390625 z M 4.4277344 13.271484 L 7 13.271484 L 7 16 L 9.71875 16 L 9.71875 18.5625 L 7 18.5625 L 7 21.291016 L 4.4277344 21.291016 L 4.4277344 18.5625 L 1.7089844 18.5625 L 1.7089844 16 L 4.4277344 16 L 4.4277344 13.271484 z M 20 14 A 1.9161212 1.9161212 0 0 1 21.916016 15.916016 A 1.9161212 1.9161212 0 0 1 20 17.832031 A 1.9161212 1.9161212 0 0 1 18.083984 15.916016 A 1.9161212 1.9161212 0 0 1 20 14 z M 16.421875 17.667969 A 1.9168563 1.9168563 0 0 1 18.337891 19.583984 A 1.9168563 1.9168563 0 0 1 16.421875 21.5 A 1.9168563 1.9168563 0 0 1 14.505859 19.583984 A 1.9168563 1.9168563 0 0 1 16.421875 17.667969 z " />
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package nsusbloader.com.usb;
2+
3+
import nsusbloader.ModelControllers.ILogPrinter;
4+
import nsusbloader.NSLDataTypes.EFileStatus;
5+
import nsusbloader.NSLDataTypes.EMsgType;
6+
7+
import java.io.File;
8+
import java.util.HashMap;
9+
10+
public class NoLogPrinter implements ILogPrinter {
11+
@Override
12+
public void print(String message, EMsgType type) { }
13+
14+
@Override
15+
public void updateProgress(Double value) { }
16+
17+
@Override
18+
public void update(HashMap<String, File> nspMap, EFileStatus status) { }
19+
20+
@Override
21+
public void update(File file, EFileStatus status) { }
22+
23+
@Override
24+
public void updateOneLinerStatus(boolean status) { }
25+
26+
@Override
27+
public void close() { }
28+
}

src/test/java/nsusbloader/com/usb/TransferModuleTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import nsusbloader.ModelControllers.CancellableRunnable;
44
import nsusbloader.ModelControllers.ILogPrinter;
5-
import nsusbloader.ModelControllers.LogPrinterCli;
65
import org.junit.jupiter.api.BeforeEach;
76
import org.junit.jupiter.api.DisplayName;
87
import org.junit.jupiter.api.Test;
@@ -81,7 +80,7 @@ void createFiles() throws Exception{
8180
filesMap.put(splitFileName10, splitFile10);
8281
filesMap.put(splitFileName11, splitFile11);
8382

84-
ILogPrinter printer = new LogPrinterCli();
83+
ILogPrinter printer = new NoLogPrinter();
8584
this.transferModule = new TransferModuleImplementation((DeviceHandle)null, filesMap, (CancellableRunnable)null, printer);
8685
}
8786

0 commit comments

Comments
 (0)