Code cleanup

This commit is contained in:
drdev
2014-01-25 02:48:36 +00:00
parent a3fb6de6b3
commit b198e8a40e
4 changed files with 30 additions and 26 deletions

View File

@@ -125,8 +125,9 @@ public class DeckProxy implements InventoryItem {
if (sbSize == Integer.MIN_VALUE) {
CardPool sb = getDeck().get(DeckSection.Sideboard);
sbSize = sb == null ? -1 : sb.countAll();
if( sbSize == 0 )
if (sbSize == 0) {
sbSize = -1;
}
}
return sbSize;
}
@@ -144,8 +145,8 @@ public class DeckProxy implements InventoryItem {
private static void addDecksRecursivelly(List<DeckProxy> list, String path, IStorage<Deck> folder) {
for (IStorage<Deck> f : folder.getFolders()) {
String subPath = (StringUtils.isBlank(path) ? "" : path) + "/" + f.getName();
addDecksRecursivelly(list, subPath, f);
String subPath = (StringUtils.isBlank(path) ? "" : path) + "/" + f.getName();
addDecksRecursivelly(list, subPath, f);
}
for (Deck d : folder) {
@@ -179,20 +180,23 @@ public class DeckProxy implements InventoryItem {
}
public void reloadFromStorage() {
if( null != storage )
if (storage != null) {
deck = storage.get(getName());
}
invalidateCache();
}
@SuppressWarnings("unchecked")
public void updateInStorage() {
if ( storage instanceof StorageImmediatelySerialized<?> )
if (storage instanceof StorageImmediatelySerialized<?>) {
((StorageImmediatelySerialized<IHasName>)storage).add(deck);
}
}
public void deleteFromStorage() {
if ( storage instanceof StorageImmediatelySerialized<?> )
if (storage instanceof StorageImmediatelySerialized<?>) {
storage.delete(getName());
}
}
private static class ThemeDeckGenerator extends DeckProxy {

View File

@@ -254,16 +254,16 @@ public enum CCurrentDeck implements ICDoc {
return null;
}
/** The Constant HTML_FILTER. */
public static final FileFilter HTML_FILTER = new FileFilter() {
@Override
public boolean accept(final File f) {
return f.getName().endsWith(".html") || f.isDirectory();
}
/** The Constant HTML_FILTER. */
public static final FileFilter HTML_FILTER = new FileFilter() {
@Override
public boolean accept(final File f) {
return f.getName().endsWith(".html") || f.isDirectory();
}
@Override
public String getDescription() {
return "Proxy File .html";
}
};
@Override
public String getDescription() {
return "Proxy File .html";
}
};
}

View File

@@ -47,8 +47,7 @@ public class DeckController<T extends DeckBase> {
* @param view0 the view0
* @param newModelCreator0 the new model creator0
*/
public DeckController(final IStorage<T> folder0, final ACEditorBase<?, T> view0,
final Supplier<T> newModelCreator0) {
public DeckController(final IStorage<T> folder0, final ACEditorBase<?, T> view0, final Supplier<T> newModelCreator0) {
this.rootFolder = folder0;
this.currentFolder = rootFolder;
this.view = view0;
@@ -142,10 +141,12 @@ public class DeckController<T extends DeckBase> {
}
public void load(final String path, final String name) {
if ( StringUtils.isBlank(path))
if (StringUtils.isBlank(path)) {
currentFolder = rootFolder;
else
}
else {
currentFolder = rootFolder.tryGetFolder(path);
}
load(name);
}

View File

@@ -407,7 +407,6 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
*/
public void setPool(final ItemPool<T> poolView, boolean infinite) {
this.setPoolImpl(ItemPool.createFrom(poolView, this.genericType), infinite);
}
public void setPool(final ItemPool<T> pool0) {