Go to the documentation of this file.
20 package net.sf.gridarta.project;
23 import java.io.FileNotFoundException;
24 import java.io.IOException;
25 import java.net.URISyntaxException;
27 import java.util.Collections;
108 import net.
sf.japi.swing.action.ActionBuilder;
109 import net.
sf.japi.swing.action.ActionBuilderFactory;
110 import nu.xom.Document;
111 import nu.xom.ParsingException;
112 import nu.xom.xinclude.XIncludeException;
113 import org.apache.log4j.Category;
114 import org.apache.log4j.Logger;
115 import org.jetbrains.annotations.NotNull;
116 import org.jetbrains.annotations.Nullable;
117 import org.xml.sax.SAXException;
205 final int doubleFaceOffset = projectFactory.getDoubleFaceOffset();
252 return archetypeTypeSetParser.
loadTypesFromXML(typesErrorViewCollector, document);
253 }
catch (
final IOException | ParsingException | SAXException | URISyntaxException | XIncludeException ex) {
259 private static <G extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>>
void loadArchetypes(@NotNull
final ErrorView errorView, @NotNull
final ProjectSettings projectSettings, @NotNull
final ArchetypeSet<G, A, R> archetypeSet, @NotNull
final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull
final AbstractResources<G, A, R> resources, @NotNull
final ConfigSource configSource) {
260 final long timeStart = System.currentTimeMillis();
261 if (
LOG.isInfoEnabled()) {
262 LOG.info(
"Start to load archetypes...");
266 if (
LOG.isInfoEnabled()) {
267 LOG.info(
"Archetype loading took " + (System.currentTimeMillis() - timeStart) / 1000.0 +
" seconds.");
271 private static <G extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>>
void addArchetypes(@NotNull
final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull
final ArchetypeSet<G, A, R> archetypeSet) {
273 final CharSequence editorFolder = archetype.getEditorFolder();
276 if (tmp.length == 2) {
277 final String panelName = tmp[0];
278 final String folderName = tmp[1];
291 }
catch (
final IOException ex) {
299 }
catch (
final IOException | ParsingException | SAXException | URISyntaxException | XIncludeException ex) {
318 private static <G extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>>
DelegatingMapValidator<G, A, R> loadValidators(@NotNull
final ErrorView errorView, @NotNull
final ProjectFactory<G, A, R> projectFactory, @NotNull
final ProjectSettings projectSettings, @NotNull
final GameObjectMatchers gameObjectMatchers, @NotNull
final ArchetypeTypeSet archetypeTypeSet, @NotNull
final ValidatorPreferences validatorPreferences, @NotNull
final MapWriter<G, A, R> mapWriter, @NotNull
final MapManager<G, A, R> mapManager) {
328 if (shopSquareMatcher !=
null) {
330 if (noSpellsMatcher !=
null) {
336 if (paidItemMatcher !=
null) {
350 private static <G extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>>
void loadValidators(@NotNull
final DelegatingMapValidator<G, A, R> validators, @NotNull
final ValidatorFactory<G, A, R> validatorFactory, @NotNull
final ErrorView errorView) {
351 final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
354 final String spec = actionBuilder.getString(
"validator." +
id);
365 if (
LOG.isInfoEnabled()) {
366 LOG.info(
"Loaded " +
id +
" map validators.");
371 private static <G extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>>
Spells<GameObjectSpell<G, A, R>>
loadArchetypeSpells(
final int spellType, @NotNull
final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull
final ArchetypeSet<G, A, R> archetypeSet) {
373 if (spellType != 0) {
383 if (spellFile ==
null) {
392 }
catch (
final IOException | ParsingException | SAXException | URISyntaxException | XIncludeException ex) {
401 Map<String, TreasureTreeNode> specialTreasureLists;
408 }
catch (
final IOException | ParsingException | SAXException | URISyntaxException | XIncludeException ex) {
410 specialTreasureLists = Collections.emptyMap();
412 }
catch (
final FileNotFoundException ex) {
414 specialTreasureLists = Collections.emptyMap();
416 return specialTreasureLists;
555 return pluginParameters;
final GameObjectMatchers gameObjectMatchers
InsertionMode getTopmostInsertionMode()
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > AutojoinLists< G, A, R > loadList(@NotNull final ErrorView errorView, final ArchetypeSet< G, A, R > archetypeSet, @NotNull final File baseDir)
PluginModel< G, A, R > getPluginModel()
MapManager< G, A, R > getPickmapManager()
FaceObjectProviders getFaceObjectProviders()
static URL getResource(@NotNull final File dir, @NotNull final String fileName)
FaceObjects getFaceObjects()
void addArchetype(@NotNull final String panel, @NotNull final String folder, @NotNull final R archetype)
Spells< NumberSpell > getNumberSpells()
GameObjectMatchers getGameObjectMatchers()
AbstractMapManager< G, A, R > getMapManager()
static final String TYPEDEF_FILE
final PathManager pathManager
Collection< R > getArchetypes()
static ArchetypeTypeSet loadArchetypeTypeSet(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings)
GameObjectParser< G, A, R > newGameObjectParser()
static Map< String, TreasureTreeNode > loadSpecialTreasureLists(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings)
Spells< GameObjectSpell< G, A, R > > getGameObjectSpells()
final DelegatingMapValidator< G, A, R > validators
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > void loadValidators(@NotNull final DelegatingMapValidator< G, A, R > validators, @NotNull final ValidatorFactory< G, A, R > validatorFactory, @NotNull final ErrorView errorView)
String EDITOR_FOLDER_INTERN
MAP_VALIDATOR_ENTRY_INVALID
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > PluginModel< G, A, R > loadPlugins(@NotNull final PluginParameterFactory< G, A, R > pluginParameterFactory, @NotNull final PluginModelParser< G, A, R > pluginModelParser, @NotNull final ErrorView errorView, @NotNull final File pluginsDir)
ArchetypeSet< G, A, R > getArchetypeSet()
final SmoothFaces smoothFaces
ArchetypeTypeSet getArchetypeTypeSet()
void load(@NotNull final ArchetypeSet< G, A, R > archetypeSet, final int typeNo, @NotNull final Spells< GameObjectSpell< G, A, R >> spells)
AbstractResources< G, A, R > getResources()
final MapArchObjectFactory< A > mapArchObjectFactory
final ProjectSettings projectSettings
void addValidator(@NotNull final Validator< G, A, R > validator)
AnimationObjects getAnimationObjects()
GameObjectMatcher getMatcher(@NotNull final String... ids)
ArchetypeChooserModel< G, A, R > getArchetypeChooserModel()
final AbstractResources< G, A, R > resources
final DefaultMapReaderFactory< G, A, R > mapReaderFactory
final FaceObjects faceObjects
GameObjectFactory< G, A, R > getGameObjectFactory()
static final Category LOG
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > DelegatingMapValidator< G, A, R > loadValidators(@NotNull final ErrorView errorView, @NotNull final ProjectFactory< G, A, R > projectFactory, @NotNull final ProjectSettings projectSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter< G, A, R > mapWriter, @NotNull final MapManager< G, A, R > mapManager)
final InsertionMode topmostInsertionMode
MapArchObjectFactory< A > getMapArchObjectFactory()
static void load(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Document document, @NotNull final Spells< NumberSpell > spells)
ArchetypeTypeSet loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Document document)
static Document readXmlUrl(@NotNull final URL url, @NotNull final String rootElement, @NotNull final String systemId, @NotNull final String resourceName, @Nullable final ErrorHandler errorHandler)
final GameObjectParser< G, A, R > gameObjectParser
static Spells< NumberSpell > loadSpellFile(@Nullable final String spellFile, @NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings)
final MapModelFactory< G, A, R > mapModelFactory
final AnimationObjects animationObjects
DelegatingMapValidator< G, A, R > getValidators()
void addWarning(@NotNull final ErrorViewCategory category)
PathManager getPathManager()
ProjectSettings getProjectSettings()
final Spells< GameObjectSpell< G, A, R > > gameObjectSpells
PluginParameters newPluginParameters(@NotNull final Object rendererFactory)
void addPluginParameter(@NotNull final String name, @Nullable final Object value)
MapModelFactory< G, A, R > getMapModelFactory()
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ArchetypeSet< G, A, R > archetypeSet, @NotNull final ArchetypeChooserModel< G, A, R > archetypeChooserModel, @NotNull final AbstractResources< G, A, R > resources, @NotNull final ConfigSource configSource)
static GameObjectMatchers loadGameObjectMatchers(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings)
static final Pattern PATTERN_SLASH
static Map< String, TreasureTreeNode > parseTreasureLists(@NotNull final Document specialTreasureListsDocument)
final TreasureTree treasureTree
final AbstractMapManager< G, A, R > mapManager
MapReaderFactory< G, A > getMapReaderFactory()
static TreasureTree parseTreasures(@NotNull final ErrorView errorView, @NotNull final Map< String, TreasureTreeNode > specialTreasureLists, @NotNull final ConfigSource configSource, @NotNull final ProjectSettings projectSettings)
final ArchetypeSet< G, A, R > archetypeSet
final Spells< NumberSpell > numberSpells
final MapManager< G, A, R > pickmapManager
File getConfigurationDirectory()
final ArchetypeTypeSet archetypeTypeSet
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > void addArchetypes(@NotNull final ArchetypeChooserModel< G, A, R > archetypeChooserModel, @NotNull final ArchetypeSet< G, A, R > archetypeSet)
final FaceObjectProviders faceObjectProviders
final GameObjectFactory< G, A, R > gameObjectFactory
GameObjectParser< G, A, R > getGameObjectParser()
static void readGameObjectMatchers(@NotNull final Document document, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorViewCollector errorViewCollector)
final PluginModel< G, A, R > pluginModel
ProjectModel(@NotNull final ErrorView errorView, @NotNull final ProjectSettings projectSettings, @NotNull final ProjectFactory< G, A, R > projectFactory, @NotNull final ResourceIcons resourceIcons, @NotNull final ConfigSource configSource)
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > Spells< GameObjectSpell< G, A, R > > loadArchetypeSpells(final int spellType, @NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final ArchetypeSet< G, A, R > archetypeSet)
GAMEOBJECTMATCHERS_FILE_INVALID
final ArchetypeChooserModel< G, A, R > archetypeChooserModel
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final AttributeRangeChecker< G, A, R > attributeRangeChecker, @NotNull final EnvironmentChecker< G, A, R > environmentChecker)
void addFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener)
TreasureTree getTreasureTree()
SmoothFaces getSmoothFaces()