Search in sources :

Example 1 with MTGPicturesCache

use of org.magic.api.interfaces.MTGPicturesCache in project MtgDesktopCompanion by nicho92.

the class PicturesProviderTests method removeCache.

@Before
public void removeCache() {
    MTGLogger.changeLevel(Level.ERROR);
    List<MTGPicturesCache> caches = MTGControler.getInstance().getListCaches();
    MTGControler.getInstance().getListCaches().removeAll(caches);
    MTGPicturesCache cache = new NoCache();
    cache.enable(true);
    MTGControler.getInstance().getListCaches().add(cache);
}
Also used : MTGPicturesCache(org.magic.api.interfaces.MTGPicturesCache) NoCache(org.magic.api.cache.impl.NoCache) Before(org.junit.Before)

Example 2 with MTGPicturesCache

use of org.magic.api.interfaces.MTGPicturesCache in project MtgDesktopCompanion by nicho92.

the class SpeedConfigurator method save.

protected void save() {
    for (MTGCardsProvider prov : MTGControler.getInstance().getListProviders()) {
        prov.enable(false);
        if (prov.getName().equals(cboProvider.getSelectedItem().toString()))
            prov.enable(true);
        MTGControler.getInstance().setProperty(prov, prov.isEnable());
    }
    for (MTGDao prov : MTGControler.getInstance().getDaoProviders()) {
        prov.enable(false);
        if (prov.getName().equals(cboDAOs.getSelectedItem().toString()))
            prov.enable(true);
        MTGControler.getInstance().setProperty(prov, prov.isEnable());
    }
    for (MTGPictureProvider prov : MTGControler.getInstance().getPicturesProviders()) {
        prov.enable(false);
        if (prov.getName().equals(cboPictures.getSelectedItem().toString()))
            prov.enable(true);
        MTGControler.getInstance().setProperty(prov, prov.isEnable());
    }
    for (MTGPicturesCache prov : MTGControler.getInstance().getListCaches()) {
        prov.enable(false);
        if (prov.getName().equals(cboCaches.getSelectedItem().toString()))
            prov.enable(true);
        MTGControler.getInstance().setProperty(prov, prov.isEnable());
    }
    for (MTGDashBoard prov : MTGControler.getInstance().getDashBoards()) {
        prov.enable(false);
        if (prov.getName().equals(cboDashboard.getSelectedItem().toString()))
            prov.enable(true);
        MTGControler.getInstance().setProperty(prov, prov.isEnable());
    }
    System.exit(0);
}
Also used : MTGPictureProvider(org.magic.api.interfaces.MTGPictureProvider) MTGDao(org.magic.api.interfaces.MTGDao) MTGDashBoard(org.magic.api.interfaces.MTGDashBoard) MTGPicturesCache(org.magic.api.interfaces.MTGPicturesCache) MTGCardsProvider(org.magic.api.interfaces.MTGCardsProvider)

Aggregations

MTGPicturesCache (org.magic.api.interfaces.MTGPicturesCache)2 Before (org.junit.Before)1 NoCache (org.magic.api.cache.impl.NoCache)1 MTGCardsProvider (org.magic.api.interfaces.MTGCardsProvider)1 MTGDao (org.magic.api.interfaces.MTGDao)1 MTGDashBoard (org.magic.api.interfaces.MTGDashBoard)1 MTGPictureProvider (org.magic.api.interfaces.MTGPictureProvider)1