Skip to content

Commit

Permalink
Removed temporary console logs from game import code.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanceewing committed Apr 10, 2024
1 parent c1c4630 commit c6af537
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions html/src/main/java/com/agifans/agile/gwt/GwtDialogHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ public void openFileDialog(AppConfigItem appConfigItem, String fileType, String
showHtmlOpenFileDialog(fileType, new GwtOpenFileResultsHandler() {
@Override
public void onFileResultsReady(GwtOpenFileResult[] openFileResultArray) {
if (openFileResultArray.length > 0) {
logToJSConsole("Game files are now being imported into AGILE...");
}

boolean hasVolFile = false;
boolean hasDirFile = false;
String directoryName = null;
Expand Down Expand Up @@ -274,8 +270,6 @@ private boolean isGameFile(String filename) {
}

private final native void showHtmlOpenFileDialog(String type, GwtOpenFileResultsHandler resultsHandler)/*-{
console.log('About to create input element of type file...');
var fileInputElem = document.createElement('input');
fileInputElem.type = "file";
Expand All @@ -291,34 +285,26 @@ private final native void showHtmlOpenFileDialog(String type, GwtOpenFileResults
fileInputElem.multiple = true;
}
console.log('Finished creating input element of type file');
document.body.appendChild(fileInputElem);
// The change event occurs after a file is chosen.
fileInputElem.addEventListener("change", function(event) {
document.body.removeChild(fileInputElem);
if (this.files.length === 0) {
console.log('No files selected for import');
// No file was selected, so nothing more to do.
[email protected]::onFileResultsReady([Lcom/agifans/agile/gwt/GwtOpenFileResult;)([]);
}
else {
console.log('File(s) were selected for import. Reading them now...');
// There can be multiple files, so we need to fetch all of them, and
// only when all have finished loading do we invoke the callback with
// content of the files.
Promise.all([].map.call(this.files, function (file) {
console.log('Starting to read in file ' + file.name);
return new Promise(function (resolve, reject) {
var reader = new FileReader();
// NOTE 1: loadend called regards of whether it was successful or not.
// NOTE 2: file has .name, .size and .lastModified fields.
reader.addEventListener("loadend", function (event) {
console.log('Finished reading in file ' + file.name);
resolve({
fileName: file.name,
filePath: file.webkitRelativePath? file.webkitRelativePath : '',
Expand All @@ -328,8 +314,6 @@ private final native void showHtmlOpenFileDialog(String type, GwtOpenFileResults
reader.readAsArrayBuffer(file);
});
})).then(function (results) {
console.log('Finished reading in all selected files.');
// The results param is an array of result objects
[email protected]::onFileResultsReady([Lcom/agifans/agile/gwt/GwtOpenFileResult;)(results);
});
Expand All @@ -339,16 +323,12 @@ private final native void showHtmlOpenFileDialog(String type, GwtOpenFileResults
fileInputElem.addEventListener("cancel", function(event) {
document.body.removeChild(fileInputElem);
console.log('Open file dialog was cancelled.');
// No file was selected, so nothing more to do.
[email protected]::onFileResultsReady([Lcom/agifans/agile/gwt/GwtOpenFileResult;)([]);
});
// Trigger the display of the open file dialog.
fileInputElem.click();
console.log('File input element has been clicked.');
}-*/;

@Override
Expand Down

0 comments on commit c6af537

Please sign in to comment.