Search in sources :

Example 1 with PCGenTask

use of pcgen.system.PCGenTask in project pcgen by PCGen.

the class DataTest method loadGameModes.

private static void loadGameModes() {
    String configFolder = "testsuite";
    String pccLoc = TestHelper.findDataFolder();
    System.out.println("Got data folder of " + pccLoc);
    try {
        TestHelper.createDummySettingsFile(TEST_CONFIG_FILE, configFolder, pccLoc);
    } catch (IOException e) {
        Logging.errorPrint("DataTest.loadGameModes failed", e);
    }
    PropertyContextFactory configFactory = new PropertyContextFactory(SystemUtils.USER_DIR);
    configFactory.registerAndLoadPropertyContext(ConfigurationSettings.getInstance(TEST_CONFIG_FILE));
    Main.loadProperties(false);
    PCGenTask loadPluginTask = Main.createLoadPluginTask();
    loadPluginTask.execute();
    GameModeFileLoader gameModeFileLoader = new GameModeFileLoader();
    gameModeFileLoader.execute();
    CampaignFileLoader campaignFileLoader = new CampaignFileLoader();
    campaignFileLoader.execute();
}
Also used : CampaignFileLoader(pcgen.persistence.CampaignFileLoader) PCGenTask(pcgen.system.PCGenTask) PropertyContextFactory(pcgen.system.PropertyContextFactory) IOException(java.io.IOException) GameModeFileLoader(pcgen.persistence.GameModeFileLoader)

Example 2 with PCGenTask

use of pcgen.system.PCGenTask in project pcgen by PCGen.

the class TestHelper method loadGameModes.

public static void loadGameModes(String testConfigFile) {
    String configFolder = "testsuite";
    String pccLoc = TestHelper.findDataFolder();
    System.out.println("Got data folder of " + pccLoc);
    try {
        TestHelper.createDummySettingsFile(testConfigFile, configFolder, pccLoc);
    } catch (IOException e) {
        Logging.errorPrint("DataTest.loadGameModes failed", e);
    }
    PropertyContextFactory configFactory = new PropertyContextFactory(SystemUtils.USER_DIR);
    configFactory.registerAndLoadPropertyContext(ConfigurationSettings.getInstance(testConfigFile));
    Main.loadProperties(false);
    PCGenTask loadPluginTask = Main.createLoadPluginTask();
    loadPluginTask.execute();
    GameModeFileLoader gameModeFileLoader = new GameModeFileLoader();
    gameModeFileLoader.execute();
    CampaignFileLoader campaignFileLoader = new CampaignFileLoader();
    campaignFileLoader.execute();
}
Also used : CampaignFileLoader(pcgen.persistence.CampaignFileLoader) PCGenTask(pcgen.system.PCGenTask) PropertyContextFactory(pcgen.system.PropertyContextFactory) IOException(java.io.IOException) GameModeFileLoader(pcgen.persistence.GameModeFileLoader)

Example 3 with PCGenTask

use of pcgen.system.PCGenTask in project pcgen by PCGen.

the class StartupPanel method performAnalysis.

@Override
public boolean performAnalysis(CDOMObject pc) {
    new Thread(new Runnable() {

        @Override
        public void run() {
            PCGenTask loadPluginTask = Main.createLoadPluginTask();
            loadPluginTask.execute();
            progressBar.setValue(1);
            gameModeFileLoader.execute();
            progressBar.setValue(2);
            campaignFileLoader.execute();
            progressBar.setValue(3);
            message.add(new JLabel("Initialization complete, press next button to continue..."));
            message.revalidate();
            fireProgressEvent(ProgressEvent.AUTO_ADVANCE);
        }
    }).start();
    return true;
}
Also used : PCGenTask(pcgen.system.PCGenTask) JLabel(javax.swing.JLabel)

Example 4 with PCGenTask

use of pcgen.system.PCGenTask in project pcgen by PCGen.

the class DataLoadTest method loadGameModes.

private static void loadGameModes() {
    String configFolder = "testsuite";
    String pccLoc = TestHelper.findDataFolder();
    System.out.println("Got data folder of " + pccLoc);
    try {
        TestHelper.createDummySettingsFile(TEST_CONFIG_FILE, configFolder, pccLoc);
    } catch (IOException e) {
        Logging.errorPrint("DataTest.loadGameModes failed", e);
    }
    PropertyContextFactory configFactory = new PropertyContextFactory(SystemUtils.USER_DIR);
    configFactory.registerAndLoadPropertyContext(ConfigurationSettings.getInstance(TEST_CONFIG_FILE));
    Main.loadProperties(false);
    PCGenTask loadPluginTask = Main.createLoadPluginTask();
    loadPluginTask.execute();
    GameModeFileLoader gameModeFileLoader = new GameModeFileLoader();
    gameModeFileLoader.execute();
    CampaignFileLoader campaignFileLoader = new CampaignFileLoader();
    campaignFileLoader.execute();
}
Also used : CampaignFileLoader(pcgen.persistence.CampaignFileLoader) PCGenTask(pcgen.system.PCGenTask) PropertyContextFactory(pcgen.system.PropertyContextFactory) IOException(java.io.IOException) GameModeFileLoader(pcgen.persistence.GameModeFileLoader)

Example 5 with PCGenTask

use of pcgen.system.PCGenTask in project pcgen by PCGen.

the class SplashScreen method progressChanged.

/**
	 * This updates the progress bar with the latest task progress information.
	 * It is not assumed that this method will be called on the Event Dispatch
	 * thread so UI updates are added to the Event Dispatch queue so that they
	 * are handled appropriately. To make sure that update requests do not
	 * overwhelm the UI thread a {@code dirty} flag is used to make sure
	 * that the multiple UI update requests are not queued at the same time.
	 *
	 * @param event a PCGenTaskEvent
	 */
@Override
public void progressChanged(final PCGenTaskEvent event) {
    if (!dirty) {
        dirty = true;
        SwingUtilities.invokeLater(() -> {
            PCGenTask task = event.getSource();
            loadProgress.getModel().setRangeProperties(task.getProgress(), 1, 0, task.getMaximum(), true);
            loadingLabel.setText(task.getMessage());
            dirty = false;
        });
    }
}
Also used : PCGenTask(pcgen.system.PCGenTask)

Aggregations

PCGenTask (pcgen.system.PCGenTask)5 IOException (java.io.IOException)3 CampaignFileLoader (pcgen.persistence.CampaignFileLoader)3 GameModeFileLoader (pcgen.persistence.GameModeFileLoader)3 PropertyContextFactory (pcgen.system.PropertyContextFactory)3 JLabel (javax.swing.JLabel)1