Skip to content

Commit

Permalink
Transfered GameLibrary Handlers from InputHandler to GameLibrary_Hand…
Browse files Browse the repository at this point in the history
…ler #7
  • Loading branch information
sguergachi committed Oct 6, 2012
1 parent 2d9ce0f commit 188b4fe
Show file tree
Hide file tree
Showing 10 changed files with 1,712 additions and 1,669 deletions.
Binary file modified lib/AuroraDB.h2.db
Binary file not shown.
68 changes: 68 additions & 0 deletions lib/AuroraDB.trace.db
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,71 @@ org.h2.jdbc.JdbcSQLException: No data is available [2000-167]
org.h2.jdbc.JdbcSQLException: No data is available [2000-167]
09-17 23:48:21 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: No data is available [2000-167]
10-03 23:32:49 jdbc[3]: exception
org.h2.jdbc.JdbcSQLException: Statement was canceled or the session timed out; SQL statement:
SELECT FILE_NAME FROM AuroraTable WHERE GAME_NAME LIKE '%border%' [57014-167]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.message.DbException.get(DbException.java:135)
at org.h2.engine.Session.checkCanceled(Session.java:884)
at org.h2.command.Prepared.checkCanceled(Prepared.java:274)
at org.h2.command.Prepared.setCurrentRowNumber(Prepared.java:332)
at org.h2.command.dml.Select.queryFlat(Select.java:514)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:618)
at org.h2.command.dml.Query.query(Query.java:307)
at org.h2.command.dml.Query.query(Query.java:277)
at org.h2.command.dml.Query.query(Query.java:36)
at org.h2.command.CommandContainer.query(CommandContainer.java:86)
at org.h2.command.Command.executeQuery(Command.java:191)
at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:109)
at aurora.engine.V1.Logic.aSimpleDB.searchAprox(aSimpleDB.java:838)
at aurora.V1.core.GameSearch.searchGame(GameSearch.java:221)
at aurora.V1.core.GameSearch.run(GameSearch.java:305)
at java.lang.Thread.run(Thread.java:662)
10-06 13:49:52 jdbc[3]: exception
org.h2.jdbc.JdbcSQLException: Statement was canceled or the session timed out; SQL statement:
SELECT FILE_NAME FROM AuroraTable WHERE GAME_NAME LIKE '%Borderl%' [57014-167]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.message.DbException.get(DbException.java:135)
at org.h2.engine.Session.checkCanceled(Session.java:884)
at org.h2.command.Prepared.checkCanceled(Prepared.java:274)
at org.h2.command.Prepared.setCurrentRowNumber(Prepared.java:332)
at org.h2.command.dml.Select.queryFlat(Select.java:514)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:618)
at org.h2.command.dml.Query.query(Query.java:307)
at org.h2.command.dml.Query.query(Query.java:277)
at org.h2.command.dml.Query.query(Query.java:36)
at org.h2.command.CommandContainer.query(CommandContainer.java:86)
at org.h2.command.Command.executeQuery(Command.java:191)
at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:109)
at aurora.engine.V1.Logic.aSimpleDB.searchAprox(aSimpleDB.java:838)
at aurora.V1.core.GameSearch.searchGame(GameSearch.java:221)
at aurora.V1.core.GameSearch.run(GameSearch.java:305)
at java.lang.Thread.run(Thread.java:662)
10-06 13:49:52 jdbc[5]: null
org.h2.message.DbException: The connection was not closed by the application and is garbage collected [90018-167]
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.message.DbException.get(DbException.java:135)
at org.h2.jdbc.JdbcConnection.closeOld(JdbcConnection.java:174)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:121)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at aurora.engine.V1.Logic.aSimpleDB.searchAprox(aSimpleDB.java:818)
at aurora.V1.core.GameSearch.searchGame(GameSearch.java:221)
at aurora.V1.core.GameSearch.run(GameSearch.java:305)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.h2.jdbc.JdbcSQLException: The connection was not closed by the application and is garbage collected [90018-167]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
... 13 more
10-06 13:49:52 jdbc[5]: exception
org.h2.jdbc.JdbcSQLException: No data is available [2000-167]
10-06 13:49:52 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: No data is available [2000-167]
10-06 13:49:53 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: No data is available [2000-167]
2 changes: 1 addition & 1 deletion src/aurora/V1/core/AuroraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void run() {
if (ui.getOS().equals("Windows 7") || osName.equals("Windows XP") || ui.getOS().equals("Windows Vista")) {



System.out.println(game.getGamePath());
if (game.getGamePath().endsWith("exe")) {
//Get the directory
ProcessBuilder processBuild = new ProcessBuilder(game.getGamePath());
Expand Down
82 changes: 41 additions & 41 deletions src/aurora/V1/core/GridSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package aurora.V1.core;

import aurora.V1.core.screen_handler.GameLibrary_HANDLE;
import aurora.V1.core.screen_ui.GameLibrary_UI;
import aurora.engine.V1.UI.aImage;
import java.awt.BorderLayout;
Expand All @@ -38,24 +39,24 @@ public class GridSearch {
private char typed; // This is the character user types
private String AppendedName = ""; //This is the concatination of all characters
private AuroraCoreUI ui; // The is the UI object
private GameLibrary_UI Library; // This is the Library View Object
private GridManager LibraryManager; // This is the Grid Manager From The GameCover Library
private GameLibrary_UI libUI; // This is the Library View Object
private aImage sideSearchImage; // The Image To The Side of The Grid that says: Search
private GridManager SearchManager = null; // The Grid Manager For the Manager
private GridAnimation SearchGridAnimator; // The Grid Animator for the Search Grid
private ArrayList<Game> foundGameList; //List of all games found
private boolean ClearedGrid; // ClearedGrid boolean
private Game foundGame; //Current found game
private Game GameOriginal; //Original GameCover for copying purpouses
private FavListener FaveListener;
private final GameLibrary_HANDLE handler;
private GridAnimation SearchGridAnimator;

//////////////////////////
////////Constructor//////
////////////////////////
public GridSearch(AuroraCoreUI ui, GameLibrary_UI Obj_Library, GridManager manager) {
this.ui = ui;
this.Library = Obj_Library;
this.LibraryManager = manager;
this.libUI = Obj_Library;
this.handler = libUI.getHandler();
foundGameList = new ArrayList();
this.ClearedGrid = false;
}
Expand Down Expand Up @@ -86,11 +87,11 @@ public void removeChar(char typedChar) {


//What Happends When The Length is zero
if (AppendedName.length() == 0 || Library.getSearchBar().getText().length() == 0) {
if (AppendedName.length() == 0 || libUI.getSearchBar().getText().length() == 0) {
try {
restoreGrid(); //Restores to The original Library
resetAppendedName(); // Resets AppendName variable
Library.getGameBack().revalidate(); // Refreshes the Grid.
libUI.getGameBack().revalidate(); // Refreshes the Grid.
} catch (MalformedURLException ex) {
Logger.getLogger(GridSearch.class.getName()).log(Level.SEVERE, null, ex);
}
Expand Down Expand Up @@ -151,16 +152,16 @@ private void searchGame() {
System.out.println("Performing Lenient Search: " + AppendedName);

//Search Each Grid
for (int g = 0; g < Library.getGridSplit().getArray().size(); g++) {
for (int g = 0; g < libUI.getGridSplit().getArray().size(); g++) {
//Search GameCover in specific Grid

for (int j = 0; j < Library.getGridSplit().getGrid(g).getArray().size(); j++) {
for (int j = 0; j < libUI.getGridSplit().getGrid(g).getArray().size(); j++) {

//check if placeholder object
if (Library.getGridSplit().getGrid(g).getArray().get(j).getClass() != GamePlaceholder.class) {
if (libUI.getGridSplit().getGrid(g).getArray().get(j).getClass() != GamePlaceholder.class) {

//Convert each object in specific grid to GameCover Object
Game game = (Game) Library.getGridSplit().getGrid(g).getArray().get(j);
Game game = (Game) libUI.getGridSplit().getGrid(g).getArray().get(j);

int checkLength = ((AppendedName.length()));

Expand Down Expand Up @@ -199,18 +200,18 @@ private void searchGame() {
//If Nothing Found clear grid
if (foundGameList.isEmpty()) {
this.clearSearchGrid();
Library.getGameBack().repaint();
libUI.getGameBack().repaint();
}

//Clear grid
} else if (AppendedName.length() != 0) {
this.clearSearchGrid();
Library.getGameBack().repaint();
libUI.getGameBack().repaint();

}

//add the place holders at the end
SearchManager.addPlaceHolders(Library.getSIZE_GameCoverWidth(), Library.getSIZE_GameCoverHeight());
SearchManager.addPlaceHolders(libUI.getSIZE_GameCoverWidth(), libUI.getSIZE_GameCoverHeight());
}

private boolean checkGameExistsInSearch(String name) {
Expand All @@ -231,8 +232,8 @@ private boolean checkGameExistsInSearch(String name) {
//Check if GameCover with exact string exists in library
private boolean checkGameExistsInLibrary(String name) {

if (Library.getGridSplit().findGameName(name)[0] != -1
&& Library.getGridSplit().findGameName(name)[0] != -1) {
if (libUI.getGridSplit().findGameName(name)[0] != -1
&& libUI.getGridSplit().findGameName(name)[0] != -1) {
return true;
}
return false;
Expand All @@ -242,9 +243,9 @@ private void addFoundGame(String name) {

//MAKE A COPY OF THE PREVIEOUS GAME

GameOriginal = (Game) (Library.getGridSplit().getGrid(
Library.getGridSplit().findGameName(name)[0]).getArray().get(
Library.getGridSplit().findGameName(name)[1]));
GameOriginal = (Game) (libUI.getGridSplit().getGrid(
libUI.getGridSplit().findGameName(name)[0]).getArray().get(
libUI.getGridSplit().findGameName(name)[1]));

//Set Up New Cover
foundGame = new Game(SearchManager, ui, GameOriginal.getBoxArtURL());
Expand All @@ -263,30 +264,29 @@ private void addFoundGame(String name) {
//Live Display of GameCover Found
private void displayGames() throws MalformedURLException {

InputHandler keyHandler = new InputHandler();

//Go through Array and add to Grid
for (int i = 0; i < foundGameList.size(); i++) {
//Check for dupicates
if (!checkGameExistsInSearch(foundGameList.get(i).getName())) {

SearchManager.addGame(foundGameList.get(i)); // add to the grid.
foundGameList.get(i).addFocusListener(keyHandler.new searchLostFocusHandler(Library));
foundGameList.get(i).addFocusListener(handler.new searchLostFocusHandler(libUI));
foundGameList.get(i).update();

//Handle Remote Favorting to affect original game too
foundGame = foundGameList.get(i);
GameOriginal = (Game) (Library.getGridSplit().getGrid(
Library.getGridSplit().findGameName(foundGame.getGameName())[0]).getArray().get(
Library.getGridSplit().findGameName(foundGame.getGameName())[1]));
GameOriginal = (Game) (libUI.getGridSplit().getGrid(
libUI.getGridSplit().findGameName(foundGame.getGameName())[0]).getArray().get(
libUI.getGridSplit().findGameName(foundGame.getGameName())[1]));

FaveListener = new FavListener(foundGame, GameOriginal);


foundGameList.get(i).getFavoriteButton().addActionListener(FaveListener);

Library.getGameBack().revalidate();
Library.getGameBack().repaint();
libUI.getGameBack().revalidate();
libUI.getGameBack().repaint();

SearchManager.getGrid(0).revalidate();
SearchManager.getGrid(0).repaint();
Expand Down Expand Up @@ -315,18 +315,18 @@ public void clearGameGrid() {


//Remove Favorite Side Image
Library.getGameBack().remove(0);
Library.getGameBack().remove(Library.getImgFavorite());
libUI.getGameBack().remove(0);
libUI.getGameBack().remove(libUI.getImgFavorite());
//Add search Side image
this.sideSearchImage = new aImage("Aurora_Search.png");
Library.getGameBack().add(sideSearchImage, BorderLayout.WEST);
for (int i = 0; i < Library.getGridSplit().getArray().size(); i++) {
Library.getGameBack().remove(Library.getGridSplit().getGrid(i));
libUI.getGameBack().add(sideSearchImage, BorderLayout.WEST);
for (int i = 0; i < libUI.getGridSplit().getArray().size(); i++) {
libUI.getGameBack().remove(libUI.getGridSplit().getGrid(i));

}

Library.getGameBack().revalidate();
Library.getGameBack().repaint();
libUI.getGameBack().revalidate();
libUI.getGameBack().repaint();

setUpGrid();

Expand All @@ -345,14 +345,14 @@ public void restoreGrid() throws MalformedURLException {
ClearedGrid = false;


Library.getGameBack().removeAll();
libUI.getGameBack().removeAll();

Library.getGameBack().add(Library.getImgFavorite(), BorderLayout.WEST);
Library.getGameBack().add(Library.getGridSplit().getGrid(0), BorderLayout.CENTER);
Library.getGameBack().add(Library.getImgGameRight(), BorderLayout.EAST);
libUI.getGameBack().add(libUI.getImgFavorite(), BorderLayout.WEST);
libUI.getGameBack().add(libUI.getGridSplit().getGrid(0), BorderLayout.CENTER);
libUI.getGameBack().add(libUI.getImgGameRight(), BorderLayout.EAST);

Library.getGameBack().revalidate();
Library.getGameBack().repaint();
libUI.getGameBack().revalidate();
libUI.getGameBack().repaint();


}
Expand All @@ -361,9 +361,9 @@ public void restoreGrid() throws MalformedURLException {
private void setUpGrid() {
this.SearchManager = new GridManager(2, 4, ui);
SearchManager.initiateGrid(0);
Library.getGameBack().add(SearchManager.getGrid(0), BorderLayout.CENTER);
libUI.getGameBack().add(SearchManager.getGrid(0), BorderLayout.CENTER);

this.SearchGridAnimator = new GridAnimation(SearchManager, Library.getGameBack());
this.SearchGridAnimator = new GridAnimation(SearchManager, libUI.getGameBack());


}
Expand Down
Loading

0 comments on commit 188b4fe

Please sign in to comment.