Skip to content

Commit

Permalink
MOAR REFACTORING!!! MOAR COMMENTING!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
sguergachi committed Oct 23, 2012
1 parent 2e3e9cd commit 4ebcff1
Show file tree
Hide file tree
Showing 7 changed files with 354 additions and 214 deletions.
8 changes: 4 additions & 4 deletions src/aurora/V1/core/AuroraApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package aurora.V1.core;

import aurora.V1.core.screen_ui.DashboardUI;
import aurora.engine.V1.UI.AuroraScreenUI;
import aurora.engine.V1.UI.AuroraUI;
import aurora.engine.V1.UI.aButton;
import aurora.engine.V1.UI.aProgressWheel;
import java.awt.BorderLayout;
Expand All @@ -39,7 +39,7 @@
* @author Sammy
* @version 0.3
*/
public abstract class AuroraApp implements Runnable, AuroraScreenUI {
public abstract class AuroraApp implements Runnable, AuroraUI {

private JFrame frame;
private AuroraCoreUI coreUI;
Expand All @@ -58,7 +58,7 @@ public abstract class AuroraApp implements Runnable, AuroraScreenUI {

public AuroraApp() {
ComponentsContainingListeners = new ArrayList<JComponent>();

}

/**
Expand Down Expand Up @@ -242,7 +242,7 @@ private void removeAllListeners() {
//For Components in the Volatile Bank!
for (int i = 0; i < ComponentsContainingListeners.size(); i++) {

//Remove KeyListers
//Remove KeyListers
KeyListeners = ComponentsContainingListeners.get(i).getKeyListeners();

for (int j = 0; j < KeyListeners.length; j++) {
Expand Down
98 changes: 49 additions & 49 deletions src/aurora/V1/core/GameSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class GameSearch implements Runnable {

private AuroraCoreUI ui;
private GameLibraryUI libUI;
private GameLibraryUI libraryUI;
private aSimpleDB db;
private ArrayList foundGameList;
private char typed;
Expand All @@ -47,15 +47,15 @@ public class GameSearch implements Runnable {
private Object[] foundArray;
private AuroraStorage storage;


//////////////////////////
////////Constructor//////
////////////////////////
public GameSearch(GameLibraryUI gameLibraryUI, aSimpleDB database, AuroraStorage storage) {
this.ui = gameLibraryUI.getCoreUI();
this.db = database;
this.storage = storage;
libUI = gameLibraryUI;
libraryUI = gameLibraryUI;
foundGameList = new ArrayList();

}
Expand Down Expand Up @@ -125,21 +125,21 @@ public void removeChar(char typedChar) {
//Reset text, Cover Image, List and turn notification to red
public void resetCover() {

libUI.getCoverPane().removeAll();
libUI.getCoverPane().revalidate();
libUI.getCoverPane().add(libUI.getCoverGame());
libUI.getCoverGame().revalidate();
libUI.getCoverPane().revalidate();
libraryUI.getCoverPane().removeAll();
libraryUI.getCoverPane().revalidate();
libraryUI.getCoverPane().add(libraryUI.getCoverGame());
libraryUI.getCoverGame().revalidate();
libraryUI.getCoverPane().revalidate();

libUI.getSearchText().setText("");
libraryUI.getSearchText().setText("");
AppendedName = "";
foundGame = "";

foundArray = null;
libUI.getAddGamePane().revalidate();
libUI.getListModel().removeAllElements();
libUI.getStepOne().setImgURl("AddGame_step1_red.png");
libUI.checkNotifiers();
libraryUI.getAddGamePane().revalidate();
libraryUI.getListModel().removeAllElements();
libraryUI.getStepOne().setImgURl("AddGame_step1_red.png");
libraryUI.checkNotifiers();
}

public void setAppendedName(String AppendedName) {
Expand All @@ -162,31 +162,31 @@ public void searchSpecificGame(String gameName) {

//If not found show Placeholder and turn notification red
if (foundGame == null) {
libUI.getCoverPane().removeAll();
libraryUI.getCoverPane().removeAll();
notFound = new aImagePane("NoGameFound.png", 220, 250);
libUI.getCoverPane().add(notFound);
libraryUI.getCoverPane().add(notFound);
foundGameCover = null;
libUI.getStepOne().setImgURl("AddGame_step1_red.png");
libUI.checkNotifiers();
libUI.getListModel().removeAllElements();
libUI.getCoverPane().repaint();
libUI.getCoverPane().revalidate();
libraryUI.getStepOne().setImgURl("AddGame_step1_red.png");
libraryUI.checkNotifiers();
libraryUI.getListModel().removeAllElements();
libraryUI.getCoverPane().repaint();
libraryUI.getCoverPane().revalidate();

//Show the game Cover if a single database item is found
} else if (foundGame != null) {

libUI.getCoverPane().removeAll();
libraryUI.getCoverPane().removeAll();
//Create the new GameCover object
foundGameCover = new Game(libUI.getGridSplit(), ui, libUI.getDashUI(), storage);
foundGameCover = new Game(libraryUI.getGridSplit(), ui, libraryUI.getDashUI(), storage);
try {
foundGameCover.setCoverUrl(foundGame);
} catch (MalformedURLException ex) {
Logger.getLogger(GameSearch.class.getName()).log(Level.SEVERE, null, ex);
}
foundGameCover.setCoverSize(220, 250);
foundGameCover.setGameName(gameName);
libUI.getCoverPane().add(foundGameCover);

libraryUI.getCoverPane().add(foundGameCover);
try {
foundGameCover.update();
foundGameCover.removeInteraction();
Expand All @@ -195,10 +195,10 @@ public void searchSpecificGame(String gameName) {
}

//Change notification
libUI.getStepOne().setImgURl("AddGame_step1_green.png");
libUI.checkNotifiers();
libUI.getCoverPane().repaint();
libUI.getCoverPane().revalidate();
libraryUI.getStepOne().setImgURl("AddGame_step1_green.png");
libraryUI.checkNotifiers();
libraryUI.getCoverPane().repaint();
libraryUI.getCoverPane().revalidate();

}
}
Expand All @@ -210,13 +210,13 @@ public static Game getFoundGameCover() {
private void searchGame() {

//What Happends When The Length is zero
if (AppendedName.length() <= 0 || libUI.getGameSearchBar().getText().length() == 0) {
if (AppendedName.length() <= 0 || libraryUI.getGameSearchBar().getText().length() == 0) {
System.out.println("RESETING PANE");
resetCover();
libUI.getCoverPane().repaint();
libUI.getCoverPane().revalidate();
libraryUI.getCoverPane().repaint();
libraryUI.getCoverPane().revalidate();
} else {
libUI.getListModel().removeAllElements();
libraryUI.getListModel().removeAllElements();
//Query the database
try {
foundArray = db.searchAprox("AuroraTable", "FILE_NAME", "GAME_NAME", AppendedName.toString());
Expand All @@ -234,10 +234,10 @@ private void searchGame() {
for (int i = 0; i <= 10 && i < foundArray.length; i++) {
if (foundArray[i] != null) {
String gameItem = (String) foundArray[i];
libUI.getListModel().addElement(gameItem.replace("-", " ").replace(".png", ""));
libraryUI.getListModel().addElement(gameItem.replace("-", " ").replace(".png", ""));
}
}
libUI.getGamesList().revalidate();
libraryUI.getGamesList().revalidate();
//Library.getGamesList().setSelectedIndex(1);
} catch (Exception ex) {
foundGame = null;
Expand All @@ -248,32 +248,32 @@ private void searchGame() {
//and turn the notifier red
if (foundGame == null) {

libUI.getCoverPane().removeAll();
libraryUI.getCoverPane().removeAll();
notFound = new aImagePane("NoGameFound.png", 220, 250);
libUI.getCoverPane().add(notFound);
libraryUI.getCoverPane().add(notFound);
foundGameCover = null;
libUI.getStepOne().setImgURl("AddGame_step1_red.png");
libUI.checkNotifiers();
libUI.getListModel().removeAllElements();
libUI.getCoverPane().repaint();
libUI.getCoverPane().revalidate();
libraryUI.getStepOne().setImgURl("AddGame_step1_red.png");
libraryUI.checkNotifiers();
libraryUI.getListModel().removeAllElements();
libraryUI.getCoverPane().repaint();
libraryUI.getCoverPane().revalidate();

} else if (foundGame != null) {

libUI.getCoverPane().removeAll();
libraryUI.getCoverPane().removeAll();


//Set up GameCover object with First Database item found
foundGameCover = new Game(libUI.getGridSplit(), ui, libUI.getDashUI(), storage);
foundGameCover = new Game(libraryUI.getGridSplit(), ui, libraryUI.getDashUI(), storage);
try {
foundGameCover.setCoverUrl(foundGame); //use seperate string
} catch (MalformedURLException ex) {
Logger.getLogger(GameSearch.class.getName()).log(Level.SEVERE, null, ex);
}
foundGameCover.setCoverSize(220, 250);
foundGameCover.setGameName(foundGame.replace("-", " ").replace(".png", ""));
libUI.getCoverPane().add(foundGameCover);

libraryUI.getCoverPane().add(foundGameCover);
//Show GameCover
try {
foundGameCover.update();
Expand All @@ -283,10 +283,10 @@ private void searchGame() {
}

//Trun notifier Green
libUI.getStepOne().setImgURl("AddGame_step1_green.png");
libUI.checkNotifiers();
libUI.getCoverPane().repaint();
libUI.getCoverPane().revalidate();
libraryUI.getStepOne().setImgURl("AddGame_step1_green.png");
libraryUI.checkNotifiers();
libraryUI.getCoverPane().repaint();
libraryUI.getCoverPane().revalidate();
}
}
}
Expand Down
Loading

0 comments on commit 4ebcff1

Please sign in to comment.