From 315f5c138e17f748d9914ea8a865a2fae08d6da4 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 05:46:40 +0100 Subject: [PATCH 01/96] Scope implementation --- .../de/saxsys/mvvmfx/InjectViewScope.java | 11 +++ .../src/main/java/de/saxsys/mvvmfx/Scope.java | 5 ++ .../java/de/saxsys/mvvmfx/ScopeStore.java | 35 ++++++++ .../viewloader/DependencyInjector.java | 2 +- .../internal/viewloader/FxmlViewLoader.java | 18 ++-- .../internal/viewloader/JavaViewLoader.java | 2 + .../viewloader/ViewLoaderReflectionUtils.java | 84 +++++++++++++++---- .../test/java/de/saxsys/mvvmfx/ScopeTest.java | 78 +++++++++++++++++ .../viewloader/example/ScopedFxmlViewA.java | 14 ++++ .../viewloader/example/ScopedFxmlViewB.java | 14 ++++ .../viewloader/example/ScopedJavaViewA.java | 27 ++++++ .../viewloader/example/ScopedJavaViewB.java | 27 ++++++ .../viewloader/example/ScopedViewModelA.java | 33 ++++++++ .../viewloader/example/ScopedViewModelB.java | 30 +++++++ .../viewloader/example/TestScope.java | 7 ++ .../viewloader/example/ScopedFxmlViewA.fxml | 6 ++ .../viewloader/example/ScopedFxmlViewB.fxml | 6 ++ 17 files changed, 375 insertions(+), 24 deletions(-) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java new file mode 100644 index 000000000..9d16f70ee --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface InjectViewScope { +} \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java new file mode 100644 index 000000000..b50815834 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java @@ -0,0 +1,5 @@ +package de.saxsys.mvvmfx; + +public interface Scope { + +} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java new file mode 100644 index 000000000..1f066fff2 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -0,0 +1,35 @@ +package de.saxsys.mvvmfx; + +import java.util.HashMap; +import java.util.Map; + +import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; + +public class ScopeStore<V extends Scope> { + + // TODO Memory Leak fixen? + private final Map<String, Scope> scopes = new HashMap<>(); + + private static final ScopeStore INSTANCE = new ScopeStore(); + + public static ScopeStore<TestScope> getInstance() { + return INSTANCE; + } + + public V getScope(Class<? extends Scope> scopeType, String id) { + String mapId = scopeType.getName() + id; + + V scope = (V) scopes.get(mapId); + + if (scope == null) { + scope = createScopeInstance(scopeType); + scopes.put(mapId, scope); + } + return scope; + } + + private V createScopeInstance(Class<? extends Scope> scopeType) { + return (V) DependencyInjector.getInstance().getInstanceOf(scopeType); + } +} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/DependencyInjector.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/DependencyInjector.java index c28927626..85fe3438e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/DependencyInjector.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/DependencyInjector.java @@ -65,7 +65,7 @@ public void setCustomInjector(Callback<Class<?>, Object> callback) { * @return */ @SuppressWarnings("unchecked") - <T> T getInstanceOf(Class<? extends T> type) { + public <T> T getInstanceOf(Class<? extends T> type) { if (isCustomInjectorDefined()) { return (T) customInjector.call(type); } else { diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index e5e6aa19e..2dc922aaf 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -135,21 +135,23 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi throw new IOException("Could not load the controller for the View " + resource + " maybe your missed the fx:controller in your fxml?"); } - - + + // the actually used ViewModel instance. We need this so we can return it in the ViewTuple ViewModelType actualViewModel; // if no existing viewModel was provided... - if(viewModel == null) { + if (viewModel == null) { // ... we try to find the created ViewModel from the codeBehind. // this is only possible when the codeBehind has a field for the VM and the VM was injected actualViewModel = ViewLoaderReflectionUtils.getExistingViewModel(loadedController); - - // otherwise we create a new ViewModel. This is needed because the ViewTuple has to contain a VM even if the codeBehind doesn't need one + + // otherwise we create a new ViewModel. This is needed because the ViewTuple has to contain a VM even if + // the codeBehind doesn't need one if (actualViewModel == null) { actualViewModel = ViewLoaderReflectionUtils.createViewModel(loadedController); } + ViewLoaderReflectionUtils.injectScope(actualViewModel); } else { actualViewModel = viewModel; } @@ -207,7 +209,7 @@ private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBund * a view. */ private static class DefaultControllerFactory implements Callback<Class<?>, Object> { - private ResourceBundle resourceBundle; + private final ResourceBundle resourceBundle; public DefaultControllerFactory(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; @@ -276,9 +278,9 @@ private static class ControllerFactoryForCustomViewModel implements Callback<Cla private boolean customViewModelInjected = false; - private ViewModel customViewModel; + private final ViewModel customViewModel; - private ResourceBundle resourceBundle; + private final ResourceBundle resourceBundle; public ControllerFactoryForCustomViewModel(ViewModel customViewModel, ResourceBundle resourceBundle) { this.customViewModel = customViewModel; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 65a28b6a4..f08943661 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -21,6 +21,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ResourceBundle; + import javafx.fxml.Initializable; import javafx.scene.Parent; @@ -87,6 +88,7 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi if (viewModel != null) { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); + ViewLoaderReflectionUtils.injectScope(viewModel); ViewLoaderReflectionUtils.initializeViewModel(viewModel); ViewLoaderReflectionUtils.injectViewModel(view, viewModel); } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 219aa9796..e0700f20b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -12,6 +12,9 @@ import net.jodah.typetools.TypeResolver; import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; /** @@ -36,34 +39,61 @@ public class ViewLoaderReflectionUtils { public static Optional<Field> getViewModelField(Class<? extends View> viewType, Class<?> viewModelType) { List<Field> allViewModelFields = getViewModelFields(viewType); - if(allViewModelFields.isEmpty()) { + if (allViewModelFields.isEmpty()) { return Optional.empty(); } - + if (allViewModelFields.size() > 1) { throw new RuntimeException("The View <" + viewType + "> may only define one viewModel but there were <" + allViewModelFields.size() + "> viewModel fields with the @InjectViewModel annotation!"); } - + Field field = allViewModelFields.get(0); - if(! ViewModel.class.isAssignableFrom(field.getType())) { - throw new RuntimeException("The View <" + viewType + "> has a field annotated with @InjectViewModel but the type of the field doesn't implement the 'ViewModel' interface!"); + if (!ViewModel.class.isAssignableFrom(field.getType())) { + throw new RuntimeException( + "The View <" + + viewType + + "> has a field annotated with @InjectViewModel but the type of the field doesn't implement the 'ViewModel' interface!"); } - if(! field.getType().isAssignableFrom(viewModelType)) { - throw new RuntimeException("The View <" + viewType + "> has a field annotated with @InjectViewModel but the type of the field doesn't match the generic ViewModel type of the View class. " - + "The declared generic type is <" + viewModelType + "> but the actual type of the field is <" + field.getType() + ">."); + if (!field.getType().isAssignableFrom(viewModelType)) { + throw new RuntimeException( + "The View <" + + viewType + + "> has a field annotated with @InjectViewModel but the type of the field doesn't match the generic ViewModel type of the View class. " + + "The declared generic type is <" + viewModelType + + "> but the actual type of the field is <" + field.getType() + ">."); } - + return Optional.of(field); } - - + + public static List<Field> getScopeFields(Class<?> viewModelType) { + List<Field> allViewModelFields = getScopeFieldsUnchecked(viewModelType); + + allViewModelFields + .stream() + .forEach( + field -> { + if (!Scope.class.isAssignableFrom(field.getType())) { + throw new RuntimeException( + "The ViewModel <" + + viewModelType + + "> has a field annotated with @InjectScope but the type of the field doesn't implement the 'Scope' interface!"); + } + }); + + return allViewModelFields; + } + + /** - * Returns a list of all {@link Field}s of ViewModels for a given view type that are annotated with {@link InjectViewModel}. + * Returns a list of all {@link Field}s of ViewModels for a given view type that are annotated with + * {@link InjectViewModel}. * - * @param viewType the type of the view. + * @param viewType + * the type of the view. * @return a list of fields. */ private static List<Field> getViewModelFields(Class<? extends View> viewType) { @@ -72,6 +102,13 @@ private static List<Field> getViewModelFields(Class<? extends View> viewType) { .collect(Collectors.toList()); } + private static List<Field> getScopeFieldsUnchecked(Class<?> viewModelType) { + return Arrays.stream(viewModelType.getDeclaredFields()) + .filter(field -> field.isAnnotationPresent(InjectViewScope.class)) + .collect(Collectors.toList()); + } + + /** * This method is used to get the ViewModel instance of a given view/codeBehind. @@ -139,8 +176,10 @@ public static void injectViewModel(final View view, ViewModel viewModel) { * the generic type of the ViewModel. * @return an Optional containing the ViewModel if it was created or already existing. Otherwise the Optional is * empty. - * - * @throws RuntimeException if there is a ViewModel field in the View with the {@link InjectViewModel} annotation whose type doesn't match the generic ViewModel type from the View class. + * + * @throws RuntimeException + * if there is a ViewModel field in the View with the {@link InjectViewModel} annotation whose type + * doesn't match the generic ViewModel type from the View class. */ @SuppressWarnings("unchecked") public static <V extends View<? extends VM>, VM extends ViewModel> Optional<VM> createAndInjectViewModel( @@ -187,6 +226,21 @@ public static <V extends View<? extends VM>, VM extends ViewModel> Optional<VM> return Optional.empty(); } + static void injectScope(Object viewModel) { + List<Field> scopeFields = getScopeFields(viewModel.getClass()); + + scopeFields.forEach(scopeField -> { + ReflectionUtils.accessField(scopeField, () -> { + Class<? extends Scope> type = (Class<? extends Scope>) scopeField.getType(); + final Object newScope = ScopeStore.getInstance().getScope(type, ""); + + scopeField.set(viewModel, newScope); + + return newScope; + }, "Can't inject Scope into ViewModel <" + viewModel.getClass()); + }); + } + /** * Creates a viewModel instance for a View type. The type of the view is determined by the given view instance. * diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java new file mode 100644 index 000000000..1bfebfa1e --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java @@ -0,0 +1,78 @@ +package de.saxsys.mvvmfx; + + +import org.junit.Assert; +import org.junit.Test; + +import de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewA; +import de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewB; +import de.saxsys.mvvmfx.internal.viewloader.example.ScopedJavaViewA; +import de.saxsys.mvvmfx.internal.viewloader.example.ScopedJavaViewB; +import de.saxsys.mvvmfx.internal.viewloader.example.ScopedViewModelA; +import de.saxsys.mvvmfx.internal.viewloader.example.ScopedViewModelB; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; + +public class ScopeTest { + + + @Test + public void testJavaScopedView() throws Exception { + + ViewTuple<ScopedJavaViewA, ScopedViewModelA> load1 = FluentViewLoader.javaView(ScopedJavaViewA.class).load(); + ViewTuple<ScopedJavaViewB, ScopedViewModelB> load2 = FluentViewLoader.javaView(ScopedJavaViewB.class).load(); + + TestScope scope1a = load1.getViewModel().getScope(); + TestScope scope2a = load1.getViewModel().getScope2(); + TestScope scope3a = load1.getViewModel().getScope3(); + + TestScope scope1b = load2.getViewModel().getScope(); + TestScope scope2b = load2.getViewModel().getScope2(); + TestScope scope3b = load2.getViewModel().getScope3(); + + Assert.assertNotNull(scope1a); + Assert.assertNotNull(scope2a); + Assert.assertNotNull(scope3a); + Assert.assertNotNull(scope1b); + Assert.assertNotNull(scope2b); + Assert.assertNotNull(scope3b); + + Assert.assertEquals(scope1a, scope1b); + Assert.assertEquals(scope2a, scope2b); + Assert.assertEquals(scope3a, scope3b); + + Assert.assertNotEquals(scope1a, scope2a); + Assert.assertNotEquals(scope1a, scope3a); + Assert.assertNotEquals(scope2a, scope3a); + } + + @Test + public void testFxmlScopedView() throws Exception { + + ViewTuple<ScopedFxmlViewA, ScopedViewModelA> load1 = FluentViewLoader.fxmlView(ScopedFxmlViewA.class).load(); + ViewTuple<ScopedFxmlViewB, ScopedViewModelB> load2 = FluentViewLoader.fxmlView(ScopedFxmlViewB.class).load(); + + TestScope scope1a = load1.getViewModel().getScope(); + TestScope scope2a = load1.getViewModel().getScope2(); + TestScope scope3a = load1.getViewModel().getScope3(); + + TestScope scope1b = load2.getViewModel().getScope(); + TestScope scope2b = load2.getViewModel().getScope2(); + TestScope scope3b = load2.getViewModel().getScope3(); + + Assert.assertNotNull(scope1a); + Assert.assertNotNull(scope2a); + Assert.assertNotNull(scope3a); + Assert.assertNotNull(scope1b); + Assert.assertNotNull(scope2b); + Assert.assertNotNull(scope3b); + + Assert.assertEquals(scope1a, scope1b); + Assert.assertEquals(scope2a, scope2b); + Assert.assertEquals(scope3a, scope3b); + + Assert.assertNotEquals(scope1a, scope2a); + Assert.assertNotEquals(scope1a, scope3a); + Assert.assertNotEquals(scope2a, scope3a); + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java new file mode 100644 index 000000000..f09b55e23 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java @@ -0,0 +1,14 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import de.saxsys.mvvmfx.FxmlView; + + +/** + * This class is used as example View class that uses FXML. + * + * @author manuel.mauky + */ +public class ScopedFxmlViewA implements FxmlView<ScopedViewModelA> { + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java new file mode 100644 index 000000000..09e442e4a --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java @@ -0,0 +1,14 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import de.saxsys.mvvmfx.FxmlView; + + +/** + * This class is used as example View class that uses FXML. + * + * @author manuel.mauky + */ +public class ScopedFxmlViewB implements FxmlView<ScopedViewModelB> { + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java new file mode 100644 index 000000000..a192d284d --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java @@ -0,0 +1,27 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import java.net.URL; +import java.util.ResourceBundle; + +import javafx.fxml.Initializable; +import javafx.scene.layout.VBox; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.JavaView; + +/** + * This class is used as example View class that is written in pure java. + */ +public class ScopedJavaViewA extends VBox implements JavaView<ScopedViewModelA>, Initializable { + @InjectViewModel + public ScopedViewModelA viewModel; + + public ResourceBundle resourceBundle; + + public boolean viewModelWasNull = true; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + this.resourceBundle = resourceBundle; + viewModelWasNull = viewModel == null; + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java new file mode 100644 index 000000000..9e6ec1f1b --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java @@ -0,0 +1,27 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import java.net.URL; +import java.util.ResourceBundle; + +import javafx.fxml.Initializable; +import javafx.scene.layout.VBox; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.JavaView; + +/** + * This class is used as example View class that is written in pure java. + */ +public class ScopedJavaViewB extends VBox implements JavaView<ScopedViewModelB>, Initializable { + @InjectViewModel + public ScopedViewModelB viewModel; + + public ResourceBundle resourceBundle; + + public boolean viewModelWasNull = true; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + this.resourceBundle = resourceBundle; + viewModelWasNull = viewModel == null; + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java new file mode 100644 index 000000000..fd4ec9875 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java @@ -0,0 +1,33 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.ScopeStore; +import de.saxsys.mvvmfx.ViewModel; + +public class ScopedViewModelA implements ViewModel { + + @InjectViewScope + private TestScope scope; + + private final TestScope scope2; + private final TestScope scope3; + + public ScopedViewModelA() { + scope2 = ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); + scope3 = ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); + } + + public TestScope getScope() { + return scope; + } + + public TestScope getScope2() { + return scope2; + } + + public TestScope getScope3() { + return scope3; + } + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java new file mode 100644 index 000000000..fd7288990 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java @@ -0,0 +1,30 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.ScopeStore; +import de.saxsys.mvvmfx.ViewModel; + +public class ScopedViewModelB implements ViewModel { + @InjectViewScope + TestScope scope; + + private final TestScope scope2; + private final TestScope scope3; + + public ScopedViewModelB() { + scope2 = (TestScope) ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); + scope3 = (TestScope) ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); + } + + public TestScope getScope() { + return scope; + } + + public TestScope getScope2() { + return scope2; + } + + public TestScope getScope3() { + return scope3; + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java new file mode 100644 index 000000000..7a775d2ff --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java @@ -0,0 +1,7 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +import de.saxsys.mvvmfx.Scope; + +public class TestScope implements Scope { + +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml new file mode 100644 index 000000000..3747e9805 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewA"> + +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml new file mode 100644 index 000000000..d371a518b --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewB"> + +</VBox> From 00e733bb98a1dd7a886ea8b427d5ba266382c2d9 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 05:51:59 +0100 Subject: [PATCH 02/96] Refactoring + Javadoc --- .../{InjectViewScope.java => InjectScope.java} | 7 ++++++- .../src/main/java/de/saxsys/mvvmfx/Scope.java | 6 ++++++ .../main/java/de/saxsys/mvvmfx/ScopeStore.java | 7 +++++++ .../viewloader/ViewLoaderReflectionUtils.java | 4 ++-- .../viewloader/example/ScopedFxmlViewA.java | 2 +- .../viewloader/example/ScopedFxmlViewB.java | 2 +- .../viewloader/example/ScopedJavaViewA.java | 2 ++ .../viewloader/example/ScopedJavaViewB.java | 2 ++ .../viewloader/example/ScopedViewModelA.java | 8 ++++++-- .../viewloader/example/ScopedViewModelB.java | 17 +++++++++++------ 10 files changed, 44 insertions(+), 13 deletions(-) rename mvvmfx/src/main/java/de/saxsys/mvvmfx/{InjectViewScope.java => InjectScope.java} (77%) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java similarity index 77% rename from mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java rename to mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java index 9d16f70ee..fbfa0ef3e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java @@ -5,7 +5,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * + * @author alexander.casall + * + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) -public @interface InjectViewScope { +public @interface InjectScope { } \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java index b50815834..2921256d2 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java @@ -1,5 +1,11 @@ package de.saxsys.mvvmfx; +/** + * Scope. + * + * @author alexander.casall + * + */ public interface Scope { } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index 1f066fff2..b500eac92 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -6,6 +6,13 @@ import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; +/** + * Scope Store. + * + * @author alexander.casall + * + * @param <V> + */ public class ScopeStore<V extends Scope> { // TODO Memory Leak fixen? diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index e0700f20b..54117d0ed 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -12,7 +12,7 @@ import net.jodah.typetools.TypeResolver; import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; @@ -104,7 +104,7 @@ private static List<Field> getViewModelFields(Class<? extends View> viewType) { private static List<Field> getScopeFieldsUnchecked(Class<?> viewModelType) { return Arrays.stream(viewModelType.getDeclaredFields()) - .filter(field -> field.isAnnotationPresent(InjectViewScope.class)) + .filter(field -> field.isAnnotationPresent(InjectScope.class)) .collect(Collectors.toList()); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java index f09b55e23..ad23a7710 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java @@ -6,7 +6,7 @@ /** * This class is used as example View class that uses FXML. * - * @author manuel.mauky + * @author alexander.casall */ public class ScopedFxmlViewA implements FxmlView<ScopedViewModelA> { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java index 09e442e4a..29d812c9c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java @@ -6,7 +6,7 @@ /** * This class is used as example View class that uses FXML. * - * @author manuel.mauky + * @author alexander.casall */ public class ScopedFxmlViewB implements FxmlView<ScopedViewModelB> { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java index a192d284d..7ed16e10c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java @@ -10,6 +10,8 @@ /** * This class is used as example View class that is written in pure java. + * + * @author alexander.casall */ public class ScopedJavaViewA extends VBox implements JavaView<ScopedViewModelA>, Initializable { @InjectViewModel diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java index 9e6ec1f1b..0a8dd7499 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java @@ -10,6 +10,8 @@ /** * This class is used as example View class that is written in pure java. + * + * @author alexander.casall */ public class ScopedJavaViewB extends VBox implements JavaView<ScopedViewModelB>, Initializable { @InjectViewModel diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java index fd4ec9875..882074440 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java @@ -1,12 +1,16 @@ package de.saxsys.mvvmfx.internal.viewloader.example; -import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; +/** + * + * @author alexander.casall + */ public class ScopedViewModelA implements ViewModel { - @InjectViewScope + @InjectScope private TestScope scope; private final TestScope scope2; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java index fd7288990..126dbba39 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java @@ -1,29 +1,34 @@ package de.saxsys.mvvmfx.internal.viewloader.example; -import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; +/** + * + * @author alexander.casall + * + */ public class ScopedViewModelB implements ViewModel { - @InjectViewScope + @InjectScope TestScope scope; private final TestScope scope2; private final TestScope scope3; public ScopedViewModelB() { - scope2 = (TestScope) ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); - scope3 = (TestScope) ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); + scope2 = ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); + scope3 = ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); } public TestScope getScope() { return scope; } - + public TestScope getScope2() { return scope2; } - + public TestScope getScope3() { return scope3; } From 14de3fe6123d7dd6ccdbf65714a727f0abb395ca Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 05:51:59 +0100 Subject: [PATCH 03/96] Refactoring + renaming https://github.com/sialcasa/mvvmFX/issues/154 --- .../{InjectViewScope.java => InjectScope.java} | 7 ++++++- .../src/main/java/de/saxsys/mvvmfx/Scope.java | 6 ++++++ .../main/java/de/saxsys/mvvmfx/ScopeStore.java | 7 +++++++ .../viewloader/ViewLoaderReflectionUtils.java | 4 ++-- .../viewloader/example/ScopedFxmlViewA.java | 2 +- .../viewloader/example/ScopedFxmlViewB.java | 2 +- .../viewloader/example/ScopedJavaViewA.java | 2 ++ .../viewloader/example/ScopedJavaViewB.java | 2 ++ .../viewloader/example/ScopedViewModelA.java | 8 ++++++-- .../viewloader/example/ScopedViewModelB.java | 17 +++++++++++------ 10 files changed, 44 insertions(+), 13 deletions(-) rename mvvmfx/src/main/java/de/saxsys/mvvmfx/{InjectViewScope.java => InjectScope.java} (77%) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java similarity index 77% rename from mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java rename to mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java index 9d16f70ee..fbfa0ef3e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectViewScope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java @@ -5,7 +5,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * + * @author alexander.casall + * + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) -public @interface InjectViewScope { +public @interface InjectScope { } \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java index b50815834..2921256d2 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java @@ -1,5 +1,11 @@ package de.saxsys.mvvmfx; +/** + * Scope. + * + * @author alexander.casall + * + */ public interface Scope { } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index 1f066fff2..b500eac92 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -6,6 +6,13 @@ import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; +/** + * Scope Store. + * + * @author alexander.casall + * + * @param <V> + */ public class ScopeStore<V extends Scope> { // TODO Memory Leak fixen? diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index e0700f20b..54117d0ed 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -12,7 +12,7 @@ import net.jodah.typetools.TypeResolver; import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; @@ -104,7 +104,7 @@ private static List<Field> getViewModelFields(Class<? extends View> viewType) { private static List<Field> getScopeFieldsUnchecked(Class<?> viewModelType) { return Arrays.stream(viewModelType.getDeclaredFields()) - .filter(field -> field.isAnnotationPresent(InjectViewScope.class)) + .filter(field -> field.isAnnotationPresent(InjectScope.class)) .collect(Collectors.toList()); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java index f09b55e23..ad23a7710 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java @@ -6,7 +6,7 @@ /** * This class is used as example View class that uses FXML. * - * @author manuel.mauky + * @author alexander.casall */ public class ScopedFxmlViewA implements FxmlView<ScopedViewModelA> { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java index 09e442e4a..29d812c9c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java @@ -6,7 +6,7 @@ /** * This class is used as example View class that uses FXML. * - * @author manuel.mauky + * @author alexander.casall */ public class ScopedFxmlViewB implements FxmlView<ScopedViewModelB> { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java index a192d284d..7ed16e10c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java @@ -10,6 +10,8 @@ /** * This class is used as example View class that is written in pure java. + * + * @author alexander.casall */ public class ScopedJavaViewA extends VBox implements JavaView<ScopedViewModelA>, Initializable { @InjectViewModel diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java index 9e6ec1f1b..0a8dd7499 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java @@ -10,6 +10,8 @@ /** * This class is used as example View class that is written in pure java. + * + * @author alexander.casall */ public class ScopedJavaViewB extends VBox implements JavaView<ScopedViewModelB>, Initializable { @InjectViewModel diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java index fd4ec9875..882074440 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java @@ -1,12 +1,16 @@ package de.saxsys.mvvmfx.internal.viewloader.example; -import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; +/** + * + * @author alexander.casall + */ public class ScopedViewModelA implements ViewModel { - @InjectViewScope + @InjectScope private TestScope scope; private final TestScope scope2; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java index fd7288990..126dbba39 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java @@ -1,29 +1,34 @@ package de.saxsys.mvvmfx.internal.viewloader.example; -import de.saxsys.mvvmfx.InjectViewScope; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; +/** + * + * @author alexander.casall + * + */ public class ScopedViewModelB implements ViewModel { - @InjectViewScope + @InjectScope TestScope scope; private final TestScope scope2; private final TestScope scope3; public ScopedViewModelB() { - scope2 = (TestScope) ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); - scope3 = (TestScope) ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); + scope2 = ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); + scope3 = ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); } public TestScope getScope() { return scope; } - + public TestScope getScope2() { return scope2; } - + public TestScope getScope3() { return scope3; } From e0d7634bf6a448b3b8cd2074539b6e1ba588ef77 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 08:14:07 +0100 Subject: [PATCH 04/96] Fixed buildbreak --- mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index b500eac92..8ecc540d9 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -4,13 +4,12 @@ import java.util.Map; import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; /** * Scope Store. * * @author alexander.casall - * + * * @param <V> */ public class ScopeStore<V extends Scope> { @@ -20,7 +19,7 @@ public class ScopeStore<V extends Scope> { private static final ScopeStore INSTANCE = new ScopeStore(); - public static ScopeStore<TestScope> getInstance() { + public static <X extends Scope> ScopeStore<X> getInstance() { return INSTANCE; } From 08509b58c8ab61868bc331bf3952c864ec5ba548 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 08:18:08 +0100 Subject: [PATCH 05/96] Another Buikdbreak --- .../internal/viewloader/example/ScopedViewModelA.java | 4 ++-- .../internal/viewloader/example/ScopedViewModelB.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java index 882074440..ef67ef993 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java @@ -17,8 +17,8 @@ public class ScopedViewModelA implements ViewModel { private final TestScope scope3; public ScopedViewModelA() { - scope2 = ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); - scope3 = ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); + scope2 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId2"); + scope3 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId3"); } public TestScope getScope() { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java index 126dbba39..a130aa25f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java @@ -7,7 +7,7 @@ /** * * @author alexander.casall - * + * */ public class ScopedViewModelB implements ViewModel { @InjectScope @@ -17,8 +17,8 @@ public class ScopedViewModelB implements ViewModel { private final TestScope scope3; public ScopedViewModelB() { - scope2 = ScopeStore.getInstance().getScope(TestScope.class, "coolId2"); - scope3 = ScopeStore.getInstance().getScope(TestScope.class, "coolId3"); + scope2 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId2"); + scope3 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId3"); } public TestScope getScope() { From 9e038333a65e8663c3b104ed8fe61a0e441287d3 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 08:25:52 +0100 Subject: [PATCH 06/96] Fixed NPE when No Viewmodel is given --- .../internal/viewloader/FxmlViewLoader.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 2dc922aaf..ab3cb561a 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -20,15 +20,14 @@ import java.util.Optional; import java.util.ResourceBundle; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.util.Callback; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.util.Callback; /** * This viewLoader is used to load views that are implementing {@link de.saxsys.mvvmfx.FxmlView}. @@ -52,12 +51,12 @@ public class FxmlViewLoader { * the root object that is passed to the {@link javafx.fxml.FXMLLoader} * @param viewModel * the viewModel instance that is used when loading the viewTuple. - * + * * @param <ViewType> * the generic type of the view. * @param <ViewModelType> * the generic type of the viewModel. - * + * * @return the loaded ViewTuple. */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( @@ -102,7 +101,7 @@ private String createFxmlPath(Class<?> viewType) { * * @param resource * the string path to the fxml file that is loaded. - * + * * @param resourceBundle * the resourceBundle that is passed to the {@link javafx.fxml.FXMLLoader}. * @param codeBehind @@ -111,12 +110,12 @@ private String createFxmlPath(Class<?> viewType) { * the root object that is passed to the {@link javafx.fxml.FXMLLoader} * @param viewModel * the viewModel instance that is used when loading the viewTuple. - * + * * @param <ViewType> * the generic type of the view. * @param <ViewModelType> * the generic type of the viewModel. - * + * * @return the loaded ViewTuple. */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( @@ -151,11 +150,12 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi if (actualViewModel == null) { actualViewModel = ViewLoaderReflectionUtils.createViewModel(loadedController); } - ViewLoaderReflectionUtils.injectScope(actualViewModel); } else { actualViewModel = viewModel; } - + if (actualViewModel != null) { + ViewLoaderReflectionUtils.injectScope(actualViewModel); + } return new ViewTuple<>(loadedController, loadedRoot, actualViewModel); @@ -167,8 +167,8 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View codeBehind, Object root, ViewModel viewModel) - throws IOException { - + throws IOException { + // Load FXML file final URL location = FxmlViewLoader.class.getResource(resource); if (location == null) { From 63048b62de2255f75cff1b716158d6e322c28f37 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Tue, 3 Nov 2015 11:22:39 +0100 Subject: [PATCH 07/96] scopeStore can now be mocked --- .../java/de/saxsys/mvvmfx/ScopeStore.java | 37 +++++++++---------- .../viewloader/ViewLoaderReflectionUtils.java | 34 ++++++++--------- .../viewloader/example/ScopedViewModelA.java | 18 +++++++-- .../viewloader/example/ScopedViewModelB.java | 7 +++- 4 files changed, 55 insertions(+), 41 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index 8ecc540d9..a13e361fc 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -1,41 +1,40 @@ package de.saxsys.mvvmfx; +import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; + import java.util.HashMap; import java.util.Map; -import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; - /** * Scope Store. * * @author alexander.casall * - * @param <V> */ -public class ScopeStore<V extends Scope> { +public class ScopeStore { // TODO Memory Leak fixen? private final Map<String, Scope> scopes = new HashMap<>(); private static final ScopeStore INSTANCE = new ScopeStore(); - public static <X extends Scope> ScopeStore<X> getInstance() { + public static ScopeStore getInstance() { return INSTANCE; } - - public V getScope(Class<? extends Scope> scopeType, String id) { - String mapId = scopeType.getName() + id; - - V scope = (V) scopes.get(mapId); - - if (scope == null) { - scope = createScopeInstance(scopeType); - scopes.put(mapId, scope); - } - return scope; - } - - private V createScopeInstance(Class<? extends Scope> scopeType) { + + public <V extends Scope> V getScope(Class<V> scopeType, String id) { + String mapId = scopeType.getName() + id; + + V scope = (V) getInstance().scopes.get(mapId); + + if (scope == null) { + scope = getInstance().createScopeInstance(scopeType); + getInstance().scopes.put(mapId, scope); + } + return scope; + } + + private <V extends Scope> V createScopeInstance(Class<V> scopeType) { return (V) DependencyInjector.getInstance().getInstanceOf(scopeType); } } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 54117d0ed..82566e16d 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -1,5 +1,9 @@ package de.saxsys.mvvmfx.internal.viewloader; +import de.saxsys.mvvmfx.*; +import net.jodah.typetools.TypeResolver; + +import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -10,13 +14,6 @@ import java.util.Optional; import java.util.stream.Collectors; -import net.jodah.typetools.TypeResolver; -import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.Scope; -import de.saxsys.mvvmfx.ScopeStore; -import de.saxsys.mvvmfx.ViewModel; - /** * This class encapsulates reflection related utility operations specific for loading of views. * @@ -70,9 +67,9 @@ public static Optional<Field> getViewModelField(Class<? extends View> viewType, } public static List<Field> getScopeFields(Class<?> viewModelType) { - List<Field> allViewModelFields = getScopeFieldsUnchecked(viewModelType); + final List<Field> allScopeFields = getScopeFieldsUnchecked(viewModelType); - allViewModelFields + allScopeFields .stream() .forEach( field -> { @@ -84,7 +81,7 @@ public static List<Field> getScopeFields(Class<?> viewModelType) { } }); - return allViewModelFields; + return allScopeFields; } @@ -97,16 +94,19 @@ public static List<Field> getScopeFields(Class<?> viewModelType) { * @return a list of fields. */ private static List<Field> getViewModelFields(Class<? extends View> viewType) { - return Arrays.stream(viewType.getDeclaredFields()) - .filter(field -> field.isAnnotationPresent(InjectViewModel.class)) - .collect(Collectors.toList()); + return getFieldsWithAnnotation(viewType, InjectViewModel.class); } private static List<Field> getScopeFieldsUnchecked(Class<?> viewModelType) { - return Arrays.stream(viewModelType.getDeclaredFields()) - .filter(field -> field.isAnnotationPresent(InjectScope.class)) - .collect(Collectors.toList()); + return getFieldsWithAnnotation(viewModelType, InjectScope.class); } + + + private static <T, A extends Annotation> List<Field> getFieldsWithAnnotation(Class<T> classType, Class<A> annotationType) { + return Arrays.stream(classType.getDeclaredFields()) + .filter(field -> field.isAnnotationPresent(annotationType)) + .collect(Collectors.toList()); + } @@ -237,7 +237,7 @@ static void injectScope(Object viewModel) { scopeField.set(viewModel, newScope); return newScope; - }, "Can't inject Scope into ViewModel <" + viewModel.getClass()); + }, "Can't inject Scope into ViewModel <" + viewModel.getClass() + ">"); }); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java index ef67ef993..b40e7ede1 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java @@ -15,11 +15,23 @@ public class ScopedViewModelA implements ViewModel { private final TestScope scope2; private final TestScope scope3; - + + + public static boolean check = false; + + + private ScopeStore scopeStore = new ScopeStore(); + public ScopedViewModelA() { - scope2 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId2"); - scope3 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId3"); + scope2 = scopeStore.getScope(TestScope.class, "coolId2"); + scope3 = scopeStore.getScope(TestScope.class, "coolId3"); } + + + public void initialize() { + check = true; + System.out.println(">" + scope.toString()); + } public TestScope getScope() { return scope; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java index a130aa25f..14b49a2bf 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java @@ -15,10 +15,13 @@ public class ScopedViewModelB implements ViewModel { private final TestScope scope2; private final TestScope scope3; + + + private ScopeStore scopeStore = new ScopeStore(); public ScopedViewModelB() { - scope2 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId2"); - scope3 = ScopeStore.<TestScope> getInstance().getScope(TestScope.class, "coolId3"); + scope2 = scopeStore.getScope(TestScope.class, "coolId2"); + scope3 = scopeStore.getScope(TestScope.class, "coolId3"); } public TestScope getScope() { From 80081bb573f3434ae46d9ebc7ab6fb12cb55da77 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Tue, 3 Nov 2015 21:15:58 +0100 Subject: [PATCH 08/96] extended InjectScope annotation --- .../java/de/saxsys/mvvmfx/InjectScope.java | 7 ++ .../java/de/saxsys/mvvmfx/ScopeStore.java | 20 +++-- .../viewloader/ViewLoaderReflectionUtils.java | 45 +++++++---- .../test/java/de/saxsys/mvvmfx/ScopeTest.java | 78 ------------------- .../viewloader/example/ScopedJavaViewA.java | 29 ------- .../viewloader/example/ScopedJavaViewB.java | 29 ------- .../viewloader/example/ScopedViewModelA.java | 49 ------------ .../viewloader/example/ScopedViewModelB.java | 38 --------- .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 66 ++++++++++++++++ .../example => scopes}/ScopedFxmlViewA.java | 2 +- .../example => scopes}/ScopedFxmlViewB.java | 2 +- .../saxsys/mvvmfx/scopes/ScopedJavaViewA.java | 17 ++++ .../saxsys/mvvmfx/scopes/ScopedJavaViewB.java | 17 ++++ .../mvvmfx/scopes/ScopedViewModelA.java | 36 +++++++++ .../mvvmfx/scopes/ScopedViewModelB.java | 37 +++++++++ .../example => scopes}/ScopedFxmlViewA.fxml | 2 +- .../example => scopes}/ScopedFxmlViewB.fxml | 2 +- 17 files changed, 228 insertions(+), 248 deletions(-) delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java rename mvvmfx/src/test/java/de/saxsys/mvvmfx/{internal/viewloader/example => scopes}/ScopedFxmlViewA.java (79%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/{internal/viewloader/example => scopes}/ScopedFxmlViewB.java (79%) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/{internal/viewloader/example => scopes}/ScopedFxmlViewA.fxml (73%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/{internal/viewloader/example => scopes}/ScopedFxmlViewB.fxml (73%) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java index fbfa0ef3e..5bec70b34 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectScope.java @@ -13,4 +13,11 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface InjectScope { + + /** + * the id of the scope. + * Default is "" which means that the scope is global. + */ + String value() default ""; + } \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index a13e361fc..b6228da9c 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -18,23 +18,29 @@ public class ScopeStore { private static final ScopeStore INSTANCE = new ScopeStore(); - public static ScopeStore getInstance() { + public static ScopeStore getInstance() { return INSTANCE; } + public <V extends Scope> V getScope(Class<V> scopeType) { + return getScope(scopeType, ""); + } + public <V extends Scope> V getScope(Class<V> scopeType, String id) { - String mapId = scopeType.getName() + id; + String mapId = scopeType.getName() + id.trim(); - V scope = (V) getInstance().scopes.get(mapId); - if (scope == null) { - scope = getInstance().createScopeInstance(scopeType); + if(! getInstance().scopes.containsKey(mapId)) { + V scope = getInstance().createScopeInstance(scopeType); getInstance().scopes.put(mapId, scope); } - return scope; + + final V v = (V) getInstance().scopes.get(mapId); + + return v; } private <V extends Scope> V createScopeInstance(Class<V> scopeType) { - return (V) DependencyInjector.getInstance().getInstanceOf(scopeType); + return DependencyInjector.getInstance().getInstanceOf(scopeType); } } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 82566e16d..62be770d0 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -67,7 +67,7 @@ public static Optional<Field> getViewModelField(Class<? extends View> viewType, } public static List<Field> getScopeFields(Class<?> viewModelType) { - final List<Field> allScopeFields = getScopeFieldsUnchecked(viewModelType); + final List<Field> allScopeFields = getFieldsWithAnnotation(viewModelType, InjectScope.class); allScopeFields .stream() @@ -97,11 +97,6 @@ private static List<Field> getViewModelFields(Class<? extends View> viewType) { return getFieldsWithAnnotation(viewType, InjectViewModel.class); } - private static List<Field> getScopeFieldsUnchecked(Class<?> viewModelType) { - return getFieldsWithAnnotation(viewModelType, InjectScope.class); - } - - private static <T, A extends Annotation> List<Field> getFieldsWithAnnotation(Class<T> classType, Class<A> annotationType) { return Arrays.stream(classType.getDeclaredFields()) .filter(field -> field.isAnnotationPresent(annotationType)) @@ -230,16 +225,38 @@ static void injectScope(Object viewModel) { List<Field> scopeFields = getScopeFields(viewModel.getClass()); scopeFields.forEach(scopeField -> { - ReflectionUtils.accessField(scopeField, () -> { - Class<? extends Scope> type = (Class<? extends Scope>) scopeField.getType(); - final Object newScope = ScopeStore.getInstance().getScope(type, ""); - - scopeField.set(viewModel, newScope); - - return newScope; - }, "Can't inject Scope into ViewModel <" + viewModel.getClass() + ">"); + ReflectionUtils.accessField(scopeField, + () -> injectScopeIntoField(scopeField, viewModel), + "Can't inject Scope into ViewModel <" + viewModel.getClass() + ">"); }); } + + static Object injectScopeIntoField(Field scopeField, Object viewModel) throws IllegalAccessException { + Class<? extends Scope> scopeType = (Class<? extends Scope>) scopeField.getType(); + + + final InjectScope[] annotations = scopeField.getAnnotationsByType(InjectScope.class); + + if(annotations.length != 1) { + throw new RuntimeException("A field to inject a Scope into should have exactly one @InjectScope annotation " + + "but the viewModel <" + viewModel + "> has a field that violates this rule."); + } + + Object newScope; + + final String annotationValue = annotations[0].value(); + + if(annotationValue == null || annotationValue.trim().isEmpty()) { + newScope = ScopeStore.getInstance().getScope(scopeType); + } else { + newScope = ScopeStore.getInstance().getScope(scopeType, annotationValue); + } + + + scopeField.set(viewModel, newScope); + + return newScope; + } /** * Creates a viewModel instance for a View type. The type of the view is determined by the given view instance. diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java deleted file mode 100644 index 1bfebfa1e..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/ScopeTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package de.saxsys.mvvmfx; - - -import org.junit.Assert; -import org.junit.Test; - -import de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewA; -import de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewB; -import de.saxsys.mvvmfx.internal.viewloader.example.ScopedJavaViewA; -import de.saxsys.mvvmfx.internal.viewloader.example.ScopedJavaViewB; -import de.saxsys.mvvmfx.internal.viewloader.example.ScopedViewModelA; -import de.saxsys.mvvmfx.internal.viewloader.example.ScopedViewModelB; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; - -public class ScopeTest { - - - @Test - public void testJavaScopedView() throws Exception { - - ViewTuple<ScopedJavaViewA, ScopedViewModelA> load1 = FluentViewLoader.javaView(ScopedJavaViewA.class).load(); - ViewTuple<ScopedJavaViewB, ScopedViewModelB> load2 = FluentViewLoader.javaView(ScopedJavaViewB.class).load(); - - TestScope scope1a = load1.getViewModel().getScope(); - TestScope scope2a = load1.getViewModel().getScope2(); - TestScope scope3a = load1.getViewModel().getScope3(); - - TestScope scope1b = load2.getViewModel().getScope(); - TestScope scope2b = load2.getViewModel().getScope2(); - TestScope scope3b = load2.getViewModel().getScope3(); - - Assert.assertNotNull(scope1a); - Assert.assertNotNull(scope2a); - Assert.assertNotNull(scope3a); - Assert.assertNotNull(scope1b); - Assert.assertNotNull(scope2b); - Assert.assertNotNull(scope3b); - - Assert.assertEquals(scope1a, scope1b); - Assert.assertEquals(scope2a, scope2b); - Assert.assertEquals(scope3a, scope3b); - - Assert.assertNotEquals(scope1a, scope2a); - Assert.assertNotEquals(scope1a, scope3a); - Assert.assertNotEquals(scope2a, scope3a); - } - - @Test - public void testFxmlScopedView() throws Exception { - - ViewTuple<ScopedFxmlViewA, ScopedViewModelA> load1 = FluentViewLoader.fxmlView(ScopedFxmlViewA.class).load(); - ViewTuple<ScopedFxmlViewB, ScopedViewModelB> load2 = FluentViewLoader.fxmlView(ScopedFxmlViewB.class).load(); - - TestScope scope1a = load1.getViewModel().getScope(); - TestScope scope2a = load1.getViewModel().getScope2(); - TestScope scope3a = load1.getViewModel().getScope3(); - - TestScope scope1b = load2.getViewModel().getScope(); - TestScope scope2b = load2.getViewModel().getScope2(); - TestScope scope3b = load2.getViewModel().getScope3(); - - Assert.assertNotNull(scope1a); - Assert.assertNotNull(scope2a); - Assert.assertNotNull(scope3a); - Assert.assertNotNull(scope1b); - Assert.assertNotNull(scope2b); - Assert.assertNotNull(scope3b); - - Assert.assertEquals(scope1a, scope1b); - Assert.assertEquals(scope2a, scope2b); - Assert.assertEquals(scope3a, scope3b); - - Assert.assertNotEquals(scope1a, scope2a); - Assert.assertNotEquals(scope1a, scope3a); - Assert.assertNotEquals(scope2a, scope3a); - } - -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java deleted file mode 100644 index 7ed16e10c..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewA.java +++ /dev/null @@ -1,29 +0,0 @@ -package de.saxsys.mvvmfx.internal.viewloader.example; - -import java.net.URL; -import java.util.ResourceBundle; - -import javafx.fxml.Initializable; -import javafx.scene.layout.VBox; -import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.JavaView; - -/** - * This class is used as example View class that is written in pure java. - * - * @author alexander.casall - */ -public class ScopedJavaViewA extends VBox implements JavaView<ScopedViewModelA>, Initializable { - @InjectViewModel - public ScopedViewModelA viewModel; - - public ResourceBundle resourceBundle; - - public boolean viewModelWasNull = true; - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - this.resourceBundle = resourceBundle; - viewModelWasNull = viewModel == null; - } -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java deleted file mode 100644 index 0a8dd7499..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedJavaViewB.java +++ /dev/null @@ -1,29 +0,0 @@ -package de.saxsys.mvvmfx.internal.viewloader.example; - -import java.net.URL; -import java.util.ResourceBundle; - -import javafx.fxml.Initializable; -import javafx.scene.layout.VBox; -import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.JavaView; - -/** - * This class is used as example View class that is written in pure java. - * - * @author alexander.casall - */ -public class ScopedJavaViewB extends VBox implements JavaView<ScopedViewModelB>, Initializable { - @InjectViewModel - public ScopedViewModelB viewModel; - - public ResourceBundle resourceBundle; - - public boolean viewModelWasNull = true; - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - this.resourceBundle = resourceBundle; - viewModelWasNull = viewModel == null; - } -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java deleted file mode 100644 index b40e7ede1..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelA.java +++ /dev/null @@ -1,49 +0,0 @@ -package de.saxsys.mvvmfx.internal.viewloader.example; - -import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.ScopeStore; -import de.saxsys.mvvmfx.ViewModel; - -/** - * - * @author alexander.casall - */ -public class ScopedViewModelA implements ViewModel { - - @InjectScope - private TestScope scope; - - private final TestScope scope2; - private final TestScope scope3; - - - public static boolean check = false; - - - private ScopeStore scopeStore = new ScopeStore(); - - public ScopedViewModelA() { - scope2 = scopeStore.getScope(TestScope.class, "coolId2"); - scope3 = scopeStore.getScope(TestScope.class, "coolId3"); - } - - - public void initialize() { - check = true; - System.out.println(">" + scope.toString()); - } - - public TestScope getScope() { - return scope; - } - - public TestScope getScope2() { - return scope2; - } - - public TestScope getScope3() { - return scope3; - } - - -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java deleted file mode 100644 index 14b49a2bf..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedViewModelB.java +++ /dev/null @@ -1,38 +0,0 @@ -package de.saxsys.mvvmfx.internal.viewloader.example; - -import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.ScopeStore; -import de.saxsys.mvvmfx.ViewModel; - -/** - * - * @author alexander.casall - * - */ -public class ScopedViewModelB implements ViewModel { - @InjectScope - TestScope scope; - - private final TestScope scope2; - private final TestScope scope3; - - - private ScopeStore scopeStore = new ScopeStore(); - - public ScopedViewModelB() { - scope2 = scopeStore.getScope(TestScope.class, "coolId2"); - scope3 = scopeStore.getScope(TestScope.class, "coolId3"); - } - - public TestScope getScope() { - return scope; - } - - public TestScope getScope2() { - return scope2; - } - - public TestScope getScope3() { - return scope3; - } -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java new file mode 100644 index 000000000..876479c7e --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -0,0 +1,66 @@ +package de.saxsys.mvvmfx.scopes; + + +import de.saxsys.mvvmfx.FluentViewLoader; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ScopeTest { + + @Test + public void testJavaScopedView() throws Exception { + + final ScopedViewModelA viewModelA = FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); + final ScopedViewModelB viewModelB = FluentViewLoader.javaView(ScopedJavaViewB.class).load().getViewModel(); + + verifyScopes(viewModelA, viewModelB); + } + + @Test + public void testFxmlScopedView() throws Exception { + + final ScopedViewModelA viewModelA = FluentViewLoader.fxmlView(ScopedFxmlViewA.class).load().getViewModel(); + final ScopedViewModelB viewModelB = FluentViewLoader.fxmlView(ScopedFxmlViewB.class).load().getViewModel(); + + verifyScopes(viewModelA, viewModelB); + } + + + private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB) { + assertThat(viewModelA.injectedScope1).isNotNull(); + assertThat(viewModelA.injectedScope2).isNotNull(); + assertThat(viewModelA.injectedScope3).isNotNull(); + assertThat(viewModelA.lazyScope1).isNotNull(); + assertThat(viewModelA.lazyScope2).isNotNull(); + assertThat(viewModelA.lazyScope3).isNotNull(); + + + assertThat(viewModelA.injectedScope1).isEqualTo(viewModelA.lazyScope1); + assertThat(viewModelA.injectedScope2).isEqualTo(viewModelA.lazyScope2); + assertThat(viewModelA.injectedScope3).isEqualTo(viewModelA.lazyScope3); + + + assertThat(viewModelB.injectedScope1).isNotNull(); + assertThat(viewModelB.injectedScope2).isNotNull(); + assertThat(viewModelB.injectedScope3).isNotNull(); + assertThat(viewModelB.lazyScope1).isNotNull(); + assertThat(viewModelB.lazyScope2).isNotNull(); + assertThat(viewModelB.lazyScope3).isNotNull(); + + + assertThat(viewModelB.injectedScope1).isEqualTo(viewModelB.lazyScope1); + assertThat(viewModelB.injectedScope2).isEqualTo(viewModelB.lazyScope2); + assertThat(viewModelB.injectedScope3).isEqualTo(viewModelB.lazyScope3); + + + assertThat(viewModelA.injectedScope1).isEqualTo(viewModelB.injectedScope1); + assertThat(viewModelA.injectedScope2).isEqualTo(viewModelB.injectedScope2); + assertThat(viewModelA.injectedScope3).isEqualTo(viewModelB.injectedScope3); + assertThat(viewModelA.lazyScope1).isEqualTo(viewModelB.lazyScope1); + assertThat(viewModelA.lazyScope2).isEqualTo(viewModelB.lazyScope2); + assertThat(viewModelA.lazyScope3).isEqualTo(viewModelB.lazyScope3); + } + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java similarity index 79% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java index ad23a7710..cd8eadf20 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.internal.viewloader.example; +package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java similarity index 79% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java index 29d812c9c..d0487e030 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.internal.viewloader.example; +package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java new file mode 100644 index 000000000..36036983f --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java @@ -0,0 +1,17 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.JavaView; +import javafx.scene.layout.VBox; + +/** + * This class is used as example View class that is written in pure java. + * + * @author alexander.casall + */ +public class ScopedJavaViewA extends VBox implements JavaView<ScopedViewModelA> { + + @InjectViewModel + public ScopedViewModelA viewModel; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java new file mode 100644 index 000000000..0b8520c45 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java @@ -0,0 +1,17 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.JavaView; +import javafx.scene.layout.VBox; + +/** + * This class is used as example View class that is written in pure java. + * + * @author alexander.casall + */ +public class ScopedJavaViewB extends VBox implements JavaView<ScopedViewModelB> { + + @InjectViewModel + public ScopedViewModelB viewModel; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java new file mode 100644 index 000000000..5af7d3c18 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -0,0 +1,36 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeStore; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; + +/** + * + * @author alexander.casall + */ +public class ScopedViewModelA implements ViewModel { + + @InjectScope + public TestScope injectedScope1; + + @InjectScope("coolId2") + public TestScope injectedScope2; + + @InjectScope("coolId3") + public TestScope injectedScope3; + + public final TestScope lazyScope1; + public final TestScope lazyScope2; + public final TestScope lazyScope3; + + + private ScopeStore scopeStore = new ScopeStore(); + + public ScopedViewModelA() { + lazyScope1 = scopeStore.getScope(TestScope.class); + lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); + lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java new file mode 100644 index 000000000..000ae2799 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java @@ -0,0 +1,37 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeStore; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; + +/** + * + * @author alexander.casall + * + */ +public class ScopedViewModelB implements ViewModel { + + @InjectScope + public TestScope injectedScope1; + + @InjectScope("coolId2") + public TestScope injectedScope2; + + @InjectScope("coolId3") + public TestScope injectedScope3; + + public final TestScope lazyScope1; + public final TestScope lazyScope2; + public final TestScope lazyScope3; + + + private ScopeStore scopeStore = new ScopeStore(); + + public ScopedViewModelB () { + lazyScope1 = scopeStore.getScope(TestScope.class); + lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); + lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); + } + +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml similarity index 73% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml index 3747e9805..534458eec 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewA.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewA"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewA"> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml similarity index 73% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml index d371a518b..9e3438afb 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/internal/viewloader/example/ScopedFxmlViewB.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.internal.viewloader.example.ScopedFxmlViewB"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewB"> </VBox> From 0c4b4ca729842484762d6c9a15e20b545e7768c6 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 22:52:29 +0100 Subject: [PATCH 09/96] Changed CSS + Refactored Views --- .../ui/addcontact/AddContactDialog.java | 10 +- .../contacts/ui/detail/DetailView.java | 89 ++++++------- .../contacts/ui/detail/DetailViewModel.java | 120 +++++++++++------- .../contacts/ui/master/MasterViewModel.java | 34 +++-- .../src/main/resources/contacts.css | 19 ++- .../contacts/ui/detail/DetailView.fxml | 37 +++--- .../ui/detail/DetailViewModelTest.java | 21 +-- 7 files changed, 174 insertions(+), 156 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java index 70fc4fcd4..6be0645f0 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java @@ -1,9 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addcontact; -import javafx.fxml.FXML; -import javafx.scene.Parent; -import javafx.stage.Stage; - import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Singleton; @@ -14,6 +10,9 @@ import de.saxsys.mvvmfx.examples.contacts.events.OpenAddContactDialogEvent; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; +import javafx.fxml.FXML; +import javafx.scene.Parent; +import javafx.stage.Stage; @Singleton public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { @@ -22,14 +21,13 @@ public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { @FXML private ContactDialogView contactDialogViewController; - @Inject private Stage primaryStage; @InjectViewModel private AddContactDialogViewModel viewModel; - private Parent root; + private final Parent root; @Inject AddContactDialog() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java index 0790c7c21..20f9e5a73 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java @@ -2,90 +2,69 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; -import javafx.beans.property.SimpleBooleanProperty; +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.utils.commands.Command; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Hyperlink; import javafx.scene.control.Label; - -import de.saxsys.mvvmfx.FxmlView; -import de.saxsys.mvvmfx.InjectViewModel; import javafx.scene.control.Labeled; public class DetailView implements FxmlView<DetailViewModel> { @FXML - public Label nameLabel; - @FXML - public Label birthdayLabel; - @FXML - public Label roleDepartmentLabel; + public Label nameLabel, birthdayLabel, roleDepartmentLabel, phoneLabel, mobileLabel, cityPostalCodeLabel, + streetLabel, countrySubdivisionLabel; @FXML public Hyperlink emailHyperlink; - @FXML - public Label phoneLabel; - @FXML - public Label mobileLabel; - - @FXML - public Label cityPostalCodeLabel; - @FXML - public Label streetLabel; - @FXML - public Label countrySubdivisionLabel; - @FXML - public Button editButton; - @FXML - public Button removeButton; + public Button editButton, removeButton; @InjectViewModel private DetailViewModel viewModel; + private Command removeCommand; + private Command editCommand; + private Command mailCommand; + public void initialize() { - removeButton.disableProperty().bind(viewModel.removeButtonDisabledProperty()); - editButton.disableProperty().bind(viewModel.editButtonDisabledProperty()); + removeCommand = viewModel.getRemoveCommand(); + editCommand = viewModel.getEditCommand(); + mailCommand = viewModel.getEmailLinkCommand(); + removeButton.disableProperty().bind(removeCommand.notExecutableProperty()); + editButton.disableProperty().bind(editCommand.notExecutableProperty()); + nameLabel.setText(""); nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); - initVisibilityBindings(nameLabel); + nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); birthdayLabel.textProperty().bind(viewModel.birthdayLabelTextProperty()); - initVisibilityBindings(birthdayLabel); - roleDepartmentLabel.textProperty().bind(viewModel.roleDepartmentLabelTextProperty()); - initVisibilityBindings(roleDepartmentLabel); - emailHyperlink.textProperty().bind(viewModel.emailLabelTextProperty()); - emailHyperlink.setOnAction(event -> viewModel.onEmailLinkClicked()); - initVisibilityBindings(emailHyperlink); - phoneLabel.textProperty().bind(viewModel.phoneLabelTextProperty()); - initVisibilityBindings(phoneLabel); - mobileLabel.textProperty().bind(viewModel.mobileLabelTextProperty()); - initVisibilityBindings(mobileLabel); - - - // the email hyperlink should always look "unvisited". - emailHyperlink.visitedProperty().bind(new SimpleBooleanProperty(false)); - - cityPostalCodeLabel.textProperty().bind(viewModel.cityPostalcodeLabelTextProperty()); - initVisibilityBindings(cityPostalCodeLabel); - streetLabel.textProperty().bind(viewModel.streetLabelTextProperty()); - initVisibilityBindings(streetLabel); - countrySubdivisionLabel.textProperty().bind(viewModel.countrySubdivisionLabelTextProperty()); + + initVisibilityBindings(nameLabel); + initVisibilityBindings(birthdayLabel); + initVisibilityBindings(roleDepartmentLabel); + initVisibilityBindings(emailHyperlink); + initVisibilityBindings(phoneLabel); + initVisibilityBindings(mobileLabel); + initVisibilityBindings(cityPostalCodeLabel); + initVisibilityBindings(streetLabel); initVisibilityBindings(countrySubdivisionLabel); initIcons(); } private void initVisibilityBindings(Labeled label) { - label.visibleProperty().bind(label.textProperty().isNotEmpty()); + label.visibleProperty().bind(editCommand.executableProperty()); label.managedProperty().bind(label.visibleProperty()); } @@ -95,18 +74,22 @@ private void initIcons() { AwesomeDude.setIcon(emailHyperlink, AwesomeIcon.AT); AwesomeDude.setIcon(mobileLabel, AwesomeIcon.MOBILE_PHONE); AwesomeDude.setIcon(phoneLabel, AwesomeIcon.PHONE); - AwesomeDude.setIcon(editButton, AwesomeIcon.EDIT); AwesomeDude.setIcon(removeButton, AwesomeIcon.TRASH_ALT); } @FXML - public void edit() { - viewModel.editAction(); + public void editAction() { + editCommand.execute(); + } + + @FXML + public void removeAction() { + removeCommand.execute(); } @FXML - public void remove() { - viewModel.removeAction(); + public void mailAction() { + mailCommand.execute(); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index 0f76682f4..8d1e984d5 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -5,16 +5,6 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import javafx.application.HostServices; -import javafx.beans.binding.Bindings; -import javafx.beans.binding.ObjectBinding; -import javafx.beans.binding.StringBinding; -import javafx.beans.property.ReadOnlyBooleanProperty; -import javafx.beans.property.ReadOnlyBooleanWrapper; -import javafx.beans.property.ReadOnlyObjectProperty; -import javafx.beans.property.ReadOnlyStringProperty; -import javafx.beans.property.ReadOnlyStringWrapper; - import javax.annotation.PostConstruct; import javax.enterprise.event.Event; import javax.inject.Inject; @@ -25,26 +15,37 @@ import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; +import de.saxsys.mvvmfx.utils.commands.Action; +import de.saxsys.mvvmfx.utils.commands.Command; +import de.saxsys.mvvmfx.utils.commands.DelegateCommand; +import javafx.application.HostServices; +import javafx.beans.binding.Bindings; +import javafx.beans.binding.ObjectBinding; +import javafx.beans.binding.StringBinding; +import javafx.beans.property.ReadOnlyObjectProperty; +import javafx.beans.property.ReadOnlyStringProperty; +import javafx.beans.property.ReadOnlyStringWrapper; public class DetailViewModel implements ViewModel { private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ISO_DATE; - private ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper birthday = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper roleDepartment = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper email = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper phone = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper mobile = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper birthday = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper roleDepartment = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper email = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper phone = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper mobile = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper cityPostalcode = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper street = new ReadOnlyStringWrapper(); - private ReadOnlyStringWrapper countrySubdivision = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper cityPostalcode = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper street = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper countrySubdivision = new ReadOnlyStringWrapper(); - private ReadOnlyBooleanWrapper removeButtonDisabled = new ReadOnlyBooleanWrapper(); - private ReadOnlyBooleanWrapper editButtonDisabled = new ReadOnlyBooleanWrapper(); + private DelegateCommand editCommand; + private DelegateCommand removeCommand; + private DelegateCommand emailLinkCommand; @Inject private Event<OpenEditContactDialogEvent> openEditEvent; @@ -62,6 +63,40 @@ public class DetailViewModel implements ViewModel { void init() { ReadOnlyObjectProperty<Contact> contactProperty = masterViewModel.selectedContactProperty(); + createBindingsForLabels(contactProperty); + + editCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + Contact selectedContact = masterViewModel.selectedContactProperty().get(); + if (selectedContact != null) { + openEditEvent.fire(new OpenEditContactDialogEvent(selectedContact.getId())); + } + } + }, masterViewModel.selectedContactProperty().isNotNull()); + + removeCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + Contact selectedContact = masterViewModel.selectedContactProperty().get(); + if (selectedContact != null) { + repository.delete(masterViewModel.selectedContactProperty().get()); + } + } + + }, masterViewModel.selectedContactProperty().isNotNull()); + + emailLinkCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + if (email.get() != null && !email.get().trim().isEmpty()) { + hostServices.showDocument("mailto:" + email.get()); + } + } + }); + } + + private void createBindingsForLabels(ReadOnlyObjectProperty<Contact> contactProperty) { name.bind(emptyStringOnNull(map(contactProperty, contact -> { StringBuilder result = new StringBuilder(); @@ -140,10 +175,6 @@ void init() { } return result.toString(); }))); - - - removeButtonDisabled.bind(masterViewModel.selectedContactProperty().isNull()); - editButtonDisabled.bind(masterViewModel.selectedContactProperty().isNull()); } /** @@ -157,31 +188,21 @@ private StringBinding emptyStringOnNull(ObjectBinding<String> source) { } else { return source.get(); } - }, source); + } , source); } - public void onEmailLinkClicked() { - if (email.get() != null && !email.get().trim().isEmpty()) { - hostServices.showDocument("mailto:" + email.get()); - } + public Command getEditCommand() { + return editCommand; } - public void editAction() { - Contact selectedContact = masterViewModel.selectedContactProperty().get(); - if (selectedContact != null) { - openEditEvent.fire(new OpenEditContactDialogEvent(selectedContact.getId())); - } + public Command getRemoveCommand() { + return removeCommand; } - public void removeAction() { - Contact selectedContact = masterViewModel.selectedContactProperty().get(); - if (selectedContact != null) { - repository.delete(masterViewModel.selectedContactProperty().get()); - } + public Command getEmailLinkCommand() { + return emailLinkCommand; } - - public ReadOnlyStringProperty nameLabelTextProperty() { return name.getReadOnlyProperty(); } @@ -218,12 +239,17 @@ public ReadOnlyStringProperty countrySubdivisionLabelTextProperty() { return countrySubdivision.getReadOnlyProperty(); } - - public ReadOnlyBooleanProperty removeButtonDisabledProperty() { - return removeButtonDisabled.getReadOnlyProperty(); + private String trimString(String string) { + if (string == null || string.trim().isEmpty()) { + return ""; + } + return string; } - public ReadOnlyBooleanProperty editButtonDisabledProperty() { - return editButtonDisabled.getReadOnlyProperty(); + private String trimStringWithPostfix(String string, String append) { + if (string == null || string.trim().isEmpty()) { + return ""; + } + return string + append; } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java index 8854ebd0b..2c3a08e06 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java @@ -4,14 +4,6 @@ import java.util.Set; import java.util.function.Consumer; -import javafx.beans.binding.Bindings; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.ReadOnlyObjectProperty; -import javafx.beans.property.ReadOnlyObjectWrapper; -import javafx.beans.property.SimpleObjectProperty; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; - import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; @@ -24,6 +16,13 @@ import de.saxsys.mvvmfx.examples.contacts.events.ContactsUpdatedEvent; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; +import javafx.beans.binding.Bindings; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyObjectProperty; +import javafx.beans.property.ReadOnlyObjectWrapper; +import javafx.beans.property.SimpleObjectProperty; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; @ApplicationScoped @@ -31,11 +30,11 @@ public class MasterViewModel implements ViewModel { private static final Logger LOG = LoggerFactory.getLogger(MasterViewModel.class); - private ObservableList<MasterTableViewModel> contacts = FXCollections.observableArrayList(); + private final ObservableList<MasterTableViewModel> contacts = FXCollections.observableArrayList(); - private ReadOnlyObjectWrapper<Contact> selectedContact = new ReadOnlyObjectWrapper<>(); + private final ReadOnlyObjectWrapper<Contact> selectedContact = new ReadOnlyObjectWrapper<>(); - private ObjectProperty<MasterTableViewModel> selectedTableRow = new SimpleObjectProperty<>(); + private final ObjectProperty<MasterTableViewModel> selectedTableRow = new SimpleObjectProperty<>(); private Optional<Consumer<MasterTableViewModel>> onSelect = Optional.empty(); @@ -52,7 +51,7 @@ public void init() { } else { return repository.findById(selectedTableRow.get().getId()).orElse(null); } - }, selectedTableRow)); + } , selectedTableRow)); } public void onContactsUpdateEvent(@Observes ContactsUpdatedEvent event) { @@ -75,7 +74,7 @@ private void updateContactList() { if (selectedContactId != null) { Optional<MasterTableViewModel> selectedRow = contacts.stream() .filter(row -> row.getId().equals(selectedContactId)).findFirst(); - + if (selectedRow.isPresent()) { onSelect.ifPresent(consumer -> consumer.accept(selectedRow.get())); } else { @@ -98,6 +97,13 @@ public ObjectProperty<MasterTableViewModel> selectedTableRowProperty() { } public ReadOnlyObjectProperty<Contact> selectedContactProperty() { - return selectedContact.getReadOnlyProperty(); + return this.selectedContact.getReadOnlyProperty(); } + + + public Contact getSelectedContact() { + return this.selectedContactProperty().get(); + } + + } diff --git a/examples/contacts-example/src/main/resources/contacts.css b/examples/contacts-example/src/main/resources/contacts.css index 7ea076850..bbd7a0ad6 100644 --- a/examples/contacts-example/src/main/resources/contacts.css +++ b/examples/contacts-example/src/main/resources/contacts.css @@ -1,5 +1,20 @@ - - .invisible-pagination-control .pagination-control { visibility: hidden; +} +.hyperlink:visited { + -fx-text-fill: -fx-text-base-color; +} + +.hyperlink { + -fx-text-fill: -fx-text-base-color; +} + +.hyperlink:focused { + -fx-border-width: 0px; +} +.hyperlink:hover { + -fx-underline: true; +} +.hyperlink:show-mnemonics > .mnemonic-underline { + -fx-stroke: transparent; } \ No newline at end of file diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml index 970dd9da0..efa0c16c1 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml @@ -13,38 +13,35 @@ <?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.VBox?> -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="50.0" minWidth="100.0" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.detail.DetailView"> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="50.0" minWidth="100.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.detail.DetailView"> <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <children> <VBox maxHeight="1.7976931348623157E308" spacing="3.0" VBox.vgrow="ALWAYS"> <children> - <Label fx:id="nameLabel" style="-fx-text-fill: dimgrey; -fx-font-size: 20;" text="name"/> - <Label fx:id="birthdayLabel" text="birthday"/> - <Label fx:id="roleDepartmentLabel" text="role/department"/> - <Hyperlink fx:id="emailHyperlink" text="email address"/> - <Label fx:id="phoneLabel" text="phone number"/> - <Label fx:id="mobileLabel" text="mobile number"/> - <Separator prefWidth="200.0"/> - <Label fx:id="streetLabel" text="street"/> - <Label fx:id="cityPostalCodeLabel" text="city (postalcode)"/> - <Label fx:id="countrySubdivisionLabel" text="country / subdivision"/> + <Label fx:id="nameLabel" style="-fx-text-fill: dimgrey; -fx-font-size: 20;" text="name" /> + <Label fx:id="birthdayLabel" text="birthday" /> + <Label fx:id="roleDepartmentLabel" text="role/department" /> + <Hyperlink fx:id="emailHyperlink" onAction="#mailAction" text="email address" /> + <Label fx:id="phoneLabel" text="phone number" /> + <Label fx:id="mobileLabel" text="mobile number" /> + <Separator prefWidth="200.0" /> + <Label fx:id="streetLabel" text="street" /> + <Label fx:id="cityPostalCodeLabel" text="city (postalcode)" /> + <Label fx:id="countrySubdivisionLabel" text="country / subdivision" /> </children> <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0" /> </padding> </VBox> - <Separator/> + <Separator /> <HBox alignment="CENTER" spacing="5.0"> <children> - <Button fx:id="editButton" mnemonicParsing="false" onAction="#edit" text="%common.edit"/> - <Button fx:id="removeButton" mnemonicParsing="false" onAction="#remove" text="%common.remove"/> + <Button fx:id="editButton" mnemonicParsing="false" onAction="#editAction" text="%common.edit" /> + <Button fx:id="removeButton" mnemonicParsing="false" onAction="#removeAction" text="%common.remove" /> </children> <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> </padding> </HBox> </children> diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java index 0f40b9488..716ca018f 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java @@ -7,15 +7,14 @@ import java.time.LocalDate; -import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.SimpleObjectProperty; - import org.junit.Before; import org.junit.Test; import de.saxsys.mvvmfx.examples.contacts.model.Contact; +import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; public class DetailViewModelTest { @@ -23,7 +22,7 @@ public class DetailViewModelTest { private DetailViewModel viewModel; - private ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(); + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(); private Contact luke; private Contact obi; @@ -51,16 +50,10 @@ public void setup() { @Test public void testRemoveAction() { selectedContact.set(null); - assertThat(viewModel.removeButtonDisabledProperty()).isTrue(); - - + assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isTrue(); selectedContact.set(luke); - assertThat(viewModel.removeButtonDisabledProperty()).isFalse(); - - - - viewModel.removeAction(); - + assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isFalse(); + viewModel.getRemoveCommand().execute(); verify(repository).delete(luke); } From a9213185c22a26a3359f317e39b379081229e003 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Tue, 3 Nov 2015 23:10:46 +0100 Subject: [PATCH 10/96] add notification mechanism to scopes --- .../src/main/java/de/saxsys/mvvmfx/Scope.java | 20 ++++++++++- .../main/java/de/saxsys/mvvmfx/ViewModel.java | 5 ++- .../DefaultNotificationCenter.java | 35 +++++++++---------- .../notifications/NotificationCenter.java | 29 ++++++++------- 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java index 2921256d2..f19c59f65 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java @@ -1,5 +1,7 @@ package de.saxsys.mvvmfx; +import de.saxsys.mvvmfx.utils.notifications.NotificationObserver; + /** * Scope. * @@ -7,5 +9,21 @@ * */ public interface Scope { - + + default void publish(String messageName, Object... payload) { + MvvmFX.getNotificationCenter().publish(this, messageName, payload); + } + + default void subscribe(String messageName, NotificationObserver observer) { + MvvmFX.getNotificationCenter().subscribe(this, messageName, observer); + } + + default void unsubscribe(String messageName, NotificationObserver observer) { + MvvmFX.getNotificationCenter().unsubscribe(this, messageName, observer); + } + + default void unsubscribe(NotificationObserver observer) { + MvvmFX.getNotificationCenter().unsubscribe(this, observer); + } + } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java index 885a9eb29..fe3cbbff2 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java @@ -15,11 +15,10 @@ ******************************************************************************/ package de.saxsys.mvvmfx; -import de.saxsys.mvvmfx.utils.notifications.NotificationTestHelper; -import javafx.application.Platform; import de.saxsys.mvvmfx.internal.viewloader.View; import de.saxsys.mvvmfx.utils.notifications.NotificationCenter; import de.saxsys.mvvmfx.utils.notifications.NotificationObserver; +import de.saxsys.mvvmfx.utils.notifications.NotificationTestHelper; /** * <p> @@ -51,7 +50,7 @@ public interface ViewModel { * * This notification mechanism uses the {@link NotificationCenter} internally with the difference that messages send * by this method aren't globally available. Instead they can only be received by this viewModels {@link #subscribe(String, NotificationObserver)} - * method or when using this viewModel instance as argument to the {@link NotificationCenter#subscribe(ViewModel, String, NotificationObserver)} method. + * method or when using this viewModel instance as argument to the {@link NotificationCenter#subscribe(Object, String, NotificationObserver)} method. * <p> * * See {@link NotificationTestHelper} for a utility that's purpose is to simplify unit tests with notifications. diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java index 23b6f2892..674bfd2c4 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java @@ -15,17 +15,14 @@ ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; -import de.saxsys.mvvmfx.ViewModel; import javafx.application.Platform; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; /** * Default implementation of {@link NotificationCenter}. @@ -41,7 +38,7 @@ class DefaultNotificationCenter implements NotificationCenter { } private final ObserverMap globalObservers = new ObserverMap(); - private final ViewModelObservers viewModelObservers = new ViewModelObservers(); + private final ChannelObserverMap channelObserverMap = new ChannelObserverMap(); @Override public void subscribe(String messageName, NotificationObserver observer) { @@ -67,14 +64,14 @@ public void publish(String messageName, Object... payload) { * This notification will be send to the UI-Thread (if the UI-toolkit was bootstrapped). * If no UI-Toolkit is available the notification will be directly published. This is typically the case in unit tests. * - * @param viewModel the ViewModel + * @param channel the channel * @param messageName the message to sent * @param payload additional arguments to the message */ @Override - public void publish(ViewModel viewModel, String messageName, Object[] payload) { - if(viewModelObservers.containsKey(viewModel)) { - final ObserverMap observerMap = viewModelObservers.get(viewModel); + public void publish(Object channel, String messageName, Object[] payload) { + if(channelObserverMap.containsKey(channel)) { + final ObserverMap observerMap = channelObserverMap.get(channel); if (Platform.isFxApplicationThread()) { publish(messageName, payload, observerMap); @@ -97,28 +94,28 @@ public void publish(ViewModel viewModel, String messageName, Object[] payload) { @Override - public void subscribe(ViewModel viewModel, String messageName, NotificationObserver observer) { - if(!viewModelObservers.containsKey(viewModel)) { - viewModelObservers.put(viewModel, new ObserverMap()); + public void subscribe(Object channel, String messageName, NotificationObserver observer) { + if(!channelObserverMap.containsKey(channel)) { + channelObserverMap.put(channel, new ObserverMap()); } - final ObserverMap observerMap = viewModelObservers.get(viewModel); + final ObserverMap observerMap = channelObserverMap.get(channel); addObserver(messageName, observer, observerMap); } @Override - public void unsubscribe(ViewModel viewModel, String messageName, NotificationObserver observer) { - if(viewModelObservers.containsKey(viewModel)) { - final ObserverMap observerMap = viewModelObservers.get(viewModel); + public void unsubscribe(Object channel, String messageName, NotificationObserver observer) { + if(channelObserverMap.containsKey(channel)) { + final ObserverMap observerMap = channelObserverMap.get(channel); removeObserversForMessageName(messageName, observer, observerMap); } } @Override - public void unsubscribe(ViewModel viewModel, NotificationObserver observer) { - if(viewModelObservers.containsKey(viewModel)){ - ObserverMap observerMap = viewModelObservers.get(viewModel); + public void unsubscribe(Object channel, NotificationObserver observer) { + if(channelObserverMap.containsKey(channel)){ + ObserverMap observerMap = channelObserverMap.get(channel); removeObserverFromObserverMap(observer, observerMap); } } @@ -181,7 +178,7 @@ private class ObserverMap extends HashMap<String, List<NotificationObserver>> { } @SuppressWarnings("serial") - private class ViewModelObservers extends HashMap<ViewModel, ObserverMap> { + private class ChannelObserverMap extends HashMap<Object, ObserverMap> { } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java index 3d50d0509..ed571dc59 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationCenter.java @@ -15,9 +15,6 @@ ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; -import de.saxsys.mvvmfx.ViewModel; - - /** * Central component to provide a notification mechanism. You can add observers by using keys to get notifications for * it. If you want you can pass an @@ -85,45 +82,51 @@ void unsubscribe(String messageName, /** - * Publishes a notification to the {@link ViewModel}-subscribers for the given notificationId. - * + * Publishes a notification on a specific channel. The channel can be any object that can be distinguished by the equals method. + * Only subscribers that use the same channel object can receive the published message. + * + * @param channel + * a channel object. + * * @param messageName * of the notification * @param payload * to be send */ - void publish(ViewModel viewModel, String messageName, Object[] payload); + void publish(Object channel, String messageName, Object[] payload); /** - * Subscribe to a {@link ViewModel}-notification with a given {@link NotificationObserver}. + * + * Subscribe to a notification with a given {@link NotificationObserver} on a specific channel. + * See {@link #publish(Object, String, Object[])} for more information on channels. * - * @param viewModel + * @param channel a channel object * * @param messageName * of the Notification * @param observer * which should execute when the notification occurs */ - void subscribe(ViewModel viewModel, String messageName, + void subscribe(Object channel, String messageName, NotificationObserver observer); /** * Removes a {@link NotificationObserver} for a given messageName. * - * @param viewModel + * @param channel * @param messageName * @param observer */ - void unsubscribe(ViewModel viewModel, String messageName, + void unsubscribe(Object channel, String messageName, NotificationObserver observer); /** * Removes a {@link NotificationObserver} for all messageName. * - * @param viewModel + * @param channel * @param observer */ - void unsubscribe(ViewModel viewModel, + void unsubscribe(Object channel, NotificationObserver observer); } From f496f9f5a22af419530196e02d18cfee82f92385 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 3 Nov 2015 23:41:12 +0100 Subject: [PATCH 11/96] Used scopes in Contacts example --- .../addcontact/AddContactDialogViewModel.java | 31 ++++---- .../ui/addressform/AddressFormViewModel.java | 58 +++++++------- .../ui/contactdialog/ContactDialogView.java | 19 ++--- .../contactdialog/ContactDialogViewModel.java | 75 +++++++------------ .../ui/contactform/ContactFormViewModel.java | 37 ++++++--- .../EditContactDialogViewModel.java | 26 ++++--- .../ui/scopes/ContactDialogScope.java | 60 +++++++++++++++ 7 files changed, 185 insertions(+), 121 deletions(-) create mode 100644 examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index 0f3438e64..e139fbfbf 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -1,25 +1,28 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addcontact; import java.util.ResourceBundle; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; import javax.inject.Inject; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; public class AddContactDialogViewModel implements ViewModel { static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; - private BooleanProperty dialogOpen = new SimpleBooleanProperty(); + private final BooleanProperty dialogOpen = new SimpleBooleanProperty(); @Inject private Repository repository; - private ContactDialogViewModel contactDialogViewModel; + @InjectScope + private ContactDialogScope dialogScope; @Inject private ResourceBundle defaultResourceBundle; @@ -27,25 +30,26 @@ public class AddContactDialogViewModel implements ViewModel { public AddContactDialogViewModel() { dialogOpen.addListener((obs, oldV, newV) -> { if (!newV) { - contactDialogViewModel.resetDialogPage(); + // contactDialogViewModel.resetDialogPage(); + dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); } }); } public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewModel) { - this.contactDialogViewModel = contactDialogViewModel; - contactDialogViewModel.setOkAction(this::addContactAction); contactDialogViewModel.titleTextProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); } public void addContactAction() { - if (contactDialogViewModel.validProperty().get()) { + if (dialogScope.isContactFormValid()) { + + // contactDialogViewModel.getAddressFormViewModel().commitChanges(); + dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); - contactDialogViewModel.getAddressFormViewModel().commitChanges(); - Contact contact = contactDialogViewModel.getContactFormViewModel().getContact(); + Contact contact = dialogScope.getContactToEdit(); repository.save(contact); @@ -54,12 +58,11 @@ public void addContactAction() { } public void openDialog() { - contactDialogViewModel.resetForms(); + // contactDialogViewModel.resetForms(); + dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); Contact contact = new Contact(); - contactDialogViewModel.getContactFormViewModel().initWithContact(contact); - contactDialogViewModel.getAddressFormViewModel().initWithAddress(contact.getAddress()); - + dialogScope.setContactToEdit(contact); this.dialogOpenProperty().set(true); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index cf1af56fe..9bbf22e54 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -3,7 +3,17 @@ import java.util.Optional; import java.util.ResourceBundle; +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Address; +import de.saxsys.mvvmfx.examples.contacts.model.Country; +import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; +import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; +import de.saxsys.mvvmfx.utils.itemlist.ItemList; import javafx.beans.binding.Bindings; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyBooleanProperty; @@ -17,36 +27,27 @@ import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.model.Country; -import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; -import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; -import de.saxsys.mvvmfx.utils.itemlist.ItemList; - public class AddressFormViewModel implements ViewModel { static final String NOTHING_SELECTED_MARKER = "---"; static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; - private ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); private ObservableList<String> countries; private ObservableList<String> subdivisions; - private ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); - private StringProperty street = new SimpleStringProperty(); - private StringProperty postalCode = new SimpleStringProperty(); - private StringProperty city = new SimpleStringProperty(); - private ObjectProperty<Subdivision> subdivision = new SimpleObjectProperty<>(); - private ObjectProperty<Country> country = new SimpleObjectProperty<>(); + private final StringProperty street = new SimpleStringProperty(); + private final StringProperty postalCode = new SimpleStringProperty(); + private final StringProperty city = new SimpleStringProperty(); + private final ObjectProperty<Subdivision> subdivision = new SimpleObjectProperty<>(); + private final ObjectProperty<Country> country = new SimpleObjectProperty<>(); - private StringProperty selectedCountry = new SimpleStringProperty(NOTHING_SELECTED_MARKER); - private StringProperty selectedSubdivision = new SimpleStringProperty(NOTHING_SELECTED_MARKER); + private final StringProperty selectedCountry = new SimpleStringProperty(NOTHING_SELECTED_MARKER); + private final StringProperty selectedSubdivision = new SimpleStringProperty(NOTHING_SELECTED_MARKER); - private ReadOnlyBooleanWrapper loadingInProgress = new ReadOnlyBooleanWrapper(); - private ReadOnlyBooleanWrapper countryInputDisabled = new ReadOnlyBooleanWrapper(); - private ReadOnlyBooleanWrapper subdivisionInputDisabled = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper loadingInProgress = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper countryInputDisabled = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper subdivisionInputDisabled = new ReadOnlyBooleanWrapper(); @Inject CountrySelector countrySelector; @@ -54,6 +55,9 @@ public class AddressFormViewModel implements ViewModel { @Inject ResourceBundle resourceBundle; + @InjectScope + private ContactDialogScope dialogScope; + // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. @@ -64,6 +68,8 @@ public class AddressFormViewModel implements ViewModel { @PostConstruct public void init() { + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); loadingInProgress.bind(countrySelector.inProgressProperty()); countrySelector.init(); @@ -77,7 +83,7 @@ public void init() { Optional<Country> matchingCountry = countrySelector.availableCountries().stream() .filter(country -> newV.equals(country.getName())) .findFirst(); - + if (matchingCountry.isPresent()) { countrySelector.setCountry(matchingCountry.get()); country.set(matchingCountry.get()); @@ -93,7 +99,7 @@ public void init() { if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { Optional<Subdivision> subdivisionOptional = countrySelector.subdivisions().stream() .filter(subdivision -> subdivision.getName().equals(newV)).findFirst(); - + if (subdivisionOptional.isPresent()) { subdivision.set(subdivisionOptional.get()); } else { @@ -129,12 +135,12 @@ private void initCountryList() { countries = createListWithNothingSelectedMarker( mappedList); - + countries.addListener((ListChangeListener<String>) c -> selectedCountry.set(NOTHING_SELECTED_MARKER)); } - public void commitChanges() { + private void commitChanges() { address.setStreet(street.get()); address.setCity(city.get()); address.setPostalcode(postalCode.get()); @@ -225,7 +231,7 @@ public ReadOnlyBooleanProperty subdivisionInputDisabledProperty() { return subdivisionInputDisabled.getReadOnlyProperty(); } - public void resetForm() { + private void resetForm() { street.set(""); city.set(""); postalCode.set(""); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java index faee01cb2..ea940a359 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java @@ -1,11 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactdialog; -import javafx.fxml.FXML; -import javafx.scene.control.Button; -import javafx.scene.control.ContentDisplay; -import javafx.scene.control.Pagination; -import javafx.scene.text.Text; - import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; import de.saxsys.mvvmfx.FluentViewLoader; @@ -16,6 +10,11 @@ import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormView; import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormViewModel; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.ContentDisplay; +import javafx.scene.control.Pagination; +import javafx.scene.text.Text; public class ContactDialogView implements FxmlView<ContactDialogViewModel> { @@ -34,7 +33,6 @@ public class ContactDialogView implements FxmlView<ContactDialogViewModel> { @FXML private Pagination formPagination; - @InjectViewModel private ContactDialogViewModel viewModel; @@ -42,13 +40,10 @@ public class ContactDialogView implements FxmlView<ContactDialogViewModel> { public void initialize() { ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader .fxmlView(ContactFormView.class).load(); - + ViewTuple<AddressFormView, AddressFormViewModel> addressFormTuple = FluentViewLoader .fxmlView(AddressFormView.class).load(); - - viewModel.setContactFormViewModel(contactFormTuple.getViewModel()); - viewModel.setAddressFormViewModel(addressFormTuple.getViewModel()); - + formPagination.getStyleClass().add("invisible-pagination-control"); formPagination.setPageFactory(index -> { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 01c7905e4..9f41afbed 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -1,42 +1,36 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactdialog; +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.binding.Bindings; -import javafx.beans.binding.BooleanBinding; -import javafx.beans.property.*; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.ReadOnlyBooleanProperty; +import javafx.beans.property.ReadOnlyBooleanWrapper; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.beans.value.ObservableBooleanValue; -import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel; -import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormViewModel; - public class ContactDialogViewModel implements ViewModel { - private IntegerProperty dialogPage = new SimpleIntegerProperty(0); + @InjectScope + private ContactDialogScope dialogScope; - private ObjectProperty<ContactFormViewModel> contactFormViewModel = new SimpleObjectProperty<>(); - private ObjectProperty<AddressFormViewModel> addressFormViewModel = new SimpleObjectProperty<>(); + private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); - private ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); - private StringProperty titleText = new SimpleStringProperty(); + private final StringProperty titleText = new SimpleStringProperty(); private Runnable okAction; - // we need this field to prevent the binding from beeing garbage collected - private BooleanBinding viewModelsInitialized; - - public ContactDialogViewModel() { - viewModelsInitialized = contactFormViewModel.isNotNull().and(addressFormViewModel.isNotNull()); - - // as soon as both viewModels are set we add a binding that is true only when both viewModels are valid. - viewModelsInitialized.addListener((obs, oldV, newV) -> { - if (newV) { - valid.bind(Bindings.and(contactFormViewModel.get().validProperty(), addressFormViewModel.get() - .validProperty())); - } else { - valid.unbind(); - } - }); + public void initialize() { + System.out.println(dialogScope); + valid.bind( + Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString(), + (key, payload) -> resetDialogPage()); } public void okAction() { @@ -65,26 +59,11 @@ public void resetDialogPage() { dialogPage.set(0); } - public void resetForms() { - contactFormViewModel.get().resetForm(); - addressFormViewModel.get().resetForm(); - } - - public void setContactFormViewModel(ContactFormViewModel contactFormViewModel) { - this.contactFormViewModel.set(contactFormViewModel); - } + // public void resetForms() { + // contactFormViewModel.get().resetForm(); + // addressFormViewModel.get().resetForm(); + // } - public ContactFormViewModel getContactFormViewModel() { - return contactFormViewModel.get(); - } - - public void setAddressFormViewModel(AddressFormViewModel addressFormViewModel) { - this.addressFormViewModel.set(addressFormViewModel); - } - - public AddressFormViewModel getAddressFormViewModel() { - return addressFormViewModel.get(); - } public IntegerProperty dialogPageProperty() { return dialogPage; @@ -92,7 +71,7 @@ public IntegerProperty dialogPageProperty() { public ObservableBooleanValue okButtonDisabledProperty() { - return Bindings.and(contactFormViewModel.get().validProperty(), addressFormViewModel.get().validProperty()) + return Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty()) .not(); } @@ -101,7 +80,7 @@ public ObservableBooleanValue okButtonVisibleProperty() { } public ObservableBooleanValue nextButtonDisabledProperty() { - return contactFormViewModel.get().validProperty().not(); + return dialogScope.contactFormValidProperty().not(); } public ObservableBooleanValue nextButtonVisibleProperty() { @@ -113,7 +92,7 @@ public ObservableBooleanValue previousButtonVisibleProperty() { } public ObservableBooleanValue previousButtonDisabledProperty() { - return addressFormViewModel.get().validProperty().not(); + return dialogScope.addressFormValidProperty().not(); } public ReadOnlyBooleanProperty validProperty() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index fafb48686..115eed2dd 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -1,38 +1,51 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactform; +import java.time.LocalDate; + +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import de.saxsys.mvvmfx.examples.contacts.ui.validators.BirthdayValidator; import de.saxsys.mvvmfx.examples.contacts.ui.validators.EmailValidator; import de.saxsys.mvvmfx.examples.contacts.ui.validators.PhoneValidator; import de.saxsys.mvvmfx.utils.mapping.ModelWrapper; -import de.saxsys.mvvmfx.utils.validation.*; +import de.saxsys.mvvmfx.utils.validation.CompositeValidator; +import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; +import de.saxsys.mvvmfx.utils.validation.ValidationMessage; +import de.saxsys.mvvmfx.utils.validation.ValidationStatus; +import de.saxsys.mvvmfx.utils.validation.Validator; import javafx.beans.binding.BooleanExpression; import javafx.beans.property.Property; import javafx.beans.property.StringProperty; -import java.time.LocalDate; - public class ContactFormViewModel implements ViewModel { - private ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); + private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); private Validator firstnameValidator; private Validator lastnameValidator; - private Validator emailValidator = new EmailValidator(emailProperty()); - private Validator birthdayValidator = new BirthdayValidator(birthdayProperty()); + private final Validator emailValidator = new EmailValidator(emailProperty()); + private final Validator birthdayValidator = new BirthdayValidator(birthdayProperty()); - private Validator phoneValidator = new PhoneValidator(phoneNumberProperty(), "The phone number is invalid!"); - private Validator mobileValidator = new PhoneValidator(mobileNumberProperty(), "The mobile number is invalid!"); + private final Validator phoneValidator = new PhoneValidator(phoneNumberProperty(), "The phone number is invalid!"); + private final Validator mobileValidator = new PhoneValidator(mobileNumberProperty(), + "The mobile number is invalid!"); + + private final CompositeValidator formValidator = new CompositeValidator(); - private CompositeValidator formValidator = new CompositeValidator(); + @InjectScope + ContactDialogScope dialogScope; public ContactFormViewModel() { + + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); + firstnameValidator = new FunctionBasedValidator<>( firstnameProperty(), firstName -> firstName != null && !firstName.trim().isEmpty(), ValidationMessage.error("Firstname may not be empty")); - - + + lastnameValidator = new FunctionBasedValidator<>(lastnameProperty(), lastName -> { if (lastName == null || lastName.isEmpty()) { return ValidationMessage.error("Lastname may not be empty"); @@ -53,7 +66,7 @@ public ContactFormViewModel() { mobileValidator); } - public void resetForm() { + private void resetForm() { contactWrapper.reset(); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 98df37e86..bf214c31e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -1,22 +1,28 @@ package de.saxsys.mvvmfx.examples.contacts.ui.editcontact; +import java.util.ResourceBundle; + +import javax.inject.Inject; + +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; -import javax.inject.Inject; -import java.util.ResourceBundle; - public class EditContactDialogViewModel implements ViewModel { static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; - private BooleanProperty dialogOpen = new SimpleBooleanProperty(); + private final BooleanProperty dialogOpen = new SimpleBooleanProperty(); @Inject Repository repository; + @InjectScope + private ContactDialogScope dialogScope; + @Inject ResourceBundle defaultResourceBundle; @@ -39,8 +45,10 @@ public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewMo public void applyAction() { if (contactDialogViewModel.validProperty().get()) { - contactDialogViewModel.getAddressFormViewModel().commitChanges(); - repository.save(contactDialogViewModel.getContactFormViewModel().getContact()); + // contactDialogViewModel.getAddressFormViewModel().commitChanges(); + dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); + + repository.save(dialogScope.contactToEditProperty().get()); dialogOpen.set(false); } @@ -48,10 +56,10 @@ public void applyAction() { public void openDialog(String contactId) { - contactDialogViewModel.resetForms(); + dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); + repository.findById(contactId).ifPresent(contact -> { - contactDialogViewModel.getContactFormViewModel().initWithContact(contact); - contactDialogViewModel.getAddressFormViewModel().initWithAddress(contact.getAddress()); + dialogScope.setContactToEdit(contact); dialogOpen.set(true); }); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java new file mode 100644 index 000000000..ac9b3eb17 --- /dev/null +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -0,0 +1,60 @@ +package de.saxsys.mvvmfx.examples.contacts.ui.scopes; + +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.examples.contacts.model.Contact; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleObjectProperty; + +public class ContactDialogScope implements Scope { + + public enum Notifications { + RESET_DIALOG_PAGE, COMMIT, RESET_FORMS; + } + + + private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); + private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); + private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(); + + public BooleanProperty contactFormValidProperty() { + return this.contactFormValid; + } + + public boolean isContactFormValid() { + return this.contactFormValidProperty().get(); + } + + public void setContactFormValid(final boolean contactFormValid) { + this.contactFormValidProperty().set(contactFormValid); + } + + public BooleanProperty addressFormValidProperty() { + return this.addressFormValid; + } + + public boolean isAddressFormValid() { + return this.addressFormValidProperty().get(); + } + + public void setAddressFormValid(final boolean addressFormValid) { + this.addressFormValidProperty().set(addressFormValid); + } + + public ObjectProperty<Contact> contactToEditProperty() { + return this.contactToEdit; + } + + + public Contact getContactToEdit() { + return this.contactToEditProperty().get(); + } + + + public void setContactToEdit(final Contact contactToEdit) { + this.contactToEditProperty().set(contactToEdit); + } + + +} From ceb5ff35a2ac0fc8bd0d82701dd6fcd1577e147b Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Wed, 4 Nov 2015 00:41:46 +0100 Subject: [PATCH 12/96] fix contacts example with scopes --- .../addcontact/AddContactDialogViewModel.java | 8 +-- .../ui/addressform/AddressFormViewModel.java | 57 +++++++++--------- .../contactdialog/ContactDialogViewModel.java | 9 +-- .../ui/contactform/ContactFormViewModel.java | 60 +++++++++---------- .../EditContactDialogViewModel.java | 10 ++-- .../ui/scopes/ContactDialogScope.java | 2 +- .../addressform/AddressFormViewModelTest.java | 27 ++++----- .../ContactDialogViewModelTest.java | 23 ++++--- .../EditContactDialogViewModelTest.java | 11 ++-- .../internal/viewloader/FxmlViewLoader.java | 17 +++--- .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 6 +- .../saxsys/mvvmfx/scopes/ScopedFxmlViewA.java | 5 +- .../saxsys/mvvmfx/scopes/ScopedFxmlViewB.java | 4 +- .../mvvmfx/scopes/ScopesFxmlParentView.java | 13 ++++ .../mvvmfx/scopes/ScopesFxmlParentView.fxml | 9 +++ 15 files changed, 137 insertions(+), 124 deletions(-) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index e139fbfbf..62baa3337 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -1,9 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addcontact; -import java.util.ResourceBundle; - -import javax.inject.Inject; - import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; @@ -13,6 +9,9 @@ import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; +import javax.inject.Inject; +import java.util.ResourceBundle; + public class AddContactDialogViewModel implements ViewModel { static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; @@ -32,6 +31,7 @@ public AddContactDialogViewModel() { if (!newV) { // contactDialogViewModel.resetDialogPage(); dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); + dialogScope.setContactToEdit(null); } }); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index 9bbf22e54..2aa758229 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -1,32 +1,21 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addressform; -import java.util.Optional; -import java.util.ResourceBundle; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.model.Address; -import de.saxsys.mvvmfx.examples.contacts.model.Country; -import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; -import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; +import de.saxsys.mvvmfx.examples.contacts.model.*; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import de.saxsys.mvvmfx.utils.itemlist.ItemList; import javafx.beans.binding.Bindings; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.ReadOnlyBooleanProperty; -import javafx.beans.property.ReadOnlyBooleanWrapper; -import javafx.beans.property.ReadOnlyStringProperty; -import javafx.beans.property.ReadOnlyStringWrapper; -import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; -import javafx.beans.property.StringProperty; +import javafx.beans.binding.ObjectBinding; +import javafx.beans.property.*; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; +import javax.inject.Inject; +import java.util.Optional; +import java.util.ResourceBundle; + public class AddressFormViewModel implements ViewModel { static final String NOTHING_SELECTED_MARKER = "---"; static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; @@ -65,13 +54,25 @@ public class AddressFormViewModel implements ViewModel { // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. private ItemList<Subdivision> subdivisionItemList; private Address address; + + private ObjectBinding<Contact> contactBinding; - @PostConstruct - public void init() { - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); + public void initialize() { + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); - - loadingInProgress.bind(countrySelector.inProgressProperty()); + + dialogScope.contactToEditProperty().addListener((observable, oldValue, newValue) -> { + if(newValue != null) { + if(newValue.getAddress() == null) { + System.out.println("Address is null"); + } else { + initWithAddress(newValue.getAddress()); + } + } + }); + + + loadingInProgress.bind(countrySelector.inProgressProperty()); countrySelector.init(); initSubdivisionLabel(); @@ -112,6 +113,9 @@ public void init() { countryInputDisabled.bind(loadingInProgress); subdivisionInputDisabled.bind(loadingInProgress.or(Bindings.size(subdivisionsList()).lessThanOrEqualTo(1))); + + + dialogScope.addressFormValidProperty().bind(valid); } void initSubdivisionLabel() { @@ -141,6 +145,7 @@ private void initCountryList() { private void commitChanges() { + address.setStreet(street.get()); address.setCity(city.get()); address.setPostalcode(postalCode.get()); @@ -182,11 +187,7 @@ static ObservableList<String> createListWithNothingSelectedMarker(ObservableList return result; } - public ReadOnlyBooleanProperty validProperty() { - return valid.getReadOnlyProperty(); - } - - + public ObservableList<String> countriesList() { return countries; } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 9f41afbed..8588e1b9d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -26,7 +26,6 @@ public class ContactDialogViewModel implements ViewModel { private Runnable okAction; public void initialize() { - System.out.println(dialogScope); valid.bind( Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); dialogScope.subscribe(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString(), @@ -55,16 +54,10 @@ public void nextAction() { } } - public void resetDialogPage() { + private void resetDialogPage() { dialogPage.set(0); } - // public void resetForms() { - // contactFormViewModel.get().resetForm(); - // addressFormViewModel.get().resetForm(); - // } - - public IntegerProperty dialogPageProperty() { return dialogPage; } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index 115eed2dd..8ffe44c38 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -1,7 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactform; -import java.time.LocalDate; - import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; @@ -10,15 +8,12 @@ import de.saxsys.mvvmfx.examples.contacts.ui.validators.EmailValidator; import de.saxsys.mvvmfx.examples.contacts.ui.validators.PhoneValidator; import de.saxsys.mvvmfx.utils.mapping.ModelWrapper; -import de.saxsys.mvvmfx.utils.validation.CompositeValidator; -import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; -import de.saxsys.mvvmfx.utils.validation.ValidationMessage; -import de.saxsys.mvvmfx.utils.validation.ValidationStatus; -import de.saxsys.mvvmfx.utils.validation.Validator; -import javafx.beans.binding.BooleanExpression; +import de.saxsys.mvvmfx.utils.validation.*; import javafx.beans.property.Property; import javafx.beans.property.StringProperty; +import java.time.LocalDate; + public class ContactFormViewModel implements ViewModel { private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); @@ -37,9 +32,6 @@ public class ContactFormViewModel implements ViewModel { ContactDialogScope dialogScope; public ContactFormViewModel() { - - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); - firstnameValidator = new FunctionBasedValidator<>( firstnameProperty(), firstName -> firstName != null && !firstName.trim().isEmpty(), @@ -65,27 +57,39 @@ public ContactFormViewModel() { phoneValidator, mobileValidator); } - + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); + + dialogScope.contactToEditProperty().addListener((observable, oldValue, newValue) -> { + if(newValue != null) { + initWithContact(newValue); + } + }); + + + dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); + } + + private void resetForm() { contactWrapper.reset(); - } + } - public void initWithContact(Contact contact) { + private void initWithContact(Contact contact) { this.contactWrapper.set(contact); this.contactWrapper.reload(); } - - public Contact getContact() { - - if (contactWrapper.get() == null) { - contactWrapper.set(new Contact()); - } - - contactWrapper.commit(); - - return contactWrapper.get(); - } - + + private void commitChanges() { + if (contactWrapper.get() == null) { + contactWrapper.set(new Contact()); + } + + contactWrapper.commit(); + } + public ValidationStatus firstnameValidation() { return firstnameValidator.getValidationStatus(); } @@ -145,8 +149,4 @@ public StringProperty mobileNumberProperty() { public StringProperty phoneNumberProperty() { return contactWrapper.field("phoneNumber", Contact::getPhoneNumber, Contact::setPhoneNumber); } - - public BooleanExpression validProperty() { - return formValidator.getValidationStatus().validProperty(); - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index bf214c31e..961e2638a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -1,9 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.editcontact; -import java.util.ResourceBundle; - -import javax.inject.Inject; - import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Repository; @@ -12,6 +8,9 @@ import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; +import javax.inject.Inject; +import java.util.ResourceBundle; + public class EditContactDialogViewModel implements ViewModel { static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; @@ -37,7 +36,8 @@ public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewMo dialogOpen.addListener((observable, oldValue, newValue) -> { if (!newValue) { - contactDialogViewModel.resetDialogPage(); + dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); + dialogScope.setContactToEdit(null); } }); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index ac9b3eb17..58a698283 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -16,7 +16,7 @@ public enum Notifications { private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); - private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(); + private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); public BooleanProperty contactFormValidProperty() { return this.contactFormValid; diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java index 008df2a7a..1449a0a93 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java @@ -1,27 +1,24 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addressform; -import static de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel.NOTHING_SELECTED_MARKER; -import static de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel.SUBDIVISION_LABEL_KEY; -import static eu.lestard.assertj.javafx.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ListResourceBundle; -import java.util.ResourceBundle; +import de.saxsys.mvvmfx.examples.contacts.model.Country; +import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; +import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; - import org.junit.Before; import org.junit.Test; -import de.saxsys.mvvmfx.examples.contacts.model.Country; -import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; -import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; +import java.util.ListResourceBundle; +import java.util.ResourceBundle; + +import static de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel.NOTHING_SELECTED_MARKER; +import static de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel.SUBDIVISION_LABEL_KEY; +import static eu.lestard.assertj.javafx.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.*; public class AddressFormViewModelTest { @@ -101,7 +98,7 @@ public void testSubdivisionLabel() { @Test public void testCountryAndFederalStateLists() throws Exception { - viewModel.init(); + viewModel.initialize(); assertThat(viewModel.countriesList()).hasSize(3).contains(NOTHING_SELECTED_MARKER, "Austria", "Germany"); assertThat(viewModel.countriesList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java index 976843bf4..012e30167 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java @@ -1,17 +1,14 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactdialog; -import static eu.lestard.assertj.javafx.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - +import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormViewModel; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; - import org.junit.Before; import org.junit.Test; -import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel; -import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormViewModel; +import static eu.lestard.assertj.javafx.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; public class ContactDialogViewModelTest { @@ -27,14 +24,14 @@ public class ContactDialogViewModelTest { public void setup() { contactFormViewModel = mock(ContactFormViewModel.class); - when(contactFormViewModel.validProperty()).thenReturn(contactFormValid); +// when(contactFormViewModel.validProperty()).thenReturn(contactFormValid); addressFormViewModel = mock(AddressFormViewModel.class); - when(addressFormViewModel.validProperty()).thenReturn(addressFormValid); +// when(addressFormViewModel.validProperty()).thenReturn(addressFormValid); viewModel = new ContactDialogViewModel(); - viewModel.setContactFormViewModel(contactFormViewModel); - viewModel.setAddressFormViewModel(addressFormViewModel); +// viewModel.setContactFormViewModel(contactFormViewModel); +// viewModel.setAddressFormViewModel(addressFormViewModel); } @Test @@ -46,10 +43,10 @@ public void testValid() { assertThat(viewModel.validProperty()).isFalse(); - viewModel.setContactFormViewModel(contactFormViewModel); +// viewModel.setContactFormViewModel(contactFormViewModel); assertThat(viewModel.validProperty()).isFalse(); - viewModel.setAddressFormViewModel(addressFormViewModel); +// viewModel.setAddressFormViewModel(addressFormViewModel); assertThat(viewModel.validProperty()).isTrue(); addressFormValid.set(false); diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java index 9c8799583..2605b08f6 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java @@ -16,10 +16,7 @@ import static de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogViewModel.TITLE_LABEL_KEY; import static eu.lestard.assertj.javafx.api.Assertions.assertThat; -import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class EditContactDialogViewModelTest { @@ -59,8 +56,8 @@ protected Object[][] getContents() { contactDialogViewModel = mock(ContactDialogViewModel.class); when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); - when(contactDialogViewModel.getContactFormViewModel()).thenReturn(contactFormViewModel); - when(contactDialogViewModel.getAddressFormViewModel()).thenReturn(addressFormViewModel); +// when(contactDialogViewModel.getContactFormViewModel()).thenReturn(contactFormViewModel); +// when(contactDialogViewModel.getAddressFormViewModel()).thenReturn(addressFormViewModel); when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); viewModel.setContactDialogViewModel(contactDialogViewModel); @@ -77,7 +74,7 @@ public void testOpenDialogSuccess() { viewModel.openDialog(chewie.getId()); - verify(contactFormViewModel).initWithContact(chewie); +// verify(contactFormViewModel).initWithContact(chewie); assertThat(viewModel.dialogOpenProperty()).isTrue(); } @@ -87,7 +84,7 @@ public void testOpenDialogNoSuchContact() { viewModel.openDialog("12345"); - verify(contactFormViewModel, never()).initWithContact(any()); +// verify(contactFormViewModel, never()).initWithContact(any()); assertThat(viewModel.dialogOpenProperty()).isFalse(); } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index ab3cb561a..336fa257d 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -15,19 +15,18 @@ ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; -import java.io.IOException; -import java.net.URL; -import java.util.Optional; -import java.util.ResourceBundle; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.util.Callback; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.URL; +import java.util.Optional; +import java.util.ResourceBundle; /** * This viewLoader is used to load views that are implementing {@link de.saxsys.mvvmfx.FxmlView}. @@ -239,6 +238,7 @@ private static void handleInjection(View codeBehind, ResourceBundle resourceBund final Object viewModel = viewModelOptional.get(); if (viewModel instanceof ViewModel) { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); + ViewLoaderReflectionUtils.injectScope(viewModel); ViewLoaderReflectionUtils.initializeViewModel((ViewModel) viewModel); } } @@ -249,6 +249,7 @@ private static void handleInjection(View codeBehind, ResourceBundle resourceBund if (viewModel != null) { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); + ViewLoaderReflectionUtils.injectScope(viewModel); ViewLoaderReflectionUtils.injectViewModel(codeBehind, viewModel); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index 876479c7e..9020e4fad 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -20,8 +20,10 @@ public void testJavaScopedView() throws Exception { @Test public void testFxmlScopedView() throws Exception { - final ScopedViewModelA viewModelA = FluentViewLoader.fxmlView(ScopedFxmlViewA.class).load().getViewModel(); - final ScopedViewModelB viewModelB = FluentViewLoader.fxmlView(ScopedFxmlViewB.class).load().getViewModel(); + final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class).load().getCodeBehind(); + + final ScopedViewModelA viewModelA = parentView.subviewAController.viewModel; + final ScopedViewModelB viewModelB = parentView.subviewBController.viewModel; verifyScopes(viewModelA, viewModelB); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java index cd8eadf20..b63311951 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java @@ -1,6 +1,7 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; /** @@ -9,6 +10,6 @@ * @author alexander.casall */ public class ScopedFxmlViewA implements FxmlView<ScopedViewModelA> { - - + @InjectViewModel + public ScopedViewModelA viewModel; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java index d0487e030..f2eaf66a9 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java @@ -1,6 +1,7 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; /** @@ -9,6 +10,7 @@ * @author alexander.casall */ public class ScopedFxmlViewB implements FxmlView<ScopedViewModelB> { - + @InjectViewModel + public ScopedViewModelB viewModel; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java new file mode 100644 index 000000000..f5bc4b175 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java @@ -0,0 +1,13 @@ +package de.saxsys.mvvmfx.scopes; + +import javafx.fxml.FXML; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.ViewModel; + +public class ScopesFxmlParentView implements FxmlView<ViewModel> { + @FXML + public ScopedFxmlViewA subviewAController; + @FXML + public ScopedFxmlViewB subviewBController; +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml new file mode 100644 index 000000000..d0a4a08ea --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopesFxmlParentView"> + <children> + <fx:include fx:id="subviewA" source="ScopedFxmlViewA.fxml"/> + <fx:include fx:id="subviewB" source="ScopedFxmlViewB.fxml"/> + </children> +</VBox> \ No newline at end of file From 6a2b33bfbce0db3bf2c1f809f6830a12747c14b6 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Wed, 4 Nov 2015 10:08:54 +0100 Subject: [PATCH 13/96] weakvaluehashmap --- .../mvvmfx/internal/WeakValueHashMap.java | 507 ++++++++++++++++++ 1 file changed, 507 insertions(+) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/WeakValueHashMap.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/WeakValueHashMap.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/WeakValueHashMap.java new file mode 100644 index 000000000..0e57a41ba --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/WeakValueHashMap.java @@ -0,0 +1,507 @@ +package de.saxsys.mvvmfx.internal; +/* + * The contents of this file are subject to the terms + * of the Common Development and Distribution License + * (the "License"). You may not use this file except + * in compliance with the License. + * + * You can obtain a copy of the license at + * glassfish/bootstrap/legal/CDDLv1.0.txt or + * https://glassfish.dev.java.net/public/CDDLv1.0.html. + * See the License for the specific language governing + * permissions and limitations under the License. + * + * When distributing Covered Code, include this CDDL + * HEADER in each file and include the License file at + * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable, + * add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your + * own identifying information: Portions Copyright [yyyy] + * [name of copyright owner] + */ + +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.util.AbstractCollection; +import java.util.AbstractSet; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; + +/** + * A WeakValueHashMap is implemented as a HashMap that maps keys to WeakValues. Because we don't have access to the + * innards of the HashMap, we have to wrap/unwrap value objects with WeakValues on every operation. Fortunately + * WeakValues are small, short-lived objects, so the added allocation overhead is tolerable. This implementaton directly + * extends java.util.HashMap. + * + * @author Markus Fuchs + * @see java.util.HashMap + * @see java.lang.ref.WeakReference + */ + +public class WeakValueHashMap extends HashMap { + + /* Reference queue for cleared WeakValues */ + private final ReferenceQueue queue = new ReferenceQueue(); + + /** + * Returns the number of key-value mappings in this map. + * <p> + * + * @return the number of key-value mappings in this map. + */ + @Override + public int size() { + // delegate to entrySet, as super.size() also counts WeakValues + return entrySet().size(); + } + + /** + * Returns <tt>true</tt> if this map contains no key-value mappings. + * <p> + * + * @return <tt>true</tt> if this map contains no key-value mappings. + */ + @Override + public boolean isEmpty() { + return size() == 0; + } + + /** + * Returns <tt>true</tt> if this map contains a mapping for the specified key. + * <p> + * + * @param key + * key whose presence in this map is to be tested + * @return <tt>true</tt> if this map contains a mapping for the specified key. + */ + @Override + public boolean containsKey(Object key) { + // need to clean up gc'ed values before invoking super method + processQueue(); + return super.containsKey(key); + } + + /** + * Returns <tt>true</tt> if this map maps one or more keys to the specified value. + * <p> + * + * @param value + * value whose presence in this map is to be tested + * @return <tt>true</tt> if this map maps one or more keys to this value. + */ + @Override + public boolean containsValue(Object value) { + return super.containsValue(WeakValue.create(value)); + } + + /** + * Gets the value for the given key. + * <p> + * + * @param key + * key whose associated value, if any, is to be returned + * @return the value to which this map maps the specified key. + */ + @Override + public Object get(Object key) { + // We don't need to remove garbage collected values here; + // if they are garbage collected, the get() method returns null; + // the next put() call with the same key removes the old value + // automatically so that it can be completely garbage collected + return getReferenceObject((WeakReference) super.get(key)); + } + + /** + * Puts a new (key,value) into the map. + * <p> + * + * @param key + * key with which the specified value is to be associated. + * @param value + * value to be associated with the specified key. + * @return previous value associated with specified key, or null if there was no mapping for key or the value has + * been garbage collected by the garbage collector. + */ + @Override + public Object put(Object key, Object value) { + // If the map already contains an equivalent key, the new key + // of a (key, value) pair is NOT stored in the map but the new + // value only. But as the key is strongly referenced by the + // map, it can not be removed from the garbage collector, even + // if the key becomes weakly reachable due to the old + // value. So, it isn't necessary to remove all garbage + // collected values with their keys from the map before the + // new entry is made. We only clean up here to distribute + // clean up calls on different operations. + processQueue(); + + WeakValue oldValue = (WeakValue) super.put(key, WeakValue.create(key, value, queue)); + return getReferenceObject(oldValue); + } + + /** + * Removes key and value for the given key. + * <p> + * + * @param key + * key whose mapping is to be removed from the map. + * @return previous value associated with specified key, or null if there was no mapping for key or the value has + * been garbage collected by the garbage collector. + */ + @Override + public Object remove(Object key) { + return getReferenceObject((WeakReference) super.remove(key)); + } + + /** + * A convenience method to return the object held by the weak reference or <code>null</code> if it does not exist. + */ + private final Object getReferenceObject(WeakReference ref) { + return (ref == null) ? null : ref.get(); + } + + /** + * Removes all garbage collected values with their keys from the map. Since we don't know how much the + * ReferenceQueue.poll() operation costs, we should not call it every map operation. + */ + private void processQueue() { + WeakValue wv = null; + + while ((wv = (WeakValue) this.queue.poll()) != null) { + // "super" is not really necessary but use it + // to be on the safe side + super.remove(wv.key); + } + } + + /* -- Helper classes -- */ + + /** + * We need this special class to keep the backward reference from the value to the key, so that we are able to + * remove the key if the value is garbage collected. + */ + private static class WeakValue extends WeakReference { + /** + * It's the same as the key in the map. We need the key to remove the value if it is garbage collected. + */ + private Object key; + + private WeakValue(Object value) { + super(value); + } + + /** + * Creates a new weak reference without adding it to a ReferenceQueue. + */ + private static WeakValue create(Object value) { + if (value == null) + return null; + else + return new WeakValue(value); + } + + private WeakValue(Object key, Object value, ReferenceQueue queue) { + super(value, queue); + this.key = key; + } + + /** + * Creates a new weak reference and adds it to the given queue. + */ + private static WeakValue create(Object key, Object value, + ReferenceQueue queue) { + if (value == null) + return null; + else + return new WeakValue(key, value, queue); + } + + /** + * A WeakValue is equal to another WeakValue iff they both refer to objects that are, in turn, equal according + * to their own equals methods. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + + if (!(obj instanceof WeakValue)) + return false; + + Object ref1 = this.get(); + Object ref2 = ((WeakValue) obj).get(); + + if (ref1 == ref2) + return true; + + if ((ref1 == null) || (ref2 == null)) + return false; + + return ref1.equals(ref2); + } + + /** + * + */ + @Override + public int hashCode() { + Object ref = this.get(); + + return (ref == null) ? 0 : ref.hashCode(); + } + } + + /** + * Internal class for entries. This class wraps/unwraps the values of the Entry objects returned from the underlying + * map. + */ + private class Entry implements Map.Entry { + private final Map.Entry ent; + private Object value; /* + * Strong reference to value, so that the GC will leave it alone as long as this Entry + * exists + */ + + Entry(Map.Entry ent, Object value) { + this.ent = ent; + this.value = value; + } + + @Override + public Object getKey() { + return ent.getKey(); + } + + @Override + public Object getValue() { + return value; + } + + @Override + public Object setValue(Object value) { + // This call changes the map. Please see the comment on + // the put method for the correctness remark. + Object oldValue = this.value; + this.value = value; + ent.setValue(WeakValue.create(getKey(), value, queue)); + return oldValue; + } + + private boolean valEquals(Object o1, Object o2) { + return (o1 == null) ? (o2 == null) : o1.equals(o2); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Map.Entry)) + return false; + Map.Entry e = (Map.Entry) o; + return (valEquals(ent.getKey(), e.getKey()) + && valEquals(value, e.getValue())); + } + + @Override + public int hashCode() { + Object k; + return ((((k = ent.getKey()) == null) ? 0 : k.hashCode()) + ^ ((value == null) ? 0 : value.hashCode())); + } + + } + + /** + * Internal class for entry sets to unwrap/wrap WeakValues stored in the map. + */ + private class EntrySet extends AbstractSet { + + @Override + public Iterator iterator() { + // remove garbage collected elements + processQueue(); + + return new Iterator() { + Iterator hashIterator = hashEntrySet.iterator(); + Entry next = null; + + @Override + public boolean hasNext() { + if (hashIterator.hasNext()) { + // since we removed garbage collected elements, + // we can simply return the next entry. + Map.Entry ent = (Map.Entry) hashIterator.next(); + WeakValue wv = (WeakValue) ent.getValue(); + Object v = (wv == null) ? null : wv.get(); + next = new Entry(ent, v); + return true; + } + return false; + } + + @Override + public Object next() { + if ((next == null) && !hasNext()) + throw new NoSuchElementException(); + Entry e = next; + next = null; + return e; + } + + @Override + public void remove() { + hashIterator.remove(); + } + + }; + } + + @Override + public boolean isEmpty() { + return !(iterator().hasNext()); + } + + @Override + public int size() { + int j = 0; + for (Iterator i = iterator(); i.hasNext(); i.next()) + j++; + return j; + } + + @Override + public boolean remove(Object o) { + if (!(o instanceof Map.Entry)) + return false; + Map.Entry e = (Map.Entry) o; + Object ek = e.getKey(); + Object ev = e.getValue(); + Object hv = WeakValueHashMap.this.get(ek); + if (hv == null) { + // if the map's value is null, we have to check, if the + // entry's value is null and the map contains the key + if ((ev == null) && WeakValueHashMap.this.containsKey(ek)) { + WeakValueHashMap.this.remove(ek); + return true; + } else { + return false; + } + // otherwise, simply compare the values + } else if (hv.equals(ev)) { + WeakValueHashMap.this.remove(ek); + return true; + } + + return false; + } + + @Override + public int hashCode() { + int h = 0; + for (Iterator i = hashEntrySet.iterator(); i.hasNext();) { + Map.Entry ent = (Map.Entry) i.next(); + Object k; + WeakValue wv = (WeakValue) ent.getValue(); + if (wv == null) + continue; + h += ((((k = ent.getKey()) == null) ? 0 : k.hashCode()) + ^ wv.hashCode()); + } + return h; + } + + } + + // internal helper variable, because we can't access + // entrySet from the superclass inside the EntrySet class + private Set hashEntrySet = null; + // stores the EntrySet instance + private Set entrySet = null; + + /** + * Returns a <code>Set</code> view of the mappings in this map. + * <p> + * + * @return a <code>Set</code> view of the mappings in this map. + */ + @Override + public Set entrySet() { + if (entrySet == null) { + hashEntrySet = super.entrySet(); + entrySet = new EntrySet(); + } + return entrySet; + } + + // stores the value collection + private transient Collection values = null; + + /** + * Returns a <code>Collection</code> view of the values contained in this map. + * <p> + * + * @return a <code>Collection</code> view of the values contained in this map. + */ + @Override + public Collection values() { + // delegates to entrySet, because super method returns + // WeakValues instead of value objects + if (values == null) { + values = new AbstractCollection() { + @Override + public Iterator iterator() { + return new Iterator() { + private final Iterator i = entrySet().iterator(); + + @Override + public boolean hasNext() { + return i.hasNext(); + } + + @Override + public Object next() { + return ((Entry) i.next()).getValue(); + } + + @Override + public void remove() { + i.remove(); + } + }; + } + + @Override + public int size() { + return WeakValueHashMap.this.size(); + } + + @Override + public boolean contains(Object v) { + return WeakValueHashMap.this.containsValue(v); + } + }; + } + return values; + } + +} + From 95d9e1bc6f338944857fd4155b956d7e6fa11a17 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Wed, 4 Nov 2015 10:10:09 +0100 Subject: [PATCH 14/96] WeakHashMap in Scope store --- .../java/de/saxsys/mvvmfx/ScopeStore.java | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index b6228da9c..a7176d927 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -1,45 +1,44 @@ package de.saxsys.mvvmfx; -import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; - -import java.util.HashMap; import java.util.Map; +import de.saxsys.mvvmfx.internal.WeakValueHashMap; +import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; + /** * Scope Store. * * @author alexander.casall - * + * */ public class ScopeStore { - // TODO Memory Leak fixen? - private final Map<String, Scope> scopes = new HashMap<>(); + private final Map<String, Scope> scopes = new WeakValueHashMap(); private static final ScopeStore INSTANCE = new ScopeStore(); public static ScopeStore getInstance() { return INSTANCE; } - - public <V extends Scope> V getScope(Class<V> scopeType) { - return getScope(scopeType, ""); - } - - public <V extends Scope> V getScope(Class<V> scopeType, String id) { - String mapId = scopeType.getName() + id.trim(); - - - if(! getInstance().scopes.containsKey(mapId)) { - V scope = getInstance().createScopeInstance(scopeType); - getInstance().scopes.put(mapId, scope); - } - - final V v = (V) getInstance().scopes.get(mapId); - - return v; - } - + + public <V extends Scope> V getScope(Class<V> scopeType) { + return getScope(scopeType, ""); + } + + public <V extends Scope> V getScope(Class<V> scopeType, String id) { + String mapId = scopeType.getName() + id.trim(); + + + if (!getInstance().scopes.containsKey(mapId)) { + V scope = getInstance().createScopeInstance(scopeType); + getInstance().scopes.put(mapId, scope); + } + + final V v = (V) getInstance().scopes.get(mapId); + + return v; + } + private <V extends Scope> V createScopeInstance(Class<V> scopeType) { return DependencyInjector.getInstance().getInstanceOf(scopeType); } From 589307873d1417693ec29e2805f018dc66c9f4d0 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Wed, 4 Nov 2015 11:00:00 +0100 Subject: [PATCH 15/96] Fixed failing tests in contacts example --- .../ui/addressform/AddressFormViewModel.java | 2 +- .../contactdialog/ContactDialogViewModel.java | 18 +- .../EditContactDialogViewModel.java | 2 +- .../addressform/AddressFormViewModelTest.java | 9 +- .../ContactDialogViewModelTest.java | 259 +++++++++--------- .../EditContactDialogViewModelTest.java | 26 +- 6 files changed, 148 insertions(+), 168 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index 2aa758229..a3b125e5c 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -45,7 +45,7 @@ public class AddressFormViewModel implements ViewModel { ResourceBundle resourceBundle; @InjectScope - private ContactDialogScope dialogScope; + ContactDialogScope dialogScope; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 8588e1b9d..dfb380c99 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -4,18 +4,13 @@ import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.binding.Bindings; -import javafx.beans.property.IntegerProperty; -import javafx.beans.property.ReadOnlyBooleanProperty; -import javafx.beans.property.ReadOnlyBooleanWrapper; -import javafx.beans.property.SimpleIntegerProperty; -import javafx.beans.property.SimpleStringProperty; -import javafx.beans.property.StringProperty; +import javafx.beans.property.*; import javafx.beans.value.ObservableBooleanValue; public class ContactDialogViewModel implements ViewModel { @InjectScope - private ContactDialogScope dialogScope; + ContactDialogScope dialogScope; private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); @@ -24,10 +19,10 @@ public class ContactDialogViewModel implements ViewModel { private final StringProperty titleText = new SimpleStringProperty(); private Runnable okAction; - + public void initialize() { - valid.bind( - Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); + valid.bind( + Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); dialogScope.subscribe(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString(), (key, payload) -> resetDialogPage()); } @@ -64,8 +59,7 @@ public IntegerProperty dialogPageProperty() { public ObservableBooleanValue okButtonDisabledProperty() { - return Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty()) - .not(); + return valid.not(); } public ObservableBooleanValue okButtonVisibleProperty() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 961e2638a..0a0006740 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -20,7 +20,7 @@ public class EditContactDialogViewModel implements ViewModel { Repository repository; @InjectScope - private ContactDialogScope dialogScope; + ContactDialogScope dialogScope; @Inject ResourceBundle defaultResourceBundle; diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java index 1449a0a93..568f5a565 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java @@ -3,6 +3,7 @@ import de.saxsys.mvvmfx.examples.contacts.model.Country; import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -36,6 +37,8 @@ public class AddressFormViewModelTest { private ObservableList<Country> availableCountries = FXCollections.observableArrayList(); private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); + + private ContactDialogScope scope; @Before public void setup() { @@ -73,9 +76,13 @@ protected Object[][] getContents() { subdivisions.clear(); return null; }).when(countrySelector).setCountry(null); - + + + + scope = new ContactDialogScope(); viewModel = new AddressFormViewModel(); + viewModel.dialogScope = scope; viewModel.resourceBundle = resourceBundle; viewModel.countrySelector = countrySelector; } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java index 012e30167..2ff1ddb66 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java @@ -1,154 +1,139 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactdialog; -import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel; -import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; import org.junit.Before; import org.junit.Test; import static eu.lestard.assertj.javafx.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; public class ContactDialogViewModelTest { private ContactDialogViewModel viewModel; + + private ContactDialogScope scope; - private ContactFormViewModel contactFormViewModel; - private AddressFormViewModel addressFormViewModel; - - private BooleanProperty contactFormValid = new SimpleBooleanProperty(); - private BooleanProperty addressFormValid = new SimpleBooleanProperty(); - + private BooleanProperty contactFormValid; + private BooleanProperty addressFormValid; + @Before public void setup() { - - contactFormViewModel = mock(ContactFormViewModel.class); -// when(contactFormViewModel.validProperty()).thenReturn(contactFormValid); - - addressFormViewModel = mock(AddressFormViewModel.class); -// when(addressFormViewModel.validProperty()).thenReturn(addressFormValid); - - viewModel = new ContactDialogViewModel(); -// viewModel.setContactFormViewModel(contactFormViewModel); -// viewModel.setAddressFormViewModel(addressFormViewModel); - } - - @Test - public void testValid() { + scope = new ContactDialogScope(); + contactFormValid = scope.contactFormValidProperty(); + addressFormValid = scope.addressFormValidProperty(); + viewModel = new ContactDialogViewModel(); - - addressFormValid.set(true); - contactFormValid.set(true); - - assertThat(viewModel.validProperty()).isFalse(); - -// viewModel.setContactFormViewModel(contactFormViewModel); - assertThat(viewModel.validProperty()).isFalse(); - -// viewModel.setAddressFormViewModel(addressFormViewModel); - assertThat(viewModel.validProperty()).isTrue(); - - addressFormValid.set(false); - assertThat(viewModel.validProperty()).isFalse(); - - addressFormValid.set(true); - assertThat(viewModel.validProperty()).isTrue(); - - contactFormValid.set(false); - assertThat(viewModel.validProperty()).isFalse(); - - contactFormValid.set(true); - assertThat(viewModel.validProperty()).isTrue(); - } - - @Test - public void testWorkflow() { - assertThat(viewModel.dialogPageProperty()).hasValue(0); - - contactFormValid.set(false); - addressFormValid.set(false); - - // add button is invisible and disabled - assertThat(viewModel.okButtonVisibleProperty()).isFalse(); - assertThat(viewModel.okButtonDisabledProperty()).isTrue(); - - // next button is visible but disabled - assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); - assertThat(viewModel.nextButtonDisabledProperty()).isTrue(); - - // previous button is invisible and disabled - assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); - assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - - - - // now we enter all mandatory values into the form and it is now valid - contactFormValid.set(true); - - // add button is still invisible and disabled - assertThat(viewModel.okButtonVisibleProperty()).isFalse(); - assertThat(viewModel.okButtonDisabledProperty()).isTrue(); - - // next button is visible and now also enabled - assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - - // previous button is invisible and disabled - assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); - assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - - - - // lets go to the next page - viewModel.nextAction(); - - assertThat(viewModel.dialogPageProperty()).hasValue(1); - - // add button is now visible but still disabled - assertThat(viewModel.okButtonVisibleProperty()).isTrue(); - assertThat(viewModel.okButtonDisabledProperty()).isTrue(); - - // next button is invisible and enabled - assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - - // previous button is now visible but still disabled - assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); - assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - - - // lets enter valid address informations... - addressFormValid.set(true); - - // add button is still visible and now also enabled - assertThat(viewModel.okButtonVisibleProperty()).isTrue(); - assertThat(viewModel.okButtonDisabledProperty()).isFalse(); - - // next button is invisible and enabled - assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - - // previous button is still visible and now also enabled - assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); - assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); - - - // lets go back to the previous page. The address form is still valid. - viewModel.previousAction(); - assertThat(viewModel.dialogPageProperty()).hasValue(0); - - // add button is invisible again and but still enabled - assertThat(viewModel.okButtonVisibleProperty()).isFalse(); - assertThat(viewModel.okButtonDisabledProperty()).isFalse(); - - // next button is visible again and still enabled - assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - - // previous button is now invisible but stays enabled - assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); - assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); - + viewModel.dialogScope = scope; + viewModel.initialize(); } + + @Test + public void testValid() { + addressFormValid.set(true); + contactFormValid.set(true); + + assertThat(viewModel.validProperty()).isTrue(); + + addressFormValid.set(false); + assertThat(viewModel.validProperty()).isFalse(); + + addressFormValid.set(true); + assertThat(viewModel.validProperty()).isTrue(); + + contactFormValid.set(false); + assertThat(viewModel.validProperty()).isFalse(); + + contactFormValid.set(true); + assertThat(viewModel.validProperty()).isTrue(); + } + + @Test + public void testWorkflow() { + assertThat(viewModel.dialogPageProperty()).hasValue(0); + + contactFormValid.set(false); + addressFormValid.set(false); + + // add button is invisible and disabled + assertThat(viewModel.okButtonVisibleProperty()).isFalse(); + assertThat(viewModel.okButtonDisabledProperty()).isTrue(); + + // next button is visible but disabled + assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); + assertThat(viewModel.nextButtonDisabledProperty()).isTrue(); + + // previous button is invisible and disabled + assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); + assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); + + + + // now we enter all mandatory values into the form and it is now valid + contactFormValid.set(true); + + // add button is still invisible and disabled + assertThat(viewModel.okButtonVisibleProperty()).isFalse(); + assertThat(viewModel.okButtonDisabledProperty()).isTrue(); + + // next button is visible and now also enabled + assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + + // previous button is invisible and disabled + assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); + assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); + + + + // lets go to the next page + viewModel.nextAction(); + + assertThat(viewModel.dialogPageProperty()).hasValue(1); + + // add button is now visible but still disabled + assertThat(viewModel.okButtonVisibleProperty()).isTrue(); + assertThat(viewModel.okButtonDisabledProperty()).isTrue(); + + // next button is invisible and enabled + assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + + // previous button is now visible but still disabled + assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); + assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); + + + // lets enter valid address informations... + addressFormValid.set(true); + + // add button is still visible and now also enabled + assertThat(viewModel.okButtonVisibleProperty()).isTrue(); + assertThat(viewModel.okButtonDisabledProperty()).isFalse(); + + // next button is invisible and enabled + assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + + // previous button is still visible and now also enabled + assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); + assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); + + + // lets go back to the previous page. The address form is still valid. + viewModel.previousAction(); + assertThat(viewModel.dialogPageProperty()).hasValue(0); + + // add button is invisible again and but still enabled + assertThat(viewModel.okButtonVisibleProperty()).isFalse(); + assertThat(viewModel.okButtonDisabledProperty()).isFalse(); + + // next button is visible again and still enabled + assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + + // previous button is now invisible but stays enabled + assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); + assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); + + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java index 2605b08f6..6183a2014 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java @@ -2,9 +2,8 @@ import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; -import de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleStringProperty; import org.junit.Before; @@ -26,13 +25,14 @@ public class EditContactDialogViewModelTest { private Repository repository; private ContactDialogViewModel contactDialogViewModel; - private ContactFormViewModel contactFormViewModel; - private AddressFormViewModel addressFormViewModel; - - private ResourceBundle resourceBundle; - + + private ContactDialogScope scope; + @Before public void setup() { + scope = new ContactDialogScope(); + + // sadly the ResourceBundle.getString method is final so we can't use mockito ResourceBundle resourceBundle = new ListResourceBundle() { @Override @@ -44,20 +44,16 @@ protected Object[][] getContents() { }; viewModel = new EditContactDialogViewModel(); + viewModel.dialogScope = scope; + viewModel.defaultResourceBundle = resourceBundle; repository = mock(Repository.class); viewModel.repository = repository; - - - contactFormViewModel = mock(ContactFormViewModel.class); - addressFormViewModel = mock(AddressFormViewModel.class); - + contactDialogViewModel = mock(ContactDialogViewModel.class); when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); -// when(contactDialogViewModel.getContactFormViewModel()).thenReturn(contactFormViewModel); -// when(contactDialogViewModel.getAddressFormViewModel()).thenReturn(addressFormViewModel); when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); viewModel.setContactDialogViewModel(contactDialogViewModel); @@ -74,7 +70,6 @@ public void testOpenDialogSuccess() { viewModel.openDialog(chewie.getId()); -// verify(contactFormViewModel).initWithContact(chewie); assertThat(viewModel.dialogOpenProperty()).isTrue(); } @@ -84,7 +79,6 @@ public void testOpenDialogNoSuchContact() { viewModel.openDialog("12345"); -// verify(contactFormViewModel, never()).initWithContact(any()); assertThat(viewModel.dialogOpenProperty()).isFalse(); } From c4a78632d744b20b198f85f3917d7f53aae4cb1c Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sun, 8 Nov 2015 19:19:30 +0100 Subject: [PATCH 16/96] Added Test for the Weak Behavior of the HashMap in the Scope Store --- .../mvvmfx/testingutils/GCVerifier.java | 6 +- .../viewloader/example/TestScope.java | 4 + .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 140 +++++++++++------- .../mvvmfx/scopes/ScopedViewModelA.java | 47 ++++-- .../mvvmfx/scopes/ScopedViewModelB.java | 69 ++++++--- 5 files changed, 171 insertions(+), 95 deletions(-) diff --git a/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java b/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java index 52d153ede..1ab1a5d15 100644 --- a/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java +++ b/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java @@ -22,9 +22,9 @@ * */ public class GCVerifier { - private WeakReference reference; + private final WeakReference reference; - private String objectName; + private final String objectName; GCVerifier(WeakReference reference, String objectName) { this.reference = reference; @@ -36,7 +36,7 @@ public class GCVerifier { * * @param instance * the instance that is verified. - * + * * @return an instance of the {@link GCVerifier} that can be used to verify the garbage collection of the given * instance. */ diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java index 7a775d2ff..022acfc9c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java @@ -1,7 +1,11 @@ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.Scope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; public class TestScope implements Scope { + public BooleanProperty someProperty = new SimpleBooleanProperty(); + } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index 876479c7e..9119f6477 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -1,66 +1,96 @@ package de.saxsys.mvvmfx.scopes; -import de.saxsys.mvvmfx.FluentViewLoader; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.testingutils.GCVerifier; +import javafx.scene.Parent; public class ScopeTest { - + @Test public void testJavaScopedView() throws Exception { - - final ScopedViewModelA viewModelA = FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); - final ScopedViewModelB viewModelB = FluentViewLoader.javaView(ScopedJavaViewB.class).load().getViewModel(); - - verifyScopes(viewModelA, viewModelB); + + final ScopedViewModelA viewModelA = FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); + final ScopedViewModelB viewModelB = FluentViewLoader.javaView(ScopedJavaViewB.class).load().getViewModel(); + + verifyScopes(viewModelA, viewModelB); + } + + @Test + public void testFxmlScopedView() throws Exception { + + final ScopedViewModelA viewModelA = FluentViewLoader.fxmlView(ScopedFxmlViewA.class).load().getViewModel(); + final ScopedViewModelB viewModelB = FluentViewLoader.fxmlView(ScopedFxmlViewB.class).load().getViewModel(); + + verifyScopes(viewModelA, viewModelB); + } + + + private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB) { + assertThat(viewModelA.injectedScope1).isNotNull(); + assertThat(viewModelA.injectedScope2).isNotNull(); + assertThat(viewModelA.injectedScope3).isNotNull(); + assertThat(viewModelA.lazyScope1).isNotNull(); + assertThat(viewModelA.lazyScope2).isNotNull(); + assertThat(viewModelA.lazyScope3).isNotNull(); + + + assertThat(viewModelA.injectedScope1).isEqualTo(viewModelA.lazyScope1); + assertThat(viewModelA.injectedScope2).isEqualTo(viewModelA.lazyScope2); + assertThat(viewModelA.injectedScope3).isEqualTo(viewModelA.lazyScope3); + + + assertThat(viewModelB.injectedScope1).isNotNull(); + assertThat(viewModelB.injectedScope2).isNotNull(); + assertThat(viewModelB.injectedScope3).isNotNull(); + assertThat(viewModelB.lazyScope1).isNotNull(); + assertThat(viewModelB.lazyScope2).isNotNull(); + assertThat(viewModelB.lazyScope3).isNotNull(); + + + assertThat(viewModelB.injectedScope1).isEqualTo(viewModelB.lazyScope1); + assertThat(viewModelB.injectedScope2).isEqualTo(viewModelB.lazyScope2); + assertThat(viewModelB.injectedScope3).isEqualTo(viewModelB.lazyScope3); + + + assertThat(viewModelA.injectedScope1).isEqualTo(viewModelB.injectedScope1); + assertThat(viewModelA.injectedScope2).isEqualTo(viewModelB.injectedScope2); + assertThat(viewModelA.injectedScope3).isEqualTo(viewModelB.injectedScope3); + assertThat(viewModelA.lazyScope1).isEqualTo(viewModelB.lazyScope1); + assertThat(viewModelA.lazyScope2).isEqualTo(viewModelB.lazyScope2); + assertThat(viewModelA.lazyScope3).isEqualTo(viewModelB.lazyScope3); + } + + @Test + public void testMemoryRelease() throws Exception { + ViewTuple<ScopedJavaViewA, ScopedViewModelA> tuple1 = FluentViewLoader.javaView(ScopedJavaViewA.class).load(); + ViewTuple<ScopedJavaViewB, ScopedViewModelB> tuple2 = FluentViewLoader.javaView(ScopedJavaViewB.class).load(); + + ScopedViewModelA viewModelA = tuple1.getViewModel(); + ScopedViewModelB viewModelB = tuple2.getViewModel(); + Parent view1 = tuple1.getView(); + Parent view2 = tuple1.getView(); + + GCVerifier verifyer1 = GCVerifier.create(viewModelA); + GCVerifier verifyer2 = GCVerifier.create(viewModelB); + GCVerifier verifyer3 = GCVerifier.create(view1); + GCVerifier verifyer4 = GCVerifier.create(view2); + + tuple1 = null; + tuple2 = null; + viewModelA = null; + viewModelB = null; + view1 = null; + view2 = null; + + verifyer1.verify(); + verifyer2.verify(); + verifyer3.verify(); + verifyer4.verify(); } - - @Test - public void testFxmlScopedView() throws Exception { - - final ScopedViewModelA viewModelA = FluentViewLoader.fxmlView(ScopedFxmlViewA.class).load().getViewModel(); - final ScopedViewModelB viewModelB = FluentViewLoader.fxmlView(ScopedFxmlViewB.class).load().getViewModel(); - - verifyScopes(viewModelA, viewModelB); - } - - - private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB) { - assertThat(viewModelA.injectedScope1).isNotNull(); - assertThat(viewModelA.injectedScope2).isNotNull(); - assertThat(viewModelA.injectedScope3).isNotNull(); - assertThat(viewModelA.lazyScope1).isNotNull(); - assertThat(viewModelA.lazyScope2).isNotNull(); - assertThat(viewModelA.lazyScope3).isNotNull(); - - - assertThat(viewModelA.injectedScope1).isEqualTo(viewModelA.lazyScope1); - assertThat(viewModelA.injectedScope2).isEqualTo(viewModelA.lazyScope2); - assertThat(viewModelA.injectedScope3).isEqualTo(viewModelA.lazyScope3); - - - assertThat(viewModelB.injectedScope1).isNotNull(); - assertThat(viewModelB.injectedScope2).isNotNull(); - assertThat(viewModelB.injectedScope3).isNotNull(); - assertThat(viewModelB.lazyScope1).isNotNull(); - assertThat(viewModelB.lazyScope2).isNotNull(); - assertThat(viewModelB.lazyScope3).isNotNull(); - - - assertThat(viewModelB.injectedScope1).isEqualTo(viewModelB.lazyScope1); - assertThat(viewModelB.injectedScope2).isEqualTo(viewModelB.lazyScope2); - assertThat(viewModelB.injectedScope3).isEqualTo(viewModelB.lazyScope3); - - - assertThat(viewModelA.injectedScope1).isEqualTo(viewModelB.injectedScope1); - assertThat(viewModelA.injectedScope2).isEqualTo(viewModelB.injectedScope2); - assertThat(viewModelA.injectedScope3).isEqualTo(viewModelB.injectedScope3); - assertThat(viewModelA.lazyScope1).isEqualTo(viewModelB.lazyScope1); - assertThat(viewModelA.lazyScope2).isEqualTo(viewModelB.lazyScope2); - assertThat(viewModelA.lazyScope3).isEqualTo(viewModelB.lazyScope3); - } - - } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 5af7d3c18..fa2ebe5d2 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -4,6 +4,9 @@ import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.value.ChangeListener; /** * @@ -13,24 +16,42 @@ public class ScopedViewModelA implements ViewModel { @InjectScope public TestScope injectedScope1; - - @InjectScope("coolId2") - public TestScope injectedScope2; - - @InjectScope("coolId3") - public TestScope injectedScope3; - + + @InjectScope("coolId2") + public TestScope injectedScope2; + + @InjectScope("coolId3") + public TestScope injectedScope3; + public final TestScope lazyScope1; public final TestScope lazyScope2; public final TestScope lazyScope3; - - - private ScopeStore scopeStore = new ScopeStore(); - + + + private final ScopeStore scopeStore = new ScopeStore(); + + private final BooleanProperty reference = new SimpleBooleanProperty(); + public ScopedViewModelA() { - lazyScope1 = scopeStore.getScope(TestScope.class); + lazyScope1 = scopeStore.getScope(TestScope.class); lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); } - + + public void initialize() { + // Create Potential Memory Leaks + injectedScope1.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + injectedScope2.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + injectedScope3.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + lazyScope1.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + lazyScope2.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + lazyScope3.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + } + } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java index 000ae2799..966107101 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java @@ -4,34 +4,55 @@ import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.value.ChangeListener; /** * * @author alexander.casall - * + * */ public class ScopedViewModelB implements ViewModel { - - @InjectScope - public TestScope injectedScope1; - - @InjectScope("coolId2") - public TestScope injectedScope2; - - @InjectScope("coolId3") - public TestScope injectedScope3; - - public final TestScope lazyScope1; - public final TestScope lazyScope2; - public final TestScope lazyScope3; - - - private ScopeStore scopeStore = new ScopeStore(); - - public ScopedViewModelB () { - lazyScope1 = scopeStore.getScope(TestScope.class); - lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); - lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); - } - + + @InjectScope + public TestScope injectedScope1; + + @InjectScope("coolId2") + public TestScope injectedScope2; + + @InjectScope("coolId3") + public TestScope injectedScope3; + + public final TestScope lazyScope1; + public final TestScope lazyScope2; + public final TestScope lazyScope3; + + + private final ScopeStore scopeStore = new ScopeStore(); + + private final BooleanProperty reference = new SimpleBooleanProperty(); + + public ScopedViewModelB() { + lazyScope1 = scopeStore.getScope(TestScope.class); + lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); + lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); + } + + public void initialize() { + // Create Potential Memory Leaks + injectedScope1.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + injectedScope2.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + injectedScope3.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + lazyScope1.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + lazyScope2.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + lazyScope3.someProperty + .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + } + } From 73461fc986388b9a6f7c258ad88c0ad5dcbd9da0 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 10 Nov 2015 13:24:50 +0100 Subject: [PATCH 17/96] Added missing licence headers --- mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java | 15 +++++++++++++++ .../main/java/de/saxsys/mvvmfx/ScopeStore.java | 15 +++++++++++++++ .../saxsys/mvvmfx/internal/MvvmfxApplication.java | 15 +++++++++++++++ .../internal/viewloader/ReflectionUtils.java | 15 +++++++++++++++ .../viewloader/ResourceBundleInjector.java | 15 +++++++++++++++ .../viewloader/ResourceBundleManager.java | 15 +++++++++++++++ .../viewloader/ViewLoaderReflectionUtils.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/utils/commands/Action.java | 15 +++++++++++++++ .../saxsys/mvvmfx/utils/mapping/ModelWrapper.java | 15 +++++++++++++++ .../mapping/accessorfunctions/BooleanGetter.java | 15 +++++++++++++++ .../BooleanPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/BooleanSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/DoubleGetter.java | 15 +++++++++++++++ .../accessorfunctions/DoublePropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/DoubleSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/FloatGetter.java | 15 +++++++++++++++ .../accessorfunctions/FloatPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/FloatSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/IntGetter.java | 15 +++++++++++++++ .../accessorfunctions/IntPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/IntSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/ListGetter.java | 15 +++++++++++++++ .../accessorfunctions/ListPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/ListSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/LongGetter.java | 15 +++++++++++++++ .../accessorfunctions/LongPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/LongSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/ObjectGetter.java | 15 +++++++++++++++ .../accessorfunctions/ObjectPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/ObjectSetter.java | 15 +++++++++++++++ .../mapping/accessorfunctions/StringGetter.java | 15 +++++++++++++++ .../accessorfunctions/StringPropertyAccessor.java | 15 +++++++++++++++ .../mapping/accessorfunctions/StringSetter.java | 15 +++++++++++++++ .../notifications/NotificationTestHelper.java | 15 +++++++++++++++ .../validation/CompositeValidationResult.java | 15 +++++++++++++++ .../utils/validation/CompositeValidator.java | 15 +++++++++++++++ .../utils/validation/FunctionBasedValidator.java | 15 +++++++++++++++ .../validation/ObservableRuleBasedValidator.java | 15 +++++++++++++++ .../mvvmfx/utils/validation/ObservableRules.java | 15 +++++++++++++++ .../saxsys/mvvmfx/utils/validation/Severity.java | 15 +++++++++++++++ .../utils/validation/ValidationMessage.java | 15 +++++++++++++++ .../mvvmfx/utils/validation/ValidationStatus.java | 15 +++++++++++++++ .../saxsys/mvvmfx/utils/validation/Validator.java | 15 +++++++++++++++ .../visualization/ControlsFxVisualizer.java | 15 +++++++++++++++ .../visualization/ValidationVisualizer.java | 15 +++++++++++++++ .../visualization/ValidationVisualizerBase.java | 15 +++++++++++++++ .../viewlist/CachedViewModelCellFactory.java | 15 +++++++++++++++ .../src/test/java/FxmlViewInDefaultPackage.java | 15 +++++++++++++++ .../test/java/FxmlViewinDefaultPackageTest.java | 15 +++++++++++++++ .../viewloader/FluentViewLoader_API_Test.java | 15 +++++++++++++++ .../FluentViewLoader_JavaView_Test.java | 15 +++++++++++++++ .../FluentViewLoader_ResourceBundle_Test.java | 15 +++++++++++++++ .../viewloader/MockableViewLoaderTest.java | 15 +++++++++++++++ .../internal/viewloader/ResourceBundleAssert.java | 15 +++++++++++++++ .../viewloader/ResourceBundleInjectorTest.java | 15 +++++++++++++++ .../viewloader/ResourceBundleManagerTest.java | 15 +++++++++++++++ .../viewloader/ViewLoaderReflectionUtilsTest.java | 15 +++++++++++++++ .../viewloader/example/InvalidFxmlTestView.java | 15 +++++++++++++++ .../internal/viewloader/example/TestFxmlView.java | 15 +++++++++++++++ .../viewloader/example/TestFxmlViewFxRoot.java | 15 +++++++++++++++ .../example/TestFxmlViewMultipleViewModels.java | 15 +++++++++++++++ .../example/TestFxmlViewResourceBundle.java | 15 +++++++++++++++ ...stFxmlViewResourceBundleWithoutController.java | 15 +++++++++++++++ .../example/TestFxmlViewWithActionMethod.java | 15 +++++++++++++++ .../TestFxmlViewWithMissingController.java | 15 +++++++++++++++ .../TestFxmlViewWithWrongAnnotationUsage.java | 15 +++++++++++++++ .../example/TestFxmlViewWithWrongController.java | 15 +++++++++++++++ .../TestFxmlViewWithWrongInjectedViewModel.java | 15 +++++++++++++++ .../TestFxmlViewWithoutViewModelField.java | 15 +++++++++++++++ .../example/TestFxmlViewWithoutViewModelType.java | 15 +++++++++++++++ .../internal/viewloader/example/TestJavaView.java | 15 +++++++++++++++ .../internal/viewloader/example/TestScope.java | 15 +++++++++++++++ .../internal/viewloader/example/TestViewA.java | 15 +++++++++++++++ .../internal/viewloader/example/TestViewB.java | 15 +++++++++++++++ .../viewloader/example/TestViewModel.java | 15 +++++++++++++++ .../viewloader/example/TestViewModelA.java | 15 +++++++++++++++ .../viewloader/example/TestViewModelB.java | 15 +++++++++++++++ .../example/TestViewModelWithResourceBundle.java | 15 +++++++++++++++ .../global/GlobalResourceBundleTest.java | 15 +++++++++++++++ .../mvvmfx/resourcebundle/global/TestView.java | 15 +++++++++++++++ .../resourcebundle/global/TestViewModel.java | 15 +++++++++++++++ .../resourcebundle/included/IncludedView.java | 15 +++++++++++++++ .../included/IncludedViewModel.java | 15 +++++++++++++++ .../included/IncludedViewsTest.java | 15 +++++++++++++++ .../mvvmfx/resourcebundle/included/RootView.java | 15 +++++++++++++++ .../resourcebundle/included/RootViewModel.java | 15 +++++++++++++++ .../java/de/saxsys/mvvmfx/scopes/ScopeTest.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/scopes/ScopedViewModelA.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/scopes/ScopedViewModelB.java | 15 +++++++++++++++ .../utils/commands/CompositeCommandTest.java | 15 +++++++++++++++ .../utils/commands/DelegateCommandTest.java | 15 +++++++++++++++ .../saxsys/mvvmfx/utils/commands/testapp/App.java | 15 +++++++++++++++ .../mvvmfx/utils/commands/testapp/MainView.java | 15 +++++++++++++++ .../utils/commands/testapp/MainViewModel.java | 15 +++++++++++++++ .../mvvmfx/utils/commands/testapp/Service.java | 15 +++++++++++++++ .../mvvmfx/utils/commands/testapp/SubView.java | 15 +++++++++++++++ .../utils/commands/testapp/SubViewModel.java | 15 +++++++++++++++ .../saxsys/mvvmfx/utils/mapping/ExampleModel.java | 15 +++++++++++++++ .../mvvmfx/utils/mapping/ModelWrapperTest.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/utils/mapping/Person.java | 15 +++++++++++++++ .../de/saxsys/mvvmfx/utils/mapping/PersonFX.java | 15 +++++++++++++++ .../mvvmfx/utils/mapping/ReturnTypeTest.java | 15 +++++++++++++++ .../ConcurrentModificationBugTest.java | 15 +++++++++++++++ .../notifications/NotificationTestHelperTest.java | 15 +++++++++++++++ .../mvvmfx/utils/notifications/ViewModelTest.java | 15 +++++++++++++++ .../ViewModelWithoutUiThreadTest.java | 15 +++++++++++++++ .../utils/validation/CompositeValidatorTest.java | 15 +++++++++++++++ .../validation/FunctionBasedValidatorTest.java | 15 +++++++++++++++ .../utils/validation/HighestMessageBugTest.java | 15 +++++++++++++++ .../utils/validation/ObservableRulesTest.java | 15 +++++++++++++++ .../validation/ObservableRulesValidatorTest.java | 15 +++++++++++++++ .../saxsys/mvvmfx/utils/validation/TestApp.java | 15 +++++++++++++++ .../utils/validation/ValidationStatusTest.java | 15 +++++++++++++++ .../crossfieldexample/CrossFieldExampleApp.java | 15 +++++++++++++++ .../crossfieldexample/RegisterFormView.java | 15 +++++++++++++++ .../crossfieldexample/RegisterFormViewModel.java | 15 +++++++++++++++ 120 files changed, 1800 insertions(+) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java index f19c59f65..bfe7af114 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Scope.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx; import de.saxsys.mvvmfx.utils.notifications.NotificationObserver; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index b6228da9c..73ec94403 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx; import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/MvvmfxApplication.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/MvvmfxApplication.java index 6c8f760c2..00055123b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/MvvmfxApplication.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/MvvmfxApplication.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal; import javafx.application.Application; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ReflectionUtils.java index 27f3af019..4f9ffbc75 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ReflectionUtils.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import java.lang.annotation.Annotation; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjector.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjector.java index 24dcd33b5..8e387ecc0 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjector.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjector.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import java.lang.reflect.Field; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManager.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManager.java index 5584b13b4..f17a2213a 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManager.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManager.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import eu.lestard.doc.Internal; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 62be770d0..21777a4e1 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import de.saxsys.mvvmfx.*; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/Action.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/Action.java index 797a5c43b..f160b6afc 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/Action.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/Action.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands; import javafx.concurrent.Task; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index 339b62b91..faa05b93c 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; import java.util.Collections; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanGetter.java index 639e3daee..216955123 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanPropertyAccessor.java index f36e7aa18..f01797241 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.Property; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanSetter.java index 05ad65113..236d2af47 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/BooleanSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleGetter.java index 32c33c75c..15ee26e6d 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoublePropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoublePropertyAccessor.java index ecfadcfed..d9bbea59c 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoublePropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoublePropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleSetter.java index 74c8376b4..a198801fc 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/DoubleSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatGetter.java index c04f95055..ebcdd42ba 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatPropertyAccessor.java index 09c914913..0f3fa9fd0 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.FloatProperty; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatSetter.java index 68199b5f0..5ca38cf68 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/FloatSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntGetter.java index c413c3379..d0f65c24f 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntPropertyAccessor.java index ceeeda826..ec97e8e0b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.IntegerProperty; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntSetter.java index 654f321f3..371c539d3 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/IntSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListGetter.java index f36f97d80..ebd946394 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.List; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListPropertyAccessor.java index 28d7b2e5d..719821587 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.ListProperty; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListSetter.java index 62d71fcfa..527faa4f7 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ListSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.List; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongGetter.java index 85d3f6a60..2c16520c2 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongPropertyAccessor.java index 145d20f34..075126003 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.LongProperty; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongSetter.java index d53d0613d..38cd37fe8 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/LongSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectGetter.java index e035ff01b..18e86907a 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectPropertyAccessor.java index 5deca65ba..041622026 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.Property; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectSetter.java index aff8be60a..7931eecf6 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/ObjectSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringGetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringGetter.java index 8c9838892..3c884104c 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringGetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringGetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.Function; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringPropertyAccessor.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringPropertyAccessor.java index 3fd6772ba..9667b32de 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringPropertyAccessor.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringPropertyAccessor.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import javafx.beans.property.Property; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringSetter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringSetter.java index 0fa709647..6cee2a314 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringSetter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/accessorfunctions/StringSetter.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping.accessorfunctions; import java.util.function.BiConsumer; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelper.java index 513274ebd..a911aa50c 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelper.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidationResult.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidationResult.java index 262176668..15be9e249 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidationResult.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidationResult.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.property.ListProperty; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidator.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidator.java index d472ed967..167f42354 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidator.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/CompositeValidator.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import java.util.stream.Collectors; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidator.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidator.java index c1430adbf..3564b5b90 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidator.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidator.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.value.ObservableValue; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRuleBasedValidator.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRuleBasedValidator.java index 20c087274..32400ba4b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRuleBasedValidator.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRuleBasedValidator.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.value.ObservableValue; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRules.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRules.java index 6b5ddd006..b67f2fae7 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRules.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ObservableRules.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.binding.Bindings; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Severity.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Severity.java index ada23c960..bfc08d324 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Severity.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Severity.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; /** diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java index 2afd88ebb..0bba3e635 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; /** diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationStatus.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationStatus.java index 016a196a3..7a268a5c9 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationStatus.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationStatus.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.property.ListProperty; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Validator.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Validator.java index caf53cc3a..3e9a7e9b6 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Validator.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/Validator.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; /** diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ControlsFxVisualizer.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ControlsFxVisualizer.java index affa1ade9..2533c7384 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ControlsFxVisualizer.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ControlsFxVisualizer.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation.visualization; import de.saxsys.mvvmfx.utils.validation.Severity; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizer.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizer.java index 795a191db..e74557c90 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizer.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizer.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation.visualization; import de.saxsys.mvvmfx.utils.validation.ValidationStatus; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizerBase.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizerBase.java index b4859e366..15b9dea73 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizerBase.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/visualization/ValidationVisualizerBase.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation.visualization; import de.saxsys.mvvmfx.utils.validation.Severity; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/viewlist/CachedViewModelCellFactory.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/viewlist/CachedViewModelCellFactory.java index 7144fafb3..5f1e2e758 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/viewlist/CachedViewModelCellFactory.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/viewlist/CachedViewModelCellFactory.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.viewlist; import de.saxsys.mvvmfx.FluentViewLoader; diff --git a/mvvmfx/src/test/java/FxmlViewInDefaultPackage.java b/mvvmfx/src/test/java/FxmlViewInDefaultPackage.java index 798d0709e..35017ee5e 100644 --- a/mvvmfx/src/test/java/FxmlViewInDefaultPackage.java +++ b/mvvmfx/src/test/java/FxmlViewInDefaultPackage.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.internal.viewloader.example.TestViewModel; diff --git a/mvvmfx/src/test/java/FxmlViewinDefaultPackageTest.java b/mvvmfx/src/test/java/FxmlViewinDefaultPackageTest.java index d5cc68d31..18d851e3a 100644 --- a/mvvmfx/src/test/java/FxmlViewinDefaultPackageTest.java +++ b/mvvmfx/src/test/java/FxmlViewinDefaultPackageTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.ViewTuple; import de.saxsys.mvvmfx.internal.viewloader.example.TestViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_API_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_API_Test.java index 1916c97ec..c424de914 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_API_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_API_Test.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import static org.assertj.core.api.Assertions.*; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java index bcb23bf2c..d66ddf9ee 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_ResourceBundle_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_ResourceBundle_Test.java index 1c46c6863..4a8da07e8 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_ResourceBundle_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_ResourceBundle_Test.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import static de.saxsys.mvvmfx.internal.viewloader.ResourceBundleAssert.assertThat; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/MockableViewLoaderTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/MockableViewLoaderTest.java index d3328602b..f15cce5c7 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/MockableViewLoaderTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/MockableViewLoaderTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import de.saxsys.mvvmfx.ViewTuple; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleAssert.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleAssert.java index 8adfaea71..8d60c5ed1 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleAssert.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleAssert.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import org.assertj.core.api.AbstractAssert; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjectorTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjectorTest.java index f23e1065e..576bb9bbd 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjectorTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleInjectorTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import static org.assertj.core.api.Assertions.assertThat; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManagerTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManagerTest.java index badc8c8a0..f6dfed8bc 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManagerTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ResourceBundleManagerTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import org.junit.Before; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtilsTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtilsTest.java index de333dce1..8fed48609 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtilsTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtilsTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; import static org.assertj.core.api.Assertions.*; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/InvalidFxmlTestView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/InvalidFxmlTestView.java index 66aad9c54..fdcd9fc99 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/InvalidFxmlTestView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/InvalidFxmlTestView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import java.net.URL; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlView.java index 391d160f7..50e2bf182 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import java.net.URL; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewFxRoot.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewFxRoot.java index aba37ef9b..9ee397ba9 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewFxRoot.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewFxRoot.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import javafx.scene.layout.VBox; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewMultipleViewModels.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewMultipleViewModels.java index b93fbf397..8569444b4 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewMultipleViewModels.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewMultipleViewModels.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundle.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundle.java index 2ec440e94..6ac13e48f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundle.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundle.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import java.util.ResourceBundle; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundleWithoutController.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundleWithoutController.java index 81686d0e4..a416b45c9 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundleWithoutController.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewResourceBundleWithoutController.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import java.util.ResourceBundle; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithActionMethod.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithActionMethod.java index 7ad140ee6..eb9baf51c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithActionMethod.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithActionMethod.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithMissingController.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithMissingController.java index 1875b0c00..91abd67b0 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithMissingController.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithMissingController.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongAnnotationUsage.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongAnnotationUsage.java index b77c81bc9..608d2ed0f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongAnnotationUsage.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongAnnotationUsage.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongController.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongController.java index ca9f6221f..4b647dd47 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongController.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongController.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongInjectedViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongInjectedViewModel.java index 35834946c..d14316345 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongInjectedViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithWrongInjectedViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelField.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelField.java index a20be36a5..b5407b295 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelField.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelField.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelType.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelType.java index 7750208bf..21ae5b89b 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelType.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelType.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import java.net.URL; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestJavaView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestJavaView.java index 2a2f603c1..64a329b04 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestJavaView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestJavaView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import java.net.URL; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java index 7a775d2ff..70697c881 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.Scope; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewA.java index 99dc23855..f634bf929 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewA.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewB.java index 1b1596f1a..bd4de518c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewB.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java index bc9ec02d5..e61aafd3a 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelA.java index f772f0ed7..164cb793b 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelA.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelB.java index 7c054b9cb..e17ae0980 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelB.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelWithResourceBundle.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelWithResourceBundle.java index f64f2f7c6..a1ef0f912 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelWithResourceBundle.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModelWithResourceBundle.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader.example; import de.saxsys.mvvmfx.InjectResourceBundle; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/GlobalResourceBundleTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/GlobalResourceBundleTest.java index 1b9855247..db848414e 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/GlobalResourceBundleTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/GlobalResourceBundleTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.global; import de.saxsys.mvvmfx.FluentViewLoader; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestView.java index a825297bc..917d35c99 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.global; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestViewModel.java index 19e4b0c0b..4cf3a3766 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/global/TestViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.global; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedView.java index 181e34af2..16ccdb51f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.included; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewModel.java index 3c2eebd73..011987351 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.included; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewsTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewsTest.java index e8c885139..5837b23ce 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewsTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/IncludedViewsTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.included; import de.saxsys.mvvmfx.FluentViewLoader; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootView.java index cfc54076f..57fee091b 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.included; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootViewModel.java index 5553e54bb..c36833b5e 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/resourcebundle/included/RootViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.resourcebundle.included; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index 876479c7e..997f6cd63 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java index cd8eadf20..d35997858 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java index d0487e030..310fc55e0 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java index 36036983f..e5c4a86a0 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java index 0b8520c45..1a3b2a2ad 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 5af7d3c18..940f07e0c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java index 000ae2799..e44425416 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/CompositeCommandTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/CompositeCommandTest.java index adf262f0c..7d04c1d20 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/CompositeCommandTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/CompositeCommandTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands; import static org.assertj.core.api.Assertions.assertThat; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/DelegateCommandTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/DelegateCommandTest.java index f888d7416..425396b36 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/DelegateCommandTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/DelegateCommandTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands; import static org.assertj.core.api.Assertions.assertThat; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/App.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/App.java index 347eec114..14a0fbc43 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/App.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/App.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands.testapp; /** diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainView.java index 9b062e2ea..8fee8fd09 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands.testapp; import de.saxsys.mvvmfx.FluentViewLoader; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainViewModel.java index ee37c39ec..313c9227d 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/MainViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands.testapp; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/Service.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/Service.java index c43959097..696e38bb6 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/Service.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/Service.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands.testapp; import java.util.Random; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubView.java index f46c84e6f..22d9e52ec 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands.testapp; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubViewModel.java index 80e15b1a2..ec4e33309 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/commands/testapp/SubViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.commands.testapp; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ExampleModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ExampleModel.java index 3e85d2440..c30d9f670 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ExampleModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ExampleModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; import javafx.beans.property.*; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java index a88f00182..d96a3639d 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; import javafx.beans.property.IntegerProperty; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/Person.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/Person.java index 977f29cd9..d56dfff49 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/Person.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/Person.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; import java.util.ArrayList; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/PersonFX.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/PersonFX.java index c6a7275af..109d885ee 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/PersonFX.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/PersonFX.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; import javafx.beans.property.IntegerProperty; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ReturnTypeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ReturnTypeTest.java index 2a752672d..6512cc890 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ReturnTypeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ReturnTypeTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; import javafx.beans.property.*; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ConcurrentModificationBugTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ConcurrentModificationBugTest.java index 2293ba7a0..63ef70a7d 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ConcurrentModificationBugTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ConcurrentModificationBugTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; import org.junit.Test; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java index a2f65dc5e..e623014fa 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; import static org.assertj.core.api.Assertions.*; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java index 453b9a223..ad175b637 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; import de.saxsys.mvvmfx.MvvmFX; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java index adbdf4a18..081939318 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.notifications; import de.saxsys.mvvmfx.ViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CompositeValidatorTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CompositeValidatorTest.java index fc5042b3a..6358bb9bc 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CompositeValidatorTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CompositeValidatorTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.property.BooleanProperty; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java index 20d8027f1..380fb29b6 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.property.SimpleStringProperty; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/HighestMessageBugTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/HighestMessageBugTest.java index 61bfa184e..6b97518d1 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/HighestMessageBugTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/HighestMessageBugTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import static org.assertj.core.api.Assertions.*; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesTest.java index 4b2531c98..758f6589f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.property.SimpleStringProperty; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesValidatorTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesValidatorTest.java index 5b1a4e1aa..10d0acec8 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesValidatorTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ObservableRulesValidatorTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import javafx.beans.property.BooleanProperty; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/TestApp.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/TestApp.java index d830c68d9..6e460f271 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/TestApp.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/TestApp.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; /** diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationStatusTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationStatusTest.java index 5881092e7..c39d2260c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationStatusTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationStatusTest.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; import org.junit.Test; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/CrossFieldExampleApp.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/CrossFieldExampleApp.java index 79510bcd3..6a6629994 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/CrossFieldExampleApp.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/CrossFieldExampleApp.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation.crossfieldexample; import de.saxsys.mvvmfx.FluentViewLoader; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormView.java index f1896fac6..4deaf0707 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormView.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation.crossfieldexample; import de.saxsys.mvvmfx.FxmlView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormViewModel.java index 81a9a4c30..0870f0a43 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/crossfieldexample/RegisterFormViewModel.java @@ -1,3 +1,18 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation.crossfieldexample; import de.saxsys.mvvmfx.ViewModel; From 9361add8fac79e4b6e7f5f35653d73e73823561f Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 15:01:31 +0100 Subject: [PATCH 18/96] stash pop --- .../contacts/events/OpenAboutDialogEvent.java | 9 ------ .../events/OpenAddContactDialogEvent.java | 9 ------ .../contacts/events/OpenAuthorPageEvent.java | 9 ------ .../contacts/ui/about/AboutAuthorView.java | 32 +++++++++---------- .../ui/about/AboutAuthorViewModel.java | 15 ++------- .../examples/contacts/ui/about/AboutView.java | 31 ++++++++---------- .../contacts/ui/about/AboutViewModel.java | 32 ++++++------------- .../examples/contacts/ui/menu/MenuView.java | 17 +++++++--- .../contacts/ui/menu/MenuViewModel.java | 14 ++------ .../examples/contacts/util/DialogHelper.java | 17 ++++++++++ .../contacts/ui/about/AboutAuthorView.fxml | 2 +- .../examples/contacts/ui/about/AboutView.fxml | 25 +++++++-------- 12 files changed, 85 insertions(+), 127 deletions(-) delete mode 100644 examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAboutDialogEvent.java delete mode 100644 examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAddContactDialogEvent.java delete mode 100644 examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAuthorPageEvent.java diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAboutDialogEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAboutDialogEvent.java deleted file mode 100644 index b7947d747..000000000 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAboutDialogEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.saxsys.mvvmfx.examples.contacts.events; - -import de.saxsys.mvvmfx.examples.contacts.ui.about.AboutView; - -/** - * CDI event class that is used to indicate that the {@link AboutView} dialog should be opened. - */ -public class OpenAboutDialogEvent { -} diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAddContactDialogEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAddContactDialogEvent.java deleted file mode 100644 index 085bc9022..000000000 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAddContactDialogEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.saxsys.mvvmfx.examples.contacts.events; - -import de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialog; - -/** - * CDI event class that is used to indicate that the {@link AddContactDialog} should be opened. - */ -public class OpenAddContactDialogEvent { -} diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAuthorPageEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAuthorPageEvent.java deleted file mode 100644 index 6c8977679..000000000 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenAuthorPageEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.saxsys.mvvmfx.examples.contacts.events; - -import de.saxsys.mvvmfx.examples.contacts.ui.about.AboutAuthorView; - -/** - * CDI event class that is used to indicate that the {@link AboutAuthorView} dialog should be opened. - */ -public class OpenAuthorPageEvent { -} diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java index 4f02e51ac..596f9c292 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java @@ -1,40 +1,38 @@ package de.saxsys.mvvmfx.examples.contacts.ui.about; + import de.saxsys.mvvmfx.FluentViewLoader; -import de.saxsys.mvvmfx.FxmlView; -import de.saxsys.mvvmfx.InjectViewModel; + import de.saxsys.mvvmfx.examples.contacts.events.OpenAuthorPageEvent; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + import javafx.fxml.FXML; -import javafx.scene.Parent; import javafx.stage.Stage; -import javax.enterprise.event.Observes; -import javax.inject.Inject; + public class AboutAuthorView implements FxmlView<AboutAuthorViewModel> { private Parent root; + +@Singleton +public class AboutAuthorView implements FxmlView<AboutAuthorViewModel> { + + @Inject private Stage primaryStage; - @InjectViewModel private AboutAuthorViewModel viewModel; - AboutAuthorView() { - root = FluentViewLoader.fxmlView(AboutAuthorView.class).codeBehind(this).load().getView(); - } - - public void initialize() { - DialogHelper.initDialog(viewModel.dialogOpenProperty(), primaryStage, () -> root); - } - - public void openDialog(@Observes OpenAuthorPageEvent event) { - viewModel.openDialog(); - } @FXML public void openBlog() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java index 5140d289e..2248d91f2 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java @@ -1,22 +1,15 @@ package de.saxsys.mvvmfx.examples.contacts.ui.about; +import javax.inject.Inject; + import de.saxsys.mvvmfx.ViewModel; import javafx.application.HostServices; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; - -import javax.inject.Inject; public class AboutAuthorViewModel implements ViewModel { - private BooleanProperty dialogOpen = new SimpleBooleanProperty(); - @Inject private HostServices hostServices; - public BooleanProperty dialogOpenProperty() { - return dialogOpen; - } public void openBlog() { hostServices.showDocument("http://www.lestard.eu"); @@ -25,8 +18,4 @@ public void openBlog() { public void openTwitter() { hostServices.showDocument("https://twitter.com/manuel_mauky"); } - - public void openDialog() { - dialogOpen.set(true); - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java index fa1d73c3f..314c12642 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java @@ -6,6 +6,7 @@ import javafx.stage.Stage; import javax.enterprise.event.Observes; + import javax.inject.Inject; import javax.inject.Singleton; @@ -14,33 +15,30 @@ import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; + import de.saxsys.mvvmfx.examples.contacts.events.OpenAboutDialogEvent; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; +import javafx.fxml.FXML; +import javafx.scene.Parent; +import javafx.scene.control.Hyperlink; +import javafx.stage.Stage; + + @Singleton public class AboutView implements FxmlView<AboutViewModel> { - @Inject - private Stage primaryStage; - @FXML private HyperlinkLabel librariesLabel; @InjectViewModel private AboutViewModel viewModel; - - private Parent root; - + @Inject - AboutView() { - root = FluentViewLoader.fxmlView(AboutView.class) - .codeBehind(this) - .load().getView(); - } + private Stage primaryStage; + public void initialize() { - DialogHelper.initDialog(viewModel.dialogOpenProperty(), primaryStage, () -> root); - librariesLabel.textProperty().bind(viewModel.librariesLabelTextProperty()); librariesLabel.setOnAction(event -> { Hyperlink link = (Hyperlink) event.getSource(); @@ -51,10 +49,9 @@ public void initialize() { @FXML public void openAuthorPage() { - viewModel.openAuthorPage(); + Parent view = FluentViewLoader.fxmlView(AboutAuthorView.class) + .load().getView(); + DialogHelper.showDialog(view, primaryStage); } - public void open(@Observes OpenAboutDialogEvent event) { - viewModel.openDialog(); - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java index 22e24f4e7..7d0ef45eb 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java @@ -2,35 +2,30 @@ import java.util.function.Consumer; +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.utils.notifications.NotificationCenter; import javafx.application.HostServices; -import javafx.beans.property.BooleanProperty; import javafx.beans.property.ReadOnlyStringProperty; import javafx.beans.property.ReadOnlyStringWrapper; -import javafx.beans.property.SimpleBooleanProperty; import javafx.collections.FXCollections; import javafx.collections.MapChangeListener; import javafx.collections.ObservableMap; -import javax.annotation.PostConstruct; -import javax.enterprise.event.Event; -import javax.inject.Inject; - -import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.events.OpenAuthorPageEvent; - public class AboutViewModel implements ViewModel { - private BooleanProperty dialogOpen = new SimpleBooleanProperty(); - private ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); + private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); @Inject - private Event<OpenAuthorPageEvent> openAuthorPageEvent; + private HostServices hostServices; @Inject - private HostServices hostServices; + private NotificationCenter notificationCenter; /** * Sadly the {@link javafx.application.HostServices} class of JavaFX is <code>final</code> so we can't mock it in @@ -39,6 +34,7 @@ public class AboutViewModel implements ViewModel { Consumer<String> onLinkClickedHandler; public AboutViewModel() { + libraryLinkMap.addListener((MapChangeListener<String, String>) change -> { StringBuilder labelText = new StringBuilder(); @@ -64,9 +60,6 @@ public void initLibraryMap() { libraryLinkMap.put("JFX-Testrunner", "https://github.com/sialcasa/jfx-testrunner"); } - public void openDialog() { - dialogOpen.set(true); - } public void onLinkClicked(String linkText) { if (libraryLinkMap.containsKey(linkText)) { @@ -74,15 +67,8 @@ public void onLinkClicked(String linkText) { } } - public BooleanProperty dialogOpenProperty() { - return dialogOpen; - } - public ReadOnlyStringProperty librariesLabelTextProperty() { return librariesLabelText.getReadOnlyProperty(); } - public void openAuthorPage() { - openAuthorPageEvent.fire(new OpenAuthorPageEvent()); - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java index 67ebfeed4..f2200f88a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java @@ -1,10 +1,16 @@ package de.saxsys.mvvmfx.examples.contacts.ui.menu; -import javafx.fxml.FXML; -import javafx.scene.control.MenuItem; +import javax.inject.Inject; +import de.saxsys.mvvmfx.DialogHelper; +import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.about.AboutView; +import javafx.fxml.FXML; +import javafx.scene.Parent; +import javafx.scene.control.MenuItem; +import javafx.stage.Stage; public class MenuView implements FxmlView<MenuViewModel> { @@ -14,12 +20,13 @@ public class MenuView implements FxmlView<MenuViewModel> { @InjectViewModel private MenuViewModel viewModel; + @Inject + private Stage primaryStage; public void initialize() { removeMenuItem.disableProperty().bind(viewModel.removeItemDisabledProperty()); } - @FXML public void close() { viewModel.closeAction(); @@ -32,6 +39,8 @@ public void remove() { @FXML public void about() { - viewModel.aboutAction(); + Parent view = FluentViewLoader.fxmlView(AboutView.class) + .load().getView(); + DialogHelper.showDialog(view, primaryStage); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java index abd13370a..e8c92b3ca 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java @@ -1,9 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.menu; -import de.saxsys.mvvmfx.examples.contacts.events.OpenAboutDialogEvent; -import javafx.beans.property.ReadOnlyBooleanProperty; -import javafx.beans.property.ReadOnlyBooleanWrapper; - import javax.annotation.PostConstruct; import javax.enterprise.event.Event; import javax.inject.Inject; @@ -13,14 +9,14 @@ import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; +import javafx.beans.property.ReadOnlyBooleanProperty; +import javafx.beans.property.ReadOnlyBooleanWrapper; public class MenuViewModel implements ViewModel { @Inject private Event<TriggerShutdownEvent> shouldCloseEvent; - @Inject - private Event<OpenAboutDialogEvent> aboutDialogEvent; @Inject private MasterViewModel masterViewModel; @@ -28,8 +24,7 @@ public class MenuViewModel implements ViewModel { @Inject private Repository repository; - - private ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); @PostConstruct public void init() { @@ -51,7 +46,4 @@ public ReadOnlyBooleanProperty removeItemDisabledProperty() { return removeItemDisabled.getReadOnlyProperty(); } - public void aboutAction() { - aboutDialogEvent.fire(new OpenAboutDialogEvent()); - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java index e6a88e45d..04eafb61e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java @@ -59,4 +59,21 @@ public static void initDialog(BooleanProperty openProperty, final Stage parentSt // we want to set the property to false dialogStage.setOnCloseRequest(event -> openProperty.set(false)); } + + public static Stage showDialog(Parent view, Stage parentStage, String... sceneStyleSheets) { + final Stage dialogStage = new Stage(StageStyle.UTILITY); + dialogStage.initOwner(parentStage); + dialogStage.initModality(Modality.APPLICATION_MODAL); + if (dialogStage.getScene() == null) { + // ... we create a new scene and register it in the stage. + Scene dialogScene = new Scene(view); + dialogScene.getStylesheets().addAll(sceneStyleSheets); + dialogStage.setScene(dialogScene); + + dialogStage.sizeToScene(); + dialogStage.show(); + return dialogStage; + } + return null; + } } diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml index 84b26dac3..0acf58880 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml @@ -8,7 +8,7 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutAuthorView"> <children> <HBox spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml index b7a8f48e6..be8bca1f9 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml @@ -8,40 +8,37 @@ <?import java.lang.*?> <?import javafx.scene.layout.*?> -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" - prefWidth="400.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutView"> <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <children> <HBox> <children> <Text fill="DIMGREY" strokeType="OUTSIDE" strokeWidth="0.0" text="%about.title"> <font> - <Font size="24.0"/> + <Font size="24.0" /> </font> </Text> </children> <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> </padding> </HBox> - <Separator/> + <Separator /> <VBox spacing="10.0" style="-fx-background-color: white;" VBox.vgrow="ALWAYS"> <children> - <Label maxHeight="-Infinity" maxWidth="-Infinity" text="%about.description" wrapText="true" - VBox.vgrow="ALWAYS"/> - <Label text="%about.libraries.label"/> - <HyperlinkLabel fx:id="librariesLabel"/> + <Label maxHeight="-Infinity" maxWidth="-Infinity" text="%about.description" wrapText="true" VBox.vgrow="ALWAYS" /> + <Label text="%about.libraries.label" /> + <HyperlinkLabel fx:id="librariesLabel" /> </children> <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </padding> <VBox.margin> - <Insets/> + <Insets /> </VBox.margin> </VBox> - <Hyperlink onAction="#openAuthorPage" text="About the Author"/> + <Hyperlink onAction="#openAuthorPage" text="About the Author" /> </children> </VBox> </children> From 8e31c05461a7f66764b50402857a55c40851b390 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 15:03:44 +0100 Subject: [PATCH 19/96] Resolved Merge Errors --- .../contacts/ui/about/AboutAuthorView.java | 21 ------------------- .../examples/contacts/ui/about/AboutView.java | 13 +----------- .../ui/addcontact/AddContactDialog.java | 1 - .../examples/contacts/ui/menu/MenuView.java | 2 +- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java index 596f9c292..692235637 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java @@ -1,35 +1,14 @@ package de.saxsys.mvvmfx.examples.contacts.ui.about; - -import de.saxsys.mvvmfx.FluentViewLoader; - -import de.saxsys.mvvmfx.examples.contacts.events.OpenAuthorPageEvent; -import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; - -import javax.inject.Inject; import javax.inject.Singleton; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; - import javafx.fxml.FXML; -import javafx.stage.Stage; - - - -public class AboutAuthorView implements FxmlView<AboutAuthorViewModel> { - - - private Parent root; - @Singleton public class AboutAuthorView implements FxmlView<AboutAuthorViewModel> { - - @Inject - private Stage primaryStage; - @InjectViewModel private AboutAuthorViewModel viewModel; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java index 314c12642..10acdd3b3 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java @@ -1,12 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.about; -import javafx.fxml.FXML; -import javafx.scene.Parent; -import javafx.scene.control.Hyperlink; -import javafx.stage.Stage; - -import javax.enterprise.event.Observes; - import javax.inject.Inject; import javax.inject.Singleton; @@ -15,16 +8,12 @@ import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; - -import de.saxsys.mvvmfx.examples.contacts.events.OpenAboutDialogEvent; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; - import javafx.fxml.FXML; import javafx.scene.Parent; import javafx.scene.control.Hyperlink; import javafx.stage.Stage; - @Singleton public class AboutView implements FxmlView<AboutViewModel> { @@ -33,7 +22,7 @@ public class AboutView implements FxmlView<AboutViewModel> { @InjectViewModel private AboutViewModel viewModel; - + @Inject private Stage primaryStage; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java index 6be0645f0..973fbcd1d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java @@ -7,7 +7,6 @@ import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.examples.contacts.events.OpenAddContactDialogEvent; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import javafx.fxml.FXML; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java index f2200f88a..7c4713bf1 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java @@ -2,11 +2,11 @@ import javax.inject.Inject; -import de.saxsys.mvvmfx.DialogHelper; import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.about.AboutView; +import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import javafx.fxml.FXML; import javafx.scene.Parent; import javafx.scene.control.MenuItem; From e6d07a234e1682a2425d447ab5756a50dd0bec63 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 15:43:32 +0100 Subject: [PATCH 20/96] Refactored Add Contact --- .../examples/contacts/ui/about/AboutView.java | 2 +- .../ui/addcontact/AddContactDialog.java | 24 +++---- .../addcontact/AddContactDialogViewModel.java | 24 ++++--- .../ui/addressform/AddressFormViewModel.java | 71 ++++++++++++------- .../ui/contactform/ContactFormViewModel.java | 68 ++++++++++-------- .../examples/contacts/ui/menu/MenuView.java | 2 +- .../ui/scopes/ContactDialogScope.java | 1 - .../contacts/ui/toolbar/ToolbarView.java | 18 ++++- .../contacts/ui/toolbar/ToolbarViewModel.java | 12 +--- .../ui/addcontact/AddContactDialog.fxml | 2 +- 10 files changed, 125 insertions(+), 99 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java index 10acdd3b3..02ede7138 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java @@ -40,7 +40,7 @@ public void initialize() { public void openAuthorPage() { Parent view = FluentViewLoader.fxmlView(AboutAuthorView.class) .load().getView(); - DialogHelper.showDialog(view, primaryStage); + DialogHelper.showDialog(view, primaryStage, "/contacts.css"); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java index 973fbcd1d..5d044243f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java @@ -1,16 +1,12 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addcontact; -import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Singleton; -import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView; -import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import javafx.fxml.FXML; -import javafx.scene.Parent; import javafx.stage.Stage; @Singleton @@ -26,24 +22,20 @@ public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { @InjectViewModel private AddContactDialogViewModel viewModel; - private final Parent root; + private Stage showDialog; - @Inject - AddContactDialog() { - root = FluentViewLoader - .fxmlView(AddContactDialog.class) - .codeBehind(this) - .load() - .getView(); - } public void initialize() { viewModel.setContactDialogViewModel(contactDialogViewController.getViewModel()); - DialogHelper.initDialog(viewModel.dialogOpenProperty(), primaryStage, () -> root); + viewModel.subscribe(AddContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + showDialog.close(); + }); } - public void open(@Observes OpenAddContactDialogEvent event) { - viewModel.openDialog(); + + public void setDisplayingStage(Stage showDialog) { + this.showDialog = showDialog; } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index 62baa3337..dfc2ef045 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -1,5 +1,9 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addcontact; +import java.util.ResourceBundle; + +import javax.inject.Inject; + import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; @@ -9,14 +13,13 @@ import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; -import javax.inject.Inject; -import java.util.ResourceBundle; - public class AddContactDialogViewModel implements ViewModel { + + public static final String CLOSE_DIALOG_NOTIFICATION = "closeDialog"; + static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; private final BooleanProperty dialogOpen = new SimpleBooleanProperty(); - @Inject private Repository repository; @@ -31,11 +34,15 @@ public AddContactDialogViewModel() { if (!newV) { // contactDialogViewModel.resetDialogPage(); dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); - dialogScope.setContactToEdit(null); + dialogScope.setContactToEdit(null); } }); } + public void initialize() { + openDialog(); + } + public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewModel) { contactDialogViewModel.setOkAction(this::addContactAction); @@ -53,21 +60,16 @@ public void addContactAction() { repository.save(contact); - dialogOpen.set(false); + publish(CLOSE_DIALOG_NOTIFICATION); } } public void openDialog() { - // contactDialogViewModel.resetForms(); dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); Contact contact = new Contact(); dialogScope.setContactToEdit(contact); - this.dialogOpenProperty().set(true); } - public BooleanProperty dialogOpenProperty() { - return dialogOpen; - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index a3b125e5c..deeece418 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -1,21 +1,33 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addressform; +import java.util.Optional; +import java.util.ResourceBundle; + +import javax.inject.Inject; + import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.model.*; +import de.saxsys.mvvmfx.examples.contacts.model.Address; +import de.saxsys.mvvmfx.examples.contacts.model.Contact; +import de.saxsys.mvvmfx.examples.contacts.model.Country; +import de.saxsys.mvvmfx.examples.contacts.model.CountrySelector; +import de.saxsys.mvvmfx.examples.contacts.model.Subdivision; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import de.saxsys.mvvmfx.utils.itemlist.ItemList; import javafx.beans.binding.Bindings; import javafx.beans.binding.ObjectBinding; -import javafx.beans.property.*; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyBooleanProperty; +import javafx.beans.property.ReadOnlyBooleanWrapper; +import javafx.beans.property.ReadOnlyStringProperty; +import javafx.beans.property.ReadOnlyStringWrapper; +import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; -import javax.inject.Inject; -import java.util.Optional; -import java.util.ResourceBundle; - public class AddressFormViewModel implements ViewModel { static final String NOTHING_SELECTED_MARKER = "---"; static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; @@ -54,25 +66,30 @@ public class AddressFormViewModel implements ViewModel { // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. private ItemList<Subdivision> subdivisionItemList; private Address address; - - private ObjectBinding<Contact> contactBinding; + + private ObjectBinding<Contact> contactBinding; public void initialize() { - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); - - dialogScope.contactToEditProperty().addListener((observable, oldValue, newValue) -> { - if(newValue != null) { - if(newValue.getAddress() == null) { - System.out.println("Address is null"); - } else { - initWithAddress(newValue.getAddress()); - } - } - }); - - - loadingInProgress.bind(countrySelector.inProgressProperty()); + + ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + if (contactToEditProperty.get() != null) { + initWithAddress(contactToEditProperty.get().getAddress()); + } + + contactToEditProperty.addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + if (newValue.getAddress() == null) { + System.out.println("Address is null"); + } else { + initWithAddress(newValue.getAddress()); + } + } + }); + + + loadingInProgress.bind(countrySelector.inProgressProperty()); countrySelector.init(); initSubdivisionLabel(); @@ -113,9 +130,9 @@ public void initialize() { countryInputDisabled.bind(loadingInProgress); subdivisionInputDisabled.bind(loadingInProgress.or(Bindings.size(subdivisionsList()).lessThanOrEqualTo(1))); - - - dialogScope.addressFormValidProperty().bind(valid); + + + dialogScope.addressFormValidProperty().bind(valid); } void initSubdivisionLabel() { @@ -145,7 +162,7 @@ private void initCountryList() { private void commitChanges() { - + address.setStreet(street.get()); address.setCity(city.get()); address.setPostalcode(postalCode.get()); @@ -187,7 +204,7 @@ static ObservableList<String> createListWithNothingSelectedMarker(ObservableList return result; } - + public ObservableList<String> countriesList() { return countries; } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index 8ffe44c38..185f760a4 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -1,5 +1,7 @@ package de.saxsys.mvvmfx.examples.contacts.ui.contactform; +import java.time.LocalDate; + import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; @@ -8,12 +10,15 @@ import de.saxsys.mvvmfx.examples.contacts.ui.validators.EmailValidator; import de.saxsys.mvvmfx.examples.contacts.ui.validators.PhoneValidator; import de.saxsys.mvvmfx.utils.mapping.ModelWrapper; -import de.saxsys.mvvmfx.utils.validation.*; +import de.saxsys.mvvmfx.utils.validation.CompositeValidator; +import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; +import de.saxsys.mvvmfx.utils.validation.ValidationMessage; +import de.saxsys.mvvmfx.utils.validation.ValidationStatus; +import de.saxsys.mvvmfx.utils.validation.Validator; +import javafx.beans.property.ObjectProperty; import javafx.beans.property.Property; import javafx.beans.property.StringProperty; -import java.time.LocalDate; - public class ContactFormViewModel implements ViewModel { private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); @@ -57,39 +62,44 @@ public ContactFormViewModel() { phoneValidator, mobileValidator); } - - public void initialize() { - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); - - dialogScope.contactToEditProperty().addListener((observable, oldValue, newValue) -> { - if(newValue != null) { - initWithContact(newValue); - } - }); - - - dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); - } - - + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); + + ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + if (contactToEditProperty.get() != null) { + initWithContact(contactToEditProperty.get()); + } + + contactToEditProperty.addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + initWithContact(newValue); + } + }); + + + dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); + } + + private void resetForm() { contactWrapper.reset(); - } + } private void initWithContact(Contact contact) { this.contactWrapper.set(contact); this.contactWrapper.reload(); } - - private void commitChanges() { - if (contactWrapper.get() == null) { - contactWrapper.set(new Contact()); - } - - contactWrapper.commit(); - } - + + private void commitChanges() { + if (contactWrapper.get() == null) { + contactWrapper.set(new Contact()); + } + + contactWrapper.commit(); + } + public ValidationStatus firstnameValidation() { return firstnameValidator.getValidationStatus(); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java index 7c4713bf1..57daa518b 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java @@ -41,6 +41,6 @@ public void remove() { public void about() { Parent view = FluentViewLoader.fxmlView(AboutView.class) .load().getView(); - DialogHelper.showDialog(view, primaryStage); + DialogHelper.showDialog(view, primaryStage, "/contacts.css"); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index 58a698283..e7eb85e4a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -13,7 +13,6 @@ public enum Notifications { RESET_DIALOG_PAGE, COMMIT, RESET_FORMS; } - private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java index 3b59de830..2dd25e5e2 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java @@ -1,11 +1,20 @@ package de.saxsys.mvvmfx.examples.contacts.ui.toolbar; +import javax.inject.Inject; + import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialog; +import de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialogViewModel; +import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import javafx.fxml.FXML; +import javafx.scene.Parent; import javafx.scene.control.Button; +import javafx.stage.Stage; public class ToolbarView implements FxmlView<ToolbarViewModel> { @@ -15,12 +24,19 @@ public class ToolbarView implements FxmlView<ToolbarViewModel> { @InjectViewModel private ToolbarViewModel viewModel; + @Inject + private Stage primaryStage; + public void initialize() { AwesomeDude.setIcon(addNewContactButton, AwesomeIcon.PLUS); } @FXML public void addNewContact() { - viewModel.addNewContactAction(); + ViewTuple<AddContactDialog, AddContactDialogViewModel> load = FluentViewLoader.fxmlView(AddContactDialog.class) + .load(); + Parent view = load.getView(); + Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + load.getCodeBehind().setDisplayingStage(showDialog); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java index 618d4af83..6e1162b14 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java @@ -1,17 +1,7 @@ package de.saxsys.mvvmfx.examples.contacts.ui.toolbar; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.events.OpenAddContactDialogEvent; - -import javax.enterprise.event.Event; -import javax.inject.Inject; public class ToolbarViewModel implements ViewModel { - - @Inject - private Event<OpenAddContactDialogEvent> openPopupEvent; - - public void addNewContactAction() { - openPopupEvent.fire(new OpenAddContactDialogEvent()); - } + } diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml index bcebd0bc5..072c91b0e 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> -<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> +<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialog"> <children> <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" fx:id="contactDialogView" From 14b6d9f63e710d41052a1f4545545bf48bce89a1 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 16:41:42 +0100 Subject: [PATCH 21/96] EditContactDialog Refactoring --- .../events/OpenEditContactDialogEvent.java | 25 ---------- .../ui/addressform/AddressFormViewModel.java | 3 +- .../contactdialog/ContactDialogViewModel.java | 16 ++++-- .../contacts/ui/detail/DetailView.java | 22 +++++++++ .../contacts/ui/detail/DetailViewModel.java | 14 ++++-- .../ui/editcontact/EditContactDialog.java | 30 +++--------- .../EditContactDialogViewModel.java | 49 +++++-------------- .../ui/scopes/ContactDialogScope.java | 17 +++++++ .../ui/editcontact/EditContactDialog.fxml | 2 +- 9 files changed, 82 insertions(+), 96 deletions(-) delete mode 100644 examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenEditContactDialogEvent.java diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenEditContactDialogEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenEditContactDialogEvent.java deleted file mode 100644 index a7d736526..000000000 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/OpenEditContactDialogEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package de.saxsys.mvvmfx.examples.contacts.events; - -import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialog; - -/** - * CDI event class that is used to indicate that the {@link EditContactDialog} dialog should be opened. - * - * It contains the id of the contact to edit. - */ -public class OpenEditContactDialogEvent { - - private final String contactId; - - /** - * @param contactId - * the id of the contact to edit. - */ - public OpenEditContactDialogEvent(String contactId) { - this.contactId = contactId; - } - - public String getContactId() { - return contactId; - } -} diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index deeece418..a57a02834 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -59,8 +59,6 @@ public class AddressFormViewModel implements ViewModel { @InjectScope ContactDialogScope dialogScope; - - // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. private ItemList<Country> countryItemList; // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. @@ -74,6 +72,7 @@ public void initialize() { dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + if (contactToEditProperty.get() != null) { initWithAddress(contactToEditProperty.get().getAddress()); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index dfb380c99..40bae4373 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -4,7 +4,12 @@ import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.binding.Bindings; -import javafx.beans.property.*; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.ReadOnlyBooleanProperty; +import javafx.beans.property.ReadOnlyBooleanWrapper; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.beans.value.ObservableBooleanValue; public class ContactDialogViewModel implements ViewModel { @@ -19,10 +24,11 @@ public class ContactDialogViewModel implements ViewModel { private final StringProperty titleText = new SimpleStringProperty(); private Runnable okAction; - + public void initialize() { - valid.bind( - Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); + valid.bind( + Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); + dialogScope.bothFormsValidProperty().bind(valid); dialogScope.subscribe(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString(), (key, payload) -> resetDialogPage()); } @@ -59,7 +65,7 @@ public IntegerProperty dialogPageProperty() { public ObservableBooleanValue okButtonDisabledProperty() { - return valid.not(); + return valid.not(); } public ObservableBooleanValue okButtonVisibleProperty() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java index 20f9e5a73..cdef5ad3f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java @@ -1,15 +1,24 @@ package de.saxsys.mvvmfx.examples.contacts.ui.detail; +import javax.inject.Inject; + import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialog; +import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogViewModel; +import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import de.saxsys.mvvmfx.utils.commands.Command; import javafx.fxml.FXML; +import javafx.scene.Parent; import javafx.scene.control.Button; import javafx.scene.control.Hyperlink; import javafx.scene.control.Label; import javafx.scene.control.Labeled; +import javafx.stage.Stage; public class DetailView implements FxmlView<DetailViewModel> { @FXML @@ -21,6 +30,8 @@ public class DetailView implements FxmlView<DetailViewModel> { @FXML public Button editButton, removeButton; + @Inject + private Stage primaryStage; @InjectViewModel private DetailViewModel viewModel; @@ -61,6 +72,17 @@ public void initialize() { initVisibilityBindings(countrySubdivisionLabel); initIcons(); + + viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { + ViewTuple<EditContactDialog, EditContactDialogViewModel> load = FluentViewLoader + .fxmlView(EditContactDialog.class) + .load(); + Parent view = load.getView(); + Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + load.getCodeBehind().setOwningStage(showDialog); + }); + + } private void initVisibilityBindings(Labeled label) { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index 8d1e984d5..8531785cb 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -6,15 +6,15 @@ import java.time.format.DateTimeFormatter; import javax.annotation.PostConstruct; -import javax.enterprise.event.Event; import javax.inject.Inject; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.examples.contacts.events.OpenEditContactDialogEvent; import de.saxsys.mvvmfx.examples.contacts.model.Address; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import de.saxsys.mvvmfx.utils.commands.Action; import de.saxsys.mvvmfx.utils.commands.Command; import de.saxsys.mvvmfx.utils.commands.DelegateCommand; @@ -28,6 +28,8 @@ public class DetailViewModel implements ViewModel { + public static final String OPEN_EDIT_CONTACT_DIALOG = "open_edit_contact"; + private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ISO_DATE; private final ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); @@ -47,8 +49,6 @@ public class DetailViewModel implements ViewModel { private DelegateCommand removeCommand; private DelegateCommand emailLinkCommand; - @Inject - private Event<OpenEditContactDialogEvent> openEditEvent; @Inject MasterViewModel masterViewModel; @@ -59,6 +59,9 @@ public class DetailViewModel implements ViewModel { @Inject Repository repository; + @InjectScope + ContactDialogScope scope; + @PostConstruct void init() { ReadOnlyObjectProperty<Contact> contactProperty = masterViewModel.selectedContactProperty(); @@ -70,7 +73,8 @@ void init() { protected void action() throws Exception { Contact selectedContact = masterViewModel.selectedContactProperty().get(); if (selectedContact != null) { - openEditEvent.fire(new OpenEditContactDialogEvent(selectedContact.getId())); + scope.setContactToEdit(selectedContact); + publish(OPEN_EDIT_CONTACT_DIALOG); } } }, masterViewModel.selectedContactProperty().isNotNull()); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java index 885637fee..705096a88 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java @@ -1,19 +1,13 @@ package de.saxsys.mvvmfx.examples.contacts.ui.editcontact; -import javafx.fxml.FXML; -import javafx.scene.Parent; -import javafx.stage.Stage; - -import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Singleton; -import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.examples.contacts.events.OpenEditContactDialogEvent; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView; -import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; +import javafx.fxml.FXML; +import javafx.stage.Stage; @Singleton public class EditContactDialog implements FxmlView<EditContactDialogViewModel> { @@ -21,31 +15,23 @@ public class EditContactDialog implements FxmlView<EditContactDialogViewModel> { @FXML private ContactDialogView contactDialogViewController; - - private Parent root; - @Inject private Stage primaryStage; @InjectViewModel private EditContactDialogViewModel viewModel; - @Inject - EditContactDialog() { - root = FluentViewLoader - .fxmlView(EditContactDialog.class) - .codeBehind(this) - .load() - .getView(); - } + private Stage showDialog; public void initialize() { viewModel.setContactDialogViewModel(contactDialogViewController.getViewModel()); - DialogHelper.initDialog(viewModel.dialogOpenProperty(), primaryStage, () -> root); + viewModel.subscribe(viewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + showDialog.close(); + }); } - public void open(@Observes OpenEditContactDialogEvent event) { - viewModel.openDialog(event.getContactId()); + public void setOwningStage(Stage showDialog) { + this.showDialog = showDialog; } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 0a0006740..7848dcef3 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -1,20 +1,19 @@ package de.saxsys.mvvmfx.examples.contacts.ui.editcontact; +import java.util.ResourceBundle; + +import javax.inject.Inject; + import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; - -import javax.inject.Inject; -import java.util.ResourceBundle; public class EditContactDialogViewModel implements ViewModel { static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; - private final BooleanProperty dialogOpen = new SimpleBooleanProperty(); + public static final String CLOSE_DIALOG_NOTIFICATION = "CLOSE_DIALOG_NOT"; @Inject Repository repository; @@ -25,49 +24,27 @@ public class EditContactDialogViewModel implements ViewModel { @Inject ResourceBundle defaultResourceBundle; - private ContactDialogViewModel contactDialogViewModel; - - public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewModel) { - this.contactDialogViewModel = contactDialogViewModel; - contactDialogViewModel.setOkAction(this::applyAction); contactDialogViewModel.titleTextProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - dialogOpen.addListener((observable, oldValue, newValue) -> { - if (!newValue) { - dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); - dialogScope.setContactToEdit(null); - } - }); + } + + public void initialze() { + dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); + dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); + // dialogScope.setContactToEdit(null); } public void applyAction() { - if (contactDialogViewModel.validProperty().get()) { + if (dialogScope.bothFormsValidProperty().get()) { // contactDialogViewModel.getAddressFormViewModel().commitChanges(); dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); repository.save(dialogScope.contactToEditProperty().get()); - dialogOpen.set(false); + publish(CLOSE_DIALOG_NOTIFICATION); } } - - - public void openDialog(String contactId) { - dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); - - repository.findById(contactId).ifPresent(contact -> { - dialogScope.setContactToEdit(contact); - dialogOpen.set(true); - }); - } - - public BooleanProperty dialogOpenProperty() { - return dialogOpen; - } - - - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index e7eb85e4a..48b23d113 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -15,6 +15,8 @@ public enum Notifications { private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); + private final BooleanProperty bothFormsValid = new SimpleBooleanProperty(); + private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); public BooleanProperty contactFormValidProperty() { @@ -55,5 +57,20 @@ public void setContactToEdit(final Contact contactToEdit) { this.contactToEditProperty().set(contactToEdit); } + public final BooleanProperty bothFormsValidProperty() { + return this.bothFormsValid; + } + + + public final boolean isBothFormsValid() { + return this.bothFormsValidProperty().get(); + } + + + public final void setBothFormsValid(final boolean bothFormsValid) { + this.bothFormsValidProperty().set(bothFormsValid); + } + + } diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml index bcebd0bc5..a89106b1c 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> -<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> +<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialog"> <children> <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" fx:id="contactDialogView" From 6f2e60ef9a2a30cf41f03322d59d4aa5b37a6feb Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 16:42:43 +0100 Subject: [PATCH 22/96] Changed Tests because of refactoring --- .../EditContactDialogViewModelTest.java | 62 ++++++------------- 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java index 6183a2014..f3fde1940 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java @@ -1,22 +1,19 @@ package de.saxsys.mvvmfx.examples.contacts.ui.editcontact; -import de.saxsys.mvvmfx.examples.contacts.model.Contact; +import static de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogViewModel.TITLE_LABEL_KEY; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ListResourceBundle; +import java.util.ResourceBundle; + +import org.junit.Before; + import de.saxsys.mvvmfx.examples.contacts.model.Repository; import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleStringProperty; -import org.junit.Before; -import org.junit.Test; - -import java.util.ListResourceBundle; -import java.util.Optional; -import java.util.ResourceBundle; - -import static de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogViewModel.TITLE_LABEL_KEY; -import static eu.lestard.assertj.javafx.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; public class EditContactDialogViewModelTest { @@ -25,14 +22,14 @@ public class EditContactDialogViewModelTest { private Repository repository; private ContactDialogViewModel contactDialogViewModel; - - private ContactDialogScope scope; - + + private ContactDialogScope scope; + @Before public void setup() { - scope = new ContactDialogScope(); - - + scope = new ContactDialogScope(); + + // sadly the ResourceBundle.getString method is final so we can't use mockito ResourceBundle resourceBundle = new ListResourceBundle() { @Override @@ -44,13 +41,13 @@ protected Object[][] getContents() { }; viewModel = new EditContactDialogViewModel(); - viewModel.dialogScope = scope; - + viewModel.dialogScope = scope; + viewModel.defaultResourceBundle = resourceBundle; repository = mock(Repository.class); viewModel.repository = repository; - + contactDialogViewModel = mock(ContactDialogViewModel.class); when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); @@ -59,27 +56,4 @@ protected Object[][] getContents() { viewModel.setContactDialogViewModel(contactDialogViewModel); } - - @Test - public void testOpenDialogSuccess() { - Contact chewie = new Contact(); - chewie.setFirstname("Chewbacca"); - - when(repository.findById(chewie.getId())).thenReturn(Optional.of(chewie)); - - - viewModel.openDialog(chewie.getId()); - - assertThat(viewModel.dialogOpenProperty()).isTrue(); - } - - @Test - public void testOpenDialogNoSuchContact() { - when(repository.findById("12345")).thenReturn(Optional.empty()); - - viewModel.openDialog("12345"); - - assertThat(viewModel.dialogOpenProperty()).isFalse(); - } - } From f761ecf975221792dd7b7383f18103c66527321e Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:13:05 +0100 Subject: [PATCH 23/96] Eliminated communication between ViewModels --- .../contacts/ui/about/AboutViewModel.java | 10 ++--- .../ui/addcontact/AddContactDialog.java | 6 --- .../addcontact/AddContactDialogViewModel.java | 42 +++++-------------- .../contactdialog/ContactDialogViewModel.java | 1 + .../ui/editcontact/EditContactDialog.java | 2 - .../EditContactDialogViewModel.java | 16 ++++--- .../ui/scopes/ContactDialogScope.java | 23 +++++++++- 7 files changed, 45 insertions(+), 55 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java index 7d0ef45eb..a3d2901a3 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java @@ -16,17 +16,17 @@ public class AboutViewModel implements ViewModel { - - private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); - - ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); - @Inject private HostServices hostServices; @Inject private NotificationCenter notificationCenter; + private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); + + // Package Private because of testing reasons + ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); + /** * Sadly the {@link javafx.application.HostServices} class of JavaFX is <code>final</code> so we can't mock it in * tests. To still be able to test link actions we have introduced this handler as a mockable indirection. diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java index 5d044243f..78e106366 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java @@ -1,6 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addcontact; -import javax.inject.Inject; import javax.inject.Singleton; import de.saxsys.mvvmfx.FxmlView; @@ -16,9 +15,6 @@ public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { @FXML private ContactDialogView contactDialogViewController; - @Inject - private Stage primaryStage; - @InjectViewModel private AddContactDialogViewModel viewModel; @@ -26,8 +22,6 @@ public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { public void initialize() { - viewModel.setContactDialogViewModel(contactDialogViewController.getViewModel()); - viewModel.subscribe(AddContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { showDialog.close(); }); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index dfc2ef045..c09e4159c 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -8,10 +8,7 @@ import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; public class AddContactDialogViewModel implements ViewModel { @@ -19,7 +16,6 @@ public class AddContactDialogViewModel implements ViewModel { static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; - private final BooleanProperty dialogOpen = new SimpleBooleanProperty(); @Inject private Repository repository; @@ -29,27 +25,17 @@ public class AddContactDialogViewModel implements ViewModel { @Inject private ResourceBundle defaultResourceBundle; - public AddContactDialogViewModel() { - dialogOpen.addListener((obs, oldV, newV) -> { - if (!newV) { - // contactDialogViewModel.resetDialogPage(); - dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); - dialogScope.setContactToEdit(null); - } - }); - } - public void initialize() { - openDialog(); - } - - - public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewModel) { - contactDialogViewModel.setOkAction(this::addContactAction); - contactDialogViewModel.titleTextProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); + dialogScope.subscribe(ContactDialogScope.Notifications.OK_BEFORE_COMMIT.toString(), (key, payload) -> { + addContactAction(); + }); + + dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); + dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); + Contact contact = new Contact(); + dialogScope.setContactToEdit(contact); } - public void addContactAction() { if (dialogScope.isContactFormValid()) { @@ -60,16 +46,10 @@ public void addContactAction() { repository.save(contact); + dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); + dialogScope.setContactToEdit(null); + publish(CLOSE_DIALOG_NOTIFICATION); } } - - public void openDialog() { - dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); - - Contact contact = new Contact(); - dialogScope.setContactToEdit(contact); - } - - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 40bae4373..9a24fb990 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -31,6 +31,7 @@ public void initialize() { dialogScope.bothFormsValidProperty().bind(valid); dialogScope.subscribe(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString(), (key, payload) -> resetDialogPage()); + titleText.bind(dialogScope.dialogTitleProperty()); } public void okAction() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java index 705096a88..13e9e5e56 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java @@ -24,8 +24,6 @@ public class EditContactDialog implements FxmlView<EditContactDialogViewModel> { private Stage showDialog; public void initialize() { - viewModel.setContactDialogViewModel(contactDialogViewController.getViewModel()); - viewModel.subscribe(viewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { showDialog.close(); }); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 7848dcef3..9bf3b3113 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -7,7 +7,6 @@ import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; public class EditContactDialogViewModel implements ViewModel { @@ -24,16 +23,15 @@ public class EditContactDialogViewModel implements ViewModel { @Inject ResourceBundle defaultResourceBundle; - public void setContactDialogViewModel(ContactDialogViewModel contactDialogViewModel) { - contactDialogViewModel.setOkAction(this::applyAction); - contactDialogViewModel.titleTextProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - - } - - public void initialze() { + public void initialize() { dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); - // dialogScope.setContactToEdit(null); + + dialogScope.subscribe(ContactDialogScope.Notifications.OK_BEFORE_COMMIT.toString(), (key, payload) -> { + applyAction(); + }); + + dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); } public void applyAction() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index 48b23d113..b27978bcc 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -6,18 +6,22 @@ import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; public class ContactDialogScope implements Scope { public enum Notifications { - RESET_DIALOG_PAGE, COMMIT, RESET_FORMS; + RESET_DIALOG_PAGE, OK_BEFORE_COMMIT, COMMIT, RESET_FORMS; } + private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); + private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); private final BooleanProperty bothFormsValid = new SimpleBooleanProperty(); + private final StringProperty dialogTitle = new SimpleStringProperty(); - private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); public BooleanProperty contactFormValidProperty() { return this.contactFormValid; @@ -71,6 +75,21 @@ public final void setBothFormsValid(final boolean bothFormsValid) { this.bothFormsValidProperty().set(bothFormsValid); } + public final StringProperty dialogTitleProperty() { + return this.dialogTitle; + } + + + public final java.lang.String getDialogTitle() { + return this.dialogTitleProperty().get(); + } + + + public final void setDialogTitle(final java.lang.String dialogTitle) { + this.dialogTitleProperty().set(dialogTitle); + } + + } From c06333f7a34fee68032a0ac5e3ad429c72b88e25 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:14:04 +0100 Subject: [PATCH 24/96] Test --- .../contacts/ui/editcontact/EditContactDialogViewModelTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java index f3fde1940..b7b9c5ba6 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java @@ -53,7 +53,6 @@ protected Object[][] getContents() { when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); - viewModel.setContactDialogViewModel(contactDialogViewModel); } } From 4bf497def950dd5acd5b37ea7f59293b3fde200c Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:15:52 +0100 Subject: [PATCH 25/96] Refactoring --- .../examples/contacts/ui/addcontact/AddContactDialog.java | 6 ------ .../contacts/ui/addcontact/AddContactDialogViewModel.java | 1 - 2 files changed, 7 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java index 78e106366..7210bf6b1 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java @@ -4,17 +4,11 @@ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView; -import javafx.fxml.FXML; import javafx.stage.Stage; @Singleton public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { - - @FXML - private ContactDialogView contactDialogViewController; - @InjectViewModel private AddContactDialogViewModel viewModel; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index c09e4159c..2ead0e0d2 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -39,7 +39,6 @@ public void initialize() { public void addContactAction() { if (dialogScope.isContactFormValid()) { - // contactDialogViewModel.getAddressFormViewModel().commitChanges(); dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); Contact contact = dialogScope.getContactToEdit(); From c8459d82c322176e917f8ff50febbde94d288024 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:17:04 +0100 Subject: [PATCH 26/96] code formatting --- .../contacts/ui/addressform/AddressFormView.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java index 532c338cb..9e43398cb 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java @@ -1,27 +1,29 @@ package de.saxsys.mvvmfx.examples.contacts.ui.addressform; +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; import javafx.fxml.FXML; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.ProgressIndicator; import javafx.scene.control.TextField; -import de.saxsys.mvvmfx.FxmlView; -import de.saxsys.mvvmfx.InjectViewModel; public class AddressFormView implements FxmlView<AddressFormViewModel> { + @FXML public TextField streetInput; @FXML public TextField postalcodeInput; @FXML public TextField cityInput; + @FXML public ComboBox<String> countryInput; @FXML public ComboBox<String> federalStateInput; + @FXML public Label subdivisionLabel; - @FXML public Label countryLabel; @@ -34,9 +36,7 @@ public class AddressFormView implements FxmlView<AddressFormViewModel> { public void initialize() { - subdivisionLabel.textProperty().bind(viewModel.subdivisionLabel()); - subdivisionLabel.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); - + loadingIndicator.visibleProperty().bind(viewModel.loadingInProgressProperty()); countryLabel.disableProperty().bind(viewModel.countryInputDisabledProperty()); streetInput.textProperty().bindBidirectional(viewModel.streetProperty()); @@ -51,7 +51,7 @@ public void initialize() { federalStateInput.valueProperty().bindBidirectional(viewModel.selectedSubdivisionProperty()); federalStateInput.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); - loadingIndicator.visibleProperty().bind(viewModel.loadingInProgressProperty()); - + subdivisionLabel.textProperty().bind(viewModel.subdivisionLabel()); + subdivisionLabel.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); } } From 91c21a5e9c50dadccf7919643c307e8e1146f2a3 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:20:07 +0100 Subject: [PATCH 27/96] code formatting --- .../contacts/ui/addressform/AddressFormViewModel.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index a57a02834..b4b617abc 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -32,9 +32,10 @@ public class AddressFormViewModel implements ViewModel { static final String NOTHING_SELECTED_MARKER = "---"; static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; - private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); private ObservableList<String> countries; private ObservableList<String> subdivisions; + + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); private final ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); private final StringProperty street = new SimpleStringProperty(); @@ -150,29 +151,23 @@ private void initSubdivisionList() { private void initCountryList() { countryItemList = new ItemList<>(countrySelector.availableCountries(), Country::getName); - ObservableList<String> mappedList = countryItemList.getTargetList(); - countries = createListWithNothingSelectedMarker( - mappedList); - + countries = createListWithNothingSelectedMarker(mappedList); countries.addListener((ListChangeListener<String>) c -> selectedCountry.set(NOTHING_SELECTED_MARKER)); } private void commitChanges() { - address.setStreet(street.get()); address.setCity(city.get()); address.setPostalcode(postalCode.get()); - address.setCountry(country.get()); address.setSubdivision(subdivision.get()); } public void initWithAddress(Address address) { this.address = address; - street.set(address.getStreet()); city.set(address.getCity()); postalCode.set(address.getPostalcode()); From 839d8c7db6fc87b65f4c2b9684b07e34e72ccdc3 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:26:20 +0100 Subject: [PATCH 28/96] Fixed missing ok handler in dialog --- .../contacts/ui/contactdialog/ContactDialogView.java | 1 - .../ui/contactdialog/ContactDialogViewModel.java | 12 +----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java index ea940a359..968e6d5ff 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java @@ -36,7 +36,6 @@ public class ContactDialogView implements FxmlView<ContactDialogViewModel> { @InjectViewModel private ContactDialogViewModel viewModel; - public void initialize() { ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader .fxmlView(ContactFormView.class).load(); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 9a24fb990..c9053432e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -18,13 +18,9 @@ public class ContactDialogViewModel implements ViewModel { ContactDialogScope dialogScope; private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); - private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); - private final StringProperty titleText = new SimpleStringProperty(); - private Runnable okAction; - public void initialize() { valid.bind( Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); @@ -35,13 +31,7 @@ public void initialize() { } public void okAction() { - if (okAction != null) { - okAction.run(); - } - } - - public void setOkAction(Runnable okAction) { - this.okAction = okAction; + dialogScope.publish(ContactDialogScope.Notifications.OK_BEFORE_COMMIT.toString()); } public void previousAction() { From ad515223ea873823d2a24c42edcbc9fc1dbb76a9 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:29:54 +0100 Subject: [PATCH 29/96] Formatting --- .../contacts/ui/editcontact/EditContactDialog.java | 6 +----- .../ui/editcontact/EditContactDialogViewModel.java | 6 +----- .../contacts/ui/master/MasterTableViewModel.java | 12 ++++++------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java index 13e9e5e56..f0b70a14e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java @@ -1,6 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.ui.editcontact; -import javax.inject.Inject; import javax.inject.Singleton; import de.saxsys.mvvmfx.FxmlView; @@ -15,16 +14,13 @@ public class EditContactDialog implements FxmlView<EditContactDialogViewModel> { @FXML private ContactDialogView contactDialogViewController; - @Inject - private Stage primaryStage; - @InjectViewModel private EditContactDialogViewModel viewModel; private Stage showDialog; public void initialize() { - viewModel.subscribe(viewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + viewModel.subscribe(EditContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { showDialog.close(); }); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 9bf3b3113..6482afc1a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -10,8 +10,8 @@ import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; public class EditContactDialogViewModel implements ViewModel { - static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; + static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; public static final String CLOSE_DIALOG_NOTIFICATION = "CLOSE_DIALOG_NOT"; @Inject @@ -36,12 +36,8 @@ public void initialize() { public void applyAction() { if (dialogScope.bothFormsValidProperty().get()) { - - // contactDialogViewModel.getAddressFormViewModel().commitChanges(); dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); - repository.save(dialogScope.contactToEditProperty().get()); - publish(CLOSE_DIALOG_NOTIFICATION); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java index bfd04fd00..d016e234d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java @@ -1,5 +1,8 @@ package de.saxsys.mvvmfx.examples.contacts.ui.master; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; + import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.util.CentralClock; import de.saxsys.mvvmfx.utils.mapping.ModelWrapper; @@ -8,13 +11,11 @@ import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.StringProperty; -import java.time.LocalDate; -import java.time.temporal.ChronoUnit; - public class MasterTableViewModel { + private final String id; - private IntegerProperty age = new SimpleIntegerProperty(); - private ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); + private final IntegerProperty age = new SimpleIntegerProperty(); + private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); public MasterTableViewModel(Contact contact) { id = contact.getId(); @@ -26,7 +27,6 @@ public MasterTableViewModel(Contact contact) { } } - @Override public boolean equals(Object obj) { From 25f4569423efea1f0b118042c5112380edff7517 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:35:12 +0100 Subject: [PATCH 30/96] Replaced Enum with static String --- .../ui/addcontact/AddContactDialogViewModel.java | 8 ++++---- .../contacts/ui/addressform/AddressFormViewModel.java | 4 ++-- .../ui/contactdialog/ContactDialogViewModel.java | 4 ++-- .../contacts/ui/contactform/ContactFormViewModel.java | 4 ++-- .../ui/editcontact/EditContactDialogViewModel.java | 9 ++++----- .../examples/contacts/ui/scopes/ContactDialogScope.java | 7 ++++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index 2ead0e0d2..9e76049cb 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -26,12 +26,12 @@ public class AddContactDialogViewModel implements ViewModel { private ResourceBundle defaultResourceBundle; public void initialize() { - dialogScope.subscribe(ContactDialogScope.Notifications.OK_BEFORE_COMMIT.toString(), (key, payload) -> { + dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { addContactAction(); }); dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); + dialogScope.publish(ContactDialogScope.RESET_FORMS); Contact contact = new Contact(); dialogScope.setContactToEdit(contact); } @@ -39,13 +39,13 @@ public void initialize() { public void addContactAction() { if (dialogScope.isContactFormValid()) { - dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); + dialogScope.publish(ContactDialogScope.COMMIT); Contact contact = dialogScope.getContactToEdit(); repository.save(contact); - dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); + dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); dialogScope.setContactToEdit(null); publish(CLOSE_DIALOG_NOTIFICATION); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index b4b617abc..57e6cb0f7 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -69,8 +69,8 @@ public class AddressFormViewModel implements ViewModel { private ObjectBinding<Contact> contactBinding; public void initialize() { - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); + dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index c9053432e..14118ce51 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -25,13 +25,13 @@ public void initialize() { valid.bind( Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); dialogScope.bothFormsValidProperty().bind(valid); - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString(), + dialogScope.subscribe(ContactDialogScope.RESET_DIALOG_PAGE, (key, payload) -> resetDialogPage()); titleText.bind(dialogScope.dialogTitleProperty()); } public void okAction() { - dialogScope.publish(ContactDialogScope.Notifications.OK_BEFORE_COMMIT.toString()); + dialogScope.publish(ContactDialogScope.OK_BEFORE_COMMIT); } public void previousAction() { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index 185f760a4..bc7b98521 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -64,8 +64,8 @@ public ContactFormViewModel() { } public void initialize() { - dialogScope.subscribe(ContactDialogScope.Notifications.RESET_FORMS.toString(), (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.Notifications.COMMIT.toString(), (key, payload) -> commitChanges()); + dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); if (contactToEditProperty.get() != null) { diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 6482afc1a..974bbb8bc 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -24,10 +24,9 @@ public class EditContactDialogViewModel implements ViewModel { ResourceBundle defaultResourceBundle; public void initialize() { - dialogScope.publish(ContactDialogScope.Notifications.RESET_FORMS.toString()); - dialogScope.publish(ContactDialogScope.Notifications.RESET_DIALOG_PAGE.toString()); - - dialogScope.subscribe(ContactDialogScope.Notifications.OK_BEFORE_COMMIT.toString(), (key, payload) -> { + dialogScope.publish(ContactDialogScope.RESET_FORMS); + dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); + dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { applyAction(); }); @@ -36,7 +35,7 @@ public void initialize() { public void applyAction() { if (dialogScope.bothFormsValidProperty().get()) { - dialogScope.publish(ContactDialogScope.Notifications.COMMIT.toString()); + dialogScope.publish(ContactDialogScope.COMMIT); repository.save(dialogScope.contactToEditProperty().get()); publish(CLOSE_DIALOG_NOTIFICATION); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index b27978bcc..e7f51b0b0 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -11,9 +11,10 @@ public class ContactDialogScope implements Scope { - public enum Notifications { - RESET_DIALOG_PAGE, OK_BEFORE_COMMIT, COMMIT, RESET_FORMS; - } + public static String RESET_DIALOG_PAGE = "contact_reset_dialog_page"; + public static String OK_BEFORE_COMMIT = "contact_ok_before_commit"; + public static String COMMIT = "contact_commit"; + public static String RESET_FORMS = "contact_reset"; private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); From de3fd5c363bcc230b93272ed2976397281fe8753 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:36:00 +0100 Subject: [PATCH 31/96] deleted line --- .../examples/contacts/ui/contactform/ContactFormViewModel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index bc7b98521..b53d01949 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -53,7 +53,6 @@ public ContactFormViewModel() { return null; }); - formValidator.addValidators( firstnameValidator, lastnameValidator, From d1ead195d2a36119a550c37cfbc9d273ca4a50e9 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Sat, 14 Nov 2015 17:49:39 +0100 Subject: [PATCH 32/96] renamed getter --- .../mvvmfx/examples/contacts/ui/master/MasterView.java | 2 +- .../mvvmfx/examples/contacts/ui/master/MasterViewModel.java | 2 +- .../examples/contacts/ui/master/MasterViewModelTest.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java index 29337fe54..124bb15e9 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java @@ -15,7 +15,7 @@ public class MasterView implements FxmlView<MasterViewModel> { private MasterViewModel viewModel; public void initialize() { - contactTable.setItems(viewModel.contactList()); + contactTable.setItems(viewModel.getContactList()); viewModel.selectedTableRowProperty().bind(contactTable.getSelectionModel().selectedItemProperty()); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java index 2c3a08e06..221eb4817 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java @@ -83,7 +83,7 @@ private void updateContactList() { } } - public ObservableList<MasterTableViewModel> contactList() { + public ObservableList<MasterTableViewModel> getContactList() { return contacts; } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java index ac5d537d5..c6358637a 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java @@ -61,7 +61,7 @@ public void testSelectContact() { assertThat(viewModel.selectedContactProperty()).hasNullValue(); - MasterTableViewModel firstRow = viewModel.contactList().get(0); + MasterTableViewModel firstRow = viewModel.getContactList().get(0); viewModel.selectedTableRowProperty().set(firstRow); @@ -151,7 +151,7 @@ public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { * verify what Contacts are shown in the Table. */ private List<String> getContactIdsInTable() { - return viewModel.contactList().stream().map(MasterTableViewModel::getId).collect( + return viewModel.getContactList().stream().map(MasterTableViewModel::getId).collect( Collectors.toList()); } @@ -160,6 +160,6 @@ private List<String> getContactIdsInTable() { * {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} from the contact list. */ private MasterTableViewModel findTableViewModelForContact(Contact contact) { - return viewModel.contactList().stream().filter(row -> row.getId().equals(contact.getId())).findFirst().get(); + return viewModel.getContactList().stream().filter(row -> row.getId().equals(contact.getId())).findFirst().get(); } } From 48aa4fda967187986823ae1aefa17411babade13 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 16 Nov 2015 09:34:26 +0100 Subject: [PATCH 33/96] Introduced Scope between Master / detail View --- .../contacts/ui/detail/DetailViewModel.java | 29 +++++++++---------- .../contacts/ui/master/MasterViewModel.java | 23 ++++++--------- .../contacts/ui/menu/MenuViewModel.java | 19 ++++++------ .../contacts/ui/scopes/MasterDetailScope.java | 27 +++++++++++++++++ .../ui/detail/DetailViewModelTest.java | 8 ++--- .../ui/master/MasterViewModelTest.java | 25 +++++++++------- 6 files changed, 77 insertions(+), 54 deletions(-) create mode 100644 examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index 8531785cb..9112e5a5f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -5,7 +5,6 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import javax.annotation.PostConstruct; import javax.inject.Inject; import de.saxsys.mvvmfx.InjectScope; @@ -13,8 +12,8 @@ import de.saxsys.mvvmfx.examples.contacts.model.Address; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.MasterDetailScope; import de.saxsys.mvvmfx.utils.commands.Action; import de.saxsys.mvvmfx.utils.commands.Command; import de.saxsys.mvvmfx.utils.commands.DelegateCommand; @@ -49,10 +48,6 @@ public class DetailViewModel implements ViewModel { private DelegateCommand removeCommand; private DelegateCommand emailLinkCommand; - - @Inject - MasterViewModel masterViewModel; - @Inject HostServices hostServices; @@ -60,35 +55,37 @@ public class DetailViewModel implements ViewModel { Repository repository; @InjectScope - ContactDialogScope scope; + MasterDetailScope mdScope; + + @InjectScope + ContactDialogScope dialogscope; - @PostConstruct - void init() { - ReadOnlyObjectProperty<Contact> contactProperty = masterViewModel.selectedContactProperty(); + public void initialize() { + ReadOnlyObjectProperty<Contact> contactProperty = mdScope.selectedContactProperty(); createBindingsForLabels(contactProperty); editCommand = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { - Contact selectedContact = masterViewModel.selectedContactProperty().get(); + Contact selectedContact = mdScope.selectedContactProperty().get(); if (selectedContact != null) { - scope.setContactToEdit(selectedContact); + dialogscope.setContactToEdit(selectedContact); publish(OPEN_EDIT_CONTACT_DIALOG); } } - }, masterViewModel.selectedContactProperty().isNotNull()); + }, mdScope.selectedContactProperty().isNotNull()); removeCommand = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { - Contact selectedContact = masterViewModel.selectedContactProperty().get(); + Contact selectedContact = mdScope.selectedContactProperty().get(); if (selectedContact != null) { - repository.delete(masterViewModel.selectedContactProperty().get()); + repository.delete(mdScope.selectedContactProperty().get()); } } - }, masterViewModel.selectedContactProperty().isNotNull()); + }, mdScope.selectedContactProperty().isNotNull()); emailLinkCommand = new DelegateCommand(() -> new Action() { @Override diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java index 221eb4817..1ccf27a29 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java @@ -4,28 +4,25 @@ import java.util.Set; import java.util.function.Consumer; -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.events.ContactsUpdatedEvent; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.MasterDetailScope; import javafx.beans.binding.Bindings; import javafx.beans.property.ObjectProperty; -import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; - -@ApplicationScoped public class MasterViewModel implements ViewModel { private static final Logger LOG = LoggerFactory.getLogger(MasterViewModel.class); @@ -41,10 +38,15 @@ public class MasterViewModel implements ViewModel { @Inject Repository repository; - @PostConstruct - public void init() { + @InjectScope + MasterDetailScope mdScope; + + + public void initialize() { updateContactList(); + mdScope.selectedContactProperty().bind(selectedContact); + selectedContact.bind(Bindings.createObjectBinding(() -> { if (selectedTableRow.get() == null) { return null; @@ -96,14 +98,7 @@ public ObjectProperty<MasterTableViewModel> selectedTableRowProperty() { return selectedTableRow; } - public ReadOnlyObjectProperty<Contact> selectedContactProperty() { - return this.selectedContact.getReadOnlyProperty(); - } - - public Contact getSelectedContact() { - return this.selectedContactProperty().get(); - } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java index e8c92b3ca..15a2669b8 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java @@ -1,14 +1,14 @@ package de.saxsys.mvvmfx.examples.contacts.ui.menu; -import javax.annotation.PostConstruct; import javax.enterprise.event.Event; import javax.inject.Inject; +import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.events.TriggerShutdownEvent; import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.MasterDetailScope; import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.ReadOnlyBooleanWrapper; @@ -17,18 +17,17 @@ public class MenuViewModel implements ViewModel { @Inject private Event<TriggerShutdownEvent> shouldCloseEvent; - - @Inject - private MasterViewModel masterViewModel; + @InjectScope + private MasterDetailScope mdScope; @Inject private Repository repository; private final ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); - @PostConstruct - public void init() { - removeItemDisabled.bind(masterViewModel.selectedContactProperty().isNull()); + + public void initialize() { + removeItemDisabled.bind(mdScope.selectedContactProperty().isNull()); } public void closeAction() { @@ -36,9 +35,9 @@ public void closeAction() { } public void removeAction() { - Contact selectedContact = masterViewModel.selectedContactProperty().get(); + Contact selectedContact = mdScope.selectedContactProperty().get(); if (selectedContact != null) { - repository.delete(masterViewModel.selectedContactProperty().get()); + repository.delete(mdScope.selectedContactProperty().get()); } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java new file mode 100644 index 000000000..620167b5a --- /dev/null +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java @@ -0,0 +1,27 @@ +package de.saxsys.mvvmfx.examples.contacts.ui.scopes; + +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.examples.contacts.model.Contact; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; + +public class MasterDetailScope implements Scope { + + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); + + public ObjectProperty<Contact> selectedContactProperty() { + return this.selectedContact; + } + + + public final Contact getSelectedContact() { + return this.selectedContactProperty().get(); + } + + + public final void setSelectedContact(final Contact selectedContact) { + this.selectedContactProperty().set(selectedContact); + } + + +} diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java index 716ca018f..26e6b2826 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java @@ -12,7 +12,7 @@ import de.saxsys.mvvmfx.examples.contacts.model.Contact; import de.saxsys.mvvmfx.examples.contacts.model.Repository; -import de.saxsys.mvvmfx.examples.contacts.ui.master.MasterViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.MasterDetailScope; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -30,17 +30,17 @@ public class DetailViewModelTest { @Before public void setup() { - MasterViewModel masterViewModelMock = mock(MasterViewModel.class); + MasterDetailScope masterViewModelMock = mock(MasterDetailScope.class); when(masterViewModelMock.selectedContactProperty()).thenReturn(selectedContact); viewModel = new DetailViewModel(); - viewModel.masterViewModel = masterViewModelMock; + viewModel.mdScope = masterViewModelMock; repository = mock(Repository.class); viewModel.repository = repository; - viewModel.init(); + viewModel.initialize(); luke = new Contact(); obi = new Contact(); diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java index c6358637a..24be4d6b0 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java @@ -19,12 +19,14 @@ import de.saxsys.mvvmfx.examples.contacts.model.ContactFactory; import de.saxsys.mvvmfx.examples.contacts.model.InmemoryRepository; import de.saxsys.mvvmfx.examples.contacts.model.Repository; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.MasterDetailScope; @SuppressWarnings("unchecked") public class MasterViewModelTest { private MasterViewModel viewModel; + private MasterDetailScope mdScope; private Repository repository; private Contact contact1; @@ -37,6 +39,9 @@ public class MasterViewModelTest { public void setup() { repository = new InmemoryRepository(); viewModel = new MasterViewModel(); + mdScope = new MasterDetailScope(); + + viewModel.mdScope = mdScope; viewModel.repository = repository; contact1 = ContactFactory.createRandomContact(); @@ -54,24 +59,24 @@ public void setup() { @Test public void testSelectContact() { - viewModel.init(); + viewModel.initialize(); assertThat(viewModel.selectedTableRowProperty()).hasNullValue(); - assertThat(viewModel.selectedContactProperty()).hasNullValue(); + assertThat(mdScope.selectedContactProperty()).hasNullValue(); MasterTableViewModel firstRow = viewModel.getContactList().get(0); viewModel.selectedTableRowProperty().set(firstRow); - assertThat(viewModel.selectedContactProperty()).hasNotNullValue(); - assertThat(viewModel.selectedContactProperty().get().getId()).isEqualTo(firstRow.getId()); + assertThat(mdScope.selectedContactProperty()).hasNotNullValue(); + assertThat(mdScope.selectedContactProperty().get().getId()).isEqualTo(firstRow.getId()); viewModel.selectedTableRowProperty().set(null); - assertThat(viewModel.selectedContactProperty()).hasNullValue(); + assertThat(mdScope.selectedContactProperty()).hasNullValue(); } @@ -80,7 +85,7 @@ public void testSelectContact() { */ @Test public void testUpdateContactListNoSelection() { - viewModel.init(); + viewModel.initialize(); viewModel.selectedTableRowProperty().set(null); assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); @@ -96,7 +101,7 @@ public void testUpdateContactListNoSelection() { */ @Test public void testUpdateContactListSelectionPersistsAfterUpdate() { - viewModel.init(); + viewModel.initialize(); assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); MasterTableViewModel row2 = findTableViewModelForContact(contact2); @@ -111,7 +116,7 @@ public void testUpdateContactListSelectionPersistsAfterUpdate() { assertThat(getContactIdsInTable()).contains(contact2.getId(), contact3.getId()) .doesNotContain(contact1.getId()); - + verify(onSelectConsumer).accept(row2); } @@ -121,7 +126,7 @@ public void testUpdateContactListSelectionPersistsAfterUpdate() { */ @Test public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { - viewModel.init(); + viewModel.initialize(); MasterTableViewModel row2 = findTableViewModelForContact(contact2); viewModel.selectedTableRowProperty().set(row2); @@ -135,7 +140,7 @@ public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { assertThat(getContactIdsInTable()).contains(contact1.getId(), contact3.getId()) .doesNotContain(contact2.getId()); - + verify(onSelectConsumer).accept(null); } From 99e26d864b7213eb82afcc14fec7ba21123ebe49 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 16 Nov 2015 09:49:49 +0100 Subject: [PATCH 34/96] Small refactoring --- .../contacts/ui/detail/DetailViewModel.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index 9112e5a5f..27f693386 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -21,6 +21,7 @@ import javafx.beans.binding.Bindings; import javafx.beans.binding.ObjectBinding; import javafx.beans.binding.StringBinding; +import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.ReadOnlyStringProperty; import javafx.beans.property.ReadOnlyStringWrapper; @@ -61,31 +62,31 @@ public class DetailViewModel implements ViewModel { ContactDialogScope dialogscope; public void initialize() { - ReadOnlyObjectProperty<Contact> contactProperty = mdScope.selectedContactProperty(); + ReadOnlyObjectProperty<Contact> contactProperty = getSelectedContactPropertyFromScope(); createBindingsForLabels(contactProperty); editCommand = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { - Contact selectedContact = mdScope.selectedContactProperty().get(); + Contact selectedContact = getSelectedContactFromScope(); if (selectedContact != null) { dialogscope.setContactToEdit(selectedContact); publish(OPEN_EDIT_CONTACT_DIALOG); } } - }, mdScope.selectedContactProperty().isNotNull()); + }, getSelectedContactPropertyFromScope().isNotNull()); removeCommand = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { - Contact selectedContact = mdScope.selectedContactProperty().get(); + Contact selectedContact = getSelectedContactFromScope(); if (selectedContact != null) { - repository.delete(mdScope.selectedContactProperty().get()); + repository.delete(getSelectedContactFromScope()); } } - }, mdScope.selectedContactProperty().isNotNull()); + }, getSelectedContactPropertyFromScope().isNotNull()); emailLinkCommand = new DelegateCommand(() -> new Action() { @Override @@ -253,4 +254,12 @@ private String trimStringWithPostfix(String string, String append) { } return string + append; } + + private Contact getSelectedContactFromScope() { + return getSelectedContactPropertyFromScope().get(); + } + + private ObjectProperty<Contact> getSelectedContactPropertyFromScope() { + return mdScope.selectedContactProperty(); + } } From 2748e90b385f8c6f86ebcea2954a1be68d2b1102 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 16 Nov 2015 14:46:00 +0100 Subject: [PATCH 35/96] Changed readme regarding scopes / cdi events --- examples/contacts-example/README.md | 79 ++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/examples/contacts-example/README.md b/examples/contacts-example/README.md index 8d63549c4..53ce06a4d 100644 --- a/examples/contacts-example/README.md +++ b/examples/contacts-example/README.md @@ -22,34 +22,79 @@ With a dialog you can add new contacts or edit existing ones. ### Highlights and interesting parts -#### Dialogs opened with CDI-Events +#### Usage of Scopes -- The application uses CDI-Events to decouple the *add*/*edit* dialogs from the places where they are opened. Instead, when a - button is clicked to open a dialog, an CDI-Event is fired. The dialog reacts to this event and will open up itself. +[mvvmFX Scopes](https://github.com/sialcasa/mvvmFX/wiki/Scopes) are used for two scenarios in this example: -[ToolbarViewModel.java:](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java) +* Communication between the Master and the Detail View +* Dialog to add or edit a contact -```java -@Inject -private Event<OpenAddContactDialogEvent> openPopupEvent; +##### Scope for Master Detail View + + +[MasterDetailScope.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java) -public void addNewContactAction(){ - openPopupEvent.fire(new OpenAddContactDialogEvent()); +[MasterViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java) + +[DetailViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java) + +```Java +public class MasterDetailScope implements Scope { + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); } ``` -[AddContactDialog.java:](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java) - -```java -public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { - ... +```Java +public class MasterViewModel implements ViewModel { + @InjectScope + MasterDetailScope mdScope; + + public void initialize() { + mdScope.selectedContactProperty().bind(selectedContact); + } +} +``` - public void open(@Observes OpenAddContactDialogEvent event) { - viewModel.openDialog(); - } +```Java +public class MasterDetailScope implements Scope { + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); } ``` + +##### Scope for Dialog Wizard + +In this case the scope is used to handle the state of a multi paged wizard dialog. + +###### Classes that are opening the dialogs + +[ToolbarView.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView) + +[DetailView](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java) + +First usage of the scope in [DetailViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel), where the person object which should get edited is set. + + + +###### Dialog Base + +[ContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java) + +###### Specific Dialog Implementation + +[EditContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java) + +[AddContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java) + +###### Dialog pages + +[ContactFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java) + +[AddressFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java) + + + + #### ResourceBundles and I18N There are resourceBundles available for german and english language. In [App.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java) From 157025d30f638552e99b11cff99b69d51c61ceb1 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Tue, 17 Nov 2015 17:23:48 +0100 Subject: [PATCH 36/96] Documented usage of scopes in the example --- examples/contacts-example/README.md | 46 +++++++++++------------------ 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/examples/contacts-example/README.md b/examples/contacts-example/README.md index 53ce06a4d..4cb120846 100644 --- a/examples/contacts-example/README.md +++ b/examples/contacts-example/README.md @@ -31,12 +31,7 @@ With a dialog you can add new contacts or edit existing ones. ##### Scope for Master Detail View - -[MasterDetailScope.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java) - -[MasterViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java) - -[DetailViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java) +In this scenario the [MasterDetailScope](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java) is used to provide a property where the [MasterViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java) signals which contact should be displayed in the [DetailViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java). ```Java public class MasterDetailScope implements Scope { @@ -56,43 +51,38 @@ public class MasterViewModel implements ViewModel { ``` ```Java -public class MasterDetailScope implements Scope { - private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); +public class DetailViewModel implements ViewModel { + @InjectScope + MasterDetailScope mdScope; + + ...//Create all bindings to the information of the mdScope.selectedContactProperty() } + ``` ##### Scope for Dialog Wizard -In this case the scope is used to handle the state of a multi paged wizard dialog. - -###### Classes that are opening the dialogs - -[ToolbarView.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView) - -[DetailView](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java) - -First usage of the scope in [DetailViewModel.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel), where the person object which should get edited is set. - - - -###### Dialog Base +In this case the scope is used to handle the state of a multi paged dialog. -[ContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java) +To understand the machanism of the implemented dialogs, you should check the following classes: -###### Specific Dialog Implementation +* [EditContactDialogView](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java) and [AddContactDialog](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java) -[EditContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java) +* Both of them are using the [ContactDialogView](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java) with different configurations. -[AddContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java) +* [AddressFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java) and [ContactFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java) are the dialog pages (1 and 2) that are displayed in the EditContactDialog and the AddContactDialog -###### Dialog pages +* Also check the Views where the dialogs are created ([ToolbarView.java](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView) and [DetailView](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java)). -[ContactFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java) +######Scope usages###### +The used scope is called [ContactDialogScope](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java) and it has three use cases: -[AddressFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java) +1. Configuration (eg. title) of the [ContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java) from the [EditContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java) and [AddContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java). +2. [DetailViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel) sets the Contact object that will be edited into the scope. This information is used by the dialog pages: [AddressFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java) and [ContactFormViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java) +3. [ContactDialogViewModel](src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java) binds the *disableProperty()* of the navigation buttons to the validation state in the scope. This validation state is bound to the validation state of the dialog pages (AddressFormView and ContactFormView). #### ResourceBundles and I18N From 93f22ef298211ec65a13fccbd25e0c3ed7f95653 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@googlemail.com> Date: Wed, 18 Nov 2015 00:49:47 +0100 Subject: [PATCH 37/96] Formatted XML snipped in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 975999389..9ef3e5e38 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Here we make bug fixes for the current stable release. Here we develop new features. This release is unstable and shouldn't be used in production. -``` +```xml <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx</artifactId> From 5b5fe05d0e84159c3ca8823a72935aa8980a66e7 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Thu, 19 Nov 2015 14:50:36 +0100 Subject: [PATCH 38/96] Add failing test to reproduce bug --- .../FluentViewLoader_FxmlView_Test.java | 41 +++++++++++++++++-- .../FluentViewLoader_JavaView_Test.java | 7 +++- ...wWithoutViewModelTypeButWithInjection.java | 2 +- .../viewloader/example/TestViewModel.java | 6 +++ 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java index 6d17c6812..245c2e6d6 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java @@ -58,6 +58,8 @@ public void testLoadFxmlViewTuple() throws IOException { TestFxmlView.instanceCounter = 0; TestViewModel.instanceCounter = 0; + + TestViewModel.wasInitialized = false; final ViewTuple<TestFxmlView, TestViewModel> viewTuple = FluentViewLoader.fxmlView(TestFxmlView.class) .resourceBundle(resourceBundle).load(); @@ -75,6 +77,7 @@ public void testLoadFxmlViewTuple() throws IOException { assertThat(TestFxmlView.instanceCounter).isEqualTo(1); assertThat(TestViewModel.instanceCounter).isEqualTo(1); + assertThat(TestViewModel.wasInitialized).isTrue(); } @@ -133,6 +136,7 @@ public void testViewWithoutViewModelType() { @Test public void testViewWithFxRoot() { TestFxmlViewFxRoot root = new TestFxmlViewFxRoot(); + TestViewModel.wasInitialized = false; ViewTuple<TestFxmlViewFxRoot, TestViewModel> viewTuple = FluentViewLoader.fxmlView( TestFxmlViewFxRoot.class).codeBehind(root).root(root).load(); @@ -144,6 +148,8 @@ public void testViewWithFxRoot() { assertThat(viewTuple.getCodeBehind().viewModel).isNotNull(); assertThat(viewTuple.getCodeBehind().viewModelWasNull).isFalse(); + + assertThat(TestViewModel.wasInitialized).isTrue(); } @@ -152,6 +158,7 @@ public void testViewWithFxRoot() { */ @Test public void testUseExistingCodeBehind() { + TestViewModel.wasInitialized = false; TestFxmlViewWithMissingController codeBehind = new TestFxmlViewWithMissingController(); ViewTuple<TestFxmlViewWithMissingController, TestViewModel> viewTuple = @@ -161,6 +168,8 @@ public void testUseExistingCodeBehind() { assertThat(viewTuple.getCodeBehind()).isEqualTo(codeBehind); assertThat(viewTuple.getCodeBehind().viewModel).isNotNull(); + + assertThat(TestViewModel.wasInitialized).isTrue(); } /** @@ -240,12 +249,16 @@ public void testAlreadyExistingViewModelShouldNotBeOverwritten() { TestViewModel existingViewModel = new TestViewModel(); codeBehind.viewModel = existingViewModel; + TestViewModel.wasInitialized = false; ViewTuple<TestFxmlViewWithMissingController, TestViewModel> viewTuple = FluentViewLoader .fxmlView(TestFxmlViewWithMissingController.class).codeBehind(codeBehind).load(); assertThat(viewTuple.getCodeBehind()).isNotNull(); assertThat(viewTuple.getCodeBehind().viewModel).isEqualTo(existingViewModel); + + // Existing VM should not be re-initialized + assertThat(TestViewModel.wasInitialized).isFalse(); } @@ -311,7 +324,18 @@ public void testThrowExceptionWhenWrongViewModelTypeIsInjected() { .hasMessageContaining("field doesn't match the generic ViewModel type "); } } - + + + @Test + public void testInjectViewModelInViewWithoutGenericViewModelType() { + try { + FluentViewLoader.fxmlView(TestFxmlViewWithoutViewModelTypeButWithInjection.class).load(); + fail("Expected an Exception"); + } catch (Exception e) { + assertThat(ExceptionUtils.getRootCause(e)).isInstanceOf(RuntimeException.class).hasMessageContaining("field doesn't match the generic ViewModel type "); + } + } + /** * The {@link InjectViewModel} annotation may only be used on fields whose Type are implementing {@link ViewModel}. */ @@ -355,7 +379,7 @@ public void testSubViewIsCorrectlyInitialized() { */ @Test public void testUseExistingViewModel() { - + TestViewModel.wasInitialized = false; TestViewModel viewModel = new TestViewModel(); ViewTuple<TestFxmlView, TestViewModel> viewTupleOne = FluentViewLoader.fxmlView(TestFxmlView.class) @@ -378,6 +402,9 @@ public void testUseExistingViewModel() { assertThat(viewTupleTwo.getCodeBehind().getViewModel()).isEqualTo(viewModel); assertThat(viewTupleTwo.getCodeBehind()).isNotEqualTo(viewTupleOne.getCodeBehind()); + + // when an existing VM is used it should not be re-initialized + assertThat(TestViewModel.wasInitialized).isFalse(); } /** @@ -385,14 +412,15 @@ public void testUseExistingViewModel() { */ @Test public void testViewModelIsAvailableInViewTupleEvenIfItIsntInjectedInTheView() { - + TestViewModel.wasInitialized = false; ViewTuple<TestFxmlViewWithoutViewModelField, TestViewModel> viewTuple = FluentViewLoader .fxmlView(TestFxmlViewWithoutViewModelField.class).load(); assertThat(viewTuple.getCodeBehind().wasInitialized).isTrue(); assertThat(viewTuple.getViewModel()).isNotNull(); - + + assertThat(TestViewModel.wasInitialized).isTrue(); } /** @@ -407,6 +435,8 @@ public void testViewModelIsAvailableInViewTupleEvenIfItIsntInjectedInTheView() { */ @Test public void testExistingViewModelWithoutInjectionInView() { + TestViewModel.wasInitialized = false; + DependencyInjector.getInstance().setCustomInjector(type -> { if(type.equals(TestViewModel.class)) { fail("An instance of TestViewModel was requested!"); @@ -430,5 +460,8 @@ public void testExistingViewModelWithoutInjectionInView() { // we need to reset the DI DependencyInjector.getInstance().setCustomInjector(null); + + + assertThat(TestViewModel.wasInitialized).isFalse(); } } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java index d1fa2acf1..054c7d938 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java @@ -85,6 +85,7 @@ public void after() { */ @Test public void testViewTuple() { + TestViewModel.wasInitialized = false; class TestView extends VBox implements JavaView<TestViewModel> { @InjectViewModel private TestViewModel viewModel; @@ -96,6 +97,7 @@ class TestView extends VBox implements JavaView<TestViewModel> { assertThat(viewTuple.getView()).isNotNull().isInstanceOf(VBox.class); assertThat(viewTuple.getCodeBehind()).isNotNull(); assertThat(viewTuple.getViewModel()).isNotNull(); + assertThat(TestViewModel.wasInitialized).isTrue(); } @Test @@ -248,8 +250,9 @@ class TestView extends VBox implements JavaView<TestViewModel> { assertThat(rootCause).isInstanceOf(RuntimeException.class).hasMessageContaining("doesn't implement the 'ViewModel' interface"); } } - - + + + /** * A View without generic ViewModel type can't inject a ViewModel */ diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelTypeButWithInjection.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelTypeButWithInjection.java index 673c8e5de..3b1bf2792 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelTypeButWithInjection.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestFxmlViewWithoutViewModelTypeButWithInjection.java @@ -4,7 +4,7 @@ import de.saxsys.mvvmfx.InjectViewModel; public class TestFxmlViewWithoutViewModelTypeButWithInjection implements FxmlView { - + @InjectViewModel public TestViewModel viewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java index bc9ec02d5..c99b997d7 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestViewModel.java @@ -4,9 +4,15 @@ public class TestViewModel implements ViewModel { public static int instanceCounter = 0; + + public static boolean wasInitialized = false; public TestViewModel() { instanceCounter++; } + + public void initialize() { + wasInitialized = true; + } } From dec341003bf85c758b2c68a0d281ad30f4baee76 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 24 Nov 2015 11:31:05 +0100 Subject: [PATCH 39/96] added additional assertions for initialization handling --- .../FluentViewLoader_FxmlView_Test.java | 10 +++++++--- .../FluentViewLoader_JavaView_Test.java | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java index 245c2e6d6..551ef47f4 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java @@ -332,7 +332,8 @@ public void testInjectViewModelInViewWithoutGenericViewModelType() { FluentViewLoader.fxmlView(TestFxmlViewWithoutViewModelTypeButWithInjection.class).load(); fail("Expected an Exception"); } catch (Exception e) { - assertThat(ExceptionUtils.getRootCause(e)).isInstanceOf(RuntimeException.class).hasMessageContaining("field doesn't match the generic ViewModel type "); + assertThat(ExceptionUtils.getRootCause(e)).isInstanceOf(RuntimeException.class) + .hasMessageContaining("tries to inject a viewModel"); } } @@ -345,7 +346,8 @@ public void testThrowExceptionWhenInjectViewModelAnnotationIsUsedOnOtherType() { FluentViewLoader.fxmlView(TestFxmlViewWithWrongAnnotationUsage.class).load(); fail("Expected an Exception"); } catch (Exception e) { - assertThat(ExceptionUtils.getRootCause(e)).isInstanceOf(RuntimeException.class).hasMessageContaining("doesn't implement the 'ViewModel' interface"); + assertThat(ExceptionUtils.getRootCause(e)).isInstanceOf(RuntimeException.class) + .hasMessageContaining("doesn't implement the 'ViewModel' interface"); } } @@ -390,7 +392,9 @@ public void testUseExistingViewModel() { assertThat(viewTupleOne.getCodeBehind().getViewModel()).isEqualTo(viewModel); assertThat(viewTupleOne.getViewModel()).isEqualTo(viewModel); - + + // when an existing VM is used it should not be re-initialized + assertThat(TestViewModel.wasInitialized).isFalse(); ViewTuple<TestFxmlView, TestViewModel> viewTupleTwo = FluentViewLoader.fxmlView(TestFxmlView.class) .viewModel(viewModel) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java index 054c7d938..9a9407808 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java @@ -116,6 +116,7 @@ class TestView extends VBox implements JavaView<TestViewModelWithResourceBundle> assertThat(TestViewModelWithResourceBundle.wasInitialized).isTrue(); assertThat(TestViewModelWithResourceBundle.resourceBundleWasAvailableAtInitialize).isTrue(); } + /** @@ -140,6 +141,8 @@ class TestView implements JavaView<TestViewModel> { */ @Test public void testViewWithoutViewModelType() { + + TestViewModel.wasInitialized = false; class TestView extends VBox implements JavaView { } @@ -150,6 +153,8 @@ class TestView extends VBox implements JavaView { View codeBehind = viewTuple.getCodeBehind(); assertThat(codeBehind).isNotNull().isInstanceOf(TestView.class); + + assertThat(TestViewModel.wasInitialized).isTrue(); } /** @@ -157,6 +162,8 @@ class TestView extends VBox implements JavaView { */ @Test public void testViewModelWasInjectedBeforeExplicitInitialize() { + TestViewModel.wasInitialized = false; + class TestView extends VBox implements JavaView<TestViewModel>, Initializable { @InjectViewModel public TestViewModel viewModel; @@ -172,6 +179,7 @@ public void initialize(URL location, ResourceBundle resources) { assertThat(loadedView.viewModel).isNotNull(); assertThat(loadedView.viewModelWasInjected).isTrue(); + assertThat(TestViewModel.wasInitialized).isTrue(); } /** @@ -179,6 +187,8 @@ public void initialize(URL location, ResourceBundle resources) { */ @Test public void testViewModelWasInjectedBeforeImplicitInitialize() { + TestViewModel.wasInitialized = false; + class TestView extends VBox implements JavaView<TestViewModel> { @InjectViewModel public TestViewModel viewModel; @@ -193,6 +203,7 @@ public void initialize() { assertThat(loadedView.viewModel).isNotNull(); assertThat(loadedView.viewModelWasInjected).isTrue(); + assertThat(TestViewModel.wasInitialized).isTrue(); } @@ -279,6 +290,8 @@ class TestView extends VBox implements JavaView { */ @Test public void testViewModelIsAvailableInViewTupleEvenIfItIsntInjectedInTheView() { + TestViewModel.wasInitialized = false; + class TestView extends VBox implements JavaView<TestViewModel> { } @@ -287,11 +300,14 @@ class TestView extends VBox implements JavaView<TestViewModel> { .javaView(TestView.class).load(); assertThat(viewTuple.getViewModel()).isNotNull(); + assertThat(TestViewModel.wasInitialized).isTrue(); } @Test public void testUseExistingViewModel() { + TestViewModel.wasInitialized = false; + class TestView extends VBox implements JavaView<TestViewModel> { @InjectViewModel public TestViewModel viewModel; @@ -304,6 +320,8 @@ class TestView extends VBox implements JavaView<TestViewModel> { assertThat(viewTuple.getCodeBehind().viewModel).isEqualTo(viewModel); assertThat(viewTuple.getViewModel()).isEqualTo(viewModel); + + assertThat(TestViewModel.wasInitialized).isFalse(); // existing VMs aren't re-initialized } From 28a783241900323b0154b650a4be7662453b63f6 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 24 Nov 2015 14:11:28 +0100 Subject: [PATCH 40/96] update version to 1.4.2-SNAPSHOT to begin next bugfix cycle --- examples/books-example/pom.xml | 2 +- examples/contacts-example/pom.xml | 2 +- examples/mini-examples/fx-root-example/pom.xml | 2 +- examples/mini-examples/helloworld-without-fxml/pom.xml | 2 +- examples/mini-examples/helloworld/pom.xml | 2 +- examples/mini-examples/pom.xml | 2 +- examples/mini-examples/synchronizefx-example/pom.xml | 2 +- examples/mini-examples/welcome-example/pom.xml | 2 +- examples/pom.xml | 2 +- examples/todomvc-example/pom.xml | 2 +- mvvmfx-archetype/pom.xml | 2 +- mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml | 2 +- mvvmfx-cdi/pom.xml | 2 +- mvvmfx-guice/pom.xml | 2 +- mvvmfx-testing-utils/pom.xml | 2 +- mvvmfx-utils/pom.xml | 2 +- mvvmfx/pom.xml | 2 +- pom.xml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/books-example/pom.xml b/examples/books-example/pom.xml index 6dfa7867f..fc769d7af 100644 --- a/examples/books-example/pom.xml +++ b/examples/books-example/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys.mvvmfx</groupId> <artifactId>examples</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/contacts-example/pom.xml b/examples/contacts-example/pom.xml index ad6855b22..e9b161490 100644 --- a/examples/contacts-example/pom.xml +++ b/examples/contacts-example/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>de.saxsys.mvvmfx</groupId> <artifactId>examples</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <artifactId>contacts-example</artifactId> diff --git a/examples/mini-examples/fx-root-example/pom.xml b/examples/mini-examples/fx-root-example/pom.xml index aeb65e31c..635d46c79 100644 --- a/examples/mini-examples/fx-root-example/pom.xml +++ b/examples/mini-examples/fx-root-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/helloworld-without-fxml/pom.xml b/examples/mini-examples/helloworld-without-fxml/pom.xml index 96c8c4f10..d83dd1717 100644 --- a/examples/mini-examples/helloworld-without-fxml/pom.xml +++ b/examples/mini-examples/helloworld-without-fxml/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/helloworld/pom.xml b/examples/mini-examples/helloworld/pom.xml index afb2ba6ae..06f189690 100644 --- a/examples/mini-examples/helloworld/pom.xml +++ b/examples/mini-examples/helloworld/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/pom.xml b/examples/mini-examples/pom.xml index dcc348b17..c23e1a8fe 100644 --- a/examples/mini-examples/pom.xml +++ b/examples/mini-examples/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <packaging>pom</packaging> diff --git a/examples/mini-examples/synchronizefx-example/pom.xml b/examples/mini-examples/synchronizefx-example/pom.xml index 93c6388f0..d1804786e 100644 --- a/examples/mini-examples/synchronizefx-example/pom.xml +++ b/examples/mini-examples/synchronizefx-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/welcome-example/pom.xml b/examples/mini-examples/welcome-example/pom.xml index 687108930..0e5b1843d 100644 --- a/examples/mini-examples/welcome-example/pom.xml +++ b/examples/mini-examples/welcome-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/pom.xml b/examples/pom.xml index 0566f8cb8..785e3412e 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <groupId>de.saxsys.mvvmfx</groupId> diff --git a/examples/todomvc-example/pom.xml b/examples/todomvc-example/pom.xml index 7a966b04b..9c0516396 100644 --- a/examples/todomvc-example/pom.xml +++ b/examples/todomvc-example/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys.mvvmfx</groupId> <artifactId>examples</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/mvvmfx-archetype/pom.xml b/mvvmfx-archetype/pom.xml index e75f5922c..d046713cb 100644 --- a/mvvmfx-archetype/pom.xml +++ b/mvvmfx-archetype/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> diff --git a/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml b/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml index d2140a7c5..133dbfb24 100644 --- a/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml +++ b/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml @@ -16,7 +16,7 @@ <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> <type>pom</type> <scope>import</scope> </dependency> diff --git a/mvvmfx-cdi/pom.xml b/mvvmfx-cdi/pom.xml index 694343b49..802f1c0d2 100644 --- a/mvvmfx-cdi/pom.xml +++ b/mvvmfx-cdi/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <artifactId>mvvmfx-cdi</artifactId> diff --git a/mvvmfx-guice/pom.xml b/mvvmfx-guice/pom.xml index b81a38ba1..f08ba7463 100644 --- a/mvvmfx-guice/pom.xml +++ b/mvvmfx-guice/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <artifactId>mvvmfx-guice</artifactId> diff --git a/mvvmfx-testing-utils/pom.xml b/mvvmfx-testing-utils/pom.xml index 684867d15..5d86f9642 100644 --- a/mvvmfx-testing-utils/pom.xml +++ b/mvvmfx-testing-utils/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mvvmfx-parent</artifactId> <groupId>de.saxsys</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/mvvmfx-utils/pom.xml b/mvvmfx-utils/pom.xml index 697fe9026..a6e8d3091 100644 --- a/mvvmfx-utils/pom.xml +++ b/mvvmfx-utils/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mvvmfx-parent</artifactId> <groupId>de.saxsys</groupId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/mvvmfx/pom.xml b/mvvmfx/pom.xml index 6e2b1512d..3dc89dbad 100644 --- a/mvvmfx/pom.xml +++ b/mvvmfx/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> </parent> <artifactId>mvvmfx</artifactId> diff --git a/pom.xml b/pom.xml index 9c29b087a..0122c4f24 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> <packaging>pom</packaging> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> <name>mvvmFX parent</name> <description>Application Framework for MVVM with JavaFX.</description> <url>http://www.saxsys.de</url> From 0db5799b77e88128a21da4732b6a2fabf5868c51 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@googlemail.com> Date: Mon, 14 Dec 2015 17:11:56 +0100 Subject: [PATCH 41/96] Added Commercial Support Option --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0fdd02b9e..9c9716121 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ __mvvm(fx)__ is an application framework which provides you necessary components __MVVM__ is the enhanced version of the [Presentation Model](http://martinfowler.com/eaaDev/PresentationModel.html "Presentation Model") pattern and was created by Microsoft engineers for [WPF](http://msdn.microsoft.com/en-us/library/ms754130.aspx "WPF") . JavaFX and WPF does have similarities like Databinding and descriptive UI declaration (FXML/XAML). Because of this fact we adopt best practices of the development with the Microsoft technology. +[](mailto:alexander.casall@saxsys.de) [](https://travis-ci.org/sialcasa/mvvmFX) + ###[Howto](../../wiki "Howto")### ### Maven dependency### From 5428dd567b9b8aafe917579659c1346ffb1a6a78 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@googlemail.com> Date: Mon, 14 Dec 2015 17:19:17 +0100 Subject: [PATCH 42/96] Commercial Support Contact Adress --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c9716121..f983bbfd4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ __mvvm(fx)__ is an application framework which provides you necessary components __MVVM__ is the enhanced version of the [Presentation Model](http://martinfowler.com/eaaDev/PresentationModel.html "Presentation Model") pattern and was created by Microsoft engineers for [WPF](http://msdn.microsoft.com/en-us/library/ms754130.aspx "WPF") . JavaFX and WPF does have similarities like Databinding and descriptive UI declaration (FXML/XAML). Because of this fact we adopt best practices of the development with the Microsoft technology. -[](mailto:alexander.casall@saxsys.de) +[](http://goo.gl/forms/WVBG3SWHuL) [](https://travis-ci.org/sialcasa/mvvmFX) From 78718d40a646212bcd4016ce737966fea121d4d5 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Wed, 13 Jan 2016 20:00:57 +0100 Subject: [PATCH 43/96] Add missing suffix 'View'. --- .../{AddContactDialog.java => AddContactDialogView.java} | 2 +- .../mvvmfx/examples/contacts/ui/detail/DetailView.java | 6 +++--- .../{EditContactDialog.java => EditContactDialogView.java} | 2 +- .../mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java | 4 ++-- .../{AddContactDialog.fxml => AddContactDialogView.fxml} | 2 +- .../{EditContactDialog.fxml => EditContactDialogView.fxml} | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) rename examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/{AddContactDialog.java => AddContactDialogView.java} (86%) rename examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/{EditContactDialog.java => EditContactDialogView.java} (89%) rename examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/{AddContactDialog.fxml => AddContactDialogView.fxml} (91%) rename examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/{EditContactDialog.fxml => EditContactDialogView.fxml} (91%) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java similarity index 86% rename from examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java index 7210bf6b1..739aa12b7 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java @@ -7,7 +7,7 @@ import javafx.stage.Stage; @Singleton -public class AddContactDialog implements FxmlView<AddContactDialogViewModel> { +public class AddContactDialogView implements FxmlView<AddContactDialogViewModel> { @InjectViewModel private AddContactDialogViewModel viewModel; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java index cdef5ad3f..29d507934 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java @@ -8,7 +8,7 @@ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialog; +import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogView; import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogViewModel; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import de.saxsys.mvvmfx.utils.commands.Command; @@ -74,8 +74,8 @@ public void initialize() { initIcons(); viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { - ViewTuple<EditContactDialog, EditContactDialogViewModel> load = FluentViewLoader - .fxmlView(EditContactDialog.class) + ViewTuple<EditContactDialogView, EditContactDialogViewModel> load = FluentViewLoader + .fxmlView(EditContactDialogView.class) .load(); Parent view = load.getView(); Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java similarity index 89% rename from examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java index f0b70a14e..35f4ba4ba 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java @@ -9,7 +9,7 @@ import javafx.stage.Stage; @Singleton -public class EditContactDialog implements FxmlView<EditContactDialogViewModel> { +public class EditContactDialogView implements FxmlView<EditContactDialogViewModel> { @FXML private ContactDialogView contactDialogViewController; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java index 2dd25e5e2..6f319077b 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java @@ -8,7 +8,7 @@ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialog; +import de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialogView; import de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialogViewModel; import de.saxsys.mvvmfx.examples.contacts.util.DialogHelper; import javafx.fxml.FXML; @@ -33,7 +33,7 @@ public void initialize() { @FXML public void addNewContact() { - ViewTuple<AddContactDialog, AddContactDialogViewModel> load = FluentViewLoader.fxmlView(AddContactDialog.class) + ViewTuple<AddContactDialogView, AddContactDialogViewModel> load = FluentViewLoader.fxmlView(AddContactDialogView.class) .load(); Parent view = load.getView(); Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml similarity index 91% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml rename to examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml index 072c91b0e..c29c29710 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialog.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> -<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialog"> +<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialogView"> <children> <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" fx:id="contactDialogView" diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml similarity index 91% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml rename to examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml index a89106b1c..5e105a527 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialog.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> -<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialog"> +<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogView"> <children> <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" fx:id="contactDialogView" From cebe9a664f9170c9ef434526ee65a0110529c315 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@googlemail.com> Date: Sun, 17 Jan 2016 00:16:11 +0100 Subject: [PATCH 44/96] #350 JavaViews can now be loaded with existing codeBehind --- .../de/saxsys/mvvmfx/FluentViewLoader.java | 29 +++++++++++++++---- .../internal/viewloader/JavaViewLoader.java | 15 ++-------- .../FluentViewLoader_JavaView_Test.java | 26 +++++++++++++++-- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java index 26ef3d424..9c9ad86a2 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java @@ -1,11 +1,11 @@ package de.saxsys.mvvmfx; -import java.util.ResourceBundle; - import de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader; import de.saxsys.mvvmfx.internal.viewloader.JavaViewLoader; import de.saxsys.mvvmfx.internal.viewloader.ResourceBundleManager; +import java.util.ResourceBundle; + /** * Fluent API for loading Views. <br> * @@ -57,6 +57,7 @@ public static class JavaViewStep<ViewType extends JavaView<? extends ViewModelTy private ResourceBundle resourceBundle; private ViewModelType viewModel; + private ViewType codeBehind; JavaViewStep(Class<? extends ViewType> viewType) { this.viewType = viewType; @@ -92,7 +93,21 @@ public JavaViewStep<ViewType, ViewModelType> viewModel(ViewModelType viewModel) this.viewModel = viewModel; return this; } - + + /** + * This param is used to define an existing instance of the codeBehind class that is used instead of creating a + * new one while loading. <br> + * + * This can be useful when creating custom controls. + * + * @param codeBehind + * the codeBehind instance that is used to load this java view. + * @return this instance of the builder step. + */ + public JavaViewStep<ViewType, ViewModelType> codeBehind(ViewType codeBehind) { + this.codeBehind = codeBehind; + return this; + } /** * The final step of the Fluent API. This method loads the view based on the given params. @@ -102,9 +117,11 @@ public JavaViewStep<ViewType, ViewModelType> viewModel(ViewModelType viewModel) public ViewTuple<ViewType, ViewModelType> load() { JavaViewLoader javaViewLoader = new JavaViewLoader(); - return javaViewLoader.loadJavaViewTuple(viewType, ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), viewModel); + return javaViewLoader.loadJavaViewTuple(viewType, ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), viewModel, codeBehind); } - } + + + } /** * This class is the builder step to load a fxml based view. It is accessed from the {@link FluentViewLoader} with @@ -123,7 +140,7 @@ public static class FxmlViewStep<ViewType extends FxmlView<? extends ViewModelTy private Object root; private ViewType codeBehind; private ViewModelType viewModel; - + FxmlViewStep(Class<? extends ViewType> viewType) { this.viewType = viewType; } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 9fa31428e..101e7024b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -30,15 +30,6 @@ import java.util.List; import java.util.ResourceBundle; -import javafx.fxml.Initializable; -import javafx.scene.Parent; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.ViewTuple; - /** * This viewLoader is used to load views that are implementing {@link de.saxsys.mvvmfx.JavaView}. * @@ -78,10 +69,10 @@ public class JavaViewLoader { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadJavaViewTuple( Class<? extends ViewType> - viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel) { + viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel, ViewType codeBehind) { DependencyInjector injectionFacade = DependencyInjector.getInstance(); - - final ViewType view = injectionFacade.getInstanceOf(viewType); + + final ViewType view = codeBehind == null ? injectionFacade.getInstanceOf(viewType) : codeBehind; if (!(view instanceof Parent)) { throw new IllegalArgumentException("Can not load java view! The view class has to extend from " diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java index abaafa7cb..ab3a5e3cb 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java @@ -33,6 +33,7 @@ import java.net.URL; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; +import java.util.concurrent.atomic.AtomicInteger; import static de.saxsys.mvvmfx.internal.viewloader.ResourceBundleAssert.assertThat; import static org.assertj.core.api.Assertions.assertThat; @@ -543,5 +544,26 @@ public void initialize(URL location, ResourceBundle resources) { assertThat(loadedView.resources).isNull(); } - -} + + + @Test + public void testExistingCodeBehindIsUsed() { + AtomicInteger counter = new AtomicInteger(0); + class TestView extends VBox implements JavaView<TestViewModel> { + + TestView() { + counter.incrementAndGet(); + } + } + + TestView view = new TestView(); + + final ViewTuple<TestView, TestViewModel> viewTuple = FluentViewLoader.javaView(TestView.class).codeBehind(view).load(); + + assertThat(viewTuple.getView()).isEqualTo(view); + assertThat(viewTuple.getCodeBehind()).isEqualTo(view); + + assertThat(counter.get()).isEqualTo(1); + } + +} \ No newline at end of file From e756b3796db2f4e4f46b3bb6e68f842b3706efbe Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 31 Jan 2016 19:23:52 +0100 Subject: [PATCH 45/96] Format sourcecode. --- examples/mini-examples/helloworld/pom.xml | 34 +++++++++--------- .../examples/helloworld/HelloWorldView.java | 23 ++++++------ .../helloworld/HelloWorldViewModel.java | 30 ++++++++-------- .../mvvmfx/examples/helloworld/Starter.java | 35 +++++++++---------- .../examples/helloworld/HelloWorldView.fxml | 15 ++++---- 5 files changed, 66 insertions(+), 71 deletions(-) diff --git a/examples/mini-examples/helloworld/pom.xml b/examples/mini-examples/helloworld/pom.xml index cbd814fef..105238c39 100644 --- a/examples/mini-examples/helloworld/pom.xml +++ b/examples/mini-examples/helloworld/pom.xml @@ -1,23 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>mini-examples</artifactId> - <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>helloworld</artifactId> - <name>HelloWorld Example</name> - - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - </dependencies> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworld</artifactId> + <name>HelloWorld Example</name> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java index cbc6b7b9c..cecfb350f 100644 --- a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java +++ b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java @@ -10,15 +10,16 @@ import de.saxsys.mvvmfx.InjectViewModel; public class HelloWorldView implements FxmlView<HelloWorldViewModel>, Initializable { - - @FXML - private Label helloLabel; - - @InjectViewModel - private HelloWorldViewModel viewModel; - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - helloLabel.textProperty().bind(viewModel.helloMessage()); - } + + @FXML + private Label helloLabel; + + @InjectViewModel + private HelloWorldViewModel viewModel; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + helloLabel.textProperty().bind(viewModel.helloMessage()); + } + } diff --git a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java index c80b0cb2e..f01eb813b 100644 --- a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java +++ b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java @@ -6,19 +6,19 @@ import de.saxsys.mvvmfx.ViewModel; public class HelloWorldViewModel implements ViewModel { - - private StringProperty helloMessage = new SimpleStringProperty("Hello World"); - - public StringProperty helloMessage() { - return helloMessage; - } - - public String getHelloMessage() { - return helloMessage.get(); - } - - public void setHelloMessage(String message) { - helloMessage.set(message); - } - + + private final StringProperty helloMessage = new SimpleStringProperty("Hello World"); + + public StringProperty helloMessage() { + return helloMessage; + } + + public String getHelloMessage() { + return helloMessage.get(); + } + + public void setHelloMessage(String message) { + helloMessage.set(message); + } + } diff --git a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java index fe0b72f43..f8c66dda2 100644 --- a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java +++ b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java @@ -8,24 +8,21 @@ import de.saxsys.mvvmfx.ViewTuple; - public class Starter extends Application { - - - public static void main(String... args) { - Application.launch(args); - } - - - @Override - public void start(Stage stage) throws Exception { - stage.setTitle("Hello World Application"); - - ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.fxmlView(HelloWorldView.class) - .load(); - - Parent root = viewTuple.getView(); - stage.setScene(new Scene(root)); - stage.show(); - } + + public static void main(String... args) { + Application.launch(args); + } + + @Override + public void start(Stage stage) throws Exception { + stage.setTitle("Hello World Application"); + + final ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.fxmlView(HelloWorldView.class).load(); + + final Parent root = viewTuple.getView(); + stage.setScene(new Scene(root)); + stage.show(); + } + } diff --git a/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml b/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml index 4ffaa267a..a7dd3cc92 100644 --- a/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml +++ b/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml @@ -3,12 +3,11 @@ <?import javafx.geometry.Insets?> <?import javafx.scene.control.Label?> <?import javafx.scene.layout.VBox?> -<VBox alignment="CENTER" xmlns:fx="http://javafx.com/fxml" - fx:controller="de.saxsys.mvvmfx.examples.helloworld.HelloWorldView"> - <children> - <Label fx:id="helloLabel"/> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> - </padding> +<VBox alignment="CENTER" xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.examples.helloworld.HelloWorldView"> + <children> + <Label fx:id="helloLabel"/> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + </padding> </VBox> From 739294512c2258ab72e30c0972cb47f9315dc091 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 31 Jan 2016 19:24:48 +0100 Subject: [PATCH 46/96] Format sourcecode. --- .../helloworld-without-fxml/pom.xml | 34 +++++++++--------- .../examples/helloworld/HelloWorldView.java | 31 ++++++++-------- .../helloworld/HelloWorldViewModel.java | 30 ++++++++-------- .../mvvmfx/examples/helloworld/Starter.java | 35 +++++++++---------- 4 files changed, 63 insertions(+), 67 deletions(-) diff --git a/examples/mini-examples/helloworld-without-fxml/pom.xml b/examples/mini-examples/helloworld-without-fxml/pom.xml index 9f10885e2..d69e997f3 100644 --- a/examples/mini-examples/helloworld-without-fxml/pom.xml +++ b/examples/mini-examples/helloworld-without-fxml/pom.xml @@ -1,23 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>mini-examples</artifactId> - <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>helloworld-without-fxml</artifactId> - <name>HelloWorld Example without FXML</name> - - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - </dependencies> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworld-without-fxml</artifactId> + <name>HelloWorld Example without FXML</name> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java index 8d40b0f93..5069ff88b 100644 --- a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java +++ b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java @@ -11,19 +11,20 @@ import de.saxsys.mvvmfx.JavaView; public class HelloWorldView extends VBox implements JavaView<HelloWorldViewModel>, Initializable { - - private Label helloLabel = new Label(); - - @InjectViewModel - private HelloWorldViewModel viewModel; - - public HelloWorldView() { - getChildren().add(helloLabel); - setPadding(new Insets(10, 10, 10, 10)); - } - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - helloLabel.textProperty().bind(viewModel.helloMessage()); - } + + private final Label helloLabel = new Label(); + + @InjectViewModel + private HelloWorldViewModel viewModel; + + public HelloWorldView() { + getChildren().add(helloLabel); + setPadding(new Insets(10, 10, 10, 10)); + } + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + helloLabel.textProperty().bind(viewModel.helloMessage()); + } + } diff --git a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java index c80b0cb2e..f01eb813b 100644 --- a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java +++ b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java @@ -6,19 +6,19 @@ import de.saxsys.mvvmfx.ViewModel; public class HelloWorldViewModel implements ViewModel { - - private StringProperty helloMessage = new SimpleStringProperty("Hello World"); - - public StringProperty helloMessage() { - return helloMessage; - } - - public String getHelloMessage() { - return helloMessage.get(); - } - - public void setHelloMessage(String message) { - helloMessage.set(message); - } - + + private final StringProperty helloMessage = new SimpleStringProperty("Hello World"); + + public StringProperty helloMessage() { + return helloMessage; + } + + public String getHelloMessage() { + return helloMessage.get(); + } + + public void setHelloMessage(String message) { + helloMessage.set(message); + } + } diff --git a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java index ff6119122..731568f07 100644 --- a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java +++ b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java @@ -1,6 +1,5 @@ package de.saxsys.mvvmfx.examples.helloworld; - import de.saxsys.mvvmfx.FluentViewLoader; import javafx.application.Application; import javafx.scene.Parent; @@ -10,22 +9,20 @@ import de.saxsys.mvvmfx.ViewTuple; public class Starter extends Application { - - - public static void main(String... args) { - Application.launch(args); - } - - - @Override - public void start(Stage stage) throws Exception { - stage.setTitle("Hello World Application"); - - ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.javaView(HelloWorldView.class) - .load(); - - Parent root = viewTuple.getView(); - stage.setScene(new Scene(root)); - stage.show(); - } + + public static void main(String... args) { + Application.launch(args); + } + + @Override + public void start(Stage stage) throws Exception { + stage.setTitle("Hello World Application"); + + final ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.javaView(HelloWorldView.class).load(); + + final Parent root = viewTuple.getView(); + stage.setScene(new Scene(root)); + stage.show(); + } + } From e9f9e17a898e16ae0a714a366bf06f05fb07987d Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 31 Jan 2016 19:33:28 +0100 Subject: [PATCH 47/96] Format sourcecode. --- .../mini-examples/welcome-example/pom.xml | 122 ++++++----- .../mvvmfx/examples/welcome/CdiStarter.java | 33 +-- .../mvvmfx/examples/welcome/GuiceStarter.java | 35 +-- .../mvvmfx/examples/welcome/model/Gender.java | 14 +- .../mvvmfx/examples/welcome/model/Person.java | 202 +++++++++--------- .../examples/welcome/model/Repository.java | 72 +++---- .../view/maincontainer/MainContainerView.java | 138 ++++++------ .../view/personlogin/PersonLoginView.java | 111 +++++----- .../view/personwelcome/PersonWelcomeView.java | 65 +++--- .../maincontainer/MainContainerViewModel.java | 24 +-- .../personlogin/PersonLoginViewModel.java | 148 ++++++------- .../PersonLoginViewModelNotifications.java | 32 +-- .../personwelcome/PersonWelcomeViewModel.java | 124 +++++------ .../view/maincontainer/MainContainerView.fxml | 28 +-- .../view/personlogin/PersonLoginView.fxml | 51 +++-- .../view/personwelcome/PersonWelcomeView.fxml | 18 +- .../personlogin/PersonLoginViewModelTest.java | 22 +- .../PersonWelcomeViewModelTest.java | 131 ++++++------ 18 files changed, 685 insertions(+), 685 deletions(-) diff --git a/examples/mini-examples/welcome-example/pom.xml b/examples/mini-examples/welcome-example/pom.xml index 3406c72b0..d6eee79fb 100644 --- a/examples/mini-examples/welcome-example/pom.xml +++ b/examples/mini-examples/welcome-example/pom.xml @@ -1,72 +1,70 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>mini-examples</artifactId> - <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> - <name>mvvmfx - welcome screen example</name> - <artifactId>welcome-example</artifactId> + <name>mvvmfx - welcome screen example</name> + <artifactId>welcome-example</artifactId> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> - <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - <version>1</version> - </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + </dependency> + <!-- CDI specific libraries --> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-cdi</artifactId> + </dependency> + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jandex</artifactId> + <version>1.2.4.Final</version> + </dependency> - <!-- CDI specific libraries --> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-cdi</artifactId> - </dependency> - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jandex</artifactId> - <version>1.2.4.Final</version> - </dependency> + <!-- Guice specific libraries --> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-guice</artifactId> + </dependency> - <!-- Guice specific libraries --> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-guice</artifactId> - </dependency> - - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>12.0</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - </dependency> - </dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>12.0</version> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java index 1b71344d1..f0f6a7361 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java @@ -16,20 +16,21 @@ * @author manuel.mauky */ public class CdiStarter extends MvvmfxCdiApplication { - - public static void main(String... args) { - launch(args); - } - - @Override - public void startMvvmfx(Stage stage) { - ViewTuple<MainContainerView, MainContainerViewModel> tuple = - FluentViewLoader.fxmlView(MainContainerView.class).load(); - - Parent view = tuple.getView(); - - final Scene scene = new Scene(view); - stage.setScene(scene); - stage.show(); - } + + public static void main(String... args) { + launch(args); + } + + @Override + public void startMvvmfx(Stage stage) { + final ViewTuple<MainContainerView, MainContainerViewModel> tuple + = FluentViewLoader.fxmlView(MainContainerView.class).load(); + + Parent view = tuple.getView(); + + final Scene scene = new Scene(view); + stage.setScene(scene); + stage.show(); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java index 932f620c2..279fcb8bf 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java @@ -16,21 +16,22 @@ * @author sialcasa */ public class GuiceStarter extends MvvmfxGuiceApplication { - - public static void main(final String[] args) { - launch(args); - } - - @Override - public void startMvvmfx(final Stage stage) throws Exception { - ViewTuple<MainContainerView, MainContainerViewModel> tuple = - FluentViewLoader.fxmlView(MainContainerView.class).load(); - - // Locate View for loaded FXML file - final Parent view = tuple.getView(); - - final Scene scene = new Scene(view); - stage.setScene(scene); - stage.show(); - } + + public static void main(final String[] args) { + launch(args); + } + + @Override + public void startMvvmfx(final Stage stage) throws Exception { + final ViewTuple<MainContainerView, MainContainerViewModel> tuple + = FluentViewLoader.fxmlView(MainContainerView.class).load(); + + // Locate View for loaded FXML file + final Parent view = tuple.getView(); + + final Scene scene = new Scene(view); + stage.setScene(scene); + stage.show(); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java index 64128bda7..0f2f6685f 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java @@ -1,13 +1,13 @@ package de.saxsys.mvvmfx.examples.welcome.model; /** - * Enum of possible gender information. If a person doesn't like to provide a gender, the value {@link #NOT_SPECIFIED} - * can be used. + * Enum of possible gender information. If a person doesn't like to provide a + * gender, the value {@link #NOT_SPECIFIED} can be used. */ public enum Gender { - - MALE, - FEMALE, - NOT_SPECIFIED - + + MALE, + FEMALE, + NOT_SPECIFIED + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java index 975ce484c..f6124a863 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java @@ -8,110 +8,106 @@ import javafx.beans.property.StringProperty; /** - * The class represents a Person with a firstname and a lastname. It provides access with JavaFX Properties. - * + * The class represents a Person with a firstname and a lastname. It provides + * access with JavaFX Properties. + * * @author alexander.casall - * + * */ public class Person { - - private int technicalID; - private final StringProperty firstName = new SimpleStringProperty(); - private final StringProperty lastName = new SimpleStringProperty(); - private final ObjectProperty<Gender> gender = new SimpleObjectProperty<>(); - - /** - * Creates a person with given name. - * - * @param firstName - * of person - * @param lastName - * of person - * @param gender - * of person - */ - public Person(final String firstName, final String lastName, Gender gender) { - this.firstName.set(firstName); - this.lastName.set(lastName); - this.gender.set(gender); - } - - /** - * @return firstname as {@link StringProperty} - */ - public StringProperty firstNameProperty() { - return firstName; - } - - /** - * @return lastname as {@link StringProperty} - */ - public StringProperty lastNameProperty() { - return lastName; - } - - - /** - * @return the gender of the person as {@link ObjectProperty}. - */ - public ObjectProperty<Gender> genderProperty() { - return gender; - } - - /** - * @return firstname as {@link String} - */ - public String getFirstName() { - return firstNameProperty().get(); - } - - /** - * @see #getFirstName() - * @param firstName - */ - public void setFirstName(final String firstName) { - firstNameProperty().set(firstName); - } - - /** - * @return lastname as {@link String} - */ - public String getLastName() { - return lastNameProperty().get(); - } - - /** - * @see #getLastName() - */ - public void setLastName(final String lastName) { - lastNameProperty().set(lastName); - } - - /** - * @return the gender of the person as {@link String} - */ - public Gender getGender() { - return gender.get(); - } - - /** - * @see #getGender() - */ - public void setGender(Gender gender) { - this.gender.set(gender); - } - - - /** - * Gets the technical id. - * - * @return technical id - */ - public int getId() { - if (technicalID == 0) { - technicalID = new Random().nextInt(); - } - return technicalID; - } - + + private int technicalID; + private final StringProperty firstName = new SimpleStringProperty(); + private final StringProperty lastName = new SimpleStringProperty(); + private final ObjectProperty<Gender> gender = new SimpleObjectProperty<>(); + + /** + * Creates a person with given name. + * + * @param firstName of person + * @param lastName of person + * @param gender of person + */ + public Person(final String firstName, final String lastName, Gender gender) { + this.firstName.set(firstName); + this.lastName.set(lastName); + this.gender.set(gender); + } + + /** + * @return firstname as {@link StringProperty} + */ + public StringProperty firstNameProperty() { + return firstName; + } + + /** + * @return lastname as {@link StringProperty} + */ + public StringProperty lastNameProperty() { + return lastName; + } + + /** + * @return the gender of the person as {@link ObjectProperty}. + */ + public ObjectProperty<Gender> genderProperty() { + return gender; + } + + /** + * @return firstname as {@link String} + */ + public String getFirstName() { + return firstNameProperty().get(); + } + + /** + * @see #getFirstName() + * @param firstName + */ + public void setFirstName(final String firstName) { + firstNameProperty().set(firstName); + } + + /** + * @return lastname as {@link String} + */ + public String getLastName() { + return lastNameProperty().get(); + } + + /** + * @see #getLastName() + */ + public void setLastName(final String lastName) { + lastNameProperty().set(lastName); + } + + /** + * @return the gender of the person as {@link String} + */ + public Gender getGender() { + return gender.get(); + } + + /** + * @see #getGender() + */ + public void setGender(Gender gender) { + this.gender.set(gender); + } + + /** + * Gets the technical id. + * + * @return technical id + */ + public int getId() { + if (technicalID == 0) { + technicalID = new Random().nextInt(); + } + return technicalID; + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java index 0446f04a9..7fe11f74e 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java @@ -5,46 +5,46 @@ import javax.inject.Singleton; - /** * Service class for providing some dummy data. - * + * * @author sialcasa */ @Singleton public class Repository { - - List<Person> persons = new ArrayList<Person>(); - - /** - * Creates the Repo. - */ - public Repository() { - persons.add(new Person("Alexander", "Casall", Gender.MALE)); - persons.add(new Person("Bernd", "Grams", Gender.MALE)); - persons.add(new Person("Anna", "Schulze", Gender.FEMALE)); - persons.add(new Person("Andy", "Mueller", Gender.NOT_SPECIFIED)); - } - - /** - * @return available {@link Person}s - */ - public List<Person> getPersons() { - return persons; - } - - /** - * Gets a Person.s - * - * @param id - * of the person - * @return person - */ - public Person getPersonById(final int id) { - for (Person person : persons) - if (id == person.getId()) - return person; - return null; - } - + + List<Person> persons = new ArrayList<Person>(); + + /** + * Creates the Repo. + */ + public Repository() { + persons.add(new Person("Alexander", "Casall", Gender.MALE)); + persons.add(new Person("Bernd", "Grams", Gender.MALE)); + persons.add(new Person("Anna", "Schulze", Gender.FEMALE)); + persons.add(new Person("Andy", "Mueller", Gender.NOT_SPECIFIED)); + } + + /** + * @return available {@link Person}s + */ + public List<Person> getPersons() { + return persons; + } + + /** + * Gets a Person.s + * + * @param id of the person + * @return person + */ + public Person getPersonById(final int id) { + for (Person person : persons) { + if (id == person.getId()) { + return person; + } + } + return null; + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java index 6a5864c03..d0dcbc984 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java @@ -26,77 +26,77 @@ import de.saxsys.mvvmfx.utils.viewlist.ViewListCellFactory; /** - * Main View which creates the necessary subviews, and manages them. Does not need a concrete Viewmodel, so it is typed - * with the inferface. Have a careful look on the FXML file to see, how to include different views into a MasterView. + * Main View which creates the necessary subviews, and manages them. Does not + * need a concrete Viewmodel, so it is typed with the inferface. Have a careful + * look on the FXML file to see, how to include different views into a + * MasterView. */ public class MainContainerView implements FxmlView<MainContainerViewModel>, Initializable { - - @FXML - // Injection of the login which is declared in the FXML File - private StackPane loginView; // Value injected by FXMLLoader - - @FXML + + @FXML + // Injection of the login which is declared in the FXML File + private StackPane loginView; // Value injected by FXMLLoader + + @FXML // Inject the Code behind instance of the loginView by using the - // nameconvention ...Controller - private PersonLoginView loginViewController; - - @FXML - // Inject the Code behind instance of the ListView - private ListView<Integer> personWelcomeListView; - - @Inject - // Notification Center - private NotificationCenter notificationCenter; - - - @InjectViewModel - private MainContainerViewModel viewModel; - - - private Map<Integer, ViewTuple<PersonWelcomeView, PersonWelcomeViewModel>> viewMap = new HashMap<>(); - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - // Listen for close notifications - notificationCenter.subscribe("hidePersonWelcome", - (key, payload) -> { - int personIdToHide = (int) payload[0]; - viewModel.displayedPersonsProperty().remove( - new Integer(personIdToHide)); - }); - + // nameconvention ...Controller + private PersonLoginView loginViewController; + + @FXML + // Inject the Code behind instance of the ListView + private ListView<Integer> personWelcomeListView; + + @Inject + // Notification Center + private NotificationCenter notificationCenter; + + @InjectViewModel + private MainContainerViewModel viewModel; + + private Map<Integer, ViewTuple<PersonWelcomeView, PersonWelcomeViewModel>> viewMap = new HashMap<>(); + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + // Listen for close notifications + notificationCenter.subscribe("hidePersonWelcome", + (key, payload) -> { + int personIdToHide = (int) payload[0]; + viewModel.displayedPersonsProperty().remove( + new Integer(personIdToHide)); + }); + // When the login button of the loginView, the pickedPersonProperty is - // going to have the index of the selected person - loginViewController.getViewModel().loggedInPersonIdProperty() - .addListener(new ChangeListener<Number>() { - @Override - public void changed(ObservableValue<? extends Number> arg0, - Number oldValue, Number newValue) { - int id = newValue.intValue(); - viewModel.displayedPersonsProperty().add(id); - } - }); - - // Configure List with views - final ViewListCellFactory<Integer> cellFactory = element -> { - if (!viewMap.containsKey(element)) { - ViewTuple<PersonWelcomeView, PersonWelcomeViewModel> loadedViewTuple - = FluentViewLoader.fxmlView(PersonWelcomeView.class).load(); - - PersonWelcomeView codeBehind = loadedViewTuple.getCodeBehind(); - - codeBehind.getViewModel() - .setPersonId(element); - - viewMap.put(element, loadedViewTuple); - } - - return viewMap.get(element); - }; - personWelcomeListView.setCellFactory(cellFactory); - - // Bind list - personWelcomeListView.itemsProperty().bind( - viewModel.displayedPersonsProperty()); - } + // going to have the index of the selected person + loginViewController.getViewModel().loggedInPersonIdProperty() + .addListener(new ChangeListener<Number>() { + @Override + public void changed(ObservableValue<? extends Number> arg0, + Number oldValue, Number newValue) { + int id = newValue.intValue(); + viewModel.displayedPersonsProperty().add(id); + } + }); + + // Configure List with views + final ViewListCellFactory<Integer> cellFactory = element -> { + if (!viewMap.containsKey(element)) { + ViewTuple<PersonWelcomeView, PersonWelcomeViewModel> loadedViewTuple + = FluentViewLoader.fxmlView(PersonWelcomeView.class).load(); + + PersonWelcomeView codeBehind = loadedViewTuple.getCodeBehind(); + + codeBehind.getViewModel() + .setPersonId(element); + + viewMap.put(element, loadedViewTuple); + } + + return viewMap.get(element); + }; + personWelcomeListView.setCellFactory(cellFactory); + + // Bind list + personWelcomeListView.itemsProperty().bind(viewModel.displayedPersonsProperty()); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java index b957c6bd8..cc02aaeaa 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java @@ -20,63 +20,64 @@ import de.saxsys.mvvmfx.utils.commands.Command; /** - * Code behind the fxml for visualization of the {@link PersonLoginView}. The view binds to the properties of the - * {@link PersonLoginViewModel}. + * Code behind the fxml for visualization of the {@link PersonLoginView}. The + * view binds to the properties of the {@link PersonLoginViewModel}. * * @author alexander.casall */ public class PersonLoginView implements FxmlView<PersonLoginViewModel>, Initializable { - - @FXML - // Injection of the person choiceBox which is declared in the FXML File - private ChoiceBox<String> personsChoiceBox; - - @FXML - private Button loginButton; - - @FXML - private ProgressIndicator loginProgressIndicator; - - @InjectViewModel - private PersonLoginViewModel viewModel; - - private Command loginCommand; - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - loginCommand = getViewModel().getLoginCommand(); - initChoiceBox(); - loginButton.disableProperty() - .bind(loginCommand.notExecutableProperty()); - loginProgressIndicator.visibleProperty().bind(loginCommand.runningProperty()); - - viewModel.subscribe(PersonLoginViewModelNotifications.OK.getId(), (key, payload) -> { - String message = (String) payload[0]; - Alert alert = new Alert(AlertType.INFORMATION); - alert.setTitle(message); - alert.setContentText(message); - alert.show(); - }); - - } - - @FXML - void loginButtonPressed(final ActionEvent event) { - loginCommand.execute(); - } - - private void initChoiceBox() { - personsChoiceBox.itemsProperty().bind(viewModel.selectablePersonsProperty().stringListProperty()); - - personsChoiceBox - .getSelectionModel() - .selectedIndexProperty() - .addListener( - (ChangeListener<Number>) (arg0, oldVal, newVal) -> viewModel.selectablePersonsProperty() - .select(newVal.intValue())); - } - - public PersonLoginViewModel getViewModel() { - return viewModel; - } + + @FXML + // Injection of the person choiceBox which is declared in the FXML File + private ChoiceBox<String> personsChoiceBox; + + @FXML + private Button loginButton; + + @FXML + private ProgressIndicator loginProgressIndicator; + + @InjectViewModel + private PersonLoginViewModel viewModel; + + private Command loginCommand; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + loginCommand = getViewModel().getLoginCommand(); + initChoiceBox(); + loginButton.disableProperty() + .bind(loginCommand.notExecutableProperty()); + loginProgressIndicator.visibleProperty().bind(loginCommand.runningProperty()); + + viewModel.subscribe(PersonLoginViewModelNotifications.OK.getId(), (key, payload) -> { + String message = (String) payload[0]; + Alert alert = new Alert(AlertType.INFORMATION); + alert.setTitle(message); + alert.setContentText(message); + alert.show(); + }); + + } + + @FXML + void loginButtonPressed(final ActionEvent event) { + loginCommand.execute(); + } + + private void initChoiceBox() { + personsChoiceBox.itemsProperty().bind(viewModel.selectablePersonsProperty().stringListProperty()); + + personsChoiceBox + .getSelectionModel() + .selectedIndexProperty() + .addListener( + (ChangeListener<Number>) (arg0, oldVal, newVal) -> viewModel.selectablePersonsProperty() + .select(newVal.intValue())); + } + + public PersonLoginViewModel getViewModel() { + return viewModel; + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java index a03eec26e..b50cc749c 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java @@ -16,39 +16,40 @@ import de.saxsys.mvvmfx.utils.notifications.NotificationCenter; /** - * Code behind the fxml for visualization of the PersonWelcomeViewModel. The view binds to the property of the - * {@link PersonWelcomeViewModel}. - * + * Code behind the fxml for visualization of the PersonWelcomeViewModel. The + * view binds to the property of the {@link PersonWelcomeViewModel}. + * * @author alexander.casall */ public class PersonWelcomeView implements FxmlView<PersonWelcomeViewModel>, Initializable { - - @FXML - // Injection of the label which is declared in the FXML File and shows the - // welcome message - private Label welcomeLabel; - - @Inject - private NotificationCenter notificationCenter; - - @InjectViewModel - private PersonWelcomeViewModel viewModel; - - @FXML - // Handler for Button[Button[id=null, styleClass=button]] onAction - public void closeApplicationButtonPressed(ActionEvent event) { - // MainContainerView.java will handle it - notificationCenter.publish("hidePersonWelcome", viewModel - .getPersonId()); - } - - public PersonWelcomeViewModel getViewModel() { - return viewModel; - } - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - welcomeLabel.textProperty() - .bind(viewModel.welcomeStringProperty()); - } + + @FXML + // Injection of the label which is declared in the FXML File and shows the + // welcome message + private Label welcomeLabel; + + @Inject + private NotificationCenter notificationCenter; + + @InjectViewModel + private PersonWelcomeViewModel viewModel; + + @FXML + // Handler for Button[Button[id=null, styleClass=button]] onAction + public void closeApplicationButtonPressed(ActionEvent event) { + // MainContainerView.java will handle it + notificationCenter.publish("hidePersonWelcome", viewModel + .getPersonId()); + } + + public PersonWelcomeViewModel getViewModel() { + return viewModel; + } + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + welcomeLabel.textProperty() + .bind(viewModel.welcomeStringProperty()); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java index 807bfd873..10fa2a24e 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java @@ -7,16 +7,16 @@ import de.saxsys.mvvmfx.ViewModel; public class MainContainerViewModel implements ViewModel { - - private ListProperty<Integer> displayedPersons = new SimpleListProperty<>( - FXCollections.<Integer> observableArrayList()); - - public MainContainerViewModel() { - - } - - public ListProperty<Integer> displayedPersonsProperty() { - return displayedPersons; - } - + + private ListProperty<Integer> displayedPersons = new SimpleListProperty<>( + FXCollections.<Integer>observableArrayList()); + + public MainContainerViewModel() { + + } + + public ListProperty<Integer> displayedPersonsProperty() { + return displayedPersons; + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java index e9c271d8a..ef0472cd2 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java @@ -18,82 +18,82 @@ import de.saxsys.mvvmfx.utils.itemlist.SelectableStringList; /** - * ViewModel for a login view for the persons. It provides the data which should be visualized in the frontend e.g. the - * list of persons in string representations. The tests for it can be written first. Have a look on + * ViewModel for a login view for the persons. It provides the data which should + * be visualized in the frontend e.g. the list of persons in string + * representations. The tests for it can be written first. Have a look on * PersonLoginViewModelTest. - * + * * @author alexander.casall - * + * */ - public class PersonLoginViewModel implements ViewModel { - - // Properties which are used by the view. - private SelectableItemList<Person> selectablePersons; - private ReadOnlyIntegerWrapper loggedInPersonId; - private Command loginCommand; - - // Repo - private final Repository repository; - - @Inject - public PersonLoginViewModel(Repository repository) { - this.repository = repository; - } - - private BooleanBinding createLoginPossibleBinding() { - return selectablePersonsProperty().selectedIndexProperty().isNotEqualTo(-1); - } - - /** - * Persons in string representation. - * - * @return persons - */ - public SelectableStringList selectablePersonsProperty() { - if (selectablePersons == null) { - selectablePersons = - new SelectableItemList<Person>(FXCollections.observableArrayList(repository.getPersons()), - person -> person.getFirstName() + " " - + person.getLastName()); - } - return selectablePersons; - } - - /** - * Person which is logged in. - * - * @return person - */ - public ReadOnlyIntegerProperty loggedInPersonIdProperty() { - if (loggedInPersonId == null) { - loggedInPersonId = new ReadOnlyIntegerWrapper(); - } - return loggedInPersonId.getReadOnlyProperty(); - } - - public Command getLoginCommand() { - if (loginCommand == null) { - loginCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - performLogin(); - } - }, createLoginPossibleBinding(), true); - } - return loginCommand; - } - - private void performLogin() { - try { - // fakesleep, simulating latency - Thread.sleep(2000); - } catch (Exception e) { - } - - Platform.runLater(() -> { - loggedInPersonId.set(selectablePersons.getSelectedItem().getId()); - }); - publish(PersonLoginViewModelNotifications.OK.getId(), PersonLoginViewModelNotifications.OK.getMessage()); - } + + // Properties which are used by the view. + private SelectableItemList<Person> selectablePersons; + private ReadOnlyIntegerWrapper loggedInPersonId; + private Command loginCommand; + + // Repo + private final Repository repository; + + @Inject + public PersonLoginViewModel(Repository repository) { + this.repository = repository; + } + + private BooleanBinding createLoginPossibleBinding() { + return selectablePersonsProperty().selectedIndexProperty().isNotEqualTo(-1); + } + + /** + * Persons in string representation. + * + * @return persons + */ + public SelectableStringList selectablePersonsProperty() { + if (selectablePersons == null) { + selectablePersons = new SelectableItemList<>( + FXCollections.observableArrayList(repository.getPersons()), + person -> person.getFirstName() + " " + person.getLastName()); + } + return selectablePersons; + } + + /** + * Person which is logged in. + * + * @return person + */ + public ReadOnlyIntegerProperty loggedInPersonIdProperty() { + if (loggedInPersonId == null) { + loggedInPersonId = new ReadOnlyIntegerWrapper(); + } + return loggedInPersonId.getReadOnlyProperty(); + } + + public Command getLoginCommand() { + if (loginCommand == null) { + loginCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + performLogin(); + } + }, createLoginPossibleBinding(), true); + } + return loginCommand; + } + + private void performLogin() { + try { + // fakesleep, simulating latency + Thread.sleep(2000); + } catch (Exception e) { + } + + Platform.runLater(() -> { + loggedInPersonId.set(selectablePersons.getSelectedItem().getId()); + }); + publish(PersonLoginViewModelNotifications.OK.getId(), PersonLoginViewModelNotifications.OK.getMessage()); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java index e04b5b83f..e7c2270b1 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java @@ -1,19 +1,21 @@ package de.saxsys.mvvmfx.examples.welcome.viewmodel.personlogin; public enum PersonLoginViewModelNotifications { - OK("Das Einloggen war erfolgreich"); - - private String message; - - PersonLoginViewModelNotifications(String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - public String getId() { - return toString(); - } + + OK("Das Einloggen war erfolgreich"); + + private String message; + + PersonLoginViewModelNotifications(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public String getId() { + return toString(); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java index 08323be1b..3de722059 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java @@ -13,69 +13,69 @@ import de.saxsys.mvvmfx.ViewModel; /** - * ViewModel for a welcome view for a person. It provides the data which should be visualized in the frontend. The tests - * for it can be written first. Have a look on PersonWelcomeViewModelTest. - * + * ViewModel for a welcome view for a person. It provides the data which should + * be visualized in the frontend. The tests for it can be written first. Have a + * look on PersonWelcomeViewModelTest. + * * @author alexander.casall - * + * */ public class PersonWelcomeViewModel implements ViewModel { - - private final Repository repository; - - // Properties which are used by the view. - private final StringProperty welcomeString = new SimpleStringProperty(); - - private Person person; - - /** - * Create a {@link PersonWelcomeViewModel}. - * - * @param repository - * repo which is used - */ - @Inject - public PersonWelcomeViewModel(Repository repository) { - this.repository = repository; - } - - /** - * Provides the the concated string. - * - * @return - */ - public StringProperty welcomeStringProperty() { - return welcomeString; - } - - /** - * Set Person id for the screen - * - * @param personId - * for the screen - */ - public void setPersonId(int personId) { - person = repository.getPersonById(personId); - - StringBinding salutationBinding = - Bindings.when(person.genderProperty().isEqualTo(Gender.NOT_SPECIFIED)) - .then("Herr/Frau/* ") - .otherwise( - Bindings.when(person.genderProperty().isEqualTo(Gender.MALE)) - .then("Herr ").otherwise("Frau ")); - - welcomeString.unbind(); - welcomeString.bind(Bindings.concat("Willkommen ", salutationBinding, - person.firstNameProperty(), " ", - person.lastNameProperty())); - } - - /** - * Returns the id of the displayed person. - * - * @return id - */ - public int getPersonId() { - return person.getId(); - } + + private final Repository repository; + + // Properties which are used by the view. + private final StringProperty welcomeString = new SimpleStringProperty(); + + private Person person; + + /** + * Create a {@link PersonWelcomeViewModel}. + * + * @param repository repo which is used + */ + @Inject + public PersonWelcomeViewModel(Repository repository) { + this.repository = repository; + } + + /** + * Provides the the concated string. + * + * @return + */ + public StringProperty welcomeStringProperty() { + return welcomeString; + } + + /** + * Set Person id for the screen + * + * @param personId for the screen + */ + public void setPersonId(int personId) { + person = repository.getPersonById(personId); + + StringBinding salutationBinding + = Bindings.when(person.genderProperty().isEqualTo(Gender.NOT_SPECIFIED)) + .then("Herr/Frau/* ") + .otherwise( + Bindings.when(person.genderProperty().isEqualTo(Gender.MALE)) + .then("Herr ").otherwise("Frau ")); + + welcomeString.unbind(); + welcomeString.bind(Bindings.concat("Willkommen ", salutationBinding, + person.firstNameProperty(), " ", + person.lastNameProperty())); + } + + /** + * Returns the id of the displayed person. + * + * @return id + */ + public int getPersonId() { + return person.getId(); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml index 7a4f88b07..ca3d835d1 100644 --- a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml +++ b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml @@ -9,18 +9,18 @@ <?import javafx.scene.layout.VBox?> <Pane id="personInfoVbox" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" - fx:controller="de.saxsys.mvvmfx.examples.welcome.view.maincontainer.MainContainerView"> - <!-- TODO Add Nodes --> - <children> - <VBox prefHeight="-1.0" spacing="5.0"> - <children> - <!-- Take care for setting the ID to use the injected objects in the code-behind --> - <fx:include fx:id="loginView" source="../personlogin/PersonLoginView.fxml"/> - <ListView fx:id="personWelcomeListView" blendMode="SRC_OVER" prefHeight="200.0" prefWidth="200.0"/> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> - </padding> - </VBox> - </children> + fx:controller="de.saxsys.mvvmfx.examples.welcome.view.maincontainer.MainContainerView"> + <!-- TODO Add Nodes --> + <children> + <VBox prefHeight="-1.0" spacing="5.0"> + <children> + <!-- Take care for setting the ID to use the injected objects in the code-behind --> + <fx:include fx:id="loginView" source="../personlogin/PersonLoginView.fxml"/> + <ListView fx:id="personWelcomeListView" blendMode="SRC_OVER" prefHeight="200.0" prefWidth="200.0"/> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + </padding> + </VBox> + </children> </Pane> diff --git a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml index 16c2a9fc9..7ec80038c 100644 --- a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml +++ b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml @@ -7,30 +7,29 @@ <?import javafx.scene.text.*?> <StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" - fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personlogin.PersonLoginView"> - <!-- TODO Add Nodes --> - <children> - <VBox fx:id="layoutVbox" alignment="CENTER" minHeight="37.0" spacing="5.0"> - <children> - <Label alignment="CENTER" prefWidth="270.0" text="Personen" textAlignment="LEFT"> - <font> - <Font size="30.0"/> - </font> - </Label> - <ChoiceBox id="persons" fx:id="personsChoiceBox" prefWidth="277.0"> - <items> - <FXCollections fx:factory="observableArrayList"> - <String fx:value="Item 1"/> - <String fx:value="Item 2"/> - <String fx:value="Item 3"/> - </FXCollections> - </items> - </ChoiceBox> - <Button fx:id="loginButton" alignment="CENTER" mnemonicParsing="false" onAction="#loginButtonPressed" - text="Login"/> - </children> - </VBox> - <ProgressIndicator fx:id="loginProgressIndicator"/> - </children> + xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" + fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personlogin.PersonLoginView"> + <!-- TODO Add Nodes --> + <children> + <VBox fx:id="layoutVbox" alignment="CENTER" minHeight="37.0" spacing="5.0"> + <children> + <Label alignment="CENTER" prefWidth="270.0" text="Personen" textAlignment="LEFT"> + <font> + <Font size="30.0"/> + </font> + </Label> + <ChoiceBox id="persons" fx:id="personsChoiceBox" prefWidth="277.0"> + <items> + <FXCollections fx:factory="observableArrayList"> + <String fx:value="Item 1"/> + <String fx:value="Item 2"/> + <String fx:value="Item 3"/> + </FXCollections> + </items> + </ChoiceBox> + <Button fx:id="loginButton" alignment="CENTER" mnemonicParsing="false" onAction="#loginButtonPressed" text="Login"/> + </children> + </VBox> + <ProgressIndicator fx:id="loginProgressIndicator"/> + </children> </StackPane> diff --git a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml index e294eebe8..2b3051a6a 100644 --- a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml +++ b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml @@ -10,13 +10,13 @@ <?import javafx.scene.layout.VBox?> <VBox alignment="CENTER_LEFT" spacing="10.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" - fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personwelcome.PersonWelcomeView"> - <children> - <Label fx:id="welcomeLabel" alignment="CENTER" text="The upcoming text"> - <VBox.margin> - <Insets fx:id="x1"/> - </VBox.margin> - </Label> - <Button mnemonicParsing="false" onAction="#closeApplicationButtonPressed" text="Hide" VBox.margin="$x1"/> - </children> + fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personwelcome.PersonWelcomeView"> + <children> + <Label fx:id="welcomeLabel" alignment="CENTER" text="The upcoming text"> + <VBox.margin> + <Insets fx:id="x1"/> + </VBox.margin> + </Label> + <Button mnemonicParsing="false" onAction="#closeApplicationButtonPressed" text="Hide" VBox.margin="$x1"/> + </children> </VBox> diff --git a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java index b7beaf0c0..9b116529b 100644 --- a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java +++ b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java @@ -8,15 +8,15 @@ import de.saxsys.mvvmfx.examples.welcome.viewmodel.personlogin.PersonLoginViewModel; public class PersonLoginViewModelTest { - - @Test - public void testShowAllPersons() throws Exception { - final PersonLoginViewModel personLoginViewModel = new PersonLoginViewModel( - new Repository()); - final ObservableList<String> persons = personLoginViewModel - .selectablePersonsProperty().stringListProperty(); - persons.get(0).equals("Alexander Casall"); - persons.get(1).equals("Bernd Grams"); - persons.get(2).equals("Anna Schulze"); - } + + @Test + public void testShowAllPersons() throws Exception { + final PersonLoginViewModel personLoginViewModel = new PersonLoginViewModel( + new Repository()); + final ObservableList<String> persons = personLoginViewModel + .selectablePersonsProperty().stringListProperty(); + persons.get(0).equals("Alexander Casall"); + persons.get(1).equals("Bernd Grams"); + persons.get(2).equals("Anna Schulze"); + } } diff --git a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java index 0804896d8..3d4d77cb8 100644 --- a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java +++ b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java @@ -11,69 +11,70 @@ import de.saxsys.mvvmfx.examples.welcome.viewmodel.personwelcome.PersonWelcomeViewModel; public class PersonWelcomeViewModelTest { - - private Repository repository; - private PersonWelcomeViewModel personWelcomeViewModel; - - @Before - public void setup() { - // TODO: this should be mocked - repository = new Repository(); - personWelcomeViewModel = new PersonWelcomeViewModel( - repository); - } - - @Test - public void testWelcomeStringInViewModel() throws Exception { - personWelcomeViewModel.setPersonId(repository.getPersons().get(0) - .getId()); - assertEquals( - "Willkommen Herr Alexander Casall", - personWelcomeViewModel.welcomeStringProperty().get()); - - assertEquals(repository.getPersons().get(0).getId(), - personWelcomeViewModel.getPersonId()); - } - - @Test - public void welcomeStringForFemalePersonIsDifferent() throws Exception { - personWelcomeViewModel.setPersonId(repository.getPersons().get(2) - .getId()); - assertEquals( - "Willkommen Frau Anna Schulze", - personWelcomeViewModel.welcomeStringProperty().get()); - - assertEquals(repository.getPersons().get(2).getId(), - personWelcomeViewModel.getPersonId()); - } - - @Test - public void changeFirstNameOfPersonIsReflectedInViewModel() throws Exception { - final Person person = repository.getPersons().get(0); - personWelcomeViewModel.setPersonId(person.getId()); - person.setFirstName(person.getFirstName() + 'X'); - assertEquals( - "Willkommen Herr AlexanderX Casall", - personWelcomeViewModel.welcomeStringProperty().get()); - } - - @Test - public void changeLastNameOfPersonIsReflectedInViewModel() throws Exception { - final Person person = repository.getPersons().get(0); - personWelcomeViewModel.setPersonId(person.getId()); - person.setLastName(person.getLastName() + 'X'); - assertEquals( - "Willkommen Herr Alexander CasallX", - personWelcomeViewModel.welcomeStringProperty().get()); - } - - @Test - public void changeGenderOfPersonIsReflectedInViewModel() throws Exception { - final Person person = repository.getPersons().get(0); - personWelcomeViewModel.setPersonId(person.getId()); - person.setGender(Gender.FEMALE); - assertEquals( - "Willkommen Frau Alexander Casall", - personWelcomeViewModel.welcomeStringProperty().get()); - } + + private Repository repository; + private PersonWelcomeViewModel personWelcomeViewModel; + + @Before + public void setup() { + // TODO: this should be mocked + repository = new Repository(); + personWelcomeViewModel = new PersonWelcomeViewModel( + repository); + } + + @Test + public void testWelcomeStringInViewModel() throws Exception { + personWelcomeViewModel.setPersonId(repository.getPersons().get(0) + .getId()); + assertEquals( + "Willkommen Herr Alexander Casall", + personWelcomeViewModel.welcomeStringProperty().get()); + + assertEquals(repository.getPersons().get(0).getId(), + personWelcomeViewModel.getPersonId()); + } + + @Test + public void welcomeStringForFemalePersonIsDifferent() throws Exception { + personWelcomeViewModel.setPersonId(repository.getPersons().get(2) + .getId()); + assertEquals( + "Willkommen Frau Anna Schulze", + personWelcomeViewModel.welcomeStringProperty().get()); + + assertEquals(repository.getPersons().get(2).getId(), + personWelcomeViewModel.getPersonId()); + } + + @Test + public void changeFirstNameOfPersonIsReflectedInViewModel() throws Exception { + final Person person = repository.getPersons().get(0); + personWelcomeViewModel.setPersonId(person.getId()); + person.setFirstName(person.getFirstName() + 'X'); + assertEquals( + "Willkommen Herr AlexanderX Casall", + personWelcomeViewModel.welcomeStringProperty().get()); + } + + @Test + public void changeLastNameOfPersonIsReflectedInViewModel() throws Exception { + final Person person = repository.getPersons().get(0); + personWelcomeViewModel.setPersonId(person.getId()); + person.setLastName(person.getLastName() + 'X'); + assertEquals( + "Willkommen Herr Alexander CasallX", + personWelcomeViewModel.welcomeStringProperty().get()); + } + + @Test + public void changeGenderOfPersonIsReflectedInViewModel() throws Exception { + final Person person = repository.getPersons().get(0); + personWelcomeViewModel.setPersonId(person.getId()); + person.setGender(Gender.FEMALE); + assertEquals( + "Willkommen Frau Alexander Casall", + personWelcomeViewModel.welcomeStringProperty().get()); + } + } From bec0290085276709d9afc4a476442a837b171855 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 31 Jan 2016 19:34:33 +0100 Subject: [PATCH 48/96] Fix unit test. --- .../viewmodel/personlogin/PersonLoginViewModelTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java index 9b116529b..b9709bd9b 100644 --- a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java +++ b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java @@ -1,5 +1,7 @@ package de.saxsys.mvvmfx.viewmodel.personlogin; +import static org.junit.Assert.assertEquals; + import javafx.collections.ObservableList; import org.junit.Test; @@ -15,8 +17,8 @@ public void testShowAllPersons() throws Exception { new Repository()); final ObservableList<String> persons = personLoginViewModel .selectablePersonsProperty().stringListProperty(); - persons.get(0).equals("Alexander Casall"); - persons.get(1).equals("Bernd Grams"); - persons.get(2).equals("Anna Schulze"); + assertEquals("Alexander Casall", persons.get(0)); + assertEquals("Bernd Grams", persons.get(1)); + assertEquals("Anna Schulze", persons.get(2)); } } From 3cff4fcce70bf42282fd9d2afb5dd072d5a035d0 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 31 Jan 2016 19:45:40 +0100 Subject: [PATCH 49/96] Format sourcecode. --- examples/contacts-example/pom.xml | 192 +- .../saxsys/mvvmfx/examples/contacts/App.java | 100 +- .../contacts/config/ResourceProvider.java | 17 +- .../contacts/events/ContactsUpdatedEvent.java | 1 + .../contacts/events/TriggerShutdownEvent.java | 1 + .../examples/contacts/model/Address.java | 112 +- .../examples/contacts/model/Contact.java | 186 +- .../contacts/model/ContactFactory.java | 166 +- .../examples/contacts/model/Country.java | 145 +- .../contacts/model/CountrySelector.java | 427 +- .../examples/contacts/model/Identity.java | 73 +- .../contacts/model/InmemoryRepository.java | 68 +- .../examples/contacts/model/Repository.java | 18 +- .../examples/contacts/model/Subdivision.java | 111 +- .../contacts/ui/about/AboutAuthorView.java | 27 +- .../ui/about/AboutAuthorViewModel.java | 24 +- .../examples/contacts/ui/about/AboutView.java | 53 +- .../contacts/ui/about/AboutViewModel.java | 112 +- .../ui/addcontact/AddContactDialogView.java | 34 +- .../addcontact/AddContactDialogViewModel.java | 81 +- .../ui/addressform/AddressFormView.java | 89 +- .../ui/addressform/AddressFormViewModel.java | 445 +- .../ui/contactdialog/ContactDialogView.java | 151 +- .../contactdialog/ContactDialogViewModel.java | 146 +- .../ui/contactform/ContactFormView.java | 96 +- .../ui/contactform/ContactFormViewModel.java | 275 +- .../contacts/ui/detail/DetailView.java | 187 +- .../contacts/ui/detail/DetailViewModel.java | 470 +- .../ui/editcontact/EditContactDialogView.java | 37 +- .../EditContactDialogViewModel.java | 61 +- .../examples/contacts/ui/main/MainView.java | 1 + .../contacts/ui/main/MainViewModel.java | 1 + .../ui/master/MasterTableViewModel.java | 167 +- .../contacts/ui/master/MasterView.java | 33 +- .../contacts/ui/master/MasterViewModel.java | 147 +- .../examples/contacts/ui/menu/MenuView.java | 60 +- .../contacts/ui/menu/MenuViewModel.java | 63 +- .../ui/scopes/ContactDialogScope.java | 156 +- .../contacts/ui/scopes/MasterDetailScope.java | 33 +- .../contacts/ui/toolbar/ToolbarView.java | 45 +- .../ui/validators/BirthdayValidator.java | 14 +- .../ui/validators/EmailValidator.java | 18 +- .../ui/validators/PhoneValidator.java | 35 +- .../examples/contacts/util/CentralClock.java | 58 +- .../examples/contacts/util/DialogHelper.java | 131 +- .../src/main/resources/countries/iso_3166.xml | 3302 +-- .../main/resources/countries/iso_3166_2.xml | 21328 ++++++++-------- .../contacts/ui/about/AboutAuthorView.fxml | 80 +- .../examples/contacts/ui/about/AboutView.fxml | 66 +- .../ui/addcontact/AddContactDialogView.fxml | 10 +- .../ui/addressform/AddressFormView.fxml | 82 +- .../ui/contactdialog/ContactDialogView.fxml | 84 +- .../ui/contactform/ContactFormView.fxml | 122 +- .../contacts/ui/detail/DetailView.fxml | 66 +- .../ui/editcontact/EditContactDialogView.fxml | 10 +- .../examples/contacts/ui/main/MainView.fxml | 46 +- .../contacts/ui/master/MasterView.fxml | 92 +- .../examples/contacts/ui/menu/MenuView.fxml | 50 +- .../contacts/ui/toolbar/ToolbarView.fxml | 22 +- .../src/main/resources/logback.xml | 31 +- .../mvvmfx/examples/contacts/AppTestFxIT.java | 63 +- .../model/CountrySelectorIntegrationTest.java | 283 +- .../validation/BirthdayValidatorTest.java | 78 +- .../validation/EmailAddressValidatorTest.java | 65 +- .../validation/PhoneNumberValidatorTest.java | 64 +- .../contacts/ui/about/AboutViewModelTest.java | 105 +- .../addressform/AddressFormViewModelTest.java | 336 +- .../ContactDialogViewModelTest.java | 26 +- .../ContactFormViewModelTest.java | 90 +- .../ui/detail/DetailViewModelTest.java | 323 +- .../EditContactDialogViewModelTest.java | 76 +- .../ui/master/MasterTableViewModelTest.java | 36 +- .../ui/master/MasterViewModelTest.java | 287 +- .../src/test/resources/countries/iso_3166.xml | 36 +- .../test/resources/countries/iso_3166_2.xml | 236 +- 75 files changed, 16147 insertions(+), 16215 deletions(-) diff --git a/examples/contacts-example/pom.xml b/examples/contacts-example/pom.xml index 2d7265754..33e4d450b 100644 --- a/examples/contacts-example/pom.xml +++ b/examples/contacts-example/pom.xml @@ -1,116 +1,116 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>de.saxsys.mvvmfx</groupId> - <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <artifactId>contacts-example</artifactId> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>de.saxsys.mvvmfx</groupId> + <artifactId>examples</artifactId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <artifactId>contacts-example</artifactId> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + </properties> - <build> - <plugins> - <plugin> - <groupId>com.zenjava</groupId> - <artifactId>javafx-maven-plugin</artifactId> - <version>8.1.2</version> - <configuration> - <mainClass>de.saxsys.mvvmfx.examples.contacts.App</mainClass> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>com.zenjava</groupId> + <artifactId>javafx-maven-plugin</artifactId> + <version>8.1.2</version> + <configuration> + <mainClass>de.saxsys.mvvmfx.examples.contacts.App</mainClass> + </configuration> + </plugin> + </plugins> + </build> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-cdi</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-cdi</artifactId> + </dependency> - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jandex</artifactId> - <version>1.2.4.Final</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.1.2</version> - </dependency> - <dependency> - <groupId>org.controlsfx</groupId> - <artifactId>controlsfx</artifactId> - <version>8.40.9</version> - </dependency> + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jandex</artifactId> + <version>1.2.4.Final</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.2</version> + </dependency> + <dependency> + <groupId>org.controlsfx</groupId> + <artifactId>controlsfx</artifactId> + <version>8.40.9</version> + </dependency> - <dependency> - <groupId>de.jensd</groupId> - <artifactId>fontawesomefx</artifactId> - <version>8.0.9</version> - </dependency> + <dependency> + <groupId>de.jensd</groupId> + <artifactId>fontawesomefx</artifactId> + <version>8.0.9</version> + </dependency> - <dependency> - <groupId>org.javafxdata</groupId> - <artifactId>datafx-core</artifactId> - <version>8.0b5</version> - </dependency> + <dependency> + <groupId>org.javafxdata</groupId> + <artifactId>datafx-core</artifactId> + <version>8.0b5</version> + </dependency> - <dependency> - <groupId>org.javafxdata</groupId> - <artifactId>datafx-datareader</artifactId> - <version>8.0b5</version> - </dependency> + <dependency> + <groupId>org.javafxdata</groupId> + <artifactId>datafx-datareader</artifactId> + <version>8.0b5</version> + </dependency> - <dependency> - <groupId>eu.lestard</groupId> - <artifactId>advanced-bindings</artifactId> - </dependency> + <dependency> + <groupId>eu.lestard</groupId> + <artifactId>advanced-bindings</artifactId> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>eu.lestard</groupId> - <artifactId>assertj-javafx</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>eu.lestard</groupId> + <artifactId>assertj-javafx</artifactId> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testfx</groupId> - <artifactId>testfx-core</artifactId> - <version>4.0.1-alpha</version> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testfx</groupId> + <artifactId>testfx-core</artifactId> + <version>4.0.1-alpha</version> + <scope>test</scope> + </dependency> <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-testing-utils</artifactId> <scope>test</scope> </dependency> - </dependencies> + </dependencies> </project> \ No newline at end of file diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java index 543131ecf..c615404ba 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java @@ -24,54 +24,54 @@ import de.saxsys.mvvmfx.examples.contacts.ui.main.MainViewModel; public class App extends MvvmfxCdiApplication { - - private static final Logger LOG = LoggerFactory.getLogger(App.class); - - public static void main(String... args) { - - Locale.setDefault(Locale.ENGLISH); - - launch(args); - } - - - @Inject - private ResourceBundle resourceBundle; - - @Inject - private Repository repository; - - @Override - public void initMvvmfx() throws Exception { - int numberOfContacts = 30; - for (int i = 0; i < numberOfContacts; i++) { - repository.save(ContactFactory.createRandomContact()); - } - } - - @Override - public void startMvvmfx(Stage stage) throws Exception { - LOG.info("Starting the Application"); - MvvmFX.setGlobalResourceBundle(resourceBundle); - - stage.setTitle(resourceBundle.getString("window.title")); - - ViewTuple<MainView, MainViewModel> main = FluentViewLoader.fxmlView(MainView.class).load(); - - - Scene rootScene = new Scene(main.getView()); - - rootScene.getStylesheets().add("/contacts.css"); - - stage.setScene(rootScene); - stage.show(); - } - - /** - * The shutdown of the application can be triggered by firing the {@link TriggerShutdownEvent} CDI event. - */ - public void triggerShutdown(@Observes TriggerShutdownEvent event) { - LOG.info("Application will now shut down"); - Platform.exit(); - } + + private static final Logger LOG = LoggerFactory.getLogger(App.class); + + public static void main(String... args) { + + Locale.setDefault(Locale.ENGLISH); + + launch(args); + } + + @Inject + private ResourceBundle resourceBundle; + + @Inject + private Repository repository; + + @Override + public void initMvvmfx() throws Exception { + int numberOfContacts = 30; + for (int i = 0; i < numberOfContacts; i++) { + repository.save(ContactFactory.createRandomContact()); + } + } + + @Override + public void startMvvmfx(Stage stage) throws Exception { + LOG.info("Starting the Application"); + MvvmFX.setGlobalResourceBundle(resourceBundle); + + stage.setTitle(resourceBundle.getString("window.title")); + + ViewTuple<MainView, MainViewModel> main = FluentViewLoader.fxmlView(MainView.class).load(); + + Scene rootScene = new Scene(main.getView()); + + rootScene.getStylesheets().add("/contacts.css"); + + stage.setScene(rootScene); + stage.show(); + } + + /** + * The shutdown of the application can be triggered by firing the + * {@link TriggerShutdownEvent} CDI event. + */ + public void triggerShutdown(@Observes TriggerShutdownEvent event) { + LOG.info("Application will now shut down"); + Platform.exit(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java index ccef780d2..b6d197d62 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java @@ -5,15 +5,16 @@ import java.util.ResourceBundle; /** - * A singleton CDI provider that is used to load the resource bundle and provide it for the CDI injection. + * A singleton CDI provider that is used to load the resource bundle and provide + * it for the CDI injection. */ @Singleton public class ResourceProvider { - - /* - * Due to the @Produces annotation this resource bundle can be injected in all views. - */ - @Produces - private ResourceBundle defaultResourceBundle = ResourceBundle.getBundle("default"); - + + /* + * Due to the @Produces annotation this resource bundle can be injected in all views. + */ + @Produces + private ResourceBundle defaultResourceBundle = ResourceBundle.getBundle("default"); + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java index a273c5b6e..c417dcb29 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java @@ -4,4 +4,5 @@ * CDI event class that is used to indicate that a contact was updated/added/removed. */ public class ContactsUpdatedEvent { + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java index 35ee86c8c..c655baf86 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java @@ -4,4 +4,5 @@ * Event class to trigger the shutdown of the application. */ public class TriggerShutdownEvent { + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java index 5b3addf0f..c6094fdd8 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java @@ -4,61 +4,59 @@ * An entity class that represents an address. */ public class Address extends Identity { - - private Country country; - - private Subdivision subdivision; - - private String street; - - private String postalcode; - - private String city; - - - Address() { - } - - - public Subdivision getSubdivision() { - return subdivision; - } - - public void setSubdivision(Subdivision subdivision) { - this.subdivision = subdivision; - } - - public Country getCountry() { - return country; - } - - public void setCountry(Country country) { - this.country = country; - } - - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - - public String getPostalcode() { - return postalcode; - } - - public void setPostalcode(String postalcode) { - this.postalcode = postalcode; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - + + private Country country; + + private Subdivision subdivision; + + private String street; + + private String postalcode; + + private String city; + + Address() { + + } + + public Subdivision getSubdivision() { + return subdivision; + } + + public void setSubdivision(Subdivision subdivision) { + this.subdivision = subdivision; + } + + public Country getCountry() { + return country; + } + + public void setCountry(Country country) { + this.country = country; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getPostalcode() { + return postalcode; + } + + public void setPostalcode(String postalcode) { + this.postalcode = postalcode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java index 42b6914bf..e828273d4 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java @@ -2,102 +2,100 @@ import java.time.LocalDate; - /** * An entity class that represents a contact. */ public class Contact extends Identity { - - private String firstname; - private String lastname; - private String title; - - private LocalDate birthday; - - private String role; - private String department; - - private String emailAddress; - private String phoneNumber; - private String mobileNumber; - - private final Address address = new Address(); - - public Address getAddress() { - return address; - } - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public LocalDate getBirthday() { - return birthday; - } - - public void setBirthday(LocalDate birthday) { - this.birthday = birthday; - } - - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - - public String getDepartment() { - return department; - } - - public void setDepartment(String department) { - this.department = department; - } - - public String getEmailAddress() { - return emailAddress; - } - - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getMobileNumber() { - return mobileNumber; - } - - public void setMobileNumber(String mobileNumber) { - this.mobileNumber = mobileNumber; - } - - + + private String firstname; + private String lastname; + private String title; + + private LocalDate birthday; + + private String role; + private String department; + + private String emailAddress; + private String phoneNumber; + private String mobileNumber; + + private final Address address = new Address(); + + public Address getAddress() { + return address; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getMobileNumber() { + return mobileNumber; + } + + public void setMobileNumber(String mobileNumber) { + this.mobileNumber = mobileNumber; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java index d890e73e2..9e027ab4e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java @@ -5,90 +5,90 @@ import java.util.List; import java.util.Random; - /** - * A factory that produces contacts. This is used to create dummy data for tests and for the demo. + * A factory that produces contacts. This is used to create dummy data for tests + * and for the demo. */ public class ContactFactory { - - /** - * @return a contact with random generated demo content. - */ - public static Contact createRandomContact() { - Contact contact = new Contact(); - - contact.setFirstname(new Random().nextBoolean() ? getFemaleFirstname() : getMaleFirstname()); - contact.setLastname(getLastname()); - - contact.setBirthday(getBirthday()); - - contact.setEmailAddress(getEmailAddress(contact.getFirstname())); - contact.setPhoneNumber(getPhoneNumber()); - contact.setMobileNumber(getPhoneNumber()); - - return contact; - } - - private static LocalDate getBirthday() { - int year = (2014 - 50) + new Random().nextInt(50); - - int month = new Random().nextInt(12) + 1; - - int day = new Random().nextInt(27) + 1; - - return LocalDate.of(year, month, day); - } - - private static String getPhoneNumber() { - StringBuilder number = new StringBuilder(); - - number.append("+49 "); - - for (int i = 0; i < 11; i++) { - number.append(getRandomNumber()); - } - - return number.toString(); - } - - private static String getEmailAddress(String firstname) { - StringBuilder emailAddress = new StringBuilder(); - - emailAddress.append(firstname); - emailAddress.append(getRandomNumber()); - emailAddress.append(getRandomNumber()); - emailAddress.append("@"); - - List<String> domains = Arrays.asList("example.com", "example.org", "mail.example.com"); - emailAddress.append(domains.get(new Random().nextInt(domains.size()))); - - return emailAddress.toString(); - } - - private static String getLastname() { - - List<String> names = Arrays.asList("Smith", "Brown", "Lee", "Johnson", "Williams", "Müller", "Schmidt", - "Schneider"); - - return names.get(new Random().nextInt(names.size())); - } - - private static String getMaleFirstname() { - - List<String> names = Arrays.asList("Max", "Paul", "Leon", "Lucas", "Jonas", "Ben", "Tim", "David"); - - return names.get(new Random().nextInt(names.size())); - } - - private static String getFemaleFirstname() { - - List<String> names = Arrays.asList("Marie", "Julia", "Anne", "Laura", "Lisa", "Sarah", "Michelle", "Sophie"); - - return names.get(new Random().nextInt(names.size())); - } - - private static int getRandomNumber() { - return new Random().nextInt(10); - } - + + /** + * @return a contact with random generated demo content. + */ + public static Contact createRandomContact() { + Contact contact = new Contact(); + + contact.setFirstname(new Random().nextBoolean() ? getFemaleFirstname() : getMaleFirstname()); + contact.setLastname(getLastname()); + + contact.setBirthday(getBirthday()); + + contact.setEmailAddress(getEmailAddress(contact.getFirstname())); + contact.setPhoneNumber(getPhoneNumber()); + contact.setMobileNumber(getPhoneNumber()); + + return contact; + } + + private static LocalDate getBirthday() { + int year = (2014 - 50) + new Random().nextInt(50); + + int month = new Random().nextInt(12) + 1; + + int day = new Random().nextInt(27) + 1; + + return LocalDate.of(year, month, day); + } + + private static String getPhoneNumber() { + StringBuilder number = new StringBuilder(); + + number.append("+49 "); + + for (int i = 0; i < 11; i++) { + number.append(getRandomNumber()); + } + + return number.toString(); + } + + private static String getEmailAddress(String firstname) { + StringBuilder emailAddress = new StringBuilder(); + + emailAddress.append(firstname); + emailAddress.append(getRandomNumber()); + emailAddress.append(getRandomNumber()); + emailAddress.append("@"); + + List<String> domains = Arrays.asList("example.com", "example.org", "mail.example.com"); + emailAddress.append(domains.get(new Random().nextInt(domains.size()))); + + return emailAddress.toString(); + } + + private static String getLastname() { + + List<String> names = Arrays.asList("Smith", "Brown", "Lee", "Johnson", "Williams", "Müller", "Schmidt", + "Schneider"); + + return names.get(new Random().nextInt(names.size())); + } + + private static String getMaleFirstname() { + + List<String> names = Arrays.asList("Max", "Paul", "Leon", "Lucas", "Jonas", "Ben", "Tim", "David"); + + return names.get(new Random().nextInt(names.size())); + } + + private static String getFemaleFirstname() { + + List<String> names = Arrays.asList("Marie", "Julia", "Anne", "Laura", "Lisa", "Sarah", "Michelle", "Sophie"); + + return names.get(new Random().nextInt(names.size())); + } + + private static int getRandomNumber() { + return new Random().nextInt(10); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java index 5d2ff144b..fb47ad8ae 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java @@ -1,6 +1,5 @@ package de.saxsys.mvvmfx.examples.contacts.model; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; @@ -9,79 +8,73 @@ @XmlRootElement(name = "iso_3166_entry") @XmlAccessorType(XmlAccessType.FIELD) public class Country { - - @XmlAttribute(name = "name") - private String name; - - @XmlAttribute(name = "alpha_2_code") - private String countryCode; - - Country() { - - } - - public Country(String name, String countryCode) { - this.name = name; - this.countryCode = countryCode; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCountryCode() { - return countryCode; - } - - - - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - - if (name == null || countryCode == null) { - return false; - } - - Country country = (Country) o; - - if (!name.equals(country.name)) { - return false; - } - - if (!countryCode.equals(country.countryCode)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = name == null ? 13 : name.hashCode(); - result += countryCode == null ? 13 : countryCode.hashCode(); - return result; - } - - - @Override - public String toString() { - return "Country:" + name + ", code:" + countryCode; - } + + @XmlAttribute(name = "name") + private String name; + + @XmlAttribute(name = "alpha_2_code") + private String countryCode; + + Country() { + + } + + public Country(String name, String countryCode) { + this.name = name; + this.countryCode = countryCode; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + if (name == null || countryCode == null) { + return false; + } + + Country country = (Country) o; + + if (!name.equals(country.name)) { + return false; + } + + if (!countryCode.equals(country.countryCode)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = name == null ? 13 : name.hashCode(); + result += countryCode == null ? 13 : countryCode.hashCode(); + return result; + } + + @Override + public String toString() { + return "Country:" + name + ", code:" + countryCode; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java index 26093c920..67def9047 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java @@ -27,220 +27,225 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /** - * This class is used to encapsulate the process of loading available countries and there subdivisions (if available). - * - * This class is meant to be a stateful wrapper around the existing countries. You should create an instance of this - * class, call the {@link #init()} method and then bind the UI to the provided observable lists ( + * This class is used to encapsulate the process of loading available countries + * and there subdivisions (if available). + * + * This class is meant to be a stateful wrapper around the existing countries. + * You should create an instance of this class, call the {@link #init()} method + * and then bind the UI to the provided observable lists ( * {@link #availableCountries()} and {@link #subdivisions()}). - * - * To choose a country have to use the {@link #setCountry(Country)} method. This will lead to a change of the - * {@link #subdivisions()} list. - * - * - * At the moment this class used two XML files ({@link #ISO_3166_LOCATION} and {@link #ISO_3166_2_LOCATION}) that - * contain information about countries, country-codes and subdivisions according to ISO 3166 and ISO 3166-2. - * + * + * To choose a country have to use the {@link #setCountry(Country)} method. This + * will lead to a change of the {@link #subdivisions()} list. + * + * + * At the moment this class used two XML files ({@link #ISO_3166_LOCATION} and + * {@link #ISO_3166_2_LOCATION}) that contain information about countries, + * country-codes and subdivisions according to ISO 3166 and ISO 3166-2. + * * The loading process is implemented with the DataFX framework. */ public class CountrySelector { - - private static final Logger LOG = LoggerFactory.getLogger(CountrySelector.class); - - public static final String ISO_3166_LOCATION = "/countries/iso_3166.xml"; - public static final String ISO_3166_2_LOCATION = "/countries/iso_3166_2.xml"; - private ObservableList<Country> countries = FXCollections.observableArrayList(); - private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); - - - private ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); - - private ReadOnlyBooleanWrapper inProgress = new ReadOnlyBooleanWrapper(false); - - private Map<Country, List<Subdivision>> countryCodeSubdivisionMap = new HashMap<>(); - private Map<Country, String> countryCodeSubdivisionNameMap = new HashMap<>(); - - - /** - * This method triggers the loading of the available countries and subdivisions. - */ - public void init() { - inProgress.set(true); - loadCountries(); - } - - /** - * Set the currently selected country. This will lead to an update of the {@link #subdivisions()} observable list - * and the {@link #subdivisionLabel()}. - * - * @param country - * the country that will be selected or <code>null</code> if no country is selected. - */ - public void setCountry(Country country) { - if (country == null) { - subdivisionLabel.set(null); - subdivisions.clear(); - return; - } - - subdivisionLabel.set(countryCodeSubdivisionNameMap.get(country)); - - subdivisions.clear(); - if (countryCodeSubdivisionMap.containsKey(country)) { - subdivisions.addAll(countryCodeSubdivisionMap.get(country)); - } - } - - - /** - * Load all countries from the XML file source with DataFX. - */ - void loadCountries() { - URL iso3166Resource = this.getClass().getResource(ISO_3166_LOCATION); - if (iso3166Resource == null) { - throw new IllegalStateException("Can't find the list of countries! Expected location was:" - + ISO_3166_LOCATION); - } - - XmlConverter<Country> countryConverter = new XmlConverter<>("iso_3166_entry", Country.class); - - try { - FileSource<Country> dataSource = new FileSource<>(new File(iso3166Resource.getFile()), countryConverter); - ListDataProvider<Country> listDataProvider = new ListDataProvider<>(dataSource); - - listDataProvider.setResultObservableList(countries); - - Worker<ObservableList<Country>> worker = listDataProvider.retrieve(); - // when the countries are loaded we start the loading of the subdivisions. - worker.stateProperty().addListener(obs -> { - if (worker.getState() == Worker.State.SUCCEEDED) { - loadSubdivisions(); - } - }); - } catch (IOException e) { - LOG.error("A problem was detected while loading the XML file with the available countries.", e); - } - } - - /** - * Load all subdivisions from the XML file source with DataFX. - */ - void loadSubdivisions() { - - URL iso3166_2Resource = this.getClass().getResource(ISO_3166_2_LOCATION); - - if (iso3166_2Resource == null) { - throw new IllegalStateException("Can't find the list of subdivisions! Expected location was:" + - ISO_3166_2_LOCATION); - } - - XmlConverter<ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", - ISO3166_2_CountryEntity.class); - - ObservableList<ISO3166_2_CountryEntity> subdivisionsEntities = FXCollections.observableArrayList(); - - try { - FileSource<ISO3166_2_CountryEntity> dataSource = new FileSource<>(new File(iso3166_2Resource.getFile()), - converter); - ListDataProvider<ISO3166_2_CountryEntity> listDataProvider = new ListDataProvider<>(dataSource); - - listDataProvider.setResultObservableList(subdivisionsEntities); - - Worker<ObservableList<ISO3166_2_CountryEntity>> worker = listDataProvider.retrieve(); - worker.stateProperty().addListener(obs -> { - if (worker.getState() == Worker.State.SUCCEEDED) { - - subdivisionsEntities.forEach(entity -> { - if (entity.subsets != null && !entity.subsets.isEmpty()) { - - Country country = findCountryByCode(entity.code); - - if (!countryCodeSubdivisionMap.containsKey(country)) { - countryCodeSubdivisionMap.put(country, new ArrayList<>()); - } - - List<Subdivision> subdivisionList = countryCodeSubdivisionMap.get(country); - - entity.subsets.get(0).entryList.forEach(entry -> { - subdivisionList.add(new Subdivision(entry.name, entry.code, country)); - }); - - countryCodeSubdivisionNameMap.put(country, entity.subsets.get(0).subdivisionType); - } - }); - - inProgress.set(false); - } - }); - } catch (IOException e) { - LOG.error("A problem was detected while loading the XML file with the available subdivisions.", e); - } - - } - - private Country findCountryByCode(String code) { - return countries.stream().filter(country -> country.getCountryCode().equals(code)).findFirst().orElse(null); - } - - - - /** - * XML entity class. These classes represent the structure of the XML files to be loaded. - */ - @XmlRootElement(name = "iso_3166_subset") - @XmlAccessorType(XmlAccessType.FIELD) - static class ISO3166_2_EntryEntity { - @XmlAttribute(name = "code") - public String code; - @XmlAttribute(name = "name") - public String name; - } - - /** - * XML entity class. These classes represent the structure of the XML files to be loaded. - */ - @XmlRootElement(name = "iso_3166_subset") - @XmlAccessorType(XmlAccessType.FIELD) - static class ISO3166_2_SubsetEntity { - @XmlElement(name = "iso_3166_2_entry") - public List<ISO3166_2_EntryEntity> entryList; - - @XmlAttribute(name = "type") - public String subdivisionType; - } - - /** - * XML entity class. These classes represent the structure of the XML files to be loaded. - */ - @XmlRootElement(name = "iso_3166_country") - @XmlAccessorType(XmlAccessType.FIELD) - static class ISO3166_2_CountryEntity { - @XmlAttribute(name = "code") - public String code; - - @XmlElement(name = "iso_3166_subset") - public List<ISO3166_2_SubsetEntity> subsets; - - @Override - public String toString() { - return "CountryEntity " + code; - } - } - - public ObservableList<Country> availableCountries() { - return countries; - } - - public ReadOnlyStringProperty subdivisionLabel() { - return subdivisionLabel.getReadOnlyProperty(); - } - - public ObservableList<Subdivision> subdivisions() { - return FXCollections.unmodifiableObservableList(subdivisions); - } - - public ReadOnlyBooleanProperty inProgressProperty() { - return inProgress.getReadOnlyProperty(); - } + + private static final Logger LOG = LoggerFactory.getLogger(CountrySelector.class); + + public static final String ISO_3166_LOCATION = "/countries/iso_3166.xml"; + public static final String ISO_3166_2_LOCATION = "/countries/iso_3166_2.xml"; + private ObservableList<Country> countries = FXCollections.observableArrayList(); + private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); + + private ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); + + private ReadOnlyBooleanWrapper inProgress = new ReadOnlyBooleanWrapper(false); + + private Map<Country, List<Subdivision>> countryCodeSubdivisionMap = new HashMap<>(); + private Map<Country, String> countryCodeSubdivisionNameMap = new HashMap<>(); + + /** + * This method triggers the loading of the available countries and + * subdivisions. + */ + public void init() { + inProgress.set(true); + loadCountries(); + } + + /** + * Set the currently selected country. This will lead to an update of the + * {@link #subdivisions()} observable list and the + * {@link #subdivisionLabel()}. + * + * @param country the country that will be selected or <code>null</code> if + * no country is selected. + */ + public void setCountry(Country country) { + if (country == null) { + subdivisionLabel.set(null); + subdivisions.clear(); + return; + } + + subdivisionLabel.set(countryCodeSubdivisionNameMap.get(country)); + + subdivisions.clear(); + if (countryCodeSubdivisionMap.containsKey(country)) { + subdivisions.addAll(countryCodeSubdivisionMap.get(country)); + } + } + + /** + * Load all countries from the XML file source with DataFX. + */ + void loadCountries() { + URL iso3166Resource = this.getClass().getResource(ISO_3166_LOCATION); + if (iso3166Resource == null) { + throw new IllegalStateException("Can't find the list of countries! Expected location was:" + + ISO_3166_LOCATION); + } + + XmlConverter<Country> countryConverter = new XmlConverter<>("iso_3166_entry", Country.class); + + try { + FileSource<Country> dataSource = new FileSource<>(new File(iso3166Resource.getFile()), countryConverter); + ListDataProvider<Country> listDataProvider = new ListDataProvider<>(dataSource); + + listDataProvider.setResultObservableList(countries); + + Worker<ObservableList<Country>> worker = listDataProvider.retrieve(); + // when the countries are loaded we start the loading of the subdivisions. + worker.stateProperty().addListener(obs -> { + if (worker.getState() == Worker.State.SUCCEEDED) { + loadSubdivisions(); + } + }); + } catch (IOException e) { + LOG.error("A problem was detected while loading the XML file with the available countries.", e); + } + } + + /** + * Load all subdivisions from the XML file source with DataFX. + */ + void loadSubdivisions() { + + URL iso3166_2Resource = this.getClass().getResource(ISO_3166_2_LOCATION); + + if (iso3166_2Resource == null) { + throw new IllegalStateException("Can't find the list of subdivisions! Expected location was:" + + ISO_3166_2_LOCATION); + } + + XmlConverter<ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", + ISO3166_2_CountryEntity.class); + + ObservableList<ISO3166_2_CountryEntity> subdivisionsEntities = FXCollections.observableArrayList(); + + try { + FileSource<ISO3166_2_CountryEntity> dataSource = new FileSource<>(new File(iso3166_2Resource.getFile()), + converter); + ListDataProvider<ISO3166_2_CountryEntity> listDataProvider = new ListDataProvider<>(dataSource); + + listDataProvider.setResultObservableList(subdivisionsEntities); + + Worker<ObservableList<ISO3166_2_CountryEntity>> worker = listDataProvider.retrieve(); + worker.stateProperty().addListener(obs -> { + if (worker.getState() == Worker.State.SUCCEEDED) { + + subdivisionsEntities.forEach(entity -> { + if (entity.subsets != null && !entity.subsets.isEmpty()) { + + Country country = findCountryByCode(entity.code); + + if (!countryCodeSubdivisionMap.containsKey(country)) { + countryCodeSubdivisionMap.put(country, new ArrayList<>()); + } + + List<Subdivision> subdivisionList = countryCodeSubdivisionMap.get(country); + + entity.subsets.get(0).entryList.forEach(entry -> { + subdivisionList.add(new Subdivision(entry.name, entry.code, country)); + }); + + countryCodeSubdivisionNameMap.put(country, entity.subsets.get(0).subdivisionType); + } + }); + + inProgress.set(false); + } + }); + } catch (IOException e) { + LOG.error("A problem was detected while loading the XML file with the available subdivisions.", e); + } + + } + + private Country findCountryByCode(String code) { + return countries.stream().filter(country -> country.getCountryCode().equals(code)).findFirst().orElse(null); + } + + /** + * XML entity class. These classes represent the structure of the XML files + * to be loaded. + */ + @XmlRootElement(name = "iso_3166_subset") + @XmlAccessorType(XmlAccessType.FIELD) + static class ISO3166_2_EntryEntity { + + @XmlAttribute(name = "code") + public String code; + @XmlAttribute(name = "name") + public String name; + } + + /** + * XML entity class. These classes represent the structure of the XML files + * to be loaded. + */ + @XmlRootElement(name = "iso_3166_subset") + @XmlAccessorType(XmlAccessType.FIELD) + static class ISO3166_2_SubsetEntity { + + @XmlElement(name = "iso_3166_2_entry") + public List<ISO3166_2_EntryEntity> entryList; + + @XmlAttribute(name = "type") + public String subdivisionType; + } + + /** + * XML entity class. These classes represent the structure of the XML files + * to be loaded. + */ + @XmlRootElement(name = "iso_3166_country") + @XmlAccessorType(XmlAccessType.FIELD) + static class ISO3166_2_CountryEntity { + + @XmlAttribute(name = "code") + public String code; + + @XmlElement(name = "iso_3166_subset") + public List<ISO3166_2_SubsetEntity> subsets; + + @Override + public String toString() { + return "CountryEntity " + code; + } + } + + public ObservableList<Country> availableCountries() { + return countries; + } + + public ReadOnlyStringProperty subdivisionLabel() { + return subdivisionLabel.getReadOnlyProperty(); + } + + public ObservableList<Subdivision> subdivisions() { + return FXCollections.unmodifiableObservableList(subdivisions); + } + + public ReadOnlyBooleanProperty inProgressProperty() { + return inProgress.getReadOnlyProperty(); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java index a85b6a2c6..1182be7c5 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java @@ -2,44 +2,45 @@ import java.util.UUID; - /** - * This is a base class for model entities that represent identities. This means that they are distinguished by there - * identity (id) and not by there values. Two instances can be considered "the same" when they have the same ID, + * This is a base class for model entities that represent identities. This means + * that they are distinguished by there identity (id) and not by there values. + * Two instances can be considered "the same" when they have the same ID, * independently what values they have. */ public abstract class Identity { - - private String id; - - public Identity() { - id = UUID.randomUUID().toString(); - } - - public String getId() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Identity identity = (Identity) o; - - if (!id.equals(identity.id)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return id.hashCode(); - } + + private String id; + + public Identity() { + id = UUID.randomUUID().toString(); + } + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Identity identity = (Identity) o; + + if (!id.equals(identity.id)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + return id.hashCode(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java index 2ebdbb20f..46caff397 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java @@ -12,38 +12,38 @@ @Singleton public class InmemoryRepository implements Repository { - - private Set<Contact> contacts = new HashSet<>(); - - @Inject - private Event<ContactsUpdatedEvent> contactsUpdatedEvent; - - - @Override - public Set<Contact> findAll() { - return Collections.unmodifiableSet(contacts); - } - - @Override - public Optional<Contact> findById(String id) { - return contacts.stream().filter(contact -> contact.getId().equals(id)).findFirst(); - } - - @Override - public void save(Contact contact) { - contacts.add(contact); - fireUpdateEvent(); - } - - @Override - public void delete(Contact contact) { - contacts.remove(contact); - fireUpdateEvent(); - } - - private void fireUpdateEvent() { - if (contactsUpdatedEvent != null) { - contactsUpdatedEvent.fire(new ContactsUpdatedEvent()); - } - } + + private final Set<Contact> contacts = new HashSet<>(); + + @Inject + private Event<ContactsUpdatedEvent> contactsUpdatedEvent; + + @Override + public Set<Contact> findAll() { + return Collections.unmodifiableSet(contacts); + } + + @Override + public Optional<Contact> findById(String id) { + return contacts.stream().filter(contact -> contact.getId().equals(id)).findFirst(); + } + + @Override + public void save(Contact contact) { + contacts.add(contact); + fireUpdateEvent(); + } + + @Override + public void delete(Contact contact) { + contacts.remove(contact); + fireUpdateEvent(); + } + + private void fireUpdateEvent() { + if (contactsUpdatedEvent != null) { + contactsUpdatedEvent.fire(new ContactsUpdatedEvent()); + } + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java index 7bab2c4d5..2fe7b2206 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java @@ -4,13 +4,13 @@ import java.util.Set; public interface Repository { - - - Set<Contact> findAll(); - - Optional<Contact> findById(String id); - - void save(Contact contact); - - void delete(Contact contact); + + Set<Contact> findAll(); + + Optional<Contact> findById(String id); + + void save(Contact contact); + + void delete(Contact contact); + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java index 4c2e1c96b..2ce714eb5 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java @@ -1,59 +1,60 @@ package de.saxsys.mvvmfx.examples.contacts.model; public class Subdivision { - - private final String name; - private final String abbr; - - private final Country country; - - public Subdivision(String name, String abbr, Country country) { - this.name = name; - this.abbr = abbr; - this.country = country; - } - - public String getName() { - return name; - } - - public String getAbbr() { - return abbr; - } - - public Country getCountry() { - return country; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Subdivision that = (Subdivision) o; - - if (!abbr.equals(that.abbr)) { - return false; - } - if (!country.equals(that.country)) { - return false; - } - if (!name.equals(that.name)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = name.hashCode(); - result = 31 * result + abbr.hashCode(); - result = 31 * result + country.hashCode(); - return result; - } + + private final String name; + private final String abbr; + + private final Country country; + + public Subdivision(String name, String abbr, Country country) { + this.name = name; + this.abbr = abbr; + this.country = country; + } + + public String getName() { + return name; + } + + public String getAbbr() { + return abbr; + } + + public Country getCountry() { + return country; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Subdivision that = (Subdivision) o; + + if (!abbr.equals(that.abbr)) { + return false; + } + if (!country.equals(that.country)) { + return false; + } + if (!name.equals(that.name)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = name.hashCode(); + result = 31 * result + abbr.hashCode(); + result = 31 * result + country.hashCode(); + return result; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java index 692235637..9ff5b6699 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java @@ -8,18 +8,17 @@ @Singleton public class AboutAuthorView implements FxmlView<AboutAuthorViewModel> { - - @InjectViewModel - private AboutAuthorViewModel viewModel; - - - @FXML - public void openBlog() { - viewModel.openBlog(); - } - - @FXML - public void openTwitter() { - viewModel.openTwitter(); - } + + @InjectViewModel + private AboutAuthorViewModel viewModel; + + @FXML + public void openBlog() { + viewModel.openBlog(); + } + + @FXML + public void openTwitter() { + viewModel.openTwitter(); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java index 2248d91f2..b0353a6fa 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java @@ -6,16 +6,16 @@ import javafx.application.HostServices; public class AboutAuthorViewModel implements ViewModel { - - @Inject - private HostServices hostServices; - - - public void openBlog() { - hostServices.showDocument("http://www.lestard.eu"); - } - - public void openTwitter() { - hostServices.showDocument("https://twitter.com/manuel_mauky"); - } + + @Inject + private HostServices hostServices; + + public void openBlog() { + hostServices.showDocument("http://www.lestard.eu"); + } + + public void openTwitter() { + hostServices.showDocument("https://twitter.com/manuel_mauky"); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java index 02ede7138..0eea6738f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java @@ -16,31 +16,30 @@ @Singleton public class AboutView implements FxmlView<AboutViewModel> { - - @FXML - private HyperlinkLabel librariesLabel; - - @InjectViewModel - private AboutViewModel viewModel; - - @Inject - private Stage primaryStage; - - - public void initialize() { - librariesLabel.textProperty().bind(viewModel.librariesLabelTextProperty()); - librariesLabel.setOnAction(event -> { - Hyperlink link = (Hyperlink) event.getSource(); - String str = link == null ? "" : link.getText(); - viewModel.onLinkClicked(str); - }); - } - - @FXML - public void openAuthorPage() { - Parent view = FluentViewLoader.fxmlView(AboutAuthorView.class) - .load().getView(); - DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - } - + + @FXML + private HyperlinkLabel librariesLabel; + + @InjectViewModel + private AboutViewModel viewModel; + + @Inject + private Stage primaryStage; + + public void initialize() { + librariesLabel.textProperty().bind(viewModel.librariesLabelTextProperty()); + librariesLabel.setOnAction(event -> { + Hyperlink link = (Hyperlink) event.getSource(); + String str = link == null ? "" : link.getText(); + viewModel.onLinkClicked(str); + }); + } + + @FXML + public void openAuthorPage() { + Parent view = FluentViewLoader.fxmlView(AboutAuthorView.class) + .load().getView(); + DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java index a3d2901a3..5d08da110 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java @@ -15,60 +15,60 @@ import javafx.collections.ObservableMap; public class AboutViewModel implements ViewModel { - - @Inject - private HostServices hostServices; - - @Inject - private NotificationCenter notificationCenter; - - private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); - - // Package Private because of testing reasons - ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); - - /** - * Sadly the {@link javafx.application.HostServices} class of JavaFX is <code>final</code> so we can't mock it in - * tests. To still be able to test link actions we have introduced this handler as a mockable indirection. - */ - Consumer<String> onLinkClickedHandler; - - public AboutViewModel() { - - libraryLinkMap.addListener((MapChangeListener<String, String>) change -> { - StringBuilder labelText = new StringBuilder(); - - libraryLinkMap.keySet().stream().sorted().forEach(libraryName -> { - labelText.append("- ["); - labelText.append(libraryName); - labelText.append("]\n"); - }); - - librariesLabelText.set(labelText.toString()); - }); - } - - @PostConstruct - public void initLibraryMap() { - onLinkClickedHandler = hostServices::showDocument; - - libraryLinkMap.put("DataFX", "http://www.javafxdata.org/"); - libraryLinkMap.put("ControlsFX", "http://fxexperience.com/controlsfx/"); - libraryLinkMap.put("FontAwesomeFX", "https://bitbucket.org/Jerady/fontawesomefx"); - libraryLinkMap.put("Advanced-Bindings", "https://github.com/lestard/advanced-bindings"); - libraryLinkMap.put("AssertJ-JavaFX", "https://github.com/lestard/assertj-javafx"); - libraryLinkMap.put("JFX-Testrunner", "https://github.com/sialcasa/jfx-testrunner"); - } - - - public void onLinkClicked(String linkText) { - if (libraryLinkMap.containsKey(linkText)) { - onLinkClickedHandler.accept(libraryLinkMap.get(linkText)); - } - } - - public ReadOnlyStringProperty librariesLabelTextProperty() { - return librariesLabelText.getReadOnlyProperty(); - } - + + @Inject + private HostServices hostServices; + + @Inject + private NotificationCenter notificationCenter; + + private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); + + // Package Private because of testing reasons + ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); + + /** + * Sadly the {@link javafx.application.HostServices} class of JavaFX is + * <code>final</code> so we can't mock it in tests. To still be able to test + * link actions we have introduced this handler as a mockable indirection. + */ + Consumer<String> onLinkClickedHandler; + + public AboutViewModel() { + + libraryLinkMap.addListener((MapChangeListener<String, String>) change -> { + StringBuilder labelText = new StringBuilder(); + + libraryLinkMap.keySet().stream().sorted().forEach(libraryName -> { + labelText.append("- ["); + labelText.append(libraryName); + labelText.append("]\n"); + }); + + librariesLabelText.set(labelText.toString()); + }); + } + + @PostConstruct + public void initLibraryMap() { + onLinkClickedHandler = hostServices::showDocument; + + libraryLinkMap.put("DataFX", "http://www.javafxdata.org/"); + libraryLinkMap.put("ControlsFX", "http://fxexperience.com/controlsfx/"); + libraryLinkMap.put("FontAwesomeFX", "https://bitbucket.org/Jerady/fontawesomefx"); + libraryLinkMap.put("Advanced-Bindings", "https://github.com/lestard/advanced-bindings"); + libraryLinkMap.put("AssertJ-JavaFX", "https://github.com/lestard/assertj-javafx"); + libraryLinkMap.put("JFX-Testrunner", "https://github.com/sialcasa/jfx-testrunner"); + } + + public void onLinkClicked(String linkText) { + if (libraryLinkMap.containsKey(linkText)) { + onLinkClickedHandler.accept(libraryLinkMap.get(linkText)); + } + } + + public ReadOnlyStringProperty librariesLabelTextProperty() { + return librariesLabelText.getReadOnlyProperty(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java index 739aa12b7..4609fcf78 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java @@ -8,22 +8,20 @@ @Singleton public class AddContactDialogView implements FxmlView<AddContactDialogViewModel> { - - @InjectViewModel - private AddContactDialogViewModel viewModel; - - private Stage showDialog; - - - public void initialize() { - viewModel.subscribe(AddContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { - showDialog.close(); - }); - } - - - public void setDisplayingStage(Stage showDialog) { - this.showDialog = showDialog; - } - + + @InjectViewModel + private AddContactDialogViewModel viewModel; + + private Stage showDialog; + + public void initialize() { + viewModel.subscribe(AddContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + showDialog.close(); + }); + } + + public void setDisplayingStage(Stage showDialog) { + this.showDialog = showDialog; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index 9e76049cb..28680f9f1 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -11,44 +11,45 @@ import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; public class AddContactDialogViewModel implements ViewModel { - - public static final String CLOSE_DIALOG_NOTIFICATION = "closeDialog"; - - static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; - - @Inject - private Repository repository; - - @InjectScope - private ContactDialogScope dialogScope; - - @Inject - private ResourceBundle defaultResourceBundle; - - public void initialize() { - dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { - addContactAction(); - }); - - dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - dialogScope.publish(ContactDialogScope.RESET_FORMS); - Contact contact = new Contact(); - dialogScope.setContactToEdit(contact); - } - - public void addContactAction() { - if (dialogScope.isContactFormValid()) { - - dialogScope.publish(ContactDialogScope.COMMIT); - - Contact contact = dialogScope.getContactToEdit(); - - repository.save(contact); - - dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); - dialogScope.setContactToEdit(null); - - publish(CLOSE_DIALOG_NOTIFICATION); - } - } + + public static final String CLOSE_DIALOG_NOTIFICATION = "closeDialog"; + + static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; + + @Inject + private Repository repository; + + @InjectScope + private ContactDialogScope dialogScope; + + @Inject + private ResourceBundle defaultResourceBundle; + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { + addContactAction(); + }); + + dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); + dialogScope.publish(ContactDialogScope.RESET_FORMS); + Contact contact = new Contact(); + dialogScope.setContactToEdit(contact); + } + + public void addContactAction() { + if (dialogScope.isContactFormValid()) { + + dialogScope.publish(ContactDialogScope.COMMIT); + + Contact contact = dialogScope.getContactToEdit(); + + repository.save(contact); + + dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); + dialogScope.setContactToEdit(null); + + publish(CLOSE_DIALOG_NOTIFICATION); + } + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java index 9e43398cb..69b29387a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java @@ -9,49 +9,48 @@ import javafx.scene.control.TextField; public class AddressFormView implements FxmlView<AddressFormViewModel> { - - @FXML - public TextField streetInput; - @FXML - public TextField postalcodeInput; - @FXML - public TextField cityInput; - - @FXML - public ComboBox<String> countryInput; - @FXML - public ComboBox<String> federalStateInput; - - @FXML - public Label subdivisionLabel; - @FXML - public Label countryLabel; - - @FXML - public ProgressIndicator loadingIndicator; - - - @InjectViewModel - private AddressFormViewModel viewModel; - - - public void initialize() { - loadingIndicator.visibleProperty().bind(viewModel.loadingInProgressProperty()); - countryLabel.disableProperty().bind(viewModel.countryInputDisabledProperty()); - - streetInput.textProperty().bindBidirectional(viewModel.streetProperty()); - postalcodeInput.textProperty().bindBidirectional(viewModel.postalCodeProperty()); - cityInput.textProperty().bindBidirectional(viewModel.cityProperty()); - - countryInput.setItems(viewModel.countriesList()); - countryInput.valueProperty().bindBidirectional(viewModel.selectedCountryProperty()); - countryInput.disableProperty().bind(viewModel.countryInputDisabledProperty()); - - federalStateInput.setItems(viewModel.subdivisionsList()); - federalStateInput.valueProperty().bindBidirectional(viewModel.selectedSubdivisionProperty()); - federalStateInput.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); - - subdivisionLabel.textProperty().bind(viewModel.subdivisionLabel()); - subdivisionLabel.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); - } + + @FXML + public TextField streetInput; + @FXML + public TextField postalcodeInput; + @FXML + public TextField cityInput; + + @FXML + public ComboBox<String> countryInput; + @FXML + public ComboBox<String> federalStateInput; + + @FXML + public Label subdivisionLabel; + @FXML + public Label countryLabel; + + @FXML + public ProgressIndicator loadingIndicator; + + @InjectViewModel + private AddressFormViewModel viewModel; + + public void initialize() { + loadingIndicator.visibleProperty().bind(viewModel.loadingInProgressProperty()); + countryLabel.disableProperty().bind(viewModel.countryInputDisabledProperty()); + + streetInput.textProperty().bindBidirectional(viewModel.streetProperty()); + postalcodeInput.textProperty().bindBidirectional(viewModel.postalCodeProperty()); + cityInput.textProperty().bindBidirectional(viewModel.cityProperty()); + + countryInput.setItems(viewModel.countriesList()); + countryInput.valueProperty().bindBidirectional(viewModel.selectedCountryProperty()); + countryInput.disableProperty().bind(viewModel.countryInputDisabledProperty()); + + federalStateInput.setItems(viewModel.subdivisionsList()); + federalStateInput.valueProperty().bindBidirectional(viewModel.selectedSubdivisionProperty()); + federalStateInput.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); + + subdivisionLabel.textProperty().bind(viewModel.subdivisionLabel()); + subdivisionLabel.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index 57e6cb0f7..1475494de 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -29,227 +29,226 @@ import javafx.collections.ObservableList; public class AddressFormViewModel implements ViewModel { - static final String NOTHING_SELECTED_MARKER = "---"; - static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; - - private ObservableList<String> countries; - private ObservableList<String> subdivisions; - - private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); - private final ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); - - private final StringProperty street = new SimpleStringProperty(); - private final StringProperty postalCode = new SimpleStringProperty(); - private final StringProperty city = new SimpleStringProperty(); - private final ObjectProperty<Subdivision> subdivision = new SimpleObjectProperty<>(); - private final ObjectProperty<Country> country = new SimpleObjectProperty<>(); - - private final StringProperty selectedCountry = new SimpleStringProperty(NOTHING_SELECTED_MARKER); - private final StringProperty selectedSubdivision = new SimpleStringProperty(NOTHING_SELECTED_MARKER); - - private final ReadOnlyBooleanWrapper loadingInProgress = new ReadOnlyBooleanWrapper(); - private final ReadOnlyBooleanWrapper countryInputDisabled = new ReadOnlyBooleanWrapper(); - private final ReadOnlyBooleanWrapper subdivisionInputDisabled = new ReadOnlyBooleanWrapper(); - - @Inject - CountrySelector countrySelector; - - @Inject - ResourceBundle resourceBundle; - - @InjectScope - ContactDialogScope dialogScope; - - // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. - private ItemList<Country> countryItemList; - // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. - private ItemList<Subdivision> subdivisionItemList; - private Address address; - - private ObjectBinding<Contact> contactBinding; - - public void initialize() { - dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); - - ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); - - if (contactToEditProperty.get() != null) { - initWithAddress(contactToEditProperty.get().getAddress()); - } - - contactToEditProperty.addListener((observable, oldValue, newValue) -> { - if (newValue != null) { - if (newValue.getAddress() == null) { - System.out.println("Address is null"); - } else { - initWithAddress(newValue.getAddress()); - } - } - }); - - - loadingInProgress.bind(countrySelector.inProgressProperty()); - countrySelector.init(); - - initSubdivisionLabel(); - initCountryList(); - initSubdivisionList(); - - selectedCountry.addListener((obs, oldV, newV) -> { - if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { - Optional<Country> matchingCountry = countrySelector.availableCountries().stream() - .filter(country -> newV.equals(country.getName())) - .findFirst(); - - if (matchingCountry.isPresent()) { - countrySelector.setCountry(matchingCountry.get()); - country.set(matchingCountry.get()); - } - } else if (NOTHING_SELECTED_MARKER.equals(newV)) { - countrySelector.setCountry(null); - country.set(null); - } - selectedSubdivision.set(NOTHING_SELECTED_MARKER); - }); - - selectedSubdivision.addListener((obs, oldV, newV) -> { - if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { - Optional<Subdivision> subdivisionOptional = countrySelector.subdivisions().stream() - .filter(subdivision -> subdivision.getName().equals(newV)).findFirst(); - - if (subdivisionOptional.isPresent()) { - subdivision.set(subdivisionOptional.get()); - } else { - subdivision.set(null); - } - } else { - subdivision.set(null); - } - }); - - countryInputDisabled.bind(loadingInProgress); - subdivisionInputDisabled.bind(loadingInProgress.or(Bindings.size(subdivisionsList()).lessThanOrEqualTo(1))); - - - dialogScope.addressFormValidProperty().bind(valid); - } - - void initSubdivisionLabel() { - subdivisionLabel.bind( - Bindings.when( - countrySelector.subdivisionLabel().isEmpty()) - .then(resourceBundle.getString(SUBDIVISION_LABEL_KEY)) - .otherwise(countrySelector.subdivisionLabel())); - } - - private void initSubdivisionList() { - subdivisionItemList = new ItemList<>(countrySelector.subdivisions(), Subdivision::getName); - subdivisions = createListWithNothingSelectedMarker(subdivisionItemList.getTargetList()); - subdivisions.addListener((ListChangeListener<String>) c -> selectedSubdivision.set(NOTHING_SELECTED_MARKER)); - } - - private void initCountryList() { - countryItemList = new ItemList<>(countrySelector.availableCountries(), Country::getName); - ObservableList<String> mappedList = countryItemList.getTargetList(); - - countries = createListWithNothingSelectedMarker(mappedList); - countries.addListener((ListChangeListener<String>) c -> selectedCountry.set(NOTHING_SELECTED_MARKER)); - } - - - private void commitChanges() { - address.setStreet(street.get()); - address.setCity(city.get()); - address.setPostalcode(postalCode.get()); - address.setCountry(country.get()); - address.setSubdivision(subdivision.get()); - } - - public void initWithAddress(Address address) { - this.address = address; - street.set(address.getStreet()); - city.set(address.getCity()); - postalCode.set(address.getPostalcode()); - - if (address.getCountry() != null) { - selectedCountry.set(address.getCountry().getName()); - } - if (address.getSubdivision() != null) { - selectedSubdivision.set(address.getSubdivision().getName()); - } - } - - /** - * Creates an observable list that always has {@link #NOTHING_SELECTED_MARKER} as first element and the values of - * the given observable list. - */ - static ObservableList<String> createListWithNothingSelectedMarker(ObservableList<String> source) { - final ObservableList<String> result = FXCollections.observableArrayList(); - result.add(NOTHING_SELECTED_MARKER); - result.addAll(source); - - // for sure there are better solutions for this but it's sufficient for our demo - source.addListener((ListChangeListener<String>) c -> { - result.clear(); - result.add(NOTHING_SELECTED_MARKER); - result.addAll(source); - }); - return result; - } - - - public ObservableList<String> countriesList() { - return countries; - } - - public ObservableList<String> subdivisionsList() { - return subdivisions; - } - - public StringProperty streetProperty() { - return street; - } - - public StringProperty cityProperty() { - return city; - } - - public StringProperty postalCodeProperty() { - return postalCode; - } - - public StringProperty selectedCountryProperty() { - return selectedCountry; - } - - public StringProperty selectedSubdivisionProperty() { - return selectedSubdivision; - } - - public ReadOnlyStringProperty subdivisionLabel() { - return subdivisionLabel.getReadOnlyProperty(); - } - - public ReadOnlyBooleanProperty loadingInProgressProperty() { - return loadingInProgress.getReadOnlyProperty(); - } - - public ReadOnlyBooleanProperty countryInputDisabledProperty() { - return countryInputDisabled.getReadOnlyProperty(); - } - - public ReadOnlyBooleanProperty subdivisionInputDisabledProperty() { - return subdivisionInputDisabled.getReadOnlyProperty(); - } - - private void resetForm() { - street.set(""); - city.set(""); - postalCode.set(""); - selectedCountry.set(NOTHING_SELECTED_MARKER); - selectedSubdivision.set(NOTHING_SELECTED_MARKER); - subdivision.set(null); - country.set(null); - } + + static final String NOTHING_SELECTED_MARKER = "---"; + static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; + + private ObservableList<String> countries; + private ObservableList<String> subdivisions; + + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); + private final ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); + + private final StringProperty street = new SimpleStringProperty(); + private final StringProperty postalCode = new SimpleStringProperty(); + private final StringProperty city = new SimpleStringProperty(); + private final ObjectProperty<Subdivision> subdivision = new SimpleObjectProperty<>(); + private final ObjectProperty<Country> country = new SimpleObjectProperty<>(); + + private final StringProperty selectedCountry = new SimpleStringProperty(NOTHING_SELECTED_MARKER); + private final StringProperty selectedSubdivision = new SimpleStringProperty(NOTHING_SELECTED_MARKER); + + private final ReadOnlyBooleanWrapper loadingInProgress = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper countryInputDisabled = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper subdivisionInputDisabled = new ReadOnlyBooleanWrapper(); + + @Inject + CountrySelector countrySelector; + + @Inject + ResourceBundle resourceBundle; + + @InjectScope + ContactDialogScope dialogScope; + + // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. + private ItemList<Country> countryItemList; + // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. + private ItemList<Subdivision> subdivisionItemList; + private Address address; + + private ObjectBinding<Contact> contactBinding; + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); + + ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + + if (contactToEditProperty.get() != null) { + initWithAddress(contactToEditProperty.get().getAddress()); + } + + contactToEditProperty.addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + if (newValue.getAddress() == null) { + System.out.println("Address is null"); + } else { + initWithAddress(newValue.getAddress()); + } + } + }); + + loadingInProgress.bind(countrySelector.inProgressProperty()); + countrySelector.init(); + + initSubdivisionLabel(); + initCountryList(); + initSubdivisionList(); + + selectedCountry.addListener((obs, oldV, newV) -> { + if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { + Optional<Country> matchingCountry = countrySelector.availableCountries().stream() + .filter(country -> newV.equals(country.getName())) + .findFirst(); + + if (matchingCountry.isPresent()) { + countrySelector.setCountry(matchingCountry.get()); + country.set(matchingCountry.get()); + } + } else if (NOTHING_SELECTED_MARKER.equals(newV)) { + countrySelector.setCountry(null); + country.set(null); + } + selectedSubdivision.set(NOTHING_SELECTED_MARKER); + }); + + selectedSubdivision.addListener((obs, oldV, newV) -> { + if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { + Optional<Subdivision> subdivisionOptional = countrySelector.subdivisions().stream() + .filter(subdivision -> subdivision.getName().equals(newV)).findFirst(); + + if (subdivisionOptional.isPresent()) { + subdivision.set(subdivisionOptional.get()); + } else { + subdivision.set(null); + } + } else { + subdivision.set(null); + } + }); + + countryInputDisabled.bind(loadingInProgress); + subdivisionInputDisabled.bind(loadingInProgress.or(Bindings.size(subdivisionsList()).lessThanOrEqualTo(1))); + + dialogScope.addressFormValidProperty().bind(valid); + } + + void initSubdivisionLabel() { + subdivisionLabel.bind( + Bindings.when( + countrySelector.subdivisionLabel().isEmpty()) + .then(resourceBundle.getString(SUBDIVISION_LABEL_KEY)) + .otherwise(countrySelector.subdivisionLabel())); + } + + private void initSubdivisionList() { + subdivisionItemList = new ItemList<>(countrySelector.subdivisions(), Subdivision::getName); + subdivisions = createListWithNothingSelectedMarker(subdivisionItemList.getTargetList()); + subdivisions.addListener((ListChangeListener<String>) c -> selectedSubdivision.set(NOTHING_SELECTED_MARKER)); + } + + private void initCountryList() { + countryItemList = new ItemList<>(countrySelector.availableCountries(), Country::getName); + ObservableList<String> mappedList = countryItemList.getTargetList(); + + countries = createListWithNothingSelectedMarker(mappedList); + countries.addListener((ListChangeListener<String>) c -> selectedCountry.set(NOTHING_SELECTED_MARKER)); + } + + private void commitChanges() { + address.setStreet(street.get()); + address.setCity(city.get()); + address.setPostalcode(postalCode.get()); + address.setCountry(country.get()); + address.setSubdivision(subdivision.get()); + } + + public void initWithAddress(Address address) { + this.address = address; + street.set(address.getStreet()); + city.set(address.getCity()); + postalCode.set(address.getPostalcode()); + + if (address.getCountry() != null) { + selectedCountry.set(address.getCountry().getName()); + } + if (address.getSubdivision() != null) { + selectedSubdivision.set(address.getSubdivision().getName()); + } + } + + /** + * Creates an observable list that always has + * {@link #NOTHING_SELECTED_MARKER} as first element and the values of the + * given observable list. + */ + static ObservableList<String> createListWithNothingSelectedMarker(ObservableList<String> source) { + final ObservableList<String> result = FXCollections.observableArrayList(); + result.add(NOTHING_SELECTED_MARKER); + result.addAll(source); + + // for sure there are better solutions for this but it's sufficient for our demo + source.addListener((ListChangeListener<String>) c -> { + result.clear(); + result.add(NOTHING_SELECTED_MARKER); + result.addAll(source); + }); + return result; + } + + public ObservableList<String> countriesList() { + return countries; + } + + public ObservableList<String> subdivisionsList() { + return subdivisions; + } + + public StringProperty streetProperty() { + return street; + } + + public StringProperty cityProperty() { + return city; + } + + public StringProperty postalCodeProperty() { + return postalCode; + } + + public StringProperty selectedCountryProperty() { + return selectedCountry; + } + + public StringProperty selectedSubdivisionProperty() { + return selectedSubdivision; + } + + public ReadOnlyStringProperty subdivisionLabel() { + return subdivisionLabel.getReadOnlyProperty(); + } + + public ReadOnlyBooleanProperty loadingInProgressProperty() { + return loadingInProgress.getReadOnlyProperty(); + } + + public ReadOnlyBooleanProperty countryInputDisabledProperty() { + return countryInputDisabled.getReadOnlyProperty(); + } + + public ReadOnlyBooleanProperty subdivisionInputDisabledProperty() { + return subdivisionInputDisabled.getReadOnlyProperty(); + } + + private void resetForm() { + street.set(""); + city.set(""); + postalCode.set(""); + selectedCountry.set(NOTHING_SELECTED_MARKER); + selectedSubdivision.set(NOTHING_SELECTED_MARKER); + subdivision.set(null); + country.set(null); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java index 968e6d5ff..6ce343e7c 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java @@ -17,79 +17,80 @@ import javafx.scene.text.Text; public class ContactDialogView implements FxmlView<ContactDialogViewModel> { - - @FXML - private Button okButton; - - @FXML - private Button previousButton; - - @FXML - private Button nextButton; - - @FXML - private Text titleText; - - @FXML - private Pagination formPagination; - - @InjectViewModel - private ContactDialogViewModel viewModel; - - public void initialize() { - ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader - .fxmlView(ContactFormView.class).load(); - - ViewTuple<AddressFormView, AddressFormViewModel> addressFormTuple = FluentViewLoader - .fxmlView(AddressFormView.class).load(); - - formPagination.getStyleClass().add("invisible-pagination-control"); - - formPagination.setPageFactory(index -> { - if (index == 0) { - return contactFormTuple.getView(); - } else { - return addressFormTuple.getView(); - } - }); - - formPagination.currentPageIndexProperty().bindBidirectional(viewModel.dialogPageProperty()); - - AwesomeDude.setIcon(okButton, AwesomeIcon.CHECK); - AwesomeDude.setIcon(nextButton, AwesomeIcon.CHEVRON_RIGHT, ContentDisplay.RIGHT); - AwesomeDude.setIcon(previousButton, AwesomeIcon.CHEVRON_LEFT); - - okButton.disableProperty().bind(viewModel.okButtonDisabledProperty()); - okButton.visibleProperty().bind(viewModel.okButtonVisibleProperty()); - okButton.managedProperty().bind(viewModel.okButtonVisibleProperty()); - - nextButton.disableProperty().bind(viewModel.nextButtonDisabledProperty()); - nextButton.visibleProperty().bind(viewModel.nextButtonVisibleProperty()); - nextButton.managedProperty().bind(viewModel.nextButtonVisibleProperty()); - - previousButton.disableProperty().bind(viewModel.previousButtonDisabledProperty()); - previousButton.visibleProperty().bind(viewModel.previousButtonVisibleProperty()); - previousButton.managedProperty().bind(viewModel.previousButtonVisibleProperty()); - - titleText.textProperty().bind(viewModel.titleTextProperty()); - } - - @FXML - private void previous() { - viewModel.previousAction(); - } - - @FXML - private void next() { - viewModel.nextAction(); - } - - @FXML - private void ok() { - viewModel.okAction(); - } - - public ContactDialogViewModel getViewModel() { - return viewModel; - } + + @FXML + private Button okButton; + + @FXML + private Button previousButton; + + @FXML + private Button nextButton; + + @FXML + private Text titleText; + + @FXML + private Pagination formPagination; + + @InjectViewModel + private ContactDialogViewModel viewModel; + + public void initialize() { + ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader + .fxmlView(ContactFormView.class).load(); + + ViewTuple<AddressFormView, AddressFormViewModel> addressFormTuple = FluentViewLoader + .fxmlView(AddressFormView.class).load(); + + formPagination.getStyleClass().add("invisible-pagination-control"); + + formPagination.setPageFactory(index -> { + if (index == 0) { + return contactFormTuple.getView(); + } else { + return addressFormTuple.getView(); + } + }); + + formPagination.currentPageIndexProperty().bindBidirectional(viewModel.dialogPageProperty()); + + AwesomeDude.setIcon(okButton, AwesomeIcon.CHECK); + AwesomeDude.setIcon(nextButton, AwesomeIcon.CHEVRON_RIGHT, ContentDisplay.RIGHT); + AwesomeDude.setIcon(previousButton, AwesomeIcon.CHEVRON_LEFT); + + okButton.disableProperty().bind(viewModel.okButtonDisabledProperty()); + okButton.visibleProperty().bind(viewModel.okButtonVisibleProperty()); + okButton.managedProperty().bind(viewModel.okButtonVisibleProperty()); + + nextButton.disableProperty().bind(viewModel.nextButtonDisabledProperty()); + nextButton.visibleProperty().bind(viewModel.nextButtonVisibleProperty()); + nextButton.managedProperty().bind(viewModel.nextButtonVisibleProperty()); + + previousButton.disableProperty().bind(viewModel.previousButtonDisabledProperty()); + previousButton.visibleProperty().bind(viewModel.previousButtonVisibleProperty()); + previousButton.managedProperty().bind(viewModel.previousButtonVisibleProperty()); + + titleText.textProperty().bind(viewModel.titleTextProperty()); + } + + @FXML + private void previous() { + viewModel.previousAction(); + } + + @FXML + private void next() { + viewModel.nextAction(); + } + + @FXML + private void ok() { + viewModel.okAction(); + } + + public ContactDialogViewModel getViewModel() { + return viewModel; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 14118ce51..1009ca36d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -13,77 +13,77 @@ import javafx.beans.value.ObservableBooleanValue; public class ContactDialogViewModel implements ViewModel { - - @InjectScope - ContactDialogScope dialogScope; - - private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); - private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); - private final StringProperty titleText = new SimpleStringProperty(); - - public void initialize() { - valid.bind( - Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); - dialogScope.bothFormsValidProperty().bind(valid); - dialogScope.subscribe(ContactDialogScope.RESET_DIALOG_PAGE, - (key, payload) -> resetDialogPage()); - titleText.bind(dialogScope.dialogTitleProperty()); - } - - public void okAction() { - dialogScope.publish(ContactDialogScope.OK_BEFORE_COMMIT); - } - - public void previousAction() { - if (dialogPage.get() == 1) { - dialogPage.set(0); - } - } - - public void nextAction() { - if (dialogPage.get() == 0) { - dialogPage.set(1); - } - } - - private void resetDialogPage() { - dialogPage.set(0); - } - - public IntegerProperty dialogPageProperty() { - return dialogPage; - } - - - public ObservableBooleanValue okButtonDisabledProperty() { - return valid.not(); - } - - public ObservableBooleanValue okButtonVisibleProperty() { - return dialogPage.isEqualTo(1); - } - - public ObservableBooleanValue nextButtonDisabledProperty() { - return dialogScope.contactFormValidProperty().not(); - } - - public ObservableBooleanValue nextButtonVisibleProperty() { - return dialogPage.isEqualTo(0); - } - - public ObservableBooleanValue previousButtonVisibleProperty() { - return dialogPage.isEqualTo(1); - } - - public ObservableBooleanValue previousButtonDisabledProperty() { - return dialogScope.addressFormValidProperty().not(); - } - - public ReadOnlyBooleanProperty validProperty() { - return valid; - } - - public StringProperty titleTextProperty() { - return titleText; - } + + @InjectScope + ContactDialogScope dialogScope; + + private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); + private final StringProperty titleText = new SimpleStringProperty(); + + public void initialize() { + valid.bind( + Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); + dialogScope.bothFormsValidProperty().bind(valid); + dialogScope.subscribe(ContactDialogScope.RESET_DIALOG_PAGE, + (key, payload) -> resetDialogPage()); + titleText.bind(dialogScope.dialogTitleProperty()); + } + + public void okAction() { + dialogScope.publish(ContactDialogScope.OK_BEFORE_COMMIT); + } + + public void previousAction() { + if (dialogPage.get() == 1) { + dialogPage.set(0); + } + } + + public void nextAction() { + if (dialogPage.get() == 0) { + dialogPage.set(1); + } + } + + private void resetDialogPage() { + dialogPage.set(0); + } + + public IntegerProperty dialogPageProperty() { + return dialogPage; + } + + public ObservableBooleanValue okButtonDisabledProperty() { + return valid.not(); + } + + public ObservableBooleanValue okButtonVisibleProperty() { + return dialogPage.isEqualTo(1); + } + + public ObservableBooleanValue nextButtonDisabledProperty() { + return dialogScope.contactFormValidProperty().not(); + } + + public ObservableBooleanValue nextButtonVisibleProperty() { + return dialogPage.isEqualTo(0); + } + + public ObservableBooleanValue previousButtonVisibleProperty() { + return dialogPage.isEqualTo(1); + } + + public ObservableBooleanValue previousButtonDisabledProperty() { + return dialogScope.addressFormValidProperty().not(); + } + + public ReadOnlyBooleanProperty validProperty() { + return valid; + } + + public StringProperty titleTextProperty() { + return titleText; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java index bac28f484..9b2e33459 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java @@ -9,52 +9,52 @@ import javafx.scene.control.TextField; public class ContactFormView implements FxmlView<ContactFormViewModel> { - - @FXML - public TextField firstnameInput; - @FXML - public TextField titleInput; - @FXML - public TextField lastnameInput; - @FXML - public TextField roleInput; - @FXML - public TextField departmentInput; - @FXML - public TextField mobileNumberInput; - @FXML - public TextField emailInput; - @FXML - public TextField phoneNumberInput; - @FXML - public DatePicker birthdayInput; - - private ValidationVisualizer validationVisualizer = new ControlsFxVisualizer(); - - @InjectViewModel - private ContactFormViewModel viewModel; - - public void initialize() { - firstnameInput.textProperty().bindBidirectional(viewModel.firstnameProperty()); - lastnameInput.textProperty().bindBidirectional(viewModel.lastnameProperty()); - titleInput.textProperty().bindBidirectional(viewModel.titleProperty()); - roleInput.textProperty().bindBidirectional(viewModel.roleProperty()); - departmentInput.textProperty().bindBidirectional(viewModel.departmentProperty()); - mobileNumberInput.textProperty().bindBidirectional(viewModel.mobileNumberProperty()); - phoneNumberInput.textProperty().bindBidirectional(viewModel.phoneNumberProperty()); - emailInput.textProperty().bindBidirectional(viewModel.emailProperty()); - birthdayInput.valueProperty().bindBidirectional(viewModel.birthdayProperty()); - - validationVisualizer.initVisualization(viewModel.firstnameValidation(), firstnameInput, true); - validationVisualizer.initVisualization(viewModel.lastnameValidation(), lastnameInput, true); - validationVisualizer.initVisualization(viewModel.birthdayValidation(), birthdayInput); - validationVisualizer.initVisualization(viewModel.emailValidation(), emailInput, true); - validationVisualizer.initVisualization(viewModel.phoneValidation(), phoneNumberInput); - validationVisualizer.initVisualization(viewModel.mobileValidation(), mobileNumberInput); - } - - public ContactFormViewModel getViewModel() { - return viewModel; - } - + + @FXML + public TextField firstnameInput; + @FXML + public TextField titleInput; + @FXML + public TextField lastnameInput; + @FXML + public TextField roleInput; + @FXML + public TextField departmentInput; + @FXML + public TextField mobileNumberInput; + @FXML + public TextField emailInput; + @FXML + public TextField phoneNumberInput; + @FXML + public DatePicker birthdayInput; + + private ValidationVisualizer validationVisualizer = new ControlsFxVisualizer(); + + @InjectViewModel + private ContactFormViewModel viewModel; + + public void initialize() { + firstnameInput.textProperty().bindBidirectional(viewModel.firstnameProperty()); + lastnameInput.textProperty().bindBidirectional(viewModel.lastnameProperty()); + titleInput.textProperty().bindBidirectional(viewModel.titleProperty()); + roleInput.textProperty().bindBidirectional(viewModel.roleProperty()); + departmentInput.textProperty().bindBidirectional(viewModel.departmentProperty()); + mobileNumberInput.textProperty().bindBidirectional(viewModel.mobileNumberProperty()); + phoneNumberInput.textProperty().bindBidirectional(viewModel.phoneNumberProperty()); + emailInput.textProperty().bindBidirectional(viewModel.emailProperty()); + birthdayInput.valueProperty().bindBidirectional(viewModel.birthdayProperty()); + + validationVisualizer.initVisualization(viewModel.firstnameValidation(), firstnameInput, true); + validationVisualizer.initVisualization(viewModel.lastnameValidation(), lastnameInput, true); + validationVisualizer.initVisualization(viewModel.birthdayValidation(), birthdayInput); + validationVisualizer.initVisualization(viewModel.emailValidation(), emailInput, true); + validationVisualizer.initVisualization(viewModel.phoneValidation(), phoneNumberInput); + validationVisualizer.initVisualization(viewModel.mobileValidation(), mobileNumberInput); + } + + public ContactFormViewModel getViewModel() { + return viewModel; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index b53d01949..5ac940a88 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -20,142 +20,141 @@ import javafx.beans.property.StringProperty; public class ContactFormViewModel implements ViewModel { - private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); - - private Validator firstnameValidator; - private Validator lastnameValidator; - private final Validator emailValidator = new EmailValidator(emailProperty()); - private final Validator birthdayValidator = new BirthdayValidator(birthdayProperty()); - - private final Validator phoneValidator = new PhoneValidator(phoneNumberProperty(), "The phone number is invalid!"); - private final Validator mobileValidator = new PhoneValidator(mobileNumberProperty(), - "The mobile number is invalid!"); - - private final CompositeValidator formValidator = new CompositeValidator(); - - @InjectScope - ContactDialogScope dialogScope; - - public ContactFormViewModel() { - firstnameValidator = new FunctionBasedValidator<>( - firstnameProperty(), - firstName -> firstName != null && !firstName.trim().isEmpty(), - ValidationMessage.error("Firstname may not be empty")); - - - lastnameValidator = new FunctionBasedValidator<>(lastnameProperty(), lastName -> { - if (lastName == null || lastName.isEmpty()) { - return ValidationMessage.error("Lastname may not be empty"); - } else if (lastName.trim().isEmpty()) { - return ValidationMessage.error("Lastname may not only contain whitespaces"); - } - - return null; - }); - - formValidator.addValidators( - firstnameValidator, - lastnameValidator, - emailValidator, - birthdayValidator, - phoneValidator, - mobileValidator); - } - - public void initialize() { - dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); - - ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); - if (contactToEditProperty.get() != null) { - initWithContact(contactToEditProperty.get()); - } - - contactToEditProperty.addListener((observable, oldValue, newValue) -> { - if (newValue != null) { - initWithContact(newValue); - } - }); - - - dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); - } - - - private void resetForm() { - contactWrapper.reset(); - } - - private void initWithContact(Contact contact) { - this.contactWrapper.set(contact); - this.contactWrapper.reload(); - } - - private void commitChanges() { - if (contactWrapper.get() == null) { - contactWrapper.set(new Contact()); - } - - contactWrapper.commit(); - } - - public ValidationStatus firstnameValidation() { - return firstnameValidator.getValidationStatus(); - } - - public ValidationStatus lastnameValidation() { - return lastnameValidator.getValidationStatus(); - } - - public ValidationStatus birthdayValidation() { - return birthdayValidator.getValidationStatus(); - } - - public ValidationStatus emailValidation() { - return emailValidator.getValidationStatus(); - } - - public ValidationStatus phoneValidation() { - return phoneValidator.getValidationStatus(); - } - - public ValidationStatus mobileValidation() { - return mobileValidator.getValidationStatus(); - } - - public StringProperty firstnameProperty() { - return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); - } - - public StringProperty titleProperty() { - return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); - } - - public StringProperty lastnameProperty() { - return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); - } - - public StringProperty roleProperty() { - return contactWrapper.field("role", Contact::getRole, Contact::setRole); - } - - public StringProperty departmentProperty() { - return contactWrapper.field("department", Contact::getDepartment, Contact::setDepartment); - } - - public Property<LocalDate> birthdayProperty() { - return contactWrapper.field("birthday", Contact::getBirthday, Contact::setBirthday); - } - - public StringProperty emailProperty() { - return contactWrapper.field("email", Contact::getEmailAddress, Contact::setEmailAddress); - } - - public StringProperty mobileNumberProperty() { - return contactWrapper.field("mobileNumber", Contact::getMobileNumber, Contact::setMobileNumber); - } - - public StringProperty phoneNumberProperty() { - return contactWrapper.field("phoneNumber", Contact::getPhoneNumber, Contact::setPhoneNumber); - } + + private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); + + private Validator firstnameValidator; + private Validator lastnameValidator; + private final Validator emailValidator = new EmailValidator(emailProperty()); + private final Validator birthdayValidator = new BirthdayValidator(birthdayProperty()); + + private final Validator phoneValidator = new PhoneValidator(phoneNumberProperty(), "The phone number is invalid!"); + private final Validator mobileValidator = new PhoneValidator(mobileNumberProperty(), + "The mobile number is invalid!"); + + private final CompositeValidator formValidator = new CompositeValidator(); + + @InjectScope + ContactDialogScope dialogScope; + + public ContactFormViewModel() { + firstnameValidator = new FunctionBasedValidator<>( + firstnameProperty(), + firstName -> firstName != null && !firstName.trim().isEmpty(), + ValidationMessage.error("Firstname may not be empty")); + + lastnameValidator = new FunctionBasedValidator<>(lastnameProperty(), lastName -> { + if (lastName == null || lastName.isEmpty()) { + return ValidationMessage.error("Lastname may not be empty"); + } else if (lastName.trim().isEmpty()) { + return ValidationMessage.error("Lastname may not only contain whitespaces"); + } + + return null; + }); + + formValidator.addValidators( + firstnameValidator, + lastnameValidator, + emailValidator, + birthdayValidator, + phoneValidator, + mobileValidator); + } + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); + + ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + if (contactToEditProperty.get() != null) { + initWithContact(contactToEditProperty.get()); + } + + contactToEditProperty.addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + initWithContact(newValue); + } + }); + + dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); + } + + private void resetForm() { + contactWrapper.reset(); + } + + private void initWithContact(Contact contact) { + this.contactWrapper.set(contact); + this.contactWrapper.reload(); + } + + private void commitChanges() { + if (contactWrapper.get() == null) { + contactWrapper.set(new Contact()); + } + + contactWrapper.commit(); + } + + public ValidationStatus firstnameValidation() { + return firstnameValidator.getValidationStatus(); + } + + public ValidationStatus lastnameValidation() { + return lastnameValidator.getValidationStatus(); + } + + public ValidationStatus birthdayValidation() { + return birthdayValidator.getValidationStatus(); + } + + public ValidationStatus emailValidation() { + return emailValidator.getValidationStatus(); + } + + public ValidationStatus phoneValidation() { + return phoneValidator.getValidationStatus(); + } + + public ValidationStatus mobileValidation() { + return mobileValidator.getValidationStatus(); + } + + public StringProperty firstnameProperty() { + return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); + } + + public StringProperty titleProperty() { + return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); + } + + public StringProperty lastnameProperty() { + return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); + } + + public StringProperty roleProperty() { + return contactWrapper.field("role", Contact::getRole, Contact::setRole); + } + + public StringProperty departmentProperty() { + return contactWrapper.field("department", Contact::getDepartment, Contact::setDepartment); + } + + public Property<LocalDate> birthdayProperty() { + return contactWrapper.field("birthday", Contact::getBirthday, Contact::setBirthday); + } + + public StringProperty emailProperty() { + return contactWrapper.field("email", Contact::getEmailAddress, Contact::setEmailAddress); + } + + public StringProperty mobileNumberProperty() { + return contactWrapper.field("mobileNumber", Contact::getMobileNumber, Contact::setMobileNumber); + } + + public StringProperty phoneNumberProperty() { + return contactWrapper.field("phoneNumber", Contact::getPhoneNumber, Contact::setPhoneNumber); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java index 29d507934..041c059ec 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java @@ -21,97 +21,98 @@ import javafx.stage.Stage; public class DetailView implements FxmlView<DetailViewModel> { - @FXML - public Label nameLabel, birthdayLabel, roleDepartmentLabel, phoneLabel, mobileLabel, cityPostalCodeLabel, - streetLabel, countrySubdivisionLabel; - @FXML - public Hyperlink emailHyperlink; - - @FXML - public Button editButton, removeButton; - - @Inject - private Stage primaryStage; - - @InjectViewModel - private DetailViewModel viewModel; - - private Command removeCommand; - private Command editCommand; - private Command mailCommand; - - public void initialize() { - removeCommand = viewModel.getRemoveCommand(); - editCommand = viewModel.getEditCommand(); - mailCommand = viewModel.getEmailLinkCommand(); - - removeButton.disableProperty().bind(removeCommand.notExecutableProperty()); - editButton.disableProperty().bind(editCommand.notExecutableProperty()); - - nameLabel.setText(""); - nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); - - nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); - birthdayLabel.textProperty().bind(viewModel.birthdayLabelTextProperty()); - roleDepartmentLabel.textProperty().bind(viewModel.roleDepartmentLabelTextProperty()); - emailHyperlink.textProperty().bind(viewModel.emailLabelTextProperty()); - phoneLabel.textProperty().bind(viewModel.phoneLabelTextProperty()); - mobileLabel.textProperty().bind(viewModel.mobileLabelTextProperty()); - cityPostalCodeLabel.textProperty().bind(viewModel.cityPostalcodeLabelTextProperty()); - streetLabel.textProperty().bind(viewModel.streetLabelTextProperty()); - countrySubdivisionLabel.textProperty().bind(viewModel.countrySubdivisionLabelTextProperty()); - - initVisibilityBindings(nameLabel); - initVisibilityBindings(birthdayLabel); - initVisibilityBindings(roleDepartmentLabel); - initVisibilityBindings(emailHyperlink); - initVisibilityBindings(phoneLabel); - initVisibilityBindings(mobileLabel); - initVisibilityBindings(cityPostalCodeLabel); - initVisibilityBindings(streetLabel); - initVisibilityBindings(countrySubdivisionLabel); - - initIcons(); - - viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { - ViewTuple<EditContactDialogView, EditContactDialogViewModel> load = FluentViewLoader - .fxmlView(EditContactDialogView.class) - .load(); - Parent view = load.getView(); - Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - load.getCodeBehind().setOwningStage(showDialog); - }); - - - } - - private void initVisibilityBindings(Labeled label) { - label.visibleProperty().bind(editCommand.executableProperty()); - label.managedProperty().bind(label.visibleProperty()); - } - - private void initIcons() { - AwesomeDude.setIcon(birthdayLabel, AwesomeIcon.BIRTHDAY_CAKE); - AwesomeDude.setIcon(roleDepartmentLabel, AwesomeIcon.USERS); - AwesomeDude.setIcon(emailHyperlink, AwesomeIcon.AT); - AwesomeDude.setIcon(mobileLabel, AwesomeIcon.MOBILE_PHONE); - AwesomeDude.setIcon(phoneLabel, AwesomeIcon.PHONE); - AwesomeDude.setIcon(editButton, AwesomeIcon.EDIT); - AwesomeDude.setIcon(removeButton, AwesomeIcon.TRASH_ALT); - } - - @FXML - public void editAction() { - editCommand.execute(); - } - - @FXML - public void removeAction() { - removeCommand.execute(); - } - - @FXML - public void mailAction() { - mailCommand.execute(); - } + + @FXML + public Label nameLabel, birthdayLabel, roleDepartmentLabel, phoneLabel, mobileLabel, cityPostalCodeLabel, + streetLabel, countrySubdivisionLabel; + @FXML + public Hyperlink emailHyperlink; + + @FXML + public Button editButton, removeButton; + + @Inject + private Stage primaryStage; + + @InjectViewModel + private DetailViewModel viewModel; + + private Command removeCommand; + private Command editCommand; + private Command mailCommand; + + public void initialize() { + removeCommand = viewModel.getRemoveCommand(); + editCommand = viewModel.getEditCommand(); + mailCommand = viewModel.getEmailLinkCommand(); + + removeButton.disableProperty().bind(removeCommand.notExecutableProperty()); + editButton.disableProperty().bind(editCommand.notExecutableProperty()); + + nameLabel.setText(""); + nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); + + nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); + birthdayLabel.textProperty().bind(viewModel.birthdayLabelTextProperty()); + roleDepartmentLabel.textProperty().bind(viewModel.roleDepartmentLabelTextProperty()); + emailHyperlink.textProperty().bind(viewModel.emailLabelTextProperty()); + phoneLabel.textProperty().bind(viewModel.phoneLabelTextProperty()); + mobileLabel.textProperty().bind(viewModel.mobileLabelTextProperty()); + cityPostalCodeLabel.textProperty().bind(viewModel.cityPostalcodeLabelTextProperty()); + streetLabel.textProperty().bind(viewModel.streetLabelTextProperty()); + countrySubdivisionLabel.textProperty().bind(viewModel.countrySubdivisionLabelTextProperty()); + + initVisibilityBindings(nameLabel); + initVisibilityBindings(birthdayLabel); + initVisibilityBindings(roleDepartmentLabel); + initVisibilityBindings(emailHyperlink); + initVisibilityBindings(phoneLabel); + initVisibilityBindings(mobileLabel); + initVisibilityBindings(cityPostalCodeLabel); + initVisibilityBindings(streetLabel); + initVisibilityBindings(countrySubdivisionLabel); + + initIcons(); + + viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { + ViewTuple<EditContactDialogView, EditContactDialogViewModel> load = FluentViewLoader + .fxmlView(EditContactDialogView.class) + .load(); + Parent view = load.getView(); + Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + load.getCodeBehind().setOwningStage(showDialog); + }); + + } + + private void initVisibilityBindings(Labeled label) { + label.visibleProperty().bind(editCommand.executableProperty()); + label.managedProperty().bind(label.visibleProperty()); + } + + private void initIcons() { + AwesomeDude.setIcon(birthdayLabel, AwesomeIcon.BIRTHDAY_CAKE); + AwesomeDude.setIcon(roleDepartmentLabel, AwesomeIcon.USERS); + AwesomeDude.setIcon(emailHyperlink, AwesomeIcon.AT); + AwesomeDude.setIcon(mobileLabel, AwesomeIcon.MOBILE_PHONE); + AwesomeDude.setIcon(phoneLabel, AwesomeIcon.PHONE); + AwesomeDude.setIcon(editButton, AwesomeIcon.EDIT); + AwesomeDude.setIcon(removeButton, AwesomeIcon.TRASH_ALT); + } + + @FXML + public void editAction() { + editCommand.execute(); + } + + @FXML + public void removeAction() { + removeCommand.execute(); + } + + @FXML + public void mailAction() { + mailCommand.execute(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index 27f693386..ee47eab0c 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -27,239 +27,239 @@ import javafx.beans.property.ReadOnlyStringWrapper; public class DetailViewModel implements ViewModel { - - public static final String OPEN_EDIT_CONTACT_DIALOG = "open_edit_contact"; - - private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ISO_DATE; - - private final ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); - - private final ReadOnlyStringWrapper birthday = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper roleDepartment = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper email = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper phone = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper mobile = new ReadOnlyStringWrapper(); - - private final ReadOnlyStringWrapper cityPostalcode = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper street = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper countrySubdivision = new ReadOnlyStringWrapper(); - - - private DelegateCommand editCommand; - private DelegateCommand removeCommand; - private DelegateCommand emailLinkCommand; - - @Inject - HostServices hostServices; - - @Inject - Repository repository; - - @InjectScope - MasterDetailScope mdScope; - - @InjectScope - ContactDialogScope dialogscope; - - public void initialize() { - ReadOnlyObjectProperty<Contact> contactProperty = getSelectedContactPropertyFromScope(); - - createBindingsForLabels(contactProperty); - - editCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - Contact selectedContact = getSelectedContactFromScope(); - if (selectedContact != null) { - dialogscope.setContactToEdit(selectedContact); - publish(OPEN_EDIT_CONTACT_DIALOG); - } - } - }, getSelectedContactPropertyFromScope().isNotNull()); - - removeCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - Contact selectedContact = getSelectedContactFromScope(); - if (selectedContact != null) { - repository.delete(getSelectedContactFromScope()); - } - } - - }, getSelectedContactPropertyFromScope().isNotNull()); - - emailLinkCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - if (email.get() != null && !email.get().trim().isEmpty()) { - hostServices.showDocument("mailto:" + email.get()); - } - } - }); - } - - private void createBindingsForLabels(ReadOnlyObjectProperty<Contact> contactProperty) { - name.bind(emptyStringOnNull(map(contactProperty, contact -> { - StringBuilder result = new StringBuilder(); - - String title = contact.getTitle(); - if (title != null && !title.trim().isEmpty()) { - result.append(title); - result.append(" "); - } - - result.append(contact.getFirstname()); - result.append(" "); - result.append(contact.getLastname()); - - return result.toString(); - }))); - - - email.bind(emptyStringOnNull(map(contactProperty, Contact::getEmailAddress))); - - roleDepartment.bind(emptyStringOnNull(map(contactProperty, contact -> { - StringBuilder result = new StringBuilder(); - if (contact.getRole() != null && !contact.getRole().trim().isEmpty()) { - result.append(contact.getRole()); - - if (contact.getDepartment() != null && !contact.getDepartment().trim().isEmpty()) { - result.append(" / "); - result.append(contact.getDepartment()); - } - } else if (contact.getDepartment() != null) { - result.append(contact.getDepartment()); - } - - return result.toString(); - }))); - - birthday.bind(emptyStringOnNull(map(contactProperty, contact -> { - LocalDate date = contact.getBirthday(); - if (date == null) { - return ""; - } else { - return BIRTHDAY_FORMATTER.format(date); - } - }))); - - phone.bind(emptyStringOnNull(map(contactProperty, Contact::getPhoneNumber))); - - mobile.bind(emptyStringOnNull(map(contactProperty, Contact::getMobileNumber))); - - ObjectBinding<Address> addressBinding = map(contactProperty, Contact::getAddress); - - cityPostalcode.bind(emptyStringOnNull(map(addressBinding, address -> { - StringBuilder result = new StringBuilder(); - if (address.getCity() != null) { - result.append(address.getCity()); - } - - if (address.getPostalcode() != null) { - result.append(" ("); - result.append(address.getPostalcode()); - result.append(")"); - } - return result.toString(); - }))); - - street.bind(emptyStringOnNull(map(addressBinding, Address::getStreet))); - - countrySubdivision.bind(emptyStringOnNull(map(addressBinding, address -> { - StringBuilder result = new StringBuilder(); - if (address.getCountry() != null) { - result.append(address.getCountry().getName()); - } - - if (address.getSubdivision() != null) { - result.append(" / "); - result.append(address.getSubdivision().getName()); - } - return result.toString(); - }))); - } - - /** - * When the given source binding has a value of <code>null</code> an empty string is used for the returned binding. - * Otherwise the value of the source binding is used. - */ - private StringBinding emptyStringOnNull(ObjectBinding<String> source) { - return Bindings.createStringBinding(() -> { - if (source.get() == null) { - return ""; - } else { - return source.get(); - } - } , source); - } - - public Command getEditCommand() { - return editCommand; - } - - public Command getRemoveCommand() { - return removeCommand; - } - - public Command getEmailLinkCommand() { - return emailLinkCommand; - } - - public ReadOnlyStringProperty nameLabelTextProperty() { - return name.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty birthdayLabelTextProperty() { - return birthday.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty roleDepartmentLabelTextProperty() { - return roleDepartment.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty emailLabelTextProperty() { - return email.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty phoneLabelTextProperty() { - return phone.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty mobileLabelTextProperty() { - return mobile.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty cityPostalcodeLabelTextProperty() { - return cityPostalcode.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty streetLabelTextProperty() { - return street.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty countrySubdivisionLabelTextProperty() { - return countrySubdivision.getReadOnlyProperty(); - } - - private String trimString(String string) { - if (string == null || string.trim().isEmpty()) { - return ""; - } - return string; - } - - private String trimStringWithPostfix(String string, String append) { - if (string == null || string.trim().isEmpty()) { - return ""; - } - return string + append; - } - - private Contact getSelectedContactFromScope() { - return getSelectedContactPropertyFromScope().get(); - } - - private ObjectProperty<Contact> getSelectedContactPropertyFromScope() { - return mdScope.selectedContactProperty(); - } + + public static final String OPEN_EDIT_CONTACT_DIALOG = "open_edit_contact"; + + private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ISO_DATE; + + private final ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); + + private final ReadOnlyStringWrapper birthday = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper roleDepartment = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper email = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper phone = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper mobile = new ReadOnlyStringWrapper(); + + private final ReadOnlyStringWrapper cityPostalcode = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper street = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper countrySubdivision = new ReadOnlyStringWrapper(); + + private DelegateCommand editCommand; + private DelegateCommand removeCommand; + private DelegateCommand emailLinkCommand; + + @Inject + HostServices hostServices; + + @Inject + Repository repository; + + @InjectScope + MasterDetailScope mdScope; + + @InjectScope + ContactDialogScope dialogscope; + + public void initialize() { + ReadOnlyObjectProperty<Contact> contactProperty = getSelectedContactPropertyFromScope(); + + createBindingsForLabels(contactProperty); + + editCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + Contact selectedContact = getSelectedContactFromScope(); + if (selectedContact != null) { + dialogscope.setContactToEdit(selectedContact); + publish(OPEN_EDIT_CONTACT_DIALOG); + } + } + }, getSelectedContactPropertyFromScope().isNotNull()); + + removeCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + Contact selectedContact = getSelectedContactFromScope(); + if (selectedContact != null) { + repository.delete(getSelectedContactFromScope()); + } + } + + }, getSelectedContactPropertyFromScope().isNotNull()); + + emailLinkCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + if (email.get() != null && !email.get().trim().isEmpty()) { + hostServices.showDocument("mailto:" + email.get()); + } + } + }); + } + + private void createBindingsForLabels(ReadOnlyObjectProperty<Contact> contactProperty) { + name.bind(emptyStringOnNull(map(contactProperty, contact -> { + StringBuilder result = new StringBuilder(); + + String title = contact.getTitle(); + if (title != null && !title.trim().isEmpty()) { + result.append(title); + result.append(" "); + } + + result.append(contact.getFirstname()); + result.append(" "); + result.append(contact.getLastname()); + + return result.toString(); + }))); + + email.bind(emptyStringOnNull(map(contactProperty, Contact::getEmailAddress))); + + roleDepartment.bind(emptyStringOnNull(map(contactProperty, contact -> { + StringBuilder result = new StringBuilder(); + if (contact.getRole() != null && !contact.getRole().trim().isEmpty()) { + result.append(contact.getRole()); + + if (contact.getDepartment() != null && !contact.getDepartment().trim().isEmpty()) { + result.append(" / "); + result.append(contact.getDepartment()); + } + } else if (contact.getDepartment() != null) { + result.append(contact.getDepartment()); + } + + return result.toString(); + }))); + + birthday.bind(emptyStringOnNull(map(contactProperty, contact -> { + LocalDate date = contact.getBirthday(); + if (date == null) { + return ""; + } else { + return BIRTHDAY_FORMATTER.format(date); + } + }))); + + phone.bind(emptyStringOnNull(map(contactProperty, Contact::getPhoneNumber))); + + mobile.bind(emptyStringOnNull(map(contactProperty, Contact::getMobileNumber))); + + ObjectBinding<Address> addressBinding = map(contactProperty, Contact::getAddress); + + cityPostalcode.bind(emptyStringOnNull(map(addressBinding, address -> { + StringBuilder result = new StringBuilder(); + if (address.getCity() != null) { + result.append(address.getCity()); + } + + if (address.getPostalcode() != null) { + result.append(" ("); + result.append(address.getPostalcode()); + result.append(")"); + } + return result.toString(); + }))); + + street.bind(emptyStringOnNull(map(addressBinding, Address::getStreet))); + + countrySubdivision.bind(emptyStringOnNull(map(addressBinding, address -> { + StringBuilder result = new StringBuilder(); + if (address.getCountry() != null) { + result.append(address.getCountry().getName()); + } + + if (address.getSubdivision() != null) { + result.append(" / "); + result.append(address.getSubdivision().getName()); + } + return result.toString(); + }))); + } + + /** + * When the given source binding has a value of <code>null</code> an empty + * string is used for the returned binding. Otherwise the value of the + * source binding is used. + */ + private StringBinding emptyStringOnNull(ObjectBinding<String> source) { + return Bindings.createStringBinding(() -> { + if (source.get() == null) { + return ""; + } else { + return source.get(); + } + }, source); + } + + public Command getEditCommand() { + return editCommand; + } + + public Command getRemoveCommand() { + return removeCommand; + } + + public Command getEmailLinkCommand() { + return emailLinkCommand; + } + + public ReadOnlyStringProperty nameLabelTextProperty() { + return name.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty birthdayLabelTextProperty() { + return birthday.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty roleDepartmentLabelTextProperty() { + return roleDepartment.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty emailLabelTextProperty() { + return email.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty phoneLabelTextProperty() { + return phone.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty mobileLabelTextProperty() { + return mobile.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty cityPostalcodeLabelTextProperty() { + return cityPostalcode.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty streetLabelTextProperty() { + return street.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty countrySubdivisionLabelTextProperty() { + return countrySubdivision.getReadOnlyProperty(); + } + + private String trimString(String string) { + if (string == null || string.trim().isEmpty()) { + return ""; + } + return string; + } + + private String trimStringWithPostfix(String string, String append) { + if (string == null || string.trim().isEmpty()) { + return ""; + } + return string + append; + } + + private Contact getSelectedContactFromScope() { + return getSelectedContactPropertyFromScope().get(); + } + + private ObjectProperty<Contact> getSelectedContactPropertyFromScope() { + return mdScope.selectedContactProperty(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java index 35f4ba4ba..5d6dbdf7b 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java @@ -10,22 +10,23 @@ @Singleton public class EditContactDialogView implements FxmlView<EditContactDialogViewModel> { - - @FXML - private ContactDialogView contactDialogViewController; - - @InjectViewModel - private EditContactDialogViewModel viewModel; - - private Stage showDialog; - - public void initialize() { - viewModel.subscribe(EditContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { - showDialog.close(); - }); - } - - public void setOwningStage(Stage showDialog) { - this.showDialog = showDialog; - } + + @FXML + private ContactDialogView contactDialogViewController; + + @InjectViewModel + private EditContactDialogViewModel viewModel; + + private Stage showDialog; + + public void initialize() { + viewModel.subscribe(EditContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + showDialog.close(); + }); + } + + public void setOwningStage(Stage showDialog) { + this.showDialog = showDialog; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index 974bbb8bc..da65c4458 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -10,34 +10,35 @@ import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; public class EditContactDialogViewModel implements ViewModel { - - static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; - public static final String CLOSE_DIALOG_NOTIFICATION = "CLOSE_DIALOG_NOT"; - - @Inject - Repository repository; - - @InjectScope - ContactDialogScope dialogScope; - - @Inject - ResourceBundle defaultResourceBundle; - - public void initialize() { - dialogScope.publish(ContactDialogScope.RESET_FORMS); - dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); - dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { - applyAction(); - }); - - dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - } - - public void applyAction() { - if (dialogScope.bothFormsValidProperty().get()) { - dialogScope.publish(ContactDialogScope.COMMIT); - repository.save(dialogScope.contactToEditProperty().get()); - publish(CLOSE_DIALOG_NOTIFICATION); - } - } + + static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; + public static final String CLOSE_DIALOG_NOTIFICATION = "CLOSE_DIALOG_NOT"; + + @Inject + Repository repository; + + @InjectScope + ContactDialogScope dialogScope; + + @Inject + ResourceBundle defaultResourceBundle; + + public void initialize() { + dialogScope.publish(ContactDialogScope.RESET_FORMS); + dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); + dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { + applyAction(); + }); + + dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); + } + + public void applyAction() { + if (dialogScope.bothFormsValidProperty().get()) { + dialogScope.publish(ContactDialogScope.COMMIT); + repository.save(dialogScope.contactToEditProperty().get()); + publish(CLOSE_DIALOG_NOTIFICATION); + } + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java index 69ef7e5dc..298b8c351 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java @@ -3,4 +3,5 @@ import de.saxsys.mvvmfx.FxmlView; public class MainView implements FxmlView<MainViewModel> { + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java index 39ea3611a..042970de1 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java @@ -3,4 +3,5 @@ import de.saxsys.mvvmfx.ViewModel; public class MainViewModel implements ViewModel { + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java index d016e234d..ff0f7204f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java @@ -12,89 +12,86 @@ import javafx.beans.property.StringProperty; public class MasterTableViewModel { - - private final String id; - private final IntegerProperty age = new SimpleIntegerProperty(); - private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); - - public MasterTableViewModel(Contact contact) { - id = contact.getId(); - contactWrapper.set(contact); - contactWrapper.reload(); - - if (contact.getBirthday() != null) { - age.set((int) ChronoUnit.YEARS.between(contact.getBirthday(), LocalDate.now(CentralClock.getClock()))); - } - } - - @Override - public boolean equals(Object obj) { - - if (obj == null) { - return false; - } - - if (obj == this) { - return true; - } - - if (!(obj instanceof MasterTableViewModel)) { - return false; - } - - MasterTableViewModel other = (MasterTableViewModel) obj; - - return other.getId().equals(this.getId()); - } - - @Override - public int hashCode() { - return this.getId().hashCode(); - } - - public String getId() { - return id; - } - - public StringProperty firstnameProperty() { - return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); - } - - - public StringProperty lastnameProperty() { - return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); - } - - - public StringProperty titleProperty() { - return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); - } - - public StringProperty emailAddressProperty() { - return contactWrapper.field("emailAddress", Contact::getEmailAddress, Contact::setEmailAddress); - } - - public IntegerProperty ageProperty() { - return age; - } - - public StringProperty cityProperty() { - return contactWrapper.field("city", - (StringGetter<Contact>) model -> model.getAddress().getCity(), - (model, value) -> model.getAddress().setCity(value)); - } - - - public StringProperty streetProperty() { - return contactWrapper.field("street", - (StringGetter<Contact>) model -> model.getAddress().getStreet(), - (model, value) -> model.getAddress().setStreet(value)); - } - - - public StringProperty postalCodeProperty() { - return contactWrapper.field("postalcode", - (StringGetter<Contact>) model -> model.getAddress().getPostalcode(), - (model, value) -> model.getAddress().setPostalcode(value)); - } + + private final String id; + private final IntegerProperty age = new SimpleIntegerProperty(); + private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); + + public MasterTableViewModel(Contact contact) { + id = contact.getId(); + contactWrapper.set(contact); + contactWrapper.reload(); + + if (contact.getBirthday() != null) { + age.set((int) ChronoUnit.YEARS.between(contact.getBirthday(), LocalDate.now(CentralClock.getClock()))); + } + } + + @Override + public boolean equals(Object obj) { + + if (obj == null) { + return false; + } + + if (obj == this) { + return true; + } + + if (!(obj instanceof MasterTableViewModel)) { + return false; + } + + MasterTableViewModel other = (MasterTableViewModel) obj; + + return other.getId().equals(this.getId()); + } + + @Override + public int hashCode() { + return this.getId().hashCode(); + } + + public String getId() { + return id; + } + + public StringProperty firstnameProperty() { + return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); + } + + public StringProperty lastnameProperty() { + return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); + } + + public StringProperty titleProperty() { + return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); + } + + public StringProperty emailAddressProperty() { + return contactWrapper.field("emailAddress", Contact::getEmailAddress, Contact::setEmailAddress); + } + + public IntegerProperty ageProperty() { + return age; + } + + public StringProperty cityProperty() { + return contactWrapper.field("city", + (StringGetter<Contact>) model -> model.getAddress().getCity(), + (model, value) -> model.getAddress().setCity(value)); + } + + public StringProperty streetProperty() { + return contactWrapper.field("street", + (StringGetter<Contact>) model -> model.getAddress().getStreet(), + (model, value) -> model.getAddress().setStreet(value)); + } + + public StringProperty postalCodeProperty() { + return contactWrapper.field("postalcode", + (StringGetter<Contact>) model -> model.getAddress().getPostalcode(), + (model, value) -> model.getAddress().setPostalcode(value)); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java index 124bb15e9..ec5a6eb04 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java @@ -5,22 +5,21 @@ import javafx.fxml.FXML; import javafx.scene.control.TableView; - public class MasterView implements FxmlView<MasterViewModel> { - - @FXML - private TableView<MasterTableViewModel> contactTable; - - @InjectViewModel - private MasterViewModel viewModel; - - public void initialize() { - contactTable.setItems(viewModel.getContactList()); - - viewModel.selectedTableRowProperty().bind(contactTable.getSelectionModel().selectedItemProperty()); - - // When the selectedTableRowProperty changes in the viewModel we need to update the table - viewModel.setOnSelect(vm -> contactTable.getSelectionModel().select(vm)); - } - + + @FXML + private TableView<MasterTableViewModel> contactTable; + + @InjectViewModel + private MasterViewModel viewModel; + + public void initialize() { + contactTable.setItems(viewModel.getContactList()); + + viewModel.selectedTableRowProperty().bind(contactTable.getSelectionModel().selectedItemProperty()); + + // When the selectedTableRowProperty changes in the viewModel we need to update the table + viewModel.setOnSelect(vm -> contactTable.getSelectionModel().select(vm)); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java index 1ccf27a29..0a76750f0 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java @@ -24,81 +24,74 @@ import javafx.collections.ObservableList; public class MasterViewModel implements ViewModel { - - private static final Logger LOG = LoggerFactory.getLogger(MasterViewModel.class); - - private final ObservableList<MasterTableViewModel> contacts = FXCollections.observableArrayList(); - - private final ReadOnlyObjectWrapper<Contact> selectedContact = new ReadOnlyObjectWrapper<>(); - - private final ObjectProperty<MasterTableViewModel> selectedTableRow = new SimpleObjectProperty<>(); - - private Optional<Consumer<MasterTableViewModel>> onSelect = Optional.empty(); - - @Inject - Repository repository; - - @InjectScope - MasterDetailScope mdScope; - - - public void initialize() { - updateContactList(); - - mdScope.selectedContactProperty().bind(selectedContact); - - selectedContact.bind(Bindings.createObjectBinding(() -> { - if (selectedTableRow.get() == null) { - return null; - } else { - return repository.findById(selectedTableRow.get().getId()).orElse(null); - } - } , selectedTableRow)); - } - - public void onContactsUpdateEvent(@Observes ContactsUpdatedEvent event) { - updateContactList(); - } - - private void updateContactList() { - LOG.debug("update contact list"); - - - // when there is a selected row, persist the id of this row, otherwise use null - final String selectedContactId = (selectedTableRow.get() == null) ? null : selectedTableRow.get().getId(); - - - Set<Contact> allContacts = repository.findAll(); - - contacts.clear(); - allContacts.forEach(contact -> contacts.add(new MasterTableViewModel(contact))); - - if (selectedContactId != null) { - Optional<MasterTableViewModel> selectedRow = contacts.stream() - .filter(row -> row.getId().equals(selectedContactId)).findFirst(); - - if (selectedRow.isPresent()) { - onSelect.ifPresent(consumer -> consumer.accept(selectedRow.get())); - } else { - onSelect.ifPresent(consumer -> consumer.accept(null)); - } - } - } - - public ObservableList<MasterTableViewModel> getContactList() { - return contacts; - } - - - public void setOnSelect(Consumer<MasterTableViewModel> consumer) { - onSelect = Optional.of(consumer); - } - - public ObjectProperty<MasterTableViewModel> selectedTableRowProperty() { - return selectedTableRow; - } - - - - + + private static final Logger LOG = LoggerFactory.getLogger(MasterViewModel.class); + + private final ObservableList<MasterTableViewModel> contacts = FXCollections.observableArrayList(); + + private final ReadOnlyObjectWrapper<Contact> selectedContact = new ReadOnlyObjectWrapper<>(); + + private final ObjectProperty<MasterTableViewModel> selectedTableRow = new SimpleObjectProperty<>(); + + private Optional<Consumer<MasterTableViewModel>> onSelect = Optional.empty(); + + @Inject + Repository repository; + + @InjectScope + MasterDetailScope mdScope; + + public void initialize() { + updateContactList(); + + mdScope.selectedContactProperty().bind(selectedContact); + + selectedContact.bind(Bindings.createObjectBinding(() -> { + if (selectedTableRow.get() == null) { + return null; + } else { + return repository.findById(selectedTableRow.get().getId()).orElse(null); + } + }, selectedTableRow)); + } + + public void onContactsUpdateEvent(@Observes ContactsUpdatedEvent event) { + updateContactList(); + } + + private void updateContactList() { + LOG.debug("update contact list"); + + // when there is a selected row, persist the id of this row, otherwise use null + final String selectedContactId = (selectedTableRow.get() == null) ? null : selectedTableRow.get().getId(); + + Set<Contact> allContacts = repository.findAll(); + + contacts.clear(); + allContacts.forEach(contact -> contacts.add(new MasterTableViewModel(contact))); + + if (selectedContactId != null) { + Optional<MasterTableViewModel> selectedRow = contacts.stream() + .filter(row -> row.getId().equals(selectedContactId)).findFirst(); + + if (selectedRow.isPresent()) { + onSelect.ifPresent(consumer -> consumer.accept(selectedRow.get())); + } else { + onSelect.ifPresent(consumer -> consumer.accept(null)); + } + } + } + + public ObservableList<MasterTableViewModel> getContactList() { + return contacts; + } + + public void setOnSelect(Consumer<MasterTableViewModel> consumer) { + onSelect = Optional.of(consumer); + } + + public ObjectProperty<MasterTableViewModel> selectedTableRowProperty() { + return selectedTableRow; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java index 57daa518b..d22b5628b 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java @@ -13,34 +13,34 @@ import javafx.stage.Stage; public class MenuView implements FxmlView<MenuViewModel> { - - @FXML - private MenuItem removeMenuItem; - - @InjectViewModel - private MenuViewModel viewModel; - - @Inject - private Stage primaryStage; - - public void initialize() { - removeMenuItem.disableProperty().bind(viewModel.removeItemDisabledProperty()); - } - - @FXML - public void close() { - viewModel.closeAction(); - } - - @FXML - public void remove() { - viewModel.removeAction(); - } - - @FXML - public void about() { - Parent view = FluentViewLoader.fxmlView(AboutView.class) - .load().getView(); - DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - } + + @FXML + private MenuItem removeMenuItem; + + @InjectViewModel + private MenuViewModel viewModel; + + @Inject + private Stage primaryStage; + + public void initialize() { + removeMenuItem.disableProperty().bind(viewModel.removeItemDisabledProperty()); + } + + @FXML + public void close() { + viewModel.closeAction(); + } + + @FXML + public void remove() { + viewModel.removeAction(); + } + + @FXML + public void about() { + Parent view = FluentViewLoader.fxmlView(AboutView.class).load().getView(); + DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java index 15a2669b8..8b7c4a16d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java @@ -13,36 +13,35 @@ import javafx.beans.property.ReadOnlyBooleanWrapper; public class MenuViewModel implements ViewModel { - - @Inject - private Event<TriggerShutdownEvent> shouldCloseEvent; - - @InjectScope - private MasterDetailScope mdScope; - - @Inject - private Repository repository; - - private final ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); - - - public void initialize() { - removeItemDisabled.bind(mdScope.selectedContactProperty().isNull()); - } - - public void closeAction() { - shouldCloseEvent.fire(new TriggerShutdownEvent()); - } - - public void removeAction() { - Contact selectedContact = mdScope.selectedContactProperty().get(); - if (selectedContact != null) { - repository.delete(mdScope.selectedContactProperty().get()); - } - } - - public ReadOnlyBooleanProperty removeItemDisabledProperty() { - return removeItemDisabled.getReadOnlyProperty(); - } - + + @Inject + private Event<TriggerShutdownEvent> shouldCloseEvent; + + @InjectScope + private MasterDetailScope mdScope; + + @Inject + private Repository repository; + + private final ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); + + public void initialize() { + removeItemDisabled.bind(mdScope.selectedContactProperty().isNull()); + } + + public void closeAction() { + shouldCloseEvent.fire(new TriggerShutdownEvent()); + } + + public void removeAction() { + Contact selectedContact = mdScope.selectedContactProperty().get(); + if (selectedContact != null) { + repository.delete(mdScope.selectedContactProperty().get()); + } + } + + public ReadOnlyBooleanProperty removeItemDisabledProperty() { + return removeItemDisabled.getReadOnlyProperty(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index e7f51b0b0..ab93f4159 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -10,87 +10,77 @@ import javafx.beans.property.StringProperty; public class ContactDialogScope implements Scope { - - public static String RESET_DIALOG_PAGE = "contact_reset_dialog_page"; - public static String OK_BEFORE_COMMIT = "contact_ok_before_commit"; - public static String COMMIT = "contact_commit"; - public static String RESET_FORMS = "contact_reset"; - - private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); - - private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); - private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); - private final BooleanProperty bothFormsValid = new SimpleBooleanProperty(); - private final StringProperty dialogTitle = new SimpleStringProperty(); - - - public BooleanProperty contactFormValidProperty() { - return this.contactFormValid; - } - - public boolean isContactFormValid() { - return this.contactFormValidProperty().get(); - } - - public void setContactFormValid(final boolean contactFormValid) { - this.contactFormValidProperty().set(contactFormValid); - } - - public BooleanProperty addressFormValidProperty() { - return this.addressFormValid; - } - - public boolean isAddressFormValid() { - return this.addressFormValidProperty().get(); - } - - public void setAddressFormValid(final boolean addressFormValid) { - this.addressFormValidProperty().set(addressFormValid); - } - - public ObjectProperty<Contact> contactToEditProperty() { - return this.contactToEdit; - } - - - public Contact getContactToEdit() { - return this.contactToEditProperty().get(); - } - - - public void setContactToEdit(final Contact contactToEdit) { - this.contactToEditProperty().set(contactToEdit); - } - - public final BooleanProperty bothFormsValidProperty() { - return this.bothFormsValid; - } - - - public final boolean isBothFormsValid() { - return this.bothFormsValidProperty().get(); - } - - - public final void setBothFormsValid(final boolean bothFormsValid) { - this.bothFormsValidProperty().set(bothFormsValid); - } - - public final StringProperty dialogTitleProperty() { - return this.dialogTitle; - } - - - public final java.lang.String getDialogTitle() { - return this.dialogTitleProperty().get(); - } - - - public final void setDialogTitle(final java.lang.String dialogTitle) { - this.dialogTitleProperty().set(dialogTitle); - } - - - - + + public static String RESET_DIALOG_PAGE = "contact_reset_dialog_page"; + public static String OK_BEFORE_COMMIT = "contact_ok_before_commit"; + public static String COMMIT = "contact_commit"; + public static String RESET_FORMS = "contact_reset"; + + private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); + + private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); + private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); + private final BooleanProperty bothFormsValid = new SimpleBooleanProperty(); + private final StringProperty dialogTitle = new SimpleStringProperty(); + + public BooleanProperty contactFormValidProperty() { + return this.contactFormValid; + } + + public boolean isContactFormValid() { + return this.contactFormValidProperty().get(); + } + + public void setContactFormValid(final boolean contactFormValid) { + this.contactFormValidProperty().set(contactFormValid); + } + + public BooleanProperty addressFormValidProperty() { + return this.addressFormValid; + } + + public boolean isAddressFormValid() { + return this.addressFormValidProperty().get(); + } + + public void setAddressFormValid(final boolean addressFormValid) { + this.addressFormValidProperty().set(addressFormValid); + } + + public ObjectProperty<Contact> contactToEditProperty() { + return this.contactToEdit; + } + + public Contact getContactToEdit() { + return this.contactToEditProperty().get(); + } + + public void setContactToEdit(final Contact contactToEdit) { + this.contactToEditProperty().set(contactToEdit); + } + + public final BooleanProperty bothFormsValidProperty() { + return this.bothFormsValid; + } + + public final boolean isBothFormsValid() { + return this.bothFormsValidProperty().get(); + } + + public final void setBothFormsValid(final boolean bothFormsValid) { + this.bothFormsValidProperty().set(bothFormsValid); + } + + public final StringProperty dialogTitleProperty() { + return this.dialogTitle; + } + + public final java.lang.String getDialogTitle() { + return this.dialogTitleProperty().get(); + } + + public final void setDialogTitle(final java.lang.String dialogTitle) { + this.dialogTitleProperty().set(dialogTitle); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java index 620167b5a..fdc629ddd 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java @@ -6,22 +6,19 @@ import javafx.beans.property.SimpleObjectProperty; public class MasterDetailScope implements Scope { - - private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); - - public ObjectProperty<Contact> selectedContactProperty() { - return this.selectedContact; - } - - - public final Contact getSelectedContact() { - return this.selectedContactProperty().get(); - } - - - public final void setSelectedContact(final Contact selectedContact) { - this.selectedContactProperty().set(selectedContact); - } - - + + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); + + public ObjectProperty<Contact> selectedContactProperty() { + return this.selectedContact; + } + + public final Contact getSelectedContact() { + return this.selectedContactProperty().get(); + } + + public final void setSelectedContact(final Contact selectedContact) { + this.selectedContactProperty().set(selectedContact); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java index 6f319077b..83c82995c 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java @@ -17,26 +17,27 @@ import javafx.stage.Stage; public class ToolbarView implements FxmlView<ToolbarViewModel> { - - @FXML - public Button addNewContactButton; - - @InjectViewModel - private ToolbarViewModel viewModel; - - @Inject - private Stage primaryStage; - - public void initialize() { - AwesomeDude.setIcon(addNewContactButton, AwesomeIcon.PLUS); - } - - @FXML - public void addNewContact() { - ViewTuple<AddContactDialogView, AddContactDialogViewModel> load = FluentViewLoader.fxmlView(AddContactDialogView.class) - .load(); - Parent view = load.getView(); - Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - load.getCodeBehind().setDisplayingStage(showDialog); - } + + @FXML + public Button addNewContactButton; + + @InjectViewModel + private ToolbarViewModel viewModel; + + @Inject + private Stage primaryStage; + + public void initialize() { + AwesomeDude.setIcon(addNewContactButton, AwesomeIcon.PLUS); + } + + @FXML + public void addNewContact() { + ViewTuple<AddContactDialogView, AddContactDialogViewModel> load = FluentViewLoader + .fxmlView(AddContactDialogView.class).load(); + Parent view = load.getView(); + Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + load.getCodeBehind().setDisplayingStage(showDialog); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java index c98757e85..b92519e61 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java @@ -12,11 +12,11 @@ * @author manuel.mauky */ public class BirthdayValidator extends FunctionBasedValidator<LocalDate> { - - private static final Predicate<LocalDate> birthdayPredicate = date -> - date == null || date.isBefore(LocalDate.now(CentralClock.getClock())); - - public BirthdayValidator(ObservableValue<LocalDate> date) { - super(date, birthdayPredicate, ValidationMessage.error("Birthday can't be set in the future")); - } + + private static final Predicate<LocalDate> birthdayPredicate = date + -> date == null || date.isBefore(LocalDate.now(CentralClock.getClock())); + + public BirthdayValidator(ObservableValue<LocalDate> date) { + super(date, birthdayPredicate, ValidationMessage.error("Birthday can't be set in the future")); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java index 4048534a2..35aca777a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java @@ -11,12 +11,14 @@ * @author manuel.mauky */ public class EmailValidator extends ObservableRuleBasedValidator { - private static final Pattern SIMPLE_EMAIL_PATTERN = Pattern - .compile("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"); - - public EmailValidator(ObservableValue<String> source) { - addRule(ObservableRules.notEmpty(source), ValidationMessage.error("Email may not be empty")); - addRule(ObservableRules.matches(source, SIMPLE_EMAIL_PATTERN), - ValidationMessage.warning("Maybe a wrong email format")); - } + + private static final Pattern SIMPLE_EMAIL_PATTERN = Pattern + .compile("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"); + + public EmailValidator(ObservableValue<String> source) { + addRule(ObservableRules.notEmpty(source), ValidationMessage.error("Email may not be empty")); + addRule(ObservableRules.matches(source, SIMPLE_EMAIL_PATTERN), + ValidationMessage.warning("Maybe a wrong email format")); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java index 5093decb5..7235583cf 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java @@ -12,21 +12,22 @@ * @author manuel.mauky */ public class PhoneValidator extends ObservableRuleBasedValidator { - - private static final Pattern SIMPLE_PHONE_PATTERN = Pattern.compile("\\+?[0-9\\s]{3,20}"); - - public PhoneValidator(ObservableValue<String> number, String message) { - - final BooleanBinding phonePatternMatches = Bindings.createBooleanBinding(() -> { - final String input = number.getValue(); - - if (input == null || input.trim().isEmpty()) { - return true; - } - - return SIMPLE_PHONE_PATTERN.matcher(input).matches(); - }, number); - - addRule(phonePatternMatches, ValidationMessage.error(message)); - } + + private static final Pattern SIMPLE_PHONE_PATTERN = Pattern.compile("\\+?[0-9\\s]{3,20}"); + + public PhoneValidator(ObservableValue<String> number, String message) { + + final BooleanBinding phonePatternMatches = Bindings.createBooleanBinding(() -> { + final String input = number.getValue(); + + if (input == null || input.trim().isEmpty()) { + return true; + } + + return SIMPLE_PHONE_PATTERN.matcher(input).matches(); + }, number); + + addRule(phonePatternMatches, ValidationMessage.error(message)); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java index 49130d736..b970a5bec 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java @@ -5,37 +5,39 @@ import java.time.ZonedDateTime; /** - * This class is used to have a single clock that is used to get time instances. When somewhere an instance of - * {@link java.time.LocalDate} or {@link java.time.LocalDateTime} with the current time is needed you should get it by - * using the 'now' method with the Clock param: - * + * This class is used to have a single clock that is used to get time instances. + * When somewhere an instance of {@link java.time.LocalDate} or + * {@link java.time.LocalDateTime} with the current time is needed you should + * get it by using the 'now' method with the Clock param: + * * <pre> * LocalDate now = LocalDate.now(CentralClock.getClock()); - * + * * </pre> - * - * This can help to improve the testablility of the code because in the test you can define a fixed clock (see - * {#setFixedClock}). - * + * + * This can help to improve the testablility of the code because in the test you + * can define a fixed clock (see {#setFixedClock}). + * */ public class CentralClock { - - private static Clock clock = Clock.systemUTC(); - - public static Clock getClock() { - return clock; - } - - public static void setClock(Clock clock) { - CentralClock.clock = clock; - } - - /** - * This method is used to set the clock to a fixed time. This is useful for tests. This way it's possible to create - * date/time instances with a predictable value for your tests. - */ - public static void setFixedClock(ZonedDateTime zonedDateTime) { - CentralClock.clock = Clock.fixed(zonedDateTime.toInstant(), ZoneId.systemDefault()); - } - + + private static Clock clock = Clock.systemUTC(); + + public static Clock getClock() { + return clock; + } + + public static void setClock(Clock clock) { + CentralClock.clock = clock; + } + + /** + * This method is used to set the clock to a fixed time. This is useful for + * tests. This way it's possible to create date/time instances with a + * predictable value for your tests. + */ + public static void setFixedClock(ZonedDateTime zonedDateTime) { + CentralClock.clock = Clock.fixed(zonedDateTime.toInstant(), ZoneId.systemDefault()); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java index 04eafb61e..fe546cb03 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java @@ -9,71 +9,74 @@ import javafx.stage.StageStyle; /** - * This class is a helper to create a dialog that will open and close itself according to a boolean property. - * - * This way you can define in a ViewModel when and under which conditions a dialog should be shown. + * This class is a helper to create a dialog that will open and close itself + * according to a boolean property. + * + * This way you can define in a ViewModel when and under which conditions a + * dialog should be shown. */ public class DialogHelper { - - /** - * Use this method to initialize the show/hide listeners for the dialog. - * - * @param openProperty - * the boolean property that defines whether the dialog should be shown or hidden. Set this property to - * <code>true</code> to open the dialog. Set it to <code>false</code> to close the dialog. When the - * dialog is closed by the user by clicking on the close-button of the window, this property will also be - * set to <code>false</code> by the dialog. - * @param parentStage - * the Stage that is used as parent to initialize the ownership of the dialog. This way modal dialogs can - * be created. - * @param rootSupplier - * a supplier function that is called when the dialog is made visible for the first time. This function - * has to return a {@link Parent} instance that is used as the root node of the dialog scene. - */ - public static void initDialog(BooleanProperty openProperty, final Stage parentStage, Supplier<Parent> rootSupplier) { - final Stage dialogStage = new Stage(StageStyle.UTILITY); - dialogStage.initOwner(parentStage); - dialogStage.initModality(Modality.APPLICATION_MODAL); - - openProperty.addListener((obs, oldValue, newValue) -> { - if (newValue) { - // when it is the first time the dialog is made visible (and therefore no scene exists) ... - if (dialogStage.getScene() == null) { - // ... we create a new scene and register it in the stage. - Scene dialogScene = new Scene(rootSupplier.get()); - dialogScene.getStylesheets().add("/contacts.css"); - dialogStage.setScene(dialogScene); - } else { - // ... otherwise we simple bring the dialog to front. - dialogStage.toFront(); - } - - dialogStage.sizeToScene(); - dialogStage.show(); - } else { - dialogStage.close(); - } - }); - + + /** + * Use this method to initialize the show/hide listeners for the dialog. + * + * @param openProperty the boolean property that defines whether the dialog + * should be shown or hidden. Set this property to <code>true</code> to open + * the dialog. Set it to <code>false</code> to close the dialog. When the + * dialog is closed by the user by clicking on the close-button of the + * window, this property will also be set to <code>false</code> by the + * dialog. + * @param parentStage the Stage that is used as parent to initialize the + * ownership of the dialog. This way modal dialogs can be created. + * @param rootSupplier a supplier function that is called when the dialog is + * made visible for the first time. This function has to return a + * {@link Parent} instance that is used as the root node of the dialog + * scene. + */ + public static void initDialog(BooleanProperty openProperty, final Stage parentStage, Supplier<Parent> rootSupplier) { + final Stage dialogStage = new Stage(StageStyle.UTILITY); + dialogStage.initOwner(parentStage); + dialogStage.initModality(Modality.APPLICATION_MODAL); + + openProperty.addListener((obs, oldValue, newValue) -> { + if (newValue) { + // when it is the first time the dialog is made visible (and therefore no scene exists) ... + if (dialogStage.getScene() == null) { + // ... we create a new scene and register it in the stage. + Scene dialogScene = new Scene(rootSupplier.get()); + dialogScene.getStylesheets().add("/contacts.css"); + dialogStage.setScene(dialogScene); + } else { + // ... otherwise we simple bring the dialog to front. + dialogStage.toFront(); + } + + dialogStage.sizeToScene(); + dialogStage.show(); + } else { + dialogStage.close(); + } + }); + // when the user clicks on the close button of the dialog window - // we want to set the property to false - dialogStage.setOnCloseRequest(event -> openProperty.set(false)); - } - - public static Stage showDialog(Parent view, Stage parentStage, String... sceneStyleSheets) { - final Stage dialogStage = new Stage(StageStyle.UTILITY); - dialogStage.initOwner(parentStage); - dialogStage.initModality(Modality.APPLICATION_MODAL); - if (dialogStage.getScene() == null) { - // ... we create a new scene and register it in the stage. - Scene dialogScene = new Scene(view); - dialogScene.getStylesheets().addAll(sceneStyleSheets); - dialogStage.setScene(dialogScene); - - dialogStage.sizeToScene(); - dialogStage.show(); - return dialogStage; - } - return null; - } + // we want to set the property to false + dialogStage.setOnCloseRequest(event -> openProperty.set(false)); + } + + public static Stage showDialog(Parent view, Stage parentStage, String... sceneStyleSheets) { + final Stage dialogStage = new Stage(StageStyle.UTILITY); + dialogStage.initOwner(parentStage); + dialogStage.initModality(Modality.APPLICATION_MODAL); + if (dialogStage.getScene() == null) { + // ... we create a new scene and register it in the stage. + Scene dialogScene = new Scene(view); + dialogScene.getStylesheets().addAll(sceneStyleSheets); + dialogStage.setScene(dialogScene); + + dialogStage.sizeToScene(); + dialogStage.show(); + return dialogStage; + } + return null; + } } diff --git a/examples/contacts-example/src/main/resources/countries/iso_3166.xml b/examples/contacts-example/src/main/resources/countries/iso_3166.xml index 5d0103596..e02ff9129 100644 --- a/examples/contacts-example/src/main/resources/countries/iso_3166.xml +++ b/examples/contacts-example/src/main/resources/countries/iso_3166.xml @@ -49,1655 +49,1655 @@ Source: <http://www.iso.org/iso/country_codes> ]> <iso_3166_entries> - <iso_3166_entry - alpha_2_code="AF" - alpha_3_code="AFG" - numeric_code="004" - name="Afghanistan" - official_name="Islamic Republic of Afghanistan"/> - <iso_3166_entry - alpha_2_code="AX" - alpha_3_code="ALA" - numeric_code="248" - name="Åland Islands"/> - <iso_3166_entry - alpha_2_code="AL" - alpha_3_code="ALB" - numeric_code="008" - name="Albania" - official_name="Republic of Albania"/> - <iso_3166_entry - alpha_2_code="DZ" - alpha_3_code="DZA" - numeric_code="012" - name="Algeria" - official_name="People's Democratic Republic of Algeria"/> - <iso_3166_entry - alpha_2_code="AS" - alpha_3_code="ASM" - numeric_code="016" - name="American Samoa"/> - <iso_3166_entry - alpha_2_code="AD" - alpha_3_code="AND" - numeric_code="020" - name="Andorra" - official_name="Principality of Andorra"/> - <iso_3166_entry - alpha_2_code="AO" - alpha_3_code="AGO" - numeric_code="024" - name="Angola" - official_name="Republic of Angola"/> - <iso_3166_entry - alpha_2_code="AI" - alpha_3_code="AIA" - numeric_code="660" - name="Anguilla"/> - <iso_3166_entry - alpha_2_code="AQ" - alpha_3_code="ATA" - numeric_code="010" - name="Antarctica"/> - <iso_3166_entry - alpha_2_code="AG" - alpha_3_code="ATG" - numeric_code="028" - name="Antigua and Barbuda"/> - <iso_3166_entry - alpha_2_code="AR" - alpha_3_code="ARG" - numeric_code="032" - name="Argentina" - official_name="Argentine Republic"/> - <iso_3166_entry - alpha_2_code="AM" - alpha_3_code="ARM" - numeric_code="051" - name="Armenia" - official_name="Republic of Armenia"/> - <iso_3166_entry - alpha_2_code="AW" - alpha_3_code="ABW" - numeric_code="533" - name="Aruba"/> - <iso_3166_entry - alpha_2_code="AU" - alpha_3_code="AUS" - numeric_code="036" - name="Australia"/> - <iso_3166_entry - alpha_2_code="AT" - alpha_3_code="AUT" - numeric_code="040" - name="Austria" - official_name="Republic of Austria"/> - <iso_3166_entry - alpha_2_code="AZ" - alpha_3_code="AZE" - numeric_code="031" - name="Azerbaijan" - official_name="Republic of Azerbaijan"/> - <iso_3166_entry - alpha_2_code="BS" - alpha_3_code="BHS" - numeric_code="044" - name="Bahamas" - official_name="Commonwealth of the Bahamas"/> - <iso_3166_entry - alpha_2_code="BH" - alpha_3_code="BHR" - numeric_code="048" - name="Bahrain" - official_name="Kingdom of Bahrain"/> - <iso_3166_entry - alpha_2_code="BD" - alpha_3_code="BGD" - numeric_code="050" - name="Bangladesh" - official_name="People's Republic of Bangladesh"/> - <iso_3166_entry - alpha_2_code="BB" - alpha_3_code="BRB" - numeric_code="052" - name="Barbados"/> - <iso_3166_entry - alpha_2_code="BY" - alpha_3_code="BLR" - numeric_code="112" - name="Belarus" - official_name="Republic of Belarus"/> - <iso_3166_entry - alpha_2_code="BE" - alpha_3_code="BEL" - numeric_code="056" - name="Belgium" - official_name="Kingdom of Belgium"/> - <iso_3166_entry - alpha_2_code="BZ" - alpha_3_code="BLZ" - numeric_code="084" - name="Belize"/> - <iso_3166_entry - alpha_2_code="BJ" - alpha_3_code="BEN" - numeric_code="204" - name="Benin" - official_name="Republic of Benin"/> - <iso_3166_entry - alpha_2_code="BM" - alpha_3_code="BMU" - numeric_code="060" - name="Bermuda"/> - <iso_3166_entry - alpha_2_code="BT" - alpha_3_code="BTN" - numeric_code="064" - name="Bhutan" - official_name="Kingdom of Bhutan"/> - <iso_3166_entry - alpha_2_code="BO" - alpha_3_code="BOL" - numeric_code="068" - common_name="Bolivia" - name="Bolivia, Plurinational State of" - official_name="Plurinational State of Bolivia"/> - <iso_3166_entry - alpha_2_code="BQ" - alpha_3_code="BES" - numeric_code="535" - name="Bonaire, Saint Eustatius and Saba" - official_name="Bonaire, Saint Eustatius and Saba"/> - <iso_3166_entry - alpha_2_code="BA" - alpha_3_code="BIH" - numeric_code="070" - name="Bosnia and Herzegovina" - official_name="Republic of Bosnia and Herzegovina"/> - <iso_3166_entry - alpha_2_code="BW" - alpha_3_code="BWA" - numeric_code="072" - name="Botswana" - official_name="Republic of Botswana"/> - <iso_3166_entry - alpha_2_code="BV" - alpha_3_code="BVT" - numeric_code="074" - name="Bouvet Island"/> - <iso_3166_entry - alpha_2_code="BR" - alpha_3_code="BRA" - numeric_code="076" - name="Brazil" - official_name="Federative Republic of Brazil"/> - <iso_3166_entry - alpha_2_code="IO" - alpha_3_code="IOT" - numeric_code="086" - name="British Indian Ocean Territory"/> - <iso_3166_entry - alpha_2_code="BN" - alpha_3_code="BRN" - numeric_code="096" - name="Brunei Darussalam"/> - <iso_3166_entry - alpha_2_code="BG" - alpha_3_code="BGR" - numeric_code="100" - name="Bulgaria" - official_name="Republic of Bulgaria"/> - <iso_3166_entry - alpha_2_code="BF" - alpha_3_code="BFA" - numeric_code="854" - name="Burkina Faso"/> - <iso_3166_entry - alpha_2_code="BI" - alpha_3_code="BDI" - numeric_code="108" - name="Burundi" - official_name="Republic of Burundi"/> - <iso_3166_entry - alpha_2_code="KH" - alpha_3_code="KHM" - numeric_code="116" - name="Cambodia" - official_name="Kingdom of Cambodia"/> - <iso_3166_entry - alpha_2_code="CM" - alpha_3_code="CMR" - numeric_code="120" - name="Cameroon" - official_name="Republic of Cameroon"/> - <iso_3166_entry - alpha_2_code="CA" - alpha_3_code="CAN" - numeric_code="124" - name="Canada"/> - <iso_3166_entry - alpha_2_code="CV" - alpha_3_code="CPV" - numeric_code="132" - name="Cape Verde" - official_name="Republic of Cape Verde"/> - <iso_3166_entry - alpha_2_code="KY" - alpha_3_code="CYM" - numeric_code="136" - name="Cayman Islands"/> - <iso_3166_entry - alpha_2_code="CF" - alpha_3_code="CAF" - numeric_code="140" - name="Central African Republic"/> - <iso_3166_entry - alpha_2_code="TD" - alpha_3_code="TCD" - numeric_code="148" - name="Chad" - official_name="Republic of Chad"/> - <iso_3166_entry - alpha_2_code="CL" - alpha_3_code="CHL" - numeric_code="152" - name="Chile" - official_name="Republic of Chile"/> - <iso_3166_entry - alpha_2_code="CN" - alpha_3_code="CHN" - numeric_code="156" - name="China" - official_name="People's Republic of China"/> - <iso_3166_entry - alpha_2_code="CX" - alpha_3_code="CXR" - numeric_code="162" - name="Christmas Island"/> - <iso_3166_entry - alpha_2_code="CC" - alpha_3_code="CCK" - numeric_code="166" - name="Cocos (Keeling) Islands"/> - <iso_3166_entry - alpha_2_code="CO" - alpha_3_code="COL" - numeric_code="170" - name="Colombia" - official_name="Republic of Colombia"/> - <iso_3166_entry - alpha_2_code="KM" - alpha_3_code="COM" - numeric_code="174" - name="Comoros" - official_name="Union of the Comoros"/> - <iso_3166_entry - alpha_2_code="CG" - alpha_3_code="COG" - numeric_code="178" - name="Congo" - official_name="Republic of the Congo"/> - <iso_3166_entry - alpha_2_code="CD" - alpha_3_code="COD" - numeric_code="180" - name="Congo, The Democratic Republic of the"/> - <iso_3166_entry - alpha_2_code="CK" - alpha_3_code="COK" - numeric_code="184" - name="Cook Islands"/> - <iso_3166_entry - alpha_2_code="CR" - alpha_3_code="CRI" - numeric_code="188" - name="Costa Rica" - official_name="Republic of Costa Rica"/> - <iso_3166_entry - alpha_2_code="CI" - alpha_3_code="CIV" - numeric_code="384" - name="Côte d'Ivoire" - official_name="Republic of Côte d'Ivoire"/> - <iso_3166_entry - alpha_2_code="HR" - alpha_3_code="HRV" - numeric_code="191" - name="Croatia" - official_name="Republic of Croatia"/> - <iso_3166_entry - alpha_2_code="CU" - alpha_3_code="CUB" - numeric_code="192" - name="Cuba" - official_name="Republic of Cuba"/> - <iso_3166_entry - alpha_2_code="CW" - alpha_3_code="CUW" - numeric_code="531" - name="Curaçao" - official_name="Curaçao"/> - <iso_3166_entry - alpha_2_code="CY" - alpha_3_code="CYP" - numeric_code="196" - name="Cyprus" - official_name="Republic of Cyprus"/> - <iso_3166_entry - alpha_2_code="CZ" - alpha_3_code="CZE" - numeric_code="203" - name="Czech Republic"/> - <iso_3166_entry - alpha_2_code="DK" - alpha_3_code="DNK" - numeric_code="208" - name="Denmark" - official_name="Kingdom of Denmark"/> - <iso_3166_entry - alpha_2_code="DJ" - alpha_3_code="DJI" - numeric_code="262" - name="Djibouti" - official_name="Republic of Djibouti"/> - <iso_3166_entry - alpha_2_code="DM" - alpha_3_code="DMA" - numeric_code="212" - name="Dominica" - official_name="Commonwealth of Dominica"/> - <iso_3166_entry - alpha_2_code="DO" - alpha_3_code="DOM" - numeric_code="214" - name="Dominican Republic"/> - <iso_3166_entry - alpha_2_code="EC" - alpha_3_code="ECU" - numeric_code="218" - name="Ecuador" - official_name="Republic of Ecuador"/> - <iso_3166_entry - alpha_2_code="EG" - alpha_3_code="EGY" - numeric_code="818" - name="Egypt" - official_name="Arab Republic of Egypt"/> - <iso_3166_entry - alpha_2_code="SV" - alpha_3_code="SLV" - numeric_code="222" - name="El Salvador" - official_name="Republic of El Salvador"/> - <iso_3166_entry - alpha_2_code="GQ" - alpha_3_code="GNQ" - numeric_code="226" - name="Equatorial Guinea" - official_name="Republic of Equatorial Guinea"/> - <iso_3166_entry - alpha_2_code="ER" - alpha_3_code="ERI" - numeric_code="232" - name="Eritrea"/> - <iso_3166_entry - alpha_2_code="EE" - alpha_3_code="EST" - numeric_code="233" - name="Estonia" - official_name="Republic of Estonia"/> - <iso_3166_entry - alpha_2_code="ET" - alpha_3_code="ETH" - numeric_code="231" - name="Ethiopia" - official_name="Federal Democratic Republic of Ethiopia"/> - <iso_3166_entry - alpha_2_code="FK" - alpha_3_code="FLK" - numeric_code="238" - name="Falkland Islands (Malvinas)"/> - <iso_3166_entry - alpha_2_code="FO" - alpha_3_code="FRO" - numeric_code="234" - name="Faroe Islands"/> - <iso_3166_entry - alpha_2_code="FJ" - alpha_3_code="FJI" - numeric_code="242" - name="Fiji" - official_name="Republic of the Fiji Islands"/> - <iso_3166_entry - alpha_2_code="FI" - alpha_3_code="FIN" - numeric_code="246" - name="Finland" - official_name="Republic of Finland"/> - <iso_3166_entry - alpha_2_code="FR" - alpha_3_code="FRA" - numeric_code="250" - name="France" - official_name="French Republic"/> - <iso_3166_entry - alpha_2_code="GF" - alpha_3_code="GUF" - numeric_code="254" - name="French Guiana"/> - <iso_3166_entry - alpha_2_code="PF" - alpha_3_code="PYF" - numeric_code="258" - name="French Polynesia"/> - <iso_3166_entry - alpha_2_code="TF" - alpha_3_code="ATF" - numeric_code="260" - name="French Southern Territories"/> - <iso_3166_entry - alpha_2_code="GA" - alpha_3_code="GAB" - numeric_code="266" - name="Gabon" - official_name="Gabonese Republic"/> - <iso_3166_entry - alpha_2_code="GM" - alpha_3_code="GMB" - numeric_code="270" - name="Gambia" - official_name="Republic of the Gambia"/> - <iso_3166_entry - alpha_2_code="GE" - alpha_3_code="GEO" - numeric_code="268" - name="Georgia"/> - <iso_3166_entry - alpha_2_code="DE" - alpha_3_code="DEU" - numeric_code="276" - name="Germany" - official_name="Federal Republic of Germany"/> - <iso_3166_entry - alpha_2_code="GH" - alpha_3_code="GHA" - numeric_code="288" - name="Ghana" - official_name="Republic of Ghana"/> - <iso_3166_entry - alpha_2_code="GI" - alpha_3_code="GIB" - numeric_code="292" - name="Gibraltar"/> - <iso_3166_entry - alpha_2_code="GR" - alpha_3_code="GRC" - numeric_code="300" - name="Greece" - official_name="Hellenic Republic"/> - <iso_3166_entry - alpha_2_code="GL" - alpha_3_code="GRL" - numeric_code="304" - name="Greenland"/> - <iso_3166_entry - alpha_2_code="GD" - alpha_3_code="GRD" - numeric_code="308" - name="Grenada"/> - <iso_3166_entry - alpha_2_code="GP" - alpha_3_code="GLP" - numeric_code="312" - name="Guadeloupe"/> - <iso_3166_entry - alpha_2_code="GU" - alpha_3_code="GUM" - numeric_code="316" - name="Guam"/> - <iso_3166_entry - alpha_2_code="GT" - alpha_3_code="GTM" - numeric_code="320" - name="Guatemala" - official_name="Republic of Guatemala"/> - <iso_3166_entry - alpha_2_code="GG" - alpha_3_code="GGY" - numeric_code="831" - name="Guernsey"/> - <iso_3166_entry - alpha_2_code="GN" - alpha_3_code="GIN" - numeric_code="324" - name="Guinea" - official_name="Republic of Guinea"/> - <iso_3166_entry - alpha_2_code="GW" - alpha_3_code="GNB" - numeric_code="624" - name="Guinea-Bissau" - official_name="Republic of Guinea-Bissau"/> - <iso_3166_entry - alpha_2_code="GY" - alpha_3_code="GUY" - numeric_code="328" - name="Guyana" - official_name="Republic of Guyana"/> - <iso_3166_entry - alpha_2_code="HT" - alpha_3_code="HTI" - numeric_code="332" - name="Haiti" - official_name="Republic of Haiti"/> - <iso_3166_entry - alpha_2_code="HM" - alpha_3_code="HMD" - numeric_code="334" - name="Heard Island and McDonald Islands"/> - <iso_3166_entry - alpha_2_code="VA" - alpha_3_code="VAT" - numeric_code="336" - name="Holy See (Vatican City State)"/> - <iso_3166_entry - alpha_2_code="HN" - alpha_3_code="HND" - numeric_code="340" - name="Honduras" - official_name="Republic of Honduras"/> - <iso_3166_entry - alpha_2_code="HK" - alpha_3_code="HKG" - numeric_code="344" - name="Hong Kong" - official_name="Hong Kong Special Administrative Region of China"/> - <iso_3166_entry - alpha_2_code="HU" - alpha_3_code="HUN" - numeric_code="348" - name="Hungary" - official_name="Republic of Hungary"/> - <iso_3166_entry - alpha_2_code="IS" - alpha_3_code="ISL" - numeric_code="352" - name="Iceland" - official_name="Republic of Iceland"/> - <iso_3166_entry - alpha_2_code="IN" - alpha_3_code="IND" - numeric_code="356" - name="India" - official_name="Republic of India"/> - <iso_3166_entry - alpha_2_code="ID" - alpha_3_code="IDN" - numeric_code="360" - name="Indonesia" - official_name="Republic of Indonesia"/> - <iso_3166_entry - alpha_2_code="IR" - alpha_3_code="IRN" - numeric_code="364" - name="Iran, Islamic Republic of" - official_name="Islamic Republic of Iran"/> - <iso_3166_entry - alpha_2_code="IQ" - alpha_3_code="IRQ" - numeric_code="368" - name="Iraq" - official_name="Republic of Iraq"/> - <iso_3166_entry - alpha_2_code="IE" - alpha_3_code="IRL" - numeric_code="372" - name="Ireland"/> - <iso_3166_entry - alpha_2_code="IM" - alpha_3_code="IMN" - numeric_code="833" - name="Isle of Man"/> - <iso_3166_entry - alpha_2_code="IL" - alpha_3_code="ISR" - numeric_code="376" - name="Israel" - official_name="State of Israel"/> - <iso_3166_entry - alpha_2_code="IT" - alpha_3_code="ITA" - numeric_code="380" - name="Italy" - official_name="Italian Republic"/> - <iso_3166_entry - alpha_2_code="JM" - alpha_3_code="JAM" - numeric_code="388" - name="Jamaica"/> - <iso_3166_entry - alpha_2_code="JP" - alpha_3_code="JPN" - numeric_code="392" - name="Japan"/> - <iso_3166_entry - alpha_2_code="JE" - alpha_3_code="JEY" - numeric_code="832" - name="Jersey"/> - <iso_3166_entry - alpha_2_code="JO" - alpha_3_code="JOR" - numeric_code="400" - name="Jordan" - official_name="Hashemite Kingdom of Jordan"/> - <iso_3166_entry - alpha_2_code="KZ" - alpha_3_code="KAZ" - numeric_code="398" - name="Kazakhstan" - official_name="Republic of Kazakhstan"/> - <iso_3166_entry - alpha_2_code="KE" - alpha_3_code="KEN" - numeric_code="404" - name="Kenya" - official_name="Republic of Kenya"/> - <iso_3166_entry - alpha_2_code="KI" - alpha_3_code="KIR" - numeric_code="296" - name="Kiribati" - official_name="Republic of Kiribati"/> - <iso_3166_entry - alpha_2_code="KP" - alpha_3_code="PRK" - numeric_code="408" - name="Korea, Democratic People's Republic of" - official_name="Democratic People's Republic of Korea"/> - <iso_3166_entry - alpha_2_code="KR" - alpha_3_code="KOR" - numeric_code="410" - name="Korea, Republic of"/> - <iso_3166_entry - alpha_2_code="KW" - alpha_3_code="KWT" - numeric_code="414" - name="Kuwait" - official_name="State of Kuwait"/> - <iso_3166_entry - alpha_2_code="KG" - alpha_3_code="KGZ" - numeric_code="417" - name="Kyrgyzstan" - official_name="Kyrgyz Republic"/> - <iso_3166_entry - alpha_2_code="LA" - alpha_3_code="LAO" - numeric_code="418" - name="Lao People's Democratic Republic"/> - <iso_3166_entry - alpha_2_code="LV" - alpha_3_code="LVA" - numeric_code="428" - name="Latvia" - official_name="Republic of Latvia"/> - <iso_3166_entry - alpha_2_code="LB" - alpha_3_code="LBN" - numeric_code="422" - name="Lebanon" - official_name="Lebanese Republic"/> - <iso_3166_entry - alpha_2_code="LS" - alpha_3_code="LSO" - numeric_code="426" - name="Lesotho" - official_name="Kingdom of Lesotho"/> - <iso_3166_entry - alpha_2_code="LR" - alpha_3_code="LBR" - numeric_code="430" - name="Liberia" - official_name="Republic of Liberia"/> - <iso_3166_entry - alpha_2_code="LY" - alpha_3_code="LBY" - numeric_code="434" - common_name="Libya" - name="Libyan Arab Jamahiriya" - official_name="Socialist People's Libyan Arab Jamahiriya"/> - <iso_3166_entry - alpha_2_code="LI" - alpha_3_code="LIE" - numeric_code="438" - name="Liechtenstein" - official_name="Principality of Liechtenstein"/> - <iso_3166_entry - alpha_2_code="LT" - alpha_3_code="LTU" - numeric_code="440" - name="Lithuania" - official_name="Republic of Lithuania"/> - <iso_3166_entry - alpha_2_code="LU" - alpha_3_code="LUX" - numeric_code="442" - name="Luxembourg" - official_name="Grand Duchy of Luxembourg"/> - <iso_3166_entry - alpha_2_code="MO" - alpha_3_code="MAC" - numeric_code="446" - name="Macao" - official_name="Macao Special Administrative Region of China"/> - <iso_3166_entry - alpha_2_code="MK" - alpha_3_code="MKD" - numeric_code="807" - name="Macedonia, Republic of" - official_name="The Former Yugoslav Republic of Macedonia"/> - <iso_3166_entry - alpha_2_code="MG" - alpha_3_code="MDG" - numeric_code="450" - name="Madagascar" - official_name="Republic of Madagascar"/> - <iso_3166_entry - alpha_2_code="MW" - alpha_3_code="MWI" - numeric_code="454" - name="Malawi" - official_name="Republic of Malawi"/> - <iso_3166_entry - alpha_2_code="MY" - alpha_3_code="MYS" - numeric_code="458" - name="Malaysia"/> - <iso_3166_entry - alpha_2_code="MV" - alpha_3_code="MDV" - numeric_code="462" - name="Maldives" - official_name="Republic of Maldives"/> - <iso_3166_entry - alpha_2_code="ML" - alpha_3_code="MLI" - numeric_code="466" - name="Mali" - official_name="Republic of Mali"/> - <iso_3166_entry - alpha_2_code="MT" - alpha_3_code="MLT" - numeric_code="470" - name="Malta" - official_name="Republic of Malta"/> - <iso_3166_entry - alpha_2_code="MH" - alpha_3_code="MHL" - numeric_code="584" - name="Marshall Islands" - official_name="Republic of the Marshall Islands"/> - <iso_3166_entry - alpha_2_code="MQ" - alpha_3_code="MTQ" - numeric_code="474" - name="Martinique"/> - <iso_3166_entry - alpha_2_code="MR" - alpha_3_code="MRT" - numeric_code="478" - name="Mauritania" - official_name="Islamic Republic of Mauritania"/> - <iso_3166_entry - alpha_2_code="MU" - alpha_3_code="MUS" - numeric_code="480" - name="Mauritius" - official_name="Republic of Mauritius"/> - <iso_3166_entry - alpha_2_code="YT" - alpha_3_code="MYT" - numeric_code="175" - name="Mayotte"/> - <iso_3166_entry - alpha_2_code="MX" - alpha_3_code="MEX" - numeric_code="484" - name="Mexico" - official_name="United Mexican States"/> - <iso_3166_entry - alpha_2_code="FM" - alpha_3_code="FSM" - numeric_code="583" - name="Micronesia, Federated States of" - official_name="Federated States of Micronesia"/> - <iso_3166_entry - alpha_2_code="MD" - alpha_3_code="MDA" - numeric_code="498" - common_name="Moldova" - name="Moldova, Republic of" - official_name="Republic of Moldova"/> - <iso_3166_entry - alpha_2_code="MC" - alpha_3_code="MCO" - numeric_code="492" - name="Monaco" - official_name="Principality of Monaco"/> - <iso_3166_entry - alpha_2_code="MN" - alpha_3_code="MNG" - numeric_code="496" - name="Mongolia"/> - <iso_3166_entry - alpha_2_code="ME" - alpha_3_code="MNE" - numeric_code="499" - name="Montenegro" - official_name="Montenegro"/> - <iso_3166_entry - alpha_2_code="MS" - alpha_3_code="MSR" - numeric_code="500" - name="Montserrat"/> - <iso_3166_entry - alpha_2_code="MA" - alpha_3_code="MAR" - numeric_code="504" - name="Morocco" - official_name="Kingdom of Morocco"/> - <iso_3166_entry - alpha_2_code="MZ" - alpha_3_code="MOZ" - numeric_code="508" - name="Mozambique" - official_name="Republic of Mozambique"/> - <iso_3166_entry - alpha_2_code="MM" - alpha_3_code="MMR" - numeric_code="104" - name="Myanmar" - official_name="Union of Myanmar"/> - <iso_3166_entry - alpha_2_code="NA" - alpha_3_code="NAM" - numeric_code="516" - name="Namibia" - official_name="Republic of Namibia"/> - <iso_3166_entry - alpha_2_code="NR" - alpha_3_code="NRU" - numeric_code="520" - name="Nauru" - official_name="Republic of Nauru"/> - <iso_3166_entry - alpha_2_code="NP" - alpha_3_code="NPL" - numeric_code="524" - name="Nepal" - official_name="Federal Democratic Republic of Nepal"/> - <iso_3166_entry - alpha_2_code="NL" - alpha_3_code="NLD" - numeric_code="528" - name="Netherlands" - official_name="Kingdom of the Netherlands"/> - <iso_3166_entry - alpha_2_code="NC" - alpha_3_code="NCL" - numeric_code="540" - name="New Caledonia"/> - <iso_3166_entry - alpha_2_code="NZ" - alpha_3_code="NZL" - numeric_code="554" - name="New Zealand"/> - <iso_3166_entry - alpha_2_code="NI" - alpha_3_code="NIC" - numeric_code="558" - name="Nicaragua" - official_name="Republic of Nicaragua"/> - <iso_3166_entry - alpha_2_code="NE" - alpha_3_code="NER" - numeric_code="562" - name="Niger" - official_name="Republic of the Niger"/> - <iso_3166_entry - alpha_2_code="NG" - alpha_3_code="NGA" - numeric_code="566" - name="Nigeria" - official_name="Federal Republic of Nigeria"/> - <iso_3166_entry - alpha_2_code="NU" - alpha_3_code="NIU" - numeric_code="570" - name="Niue" - official_name="Republic of Niue"/> - <iso_3166_entry - alpha_2_code="NF" - alpha_3_code="NFK" - numeric_code="574" - name="Norfolk Island"/> - <iso_3166_entry - alpha_2_code="MP" - alpha_3_code="MNP" - numeric_code="580" - name="Northern Mariana Islands" - official_name="Commonwealth of the Northern Mariana Islands"/> - <iso_3166_entry - alpha_2_code="NO" - alpha_3_code="NOR" - numeric_code="578" - name="Norway" - official_name="Kingdom of Norway"/> - <iso_3166_entry - alpha_2_code="OM" - alpha_3_code="OMN" - numeric_code="512" - name="Oman" - official_name="Sultanate of Oman"/> - <iso_3166_entry - alpha_2_code="PK" - alpha_3_code="PAK" - numeric_code="586" - name="Pakistan" - official_name="Islamic Republic of Pakistan"/> - <iso_3166_entry - alpha_2_code="PW" - alpha_3_code="PLW" - numeric_code="585" - name="Palau" - official_name="Republic of Palau"/> - <iso_3166_entry - alpha_2_code="PS" - alpha_3_code="PSE" - numeric_code="275" - name="Palestinian Territory, Occupied" - official_name="Occupied Palestinian Territory"/> - <iso_3166_entry - alpha_2_code="PA" - alpha_3_code="PAN" - numeric_code="591" - name="Panama" - official_name="Republic of Panama"/> - <iso_3166_entry - alpha_2_code="PG" - alpha_3_code="PNG" - numeric_code="598" - name="Papua New Guinea"/> - <iso_3166_entry - alpha_2_code="PY" - alpha_3_code="PRY" - numeric_code="600" - name="Paraguay" - official_name="Republic of Paraguay"/> - <iso_3166_entry - alpha_2_code="PE" - alpha_3_code="PER" - numeric_code="604" - name="Peru" - official_name="Republic of Peru"/> - <iso_3166_entry - alpha_2_code="PH" - alpha_3_code="PHL" - numeric_code="608" - name="Philippines" - official_name="Republic of the Philippines"/> - <iso_3166_entry - alpha_2_code="PN" - alpha_3_code="PCN" - numeric_code="612" - name="Pitcairn"/> - <iso_3166_entry - alpha_2_code="PL" - alpha_3_code="POL" - numeric_code="616" - name="Poland" - official_name="Republic of Poland"/> - <iso_3166_entry - alpha_2_code="PT" - alpha_3_code="PRT" - numeric_code="620" - name="Portugal" - official_name="Portuguese Republic"/> - <iso_3166_entry - alpha_2_code="PR" - alpha_3_code="PRI" - numeric_code="630" - name="Puerto Rico"/> - <iso_3166_entry - alpha_2_code="QA" - alpha_3_code="QAT" - numeric_code="634" - name="Qatar" - official_name="State of Qatar"/> - <iso_3166_entry - alpha_2_code="RE" - alpha_3_code="REU" - numeric_code="638" - name="Reunion"/> - <iso_3166_entry - alpha_2_code="RO" - alpha_3_code="ROU" - numeric_code="642" - name="Romania"/> - <iso_3166_entry - alpha_2_code="RU" - alpha_3_code="RUS" - numeric_code="643" - name="Russian Federation"/> - <iso_3166_entry - alpha_2_code="RW" - alpha_3_code="RWA" - numeric_code="646" - name="Rwanda" - official_name="Rwandese Republic"/> - <iso_3166_entry - alpha_2_code="BL" - alpha_3_code="BLM" - numeric_code="652" - name="Saint Barthélemy"/> - <iso_3166_entry - alpha_2_code="SH" - alpha_3_code="SHN" - numeric_code="654" - name="Saint Helena, Ascension and Tristan da Cunha"/> - <iso_3166_entry - alpha_2_code="KN" - alpha_3_code="KNA" - numeric_code="659" - name="Saint Kitts and Nevis"/> - <iso_3166_entry - alpha_2_code="LC" - alpha_3_code="LCA" - numeric_code="662" - name="Saint Lucia"/> - <iso_3166_entry - alpha_2_code="MF" - alpha_3_code="MAF" - numeric_code="663" - name="Saint Martin (French part)"/> - <iso_3166_entry - alpha_2_code="PM" - alpha_3_code="SPM" - numeric_code="666" - name="Saint Pierre and Miquelon"/> - <iso_3166_entry - alpha_2_code="VC" - alpha_3_code="VCT" - numeric_code="670" - name="Saint Vincent and the Grenadines"/> - <iso_3166_entry - alpha_2_code="WS" - alpha_3_code="WSM" - numeric_code="882" - name="Samoa" - official_name="Independent State of Samoa"/> - <iso_3166_entry - alpha_2_code="SM" - alpha_3_code="SMR" - numeric_code="674" - name="San Marino" - official_name="Republic of San Marino"/> - <iso_3166_entry - alpha_2_code="ST" - alpha_3_code="STP" - numeric_code="678" - name="Sao Tome and Principe" - official_name="Democratic Republic of Sao Tome and Principe"/> - <iso_3166_entry - alpha_2_code="SA" - alpha_3_code="SAU" - numeric_code="682" - name="Saudi Arabia" - official_name="Kingdom of Saudi Arabia"/> - <iso_3166_entry - alpha_2_code="SN" - alpha_3_code="SEN" - numeric_code="686" - name="Senegal" - official_name="Republic of Senegal"/> - <iso_3166_entry - alpha_2_code="RS" - alpha_3_code="SRB" - numeric_code="688" - name="Serbia" - official_name="Republic of Serbia"/> - <iso_3166_entry - alpha_2_code="SC" - alpha_3_code="SYC" - numeric_code="690" - name="Seychelles" - official_name="Republic of Seychelles"/> - <iso_3166_entry - alpha_2_code="SL" - alpha_3_code="SLE" - numeric_code="694" - name="Sierra Leone" - official_name="Republic of Sierra Leone"/> - <iso_3166_entry - alpha_2_code="SG" - alpha_3_code="SGP" - numeric_code="702" - name="Singapore" - official_name="Republic of Singapore"/> - <iso_3166_entry - alpha_2_code="SX" - alpha_3_code="SXM" - numeric_code="702" - name="Sint Maarten" - official_name="Sint Maarten (Dutch part)"/> - <iso_3166_entry - alpha_2_code="SK" - alpha_3_code="SVK" - numeric_code="703" - name="Slovakia" - official_name="Slovak Republic"/> - <iso_3166_entry - alpha_2_code="SI" - alpha_3_code="SVN" - numeric_code="705" - name="Slovenia" - official_name="Republic of Slovenia"/> - <iso_3166_entry - alpha_2_code="SB" - alpha_3_code="SLB" - numeric_code="090" - name="Solomon Islands"/> - <iso_3166_entry - alpha_2_code="SO" - alpha_3_code="SOM" - numeric_code="706" - name="Somalia" - official_name="Somali Republic"/> - <iso_3166_entry - alpha_2_code="ZA" - alpha_3_code="ZAF" - numeric_code="710" - name="South Africa" - official_name="Republic of South Africa"/> - <iso_3166_entry - alpha_2_code="GS" - alpha_3_code="SGS" - numeric_code="239" - name="South Georgia and the South Sandwich Islands"/> - <iso_3166_entry - alpha_2_code="ES" - alpha_3_code="ESP" - numeric_code="724" - name="Spain" - official_name="Kingdom of Spain"/> - <iso_3166_entry - alpha_2_code="LK" - alpha_3_code="LKA" - numeric_code="144" - name="Sri Lanka" - official_name="Democratic Socialist Republic of Sri Lanka"/> - <iso_3166_entry - alpha_2_code="SD" - alpha_3_code="SDN" - numeric_code="736" - name="Sudan" - official_name="Republic of the Sudan"/> - <iso_3166_entry - alpha_2_code="SR" - alpha_3_code="SUR" - numeric_code="740" - name="Suriname" - official_name="Republic of Suriname"/> - <iso_3166_entry - alpha_2_code="SJ" - alpha_3_code="SJM" - numeric_code="744" - name="Svalbard and Jan Mayen"/> - <iso_3166_entry - alpha_2_code="SZ" - alpha_3_code="SWZ" - numeric_code="748" - name="Swaziland" - official_name="Kingdom of Swaziland"/> - <iso_3166_entry - alpha_2_code="SE" - alpha_3_code="SWE" - numeric_code="752" - name="Sweden" - official_name="Kingdom of Sweden"/> - <iso_3166_entry - alpha_2_code="CH" - alpha_3_code="CHE" - numeric_code="756" - name="Switzerland" - official_name="Swiss Confederation"/> - <iso_3166_entry - alpha_2_code="SY" - alpha_3_code="SYR" - numeric_code="760" - name="Syrian Arab Republic"/> - <iso_3166_entry - alpha_2_code="TW" - alpha_3_code="TWN" - numeric_code="158" - common_name="Taiwan" - name="Taiwan, Province of China" - official_name="Taiwan, Province of China"/> - <iso_3166_entry - alpha_2_code="TJ" - alpha_3_code="TJK" - numeric_code="762" - name="Tajikistan" - official_name="Republic of Tajikistan"/> - <iso_3166_entry - alpha_2_code="TZ" - alpha_3_code="TZA" - numeric_code="834" - name="Tanzania, United Republic of" - official_name="United Republic of Tanzania"/> - <iso_3166_entry - alpha_2_code="TH" - alpha_3_code="THA" - numeric_code="764" - name="Thailand" - official_name="Kingdom of Thailand"/> - <iso_3166_entry - alpha_2_code="TL" - alpha_3_code="TLS" - numeric_code="626" - name="Timor-Leste" - official_name="Democratic Republic of Timor-Leste"/> - <iso_3166_entry - alpha_2_code="TG" - alpha_3_code="TGO" - numeric_code="768" - name="Togo" - official_name="Togolese Republic"/> - <iso_3166_entry - alpha_2_code="TK" - alpha_3_code="TKL" - numeric_code="772" - name="Tokelau"/> - <iso_3166_entry - alpha_2_code="TO" - alpha_3_code="TON" - numeric_code="776" - name="Tonga" - official_name="Kingdom of Tonga"/> - <iso_3166_entry - alpha_2_code="TT" - alpha_3_code="TTO" - numeric_code="780" - name="Trinidad and Tobago" - official_name="Republic of Trinidad and Tobago"/> - <iso_3166_entry - alpha_2_code="TN" - alpha_3_code="TUN" - numeric_code="788" - name="Tunisia" - official_name="Republic of Tunisia"/> - <iso_3166_entry - alpha_2_code="TR" - alpha_3_code="TUR" - numeric_code="792" - name="Turkey" - official_name="Republic of Turkey"/> - <iso_3166_entry - alpha_2_code="TM" - alpha_3_code="TKM" - numeric_code="795" - name="Turkmenistan"/> - <iso_3166_entry - alpha_2_code="TC" - alpha_3_code="TCA" - numeric_code="796" - name="Turks and Caicos Islands"/> - <iso_3166_entry - alpha_2_code="TV" - alpha_3_code="TUV" - numeric_code="798" - name="Tuvalu"/> - <iso_3166_entry - alpha_2_code="UG" - alpha_3_code="UGA" - numeric_code="800" - name="Uganda" - official_name="Republic of Uganda"/> - <iso_3166_entry - alpha_2_code="UA" - alpha_3_code="UKR" - numeric_code="804" - name="Ukraine"/> - <iso_3166_entry - alpha_2_code="AE" - alpha_3_code="ARE" - numeric_code="784" - name="United Arab Emirates"/> - <iso_3166_entry - alpha_2_code="GB" - alpha_3_code="GBR" - numeric_code="826" - name="United Kingdom" - official_name="United Kingdom of Great Britain and Northern Ireland"/> - <iso_3166_entry - alpha_2_code="US" - alpha_3_code="USA" - numeric_code="840" - name="United States" - official_name="United States of America"/> - <iso_3166_entry - alpha_2_code="UM" - alpha_3_code="UMI" - numeric_code="581" - name="United States Minor Outlying Islands"/> - <iso_3166_entry - alpha_2_code="UY" - alpha_3_code="URY" - numeric_code="858" - name="Uruguay" - official_name="Eastern Republic of Uruguay"/> - <iso_3166_entry - alpha_2_code="UZ" - alpha_3_code="UZB" - numeric_code="860" - name="Uzbekistan" - official_name="Republic of Uzbekistan"/> - <iso_3166_entry - alpha_2_code="VU" - alpha_3_code="VUT" - numeric_code="548" - name="Vanuatu" - official_name="Republic of Vanuatu"/> - <iso_3166_entry - alpha_2_code="VE" - alpha_3_code="VEN" - numeric_code="862" - common_name="Venezuela" - name="Venezuela, Bolivarian republic of" - official_name="Bolivarian Republic of Venezuela"/> - <iso_3166_entry - alpha_2_code="VN" - alpha_3_code="VNM" - numeric_code="704" - name="Viet Nam" - official_name="Socialist Republic of Viet Nam"/> - <!-- FIXME CHECK OFFICIAL NAME --> - <iso_3166_entry - alpha_2_code="VG" - alpha_3_code="VGB" - numeric_code="092" - name="Virgin Islands, British" - official_name="British Virgin Islands"/> - <iso_3166_entry - alpha_2_code="VI" - alpha_3_code="VIR" - numeric_code="850" - name="Virgin Islands, U.S." - official_name="Virgin Islands of the United States"/> - <iso_3166_entry - alpha_2_code="WF" - alpha_3_code="WLF" - numeric_code="876" - name="Wallis and Futuna"/> - <iso_3166_entry - alpha_2_code="EH" - alpha_3_code="ESH" - numeric_code="732" - name="Western Sahara"/> - <iso_3166_entry - alpha_2_code="YE" - alpha_3_code="YEM" - numeric_code="887" - name="Yemen" - official_name="Republic of Yemen"/> - <iso_3166_entry - alpha_2_code="ZM" - alpha_3_code="ZMB" - numeric_code="894" - name="Zambia" - official_name="Republic of Zambia"/> - <iso_3166_entry - alpha_2_code="ZW" - alpha_3_code="ZWE" - numeric_code="716" - name="Zimbabwe" - official_name="Republic of Zimbabwe"/> - <iso_3166_3_entry - alpha_4_code="BQAQ" - alpha_3_code="ATB" - date_withdrawn="1979" - names="British Antarctic Territory"/> - <iso_3166_3_entry - alpha_4_code="BUMM" - alpha_3_code="BUR" - numeric_code="104" - date_withdrawn="1989-12-05" - names="Burma, Socialist Republic of the Union of"/> - <iso_3166_3_entry - alpha_4_code="BYAA" - alpha_3_code="BYS" - numeric_code="112" - date_withdrawn="1992-06-15" - names="Byelorussian SSR Soviet Socialist Republic"/> - <iso_3166_3_entry - alpha_4_code="CTKI" - alpha_3_code="CTE" - numeric_code="128" - date_withdrawn="1984" - names="Canton and Enderbury Islands"/> - <iso_3166_3_entry - alpha_4_code="CSHH" - alpha_3_code="CSK" - numeric_code="200" - date_withdrawn="1993-06-15" - names="Czechoslovakia, Czechoslovak Socialist Republic"/> - <iso_3166_3_entry - alpha_4_code="DYBJ" - alpha_3_code="DHY" - numeric_code="204" - date_withdrawn="1977" - names="Dahomey"/> - <iso_3166_3_entry - alpha_4_code="NQAQ" - alpha_3_code="ATN" - numeric_code="216" - date_withdrawn="1983" - names="Dronning Maud Land"/> - <iso_3166_3_entry - alpha_4_code="TPTL" - alpha_3_code="TMP" - numeric_code="626" - date_withdrawn="2002-05-20" - names="East Timor" - comment="was Portuguese Timor"/> - <iso_3166_3_entry - alpha_4_code="ET" - alpha_3_code="ETH" - numeric_code="230" - date_withdrawn="1993-07-16" - names="Ethiopia"/> - <iso_3166_3_entry - alpha_4_code="FXFR" - alpha_3_code="FXX" - numeric_code="249" - date_withdrawn="1997-07-14" - names="France, Metropolitan"/> - <iso_3166_3_entry - alpha_4_code="AIDJ" - alpha_3_code="AFI" - numeric_code="262" - date_withdrawn="1977" - names="French Afars and Issas"/> - <iso_3166_3_entry - alpha_4_code="FQHH" - alpha_3_code="ATF" - date_withdrawn="1979" - names="French Southern and Antarctic Territories" - comment="now split between AQ and TF"/> - <iso_3166_3_entry - alpha_4_code="DDDE" - alpha_3_code="DDR" - numeric_code="278" - date_withdrawn="1990-10-30" - names="German Democratic Republic"/> - <iso_3166_3_entry - alpha_4_code="DE" - alpha_3_code="DEU" - numeric_code="280" - date_withdrawn="1990-10-30" - names="Germany, Federal Republic of"/> - <iso_3166_3_entry - alpha_4_code="GEHH" - alpha_3_code="GEL" - numeric_code="296" - date_withdrawn="1979" - names="Gilbert and Ellice Islands" - comment="now split into Kiribati and Tuvalu"/> - <iso_3166_3_entry - alpha_4_code="JTUM" - alpha_3_code="JTN" - numeric_code="396" - date_withdrawn="1986" - names="Johnston Island"/> - <iso_3166_3_entry - alpha_4_code="MIUM" - alpha_3_code="MID" - numeric_code="488" - date_withdrawn="1986" - names="Midway Islands"/> - <iso_3166_3_entry - alpha_4_code="AN" - alpha_3_code="ANT" - numeric_code="532" - date_withdrawn="1993-07-12" - names="Netherlands Antilles"/> - <iso_3166_3_entry - alpha_4_code="NTHH" - alpha_3_code="NTZ" - numeric_code="536" - date_withdrawn="1993-07-12" - names="Neutral Zone" - comment="formerly between Saudi Arabia and Iraq"/> - <iso_3166_3_entry - alpha_4_code="NHVU" - alpha_3_code="NHB" - numeric_code="548" - date_withdrawn="1980" - names="New Hebrides"/> - <iso_3166_3_entry - alpha_4_code="PCHH" - alpha_3_code="PCI" - numeric_code="582" - date_withdrawn="1986" - names="Pacific Islands (trust territory)" - comment="divided into FM, MH, MP, and PW"/> - <iso_3166_3_entry - alpha_4_code="PA" - alpha_3_code="PAN" - numeric_code="590" - date_withdrawn="1993-07-22" - names="Panama, Republic of"/> - <iso_3166_3_entry - alpha_4_code="PZPA" - alpha_3_code="PCZ" - date_withdrawn="1980" - names="Panama Canal Zone"/> - <iso_3166_3_entry - alpha_4_code="RO" - alpha_3_code="ROM" - numeric_code="642" - date_withdrawn="2002-02-01" - names="Romania, Socialist Republic of"/> - <iso_3166_3_entry - alpha_4_code="KN" - alpha_3_code="KNA" - numeric_code="658" - date_withdrawn="1988" - names="St. Kitts-Nevis-Anguilla" - comment="now St. Kitts and Nevis and Anguilla"/> - <iso_3166_3_entry - alpha_4_code="CSXX" - alpha_3_code="SCG" - numeric_code="891" - date_withdrawn="2006-06-05" - names="Serbia and Montenegro"/> - <iso_3166_3_entry - alpha_4_code="SKIN" - alpha_3_code="SKM" - date_withdrawn="1975" - names="Sikkim"/> - <iso_3166_3_entry - alpha_4_code="RHZW" - alpha_3_code="RHO" - numeric_code="716" - date_withdrawn="1980" - names="Southern Rhodesia"/> - <iso_3166_3_entry - alpha_4_code="EH" - alpha_3_code="ESH" - numeric_code="732" - date_withdrawn="1988" - names="Spanish Sahara" - comment="now Western Sahara"/> - <iso_3166_3_entry - alpha_4_code="PUUM" - alpha_3_code="PUS" - numeric_code="849" - date_withdrawn="1986" - names="US Miscellaneous Pacific Islands"/> - <iso_3166_3_entry - alpha_4_code="SUHH" - alpha_3_code="SUN" - numeric_code="810" - date_withdrawn="1992-08-30" - names="USSR, Union of Soviet Socialist Republics"/> - <iso_3166_3_entry - alpha_4_code="HVBF" - alpha_3_code="HVO" - numeric_code="854" - date_withdrawn="1984" - names="Upper Volta, Republic of"/> - <iso_3166_3_entry - alpha_4_code="VA" - alpha_3_code="VAT" - numeric_code="336" - date_withdrawn="1996-04-03" - names="Vatican City State (Holy See)"/> - <iso_3166_3_entry - alpha_4_code="VDVN" - alpha_3_code="VDR" - date_withdrawn="1977" - names="Viet-Nam, Democratic Republic of"/> - <iso_3166_3_entry - alpha_4_code="WKUM" - alpha_3_code="WAK" - numeric_code="872" - date_withdrawn="1986" - names="Wake Island"/> - <iso_3166_3_entry - alpha_4_code="YDYE" - alpha_3_code="YMD" - numeric_code="720" - date_withdrawn="1990-08-14" - names="Yemen, Democratic, People's Democratic Republic of"/> - <iso_3166_3_entry - alpha_4_code="YE" - alpha_3_code="YEM" - numeric_code="891" - date_withdrawn="1990-08-14" - names="Yemen, Yemen Arab Republic"/> - <iso_3166_3_entry - alpha_4_code="YUCS" - alpha_3_code="YUG" - numeric_code="891" - date_withdrawn="1993-07-28" - names="Yugoslavia, Socialist Federal Republic of"/> - <iso_3166_3_entry - alpha_4_code="ZRCD" - alpha_3_code="ZAR" - numeric_code="180" - date_withdrawn="1997-07-14" - names="Zaire, Republic of"/> + <iso_3166_entry + alpha_2_code="AF" + alpha_3_code="AFG" + numeric_code="004" + name="Afghanistan" + official_name="Islamic Republic of Afghanistan"/> + <iso_3166_entry + alpha_2_code="AX" + alpha_3_code="ALA" + numeric_code="248" + name="Åland Islands"/> + <iso_3166_entry + alpha_2_code="AL" + alpha_3_code="ALB" + numeric_code="008" + name="Albania" + official_name="Republic of Albania"/> + <iso_3166_entry + alpha_2_code="DZ" + alpha_3_code="DZA" + numeric_code="012" + name="Algeria" + official_name="People's Democratic Republic of Algeria"/> + <iso_3166_entry + alpha_2_code="AS" + alpha_3_code="ASM" + numeric_code="016" + name="American Samoa"/> + <iso_3166_entry + alpha_2_code="AD" + alpha_3_code="AND" + numeric_code="020" + name="Andorra" + official_name="Principality of Andorra"/> + <iso_3166_entry + alpha_2_code="AO" + alpha_3_code="AGO" + numeric_code="024" + name="Angola" + official_name="Republic of Angola"/> + <iso_3166_entry + alpha_2_code="AI" + alpha_3_code="AIA" + numeric_code="660" + name="Anguilla"/> + <iso_3166_entry + alpha_2_code="AQ" + alpha_3_code="ATA" + numeric_code="010" + name="Antarctica"/> + <iso_3166_entry + alpha_2_code="AG" + alpha_3_code="ATG" + numeric_code="028" + name="Antigua and Barbuda"/> + <iso_3166_entry + alpha_2_code="AR" + alpha_3_code="ARG" + numeric_code="032" + name="Argentina" + official_name="Argentine Republic"/> + <iso_3166_entry + alpha_2_code="AM" + alpha_3_code="ARM" + numeric_code="051" + name="Armenia" + official_name="Republic of Armenia"/> + <iso_3166_entry + alpha_2_code="AW" + alpha_3_code="ABW" + numeric_code="533" + name="Aruba"/> + <iso_3166_entry + alpha_2_code="AU" + alpha_3_code="AUS" + numeric_code="036" + name="Australia"/> + <iso_3166_entry + alpha_2_code="AT" + alpha_3_code="AUT" + numeric_code="040" + name="Austria" + official_name="Republic of Austria"/> + <iso_3166_entry + alpha_2_code="AZ" + alpha_3_code="AZE" + numeric_code="031" + name="Azerbaijan" + official_name="Republic of Azerbaijan"/> + <iso_3166_entry + alpha_2_code="BS" + alpha_3_code="BHS" + numeric_code="044" + name="Bahamas" + official_name="Commonwealth of the Bahamas"/> + <iso_3166_entry + alpha_2_code="BH" + alpha_3_code="BHR" + numeric_code="048" + name="Bahrain" + official_name="Kingdom of Bahrain"/> + <iso_3166_entry + alpha_2_code="BD" + alpha_3_code="BGD" + numeric_code="050" + name="Bangladesh" + official_name="People's Republic of Bangladesh"/> + <iso_3166_entry + alpha_2_code="BB" + alpha_3_code="BRB" + numeric_code="052" + name="Barbados"/> + <iso_3166_entry + alpha_2_code="BY" + alpha_3_code="BLR" + numeric_code="112" + name="Belarus" + official_name="Republic of Belarus"/> + <iso_3166_entry + alpha_2_code="BE" + alpha_3_code="BEL" + numeric_code="056" + name="Belgium" + official_name="Kingdom of Belgium"/> + <iso_3166_entry + alpha_2_code="BZ" + alpha_3_code="BLZ" + numeric_code="084" + name="Belize"/> + <iso_3166_entry + alpha_2_code="BJ" + alpha_3_code="BEN" + numeric_code="204" + name="Benin" + official_name="Republic of Benin"/> + <iso_3166_entry + alpha_2_code="BM" + alpha_3_code="BMU" + numeric_code="060" + name="Bermuda"/> + <iso_3166_entry + alpha_2_code="BT" + alpha_3_code="BTN" + numeric_code="064" + name="Bhutan" + official_name="Kingdom of Bhutan"/> + <iso_3166_entry + alpha_2_code="BO" + alpha_3_code="BOL" + numeric_code="068" + common_name="Bolivia" + name="Bolivia, Plurinational State of" + official_name="Plurinational State of Bolivia"/> + <iso_3166_entry + alpha_2_code="BQ" + alpha_3_code="BES" + numeric_code="535" + name="Bonaire, Saint Eustatius and Saba" + official_name="Bonaire, Saint Eustatius and Saba"/> + <iso_3166_entry + alpha_2_code="BA" + alpha_3_code="BIH" + numeric_code="070" + name="Bosnia and Herzegovina" + official_name="Republic of Bosnia and Herzegovina"/> + <iso_3166_entry + alpha_2_code="BW" + alpha_3_code="BWA" + numeric_code="072" + name="Botswana" + official_name="Republic of Botswana"/> + <iso_3166_entry + alpha_2_code="BV" + alpha_3_code="BVT" + numeric_code="074" + name="Bouvet Island"/> + <iso_3166_entry + alpha_2_code="BR" + alpha_3_code="BRA" + numeric_code="076" + name="Brazil" + official_name="Federative Republic of Brazil"/> + <iso_3166_entry + alpha_2_code="IO" + alpha_3_code="IOT" + numeric_code="086" + name="British Indian Ocean Territory"/> + <iso_3166_entry + alpha_2_code="BN" + alpha_3_code="BRN" + numeric_code="096" + name="Brunei Darussalam"/> + <iso_3166_entry + alpha_2_code="BG" + alpha_3_code="BGR" + numeric_code="100" + name="Bulgaria" + official_name="Republic of Bulgaria"/> + <iso_3166_entry + alpha_2_code="BF" + alpha_3_code="BFA" + numeric_code="854" + name="Burkina Faso"/> + <iso_3166_entry + alpha_2_code="BI" + alpha_3_code="BDI" + numeric_code="108" + name="Burundi" + official_name="Republic of Burundi"/> + <iso_3166_entry + alpha_2_code="KH" + alpha_3_code="KHM" + numeric_code="116" + name="Cambodia" + official_name="Kingdom of Cambodia"/> + <iso_3166_entry + alpha_2_code="CM" + alpha_3_code="CMR" + numeric_code="120" + name="Cameroon" + official_name="Republic of Cameroon"/> + <iso_3166_entry + alpha_2_code="CA" + alpha_3_code="CAN" + numeric_code="124" + name="Canada"/> + <iso_3166_entry + alpha_2_code="CV" + alpha_3_code="CPV" + numeric_code="132" + name="Cape Verde" + official_name="Republic of Cape Verde"/> + <iso_3166_entry + alpha_2_code="KY" + alpha_3_code="CYM" + numeric_code="136" + name="Cayman Islands"/> + <iso_3166_entry + alpha_2_code="CF" + alpha_3_code="CAF" + numeric_code="140" + name="Central African Republic"/> + <iso_3166_entry + alpha_2_code="TD" + alpha_3_code="TCD" + numeric_code="148" + name="Chad" + official_name="Republic of Chad"/> + <iso_3166_entry + alpha_2_code="CL" + alpha_3_code="CHL" + numeric_code="152" + name="Chile" + official_name="Republic of Chile"/> + <iso_3166_entry + alpha_2_code="CN" + alpha_3_code="CHN" + numeric_code="156" + name="China" + official_name="People's Republic of China"/> + <iso_3166_entry + alpha_2_code="CX" + alpha_3_code="CXR" + numeric_code="162" + name="Christmas Island"/> + <iso_3166_entry + alpha_2_code="CC" + alpha_3_code="CCK" + numeric_code="166" + name="Cocos (Keeling) Islands"/> + <iso_3166_entry + alpha_2_code="CO" + alpha_3_code="COL" + numeric_code="170" + name="Colombia" + official_name="Republic of Colombia"/> + <iso_3166_entry + alpha_2_code="KM" + alpha_3_code="COM" + numeric_code="174" + name="Comoros" + official_name="Union of the Comoros"/> + <iso_3166_entry + alpha_2_code="CG" + alpha_3_code="COG" + numeric_code="178" + name="Congo" + official_name="Republic of the Congo"/> + <iso_3166_entry + alpha_2_code="CD" + alpha_3_code="COD" + numeric_code="180" + name="Congo, The Democratic Republic of the"/> + <iso_3166_entry + alpha_2_code="CK" + alpha_3_code="COK" + numeric_code="184" + name="Cook Islands"/> + <iso_3166_entry + alpha_2_code="CR" + alpha_3_code="CRI" + numeric_code="188" + name="Costa Rica" + official_name="Republic of Costa Rica"/> + <iso_3166_entry + alpha_2_code="CI" + alpha_3_code="CIV" + numeric_code="384" + name="Côte d'Ivoire" + official_name="Republic of Côte d'Ivoire"/> + <iso_3166_entry + alpha_2_code="HR" + alpha_3_code="HRV" + numeric_code="191" + name="Croatia" + official_name="Republic of Croatia"/> + <iso_3166_entry + alpha_2_code="CU" + alpha_3_code="CUB" + numeric_code="192" + name="Cuba" + official_name="Republic of Cuba"/> + <iso_3166_entry + alpha_2_code="CW" + alpha_3_code="CUW" + numeric_code="531" + name="Curaçao" + official_name="Curaçao"/> + <iso_3166_entry + alpha_2_code="CY" + alpha_3_code="CYP" + numeric_code="196" + name="Cyprus" + official_name="Republic of Cyprus"/> + <iso_3166_entry + alpha_2_code="CZ" + alpha_3_code="CZE" + numeric_code="203" + name="Czech Republic"/> + <iso_3166_entry + alpha_2_code="DK" + alpha_3_code="DNK" + numeric_code="208" + name="Denmark" + official_name="Kingdom of Denmark"/> + <iso_3166_entry + alpha_2_code="DJ" + alpha_3_code="DJI" + numeric_code="262" + name="Djibouti" + official_name="Republic of Djibouti"/> + <iso_3166_entry + alpha_2_code="DM" + alpha_3_code="DMA" + numeric_code="212" + name="Dominica" + official_name="Commonwealth of Dominica"/> + <iso_3166_entry + alpha_2_code="DO" + alpha_3_code="DOM" + numeric_code="214" + name="Dominican Republic"/> + <iso_3166_entry + alpha_2_code="EC" + alpha_3_code="ECU" + numeric_code="218" + name="Ecuador" + official_name="Republic of Ecuador"/> + <iso_3166_entry + alpha_2_code="EG" + alpha_3_code="EGY" + numeric_code="818" + name="Egypt" + official_name="Arab Republic of Egypt"/> + <iso_3166_entry + alpha_2_code="SV" + alpha_3_code="SLV" + numeric_code="222" + name="El Salvador" + official_name="Republic of El Salvador"/> + <iso_3166_entry + alpha_2_code="GQ" + alpha_3_code="GNQ" + numeric_code="226" + name="Equatorial Guinea" + official_name="Republic of Equatorial Guinea"/> + <iso_3166_entry + alpha_2_code="ER" + alpha_3_code="ERI" + numeric_code="232" + name="Eritrea"/> + <iso_3166_entry + alpha_2_code="EE" + alpha_3_code="EST" + numeric_code="233" + name="Estonia" + official_name="Republic of Estonia"/> + <iso_3166_entry + alpha_2_code="ET" + alpha_3_code="ETH" + numeric_code="231" + name="Ethiopia" + official_name="Federal Democratic Republic of Ethiopia"/> + <iso_3166_entry + alpha_2_code="FK" + alpha_3_code="FLK" + numeric_code="238" + name="Falkland Islands (Malvinas)"/> + <iso_3166_entry + alpha_2_code="FO" + alpha_3_code="FRO" + numeric_code="234" + name="Faroe Islands"/> + <iso_3166_entry + alpha_2_code="FJ" + alpha_3_code="FJI" + numeric_code="242" + name="Fiji" + official_name="Republic of the Fiji Islands"/> + <iso_3166_entry + alpha_2_code="FI" + alpha_3_code="FIN" + numeric_code="246" + name="Finland" + official_name="Republic of Finland"/> + <iso_3166_entry + alpha_2_code="FR" + alpha_3_code="FRA" + numeric_code="250" + name="France" + official_name="French Republic"/> + <iso_3166_entry + alpha_2_code="GF" + alpha_3_code="GUF" + numeric_code="254" + name="French Guiana"/> + <iso_3166_entry + alpha_2_code="PF" + alpha_3_code="PYF" + numeric_code="258" + name="French Polynesia"/> + <iso_3166_entry + alpha_2_code="TF" + alpha_3_code="ATF" + numeric_code="260" + name="French Southern Territories"/> + <iso_3166_entry + alpha_2_code="GA" + alpha_3_code="GAB" + numeric_code="266" + name="Gabon" + official_name="Gabonese Republic"/> + <iso_3166_entry + alpha_2_code="GM" + alpha_3_code="GMB" + numeric_code="270" + name="Gambia" + official_name="Republic of the Gambia"/> + <iso_3166_entry + alpha_2_code="GE" + alpha_3_code="GEO" + numeric_code="268" + name="Georgia"/> + <iso_3166_entry + alpha_2_code="DE" + alpha_3_code="DEU" + numeric_code="276" + name="Germany" + official_name="Federal Republic of Germany"/> + <iso_3166_entry + alpha_2_code="GH" + alpha_3_code="GHA" + numeric_code="288" + name="Ghana" + official_name="Republic of Ghana"/> + <iso_3166_entry + alpha_2_code="GI" + alpha_3_code="GIB" + numeric_code="292" + name="Gibraltar"/> + <iso_3166_entry + alpha_2_code="GR" + alpha_3_code="GRC" + numeric_code="300" + name="Greece" + official_name="Hellenic Republic"/> + <iso_3166_entry + alpha_2_code="GL" + alpha_3_code="GRL" + numeric_code="304" + name="Greenland"/> + <iso_3166_entry + alpha_2_code="GD" + alpha_3_code="GRD" + numeric_code="308" + name="Grenada"/> + <iso_3166_entry + alpha_2_code="GP" + alpha_3_code="GLP" + numeric_code="312" + name="Guadeloupe"/> + <iso_3166_entry + alpha_2_code="GU" + alpha_3_code="GUM" + numeric_code="316" + name="Guam"/> + <iso_3166_entry + alpha_2_code="GT" + alpha_3_code="GTM" + numeric_code="320" + name="Guatemala" + official_name="Republic of Guatemala"/> + <iso_3166_entry + alpha_2_code="GG" + alpha_3_code="GGY" + numeric_code="831" + name="Guernsey"/> + <iso_3166_entry + alpha_2_code="GN" + alpha_3_code="GIN" + numeric_code="324" + name="Guinea" + official_name="Republic of Guinea"/> + <iso_3166_entry + alpha_2_code="GW" + alpha_3_code="GNB" + numeric_code="624" + name="Guinea-Bissau" + official_name="Republic of Guinea-Bissau"/> + <iso_3166_entry + alpha_2_code="GY" + alpha_3_code="GUY" + numeric_code="328" + name="Guyana" + official_name="Republic of Guyana"/> + <iso_3166_entry + alpha_2_code="HT" + alpha_3_code="HTI" + numeric_code="332" + name="Haiti" + official_name="Republic of Haiti"/> + <iso_3166_entry + alpha_2_code="HM" + alpha_3_code="HMD" + numeric_code="334" + name="Heard Island and McDonald Islands"/> + <iso_3166_entry + alpha_2_code="VA" + alpha_3_code="VAT" + numeric_code="336" + name="Holy See (Vatican City State)"/> + <iso_3166_entry + alpha_2_code="HN" + alpha_3_code="HND" + numeric_code="340" + name="Honduras" + official_name="Republic of Honduras"/> + <iso_3166_entry + alpha_2_code="HK" + alpha_3_code="HKG" + numeric_code="344" + name="Hong Kong" + official_name="Hong Kong Special Administrative Region of China"/> + <iso_3166_entry + alpha_2_code="HU" + alpha_3_code="HUN" + numeric_code="348" + name="Hungary" + official_name="Republic of Hungary"/> + <iso_3166_entry + alpha_2_code="IS" + alpha_3_code="ISL" + numeric_code="352" + name="Iceland" + official_name="Republic of Iceland"/> + <iso_3166_entry + alpha_2_code="IN" + alpha_3_code="IND" + numeric_code="356" + name="India" + official_name="Republic of India"/> + <iso_3166_entry + alpha_2_code="ID" + alpha_3_code="IDN" + numeric_code="360" + name="Indonesia" + official_name="Republic of Indonesia"/> + <iso_3166_entry + alpha_2_code="IR" + alpha_3_code="IRN" + numeric_code="364" + name="Iran, Islamic Republic of" + official_name="Islamic Republic of Iran"/> + <iso_3166_entry + alpha_2_code="IQ" + alpha_3_code="IRQ" + numeric_code="368" + name="Iraq" + official_name="Republic of Iraq"/> + <iso_3166_entry + alpha_2_code="IE" + alpha_3_code="IRL" + numeric_code="372" + name="Ireland"/> + <iso_3166_entry + alpha_2_code="IM" + alpha_3_code="IMN" + numeric_code="833" + name="Isle of Man"/> + <iso_3166_entry + alpha_2_code="IL" + alpha_3_code="ISR" + numeric_code="376" + name="Israel" + official_name="State of Israel"/> + <iso_3166_entry + alpha_2_code="IT" + alpha_3_code="ITA" + numeric_code="380" + name="Italy" + official_name="Italian Republic"/> + <iso_3166_entry + alpha_2_code="JM" + alpha_3_code="JAM" + numeric_code="388" + name="Jamaica"/> + <iso_3166_entry + alpha_2_code="JP" + alpha_3_code="JPN" + numeric_code="392" + name="Japan"/> + <iso_3166_entry + alpha_2_code="JE" + alpha_3_code="JEY" + numeric_code="832" + name="Jersey"/> + <iso_3166_entry + alpha_2_code="JO" + alpha_3_code="JOR" + numeric_code="400" + name="Jordan" + official_name="Hashemite Kingdom of Jordan"/> + <iso_3166_entry + alpha_2_code="KZ" + alpha_3_code="KAZ" + numeric_code="398" + name="Kazakhstan" + official_name="Republic of Kazakhstan"/> + <iso_3166_entry + alpha_2_code="KE" + alpha_3_code="KEN" + numeric_code="404" + name="Kenya" + official_name="Republic of Kenya"/> + <iso_3166_entry + alpha_2_code="KI" + alpha_3_code="KIR" + numeric_code="296" + name="Kiribati" + official_name="Republic of Kiribati"/> + <iso_3166_entry + alpha_2_code="KP" + alpha_3_code="PRK" + numeric_code="408" + name="Korea, Democratic People's Republic of" + official_name="Democratic People's Republic of Korea"/> + <iso_3166_entry + alpha_2_code="KR" + alpha_3_code="KOR" + numeric_code="410" + name="Korea, Republic of"/> + <iso_3166_entry + alpha_2_code="KW" + alpha_3_code="KWT" + numeric_code="414" + name="Kuwait" + official_name="State of Kuwait"/> + <iso_3166_entry + alpha_2_code="KG" + alpha_3_code="KGZ" + numeric_code="417" + name="Kyrgyzstan" + official_name="Kyrgyz Republic"/> + <iso_3166_entry + alpha_2_code="LA" + alpha_3_code="LAO" + numeric_code="418" + name="Lao People's Democratic Republic"/> + <iso_3166_entry + alpha_2_code="LV" + alpha_3_code="LVA" + numeric_code="428" + name="Latvia" + official_name="Republic of Latvia"/> + <iso_3166_entry + alpha_2_code="LB" + alpha_3_code="LBN" + numeric_code="422" + name="Lebanon" + official_name="Lebanese Republic"/> + <iso_3166_entry + alpha_2_code="LS" + alpha_3_code="LSO" + numeric_code="426" + name="Lesotho" + official_name="Kingdom of Lesotho"/> + <iso_3166_entry + alpha_2_code="LR" + alpha_3_code="LBR" + numeric_code="430" + name="Liberia" + official_name="Republic of Liberia"/> + <iso_3166_entry + alpha_2_code="LY" + alpha_3_code="LBY" + numeric_code="434" + common_name="Libya" + name="Libyan Arab Jamahiriya" + official_name="Socialist People's Libyan Arab Jamahiriya"/> + <iso_3166_entry + alpha_2_code="LI" + alpha_3_code="LIE" + numeric_code="438" + name="Liechtenstein" + official_name="Principality of Liechtenstein"/> + <iso_3166_entry + alpha_2_code="LT" + alpha_3_code="LTU" + numeric_code="440" + name="Lithuania" + official_name="Republic of Lithuania"/> + <iso_3166_entry + alpha_2_code="LU" + alpha_3_code="LUX" + numeric_code="442" + name="Luxembourg" + official_name="Grand Duchy of Luxembourg"/> + <iso_3166_entry + alpha_2_code="MO" + alpha_3_code="MAC" + numeric_code="446" + name="Macao" + official_name="Macao Special Administrative Region of China"/> + <iso_3166_entry + alpha_2_code="MK" + alpha_3_code="MKD" + numeric_code="807" + name="Macedonia, Republic of" + official_name="The Former Yugoslav Republic of Macedonia"/> + <iso_3166_entry + alpha_2_code="MG" + alpha_3_code="MDG" + numeric_code="450" + name="Madagascar" + official_name="Republic of Madagascar"/> + <iso_3166_entry + alpha_2_code="MW" + alpha_3_code="MWI" + numeric_code="454" + name="Malawi" + official_name="Republic of Malawi"/> + <iso_3166_entry + alpha_2_code="MY" + alpha_3_code="MYS" + numeric_code="458" + name="Malaysia"/> + <iso_3166_entry + alpha_2_code="MV" + alpha_3_code="MDV" + numeric_code="462" + name="Maldives" + official_name="Republic of Maldives"/> + <iso_3166_entry + alpha_2_code="ML" + alpha_3_code="MLI" + numeric_code="466" + name="Mali" + official_name="Republic of Mali"/> + <iso_3166_entry + alpha_2_code="MT" + alpha_3_code="MLT" + numeric_code="470" + name="Malta" + official_name="Republic of Malta"/> + <iso_3166_entry + alpha_2_code="MH" + alpha_3_code="MHL" + numeric_code="584" + name="Marshall Islands" + official_name="Republic of the Marshall Islands"/> + <iso_3166_entry + alpha_2_code="MQ" + alpha_3_code="MTQ" + numeric_code="474" + name="Martinique"/> + <iso_3166_entry + alpha_2_code="MR" + alpha_3_code="MRT" + numeric_code="478" + name="Mauritania" + official_name="Islamic Republic of Mauritania"/> + <iso_3166_entry + alpha_2_code="MU" + alpha_3_code="MUS" + numeric_code="480" + name="Mauritius" + official_name="Republic of Mauritius"/> + <iso_3166_entry + alpha_2_code="YT" + alpha_3_code="MYT" + numeric_code="175" + name="Mayotte"/> + <iso_3166_entry + alpha_2_code="MX" + alpha_3_code="MEX" + numeric_code="484" + name="Mexico" + official_name="United Mexican States"/> + <iso_3166_entry + alpha_2_code="FM" + alpha_3_code="FSM" + numeric_code="583" + name="Micronesia, Federated States of" + official_name="Federated States of Micronesia"/> + <iso_3166_entry + alpha_2_code="MD" + alpha_3_code="MDA" + numeric_code="498" + common_name="Moldova" + name="Moldova, Republic of" + official_name="Republic of Moldova"/> + <iso_3166_entry + alpha_2_code="MC" + alpha_3_code="MCO" + numeric_code="492" + name="Monaco" + official_name="Principality of Monaco"/> + <iso_3166_entry + alpha_2_code="MN" + alpha_3_code="MNG" + numeric_code="496" + name="Mongolia"/> + <iso_3166_entry + alpha_2_code="ME" + alpha_3_code="MNE" + numeric_code="499" + name="Montenegro" + official_name="Montenegro"/> + <iso_3166_entry + alpha_2_code="MS" + alpha_3_code="MSR" + numeric_code="500" + name="Montserrat"/> + <iso_3166_entry + alpha_2_code="MA" + alpha_3_code="MAR" + numeric_code="504" + name="Morocco" + official_name="Kingdom of Morocco"/> + <iso_3166_entry + alpha_2_code="MZ" + alpha_3_code="MOZ" + numeric_code="508" + name="Mozambique" + official_name="Republic of Mozambique"/> + <iso_3166_entry + alpha_2_code="MM" + alpha_3_code="MMR" + numeric_code="104" + name="Myanmar" + official_name="Union of Myanmar"/> + <iso_3166_entry + alpha_2_code="NA" + alpha_3_code="NAM" + numeric_code="516" + name="Namibia" + official_name="Republic of Namibia"/> + <iso_3166_entry + alpha_2_code="NR" + alpha_3_code="NRU" + numeric_code="520" + name="Nauru" + official_name="Republic of Nauru"/> + <iso_3166_entry + alpha_2_code="NP" + alpha_3_code="NPL" + numeric_code="524" + name="Nepal" + official_name="Federal Democratic Republic of Nepal"/> + <iso_3166_entry + alpha_2_code="NL" + alpha_3_code="NLD" + numeric_code="528" + name="Netherlands" + official_name="Kingdom of the Netherlands"/> + <iso_3166_entry + alpha_2_code="NC" + alpha_3_code="NCL" + numeric_code="540" + name="New Caledonia"/> + <iso_3166_entry + alpha_2_code="NZ" + alpha_3_code="NZL" + numeric_code="554" + name="New Zealand"/> + <iso_3166_entry + alpha_2_code="NI" + alpha_3_code="NIC" + numeric_code="558" + name="Nicaragua" + official_name="Republic of Nicaragua"/> + <iso_3166_entry + alpha_2_code="NE" + alpha_3_code="NER" + numeric_code="562" + name="Niger" + official_name="Republic of the Niger"/> + <iso_3166_entry + alpha_2_code="NG" + alpha_3_code="NGA" + numeric_code="566" + name="Nigeria" + official_name="Federal Republic of Nigeria"/> + <iso_3166_entry + alpha_2_code="NU" + alpha_3_code="NIU" + numeric_code="570" + name="Niue" + official_name="Republic of Niue"/> + <iso_3166_entry + alpha_2_code="NF" + alpha_3_code="NFK" + numeric_code="574" + name="Norfolk Island"/> + <iso_3166_entry + alpha_2_code="MP" + alpha_3_code="MNP" + numeric_code="580" + name="Northern Mariana Islands" + official_name="Commonwealth of the Northern Mariana Islands"/> + <iso_3166_entry + alpha_2_code="NO" + alpha_3_code="NOR" + numeric_code="578" + name="Norway" + official_name="Kingdom of Norway"/> + <iso_3166_entry + alpha_2_code="OM" + alpha_3_code="OMN" + numeric_code="512" + name="Oman" + official_name="Sultanate of Oman"/> + <iso_3166_entry + alpha_2_code="PK" + alpha_3_code="PAK" + numeric_code="586" + name="Pakistan" + official_name="Islamic Republic of Pakistan"/> + <iso_3166_entry + alpha_2_code="PW" + alpha_3_code="PLW" + numeric_code="585" + name="Palau" + official_name="Republic of Palau"/> + <iso_3166_entry + alpha_2_code="PS" + alpha_3_code="PSE" + numeric_code="275" + name="Palestinian Territory, Occupied" + official_name="Occupied Palestinian Territory"/> + <iso_3166_entry + alpha_2_code="PA" + alpha_3_code="PAN" + numeric_code="591" + name="Panama" + official_name="Republic of Panama"/> + <iso_3166_entry + alpha_2_code="PG" + alpha_3_code="PNG" + numeric_code="598" + name="Papua New Guinea"/> + <iso_3166_entry + alpha_2_code="PY" + alpha_3_code="PRY" + numeric_code="600" + name="Paraguay" + official_name="Republic of Paraguay"/> + <iso_3166_entry + alpha_2_code="PE" + alpha_3_code="PER" + numeric_code="604" + name="Peru" + official_name="Republic of Peru"/> + <iso_3166_entry + alpha_2_code="PH" + alpha_3_code="PHL" + numeric_code="608" + name="Philippines" + official_name="Republic of the Philippines"/> + <iso_3166_entry + alpha_2_code="PN" + alpha_3_code="PCN" + numeric_code="612" + name="Pitcairn"/> + <iso_3166_entry + alpha_2_code="PL" + alpha_3_code="POL" + numeric_code="616" + name="Poland" + official_name="Republic of Poland"/> + <iso_3166_entry + alpha_2_code="PT" + alpha_3_code="PRT" + numeric_code="620" + name="Portugal" + official_name="Portuguese Republic"/> + <iso_3166_entry + alpha_2_code="PR" + alpha_3_code="PRI" + numeric_code="630" + name="Puerto Rico"/> + <iso_3166_entry + alpha_2_code="QA" + alpha_3_code="QAT" + numeric_code="634" + name="Qatar" + official_name="State of Qatar"/> + <iso_3166_entry + alpha_2_code="RE" + alpha_3_code="REU" + numeric_code="638" + name="Reunion"/> + <iso_3166_entry + alpha_2_code="RO" + alpha_3_code="ROU" + numeric_code="642" + name="Romania"/> + <iso_3166_entry + alpha_2_code="RU" + alpha_3_code="RUS" + numeric_code="643" + name="Russian Federation"/> + <iso_3166_entry + alpha_2_code="RW" + alpha_3_code="RWA" + numeric_code="646" + name="Rwanda" + official_name="Rwandese Republic"/> + <iso_3166_entry + alpha_2_code="BL" + alpha_3_code="BLM" + numeric_code="652" + name="Saint Barthélemy"/> + <iso_3166_entry + alpha_2_code="SH" + alpha_3_code="SHN" + numeric_code="654" + name="Saint Helena, Ascension and Tristan da Cunha"/> + <iso_3166_entry + alpha_2_code="KN" + alpha_3_code="KNA" + numeric_code="659" + name="Saint Kitts and Nevis"/> + <iso_3166_entry + alpha_2_code="LC" + alpha_3_code="LCA" + numeric_code="662" + name="Saint Lucia"/> + <iso_3166_entry + alpha_2_code="MF" + alpha_3_code="MAF" + numeric_code="663" + name="Saint Martin (French part)"/> + <iso_3166_entry + alpha_2_code="PM" + alpha_3_code="SPM" + numeric_code="666" + name="Saint Pierre and Miquelon"/> + <iso_3166_entry + alpha_2_code="VC" + alpha_3_code="VCT" + numeric_code="670" + name="Saint Vincent and the Grenadines"/> + <iso_3166_entry + alpha_2_code="WS" + alpha_3_code="WSM" + numeric_code="882" + name="Samoa" + official_name="Independent State of Samoa"/> + <iso_3166_entry + alpha_2_code="SM" + alpha_3_code="SMR" + numeric_code="674" + name="San Marino" + official_name="Republic of San Marino"/> + <iso_3166_entry + alpha_2_code="ST" + alpha_3_code="STP" + numeric_code="678" + name="Sao Tome and Principe" + official_name="Democratic Republic of Sao Tome and Principe"/> + <iso_3166_entry + alpha_2_code="SA" + alpha_3_code="SAU" + numeric_code="682" + name="Saudi Arabia" + official_name="Kingdom of Saudi Arabia"/> + <iso_3166_entry + alpha_2_code="SN" + alpha_3_code="SEN" + numeric_code="686" + name="Senegal" + official_name="Republic of Senegal"/> + <iso_3166_entry + alpha_2_code="RS" + alpha_3_code="SRB" + numeric_code="688" + name="Serbia" + official_name="Republic of Serbia"/> + <iso_3166_entry + alpha_2_code="SC" + alpha_3_code="SYC" + numeric_code="690" + name="Seychelles" + official_name="Republic of Seychelles"/> + <iso_3166_entry + alpha_2_code="SL" + alpha_3_code="SLE" + numeric_code="694" + name="Sierra Leone" + official_name="Republic of Sierra Leone"/> + <iso_3166_entry + alpha_2_code="SG" + alpha_3_code="SGP" + numeric_code="702" + name="Singapore" + official_name="Republic of Singapore"/> + <iso_3166_entry + alpha_2_code="SX" + alpha_3_code="SXM" + numeric_code="702" + name="Sint Maarten" + official_name="Sint Maarten (Dutch part)"/> + <iso_3166_entry + alpha_2_code="SK" + alpha_3_code="SVK" + numeric_code="703" + name="Slovakia" + official_name="Slovak Republic"/> + <iso_3166_entry + alpha_2_code="SI" + alpha_3_code="SVN" + numeric_code="705" + name="Slovenia" + official_name="Republic of Slovenia"/> + <iso_3166_entry + alpha_2_code="SB" + alpha_3_code="SLB" + numeric_code="090" + name="Solomon Islands"/> + <iso_3166_entry + alpha_2_code="SO" + alpha_3_code="SOM" + numeric_code="706" + name="Somalia" + official_name="Somali Republic"/> + <iso_3166_entry + alpha_2_code="ZA" + alpha_3_code="ZAF" + numeric_code="710" + name="South Africa" + official_name="Republic of South Africa"/> + <iso_3166_entry + alpha_2_code="GS" + alpha_3_code="SGS" + numeric_code="239" + name="South Georgia and the South Sandwich Islands"/> + <iso_3166_entry + alpha_2_code="ES" + alpha_3_code="ESP" + numeric_code="724" + name="Spain" + official_name="Kingdom of Spain"/> + <iso_3166_entry + alpha_2_code="LK" + alpha_3_code="LKA" + numeric_code="144" + name="Sri Lanka" + official_name="Democratic Socialist Republic of Sri Lanka"/> + <iso_3166_entry + alpha_2_code="SD" + alpha_3_code="SDN" + numeric_code="736" + name="Sudan" + official_name="Republic of the Sudan"/> + <iso_3166_entry + alpha_2_code="SR" + alpha_3_code="SUR" + numeric_code="740" + name="Suriname" + official_name="Republic of Suriname"/> + <iso_3166_entry + alpha_2_code="SJ" + alpha_3_code="SJM" + numeric_code="744" + name="Svalbard and Jan Mayen"/> + <iso_3166_entry + alpha_2_code="SZ" + alpha_3_code="SWZ" + numeric_code="748" + name="Swaziland" + official_name="Kingdom of Swaziland"/> + <iso_3166_entry + alpha_2_code="SE" + alpha_3_code="SWE" + numeric_code="752" + name="Sweden" + official_name="Kingdom of Sweden"/> + <iso_3166_entry + alpha_2_code="CH" + alpha_3_code="CHE" + numeric_code="756" + name="Switzerland" + official_name="Swiss Confederation"/> + <iso_3166_entry + alpha_2_code="SY" + alpha_3_code="SYR" + numeric_code="760" + name="Syrian Arab Republic"/> + <iso_3166_entry + alpha_2_code="TW" + alpha_3_code="TWN" + numeric_code="158" + common_name="Taiwan" + name="Taiwan, Province of China" + official_name="Taiwan, Province of China"/> + <iso_3166_entry + alpha_2_code="TJ" + alpha_3_code="TJK" + numeric_code="762" + name="Tajikistan" + official_name="Republic of Tajikistan"/> + <iso_3166_entry + alpha_2_code="TZ" + alpha_3_code="TZA" + numeric_code="834" + name="Tanzania, United Republic of" + official_name="United Republic of Tanzania"/> + <iso_3166_entry + alpha_2_code="TH" + alpha_3_code="THA" + numeric_code="764" + name="Thailand" + official_name="Kingdom of Thailand"/> + <iso_3166_entry + alpha_2_code="TL" + alpha_3_code="TLS" + numeric_code="626" + name="Timor-Leste" + official_name="Democratic Republic of Timor-Leste"/> + <iso_3166_entry + alpha_2_code="TG" + alpha_3_code="TGO" + numeric_code="768" + name="Togo" + official_name="Togolese Republic"/> + <iso_3166_entry + alpha_2_code="TK" + alpha_3_code="TKL" + numeric_code="772" + name="Tokelau"/> + <iso_3166_entry + alpha_2_code="TO" + alpha_3_code="TON" + numeric_code="776" + name="Tonga" + official_name="Kingdom of Tonga"/> + <iso_3166_entry + alpha_2_code="TT" + alpha_3_code="TTO" + numeric_code="780" + name="Trinidad and Tobago" + official_name="Republic of Trinidad and Tobago"/> + <iso_3166_entry + alpha_2_code="TN" + alpha_3_code="TUN" + numeric_code="788" + name="Tunisia" + official_name="Republic of Tunisia"/> + <iso_3166_entry + alpha_2_code="TR" + alpha_3_code="TUR" + numeric_code="792" + name="Turkey" + official_name="Republic of Turkey"/> + <iso_3166_entry + alpha_2_code="TM" + alpha_3_code="TKM" + numeric_code="795" + name="Turkmenistan"/> + <iso_3166_entry + alpha_2_code="TC" + alpha_3_code="TCA" + numeric_code="796" + name="Turks and Caicos Islands"/> + <iso_3166_entry + alpha_2_code="TV" + alpha_3_code="TUV" + numeric_code="798" + name="Tuvalu"/> + <iso_3166_entry + alpha_2_code="UG" + alpha_3_code="UGA" + numeric_code="800" + name="Uganda" + official_name="Republic of Uganda"/> + <iso_3166_entry + alpha_2_code="UA" + alpha_3_code="UKR" + numeric_code="804" + name="Ukraine"/> + <iso_3166_entry + alpha_2_code="AE" + alpha_3_code="ARE" + numeric_code="784" + name="United Arab Emirates"/> + <iso_3166_entry + alpha_2_code="GB" + alpha_3_code="GBR" + numeric_code="826" + name="United Kingdom" + official_name="United Kingdom of Great Britain and Northern Ireland"/> + <iso_3166_entry + alpha_2_code="US" + alpha_3_code="USA" + numeric_code="840" + name="United States" + official_name="United States of America"/> + <iso_3166_entry + alpha_2_code="UM" + alpha_3_code="UMI" + numeric_code="581" + name="United States Minor Outlying Islands"/> + <iso_3166_entry + alpha_2_code="UY" + alpha_3_code="URY" + numeric_code="858" + name="Uruguay" + official_name="Eastern Republic of Uruguay"/> + <iso_3166_entry + alpha_2_code="UZ" + alpha_3_code="UZB" + numeric_code="860" + name="Uzbekistan" + official_name="Republic of Uzbekistan"/> + <iso_3166_entry + alpha_2_code="VU" + alpha_3_code="VUT" + numeric_code="548" + name="Vanuatu" + official_name="Republic of Vanuatu"/> + <iso_3166_entry + alpha_2_code="VE" + alpha_3_code="VEN" + numeric_code="862" + common_name="Venezuela" + name="Venezuela, Bolivarian republic of" + official_name="Bolivarian Republic of Venezuela"/> + <iso_3166_entry + alpha_2_code="VN" + alpha_3_code="VNM" + numeric_code="704" + name="Viet Nam" + official_name="Socialist Republic of Viet Nam"/> + <!-- FIXME CHECK OFFICIAL NAME --> + <iso_3166_entry + alpha_2_code="VG" + alpha_3_code="VGB" + numeric_code="092" + name="Virgin Islands, British" + official_name="British Virgin Islands"/> + <iso_3166_entry + alpha_2_code="VI" + alpha_3_code="VIR" + numeric_code="850" + name="Virgin Islands, U.S." + official_name="Virgin Islands of the United States"/> + <iso_3166_entry + alpha_2_code="WF" + alpha_3_code="WLF" + numeric_code="876" + name="Wallis and Futuna"/> + <iso_3166_entry + alpha_2_code="EH" + alpha_3_code="ESH" + numeric_code="732" + name="Western Sahara"/> + <iso_3166_entry + alpha_2_code="YE" + alpha_3_code="YEM" + numeric_code="887" + name="Yemen" + official_name="Republic of Yemen"/> + <iso_3166_entry + alpha_2_code="ZM" + alpha_3_code="ZMB" + numeric_code="894" + name="Zambia" + official_name="Republic of Zambia"/> + <iso_3166_entry + alpha_2_code="ZW" + alpha_3_code="ZWE" + numeric_code="716" + name="Zimbabwe" + official_name="Republic of Zimbabwe"/> + <iso_3166_3_entry + alpha_4_code="BQAQ" + alpha_3_code="ATB" + date_withdrawn="1979" + names="British Antarctic Territory"/> + <iso_3166_3_entry + alpha_4_code="BUMM" + alpha_3_code="BUR" + numeric_code="104" + date_withdrawn="1989-12-05" + names="Burma, Socialist Republic of the Union of"/> + <iso_3166_3_entry + alpha_4_code="BYAA" + alpha_3_code="BYS" + numeric_code="112" + date_withdrawn="1992-06-15" + names="Byelorussian SSR Soviet Socialist Republic"/> + <iso_3166_3_entry + alpha_4_code="CTKI" + alpha_3_code="CTE" + numeric_code="128" + date_withdrawn="1984" + names="Canton and Enderbury Islands"/> + <iso_3166_3_entry + alpha_4_code="CSHH" + alpha_3_code="CSK" + numeric_code="200" + date_withdrawn="1993-06-15" + names="Czechoslovakia, Czechoslovak Socialist Republic"/> + <iso_3166_3_entry + alpha_4_code="DYBJ" + alpha_3_code="DHY" + numeric_code="204" + date_withdrawn="1977" + names="Dahomey"/> + <iso_3166_3_entry + alpha_4_code="NQAQ" + alpha_3_code="ATN" + numeric_code="216" + date_withdrawn="1983" + names="Dronning Maud Land"/> + <iso_3166_3_entry + alpha_4_code="TPTL" + alpha_3_code="TMP" + numeric_code="626" + date_withdrawn="2002-05-20" + names="East Timor" + comment="was Portuguese Timor"/> + <iso_3166_3_entry + alpha_4_code="ET" + alpha_3_code="ETH" + numeric_code="230" + date_withdrawn="1993-07-16" + names="Ethiopia"/> + <iso_3166_3_entry + alpha_4_code="FXFR" + alpha_3_code="FXX" + numeric_code="249" + date_withdrawn="1997-07-14" + names="France, Metropolitan"/> + <iso_3166_3_entry + alpha_4_code="AIDJ" + alpha_3_code="AFI" + numeric_code="262" + date_withdrawn="1977" + names="French Afars and Issas"/> + <iso_3166_3_entry + alpha_4_code="FQHH" + alpha_3_code="ATF" + date_withdrawn="1979" + names="French Southern and Antarctic Territories" + comment="now split between AQ and TF"/> + <iso_3166_3_entry + alpha_4_code="DDDE" + alpha_3_code="DDR" + numeric_code="278" + date_withdrawn="1990-10-30" + names="German Democratic Republic"/> + <iso_3166_3_entry + alpha_4_code="DE" + alpha_3_code="DEU" + numeric_code="280" + date_withdrawn="1990-10-30" + names="Germany, Federal Republic of"/> + <iso_3166_3_entry + alpha_4_code="GEHH" + alpha_3_code="GEL" + numeric_code="296" + date_withdrawn="1979" + names="Gilbert and Ellice Islands" + comment="now split into Kiribati and Tuvalu"/> + <iso_3166_3_entry + alpha_4_code="JTUM" + alpha_3_code="JTN" + numeric_code="396" + date_withdrawn="1986" + names="Johnston Island"/> + <iso_3166_3_entry + alpha_4_code="MIUM" + alpha_3_code="MID" + numeric_code="488" + date_withdrawn="1986" + names="Midway Islands"/> + <iso_3166_3_entry + alpha_4_code="AN" + alpha_3_code="ANT" + numeric_code="532" + date_withdrawn="1993-07-12" + names="Netherlands Antilles"/> + <iso_3166_3_entry + alpha_4_code="NTHH" + alpha_3_code="NTZ" + numeric_code="536" + date_withdrawn="1993-07-12" + names="Neutral Zone" + comment="formerly between Saudi Arabia and Iraq"/> + <iso_3166_3_entry + alpha_4_code="NHVU" + alpha_3_code="NHB" + numeric_code="548" + date_withdrawn="1980" + names="New Hebrides"/> + <iso_3166_3_entry + alpha_4_code="PCHH" + alpha_3_code="PCI" + numeric_code="582" + date_withdrawn="1986" + names="Pacific Islands (trust territory)" + comment="divided into FM, MH, MP, and PW"/> + <iso_3166_3_entry + alpha_4_code="PA" + alpha_3_code="PAN" + numeric_code="590" + date_withdrawn="1993-07-22" + names="Panama, Republic of"/> + <iso_3166_3_entry + alpha_4_code="PZPA" + alpha_3_code="PCZ" + date_withdrawn="1980" + names="Panama Canal Zone"/> + <iso_3166_3_entry + alpha_4_code="RO" + alpha_3_code="ROM" + numeric_code="642" + date_withdrawn="2002-02-01" + names="Romania, Socialist Republic of"/> + <iso_3166_3_entry + alpha_4_code="KN" + alpha_3_code="KNA" + numeric_code="658" + date_withdrawn="1988" + names="St. Kitts-Nevis-Anguilla" + comment="now St. Kitts and Nevis and Anguilla"/> + <iso_3166_3_entry + alpha_4_code="CSXX" + alpha_3_code="SCG" + numeric_code="891" + date_withdrawn="2006-06-05" + names="Serbia and Montenegro"/> + <iso_3166_3_entry + alpha_4_code="SKIN" + alpha_3_code="SKM" + date_withdrawn="1975" + names="Sikkim"/> + <iso_3166_3_entry + alpha_4_code="RHZW" + alpha_3_code="RHO" + numeric_code="716" + date_withdrawn="1980" + names="Southern Rhodesia"/> + <iso_3166_3_entry + alpha_4_code="EH" + alpha_3_code="ESH" + numeric_code="732" + date_withdrawn="1988" + names="Spanish Sahara" + comment="now Western Sahara"/> + <iso_3166_3_entry + alpha_4_code="PUUM" + alpha_3_code="PUS" + numeric_code="849" + date_withdrawn="1986" + names="US Miscellaneous Pacific Islands"/> + <iso_3166_3_entry + alpha_4_code="SUHH" + alpha_3_code="SUN" + numeric_code="810" + date_withdrawn="1992-08-30" + names="USSR, Union of Soviet Socialist Republics"/> + <iso_3166_3_entry + alpha_4_code="HVBF" + alpha_3_code="HVO" + numeric_code="854" + date_withdrawn="1984" + names="Upper Volta, Republic of"/> + <iso_3166_3_entry + alpha_4_code="VA" + alpha_3_code="VAT" + numeric_code="336" + date_withdrawn="1996-04-03" + names="Vatican City State (Holy See)"/> + <iso_3166_3_entry + alpha_4_code="VDVN" + alpha_3_code="VDR" + date_withdrawn="1977" + names="Viet-Nam, Democratic Republic of"/> + <iso_3166_3_entry + alpha_4_code="WKUM" + alpha_3_code="WAK" + numeric_code="872" + date_withdrawn="1986" + names="Wake Island"/> + <iso_3166_3_entry + alpha_4_code="YDYE" + alpha_3_code="YMD" + numeric_code="720" + date_withdrawn="1990-08-14" + names="Yemen, Democratic, People's Democratic Republic of"/> + <iso_3166_3_entry + alpha_4_code="YE" + alpha_3_code="YEM" + numeric_code="891" + date_withdrawn="1990-08-14" + names="Yemen, Yemen Arab Republic"/> + <iso_3166_3_entry + alpha_4_code="YUCS" + alpha_3_code="YUG" + numeric_code="891" + date_withdrawn="1993-07-28" + names="Yugoslavia, Socialist Federal Republic of"/> + <iso_3166_3_entry + alpha_4_code="ZRCD" + alpha_3_code="ZAR" + numeric_code="180" + date_withdrawn="1997-07-14" + names="Zaire, Republic of"/> </iso_3166_entries> diff --git a/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml b/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml index 6afa46d1b..223cc2e47 100644 --- a/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml +++ b/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml @@ -56,10668 +56,10668 @@ Source: <http://www.iso.org/iso/country_codes/background_on_iso_3166/iso_3166-2. ]> <iso_3166_2_entries> - <!-- Andorra --> - <iso_3166_country code="AD"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="AD-07" name="Andorra la Vella"/> - <iso_3166_2_entry - code="AD-02" name="Canillo"/> - <iso_3166_2_entry - code="AD-03" name="Encamp"/> - <iso_3166_2_entry - code="AD-08" name="Escaldes-Engordany"/> - <iso_3166_2_entry - code="AD-04" name="La Massana"/> - <iso_3166_2_entry - code="AD-05" name="Ordino"/> - <iso_3166_2_entry - code="AD-06" name="Sant Julià de Lòria"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United Arab Emirates --> - <iso_3166_country code="AE"> - <iso_3166_subset type="Emirate"> - <iso_3166_2_entry - code="AE-AZ" name="Abū Ȥaby [Abu Dhabi]"/> - <iso_3166_2_entry - code="AE-AJ" name="'Ajmān"/> - <iso_3166_2_entry - code="AE-FU" name="Al Fujayrah"/> - <iso_3166_2_entry - code="AE-SH" name="Ash Shāriqah"/> - <iso_3166_2_entry - code="AE-DU" name="Dubayy"/> - <iso_3166_2_entry - code="AE-RK" name="Ra’s al Khaymah"/> - <iso_3166_2_entry - code="AE-UQ" name="Umm al Qaywayn"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Afghanistan --> - <iso_3166_country code="AF"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AF-BDS" name="Badakhshān"/> - <iso_3166_2_entry - code="AF-BDG" name="Bādghīs"/> - <iso_3166_2_entry - code="AF-BGL" name="Baghlān"/> - <iso_3166_2_entry - code="AF-BAL" name="Balkh"/> - <iso_3166_2_entry - code="AF-BAM" name="Bāmīān"/> - <iso_3166_2_entry - code="AF-DAY" name="Dāykondī"/> - <iso_3166_2_entry - code="AF-FRA" name="Farāh"/> - <iso_3166_2_entry - code="AF-FYB" name="Fāryāb"/> - <iso_3166_2_entry - code="AF-GHA" name="Ghaznī"/> - <iso_3166_2_entry - code="AF-GHO" name="Ghowr"/> - <iso_3166_2_entry - code="AF-HEL" name="Helmand"/> - <iso_3166_2_entry - code="AF-HER" name="Herāt"/> - <iso_3166_2_entry - code="AF-JOW" name="Jowzjān"/> - <iso_3166_2_entry - code="AF-KAB" name="Kābul [Kābol]"/> - <iso_3166_2_entry - code="AF-KAN" name="Kandahār"/> - <iso_3166_2_entry - code="AF-KAP" name="Kāpīsā"/> - <iso_3166_2_entry - code="AF-KHO" name="Khowst"/> - <iso_3166_2_entry - code="AF-KNR" name="Konar [Kunar]"/> - <iso_3166_2_entry - code="AF-KDZ" name="Kondoz [Kunduz]"/> - <iso_3166_2_entry - code="AF-LAG" name="Laghmān"/> - <iso_3166_2_entry - code="AF-LOW" name="Lowgar"/> - <iso_3166_2_entry - code="AF-NAN" name="Nangrahār [Nangarhār]"/> - <iso_3166_2_entry - code="AF-NIM" name="Nīmrūz"/> - <iso_3166_2_entry - code="AF-NUR" name="Nūrestān"/> - <iso_3166_2_entry - code="AF-ORU" name="Orūzgān [Urūzgān]"/> - <iso_3166_2_entry - code="AF-PAN" name="Panjshīr"/> - <iso_3166_2_entry - code="AF-PIA" name="Paktīā"/> - <iso_3166_2_entry - code="AF-PKA" name="Paktīkā"/> - <iso_3166_2_entry - code="AF-PAR" name="Parwān"/> - <iso_3166_2_entry - code="AF-SAM" name="Samangān"/> - <iso_3166_2_entry - code="AF-SAR" name="Sar-e Pol"/> - <iso_3166_2_entry - code="AF-TAK" name="Takhār"/> - <iso_3166_2_entry - code="AF-WAR" name="Wardak [Wardag]"/> - <iso_3166_2_entry - code="AF-ZAB" name="Zābol [Zābul]"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Antigua and Barbuda --> - <iso_3166_country code="AG"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="AG-03" name="Saint George"/> - <iso_3166_2_entry - code="AG-04" name="Saint John"/> - <iso_3166_2_entry - code="AG-05" name="Saint Mary"/> - <iso_3166_2_entry - code="AG-06" name="Saint Paul"/> - <iso_3166_2_entry - code="AG-07" name="Saint Peter"/> - <iso_3166_2_entry - code="AG-08" name="Saint Philip"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="AG-10" name="Barbuda"/> - <iso_3166_2_entry - code="AG-11" name="Redonda"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Albania --> - <iso_3166_country code="AL"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="AL-01" name="Berat"/> - <iso_3166_2_entry - code="AL-09" name="Dibër"/> - <iso_3166_2_entry - code="AL-02" name="Durrës"/> - <iso_3166_2_entry - code="AL-03" name="Elbasan"/> - <iso_3166_2_entry - code="AL-04" name="Fier"/> - <iso_3166_2_entry - code="AL-05" name="Gjirokastër"/> - <iso_3166_2_entry - code="AL-06" name="Korçë"/> - <iso_3166_2_entry - code="AL-07" name="Kukës"/> - <iso_3166_2_entry - code="AL-08" name="Lezhë"/> - <iso_3166_2_entry - code="AL-10" name="Shkodër"/> - <iso_3166_2_entry - code="AL-11" name="Tiranë"/> - <iso_3166_2_entry - code="AL-12" name="Vlorë"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="AL-BR" name="Berat" parent="01"/> - <iso_3166_2_entry - code="AL-BU" name="Bulqizë" parent="09"/> - <iso_3166_2_entry - code="AL-DL" name="Delvinë" parent="12"/> - <iso_3166_2_entry - code="AL-DV" name="Devoll" parent="06"/> - <iso_3166_2_entry - code="AL-DI" name="Dibër" parent="09"/> - <iso_3166_2_entry - code="AL-DR" name="Durrës" parent="02"/> - <iso_3166_2_entry - code="AL-EL" name="Elbasan" parent="03"/> - <iso_3166_2_entry - code="AL-FR" name="Fier" parent="04"/> - <iso_3166_2_entry - code="AL-GR" name="Gramsh" parent="03"/> - <iso_3166_2_entry - code="AL-GJ" name="Gjirokastër" parent="05"/> - <iso_3166_2_entry - code="AL-HA" name="Has" parent="07"/> - <iso_3166_2_entry - code="AL-KA" name="Kavajë" parent="11"/> - <iso_3166_2_entry - code="AL-ER" name="Kolonjë" parent="06"/> - <iso_3166_2_entry - code="AL-KO" name="Korçë" parent="06"/> - <iso_3166_2_entry - code="AL-KR" name="Krujë" parent="02"/> - <iso_3166_2_entry - code="AL-KC" name="Kuçovë" parent="01"/> - <iso_3166_2_entry - code="AL-KU" name="Kukës" parent="07"/> - <iso_3166_2_entry - code="AL-KB" name="Kurbin" parent="08"/> - <iso_3166_2_entry - code="AL-LE" name="Lezhë" parent="08"/> - <iso_3166_2_entry - code="AL-LB" name="Librazhd" parent="03"/> - <iso_3166_2_entry - code="AL-LU" name="Lushnjë" parent="04"/> - <iso_3166_2_entry - code="AL-MM" name="Malësi e Madhe" parent="10"/> - <iso_3166_2_entry - code="AL-MK" name="Mallakastër" parent="04"/> - <iso_3166_2_entry - code="AL-MT" name="Mat" parent="09"/> - <iso_3166_2_entry - code="AL-MR" name="Mirditë" parent="08"/> - <iso_3166_2_entry - code="AL-PQ" name="Peqin" parent="03"/> - <iso_3166_2_entry - code="AL-PR" name="Përmet" parent="05"/> - <iso_3166_2_entry - code="AL-PG" name="Pogradec" parent="06"/> - <iso_3166_2_entry - code="AL-PU" name="Pukë" parent="10"/> - <iso_3166_2_entry - code="AL-SR" name="Sarandë" parent="12"/> - <iso_3166_2_entry - code="AL-SK" name="Skrapar" parent="01"/> - <iso_3166_2_entry - code="AL-SH" name="Shkodër" parent="10"/> - <iso_3166_2_entry - code="AL-TE" name="Tepelenë" parent="05"/> - <iso_3166_2_entry - code="AL-TR" name="Tiranë" parent="11"/> - <iso_3166_2_entry - code="AL-TP" name="Tropojë" parent="07"/> - <iso_3166_2_entry - code="AL-VL" name="Vlorë" parent="12"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Armenia --> - <iso_3166_country code="AM"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AM-ER" name="Erevan"/> - <iso_3166_2_entry - code="AM-AG" name="Aragacotn"/> - <iso_3166_2_entry - code="AM-AR" name="Ararat"/> - <iso_3166_2_entry - code="AM-AV" name="Armavir"/> - <iso_3166_2_entry - code="AM-GR" name="Gegarkunik'"/> - <iso_3166_2_entry - code="AM-KT" name="Kotayk'"/> - <iso_3166_2_entry - code="AM-LO" name="Lory"/> - <iso_3166_2_entry - code="AM-SH" name="Sirak"/> - <iso_3166_2_entry - code="AM-SU" name="Syunik'"/> - <iso_3166_2_entry - code="AM-TV" name="Tavus"/> - <iso_3166_2_entry - code="AM-VD" name="Vayoc Jor"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Angola --> - <iso_3166_country code="AO"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AO-BGO" name="Bengo"/> - <iso_3166_2_entry - code="AO-BGU" name="Benguela"/> - <iso_3166_2_entry - code="AO-BIE" name="Bié"/> - <iso_3166_2_entry - code="AO-CAB" name="Cabinda"/> - <iso_3166_2_entry - code="AO-CCU" name="Cuando-Cubango"/> - <iso_3166_2_entry - code="AO-CNO" name="Cuanza Norte"/> - <iso_3166_2_entry - code="AO-CUS" name="Cuanza Sul"/> - <iso_3166_2_entry - code="AO-CNN" name="Cunene"/> - <iso_3166_2_entry - code="AO-HUA" name="Huambo"/> - <iso_3166_2_entry - code="AO-HUI" name="Huíla"/> - <iso_3166_2_entry - code="AO-LUA" name="Luanda"/> - <iso_3166_2_entry - code="AO-LNO" name="Lunda Norte"/> - <iso_3166_2_entry - code="AO-LSU" name="Lunda Sul"/> - <iso_3166_2_entry - code="AO-MAL" name="Malange"/> - <iso_3166_2_entry - code="AO-MOX" name="Moxico"/> - <iso_3166_2_entry - code="AO-NAM" name="Namibe"/> - <iso_3166_2_entry - code="AO-UIG" name="Uíge"/> - <iso_3166_2_entry - code="AO-ZAI" name="Zaire"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Argentina --> - <iso_3166_country code="AR"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="AR-C" name="Ciudad Autónoma de Buenos Aires"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AR-B" name="Buenos Aires"/> - <iso_3166_2_entry - code="AR-K" name="Catamarca"/> - <iso_3166_2_entry - code="AR-X" name="Cordoba"/> - <iso_3166_2_entry - code="AR-W" name="Corrientes"/> - <iso_3166_2_entry - code="AR-H" name="Chaco"/> - <iso_3166_2_entry - code="AR-U" name="Chubut"/> - <iso_3166_2_entry - code="AR-E" name="Entre Rios"/> - <iso_3166_2_entry - code="AR-P" name="Formosa"/> - <iso_3166_2_entry - code="AR-Y" name="Jujuy"/> - <iso_3166_2_entry - code="AR-L" name="La Pampa"/> - <iso_3166_2_entry - code="AR-M" name="Mendoza"/> - <iso_3166_2_entry - code="AR-N" name="Misiones"/> - <iso_3166_2_entry - code="AR-Q" name="Neuquen"/> - <iso_3166_2_entry - code="AR-R" name="Rio Negro"/> - <iso_3166_2_entry - code="AR-A" name="Salta"/> - <iso_3166_2_entry - code="AR-J" name="San Juan"/> - <iso_3166_2_entry - code="AR-D" name="San Luis"/> - <iso_3166_2_entry - code="AR-Z" name="Santa Cruz"/> - <iso_3166_2_entry - code="AR-S" name="Santa Fe"/> - <iso_3166_2_entry - code="AR-G" name="Santiago del Estero"/> - <iso_3166_2_entry - code="AR-V" name="Tierra del Fuego"/> - <iso_3166_2_entry - code="AR-T" name="Tucuman"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Austria --> - <iso_3166_country code="AT"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="AT-1" name="Burgenland"/> - <iso_3166_2_entry - code="AT-2" name="Kärnten"/> - <iso_3166_2_entry - code="AT-3" name="Niederösterreich"/> - <iso_3166_2_entry - code="AT-4" name="Oberösterreich"/> - <iso_3166_2_entry - code="AT-5" name="Salzburg"/> - <iso_3166_2_entry - code="AT-6" name="Steiermark"/> - <iso_3166_2_entry - code="AT-7" name="Tirol"/> - <iso_3166_2_entry - code="AT-8" name="Vorarlberg"/> - <iso_3166_2_entry - code="AT-9" name="Wien"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Australia --> - <iso_3166_country code="AU"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="AU-NSW" name="New South Wales"/> - <iso_3166_2_entry - code="AU-QLD" name="Queensland"/> - <iso_3166_2_entry - code="AU-SA" name="South Australia"/> - <iso_3166_2_entry - code="AU-TAS" name="Tasmania"/> - <iso_3166_2_entry - code="AU-VIC" name="Victoria"/> - <iso_3166_2_entry - code="AU-WA" name="Western Australia"/> - </iso_3166_subset> - <iso_3166_subset type="Territory"> - <iso_3166_2_entry - code="AU-ACT" name="Australian Capital Territory"/> - <iso_3166_2_entry - code="AU-NT" name="Northern Territory"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Azerbaijan --> - <iso_3166_country code="AZ"> - <iso_3166_subset type="Autonomous republic"> - <iso_3166_2_entry - code="AZ NX" name="Naxçıvan"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="AZ-AB" name="Əli Bayramlı"/> - <iso_3166_2_entry - code="AZ-BA" name="Bakı"/> - <iso_3166_2_entry - code="AZ-GA" name="Gəncə"/> - <iso_3166_2_entry - code="AZ-LA" name="Lənkəran"/> - <iso_3166_2_entry - code="AZ-MI" name="Mingəçevir"/> - <iso_3166_2_entry - code="AZ-NA" name="Naftalan"/> - <iso_3166_2_entry - code="AZ-SA" name="Şəki"/> - <iso_3166_2_entry - code="AZ-SM" name="Sumqayıt"/> - <iso_3166_2_entry - code="AZ-SS" name="Şuşa"/> - <iso_3166_2_entry - code="AZ-XA" name="Xankəndi"/> - <iso_3166_2_entry - code="AZ-YE" name="Yevlax"/> - </iso_3166_subset> - <iso_3166_subset type="Rayon"> - <iso_3166_2_entry - code="AZ-ABS" name="Abşeron"/> - <iso_3166_2_entry - code="AZ-AGC" name="Ağcabədi"/> - <iso_3166_2_entry - code="AZ-AGM" name="Ağdam"/> - <iso_3166_2_entry - code="AZ-AGS" name="Ağdaş"/> - <iso_3166_2_entry - code="AZ-AGA" name="Ağstafa"/> - <iso_3166_2_entry - code="AZ-AGU" name="Ağsu"/> - <iso_3166_2_entry - code="AZ-AST" name="Astara"/> - <iso_3166_2_entry - code="AZ-BAB" name="Babək" parent="NX"/> - <iso_3166_2_entry - code="AZ-BAL" name="Balakən"/> - <iso_3166_2_entry - code="AZ-BAR" name="Bərdə"/> - <iso_3166_2_entry - code="AZ-BEY" name="Beyləqan"/> - <iso_3166_2_entry - code="AZ-BIL" name="Biləsuvar"/> - <iso_3166_2_entry - code="AZ-CAB" name="Cəbrayıl"/> - <iso_3166_2_entry - code="AZ-CAL" name="Cəlilabab"/> - <iso_3166_2_entry - code="AZ-CUL" name="Culfa" parent="NX"/> - <iso_3166_2_entry - code="AZ-DAS" name="Daşkəsən"/> - <iso_3166_2_entry - code="AZ-DAV" name="Dəvəçi"/> - <iso_3166_2_entry - code="AZ-FUZ" name="Füzuli"/> - <iso_3166_2_entry - code="AZ-GAD" name="Gədəbəy"/> - <iso_3166_2_entry - code="AZ-GOR" name="Goranboy"/> - <iso_3166_2_entry - code="AZ-GOY" name="Göyçay"/> - <iso_3166_2_entry - code="AZ-HAC" name="Hacıqabul"/> - <iso_3166_2_entry - code="AZ-IMI" name="İmişli"/> - <iso_3166_2_entry - code="AZ-ISM" name="İsmayıllı"/> - <iso_3166_2_entry - code="AZ-KAL" name="Kəlbəcər"/> - <iso_3166_2_entry - code="AZ-KUR" name="Kürdəmir"/> - <iso_3166_2_entry - code="AZ-LAC" name="Laçın"/> - <iso_3166_2_entry - code="AZ-LAN" name="Lənkəran"/> - <iso_3166_2_entry - code="AZ-LER" name="Lerik"/> - <iso_3166_2_entry - code="AZ-MAS" name="Masallı"/> - <iso_3166_2_entry - code="AZ-NEF" name="Neftçala"/> - <iso_3166_2_entry - code="AZ-OGU" name="Oğuz"/> - <iso_3166_2_entry - code="AZ-ORD" name="Ordubad" parent="NX"/> - <iso_3166_2_entry - code="AZ-QAB" name="Qəbələ"/> - <iso_3166_2_entry - code="AZ-QAX" name="Qax"/> - <iso_3166_2_entry - code="AZ-QAZ" name="Qazax"/> - <iso_3166_2_entry - code="AZ-QOB" name="Qobustan"/> - <iso_3166_2_entry - code="AZ-QBA" name="Quba"/> - <iso_3166_2_entry - code="AZ-QBI" name="Qubadlı"/> - <iso_3166_2_entry - code="AZ-QUS" name="Qusar"/> - <iso_3166_2_entry - code="AZ-SAT" name="Saatlı"/> - <iso_3166_2_entry - code="AZ-SAB" name="Sabirabad"/> - <iso_3166_2_entry - code="AZ-SAD" name="Sədərək" parent="NX"/> - <iso_3166_2_entry - code="AZ-SAH" name="Şahbuz" parent="NX"/> - <iso_3166_2_entry - code="AZ-SAK" name="Şəki"/> - <iso_3166_2_entry - code="AZ-SAL" name="Salyan"/> - <iso_3166_2_entry - code="AZ-SMI" name="Şamaxı"/> - <iso_3166_2_entry - code="AZ-SKR" name="Şəmkir"/> - <iso_3166_2_entry - code="AZ-SMX" name="Samux"/> - <iso_3166_2_entry - code="AZ-SAR" name="Şərur" parent="NX"/> - <iso_3166_2_entry - code="AZ-SIY" name="Siyəzən"/> - <iso_3166_2_entry - code="AZ-SUS" name="Şuşa"/> - <iso_3166_2_entry - code="AZ-TAR" name="Tərtər"/> - <iso_3166_2_entry - code="AZ-TOV" name="Tovuz"/> - <iso_3166_2_entry - code="AZ-UCA" name="Ucar"/> - <iso_3166_2_entry - code="AZ-XAC" name="Xaçmaz"/> - <iso_3166_2_entry - code="AZ-XAN" name="Xanlar"/> - <iso_3166_2_entry - code="AZ-XIZ" name="Xızı"/> - <iso_3166_2_entry - code="AZ-XCI" name="Xocalı"/> - <iso_3166_2_entry - code="AZ-XVD" name="Xocavənd"/> - <iso_3166_2_entry - code="AZ-YAR" name="Yardımlı"/> - <iso_3166_2_entry - code="AZ-YEV" name="Yevlax"/> - <iso_3166_2_entry - code="AZ-ZAN" name="Zəngilan"/> - <iso_3166_2_entry - code="AZ-ZAQ" name="Zaqatala"/> - <iso_3166_2_entry - code="AZ-ZAR" name="Zərdab"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bosnia-Herzegovina --> - <iso_3166_country code="BA"> - <iso_3166_subset type="Entity"> - <iso_3166_2_entry - code="BA-BIH" name="Federacija Bosne i Hercegovine"/> - <iso_3166_2_entry - code="BA-SRP" name="Republika Srpska"/> - </iso_3166_subset> - <iso_3166_subset type="Canton"> - <iso_3166_2_entry - code="BA-05" name="Bosansko-podrinjski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-07" name="Hercegovačko-neretvanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-10" name="Kanton br. 10 (Livanjski kanton)" parent="BIH"/> - <iso_3166_2_entry - code="BA-09" name="Kanton Sarajevo" parent="BIH"/> - <iso_3166_2_entry - code="BA-02" name="Posavski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-06" name="Srednjobosanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-03" name="Tuzlanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-01" name="Unsko-sanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-08" name="Zapadnohercegovački kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-04" name="Zeničko-dobojski kanton" parent="BIH"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BA-BRC" name="Brčko distrikt"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Barbados --> - <iso_3166_country code="BB"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="BB-01" name="Christ Church"/> - <iso_3166_2_entry - code="BB-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="BB-03" name="Saint George"/> - <iso_3166_2_entry - code="BB-04" name="Saint James"/> - <iso_3166_2_entry - code="BB-05" name="Saint John"/> - <iso_3166_2_entry - code="BB-06" name="Saint Joseph"/> - <iso_3166_2_entry - code="BB-07" name="Saint Lucy"/> - <iso_3166_2_entry - code="BB-08" name="Saint Michael"/> - <iso_3166_2_entry - code="BB-09" name="Saint Peter"/> - <iso_3166_2_entry - code="BB-10" name="Saint Philip"/> - <iso_3166_2_entry - code="BB-11" name="Saint Thomas"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bangladesh --> - <iso_3166_country code="BD"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="BD 1" name="Barisal bibhag"/> - <iso_3166_2_entry - code="BD 2" name="Chittagong bibhag"/> - <iso_3166_2_entry - code="BD 3" name="Dhaka bibhag"/> - <iso_3166_2_entry - code="BD 4" name="Khulna bibhag"/> - <iso_3166_2_entry - code="BD 5" name="Rajshahi bibhag"/> - <iso_3166_2_entry - code="BD 6" name="Sylhet bibhag"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BD-05" name="Bagerhat zila" parent="4"/> - <iso_3166_2_entry - code="BD-01" name="Bandarban zila" parent="2"/> - <iso_3166_2_entry - code="BD-02" name="Barguna zila" parent="1"/> - <iso_3166_2_entry - code="BD-06" name="Barisal zila" parent="1"/> - <iso_3166_2_entry - code="BD-07" name="Bhola zila" parent="1"/> - <iso_3166_2_entry - code="BD-03" name="Bogra zila" parent="5"/> - <iso_3166_2_entry - code="BD-04" name="Brahmanbaria zila" parent="2"/> - <iso_3166_2_entry - code="BD-09" name="Chandpur zila" parent="2"/> - <iso_3166_2_entry - code="BD-10" name="Chittagong zila" parent="2"/> - <iso_3166_2_entry - code="BD-12" name="Chuadanga zila" parent="4"/> - <iso_3166_2_entry - code="BD-08" name="Comilla zila" parent="2"/> - <iso_3166_2_entry - code="BD-11" name="Cox's Bazar zila" parent="2"/> - <iso_3166_2_entry - code="BD-13" name="Dhaka zila" parent="3"/> - <iso_3166_2_entry - code="BD-14" name="Dinajpur zila" parent="5"/> - <iso_3166_2_entry - code="BD-15" name="Faridpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-16" name="Feni zila" parent="2"/> - <iso_3166_2_entry - code="BD-19" name="Gaibandha zila" parent="5"/> - <iso_3166_2_entry - code="BD-18" name="Gazipur zila" parent="3"/> - <iso_3166_2_entry - code="BD-17" name="Gopalganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-20" name="Habiganj zila" parent="6"/> - <iso_3166_2_entry - code="BD-24" name="Jaipurhat zila" parent="5"/> - <iso_3166_2_entry - code="BD-21" name="Jamalpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-22" name="Jessore zila" parent="4"/> - <iso_3166_2_entry - code="BD-25" name="Jhalakati zila" parent="1"/> - <iso_3166_2_entry - code="BD-23" name="Jhenaidah zila" parent="4"/> - <iso_3166_2_entry - code="BD-29" name="Khagrachari zila" parent="2"/> - <iso_3166_2_entry - code="BD-27" name="Khulna zila" parent="4"/> - <iso_3166_2_entry - code="BD-26" name="Kishorganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-28" name="Kurigram zila" parent="5"/> - <iso_3166_2_entry - code="BD-30" name="Kushtia zila" parent="4"/> - <iso_3166_2_entry - code="BD-31" name="Lakshmipur zila" parent="2"/> - <iso_3166_2_entry - code="BD-32" name="Lalmonirhat zila" parent="5"/> - <iso_3166_2_entry - code="BD-36" name="Madaripur zila" parent="3"/> - <iso_3166_2_entry - code="BD-37" name="Magura zila" parent="4"/> - <iso_3166_2_entry - code="BD-33" name="Manikganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-39" name="Meherpur zila" parent="4"/> - <iso_3166_2_entry - code="BD-38" name="Moulvibazar zila" parent="6"/> - <iso_3166_2_entry - code="BD-35" name="Munshiganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-34" name="Mymensingh zila" parent="3"/> - <iso_3166_2_entry - code="BD-48" name="Naogaon zila" parent="5"/> - <iso_3166_2_entry - code="BD-43" name="Narail zila" parent="4"/> - <iso_3166_2_entry - code="BD-40" name="Narayanganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-42" name="Narsingdi zila" parent="3"/> - <iso_3166_2_entry - code="BD-44" name="Natore zila" parent="5"/> - <iso_3166_2_entry - code="BD-45" name="Nawabganj zila" parent="5"/> - <iso_3166_2_entry - code="BD-41" name="Netrakona zila" parent="3"/> - <iso_3166_2_entry - code="BD-46" name="Nilphamari zila" parent="5"/> - <iso_3166_2_entry - code="BD-47" name="Noakhali zila" parent="2"/> - <iso_3166_2_entry - code="BD-49" name="Pabna zila" parent="5"/> - <iso_3166_2_entry - code="BD-52" name="Panchagarh zila" parent="5"/> - <iso_3166_2_entry - code="BD-51" name="Patuakhali zila" parent="1"/> - <iso_3166_2_entry - code="BD-50" name="Pirojpur zila" parent="1"/> - <iso_3166_2_entry - code="BD-53" name="Rajbari zila" parent="3"/> - <iso_3166_2_entry - code="BD-54" name="Rajshahi zila" parent="5"/> - <iso_3166_2_entry - code="BD-56" name="Rangamati zila" parent="2"/> - <iso_3166_2_entry - code="BD-55" name="Rangpur zila" parent="5"/> - <iso_3166_2_entry - code="BD-58" name="Satkhira zila" parent="4"/> - <iso_3166_2_entry - code="BD-62" name="Shariatpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-57" name="Sherpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-59" name="Sirajganj zila" parent="5"/> - <iso_3166_2_entry - code="BD-61" name="Sunamganj zila" parent="6"/> - <iso_3166_2_entry - code="BD-60" name="Sylhet zila" parent="6"/> - <iso_3166_2_entry - code="BD-63" name="Tangail zila" parent="3"/> - <iso_3166_2_entry - code="BD-64" name="Thakurgaon zila" parent="5"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Belgium --> - <iso_3166_country code="BE"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="BE-VAN" name="Antwerpen"/> - <iso_3166_2_entry - code="BE-WBR" name="Brabant Wallon"/> - <iso_3166_2_entry - code="BE-BRU" name="Brussels-Capital Region"/> - <iso_3166_2_entry - code="BE-WHT" name="Hainaut"/> - <iso_3166_2_entry - code="BE-WLG" name="Liege"/> - <iso_3166_2_entry - code="BE-VLI" name="Limburg"/> - <iso_3166_2_entry - code="BE-WLX" name="Luxembourg"/> - <iso_3166_2_entry - code="BE-WNA" name="Namur"/> - <iso_3166_2_entry - code="BE-VOV" name="Oost-Vlaanderen"/> - <iso_3166_2_entry - code="BE-VBR" name="Vlaams-Brabant"/> - <iso_3166_2_entry - code="BE-VWV" name="West-Vlaanderen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Burkina-Faso --> - <iso_3166_country code="BF"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="BF-01" name="Boucle du Mouhoun"/> - <iso_3166_2_entry - code="BF-02" name="Cascades"/> - <iso_3166_2_entry - code="BF-03" name="Centre"/> - <iso_3166_2_entry - code="BF-04" name="Centre-Est"/> - <iso_3166_2_entry - code="BF-05" name="Centre-Nord"/> - <iso_3166_2_entry - code="BF-06" name="Centre-Ouest"/> - <iso_3166_2_entry - code="BF-07" name="Centre-Sud"/> - <iso_3166_2_entry - code="BF-08" name="Est"/> - <iso_3166_2_entry - code="BF-09" name="Hauts-Bassins"/> - <iso_3166_2_entry - code="BF-10" name="Nord"/> - <iso_3166_2_entry - code="BF-11" name="Plateau-Central"/> - <iso_3166_2_entry - code="BF-12" name="Sahel"/> - <iso_3166_2_entry - code="BF-13" name="Sud-Ouest"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="BF-BAL" name="Balé" parent="01"/> - <iso_3166_2_entry - code="BF-BAM" name="Bam" parent="05"/> - <iso_3166_2_entry - code="BF-BAN" name="Banwa" parent="01"/> - <iso_3166_2_entry - code="BF-BAZ" name="Bazèga" parent="07"/> - <iso_3166_2_entry - code="BF-BGR" name="Bougouriba" parent="13"/> - <iso_3166_2_entry - code="BF-BLG" name="Boulgou" parent="04"/> - <iso_3166_2_entry - code="BF-BLK" name="Boulkiemdé" parent="06"/> - <iso_3166_2_entry - code="BF-COM" name="Comoé" parent="02"/> - <iso_3166_2_entry - code="BF-GAN" name="Ganzourgou" parent="11"/> - <iso_3166_2_entry - code="BF-GNA" name="Gnagna" parent="08"/> - <iso_3166_2_entry - code="BF-GOU" name="Gourma" parent="08"/> - <iso_3166_2_entry - code="BF-HOU" name="Houet" parent="09"/> - <iso_3166_2_entry - code="BF-IOB" name="Ioba" parent="13"/> - <iso_3166_2_entry - code="BF-KAD" name="Kadiogo" parent="03"/> - <iso_3166_2_entry - code="BF-KEN" name="Kénédougou" parent="09"/> - <iso_3166_2_entry - code="BF-KMD" name="Komondjari" parent="08"/> - <iso_3166_2_entry - code="BF-KMP" name="Kompienga" parent="08"/> - <iso_3166_2_entry - code="BF-KOS" name="Kossi" parent="01"/> - <iso_3166_2_entry - code="BF-KOP" name="Koulpélogo" parent="04"/> - <iso_3166_2_entry - code="BF-KOT" name="Kouritenga" parent="04"/> - <iso_3166_2_entry - code="BF-KOW" name="Kourwéogo" parent="11"/> - <iso_3166_2_entry - code="BF-LER" name="Léraba" parent="02"/> - <iso_3166_2_entry - code="BF-LOR" name="Loroum" parent="10"/> - <iso_3166_2_entry - code="BF-MOU" name="Mouhoun" parent="01"/> - <iso_3166_2_entry - code="BF-NAO" name="Naouri" parent="07"/> - <iso_3166_2_entry - code="BF-NAM" name="Namentenga" parent="05"/> - <iso_3166_2_entry - code="BF-NAY" name="Nayala" parent="01"/> - <iso_3166_2_entry - code="BF-NOU" name="Noumbiel" parent="13"/> - <iso_3166_2_entry - code="BF-OUB" name="Oubritenga" parent="11"/> - <iso_3166_2_entry - code="BF-OUD" name="Oudalan" parent="12"/> - <iso_3166_2_entry - code="BF-PAS" name="Passoré" parent="10"/> - <iso_3166_2_entry - code="BF-PON" name="Poni" parent="13"/> - <iso_3166_2_entry - code="BF-SNG" name="Sanguié" parent="06"/> - <iso_3166_2_entry - code="BF-SMT" name="Sanmatenga" parent="05"/> - <iso_3166_2_entry - code="BF-SEN" name="Séno" parent="12"/> - <iso_3166_2_entry - code="BF-SIS" name="Sissili" parent="06"/> - <iso_3166_2_entry - code="BF-SOM" name="Soum" parent="12"/> - <iso_3166_2_entry - code="BF-SOR" name="Sourou" parent="01"/> - <iso_3166_2_entry - code="BF-TAP" name="Tapoa" parent="08"/> - <iso_3166_2_entry - code="BF-TUI" name="Tui" parent="09"/> - <iso_3166_2_entry - code="BF-YAG" name="Yagha" parent="12"/> - <iso_3166_2_entry - code="BF-YAT" name="Yatenga" parent="10"/> - <iso_3166_2_entry - code="BF-ZIR" name="Ziro" parent="06"/> - <iso_3166_2_entry - code="BF-ZON" name="Zondoma" parent="10"/> - <iso_3166_2_entry - code="BF-ZOU" name="Zoundwéogo" parent="07"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bulgaria --> - <iso_3166_country code="BG"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="BG-01" name="Blagoevgrad"/> - <iso_3166_2_entry - code="BG-02" name="Burgas"/> - <iso_3166_2_entry - code="BG-08" name="Dobrich"/> - <iso_3166_2_entry - code="BG-07" name="Gabrovo"/> - <iso_3166_2_entry - code="BG-26" name="Haskovo"/> - <iso_3166_2_entry - code="BG-09" name="Kardzhali"/> - <iso_3166_2_entry - code="BG-10" name="Kyustendil"/> - <iso_3166_2_entry - code="BG-11" name="Lovech"/> - <iso_3166_2_entry - code="BG-12" name="Montana"/> - <iso_3166_2_entry - code="BG-13" name="Pazardzhik"/> - <iso_3166_2_entry - code="BG-14" name="Pernik"/> - <iso_3166_2_entry - code="BG-15" name="Pleven"/> - <iso_3166_2_entry - code="BG-16" name="Plovdiv"/> - <iso_3166_2_entry - code="BG-17" name="Razgrad"/> - <iso_3166_2_entry - code="BG-18" name="Ruse"/> - <iso_3166_2_entry - code="BG-27" name="Shumen"/> - <iso_3166_2_entry - code="BG-19" name="Silistra"/> - <iso_3166_2_entry - code="BG-20" name="Sliven"/> - <iso_3166_2_entry - code="BG-21" name="Smolyan"/> - <iso_3166_2_entry - code="BG-23" name="Sofia"/> - <iso_3166_2_entry - code="BG-22" name="Sofia-Grad"/> - <iso_3166_2_entry - code="BG-24" name="Stara Zagora"/> - <iso_3166_2_entry - code="BG-25" name="Targovishte"/> - <iso_3166_2_entry - code="BG-03" name="Varna"/> - <iso_3166_2_entry - code="BG-04" name="Veliko Tarnovo"/> - <iso_3166_2_entry - code="BG-05" name="Vidin"/> - <iso_3166_2_entry - code="BG-06" name="Vratsa"/> - <iso_3166_2_entry - code="BG-28" name="Yambol"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bahrain --> - <iso_3166_country code="BH"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="BH-13" name="Al Manāmah (Al ‘Āşimah)"/> - <iso_3166_2_entry - code="BH-14" name="Al Janūbīyah"/> - <iso_3166_2_entry - code="BH-15" name="Al Muḩarraq"/> - <iso_3166_2_entry - code="BH-16" name="Al Wusţá"/> - <iso_3166_2_entry - code="BH-17" name="Ash Shamālīyah"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Burundi --> - <iso_3166_country code="BI"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="BI-BB" name="Bubanza"/> - <iso_3166_2_entry - code="BI-BM" name="Bujumbura Mairie"/> - <iso_3166_2_entry - code="BI-BL" name="Bujumbura Rural"/> - <iso_3166_2_entry - code="BI-BR" name="Bururi"/> - <iso_3166_2_entry - code="BI-CA" name="Cankuzo"/> - <iso_3166_2_entry - code="BI-CI" name="Cibitoke"/> - <iso_3166_2_entry - code="BI-GI" name="Gitega"/> - <iso_3166_2_entry - code="BI-KR" name="Karuzi"/> - <iso_3166_2_entry - code="BI-KY" name="Kayanza"/> - <iso_3166_2_entry - code="BI-KI" name="Kirundo"/> - <iso_3166_2_entry - code="BI-MA" name="Makamba"/> - <iso_3166_2_entry - code="BI-MU" name="Muramvya"/> - <iso_3166_2_entry - code="BI-MW" name="Mwaro"/> - <iso_3166_2_entry - code="BI-NG" name="Ngozi"/> - <iso_3166_2_entry - code="BI-RT" name="Rutana"/> - <iso_3166_2_entry - code="BI-RY" name="Ruyigi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Benin --> - <iso_3166_country code="BJ"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="BJ-AL" name="Alibori"/> - <iso_3166_2_entry - code="BJ-AK" name="Atakora"/> - <iso_3166_2_entry - code="BJ-AQ" name="Atlantique"/> - <iso_3166_2_entry - code="BJ-BO" name="Borgou"/> - <iso_3166_2_entry - code="BJ-CO" name="Collines"/> - <iso_3166_2_entry - code="BJ-DO" name="Donga"/> - <iso_3166_2_entry - code="BJ-KO" name="Kouffo"/> - <iso_3166_2_entry - code="BJ-LI" name="Littoral"/> - <iso_3166_2_entry - code="BJ-MO" name="Mono"/> - <iso_3166_2_entry - code="BJ-OU" name="Ouémé"/> - <iso_3166_2_entry - code="BJ-PL" name="Plateau"/> - <iso_3166_2_entry - code="BJ-ZO" name="Zou"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Barthélemy --> - <iso_3166_country code="BL"/> - <!-- Brunei Darussalam --> - <iso_3166_country code="BN"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BN-BE" name="Belait"/> - <iso_3166_2_entry - code="BN-BM" name="Brunei-Muara"/> - <iso_3166_2_entry - code="BN-TE" name="Temburong"/> - <iso_3166_2_entry - code="BN-TU" name="Tutong"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bolivia --> - <iso_3166_country code="BO"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="BO-H" name="Chuquisaca"/> - <iso_3166_2_entry - code="BO-C" name="Cochabamba"/> - <iso_3166_2_entry - code="BO-B" name="El Beni"/> - <iso_3166_2_entry - code="BO-L" name="La Paz"/> - <iso_3166_2_entry - code="BO-O" name="Oruro"/> - <iso_3166_2_entry - code="BO-N" name="Pando"/> - <iso_3166_2_entry - code="BO-P" name="Potosí"/> - <iso_3166_2_entry - code="BO-S" name="Santa Cruz"/> - <iso_3166_2_entry - code="BO-T" name="Tarija"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Brazil --> - <iso_3166_country code="BR"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="BR-AC" name="Acre"/> - <iso_3166_2_entry - code="BR-AL" name="Alagoas"/> - <iso_3166_2_entry - code="BR-AM" name="Amazonas"/> - <iso_3166_2_entry - code="BR-AP" name="Amapá"/> - <iso_3166_2_entry - code="BR-BA" name="Bahia"/> - <iso_3166_2_entry - code="BR-CE" name="Ceará"/> - <iso_3166_2_entry - code="BR-ES" name="Espírito Santo"/> - <iso_3166_2_entry - code="BR-FN" name="Fernando de Noronha"/> - <iso_3166_2_entry - code="BR-GO" name="Goiás"/> - <iso_3166_2_entry - code="BR-MA" name="Maranhão"/> - <iso_3166_2_entry - code="BR-MG" name="Minas Gerais"/> - <iso_3166_2_entry - code="BR-MS" name="Mato Grosso do Sul"/> - <iso_3166_2_entry - code="BR-MT" name="Mato Grosso"/> - <iso_3166_2_entry - code="BR-PA" name="Pará"/> - <iso_3166_2_entry - code="BR-PB" name="Paraíba"/> - <iso_3166_2_entry - code="BR-PE" name="Pernambuco"/> - <iso_3166_2_entry - code="BR-PI" name="Piauí"/> - <iso_3166_2_entry - code="BR-PR" name="Paraná"/> - <iso_3166_2_entry - code="BR-RJ" name="Rio de Janeiro"/> - <iso_3166_2_entry - code="BR-RN" name="Rio Grande do Norte"/> - <iso_3166_2_entry - code="BR-RO" name="Rondônia"/> - <iso_3166_2_entry - code="BR-RR" name="Roraima"/> - <iso_3166_2_entry - code="BR-RS" name="Rio Grande do Sul"/> - <iso_3166_2_entry - code="BR-SC" name="Santa Catarina"/> - <iso_3166_2_entry - code="BR-SE" name="Sergipe"/> - <iso_3166_2_entry - code="BR-SP" name="São Paulo"/> - <iso_3166_2_entry - code="BR-TO" name="Tocantins"/> - </iso_3166_subset> - <iso_3166_subset type="Federal District"> - <iso_3166_2_entry - code="BR-DF" name="Distrito Federal"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bahamas --> - <iso_3166_country code="BS"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BS-AC" name="Acklins Islands"/> - <iso_3166_2_entry - code="BS-BY" name="Berry Islands"/> - <iso_3166_2_entry - code="BS-BI" name="Bimini and Cat Cay"/> - <iso_3166_2_entry - code="BS-BP" name="Black Point"/> - <iso_3166_2_entry - code="BS-CI" name="Cat Island"/> - <iso_3166_2_entry - code="BS-CO" name="Central Abaco"/> - <iso_3166_2_entry - code="BS-CS" name="Central Andros"/> - <iso_3166_2_entry - code="BS-CE" name="Central Eleuthera"/> - <iso_3166_2_entry - code="BS-FP" name="City of Freeport"/> - <iso_3166_2_entry - code="BS-CK" name="Crooked Island and Long Cay"/> - <iso_3166_2_entry - code="BS-EG" name="East Grand Bahama"/> - <iso_3166_2_entry - code="BS-EX" name="Exuma"/> - <iso_3166_2_entry - code="BS-GC" name="Grand Cay"/> - <iso_3166_2_entry - code="BS-GT" name="Green Turtle Cay"/> - <iso_3166_2_entry - code="BS-HI" name="Harbour Island"/> - <iso_3166_2_entry - code="BS-HT" name="Hope Town"/> - <iso_3166_2_entry - code="BS-IN" name="Inagua"/> - <iso_3166_2_entry - code="BS-LI" name="Long Island"/> - <iso_3166_2_entry - code="BS-MC" name="Mangrove Cay"/> - <iso_3166_2_entry - code="BS-MG" name="Mayaguana"/> - <iso_3166_2_entry - code="BS-MI" name="Moore's Island"/> - <iso_3166_2_entry - code="BS-NO" name="North Abaco"/> - <iso_3166_2_entry - code="BS-NS" name="North Andros"/> - <iso_3166_2_entry - code="BS-NE" name="North Eleuthera"/> - <iso_3166_2_entry - code="BS-RI" name="Ragged Island"/> - <iso_3166_2_entry - code="BS-RC" name="Rum Cay"/> - <iso_3166_2_entry - code="BS-SS" name="San Salvador"/> - <iso_3166_2_entry - code="BS-SO" name="South Abaco"/> - <iso_3166_2_entry - code="BS-SA" name="South Andros"/> - <iso_3166_2_entry - code="BS-SE" name="South Eleuthera"/> - <iso_3166_2_entry - code="BS-SW" name="Spanish Wells"/> - <iso_3166_2_entry - code="BS-WG" name="West Grand Bahama"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bhutan --> - <iso_3166_country code="BT"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BT-33" name="Bumthang"/> - <iso_3166_2_entry - code="BT-12" name="Chhukha"/> - <iso_3166_2_entry - code="BT-22" name="Dagana"/> - <iso_3166_2_entry - code="BT-GA" name="Gasa"/> - <iso_3166_2_entry - code="BT-13" name="Ha"/> - <iso_3166_2_entry - code="BT-44" name="Lhuentse"/> - <iso_3166_2_entry - code="BT-42" name="Monggar"/> - <iso_3166_2_entry - code="BT-11" name="Paro"/> - <iso_3166_2_entry - code="BT-43" name="Pemagatshel"/> - <iso_3166_2_entry - code="BT-23" name="Punakha"/> - <iso_3166_2_entry - code="BT-45" name="Samdrup Jongkha"/> - <iso_3166_2_entry - code="BT-14" name="Samtee"/> - <iso_3166_2_entry - code="BT-31" name="Sarpang"/> - <iso_3166_2_entry - code="BT-15" name="Thimphu"/> - <iso_3166_2_entry - code="BT-41" name="Trashigang"/> - <iso_3166_2_entry - code="BT-TY" name="Trashi Yangtse"/> - <iso_3166_2_entry - code="BT-32" name="Trongsa"/> - <iso_3166_2_entry - code="BT-21" name="Tsirang"/> - <iso_3166_2_entry - code="BT-24" name="Wangdue Phodrang"/> - <iso_3166_2_entry - code="BT-34" name="Zhemgang"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Botswana --> - <iso_3166_country code="BW"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BW-CE" name="Central"/> - <iso_3166_2_entry - code="BW-GH" name="Ghanzi"/> - <iso_3166_2_entry - code="BW-KG" name="Kgalagadi"/> - <iso_3166_2_entry - code="BW-KL" name="Kgatleng"/> - <iso_3166_2_entry - code="BW-KW" name="Kweneng"/> - <iso_3166_2_entry - code="BW-NG" name="Ngamiland"/> - <iso_3166_2_entry - code="BW-NE" name="North-East"/> - <iso_3166_2_entry - code="BW-NW" name="North-West (Botswana)"/> - <iso_3166_2_entry - code="BW-SE" name="South-East"/> - <iso_3166_2_entry - code="BW-SO" name="Southern (Botswana)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Belarus --> - <iso_3166_country code="BY"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="BY-HM" name="Horad Minsk"/> - </iso_3166_subset> - <iso_3166_subset type="Oblast"> - <!-- ISO 3166-2 gives several Romanised versions of the names; here we choose the GOST be version --> - <iso_3166_2_entry - code="BY-BR" name="Brèsckaja voblasc'"/> - <iso_3166_2_entry - code="BY-HO" name="Homel'skaja voblasc'"/> - <iso_3166_2_entry - code="BY-HR" name="Hrodzenskaja voblasc'"/> - <iso_3166_2_entry - code="BY-MA" name="Mahilëuskaja voblasc'"/> - <iso_3166_2_entry - code="BY-MI" name="Minskaja voblasc'"/> - <iso_3166_2_entry - code="BY-VI" name="Vicebskaja voblasc'"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Belize --> - <iso_3166_country code="BZ"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BZ-BZ" name="Belize"/> - <iso_3166_2_entry - code="BZ-CY" name="Cayo"/> - <iso_3166_2_entry - code="BZ-CZL" name="Corozal"/> - <iso_3166_2_entry - code="BZ-OW" name="Orange Walk"/> - <iso_3166_2_entry - code="BZ-SC" name="Stann Creek"/> - <iso_3166_2_entry - code="BZ-TOL" name="Toledo"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Canada --> - <iso_3166_country code="CA"> - <!-- sub-region codes for Canadian provinces and territories --> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CA-AB" name="Alberta"/> - <iso_3166_2_entry - code="CA-BC" name="British Columbia"/> - <iso_3166_2_entry - code="CA-MB" name="Manitoba"/> - <iso_3166_2_entry - code="CA-NB" name="New Brunswick"/> - <iso_3166_2_entry - code="CA-NL" name="Newfoundland and Labrador"/> - <iso_3166_2_entry - code="CA-NS" name="Nova Scotia"/> - <iso_3166_2_entry - code="CA-ON" name="Ontario"/> - <iso_3166_2_entry - code="CA-PE" name="Prince Edward Island"/> - <iso_3166_2_entry - code="CA-QC" name="Quebec"/> - <iso_3166_2_entry - code="CA-SK" name="Saskatchewan"/> - </iso_3166_subset> - <iso_3166_subset type="Territory"> - <iso_3166_2_entry - code="CA-NT" name="Northwest Territories"/> - <iso_3166_2_entry - code="CA-NU" name="Nunavut"/> - <iso_3166_2_entry - code="CA-YT" name="Yukon Territory"/> - </iso_3166_subset> - </iso_3166_country> - <!-- The Democratic Republic of Congo --> - <iso_3166_country code="CD"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="CD-KN" name="Kinshasa"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CD-BN" name="Bandundu"/> - <iso_3166_2_entry - code="CD-BC" name="Bas-Congo"/> - <iso_3166_2_entry - code="CD-EQ" name="Équateur"/> - <iso_3166_2_entry - code="CD-HC" name="Haut-Congo"/> - <iso_3166_2_entry - code="CD-KW" name="Kasai-Occidental"/> - <iso_3166_2_entry - code="CD-KE" name="Kasai-Oriental"/> - <iso_3166_2_entry - code="CD-KA" name="Katanga"/> - <iso_3166_2_entry - code="CD-MA" name="Maniema"/> - <iso_3166_2_entry - code="CD-NK" name="Nord-Kivu"/> - <iso_3166_2_entry - code="CD-OR" name="Orientale"/> - <iso_3166_2_entry - code="CD-SK" name="Sud-Kivu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Central African Republic --> - <iso_3166_country code="CF"> - <iso_3166_subset type="Commune"> - <iso_3166_2_entry - code="CF-BGF" name="Bangui"/> - </iso_3166_subset> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="CF-BB" name="Bamingui-Bangoran"/> - <iso_3166_2_entry - code="CF-BK" name="Basse-Kotto"/> - <iso_3166_2_entry - code="CF-HK" name="Haute-Kotto"/> - <iso_3166_2_entry - code="CF-HM" name="Haut-Mbomou"/> - <iso_3166_2_entry - code="CF-KG" name="Kémo-Gribingui"/> - <iso_3166_2_entry - code="CF-LB" name="Lobaye"/> - <iso_3166_2_entry - code="CF-HS" name="Haute-Sangha / Mambéré-Kadéï"/> - <iso_3166_2_entry - code="CF-MB" name="Mbomou"/> - <iso_3166_2_entry - code="CF-NM" name="Nana-Mambéré"/> - <iso_3166_2_entry - code="CF-MP" name="Ombella-M'poko"/> - <iso_3166_2_entry - code="CF-UK" name="Ouaka"/> - <iso_3166_2_entry - code="CF-AC" name="Ouham"/> - <iso_3166_2_entry - code="CF-OP" name="Ouham-Pendé"/> - <iso_3166_2_entry - code="CF-VR" name="Vakaga"/> - </iso_3166_subset> - <iso_3166_subset type="Economic Prefecture"> - <iso_3166_2_entry - code="CF-KB" name="Gribingui"/> - <iso_3166_2_entry - code="CF-SE" name="Sangha"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Congo --> - <iso_3166_country code="CG"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CG-11" name="Bouenza"/> - <iso_3166_2_entry - code="CG-8" name="Cuvette"/> - <iso_3166_2_entry - code="CG-15" name="Cuvette-Ouest"/> - <iso_3166_2_entry - code="CG-5" name="Kouilou"/> - <iso_3166_2_entry - code="CG-2" name="Lékoumou"/> - <iso_3166_2_entry - code="CG-7" name="Likouala"/> - <iso_3166_2_entry - code="CG-9" name="Niari"/> - <iso_3166_2_entry - code="CG-14" name="Plateaux"/> - <iso_3166_2_entry - code="CG-12" name="Pool"/> - <iso_3166_2_entry - code="CG-13" name="Sangha"/> - </iso_3166_subset> - <iso_3166_subset type="Capital District"> - <iso_3166_2_entry - code="CG-BZV" name="Brazzaville"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Switzerland --> - <iso_3166_country code="CH"> - <iso_3166_subset type="Canton"> - <iso_3166_2_entry - code="CH-AG" name="Aargau"/> - <iso_3166_2_entry - code="CH-AI" name="Appenzell Innerrhoden"/> - <iso_3166_2_entry - code="CH-AR" name="Appenzell Ausserrhoden"/> - <iso_3166_2_entry - code="CH-BE" name="Bern"/> - <iso_3166_2_entry - code="CH-BL" name="Basel-Landschaft"/> - <iso_3166_2_entry - code="CH-BS" name="Basel-Stadt"/> - <iso_3166_2_entry - code="CH-FR" name="Fribourg"/> - <iso_3166_2_entry - code="CH-GE" name="Genève"/> - <iso_3166_2_entry - code="CH-GL" name="Glarus"/> - <iso_3166_2_entry - code="CH-GR" name="Graubünden"/> - <iso_3166_2_entry - code="CH-JU" name="Jura"/> - <iso_3166_2_entry - code="CH-LU" name="Luzern"/> - <iso_3166_2_entry - code="CH-NE" name="Neuchâtel"/> - <iso_3166_2_entry - code="CH-NW" name="Nidwalden"/> - <iso_3166_2_entry - code="CH-OW" name="Obwalden"/> - <iso_3166_2_entry - code="CH-SG" name="Sankt Gallen"/> - <iso_3166_2_entry - code="CH-SH" name="Schaffhausen"/> - <iso_3166_2_entry - code="CH-SO" name="Solothurn"/> - <iso_3166_2_entry - code="CH-SZ" name="Schwyz"/> - <iso_3166_2_entry - code="CH-TG" name="Thurgau"/> - <iso_3166_2_entry - code="CH-TI" name="Ticino"/> - <iso_3166_2_entry - code="CH-UR" name="Uri"/> - <iso_3166_2_entry - code="CH-VD" name="Vaud"/> - <iso_3166_2_entry - code="CH-VS" name="Valais"/> - <iso_3166_2_entry - code="CH-ZG" name="Zug"/> - <iso_3166_2_entry - code="CH-ZH" name="Zürich"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cote D'ivoire --> - <iso_3166_country code="CI"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CI-06" name="18 Montagnes (Région des)"/> - <iso_3166_2_entry - code="CI-16" name="Agnébi (Région de l')"/> - <iso_3166_2_entry - code="CI-17" name="Bafing (Région du)"/> - <iso_3166_2_entry - code="CI-09" name="Bas-Sassandra (Région du)"/> - <iso_3166_2_entry - code="CI-10" name="Denguélé (Région du)"/> - <iso_3166_2_entry - code="CI-18" name="Fromager (Région du)"/> - <iso_3166_2_entry - code="CI-02" name="Haut-Sassandra (Région du)"/> - <iso_3166_2_entry - code="CI-07" name="Lacs (Région des)"/> - <iso_3166_2_entry - code="CI-01" name="Lagunes (Région des)"/> - <iso_3166_2_entry - code="CI-12" name="Marahoué (Région de la)"/> - <iso_3166_2_entry - code="CI-19" name="Moyen-Cavally (Région du)"/> - <iso_3166_2_entry - code="CI-05" name="Moyen-Comoé (Région du)"/> - <iso_3166_2_entry - code="CI-11" name="Nzi-Comoé (Région)"/> - <iso_3166_2_entry - code="CI-03" name="Savanes (Région des)"/> - <iso_3166_2_entry - code="CI-15" name="Sud-Bandama (Région du)"/> - <iso_3166_2_entry - code="CI-13" name="Sud-Comoé (Région du)"/> - <iso_3166_2_entry - code="CI-04" name="Vallée du Bandama (Région de la)"/> - <iso_3166_2_entry - code="CI-14" name="Worodouqou (Région du)"/> - <iso_3166_2_entry - code="CI-08" name="Zanzan (Région du)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Chile --> - <iso_3166_country code="CL"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CL-AI" name="Aisén del General Carlos Ibáñez del Campo"/> - <iso_3166_2_entry - code="CL-AN" name="Antofagasta"/> - <iso_3166_2_entry - code="CL-AR" name="Araucanía"/> - <iso_3166_2_entry - code="CL-AP" name="Arica y Parinacota"/> - <iso_3166_2_entry - code="CL-AT" name="Atacama"/> - <iso_3166_2_entry - code="CL-BI" name="Bío-Bío"/> - <iso_3166_2_entry - code="CL-CO" name="Coquimbo"/> - <iso_3166_2_entry - code="CL-LI" name="Libertador General Bernardo O'Higgins"/> - <iso_3166_2_entry - code="CL-LL" name="Los Lagos"/> - <iso_3166_2_entry - code="CL-LR" name="Los Ríos"/> - <iso_3166_2_entry - code="CL-MA" name="Magallanes y Antártica Chilena"/> - <iso_3166_2_entry - code="CL-ML" name="Maule"/> - <iso_3166_2_entry - code="CL-RM" name="Región Metropolitana de Santiago"/> - <iso_3166_2_entry - code="CL-TA" name="Tarapacá"/> - <iso_3166_2_entry - code="CL-VS" name="Valparaíso"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cameroon --> - <iso_3166_country code="CM"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CM-AD" name="Adamaoua"/> - <iso_3166_2_entry - code="CM-CE" name="Centre"/> - <iso_3166_2_entry - code="CM-ES" name="East"/> - <iso_3166_2_entry - code="CM-EN" name="Far North"/> - <iso_3166_2_entry - code="CM-LT" name="Littoral"/> - <iso_3166_2_entry - code="CM-NO" name="North"/> - <iso_3166_2_entry - code="CM-NW" name="North-West (Cameroon)"/> - <iso_3166_2_entry - code="CM-SU" name="South"/> - <iso_3166_2_entry - code="CM-SW" name="South-West"/> - <iso_3166_2_entry - code="CM-OU" name="West"/> - </iso_3166_subset> - </iso_3166_country> - <!-- China --> - <iso_3166_country code="CN"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="CN-11" name="Beijing"/> - <iso_3166_2_entry - code="CN-50" name="Chongqing"/> - <iso_3166_2_entry - code="CN-31" name="Shanghai"/> - <iso_3166_2_entry - code="CN-12" name="Tianjin"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CN-34" name="Anhui"/> - <iso_3166_2_entry - code="CN-35" name="Fujian"/> - <iso_3166_2_entry - code="CN-62" name="Gansu"/> - <iso_3166_2_entry - code="CN-44" name="Guangdong"/> - <iso_3166_2_entry - code="CN-52" name="Guizhou"/> - <iso_3166_2_entry - code="CN-46" name="Hainan"/> - <iso_3166_2_entry - code="CN-13" name="Hebei"/> - <iso_3166_2_entry - code="CN-23" name="Heilongjiang"/> - <iso_3166_2_entry - code="CN-41" name="Henan"/> - <iso_3166_2_entry - code="CN-42" name="Hubei"/> - <iso_3166_2_entry - code="CN-43" name="Hunan"/> - <iso_3166_2_entry - code="CN-32" name="Jiangsu"/> - <iso_3166_2_entry - code="CN-36" name="Jiangxi"/> - <iso_3166_2_entry - code="CN-22" name="Jilin"/> - <iso_3166_2_entry - code="CN-21" name="Liaoning"/> - <iso_3166_2_entry - code="CN-63" name="Qinghai"/> - <iso_3166_2_entry - code="CN-61" name="Shaanxi"/> - <iso_3166_2_entry - code="CN-37" name="Shandong"/> - <iso_3166_2_entry - code="CN-14" name="Shanxi"/> - <iso_3166_2_entry - code="CN-51" name="Sichuan"/> - <iso_3166_2_entry - code="CN-71" name="Taiwan"/> - <iso_3166_2_entry - code="CN-53" name="Yunnan"/> - <iso_3166_2_entry - code="CN-33" name="Zhejiang"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous region"> - <iso_3166_2_entry - code="CN-45" name="Guangxi"/> - <iso_3166_2_entry - code="CN-15" name="Nei Mongol"/> - <iso_3166_2_entry - code="CN-64" name="Ningxia"/> - <iso_3166_2_entry - code="CN-65" name="Xinjiang"/> - <iso_3166_2_entry - code="CN-54" name="Xizang"/> - </iso_3166_subset> - <iso_3166_subset type="Special administrative region"> - <iso_3166_2_entry - code="CN-91" name="Xianggang (Hong-Kong)"/> - <iso_3166_2_entry - code="CN-92" name="Aomen (Macau)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Colombia --> - <iso_3166_country code="CO"> - <iso_3166_subset type="Capital district"> - <iso_3166_2_entry - code="CO-DC" name="Distrito Capital de Bogotá"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="CO-AMA" name="Amazonas"/> - <iso_3166_2_entry - code="CO-ANT" name="Antioquia"/> - <iso_3166_2_entry - code="CO-ARA" name="Arauca"/> - <iso_3166_2_entry - code="CO-ATL" name="Atlántico"/> - <iso_3166_2_entry - code="CO-BOL" name="Bolívar"/> - <iso_3166_2_entry - code="CO-BOY" name="Boyacá"/> - <iso_3166_2_entry - code="CO-CAL" name="Caldas"/> - <iso_3166_2_entry - code="CO-CAQ" name="Caquetá"/> - <iso_3166_2_entry - code="CO-CAS" name="Casanare"/> - <iso_3166_2_entry - code="CO-CAU" name="Cauca"/> - <iso_3166_2_entry - code="CO-CES" name="Cesar"/> - <iso_3166_2_entry - code="CO-CHO" name="Chocó"/> - <iso_3166_2_entry - code="CO-COR" name="Córdoba"/> - <iso_3166_2_entry - code="CO-CUN" name="Cundinamarca"/> - <iso_3166_2_entry - code="CO-GUA" name="Guainía"/> - <iso_3166_2_entry - code="CO-GUV" name="Guaviare"/> - <iso_3166_2_entry - code="CO-HUI" name="Huila"/> - <iso_3166_2_entry - code="CO-LAG" name="La Guajira"/> - <iso_3166_2_entry - code="CO-MAG" name="Magdalena"/> - <iso_3166_2_entry - code="CO-MET" name="Meta"/> - <iso_3166_2_entry - code="CO-NAR" name="Nariño"/> - <iso_3166_2_entry - code="CO-NSA" name="Norte de Santander"/> - <iso_3166_2_entry - code="CO-PUT" name="Putumayo"/> - <iso_3166_2_entry - code="CO-QUI" name="Quindío"/> - <iso_3166_2_entry - code="CO-RIS" name="Risaralda"/> - <iso_3166_2_entry - code="CO-SAP" name="San Andrés, Providencia y Santa Catalina"/> - <iso_3166_2_entry - code="CO-SAN" name="Santander"/> - <iso_3166_2_entry - code="CO-SUC" name="Sucre"/> - <iso_3166_2_entry - code="CO-TOL" name="Tolima"/> - <iso_3166_2_entry - code="CO-VAC" name="Valle del Cauca"/> - <iso_3166_2_entry - code="CO-VAU" name="Vaupés"/> - <iso_3166_2_entry - code="CO-VID" name="Vichada"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Costa Rica --> - <iso_3166_country code="CR"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CR-A" name="Alajuela"/> - <iso_3166_2_entry - code="CR-C" name="Cartago"/> - <iso_3166_2_entry - code="CR-G" name="Guanacaste"/> - <iso_3166_2_entry - code="CR-H" name="Heredia"/> - <iso_3166_2_entry - code="CR-L" name="Limón"/> - <iso_3166_2_entry - code="CR-P" name="Puntarenas"/> - <iso_3166_2_entry - code="CR-SJ" name="San José"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cuba --> - <iso_3166_country code="CU"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CU-09" name="Camagüey"/> - <iso_3166_2_entry - code="CU-08" name="Ciego de Ávila"/> - <iso_3166_2_entry - code="CU-06" name="Cienfuegos"/> - <iso_3166_2_entry - code="CU-03" name="Ciudad de La Habana"/> - <iso_3166_2_entry - code="CU-12" name="Granma"/> - <iso_3166_2_entry - code="CU-14" name="Guantánamo"/> - <iso_3166_2_entry - code="CU-11" name="Holguín"/> - <iso_3166_2_entry - code="CU-02" name="La Habana"/> - <iso_3166_2_entry - code="CU-10" name="Las Tunas"/> - <iso_3166_2_entry - code="CU-04" name="Matanzas"/> - <iso_3166_2_entry - code="CU-01" name="Pinar del Rio"/> - <iso_3166_2_entry - code="CU-07" name="Sancti Spíritus"/> - <iso_3166_2_entry - code="CU-13" name="Santiago de Cuba"/> - <iso_3166_2_entry - code="CU-05" name="Villa Clara"/> - </iso_3166_subset> - <iso_3166_subset type="Special municipality"> - <iso_3166_2_entry - code="CU-99" name="Isla de la Juventud"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cape Verde --> - <iso_3166_country code="CV"> - <iso_3166_subset type="Geographical region"> - <iso_3166_2_entry - code="CV B" name="Ilhas de Barlavento"/> - <iso_3166_2_entry - code="CV S" name="Ilhas de Sotavento"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="CV-BV" name="Boa Vista" parent="B"/> - <iso_3166_2_entry - code="CV-BR" name="Brava" parent="S"/> - <iso_3166_2_entry - code="CV-MA" name="Maio" parent="S"/> - <iso_3166_2_entry - code="CV-MO" name="Mosteiros" parent="S"/> - <iso_3166_2_entry - code="CV-PA" name="Paul" parent="B"/> - <iso_3166_2_entry - code="CV-PN" name="Porto Novo" parent="B"/> - <iso_3166_2_entry - code="CV-PR" name="Praia" parent="S"/> - <iso_3166_2_entry - code="CV-RB" name="Ribeira Brava" parent="B"/> - <iso_3166_2_entry - code="CV-RG" name="Ribeira Grande" parent="B"/> - <iso_3166_2_entry - code="CV-RS" name="Ribeira Grande de Santiago" parent="S"/> - <iso_3166_2_entry - code="CV-SL" name="Sal" parent="B"/> - <iso_3166_2_entry - code="CV-CA" name="Santa Catarina" parent="S"/> - <iso_3166_2_entry - code="CV-CF" name="Santa Catarina de Fogo" parent="S"/> - <iso_3166_2_entry - code="CV-CR" name="Santa Cruz" parent="S"/> - <iso_3166_2_entry - code="CV-SD" name="São Domingos" parent="S"/> - <iso_3166_2_entry - code="CV-SF" name="São Filipe" parent="S"/> - <iso_3166_2_entry - code="CV-SL" name="São Lourenço dos Órgãos" parent="S"/> - <iso_3166_2_entry - code="CV-SM" name="São Miguel" parent="S"/> - <iso_3166_2_entry - code="CV-SS" name="São Salvador do Mundo" parent="S"/> - <iso_3166_2_entry - code="CV-SV" name="São Vicente" parent="B"/> - <iso_3166_2_entry - code="CV-TA" name="Tarrafal" parent="S"/> - <iso_3166_2_entry - code="CV-TS" name="Tarrafal de São Nicolau" parent="S"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cyprus --> - <iso_3166_country code="CY"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="CY-04" name="Ammóchostos"/> - <iso_3166_2_entry - code="CY-06" name="Kerýneia"/> - <iso_3166_2_entry - code="CY-03" name="Lárnaka"/> - <iso_3166_2_entry - code="CY-01" name="Lefkosía"/> - <iso_3166_2_entry - code="CY-02" name="Lemesós"/> - <iso_3166_2_entry - code="CY-05" name="Páfos"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Czech Republic --> - <iso_3166_country code="CZ"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CZ-JC" name="Jihočeský kraj"/> - <iso_3166_2_entry - code="CZ-JM" name="Jihomoravský kraj"/> - <iso_3166_2_entry - code="CZ-KA" name="Karlovarský kraj"/> - <iso_3166_2_entry - code="CZ-KR" name="Královéhradecký kraj"/> - <iso_3166_2_entry - code="CZ-LI" name="Liberecký kraj"/> - <iso_3166_2_entry - code="CZ-MO" name="Moravskoslezský kraj"/> - <iso_3166_2_entry - code="CZ-OL" name="Olomoucký kraj"/> - <iso_3166_2_entry - code="CZ-PA" name="Pardubický kraj"/> - <iso_3166_2_entry - code="CZ-PL" name="Plzeňský kraj"/> - <iso_3166_2_entry - code="CZ-PR" name="Praha, hlavní město"/> - <iso_3166_2_entry - code="CZ-ST" name="Středočeský kraj"/> - <iso_3166_2_entry - code="CZ-US" name="Ústecký kraj"/> - <iso_3166_2_entry - code="CZ-VY" name="Vysočina"/> - <iso_3166_2_entry - code="CZ-ZL" name="Zlínský kraj"/> - </iso_3166_subset> - <iso_3166_subset type="district"> - <iso_3166_2_entry - code="CZ-201" name="Benešov" parent="ST"/> - <iso_3166_2_entry - code="CZ-202" name="Beroun" parent="ST"/> - <iso_3166_2_entry - code="CZ-621" name="Blansko" parent="JM"/> - <iso_3166_2_entry - code="CZ-622" name="Brno-město" parent="JM"/> - <iso_3166_2_entry - code="CZ-623" name="Brno-venkov" parent="JM"/> - <iso_3166_2_entry - code="CZ-801" name="Bruntál" parent="MO"/> - <iso_3166_2_entry - code="CZ-624" name="Břeclav" parent="JM"/> - <iso_3166_2_entry - code="CZ-511" name="Česká Lípa" parent="LI"/> - <iso_3166_2_entry - code="CZ-311" name="České Budějovice" parent="JC"/> - <iso_3166_2_entry - code="CZ-312" name="Český Krumlov" parent="JC"/> - <iso_3166_2_entry - code="CZ-421" name="Děčín" parent="US"/> - <iso_3166_2_entry - code="CZ-321" name="Domažlice" parent="PL"/> - <iso_3166_2_entry - code="CZ-802" name="Frýdek Místek" parent="MO"/> - <iso_3166_2_entry - code="CZ-611" name="Havlíčkův Brod" parent="VY"/> - <iso_3166_2_entry - code="CZ-625" name="Hodonín" parent="JM"/> - <iso_3166_2_entry - code="CZ-521" name="Hradec Králové" parent="KR"/> - <iso_3166_2_entry - code="CZ-411" name="Cheb" parent="KA"/> - <iso_3166_2_entry - code="CZ-422" name="Chomutov" parent="US"/> - <iso_3166_2_entry - code="CZ-531" name="Chrudim" parent="PA"/> - <iso_3166_2_entry - code="CZ-512" name="Jablonec nad Nisou" parent="LI"/> - <iso_3166_2_entry - code="CZ-711" name="Jeseník" parent="OL"/> - <iso_3166_2_entry - code="CZ-522" name="Jičín" parent="KR"/> - <iso_3166_2_entry - code="CZ-612" name="Jihlava" parent="VY"/> - <iso_3166_2_entry - code="CZ-313" name="Jindřichův Hradec" parent="JC"/> - <iso_3166_2_entry - code="CZ-412" name="Karlovy Vary" parent="KA"/> - <iso_3166_2_entry - code="CZ-803" name="Karviná" parent="MO"/> - <iso_3166_2_entry - code="CZ-203" name="Kladno" parent="ST"/> - <iso_3166_2_entry - code="CZ-322" name="Klatovy" parent="PL"/> - <iso_3166_2_entry - code="CZ-204" name="Kolín" parent="ST"/> - <iso_3166_2_entry - code="CZ-721" name="Kromĕříž" parent="ZL"/> - <iso_3166_2_entry - code="CZ-205" name="Kutná Hora" parent="ST"/> - <iso_3166_2_entry - code="CZ-513" name="Liberec" parent="LI"/> - <iso_3166_2_entry - code="CZ-423" name="Litoměřice" parent="US"/> - <iso_3166_2_entry - code="CZ-424" name="Louny" parent="US"/> - <iso_3166_2_entry - code="CZ-206" name="Mělník" parent="ST"/> - <iso_3166_2_entry - code="CZ-207" name="Mladá Boleslav" parent="ST"/> - <iso_3166_2_entry - code="CZ-425" name="Most" parent="US"/> - <iso_3166_2_entry - code="CZ-523" name="Náchod" parent="KR"/> - <iso_3166_2_entry - code="CZ-804" name="Nový Jičín" parent="MO"/> - <iso_3166_2_entry - code="CZ-208" name="Nymburk" parent="ST"/> - <iso_3166_2_entry - code="CZ-712" name="Olomouc" parent="OL"/> - <iso_3166_2_entry - code="CZ-805" name="Opava" parent="MO"/> - <iso_3166_2_entry - code="CZ-806" name="Ostrava město" parent="MO"/> - <iso_3166_2_entry - code="CZ-532" name="Pardubice" parent="PA"/> - <iso_3166_2_entry - code="CZ-613" name="Pelhřimov" parent="VY"/> - <iso_3166_2_entry - code="CZ-314" name="Písek" parent="JC"/> - <iso_3166_2_entry - code="CZ-324" name="Plzeň jih" parent="PL"/> - <iso_3166_2_entry - code="CZ-323" name="Plzeň město" parent="PL"/> - <iso_3166_2_entry - code="CZ-325" name="Plzeň sever" parent="PL"/> - <iso_3166_2_entry - code="CZ-101" name="Praha 1" parent="PR"/> - <iso_3166_2_entry - code="CZ-102" name="Praha 2" parent="PR"/> - <iso_3166_2_entry - code="CZ-103" name="Praha 3" parent="PR"/> - <iso_3166_2_entry - code="CZ-104" name="Praha 4" parent="PR"/> - <iso_3166_2_entry - code="CZ-105" name="Praha 5" parent="PR"/> - <iso_3166_2_entry - code="CZ-106" name="Praha 6" parent="PR"/> - <iso_3166_2_entry - code="CZ-107" name="Praha 7" parent="PR"/> - <iso_3166_2_entry - code="CZ-108" name="Praha 8" parent="PR"/> - <iso_3166_2_entry - code="CZ-109" name="Praha 9" parent="PR"/> - <iso_3166_2_entry - code="CZ-10A" name="Praha 10" parent="PR"/> - <iso_3166_2_entry - code="CZ-10B" name="Praha 11" parent="PR"/> - <iso_3166_2_entry - code="CZ-10C" name="Praha 12" parent="PR"/> - <iso_3166_2_entry - code="CZ-10D" name="Praha 13" parent="PR"/> - <iso_3166_2_entry - code="CZ-10E" name="Praha 14" parent="PR"/> - <iso_3166_2_entry - code="CZ-10F" name="Praha 15" parent="PR"/> - <iso_3166_2_entry - code="CZ-209" name="Praha východ" parent="ST"/> - <iso_3166_2_entry - code="CZ-20A" name="Praha západ" parent="ST"/> - <iso_3166_2_entry - code="CZ-315" name="Prachatice" parent="JC"/> - <iso_3166_2_entry - code="CZ-713" name="Prostĕjov" parent="OL"/> - <iso_3166_2_entry - code="CZ-714" name="Přerov" parent="OL"/> - <iso_3166_2_entry - code="CZ-20B" name="Příbram" parent="ST"/> - <iso_3166_2_entry - code="CZ-20C" name="Rakovník" parent="ST"/> - <iso_3166_2_entry - code="CZ-326" name="Rokycany" parent="PL"/> - <iso_3166_2_entry - code="CZ-524" name="Rychnov nad Kněžnou" parent="KR"/> - <iso_3166_2_entry - code="CZ-514" name="Semily" parent="LI"/> - <iso_3166_2_entry - code="CZ-413" name="Sokolov" parent="KA"/> - <iso_3166_2_entry - code="CZ-316" name="Strakonice" parent="JC"/> - <iso_3166_2_entry - code="CZ-533" name="Svitavy" parent="PA"/> - <iso_3166_2_entry - code="CZ-715" name="Šumperk" parent="OL"/> - <iso_3166_2_entry - code="CZ-317" name="Tábor" parent="JC"/> - <iso_3166_2_entry - code="CZ-327" name="Tachov" parent="PL"/> - <iso_3166_2_entry - code="CZ-426" name="Teplice" parent="US"/> - <iso_3166_2_entry - code="CZ-525" name="Trutnov" parent="KR"/> - <iso_3166_2_entry - code="CZ-614" name="Třebíč" parent="VY"/> - <iso_3166_2_entry - code="CZ-722" name="Uherské Hradištĕ" parent="ZL"/> - <iso_3166_2_entry - code="CZ-427" name="Ústí nad Labem" parent="US"/> - <iso_3166_2_entry - code="CZ-534" name="Ústí nad Orlicí" parent="PA"/> - <iso_3166_2_entry - code="CZ-723" name="Vsetín" parent="ZL"/> - <iso_3166_2_entry - code="CZ-626" name="Vyškov" parent="JM"/> - <iso_3166_2_entry - code="CZ-724" name="Zlín" parent="ZL"/> - <iso_3166_2_entry - code="CZ-627" name="Znojmo" parent="JM"/> - <iso_3166_2_entry - code="CZ-615" name="Žd’ár nad Sázavou" parent="VY"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Germany --> - <iso_3166_country code="DE"> - <iso_3166_subset type="State"> - <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> - <iso_3166_2_entry - code="DE-BW" name="Baden-Württemberg"/> - <iso_3166_2_entry - code="DE-BY" name="Bayern"/> - <iso_3166_2_entry - code="DE-HB" name="Bremen"/> - <iso_3166_2_entry - code="DE-HH" name="Hamburg"/> - <iso_3166_2_entry - code="DE-HE" name="Hessen"/> - <iso_3166_2_entry - code="DE-NI" name="Niedersachsen"/> - <iso_3166_2_entry - code="DE-NW" name="Nordrhein-Westfalen"/> - <iso_3166_2_entry - code="DE-RP" name="Rheinland-Pfalz"/> - <iso_3166_2_entry - code="DE-SL" name="Saarland"/> - <iso_3166_2_entry - code="DE-SH" name="Schleswig-Holstein"/> - <iso_3166_2_entry - code="DE-BE" name="Berlin"/> - <iso_3166_2_entry - code="DE-BB" name="Brandenburg"/> - <iso_3166_2_entry - code="DE-MV" name="Mecklenburg-Vorpommern"/> - <iso_3166_2_entry - code="DE-SN" name="Sachsen"/> - <iso_3166_2_entry - code="DE-ST" name="Sachsen-Anhalt"/> - <iso_3166_2_entry - code="DE-TH" name="Thüringen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Djibouti --> - <iso_3166_country code="DJ"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="DJ-AS" name="Ali Sabieh"/> - <iso_3166_2_entry - code="DJ-AR" name="Arta"/> - <iso_3166_2_entry - code="DJ-DI" name="Dikhil"/> - <iso_3166_2_entry - code="DJ-OB" name="Obock"/> - <iso_3166_2_entry - code="DJ-TA" name="Tadjourah"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="DJ-DJ" name="Djibouti"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Denmark --> - <iso_3166_country code="DK"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="DK-81" name="Nordjylland"/> - <iso_3166_2_entry - code="DK-82" name="Midtjylland"/> - <iso_3166_2_entry - code="DK-83" name="Syddanmark"/> - <iso_3166_2_entry - code="DK-84" name="Hovedstaden"/> - <iso_3166_2_entry - code="DK-85" name="Sjælland"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Dominica --> - <iso_3166_country code="DM"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="DM-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="DM-03" name="Saint David"/> - <iso_3166_2_entry - code="DM-04" name="Saint George"/> - <iso_3166_2_entry - code="DM-05" name="Saint John"/> - <iso_3166_2_entry - code="DM-06" name="Saint Joseph"/> - <iso_3166_2_entry - code="DM-07" name="Saint Luke"/> - <iso_3166_2_entry - code="DM-08" name="Saint Mark"/> - <iso_3166_2_entry - code="DM-09" name="Saint Patrick"/> - <iso_3166_2_entry - code="DM-10" name="Saint Paul"/> - <iso_3166_2_entry - code="DM-01" name="Saint Peter"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Dominican Republic --> - <iso_3166_country code="DO"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="DO-01" name="Distrito Nacional (Santo Domingo)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="DO-02" name="Azua"/> - <iso_3166_2_entry - code="DO-03" name="Bahoruco"/> - <iso_3166_2_entry - code="DO-04" name="Barahona"/> - <iso_3166_2_entry - code="DO-05" name="Dajabón"/> - <iso_3166_2_entry - code="DO-06" name="Duarte"/> - <iso_3166_2_entry - code="DO-08" name="El Seybo [El Seibo]"/> - <iso_3166_2_entry - code="DO-09" name="Espaillat"/> - <iso_3166_2_entry - code="DO-30" name="Hato Mayor"/> - <iso_3166_2_entry - code="DO-10" name="Independencia"/> - <iso_3166_2_entry - code="DO-11" name="La Altagracia"/> - <iso_3166_2_entry - code="DO-07" name="La Estrelleta [Elías Piña]"/> - <iso_3166_2_entry - code="DO-12" name="La Romana"/> - <iso_3166_2_entry - code="DO-13" name="La Vega"/> - <iso_3166_2_entry - code="DO-14" name="María Trinidad Sánchez"/> - <iso_3166_2_entry - code="DO-28" name="Monseñor Nouel"/> - <iso_3166_2_entry - code="DO-15" name="Monte Cristi"/> - <iso_3166_2_entry - code="DO-29" name="Monte Plata"/> - <iso_3166_2_entry - code="DO-16" name="Pedernales"/> - <iso_3166_2_entry - code="DO-17" name="Peravia"/> - <iso_3166_2_entry - code="DO-18" name="Puerto Plata"/> - <iso_3166_2_entry - code="DO-19" name="Salcedo"/> - <iso_3166_2_entry - code="DO-20" name="Samaná"/> - <iso_3166_2_entry - code="DO-21" name="San Cristóbal"/> - <iso_3166_2_entry - code="DO-22" name="San Juan"/> - <iso_3166_2_entry - code="DO-23" name="San Pedro de Macorís"/> - <iso_3166_2_entry - code="DO-24" name="Sánchez Ramírez"/> - <iso_3166_2_entry - code="DO-25" name="Santiago"/> - <iso_3166_2_entry - code="DO-26" name="Santiago Rodríguez"/> - <iso_3166_2_entry - code="DO-27" name="Valverde"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Algeria --> - <iso_3166_country code="DZ"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="DZ-01" name="Adrar"/> - <iso_3166_2_entry - code="DZ-44" name="Aïn Defla"/> - <iso_3166_2_entry - code="DZ-46" name="Aïn Témouchent"/> - <iso_3166_2_entry - code="DZ-16" name="Alger"/> - <iso_3166_2_entry - code="DZ-23" name="Annaba"/> - <iso_3166_2_entry - code="DZ-05" name="Batna"/> - <iso_3166_2_entry - code="DZ-08" name="Béchar"/> - <iso_3166_2_entry - code="DZ-06" name="Béjaïa"/> - <iso_3166_2_entry - code="DZ-07" name="Biskra"/> - <iso_3166_2_entry - code="DZ-09" name="Blida"/> - <iso_3166_2_entry - code="DZ-34" name="Bordj Bou Arréridj"/> - <iso_3166_2_entry - code="DZ-10" name="Bouira"/> - <iso_3166_2_entry - code="DZ-35" name="Boumerdès"/> - <iso_3166_2_entry - code="DZ-02" name="Chlef"/> - <iso_3166_2_entry - code="DZ-25" name="Constantine"/> - <iso_3166_2_entry - code="DZ-17" name="Djelfa"/> - <iso_3166_2_entry - code="DZ-32" name="El Bayadh"/> - <iso_3166_2_entry - code="DZ-39" name="El Oued"/> - <iso_3166_2_entry - code="DZ-36" name="El Tarf"/> - <iso_3166_2_entry - code="DZ-47" name="Ghardaïa"/> - <iso_3166_2_entry - code="DZ-24" name="Guelma"/> - <iso_3166_2_entry - code="DZ-33" name="Illizi"/> - <iso_3166_2_entry - code="DZ-18" name="Jijel"/> - <iso_3166_2_entry - code="DZ-40" name="Khenchela"/> - <iso_3166_2_entry - code="DZ-03" name="Laghouat"/> - <iso_3166_2_entry - code="DZ-29" name="Mascara"/> - <iso_3166_2_entry - code="DZ-26" name="Médéa"/> - <iso_3166_2_entry - code="DZ-43" name="Mila"/> - <iso_3166_2_entry - code="DZ-27" name="Mostaganem"/> - <iso_3166_2_entry - code="DZ-28" name="Msila"/> - <iso_3166_2_entry - code="DZ-45" name="Naama"/> - <iso_3166_2_entry - code="DZ-31" name="Oran"/> - <iso_3166_2_entry - code="DZ-30" name="Ouargla"/> - <iso_3166_2_entry - code="DZ-04" name="Oum el Bouaghi"/> - <iso_3166_2_entry - code="DZ-48" name="Relizane"/> - <iso_3166_2_entry - code="DZ-20" name="Saïda"/> - <iso_3166_2_entry - code="DZ-19" name="Sétif"/> - <iso_3166_2_entry - code="DZ-22" name="Sidi Bel Abbès"/> - <iso_3166_2_entry - code="DZ-21" name="Skikda"/> - <iso_3166_2_entry - code="DZ-41" name="Souk Ahras"/> - <iso_3166_2_entry - code="DZ-11" name="Tamanghasset"/> - <iso_3166_2_entry - code="DZ-12" name="Tébessa"/> - <iso_3166_2_entry - code="DZ-14" name="Tiaret"/> - <iso_3166_2_entry - code="DZ-37" name="Tindouf"/> - <iso_3166_2_entry - code="DZ-42" name="Tipaza"/> - <iso_3166_2_entry - code="DZ-38" name="Tissemsilt"/> - <iso_3166_2_entry - code="DZ-15" name="Tizi Ouzou"/> - <iso_3166_2_entry - code="DZ-13" name="Tlemcen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ecuador --> - <iso_3166_country code="EC"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="EC-A" name="Azuay"/> - <iso_3166_2_entry - code="EC-B" name="Bolívar"/> - <iso_3166_2_entry - code="EC-F" name="Cañar"/> - <iso_3166_2_entry - code="EC-C" name="Carchi"/> - <iso_3166_2_entry - code="EC-X" name="Cotopaxi"/> - <iso_3166_2_entry - code="EC-H" name="Chimborazo"/> - <iso_3166_2_entry - code="EC-O" name="El Oro"/> - <iso_3166_2_entry - code="EC-E" name="Esmeraldas"/> - <iso_3166_2_entry - code="EC-W" name="Galápagos"/> - <iso_3166_2_entry - code="EC-G" name="Guayas"/> - <iso_3166_2_entry - code="EC-I" name="Imbabura"/> - <iso_3166_2_entry - code="EC-L" name="Loja"/> - <iso_3166_2_entry - code="EC-R" name="Los Ríos"/> - <iso_3166_2_entry - code="EC-M" name="Manabí"/> - <iso_3166_2_entry - code="EC-S" name="Morona-Santiago"/> - <iso_3166_2_entry - code="EC-N" name="Napo"/> - <iso_3166_2_entry - code="EC-D" name="Orellana"/> - <iso_3166_2_entry - code="EC-Y" name="Pastaza"/> - <iso_3166_2_entry - code="EC-P" name="Pichincha"/> - <iso_3166_2_entry - code="EC-SE" name="Santa Elena"/> - <iso_3166_2_entry - code="EC-SD" name="Santo Domingo de los Tsáchilas"/> - <iso_3166_2_entry - code="EC-U" name="Sucumbíos"/> - <iso_3166_2_entry - code="EC-T" name="Tungurahua"/> - <iso_3166_2_entry - code="EC-Z" name="Zamora-Chinchipe"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Estonia --> - <iso_3166_country code="EE"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="EE-37" name="Harjumaa"/> - <iso_3166_2_entry - code="EE-39" name="Hiiumaa"/> - <iso_3166_2_entry - code="EE-44" name="Ida-Virumaa"/> - <iso_3166_2_entry - code="EE-49" name="Jõgevamaa"/> - <iso_3166_2_entry - code="EE-51" name="Järvamaa"/> - <iso_3166_2_entry - code="EE-57" name="Läänemaa"/> - <iso_3166_2_entry - code="EE-59" name="Lääne-Virumaa"/> - <iso_3166_2_entry - code="EE-65" name="Põlvamaa"/> - <iso_3166_2_entry - code="EE-67" name="Pärnumaa"/> - <iso_3166_2_entry - code="EE-70" name="Raplamaa"/> - <iso_3166_2_entry - code="EE-74" name="Saaremaa"/> - <iso_3166_2_entry - code="EE-78" name="Tartumaa"/> - <iso_3166_2_entry - code="EE-82" name="Valgamaa"/> - <iso_3166_2_entry - code="EE-84" name="Viljandimaa"/> - <iso_3166_2_entry - code="EE-86" name="Võrumaa"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Egypt --> - <iso_3166_country code="EG"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="EG-DK" name="Ad Daqahlīyah"/> - <iso_3166_2_entry - code="EG-BA" name="Al Bahr al Ahmar"/> - <iso_3166_2_entry - code="EG-BH" name="Al Buhayrah"/> - <iso_3166_2_entry - code="EG-FYM" name="Al Fayyūm"/> - <iso_3166_2_entry - code="EG-GH" name="Al Gharbīyah"/> - <iso_3166_2_entry - code="EG-ALX" name="Al Iskandarīyah"/> - <iso_3166_2_entry - code="EG-IS" name="Al Ismā`īlīyah"/> - <iso_3166_2_entry - code="EG-GZ" name="Al Jīzah"/> - <iso_3166_2_entry - code="EG-MNF" name="Al Minūfīyah"/> - <iso_3166_2_entry - code="EG-MN" name="Al Minyā"/> - <iso_3166_2_entry - code="EG-C" name="Al Qāhirah"/> - <iso_3166_2_entry - code="EG-KB" name="Al Qalyūbīyah"/> - <iso_3166_2_entry - code="EG-WAD" name="Al Wādī al Jadīd"/> - <iso_3166_2_entry - code="EG-SU" name="As Sādis min Uktūbar"/> - <iso_3166_2_entry - code="EG-SHR" name="Ash Sharqīyah"/> - <iso_3166_2_entry - code="EG-SUZ" name="As Suways"/> - <iso_3166_2_entry - code="EG-ASN" name="Aswān"/> - <iso_3166_2_entry - code="EG-AST" name="Asyūt"/> - <iso_3166_2_entry - code="EG-BNS" name="Banī Suwayf"/> - <iso_3166_2_entry - code="EG-PTS" name="Būr Sa`īd"/> - <iso_3166_2_entry - code="EG-DT" name="Dumyāt"/> - <iso_3166_2_entry - code="EG-HU" name="Ḩulwān"/> - <iso_3166_2_entry - code="EG-JS" name="Janūb Sīnā'"/> - <iso_3166_2_entry - code="EG-KFS" name="Kafr ash Shaykh"/> - <iso_3166_2_entry - code="EG-MT" name="Matrūh"/> - <iso_3166_2_entry - code="EG-KN" name="Qinā"/> - <iso_3166_2_entry - code="EG-SIN" name="Shamal Sīnā'"/> - <iso_3166_2_entry - code="EG-SHG" name="Sūhāj"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Eritrea --> - <iso_3166_country code="ER"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ER-AN" name="Anseba"/> - <iso_3166_2_entry - code="ER-DU" name="Debub"/> - <iso_3166_2_entry - code="ER-DK" name="Debubawi Keyih Bahri [Debub-Keih-Bahri]"/> - <iso_3166_2_entry - code="ER-GB" name="Gash-Barka"/> - <iso_3166_2_entry - code="ER-MA" name="Maakel [Maekel]"/> - <iso_3166_2_entry - code="ER-SK" name="Semenawi Keyih Bahri [Semien-Keih-Bahri]"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Spain --> - <iso_3166_country code="ES"> - <iso_3166_subset type="Autonomous community"> - <iso_3166_2_entry - code="ES-AN" name="Andalucía"/> - <iso_3166_2_entry - code="ES-AR" name="Aragón"/> - <iso_3166_2_entry - code="ES-AS" name="Asturias, Principado de"/> - <iso_3166_2_entry - code="ES-CN" name="Canarias"/> - <iso_3166_2_entry - code="ES-CB" name="Cantabria"/> - <iso_3166_2_entry - code="ES-CM" name="Castilla-La Mancha"/> - <iso_3166_2_entry - code="ES-CL" name="Castilla y León"/> - <iso_3166_2_entry - code="ES-CT" name="Catalunya"/> - <iso_3166_2_entry - code="ES-EX" name="Extremadura"/> - <iso_3166_2_entry - code="ES-GA" name="Galicia"/> - <iso_3166_2_entry - code="ES-PM" name="Illes Balears"/> - <iso_3166_2_entry - code="ES-RI" name="La Rioja"/> - <iso_3166_2_entry - code="ES-MD" name="Madrid, Comunidad de"/> - <iso_3166_2_entry - code="ES-MC" name="Murcia, Región de"/> - <iso_3166_2_entry - code="ES-NC" name="Navarra, Comunidad Foral de / Nafarroako Foru Komunitatea"/> - <iso_3166_2_entry - code="ES-PV" name="País Vasco / Euskal Herria"/> - <iso_3166_2_entry - code="ES-VC" name="Valenciana, Comunidad / Valenciana, Comunitat "/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ES-C" name="A Coruña" parent="GA"/> - <iso_3166_2_entry - code="ES-VI" name="Álava" parent="PV"/> - <iso_3166_2_entry - code="ES-AB" name="Albacete" parent="CM"/> - <iso_3166_2_entry - code="ES-A" name="Alicante" parent="VC"/> - <iso_3166_2_entry - code="ES-AL" name="Almería" parent="AN"/> - <iso_3166_2_entry - code="ES-O" name="Asturias" parent="AS"/> - <iso_3166_2_entry - code="ES-AV" name="Ávila" parent="CL"/> - <iso_3166_2_entry - code="ES-BA" name="Badajoz" parent="EX"/> - <iso_3166_2_entry - code="ES-IB" name="Balears" parent="IB"/> - <iso_3166_2_entry - code="ES-B" name="Barcelona" parent="CT"/> - <iso_3166_2_entry - code="ES-BU" name="Burgos" parent="CL"/> - <iso_3166_2_entry - code="ES-CC" name="Cáceres" parent="EX"/> - <iso_3166_2_entry - code="ES-CA" name="Cádiz" parent="AN"/> - <iso_3166_2_entry - code="ES-S" name="Cantabria" parent="CB"/> - <iso_3166_2_entry - code="ES-CS" name="Castellón" parent="VC"/> - <iso_3166_2_entry - code="ES-CR" name="Ciudad Real" parent="CM"/> - <iso_3166_2_entry - code="ES-CO" name="Córdoba" parent="AN"/> - <iso_3166_2_entry - code="ES-CU" name="Cuenca" parent="CM"/> - <iso_3166_2_entry - code="ES-GI" name="Girona" parent="CT"/> - <iso_3166_2_entry - code="ES-GR" name="Granada" parent="AN"/> - <iso_3166_2_entry - code="ES-GU" name="Guadalajara" parent="CM"/> - <iso_3166_2_entry - code="ES-SS" name="Guipúzcoa / Gipuzkoa" parent="PV"/> - <iso_3166_2_entry - code="ES-H" name="Huelva" parent="AN"/> - <iso_3166_2_entry - code="ES-HU" name="Huesca" parent="AR"/> - <iso_3166_2_entry - code="ES-J" name="Jaén" parent="AN"/> - <iso_3166_2_entry - code="ES-LO" name="La Rioja" parent="RI"/> - <iso_3166_2_entry - code="ES-GC" name="Las Palmas" parent="CN"/> - <iso_3166_2_entry - code="ES-LE" name="León" parent="CL"/> - <iso_3166_2_entry - code="ES-L" name="Lleida" parent="CT"/> - <iso_3166_2_entry - code="ES-LU" name="Lugo" parent="GA"/> - <iso_3166_2_entry - code="ES-M" name="Madrid" parent="MD"/> - <iso_3166_2_entry - code="ES-MA" name="Málaga" parent="AN"/> - <iso_3166_2_entry - code="ES-MU" name="Murcia" parent="MC"/> - <iso_3166_2_entry - code="ES-NA" name="Navarra / Nafarroa" parent="NC"/> - <iso_3166_2_entry - code="ES-OR" name="Ourense" parent="GA"/> - <iso_3166_2_entry - code="ES-P" name="Palencia" parent="CL"/> - <iso_3166_2_entry - code="ES-PO" name="Pontevedra" parent="GA"/> - <iso_3166_2_entry - code="ES-SA" name="Salamanca" parent="CL"/> - <iso_3166_2_entry - code="ES-TF" name="Santa Cruz de Tenerife" parent="CN"/> - <iso_3166_2_entry - code="ES-SG" name="Segovia" parent="CL"/> - <iso_3166_2_entry - code="ES-SE" name="Sevilla" parent="AN"/> - <iso_3166_2_entry - code="ES-SO" name="Soria" parent="CL"/> - <iso_3166_2_entry - code="ES-T" name="Tarragona" parent="CT"/> - <iso_3166_2_entry - code="ES-TE" name="Teruel" parent="AR"/> - <iso_3166_2_entry - code="ES-TO" name="Toledo" parent="CM"/> - <iso_3166_2_entry - code="ES-V" name="Valencia / València" parent="VC"/> - <iso_3166_2_entry - code="ES-VA" name="Valladolid" parent="CL"/> - <iso_3166_2_entry - code="ES-BI" name="Vizcayaa / Bizkaia" parent="PV"/> - <iso_3166_2_entry - code="ES-ZA" name="Zamora" parent="CL"/> - <iso_3166_2_entry - code="ES-Z" name="Zaragoza" parent="AR"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous city"> - <iso_3166_2_entry - code="ES-CE" name="Ceuta"/> - <iso_3166_2_entry - code="ES-ML" name="Melilla"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ethiopia --> - <iso_3166_country code="ET"> - <iso_3166_subset type="Administration"> - <iso_3166_2_entry - code="ET-AA" name="Ādīs Ābeba"/> - <iso_3166_2_entry - code="ET-DD" name="Dirē Dawa"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="ET-AF" name="Āfar"/> - <iso_3166_2_entry - code="ET-AM" name="Āmara"/> - <iso_3166_2_entry - code="ET-BE" name="Bīnshangul Gumuz"/> - <iso_3166_2_entry - code="ET-GA" name="Gambēla Hizboch"/> - <iso_3166_2_entry - code="ET-HA" name="Hārerī Hizb"/> - <iso_3166_2_entry - code="ET-OR" name="Oromīya"/> - <iso_3166_2_entry - code="ET-SO" name="Sumalē"/> - <iso_3166_2_entry - code="ET-TI" name="Tigray"/> - <iso_3166_2_entry - code="ET-SN" name="YeDebub Bihēroch Bihēreseboch na Hizboch"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Finland --> - <iso_3166_country code="FI"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="FI-AL" name="Ahvenanmaan lääni"/> - <iso_3166_2_entry - code="FI-ES" name="Etelä-Suomen lääni"/> - <iso_3166_2_entry - code="FI-IS" name="Itä-Suomen lääni"/> - <iso_3166_2_entry - code="FI-LL" name="Lapin lääni"/> - <iso_3166_2_entry - code="FI-LS" name="Länsi-Suomen lääni"/> - <iso_3166_2_entry - code="FI-OL" name="Oulun lääni"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Fiji --> - <iso_3166_country code="FJ"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="FJ-C" name="Central"/> - <iso_3166_2_entry - code="FJ-E" name="Eastern"/> - <iso_3166_2_entry - code="FJ-N" name="Northern"/> - <iso_3166_2_entry - code="FJ-W" name="Western"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="FJ-R" name="Rotuma"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Federated States of Micronesia --> - <iso_3166_country code="FM"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="FM-TRK" name="Chuuk"/> - <iso_3166_2_entry - code="FM-KSA" name="Kosrae"/> - <iso_3166_2_entry - code="FM-PNI" name="Pohnpei"/> - <iso_3166_2_entry - code="FM-YAP" name="Yap"/> - </iso_3166_subset> - </iso_3166_country> - <!-- France --> - <iso_3166_country code="FR"> - <iso_3166_subset type="Metropolitan region"> - <iso_3166_2_entry - code="FR-A" name="Alsace"/> - <iso_3166_2_entry - code="FR-B" name="Aquitaine"/> - <iso_3166_2_entry - code="FR-C" name="Auvergne"/> - <iso_3166_2_entry - code="FR-P" name="Basse-Normandie"/> - <iso_3166_2_entry - code="FR-D" name="Bourgogne"/> - <iso_3166_2_entry - code="FR-E" name="Bretagne"/> - <iso_3166_2_entry - code="FR-F" name="Centre"/> - <iso_3166_2_entry - code="FR-G" name="Champagne-Ardenne"/> - <iso_3166_2_entry - code="FR-H" name="Corse"/> - <iso_3166_2_entry - code="FR-I" name="Franche-Comté"/> - <iso_3166_2_entry - code="FR-Q" name="Haute-Normandie"/> - <iso_3166_2_entry - code="FR-J" name="Île-de-France"/> - <iso_3166_2_entry - code="FR-K" name="Languedoc-Roussillon"/> - <iso_3166_2_entry - code="FR-L" name="Limousin"/> - <iso_3166_2_entry - code="FR-M" name="Lorraine"/> - <iso_3166_2_entry - code="FR-N" name="Midi-Pyrénées"/> - <iso_3166_2_entry - code="FR-O" name="Nord - Pas-de-Calais"/> - <iso_3166_2_entry - code="FR-R" name="Pays de la Loire"/> - <iso_3166_2_entry - code="FR-S" name="Picardie"/> - <iso_3166_2_entry - code="FR-T" name="Poitou-Charentes"/> - <iso_3166_2_entry - code="FR-U" name="Provence-Alpes-Côte d'Azur"/> - <iso_3166_2_entry - code="FR-V" name="Rhône-Alpes"/> - </iso_3166_subset> - <iso_3166_subset type="Overseas region/department"> - <iso_3166_2_entry - code="FR-GP" name="Guadeloupe"/> - <iso_3166_2_entry - code="FR-GF" name="Guyane"/> - <iso_3166_2_entry - code="FR-MQ" name="Martinique"/> - <iso_3166_2_entry - code="FR-RE" name="Réunion"/> - </iso_3166_subset> - <iso_3166_subset type="Metropolitan department"> - <iso_3166_2_entry - code="FR-01" name="Ain" parent="V"/> - <iso_3166_2_entry - code="FR-02" name="Aisne" parent="S"/> - <iso_3166_2_entry - code="FR-03" name="Allier" parent="C"/> - <iso_3166_2_entry - code="FR-04" name="Alpes-de-Haute-Provence" parent="U"/> - <iso_3166_2_entry - code="FR-06" name="Alpes-Maritimes" parent="U"/> - <iso_3166_2_entry - code="FR-07" name="Ardèche" parent="V"/> - <iso_3166_2_entry - code="FR-08" name="Ardennes" parent="G"/> - <iso_3166_2_entry - code="FR-09" name="Ariège" parent="N"/> - <iso_3166_2_entry - code="FR-10" name="Aube" parent="G"/> - <iso_3166_2_entry - code="FR-11" name="Aude" parent="K"/> - <iso_3166_2_entry - code="FR-12" name="Aveyron" parent="N"/> - <iso_3166_2_entry - code="FR-67" name="Bas-Rhin" parent="A"/> - <iso_3166_2_entry - code="FR-13" name="Bouches-du-Rhône" parent="U"/> - <iso_3166_2_entry - code="FR-14" name="Calvados" parent="P"/> - <iso_3166_2_entry - code="FR-15" name="Cantal" parent="C"/> - <iso_3166_2_entry - code="FR-16" name="Charente" parent="T"/> - <iso_3166_2_entry - code="FR-17" name="Charente-Maritime" parent="T"/> - <iso_3166_2_entry - code="FR-18" name="Cher" parent="F"/> - <iso_3166_2_entry - code="FR-19" name="Corrèze" parent="L"/> - <iso_3166_2_entry - code="FR-2A" name="Corse-du-Sud" parent="H"/> - <iso_3166_2_entry - code="FR-21" name="Côte-d'Or" parent="D"/> - <iso_3166_2_entry - code="FR-22" name="Côtes-d'Armor" parent="E"/> - <iso_3166_2_entry - code="FR-23" name="Creuse" parent="L"/> - <iso_3166_2_entry - code="FR-79" name="Deux-Sèvres" parent="T"/> - <iso_3166_2_entry - code="FR-24" name="Dordogne" parent="B"/> - <iso_3166_2_entry - code="FR-25" name="Doubs" parent="I"/> - <iso_3166_2_entry - code="FR-26" name="Drôme" parent="V"/> - <iso_3166_2_entry - code="FR-91" name="Essonne" parent="J"/> - <iso_3166_2_entry - code="FR-27" name="Eure" parent="Q"/> - <iso_3166_2_entry - code="FR-28" name="Eure-et-Loir" parent="F"/> - <iso_3166_2_entry - code="FR-29" name="Finistère" parent="E"/> - <iso_3166_2_entry - code="FR-30" name="Gard" parent="K"/> - <iso_3166_2_entry - code="FR-32" name="Gers" parent="N"/> - <iso_3166_2_entry - code="FR-33" name="Gironde" parent="B"/> - <iso_3166_2_entry - code="FR-2B" name="Haute-Corse" parent="H"/> - <iso_3166_2_entry - code="FR-31" name="Haute-Garonne" parent="N"/> - <iso_3166_2_entry - code="FR-43" name="Haute-Loire" parent="C"/> - <iso_3166_2_entry - code="FR-52" name="Haute-Marne" parent="G"/> - <iso_3166_2_entry - code="FR-05" name="Hautes-Alpes" parent="U"/> - <iso_3166_2_entry - code="FR-70" name="Haute-Saône" parent="I"/> - <iso_3166_2_entry - code="FR-74" name="Haute-Savoie" parent="V"/> - <iso_3166_2_entry - code="FR-65" name="Hautes-Pyrénées" parent="N"/> - <iso_3166_2_entry - code="FR-87" name="Haute-Vienne" parent="L"/> - <iso_3166_2_entry - code="FR-68" name="Haut-Rhin" parent="A"/> - <iso_3166_2_entry - code="FR-92" name="Hauts-de-Seine" parent="J"/> - <iso_3166_2_entry - code="FR-34" name="Hérault" parent="K"/> - <iso_3166_2_entry - code="FR-35" name="Ille-et-Vilaine" parent="E"/> - <iso_3166_2_entry - code="FR-36" name="Indre" parent="F"/> - <iso_3166_2_entry - code="FR-37" name="Indre-et-Loire" parent="F"/> - <iso_3166_2_entry - code="FR-38" name="Isère" parent="V"/> - <iso_3166_2_entry - code="FR-39" name="Jura" parent="I"/> - <iso_3166_2_entry - code="FR-40" name="Landes" parent="B"/> - <iso_3166_2_entry - code="FR-41" name="Loir-et-Cher" parent="F"/> - <iso_3166_2_entry - code="FR-42" name="Loire" parent="V"/> - <iso_3166_2_entry - code="FR-44" name="Loire-Atlantique" parent="R"/> - <iso_3166_2_entry - code="FR-45" name="Loiret" parent="F"/> - <iso_3166_2_entry - code="FR-46" name="Lot" parent="N"/> - <iso_3166_2_entry - code="FR-47" name="Lot-et-Garonne" parent="B"/> - <iso_3166_2_entry - code="FR-48" name="Lozère" parent="K"/> - <iso_3166_2_entry - code="FR-49" name="Maine-et-Loire" parent="R"/> - <iso_3166_2_entry - code="FR-50" name="Manche" parent="P"/> - <iso_3166_2_entry - code="FR-51" name="Marne" parent="G"/> - <iso_3166_2_entry - code="FR-53" name="Mayenne" parent="R"/> - <iso_3166_2_entry - code="FR-54" name="Meurthe-et-Moselle" parent="M"/> - <iso_3166_2_entry - code="FR-55" name="Meuse" parent="M"/> - <iso_3166_2_entry - code="FR-56" name="Morbihan" parent="E"/> - <iso_3166_2_entry - code="FR-57" name="Moselle" parent="M"/> - <iso_3166_2_entry - code="FR-58" name="Nièvre" parent="D"/> - <iso_3166_2_entry - code="FR-59" name="Nord" parent="O"/> - <iso_3166_2_entry - code="FR-60" name="Oise" parent="S"/> - <iso_3166_2_entry - code="FR-61" name="Orne" parent="P"/> - <iso_3166_2_entry - code="FR-75" name="Paris" parent="J"/> - <iso_3166_2_entry - code="FR-62" name="Pas-de-Calais" parent="O"/> - <iso_3166_2_entry - code="FR-63" name="Puy-de-Dôme" parent="C"/> - <iso_3166_2_entry - code="FR-64" name="Pyrénées-Atlantiques" parent="B"/> - <iso_3166_2_entry - code="FR-66" name="Pyrénées-Orientales" parent="K"/> - <iso_3166_2_entry - code="FR-69" name="Rhône" parent="V"/> - <iso_3166_2_entry - code="FR-71" name="Saône-et-Loire" parent="D"/> - <iso_3166_2_entry - code="FR-72" name="Sarthe" parent="R"/> - <iso_3166_2_entry - code="FR-73" name="Savoie" parent="V"/> - <iso_3166_2_entry - code="FR-77" name="Seine-et-Marne" parent="J"/> - <iso_3166_2_entry - code="FR-76" name="Seine-Maritime" parent="Q"/> - <iso_3166_2_entry - code="FR-93" name="Seine-Saint-Denis" parent="J"/> - <iso_3166_2_entry - code="FR-80" name="Somme" parent="S"/> - <iso_3166_2_entry - code="FR-81" name="Tarn" parent="N"/> - <iso_3166_2_entry - code="FR-82" name="Tarn-et-Garonne" parent="N"/> - <iso_3166_2_entry - code="FR-90" name="Territoire de Belfort" parent="I"/> - <iso_3166_2_entry - code="FR-94" name="Val-de-Marne" parent="J"/> - <iso_3166_2_entry - code="FR-95" name="Val d'Oise" parent="J"/> - <iso_3166_2_entry - code="FR-83" name="Var" parent="U"/> - <iso_3166_2_entry - code="FR-84" name="Vaucluse" parent="U"/> - <iso_3166_2_entry - code="FR-85" name="Vendée" parent="R"/> - <iso_3166_2_entry - code="FR-86" name="Vienne" parent="T"/> - <iso_3166_2_entry - code="FR-88" name="Vosges" parent="M"/> - <iso_3166_2_entry - code="FR-89" name="Yonne" parent="D"/> - <iso_3166_2_entry - code="FR-78" name="Yvelines" parent="J"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="FR-CP" name="Clipperton"/> - </iso_3166_subset> - <iso_3166_subset type="Overseas territorial collectivity"> - <iso_3166_2_entry - code="FR-YT" name="Mayotte"/> - <iso_3166_2_entry - code="FR-NC" name="Nouvelle-Calédonie"/> - <iso_3166_2_entry - code="FR-PF" name="Polynésie française"/> - <iso_3166_2_entry - code="FR-BL" name="Saint-Barthélemy"/> - <iso_3166_2_entry - code="FR-MF" name="Saint-Martin"/> - <iso_3166_2_entry - code="FR-PM" name="Saint-Pierre-et-Miquelon"/> - <iso_3166_2_entry - code="FR-TF" name="Terres australes françaises"/> - <iso_3166_2_entry - code="FR-WF" name="Wallis-et-Futuna"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Gabon --> - <iso_3166_country code="GA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GA-1" name="Estuaire"/> - <iso_3166_2_entry - code="GA-2" name="Haut-Ogooué"/> - <iso_3166_2_entry - code="GA-3" name="Moyen-Ogooué"/> - <iso_3166_2_entry - code="GA-4" name="Ngounié"/> - <iso_3166_2_entry - code="GA-5" name="Nyanga"/> - <iso_3166_2_entry - code="GA-6" name="Ogooué-Ivindo"/> - <iso_3166_2_entry - code="GA-7" name="Ogooué-Lolo"/> - <iso_3166_2_entry - code="GA-8" name="Ogooué-Maritime"/> - <iso_3166_2_entry - code="GA-9" name="Woleu-Ntem"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United Kingdom --> - <iso_3166_country code="GB"> - <iso_3166_subset type="Country"> - <iso_3166_2_entry - code="GB ENG" name="England"/> - <iso_3166_2_entry - code="GB SCT" name="Scotland"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GB NIR" name="Northern Ireland"/> - </iso_3166_subset> - <iso_3166_subset type="Principality"> - <iso_3166_2_entry - code="GB WLS" name="Wales"/> - </iso_3166_subset> - <iso_3166_subset type="Included for completeness"> - <iso_3166_2_entry - code="GB EAW" name="England and Wales"/> - <iso_3166_2_entry - code="GB GBN" name="Great Britain"/> - <iso_3166_2_entry - code="GB UKM" name="United Kingdom"/> - </iso_3166_subset> - <iso_3166_subset type="Two-tier county"> - <iso_3166_2_entry - code="GB-BKM" name="Buckinghamshire"/> - <iso_3166_2_entry - code="GB-CAM" name="Cambridgeshire"/> - <iso_3166_2_entry - code="GB-CMA" name="Cumbria"/> - <iso_3166_2_entry - code="GB-DBY" name="Derbyshire"/> - <iso_3166_2_entry - code="GB-DEV" name="Devon"/> - <iso_3166_2_entry - code="GB-DOR" name="Dorset"/> - <iso_3166_2_entry - code="GB-ESX" name="East Sussex"/> - <iso_3166_2_entry - code="GB-ESS" name="Essex"/> - <iso_3166_2_entry - code="GB-GLS" name="Gloucestershire"/> - <iso_3166_2_entry - code="GB-HAM" name="Hampshire"/> - <iso_3166_2_entry - code="GB-HRT" name="Hertfordshire"/> - <iso_3166_2_entry - code="GB-KEN" name="Kent"/> - <iso_3166_2_entry - code="GB-LAN" name="Lancashire"/> - <iso_3166_2_entry - code="GB-LEC" name="Leicestershire"/> - <iso_3166_2_entry - code="GB-LIN" name="Lincolnshire"/> - <iso_3166_2_entry - code="GB-NFK" name="Norfolk"/> - <iso_3166_2_entry - code="GB-NYK" name="North Yorkshire"/> - <iso_3166_2_entry - code="GB-NTH" name="Northamptonshire"/> - <iso_3166_2_entry - code="GB-NTT" name="Nottinghamshire"/> - <iso_3166_2_entry - code="GB-OXF" name="Oxfordshire"/> - <iso_3166_2_entry - code="GB-SOM" name="Somerset"/> - <iso_3166_2_entry - code="GB-STS" name="Staffordshire"/> - <iso_3166_2_entry - code="GB-SFK" name="Suffolk"/> - <iso_3166_2_entry - code="GB-SRY" name="Surrey"/> - <iso_3166_2_entry - code="GB-WAR" name="Warwickshire"/> - <iso_3166_2_entry - code="GB-WSX" name="West Sussex"/> - <iso_3166_2_entry - code="GB-WOR" name="Worcestershire"/> - </iso_3166_subset> - <iso_3166_subset type="London borough"> - <iso_3166_2_entry - code="GB-BDG" name="Barking and Dagenham"/> - <iso_3166_2_entry - code="GB-BNE" name="Barnet"/> - <iso_3166_2_entry - code="GB-BEX" name="Bexley"/> - <iso_3166_2_entry - code="GB-BEN" name="Brent"/> - <iso_3166_2_entry - code="GB-BRY" name="Bromley"/> - <iso_3166_2_entry - code="GB-CMD" name="Camden"/> - <iso_3166_2_entry - code="GB-CRY" name="Croydon"/> - <iso_3166_2_entry - code="GB-EAL" name="Ealing"/> - <iso_3166_2_entry - code="GB-ENF" name="Enfield"/> - <iso_3166_2_entry - code="GB-GRE" name="Greenwich"/> - <iso_3166_2_entry - code="GB-HCK" name="Hackney"/> - <iso_3166_2_entry - code="GB-HMF" name="Hammersmith and Fulham"/> - <iso_3166_2_entry - code="GB-HRY" name="Haringey"/> - <iso_3166_2_entry - code="GB-HRW" name="Harrow"/> - <iso_3166_2_entry - code="GB-HAV" name="Havering"/> - <iso_3166_2_entry - code="GB-HIL" name="Hillingdon"/> - <iso_3166_2_entry - code="GB-HNS" name="Hounslow"/> - <iso_3166_2_entry - code="GB-ISL" name="Islington"/> - <iso_3166_2_entry - code="GB-KEC" name="Kensington and Chelsea"/> - <iso_3166_2_entry - code="GB-KTT" name="Kingston upon Thames"/> - <iso_3166_2_entry - code="GB-LBH" name="Lambeth"/> - <iso_3166_2_entry - code="GB-LEW" name="Lewisham"/> - <iso_3166_2_entry - code="GB-MRT" name="Merton"/> - <iso_3166_2_entry - code="GB-NWM" name="Newham"/> - <iso_3166_2_entry - code="GB-RDB" name="Redbridge"/> - <iso_3166_2_entry - code="GB-RIC" name="Richmond upon Thames"/> - <iso_3166_2_entry - code="GB-SWK" name="Southwark"/> - <iso_3166_2_entry - code="GB-STN" name="Sutton"/> - <iso_3166_2_entry - code="GB-TWH" name="Tower Hamlets"/> - <iso_3166_2_entry - code="GB-WFT" name="Waltham Forest"/> - <iso_3166_2_entry - code="GB-WND" name="Wandsworth"/> - <iso_3166_2_entry - code="GB-WSM" name="Westminster"/> - </iso_3166_subset> - <iso_3166_subset type="Metropolitan district"> - <iso_3166_2_entry - code="GB-BNS" name="Barnsley"/> - <iso_3166_2_entry - code="GB-BIR" name="Birmingham"/> - <iso_3166_2_entry - code="GB-BOL" name="Bolton"/> - <iso_3166_2_entry - code="GB-BRD" name="Bradford"/> - <iso_3166_2_entry - code="GB-BUR" name="Bury"/> - <iso_3166_2_entry - code="GB-CLD" name="Calderdale"/> - <iso_3166_2_entry - code="GB-COV" name="Coventry"/> - <iso_3166_2_entry - code="GB-DNC" name="Doncaster"/> - <iso_3166_2_entry - code="GB-DUD" name="Dudley"/> - <iso_3166_2_entry - code="GB-GAT" name="Gateshead"/> - <iso_3166_2_entry - code="GB-KIR" name="Kirklees"/> - <iso_3166_2_entry - code="GB-KWL" name="Knowsley"/> - <iso_3166_2_entry - code="GB-LDS" name="Leeds"/> - <iso_3166_2_entry - code="GB-LIV" name="Liverpool"/> - <iso_3166_2_entry - code="GB-MAN" name="Manchester"/> - <iso_3166_2_entry - code="GB-NET" name="Newcastle upon Tyne"/> - <iso_3166_2_entry - code="GB-NTY" name="North Tyneside"/> - <iso_3166_2_entry - code="GB-OLD" name="Oldham"/> - <iso_3166_2_entry - code="GB-RCH" name="Rochdale"/> - <iso_3166_2_entry - code="GB-ROT" name="Rotherham"/> - <iso_3166_2_entry - code="GB-SHN" name="St. Helens"/> - <iso_3166_2_entry - code="GB-SLF" name="Salford"/> - <iso_3166_2_entry - code="GB-SAW" name="Sandwell"/> - <iso_3166_2_entry - code="GB-SFT" name="Sefton"/> - <iso_3166_2_entry - code="GB-SHF" name="Sheffield"/> - <iso_3166_2_entry - code="GB-SOL" name="Solihull"/> - <iso_3166_2_entry - code="GB-STY" name="South Tyneside"/> - <iso_3166_2_entry - code="GB-SKP" name="Stockport"/> - <iso_3166_2_entry - code="GB-SND" name="Sunderland"/> - <iso_3166_2_entry - code="GB-TAM" name="Tameside"/> - <iso_3166_2_entry - code="GB-TRF" name="Trafford"/> - <iso_3166_2_entry - code="GB-WKF" name="Wakefield"/> - <iso_3166_2_entry - code="GB-WLL" name="Walsall"/> - <iso_3166_2_entry - code="GB-WGN" name="Wigan"/> - <iso_3166_2_entry - code="GB-WRL" name="Wirral"/> - <iso_3166_2_entry - code="GB-WLV" name="Wolverhampton"/> - </iso_3166_subset> - <iso_3166_subset type="City corporation"> - <iso_3166_2_entry - code="GB-LND" name="London, City of"/> - </iso_3166_subset> - <iso_3166_subset type="Council area"> - <iso_3166_2_entry - code="GB-ABE" name="Aberdeen City"/> - <iso_3166_2_entry - code="GB-ABD" name="Aberdeenshire"/> - <iso_3166_2_entry - code="GB-ANS" name="Angus"/> - <iso_3166_2_entry - code="GB-AGB" name="Argyll and Bute"/> - <iso_3166_2_entry - code="GB-CLK" name="Clackmannanshire"/> - <iso_3166_2_entry - code="GB-DGY" name="Dumfries and Galloway"/> - <iso_3166_2_entry - code="GB-DND" name="Dundee City"/> - <iso_3166_2_entry - code="GB-EAY" name="East Ayrshire"/> - <iso_3166_2_entry - code="GB-EDU" name="East Dunbartonshire"/> - <iso_3166_2_entry - code="GB-ELN" name="East Lothian"/> - <iso_3166_2_entry - code="GB-ERW" name="East Renfrewshire"/> - <iso_3166_2_entry - code="GB-EDH" name="Edinburgh, City of"/> - <iso_3166_2_entry - code="GB-ELS" name="Eilean Siar"/> - <iso_3166_2_entry - code="GB-FAL" name="Falkirk"/> - <iso_3166_2_entry - code="GB-FIF" name="Fife"/> - <iso_3166_2_entry - code="GB-GLG" name="Glasgow City"/> - <iso_3166_2_entry - code="GB-HED" name="Highland"/> - <iso_3166_2_entry - code="GB-IVC" name="Inverclyde"/> - <iso_3166_2_entry - code="GB-MLN" name="Midlothian"/> - <iso_3166_2_entry - code="GB-MRY" name="Moray"/> - <iso_3166_2_entry - code="GB-NAY" name="North Ayrshire"/> - <iso_3166_2_entry - code="GB-NLK" name="North Lanarkshire"/> - <iso_3166_2_entry - code="GB-ORR" name="Orkney Islands"/> - <iso_3166_2_entry - code="GB-PKN" name="Perth and Kinross"/> - <iso_3166_2_entry - code="GB-RFW" name="Renfrewshire"/> - <iso_3166_2_entry - code="GB-SCB" name="Scottish Borders, The"/> - <iso_3166_2_entry - code="GB-ZET" name="Shetland Islands"/> - <iso_3166_2_entry - code="GB-SAY" name="South Ayrshire"/> - <iso_3166_2_entry - code="GB-SLK" name="South Lanarkshire"/> - <iso_3166_2_entry - code="GB-STG" name="Stirling"/> - <iso_3166_2_entry - code="GB-WDU" name="West Dunbartonshire"/> - <iso_3166_2_entry - code="GB-WLN" name="West Lothian"/> - </iso_3166_subset> - <iso_3166_subset type="District council area"> - <iso_3166_2_entry - code="GB-ANT" name="Antrim"/> - <iso_3166_2_entry - code="GB-ARD" name="Ards"/> - <iso_3166_2_entry - code="GB-ARM" name="Armagh"/> - <iso_3166_2_entry - code="GB-BLA" name="Ballymena"/> - <iso_3166_2_entry - code="GB-BLY" name="Ballymoney"/> - <iso_3166_2_entry - code="GB-BNB" name="Banbridge"/> - <iso_3166_2_entry - code="GB-BFS" name="Belfast"/> - <iso_3166_2_entry - code="GB-CKF" name="Carrickfergus"/> - <iso_3166_2_entry - code="GB-CSR" name="Castlereagh"/> - <iso_3166_2_entry - code="GB-CLR" name="Coleraine"/> - <iso_3166_2_entry - code="GB-CKT" name="Cookstown"/> - <iso_3166_2_entry - code="GB-CGV" name="Craigavon"/> - <iso_3166_2_entry - code="GB-DRY" name="Derry"/> - <iso_3166_2_entry - code="GB-DOW" name="Down"/> - <iso_3166_2_entry - code="GB-DGN" name="Dungannon"/> - <iso_3166_2_entry - code="GB-FER" name="Fermanagh"/> - <iso_3166_2_entry - code="GB-LRN" name="Larne"/> - <iso_3166_2_entry - code="GB-LMV" name="Limavady"/> - <iso_3166_2_entry - code="GB-LSB" name="Lisburn"/> - <iso_3166_2_entry - code="GB-MFT" name="Magherafelt"/> - <iso_3166_2_entry - code="GB-MYL" name="Moyle"/> - <iso_3166_2_entry - code="GB-NYM" name="Newry and Mourne"/> - <iso_3166_2_entry - code="GB-NTA" name="Newtownabbey"/> - <iso_3166_2_entry - code="GB-NDN" name="North Down"/> - <iso_3166_2_entry - code="GB-OMH" name="Omagh"/> - <iso_3166_2_entry - code="GB-STB" name="Strabane"/> - </iso_3166_subset> - <iso_3166_subset type="Unitary authority (England)"> - <iso_3166_2_entry - code="GB-BAS" name="Bath and North East Somerset"/> - <iso_3166_2_entry - code="GB-BBD" name="Blackburn with Darwen"/> - <iso_3166_2_entry - code="GB-BDF" name="Bedford"/> - <iso_3166_2_entry - code="GB-BPL" name="Blackpool"/> - <iso_3166_2_entry - code="GB-BMH" name="Bournemouth"/> - <iso_3166_2_entry - code="GB-BRC" name="Bracknell Forest"/> - <iso_3166_2_entry - code="GB-BNH" name="Brighton and Hove"/> - <iso_3166_2_entry - code="GB-BST" name="Bristol, City of"/> - <iso_3166_2_entry - code="GB-CBF" name="Central Bedfordshire"/> - <iso_3166_2_entry - code="GB-CHE" name="Cheshire East"/> - <iso_3166_2_entry - code="GB-CHW" name="Cheshire West and Chester"/> - <iso_3166_2_entry - code="GB-CON" name="Cornwall"/> - <iso_3166_2_entry - code="GB-DAL" name="Darlington"/> - <iso_3166_2_entry - code="GB-DER" name="Derby"/> - <iso_3166_2_entry - code="GB-DUR" name="Durham"/> - <iso_3166_2_entry - code="GB-ERY" name="East Riding of Yorkshire"/> - <iso_3166_2_entry - code="GB-HAL" name="Halton"/> - <iso_3166_2_entry - code="GB-HPL" name="Hartlepool"/> - <iso_3166_2_entry - code="GB-HEF" name="Herefordshire"/> - <iso_3166_2_entry - code="GB-IOW" name="Isle of Wight"/> - <iso_3166_2_entry - code="GB-KHL" name="Kingston upon Hull"/> - <iso_3166_2_entry - code="GB-LCE" name="Leicester"/> - <iso_3166_2_entry - code="GB-LUT" name="Luton"/> - <iso_3166_2_entry - code="GB-MDW" name="Medway"/> - <iso_3166_2_entry - code="GB-MDB" name="Middlesbrough"/> - <iso_3166_2_entry - code="GB-MIK" name="Milton Keynes"/> - <iso_3166_2_entry - code="GB-NEL" name="North East Lincolnshire"/> - <iso_3166_2_entry - code="GB-NLN" name="North Lincolnshire"/> - <iso_3166_2_entry - code="GB-NSM" name="North Somerset"/> - <iso_3166_2_entry - code="GB-NBL" name="Northumberland"/> - <iso_3166_2_entry - code="GB-NGM" name="Nottingham"/> - <iso_3166_2_entry - code="GB-PTE" name="Peterborough"/> - <iso_3166_2_entry - code="GB-PLY" name="Plymouth"/> - <iso_3166_2_entry - code="GB-POL" name="Poole"/> - <iso_3166_2_entry - code="GB-POR" name="Portsmouth"/> - <iso_3166_2_entry - code="GB-RDG" name="Reading"/> - <iso_3166_2_entry - code="GB-RCC" name="Redcar and Cleveland"/> - <iso_3166_2_entry - code="GB-RUT" name="Rutland"/> - <iso_3166_2_entry - code="GB-SHR" name="Shropshire"/> - <iso_3166_2_entry - code="GB-SLG" name="Slough"/> - <iso_3166_2_entry - code="GB-SGC" name="South Gloucestershire"/> - <iso_3166_2_entry - code="GB-STH" name="Southampton"/> - <iso_3166_2_entry - code="GB-SOS" name="Southend-on-Sea"/> - <iso_3166_2_entry - code="GB-STT" name="Stockton-on-Tees"/> - <iso_3166_2_entry - code="GB-STE" name="Stoke-on-Trent"/> - <iso_3166_2_entry - code="GB-SWD" name="Swindon"/> - <iso_3166_2_entry - code="GB-TFW" name="Telford and Wrekin"/> - <iso_3166_2_entry - code="GB-THR" name="Thurrock"/> - <iso_3166_2_entry - code="GB-TOB" name="Torbay"/> - <iso_3166_2_entry - code="GB-WRT" name="Warrington"/> - <iso_3166_2_entry - code="GB-WBX" name="West Berkshire"/> - <iso_3166_2_entry - code="GB-WNM" name="Windsor and Maidenhead"/> - <iso_3166_2_entry - code="GB-WOK" name="Wokingham"/> - <iso_3166_2_entry - code="GB-YOR" name="York"/> - </iso_3166_subset> - <iso_3166_subset type="Unitary authority (Wales)"> - <iso_3166_2_entry - code="GB-BGW" name="Blaenau Gwent"/> - <iso_3166_2_entry - code="GB-BGE" name="Bridgend;Pen-y-bont ar Ogwr"/> - <iso_3166_2_entry - code="GB-CAY" name="Caerphilly;Caerffili"/> - <iso_3166_2_entry - code="GB-CRF" name="Cardiff;Caerdydd"/> - <iso_3166_2_entry - code="GB-CMN" name="Carmarthenshire;Sir Gaerfyrddin"/> - <iso_3166_2_entry - code="GB-CGN" name="Ceredigion;Sir Ceredigion"/> - <iso_3166_2_entry - code="GB-CWY" name="Conwy"/> - <iso_3166_2_entry - code="GB-DEN" name="Denbighshire;Sir Ddinbych"/> - <iso_3166_2_entry - code="GB-FLN" name="Flintshire;Sir y Fflint"/> - <iso_3166_2_entry - code="GB-GWN" name="Gwynedd"/> - <iso_3166_2_entry - code="GB-AGY" name="Isle of Anglesey;Sir Ynys Môn"/> - <iso_3166_2_entry - code="GB-MTY" name="Merthyr Tydfil;Merthyr Tudful"/> - <iso_3166_2_entry - code="GB-MON" name="Monmouthshire;Sir Fynwy"/> - <iso_3166_2_entry - code="GB-NTL" name="Neath Port Talbot;Castell-nedd Port Talbot"/> - <iso_3166_2_entry - code="GB-NWP" name="Newport;Casnewydd"/> - <iso_3166_2_entry - code="GB-PEM" name="Pembrokeshire;Sir Benfro"/> - <iso_3166_2_entry - code="GB-POW" name="Powys"/> - <iso_3166_2_entry - code="GB-RCT" name="Rhondda, Cynon, Taff;Rhondda, Cynon,Taf"/> - <iso_3166_2_entry - code="GB-SWA" name="Swansea;Abertawe"/> - <iso_3166_2_entry - code="GB-TOF" name="Torfaen;Tor-faen"/> - <iso_3166_2_entry - code="GB-VGL" name="Vale of Glamorgan, The;Bro Morgannwg"/> - <iso_3166_2_entry - code="GB-WRX" name="Wrexham;Wrecsam"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Grenada --> - <iso_3166_country code="GD"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="GD-01" name="Saint Andrew"/> - <iso_3166_2_entry - code="GD-02" name="Saint David"/> - <iso_3166_2_entry - code="GD-03" name="Saint George"/> - <iso_3166_2_entry - code="GD-04" name="Saint John"/> - <iso_3166_2_entry - code="GD-05" name="Saint Mark"/> - <iso_3166_2_entry - code="GD-06" name="Saint Patrick"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="GD-10" name="Southern Grenadine Islands"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Georgia --> - <iso_3166_country code="GE"> - <iso_3166_subset type="Autonomous republic"> - <iso_3166_2_entry - code="GE-AB" name="Abkhazia"/> - <iso_3166_2_entry - code="GE-AJ" name="Ajaria"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="GE-TB" name="T’bilisi"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GE-GU" name="Guria"/> - <iso_3166_2_entry - code="GE-IM" name="Imeret’i"/> - <iso_3166_2_entry - code="GE-KA" name="Kakhet’i"/> - <iso_3166_2_entry - code="GE-KK" name="K’vemo K’art’li"/> - <iso_3166_2_entry - code="GE-MM" name="Mts’khet’a-Mt’ianet’i"/> - <iso_3166_2_entry - code="GE-RL" name="Racha-Lech’khumi-K’vemo Svanet’i"/> - <iso_3166_2_entry - code="GE-SZ" name="Samegrelo-Zemo Svanet’i"/> - <iso_3166_2_entry - code="GE-SJ" name="Samts’khe-Javakhet’i"/> - <iso_3166_2_entry - code="GE-SK" name="Shida K’art’li"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guernsey --> - <iso_3166_country code="GG"> - </iso_3166_country> - <!-- Ghana --> - <iso_3166_country code="GH"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GH-AH" name="Ashanti"/> - <iso_3166_2_entry - code="GH-BA" name="Brong-Ahafo"/> - <iso_3166_2_entry - code="GH-CP" name="Central"/> - <iso_3166_2_entry - code="GH-EP" name="Eastern"/> - <iso_3166_2_entry - code="GH-AA" name="Greater Accra"/> - <iso_3166_2_entry - code="GH-NP" name="Northern"/> - <iso_3166_2_entry - code="GH-UE" name="Upper East"/> - <iso_3166_2_entry - code="GH-UW" name="Upper West"/> - <iso_3166_2_entry - code="GH-TV" name="Volta"/> - <iso_3166_2_entry - code="GH-WP" name="Western"/> - </iso_3166_subset> - <!-- Greenland --> - <iso_3166_country code="GL"/> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="GL-KU" name="Kommune Kujalleq"/> - <iso_3166_2_entry - code="GL-SM" name="Kommuneqarfik Sermersooq"/> - <iso_3166_2_entry - code="GL-QA" name="Qaasuitsup Kommunia"/> - <iso_3166_2_entry - code="GL-QE" name="Qeqqata Kommunia"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Gambia --> - <iso_3166_country code="GM"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="GM-L" name="Lower River"/> - <iso_3166_2_entry - code="GM-M" name="Central River"/> - <iso_3166_2_entry - code="GM-N" name="North Bank"/> - <iso_3166_2_entry - code="GM-U" name="Upper River"/> - <iso_3166_2_entry - code="GM-W" name="Western"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="GM-B" name="Banjul"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guinea --> - <iso_3166_country code="GN"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="GN-B" name="Boké"/> - <iso_3166_2_entry - code="GN-F" name="Faranah"/> - <iso_3166_2_entry - code="GN-K" name="Kankan"/> - <iso_3166_2_entry - code="GN-D" name="Kindia"/> - <iso_3166_2_entry - code="GN-L" name="Labé"/> - <iso_3166_2_entry - code="GN-M" name="Mamou"/> - <iso_3166_2_entry - code="GN-N" name="Nzérékoré"/> - </iso_3166_subset> - <iso_3166_subset type="Special zone"> - <iso_3166_2_entry - code="GN C" name="Conakry"/> - </iso_3166_subset> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="GN-BE" name="Beyla" parent="N"/> - <iso_3166_2_entry - code="GN-BF" name="Boffa" parent="B"/> - <iso_3166_2_entry - code="GN-BK" name="Boké" parent="B"/> - <iso_3166_2_entry - code="GN-CO" name="Coyah" parent="D"/> - <iso_3166_2_entry - code="GN-DB" name="Dabola" parent="F"/> - <iso_3166_2_entry - code="GN-DL" name="Dalaba" parent="M"/> - <iso_3166_2_entry - code="GN-DI" name="Dinguiraye" parent="F"/> - <iso_3166_2_entry - code="GN-DU" name="Dubréka" parent="D"/> - <iso_3166_2_entry - code="GN-FA" name="Faranah" parent="F"/> - <iso_3166_2_entry - code="GN-FO" name="Forécariah" parent="D"/> - <iso_3166_2_entry - code="GN-FR" name="Fria" parent="B"/> - <iso_3166_2_entry - code="GN-GA" name="Gaoual" parent="B"/> - <iso_3166_2_entry - code="GN-GU" name="Guékédou" parent="N"/> - <iso_3166_2_entry - code="GN-KA" name="Kankan" parent="K"/> - <iso_3166_2_entry - code="GN-KE" name="Kérouané" parent="K"/> - <iso_3166_2_entry - code="GN-KD" name="Kindia" parent="D"/> - <iso_3166_2_entry - code="GN-KS" name="Kissidougou" parent="F"/> - <iso_3166_2_entry - code="GN-KB" name="Koubia" parent="L"/> - <iso_3166_2_entry - code="GN-KN" name="Koundara" parent="B"/> - <iso_3166_2_entry - code="GN-KO" name="Kouroussa" parent="K"/> - <iso_3166_2_entry - code="GN-LA" name="Labé" parent="L"/> - <iso_3166_2_entry - code="GN-LE" name="Lélouma" parent="L"/> - <iso_3166_2_entry - code="GN-LO" name="Lola" parent="N"/> - <iso_3166_2_entry - code="GN-MC" name="Macenta" parent="N"/> - <iso_3166_2_entry - code="GN-ML" name="Mali" parent="L"/> - <iso_3166_2_entry - code="GN-MM" name="Mamou" parent="M"/> - <iso_3166_2_entry - code="GN-MD" name="Mandiana" parent="K"/> - <iso_3166_2_entry - code="GN-NZ" name="Nzérékoré" parent="N"/> - <iso_3166_2_entry - code="GN-PI" name="Pita" parent="M"/> - <iso_3166_2_entry - code="GN-SI" name="Siguiri" parent="K"/> - <iso_3166_2_entry - code="GN-TE" name="Télimélé" parent="D"/> - <iso_3166_2_entry - code="GN-TO" name="Tougué" parent="L"/> - <iso_3166_2_entry - code="GN-YO" name="Yomou" parent="N"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Equatorial Guinea --> - <iso_3166_country code="GQ"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GQ-C" name="Región Continental"/> - <iso_3166_2_entry - code="GQ-I" name="Región Insular"/> - <iso_3166_2_entry - code="GQ-AN" name="Annobón"/> - <iso_3166_2_entry - code="GQ-BN" name="Bioko Norte"/> - <iso_3166_2_entry - code="GQ-BS" name="Bioko Sur"/> - <iso_3166_2_entry - code="GQ-CS" name="Centro Sur"/> - <iso_3166_2_entry - code="GQ-KN" name="Kié-Ntem"/> - <iso_3166_2_entry - code="GQ-LI" name="Litoral"/> - <iso_3166_2_entry - code="GQ-WN" name="Wele-Nzás"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Greece --> - <iso_3166_country code="GR"> - <iso_3166_subset type="Administrative region"> - <iso_3166_2_entry - code="GR-A" name="Anatoliki Makedonia kai Thraki"/> - <iso_3166_2_entry - code="GR-I" name="Attiki"/> - <iso_3166_2_entry - code="GR-G" name="Dytiki Ellada"/> - <iso_3166_2_entry - code="GR-C" name="Dytiki Makedonia"/> - <iso_3166_2_entry - code="GR-F" name="Ionia Nisia"/> - <iso_3166_2_entry - code="GR-D" name="Ipeiros"/> - <iso_3166_2_entry - code="GR-B" name="Kentriki Makedonia"/> - <iso_3166_2_entry - code="GR-M" name="Kriti"/> - <iso_3166_2_entry - code="GR-L" name="Notio Aigaio"/> - <iso_3166_2_entry - code="GR-J" name="Peloponnisos"/> - <iso_3166_2_entry - code="GR-H" name="Sterea Ellada"/> - <iso_3166_2_entry - code="GR-E" name="Thessalia"/> - <iso_3166_2_entry - code="GR-K" name="Voreio Aigaio"/> - </iso_3166_subset> - <iso_3166_subset type="Self-governed part"> - <iso_3166_2_entry - code="GR-69" name="Agio Oros"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="GR-13" name="Achaïa" parent="G"/> - <iso_3166_2_entry - code="GR-01" name="Aitolia kai Akarnania" parent="G"/> - <iso_3166_2_entry - code="GR-11" name="Argolida" parent="J"/> - <iso_3166_2_entry - code="GR-12" name="Arkadia" parent="J"/> - <iso_3166_2_entry - code="GR-31" name="Arta" parent="F"/> - <iso_3166_2_entry - code="GR-A1" name="Attiki" parent="I"/> - <iso_3166_2_entry - code="GR-64" name="Chalkidiki" parent="B"/> - <iso_3166_2_entry - code="GR-94" name="Chania" parent="M"/> - <iso_3166_2_entry - code="GR-85" name="Chios" parent="K"/> - <iso_3166_2_entry - code="GR-81" name="Dodekanisos" parent="L"/> - <iso_3166_2_entry - code="GR-52" name="Drama" parent="A"/> - <iso_3166_2_entry - code="GR-71" name="Evros" parent="A"/> - <iso_3166_2_entry - code="GR-05" name="Evrytania" parent="H"/> - <iso_3166_2_entry - code="GR-04" name="Evvoias" parent="H"/> - <iso_3166_2_entry - code="GR-63" name="Florina" parent="C"/> - <iso_3166_2_entry - code="GR-07" name="Fokida" parent="H"/> - <iso_3166_2_entry - code="GR-06" name="Fthiotida" parent="H"/> - <iso_3166_2_entry - code="GR-51" name="Grevena" parent="C"/> - <iso_3166_2_entry - code="GR-14" name="Ileia" parent="G"/> - <iso_3166_2_entry - code="GR-53" name="Imathia" parent="B"/> - <iso_3166_2_entry - code="GR-33" name="Ioannina" parent="D"/> - <iso_3166_2_entry - code="GR-91" name="Irakleio" parent="M"/> - <iso_3166_2_entry - code="GR-41" name="Karditsa" parent="E"/> - <iso_3166_2_entry - code="GR-56" name="Kastoria" parent="C"/> - <iso_3166_2_entry - code="GR-55" name="Kavala" parent="A"/> - <iso_3166_2_entry - code="GR-23" name="Kefallonia" parent="F"/> - <iso_3166_2_entry - code="GR-22" name="Kerkyra" parent="F"/> - <iso_3166_2_entry - code="GR-57" name="Kilkis" parent="B"/> - <iso_3166_2_entry - code="GR-15" name="Korinthia" parent="J"/> - <iso_3166_2_entry - code="GR-58" name="Kozani" parent="C"/> - <iso_3166_2_entry - code="GR-82" name="Kyklades" parent="L"/> - <iso_3166_2_entry - code="GR-16" name="Lakonia" parent="J"/> - <iso_3166_2_entry - code="GR-42" name="Larisa" parent="E"/> - <iso_3166_2_entry - code="GR-92" name="Lasithi" parent="M"/> - <iso_3166_2_entry - code="GR-24" name="Lefkada" parent="F"/> - <iso_3166_2_entry - code="GR-83" name="Lesvos" parent="K"/> - <iso_3166_2_entry - code="GR-43" name="Magnisia" parent="E"/> - <iso_3166_2_entry - code="GR-17" name="Messinia" parent="J"/> - <iso_3166_2_entry - code="GR-59" name="Pella" parent="B"/> - <iso_3166_2_entry - code="GR-61" name="Pieria" parent="B"/> - <iso_3166_2_entry - code="GR-34" name="Preveza" parent="D"/> - <iso_3166_2_entry - code="GR-93" name="Rethymno" parent="M"/> - <iso_3166_2_entry - code="GR-73" name="Rodopi" parent="A"/> - <iso_3166_2_entry - code="GR-84" name="Samos" parent="K"/> - <iso_3166_2_entry - code="GR-62" name="Serres" parent="B"/> - <iso_3166_2_entry - code="GR-32" name="Thesprotia" parent="D"/> - <iso_3166_2_entry - code="GR-54" name="Thessaloniki" parent="B"/> - <iso_3166_2_entry - code="GR-44" name="Trikala" parent="E"/> - <iso_3166_2_entry - code="GR-03" name="Voiotia" parent="H"/> - <iso_3166_2_entry - code="GR-72" name="Xanthi" parent="A"/> - <iso_3166_2_entry - code="GR-21" name="Zakynthos" parent="F"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guatemala --> - <iso_3166_country code="GT"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="GT-AV" name="Alta Verapaz"/> - <iso_3166_2_entry - code="GT-BV" name="Baja Verapaz"/> - <iso_3166_2_entry - code="GT-CM" name="Chimaltenango"/> - <iso_3166_2_entry - code="GT-CQ" name="Chiquimula"/> - <iso_3166_2_entry - code="GT-PR" name="El Progreso"/> - <iso_3166_2_entry - code="GT-ES" name="Escuintla"/> - <iso_3166_2_entry - code="GT-GU" name="Guatemala"/> - <iso_3166_2_entry - code="GT-HU" name="Huehuetenango"/> - <iso_3166_2_entry - code="GT-IZ" name="Izabal"/> - <iso_3166_2_entry - code="GT-JA" name="Jalapa"/> - <iso_3166_2_entry - code="GT-JU" name="Jutiapa"/> - <iso_3166_2_entry - code="GT-PE" name="Petén"/> - <iso_3166_2_entry - code="GT-QZ" name="Quetzaltenango"/> - <iso_3166_2_entry - code="GT-QC" name="Quiché"/> - <iso_3166_2_entry - code="GT-RE" name="Retalhuleu"/> - <iso_3166_2_entry - code="GT-SA" name="Sacatepéquez"/> - <iso_3166_2_entry - code="GT-SM" name="San Marcos"/> - <iso_3166_2_entry - code="GT-SR" name="Santa Rosa"/> - <iso_3166_2_entry - code="GT-SO" name="Sololá"/> - <iso_3166_2_entry - code="GT-SU" name="Suchitepéquez"/> - <iso_3166_2_entry - code="GT-TO" name="Totonicapán"/> - <iso_3166_2_entry - code="GT-ZA" name="Zacapa"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guinea-Bissau --> - <iso_3166_country code="GW"> - <iso_3166_subset type="Autonomous sector"> - <iso_3166_2_entry - code="GW-BS" name="Bissau"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GW-L" name="Leste"/> - <iso_3166_2_entry - code="GW-N" name="Norte"/> - <iso_3166_2_entry - code="GW-S" name="Sul"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GW-BA" name="Bafatá" parent="L"/> - <iso_3166_2_entry - code="GW-BM" name="Biombo" parent="N"/> - <iso_3166_2_entry - code="GW-BL" name="Bolama" parent="S"/> - <iso_3166_2_entry - code="GW-CA" name="Cacheu" parent="N"/> - <iso_3166_2_entry - code="GW-GA" name="Gabú" parent="L"/> - <iso_3166_2_entry - code="GW-OI" name="Oio" parent="N"/> - <iso_3166_2_entry - code="GW-QU" name="Quinara" parent="S"/> - <iso_3166_2_entry - code="GW-TO" name="Tombali" parent="S"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guyana --> - <iso_3166_country code="GY"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GY-BA" name="Barima-Waini"/> - <iso_3166_2_entry - code="GY-CU" name="Cuyuni-Mazaruni"/> - <iso_3166_2_entry - code="GY-DE" name="Demerara-Mahaica"/> - <iso_3166_2_entry - code="GY-EB" name="East Berbice-Corentyne"/> - <iso_3166_2_entry - code="GY-ES" name="Essequibo Islands-West Demerara"/> - <iso_3166_2_entry - code="GY-MA" name="Mahaica-Berbice"/> - <iso_3166_2_entry - code="GY-PM" name="Pomeroon-Supenaam"/> - <iso_3166_2_entry - code="GY-PT" name="Potaro-Siparuni"/> - <iso_3166_2_entry - code="GY-UD" name="Upper Demerara-Berbice"/> - <iso_3166_2_entry - code="GY-UT" name="Upper Takutu-Upper Essequibo"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Honduras --> - <iso_3166_country code="HN"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="HN-AT" name="Atlántida"/> - <iso_3166_2_entry - code="HN-CL" name="Colón"/> - <iso_3166_2_entry - code="HN-CM" name="Comayagua"/> - <iso_3166_2_entry - code="HN-CP" name="Copán"/> - <iso_3166_2_entry - code="HN-CR" name="Cortés"/> - <iso_3166_2_entry - code="HN-CH" name="Choluteca"/> - <iso_3166_2_entry - code="HN-EP" name="El Paraíso"/> - <iso_3166_2_entry - code="HN-FM" name="Francisco Morazán"/> - <iso_3166_2_entry - code="HN-GD" name="Gracias a Dios"/> - <iso_3166_2_entry - code="HN-IN" name="Intibucá"/> - <iso_3166_2_entry - code="HN-IB" name="Islas de la Bahía"/> - <iso_3166_2_entry - code="HN-LP" name="La Paz"/> - <iso_3166_2_entry - code="HN-LE" name="Lempira"/> - <iso_3166_2_entry - code="HN-OC" name="Ocotepeque"/> - <iso_3166_2_entry - code="HN-OL" name="Olancho"/> - <iso_3166_2_entry - code="HN-SB" name="Santa Bárbara"/> - <iso_3166_2_entry - code="HN-VA" name="Valle"/> - <iso_3166_2_entry - code="HN-YO" name="Yoro"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Croatia --> - <iso_3166_country code="HR"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="HR-21" name="Grad Zagreb"/> - </iso_3166_subset> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="HR-07" name="Bjelovarsko-bilogorska županija"/> - <iso_3166_2_entry - code="HR-12" name="Brodsko-posavska županija"/> - <iso_3166_2_entry - code="HR-19" name="Dubrovačko-neretvanska županija"/> - <iso_3166_2_entry - code="HR-18" name="Istarska županija"/> - <iso_3166_2_entry - code="HR-04" name="Karlovačka županija"/> - <iso_3166_2_entry - code="HR-06" name="Koprivničko-križevačka županija"/> - <iso_3166_2_entry - code="HR-02" name="Krapinsko-zagorska županija"/> - <iso_3166_2_entry - code="HR-09" name="Ličko-senjska županija"/> - <iso_3166_2_entry - code="HR-20" name="Međimurska županija"/> - <iso_3166_2_entry - code="HR-14" name="Osječko-baranjska županija"/> - <iso_3166_2_entry - code="HR-11" name="Požeško-slavonska županija"/> - <iso_3166_2_entry - code="HR-08" name="Primorsko-goranska županija"/> - <iso_3166_2_entry - code="HR-03" name="Sisačko-moslavačka županija"/> - <iso_3166_2_entry - code="HR-17" name="Splitsko-dalmatinska županija"/> - <iso_3166_2_entry - code="HR-15" name="Šibensko-kninska županija"/> - <iso_3166_2_entry - code="HR-05" name="Varaždinska županija"/> - <iso_3166_2_entry - code="HR-10" name="Virovitičko-podravska županija"/> - <iso_3166_2_entry - code="HR-16" name="Vukovarsko-srijemska županija"/> - <iso_3166_2_entry - code="HR-13" name="Zadarska županija"/> - <iso_3166_2_entry - code="HR-01" name="Zagrebačka županija"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Haiti --> - <iso_3166_country code="HT"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="HT-AR" name="Artibonite"/> - <iso_3166_2_entry - code="HT-CE" name="Centre"/> - <iso_3166_2_entry - code="HT-GA" name="Grande-Anse"/> - <iso_3166_2_entry - code="HT-ND" name="Nord"/> - <iso_3166_2_entry - code="HT-NE" name="Nord-Est"/> - <iso_3166_2_entry - code="HT-NO" name="Nord-Ouest"/> - <iso_3166_2_entry - code="HT-OU" name="Ouest"/> - <iso_3166_2_entry - code="HT-SD" name="Sud"/> - <iso_3166_2_entry - code="HT-SE" name="Sud-Est"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Hungary --> - <iso_3166_country code="HU"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="HU-BK" name="Bács-Kiskun"/> - <iso_3166_2_entry - code="HU-BA" name="Baranya"/> - <iso_3166_2_entry - code="HU-BE" name="Békés"/> - <iso_3166_2_entry - code="HU-BZ" name="Borsod-Abaúj-Zemplén"/> - <iso_3166_2_entry - code="HU-CS" name="Csongrád"/> - <iso_3166_2_entry - code="HU-FE" name="Fejér"/> - <iso_3166_2_entry - code="HU-GS" name="Győr-Moson-Sopron"/> - <iso_3166_2_entry - code="HU-HB" name="Hajdú-Bihar"/> - <iso_3166_2_entry - code="HU-HE" name="Heves"/> - <iso_3166_2_entry - code="HU-JN" name="Jász-Nagykun-Szolnok"/> - <iso_3166_2_entry - code="HU-KE" name="Komárom-Esztergom"/> - <iso_3166_2_entry - code="HU-NO" name="Nógrád"/> - <iso_3166_2_entry - code="HU-PE" name="Pest"/> - <iso_3166_2_entry - code="HU-SO" name="Somogy"/> - <iso_3166_2_entry - code="HU-SZ" name="Szabolcs-Szatmár-Bereg"/> - <iso_3166_2_entry - code="HU-TO" name="Tolna"/> - <iso_3166_2_entry - code="HU-VA" name="Vas"/> - <iso_3166_2_entry - code="HU-VE" name="Veszprém (county)"/> - <iso_3166_2_entry - code="HU-ZA" name="Zala"/> - </iso_3166_subset> - <iso_3166_subset type="City with county rights"> - <iso_3166_2_entry - code="HU-BC" name="Békéscsaba"/> - <iso_3166_2_entry - code="HU-DE" name="Debrecen"/> - <iso_3166_2_entry - code="HU-DU" name="Dunaújváros"/> - <iso_3166_2_entry - code="HU-EG" name="Eger"/> - <iso_3166_2_entry - code="HU-ER" name="Érd"/> - <iso_3166_2_entry - code="HU-GY" name="Győr"/> - <iso_3166_2_entry - code="HU-HV" name="Hódmezővásárhely"/> - <iso_3166_2_entry - code="HU-KV" name="Kaposvár"/> - <iso_3166_2_entry - code="HU-KM" name="Kecskemét"/> - <iso_3166_2_entry - code="HU-MI" name="Miskolc"/> - <iso_3166_2_entry - code="HU-NK" name="Nagykanizsa"/> - <iso_3166_2_entry - code="HU-NY" name="Nyíregyháza"/> - <iso_3166_2_entry - code="HU-PS" name="Pécs"/> - <iso_3166_2_entry - code="HU-ST" name="Salgótarján"/> - <iso_3166_2_entry - code="HU-SN" name="Sopron"/> - <iso_3166_2_entry - code="HU-SD" name="Szeged"/> - <iso_3166_2_entry - code="HU-SF" name="Székesfehérvár"/> - <iso_3166_2_entry - code="HU-SS" name="Szekszárd"/> - <iso_3166_2_entry - code="HU-SK" name="Szolnok"/> - <iso_3166_2_entry - code="HU-SH" name="Szombathely"/> - <iso_3166_2_entry - code="HU-TB" name="Tatabánya"/> - <iso_3166_2_entry - code="HU-VM" name="Veszprém"/> - <iso_3166_2_entry - code="HU-ZE" name="Zalaegerszeg"/> - </iso_3166_subset> - <iso_3166_subset type="Capital city"> - <iso_3166_2_entry - code="HU-BU" name="Budapest"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Indonesia --> - <iso_3166_country code="ID"> - <iso_3166_subset type="Geographical unit"> - <iso_3166_2_entry - code="ID-JW" name="Jawa"/> - <iso_3166_2_entry - code="ID-KA" name="Kalimantan"/> - <iso_3166_2_entry - code="ID-MA" name="Maluku"/> - <iso_3166_2_entry - code="ID-NU" name="Nusa Tenggara"/> - <iso_3166_2_entry - code="ID-IJ" name="Papua"/> - <iso_3166_2_entry - code="ID-SL" name="Sulawesi"/> - <iso_3166_2_entry - code="ID-SM" name="Sumatera"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous Province"> - <iso_3166_2_entry - code="ID-AC" name="Aceh" parent="SM"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ID-BA" name="Bali" parent="NU"/> - <iso_3166_2_entry - code="ID-BB" name="Bangka Belitung" parent="SM"/> - <iso_3166_2_entry - code="ID-BT" name="Banten" parent="JW"/> - <iso_3166_2_entry - code="ID-BE" name="Bengkulu" parent="SM"/> - <iso_3166_2_entry - code="ID-GO" name="Gorontalo" parent="SL"/> - <iso_3166_2_entry - code="ID-JA" name="Jambi" parent="SM"/> - <iso_3166_2_entry - code="ID-JB" name="Jawa Barat" parent="JW"/> - <iso_3166_2_entry - code="ID-JT" name="Jawa Tengah" parent="JW"/> - <iso_3166_2_entry - code="ID-JI" name="Jawa Timur" parent="JW"/> - <iso_3166_2_entry - code="ID-KB" name="Kalimantan Barat" parent="KA"/> - <iso_3166_2_entry - code="ID-KT" name="Kalimantan Tengah" parent="KA"/> - <iso_3166_2_entry - code="ID-KS" name="Kalimantan Selatan" parent="KA"/> - <iso_3166_2_entry - code="ID-KI" name="Kalimantan Timur" parent="KA"/> - <iso_3166_2_entry - code="ID-KR" name="Kepulauan Riau" parent="SM"/> - <iso_3166_2_entry - code="ID-LA" name="Lampung" parent="SM"/> - <iso_3166_2_entry - code="ID-MA" name="Maluku" parent="MA"/> - <iso_3166_2_entry - code="ID-MU" name="Maluku Utara" parent="MA"/> - <iso_3166_2_entry - code="ID-NB" name="Nusa Tenggara Barat" parent="NU"/> - <iso_3166_2_entry - code="ID-NT" name="Nusa Tenggara Timur" parent="NU"/> - <iso_3166_2_entry - code="ID-PA" name="Papua" parent="IJ"/> - <iso_3166_2_entry - code="ID-PB" name="Papua Barat" parent="IJ"/> - <iso_3166_2_entry - code="ID-RI" name="Riau" parent="SM"/> - <iso_3166_2_entry - code="ID-SR" name="Sulawesi Barat" parent="SL"/> - <iso_3166_2_entry - code="ID-SN" name="Sulawesi Selatan" parent="SL"/> - <iso_3166_2_entry - code="ID-ST" name="Sulawesi Tengah" parent="SL"/> - <iso_3166_2_entry - code="ID-SG" name="Sulawesi Tenggara" parent="SL"/> - <iso_3166_2_entry - code="ID-SA" name="Sulawesi Utara" parent="SL"/> - <iso_3166_2_entry - code="ID-SB" name="Sumatra Barat" parent="SM"/> - <iso_3166_2_entry - code="ID-SS" name="Sumatra Selatan" parent="SM"/> - <iso_3166_2_entry - code="ID-SU" name="Sumatera Utara" parent="SM"/> - </iso_3166_subset> - <iso_3166_subset type="Special District"> - <iso_3166_2_entry - code="ID-JK" name="Jakarta Raya" parent="JW"/> - </iso_3166_subset> - <iso_3166_subset type="Special Region"> - <iso_3166_2_entry - code="ID-YO" name="Yogyakarta" parent="JW"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ireland --> - <iso_3166_country code="IE"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="IE-C" name="Connacht"/> - <iso_3166_2_entry - code="IE-L" name="Leinster"/> - <iso_3166_2_entry - code="IE-M" name="Munster"/> - <iso_3166_2_entry - code="IE-U" name="Ulster"/> - </iso_3166_subset> - <iso_3166_subset type="County"> - <!-- Ireland uses Car Registration codes for Counties as ISO 3166-2 regions --> - <iso_3166_2_entry - code="IE-CW" name="Carlow" parent="L"/> - <iso_3166_2_entry - code="IE-CN" name="Cavan" parent="U"/> - <iso_3166_2_entry - code="IE-CE" name="Clare" parent="M"/> - <iso_3166_2_entry - code="IE-C" name="Cork" parent="M"/> - <iso_3166_2_entry - code="IE-DL" name="Donegal" parent="U"/> - <iso_3166_2_entry - code="IE-D" name="Dublin" parent="L"/> - <iso_3166_2_entry - code="IE-G" name="Galway" parent="C"/> - <iso_3166_2_entry - code="IE-KY" name="Kerry" parent="M"/> - <iso_3166_2_entry - code="IE-KE" name="Kildare" parent="L"/> - <iso_3166_2_entry - code="IE-KK" name="Kilkenny" parent="L"/> - <iso_3166_2_entry - code="IE-LS" name="Laois" parent="L"/> - <iso_3166_2_entry - code="IE-LM" name="Leitrim" parent="C"/> - <iso_3166_2_entry - code="IE-LK" name="Limerick" parent="M"/> - <iso_3166_2_entry - code="IE-LD" name="Longford" parent="L"/> - <iso_3166_2_entry - code="IE-LH" name="Louth" parent="L"/> - <iso_3166_2_entry - code="IE-MO" name="Mayo" parent="C"/> - <iso_3166_2_entry - code="IE-MH" name="Meath" parent="L"/> - <iso_3166_2_entry - code="IE-MN" name="Monaghan" parent="U"/> - <iso_3166_2_entry - code="IE-OY" name="Offaly" parent="L"/> - <iso_3166_2_entry - code="IE-RN" name="Roscommon" parent="C"/> - <iso_3166_2_entry - code="IE-SO" name="Sligo" parent="C"/> - <iso_3166_2_entry - code="IE-TA" name="Tipperary" parent="M"/> - <iso_3166_2_entry - code="IE-WD" name="Waterford" parent="M"/> - <iso_3166_2_entry - code="IE-WH" name="Westmeath" parent="L"/> - <iso_3166_2_entry - code="IE-WX" name="Wexford" parent="L"/> - <iso_3166_2_entry - code="IE-WW" name="Wicklow" parent="L"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Israel --> - <iso_3166_country code="IL"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="IL-D" name="HaDarom"/> - <iso_3166_2_entry - code="IL-M" name="HaMerkaz"/> - <iso_3166_2_entry - code="IL-Z" name="HaZafon"/> - <iso_3166_2_entry - code="IL-HA" name="Hefa"/> - <iso_3166_2_entry - code="IL-TA" name="Tel-Aviv"/> - <iso_3166_2_entry - code="IL-JM" name="Yerushalayim Al Quds"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Isle of Man --> - <iso_3166_country code="IM"/> - <!-- India --> - <iso_3166_country code="IN"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="IN-AP" name="Andhra Pradesh"/> - <iso_3166_2_entry - code="IN-AR" name="Arunāchal Pradesh"/> - <iso_3166_2_entry - code="IN-AS" name="Assam"/> - <iso_3166_2_entry - code="IN-BR" name="Bihār"/> - <iso_3166_2_entry - code="IN-CT" name="Chhattīsgarh"/> - <iso_3166_2_entry - code="IN-GA" name="Goa"/> - <iso_3166_2_entry - code="IN-GJ" name="Gujarāt"/> - <iso_3166_2_entry - code="IN-HR" name="Haryāna"/> - <iso_3166_2_entry - code="IN-HP" name="Himāchal Pradesh"/> - <iso_3166_2_entry - code="IN-JK" name="Jammu and Kashmīr"/> - <iso_3166_2_entry - code="IN-JH" name="Jharkhand"/> - <iso_3166_2_entry - code="IN-KA" name="Karnātaka"/> - <iso_3166_2_entry - code="IN-KL" name="Kerala"/> - <iso_3166_2_entry - code="IN-MP" name="Madhya Pradesh"/> - <iso_3166_2_entry - code="IN-MH" name="Mahārāshtra"/> - <iso_3166_2_entry - code="IN-MN" name="Manipur"/> - <iso_3166_2_entry - code="IN-ML" name="Meghālaya"/> - <iso_3166_2_entry - code="IN-MZ" name="Mizoram"/> - <iso_3166_2_entry - code="IN-NL" name="Nāgāland"/> - <iso_3166_2_entry - code="IN-OR" name="Orissa"/> - <iso_3166_2_entry - code="IN-PB" name="Punjab"/> - <iso_3166_2_entry - code="IN-RJ" name="Rājasthān"/> - <iso_3166_2_entry - code="IN-SK" name="Sikkim"/> - <iso_3166_2_entry - code="IN-TN" name="Tamil Nādu"/> - <iso_3166_2_entry - code="IN-TR" name="Tripura"/> - <iso_3166_2_entry - code="IN-UL" name="Uttaranchal"/> - <iso_3166_2_entry - code="IN-UP" name="Uttar Pradesh"/> - <iso_3166_2_entry - code="IN-WB" name="West Bengal"/> - </iso_3166_subset> - <iso_3166_subset type="Union territory"> - <iso_3166_2_entry - code="IN-AN" name="Andaman and Nicobar Islands"/> - <iso_3166_2_entry - code="IN-CH" name="Chandīgarh"/> - <iso_3166_2_entry - code="IN-DN" name="Dādra and Nagar Haveli"/> - <iso_3166_2_entry - code="IN-DD" name="Damān and Diu"/> - <iso_3166_2_entry - code="IN-DL" name="Delhi"/> - <iso_3166_2_entry - code="IN-LD" name="Lakshadweep"/> - <iso_3166_2_entry - code="IN-PY" name="Pondicherry"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Iraq --> - <iso_3166_country code="IQ"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="IQ-AN" name="Al Anbar"/> - <iso_3166_2_entry - code="IQ-BA" name="Al Basrah"/> - <iso_3166_2_entry - code="IQ-MU" name="Al Muthanna"/> - <iso_3166_2_entry - code="IQ-QA" name="Al Qadisiyah"/> - <iso_3166_2_entry - code="IQ-NA" name="An Najef"/> - <iso_3166_2_entry - code="IQ-AR" name="Arbil"/> - <iso_3166_2_entry - code="IQ-SW" name="As Sulaymaniyah"/> - <iso_3166_2_entry - code="IQ-TS" name="At Ta'mim"/> - <iso_3166_2_entry - code="IQ-BB" name="Babil"/> - <iso_3166_2_entry - code="IQ-BG" name="Baghdad"/> - <iso_3166_2_entry - code="IQ-DA" name="Dahuk"/> - <iso_3166_2_entry - code="IQ-DQ" name="Dhi Qar"/> - <iso_3166_2_entry - code="IQ-DI" name="Diyala"/> - <iso_3166_2_entry - code="IQ-KA" name="Karbala'"/> - <iso_3166_2_entry - code="IQ-MA" name="Maysan"/> - <iso_3166_2_entry - code="IQ-NI" name="Ninawa"/> - <iso_3166_2_entry - code="IQ-SD" name="Salah ad Din"/> - <iso_3166_2_entry - code="IQ-WA" name="Wasit"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Iran --> - <iso_3166_country code="IR"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="IR-03" name="Ardabīl"/> - <iso_3166_2_entry - code="IR-02" name="Āzarbāyjān-e Gharbī"/> - <iso_3166_2_entry - code="IR-01" name="Āzarbāyjān-e Sharqī"/> - <iso_3166_2_entry - code="IR-06" name="Būshehr"/> - <iso_3166_2_entry - code="IR-08" name="Chahār Mahāll va Bakhtīārī"/> - <iso_3166_2_entry - code="IR-04" name="Eşfahān"/> - <iso_3166_2_entry - code="IR-14" name="Fārs"/> - <iso_3166_2_entry - code="IR-19" name="Gīlān"/> - <iso_3166_2_entry - code="IR-27" name="Golestān"/> - <iso_3166_2_entry - code="IR-24" name="Hamadān"/> - <iso_3166_2_entry - code="IR-23" name="Hormozgān"/> - <iso_3166_2_entry - code="IR-05" name="Īlām"/> - <iso_3166_2_entry - code="IR-15" name="Kermān"/> - <iso_3166_2_entry - code="IR-17" name="Kermānshāh"/> - <iso_3166_2_entry - code="IR-29" name="Khorāsān-e Janūbī"/> - <iso_3166_2_entry - code="IR-30" name="Khorāsān-e Razavī"/> - <iso_3166_2_entry - code="IR-31" name="Khorāsān-e Shemālī"/> - <iso_3166_2_entry - code="IR-10" name="Khūzestān"/> - <iso_3166_2_entry - code="IR-18" name="Kohgīlūyeh va Būyer Ahmad"/> - <iso_3166_2_entry - code="IR-16" name="Kordestān"/> - <iso_3166_2_entry - code="IR-20" name="Lorestān"/> - <iso_3166_2_entry - code="IR-22" name="Markazī"/> - <iso_3166_2_entry - code="IR-21" name="Māzandarān"/> - <iso_3166_2_entry - code="IR-28" name="Qazvīn"/> - <iso_3166_2_entry - code="IR-26" name="Qom"/> - <iso_3166_2_entry - code="IR-12" name="Semnān"/> - <iso_3166_2_entry - code="IR-13" name="Sīstān va Balūchestān"/> - <iso_3166_2_entry - code="IR-07" name="Tehrān"/> - <iso_3166_2_entry - code="IR-25" name="Yazd"/> - <iso_3166_2_entry - code="IR-11" name="Zanjān"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Iceland --> - <iso_3166_country code="IS"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="IS-7" name="Austurland"/> - <iso_3166_2_entry - code="IS-1" name="Höfuðborgarsvæðið"/> - <iso_3166_2_entry - code="IS-6" name="Norðurland eystra"/> - <iso_3166_2_entry - code="IS-5" name="Norðurland vestra"/> - <iso_3166_2_entry - code="IS-8" name="Suðurland"/> - <iso_3166_2_entry - code="IS-2" name="Suðurnes"/> - <iso_3166_2_entry - code="IS-4" name="Vestfirðir"/> - <iso_3166_2_entry - code="IS-3" name="Vesturland"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="IS-0" name="Reykjavík"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Italy --> - <iso_3166_country code="IT"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="IT-65" name="Abruzzo"/> - <iso_3166_2_entry - code="IT-77" name="Basilicata"/> - <iso_3166_2_entry - code="IT-78" name="Calabria"/> - <iso_3166_2_entry - code="IT-72" name="Campania"/> - <iso_3166_2_entry - code="IT-45" name="Emilia-Romagna"/> - <iso_3166_2_entry - code="IT-36" name="Friuli-Venezia Giulia"/> - <iso_3166_2_entry - code="IT-62" name="Lazio"/> - <iso_3166_2_entry - code="IT-42" name="Liguria"/> - <iso_3166_2_entry - code="IT-25" name="Lombardia"/> - <iso_3166_2_entry - code="IT-57" name="Marche"/> - <iso_3166_2_entry - code="IT-67" name="Molise"/> - <iso_3166_2_entry - code="IT-21" name="Piemonte"/> - <iso_3166_2_entry - code="IT-75" name="Puglia"/> - <iso_3166_2_entry - code="IT-88" name="Sardegna"/> - <iso_3166_2_entry - code="IT-82" name="Sicilia"/> - <iso_3166_2_entry - code="IT-52" name="Toscana"/> - <iso_3166_2_entry - code="IT-32" name="Trentino-Alto Adige"/> - <iso_3166_2_entry - code="IT-55" name="Umbria"/> - <iso_3166_2_entry - code="IT-23" name="Valle d'Aosta"/> - <iso_3166_2_entry - code="IT-34" name="Veneto"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="IT-AG" name="Agrigento" parent="82"/> - <iso_3166_2_entry - code="IT-AL" name="Alessandria" parent="21"/> - <iso_3166_2_entry - code="IT-AN" name="Ancona" parent="57"/> - <iso_3166_2_entry - code="IT-AO" name="Aosta" parent="23"/> - <iso_3166_2_entry - code="IT-AR" name="Arezzo" parent="52"/> - <iso_3166_2_entry - code="IT-AP" name="Ascoli Piceno" parent="57"/> - <iso_3166_2_entry - code="IT-AT" name="Asti" parent="21"/> - <iso_3166_2_entry - code="IT-AV" name="Avellino" parent="72"/> - <iso_3166_2_entry - code="IT-BA" name="Bari" parent="75"/> - <iso_3166_2_entry - code="IT-BT" name="Barletta-Andria-Trani" parent="75"/> - <iso_3166_2_entry - code="IT-BL" name="Belluno" parent="34"/> - <iso_3166_2_entry - code="IT-BN" name="Benevento" parent="72"/> - <iso_3166_2_entry - code="IT-BG" name="Bergamo" parent="25"/> - <iso_3166_2_entry - code="IT-BI" name="Biella" parent="21"/> - <iso_3166_2_entry - code="IT-BO" name="Bologna" parent="45"/> - <iso_3166_2_entry - code="IT-BZ" name="Bolzano" parent="32"/> - <iso_3166_2_entry - code="IT-BS" name="Brescia" parent="25"/> - <iso_3166_2_entry - code="IT-BR" name="Brindisi" parent="75"/> - <iso_3166_2_entry - code="IT-CA" name="Cagliari" parent="88"/> - <iso_3166_2_entry - code="IT-CL" name="Caltanissetta" parent="82"/> - <iso_3166_2_entry - code="IT-CB" name="Campobasso" parent="67"/> - <iso_3166_2_entry - code="IT-CI" name="Carbonia-Iglesias" parent="88"/> - <iso_3166_2_entry - code="IT-CE" name="Caserta" parent="72"/> - <iso_3166_2_entry - code="IT-CT" name="Catania" parent="82"/> - <iso_3166_2_entry - code="IT-CZ" name="Catanzaro" parent="78"/> - <iso_3166_2_entry - code="IT-CH" name="Chieti" parent="65"/> - <iso_3166_2_entry - code="IT-CO" name="Como" parent="25"/> - <iso_3166_2_entry - code="IT-CS" name="Cosenza" parent="78"/> - <iso_3166_2_entry - code="IT-CR" name="Cremona" parent="25"/> - <iso_3166_2_entry - code="IT-KR" name="Crotone" parent="78"/> - <iso_3166_2_entry - code="IT-CN" name="Cuneo" parent="21"/> - <iso_3166_2_entry - code="IT-EN" name="Enna" parent="82"/> - <iso_3166_2_entry - code="IT-FM" name="Fermo" parent="57"/> - <iso_3166_2_entry - code="IT-FE" name="Ferrara" parent="45"/> - <iso_3166_2_entry - code="IT-FI" name="Firenze" parent="52"/> - <iso_3166_2_entry - code="IT-FG" name="Foggia" parent="75"/> - <iso_3166_2_entry - code="IT-FC" name="Forlì-Cesena" parent="45"/> - <iso_3166_2_entry - code="IT-FR" name="Frosinone" parent="62"/> - <iso_3166_2_entry - code="IT-GE" name="Genova" parent="42"/> - <iso_3166_2_entry - code="IT-GO" name="Gorizia" parent="36"/> - <iso_3166_2_entry - code="IT-GR" name="Grosseto" parent="52"/> - <iso_3166_2_entry - code="IT-IM" name="Imperia" parent="42"/> - <iso_3166_2_entry - code="IT-IS" name="Isernia" parent="67"/> - <iso_3166_2_entry - code="IT-SP" name="La Spezia" parent="42"/> - <iso_3166_2_entry - code="IT-AQ" name="L'Aquila" parent="65"/> - <iso_3166_2_entry - code="IT-LT" name="Latina" parent="62"/> - <iso_3166_2_entry - code="IT-LE" name="Lecce" parent="75"/> - <iso_3166_2_entry - code="IT-LC" name="Lecco" parent="25"/> - <iso_3166_2_entry - code="IT-LI" name="Livorno" parent="52"/> - <iso_3166_2_entry - code="IT-LO" name="Lodi" parent="25"/> - <iso_3166_2_entry - code="IT-LU" name="Lucca" parent="52"/> - <iso_3166_2_entry - code="IT-SC" name="Macerata" parent="57"/> - <iso_3166_2_entry - code="IT-MN" name="Mantova" parent="25"/> - <iso_3166_2_entry - code="IT-MS" name="Massa-Carrara" parent="52"/> - <iso_3166_2_entry - code="IT-MT" name="Matera" parent="77"/> - <iso_3166_2_entry - code="IT-VS" name="Medio Campidano" parent="88"/> - <iso_3166_2_entry - code="IT-ME" name="Messina" parent="82"/> - <iso_3166_2_entry - code="IT-MI" name="Milano" parent="25"/> - <iso_3166_2_entry - code="IT-MO" name="Modena" parent="45"/> - <iso_3166_2_entry - code="IT-MB" name="Monza e Brianza" parent="25"/> - <iso_3166_2_entry - code="IT-NA" name="Napoli" parent="72"/> - <iso_3166_2_entry - code="IT-NO" name="Novara" parent="21"/> - <iso_3166_2_entry - code="IT-NU" name="Nuoro" parent="88"/> - <iso_3166_2_entry - code="IT-OG" name="Ogliastra" parent="88"/> - <iso_3166_2_entry - code="IT-OT" name="Olbia-Tempio" parent="88"/> - <iso_3166_2_entry - code="IT-OR" name="Oristano" parent="88"/> - <iso_3166_2_entry - code="IT-PD" name="Padova" parent="34"/> - <iso_3166_2_entry - code="IT-PA" name="Palermo" parent="82"/> - <iso_3166_2_entry - code="IT-PR" name="Parma" parent="45"/> - <iso_3166_2_entry - code="IT-PV" name="Pavia" parent="25"/> - <iso_3166_2_entry - code="IT-PG" name="Perugia" parent="55"/> - <iso_3166_2_entry - code="IT-PU" name="Pesaro e Urbino" parent="57"/> - <iso_3166_2_entry - code="IT-PE" name="Pescara" parent="65"/> - <iso_3166_2_entry - code="IT-PC" name="Piacenza" parent="45"/> - <iso_3166_2_entry - code="IT-PI" name="Pisa" parent="52"/> - <iso_3166_2_entry - code="IT-PT" name="Pistoia" parent="52"/> - <iso_3166_2_entry - code="IT-PN" name="Pordenone" parent="36"/> - <iso_3166_2_entry - code="IT-PZ" name="Potenza" parent="77"/> - <iso_3166_2_entry - code="IT-PO" name="Prato" parent="52"/> - <iso_3166_2_entry - code="IT-RG" name="Ragusa" parent="82"/> - <iso_3166_2_entry - code="IT-RA" name="Ravenna" parent="45"/> - <iso_3166_2_entry - code="IT-RC" name="Reggio Calabria" parent="78"/> - <iso_3166_2_entry - code="IT-RE" name="Reggio Emilia" parent="45"/> - <iso_3166_2_entry - code="IT-RI" name="Rieti" parent="62"/> - <iso_3166_2_entry - code="IT-RN" name="Rimini" parent="45"/> - <iso_3166_2_entry - code="IT-RM" name="Roma" parent="62"/> - <iso_3166_2_entry - code="IT-RO" name="Rovigo" parent="34"/> - <iso_3166_2_entry - code="IT-SA" name="Salerno" parent="72"/> - <iso_3166_2_entry - code="IT-SS" name="Sassari" parent="88"/> - <iso_3166_2_entry - code="IT-SV" name="Savona" parent="42"/> - <iso_3166_2_entry - code="IT-SI" name="Siena" parent="52"/> - <iso_3166_2_entry - code="IT-SR" name="Siracusa" parent="82"/> - <iso_3166_2_entry - code="IT-SO" name="Sondrio" parent="25"/> - <iso_3166_2_entry - code="IT-TA" name="Taranto" parent="75"/> - <iso_3166_2_entry - code="IT-TE" name="Teramo" parent="65"/> - <iso_3166_2_entry - code="IT-TR" name="Terni" parent="55"/> - <iso_3166_2_entry - code="IT-TO" name="Torino" parent="21"/> - <iso_3166_2_entry - code="IT-TP" name="Trapani" parent="82"/> - <iso_3166_2_entry - code="IT-TN" name="Trento" parent="32"/> - <iso_3166_2_entry - code="IT-TV" name="Treviso" parent="34"/> - <iso_3166_2_entry - code="IT-TS" name="Trieste" parent="36"/> - <iso_3166_2_entry - code="IT-UD" name="Udine" parent="36"/> - <iso_3166_2_entry - code="IT-VA" name="Varese" parent="25"/> - <iso_3166_2_entry - code="IT-VE" name="Venezia" parent="34"/> - <iso_3166_2_entry - code="IT-VB" name="Verbano-Cusio-Ossola" parent="21"/> - <iso_3166_2_entry - code="IT-VC" name="Vercelli" parent="21"/> - <iso_3166_2_entry - code="IT-VR" name="Verona" parent="34"/> - <iso_3166_2_entry - code="IT-VV" name="Vibo Valentia" parent="78"/> - <iso_3166_2_entry - code="IT-VI" name="Vicenza" parent="34"/> - <iso_3166_2_entry - code="IT-VT" name="Viterbo" parent="62"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Jersey --> - <iso_3166_country code="JE"/> - <!-- Jamaica --> - <iso_3166_country code="JM"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="JM-13" name="Clarendon"/> - <iso_3166_2_entry - code="JM-09" name="Hanover"/> - <iso_3166_2_entry - code="JM-01" name="Kingston"/> - <iso_3166_2_entry - code="JM-12" name="Manchester"/> - <iso_3166_2_entry - code="JM-04" name="Portland"/> - <iso_3166_2_entry - code="JM-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="JM-06" name="Saint Ann"/> - <iso_3166_2_entry - code="JM-14" name="Saint Catherine"/> - <iso_3166_2_entry - code="JM-11" name="Saint Elizabeth"/> - <iso_3166_2_entry - code="JM-08" name="Saint James"/> - <iso_3166_2_entry - code="JM-05" name="Saint Mary"/> - <iso_3166_2_entry - code="JM-03" name="Saint Thomas"/> - <iso_3166_2_entry - code="JM-07" name="Trelawny"/> - <iso_3166_2_entry - code="JM-10" name="Westmoreland"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Jordan --> - <iso_3166_country code="JO"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="JO-AJ" name="`Ajlun"/> - <iso_3166_2_entry - code="JO-AQ" name="Al `Aqabah"/> - <iso_3166_2_entry - code="JO-BA" name="Al Balqā'"/> - <iso_3166_2_entry - code="JO-KA" name="Al Karak"/> - <iso_3166_2_entry - code="JO-MA" name="Al Mafraq"/> - <iso_3166_2_entry - code="JO-AM" name="Amman"/> - <iso_3166_2_entry - code="JO-AT" name="Aţ Ţafīlah"/> - <iso_3166_2_entry - code="JO-AZ" name="Az Zarqā'"/> - <iso_3166_2_entry - code="JO-JR" name="Irbid"/> - <iso_3166_2_entry - code="JO-JA" name="Jarash"/> - <iso_3166_2_entry - code="JO-MN" name="Ma`ān"/> - <iso_3166_2_entry - code="JO-MD" name="Mādabā"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Japan --> - <iso_3166_country code="JP"> - <iso_3166_subset type="Prefecture"> - <!-- Japan uses Prefectures for its ISO 3166-2 regions --> - <!-- Data taken from http://fotw.digibel.be/flags/jp-prefe.html --> - <iso_3166_2_entry - code="JP-23" name="Aichi"/> - <iso_3166_2_entry - code="JP-05" name="Akita"/> - <iso_3166_2_entry - code="JP-02" name="Aomori"/> - <iso_3166_2_entry - code="JP-12" name="Chiba"/> - <iso_3166_2_entry - code="JP-38" name="Ehime"/> - <iso_3166_2_entry - code="JP-18" name="Fukui"/> - <iso_3166_2_entry - code="JP-40" name="Fukuoka"/> - <iso_3166_2_entry - code="JP-07" name="Fukushima"/> - <iso_3166_2_entry - code="JP-21" name="Gifu"/> - <iso_3166_2_entry - code="JP-10" name="Gunma"/> - <iso_3166_2_entry - code="JP-34" name="Hiroshima"/> - <iso_3166_2_entry - code="JP-01" name="Hokkaido"/> - <iso_3166_2_entry - code="JP-28" name="Hyogo"/> - <iso_3166_2_entry - code="JP-08" name="Ibaraki"/> - <iso_3166_2_entry - code="JP-17" name="Ishikawa"/> - <iso_3166_2_entry - code="JP-03" name="Iwate"/> - <iso_3166_2_entry - code="JP-37" name="Kagawa"/> - <iso_3166_2_entry - code="JP-46" name="Kagoshima"/> - <iso_3166_2_entry - code="JP-14" name="Kanagawa"/> - <iso_3166_2_entry - code="JP-39" name="Kochi"/> - <iso_3166_2_entry - code="JP-43" name="Kumamoto"/> - <iso_3166_2_entry - code="JP-26" name="Kyoto"/> - <iso_3166_2_entry - code="JP-24" name="Mie"/> - <iso_3166_2_entry - code="JP-04" name="Miyagi"/> - <iso_3166_2_entry - code="JP-45" name="Miyazaki"/> - <iso_3166_2_entry - code="JP-20" name="Nagano"/> - <iso_3166_2_entry - code="JP-42" name="Nagasaki"/> - <iso_3166_2_entry - code="JP-29" name="Nara"/> - <iso_3166_2_entry - code="JP-15" name="Niigata"/> - <iso_3166_2_entry - code="JP-44" name="Oita"/> - <iso_3166_2_entry - code="JP-33" name="Okayama"/> - <iso_3166_2_entry - code="JP-47" name="Okinawa"/> - <iso_3166_2_entry - code="JP-27" name="Osaka"/> - <iso_3166_2_entry - code="JP-41" name="Saga"/> - <iso_3166_2_entry - code="JP-11" name="Saitama"/> - <iso_3166_2_entry - code="JP-25" name="Shiga"/> - <iso_3166_2_entry - code="JP-32" name="Shimane"/> - <iso_3166_2_entry - code="JP-22" name="Shizuoka"/> - <iso_3166_2_entry - code="JP-09" name="Tochigi"/> - <iso_3166_2_entry - code="JP-36" name="Tokushima"/> - <iso_3166_2_entry - code="JP-13" name="Tokyo"/> - <iso_3166_2_entry - code="JP-31" name="Tottori"/> - <iso_3166_2_entry - code="JP-16" name="Toyama"/> - <iso_3166_2_entry - code="JP-30" name="Wakayama"/> - <iso_3166_2_entry - code="JP-06" name="Yamagata"/> - <iso_3166_2_entry - code="JP-35" name="Yamaguchi"/> - <iso_3166_2_entry - code="JP-19" name="Yamanashi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kenya --> - <iso_3166_country code="KE"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KE-110" name="Nairobi Municipality"/> - <iso_3166_2_entry - code="KE-200" name="Central"/> - <iso_3166_2_entry - code="KE-300" name="Coast"/> - <iso_3166_2_entry - code="KE-400" name="Eastern"/> - <iso_3166_2_entry - code="KE-500" name="North-Eastern Kaskazini Mashariki"/> - <iso_3166_2_entry - code="KE-700" name="Rift Valley"/> - <iso_3166_2_entry - code="KE-900" name="Western Magharibi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kyrgystan --> - <iso_3166_country code="KG"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="KG-GB" name="Bishkek"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="KG-B" name="Batken"/> - <iso_3166_2_entry - code="KG-C" name="Chü"/> - <iso_3166_2_entry - code="KG-J" name="Jalal-Abad"/> - <iso_3166_2_entry - code="KG-N" name="Naryn"/> - <iso_3166_2_entry - code="KG-O" name="Osh"/> - <iso_3166_2_entry - code="KG-T" name="Talas"/> - <iso_3166_2_entry - code="KG-Y" name="Ysyk-Köl"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cambodia --> - <iso_3166_country code="KH"> - <iso_3166_subset type="Autonomous municipality"> - <iso_3166_2_entry - code="KH-23" name="Krong Kaeb"/> - <iso_3166_2_entry - code="KH-24" name="Krong Pailin"/> - <iso_3166_2_entry - code="KH-18" name="Krong Preah Sihanouk"/> - <iso_3166_2_entry - code="KH-12" name="Phnom Penh"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KH-2" name="Battambang"/> - <iso_3166_2_entry - code="KH-1" name="Banteay Mean Chey"/> - <iso_3166_2_entry - code="KH-3" name="Kampong Cham"/> - <iso_3166_2_entry - code="KH-4" name="Kampong Chhnang"/> - <iso_3166_2_entry - code="KH-5" name="Kampong Speu"/> - <iso_3166_2_entry - code="KH-6" name="Kampong Thom"/> - <iso_3166_2_entry - code="KH-7" name="Kampot"/> - <iso_3166_2_entry - code="KH-8" name="Kandal"/> - <iso_3166_2_entry - code="KH-9" name="Kach Kong"/> - <iso_3166_2_entry - code="KH-10" name="Krachoh"/> - <iso_3166_2_entry - code="KH-11" name="Mondol Kiri"/> - <iso_3166_2_entry - code="KH-22" name="Otdar Mean Chey"/> - <iso_3166_2_entry - code="KH-15" name="Pousaat"/> - <iso_3166_2_entry - code="KH-13" name="Preah Vihear"/> - <iso_3166_2_entry - code="KH-14" name="Prey Veaeng"/> - <iso_3166_2_entry - code="KH-16" name="Rotanak Kiri"/> - <iso_3166_2_entry - code="KH-17" name="Siem Reab"/> - <iso_3166_2_entry - code="KH-19" name="Stueng Traeng"/> - <iso_3166_2_entry - code="KH-20" name="Svaay Rieng"/> - <iso_3166_2_entry - code="KH-21" name="Taakaev"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kiribati --> - <iso_3166_country code="KI"> - <iso_3166_subset type="Island group"> - <iso_3166_2_entry - code="KI-G" name="Gilbert Islands"/> - <iso_3166_2_entry - code="KI-L" name="Line Islands"/> - <iso_3166_2_entry - code="KI-P" name="Phoenix Islands"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Kitts and Nevis --> - <iso_3166_country code="KN"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="KN-K" name="Saint Kitts"/> - <iso_3166_2_entry - code="KN-N" name="Nevis"/> - </iso_3166_subset> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="KN-01" name="Christ Church Nichola Town" parent="K"/> - <iso_3166_2_entry - code="KN-02" name="Saint Anne Sandy Point" parent="K"/> - <iso_3166_2_entry - code="KN-03" name="Saint George Basseterre" parent="K"/> - <iso_3166_2_entry - code="KN-04" name="Saint George Gingerland" parent="N"/> - <iso_3166_2_entry - code="KN-05" name="Saint James Windward" parent="N"/> - <iso_3166_2_entry - code="KN-06" name="Saint John Capisterre" parent="K"/> - <iso_3166_2_entry - code="KN-07" name="Saint John Figtree" parent="N"/> - <iso_3166_2_entry - code="KN-08" name="Saint Mary Cayon" parent="K"/> - <iso_3166_2_entry - code="KN-09" name="Saint Paul Capisterre" parent="K"/> - <iso_3166_2_entry - code="KN-10" name="Saint Paul Charlestown" parent="N"/> - <iso_3166_2_entry - code="KN-11" name="Saint Peter Basseterre" parent="K"/> - <iso_3166_2_entry - code="KN-12" name="Saint Thomas Lowland" parent="N"/> - <iso_3166_2_entry - code="KN-13" name="Saint Thomas Middle Island" parent="K"/> - <iso_3166_2_entry - code="KN-15" name="Trinity Palmetto Point" parent="K"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Comorros --> - <iso_3166_country code="KM"> - <iso_3166_subset type="Island"> - <iso_3166_2_entry - code="KM-A" name="Andjouân (Anjwān)"/> - <iso_3166_2_entry - code="KM-G" name="Andjazîdja (Anjazījah)"/> - <iso_3166_2_entry - code="KM-M" name="Moûhîlî (Mūhīlī)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- North Korea --> - <iso_3166_country code="KP"> - <iso_3166_subset type="Capital city"> - <iso_3166_2_entry - code="KP-01" name="P’yŏngyang"/> - </iso_3166_subset> - <iso_3166_subset type="Special city"> - <iso_3166_2_entry - code="KP-13" name="Nasŏn (Najin-Sŏnbong)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KP-02" name="P’yŏngan-namdo"/> - <iso_3166_2_entry - code="KP-03" name="P’yŏngan-bukto"/> - <iso_3166_2_entry - code="KP-04" name="Chagang-do"/> - <iso_3166_2_entry - code="KP-05" name="Hwanghae-namdo"/> - <iso_3166_2_entry - code="KP-06" name="Hwanghae-bukto"/> - <iso_3166_2_entry - code="KP-07" name="Kangwŏn-do"/> - <iso_3166_2_entry - code="KP-08" name="Hamgyŏng-namdo"/> - <iso_3166_2_entry - code="KP-09" name="Hamgyŏng-bukto"/> - <iso_3166_2_entry - code="KP-10" name="Yanggang-do"/> - </iso_3166_subset> - </iso_3166_country> - <!-- South Korea --> - <iso_3166_country code="KR"> - <iso_3166_subset type="Capital Metropolitan City"> - <iso_3166_2_entry - code="KR-11" name="Seoul Teugbyeolsi"/> - </iso_3166_subset> - <iso_3166_subset type="Metropolitan cities"> - <iso_3166_2_entry - code="KR-26" name="Busan Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-27" name="Daegu Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-30" name="Daejeon Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-29" name="Gwangju Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-28" name="Incheon Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-31" name="Ulsan Gwang'yeogsi"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KR-43" name="Chungcheongbukdo"/> - <iso_3166_2_entry - code="KR-44" name="Chungcheongnamdo"/> - <iso_3166_2_entry - code="KR-42" name="Gang'weondo"/> - <iso_3166_2_entry - code="KR-41" name="Gyeonggido"/> - <iso_3166_2_entry - code="KR-47" name="Gyeongsangbukdo"/> - <iso_3166_2_entry - code="KR-48" name="Gyeongsangnamdo"/> - <iso_3166_2_entry - code="KR-49" name="Jejudo"/> - <iso_3166_2_entry - code="KR-45" name="Jeonrabukdo"/> - <iso_3166_2_entry - code="KR-46" name="Jeonranamdo"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kuwait --> - <iso_3166_country code="KW"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="KW-AH" name="Al Ahmadi"/> - <iso_3166_2_entry - code="KW-FA" name="Al Farwānīyah"/> - <iso_3166_2_entry - code="KW-JA" name="Al Jahrah"/> - <iso_3166_2_entry - code="KW-KU" name="Al Kuwayt"/> - <iso_3166_2_entry - code="KW-HA" name="Hawallī"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kazakhstan --> - <iso_3166_country code="KZ"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="KZ-ALA" name="Almaty"/> - <iso_3166_2_entry - code="KZ-AST" name="Astana"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="KZ-ALM" name="Almaty oblysy"/> - <iso_3166_2_entry - code="KZ-AKM" name="Aqmola oblysy"/> - <iso_3166_2_entry - code="KZ-AKT" name="Aqtöbe oblysy"/> - <iso_3166_2_entry - code="KZ-ATY" name="Atyraū oblysy"/> - <iso_3166_2_entry - code="KZ-ZAP" name="Batys Quzaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-MAN" name="Mangghystaū oblysy"/> - <iso_3166_2_entry - code="KZ-YUZ" name="Ongtüstik Qazaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-PAV" name="Pavlodar oblysy"/> - <iso_3166_2_entry - code="KZ-KAR" name="Qaraghandy oblysy"/> - <iso_3166_2_entry - code="KZ-KUS" name="Qostanay oblysy"/> - <iso_3166_2_entry - code="KZ-KZY" name="Qyzylorda oblysy"/> - <iso_3166_2_entry - code="KZ-VOS" name="Shyghys Qazaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-SEV" name="Soltüstik Quzaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-ZHA" name="Zhambyl oblysy"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Laos --> - <iso_3166_country code="LA"> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="LA-VT" name="Vientiane"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="LA-AT" name="Attapu"/> - <iso_3166_2_entry - code="LA-BK" name="Bokèo"/> - <iso_3166_2_entry - code="LA-BL" name="Bolikhamxai"/> - <iso_3166_2_entry - code="LA-CH" name="Champasak"/> - <iso_3166_2_entry - code="LA-HO" name="Houaphan"/> - <iso_3166_2_entry - code="LA-KH" name="Khammouan"/> - <iso_3166_2_entry - code="LA-LM" name="Louang Namtha"/> - <iso_3166_2_entry - code="LA-LP" name="Louangphabang"/> - <iso_3166_2_entry - code="LA-OU" name="Oudômxai"/> - <iso_3166_2_entry - code="LA-PH" name="Phôngsali"/> - <iso_3166_2_entry - code="LA-SL" name="Salavan"/> - <iso_3166_2_entry - code="LA-SV" name="Savannakhét"/> - <iso_3166_2_entry - code="LA-VI" name="Vientiane"/> - <iso_3166_2_entry - code="LA-XA" name="Xaignabouli"/> - <iso_3166_2_entry - code="LA-XE" name="Xékong"/> - <iso_3166_2_entry - code="LA-XI" name="Xiangkhoang"/> - </iso_3166_subset> - <iso_3166_subset type="Special zone"> - <iso_3166_2_entry - code="LA-XN" name="Xiasômboun"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Liechtenstein --> - <iso_3166_country code="LI"> - <iso_3166_subset type="Commune"> - <iso_3166_2_entry - code="LI-01" name="Balzers"/> - <iso_3166_2_entry - code="LI-02" name="Eschen"/> - <iso_3166_2_entry - code="LI-03" name="Gamprin"/> - <iso_3166_2_entry - code="LI-04" name="Mauren"/> - <iso_3166_2_entry - code="LI-05" name="Planken"/> - <iso_3166_2_entry - code="LI-06" name="Ruggell"/> - <iso_3166_2_entry - code="LI-07" name="Schaan"/> - <iso_3166_2_entry - code="LI-08" name="Schellenberg"/> - <iso_3166_2_entry - code="LI-09" name="Triesen"/> - <iso_3166_2_entry - code="LI-10" name="Triesenberg"/> - <iso_3166_2_entry - code="LI-11" name="Vaduz"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Lebanon --> - <iso_3166_country code="LB"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="LB-AK" name="Aakkâr"/> - <iso_3166_2_entry - code="LB-BH" name="Baalbek-Hermel"/> - <iso_3166_2_entry - code="LB-BI" name="Béqaa"/> - <iso_3166_2_entry - code="LB-BA" name="Beyrouth"/> - <iso_3166_2_entry - code="LB-AS" name="Liban-Nord"/> - <iso_3166_2_entry - code="LB-JA" name="Liban-Sud"/> - <iso_3166_2_entry - code="LB-JL" name="Mont-Liban"/> - <iso_3166_2_entry - code="LB-NA" name="Nabatîyé"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sri Lanka --> - <iso_3166_country code="LK"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="LK-1" name="Basnāhira paḷāta"/> - <iso_3166_2_entry - code="LK-3" name="Dakuṇu paḷāta"/> - <iso_3166_2_entry - code="LK-2" name="Madhyama paḷāta"/> - <iso_3166_2_entry - code="LK-5" name="Næ̆gĕnahira paḷāta"/> - <iso_3166_2_entry - code="LK-9" name="Sabaragamuva paḷāta"/> - <iso_3166_2_entry - code="LK-7" name="Uturumæ̆da paḷāta"/> - <iso_3166_2_entry - code="LK-4" name="Uturu paḷāta"/> - <iso_3166_2_entry - code="LK-8" name="Ūva paḷāta"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="LK-52" name="Ampāara" parent="5"/> - <iso_3166_2_entry - code="LK-71" name="Anurādhapura" parent="7"/> - <iso_3166_2_entry - code="LK-81" name="Badulla" parent="8"/> - <iso_3166_2_entry - code="LK-51" name="Maḍakalapuva" parent="5"/> - <iso_3166_2_entry - code="LK-11" name="Kŏḷamba" parent="1"/> - <iso_3166_2_entry - code="LK-31" name="Gālla" parent="3"/> - <iso_3166_2_entry - code="LK-12" name="Gampaha" parent="1"/> - <iso_3166_2_entry - code="LK-33" name="Hambantŏṭa" parent="3"/> - <iso_3166_2_entry - code="LK-41" name="Yāpanaya" parent="4"/> - <iso_3166_2_entry - code="LK-13" name="Kaḷutara" parent="1"/> - <iso_3166_2_entry - code="LK-21" name="Mahanuvara" parent="2"/> - <iso_3166_2_entry - code="LK-92" name="Kægalla" parent="9"/> - <iso_3166_2_entry - code="LK-42" name="Kilinŏchchi" parent="4"/> - <iso_3166_2_entry - code="LK-61" name="Kuruṇægala" parent="6"/> - <iso_3166_2_entry - code="LK-43" name="Mannārama" parent="4"/> - <iso_3166_2_entry - code="LK-22" name="Mātale" parent="2"/> - <iso_3166_2_entry - code="LK-32" name="Mātara" parent="3"/> - <iso_3166_2_entry - code="LK-82" name="Mŏṇarāgala" parent="8"/> - <iso_3166_2_entry - code="LK-45" name="Mulativ" parent="4"/> - <iso_3166_2_entry - code="LK-23" name="Nuvara Ĕliya" parent="2"/> - <iso_3166_2_entry - code="LK-72" name="Pŏḷŏnnaruva" parent="7"/> - <iso_3166_2_entry - code="LK-62" name="Puttalama" parent="6"/> - <iso_3166_2_entry - code="LK-91" name="Ratnapura" parent="9"/> - <iso_3166_2_entry - code="LK-53" name="Trikuṇāmalaya" parent="5"/> - <iso_3166_2_entry - code="LK-44" name="Vavuniyāva" parent="4"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Liberia --> - <iso_3166_country code="LR"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="LR-BM" name="Bomi"/> - <iso_3166_2_entry - code="LR-BG" name="Bong"/> - <iso_3166_2_entry - code="LR-GB" name="Grand Bassa"/> - <iso_3166_2_entry - code="LR-CM" name="Grand Cape Mount"/> - <iso_3166_2_entry - code="LR-GG" name="Grand Gedeh"/> - <iso_3166_2_entry - code="LR-GK" name="Grand Kru"/> - <iso_3166_2_entry - code="LR-LO" name="Lofa"/> - <iso_3166_2_entry - code="LR-MG" name="Margibi"/> - <iso_3166_2_entry - code="LR-MY" name="Maryland"/> - <iso_3166_2_entry - code="LR-MO" name="Montserrado"/> - <iso_3166_2_entry - code="LR-NI" name="Nimba"/> - <iso_3166_2_entry - code="LR-RI" name="Rivercess"/> - <iso_3166_2_entry - code="LR-SI" name="Sinoe"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Lesotho --> - <iso_3166_country code="LS"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="LS-D" name="Berea"/> - <iso_3166_2_entry - code="LS-B" name="Butha-Buthe"/> - <iso_3166_2_entry - code="LS-C" name="Leribe"/> - <iso_3166_2_entry - code="LS-E" name="Mafeteng"/> - <iso_3166_2_entry - code="LS-A" name="Maseru"/> - <iso_3166_2_entry - code="LS-F" name="Mohale's Hoek"/> - <iso_3166_2_entry - code="LS-J" name="Mokhotlong"/> - <iso_3166_2_entry - code="LS-H" name="Qacha's Nek"/> - <iso_3166_2_entry - code="LS-G" name="Quthing"/> - <iso_3166_2_entry - code="LS-K" name="Thaba-Tseka"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Lithuania --> - <iso_3166_country code="LT"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="LT-AL" name="Alytaus Apskritis"/> - <iso_3166_2_entry - code="LT-KU" name="Kauno Apskritis"/> - <iso_3166_2_entry - code="LT-KL" name="Klaipėdos Apskritis"/> - <iso_3166_2_entry - code="LT-MR" name="Marijampolės Apskritis"/> - <iso_3166_2_entry - code="LT-PN" name="Panevėžio Apskritis"/> - <iso_3166_2_entry - code="LT-SA" name="Šiaulių Apskritis"/> - <iso_3166_2_entry - code="LT-TA" name="Tauragés Apskritis"/> - <iso_3166_2_entry - code="LT-TE" name="Telšių Apskritis"/> - <iso_3166_2_entry - code="LT-UT" name="Utenos Apskritis"/> - <iso_3166_2_entry - code="LT-VL" name="Vilniaus Apskritis"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Luxembourg --> - <iso_3166_country code="LU"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="LU-D" name="Diekirch"/> - <iso_3166_2_entry - code="LU-G" name="Grevenmacher"/> - <iso_3166_2_entry - code="LU-L" name="Luxembourg"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Latvia --> - <iso_3166_country code="LV"> - <iso_3166_subset type="District"> - <!-- We should probably add a "District" suffix here, but is it "Rajon" --> - <!-- or "Apriņķis"? --> - <iso_3166_2_entry - code="LV-AI" name="Aizkraukle"/> - <iso_3166_2_entry - code="LV-AL" name="Alūksne"/> - <iso_3166_2_entry - code="LV-BL" name="Balvi"/> - <iso_3166_2_entry - code="LV-BU" name="Bauska"/> - <iso_3166_2_entry - code="LV-CE" name="Cēsis"/> - <iso_3166_2_entry - code="LV-DA" name="Daugavpils"/> - <iso_3166_2_entry - code="LV-DO" name="Dobele"/> - <iso_3166_2_entry - code="LV-GU" name="Gulbene"/> - <iso_3166_2_entry - code="LV-JK" name="Jēkabpils"/> - <iso_3166_2_entry - code="LV-JL" name="Jelgava"/> - <iso_3166_2_entry - code="LV-KR" name="Krāslava"/> - <iso_3166_2_entry - code="LV-KU" name="Kuldīga"/> - <iso_3166_2_entry - code="LV-LE" name="Liepāja"/> - <iso_3166_2_entry - code="LV-LM" name="Limbaži"/> - <iso_3166_2_entry - code="LV-LU" name="Ludza"/> - <iso_3166_2_entry - code="LV-MA" name="Madona"/> - <iso_3166_2_entry - code="LV-OG" name="Ogre"/> - <iso_3166_2_entry - code="LV-PR" name="Preiļi"/> - <iso_3166_2_entry - code="LV-RE" name="Rēzekne"/> - <iso_3166_2_entry - code="LV-RI" name="Rīga"/> - <iso_3166_2_entry - code="LV-SA" name="Saldus"/> - <iso_3166_2_entry - code="LV-TA" name="Talsi"/> - <iso_3166_2_entry - code="LV-TU" name="Tukums"/> - <iso_3166_2_entry - code="LV-VK" name="Valka"/> - <iso_3166_2_entry - code="LV-VM" name="Valmiera"/> - <iso_3166_2_entry - code="LV-VE" name="Ventspils"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="LV-DGV" name="Daugavpils"/> - <iso_3166_2_entry - code="LV-JEL" name="Jelgava"/> - <iso_3166_2_entry - code="LV-JUR" name="Jūrmala"/> - <iso_3166_2_entry - code="LV-LPX" name="Liepāja"/> - <iso_3166_2_entry - code="LV-REZ" name="Rēzekne"/> - <iso_3166_2_entry - code="LV-RIX" name="Rīga"/> - <iso_3166_2_entry - code="LV-VEN" name="Ventspils"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Libya --> - <iso_3166_country code="LY"> - <iso_3166_subset type="Popularates"> - <iso_3166_2_entry - code="LY-BU" name="Al Buţnān"/> - <iso_3166_2_entry - code="LY-JA" name="Al Jabal al Akhḑar"/> - <iso_3166_2_entry - code="LY-JG" name="Al Jabal al Gharbī"/> - <iso_3166_2_entry - code="LY-JI" name="Al Jifārah"/> - <iso_3166_2_entry - code="LY-JU" name="Al Jufrah"/> - <iso_3166_2_entry - code="LY-KF" name="Al Kufrah"/> - <iso_3166_2_entry - code="LY-MJ" name="Al Marj"/> - <iso_3166_2_entry - code="LY-MB" name="Al Marqab"/> - <iso_3166_2_entry - code="LY-WA" name="Al Wāḩāt"/> - <iso_3166_2_entry - code="LY-NQ" name="An Nuqaţ al Khams"/> - <iso_3166_2_entry - code="LY-ZA" name="Az Zāwiyah"/> - <iso_3166_2_entry - code="LY-BA" name="Banghāzī"/> - <iso_3166_2_entry - code="LY-DR" name="Darnah"/> - <iso_3166_2_entry - code="LY-GT" name="Ghāt"/> - <iso_3166_2_entry - code="LY-JB" name="Jaghbūb"/> - <iso_3166_2_entry - code="LY-MI" name="Mişrātah"/> - <iso_3166_2_entry - code="LY-MQ" name="Murzuq"/> - <iso_3166_2_entry - code="LY-NL" name="Nālūt"/> - <iso_3166_2_entry - code="LY-SB" name="Sabhā"/> - <iso_3166_2_entry - code="LY-SR" name="Surt"/> - <iso_3166_2_entry - code="LY-TB" name="Ţarābulus"/> - <iso_3166_2_entry - code="LY-WD" name="Wādī al Ḩayāt"/> - <iso_3166_2_entry - code="LY-WS" name="Wādī ash Shāţiʾ"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Morocco --> - <iso_3166_country code="MA"> - <iso_3166_subset type="Economic region"> - <iso_3166_2_entry - code="MA 09" name="Chaouia-Ouardigha"/> - <iso_3166_2_entry - code="MA 10" name="Doukhala-Abda"/> - <iso_3166_2_entry - code="MA 05" name="Fès-Boulemane"/> - <iso_3166_2_entry - code="MA 02" name="Gharb-Chrarda-Beni Hssen"/> - <iso_3166_2_entry - code="MA 08" name="Grand Casablanca"/> - <iso_3166_2_entry - code="MA 14" name="Guelmim-Es Smara"/> - <iso_3166_2_entry - code="MA 15" name="Laâyoune-Boujdour-Sakia el Hamra"/> - <iso_3166_2_entry - code="MA 04" name="L'Oriental"/> - <iso_3166_2_entry - code="MA 11" name="Marrakech-Tensift-Al Haouz"/> - <iso_3166_2_entry - code="MA 06" name="Meknès-Tafilalet"/> - <iso_3166_2_entry - code="MA 16" name="Oued ed Dahab-Lagouira"/> - <iso_3166_2_entry - code="MA 07" name="Rabat-Salé-Zemmour-Zaer"/> - <iso_3166_2_entry - code="MA 13" name="Sous-Massa-Draa"/> - <iso_3166_2_entry - code="MA 12" name="Tadla-Azilal"/> - <iso_3166_2_entry - code="MA 01" name="Tanger-Tétouan"/> - <iso_3166_2_entry - code="MA 03" name="Taza-Al Hoceima-Taounate"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="MA-HAO" name="Al Haouz" parent="11"/> - <iso_3166_2_entry - code="MA-HOC" name="Al Hoceïma" parent="03"/> - <iso_3166_2_entry - code="MA-ASZ" name="Assa-Zag" parent="14"/> - <iso_3166_2_entry - code="MA-AZI" name="Azilal" parent="12"/> - <iso_3166_2_entry - code="MA-BEM" name="Beni Mellal" parent="12"/> - <iso_3166_2_entry - code="MA-BES" name="Ben Slimane" parent="09"/> - <iso_3166_2_entry - code="MA-BER" name="Berkane" parent="04"/> - <iso_3166_2_entry - code="MA-BOD" name="Boujdour (EH)" parent="15"/> - <iso_3166_2_entry - code="MA-BOM" name="Boulemane" parent="05"/> - <iso_3166_2_entry - code="MA-CHE" name="Chefchaouen" parent="01"/> - <iso_3166_2_entry - code="MA-CHI" name="Chichaoua" parent="11"/> - <iso_3166_2_entry - code="MA-CHT" name="Chtouka-Ait Baha" parent="13"/> - <iso_3166_2_entry - code="MA-HAJ" name="El Hajeb" parent="06"/> - <iso_3166_2_entry - code="MA-JDI" name="El Jadida" parent="10"/> - <iso_3166_2_entry - code="MA-ERR" name="Errachidia" parent="06"/> - <iso_3166_2_entry - code="MA-ESI" name="Essaouira" parent="11"/> - <iso_3166_2_entry - code="MA-ESM" name="Es Smara (EH)" parent="14"/> - <iso_3166_2_entry - code="MA-FIG" name="Figuig" parent="04"/> - <iso_3166_2_entry - code="MA-GUE" name="Guelmim" parent="14"/> - <iso_3166_2_entry - code="MA-IFR" name="Ifrane" parent="06"/> - <iso_3166_2_entry - code="MA-JRA" name="Jrada" parent="04"/> - <iso_3166_2_entry - code="MA-KES" name="Kelaat es Sraghna" parent="11"/> - <iso_3166_2_entry - code="MA-KEN" name="Kénitra" parent="02"/> - <iso_3166_2_entry - code="MA-KHE" name="Khemisaet" parent="07"/> - <iso_3166_2_entry - code="MA-KHN" name="Khenifra" parent="06"/> - <iso_3166_2_entry - code="MA-KHO" name="Khouribga" parent="09"/> - <iso_3166_2_entry - code="MA-LAA" name="Laâyoune (EH)" parent="15"/> - <iso_3166_2_entry - code="MA-LAP" name="Larache" parent="01"/> - <iso_3166_2_entry - code="MA-MED" name="Médiouna" parent="08"/> - <iso_3166_2_entry - code="MA-MOU" name="Moulay Yacoub" parent="05"/> - <iso_3166_2_entry - code="MA-NAD" name="Nador" parent="04"/> - <iso_3166_2_entry - code="MA-NOU" name="Nouaceur" parent="08"/> - <iso_3166_2_entry - code="MA-OUA" name="Ouarzazate" parent="13"/> - <iso_3166_2_entry - code="MA-OUD" name="Oued ed Dahab (EH)" parent="16"/> - <iso_3166_2_entry - code="MA-SAF" name="Safi" parent="10"/> - <iso_3166_2_entry - code="MA-SEF" name="Sefrou" parent="05"/> - <iso_3166_2_entry - code="MA-SET" name="Settat" parent="09"/> - <iso_3166_2_entry - code="MA-SIK" name="Sidl Kacem" parent="02"/> - <iso_3166_2_entry - code="MA-TNT" name="Tan-Tan" parent="14"/> - <iso_3166_2_entry - code="MA-TAO" name="Taounate" parent="03"/> - <iso_3166_2_entry - code="MA-TAI" name="Taourirt" parent="04"/> - <iso_3166_2_entry - code="MA-TAR" name="Taroudant" parent="13"/> - <iso_3166_2_entry - code="MA-TAT" name="Tata" parent="14"/> - <iso_3166_2_entry - code="MA-TAZ" name="Taza" parent="03"/> - <iso_3166_2_entry - code="MA-TIZ" name="Tiznit" parent="13"/> - <iso_3166_2_entry - code="MA-ZAG" name="Zagora" parent="13"/> - </iso_3166_subset> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="MA-AGD" name="Agadir-Ida-Outanane" parent="13"/> - <iso_3166_2_entry - code="MA-AOU" name="Aousserd" parent="16"/> - <iso_3166_2_entry - code="MA-CAS" name="Casablanca [Dar el Beïda]" parent="08"/> - <iso_3166_2_entry - code="MA-FAH" name="Fahs-Beni Makada" parent="01"/> - <iso_3166_2_entry - code="MA-FES" name="Fès-Dar-Dbibegh" parent="05"/> - <iso_3166_2_entry - code="MA-INE" name="Inezgane-Ait Melloul" parent="13"/> - <iso_3166_2_entry - code="MA-MMD" name="Marrakech-Medina" parent="11"/> - <iso_3166_2_entry - code="MA-MMN" name="Marrakech-Menara" parent="11"/> - <iso_3166_2_entry - code="MA-MEK" name="Meknès" parent="06"/> - <iso_3166_2_entry - code="MA-MOH" name="Mohammadia" parent="08"/> - <iso_3166_2_entry - code="MA-OUJ" name="Oujda-Angad" parent="04"/> - <iso_3166_2_entry - code="MA-RAB" name="Rabat" parent="07"/> - <iso_3166_2_entry - code="MA-SAL" name="Salé" parent="07"/> - <iso_3166_2_entry - code="MA-SYB" name="Sidi Youssef Ben Ali" parent="11"/> - <iso_3166_2_entry - code="MA-SKH" name="Skhirate-Témara" parent="07"/> - <iso_3166_2_entry - code="MA-TNG" name="Tanger-Assilah" parent="01"/> - <iso_3166_2_entry - code="MA-TET" name="Tétouan" parent="01"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Moldova --> - <iso_3166_country code="MD"> - <iso_3166_subset type="Autonomous territorial unit"> - <iso_3166_2_entry - code="MD-GA" name="Găgăuzia, Unitatea teritorială autonomă"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MD-BA" name="Bălți"/> - <iso_3166_2_entry - code="MD-BD" name="Tighina"/> - <iso_3166_2_entry - code="MD-CU" name="Chișinău"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MD-AN" name="Anenii Noi"/> - <iso_3166_2_entry - code="MD-BS" name="Basarabeasca"/> - <iso_3166_2_entry - code="MD-BR" name="Briceni"/> - <iso_3166_2_entry - code="MD-CA" name="Cahul"/> - <iso_3166_2_entry - code="MD-CT" name="Cantemir"/> - <iso_3166_2_entry - code="MD-CL" name="Călărași"/> - <iso_3166_2_entry - code="MD-CS" name="Căușeni"/> - <iso_3166_2_entry - code="MD-CM" name="Cimișlia"/> - <iso_3166_2_entry - code="MD-CR" name="Criuleni"/> - <iso_3166_2_entry - code="MD-DO" name="Dondușeni"/> - <iso_3166_2_entry - code="MD-DR" name="Drochia"/> - <iso_3166_2_entry - code="MD-DU" name="Dubăsari"/> - <iso_3166_2_entry - code="MD-ED" name="Edineț"/> - <iso_3166_2_entry - code="MD-FA" name="Fălești"/> - <iso_3166_2_entry - code="MD-FL" name="Florești"/> - <iso_3166_2_entry - code="MD-GL" name="Glodeni"/> - <iso_3166_2_entry - code="MD-HI" name="Hîncești"/> - <iso_3166_2_entry - code="MD-IA" name="Ialoveni"/> - <iso_3166_2_entry - code="MD-LE" name="Leova"/> - <iso_3166_2_entry - code="MD-NI" name="Nisporeni"/> - <iso_3166_2_entry - code="MD-OC" name="Ocnița"/> - <iso_3166_2_entry - code="MD-OR" name="Orhei"/> - <iso_3166_2_entry - code="MD-RE" name="Rezina"/> - <iso_3166_2_entry - code="MD-RI" name="Rîșcani"/> - <iso_3166_2_entry - code="MD-SI" name="Sîngerei"/> - <iso_3166_2_entry - code="MD-SO" name="Soroca"/> - <iso_3166_2_entry - code="MD-ST" name="Strășeni"/> - <iso_3166_2_entry - code="MD-SD" name="Șoldănești"/> - <iso_3166_2_entry - code="MD-SV" name="Ștefan Vodă"/> - <iso_3166_2_entry - code="MD-TA" name="Taraclia"/> - <iso_3166_2_entry - code="MD-TE" name="Telenești"/> - <iso_3166_2_entry - code="MD-UN" name="Ungheni"/> - </iso_3166_subset> - <iso_3166_subset type="Territorial unit"> - <iso_3166_2_entry - code="MD-SN" name="Stînga Nistrului, unitatea teritorială din"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Montenegro --> - <iso_3166_country code="ME"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="ME-01" name="Andrijevica"/> - <iso_3166_2_entry - code="ME-02" name="Bar"/> - <iso_3166_2_entry - code="ME-03" name="Berane"/> - <iso_3166_2_entry - code="ME-04" name="Bijelo Polje"/> - <iso_3166_2_entry - code="ME-05" name="Budva"/> - <iso_3166_2_entry - code="ME-06" name="Cetinje"/> - <iso_3166_2_entry - code="ME-07" name="Danilovgrad"/> - <iso_3166_2_entry - code="ME-08" name="Herceg-Novi"/> - <iso_3166_2_entry - code="ME-09" name="Kolašin"/> - <iso_3166_2_entry - code="ME-10" name="Kotor"/> - <iso_3166_2_entry - code="ME-11" name="Mojkovac"/> - <iso_3166_2_entry - code="ME-12" name="Nikšić"/> - <iso_3166_2_entry - code="ME-13" name="Plav"/> - <iso_3166_2_entry - code="ME-14" name="Pljevlja"/> - <iso_3166_2_entry - code="ME-15" name="Plužine"/> - <iso_3166_2_entry - code="ME-16" name="Podgorica"/> - <iso_3166_2_entry - code="ME-17" name="Rožaje"/> - <iso_3166_2_entry - code="ME-18" name="Šavnik"/> - <iso_3166_2_entry - code="ME-19" name="Tivat"/> - <iso_3166_2_entry - code="ME-20" name="Ulcinj"/> - <iso_3166_2_entry - code="ME-21" name="Žabljak"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Martin (French part) --> - <iso_3166_country code="MF"/> - <!-- Madagascar --> - <iso_3166_country code="MG"> - <iso_3166_subset type="Autonomous province"> - <iso_3166_2_entry - code="MG-T" name="Antananarivo"/> - <iso_3166_2_entry - code="MG-D" name="Antsiranana"/> - <iso_3166_2_entry - code="MG-F" name="Fianarantsoa"/> - <iso_3166_2_entry - code="MG-M" name="Mahajanga"/> - <iso_3166_2_entry - code="MG-A" name="Toamasina"/> - <iso_3166_2_entry - code="MG-U" name="Toliara"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Marshall Islands --> - <iso_3166_country code="MH"> - <iso_3166_subset type="Chains (of islands)"> - <iso_3166_2_entry - code="MH-L" name="Ralik chain"/> - <iso_3166_2_entry - code="MH-T" name="Ratak chain"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="MH-ALL" name="Ailinglaplap" parent="L"/> - <iso_3166_2_entry - code="MH-ALK" name="Ailuk" parent="T"/> - <iso_3166_2_entry - code="MH-ARN" name="Arno" parent="T"/> - <iso_3166_2_entry - code="MH-AUR" name="Aur" parent="T"/> - <iso_3166_2_entry - code="MH-EBO" name="Ebon" parent="L"/> - <iso_3166_2_entry - code="MH-ENI" name="Enewetak" parent="L"/> - <iso_3166_2_entry - code="MH-JAB" name="Jabat" parent="L"/> - <iso_3166_2_entry - code="MH-JAL" name="Jaluit" parent="L"/> - <iso_3166_2_entry - code="MH-KIL" name="Kili" parent="L"/> - <iso_3166_2_entry - code="MH-KWA" name="Kwajalein" parent="L"/> - <iso_3166_2_entry - code="MH-LAE" name="Lae" parent="L"/> - <iso_3166_2_entry - code="MH-LIB" name="Lib" parent="L"/> - <iso_3166_2_entry - code="MH-LIK" name="Likiep" parent="T"/> - <iso_3166_2_entry - code="MH-MAJ" name="Majuro" parent="T"/> - <iso_3166_2_entry - code="MH-MAL" name="Maloelap" parent="T"/> - <iso_3166_2_entry - code="MH-MEJ" name="Mejit" parent="T"/> - <iso_3166_2_entry - code="MH-MIL" name="Mili" parent="T"/> - <iso_3166_2_entry - code="MH-NMK" name="Namdrik" parent="L"/> - <iso_3166_2_entry - code="MH-NMU" name="Namu" parent="L"/> - <iso_3166_2_entry - code="MH-RON" name="Rongelap" parent="L"/> - <iso_3166_2_entry - code="MH-UJA" name="Ujae" parent="L"/> - <iso_3166_2_entry - code="MH-UTI" name="Utirik" parent="T"/> - <iso_3166_2_entry - code="MH-WTN" name="Wotho" parent="L"/> - <iso_3166_2_entry - code="MH-WTJ" name="Wotje" parent="T"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Macedonia --> - <iso_3166_country code="MK"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="MK-01" name="Aerodrom"/> - <iso_3166_2_entry - code="MK-02" name="Aračinovo"/> - <iso_3166_2_entry - code="MK-03" name="Berovo"/> - <iso_3166_2_entry - code="MK-04" name="Bitola"/> - <iso_3166_2_entry - code="MK-05" name="Bogdanci"/> - <iso_3166_2_entry - code="MK-06" name="Bogovinje"/> - <iso_3166_2_entry - code="MK-07" name="Bosilovo"/> - <iso_3166_2_entry - code="MK-08" name="Brvenica"/> - <iso_3166_2_entry - code="MK-09" name="Butel"/> - <iso_3166_2_entry - code="MK-77" name="Centar"/> - <iso_3166_2_entry - code="MK-78" name="Centar Župa"/> - <iso_3166_2_entry - code="MK-79" name="Čair"/> - <iso_3166_2_entry - code="MK-80" name="Čaška"/> - <iso_3166_2_entry - code="MK-81" name="Češinovo-Obleševo"/> - <iso_3166_2_entry - code="MK-82" name="Čučer Sandevo"/> - <iso_3166_2_entry - code="MK-21" name="Debar"/> - <iso_3166_2_entry - code="MK-22" name="Debarca"/> - <iso_3166_2_entry - code="MK-23" name="Delčevo"/> - <iso_3166_2_entry - code="MK-25" name="Demir Hisar"/> - <iso_3166_2_entry - code="MK-24" name="Demir Kapija"/> - <iso_3166_2_entry - code="MK-26" name="Dojran"/> - <iso_3166_2_entry - code="MK-27" name="Dolneni"/> - <iso_3166_2_entry - code="MK-28" name="Drugovo"/> - <iso_3166_2_entry - code="MK-17" name="Gazi Baba"/> - <iso_3166_2_entry - code="MK-18" name="Gevgelija"/> - <iso_3166_2_entry - code="MK-29" name="Gjorče Petrov"/> - <iso_3166_2_entry - code="MK-19" name="Gostivar"/> - <iso_3166_2_entry - code="MK-20" name="Gradsko"/> - <iso_3166_2_entry - code="MK-34" name="Ilinden"/> - <iso_3166_2_entry - code="MK-35" name="Jegunovce"/> - <iso_3166_2_entry - code="MK-37" name="Karbinci"/> - <iso_3166_2_entry - code="MK-38" name="Karpoš"/> - <iso_3166_2_entry - code="MK-36" name="Kavadarci"/> - <iso_3166_2_entry - code="MK-40" name="Kičevo"/> - <iso_3166_2_entry - code="MK-39" name="Kisela Voda"/> - <iso_3166_2_entry - code="MK-42" name="Kočani"/> - <iso_3166_2_entry - code="MK-41" name="Konče"/> - <iso_3166_2_entry - code="MK-43" name="Kratovo"/> - <iso_3166_2_entry - code="MK-44" name="Kriva Palanka"/> - <iso_3166_2_entry - code="MK-45" name="Krivogaštani"/> - <iso_3166_2_entry - code="MK-46" name="Kruševo"/> - <iso_3166_2_entry - code="MK-47" name="Kumanovo"/> - <iso_3166_2_entry - code="MK-48" name="Lipkovo"/> - <iso_3166_2_entry - code="MK-49" name="Lozovo"/> - <iso_3166_2_entry - code="MK-51" name="Makedonska Kamenica"/> - <iso_3166_2_entry - code="MK-52" name="Makedonski Brod"/> - <iso_3166_2_entry - code="MK-50" name="Mavrovo-i-Rostuša"/> - <iso_3166_2_entry - code="MK-53" name="Mogila"/> - <iso_3166_2_entry - code="MK-54" name="Negotino"/> - <iso_3166_2_entry - code="MK-55" name="Novaci"/> - <iso_3166_2_entry - code="MK-56" name="Novo Selo"/> - <iso_3166_2_entry - code="MK-58" name="Ohrid"/> - <iso_3166_2_entry - code="MK-57" name="Oslomej"/> - <iso_3166_2_entry - code="MK-60" name="Pehčevo"/> - <iso_3166_2_entry - code="MK-59" name="Petrovec"/> - <iso_3166_2_entry - code="MK-61" name="Plasnica"/> - <iso_3166_2_entry - code="MK-62" name="Prilep"/> - <iso_3166_2_entry - code="MK-63" name="Probištip"/> - <iso_3166_2_entry - code="MK-64" name="Radoviš"/> - <iso_3166_2_entry - code="MK-65" name="Rankovce"/> - <iso_3166_2_entry - code="MK-66" name="Resen"/> - <iso_3166_2_entry - code="MK-67" name="Rosoman"/> - <iso_3166_2_entry - code="MK-68" name="Saraj"/> - <iso_3166_2_entry - code="MK-83" name="Štip"/> - <iso_3166_2_entry - code="MK-84" name="Šuto Orizari"/> - <iso_3166_2_entry - code="MK-70" name="Sopište"/> - <iso_3166_2_entry - code="MK-71" name="Staro Nagoričane"/> - <iso_3166_2_entry - code="MK-72" name="Struga"/> - <iso_3166_2_entry - code="MK-73" name="Strumica"/> - <iso_3166_2_entry - code="MK-74" name="Studeničani"/> - <iso_3166_2_entry - code="MK-69" name="Sveti Nikole"/> - <iso_3166_2_entry - code="MK-75" name="Tearce"/> - <iso_3166_2_entry - code="MK-76" name="Tetovo"/> - <iso_3166_2_entry - code="MK-10" name="Valandovo"/> - <iso_3166_2_entry - code="MK-11" name="Vasilevo"/> - <iso_3166_2_entry - code="MK-13" name="Veles"/> - <iso_3166_2_entry - code="MK-12" name="Vevčani"/> - <iso_3166_2_entry - code="MK-14" name="Vinica"/> - <iso_3166_2_entry - code="MK-15" name="Vraneštica"/> - <iso_3166_2_entry - code="MK-16" name="Vrapčište"/> - <iso_3166_2_entry - code="MK-31" name="Zajas"/> - <iso_3166_2_entry - code="MK-32" name="Zelenikovo"/> - <iso_3166_2_entry - code="MK-30" name="Želino"/> - <iso_3166_2_entry - code="MK-33" name="Zrnovci"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mali --> - <iso_3166_country code="ML"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="ML-BK0" name="Bamako"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="ML-7" name="Gao"/> - <iso_3166_2_entry - code="ML-1" name="Kayes"/> - <iso_3166_2_entry - code="ML-8" name="Kidal"/> - <iso_3166_2_entry - code="ML-2" name="Koulikoro"/> - <iso_3166_2_entry - code="ML-5" name="Mopti"/> - <iso_3166_2_entry - code="ML-4" name="Ségou"/> - <iso_3166_2_entry - code="ML-3" name="Sikasso"/> - <iso_3166_2_entry - code="ML-6" name="Tombouctou"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Myanmar --> - <iso_3166_country code="MM"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="MM-07" name="Ayeyarwady"/> - <iso_3166_2_entry - code="MM-02" name="Bago"/> - <iso_3166_2_entry - code="MM-03" name="Magway"/> - <iso_3166_2_entry - code="MM-04" name="Mandalay"/> - <iso_3166_2_entry - code="MM-01" name="Sagaing"/> - <iso_3166_2_entry - code="MM-05" name="Tanintharyi"/> - <iso_3166_2_entry - code="MM-06" name="Yangon"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="MM-14" name="Chin"/> - <iso_3166_2_entry - code="MM-11" name="Kachin"/> - <iso_3166_2_entry - code="MM-12" name="Kayah"/> - <iso_3166_2_entry - code="MM-13" name="Kayin"/> - <iso_3166_2_entry - code="MM-15" name="Mon"/> - <iso_3166_2_entry - code="MM-16" name="Rakhine"/> - <iso_3166_2_entry - code="MM-17" name="Shan"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mongolia --> - <iso_3166_country code="MN"> - <iso_3166_subset type="Province"> - <!-- Different transliterations possible, is there an official one? --> - <iso_3166_2_entry - code="MN-073" name="Arhangay"/> - <iso_3166_2_entry - code="MN-069" name="Bayanhongor"/> - <iso_3166_2_entry - code="MN-071" name="Bayan-Ölgiy"/> - <iso_3166_2_entry - code="MN-067" name="Bulgan"/> - <iso_3166_2_entry - code="MN-061" name="Dornod"/> - <iso_3166_2_entry - code="MN-063" name="Dornogovi"/> - <iso_3166_2_entry - code="MN-059" name="Dundgovi"/> - <iso_3166_2_entry - code="MN-057" name="Dzavhan"/> - <iso_3166_2_entry - code="MN-065" name="Govi-Altay"/> - <iso_3166_2_entry - code="MN-039" name="Hentiy"/> - <iso_3166_2_entry - code="MN-043" name="Hovd"/> - <iso_3166_2_entry - code="MN-041" name="Hövsgöl"/> - <iso_3166_2_entry - code="MN-053" name="Ömnögovi"/> - <iso_3166_2_entry - code="MN-055" name="Övörhangay"/> - <iso_3166_2_entry - code="MN-049" name="Selenge"/> - <iso_3166_2_entry - code="MN-051" name="Sühbaatar"/> - <iso_3166_2_entry - code="MN-047" name="Töv"/> - <iso_3166_2_entry - code="MN-046" name="Uvs"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="MN-1" name="Ulanbaatar"/> - <iso_3166_2_entry - code="MN-037" name="Darhan uul"/> - <iso_3166_2_entry - code="MN-064" name="Govi-Sumber"/> - <iso_3166_2_entry - code="MN-035" name="Orhon"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Macao --> - <iso_3166_country code="MO"/> - <!-- Mauritania --> - <iso_3166_country code="MR"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MR-NKC" name="Nouakchott"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="MR-07" name="Adrar"/> - <iso_3166_2_entry - code="MR-03" name="Assaba"/> - <iso_3166_2_entry - code="MR-05" name="Brakna"/> - <iso_3166_2_entry - code="MR-08" name="Dakhlet Nouadhibou"/> - <iso_3166_2_entry - code="MR-04" name="Gorgol"/> - <iso_3166_2_entry - code="MR-10" name="Guidimaka"/> - <iso_3166_2_entry - code="MR-01" name="Hodh ech Chargui"/> - <iso_3166_2_entry - code="MR-02" name="Hodh el Charbi"/> - <iso_3166_2_entry - code="MR-12" name="Inchiri"/> - <iso_3166_2_entry - code="MR-09" name="Tagant"/> - <iso_3166_2_entry - code="MR-11" name="Tiris Zemmour"/> - <iso_3166_2_entry - code="MR-06" name="Trarza"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Malta --> - <iso_3166_country code="MT"> - <iso_3166_subset type="Local council"> - <iso_3166_2_entry - code="MT-01" name="Attard"/> - <iso_3166_2_entry - code="MT-02" name="Balzan"/> - <iso_3166_2_entry - code="MT-03" name="Birgu"/> - <iso_3166_2_entry - code="MT-04" name="Birkirkara"/> - <iso_3166_2_entry - code="MT-05" name="Birżebbuġa"/> - <iso_3166_2_entry - code="MT-06" name="Bormla"/> - <iso_3166_2_entry - code="MT-07" name="Dingli"/> - <iso_3166_2_entry - code="MT-08" name="Fgura"/> - <iso_3166_2_entry - code="MT-09" name="Floriana"/> - <iso_3166_2_entry - code="MT-10" name="Fontana"/> - <iso_3166_2_entry - code="MT-11" name="Gudja"/> - <iso_3166_2_entry - code="MT-12" name="Gżira"/> - <iso_3166_2_entry - code="MT-13" name="Għajnsielem"/> - <iso_3166_2_entry - code="MT-14" name="Għarb"/> - <iso_3166_2_entry - code="MT-15" name="Għargħur"/> - <iso_3166_2_entry - code="MT-16" name="Għasri"/> - <iso_3166_2_entry - code="MT-17" name="Għaxaq"/> - <iso_3166_2_entry - code="MT-18" name="Ħamrun"/> - <iso_3166_2_entry - code="MT-19" name="Iklin"/> - <iso_3166_2_entry - code="MT-20" name="Isla"/> - <iso_3166_2_entry - code="MT-21" name="Kalkara"/> - <iso_3166_2_entry - code="MT-22" name="Kerċem"/> - <iso_3166_2_entry - code="MT-23" name="Kirkop"/> - <iso_3166_2_entry - code="MT-24" name="Lija"/> - <iso_3166_2_entry - code="MT-25" name="Luqa"/> - <iso_3166_2_entry - code="MT-26" name="Marsa"/> - <iso_3166_2_entry - code="MT-27" name="Marsaskala"/> - <iso_3166_2_entry - code="MT-28" name="Marsaxlokk"/> - <iso_3166_2_entry - code="MT-29" name="Mdina"/> - <iso_3166_2_entry - code="MT-30" name="Mellieħa"/> - <iso_3166_2_entry - code="MT-31" name="Mġarr"/> - <iso_3166_2_entry - code="MT-32" name="Mosta"/> - <iso_3166_2_entry - code="MT-33" name="Mqabba"/> - <iso_3166_2_entry - code="MT-34" name="Msida"/> - <iso_3166_2_entry - code="MT-35" name="Mtarfa"/> - <iso_3166_2_entry - code="MT-36" name="Munxar"/> - <iso_3166_2_entry - code="MT-37" name="Nadur"/> - <iso_3166_2_entry - code="MT-38" name="Naxxar"/> - <iso_3166_2_entry - code="MT-39" name="Paola"/> - <iso_3166_2_entry - code="MT-40" name="Pembroke"/> - <iso_3166_2_entry - code="MT-41" name="Pietà"/> - <iso_3166_2_entry - code="MT-42" name="Qala"/> - <iso_3166_2_entry - code="MT-43" name="Qormi"/> - <iso_3166_2_entry - code="MT-44" name="Qrendi"/> - <iso_3166_2_entry - code="MT-45" name="Rabat Għawdex"/> - <iso_3166_2_entry - code="MT-46" name="Rabat Malta"/> - <iso_3166_2_entry - code="MT-47" name="Safi"/> - <iso_3166_2_entry - code="MT-48" name="San Ġiljan"/> - <iso_3166_2_entry - code="MT-49" name="San Ġwann"/> - <iso_3166_2_entry - code="MT-50" name="San Lawrenz"/> - <iso_3166_2_entry - code="MT-51" name="San Pawl il-Baħar"/> - <iso_3166_2_entry - code="MT-52" name="Sannat"/> - <iso_3166_2_entry - code="MT-53" name="Santa Luċija"/> - <iso_3166_2_entry - code="MT-54" name="Santa Venera"/> - <iso_3166_2_entry - code="MT-55" name="Siġġiewi"/> - <iso_3166_2_entry - code="MT-56" name="Sliema"/> - <iso_3166_2_entry - code="MT-57" name="Swieqi"/> - <iso_3166_2_entry - code="MT-58" name="Ta’ Xbiex"/> - <iso_3166_2_entry - code="MT-59" name="Tarxien"/> - <iso_3166_2_entry - code="MT-60" name="Valletta"/> - <iso_3166_2_entry - code="MT-61" name="Xagħra"/> - <iso_3166_2_entry - code="MT-62" name="Xewkija"/> - <iso_3166_2_entry - code="MT-63" name="Xgħajra"/> - <iso_3166_2_entry - code="MT-64" name="Żabbar"/> - <iso_3166_2_entry - code="MT-65" name="Żebbuġ Għawdex"/> - <iso_3166_2_entry - code="MT-66" name="Żebbuġ Malta"/> - <iso_3166_2_entry - code="MT-67" name="Żejtun"/> - <iso_3166_2_entry - code="MT-68" name="Żurrieq"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mauritius --> - <iso_3166_country code="MU"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MU-BR" name="Beau Bassin-Rose Hill"/> - <iso_3166_2_entry - code="MU-CU" name="Curepipe"/> - <iso_3166_2_entry - code="MU-PU" name="Port Louis"/> - <iso_3166_2_entry - code="MU-QB" name="Quatre Bornes"/> - <iso_3166_2_entry - code="MU-VP" name="Vacoas-Phoenix"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="MU-AG" name="Agalega Islands"/> - <iso_3166_2_entry - code="MU-CC" name="Cargados Carajos Shoals"/> - <iso_3166_2_entry - code="MU-RO" name="Rodrigues Island"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MU-BL" name="Black River"/> - <iso_3166_2_entry - code="MU-FL" name="Flacq"/> - <iso_3166_2_entry - code="MU-GP" name="Grand Port"/> - <iso_3166_2_entry - code="MU-MO" name="Moka"/> - <iso_3166_2_entry - code="MU-PA" name="Pamplemousses"/> - <iso_3166_2_entry - code="MU-PW" name="Plaines Wilhems"/> - <iso_3166_2_entry - code="MU-PL" name="Port Louis"/> - <iso_3166_2_entry - code="MU-RP" name="Rivière du Rempart"/> - <iso_3166_2_entry - code="MU-SA" name="Savanne"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Maldives --> - <iso_3166_country code="MV"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MV-MLE" name="Male"/> - </iso_3166_subset> - <iso_3166_subset type="Atoll"> - <iso_3166_2_entry - code="MV-02" name="Alif"/> - <iso_3166_2_entry - code="MV-20" name="Baa"/> - <iso_3166_2_entry - code="MV-17" name="Dhaalu"/> - <iso_3166_2_entry - code="MV-14" name="Faafu"/> - <iso_3166_2_entry - code="MV-27" name="Gaafu Aliff"/> - <iso_3166_2_entry - code="MV-28" name="Gaafu Daalu"/> - <iso_3166_2_entry - code="MV-29" name="Gnaviyani"/> - <iso_3166_2_entry - code="MV-07" name="Haa Alif"/> - <iso_3166_2_entry - code="MV-23" name="Haa Dhaalu"/> - <iso_3166_2_entry - code="MV-26" name="Kaafu"/> - <iso_3166_2_entry - code="MV-05" name="Laamu"/> - <iso_3166_2_entry - code="MV-03" name="Lhaviyani"/> - <iso_3166_2_entry - code="MV-12" name="Meemu"/> - <iso_3166_2_entry - code="MV-25" name="Noonu"/> - <iso_3166_2_entry - code="MV-13" name="Raa"/> - <iso_3166_2_entry - code="MV-01" name="Seenu"/> - <iso_3166_2_entry - code="MV-24" name="Shaviyani"/> - <iso_3166_2_entry - code="MV-08" name="Thaa"/> - <iso_3166_2_entry - code="MV-04" name="Vaavu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Malawi --> - <iso_3166_country code="MW"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="MW C" name="Central Region"/> - <iso_3166_2_entry - code="MW N" name="Northern Region"/> - <iso_3166_2_entry - code="MW S" name="Southern Region"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MW-BA" name="Balaka" parent="S"/> - <iso_3166_2_entry - code="MW-BL" name="Blantyre" parent="S"/> - <iso_3166_2_entry - code="MW-CK" name="Chikwawa" parent="S"/> - <iso_3166_2_entry - code="MW-CR" name="Chiradzulu" parent="S"/> - <iso_3166_2_entry - code="MW-CT" name="Chitipa" parent="N"/> - <iso_3166_2_entry - code="MW-DE" name="Dedza" parent="C"/> - <iso_3166_2_entry - code="MW-DO" name="Dowa" parent="C"/> - <iso_3166_2_entry - code="MW-KR" name="Karonga" parent="N"/> - <iso_3166_2_entry - code="MW-KS" name="Kasungu" parent="C"/> - <iso_3166_2_entry - code="MW-LK" name="Likoma" parent="N"/> - <iso_3166_2_entry - code="MW-LI" name="Lilongwe" parent="C"/> - <iso_3166_2_entry - code="MW-MH" name="Machinga" parent="S"/> - <iso_3166_2_entry - code="MW-MG" name="Mangochi" parent="S"/> - <iso_3166_2_entry - code="MW-MC" name="Mchinji" parent="C"/> - <iso_3166_2_entry - code="MW-MU" name="Mulanje" parent="S"/> - <iso_3166_2_entry - code="MW-MW" name="Mwanza" parent="S"/> - <iso_3166_2_entry - code="MW-MZ" name="Mzimba" parent="N"/> - <iso_3166_2_entry - code="MW-NE" name="Neno" parent="N"/> - <iso_3166_2_entry - code="MW-NB" name="Nkhata Bay" parent="N"/> - <iso_3166_2_entry - code="MW-NK" name="Nkhotakota" parent="C"/> - <iso_3166_2_entry - code="MW-NS" name="Nsanje" parent="S"/> - <iso_3166_2_entry - code="MW-NU" name="Ntcheu" parent="C"/> - <iso_3166_2_entry - code="MW-NI" name="Ntchisi" parent="C"/> - <iso_3166_2_entry - code="MW-PH" name="Phalombe" parent="S"/> - <iso_3166_2_entry - code="MW-RU" name="Rumphi" parent="N"/> - <iso_3166_2_entry - code="MW-SA" name="Salima" parent="C"/> - <iso_3166_2_entry - code="MW-TH" name="Thyolo" parent="S"/> - <iso_3166_2_entry - code="MW-ZO" name="Zomba" parent="S"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mexico --> - <iso_3166_country code="MX"> - <iso_3166_subset type="Federal district"> - <iso_3166_2_entry - code="MX-DIF" name="Distrito Federal"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="MX-AGU" name="Aguascalientes"/> - <iso_3166_2_entry - code="MX-BCN" name="Baja California"/> - <iso_3166_2_entry - code="MX-BCS" name="Baja California Sur"/> - <iso_3166_2_entry - code="MX-CAM" name="Campeche"/> - <iso_3166_2_entry - code="MX-COA" name="Coahuila"/> - <iso_3166_2_entry - code="MX-COL" name="Colima"/> - <iso_3166_2_entry - code="MX-CHP" name="Chiapas"/> - <iso_3166_2_entry - code="MX-CHH" name="Chihuahua"/> - <iso_3166_2_entry - code="MX-DUR" name="Durango"/> - <iso_3166_2_entry - code="MX-GUA" name="Guanajuato"/> - <iso_3166_2_entry - code="MX-GRO" name="Guerrero"/> - <iso_3166_2_entry - code="MX-HID" name="Hidalgo"/> - <iso_3166_2_entry - code="MX-JAL" name="Jalisco"/> - <iso_3166_2_entry - code="MX-MEX" name="México"/> - <iso_3166_2_entry - code="MX-MIC" name="Michoacán"/> - <iso_3166_2_entry - code="MX-MOR" name="Morelos"/> - <iso_3166_2_entry - code="MX-NAY" name="Nayarit"/> - <iso_3166_2_entry - code="MX-NLE" name="Nuevo León"/> - <iso_3166_2_entry - code="MX-OAX" name="Oaxaca"/> - <iso_3166_2_entry - code="MX-PUE" name="Puebla"/> - <iso_3166_2_entry - code="MX-QUE" name="Querétaro"/> - <iso_3166_2_entry - code="MX-ROO" name="Quintana Roo"/> - <iso_3166_2_entry - code="MX-SLP" name="San Luis Potosí"/> - <iso_3166_2_entry - code="MX-SIN" name="Sinaloa"/> - <iso_3166_2_entry - code="MX-SON" name="Sonora"/> - <iso_3166_2_entry - code="MX-TAB" name="Tabasco"/> - <iso_3166_2_entry - code="MX-TAM" name="Tamaulipas"/> - <iso_3166_2_entry - code="MX-TLA" name="Tlaxcala"/> - <iso_3166_2_entry - code="MX-VER" name="Veracruz"/> - <iso_3166_2_entry - code="MX-YUC" name="Yucatán"/> - <iso_3166_2_entry - code="MX-ZAC" name="Zacatecas"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Malaysia --> - <iso_3166_country code="MY"> - <iso_3166_subset type="Federal Territories"> - <iso_3166_2_entry - code="MY-14" name="Wilayah Persekutuan Kuala Lumpur"/> - <iso_3166_2_entry - code="MY-15" name="Wilayah Persekutuan Labuan"/> - <iso_3166_2_entry - code="MY-16" name="Wilayah Persekutuan Putrajaya"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="MY-01" name="Johor"/> - <iso_3166_2_entry - code="MY-02" name="Kedah"/> - <iso_3166_2_entry - code="MY-03" name="Kelantan"/> - <iso_3166_2_entry - code="MY-04" name="Melaka"/> - <iso_3166_2_entry - code="MY-05" name="Negeri Sembilan"/> - <iso_3166_2_entry - code="MY-06" name="Pahang"/> - <iso_3166_2_entry - code="MY-08" name="Perak"/> - <iso_3166_2_entry - code="MY-09" name="Perlis"/> - <iso_3166_2_entry - code="MY-07" name="Pulau Pinang"/> - <iso_3166_2_entry - code="MY-12" name="Sabah"/> - <iso_3166_2_entry - code="MY-13" name="Sarawak"/> - <iso_3166_2_entry - code="MY-10" name="Selangor"/> - <iso_3166_2_entry - code="MY-11" name="Terengganu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mozambique --> - <iso_3166_country code="MZ"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MZ-MPM" name="Maputo (city)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="MZ-P" name="Cabo Delgado"/> - <iso_3166_2_entry - code="MZ-G" name="Gaza"/> - <iso_3166_2_entry - code="MZ-I" name="Inhambane"/> - <iso_3166_2_entry - code="MZ-B" name="Manica"/> - <iso_3166_2_entry - code="MZ-L" name="Maputo"/> - <iso_3166_2_entry - code="MZ-N" name="Numpula"/> - <iso_3166_2_entry - code="MZ-A" name="Niassa"/> - <iso_3166_2_entry - code="MZ-S" name="Sofala"/> - <iso_3166_2_entry - code="MZ-T" name="Tete"/> - <iso_3166_2_entry - code="MZ-Q" name="Zambezia"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Namibia --> - <iso_3166_country code="NA"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="NA-CA" name="Caprivi"/> - <iso_3166_2_entry - code="NA-ER" name="Erongo"/> - <iso_3166_2_entry - code="NA-HA" name="Hardap"/> - <iso_3166_2_entry - code="NA-KA" name="Karas"/> - <iso_3166_2_entry - code="NA-KH" name="Khomas"/> - <iso_3166_2_entry - code="NA-KU" name="Kunene"/> - <iso_3166_2_entry - code="NA-OW" name="Ohangwena"/> - <iso_3166_2_entry - code="NA-OK" name="Okavango"/> - <iso_3166_2_entry - code="NA-OH" name="Omaheke"/> - <iso_3166_2_entry - code="NA-OS" name="Omusati"/> - <iso_3166_2_entry - code="NA-ON" name="Oshana"/> - <iso_3166_2_entry - code="NA-OT" name="Oshikoto"/> - <iso_3166_2_entry - code="NA-OD" name="Otjozondjupa"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Niger --> - <iso_3166_country code="NE"> - <iso_3166_subset type="Capital District"> - <iso_3166_2_entry - code="NE-8" name="Niamey"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="NE-1" name="Agadez"/> - <iso_3166_2_entry - code="NE-2" name="Diffa"/> - <iso_3166_2_entry - code="NE-3" name="Dosso"/> - <iso_3166_2_entry - code="NE-4" name="Maradi"/> - <iso_3166_2_entry - code="NE-5" name="Tahoua"/> - <iso_3166_2_entry - code="NE-6" name="Tillabéri"/> - <iso_3166_2_entry - code="NE-7" name="Zinder"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nigeria --> - <iso_3166_country code="NG"> - <iso_3166_subset type="Capital Territory"> - <iso_3166_2_entry - code="NG-FC" name="Abuja Capital Territory"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="NG-AB" name="Abia"/> - <iso_3166_2_entry - code="NG-AD" name="Adamawa"/> - <iso_3166_2_entry - code="NG-AK" name="Akwa Ibom"/> - <iso_3166_2_entry - code="NG-AN" name="Anambra"/> - <iso_3166_2_entry - code="NG-BA" name="Bauchi"/> - <iso_3166_2_entry - code="NG-BY" name="Bayelsa"/> - <iso_3166_2_entry - code="NG-BE" name="Benue"/> - <iso_3166_2_entry - code="NG-BO" name="Borno"/> - <iso_3166_2_entry - code="NG-CR" name="Cross River"/> - <iso_3166_2_entry - code="NG-DE" name="Delta"/> - <iso_3166_2_entry - code="NG-EB" name="Ebonyi"/> - <iso_3166_2_entry - code="NG-ED" name="Edo"/> - <iso_3166_2_entry - code="NG-EK" name="Ekiti"/> - <iso_3166_2_entry - code="NG-EN" name="Enugu"/> - <iso_3166_2_entry - code="NG-GO" name="Gombe"/> - <iso_3166_2_entry - code="NG-IM" name="Imo"/> - <iso_3166_2_entry - code="NG-JI" name="Jigawa"/> - <iso_3166_2_entry - code="NG-KD" name="Kaduna"/> - <iso_3166_2_entry - code="NG-KN" name="Kano"/> - <iso_3166_2_entry - code="NG-KT" name="Katsina"/> - <iso_3166_2_entry - code="NG-KE" name="Kebbi"/> - <iso_3166_2_entry - code="NG-KO" name="Kogi"/> - <iso_3166_2_entry - code="NG-KW" name="Kwara"/> - <iso_3166_2_entry - code="NG-LA" name="Lagos"/> - <iso_3166_2_entry - code="NG-NA" name="Nassarawa"/> - <iso_3166_2_entry - code="NG-NI" name="Niger"/> - <iso_3166_2_entry - code="NG-OG" name="Ogun"/> - <iso_3166_2_entry - code="NG-ON" name="Ondo"/> - <iso_3166_2_entry - code="NG-OS" name="Osun"/> - <iso_3166_2_entry - code="NG-OY" name="Oyo"/> - <iso_3166_2_entry - code="NG-PL" name="Plateau"/> - <iso_3166_2_entry - code="NG-RI" name="Rivers"/> - <iso_3166_2_entry - code="NG-SO" name="Sokoto"/> - <iso_3166_2_entry - code="NG-TA" name="Taraba"/> - <iso_3166_2_entry - code="NG-YO" name="Yobe"/> - <iso_3166_2_entry - code="NG-ZA" name="Zamfara"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nicaragua --> - <iso_3166_country code="NI"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="NI-BO" name="Boaco"/> - <iso_3166_2_entry - code="NI-CA" name="Carazo"/> - <iso_3166_2_entry - code="NI-CI" name="Chinandega"/> - <iso_3166_2_entry - code="NI-CO" name="Chontales"/> - <iso_3166_2_entry - code="NI-ES" name="Estelí"/> - <iso_3166_2_entry - code="NI-GR" name="Granada"/> - <iso_3166_2_entry - code="NI-JI" name="Jinotega"/> - <iso_3166_2_entry - code="NI-LE" name="León"/> - <iso_3166_2_entry - code="NI-MD" name="Madriz"/> - <iso_3166_2_entry - code="NI-MN" name="Managua"/> - <iso_3166_2_entry - code="NI-MS" name="Masaya"/> - <iso_3166_2_entry - code="NI-MT" name="Matagalpa"/> - <iso_3166_2_entry - code="NI-NS" name="Nueva Segovia"/> - <iso_3166_2_entry - code="NI-SJ" name="Río San Juan"/> - <iso_3166_2_entry - code="NI-RI" name="Rivas"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous Region"> - <iso_3166_2_entry - code="NI-AN" name="Atlántico Norte"/> - <iso_3166_2_entry - code="NI-AS" name="Atlántico Sur"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Netherlands --> - <iso_3166_country code="NL"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="NL-DR" name="Drenthe"/> - <iso_3166_2_entry - code="NL-FL" name="Flevoland"/> - <iso_3166_2_entry - code="NL-FR" name="Friesland"/> - <iso_3166_2_entry - code="NL-GE" name="Gelderland"/> - <iso_3166_2_entry - code="NL-GR" name="Groningen"/> - <iso_3166_2_entry - code="NL-LI" name="Limburg"/> - <iso_3166_2_entry - code="NL-NB" name="Noord-Brabant"/> - <iso_3166_2_entry - code="NL-NH" name="Noord-Holland"/> - <iso_3166_2_entry - code="NL-OV" name="Overijssel"/> - <iso_3166_2_entry - code="NL-UT" name="Utrecht"/> - <iso_3166_2_entry - code="NL-ZE" name="Zeeland"/> - <iso_3166_2_entry - code="NL-ZH" name="Zuid-Holland"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Norway --> - <iso_3166_country code="NO"> - <iso_3166_subset type="County"> - <!-- Derived from http://geotags.com/geo/DMS3.html --> - <!-- See also Country code 'SJ' for Jan Mayen & Svalbard --> - <iso_3166_2_entry - code="NO-02" name="Akershus"/> - <iso_3166_2_entry - code="NO-09" name="Aust-Agder"/> - <iso_3166_2_entry - code="NO-06" name="Buskerud"/> - <iso_3166_2_entry - code="NO-20" name="Finnmark"/> - <iso_3166_2_entry - code="NO-04" name="Hedmark"/> - <iso_3166_2_entry - code="NO-12" name="Hordaland"/> - <iso_3166_2_entry - code="NO-15" name="Møre og Romsdal"/> - <iso_3166_2_entry - code="NO-18" name="Nordland"/> - <iso_3166_2_entry - code="NO-17" name="Nord-Trøndelag"/> - <iso_3166_2_entry - code="NO-05" name="Oppland"/> - <iso_3166_2_entry - code="NO-03" name="Oslo"/> - <iso_3166_2_entry - code="NO-11" name="Rogaland"/> - <iso_3166_2_entry - code="NO-14" name="Sogn og Fjordane"/> - <iso_3166_2_entry - code="NO-16" name="Sør-Trøndelag"/> - <iso_3166_2_entry - code="NO-08" name="Telemark"/> - <iso_3166_2_entry - code="NO-19" name="Troms"/> - <iso_3166_2_entry - code="NO-10" name="Vest-Agder"/> - <iso_3166_2_entry - code="NO-07" name="Vestfold"/> - <iso_3166_2_entry - code="NO-01" name="Østfold"/> - <iso_3166_2_entry - code="NO-22" name="Jan Mayen"/> - <iso_3166_2_entry - code="NO-21" name="Svalbard"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nepal --> - <iso_3166_country code="NP"> - <iso_3166_subset type="Development region"> - <iso_3166_2_entry - code="NP-1" name="Madhyamanchal"/> - <iso_3166_2_entry - code="NP-2" name="Madhya Pashchimanchal"/> - <iso_3166_2_entry - code="NP-3" name="Pashchimanchal"/> - <iso_3166_2_entry - code="NP-4" name="Purwanchal"/> - <iso_3166_2_entry - code="NP-5" name="Sudur Pashchimanchal"/> - </iso_3166_subset> - <iso_3166_subset type="zone"> - <iso_3166_2_entry - code="NP-BA" name="Bagmati" parent="1"/> - <iso_3166_2_entry - code="NP-BH" name="Bheri" parent="2"/> - <iso_3166_2_entry - code="NP-DH" name="Dhawalagiri" parent="3"/> - <iso_3166_2_entry - code="NP-GA" name="Gandaki" parent="3"/> - <iso_3166_2_entry - code="NP-JA" name="Janakpur" parent="1"/> - <iso_3166_2_entry - code="NP-KA" name="Karnali" parent="2"/> - <iso_3166_2_entry - code="NP-KO" name="Kosi" parent="4"/> - <iso_3166_2_entry - code="NP-LU" name="Lumbini" parent="3"/> - <iso_3166_2_entry - code="NP-MA" name="Mahakali" parent="5"/> - <iso_3166_2_entry - code="NP-ME" name="Mechi" parent="4"/> - <iso_3166_2_entry - code="NP-NA" name="Narayani" parent="1"/> - <iso_3166_2_entry - code="NP-RA" name="Rapti" parent="2"/> - <iso_3166_2_entry - code="NP-SA" name="Sagarmatha" parent="4"/> - <iso_3166_2_entry - code="NP-SE" name="Seti" parent="5"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nauru --> - <iso_3166_country code="NR"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="NR-01" name="Aiwo"/> - <iso_3166_2_entry - code="NR-02" name="Anabar"/> - <iso_3166_2_entry - code="NR-03" name="Anetan"/> - <iso_3166_2_entry - code="NR-04" name="Anibare"/> - <iso_3166_2_entry - code="NR-05" name="Baiti"/> - <iso_3166_2_entry - code="NR-06" name="Boe"/> - <iso_3166_2_entry - code="NR-07" name="Buada"/> - <iso_3166_2_entry - code="NR-08" name="Denigomodu"/> - <iso_3166_2_entry - code="NR-09" name="Ewa"/> - <iso_3166_2_entry - code="NR-10" name="Ijuw"/> - <iso_3166_2_entry - code="NR-11" name="Meneng"/> - <iso_3166_2_entry - code="NR-12" name="Nibok"/> - <iso_3166_2_entry - code="NR-13" name="Uaboe"/> - <iso_3166_2_entry - code="NR-14" name="Yaren"/> - </iso_3166_subset> - </iso_3166_country> - <!-- New Zealand --> - <iso_3166_country code="NZ"> - <iso_3166_subset type="Island"> - <iso_3166_2_entry - code="NZ-N" name="North Island"/> - <iso_3166_2_entry - code="NZ-S" name="South Island"/> - </iso_3166_subset> - <iso_3166_subset type="Regional council"> - <iso_3166_2_entry - code="NZ-AUK" name="Auckland" parent="N"/> - <iso_3166_2_entry - code="NZ-BOP" name="Bay of Plenty" parent="N"/> - <iso_3166_2_entry - code="NZ-CAN" name="Canterbury" parent="S"/> - <iso_3166_2_entry - code="NZ-HKB" name="Hawke's Bay" parent="N"/> - <iso_3166_2_entry - code="NZ-MWT" name="Manawatu-Wanganui" parent="N"/> - <iso_3166_2_entry - code="NZ-NTL" name="Northland" parent="N"/> - <iso_3166_2_entry - code="NZ-OTA" name="Otago" parent="S"/> - <iso_3166_2_entry - code="NZ-STL" name="Southland" parent="S"/> - <iso_3166_2_entry - code="NZ-TKI" name="Taranaki" parent="N"/> - <iso_3166_2_entry - code="NZ-WKO" name="Waikato" parent="N"/> - <iso_3166_2_entry - code="NZ-WGN" name="Wellington" parent="N"/> - <iso_3166_2_entry - code="NZ-WTC" name="West Coast" parent="S"/> - </iso_3166_subset> - <iso_3166_subset type="Unitary authority"> - <iso_3166_2_entry - code="NZ-GIS" name="Gisborne District" parent="N"/> - <iso_3166_2_entry - code="NZ-MBH" name="Marlborough District" parent="S"/> - <iso_3166_2_entry - code="NZ-NSN" name="Nelson City" parent="S"/> - <iso_3166_2_entry - code="NZ-TAS" name="Tasman District" parent="S"/> - </iso_3166_subset> - <iso_3166_subset type="Special island authority"> - <iso_3166_2_entry - code="NZ-CIT" name="Chatham Islands Territory"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Oman --> - <iso_3166_country code="OM"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="OM-DA" name="Ad Dākhilīya"/> - <iso_3166_2_entry - code="OM-BA" name="Al Bāţinah"/> - <iso_3166_2_entry - code="OM-WU" name="Al Wusţá"/> - <iso_3166_2_entry - code="OM-SH" name="Ash Sharqīyah"/> - <iso_3166_2_entry - code="OM-ZA" name="Az̧ Z̧āhirah"/> - </iso_3166_subset> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="OM-BU" name="Al Buraymī"/> - <iso_3166_2_entry - code="OM-MA" name="Masqaţ"/> - <iso_3166_2_entry - code="OM-MU" name="Musandam"/> - <iso_3166_2_entry - code="OM-ZU" name="Z̧ufār"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Panama --> - <iso_3166_country code="PA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PA-1" name="Bocas del Toro"/> - <iso_3166_2_entry - code="PA-4" name="Chiriquí"/> - <iso_3166_2_entry - code="PA-2" name="Coclé"/> - <iso_3166_2_entry - code="PA-3" name="Colón"/> - <iso_3166_2_entry - code="PA-5" name="Darién"/> - <iso_3166_2_entry - code="PA-6" name="Herrera"/> - <iso_3166_2_entry - code="PA-7" name="Los Santos"/> - <iso_3166_2_entry - code="PA-8" name="Panamá"/> - <iso_3166_2_entry - code="PA-9" name="Veraguas"/> - </iso_3166_subset> - <iso_3166_subset type="Indigenous region"> - <iso_3166_2_entry - code="PA-EM" name="Emberá"/> - <iso_3166_2_entry - code="PA-KY" name="Kuna Yala"/> - <iso_3166_2_entry - code="PA-NB" name="Ngöbe-Buglé"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Peru --> - <iso_3166_country code="PE"> - <iso_3166_subset type="Constitutional province"> - <iso_3166_2_entry - code="PE-CAL" name="El Callao"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="PE-LMA" name="Municipalidad Metropolitana de Lima"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="PE-AMA" name="Amazonas"/> - <iso_3166_2_entry - code="PE-ANC" name="Ancash"/> - <iso_3166_2_entry - code="PE-APU" name="Apurímac"/> - <iso_3166_2_entry - code="PE-ARE" name="Arequipa"/> - <iso_3166_2_entry - code="PE-AYA" name="Ayacucho"/> - <iso_3166_2_entry - code="PE-CAJ" name="Cajamarca"/> - <iso_3166_2_entry - code="PE-CUS" name="Cusco [Cuzco]"/> - <iso_3166_2_entry - code="PE-HUV" name="Huancavelica"/> - <iso_3166_2_entry - code="PE-HUC" name="Huánuco"/> - <iso_3166_2_entry - code="PE-ICA" name="Ica"/> - <iso_3166_2_entry - code="PE-JUN" name="Junín"/> - <iso_3166_2_entry - code="PE-LAL" name="La Libertad"/> - <iso_3166_2_entry - code="PE-LAM" name="Lambayeque"/> - <iso_3166_2_entry - code="PE-LIM" name="Lima"/> - <iso_3166_2_entry - code="PE-LOR" name="Loreto"/> - <iso_3166_2_entry - code="PE-MDD" name="Madre de Dios"/> - <iso_3166_2_entry - code="PE-MOQ" name="Moquegua"/> - <iso_3166_2_entry - code="PE-PAS" name="Pasco"/> - <iso_3166_2_entry - code="PE-PIU" name="Piura"/> - <iso_3166_2_entry - code="PE-PUN" name="Puno"/> - <iso_3166_2_entry - code="PE-SAM" name="San Martín"/> - <iso_3166_2_entry - code="PE-TAC" name="Tacna"/> - <iso_3166_2_entry - code="PE-TUM" name="Tumbes"/> - <iso_3166_2_entry - code="PE-UCA" name="Ucayali"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Papua New Guinea --> - <iso_3166_country code="PG"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="PG-NCD" name="National Capital District (Port Moresby)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PG-CPM" name="Central"/> - <iso_3166_2_entry - code="PG-CPK" name="Chimbu"/> - <iso_3166_2_entry - code="PG-EHG" name="Eastern Highlands"/> - <iso_3166_2_entry - code="PG-EBR" name="East New Britain"/> - <iso_3166_2_entry - code="PG-ESW" name="East Sepik"/> - <iso_3166_2_entry - code="PG-EPW" name="Enga"/> - <iso_3166_2_entry - code="PG-GPK" name="Gulf"/> - <iso_3166_2_entry - code="PG-MPM" name="Madang"/> - <iso_3166_2_entry - code="PG-MRL" name="Manus"/> - <iso_3166_2_entry - code="PG-MBA" name="Milne Bay"/> - <iso_3166_2_entry - code="PG-MPL" name="Morobe"/> - <iso_3166_2_entry - code="PG-NIK" name="New Ireland"/> - <iso_3166_2_entry - code="PG-NPP" name="Northern"/> - <iso_3166_2_entry - code="PG-NSA" name="North Solomons"/> - <iso_3166_2_entry - code="PG-SAN" name="Sandaun"/> - <iso_3166_2_entry - code="PG-SHM" name="Southern Highlands"/> - <iso_3166_2_entry - code="PG-WPD" name="Western"/> - <iso_3166_2_entry - code="PG-WHM" name="Western Highlands"/> - <iso_3166_2_entry - code="PG-WBK" name="West New Britain"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Phillipines --> - <iso_3166_country code="PH"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="PH-14" name="Autonomous Region in Muslim Mindanao (ARMM)"/> - <iso_3166_2_entry - code="PH-05" name="Bicol (Region V)"/> - <iso_3166_2_entry - code="PH-02" name="Cagayan Valley (Region II)"/> - <iso_3166_2_entry - code="PH-40" name="CALABARZON (Region IV-A)"/> - <iso_3166_2_entry - code="PH-13" name="Caraga (Region XIII)"/> - <iso_3166_2_entry - code="PH-03" name="Central Luzon (Region III)"/> - <iso_3166_2_entry - code="PH-07" name="Central Visayas (Region VII)"/> - <iso_3166_2_entry - code="PH-15" name="Cordillera Administrative Region (CAR)"/> - <iso_3166_2_entry - code="PH-08" name="Eastern Visayas (Region VIII)"/> - <iso_3166_2_entry - code="PH-01" name="Ilocos (Region I)"/> - <iso_3166_2_entry - code="PH-41" name="MIMAROPA (Region IV-B)"/> - <iso_3166_2_entry - code="PH-00" name="National Capital Region"/> - <iso_3166_2_entry - code="PH-10" name="Northern Mindanao (Region X)"/> - <iso_3166_2_entry - code="PH-12" name="Soccsksargen (Region XII)"/> - <iso_3166_2_entry - code="PH-06" name="Western Visayas (Region VI)"/> - <iso_3166_2_entry - code="PH-09" name="Zamboanga Peninsula (Region IX)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PH-ABR" name="Abra" parent="15"/> - <iso_3166_2_entry - code="PH-AGN" name="Agusan del Norte" parent="13"/> - <iso_3166_2_entry - code="PH-AGS" name="Agusan del Sur" parent="13"/> - <iso_3166_2_entry - code="PH-AKL" name="Aklan" parent="06"/> - <iso_3166_2_entry - code="PH-ALB" name="Albay" parent="05"/> - <iso_3166_2_entry - code="PH-ANT" name="Antique" parent="06"/> - <iso_3166_2_entry - code="PH-APA" name="Apayao" parent="15"/> - <iso_3166_2_entry - code="PH-AUR" name="Aurora" parent="03"/> - <iso_3166_2_entry - code="PH-BAS" name="Basilan" parent="09"/> - <iso_3166_2_entry - code="PH-BAN" name="Batasn" parent="03"/> - <iso_3166_2_entry - code="PH-BTN" name="Batanes" parent="02"/> - <iso_3166_2_entry - code="PH-BTG" name="Batangas" parent="40"/> - <iso_3166_2_entry - code="PH-BEN" name="Benguet" parent="15"/> - <iso_3166_2_entry - code="PH-BIL" name="Biliran" parent="08"/> - <iso_3166_2_entry - code="PH-BOH" name="Bohol" parent="07"/> - <iso_3166_2_entry - code="PH-BUK" name="Bukidnon" parent="10"/> - <iso_3166_2_entry - code="PH-BUL" name="Bulacan" parent="03"/> - <iso_3166_2_entry - code="PH-CAG" name="Cagayan" parent="02"/> - <iso_3166_2_entry - code="PH-CAN" name="Camarines Norte" parent="05"/> - <iso_3166_2_entry - code="PH-CAS" name="Camarines Sur" parent="05"/> - <iso_3166_2_entry - code="PH-CAM" name="Camiguin" parent="10"/> - <iso_3166_2_entry - code="PH-CAP" name="Capiz" parent="06"/> - <iso_3166_2_entry - code="PH-CAT" name="Catanduanes" parent="05"/> - <iso_3166_2_entry - code="PH-CAV" name="Cavite" parent="40"/> - <iso_3166_2_entry - code="PH-CEB" name="Cebu" parent="07"/> - <iso_3166_2_entry - code="PH-COM" name="Compostela Valley" parent="11"/> - <iso_3166_2_entry - code="PH-DAV" name="Davao del Norte" parent="11"/> - <iso_3166_2_entry - code="PH-DAS" name="Davao del Sur" parent="11"/> - <iso_3166_2_entry - code="PH-DAO" name="Davao Oriental" parent="11"/> - <iso_3166_2_entry - code="PH-DIN" name="Dinagat Islands" parent="13"/> - <iso_3166_2_entry - code="PH-EAS" name="Eastern Samar" parent="08"/> - <iso_3166_2_entry - code="PH-GUI" name="Guimaras" parent="06"/> - <iso_3166_2_entry - code="PH-IFU" name="Ifugao" parent="15"/> - <iso_3166_2_entry - code="PH-ILN" name="Ilocos Norte" parent="01"/> - <iso_3166_2_entry - code="PH-ILS" name="Ilocos Sur" parent="01"/> - <iso_3166_2_entry - code="PH-ILI" name="Iloilo" parent="06"/> - <iso_3166_2_entry - code="PH-ISA" name="Isabela" parent="02"/> - <iso_3166_2_entry - code="PH-KAL" name="Kalinga-Apayso" parent="15"/> - <iso_3166_2_entry - code="PH-LAG" name="Laguna" parent="40"/> - <iso_3166_2_entry - code="PH-LAN" name="Lanao del Norte" parent="12"/> - <iso_3166_2_entry - code="PH-LAS" name="Lanao del Sur" parent="14"/> - <iso_3166_2_entry - code="PH-LUN" name="La Union" parent="01"/> - <iso_3166_2_entry - code="PH-LEY" name="Leyte" parent="08"/> - <iso_3166_2_entry - code="PH-MAG" name="Maguindanao" parent="14"/> - <iso_3166_2_entry - code="PH-MAD" name="Marinduque" parent="41"/> - <iso_3166_2_entry - code="PH-MAS" name="Masbate" parent="05"/> - <iso_3166_2_entry - code="PH-MDC" name="Mindoro Occidental" parent="41"/> - <iso_3166_2_entry - code="PH-MDR" name="Mindoro Oriental" parent="41"/> - <iso_3166_2_entry - code="PH-MSC" name="Misamis Occidental" parent="10"/> - <iso_3166_2_entry - code="PH-MSR" name="Misamis Oriental" parent="10"/> - <iso_3166_2_entry - code="PH-MOU" name="Mountain Province" parent="15"/> - <iso_3166_2_entry - code="PH-NEC" name="Negroe Occidental" parent="06"/> - <iso_3166_2_entry - code="PH-NER" name="Negros Oriental" parent="07"/> - <iso_3166_2_entry - code="PH-NCO" name="North Cotabato" parent="12"/> - <iso_3166_2_entry - code="PH-NSA" name="Northern Samar" parent="08"/> - <iso_3166_2_entry - code="PH-NUE" name="Nueva Ecija" parent="03"/> - <iso_3166_2_entry - code="PH-NUV" name="Nueva Vizcaya" parent="02"/> - <iso_3166_2_entry - code="PH-PLW" name="Palawan" parent="41"/> - <iso_3166_2_entry - code="PH-PAM" name="Pampanga" parent="03"/> - <iso_3166_2_entry - code="PH-PAN" name="Pangasinan" parent="01"/> - <iso_3166_2_entry - code="PH-QUE" name="Quezon" parent="40"/> - <iso_3166_2_entry - code="PH-QUI" name="Quirino" parent="02"/> - <iso_3166_2_entry - code="PH-RIZ" name="Rizal" parent="40"/> - <iso_3166_2_entry - code="PH-ROM" name="Romblon" parent="41"/> - <iso_3166_2_entry - code="PH-SAR" name="Sarangani" parent="11"/> - <iso_3166_2_entry - code="PH-SIG" name="Siquijor" parent="07"/> - <iso_3166_2_entry - code="PH-SOR" name="Sorsogon" parent="05"/> - <iso_3166_2_entry - code="PH-SCO" name="South Cotabato" parent="11"/> - <iso_3166_2_entry - code="PH-SLE" name="Southern Leyte" parent="08"/> - <iso_3166_2_entry - code="PH-SUK" name="Sultan Kudarat" parent="12"/> - <iso_3166_2_entry - code="PH-SLU" name="Sulu" parent="14"/> - <iso_3166_2_entry - code="PH-SUN" name="Surigao del Norte" parent="13"/> - <iso_3166_2_entry - code="PH-SUR" name="Surigao del Sur" parent="13"/> - <iso_3166_2_entry - code="PH-TAR" name="Tarlac" parent="03"/> - <iso_3166_2_entry - code="PH-TAW" name="Tawi-Tawi" parent="14"/> - <iso_3166_2_entry - code="PH-WSA" name="Western Samar" parent="08"/> - <iso_3166_2_entry - code="PH-ZMB" name="Zambales" parent="03"/> - <iso_3166_2_entry - code="PH-ZAN" name="Zamboanga del Norte" parent="09"/> - <iso_3166_2_entry - code="PH-ZAS" name="Zamboanga del Sur" parent="09"/> - <iso_3166_2_entry - code="PH-ZSI" name="Zamboanga Sibugay" parent="09"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Pakistan --> - <iso_3166_country code="PK"> - <iso_3166_subset type="Capital territory"> - <iso_3166_2_entry - code="PK-IS" name="Islamabad"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PK-BA" name="Balochistan"/> - <iso_3166_2_entry - code="PK-NW" name="North-West Frontier"/> - <iso_3166_2_entry - code="PK-PB" name="Punjab"/> - <iso_3166_2_entry - code="PK-SD" name="Sindh"/> - </iso_3166_subset> - <iso_3166_subset type="Area"> - <iso_3166_2_entry - code="PK-TA" name="Federally Administered Tribal Areas"/> - <iso_3166_2_entry - code="PK-JK" name="Azad Kashmir"/> - <iso_3166_2_entry - code="PK-NA" name="Northern Areas"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Poland --> - <iso_3166_country code="PL"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PL-DS" name="Dolnośląskie"/> - <iso_3166_2_entry - code="PL-KP" name="Kujawsko-pomorskie"/> - <iso_3166_2_entry - code="PL-LU" name="Lubelskie"/> - <iso_3166_2_entry - code="PL-LB" name="Lubuskie"/> - <iso_3166_2_entry - code="PL-LD" name="Łódzkie"/> - <iso_3166_2_entry - code="PL-MA" name="Małopolskie"/> - <iso_3166_2_entry - code="PL-MZ" name="Mazowieckie"/> - <iso_3166_2_entry - code="PL-OP" name="Opolskie"/> - <iso_3166_2_entry - code="PL-PK" name="Podkarpackie"/> - <iso_3166_2_entry - code="PL-PD" name="Podlaskie"/> - <iso_3166_2_entry - code="PL-PM" name="Pomorskie"/> - <iso_3166_2_entry - code="PL-SL" name="Śląskie"/> - <iso_3166_2_entry - code="PL-SK" name="Świętokrzyskie"/> - <iso_3166_2_entry - code="PL-WN" name="Warmińsko-mazurskie"/> - <iso_3166_2_entry - code="PL-WP" name="Wielkopolskie"/> - <iso_3166_2_entry - code="PL-ZP" name="Zachodniopomorskie"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Palestinian Territory, Occupied --> - <iso_3166_country code="PS"/> - <!-- Portugal --> - <iso_3166_country code="PT"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="PT-01" name="Aveiro"/> - <iso_3166_2_entry - code="PT-02" name="Beja"/> - <iso_3166_2_entry - code="PT-03" name="Braga"/> - <iso_3166_2_entry - code="PT-04" name="Bragança"/> - <iso_3166_2_entry - code="PT-05" name="Castelo Branco"/> - <iso_3166_2_entry - code="PT-06" name="Coimbra"/> - <iso_3166_2_entry - code="PT-07" name="Évora"/> - <iso_3166_2_entry - code="PT-08" name="Faro"/> - <iso_3166_2_entry - code="PT-09" name="Guarda"/> - <iso_3166_2_entry - code="PT-10" name="Leiria"/> - <iso_3166_2_entry - code="PT-11" name="Lisboa"/> - <iso_3166_2_entry - code="PT-12" name="Portalegre"/> - <iso_3166_2_entry - code="PT-13" name="Porto"/> - <iso_3166_2_entry - code="PT-14" name="Santarém"/> - <iso_3166_2_entry - code="PT-15" name="Setúbal"/> - <iso_3166_2_entry - code="PT-16" name="Viana do Castelo"/> - <iso_3166_2_entry - code="PT-17" name="Vila Real"/> - <iso_3166_2_entry - code="PT-18" name="Viseu"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous region"> - <iso_3166_2_entry - code="PT-20" name="Região Autónoma dos Açores"/> - <iso_3166_2_entry - code="PT-30" name="Região Autónoma da Madeira"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Palau --> - <iso_3166_country code="PW"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="PW-002" name="Aimeliik"/> - <iso_3166_2_entry - code="PW-004" name="Airai"/> - <iso_3166_2_entry - code="PW-010" name="Angaur"/> - <iso_3166_2_entry - code="PW-050" name="Hatobohei"/> - <iso_3166_2_entry - code="PW-100" name="Kayangel"/> - <iso_3166_2_entry - code="PW-150" name="Koror"/> - <iso_3166_2_entry - code="PW-212" name="Melekeok"/> - <iso_3166_2_entry - code="PW-214" name="Ngaraard"/> - <iso_3166_2_entry - code="PW-218" name="Ngarchelong"/> - <iso_3166_2_entry - code="PW-222" name="Ngardmau"/> - <iso_3166_2_entry - code="PW-224" name="Ngatpang"/> - <iso_3166_2_entry - code="PW-226" name="Ngchesar"/> - <iso_3166_2_entry - code="PW-227" name="Ngeremlengui"/> - <iso_3166_2_entry - code="PW-228" name="Ngiwal"/> - <iso_3166_2_entry - code="PW-350" name="Peleliu"/> - <iso_3166_2_entry - code="PW-370" name="Sonsorol"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Paraguay --> - <iso_3166_country code="PY"> - <iso_3166_subset type="Capital district"> - <iso_3166_2_entry - code="PY-ASU" name="Asunción"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="PY-16" name="Alto Paraguay"/> - <iso_3166_2_entry - code="PY-10" name="Alto Paraná"/> - <iso_3166_2_entry - code="PY-13" name="Amambay"/> - <iso_3166_2_entry - code="PY-19" name="Boquerón"/> - <iso_3166_2_entry - code="PY-5" name="Caaguazú"/> - <iso_3166_2_entry - code="PY-6" name="Caazapá"/> - <iso_3166_2_entry - code="PY-14" name="Canindeyú"/> - <iso_3166_2_entry - code="PY-11" name="Central"/> - <iso_3166_2_entry - code="PY-1" name="Concepción"/> - <iso_3166_2_entry - code="PY-3" name="Cordillera"/> - <iso_3166_2_entry - code="PY-4" name="Guairá"/> - <iso_3166_2_entry - code="PY-7" name="Itapúa"/> - <iso_3166_2_entry - code="PY-8" name="Misiones"/> - <iso_3166_2_entry - code="PY-12" name="Ñeembucú"/> - <iso_3166_2_entry - code="PY-9" name="Paraguarí"/> - <iso_3166_2_entry - code="PY-15" name="Presidente Hayes"/> - <iso_3166_2_entry - code="PY-2" name="San Pedro"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Qatar --> - <iso_3166_country code="QA"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="QA-DA" name="Ad Dawhah"/> - <iso_3166_2_entry - code="QA-GH" name="Al Ghuwayriyah"/> - <iso_3166_2_entry - code="QA-JU" name="Al Jumayliyah"/> - <iso_3166_2_entry - code="QA-KH" name="Al Khawr"/> - <iso_3166_2_entry - code="QA-WA" name="Al Wakrah"/> - <iso_3166_2_entry - code="QA-RA" name="Ar Rayyan"/> - <iso_3166_2_entry - code="QA-JB" name="Jariyan al Batnah"/> - <iso_3166_2_entry - code="QA-MS" name="Madinat ash Shamal"/> - <iso_3166_2_entry - code="QA-US" name="Umm Salal"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Romania --> - <iso_3166_country code="RO"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="RO-AB" name="Alba"/> - <iso_3166_2_entry - code="RO-AR" name="Arad"/> - <iso_3166_2_entry - code="RO-AG" name="Argeș"/> - <iso_3166_2_entry - code="RO-BC" name="Bacău"/> - <iso_3166_2_entry - code="RO-BH" name="Bihor"/> - <iso_3166_2_entry - code="RO-BN" name="Bistrița-Năsăud"/> - <iso_3166_2_entry - code="RO-BT" name="Botoșani"/> - <iso_3166_2_entry - code="RO-BV" name="Brașov"/> - <iso_3166_2_entry - code="RO-BR" name="Brăila"/> - <iso_3166_2_entry - code="RO-BZ" name="Buzău"/> - <iso_3166_2_entry - code="RO-CS" name="Caraș-Severin"/> - <iso_3166_2_entry - code="RO-CL" name="Călărași"/> - <iso_3166_2_entry - code="RO-CJ" name="Cluj"/> - <iso_3166_2_entry - code="RO-CT" name="Constanța"/> - <iso_3166_2_entry - code="RO-CV" name="Covasna"/> - <iso_3166_2_entry - code="RO-DB" name="Dâmbovița"/> - <iso_3166_2_entry - code="RO-DJ" name="Dolj"/> - <iso_3166_2_entry - code="RO-GL" name="Galați"/> - <iso_3166_2_entry - code="RO-GR" name="Giurgiu"/> - <iso_3166_2_entry - code="RO-GJ" name="Gorj"/> - <iso_3166_2_entry - code="RO-HR" name="Harghita"/> - <iso_3166_2_entry - code="RO-HD" name="Hunedoara"/> - <iso_3166_2_entry - code="RO-IL" name="Ialomița"/> - <iso_3166_2_entry - code="RO-IS" name="Iași"/> - <iso_3166_2_entry - code="RO-IF" name="Ilfov"/> - <iso_3166_2_entry - code="RO-MM" name="Maramureș"/> - <iso_3166_2_entry - code="RO-MH" name="Mehedinți"/> - <iso_3166_2_entry - code="RO-MS" name="Mureș"/> - <iso_3166_2_entry - code="RO-NT" name="Neamț"/> - <iso_3166_2_entry - code="RO-OT" name="Olt"/> - <iso_3166_2_entry - code="RO-PH" name="Prahova"/> - <iso_3166_2_entry - code="RO-SM" name="Satu Mare"/> - <iso_3166_2_entry - code="RO-SJ" name="Sălaj"/> - <iso_3166_2_entry - code="RO-SB" name="Sibiu"/> - <iso_3166_2_entry - code="RO-SV" name="Suceava"/> - <iso_3166_2_entry - code="RO-TR" name="Teleorman"/> - <iso_3166_2_entry - code="RO-TM" name="Timiș"/> - <iso_3166_2_entry - code="RO-TL" name="Tulcea"/> - <iso_3166_2_entry - code="RO-VS" name="Vaslui"/> - <iso_3166_2_entry - code="RO-VL" name="Vâlcea"/> - <iso_3166_2_entry - code="RO-VN" name="Vrancea"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="RO-B" name="București"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Serbia --> - <iso_3166_country code="RS"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="RS-00" name="Beograd"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous province"> - <iso_3166_2_entry - code="RS KM" name="Kosovo-Metohija"/> - <iso_3166_2_entry - code="RS VO" name="Vojvodina"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="RS-14" name="Borski okrug"/> - <iso_3166_2_entry - code="RS-11" name="Braničevski okrug"/> - <iso_3166_2_entry - code="RS-23" name="Jablanički okrug"/> - <iso_3166_2_entry - code="RS-06" name="Južnobački okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-04" name="Južnobanatski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-09" name="Kolubarski okrug"/> - <iso_3166_2_entry - code="RS-25" name="Kosovski okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-28" name="Kosovsko-Mitrovački okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-29" name="Kosovsko-Pomoravski okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-08" name="Mačvanski okrug"/> - <iso_3166_2_entry - code="RS-17" name="Moravički okrug"/> - <iso_3166_2_entry - code="RS-20" name="Nišavski okrug"/> - <iso_3166_2_entry - code="RS-24" name="Pčinjski okrug"/> - <iso_3166_2_entry - code="RS-26" name="Pećki okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-22" name="Pirotski okrug"/> - <iso_3166_2_entry - code="RS-10" name="Podunavski okrug"/> - <iso_3166_2_entry - code="RS-13" name="Pomoravski okrug"/> - <iso_3166_2_entry - code="RS-27" name="Prizrenski okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-19" name="Rasinski okrug"/> - <iso_3166_2_entry - code="RS-18" name="Raški okrug"/> - <iso_3166_2_entry - code="RS-01" name="Severnobački okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-03" name="Severnobanatski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-02" name="Srednjebanatski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-07" name="Sremski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-12" name="Šumadijski okrug"/> - <iso_3166_2_entry - code="RS-21" name="Toplički okrug"/> - <iso_3166_2_entry - code="RS-15" name="Zaječarski okrug"/> - <iso_3166_2_entry - code="RS-05" name="Zapadnobački okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-16" name="Zlatiborski okrug"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Russia --> - <iso_3166_country code="RU"> - <!-- The ISO 3166-2 entries give romanised versions according to two standards, --> - <!-- GOST (1983) and Russian BGN/PCGN (1947). --> - <!-- Here the BGN entry is listed , since it was listed first in the ISO document --> - <!-- Localize to Cyrillic anyway in the po files. --> - <iso_3166_subset type="Republic"> - <iso_3166_2_entry - code="RU-AD" name="Adygeya, Respublika"/> - <iso_3166_2_entry - code="RU-AL" name="Altay, Respublika"/> - <iso_3166_2_entry - code="RU-BA" name="Bashkortostan, Respublika"/> - <iso_3166_2_entry - code="RU-BU" name="Buryatiya, Respublika"/> - <iso_3166_2_entry - code="RU-CE" name="Chechenskaya Respublika"/> - <iso_3166_2_entry - code="RU-CU" name="Chuvashskaya Respublika"/> - <iso_3166_2_entry - code="RU-DA" name="Dagestan, Respublika"/> - <iso_3166_2_entry - code="RU-IN" name="Respublika Ingushetiya"/> - <iso_3166_2_entry - code="RU-KB" name="Kabardino-Balkarskaya Respublika"/> - <iso_3166_2_entry - code="RU-KL" name="Kalmykiya, Respublika"/> - <iso_3166_2_entry - code="RU-KC" name="Karachayevo-Cherkesskaya Respublika"/> - <iso_3166_2_entry - code="RU-KR" name="Kareliya, Respublika"/> - <iso_3166_2_entry - code="RU-KK" name="Khakasiya, Respublika"/> - <iso_3166_2_entry - code="RU-KO" name="Komi, Respublika"/> - <iso_3166_2_entry - code="RU-ME" name="Mariy El, Respublika"/> - <iso_3166_2_entry - code="RU-MO" name="Mordoviya, Respublika"/> - <iso_3166_2_entry - code="RU-SA" name="Sakha, Respublika [Yakutiya]"/> - <iso_3166_2_entry - code="RU-SE" name="Severnaya Osetiya-Alaniya, Respublika"/> - <iso_3166_2_entry - code="RU-TA" name="Tatarstan, Respublika"/> - <iso_3166_2_entry - code="RU-TY" name="Tyva, Respublika [Tuva]"/> - <iso_3166_2_entry - code="RU-UD" name="Udmurtskaya Respublika"/> - </iso_3166_subset> - <iso_3166_subset type="Administrative Territory"> - <iso_3166_2_entry - code="RU-ALT" name="Altayskiy kray"/> - <iso_3166_2_entry - code="RU-KAM" name="Kamchatskiy kray"/> - <iso_3166_2_entry - code="RU-KHA" name="Khabarovskiy kray"/> - <iso_3166_2_entry - code="RU-KDA" name="Krasnodarskiy kray"/> - <iso_3166_2_entry - code="RU-KYA" name="Krasnoyarskiy kray"/> - <iso_3166_2_entry - code="RU-PER" name="Permskiy kray"/> - <iso_3166_2_entry - code="RU-PRI" name="Primorskiy kray"/> - <iso_3166_2_entry - code="RU-STA" name="Stavropol'skiy kray"/> - <iso_3166_2_entry - code="RU-ZAB" name="Zabajkal'skij kraj"/> - </iso_3166_subset> - <iso_3166_subset type="Administrative Region"> - <iso_3166_2_entry - code="RU-AMU" name="Amurskaya oblast'"/> - <iso_3166_2_entry - code="RU-ARK" name="Arkhangel'skaya oblast'"/> - <iso_3166_2_entry - code="RU-AST" name="Astrakhanskaya oblast'"/> - <iso_3166_2_entry - code="RU-BEL" name="Belgorodskaya oblast'"/> - <iso_3166_2_entry - code="RU-BRY" name="Bryanskaya oblast'"/> - <iso_3166_2_entry - code="RU-CHE" name="Chelyabinskaya oblast'"/> - <iso_3166_2_entry - code="RU-IRK" name="Irkutiskaya oblast'"/> - <iso_3166_2_entry - code="RU-IVA" name="Ivanovskaya oblast'"/> - <iso_3166_2_entry - code="RU-KGD" name="Kaliningradskaya oblast'"/> - <iso_3166_2_entry - code="RU-KLU" name="Kaluzhskaya oblast'"/> - <iso_3166_2_entry - code="RU-KEM" name="Kemerovskaya oblast'"/> - <iso_3166_2_entry - code="RU-KIR" name="Kirovskaya oblast'"/> - <iso_3166_2_entry - code="RU-KOS" name="Kostromskaya oblast'"/> - <iso_3166_2_entry - code="RU-KGN" name="Kurganskaya oblast'"/> - <iso_3166_2_entry - code="RU-KRS" name="Kurskaya oblast'"/> - <iso_3166_2_entry - code="RU-LEN" name="Leningradskaya oblast'"/> - <iso_3166_2_entry - code="RU-LIP" name="Lipetskaya oblast'"/> - <iso_3166_2_entry - code="RU-MAG" name="Magadanskaya oblast'"/> - <iso_3166_2_entry - code="RU-MOS" name="Moskovskaya oblast'"/> - <iso_3166_2_entry - code="RU-MUR" name="Murmanskaya oblast'"/> - <iso_3166_2_entry - code="RU-NIZ" name="Nizhegorodskaya oblast'"/> - <iso_3166_2_entry - code="RU-NGR" name="Novgorodskaya oblast'"/> - <iso_3166_2_entry - code="RU-NVS" name="Novosibirskaya oblast'"/> - <iso_3166_2_entry - code="RU-OMS" name="Omskaya oblast'"/> - <iso_3166_2_entry - code="RU-ORE" name="Orenburgskaya oblast'"/> - <iso_3166_2_entry - code="RU-ORL" name="Orlovskaya oblast'"/> - <iso_3166_2_entry - code="RU-PNZ" name="Penzenskaya oblast'"/> - <iso_3166_2_entry - code="RU-PSK" name="Pskovskaya oblast'"/> - <iso_3166_2_entry - code="RU-ROS" name="Rostovskaya oblast'"/> - <iso_3166_2_entry - code="RU-RYA" name="Ryazanskaya oblast'"/> - <iso_3166_2_entry - code="RU-SAK" name="Sakhalinskaya oblast'"/> - <iso_3166_2_entry - code="RU-SAM" name="Samaraskaya oblast'"/> - <iso_3166_2_entry - code="RU-SAR" name="Saratovskaya oblast'"/> - <iso_3166_2_entry - code="RU-SMO" name="Smolenskaya oblast'"/> - <iso_3166_2_entry - code="RU-SVE" name="Sverdlovskaya oblast'"/> - <iso_3166_2_entry - code="RU-TAM" name="Tambovskaya oblast'"/> - <iso_3166_2_entry - code="RU-TOM" name="Tomskaya oblast'"/> - <iso_3166_2_entry - code="RU-TUL" name="Tul'skaya oblast'"/> - <iso_3166_2_entry - code="RU-TVE" name="Tverskaya oblast'"/> - <iso_3166_2_entry - code="RU-TYU" name="Tyumenskaya oblast'"/> - <iso_3166_2_entry - code="RU-ULY" name="Ul'yanovskaya oblast'"/> - <iso_3166_2_entry - code="RU-VLA" name="Vladimirskaya oblast'"/> - <iso_3166_2_entry - code="RU-VGG" name="Volgogradskaya oblast'"/> - <iso_3166_2_entry - code="RU-VLG" name="Vologodskaya oblast'"/> - <iso_3166_2_entry - code="RU-VOR" name="Voronezhskaya oblast'"/> - <iso_3166_2_entry - code="RU-YAR" name="Yaroslavskaya oblast'"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous City"> - <iso_3166_2_entry - code="RU-MOW" name="Moskva"/> - <iso_3166_2_entry - code="RU-SPE" name="Sankt-Peterburg"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous Region"> - <iso_3166_2_entry - code="RU-YEV" name="Yevreyskaya avtonomnaya oblast'"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous District"> - <iso_3166_2_entry - code="RU-CHU" name="Chukotskiy avtonomnyy okrug"/> - <iso_3166_2_entry - code="RU-KHM" name="Khanty-Mansiysky avtonomnyy okrug-Yugra"/> - <iso_3166_2_entry - code="RU-NEN" name="Nenetskiy avtonomnyy okrug"/> - <iso_3166_2_entry - code="RU-YAN" name="Yamalo-Nenetskiy avtonomnyy okrug"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Rwanda --> - <iso_3166_country code="RW"> - <iso_3166_subset type="Town council"> - <iso_3166_2_entry - code="RW-01" name="Ville de Kigali"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="RW-02" name="Est"/> - <iso_3166_2_entry - code="RW-03" name="Nord"/> - <iso_3166_2_entry - code="RW-04" name="Ouest"/> - <iso_3166_2_entry - code="RW-05" name="Sud"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saudi Arabia --> - <iso_3166_country code="SA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="SA-11" name="Al Bāhah"/> - <iso_3166_2_entry - code="SA-08" name="Al Ḥudūd ash Shamāliyah"/> - <iso_3166_2_entry - code="SA-12" name="Al Jawf"/> - <iso_3166_2_entry - code="SA-03" name="Al Madīnah"/> - <iso_3166_2_entry - code="SA-05" name="Al Qaşīm"/> - <iso_3166_2_entry - code="SA-01" name="Ar Riyāḍ"/> - <iso_3166_2_entry - code="SA-04" name="Ash Sharqīyah"/> - <iso_3166_2_entry - code="SA-14" name="`Asīr"/> - <iso_3166_2_entry - code="SA-06" name="Ḥā'il"/> - <iso_3166_2_entry - code="SA-09" name="Jīzan"/> - <iso_3166_2_entry - code="SA-02" name="Makkah"/> - <iso_3166_2_entry - code="SA-10" name="Najrān"/> - <iso_3166_2_entry - code="SA-07" name="Tabūk"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Solomon Islands --> - <iso_3166_country code="SB"> - <iso_3166_subset type="Capital territory"> - <iso_3166_2_entry - code="SB-CT" name="Capital Territory (Honiara)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="SB-CE" name="Central"/> - <iso_3166_2_entry - code="SB-CH" name="Choiseul"/> - <iso_3166_2_entry - code="SB-GU" name="Guadalcanal"/> - <iso_3166_2_entry - code="SB-IS" name="Isabel"/> - <iso_3166_2_entry - code="SB-MK" name="Makira"/> - <iso_3166_2_entry - code="SB-ML" name="Malaita"/> - <iso_3166_2_entry - code="SB-RB" name="Rennell and Bellona"/> - <iso_3166_2_entry - code="SB-TE" name="Temotu"/> - <iso_3166_2_entry - code="SB-WE" name="Western"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Seychelles --> - <iso_3166_country code="SC"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="SC-01" name="Anse aux Pins"/> - <iso_3166_2_entry - code="SC-02" name="Anse Boileau"/> - <iso_3166_2_entry - code="SC-03" name="Anse Etoile"/> - <iso_3166_2_entry - code="SC-04" name="Anse Louis"/> - <iso_3166_2_entry - code="SC-05" name="Anse Royale"/> - <iso_3166_2_entry - code="SC-06" name="Baie Lazare"/> - <iso_3166_2_entry - code="SC-07" name="Baie Sainte Anne"/> - <iso_3166_2_entry - code="SC-08" name="Beau Vallon"/> - <iso_3166_2_entry - code="SC-09" name="Bel Air"/> - <iso_3166_2_entry - code="SC-10" name="Bel Ombre"/> - <iso_3166_2_entry - code="SC-11" name="Cascade"/> - <iso_3166_2_entry - code="SC-12" name="Glacis"/> - <iso_3166_2_entry - code="SC-13" name="Grand Anse Mahe"/> - <iso_3166_2_entry - code="SC-14" name="Grand Anse Praslin"/> - <iso_3166_2_entry - code="SC-15" name="La Digue"/> - <iso_3166_2_entry - code="SC-16" name="English River"/> - <iso_3166_2_entry - code="SC-24" name="Les Mamelles"/> - <iso_3166_2_entry - code="SC-17" name="Mont Buxton"/> - <iso_3166_2_entry - code="SC-18" name="Mont Fleuri"/> - <iso_3166_2_entry - code="SC-19" name="Plaisance"/> - <iso_3166_2_entry - code="SC-20" name="Pointe Larue"/> - <iso_3166_2_entry - code="SC-21" name="Port Glaud"/> - <iso_3166_2_entry - code="SC-25" name="Roche Caiman"/> - <iso_3166_2_entry - code="SC-22" name="Saint Louis"/> - <iso_3166_2_entry - code="SC-23" name="Takamaka"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sudan --> - <iso_3166_country code="SD"> - <iso_3166_subset type="state"> - <iso_3166_2_entry - code="SD-26" name="Al Baḩr al Aḩmar"/> - <iso_3166_2_entry - code="SD-18" name="Al Buḩayrāt"/> - <iso_3166_2_entry - code="SD-07" name="Al Jazīrah"/> - <iso_3166_2_entry - code="SD-03" name="Al Kharţūm"/> - <iso_3166_2_entry - code="SD-06" name="Al Qaḑārif"/> - <iso_3166_2_entry - code="SD-22" name="Al Waḩdah"/> - <iso_3166_2_entry - code="SD-04" name="An Nīl"/> - <iso_3166_2_entry - code="SD-08" name="An Nīl al Abyaḑ"/> - <iso_3166_2_entry - code="SD-24" name="An Nīl al Azraq"/> - <iso_3166_2_entry - code="SD-01" name="Ash Shamālīyah"/> - <iso_3166_2_entry - code="SD-23" name="A‘ālī an Nīl"/> - <iso_3166_2_entry - code="SD-17" name="Baḩr al Jabal"/> - <iso_3166_2_entry - code="SD-16" name="Gharb al Istiwā'īyah"/> - <iso_3166_2_entry - code="SD-14" name="Gharb Baḩr al Ghazāl"/> - <iso_3166_2_entry - code="SD-12" name="Gharb Dārfūr"/> - <iso_3166_2_entry - code="SD-11" name="Janūb Dārfūr"/> - <iso_3166_2_entry - code="SD-13" name="Janūb Kurdufān"/> - <iso_3166_2_entry - code="SD-20" name="Jūnqalī"/> - <iso_3166_2_entry - code="SD-05" name="Kassalā"/> - <iso_3166_2_entry - code="SD-15" name="Shamāl Baḩr al Ghazāl"/> - <iso_3166_2_entry - code="SD-02" name="Shamāl Dārfūr"/> - <iso_3166_2_entry - code="SD-09" name="Shamāl Kurdufān"/> - <iso_3166_2_entry - code="SD-19" name="Sharq al Istiwā'īyah"/> - <iso_3166_2_entry - code="SD-25" name="Sinnār"/> - <iso_3166_2_entry - code="SD-21" name="Wārāb"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sweden --> - <iso_3166_country code="SE"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="SE-K" name="Blekinge län"/> - <iso_3166_2_entry - code="SE-W" name="Dalarnas län"/> - <iso_3166_2_entry - code="SE-I" name="Gotlands län"/> - <iso_3166_2_entry - code="SE-X" name="Gävleborgs län"/> - <iso_3166_2_entry - code="SE-N" name="Hallands län"/> - <iso_3166_2_entry - code="SE-Z" name="Jämtlande län"/> - <iso_3166_2_entry - code="SE-F" name="Jönköpings län"/> - <iso_3166_2_entry - code="SE-H" name="Kalmar län"/> - <iso_3166_2_entry - code="SE-G" name="Kronobergs län"/> - <iso_3166_2_entry - code="SE-BD" name="Norrbottens län"/> - <iso_3166_2_entry - code="SE-M" name="Skåne län"/> - <iso_3166_2_entry - code="SE-AB" name="Stockholms län"/> - <iso_3166_2_entry - code="SE-D" name="Södermanlands län"/> - <iso_3166_2_entry - code="SE-C" name="Uppsala län"/> - <iso_3166_2_entry - code="SE-S" name="Värmlands län"/> - <iso_3166_2_entry - code="SE-AC" name="Västerbottens län"/> - <iso_3166_2_entry - code="SE-Y" name="Västernorrlands län"/> - <iso_3166_2_entry - code="SE-U" name="Västmanlands län"/> - <iso_3166_2_entry - code="SE-Q" name="Västra Götalands län"/> - <iso_3166_2_entry - code="SE-T" name="Örebro län"/> - <iso_3166_2_entry - code="SE-E" name="Östergötlands län"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Singapore --> - <iso_3166_country code="SG"> - <iso_3166_subset type="district"> - <iso_3166_2_entry - code="SG-01" name="Central Singapore"/> - <iso_3166_2_entry - code="SG-02" name="North East"/> - <iso_3166_2_entry - code="SG-03" name="North West"/> - <iso_3166_2_entry - code="SG-04" name="South East"/> - <iso_3166_2_entry - code="SG-05" name="South West"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Helena, Ascension and Tristan da Cunha --> - <iso_3166_country code="SH"> - </iso_3166_country> - <!-- Slovenia --> - <iso_3166_country code="SI"> - <iso_3166_subset type="Municipalities"> - <iso_3166_2_entry - code="SI-001" name="Ajdovščina"/> - <iso_3166_2_entry - code="SI-195" name="Apače"/> - <iso_3166_2_entry - code="SI-002" name="Beltinci"/> - <iso_3166_2_entry - code="SI-148" name="Benedikt"/> - <iso_3166_2_entry - code="SI-149" name="Bistrica ob Sotli"/> - <iso_3166_2_entry - code="SI-003" name="Bled"/> - <iso_3166_2_entry - code="SI-150" name="Bloke"/> - <iso_3166_2_entry - code="SI-004" name="Bohinj"/> - <iso_3166_2_entry - code="SI-005" name="Borovnica"/> - <iso_3166_2_entry - code="SI-006" name="Bovec"/> - <iso_3166_2_entry - code="SI-151" name="Braslovče"/> - <iso_3166_2_entry - code="SI-007" name="Brda"/> - <iso_3166_2_entry - code="SI-008" name="Brezovica"/> - <iso_3166_2_entry - code="SI-009" name="Brežice"/> - <iso_3166_2_entry - code="SI-152" name="Cankova"/> - <iso_3166_2_entry - code="SI-011" name="Celje"/> - <iso_3166_2_entry - code="SI-012" name="Cerklje na Gorenjskem"/> - <iso_3166_2_entry - code="SI-013" name="Cerknica"/> - <iso_3166_2_entry - code="SI-014" name="Cerkno"/> - <iso_3166_2_entry - code="SI-153" name="Cerkvenjak"/> - <iso_3166_2_entry - code="SI-196" name="Cirkulane"/> - <iso_3166_2_entry - code="SI-015" name="Črenšovci"/> - <iso_3166_2_entry - code="SI-016" name="Črna na Koroškem"/> - <iso_3166_2_entry - code="SI-017" name="Črnomelj"/> - <iso_3166_2_entry - code="SI-018" name="Destrnik"/> - <iso_3166_2_entry - code="SI-019" name="Divača"/> - <iso_3166_2_entry - code="SI-154" name="Dobje"/> - <iso_3166_2_entry - code="SI-020" name="Dobrepolje"/> - <iso_3166_2_entry - code="SI-155" name="Dobrna"/> - <iso_3166_2_entry - code="SI-021" name="Dobrova-Polhov Gradec"/> - <iso_3166_2_entry - code="SI-156" name="Dobrovnik/Dobronak"/> - <iso_3166_2_entry - code="SI-022" name="Dol pri Ljubljani"/> - <iso_3166_2_entry - code="SI-157" name="Dolenjske Toplice"/> - <iso_3166_2_entry - code="SI-023" name="Domžale"/> - <iso_3166_2_entry - code="SI-024" name="Dornava"/> - <iso_3166_2_entry - code="SI-025" name="Dravograd"/> - <iso_3166_2_entry - code="SI-026" name="Duplek"/> - <iso_3166_2_entry - code="SI-027" name="Gorenja vas-Poljane"/> - <iso_3166_2_entry - code="SI-028" name="Gorišnica"/> - <iso_3166_2_entry - code="SI-207" name="Gorje"/> - <iso_3166_2_entry - code="SI-029" name="Gornja Radgona"/> - <iso_3166_2_entry - code="SI-030" name="Gornji Grad"/> - <iso_3166_2_entry - code="SI-031" name="Gornji Petrovci"/> - <iso_3166_2_entry - code="SI-158" name="Grad"/> - <iso_3166_2_entry - code="SI-032" name="Grosuplje"/> - <iso_3166_2_entry - code="SI-159" name="Hajdina"/> - <iso_3166_2_entry - code="SI-160" name="Hoče-Slivnica"/> - <iso_3166_2_entry - code="SI-161" name="Hodoš/Hodos"/> - <iso_3166_2_entry - code="SI-162" name="Horjul"/> - <iso_3166_2_entry - code="SI-034" name="Hrastnik"/> - <iso_3166_2_entry - code="SI-035" name="Hrpelje-Kozina"/> - <iso_3166_2_entry - code="SI-036" name="Idrija"/> - <iso_3166_2_entry - code="SI-037" name="Ig"/> - <iso_3166_2_entry - code="SI-038" name="Ilirska Bistrica"/> - <iso_3166_2_entry - code="SI-039" name="Ivančna Gorica"/> - <iso_3166_2_entry - code="SI-040" name="Izola/Isola"/> - <iso_3166_2_entry - code="SI-041" name="Jesenice"/> - <iso_3166_2_entry - code="SI-163" name="Jezersko"/> - <iso_3166_2_entry - code="SI-042" name="Juršinci"/> - <iso_3166_2_entry - code="SI-043" name="Kamnik"/> - <iso_3166_2_entry - code="SI-044" name="Kanal"/> - <iso_3166_2_entry - code="SI-045" name="Kidričevo"/> - <iso_3166_2_entry - code="SI-046" name="Kobarid"/> - <iso_3166_2_entry - code="SI-047" name="Kobilje"/> - <iso_3166_2_entry - code="SI-048" name="Kočevje"/> - <iso_3166_2_entry - code="SI-049" name="Komen"/> - <iso_3166_2_entry - code="SI-164" name="Komenda"/> - <iso_3166_2_entry - code="SI-050" name="Koper/Capodistria"/> - <iso_3166_2_entry - code="SI-197" name="Kosanjevica na Krki"/> - <iso_3166_2_entry - code="SI-165" name="Kostel"/> - <iso_3166_2_entry - code="SI-051" name="Kozje"/> - <iso_3166_2_entry - code="SI-052" name="Kranj"/> - <iso_3166_2_entry - code="SI-053" name="Kranjska Gora"/> - <iso_3166_2_entry - code="SI-166" name="Križevci"/> - <iso_3166_2_entry - code="SI-054" name="Krško"/> - <iso_3166_2_entry - code="SI-055" name="Kungota"/> - <iso_3166_2_entry - code="SI-056" name="Kuzma"/> - <iso_3166_2_entry - code="SI-057" name="Laško"/> - <iso_3166_2_entry - code="SI-058" name="Lenart"/> - <iso_3166_2_entry - code="SI-059" name="Lendava/Lendva"/> - <iso_3166_2_entry - code="SI-060" name="Litija"/> - <iso_3166_2_entry - code="SI-061" name="Ljubljana"/> - <iso_3166_2_entry - code="SI-062" name="Ljubno"/> - <iso_3166_2_entry - code="SI-063" name="Ljutomer"/> - <iso_3166_2_entry - code="SI-208" name="Log-Dragomer"/> - <iso_3166_2_entry - code="SI-064" name="Logatec"/> - <iso_3166_2_entry - code="SI-065" name="Loška dolina"/> - <iso_3166_2_entry - code="SI-066" name="Loški Potok"/> - <iso_3166_2_entry - code="SI-167" name="Lovrenc na Pohorju"/> - <iso_3166_2_entry - code="SI-067" name="Luče"/> - <iso_3166_2_entry - code="SI-068" name="Lukovica"/> - <iso_3166_2_entry - code="SI-069" name="Majšperk"/> - <iso_3166_2_entry - code="SI-198" name="Makole"/> - <iso_3166_2_entry - code="SI-070" name="Maribor"/> - <iso_3166_2_entry - code="SI-168" name="Markovci"/> - <iso_3166_2_entry - code="SI-071" name="Medvode"/> - <iso_3166_2_entry - code="SI-072" name="Mengeš"/> - <iso_3166_2_entry - code="SI-073" name="Metlika"/> - <iso_3166_2_entry - code="SI-074" name="Mežica"/> - <iso_3166_2_entry - code="SI-169" name="Miklavž na Dravskem polju"/> - <iso_3166_2_entry - code="SI-075" name="Miren-Kostanjevica"/> - <iso_3166_2_entry - code="SI-170" name="Mirna Peč"/> - <iso_3166_2_entry - code="SI-076" name="Mislinja"/> - <iso_3166_2_entry - code="SI-199" name="Mokronog-Trebelno"/> - <iso_3166_2_entry - code="SI-077" name="Moravče"/> - <iso_3166_2_entry - code="SI-078" name="Moravske Toplice"/> - <iso_3166_2_entry - code="SI-079" name="Mozirje"/> - <iso_3166_2_entry - code="SI-080" name="Murska Sobota"/> - <iso_3166_2_entry - code="SI-081" name="Muta"/> - <iso_3166_2_entry - code="SI-082" name="Naklo"/> - <iso_3166_2_entry - code="SI-083" name="Nazarje"/> - <iso_3166_2_entry - code="SI-084" name="Nova Gorica"/> - <iso_3166_2_entry - code="SI-085" name="Novo mesto"/> - <iso_3166_2_entry - code="SI-086" name="Odranci"/> - <iso_3166_2_entry - code="SI-171" name="Oplotnica"/> - <iso_3166_2_entry - code="SI-087" name="Ormož"/> - <iso_3166_2_entry - code="SI-088" name="Osilnica"/> - <iso_3166_2_entry - code="SI-089" name="Pesnica"/> - <iso_3166_2_entry - code="SI-090" name="Piran/Pirano"/> - <iso_3166_2_entry - code="SI-091" name="Pivka"/> - <iso_3166_2_entry - code="SI-092" name="Podčetrtek"/> - <iso_3166_2_entry - code="SI-172" name="Podlehnik"/> - <iso_3166_2_entry - code="SI-093" name="Podvelka"/> - <iso_3166_2_entry - code="SI-200" name="Poljčane"/> - <iso_3166_2_entry - code="SI-173" name="Polzela"/> - <iso_3166_2_entry - code="SI-094" name="Postojna"/> - <iso_3166_2_entry - code="SI-174" name="Prebold"/> - <iso_3166_2_entry - code="SI-095" name="Preddvor"/> - <iso_3166_2_entry - code="SI-175" name="Prevalje"/> - <iso_3166_2_entry - code="SI-096" name="Ptuj"/> - <iso_3166_2_entry - code="SI-097" name="Puconci"/> - <iso_3166_2_entry - code="SI-098" name="Rače-Fram"/> - <iso_3166_2_entry - code="SI-099" name="Radeče"/> - <iso_3166_2_entry - code="SI-100" name="Radenci"/> - <iso_3166_2_entry - code="SI-101" name="Radlje ob Dravi"/> - <iso_3166_2_entry - code="SI-102" name="Radovljica"/> - <iso_3166_2_entry - code="SI-103" name="Ravne na Koroškem"/> - <iso_3166_2_entry - code="SI-176" name="Razkrižje"/> - <iso_3166_2_entry - code="SI-209" name="Rečica ob Savinji"/> - <iso_3166_2_entry - code="SI-201" name="Renče-Vogrsko"/> - <iso_3166_2_entry - code="SI-104" name="Ribnica"/> - <iso_3166_2_entry - code="SI-177" name="Ribnica na Pohorju"/> - <iso_3166_2_entry - code="SI-106" name="Rogaška Slatina"/> - <iso_3166_2_entry - code="SI-105" name="Rogašovci"/> - <iso_3166_2_entry - code="SI-107" name="Rogatec"/> - <iso_3166_2_entry - code="SI-108" name="Ruše"/> - <iso_3166_2_entry - code="SI-178" name="Selnica ob Dravi"/> - <iso_3166_2_entry - code="SI-109" name="Semič"/> - <iso_3166_2_entry - code="SI-110" name="Sevnica"/> - <iso_3166_2_entry - code="SI-111" name="Sežana"/> - <iso_3166_2_entry - code="SI-112" name="Slovenj Gradec"/> - <iso_3166_2_entry - code="SI-113" name="Slovenska Bistrica"/> - <iso_3166_2_entry - code="SI-114" name="Slovenske Konjice"/> - <iso_3166_2_entry - code="SI-179" name="Sodražica"/> - <iso_3166_2_entry - code="SI-180" name="Solčava"/> - <iso_3166_2_entry - code="SI-202" name="Središče ob Dravi"/> - <iso_3166_2_entry - code="SI-115" name="Starče"/> - <iso_3166_2_entry - code="SI-203" name="Straža"/> - <iso_3166_2_entry - code="SI-181" name="Sveta Ana"/> - <iso_3166_2_entry - code="SI-204" name="Sveta Trojica v Slovenskih Goricah"/> - <iso_3166_2_entry - code="SI-182" name="Sveta Andraž v Slovenskih Goricah"/> - <iso_3166_2_entry - code="SI-116" name="Sveti Jurij"/> - <iso_3166_2_entry - code="SI-210" name="Sveti Jurij v Slovenskih Goricah"/> - <iso_3166_2_entry - code="SI-205" name="Sveti Tomaž"/> - <iso_3166_2_entry - code="SI-033" name="Šalovci"/> - <iso_3166_2_entry - code="SI-183" name="Šempeter-Vrtojba"/> - <iso_3166_2_entry - code="SI-117" name="Šenčur"/> - <iso_3166_2_entry - code="SI-118" name="Šentilj"/> - <iso_3166_2_entry - code="SI-119" name="Šentjernej"/> - <iso_3166_2_entry - code="SI-120" name="Šentjur"/> - <iso_3166_2_entry - code="SI-211" name="Šentrupert"/> - <iso_3166_2_entry - code="SI-121" name="Škocjan"/> - <iso_3166_2_entry - code="SI-122" name="Škofja Loka"/> - <iso_3166_2_entry - code="SI-123" name="Škofljica"/> - <iso_3166_2_entry - code="SI-124" name="Šmarje pri Jelšah"/> - <iso_3166_2_entry - code="SI-206" name="Šmarjeske Topliče"/> - <iso_3166_2_entry - code="SI-125" name="Šmartno ob Paki"/> - <iso_3166_2_entry - code="SI-194" name="Šmartno pri Litiji"/> - <iso_3166_2_entry - code="SI-126" name="Šoštanj"/> - <iso_3166_2_entry - code="SI-127" name="Štore"/> - <iso_3166_2_entry - code="SI-184" name="Tabor"/> - <iso_3166_2_entry - code="SI-010" name="Tišina"/> - <iso_3166_2_entry - code="SI-128" name="Tolmin"/> - <iso_3166_2_entry - code="SI-129" name="Trbovlje"/> - <iso_3166_2_entry - code="SI-130" name="Trebnje"/> - <iso_3166_2_entry - code="SI-185" name="Trnovska vas"/> - <iso_3166_2_entry - code="SI-186" name="Trzin"/> - <iso_3166_2_entry - code="SI-131" name="Tržič"/> - <iso_3166_2_entry - code="SI-132" name="Turnišče"/> - <iso_3166_2_entry - code="SI-133" name="Velenje"/> - <iso_3166_2_entry - code="SI-187" name="Velika Polana"/> - <iso_3166_2_entry - code="SI-134" name="Velike Lašče"/> - <iso_3166_2_entry - code="SI-188" name="Veržej"/> - <iso_3166_2_entry - code="SI-135" name="Videm"/> - <iso_3166_2_entry - code="SI-136" name="Vipava"/> - <iso_3166_2_entry - code="SI-137" name="Vitanje"/> - <iso_3166_2_entry - code="SI-138" name="Vodice"/> - <iso_3166_2_entry - code="SI-139" name="Vojnik"/> - <iso_3166_2_entry - code="SI-189" name="Vransko"/> - <iso_3166_2_entry - code="SI-140" name="Vrhnika"/> - <iso_3166_2_entry - code="SI-141" name="Vuzenica"/> - <iso_3166_2_entry - code="SI-142" name="Zagorje ob Savi"/> - <iso_3166_2_entry - code="SI-143" name="Zavrč"/> - <iso_3166_2_entry - code="SI-144" name="Zreče"/> - <iso_3166_2_entry - code="SI-190" name="Žalec"/> - <iso_3166_2_entry - code="SI-146" name="Železniki"/> - <iso_3166_2_entry - code="SI-191" name="Žetale"/> - <iso_3166_2_entry - code="SI-147" name="Žiri"/> - <iso_3166_2_entry - code="SI-192" name="Žirovnica"/> - <iso_3166_2_entry - code="SI-193" name="Žužemberk"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Slovakia --> - <iso_3166_country code="SK"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="SK-BC" name="Banskobystrický kraj"/> - <iso_3166_2_entry - code="SK-BL" name="Bratislavský kraj"/> - <iso_3166_2_entry - code="SK-KI" name="Košický kraj"/> - <iso_3166_2_entry - code="SK-NJ" name="Nitriansky kraj"/> - <iso_3166_2_entry - code="SK-PV" name="Prešovský kraj"/> - <iso_3166_2_entry - code="SK-TC" name="Trenčiansky kraj"/> - <iso_3166_2_entry - code="SK-TA" name="Trnavský kraj"/> - <iso_3166_2_entry - code="SK-ZI" name="Žilinský kraj"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sierra Leone --> - <iso_3166_country code="SL"> - <iso_3166_subset type="Area"> - <iso_3166_2_entry - code="SL-W" name="Western Area (Freetown)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="SL-E" name="Eastern"/> - <iso_3166_2_entry - code="SL-N" name="Northern"/> - <iso_3166_2_entry - code="SL-S" name="Southern (Sierra Leone)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- San Marino --> - <iso_3166_country code="SM"> - <iso_3166_subset type="Municipalities"> - <iso_3166_2_entry - code="SM-01" name="Acquaviva"/> - <iso_3166_2_entry - code="SM-06" name="Borgo Maggiore"/> - <iso_3166_2_entry - code="SM-02" name="Chiesanuova"/> - <iso_3166_2_entry - code="SM-03" name="Domagnano"/> - <iso_3166_2_entry - code="SM-04" name="Faetano"/> - <iso_3166_2_entry - code="SM-05" name="Fiorentino"/> - <iso_3166_2_entry - code="SM-08" name="Montegiardino"/> - <iso_3166_2_entry - code="SM-07" name="San Marino"/> - <iso_3166_2_entry - code="SM-09" name="Serravalle"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Senegal --> - <iso_3166_country code="SN"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="SN-DK" name="Dakar"/> - <iso_3166_2_entry - code="SN-DB" name="Diourbel"/> - <iso_3166_2_entry - code="SN-FK" name="Fatick"/> - <iso_3166_2_entry - code="SN-KA" name="Kaffrine"/> - <iso_3166_2_entry - code="SN-KL" name="Kaolack"/> - <iso_3166_2_entry - code="SN-KE" name="Kédougou"/> - <iso_3166_2_entry - code="SN-KD" name="Kolda"/> - <iso_3166_2_entry - code="SN-LG" name="Louga"/> - <iso_3166_2_entry - code="SN-MT" name="Matam"/> - <iso_3166_2_entry - code="SN-SL" name="Saint-Louis"/> - <iso_3166_2_entry - code="SN-SE" name="Sédhiou"/> - <iso_3166_2_entry - code="SN-TC" name="Tambacounda"/> - <iso_3166_2_entry - code="SN-TH" name="Thiès"/> - <iso_3166_2_entry - code="SN-ZG" name="Ziguinchor"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Somalia --> - <iso_3166_country code="SO"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="SO-AW" name="Awdal"/> - <iso_3166_2_entry - code="SO-BK" name="Bakool"/> - <iso_3166_2_entry - code="SO-BN" name="Banaadir"/> - <iso_3166_2_entry - code="SO-BR" name="Bari"/> - <iso_3166_2_entry - code="SO-BY" name="Bay"/> - <iso_3166_2_entry - code="SO-GA" name="Galguduud"/> - <iso_3166_2_entry - code="SO-GE" name="Gedo"/> - <iso_3166_2_entry - code="SO-HI" name="Hiirsan"/> - <iso_3166_2_entry - code="SO-JD" name="Jubbada Dhexe"/> - <iso_3166_2_entry - code="SO-JH" name="Jubbada Hoose"/> - <iso_3166_2_entry - code="SO-MU" name="Mudug"/> - <iso_3166_2_entry - code="SO-NU" name="Nugaal"/> - <iso_3166_2_entry - code="SO-SA" name="Saneag"/> - <iso_3166_2_entry - code="SO-SD" name="Shabeellaha Dhexe"/> - <iso_3166_2_entry - code="SO-SH" name="Shabeellaha Hoose"/> - <iso_3166_2_entry - code="SO-SO" name="Sool"/> - <iso_3166_2_entry - code="SO-TO" name="Togdheer"/> - <iso_3166_2_entry - code="SO-WO" name="Woqooyi Galbeed"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Suriname --> - <iso_3166_country code="SR"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="SR-BR" name="Brokopondo"/> - <iso_3166_2_entry - code="SR-CM" name="Commewijne"/> - <iso_3166_2_entry - code="SR-CR" name="Coronie"/> - <iso_3166_2_entry - code="SR-MA" name="Marowijne"/> - <iso_3166_2_entry - code="SR-NI" name="Nickerie"/> - <iso_3166_2_entry - code="SR-PR" name="Para"/> - <iso_3166_2_entry - code="SR-PM" name="Paramaribo"/> - <iso_3166_2_entry - code="SR-SA" name="Saramacca"/> - <iso_3166_2_entry - code="SR-SI" name="Sipaliwini"/> - <iso_3166_2_entry - code="SR-WA" name="Wanica"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sao Tome and Principe --> - <iso_3166_country code="ST"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="ST-P" name="Príncipe"/> - <iso_3166_2_entry - code="ST-S" name="São Tomé"/> - </iso_3166_subset> - </iso_3166_country> - <!-- El Salvador --> - <iso_3166_country code="SV"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="SV-AH" name="Ahuachapán"/> - <iso_3166_2_entry - code="SV-CA" name="Cabañas"/> - <iso_3166_2_entry - code="SV-CU" name="Cuscatlán"/> - <iso_3166_2_entry - code="SV-CH" name="Chalatenango"/> - <iso_3166_2_entry - code="SV-LI" name="La Libertad"/> - <iso_3166_2_entry - code="SV-PA" name="La Paz"/> - <iso_3166_2_entry - code="SV-UN" name="La Unión"/> - <iso_3166_2_entry - code="SV-MO" name="Morazán"/> - <iso_3166_2_entry - code="SV-SM" name="San Miguel"/> - <iso_3166_2_entry - code="SV-SS" name="San Salvador"/> - <iso_3166_2_entry - code="SV-SA" name="Santa Ana"/> - <iso_3166_2_entry - code="SV-SV" name="San Vicente"/> - <iso_3166_2_entry - code="SV-SO" name="Sonsonate"/> - <iso_3166_2_entry - code="SV-US" name="Usulután"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Syria --> - <iso_3166_country code="SY"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="SY-HA" name="Al Hasakah"/> - <iso_3166_2_entry - code="SY-LA" name="Al Ladhiqiyah"/> - <iso_3166_2_entry - code="SY-QU" name="Al Qunaytirah"/> - <iso_3166_2_entry - code="SY-RA" name="Ar Raqqah"/> - <iso_3166_2_entry - code="SY-SU" name="As Suwayda'"/> - <iso_3166_2_entry - code="SY-DR" name="Dar'a"/> - <iso_3166_2_entry - code="SY-DY" name="Dayr az Zawr"/> - <iso_3166_2_entry - code="SY-DI" name="Dimashq"/> - <iso_3166_2_entry - code="SY-HL" name="Halab"/> - <iso_3166_2_entry - code="SY-HM" name="Hamah"/> - <iso_3166_2_entry - code="SY-HI" name="Homs"/> - <iso_3166_2_entry - code="SY-ID" name="Idlib"/> - <iso_3166_2_entry - code="SY-RD" name="Rif Dimashq"/> - <iso_3166_2_entry - code="SY-TA" name="Tartus"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Swaziland --> - <iso_3166_country code="SZ"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="SZ-HH" name="Hhohho"/> - <iso_3166_2_entry - code="SZ-LU" name="Lubombo"/> - <iso_3166_2_entry - code="SZ-MA" name="Manzini"/> - <iso_3166_2_entry - code="SZ-SH" name="Shiselweni"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Chad --> - <iso_3166_country code="TD"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TD-BA" name="Al Baṭḩah"/> - <iso_3166_2_entry - code="TD-LC" name="Al Buḩayrah"/> - <iso_3166_2_entry - code="TD-BG" name="Baḩr al Ghazāl"/> - <iso_3166_2_entry - code="TD-BO" name="Būrkū"/> - <iso_3166_2_entry - code="TD-HL" name="Ḥajjar Lamīs"/> - <iso_3166_2_entry - code="TD-EN" name="Innīdī"/> - <iso_3166_2_entry - code="TD-KA" name="Kānim"/> - <iso_3166_2_entry - code="TD-LO" name="Lūqūn al Gharbī"/> - <iso_3166_2_entry - code="TD-LR" name="Lūqūn ash Sharqī"/> - <iso_3166_2_entry - code="TD-ND" name="Madīnat Injamīnā"/> - <iso_3166_2_entry - code="TD-MA" name="Māndūl"/> - <iso_3166_2_entry - code="TD-MO" name="Māyū Kībbī al Gharbī"/> - <iso_3166_2_entry - code="TD-ME" name="Māyū Kībbī ash Sharqī"/> - <iso_3166_2_entry - code="TD-GR" name="Qīrā"/> - <iso_3166_2_entry - code="TD-SA" name="Salāmāt"/> - <iso_3166_2_entry - code="TD-MC" name="Shārī al Awsaṭ"/> - <iso_3166_2_entry - code="TD-CB" name="Shārī Bāqirmī"/> - <iso_3166_2_entry - code="TD-SI" name="Sīlā"/> - <iso_3166_2_entry - code="TD-TA" name="Tānjilī"/> - <iso_3166_2_entry - code="TD-TI" name="Tibastī"/> - <iso_3166_2_entry - code="TD-OD" name="Waddāy"/> - <iso_3166_2_entry - code="TD-WF" name="Wādī Fīrā"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Togo --> - <iso_3166_country code="TG"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TG-C" name="Région du Centre"/> - <iso_3166_2_entry - code="TG-K" name="Région de la Kara"/> - <iso_3166_2_entry - code="TG-M" name="Région Maritime"/> - <iso_3166_2_entry - code="TG-P" name="Région des Plateaux"/> - <iso_3166_2_entry - code="TG-S" name="Région des Savannes"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Thailand --> - <iso_3166_country code="TH"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="TH-10" name="Krung Thep Maha Nakhon Bangkok"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="TH-S" name="Phatthaya"/> - <iso_3166_2_entry - code="TH-37" name="Amnat Charoen"/> - <iso_3166_2_entry - code="TH-15" name="Ang Thong"/> - <iso_3166_2_entry - code="TH-31" name="Buri Ram"/> - <iso_3166_2_entry - code="TH-24" name="Chachoengsao"/> - <iso_3166_2_entry - code="TH-18" name="Chai Nat"/> - <iso_3166_2_entry - code="TH-36" name="Chaiyaphum"/> - <iso_3166_2_entry - code="TH-22" name="Chanthaburi"/> - <iso_3166_2_entry - code="TH-50" name="Chiang Mai"/> - <iso_3166_2_entry - code="TH-57" name="Chiang Rai"/> - <iso_3166_2_entry - code="TH-20" name="Chon Buri"/> - <iso_3166_2_entry - code="TH-86" name="Chumphon"/> - <iso_3166_2_entry - code="TH-46" name="Kalasin"/> - <iso_3166_2_entry - code="TH-62" name="Kamphaeng Phet"/> - <iso_3166_2_entry - code="TH-71" name="Kanchanaburi"/> - <iso_3166_2_entry - code="TH-40" name="Khon Kaen"/> - <iso_3166_2_entry - code="TH-81" name="Krabi"/> - <iso_3166_2_entry - code="TH-52" name="Lampang"/> - <iso_3166_2_entry - code="TH-51" name="Lamphun"/> - <iso_3166_2_entry - code="TH-42" name="Loei"/> - <iso_3166_2_entry - code="TH-16" name="Lop Buri"/> - <iso_3166_2_entry - code="TH-58" name="Mae Hong Son"/> - <iso_3166_2_entry - code="TH-44" name="Maha Sarakham"/> - <iso_3166_2_entry - code="TH-49" name="Mukdahan"/> - <iso_3166_2_entry - code="TH-26" name="Nakhon Nayok"/> - <iso_3166_2_entry - code="TH-73" name="Nakhon Pathom"/> - <iso_3166_2_entry - code="TH-48" name="Nakhon Phanom"/> - <iso_3166_2_entry - code="TH-30" name="Nakhon Ratchasima"/> - <iso_3166_2_entry - code="TH-60" name="Nakhon Sawan"/> - <iso_3166_2_entry - code="TH-80" name="Nakhon Si Thammarat"/> - <iso_3166_2_entry - code="TH-55" name="Nan"/> - <iso_3166_2_entry - code="TH-96" name="Narathiwat"/> - <iso_3166_2_entry - code="TH-39" name="Nong Bua Lam Phu"/> - <iso_3166_2_entry - code="TH-43" name="Nong Khai"/> - <iso_3166_2_entry - code="TH-12" name="Nonthaburi"/> - <iso_3166_2_entry - code="TH-13" name="Pathum Thani"/> - <iso_3166_2_entry - code="TH-94" name="Pattani"/> - <iso_3166_2_entry - code="TH-82" name="Phangnga"/> - <iso_3166_2_entry - code="TH-93" name="Phatthalung"/> - <iso_3166_2_entry - code="TH-56" name="Phayao"/> - <iso_3166_2_entry - code="TH-67" name="Phetchabun"/> - <iso_3166_2_entry - code="TH-76" name="Phetchaburi"/> - <iso_3166_2_entry - code="TH-66" name="Phichit"/> - <iso_3166_2_entry - code="TH-65" name="Phitsanulok"/> - <iso_3166_2_entry - code="TH-54" name="Phrae"/> - <iso_3166_2_entry - code="TH-14" name="Phra Nakhon Si Ayutthaya"/> - <iso_3166_2_entry - code="TH-83" name="Phuket"/> - <iso_3166_2_entry - code="TH-25" name="Prachin Buri"/> - <iso_3166_2_entry - code="TH-77" name="Prachuap Khiri Khan"/> - <iso_3166_2_entry - code="TH-85" name="Ranong"/> - <iso_3166_2_entry - code="TH-70" name="Ratchaburi"/> - <iso_3166_2_entry - code="TH-21" name="Rayong"/> - <iso_3166_2_entry - code="TH-45" name="Roi Et"/> - <iso_3166_2_entry - code="TH-27" name="Sa Kaeo"/> - <iso_3166_2_entry - code="TH-47" name="Sakon Nakhon"/> - <iso_3166_2_entry - code="TH-11" name="Samut Prakan"/> - <iso_3166_2_entry - code="TH-74" name="Samut Sakhon"/> - <iso_3166_2_entry - code="TH-75" name="Samut Songkhram"/> - <iso_3166_2_entry - code="TH-19" name="Saraburi"/> - <iso_3166_2_entry - code="TH-91" name="Satun"/> - <iso_3166_2_entry - code="TH-17" name="Sing Buri"/> - <iso_3166_2_entry - code="TH-33" name="Si Sa Ket"/> - <iso_3166_2_entry - code="TH-90" name="Songkhla"/> - <iso_3166_2_entry - code="TH-64" name="Sukhothai"/> - <iso_3166_2_entry - code="TH-72" name="Suphan Buri"/> - <iso_3166_2_entry - code="TH-84" name="Surat Thani"/> - <iso_3166_2_entry - code="TH-32" name="Surin"/> - <iso_3166_2_entry - code="TH-63" name="Tak"/> - <iso_3166_2_entry - code="TH-92" name="Trang"/> - <iso_3166_2_entry - code="TH-23" name="Trat"/> - <iso_3166_2_entry - code="TH-34" name="Ubon Ratchathani"/> - <iso_3166_2_entry - code="TH-41" name="Udon Thani"/> - <iso_3166_2_entry - code="TH-61" name="Uthai Thani"/> - <iso_3166_2_entry - code="TH-53" name="Uttaradit"/> - <iso_3166_2_entry - code="TH-95" name="Yala"/> - <iso_3166_2_entry - code="TH-35" name="Yasothon"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tajikistan --> - <iso_3166_country code="TJ"> - <iso_3166_subset type="Autonomous region"> - <iso_3166_2_entry - code="TJ-GB" name="Gorno-Badakhshan"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TJ-KT" name="Khatlon"/> - <iso_3166_2_entry - code="TJ-SU" name="Sughd"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Timor Leste --> - <iso_3166_country code="TL"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="TL-AL" name="Aileu"/> - <iso_3166_2_entry - code="TL-AN" name="Ainaro"/> - <iso_3166_2_entry - code="TL-BA" name="Baucau"/> - <iso_3166_2_entry - code="TL-BO" name="Bobonaro"/> - <iso_3166_2_entry - code="TL-CO" name="Cova Lima"/> - <iso_3166_2_entry - code="TL-DI" name="Dili"/> - <iso_3166_2_entry - code="TL-ER" name="Ermera"/> - <iso_3166_2_entry - code="TL-LA" name="Lautem"/> - <iso_3166_2_entry - code="TL-LI" name="Liquiça"/> - <iso_3166_2_entry - code="TL-MT" name="Manatuto"/> - <iso_3166_2_entry - code="TL-MF" name="Manufahi"/> - <iso_3166_2_entry - code="TL-OE" name="Oecussi"/> - <iso_3166_2_entry - code="TL-VI" name="Viqueque"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Turkmenistan --> - <iso_3166_country code="TM"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TM-A" name="Ahal"/> - <iso_3166_2_entry - code="TM-B" name="Balkan"/> - <iso_3166_2_entry - code="TM-D" name="Daşoguz"/> - <iso_3166_2_entry - code="TM-L" name="Lebap"/> - <iso_3166_2_entry - code="TM-M" name="Mary"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="TM-S" name="Aşgabat"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tunisia --> - <iso_3166_country code="TN"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="TN-31" name="Béja"/> - <iso_3166_2_entry - code="TN-13" name="Ben Arous"/> - <iso_3166_2_entry - code="TN-23" name="Bizerte"/> - <iso_3166_2_entry - code="TN-81" name="Gabès"/> - <iso_3166_2_entry - code="TN-71" name="Gafsa"/> - <iso_3166_2_entry - code="TN-32" name="Jendouba"/> - <iso_3166_2_entry - code="TN-41" name="Kairouan"/> - <iso_3166_2_entry - code="TN-42" name="Kasserine"/> - <iso_3166_2_entry - code="TN-73" name="Kebili"/> - <iso_3166_2_entry - code="TN-12" name="L'Ariana"/> - <iso_3166_2_entry - code="TN-33" name="Le Kef"/> - <iso_3166_2_entry - code="TN-53" name="Mahdia"/> - <iso_3166_2_entry - code="TN-14" name="La Manouba"/> - <iso_3166_2_entry - code="TN-82" name="Medenine"/> - <iso_3166_2_entry - code="TN-52" name="Monastir"/> - <iso_3166_2_entry - code="TN-21" name="Nabeul"/> - <iso_3166_2_entry - code="TN-61" name="Sfax"/> - <iso_3166_2_entry - code="TN-43" name="Sidi Bouzid"/> - <iso_3166_2_entry - code="TN-34" name="Siliana"/> - <iso_3166_2_entry - code="TN-51" name="Sousse"/> - <iso_3166_2_entry - code="TN-83" name="Tataouine"/> - <iso_3166_2_entry - code="TN-72" name="Tozeur"/> - <iso_3166_2_entry - code="TN-11" name="Tunis"/> - <iso_3166_2_entry - code="TN-22" name="Zaghouan"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tonga --> - <iso_3166_country code="TO"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="TO-01" name="'Eua"/> - <iso_3166_2_entry - code="TO-02" name="Ha'apai"/> - <iso_3166_2_entry - code="TO-03" name="Niuas"/> - <iso_3166_2_entry - code="TO-04" name="Tongatapu"/> - <iso_3166_2_entry - code="TO-05" name="Vava'u"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Turkey --> - <iso_3166_country code="TR"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="TR-01" name="Adana"/> - <iso_3166_2_entry - code="TR-02" name="Adıyaman"/> - <iso_3166_2_entry - code="TR-03" name="Afyon"/> - <iso_3166_2_entry - code="TR-04" name="Ağrı"/> - <iso_3166_2_entry - code="TR-68" name="Aksaray"/> - <iso_3166_2_entry - code="TR-05" name="Amasya"/> - <iso_3166_2_entry - code="TR-06" name="Ankara"/> - <iso_3166_2_entry - code="TR-07" name="Antalya"/> - <iso_3166_2_entry - code="TR-75" name="Ardahan"/> - <iso_3166_2_entry - code="TR-08" name="Artvin"/> - <iso_3166_2_entry - code="TR-09" name="Aydın"/> - <iso_3166_2_entry - code="TR-10" name="Balıkesir"/> - <iso_3166_2_entry - code="TR-74" name="Bartın"/> - <iso_3166_2_entry - code="TR-72" name="Batman"/> - <iso_3166_2_entry - code="TR-69" name="Bayburt"/> - <iso_3166_2_entry - code="TR-11" name="Bilecik"/> - <iso_3166_2_entry - code="TR-12" name="Bingöl"/> - <iso_3166_2_entry - code="TR-13" name="Bitlis"/> - <iso_3166_2_entry - code="TR-14" name="Bolu"/> - <iso_3166_2_entry - code="TR-15" name="Burdur"/> - <iso_3166_2_entry - code="TR-16" name="Bursa"/> - <iso_3166_2_entry - code="TR-17" name="Çanakkale"/> - <iso_3166_2_entry - code="TR-18" name="Çankırı"/> - <iso_3166_2_entry - code="TR-19" name="Çorum"/> - <iso_3166_2_entry - code="TR-20" name="Denizli"/> - <iso_3166_2_entry - code="TR-21" name="Diyarbakır"/> - <iso_3166_2_entry - code="TR-81" name="Düzce"/> - <iso_3166_2_entry - code="TR-22" name="Edirne"/> - <iso_3166_2_entry - code="TR-23" name="Elazığ"/> - <iso_3166_2_entry - code="TR-24" name="Erzincan"/> - <iso_3166_2_entry - code="TR-25" name="Erzurum"/> - <iso_3166_2_entry - code="TR-26" name="Eskişehir"/> - <iso_3166_2_entry - code="TR-27" name="Gaziantep"/> - <iso_3166_2_entry - code="TR-28" name="Giresun"/> - <iso_3166_2_entry - code="TR-29" name="Gümüşhane"/> - <iso_3166_2_entry - code="TR-30" name="Hakkâri"/> - <iso_3166_2_entry - code="TR-31" name="Hatay"/> - <iso_3166_2_entry - code="TR-76" name="Iğdır"/> - <iso_3166_2_entry - code="TR-32" name="Isparta"/> - <iso_3166_2_entry - code="TR-33" name="İçel"/> - <iso_3166_2_entry - code="TR-34" name="İstanbul"/> - <iso_3166_2_entry - code="TR-35" name="İzmir"/> - <iso_3166_2_entry - code="TR-46" name="Kahramanmaraş"/> - <iso_3166_2_entry - code="TR-78" name="Karabük"/> - <iso_3166_2_entry - code="TR-70" name="Karaman"/> - <iso_3166_2_entry - code="TR-36" name="Kars"/> - <iso_3166_2_entry - code="TR-37" name="Kastamonu"/> - <iso_3166_2_entry - code="TR-38" name="Kayseri"/> - <iso_3166_2_entry - code="TR-71" name="Kırıkkale"/> - <iso_3166_2_entry - code="TR-39" name="Kırklareli"/> - <iso_3166_2_entry - code="TR-40" name="Kırşehir"/> - <iso_3166_2_entry - code="TR-79" name="Kilis"/> - <iso_3166_2_entry - code="TR-41" name="Kocaeli"/> - <iso_3166_2_entry - code="TR-42" name="Konya"/> - <iso_3166_2_entry - code="TR-43" name="Kütahya"/> - <iso_3166_2_entry - code="TR-44" name="Malatya"/> - <iso_3166_2_entry - code="TR-45" name="Manisa"/> - <iso_3166_2_entry - code="TR-47" name="Mardin"/> - <iso_3166_2_entry - code="TR-48" name="Muğla"/> - <iso_3166_2_entry - code="TR-49" name="Muş"/> - <iso_3166_2_entry - code="TR-50" name="Nevşehir"/> - <iso_3166_2_entry - code="TR-51" name="Niğde"/> - <iso_3166_2_entry - code="TR-52" name="Ordu"/> - <iso_3166_2_entry - code="TR-80" name="Osmaniye"/> - <iso_3166_2_entry - code="TR-53" name="Rize"/> - <iso_3166_2_entry - code="TR-54" name="Sakarya"/> - <iso_3166_2_entry - code="TR-55" name="Samsun"/> - <iso_3166_2_entry - code="TR-56" name="Siirt"/> - <iso_3166_2_entry - code="TR-57" name="Sinop"/> - <iso_3166_2_entry - code="TR-58" name="Sivas"/> - <iso_3166_2_entry - code="TR-63" name="Şanlıurfa"/> - <iso_3166_2_entry - code="TR-73" name="Şırnak"/> - <iso_3166_2_entry - code="TR-59" name="Tekirdağ"/> - <iso_3166_2_entry - code="TR-60" name="Tokat"/> - <iso_3166_2_entry - code="TR-61" name="Trabzon"/> - <iso_3166_2_entry - code="TR-62" name="Tunceli"/> - <iso_3166_2_entry - code="TR-64" name="Uşak"/> - <iso_3166_2_entry - code="TR-65" name="Van"/> - <iso_3166_2_entry - code="TR-77" name="Yalova"/> - <iso_3166_2_entry - code="TR-66" name="Yozgat"/> - <iso_3166_2_entry - code="TR-67" name="Zonguldak"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Trinidad and Tobago --> - <iso_3166_country code="TT"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TT-CTT" name="Couva-Tabaquite-Talparo"/> - <iso_3166_2_entry - code="TT-DMN" name="Diego Martin"/> - <iso_3166_2_entry - code="TT-ETO" name="Eastern Tobago"/> - <iso_3166_2_entry - code="TT-PED" name="Penal-Debe"/> - <iso_3166_2_entry - code="TT-PRT" name="Princes Town"/> - <iso_3166_2_entry - code="TT-RCM" name="Rio Claro-Mayaro"/> - <iso_3166_2_entry - code="TT-SGE" name="Sangre Grande"/> - <iso_3166_2_entry - code="TT-SJL" name="San Juan-Laventille"/> - <iso_3166_2_entry - code="TT-SIP" name="Siparia"/> - <iso_3166_2_entry - code="TT-TUP" name="Tunapuna-Piarco"/> - <iso_3166_2_entry - code="TT-WTO" name="Western Tobago"/> - </iso_3166_subset> - <iso_3166_subset type="Borough"> - <iso_3166_2_entry - code="TT-ARI" name="Arima"/> - <iso_3166_2_entry - code="TT-CHA" name="Chaguanas"/> - <iso_3166_2_entry - code="TT-PTF" name="Point Fortin"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="TT-POS" name="Port of Spain"/> - <iso_3166_2_entry - code="TT-SFO" name="San Fernando"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tuvalu --> - <iso_3166_country code="TV"> - <iso_3166_subset type="Town council"> - <iso_3166_2_entry - code="TV-FUN" name="Funafuti"/> - </iso_3166_subset> - <iso_3166_subset type="Island council"> - <iso_3166_2_entry - code="TV-NMG" name="Nanumanga"/> - <iso_3166_2_entry - code="TV-NMA" name="Nanumea"/> - <iso_3166_2_entry - code="TV-NIT" name="Niutao"/> - <iso_3166_2_entry - code="TV-NIU" name="Nui"/> - <iso_3166_2_entry - code="TV-NKF" name="Nukufetau"/> - <iso_3166_2_entry - code="TV-NKL" name="Nukulaelae"/> - <iso_3166_2_entry - code="TV-VAI" name="Vaitupu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Taiwan --> - <iso_3166_country code="TW"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="TW-CHA" name="Changhua"/> - <iso_3166_2_entry - code="TW-CYQ" name="Chiayi"/> - <iso_3166_2_entry - code="TW-HSQ" name="Hsinchu"/> - <iso_3166_2_entry - code="TW-HUA" name="Hualien"/> - <iso_3166_2_entry - code="TW-ILA" name="Ilan"/> - <iso_3166_2_entry - code="TW-KHQ" name="Kaohsiung"/> - <iso_3166_2_entry - code="TW-MIA" name="Miaoli"/> - <iso_3166_2_entry - code="TW-NAN" name="Nantou"/> - <iso_3166_2_entry - code="TW-PEN" name="Penghu"/> - <iso_3166_2_entry - code="TW-PIF" name="Pingtung"/> - <iso_3166_2_entry - code="TW-TXQ" name="Taichung"/> - <iso_3166_2_entry - code="TW-TNQ" name="Tainan"/> - <iso_3166_2_entry - code="TW-TPQ" name="Taipei"/> - <iso_3166_2_entry - code="TW-TTT" name="Taitung"/> - <iso_3166_2_entry - code="TW-TAO" name="Taoyuan"/> - <iso_3166_2_entry - code="TW-YUN" name="Yunlin"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="TW-CYI" name="Chiay City"/> - <iso_3166_2_entry - code="TW-HSZ" name="Hsinchui City"/> - <iso_3166_2_entry - code="TW-KEE" name="Keelung City"/> - <iso_3166_2_entry - code="TW-TXG" name="Taichung City"/> - <iso_3166_2_entry - code="TW-TNN" name="Tainan City"/> - </iso_3166_subset> - <iso_3166_subset type="Special Municipality"> - <iso_3166_2_entry - code="TW-KHH" name="Kaohsiung City"/> - <iso_3166_2_entry - code="TW-TPE" name="Taipei City"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tanzania --> - <iso_3166_country code="TZ"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TZ-01" name="Arusha"/> - <iso_3166_2_entry - code="TZ-02" name="Dar-es-Salaam"/> - <iso_3166_2_entry - code="TZ-03" name="Dodoma"/> - <iso_3166_2_entry - code="TZ-04" name="Iringa"/> - <iso_3166_2_entry - code="TZ-05" name="Kagera"/> - <iso_3166_2_entry - code="TZ-06" name="Kaskazini Pemba"/> - <iso_3166_2_entry - code="TZ-07" name="Kaskazini Unguja"/> - <iso_3166_2_entry - code="TZ-08" name="Kigoma"/> - <iso_3166_2_entry - code="TZ-09" name="Kilimanjaro"/> - <iso_3166_2_entry - code="TZ-10" name="Kusini Pemba"/> - <iso_3166_2_entry - code="TZ-11" name="Kusini Unguja"/> - <iso_3166_2_entry - code="TZ-12" name="Lindi"/> - <iso_3166_2_entry - code="TZ-26" name="Manyara"/> - <iso_3166_2_entry - code="TZ-13" name="Mara"/> - <iso_3166_2_entry - code="TZ-14" name="Mbeya"/> - <iso_3166_2_entry - code="TZ-15" name="Mjini Magharibi"/> - <iso_3166_2_entry - code="TZ-16" name="Morogoro"/> - <iso_3166_2_entry - code="TZ-17" name="Mtwara"/> - <iso_3166_2_entry - code="TZ-18" name="Mwanza"/> - <iso_3166_2_entry - code="TZ-19" name="Pwani"/> - <iso_3166_2_entry - code="TZ-20" name="Rukwa"/> - <iso_3166_2_entry - code="TZ-21" name="Ruvuma"/> - <iso_3166_2_entry - code="TZ-22" name="Shinyanga"/> - <iso_3166_2_entry - code="TZ-23" name="Singida"/> - <iso_3166_2_entry - code="TZ-24" name="Tabora"/> - <iso_3166_2_entry - code="TZ-25" name="Tanga"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ukraine --> - <iso_3166_country code="UA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="UA-71" name="Cherkas'ka Oblast'"/> - <iso_3166_2_entry - code="UA-74" name="Chernihivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-77" name="Chernivets'ka Oblast'"/> - <iso_3166_2_entry - code="UA-12" name="Dnipropetrovs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-14" name="Donets'ka Oblast'"/> - <iso_3166_2_entry - code="UA-26" name="Ivano-Frankivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-63" name="Kharkivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-65" name="Khersons'ka Oblast'"/> - <iso_3166_2_entry - code="UA-68" name="Khmel'nyts'ka Oblast'"/> - <iso_3166_2_entry - code="UA-35" name="Kirovohrads'ka Oblast'"/> - <iso_3166_2_entry - code="UA-32" name="Kyïvs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-09" name="Luhans'ka Oblast'"/> - <iso_3166_2_entry - code="UA-46" name="L'vivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-48" name="Mykolaïvs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-51" name="Odes'ka Oblast'"/> - <iso_3166_2_entry - code="UA-53" name="Poltavs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-56" name="Rivnens'ka Oblast'"/> - <iso_3166_2_entry - code="UA-59" name="Sums 'ka Oblast'"/> - <iso_3166_2_entry - code="UA-61" name="Ternopil's'ka Oblast'"/> - <iso_3166_2_entry - code="UA-05" name="Vinnyts'ka Oblast'"/> - <iso_3166_2_entry - code="UA-07" name="Volyns'ka Oblast'"/> - <iso_3166_2_entry - code="UA-21" name="Zakarpats'ka Oblast'"/> - <iso_3166_2_entry - code="UA-23" name="Zaporiz'ka Oblast'"/> - <iso_3166_2_entry - code="UA-18" name="Zhytomyrs'ka Oblast'"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous republic"> - <iso_3166_2_entry - code="UA-43" name="Respublika Krym"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="UA-30" name="Kyïvs'ka mis'ka rada"/> - <iso_3166_2_entry - code="UA-40" name="Sevastopol"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Uganda --> - <iso_3166_country code="UG"> - <iso_3166_subset type="Geographical region"> - <iso_3166_2_entry - code="UG-C" name="Central"/> - <iso_3166_2_entry - code="UG-E" name="Eastern"/> - <iso_3166_2_entry - code="UG-N" name="Northern"/> - <iso_3166_2_entry - code="UG-W" name="Western"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="UG-317" name="Abim" parent="N"/> - <iso_3166_2_entry - code="UG-301" name="Adjumani" parent="N"/> - <iso_3166_2_entry - code="UG-314" name="Amolatar" parent="N"/> - <iso_3166_2_entry - code="UG-216" name="Amuria" parent="E"/> - <iso_3166_2_entry - code="UG-319" name="Amuru" parent="N"/> - <iso_3166_2_entry - code="UG-302" name="Apac" parent="N"/> - <iso_3166_2_entry - code="UG-303" name="Arua" parent="N"/> - <iso_3166_2_entry - code="UG-217" name="Budaka" parent="E"/> - <iso_3166_2_entry - code="UG-223" name="Bududa" parent="E"/> - <iso_3166_2_entry - code="UG-201" name="Bugiri" parent="E"/> - <iso_3166_2_entry - code="UG-224" name="Bukedea" parent="E"/> - <iso_3166_2_entry - code="UG-218" name="Bukwa" parent="E"/> - <iso_3166_2_entry - code="UG-419" name="Buliisa" parent="W"/> - <iso_3166_2_entry - code="UG-401" name="Bundibugyo" parent="W"/> - <iso_3166_2_entry - code="UG-402" name="Bushenyi" parent="W"/> - <iso_3166_2_entry - code="UG-202" name="Busia" parent="E"/> - <iso_3166_2_entry - code="UG-219" name="Butaleja" parent="E"/> - <iso_3166_2_entry - code="UG-318" name="Dokolo" parent="N"/> - <iso_3166_2_entry - code="UG-304" name="Gulu" parent="N"/> - <iso_3166_2_entry - code="UG-403" name="Hoima" parent="W"/> - <iso_3166_2_entry - code="UG-416" name="Ibanda" parent="W"/> - <iso_3166_2_entry - code="UG-203" name="Iganga" parent="E"/> - <iso_3166_2_entry - code="UG-417" name="Isingiro" parent="W"/> - <iso_3166_2_entry - code="UG-204" name="Jinja" parent="E"/> - <iso_3166_2_entry - code="UG-315" name="Kaabong" parent="N"/> - <iso_3166_2_entry - code="UG-404" name="Kabale" parent="W"/> - <iso_3166_2_entry - code="UG-405" name="Kabarole" parent="W"/> - <iso_3166_2_entry - code="UG-213" name="Kaberamaido" parent="E"/> - <iso_3166_2_entry - code="UG-101" name="Kalangala" parent="C"/> - <iso_3166_2_entry - code="UG-220" name="Kaliro" parent="E"/> - <iso_3166_2_entry - code="UG-102" name="Kampala" parent="C"/> - <iso_3166_2_entry - code="UG-205" name="Kamuli" parent="E"/> - <iso_3166_2_entry - code="UG-413" name="Kamwenge" parent="W"/> - <iso_3166_2_entry - code="UG-414" name="Kanungu" parent="W"/> - <iso_3166_2_entry - code="UG-206" name="Kapchorwa" parent="E"/> - <iso_3166_2_entry - code="UG-406" name="Kasese" parent="W"/> - <iso_3166_2_entry - code="UG-207" name="Katakwi" parent="E"/> - <iso_3166_2_entry - code="UG-112" name="Kayunga" parent="C"/> - <iso_3166_2_entry - code="UG-407" name="Kibaale" parent="W"/> - <iso_3166_2_entry - code="UG-103" name="Kiboga" parent="C"/> - <iso_3166_2_entry - code="UG-418" name="Kiruhura" parent="W"/> - <iso_3166_2_entry - code="UG-408" name="Kisoro" parent="W"/> - <iso_3166_2_entry - code="UG-305" name="Kitgum" parent="N"/> - <iso_3166_2_entry - code="UG-316" name="Koboko" parent="N"/> - <iso_3166_2_entry - code="UG-306" name="Kotido" parent="N"/> - <iso_3166_2_entry - code="UG-208" name="Kumi" parent="E"/> - <iso_3166_2_entry - code="UG-415" name="Kyenjojo" parent="W"/> - <iso_3166_2_entry - code="UG-307" name="Lira" parent="N"/> - <iso_3166_2_entry - code="UG-104" name="Luwero" parent="C"/> - <iso_3166_2_entry - code="UG-116" name="Lyantonde" parent="C"/> - <iso_3166_2_entry - code="UG-221" name="Manafwa" parent="E"/> - <iso_3166_2_entry - code="UG-320" name="Maracha" parent="N"/> - <iso_3166_2_entry - code="UG-105" name="Masaka" parent="C"/> - <iso_3166_2_entry - code="UG-409" name="Masindi" parent="W"/> - <iso_3166_2_entry - code="UG-214" name="Mayuge" parent="E"/> - <iso_3166_2_entry - code="UG-209" name="Mbale" parent="E"/> - <iso_3166_2_entry - code="UG-410" name="Mbarara" parent="W"/> - <iso_3166_2_entry - code="UG-114" name="Mityana" parent="C"/> - <iso_3166_2_entry - code="UG-308" name="Moroto" parent="N"/> - <iso_3166_2_entry - code="UG-309" name="Moyo" parent="N"/> - <iso_3166_2_entry - code="UG-106" name="Mpigi" parent="C"/> - <iso_3166_2_entry - code="UG-107" name="Mubende" parent="C"/> - <iso_3166_2_entry - code="UG-108" name="Mukono" parent="C"/> - <iso_3166_2_entry - code="UG-311" name="Nakapiripirit" parent="N"/> - <iso_3166_2_entry - code="UG-115" name="Nakaseke" parent="C"/> - <iso_3166_2_entry - code="UG-109" name="Nakasongola" parent="C"/> - <iso_3166_2_entry - code="UG-222" name="Namutumba" parent="E"/> - <iso_3166_2_entry - code="UG-310" name="Nebbi" parent="N"/> - <iso_3166_2_entry - code="UG-411" name="Ntungamo" parent="W"/> - <iso_3166_2_entry - code="UG-321" name="Oyam" parent="N"/> - <iso_3166_2_entry - code="UG-312" name="Pader" parent="N"/> - <iso_3166_2_entry - code="UG-210" name="Pallisa" parent="E"/> - <iso_3166_2_entry - code="UG-110" name="Rakai" parent="C"/> - <iso_3166_2_entry - code="UG-412" name="Rukungiri" parent="W"/> - <iso_3166_2_entry - code="UG-111" name="Sembabule" parent="C"/> - <iso_3166_2_entry - code="UG-215" name="Sironko" parent="E"/> - <iso_3166_2_entry - code="UG-211" name="Soroti" parent="E"/> - <iso_3166_2_entry - code="UG-212" name="Tororo" parent="E"/> - <iso_3166_2_entry - code="UG-113" name="Wakiso" parent="C"/> - <iso_3166_2_entry - code="UG-313" name="Yumbe" parent="N"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United States Minor Outlying Islands --> - <iso_3166_country code="UM"> - <iso_3166_subset type="Territory"> - <iso_3166_2_entry - code="UM-81" name="Baker Island"/> - <iso_3166_2_entry - code="UM-84" name="Howland Island"/> - <iso_3166_2_entry - code="UM-86" name="Jarvis Island"/> - <iso_3166_2_entry - code="UM-67" name="Johnston Atoll"/> - <iso_3166_2_entry - code="UM-89" name="Kingman Reef"/> - <iso_3166_2_entry - code="UM-71" name="Midway Islands"/> - <iso_3166_2_entry - code="UM-76" name="Navassa Island"/> - <iso_3166_2_entry - code="UM-95" name="Palmyra Atoll"/> - <iso_3166_2_entry - code="UM-79" name="Wake Island"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United States --> - <iso_3166_country code="US"> - <iso_3166_subset type="State"> - <!-- US ISO 3166-2 system (from one example) appears to be based on USPS State --> - <!-- and territory codes, which follow: --> - <!-- Note US-UM: Outlying Islands have their own subregion in 'UM' --> - <iso_3166_2_entry - code="US-AL" name="Alabama"/> - <iso_3166_2_entry - code="US-AK" name="Alaska"/> - <iso_3166_2_entry - code="US-AZ" name="Arizona"/> - <iso_3166_2_entry - code="US-AR" name="Arkansas"/> - <iso_3166_2_entry - code="US-CA" name="California"/> - <iso_3166_2_entry - code="US-CO" name="Colorado"/> - <iso_3166_2_entry - code="US-CT" name="Connecticut"/> - <iso_3166_2_entry - code="US-DE" name="Delaware"/> - <iso_3166_2_entry - code="US-FL" name="Florida"/> - <iso_3166_2_entry - code="US-GA" name="Georgia"/> - <iso_3166_2_entry - code="US-HI" name="Hawaii"/> - <iso_3166_2_entry - code="US-ID" name="Idaho"/> - <iso_3166_2_entry - code="US-IL" name="Illinois"/> - <iso_3166_2_entry - code="US-IN" name="Indiana"/> - <iso_3166_2_entry - code="US-IA" name="Iowa"/> - <iso_3166_2_entry - code="US-KS" name="Kansas"/> - <iso_3166_2_entry - code="US-KY" name="Kentucky"/> - <iso_3166_2_entry - code="US-LA" name="Louisiana"/> - <iso_3166_2_entry - code="US-ME" name="Maine"/> - <iso_3166_2_entry - code="US-MD" name="Maryland"/> - <iso_3166_2_entry - code="US-MA" name="Massachusetts"/> - <iso_3166_2_entry - code="US-MI" name="Michigan"/> - <iso_3166_2_entry - code="US-MN" name="Minnesota"/> - <iso_3166_2_entry - code="US-MS" name="Mississippi"/> - <iso_3166_2_entry - code="US-MO" name="Missouri"/> - <iso_3166_2_entry - code="US-MT" name="Montana"/> - <iso_3166_2_entry - code="US-NE" name="Nebraska"/> - <iso_3166_2_entry - code="US-NV" name="Nevada"/> - <iso_3166_2_entry - code="US-NH" name="New Hampshire"/> - <iso_3166_2_entry - code="US-NJ" name="New Jersey"/> - <iso_3166_2_entry - code="US-NM" name="New Mexico"/> - <iso_3166_2_entry - code="US-NY" name="New York"/> - <iso_3166_2_entry - code="US-NC" name="North Carolina"/> - <iso_3166_2_entry - code="US-ND" name="North Dakota"/> - <iso_3166_2_entry - code="US-OH" name="Ohio"/> - <iso_3166_2_entry - code="US-OK" name="Oklahoma"/> - <iso_3166_2_entry - code="US-OR" name="Oregon"/> - <iso_3166_2_entry - code="US-PA" name="Pennsylvania"/> - <iso_3166_2_entry - code="US-RI" name="Rhode Island"/> - <iso_3166_2_entry - code="US-SC" name="South Carolina"/> - <iso_3166_2_entry - code="US-SD" name="South Dakota"/> - <iso_3166_2_entry - code="US-TN" name="Tennessee"/> - <iso_3166_2_entry - code="US-TX" name="Texas"/> - <iso_3166_2_entry - code="US-UT" name="Utah"/> - <iso_3166_2_entry - code="US-VT" name="Vermont"/> - <iso_3166_2_entry - code="US-VA" name="Virginia"/> - <iso_3166_2_entry - code="US-WA" name="Washington"/> - <iso_3166_2_entry - code="US-WV" name="West Virginia"/> - <iso_3166_2_entry - code="US-WI" name="Wisconsin"/> - <iso_3166_2_entry - code="US-WY" name="Wyoming"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="US-DC" name="District of Columbia"/> - </iso_3166_subset> - <iso_3166_subset type="Outlying area"> - <iso_3166_2_entry - code="US-AS" name="American Samoa"/> - <iso_3166_2_entry - code="US-GU" name="Guam"/> - <iso_3166_2_entry - code="US-MP" name="Northern Mariana Islands"/> - <iso_3166_2_entry - code="US-PR" name="Puerto Rico"/> - <iso_3166_2_entry - code="US-UM" name="United States Minor Outlying Islands"/> - <iso_3166_2_entry - code="US-VI" name="Virgin Islands"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Uruguay --> - <iso_3166_country code="UY"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="UY-AR" name="Artigas"/> - <iso_3166_2_entry - code="UY-CA" name="Canelones"/> - <iso_3166_2_entry - code="UY-CL" name="Cerro Largo"/> - <iso_3166_2_entry - code="UY-CO" name="Colonia"/> - <iso_3166_2_entry - code="UY-DU" name="Durazno"/> - <iso_3166_2_entry - code="UY-FS" name="Flores"/> - <iso_3166_2_entry - code="UY-FD" name="Florida"/> - <iso_3166_2_entry - code="UY-LA" name="Lavalleja"/> - <iso_3166_2_entry - code="UY-MA" name="Maldonado"/> - <iso_3166_2_entry - code="UY-MO" name="Montevideo"/> - <iso_3166_2_entry - code="UY-PA" name="Paysandú"/> - <iso_3166_2_entry - code="UY-RN" name="Río Negro"/> - <iso_3166_2_entry - code="UY-RV" name="Rivera"/> - <iso_3166_2_entry - code="UY-RO" name="Rocha"/> - <iso_3166_2_entry - code="UY-SA" name="Salto"/> - <iso_3166_2_entry - code="UY-SJ" name="San José"/> - <iso_3166_2_entry - code="UY-SO" name="Soriano"/> - <iso_3166_2_entry - code="UY-TA" name="Tacuarembó"/> - <iso_3166_2_entry - code="UY-TT" name="Treinta y Tres"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Uzbekistan --> - <iso_3166_country code="UZ"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="UZ-TK" name="Toshkent"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="UZ-AN" name="Andijon"/> - <iso_3166_2_entry - code="UZ-BU" name="Buxoro"/> - <iso_3166_2_entry - code="UZ-FA" name="Farg'ona"/> - <iso_3166_2_entry - code="UZ-JI" name="Jizzax"/> - <iso_3166_2_entry - code="UZ-NG" name="Namangan"/> - <iso_3166_2_entry - code="UZ-NW" name="Navoiy"/> - <iso_3166_2_entry - code="UZ-QA" name="Qashqadaryo"/> - <iso_3166_2_entry - code="UZ-SA" name="Samarqand"/> - <iso_3166_2_entry - code="UZ-SI" name="Sirdaryo"/> - <iso_3166_2_entry - code="UZ-SU" name="Surxondaryo"/> - <iso_3166_2_entry - code="UZ-TO" name="Toshkent"/> - <iso_3166_2_entry - code="UZ-XO" name="Xorazm"/> - </iso_3166_subset> - <iso_3166_subset type="Republic"> - <iso_3166_2_entry - code="UZ-QR" name="Qoraqalpog'iston Respublikasi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Vincent and the Grenadines --> - <iso_3166_country code="VC"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="VC-01" name="Charlotte"/> - <iso_3166_2_entry - code="VC-06" name="Grenadines"/> - <iso_3166_2_entry - code="VC-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="VC-03" name="Saint David"/> - <iso_3166_2_entry - code="VC-04" name="Saint George"/> - <iso_3166_2_entry - code="VC-05" name="Saint Patrick"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Venezuela --> - <iso_3166_country code="VE"> - <iso_3166_subset type="Federal Dependency"> - <iso_3166_2_entry - code="VE-W" name="Dependencias Federales"/> - </iso_3166_subset> - <iso_3166_subset type="Federal District"> - <iso_3166_2_entry - code="VE-A" name="Distrito Federal"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="VE-Z" name="Amazonas"/> - <iso_3166_2_entry - code="VE-B" name="Anzoátegui"/> - <iso_3166_2_entry - code="VE-C" name="Apure"/> - <iso_3166_2_entry - code="VE-D" name="Aragua"/> - <iso_3166_2_entry - code="VE-E" name="Barinas"/> - <iso_3166_2_entry - code="VE-F" name="Bolívar"/> - <iso_3166_2_entry - code="VE-G" name="Carabobo"/> - <iso_3166_2_entry - code="VE-H" name="Cojedes"/> - <iso_3166_2_entry - code="VE-Y" name="Delta Amacuro"/> - <iso_3166_2_entry - code="VE-I" name="Falcón"/> - <iso_3166_2_entry - code="VE-J" name="Guárico"/> - <iso_3166_2_entry - code="VE-K" name="Lara"/> - <iso_3166_2_entry - code="VE-L" name="Mérida"/> - <iso_3166_2_entry - code="VE-M" name="Miranda"/> - <iso_3166_2_entry - code="VE-N" name="Monagas"/> - <iso_3166_2_entry - code="VE-O" name="Nueva Esparta"/> - <iso_3166_2_entry - code="VE-P" name="Portuguesa"/> - <iso_3166_2_entry - code="VE-R" name="Sucre"/> - <iso_3166_2_entry - code="VE-S" name="Táchira"/> - <iso_3166_2_entry - code="VE-T" name="Trujillo"/> - <iso_3166_2_entry - code="VE-X" name="Vargas"/> - <iso_3166_2_entry - code="VE-U" name="Yaracuy"/> - <iso_3166_2_entry - code="VE-V" name="Zulia"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Viet Nam --> - <iso_3166_country code="VN"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="VN-44" name="An Giang"/> - <iso_3166_2_entry - code="VN-43" name="Bà Rịa - Vũng Tàu"/> - <iso_3166_2_entry - code="VN-53" name="Bắc Kạn"/> - <iso_3166_2_entry - code="VN-54" name="Bắc Giang"/> - <iso_3166_2_entry - code="VN-55" name="Bạc Liêu"/> - <iso_3166_2_entry - code="VN-56" name="Bắc Ninh"/> - <iso_3166_2_entry - code="VN-50" name="Bến Tre"/> - <iso_3166_2_entry - code="VN-31" name="Bình Định"/> - <iso_3166_2_entry - code="VN-57" name="Bình Dương"/> - <iso_3166_2_entry - code="VN-58" name="Bình Phước"/> - <iso_3166_2_entry - code="VN-40" name="Bình Thuận"/> - <iso_3166_2_entry - code="VN-59" name="Cà Mau"/> - <iso_3166_2_entry - code="VN-48" name="Cần Thơ"/> - <iso_3166_2_entry - code="VN-04" name="Cao Bằng"/> - <iso_3166_2_entry - code="VN-60" name="Đà Nẵng, thành phố"/> - <iso_3166_2_entry - code="VN-33" name="Đắc Lắk"/> - <iso_3166_2_entry - code="VN-72" name="Đắk Nông"/> - <iso_3166_2_entry - code="VN-71" name="Điện Biên"/> - <iso_3166_2_entry - code="VN-39" name="Đồng Nai"/> - <iso_3166_2_entry - code="VN-45" name="Đồng Tháp"/> - <iso_3166_2_entry - code="VN-30" name="Gia Lai"/> - <iso_3166_2_entry - code="VN-03" name="Hà Giang"/> - <iso_3166_2_entry - code="VN-63" name="Hà Nam"/> - <iso_3166_2_entry - code="VN-64" name="Hà Nội, thủ đô"/> - <iso_3166_2_entry - code="VN-15" name="Hà Tây"/> - <iso_3166_2_entry - code="VN-23" name="Hà Tỉnh"/> - <iso_3166_2_entry - code="VN-61" name="Hải Duong"/> - <iso_3166_2_entry - code="VN-62" name="Hải Phòng, thành phố"/> - <iso_3166_2_entry - code="VN-73" name="Hậu Giang"/> - <iso_3166_2_entry - code="VN-14" name="Hoà Bình"/> - <iso_3166_2_entry - code="VN-65" name="Hồ Chí Minh, thành phố [Sài Gòn]"/> - <iso_3166_2_entry - code="VN-66" name="Hưng Yên"/> - <iso_3166_2_entry - code="VN-34" name="Khánh Hòa"/> - <iso_3166_2_entry - code="VN-47" name="Kiên Giang"/> - <iso_3166_2_entry - code="VN-28" name="Kon Tum"/> - <iso_3166_2_entry - code="VN-01" name="Lai Châu"/> - <iso_3166_2_entry - code="VN-35" name="Lâm Đồng"/> - <iso_3166_2_entry - code="VN-09" name="Lạng Sơn"/> - <iso_3166_2_entry - code="VN-02" name="Lào Cai"/> - <iso_3166_2_entry - code="VN-41" name="Long An"/> - <iso_3166_2_entry - code="VN-67" name="Nam Định"/> - <iso_3166_2_entry - code="VN-22" name="Nghệ An"/> - <iso_3166_2_entry - code="VN-18" name="Ninh Bình"/> - <iso_3166_2_entry - code="VN-36" name="Ninh Thuận"/> - <iso_3166_2_entry - code="VN-68" name="Phú Thọ"/> - <iso_3166_2_entry - code="VN-32" name="Phú Yên"/> - <iso_3166_2_entry - code="VN-24" name="Quảng Bình"/> - <iso_3166_2_entry - code="VN-27" name="Quảng Nam"/> - <iso_3166_2_entry - code="VN-29" name="Quảng Ngãi"/> - <iso_3166_2_entry - code="VN-13" name="Quảng Ninh"/> - <iso_3166_2_entry - code="VN-25" name="Quảng Trị"/> - <iso_3166_2_entry - code="VN-52" name="Sóc Trăng"/> - <iso_3166_2_entry - code="VN-05" name="Sơn La"/> - <iso_3166_2_entry - code="VN-37" name="Tây Ninh"/> - <iso_3166_2_entry - code="VN-20" name="Thái Bình"/> - <iso_3166_2_entry - code="VN-69" name="Thái Nguyên"/> - <iso_3166_2_entry - code="VN-21" name="Thanh Hóa"/> - <iso_3166_2_entry - code="VN-26" name="Thừa Thiên-Huế"/> - <iso_3166_2_entry - code="VN-46" name="Tiền Giang"/> - <iso_3166_2_entry - code="VN-51" name="Trà Vinh"/> - <iso_3166_2_entry - code="VN-07" name="Tuyên Quang"/> - <iso_3166_2_entry - code="VN-49" name="Vĩnh Long"/> - <iso_3166_2_entry - code="VN-70" name="Vĩnh Phúc"/> - <iso_3166_2_entry - code="VN-06" name="Yên Bái"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Vanuatu --> - <iso_3166_country code="VU"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="VU-MAP" name="Malampa"/> - <iso_3166_2_entry - code="VU-PAM" name="Pénama"/> - <iso_3166_2_entry - code="VU-SAM" name="Sanma"/> - <iso_3166_2_entry - code="VU-SEE" name="Shéfa"/> - <iso_3166_2_entry - code="VU-TAE" name="Taféa"/> - <iso_3166_2_entry - code="VU-TOB" name="Torba"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Samoa --> - <iso_3166_country code="WS"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="WS-AA" name="A'ana"/> - <iso_3166_2_entry - code="WS-AL" name="Aiga-i-le-Tai"/> - <iso_3166_2_entry - code="WS-AT" name="Atua"/> - <iso_3166_2_entry - code="WS-FA" name="Fa'asaleleaga"/> - <iso_3166_2_entry - code="WS-GE" name="Gaga'emauga"/> - <iso_3166_2_entry - code="WS-GI" name="Gagaifomauga"/> - <iso_3166_2_entry - code="WS-PA" name="Palauli"/> - <iso_3166_2_entry - code="WS-SA" name="Satupa'itea"/> - <iso_3166_2_entry - code="WS-TU" name="Tuamasaga"/> - <iso_3166_2_entry - code="WS-VF" name="Va'a-o-Fonoti"/> - <iso_3166_2_entry - code="WS-VS" name="Vaisigano"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Yemen --> - <iso_3166_country code="YE"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="YE-AB" name="Abyān"/> - <iso_3166_2_entry - code="YE-AD" name="'Adan"/> - <iso_3166_2_entry - code="YE-DA" name="Aḑ Ḑāli‘"/> - <iso_3166_2_entry - code="YE-BA" name="Al Bayḑā'"/> - <iso_3166_2_entry - code="YE-MU" name="Al Ḩudaydah"/> - <iso_3166_2_entry - code="YE-JA" name="Al Jawf"/> - <iso_3166_2_entry - code="YE-MR" name="Al Mahrah"/> - <iso_3166_2_entry - code="YE-MW" name="Al Maḩwīt"/> - <iso_3166_2_entry - code="YE-AM" name="'Amrān"/> - <iso_3166_2_entry - code="YE-DH" name="Dhamār"/> - <iso_3166_2_entry - code="YE-HD" name="Ḩaḑramawt"/> - <iso_3166_2_entry - code="YE-HJ" name="Ḩajjah"/> - <iso_3166_2_entry - code="YE-IB" name="Ibb"/> - <iso_3166_2_entry - code="YE-LA" name="Laḩij"/> - <iso_3166_2_entry - code="YE-MA" name="Ma'rib"/> - <iso_3166_2_entry - code="YE-RA" name="Raymah"/> - <iso_3166_2_entry - code="YE-SD" name="Şa'dah"/> - <iso_3166_2_entry - code="YE-SN" name="Şan'ā'"/> - <iso_3166_2_entry - code="YE-SH" name="Shabwah"/> - <iso_3166_2_entry - code="YE-TA" name="Tā'izz"/> - </iso_3166_subset> - </iso_3166_country> - <!-- South Africa --> - <iso_3166_country code="ZA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ZA-EC" name="Eastern Cape"/> - <iso_3166_2_entry - code="ZA-FS" name="Free State"/> - <iso_3166_2_entry - code="ZA-GT" name="Gauteng"/> - <iso_3166_2_entry - code="ZA-NL" name="Kwazulu-Natal"/> - <iso_3166_2_entry - code="ZA-LP" name="Limpopo"/> - <iso_3166_2_entry - code="ZA-MP" name="Mpumalanga"/> - <iso_3166_2_entry - code="ZA-NC" name="Northern Cape"/> - <iso_3166_2_entry - code="ZA-NW" name="North-West (South Africa)"/> - <iso_3166_2_entry - code="ZA-WC" name="Western Cape"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Zambia --> - <iso_3166_country code="ZM"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ZM-02" name="Central"/> - <iso_3166_2_entry - code="ZM-08" name="Copperbelt"/> - <iso_3166_2_entry - code="ZM-03" name="Eastern"/> - <iso_3166_2_entry - code="ZM-04" name="Luapula"/> - <iso_3166_2_entry - code="ZM-09" name="Lusaka"/> - <iso_3166_2_entry - code="ZM-05" name="Northern"/> - <iso_3166_2_entry - code="ZM-06" name="North-Western"/> - <iso_3166_2_entry - code="ZM-07" name="Southern (Zambia)"/> - <iso_3166_2_entry - code="ZM-01" name="Western"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Zimbabwe --> - <iso_3166_country code="ZW"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="ZW-BU" name="Bulawayo"/> - <iso_3166_2_entry - code="ZW-HA" name="Harare"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ZW-MA" name="Manicaland"/> - <iso_3166_2_entry - code="ZW-MC" name="Mashonaland Central"/> - <iso_3166_2_entry - code="ZW-ME" name="Mashonaland East"/> - <iso_3166_2_entry - code="ZW-MW" name="Mashonaland West"/> - <iso_3166_2_entry - code="ZW-MV" name="Masvingo"/> - <iso_3166_2_entry - code="ZW-MN" name="Matabeleland North"/> - <iso_3166_2_entry - code="ZW-MS" name="Matabeleland South"/> - <iso_3166_2_entry - code="ZW-MI" name="Midlands"/> - </iso_3166_subset> - </iso_3166_country> + <!-- Andorra --> + <iso_3166_country code="AD"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="AD-07" name="Andorra la Vella"/> + <iso_3166_2_entry + code="AD-02" name="Canillo"/> + <iso_3166_2_entry + code="AD-03" name="Encamp"/> + <iso_3166_2_entry + code="AD-08" name="Escaldes-Engordany"/> + <iso_3166_2_entry + code="AD-04" name="La Massana"/> + <iso_3166_2_entry + code="AD-05" name="Ordino"/> + <iso_3166_2_entry + code="AD-06" name="Sant Julià de Lòria"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United Arab Emirates --> + <iso_3166_country code="AE"> + <iso_3166_subset type="Emirate"> + <iso_3166_2_entry + code="AE-AZ" name="Abū Ȥaby [Abu Dhabi]"/> + <iso_3166_2_entry + code="AE-AJ" name="'Ajmān"/> + <iso_3166_2_entry + code="AE-FU" name="Al Fujayrah"/> + <iso_3166_2_entry + code="AE-SH" name="Ash Shāriqah"/> + <iso_3166_2_entry + code="AE-DU" name="Dubayy"/> + <iso_3166_2_entry + code="AE-RK" name="Ra’s al Khaymah"/> + <iso_3166_2_entry + code="AE-UQ" name="Umm al Qaywayn"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Afghanistan --> + <iso_3166_country code="AF"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AF-BDS" name="Badakhshān"/> + <iso_3166_2_entry + code="AF-BDG" name="Bādghīs"/> + <iso_3166_2_entry + code="AF-BGL" name="Baghlān"/> + <iso_3166_2_entry + code="AF-BAL" name="Balkh"/> + <iso_3166_2_entry + code="AF-BAM" name="Bāmīān"/> + <iso_3166_2_entry + code="AF-DAY" name="Dāykondī"/> + <iso_3166_2_entry + code="AF-FRA" name="Farāh"/> + <iso_3166_2_entry + code="AF-FYB" name="Fāryāb"/> + <iso_3166_2_entry + code="AF-GHA" name="Ghaznī"/> + <iso_3166_2_entry + code="AF-GHO" name="Ghowr"/> + <iso_3166_2_entry + code="AF-HEL" name="Helmand"/> + <iso_3166_2_entry + code="AF-HER" name="Herāt"/> + <iso_3166_2_entry + code="AF-JOW" name="Jowzjān"/> + <iso_3166_2_entry + code="AF-KAB" name="Kābul [Kābol]"/> + <iso_3166_2_entry + code="AF-KAN" name="Kandahār"/> + <iso_3166_2_entry + code="AF-KAP" name="Kāpīsā"/> + <iso_3166_2_entry + code="AF-KHO" name="Khowst"/> + <iso_3166_2_entry + code="AF-KNR" name="Konar [Kunar]"/> + <iso_3166_2_entry + code="AF-KDZ" name="Kondoz [Kunduz]"/> + <iso_3166_2_entry + code="AF-LAG" name="Laghmān"/> + <iso_3166_2_entry + code="AF-LOW" name="Lowgar"/> + <iso_3166_2_entry + code="AF-NAN" name="Nangrahār [Nangarhār]"/> + <iso_3166_2_entry + code="AF-NIM" name="Nīmrūz"/> + <iso_3166_2_entry + code="AF-NUR" name="Nūrestān"/> + <iso_3166_2_entry + code="AF-ORU" name="Orūzgān [Urūzgān]"/> + <iso_3166_2_entry + code="AF-PAN" name="Panjshīr"/> + <iso_3166_2_entry + code="AF-PIA" name="Paktīā"/> + <iso_3166_2_entry + code="AF-PKA" name="Paktīkā"/> + <iso_3166_2_entry + code="AF-PAR" name="Parwān"/> + <iso_3166_2_entry + code="AF-SAM" name="Samangān"/> + <iso_3166_2_entry + code="AF-SAR" name="Sar-e Pol"/> + <iso_3166_2_entry + code="AF-TAK" name="Takhār"/> + <iso_3166_2_entry + code="AF-WAR" name="Wardak [Wardag]"/> + <iso_3166_2_entry + code="AF-ZAB" name="Zābol [Zābul]"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Antigua and Barbuda --> + <iso_3166_country code="AG"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="AG-03" name="Saint George"/> + <iso_3166_2_entry + code="AG-04" name="Saint John"/> + <iso_3166_2_entry + code="AG-05" name="Saint Mary"/> + <iso_3166_2_entry + code="AG-06" name="Saint Paul"/> + <iso_3166_2_entry + code="AG-07" name="Saint Peter"/> + <iso_3166_2_entry + code="AG-08" name="Saint Philip"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="AG-10" name="Barbuda"/> + <iso_3166_2_entry + code="AG-11" name="Redonda"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Albania --> + <iso_3166_country code="AL"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="AL-01" name="Berat"/> + <iso_3166_2_entry + code="AL-09" name="Dibër"/> + <iso_3166_2_entry + code="AL-02" name="Durrës"/> + <iso_3166_2_entry + code="AL-03" name="Elbasan"/> + <iso_3166_2_entry + code="AL-04" name="Fier"/> + <iso_3166_2_entry + code="AL-05" name="Gjirokastër"/> + <iso_3166_2_entry + code="AL-06" name="Korçë"/> + <iso_3166_2_entry + code="AL-07" name="Kukës"/> + <iso_3166_2_entry + code="AL-08" name="Lezhë"/> + <iso_3166_2_entry + code="AL-10" name="Shkodër"/> + <iso_3166_2_entry + code="AL-11" name="Tiranë"/> + <iso_3166_2_entry + code="AL-12" name="Vlorë"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="AL-BR" name="Berat" parent="01"/> + <iso_3166_2_entry + code="AL-BU" name="Bulqizë" parent="09"/> + <iso_3166_2_entry + code="AL-DL" name="Delvinë" parent="12"/> + <iso_3166_2_entry + code="AL-DV" name="Devoll" parent="06"/> + <iso_3166_2_entry + code="AL-DI" name="Dibër" parent="09"/> + <iso_3166_2_entry + code="AL-DR" name="Durrës" parent="02"/> + <iso_3166_2_entry + code="AL-EL" name="Elbasan" parent="03"/> + <iso_3166_2_entry + code="AL-FR" name="Fier" parent="04"/> + <iso_3166_2_entry + code="AL-GR" name="Gramsh" parent="03"/> + <iso_3166_2_entry + code="AL-GJ" name="Gjirokastër" parent="05"/> + <iso_3166_2_entry + code="AL-HA" name="Has" parent="07"/> + <iso_3166_2_entry + code="AL-KA" name="Kavajë" parent="11"/> + <iso_3166_2_entry + code="AL-ER" name="Kolonjë" parent="06"/> + <iso_3166_2_entry + code="AL-KO" name="Korçë" parent="06"/> + <iso_3166_2_entry + code="AL-KR" name="Krujë" parent="02"/> + <iso_3166_2_entry + code="AL-KC" name="Kuçovë" parent="01"/> + <iso_3166_2_entry + code="AL-KU" name="Kukës" parent="07"/> + <iso_3166_2_entry + code="AL-KB" name="Kurbin" parent="08"/> + <iso_3166_2_entry + code="AL-LE" name="Lezhë" parent="08"/> + <iso_3166_2_entry + code="AL-LB" name="Librazhd" parent="03"/> + <iso_3166_2_entry + code="AL-LU" name="Lushnjë" parent="04"/> + <iso_3166_2_entry + code="AL-MM" name="Malësi e Madhe" parent="10"/> + <iso_3166_2_entry + code="AL-MK" name="Mallakastër" parent="04"/> + <iso_3166_2_entry + code="AL-MT" name="Mat" parent="09"/> + <iso_3166_2_entry + code="AL-MR" name="Mirditë" parent="08"/> + <iso_3166_2_entry + code="AL-PQ" name="Peqin" parent="03"/> + <iso_3166_2_entry + code="AL-PR" name="Përmet" parent="05"/> + <iso_3166_2_entry + code="AL-PG" name="Pogradec" parent="06"/> + <iso_3166_2_entry + code="AL-PU" name="Pukë" parent="10"/> + <iso_3166_2_entry + code="AL-SR" name="Sarandë" parent="12"/> + <iso_3166_2_entry + code="AL-SK" name="Skrapar" parent="01"/> + <iso_3166_2_entry + code="AL-SH" name="Shkodër" parent="10"/> + <iso_3166_2_entry + code="AL-TE" name="Tepelenë" parent="05"/> + <iso_3166_2_entry + code="AL-TR" name="Tiranë" parent="11"/> + <iso_3166_2_entry + code="AL-TP" name="Tropojë" parent="07"/> + <iso_3166_2_entry + code="AL-VL" name="Vlorë" parent="12"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Armenia --> + <iso_3166_country code="AM"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AM-ER" name="Erevan"/> + <iso_3166_2_entry + code="AM-AG" name="Aragacotn"/> + <iso_3166_2_entry + code="AM-AR" name="Ararat"/> + <iso_3166_2_entry + code="AM-AV" name="Armavir"/> + <iso_3166_2_entry + code="AM-GR" name="Gegarkunik'"/> + <iso_3166_2_entry + code="AM-KT" name="Kotayk'"/> + <iso_3166_2_entry + code="AM-LO" name="Lory"/> + <iso_3166_2_entry + code="AM-SH" name="Sirak"/> + <iso_3166_2_entry + code="AM-SU" name="Syunik'"/> + <iso_3166_2_entry + code="AM-TV" name="Tavus"/> + <iso_3166_2_entry + code="AM-VD" name="Vayoc Jor"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Angola --> + <iso_3166_country code="AO"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AO-BGO" name="Bengo"/> + <iso_3166_2_entry + code="AO-BGU" name="Benguela"/> + <iso_3166_2_entry + code="AO-BIE" name="Bié"/> + <iso_3166_2_entry + code="AO-CAB" name="Cabinda"/> + <iso_3166_2_entry + code="AO-CCU" name="Cuando-Cubango"/> + <iso_3166_2_entry + code="AO-CNO" name="Cuanza Norte"/> + <iso_3166_2_entry + code="AO-CUS" name="Cuanza Sul"/> + <iso_3166_2_entry + code="AO-CNN" name="Cunene"/> + <iso_3166_2_entry + code="AO-HUA" name="Huambo"/> + <iso_3166_2_entry + code="AO-HUI" name="Huíla"/> + <iso_3166_2_entry + code="AO-LUA" name="Luanda"/> + <iso_3166_2_entry + code="AO-LNO" name="Lunda Norte"/> + <iso_3166_2_entry + code="AO-LSU" name="Lunda Sul"/> + <iso_3166_2_entry + code="AO-MAL" name="Malange"/> + <iso_3166_2_entry + code="AO-MOX" name="Moxico"/> + <iso_3166_2_entry + code="AO-NAM" name="Namibe"/> + <iso_3166_2_entry + code="AO-UIG" name="Uíge"/> + <iso_3166_2_entry + code="AO-ZAI" name="Zaire"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Argentina --> + <iso_3166_country code="AR"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="AR-C" name="Ciudad Autónoma de Buenos Aires"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AR-B" name="Buenos Aires"/> + <iso_3166_2_entry + code="AR-K" name="Catamarca"/> + <iso_3166_2_entry + code="AR-X" name="Cordoba"/> + <iso_3166_2_entry + code="AR-W" name="Corrientes"/> + <iso_3166_2_entry + code="AR-H" name="Chaco"/> + <iso_3166_2_entry + code="AR-U" name="Chubut"/> + <iso_3166_2_entry + code="AR-E" name="Entre Rios"/> + <iso_3166_2_entry + code="AR-P" name="Formosa"/> + <iso_3166_2_entry + code="AR-Y" name="Jujuy"/> + <iso_3166_2_entry + code="AR-L" name="La Pampa"/> + <iso_3166_2_entry + code="AR-M" name="Mendoza"/> + <iso_3166_2_entry + code="AR-N" name="Misiones"/> + <iso_3166_2_entry + code="AR-Q" name="Neuquen"/> + <iso_3166_2_entry + code="AR-R" name="Rio Negro"/> + <iso_3166_2_entry + code="AR-A" name="Salta"/> + <iso_3166_2_entry + code="AR-J" name="San Juan"/> + <iso_3166_2_entry + code="AR-D" name="San Luis"/> + <iso_3166_2_entry + code="AR-Z" name="Santa Cruz"/> + <iso_3166_2_entry + code="AR-S" name="Santa Fe"/> + <iso_3166_2_entry + code="AR-G" name="Santiago del Estero"/> + <iso_3166_2_entry + code="AR-V" name="Tierra del Fuego"/> + <iso_3166_2_entry + code="AR-T" name="Tucuman"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Austria --> + <iso_3166_country code="AT"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="AT-1" name="Burgenland"/> + <iso_3166_2_entry + code="AT-2" name="Kärnten"/> + <iso_3166_2_entry + code="AT-3" name="Niederösterreich"/> + <iso_3166_2_entry + code="AT-4" name="Oberösterreich"/> + <iso_3166_2_entry + code="AT-5" name="Salzburg"/> + <iso_3166_2_entry + code="AT-6" name="Steiermark"/> + <iso_3166_2_entry + code="AT-7" name="Tirol"/> + <iso_3166_2_entry + code="AT-8" name="Vorarlberg"/> + <iso_3166_2_entry + code="AT-9" name="Wien"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Australia --> + <iso_3166_country code="AU"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="AU-NSW" name="New South Wales"/> + <iso_3166_2_entry + code="AU-QLD" name="Queensland"/> + <iso_3166_2_entry + code="AU-SA" name="South Australia"/> + <iso_3166_2_entry + code="AU-TAS" name="Tasmania"/> + <iso_3166_2_entry + code="AU-VIC" name="Victoria"/> + <iso_3166_2_entry + code="AU-WA" name="Western Australia"/> + </iso_3166_subset> + <iso_3166_subset type="Territory"> + <iso_3166_2_entry + code="AU-ACT" name="Australian Capital Territory"/> + <iso_3166_2_entry + code="AU-NT" name="Northern Territory"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Azerbaijan --> + <iso_3166_country code="AZ"> + <iso_3166_subset type="Autonomous republic"> + <iso_3166_2_entry + code="AZ NX" name="Naxçıvan"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="AZ-AB" name="Əli Bayramlı"/> + <iso_3166_2_entry + code="AZ-BA" name="Bakı"/> + <iso_3166_2_entry + code="AZ-GA" name="Gəncə"/> + <iso_3166_2_entry + code="AZ-LA" name="Lənkəran"/> + <iso_3166_2_entry + code="AZ-MI" name="Mingəçevir"/> + <iso_3166_2_entry + code="AZ-NA" name="Naftalan"/> + <iso_3166_2_entry + code="AZ-SA" name="Şəki"/> + <iso_3166_2_entry + code="AZ-SM" name="Sumqayıt"/> + <iso_3166_2_entry + code="AZ-SS" name="Şuşa"/> + <iso_3166_2_entry + code="AZ-XA" name="Xankəndi"/> + <iso_3166_2_entry + code="AZ-YE" name="Yevlax"/> + </iso_3166_subset> + <iso_3166_subset type="Rayon"> + <iso_3166_2_entry + code="AZ-ABS" name="Abşeron"/> + <iso_3166_2_entry + code="AZ-AGC" name="Ağcabədi"/> + <iso_3166_2_entry + code="AZ-AGM" name="Ağdam"/> + <iso_3166_2_entry + code="AZ-AGS" name="Ağdaş"/> + <iso_3166_2_entry + code="AZ-AGA" name="Ağstafa"/> + <iso_3166_2_entry + code="AZ-AGU" name="Ağsu"/> + <iso_3166_2_entry + code="AZ-AST" name="Astara"/> + <iso_3166_2_entry + code="AZ-BAB" name="Babək" parent="NX"/> + <iso_3166_2_entry + code="AZ-BAL" name="Balakən"/> + <iso_3166_2_entry + code="AZ-BAR" name="Bərdə"/> + <iso_3166_2_entry + code="AZ-BEY" name="Beyləqan"/> + <iso_3166_2_entry + code="AZ-BIL" name="Biləsuvar"/> + <iso_3166_2_entry + code="AZ-CAB" name="Cəbrayıl"/> + <iso_3166_2_entry + code="AZ-CAL" name="Cəlilabab"/> + <iso_3166_2_entry + code="AZ-CUL" name="Culfa" parent="NX"/> + <iso_3166_2_entry + code="AZ-DAS" name="Daşkəsən"/> + <iso_3166_2_entry + code="AZ-DAV" name="Dəvəçi"/> + <iso_3166_2_entry + code="AZ-FUZ" name="Füzuli"/> + <iso_3166_2_entry + code="AZ-GAD" name="Gədəbəy"/> + <iso_3166_2_entry + code="AZ-GOR" name="Goranboy"/> + <iso_3166_2_entry + code="AZ-GOY" name="Göyçay"/> + <iso_3166_2_entry + code="AZ-HAC" name="Hacıqabul"/> + <iso_3166_2_entry + code="AZ-IMI" name="İmişli"/> + <iso_3166_2_entry + code="AZ-ISM" name="İsmayıllı"/> + <iso_3166_2_entry + code="AZ-KAL" name="Kəlbəcər"/> + <iso_3166_2_entry + code="AZ-KUR" name="Kürdəmir"/> + <iso_3166_2_entry + code="AZ-LAC" name="Laçın"/> + <iso_3166_2_entry + code="AZ-LAN" name="Lənkəran"/> + <iso_3166_2_entry + code="AZ-LER" name="Lerik"/> + <iso_3166_2_entry + code="AZ-MAS" name="Masallı"/> + <iso_3166_2_entry + code="AZ-NEF" name="Neftçala"/> + <iso_3166_2_entry + code="AZ-OGU" name="Oğuz"/> + <iso_3166_2_entry + code="AZ-ORD" name="Ordubad" parent="NX"/> + <iso_3166_2_entry + code="AZ-QAB" name="Qəbələ"/> + <iso_3166_2_entry + code="AZ-QAX" name="Qax"/> + <iso_3166_2_entry + code="AZ-QAZ" name="Qazax"/> + <iso_3166_2_entry + code="AZ-QOB" name="Qobustan"/> + <iso_3166_2_entry + code="AZ-QBA" name="Quba"/> + <iso_3166_2_entry + code="AZ-QBI" name="Qubadlı"/> + <iso_3166_2_entry + code="AZ-QUS" name="Qusar"/> + <iso_3166_2_entry + code="AZ-SAT" name="Saatlı"/> + <iso_3166_2_entry + code="AZ-SAB" name="Sabirabad"/> + <iso_3166_2_entry + code="AZ-SAD" name="Sədərək" parent="NX"/> + <iso_3166_2_entry + code="AZ-SAH" name="Şahbuz" parent="NX"/> + <iso_3166_2_entry + code="AZ-SAK" name="Şəki"/> + <iso_3166_2_entry + code="AZ-SAL" name="Salyan"/> + <iso_3166_2_entry + code="AZ-SMI" name="Şamaxı"/> + <iso_3166_2_entry + code="AZ-SKR" name="Şəmkir"/> + <iso_3166_2_entry + code="AZ-SMX" name="Samux"/> + <iso_3166_2_entry + code="AZ-SAR" name="Şərur" parent="NX"/> + <iso_3166_2_entry + code="AZ-SIY" name="Siyəzən"/> + <iso_3166_2_entry + code="AZ-SUS" name="Şuşa"/> + <iso_3166_2_entry + code="AZ-TAR" name="Tərtər"/> + <iso_3166_2_entry + code="AZ-TOV" name="Tovuz"/> + <iso_3166_2_entry + code="AZ-UCA" name="Ucar"/> + <iso_3166_2_entry + code="AZ-XAC" name="Xaçmaz"/> + <iso_3166_2_entry + code="AZ-XAN" name="Xanlar"/> + <iso_3166_2_entry + code="AZ-XIZ" name="Xızı"/> + <iso_3166_2_entry + code="AZ-XCI" name="Xocalı"/> + <iso_3166_2_entry + code="AZ-XVD" name="Xocavənd"/> + <iso_3166_2_entry + code="AZ-YAR" name="Yardımlı"/> + <iso_3166_2_entry + code="AZ-YEV" name="Yevlax"/> + <iso_3166_2_entry + code="AZ-ZAN" name="Zəngilan"/> + <iso_3166_2_entry + code="AZ-ZAQ" name="Zaqatala"/> + <iso_3166_2_entry + code="AZ-ZAR" name="Zərdab"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bosnia-Herzegovina --> + <iso_3166_country code="BA"> + <iso_3166_subset type="Entity"> + <iso_3166_2_entry + code="BA-BIH" name="Federacija Bosne i Hercegovine"/> + <iso_3166_2_entry + code="BA-SRP" name="Republika Srpska"/> + </iso_3166_subset> + <iso_3166_subset type="Canton"> + <iso_3166_2_entry + code="BA-05" name="Bosansko-podrinjski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-07" name="Hercegovačko-neretvanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-10" name="Kanton br. 10 (Livanjski kanton)" parent="BIH"/> + <iso_3166_2_entry + code="BA-09" name="Kanton Sarajevo" parent="BIH"/> + <iso_3166_2_entry + code="BA-02" name="Posavski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-06" name="Srednjobosanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-03" name="Tuzlanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-01" name="Unsko-sanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-08" name="Zapadnohercegovački kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-04" name="Zeničko-dobojski kanton" parent="BIH"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BA-BRC" name="Brčko distrikt"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Barbados --> + <iso_3166_country code="BB"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="BB-01" name="Christ Church"/> + <iso_3166_2_entry + code="BB-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="BB-03" name="Saint George"/> + <iso_3166_2_entry + code="BB-04" name="Saint James"/> + <iso_3166_2_entry + code="BB-05" name="Saint John"/> + <iso_3166_2_entry + code="BB-06" name="Saint Joseph"/> + <iso_3166_2_entry + code="BB-07" name="Saint Lucy"/> + <iso_3166_2_entry + code="BB-08" name="Saint Michael"/> + <iso_3166_2_entry + code="BB-09" name="Saint Peter"/> + <iso_3166_2_entry + code="BB-10" name="Saint Philip"/> + <iso_3166_2_entry + code="BB-11" name="Saint Thomas"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bangladesh --> + <iso_3166_country code="BD"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="BD 1" name="Barisal bibhag"/> + <iso_3166_2_entry + code="BD 2" name="Chittagong bibhag"/> + <iso_3166_2_entry + code="BD 3" name="Dhaka bibhag"/> + <iso_3166_2_entry + code="BD 4" name="Khulna bibhag"/> + <iso_3166_2_entry + code="BD 5" name="Rajshahi bibhag"/> + <iso_3166_2_entry + code="BD 6" name="Sylhet bibhag"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BD-05" name="Bagerhat zila" parent="4"/> + <iso_3166_2_entry + code="BD-01" name="Bandarban zila" parent="2"/> + <iso_3166_2_entry + code="BD-02" name="Barguna zila" parent="1"/> + <iso_3166_2_entry + code="BD-06" name="Barisal zila" parent="1"/> + <iso_3166_2_entry + code="BD-07" name="Bhola zila" parent="1"/> + <iso_3166_2_entry + code="BD-03" name="Bogra zila" parent="5"/> + <iso_3166_2_entry + code="BD-04" name="Brahmanbaria zila" parent="2"/> + <iso_3166_2_entry + code="BD-09" name="Chandpur zila" parent="2"/> + <iso_3166_2_entry + code="BD-10" name="Chittagong zila" parent="2"/> + <iso_3166_2_entry + code="BD-12" name="Chuadanga zila" parent="4"/> + <iso_3166_2_entry + code="BD-08" name="Comilla zila" parent="2"/> + <iso_3166_2_entry + code="BD-11" name="Cox's Bazar zila" parent="2"/> + <iso_3166_2_entry + code="BD-13" name="Dhaka zila" parent="3"/> + <iso_3166_2_entry + code="BD-14" name="Dinajpur zila" parent="5"/> + <iso_3166_2_entry + code="BD-15" name="Faridpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-16" name="Feni zila" parent="2"/> + <iso_3166_2_entry + code="BD-19" name="Gaibandha zila" parent="5"/> + <iso_3166_2_entry + code="BD-18" name="Gazipur zila" parent="3"/> + <iso_3166_2_entry + code="BD-17" name="Gopalganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-20" name="Habiganj zila" parent="6"/> + <iso_3166_2_entry + code="BD-24" name="Jaipurhat zila" parent="5"/> + <iso_3166_2_entry + code="BD-21" name="Jamalpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-22" name="Jessore zila" parent="4"/> + <iso_3166_2_entry + code="BD-25" name="Jhalakati zila" parent="1"/> + <iso_3166_2_entry + code="BD-23" name="Jhenaidah zila" parent="4"/> + <iso_3166_2_entry + code="BD-29" name="Khagrachari zila" parent="2"/> + <iso_3166_2_entry + code="BD-27" name="Khulna zila" parent="4"/> + <iso_3166_2_entry + code="BD-26" name="Kishorganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-28" name="Kurigram zila" parent="5"/> + <iso_3166_2_entry + code="BD-30" name="Kushtia zila" parent="4"/> + <iso_3166_2_entry + code="BD-31" name="Lakshmipur zila" parent="2"/> + <iso_3166_2_entry + code="BD-32" name="Lalmonirhat zila" parent="5"/> + <iso_3166_2_entry + code="BD-36" name="Madaripur zila" parent="3"/> + <iso_3166_2_entry + code="BD-37" name="Magura zila" parent="4"/> + <iso_3166_2_entry + code="BD-33" name="Manikganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-39" name="Meherpur zila" parent="4"/> + <iso_3166_2_entry + code="BD-38" name="Moulvibazar zila" parent="6"/> + <iso_3166_2_entry + code="BD-35" name="Munshiganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-34" name="Mymensingh zila" parent="3"/> + <iso_3166_2_entry + code="BD-48" name="Naogaon zila" parent="5"/> + <iso_3166_2_entry + code="BD-43" name="Narail zila" parent="4"/> + <iso_3166_2_entry + code="BD-40" name="Narayanganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-42" name="Narsingdi zila" parent="3"/> + <iso_3166_2_entry + code="BD-44" name="Natore zila" parent="5"/> + <iso_3166_2_entry + code="BD-45" name="Nawabganj zila" parent="5"/> + <iso_3166_2_entry + code="BD-41" name="Netrakona zila" parent="3"/> + <iso_3166_2_entry + code="BD-46" name="Nilphamari zila" parent="5"/> + <iso_3166_2_entry + code="BD-47" name="Noakhali zila" parent="2"/> + <iso_3166_2_entry + code="BD-49" name="Pabna zila" parent="5"/> + <iso_3166_2_entry + code="BD-52" name="Panchagarh zila" parent="5"/> + <iso_3166_2_entry + code="BD-51" name="Patuakhali zila" parent="1"/> + <iso_3166_2_entry + code="BD-50" name="Pirojpur zila" parent="1"/> + <iso_3166_2_entry + code="BD-53" name="Rajbari zila" parent="3"/> + <iso_3166_2_entry + code="BD-54" name="Rajshahi zila" parent="5"/> + <iso_3166_2_entry + code="BD-56" name="Rangamati zila" parent="2"/> + <iso_3166_2_entry + code="BD-55" name="Rangpur zila" parent="5"/> + <iso_3166_2_entry + code="BD-58" name="Satkhira zila" parent="4"/> + <iso_3166_2_entry + code="BD-62" name="Shariatpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-57" name="Sherpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-59" name="Sirajganj zila" parent="5"/> + <iso_3166_2_entry + code="BD-61" name="Sunamganj zila" parent="6"/> + <iso_3166_2_entry + code="BD-60" name="Sylhet zila" parent="6"/> + <iso_3166_2_entry + code="BD-63" name="Tangail zila" parent="3"/> + <iso_3166_2_entry + code="BD-64" name="Thakurgaon zila" parent="5"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Belgium --> + <iso_3166_country code="BE"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="BE-VAN" name="Antwerpen"/> + <iso_3166_2_entry + code="BE-WBR" name="Brabant Wallon"/> + <iso_3166_2_entry + code="BE-BRU" name="Brussels-Capital Region"/> + <iso_3166_2_entry + code="BE-WHT" name="Hainaut"/> + <iso_3166_2_entry + code="BE-WLG" name="Liege"/> + <iso_3166_2_entry + code="BE-VLI" name="Limburg"/> + <iso_3166_2_entry + code="BE-WLX" name="Luxembourg"/> + <iso_3166_2_entry + code="BE-WNA" name="Namur"/> + <iso_3166_2_entry + code="BE-VOV" name="Oost-Vlaanderen"/> + <iso_3166_2_entry + code="BE-VBR" name="Vlaams-Brabant"/> + <iso_3166_2_entry + code="BE-VWV" name="West-Vlaanderen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Burkina-Faso --> + <iso_3166_country code="BF"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="BF-01" name="Boucle du Mouhoun"/> + <iso_3166_2_entry + code="BF-02" name="Cascades"/> + <iso_3166_2_entry + code="BF-03" name="Centre"/> + <iso_3166_2_entry + code="BF-04" name="Centre-Est"/> + <iso_3166_2_entry + code="BF-05" name="Centre-Nord"/> + <iso_3166_2_entry + code="BF-06" name="Centre-Ouest"/> + <iso_3166_2_entry + code="BF-07" name="Centre-Sud"/> + <iso_3166_2_entry + code="BF-08" name="Est"/> + <iso_3166_2_entry + code="BF-09" name="Hauts-Bassins"/> + <iso_3166_2_entry + code="BF-10" name="Nord"/> + <iso_3166_2_entry + code="BF-11" name="Plateau-Central"/> + <iso_3166_2_entry + code="BF-12" name="Sahel"/> + <iso_3166_2_entry + code="BF-13" name="Sud-Ouest"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="BF-BAL" name="Balé" parent="01"/> + <iso_3166_2_entry + code="BF-BAM" name="Bam" parent="05"/> + <iso_3166_2_entry + code="BF-BAN" name="Banwa" parent="01"/> + <iso_3166_2_entry + code="BF-BAZ" name="Bazèga" parent="07"/> + <iso_3166_2_entry + code="BF-BGR" name="Bougouriba" parent="13"/> + <iso_3166_2_entry + code="BF-BLG" name="Boulgou" parent="04"/> + <iso_3166_2_entry + code="BF-BLK" name="Boulkiemdé" parent="06"/> + <iso_3166_2_entry + code="BF-COM" name="Comoé" parent="02"/> + <iso_3166_2_entry + code="BF-GAN" name="Ganzourgou" parent="11"/> + <iso_3166_2_entry + code="BF-GNA" name="Gnagna" parent="08"/> + <iso_3166_2_entry + code="BF-GOU" name="Gourma" parent="08"/> + <iso_3166_2_entry + code="BF-HOU" name="Houet" parent="09"/> + <iso_3166_2_entry + code="BF-IOB" name="Ioba" parent="13"/> + <iso_3166_2_entry + code="BF-KAD" name="Kadiogo" parent="03"/> + <iso_3166_2_entry + code="BF-KEN" name="Kénédougou" parent="09"/> + <iso_3166_2_entry + code="BF-KMD" name="Komondjari" parent="08"/> + <iso_3166_2_entry + code="BF-KMP" name="Kompienga" parent="08"/> + <iso_3166_2_entry + code="BF-KOS" name="Kossi" parent="01"/> + <iso_3166_2_entry + code="BF-KOP" name="Koulpélogo" parent="04"/> + <iso_3166_2_entry + code="BF-KOT" name="Kouritenga" parent="04"/> + <iso_3166_2_entry + code="BF-KOW" name="Kourwéogo" parent="11"/> + <iso_3166_2_entry + code="BF-LER" name="Léraba" parent="02"/> + <iso_3166_2_entry + code="BF-LOR" name="Loroum" parent="10"/> + <iso_3166_2_entry + code="BF-MOU" name="Mouhoun" parent="01"/> + <iso_3166_2_entry + code="BF-NAO" name="Naouri" parent="07"/> + <iso_3166_2_entry + code="BF-NAM" name="Namentenga" parent="05"/> + <iso_3166_2_entry + code="BF-NAY" name="Nayala" parent="01"/> + <iso_3166_2_entry + code="BF-NOU" name="Noumbiel" parent="13"/> + <iso_3166_2_entry + code="BF-OUB" name="Oubritenga" parent="11"/> + <iso_3166_2_entry + code="BF-OUD" name="Oudalan" parent="12"/> + <iso_3166_2_entry + code="BF-PAS" name="Passoré" parent="10"/> + <iso_3166_2_entry + code="BF-PON" name="Poni" parent="13"/> + <iso_3166_2_entry + code="BF-SNG" name="Sanguié" parent="06"/> + <iso_3166_2_entry + code="BF-SMT" name="Sanmatenga" parent="05"/> + <iso_3166_2_entry + code="BF-SEN" name="Séno" parent="12"/> + <iso_3166_2_entry + code="BF-SIS" name="Sissili" parent="06"/> + <iso_3166_2_entry + code="BF-SOM" name="Soum" parent="12"/> + <iso_3166_2_entry + code="BF-SOR" name="Sourou" parent="01"/> + <iso_3166_2_entry + code="BF-TAP" name="Tapoa" parent="08"/> + <iso_3166_2_entry + code="BF-TUI" name="Tui" parent="09"/> + <iso_3166_2_entry + code="BF-YAG" name="Yagha" parent="12"/> + <iso_3166_2_entry + code="BF-YAT" name="Yatenga" parent="10"/> + <iso_3166_2_entry + code="BF-ZIR" name="Ziro" parent="06"/> + <iso_3166_2_entry + code="BF-ZON" name="Zondoma" parent="10"/> + <iso_3166_2_entry + code="BF-ZOU" name="Zoundwéogo" parent="07"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bulgaria --> + <iso_3166_country code="BG"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="BG-01" name="Blagoevgrad"/> + <iso_3166_2_entry + code="BG-02" name="Burgas"/> + <iso_3166_2_entry + code="BG-08" name="Dobrich"/> + <iso_3166_2_entry + code="BG-07" name="Gabrovo"/> + <iso_3166_2_entry + code="BG-26" name="Haskovo"/> + <iso_3166_2_entry + code="BG-09" name="Kardzhali"/> + <iso_3166_2_entry + code="BG-10" name="Kyustendil"/> + <iso_3166_2_entry + code="BG-11" name="Lovech"/> + <iso_3166_2_entry + code="BG-12" name="Montana"/> + <iso_3166_2_entry + code="BG-13" name="Pazardzhik"/> + <iso_3166_2_entry + code="BG-14" name="Pernik"/> + <iso_3166_2_entry + code="BG-15" name="Pleven"/> + <iso_3166_2_entry + code="BG-16" name="Plovdiv"/> + <iso_3166_2_entry + code="BG-17" name="Razgrad"/> + <iso_3166_2_entry + code="BG-18" name="Ruse"/> + <iso_3166_2_entry + code="BG-27" name="Shumen"/> + <iso_3166_2_entry + code="BG-19" name="Silistra"/> + <iso_3166_2_entry + code="BG-20" name="Sliven"/> + <iso_3166_2_entry + code="BG-21" name="Smolyan"/> + <iso_3166_2_entry + code="BG-23" name="Sofia"/> + <iso_3166_2_entry + code="BG-22" name="Sofia-Grad"/> + <iso_3166_2_entry + code="BG-24" name="Stara Zagora"/> + <iso_3166_2_entry + code="BG-25" name="Targovishte"/> + <iso_3166_2_entry + code="BG-03" name="Varna"/> + <iso_3166_2_entry + code="BG-04" name="Veliko Tarnovo"/> + <iso_3166_2_entry + code="BG-05" name="Vidin"/> + <iso_3166_2_entry + code="BG-06" name="Vratsa"/> + <iso_3166_2_entry + code="BG-28" name="Yambol"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bahrain --> + <iso_3166_country code="BH"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="BH-13" name="Al Manāmah (Al ‘Āşimah)"/> + <iso_3166_2_entry + code="BH-14" name="Al Janūbīyah"/> + <iso_3166_2_entry + code="BH-15" name="Al Muḩarraq"/> + <iso_3166_2_entry + code="BH-16" name="Al Wusţá"/> + <iso_3166_2_entry + code="BH-17" name="Ash Shamālīyah"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Burundi --> + <iso_3166_country code="BI"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="BI-BB" name="Bubanza"/> + <iso_3166_2_entry + code="BI-BM" name="Bujumbura Mairie"/> + <iso_3166_2_entry + code="BI-BL" name="Bujumbura Rural"/> + <iso_3166_2_entry + code="BI-BR" name="Bururi"/> + <iso_3166_2_entry + code="BI-CA" name="Cankuzo"/> + <iso_3166_2_entry + code="BI-CI" name="Cibitoke"/> + <iso_3166_2_entry + code="BI-GI" name="Gitega"/> + <iso_3166_2_entry + code="BI-KR" name="Karuzi"/> + <iso_3166_2_entry + code="BI-KY" name="Kayanza"/> + <iso_3166_2_entry + code="BI-KI" name="Kirundo"/> + <iso_3166_2_entry + code="BI-MA" name="Makamba"/> + <iso_3166_2_entry + code="BI-MU" name="Muramvya"/> + <iso_3166_2_entry + code="BI-MW" name="Mwaro"/> + <iso_3166_2_entry + code="BI-NG" name="Ngozi"/> + <iso_3166_2_entry + code="BI-RT" name="Rutana"/> + <iso_3166_2_entry + code="BI-RY" name="Ruyigi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Benin --> + <iso_3166_country code="BJ"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="BJ-AL" name="Alibori"/> + <iso_3166_2_entry + code="BJ-AK" name="Atakora"/> + <iso_3166_2_entry + code="BJ-AQ" name="Atlantique"/> + <iso_3166_2_entry + code="BJ-BO" name="Borgou"/> + <iso_3166_2_entry + code="BJ-CO" name="Collines"/> + <iso_3166_2_entry + code="BJ-DO" name="Donga"/> + <iso_3166_2_entry + code="BJ-KO" name="Kouffo"/> + <iso_3166_2_entry + code="BJ-LI" name="Littoral"/> + <iso_3166_2_entry + code="BJ-MO" name="Mono"/> + <iso_3166_2_entry + code="BJ-OU" name="Ouémé"/> + <iso_3166_2_entry + code="BJ-PL" name="Plateau"/> + <iso_3166_2_entry + code="BJ-ZO" name="Zou"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Barthélemy --> + <iso_3166_country code="BL"/> + <!-- Brunei Darussalam --> + <iso_3166_country code="BN"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BN-BE" name="Belait"/> + <iso_3166_2_entry + code="BN-BM" name="Brunei-Muara"/> + <iso_3166_2_entry + code="BN-TE" name="Temburong"/> + <iso_3166_2_entry + code="BN-TU" name="Tutong"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bolivia --> + <iso_3166_country code="BO"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="BO-H" name="Chuquisaca"/> + <iso_3166_2_entry + code="BO-C" name="Cochabamba"/> + <iso_3166_2_entry + code="BO-B" name="El Beni"/> + <iso_3166_2_entry + code="BO-L" name="La Paz"/> + <iso_3166_2_entry + code="BO-O" name="Oruro"/> + <iso_3166_2_entry + code="BO-N" name="Pando"/> + <iso_3166_2_entry + code="BO-P" name="Potosí"/> + <iso_3166_2_entry + code="BO-S" name="Santa Cruz"/> + <iso_3166_2_entry + code="BO-T" name="Tarija"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Brazil --> + <iso_3166_country code="BR"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="BR-AC" name="Acre"/> + <iso_3166_2_entry + code="BR-AL" name="Alagoas"/> + <iso_3166_2_entry + code="BR-AM" name="Amazonas"/> + <iso_3166_2_entry + code="BR-AP" name="Amapá"/> + <iso_3166_2_entry + code="BR-BA" name="Bahia"/> + <iso_3166_2_entry + code="BR-CE" name="Ceará"/> + <iso_3166_2_entry + code="BR-ES" name="Espírito Santo"/> + <iso_3166_2_entry + code="BR-FN" name="Fernando de Noronha"/> + <iso_3166_2_entry + code="BR-GO" name="Goiás"/> + <iso_3166_2_entry + code="BR-MA" name="Maranhão"/> + <iso_3166_2_entry + code="BR-MG" name="Minas Gerais"/> + <iso_3166_2_entry + code="BR-MS" name="Mato Grosso do Sul"/> + <iso_3166_2_entry + code="BR-MT" name="Mato Grosso"/> + <iso_3166_2_entry + code="BR-PA" name="Pará"/> + <iso_3166_2_entry + code="BR-PB" name="Paraíba"/> + <iso_3166_2_entry + code="BR-PE" name="Pernambuco"/> + <iso_3166_2_entry + code="BR-PI" name="Piauí"/> + <iso_3166_2_entry + code="BR-PR" name="Paraná"/> + <iso_3166_2_entry + code="BR-RJ" name="Rio de Janeiro"/> + <iso_3166_2_entry + code="BR-RN" name="Rio Grande do Norte"/> + <iso_3166_2_entry + code="BR-RO" name="Rondônia"/> + <iso_3166_2_entry + code="BR-RR" name="Roraima"/> + <iso_3166_2_entry + code="BR-RS" name="Rio Grande do Sul"/> + <iso_3166_2_entry + code="BR-SC" name="Santa Catarina"/> + <iso_3166_2_entry + code="BR-SE" name="Sergipe"/> + <iso_3166_2_entry + code="BR-SP" name="São Paulo"/> + <iso_3166_2_entry + code="BR-TO" name="Tocantins"/> + </iso_3166_subset> + <iso_3166_subset type="Federal District"> + <iso_3166_2_entry + code="BR-DF" name="Distrito Federal"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bahamas --> + <iso_3166_country code="BS"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BS-AC" name="Acklins Islands"/> + <iso_3166_2_entry + code="BS-BY" name="Berry Islands"/> + <iso_3166_2_entry + code="BS-BI" name="Bimini and Cat Cay"/> + <iso_3166_2_entry + code="BS-BP" name="Black Point"/> + <iso_3166_2_entry + code="BS-CI" name="Cat Island"/> + <iso_3166_2_entry + code="BS-CO" name="Central Abaco"/> + <iso_3166_2_entry + code="BS-CS" name="Central Andros"/> + <iso_3166_2_entry + code="BS-CE" name="Central Eleuthera"/> + <iso_3166_2_entry + code="BS-FP" name="City of Freeport"/> + <iso_3166_2_entry + code="BS-CK" name="Crooked Island and Long Cay"/> + <iso_3166_2_entry + code="BS-EG" name="East Grand Bahama"/> + <iso_3166_2_entry + code="BS-EX" name="Exuma"/> + <iso_3166_2_entry + code="BS-GC" name="Grand Cay"/> + <iso_3166_2_entry + code="BS-GT" name="Green Turtle Cay"/> + <iso_3166_2_entry + code="BS-HI" name="Harbour Island"/> + <iso_3166_2_entry + code="BS-HT" name="Hope Town"/> + <iso_3166_2_entry + code="BS-IN" name="Inagua"/> + <iso_3166_2_entry + code="BS-LI" name="Long Island"/> + <iso_3166_2_entry + code="BS-MC" name="Mangrove Cay"/> + <iso_3166_2_entry + code="BS-MG" name="Mayaguana"/> + <iso_3166_2_entry + code="BS-MI" name="Moore's Island"/> + <iso_3166_2_entry + code="BS-NO" name="North Abaco"/> + <iso_3166_2_entry + code="BS-NS" name="North Andros"/> + <iso_3166_2_entry + code="BS-NE" name="North Eleuthera"/> + <iso_3166_2_entry + code="BS-RI" name="Ragged Island"/> + <iso_3166_2_entry + code="BS-RC" name="Rum Cay"/> + <iso_3166_2_entry + code="BS-SS" name="San Salvador"/> + <iso_3166_2_entry + code="BS-SO" name="South Abaco"/> + <iso_3166_2_entry + code="BS-SA" name="South Andros"/> + <iso_3166_2_entry + code="BS-SE" name="South Eleuthera"/> + <iso_3166_2_entry + code="BS-SW" name="Spanish Wells"/> + <iso_3166_2_entry + code="BS-WG" name="West Grand Bahama"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bhutan --> + <iso_3166_country code="BT"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BT-33" name="Bumthang"/> + <iso_3166_2_entry + code="BT-12" name="Chhukha"/> + <iso_3166_2_entry + code="BT-22" name="Dagana"/> + <iso_3166_2_entry + code="BT-GA" name="Gasa"/> + <iso_3166_2_entry + code="BT-13" name="Ha"/> + <iso_3166_2_entry + code="BT-44" name="Lhuentse"/> + <iso_3166_2_entry + code="BT-42" name="Monggar"/> + <iso_3166_2_entry + code="BT-11" name="Paro"/> + <iso_3166_2_entry + code="BT-43" name="Pemagatshel"/> + <iso_3166_2_entry + code="BT-23" name="Punakha"/> + <iso_3166_2_entry + code="BT-45" name="Samdrup Jongkha"/> + <iso_3166_2_entry + code="BT-14" name="Samtee"/> + <iso_3166_2_entry + code="BT-31" name="Sarpang"/> + <iso_3166_2_entry + code="BT-15" name="Thimphu"/> + <iso_3166_2_entry + code="BT-41" name="Trashigang"/> + <iso_3166_2_entry + code="BT-TY" name="Trashi Yangtse"/> + <iso_3166_2_entry + code="BT-32" name="Trongsa"/> + <iso_3166_2_entry + code="BT-21" name="Tsirang"/> + <iso_3166_2_entry + code="BT-24" name="Wangdue Phodrang"/> + <iso_3166_2_entry + code="BT-34" name="Zhemgang"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Botswana --> + <iso_3166_country code="BW"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BW-CE" name="Central"/> + <iso_3166_2_entry + code="BW-GH" name="Ghanzi"/> + <iso_3166_2_entry + code="BW-KG" name="Kgalagadi"/> + <iso_3166_2_entry + code="BW-KL" name="Kgatleng"/> + <iso_3166_2_entry + code="BW-KW" name="Kweneng"/> + <iso_3166_2_entry + code="BW-NG" name="Ngamiland"/> + <iso_3166_2_entry + code="BW-NE" name="North-East"/> + <iso_3166_2_entry + code="BW-NW" name="North-West (Botswana)"/> + <iso_3166_2_entry + code="BW-SE" name="South-East"/> + <iso_3166_2_entry + code="BW-SO" name="Southern (Botswana)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Belarus --> + <iso_3166_country code="BY"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="BY-HM" name="Horad Minsk"/> + </iso_3166_subset> + <iso_3166_subset type="Oblast"> + <!-- ISO 3166-2 gives several Romanised versions of the names; here we choose the GOST be version --> + <iso_3166_2_entry + code="BY-BR" name="Brèsckaja voblasc'"/> + <iso_3166_2_entry + code="BY-HO" name="Homel'skaja voblasc'"/> + <iso_3166_2_entry + code="BY-HR" name="Hrodzenskaja voblasc'"/> + <iso_3166_2_entry + code="BY-MA" name="Mahilëuskaja voblasc'"/> + <iso_3166_2_entry + code="BY-MI" name="Minskaja voblasc'"/> + <iso_3166_2_entry + code="BY-VI" name="Vicebskaja voblasc'"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Belize --> + <iso_3166_country code="BZ"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BZ-BZ" name="Belize"/> + <iso_3166_2_entry + code="BZ-CY" name="Cayo"/> + <iso_3166_2_entry + code="BZ-CZL" name="Corozal"/> + <iso_3166_2_entry + code="BZ-OW" name="Orange Walk"/> + <iso_3166_2_entry + code="BZ-SC" name="Stann Creek"/> + <iso_3166_2_entry + code="BZ-TOL" name="Toledo"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Canada --> + <iso_3166_country code="CA"> + <!-- sub-region codes for Canadian provinces and territories --> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CA-AB" name="Alberta"/> + <iso_3166_2_entry + code="CA-BC" name="British Columbia"/> + <iso_3166_2_entry + code="CA-MB" name="Manitoba"/> + <iso_3166_2_entry + code="CA-NB" name="New Brunswick"/> + <iso_3166_2_entry + code="CA-NL" name="Newfoundland and Labrador"/> + <iso_3166_2_entry + code="CA-NS" name="Nova Scotia"/> + <iso_3166_2_entry + code="CA-ON" name="Ontario"/> + <iso_3166_2_entry + code="CA-PE" name="Prince Edward Island"/> + <iso_3166_2_entry + code="CA-QC" name="Quebec"/> + <iso_3166_2_entry + code="CA-SK" name="Saskatchewan"/> + </iso_3166_subset> + <iso_3166_subset type="Territory"> + <iso_3166_2_entry + code="CA-NT" name="Northwest Territories"/> + <iso_3166_2_entry + code="CA-NU" name="Nunavut"/> + <iso_3166_2_entry + code="CA-YT" name="Yukon Territory"/> + </iso_3166_subset> + </iso_3166_country> + <!-- The Democratic Republic of Congo --> + <iso_3166_country code="CD"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="CD-KN" name="Kinshasa"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CD-BN" name="Bandundu"/> + <iso_3166_2_entry + code="CD-BC" name="Bas-Congo"/> + <iso_3166_2_entry + code="CD-EQ" name="Équateur"/> + <iso_3166_2_entry + code="CD-HC" name="Haut-Congo"/> + <iso_3166_2_entry + code="CD-KW" name="Kasai-Occidental"/> + <iso_3166_2_entry + code="CD-KE" name="Kasai-Oriental"/> + <iso_3166_2_entry + code="CD-KA" name="Katanga"/> + <iso_3166_2_entry + code="CD-MA" name="Maniema"/> + <iso_3166_2_entry + code="CD-NK" name="Nord-Kivu"/> + <iso_3166_2_entry + code="CD-OR" name="Orientale"/> + <iso_3166_2_entry + code="CD-SK" name="Sud-Kivu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Central African Republic --> + <iso_3166_country code="CF"> + <iso_3166_subset type="Commune"> + <iso_3166_2_entry + code="CF-BGF" name="Bangui"/> + </iso_3166_subset> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="CF-BB" name="Bamingui-Bangoran"/> + <iso_3166_2_entry + code="CF-BK" name="Basse-Kotto"/> + <iso_3166_2_entry + code="CF-HK" name="Haute-Kotto"/> + <iso_3166_2_entry + code="CF-HM" name="Haut-Mbomou"/> + <iso_3166_2_entry + code="CF-KG" name="Kémo-Gribingui"/> + <iso_3166_2_entry + code="CF-LB" name="Lobaye"/> + <iso_3166_2_entry + code="CF-HS" name="Haute-Sangha / Mambéré-Kadéï"/> + <iso_3166_2_entry + code="CF-MB" name="Mbomou"/> + <iso_3166_2_entry + code="CF-NM" name="Nana-Mambéré"/> + <iso_3166_2_entry + code="CF-MP" name="Ombella-M'poko"/> + <iso_3166_2_entry + code="CF-UK" name="Ouaka"/> + <iso_3166_2_entry + code="CF-AC" name="Ouham"/> + <iso_3166_2_entry + code="CF-OP" name="Ouham-Pendé"/> + <iso_3166_2_entry + code="CF-VR" name="Vakaga"/> + </iso_3166_subset> + <iso_3166_subset type="Economic Prefecture"> + <iso_3166_2_entry + code="CF-KB" name="Gribingui"/> + <iso_3166_2_entry + code="CF-SE" name="Sangha"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Congo --> + <iso_3166_country code="CG"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CG-11" name="Bouenza"/> + <iso_3166_2_entry + code="CG-8" name="Cuvette"/> + <iso_3166_2_entry + code="CG-15" name="Cuvette-Ouest"/> + <iso_3166_2_entry + code="CG-5" name="Kouilou"/> + <iso_3166_2_entry + code="CG-2" name="Lékoumou"/> + <iso_3166_2_entry + code="CG-7" name="Likouala"/> + <iso_3166_2_entry + code="CG-9" name="Niari"/> + <iso_3166_2_entry + code="CG-14" name="Plateaux"/> + <iso_3166_2_entry + code="CG-12" name="Pool"/> + <iso_3166_2_entry + code="CG-13" name="Sangha"/> + </iso_3166_subset> + <iso_3166_subset type="Capital District"> + <iso_3166_2_entry + code="CG-BZV" name="Brazzaville"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Switzerland --> + <iso_3166_country code="CH"> + <iso_3166_subset type="Canton"> + <iso_3166_2_entry + code="CH-AG" name="Aargau"/> + <iso_3166_2_entry + code="CH-AI" name="Appenzell Innerrhoden"/> + <iso_3166_2_entry + code="CH-AR" name="Appenzell Ausserrhoden"/> + <iso_3166_2_entry + code="CH-BE" name="Bern"/> + <iso_3166_2_entry + code="CH-BL" name="Basel-Landschaft"/> + <iso_3166_2_entry + code="CH-BS" name="Basel-Stadt"/> + <iso_3166_2_entry + code="CH-FR" name="Fribourg"/> + <iso_3166_2_entry + code="CH-GE" name="Genève"/> + <iso_3166_2_entry + code="CH-GL" name="Glarus"/> + <iso_3166_2_entry + code="CH-GR" name="Graubünden"/> + <iso_3166_2_entry + code="CH-JU" name="Jura"/> + <iso_3166_2_entry + code="CH-LU" name="Luzern"/> + <iso_3166_2_entry + code="CH-NE" name="Neuchâtel"/> + <iso_3166_2_entry + code="CH-NW" name="Nidwalden"/> + <iso_3166_2_entry + code="CH-OW" name="Obwalden"/> + <iso_3166_2_entry + code="CH-SG" name="Sankt Gallen"/> + <iso_3166_2_entry + code="CH-SH" name="Schaffhausen"/> + <iso_3166_2_entry + code="CH-SO" name="Solothurn"/> + <iso_3166_2_entry + code="CH-SZ" name="Schwyz"/> + <iso_3166_2_entry + code="CH-TG" name="Thurgau"/> + <iso_3166_2_entry + code="CH-TI" name="Ticino"/> + <iso_3166_2_entry + code="CH-UR" name="Uri"/> + <iso_3166_2_entry + code="CH-VD" name="Vaud"/> + <iso_3166_2_entry + code="CH-VS" name="Valais"/> + <iso_3166_2_entry + code="CH-ZG" name="Zug"/> + <iso_3166_2_entry + code="CH-ZH" name="Zürich"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cote D'ivoire --> + <iso_3166_country code="CI"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CI-06" name="18 Montagnes (Région des)"/> + <iso_3166_2_entry + code="CI-16" name="Agnébi (Région de l')"/> + <iso_3166_2_entry + code="CI-17" name="Bafing (Région du)"/> + <iso_3166_2_entry + code="CI-09" name="Bas-Sassandra (Région du)"/> + <iso_3166_2_entry + code="CI-10" name="Denguélé (Région du)"/> + <iso_3166_2_entry + code="CI-18" name="Fromager (Région du)"/> + <iso_3166_2_entry + code="CI-02" name="Haut-Sassandra (Région du)"/> + <iso_3166_2_entry + code="CI-07" name="Lacs (Région des)"/> + <iso_3166_2_entry + code="CI-01" name="Lagunes (Région des)"/> + <iso_3166_2_entry + code="CI-12" name="Marahoué (Région de la)"/> + <iso_3166_2_entry + code="CI-19" name="Moyen-Cavally (Région du)"/> + <iso_3166_2_entry + code="CI-05" name="Moyen-Comoé (Région du)"/> + <iso_3166_2_entry + code="CI-11" name="Nzi-Comoé (Région)"/> + <iso_3166_2_entry + code="CI-03" name="Savanes (Région des)"/> + <iso_3166_2_entry + code="CI-15" name="Sud-Bandama (Région du)"/> + <iso_3166_2_entry + code="CI-13" name="Sud-Comoé (Région du)"/> + <iso_3166_2_entry + code="CI-04" name="Vallée du Bandama (Région de la)"/> + <iso_3166_2_entry + code="CI-14" name="Worodouqou (Région du)"/> + <iso_3166_2_entry + code="CI-08" name="Zanzan (Région du)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Chile --> + <iso_3166_country code="CL"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CL-AI" name="Aisén del General Carlos Ibáñez del Campo"/> + <iso_3166_2_entry + code="CL-AN" name="Antofagasta"/> + <iso_3166_2_entry + code="CL-AR" name="Araucanía"/> + <iso_3166_2_entry + code="CL-AP" name="Arica y Parinacota"/> + <iso_3166_2_entry + code="CL-AT" name="Atacama"/> + <iso_3166_2_entry + code="CL-BI" name="Bío-Bío"/> + <iso_3166_2_entry + code="CL-CO" name="Coquimbo"/> + <iso_3166_2_entry + code="CL-LI" name="Libertador General Bernardo O'Higgins"/> + <iso_3166_2_entry + code="CL-LL" name="Los Lagos"/> + <iso_3166_2_entry + code="CL-LR" name="Los Ríos"/> + <iso_3166_2_entry + code="CL-MA" name="Magallanes y Antártica Chilena"/> + <iso_3166_2_entry + code="CL-ML" name="Maule"/> + <iso_3166_2_entry + code="CL-RM" name="Región Metropolitana de Santiago"/> + <iso_3166_2_entry + code="CL-TA" name="Tarapacá"/> + <iso_3166_2_entry + code="CL-VS" name="Valparaíso"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cameroon --> + <iso_3166_country code="CM"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CM-AD" name="Adamaoua"/> + <iso_3166_2_entry + code="CM-CE" name="Centre"/> + <iso_3166_2_entry + code="CM-ES" name="East"/> + <iso_3166_2_entry + code="CM-EN" name="Far North"/> + <iso_3166_2_entry + code="CM-LT" name="Littoral"/> + <iso_3166_2_entry + code="CM-NO" name="North"/> + <iso_3166_2_entry + code="CM-NW" name="North-West (Cameroon)"/> + <iso_3166_2_entry + code="CM-SU" name="South"/> + <iso_3166_2_entry + code="CM-SW" name="South-West"/> + <iso_3166_2_entry + code="CM-OU" name="West"/> + </iso_3166_subset> + </iso_3166_country> + <!-- China --> + <iso_3166_country code="CN"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="CN-11" name="Beijing"/> + <iso_3166_2_entry + code="CN-50" name="Chongqing"/> + <iso_3166_2_entry + code="CN-31" name="Shanghai"/> + <iso_3166_2_entry + code="CN-12" name="Tianjin"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CN-34" name="Anhui"/> + <iso_3166_2_entry + code="CN-35" name="Fujian"/> + <iso_3166_2_entry + code="CN-62" name="Gansu"/> + <iso_3166_2_entry + code="CN-44" name="Guangdong"/> + <iso_3166_2_entry + code="CN-52" name="Guizhou"/> + <iso_3166_2_entry + code="CN-46" name="Hainan"/> + <iso_3166_2_entry + code="CN-13" name="Hebei"/> + <iso_3166_2_entry + code="CN-23" name="Heilongjiang"/> + <iso_3166_2_entry + code="CN-41" name="Henan"/> + <iso_3166_2_entry + code="CN-42" name="Hubei"/> + <iso_3166_2_entry + code="CN-43" name="Hunan"/> + <iso_3166_2_entry + code="CN-32" name="Jiangsu"/> + <iso_3166_2_entry + code="CN-36" name="Jiangxi"/> + <iso_3166_2_entry + code="CN-22" name="Jilin"/> + <iso_3166_2_entry + code="CN-21" name="Liaoning"/> + <iso_3166_2_entry + code="CN-63" name="Qinghai"/> + <iso_3166_2_entry + code="CN-61" name="Shaanxi"/> + <iso_3166_2_entry + code="CN-37" name="Shandong"/> + <iso_3166_2_entry + code="CN-14" name="Shanxi"/> + <iso_3166_2_entry + code="CN-51" name="Sichuan"/> + <iso_3166_2_entry + code="CN-71" name="Taiwan"/> + <iso_3166_2_entry + code="CN-53" name="Yunnan"/> + <iso_3166_2_entry + code="CN-33" name="Zhejiang"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous region"> + <iso_3166_2_entry + code="CN-45" name="Guangxi"/> + <iso_3166_2_entry + code="CN-15" name="Nei Mongol"/> + <iso_3166_2_entry + code="CN-64" name="Ningxia"/> + <iso_3166_2_entry + code="CN-65" name="Xinjiang"/> + <iso_3166_2_entry + code="CN-54" name="Xizang"/> + </iso_3166_subset> + <iso_3166_subset type="Special administrative region"> + <iso_3166_2_entry + code="CN-91" name="Xianggang (Hong-Kong)"/> + <iso_3166_2_entry + code="CN-92" name="Aomen (Macau)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Colombia --> + <iso_3166_country code="CO"> + <iso_3166_subset type="Capital district"> + <iso_3166_2_entry + code="CO-DC" name="Distrito Capital de Bogotá"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="CO-AMA" name="Amazonas"/> + <iso_3166_2_entry + code="CO-ANT" name="Antioquia"/> + <iso_3166_2_entry + code="CO-ARA" name="Arauca"/> + <iso_3166_2_entry + code="CO-ATL" name="Atlántico"/> + <iso_3166_2_entry + code="CO-BOL" name="Bolívar"/> + <iso_3166_2_entry + code="CO-BOY" name="Boyacá"/> + <iso_3166_2_entry + code="CO-CAL" name="Caldas"/> + <iso_3166_2_entry + code="CO-CAQ" name="Caquetá"/> + <iso_3166_2_entry + code="CO-CAS" name="Casanare"/> + <iso_3166_2_entry + code="CO-CAU" name="Cauca"/> + <iso_3166_2_entry + code="CO-CES" name="Cesar"/> + <iso_3166_2_entry + code="CO-CHO" name="Chocó"/> + <iso_3166_2_entry + code="CO-COR" name="Córdoba"/> + <iso_3166_2_entry + code="CO-CUN" name="Cundinamarca"/> + <iso_3166_2_entry + code="CO-GUA" name="Guainía"/> + <iso_3166_2_entry + code="CO-GUV" name="Guaviare"/> + <iso_3166_2_entry + code="CO-HUI" name="Huila"/> + <iso_3166_2_entry + code="CO-LAG" name="La Guajira"/> + <iso_3166_2_entry + code="CO-MAG" name="Magdalena"/> + <iso_3166_2_entry + code="CO-MET" name="Meta"/> + <iso_3166_2_entry + code="CO-NAR" name="Nariño"/> + <iso_3166_2_entry + code="CO-NSA" name="Norte de Santander"/> + <iso_3166_2_entry + code="CO-PUT" name="Putumayo"/> + <iso_3166_2_entry + code="CO-QUI" name="Quindío"/> + <iso_3166_2_entry + code="CO-RIS" name="Risaralda"/> + <iso_3166_2_entry + code="CO-SAP" name="San Andrés, Providencia y Santa Catalina"/> + <iso_3166_2_entry + code="CO-SAN" name="Santander"/> + <iso_3166_2_entry + code="CO-SUC" name="Sucre"/> + <iso_3166_2_entry + code="CO-TOL" name="Tolima"/> + <iso_3166_2_entry + code="CO-VAC" name="Valle del Cauca"/> + <iso_3166_2_entry + code="CO-VAU" name="Vaupés"/> + <iso_3166_2_entry + code="CO-VID" name="Vichada"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Costa Rica --> + <iso_3166_country code="CR"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CR-A" name="Alajuela"/> + <iso_3166_2_entry + code="CR-C" name="Cartago"/> + <iso_3166_2_entry + code="CR-G" name="Guanacaste"/> + <iso_3166_2_entry + code="CR-H" name="Heredia"/> + <iso_3166_2_entry + code="CR-L" name="Limón"/> + <iso_3166_2_entry + code="CR-P" name="Puntarenas"/> + <iso_3166_2_entry + code="CR-SJ" name="San José"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cuba --> + <iso_3166_country code="CU"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CU-09" name="Camagüey"/> + <iso_3166_2_entry + code="CU-08" name="Ciego de Ávila"/> + <iso_3166_2_entry + code="CU-06" name="Cienfuegos"/> + <iso_3166_2_entry + code="CU-03" name="Ciudad de La Habana"/> + <iso_3166_2_entry + code="CU-12" name="Granma"/> + <iso_3166_2_entry + code="CU-14" name="Guantánamo"/> + <iso_3166_2_entry + code="CU-11" name="Holguín"/> + <iso_3166_2_entry + code="CU-02" name="La Habana"/> + <iso_3166_2_entry + code="CU-10" name="Las Tunas"/> + <iso_3166_2_entry + code="CU-04" name="Matanzas"/> + <iso_3166_2_entry + code="CU-01" name="Pinar del Rio"/> + <iso_3166_2_entry + code="CU-07" name="Sancti Spíritus"/> + <iso_3166_2_entry + code="CU-13" name="Santiago de Cuba"/> + <iso_3166_2_entry + code="CU-05" name="Villa Clara"/> + </iso_3166_subset> + <iso_3166_subset type="Special municipality"> + <iso_3166_2_entry + code="CU-99" name="Isla de la Juventud"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cape Verde --> + <iso_3166_country code="CV"> + <iso_3166_subset type="Geographical region"> + <iso_3166_2_entry + code="CV B" name="Ilhas de Barlavento"/> + <iso_3166_2_entry + code="CV S" name="Ilhas de Sotavento"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="CV-BV" name="Boa Vista" parent="B"/> + <iso_3166_2_entry + code="CV-BR" name="Brava" parent="S"/> + <iso_3166_2_entry + code="CV-MA" name="Maio" parent="S"/> + <iso_3166_2_entry + code="CV-MO" name="Mosteiros" parent="S"/> + <iso_3166_2_entry + code="CV-PA" name="Paul" parent="B"/> + <iso_3166_2_entry + code="CV-PN" name="Porto Novo" parent="B"/> + <iso_3166_2_entry + code="CV-PR" name="Praia" parent="S"/> + <iso_3166_2_entry + code="CV-RB" name="Ribeira Brava" parent="B"/> + <iso_3166_2_entry + code="CV-RG" name="Ribeira Grande" parent="B"/> + <iso_3166_2_entry + code="CV-RS" name="Ribeira Grande de Santiago" parent="S"/> + <iso_3166_2_entry + code="CV-SL" name="Sal" parent="B"/> + <iso_3166_2_entry + code="CV-CA" name="Santa Catarina" parent="S"/> + <iso_3166_2_entry + code="CV-CF" name="Santa Catarina de Fogo" parent="S"/> + <iso_3166_2_entry + code="CV-CR" name="Santa Cruz" parent="S"/> + <iso_3166_2_entry + code="CV-SD" name="São Domingos" parent="S"/> + <iso_3166_2_entry + code="CV-SF" name="São Filipe" parent="S"/> + <iso_3166_2_entry + code="CV-SL" name="São Lourenço dos Órgãos" parent="S"/> + <iso_3166_2_entry + code="CV-SM" name="São Miguel" parent="S"/> + <iso_3166_2_entry + code="CV-SS" name="São Salvador do Mundo" parent="S"/> + <iso_3166_2_entry + code="CV-SV" name="São Vicente" parent="B"/> + <iso_3166_2_entry + code="CV-TA" name="Tarrafal" parent="S"/> + <iso_3166_2_entry + code="CV-TS" name="Tarrafal de São Nicolau" parent="S"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cyprus --> + <iso_3166_country code="CY"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="CY-04" name="Ammóchostos"/> + <iso_3166_2_entry + code="CY-06" name="Kerýneia"/> + <iso_3166_2_entry + code="CY-03" name="Lárnaka"/> + <iso_3166_2_entry + code="CY-01" name="Lefkosía"/> + <iso_3166_2_entry + code="CY-02" name="Lemesós"/> + <iso_3166_2_entry + code="CY-05" name="Páfos"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Czech Republic --> + <iso_3166_country code="CZ"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CZ-JC" name="Jihočeský kraj"/> + <iso_3166_2_entry + code="CZ-JM" name="Jihomoravský kraj"/> + <iso_3166_2_entry + code="CZ-KA" name="Karlovarský kraj"/> + <iso_3166_2_entry + code="CZ-KR" name="Královéhradecký kraj"/> + <iso_3166_2_entry + code="CZ-LI" name="Liberecký kraj"/> + <iso_3166_2_entry + code="CZ-MO" name="Moravskoslezský kraj"/> + <iso_3166_2_entry + code="CZ-OL" name="Olomoucký kraj"/> + <iso_3166_2_entry + code="CZ-PA" name="Pardubický kraj"/> + <iso_3166_2_entry + code="CZ-PL" name="Plzeňský kraj"/> + <iso_3166_2_entry + code="CZ-PR" name="Praha, hlavní město"/> + <iso_3166_2_entry + code="CZ-ST" name="Středočeský kraj"/> + <iso_3166_2_entry + code="CZ-US" name="Ústecký kraj"/> + <iso_3166_2_entry + code="CZ-VY" name="Vysočina"/> + <iso_3166_2_entry + code="CZ-ZL" name="Zlínský kraj"/> + </iso_3166_subset> + <iso_3166_subset type="district"> + <iso_3166_2_entry + code="CZ-201" name="Benešov" parent="ST"/> + <iso_3166_2_entry + code="CZ-202" name="Beroun" parent="ST"/> + <iso_3166_2_entry + code="CZ-621" name="Blansko" parent="JM"/> + <iso_3166_2_entry + code="CZ-622" name="Brno-město" parent="JM"/> + <iso_3166_2_entry + code="CZ-623" name="Brno-venkov" parent="JM"/> + <iso_3166_2_entry + code="CZ-801" name="Bruntál" parent="MO"/> + <iso_3166_2_entry + code="CZ-624" name="Břeclav" parent="JM"/> + <iso_3166_2_entry + code="CZ-511" name="Česká Lípa" parent="LI"/> + <iso_3166_2_entry + code="CZ-311" name="České Budějovice" parent="JC"/> + <iso_3166_2_entry + code="CZ-312" name="Český Krumlov" parent="JC"/> + <iso_3166_2_entry + code="CZ-421" name="Děčín" parent="US"/> + <iso_3166_2_entry + code="CZ-321" name="Domažlice" parent="PL"/> + <iso_3166_2_entry + code="CZ-802" name="Frýdek Místek" parent="MO"/> + <iso_3166_2_entry + code="CZ-611" name="Havlíčkův Brod" parent="VY"/> + <iso_3166_2_entry + code="CZ-625" name="Hodonín" parent="JM"/> + <iso_3166_2_entry + code="CZ-521" name="Hradec Králové" parent="KR"/> + <iso_3166_2_entry + code="CZ-411" name="Cheb" parent="KA"/> + <iso_3166_2_entry + code="CZ-422" name="Chomutov" parent="US"/> + <iso_3166_2_entry + code="CZ-531" name="Chrudim" parent="PA"/> + <iso_3166_2_entry + code="CZ-512" name="Jablonec nad Nisou" parent="LI"/> + <iso_3166_2_entry + code="CZ-711" name="Jeseník" parent="OL"/> + <iso_3166_2_entry + code="CZ-522" name="Jičín" parent="KR"/> + <iso_3166_2_entry + code="CZ-612" name="Jihlava" parent="VY"/> + <iso_3166_2_entry + code="CZ-313" name="Jindřichův Hradec" parent="JC"/> + <iso_3166_2_entry + code="CZ-412" name="Karlovy Vary" parent="KA"/> + <iso_3166_2_entry + code="CZ-803" name="Karviná" parent="MO"/> + <iso_3166_2_entry + code="CZ-203" name="Kladno" parent="ST"/> + <iso_3166_2_entry + code="CZ-322" name="Klatovy" parent="PL"/> + <iso_3166_2_entry + code="CZ-204" name="Kolín" parent="ST"/> + <iso_3166_2_entry + code="CZ-721" name="Kromĕříž" parent="ZL"/> + <iso_3166_2_entry + code="CZ-205" name="Kutná Hora" parent="ST"/> + <iso_3166_2_entry + code="CZ-513" name="Liberec" parent="LI"/> + <iso_3166_2_entry + code="CZ-423" name="Litoměřice" parent="US"/> + <iso_3166_2_entry + code="CZ-424" name="Louny" parent="US"/> + <iso_3166_2_entry + code="CZ-206" name="Mělník" parent="ST"/> + <iso_3166_2_entry + code="CZ-207" name="Mladá Boleslav" parent="ST"/> + <iso_3166_2_entry + code="CZ-425" name="Most" parent="US"/> + <iso_3166_2_entry + code="CZ-523" name="Náchod" parent="KR"/> + <iso_3166_2_entry + code="CZ-804" name="Nový Jičín" parent="MO"/> + <iso_3166_2_entry + code="CZ-208" name="Nymburk" parent="ST"/> + <iso_3166_2_entry + code="CZ-712" name="Olomouc" parent="OL"/> + <iso_3166_2_entry + code="CZ-805" name="Opava" parent="MO"/> + <iso_3166_2_entry + code="CZ-806" name="Ostrava město" parent="MO"/> + <iso_3166_2_entry + code="CZ-532" name="Pardubice" parent="PA"/> + <iso_3166_2_entry + code="CZ-613" name="Pelhřimov" parent="VY"/> + <iso_3166_2_entry + code="CZ-314" name="Písek" parent="JC"/> + <iso_3166_2_entry + code="CZ-324" name="Plzeň jih" parent="PL"/> + <iso_3166_2_entry + code="CZ-323" name="Plzeň město" parent="PL"/> + <iso_3166_2_entry + code="CZ-325" name="Plzeň sever" parent="PL"/> + <iso_3166_2_entry + code="CZ-101" name="Praha 1" parent="PR"/> + <iso_3166_2_entry + code="CZ-102" name="Praha 2" parent="PR"/> + <iso_3166_2_entry + code="CZ-103" name="Praha 3" parent="PR"/> + <iso_3166_2_entry + code="CZ-104" name="Praha 4" parent="PR"/> + <iso_3166_2_entry + code="CZ-105" name="Praha 5" parent="PR"/> + <iso_3166_2_entry + code="CZ-106" name="Praha 6" parent="PR"/> + <iso_3166_2_entry + code="CZ-107" name="Praha 7" parent="PR"/> + <iso_3166_2_entry + code="CZ-108" name="Praha 8" parent="PR"/> + <iso_3166_2_entry + code="CZ-109" name="Praha 9" parent="PR"/> + <iso_3166_2_entry + code="CZ-10A" name="Praha 10" parent="PR"/> + <iso_3166_2_entry + code="CZ-10B" name="Praha 11" parent="PR"/> + <iso_3166_2_entry + code="CZ-10C" name="Praha 12" parent="PR"/> + <iso_3166_2_entry + code="CZ-10D" name="Praha 13" parent="PR"/> + <iso_3166_2_entry + code="CZ-10E" name="Praha 14" parent="PR"/> + <iso_3166_2_entry + code="CZ-10F" name="Praha 15" parent="PR"/> + <iso_3166_2_entry + code="CZ-209" name="Praha východ" parent="ST"/> + <iso_3166_2_entry + code="CZ-20A" name="Praha západ" parent="ST"/> + <iso_3166_2_entry + code="CZ-315" name="Prachatice" parent="JC"/> + <iso_3166_2_entry + code="CZ-713" name="Prostĕjov" parent="OL"/> + <iso_3166_2_entry + code="CZ-714" name="Přerov" parent="OL"/> + <iso_3166_2_entry + code="CZ-20B" name="Příbram" parent="ST"/> + <iso_3166_2_entry + code="CZ-20C" name="Rakovník" parent="ST"/> + <iso_3166_2_entry + code="CZ-326" name="Rokycany" parent="PL"/> + <iso_3166_2_entry + code="CZ-524" name="Rychnov nad Kněžnou" parent="KR"/> + <iso_3166_2_entry + code="CZ-514" name="Semily" parent="LI"/> + <iso_3166_2_entry + code="CZ-413" name="Sokolov" parent="KA"/> + <iso_3166_2_entry + code="CZ-316" name="Strakonice" parent="JC"/> + <iso_3166_2_entry + code="CZ-533" name="Svitavy" parent="PA"/> + <iso_3166_2_entry + code="CZ-715" name="Šumperk" parent="OL"/> + <iso_3166_2_entry + code="CZ-317" name="Tábor" parent="JC"/> + <iso_3166_2_entry + code="CZ-327" name="Tachov" parent="PL"/> + <iso_3166_2_entry + code="CZ-426" name="Teplice" parent="US"/> + <iso_3166_2_entry + code="CZ-525" name="Trutnov" parent="KR"/> + <iso_3166_2_entry + code="CZ-614" name="Třebíč" parent="VY"/> + <iso_3166_2_entry + code="CZ-722" name="Uherské Hradištĕ" parent="ZL"/> + <iso_3166_2_entry + code="CZ-427" name="Ústí nad Labem" parent="US"/> + <iso_3166_2_entry + code="CZ-534" name="Ústí nad Orlicí" parent="PA"/> + <iso_3166_2_entry + code="CZ-723" name="Vsetín" parent="ZL"/> + <iso_3166_2_entry + code="CZ-626" name="Vyškov" parent="JM"/> + <iso_3166_2_entry + code="CZ-724" name="Zlín" parent="ZL"/> + <iso_3166_2_entry + code="CZ-627" name="Znojmo" parent="JM"/> + <iso_3166_2_entry + code="CZ-615" name="Žd’ár nad Sázavou" parent="VY"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Germany --> + <iso_3166_country code="DE"> + <iso_3166_subset type="State"> + <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> + <iso_3166_2_entry + code="DE-BW" name="Baden-Württemberg"/> + <iso_3166_2_entry + code="DE-BY" name="Bayern"/> + <iso_3166_2_entry + code="DE-HB" name="Bremen"/> + <iso_3166_2_entry + code="DE-HH" name="Hamburg"/> + <iso_3166_2_entry + code="DE-HE" name="Hessen"/> + <iso_3166_2_entry + code="DE-NI" name="Niedersachsen"/> + <iso_3166_2_entry + code="DE-NW" name="Nordrhein-Westfalen"/> + <iso_3166_2_entry + code="DE-RP" name="Rheinland-Pfalz"/> + <iso_3166_2_entry + code="DE-SL" name="Saarland"/> + <iso_3166_2_entry + code="DE-SH" name="Schleswig-Holstein"/> + <iso_3166_2_entry + code="DE-BE" name="Berlin"/> + <iso_3166_2_entry + code="DE-BB" name="Brandenburg"/> + <iso_3166_2_entry + code="DE-MV" name="Mecklenburg-Vorpommern"/> + <iso_3166_2_entry + code="DE-SN" name="Sachsen"/> + <iso_3166_2_entry + code="DE-ST" name="Sachsen-Anhalt"/> + <iso_3166_2_entry + code="DE-TH" name="Thüringen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Djibouti --> + <iso_3166_country code="DJ"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="DJ-AS" name="Ali Sabieh"/> + <iso_3166_2_entry + code="DJ-AR" name="Arta"/> + <iso_3166_2_entry + code="DJ-DI" name="Dikhil"/> + <iso_3166_2_entry + code="DJ-OB" name="Obock"/> + <iso_3166_2_entry + code="DJ-TA" name="Tadjourah"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="DJ-DJ" name="Djibouti"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Denmark --> + <iso_3166_country code="DK"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="DK-81" name="Nordjylland"/> + <iso_3166_2_entry + code="DK-82" name="Midtjylland"/> + <iso_3166_2_entry + code="DK-83" name="Syddanmark"/> + <iso_3166_2_entry + code="DK-84" name="Hovedstaden"/> + <iso_3166_2_entry + code="DK-85" name="Sjælland"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Dominica --> + <iso_3166_country code="DM"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="DM-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="DM-03" name="Saint David"/> + <iso_3166_2_entry + code="DM-04" name="Saint George"/> + <iso_3166_2_entry + code="DM-05" name="Saint John"/> + <iso_3166_2_entry + code="DM-06" name="Saint Joseph"/> + <iso_3166_2_entry + code="DM-07" name="Saint Luke"/> + <iso_3166_2_entry + code="DM-08" name="Saint Mark"/> + <iso_3166_2_entry + code="DM-09" name="Saint Patrick"/> + <iso_3166_2_entry + code="DM-10" name="Saint Paul"/> + <iso_3166_2_entry + code="DM-01" name="Saint Peter"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Dominican Republic --> + <iso_3166_country code="DO"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="DO-01" name="Distrito Nacional (Santo Domingo)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="DO-02" name="Azua"/> + <iso_3166_2_entry + code="DO-03" name="Bahoruco"/> + <iso_3166_2_entry + code="DO-04" name="Barahona"/> + <iso_3166_2_entry + code="DO-05" name="Dajabón"/> + <iso_3166_2_entry + code="DO-06" name="Duarte"/> + <iso_3166_2_entry + code="DO-08" name="El Seybo [El Seibo]"/> + <iso_3166_2_entry + code="DO-09" name="Espaillat"/> + <iso_3166_2_entry + code="DO-30" name="Hato Mayor"/> + <iso_3166_2_entry + code="DO-10" name="Independencia"/> + <iso_3166_2_entry + code="DO-11" name="La Altagracia"/> + <iso_3166_2_entry + code="DO-07" name="La Estrelleta [Elías Piña]"/> + <iso_3166_2_entry + code="DO-12" name="La Romana"/> + <iso_3166_2_entry + code="DO-13" name="La Vega"/> + <iso_3166_2_entry + code="DO-14" name="María Trinidad Sánchez"/> + <iso_3166_2_entry + code="DO-28" name="Monseñor Nouel"/> + <iso_3166_2_entry + code="DO-15" name="Monte Cristi"/> + <iso_3166_2_entry + code="DO-29" name="Monte Plata"/> + <iso_3166_2_entry + code="DO-16" name="Pedernales"/> + <iso_3166_2_entry + code="DO-17" name="Peravia"/> + <iso_3166_2_entry + code="DO-18" name="Puerto Plata"/> + <iso_3166_2_entry + code="DO-19" name="Salcedo"/> + <iso_3166_2_entry + code="DO-20" name="Samaná"/> + <iso_3166_2_entry + code="DO-21" name="San Cristóbal"/> + <iso_3166_2_entry + code="DO-22" name="San Juan"/> + <iso_3166_2_entry + code="DO-23" name="San Pedro de Macorís"/> + <iso_3166_2_entry + code="DO-24" name="Sánchez Ramírez"/> + <iso_3166_2_entry + code="DO-25" name="Santiago"/> + <iso_3166_2_entry + code="DO-26" name="Santiago Rodríguez"/> + <iso_3166_2_entry + code="DO-27" name="Valverde"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Algeria --> + <iso_3166_country code="DZ"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="DZ-01" name="Adrar"/> + <iso_3166_2_entry + code="DZ-44" name="Aïn Defla"/> + <iso_3166_2_entry + code="DZ-46" name="Aïn Témouchent"/> + <iso_3166_2_entry + code="DZ-16" name="Alger"/> + <iso_3166_2_entry + code="DZ-23" name="Annaba"/> + <iso_3166_2_entry + code="DZ-05" name="Batna"/> + <iso_3166_2_entry + code="DZ-08" name="Béchar"/> + <iso_3166_2_entry + code="DZ-06" name="Béjaïa"/> + <iso_3166_2_entry + code="DZ-07" name="Biskra"/> + <iso_3166_2_entry + code="DZ-09" name="Blida"/> + <iso_3166_2_entry + code="DZ-34" name="Bordj Bou Arréridj"/> + <iso_3166_2_entry + code="DZ-10" name="Bouira"/> + <iso_3166_2_entry + code="DZ-35" name="Boumerdès"/> + <iso_3166_2_entry + code="DZ-02" name="Chlef"/> + <iso_3166_2_entry + code="DZ-25" name="Constantine"/> + <iso_3166_2_entry + code="DZ-17" name="Djelfa"/> + <iso_3166_2_entry + code="DZ-32" name="El Bayadh"/> + <iso_3166_2_entry + code="DZ-39" name="El Oued"/> + <iso_3166_2_entry + code="DZ-36" name="El Tarf"/> + <iso_3166_2_entry + code="DZ-47" name="Ghardaïa"/> + <iso_3166_2_entry + code="DZ-24" name="Guelma"/> + <iso_3166_2_entry + code="DZ-33" name="Illizi"/> + <iso_3166_2_entry + code="DZ-18" name="Jijel"/> + <iso_3166_2_entry + code="DZ-40" name="Khenchela"/> + <iso_3166_2_entry + code="DZ-03" name="Laghouat"/> + <iso_3166_2_entry + code="DZ-29" name="Mascara"/> + <iso_3166_2_entry + code="DZ-26" name="Médéa"/> + <iso_3166_2_entry + code="DZ-43" name="Mila"/> + <iso_3166_2_entry + code="DZ-27" name="Mostaganem"/> + <iso_3166_2_entry + code="DZ-28" name="Msila"/> + <iso_3166_2_entry + code="DZ-45" name="Naama"/> + <iso_3166_2_entry + code="DZ-31" name="Oran"/> + <iso_3166_2_entry + code="DZ-30" name="Ouargla"/> + <iso_3166_2_entry + code="DZ-04" name="Oum el Bouaghi"/> + <iso_3166_2_entry + code="DZ-48" name="Relizane"/> + <iso_3166_2_entry + code="DZ-20" name="Saïda"/> + <iso_3166_2_entry + code="DZ-19" name="Sétif"/> + <iso_3166_2_entry + code="DZ-22" name="Sidi Bel Abbès"/> + <iso_3166_2_entry + code="DZ-21" name="Skikda"/> + <iso_3166_2_entry + code="DZ-41" name="Souk Ahras"/> + <iso_3166_2_entry + code="DZ-11" name="Tamanghasset"/> + <iso_3166_2_entry + code="DZ-12" name="Tébessa"/> + <iso_3166_2_entry + code="DZ-14" name="Tiaret"/> + <iso_3166_2_entry + code="DZ-37" name="Tindouf"/> + <iso_3166_2_entry + code="DZ-42" name="Tipaza"/> + <iso_3166_2_entry + code="DZ-38" name="Tissemsilt"/> + <iso_3166_2_entry + code="DZ-15" name="Tizi Ouzou"/> + <iso_3166_2_entry + code="DZ-13" name="Tlemcen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ecuador --> + <iso_3166_country code="EC"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="EC-A" name="Azuay"/> + <iso_3166_2_entry + code="EC-B" name="Bolívar"/> + <iso_3166_2_entry + code="EC-F" name="Cañar"/> + <iso_3166_2_entry + code="EC-C" name="Carchi"/> + <iso_3166_2_entry + code="EC-X" name="Cotopaxi"/> + <iso_3166_2_entry + code="EC-H" name="Chimborazo"/> + <iso_3166_2_entry + code="EC-O" name="El Oro"/> + <iso_3166_2_entry + code="EC-E" name="Esmeraldas"/> + <iso_3166_2_entry + code="EC-W" name="Galápagos"/> + <iso_3166_2_entry + code="EC-G" name="Guayas"/> + <iso_3166_2_entry + code="EC-I" name="Imbabura"/> + <iso_3166_2_entry + code="EC-L" name="Loja"/> + <iso_3166_2_entry + code="EC-R" name="Los Ríos"/> + <iso_3166_2_entry + code="EC-M" name="Manabí"/> + <iso_3166_2_entry + code="EC-S" name="Morona-Santiago"/> + <iso_3166_2_entry + code="EC-N" name="Napo"/> + <iso_3166_2_entry + code="EC-D" name="Orellana"/> + <iso_3166_2_entry + code="EC-Y" name="Pastaza"/> + <iso_3166_2_entry + code="EC-P" name="Pichincha"/> + <iso_3166_2_entry + code="EC-SE" name="Santa Elena"/> + <iso_3166_2_entry + code="EC-SD" name="Santo Domingo de los Tsáchilas"/> + <iso_3166_2_entry + code="EC-U" name="Sucumbíos"/> + <iso_3166_2_entry + code="EC-T" name="Tungurahua"/> + <iso_3166_2_entry + code="EC-Z" name="Zamora-Chinchipe"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Estonia --> + <iso_3166_country code="EE"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="EE-37" name="Harjumaa"/> + <iso_3166_2_entry + code="EE-39" name="Hiiumaa"/> + <iso_3166_2_entry + code="EE-44" name="Ida-Virumaa"/> + <iso_3166_2_entry + code="EE-49" name="Jõgevamaa"/> + <iso_3166_2_entry + code="EE-51" name="Järvamaa"/> + <iso_3166_2_entry + code="EE-57" name="Läänemaa"/> + <iso_3166_2_entry + code="EE-59" name="Lääne-Virumaa"/> + <iso_3166_2_entry + code="EE-65" name="Põlvamaa"/> + <iso_3166_2_entry + code="EE-67" name="Pärnumaa"/> + <iso_3166_2_entry + code="EE-70" name="Raplamaa"/> + <iso_3166_2_entry + code="EE-74" name="Saaremaa"/> + <iso_3166_2_entry + code="EE-78" name="Tartumaa"/> + <iso_3166_2_entry + code="EE-82" name="Valgamaa"/> + <iso_3166_2_entry + code="EE-84" name="Viljandimaa"/> + <iso_3166_2_entry + code="EE-86" name="Võrumaa"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Egypt --> + <iso_3166_country code="EG"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="EG-DK" name="Ad Daqahlīyah"/> + <iso_3166_2_entry + code="EG-BA" name="Al Bahr al Ahmar"/> + <iso_3166_2_entry + code="EG-BH" name="Al Buhayrah"/> + <iso_3166_2_entry + code="EG-FYM" name="Al Fayyūm"/> + <iso_3166_2_entry + code="EG-GH" name="Al Gharbīyah"/> + <iso_3166_2_entry + code="EG-ALX" name="Al Iskandarīyah"/> + <iso_3166_2_entry + code="EG-IS" name="Al Ismā`īlīyah"/> + <iso_3166_2_entry + code="EG-GZ" name="Al Jīzah"/> + <iso_3166_2_entry + code="EG-MNF" name="Al Minūfīyah"/> + <iso_3166_2_entry + code="EG-MN" name="Al Minyā"/> + <iso_3166_2_entry + code="EG-C" name="Al Qāhirah"/> + <iso_3166_2_entry + code="EG-KB" name="Al Qalyūbīyah"/> + <iso_3166_2_entry + code="EG-WAD" name="Al Wādī al Jadīd"/> + <iso_3166_2_entry + code="EG-SU" name="As Sādis min Uktūbar"/> + <iso_3166_2_entry + code="EG-SHR" name="Ash Sharqīyah"/> + <iso_3166_2_entry + code="EG-SUZ" name="As Suways"/> + <iso_3166_2_entry + code="EG-ASN" name="Aswān"/> + <iso_3166_2_entry + code="EG-AST" name="Asyūt"/> + <iso_3166_2_entry + code="EG-BNS" name="Banī Suwayf"/> + <iso_3166_2_entry + code="EG-PTS" name="Būr Sa`īd"/> + <iso_3166_2_entry + code="EG-DT" name="Dumyāt"/> + <iso_3166_2_entry + code="EG-HU" name="Ḩulwān"/> + <iso_3166_2_entry + code="EG-JS" name="Janūb Sīnā'"/> + <iso_3166_2_entry + code="EG-KFS" name="Kafr ash Shaykh"/> + <iso_3166_2_entry + code="EG-MT" name="Matrūh"/> + <iso_3166_2_entry + code="EG-KN" name="Qinā"/> + <iso_3166_2_entry + code="EG-SIN" name="Shamal Sīnā'"/> + <iso_3166_2_entry + code="EG-SHG" name="Sūhāj"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Eritrea --> + <iso_3166_country code="ER"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ER-AN" name="Anseba"/> + <iso_3166_2_entry + code="ER-DU" name="Debub"/> + <iso_3166_2_entry + code="ER-DK" name="Debubawi Keyih Bahri [Debub-Keih-Bahri]"/> + <iso_3166_2_entry + code="ER-GB" name="Gash-Barka"/> + <iso_3166_2_entry + code="ER-MA" name="Maakel [Maekel]"/> + <iso_3166_2_entry + code="ER-SK" name="Semenawi Keyih Bahri [Semien-Keih-Bahri]"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Spain --> + <iso_3166_country code="ES"> + <iso_3166_subset type="Autonomous community"> + <iso_3166_2_entry + code="ES-AN" name="Andalucía"/> + <iso_3166_2_entry + code="ES-AR" name="Aragón"/> + <iso_3166_2_entry + code="ES-AS" name="Asturias, Principado de"/> + <iso_3166_2_entry + code="ES-CN" name="Canarias"/> + <iso_3166_2_entry + code="ES-CB" name="Cantabria"/> + <iso_3166_2_entry + code="ES-CM" name="Castilla-La Mancha"/> + <iso_3166_2_entry + code="ES-CL" name="Castilla y León"/> + <iso_3166_2_entry + code="ES-CT" name="Catalunya"/> + <iso_3166_2_entry + code="ES-EX" name="Extremadura"/> + <iso_3166_2_entry + code="ES-GA" name="Galicia"/> + <iso_3166_2_entry + code="ES-PM" name="Illes Balears"/> + <iso_3166_2_entry + code="ES-RI" name="La Rioja"/> + <iso_3166_2_entry + code="ES-MD" name="Madrid, Comunidad de"/> + <iso_3166_2_entry + code="ES-MC" name="Murcia, Región de"/> + <iso_3166_2_entry + code="ES-NC" name="Navarra, Comunidad Foral de / Nafarroako Foru Komunitatea"/> + <iso_3166_2_entry + code="ES-PV" name="País Vasco / Euskal Herria"/> + <iso_3166_2_entry + code="ES-VC" name="Valenciana, Comunidad / Valenciana, Comunitat "/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ES-C" name="A Coruña" parent="GA"/> + <iso_3166_2_entry + code="ES-VI" name="Álava" parent="PV"/> + <iso_3166_2_entry + code="ES-AB" name="Albacete" parent="CM"/> + <iso_3166_2_entry + code="ES-A" name="Alicante" parent="VC"/> + <iso_3166_2_entry + code="ES-AL" name="Almería" parent="AN"/> + <iso_3166_2_entry + code="ES-O" name="Asturias" parent="AS"/> + <iso_3166_2_entry + code="ES-AV" name="Ávila" parent="CL"/> + <iso_3166_2_entry + code="ES-BA" name="Badajoz" parent="EX"/> + <iso_3166_2_entry + code="ES-IB" name="Balears" parent="IB"/> + <iso_3166_2_entry + code="ES-B" name="Barcelona" parent="CT"/> + <iso_3166_2_entry + code="ES-BU" name="Burgos" parent="CL"/> + <iso_3166_2_entry + code="ES-CC" name="Cáceres" parent="EX"/> + <iso_3166_2_entry + code="ES-CA" name="Cádiz" parent="AN"/> + <iso_3166_2_entry + code="ES-S" name="Cantabria" parent="CB"/> + <iso_3166_2_entry + code="ES-CS" name="Castellón" parent="VC"/> + <iso_3166_2_entry + code="ES-CR" name="Ciudad Real" parent="CM"/> + <iso_3166_2_entry + code="ES-CO" name="Córdoba" parent="AN"/> + <iso_3166_2_entry + code="ES-CU" name="Cuenca" parent="CM"/> + <iso_3166_2_entry + code="ES-GI" name="Girona" parent="CT"/> + <iso_3166_2_entry + code="ES-GR" name="Granada" parent="AN"/> + <iso_3166_2_entry + code="ES-GU" name="Guadalajara" parent="CM"/> + <iso_3166_2_entry + code="ES-SS" name="Guipúzcoa / Gipuzkoa" parent="PV"/> + <iso_3166_2_entry + code="ES-H" name="Huelva" parent="AN"/> + <iso_3166_2_entry + code="ES-HU" name="Huesca" parent="AR"/> + <iso_3166_2_entry + code="ES-J" name="Jaén" parent="AN"/> + <iso_3166_2_entry + code="ES-LO" name="La Rioja" parent="RI"/> + <iso_3166_2_entry + code="ES-GC" name="Las Palmas" parent="CN"/> + <iso_3166_2_entry + code="ES-LE" name="León" parent="CL"/> + <iso_3166_2_entry + code="ES-L" name="Lleida" parent="CT"/> + <iso_3166_2_entry + code="ES-LU" name="Lugo" parent="GA"/> + <iso_3166_2_entry + code="ES-M" name="Madrid" parent="MD"/> + <iso_3166_2_entry + code="ES-MA" name="Málaga" parent="AN"/> + <iso_3166_2_entry + code="ES-MU" name="Murcia" parent="MC"/> + <iso_3166_2_entry + code="ES-NA" name="Navarra / Nafarroa" parent="NC"/> + <iso_3166_2_entry + code="ES-OR" name="Ourense" parent="GA"/> + <iso_3166_2_entry + code="ES-P" name="Palencia" parent="CL"/> + <iso_3166_2_entry + code="ES-PO" name="Pontevedra" parent="GA"/> + <iso_3166_2_entry + code="ES-SA" name="Salamanca" parent="CL"/> + <iso_3166_2_entry + code="ES-TF" name="Santa Cruz de Tenerife" parent="CN"/> + <iso_3166_2_entry + code="ES-SG" name="Segovia" parent="CL"/> + <iso_3166_2_entry + code="ES-SE" name="Sevilla" parent="AN"/> + <iso_3166_2_entry + code="ES-SO" name="Soria" parent="CL"/> + <iso_3166_2_entry + code="ES-T" name="Tarragona" parent="CT"/> + <iso_3166_2_entry + code="ES-TE" name="Teruel" parent="AR"/> + <iso_3166_2_entry + code="ES-TO" name="Toledo" parent="CM"/> + <iso_3166_2_entry + code="ES-V" name="Valencia / València" parent="VC"/> + <iso_3166_2_entry + code="ES-VA" name="Valladolid" parent="CL"/> + <iso_3166_2_entry + code="ES-BI" name="Vizcayaa / Bizkaia" parent="PV"/> + <iso_3166_2_entry + code="ES-ZA" name="Zamora" parent="CL"/> + <iso_3166_2_entry + code="ES-Z" name="Zaragoza" parent="AR"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous city"> + <iso_3166_2_entry + code="ES-CE" name="Ceuta"/> + <iso_3166_2_entry + code="ES-ML" name="Melilla"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ethiopia --> + <iso_3166_country code="ET"> + <iso_3166_subset type="Administration"> + <iso_3166_2_entry + code="ET-AA" name="Ādīs Ābeba"/> + <iso_3166_2_entry + code="ET-DD" name="Dirē Dawa"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="ET-AF" name="Āfar"/> + <iso_3166_2_entry + code="ET-AM" name="Āmara"/> + <iso_3166_2_entry + code="ET-BE" name="Bīnshangul Gumuz"/> + <iso_3166_2_entry + code="ET-GA" name="Gambēla Hizboch"/> + <iso_3166_2_entry + code="ET-HA" name="Hārerī Hizb"/> + <iso_3166_2_entry + code="ET-OR" name="Oromīya"/> + <iso_3166_2_entry + code="ET-SO" name="Sumalē"/> + <iso_3166_2_entry + code="ET-TI" name="Tigray"/> + <iso_3166_2_entry + code="ET-SN" name="YeDebub Bihēroch Bihēreseboch na Hizboch"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Finland --> + <iso_3166_country code="FI"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="FI-AL" name="Ahvenanmaan lääni"/> + <iso_3166_2_entry + code="FI-ES" name="Etelä-Suomen lääni"/> + <iso_3166_2_entry + code="FI-IS" name="Itä-Suomen lääni"/> + <iso_3166_2_entry + code="FI-LL" name="Lapin lääni"/> + <iso_3166_2_entry + code="FI-LS" name="Länsi-Suomen lääni"/> + <iso_3166_2_entry + code="FI-OL" name="Oulun lääni"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Fiji --> + <iso_3166_country code="FJ"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="FJ-C" name="Central"/> + <iso_3166_2_entry + code="FJ-E" name="Eastern"/> + <iso_3166_2_entry + code="FJ-N" name="Northern"/> + <iso_3166_2_entry + code="FJ-W" name="Western"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="FJ-R" name="Rotuma"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Federated States of Micronesia --> + <iso_3166_country code="FM"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="FM-TRK" name="Chuuk"/> + <iso_3166_2_entry + code="FM-KSA" name="Kosrae"/> + <iso_3166_2_entry + code="FM-PNI" name="Pohnpei"/> + <iso_3166_2_entry + code="FM-YAP" name="Yap"/> + </iso_3166_subset> + </iso_3166_country> + <!-- France --> + <iso_3166_country code="FR"> + <iso_3166_subset type="Metropolitan region"> + <iso_3166_2_entry + code="FR-A" name="Alsace"/> + <iso_3166_2_entry + code="FR-B" name="Aquitaine"/> + <iso_3166_2_entry + code="FR-C" name="Auvergne"/> + <iso_3166_2_entry + code="FR-P" name="Basse-Normandie"/> + <iso_3166_2_entry + code="FR-D" name="Bourgogne"/> + <iso_3166_2_entry + code="FR-E" name="Bretagne"/> + <iso_3166_2_entry + code="FR-F" name="Centre"/> + <iso_3166_2_entry + code="FR-G" name="Champagne-Ardenne"/> + <iso_3166_2_entry + code="FR-H" name="Corse"/> + <iso_3166_2_entry + code="FR-I" name="Franche-Comté"/> + <iso_3166_2_entry + code="FR-Q" name="Haute-Normandie"/> + <iso_3166_2_entry + code="FR-J" name="Île-de-France"/> + <iso_3166_2_entry + code="FR-K" name="Languedoc-Roussillon"/> + <iso_3166_2_entry + code="FR-L" name="Limousin"/> + <iso_3166_2_entry + code="FR-M" name="Lorraine"/> + <iso_3166_2_entry + code="FR-N" name="Midi-Pyrénées"/> + <iso_3166_2_entry + code="FR-O" name="Nord - Pas-de-Calais"/> + <iso_3166_2_entry + code="FR-R" name="Pays de la Loire"/> + <iso_3166_2_entry + code="FR-S" name="Picardie"/> + <iso_3166_2_entry + code="FR-T" name="Poitou-Charentes"/> + <iso_3166_2_entry + code="FR-U" name="Provence-Alpes-Côte d'Azur"/> + <iso_3166_2_entry + code="FR-V" name="Rhône-Alpes"/> + </iso_3166_subset> + <iso_3166_subset type="Overseas region/department"> + <iso_3166_2_entry + code="FR-GP" name="Guadeloupe"/> + <iso_3166_2_entry + code="FR-GF" name="Guyane"/> + <iso_3166_2_entry + code="FR-MQ" name="Martinique"/> + <iso_3166_2_entry + code="FR-RE" name="Réunion"/> + </iso_3166_subset> + <iso_3166_subset type="Metropolitan department"> + <iso_3166_2_entry + code="FR-01" name="Ain" parent="V"/> + <iso_3166_2_entry + code="FR-02" name="Aisne" parent="S"/> + <iso_3166_2_entry + code="FR-03" name="Allier" parent="C"/> + <iso_3166_2_entry + code="FR-04" name="Alpes-de-Haute-Provence" parent="U"/> + <iso_3166_2_entry + code="FR-06" name="Alpes-Maritimes" parent="U"/> + <iso_3166_2_entry + code="FR-07" name="Ardèche" parent="V"/> + <iso_3166_2_entry + code="FR-08" name="Ardennes" parent="G"/> + <iso_3166_2_entry + code="FR-09" name="Ariège" parent="N"/> + <iso_3166_2_entry + code="FR-10" name="Aube" parent="G"/> + <iso_3166_2_entry + code="FR-11" name="Aude" parent="K"/> + <iso_3166_2_entry + code="FR-12" name="Aveyron" parent="N"/> + <iso_3166_2_entry + code="FR-67" name="Bas-Rhin" parent="A"/> + <iso_3166_2_entry + code="FR-13" name="Bouches-du-Rhône" parent="U"/> + <iso_3166_2_entry + code="FR-14" name="Calvados" parent="P"/> + <iso_3166_2_entry + code="FR-15" name="Cantal" parent="C"/> + <iso_3166_2_entry + code="FR-16" name="Charente" parent="T"/> + <iso_3166_2_entry + code="FR-17" name="Charente-Maritime" parent="T"/> + <iso_3166_2_entry + code="FR-18" name="Cher" parent="F"/> + <iso_3166_2_entry + code="FR-19" name="Corrèze" parent="L"/> + <iso_3166_2_entry + code="FR-2A" name="Corse-du-Sud" parent="H"/> + <iso_3166_2_entry + code="FR-21" name="Côte-d'Or" parent="D"/> + <iso_3166_2_entry + code="FR-22" name="Côtes-d'Armor" parent="E"/> + <iso_3166_2_entry + code="FR-23" name="Creuse" parent="L"/> + <iso_3166_2_entry + code="FR-79" name="Deux-Sèvres" parent="T"/> + <iso_3166_2_entry + code="FR-24" name="Dordogne" parent="B"/> + <iso_3166_2_entry + code="FR-25" name="Doubs" parent="I"/> + <iso_3166_2_entry + code="FR-26" name="Drôme" parent="V"/> + <iso_3166_2_entry + code="FR-91" name="Essonne" parent="J"/> + <iso_3166_2_entry + code="FR-27" name="Eure" parent="Q"/> + <iso_3166_2_entry + code="FR-28" name="Eure-et-Loir" parent="F"/> + <iso_3166_2_entry + code="FR-29" name="Finistère" parent="E"/> + <iso_3166_2_entry + code="FR-30" name="Gard" parent="K"/> + <iso_3166_2_entry + code="FR-32" name="Gers" parent="N"/> + <iso_3166_2_entry + code="FR-33" name="Gironde" parent="B"/> + <iso_3166_2_entry + code="FR-2B" name="Haute-Corse" parent="H"/> + <iso_3166_2_entry + code="FR-31" name="Haute-Garonne" parent="N"/> + <iso_3166_2_entry + code="FR-43" name="Haute-Loire" parent="C"/> + <iso_3166_2_entry + code="FR-52" name="Haute-Marne" parent="G"/> + <iso_3166_2_entry + code="FR-05" name="Hautes-Alpes" parent="U"/> + <iso_3166_2_entry + code="FR-70" name="Haute-Saône" parent="I"/> + <iso_3166_2_entry + code="FR-74" name="Haute-Savoie" parent="V"/> + <iso_3166_2_entry + code="FR-65" name="Hautes-Pyrénées" parent="N"/> + <iso_3166_2_entry + code="FR-87" name="Haute-Vienne" parent="L"/> + <iso_3166_2_entry + code="FR-68" name="Haut-Rhin" parent="A"/> + <iso_3166_2_entry + code="FR-92" name="Hauts-de-Seine" parent="J"/> + <iso_3166_2_entry + code="FR-34" name="Hérault" parent="K"/> + <iso_3166_2_entry + code="FR-35" name="Ille-et-Vilaine" parent="E"/> + <iso_3166_2_entry + code="FR-36" name="Indre" parent="F"/> + <iso_3166_2_entry + code="FR-37" name="Indre-et-Loire" parent="F"/> + <iso_3166_2_entry + code="FR-38" name="Isère" parent="V"/> + <iso_3166_2_entry + code="FR-39" name="Jura" parent="I"/> + <iso_3166_2_entry + code="FR-40" name="Landes" parent="B"/> + <iso_3166_2_entry + code="FR-41" name="Loir-et-Cher" parent="F"/> + <iso_3166_2_entry + code="FR-42" name="Loire" parent="V"/> + <iso_3166_2_entry + code="FR-44" name="Loire-Atlantique" parent="R"/> + <iso_3166_2_entry + code="FR-45" name="Loiret" parent="F"/> + <iso_3166_2_entry + code="FR-46" name="Lot" parent="N"/> + <iso_3166_2_entry + code="FR-47" name="Lot-et-Garonne" parent="B"/> + <iso_3166_2_entry + code="FR-48" name="Lozère" parent="K"/> + <iso_3166_2_entry + code="FR-49" name="Maine-et-Loire" parent="R"/> + <iso_3166_2_entry + code="FR-50" name="Manche" parent="P"/> + <iso_3166_2_entry + code="FR-51" name="Marne" parent="G"/> + <iso_3166_2_entry + code="FR-53" name="Mayenne" parent="R"/> + <iso_3166_2_entry + code="FR-54" name="Meurthe-et-Moselle" parent="M"/> + <iso_3166_2_entry + code="FR-55" name="Meuse" parent="M"/> + <iso_3166_2_entry + code="FR-56" name="Morbihan" parent="E"/> + <iso_3166_2_entry + code="FR-57" name="Moselle" parent="M"/> + <iso_3166_2_entry + code="FR-58" name="Nièvre" parent="D"/> + <iso_3166_2_entry + code="FR-59" name="Nord" parent="O"/> + <iso_3166_2_entry + code="FR-60" name="Oise" parent="S"/> + <iso_3166_2_entry + code="FR-61" name="Orne" parent="P"/> + <iso_3166_2_entry + code="FR-75" name="Paris" parent="J"/> + <iso_3166_2_entry + code="FR-62" name="Pas-de-Calais" parent="O"/> + <iso_3166_2_entry + code="FR-63" name="Puy-de-Dôme" parent="C"/> + <iso_3166_2_entry + code="FR-64" name="Pyrénées-Atlantiques" parent="B"/> + <iso_3166_2_entry + code="FR-66" name="Pyrénées-Orientales" parent="K"/> + <iso_3166_2_entry + code="FR-69" name="Rhône" parent="V"/> + <iso_3166_2_entry + code="FR-71" name="Saône-et-Loire" parent="D"/> + <iso_3166_2_entry + code="FR-72" name="Sarthe" parent="R"/> + <iso_3166_2_entry + code="FR-73" name="Savoie" parent="V"/> + <iso_3166_2_entry + code="FR-77" name="Seine-et-Marne" parent="J"/> + <iso_3166_2_entry + code="FR-76" name="Seine-Maritime" parent="Q"/> + <iso_3166_2_entry + code="FR-93" name="Seine-Saint-Denis" parent="J"/> + <iso_3166_2_entry + code="FR-80" name="Somme" parent="S"/> + <iso_3166_2_entry + code="FR-81" name="Tarn" parent="N"/> + <iso_3166_2_entry + code="FR-82" name="Tarn-et-Garonne" parent="N"/> + <iso_3166_2_entry + code="FR-90" name="Territoire de Belfort" parent="I"/> + <iso_3166_2_entry + code="FR-94" name="Val-de-Marne" parent="J"/> + <iso_3166_2_entry + code="FR-95" name="Val d'Oise" parent="J"/> + <iso_3166_2_entry + code="FR-83" name="Var" parent="U"/> + <iso_3166_2_entry + code="FR-84" name="Vaucluse" parent="U"/> + <iso_3166_2_entry + code="FR-85" name="Vendée" parent="R"/> + <iso_3166_2_entry + code="FR-86" name="Vienne" parent="T"/> + <iso_3166_2_entry + code="FR-88" name="Vosges" parent="M"/> + <iso_3166_2_entry + code="FR-89" name="Yonne" parent="D"/> + <iso_3166_2_entry + code="FR-78" name="Yvelines" parent="J"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="FR-CP" name="Clipperton"/> + </iso_3166_subset> + <iso_3166_subset type="Overseas territorial collectivity"> + <iso_3166_2_entry + code="FR-YT" name="Mayotte"/> + <iso_3166_2_entry + code="FR-NC" name="Nouvelle-Calédonie"/> + <iso_3166_2_entry + code="FR-PF" name="Polynésie française"/> + <iso_3166_2_entry + code="FR-BL" name="Saint-Barthélemy"/> + <iso_3166_2_entry + code="FR-MF" name="Saint-Martin"/> + <iso_3166_2_entry + code="FR-PM" name="Saint-Pierre-et-Miquelon"/> + <iso_3166_2_entry + code="FR-TF" name="Terres australes françaises"/> + <iso_3166_2_entry + code="FR-WF" name="Wallis-et-Futuna"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Gabon --> + <iso_3166_country code="GA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GA-1" name="Estuaire"/> + <iso_3166_2_entry + code="GA-2" name="Haut-Ogooué"/> + <iso_3166_2_entry + code="GA-3" name="Moyen-Ogooué"/> + <iso_3166_2_entry + code="GA-4" name="Ngounié"/> + <iso_3166_2_entry + code="GA-5" name="Nyanga"/> + <iso_3166_2_entry + code="GA-6" name="Ogooué-Ivindo"/> + <iso_3166_2_entry + code="GA-7" name="Ogooué-Lolo"/> + <iso_3166_2_entry + code="GA-8" name="Ogooué-Maritime"/> + <iso_3166_2_entry + code="GA-9" name="Woleu-Ntem"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United Kingdom --> + <iso_3166_country code="GB"> + <iso_3166_subset type="Country"> + <iso_3166_2_entry + code="GB ENG" name="England"/> + <iso_3166_2_entry + code="GB SCT" name="Scotland"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GB NIR" name="Northern Ireland"/> + </iso_3166_subset> + <iso_3166_subset type="Principality"> + <iso_3166_2_entry + code="GB WLS" name="Wales"/> + </iso_3166_subset> + <iso_3166_subset type="Included for completeness"> + <iso_3166_2_entry + code="GB EAW" name="England and Wales"/> + <iso_3166_2_entry + code="GB GBN" name="Great Britain"/> + <iso_3166_2_entry + code="GB UKM" name="United Kingdom"/> + </iso_3166_subset> + <iso_3166_subset type="Two-tier county"> + <iso_3166_2_entry + code="GB-BKM" name="Buckinghamshire"/> + <iso_3166_2_entry + code="GB-CAM" name="Cambridgeshire"/> + <iso_3166_2_entry + code="GB-CMA" name="Cumbria"/> + <iso_3166_2_entry + code="GB-DBY" name="Derbyshire"/> + <iso_3166_2_entry + code="GB-DEV" name="Devon"/> + <iso_3166_2_entry + code="GB-DOR" name="Dorset"/> + <iso_3166_2_entry + code="GB-ESX" name="East Sussex"/> + <iso_3166_2_entry + code="GB-ESS" name="Essex"/> + <iso_3166_2_entry + code="GB-GLS" name="Gloucestershire"/> + <iso_3166_2_entry + code="GB-HAM" name="Hampshire"/> + <iso_3166_2_entry + code="GB-HRT" name="Hertfordshire"/> + <iso_3166_2_entry + code="GB-KEN" name="Kent"/> + <iso_3166_2_entry + code="GB-LAN" name="Lancashire"/> + <iso_3166_2_entry + code="GB-LEC" name="Leicestershire"/> + <iso_3166_2_entry + code="GB-LIN" name="Lincolnshire"/> + <iso_3166_2_entry + code="GB-NFK" name="Norfolk"/> + <iso_3166_2_entry + code="GB-NYK" name="North Yorkshire"/> + <iso_3166_2_entry + code="GB-NTH" name="Northamptonshire"/> + <iso_3166_2_entry + code="GB-NTT" name="Nottinghamshire"/> + <iso_3166_2_entry + code="GB-OXF" name="Oxfordshire"/> + <iso_3166_2_entry + code="GB-SOM" name="Somerset"/> + <iso_3166_2_entry + code="GB-STS" name="Staffordshire"/> + <iso_3166_2_entry + code="GB-SFK" name="Suffolk"/> + <iso_3166_2_entry + code="GB-SRY" name="Surrey"/> + <iso_3166_2_entry + code="GB-WAR" name="Warwickshire"/> + <iso_3166_2_entry + code="GB-WSX" name="West Sussex"/> + <iso_3166_2_entry + code="GB-WOR" name="Worcestershire"/> + </iso_3166_subset> + <iso_3166_subset type="London borough"> + <iso_3166_2_entry + code="GB-BDG" name="Barking and Dagenham"/> + <iso_3166_2_entry + code="GB-BNE" name="Barnet"/> + <iso_3166_2_entry + code="GB-BEX" name="Bexley"/> + <iso_3166_2_entry + code="GB-BEN" name="Brent"/> + <iso_3166_2_entry + code="GB-BRY" name="Bromley"/> + <iso_3166_2_entry + code="GB-CMD" name="Camden"/> + <iso_3166_2_entry + code="GB-CRY" name="Croydon"/> + <iso_3166_2_entry + code="GB-EAL" name="Ealing"/> + <iso_3166_2_entry + code="GB-ENF" name="Enfield"/> + <iso_3166_2_entry + code="GB-GRE" name="Greenwich"/> + <iso_3166_2_entry + code="GB-HCK" name="Hackney"/> + <iso_3166_2_entry + code="GB-HMF" name="Hammersmith and Fulham"/> + <iso_3166_2_entry + code="GB-HRY" name="Haringey"/> + <iso_3166_2_entry + code="GB-HRW" name="Harrow"/> + <iso_3166_2_entry + code="GB-HAV" name="Havering"/> + <iso_3166_2_entry + code="GB-HIL" name="Hillingdon"/> + <iso_3166_2_entry + code="GB-HNS" name="Hounslow"/> + <iso_3166_2_entry + code="GB-ISL" name="Islington"/> + <iso_3166_2_entry + code="GB-KEC" name="Kensington and Chelsea"/> + <iso_3166_2_entry + code="GB-KTT" name="Kingston upon Thames"/> + <iso_3166_2_entry + code="GB-LBH" name="Lambeth"/> + <iso_3166_2_entry + code="GB-LEW" name="Lewisham"/> + <iso_3166_2_entry + code="GB-MRT" name="Merton"/> + <iso_3166_2_entry + code="GB-NWM" name="Newham"/> + <iso_3166_2_entry + code="GB-RDB" name="Redbridge"/> + <iso_3166_2_entry + code="GB-RIC" name="Richmond upon Thames"/> + <iso_3166_2_entry + code="GB-SWK" name="Southwark"/> + <iso_3166_2_entry + code="GB-STN" name="Sutton"/> + <iso_3166_2_entry + code="GB-TWH" name="Tower Hamlets"/> + <iso_3166_2_entry + code="GB-WFT" name="Waltham Forest"/> + <iso_3166_2_entry + code="GB-WND" name="Wandsworth"/> + <iso_3166_2_entry + code="GB-WSM" name="Westminster"/> + </iso_3166_subset> + <iso_3166_subset type="Metropolitan district"> + <iso_3166_2_entry + code="GB-BNS" name="Barnsley"/> + <iso_3166_2_entry + code="GB-BIR" name="Birmingham"/> + <iso_3166_2_entry + code="GB-BOL" name="Bolton"/> + <iso_3166_2_entry + code="GB-BRD" name="Bradford"/> + <iso_3166_2_entry + code="GB-BUR" name="Bury"/> + <iso_3166_2_entry + code="GB-CLD" name="Calderdale"/> + <iso_3166_2_entry + code="GB-COV" name="Coventry"/> + <iso_3166_2_entry + code="GB-DNC" name="Doncaster"/> + <iso_3166_2_entry + code="GB-DUD" name="Dudley"/> + <iso_3166_2_entry + code="GB-GAT" name="Gateshead"/> + <iso_3166_2_entry + code="GB-KIR" name="Kirklees"/> + <iso_3166_2_entry + code="GB-KWL" name="Knowsley"/> + <iso_3166_2_entry + code="GB-LDS" name="Leeds"/> + <iso_3166_2_entry + code="GB-LIV" name="Liverpool"/> + <iso_3166_2_entry + code="GB-MAN" name="Manchester"/> + <iso_3166_2_entry + code="GB-NET" name="Newcastle upon Tyne"/> + <iso_3166_2_entry + code="GB-NTY" name="North Tyneside"/> + <iso_3166_2_entry + code="GB-OLD" name="Oldham"/> + <iso_3166_2_entry + code="GB-RCH" name="Rochdale"/> + <iso_3166_2_entry + code="GB-ROT" name="Rotherham"/> + <iso_3166_2_entry + code="GB-SHN" name="St. Helens"/> + <iso_3166_2_entry + code="GB-SLF" name="Salford"/> + <iso_3166_2_entry + code="GB-SAW" name="Sandwell"/> + <iso_3166_2_entry + code="GB-SFT" name="Sefton"/> + <iso_3166_2_entry + code="GB-SHF" name="Sheffield"/> + <iso_3166_2_entry + code="GB-SOL" name="Solihull"/> + <iso_3166_2_entry + code="GB-STY" name="South Tyneside"/> + <iso_3166_2_entry + code="GB-SKP" name="Stockport"/> + <iso_3166_2_entry + code="GB-SND" name="Sunderland"/> + <iso_3166_2_entry + code="GB-TAM" name="Tameside"/> + <iso_3166_2_entry + code="GB-TRF" name="Trafford"/> + <iso_3166_2_entry + code="GB-WKF" name="Wakefield"/> + <iso_3166_2_entry + code="GB-WLL" name="Walsall"/> + <iso_3166_2_entry + code="GB-WGN" name="Wigan"/> + <iso_3166_2_entry + code="GB-WRL" name="Wirral"/> + <iso_3166_2_entry + code="GB-WLV" name="Wolverhampton"/> + </iso_3166_subset> + <iso_3166_subset type="City corporation"> + <iso_3166_2_entry + code="GB-LND" name="London, City of"/> + </iso_3166_subset> + <iso_3166_subset type="Council area"> + <iso_3166_2_entry + code="GB-ABE" name="Aberdeen City"/> + <iso_3166_2_entry + code="GB-ABD" name="Aberdeenshire"/> + <iso_3166_2_entry + code="GB-ANS" name="Angus"/> + <iso_3166_2_entry + code="GB-AGB" name="Argyll and Bute"/> + <iso_3166_2_entry + code="GB-CLK" name="Clackmannanshire"/> + <iso_3166_2_entry + code="GB-DGY" name="Dumfries and Galloway"/> + <iso_3166_2_entry + code="GB-DND" name="Dundee City"/> + <iso_3166_2_entry + code="GB-EAY" name="East Ayrshire"/> + <iso_3166_2_entry + code="GB-EDU" name="East Dunbartonshire"/> + <iso_3166_2_entry + code="GB-ELN" name="East Lothian"/> + <iso_3166_2_entry + code="GB-ERW" name="East Renfrewshire"/> + <iso_3166_2_entry + code="GB-EDH" name="Edinburgh, City of"/> + <iso_3166_2_entry + code="GB-ELS" name="Eilean Siar"/> + <iso_3166_2_entry + code="GB-FAL" name="Falkirk"/> + <iso_3166_2_entry + code="GB-FIF" name="Fife"/> + <iso_3166_2_entry + code="GB-GLG" name="Glasgow City"/> + <iso_3166_2_entry + code="GB-HED" name="Highland"/> + <iso_3166_2_entry + code="GB-IVC" name="Inverclyde"/> + <iso_3166_2_entry + code="GB-MLN" name="Midlothian"/> + <iso_3166_2_entry + code="GB-MRY" name="Moray"/> + <iso_3166_2_entry + code="GB-NAY" name="North Ayrshire"/> + <iso_3166_2_entry + code="GB-NLK" name="North Lanarkshire"/> + <iso_3166_2_entry + code="GB-ORR" name="Orkney Islands"/> + <iso_3166_2_entry + code="GB-PKN" name="Perth and Kinross"/> + <iso_3166_2_entry + code="GB-RFW" name="Renfrewshire"/> + <iso_3166_2_entry + code="GB-SCB" name="Scottish Borders, The"/> + <iso_3166_2_entry + code="GB-ZET" name="Shetland Islands"/> + <iso_3166_2_entry + code="GB-SAY" name="South Ayrshire"/> + <iso_3166_2_entry + code="GB-SLK" name="South Lanarkshire"/> + <iso_3166_2_entry + code="GB-STG" name="Stirling"/> + <iso_3166_2_entry + code="GB-WDU" name="West Dunbartonshire"/> + <iso_3166_2_entry + code="GB-WLN" name="West Lothian"/> + </iso_3166_subset> + <iso_3166_subset type="District council area"> + <iso_3166_2_entry + code="GB-ANT" name="Antrim"/> + <iso_3166_2_entry + code="GB-ARD" name="Ards"/> + <iso_3166_2_entry + code="GB-ARM" name="Armagh"/> + <iso_3166_2_entry + code="GB-BLA" name="Ballymena"/> + <iso_3166_2_entry + code="GB-BLY" name="Ballymoney"/> + <iso_3166_2_entry + code="GB-BNB" name="Banbridge"/> + <iso_3166_2_entry + code="GB-BFS" name="Belfast"/> + <iso_3166_2_entry + code="GB-CKF" name="Carrickfergus"/> + <iso_3166_2_entry + code="GB-CSR" name="Castlereagh"/> + <iso_3166_2_entry + code="GB-CLR" name="Coleraine"/> + <iso_3166_2_entry + code="GB-CKT" name="Cookstown"/> + <iso_3166_2_entry + code="GB-CGV" name="Craigavon"/> + <iso_3166_2_entry + code="GB-DRY" name="Derry"/> + <iso_3166_2_entry + code="GB-DOW" name="Down"/> + <iso_3166_2_entry + code="GB-DGN" name="Dungannon"/> + <iso_3166_2_entry + code="GB-FER" name="Fermanagh"/> + <iso_3166_2_entry + code="GB-LRN" name="Larne"/> + <iso_3166_2_entry + code="GB-LMV" name="Limavady"/> + <iso_3166_2_entry + code="GB-LSB" name="Lisburn"/> + <iso_3166_2_entry + code="GB-MFT" name="Magherafelt"/> + <iso_3166_2_entry + code="GB-MYL" name="Moyle"/> + <iso_3166_2_entry + code="GB-NYM" name="Newry and Mourne"/> + <iso_3166_2_entry + code="GB-NTA" name="Newtownabbey"/> + <iso_3166_2_entry + code="GB-NDN" name="North Down"/> + <iso_3166_2_entry + code="GB-OMH" name="Omagh"/> + <iso_3166_2_entry + code="GB-STB" name="Strabane"/> + </iso_3166_subset> + <iso_3166_subset type="Unitary authority (England)"> + <iso_3166_2_entry + code="GB-BAS" name="Bath and North East Somerset"/> + <iso_3166_2_entry + code="GB-BBD" name="Blackburn with Darwen"/> + <iso_3166_2_entry + code="GB-BDF" name="Bedford"/> + <iso_3166_2_entry + code="GB-BPL" name="Blackpool"/> + <iso_3166_2_entry + code="GB-BMH" name="Bournemouth"/> + <iso_3166_2_entry + code="GB-BRC" name="Bracknell Forest"/> + <iso_3166_2_entry + code="GB-BNH" name="Brighton and Hove"/> + <iso_3166_2_entry + code="GB-BST" name="Bristol, City of"/> + <iso_3166_2_entry + code="GB-CBF" name="Central Bedfordshire"/> + <iso_3166_2_entry + code="GB-CHE" name="Cheshire East"/> + <iso_3166_2_entry + code="GB-CHW" name="Cheshire West and Chester"/> + <iso_3166_2_entry + code="GB-CON" name="Cornwall"/> + <iso_3166_2_entry + code="GB-DAL" name="Darlington"/> + <iso_3166_2_entry + code="GB-DER" name="Derby"/> + <iso_3166_2_entry + code="GB-DUR" name="Durham"/> + <iso_3166_2_entry + code="GB-ERY" name="East Riding of Yorkshire"/> + <iso_3166_2_entry + code="GB-HAL" name="Halton"/> + <iso_3166_2_entry + code="GB-HPL" name="Hartlepool"/> + <iso_3166_2_entry + code="GB-HEF" name="Herefordshire"/> + <iso_3166_2_entry + code="GB-IOW" name="Isle of Wight"/> + <iso_3166_2_entry + code="GB-KHL" name="Kingston upon Hull"/> + <iso_3166_2_entry + code="GB-LCE" name="Leicester"/> + <iso_3166_2_entry + code="GB-LUT" name="Luton"/> + <iso_3166_2_entry + code="GB-MDW" name="Medway"/> + <iso_3166_2_entry + code="GB-MDB" name="Middlesbrough"/> + <iso_3166_2_entry + code="GB-MIK" name="Milton Keynes"/> + <iso_3166_2_entry + code="GB-NEL" name="North East Lincolnshire"/> + <iso_3166_2_entry + code="GB-NLN" name="North Lincolnshire"/> + <iso_3166_2_entry + code="GB-NSM" name="North Somerset"/> + <iso_3166_2_entry + code="GB-NBL" name="Northumberland"/> + <iso_3166_2_entry + code="GB-NGM" name="Nottingham"/> + <iso_3166_2_entry + code="GB-PTE" name="Peterborough"/> + <iso_3166_2_entry + code="GB-PLY" name="Plymouth"/> + <iso_3166_2_entry + code="GB-POL" name="Poole"/> + <iso_3166_2_entry + code="GB-POR" name="Portsmouth"/> + <iso_3166_2_entry + code="GB-RDG" name="Reading"/> + <iso_3166_2_entry + code="GB-RCC" name="Redcar and Cleveland"/> + <iso_3166_2_entry + code="GB-RUT" name="Rutland"/> + <iso_3166_2_entry + code="GB-SHR" name="Shropshire"/> + <iso_3166_2_entry + code="GB-SLG" name="Slough"/> + <iso_3166_2_entry + code="GB-SGC" name="South Gloucestershire"/> + <iso_3166_2_entry + code="GB-STH" name="Southampton"/> + <iso_3166_2_entry + code="GB-SOS" name="Southend-on-Sea"/> + <iso_3166_2_entry + code="GB-STT" name="Stockton-on-Tees"/> + <iso_3166_2_entry + code="GB-STE" name="Stoke-on-Trent"/> + <iso_3166_2_entry + code="GB-SWD" name="Swindon"/> + <iso_3166_2_entry + code="GB-TFW" name="Telford and Wrekin"/> + <iso_3166_2_entry + code="GB-THR" name="Thurrock"/> + <iso_3166_2_entry + code="GB-TOB" name="Torbay"/> + <iso_3166_2_entry + code="GB-WRT" name="Warrington"/> + <iso_3166_2_entry + code="GB-WBX" name="West Berkshire"/> + <iso_3166_2_entry + code="GB-WNM" name="Windsor and Maidenhead"/> + <iso_3166_2_entry + code="GB-WOK" name="Wokingham"/> + <iso_3166_2_entry + code="GB-YOR" name="York"/> + </iso_3166_subset> + <iso_3166_subset type="Unitary authority (Wales)"> + <iso_3166_2_entry + code="GB-BGW" name="Blaenau Gwent"/> + <iso_3166_2_entry + code="GB-BGE" name="Bridgend;Pen-y-bont ar Ogwr"/> + <iso_3166_2_entry + code="GB-CAY" name="Caerphilly;Caerffili"/> + <iso_3166_2_entry + code="GB-CRF" name="Cardiff;Caerdydd"/> + <iso_3166_2_entry + code="GB-CMN" name="Carmarthenshire;Sir Gaerfyrddin"/> + <iso_3166_2_entry + code="GB-CGN" name="Ceredigion;Sir Ceredigion"/> + <iso_3166_2_entry + code="GB-CWY" name="Conwy"/> + <iso_3166_2_entry + code="GB-DEN" name="Denbighshire;Sir Ddinbych"/> + <iso_3166_2_entry + code="GB-FLN" name="Flintshire;Sir y Fflint"/> + <iso_3166_2_entry + code="GB-GWN" name="Gwynedd"/> + <iso_3166_2_entry + code="GB-AGY" name="Isle of Anglesey;Sir Ynys Môn"/> + <iso_3166_2_entry + code="GB-MTY" name="Merthyr Tydfil;Merthyr Tudful"/> + <iso_3166_2_entry + code="GB-MON" name="Monmouthshire;Sir Fynwy"/> + <iso_3166_2_entry + code="GB-NTL" name="Neath Port Talbot;Castell-nedd Port Talbot"/> + <iso_3166_2_entry + code="GB-NWP" name="Newport;Casnewydd"/> + <iso_3166_2_entry + code="GB-PEM" name="Pembrokeshire;Sir Benfro"/> + <iso_3166_2_entry + code="GB-POW" name="Powys"/> + <iso_3166_2_entry + code="GB-RCT" name="Rhondda, Cynon, Taff;Rhondda, Cynon,Taf"/> + <iso_3166_2_entry + code="GB-SWA" name="Swansea;Abertawe"/> + <iso_3166_2_entry + code="GB-TOF" name="Torfaen;Tor-faen"/> + <iso_3166_2_entry + code="GB-VGL" name="Vale of Glamorgan, The;Bro Morgannwg"/> + <iso_3166_2_entry + code="GB-WRX" name="Wrexham;Wrecsam"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Grenada --> + <iso_3166_country code="GD"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="GD-01" name="Saint Andrew"/> + <iso_3166_2_entry + code="GD-02" name="Saint David"/> + <iso_3166_2_entry + code="GD-03" name="Saint George"/> + <iso_3166_2_entry + code="GD-04" name="Saint John"/> + <iso_3166_2_entry + code="GD-05" name="Saint Mark"/> + <iso_3166_2_entry + code="GD-06" name="Saint Patrick"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="GD-10" name="Southern Grenadine Islands"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Georgia --> + <iso_3166_country code="GE"> + <iso_3166_subset type="Autonomous republic"> + <iso_3166_2_entry + code="GE-AB" name="Abkhazia"/> + <iso_3166_2_entry + code="GE-AJ" name="Ajaria"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="GE-TB" name="T’bilisi"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GE-GU" name="Guria"/> + <iso_3166_2_entry + code="GE-IM" name="Imeret’i"/> + <iso_3166_2_entry + code="GE-KA" name="Kakhet’i"/> + <iso_3166_2_entry + code="GE-KK" name="K’vemo K’art’li"/> + <iso_3166_2_entry + code="GE-MM" name="Mts’khet’a-Mt’ianet’i"/> + <iso_3166_2_entry + code="GE-RL" name="Racha-Lech’khumi-K’vemo Svanet’i"/> + <iso_3166_2_entry + code="GE-SZ" name="Samegrelo-Zemo Svanet’i"/> + <iso_3166_2_entry + code="GE-SJ" name="Samts’khe-Javakhet’i"/> + <iso_3166_2_entry + code="GE-SK" name="Shida K’art’li"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guernsey --> + <iso_3166_country code="GG"> + </iso_3166_country> + <!-- Ghana --> + <iso_3166_country code="GH"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GH-AH" name="Ashanti"/> + <iso_3166_2_entry + code="GH-BA" name="Brong-Ahafo"/> + <iso_3166_2_entry + code="GH-CP" name="Central"/> + <iso_3166_2_entry + code="GH-EP" name="Eastern"/> + <iso_3166_2_entry + code="GH-AA" name="Greater Accra"/> + <iso_3166_2_entry + code="GH-NP" name="Northern"/> + <iso_3166_2_entry + code="GH-UE" name="Upper East"/> + <iso_3166_2_entry + code="GH-UW" name="Upper West"/> + <iso_3166_2_entry + code="GH-TV" name="Volta"/> + <iso_3166_2_entry + code="GH-WP" name="Western"/> + </iso_3166_subset> + <!-- Greenland --> + <iso_3166_country code="GL"/> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="GL-KU" name="Kommune Kujalleq"/> + <iso_3166_2_entry + code="GL-SM" name="Kommuneqarfik Sermersooq"/> + <iso_3166_2_entry + code="GL-QA" name="Qaasuitsup Kommunia"/> + <iso_3166_2_entry + code="GL-QE" name="Qeqqata Kommunia"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Gambia --> + <iso_3166_country code="GM"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="GM-L" name="Lower River"/> + <iso_3166_2_entry + code="GM-M" name="Central River"/> + <iso_3166_2_entry + code="GM-N" name="North Bank"/> + <iso_3166_2_entry + code="GM-U" name="Upper River"/> + <iso_3166_2_entry + code="GM-W" name="Western"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="GM-B" name="Banjul"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guinea --> + <iso_3166_country code="GN"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="GN-B" name="Boké"/> + <iso_3166_2_entry + code="GN-F" name="Faranah"/> + <iso_3166_2_entry + code="GN-K" name="Kankan"/> + <iso_3166_2_entry + code="GN-D" name="Kindia"/> + <iso_3166_2_entry + code="GN-L" name="Labé"/> + <iso_3166_2_entry + code="GN-M" name="Mamou"/> + <iso_3166_2_entry + code="GN-N" name="Nzérékoré"/> + </iso_3166_subset> + <iso_3166_subset type="Special zone"> + <iso_3166_2_entry + code="GN C" name="Conakry"/> + </iso_3166_subset> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="GN-BE" name="Beyla" parent="N"/> + <iso_3166_2_entry + code="GN-BF" name="Boffa" parent="B"/> + <iso_3166_2_entry + code="GN-BK" name="Boké" parent="B"/> + <iso_3166_2_entry + code="GN-CO" name="Coyah" parent="D"/> + <iso_3166_2_entry + code="GN-DB" name="Dabola" parent="F"/> + <iso_3166_2_entry + code="GN-DL" name="Dalaba" parent="M"/> + <iso_3166_2_entry + code="GN-DI" name="Dinguiraye" parent="F"/> + <iso_3166_2_entry + code="GN-DU" name="Dubréka" parent="D"/> + <iso_3166_2_entry + code="GN-FA" name="Faranah" parent="F"/> + <iso_3166_2_entry + code="GN-FO" name="Forécariah" parent="D"/> + <iso_3166_2_entry + code="GN-FR" name="Fria" parent="B"/> + <iso_3166_2_entry + code="GN-GA" name="Gaoual" parent="B"/> + <iso_3166_2_entry + code="GN-GU" name="Guékédou" parent="N"/> + <iso_3166_2_entry + code="GN-KA" name="Kankan" parent="K"/> + <iso_3166_2_entry + code="GN-KE" name="Kérouané" parent="K"/> + <iso_3166_2_entry + code="GN-KD" name="Kindia" parent="D"/> + <iso_3166_2_entry + code="GN-KS" name="Kissidougou" parent="F"/> + <iso_3166_2_entry + code="GN-KB" name="Koubia" parent="L"/> + <iso_3166_2_entry + code="GN-KN" name="Koundara" parent="B"/> + <iso_3166_2_entry + code="GN-KO" name="Kouroussa" parent="K"/> + <iso_3166_2_entry + code="GN-LA" name="Labé" parent="L"/> + <iso_3166_2_entry + code="GN-LE" name="Lélouma" parent="L"/> + <iso_3166_2_entry + code="GN-LO" name="Lola" parent="N"/> + <iso_3166_2_entry + code="GN-MC" name="Macenta" parent="N"/> + <iso_3166_2_entry + code="GN-ML" name="Mali" parent="L"/> + <iso_3166_2_entry + code="GN-MM" name="Mamou" parent="M"/> + <iso_3166_2_entry + code="GN-MD" name="Mandiana" parent="K"/> + <iso_3166_2_entry + code="GN-NZ" name="Nzérékoré" parent="N"/> + <iso_3166_2_entry + code="GN-PI" name="Pita" parent="M"/> + <iso_3166_2_entry + code="GN-SI" name="Siguiri" parent="K"/> + <iso_3166_2_entry + code="GN-TE" name="Télimélé" parent="D"/> + <iso_3166_2_entry + code="GN-TO" name="Tougué" parent="L"/> + <iso_3166_2_entry + code="GN-YO" name="Yomou" parent="N"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Equatorial Guinea --> + <iso_3166_country code="GQ"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GQ-C" name="Región Continental"/> + <iso_3166_2_entry + code="GQ-I" name="Región Insular"/> + <iso_3166_2_entry + code="GQ-AN" name="Annobón"/> + <iso_3166_2_entry + code="GQ-BN" name="Bioko Norte"/> + <iso_3166_2_entry + code="GQ-BS" name="Bioko Sur"/> + <iso_3166_2_entry + code="GQ-CS" name="Centro Sur"/> + <iso_3166_2_entry + code="GQ-KN" name="Kié-Ntem"/> + <iso_3166_2_entry + code="GQ-LI" name="Litoral"/> + <iso_3166_2_entry + code="GQ-WN" name="Wele-Nzás"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Greece --> + <iso_3166_country code="GR"> + <iso_3166_subset type="Administrative region"> + <iso_3166_2_entry + code="GR-A" name="Anatoliki Makedonia kai Thraki"/> + <iso_3166_2_entry + code="GR-I" name="Attiki"/> + <iso_3166_2_entry + code="GR-G" name="Dytiki Ellada"/> + <iso_3166_2_entry + code="GR-C" name="Dytiki Makedonia"/> + <iso_3166_2_entry + code="GR-F" name="Ionia Nisia"/> + <iso_3166_2_entry + code="GR-D" name="Ipeiros"/> + <iso_3166_2_entry + code="GR-B" name="Kentriki Makedonia"/> + <iso_3166_2_entry + code="GR-M" name="Kriti"/> + <iso_3166_2_entry + code="GR-L" name="Notio Aigaio"/> + <iso_3166_2_entry + code="GR-J" name="Peloponnisos"/> + <iso_3166_2_entry + code="GR-H" name="Sterea Ellada"/> + <iso_3166_2_entry + code="GR-E" name="Thessalia"/> + <iso_3166_2_entry + code="GR-K" name="Voreio Aigaio"/> + </iso_3166_subset> + <iso_3166_subset type="Self-governed part"> + <iso_3166_2_entry + code="GR-69" name="Agio Oros"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="GR-13" name="Achaïa" parent="G"/> + <iso_3166_2_entry + code="GR-01" name="Aitolia kai Akarnania" parent="G"/> + <iso_3166_2_entry + code="GR-11" name="Argolida" parent="J"/> + <iso_3166_2_entry + code="GR-12" name="Arkadia" parent="J"/> + <iso_3166_2_entry + code="GR-31" name="Arta" parent="F"/> + <iso_3166_2_entry + code="GR-A1" name="Attiki" parent="I"/> + <iso_3166_2_entry + code="GR-64" name="Chalkidiki" parent="B"/> + <iso_3166_2_entry + code="GR-94" name="Chania" parent="M"/> + <iso_3166_2_entry + code="GR-85" name="Chios" parent="K"/> + <iso_3166_2_entry + code="GR-81" name="Dodekanisos" parent="L"/> + <iso_3166_2_entry + code="GR-52" name="Drama" parent="A"/> + <iso_3166_2_entry + code="GR-71" name="Evros" parent="A"/> + <iso_3166_2_entry + code="GR-05" name="Evrytania" parent="H"/> + <iso_3166_2_entry + code="GR-04" name="Evvoias" parent="H"/> + <iso_3166_2_entry + code="GR-63" name="Florina" parent="C"/> + <iso_3166_2_entry + code="GR-07" name="Fokida" parent="H"/> + <iso_3166_2_entry + code="GR-06" name="Fthiotida" parent="H"/> + <iso_3166_2_entry + code="GR-51" name="Grevena" parent="C"/> + <iso_3166_2_entry + code="GR-14" name="Ileia" parent="G"/> + <iso_3166_2_entry + code="GR-53" name="Imathia" parent="B"/> + <iso_3166_2_entry + code="GR-33" name="Ioannina" parent="D"/> + <iso_3166_2_entry + code="GR-91" name="Irakleio" parent="M"/> + <iso_3166_2_entry + code="GR-41" name="Karditsa" parent="E"/> + <iso_3166_2_entry + code="GR-56" name="Kastoria" parent="C"/> + <iso_3166_2_entry + code="GR-55" name="Kavala" parent="A"/> + <iso_3166_2_entry + code="GR-23" name="Kefallonia" parent="F"/> + <iso_3166_2_entry + code="GR-22" name="Kerkyra" parent="F"/> + <iso_3166_2_entry + code="GR-57" name="Kilkis" parent="B"/> + <iso_3166_2_entry + code="GR-15" name="Korinthia" parent="J"/> + <iso_3166_2_entry + code="GR-58" name="Kozani" parent="C"/> + <iso_3166_2_entry + code="GR-82" name="Kyklades" parent="L"/> + <iso_3166_2_entry + code="GR-16" name="Lakonia" parent="J"/> + <iso_3166_2_entry + code="GR-42" name="Larisa" parent="E"/> + <iso_3166_2_entry + code="GR-92" name="Lasithi" parent="M"/> + <iso_3166_2_entry + code="GR-24" name="Lefkada" parent="F"/> + <iso_3166_2_entry + code="GR-83" name="Lesvos" parent="K"/> + <iso_3166_2_entry + code="GR-43" name="Magnisia" parent="E"/> + <iso_3166_2_entry + code="GR-17" name="Messinia" parent="J"/> + <iso_3166_2_entry + code="GR-59" name="Pella" parent="B"/> + <iso_3166_2_entry + code="GR-61" name="Pieria" parent="B"/> + <iso_3166_2_entry + code="GR-34" name="Preveza" parent="D"/> + <iso_3166_2_entry + code="GR-93" name="Rethymno" parent="M"/> + <iso_3166_2_entry + code="GR-73" name="Rodopi" parent="A"/> + <iso_3166_2_entry + code="GR-84" name="Samos" parent="K"/> + <iso_3166_2_entry + code="GR-62" name="Serres" parent="B"/> + <iso_3166_2_entry + code="GR-32" name="Thesprotia" parent="D"/> + <iso_3166_2_entry + code="GR-54" name="Thessaloniki" parent="B"/> + <iso_3166_2_entry + code="GR-44" name="Trikala" parent="E"/> + <iso_3166_2_entry + code="GR-03" name="Voiotia" parent="H"/> + <iso_3166_2_entry + code="GR-72" name="Xanthi" parent="A"/> + <iso_3166_2_entry + code="GR-21" name="Zakynthos" parent="F"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guatemala --> + <iso_3166_country code="GT"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="GT-AV" name="Alta Verapaz"/> + <iso_3166_2_entry + code="GT-BV" name="Baja Verapaz"/> + <iso_3166_2_entry + code="GT-CM" name="Chimaltenango"/> + <iso_3166_2_entry + code="GT-CQ" name="Chiquimula"/> + <iso_3166_2_entry + code="GT-PR" name="El Progreso"/> + <iso_3166_2_entry + code="GT-ES" name="Escuintla"/> + <iso_3166_2_entry + code="GT-GU" name="Guatemala"/> + <iso_3166_2_entry + code="GT-HU" name="Huehuetenango"/> + <iso_3166_2_entry + code="GT-IZ" name="Izabal"/> + <iso_3166_2_entry + code="GT-JA" name="Jalapa"/> + <iso_3166_2_entry + code="GT-JU" name="Jutiapa"/> + <iso_3166_2_entry + code="GT-PE" name="Petén"/> + <iso_3166_2_entry + code="GT-QZ" name="Quetzaltenango"/> + <iso_3166_2_entry + code="GT-QC" name="Quiché"/> + <iso_3166_2_entry + code="GT-RE" name="Retalhuleu"/> + <iso_3166_2_entry + code="GT-SA" name="Sacatepéquez"/> + <iso_3166_2_entry + code="GT-SM" name="San Marcos"/> + <iso_3166_2_entry + code="GT-SR" name="Santa Rosa"/> + <iso_3166_2_entry + code="GT-SO" name="Sololá"/> + <iso_3166_2_entry + code="GT-SU" name="Suchitepéquez"/> + <iso_3166_2_entry + code="GT-TO" name="Totonicapán"/> + <iso_3166_2_entry + code="GT-ZA" name="Zacapa"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guinea-Bissau --> + <iso_3166_country code="GW"> + <iso_3166_subset type="Autonomous sector"> + <iso_3166_2_entry + code="GW-BS" name="Bissau"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GW-L" name="Leste"/> + <iso_3166_2_entry + code="GW-N" name="Norte"/> + <iso_3166_2_entry + code="GW-S" name="Sul"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GW-BA" name="Bafatá" parent="L"/> + <iso_3166_2_entry + code="GW-BM" name="Biombo" parent="N"/> + <iso_3166_2_entry + code="GW-BL" name="Bolama" parent="S"/> + <iso_3166_2_entry + code="GW-CA" name="Cacheu" parent="N"/> + <iso_3166_2_entry + code="GW-GA" name="Gabú" parent="L"/> + <iso_3166_2_entry + code="GW-OI" name="Oio" parent="N"/> + <iso_3166_2_entry + code="GW-QU" name="Quinara" parent="S"/> + <iso_3166_2_entry + code="GW-TO" name="Tombali" parent="S"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guyana --> + <iso_3166_country code="GY"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GY-BA" name="Barima-Waini"/> + <iso_3166_2_entry + code="GY-CU" name="Cuyuni-Mazaruni"/> + <iso_3166_2_entry + code="GY-DE" name="Demerara-Mahaica"/> + <iso_3166_2_entry + code="GY-EB" name="East Berbice-Corentyne"/> + <iso_3166_2_entry + code="GY-ES" name="Essequibo Islands-West Demerara"/> + <iso_3166_2_entry + code="GY-MA" name="Mahaica-Berbice"/> + <iso_3166_2_entry + code="GY-PM" name="Pomeroon-Supenaam"/> + <iso_3166_2_entry + code="GY-PT" name="Potaro-Siparuni"/> + <iso_3166_2_entry + code="GY-UD" name="Upper Demerara-Berbice"/> + <iso_3166_2_entry + code="GY-UT" name="Upper Takutu-Upper Essequibo"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Honduras --> + <iso_3166_country code="HN"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="HN-AT" name="Atlántida"/> + <iso_3166_2_entry + code="HN-CL" name="Colón"/> + <iso_3166_2_entry + code="HN-CM" name="Comayagua"/> + <iso_3166_2_entry + code="HN-CP" name="Copán"/> + <iso_3166_2_entry + code="HN-CR" name="Cortés"/> + <iso_3166_2_entry + code="HN-CH" name="Choluteca"/> + <iso_3166_2_entry + code="HN-EP" name="El Paraíso"/> + <iso_3166_2_entry + code="HN-FM" name="Francisco Morazán"/> + <iso_3166_2_entry + code="HN-GD" name="Gracias a Dios"/> + <iso_3166_2_entry + code="HN-IN" name="Intibucá"/> + <iso_3166_2_entry + code="HN-IB" name="Islas de la Bahía"/> + <iso_3166_2_entry + code="HN-LP" name="La Paz"/> + <iso_3166_2_entry + code="HN-LE" name="Lempira"/> + <iso_3166_2_entry + code="HN-OC" name="Ocotepeque"/> + <iso_3166_2_entry + code="HN-OL" name="Olancho"/> + <iso_3166_2_entry + code="HN-SB" name="Santa Bárbara"/> + <iso_3166_2_entry + code="HN-VA" name="Valle"/> + <iso_3166_2_entry + code="HN-YO" name="Yoro"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Croatia --> + <iso_3166_country code="HR"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="HR-21" name="Grad Zagreb"/> + </iso_3166_subset> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="HR-07" name="Bjelovarsko-bilogorska županija"/> + <iso_3166_2_entry + code="HR-12" name="Brodsko-posavska županija"/> + <iso_3166_2_entry + code="HR-19" name="Dubrovačko-neretvanska županija"/> + <iso_3166_2_entry + code="HR-18" name="Istarska županija"/> + <iso_3166_2_entry + code="HR-04" name="Karlovačka županija"/> + <iso_3166_2_entry + code="HR-06" name="Koprivničko-križevačka županija"/> + <iso_3166_2_entry + code="HR-02" name="Krapinsko-zagorska županija"/> + <iso_3166_2_entry + code="HR-09" name="Ličko-senjska županija"/> + <iso_3166_2_entry + code="HR-20" name="Međimurska županija"/> + <iso_3166_2_entry + code="HR-14" name="Osječko-baranjska županija"/> + <iso_3166_2_entry + code="HR-11" name="Požeško-slavonska županija"/> + <iso_3166_2_entry + code="HR-08" name="Primorsko-goranska županija"/> + <iso_3166_2_entry + code="HR-03" name="Sisačko-moslavačka županija"/> + <iso_3166_2_entry + code="HR-17" name="Splitsko-dalmatinska županija"/> + <iso_3166_2_entry + code="HR-15" name="Šibensko-kninska županija"/> + <iso_3166_2_entry + code="HR-05" name="Varaždinska županija"/> + <iso_3166_2_entry + code="HR-10" name="Virovitičko-podravska županija"/> + <iso_3166_2_entry + code="HR-16" name="Vukovarsko-srijemska županija"/> + <iso_3166_2_entry + code="HR-13" name="Zadarska županija"/> + <iso_3166_2_entry + code="HR-01" name="Zagrebačka županija"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Haiti --> + <iso_3166_country code="HT"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="HT-AR" name="Artibonite"/> + <iso_3166_2_entry + code="HT-CE" name="Centre"/> + <iso_3166_2_entry + code="HT-GA" name="Grande-Anse"/> + <iso_3166_2_entry + code="HT-ND" name="Nord"/> + <iso_3166_2_entry + code="HT-NE" name="Nord-Est"/> + <iso_3166_2_entry + code="HT-NO" name="Nord-Ouest"/> + <iso_3166_2_entry + code="HT-OU" name="Ouest"/> + <iso_3166_2_entry + code="HT-SD" name="Sud"/> + <iso_3166_2_entry + code="HT-SE" name="Sud-Est"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Hungary --> + <iso_3166_country code="HU"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="HU-BK" name="Bács-Kiskun"/> + <iso_3166_2_entry + code="HU-BA" name="Baranya"/> + <iso_3166_2_entry + code="HU-BE" name="Békés"/> + <iso_3166_2_entry + code="HU-BZ" name="Borsod-Abaúj-Zemplén"/> + <iso_3166_2_entry + code="HU-CS" name="Csongrád"/> + <iso_3166_2_entry + code="HU-FE" name="Fejér"/> + <iso_3166_2_entry + code="HU-GS" name="Győr-Moson-Sopron"/> + <iso_3166_2_entry + code="HU-HB" name="Hajdú-Bihar"/> + <iso_3166_2_entry + code="HU-HE" name="Heves"/> + <iso_3166_2_entry + code="HU-JN" name="Jász-Nagykun-Szolnok"/> + <iso_3166_2_entry + code="HU-KE" name="Komárom-Esztergom"/> + <iso_3166_2_entry + code="HU-NO" name="Nógrád"/> + <iso_3166_2_entry + code="HU-PE" name="Pest"/> + <iso_3166_2_entry + code="HU-SO" name="Somogy"/> + <iso_3166_2_entry + code="HU-SZ" name="Szabolcs-Szatmár-Bereg"/> + <iso_3166_2_entry + code="HU-TO" name="Tolna"/> + <iso_3166_2_entry + code="HU-VA" name="Vas"/> + <iso_3166_2_entry + code="HU-VE" name="Veszprém (county)"/> + <iso_3166_2_entry + code="HU-ZA" name="Zala"/> + </iso_3166_subset> + <iso_3166_subset type="City with county rights"> + <iso_3166_2_entry + code="HU-BC" name="Békéscsaba"/> + <iso_3166_2_entry + code="HU-DE" name="Debrecen"/> + <iso_3166_2_entry + code="HU-DU" name="Dunaújváros"/> + <iso_3166_2_entry + code="HU-EG" name="Eger"/> + <iso_3166_2_entry + code="HU-ER" name="Érd"/> + <iso_3166_2_entry + code="HU-GY" name="Győr"/> + <iso_3166_2_entry + code="HU-HV" name="Hódmezővásárhely"/> + <iso_3166_2_entry + code="HU-KV" name="Kaposvár"/> + <iso_3166_2_entry + code="HU-KM" name="Kecskemét"/> + <iso_3166_2_entry + code="HU-MI" name="Miskolc"/> + <iso_3166_2_entry + code="HU-NK" name="Nagykanizsa"/> + <iso_3166_2_entry + code="HU-NY" name="Nyíregyháza"/> + <iso_3166_2_entry + code="HU-PS" name="Pécs"/> + <iso_3166_2_entry + code="HU-ST" name="Salgótarján"/> + <iso_3166_2_entry + code="HU-SN" name="Sopron"/> + <iso_3166_2_entry + code="HU-SD" name="Szeged"/> + <iso_3166_2_entry + code="HU-SF" name="Székesfehérvár"/> + <iso_3166_2_entry + code="HU-SS" name="Szekszárd"/> + <iso_3166_2_entry + code="HU-SK" name="Szolnok"/> + <iso_3166_2_entry + code="HU-SH" name="Szombathely"/> + <iso_3166_2_entry + code="HU-TB" name="Tatabánya"/> + <iso_3166_2_entry + code="HU-VM" name="Veszprém"/> + <iso_3166_2_entry + code="HU-ZE" name="Zalaegerszeg"/> + </iso_3166_subset> + <iso_3166_subset type="Capital city"> + <iso_3166_2_entry + code="HU-BU" name="Budapest"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Indonesia --> + <iso_3166_country code="ID"> + <iso_3166_subset type="Geographical unit"> + <iso_3166_2_entry + code="ID-JW" name="Jawa"/> + <iso_3166_2_entry + code="ID-KA" name="Kalimantan"/> + <iso_3166_2_entry + code="ID-MA" name="Maluku"/> + <iso_3166_2_entry + code="ID-NU" name="Nusa Tenggara"/> + <iso_3166_2_entry + code="ID-IJ" name="Papua"/> + <iso_3166_2_entry + code="ID-SL" name="Sulawesi"/> + <iso_3166_2_entry + code="ID-SM" name="Sumatera"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous Province"> + <iso_3166_2_entry + code="ID-AC" name="Aceh" parent="SM"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ID-BA" name="Bali" parent="NU"/> + <iso_3166_2_entry + code="ID-BB" name="Bangka Belitung" parent="SM"/> + <iso_3166_2_entry + code="ID-BT" name="Banten" parent="JW"/> + <iso_3166_2_entry + code="ID-BE" name="Bengkulu" parent="SM"/> + <iso_3166_2_entry + code="ID-GO" name="Gorontalo" parent="SL"/> + <iso_3166_2_entry + code="ID-JA" name="Jambi" parent="SM"/> + <iso_3166_2_entry + code="ID-JB" name="Jawa Barat" parent="JW"/> + <iso_3166_2_entry + code="ID-JT" name="Jawa Tengah" parent="JW"/> + <iso_3166_2_entry + code="ID-JI" name="Jawa Timur" parent="JW"/> + <iso_3166_2_entry + code="ID-KB" name="Kalimantan Barat" parent="KA"/> + <iso_3166_2_entry + code="ID-KT" name="Kalimantan Tengah" parent="KA"/> + <iso_3166_2_entry + code="ID-KS" name="Kalimantan Selatan" parent="KA"/> + <iso_3166_2_entry + code="ID-KI" name="Kalimantan Timur" parent="KA"/> + <iso_3166_2_entry + code="ID-KR" name="Kepulauan Riau" parent="SM"/> + <iso_3166_2_entry + code="ID-LA" name="Lampung" parent="SM"/> + <iso_3166_2_entry + code="ID-MA" name="Maluku" parent="MA"/> + <iso_3166_2_entry + code="ID-MU" name="Maluku Utara" parent="MA"/> + <iso_3166_2_entry + code="ID-NB" name="Nusa Tenggara Barat" parent="NU"/> + <iso_3166_2_entry + code="ID-NT" name="Nusa Tenggara Timur" parent="NU"/> + <iso_3166_2_entry + code="ID-PA" name="Papua" parent="IJ"/> + <iso_3166_2_entry + code="ID-PB" name="Papua Barat" parent="IJ"/> + <iso_3166_2_entry + code="ID-RI" name="Riau" parent="SM"/> + <iso_3166_2_entry + code="ID-SR" name="Sulawesi Barat" parent="SL"/> + <iso_3166_2_entry + code="ID-SN" name="Sulawesi Selatan" parent="SL"/> + <iso_3166_2_entry + code="ID-ST" name="Sulawesi Tengah" parent="SL"/> + <iso_3166_2_entry + code="ID-SG" name="Sulawesi Tenggara" parent="SL"/> + <iso_3166_2_entry + code="ID-SA" name="Sulawesi Utara" parent="SL"/> + <iso_3166_2_entry + code="ID-SB" name="Sumatra Barat" parent="SM"/> + <iso_3166_2_entry + code="ID-SS" name="Sumatra Selatan" parent="SM"/> + <iso_3166_2_entry + code="ID-SU" name="Sumatera Utara" parent="SM"/> + </iso_3166_subset> + <iso_3166_subset type="Special District"> + <iso_3166_2_entry + code="ID-JK" name="Jakarta Raya" parent="JW"/> + </iso_3166_subset> + <iso_3166_subset type="Special Region"> + <iso_3166_2_entry + code="ID-YO" name="Yogyakarta" parent="JW"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ireland --> + <iso_3166_country code="IE"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="IE-C" name="Connacht"/> + <iso_3166_2_entry + code="IE-L" name="Leinster"/> + <iso_3166_2_entry + code="IE-M" name="Munster"/> + <iso_3166_2_entry + code="IE-U" name="Ulster"/> + </iso_3166_subset> + <iso_3166_subset type="County"> + <!-- Ireland uses Car Registration codes for Counties as ISO 3166-2 regions --> + <iso_3166_2_entry + code="IE-CW" name="Carlow" parent="L"/> + <iso_3166_2_entry + code="IE-CN" name="Cavan" parent="U"/> + <iso_3166_2_entry + code="IE-CE" name="Clare" parent="M"/> + <iso_3166_2_entry + code="IE-C" name="Cork" parent="M"/> + <iso_3166_2_entry + code="IE-DL" name="Donegal" parent="U"/> + <iso_3166_2_entry + code="IE-D" name="Dublin" parent="L"/> + <iso_3166_2_entry + code="IE-G" name="Galway" parent="C"/> + <iso_3166_2_entry + code="IE-KY" name="Kerry" parent="M"/> + <iso_3166_2_entry + code="IE-KE" name="Kildare" parent="L"/> + <iso_3166_2_entry + code="IE-KK" name="Kilkenny" parent="L"/> + <iso_3166_2_entry + code="IE-LS" name="Laois" parent="L"/> + <iso_3166_2_entry + code="IE-LM" name="Leitrim" parent="C"/> + <iso_3166_2_entry + code="IE-LK" name="Limerick" parent="M"/> + <iso_3166_2_entry + code="IE-LD" name="Longford" parent="L"/> + <iso_3166_2_entry + code="IE-LH" name="Louth" parent="L"/> + <iso_3166_2_entry + code="IE-MO" name="Mayo" parent="C"/> + <iso_3166_2_entry + code="IE-MH" name="Meath" parent="L"/> + <iso_3166_2_entry + code="IE-MN" name="Monaghan" parent="U"/> + <iso_3166_2_entry + code="IE-OY" name="Offaly" parent="L"/> + <iso_3166_2_entry + code="IE-RN" name="Roscommon" parent="C"/> + <iso_3166_2_entry + code="IE-SO" name="Sligo" parent="C"/> + <iso_3166_2_entry + code="IE-TA" name="Tipperary" parent="M"/> + <iso_3166_2_entry + code="IE-WD" name="Waterford" parent="M"/> + <iso_3166_2_entry + code="IE-WH" name="Westmeath" parent="L"/> + <iso_3166_2_entry + code="IE-WX" name="Wexford" parent="L"/> + <iso_3166_2_entry + code="IE-WW" name="Wicklow" parent="L"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Israel --> + <iso_3166_country code="IL"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="IL-D" name="HaDarom"/> + <iso_3166_2_entry + code="IL-M" name="HaMerkaz"/> + <iso_3166_2_entry + code="IL-Z" name="HaZafon"/> + <iso_3166_2_entry + code="IL-HA" name="Hefa"/> + <iso_3166_2_entry + code="IL-TA" name="Tel-Aviv"/> + <iso_3166_2_entry + code="IL-JM" name="Yerushalayim Al Quds"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Isle of Man --> + <iso_3166_country code="IM"/> + <!-- India --> + <iso_3166_country code="IN"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="IN-AP" name="Andhra Pradesh"/> + <iso_3166_2_entry + code="IN-AR" name="Arunāchal Pradesh"/> + <iso_3166_2_entry + code="IN-AS" name="Assam"/> + <iso_3166_2_entry + code="IN-BR" name="Bihār"/> + <iso_3166_2_entry + code="IN-CT" name="Chhattīsgarh"/> + <iso_3166_2_entry + code="IN-GA" name="Goa"/> + <iso_3166_2_entry + code="IN-GJ" name="Gujarāt"/> + <iso_3166_2_entry + code="IN-HR" name="Haryāna"/> + <iso_3166_2_entry + code="IN-HP" name="Himāchal Pradesh"/> + <iso_3166_2_entry + code="IN-JK" name="Jammu and Kashmīr"/> + <iso_3166_2_entry + code="IN-JH" name="Jharkhand"/> + <iso_3166_2_entry + code="IN-KA" name="Karnātaka"/> + <iso_3166_2_entry + code="IN-KL" name="Kerala"/> + <iso_3166_2_entry + code="IN-MP" name="Madhya Pradesh"/> + <iso_3166_2_entry + code="IN-MH" name="Mahārāshtra"/> + <iso_3166_2_entry + code="IN-MN" name="Manipur"/> + <iso_3166_2_entry + code="IN-ML" name="Meghālaya"/> + <iso_3166_2_entry + code="IN-MZ" name="Mizoram"/> + <iso_3166_2_entry + code="IN-NL" name="Nāgāland"/> + <iso_3166_2_entry + code="IN-OR" name="Orissa"/> + <iso_3166_2_entry + code="IN-PB" name="Punjab"/> + <iso_3166_2_entry + code="IN-RJ" name="Rājasthān"/> + <iso_3166_2_entry + code="IN-SK" name="Sikkim"/> + <iso_3166_2_entry + code="IN-TN" name="Tamil Nādu"/> + <iso_3166_2_entry + code="IN-TR" name="Tripura"/> + <iso_3166_2_entry + code="IN-UL" name="Uttaranchal"/> + <iso_3166_2_entry + code="IN-UP" name="Uttar Pradesh"/> + <iso_3166_2_entry + code="IN-WB" name="West Bengal"/> + </iso_3166_subset> + <iso_3166_subset type="Union territory"> + <iso_3166_2_entry + code="IN-AN" name="Andaman and Nicobar Islands"/> + <iso_3166_2_entry + code="IN-CH" name="Chandīgarh"/> + <iso_3166_2_entry + code="IN-DN" name="Dādra and Nagar Haveli"/> + <iso_3166_2_entry + code="IN-DD" name="Damān and Diu"/> + <iso_3166_2_entry + code="IN-DL" name="Delhi"/> + <iso_3166_2_entry + code="IN-LD" name="Lakshadweep"/> + <iso_3166_2_entry + code="IN-PY" name="Pondicherry"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Iraq --> + <iso_3166_country code="IQ"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="IQ-AN" name="Al Anbar"/> + <iso_3166_2_entry + code="IQ-BA" name="Al Basrah"/> + <iso_3166_2_entry + code="IQ-MU" name="Al Muthanna"/> + <iso_3166_2_entry + code="IQ-QA" name="Al Qadisiyah"/> + <iso_3166_2_entry + code="IQ-NA" name="An Najef"/> + <iso_3166_2_entry + code="IQ-AR" name="Arbil"/> + <iso_3166_2_entry + code="IQ-SW" name="As Sulaymaniyah"/> + <iso_3166_2_entry + code="IQ-TS" name="At Ta'mim"/> + <iso_3166_2_entry + code="IQ-BB" name="Babil"/> + <iso_3166_2_entry + code="IQ-BG" name="Baghdad"/> + <iso_3166_2_entry + code="IQ-DA" name="Dahuk"/> + <iso_3166_2_entry + code="IQ-DQ" name="Dhi Qar"/> + <iso_3166_2_entry + code="IQ-DI" name="Diyala"/> + <iso_3166_2_entry + code="IQ-KA" name="Karbala'"/> + <iso_3166_2_entry + code="IQ-MA" name="Maysan"/> + <iso_3166_2_entry + code="IQ-NI" name="Ninawa"/> + <iso_3166_2_entry + code="IQ-SD" name="Salah ad Din"/> + <iso_3166_2_entry + code="IQ-WA" name="Wasit"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Iran --> + <iso_3166_country code="IR"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="IR-03" name="Ardabīl"/> + <iso_3166_2_entry + code="IR-02" name="Āzarbāyjān-e Gharbī"/> + <iso_3166_2_entry + code="IR-01" name="Āzarbāyjān-e Sharqī"/> + <iso_3166_2_entry + code="IR-06" name="Būshehr"/> + <iso_3166_2_entry + code="IR-08" name="Chahār Mahāll va Bakhtīārī"/> + <iso_3166_2_entry + code="IR-04" name="Eşfahān"/> + <iso_3166_2_entry + code="IR-14" name="Fārs"/> + <iso_3166_2_entry + code="IR-19" name="Gīlān"/> + <iso_3166_2_entry + code="IR-27" name="Golestān"/> + <iso_3166_2_entry + code="IR-24" name="Hamadān"/> + <iso_3166_2_entry + code="IR-23" name="Hormozgān"/> + <iso_3166_2_entry + code="IR-05" name="Īlām"/> + <iso_3166_2_entry + code="IR-15" name="Kermān"/> + <iso_3166_2_entry + code="IR-17" name="Kermānshāh"/> + <iso_3166_2_entry + code="IR-29" name="Khorāsān-e Janūbī"/> + <iso_3166_2_entry + code="IR-30" name="Khorāsān-e Razavī"/> + <iso_3166_2_entry + code="IR-31" name="Khorāsān-e Shemālī"/> + <iso_3166_2_entry + code="IR-10" name="Khūzestān"/> + <iso_3166_2_entry + code="IR-18" name="Kohgīlūyeh va Būyer Ahmad"/> + <iso_3166_2_entry + code="IR-16" name="Kordestān"/> + <iso_3166_2_entry + code="IR-20" name="Lorestān"/> + <iso_3166_2_entry + code="IR-22" name="Markazī"/> + <iso_3166_2_entry + code="IR-21" name="Māzandarān"/> + <iso_3166_2_entry + code="IR-28" name="Qazvīn"/> + <iso_3166_2_entry + code="IR-26" name="Qom"/> + <iso_3166_2_entry + code="IR-12" name="Semnān"/> + <iso_3166_2_entry + code="IR-13" name="Sīstān va Balūchestān"/> + <iso_3166_2_entry + code="IR-07" name="Tehrān"/> + <iso_3166_2_entry + code="IR-25" name="Yazd"/> + <iso_3166_2_entry + code="IR-11" name="Zanjān"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Iceland --> + <iso_3166_country code="IS"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="IS-7" name="Austurland"/> + <iso_3166_2_entry + code="IS-1" name="Höfuðborgarsvæðið"/> + <iso_3166_2_entry + code="IS-6" name="Norðurland eystra"/> + <iso_3166_2_entry + code="IS-5" name="Norðurland vestra"/> + <iso_3166_2_entry + code="IS-8" name="Suðurland"/> + <iso_3166_2_entry + code="IS-2" name="Suðurnes"/> + <iso_3166_2_entry + code="IS-4" name="Vestfirðir"/> + <iso_3166_2_entry + code="IS-3" name="Vesturland"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="IS-0" name="Reykjavík"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Italy --> + <iso_3166_country code="IT"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="IT-65" name="Abruzzo"/> + <iso_3166_2_entry + code="IT-77" name="Basilicata"/> + <iso_3166_2_entry + code="IT-78" name="Calabria"/> + <iso_3166_2_entry + code="IT-72" name="Campania"/> + <iso_3166_2_entry + code="IT-45" name="Emilia-Romagna"/> + <iso_3166_2_entry + code="IT-36" name="Friuli-Venezia Giulia"/> + <iso_3166_2_entry + code="IT-62" name="Lazio"/> + <iso_3166_2_entry + code="IT-42" name="Liguria"/> + <iso_3166_2_entry + code="IT-25" name="Lombardia"/> + <iso_3166_2_entry + code="IT-57" name="Marche"/> + <iso_3166_2_entry + code="IT-67" name="Molise"/> + <iso_3166_2_entry + code="IT-21" name="Piemonte"/> + <iso_3166_2_entry + code="IT-75" name="Puglia"/> + <iso_3166_2_entry + code="IT-88" name="Sardegna"/> + <iso_3166_2_entry + code="IT-82" name="Sicilia"/> + <iso_3166_2_entry + code="IT-52" name="Toscana"/> + <iso_3166_2_entry + code="IT-32" name="Trentino-Alto Adige"/> + <iso_3166_2_entry + code="IT-55" name="Umbria"/> + <iso_3166_2_entry + code="IT-23" name="Valle d'Aosta"/> + <iso_3166_2_entry + code="IT-34" name="Veneto"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="IT-AG" name="Agrigento" parent="82"/> + <iso_3166_2_entry + code="IT-AL" name="Alessandria" parent="21"/> + <iso_3166_2_entry + code="IT-AN" name="Ancona" parent="57"/> + <iso_3166_2_entry + code="IT-AO" name="Aosta" parent="23"/> + <iso_3166_2_entry + code="IT-AR" name="Arezzo" parent="52"/> + <iso_3166_2_entry + code="IT-AP" name="Ascoli Piceno" parent="57"/> + <iso_3166_2_entry + code="IT-AT" name="Asti" parent="21"/> + <iso_3166_2_entry + code="IT-AV" name="Avellino" parent="72"/> + <iso_3166_2_entry + code="IT-BA" name="Bari" parent="75"/> + <iso_3166_2_entry + code="IT-BT" name="Barletta-Andria-Trani" parent="75"/> + <iso_3166_2_entry + code="IT-BL" name="Belluno" parent="34"/> + <iso_3166_2_entry + code="IT-BN" name="Benevento" parent="72"/> + <iso_3166_2_entry + code="IT-BG" name="Bergamo" parent="25"/> + <iso_3166_2_entry + code="IT-BI" name="Biella" parent="21"/> + <iso_3166_2_entry + code="IT-BO" name="Bologna" parent="45"/> + <iso_3166_2_entry + code="IT-BZ" name="Bolzano" parent="32"/> + <iso_3166_2_entry + code="IT-BS" name="Brescia" parent="25"/> + <iso_3166_2_entry + code="IT-BR" name="Brindisi" parent="75"/> + <iso_3166_2_entry + code="IT-CA" name="Cagliari" parent="88"/> + <iso_3166_2_entry + code="IT-CL" name="Caltanissetta" parent="82"/> + <iso_3166_2_entry + code="IT-CB" name="Campobasso" parent="67"/> + <iso_3166_2_entry + code="IT-CI" name="Carbonia-Iglesias" parent="88"/> + <iso_3166_2_entry + code="IT-CE" name="Caserta" parent="72"/> + <iso_3166_2_entry + code="IT-CT" name="Catania" parent="82"/> + <iso_3166_2_entry + code="IT-CZ" name="Catanzaro" parent="78"/> + <iso_3166_2_entry + code="IT-CH" name="Chieti" parent="65"/> + <iso_3166_2_entry + code="IT-CO" name="Como" parent="25"/> + <iso_3166_2_entry + code="IT-CS" name="Cosenza" parent="78"/> + <iso_3166_2_entry + code="IT-CR" name="Cremona" parent="25"/> + <iso_3166_2_entry + code="IT-KR" name="Crotone" parent="78"/> + <iso_3166_2_entry + code="IT-CN" name="Cuneo" parent="21"/> + <iso_3166_2_entry + code="IT-EN" name="Enna" parent="82"/> + <iso_3166_2_entry + code="IT-FM" name="Fermo" parent="57"/> + <iso_3166_2_entry + code="IT-FE" name="Ferrara" parent="45"/> + <iso_3166_2_entry + code="IT-FI" name="Firenze" parent="52"/> + <iso_3166_2_entry + code="IT-FG" name="Foggia" parent="75"/> + <iso_3166_2_entry + code="IT-FC" name="Forlì-Cesena" parent="45"/> + <iso_3166_2_entry + code="IT-FR" name="Frosinone" parent="62"/> + <iso_3166_2_entry + code="IT-GE" name="Genova" parent="42"/> + <iso_3166_2_entry + code="IT-GO" name="Gorizia" parent="36"/> + <iso_3166_2_entry + code="IT-GR" name="Grosseto" parent="52"/> + <iso_3166_2_entry + code="IT-IM" name="Imperia" parent="42"/> + <iso_3166_2_entry + code="IT-IS" name="Isernia" parent="67"/> + <iso_3166_2_entry + code="IT-SP" name="La Spezia" parent="42"/> + <iso_3166_2_entry + code="IT-AQ" name="L'Aquila" parent="65"/> + <iso_3166_2_entry + code="IT-LT" name="Latina" parent="62"/> + <iso_3166_2_entry + code="IT-LE" name="Lecce" parent="75"/> + <iso_3166_2_entry + code="IT-LC" name="Lecco" parent="25"/> + <iso_3166_2_entry + code="IT-LI" name="Livorno" parent="52"/> + <iso_3166_2_entry + code="IT-LO" name="Lodi" parent="25"/> + <iso_3166_2_entry + code="IT-LU" name="Lucca" parent="52"/> + <iso_3166_2_entry + code="IT-SC" name="Macerata" parent="57"/> + <iso_3166_2_entry + code="IT-MN" name="Mantova" parent="25"/> + <iso_3166_2_entry + code="IT-MS" name="Massa-Carrara" parent="52"/> + <iso_3166_2_entry + code="IT-MT" name="Matera" parent="77"/> + <iso_3166_2_entry + code="IT-VS" name="Medio Campidano" parent="88"/> + <iso_3166_2_entry + code="IT-ME" name="Messina" parent="82"/> + <iso_3166_2_entry + code="IT-MI" name="Milano" parent="25"/> + <iso_3166_2_entry + code="IT-MO" name="Modena" parent="45"/> + <iso_3166_2_entry + code="IT-MB" name="Monza e Brianza" parent="25"/> + <iso_3166_2_entry + code="IT-NA" name="Napoli" parent="72"/> + <iso_3166_2_entry + code="IT-NO" name="Novara" parent="21"/> + <iso_3166_2_entry + code="IT-NU" name="Nuoro" parent="88"/> + <iso_3166_2_entry + code="IT-OG" name="Ogliastra" parent="88"/> + <iso_3166_2_entry + code="IT-OT" name="Olbia-Tempio" parent="88"/> + <iso_3166_2_entry + code="IT-OR" name="Oristano" parent="88"/> + <iso_3166_2_entry + code="IT-PD" name="Padova" parent="34"/> + <iso_3166_2_entry + code="IT-PA" name="Palermo" parent="82"/> + <iso_3166_2_entry + code="IT-PR" name="Parma" parent="45"/> + <iso_3166_2_entry + code="IT-PV" name="Pavia" parent="25"/> + <iso_3166_2_entry + code="IT-PG" name="Perugia" parent="55"/> + <iso_3166_2_entry + code="IT-PU" name="Pesaro e Urbino" parent="57"/> + <iso_3166_2_entry + code="IT-PE" name="Pescara" parent="65"/> + <iso_3166_2_entry + code="IT-PC" name="Piacenza" parent="45"/> + <iso_3166_2_entry + code="IT-PI" name="Pisa" parent="52"/> + <iso_3166_2_entry + code="IT-PT" name="Pistoia" parent="52"/> + <iso_3166_2_entry + code="IT-PN" name="Pordenone" parent="36"/> + <iso_3166_2_entry + code="IT-PZ" name="Potenza" parent="77"/> + <iso_3166_2_entry + code="IT-PO" name="Prato" parent="52"/> + <iso_3166_2_entry + code="IT-RG" name="Ragusa" parent="82"/> + <iso_3166_2_entry + code="IT-RA" name="Ravenna" parent="45"/> + <iso_3166_2_entry + code="IT-RC" name="Reggio Calabria" parent="78"/> + <iso_3166_2_entry + code="IT-RE" name="Reggio Emilia" parent="45"/> + <iso_3166_2_entry + code="IT-RI" name="Rieti" parent="62"/> + <iso_3166_2_entry + code="IT-RN" name="Rimini" parent="45"/> + <iso_3166_2_entry + code="IT-RM" name="Roma" parent="62"/> + <iso_3166_2_entry + code="IT-RO" name="Rovigo" parent="34"/> + <iso_3166_2_entry + code="IT-SA" name="Salerno" parent="72"/> + <iso_3166_2_entry + code="IT-SS" name="Sassari" parent="88"/> + <iso_3166_2_entry + code="IT-SV" name="Savona" parent="42"/> + <iso_3166_2_entry + code="IT-SI" name="Siena" parent="52"/> + <iso_3166_2_entry + code="IT-SR" name="Siracusa" parent="82"/> + <iso_3166_2_entry + code="IT-SO" name="Sondrio" parent="25"/> + <iso_3166_2_entry + code="IT-TA" name="Taranto" parent="75"/> + <iso_3166_2_entry + code="IT-TE" name="Teramo" parent="65"/> + <iso_3166_2_entry + code="IT-TR" name="Terni" parent="55"/> + <iso_3166_2_entry + code="IT-TO" name="Torino" parent="21"/> + <iso_3166_2_entry + code="IT-TP" name="Trapani" parent="82"/> + <iso_3166_2_entry + code="IT-TN" name="Trento" parent="32"/> + <iso_3166_2_entry + code="IT-TV" name="Treviso" parent="34"/> + <iso_3166_2_entry + code="IT-TS" name="Trieste" parent="36"/> + <iso_3166_2_entry + code="IT-UD" name="Udine" parent="36"/> + <iso_3166_2_entry + code="IT-VA" name="Varese" parent="25"/> + <iso_3166_2_entry + code="IT-VE" name="Venezia" parent="34"/> + <iso_3166_2_entry + code="IT-VB" name="Verbano-Cusio-Ossola" parent="21"/> + <iso_3166_2_entry + code="IT-VC" name="Vercelli" parent="21"/> + <iso_3166_2_entry + code="IT-VR" name="Verona" parent="34"/> + <iso_3166_2_entry + code="IT-VV" name="Vibo Valentia" parent="78"/> + <iso_3166_2_entry + code="IT-VI" name="Vicenza" parent="34"/> + <iso_3166_2_entry + code="IT-VT" name="Viterbo" parent="62"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Jersey --> + <iso_3166_country code="JE"/> + <!-- Jamaica --> + <iso_3166_country code="JM"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="JM-13" name="Clarendon"/> + <iso_3166_2_entry + code="JM-09" name="Hanover"/> + <iso_3166_2_entry + code="JM-01" name="Kingston"/> + <iso_3166_2_entry + code="JM-12" name="Manchester"/> + <iso_3166_2_entry + code="JM-04" name="Portland"/> + <iso_3166_2_entry + code="JM-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="JM-06" name="Saint Ann"/> + <iso_3166_2_entry + code="JM-14" name="Saint Catherine"/> + <iso_3166_2_entry + code="JM-11" name="Saint Elizabeth"/> + <iso_3166_2_entry + code="JM-08" name="Saint James"/> + <iso_3166_2_entry + code="JM-05" name="Saint Mary"/> + <iso_3166_2_entry + code="JM-03" name="Saint Thomas"/> + <iso_3166_2_entry + code="JM-07" name="Trelawny"/> + <iso_3166_2_entry + code="JM-10" name="Westmoreland"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Jordan --> + <iso_3166_country code="JO"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="JO-AJ" name="`Ajlun"/> + <iso_3166_2_entry + code="JO-AQ" name="Al `Aqabah"/> + <iso_3166_2_entry + code="JO-BA" name="Al Balqā'"/> + <iso_3166_2_entry + code="JO-KA" name="Al Karak"/> + <iso_3166_2_entry + code="JO-MA" name="Al Mafraq"/> + <iso_3166_2_entry + code="JO-AM" name="Amman"/> + <iso_3166_2_entry + code="JO-AT" name="Aţ Ţafīlah"/> + <iso_3166_2_entry + code="JO-AZ" name="Az Zarqā'"/> + <iso_3166_2_entry + code="JO-JR" name="Irbid"/> + <iso_3166_2_entry + code="JO-JA" name="Jarash"/> + <iso_3166_2_entry + code="JO-MN" name="Ma`ān"/> + <iso_3166_2_entry + code="JO-MD" name="Mādabā"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Japan --> + <iso_3166_country code="JP"> + <iso_3166_subset type="Prefecture"> + <!-- Japan uses Prefectures for its ISO 3166-2 regions --> + <!-- Data taken from http://fotw.digibel.be/flags/jp-prefe.html --> + <iso_3166_2_entry + code="JP-23" name="Aichi"/> + <iso_3166_2_entry + code="JP-05" name="Akita"/> + <iso_3166_2_entry + code="JP-02" name="Aomori"/> + <iso_3166_2_entry + code="JP-12" name="Chiba"/> + <iso_3166_2_entry + code="JP-38" name="Ehime"/> + <iso_3166_2_entry + code="JP-18" name="Fukui"/> + <iso_3166_2_entry + code="JP-40" name="Fukuoka"/> + <iso_3166_2_entry + code="JP-07" name="Fukushima"/> + <iso_3166_2_entry + code="JP-21" name="Gifu"/> + <iso_3166_2_entry + code="JP-10" name="Gunma"/> + <iso_3166_2_entry + code="JP-34" name="Hiroshima"/> + <iso_3166_2_entry + code="JP-01" name="Hokkaido"/> + <iso_3166_2_entry + code="JP-28" name="Hyogo"/> + <iso_3166_2_entry + code="JP-08" name="Ibaraki"/> + <iso_3166_2_entry + code="JP-17" name="Ishikawa"/> + <iso_3166_2_entry + code="JP-03" name="Iwate"/> + <iso_3166_2_entry + code="JP-37" name="Kagawa"/> + <iso_3166_2_entry + code="JP-46" name="Kagoshima"/> + <iso_3166_2_entry + code="JP-14" name="Kanagawa"/> + <iso_3166_2_entry + code="JP-39" name="Kochi"/> + <iso_3166_2_entry + code="JP-43" name="Kumamoto"/> + <iso_3166_2_entry + code="JP-26" name="Kyoto"/> + <iso_3166_2_entry + code="JP-24" name="Mie"/> + <iso_3166_2_entry + code="JP-04" name="Miyagi"/> + <iso_3166_2_entry + code="JP-45" name="Miyazaki"/> + <iso_3166_2_entry + code="JP-20" name="Nagano"/> + <iso_3166_2_entry + code="JP-42" name="Nagasaki"/> + <iso_3166_2_entry + code="JP-29" name="Nara"/> + <iso_3166_2_entry + code="JP-15" name="Niigata"/> + <iso_3166_2_entry + code="JP-44" name="Oita"/> + <iso_3166_2_entry + code="JP-33" name="Okayama"/> + <iso_3166_2_entry + code="JP-47" name="Okinawa"/> + <iso_3166_2_entry + code="JP-27" name="Osaka"/> + <iso_3166_2_entry + code="JP-41" name="Saga"/> + <iso_3166_2_entry + code="JP-11" name="Saitama"/> + <iso_3166_2_entry + code="JP-25" name="Shiga"/> + <iso_3166_2_entry + code="JP-32" name="Shimane"/> + <iso_3166_2_entry + code="JP-22" name="Shizuoka"/> + <iso_3166_2_entry + code="JP-09" name="Tochigi"/> + <iso_3166_2_entry + code="JP-36" name="Tokushima"/> + <iso_3166_2_entry + code="JP-13" name="Tokyo"/> + <iso_3166_2_entry + code="JP-31" name="Tottori"/> + <iso_3166_2_entry + code="JP-16" name="Toyama"/> + <iso_3166_2_entry + code="JP-30" name="Wakayama"/> + <iso_3166_2_entry + code="JP-06" name="Yamagata"/> + <iso_3166_2_entry + code="JP-35" name="Yamaguchi"/> + <iso_3166_2_entry + code="JP-19" name="Yamanashi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kenya --> + <iso_3166_country code="KE"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KE-110" name="Nairobi Municipality"/> + <iso_3166_2_entry + code="KE-200" name="Central"/> + <iso_3166_2_entry + code="KE-300" name="Coast"/> + <iso_3166_2_entry + code="KE-400" name="Eastern"/> + <iso_3166_2_entry + code="KE-500" name="North-Eastern Kaskazini Mashariki"/> + <iso_3166_2_entry + code="KE-700" name="Rift Valley"/> + <iso_3166_2_entry + code="KE-900" name="Western Magharibi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kyrgystan --> + <iso_3166_country code="KG"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="KG-GB" name="Bishkek"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="KG-B" name="Batken"/> + <iso_3166_2_entry + code="KG-C" name="Chü"/> + <iso_3166_2_entry + code="KG-J" name="Jalal-Abad"/> + <iso_3166_2_entry + code="KG-N" name="Naryn"/> + <iso_3166_2_entry + code="KG-O" name="Osh"/> + <iso_3166_2_entry + code="KG-T" name="Talas"/> + <iso_3166_2_entry + code="KG-Y" name="Ysyk-Köl"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cambodia --> + <iso_3166_country code="KH"> + <iso_3166_subset type="Autonomous municipality"> + <iso_3166_2_entry + code="KH-23" name="Krong Kaeb"/> + <iso_3166_2_entry + code="KH-24" name="Krong Pailin"/> + <iso_3166_2_entry + code="KH-18" name="Krong Preah Sihanouk"/> + <iso_3166_2_entry + code="KH-12" name="Phnom Penh"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KH-2" name="Battambang"/> + <iso_3166_2_entry + code="KH-1" name="Banteay Mean Chey"/> + <iso_3166_2_entry + code="KH-3" name="Kampong Cham"/> + <iso_3166_2_entry + code="KH-4" name="Kampong Chhnang"/> + <iso_3166_2_entry + code="KH-5" name="Kampong Speu"/> + <iso_3166_2_entry + code="KH-6" name="Kampong Thom"/> + <iso_3166_2_entry + code="KH-7" name="Kampot"/> + <iso_3166_2_entry + code="KH-8" name="Kandal"/> + <iso_3166_2_entry + code="KH-9" name="Kach Kong"/> + <iso_3166_2_entry + code="KH-10" name="Krachoh"/> + <iso_3166_2_entry + code="KH-11" name="Mondol Kiri"/> + <iso_3166_2_entry + code="KH-22" name="Otdar Mean Chey"/> + <iso_3166_2_entry + code="KH-15" name="Pousaat"/> + <iso_3166_2_entry + code="KH-13" name="Preah Vihear"/> + <iso_3166_2_entry + code="KH-14" name="Prey Veaeng"/> + <iso_3166_2_entry + code="KH-16" name="Rotanak Kiri"/> + <iso_3166_2_entry + code="KH-17" name="Siem Reab"/> + <iso_3166_2_entry + code="KH-19" name="Stueng Traeng"/> + <iso_3166_2_entry + code="KH-20" name="Svaay Rieng"/> + <iso_3166_2_entry + code="KH-21" name="Taakaev"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kiribati --> + <iso_3166_country code="KI"> + <iso_3166_subset type="Island group"> + <iso_3166_2_entry + code="KI-G" name="Gilbert Islands"/> + <iso_3166_2_entry + code="KI-L" name="Line Islands"/> + <iso_3166_2_entry + code="KI-P" name="Phoenix Islands"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Kitts and Nevis --> + <iso_3166_country code="KN"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="KN-K" name="Saint Kitts"/> + <iso_3166_2_entry + code="KN-N" name="Nevis"/> + </iso_3166_subset> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="KN-01" name="Christ Church Nichola Town" parent="K"/> + <iso_3166_2_entry + code="KN-02" name="Saint Anne Sandy Point" parent="K"/> + <iso_3166_2_entry + code="KN-03" name="Saint George Basseterre" parent="K"/> + <iso_3166_2_entry + code="KN-04" name="Saint George Gingerland" parent="N"/> + <iso_3166_2_entry + code="KN-05" name="Saint James Windward" parent="N"/> + <iso_3166_2_entry + code="KN-06" name="Saint John Capisterre" parent="K"/> + <iso_3166_2_entry + code="KN-07" name="Saint John Figtree" parent="N"/> + <iso_3166_2_entry + code="KN-08" name="Saint Mary Cayon" parent="K"/> + <iso_3166_2_entry + code="KN-09" name="Saint Paul Capisterre" parent="K"/> + <iso_3166_2_entry + code="KN-10" name="Saint Paul Charlestown" parent="N"/> + <iso_3166_2_entry + code="KN-11" name="Saint Peter Basseterre" parent="K"/> + <iso_3166_2_entry + code="KN-12" name="Saint Thomas Lowland" parent="N"/> + <iso_3166_2_entry + code="KN-13" name="Saint Thomas Middle Island" parent="K"/> + <iso_3166_2_entry + code="KN-15" name="Trinity Palmetto Point" parent="K"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Comorros --> + <iso_3166_country code="KM"> + <iso_3166_subset type="Island"> + <iso_3166_2_entry + code="KM-A" name="Andjouân (Anjwān)"/> + <iso_3166_2_entry + code="KM-G" name="Andjazîdja (Anjazījah)"/> + <iso_3166_2_entry + code="KM-M" name="Moûhîlî (Mūhīlī)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- North Korea --> + <iso_3166_country code="KP"> + <iso_3166_subset type="Capital city"> + <iso_3166_2_entry + code="KP-01" name="P’yŏngyang"/> + </iso_3166_subset> + <iso_3166_subset type="Special city"> + <iso_3166_2_entry + code="KP-13" name="Nasŏn (Najin-Sŏnbong)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KP-02" name="P’yŏngan-namdo"/> + <iso_3166_2_entry + code="KP-03" name="P’yŏngan-bukto"/> + <iso_3166_2_entry + code="KP-04" name="Chagang-do"/> + <iso_3166_2_entry + code="KP-05" name="Hwanghae-namdo"/> + <iso_3166_2_entry + code="KP-06" name="Hwanghae-bukto"/> + <iso_3166_2_entry + code="KP-07" name="Kangwŏn-do"/> + <iso_3166_2_entry + code="KP-08" name="Hamgyŏng-namdo"/> + <iso_3166_2_entry + code="KP-09" name="Hamgyŏng-bukto"/> + <iso_3166_2_entry + code="KP-10" name="Yanggang-do"/> + </iso_3166_subset> + </iso_3166_country> + <!-- South Korea --> + <iso_3166_country code="KR"> + <iso_3166_subset type="Capital Metropolitan City"> + <iso_3166_2_entry + code="KR-11" name="Seoul Teugbyeolsi"/> + </iso_3166_subset> + <iso_3166_subset type="Metropolitan cities"> + <iso_3166_2_entry + code="KR-26" name="Busan Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-27" name="Daegu Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-30" name="Daejeon Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-29" name="Gwangju Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-28" name="Incheon Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-31" name="Ulsan Gwang'yeogsi"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KR-43" name="Chungcheongbukdo"/> + <iso_3166_2_entry + code="KR-44" name="Chungcheongnamdo"/> + <iso_3166_2_entry + code="KR-42" name="Gang'weondo"/> + <iso_3166_2_entry + code="KR-41" name="Gyeonggido"/> + <iso_3166_2_entry + code="KR-47" name="Gyeongsangbukdo"/> + <iso_3166_2_entry + code="KR-48" name="Gyeongsangnamdo"/> + <iso_3166_2_entry + code="KR-49" name="Jejudo"/> + <iso_3166_2_entry + code="KR-45" name="Jeonrabukdo"/> + <iso_3166_2_entry + code="KR-46" name="Jeonranamdo"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kuwait --> + <iso_3166_country code="KW"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="KW-AH" name="Al Ahmadi"/> + <iso_3166_2_entry + code="KW-FA" name="Al Farwānīyah"/> + <iso_3166_2_entry + code="KW-JA" name="Al Jahrah"/> + <iso_3166_2_entry + code="KW-KU" name="Al Kuwayt"/> + <iso_3166_2_entry + code="KW-HA" name="Hawallī"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kazakhstan --> + <iso_3166_country code="KZ"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="KZ-ALA" name="Almaty"/> + <iso_3166_2_entry + code="KZ-AST" name="Astana"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="KZ-ALM" name="Almaty oblysy"/> + <iso_3166_2_entry + code="KZ-AKM" name="Aqmola oblysy"/> + <iso_3166_2_entry + code="KZ-AKT" name="Aqtöbe oblysy"/> + <iso_3166_2_entry + code="KZ-ATY" name="Atyraū oblysy"/> + <iso_3166_2_entry + code="KZ-ZAP" name="Batys Quzaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-MAN" name="Mangghystaū oblysy"/> + <iso_3166_2_entry + code="KZ-YUZ" name="Ongtüstik Qazaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-PAV" name="Pavlodar oblysy"/> + <iso_3166_2_entry + code="KZ-KAR" name="Qaraghandy oblysy"/> + <iso_3166_2_entry + code="KZ-KUS" name="Qostanay oblysy"/> + <iso_3166_2_entry + code="KZ-KZY" name="Qyzylorda oblysy"/> + <iso_3166_2_entry + code="KZ-VOS" name="Shyghys Qazaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-SEV" name="Soltüstik Quzaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-ZHA" name="Zhambyl oblysy"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Laos --> + <iso_3166_country code="LA"> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="LA-VT" name="Vientiane"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="LA-AT" name="Attapu"/> + <iso_3166_2_entry + code="LA-BK" name="Bokèo"/> + <iso_3166_2_entry + code="LA-BL" name="Bolikhamxai"/> + <iso_3166_2_entry + code="LA-CH" name="Champasak"/> + <iso_3166_2_entry + code="LA-HO" name="Houaphan"/> + <iso_3166_2_entry + code="LA-KH" name="Khammouan"/> + <iso_3166_2_entry + code="LA-LM" name="Louang Namtha"/> + <iso_3166_2_entry + code="LA-LP" name="Louangphabang"/> + <iso_3166_2_entry + code="LA-OU" name="Oudômxai"/> + <iso_3166_2_entry + code="LA-PH" name="Phôngsali"/> + <iso_3166_2_entry + code="LA-SL" name="Salavan"/> + <iso_3166_2_entry + code="LA-SV" name="Savannakhét"/> + <iso_3166_2_entry + code="LA-VI" name="Vientiane"/> + <iso_3166_2_entry + code="LA-XA" name="Xaignabouli"/> + <iso_3166_2_entry + code="LA-XE" name="Xékong"/> + <iso_3166_2_entry + code="LA-XI" name="Xiangkhoang"/> + </iso_3166_subset> + <iso_3166_subset type="Special zone"> + <iso_3166_2_entry + code="LA-XN" name="Xiasômboun"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Liechtenstein --> + <iso_3166_country code="LI"> + <iso_3166_subset type="Commune"> + <iso_3166_2_entry + code="LI-01" name="Balzers"/> + <iso_3166_2_entry + code="LI-02" name="Eschen"/> + <iso_3166_2_entry + code="LI-03" name="Gamprin"/> + <iso_3166_2_entry + code="LI-04" name="Mauren"/> + <iso_3166_2_entry + code="LI-05" name="Planken"/> + <iso_3166_2_entry + code="LI-06" name="Ruggell"/> + <iso_3166_2_entry + code="LI-07" name="Schaan"/> + <iso_3166_2_entry + code="LI-08" name="Schellenberg"/> + <iso_3166_2_entry + code="LI-09" name="Triesen"/> + <iso_3166_2_entry + code="LI-10" name="Triesenberg"/> + <iso_3166_2_entry + code="LI-11" name="Vaduz"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Lebanon --> + <iso_3166_country code="LB"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="LB-AK" name="Aakkâr"/> + <iso_3166_2_entry + code="LB-BH" name="Baalbek-Hermel"/> + <iso_3166_2_entry + code="LB-BI" name="Béqaa"/> + <iso_3166_2_entry + code="LB-BA" name="Beyrouth"/> + <iso_3166_2_entry + code="LB-AS" name="Liban-Nord"/> + <iso_3166_2_entry + code="LB-JA" name="Liban-Sud"/> + <iso_3166_2_entry + code="LB-JL" name="Mont-Liban"/> + <iso_3166_2_entry + code="LB-NA" name="Nabatîyé"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sri Lanka --> + <iso_3166_country code="LK"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="LK-1" name="Basnāhira paḷāta"/> + <iso_3166_2_entry + code="LK-3" name="Dakuṇu paḷāta"/> + <iso_3166_2_entry + code="LK-2" name="Madhyama paḷāta"/> + <iso_3166_2_entry + code="LK-5" name="Næ̆gĕnahira paḷāta"/> + <iso_3166_2_entry + code="LK-9" name="Sabaragamuva paḷāta"/> + <iso_3166_2_entry + code="LK-7" name="Uturumæ̆da paḷāta"/> + <iso_3166_2_entry + code="LK-4" name="Uturu paḷāta"/> + <iso_3166_2_entry + code="LK-8" name="Ūva paḷāta"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="LK-52" name="Ampāara" parent="5"/> + <iso_3166_2_entry + code="LK-71" name="Anurādhapura" parent="7"/> + <iso_3166_2_entry + code="LK-81" name="Badulla" parent="8"/> + <iso_3166_2_entry + code="LK-51" name="Maḍakalapuva" parent="5"/> + <iso_3166_2_entry + code="LK-11" name="Kŏḷamba" parent="1"/> + <iso_3166_2_entry + code="LK-31" name="Gālla" parent="3"/> + <iso_3166_2_entry + code="LK-12" name="Gampaha" parent="1"/> + <iso_3166_2_entry + code="LK-33" name="Hambantŏṭa" parent="3"/> + <iso_3166_2_entry + code="LK-41" name="Yāpanaya" parent="4"/> + <iso_3166_2_entry + code="LK-13" name="Kaḷutara" parent="1"/> + <iso_3166_2_entry + code="LK-21" name="Mahanuvara" parent="2"/> + <iso_3166_2_entry + code="LK-92" name="Kægalla" parent="9"/> + <iso_3166_2_entry + code="LK-42" name="Kilinŏchchi" parent="4"/> + <iso_3166_2_entry + code="LK-61" name="Kuruṇægala" parent="6"/> + <iso_3166_2_entry + code="LK-43" name="Mannārama" parent="4"/> + <iso_3166_2_entry + code="LK-22" name="Mātale" parent="2"/> + <iso_3166_2_entry + code="LK-32" name="Mātara" parent="3"/> + <iso_3166_2_entry + code="LK-82" name="Mŏṇarāgala" parent="8"/> + <iso_3166_2_entry + code="LK-45" name="Mulativ" parent="4"/> + <iso_3166_2_entry + code="LK-23" name="Nuvara Ĕliya" parent="2"/> + <iso_3166_2_entry + code="LK-72" name="Pŏḷŏnnaruva" parent="7"/> + <iso_3166_2_entry + code="LK-62" name="Puttalama" parent="6"/> + <iso_3166_2_entry + code="LK-91" name="Ratnapura" parent="9"/> + <iso_3166_2_entry + code="LK-53" name="Trikuṇāmalaya" parent="5"/> + <iso_3166_2_entry + code="LK-44" name="Vavuniyāva" parent="4"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Liberia --> + <iso_3166_country code="LR"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="LR-BM" name="Bomi"/> + <iso_3166_2_entry + code="LR-BG" name="Bong"/> + <iso_3166_2_entry + code="LR-GB" name="Grand Bassa"/> + <iso_3166_2_entry + code="LR-CM" name="Grand Cape Mount"/> + <iso_3166_2_entry + code="LR-GG" name="Grand Gedeh"/> + <iso_3166_2_entry + code="LR-GK" name="Grand Kru"/> + <iso_3166_2_entry + code="LR-LO" name="Lofa"/> + <iso_3166_2_entry + code="LR-MG" name="Margibi"/> + <iso_3166_2_entry + code="LR-MY" name="Maryland"/> + <iso_3166_2_entry + code="LR-MO" name="Montserrado"/> + <iso_3166_2_entry + code="LR-NI" name="Nimba"/> + <iso_3166_2_entry + code="LR-RI" name="Rivercess"/> + <iso_3166_2_entry + code="LR-SI" name="Sinoe"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Lesotho --> + <iso_3166_country code="LS"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="LS-D" name="Berea"/> + <iso_3166_2_entry + code="LS-B" name="Butha-Buthe"/> + <iso_3166_2_entry + code="LS-C" name="Leribe"/> + <iso_3166_2_entry + code="LS-E" name="Mafeteng"/> + <iso_3166_2_entry + code="LS-A" name="Maseru"/> + <iso_3166_2_entry + code="LS-F" name="Mohale's Hoek"/> + <iso_3166_2_entry + code="LS-J" name="Mokhotlong"/> + <iso_3166_2_entry + code="LS-H" name="Qacha's Nek"/> + <iso_3166_2_entry + code="LS-G" name="Quthing"/> + <iso_3166_2_entry + code="LS-K" name="Thaba-Tseka"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Lithuania --> + <iso_3166_country code="LT"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="LT-AL" name="Alytaus Apskritis"/> + <iso_3166_2_entry + code="LT-KU" name="Kauno Apskritis"/> + <iso_3166_2_entry + code="LT-KL" name="Klaipėdos Apskritis"/> + <iso_3166_2_entry + code="LT-MR" name="Marijampolės Apskritis"/> + <iso_3166_2_entry + code="LT-PN" name="Panevėžio Apskritis"/> + <iso_3166_2_entry + code="LT-SA" name="Šiaulių Apskritis"/> + <iso_3166_2_entry + code="LT-TA" name="Tauragés Apskritis"/> + <iso_3166_2_entry + code="LT-TE" name="Telšių Apskritis"/> + <iso_3166_2_entry + code="LT-UT" name="Utenos Apskritis"/> + <iso_3166_2_entry + code="LT-VL" name="Vilniaus Apskritis"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Luxembourg --> + <iso_3166_country code="LU"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="LU-D" name="Diekirch"/> + <iso_3166_2_entry + code="LU-G" name="Grevenmacher"/> + <iso_3166_2_entry + code="LU-L" name="Luxembourg"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Latvia --> + <iso_3166_country code="LV"> + <iso_3166_subset type="District"> + <!-- We should probably add a "District" suffix here, but is it "Rajon" --> + <!-- or "Apriņķis"? --> + <iso_3166_2_entry + code="LV-AI" name="Aizkraukle"/> + <iso_3166_2_entry + code="LV-AL" name="Alūksne"/> + <iso_3166_2_entry + code="LV-BL" name="Balvi"/> + <iso_3166_2_entry + code="LV-BU" name="Bauska"/> + <iso_3166_2_entry + code="LV-CE" name="Cēsis"/> + <iso_3166_2_entry + code="LV-DA" name="Daugavpils"/> + <iso_3166_2_entry + code="LV-DO" name="Dobele"/> + <iso_3166_2_entry + code="LV-GU" name="Gulbene"/> + <iso_3166_2_entry + code="LV-JK" name="Jēkabpils"/> + <iso_3166_2_entry + code="LV-JL" name="Jelgava"/> + <iso_3166_2_entry + code="LV-KR" name="Krāslava"/> + <iso_3166_2_entry + code="LV-KU" name="Kuldīga"/> + <iso_3166_2_entry + code="LV-LE" name="Liepāja"/> + <iso_3166_2_entry + code="LV-LM" name="Limbaži"/> + <iso_3166_2_entry + code="LV-LU" name="Ludza"/> + <iso_3166_2_entry + code="LV-MA" name="Madona"/> + <iso_3166_2_entry + code="LV-OG" name="Ogre"/> + <iso_3166_2_entry + code="LV-PR" name="Preiļi"/> + <iso_3166_2_entry + code="LV-RE" name="Rēzekne"/> + <iso_3166_2_entry + code="LV-RI" name="Rīga"/> + <iso_3166_2_entry + code="LV-SA" name="Saldus"/> + <iso_3166_2_entry + code="LV-TA" name="Talsi"/> + <iso_3166_2_entry + code="LV-TU" name="Tukums"/> + <iso_3166_2_entry + code="LV-VK" name="Valka"/> + <iso_3166_2_entry + code="LV-VM" name="Valmiera"/> + <iso_3166_2_entry + code="LV-VE" name="Ventspils"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="LV-DGV" name="Daugavpils"/> + <iso_3166_2_entry + code="LV-JEL" name="Jelgava"/> + <iso_3166_2_entry + code="LV-JUR" name="Jūrmala"/> + <iso_3166_2_entry + code="LV-LPX" name="Liepāja"/> + <iso_3166_2_entry + code="LV-REZ" name="Rēzekne"/> + <iso_3166_2_entry + code="LV-RIX" name="Rīga"/> + <iso_3166_2_entry + code="LV-VEN" name="Ventspils"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Libya --> + <iso_3166_country code="LY"> + <iso_3166_subset type="Popularates"> + <iso_3166_2_entry + code="LY-BU" name="Al Buţnān"/> + <iso_3166_2_entry + code="LY-JA" name="Al Jabal al Akhḑar"/> + <iso_3166_2_entry + code="LY-JG" name="Al Jabal al Gharbī"/> + <iso_3166_2_entry + code="LY-JI" name="Al Jifārah"/> + <iso_3166_2_entry + code="LY-JU" name="Al Jufrah"/> + <iso_3166_2_entry + code="LY-KF" name="Al Kufrah"/> + <iso_3166_2_entry + code="LY-MJ" name="Al Marj"/> + <iso_3166_2_entry + code="LY-MB" name="Al Marqab"/> + <iso_3166_2_entry + code="LY-WA" name="Al Wāḩāt"/> + <iso_3166_2_entry + code="LY-NQ" name="An Nuqaţ al Khams"/> + <iso_3166_2_entry + code="LY-ZA" name="Az Zāwiyah"/> + <iso_3166_2_entry + code="LY-BA" name="Banghāzī"/> + <iso_3166_2_entry + code="LY-DR" name="Darnah"/> + <iso_3166_2_entry + code="LY-GT" name="Ghāt"/> + <iso_3166_2_entry + code="LY-JB" name="Jaghbūb"/> + <iso_3166_2_entry + code="LY-MI" name="Mişrātah"/> + <iso_3166_2_entry + code="LY-MQ" name="Murzuq"/> + <iso_3166_2_entry + code="LY-NL" name="Nālūt"/> + <iso_3166_2_entry + code="LY-SB" name="Sabhā"/> + <iso_3166_2_entry + code="LY-SR" name="Surt"/> + <iso_3166_2_entry + code="LY-TB" name="Ţarābulus"/> + <iso_3166_2_entry + code="LY-WD" name="Wādī al Ḩayāt"/> + <iso_3166_2_entry + code="LY-WS" name="Wādī ash Shāţiʾ"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Morocco --> + <iso_3166_country code="MA"> + <iso_3166_subset type="Economic region"> + <iso_3166_2_entry + code="MA 09" name="Chaouia-Ouardigha"/> + <iso_3166_2_entry + code="MA 10" name="Doukhala-Abda"/> + <iso_3166_2_entry + code="MA 05" name="Fès-Boulemane"/> + <iso_3166_2_entry + code="MA 02" name="Gharb-Chrarda-Beni Hssen"/> + <iso_3166_2_entry + code="MA 08" name="Grand Casablanca"/> + <iso_3166_2_entry + code="MA 14" name="Guelmim-Es Smara"/> + <iso_3166_2_entry + code="MA 15" name="Laâyoune-Boujdour-Sakia el Hamra"/> + <iso_3166_2_entry + code="MA 04" name="L'Oriental"/> + <iso_3166_2_entry + code="MA 11" name="Marrakech-Tensift-Al Haouz"/> + <iso_3166_2_entry + code="MA 06" name="Meknès-Tafilalet"/> + <iso_3166_2_entry + code="MA 16" name="Oued ed Dahab-Lagouira"/> + <iso_3166_2_entry + code="MA 07" name="Rabat-Salé-Zemmour-Zaer"/> + <iso_3166_2_entry + code="MA 13" name="Sous-Massa-Draa"/> + <iso_3166_2_entry + code="MA 12" name="Tadla-Azilal"/> + <iso_3166_2_entry + code="MA 01" name="Tanger-Tétouan"/> + <iso_3166_2_entry + code="MA 03" name="Taza-Al Hoceima-Taounate"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="MA-HAO" name="Al Haouz" parent="11"/> + <iso_3166_2_entry + code="MA-HOC" name="Al Hoceïma" parent="03"/> + <iso_3166_2_entry + code="MA-ASZ" name="Assa-Zag" parent="14"/> + <iso_3166_2_entry + code="MA-AZI" name="Azilal" parent="12"/> + <iso_3166_2_entry + code="MA-BEM" name="Beni Mellal" parent="12"/> + <iso_3166_2_entry + code="MA-BES" name="Ben Slimane" parent="09"/> + <iso_3166_2_entry + code="MA-BER" name="Berkane" parent="04"/> + <iso_3166_2_entry + code="MA-BOD" name="Boujdour (EH)" parent="15"/> + <iso_3166_2_entry + code="MA-BOM" name="Boulemane" parent="05"/> + <iso_3166_2_entry + code="MA-CHE" name="Chefchaouen" parent="01"/> + <iso_3166_2_entry + code="MA-CHI" name="Chichaoua" parent="11"/> + <iso_3166_2_entry + code="MA-CHT" name="Chtouka-Ait Baha" parent="13"/> + <iso_3166_2_entry + code="MA-HAJ" name="El Hajeb" parent="06"/> + <iso_3166_2_entry + code="MA-JDI" name="El Jadida" parent="10"/> + <iso_3166_2_entry + code="MA-ERR" name="Errachidia" parent="06"/> + <iso_3166_2_entry + code="MA-ESI" name="Essaouira" parent="11"/> + <iso_3166_2_entry + code="MA-ESM" name="Es Smara (EH)" parent="14"/> + <iso_3166_2_entry + code="MA-FIG" name="Figuig" parent="04"/> + <iso_3166_2_entry + code="MA-GUE" name="Guelmim" parent="14"/> + <iso_3166_2_entry + code="MA-IFR" name="Ifrane" parent="06"/> + <iso_3166_2_entry + code="MA-JRA" name="Jrada" parent="04"/> + <iso_3166_2_entry + code="MA-KES" name="Kelaat es Sraghna" parent="11"/> + <iso_3166_2_entry + code="MA-KEN" name="Kénitra" parent="02"/> + <iso_3166_2_entry + code="MA-KHE" name="Khemisaet" parent="07"/> + <iso_3166_2_entry + code="MA-KHN" name="Khenifra" parent="06"/> + <iso_3166_2_entry + code="MA-KHO" name="Khouribga" parent="09"/> + <iso_3166_2_entry + code="MA-LAA" name="Laâyoune (EH)" parent="15"/> + <iso_3166_2_entry + code="MA-LAP" name="Larache" parent="01"/> + <iso_3166_2_entry + code="MA-MED" name="Médiouna" parent="08"/> + <iso_3166_2_entry + code="MA-MOU" name="Moulay Yacoub" parent="05"/> + <iso_3166_2_entry + code="MA-NAD" name="Nador" parent="04"/> + <iso_3166_2_entry + code="MA-NOU" name="Nouaceur" parent="08"/> + <iso_3166_2_entry + code="MA-OUA" name="Ouarzazate" parent="13"/> + <iso_3166_2_entry + code="MA-OUD" name="Oued ed Dahab (EH)" parent="16"/> + <iso_3166_2_entry + code="MA-SAF" name="Safi" parent="10"/> + <iso_3166_2_entry + code="MA-SEF" name="Sefrou" parent="05"/> + <iso_3166_2_entry + code="MA-SET" name="Settat" parent="09"/> + <iso_3166_2_entry + code="MA-SIK" name="Sidl Kacem" parent="02"/> + <iso_3166_2_entry + code="MA-TNT" name="Tan-Tan" parent="14"/> + <iso_3166_2_entry + code="MA-TAO" name="Taounate" parent="03"/> + <iso_3166_2_entry + code="MA-TAI" name="Taourirt" parent="04"/> + <iso_3166_2_entry + code="MA-TAR" name="Taroudant" parent="13"/> + <iso_3166_2_entry + code="MA-TAT" name="Tata" parent="14"/> + <iso_3166_2_entry + code="MA-TAZ" name="Taza" parent="03"/> + <iso_3166_2_entry + code="MA-TIZ" name="Tiznit" parent="13"/> + <iso_3166_2_entry + code="MA-ZAG" name="Zagora" parent="13"/> + </iso_3166_subset> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="MA-AGD" name="Agadir-Ida-Outanane" parent="13"/> + <iso_3166_2_entry + code="MA-AOU" name="Aousserd" parent="16"/> + <iso_3166_2_entry + code="MA-CAS" name="Casablanca [Dar el Beïda]" parent="08"/> + <iso_3166_2_entry + code="MA-FAH" name="Fahs-Beni Makada" parent="01"/> + <iso_3166_2_entry + code="MA-FES" name="Fès-Dar-Dbibegh" parent="05"/> + <iso_3166_2_entry + code="MA-INE" name="Inezgane-Ait Melloul" parent="13"/> + <iso_3166_2_entry + code="MA-MMD" name="Marrakech-Medina" parent="11"/> + <iso_3166_2_entry + code="MA-MMN" name="Marrakech-Menara" parent="11"/> + <iso_3166_2_entry + code="MA-MEK" name="Meknès" parent="06"/> + <iso_3166_2_entry + code="MA-MOH" name="Mohammadia" parent="08"/> + <iso_3166_2_entry + code="MA-OUJ" name="Oujda-Angad" parent="04"/> + <iso_3166_2_entry + code="MA-RAB" name="Rabat" parent="07"/> + <iso_3166_2_entry + code="MA-SAL" name="Salé" parent="07"/> + <iso_3166_2_entry + code="MA-SYB" name="Sidi Youssef Ben Ali" parent="11"/> + <iso_3166_2_entry + code="MA-SKH" name="Skhirate-Témara" parent="07"/> + <iso_3166_2_entry + code="MA-TNG" name="Tanger-Assilah" parent="01"/> + <iso_3166_2_entry + code="MA-TET" name="Tétouan" parent="01"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Moldova --> + <iso_3166_country code="MD"> + <iso_3166_subset type="Autonomous territorial unit"> + <iso_3166_2_entry + code="MD-GA" name="Găgăuzia, Unitatea teritorială autonomă"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MD-BA" name="Bălți"/> + <iso_3166_2_entry + code="MD-BD" name="Tighina"/> + <iso_3166_2_entry + code="MD-CU" name="Chișinău"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MD-AN" name="Anenii Noi"/> + <iso_3166_2_entry + code="MD-BS" name="Basarabeasca"/> + <iso_3166_2_entry + code="MD-BR" name="Briceni"/> + <iso_3166_2_entry + code="MD-CA" name="Cahul"/> + <iso_3166_2_entry + code="MD-CT" name="Cantemir"/> + <iso_3166_2_entry + code="MD-CL" name="Călărași"/> + <iso_3166_2_entry + code="MD-CS" name="Căușeni"/> + <iso_3166_2_entry + code="MD-CM" name="Cimișlia"/> + <iso_3166_2_entry + code="MD-CR" name="Criuleni"/> + <iso_3166_2_entry + code="MD-DO" name="Dondușeni"/> + <iso_3166_2_entry + code="MD-DR" name="Drochia"/> + <iso_3166_2_entry + code="MD-DU" name="Dubăsari"/> + <iso_3166_2_entry + code="MD-ED" name="Edineț"/> + <iso_3166_2_entry + code="MD-FA" name="Fălești"/> + <iso_3166_2_entry + code="MD-FL" name="Florești"/> + <iso_3166_2_entry + code="MD-GL" name="Glodeni"/> + <iso_3166_2_entry + code="MD-HI" name="Hîncești"/> + <iso_3166_2_entry + code="MD-IA" name="Ialoveni"/> + <iso_3166_2_entry + code="MD-LE" name="Leova"/> + <iso_3166_2_entry + code="MD-NI" name="Nisporeni"/> + <iso_3166_2_entry + code="MD-OC" name="Ocnița"/> + <iso_3166_2_entry + code="MD-OR" name="Orhei"/> + <iso_3166_2_entry + code="MD-RE" name="Rezina"/> + <iso_3166_2_entry + code="MD-RI" name="Rîșcani"/> + <iso_3166_2_entry + code="MD-SI" name="Sîngerei"/> + <iso_3166_2_entry + code="MD-SO" name="Soroca"/> + <iso_3166_2_entry + code="MD-ST" name="Strășeni"/> + <iso_3166_2_entry + code="MD-SD" name="Șoldănești"/> + <iso_3166_2_entry + code="MD-SV" name="Ștefan Vodă"/> + <iso_3166_2_entry + code="MD-TA" name="Taraclia"/> + <iso_3166_2_entry + code="MD-TE" name="Telenești"/> + <iso_3166_2_entry + code="MD-UN" name="Ungheni"/> + </iso_3166_subset> + <iso_3166_subset type="Territorial unit"> + <iso_3166_2_entry + code="MD-SN" name="Stînga Nistrului, unitatea teritorială din"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Montenegro --> + <iso_3166_country code="ME"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="ME-01" name="Andrijevica"/> + <iso_3166_2_entry + code="ME-02" name="Bar"/> + <iso_3166_2_entry + code="ME-03" name="Berane"/> + <iso_3166_2_entry + code="ME-04" name="Bijelo Polje"/> + <iso_3166_2_entry + code="ME-05" name="Budva"/> + <iso_3166_2_entry + code="ME-06" name="Cetinje"/> + <iso_3166_2_entry + code="ME-07" name="Danilovgrad"/> + <iso_3166_2_entry + code="ME-08" name="Herceg-Novi"/> + <iso_3166_2_entry + code="ME-09" name="Kolašin"/> + <iso_3166_2_entry + code="ME-10" name="Kotor"/> + <iso_3166_2_entry + code="ME-11" name="Mojkovac"/> + <iso_3166_2_entry + code="ME-12" name="Nikšić"/> + <iso_3166_2_entry + code="ME-13" name="Plav"/> + <iso_3166_2_entry + code="ME-14" name="Pljevlja"/> + <iso_3166_2_entry + code="ME-15" name="Plužine"/> + <iso_3166_2_entry + code="ME-16" name="Podgorica"/> + <iso_3166_2_entry + code="ME-17" name="Rožaje"/> + <iso_3166_2_entry + code="ME-18" name="Šavnik"/> + <iso_3166_2_entry + code="ME-19" name="Tivat"/> + <iso_3166_2_entry + code="ME-20" name="Ulcinj"/> + <iso_3166_2_entry + code="ME-21" name="Žabljak"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Martin (French part) --> + <iso_3166_country code="MF"/> + <!-- Madagascar --> + <iso_3166_country code="MG"> + <iso_3166_subset type="Autonomous province"> + <iso_3166_2_entry + code="MG-T" name="Antananarivo"/> + <iso_3166_2_entry + code="MG-D" name="Antsiranana"/> + <iso_3166_2_entry + code="MG-F" name="Fianarantsoa"/> + <iso_3166_2_entry + code="MG-M" name="Mahajanga"/> + <iso_3166_2_entry + code="MG-A" name="Toamasina"/> + <iso_3166_2_entry + code="MG-U" name="Toliara"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Marshall Islands --> + <iso_3166_country code="MH"> + <iso_3166_subset type="Chains (of islands)"> + <iso_3166_2_entry + code="MH-L" name="Ralik chain"/> + <iso_3166_2_entry + code="MH-T" name="Ratak chain"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="MH-ALL" name="Ailinglaplap" parent="L"/> + <iso_3166_2_entry + code="MH-ALK" name="Ailuk" parent="T"/> + <iso_3166_2_entry + code="MH-ARN" name="Arno" parent="T"/> + <iso_3166_2_entry + code="MH-AUR" name="Aur" parent="T"/> + <iso_3166_2_entry + code="MH-EBO" name="Ebon" parent="L"/> + <iso_3166_2_entry + code="MH-ENI" name="Enewetak" parent="L"/> + <iso_3166_2_entry + code="MH-JAB" name="Jabat" parent="L"/> + <iso_3166_2_entry + code="MH-JAL" name="Jaluit" parent="L"/> + <iso_3166_2_entry + code="MH-KIL" name="Kili" parent="L"/> + <iso_3166_2_entry + code="MH-KWA" name="Kwajalein" parent="L"/> + <iso_3166_2_entry + code="MH-LAE" name="Lae" parent="L"/> + <iso_3166_2_entry + code="MH-LIB" name="Lib" parent="L"/> + <iso_3166_2_entry + code="MH-LIK" name="Likiep" parent="T"/> + <iso_3166_2_entry + code="MH-MAJ" name="Majuro" parent="T"/> + <iso_3166_2_entry + code="MH-MAL" name="Maloelap" parent="T"/> + <iso_3166_2_entry + code="MH-MEJ" name="Mejit" parent="T"/> + <iso_3166_2_entry + code="MH-MIL" name="Mili" parent="T"/> + <iso_3166_2_entry + code="MH-NMK" name="Namdrik" parent="L"/> + <iso_3166_2_entry + code="MH-NMU" name="Namu" parent="L"/> + <iso_3166_2_entry + code="MH-RON" name="Rongelap" parent="L"/> + <iso_3166_2_entry + code="MH-UJA" name="Ujae" parent="L"/> + <iso_3166_2_entry + code="MH-UTI" name="Utirik" parent="T"/> + <iso_3166_2_entry + code="MH-WTN" name="Wotho" parent="L"/> + <iso_3166_2_entry + code="MH-WTJ" name="Wotje" parent="T"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Macedonia --> + <iso_3166_country code="MK"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="MK-01" name="Aerodrom"/> + <iso_3166_2_entry + code="MK-02" name="Aračinovo"/> + <iso_3166_2_entry + code="MK-03" name="Berovo"/> + <iso_3166_2_entry + code="MK-04" name="Bitola"/> + <iso_3166_2_entry + code="MK-05" name="Bogdanci"/> + <iso_3166_2_entry + code="MK-06" name="Bogovinje"/> + <iso_3166_2_entry + code="MK-07" name="Bosilovo"/> + <iso_3166_2_entry + code="MK-08" name="Brvenica"/> + <iso_3166_2_entry + code="MK-09" name="Butel"/> + <iso_3166_2_entry + code="MK-77" name="Centar"/> + <iso_3166_2_entry + code="MK-78" name="Centar Župa"/> + <iso_3166_2_entry + code="MK-79" name="Čair"/> + <iso_3166_2_entry + code="MK-80" name="Čaška"/> + <iso_3166_2_entry + code="MK-81" name="Češinovo-Obleševo"/> + <iso_3166_2_entry + code="MK-82" name="Čučer Sandevo"/> + <iso_3166_2_entry + code="MK-21" name="Debar"/> + <iso_3166_2_entry + code="MK-22" name="Debarca"/> + <iso_3166_2_entry + code="MK-23" name="Delčevo"/> + <iso_3166_2_entry + code="MK-25" name="Demir Hisar"/> + <iso_3166_2_entry + code="MK-24" name="Demir Kapija"/> + <iso_3166_2_entry + code="MK-26" name="Dojran"/> + <iso_3166_2_entry + code="MK-27" name="Dolneni"/> + <iso_3166_2_entry + code="MK-28" name="Drugovo"/> + <iso_3166_2_entry + code="MK-17" name="Gazi Baba"/> + <iso_3166_2_entry + code="MK-18" name="Gevgelija"/> + <iso_3166_2_entry + code="MK-29" name="Gjorče Petrov"/> + <iso_3166_2_entry + code="MK-19" name="Gostivar"/> + <iso_3166_2_entry + code="MK-20" name="Gradsko"/> + <iso_3166_2_entry + code="MK-34" name="Ilinden"/> + <iso_3166_2_entry + code="MK-35" name="Jegunovce"/> + <iso_3166_2_entry + code="MK-37" name="Karbinci"/> + <iso_3166_2_entry + code="MK-38" name="Karpoš"/> + <iso_3166_2_entry + code="MK-36" name="Kavadarci"/> + <iso_3166_2_entry + code="MK-40" name="Kičevo"/> + <iso_3166_2_entry + code="MK-39" name="Kisela Voda"/> + <iso_3166_2_entry + code="MK-42" name="Kočani"/> + <iso_3166_2_entry + code="MK-41" name="Konče"/> + <iso_3166_2_entry + code="MK-43" name="Kratovo"/> + <iso_3166_2_entry + code="MK-44" name="Kriva Palanka"/> + <iso_3166_2_entry + code="MK-45" name="Krivogaštani"/> + <iso_3166_2_entry + code="MK-46" name="Kruševo"/> + <iso_3166_2_entry + code="MK-47" name="Kumanovo"/> + <iso_3166_2_entry + code="MK-48" name="Lipkovo"/> + <iso_3166_2_entry + code="MK-49" name="Lozovo"/> + <iso_3166_2_entry + code="MK-51" name="Makedonska Kamenica"/> + <iso_3166_2_entry + code="MK-52" name="Makedonski Brod"/> + <iso_3166_2_entry + code="MK-50" name="Mavrovo-i-Rostuša"/> + <iso_3166_2_entry + code="MK-53" name="Mogila"/> + <iso_3166_2_entry + code="MK-54" name="Negotino"/> + <iso_3166_2_entry + code="MK-55" name="Novaci"/> + <iso_3166_2_entry + code="MK-56" name="Novo Selo"/> + <iso_3166_2_entry + code="MK-58" name="Ohrid"/> + <iso_3166_2_entry + code="MK-57" name="Oslomej"/> + <iso_3166_2_entry + code="MK-60" name="Pehčevo"/> + <iso_3166_2_entry + code="MK-59" name="Petrovec"/> + <iso_3166_2_entry + code="MK-61" name="Plasnica"/> + <iso_3166_2_entry + code="MK-62" name="Prilep"/> + <iso_3166_2_entry + code="MK-63" name="Probištip"/> + <iso_3166_2_entry + code="MK-64" name="Radoviš"/> + <iso_3166_2_entry + code="MK-65" name="Rankovce"/> + <iso_3166_2_entry + code="MK-66" name="Resen"/> + <iso_3166_2_entry + code="MK-67" name="Rosoman"/> + <iso_3166_2_entry + code="MK-68" name="Saraj"/> + <iso_3166_2_entry + code="MK-83" name="Štip"/> + <iso_3166_2_entry + code="MK-84" name="Šuto Orizari"/> + <iso_3166_2_entry + code="MK-70" name="Sopište"/> + <iso_3166_2_entry + code="MK-71" name="Staro Nagoričane"/> + <iso_3166_2_entry + code="MK-72" name="Struga"/> + <iso_3166_2_entry + code="MK-73" name="Strumica"/> + <iso_3166_2_entry + code="MK-74" name="Studeničani"/> + <iso_3166_2_entry + code="MK-69" name="Sveti Nikole"/> + <iso_3166_2_entry + code="MK-75" name="Tearce"/> + <iso_3166_2_entry + code="MK-76" name="Tetovo"/> + <iso_3166_2_entry + code="MK-10" name="Valandovo"/> + <iso_3166_2_entry + code="MK-11" name="Vasilevo"/> + <iso_3166_2_entry + code="MK-13" name="Veles"/> + <iso_3166_2_entry + code="MK-12" name="Vevčani"/> + <iso_3166_2_entry + code="MK-14" name="Vinica"/> + <iso_3166_2_entry + code="MK-15" name="Vraneštica"/> + <iso_3166_2_entry + code="MK-16" name="Vrapčište"/> + <iso_3166_2_entry + code="MK-31" name="Zajas"/> + <iso_3166_2_entry + code="MK-32" name="Zelenikovo"/> + <iso_3166_2_entry + code="MK-30" name="Želino"/> + <iso_3166_2_entry + code="MK-33" name="Zrnovci"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mali --> + <iso_3166_country code="ML"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="ML-BK0" name="Bamako"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="ML-7" name="Gao"/> + <iso_3166_2_entry + code="ML-1" name="Kayes"/> + <iso_3166_2_entry + code="ML-8" name="Kidal"/> + <iso_3166_2_entry + code="ML-2" name="Koulikoro"/> + <iso_3166_2_entry + code="ML-5" name="Mopti"/> + <iso_3166_2_entry + code="ML-4" name="Ségou"/> + <iso_3166_2_entry + code="ML-3" name="Sikasso"/> + <iso_3166_2_entry + code="ML-6" name="Tombouctou"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Myanmar --> + <iso_3166_country code="MM"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="MM-07" name="Ayeyarwady"/> + <iso_3166_2_entry + code="MM-02" name="Bago"/> + <iso_3166_2_entry + code="MM-03" name="Magway"/> + <iso_3166_2_entry + code="MM-04" name="Mandalay"/> + <iso_3166_2_entry + code="MM-01" name="Sagaing"/> + <iso_3166_2_entry + code="MM-05" name="Tanintharyi"/> + <iso_3166_2_entry + code="MM-06" name="Yangon"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="MM-14" name="Chin"/> + <iso_3166_2_entry + code="MM-11" name="Kachin"/> + <iso_3166_2_entry + code="MM-12" name="Kayah"/> + <iso_3166_2_entry + code="MM-13" name="Kayin"/> + <iso_3166_2_entry + code="MM-15" name="Mon"/> + <iso_3166_2_entry + code="MM-16" name="Rakhine"/> + <iso_3166_2_entry + code="MM-17" name="Shan"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mongolia --> + <iso_3166_country code="MN"> + <iso_3166_subset type="Province"> + <!-- Different transliterations possible, is there an official one? --> + <iso_3166_2_entry + code="MN-073" name="Arhangay"/> + <iso_3166_2_entry + code="MN-069" name="Bayanhongor"/> + <iso_3166_2_entry + code="MN-071" name="Bayan-Ölgiy"/> + <iso_3166_2_entry + code="MN-067" name="Bulgan"/> + <iso_3166_2_entry + code="MN-061" name="Dornod"/> + <iso_3166_2_entry + code="MN-063" name="Dornogovi"/> + <iso_3166_2_entry + code="MN-059" name="Dundgovi"/> + <iso_3166_2_entry + code="MN-057" name="Dzavhan"/> + <iso_3166_2_entry + code="MN-065" name="Govi-Altay"/> + <iso_3166_2_entry + code="MN-039" name="Hentiy"/> + <iso_3166_2_entry + code="MN-043" name="Hovd"/> + <iso_3166_2_entry + code="MN-041" name="Hövsgöl"/> + <iso_3166_2_entry + code="MN-053" name="Ömnögovi"/> + <iso_3166_2_entry + code="MN-055" name="Övörhangay"/> + <iso_3166_2_entry + code="MN-049" name="Selenge"/> + <iso_3166_2_entry + code="MN-051" name="Sühbaatar"/> + <iso_3166_2_entry + code="MN-047" name="Töv"/> + <iso_3166_2_entry + code="MN-046" name="Uvs"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="MN-1" name="Ulanbaatar"/> + <iso_3166_2_entry + code="MN-037" name="Darhan uul"/> + <iso_3166_2_entry + code="MN-064" name="Govi-Sumber"/> + <iso_3166_2_entry + code="MN-035" name="Orhon"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Macao --> + <iso_3166_country code="MO"/> + <!-- Mauritania --> + <iso_3166_country code="MR"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MR-NKC" name="Nouakchott"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="MR-07" name="Adrar"/> + <iso_3166_2_entry + code="MR-03" name="Assaba"/> + <iso_3166_2_entry + code="MR-05" name="Brakna"/> + <iso_3166_2_entry + code="MR-08" name="Dakhlet Nouadhibou"/> + <iso_3166_2_entry + code="MR-04" name="Gorgol"/> + <iso_3166_2_entry + code="MR-10" name="Guidimaka"/> + <iso_3166_2_entry + code="MR-01" name="Hodh ech Chargui"/> + <iso_3166_2_entry + code="MR-02" name="Hodh el Charbi"/> + <iso_3166_2_entry + code="MR-12" name="Inchiri"/> + <iso_3166_2_entry + code="MR-09" name="Tagant"/> + <iso_3166_2_entry + code="MR-11" name="Tiris Zemmour"/> + <iso_3166_2_entry + code="MR-06" name="Trarza"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Malta --> + <iso_3166_country code="MT"> + <iso_3166_subset type="Local council"> + <iso_3166_2_entry + code="MT-01" name="Attard"/> + <iso_3166_2_entry + code="MT-02" name="Balzan"/> + <iso_3166_2_entry + code="MT-03" name="Birgu"/> + <iso_3166_2_entry + code="MT-04" name="Birkirkara"/> + <iso_3166_2_entry + code="MT-05" name="Birżebbuġa"/> + <iso_3166_2_entry + code="MT-06" name="Bormla"/> + <iso_3166_2_entry + code="MT-07" name="Dingli"/> + <iso_3166_2_entry + code="MT-08" name="Fgura"/> + <iso_3166_2_entry + code="MT-09" name="Floriana"/> + <iso_3166_2_entry + code="MT-10" name="Fontana"/> + <iso_3166_2_entry + code="MT-11" name="Gudja"/> + <iso_3166_2_entry + code="MT-12" name="Gżira"/> + <iso_3166_2_entry + code="MT-13" name="Għajnsielem"/> + <iso_3166_2_entry + code="MT-14" name="Għarb"/> + <iso_3166_2_entry + code="MT-15" name="Għargħur"/> + <iso_3166_2_entry + code="MT-16" name="Għasri"/> + <iso_3166_2_entry + code="MT-17" name="Għaxaq"/> + <iso_3166_2_entry + code="MT-18" name="Ħamrun"/> + <iso_3166_2_entry + code="MT-19" name="Iklin"/> + <iso_3166_2_entry + code="MT-20" name="Isla"/> + <iso_3166_2_entry + code="MT-21" name="Kalkara"/> + <iso_3166_2_entry + code="MT-22" name="Kerċem"/> + <iso_3166_2_entry + code="MT-23" name="Kirkop"/> + <iso_3166_2_entry + code="MT-24" name="Lija"/> + <iso_3166_2_entry + code="MT-25" name="Luqa"/> + <iso_3166_2_entry + code="MT-26" name="Marsa"/> + <iso_3166_2_entry + code="MT-27" name="Marsaskala"/> + <iso_3166_2_entry + code="MT-28" name="Marsaxlokk"/> + <iso_3166_2_entry + code="MT-29" name="Mdina"/> + <iso_3166_2_entry + code="MT-30" name="Mellieħa"/> + <iso_3166_2_entry + code="MT-31" name="Mġarr"/> + <iso_3166_2_entry + code="MT-32" name="Mosta"/> + <iso_3166_2_entry + code="MT-33" name="Mqabba"/> + <iso_3166_2_entry + code="MT-34" name="Msida"/> + <iso_3166_2_entry + code="MT-35" name="Mtarfa"/> + <iso_3166_2_entry + code="MT-36" name="Munxar"/> + <iso_3166_2_entry + code="MT-37" name="Nadur"/> + <iso_3166_2_entry + code="MT-38" name="Naxxar"/> + <iso_3166_2_entry + code="MT-39" name="Paola"/> + <iso_3166_2_entry + code="MT-40" name="Pembroke"/> + <iso_3166_2_entry + code="MT-41" name="Pietà"/> + <iso_3166_2_entry + code="MT-42" name="Qala"/> + <iso_3166_2_entry + code="MT-43" name="Qormi"/> + <iso_3166_2_entry + code="MT-44" name="Qrendi"/> + <iso_3166_2_entry + code="MT-45" name="Rabat Għawdex"/> + <iso_3166_2_entry + code="MT-46" name="Rabat Malta"/> + <iso_3166_2_entry + code="MT-47" name="Safi"/> + <iso_3166_2_entry + code="MT-48" name="San Ġiljan"/> + <iso_3166_2_entry + code="MT-49" name="San Ġwann"/> + <iso_3166_2_entry + code="MT-50" name="San Lawrenz"/> + <iso_3166_2_entry + code="MT-51" name="San Pawl il-Baħar"/> + <iso_3166_2_entry + code="MT-52" name="Sannat"/> + <iso_3166_2_entry + code="MT-53" name="Santa Luċija"/> + <iso_3166_2_entry + code="MT-54" name="Santa Venera"/> + <iso_3166_2_entry + code="MT-55" name="Siġġiewi"/> + <iso_3166_2_entry + code="MT-56" name="Sliema"/> + <iso_3166_2_entry + code="MT-57" name="Swieqi"/> + <iso_3166_2_entry + code="MT-58" name="Ta’ Xbiex"/> + <iso_3166_2_entry + code="MT-59" name="Tarxien"/> + <iso_3166_2_entry + code="MT-60" name="Valletta"/> + <iso_3166_2_entry + code="MT-61" name="Xagħra"/> + <iso_3166_2_entry + code="MT-62" name="Xewkija"/> + <iso_3166_2_entry + code="MT-63" name="Xgħajra"/> + <iso_3166_2_entry + code="MT-64" name="Żabbar"/> + <iso_3166_2_entry + code="MT-65" name="Żebbuġ Għawdex"/> + <iso_3166_2_entry + code="MT-66" name="Żebbuġ Malta"/> + <iso_3166_2_entry + code="MT-67" name="Żejtun"/> + <iso_3166_2_entry + code="MT-68" name="Żurrieq"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mauritius --> + <iso_3166_country code="MU"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MU-BR" name="Beau Bassin-Rose Hill"/> + <iso_3166_2_entry + code="MU-CU" name="Curepipe"/> + <iso_3166_2_entry + code="MU-PU" name="Port Louis"/> + <iso_3166_2_entry + code="MU-QB" name="Quatre Bornes"/> + <iso_3166_2_entry + code="MU-VP" name="Vacoas-Phoenix"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="MU-AG" name="Agalega Islands"/> + <iso_3166_2_entry + code="MU-CC" name="Cargados Carajos Shoals"/> + <iso_3166_2_entry + code="MU-RO" name="Rodrigues Island"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MU-BL" name="Black River"/> + <iso_3166_2_entry + code="MU-FL" name="Flacq"/> + <iso_3166_2_entry + code="MU-GP" name="Grand Port"/> + <iso_3166_2_entry + code="MU-MO" name="Moka"/> + <iso_3166_2_entry + code="MU-PA" name="Pamplemousses"/> + <iso_3166_2_entry + code="MU-PW" name="Plaines Wilhems"/> + <iso_3166_2_entry + code="MU-PL" name="Port Louis"/> + <iso_3166_2_entry + code="MU-RP" name="Rivière du Rempart"/> + <iso_3166_2_entry + code="MU-SA" name="Savanne"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Maldives --> + <iso_3166_country code="MV"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MV-MLE" name="Male"/> + </iso_3166_subset> + <iso_3166_subset type="Atoll"> + <iso_3166_2_entry + code="MV-02" name="Alif"/> + <iso_3166_2_entry + code="MV-20" name="Baa"/> + <iso_3166_2_entry + code="MV-17" name="Dhaalu"/> + <iso_3166_2_entry + code="MV-14" name="Faafu"/> + <iso_3166_2_entry + code="MV-27" name="Gaafu Aliff"/> + <iso_3166_2_entry + code="MV-28" name="Gaafu Daalu"/> + <iso_3166_2_entry + code="MV-29" name="Gnaviyani"/> + <iso_3166_2_entry + code="MV-07" name="Haa Alif"/> + <iso_3166_2_entry + code="MV-23" name="Haa Dhaalu"/> + <iso_3166_2_entry + code="MV-26" name="Kaafu"/> + <iso_3166_2_entry + code="MV-05" name="Laamu"/> + <iso_3166_2_entry + code="MV-03" name="Lhaviyani"/> + <iso_3166_2_entry + code="MV-12" name="Meemu"/> + <iso_3166_2_entry + code="MV-25" name="Noonu"/> + <iso_3166_2_entry + code="MV-13" name="Raa"/> + <iso_3166_2_entry + code="MV-01" name="Seenu"/> + <iso_3166_2_entry + code="MV-24" name="Shaviyani"/> + <iso_3166_2_entry + code="MV-08" name="Thaa"/> + <iso_3166_2_entry + code="MV-04" name="Vaavu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Malawi --> + <iso_3166_country code="MW"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="MW C" name="Central Region"/> + <iso_3166_2_entry + code="MW N" name="Northern Region"/> + <iso_3166_2_entry + code="MW S" name="Southern Region"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MW-BA" name="Balaka" parent="S"/> + <iso_3166_2_entry + code="MW-BL" name="Blantyre" parent="S"/> + <iso_3166_2_entry + code="MW-CK" name="Chikwawa" parent="S"/> + <iso_3166_2_entry + code="MW-CR" name="Chiradzulu" parent="S"/> + <iso_3166_2_entry + code="MW-CT" name="Chitipa" parent="N"/> + <iso_3166_2_entry + code="MW-DE" name="Dedza" parent="C"/> + <iso_3166_2_entry + code="MW-DO" name="Dowa" parent="C"/> + <iso_3166_2_entry + code="MW-KR" name="Karonga" parent="N"/> + <iso_3166_2_entry + code="MW-KS" name="Kasungu" parent="C"/> + <iso_3166_2_entry + code="MW-LK" name="Likoma" parent="N"/> + <iso_3166_2_entry + code="MW-LI" name="Lilongwe" parent="C"/> + <iso_3166_2_entry + code="MW-MH" name="Machinga" parent="S"/> + <iso_3166_2_entry + code="MW-MG" name="Mangochi" parent="S"/> + <iso_3166_2_entry + code="MW-MC" name="Mchinji" parent="C"/> + <iso_3166_2_entry + code="MW-MU" name="Mulanje" parent="S"/> + <iso_3166_2_entry + code="MW-MW" name="Mwanza" parent="S"/> + <iso_3166_2_entry + code="MW-MZ" name="Mzimba" parent="N"/> + <iso_3166_2_entry + code="MW-NE" name="Neno" parent="N"/> + <iso_3166_2_entry + code="MW-NB" name="Nkhata Bay" parent="N"/> + <iso_3166_2_entry + code="MW-NK" name="Nkhotakota" parent="C"/> + <iso_3166_2_entry + code="MW-NS" name="Nsanje" parent="S"/> + <iso_3166_2_entry + code="MW-NU" name="Ntcheu" parent="C"/> + <iso_3166_2_entry + code="MW-NI" name="Ntchisi" parent="C"/> + <iso_3166_2_entry + code="MW-PH" name="Phalombe" parent="S"/> + <iso_3166_2_entry + code="MW-RU" name="Rumphi" parent="N"/> + <iso_3166_2_entry + code="MW-SA" name="Salima" parent="C"/> + <iso_3166_2_entry + code="MW-TH" name="Thyolo" parent="S"/> + <iso_3166_2_entry + code="MW-ZO" name="Zomba" parent="S"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mexico --> + <iso_3166_country code="MX"> + <iso_3166_subset type="Federal district"> + <iso_3166_2_entry + code="MX-DIF" name="Distrito Federal"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="MX-AGU" name="Aguascalientes"/> + <iso_3166_2_entry + code="MX-BCN" name="Baja California"/> + <iso_3166_2_entry + code="MX-BCS" name="Baja California Sur"/> + <iso_3166_2_entry + code="MX-CAM" name="Campeche"/> + <iso_3166_2_entry + code="MX-COA" name="Coahuila"/> + <iso_3166_2_entry + code="MX-COL" name="Colima"/> + <iso_3166_2_entry + code="MX-CHP" name="Chiapas"/> + <iso_3166_2_entry + code="MX-CHH" name="Chihuahua"/> + <iso_3166_2_entry + code="MX-DUR" name="Durango"/> + <iso_3166_2_entry + code="MX-GUA" name="Guanajuato"/> + <iso_3166_2_entry + code="MX-GRO" name="Guerrero"/> + <iso_3166_2_entry + code="MX-HID" name="Hidalgo"/> + <iso_3166_2_entry + code="MX-JAL" name="Jalisco"/> + <iso_3166_2_entry + code="MX-MEX" name="México"/> + <iso_3166_2_entry + code="MX-MIC" name="Michoacán"/> + <iso_3166_2_entry + code="MX-MOR" name="Morelos"/> + <iso_3166_2_entry + code="MX-NAY" name="Nayarit"/> + <iso_3166_2_entry + code="MX-NLE" name="Nuevo León"/> + <iso_3166_2_entry + code="MX-OAX" name="Oaxaca"/> + <iso_3166_2_entry + code="MX-PUE" name="Puebla"/> + <iso_3166_2_entry + code="MX-QUE" name="Querétaro"/> + <iso_3166_2_entry + code="MX-ROO" name="Quintana Roo"/> + <iso_3166_2_entry + code="MX-SLP" name="San Luis Potosí"/> + <iso_3166_2_entry + code="MX-SIN" name="Sinaloa"/> + <iso_3166_2_entry + code="MX-SON" name="Sonora"/> + <iso_3166_2_entry + code="MX-TAB" name="Tabasco"/> + <iso_3166_2_entry + code="MX-TAM" name="Tamaulipas"/> + <iso_3166_2_entry + code="MX-TLA" name="Tlaxcala"/> + <iso_3166_2_entry + code="MX-VER" name="Veracruz"/> + <iso_3166_2_entry + code="MX-YUC" name="Yucatán"/> + <iso_3166_2_entry + code="MX-ZAC" name="Zacatecas"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Malaysia --> + <iso_3166_country code="MY"> + <iso_3166_subset type="Federal Territories"> + <iso_3166_2_entry + code="MY-14" name="Wilayah Persekutuan Kuala Lumpur"/> + <iso_3166_2_entry + code="MY-15" name="Wilayah Persekutuan Labuan"/> + <iso_3166_2_entry + code="MY-16" name="Wilayah Persekutuan Putrajaya"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="MY-01" name="Johor"/> + <iso_3166_2_entry + code="MY-02" name="Kedah"/> + <iso_3166_2_entry + code="MY-03" name="Kelantan"/> + <iso_3166_2_entry + code="MY-04" name="Melaka"/> + <iso_3166_2_entry + code="MY-05" name="Negeri Sembilan"/> + <iso_3166_2_entry + code="MY-06" name="Pahang"/> + <iso_3166_2_entry + code="MY-08" name="Perak"/> + <iso_3166_2_entry + code="MY-09" name="Perlis"/> + <iso_3166_2_entry + code="MY-07" name="Pulau Pinang"/> + <iso_3166_2_entry + code="MY-12" name="Sabah"/> + <iso_3166_2_entry + code="MY-13" name="Sarawak"/> + <iso_3166_2_entry + code="MY-10" name="Selangor"/> + <iso_3166_2_entry + code="MY-11" name="Terengganu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mozambique --> + <iso_3166_country code="MZ"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MZ-MPM" name="Maputo (city)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="MZ-P" name="Cabo Delgado"/> + <iso_3166_2_entry + code="MZ-G" name="Gaza"/> + <iso_3166_2_entry + code="MZ-I" name="Inhambane"/> + <iso_3166_2_entry + code="MZ-B" name="Manica"/> + <iso_3166_2_entry + code="MZ-L" name="Maputo"/> + <iso_3166_2_entry + code="MZ-N" name="Numpula"/> + <iso_3166_2_entry + code="MZ-A" name="Niassa"/> + <iso_3166_2_entry + code="MZ-S" name="Sofala"/> + <iso_3166_2_entry + code="MZ-T" name="Tete"/> + <iso_3166_2_entry + code="MZ-Q" name="Zambezia"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Namibia --> + <iso_3166_country code="NA"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="NA-CA" name="Caprivi"/> + <iso_3166_2_entry + code="NA-ER" name="Erongo"/> + <iso_3166_2_entry + code="NA-HA" name="Hardap"/> + <iso_3166_2_entry + code="NA-KA" name="Karas"/> + <iso_3166_2_entry + code="NA-KH" name="Khomas"/> + <iso_3166_2_entry + code="NA-KU" name="Kunene"/> + <iso_3166_2_entry + code="NA-OW" name="Ohangwena"/> + <iso_3166_2_entry + code="NA-OK" name="Okavango"/> + <iso_3166_2_entry + code="NA-OH" name="Omaheke"/> + <iso_3166_2_entry + code="NA-OS" name="Omusati"/> + <iso_3166_2_entry + code="NA-ON" name="Oshana"/> + <iso_3166_2_entry + code="NA-OT" name="Oshikoto"/> + <iso_3166_2_entry + code="NA-OD" name="Otjozondjupa"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Niger --> + <iso_3166_country code="NE"> + <iso_3166_subset type="Capital District"> + <iso_3166_2_entry + code="NE-8" name="Niamey"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="NE-1" name="Agadez"/> + <iso_3166_2_entry + code="NE-2" name="Diffa"/> + <iso_3166_2_entry + code="NE-3" name="Dosso"/> + <iso_3166_2_entry + code="NE-4" name="Maradi"/> + <iso_3166_2_entry + code="NE-5" name="Tahoua"/> + <iso_3166_2_entry + code="NE-6" name="Tillabéri"/> + <iso_3166_2_entry + code="NE-7" name="Zinder"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nigeria --> + <iso_3166_country code="NG"> + <iso_3166_subset type="Capital Territory"> + <iso_3166_2_entry + code="NG-FC" name="Abuja Capital Territory"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="NG-AB" name="Abia"/> + <iso_3166_2_entry + code="NG-AD" name="Adamawa"/> + <iso_3166_2_entry + code="NG-AK" name="Akwa Ibom"/> + <iso_3166_2_entry + code="NG-AN" name="Anambra"/> + <iso_3166_2_entry + code="NG-BA" name="Bauchi"/> + <iso_3166_2_entry + code="NG-BY" name="Bayelsa"/> + <iso_3166_2_entry + code="NG-BE" name="Benue"/> + <iso_3166_2_entry + code="NG-BO" name="Borno"/> + <iso_3166_2_entry + code="NG-CR" name="Cross River"/> + <iso_3166_2_entry + code="NG-DE" name="Delta"/> + <iso_3166_2_entry + code="NG-EB" name="Ebonyi"/> + <iso_3166_2_entry + code="NG-ED" name="Edo"/> + <iso_3166_2_entry + code="NG-EK" name="Ekiti"/> + <iso_3166_2_entry + code="NG-EN" name="Enugu"/> + <iso_3166_2_entry + code="NG-GO" name="Gombe"/> + <iso_3166_2_entry + code="NG-IM" name="Imo"/> + <iso_3166_2_entry + code="NG-JI" name="Jigawa"/> + <iso_3166_2_entry + code="NG-KD" name="Kaduna"/> + <iso_3166_2_entry + code="NG-KN" name="Kano"/> + <iso_3166_2_entry + code="NG-KT" name="Katsina"/> + <iso_3166_2_entry + code="NG-KE" name="Kebbi"/> + <iso_3166_2_entry + code="NG-KO" name="Kogi"/> + <iso_3166_2_entry + code="NG-KW" name="Kwara"/> + <iso_3166_2_entry + code="NG-LA" name="Lagos"/> + <iso_3166_2_entry + code="NG-NA" name="Nassarawa"/> + <iso_3166_2_entry + code="NG-NI" name="Niger"/> + <iso_3166_2_entry + code="NG-OG" name="Ogun"/> + <iso_3166_2_entry + code="NG-ON" name="Ondo"/> + <iso_3166_2_entry + code="NG-OS" name="Osun"/> + <iso_3166_2_entry + code="NG-OY" name="Oyo"/> + <iso_3166_2_entry + code="NG-PL" name="Plateau"/> + <iso_3166_2_entry + code="NG-RI" name="Rivers"/> + <iso_3166_2_entry + code="NG-SO" name="Sokoto"/> + <iso_3166_2_entry + code="NG-TA" name="Taraba"/> + <iso_3166_2_entry + code="NG-YO" name="Yobe"/> + <iso_3166_2_entry + code="NG-ZA" name="Zamfara"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nicaragua --> + <iso_3166_country code="NI"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="NI-BO" name="Boaco"/> + <iso_3166_2_entry + code="NI-CA" name="Carazo"/> + <iso_3166_2_entry + code="NI-CI" name="Chinandega"/> + <iso_3166_2_entry + code="NI-CO" name="Chontales"/> + <iso_3166_2_entry + code="NI-ES" name="Estelí"/> + <iso_3166_2_entry + code="NI-GR" name="Granada"/> + <iso_3166_2_entry + code="NI-JI" name="Jinotega"/> + <iso_3166_2_entry + code="NI-LE" name="León"/> + <iso_3166_2_entry + code="NI-MD" name="Madriz"/> + <iso_3166_2_entry + code="NI-MN" name="Managua"/> + <iso_3166_2_entry + code="NI-MS" name="Masaya"/> + <iso_3166_2_entry + code="NI-MT" name="Matagalpa"/> + <iso_3166_2_entry + code="NI-NS" name="Nueva Segovia"/> + <iso_3166_2_entry + code="NI-SJ" name="Río San Juan"/> + <iso_3166_2_entry + code="NI-RI" name="Rivas"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous Region"> + <iso_3166_2_entry + code="NI-AN" name="Atlántico Norte"/> + <iso_3166_2_entry + code="NI-AS" name="Atlántico Sur"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Netherlands --> + <iso_3166_country code="NL"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="NL-DR" name="Drenthe"/> + <iso_3166_2_entry + code="NL-FL" name="Flevoland"/> + <iso_3166_2_entry + code="NL-FR" name="Friesland"/> + <iso_3166_2_entry + code="NL-GE" name="Gelderland"/> + <iso_3166_2_entry + code="NL-GR" name="Groningen"/> + <iso_3166_2_entry + code="NL-LI" name="Limburg"/> + <iso_3166_2_entry + code="NL-NB" name="Noord-Brabant"/> + <iso_3166_2_entry + code="NL-NH" name="Noord-Holland"/> + <iso_3166_2_entry + code="NL-OV" name="Overijssel"/> + <iso_3166_2_entry + code="NL-UT" name="Utrecht"/> + <iso_3166_2_entry + code="NL-ZE" name="Zeeland"/> + <iso_3166_2_entry + code="NL-ZH" name="Zuid-Holland"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Norway --> + <iso_3166_country code="NO"> + <iso_3166_subset type="County"> + <!-- Derived from http://geotags.com/geo/DMS3.html --> + <!-- See also Country code 'SJ' for Jan Mayen & Svalbard --> + <iso_3166_2_entry + code="NO-02" name="Akershus"/> + <iso_3166_2_entry + code="NO-09" name="Aust-Agder"/> + <iso_3166_2_entry + code="NO-06" name="Buskerud"/> + <iso_3166_2_entry + code="NO-20" name="Finnmark"/> + <iso_3166_2_entry + code="NO-04" name="Hedmark"/> + <iso_3166_2_entry + code="NO-12" name="Hordaland"/> + <iso_3166_2_entry + code="NO-15" name="Møre og Romsdal"/> + <iso_3166_2_entry + code="NO-18" name="Nordland"/> + <iso_3166_2_entry + code="NO-17" name="Nord-Trøndelag"/> + <iso_3166_2_entry + code="NO-05" name="Oppland"/> + <iso_3166_2_entry + code="NO-03" name="Oslo"/> + <iso_3166_2_entry + code="NO-11" name="Rogaland"/> + <iso_3166_2_entry + code="NO-14" name="Sogn og Fjordane"/> + <iso_3166_2_entry + code="NO-16" name="Sør-Trøndelag"/> + <iso_3166_2_entry + code="NO-08" name="Telemark"/> + <iso_3166_2_entry + code="NO-19" name="Troms"/> + <iso_3166_2_entry + code="NO-10" name="Vest-Agder"/> + <iso_3166_2_entry + code="NO-07" name="Vestfold"/> + <iso_3166_2_entry + code="NO-01" name="Østfold"/> + <iso_3166_2_entry + code="NO-22" name="Jan Mayen"/> + <iso_3166_2_entry + code="NO-21" name="Svalbard"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nepal --> + <iso_3166_country code="NP"> + <iso_3166_subset type="Development region"> + <iso_3166_2_entry + code="NP-1" name="Madhyamanchal"/> + <iso_3166_2_entry + code="NP-2" name="Madhya Pashchimanchal"/> + <iso_3166_2_entry + code="NP-3" name="Pashchimanchal"/> + <iso_3166_2_entry + code="NP-4" name="Purwanchal"/> + <iso_3166_2_entry + code="NP-5" name="Sudur Pashchimanchal"/> + </iso_3166_subset> + <iso_3166_subset type="zone"> + <iso_3166_2_entry + code="NP-BA" name="Bagmati" parent="1"/> + <iso_3166_2_entry + code="NP-BH" name="Bheri" parent="2"/> + <iso_3166_2_entry + code="NP-DH" name="Dhawalagiri" parent="3"/> + <iso_3166_2_entry + code="NP-GA" name="Gandaki" parent="3"/> + <iso_3166_2_entry + code="NP-JA" name="Janakpur" parent="1"/> + <iso_3166_2_entry + code="NP-KA" name="Karnali" parent="2"/> + <iso_3166_2_entry + code="NP-KO" name="Kosi" parent="4"/> + <iso_3166_2_entry + code="NP-LU" name="Lumbini" parent="3"/> + <iso_3166_2_entry + code="NP-MA" name="Mahakali" parent="5"/> + <iso_3166_2_entry + code="NP-ME" name="Mechi" parent="4"/> + <iso_3166_2_entry + code="NP-NA" name="Narayani" parent="1"/> + <iso_3166_2_entry + code="NP-RA" name="Rapti" parent="2"/> + <iso_3166_2_entry + code="NP-SA" name="Sagarmatha" parent="4"/> + <iso_3166_2_entry + code="NP-SE" name="Seti" parent="5"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nauru --> + <iso_3166_country code="NR"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="NR-01" name="Aiwo"/> + <iso_3166_2_entry + code="NR-02" name="Anabar"/> + <iso_3166_2_entry + code="NR-03" name="Anetan"/> + <iso_3166_2_entry + code="NR-04" name="Anibare"/> + <iso_3166_2_entry + code="NR-05" name="Baiti"/> + <iso_3166_2_entry + code="NR-06" name="Boe"/> + <iso_3166_2_entry + code="NR-07" name="Buada"/> + <iso_3166_2_entry + code="NR-08" name="Denigomodu"/> + <iso_3166_2_entry + code="NR-09" name="Ewa"/> + <iso_3166_2_entry + code="NR-10" name="Ijuw"/> + <iso_3166_2_entry + code="NR-11" name="Meneng"/> + <iso_3166_2_entry + code="NR-12" name="Nibok"/> + <iso_3166_2_entry + code="NR-13" name="Uaboe"/> + <iso_3166_2_entry + code="NR-14" name="Yaren"/> + </iso_3166_subset> + </iso_3166_country> + <!-- New Zealand --> + <iso_3166_country code="NZ"> + <iso_3166_subset type="Island"> + <iso_3166_2_entry + code="NZ-N" name="North Island"/> + <iso_3166_2_entry + code="NZ-S" name="South Island"/> + </iso_3166_subset> + <iso_3166_subset type="Regional council"> + <iso_3166_2_entry + code="NZ-AUK" name="Auckland" parent="N"/> + <iso_3166_2_entry + code="NZ-BOP" name="Bay of Plenty" parent="N"/> + <iso_3166_2_entry + code="NZ-CAN" name="Canterbury" parent="S"/> + <iso_3166_2_entry + code="NZ-HKB" name="Hawke's Bay" parent="N"/> + <iso_3166_2_entry + code="NZ-MWT" name="Manawatu-Wanganui" parent="N"/> + <iso_3166_2_entry + code="NZ-NTL" name="Northland" parent="N"/> + <iso_3166_2_entry + code="NZ-OTA" name="Otago" parent="S"/> + <iso_3166_2_entry + code="NZ-STL" name="Southland" parent="S"/> + <iso_3166_2_entry + code="NZ-TKI" name="Taranaki" parent="N"/> + <iso_3166_2_entry + code="NZ-WKO" name="Waikato" parent="N"/> + <iso_3166_2_entry + code="NZ-WGN" name="Wellington" parent="N"/> + <iso_3166_2_entry + code="NZ-WTC" name="West Coast" parent="S"/> + </iso_3166_subset> + <iso_3166_subset type="Unitary authority"> + <iso_3166_2_entry + code="NZ-GIS" name="Gisborne District" parent="N"/> + <iso_3166_2_entry + code="NZ-MBH" name="Marlborough District" parent="S"/> + <iso_3166_2_entry + code="NZ-NSN" name="Nelson City" parent="S"/> + <iso_3166_2_entry + code="NZ-TAS" name="Tasman District" parent="S"/> + </iso_3166_subset> + <iso_3166_subset type="Special island authority"> + <iso_3166_2_entry + code="NZ-CIT" name="Chatham Islands Territory"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Oman --> + <iso_3166_country code="OM"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="OM-DA" name="Ad Dākhilīya"/> + <iso_3166_2_entry + code="OM-BA" name="Al Bāţinah"/> + <iso_3166_2_entry + code="OM-WU" name="Al Wusţá"/> + <iso_3166_2_entry + code="OM-SH" name="Ash Sharqīyah"/> + <iso_3166_2_entry + code="OM-ZA" name="Az̧ Z̧āhirah"/> + </iso_3166_subset> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="OM-BU" name="Al Buraymī"/> + <iso_3166_2_entry + code="OM-MA" name="Masqaţ"/> + <iso_3166_2_entry + code="OM-MU" name="Musandam"/> + <iso_3166_2_entry + code="OM-ZU" name="Z̧ufār"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Panama --> + <iso_3166_country code="PA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PA-1" name="Bocas del Toro"/> + <iso_3166_2_entry + code="PA-4" name="Chiriquí"/> + <iso_3166_2_entry + code="PA-2" name="Coclé"/> + <iso_3166_2_entry + code="PA-3" name="Colón"/> + <iso_3166_2_entry + code="PA-5" name="Darién"/> + <iso_3166_2_entry + code="PA-6" name="Herrera"/> + <iso_3166_2_entry + code="PA-7" name="Los Santos"/> + <iso_3166_2_entry + code="PA-8" name="Panamá"/> + <iso_3166_2_entry + code="PA-9" name="Veraguas"/> + </iso_3166_subset> + <iso_3166_subset type="Indigenous region"> + <iso_3166_2_entry + code="PA-EM" name="Emberá"/> + <iso_3166_2_entry + code="PA-KY" name="Kuna Yala"/> + <iso_3166_2_entry + code="PA-NB" name="Ngöbe-Buglé"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Peru --> + <iso_3166_country code="PE"> + <iso_3166_subset type="Constitutional province"> + <iso_3166_2_entry + code="PE-CAL" name="El Callao"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="PE-LMA" name="Municipalidad Metropolitana de Lima"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="PE-AMA" name="Amazonas"/> + <iso_3166_2_entry + code="PE-ANC" name="Ancash"/> + <iso_3166_2_entry + code="PE-APU" name="Apurímac"/> + <iso_3166_2_entry + code="PE-ARE" name="Arequipa"/> + <iso_3166_2_entry + code="PE-AYA" name="Ayacucho"/> + <iso_3166_2_entry + code="PE-CAJ" name="Cajamarca"/> + <iso_3166_2_entry + code="PE-CUS" name="Cusco [Cuzco]"/> + <iso_3166_2_entry + code="PE-HUV" name="Huancavelica"/> + <iso_3166_2_entry + code="PE-HUC" name="Huánuco"/> + <iso_3166_2_entry + code="PE-ICA" name="Ica"/> + <iso_3166_2_entry + code="PE-JUN" name="Junín"/> + <iso_3166_2_entry + code="PE-LAL" name="La Libertad"/> + <iso_3166_2_entry + code="PE-LAM" name="Lambayeque"/> + <iso_3166_2_entry + code="PE-LIM" name="Lima"/> + <iso_3166_2_entry + code="PE-LOR" name="Loreto"/> + <iso_3166_2_entry + code="PE-MDD" name="Madre de Dios"/> + <iso_3166_2_entry + code="PE-MOQ" name="Moquegua"/> + <iso_3166_2_entry + code="PE-PAS" name="Pasco"/> + <iso_3166_2_entry + code="PE-PIU" name="Piura"/> + <iso_3166_2_entry + code="PE-PUN" name="Puno"/> + <iso_3166_2_entry + code="PE-SAM" name="San Martín"/> + <iso_3166_2_entry + code="PE-TAC" name="Tacna"/> + <iso_3166_2_entry + code="PE-TUM" name="Tumbes"/> + <iso_3166_2_entry + code="PE-UCA" name="Ucayali"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Papua New Guinea --> + <iso_3166_country code="PG"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="PG-NCD" name="National Capital District (Port Moresby)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PG-CPM" name="Central"/> + <iso_3166_2_entry + code="PG-CPK" name="Chimbu"/> + <iso_3166_2_entry + code="PG-EHG" name="Eastern Highlands"/> + <iso_3166_2_entry + code="PG-EBR" name="East New Britain"/> + <iso_3166_2_entry + code="PG-ESW" name="East Sepik"/> + <iso_3166_2_entry + code="PG-EPW" name="Enga"/> + <iso_3166_2_entry + code="PG-GPK" name="Gulf"/> + <iso_3166_2_entry + code="PG-MPM" name="Madang"/> + <iso_3166_2_entry + code="PG-MRL" name="Manus"/> + <iso_3166_2_entry + code="PG-MBA" name="Milne Bay"/> + <iso_3166_2_entry + code="PG-MPL" name="Morobe"/> + <iso_3166_2_entry + code="PG-NIK" name="New Ireland"/> + <iso_3166_2_entry + code="PG-NPP" name="Northern"/> + <iso_3166_2_entry + code="PG-NSA" name="North Solomons"/> + <iso_3166_2_entry + code="PG-SAN" name="Sandaun"/> + <iso_3166_2_entry + code="PG-SHM" name="Southern Highlands"/> + <iso_3166_2_entry + code="PG-WPD" name="Western"/> + <iso_3166_2_entry + code="PG-WHM" name="Western Highlands"/> + <iso_3166_2_entry + code="PG-WBK" name="West New Britain"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Phillipines --> + <iso_3166_country code="PH"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="PH-14" name="Autonomous Region in Muslim Mindanao (ARMM)"/> + <iso_3166_2_entry + code="PH-05" name="Bicol (Region V)"/> + <iso_3166_2_entry + code="PH-02" name="Cagayan Valley (Region II)"/> + <iso_3166_2_entry + code="PH-40" name="CALABARZON (Region IV-A)"/> + <iso_3166_2_entry + code="PH-13" name="Caraga (Region XIII)"/> + <iso_3166_2_entry + code="PH-03" name="Central Luzon (Region III)"/> + <iso_3166_2_entry + code="PH-07" name="Central Visayas (Region VII)"/> + <iso_3166_2_entry + code="PH-15" name="Cordillera Administrative Region (CAR)"/> + <iso_3166_2_entry + code="PH-08" name="Eastern Visayas (Region VIII)"/> + <iso_3166_2_entry + code="PH-01" name="Ilocos (Region I)"/> + <iso_3166_2_entry + code="PH-41" name="MIMAROPA (Region IV-B)"/> + <iso_3166_2_entry + code="PH-00" name="National Capital Region"/> + <iso_3166_2_entry + code="PH-10" name="Northern Mindanao (Region X)"/> + <iso_3166_2_entry + code="PH-12" name="Soccsksargen (Region XII)"/> + <iso_3166_2_entry + code="PH-06" name="Western Visayas (Region VI)"/> + <iso_3166_2_entry + code="PH-09" name="Zamboanga Peninsula (Region IX)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PH-ABR" name="Abra" parent="15"/> + <iso_3166_2_entry + code="PH-AGN" name="Agusan del Norte" parent="13"/> + <iso_3166_2_entry + code="PH-AGS" name="Agusan del Sur" parent="13"/> + <iso_3166_2_entry + code="PH-AKL" name="Aklan" parent="06"/> + <iso_3166_2_entry + code="PH-ALB" name="Albay" parent="05"/> + <iso_3166_2_entry + code="PH-ANT" name="Antique" parent="06"/> + <iso_3166_2_entry + code="PH-APA" name="Apayao" parent="15"/> + <iso_3166_2_entry + code="PH-AUR" name="Aurora" parent="03"/> + <iso_3166_2_entry + code="PH-BAS" name="Basilan" parent="09"/> + <iso_3166_2_entry + code="PH-BAN" name="Batasn" parent="03"/> + <iso_3166_2_entry + code="PH-BTN" name="Batanes" parent="02"/> + <iso_3166_2_entry + code="PH-BTG" name="Batangas" parent="40"/> + <iso_3166_2_entry + code="PH-BEN" name="Benguet" parent="15"/> + <iso_3166_2_entry + code="PH-BIL" name="Biliran" parent="08"/> + <iso_3166_2_entry + code="PH-BOH" name="Bohol" parent="07"/> + <iso_3166_2_entry + code="PH-BUK" name="Bukidnon" parent="10"/> + <iso_3166_2_entry + code="PH-BUL" name="Bulacan" parent="03"/> + <iso_3166_2_entry + code="PH-CAG" name="Cagayan" parent="02"/> + <iso_3166_2_entry + code="PH-CAN" name="Camarines Norte" parent="05"/> + <iso_3166_2_entry + code="PH-CAS" name="Camarines Sur" parent="05"/> + <iso_3166_2_entry + code="PH-CAM" name="Camiguin" parent="10"/> + <iso_3166_2_entry + code="PH-CAP" name="Capiz" parent="06"/> + <iso_3166_2_entry + code="PH-CAT" name="Catanduanes" parent="05"/> + <iso_3166_2_entry + code="PH-CAV" name="Cavite" parent="40"/> + <iso_3166_2_entry + code="PH-CEB" name="Cebu" parent="07"/> + <iso_3166_2_entry + code="PH-COM" name="Compostela Valley" parent="11"/> + <iso_3166_2_entry + code="PH-DAV" name="Davao del Norte" parent="11"/> + <iso_3166_2_entry + code="PH-DAS" name="Davao del Sur" parent="11"/> + <iso_3166_2_entry + code="PH-DAO" name="Davao Oriental" parent="11"/> + <iso_3166_2_entry + code="PH-DIN" name="Dinagat Islands" parent="13"/> + <iso_3166_2_entry + code="PH-EAS" name="Eastern Samar" parent="08"/> + <iso_3166_2_entry + code="PH-GUI" name="Guimaras" parent="06"/> + <iso_3166_2_entry + code="PH-IFU" name="Ifugao" parent="15"/> + <iso_3166_2_entry + code="PH-ILN" name="Ilocos Norte" parent="01"/> + <iso_3166_2_entry + code="PH-ILS" name="Ilocos Sur" parent="01"/> + <iso_3166_2_entry + code="PH-ILI" name="Iloilo" parent="06"/> + <iso_3166_2_entry + code="PH-ISA" name="Isabela" parent="02"/> + <iso_3166_2_entry + code="PH-KAL" name="Kalinga-Apayso" parent="15"/> + <iso_3166_2_entry + code="PH-LAG" name="Laguna" parent="40"/> + <iso_3166_2_entry + code="PH-LAN" name="Lanao del Norte" parent="12"/> + <iso_3166_2_entry + code="PH-LAS" name="Lanao del Sur" parent="14"/> + <iso_3166_2_entry + code="PH-LUN" name="La Union" parent="01"/> + <iso_3166_2_entry + code="PH-LEY" name="Leyte" parent="08"/> + <iso_3166_2_entry + code="PH-MAG" name="Maguindanao" parent="14"/> + <iso_3166_2_entry + code="PH-MAD" name="Marinduque" parent="41"/> + <iso_3166_2_entry + code="PH-MAS" name="Masbate" parent="05"/> + <iso_3166_2_entry + code="PH-MDC" name="Mindoro Occidental" parent="41"/> + <iso_3166_2_entry + code="PH-MDR" name="Mindoro Oriental" parent="41"/> + <iso_3166_2_entry + code="PH-MSC" name="Misamis Occidental" parent="10"/> + <iso_3166_2_entry + code="PH-MSR" name="Misamis Oriental" parent="10"/> + <iso_3166_2_entry + code="PH-MOU" name="Mountain Province" parent="15"/> + <iso_3166_2_entry + code="PH-NEC" name="Negroe Occidental" parent="06"/> + <iso_3166_2_entry + code="PH-NER" name="Negros Oriental" parent="07"/> + <iso_3166_2_entry + code="PH-NCO" name="North Cotabato" parent="12"/> + <iso_3166_2_entry + code="PH-NSA" name="Northern Samar" parent="08"/> + <iso_3166_2_entry + code="PH-NUE" name="Nueva Ecija" parent="03"/> + <iso_3166_2_entry + code="PH-NUV" name="Nueva Vizcaya" parent="02"/> + <iso_3166_2_entry + code="PH-PLW" name="Palawan" parent="41"/> + <iso_3166_2_entry + code="PH-PAM" name="Pampanga" parent="03"/> + <iso_3166_2_entry + code="PH-PAN" name="Pangasinan" parent="01"/> + <iso_3166_2_entry + code="PH-QUE" name="Quezon" parent="40"/> + <iso_3166_2_entry + code="PH-QUI" name="Quirino" parent="02"/> + <iso_3166_2_entry + code="PH-RIZ" name="Rizal" parent="40"/> + <iso_3166_2_entry + code="PH-ROM" name="Romblon" parent="41"/> + <iso_3166_2_entry + code="PH-SAR" name="Sarangani" parent="11"/> + <iso_3166_2_entry + code="PH-SIG" name="Siquijor" parent="07"/> + <iso_3166_2_entry + code="PH-SOR" name="Sorsogon" parent="05"/> + <iso_3166_2_entry + code="PH-SCO" name="South Cotabato" parent="11"/> + <iso_3166_2_entry + code="PH-SLE" name="Southern Leyte" parent="08"/> + <iso_3166_2_entry + code="PH-SUK" name="Sultan Kudarat" parent="12"/> + <iso_3166_2_entry + code="PH-SLU" name="Sulu" parent="14"/> + <iso_3166_2_entry + code="PH-SUN" name="Surigao del Norte" parent="13"/> + <iso_3166_2_entry + code="PH-SUR" name="Surigao del Sur" parent="13"/> + <iso_3166_2_entry + code="PH-TAR" name="Tarlac" parent="03"/> + <iso_3166_2_entry + code="PH-TAW" name="Tawi-Tawi" parent="14"/> + <iso_3166_2_entry + code="PH-WSA" name="Western Samar" parent="08"/> + <iso_3166_2_entry + code="PH-ZMB" name="Zambales" parent="03"/> + <iso_3166_2_entry + code="PH-ZAN" name="Zamboanga del Norte" parent="09"/> + <iso_3166_2_entry + code="PH-ZAS" name="Zamboanga del Sur" parent="09"/> + <iso_3166_2_entry + code="PH-ZSI" name="Zamboanga Sibugay" parent="09"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Pakistan --> + <iso_3166_country code="PK"> + <iso_3166_subset type="Capital territory"> + <iso_3166_2_entry + code="PK-IS" name="Islamabad"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PK-BA" name="Balochistan"/> + <iso_3166_2_entry + code="PK-NW" name="North-West Frontier"/> + <iso_3166_2_entry + code="PK-PB" name="Punjab"/> + <iso_3166_2_entry + code="PK-SD" name="Sindh"/> + </iso_3166_subset> + <iso_3166_subset type="Area"> + <iso_3166_2_entry + code="PK-TA" name="Federally Administered Tribal Areas"/> + <iso_3166_2_entry + code="PK-JK" name="Azad Kashmir"/> + <iso_3166_2_entry + code="PK-NA" name="Northern Areas"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Poland --> + <iso_3166_country code="PL"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PL-DS" name="Dolnośląskie"/> + <iso_3166_2_entry + code="PL-KP" name="Kujawsko-pomorskie"/> + <iso_3166_2_entry + code="PL-LU" name="Lubelskie"/> + <iso_3166_2_entry + code="PL-LB" name="Lubuskie"/> + <iso_3166_2_entry + code="PL-LD" name="Łódzkie"/> + <iso_3166_2_entry + code="PL-MA" name="Małopolskie"/> + <iso_3166_2_entry + code="PL-MZ" name="Mazowieckie"/> + <iso_3166_2_entry + code="PL-OP" name="Opolskie"/> + <iso_3166_2_entry + code="PL-PK" name="Podkarpackie"/> + <iso_3166_2_entry + code="PL-PD" name="Podlaskie"/> + <iso_3166_2_entry + code="PL-PM" name="Pomorskie"/> + <iso_3166_2_entry + code="PL-SL" name="Śląskie"/> + <iso_3166_2_entry + code="PL-SK" name="Świętokrzyskie"/> + <iso_3166_2_entry + code="PL-WN" name="Warmińsko-mazurskie"/> + <iso_3166_2_entry + code="PL-WP" name="Wielkopolskie"/> + <iso_3166_2_entry + code="PL-ZP" name="Zachodniopomorskie"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Palestinian Territory, Occupied --> + <iso_3166_country code="PS"/> + <!-- Portugal --> + <iso_3166_country code="PT"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="PT-01" name="Aveiro"/> + <iso_3166_2_entry + code="PT-02" name="Beja"/> + <iso_3166_2_entry + code="PT-03" name="Braga"/> + <iso_3166_2_entry + code="PT-04" name="Bragança"/> + <iso_3166_2_entry + code="PT-05" name="Castelo Branco"/> + <iso_3166_2_entry + code="PT-06" name="Coimbra"/> + <iso_3166_2_entry + code="PT-07" name="Évora"/> + <iso_3166_2_entry + code="PT-08" name="Faro"/> + <iso_3166_2_entry + code="PT-09" name="Guarda"/> + <iso_3166_2_entry + code="PT-10" name="Leiria"/> + <iso_3166_2_entry + code="PT-11" name="Lisboa"/> + <iso_3166_2_entry + code="PT-12" name="Portalegre"/> + <iso_3166_2_entry + code="PT-13" name="Porto"/> + <iso_3166_2_entry + code="PT-14" name="Santarém"/> + <iso_3166_2_entry + code="PT-15" name="Setúbal"/> + <iso_3166_2_entry + code="PT-16" name="Viana do Castelo"/> + <iso_3166_2_entry + code="PT-17" name="Vila Real"/> + <iso_3166_2_entry + code="PT-18" name="Viseu"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous region"> + <iso_3166_2_entry + code="PT-20" name="Região Autónoma dos Açores"/> + <iso_3166_2_entry + code="PT-30" name="Região Autónoma da Madeira"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Palau --> + <iso_3166_country code="PW"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="PW-002" name="Aimeliik"/> + <iso_3166_2_entry + code="PW-004" name="Airai"/> + <iso_3166_2_entry + code="PW-010" name="Angaur"/> + <iso_3166_2_entry + code="PW-050" name="Hatobohei"/> + <iso_3166_2_entry + code="PW-100" name="Kayangel"/> + <iso_3166_2_entry + code="PW-150" name="Koror"/> + <iso_3166_2_entry + code="PW-212" name="Melekeok"/> + <iso_3166_2_entry + code="PW-214" name="Ngaraard"/> + <iso_3166_2_entry + code="PW-218" name="Ngarchelong"/> + <iso_3166_2_entry + code="PW-222" name="Ngardmau"/> + <iso_3166_2_entry + code="PW-224" name="Ngatpang"/> + <iso_3166_2_entry + code="PW-226" name="Ngchesar"/> + <iso_3166_2_entry + code="PW-227" name="Ngeremlengui"/> + <iso_3166_2_entry + code="PW-228" name="Ngiwal"/> + <iso_3166_2_entry + code="PW-350" name="Peleliu"/> + <iso_3166_2_entry + code="PW-370" name="Sonsorol"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Paraguay --> + <iso_3166_country code="PY"> + <iso_3166_subset type="Capital district"> + <iso_3166_2_entry + code="PY-ASU" name="Asunción"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="PY-16" name="Alto Paraguay"/> + <iso_3166_2_entry + code="PY-10" name="Alto Paraná"/> + <iso_3166_2_entry + code="PY-13" name="Amambay"/> + <iso_3166_2_entry + code="PY-19" name="Boquerón"/> + <iso_3166_2_entry + code="PY-5" name="Caaguazú"/> + <iso_3166_2_entry + code="PY-6" name="Caazapá"/> + <iso_3166_2_entry + code="PY-14" name="Canindeyú"/> + <iso_3166_2_entry + code="PY-11" name="Central"/> + <iso_3166_2_entry + code="PY-1" name="Concepción"/> + <iso_3166_2_entry + code="PY-3" name="Cordillera"/> + <iso_3166_2_entry + code="PY-4" name="Guairá"/> + <iso_3166_2_entry + code="PY-7" name="Itapúa"/> + <iso_3166_2_entry + code="PY-8" name="Misiones"/> + <iso_3166_2_entry + code="PY-12" name="Ñeembucú"/> + <iso_3166_2_entry + code="PY-9" name="Paraguarí"/> + <iso_3166_2_entry + code="PY-15" name="Presidente Hayes"/> + <iso_3166_2_entry + code="PY-2" name="San Pedro"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Qatar --> + <iso_3166_country code="QA"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="QA-DA" name="Ad Dawhah"/> + <iso_3166_2_entry + code="QA-GH" name="Al Ghuwayriyah"/> + <iso_3166_2_entry + code="QA-JU" name="Al Jumayliyah"/> + <iso_3166_2_entry + code="QA-KH" name="Al Khawr"/> + <iso_3166_2_entry + code="QA-WA" name="Al Wakrah"/> + <iso_3166_2_entry + code="QA-RA" name="Ar Rayyan"/> + <iso_3166_2_entry + code="QA-JB" name="Jariyan al Batnah"/> + <iso_3166_2_entry + code="QA-MS" name="Madinat ash Shamal"/> + <iso_3166_2_entry + code="QA-US" name="Umm Salal"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Romania --> + <iso_3166_country code="RO"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="RO-AB" name="Alba"/> + <iso_3166_2_entry + code="RO-AR" name="Arad"/> + <iso_3166_2_entry + code="RO-AG" name="Argeș"/> + <iso_3166_2_entry + code="RO-BC" name="Bacău"/> + <iso_3166_2_entry + code="RO-BH" name="Bihor"/> + <iso_3166_2_entry + code="RO-BN" name="Bistrița-Năsăud"/> + <iso_3166_2_entry + code="RO-BT" name="Botoșani"/> + <iso_3166_2_entry + code="RO-BV" name="Brașov"/> + <iso_3166_2_entry + code="RO-BR" name="Brăila"/> + <iso_3166_2_entry + code="RO-BZ" name="Buzău"/> + <iso_3166_2_entry + code="RO-CS" name="Caraș-Severin"/> + <iso_3166_2_entry + code="RO-CL" name="Călărași"/> + <iso_3166_2_entry + code="RO-CJ" name="Cluj"/> + <iso_3166_2_entry + code="RO-CT" name="Constanța"/> + <iso_3166_2_entry + code="RO-CV" name="Covasna"/> + <iso_3166_2_entry + code="RO-DB" name="Dâmbovița"/> + <iso_3166_2_entry + code="RO-DJ" name="Dolj"/> + <iso_3166_2_entry + code="RO-GL" name="Galați"/> + <iso_3166_2_entry + code="RO-GR" name="Giurgiu"/> + <iso_3166_2_entry + code="RO-GJ" name="Gorj"/> + <iso_3166_2_entry + code="RO-HR" name="Harghita"/> + <iso_3166_2_entry + code="RO-HD" name="Hunedoara"/> + <iso_3166_2_entry + code="RO-IL" name="Ialomița"/> + <iso_3166_2_entry + code="RO-IS" name="Iași"/> + <iso_3166_2_entry + code="RO-IF" name="Ilfov"/> + <iso_3166_2_entry + code="RO-MM" name="Maramureș"/> + <iso_3166_2_entry + code="RO-MH" name="Mehedinți"/> + <iso_3166_2_entry + code="RO-MS" name="Mureș"/> + <iso_3166_2_entry + code="RO-NT" name="Neamț"/> + <iso_3166_2_entry + code="RO-OT" name="Olt"/> + <iso_3166_2_entry + code="RO-PH" name="Prahova"/> + <iso_3166_2_entry + code="RO-SM" name="Satu Mare"/> + <iso_3166_2_entry + code="RO-SJ" name="Sălaj"/> + <iso_3166_2_entry + code="RO-SB" name="Sibiu"/> + <iso_3166_2_entry + code="RO-SV" name="Suceava"/> + <iso_3166_2_entry + code="RO-TR" name="Teleorman"/> + <iso_3166_2_entry + code="RO-TM" name="Timiș"/> + <iso_3166_2_entry + code="RO-TL" name="Tulcea"/> + <iso_3166_2_entry + code="RO-VS" name="Vaslui"/> + <iso_3166_2_entry + code="RO-VL" name="Vâlcea"/> + <iso_3166_2_entry + code="RO-VN" name="Vrancea"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="RO-B" name="București"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Serbia --> + <iso_3166_country code="RS"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="RS-00" name="Beograd"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous province"> + <iso_3166_2_entry + code="RS KM" name="Kosovo-Metohija"/> + <iso_3166_2_entry + code="RS VO" name="Vojvodina"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="RS-14" name="Borski okrug"/> + <iso_3166_2_entry + code="RS-11" name="Braničevski okrug"/> + <iso_3166_2_entry + code="RS-23" name="Jablanički okrug"/> + <iso_3166_2_entry + code="RS-06" name="Južnobački okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-04" name="Južnobanatski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-09" name="Kolubarski okrug"/> + <iso_3166_2_entry + code="RS-25" name="Kosovski okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-28" name="Kosovsko-Mitrovački okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-29" name="Kosovsko-Pomoravski okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-08" name="Mačvanski okrug"/> + <iso_3166_2_entry + code="RS-17" name="Moravički okrug"/> + <iso_3166_2_entry + code="RS-20" name="Nišavski okrug"/> + <iso_3166_2_entry + code="RS-24" name="Pčinjski okrug"/> + <iso_3166_2_entry + code="RS-26" name="Pećki okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-22" name="Pirotski okrug"/> + <iso_3166_2_entry + code="RS-10" name="Podunavski okrug"/> + <iso_3166_2_entry + code="RS-13" name="Pomoravski okrug"/> + <iso_3166_2_entry + code="RS-27" name="Prizrenski okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-19" name="Rasinski okrug"/> + <iso_3166_2_entry + code="RS-18" name="Raški okrug"/> + <iso_3166_2_entry + code="RS-01" name="Severnobački okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-03" name="Severnobanatski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-02" name="Srednjebanatski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-07" name="Sremski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-12" name="Šumadijski okrug"/> + <iso_3166_2_entry + code="RS-21" name="Toplički okrug"/> + <iso_3166_2_entry + code="RS-15" name="Zaječarski okrug"/> + <iso_3166_2_entry + code="RS-05" name="Zapadnobački okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-16" name="Zlatiborski okrug"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Russia --> + <iso_3166_country code="RU"> + <!-- The ISO 3166-2 entries give romanised versions according to two standards, --> + <!-- GOST (1983) and Russian BGN/PCGN (1947). --> + <!-- Here the BGN entry is listed , since it was listed first in the ISO document --> + <!-- Localize to Cyrillic anyway in the po files. --> + <iso_3166_subset type="Republic"> + <iso_3166_2_entry + code="RU-AD" name="Adygeya, Respublika"/> + <iso_3166_2_entry + code="RU-AL" name="Altay, Respublika"/> + <iso_3166_2_entry + code="RU-BA" name="Bashkortostan, Respublika"/> + <iso_3166_2_entry + code="RU-BU" name="Buryatiya, Respublika"/> + <iso_3166_2_entry + code="RU-CE" name="Chechenskaya Respublika"/> + <iso_3166_2_entry + code="RU-CU" name="Chuvashskaya Respublika"/> + <iso_3166_2_entry + code="RU-DA" name="Dagestan, Respublika"/> + <iso_3166_2_entry + code="RU-IN" name="Respublika Ingushetiya"/> + <iso_3166_2_entry + code="RU-KB" name="Kabardino-Balkarskaya Respublika"/> + <iso_3166_2_entry + code="RU-KL" name="Kalmykiya, Respublika"/> + <iso_3166_2_entry + code="RU-KC" name="Karachayevo-Cherkesskaya Respublika"/> + <iso_3166_2_entry + code="RU-KR" name="Kareliya, Respublika"/> + <iso_3166_2_entry + code="RU-KK" name="Khakasiya, Respublika"/> + <iso_3166_2_entry + code="RU-KO" name="Komi, Respublika"/> + <iso_3166_2_entry + code="RU-ME" name="Mariy El, Respublika"/> + <iso_3166_2_entry + code="RU-MO" name="Mordoviya, Respublika"/> + <iso_3166_2_entry + code="RU-SA" name="Sakha, Respublika [Yakutiya]"/> + <iso_3166_2_entry + code="RU-SE" name="Severnaya Osetiya-Alaniya, Respublika"/> + <iso_3166_2_entry + code="RU-TA" name="Tatarstan, Respublika"/> + <iso_3166_2_entry + code="RU-TY" name="Tyva, Respublika [Tuva]"/> + <iso_3166_2_entry + code="RU-UD" name="Udmurtskaya Respublika"/> + </iso_3166_subset> + <iso_3166_subset type="Administrative Territory"> + <iso_3166_2_entry + code="RU-ALT" name="Altayskiy kray"/> + <iso_3166_2_entry + code="RU-KAM" name="Kamchatskiy kray"/> + <iso_3166_2_entry + code="RU-KHA" name="Khabarovskiy kray"/> + <iso_3166_2_entry + code="RU-KDA" name="Krasnodarskiy kray"/> + <iso_3166_2_entry + code="RU-KYA" name="Krasnoyarskiy kray"/> + <iso_3166_2_entry + code="RU-PER" name="Permskiy kray"/> + <iso_3166_2_entry + code="RU-PRI" name="Primorskiy kray"/> + <iso_3166_2_entry + code="RU-STA" name="Stavropol'skiy kray"/> + <iso_3166_2_entry + code="RU-ZAB" name="Zabajkal'skij kraj"/> + </iso_3166_subset> + <iso_3166_subset type="Administrative Region"> + <iso_3166_2_entry + code="RU-AMU" name="Amurskaya oblast'"/> + <iso_3166_2_entry + code="RU-ARK" name="Arkhangel'skaya oblast'"/> + <iso_3166_2_entry + code="RU-AST" name="Astrakhanskaya oblast'"/> + <iso_3166_2_entry + code="RU-BEL" name="Belgorodskaya oblast'"/> + <iso_3166_2_entry + code="RU-BRY" name="Bryanskaya oblast'"/> + <iso_3166_2_entry + code="RU-CHE" name="Chelyabinskaya oblast'"/> + <iso_3166_2_entry + code="RU-IRK" name="Irkutiskaya oblast'"/> + <iso_3166_2_entry + code="RU-IVA" name="Ivanovskaya oblast'"/> + <iso_3166_2_entry + code="RU-KGD" name="Kaliningradskaya oblast'"/> + <iso_3166_2_entry + code="RU-KLU" name="Kaluzhskaya oblast'"/> + <iso_3166_2_entry + code="RU-KEM" name="Kemerovskaya oblast'"/> + <iso_3166_2_entry + code="RU-KIR" name="Kirovskaya oblast'"/> + <iso_3166_2_entry + code="RU-KOS" name="Kostromskaya oblast'"/> + <iso_3166_2_entry + code="RU-KGN" name="Kurganskaya oblast'"/> + <iso_3166_2_entry + code="RU-KRS" name="Kurskaya oblast'"/> + <iso_3166_2_entry + code="RU-LEN" name="Leningradskaya oblast'"/> + <iso_3166_2_entry + code="RU-LIP" name="Lipetskaya oblast'"/> + <iso_3166_2_entry + code="RU-MAG" name="Magadanskaya oblast'"/> + <iso_3166_2_entry + code="RU-MOS" name="Moskovskaya oblast'"/> + <iso_3166_2_entry + code="RU-MUR" name="Murmanskaya oblast'"/> + <iso_3166_2_entry + code="RU-NIZ" name="Nizhegorodskaya oblast'"/> + <iso_3166_2_entry + code="RU-NGR" name="Novgorodskaya oblast'"/> + <iso_3166_2_entry + code="RU-NVS" name="Novosibirskaya oblast'"/> + <iso_3166_2_entry + code="RU-OMS" name="Omskaya oblast'"/> + <iso_3166_2_entry + code="RU-ORE" name="Orenburgskaya oblast'"/> + <iso_3166_2_entry + code="RU-ORL" name="Orlovskaya oblast'"/> + <iso_3166_2_entry + code="RU-PNZ" name="Penzenskaya oblast'"/> + <iso_3166_2_entry + code="RU-PSK" name="Pskovskaya oblast'"/> + <iso_3166_2_entry + code="RU-ROS" name="Rostovskaya oblast'"/> + <iso_3166_2_entry + code="RU-RYA" name="Ryazanskaya oblast'"/> + <iso_3166_2_entry + code="RU-SAK" name="Sakhalinskaya oblast'"/> + <iso_3166_2_entry + code="RU-SAM" name="Samaraskaya oblast'"/> + <iso_3166_2_entry + code="RU-SAR" name="Saratovskaya oblast'"/> + <iso_3166_2_entry + code="RU-SMO" name="Smolenskaya oblast'"/> + <iso_3166_2_entry + code="RU-SVE" name="Sverdlovskaya oblast'"/> + <iso_3166_2_entry + code="RU-TAM" name="Tambovskaya oblast'"/> + <iso_3166_2_entry + code="RU-TOM" name="Tomskaya oblast'"/> + <iso_3166_2_entry + code="RU-TUL" name="Tul'skaya oblast'"/> + <iso_3166_2_entry + code="RU-TVE" name="Tverskaya oblast'"/> + <iso_3166_2_entry + code="RU-TYU" name="Tyumenskaya oblast'"/> + <iso_3166_2_entry + code="RU-ULY" name="Ul'yanovskaya oblast'"/> + <iso_3166_2_entry + code="RU-VLA" name="Vladimirskaya oblast'"/> + <iso_3166_2_entry + code="RU-VGG" name="Volgogradskaya oblast'"/> + <iso_3166_2_entry + code="RU-VLG" name="Vologodskaya oblast'"/> + <iso_3166_2_entry + code="RU-VOR" name="Voronezhskaya oblast'"/> + <iso_3166_2_entry + code="RU-YAR" name="Yaroslavskaya oblast'"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous City"> + <iso_3166_2_entry + code="RU-MOW" name="Moskva"/> + <iso_3166_2_entry + code="RU-SPE" name="Sankt-Peterburg"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous Region"> + <iso_3166_2_entry + code="RU-YEV" name="Yevreyskaya avtonomnaya oblast'"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous District"> + <iso_3166_2_entry + code="RU-CHU" name="Chukotskiy avtonomnyy okrug"/> + <iso_3166_2_entry + code="RU-KHM" name="Khanty-Mansiysky avtonomnyy okrug-Yugra"/> + <iso_3166_2_entry + code="RU-NEN" name="Nenetskiy avtonomnyy okrug"/> + <iso_3166_2_entry + code="RU-YAN" name="Yamalo-Nenetskiy avtonomnyy okrug"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Rwanda --> + <iso_3166_country code="RW"> + <iso_3166_subset type="Town council"> + <iso_3166_2_entry + code="RW-01" name="Ville de Kigali"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="RW-02" name="Est"/> + <iso_3166_2_entry + code="RW-03" name="Nord"/> + <iso_3166_2_entry + code="RW-04" name="Ouest"/> + <iso_3166_2_entry + code="RW-05" name="Sud"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saudi Arabia --> + <iso_3166_country code="SA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="SA-11" name="Al Bāhah"/> + <iso_3166_2_entry + code="SA-08" name="Al Ḥudūd ash Shamāliyah"/> + <iso_3166_2_entry + code="SA-12" name="Al Jawf"/> + <iso_3166_2_entry + code="SA-03" name="Al Madīnah"/> + <iso_3166_2_entry + code="SA-05" name="Al Qaşīm"/> + <iso_3166_2_entry + code="SA-01" name="Ar Riyāḍ"/> + <iso_3166_2_entry + code="SA-04" name="Ash Sharqīyah"/> + <iso_3166_2_entry + code="SA-14" name="`Asīr"/> + <iso_3166_2_entry + code="SA-06" name="Ḥā'il"/> + <iso_3166_2_entry + code="SA-09" name="Jīzan"/> + <iso_3166_2_entry + code="SA-02" name="Makkah"/> + <iso_3166_2_entry + code="SA-10" name="Najrān"/> + <iso_3166_2_entry + code="SA-07" name="Tabūk"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Solomon Islands --> + <iso_3166_country code="SB"> + <iso_3166_subset type="Capital territory"> + <iso_3166_2_entry + code="SB-CT" name="Capital Territory (Honiara)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="SB-CE" name="Central"/> + <iso_3166_2_entry + code="SB-CH" name="Choiseul"/> + <iso_3166_2_entry + code="SB-GU" name="Guadalcanal"/> + <iso_3166_2_entry + code="SB-IS" name="Isabel"/> + <iso_3166_2_entry + code="SB-MK" name="Makira"/> + <iso_3166_2_entry + code="SB-ML" name="Malaita"/> + <iso_3166_2_entry + code="SB-RB" name="Rennell and Bellona"/> + <iso_3166_2_entry + code="SB-TE" name="Temotu"/> + <iso_3166_2_entry + code="SB-WE" name="Western"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Seychelles --> + <iso_3166_country code="SC"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="SC-01" name="Anse aux Pins"/> + <iso_3166_2_entry + code="SC-02" name="Anse Boileau"/> + <iso_3166_2_entry + code="SC-03" name="Anse Etoile"/> + <iso_3166_2_entry + code="SC-04" name="Anse Louis"/> + <iso_3166_2_entry + code="SC-05" name="Anse Royale"/> + <iso_3166_2_entry + code="SC-06" name="Baie Lazare"/> + <iso_3166_2_entry + code="SC-07" name="Baie Sainte Anne"/> + <iso_3166_2_entry + code="SC-08" name="Beau Vallon"/> + <iso_3166_2_entry + code="SC-09" name="Bel Air"/> + <iso_3166_2_entry + code="SC-10" name="Bel Ombre"/> + <iso_3166_2_entry + code="SC-11" name="Cascade"/> + <iso_3166_2_entry + code="SC-12" name="Glacis"/> + <iso_3166_2_entry + code="SC-13" name="Grand Anse Mahe"/> + <iso_3166_2_entry + code="SC-14" name="Grand Anse Praslin"/> + <iso_3166_2_entry + code="SC-15" name="La Digue"/> + <iso_3166_2_entry + code="SC-16" name="English River"/> + <iso_3166_2_entry + code="SC-24" name="Les Mamelles"/> + <iso_3166_2_entry + code="SC-17" name="Mont Buxton"/> + <iso_3166_2_entry + code="SC-18" name="Mont Fleuri"/> + <iso_3166_2_entry + code="SC-19" name="Plaisance"/> + <iso_3166_2_entry + code="SC-20" name="Pointe Larue"/> + <iso_3166_2_entry + code="SC-21" name="Port Glaud"/> + <iso_3166_2_entry + code="SC-25" name="Roche Caiman"/> + <iso_3166_2_entry + code="SC-22" name="Saint Louis"/> + <iso_3166_2_entry + code="SC-23" name="Takamaka"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sudan --> + <iso_3166_country code="SD"> + <iso_3166_subset type="state"> + <iso_3166_2_entry + code="SD-26" name="Al Baḩr al Aḩmar"/> + <iso_3166_2_entry + code="SD-18" name="Al Buḩayrāt"/> + <iso_3166_2_entry + code="SD-07" name="Al Jazīrah"/> + <iso_3166_2_entry + code="SD-03" name="Al Kharţūm"/> + <iso_3166_2_entry + code="SD-06" name="Al Qaḑārif"/> + <iso_3166_2_entry + code="SD-22" name="Al Waḩdah"/> + <iso_3166_2_entry + code="SD-04" name="An Nīl"/> + <iso_3166_2_entry + code="SD-08" name="An Nīl al Abyaḑ"/> + <iso_3166_2_entry + code="SD-24" name="An Nīl al Azraq"/> + <iso_3166_2_entry + code="SD-01" name="Ash Shamālīyah"/> + <iso_3166_2_entry + code="SD-23" name="A‘ālī an Nīl"/> + <iso_3166_2_entry + code="SD-17" name="Baḩr al Jabal"/> + <iso_3166_2_entry + code="SD-16" name="Gharb al Istiwā'īyah"/> + <iso_3166_2_entry + code="SD-14" name="Gharb Baḩr al Ghazāl"/> + <iso_3166_2_entry + code="SD-12" name="Gharb Dārfūr"/> + <iso_3166_2_entry + code="SD-11" name="Janūb Dārfūr"/> + <iso_3166_2_entry + code="SD-13" name="Janūb Kurdufān"/> + <iso_3166_2_entry + code="SD-20" name="Jūnqalī"/> + <iso_3166_2_entry + code="SD-05" name="Kassalā"/> + <iso_3166_2_entry + code="SD-15" name="Shamāl Baḩr al Ghazāl"/> + <iso_3166_2_entry + code="SD-02" name="Shamāl Dārfūr"/> + <iso_3166_2_entry + code="SD-09" name="Shamāl Kurdufān"/> + <iso_3166_2_entry + code="SD-19" name="Sharq al Istiwā'īyah"/> + <iso_3166_2_entry + code="SD-25" name="Sinnār"/> + <iso_3166_2_entry + code="SD-21" name="Wārāb"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sweden --> + <iso_3166_country code="SE"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="SE-K" name="Blekinge län"/> + <iso_3166_2_entry + code="SE-W" name="Dalarnas län"/> + <iso_3166_2_entry + code="SE-I" name="Gotlands län"/> + <iso_3166_2_entry + code="SE-X" name="Gävleborgs län"/> + <iso_3166_2_entry + code="SE-N" name="Hallands län"/> + <iso_3166_2_entry + code="SE-Z" name="Jämtlande län"/> + <iso_3166_2_entry + code="SE-F" name="Jönköpings län"/> + <iso_3166_2_entry + code="SE-H" name="Kalmar län"/> + <iso_3166_2_entry + code="SE-G" name="Kronobergs län"/> + <iso_3166_2_entry + code="SE-BD" name="Norrbottens län"/> + <iso_3166_2_entry + code="SE-M" name="Skåne län"/> + <iso_3166_2_entry + code="SE-AB" name="Stockholms län"/> + <iso_3166_2_entry + code="SE-D" name="Södermanlands län"/> + <iso_3166_2_entry + code="SE-C" name="Uppsala län"/> + <iso_3166_2_entry + code="SE-S" name="Värmlands län"/> + <iso_3166_2_entry + code="SE-AC" name="Västerbottens län"/> + <iso_3166_2_entry + code="SE-Y" name="Västernorrlands län"/> + <iso_3166_2_entry + code="SE-U" name="Västmanlands län"/> + <iso_3166_2_entry + code="SE-Q" name="Västra Götalands län"/> + <iso_3166_2_entry + code="SE-T" name="Örebro län"/> + <iso_3166_2_entry + code="SE-E" name="Östergötlands län"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Singapore --> + <iso_3166_country code="SG"> + <iso_3166_subset type="district"> + <iso_3166_2_entry + code="SG-01" name="Central Singapore"/> + <iso_3166_2_entry + code="SG-02" name="North East"/> + <iso_3166_2_entry + code="SG-03" name="North West"/> + <iso_3166_2_entry + code="SG-04" name="South East"/> + <iso_3166_2_entry + code="SG-05" name="South West"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Helena, Ascension and Tristan da Cunha --> + <iso_3166_country code="SH"> + </iso_3166_country> + <!-- Slovenia --> + <iso_3166_country code="SI"> + <iso_3166_subset type="Municipalities"> + <iso_3166_2_entry + code="SI-001" name="Ajdovščina"/> + <iso_3166_2_entry + code="SI-195" name="Apače"/> + <iso_3166_2_entry + code="SI-002" name="Beltinci"/> + <iso_3166_2_entry + code="SI-148" name="Benedikt"/> + <iso_3166_2_entry + code="SI-149" name="Bistrica ob Sotli"/> + <iso_3166_2_entry + code="SI-003" name="Bled"/> + <iso_3166_2_entry + code="SI-150" name="Bloke"/> + <iso_3166_2_entry + code="SI-004" name="Bohinj"/> + <iso_3166_2_entry + code="SI-005" name="Borovnica"/> + <iso_3166_2_entry + code="SI-006" name="Bovec"/> + <iso_3166_2_entry + code="SI-151" name="Braslovče"/> + <iso_3166_2_entry + code="SI-007" name="Brda"/> + <iso_3166_2_entry + code="SI-008" name="Brezovica"/> + <iso_3166_2_entry + code="SI-009" name="Brežice"/> + <iso_3166_2_entry + code="SI-152" name="Cankova"/> + <iso_3166_2_entry + code="SI-011" name="Celje"/> + <iso_3166_2_entry + code="SI-012" name="Cerklje na Gorenjskem"/> + <iso_3166_2_entry + code="SI-013" name="Cerknica"/> + <iso_3166_2_entry + code="SI-014" name="Cerkno"/> + <iso_3166_2_entry + code="SI-153" name="Cerkvenjak"/> + <iso_3166_2_entry + code="SI-196" name="Cirkulane"/> + <iso_3166_2_entry + code="SI-015" name="Črenšovci"/> + <iso_3166_2_entry + code="SI-016" name="Črna na Koroškem"/> + <iso_3166_2_entry + code="SI-017" name="Črnomelj"/> + <iso_3166_2_entry + code="SI-018" name="Destrnik"/> + <iso_3166_2_entry + code="SI-019" name="Divača"/> + <iso_3166_2_entry + code="SI-154" name="Dobje"/> + <iso_3166_2_entry + code="SI-020" name="Dobrepolje"/> + <iso_3166_2_entry + code="SI-155" name="Dobrna"/> + <iso_3166_2_entry + code="SI-021" name="Dobrova-Polhov Gradec"/> + <iso_3166_2_entry + code="SI-156" name="Dobrovnik/Dobronak"/> + <iso_3166_2_entry + code="SI-022" name="Dol pri Ljubljani"/> + <iso_3166_2_entry + code="SI-157" name="Dolenjske Toplice"/> + <iso_3166_2_entry + code="SI-023" name="Domžale"/> + <iso_3166_2_entry + code="SI-024" name="Dornava"/> + <iso_3166_2_entry + code="SI-025" name="Dravograd"/> + <iso_3166_2_entry + code="SI-026" name="Duplek"/> + <iso_3166_2_entry + code="SI-027" name="Gorenja vas-Poljane"/> + <iso_3166_2_entry + code="SI-028" name="Gorišnica"/> + <iso_3166_2_entry + code="SI-207" name="Gorje"/> + <iso_3166_2_entry + code="SI-029" name="Gornja Radgona"/> + <iso_3166_2_entry + code="SI-030" name="Gornji Grad"/> + <iso_3166_2_entry + code="SI-031" name="Gornji Petrovci"/> + <iso_3166_2_entry + code="SI-158" name="Grad"/> + <iso_3166_2_entry + code="SI-032" name="Grosuplje"/> + <iso_3166_2_entry + code="SI-159" name="Hajdina"/> + <iso_3166_2_entry + code="SI-160" name="Hoče-Slivnica"/> + <iso_3166_2_entry + code="SI-161" name="Hodoš/Hodos"/> + <iso_3166_2_entry + code="SI-162" name="Horjul"/> + <iso_3166_2_entry + code="SI-034" name="Hrastnik"/> + <iso_3166_2_entry + code="SI-035" name="Hrpelje-Kozina"/> + <iso_3166_2_entry + code="SI-036" name="Idrija"/> + <iso_3166_2_entry + code="SI-037" name="Ig"/> + <iso_3166_2_entry + code="SI-038" name="Ilirska Bistrica"/> + <iso_3166_2_entry + code="SI-039" name="Ivančna Gorica"/> + <iso_3166_2_entry + code="SI-040" name="Izola/Isola"/> + <iso_3166_2_entry + code="SI-041" name="Jesenice"/> + <iso_3166_2_entry + code="SI-163" name="Jezersko"/> + <iso_3166_2_entry + code="SI-042" name="Juršinci"/> + <iso_3166_2_entry + code="SI-043" name="Kamnik"/> + <iso_3166_2_entry + code="SI-044" name="Kanal"/> + <iso_3166_2_entry + code="SI-045" name="Kidričevo"/> + <iso_3166_2_entry + code="SI-046" name="Kobarid"/> + <iso_3166_2_entry + code="SI-047" name="Kobilje"/> + <iso_3166_2_entry + code="SI-048" name="Kočevje"/> + <iso_3166_2_entry + code="SI-049" name="Komen"/> + <iso_3166_2_entry + code="SI-164" name="Komenda"/> + <iso_3166_2_entry + code="SI-050" name="Koper/Capodistria"/> + <iso_3166_2_entry + code="SI-197" name="Kosanjevica na Krki"/> + <iso_3166_2_entry + code="SI-165" name="Kostel"/> + <iso_3166_2_entry + code="SI-051" name="Kozje"/> + <iso_3166_2_entry + code="SI-052" name="Kranj"/> + <iso_3166_2_entry + code="SI-053" name="Kranjska Gora"/> + <iso_3166_2_entry + code="SI-166" name="Križevci"/> + <iso_3166_2_entry + code="SI-054" name="Krško"/> + <iso_3166_2_entry + code="SI-055" name="Kungota"/> + <iso_3166_2_entry + code="SI-056" name="Kuzma"/> + <iso_3166_2_entry + code="SI-057" name="Laško"/> + <iso_3166_2_entry + code="SI-058" name="Lenart"/> + <iso_3166_2_entry + code="SI-059" name="Lendava/Lendva"/> + <iso_3166_2_entry + code="SI-060" name="Litija"/> + <iso_3166_2_entry + code="SI-061" name="Ljubljana"/> + <iso_3166_2_entry + code="SI-062" name="Ljubno"/> + <iso_3166_2_entry + code="SI-063" name="Ljutomer"/> + <iso_3166_2_entry + code="SI-208" name="Log-Dragomer"/> + <iso_3166_2_entry + code="SI-064" name="Logatec"/> + <iso_3166_2_entry + code="SI-065" name="Loška dolina"/> + <iso_3166_2_entry + code="SI-066" name="Loški Potok"/> + <iso_3166_2_entry + code="SI-167" name="Lovrenc na Pohorju"/> + <iso_3166_2_entry + code="SI-067" name="Luče"/> + <iso_3166_2_entry + code="SI-068" name="Lukovica"/> + <iso_3166_2_entry + code="SI-069" name="Majšperk"/> + <iso_3166_2_entry + code="SI-198" name="Makole"/> + <iso_3166_2_entry + code="SI-070" name="Maribor"/> + <iso_3166_2_entry + code="SI-168" name="Markovci"/> + <iso_3166_2_entry + code="SI-071" name="Medvode"/> + <iso_3166_2_entry + code="SI-072" name="Mengeš"/> + <iso_3166_2_entry + code="SI-073" name="Metlika"/> + <iso_3166_2_entry + code="SI-074" name="Mežica"/> + <iso_3166_2_entry + code="SI-169" name="Miklavž na Dravskem polju"/> + <iso_3166_2_entry + code="SI-075" name="Miren-Kostanjevica"/> + <iso_3166_2_entry + code="SI-170" name="Mirna Peč"/> + <iso_3166_2_entry + code="SI-076" name="Mislinja"/> + <iso_3166_2_entry + code="SI-199" name="Mokronog-Trebelno"/> + <iso_3166_2_entry + code="SI-077" name="Moravče"/> + <iso_3166_2_entry + code="SI-078" name="Moravske Toplice"/> + <iso_3166_2_entry + code="SI-079" name="Mozirje"/> + <iso_3166_2_entry + code="SI-080" name="Murska Sobota"/> + <iso_3166_2_entry + code="SI-081" name="Muta"/> + <iso_3166_2_entry + code="SI-082" name="Naklo"/> + <iso_3166_2_entry + code="SI-083" name="Nazarje"/> + <iso_3166_2_entry + code="SI-084" name="Nova Gorica"/> + <iso_3166_2_entry + code="SI-085" name="Novo mesto"/> + <iso_3166_2_entry + code="SI-086" name="Odranci"/> + <iso_3166_2_entry + code="SI-171" name="Oplotnica"/> + <iso_3166_2_entry + code="SI-087" name="Ormož"/> + <iso_3166_2_entry + code="SI-088" name="Osilnica"/> + <iso_3166_2_entry + code="SI-089" name="Pesnica"/> + <iso_3166_2_entry + code="SI-090" name="Piran/Pirano"/> + <iso_3166_2_entry + code="SI-091" name="Pivka"/> + <iso_3166_2_entry + code="SI-092" name="Podčetrtek"/> + <iso_3166_2_entry + code="SI-172" name="Podlehnik"/> + <iso_3166_2_entry + code="SI-093" name="Podvelka"/> + <iso_3166_2_entry + code="SI-200" name="Poljčane"/> + <iso_3166_2_entry + code="SI-173" name="Polzela"/> + <iso_3166_2_entry + code="SI-094" name="Postojna"/> + <iso_3166_2_entry + code="SI-174" name="Prebold"/> + <iso_3166_2_entry + code="SI-095" name="Preddvor"/> + <iso_3166_2_entry + code="SI-175" name="Prevalje"/> + <iso_3166_2_entry + code="SI-096" name="Ptuj"/> + <iso_3166_2_entry + code="SI-097" name="Puconci"/> + <iso_3166_2_entry + code="SI-098" name="Rače-Fram"/> + <iso_3166_2_entry + code="SI-099" name="Radeče"/> + <iso_3166_2_entry + code="SI-100" name="Radenci"/> + <iso_3166_2_entry + code="SI-101" name="Radlje ob Dravi"/> + <iso_3166_2_entry + code="SI-102" name="Radovljica"/> + <iso_3166_2_entry + code="SI-103" name="Ravne na Koroškem"/> + <iso_3166_2_entry + code="SI-176" name="Razkrižje"/> + <iso_3166_2_entry + code="SI-209" name="Rečica ob Savinji"/> + <iso_3166_2_entry + code="SI-201" name="Renče-Vogrsko"/> + <iso_3166_2_entry + code="SI-104" name="Ribnica"/> + <iso_3166_2_entry + code="SI-177" name="Ribnica na Pohorju"/> + <iso_3166_2_entry + code="SI-106" name="Rogaška Slatina"/> + <iso_3166_2_entry + code="SI-105" name="Rogašovci"/> + <iso_3166_2_entry + code="SI-107" name="Rogatec"/> + <iso_3166_2_entry + code="SI-108" name="Ruše"/> + <iso_3166_2_entry + code="SI-178" name="Selnica ob Dravi"/> + <iso_3166_2_entry + code="SI-109" name="Semič"/> + <iso_3166_2_entry + code="SI-110" name="Sevnica"/> + <iso_3166_2_entry + code="SI-111" name="Sežana"/> + <iso_3166_2_entry + code="SI-112" name="Slovenj Gradec"/> + <iso_3166_2_entry + code="SI-113" name="Slovenska Bistrica"/> + <iso_3166_2_entry + code="SI-114" name="Slovenske Konjice"/> + <iso_3166_2_entry + code="SI-179" name="Sodražica"/> + <iso_3166_2_entry + code="SI-180" name="Solčava"/> + <iso_3166_2_entry + code="SI-202" name="Središče ob Dravi"/> + <iso_3166_2_entry + code="SI-115" name="Starče"/> + <iso_3166_2_entry + code="SI-203" name="Straža"/> + <iso_3166_2_entry + code="SI-181" name="Sveta Ana"/> + <iso_3166_2_entry + code="SI-204" name="Sveta Trojica v Slovenskih Goricah"/> + <iso_3166_2_entry + code="SI-182" name="Sveta Andraž v Slovenskih Goricah"/> + <iso_3166_2_entry + code="SI-116" name="Sveti Jurij"/> + <iso_3166_2_entry + code="SI-210" name="Sveti Jurij v Slovenskih Goricah"/> + <iso_3166_2_entry + code="SI-205" name="Sveti Tomaž"/> + <iso_3166_2_entry + code="SI-033" name="Šalovci"/> + <iso_3166_2_entry + code="SI-183" name="Šempeter-Vrtojba"/> + <iso_3166_2_entry + code="SI-117" name="Šenčur"/> + <iso_3166_2_entry + code="SI-118" name="Šentilj"/> + <iso_3166_2_entry + code="SI-119" name="Šentjernej"/> + <iso_3166_2_entry + code="SI-120" name="Šentjur"/> + <iso_3166_2_entry + code="SI-211" name="Šentrupert"/> + <iso_3166_2_entry + code="SI-121" name="Škocjan"/> + <iso_3166_2_entry + code="SI-122" name="Škofja Loka"/> + <iso_3166_2_entry + code="SI-123" name="Škofljica"/> + <iso_3166_2_entry + code="SI-124" name="Šmarje pri Jelšah"/> + <iso_3166_2_entry + code="SI-206" name="Šmarjeske Topliče"/> + <iso_3166_2_entry + code="SI-125" name="Šmartno ob Paki"/> + <iso_3166_2_entry + code="SI-194" name="Šmartno pri Litiji"/> + <iso_3166_2_entry + code="SI-126" name="Šoštanj"/> + <iso_3166_2_entry + code="SI-127" name="Štore"/> + <iso_3166_2_entry + code="SI-184" name="Tabor"/> + <iso_3166_2_entry + code="SI-010" name="Tišina"/> + <iso_3166_2_entry + code="SI-128" name="Tolmin"/> + <iso_3166_2_entry + code="SI-129" name="Trbovlje"/> + <iso_3166_2_entry + code="SI-130" name="Trebnje"/> + <iso_3166_2_entry + code="SI-185" name="Trnovska vas"/> + <iso_3166_2_entry + code="SI-186" name="Trzin"/> + <iso_3166_2_entry + code="SI-131" name="Tržič"/> + <iso_3166_2_entry + code="SI-132" name="Turnišče"/> + <iso_3166_2_entry + code="SI-133" name="Velenje"/> + <iso_3166_2_entry + code="SI-187" name="Velika Polana"/> + <iso_3166_2_entry + code="SI-134" name="Velike Lašče"/> + <iso_3166_2_entry + code="SI-188" name="Veržej"/> + <iso_3166_2_entry + code="SI-135" name="Videm"/> + <iso_3166_2_entry + code="SI-136" name="Vipava"/> + <iso_3166_2_entry + code="SI-137" name="Vitanje"/> + <iso_3166_2_entry + code="SI-138" name="Vodice"/> + <iso_3166_2_entry + code="SI-139" name="Vojnik"/> + <iso_3166_2_entry + code="SI-189" name="Vransko"/> + <iso_3166_2_entry + code="SI-140" name="Vrhnika"/> + <iso_3166_2_entry + code="SI-141" name="Vuzenica"/> + <iso_3166_2_entry + code="SI-142" name="Zagorje ob Savi"/> + <iso_3166_2_entry + code="SI-143" name="Zavrč"/> + <iso_3166_2_entry + code="SI-144" name="Zreče"/> + <iso_3166_2_entry + code="SI-190" name="Žalec"/> + <iso_3166_2_entry + code="SI-146" name="Železniki"/> + <iso_3166_2_entry + code="SI-191" name="Žetale"/> + <iso_3166_2_entry + code="SI-147" name="Žiri"/> + <iso_3166_2_entry + code="SI-192" name="Žirovnica"/> + <iso_3166_2_entry + code="SI-193" name="Žužemberk"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Slovakia --> + <iso_3166_country code="SK"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="SK-BC" name="Banskobystrický kraj"/> + <iso_3166_2_entry + code="SK-BL" name="Bratislavský kraj"/> + <iso_3166_2_entry + code="SK-KI" name="Košický kraj"/> + <iso_3166_2_entry + code="SK-NJ" name="Nitriansky kraj"/> + <iso_3166_2_entry + code="SK-PV" name="Prešovský kraj"/> + <iso_3166_2_entry + code="SK-TC" name="Trenčiansky kraj"/> + <iso_3166_2_entry + code="SK-TA" name="Trnavský kraj"/> + <iso_3166_2_entry + code="SK-ZI" name="Žilinský kraj"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sierra Leone --> + <iso_3166_country code="SL"> + <iso_3166_subset type="Area"> + <iso_3166_2_entry + code="SL-W" name="Western Area (Freetown)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="SL-E" name="Eastern"/> + <iso_3166_2_entry + code="SL-N" name="Northern"/> + <iso_3166_2_entry + code="SL-S" name="Southern (Sierra Leone)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- San Marino --> + <iso_3166_country code="SM"> + <iso_3166_subset type="Municipalities"> + <iso_3166_2_entry + code="SM-01" name="Acquaviva"/> + <iso_3166_2_entry + code="SM-06" name="Borgo Maggiore"/> + <iso_3166_2_entry + code="SM-02" name="Chiesanuova"/> + <iso_3166_2_entry + code="SM-03" name="Domagnano"/> + <iso_3166_2_entry + code="SM-04" name="Faetano"/> + <iso_3166_2_entry + code="SM-05" name="Fiorentino"/> + <iso_3166_2_entry + code="SM-08" name="Montegiardino"/> + <iso_3166_2_entry + code="SM-07" name="San Marino"/> + <iso_3166_2_entry + code="SM-09" name="Serravalle"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Senegal --> + <iso_3166_country code="SN"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="SN-DK" name="Dakar"/> + <iso_3166_2_entry + code="SN-DB" name="Diourbel"/> + <iso_3166_2_entry + code="SN-FK" name="Fatick"/> + <iso_3166_2_entry + code="SN-KA" name="Kaffrine"/> + <iso_3166_2_entry + code="SN-KL" name="Kaolack"/> + <iso_3166_2_entry + code="SN-KE" name="Kédougou"/> + <iso_3166_2_entry + code="SN-KD" name="Kolda"/> + <iso_3166_2_entry + code="SN-LG" name="Louga"/> + <iso_3166_2_entry + code="SN-MT" name="Matam"/> + <iso_3166_2_entry + code="SN-SL" name="Saint-Louis"/> + <iso_3166_2_entry + code="SN-SE" name="Sédhiou"/> + <iso_3166_2_entry + code="SN-TC" name="Tambacounda"/> + <iso_3166_2_entry + code="SN-TH" name="Thiès"/> + <iso_3166_2_entry + code="SN-ZG" name="Ziguinchor"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Somalia --> + <iso_3166_country code="SO"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="SO-AW" name="Awdal"/> + <iso_3166_2_entry + code="SO-BK" name="Bakool"/> + <iso_3166_2_entry + code="SO-BN" name="Banaadir"/> + <iso_3166_2_entry + code="SO-BR" name="Bari"/> + <iso_3166_2_entry + code="SO-BY" name="Bay"/> + <iso_3166_2_entry + code="SO-GA" name="Galguduud"/> + <iso_3166_2_entry + code="SO-GE" name="Gedo"/> + <iso_3166_2_entry + code="SO-HI" name="Hiirsan"/> + <iso_3166_2_entry + code="SO-JD" name="Jubbada Dhexe"/> + <iso_3166_2_entry + code="SO-JH" name="Jubbada Hoose"/> + <iso_3166_2_entry + code="SO-MU" name="Mudug"/> + <iso_3166_2_entry + code="SO-NU" name="Nugaal"/> + <iso_3166_2_entry + code="SO-SA" name="Saneag"/> + <iso_3166_2_entry + code="SO-SD" name="Shabeellaha Dhexe"/> + <iso_3166_2_entry + code="SO-SH" name="Shabeellaha Hoose"/> + <iso_3166_2_entry + code="SO-SO" name="Sool"/> + <iso_3166_2_entry + code="SO-TO" name="Togdheer"/> + <iso_3166_2_entry + code="SO-WO" name="Woqooyi Galbeed"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Suriname --> + <iso_3166_country code="SR"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="SR-BR" name="Brokopondo"/> + <iso_3166_2_entry + code="SR-CM" name="Commewijne"/> + <iso_3166_2_entry + code="SR-CR" name="Coronie"/> + <iso_3166_2_entry + code="SR-MA" name="Marowijne"/> + <iso_3166_2_entry + code="SR-NI" name="Nickerie"/> + <iso_3166_2_entry + code="SR-PR" name="Para"/> + <iso_3166_2_entry + code="SR-PM" name="Paramaribo"/> + <iso_3166_2_entry + code="SR-SA" name="Saramacca"/> + <iso_3166_2_entry + code="SR-SI" name="Sipaliwini"/> + <iso_3166_2_entry + code="SR-WA" name="Wanica"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sao Tome and Principe --> + <iso_3166_country code="ST"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="ST-P" name="Príncipe"/> + <iso_3166_2_entry + code="ST-S" name="São Tomé"/> + </iso_3166_subset> + </iso_3166_country> + <!-- El Salvador --> + <iso_3166_country code="SV"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="SV-AH" name="Ahuachapán"/> + <iso_3166_2_entry + code="SV-CA" name="Cabañas"/> + <iso_3166_2_entry + code="SV-CU" name="Cuscatlán"/> + <iso_3166_2_entry + code="SV-CH" name="Chalatenango"/> + <iso_3166_2_entry + code="SV-LI" name="La Libertad"/> + <iso_3166_2_entry + code="SV-PA" name="La Paz"/> + <iso_3166_2_entry + code="SV-UN" name="La Unión"/> + <iso_3166_2_entry + code="SV-MO" name="Morazán"/> + <iso_3166_2_entry + code="SV-SM" name="San Miguel"/> + <iso_3166_2_entry + code="SV-SS" name="San Salvador"/> + <iso_3166_2_entry + code="SV-SA" name="Santa Ana"/> + <iso_3166_2_entry + code="SV-SV" name="San Vicente"/> + <iso_3166_2_entry + code="SV-SO" name="Sonsonate"/> + <iso_3166_2_entry + code="SV-US" name="Usulután"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Syria --> + <iso_3166_country code="SY"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="SY-HA" name="Al Hasakah"/> + <iso_3166_2_entry + code="SY-LA" name="Al Ladhiqiyah"/> + <iso_3166_2_entry + code="SY-QU" name="Al Qunaytirah"/> + <iso_3166_2_entry + code="SY-RA" name="Ar Raqqah"/> + <iso_3166_2_entry + code="SY-SU" name="As Suwayda'"/> + <iso_3166_2_entry + code="SY-DR" name="Dar'a"/> + <iso_3166_2_entry + code="SY-DY" name="Dayr az Zawr"/> + <iso_3166_2_entry + code="SY-DI" name="Dimashq"/> + <iso_3166_2_entry + code="SY-HL" name="Halab"/> + <iso_3166_2_entry + code="SY-HM" name="Hamah"/> + <iso_3166_2_entry + code="SY-HI" name="Homs"/> + <iso_3166_2_entry + code="SY-ID" name="Idlib"/> + <iso_3166_2_entry + code="SY-RD" name="Rif Dimashq"/> + <iso_3166_2_entry + code="SY-TA" name="Tartus"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Swaziland --> + <iso_3166_country code="SZ"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="SZ-HH" name="Hhohho"/> + <iso_3166_2_entry + code="SZ-LU" name="Lubombo"/> + <iso_3166_2_entry + code="SZ-MA" name="Manzini"/> + <iso_3166_2_entry + code="SZ-SH" name="Shiselweni"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Chad --> + <iso_3166_country code="TD"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TD-BA" name="Al Baṭḩah"/> + <iso_3166_2_entry + code="TD-LC" name="Al Buḩayrah"/> + <iso_3166_2_entry + code="TD-BG" name="Baḩr al Ghazāl"/> + <iso_3166_2_entry + code="TD-BO" name="Būrkū"/> + <iso_3166_2_entry + code="TD-HL" name="Ḥajjar Lamīs"/> + <iso_3166_2_entry + code="TD-EN" name="Innīdī"/> + <iso_3166_2_entry + code="TD-KA" name="Kānim"/> + <iso_3166_2_entry + code="TD-LO" name="Lūqūn al Gharbī"/> + <iso_3166_2_entry + code="TD-LR" name="Lūqūn ash Sharqī"/> + <iso_3166_2_entry + code="TD-ND" name="Madīnat Injamīnā"/> + <iso_3166_2_entry + code="TD-MA" name="Māndūl"/> + <iso_3166_2_entry + code="TD-MO" name="Māyū Kībbī al Gharbī"/> + <iso_3166_2_entry + code="TD-ME" name="Māyū Kībbī ash Sharqī"/> + <iso_3166_2_entry + code="TD-GR" name="Qīrā"/> + <iso_3166_2_entry + code="TD-SA" name="Salāmāt"/> + <iso_3166_2_entry + code="TD-MC" name="Shārī al Awsaṭ"/> + <iso_3166_2_entry + code="TD-CB" name="Shārī Bāqirmī"/> + <iso_3166_2_entry + code="TD-SI" name="Sīlā"/> + <iso_3166_2_entry + code="TD-TA" name="Tānjilī"/> + <iso_3166_2_entry + code="TD-TI" name="Tibastī"/> + <iso_3166_2_entry + code="TD-OD" name="Waddāy"/> + <iso_3166_2_entry + code="TD-WF" name="Wādī Fīrā"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Togo --> + <iso_3166_country code="TG"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TG-C" name="Région du Centre"/> + <iso_3166_2_entry + code="TG-K" name="Région de la Kara"/> + <iso_3166_2_entry + code="TG-M" name="Région Maritime"/> + <iso_3166_2_entry + code="TG-P" name="Région des Plateaux"/> + <iso_3166_2_entry + code="TG-S" name="Région des Savannes"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Thailand --> + <iso_3166_country code="TH"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="TH-10" name="Krung Thep Maha Nakhon Bangkok"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="TH-S" name="Phatthaya"/> + <iso_3166_2_entry + code="TH-37" name="Amnat Charoen"/> + <iso_3166_2_entry + code="TH-15" name="Ang Thong"/> + <iso_3166_2_entry + code="TH-31" name="Buri Ram"/> + <iso_3166_2_entry + code="TH-24" name="Chachoengsao"/> + <iso_3166_2_entry + code="TH-18" name="Chai Nat"/> + <iso_3166_2_entry + code="TH-36" name="Chaiyaphum"/> + <iso_3166_2_entry + code="TH-22" name="Chanthaburi"/> + <iso_3166_2_entry + code="TH-50" name="Chiang Mai"/> + <iso_3166_2_entry + code="TH-57" name="Chiang Rai"/> + <iso_3166_2_entry + code="TH-20" name="Chon Buri"/> + <iso_3166_2_entry + code="TH-86" name="Chumphon"/> + <iso_3166_2_entry + code="TH-46" name="Kalasin"/> + <iso_3166_2_entry + code="TH-62" name="Kamphaeng Phet"/> + <iso_3166_2_entry + code="TH-71" name="Kanchanaburi"/> + <iso_3166_2_entry + code="TH-40" name="Khon Kaen"/> + <iso_3166_2_entry + code="TH-81" name="Krabi"/> + <iso_3166_2_entry + code="TH-52" name="Lampang"/> + <iso_3166_2_entry + code="TH-51" name="Lamphun"/> + <iso_3166_2_entry + code="TH-42" name="Loei"/> + <iso_3166_2_entry + code="TH-16" name="Lop Buri"/> + <iso_3166_2_entry + code="TH-58" name="Mae Hong Son"/> + <iso_3166_2_entry + code="TH-44" name="Maha Sarakham"/> + <iso_3166_2_entry + code="TH-49" name="Mukdahan"/> + <iso_3166_2_entry + code="TH-26" name="Nakhon Nayok"/> + <iso_3166_2_entry + code="TH-73" name="Nakhon Pathom"/> + <iso_3166_2_entry + code="TH-48" name="Nakhon Phanom"/> + <iso_3166_2_entry + code="TH-30" name="Nakhon Ratchasima"/> + <iso_3166_2_entry + code="TH-60" name="Nakhon Sawan"/> + <iso_3166_2_entry + code="TH-80" name="Nakhon Si Thammarat"/> + <iso_3166_2_entry + code="TH-55" name="Nan"/> + <iso_3166_2_entry + code="TH-96" name="Narathiwat"/> + <iso_3166_2_entry + code="TH-39" name="Nong Bua Lam Phu"/> + <iso_3166_2_entry + code="TH-43" name="Nong Khai"/> + <iso_3166_2_entry + code="TH-12" name="Nonthaburi"/> + <iso_3166_2_entry + code="TH-13" name="Pathum Thani"/> + <iso_3166_2_entry + code="TH-94" name="Pattani"/> + <iso_3166_2_entry + code="TH-82" name="Phangnga"/> + <iso_3166_2_entry + code="TH-93" name="Phatthalung"/> + <iso_3166_2_entry + code="TH-56" name="Phayao"/> + <iso_3166_2_entry + code="TH-67" name="Phetchabun"/> + <iso_3166_2_entry + code="TH-76" name="Phetchaburi"/> + <iso_3166_2_entry + code="TH-66" name="Phichit"/> + <iso_3166_2_entry + code="TH-65" name="Phitsanulok"/> + <iso_3166_2_entry + code="TH-54" name="Phrae"/> + <iso_3166_2_entry + code="TH-14" name="Phra Nakhon Si Ayutthaya"/> + <iso_3166_2_entry + code="TH-83" name="Phuket"/> + <iso_3166_2_entry + code="TH-25" name="Prachin Buri"/> + <iso_3166_2_entry + code="TH-77" name="Prachuap Khiri Khan"/> + <iso_3166_2_entry + code="TH-85" name="Ranong"/> + <iso_3166_2_entry + code="TH-70" name="Ratchaburi"/> + <iso_3166_2_entry + code="TH-21" name="Rayong"/> + <iso_3166_2_entry + code="TH-45" name="Roi Et"/> + <iso_3166_2_entry + code="TH-27" name="Sa Kaeo"/> + <iso_3166_2_entry + code="TH-47" name="Sakon Nakhon"/> + <iso_3166_2_entry + code="TH-11" name="Samut Prakan"/> + <iso_3166_2_entry + code="TH-74" name="Samut Sakhon"/> + <iso_3166_2_entry + code="TH-75" name="Samut Songkhram"/> + <iso_3166_2_entry + code="TH-19" name="Saraburi"/> + <iso_3166_2_entry + code="TH-91" name="Satun"/> + <iso_3166_2_entry + code="TH-17" name="Sing Buri"/> + <iso_3166_2_entry + code="TH-33" name="Si Sa Ket"/> + <iso_3166_2_entry + code="TH-90" name="Songkhla"/> + <iso_3166_2_entry + code="TH-64" name="Sukhothai"/> + <iso_3166_2_entry + code="TH-72" name="Suphan Buri"/> + <iso_3166_2_entry + code="TH-84" name="Surat Thani"/> + <iso_3166_2_entry + code="TH-32" name="Surin"/> + <iso_3166_2_entry + code="TH-63" name="Tak"/> + <iso_3166_2_entry + code="TH-92" name="Trang"/> + <iso_3166_2_entry + code="TH-23" name="Trat"/> + <iso_3166_2_entry + code="TH-34" name="Ubon Ratchathani"/> + <iso_3166_2_entry + code="TH-41" name="Udon Thani"/> + <iso_3166_2_entry + code="TH-61" name="Uthai Thani"/> + <iso_3166_2_entry + code="TH-53" name="Uttaradit"/> + <iso_3166_2_entry + code="TH-95" name="Yala"/> + <iso_3166_2_entry + code="TH-35" name="Yasothon"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tajikistan --> + <iso_3166_country code="TJ"> + <iso_3166_subset type="Autonomous region"> + <iso_3166_2_entry + code="TJ-GB" name="Gorno-Badakhshan"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TJ-KT" name="Khatlon"/> + <iso_3166_2_entry + code="TJ-SU" name="Sughd"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Timor Leste --> + <iso_3166_country code="TL"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="TL-AL" name="Aileu"/> + <iso_3166_2_entry + code="TL-AN" name="Ainaro"/> + <iso_3166_2_entry + code="TL-BA" name="Baucau"/> + <iso_3166_2_entry + code="TL-BO" name="Bobonaro"/> + <iso_3166_2_entry + code="TL-CO" name="Cova Lima"/> + <iso_3166_2_entry + code="TL-DI" name="Dili"/> + <iso_3166_2_entry + code="TL-ER" name="Ermera"/> + <iso_3166_2_entry + code="TL-LA" name="Lautem"/> + <iso_3166_2_entry + code="TL-LI" name="Liquiça"/> + <iso_3166_2_entry + code="TL-MT" name="Manatuto"/> + <iso_3166_2_entry + code="TL-MF" name="Manufahi"/> + <iso_3166_2_entry + code="TL-OE" name="Oecussi"/> + <iso_3166_2_entry + code="TL-VI" name="Viqueque"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Turkmenistan --> + <iso_3166_country code="TM"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TM-A" name="Ahal"/> + <iso_3166_2_entry + code="TM-B" name="Balkan"/> + <iso_3166_2_entry + code="TM-D" name="Daşoguz"/> + <iso_3166_2_entry + code="TM-L" name="Lebap"/> + <iso_3166_2_entry + code="TM-M" name="Mary"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="TM-S" name="Aşgabat"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tunisia --> + <iso_3166_country code="TN"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="TN-31" name="Béja"/> + <iso_3166_2_entry + code="TN-13" name="Ben Arous"/> + <iso_3166_2_entry + code="TN-23" name="Bizerte"/> + <iso_3166_2_entry + code="TN-81" name="Gabès"/> + <iso_3166_2_entry + code="TN-71" name="Gafsa"/> + <iso_3166_2_entry + code="TN-32" name="Jendouba"/> + <iso_3166_2_entry + code="TN-41" name="Kairouan"/> + <iso_3166_2_entry + code="TN-42" name="Kasserine"/> + <iso_3166_2_entry + code="TN-73" name="Kebili"/> + <iso_3166_2_entry + code="TN-12" name="L'Ariana"/> + <iso_3166_2_entry + code="TN-33" name="Le Kef"/> + <iso_3166_2_entry + code="TN-53" name="Mahdia"/> + <iso_3166_2_entry + code="TN-14" name="La Manouba"/> + <iso_3166_2_entry + code="TN-82" name="Medenine"/> + <iso_3166_2_entry + code="TN-52" name="Monastir"/> + <iso_3166_2_entry + code="TN-21" name="Nabeul"/> + <iso_3166_2_entry + code="TN-61" name="Sfax"/> + <iso_3166_2_entry + code="TN-43" name="Sidi Bouzid"/> + <iso_3166_2_entry + code="TN-34" name="Siliana"/> + <iso_3166_2_entry + code="TN-51" name="Sousse"/> + <iso_3166_2_entry + code="TN-83" name="Tataouine"/> + <iso_3166_2_entry + code="TN-72" name="Tozeur"/> + <iso_3166_2_entry + code="TN-11" name="Tunis"/> + <iso_3166_2_entry + code="TN-22" name="Zaghouan"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tonga --> + <iso_3166_country code="TO"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="TO-01" name="'Eua"/> + <iso_3166_2_entry + code="TO-02" name="Ha'apai"/> + <iso_3166_2_entry + code="TO-03" name="Niuas"/> + <iso_3166_2_entry + code="TO-04" name="Tongatapu"/> + <iso_3166_2_entry + code="TO-05" name="Vava'u"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Turkey --> + <iso_3166_country code="TR"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="TR-01" name="Adana"/> + <iso_3166_2_entry + code="TR-02" name="Adıyaman"/> + <iso_3166_2_entry + code="TR-03" name="Afyon"/> + <iso_3166_2_entry + code="TR-04" name="Ağrı"/> + <iso_3166_2_entry + code="TR-68" name="Aksaray"/> + <iso_3166_2_entry + code="TR-05" name="Amasya"/> + <iso_3166_2_entry + code="TR-06" name="Ankara"/> + <iso_3166_2_entry + code="TR-07" name="Antalya"/> + <iso_3166_2_entry + code="TR-75" name="Ardahan"/> + <iso_3166_2_entry + code="TR-08" name="Artvin"/> + <iso_3166_2_entry + code="TR-09" name="Aydın"/> + <iso_3166_2_entry + code="TR-10" name="Balıkesir"/> + <iso_3166_2_entry + code="TR-74" name="Bartın"/> + <iso_3166_2_entry + code="TR-72" name="Batman"/> + <iso_3166_2_entry + code="TR-69" name="Bayburt"/> + <iso_3166_2_entry + code="TR-11" name="Bilecik"/> + <iso_3166_2_entry + code="TR-12" name="Bingöl"/> + <iso_3166_2_entry + code="TR-13" name="Bitlis"/> + <iso_3166_2_entry + code="TR-14" name="Bolu"/> + <iso_3166_2_entry + code="TR-15" name="Burdur"/> + <iso_3166_2_entry + code="TR-16" name="Bursa"/> + <iso_3166_2_entry + code="TR-17" name="Çanakkale"/> + <iso_3166_2_entry + code="TR-18" name="Çankırı"/> + <iso_3166_2_entry + code="TR-19" name="Çorum"/> + <iso_3166_2_entry + code="TR-20" name="Denizli"/> + <iso_3166_2_entry + code="TR-21" name="Diyarbakır"/> + <iso_3166_2_entry + code="TR-81" name="Düzce"/> + <iso_3166_2_entry + code="TR-22" name="Edirne"/> + <iso_3166_2_entry + code="TR-23" name="Elazığ"/> + <iso_3166_2_entry + code="TR-24" name="Erzincan"/> + <iso_3166_2_entry + code="TR-25" name="Erzurum"/> + <iso_3166_2_entry + code="TR-26" name="Eskişehir"/> + <iso_3166_2_entry + code="TR-27" name="Gaziantep"/> + <iso_3166_2_entry + code="TR-28" name="Giresun"/> + <iso_3166_2_entry + code="TR-29" name="Gümüşhane"/> + <iso_3166_2_entry + code="TR-30" name="Hakkâri"/> + <iso_3166_2_entry + code="TR-31" name="Hatay"/> + <iso_3166_2_entry + code="TR-76" name="Iğdır"/> + <iso_3166_2_entry + code="TR-32" name="Isparta"/> + <iso_3166_2_entry + code="TR-33" name="İçel"/> + <iso_3166_2_entry + code="TR-34" name="İstanbul"/> + <iso_3166_2_entry + code="TR-35" name="İzmir"/> + <iso_3166_2_entry + code="TR-46" name="Kahramanmaraş"/> + <iso_3166_2_entry + code="TR-78" name="Karabük"/> + <iso_3166_2_entry + code="TR-70" name="Karaman"/> + <iso_3166_2_entry + code="TR-36" name="Kars"/> + <iso_3166_2_entry + code="TR-37" name="Kastamonu"/> + <iso_3166_2_entry + code="TR-38" name="Kayseri"/> + <iso_3166_2_entry + code="TR-71" name="Kırıkkale"/> + <iso_3166_2_entry + code="TR-39" name="Kırklareli"/> + <iso_3166_2_entry + code="TR-40" name="Kırşehir"/> + <iso_3166_2_entry + code="TR-79" name="Kilis"/> + <iso_3166_2_entry + code="TR-41" name="Kocaeli"/> + <iso_3166_2_entry + code="TR-42" name="Konya"/> + <iso_3166_2_entry + code="TR-43" name="Kütahya"/> + <iso_3166_2_entry + code="TR-44" name="Malatya"/> + <iso_3166_2_entry + code="TR-45" name="Manisa"/> + <iso_3166_2_entry + code="TR-47" name="Mardin"/> + <iso_3166_2_entry + code="TR-48" name="Muğla"/> + <iso_3166_2_entry + code="TR-49" name="Muş"/> + <iso_3166_2_entry + code="TR-50" name="Nevşehir"/> + <iso_3166_2_entry + code="TR-51" name="Niğde"/> + <iso_3166_2_entry + code="TR-52" name="Ordu"/> + <iso_3166_2_entry + code="TR-80" name="Osmaniye"/> + <iso_3166_2_entry + code="TR-53" name="Rize"/> + <iso_3166_2_entry + code="TR-54" name="Sakarya"/> + <iso_3166_2_entry + code="TR-55" name="Samsun"/> + <iso_3166_2_entry + code="TR-56" name="Siirt"/> + <iso_3166_2_entry + code="TR-57" name="Sinop"/> + <iso_3166_2_entry + code="TR-58" name="Sivas"/> + <iso_3166_2_entry + code="TR-63" name="Şanlıurfa"/> + <iso_3166_2_entry + code="TR-73" name="Şırnak"/> + <iso_3166_2_entry + code="TR-59" name="Tekirdağ"/> + <iso_3166_2_entry + code="TR-60" name="Tokat"/> + <iso_3166_2_entry + code="TR-61" name="Trabzon"/> + <iso_3166_2_entry + code="TR-62" name="Tunceli"/> + <iso_3166_2_entry + code="TR-64" name="Uşak"/> + <iso_3166_2_entry + code="TR-65" name="Van"/> + <iso_3166_2_entry + code="TR-77" name="Yalova"/> + <iso_3166_2_entry + code="TR-66" name="Yozgat"/> + <iso_3166_2_entry + code="TR-67" name="Zonguldak"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Trinidad and Tobago --> + <iso_3166_country code="TT"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TT-CTT" name="Couva-Tabaquite-Talparo"/> + <iso_3166_2_entry + code="TT-DMN" name="Diego Martin"/> + <iso_3166_2_entry + code="TT-ETO" name="Eastern Tobago"/> + <iso_3166_2_entry + code="TT-PED" name="Penal-Debe"/> + <iso_3166_2_entry + code="TT-PRT" name="Princes Town"/> + <iso_3166_2_entry + code="TT-RCM" name="Rio Claro-Mayaro"/> + <iso_3166_2_entry + code="TT-SGE" name="Sangre Grande"/> + <iso_3166_2_entry + code="TT-SJL" name="San Juan-Laventille"/> + <iso_3166_2_entry + code="TT-SIP" name="Siparia"/> + <iso_3166_2_entry + code="TT-TUP" name="Tunapuna-Piarco"/> + <iso_3166_2_entry + code="TT-WTO" name="Western Tobago"/> + </iso_3166_subset> + <iso_3166_subset type="Borough"> + <iso_3166_2_entry + code="TT-ARI" name="Arima"/> + <iso_3166_2_entry + code="TT-CHA" name="Chaguanas"/> + <iso_3166_2_entry + code="TT-PTF" name="Point Fortin"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="TT-POS" name="Port of Spain"/> + <iso_3166_2_entry + code="TT-SFO" name="San Fernando"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tuvalu --> + <iso_3166_country code="TV"> + <iso_3166_subset type="Town council"> + <iso_3166_2_entry + code="TV-FUN" name="Funafuti"/> + </iso_3166_subset> + <iso_3166_subset type="Island council"> + <iso_3166_2_entry + code="TV-NMG" name="Nanumanga"/> + <iso_3166_2_entry + code="TV-NMA" name="Nanumea"/> + <iso_3166_2_entry + code="TV-NIT" name="Niutao"/> + <iso_3166_2_entry + code="TV-NIU" name="Nui"/> + <iso_3166_2_entry + code="TV-NKF" name="Nukufetau"/> + <iso_3166_2_entry + code="TV-NKL" name="Nukulaelae"/> + <iso_3166_2_entry + code="TV-VAI" name="Vaitupu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Taiwan --> + <iso_3166_country code="TW"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="TW-CHA" name="Changhua"/> + <iso_3166_2_entry + code="TW-CYQ" name="Chiayi"/> + <iso_3166_2_entry + code="TW-HSQ" name="Hsinchu"/> + <iso_3166_2_entry + code="TW-HUA" name="Hualien"/> + <iso_3166_2_entry + code="TW-ILA" name="Ilan"/> + <iso_3166_2_entry + code="TW-KHQ" name="Kaohsiung"/> + <iso_3166_2_entry + code="TW-MIA" name="Miaoli"/> + <iso_3166_2_entry + code="TW-NAN" name="Nantou"/> + <iso_3166_2_entry + code="TW-PEN" name="Penghu"/> + <iso_3166_2_entry + code="TW-PIF" name="Pingtung"/> + <iso_3166_2_entry + code="TW-TXQ" name="Taichung"/> + <iso_3166_2_entry + code="TW-TNQ" name="Tainan"/> + <iso_3166_2_entry + code="TW-TPQ" name="Taipei"/> + <iso_3166_2_entry + code="TW-TTT" name="Taitung"/> + <iso_3166_2_entry + code="TW-TAO" name="Taoyuan"/> + <iso_3166_2_entry + code="TW-YUN" name="Yunlin"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="TW-CYI" name="Chiay City"/> + <iso_3166_2_entry + code="TW-HSZ" name="Hsinchui City"/> + <iso_3166_2_entry + code="TW-KEE" name="Keelung City"/> + <iso_3166_2_entry + code="TW-TXG" name="Taichung City"/> + <iso_3166_2_entry + code="TW-TNN" name="Tainan City"/> + </iso_3166_subset> + <iso_3166_subset type="Special Municipality"> + <iso_3166_2_entry + code="TW-KHH" name="Kaohsiung City"/> + <iso_3166_2_entry + code="TW-TPE" name="Taipei City"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tanzania --> + <iso_3166_country code="TZ"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TZ-01" name="Arusha"/> + <iso_3166_2_entry + code="TZ-02" name="Dar-es-Salaam"/> + <iso_3166_2_entry + code="TZ-03" name="Dodoma"/> + <iso_3166_2_entry + code="TZ-04" name="Iringa"/> + <iso_3166_2_entry + code="TZ-05" name="Kagera"/> + <iso_3166_2_entry + code="TZ-06" name="Kaskazini Pemba"/> + <iso_3166_2_entry + code="TZ-07" name="Kaskazini Unguja"/> + <iso_3166_2_entry + code="TZ-08" name="Kigoma"/> + <iso_3166_2_entry + code="TZ-09" name="Kilimanjaro"/> + <iso_3166_2_entry + code="TZ-10" name="Kusini Pemba"/> + <iso_3166_2_entry + code="TZ-11" name="Kusini Unguja"/> + <iso_3166_2_entry + code="TZ-12" name="Lindi"/> + <iso_3166_2_entry + code="TZ-26" name="Manyara"/> + <iso_3166_2_entry + code="TZ-13" name="Mara"/> + <iso_3166_2_entry + code="TZ-14" name="Mbeya"/> + <iso_3166_2_entry + code="TZ-15" name="Mjini Magharibi"/> + <iso_3166_2_entry + code="TZ-16" name="Morogoro"/> + <iso_3166_2_entry + code="TZ-17" name="Mtwara"/> + <iso_3166_2_entry + code="TZ-18" name="Mwanza"/> + <iso_3166_2_entry + code="TZ-19" name="Pwani"/> + <iso_3166_2_entry + code="TZ-20" name="Rukwa"/> + <iso_3166_2_entry + code="TZ-21" name="Ruvuma"/> + <iso_3166_2_entry + code="TZ-22" name="Shinyanga"/> + <iso_3166_2_entry + code="TZ-23" name="Singida"/> + <iso_3166_2_entry + code="TZ-24" name="Tabora"/> + <iso_3166_2_entry + code="TZ-25" name="Tanga"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ukraine --> + <iso_3166_country code="UA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="UA-71" name="Cherkas'ka Oblast'"/> + <iso_3166_2_entry + code="UA-74" name="Chernihivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-77" name="Chernivets'ka Oblast'"/> + <iso_3166_2_entry + code="UA-12" name="Dnipropetrovs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-14" name="Donets'ka Oblast'"/> + <iso_3166_2_entry + code="UA-26" name="Ivano-Frankivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-63" name="Kharkivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-65" name="Khersons'ka Oblast'"/> + <iso_3166_2_entry + code="UA-68" name="Khmel'nyts'ka Oblast'"/> + <iso_3166_2_entry + code="UA-35" name="Kirovohrads'ka Oblast'"/> + <iso_3166_2_entry + code="UA-32" name="Kyïvs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-09" name="Luhans'ka Oblast'"/> + <iso_3166_2_entry + code="UA-46" name="L'vivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-48" name="Mykolaïvs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-51" name="Odes'ka Oblast'"/> + <iso_3166_2_entry + code="UA-53" name="Poltavs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-56" name="Rivnens'ka Oblast'"/> + <iso_3166_2_entry + code="UA-59" name="Sums 'ka Oblast'"/> + <iso_3166_2_entry + code="UA-61" name="Ternopil's'ka Oblast'"/> + <iso_3166_2_entry + code="UA-05" name="Vinnyts'ka Oblast'"/> + <iso_3166_2_entry + code="UA-07" name="Volyns'ka Oblast'"/> + <iso_3166_2_entry + code="UA-21" name="Zakarpats'ka Oblast'"/> + <iso_3166_2_entry + code="UA-23" name="Zaporiz'ka Oblast'"/> + <iso_3166_2_entry + code="UA-18" name="Zhytomyrs'ka Oblast'"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous republic"> + <iso_3166_2_entry + code="UA-43" name="Respublika Krym"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="UA-30" name="Kyïvs'ka mis'ka rada"/> + <iso_3166_2_entry + code="UA-40" name="Sevastopol"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Uganda --> + <iso_3166_country code="UG"> + <iso_3166_subset type="Geographical region"> + <iso_3166_2_entry + code="UG-C" name="Central"/> + <iso_3166_2_entry + code="UG-E" name="Eastern"/> + <iso_3166_2_entry + code="UG-N" name="Northern"/> + <iso_3166_2_entry + code="UG-W" name="Western"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="UG-317" name="Abim" parent="N"/> + <iso_3166_2_entry + code="UG-301" name="Adjumani" parent="N"/> + <iso_3166_2_entry + code="UG-314" name="Amolatar" parent="N"/> + <iso_3166_2_entry + code="UG-216" name="Amuria" parent="E"/> + <iso_3166_2_entry + code="UG-319" name="Amuru" parent="N"/> + <iso_3166_2_entry + code="UG-302" name="Apac" parent="N"/> + <iso_3166_2_entry + code="UG-303" name="Arua" parent="N"/> + <iso_3166_2_entry + code="UG-217" name="Budaka" parent="E"/> + <iso_3166_2_entry + code="UG-223" name="Bududa" parent="E"/> + <iso_3166_2_entry + code="UG-201" name="Bugiri" parent="E"/> + <iso_3166_2_entry + code="UG-224" name="Bukedea" parent="E"/> + <iso_3166_2_entry + code="UG-218" name="Bukwa" parent="E"/> + <iso_3166_2_entry + code="UG-419" name="Buliisa" parent="W"/> + <iso_3166_2_entry + code="UG-401" name="Bundibugyo" parent="W"/> + <iso_3166_2_entry + code="UG-402" name="Bushenyi" parent="W"/> + <iso_3166_2_entry + code="UG-202" name="Busia" parent="E"/> + <iso_3166_2_entry + code="UG-219" name="Butaleja" parent="E"/> + <iso_3166_2_entry + code="UG-318" name="Dokolo" parent="N"/> + <iso_3166_2_entry + code="UG-304" name="Gulu" parent="N"/> + <iso_3166_2_entry + code="UG-403" name="Hoima" parent="W"/> + <iso_3166_2_entry + code="UG-416" name="Ibanda" parent="W"/> + <iso_3166_2_entry + code="UG-203" name="Iganga" parent="E"/> + <iso_3166_2_entry + code="UG-417" name="Isingiro" parent="W"/> + <iso_3166_2_entry + code="UG-204" name="Jinja" parent="E"/> + <iso_3166_2_entry + code="UG-315" name="Kaabong" parent="N"/> + <iso_3166_2_entry + code="UG-404" name="Kabale" parent="W"/> + <iso_3166_2_entry + code="UG-405" name="Kabarole" parent="W"/> + <iso_3166_2_entry + code="UG-213" name="Kaberamaido" parent="E"/> + <iso_3166_2_entry + code="UG-101" name="Kalangala" parent="C"/> + <iso_3166_2_entry + code="UG-220" name="Kaliro" parent="E"/> + <iso_3166_2_entry + code="UG-102" name="Kampala" parent="C"/> + <iso_3166_2_entry + code="UG-205" name="Kamuli" parent="E"/> + <iso_3166_2_entry + code="UG-413" name="Kamwenge" parent="W"/> + <iso_3166_2_entry + code="UG-414" name="Kanungu" parent="W"/> + <iso_3166_2_entry + code="UG-206" name="Kapchorwa" parent="E"/> + <iso_3166_2_entry + code="UG-406" name="Kasese" parent="W"/> + <iso_3166_2_entry + code="UG-207" name="Katakwi" parent="E"/> + <iso_3166_2_entry + code="UG-112" name="Kayunga" parent="C"/> + <iso_3166_2_entry + code="UG-407" name="Kibaale" parent="W"/> + <iso_3166_2_entry + code="UG-103" name="Kiboga" parent="C"/> + <iso_3166_2_entry + code="UG-418" name="Kiruhura" parent="W"/> + <iso_3166_2_entry + code="UG-408" name="Kisoro" parent="W"/> + <iso_3166_2_entry + code="UG-305" name="Kitgum" parent="N"/> + <iso_3166_2_entry + code="UG-316" name="Koboko" parent="N"/> + <iso_3166_2_entry + code="UG-306" name="Kotido" parent="N"/> + <iso_3166_2_entry + code="UG-208" name="Kumi" parent="E"/> + <iso_3166_2_entry + code="UG-415" name="Kyenjojo" parent="W"/> + <iso_3166_2_entry + code="UG-307" name="Lira" parent="N"/> + <iso_3166_2_entry + code="UG-104" name="Luwero" parent="C"/> + <iso_3166_2_entry + code="UG-116" name="Lyantonde" parent="C"/> + <iso_3166_2_entry + code="UG-221" name="Manafwa" parent="E"/> + <iso_3166_2_entry + code="UG-320" name="Maracha" parent="N"/> + <iso_3166_2_entry + code="UG-105" name="Masaka" parent="C"/> + <iso_3166_2_entry + code="UG-409" name="Masindi" parent="W"/> + <iso_3166_2_entry + code="UG-214" name="Mayuge" parent="E"/> + <iso_3166_2_entry + code="UG-209" name="Mbale" parent="E"/> + <iso_3166_2_entry + code="UG-410" name="Mbarara" parent="W"/> + <iso_3166_2_entry + code="UG-114" name="Mityana" parent="C"/> + <iso_3166_2_entry + code="UG-308" name="Moroto" parent="N"/> + <iso_3166_2_entry + code="UG-309" name="Moyo" parent="N"/> + <iso_3166_2_entry + code="UG-106" name="Mpigi" parent="C"/> + <iso_3166_2_entry + code="UG-107" name="Mubende" parent="C"/> + <iso_3166_2_entry + code="UG-108" name="Mukono" parent="C"/> + <iso_3166_2_entry + code="UG-311" name="Nakapiripirit" parent="N"/> + <iso_3166_2_entry + code="UG-115" name="Nakaseke" parent="C"/> + <iso_3166_2_entry + code="UG-109" name="Nakasongola" parent="C"/> + <iso_3166_2_entry + code="UG-222" name="Namutumba" parent="E"/> + <iso_3166_2_entry + code="UG-310" name="Nebbi" parent="N"/> + <iso_3166_2_entry + code="UG-411" name="Ntungamo" parent="W"/> + <iso_3166_2_entry + code="UG-321" name="Oyam" parent="N"/> + <iso_3166_2_entry + code="UG-312" name="Pader" parent="N"/> + <iso_3166_2_entry + code="UG-210" name="Pallisa" parent="E"/> + <iso_3166_2_entry + code="UG-110" name="Rakai" parent="C"/> + <iso_3166_2_entry + code="UG-412" name="Rukungiri" parent="W"/> + <iso_3166_2_entry + code="UG-111" name="Sembabule" parent="C"/> + <iso_3166_2_entry + code="UG-215" name="Sironko" parent="E"/> + <iso_3166_2_entry + code="UG-211" name="Soroti" parent="E"/> + <iso_3166_2_entry + code="UG-212" name="Tororo" parent="E"/> + <iso_3166_2_entry + code="UG-113" name="Wakiso" parent="C"/> + <iso_3166_2_entry + code="UG-313" name="Yumbe" parent="N"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United States Minor Outlying Islands --> + <iso_3166_country code="UM"> + <iso_3166_subset type="Territory"> + <iso_3166_2_entry + code="UM-81" name="Baker Island"/> + <iso_3166_2_entry + code="UM-84" name="Howland Island"/> + <iso_3166_2_entry + code="UM-86" name="Jarvis Island"/> + <iso_3166_2_entry + code="UM-67" name="Johnston Atoll"/> + <iso_3166_2_entry + code="UM-89" name="Kingman Reef"/> + <iso_3166_2_entry + code="UM-71" name="Midway Islands"/> + <iso_3166_2_entry + code="UM-76" name="Navassa Island"/> + <iso_3166_2_entry + code="UM-95" name="Palmyra Atoll"/> + <iso_3166_2_entry + code="UM-79" name="Wake Island"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United States --> + <iso_3166_country code="US"> + <iso_3166_subset type="State"> + <!-- US ISO 3166-2 system (from one example) appears to be based on USPS State --> + <!-- and territory codes, which follow: --> + <!-- Note US-UM: Outlying Islands have their own subregion in 'UM' --> + <iso_3166_2_entry + code="US-AL" name="Alabama"/> + <iso_3166_2_entry + code="US-AK" name="Alaska"/> + <iso_3166_2_entry + code="US-AZ" name="Arizona"/> + <iso_3166_2_entry + code="US-AR" name="Arkansas"/> + <iso_3166_2_entry + code="US-CA" name="California"/> + <iso_3166_2_entry + code="US-CO" name="Colorado"/> + <iso_3166_2_entry + code="US-CT" name="Connecticut"/> + <iso_3166_2_entry + code="US-DE" name="Delaware"/> + <iso_3166_2_entry + code="US-FL" name="Florida"/> + <iso_3166_2_entry + code="US-GA" name="Georgia"/> + <iso_3166_2_entry + code="US-HI" name="Hawaii"/> + <iso_3166_2_entry + code="US-ID" name="Idaho"/> + <iso_3166_2_entry + code="US-IL" name="Illinois"/> + <iso_3166_2_entry + code="US-IN" name="Indiana"/> + <iso_3166_2_entry + code="US-IA" name="Iowa"/> + <iso_3166_2_entry + code="US-KS" name="Kansas"/> + <iso_3166_2_entry + code="US-KY" name="Kentucky"/> + <iso_3166_2_entry + code="US-LA" name="Louisiana"/> + <iso_3166_2_entry + code="US-ME" name="Maine"/> + <iso_3166_2_entry + code="US-MD" name="Maryland"/> + <iso_3166_2_entry + code="US-MA" name="Massachusetts"/> + <iso_3166_2_entry + code="US-MI" name="Michigan"/> + <iso_3166_2_entry + code="US-MN" name="Minnesota"/> + <iso_3166_2_entry + code="US-MS" name="Mississippi"/> + <iso_3166_2_entry + code="US-MO" name="Missouri"/> + <iso_3166_2_entry + code="US-MT" name="Montana"/> + <iso_3166_2_entry + code="US-NE" name="Nebraska"/> + <iso_3166_2_entry + code="US-NV" name="Nevada"/> + <iso_3166_2_entry + code="US-NH" name="New Hampshire"/> + <iso_3166_2_entry + code="US-NJ" name="New Jersey"/> + <iso_3166_2_entry + code="US-NM" name="New Mexico"/> + <iso_3166_2_entry + code="US-NY" name="New York"/> + <iso_3166_2_entry + code="US-NC" name="North Carolina"/> + <iso_3166_2_entry + code="US-ND" name="North Dakota"/> + <iso_3166_2_entry + code="US-OH" name="Ohio"/> + <iso_3166_2_entry + code="US-OK" name="Oklahoma"/> + <iso_3166_2_entry + code="US-OR" name="Oregon"/> + <iso_3166_2_entry + code="US-PA" name="Pennsylvania"/> + <iso_3166_2_entry + code="US-RI" name="Rhode Island"/> + <iso_3166_2_entry + code="US-SC" name="South Carolina"/> + <iso_3166_2_entry + code="US-SD" name="South Dakota"/> + <iso_3166_2_entry + code="US-TN" name="Tennessee"/> + <iso_3166_2_entry + code="US-TX" name="Texas"/> + <iso_3166_2_entry + code="US-UT" name="Utah"/> + <iso_3166_2_entry + code="US-VT" name="Vermont"/> + <iso_3166_2_entry + code="US-VA" name="Virginia"/> + <iso_3166_2_entry + code="US-WA" name="Washington"/> + <iso_3166_2_entry + code="US-WV" name="West Virginia"/> + <iso_3166_2_entry + code="US-WI" name="Wisconsin"/> + <iso_3166_2_entry + code="US-WY" name="Wyoming"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="US-DC" name="District of Columbia"/> + </iso_3166_subset> + <iso_3166_subset type="Outlying area"> + <iso_3166_2_entry + code="US-AS" name="American Samoa"/> + <iso_3166_2_entry + code="US-GU" name="Guam"/> + <iso_3166_2_entry + code="US-MP" name="Northern Mariana Islands"/> + <iso_3166_2_entry + code="US-PR" name="Puerto Rico"/> + <iso_3166_2_entry + code="US-UM" name="United States Minor Outlying Islands"/> + <iso_3166_2_entry + code="US-VI" name="Virgin Islands"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Uruguay --> + <iso_3166_country code="UY"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="UY-AR" name="Artigas"/> + <iso_3166_2_entry + code="UY-CA" name="Canelones"/> + <iso_3166_2_entry + code="UY-CL" name="Cerro Largo"/> + <iso_3166_2_entry + code="UY-CO" name="Colonia"/> + <iso_3166_2_entry + code="UY-DU" name="Durazno"/> + <iso_3166_2_entry + code="UY-FS" name="Flores"/> + <iso_3166_2_entry + code="UY-FD" name="Florida"/> + <iso_3166_2_entry + code="UY-LA" name="Lavalleja"/> + <iso_3166_2_entry + code="UY-MA" name="Maldonado"/> + <iso_3166_2_entry + code="UY-MO" name="Montevideo"/> + <iso_3166_2_entry + code="UY-PA" name="Paysandú"/> + <iso_3166_2_entry + code="UY-RN" name="Río Negro"/> + <iso_3166_2_entry + code="UY-RV" name="Rivera"/> + <iso_3166_2_entry + code="UY-RO" name="Rocha"/> + <iso_3166_2_entry + code="UY-SA" name="Salto"/> + <iso_3166_2_entry + code="UY-SJ" name="San José"/> + <iso_3166_2_entry + code="UY-SO" name="Soriano"/> + <iso_3166_2_entry + code="UY-TA" name="Tacuarembó"/> + <iso_3166_2_entry + code="UY-TT" name="Treinta y Tres"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Uzbekistan --> + <iso_3166_country code="UZ"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="UZ-TK" name="Toshkent"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="UZ-AN" name="Andijon"/> + <iso_3166_2_entry + code="UZ-BU" name="Buxoro"/> + <iso_3166_2_entry + code="UZ-FA" name="Farg'ona"/> + <iso_3166_2_entry + code="UZ-JI" name="Jizzax"/> + <iso_3166_2_entry + code="UZ-NG" name="Namangan"/> + <iso_3166_2_entry + code="UZ-NW" name="Navoiy"/> + <iso_3166_2_entry + code="UZ-QA" name="Qashqadaryo"/> + <iso_3166_2_entry + code="UZ-SA" name="Samarqand"/> + <iso_3166_2_entry + code="UZ-SI" name="Sirdaryo"/> + <iso_3166_2_entry + code="UZ-SU" name="Surxondaryo"/> + <iso_3166_2_entry + code="UZ-TO" name="Toshkent"/> + <iso_3166_2_entry + code="UZ-XO" name="Xorazm"/> + </iso_3166_subset> + <iso_3166_subset type="Republic"> + <iso_3166_2_entry + code="UZ-QR" name="Qoraqalpog'iston Respublikasi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Vincent and the Grenadines --> + <iso_3166_country code="VC"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="VC-01" name="Charlotte"/> + <iso_3166_2_entry + code="VC-06" name="Grenadines"/> + <iso_3166_2_entry + code="VC-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="VC-03" name="Saint David"/> + <iso_3166_2_entry + code="VC-04" name="Saint George"/> + <iso_3166_2_entry + code="VC-05" name="Saint Patrick"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Venezuela --> + <iso_3166_country code="VE"> + <iso_3166_subset type="Federal Dependency"> + <iso_3166_2_entry + code="VE-W" name="Dependencias Federales"/> + </iso_3166_subset> + <iso_3166_subset type="Federal District"> + <iso_3166_2_entry + code="VE-A" name="Distrito Federal"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="VE-Z" name="Amazonas"/> + <iso_3166_2_entry + code="VE-B" name="Anzoátegui"/> + <iso_3166_2_entry + code="VE-C" name="Apure"/> + <iso_3166_2_entry + code="VE-D" name="Aragua"/> + <iso_3166_2_entry + code="VE-E" name="Barinas"/> + <iso_3166_2_entry + code="VE-F" name="Bolívar"/> + <iso_3166_2_entry + code="VE-G" name="Carabobo"/> + <iso_3166_2_entry + code="VE-H" name="Cojedes"/> + <iso_3166_2_entry + code="VE-Y" name="Delta Amacuro"/> + <iso_3166_2_entry + code="VE-I" name="Falcón"/> + <iso_3166_2_entry + code="VE-J" name="Guárico"/> + <iso_3166_2_entry + code="VE-K" name="Lara"/> + <iso_3166_2_entry + code="VE-L" name="Mérida"/> + <iso_3166_2_entry + code="VE-M" name="Miranda"/> + <iso_3166_2_entry + code="VE-N" name="Monagas"/> + <iso_3166_2_entry + code="VE-O" name="Nueva Esparta"/> + <iso_3166_2_entry + code="VE-P" name="Portuguesa"/> + <iso_3166_2_entry + code="VE-R" name="Sucre"/> + <iso_3166_2_entry + code="VE-S" name="Táchira"/> + <iso_3166_2_entry + code="VE-T" name="Trujillo"/> + <iso_3166_2_entry + code="VE-X" name="Vargas"/> + <iso_3166_2_entry + code="VE-U" name="Yaracuy"/> + <iso_3166_2_entry + code="VE-V" name="Zulia"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Viet Nam --> + <iso_3166_country code="VN"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="VN-44" name="An Giang"/> + <iso_3166_2_entry + code="VN-43" name="Bà Rịa - Vũng Tàu"/> + <iso_3166_2_entry + code="VN-53" name="Bắc Kạn"/> + <iso_3166_2_entry + code="VN-54" name="Bắc Giang"/> + <iso_3166_2_entry + code="VN-55" name="Bạc Liêu"/> + <iso_3166_2_entry + code="VN-56" name="Bắc Ninh"/> + <iso_3166_2_entry + code="VN-50" name="Bến Tre"/> + <iso_3166_2_entry + code="VN-31" name="Bình Định"/> + <iso_3166_2_entry + code="VN-57" name="Bình Dương"/> + <iso_3166_2_entry + code="VN-58" name="Bình Phước"/> + <iso_3166_2_entry + code="VN-40" name="Bình Thuận"/> + <iso_3166_2_entry + code="VN-59" name="Cà Mau"/> + <iso_3166_2_entry + code="VN-48" name="Cần Thơ"/> + <iso_3166_2_entry + code="VN-04" name="Cao Bằng"/> + <iso_3166_2_entry + code="VN-60" name="Đà Nẵng, thành phố"/> + <iso_3166_2_entry + code="VN-33" name="Đắc Lắk"/> + <iso_3166_2_entry + code="VN-72" name="Đắk Nông"/> + <iso_3166_2_entry + code="VN-71" name="Điện Biên"/> + <iso_3166_2_entry + code="VN-39" name="Đồng Nai"/> + <iso_3166_2_entry + code="VN-45" name="Đồng Tháp"/> + <iso_3166_2_entry + code="VN-30" name="Gia Lai"/> + <iso_3166_2_entry + code="VN-03" name="Hà Giang"/> + <iso_3166_2_entry + code="VN-63" name="Hà Nam"/> + <iso_3166_2_entry + code="VN-64" name="Hà Nội, thủ đô"/> + <iso_3166_2_entry + code="VN-15" name="Hà Tây"/> + <iso_3166_2_entry + code="VN-23" name="Hà Tỉnh"/> + <iso_3166_2_entry + code="VN-61" name="Hải Duong"/> + <iso_3166_2_entry + code="VN-62" name="Hải Phòng, thành phố"/> + <iso_3166_2_entry + code="VN-73" name="Hậu Giang"/> + <iso_3166_2_entry + code="VN-14" name="Hoà Bình"/> + <iso_3166_2_entry + code="VN-65" name="Hồ Chí Minh, thành phố [Sài Gòn]"/> + <iso_3166_2_entry + code="VN-66" name="Hưng Yên"/> + <iso_3166_2_entry + code="VN-34" name="Khánh Hòa"/> + <iso_3166_2_entry + code="VN-47" name="Kiên Giang"/> + <iso_3166_2_entry + code="VN-28" name="Kon Tum"/> + <iso_3166_2_entry + code="VN-01" name="Lai Châu"/> + <iso_3166_2_entry + code="VN-35" name="Lâm Đồng"/> + <iso_3166_2_entry + code="VN-09" name="Lạng Sơn"/> + <iso_3166_2_entry + code="VN-02" name="Lào Cai"/> + <iso_3166_2_entry + code="VN-41" name="Long An"/> + <iso_3166_2_entry + code="VN-67" name="Nam Định"/> + <iso_3166_2_entry + code="VN-22" name="Nghệ An"/> + <iso_3166_2_entry + code="VN-18" name="Ninh Bình"/> + <iso_3166_2_entry + code="VN-36" name="Ninh Thuận"/> + <iso_3166_2_entry + code="VN-68" name="Phú Thọ"/> + <iso_3166_2_entry + code="VN-32" name="Phú Yên"/> + <iso_3166_2_entry + code="VN-24" name="Quảng Bình"/> + <iso_3166_2_entry + code="VN-27" name="Quảng Nam"/> + <iso_3166_2_entry + code="VN-29" name="Quảng Ngãi"/> + <iso_3166_2_entry + code="VN-13" name="Quảng Ninh"/> + <iso_3166_2_entry + code="VN-25" name="Quảng Trị"/> + <iso_3166_2_entry + code="VN-52" name="Sóc Trăng"/> + <iso_3166_2_entry + code="VN-05" name="Sơn La"/> + <iso_3166_2_entry + code="VN-37" name="Tây Ninh"/> + <iso_3166_2_entry + code="VN-20" name="Thái Bình"/> + <iso_3166_2_entry + code="VN-69" name="Thái Nguyên"/> + <iso_3166_2_entry + code="VN-21" name="Thanh Hóa"/> + <iso_3166_2_entry + code="VN-26" name="Thừa Thiên-Huế"/> + <iso_3166_2_entry + code="VN-46" name="Tiền Giang"/> + <iso_3166_2_entry + code="VN-51" name="Trà Vinh"/> + <iso_3166_2_entry + code="VN-07" name="Tuyên Quang"/> + <iso_3166_2_entry + code="VN-49" name="Vĩnh Long"/> + <iso_3166_2_entry + code="VN-70" name="Vĩnh Phúc"/> + <iso_3166_2_entry + code="VN-06" name="Yên Bái"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Vanuatu --> + <iso_3166_country code="VU"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="VU-MAP" name="Malampa"/> + <iso_3166_2_entry + code="VU-PAM" name="Pénama"/> + <iso_3166_2_entry + code="VU-SAM" name="Sanma"/> + <iso_3166_2_entry + code="VU-SEE" name="Shéfa"/> + <iso_3166_2_entry + code="VU-TAE" name="Taféa"/> + <iso_3166_2_entry + code="VU-TOB" name="Torba"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Samoa --> + <iso_3166_country code="WS"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="WS-AA" name="A'ana"/> + <iso_3166_2_entry + code="WS-AL" name="Aiga-i-le-Tai"/> + <iso_3166_2_entry + code="WS-AT" name="Atua"/> + <iso_3166_2_entry + code="WS-FA" name="Fa'asaleleaga"/> + <iso_3166_2_entry + code="WS-GE" name="Gaga'emauga"/> + <iso_3166_2_entry + code="WS-GI" name="Gagaifomauga"/> + <iso_3166_2_entry + code="WS-PA" name="Palauli"/> + <iso_3166_2_entry + code="WS-SA" name="Satupa'itea"/> + <iso_3166_2_entry + code="WS-TU" name="Tuamasaga"/> + <iso_3166_2_entry + code="WS-VF" name="Va'a-o-Fonoti"/> + <iso_3166_2_entry + code="WS-VS" name="Vaisigano"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Yemen --> + <iso_3166_country code="YE"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="YE-AB" name="Abyān"/> + <iso_3166_2_entry + code="YE-AD" name="'Adan"/> + <iso_3166_2_entry + code="YE-DA" name="Aḑ Ḑāli‘"/> + <iso_3166_2_entry + code="YE-BA" name="Al Bayḑā'"/> + <iso_3166_2_entry + code="YE-MU" name="Al Ḩudaydah"/> + <iso_3166_2_entry + code="YE-JA" name="Al Jawf"/> + <iso_3166_2_entry + code="YE-MR" name="Al Mahrah"/> + <iso_3166_2_entry + code="YE-MW" name="Al Maḩwīt"/> + <iso_3166_2_entry + code="YE-AM" name="'Amrān"/> + <iso_3166_2_entry + code="YE-DH" name="Dhamār"/> + <iso_3166_2_entry + code="YE-HD" name="Ḩaḑramawt"/> + <iso_3166_2_entry + code="YE-HJ" name="Ḩajjah"/> + <iso_3166_2_entry + code="YE-IB" name="Ibb"/> + <iso_3166_2_entry + code="YE-LA" name="Laḩij"/> + <iso_3166_2_entry + code="YE-MA" name="Ma'rib"/> + <iso_3166_2_entry + code="YE-RA" name="Raymah"/> + <iso_3166_2_entry + code="YE-SD" name="Şa'dah"/> + <iso_3166_2_entry + code="YE-SN" name="Şan'ā'"/> + <iso_3166_2_entry + code="YE-SH" name="Shabwah"/> + <iso_3166_2_entry + code="YE-TA" name="Tā'izz"/> + </iso_3166_subset> + </iso_3166_country> + <!-- South Africa --> + <iso_3166_country code="ZA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ZA-EC" name="Eastern Cape"/> + <iso_3166_2_entry + code="ZA-FS" name="Free State"/> + <iso_3166_2_entry + code="ZA-GT" name="Gauteng"/> + <iso_3166_2_entry + code="ZA-NL" name="Kwazulu-Natal"/> + <iso_3166_2_entry + code="ZA-LP" name="Limpopo"/> + <iso_3166_2_entry + code="ZA-MP" name="Mpumalanga"/> + <iso_3166_2_entry + code="ZA-NC" name="Northern Cape"/> + <iso_3166_2_entry + code="ZA-NW" name="North-West (South Africa)"/> + <iso_3166_2_entry + code="ZA-WC" name="Western Cape"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Zambia --> + <iso_3166_country code="ZM"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ZM-02" name="Central"/> + <iso_3166_2_entry + code="ZM-08" name="Copperbelt"/> + <iso_3166_2_entry + code="ZM-03" name="Eastern"/> + <iso_3166_2_entry + code="ZM-04" name="Luapula"/> + <iso_3166_2_entry + code="ZM-09" name="Lusaka"/> + <iso_3166_2_entry + code="ZM-05" name="Northern"/> + <iso_3166_2_entry + code="ZM-06" name="North-Western"/> + <iso_3166_2_entry + code="ZM-07" name="Southern (Zambia)"/> + <iso_3166_2_entry + code="ZM-01" name="Western"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Zimbabwe --> + <iso_3166_country code="ZW"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="ZW-BU" name="Bulawayo"/> + <iso_3166_2_entry + code="ZW-HA" name="Harare"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ZW-MA" name="Manicaland"/> + <iso_3166_2_entry + code="ZW-MC" name="Mashonaland Central"/> + <iso_3166_2_entry + code="ZW-ME" name="Mashonaland East"/> + <iso_3166_2_entry + code="ZW-MW" name="Mashonaland West"/> + <iso_3166_2_entry + code="ZW-MV" name="Masvingo"/> + <iso_3166_2_entry + code="ZW-MN" name="Matabeleland North"/> + <iso_3166_2_entry + code="ZW-MS" name="Matabeleland South"/> + <iso_3166_2_entry + code="ZW-MI" name="Midlands"/> + </iso_3166_subset> + </iso_3166_country> </iso_3166_2_entries> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml index 0acf58880..aaf03602a 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml @@ -8,44 +8,44 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutAuthorView"> - <children> - <HBox spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <children> - <ImageView fitHeight="200.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true" - HBox.hgrow="ALWAYS"> - <image> - <Image url="@profile_manuel.png"/> - </image> - </ImageView> - <VBox alignment="CENTER" layoutX="184.0" layoutY="50.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <Label text="Manuel Mauky"> - <font> - <Font size="24.0"/> - </font> - </Label> - <Hyperlink onAction="#openBlog" text="www.lestard.eu"> - <font> - <Font size="14.0"/> - </font> - </Hyperlink> - <Hyperlink onAction="#openTwitter" text="\@manuel_mauky"> - <font> - <Font size="14.0"/> - </font> - </Hyperlink> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> - </padding> - </VBox> - </children> - <padding> - <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> - </padding> - </HBox> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutAuthorView"> + <children> + <HBox spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <children> + <ImageView fitHeight="200.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true" + HBox.hgrow="ALWAYS"> + <image> + <Image url="@profile_manuel.png"/> + </image> + </ImageView> + <VBox alignment="CENTER" layoutX="184.0" layoutY="50.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <Label text="Manuel Mauky"> + <font> + <Font size="24.0"/> + </font> + </Label> + <Hyperlink onAction="#openBlog" text="www.lestard.eu"> + <font> + <Font size="14.0"/> + </font> + </Hyperlink> + <Hyperlink onAction="#openTwitter" text="\@manuel_mauky"> + <font> + <Font size="14.0"/> + </font> + </Hyperlink> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + </padding> + </VBox> + </children> + <padding> + <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> + </padding> + </HBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml index be8bca1f9..4cd7bd6d4 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml @@ -9,37 +9,37 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutView"> - <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <HBox> - <children> - <Text fill="DIMGREY" strokeType="OUTSIDE" strokeWidth="0.0" text="%about.title"> - <font> - <Font size="24.0" /> - </font> - </Text> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> - </padding> - </HBox> - <Separator /> - <VBox spacing="10.0" style="-fx-background-color: white;" VBox.vgrow="ALWAYS"> - <children> - <Label maxHeight="-Infinity" maxWidth="-Infinity" text="%about.description" wrapText="true" VBox.vgrow="ALWAYS" /> - <Label text="%about.libraries.label" /> - <HyperlinkLabel fx:id="librariesLabel" /> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> - </padding> - <VBox.margin> - <Insets /> - </VBox.margin> - </VBox> - <Hyperlink onAction="#openAuthorPage" text="About the Author" /> - </children> - </VBox> - </children> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <HBox> + <children> + <Text fill="DIMGREY" strokeType="OUTSIDE" strokeWidth="0.0" text="%about.title"> + <font> + <Font size="24.0" /> + </font> + </Text> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> + </padding> + </HBox> + <Separator /> + <VBox spacing="10.0" style="-fx-background-color: white;" VBox.vgrow="ALWAYS"> + <children> + <Label maxHeight="-Infinity" maxWidth="-Infinity" text="%about.description" wrapText="true" VBox.vgrow="ALWAYS" /> + <Label text="%about.libraries.label" /> + <HyperlinkLabel fx:id="librariesLabel" /> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> + </padding> + <VBox.margin> + <Insets /> + </VBox.margin> + </VBox> + <Hyperlink onAction="#openAuthorPage" text="About the Author" /> + </children> + </VBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml index c29c29710..5b1eff064 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml @@ -2,9 +2,9 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialogView"> - <children> - <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0" fx:id="contactDialogView" - source="../contactdialog/ContactDialogView.fxml"/> - </children> + <children> + <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0" fx:id="contactDialogView" + source="../contactdialog/ContactDialogView.fxml"/> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml index 8e395b903..60d71fc10 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml @@ -16,45 +16,45 @@ <?import javafx.scene.layout.VBox?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormView"> - <children> - <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" - style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> - </columnConstraints> - <rowConstraints> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - </rowConstraints> - <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> - </padding> - <VBox.margin> - <Insets/> - </VBox.margin> - <children> - <Label text="%addressform.street.label"/> - <Label text="%addressform.postalcode.label" GridPane.rowIndex="1"/> - <Label text="%addressform.city.label" GridPane.rowIndex="2"/> - <TextField fx:id="streetInput" promptText="%addressform.street.prompt" GridPane.columnIndex="1"/> - <TextField fx:id="postalcodeInput" promptText="%addressform.postalcode.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="1"/> - <TextField fx:id="cityInput" promptText="%addressform.city.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="2"/> - <Label fx:id="countryLabel" text="%addressform.country.label" GridPane.rowIndex="3"/> - <Label fx:id="subdivisionLabel" text="%addressform.subdivision.label" GridPane.rowIndex="4"/> - <ComboBox fx:id="federalStateInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="4"/> - <ComboBox fx:id="countryInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/> - <ProgressIndicator fx:id="loadingIndicator" GridPane.columnIndex="2" GridPane.rowIndex="3"/> - </children> - </GridPane> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormView"> + <children> + <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" + style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <columnConstraints> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> + </columnConstraints> + <rowConstraints> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + </rowConstraints> + <padding> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> + </padding> + <VBox.margin> + <Insets/> + </VBox.margin> + <children> + <Label text="%addressform.street.label"/> + <Label text="%addressform.postalcode.label" GridPane.rowIndex="1"/> + <Label text="%addressform.city.label" GridPane.rowIndex="2"/> + <TextField fx:id="streetInput" promptText="%addressform.street.prompt" GridPane.columnIndex="1"/> + <TextField fx:id="postalcodeInput" promptText="%addressform.postalcode.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="1"/> + <TextField fx:id="cityInput" promptText="%addressform.city.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="2"/> + <Label fx:id="countryLabel" text="%addressform.country.label" GridPane.rowIndex="3"/> + <Label fx:id="subdivisionLabel" text="%addressform.subdivision.label" GridPane.rowIndex="4"/> + <ComboBox fx:id="federalStateInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="4"/> + <ComboBox fx:id="countryInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/> + <ProgressIndicator fx:id="loadingIndicator" GridPane.columnIndex="2" GridPane.rowIndex="3"/> + </children> + </GridPane> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml index dab916677..6573bf30a 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml @@ -15,46 +15,46 @@ <?import javafx.scene.text.Text?> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView"> - <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <children> - <HBox> - <children> - <Text fx:id="titleText" fill="dimgray" strokeType="OUTSIDE" strokeWidth="0.0" - text="contact dialog"> - <font> - <Font size="24.0"/> - </font> - <HBox.margin> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </HBox.margin> - </Text> - </children> - </HBox> - <Separator/> - <Pagination fx:id="formPagination" maxPageIndicatorCount="2" pageCount="2" - style="-fx-background-color: white;" VBox.vgrow="ALWAYS"/> - <Separator/> - <HBox alignment="CENTER_RIGHT" spacing="5.0"> - <children> - <Button id="previousButton" fx:id="previousButton" mnemonicParsing="false" onAction="#previous" - text="%common.previous"/> - <Button id="nextButton" fx:id="nextButton" defaultButton="true" mnemonicParsing="false" - onAction="#next" text="%common.next"/> - <Button id="okButton" fx:id="okButton" defaultButton="true" mnemonicParsing="false" - onAction="#ok" prefWidth="80.0" text="%common.ok"> - <HBox.margin> - <Insets/> - </HBox.margin> - </Button> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </padding> - </HBox> - </children> - </VBox> - </children> + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView"> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <children> + <HBox> + <children> + <Text fx:id="titleText" fill="dimgray" strokeType="OUTSIDE" strokeWidth="0.0" + text="contact dialog"> + <font> + <Font size="24.0"/> + </font> + <HBox.margin> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </HBox.margin> + </Text> + </children> + </HBox> + <Separator/> + <Pagination fx:id="formPagination" maxPageIndicatorCount="2" pageCount="2" + style="-fx-background-color: white;" VBox.vgrow="ALWAYS"/> + <Separator/> + <HBox alignment="CENTER_RIGHT" spacing="5.0"> + <children> + <Button id="previousButton" fx:id="previousButton" mnemonicParsing="false" onAction="#previous" + text="%common.previous"/> + <Button id="nextButton" fx:id="nextButton" defaultButton="true" mnemonicParsing="false" + onAction="#next" text="%common.next"/> + <Button id="okButton" fx:id="okButton" defaultButton="true" mnemonicParsing="false" + onAction="#ok" prefWidth="80.0" text="%common.ok"> + <HBox.margin> + <Insets/> + </HBox.margin> + </Button> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </padding> + </HBox> + </children> + </VBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml index 6febba9c8..1b131e31e 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml @@ -16,65 +16,65 @@ <?import javafx.scene.layout.VBox?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormView"> - <children> - <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" - style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - </columnConstraints> - <rowConstraints> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - </rowConstraints> - <children> - <Label text="%contactform.firstname.label" GridPane.halignment="RIGHT"/> - <Label text="%contactform.lastname.label" GridPane.halignment="RIGHT" GridPane.rowIndex="1"/> - <Label text="%contactform.title.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT"/> - <Label text="%contactform.role.label" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/> - <Label text="%contactform.department.label" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/> - <Label text="%contactform.email.label" GridPane.halignment="RIGHT" GridPane.rowIndex="5"/> - <Label text="%contactform.phonenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" - GridPane.rowIndex="6"/> - <Label text="%contactform.mobilenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" - GridPane.rowIndex="5"/> - <Separator GridPane.columnSpan="4" GridPane.rowIndex="4"/> - <Label text="%contactform.birthday.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" - GridPane.rowIndex="1"/> - <TextField id="firstnameInput" fx:id="firstnameInput" promptText="%contactform.firstname.prompt" - GridPane.columnIndex="1"/> - <TextField fx:id="titleInput" promptText="%contactform.title.prompt" GridPane.columnIndex="3"/> - <TextField id="lastnameInput" fx:id="lastnameInput" promptText="%contactform.lastname.prompt" - GridPane.columnIndex="1" GridPane.rowIndex="1"/> - <TextField fx:id="roleInput" promptText="%contactform.role.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="2"/> - <TextField fx:id="departmentInput" promptText="%contactform.department.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="3"/> - <TextField id="emailInput" fx:id="emailInput" promptText="%contactform.email.prompt" - GridPane.columnIndex="1" GridPane.rowIndex="5"/> - <TextField fx:id="mobileNumberInput" promptText="%contactform.mobilenumber.prompt" - GridPane.columnIndex="3" GridPane.rowIndex="5"/> - <TextField fx:id="phoneNumberInput" promptText="%contactform.phonenumber.prompt" - GridPane.columnIndex="3" GridPane.rowIndex="6"/> - <DatePicker fx:id="birthdayInput" promptText="%contactform.birthday.prompt" GridPane.columnIndex="3" - GridPane.rowIndex="1"/> - </children> - <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> - </padding> - <VBox.margin> - <Insets/> - </VBox.margin> - </GridPane> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormView"> + <children> + <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" + style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <columnConstraints> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + </columnConstraints> + <rowConstraints> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + </rowConstraints> + <children> + <Label text="%contactform.firstname.label" GridPane.halignment="RIGHT"/> + <Label text="%contactform.lastname.label" GridPane.halignment="RIGHT" GridPane.rowIndex="1"/> + <Label text="%contactform.title.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT"/> + <Label text="%contactform.role.label" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/> + <Label text="%contactform.department.label" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/> + <Label text="%contactform.email.label" GridPane.halignment="RIGHT" GridPane.rowIndex="5"/> + <Label text="%contactform.phonenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" + GridPane.rowIndex="6"/> + <Label text="%contactform.mobilenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" + GridPane.rowIndex="5"/> + <Separator GridPane.columnSpan="4" GridPane.rowIndex="4"/> + <Label text="%contactform.birthday.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" + GridPane.rowIndex="1"/> + <TextField id="firstnameInput" fx:id="firstnameInput" promptText="%contactform.firstname.prompt" + GridPane.columnIndex="1"/> + <TextField fx:id="titleInput" promptText="%contactform.title.prompt" GridPane.columnIndex="3"/> + <TextField id="lastnameInput" fx:id="lastnameInput" promptText="%contactform.lastname.prompt" + GridPane.columnIndex="1" GridPane.rowIndex="1"/> + <TextField fx:id="roleInput" promptText="%contactform.role.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="2"/> + <TextField fx:id="departmentInput" promptText="%contactform.department.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="3"/> + <TextField id="emailInput" fx:id="emailInput" promptText="%contactform.email.prompt" + GridPane.columnIndex="1" GridPane.rowIndex="5"/> + <TextField fx:id="mobileNumberInput" promptText="%contactform.mobilenumber.prompt" + GridPane.columnIndex="3" GridPane.rowIndex="5"/> + <TextField fx:id="phoneNumberInput" promptText="%contactform.phonenumber.prompt" + GridPane.columnIndex="3" GridPane.rowIndex="6"/> + <DatePicker fx:id="birthdayInput" promptText="%contactform.birthday.prompt" GridPane.columnIndex="3" + GridPane.rowIndex="1"/> + </children> + <padding> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> + </padding> + <VBox.margin> + <Insets/> + </VBox.margin> + </GridPane> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml index efa0c16c1..7756b9e97 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml @@ -14,37 +14,37 @@ <?import javafx.scene.layout.VBox?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="50.0" minWidth="100.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.detail.DetailView"> - <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <VBox maxHeight="1.7976931348623157E308" spacing="3.0" VBox.vgrow="ALWAYS"> - <children> - <Label fx:id="nameLabel" style="-fx-text-fill: dimgrey; -fx-font-size: 20;" text="name" /> - <Label fx:id="birthdayLabel" text="birthday" /> - <Label fx:id="roleDepartmentLabel" text="role/department" /> - <Hyperlink fx:id="emailHyperlink" onAction="#mailAction" text="email address" /> - <Label fx:id="phoneLabel" text="phone number" /> - <Label fx:id="mobileLabel" text="mobile number" /> - <Separator prefWidth="200.0" /> - <Label fx:id="streetLabel" text="street" /> - <Label fx:id="cityPostalCodeLabel" text="city (postalcode)" /> - <Label fx:id="countrySubdivisionLabel" text="country / subdivision" /> - </children> - <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0" /> - </padding> - </VBox> - <Separator /> - <HBox alignment="CENTER" spacing="5.0"> - <children> - <Button fx:id="editButton" mnemonicParsing="false" onAction="#editAction" text="%common.edit" /> - <Button fx:id="removeButton" mnemonicParsing="false" onAction="#removeAction" text="%common.remove" /> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> - </padding> - </HBox> - </children> - </VBox> - </children> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <VBox maxHeight="1.7976931348623157E308" spacing="3.0" VBox.vgrow="ALWAYS"> + <children> + <Label fx:id="nameLabel" style="-fx-text-fill: dimgrey; -fx-font-size: 20;" text="name" /> + <Label fx:id="birthdayLabel" text="birthday" /> + <Label fx:id="roleDepartmentLabel" text="role/department" /> + <Hyperlink fx:id="emailHyperlink" onAction="#mailAction" text="email address" /> + <Label fx:id="phoneLabel" text="phone number" /> + <Label fx:id="mobileLabel" text="mobile number" /> + <Separator prefWidth="200.0" /> + <Label fx:id="streetLabel" text="street" /> + <Label fx:id="cityPostalCodeLabel" text="city (postalcode)" /> + <Label fx:id="countrySubdivisionLabel" text="country / subdivision" /> + </children> + <padding> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0" /> + </padding> + </VBox> + <Separator /> + <HBox alignment="CENTER" spacing="5.0"> + <children> + <Button fx:id="editButton" mnemonicParsing="false" onAction="#editAction" text="%common.edit" /> + <Button fx:id="removeButton" mnemonicParsing="false" onAction="#removeAction" text="%common.remove" /> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> + </padding> + </HBox> + </children> + </VBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml index 5e105a527..56d76a332 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml @@ -2,9 +2,9 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogView"> - <children> - <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0" fx:id="contactDialogView" - source="../contactdialog/ContactDialogView.fxml"/> - </children> + <children> + <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0" fx:id="contactDialogView" + source="../contactdialog/ContactDialogView.fxml"/> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml index f0edc11a7..ad71b78e2 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml @@ -5,27 +5,27 @@ <?import javafx.scene.layout.*?> <VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.main.MainView"> - <children> - <fx:include source="../menu/MenuView.fxml" resources="menu"/> - <fx:include source="../toolbar/ToolbarView.fxml"/> - <SplitPane dividerPositions="0.7" VBox.vgrow="ALWAYS"> - <items> - <AnchorPane> - <children> - <fx:include source="../master/MasterView.fxml" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"/> - </children> - </AnchorPane> - <AnchorPane> - <children> - <fx:include source="../detail/DetailView.fxml" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"/> - </children> - </AnchorPane> - </items> - </SplitPane> - </children> + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.main.MainView"> + <children> + <fx:include source="../menu/MenuView.fxml" resources="menu"/> + <fx:include source="../toolbar/ToolbarView.fxml"/> + <SplitPane dividerPositions="0.7" VBox.vgrow="ALWAYS"> + <items> + <AnchorPane> + <children> + <fx:include source="../master/MasterView.fxml" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"/> + </children> + </AnchorPane> + <AnchorPane> + <children> + <fx:include source="../detail/DetailView.fxml" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"/> + </children> + </AnchorPane> + </items> + </SplitPane> + </children> </VBox> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml index 9a50cbac7..849d9dd01 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml @@ -10,50 +10,50 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane minHeight="50.0" minWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.master.MasterView"> - <children> - <TableView id="masterContactTable" fx:id="contactTable" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <columns> - <TableColumn prefWidth="75.0" text="%master.table.firstname"> - <cellValueFactory> - <PropertyValueFactory property="firstname"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.lastname"> - <cellValueFactory> - <PropertyValueFactory property="lastname"/> - </cellValueFactory> - </TableColumn> - <TableColumn text="%master.table.email"> - <cellValueFactory> - <PropertyValueFactory property="emailAddress"/> - </cellValueFactory> - </TableColumn> - <TableColumn text="%master.table.age"> - <cellValueFactory> - <PropertyValueFactory property="age"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.city"> - <cellValueFactory> - <PropertyValueFactory property="city"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.postalcode"> - <cellValueFactory> - <PropertyValueFactory property="postalCode"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.street"> - <cellValueFactory> - <PropertyValueFactory property="street"/> - </cellValueFactory> - </TableColumn> - </columns> - <columnResizePolicy> - <TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/> - </columnResizePolicy> - </TableView> - </children> + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.master.MasterView"> + <children> + <TableView id="masterContactTable" fx:id="contactTable" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <columns> + <TableColumn prefWidth="75.0" text="%master.table.firstname"> + <cellValueFactory> + <PropertyValueFactory property="firstname"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.lastname"> + <cellValueFactory> + <PropertyValueFactory property="lastname"/> + </cellValueFactory> + </TableColumn> + <TableColumn text="%master.table.email"> + <cellValueFactory> + <PropertyValueFactory property="emailAddress"/> + </cellValueFactory> + </TableColumn> + <TableColumn text="%master.table.age"> + <cellValueFactory> + <PropertyValueFactory property="age"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.city"> + <cellValueFactory> + <PropertyValueFactory property="city"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.postalcode"> + <cellValueFactory> + <PropertyValueFactory property="postalCode"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.street"> + <cellValueFactory> + <PropertyValueFactory property="street"/> + </cellValueFactory> + </TableColumn> + </columns> + <columnResizePolicy> + <TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/> + </columnResizePolicy> + </TableView> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml index abab1b1ba..2e77c1b52 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml @@ -5,29 +5,29 @@ <?import javafx.scene.control.*?> <AnchorPane maxHeight="-Infinity" maxWidth="+Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.menu.MenuView"> - <children> - <MenuBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <menus> - <Menu mnemonicParsing="false" text="%menu.file"> - <items> - <MenuItem mnemonicParsing="false" onAction="#close" text="%menu.file.close"/> - </items> - </Menu> - <Menu mnemonicParsing="false" text="%menu.edit"> - <items> - <MenuItem fx:id="removeMenuItem" mnemonicParsing="false" onAction="#remove" - text="%menu.edit.removecontact"/> - </items> - </Menu> - <Menu mnemonicParsing="false" text="%menu.help"> - <items> - <MenuItem mnemonicParsing="false" onAction="#about" text="%menu.help.about"/> - </items> - </Menu> - </menus> - </MenuBar> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.menu.MenuView"> + <children> + <MenuBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <menus> + <Menu mnemonicParsing="false" text="%menu.file"> + <items> + <MenuItem mnemonicParsing="false" onAction="#close" text="%menu.file.close"/> + </items> + </Menu> + <Menu mnemonicParsing="false" text="%menu.edit"> + <items> + <MenuItem fx:id="removeMenuItem" mnemonicParsing="false" onAction="#remove" + text="%menu.edit.removecontact"/> + </items> + </Menu> + <Menu mnemonicParsing="false" text="%menu.help"> + <items> + <MenuItem mnemonicParsing="false" onAction="#about" text="%menu.help.about"/> + </items> + </Menu> + </menus> + </MenuBar> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml index 0cf2a805c..c610202b5 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml @@ -8,15 +8,15 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane maxHeight="-Infinity" maxWidth="+Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.toolbar.ToolbarView"> - <children> - <ToolBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <items> - <Button id="addNewContactButton" fx:id="addNewContactButton" mnemonicParsing="false" - onAction="#addNewContact" text="%toolbar.addcontactbutton"/> - </items> - </ToolBar> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.toolbar.ToolbarView"> + <children> + <ToolBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <items> + <Button id="addNewContactButton" fx:id="addNewContactButton" mnemonicParsing="false" + onAction="#addNewContact" text="%toolbar.addcontactbutton"/> + </items> + </ToolBar> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/logback.xml b/examples/contacts-example/src/main/resources/logback.xml index 94d11e01b..49a3cf906 100644 --- a/examples/contacts-example/src/main/resources/logback.xml +++ b/examples/contacts-example/src/main/resources/logback.xml @@ -1,24 +1,23 @@ <configuration> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> - </encoder> - </appender> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> + <logger name="org.jboss.weld" level="INFO"/> - <logger name="org.jboss.weld" level="INFO"/> + <!-- log level for the mvvmfx framework--> + <logger name="de.saxsys.mvvmfx" level="INFO"/> - <!-- log level for the mvvmfx framework--> - <logger name="de.saxsys.mvvmfx" level="INFO"/> + <!-- log level for our application --> + <logger name="de.saxsys.mvvmfx.contacts" level="DEBUG"/> - <!-- log level for our application --> - <logger name="de.saxsys.mvvmfx.contacts" level="DEBUG"/> - - <!-- Strictly speaking, the level attribute is not necessary since --> - <!-- the level of the root level is set to DEBUG by default. --> - <root level="DEBUG"> - <appender-ref ref="STDOUT"/> - </root> + <!-- Strictly speaking, the level attribute is not necessary since --> + <!-- the level of the root level is set to DEBUG by default. --> + <root level="DEBUG"> + <appender-ref ref="STDOUT"/> + </root> </configuration> \ No newline at end of file diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java index 9ae81afe6..51db84123 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java @@ -12,36 +12,35 @@ @Ignore public class AppTestFxIT extends FxRobot { - - @Before - public void setupApp() throws Exception { - - FxToolkit.registerPrimaryStage(); - - FxToolkit.setupApplication(App.class); - } - - @Test - public void testAddNewContact() { - - clickOn("#addNewContactButton"); - - clickOn("#firstnameInput"); - write("luke"); - - clickOn("#lastnameInput"); - write("skywalker"); - - clickOn("#emailInput"); - write("luke.skywalker@example.org"); - - clickOn("#nextButton"); - - - clickOn("#okButton"); - - verifyThat("#masterContactTable", hasTableCell("luke")); - verifyThat("#masterContactTable", hasTableCell("skywalker")); - verifyThat("#masterContactTable", hasTableCell("luke.skywalker@example.org")); - } + + @Before + public void setupApp() throws Exception { + + FxToolkit.registerPrimaryStage(); + + FxToolkit.setupApplication(App.class); + } + + @Test + public void testAddNewContact() { + + clickOn("#addNewContactButton"); + + clickOn("#firstnameInput"); + write("luke"); + + clickOn("#lastnameInput"); + write("skywalker"); + + clickOn("#emailInput"); + write("luke.skywalker@example.org"); + + clickOn("#nextButton"); + + clickOn("#okButton"); + + verifyThat("#masterContactTable", hasTableCell("luke")); + verifyThat("#masterContactTable", hasTableCell("skywalker")); + verifyThat("#masterContactTable", hasTableCell("luke.skywalker@example.org")); + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java index fdcf2ea8e..a8048b99b 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java @@ -21,150 +21,141 @@ @RunWith(JfxRunner.class) public class CountrySelectorIntegrationTest { - - private CountrySelector countrySelector; - - - @Before - public void setup() { - countrySelector = new CountrySelector(); - } - - @Test - public void testXmlConverterForCountry() throws FileNotFoundException { - XmlConverter<Country> converter = new XmlConverter<>("iso_3166_entry", Country.class); - - String iso_3166_xml = this.getClass().getResource("/countries/iso_3166.xml").getFile(); - - assertThat(iso_3166_xml).isNotNull(); - - converter.initialize(new FileInputStream(iso_3166_xml)); - - Country country = converter.get(); - assertThat(country).isNotNull(); - } - - @Test - public void testXmlConverterForSubdivision() throws Exception { - XmlConverter<CountrySelector.ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", - CountrySelector.ISO3166_2_CountryEntity.class); - - String iso_3166_2_xml = this.getClass().getResource("/countries/iso_3166_2.xml").getFile(); - - assertThat(iso_3166_2_xml).isNotNull(); - - converter.initialize(new FileInputStream(iso_3166_2_xml)); - - CountrySelector.ISO3166_2_CountryEntity entity = converter.get(); - - assertThat(entity).isNotNull(); - assertThat(entity.code).isNotNull().isEqualTo("DE"); - - assertThat(entity.subsets).isNotNull().hasSize(1); - assertThat(entity.subsets.get(0).subdivisionType).isEqualTo("State"); - - List<CountrySelector.ISO3166_2_EntryEntity> entryList = entity.subsets.get(0).entryList; - - assertThat(entryList).isNotNull().hasSize(16); - - CountrySelector.ISO3166_2_EntryEntity entry = entryList.get(0); - - assertThat(entry.code).isEqualTo("DE-BW"); - assertThat(entry.name).isEqualTo("Baden-Württemberg"); - } - - - - @Test - public void testLoadSubdivisions() throws Exception { - runBlocked(countrySelector::init); - - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - assertThat(countrySelector.subdivisions()).isEmpty(); - - countrySelector.setCountry(new Country("Germany", "DE")); - - assertThat(countrySelector.subdivisionLabel()).hasValue("State"); - assertThat(countrySelector.subdivisions()).hasSize(16); - - countrySelector.setCountry(null); - - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - assertThat(countrySelector.subdivisions()).isEmpty(); - - } - - - @Test - public void testLoadCountries() throws InterruptedException, ExecutionException, TimeoutException { - runBlocked(countrySelector::init); - - assertThat(countrySelector.availableCountries()).hasSize(3); - assertThat(getCountryNames(countrySelector.availableCountries())).contains("Germany", "Austria", "Switzerland"); - - assertThat(countrySelector.subdivisions()).isEmpty(); - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - - - Country germany = getCountryByName(countrySelector.availableCountries(), "Germany"); - - assertThat(germany).isNotNull(); - - countrySelector.setCountry(germany); - - assertThat(countrySelector.subdivisions()).hasSize(16); - assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Sachsen", "Bayern", "Hessen"); // only - // test - // some - // examples. - assertThat(countrySelector.subdivisionLabel()).hasValue("State"); - - - Country switzerland = getCountryByName(countrySelector.availableCountries(), "Switzerland"); - - countrySelector.setCountry(switzerland); - - assertThat(countrySelector.subdivisions()).hasSize(26); - assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Zürich", "Jura", "Bern"); - assertThat(countrySelector.subdivisionLabel()).hasValue("Canton"); - - - countrySelector.setCountry(null); - - assertThat(countrySelector.subdivisions()).isEmpty(); - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - } - - - private void runBlocked(Runnable function) { - CompletableFuture<Boolean> blocker = new CompletableFuture<>(); - - countrySelector.inProgressProperty().addListener((obs, oldV, newV) -> { - if (!newV) { - blocker.complete(true); - } - }); - - Platform.runLater(function); - - try { - blocker.get(5, TimeUnit.SECONDS); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - private Country getCountryByName(List<Country> countries, String name) { - return countries.stream().filter(country -> country.getName().equals(name)).findFirst().orElse(null); - } - - - private List<String> getSubdivisionNames(List<Subdivision> subdivisions) { - return subdivisions.stream().map(Subdivision::getName).collect(Collectors.toList()); - } - - private List<String> getCountryNames(List<Country> countries) { - return countries.stream().map(Country::getName).collect(Collectors.toList()); - } + + private CountrySelector countrySelector; + + @Before + public void setup() { + countrySelector = new CountrySelector(); + } + + @Test + public void testXmlConverterForCountry() throws FileNotFoundException { + XmlConverter<Country> converter = new XmlConverter<>("iso_3166_entry", Country.class); + + String iso_3166_xml = this.getClass().getResource("/countries/iso_3166.xml").getFile(); + + assertThat(iso_3166_xml).isNotNull(); + + converter.initialize(new FileInputStream(iso_3166_xml)); + + Country country = converter.get(); + assertThat(country).isNotNull(); + } + + @Test + public void testXmlConverterForSubdivision() throws Exception { + XmlConverter<CountrySelector.ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", + CountrySelector.ISO3166_2_CountryEntity.class); + + String iso_3166_2_xml = this.getClass().getResource("/countries/iso_3166_2.xml").getFile(); + + assertThat(iso_3166_2_xml).isNotNull(); + + converter.initialize(new FileInputStream(iso_3166_2_xml)); + + CountrySelector.ISO3166_2_CountryEntity entity = converter.get(); + + assertThat(entity).isNotNull(); + assertThat(entity.code).isNotNull().isEqualTo("DE"); + + assertThat(entity.subsets).isNotNull().hasSize(1); + assertThat(entity.subsets.get(0).subdivisionType).isEqualTo("State"); + + List<CountrySelector.ISO3166_2_EntryEntity> entryList = entity.subsets.get(0).entryList; + + assertThat(entryList).isNotNull().hasSize(16); + + CountrySelector.ISO3166_2_EntryEntity entry = entryList.get(0); + + assertThat(entry.code).isEqualTo("DE-BW"); + assertThat(entry.name).isEqualTo("Baden-Württemberg"); + } + + @Test + public void testLoadSubdivisions() throws Exception { + runBlocked(countrySelector::init); + + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + assertThat(countrySelector.subdivisions()).isEmpty(); + + countrySelector.setCountry(new Country("Germany", "DE")); + + assertThat(countrySelector.subdivisionLabel()).hasValue("State"); + assertThat(countrySelector.subdivisions()).hasSize(16); + + countrySelector.setCountry(null); + + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + assertThat(countrySelector.subdivisions()).isEmpty(); + + } + + @Test + public void testLoadCountries() throws InterruptedException, ExecutionException, TimeoutException { + runBlocked(countrySelector::init); + + assertThat(countrySelector.availableCountries()).hasSize(3); + assertThat(getCountryNames(countrySelector.availableCountries())).contains("Germany", "Austria", "Switzerland"); + + assertThat(countrySelector.subdivisions()).isEmpty(); + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + + Country germany = getCountryByName(countrySelector.availableCountries(), "Germany"); + + assertThat(germany).isNotNull(); + + countrySelector.setCountry(germany); + + assertThat(countrySelector.subdivisions()).hasSize(16); + assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Sachsen", "Bayern", "Hessen"); // only + // test + // some + // examples. + assertThat(countrySelector.subdivisionLabel()).hasValue("State"); + + Country switzerland = getCountryByName(countrySelector.availableCountries(), "Switzerland"); + + countrySelector.setCountry(switzerland); + + assertThat(countrySelector.subdivisions()).hasSize(26); + assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Zürich", "Jura", "Bern"); + assertThat(countrySelector.subdivisionLabel()).hasValue("Canton"); + + countrySelector.setCountry(null); + + assertThat(countrySelector.subdivisions()).isEmpty(); + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + } + + private void runBlocked(Runnable function) { + CompletableFuture<Boolean> blocker = new CompletableFuture<>(); + + countrySelector.inProgressProperty().addListener((obs, oldV, newV) -> { + if (!newV) { + blocker.complete(true); + } + }); + + Platform.runLater(function); + + try { + blocker.get(5, TimeUnit.SECONDS); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private Country getCountryByName(List<Country> countries, String name) { + return countries.stream().filter(country -> country.getName().equals(name)).findFirst().orElse(null); + } + + private List<String> getSubdivisionNames(List<Subdivision> subdivisions) { + return subdivisions.stream().map(Subdivision::getName).collect(Collectors.toList()); + } + + private List<String> getCountryNames(List<Country> countries) { + return countries.stream().map(Country::getName).collect(Collectors.toList()); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java index b3aa05d54..85e87e5d2 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java @@ -19,45 +19,43 @@ import de.saxsys.mvvmfx.examples.contacts.util.CentralClock; import de.saxsys.mvvmfx.utils.validation.ValidationStatus; - public class BirthdayValidatorTest { - - private ValidationStatus result; - private ObjectProperty<LocalDate> value = new SimpleObjectProperty<>(); - - - @Before - public void setup() { - ZonedDateTime now = ZonedDateTime - .of(LocalDate.of(2014, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); - - CentralClock.setFixedClock(now); - - Validator validator = new BirthdayValidator(value); - - result = validator.getValidationStatus(); - } - - - @Test - public void testBirthdayInThePast() { - LocalDate now = LocalDate.now(CentralClock.getClock()); - LocalDate birthday = now.minusYears(20); - - value.set(birthday); - - assertThat(result.isValid()).isTrue(); - } - - @Test - public void testBirthdayInTheFuture() { - - LocalDate now = LocalDate.now(CentralClock.getClock()); - - LocalDate birthday = now.plusDays(1); - - value.set(birthday); - assertThat(result.isValid()).isFalse(); - assertThat(result.getErrorMessages()).hasSize(1); - } + + private ValidationStatus result; + private ObjectProperty<LocalDate> value = new SimpleObjectProperty<>(); + + @Before + public void setup() { + ZonedDateTime now = ZonedDateTime + .of(LocalDate.of(2014, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); + + CentralClock.setFixedClock(now); + + Validator validator = new BirthdayValidator(value); + + result = validator.getValidationStatus(); + } + + @Test + public void testBirthdayInThePast() { + LocalDate now = LocalDate.now(CentralClock.getClock()); + LocalDate birthday = now.minusYears(20); + + value.set(birthday); + + assertThat(result.isValid()).isTrue(); + } + + @Test + public void testBirthdayInTheFuture() { + + LocalDate now = LocalDate.now(CentralClock.getClock()); + + LocalDate birthday = now.plusDays(1); + + value.set(birthday); + assertThat(result.isValid()).isFalse(); + assertThat(result.getErrorMessages()).hasSize(1); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java index dd46ee059..a1e1fba5d 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java @@ -13,38 +13,35 @@ import de.saxsys.mvvmfx.utils.validation.ValidationStatus; public class EmailAddressValidatorTest { - - private ValidationStatus result; - private StringProperty value = new SimpleStringProperty(); - - - @Before - public void setup() { - Validator validator = new EmailValidator(value); - - result = validator.getValidationStatus(); - } - - @Test - public void testValidationOfEmail() { - assertThat(result.isValid()).isFalse(); - - - value.set("darthvader@imperium.org"); - assertThat(result.isValid()).isTrue(); - - - value.set("darthvader.imperium.org"); // wrong email format - assertThat(result.isValid()).isFalse(); - - - value.set(null); - assertThat(result.isValid()).isFalse(); - - value.set(""); - assertThat(result.isValid()).isFalse(); - - value.set(" "); - assertThat(result.isValid()).isFalse(); - } + + private ValidationStatus result; + private StringProperty value = new SimpleStringProperty(); + + @Before + public void setup() { + Validator validator = new EmailValidator(value); + + result = validator.getValidationStatus(); + } + + @Test + public void testValidationOfEmail() { + assertThat(result.isValid()).isFalse(); + + value.set("darthvader@imperium.org"); + assertThat(result.isValid()).isTrue(); + + value.set("darthvader.imperium.org"); // wrong email format + assertThat(result.isValid()).isFalse(); + + value.set(null); + assertThat(result.isValid()).isFalse(); + + value.set(""); + assertThat(result.isValid()).isFalse(); + + value.set(" "); + assertThat(result.isValid()).isFalse(); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java index 3696f770b..d753f926e 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java @@ -13,37 +13,35 @@ import de.saxsys.mvvmfx.utils.validation.ValidationStatus; public class PhoneNumberValidatorTest { - - private ValidationStatus result; - private StringProperty value = new SimpleStringProperty(); - - - @Before - public void setup() { - Validator validator = new PhoneValidator(value, "error message"); - - result = validator.getValidationStatus(); - } - - - @Test - public void testPhoneNumber() { - // phone number is not mandatory - value.set(""); - assertThat(result.isValid()).isTrue(); - value.set(null); - assertThat(result.isValid()).isTrue(); - value.set(" "); - assertThat(result.isValid()).isTrue(); - - - value.set("012345678"); - assertThat(result.isValid()).isTrue(); - - value.set("+49 1234 324541"); - assertThat(result.isValid()).isTrue(); - - value.set("abc"); - assertThat(result.isValid()).isFalse(); - } + + private ValidationStatus result; + private StringProperty value = new SimpleStringProperty(); + + @Before + public void setup() { + Validator validator = new PhoneValidator(value, "error message"); + + result = validator.getValidationStatus(); + } + + @Test + public void testPhoneNumber() { + // phone number is not mandatory + value.set(""); + assertThat(result.isValid()).isTrue(); + value.set(null); + assertThat(result.isValid()).isTrue(); + value.set(" "); + assertThat(result.isValid()).isTrue(); + + value.set("012345678"); + assertThat(result.isValid()).isTrue(); + + value.set("+49 1234 324541"); + assertThat(result.isValid()).isTrue(); + + value.set("abc"); + assertThat(result.isValid()).isFalse(); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java index 8103babec..ca59e0bfa 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java @@ -13,56 +13,57 @@ import org.junit.Test; public class AboutViewModelTest { - - private static final String MY_COOL_LIB_NAME = "my cool library"; - private static final String MY_COOL_LIB_URL = "http://my-cool-library.example.org"; - - private static final String OTHER_FX_NAME = "otherFX"; - private static final String OTHER_FX_URL = "http://otherfx.example.org"; - - private AboutViewModel viewModel; - - private Consumer<String> onLinkClickedHandler; - - @SuppressWarnings("unchecked") - @Before - public void setup() { - viewModel = new AboutViewModel(); - - onLinkClickedHandler = mock(Consumer.class); - viewModel.onLinkClickedHandler = onLinkClickedHandler; - } - - @Test - public void testLibrariesLabel() { - - ReadOnlyStringProperty libraries = viewModel.librariesLabelTextProperty(); - - assertThat(libraries).hasValue(""); - - viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); - - assertThat(libraries).hasValue("- [my cool library]\n"); - - viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); - assertThat(libraries).hasValue("- [my cool library]\n- [otherFX]\n"); - } - - @Test - public void testOnLinkClicked() { - - viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); - viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); - - viewModel.onLinkClicked(MY_COOL_LIB_NAME); - - verify(onLinkClickedHandler).accept(MY_COOL_LIB_URL); - - viewModel.onLinkClicked(OTHER_FX_NAME); - verify(onLinkClickedHandler).accept(OTHER_FX_URL); - - viewModel.onLinkClicked("something else"); - - verifyNoMoreInteractions(onLinkClickedHandler); - } + + private static final String MY_COOL_LIB_NAME = "my cool library"; + private static final String MY_COOL_LIB_URL = "http://my-cool-library.example.org"; + + private static final String OTHER_FX_NAME = "otherFX"; + private static final String OTHER_FX_URL = "http://otherfx.example.org"; + + private AboutViewModel viewModel; + + private Consumer<String> onLinkClickedHandler; + + @SuppressWarnings("unchecked") + @Before + public void setup() { + viewModel = new AboutViewModel(); + + onLinkClickedHandler = mock(Consumer.class); + viewModel.onLinkClickedHandler = onLinkClickedHandler; + } + + @Test + public void testLibrariesLabel() { + + ReadOnlyStringProperty libraries = viewModel.librariesLabelTextProperty(); + + assertThat(libraries).hasValue(""); + + viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); + + assertThat(libraries).hasValue("- [my cool library]\n"); + + viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); + assertThat(libraries).hasValue("- [my cool library]\n- [otherFX]\n"); + } + + @Test + public void testOnLinkClicked() { + + viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); + viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); + + viewModel.onLinkClicked(MY_COOL_LIB_NAME); + + verify(onLinkClickedHandler).accept(MY_COOL_LIB_URL); + + viewModel.onLinkClicked(OTHER_FX_NAME); + verify(onLinkClickedHandler).accept(OTHER_FX_URL); + + viewModel.onLinkClicked("something else"); + + verifyNoMoreInteractions(onLinkClickedHandler); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java index 568f5a565..3eac015b3 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java @@ -21,185 +21,175 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; - public class AddressFormViewModelTest { - private static final String SUBDIVISION_DEFAULT_LABEL = "default_subdivision_label"; - - private AddressFormViewModel viewModel; - - private CountrySelector countrySelector; - - private Country germany = new Country("Germany", "DE"); - private Country austria = new Country("Austria", "AU"); - - - private StringProperty subdivisionLabel = new SimpleStringProperty(); - - private ObservableList<Country> availableCountries = FXCollections.observableArrayList(); - private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); + + private static final String SUBDIVISION_DEFAULT_LABEL = "default_subdivision_label"; + + private AddressFormViewModel viewModel; + + private CountrySelector countrySelector; + + private Country germany = new Country("Germany", "DE"); + private Country austria = new Country("Austria", "AU"); + + private StringProperty subdivisionLabel = new SimpleStringProperty(); + + private ObservableList<Country> availableCountries = FXCollections.observableArrayList(); + private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); private ContactDialogScope scope; - - @Before - public void setup() { - availableCountries.addAll(germany, austria); - - // sadly the ResourceBundle.getString method is final so we can't use mockito - ResourceBundle resourceBundle = new ListResourceBundle() { - @Override - protected Object[][] getContents() { - return new Object[][] { - { SUBDIVISION_LABEL_KEY, SUBDIVISION_DEFAULT_LABEL } - }; - } - }; - countrySelector = mock(CountrySelector.class); - when(countrySelector.inProgressProperty()).thenReturn(new SimpleBooleanProperty()); - when(countrySelector.subdivisionLabel()).thenReturn(subdivisionLabel); - when(countrySelector.availableCountries()).thenReturn(availableCountries); - when(countrySelector.subdivisions()).thenReturn(subdivisions); - - // when "germany" is selected, fill in the subdivisions of germany ... - doAnswer(invocation -> { - helper_fillCountrySelectorWithGermanSubdivisions(); - return null; - }).when(countrySelector).setCountry(germany); - - // ... same for austria - doAnswer(invocation -> { - helper_fillCountrySelectorWithAustrianSubdivisions(); - return null; - }).when(countrySelector).setCountry(austria); - - // when nothing is selected, clear the subdivisions list. - doAnswer(invocation -> { - subdivisions.clear(); - return null; - }).when(countrySelector).setCountry(null); + @Before + public void setup() { + availableCountries.addAll(germany, austria); + + // sadly the ResourceBundle.getString method is final so we can't use mockito + ResourceBundle resourceBundle = new ListResourceBundle() { + @Override + protected Object[][] getContents() { + return new Object[][]{ + {SUBDIVISION_LABEL_KEY, SUBDIVISION_DEFAULT_LABEL} + }; + } + }; + countrySelector = mock(CountrySelector.class); + when(countrySelector.inProgressProperty()).thenReturn(new SimpleBooleanProperty()); + when(countrySelector.subdivisionLabel()).thenReturn(subdivisionLabel); + when(countrySelector.availableCountries()).thenReturn(availableCountries); + when(countrySelector.subdivisions()).thenReturn(subdivisions); + + // when "germany" is selected, fill in the subdivisions of germany ... + doAnswer(invocation -> { + helper_fillCountrySelectorWithGermanSubdivisions(); + return null; + }).when(countrySelector).setCountry(germany); + + // ... same for austria + doAnswer(invocation -> { + helper_fillCountrySelectorWithAustrianSubdivisions(); + return null; + }).when(countrySelector).setCountry(austria); + // when nothing is selected, clear the subdivisions list. + doAnswer(invocation -> { + subdivisions.clear(); + return null; + }).when(countrySelector).setCountry(null); scope = new ContactDialogScope(); - - viewModel = new AddressFormViewModel(); + + viewModel = new AddressFormViewModel(); viewModel.dialogScope = scope; - viewModel.resourceBundle = resourceBundle; - viewModel.countrySelector = countrySelector; - } - - @Test - public void testSubdivisionLabel() { - viewModel.initSubdivisionLabel(); - - assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); - - subdivisionLabel.set("Bundesland"); - assertThat(viewModel.subdivisionLabel()).hasValue("Bundesland"); - - subdivisionLabel.set(null); - assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); - - subdivisionLabel.set(""); - assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); - } - - @Test - public void testCountryAndFederalStateLists() throws Exception { - viewModel.initialize(); - - assertThat(viewModel.countriesList()).hasSize(3).contains(NOTHING_SELECTED_MARKER, "Austria", "Germany"); - assertThat(viewModel.countriesList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); - assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); - - assertThat(viewModel.selectedCountryProperty()).hasValue(NOTHING_SELECTED_MARKER); - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - - - viewModel.selectedCountryProperty().set("Germany"); - - - - assertThat(viewModel.subdivisionsList()).hasSize(17).contains(NOTHING_SELECTED_MARKER, "Sachsen", "Berlin", - "Bayern"); // test sample - assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - - viewModel.selectedSubdivisionProperty().set("Sachsen"); - - - viewModel.selectedCountryProperty().set("Austria"); - - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - assertThat(viewModel.subdivisionsList()).hasSize(10).contains(NOTHING_SELECTED_MARKER, "Wien", "Tirol", - "Salzburg"); - assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); - - viewModel.selectedSubdivisionProperty().set("Wien"); - - - viewModel.selectedCountryProperty().set(NOTHING_SELECTED_MARKER); - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - - assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); - } - - @Test - public void testCreateListWithNothingSelectedMarker() { - ObservableList<String> sourceList = FXCollections.observableArrayList(); - - ObservableList<String> target = AddressFormViewModel - .createListWithNothingSelectedMarker(sourceList); - - assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); - - sourceList.add("test"); - assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "test"); - - sourceList.add("temp"); - assertThat(target).hasSize(3).containsExactly(NOTHING_SELECTED_MARKER, "test", "temp"); - - sourceList.remove("test"); - assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "temp"); - - - sourceList.clear(); - assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); - } - - - private void helper_fillCountrySelectorWithGermanSubdivisions() { - subdivisions.clear(); - - subdivisions.add(new Subdivision("Baden-Württemberg", "BW", germany)); - subdivisions.add(new Subdivision("Bayern", "BY", germany)); - subdivisions.add(new Subdivision("Berlin", "BE", germany)); - subdivisions.add(new Subdivision("Brandenburg", "BB", germany)); - subdivisions.add(new Subdivision("Bremen", "HB", germany)); - subdivisions.add(new Subdivision("Hamburg", "HH", germany)); - subdivisions.add(new Subdivision("Hessen", "HE", germany)); - subdivisions.add(new Subdivision("Mecklemburg-Vorpommern", "MV", germany)); - subdivisions.add(new Subdivision("Niedersachsen", "NI", germany)); - subdivisions.add(new Subdivision("Nordrhein-Westfalen", "NW", germany)); - subdivisions.add(new Subdivision("Rheinland-Pfalz", "RP", germany)); - subdivisions.add(new Subdivision("Saarland", "SL", germany)); - subdivisions.add(new Subdivision("Sachsen", "SN", germany)); - subdivisions.add(new Subdivision("Sachsen-Anhalt", "ST", germany)); - subdivisions.add(new Subdivision("Schleswig-Holstein", "SH", germany)); - subdivisions.add(new Subdivision("Thüringen", "TH", germany)); - } - - private void helper_fillCountrySelectorWithAustrianSubdivisions() { - subdivisions.clear(); - - subdivisions.add(new Subdivision("Burgenland", "Bgld.", austria)); - subdivisions.add(new Subdivision("Kärnten", "Ktn.", austria)); - subdivisions.add(new Subdivision("Niederösterreich", "NÖ", austria)); - subdivisions.add(new Subdivision("Oberösterreich", "OÖ", austria)); - subdivisions.add(new Subdivision("Salzburg", "Sbg.", austria)); - subdivisions.add(new Subdivision("Steiermark", "Stmk.", austria)); - subdivisions.add(new Subdivision("Tirol", "T", austria)); - subdivisions.add(new Subdivision("Vorarlberg", "Vbg.", austria)); - subdivisions.add(new Subdivision("Wien", "W", austria)); - } - + viewModel.resourceBundle = resourceBundle; + viewModel.countrySelector = countrySelector; + } + + @Test + public void testSubdivisionLabel() { + viewModel.initSubdivisionLabel(); + + assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); + + subdivisionLabel.set("Bundesland"); + assertThat(viewModel.subdivisionLabel()).hasValue("Bundesland"); + + subdivisionLabel.set(null); + assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); + + subdivisionLabel.set(""); + assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); + } + + @Test + public void testCountryAndFederalStateLists() throws Exception { + viewModel.initialize(); + + assertThat(viewModel.countriesList()).hasSize(3).contains(NOTHING_SELECTED_MARKER, "Austria", "Germany"); + assertThat(viewModel.countriesList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); + assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); + + assertThat(viewModel.selectedCountryProperty()).hasValue(NOTHING_SELECTED_MARKER); + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + + viewModel.selectedCountryProperty().set("Germany"); + + assertThat(viewModel.subdivisionsList()).hasSize(17).contains(NOTHING_SELECTED_MARKER, "Sachsen", "Berlin", + "Bayern"); // test sample + assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + + viewModel.selectedSubdivisionProperty().set("Sachsen"); + + viewModel.selectedCountryProperty().set("Austria"); + + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + assertThat(viewModel.subdivisionsList()).hasSize(10).contains(NOTHING_SELECTED_MARKER, "Wien", "Tirol", + "Salzburg"); + assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); + + viewModel.selectedSubdivisionProperty().set("Wien"); + + viewModel.selectedCountryProperty().set(NOTHING_SELECTED_MARKER); + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + + assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); + } + + @Test + public void testCreateListWithNothingSelectedMarker() { + ObservableList<String> sourceList = FXCollections.observableArrayList(); + + ObservableList<String> target = AddressFormViewModel + .createListWithNothingSelectedMarker(sourceList); + + assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); + + sourceList.add("test"); + assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "test"); + + sourceList.add("temp"); + assertThat(target).hasSize(3).containsExactly(NOTHING_SELECTED_MARKER, "test", "temp"); + + sourceList.remove("test"); + assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "temp"); + + sourceList.clear(); + assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); + } + + private void helper_fillCountrySelectorWithGermanSubdivisions() { + subdivisions.clear(); + + subdivisions.add(new Subdivision("Baden-Württemberg", "BW", germany)); + subdivisions.add(new Subdivision("Bayern", "BY", germany)); + subdivisions.add(new Subdivision("Berlin", "BE", germany)); + subdivisions.add(new Subdivision("Brandenburg", "BB", germany)); + subdivisions.add(new Subdivision("Bremen", "HB", germany)); + subdivisions.add(new Subdivision("Hamburg", "HH", germany)); + subdivisions.add(new Subdivision("Hessen", "HE", germany)); + subdivisions.add(new Subdivision("Mecklemburg-Vorpommern", "MV", germany)); + subdivisions.add(new Subdivision("Niedersachsen", "NI", germany)); + subdivisions.add(new Subdivision("Nordrhein-Westfalen", "NW", germany)); + subdivisions.add(new Subdivision("Rheinland-Pfalz", "RP", germany)); + subdivisions.add(new Subdivision("Saarland", "SL", germany)); + subdivisions.add(new Subdivision("Sachsen", "SN", germany)); + subdivisions.add(new Subdivision("Sachsen-Anhalt", "ST", germany)); + subdivisions.add(new Subdivision("Schleswig-Holstein", "SH", germany)); + subdivisions.add(new Subdivision("Thüringen", "TH", germany)); + } + + private void helper_fillCountrySelectorWithAustrianSubdivisions() { + subdivisions.clear(); + + subdivisions.add(new Subdivision("Burgenland", "Bgld.", austria)); + subdivisions.add(new Subdivision("Kärnten", "Ktn.", austria)); + subdivisions.add(new Subdivision("Niederösterreich", "NÖ", austria)); + subdivisions.add(new Subdivision("Oberösterreich", "OÖ", austria)); + subdivisions.add(new Subdivision("Salzburg", "Sbg.", austria)); + subdivisions.add(new Subdivision("Steiermark", "Stmk.", austria)); + subdivisions.add(new Subdivision("Tirol", "T", austria)); + subdivisions.add(new Subdivision("Vorarlberg", "Vbg.", austria)); + subdivisions.add(new Subdivision("Wien", "W", austria)); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java index 2ff1ddb66..d81476afd 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java @@ -8,24 +8,24 @@ import static eu.lestard.assertj.javafx.api.Assertions.assertThat; public class ContactDialogViewModelTest { - - private ContactDialogViewModel viewModel; + + private ContactDialogViewModel viewModel; private ContactDialogScope scope; - - private BooleanProperty contactFormValid; - private BooleanProperty addressFormValid; - @Before - public void setup() { + private BooleanProperty contactFormValid; + private BooleanProperty addressFormValid; + + @Before + public void setup() { scope = new ContactDialogScope(); contactFormValid = scope.contactFormValidProperty(); addressFormValid = scope.addressFormValidProperty(); - viewModel = new ContactDialogViewModel(); + viewModel = new ContactDialogViewModel(); viewModel.dialogScope = scope; viewModel.initialize(); - } + } @Test public void testValid() { @@ -66,8 +66,6 @@ public void testWorkflow() { assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - - // now we enter all mandatory values into the form and it is now valid contactFormValid.set(true); @@ -83,8 +81,6 @@ public void testWorkflow() { assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - - // lets go to the next page viewModel.nextAction(); @@ -102,7 +98,6 @@ public void testWorkflow() { assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - // lets enter valid address informations... addressFormValid.set(true); @@ -118,7 +113,6 @@ public void testWorkflow() { assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); - // lets go back to the previous page. The address form is still valid. viewModel.previousAction(); assertThat(viewModel.dialogPageProperty()).hasValue(0); @@ -134,6 +128,6 @@ public void testWorkflow() { // previous button is now invisible but stays enabled assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); - } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java index 259d004ad..60bb137c3 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java @@ -9,52 +9,46 @@ import static org.assertj.core.api.Assertions.assertThat; public class ContactFormViewModelTest { - - private ContactFormViewModel viewModel; - - @Before - public void setup() { - viewModel = new ContactFormViewModel(); - } - - - @Test - public void testFirstname() { - - assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); - assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); - - - viewModel.firstnameProperty().set("Horst"); - - assertThat(viewModel.firstnameValidation().validProperty()).isTrue(); - assertThat(viewModel.firstnameValidation().getErrorMessages()).isEmpty(); - - - viewModel.firstnameProperty().setValue(""); - assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); - assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); - } - - @Test - public void testEmail() { - GCVerifier.forceGC(); - - - assertThat(viewModel.emailValidation().getMessages()).hasSize(2); - assertThat(viewModel.emailValidation().validProperty()).isFalse(); - - viewModel.emailProperty().set("Something"); - - assertThat(viewModel.emailValidation().getMessages()).hasSize(1); - assertThat(viewModel.emailValidation().validProperty()).isFalse(); - - viewModel.emailProperty().set("test@example.org"); - - assertThat(viewModel.emailValidation().getMessages()).isEmpty(); - assertThat(viewModel.emailValidation().validProperty()).isTrue(); - } - - - + + private ContactFormViewModel viewModel; + + @Before + public void setup() { + viewModel = new ContactFormViewModel(); + } + + @Test + public void testFirstname() { + + assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); + assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); + + viewModel.firstnameProperty().set("Horst"); + + assertThat(viewModel.firstnameValidation().validProperty()).isTrue(); + assertThat(viewModel.firstnameValidation().getErrorMessages()).isEmpty(); + + viewModel.firstnameProperty().setValue(""); + assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); + assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); + } + + @Test + public void testEmail() { + GCVerifier.forceGC(); + + assertThat(viewModel.emailValidation().getMessages()).hasSize(2); + assertThat(viewModel.emailValidation().validProperty()).isFalse(); + + viewModel.emailProperty().set("Something"); + + assertThat(viewModel.emailValidation().getMessages()).hasSize(1); + assertThat(viewModel.emailValidation().validProperty()).isFalse(); + + viewModel.emailProperty().set("test@example.org"); + + assertThat(viewModel.emailValidation().getMessages()).isEmpty(); + assertThat(viewModel.emailValidation().validProperty()).isTrue(); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java index 26e6b2826..0c9b869f1 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java @@ -17,169 +17,162 @@ import javafx.beans.property.SimpleObjectProperty; public class DetailViewModelTest { - - - - private DetailViewModel viewModel; - - private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(); - private Contact luke; - private Contact obi; - - private Repository repository; - - @Before - public void setup() { - MasterDetailScope masterViewModelMock = mock(MasterDetailScope.class); - - when(masterViewModelMock.selectedContactProperty()).thenReturn(selectedContact); - - viewModel = new DetailViewModel(); - viewModel.mdScope = masterViewModelMock; - - repository = mock(Repository.class); - viewModel.repository = repository; - - viewModel.initialize(); - - luke = new Contact(); - obi = new Contact(); - } - - - @Test - public void testRemoveAction() { - selectedContact.set(null); - assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isTrue(); - selectedContact.set(luke); - assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isFalse(); - viewModel.getRemoveCommand().execute(); - verify(repository).delete(luke); - } - - @Test - public void testNameLabelText() { - luke.setFirstname("Luke"); - luke.setLastname("Skywalker"); - - obi.setFirstname("Obi-Wan"); - obi.setLastname("Kenobi"); - obi.setTitle("Master"); - - selectedContact.set(null); - - assertThat(viewModel.nameLabelTextProperty()).hasValue(""); - - selectedContact.set(luke); - - assertThat(viewModel.nameLabelTextProperty()).hasValue("Luke Skywalker"); - - - selectedContact.set(obi); - - assertThat(viewModel.nameLabelTextProperty()).hasValue("Master Obi-Wan Kenobi"); - } - - - @Test - public void testBirthdayLabelText() { - luke.setBirthday(LocalDate.of(1951, 9, 25)); - obi.setBirthday(null); - - selectedContact.set(null); - assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); - - selectedContact.set(luke); - assertThat(viewModel.birthdayLabelTextProperty()).hasValue("1951-09-25"); - - selectedContact.set(obi); - assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); - - } - - @Test - public void testRoleDepartmentLabelText() { - luke.setRole("Pilot"); - luke.setDepartment("Rebel Alliance"); - - obi.setRole("Jedi"); - obi.setDepartment(null); - - selectedContact.set(null); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); - - selectedContact.set(luke); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Pilot / Rebel Alliance"); - - selectedContact.set(obi); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Jedi"); - - - luke.setRole(null); // the galactic war is over now so he isn't a pilot anymore ;-) - - selectedContact.set(luke); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Rebel Alliance"); - - - obi.setRole(""); - obi.setDepartment(""); - - selectedContact.set(obi); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); - } - - @Test - public void testEmailLabelText() { - luke.setEmailAddress("luke@rebel-alliance.com"); - - obi.setEmailAddress(null); - - - selectedContact.set(null); - assertThat(viewModel.emailLabelTextProperty()).hasValue(""); - - selectedContact.set(luke); - assertThat(viewModel.emailLabelTextProperty()).hasValue("luke@rebel-alliance.com"); - - selectedContact.set(obi); - assertThat(viewModel.emailLabelTextProperty()).hasValue(""); - } - - @Test - public void testPhoneLabelText() { - luke.setPhoneNumber(null); - obi.setPhoneNumber("0123456789"); - - selectedContact.set(null); - assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); - - selectedContact.set(luke); - assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); - - selectedContact.set(obi); - assertThat(viewModel.phoneLabelTextProperty()).hasValue("0123456789"); - - luke.setPhoneNumber("+49 123 456 789"); - selectedContact.set(luke); - assertThat(viewModel.phoneLabelTextProperty()).hasValue("+49 123 456 789"); - } - - @Test - public void testMobileLabelText() { - luke.setMobileNumber(null); - obi.setMobileNumber("0123456789"); - - selectedContact.set(null); - assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); - - selectedContact.set(luke); - assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); - - selectedContact.set(obi); - assertThat(viewModel.mobileLabelTextProperty()).hasValue("0123456789"); - - luke.setMobileNumber("+49 123 456 789"); - selectedContact.set(luke); - assertThat(viewModel.mobileLabelTextProperty()).hasValue("+49 123 456 789"); - } + + private DetailViewModel viewModel; + + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(); + private Contact luke; + private Contact obi; + + private Repository repository; + + @Before + public void setup() { + MasterDetailScope masterViewModelMock = mock(MasterDetailScope.class); + + when(masterViewModelMock.selectedContactProperty()).thenReturn(selectedContact); + + viewModel = new DetailViewModel(); + viewModel.mdScope = masterViewModelMock; + + repository = mock(Repository.class); + viewModel.repository = repository; + + viewModel.initialize(); + + luke = new Contact(); + obi = new Contact(); + } + + @Test + public void testRemoveAction() { + selectedContact.set(null); + assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isTrue(); + selectedContact.set(luke); + assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isFalse(); + viewModel.getRemoveCommand().execute(); + verify(repository).delete(luke); + } + + @Test + public void testNameLabelText() { + luke.setFirstname("Luke"); + luke.setLastname("Skywalker"); + + obi.setFirstname("Obi-Wan"); + obi.setLastname("Kenobi"); + obi.setTitle("Master"); + + selectedContact.set(null); + + assertThat(viewModel.nameLabelTextProperty()).hasValue(""); + + selectedContact.set(luke); + + assertThat(viewModel.nameLabelTextProperty()).hasValue("Luke Skywalker"); + + selectedContact.set(obi); + + assertThat(viewModel.nameLabelTextProperty()).hasValue("Master Obi-Wan Kenobi"); + } + + @Test + public void testBirthdayLabelText() { + luke.setBirthday(LocalDate.of(1951, 9, 25)); + obi.setBirthday(null); + + selectedContact.set(null); + assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); + + selectedContact.set(luke); + assertThat(viewModel.birthdayLabelTextProperty()).hasValue("1951-09-25"); + + selectedContact.set(obi); + assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); + + } + + @Test + public void testRoleDepartmentLabelText() { + luke.setRole("Pilot"); + luke.setDepartment("Rebel Alliance"); + + obi.setRole("Jedi"); + obi.setDepartment(null); + + selectedContact.set(null); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); + + selectedContact.set(luke); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Pilot / Rebel Alliance"); + + selectedContact.set(obi); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Jedi"); + + luke.setRole(null); // the galactic war is over now so he isn't a pilot anymore ;-) + + selectedContact.set(luke); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Rebel Alliance"); + + obi.setRole(""); + obi.setDepartment(""); + + selectedContact.set(obi); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); + } + + @Test + public void testEmailLabelText() { + luke.setEmailAddress("luke@rebel-alliance.com"); + + obi.setEmailAddress(null); + + selectedContact.set(null); + assertThat(viewModel.emailLabelTextProperty()).hasValue(""); + + selectedContact.set(luke); + assertThat(viewModel.emailLabelTextProperty()).hasValue("luke@rebel-alliance.com"); + + selectedContact.set(obi); + assertThat(viewModel.emailLabelTextProperty()).hasValue(""); + } + + @Test + public void testPhoneLabelText() { + luke.setPhoneNumber(null); + obi.setPhoneNumber("0123456789"); + + selectedContact.set(null); + assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); + + selectedContact.set(luke); + assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); + + selectedContact.set(obi); + assertThat(viewModel.phoneLabelTextProperty()).hasValue("0123456789"); + + luke.setPhoneNumber("+49 123 456 789"); + selectedContact.set(luke); + assertThat(viewModel.phoneLabelTextProperty()).hasValue("+49 123 456 789"); + } + + @Test + public void testMobileLabelText() { + luke.setMobileNumber(null); + obi.setMobileNumber("0123456789"); + + selectedContact.set(null); + assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); + + selectedContact.set(luke); + assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); + + selectedContact.set(obi); + assertThat(viewModel.mobileLabelTextProperty()).hasValue("0123456789"); + + luke.setMobileNumber("+49 123 456 789"); + selectedContact.set(luke); + assertThat(viewModel.mobileLabelTextProperty()).hasValue("+49 123 456 789"); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java index b7b9c5ba6..e66919f79 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java @@ -16,43 +16,41 @@ import javafx.beans.property.SimpleStringProperty; public class EditContactDialogViewModelTest { - - private EditContactDialogViewModel viewModel; - - private Repository repository; - - private ContactDialogViewModel contactDialogViewModel; - - private ContactDialogScope scope; - - @Before - public void setup() { - scope = new ContactDialogScope(); - - - // sadly the ResourceBundle.getString method is final so we can't use mockito - ResourceBundle resourceBundle = new ListResourceBundle() { - @Override - protected Object[][] getContents() { - return new Object[][] { - { TITLE_LABEL_KEY, "default_subdivision_label" } - }; - } - }; - - viewModel = new EditContactDialogViewModel(); - viewModel.dialogScope = scope; - - viewModel.defaultResourceBundle = resourceBundle; - - repository = mock(Repository.class); - viewModel.repository = repository; - - contactDialogViewModel = mock(ContactDialogViewModel.class); - when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); - - when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); - - } - + + private EditContactDialogViewModel viewModel; + + private Repository repository; + + private ContactDialogViewModel contactDialogViewModel; + + private ContactDialogScope scope; + + @Before + public void setup() { + scope = new ContactDialogScope(); + + // sadly the ResourceBundle.getString method is final so we can't use mockito + ResourceBundle resourceBundle = new ListResourceBundle() { + @Override + protected Object[][] getContents() { + return new Object[][]{ + {TITLE_LABEL_KEY, "default_subdivision_label"} + }; + } + }; + + viewModel = new EditContactDialogViewModel(); + viewModel.dialogScope = scope; + + viewModel.defaultResourceBundle = resourceBundle; + + repository = mock(Repository.class); + viewModel.repository = repository; + + contactDialogViewModel = mock(ContactDialogViewModel.class); + when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); + + when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java index d0689e939..8d9debe49 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java @@ -14,23 +14,21 @@ import de.saxsys.mvvmfx.examples.contacts.util.CentralClock; public class MasterTableViewModelTest { - - - @Test - public void testCalculationOfAge() { - - ZonedDateTime now = ZonedDateTime - .of(LocalDate.of(2010, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); // 2010-01-01T00:00 - - CentralClock.setFixedClock(now); - - - Contact contact = new Contact(); - contact.setBirthday(LocalDate.of(1987, Month.DECEMBER, 13)); - - MasterTableViewModel tableViewModel = new MasterTableViewModel(contact); - - assertThat(tableViewModel.ageProperty().get()).isEqualTo(22); - } - + + @Test + public void testCalculationOfAge() { + + ZonedDateTime now = ZonedDateTime + .of(LocalDate.of(2010, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); // 2010-01-01T00:00 + + CentralClock.setFixedClock(now); + + Contact contact = new Contact(); + contact.setBirthday(LocalDate.of(1987, Month.DECEMBER, 13)); + + MasterTableViewModel tableViewModel = new MasterTableViewModel(contact); + + assertThat(tableViewModel.ageProperty().get()).isEqualTo(22); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java index 24be4d6b0..c641d305d 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java @@ -23,148 +23,147 @@ @SuppressWarnings("unchecked") public class MasterViewModelTest { - - - private MasterViewModel viewModel; - private MasterDetailScope mdScope; - - private Repository repository; - private Contact contact1; - private Contact contact2; - private Contact contact3; - - private Consumer<MasterTableViewModel> onSelectConsumer; - - @Before - public void setup() { - repository = new InmemoryRepository(); - viewModel = new MasterViewModel(); - mdScope = new MasterDetailScope(); - - viewModel.mdScope = mdScope; - viewModel.repository = repository; - - contact1 = ContactFactory.createRandomContact(); - contact2 = ContactFactory.createRandomContact(); - contact3 = ContactFactory.createRandomContact(); - - repository.save(contact1); - repository.save(contact2); - repository.save(contact3); - - - onSelectConsumer = mock(Consumer.class); - viewModel.setOnSelect(onSelectConsumer); - } - - @Test - public void testSelectContact() { - viewModel.initialize(); - - - assertThat(viewModel.selectedTableRowProperty()).hasNullValue(); - assertThat(mdScope.selectedContactProperty()).hasNullValue(); - - - MasterTableViewModel firstRow = viewModel.getContactList().get(0); - - viewModel.selectedTableRowProperty().set(firstRow); - - assertThat(mdScope.selectedContactProperty()).hasNotNullValue(); - assertThat(mdScope.selectedContactProperty().get().getId()).isEqualTo(firstRow.getId()); - - - viewModel.selectedTableRowProperty().set(null); - - assertThat(mdScope.selectedContactProperty()).hasNullValue(); - } - - - /** - * When no item is selected before an update then after the update still no item should be selected. - */ - @Test - public void testUpdateContactListNoSelection() { - viewModel.initialize(); - viewModel.selectedTableRowProperty().set(null); - - assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); - - viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); - - verify(onSelectConsumer, never()).accept(any()); - } - - /** - * When the contactList is updated and the item that was selected before the update is still available in the - * repository (i.e. it wasn't removed) this item should still be selected after the update. - */ - @Test - public void testUpdateContactListSelectionPersistsAfterUpdate() { - viewModel.initialize(); - assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); - - MasterTableViewModel row2 = findTableViewModelForContact(contact2); - - viewModel.selectedTableRowProperty().set(row2); - - - repository.delete(contact1); // Not the selected contact - - viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); - - - assertThat(getContactIdsInTable()).contains(contact2.getId(), contact3.getId()) - .doesNotContain(contact1.getId()); - - verify(onSelectConsumer).accept(row2); - } - - /** - * When the contactList is updated and the item that was selected before the update is now not available in the - * repository anymore (because it was removed) then no item should be selected. - */ - @Test - public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { - viewModel.initialize(); - MasterTableViewModel row2 = findTableViewModelForContact(contact2); - - viewModel.selectedTableRowProperty().set(row2); - - - repository.delete(contact2); // The selected contact - - - viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); - - - assertThat(getContactIdsInTable()).contains(contact1.getId(), contact3.getId()) - .doesNotContain(contact2.getId()); - - verify(onSelectConsumer).accept(null); - } - - - /** - * This helper extracts the IDs of all Contact rows in that are shown in the TableView. - * - * The TableView doesn't directly show instances of {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} but - * instead contains instances of {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel}. - * - * Every {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} has an ID attribute corresponding - * to the ID of the contact that is shown. This method extracts these IDs and returns them as List. This way we can - * verify what Contacts are shown in the Table. - */ - private List<String> getContactIdsInTable() { - return viewModel.getContactList().stream().map(MasterTableViewModel::getId).collect( - Collectors.toList()); - } - - /** - * Returns the {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} for the given - * {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} from the contact list. - */ - private MasterTableViewModel findTableViewModelForContact(Contact contact) { - return viewModel.getContactList().stream().filter(row -> row.getId().equals(contact.getId())).findFirst().get(); - } + + private MasterViewModel viewModel; + private MasterDetailScope mdScope; + + private Repository repository; + private Contact contact1; + private Contact contact2; + private Contact contact3; + + private Consumer<MasterTableViewModel> onSelectConsumer; + + @Before + public void setup() { + repository = new InmemoryRepository(); + viewModel = new MasterViewModel(); + mdScope = new MasterDetailScope(); + + viewModel.mdScope = mdScope; + viewModel.repository = repository; + + contact1 = ContactFactory.createRandomContact(); + contact2 = ContactFactory.createRandomContact(); + contact3 = ContactFactory.createRandomContact(); + + repository.save(contact1); + repository.save(contact2); + repository.save(contact3); + + onSelectConsumer = mock(Consumer.class); + viewModel.setOnSelect(onSelectConsumer); + } + + @Test + public void testSelectContact() { + viewModel.initialize(); + + assertThat(viewModel.selectedTableRowProperty()).hasNullValue(); + assertThat(mdScope.selectedContactProperty()).hasNullValue(); + + MasterTableViewModel firstRow = viewModel.getContactList().get(0); + + viewModel.selectedTableRowProperty().set(firstRow); + + assertThat(mdScope.selectedContactProperty()).hasNotNullValue(); + assertThat(mdScope.selectedContactProperty().get().getId()).isEqualTo(firstRow.getId()); + + viewModel.selectedTableRowProperty().set(null); + + assertThat(mdScope.selectedContactProperty()).hasNullValue(); + } + + /** + * When no item is selected before an update then after the update still no + * item should be selected. + */ + @Test + public void testUpdateContactListNoSelection() { + viewModel.initialize(); + viewModel.selectedTableRowProperty().set(null); + + assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); + + viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); + + verify(onSelectConsumer, never()).accept(any()); + } + + /** + * When the contactList is updated and the item that was selected before the + * update is still available in the repository (i.e. it wasn't removed) this + * item should still be selected after the update. + */ + @Test + public void testUpdateContactListSelectionPersistsAfterUpdate() { + viewModel.initialize(); + assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); + + MasterTableViewModel row2 = findTableViewModelForContact(contact2); + + viewModel.selectedTableRowProperty().set(row2); + + repository.delete(contact1); // Not the selected contact + + viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); + + assertThat(getContactIdsInTable()).contains(contact2.getId(), contact3.getId()) + .doesNotContain(contact1.getId()); + + verify(onSelectConsumer).accept(row2); + } + + /** + * When the contactList is updated and the item that was selected before the + * update is now not available in the repository anymore (because it was + * removed) then no item should be selected. + */ + @Test + public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { + viewModel.initialize(); + MasterTableViewModel row2 = findTableViewModelForContact(contact2); + + viewModel.selectedTableRowProperty().set(row2); + + repository.delete(contact2); // The selected contact + + viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); + + assertThat(getContactIdsInTable()).contains(contact1.getId(), contact3.getId()) + .doesNotContain(contact2.getId()); + + verify(onSelectConsumer).accept(null); + } + + /** + * This helper extracts the IDs of all Contact rows in that are shown in the + * TableView. + * + * The TableView doesn't directly show instances of + * {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} but instead + * contains instances of + * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel}. + * + * Every + * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} + * has an ID attribute corresponding to the ID of the contact that is shown. + * This method extracts these IDs and returns them as List. This way we can + * verify what Contacts are shown in the Table. + */ + private List<String> getContactIdsInTable() { + return viewModel.getContactList().stream().map(MasterTableViewModel::getId).collect( + Collectors.toList()); + } + + /** + * Returns the + * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} + * for the given {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} + * from the contact list. + */ + private MasterTableViewModel findTableViewModelForContact(Contact contact) { + return viewModel.getContactList().stream().filter(row -> row.getId().equals(contact.getId())).findFirst().get(); + } + } diff --git a/examples/contacts-example/src/test/resources/countries/iso_3166.xml b/examples/contacts-example/src/test/resources/countries/iso_3166.xml index aaafdba8d..b96e5e416 100644 --- a/examples/contacts-example/src/test/resources/countries/iso_3166.xml +++ b/examples/contacts-example/src/test/resources/countries/iso_3166.xml @@ -23,22 +23,22 @@ ]> <iso_3166_entries> - <iso_3166_entry - alpha_2_code="AT" - alpha_3_code="AUT" - numeric_code="040" - name="Austria" - official_name="Republic of Austria"/> - <iso_3166_entry - alpha_2_code="DE" - alpha_3_code="DEU" - numeric_code="276" - name="Germany" - official_name="Federal Republic of Germany"/> - <iso_3166_entry - alpha_2_code="CH" - alpha_3_code="CHE" - numeric_code="756" - name="Switzerland" - official_name="Swiss Confederation"/> + <iso_3166_entry + alpha_2_code="AT" + alpha_3_code="AUT" + numeric_code="040" + name="Austria" + official_name="Republic of Austria"/> + <iso_3166_entry + alpha_2_code="DE" + alpha_3_code="DEU" + numeric_code="276" + name="Germany" + official_name="Federal Republic of Germany"/> + <iso_3166_entry + alpha_2_code="CH" + alpha_3_code="CHE" + numeric_code="756" + name="Switzerland" + official_name="Swiss Confederation"/> </iso_3166_entries> \ No newline at end of file diff --git a/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml b/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml index 84f15e9d4..f5f94af38 100644 --- a/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml +++ b/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml @@ -20,122 +20,122 @@ ]> <iso_3166_2_entries> - <!-- Germany --> - <iso_3166_country code="DE"> - <iso_3166_subset type="State"> - <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> - <iso_3166_2_entry - code="DE-BW" name="Baden-Württemberg"/> - <iso_3166_2_entry - code="DE-BY" name="Bayern"/> - <iso_3166_2_entry - code="DE-HB" name="Bremen"/> - <iso_3166_2_entry - code="DE-HH" name="Hamburg"/> - <iso_3166_2_entry - code="DE-HE" name="Hessen"/> - <iso_3166_2_entry - code="DE-NI" name="Niedersachsen"/> - <iso_3166_2_entry - code="DE-NW" name="Nordrhein-Westfalen"/> - <iso_3166_2_entry - code="DE-RP" name="Rheinland-Pfalz"/> - <iso_3166_2_entry - code="DE-SL" name="Saarland"/> - <iso_3166_2_entry - code="DE-SH" name="Schleswig-Holstein"/> - <iso_3166_2_entry - code="DE-BE" name="Berlin"/> - <iso_3166_2_entry - code="DE-BB" name="Brandenburg"/> - <iso_3166_2_entry - code="DE-MV" name="Mecklenburg-Vorpommern"/> - <iso_3166_2_entry - code="DE-SN" name="Sachsen"/> - <iso_3166_2_entry - code="DE-ST" name="Sachsen-Anhalt"/> - <iso_3166_2_entry - code="DE-TH" name="Thüringen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Austria --> - <iso_3166_country code="AT"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="AT-1" name="Burgenland"/> - <iso_3166_2_entry - code="AT-2" name="Kärnten"/> - <iso_3166_2_entry - code="AT-3" name="Niederösterreich"/> - <iso_3166_2_entry - code="AT-4" name="Oberösterreich"/> - <iso_3166_2_entry - code="AT-5" name="Salzburg"/> - <iso_3166_2_entry - code="AT-6" name="Steiermark"/> - <iso_3166_2_entry - code="AT-7" name="Tirol"/> - <iso_3166_2_entry - code="AT-8" name="Vorarlberg"/> - <iso_3166_2_entry - code="AT-9" name="Wien"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Switzerland --> - <iso_3166_country code="CH"> - <iso_3166_subset type="Canton"> - <iso_3166_2_entry - code="CH-AG" name="Aargau"/> - <iso_3166_2_entry - code="CH-AI" name="Appenzell Innerrhoden"/> - <iso_3166_2_entry - code="CH-AR" name="Appenzell Ausserrhoden"/> - <iso_3166_2_entry - code="CH-BE" name="Bern"/> - <iso_3166_2_entry - code="CH-BL" name="Basel-Landschaft"/> - <iso_3166_2_entry - code="CH-BS" name="Basel-Stadt"/> - <iso_3166_2_entry - code="CH-FR" name="Fribourg"/> - <iso_3166_2_entry - code="CH-GE" name="Genève"/> - <iso_3166_2_entry - code="CH-GL" name="Glarus"/> - <iso_3166_2_entry - code="CH-GR" name="Graubünden"/> - <iso_3166_2_entry - code="CH-JU" name="Jura"/> - <iso_3166_2_entry - code="CH-LU" name="Luzern"/> - <iso_3166_2_entry - code="CH-NE" name="Neuchâtel"/> - <iso_3166_2_entry - code="CH-NW" name="Nidwalden"/> - <iso_3166_2_entry - code="CH-OW" name="Obwalden"/> - <iso_3166_2_entry - code="CH-SG" name="Sankt Gallen"/> - <iso_3166_2_entry - code="CH-SH" name="Schaffhausen"/> - <iso_3166_2_entry - code="CH-SO" name="Solothurn"/> - <iso_3166_2_entry - code="CH-SZ" name="Schwyz"/> - <iso_3166_2_entry - code="CH-TG" name="Thurgau"/> - <iso_3166_2_entry - code="CH-TI" name="Ticino"/> - <iso_3166_2_entry - code="CH-UR" name="Uri"/> - <iso_3166_2_entry - code="CH-VD" name="Vaud"/> - <iso_3166_2_entry - code="CH-VS" name="Valais"/> - <iso_3166_2_entry - code="CH-ZG" name="Zug"/> - <iso_3166_2_entry - code="CH-ZH" name="Zürich"/> - </iso_3166_subset> - </iso_3166_country> + <!-- Germany --> + <iso_3166_country code="DE"> + <iso_3166_subset type="State"> + <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> + <iso_3166_2_entry + code="DE-BW" name="Baden-Württemberg"/> + <iso_3166_2_entry + code="DE-BY" name="Bayern"/> + <iso_3166_2_entry + code="DE-HB" name="Bremen"/> + <iso_3166_2_entry + code="DE-HH" name="Hamburg"/> + <iso_3166_2_entry + code="DE-HE" name="Hessen"/> + <iso_3166_2_entry + code="DE-NI" name="Niedersachsen"/> + <iso_3166_2_entry + code="DE-NW" name="Nordrhein-Westfalen"/> + <iso_3166_2_entry + code="DE-RP" name="Rheinland-Pfalz"/> + <iso_3166_2_entry + code="DE-SL" name="Saarland"/> + <iso_3166_2_entry + code="DE-SH" name="Schleswig-Holstein"/> + <iso_3166_2_entry + code="DE-BE" name="Berlin"/> + <iso_3166_2_entry + code="DE-BB" name="Brandenburg"/> + <iso_3166_2_entry + code="DE-MV" name="Mecklenburg-Vorpommern"/> + <iso_3166_2_entry + code="DE-SN" name="Sachsen"/> + <iso_3166_2_entry + code="DE-ST" name="Sachsen-Anhalt"/> + <iso_3166_2_entry + code="DE-TH" name="Thüringen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Austria --> + <iso_3166_country code="AT"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="AT-1" name="Burgenland"/> + <iso_3166_2_entry + code="AT-2" name="Kärnten"/> + <iso_3166_2_entry + code="AT-3" name="Niederösterreich"/> + <iso_3166_2_entry + code="AT-4" name="Oberösterreich"/> + <iso_3166_2_entry + code="AT-5" name="Salzburg"/> + <iso_3166_2_entry + code="AT-6" name="Steiermark"/> + <iso_3166_2_entry + code="AT-7" name="Tirol"/> + <iso_3166_2_entry + code="AT-8" name="Vorarlberg"/> + <iso_3166_2_entry + code="AT-9" name="Wien"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Switzerland --> + <iso_3166_country code="CH"> + <iso_3166_subset type="Canton"> + <iso_3166_2_entry + code="CH-AG" name="Aargau"/> + <iso_3166_2_entry + code="CH-AI" name="Appenzell Innerrhoden"/> + <iso_3166_2_entry + code="CH-AR" name="Appenzell Ausserrhoden"/> + <iso_3166_2_entry + code="CH-BE" name="Bern"/> + <iso_3166_2_entry + code="CH-BL" name="Basel-Landschaft"/> + <iso_3166_2_entry + code="CH-BS" name="Basel-Stadt"/> + <iso_3166_2_entry + code="CH-FR" name="Fribourg"/> + <iso_3166_2_entry + code="CH-GE" name="Genève"/> + <iso_3166_2_entry + code="CH-GL" name="Glarus"/> + <iso_3166_2_entry + code="CH-GR" name="Graubünden"/> + <iso_3166_2_entry + code="CH-JU" name="Jura"/> + <iso_3166_2_entry + code="CH-LU" name="Luzern"/> + <iso_3166_2_entry + code="CH-NE" name="Neuchâtel"/> + <iso_3166_2_entry + code="CH-NW" name="Nidwalden"/> + <iso_3166_2_entry + code="CH-OW" name="Obwalden"/> + <iso_3166_2_entry + code="CH-SG" name="Sankt Gallen"/> + <iso_3166_2_entry + code="CH-SH" name="Schaffhausen"/> + <iso_3166_2_entry + code="CH-SO" name="Solothurn"/> + <iso_3166_2_entry + code="CH-SZ" name="Schwyz"/> + <iso_3166_2_entry + code="CH-TG" name="Thurgau"/> + <iso_3166_2_entry + code="CH-TI" name="Ticino"/> + <iso_3166_2_entry + code="CH-UR" name="Uri"/> + <iso_3166_2_entry + code="CH-VD" name="Vaud"/> + <iso_3166_2_entry + code="CH-VS" name="Valais"/> + <iso_3166_2_entry + code="CH-ZG" name="Zug"/> + <iso_3166_2_entry + code="CH-ZH" name="Zürich"/> + </iso_3166_subset> + </iso_3166_country> </iso_3166_2_entries> From d5f7332d1b8d22a47f2c91e31e999b2ee673a3a7 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 31 Jan 2016 19:47:49 +0100 Subject: [PATCH 50/96] Format sourcecode. --- examples/todomvc-example/pom.xml | 51 ++++--- .../saxsys/mvvmfx/examples/todomvc/App.java | 29 ++-- .../examples/todomvc/model/TodoItem.java | 65 ++++----- .../examples/todomvc/model/TodoItemStore.java | 32 ++--- .../examples/todomvc/ui/FilterHelper.java | 86 ++++++----- .../mvvmfx/examples/todomvc/ui/MainView.java | 1 + .../examples/todomvc/ui/MainViewModel.java | 1 + .../todomvc/ui/additems/AddItemsView.java | 36 ++--- .../ui/additems/AddItemsViewModel.java | 71 +++++---- .../todomvc/ui/controls/ControlsView.java | 45 +++--- .../ui/controls/ControlsViewModel.java | 63 ++++---- .../todomvc/ui/item/ItemOverviewView.java | 17 ++- .../ui/item/ItemOverviewViewModel.java | 75 +++++----- .../examples/todomvc/ui/item/ItemView.java | 136 +++++++++--------- .../todomvc/ui/item/ItemViewModel.java | 76 +++++----- .../mvvmfx/examples/todomvc/ui/MainView.fxml | 22 +-- .../todomvc/ui/additems/AddItemsView.fxml | 16 +-- .../todomvc/ui/controls/ControlsView.fxml | 42 +++--- .../todomvc/ui/item/ItemOverviewView.fxml | 11 +- .../examples/todomvc/ui/item/ItemView.fxml | 48 +++---- 20 files changed, 459 insertions(+), 464 deletions(-) diff --git a/examples/todomvc-example/pom.xml b/examples/todomvc-example/pom.xml index cb1fb50ed..53c0614b4 100644 --- a/examples/todomvc-example/pom.xml +++ b/examples/todomvc-example/pom.xml @@ -1,31 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>de.saxsys.mvvmfx</groupId> - <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>de.saxsys.mvvmfx</groupId> + <artifactId>examples</artifactId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> - <artifactId>todomvc-example</artifactId> - - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - <dependency> - <groupId>org.fxmisc.easybind</groupId> - <artifactId>easybind</artifactId> - <version>1.0.3</version> - </dependency> - <dependency> - <groupId>de.jensd</groupId> - <artifactId>fontawesomefx</artifactId> - <version>8.2</version> - </dependency> - </dependencies> + <artifactId>todomvc-example</artifactId> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + <dependency> + <groupId>org.fxmisc.easybind</groupId> + <artifactId>easybind</artifactId> + <version>1.0.3</version> + </dependency> + <dependency> + <groupId>de.jensd</groupId> + <artifactId>fontawesomefx</artifactId> + <version>8.2</version> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java index 55f23a0e5..c774fcff6 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java @@ -12,18 +12,19 @@ * @author manuel.mauky */ public class App extends Application { - - public static void main(String... args) { - launch(args); - } - - @Override - public void start(Stage stage) throws Exception { - stage.setTitle("TodoMVVM"); - - final Parent parent = FluentViewLoader.fxmlView(MainView.class).load().getView(); - - stage.setScene(new Scene(parent)); - stage.show(); - } + + public static void main(String... args) { + launch(args); + } + + @Override + public void start(Stage stage) throws Exception { + stage.setTitle("TodoMVVM"); + + final Parent parent = FluentViewLoader.fxmlView(MainView.class).load().getView(); + + stage.setScene(new Scene(parent)); + stage.show(); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java index c77a38117..d9035f95f 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java @@ -9,36 +9,37 @@ * @author manuel.mauky */ public class TodoItem { - - private StringProperty text = new SimpleStringProperty(); - - private BooleanProperty completed = new SimpleBooleanProperty(false); - - public TodoItem(String text) { - this.text.set(text); - } - - public String getText() { - return text.get(); - } - - public StringProperty textProperty() { - return text; - } - - public void setText(String text) { - this.text.set(text); - } - - public boolean isCompleted() { - return completed.get(); - } - - public BooleanProperty completedProperty() { - return completed; - } - - public void setCompleted(boolean completed) { - this.completed.set(completed); - } + + private final StringProperty text = new SimpleStringProperty(); + + private final BooleanProperty completed = new SimpleBooleanProperty(false); + + public TodoItem(String text) { + this.text.set(text); + } + + public String getText() { + return text.get(); + } + + public StringProperty textProperty() { + return text; + } + + public void setText(String text) { + this.text.set(text); + } + + public boolean isCompleted() { + return completed.get(); + } + + public BooleanProperty completedProperty() { + return completed; + } + + public void setCompleted(boolean completed) { + this.completed.set(completed); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java index 9f44fe2b9..e037ab713 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java @@ -7,20 +7,20 @@ * @author manuel.mauky */ public class TodoItemStore { - - private ObservableList<TodoItem> items = FXCollections.observableArrayList(); - - - private static final TodoItemStore SINGLETON = new TodoItemStore(); - - private TodoItemStore() { - } - - public static TodoItemStore getInstance() { - return SINGLETON; - } - - public ObservableList<TodoItem> getItems() { - return items; - } + + private static final TodoItemStore SINGLETON = new TodoItemStore(); + + private final ObservableList<TodoItem> items = FXCollections.observableArrayList(); + + private TodoItemStore() { + } + + public static TodoItemStore getInstance() { + return SINGLETON; + } + + public ObservableList<TodoItem> getItems() { + return items; + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java index 5e4ffb221..3fb3b4636 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java @@ -15,50 +15,44 @@ * @author manuel.mauky */ public class FilterHelper { - - public static <T> ObservableList<T> filter(ObservableList<T> items, - Function<T, ObservableBooleanValue> conditionExtractor) { - return filterInternal(items, conditionExtractor, t -> conditionExtractor.apply(t).get()); - } - - public static <T> ObservableList<T> filterInverted(ObservableList<T> items, - Function<T, ObservableBooleanValue> conditionExtractor) { - return filterInternal(items, conditionExtractor, t -> !conditionExtractor.apply(t).get()); - } - - - private static <T> ObservableList<T> filterInternal(ObservableList<T> items, - Function<T, ObservableBooleanValue> conditionExtractor, final Predicate<T> predicate) { - final ObservableList<T> filteredItems = FXCollections.observableArrayList(); - - final InvalidationListener listener = observable -> { - final List<T> completed = items.stream() - .filter(predicate) - .collect(Collectors.toList()); - - filteredItems.clear(); - filteredItems.addAll(completed); - }; - - items.addListener((ListChangeListener<T>) c -> { - c.next(); - - listener.invalidated(null); - - if (c.wasAdded()) { - c.getAddedSubList() - .forEach(item -> conditionExtractor.apply(item).addListener(listener)); - } - - if (c.wasRemoved()) { - c.getRemoved() - .forEach(item -> conditionExtractor.apply(item).removeListener(listener)); - } - }); - - return filteredItems; - } - - - + + public static <T> ObservableList<T> filter(ObservableList<T> items, + Function<T, ObservableBooleanValue> conditionExtractor) { + + return filterInternal(items, conditionExtractor, t -> conditionExtractor.apply(t).get()); + } + + public static <T> ObservableList<T> filterInverted(ObservableList<T> items, + Function<T, ObservableBooleanValue> conditionExtractor) { + + return filterInternal(items, conditionExtractor, t -> !conditionExtractor.apply(t).get()); + } + + private static <T> ObservableList<T> filterInternal(ObservableList<T> items, + Function<T, ObservableBooleanValue> conditionExtractor, final Predicate<T> predicate) { + final ObservableList<T> filteredItems = FXCollections.observableArrayList(); + final InvalidationListener listener = observable -> { + final List<T> completed = items.stream().filter(predicate).collect(Collectors.toList()); + + filteredItems.clear(); + filteredItems.addAll(completed); + }; + + items.addListener((ListChangeListener<T>) c -> { + c.next(); + + listener.invalidated(null); + + if (c.wasAdded()) { + c.getAddedSubList().forEach(item -> conditionExtractor.apply(item).addListener(listener)); + } + + if (c.wasRemoved()) { + c.getRemoved().forEach(item -> conditionExtractor.apply(item).removeListener(listener)); + } + }); + + return filteredItems; + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java index fbc81c8cb..c44645308 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java @@ -6,4 +6,5 @@ * @author manuel.mauky */ public class MainView implements FxmlView<MainViewModel> { + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java index 7f08f2b23..9c08c71ad 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java @@ -6,4 +6,5 @@ * @author manuel.mauky */ public class MainViewModel implements ViewModel { + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java index f9bf47abd..7e71d7894 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java @@ -11,21 +11,23 @@ * @author manuel.mauky */ public class AddItemsView implements FxmlView<AddItemsViewModel> { - @FXML - public CheckBox selectAll; - @FXML - public TextField addInput; - - @InjectViewModel - private AddItemsViewModel viewModel; - - public void initialize() { - addInput.textProperty().bindBidirectional(viewModel.newItemValueProperty()); - - addInput.setOnAction(event -> viewModel.addItem()); - - selectAll.selectedProperty().bindBidirectional(viewModel.allSelectedProperty()); - - selectAll.visibleProperty().bind(viewModel.allSelectedVisibleProperty()); - } + + @FXML + public CheckBox selectAll; + @FXML + public TextField addInput; + + @InjectViewModel + private AddItemsViewModel viewModel; + + public void initialize() { + addInput.textProperty().bindBidirectional(viewModel.newItemValueProperty()); + + addInput.setOnAction(event -> viewModel.addItem()); + + selectAll.selectedProperty().bindBidirectional(viewModel.allSelectedProperty()); + + selectAll.visibleProperty().bind(viewModel.allSelectedVisibleProperty()); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java index 952c23d5d..2a4d652be 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java @@ -16,41 +16,38 @@ * @author manuel.mauky */ public class AddItemsViewModel implements ViewModel { - - - private BooleanProperty allSelected = new SimpleBooleanProperty(); - private StringProperty newItemValue = new SimpleStringProperty(""); - - private ReadOnlyBooleanWrapper allSelectedVisible = new ReadOnlyBooleanWrapper(); - - public AddItemsViewModel() { - allSelected.addListener((obs, oldV, newV) -> { - TodoItemStore.getInstance().getItems() - .forEach(item -> item.setCompleted(newV)); - }); - - allSelectedVisible.bind(Bindings.isEmpty(TodoItemStore.getInstance().getItems()).not()); - } - - - public void addItem() { - final String newValue = newItemValue.get(); - if (newValue != null && !newValue.trim().isEmpty()) { - TodoItemStore.getInstance().getItems().add(new TodoItem(newValue)); - newItemValue.set(""); - } - } - - public StringProperty newItemValueProperty() { - return newItemValue; - } - - - public BooleanProperty allSelectedProperty() { - return allSelected; - } - - public ReadOnlyBooleanProperty allSelectedVisibleProperty() { - return allSelectedVisible; - } + + private final BooleanProperty allSelected = new SimpleBooleanProperty(); + private final StringProperty newItemValue = new SimpleStringProperty(""); + + private final ReadOnlyBooleanWrapper allSelectedVisible = new ReadOnlyBooleanWrapper(); + + public AddItemsViewModel() { + allSelected.addListener((obs, oldV, newV) -> { + TodoItemStore.getInstance().getItems().forEach(item -> item.setCompleted(newV)); + }); + + allSelectedVisible.bind(Bindings.isEmpty(TodoItemStore.getInstance().getItems()).not()); + } + + public void addItem() { + final String newValue = newItemValue.get(); + if (newValue != null && !newValue.trim().isEmpty()) { + TodoItemStore.getInstance().getItems().add(new TodoItem(newValue)); + newItemValue.set(""); + } + } + + public StringProperty newItemValueProperty() { + return newItemValue; + } + + public BooleanProperty allSelectedProperty() { + return allSelected; + } + + public ReadOnlyBooleanProperty allSelectedVisibleProperty() { + return allSelectedVisible; + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java index abb0bf081..ec25bfca0 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java @@ -9,26 +9,27 @@ * @author manuel.mauky */ public class ControlsView implements FxmlView<ControlsViewModel> { - - @FXML - public Label itemsLeftLabel; - - @InjectViewModel - private ControlsViewModel viewModel; - - public void initialize() { - itemsLeftLabel.textProperty().bind(viewModel.itemsLeftLabelTextProperty()); - } - - public void all() { - viewModel.all(); - } - - public void active() { - viewModel.active(); - } - - public void completed() { - viewModel.completed(); - } + + @FXML + public Label itemsLeftLabel; + + @InjectViewModel + private ControlsViewModel viewModel; + + public void initialize() { + itemsLeftLabel.textProperty().bind(viewModel.itemsLeftLabelTextProperty()); + } + + public void all() { + viewModel.all(); + } + + public void active() { + viewModel.active(); + } + + public void completed() { + viewModel.completed(); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java index 0196ab7a3..433dccd1d 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java @@ -18,35 +18,36 @@ * @author manuel.mauky */ public class ControlsViewModel implements ViewModel { - - private StringProperty itemsLeftLabelText = new SimpleStringProperty(); - - private NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); - - public ControlsViewModel() { - final ObservableList<TodoItem> items = TodoItemStore.getInstance().getItems(); - - ObservableList<TodoItem> completedItems = FilterHelper.filterInverted(items, TodoItem::completedProperty); - - final IntegerBinding size = Bindings.size(completedItems); - - final StringBinding itemsLabel = Bindings.when(size.isEqualTo(1)).then("item").otherwise("items"); - itemsLeftLabelText.bind(Bindings.concat(size, " ", itemsLabel, " left")); - } - - public StringProperty itemsLeftLabelTextProperty() { - return itemsLeftLabelText; - } - - public void all() { - notificationCenter.publish("showAll"); - } - - public void active() { - notificationCenter.publish("showActive"); - } - - public void completed() { - notificationCenter.publish("showCompleted"); - } + + private final StringProperty itemsLeftLabelText = new SimpleStringProperty(); + + private final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); + + public ControlsViewModel() { + final ObservableList<TodoItem> items = TodoItemStore.getInstance().getItems(); + + ObservableList<TodoItem> completedItems = FilterHelper.filterInverted(items, TodoItem::completedProperty); + + final IntegerBinding size = Bindings.size(completedItems); + + final StringBinding itemsLabel = Bindings.when(size.isEqualTo(1)).then("item").otherwise("items"); + itemsLeftLabelText.bind(Bindings.concat(size, " ", itemsLabel, " left")); + } + + public StringProperty itemsLeftLabelTextProperty() { + return itemsLeftLabelText; + } + + public void all() { + notificationCenter.publish("showAll"); + } + + public void active() { + notificationCenter.publish("showActive"); + } + + public void completed() { + notificationCenter.publish("showCompleted"); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java index 54c4bba36..ca879d951 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java @@ -12,16 +12,15 @@ */ public class ItemOverviewView implements FxmlView<ItemOverviewViewModel> { - @FXML - public ListView<ItemViewModel> items; + @FXML + public ListView<ItemViewModel> items; - @InjectViewModel - private ItemOverviewViewModel viewModel; + @InjectViewModel + private ItemOverviewViewModel viewModel; - public void initialize() { - items.setItems(viewModel.itemsProperty()); - - items.setCellFactory(CachedViewModelCellFactory.createForFxmlView(ItemView.class)); - } + public void initialize() { + items.setItems(viewModel.itemsProperty()); + items.setCellFactory(CachedViewModelCellFactory.createForFxmlView(ItemView.class)); + } } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java index e34e61e29..fde0ca8a6 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java @@ -16,42 +16,41 @@ * @author manuel.mauky */ public class ItemOverviewViewModel implements ViewModel { - - private ListProperty<ItemViewModel> items = new SimpleListProperty<>(); - - private final ListTransformation<TodoItem, ItemViewModel> allItems; - private final ObservableList<ItemViewModel> completedItems; - private final ObservableList<ItemViewModel> activeItems; - - public ItemOverviewViewModel() { - allItems = new ListTransformation<>(TodoItemStore.getInstance().getItems(), ItemViewModel::new); - - completedItems = FilterHelper.filter(allItems.getTargetList(), ItemViewModel::completedProperty); - activeItems = FilterHelper.filterInverted(allItems.getTargetList(), ItemViewModel::completedProperty); - - showAllItems(); - - - final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); - notificationCenter.subscribe("showAll", (key, payload) -> showAllItems()); - notificationCenter.subscribe("showActive", (key, payload) -> showActiveItems()); - notificationCenter.subscribe("showCompleted", (key, payload) -> showCompletedItems()); - } - - private void showAllItems() { - items.set(allItems.getTargetList()); - } - - private void showCompletedItems() { - items.setValue(completedItems); - } - - private void showActiveItems() { - items.setValue(activeItems); - } - - - public ObservableList<ItemViewModel> itemsProperty() { - return items; - } + + private final ListProperty<ItemViewModel> items = new SimpleListProperty<>(); + + private final ListTransformation<TodoItem, ItemViewModel> allItems; + private final ObservableList<ItemViewModel> completedItems; + private final ObservableList<ItemViewModel> activeItems; + + public ItemOverviewViewModel() { + allItems = new ListTransformation<>(TodoItemStore.getInstance().getItems(), ItemViewModel::new); + + completedItems = FilterHelper.filter(allItems.getTargetList(), ItemViewModel::completedProperty); + activeItems = FilterHelper.filterInverted(allItems.getTargetList(), ItemViewModel::completedProperty); + + showAllItems(); + + final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); + notificationCenter.subscribe("showAll", (key, payload) -> showAllItems()); + notificationCenter.subscribe("showActive", (key, payload) -> showActiveItems()); + notificationCenter.subscribe("showCompleted", (key, payload) -> showCompletedItems()); + } + + private void showAllItems() { + items.set(allItems.getTargetList()); + } + + private void showCompletedItems() { + items.setValue(completedItems); + } + + private void showActiveItems() { + items.setValue(activeItems); + } + + public ObservableList<ItemViewModel> itemsProperty() { + return items; + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java index 5aa1e84a4..fb1465828 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java @@ -14,72 +14,72 @@ * @author manuel.mauky */ public class ItemView implements FxmlView<ItemViewModel> { - - public static final String STRIKETHROUGH_CSS_CLASS = "strikethrough"; - @FXML - public CheckBox completed; - @FXML - public TextField contentInput; - - @FXML - public HBox contentBox; - - @FXML - public Label contentLabel; - - @FXML - public Button deleteButton; - @FXML - public HBox root; - - @InjectViewModel - private ItemViewModel viewModel; - - - public void initialize() { - deleteButton.setVisible(false); - root.setOnMouseEntered(event -> { - deleteButton.setVisible(true); - }); - - root.setOnMouseExited(event -> { - deleteButton.setVisible(false); - }); - - completed.selectedProperty().bindBidirectional(viewModel.completedProperty()); - - contentInput.textProperty().bindBidirectional(viewModel.contentProperty()); - contentInput.visibleProperty().bind(viewModel.editModeProperty()); - contentInput.setOnAction(event -> viewModel.editModeProperty().set(false)); - contentInput.focusedProperty().addListener((obs, oldV, newV) -> { - if (!newV) { - viewModel.editModeProperty().set(false); - } - }); - - contentBox.visibleProperty().bind(viewModel.editModeProperty().not()); - completed.visibleProperty().bind(viewModel.editModeProperty().not()); - - contentLabel.textProperty().bind(viewModel.contentProperty()); - contentLabel.setOnMouseClicked(event -> { - if (event.getClickCount() > 1) { - viewModel.editModeProperty().set(true); - contentInput.requestFocus(); - } - }); - - - viewModel.textStrikeThrough().addListener((obs, oldV, newV) -> { - if (newV) { - contentLabel.getStyleClass().add(STRIKETHROUGH_CSS_CLASS); - } else { - contentLabel.getStyleClass().remove(STRIKETHROUGH_CSS_CLASS); - } - }); - - } - - public void delete() { - viewModel.delete(); - } + + public static final String STRIKETHROUGH_CSS_CLASS = "strikethrough"; + + @FXML + public CheckBox completed; + @FXML + public TextField contentInput; + + @FXML + public HBox contentBox; + + @FXML + public Label contentLabel; + + @FXML + public Button deleteButton; + @FXML + public HBox root; + + @InjectViewModel + private ItemViewModel viewModel; + + public void initialize() { + deleteButton.setVisible(false); + root.setOnMouseEntered(event -> { + deleteButton.setVisible(true); + }); + + root.setOnMouseExited(event -> { + deleteButton.setVisible(false); + }); + + completed.selectedProperty().bindBidirectional(viewModel.completedProperty()); + + contentInput.textProperty().bindBidirectional(viewModel.contentProperty()); + contentInput.visibleProperty().bind(viewModel.editModeProperty()); + contentInput.setOnAction(event -> viewModel.editModeProperty().set(false)); + contentInput.focusedProperty().addListener((obs, oldV, newV) -> { + if (!newV) { + viewModel.editModeProperty().set(false); + } + }); + + contentBox.visibleProperty().bind(viewModel.editModeProperty().not()); + completed.visibleProperty().bind(viewModel.editModeProperty().not()); + + contentLabel.textProperty().bind(viewModel.contentProperty()); + contentLabel.setOnMouseClicked(event -> { + if (event.getClickCount() > 1) { + viewModel.editModeProperty().set(true); + contentInput.requestFocus(); + } + }); + + viewModel.textStrikeThrough().addListener((obs, oldV, newV) -> { + if (newV) { + contentLabel.getStyleClass().add(STRIKETHROUGH_CSS_CLASS); + } else { + contentLabel.getStyleClass().remove(STRIKETHROUGH_CSS_CLASS); + } + }); + + } + + public void delete() { + viewModel.delete(); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java index 000966f0d..45b541e7a 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java @@ -14,42 +14,42 @@ * @author manuel.mauky */ public class ItemViewModel implements ViewModel { - - private BooleanProperty completed = new SimpleBooleanProperty(); - - private BooleanProperty editMode = new SimpleBooleanProperty(); - - private StringProperty content = new SimpleStringProperty(); - - private TodoItem item; - - public ItemViewModel(TodoItem item) { - this.item = item; - content.bindBidirectional(item.textProperty()); - completed.bindBidirectional(item.completedProperty()); - } - - public void delete() { - TodoItemStore.getInstance().getItems().remove(item); - } - - public StringProperty contentProperty() { - return content; - } - - public BooleanProperty completedProperty() { - return completed; - } - - public boolean isCompleted() { - return completed.get(); - } - - public BooleanProperty editModeProperty() { - return editMode; - } - - public ReadOnlyBooleanProperty textStrikeThrough() { - return completed; - } + + private final BooleanProperty completed = new SimpleBooleanProperty(); + private final BooleanProperty editMode = new SimpleBooleanProperty(); + + private final StringProperty content = new SimpleStringProperty(); + + private TodoItem item; + + public ItemViewModel(TodoItem item) { + this.item = item; + content.bindBidirectional(item.textProperty()); + completed.bindBidirectional(item.completedProperty()); + } + + public void delete() { + TodoItemStore.getInstance().getItems().remove(item); + } + + public StringProperty contentProperty() { + return content; + } + + public BooleanProperty completedProperty() { + return completed; + } + + public boolean isCompleted() { + return completed.get(); + } + + public BooleanProperty editModeProperty() { + return editMode; + } + + public ReadOnlyBooleanProperty textStrikeThrough() { + return completed; + } + } diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml index 3f0db24c0..267f754f8 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml @@ -8,15 +8,15 @@ <?import java.net.URL?> <VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.MainView"> - <children> - <Label id="title" text="todos"/> - <fx:include source="additems/AddItemsView.fxml"/> - <fx:include source="item/ItemOverviewView.fxml" VBox.vgrow="ALWAYS"/> - <fx:include source="controls/ControlsView.fxml"/> - </children> - <stylesheets> - <URL value="@main.css"/> - </stylesheets> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.MainView"> + <children> + <Label id="title" text="todos"/> + <fx:include source="additems/AddItemsView.fxml"/> + <fx:include source="item/ItemOverviewView.fxml" VBox.vgrow="ALWAYS"/> + <fx:include source="controls/ControlsView.fxml"/> + </children> + <stylesheets> + <URL value="@main.css"/> + </stylesheets> </VBox> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml index cf656c101..13addea26 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml @@ -6,12 +6,12 @@ <?import java.net.URL?> <HBox styleClass="add_item_root" fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.additems.AddItemsView" - alignment="CENTER_LEFT" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> - <children> - <CheckBox fx:id="selectAll" mnemonicParsing="false"/> - <TextField fx:id="addInput" promptText="What needs to be done?" HBox.hgrow="ALWAYS"/> - </children> - <stylesheets> - <URL value="@additems.css"/> - </stylesheets> + alignment="CENTER_LEFT" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <CheckBox fx:id="selectAll" mnemonicParsing="false"/> + <TextField fx:id="addInput" promptText="What needs to be done?" HBox.hgrow="ALWAYS"/> + </children> + <stylesheets> + <URL value="@additems.css"/> + </stylesheets> </HBox> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml index dbb275a96..02b170405 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml @@ -6,25 +6,25 @@ <?import javafx.scene.layout.*?> <HBox fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.controls.ControlsView" alignment="CENTER" spacing="20.0" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> - <children> - <Label fx:id="itemsLeftLabel" text="X items left"/> - <HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="10.0"> - <children> - <ToggleButton mnemonicParsing="false" onAction="#all" selected="true" text="All"> - <toggleGroup> - <ToggleGroup fx:id="stateGroup"/> - </toggleGroup> - </ToggleButton> - <ToggleButton mnemonicParsing="false" onAction="#active" text="Active" toggleGroup="$stateGroup"/> - <ToggleButton mnemonicParsing="false" onAction="#completed" text="Completed" toggleGroup="$stateGroup"/> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </padding> - </HBox> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </padding> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <Label fx:id="itemsLeftLabel" text="X items left"/> + <HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="10.0"> + <children> + <ToggleButton mnemonicParsing="false" onAction="#all" selected="true" text="All"> + <toggleGroup> + <ToggleGroup fx:id="stateGroup"/> + </toggleGroup> + </ToggleButton> + <ToggleButton mnemonicParsing="false" onAction="#active" text="Active" toggleGroup="$stateGroup"/> + <ToggleButton mnemonicParsing="false" onAction="#completed" text="Completed" toggleGroup="$stateGroup"/> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </padding> + </HBox> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </padding> </HBox> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml index 84f5c726e..b4f3f6e02 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml @@ -5,10 +5,9 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" - minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemOverviewView"> - <children> - <ListView fx:id="items" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"/> - </children> + minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemOverviewView"> + <children> + <ListView fx:id="items" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/> + </children> </AnchorPane> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml index 4384aa6d7..da23ee56d 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml @@ -9,28 +9,28 @@ <?import java.net.URL?> <HBox fx:id="root" alignment="CENTER_LEFT" minHeight="-Infinity" minWidth="-Infinity" styleClass="item_root" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemView"> - <children> - <CheckBox fx:id="completed" mnemonicParsing="false"/> - <StackPane alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> - <children> - <HBox fx:id="contentBox" styleClass="content_box"> - <children> - <Label fx:id="contentLabel" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" - text="Label" HBox.hgrow="ALWAYS"/> - <Button fx:id="deleteButton" mnemonicParsing="false" onAction="#delete"> - <graphic> - <FontAwesomeIcon glyphName="CLOSE" size="1.5em" styleClass="close_icon"/> - </graphic> - </Button> - </children> - </HBox> - <TextField fx:id="contentInput" promptText="What needs to be done?" visible="false"/> - </children> - </StackPane> - </children> - <stylesheets> - <URL value="@itemview.css"/> - </stylesheets> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemView"> + <children> + <CheckBox fx:id="completed" mnemonicParsing="false"/> + <StackPane alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> + <children> + <HBox fx:id="contentBox" styleClass="content_box"> + <children> + <Label fx:id="contentLabel" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" + text="Label" HBox.hgrow="ALWAYS"/> + <Button fx:id="deleteButton" mnemonicParsing="false" onAction="#delete"> + <graphic> + <FontAwesomeIcon glyphName="CLOSE" size="1.5em" styleClass="close_icon"/> + </graphic> + </Button> + </children> + </HBox> + <TextField fx:id="contentInput" promptText="What needs to be done?" visible="false"/> + </children> + </StackPane> + </children> + <stylesheets> + <URL value="@itemview.css"/> + </stylesheets> </HBox> From ba853e281e539ad37802de3023a121a8d771a25c Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 16 Feb 2016 14:34:08 +0100 Subject: [PATCH 51/96] Fix for #359. Made ValidationMessage class extendable --- .../utils/validation/ValidationMessage.java | 2 +- .../CustomValidationMessageTest.java | 66 +++++++++++++++++++ .../FunctionBasedValidatorTest.java | 1 - 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CustomValidationMessageTest.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java index 0bba3e635..8eb42060b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java @@ -27,7 +27,7 @@ public class ValidationMessage { private final Severity severity; - ValidationMessage(Severity severity, String message) { + public ValidationMessage(Severity severity, String message) { this.message = message; this.severity = severity; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CustomValidationMessageTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CustomValidationMessageTest.java new file mode 100644 index 000000000..f9c9417e5 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/CustomValidationMessageTest.java @@ -0,0 +1,66 @@ +package de.saxsys.mvvmfx.utils.validation; + +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; +import org.junit.Test; + +import java.util.function.Predicate; + +import static org.assertj.core.api.Assertions.assertThat; + + +/** + * This test class shows how you can create custom {@link ValidationMessage}s. + */ +public class CustomValidationMessageTest { + + + static class MyCustomValidationMessage extends ValidationMessage { + private final double errorValue; + + public static ValidationMessage factory(double errorValue) { + return new MyCustomValidationMessage(Severity.ERROR, "Error", errorValue); + } + + public MyCustomValidationMessage(Severity severity, String message, double errorValue) { + super(severity, message); + this.errorValue = errorValue; + } + + public double getErrorValue() { + return errorValue; + } + } + + + @Test + public void test() { + + StringProperty value = new SimpleStringProperty(); + + final Predicate<String> predicate = v -> v != null; + + Validator validator = new FunctionBasedValidator<>(value, predicate, MyCustomValidationMessage.factory(10.3)); + + ValidationStatus validationStatus = validator.getValidationStatus(); + + + + value.setValue(null); + + + assertThat(validationStatus.isValid()).isFalse(); + assertThat(validationStatus.getMessages()).hasSize(1); + + ValidationMessage validationMessage = validationStatus.getMessages().get(0); + + assertThat(validationMessage).isInstanceOf(MyCustomValidationMessage.class); + + MyCustomValidationMessage myCustomValidationMessage = (MyCustomValidationMessage) validationMessage; + + assertThat(myCustomValidationMessage.getErrorValue()).isEqualTo(10.3); + + + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java index 380fb29b6..17fbc3a0e 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/FunctionBasedValidatorTest.java @@ -56,7 +56,6 @@ public void testFunctionVariant() { if (v == null) { return ValidationMessage.error("null"); } - ; if (v.isEmpty()) { return ValidationMessage.error("empty"); From fe0ef784a543d29dabba6f3073dabfa114ecc1db Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 16 Feb 2016 18:37:41 +0100 Subject: [PATCH 52/96] Fix for #314. initialization of existing ViewModels isn't done anymore for fxmlViews --- .../internal/viewloader/FxmlViewLoader.java | 23 ++++--- .../internal/viewloader/JavaViewLoader.java | 7 +- .../viewloader/ViewLoaderReflectionUtils.java | 69 +++++++++---------- .../FluentViewLoader_FxmlView_Test.java | 6 +- .../FluentViewLoader_JavaView_Test.java | 2 +- 5 files changed, 59 insertions(+), 48 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 37cd80f46..d0c512624 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -27,6 +27,7 @@ import java.net.URL; import java.util.Optional; import java.util.ResourceBundle; +import java.util.function.Consumer; /** * This viewLoader is used to load views that are implementing {@link de.saxsys.mvvmfx.FxmlView}. @@ -147,6 +148,13 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi // otherwise we create a new ViewModel. This is needed because the ViewTuple has to contain a VM even if the codeBehind doesn't need one if (actualViewModel == null) { actualViewModel = ViewLoaderReflectionUtils.createViewModel(loadedController); + + + // it is possible that no viewModel could be created (f.e. when no generic VM type was specified) + // otherwise we need to initialize the created ViewModel instance. + if(actualViewModel != null) { + ViewLoaderReflectionUtils.initializeViewModel(actualViewModel); + } } } else { actualViewModel = viewModel; @@ -228,16 +236,13 @@ public Object call(Class<?> type) { private static void handleInjection(View codeBehind, ResourceBundle resourceBundle) { ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); + + Consumer<ViewModel> newVmConsumer = viewModel -> { + ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); + ViewLoaderReflectionUtils.initializeViewModel(viewModel); + }; - final Optional viewModelOptional = ViewLoaderReflectionUtils.createAndInjectViewModel(codeBehind); - - if (viewModelOptional.isPresent()) { - final Object viewModel = viewModelOptional.get(); - if (viewModel instanceof ViewModel) { - ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - ViewLoaderReflectionUtils.initializeViewModel((ViewModel) viewModel); - } - } + ViewLoaderReflectionUtils.createAndInjectViewModel(codeBehind, newVmConsumer); } private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, ViewModel viewModel) { diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index d31cad1ec..825b8a3e8 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -107,7 +107,12 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi } else { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - ViewLoaderReflectionUtils.initializeViewModel(viewModel); + + // if the user has provided an existing ViewModel, we will not (re-)initialize this existing instance + if(existingViewModel == null) { + ViewLoaderReflectionUtils.initializeViewModel(viewModel); + } + ViewLoaderReflectionUtils.injectViewModel(view, viewModel); } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 0aa2a48aa..29a013389 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -1,9 +1,5 @@ package de.saxsys.mvvmfx.internal.viewloader; -import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.ViewModel; -import net.jodah.typetools.TypeResolver; - import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -11,8 +7,13 @@ import java.security.PrivilegedAction; import java.util.List; import java.util.Optional; +import java.util.function.Consumer; import java.util.stream.Collectors; +import net.jodah.typetools.TypeResolver; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.ViewModel; + /** * This class encapsulates reflection related utility operations specific for loading of views. * @@ -135,11 +136,21 @@ public static void injectViewModel(final View view, ViewModel viewModel) { } /** - * This method is used to create and inject the ViewModel for a given View instance. The ViewModel is only created - * if the View has a suitable field for the ViewModel. + * This method is used to create and inject the ViewModel for a given View instance. + * + * The following checks are done: + * <ul> + * <li>Check whether the View class specifies a ViewModel type as generic type.</li> + * <li>Check whether the View has a field with a matching ViewModel type and the annotation {@link InjectViewModel}. + * </li> + * + * <li>Check whether field in the view instance already contains a ViewModel instance. In this case nothing will + * happen to the existing ViewModel instance.</li> + * + * </ul> * - * If a ViewModel was created OR there was already a ViewModel set in the View, this viewModel instance is returned - * via an Optional. + * If a suitable field was found a new ViewModel instance will be created and injected into the field. After that + * the given Consumer function will be applied with the injected ViewModel instance as argument. * * @param view * the view instance. @@ -147,16 +158,16 @@ public static void injectViewModel(final View view, ViewModel viewModel) { * the generic type of the View. * @param <VM> * the generic type of the ViewModel. - * @return an Optional containing the ViewModel if it was created or already existing. Otherwise the Optional is - * empty. - * + * @param newVmConsumer + * a Consumer function that is applied when a new ViewModel instance is created. + * * @throws RuntimeException * if there is a ViewModel field in the View with the {@link InjectViewModel} annotation whose type * doesn't match the generic ViewModel type from the View class. */ @SuppressWarnings("unchecked") - public static <V extends View<? extends VM>, VM extends ViewModel> Optional<VM> createAndInjectViewModel( - final V view) { + public static <V extends View<? extends VM>, VM extends ViewModel> void createAndInjectViewModel( + final V view, Consumer<ViewModel> newVmConsumer) { final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); if (viewModelType == ViewModel.class) { @@ -166,45 +177,30 @@ public static <V extends View<? extends VM>, VM extends ViewModel> Optional<VM> if(!viewModelFields.isEmpty()) { throw new RuntimeException("The given view of type <" + view.getClass() + "> has no generic viewModel type declared but tries to inject a viewModel."); } - - - return Optional.empty(); + return; } if (viewModelType == TypeResolver.Unknown.class) { - return Optional.empty(); + return; } final Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModelType); if (fieldOptional.isPresent()) { Field field = fieldOptional.get(); - Object viewModel = ReflectionUtils.accessField(field, () -> { + ReflectionUtils.accessField(field, () -> { Object existingViewModel = field.get(view); - - if (existingViewModel != null) { - return existingViewModel; - } else { + + if (existingViewModel == null) { final Object newViewModel = DependencyInjector.getInstance().getInstanceOf(viewModelType); field.set(view, newViewModel); - - return newViewModel; + + newVmConsumer.accept((ViewModel) newViewModel); } }, "Can't inject ViewModel of type <" + viewModelType + "> into the view <" + view + ">"); - if (viewModel == null) { - return Optional.empty(); - } - - try { - return Optional.of((VM) viewModel); - } catch (ClassCastException e) { - return Optional.empty(); - } } - - return Optional.empty(); } /** @@ -245,6 +241,9 @@ public static <ViewType extends View<? extends ViewModelType>, ViewModelType ext * the generic type of the ViewModel. */ public static <ViewModelType extends ViewModel> void initializeViewModel(ViewModelType viewModel) { + if(viewModel == null) { + return; + } try { final Method initMethod = viewModel.getClass().getMethod("initialize"); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java index 551ef47f4..20f324120 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_FxmlView_Test.java @@ -131,6 +131,8 @@ public void testViewWithoutViewModelType() { .getCodeBehind(); assertThat(codeBehind.wasInitialized).isTrue(); + + assertThat(viewTuple.getViewModel()).isNull(); } @Test @@ -239,7 +241,7 @@ public void testLoadFailNoSuchFxmlFile() { /** * The user can define a codeBehind instance that should be used by the viewLoader. When this codeBehind instance - * has already has a ViewModel it should not be overwritten when the view is loaded. + * already has a ViewModel it should not be overwritten when the view is loaded. */ @Test public void testAlreadyExistingViewModelShouldNotBeOverwritten() { @@ -430,7 +432,7 @@ public void testViewModelIsAvailableInViewTupleEvenIfItIsntInjectedInTheView() { /** * This test reproduces the <a href="https://github.com/sialcasa/mvvmFX/issues/292">bug #292</a> * Given the following conditions: - * 1. The View has no ViewModel field and not injection of the ViewModel. + * 1. The View has no ViewModel field and no injection of the ViewModel. * 2. While loading an existing ViewModel instance is passed to the {@link FluentViewLoader} * * Under this conditions the ViewLoader was still creating a new ViewModel instance or retrieved an instance diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java index 9a9407808..a1cfe7216 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/FluentViewLoader_JavaView_Test.java @@ -154,7 +154,7 @@ class TestView extends VBox implements JavaView { View codeBehind = viewTuple.getCodeBehind(); assertThat(codeBehind).isNotNull().isInstanceOf(TestView.class); - assertThat(TestViewModel.wasInitialized).isTrue(); + assertThat(TestViewModel.wasInitialized).isFalse(); } /** From da2841219c37ceb12b73440b9c09f3f7d805904a Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Thu, 25 Feb 2016 14:39:28 +0100 Subject: [PATCH 53/96] made constructor of ScopeStore private #353 --- mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java index 5a22def0f..bfabcfdc7 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java @@ -28,6 +28,9 @@ */ public class ScopeStore { + private ScopeStore() { + } + private final Map<String, Scope> scopes = new WeakValueHashMap(); private static final ScopeStore INSTANCE = new ScopeStore(); From b77d1005c7e3a5f6516450d9da5ad218398f1f66 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Thu, 25 Feb 2016 15:04:48 +0100 Subject: [PATCH 54/96] fix failing tests --- .../mvvmfx/scopes/ScopedViewModelA.java | 19 +++++++++---------- .../mvvmfx/scopes/ScopedViewModelB.java | 19 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 8854c9078..bc40150b4 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -41,13 +41,12 @@ public class ScopedViewModelA implements ViewModel { public final TestScope lazyScope1; public final TestScope lazyScope2; public final TestScope lazyScope3; - - - private final ScopeStore scopeStore = new ScopeStore(); - + + private final BooleanProperty reference = new SimpleBooleanProperty(); public ScopedViewModelA() { + ScopeStore scopeStore = ScopeStore.getInstance(); lazyScope1 = scopeStore.getScope(TestScope.class); lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); @@ -56,17 +55,17 @@ public ScopedViewModelA() { public void initialize() { // Create Potential Memory Leaks injectedScope1.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); injectedScope2.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); injectedScope3.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); lazyScope1.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); lazyScope2.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); lazyScope3.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); } } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java index 8bd4590d9..24c277bf0 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java @@ -42,13 +42,12 @@ public class ScopedViewModelB implements ViewModel { public final TestScope lazyScope1; public final TestScope lazyScope2; public final TestScope lazyScope3; - - - private final ScopeStore scopeStore = new ScopeStore(); - + + private final BooleanProperty reference = new SimpleBooleanProperty(); public ScopedViewModelB() { + ScopeStore scopeStore = ScopeStore.getInstance(); lazyScope1 = scopeStore.getScope(TestScope.class); lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); @@ -57,17 +56,17 @@ public ScopedViewModelB() { public void initialize() { // Create Potential Memory Leaks injectedScope1.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); injectedScope2.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); injectedScope3.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); lazyScope1.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); lazyScope2.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); lazyScope3.someProperty - .addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> reference.set(newValue)); + .addListener((observable, oldValue, newValue) -> reference.set(newValue)); } } From 424751592a269efcbfe4c467c8564722eb41c637 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 6 Mar 2016 21:18:21 +0100 Subject: [PATCH 55/96] Format sourcecode with tab intent (instead 4 spaces). --- examples/mini-examples/helloworld/pom.xml | 32 +++++++++---------- .../examples/helloworld/HelloWorldView.java | 18 +++++------ .../helloworld/HelloWorldViewModel.java | 20 ++++++------ .../mvvmfx/examples/helloworld/Starter.java | 24 +++++++------- .../examples/helloworld/HelloWorldView.fxml | 12 +++---- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/examples/mini-examples/helloworld/pom.xml b/examples/mini-examples/helloworld/pom.xml index 105238c39..f894c1b73 100644 --- a/examples/mini-examples/helloworld/pom.xml +++ b/examples/mini-examples/helloworld/pom.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>mini-examples</artifactId> - <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> - <artifactId>helloworld</artifactId> - <name>HelloWorld Example</name> + <artifactId>helloworld</artifactId> + <name>HelloWorld Example</name> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java index cecfb350f..7ddd4220c 100644 --- a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java +++ b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java @@ -11,15 +11,15 @@ public class HelloWorldView implements FxmlView<HelloWorldViewModel>, Initializable { - @FXML - private Label helloLabel; + @FXML + private Label helloLabel; - @InjectViewModel - private HelloWorldViewModel viewModel; + @InjectViewModel + private HelloWorldViewModel viewModel; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + helloLabel.textProperty().bind(viewModel.helloMessage()); + } - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - helloLabel.textProperty().bind(viewModel.helloMessage()); - } - } diff --git a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java index f01eb813b..16030aa45 100644 --- a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java +++ b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java @@ -7,18 +7,18 @@ public class HelloWorldViewModel implements ViewModel { - private final StringProperty helloMessage = new SimpleStringProperty("Hello World"); + private final StringProperty helloMessage = new SimpleStringProperty("Hello World"); - public StringProperty helloMessage() { - return helloMessage; - } + public StringProperty helloMessage() { + return helloMessage; + } - public String getHelloMessage() { - return helloMessage.get(); - } + public String getHelloMessage() { + return helloMessage.get(); + } - public void setHelloMessage(String message) { - helloMessage.set(message); - } + public void setHelloMessage(String message) { + helloMessage.set(message); + } } diff --git a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java index f8c66dda2..606deaa77 100644 --- a/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java +++ b/examples/mini-examples/helloworld/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java @@ -10,19 +10,19 @@ public class Starter extends Application { - public static void main(String... args) { - Application.launch(args); - } + public static void main(String... args) { + Application.launch(args); + } - @Override - public void start(Stage stage) throws Exception { - stage.setTitle("Hello World Application"); + @Override + public void start(Stage stage) throws Exception { + stage.setTitle("Hello World Application"); - final ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.fxmlView(HelloWorldView.class).load(); + final ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.fxmlView(HelloWorldView.class).load(); + + final Parent root = viewTuple.getView(); + stage.setScene(new Scene(root)); + stage.show(); + } - final Parent root = viewTuple.getView(); - stage.setScene(new Scene(root)); - stage.show(); - } - } diff --git a/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml b/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml index a7dd3cc92..a60aac5ca 100644 --- a/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml +++ b/examples/mini-examples/helloworld/src/main/resources/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.fxml @@ -4,10 +4,10 @@ <?import javafx.scene.control.Label?> <?import javafx.scene.layout.VBox?> <VBox alignment="CENTER" xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.examples.helloworld.HelloWorldView"> - <children> - <Label fx:id="helloLabel"/> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> - </padding> + <children> + <Label fx:id="helloLabel"/> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + </padding> </VBox> From 5dbe32e7895b8bf911fb653a9f6926c270737a75 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Sun, 6 Mar 2016 21:22:07 +0100 Subject: [PATCH 56/96] Format sourcecode with tab indentation (instead 4 spaces). --- .../helloworld-without-fxml/pom.xml | 32 +++++++++---------- .../examples/helloworld/HelloWorldView.java | 24 +++++++------- .../helloworld/HelloWorldViewModel.java | 20 ++++++------ .../mvvmfx/examples/helloworld/Starter.java | 24 +++++++------- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/examples/mini-examples/helloworld-without-fxml/pom.xml b/examples/mini-examples/helloworld-without-fxml/pom.xml index d69e997f3..bc2ff487f 100644 --- a/examples/mini-examples/helloworld-without-fxml/pom.xml +++ b/examples/mini-examples/helloworld-without-fxml/pom.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>mini-examples</artifactId> - <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> - <artifactId>helloworld-without-fxml</artifactId> - <name>HelloWorld Example without FXML</name> + <artifactId>helloworld-without-fxml</artifactId> + <name>HelloWorld Example without FXML</name> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java index 5069ff88b..1f55d108a 100644 --- a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java +++ b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldView.java @@ -12,19 +12,19 @@ public class HelloWorldView extends VBox implements JavaView<HelloWorldViewModel>, Initializable { - private final Label helloLabel = new Label(); + private final Label helloLabel = new Label(); - @InjectViewModel - private HelloWorldViewModel viewModel; + @InjectViewModel + private HelloWorldViewModel viewModel; - public HelloWorldView() { - getChildren().add(helloLabel); - setPadding(new Insets(10, 10, 10, 10)); - } + public HelloWorldView() { + getChildren().add(helloLabel); + setPadding(new Insets(10, 10, 10, 10)); + } + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + helloLabel.textProperty().bind(viewModel.helloMessage()); + } - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - helloLabel.textProperty().bind(viewModel.helloMessage()); - } - } diff --git a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java index f01eb813b..16030aa45 100644 --- a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java +++ b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/HelloWorldViewModel.java @@ -7,18 +7,18 @@ public class HelloWorldViewModel implements ViewModel { - private final StringProperty helloMessage = new SimpleStringProperty("Hello World"); + private final StringProperty helloMessage = new SimpleStringProperty("Hello World"); - public StringProperty helloMessage() { - return helloMessage; - } + public StringProperty helloMessage() { + return helloMessage; + } - public String getHelloMessage() { - return helloMessage.get(); - } + public String getHelloMessage() { + return helloMessage.get(); + } - public void setHelloMessage(String message) { - helloMessage.set(message); - } + public void setHelloMessage(String message) { + helloMessage.set(message); + } } diff --git a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java index 731568f07..9eab0daff 100644 --- a/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java +++ b/examples/mini-examples/helloworld-without-fxml/src/main/java/de/saxsys/mvvmfx/examples/helloworld/Starter.java @@ -10,19 +10,19 @@ public class Starter extends Application { - public static void main(String... args) { - Application.launch(args); - } + public static void main(String... args) { + Application.launch(args); + } - @Override - public void start(Stage stage) throws Exception { - stage.setTitle("Hello World Application"); + @Override + public void start(Stage stage) throws Exception { + stage.setTitle("Hello World Application"); - final ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.javaView(HelloWorldView.class).load(); + final ViewTuple<HelloWorldView, HelloWorldViewModel> viewTuple = FluentViewLoader.javaView(HelloWorldView.class).load(); + + final Parent root = viewTuple.getView(); + stage.setScene(new Scene(root)); + stage.show(); + } - final Parent root = viewTuple.getView(); - stage.setScene(new Scene(root)); - stage.show(); - } - } From ebc52c8f781fa65c0e133ad5cc82260916b47ef8 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Mon, 7 Mar 2016 21:47:58 +0100 Subject: [PATCH 57/96] Format sourcecode with tab indentation (instead 4 spaces). --- .../mvvmfx/examples/welcome/CdiStarter.java | 32 +-- .../mvvmfx/examples/welcome/GuiceStarter.java | 34 ++-- .../mvvmfx/examples/welcome/model/Gender.java | 6 +- .../mvvmfx/examples/welcome/model/Person.java | 186 +++++++++--------- .../examples/welcome/model/Repository.java | 66 +++---- .../view/maincontainer/MainContainerView.java | 114 +++++------ .../view/personlogin/PersonLoginView.java | 106 +++++----- .../view/personwelcome/PersonWelcomeView.java | 56 +++--- .../maincontainer/MainContainerViewModel.java | 14 +- .../personlogin/PersonLoginViewModel.java | 120 +++++------ .../PersonLoginViewModelNotifications.java | 24 +-- .../personwelcome/PersonWelcomeViewModel.java | 96 ++++----- .../view/maincontainer/MainContainerView.fxml | 28 +-- .../view/personlogin/PersonLoginView.fxml | 50 ++--- .../view/personwelcome/PersonWelcomeView.fxml | 18 +- .../personlogin/PersonLoginViewModelTest.java | 21 +- .../PersonWelcomeViewModelTest.java | 114 +++++------ 17 files changed, 543 insertions(+), 542 deletions(-) diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java index f0f6a7361..f0071307f 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/CdiStarter.java @@ -17,20 +17,20 @@ */ public class CdiStarter extends MvvmfxCdiApplication { - public static void main(String... args) { - launch(args); - } - - @Override - public void startMvvmfx(Stage stage) { - final ViewTuple<MainContainerView, MainContainerViewModel> tuple - = FluentViewLoader.fxmlView(MainContainerView.class).load(); - - Parent view = tuple.getView(); - - final Scene scene = new Scene(view); - stage.setScene(scene); - stage.show(); - } - + public static void main(String... args) { + launch(args); + } + + @Override + public void startMvvmfx(Stage stage) { + final ViewTuple<MainContainerView, MainContainerViewModel> tuple + = FluentViewLoader.fxmlView(MainContainerView.class).load(); + + Parent view = tuple.getView(); + + final Scene scene = new Scene(view); + stage.setScene(scene); + stage.show(); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java index 279fcb8bf..738340155 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/GuiceStarter.java @@ -17,21 +17,21 @@ */ public class GuiceStarter extends MvvmfxGuiceApplication { - public static void main(final String[] args) { - launch(args); - } - - @Override - public void startMvvmfx(final Stage stage) throws Exception { - final ViewTuple<MainContainerView, MainContainerViewModel> tuple - = FluentViewLoader.fxmlView(MainContainerView.class).load(); - - // Locate View for loaded FXML file - final Parent view = tuple.getView(); - - final Scene scene = new Scene(view); - stage.setScene(scene); - stage.show(); - } - + public static void main(final String[] args) { + launch(args); + } + + @Override + public void startMvvmfx(final Stage stage) throws Exception { + final ViewTuple<MainContainerView, MainContainerViewModel> tuple + = FluentViewLoader.fxmlView(MainContainerView.class).load(); + + // Locate View for loaded FXML file + final Parent view = tuple.getView(); + + final Scene scene = new Scene(view); + stage.setScene(scene); + stage.show(); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java index 0f2f6685f..fc71e75a4 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Gender.java @@ -6,8 +6,8 @@ */ public enum Gender { - MALE, - FEMALE, - NOT_SPECIFIED + MALE, + FEMALE, + NOT_SPECIFIED } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java index f6124a863..37a63c626 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Person.java @@ -16,98 +16,98 @@ */ public class Person { - private int technicalID; - private final StringProperty firstName = new SimpleStringProperty(); - private final StringProperty lastName = new SimpleStringProperty(); - private final ObjectProperty<Gender> gender = new SimpleObjectProperty<>(); - - /** - * Creates a person with given name. - * - * @param firstName of person - * @param lastName of person - * @param gender of person - */ - public Person(final String firstName, final String lastName, Gender gender) { - this.firstName.set(firstName); - this.lastName.set(lastName); - this.gender.set(gender); - } - - /** - * @return firstname as {@link StringProperty} - */ - public StringProperty firstNameProperty() { - return firstName; - } - - /** - * @return lastname as {@link StringProperty} - */ - public StringProperty lastNameProperty() { - return lastName; - } - - /** - * @return the gender of the person as {@link ObjectProperty}. - */ - public ObjectProperty<Gender> genderProperty() { - return gender; - } - - /** - * @return firstname as {@link String} - */ - public String getFirstName() { - return firstNameProperty().get(); - } - - /** - * @see #getFirstName() - * @param firstName - */ - public void setFirstName(final String firstName) { - firstNameProperty().set(firstName); - } - - /** - * @return lastname as {@link String} - */ - public String getLastName() { - return lastNameProperty().get(); - } - - /** - * @see #getLastName() - */ - public void setLastName(final String lastName) { - lastNameProperty().set(lastName); - } - - /** - * @return the gender of the person as {@link String} - */ - public Gender getGender() { - return gender.get(); - } - - /** - * @see #getGender() - */ - public void setGender(Gender gender) { - this.gender.set(gender); - } - - /** - * Gets the technical id. - * - * @return technical id - */ - public int getId() { - if (technicalID == 0) { - technicalID = new Random().nextInt(); - } - return technicalID; - } + private int technicalID; + private final StringProperty firstName = new SimpleStringProperty(); + private final StringProperty lastName = new SimpleStringProperty(); + private final ObjectProperty<Gender> gender = new SimpleObjectProperty<>(); + + /** + * Creates a person with given name. + * + * @param firstName of person + * @param lastName of person + * @param gender of person + */ + public Person(final String firstName, final String lastName, Gender gender) { + this.firstName.set(firstName); + this.lastName.set(lastName); + this.gender.set(gender); + } + + /** + * @return firstname as {@link StringProperty} + */ + public StringProperty firstNameProperty() { + return firstName; + } + + /** + * @return lastname as {@link StringProperty} + */ + public StringProperty lastNameProperty() { + return lastName; + } + + /** + * @return the gender of the person as {@link ObjectProperty}. + */ + public ObjectProperty<Gender> genderProperty() { + return gender; + } + + /** + * @return firstname as {@link String} + */ + public String getFirstName() { + return firstNameProperty().get(); + } + + /** + * @see #getFirstName() + * @param firstName + */ + public void setFirstName(final String firstName) { + firstNameProperty().set(firstName); + } + + /** + * @return lastname as {@link String} + */ + public String getLastName() { + return lastNameProperty().get(); + } + + /** + * @see #getLastName() + */ + public void setLastName(final String lastName) { + lastNameProperty().set(lastName); + } + + /** + * @return the gender of the person as {@link String} + */ + public Gender getGender() { + return gender.get(); + } + + /** + * @see #getGender() + */ + public void setGender(Gender gender) { + this.gender.set(gender); + } + + /** + * Gets the technical id. + * + * @return technical id + */ + public int getId() { + if (technicalID == 0) { + technicalID = new Random().nextInt(); + } + return technicalID; + } } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java index 7fe11f74e..3c40ceb9c 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/model/Repository.java @@ -13,38 +13,38 @@ @Singleton public class Repository { - List<Person> persons = new ArrayList<Person>(); - - /** - * Creates the Repo. - */ - public Repository() { - persons.add(new Person("Alexander", "Casall", Gender.MALE)); - persons.add(new Person("Bernd", "Grams", Gender.MALE)); - persons.add(new Person("Anna", "Schulze", Gender.FEMALE)); - persons.add(new Person("Andy", "Mueller", Gender.NOT_SPECIFIED)); - } - - /** - * @return available {@link Person}s - */ - public List<Person> getPersons() { - return persons; - } - - /** - * Gets a Person.s - * - * @param id of the person - * @return person - */ - public Person getPersonById(final int id) { - for (Person person : persons) { - if (id == person.getId()) { - return person; - } - } - return null; - } + List<Person> persons = new ArrayList<Person>(); + + /** + * Creates the Repo. + */ + public Repository() { + persons.add(new Person("Alexander", "Casall", Gender.MALE)); + persons.add(new Person("Bernd", "Grams", Gender.MALE)); + persons.add(new Person("Anna", "Schulze", Gender.FEMALE)); + persons.add(new Person("Andy", "Mueller", Gender.NOT_SPECIFIED)); + } + + /** + * @return available {@link Person}s + */ + public List<Person> getPersons() { + return persons; + } + + /** + * Gets a Person.s + * + * @param id of the person + * @return person + */ + public Person getPersonById(final int id) { + for (Person person : persons) { + if (id == person.getId()) { + return person; + } + } + return null; + } } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java index d0dcbc984..a74256cce 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.java @@ -33,70 +33,70 @@ */ public class MainContainerView implements FxmlView<MainContainerViewModel>, Initializable { - @FXML - // Injection of the login which is declared in the FXML File - private StackPane loginView; // Value injected by FXMLLoader + @FXML + // Injection of the login which is declared in the FXML File + private StackPane loginView; // Value injected by FXMLLoader - @FXML + @FXML // Inject the Code behind instance of the loginView by using the - // nameconvention ...Controller - private PersonLoginView loginViewController; + // nameconvention ...Controller + private PersonLoginView loginViewController; - @FXML - // Inject the Code behind instance of the ListView - private ListView<Integer> personWelcomeListView; + @FXML + // Inject the Code behind instance of the ListView + private ListView<Integer> personWelcomeListView; - @Inject - // Notification Center - private NotificationCenter notificationCenter; + @Inject + // Notification Center + private NotificationCenter notificationCenter; - @InjectViewModel - private MainContainerViewModel viewModel; + @InjectViewModel + private MainContainerViewModel viewModel; - private Map<Integer, ViewTuple<PersonWelcomeView, PersonWelcomeViewModel>> viewMap = new HashMap<>(); + private Map<Integer, ViewTuple<PersonWelcomeView, PersonWelcomeViewModel>> viewMap = new HashMap<>(); - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - // Listen for close notifications - notificationCenter.subscribe("hidePersonWelcome", - (key, payload) -> { - int personIdToHide = (int) payload[0]; - viewModel.displayedPersonsProperty().remove( - new Integer(personIdToHide)); - }); + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + // Listen for close notifications + notificationCenter.subscribe("hidePersonWelcome", + (key, payload) -> { + int personIdToHide = (int) payload[0]; + viewModel.displayedPersonsProperty().remove( + new Integer(personIdToHide)); + }); // When the login button of the loginView, the pickedPersonProperty is - // going to have the index of the selected person - loginViewController.getViewModel().loggedInPersonIdProperty() - .addListener(new ChangeListener<Number>() { - @Override - public void changed(ObservableValue<? extends Number> arg0, - Number oldValue, Number newValue) { - int id = newValue.intValue(); - viewModel.displayedPersonsProperty().add(id); - } - }); - - // Configure List with views - final ViewListCellFactory<Integer> cellFactory = element -> { - if (!viewMap.containsKey(element)) { - ViewTuple<PersonWelcomeView, PersonWelcomeViewModel> loadedViewTuple - = FluentViewLoader.fxmlView(PersonWelcomeView.class).load(); - - PersonWelcomeView codeBehind = loadedViewTuple.getCodeBehind(); - - codeBehind.getViewModel() - .setPersonId(element); - - viewMap.put(element, loadedViewTuple); - } - - return viewMap.get(element); - }; - personWelcomeListView.setCellFactory(cellFactory); - - // Bind list - personWelcomeListView.itemsProperty().bind(viewModel.displayedPersonsProperty()); - } - + // going to have the index of the selected person + loginViewController.getViewModel().loggedInPersonIdProperty() + .addListener(new ChangeListener<Number>() { + @Override + public void changed(ObservableValue<? extends Number> arg0, + Number oldValue, Number newValue) { + int id = newValue.intValue(); + viewModel.displayedPersonsProperty().add(id); + } + }); + + // Configure List with views + final ViewListCellFactory<Integer> cellFactory = element -> { + if (!viewMap.containsKey(element)) { + ViewTuple<PersonWelcomeView, PersonWelcomeViewModel> loadedViewTuple + = FluentViewLoader.fxmlView(PersonWelcomeView.class).load(); + + PersonWelcomeView codeBehind = loadedViewTuple.getCodeBehind(); + + codeBehind.getViewModel() + .setPersonId(element); + + viewMap.put(element, loadedViewTuple); + } + + return viewMap.get(element); + }; + personWelcomeListView.setCellFactory(cellFactory); + + // Bind list + personWelcomeListView.itemsProperty().bind(viewModel.displayedPersonsProperty()); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java index cc02aaeaa..58b55df77 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.java @@ -27,57 +27,57 @@ */ public class PersonLoginView implements FxmlView<PersonLoginViewModel>, Initializable { - @FXML - // Injection of the person choiceBox which is declared in the FXML File - private ChoiceBox<String> personsChoiceBox; - - @FXML - private Button loginButton; - - @FXML - private ProgressIndicator loginProgressIndicator; - - @InjectViewModel - private PersonLoginViewModel viewModel; - - private Command loginCommand; - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - loginCommand = getViewModel().getLoginCommand(); - initChoiceBox(); - loginButton.disableProperty() - .bind(loginCommand.notExecutableProperty()); - loginProgressIndicator.visibleProperty().bind(loginCommand.runningProperty()); - - viewModel.subscribe(PersonLoginViewModelNotifications.OK.getId(), (key, payload) -> { - String message = (String) payload[0]; - Alert alert = new Alert(AlertType.INFORMATION); - alert.setTitle(message); - alert.setContentText(message); - alert.show(); - }); - - } - - @FXML - void loginButtonPressed(final ActionEvent event) { - loginCommand.execute(); - } - - private void initChoiceBox() { - personsChoiceBox.itemsProperty().bind(viewModel.selectablePersonsProperty().stringListProperty()); - - personsChoiceBox - .getSelectionModel() - .selectedIndexProperty() - .addListener( - (ChangeListener<Number>) (arg0, oldVal, newVal) -> viewModel.selectablePersonsProperty() - .select(newVal.intValue())); - } - - public PersonLoginViewModel getViewModel() { - return viewModel; - } - + @FXML + // Injection of the person choiceBox which is declared in the FXML File + private ChoiceBox<String> personsChoiceBox; + + @FXML + private Button loginButton; + + @FXML + private ProgressIndicator loginProgressIndicator; + + @InjectViewModel + private PersonLoginViewModel viewModel; + + private Command loginCommand; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + loginCommand = getViewModel().getLoginCommand(); + initChoiceBox(); + loginButton.disableProperty() + .bind(loginCommand.notExecutableProperty()); + loginProgressIndicator.visibleProperty().bind(loginCommand.runningProperty()); + + viewModel.subscribe(PersonLoginViewModelNotifications.OK.getId(), (key, payload) -> { + String message = (String) payload[0]; + Alert alert = new Alert(AlertType.INFORMATION); + alert.setTitle(message); + alert.setContentText(message); + alert.show(); + }); + + } + + @FXML + void loginButtonPressed(final ActionEvent event) { + loginCommand.execute(); + } + + private void initChoiceBox() { + personsChoiceBox.itemsProperty().bind(viewModel.selectablePersonsProperty().stringListProperty()); + + personsChoiceBox + .getSelectionModel() + .selectedIndexProperty() + .addListener( + (ChangeListener<Number>) (arg0, oldVal, newVal) -> viewModel.selectablePersonsProperty() + .select(newVal.intValue())); + } + + public PersonLoginViewModel getViewModel() { + return viewModel; + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java index b50cc749c..df730c863 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.java @@ -23,33 +23,33 @@ */ public class PersonWelcomeView implements FxmlView<PersonWelcomeViewModel>, Initializable { - @FXML + @FXML // Injection of the label which is declared in the FXML File and shows the - // welcome message - private Label welcomeLabel; - - @Inject - private NotificationCenter notificationCenter; - - @InjectViewModel - private PersonWelcomeViewModel viewModel; - - @FXML - // Handler for Button[Button[id=null, styleClass=button]] onAction - public void closeApplicationButtonPressed(ActionEvent event) { - // MainContainerView.java will handle it - notificationCenter.publish("hidePersonWelcome", viewModel - .getPersonId()); - } - - public PersonWelcomeViewModel getViewModel() { - return viewModel; - } - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - welcomeLabel.textProperty() - .bind(viewModel.welcomeStringProperty()); - } - + // welcome message + private Label welcomeLabel; + + @Inject + private NotificationCenter notificationCenter; + + @InjectViewModel + private PersonWelcomeViewModel viewModel; + + @FXML + // Handler for Button[Button[id=null, styleClass=button]] onAction + public void closeApplicationButtonPressed(ActionEvent event) { + // MainContainerView.java will handle it + notificationCenter.publish("hidePersonWelcome", viewModel + .getPersonId()); + } + + public PersonWelcomeViewModel getViewModel() { + return viewModel; + } + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + welcomeLabel.textProperty() + .bind(viewModel.welcomeStringProperty()); + } + } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java index 10fa2a24e..05f9a7319 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/maincontainer/MainContainerViewModel.java @@ -8,15 +8,15 @@ public class MainContainerViewModel implements ViewModel { - private ListProperty<Integer> displayedPersons = new SimpleListProperty<>( - FXCollections.<Integer>observableArrayList()); + private ListProperty<Integer> displayedPersons = new SimpleListProperty<>( + FXCollections.<Integer>observableArrayList()); - public MainContainerViewModel() { + public MainContainerViewModel() { - } + } - public ListProperty<Integer> displayedPersonsProperty() { - return displayedPersons; - } + public ListProperty<Integer> displayedPersonsProperty() { + return displayedPersons; + } } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java index ef0472cd2..3f72467b2 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModel.java @@ -28,72 +28,72 @@ */ public class PersonLoginViewModel implements ViewModel { - // Properties which are used by the view. - private SelectableItemList<Person> selectablePersons; - private ReadOnlyIntegerWrapper loggedInPersonId; - private Command loginCommand; + // Properties which are used by the view. + private SelectableItemList<Person> selectablePersons; + private ReadOnlyIntegerWrapper loggedInPersonId; + private Command loginCommand; - // Repo - private final Repository repository; + // Repo + private final Repository repository; - @Inject - public PersonLoginViewModel(Repository repository) { - this.repository = repository; - } + @Inject + public PersonLoginViewModel(Repository repository) { + this.repository = repository; + } - private BooleanBinding createLoginPossibleBinding() { - return selectablePersonsProperty().selectedIndexProperty().isNotEqualTo(-1); - } + private BooleanBinding createLoginPossibleBinding() { + return selectablePersonsProperty().selectedIndexProperty().isNotEqualTo(-1); + } - /** - * Persons in string representation. - * - * @return persons - */ - public SelectableStringList selectablePersonsProperty() { - if (selectablePersons == null) { - selectablePersons = new SelectableItemList<>( - FXCollections.observableArrayList(repository.getPersons()), - person -> person.getFirstName() + " " + person.getLastName()); - } - return selectablePersons; - } + /** + * Persons in string representation. + * + * @return persons + */ + public SelectableStringList selectablePersonsProperty() { + if (selectablePersons == null) { + selectablePersons = new SelectableItemList<>( + FXCollections.observableArrayList(repository.getPersons()), + person -> person.getFirstName() + " " + person.getLastName()); + } + return selectablePersons; + } - /** - * Person which is logged in. - * - * @return person - */ - public ReadOnlyIntegerProperty loggedInPersonIdProperty() { - if (loggedInPersonId == null) { - loggedInPersonId = new ReadOnlyIntegerWrapper(); - } - return loggedInPersonId.getReadOnlyProperty(); - } + /** + * Person which is logged in. + * + * @return person + */ + public ReadOnlyIntegerProperty loggedInPersonIdProperty() { + if (loggedInPersonId == null) { + loggedInPersonId = new ReadOnlyIntegerWrapper(); + } + return loggedInPersonId.getReadOnlyProperty(); + } - public Command getLoginCommand() { - if (loginCommand == null) { - loginCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - performLogin(); - } - }, createLoginPossibleBinding(), true); - } - return loginCommand; - } + public Command getLoginCommand() { + if (loginCommand == null) { + loginCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + performLogin(); + } + }, createLoginPossibleBinding(), true); + } + return loginCommand; + } - private void performLogin() { - try { - // fakesleep, simulating latency - Thread.sleep(2000); - } catch (Exception e) { - } + private void performLogin() { + try { + // fakesleep, simulating latency + Thread.sleep(2000); + } catch (Exception e) { + } + + Platform.runLater(() -> { + loggedInPersonId.set(selectablePersons.getSelectedItem().getId()); + }); + publish(PersonLoginViewModelNotifications.OK.getId(), PersonLoginViewModelNotifications.OK.getMessage()); + } - Platform.runLater(() -> { - loggedInPersonId.set(selectablePersons.getSelectedItem().getId()); - }); - publish(PersonLoginViewModelNotifications.OK.getId(), PersonLoginViewModelNotifications.OK.getMessage()); - } - } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java index e7c2270b1..d28c86942 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personlogin/PersonLoginViewModelNotifications.java @@ -2,20 +2,20 @@ public enum PersonLoginViewModelNotifications { - OK("Das Einloggen war erfolgreich"); + OK("Das Einloggen war erfolgreich"); - private String message; + private String message; - PersonLoginViewModelNotifications(String message) { - this.message = message; - } + PersonLoginViewModelNotifications(String message) { + this.message = message; + } - public String getMessage() { - return message; - } + public String getMessage() { + return message; + } + + public String getId() { + return toString(); + } - public String getId() { - return toString(); - } - } diff --git a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java index 3de722059..2e960b7c1 100644 --- a/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java +++ b/examples/mini-examples/welcome-example/src/main/java/de/saxsys/mvvmfx/examples/welcome/viewmodel/personwelcome/PersonWelcomeViewModel.java @@ -22,60 +22,60 @@ */ public class PersonWelcomeViewModel implements ViewModel { - private final Repository repository; + private final Repository repository; - // Properties which are used by the view. - private final StringProperty welcomeString = new SimpleStringProperty(); + // Properties which are used by the view. + private final StringProperty welcomeString = new SimpleStringProperty(); - private Person person; + private Person person; - /** - * Create a {@link PersonWelcomeViewModel}. - * - * @param repository repo which is used - */ - @Inject - public PersonWelcomeViewModel(Repository repository) { - this.repository = repository; - } + /** + * Create a {@link PersonWelcomeViewModel}. + * + * @param repository repo which is used + */ + @Inject + public PersonWelcomeViewModel(Repository repository) { + this.repository = repository; + } - /** - * Provides the the concated string. - * - * @return - */ - public StringProperty welcomeStringProperty() { - return welcomeString; - } + /** + * Provides the the concated string. + * + * @return + */ + public StringProperty welcomeStringProperty() { + return welcomeString; + } - /** - * Set Person id for the screen - * - * @param personId for the screen - */ - public void setPersonId(int personId) { - person = repository.getPersonById(personId); + /** + * Set Person id for the screen + * + * @param personId for the screen + */ + public void setPersonId(int personId) { + person = repository.getPersonById(personId); - StringBinding salutationBinding - = Bindings.when(person.genderProperty().isEqualTo(Gender.NOT_SPECIFIED)) - .then("Herr/Frau/* ") - .otherwise( - Bindings.when(person.genderProperty().isEqualTo(Gender.MALE)) - .then("Herr ").otherwise("Frau ")); + StringBinding salutationBinding + = Bindings.when(person.genderProperty().isEqualTo(Gender.NOT_SPECIFIED)) + .then("Herr/Frau/* ") + .otherwise( + Bindings.when(person.genderProperty().isEqualTo(Gender.MALE)) + .then("Herr ").otherwise("Frau ")); - welcomeString.unbind(); - welcomeString.bind(Bindings.concat("Willkommen ", salutationBinding, - person.firstNameProperty(), " ", - person.lastNameProperty())); - } + welcomeString.unbind(); + welcomeString.bind(Bindings.concat("Willkommen ", salutationBinding, + person.firstNameProperty(), " ", + person.lastNameProperty())); + } + + /** + * Returns the id of the displayed person. + * + * @return id + */ + public int getPersonId() { + return person.getId(); + } - /** - * Returns the id of the displayed person. - * - * @return id - */ - public int getPersonId() { - return person.getId(); - } - } diff --git a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml index ca3d835d1..7a4f88b07 100644 --- a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml +++ b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/maincontainer/MainContainerView.fxml @@ -9,18 +9,18 @@ <?import javafx.scene.layout.VBox?> <Pane id="personInfoVbox" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" - fx:controller="de.saxsys.mvvmfx.examples.welcome.view.maincontainer.MainContainerView"> - <!-- TODO Add Nodes --> - <children> - <VBox prefHeight="-1.0" spacing="5.0"> - <children> - <!-- Take care for setting the ID to use the injected objects in the code-behind --> - <fx:include fx:id="loginView" source="../personlogin/PersonLoginView.fxml"/> - <ListView fx:id="personWelcomeListView" blendMode="SRC_OVER" prefHeight="200.0" prefWidth="200.0"/> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> - </padding> - </VBox> - </children> + fx:controller="de.saxsys.mvvmfx.examples.welcome.view.maincontainer.MainContainerView"> + <!-- TODO Add Nodes --> + <children> + <VBox prefHeight="-1.0" spacing="5.0"> + <children> + <!-- Take care for setting the ID to use the injected objects in the code-behind --> + <fx:include fx:id="loginView" source="../personlogin/PersonLoginView.fxml"/> + <ListView fx:id="personWelcomeListView" blendMode="SRC_OVER" prefHeight="200.0" prefWidth="200.0"/> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + </padding> + </VBox> + </children> </Pane> diff --git a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml index 7ec80038c..34dbccb06 100644 --- a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml +++ b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personlogin/PersonLoginView.fxml @@ -7,29 +7,29 @@ <?import javafx.scene.text.*?> <StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" - fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personlogin.PersonLoginView"> - <!-- TODO Add Nodes --> - <children> - <VBox fx:id="layoutVbox" alignment="CENTER" minHeight="37.0" spacing="5.0"> - <children> - <Label alignment="CENTER" prefWidth="270.0" text="Personen" textAlignment="LEFT"> - <font> - <Font size="30.0"/> - </font> - </Label> - <ChoiceBox id="persons" fx:id="personsChoiceBox" prefWidth="277.0"> - <items> - <FXCollections fx:factory="observableArrayList"> - <String fx:value="Item 1"/> - <String fx:value="Item 2"/> - <String fx:value="Item 3"/> - </FXCollections> - </items> - </ChoiceBox> - <Button fx:id="loginButton" alignment="CENTER" mnemonicParsing="false" onAction="#loginButtonPressed" text="Login"/> - </children> - </VBox> - <ProgressIndicator fx:id="loginProgressIndicator"/> - </children> + xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" + fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personlogin.PersonLoginView"> + <!-- TODO Add Nodes --> + <children> + <VBox fx:id="layoutVbox" alignment="CENTER" minHeight="37.0" spacing="5.0"> + <children> + <Label alignment="CENTER" prefWidth="270.0" text="Personen" textAlignment="LEFT"> + <font> + <Font size="30.0"/> + </font> + </Label> + <ChoiceBox id="persons" fx:id="personsChoiceBox" prefWidth="277.0"> + <items> + <FXCollections fx:factory="observableArrayList"> + <String fx:value="Item 1"/> + <String fx:value="Item 2"/> + <String fx:value="Item 3"/> + </FXCollections> + </items> + </ChoiceBox> + <Button fx:id="loginButton" alignment="CENTER" mnemonicParsing="false" onAction="#loginButtonPressed" text="Login"/> + </children> + </VBox> + <ProgressIndicator fx:id="loginProgressIndicator"/> + </children> </StackPane> diff --git a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml index 2b3051a6a..e294eebe8 100644 --- a/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml +++ b/examples/mini-examples/welcome-example/src/main/resources/de/saxsys/mvvmfx/examples/welcome/view/personwelcome/PersonWelcomeView.fxml @@ -10,13 +10,13 @@ <?import javafx.scene.layout.VBox?> <VBox alignment="CENTER_LEFT" spacing="10.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" - fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personwelcome.PersonWelcomeView"> - <children> - <Label fx:id="welcomeLabel" alignment="CENTER" text="The upcoming text"> - <VBox.margin> - <Insets fx:id="x1"/> - </VBox.margin> - </Label> - <Button mnemonicParsing="false" onAction="#closeApplicationButtonPressed" text="Hide" VBox.margin="$x1"/> - </children> + fx:controller="de.saxsys.mvvmfx.examples.welcome.view.personwelcome.PersonWelcomeView"> + <children> + <Label fx:id="welcomeLabel" alignment="CENTER" text="The upcoming text"> + <VBox.margin> + <Insets fx:id="x1"/> + </VBox.margin> + </Label> + <Button mnemonicParsing="false" onAction="#closeApplicationButtonPressed" text="Hide" VBox.margin="$x1"/> + </children> </VBox> diff --git a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java index b9709bd9b..fbce7d537 100644 --- a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java +++ b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personlogin/PersonLoginViewModelTest.java @@ -11,14 +11,15 @@ public class PersonLoginViewModelTest { - @Test - public void testShowAllPersons() throws Exception { - final PersonLoginViewModel personLoginViewModel = new PersonLoginViewModel( - new Repository()); - final ObservableList<String> persons = personLoginViewModel - .selectablePersonsProperty().stringListProperty(); - assertEquals("Alexander Casall", persons.get(0)); - assertEquals("Bernd Grams", persons.get(1)); - assertEquals("Anna Schulze", persons.get(2)); - } + @Test + public void testShowAllPersons() throws Exception { + final PersonLoginViewModel personLoginViewModel = new PersonLoginViewModel( + new Repository()); + final ObservableList<String> persons = personLoginViewModel + .selectablePersonsProperty().stringListProperty(); + assertEquals("Alexander Casall", persons.get(0)); + assertEquals("Bernd Grams", persons.get(1)); + assertEquals("Anna Schulze", persons.get(2)); + } + } diff --git a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java index 3d4d77cb8..0728f1ba2 100644 --- a/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java +++ b/examples/mini-examples/welcome-example/src/test/java/de/saxsys/mvvmfx/viewmodel/personwelcome/PersonWelcomeViewModelTest.java @@ -12,69 +12,69 @@ public class PersonWelcomeViewModelTest { - private Repository repository; - private PersonWelcomeViewModel personWelcomeViewModel; + private Repository repository; + private PersonWelcomeViewModel personWelcomeViewModel; - @Before - public void setup() { - // TODO: this should be mocked - repository = new Repository(); - personWelcomeViewModel = new PersonWelcomeViewModel( - repository); - } + @Before + public void setup() { + // TODO: this should be mocked + repository = new Repository(); + personWelcomeViewModel = new PersonWelcomeViewModel( + repository); + } - @Test - public void testWelcomeStringInViewModel() throws Exception { - personWelcomeViewModel.setPersonId(repository.getPersons().get(0) - .getId()); - assertEquals( - "Willkommen Herr Alexander Casall", - personWelcomeViewModel.welcomeStringProperty().get()); + @Test + public void testWelcomeStringInViewModel() throws Exception { + personWelcomeViewModel.setPersonId(repository.getPersons().get(0) + .getId()); + assertEquals( + "Willkommen Herr Alexander Casall", + personWelcomeViewModel.welcomeStringProperty().get()); - assertEquals(repository.getPersons().get(0).getId(), - personWelcomeViewModel.getPersonId()); - } + assertEquals(repository.getPersons().get(0).getId(), + personWelcomeViewModel.getPersonId()); + } - @Test - public void welcomeStringForFemalePersonIsDifferent() throws Exception { - personWelcomeViewModel.setPersonId(repository.getPersons().get(2) - .getId()); - assertEquals( - "Willkommen Frau Anna Schulze", - personWelcomeViewModel.welcomeStringProperty().get()); + @Test + public void welcomeStringForFemalePersonIsDifferent() throws Exception { + personWelcomeViewModel.setPersonId(repository.getPersons().get(2) + .getId()); + assertEquals( + "Willkommen Frau Anna Schulze", + personWelcomeViewModel.welcomeStringProperty().get()); - assertEquals(repository.getPersons().get(2).getId(), - personWelcomeViewModel.getPersonId()); - } + assertEquals(repository.getPersons().get(2).getId(), + personWelcomeViewModel.getPersonId()); + } - @Test - public void changeFirstNameOfPersonIsReflectedInViewModel() throws Exception { - final Person person = repository.getPersons().get(0); - personWelcomeViewModel.setPersonId(person.getId()); - person.setFirstName(person.getFirstName() + 'X'); - assertEquals( - "Willkommen Herr AlexanderX Casall", - personWelcomeViewModel.welcomeStringProperty().get()); - } + @Test + public void changeFirstNameOfPersonIsReflectedInViewModel() throws Exception { + final Person person = repository.getPersons().get(0); + personWelcomeViewModel.setPersonId(person.getId()); + person.setFirstName(person.getFirstName() + 'X'); + assertEquals( + "Willkommen Herr AlexanderX Casall", + personWelcomeViewModel.welcomeStringProperty().get()); + } - @Test - public void changeLastNameOfPersonIsReflectedInViewModel() throws Exception { - final Person person = repository.getPersons().get(0); - personWelcomeViewModel.setPersonId(person.getId()); - person.setLastName(person.getLastName() + 'X'); - assertEquals( - "Willkommen Herr Alexander CasallX", - personWelcomeViewModel.welcomeStringProperty().get()); - } + @Test + public void changeLastNameOfPersonIsReflectedInViewModel() throws Exception { + final Person person = repository.getPersons().get(0); + personWelcomeViewModel.setPersonId(person.getId()); + person.setLastName(person.getLastName() + 'X'); + assertEquals( + "Willkommen Herr Alexander CasallX", + personWelcomeViewModel.welcomeStringProperty().get()); + } + + @Test + public void changeGenderOfPersonIsReflectedInViewModel() throws Exception { + final Person person = repository.getPersons().get(0); + personWelcomeViewModel.setPersonId(person.getId()); + person.setGender(Gender.FEMALE); + assertEquals( + "Willkommen Frau Alexander Casall", + personWelcomeViewModel.welcomeStringProperty().get()); + } - @Test - public void changeGenderOfPersonIsReflectedInViewModel() throws Exception { - final Person person = repository.getPersons().get(0); - personWelcomeViewModel.setPersonId(person.getId()); - person.setGender(Gender.FEMALE); - assertEquals( - "Willkommen Frau Alexander Casall", - personWelcomeViewModel.welcomeStringProperty().get()); - } - } From 92aac9635890bd33b5fca4c7c0ddbe9da8d59143 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Mon, 7 Mar 2016 21:51:46 +0100 Subject: [PATCH 58/96] Format sourcecode with tab indentation (instead 4 spaces). --- .../saxsys/mvvmfx/examples/todomvc/App.java | 22 +-- .../examples/todomvc/model/TodoItem.java | 48 +++---- .../examples/todomvc/model/TodoItemStore.java | 22 +-- .../examples/todomvc/ui/FilterHelper.java | 76 +++++----- .../mvvmfx/examples/todomvc/ui/MainView.java | 2 +- .../examples/todomvc/ui/MainViewModel.java | 2 +- .../todomvc/ui/additems/AddItemsView.java | 26 ++-- .../ui/additems/AddItemsViewModel.java | 66 ++++----- .../todomvc/ui/controls/ControlsView.java | 34 ++--- .../ui/controls/ControlsViewModel.java | 44 +++--- .../todomvc/ui/item/ItemOverviewView.java | 16 +-- .../ui/item/ItemOverviewViewModel.java | 54 +++---- .../examples/todomvc/ui/item/ItemView.java | 134 +++++++++--------- .../todomvc/ui/item/ItemViewModel.java | 56 ++++---- .../mvvmfx/examples/todomvc/ui/MainView.fxml | 22 +-- .../todomvc/ui/additems/AddItemsView.fxml | 16 +-- .../todomvc/ui/controls/ControlsView.fxml | 42 +++--- .../todomvc/ui/item/ItemOverviewView.fxml | 10 +- .../examples/todomvc/ui/item/ItemView.fxml | 48 +++---- 19 files changed, 370 insertions(+), 370 deletions(-) diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java index c774fcff6..a8d8b17db 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/App.java @@ -13,18 +13,18 @@ */ public class App extends Application { - public static void main(String... args) { - launch(args); - } + public static void main(String... args) { + launch(args); + } - @Override - public void start(Stage stage) throws Exception { - stage.setTitle("TodoMVVM"); + @Override + public void start(Stage stage) throws Exception { + stage.setTitle("TodoMVVM"); - final Parent parent = FluentViewLoader.fxmlView(MainView.class).load().getView(); + final Parent parent = FluentViewLoader.fxmlView(MainView.class).load().getView(); + + stage.setScene(new Scene(parent)); + stage.show(); + } - stage.setScene(new Scene(parent)); - stage.show(); - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java index d9035f95f..811f1be9c 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItem.java @@ -10,36 +10,36 @@ */ public class TodoItem { - private final StringProperty text = new SimpleStringProperty(); + private final StringProperty text = new SimpleStringProperty(); - private final BooleanProperty completed = new SimpleBooleanProperty(false); + private final BooleanProperty completed = new SimpleBooleanProperty(false); - public TodoItem(String text) { - this.text.set(text); - } + public TodoItem(String text) { + this.text.set(text); + } - public String getText() { - return text.get(); - } + public String getText() { + return text.get(); + } - public StringProperty textProperty() { - return text; - } + public StringProperty textProperty() { + return text; + } - public void setText(String text) { - this.text.set(text); - } + public void setText(String text) { + this.text.set(text); + } - public boolean isCompleted() { - return completed.get(); - } + public boolean isCompleted() { + return completed.get(); + } - public BooleanProperty completedProperty() { - return completed; - } + public BooleanProperty completedProperty() { + return completed; + } + + public void setCompleted(boolean completed) { + this.completed.set(completed); + } - public void setCompleted(boolean completed) { - this.completed.set(completed); - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java index e037ab713..4dd9bbb30 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/model/TodoItemStore.java @@ -8,19 +8,19 @@ */ public class TodoItemStore { - private static final TodoItemStore SINGLETON = new TodoItemStore(); + private static final TodoItemStore SINGLETON = new TodoItemStore(); - private final ObservableList<TodoItem> items = FXCollections.observableArrayList(); + private final ObservableList<TodoItem> items = FXCollections.observableArrayList(); - private TodoItemStore() { - } + private TodoItemStore() { + } - public static TodoItemStore getInstance() { - return SINGLETON; - } + public static TodoItemStore getInstance() { + return SINGLETON; + } + + public ObservableList<TodoItem> getItems() { + return items; + } - public ObservableList<TodoItem> getItems() { - return items; - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java index 3fb3b4636..6bac13b30 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/FilterHelper.java @@ -16,43 +16,43 @@ */ public class FilterHelper { - public static <T> ObservableList<T> filter(ObservableList<T> items, - Function<T, ObservableBooleanValue> conditionExtractor) { - - return filterInternal(items, conditionExtractor, t -> conditionExtractor.apply(t).get()); - } - - public static <T> ObservableList<T> filterInverted(ObservableList<T> items, - Function<T, ObservableBooleanValue> conditionExtractor) { - - return filterInternal(items, conditionExtractor, t -> !conditionExtractor.apply(t).get()); - } - - private static <T> ObservableList<T> filterInternal(ObservableList<T> items, - Function<T, ObservableBooleanValue> conditionExtractor, final Predicate<T> predicate) { - final ObservableList<T> filteredItems = FXCollections.observableArrayList(); - final InvalidationListener listener = observable -> { - final List<T> completed = items.stream().filter(predicate).collect(Collectors.toList()); - - filteredItems.clear(); - filteredItems.addAll(completed); - }; - - items.addListener((ListChangeListener<T>) c -> { - c.next(); - - listener.invalidated(null); - - if (c.wasAdded()) { - c.getAddedSubList().forEach(item -> conditionExtractor.apply(item).addListener(listener)); - } - - if (c.wasRemoved()) { - c.getRemoved().forEach(item -> conditionExtractor.apply(item).removeListener(listener)); - } - }); - - return filteredItems; - } + public static <T> ObservableList<T> filter(ObservableList<T> items, + Function<T, ObservableBooleanValue> conditionExtractor) { + + return filterInternal(items, conditionExtractor, t -> conditionExtractor.apply(t).get()); + } + + public static <T> ObservableList<T> filterInverted(ObservableList<T> items, + Function<T, ObservableBooleanValue> conditionExtractor) { + + return filterInternal(items, conditionExtractor, t -> !conditionExtractor.apply(t).get()); + } + + private static <T> ObservableList<T> filterInternal(ObservableList<T> items, + Function<T, ObservableBooleanValue> conditionExtractor, final Predicate<T> predicate) { + final ObservableList<T> filteredItems = FXCollections.observableArrayList(); + final InvalidationListener listener = observable -> { + final List<T> completed = items.stream().filter(predicate).collect(Collectors.toList()); + + filteredItems.clear(); + filteredItems.addAll(completed); + }; + + items.addListener((ListChangeListener<T>) c -> { + c.next(); + + listener.invalidated(null); + + if (c.wasAdded()) { + c.getAddedSubList().forEach(item -> conditionExtractor.apply(item).addListener(listener)); + } + + if (c.wasRemoved()) { + c.getRemoved().forEach(item -> conditionExtractor.apply(item).removeListener(listener)); + } + }); + + return filteredItems; + } } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java index c44645308..af760ca5e 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.java @@ -6,5 +6,5 @@ * @author manuel.mauky */ public class MainView implements FxmlView<MainViewModel> { - + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java index 9c08c71ad..d827540b7 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainViewModel.java @@ -6,5 +6,5 @@ * @author manuel.mauky */ public class MainViewModel implements ViewModel { - + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java index 7e71d7894..35ac4be12 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.java @@ -12,22 +12,22 @@ */ public class AddItemsView implements FxmlView<AddItemsViewModel> { - @FXML - public CheckBox selectAll; - @FXML - public TextField addInput; + @FXML + public CheckBox selectAll; + @FXML + public TextField addInput; - @InjectViewModel - private AddItemsViewModel viewModel; + @InjectViewModel + private AddItemsViewModel viewModel; - public void initialize() { - addInput.textProperty().bindBidirectional(viewModel.newItemValueProperty()); + public void initialize() { + addInput.textProperty().bindBidirectional(viewModel.newItemValueProperty()); - addInput.setOnAction(event -> viewModel.addItem()); + addInput.setOnAction(event -> viewModel.addItem()); - selectAll.selectedProperty().bindBidirectional(viewModel.allSelectedProperty()); + selectAll.selectedProperty().bindBidirectional(viewModel.allSelectedProperty()); + + selectAll.visibleProperty().bind(viewModel.allSelectedVisibleProperty()); + } - selectAll.visibleProperty().bind(viewModel.allSelectedVisibleProperty()); - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java index 2a4d652be..5edb76664 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsViewModel.java @@ -17,37 +17,37 @@ */ public class AddItemsViewModel implements ViewModel { - private final BooleanProperty allSelected = new SimpleBooleanProperty(); - private final StringProperty newItemValue = new SimpleStringProperty(""); - - private final ReadOnlyBooleanWrapper allSelectedVisible = new ReadOnlyBooleanWrapper(); - - public AddItemsViewModel() { - allSelected.addListener((obs, oldV, newV) -> { - TodoItemStore.getInstance().getItems().forEach(item -> item.setCompleted(newV)); - }); - - allSelectedVisible.bind(Bindings.isEmpty(TodoItemStore.getInstance().getItems()).not()); - } - - public void addItem() { - final String newValue = newItemValue.get(); - if (newValue != null && !newValue.trim().isEmpty()) { - TodoItemStore.getInstance().getItems().add(new TodoItem(newValue)); - newItemValue.set(""); - } - } - - public StringProperty newItemValueProperty() { - return newItemValue; - } - - public BooleanProperty allSelectedProperty() { - return allSelected; - } - - public ReadOnlyBooleanProperty allSelectedVisibleProperty() { - return allSelectedVisible; - } - + private final BooleanProperty allSelected = new SimpleBooleanProperty(); + private final StringProperty newItemValue = new SimpleStringProperty(""); + + private final ReadOnlyBooleanWrapper allSelectedVisible = new ReadOnlyBooleanWrapper(); + + public AddItemsViewModel() { + allSelected.addListener((obs, oldV, newV) -> { + TodoItemStore.getInstance().getItems().forEach(item -> item.setCompleted(newV)); + }); + + allSelectedVisible.bind(Bindings.isEmpty(TodoItemStore.getInstance().getItems()).not()); + } + + public void addItem() { + final String newValue = newItemValue.get(); + if (newValue != null && !newValue.trim().isEmpty()) { + TodoItemStore.getInstance().getItems().add(new TodoItem(newValue)); + newItemValue.set(""); + } + } + + public StringProperty newItemValueProperty() { + return newItemValue; + } + + public BooleanProperty allSelectedProperty() { + return allSelected; + } + + public ReadOnlyBooleanProperty allSelectedVisibleProperty() { + return allSelectedVisible; + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java index ec25bfca0..947f7ab1d 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.java @@ -10,26 +10,26 @@ */ public class ControlsView implements FxmlView<ControlsViewModel> { - @FXML - public Label itemsLeftLabel; + @FXML + public Label itemsLeftLabel; - @InjectViewModel - private ControlsViewModel viewModel; + @InjectViewModel + private ControlsViewModel viewModel; - public void initialize() { - itemsLeftLabel.textProperty().bind(viewModel.itemsLeftLabelTextProperty()); - } + public void initialize() { + itemsLeftLabel.textProperty().bind(viewModel.itemsLeftLabelTextProperty()); + } - public void all() { - viewModel.all(); - } + public void all() { + viewModel.all(); + } - public void active() { - viewModel.active(); - } + public void active() { + viewModel.active(); + } + + public void completed() { + viewModel.completed(); + } - public void completed() { - viewModel.completed(); - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java index 433dccd1d..f7f7432f7 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsViewModel.java @@ -19,35 +19,35 @@ */ public class ControlsViewModel implements ViewModel { - private final StringProperty itemsLeftLabelText = new SimpleStringProperty(); + private final StringProperty itemsLeftLabelText = new SimpleStringProperty(); - private final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); + private final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); - public ControlsViewModel() { - final ObservableList<TodoItem> items = TodoItemStore.getInstance().getItems(); + public ControlsViewModel() { + final ObservableList<TodoItem> items = TodoItemStore.getInstance().getItems(); - ObservableList<TodoItem> completedItems = FilterHelper.filterInverted(items, TodoItem::completedProperty); + ObservableList<TodoItem> completedItems = FilterHelper.filterInverted(items, TodoItem::completedProperty); - final IntegerBinding size = Bindings.size(completedItems); + final IntegerBinding size = Bindings.size(completedItems); - final StringBinding itemsLabel = Bindings.when(size.isEqualTo(1)).then("item").otherwise("items"); - itemsLeftLabelText.bind(Bindings.concat(size, " ", itemsLabel, " left")); - } + final StringBinding itemsLabel = Bindings.when(size.isEqualTo(1)).then("item").otherwise("items"); + itemsLeftLabelText.bind(Bindings.concat(size, " ", itemsLabel, " left")); + } - public StringProperty itemsLeftLabelTextProperty() { - return itemsLeftLabelText; - } + public StringProperty itemsLeftLabelTextProperty() { + return itemsLeftLabelText; + } - public void all() { - notificationCenter.publish("showAll"); - } + public void all() { + notificationCenter.publish("showAll"); + } - public void active() { - notificationCenter.publish("showActive"); - } + public void active() { + notificationCenter.publish("showActive"); + } + + public void completed() { + notificationCenter.publish("showCompleted"); + } - public void completed() { - notificationCenter.publish("showCompleted"); - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java index ca879d951..eb33c987a 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.java @@ -12,15 +12,15 @@ */ public class ItemOverviewView implements FxmlView<ItemOverviewViewModel> { - @FXML - public ListView<ItemViewModel> items; + @FXML + public ListView<ItemViewModel> items; - @InjectViewModel - private ItemOverviewViewModel viewModel; + @InjectViewModel + private ItemOverviewViewModel viewModel; - public void initialize() { - items.setItems(viewModel.itemsProperty()); - items.setCellFactory(CachedViewModelCellFactory.createForFxmlView(ItemView.class)); - } + public void initialize() { + items.setItems(viewModel.itemsProperty()); + items.setCellFactory(CachedViewModelCellFactory.createForFxmlView(ItemView.class)); + } } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java index fde0ca8a6..e633ecb87 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewViewModel.java @@ -17,40 +17,40 @@ */ public class ItemOverviewViewModel implements ViewModel { - private final ListProperty<ItemViewModel> items = new SimpleListProperty<>(); + private final ListProperty<ItemViewModel> items = new SimpleListProperty<>(); - private final ListTransformation<TodoItem, ItemViewModel> allItems; - private final ObservableList<ItemViewModel> completedItems; - private final ObservableList<ItemViewModel> activeItems; + private final ListTransformation<TodoItem, ItemViewModel> allItems; + private final ObservableList<ItemViewModel> completedItems; + private final ObservableList<ItemViewModel> activeItems; - public ItemOverviewViewModel() { - allItems = new ListTransformation<>(TodoItemStore.getInstance().getItems(), ItemViewModel::new); + public ItemOverviewViewModel() { + allItems = new ListTransformation<>(TodoItemStore.getInstance().getItems(), ItemViewModel::new); - completedItems = FilterHelper.filter(allItems.getTargetList(), ItemViewModel::completedProperty); - activeItems = FilterHelper.filterInverted(allItems.getTargetList(), ItemViewModel::completedProperty); + completedItems = FilterHelper.filter(allItems.getTargetList(), ItemViewModel::completedProperty); + activeItems = FilterHelper.filterInverted(allItems.getTargetList(), ItemViewModel::completedProperty); - showAllItems(); + showAllItems(); - final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); - notificationCenter.subscribe("showAll", (key, payload) -> showAllItems()); - notificationCenter.subscribe("showActive", (key, payload) -> showActiveItems()); - notificationCenter.subscribe("showCompleted", (key, payload) -> showCompletedItems()); - } + final NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); + notificationCenter.subscribe("showAll", (key, payload) -> showAllItems()); + notificationCenter.subscribe("showActive", (key, payload) -> showActiveItems()); + notificationCenter.subscribe("showCompleted", (key, payload) -> showCompletedItems()); + } - private void showAllItems() { - items.set(allItems.getTargetList()); - } + private void showAllItems() { + items.set(allItems.getTargetList()); + } - private void showCompletedItems() { - items.setValue(completedItems); - } + private void showCompletedItems() { + items.setValue(completedItems); + } - private void showActiveItems() { - items.setValue(activeItems); - } + private void showActiveItems() { + items.setValue(activeItems); + } + + public ObservableList<ItemViewModel> itemsProperty() { + return items; + } - public ObservableList<ItemViewModel> itemsProperty() { - return items; - } - } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java index fb1465828..30e0506e1 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.java @@ -15,71 +15,71 @@ */ public class ItemView implements FxmlView<ItemViewModel> { - public static final String STRIKETHROUGH_CSS_CLASS = "strikethrough"; - - @FXML - public CheckBox completed; - @FXML - public TextField contentInput; - - @FXML - public HBox contentBox; - - @FXML - public Label contentLabel; - - @FXML - public Button deleteButton; - @FXML - public HBox root; - - @InjectViewModel - private ItemViewModel viewModel; - - public void initialize() { - deleteButton.setVisible(false); - root.setOnMouseEntered(event -> { - deleteButton.setVisible(true); - }); - - root.setOnMouseExited(event -> { - deleteButton.setVisible(false); - }); - - completed.selectedProperty().bindBidirectional(viewModel.completedProperty()); - - contentInput.textProperty().bindBidirectional(viewModel.contentProperty()); - contentInput.visibleProperty().bind(viewModel.editModeProperty()); - contentInput.setOnAction(event -> viewModel.editModeProperty().set(false)); - contentInput.focusedProperty().addListener((obs, oldV, newV) -> { - if (!newV) { - viewModel.editModeProperty().set(false); - } - }); - - contentBox.visibleProperty().bind(viewModel.editModeProperty().not()); - completed.visibleProperty().bind(viewModel.editModeProperty().not()); - - contentLabel.textProperty().bind(viewModel.contentProperty()); - contentLabel.setOnMouseClicked(event -> { - if (event.getClickCount() > 1) { - viewModel.editModeProperty().set(true); - contentInput.requestFocus(); - } - }); - - viewModel.textStrikeThrough().addListener((obs, oldV, newV) -> { - if (newV) { - contentLabel.getStyleClass().add(STRIKETHROUGH_CSS_CLASS); - } else { - contentLabel.getStyleClass().remove(STRIKETHROUGH_CSS_CLASS); - } - }); - - } - - public void delete() { - viewModel.delete(); - } - + public static final String STRIKETHROUGH_CSS_CLASS = "strikethrough"; + + @FXML + public CheckBox completed; + @FXML + public TextField contentInput; + + @FXML + public HBox contentBox; + + @FXML + public Label contentLabel; + + @FXML + public Button deleteButton; + @FXML + public HBox root; + + @InjectViewModel + private ItemViewModel viewModel; + + public void initialize() { + deleteButton.setVisible(false); + root.setOnMouseEntered(event -> { + deleteButton.setVisible(true); + }); + + root.setOnMouseExited(event -> { + deleteButton.setVisible(false); + }); + + completed.selectedProperty().bindBidirectional(viewModel.completedProperty()); + + contentInput.textProperty().bindBidirectional(viewModel.contentProperty()); + contentInput.visibleProperty().bind(viewModel.editModeProperty()); + contentInput.setOnAction(event -> viewModel.editModeProperty().set(false)); + contentInput.focusedProperty().addListener((obs, oldV, newV) -> { + if (!newV) { + viewModel.editModeProperty().set(false); + } + }); + + contentBox.visibleProperty().bind(viewModel.editModeProperty().not()); + completed.visibleProperty().bind(viewModel.editModeProperty().not()); + + contentLabel.textProperty().bind(viewModel.contentProperty()); + contentLabel.setOnMouseClicked(event -> { + if (event.getClickCount() > 1) { + viewModel.editModeProperty().set(true); + contentInput.requestFocus(); + } + }); + + viewModel.textStrikeThrough().addListener((obs, oldV, newV) -> { + if (newV) { + contentLabel.getStyleClass().add(STRIKETHROUGH_CSS_CLASS); + } else { + contentLabel.getStyleClass().remove(STRIKETHROUGH_CSS_CLASS); + } + }); + + } + + public void delete() { + viewModel.delete(); + } + } diff --git a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java index 45b541e7a..f295e45ac 100644 --- a/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java +++ b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemViewModel.java @@ -15,41 +15,41 @@ */ public class ItemViewModel implements ViewModel { - private final BooleanProperty completed = new SimpleBooleanProperty(); - private final BooleanProperty editMode = new SimpleBooleanProperty(); + private final BooleanProperty completed = new SimpleBooleanProperty(); + private final BooleanProperty editMode = new SimpleBooleanProperty(); - private final StringProperty content = new SimpleStringProperty(); + private final StringProperty content = new SimpleStringProperty(); - private TodoItem item; + private TodoItem item; - public ItemViewModel(TodoItem item) { - this.item = item; - content.bindBidirectional(item.textProperty()); - completed.bindBidirectional(item.completedProperty()); - } + public ItemViewModel(TodoItem item) { + this.item = item; + content.bindBidirectional(item.textProperty()); + completed.bindBidirectional(item.completedProperty()); + } - public void delete() { - TodoItemStore.getInstance().getItems().remove(item); - } + public void delete() { + TodoItemStore.getInstance().getItems().remove(item); + } - public StringProperty contentProperty() { - return content; - } + public StringProperty contentProperty() { + return content; + } - public BooleanProperty completedProperty() { - return completed; - } + public BooleanProperty completedProperty() { + return completed; + } - public boolean isCompleted() { - return completed.get(); - } + public boolean isCompleted() { + return completed.get(); + } - public BooleanProperty editModeProperty() { - return editMode; - } + public BooleanProperty editModeProperty() { + return editMode; + } + + public ReadOnlyBooleanProperty textStrikeThrough() { + return completed; + } - public ReadOnlyBooleanProperty textStrikeThrough() { - return completed; - } - } diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml index 267f754f8..3f0db24c0 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml @@ -8,15 +8,15 @@ <?import java.net.URL?> <VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.MainView"> - <children> - <Label id="title" text="todos"/> - <fx:include source="additems/AddItemsView.fxml"/> - <fx:include source="item/ItemOverviewView.fxml" VBox.vgrow="ALWAYS"/> - <fx:include source="controls/ControlsView.fxml"/> - </children> - <stylesheets> - <URL value="@main.css"/> - </stylesheets> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.MainView"> + <children> + <Label id="title" text="todos"/> + <fx:include source="additems/AddItemsView.fxml"/> + <fx:include source="item/ItemOverviewView.fxml" VBox.vgrow="ALWAYS"/> + <fx:include source="controls/ControlsView.fxml"/> + </children> + <stylesheets> + <URL value="@main.css"/> + </stylesheets> </VBox> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml index 13addea26..cf656c101 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml @@ -6,12 +6,12 @@ <?import java.net.URL?> <HBox styleClass="add_item_root" fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.additems.AddItemsView" - alignment="CENTER_LEFT" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> - <children> - <CheckBox fx:id="selectAll" mnemonicParsing="false"/> - <TextField fx:id="addInput" promptText="What needs to be done?" HBox.hgrow="ALWAYS"/> - </children> - <stylesheets> - <URL value="@additems.css"/> - </stylesheets> + alignment="CENTER_LEFT" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <CheckBox fx:id="selectAll" mnemonicParsing="false"/> + <TextField fx:id="addInput" promptText="What needs to be done?" HBox.hgrow="ALWAYS"/> + </children> + <stylesheets> + <URL value="@additems.css"/> + </stylesheets> </HBox> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml index 02b170405..dbb275a96 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml @@ -6,25 +6,25 @@ <?import javafx.scene.layout.*?> <HBox fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.controls.ControlsView" alignment="CENTER" spacing="20.0" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> - <children> - <Label fx:id="itemsLeftLabel" text="X items left"/> - <HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="10.0"> - <children> - <ToggleButton mnemonicParsing="false" onAction="#all" selected="true" text="All"> - <toggleGroup> - <ToggleGroup fx:id="stateGroup"/> - </toggleGroup> - </ToggleButton> - <ToggleButton mnemonicParsing="false" onAction="#active" text="Active" toggleGroup="$stateGroup"/> - <ToggleButton mnemonicParsing="false" onAction="#completed" text="Completed" toggleGroup="$stateGroup"/> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </padding> - </HBox> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </padding> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <Label fx:id="itemsLeftLabel" text="X items left"/> + <HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="10.0"> + <children> + <ToggleButton mnemonicParsing="false" onAction="#all" selected="true" text="All"> + <toggleGroup> + <ToggleGroup fx:id="stateGroup"/> + </toggleGroup> + </ToggleButton> + <ToggleButton mnemonicParsing="false" onAction="#active" text="Active" toggleGroup="$stateGroup"/> + <ToggleButton mnemonicParsing="false" onAction="#completed" text="Completed" toggleGroup="$stateGroup"/> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </padding> + </HBox> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </padding> </HBox> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml index b4f3f6e02..dda1dde9b 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml @@ -5,9 +5,9 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" - minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemOverviewView"> - <children> - <ListView fx:id="items" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/> - </children> + minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemOverviewView"> + <children> + <ListView fx:id="items" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/> + </children> </AnchorPane> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml index da23ee56d..4384aa6d7 100644 --- a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml +++ b/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml @@ -9,28 +9,28 @@ <?import java.net.URL?> <HBox fx:id="root" alignment="CENTER_LEFT" minHeight="-Infinity" minWidth="-Infinity" styleClass="item_root" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemView"> - <children> - <CheckBox fx:id="completed" mnemonicParsing="false"/> - <StackPane alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> - <children> - <HBox fx:id="contentBox" styleClass="content_box"> - <children> - <Label fx:id="contentLabel" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" - text="Label" HBox.hgrow="ALWAYS"/> - <Button fx:id="deleteButton" mnemonicParsing="false" onAction="#delete"> - <graphic> - <FontAwesomeIcon glyphName="CLOSE" size="1.5em" styleClass="close_icon"/> - </graphic> - </Button> - </children> - </HBox> - <TextField fx:id="contentInput" promptText="What needs to be done?" visible="false"/> - </children> - </StackPane> - </children> - <stylesheets> - <URL value="@itemview.css"/> - </stylesheets> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.todomvc.ui.item.ItemView"> + <children> + <CheckBox fx:id="completed" mnemonicParsing="false"/> + <StackPane alignment="CENTER_LEFT" HBox.hgrow="ALWAYS"> + <children> + <HBox fx:id="contentBox" styleClass="content_box"> + <children> + <Label fx:id="contentLabel" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" + text="Label" HBox.hgrow="ALWAYS"/> + <Button fx:id="deleteButton" mnemonicParsing="false" onAction="#delete"> + <graphic> + <FontAwesomeIcon glyphName="CLOSE" size="1.5em" styleClass="close_icon"/> + </graphic> + </Button> + </children> + </HBox> + <TextField fx:id="contentInput" promptText="What needs to be done?" visible="false"/> + </children> + </StackPane> + </children> + <stylesheets> + <URL value="@itemview.css"/> + </stylesheets> </HBox> From 982a63c3598ee016169c42fdaad99e8530fd6a58 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Mon, 7 Mar 2016 21:52:13 +0100 Subject: [PATCH 59/96] Format sourcecode with tab indentation (instead 4 spaces). --- examples/todomvc-example/pom.xml | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/todomvc-example/pom.xml b/examples/todomvc-example/pom.xml index 53c0614b4..dce3f747f 100644 --- a/examples/todomvc-example/pom.xml +++ b/examples/todomvc-example/pom.xml @@ -1,30 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>de.saxsys.mvvmfx</groupId> - <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>de.saxsys.mvvmfx</groupId> + <artifactId>examples</artifactId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> - <artifactId>todomvc-example</artifactId> + <artifactId>todomvc-example</artifactId> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - <dependency> - <groupId>org.fxmisc.easybind</groupId> - <artifactId>easybind</artifactId> - <version>1.0.3</version> - </dependency> - <dependency> - <groupId>de.jensd</groupId> - <artifactId>fontawesomefx</artifactId> - <version>8.2</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + <dependency> + <groupId>org.fxmisc.easybind</groupId> + <artifactId>easybind</artifactId> + <version>1.0.3</version> + </dependency> + <dependency> + <groupId>de.jensd</groupId> + <artifactId>fontawesomefx</artifactId> + <version>8.2</version> + </dependency> + </dependencies> </project> \ No newline at end of file From da24b59aae5d72e2f6952ac11c01eeebd8610f18 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Mon, 7 Mar 2016 21:52:51 +0100 Subject: [PATCH 60/96] Format sourcecode with tab indentation (instead 4 spaces). --- .../mini-examples/welcome-example/pom.xml | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/examples/mini-examples/welcome-example/pom.xml b/examples/mini-examples/welcome-example/pom.xml index d6eee79fb..b72b556fe 100644 --- a/examples/mini-examples/welcome-example/pom.xml +++ b/examples/mini-examples/welcome-example/pom.xml @@ -1,70 +1,70 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>mini-examples</artifactId> - <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> - <name>mvvmfx - welcome screen example</name> - <artifactId>welcome-example</artifactId> + <name>mvvmfx - welcome screen example</name> + <artifactId>welcome-example</artifactId> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> - <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - <version>1</version> - </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + </dependency> - <!-- CDI specific libraries --> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-cdi</artifactId> - </dependency> - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jandex</artifactId> - <version>1.2.4.Final</version> - </dependency> + <!-- CDI specific libraries --> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-cdi</artifactId> + </dependency> + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jandex</artifactId> + <version>1.2.4.Final</version> + </dependency> - <!-- Guice specific libraries --> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-guice</artifactId> - </dependency> + <!-- Guice specific libraries --> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-guice</artifactId> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>12.0</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - </dependency> - </dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>12.0</version> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + </dependencies> </project> \ No newline at end of file From 529bbbe533b0c856eca0e6f55768f06427d863f9 Mon Sep 17 00:00:00 2001 From: PRo <peter.rogge@yahoo.de> Date: Mon, 7 Mar 2016 22:03:50 +0100 Subject: [PATCH 61/96] Format sourcecode with tab indentation (instead 4 spaces). --- examples/contacts-example/pom.xml | 202 +- .../saxsys/mvvmfx/examples/contacts/App.java | 72 +- .../contacts/config/ResourceProvider.java | 10 +- .../contacts/events/ContactsUpdatedEvent.java | 5 +- .../contacts/events/TriggerShutdownEvent.java | 2 +- .../contacts/events/package-info.java | 4 +- .../examples/contacts/model/Address.java | 76 +- .../examples/contacts/model/Contact.java | 134 +- .../contacts/model/ContactFactory.java | 106 +- .../examples/contacts/model/Country.java | 136 +- .../contacts/model/CountrySelector.java | 400 +- .../examples/contacts/model/Identity.java | 66 +- .../contacts/model/InmemoryRepository.java | 66 +- .../examples/contacts/model/Repository.java | 10 +- .../examples/contacts/model/Subdivision.java | 110 +- .../contacts/ui/about/AboutAuthorView.java | 20 +- .../ui/about/AboutAuthorViewModel.java | 18 +- .../examples/contacts/ui/about/AboutView.java | 48 +- .../contacts/ui/about/AboutViewModel.java | 108 +- .../ui/addcontact/AddContactDialogView.java | 22 +- .../addcontact/AddContactDialogViewModel.java | 56 +- .../ui/addressform/AddressFormView.java | 86 +- .../ui/addressform/AddressFormViewModel.java | 442 +- .../ui/contactdialog/ContactDialogView.java | 112 +- .../contactdialog/ContactDialogViewModel.java | 144 +- .../ui/contactform/ContactFormView.java | 92 +- .../ui/contactform/ContactFormViewModel.java | 272 +- .../contacts/ui/detail/DetailView.java | 186 +- .../contacts/ui/detail/DetailViewModel.java | 468 +- .../ui/editcontact/EditContactDialogView.java | 28 +- .../EditContactDialogViewModel.java | 60 +- .../examples/contacts/ui/main/MainView.java | 2 +- .../contacts/ui/main/MainViewModel.java | 2 +- .../ui/master/MasterTableViewModel.java | 162 +- .../contacts/ui/master/MasterView.java | 20 +- .../contacts/ui/master/MasterViewModel.java | 98 +- .../examples/contacts/ui/menu/MenuView.java | 58 +- .../contacts/ui/menu/MenuViewModel.java | 44 +- .../ui/scopes/ContactDialogScope.java | 108 +- .../contacts/ui/scopes/MasterDetailScope.java | 20 +- .../contacts/ui/toolbar/ToolbarView.java | 44 +- .../ui/validators/BirthdayValidator.java | 10 +- .../ui/validators/EmailValidator.java | 16 +- .../ui/validators/PhoneValidator.java | 24 +- .../examples/contacts/util/CentralClock.java | 30 +- .../examples/contacts/util/DialogHelper.java | 112 +- .../src/main/resources/countries/iso_3166.xml | 3302 +-- .../main/resources/countries/iso_3166_2.xml | 21328 ++++++++-------- .../contacts/ui/about/AboutAuthorView.fxml | 80 +- .../examples/contacts/ui/about/AboutView.fxml | 66 +- .../ui/addcontact/AddContactDialogView.fxml | 10 +- .../ui/addressform/AddressFormView.fxml | 82 +- .../ui/contactdialog/ContactDialogView.fxml | 84 +- .../ui/contactform/ContactFormView.fxml | 122 +- .../contacts/ui/detail/DetailView.fxml | 66 +- .../ui/editcontact/EditContactDialogView.fxml | 10 +- .../examples/contacts/ui/main/MainView.fxml | 46 +- .../contacts/ui/master/MasterView.fxml | 92 +- .../examples/contacts/ui/menu/MenuView.fxml | 50 +- .../contacts/ui/toolbar/ToolbarView.fxml | 22 +- .../src/main/resources/logback.xml | 30 +- .../mvvmfx/examples/contacts/AppTestFxIT.java | 40 +- .../model/CountrySelectorIntegrationTest.java | 186 +- .../validation/BirthdayValidatorTest.java | 52 +- .../validation/EmailAddressValidatorTest.java | 44 +- .../validation/PhoneNumberValidatorTest.java | 60 +- .../contacts/ui/about/AboutViewModelTest.java | 68 +- .../addressform/AddressFormViewModelTest.java | 304 +- .../ContactDialogViewModelTest.java | 178 +- .../ContactFormViewModelTest.java | 56 +- .../ui/detail/DetailViewModelTest.java | 222 +- .../EditContactDialogViewModelTest.java | 50 +- .../ui/master/MasterTableViewModelTest.java | 20 +- .../ui/master/MasterViewModelTest.java | 266 +- .../src/test/resources/countries/iso_3166.xml | 36 +- .../test/resources/countries/iso_3166_2.xml | 236 +- 76 files changed, 15760 insertions(+), 15759 deletions(-) diff --git a/examples/contacts-example/pom.xml b/examples/contacts-example/pom.xml index 33e4d450b..4eaadcdae 100644 --- a/examples/contacts-example/pom.xml +++ b/examples/contacts-example/pom.xml @@ -1,116 +1,116 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>de.saxsys.mvvmfx</groupId> - <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> - </parent> - <artifactId>contacts-example</artifactId> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>de.saxsys.mvvmfx</groupId> + <artifactId>examples</artifactId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <artifactId>contacts-example</artifactId> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + </properties> - <build> - <plugins> - <plugin> - <groupId>com.zenjava</groupId> - <artifactId>javafx-maven-plugin</artifactId> - <version>8.1.2</version> - <configuration> - <mainClass>de.saxsys.mvvmfx.examples.contacts.App</mainClass> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>com.zenjava</groupId> + <artifactId>javafx-maven-plugin</artifactId> + <version>8.1.2</version> + <configuration> + <mainClass>de.saxsys.mvvmfx.examples.contacts.App</mainClass> + </configuration> + </plugin> + </plugins> + </build> - <dependencies> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx</artifactId> - </dependency> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-cdi</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-cdi</artifactId> + </dependency> - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jandex</artifactId> - <version>1.2.4.Final</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.1.2</version> - </dependency> - <dependency> - <groupId>org.controlsfx</groupId> - <artifactId>controlsfx</artifactId> - <version>8.40.9</version> - </dependency> + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jandex</artifactId> + <version>1.2.4.Final</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.2</version> + </dependency> + <dependency> + <groupId>org.controlsfx</groupId> + <artifactId>controlsfx</artifactId> + <version>8.40.9</version> + </dependency> - <dependency> - <groupId>de.jensd</groupId> - <artifactId>fontawesomefx</artifactId> - <version>8.0.9</version> - </dependency> + <dependency> + <groupId>de.jensd</groupId> + <artifactId>fontawesomefx</artifactId> + <version>8.0.9</version> + </dependency> - <dependency> - <groupId>org.javafxdata</groupId> - <artifactId>datafx-core</artifactId> - <version>8.0b5</version> - </dependency> + <dependency> + <groupId>org.javafxdata</groupId> + <artifactId>datafx-core</artifactId> + <version>8.0b5</version> + </dependency> - <dependency> - <groupId>org.javafxdata</groupId> - <artifactId>datafx-datareader</artifactId> - <version>8.0b5</version> - </dependency> + <dependency> + <groupId>org.javafxdata</groupId> + <artifactId>datafx-datareader</artifactId> + <version>8.0b5</version> + </dependency> - <dependency> - <groupId>eu.lestard</groupId> - <artifactId>advanced-bindings</artifactId> - </dependency> + <dependency> + <groupId>eu.lestard</groupId> + <artifactId>advanced-bindings</artifactId> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>eu.lestard</groupId> - <artifactId>assertj-javafx</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>eu.lestard</groupId> + <artifactId>assertj-javafx</artifactId> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testfx</groupId> - <artifactId>testfx-core</artifactId> - <version>4.0.1-alpha</version> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testfx</groupId> + <artifactId>testfx-core</artifactId> + <version>4.0.1-alpha</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>de.saxsys</groupId> - <artifactId>mvvmfx-testing-utils</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx-testing-utils</artifactId> + <scope>test</scope> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java index c615404ba..6feb8caf5 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/App.java @@ -25,53 +25,53 @@ public class App extends MvvmfxCdiApplication { - private static final Logger LOG = LoggerFactory.getLogger(App.class); + private static final Logger LOG = LoggerFactory.getLogger(App.class); - public static void main(String... args) { + public static void main(String... args) { - Locale.setDefault(Locale.ENGLISH); + Locale.setDefault(Locale.ENGLISH); - launch(args); - } + launch(args); + } - @Inject - private ResourceBundle resourceBundle; + @Inject + private ResourceBundle resourceBundle; - @Inject - private Repository repository; + @Inject + private Repository repository; - @Override - public void initMvvmfx() throws Exception { - int numberOfContacts = 30; - for (int i = 0; i < numberOfContacts; i++) { - repository.save(ContactFactory.createRandomContact()); - } - } + @Override + public void initMvvmfx() throws Exception { + int numberOfContacts = 30; + for (int i = 0; i < numberOfContacts; i++) { + repository.save(ContactFactory.createRandomContact()); + } + } - @Override - public void startMvvmfx(Stage stage) throws Exception { - LOG.info("Starting the Application"); - MvvmFX.setGlobalResourceBundle(resourceBundle); + @Override + public void startMvvmfx(Stage stage) throws Exception { + LOG.info("Starting the Application"); + MvvmFX.setGlobalResourceBundle(resourceBundle); - stage.setTitle(resourceBundle.getString("window.title")); + stage.setTitle(resourceBundle.getString("window.title")); - ViewTuple<MainView, MainViewModel> main = FluentViewLoader.fxmlView(MainView.class).load(); + ViewTuple<MainView, MainViewModel> main = FluentViewLoader.fxmlView(MainView.class).load(); - Scene rootScene = new Scene(main.getView()); + Scene rootScene = new Scene(main.getView()); - rootScene.getStylesheets().add("/contacts.css"); + rootScene.getStylesheets().add("/contacts.css"); - stage.setScene(rootScene); - stage.show(); - } + stage.setScene(rootScene); + stage.show(); + } + + /** + * The shutdown of the application can be triggered by firing the + * {@link TriggerShutdownEvent} CDI event. + */ + public void triggerShutdown(@Observes TriggerShutdownEvent event) { + LOG.info("Application will now shut down"); + Platform.exit(); + } - /** - * The shutdown of the application can be triggered by firing the - * {@link TriggerShutdownEvent} CDI event. - */ - public void triggerShutdown(@Observes TriggerShutdownEvent event) { - LOG.info("Application will now shut down"); - Platform.exit(); - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java index b6d197d62..ef499e696 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/config/ResourceProvider.java @@ -11,10 +11,10 @@ @Singleton public class ResourceProvider { - /* - * Due to the @Produces annotation this resource bundle can be injected in all views. - */ - @Produces - private ResourceBundle defaultResourceBundle = ResourceBundle.getBundle("default"); + /* + * Due to the @Produces annotation this resource bundle can be injected in all views. + */ + @Produces + private ResourceBundle defaultResourceBundle = ResourceBundle.getBundle("default"); } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java index c417dcb29..92cfd8f11 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/ContactsUpdatedEvent.java @@ -1,8 +1,9 @@ package de.saxsys.mvvmfx.examples.contacts.events; /** - * CDI event class that is used to indicate that a contact was updated/added/removed. + * CDI event class that is used to indicate that a contact was + * updated/added/removed. */ public class ContactsUpdatedEvent { - + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java index c655baf86..3574ae803 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/TriggerShutdownEvent.java @@ -4,5 +4,5 @@ * Event class to trigger the shutdown of the application. */ public class TriggerShutdownEvent { - + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/package-info.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/package-info.java index 65a9bda1a..c28f11518 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/package-info.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/events/package-info.java @@ -1,4 +1,4 @@ /** - * This package contains CDI event classes. + * This package contains CDI event classes. */ -package de.saxsys.mvvmfx.examples.contacts.events; \ No newline at end of file +package de.saxsys.mvvmfx.examples.contacts.events; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java index c6094fdd8..9c1d03e61 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Address.java @@ -5,58 +5,58 @@ */ public class Address extends Identity { - private Country country; + private Country country; - private Subdivision subdivision; + private Subdivision subdivision; - private String street; + private String street; - private String postalcode; + private String postalcode; - private String city; + private String city; - Address() { - - } + Address() { - public Subdivision getSubdivision() { - return subdivision; - } + } - public void setSubdivision(Subdivision subdivision) { - this.subdivision = subdivision; - } + public Subdivision getSubdivision() { + return subdivision; + } - public Country getCountry() { - return country; - } + public void setSubdivision(Subdivision subdivision) { + this.subdivision = subdivision; + } - public void setCountry(Country country) { - this.country = country; - } + public Country getCountry() { + return country; + } - public String getStreet() { - return street; - } + public void setCountry(Country country) { + this.country = country; + } - public void setStreet(String street) { - this.street = street; - } + public String getStreet() { + return street; + } - public String getPostalcode() { - return postalcode; - } + public void setStreet(String street) { + this.street = street; + } - public void setPostalcode(String postalcode) { - this.postalcode = postalcode; - } + public String getPostalcode() { + return postalcode; + } - public String getCity() { - return city; - } + public void setPostalcode(String postalcode) { + this.postalcode = postalcode; + } - public void setCity(String city) { - this.city = city; - } + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java index e828273d4..33c6e02f1 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Contact.java @@ -7,95 +7,95 @@ */ public class Contact extends Identity { - private String firstname; - private String lastname; - private String title; + private String firstname; + private String lastname; + private String title; - private LocalDate birthday; + private LocalDate birthday; - private String role; - private String department; + private String role; + private String department; - private String emailAddress; - private String phoneNumber; - private String mobileNumber; + private String emailAddress; + private String phoneNumber; + private String mobileNumber; - private final Address address = new Address(); + private final Address address = new Address(); - public Address getAddress() { - return address; - } + public Address getAddress() { + return address; + } - public String getFirstname() { - return firstname; - } + public String getFirstname() { + return firstname; + } - public void setFirstname(String firstname) { - this.firstname = firstname; - } + public void setFirstname(String firstname) { + this.firstname = firstname; + } - public String getLastname() { - return lastname; - } + public String getLastname() { + return lastname; + } - public void setLastname(String lastname) { - this.lastname = lastname; - } + public void setLastname(String lastname) { + this.lastname = lastname; + } - public String getTitle() { - return title; - } + public String getTitle() { + return title; + } - public void setTitle(String title) { - this.title = title; - } + public void setTitle(String title) { + this.title = title; + } - public LocalDate getBirthday() { - return birthday; - } + public LocalDate getBirthday() { + return birthday; + } - public void setBirthday(LocalDate birthday) { - this.birthday = birthday; - } + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } - public String getRole() { - return role; - } + public String getRole() { + return role; + } - public void setRole(String role) { - this.role = role; - } + public void setRole(String role) { + this.role = role; + } - public String getDepartment() { - return department; - } + public String getDepartment() { + return department; + } - public void setDepartment(String department) { - this.department = department; - } + public void setDepartment(String department) { + this.department = department; + } - public String getEmailAddress() { - return emailAddress; - } + public String getEmailAddress() { + return emailAddress; + } - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } - public String getPhoneNumber() { - return phoneNumber; - } + public String getPhoneNumber() { + return phoneNumber; + } - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } - public String getMobileNumber() { - return mobileNumber; - } + public String getMobileNumber() { + return mobileNumber; + } - public void setMobileNumber(String mobileNumber) { - this.mobileNumber = mobileNumber; - } + public void setMobileNumber(String mobileNumber) { + this.mobileNumber = mobileNumber; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java index 9e027ab4e..5a37c9d3b 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/ContactFactory.java @@ -11,84 +11,84 @@ */ public class ContactFactory { - /** - * @return a contact with random generated demo content. - */ - public static Contact createRandomContact() { - Contact contact = new Contact(); + /** + * @return a contact with random generated demo content. + */ + public static Contact createRandomContact() { + Contact contact = new Contact(); - contact.setFirstname(new Random().nextBoolean() ? getFemaleFirstname() : getMaleFirstname()); - contact.setLastname(getLastname()); + contact.setFirstname(new Random().nextBoolean() ? getFemaleFirstname() : getMaleFirstname()); + contact.setLastname(getLastname()); - contact.setBirthday(getBirthday()); + contact.setBirthday(getBirthday()); - contact.setEmailAddress(getEmailAddress(contact.getFirstname())); - contact.setPhoneNumber(getPhoneNumber()); - contact.setMobileNumber(getPhoneNumber()); + contact.setEmailAddress(getEmailAddress(contact.getFirstname())); + contact.setPhoneNumber(getPhoneNumber()); + contact.setMobileNumber(getPhoneNumber()); - return contact; - } + return contact; + } - private static LocalDate getBirthday() { - int year = (2014 - 50) + new Random().nextInt(50); + private static LocalDate getBirthday() { + int year = (2014 - 50) + new Random().nextInt(50); - int month = new Random().nextInt(12) + 1; + int month = new Random().nextInt(12) + 1; - int day = new Random().nextInt(27) + 1; + int day = new Random().nextInt(27) + 1; - return LocalDate.of(year, month, day); - } + return LocalDate.of(year, month, day); + } - private static String getPhoneNumber() { - StringBuilder number = new StringBuilder(); + private static String getPhoneNumber() { + StringBuilder number = new StringBuilder(); - number.append("+49 "); + number.append("+49 "); - for (int i = 0; i < 11; i++) { - number.append(getRandomNumber()); - } + for (int i = 0; i < 11; i++) { + number.append(getRandomNumber()); + } - return number.toString(); - } + return number.toString(); + } - private static String getEmailAddress(String firstname) { - StringBuilder emailAddress = new StringBuilder(); + private static String getEmailAddress(String firstname) { + StringBuilder emailAddress = new StringBuilder(); - emailAddress.append(firstname); - emailAddress.append(getRandomNumber()); - emailAddress.append(getRandomNumber()); - emailAddress.append("@"); + emailAddress.append(firstname); + emailAddress.append(getRandomNumber()); + emailAddress.append(getRandomNumber()); + emailAddress.append("@"); - List<String> domains = Arrays.asList("example.com", "example.org", "mail.example.com"); - emailAddress.append(domains.get(new Random().nextInt(domains.size()))); + List<String> domains = Arrays.asList("example.com", "example.org", "mail.example.com"); + emailAddress.append(domains.get(new Random().nextInt(domains.size()))); - return emailAddress.toString(); - } + return emailAddress.toString(); + } - private static String getLastname() { + private static String getLastname() { - List<String> names = Arrays.asList("Smith", "Brown", "Lee", "Johnson", "Williams", "Müller", "Schmidt", - "Schneider"); + List<String> names = Arrays.asList("Smith", "Brown", "Lee", "Johnson", "Williams", "Müller", "Schmidt", + "Schneider"); - return names.get(new Random().nextInt(names.size())); - } + return names.get(new Random().nextInt(names.size())); + } - private static String getMaleFirstname() { + private static String getMaleFirstname() { - List<String> names = Arrays.asList("Max", "Paul", "Leon", "Lucas", "Jonas", "Ben", "Tim", "David"); + List<String> names = Arrays.asList("Max", "Paul", "Leon", "Lucas", "Jonas", "Ben", "Tim", "David"); - return names.get(new Random().nextInt(names.size())); - } + return names.get(new Random().nextInt(names.size())); + } - private static String getFemaleFirstname() { + private static String getFemaleFirstname() { - List<String> names = Arrays.asList("Marie", "Julia", "Anne", "Laura", "Lisa", "Sarah", "Michelle", "Sophie"); + List<String> names = Arrays.asList("Marie", "Julia", "Anne", "Laura", "Lisa", "Sarah", "Michelle", "Sophie"); - return names.get(new Random().nextInt(names.size())); - } + return names.get(new Random().nextInt(names.size())); + } - private static int getRandomNumber() { - return new Random().nextInt(10); - } + private static int getRandomNumber() { + return new Random().nextInt(10); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java index fb47ad8ae..552a04350 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Country.java @@ -9,72 +9,72 @@ @XmlAccessorType(XmlAccessType.FIELD) public class Country { - @XmlAttribute(name = "name") - private String name; - - @XmlAttribute(name = "alpha_2_code") - private String countryCode; - - Country() { - - } - - public Country(String name, String countryCode) { - this.name = name; - this.countryCode = countryCode; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCountryCode() { - return countryCode; - } - - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - if (name == null || countryCode == null) { - return false; - } - - Country country = (Country) o; - - if (!name.equals(country.name)) { - return false; - } - - if (!countryCode.equals(country.countryCode)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = name == null ? 13 : name.hashCode(); - result += countryCode == null ? 13 : countryCode.hashCode(); - return result; - } - - @Override - public String toString() { - return "Country:" + name + ", code:" + countryCode; - } + @XmlAttribute(name = "name") + private String name; + + @XmlAttribute(name = "alpha_2_code") + private String countryCode; + + Country() { + + } + + public Country(String name, String countryCode) { + this.name = name; + this.countryCode = countryCode; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + if (name == null || countryCode == null) { + return false; + } + + Country country = (Country) o; + + if (!name.equals(country.name)) { + return false; + } + + if (!countryCode.equals(country.countryCode)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = name == null ? 13 : name.hashCode(); + result += countryCode == null ? 13 : countryCode.hashCode(); + return result; + } + + @Override + public String toString() { + return "Country:" + name + ", code:" + countryCode; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java index 67def9047..8e5a9ab5c 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelector.java @@ -48,204 +48,204 @@ */ public class CountrySelector { - private static final Logger LOG = LoggerFactory.getLogger(CountrySelector.class); - - public static final String ISO_3166_LOCATION = "/countries/iso_3166.xml"; - public static final String ISO_3166_2_LOCATION = "/countries/iso_3166_2.xml"; - private ObservableList<Country> countries = FXCollections.observableArrayList(); - private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); - - private ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); - - private ReadOnlyBooleanWrapper inProgress = new ReadOnlyBooleanWrapper(false); - - private Map<Country, List<Subdivision>> countryCodeSubdivisionMap = new HashMap<>(); - private Map<Country, String> countryCodeSubdivisionNameMap = new HashMap<>(); - - /** - * This method triggers the loading of the available countries and - * subdivisions. - */ - public void init() { - inProgress.set(true); - loadCountries(); - } - - /** - * Set the currently selected country. This will lead to an update of the - * {@link #subdivisions()} observable list and the - * {@link #subdivisionLabel()}. - * - * @param country the country that will be selected or <code>null</code> if - * no country is selected. - */ - public void setCountry(Country country) { - if (country == null) { - subdivisionLabel.set(null); - subdivisions.clear(); - return; - } - - subdivisionLabel.set(countryCodeSubdivisionNameMap.get(country)); - - subdivisions.clear(); - if (countryCodeSubdivisionMap.containsKey(country)) { - subdivisions.addAll(countryCodeSubdivisionMap.get(country)); - } - } - - /** - * Load all countries from the XML file source with DataFX. - */ - void loadCountries() { - URL iso3166Resource = this.getClass().getResource(ISO_3166_LOCATION); - if (iso3166Resource == null) { - throw new IllegalStateException("Can't find the list of countries! Expected location was:" - + ISO_3166_LOCATION); - } - - XmlConverter<Country> countryConverter = new XmlConverter<>("iso_3166_entry", Country.class); - - try { - FileSource<Country> dataSource = new FileSource<>(new File(iso3166Resource.getFile()), countryConverter); - ListDataProvider<Country> listDataProvider = new ListDataProvider<>(dataSource); - - listDataProvider.setResultObservableList(countries); - - Worker<ObservableList<Country>> worker = listDataProvider.retrieve(); - // when the countries are loaded we start the loading of the subdivisions. - worker.stateProperty().addListener(obs -> { - if (worker.getState() == Worker.State.SUCCEEDED) { - loadSubdivisions(); - } - }); - } catch (IOException e) { - LOG.error("A problem was detected while loading the XML file with the available countries.", e); - } - } - - /** - * Load all subdivisions from the XML file source with DataFX. - */ - void loadSubdivisions() { - - URL iso3166_2Resource = this.getClass().getResource(ISO_3166_2_LOCATION); - - if (iso3166_2Resource == null) { - throw new IllegalStateException("Can't find the list of subdivisions! Expected location was:" - + ISO_3166_2_LOCATION); - } - - XmlConverter<ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", - ISO3166_2_CountryEntity.class); - - ObservableList<ISO3166_2_CountryEntity> subdivisionsEntities = FXCollections.observableArrayList(); - - try { - FileSource<ISO3166_2_CountryEntity> dataSource = new FileSource<>(new File(iso3166_2Resource.getFile()), - converter); - ListDataProvider<ISO3166_2_CountryEntity> listDataProvider = new ListDataProvider<>(dataSource); - - listDataProvider.setResultObservableList(subdivisionsEntities); - - Worker<ObservableList<ISO3166_2_CountryEntity>> worker = listDataProvider.retrieve(); - worker.stateProperty().addListener(obs -> { - if (worker.getState() == Worker.State.SUCCEEDED) { - - subdivisionsEntities.forEach(entity -> { - if (entity.subsets != null && !entity.subsets.isEmpty()) { - - Country country = findCountryByCode(entity.code); - - if (!countryCodeSubdivisionMap.containsKey(country)) { - countryCodeSubdivisionMap.put(country, new ArrayList<>()); - } - - List<Subdivision> subdivisionList = countryCodeSubdivisionMap.get(country); - - entity.subsets.get(0).entryList.forEach(entry -> { - subdivisionList.add(new Subdivision(entry.name, entry.code, country)); - }); - - countryCodeSubdivisionNameMap.put(country, entity.subsets.get(0).subdivisionType); - } - }); - - inProgress.set(false); - } - }); - } catch (IOException e) { - LOG.error("A problem was detected while loading the XML file with the available subdivisions.", e); - } - - } - - private Country findCountryByCode(String code) { - return countries.stream().filter(country -> country.getCountryCode().equals(code)).findFirst().orElse(null); - } - - /** - * XML entity class. These classes represent the structure of the XML files - * to be loaded. - */ - @XmlRootElement(name = "iso_3166_subset") - @XmlAccessorType(XmlAccessType.FIELD) - static class ISO3166_2_EntryEntity { - - @XmlAttribute(name = "code") - public String code; - @XmlAttribute(name = "name") - public String name; - } - - /** - * XML entity class. These classes represent the structure of the XML files - * to be loaded. - */ - @XmlRootElement(name = "iso_3166_subset") - @XmlAccessorType(XmlAccessType.FIELD) - static class ISO3166_2_SubsetEntity { - - @XmlElement(name = "iso_3166_2_entry") - public List<ISO3166_2_EntryEntity> entryList; - - @XmlAttribute(name = "type") - public String subdivisionType; - } - - /** - * XML entity class. These classes represent the structure of the XML files - * to be loaded. - */ - @XmlRootElement(name = "iso_3166_country") - @XmlAccessorType(XmlAccessType.FIELD) - static class ISO3166_2_CountryEntity { - - @XmlAttribute(name = "code") - public String code; - - @XmlElement(name = "iso_3166_subset") - public List<ISO3166_2_SubsetEntity> subsets; - - @Override - public String toString() { - return "CountryEntity " + code; - } - } - - public ObservableList<Country> availableCountries() { - return countries; - } - - public ReadOnlyStringProperty subdivisionLabel() { - return subdivisionLabel.getReadOnlyProperty(); - } - - public ObservableList<Subdivision> subdivisions() { - return FXCollections.unmodifiableObservableList(subdivisions); - } - - public ReadOnlyBooleanProperty inProgressProperty() { - return inProgress.getReadOnlyProperty(); - } + private static final Logger LOG = LoggerFactory.getLogger(CountrySelector.class); + + public static final String ISO_3166_LOCATION = "/countries/iso_3166.xml"; + public static final String ISO_3166_2_LOCATION = "/countries/iso_3166_2.xml"; + private ObservableList<Country> countries = FXCollections.observableArrayList(); + private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); + + private ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); + + private ReadOnlyBooleanWrapper inProgress = new ReadOnlyBooleanWrapper(false); + + private Map<Country, List<Subdivision>> countryCodeSubdivisionMap = new HashMap<>(); + private Map<Country, String> countryCodeSubdivisionNameMap = new HashMap<>(); + + /** + * This method triggers the loading of the available countries and + * subdivisions. + */ + public void init() { + inProgress.set(true); + loadCountries(); + } + + /** + * Set the currently selected country. This will lead to an update of the + * {@link #subdivisions()} observable list and the + * {@link #subdivisionLabel()}. + * + * @param country the country that will be selected or <code>null</code> if + * no country is selected. + */ + public void setCountry(Country country) { + if (country == null) { + subdivisionLabel.set(null); + subdivisions.clear(); + return; + } + + subdivisionLabel.set(countryCodeSubdivisionNameMap.get(country)); + + subdivisions.clear(); + if (countryCodeSubdivisionMap.containsKey(country)) { + subdivisions.addAll(countryCodeSubdivisionMap.get(country)); + } + } + + /** + * Load all countries from the XML file source with DataFX. + */ + void loadCountries() { + URL iso3166Resource = this.getClass().getResource(ISO_3166_LOCATION); + if (iso3166Resource == null) { + throw new IllegalStateException("Can't find the list of countries! Expected location was:" + + ISO_3166_LOCATION); + } + + XmlConverter<Country> countryConverter = new XmlConverter<>("iso_3166_entry", Country.class); + + try { + FileSource<Country> dataSource = new FileSource<>(new File(iso3166Resource.getFile()), countryConverter); + ListDataProvider<Country> listDataProvider = new ListDataProvider<>(dataSource); + + listDataProvider.setResultObservableList(countries); + + Worker<ObservableList<Country>> worker = listDataProvider.retrieve(); + // when the countries are loaded we start the loading of the subdivisions. + worker.stateProperty().addListener(obs -> { + if (worker.getState() == Worker.State.SUCCEEDED) { + loadSubdivisions(); + } + }); + } catch (IOException e) { + LOG.error("A problem was detected while loading the XML file with the available countries.", e); + } + } + + /** + * Load all subdivisions from the XML file source with DataFX. + */ + void loadSubdivisions() { + + URL iso3166_2Resource = this.getClass().getResource(ISO_3166_2_LOCATION); + + if (iso3166_2Resource == null) { + throw new IllegalStateException("Can't find the list of subdivisions! Expected location was:" + + ISO_3166_2_LOCATION); + } + + XmlConverter<ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", + ISO3166_2_CountryEntity.class); + + ObservableList<ISO3166_2_CountryEntity> subdivisionsEntities = FXCollections.observableArrayList(); + + try { + FileSource<ISO3166_2_CountryEntity> dataSource = new FileSource<>(new File(iso3166_2Resource.getFile()), + converter); + ListDataProvider<ISO3166_2_CountryEntity> listDataProvider = new ListDataProvider<>(dataSource); + + listDataProvider.setResultObservableList(subdivisionsEntities); + + Worker<ObservableList<ISO3166_2_CountryEntity>> worker = listDataProvider.retrieve(); + worker.stateProperty().addListener(obs -> { + if (worker.getState() == Worker.State.SUCCEEDED) { + + subdivisionsEntities.forEach(entity -> { + if (entity.subsets != null && !entity.subsets.isEmpty()) { + + Country country = findCountryByCode(entity.code); + + if (!countryCodeSubdivisionMap.containsKey(country)) { + countryCodeSubdivisionMap.put(country, new ArrayList<>()); + } + + List<Subdivision> subdivisionList = countryCodeSubdivisionMap.get(country); + + entity.subsets.get(0).entryList.forEach(entry -> { + subdivisionList.add(new Subdivision(entry.name, entry.code, country)); + }); + + countryCodeSubdivisionNameMap.put(country, entity.subsets.get(0).subdivisionType); + } + }); + + inProgress.set(false); + } + }); + } catch (IOException e) { + LOG.error("A problem was detected while loading the XML file with the available subdivisions.", e); + } + + } + + private Country findCountryByCode(String code) { + return countries.stream().filter(country -> country.getCountryCode().equals(code)).findFirst().orElse(null); + } + + /** + * XML entity class. These classes represent the structure of the XML files + * to be loaded. + */ + @XmlRootElement(name = "iso_3166_subset") + @XmlAccessorType(XmlAccessType.FIELD) + static class ISO3166_2_EntryEntity { + + @XmlAttribute(name = "code") + public String code; + @XmlAttribute(name = "name") + public String name; + } + + /** + * XML entity class. These classes represent the structure of the XML files + * to be loaded. + */ + @XmlRootElement(name = "iso_3166_subset") + @XmlAccessorType(XmlAccessType.FIELD) + static class ISO3166_2_SubsetEntity { + + @XmlElement(name = "iso_3166_2_entry") + public List<ISO3166_2_EntryEntity> entryList; + + @XmlAttribute(name = "type") + public String subdivisionType; + } + + /** + * XML entity class. These classes represent the structure of the XML files + * to be loaded. + */ + @XmlRootElement(name = "iso_3166_country") + @XmlAccessorType(XmlAccessType.FIELD) + static class ISO3166_2_CountryEntity { + + @XmlAttribute(name = "code") + public String code; + + @XmlElement(name = "iso_3166_subset") + public List<ISO3166_2_SubsetEntity> subsets; + + @Override + public String toString() { + return "CountryEntity " + code; + } + } + + public ObservableList<Country> availableCountries() { + return countries; + } + + public ReadOnlyStringProperty subdivisionLabel() { + return subdivisionLabel.getReadOnlyProperty(); + } + + public ObservableList<Subdivision> subdivisions() { + return FXCollections.unmodifiableObservableList(subdivisions); + } + + public ReadOnlyBooleanProperty inProgressProperty() { + return inProgress.getReadOnlyProperty(); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java index 1182be7c5..d94e8bf4b 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Identity.java @@ -10,37 +10,37 @@ */ public abstract class Identity { - private String id; - - public Identity() { - id = UUID.randomUUID().toString(); - } - - public String getId() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Identity identity = (Identity) o; - - if (!id.equals(identity.id)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - return id.hashCode(); - } - + private String id; + + public Identity() { + id = UUID.randomUUID().toString(); + } + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Identity identity = (Identity) o; + + if (!id.equals(identity.id)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + return id.hashCode(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java index 46caff397..f0513b2ab 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/InmemoryRepository.java @@ -13,37 +13,37 @@ @Singleton public class InmemoryRepository implements Repository { - private final Set<Contact> contacts = new HashSet<>(); - - @Inject - private Event<ContactsUpdatedEvent> contactsUpdatedEvent; - - @Override - public Set<Contact> findAll() { - return Collections.unmodifiableSet(contacts); - } - - @Override - public Optional<Contact> findById(String id) { - return contacts.stream().filter(contact -> contact.getId().equals(id)).findFirst(); - } - - @Override - public void save(Contact contact) { - contacts.add(contact); - fireUpdateEvent(); - } - - @Override - public void delete(Contact contact) { - contacts.remove(contact); - fireUpdateEvent(); - } - - private void fireUpdateEvent() { - if (contactsUpdatedEvent != null) { - contactsUpdatedEvent.fire(new ContactsUpdatedEvent()); - } - } - + private final Set<Contact> contacts = new HashSet<>(); + + @Inject + private Event<ContactsUpdatedEvent> contactsUpdatedEvent; + + @Override + public Set<Contact> findAll() { + return Collections.unmodifiableSet(contacts); + } + + @Override + public Optional<Contact> findById(String id) { + return contacts.stream().filter(contact -> contact.getId().equals(id)).findFirst(); + } + + @Override + public void save(Contact contact) { + contacts.add(contact); + fireUpdateEvent(); + } + + @Override + public void delete(Contact contact) { + contacts.remove(contact); + fireUpdateEvent(); + } + + private void fireUpdateEvent() { + if (contactsUpdatedEvent != null) { + contactsUpdatedEvent.fire(new ContactsUpdatedEvent()); + } + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java index 2fe7b2206..c2a51df0e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Repository.java @@ -5,12 +5,12 @@ public interface Repository { - Set<Contact> findAll(); + Set<Contact> findAll(); - Optional<Contact> findById(String id); + Optional<Contact> findById(String id); - void save(Contact contact); + void save(Contact contact); + + void delete(Contact contact); - void delete(Contact contact); - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java index 2ce714eb5..33765142f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/model/Subdivision.java @@ -2,59 +2,59 @@ public class Subdivision { - private final String name; - private final String abbr; - - private final Country country; - - public Subdivision(String name, String abbr, Country country) { - this.name = name; - this.abbr = abbr; - this.country = country; - } - - public String getName() { - return name; - } - - public String getAbbr() { - return abbr; - } - - public Country getCountry() { - return country; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Subdivision that = (Subdivision) o; - - if (!abbr.equals(that.abbr)) { - return false; - } - if (!country.equals(that.country)) { - return false; - } - if (!name.equals(that.name)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = name.hashCode(); - result = 31 * result + abbr.hashCode(); - result = 31 * result + country.hashCode(); - return result; - } - + private final String name; + private final String abbr; + + private final Country country; + + public Subdivision(String name, String abbr, Country country) { + this.name = name; + this.abbr = abbr; + this.country = country; + } + + public String getName() { + return name; + } + + public String getAbbr() { + return abbr; + } + + public Country getCountry() { + return country; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Subdivision that = (Subdivision) o; + + if (!abbr.equals(that.abbr)) { + return false; + } + if (!country.equals(that.country)) { + return false; + } + if (!name.equals(that.name)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = name.hashCode(); + result = 31 * result + abbr.hashCode(); + result = 31 * result + country.hashCode(); + return result; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java index 9ff5b6699..2ae07c613 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.java @@ -9,16 +9,16 @@ @Singleton public class AboutAuthorView implements FxmlView<AboutAuthorViewModel> { - @InjectViewModel - private AboutAuthorViewModel viewModel; + @InjectViewModel + private AboutAuthorViewModel viewModel; - @FXML - public void openBlog() { - viewModel.openBlog(); - } + @FXML + public void openBlog() { + viewModel.openBlog(); + } - @FXML - public void openTwitter() { - viewModel.openTwitter(); - } + @FXML + public void openTwitter() { + viewModel.openTwitter(); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java index b0353a6fa..ce35bd5b7 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorViewModel.java @@ -7,15 +7,15 @@ public class AboutAuthorViewModel implements ViewModel { - @Inject - private HostServices hostServices; + @Inject + private HostServices hostServices; - public void openBlog() { - hostServices.showDocument("http://www.lestard.eu"); - } + public void openBlog() { + hostServices.showDocument("http://www.lestard.eu"); + } + + public void openTwitter() { + hostServices.showDocument("https://twitter.com/manuel_mauky"); + } - public void openTwitter() { - hostServices.showDocument("https://twitter.com/manuel_mauky"); - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java index 0eea6738f..f80196417 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.java @@ -17,29 +17,29 @@ @Singleton public class AboutView implements FxmlView<AboutViewModel> { - @FXML - private HyperlinkLabel librariesLabel; - - @InjectViewModel - private AboutViewModel viewModel; - - @Inject - private Stage primaryStage; - - public void initialize() { - librariesLabel.textProperty().bind(viewModel.librariesLabelTextProperty()); - librariesLabel.setOnAction(event -> { - Hyperlink link = (Hyperlink) event.getSource(); - String str = link == null ? "" : link.getText(); - viewModel.onLinkClicked(str); - }); - } - - @FXML - public void openAuthorPage() { - Parent view = FluentViewLoader.fxmlView(AboutAuthorView.class) - .load().getView(); - DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - } + @FXML + private HyperlinkLabel librariesLabel; + + @InjectViewModel + private AboutViewModel viewModel; + + @Inject + private Stage primaryStage; + + public void initialize() { + librariesLabel.textProperty().bind(viewModel.librariesLabelTextProperty()); + librariesLabel.setOnAction(event -> { + Hyperlink link = (Hyperlink) event.getSource(); + String str = link == null ? "" : link.getText(); + viewModel.onLinkClicked(str); + }); + } + + @FXML + public void openAuthorPage() { + Parent view = FluentViewLoader.fxmlView(AboutAuthorView.class) + .load().getView(); + DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java index 5d08da110..03b23c0a0 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModel.java @@ -16,59 +16,59 @@ public class AboutViewModel implements ViewModel { - @Inject - private HostServices hostServices; - - @Inject - private NotificationCenter notificationCenter; - - private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); - - // Package Private because of testing reasons - ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); - - /** - * Sadly the {@link javafx.application.HostServices} class of JavaFX is - * <code>final</code> so we can't mock it in tests. To still be able to test - * link actions we have introduced this handler as a mockable indirection. - */ - Consumer<String> onLinkClickedHandler; - - public AboutViewModel() { - - libraryLinkMap.addListener((MapChangeListener<String, String>) change -> { - StringBuilder labelText = new StringBuilder(); - - libraryLinkMap.keySet().stream().sorted().forEach(libraryName -> { - labelText.append("- ["); - labelText.append(libraryName); - labelText.append("]\n"); - }); - - librariesLabelText.set(labelText.toString()); - }); - } - - @PostConstruct - public void initLibraryMap() { - onLinkClickedHandler = hostServices::showDocument; - - libraryLinkMap.put("DataFX", "http://www.javafxdata.org/"); - libraryLinkMap.put("ControlsFX", "http://fxexperience.com/controlsfx/"); - libraryLinkMap.put("FontAwesomeFX", "https://bitbucket.org/Jerady/fontawesomefx"); - libraryLinkMap.put("Advanced-Bindings", "https://github.com/lestard/advanced-bindings"); - libraryLinkMap.put("AssertJ-JavaFX", "https://github.com/lestard/assertj-javafx"); - libraryLinkMap.put("JFX-Testrunner", "https://github.com/sialcasa/jfx-testrunner"); - } - - public void onLinkClicked(String linkText) { - if (libraryLinkMap.containsKey(linkText)) { - onLinkClickedHandler.accept(libraryLinkMap.get(linkText)); - } - } - - public ReadOnlyStringProperty librariesLabelTextProperty() { - return librariesLabelText.getReadOnlyProperty(); - } + @Inject + private HostServices hostServices; + + @Inject + private NotificationCenter notificationCenter; + + private final ReadOnlyStringWrapper librariesLabelText = new ReadOnlyStringWrapper(""); + + // Package Private because of testing reasons + ObservableMap<String, String> libraryLinkMap = FXCollections.observableHashMap(); + + /** + * Sadly the {@link javafx.application.HostServices} class of JavaFX is + * <code>final</code> so we can't mock it in tests. To still be able to test + * link actions we have introduced this handler as a mockable indirection. + */ + Consumer<String> onLinkClickedHandler; + + public AboutViewModel() { + + libraryLinkMap.addListener((MapChangeListener<String, String>) change -> { + StringBuilder labelText = new StringBuilder(); + + libraryLinkMap.keySet().stream().sorted().forEach(libraryName -> { + labelText.append("- ["); + labelText.append(libraryName); + labelText.append("]\n"); + }); + + librariesLabelText.set(labelText.toString()); + }); + } + + @PostConstruct + public void initLibraryMap() { + onLinkClickedHandler = hostServices::showDocument; + + libraryLinkMap.put("DataFX", "http://www.javafxdata.org/"); + libraryLinkMap.put("ControlsFX", "http://fxexperience.com/controlsfx/"); + libraryLinkMap.put("FontAwesomeFX", "https://bitbucket.org/Jerady/fontawesomefx"); + libraryLinkMap.put("Advanced-Bindings", "https://github.com/lestard/advanced-bindings"); + libraryLinkMap.put("AssertJ-JavaFX", "https://github.com/lestard/assertj-javafx"); + libraryLinkMap.put("JFX-Testrunner", "https://github.com/sialcasa/jfx-testrunner"); + } + + public void onLinkClicked(String linkText) { + if (libraryLinkMap.containsKey(linkText)) { + onLinkClickedHandler.accept(libraryLinkMap.get(linkText)); + } + } + + public ReadOnlyStringProperty librariesLabelTextProperty() { + return librariesLabelText.getReadOnlyProperty(); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java index 4609fcf78..3246d7f5e 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.java @@ -9,19 +9,19 @@ @Singleton public class AddContactDialogView implements FxmlView<AddContactDialogViewModel> { - @InjectViewModel - private AddContactDialogViewModel viewModel; + @InjectViewModel + private AddContactDialogViewModel viewModel; - private Stage showDialog; + private Stage showDialog; - public void initialize() { - viewModel.subscribe(AddContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { - showDialog.close(); - }); - } + public void initialize() { + viewModel.subscribe(AddContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + showDialog.close(); + }); + } - public void setDisplayingStage(Stage showDialog) { - this.showDialog = showDialog; - } + public void setDisplayingStage(Stage showDialog) { + this.showDialog = showDialog; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java index 28680f9f1..ffd2ed1ab 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogViewModel.java @@ -12,44 +12,44 @@ public class AddContactDialogViewModel implements ViewModel { - public static final String CLOSE_DIALOG_NOTIFICATION = "closeDialog"; + public static final String CLOSE_DIALOG_NOTIFICATION = "closeDialog"; - static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; + static final String TITLE_LABEL_KEY = "dialog.addcontact.title"; - @Inject - private Repository repository; + @Inject + private Repository repository; - @InjectScope - private ContactDialogScope dialogScope; + @InjectScope + private ContactDialogScope dialogScope; - @Inject - private ResourceBundle defaultResourceBundle; + @Inject + private ResourceBundle defaultResourceBundle; - public void initialize() { - dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { - addContactAction(); - }); + public void initialize() { + dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { + addContactAction(); + }); - dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - dialogScope.publish(ContactDialogScope.RESET_FORMS); - Contact contact = new Contact(); - dialogScope.setContactToEdit(contact); - } + dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); + dialogScope.publish(ContactDialogScope.RESET_FORMS); + Contact contact = new Contact(); + dialogScope.setContactToEdit(contact); + } - public void addContactAction() { - if (dialogScope.isContactFormValid()) { + public void addContactAction() { + if (dialogScope.isContactFormValid()) { - dialogScope.publish(ContactDialogScope.COMMIT); + dialogScope.publish(ContactDialogScope.COMMIT); - Contact contact = dialogScope.getContactToEdit(); + Contact contact = dialogScope.getContactToEdit(); - repository.save(contact); + repository.save(contact); - dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); - dialogScope.setContactToEdit(null); + dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); + dialogScope.setContactToEdit(null); + + publish(CLOSE_DIALOG_NOTIFICATION); + } + } - publish(CLOSE_DIALOG_NOTIFICATION); - } - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java index 69b29387a..226fabd05 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.java @@ -10,47 +10,47 @@ public class AddressFormView implements FxmlView<AddressFormViewModel> { - @FXML - public TextField streetInput; - @FXML - public TextField postalcodeInput; - @FXML - public TextField cityInput; - - @FXML - public ComboBox<String> countryInput; - @FXML - public ComboBox<String> federalStateInput; - - @FXML - public Label subdivisionLabel; - @FXML - public Label countryLabel; - - @FXML - public ProgressIndicator loadingIndicator; - - @InjectViewModel - private AddressFormViewModel viewModel; - - public void initialize() { - loadingIndicator.visibleProperty().bind(viewModel.loadingInProgressProperty()); - countryLabel.disableProperty().bind(viewModel.countryInputDisabledProperty()); - - streetInput.textProperty().bindBidirectional(viewModel.streetProperty()); - postalcodeInput.textProperty().bindBidirectional(viewModel.postalCodeProperty()); - cityInput.textProperty().bindBidirectional(viewModel.cityProperty()); - - countryInput.setItems(viewModel.countriesList()); - countryInput.valueProperty().bindBidirectional(viewModel.selectedCountryProperty()); - countryInput.disableProperty().bind(viewModel.countryInputDisabledProperty()); - - federalStateInput.setItems(viewModel.subdivisionsList()); - federalStateInput.valueProperty().bindBidirectional(viewModel.selectedSubdivisionProperty()); - federalStateInput.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); - - subdivisionLabel.textProperty().bind(viewModel.subdivisionLabel()); - subdivisionLabel.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); - } - + @FXML + public TextField streetInput; + @FXML + public TextField postalcodeInput; + @FXML + public TextField cityInput; + + @FXML + public ComboBox<String> countryInput; + @FXML + public ComboBox<String> federalStateInput; + + @FXML + public Label subdivisionLabel; + @FXML + public Label countryLabel; + + @FXML + public ProgressIndicator loadingIndicator; + + @InjectViewModel + private AddressFormViewModel viewModel; + + public void initialize() { + loadingIndicator.visibleProperty().bind(viewModel.loadingInProgressProperty()); + countryLabel.disableProperty().bind(viewModel.countryInputDisabledProperty()); + + streetInput.textProperty().bindBidirectional(viewModel.streetProperty()); + postalcodeInput.textProperty().bindBidirectional(viewModel.postalCodeProperty()); + cityInput.textProperty().bindBidirectional(viewModel.cityProperty()); + + countryInput.setItems(viewModel.countriesList()); + countryInput.valueProperty().bindBidirectional(viewModel.selectedCountryProperty()); + countryInput.disableProperty().bind(viewModel.countryInputDisabledProperty()); + + federalStateInput.setItems(viewModel.subdivisionsList()); + federalStateInput.valueProperty().bindBidirectional(viewModel.selectedSubdivisionProperty()); + federalStateInput.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); + + subdivisionLabel.textProperty().bind(viewModel.subdivisionLabel()); + subdivisionLabel.disableProperty().bind(viewModel.subdivisionInputDisabledProperty()); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java index 1475494de..52a54151d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModel.java @@ -30,225 +30,225 @@ public class AddressFormViewModel implements ViewModel { - static final String NOTHING_SELECTED_MARKER = "---"; - static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; - - private ObservableList<String> countries; - private ObservableList<String> subdivisions; - - private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); - private final ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); - - private final StringProperty street = new SimpleStringProperty(); - private final StringProperty postalCode = new SimpleStringProperty(); - private final StringProperty city = new SimpleStringProperty(); - private final ObjectProperty<Subdivision> subdivision = new SimpleObjectProperty<>(); - private final ObjectProperty<Country> country = new SimpleObjectProperty<>(); - - private final StringProperty selectedCountry = new SimpleStringProperty(NOTHING_SELECTED_MARKER); - private final StringProperty selectedSubdivision = new SimpleStringProperty(NOTHING_SELECTED_MARKER); - - private final ReadOnlyBooleanWrapper loadingInProgress = new ReadOnlyBooleanWrapper(); - private final ReadOnlyBooleanWrapper countryInputDisabled = new ReadOnlyBooleanWrapper(); - private final ReadOnlyBooleanWrapper subdivisionInputDisabled = new ReadOnlyBooleanWrapper(); - - @Inject - CountrySelector countrySelector; - - @Inject - ResourceBundle resourceBundle; - - @InjectScope - ContactDialogScope dialogScope; - - // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. - private ItemList<Country> countryItemList; - // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. - private ItemList<Subdivision> subdivisionItemList; - private Address address; - - private ObjectBinding<Contact> contactBinding; - - public void initialize() { - dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); - - ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); - - if (contactToEditProperty.get() != null) { - initWithAddress(contactToEditProperty.get().getAddress()); - } - - contactToEditProperty.addListener((observable, oldValue, newValue) -> { - if (newValue != null) { - if (newValue.getAddress() == null) { - System.out.println("Address is null"); - } else { - initWithAddress(newValue.getAddress()); - } - } - }); - - loadingInProgress.bind(countrySelector.inProgressProperty()); - countrySelector.init(); - - initSubdivisionLabel(); - initCountryList(); - initSubdivisionList(); - - selectedCountry.addListener((obs, oldV, newV) -> { - if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { - Optional<Country> matchingCountry = countrySelector.availableCountries().stream() - .filter(country -> newV.equals(country.getName())) - .findFirst(); - - if (matchingCountry.isPresent()) { - countrySelector.setCountry(matchingCountry.get()); - country.set(matchingCountry.get()); - } - } else if (NOTHING_SELECTED_MARKER.equals(newV)) { - countrySelector.setCountry(null); - country.set(null); - } - selectedSubdivision.set(NOTHING_SELECTED_MARKER); - }); - - selectedSubdivision.addListener((obs, oldV, newV) -> { - if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { - Optional<Subdivision> subdivisionOptional = countrySelector.subdivisions().stream() - .filter(subdivision -> subdivision.getName().equals(newV)).findFirst(); - - if (subdivisionOptional.isPresent()) { - subdivision.set(subdivisionOptional.get()); - } else { - subdivision.set(null); - } - } else { - subdivision.set(null); - } - }); - - countryInputDisabled.bind(loadingInProgress); - subdivisionInputDisabled.bind(loadingInProgress.or(Bindings.size(subdivisionsList()).lessThanOrEqualTo(1))); - - dialogScope.addressFormValidProperty().bind(valid); - } - - void initSubdivisionLabel() { - subdivisionLabel.bind( - Bindings.when( - countrySelector.subdivisionLabel().isEmpty()) - .then(resourceBundle.getString(SUBDIVISION_LABEL_KEY)) - .otherwise(countrySelector.subdivisionLabel())); - } - - private void initSubdivisionList() { - subdivisionItemList = new ItemList<>(countrySelector.subdivisions(), Subdivision::getName); - subdivisions = createListWithNothingSelectedMarker(subdivisionItemList.getTargetList()); - subdivisions.addListener((ListChangeListener<String>) c -> selectedSubdivision.set(NOTHING_SELECTED_MARKER)); - } - - private void initCountryList() { - countryItemList = new ItemList<>(countrySelector.availableCountries(), Country::getName); - ObservableList<String> mappedList = countryItemList.getTargetList(); - - countries = createListWithNothingSelectedMarker(mappedList); - countries.addListener((ListChangeListener<String>) c -> selectedCountry.set(NOTHING_SELECTED_MARKER)); - } - - private void commitChanges() { - address.setStreet(street.get()); - address.setCity(city.get()); - address.setPostalcode(postalCode.get()); - address.setCountry(country.get()); - address.setSubdivision(subdivision.get()); - } - - public void initWithAddress(Address address) { - this.address = address; - street.set(address.getStreet()); - city.set(address.getCity()); - postalCode.set(address.getPostalcode()); - - if (address.getCountry() != null) { - selectedCountry.set(address.getCountry().getName()); - } - if (address.getSubdivision() != null) { - selectedSubdivision.set(address.getSubdivision().getName()); - } - } - - /** - * Creates an observable list that always has - * {@link #NOTHING_SELECTED_MARKER} as first element and the values of the - * given observable list. - */ - static ObservableList<String> createListWithNothingSelectedMarker(ObservableList<String> source) { - final ObservableList<String> result = FXCollections.observableArrayList(); - result.add(NOTHING_SELECTED_MARKER); - result.addAll(source); - - // for sure there are better solutions for this but it's sufficient for our demo - source.addListener((ListChangeListener<String>) c -> { - result.clear(); - result.add(NOTHING_SELECTED_MARKER); - result.addAll(source); - }); - return result; - } - - public ObservableList<String> countriesList() { - return countries; - } - - public ObservableList<String> subdivisionsList() { - return subdivisions; - } - - public StringProperty streetProperty() { - return street; - } - - public StringProperty cityProperty() { - return city; - } - - public StringProperty postalCodeProperty() { - return postalCode; - } - - public StringProperty selectedCountryProperty() { - return selectedCountry; - } - - public StringProperty selectedSubdivisionProperty() { - return selectedSubdivision; - } - - public ReadOnlyStringProperty subdivisionLabel() { - return subdivisionLabel.getReadOnlyProperty(); - } - - public ReadOnlyBooleanProperty loadingInProgressProperty() { - return loadingInProgress.getReadOnlyProperty(); - } - - public ReadOnlyBooleanProperty countryInputDisabledProperty() { - return countryInputDisabled.getReadOnlyProperty(); - } - - public ReadOnlyBooleanProperty subdivisionInputDisabledProperty() { - return subdivisionInputDisabled.getReadOnlyProperty(); - } - - private void resetForm() { - street.set(""); - city.set(""); - postalCode.set(""); - selectedCountry.set(NOTHING_SELECTED_MARKER); - selectedSubdivision.set(NOTHING_SELECTED_MARKER); - subdivision.set(null); - country.set(null); - } - + static final String NOTHING_SELECTED_MARKER = "---"; + static final String SUBDIVISION_LABEL_KEY = "addressform.subdivision.label"; + + private ObservableList<String> countries; + private ObservableList<String> subdivisions; + + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(true); + private final ReadOnlyStringWrapper subdivisionLabel = new ReadOnlyStringWrapper(); + + private final StringProperty street = new SimpleStringProperty(); + private final StringProperty postalCode = new SimpleStringProperty(); + private final StringProperty city = new SimpleStringProperty(); + private final ObjectProperty<Subdivision> subdivision = new SimpleObjectProperty<>(); + private final ObjectProperty<Country> country = new SimpleObjectProperty<>(); + + private final StringProperty selectedCountry = new SimpleStringProperty(NOTHING_SELECTED_MARKER); + private final StringProperty selectedSubdivision = new SimpleStringProperty(NOTHING_SELECTED_MARKER); + + private final ReadOnlyBooleanWrapper loadingInProgress = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper countryInputDisabled = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper subdivisionInputDisabled = new ReadOnlyBooleanWrapper(); + + @Inject + CountrySelector countrySelector; + + @Inject + ResourceBundle resourceBundle; + + @InjectScope + ContactDialogScope dialogScope; + + // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. + private ItemList<Country> countryItemList; + // Don't inline this field. It's needed to prevent the list mapping from being garbage collected. + private ItemList<Subdivision> subdivisionItemList; + private Address address; + + private ObjectBinding<Contact> contactBinding; + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); + + ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + + if (contactToEditProperty.get() != null) { + initWithAddress(contactToEditProperty.get().getAddress()); + } + + contactToEditProperty.addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + if (newValue.getAddress() == null) { + System.out.println("Address is null"); + } else { + initWithAddress(newValue.getAddress()); + } + } + }); + + loadingInProgress.bind(countrySelector.inProgressProperty()); + countrySelector.init(); + + initSubdivisionLabel(); + initCountryList(); + initSubdivisionList(); + + selectedCountry.addListener((obs, oldV, newV) -> { + if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { + Optional<Country> matchingCountry = countrySelector.availableCountries().stream() + .filter(country -> newV.equals(country.getName())) + .findFirst(); + + if (matchingCountry.isPresent()) { + countrySelector.setCountry(matchingCountry.get()); + country.set(matchingCountry.get()); + } + } else if (NOTHING_SELECTED_MARKER.equals(newV)) { + countrySelector.setCountry(null); + country.set(null); + } + selectedSubdivision.set(NOTHING_SELECTED_MARKER); + }); + + selectedSubdivision.addListener((obs, oldV, newV) -> { + if (newV != null && !newV.equals(NOTHING_SELECTED_MARKER)) { + Optional<Subdivision> subdivisionOptional = countrySelector.subdivisions().stream() + .filter(subdivision -> subdivision.getName().equals(newV)).findFirst(); + + if (subdivisionOptional.isPresent()) { + subdivision.set(subdivisionOptional.get()); + } else { + subdivision.set(null); + } + } else { + subdivision.set(null); + } + }); + + countryInputDisabled.bind(loadingInProgress); + subdivisionInputDisabled.bind(loadingInProgress.or(Bindings.size(subdivisionsList()).lessThanOrEqualTo(1))); + + dialogScope.addressFormValidProperty().bind(valid); + } + + void initSubdivisionLabel() { + subdivisionLabel.bind( + Bindings.when( + countrySelector.subdivisionLabel().isEmpty()) + .then(resourceBundle.getString(SUBDIVISION_LABEL_KEY)) + .otherwise(countrySelector.subdivisionLabel())); + } + + private void initSubdivisionList() { + subdivisionItemList = new ItemList<>(countrySelector.subdivisions(), Subdivision::getName); + subdivisions = createListWithNothingSelectedMarker(subdivisionItemList.getTargetList()); + subdivisions.addListener((ListChangeListener<String>) c -> selectedSubdivision.set(NOTHING_SELECTED_MARKER)); + } + + private void initCountryList() { + countryItemList = new ItemList<>(countrySelector.availableCountries(), Country::getName); + ObservableList<String> mappedList = countryItemList.getTargetList(); + + countries = createListWithNothingSelectedMarker(mappedList); + countries.addListener((ListChangeListener<String>) c -> selectedCountry.set(NOTHING_SELECTED_MARKER)); + } + + private void commitChanges() { + address.setStreet(street.get()); + address.setCity(city.get()); + address.setPostalcode(postalCode.get()); + address.setCountry(country.get()); + address.setSubdivision(subdivision.get()); + } + + public void initWithAddress(Address address) { + this.address = address; + street.set(address.getStreet()); + city.set(address.getCity()); + postalCode.set(address.getPostalcode()); + + if (address.getCountry() != null) { + selectedCountry.set(address.getCountry().getName()); + } + if (address.getSubdivision() != null) { + selectedSubdivision.set(address.getSubdivision().getName()); + } + } + + /** + * Creates an observable list that always has + * {@link #NOTHING_SELECTED_MARKER} as first element and the values of the + * given observable list. + */ + static ObservableList<String> createListWithNothingSelectedMarker(ObservableList<String> source) { + final ObservableList<String> result = FXCollections.observableArrayList(); + result.add(NOTHING_SELECTED_MARKER); + result.addAll(source); + + // for sure there are better solutions for this but it's sufficient for our demo + source.addListener((ListChangeListener<String>) c -> { + result.clear(); + result.add(NOTHING_SELECTED_MARKER); + result.addAll(source); + }); + return result; + } + + public ObservableList<String> countriesList() { + return countries; + } + + public ObservableList<String> subdivisionsList() { + return subdivisions; + } + + public StringProperty streetProperty() { + return street; + } + + public StringProperty cityProperty() { + return city; + } + + public StringProperty postalCodeProperty() { + return postalCode; + } + + public StringProperty selectedCountryProperty() { + return selectedCountry; + } + + public StringProperty selectedSubdivisionProperty() { + return selectedSubdivision; + } + + public ReadOnlyStringProperty subdivisionLabel() { + return subdivisionLabel.getReadOnlyProperty(); + } + + public ReadOnlyBooleanProperty loadingInProgressProperty() { + return loadingInProgress.getReadOnlyProperty(); + } + + public ReadOnlyBooleanProperty countryInputDisabledProperty() { + return countryInputDisabled.getReadOnlyProperty(); + } + + public ReadOnlyBooleanProperty subdivisionInputDisabledProperty() { + return subdivisionInputDisabled.getReadOnlyProperty(); + } + + private void resetForm() { + street.set(""); + city.set(""); + postalCode.set(""); + selectedCountry.set(NOTHING_SELECTED_MARKER); + selectedSubdivision.set(NOTHING_SELECTED_MARKER); + subdivision.set(null); + country.set(null); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java index 6ce343e7c..2aa5d0e29 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java @@ -18,79 +18,79 @@ public class ContactDialogView implements FxmlView<ContactDialogViewModel> { - @FXML - private Button okButton; + @FXML + private Button okButton; - @FXML - private Button previousButton; + @FXML + private Button previousButton; - @FXML - private Button nextButton; + @FXML + private Button nextButton; - @FXML - private Text titleText; + @FXML + private Text titleText; - @FXML - private Pagination formPagination; + @FXML + private Pagination formPagination; - @InjectViewModel - private ContactDialogViewModel viewModel; + @InjectViewModel + private ContactDialogViewModel viewModel; - public void initialize() { - ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader - .fxmlView(ContactFormView.class).load(); + public void initialize() { + ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader + .fxmlView(ContactFormView.class).load(); - ViewTuple<AddressFormView, AddressFormViewModel> addressFormTuple = FluentViewLoader - .fxmlView(AddressFormView.class).load(); + ViewTuple<AddressFormView, AddressFormViewModel> addressFormTuple = FluentViewLoader + .fxmlView(AddressFormView.class).load(); - formPagination.getStyleClass().add("invisible-pagination-control"); + formPagination.getStyleClass().add("invisible-pagination-control"); - formPagination.setPageFactory(index -> { - if (index == 0) { - return contactFormTuple.getView(); - } else { - return addressFormTuple.getView(); - } - }); + formPagination.setPageFactory(index -> { + if (index == 0) { + return contactFormTuple.getView(); + } else { + return addressFormTuple.getView(); + } + }); - formPagination.currentPageIndexProperty().bindBidirectional(viewModel.dialogPageProperty()); + formPagination.currentPageIndexProperty().bindBidirectional(viewModel.dialogPageProperty()); - AwesomeDude.setIcon(okButton, AwesomeIcon.CHECK); - AwesomeDude.setIcon(nextButton, AwesomeIcon.CHEVRON_RIGHT, ContentDisplay.RIGHT); - AwesomeDude.setIcon(previousButton, AwesomeIcon.CHEVRON_LEFT); + AwesomeDude.setIcon(okButton, AwesomeIcon.CHECK); + AwesomeDude.setIcon(nextButton, AwesomeIcon.CHEVRON_RIGHT, ContentDisplay.RIGHT); + AwesomeDude.setIcon(previousButton, AwesomeIcon.CHEVRON_LEFT); - okButton.disableProperty().bind(viewModel.okButtonDisabledProperty()); - okButton.visibleProperty().bind(viewModel.okButtonVisibleProperty()); - okButton.managedProperty().bind(viewModel.okButtonVisibleProperty()); + okButton.disableProperty().bind(viewModel.okButtonDisabledProperty()); + okButton.visibleProperty().bind(viewModel.okButtonVisibleProperty()); + okButton.managedProperty().bind(viewModel.okButtonVisibleProperty()); - nextButton.disableProperty().bind(viewModel.nextButtonDisabledProperty()); - nextButton.visibleProperty().bind(viewModel.nextButtonVisibleProperty()); - nextButton.managedProperty().bind(viewModel.nextButtonVisibleProperty()); + nextButton.disableProperty().bind(viewModel.nextButtonDisabledProperty()); + nextButton.visibleProperty().bind(viewModel.nextButtonVisibleProperty()); + nextButton.managedProperty().bind(viewModel.nextButtonVisibleProperty()); - previousButton.disableProperty().bind(viewModel.previousButtonDisabledProperty()); - previousButton.visibleProperty().bind(viewModel.previousButtonVisibleProperty()); - previousButton.managedProperty().bind(viewModel.previousButtonVisibleProperty()); + previousButton.disableProperty().bind(viewModel.previousButtonDisabledProperty()); + previousButton.visibleProperty().bind(viewModel.previousButtonVisibleProperty()); + previousButton.managedProperty().bind(viewModel.previousButtonVisibleProperty()); - titleText.textProperty().bind(viewModel.titleTextProperty()); - } + titleText.textProperty().bind(viewModel.titleTextProperty()); + } - @FXML - private void previous() { - viewModel.previousAction(); - } + @FXML + private void previous() { + viewModel.previousAction(); + } - @FXML - private void next() { - viewModel.nextAction(); - } + @FXML + private void next() { + viewModel.nextAction(); + } - @FXML - private void ok() { - viewModel.okAction(); - } + @FXML + private void ok() { + viewModel.okAction(); + } + + public ContactDialogViewModel getViewModel() { + return viewModel; + } - public ContactDialogViewModel getViewModel() { - return viewModel; - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java index 1009ca36d..37c37b6b2 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModel.java @@ -14,76 +14,76 @@ public class ContactDialogViewModel implements ViewModel { - @InjectScope - ContactDialogScope dialogScope; - - private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); - private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); - private final StringProperty titleText = new SimpleStringProperty(); - - public void initialize() { - valid.bind( - Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); - dialogScope.bothFormsValidProperty().bind(valid); - dialogScope.subscribe(ContactDialogScope.RESET_DIALOG_PAGE, - (key, payload) -> resetDialogPage()); - titleText.bind(dialogScope.dialogTitleProperty()); - } - - public void okAction() { - dialogScope.publish(ContactDialogScope.OK_BEFORE_COMMIT); - } - - public void previousAction() { - if (dialogPage.get() == 1) { - dialogPage.set(0); - } - } - - public void nextAction() { - if (dialogPage.get() == 0) { - dialogPage.set(1); - } - } - - private void resetDialogPage() { - dialogPage.set(0); - } - - public IntegerProperty dialogPageProperty() { - return dialogPage; - } - - public ObservableBooleanValue okButtonDisabledProperty() { - return valid.not(); - } - - public ObservableBooleanValue okButtonVisibleProperty() { - return dialogPage.isEqualTo(1); - } - - public ObservableBooleanValue nextButtonDisabledProperty() { - return dialogScope.contactFormValidProperty().not(); - } - - public ObservableBooleanValue nextButtonVisibleProperty() { - return dialogPage.isEqualTo(0); - } - - public ObservableBooleanValue previousButtonVisibleProperty() { - return dialogPage.isEqualTo(1); - } - - public ObservableBooleanValue previousButtonDisabledProperty() { - return dialogScope.addressFormValidProperty().not(); - } - - public ReadOnlyBooleanProperty validProperty() { - return valid; - } - - public StringProperty titleTextProperty() { - return titleText; - } - + @InjectScope + ContactDialogScope dialogScope; + + private final IntegerProperty dialogPage = new SimpleIntegerProperty(0); + private final ReadOnlyBooleanWrapper valid = new ReadOnlyBooleanWrapper(); + private final StringProperty titleText = new SimpleStringProperty(); + + public void initialize() { + valid.bind( + Bindings.and(dialogScope.contactFormValidProperty(), dialogScope.addressFormValidProperty())); + dialogScope.bothFormsValidProperty().bind(valid); + dialogScope.subscribe(ContactDialogScope.RESET_DIALOG_PAGE, + (key, payload) -> resetDialogPage()); + titleText.bind(dialogScope.dialogTitleProperty()); + } + + public void okAction() { + dialogScope.publish(ContactDialogScope.OK_BEFORE_COMMIT); + } + + public void previousAction() { + if (dialogPage.get() == 1) { + dialogPage.set(0); + } + } + + public void nextAction() { + if (dialogPage.get() == 0) { + dialogPage.set(1); + } + } + + private void resetDialogPage() { + dialogPage.set(0); + } + + public IntegerProperty dialogPageProperty() { + return dialogPage; + } + + public ObservableBooleanValue okButtonDisabledProperty() { + return valid.not(); + } + + public ObservableBooleanValue okButtonVisibleProperty() { + return dialogPage.isEqualTo(1); + } + + public ObservableBooleanValue nextButtonDisabledProperty() { + return dialogScope.contactFormValidProperty().not(); + } + + public ObservableBooleanValue nextButtonVisibleProperty() { + return dialogPage.isEqualTo(0); + } + + public ObservableBooleanValue previousButtonVisibleProperty() { + return dialogPage.isEqualTo(1); + } + + public ObservableBooleanValue previousButtonDisabledProperty() { + return dialogScope.addressFormValidProperty().not(); + } + + public ReadOnlyBooleanProperty validProperty() { + return valid; + } + + public StringProperty titleTextProperty() { + return titleText; + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java index 9b2e33459..3b0e03250 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.java @@ -10,51 +10,51 @@ public class ContactFormView implements FxmlView<ContactFormViewModel> { - @FXML - public TextField firstnameInput; - @FXML - public TextField titleInput; - @FXML - public TextField lastnameInput; - @FXML - public TextField roleInput; - @FXML - public TextField departmentInput; - @FXML - public TextField mobileNumberInput; - @FXML - public TextField emailInput; - @FXML - public TextField phoneNumberInput; - @FXML - public DatePicker birthdayInput; - - private ValidationVisualizer validationVisualizer = new ControlsFxVisualizer(); - - @InjectViewModel - private ContactFormViewModel viewModel; - - public void initialize() { - firstnameInput.textProperty().bindBidirectional(viewModel.firstnameProperty()); - lastnameInput.textProperty().bindBidirectional(viewModel.lastnameProperty()); - titleInput.textProperty().bindBidirectional(viewModel.titleProperty()); - roleInput.textProperty().bindBidirectional(viewModel.roleProperty()); - departmentInput.textProperty().bindBidirectional(viewModel.departmentProperty()); - mobileNumberInput.textProperty().bindBidirectional(viewModel.mobileNumberProperty()); - phoneNumberInput.textProperty().bindBidirectional(viewModel.phoneNumberProperty()); - emailInput.textProperty().bindBidirectional(viewModel.emailProperty()); - birthdayInput.valueProperty().bindBidirectional(viewModel.birthdayProperty()); - - validationVisualizer.initVisualization(viewModel.firstnameValidation(), firstnameInput, true); - validationVisualizer.initVisualization(viewModel.lastnameValidation(), lastnameInput, true); - validationVisualizer.initVisualization(viewModel.birthdayValidation(), birthdayInput); - validationVisualizer.initVisualization(viewModel.emailValidation(), emailInput, true); - validationVisualizer.initVisualization(viewModel.phoneValidation(), phoneNumberInput); - validationVisualizer.initVisualization(viewModel.mobileValidation(), mobileNumberInput); - } - - public ContactFormViewModel getViewModel() { - return viewModel; - } + @FXML + public TextField firstnameInput; + @FXML + public TextField titleInput; + @FXML + public TextField lastnameInput; + @FXML + public TextField roleInput; + @FXML + public TextField departmentInput; + @FXML + public TextField mobileNumberInput; + @FXML + public TextField emailInput; + @FXML + public TextField phoneNumberInput; + @FXML + public DatePicker birthdayInput; + + private ValidationVisualizer validationVisualizer = new ControlsFxVisualizer(); + + @InjectViewModel + private ContactFormViewModel viewModel; + + public void initialize() { + firstnameInput.textProperty().bindBidirectional(viewModel.firstnameProperty()); + lastnameInput.textProperty().bindBidirectional(viewModel.lastnameProperty()); + titleInput.textProperty().bindBidirectional(viewModel.titleProperty()); + roleInput.textProperty().bindBidirectional(viewModel.roleProperty()); + departmentInput.textProperty().bindBidirectional(viewModel.departmentProperty()); + mobileNumberInput.textProperty().bindBidirectional(viewModel.mobileNumberProperty()); + phoneNumberInput.textProperty().bindBidirectional(viewModel.phoneNumberProperty()); + emailInput.textProperty().bindBidirectional(viewModel.emailProperty()); + birthdayInput.valueProperty().bindBidirectional(viewModel.birthdayProperty()); + + validationVisualizer.initVisualization(viewModel.firstnameValidation(), firstnameInput, true); + validationVisualizer.initVisualization(viewModel.lastnameValidation(), lastnameInput, true); + validationVisualizer.initVisualization(viewModel.birthdayValidation(), birthdayInput); + validationVisualizer.initVisualization(viewModel.emailValidation(), emailInput, true); + validationVisualizer.initVisualization(viewModel.phoneValidation(), phoneNumberInput); + validationVisualizer.initVisualization(viewModel.mobileValidation(), mobileNumberInput); + } + + public ContactFormViewModel getViewModel() { + return viewModel; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java index 5ac940a88..65a4ef10a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormViewModel.java @@ -21,140 +21,140 @@ public class ContactFormViewModel implements ViewModel { - private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); - - private Validator firstnameValidator; - private Validator lastnameValidator; - private final Validator emailValidator = new EmailValidator(emailProperty()); - private final Validator birthdayValidator = new BirthdayValidator(birthdayProperty()); - - private final Validator phoneValidator = new PhoneValidator(phoneNumberProperty(), "The phone number is invalid!"); - private final Validator mobileValidator = new PhoneValidator(mobileNumberProperty(), - "The mobile number is invalid!"); - - private final CompositeValidator formValidator = new CompositeValidator(); - - @InjectScope - ContactDialogScope dialogScope; - - public ContactFormViewModel() { - firstnameValidator = new FunctionBasedValidator<>( - firstnameProperty(), - firstName -> firstName != null && !firstName.trim().isEmpty(), - ValidationMessage.error("Firstname may not be empty")); - - lastnameValidator = new FunctionBasedValidator<>(lastnameProperty(), lastName -> { - if (lastName == null || lastName.isEmpty()) { - return ValidationMessage.error("Lastname may not be empty"); - } else if (lastName.trim().isEmpty()) { - return ValidationMessage.error("Lastname may not only contain whitespaces"); - } - - return null; - }); - - formValidator.addValidators( - firstnameValidator, - lastnameValidator, - emailValidator, - birthdayValidator, - phoneValidator, - mobileValidator); - } - - public void initialize() { - dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); - dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); - - ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); - if (contactToEditProperty.get() != null) { - initWithContact(contactToEditProperty.get()); - } - - contactToEditProperty.addListener((observable, oldValue, newValue) -> { - if (newValue != null) { - initWithContact(newValue); - } - }); - - dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); - } - - private void resetForm() { - contactWrapper.reset(); - } - - private void initWithContact(Contact contact) { - this.contactWrapper.set(contact); - this.contactWrapper.reload(); - } - - private void commitChanges() { - if (contactWrapper.get() == null) { - contactWrapper.set(new Contact()); - } - - contactWrapper.commit(); - } - - public ValidationStatus firstnameValidation() { - return firstnameValidator.getValidationStatus(); - } - - public ValidationStatus lastnameValidation() { - return lastnameValidator.getValidationStatus(); - } - - public ValidationStatus birthdayValidation() { - return birthdayValidator.getValidationStatus(); - } - - public ValidationStatus emailValidation() { - return emailValidator.getValidationStatus(); - } - - public ValidationStatus phoneValidation() { - return phoneValidator.getValidationStatus(); - } - - public ValidationStatus mobileValidation() { - return mobileValidator.getValidationStatus(); - } - - public StringProperty firstnameProperty() { - return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); - } - - public StringProperty titleProperty() { - return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); - } - - public StringProperty lastnameProperty() { - return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); - } - - public StringProperty roleProperty() { - return contactWrapper.field("role", Contact::getRole, Contact::setRole); - } - - public StringProperty departmentProperty() { - return contactWrapper.field("department", Contact::getDepartment, Contact::setDepartment); - } - - public Property<LocalDate> birthdayProperty() { - return contactWrapper.field("birthday", Contact::getBirthday, Contact::setBirthday); - } - - public StringProperty emailProperty() { - return contactWrapper.field("email", Contact::getEmailAddress, Contact::setEmailAddress); - } - - public StringProperty mobileNumberProperty() { - return contactWrapper.field("mobileNumber", Contact::getMobileNumber, Contact::setMobileNumber); - } - - public StringProperty phoneNumberProperty() { - return contactWrapper.field("phoneNumber", Contact::getPhoneNumber, Contact::setPhoneNumber); - } - + private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); + + private Validator firstnameValidator; + private Validator lastnameValidator; + private final Validator emailValidator = new EmailValidator(emailProperty()); + private final Validator birthdayValidator = new BirthdayValidator(birthdayProperty()); + + private final Validator phoneValidator = new PhoneValidator(phoneNumberProperty(), "The phone number is invalid!"); + private final Validator mobileValidator = new PhoneValidator(mobileNumberProperty(), + "The mobile number is invalid!"); + + private final CompositeValidator formValidator = new CompositeValidator(); + + @InjectScope + ContactDialogScope dialogScope; + + public ContactFormViewModel() { + firstnameValidator = new FunctionBasedValidator<>( + firstnameProperty(), + firstName -> firstName != null && !firstName.trim().isEmpty(), + ValidationMessage.error("Firstname may not be empty")); + + lastnameValidator = new FunctionBasedValidator<>(lastnameProperty(), lastName -> { + if (lastName == null || lastName.isEmpty()) { + return ValidationMessage.error("Lastname may not be empty"); + } else if (lastName.trim().isEmpty()) { + return ValidationMessage.error("Lastname may not only contain whitespaces"); + } + + return null; + }); + + formValidator.addValidators( + firstnameValidator, + lastnameValidator, + emailValidator, + birthdayValidator, + phoneValidator, + mobileValidator); + } + + public void initialize() { + dialogScope.subscribe(ContactDialogScope.RESET_FORMS, (key, payload) -> resetForm()); + dialogScope.subscribe(ContactDialogScope.COMMIT, (key, payload) -> commitChanges()); + + ObjectProperty<Contact> contactToEditProperty = dialogScope.contactToEditProperty(); + if (contactToEditProperty.get() != null) { + initWithContact(contactToEditProperty.get()); + } + + contactToEditProperty.addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + initWithContact(newValue); + } + }); + + dialogScope.contactFormValidProperty().bind(formValidator.getValidationStatus().validProperty()); + } + + private void resetForm() { + contactWrapper.reset(); + } + + private void initWithContact(Contact contact) { + this.contactWrapper.set(contact); + this.contactWrapper.reload(); + } + + private void commitChanges() { + if (contactWrapper.get() == null) { + contactWrapper.set(new Contact()); + } + + contactWrapper.commit(); + } + + public ValidationStatus firstnameValidation() { + return firstnameValidator.getValidationStatus(); + } + + public ValidationStatus lastnameValidation() { + return lastnameValidator.getValidationStatus(); + } + + public ValidationStatus birthdayValidation() { + return birthdayValidator.getValidationStatus(); + } + + public ValidationStatus emailValidation() { + return emailValidator.getValidationStatus(); + } + + public ValidationStatus phoneValidation() { + return phoneValidator.getValidationStatus(); + } + + public ValidationStatus mobileValidation() { + return mobileValidator.getValidationStatus(); + } + + public StringProperty firstnameProperty() { + return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); + } + + public StringProperty titleProperty() { + return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); + } + + public StringProperty lastnameProperty() { + return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); + } + + public StringProperty roleProperty() { + return contactWrapper.field("role", Contact::getRole, Contact::setRole); + } + + public StringProperty departmentProperty() { + return contactWrapper.field("department", Contact::getDepartment, Contact::setDepartment); + } + + public Property<LocalDate> birthdayProperty() { + return contactWrapper.field("birthday", Contact::getBirthday, Contact::setBirthday); + } + + public StringProperty emailProperty() { + return contactWrapper.field("email", Contact::getEmailAddress, Contact::setEmailAddress); + } + + public StringProperty mobileNumberProperty() { + return contactWrapper.field("mobileNumber", Contact::getMobileNumber, Contact::setMobileNumber); + } + + public StringProperty phoneNumberProperty() { + return contactWrapper.field("phoneNumber", Contact::getPhoneNumber, Contact::setPhoneNumber); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java index 041c059ec..762213a91 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java @@ -22,97 +22,97 @@ public class DetailView implements FxmlView<DetailViewModel> { - @FXML - public Label nameLabel, birthdayLabel, roleDepartmentLabel, phoneLabel, mobileLabel, cityPostalCodeLabel, - streetLabel, countrySubdivisionLabel; - @FXML - public Hyperlink emailHyperlink; - - @FXML - public Button editButton, removeButton; - - @Inject - private Stage primaryStage; - - @InjectViewModel - private DetailViewModel viewModel; - - private Command removeCommand; - private Command editCommand; - private Command mailCommand; - - public void initialize() { - removeCommand = viewModel.getRemoveCommand(); - editCommand = viewModel.getEditCommand(); - mailCommand = viewModel.getEmailLinkCommand(); - - removeButton.disableProperty().bind(removeCommand.notExecutableProperty()); - editButton.disableProperty().bind(editCommand.notExecutableProperty()); - - nameLabel.setText(""); - nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); - - nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); - birthdayLabel.textProperty().bind(viewModel.birthdayLabelTextProperty()); - roleDepartmentLabel.textProperty().bind(viewModel.roleDepartmentLabelTextProperty()); - emailHyperlink.textProperty().bind(viewModel.emailLabelTextProperty()); - phoneLabel.textProperty().bind(viewModel.phoneLabelTextProperty()); - mobileLabel.textProperty().bind(viewModel.mobileLabelTextProperty()); - cityPostalCodeLabel.textProperty().bind(viewModel.cityPostalcodeLabelTextProperty()); - streetLabel.textProperty().bind(viewModel.streetLabelTextProperty()); - countrySubdivisionLabel.textProperty().bind(viewModel.countrySubdivisionLabelTextProperty()); - - initVisibilityBindings(nameLabel); - initVisibilityBindings(birthdayLabel); - initVisibilityBindings(roleDepartmentLabel); - initVisibilityBindings(emailHyperlink); - initVisibilityBindings(phoneLabel); - initVisibilityBindings(mobileLabel); - initVisibilityBindings(cityPostalCodeLabel); - initVisibilityBindings(streetLabel); - initVisibilityBindings(countrySubdivisionLabel); - - initIcons(); - - viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { - ViewTuple<EditContactDialogView, EditContactDialogViewModel> load = FluentViewLoader - .fxmlView(EditContactDialogView.class) - .load(); - Parent view = load.getView(); - Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - load.getCodeBehind().setOwningStage(showDialog); - }); - - } - - private void initVisibilityBindings(Labeled label) { - label.visibleProperty().bind(editCommand.executableProperty()); - label.managedProperty().bind(label.visibleProperty()); - } - - private void initIcons() { - AwesomeDude.setIcon(birthdayLabel, AwesomeIcon.BIRTHDAY_CAKE); - AwesomeDude.setIcon(roleDepartmentLabel, AwesomeIcon.USERS); - AwesomeDude.setIcon(emailHyperlink, AwesomeIcon.AT); - AwesomeDude.setIcon(mobileLabel, AwesomeIcon.MOBILE_PHONE); - AwesomeDude.setIcon(phoneLabel, AwesomeIcon.PHONE); - AwesomeDude.setIcon(editButton, AwesomeIcon.EDIT); - AwesomeDude.setIcon(removeButton, AwesomeIcon.TRASH_ALT); - } - - @FXML - public void editAction() { - editCommand.execute(); - } - - @FXML - public void removeAction() { - removeCommand.execute(); - } - - @FXML - public void mailAction() { - mailCommand.execute(); - } - + @FXML + public Label nameLabel, birthdayLabel, roleDepartmentLabel, phoneLabel, mobileLabel, cityPostalCodeLabel, + streetLabel, countrySubdivisionLabel; + @FXML + public Hyperlink emailHyperlink; + + @FXML + public Button editButton, removeButton; + + @Inject + private Stage primaryStage; + + @InjectViewModel + private DetailViewModel viewModel; + + private Command removeCommand; + private Command editCommand; + private Command mailCommand; + + public void initialize() { + removeCommand = viewModel.getRemoveCommand(); + editCommand = viewModel.getEditCommand(); + mailCommand = viewModel.getEmailLinkCommand(); + + removeButton.disableProperty().bind(removeCommand.notExecutableProperty()); + editButton.disableProperty().bind(editCommand.notExecutableProperty()); + + nameLabel.setText(""); + nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); + + nameLabel.textProperty().bind(viewModel.nameLabelTextProperty()); + birthdayLabel.textProperty().bind(viewModel.birthdayLabelTextProperty()); + roleDepartmentLabel.textProperty().bind(viewModel.roleDepartmentLabelTextProperty()); + emailHyperlink.textProperty().bind(viewModel.emailLabelTextProperty()); + phoneLabel.textProperty().bind(viewModel.phoneLabelTextProperty()); + mobileLabel.textProperty().bind(viewModel.mobileLabelTextProperty()); + cityPostalCodeLabel.textProperty().bind(viewModel.cityPostalcodeLabelTextProperty()); + streetLabel.textProperty().bind(viewModel.streetLabelTextProperty()); + countrySubdivisionLabel.textProperty().bind(viewModel.countrySubdivisionLabelTextProperty()); + + initVisibilityBindings(nameLabel); + initVisibilityBindings(birthdayLabel); + initVisibilityBindings(roleDepartmentLabel); + initVisibilityBindings(emailHyperlink); + initVisibilityBindings(phoneLabel); + initVisibilityBindings(mobileLabel); + initVisibilityBindings(cityPostalCodeLabel); + initVisibilityBindings(streetLabel); + initVisibilityBindings(countrySubdivisionLabel); + + initIcons(); + + viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { + ViewTuple<EditContactDialogView, EditContactDialogViewModel> load = FluentViewLoader + .fxmlView(EditContactDialogView.class) + .load(); + Parent view = load.getView(); + Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + load.getCodeBehind().setOwningStage(showDialog); + }); + + } + + private void initVisibilityBindings(Labeled label) { + label.visibleProperty().bind(editCommand.executableProperty()); + label.managedProperty().bind(label.visibleProperty()); + } + + private void initIcons() { + AwesomeDude.setIcon(birthdayLabel, AwesomeIcon.BIRTHDAY_CAKE); + AwesomeDude.setIcon(roleDepartmentLabel, AwesomeIcon.USERS); + AwesomeDude.setIcon(emailHyperlink, AwesomeIcon.AT); + AwesomeDude.setIcon(mobileLabel, AwesomeIcon.MOBILE_PHONE); + AwesomeDude.setIcon(phoneLabel, AwesomeIcon.PHONE); + AwesomeDude.setIcon(editButton, AwesomeIcon.EDIT); + AwesomeDude.setIcon(removeButton, AwesomeIcon.TRASH_ALT); + } + + @FXML + public void editAction() { + editCommand.execute(); + } + + @FXML + public void removeAction() { + removeCommand.execute(); + } + + @FXML + public void mailAction() { + mailCommand.execute(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index ee47eab0c..5133732d5 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -28,238 +28,238 @@ public class DetailViewModel implements ViewModel { - public static final String OPEN_EDIT_CONTACT_DIALOG = "open_edit_contact"; - - private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ISO_DATE; - - private final ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); - - private final ReadOnlyStringWrapper birthday = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper roleDepartment = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper email = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper phone = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper mobile = new ReadOnlyStringWrapper(); - - private final ReadOnlyStringWrapper cityPostalcode = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper street = new ReadOnlyStringWrapper(); - private final ReadOnlyStringWrapper countrySubdivision = new ReadOnlyStringWrapper(); - - private DelegateCommand editCommand; - private DelegateCommand removeCommand; - private DelegateCommand emailLinkCommand; - - @Inject - HostServices hostServices; - - @Inject - Repository repository; - - @InjectScope - MasterDetailScope mdScope; - - @InjectScope - ContactDialogScope dialogscope; - - public void initialize() { - ReadOnlyObjectProperty<Contact> contactProperty = getSelectedContactPropertyFromScope(); - - createBindingsForLabels(contactProperty); - - editCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - Contact selectedContact = getSelectedContactFromScope(); - if (selectedContact != null) { - dialogscope.setContactToEdit(selectedContact); - publish(OPEN_EDIT_CONTACT_DIALOG); - } - } - }, getSelectedContactPropertyFromScope().isNotNull()); - - removeCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - Contact selectedContact = getSelectedContactFromScope(); - if (selectedContact != null) { - repository.delete(getSelectedContactFromScope()); - } - } - - }, getSelectedContactPropertyFromScope().isNotNull()); - - emailLinkCommand = new DelegateCommand(() -> new Action() { - @Override - protected void action() throws Exception { - if (email.get() != null && !email.get().trim().isEmpty()) { - hostServices.showDocument("mailto:" + email.get()); - } - } - }); - } - - private void createBindingsForLabels(ReadOnlyObjectProperty<Contact> contactProperty) { - name.bind(emptyStringOnNull(map(contactProperty, contact -> { - StringBuilder result = new StringBuilder(); - - String title = contact.getTitle(); - if (title != null && !title.trim().isEmpty()) { - result.append(title); - result.append(" "); - } - - result.append(contact.getFirstname()); - result.append(" "); - result.append(contact.getLastname()); - - return result.toString(); - }))); - - email.bind(emptyStringOnNull(map(contactProperty, Contact::getEmailAddress))); - - roleDepartment.bind(emptyStringOnNull(map(contactProperty, contact -> { - StringBuilder result = new StringBuilder(); - if (contact.getRole() != null && !contact.getRole().trim().isEmpty()) { - result.append(contact.getRole()); - - if (contact.getDepartment() != null && !contact.getDepartment().trim().isEmpty()) { - result.append(" / "); - result.append(contact.getDepartment()); - } - } else if (contact.getDepartment() != null) { - result.append(contact.getDepartment()); - } - - return result.toString(); - }))); - - birthday.bind(emptyStringOnNull(map(contactProperty, contact -> { - LocalDate date = contact.getBirthday(); - if (date == null) { - return ""; - } else { - return BIRTHDAY_FORMATTER.format(date); - } - }))); - - phone.bind(emptyStringOnNull(map(contactProperty, Contact::getPhoneNumber))); - - mobile.bind(emptyStringOnNull(map(contactProperty, Contact::getMobileNumber))); - - ObjectBinding<Address> addressBinding = map(contactProperty, Contact::getAddress); - - cityPostalcode.bind(emptyStringOnNull(map(addressBinding, address -> { - StringBuilder result = new StringBuilder(); - if (address.getCity() != null) { - result.append(address.getCity()); - } - - if (address.getPostalcode() != null) { - result.append(" ("); - result.append(address.getPostalcode()); - result.append(")"); - } - return result.toString(); - }))); - - street.bind(emptyStringOnNull(map(addressBinding, Address::getStreet))); - - countrySubdivision.bind(emptyStringOnNull(map(addressBinding, address -> { - StringBuilder result = new StringBuilder(); - if (address.getCountry() != null) { - result.append(address.getCountry().getName()); - } - - if (address.getSubdivision() != null) { - result.append(" / "); - result.append(address.getSubdivision().getName()); - } - return result.toString(); - }))); - } - - /** - * When the given source binding has a value of <code>null</code> an empty - * string is used for the returned binding. Otherwise the value of the - * source binding is used. - */ - private StringBinding emptyStringOnNull(ObjectBinding<String> source) { - return Bindings.createStringBinding(() -> { - if (source.get() == null) { - return ""; - } else { - return source.get(); - } - }, source); - } - - public Command getEditCommand() { - return editCommand; - } - - public Command getRemoveCommand() { - return removeCommand; - } - - public Command getEmailLinkCommand() { - return emailLinkCommand; - } - - public ReadOnlyStringProperty nameLabelTextProperty() { - return name.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty birthdayLabelTextProperty() { - return birthday.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty roleDepartmentLabelTextProperty() { - return roleDepartment.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty emailLabelTextProperty() { - return email.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty phoneLabelTextProperty() { - return phone.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty mobileLabelTextProperty() { - return mobile.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty cityPostalcodeLabelTextProperty() { - return cityPostalcode.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty streetLabelTextProperty() { - return street.getReadOnlyProperty(); - } - - public ReadOnlyStringProperty countrySubdivisionLabelTextProperty() { - return countrySubdivision.getReadOnlyProperty(); - } - - private String trimString(String string) { - if (string == null || string.trim().isEmpty()) { - return ""; - } - return string; - } - - private String trimStringWithPostfix(String string, String append) { - if (string == null || string.trim().isEmpty()) { - return ""; - } - return string + append; - } - - private Contact getSelectedContactFromScope() { - return getSelectedContactPropertyFromScope().get(); - } - - private ObjectProperty<Contact> getSelectedContactPropertyFromScope() { - return mdScope.selectedContactProperty(); - } - + public static final String OPEN_EDIT_CONTACT_DIALOG = "open_edit_contact"; + + private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ISO_DATE; + + private final ReadOnlyStringWrapper name = new ReadOnlyStringWrapper(); + + private final ReadOnlyStringWrapper birthday = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper roleDepartment = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper email = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper phone = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper mobile = new ReadOnlyStringWrapper(); + + private final ReadOnlyStringWrapper cityPostalcode = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper street = new ReadOnlyStringWrapper(); + private final ReadOnlyStringWrapper countrySubdivision = new ReadOnlyStringWrapper(); + + private DelegateCommand editCommand; + private DelegateCommand removeCommand; + private DelegateCommand emailLinkCommand; + + @Inject + HostServices hostServices; + + @Inject + Repository repository; + + @InjectScope + MasterDetailScope mdScope; + + @InjectScope + ContactDialogScope dialogscope; + + public void initialize() { + ReadOnlyObjectProperty<Contact> contactProperty = getSelectedContactPropertyFromScope(); + + createBindingsForLabels(contactProperty); + + editCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + Contact selectedContact = getSelectedContactFromScope(); + if (selectedContact != null) { + dialogscope.setContactToEdit(selectedContact); + publish(OPEN_EDIT_CONTACT_DIALOG); + } + } + }, getSelectedContactPropertyFromScope().isNotNull()); + + removeCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + Contact selectedContact = getSelectedContactFromScope(); + if (selectedContact != null) { + repository.delete(getSelectedContactFromScope()); + } + } + + }, getSelectedContactPropertyFromScope().isNotNull()); + + emailLinkCommand = new DelegateCommand(() -> new Action() { + @Override + protected void action() throws Exception { + if (email.get() != null && !email.get().trim().isEmpty()) { + hostServices.showDocument("mailto:" + email.get()); + } + } + }); + } + + private void createBindingsForLabels(ReadOnlyObjectProperty<Contact> contactProperty) { + name.bind(emptyStringOnNull(map(contactProperty, contact -> { + StringBuilder result = new StringBuilder(); + + String title = contact.getTitle(); + if (title != null && !title.trim().isEmpty()) { + result.append(title); + result.append(" "); + } + + result.append(contact.getFirstname()); + result.append(" "); + result.append(contact.getLastname()); + + return result.toString(); + }))); + + email.bind(emptyStringOnNull(map(contactProperty, Contact::getEmailAddress))); + + roleDepartment.bind(emptyStringOnNull(map(contactProperty, contact -> { + StringBuilder result = new StringBuilder(); + if (contact.getRole() != null && !contact.getRole().trim().isEmpty()) { + result.append(contact.getRole()); + + if (contact.getDepartment() != null && !contact.getDepartment().trim().isEmpty()) { + result.append(" / "); + result.append(contact.getDepartment()); + } + } else if (contact.getDepartment() != null) { + result.append(contact.getDepartment()); + } + + return result.toString(); + }))); + + birthday.bind(emptyStringOnNull(map(contactProperty, contact -> { + LocalDate date = contact.getBirthday(); + if (date == null) { + return ""; + } else { + return BIRTHDAY_FORMATTER.format(date); + } + }))); + + phone.bind(emptyStringOnNull(map(contactProperty, Contact::getPhoneNumber))); + + mobile.bind(emptyStringOnNull(map(contactProperty, Contact::getMobileNumber))); + + ObjectBinding<Address> addressBinding = map(contactProperty, Contact::getAddress); + + cityPostalcode.bind(emptyStringOnNull(map(addressBinding, address -> { + StringBuilder result = new StringBuilder(); + if (address.getCity() != null) { + result.append(address.getCity()); + } + + if (address.getPostalcode() != null) { + result.append(" ("); + result.append(address.getPostalcode()); + result.append(")"); + } + return result.toString(); + }))); + + street.bind(emptyStringOnNull(map(addressBinding, Address::getStreet))); + + countrySubdivision.bind(emptyStringOnNull(map(addressBinding, address -> { + StringBuilder result = new StringBuilder(); + if (address.getCountry() != null) { + result.append(address.getCountry().getName()); + } + + if (address.getSubdivision() != null) { + result.append(" / "); + result.append(address.getSubdivision().getName()); + } + return result.toString(); + }))); + } + + /** + * When the given source binding has a value of <code>null</code> an empty + * string is used for the returned binding. Otherwise the value of the + * source binding is used. + */ + private StringBinding emptyStringOnNull(ObjectBinding<String> source) { + return Bindings.createStringBinding(() -> { + if (source.get() == null) { + return ""; + } else { + return source.get(); + } + }, source); + } + + public Command getEditCommand() { + return editCommand; + } + + public Command getRemoveCommand() { + return removeCommand; + } + + public Command getEmailLinkCommand() { + return emailLinkCommand; + } + + public ReadOnlyStringProperty nameLabelTextProperty() { + return name.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty birthdayLabelTextProperty() { + return birthday.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty roleDepartmentLabelTextProperty() { + return roleDepartment.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty emailLabelTextProperty() { + return email.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty phoneLabelTextProperty() { + return phone.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty mobileLabelTextProperty() { + return mobile.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty cityPostalcodeLabelTextProperty() { + return cityPostalcode.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty streetLabelTextProperty() { + return street.getReadOnlyProperty(); + } + + public ReadOnlyStringProperty countrySubdivisionLabelTextProperty() { + return countrySubdivision.getReadOnlyProperty(); + } + + private String trimString(String string) { + if (string == null || string.trim().isEmpty()) { + return ""; + } + return string; + } + + private String trimStringWithPostfix(String string, String append) { + if (string == null || string.trim().isEmpty()) { + return ""; + } + return string + append; + } + + private Contact getSelectedContactFromScope() { + return getSelectedContactPropertyFromScope().get(); + } + + private ObjectProperty<Contact> getSelectedContactPropertyFromScope() { + return mdScope.selectedContactProperty(); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java index 5d6dbdf7b..6f9824125 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.java @@ -11,22 +11,22 @@ @Singleton public class EditContactDialogView implements FxmlView<EditContactDialogViewModel> { - @FXML - private ContactDialogView contactDialogViewController; + @FXML + private ContactDialogView contactDialogViewController; - @InjectViewModel - private EditContactDialogViewModel viewModel; + @InjectViewModel + private EditContactDialogViewModel viewModel; - private Stage showDialog; + private Stage showDialog; - public void initialize() { - viewModel.subscribe(EditContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { - showDialog.close(); - }); - } + public void initialize() { + viewModel.subscribe(EditContactDialogViewModel.CLOSE_DIALOG_NOTIFICATION, (key, payload) -> { + showDialog.close(); + }); + } + + public void setOwningStage(Stage showDialog) { + this.showDialog = showDialog; + } - public void setOwningStage(Stage showDialog) { - this.showDialog = showDialog; - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java index da65c4458..0e398a541 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModel.java @@ -11,34 +11,34 @@ public class EditContactDialogViewModel implements ViewModel { - static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; - public static final String CLOSE_DIALOG_NOTIFICATION = "CLOSE_DIALOG_NOT"; - - @Inject - Repository repository; - - @InjectScope - ContactDialogScope dialogScope; - - @Inject - ResourceBundle defaultResourceBundle; - - public void initialize() { - dialogScope.publish(ContactDialogScope.RESET_FORMS); - dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); - dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { - applyAction(); - }); - - dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); - } - - public void applyAction() { - if (dialogScope.bothFormsValidProperty().get()) { - dialogScope.publish(ContactDialogScope.COMMIT); - repository.save(dialogScope.contactToEditProperty().get()); - publish(CLOSE_DIALOG_NOTIFICATION); - } - } - + static final String TITLE_LABEL_KEY = "dialog.editcontact.title"; + public static final String CLOSE_DIALOG_NOTIFICATION = "CLOSE_DIALOG_NOT"; + + @Inject + Repository repository; + + @InjectScope + ContactDialogScope dialogScope; + + @Inject + ResourceBundle defaultResourceBundle; + + public void initialize() { + dialogScope.publish(ContactDialogScope.RESET_FORMS); + dialogScope.publish(ContactDialogScope.RESET_DIALOG_PAGE); + dialogScope.subscribe(ContactDialogScope.OK_BEFORE_COMMIT, (key, payload) -> { + applyAction(); + }); + + dialogScope.dialogTitleProperty().set(defaultResourceBundle.getString(TITLE_LABEL_KEY)); + } + + public void applyAction() { + if (dialogScope.bothFormsValidProperty().get()) { + dialogScope.publish(ContactDialogScope.COMMIT); + repository.save(dialogScope.contactToEditProperty().get()); + publish(CLOSE_DIALOG_NOTIFICATION); + } + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java index 298b8c351..f8d6f8cb3 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java @@ -3,5 +3,5 @@ import de.saxsys.mvvmfx.FxmlView; public class MainView implements FxmlView<MainViewModel> { - + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java index 042970de1..b95b2e514 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java @@ -3,5 +3,5 @@ import de.saxsys.mvvmfx.ViewModel; public class MainViewModel implements ViewModel { - + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java index ff0f7204f..9d0cc17c7 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModel.java @@ -13,85 +13,85 @@ public class MasterTableViewModel { - private final String id; - private final IntegerProperty age = new SimpleIntegerProperty(); - private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); - - public MasterTableViewModel(Contact contact) { - id = contact.getId(); - contactWrapper.set(contact); - contactWrapper.reload(); - - if (contact.getBirthday() != null) { - age.set((int) ChronoUnit.YEARS.between(contact.getBirthday(), LocalDate.now(CentralClock.getClock()))); - } - } - - @Override - public boolean equals(Object obj) { - - if (obj == null) { - return false; - } - - if (obj == this) { - return true; - } - - if (!(obj instanceof MasterTableViewModel)) { - return false; - } - - MasterTableViewModel other = (MasterTableViewModel) obj; - - return other.getId().equals(this.getId()); - } - - @Override - public int hashCode() { - return this.getId().hashCode(); - } - - public String getId() { - return id; - } - - public StringProperty firstnameProperty() { - return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); - } - - public StringProperty lastnameProperty() { - return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); - } - - public StringProperty titleProperty() { - return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); - } - - public StringProperty emailAddressProperty() { - return contactWrapper.field("emailAddress", Contact::getEmailAddress, Contact::setEmailAddress); - } - - public IntegerProperty ageProperty() { - return age; - } - - public StringProperty cityProperty() { - return contactWrapper.field("city", - (StringGetter<Contact>) model -> model.getAddress().getCity(), - (model, value) -> model.getAddress().setCity(value)); - } - - public StringProperty streetProperty() { - return contactWrapper.field("street", - (StringGetter<Contact>) model -> model.getAddress().getStreet(), - (model, value) -> model.getAddress().setStreet(value)); - } - - public StringProperty postalCodeProperty() { - return contactWrapper.field("postalcode", - (StringGetter<Contact>) model -> model.getAddress().getPostalcode(), - (model, value) -> model.getAddress().setPostalcode(value)); - } - + private final String id; + private final IntegerProperty age = new SimpleIntegerProperty(); + private final ModelWrapper<Contact> contactWrapper = new ModelWrapper<>(); + + public MasterTableViewModel(Contact contact) { + id = contact.getId(); + contactWrapper.set(contact); + contactWrapper.reload(); + + if (contact.getBirthday() != null) { + age.set((int) ChronoUnit.YEARS.between(contact.getBirthday(), LocalDate.now(CentralClock.getClock()))); + } + } + + @Override + public boolean equals(Object obj) { + + if (obj == null) { + return false; + } + + if (obj == this) { + return true; + } + + if (!(obj instanceof MasterTableViewModel)) { + return false; + } + + MasterTableViewModel other = (MasterTableViewModel) obj; + + return other.getId().equals(this.getId()); + } + + @Override + public int hashCode() { + return this.getId().hashCode(); + } + + public String getId() { + return id; + } + + public StringProperty firstnameProperty() { + return contactWrapper.field("firstname", Contact::getFirstname, Contact::setFirstname); + } + + public StringProperty lastnameProperty() { + return contactWrapper.field("lastname", Contact::getLastname, Contact::setLastname); + } + + public StringProperty titleProperty() { + return contactWrapper.field("title", Contact::getTitle, Contact::setTitle); + } + + public StringProperty emailAddressProperty() { + return contactWrapper.field("emailAddress", Contact::getEmailAddress, Contact::setEmailAddress); + } + + public IntegerProperty ageProperty() { + return age; + } + + public StringProperty cityProperty() { + return contactWrapper.field("city", + (StringGetter<Contact>) model -> model.getAddress().getCity(), + (model, value) -> model.getAddress().setCity(value)); + } + + public StringProperty streetProperty() { + return contactWrapper.field("street", + (StringGetter<Contact>) model -> model.getAddress().getStreet(), + (model, value) -> model.getAddress().setStreet(value)); + } + + public StringProperty postalCodeProperty() { + return contactWrapper.field("postalcode", + (StringGetter<Contact>) model -> model.getAddress().getPostalcode(), + (model, value) -> model.getAddress().setPostalcode(value)); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java index ec5a6eb04..7dc2dcf68 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.java @@ -7,19 +7,19 @@ public class MasterView implements FxmlView<MasterViewModel> { - @FXML - private TableView<MasterTableViewModel> contactTable; + @FXML + private TableView<MasterTableViewModel> contactTable; - @InjectViewModel - private MasterViewModel viewModel; + @InjectViewModel + private MasterViewModel viewModel; - public void initialize() { - contactTable.setItems(viewModel.getContactList()); + public void initialize() { + contactTable.setItems(viewModel.getContactList()); - viewModel.selectedTableRowProperty().bind(contactTable.getSelectionModel().selectedItemProperty()); + viewModel.selectedTableRowProperty().bind(contactTable.getSelectionModel().selectedItemProperty()); - // When the selectedTableRowProperty changes in the viewModel we need to update the table - viewModel.setOnSelect(vm -> contactTable.getSelectionModel().select(vm)); - } + // When the selectedTableRowProperty changes in the viewModel we need to update the table + viewModel.setOnSelect(vm -> contactTable.getSelectionModel().select(vm)); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java index 0a76750f0..ec2b77e60 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModel.java @@ -25,73 +25,73 @@ public class MasterViewModel implements ViewModel { - private static final Logger LOG = LoggerFactory.getLogger(MasterViewModel.class); + private static final Logger LOG = LoggerFactory.getLogger(MasterViewModel.class); - private final ObservableList<MasterTableViewModel> contacts = FXCollections.observableArrayList(); + private final ObservableList<MasterTableViewModel> contacts = FXCollections.observableArrayList(); - private final ReadOnlyObjectWrapper<Contact> selectedContact = new ReadOnlyObjectWrapper<>(); + private final ReadOnlyObjectWrapper<Contact> selectedContact = new ReadOnlyObjectWrapper<>(); - private final ObjectProperty<MasterTableViewModel> selectedTableRow = new SimpleObjectProperty<>(); + private final ObjectProperty<MasterTableViewModel> selectedTableRow = new SimpleObjectProperty<>(); - private Optional<Consumer<MasterTableViewModel>> onSelect = Optional.empty(); + private Optional<Consumer<MasterTableViewModel>> onSelect = Optional.empty(); - @Inject - Repository repository; + @Inject + Repository repository; - @InjectScope - MasterDetailScope mdScope; + @InjectScope + MasterDetailScope mdScope; - public void initialize() { - updateContactList(); + public void initialize() { + updateContactList(); - mdScope.selectedContactProperty().bind(selectedContact); + mdScope.selectedContactProperty().bind(selectedContact); - selectedContact.bind(Bindings.createObjectBinding(() -> { - if (selectedTableRow.get() == null) { - return null; - } else { - return repository.findById(selectedTableRow.get().getId()).orElse(null); - } - }, selectedTableRow)); - } + selectedContact.bind(Bindings.createObjectBinding(() -> { + if (selectedTableRow.get() == null) { + return null; + } else { + return repository.findById(selectedTableRow.get().getId()).orElse(null); + } + }, selectedTableRow)); + } - public void onContactsUpdateEvent(@Observes ContactsUpdatedEvent event) { - updateContactList(); - } + public void onContactsUpdateEvent(@Observes ContactsUpdatedEvent event) { + updateContactList(); + } - private void updateContactList() { - LOG.debug("update contact list"); + private void updateContactList() { + LOG.debug("update contact list"); - // when there is a selected row, persist the id of this row, otherwise use null - final String selectedContactId = (selectedTableRow.get() == null) ? null : selectedTableRow.get().getId(); + // when there is a selected row, persist the id of this row, otherwise use null + final String selectedContactId = (selectedTableRow.get() == null) ? null : selectedTableRow.get().getId(); - Set<Contact> allContacts = repository.findAll(); + Set<Contact> allContacts = repository.findAll(); - contacts.clear(); - allContacts.forEach(contact -> contacts.add(new MasterTableViewModel(contact))); + contacts.clear(); + allContacts.forEach(contact -> contacts.add(new MasterTableViewModel(contact))); - if (selectedContactId != null) { - Optional<MasterTableViewModel> selectedRow = contacts.stream() - .filter(row -> row.getId().equals(selectedContactId)).findFirst(); + if (selectedContactId != null) { + Optional<MasterTableViewModel> selectedRow = contacts.stream() + .filter(row -> row.getId().equals(selectedContactId)).findFirst(); - if (selectedRow.isPresent()) { - onSelect.ifPresent(consumer -> consumer.accept(selectedRow.get())); - } else { - onSelect.ifPresent(consumer -> consumer.accept(null)); - } - } - } + if (selectedRow.isPresent()) { + onSelect.ifPresent(consumer -> consumer.accept(selectedRow.get())); + } else { + onSelect.ifPresent(consumer -> consumer.accept(null)); + } + } + } - public ObservableList<MasterTableViewModel> getContactList() { - return contacts; - } + public ObservableList<MasterTableViewModel> getContactList() { + return contacts; + } - public void setOnSelect(Consumer<MasterTableViewModel> consumer) { - onSelect = Optional.of(consumer); - } + public void setOnSelect(Consumer<MasterTableViewModel> consumer) { + onSelect = Optional.of(consumer); + } - public ObjectProperty<MasterTableViewModel> selectedTableRowProperty() { - return selectedTableRow; - } + public ObjectProperty<MasterTableViewModel> selectedTableRowProperty() { + return selectedTableRow; + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java index d22b5628b..c6bdcc9e4 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.java @@ -14,33 +14,33 @@ public class MenuView implements FxmlView<MenuViewModel> { - @FXML - private MenuItem removeMenuItem; - - @InjectViewModel - private MenuViewModel viewModel; - - @Inject - private Stage primaryStage; - - public void initialize() { - removeMenuItem.disableProperty().bind(viewModel.removeItemDisabledProperty()); - } - - @FXML - public void close() { - viewModel.closeAction(); - } - - @FXML - public void remove() { - viewModel.removeAction(); - } - - @FXML - public void about() { - Parent view = FluentViewLoader.fxmlView(AboutView.class).load().getView(); - DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - } - + @FXML + private MenuItem removeMenuItem; + + @InjectViewModel + private MenuViewModel viewModel; + + @Inject + private Stage primaryStage; + + public void initialize() { + removeMenuItem.disableProperty().bind(viewModel.removeItemDisabledProperty()); + } + + @FXML + public void close() { + viewModel.closeAction(); + } + + @FXML + public void remove() { + viewModel.removeAction(); + } + + @FXML + public void about() { + Parent view = FluentViewLoader.fxmlView(AboutView.class).load().getView(); + DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java index 8b7c4a16d..7779fab28 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuViewModel.java @@ -14,34 +14,34 @@ public class MenuViewModel implements ViewModel { - @Inject - private Event<TriggerShutdownEvent> shouldCloseEvent; + @Inject + private Event<TriggerShutdownEvent> shouldCloseEvent; - @InjectScope - private MasterDetailScope mdScope; + @InjectScope + private MasterDetailScope mdScope; - @Inject - private Repository repository; + @Inject + private Repository repository; - private final ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); + private final ReadOnlyBooleanWrapper removeItemDisabled = new ReadOnlyBooleanWrapper(); - public void initialize() { - removeItemDisabled.bind(mdScope.selectedContactProperty().isNull()); - } + public void initialize() { + removeItemDisabled.bind(mdScope.selectedContactProperty().isNull()); + } - public void closeAction() { - shouldCloseEvent.fire(new TriggerShutdownEvent()); - } + public void closeAction() { + shouldCloseEvent.fire(new TriggerShutdownEvent()); + } - public void removeAction() { - Contact selectedContact = mdScope.selectedContactProperty().get(); - if (selectedContact != null) { - repository.delete(mdScope.selectedContactProperty().get()); - } - } + public void removeAction() { + Contact selectedContact = mdScope.selectedContactProperty().get(); + if (selectedContact != null) { + repository.delete(mdScope.selectedContactProperty().get()); + } + } - public ReadOnlyBooleanProperty removeItemDisabledProperty() { - return removeItemDisabled.getReadOnlyProperty(); - } + public ReadOnlyBooleanProperty removeItemDisabledProperty() { + return removeItemDisabled.getReadOnlyProperty(); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java index ab93f4159..ec2eb7a42 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/ContactDialogScope.java @@ -11,76 +11,76 @@ public class ContactDialogScope implements Scope { - public static String RESET_DIALOG_PAGE = "contact_reset_dialog_page"; - public static String OK_BEFORE_COMMIT = "contact_ok_before_commit"; - public static String COMMIT = "contact_commit"; - public static String RESET_FORMS = "contact_reset"; + public static String RESET_DIALOG_PAGE = "contact_reset_dialog_page"; + public static String OK_BEFORE_COMMIT = "contact_ok_before_commit"; + public static String COMMIT = "contact_commit"; + public static String RESET_FORMS = "contact_reset"; - private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); + private final ObjectProperty<Contact> contactToEdit = new SimpleObjectProperty<>(this, "contactToEdit"); - private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); - private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); - private final BooleanProperty bothFormsValid = new SimpleBooleanProperty(); - private final StringProperty dialogTitle = new SimpleStringProperty(); + private final BooleanProperty contactFormValid = new SimpleBooleanProperty(); + private final BooleanProperty addressFormValid = new SimpleBooleanProperty(); + private final BooleanProperty bothFormsValid = new SimpleBooleanProperty(); + private final StringProperty dialogTitle = new SimpleStringProperty(); - public BooleanProperty contactFormValidProperty() { - return this.contactFormValid; - } + public BooleanProperty contactFormValidProperty() { + return this.contactFormValid; + } - public boolean isContactFormValid() { - return this.contactFormValidProperty().get(); - } + public boolean isContactFormValid() { + return this.contactFormValidProperty().get(); + } - public void setContactFormValid(final boolean contactFormValid) { - this.contactFormValidProperty().set(contactFormValid); - } + public void setContactFormValid(final boolean contactFormValid) { + this.contactFormValidProperty().set(contactFormValid); + } - public BooleanProperty addressFormValidProperty() { - return this.addressFormValid; - } + public BooleanProperty addressFormValidProperty() { + return this.addressFormValid; + } - public boolean isAddressFormValid() { - return this.addressFormValidProperty().get(); - } + public boolean isAddressFormValid() { + return this.addressFormValidProperty().get(); + } - public void setAddressFormValid(final boolean addressFormValid) { - this.addressFormValidProperty().set(addressFormValid); - } + public void setAddressFormValid(final boolean addressFormValid) { + this.addressFormValidProperty().set(addressFormValid); + } - public ObjectProperty<Contact> contactToEditProperty() { - return this.contactToEdit; - } + public ObjectProperty<Contact> contactToEditProperty() { + return this.contactToEdit; + } - public Contact getContactToEdit() { - return this.contactToEditProperty().get(); - } + public Contact getContactToEdit() { + return this.contactToEditProperty().get(); + } - public void setContactToEdit(final Contact contactToEdit) { - this.contactToEditProperty().set(contactToEdit); - } + public void setContactToEdit(final Contact contactToEdit) { + this.contactToEditProperty().set(contactToEdit); + } - public final BooleanProperty bothFormsValidProperty() { - return this.bothFormsValid; - } + public final BooleanProperty bothFormsValidProperty() { + return this.bothFormsValid; + } - public final boolean isBothFormsValid() { - return this.bothFormsValidProperty().get(); - } + public final boolean isBothFormsValid() { + return this.bothFormsValidProperty().get(); + } - public final void setBothFormsValid(final boolean bothFormsValid) { - this.bothFormsValidProperty().set(bothFormsValid); - } + public final void setBothFormsValid(final boolean bothFormsValid) { + this.bothFormsValidProperty().set(bothFormsValid); + } - public final StringProperty dialogTitleProperty() { - return this.dialogTitle; - } + public final StringProperty dialogTitleProperty() { + return this.dialogTitle; + } - public final java.lang.String getDialogTitle() { - return this.dialogTitleProperty().get(); - } + public final java.lang.String getDialogTitle() { + return this.dialogTitleProperty().get(); + } - public final void setDialogTitle(final java.lang.String dialogTitle) { - this.dialogTitleProperty().set(dialogTitle); - } + public final void setDialogTitle(final java.lang.String dialogTitle) { + this.dialogTitleProperty().set(dialogTitle); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java index fdc629ddd..059628a57 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/scopes/MasterDetailScope.java @@ -7,18 +7,18 @@ public class MasterDetailScope implements Scope { - private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(this, "selectedContact"); - public ObjectProperty<Contact> selectedContactProperty() { - return this.selectedContact; - } + public ObjectProperty<Contact> selectedContactProperty() { + return this.selectedContact; + } - public final Contact getSelectedContact() { - return this.selectedContactProperty().get(); - } + public final Contact getSelectedContact() { + return this.selectedContactProperty().get(); + } - public final void setSelectedContact(final Contact selectedContact) { - this.selectedContactProperty().set(selectedContact); - } + public final void setSelectedContact(final Contact selectedContact) { + this.selectedContactProperty().set(selectedContact); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java index 83c82995c..06dbab4fd 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java @@ -18,26 +18,26 @@ public class ToolbarView implements FxmlView<ToolbarViewModel> { - @FXML - public Button addNewContactButton; - - @InjectViewModel - private ToolbarViewModel viewModel; - - @Inject - private Stage primaryStage; - - public void initialize() { - AwesomeDude.setIcon(addNewContactButton, AwesomeIcon.PLUS); - } - - @FXML - public void addNewContact() { - ViewTuple<AddContactDialogView, AddContactDialogViewModel> load = FluentViewLoader - .fxmlView(AddContactDialogView.class).load(); - Parent view = load.getView(); - Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); - load.getCodeBehind().setDisplayingStage(showDialog); - } - + @FXML + public Button addNewContactButton; + + @InjectViewModel + private ToolbarViewModel viewModel; + + @Inject + private Stage primaryStage; + + public void initialize() { + AwesomeDude.setIcon(addNewContactButton, AwesomeIcon.PLUS); + } + + @FXML + public void addNewContact() { + ViewTuple<AddContactDialogView, AddContactDialogViewModel> load = FluentViewLoader + .fxmlView(AddContactDialogView.class).load(); + Parent view = load.getView(); + Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); + load.getCodeBehind().setDisplayingStage(showDialog); + } + } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java index b92519e61..f36539595 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/BirthdayValidator.java @@ -13,10 +13,10 @@ */ public class BirthdayValidator extends FunctionBasedValidator<LocalDate> { - private static final Predicate<LocalDate> birthdayPredicate = date - -> date == null || date.isBefore(LocalDate.now(CentralClock.getClock())); + private static final Predicate<LocalDate> birthdayPredicate = date + -> date == null || date.isBefore(LocalDate.now(CentralClock.getClock())); - public BirthdayValidator(ObservableValue<LocalDate> date) { - super(date, birthdayPredicate, ValidationMessage.error("Birthday can't be set in the future")); - } + public BirthdayValidator(ObservableValue<LocalDate> date) { + super(date, birthdayPredicate, ValidationMessage.error("Birthday can't be set in the future")); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java index 35aca777a..9af4d7a43 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/EmailValidator.java @@ -12,13 +12,13 @@ */ public class EmailValidator extends ObservableRuleBasedValidator { - private static final Pattern SIMPLE_EMAIL_PATTERN = Pattern - .compile("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"); + private static final Pattern SIMPLE_EMAIL_PATTERN = Pattern + .compile("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"); + + public EmailValidator(ObservableValue<String> source) { + addRule(ObservableRules.notEmpty(source), ValidationMessage.error("Email may not be empty")); + addRule(ObservableRules.matches(source, SIMPLE_EMAIL_PATTERN), + ValidationMessage.warning("Maybe a wrong email format")); + } - public EmailValidator(ObservableValue<String> source) { - addRule(ObservableRules.notEmpty(source), ValidationMessage.error("Email may not be empty")); - addRule(ObservableRules.matches(source, SIMPLE_EMAIL_PATTERN), - ValidationMessage.warning("Maybe a wrong email format")); - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java index 7235583cf..6fd84e765 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/validators/PhoneValidator.java @@ -13,21 +13,21 @@ */ public class PhoneValidator extends ObservableRuleBasedValidator { - private static final Pattern SIMPLE_PHONE_PATTERN = Pattern.compile("\\+?[0-9\\s]{3,20}"); + private static final Pattern SIMPLE_PHONE_PATTERN = Pattern.compile("\\+?[0-9\\s]{3,20}"); - public PhoneValidator(ObservableValue<String> number, String message) { + public PhoneValidator(ObservableValue<String> number, String message) { - final BooleanBinding phonePatternMatches = Bindings.createBooleanBinding(() -> { - final String input = number.getValue(); + final BooleanBinding phonePatternMatches = Bindings.createBooleanBinding(() -> { + final String input = number.getValue(); - if (input == null || input.trim().isEmpty()) { - return true; - } + if (input == null || input.trim().isEmpty()) { + return true; + } - return SIMPLE_PHONE_PATTERN.matcher(input).matches(); - }, number); + return SIMPLE_PHONE_PATTERN.matcher(input).matches(); + }, number); + + addRule(phonePatternMatches, ValidationMessage.error(message)); + } - addRule(phonePatternMatches, ValidationMessage.error(message)); - } - } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java index b970a5bec..88cc6ee95 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/CentralClock.java @@ -21,23 +21,23 @@ */ public class CentralClock { - private static Clock clock = Clock.systemUTC(); + private static Clock clock = Clock.systemUTC(); - public static Clock getClock() { - return clock; - } + public static Clock getClock() { + return clock; + } - public static void setClock(Clock clock) { - CentralClock.clock = clock; - } + public static void setClock(Clock clock) { + CentralClock.clock = clock; + } - /** - * This method is used to set the clock to a fixed time. This is useful for - * tests. This way it's possible to create date/time instances with a - * predictable value for your tests. - */ - public static void setFixedClock(ZonedDateTime zonedDateTime) { - CentralClock.clock = Clock.fixed(zonedDateTime.toInstant(), ZoneId.systemDefault()); - } + /** + * This method is used to set the clock to a fixed time. This is useful for + * tests. This way it's possible to create date/time instances with a + * predictable value for your tests. + */ + public static void setFixedClock(ZonedDateTime zonedDateTime) { + CentralClock.clock = Clock.fixed(zonedDateTime.toInstant(), ZoneId.systemDefault()); + } } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java index fe546cb03..a559fdd87 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/util/DialogHelper.java @@ -17,66 +17,66 @@ */ public class DialogHelper { - /** - * Use this method to initialize the show/hide listeners for the dialog. - * - * @param openProperty the boolean property that defines whether the dialog - * should be shown or hidden. Set this property to <code>true</code> to open - * the dialog. Set it to <code>false</code> to close the dialog. When the - * dialog is closed by the user by clicking on the close-button of the - * window, this property will also be set to <code>false</code> by the - * dialog. - * @param parentStage the Stage that is used as parent to initialize the - * ownership of the dialog. This way modal dialogs can be created. - * @param rootSupplier a supplier function that is called when the dialog is - * made visible for the first time. This function has to return a - * {@link Parent} instance that is used as the root node of the dialog - * scene. - */ - public static void initDialog(BooleanProperty openProperty, final Stage parentStage, Supplier<Parent> rootSupplier) { - final Stage dialogStage = new Stage(StageStyle.UTILITY); - dialogStage.initOwner(parentStage); - dialogStage.initModality(Modality.APPLICATION_MODAL); + /** + * Use this method to initialize the show/hide listeners for the dialog. + * + * @param openProperty the boolean property that defines whether the dialog + * should be shown or hidden. Set this property to <code>true</code> to open + * the dialog. Set it to <code>false</code> to close the dialog. When the + * dialog is closed by the user by clicking on the close-button of the + * window, this property will also be set to <code>false</code> by the + * dialog. + * @param parentStage the Stage that is used as parent to initialize the + * ownership of the dialog. This way modal dialogs can be created. + * @param rootSupplier a supplier function that is called when the dialog is + * made visible for the first time. This function has to return a + * {@link Parent} instance that is used as the root node of the dialog + * scene. + */ + public static void initDialog(BooleanProperty openProperty, final Stage parentStage, Supplier<Parent> rootSupplier) { + final Stage dialogStage = new Stage(StageStyle.UTILITY); + dialogStage.initOwner(parentStage); + dialogStage.initModality(Modality.APPLICATION_MODAL); - openProperty.addListener((obs, oldValue, newValue) -> { - if (newValue) { - // when it is the first time the dialog is made visible (and therefore no scene exists) ... - if (dialogStage.getScene() == null) { - // ... we create a new scene and register it in the stage. - Scene dialogScene = new Scene(rootSupplier.get()); - dialogScene.getStylesheets().add("/contacts.css"); - dialogStage.setScene(dialogScene); - } else { - // ... otherwise we simple bring the dialog to front. - dialogStage.toFront(); - } + openProperty.addListener((obs, oldValue, newValue) -> { + if (newValue) { + // when it is the first time the dialog is made visible (and therefore no scene exists) ... + if (dialogStage.getScene() == null) { + // ... we create a new scene and register it in the stage. + Scene dialogScene = new Scene(rootSupplier.get()); + dialogScene.getStylesheets().add("/contacts.css"); + dialogStage.setScene(dialogScene); + } else { + // ... otherwise we simple bring the dialog to front. + dialogStage.toFront(); + } - dialogStage.sizeToScene(); - dialogStage.show(); - } else { - dialogStage.close(); - } - }); + dialogStage.sizeToScene(); + dialogStage.show(); + } else { + dialogStage.close(); + } + }); // when the user clicks on the close button of the dialog window - // we want to set the property to false - dialogStage.setOnCloseRequest(event -> openProperty.set(false)); - } + // we want to set the property to false + dialogStage.setOnCloseRequest(event -> openProperty.set(false)); + } - public static Stage showDialog(Parent view, Stage parentStage, String... sceneStyleSheets) { - final Stage dialogStage = new Stage(StageStyle.UTILITY); - dialogStage.initOwner(parentStage); - dialogStage.initModality(Modality.APPLICATION_MODAL); - if (dialogStage.getScene() == null) { - // ... we create a new scene and register it in the stage. - Scene dialogScene = new Scene(view); - dialogScene.getStylesheets().addAll(sceneStyleSheets); - dialogStage.setScene(dialogScene); + public static Stage showDialog(Parent view, Stage parentStage, String... sceneStyleSheets) { + final Stage dialogStage = new Stage(StageStyle.UTILITY); + dialogStage.initOwner(parentStage); + dialogStage.initModality(Modality.APPLICATION_MODAL); + if (dialogStage.getScene() == null) { + // ... we create a new scene and register it in the stage. + Scene dialogScene = new Scene(view); + dialogScene.getStylesheets().addAll(sceneStyleSheets); + dialogStage.setScene(dialogScene); - dialogStage.sizeToScene(); - dialogStage.show(); - return dialogStage; - } - return null; - } + dialogStage.sizeToScene(); + dialogStage.show(); + return dialogStage; + } + return null; + } } diff --git a/examples/contacts-example/src/main/resources/countries/iso_3166.xml b/examples/contacts-example/src/main/resources/countries/iso_3166.xml index e02ff9129..67bbf3f1f 100644 --- a/examples/contacts-example/src/main/resources/countries/iso_3166.xml +++ b/examples/contacts-example/src/main/resources/countries/iso_3166.xml @@ -49,1655 +49,1655 @@ Source: <http://www.iso.org/iso/country_codes> ]> <iso_3166_entries> - <iso_3166_entry - alpha_2_code="AF" - alpha_3_code="AFG" - numeric_code="004" - name="Afghanistan" - official_name="Islamic Republic of Afghanistan"/> - <iso_3166_entry - alpha_2_code="AX" - alpha_3_code="ALA" - numeric_code="248" - name="Åland Islands"/> - <iso_3166_entry - alpha_2_code="AL" - alpha_3_code="ALB" - numeric_code="008" - name="Albania" - official_name="Republic of Albania"/> - <iso_3166_entry - alpha_2_code="DZ" - alpha_3_code="DZA" - numeric_code="012" - name="Algeria" - official_name="People's Democratic Republic of Algeria"/> - <iso_3166_entry - alpha_2_code="AS" - alpha_3_code="ASM" - numeric_code="016" - name="American Samoa"/> - <iso_3166_entry - alpha_2_code="AD" - alpha_3_code="AND" - numeric_code="020" - name="Andorra" - official_name="Principality of Andorra"/> - <iso_3166_entry - alpha_2_code="AO" - alpha_3_code="AGO" - numeric_code="024" - name="Angola" - official_name="Republic of Angola"/> - <iso_3166_entry - alpha_2_code="AI" - alpha_3_code="AIA" - numeric_code="660" - name="Anguilla"/> - <iso_3166_entry - alpha_2_code="AQ" - alpha_3_code="ATA" - numeric_code="010" - name="Antarctica"/> - <iso_3166_entry - alpha_2_code="AG" - alpha_3_code="ATG" - numeric_code="028" - name="Antigua and Barbuda"/> - <iso_3166_entry - alpha_2_code="AR" - alpha_3_code="ARG" - numeric_code="032" - name="Argentina" - official_name="Argentine Republic"/> - <iso_3166_entry - alpha_2_code="AM" - alpha_3_code="ARM" - numeric_code="051" - name="Armenia" - official_name="Republic of Armenia"/> - <iso_3166_entry - alpha_2_code="AW" - alpha_3_code="ABW" - numeric_code="533" - name="Aruba"/> - <iso_3166_entry - alpha_2_code="AU" - alpha_3_code="AUS" - numeric_code="036" - name="Australia"/> - <iso_3166_entry - alpha_2_code="AT" - alpha_3_code="AUT" - numeric_code="040" - name="Austria" - official_name="Republic of Austria"/> - <iso_3166_entry - alpha_2_code="AZ" - alpha_3_code="AZE" - numeric_code="031" - name="Azerbaijan" - official_name="Republic of Azerbaijan"/> - <iso_3166_entry - alpha_2_code="BS" - alpha_3_code="BHS" - numeric_code="044" - name="Bahamas" - official_name="Commonwealth of the Bahamas"/> - <iso_3166_entry - alpha_2_code="BH" - alpha_3_code="BHR" - numeric_code="048" - name="Bahrain" - official_name="Kingdom of Bahrain"/> - <iso_3166_entry - alpha_2_code="BD" - alpha_3_code="BGD" - numeric_code="050" - name="Bangladesh" - official_name="People's Republic of Bangladesh"/> - <iso_3166_entry - alpha_2_code="BB" - alpha_3_code="BRB" - numeric_code="052" - name="Barbados"/> - <iso_3166_entry - alpha_2_code="BY" - alpha_3_code="BLR" - numeric_code="112" - name="Belarus" - official_name="Republic of Belarus"/> - <iso_3166_entry - alpha_2_code="BE" - alpha_3_code="BEL" - numeric_code="056" - name="Belgium" - official_name="Kingdom of Belgium"/> - <iso_3166_entry - alpha_2_code="BZ" - alpha_3_code="BLZ" - numeric_code="084" - name="Belize"/> - <iso_3166_entry - alpha_2_code="BJ" - alpha_3_code="BEN" - numeric_code="204" - name="Benin" - official_name="Republic of Benin"/> - <iso_3166_entry - alpha_2_code="BM" - alpha_3_code="BMU" - numeric_code="060" - name="Bermuda"/> - <iso_3166_entry - alpha_2_code="BT" - alpha_3_code="BTN" - numeric_code="064" - name="Bhutan" - official_name="Kingdom of Bhutan"/> - <iso_3166_entry - alpha_2_code="BO" - alpha_3_code="BOL" - numeric_code="068" - common_name="Bolivia" - name="Bolivia, Plurinational State of" - official_name="Plurinational State of Bolivia"/> - <iso_3166_entry - alpha_2_code="BQ" - alpha_3_code="BES" - numeric_code="535" - name="Bonaire, Saint Eustatius and Saba" - official_name="Bonaire, Saint Eustatius and Saba"/> - <iso_3166_entry - alpha_2_code="BA" - alpha_3_code="BIH" - numeric_code="070" - name="Bosnia and Herzegovina" - official_name="Republic of Bosnia and Herzegovina"/> - <iso_3166_entry - alpha_2_code="BW" - alpha_3_code="BWA" - numeric_code="072" - name="Botswana" - official_name="Republic of Botswana"/> - <iso_3166_entry - alpha_2_code="BV" - alpha_3_code="BVT" - numeric_code="074" - name="Bouvet Island"/> - <iso_3166_entry - alpha_2_code="BR" - alpha_3_code="BRA" - numeric_code="076" - name="Brazil" - official_name="Federative Republic of Brazil"/> - <iso_3166_entry - alpha_2_code="IO" - alpha_3_code="IOT" - numeric_code="086" - name="British Indian Ocean Territory"/> - <iso_3166_entry - alpha_2_code="BN" - alpha_3_code="BRN" - numeric_code="096" - name="Brunei Darussalam"/> - <iso_3166_entry - alpha_2_code="BG" - alpha_3_code="BGR" - numeric_code="100" - name="Bulgaria" - official_name="Republic of Bulgaria"/> - <iso_3166_entry - alpha_2_code="BF" - alpha_3_code="BFA" - numeric_code="854" - name="Burkina Faso"/> - <iso_3166_entry - alpha_2_code="BI" - alpha_3_code="BDI" - numeric_code="108" - name="Burundi" - official_name="Republic of Burundi"/> - <iso_3166_entry - alpha_2_code="KH" - alpha_3_code="KHM" - numeric_code="116" - name="Cambodia" - official_name="Kingdom of Cambodia"/> - <iso_3166_entry - alpha_2_code="CM" - alpha_3_code="CMR" - numeric_code="120" - name="Cameroon" - official_name="Republic of Cameroon"/> - <iso_3166_entry - alpha_2_code="CA" - alpha_3_code="CAN" - numeric_code="124" - name="Canada"/> - <iso_3166_entry - alpha_2_code="CV" - alpha_3_code="CPV" - numeric_code="132" - name="Cape Verde" - official_name="Republic of Cape Verde"/> - <iso_3166_entry - alpha_2_code="KY" - alpha_3_code="CYM" - numeric_code="136" - name="Cayman Islands"/> - <iso_3166_entry - alpha_2_code="CF" - alpha_3_code="CAF" - numeric_code="140" - name="Central African Republic"/> - <iso_3166_entry - alpha_2_code="TD" - alpha_3_code="TCD" - numeric_code="148" - name="Chad" - official_name="Republic of Chad"/> - <iso_3166_entry - alpha_2_code="CL" - alpha_3_code="CHL" - numeric_code="152" - name="Chile" - official_name="Republic of Chile"/> - <iso_3166_entry - alpha_2_code="CN" - alpha_3_code="CHN" - numeric_code="156" - name="China" - official_name="People's Republic of China"/> - <iso_3166_entry - alpha_2_code="CX" - alpha_3_code="CXR" - numeric_code="162" - name="Christmas Island"/> - <iso_3166_entry - alpha_2_code="CC" - alpha_3_code="CCK" - numeric_code="166" - name="Cocos (Keeling) Islands"/> - <iso_3166_entry - alpha_2_code="CO" - alpha_3_code="COL" - numeric_code="170" - name="Colombia" - official_name="Republic of Colombia"/> - <iso_3166_entry - alpha_2_code="KM" - alpha_3_code="COM" - numeric_code="174" - name="Comoros" - official_name="Union of the Comoros"/> - <iso_3166_entry - alpha_2_code="CG" - alpha_3_code="COG" - numeric_code="178" - name="Congo" - official_name="Republic of the Congo"/> - <iso_3166_entry - alpha_2_code="CD" - alpha_3_code="COD" - numeric_code="180" - name="Congo, The Democratic Republic of the"/> - <iso_3166_entry - alpha_2_code="CK" - alpha_3_code="COK" - numeric_code="184" - name="Cook Islands"/> - <iso_3166_entry - alpha_2_code="CR" - alpha_3_code="CRI" - numeric_code="188" - name="Costa Rica" - official_name="Republic of Costa Rica"/> - <iso_3166_entry - alpha_2_code="CI" - alpha_3_code="CIV" - numeric_code="384" - name="Côte d'Ivoire" - official_name="Republic of Côte d'Ivoire"/> - <iso_3166_entry - alpha_2_code="HR" - alpha_3_code="HRV" - numeric_code="191" - name="Croatia" - official_name="Republic of Croatia"/> - <iso_3166_entry - alpha_2_code="CU" - alpha_3_code="CUB" - numeric_code="192" - name="Cuba" - official_name="Republic of Cuba"/> - <iso_3166_entry - alpha_2_code="CW" - alpha_3_code="CUW" - numeric_code="531" - name="Curaçao" - official_name="Curaçao"/> - <iso_3166_entry - alpha_2_code="CY" - alpha_3_code="CYP" - numeric_code="196" - name="Cyprus" - official_name="Republic of Cyprus"/> - <iso_3166_entry - alpha_2_code="CZ" - alpha_3_code="CZE" - numeric_code="203" - name="Czech Republic"/> - <iso_3166_entry - alpha_2_code="DK" - alpha_3_code="DNK" - numeric_code="208" - name="Denmark" - official_name="Kingdom of Denmark"/> - <iso_3166_entry - alpha_2_code="DJ" - alpha_3_code="DJI" - numeric_code="262" - name="Djibouti" - official_name="Republic of Djibouti"/> - <iso_3166_entry - alpha_2_code="DM" - alpha_3_code="DMA" - numeric_code="212" - name="Dominica" - official_name="Commonwealth of Dominica"/> - <iso_3166_entry - alpha_2_code="DO" - alpha_3_code="DOM" - numeric_code="214" - name="Dominican Republic"/> - <iso_3166_entry - alpha_2_code="EC" - alpha_3_code="ECU" - numeric_code="218" - name="Ecuador" - official_name="Republic of Ecuador"/> - <iso_3166_entry - alpha_2_code="EG" - alpha_3_code="EGY" - numeric_code="818" - name="Egypt" - official_name="Arab Republic of Egypt"/> - <iso_3166_entry - alpha_2_code="SV" - alpha_3_code="SLV" - numeric_code="222" - name="El Salvador" - official_name="Republic of El Salvador"/> - <iso_3166_entry - alpha_2_code="GQ" - alpha_3_code="GNQ" - numeric_code="226" - name="Equatorial Guinea" - official_name="Republic of Equatorial Guinea"/> - <iso_3166_entry - alpha_2_code="ER" - alpha_3_code="ERI" - numeric_code="232" - name="Eritrea"/> - <iso_3166_entry - alpha_2_code="EE" - alpha_3_code="EST" - numeric_code="233" - name="Estonia" - official_name="Republic of Estonia"/> - <iso_3166_entry - alpha_2_code="ET" - alpha_3_code="ETH" - numeric_code="231" - name="Ethiopia" - official_name="Federal Democratic Republic of Ethiopia"/> - <iso_3166_entry - alpha_2_code="FK" - alpha_3_code="FLK" - numeric_code="238" - name="Falkland Islands (Malvinas)"/> - <iso_3166_entry - alpha_2_code="FO" - alpha_3_code="FRO" - numeric_code="234" - name="Faroe Islands"/> - <iso_3166_entry - alpha_2_code="FJ" - alpha_3_code="FJI" - numeric_code="242" - name="Fiji" - official_name="Republic of the Fiji Islands"/> - <iso_3166_entry - alpha_2_code="FI" - alpha_3_code="FIN" - numeric_code="246" - name="Finland" - official_name="Republic of Finland"/> - <iso_3166_entry - alpha_2_code="FR" - alpha_3_code="FRA" - numeric_code="250" - name="France" - official_name="French Republic"/> - <iso_3166_entry - alpha_2_code="GF" - alpha_3_code="GUF" - numeric_code="254" - name="French Guiana"/> - <iso_3166_entry - alpha_2_code="PF" - alpha_3_code="PYF" - numeric_code="258" - name="French Polynesia"/> - <iso_3166_entry - alpha_2_code="TF" - alpha_3_code="ATF" - numeric_code="260" - name="French Southern Territories"/> - <iso_3166_entry - alpha_2_code="GA" - alpha_3_code="GAB" - numeric_code="266" - name="Gabon" - official_name="Gabonese Republic"/> - <iso_3166_entry - alpha_2_code="GM" - alpha_3_code="GMB" - numeric_code="270" - name="Gambia" - official_name="Republic of the Gambia"/> - <iso_3166_entry - alpha_2_code="GE" - alpha_3_code="GEO" - numeric_code="268" - name="Georgia"/> - <iso_3166_entry - alpha_2_code="DE" - alpha_3_code="DEU" - numeric_code="276" - name="Germany" - official_name="Federal Republic of Germany"/> - <iso_3166_entry - alpha_2_code="GH" - alpha_3_code="GHA" - numeric_code="288" - name="Ghana" - official_name="Republic of Ghana"/> - <iso_3166_entry - alpha_2_code="GI" - alpha_3_code="GIB" - numeric_code="292" - name="Gibraltar"/> - <iso_3166_entry - alpha_2_code="GR" - alpha_3_code="GRC" - numeric_code="300" - name="Greece" - official_name="Hellenic Republic"/> - <iso_3166_entry - alpha_2_code="GL" - alpha_3_code="GRL" - numeric_code="304" - name="Greenland"/> - <iso_3166_entry - alpha_2_code="GD" - alpha_3_code="GRD" - numeric_code="308" - name="Grenada"/> - <iso_3166_entry - alpha_2_code="GP" - alpha_3_code="GLP" - numeric_code="312" - name="Guadeloupe"/> - <iso_3166_entry - alpha_2_code="GU" - alpha_3_code="GUM" - numeric_code="316" - name="Guam"/> - <iso_3166_entry - alpha_2_code="GT" - alpha_3_code="GTM" - numeric_code="320" - name="Guatemala" - official_name="Republic of Guatemala"/> - <iso_3166_entry - alpha_2_code="GG" - alpha_3_code="GGY" - numeric_code="831" - name="Guernsey"/> - <iso_3166_entry - alpha_2_code="GN" - alpha_3_code="GIN" - numeric_code="324" - name="Guinea" - official_name="Republic of Guinea"/> - <iso_3166_entry - alpha_2_code="GW" - alpha_3_code="GNB" - numeric_code="624" - name="Guinea-Bissau" - official_name="Republic of Guinea-Bissau"/> - <iso_3166_entry - alpha_2_code="GY" - alpha_3_code="GUY" - numeric_code="328" - name="Guyana" - official_name="Republic of Guyana"/> - <iso_3166_entry - alpha_2_code="HT" - alpha_3_code="HTI" - numeric_code="332" - name="Haiti" - official_name="Republic of Haiti"/> - <iso_3166_entry - alpha_2_code="HM" - alpha_3_code="HMD" - numeric_code="334" - name="Heard Island and McDonald Islands"/> - <iso_3166_entry - alpha_2_code="VA" - alpha_3_code="VAT" - numeric_code="336" - name="Holy See (Vatican City State)"/> - <iso_3166_entry - alpha_2_code="HN" - alpha_3_code="HND" - numeric_code="340" - name="Honduras" - official_name="Republic of Honduras"/> - <iso_3166_entry - alpha_2_code="HK" - alpha_3_code="HKG" - numeric_code="344" - name="Hong Kong" - official_name="Hong Kong Special Administrative Region of China"/> - <iso_3166_entry - alpha_2_code="HU" - alpha_3_code="HUN" - numeric_code="348" - name="Hungary" - official_name="Republic of Hungary"/> - <iso_3166_entry - alpha_2_code="IS" - alpha_3_code="ISL" - numeric_code="352" - name="Iceland" - official_name="Republic of Iceland"/> - <iso_3166_entry - alpha_2_code="IN" - alpha_3_code="IND" - numeric_code="356" - name="India" - official_name="Republic of India"/> - <iso_3166_entry - alpha_2_code="ID" - alpha_3_code="IDN" - numeric_code="360" - name="Indonesia" - official_name="Republic of Indonesia"/> - <iso_3166_entry - alpha_2_code="IR" - alpha_3_code="IRN" - numeric_code="364" - name="Iran, Islamic Republic of" - official_name="Islamic Republic of Iran"/> - <iso_3166_entry - alpha_2_code="IQ" - alpha_3_code="IRQ" - numeric_code="368" - name="Iraq" - official_name="Republic of Iraq"/> - <iso_3166_entry - alpha_2_code="IE" - alpha_3_code="IRL" - numeric_code="372" - name="Ireland"/> - <iso_3166_entry - alpha_2_code="IM" - alpha_3_code="IMN" - numeric_code="833" - name="Isle of Man"/> - <iso_3166_entry - alpha_2_code="IL" - alpha_3_code="ISR" - numeric_code="376" - name="Israel" - official_name="State of Israel"/> - <iso_3166_entry - alpha_2_code="IT" - alpha_3_code="ITA" - numeric_code="380" - name="Italy" - official_name="Italian Republic"/> - <iso_3166_entry - alpha_2_code="JM" - alpha_3_code="JAM" - numeric_code="388" - name="Jamaica"/> - <iso_3166_entry - alpha_2_code="JP" - alpha_3_code="JPN" - numeric_code="392" - name="Japan"/> - <iso_3166_entry - alpha_2_code="JE" - alpha_3_code="JEY" - numeric_code="832" - name="Jersey"/> - <iso_3166_entry - alpha_2_code="JO" - alpha_3_code="JOR" - numeric_code="400" - name="Jordan" - official_name="Hashemite Kingdom of Jordan"/> - <iso_3166_entry - alpha_2_code="KZ" - alpha_3_code="KAZ" - numeric_code="398" - name="Kazakhstan" - official_name="Republic of Kazakhstan"/> - <iso_3166_entry - alpha_2_code="KE" - alpha_3_code="KEN" - numeric_code="404" - name="Kenya" - official_name="Republic of Kenya"/> - <iso_3166_entry - alpha_2_code="KI" - alpha_3_code="KIR" - numeric_code="296" - name="Kiribati" - official_name="Republic of Kiribati"/> - <iso_3166_entry - alpha_2_code="KP" - alpha_3_code="PRK" - numeric_code="408" - name="Korea, Democratic People's Republic of" - official_name="Democratic People's Republic of Korea"/> - <iso_3166_entry - alpha_2_code="KR" - alpha_3_code="KOR" - numeric_code="410" - name="Korea, Republic of"/> - <iso_3166_entry - alpha_2_code="KW" - alpha_3_code="KWT" - numeric_code="414" - name="Kuwait" - official_name="State of Kuwait"/> - <iso_3166_entry - alpha_2_code="KG" - alpha_3_code="KGZ" - numeric_code="417" - name="Kyrgyzstan" - official_name="Kyrgyz Republic"/> - <iso_3166_entry - alpha_2_code="LA" - alpha_3_code="LAO" - numeric_code="418" - name="Lao People's Democratic Republic"/> - <iso_3166_entry - alpha_2_code="LV" - alpha_3_code="LVA" - numeric_code="428" - name="Latvia" - official_name="Republic of Latvia"/> - <iso_3166_entry - alpha_2_code="LB" - alpha_3_code="LBN" - numeric_code="422" - name="Lebanon" - official_name="Lebanese Republic"/> - <iso_3166_entry - alpha_2_code="LS" - alpha_3_code="LSO" - numeric_code="426" - name="Lesotho" - official_name="Kingdom of Lesotho"/> - <iso_3166_entry - alpha_2_code="LR" - alpha_3_code="LBR" - numeric_code="430" - name="Liberia" - official_name="Republic of Liberia"/> - <iso_3166_entry - alpha_2_code="LY" - alpha_3_code="LBY" - numeric_code="434" - common_name="Libya" - name="Libyan Arab Jamahiriya" - official_name="Socialist People's Libyan Arab Jamahiriya"/> - <iso_3166_entry - alpha_2_code="LI" - alpha_3_code="LIE" - numeric_code="438" - name="Liechtenstein" - official_name="Principality of Liechtenstein"/> - <iso_3166_entry - alpha_2_code="LT" - alpha_3_code="LTU" - numeric_code="440" - name="Lithuania" - official_name="Republic of Lithuania"/> - <iso_3166_entry - alpha_2_code="LU" - alpha_3_code="LUX" - numeric_code="442" - name="Luxembourg" - official_name="Grand Duchy of Luxembourg"/> - <iso_3166_entry - alpha_2_code="MO" - alpha_3_code="MAC" - numeric_code="446" - name="Macao" - official_name="Macao Special Administrative Region of China"/> - <iso_3166_entry - alpha_2_code="MK" - alpha_3_code="MKD" - numeric_code="807" - name="Macedonia, Republic of" - official_name="The Former Yugoslav Republic of Macedonia"/> - <iso_3166_entry - alpha_2_code="MG" - alpha_3_code="MDG" - numeric_code="450" - name="Madagascar" - official_name="Republic of Madagascar"/> - <iso_3166_entry - alpha_2_code="MW" - alpha_3_code="MWI" - numeric_code="454" - name="Malawi" - official_name="Republic of Malawi"/> - <iso_3166_entry - alpha_2_code="MY" - alpha_3_code="MYS" - numeric_code="458" - name="Malaysia"/> - <iso_3166_entry - alpha_2_code="MV" - alpha_3_code="MDV" - numeric_code="462" - name="Maldives" - official_name="Republic of Maldives"/> - <iso_3166_entry - alpha_2_code="ML" - alpha_3_code="MLI" - numeric_code="466" - name="Mali" - official_name="Republic of Mali"/> - <iso_3166_entry - alpha_2_code="MT" - alpha_3_code="MLT" - numeric_code="470" - name="Malta" - official_name="Republic of Malta"/> - <iso_3166_entry - alpha_2_code="MH" - alpha_3_code="MHL" - numeric_code="584" - name="Marshall Islands" - official_name="Republic of the Marshall Islands"/> - <iso_3166_entry - alpha_2_code="MQ" - alpha_3_code="MTQ" - numeric_code="474" - name="Martinique"/> - <iso_3166_entry - alpha_2_code="MR" - alpha_3_code="MRT" - numeric_code="478" - name="Mauritania" - official_name="Islamic Republic of Mauritania"/> - <iso_3166_entry - alpha_2_code="MU" - alpha_3_code="MUS" - numeric_code="480" - name="Mauritius" - official_name="Republic of Mauritius"/> - <iso_3166_entry - alpha_2_code="YT" - alpha_3_code="MYT" - numeric_code="175" - name="Mayotte"/> - <iso_3166_entry - alpha_2_code="MX" - alpha_3_code="MEX" - numeric_code="484" - name="Mexico" - official_name="United Mexican States"/> - <iso_3166_entry - alpha_2_code="FM" - alpha_3_code="FSM" - numeric_code="583" - name="Micronesia, Federated States of" - official_name="Federated States of Micronesia"/> - <iso_3166_entry - alpha_2_code="MD" - alpha_3_code="MDA" - numeric_code="498" - common_name="Moldova" - name="Moldova, Republic of" - official_name="Republic of Moldova"/> - <iso_3166_entry - alpha_2_code="MC" - alpha_3_code="MCO" - numeric_code="492" - name="Monaco" - official_name="Principality of Monaco"/> - <iso_3166_entry - alpha_2_code="MN" - alpha_3_code="MNG" - numeric_code="496" - name="Mongolia"/> - <iso_3166_entry - alpha_2_code="ME" - alpha_3_code="MNE" - numeric_code="499" - name="Montenegro" - official_name="Montenegro"/> - <iso_3166_entry - alpha_2_code="MS" - alpha_3_code="MSR" - numeric_code="500" - name="Montserrat"/> - <iso_3166_entry - alpha_2_code="MA" - alpha_3_code="MAR" - numeric_code="504" - name="Morocco" - official_name="Kingdom of Morocco"/> - <iso_3166_entry - alpha_2_code="MZ" - alpha_3_code="MOZ" - numeric_code="508" - name="Mozambique" - official_name="Republic of Mozambique"/> - <iso_3166_entry - alpha_2_code="MM" - alpha_3_code="MMR" - numeric_code="104" - name="Myanmar" - official_name="Union of Myanmar"/> - <iso_3166_entry - alpha_2_code="NA" - alpha_3_code="NAM" - numeric_code="516" - name="Namibia" - official_name="Republic of Namibia"/> - <iso_3166_entry - alpha_2_code="NR" - alpha_3_code="NRU" - numeric_code="520" - name="Nauru" - official_name="Republic of Nauru"/> - <iso_3166_entry - alpha_2_code="NP" - alpha_3_code="NPL" - numeric_code="524" - name="Nepal" - official_name="Federal Democratic Republic of Nepal"/> - <iso_3166_entry - alpha_2_code="NL" - alpha_3_code="NLD" - numeric_code="528" - name="Netherlands" - official_name="Kingdom of the Netherlands"/> - <iso_3166_entry - alpha_2_code="NC" - alpha_3_code="NCL" - numeric_code="540" - name="New Caledonia"/> - <iso_3166_entry - alpha_2_code="NZ" - alpha_3_code="NZL" - numeric_code="554" - name="New Zealand"/> - <iso_3166_entry - alpha_2_code="NI" - alpha_3_code="NIC" - numeric_code="558" - name="Nicaragua" - official_name="Republic of Nicaragua"/> - <iso_3166_entry - alpha_2_code="NE" - alpha_3_code="NER" - numeric_code="562" - name="Niger" - official_name="Republic of the Niger"/> - <iso_3166_entry - alpha_2_code="NG" - alpha_3_code="NGA" - numeric_code="566" - name="Nigeria" - official_name="Federal Republic of Nigeria"/> - <iso_3166_entry - alpha_2_code="NU" - alpha_3_code="NIU" - numeric_code="570" - name="Niue" - official_name="Republic of Niue"/> - <iso_3166_entry - alpha_2_code="NF" - alpha_3_code="NFK" - numeric_code="574" - name="Norfolk Island"/> - <iso_3166_entry - alpha_2_code="MP" - alpha_3_code="MNP" - numeric_code="580" - name="Northern Mariana Islands" - official_name="Commonwealth of the Northern Mariana Islands"/> - <iso_3166_entry - alpha_2_code="NO" - alpha_3_code="NOR" - numeric_code="578" - name="Norway" - official_name="Kingdom of Norway"/> - <iso_3166_entry - alpha_2_code="OM" - alpha_3_code="OMN" - numeric_code="512" - name="Oman" - official_name="Sultanate of Oman"/> - <iso_3166_entry - alpha_2_code="PK" - alpha_3_code="PAK" - numeric_code="586" - name="Pakistan" - official_name="Islamic Republic of Pakistan"/> - <iso_3166_entry - alpha_2_code="PW" - alpha_3_code="PLW" - numeric_code="585" - name="Palau" - official_name="Republic of Palau"/> - <iso_3166_entry - alpha_2_code="PS" - alpha_3_code="PSE" - numeric_code="275" - name="Palestinian Territory, Occupied" - official_name="Occupied Palestinian Territory"/> - <iso_3166_entry - alpha_2_code="PA" - alpha_3_code="PAN" - numeric_code="591" - name="Panama" - official_name="Republic of Panama"/> - <iso_3166_entry - alpha_2_code="PG" - alpha_3_code="PNG" - numeric_code="598" - name="Papua New Guinea"/> - <iso_3166_entry - alpha_2_code="PY" - alpha_3_code="PRY" - numeric_code="600" - name="Paraguay" - official_name="Republic of Paraguay"/> - <iso_3166_entry - alpha_2_code="PE" - alpha_3_code="PER" - numeric_code="604" - name="Peru" - official_name="Republic of Peru"/> - <iso_3166_entry - alpha_2_code="PH" - alpha_3_code="PHL" - numeric_code="608" - name="Philippines" - official_name="Republic of the Philippines"/> - <iso_3166_entry - alpha_2_code="PN" - alpha_3_code="PCN" - numeric_code="612" - name="Pitcairn"/> - <iso_3166_entry - alpha_2_code="PL" - alpha_3_code="POL" - numeric_code="616" - name="Poland" - official_name="Republic of Poland"/> - <iso_3166_entry - alpha_2_code="PT" - alpha_3_code="PRT" - numeric_code="620" - name="Portugal" - official_name="Portuguese Republic"/> - <iso_3166_entry - alpha_2_code="PR" - alpha_3_code="PRI" - numeric_code="630" - name="Puerto Rico"/> - <iso_3166_entry - alpha_2_code="QA" - alpha_3_code="QAT" - numeric_code="634" - name="Qatar" - official_name="State of Qatar"/> - <iso_3166_entry - alpha_2_code="RE" - alpha_3_code="REU" - numeric_code="638" - name="Reunion"/> - <iso_3166_entry - alpha_2_code="RO" - alpha_3_code="ROU" - numeric_code="642" - name="Romania"/> - <iso_3166_entry - alpha_2_code="RU" - alpha_3_code="RUS" - numeric_code="643" - name="Russian Federation"/> - <iso_3166_entry - alpha_2_code="RW" - alpha_3_code="RWA" - numeric_code="646" - name="Rwanda" - official_name="Rwandese Republic"/> - <iso_3166_entry - alpha_2_code="BL" - alpha_3_code="BLM" - numeric_code="652" - name="Saint Barthélemy"/> - <iso_3166_entry - alpha_2_code="SH" - alpha_3_code="SHN" - numeric_code="654" - name="Saint Helena, Ascension and Tristan da Cunha"/> - <iso_3166_entry - alpha_2_code="KN" - alpha_3_code="KNA" - numeric_code="659" - name="Saint Kitts and Nevis"/> - <iso_3166_entry - alpha_2_code="LC" - alpha_3_code="LCA" - numeric_code="662" - name="Saint Lucia"/> - <iso_3166_entry - alpha_2_code="MF" - alpha_3_code="MAF" - numeric_code="663" - name="Saint Martin (French part)"/> - <iso_3166_entry - alpha_2_code="PM" - alpha_3_code="SPM" - numeric_code="666" - name="Saint Pierre and Miquelon"/> - <iso_3166_entry - alpha_2_code="VC" - alpha_3_code="VCT" - numeric_code="670" - name="Saint Vincent and the Grenadines"/> - <iso_3166_entry - alpha_2_code="WS" - alpha_3_code="WSM" - numeric_code="882" - name="Samoa" - official_name="Independent State of Samoa"/> - <iso_3166_entry - alpha_2_code="SM" - alpha_3_code="SMR" - numeric_code="674" - name="San Marino" - official_name="Republic of San Marino"/> - <iso_3166_entry - alpha_2_code="ST" - alpha_3_code="STP" - numeric_code="678" - name="Sao Tome and Principe" - official_name="Democratic Republic of Sao Tome and Principe"/> - <iso_3166_entry - alpha_2_code="SA" - alpha_3_code="SAU" - numeric_code="682" - name="Saudi Arabia" - official_name="Kingdom of Saudi Arabia"/> - <iso_3166_entry - alpha_2_code="SN" - alpha_3_code="SEN" - numeric_code="686" - name="Senegal" - official_name="Republic of Senegal"/> - <iso_3166_entry - alpha_2_code="RS" - alpha_3_code="SRB" - numeric_code="688" - name="Serbia" - official_name="Republic of Serbia"/> - <iso_3166_entry - alpha_2_code="SC" - alpha_3_code="SYC" - numeric_code="690" - name="Seychelles" - official_name="Republic of Seychelles"/> - <iso_3166_entry - alpha_2_code="SL" - alpha_3_code="SLE" - numeric_code="694" - name="Sierra Leone" - official_name="Republic of Sierra Leone"/> - <iso_3166_entry - alpha_2_code="SG" - alpha_3_code="SGP" - numeric_code="702" - name="Singapore" - official_name="Republic of Singapore"/> - <iso_3166_entry - alpha_2_code="SX" - alpha_3_code="SXM" - numeric_code="702" - name="Sint Maarten" - official_name="Sint Maarten (Dutch part)"/> - <iso_3166_entry - alpha_2_code="SK" - alpha_3_code="SVK" - numeric_code="703" - name="Slovakia" - official_name="Slovak Republic"/> - <iso_3166_entry - alpha_2_code="SI" - alpha_3_code="SVN" - numeric_code="705" - name="Slovenia" - official_name="Republic of Slovenia"/> - <iso_3166_entry - alpha_2_code="SB" - alpha_3_code="SLB" - numeric_code="090" - name="Solomon Islands"/> - <iso_3166_entry - alpha_2_code="SO" - alpha_3_code="SOM" - numeric_code="706" - name="Somalia" - official_name="Somali Republic"/> - <iso_3166_entry - alpha_2_code="ZA" - alpha_3_code="ZAF" - numeric_code="710" - name="South Africa" - official_name="Republic of South Africa"/> - <iso_3166_entry - alpha_2_code="GS" - alpha_3_code="SGS" - numeric_code="239" - name="South Georgia and the South Sandwich Islands"/> - <iso_3166_entry - alpha_2_code="ES" - alpha_3_code="ESP" - numeric_code="724" - name="Spain" - official_name="Kingdom of Spain"/> - <iso_3166_entry - alpha_2_code="LK" - alpha_3_code="LKA" - numeric_code="144" - name="Sri Lanka" - official_name="Democratic Socialist Republic of Sri Lanka"/> - <iso_3166_entry - alpha_2_code="SD" - alpha_3_code="SDN" - numeric_code="736" - name="Sudan" - official_name="Republic of the Sudan"/> - <iso_3166_entry - alpha_2_code="SR" - alpha_3_code="SUR" - numeric_code="740" - name="Suriname" - official_name="Republic of Suriname"/> - <iso_3166_entry - alpha_2_code="SJ" - alpha_3_code="SJM" - numeric_code="744" - name="Svalbard and Jan Mayen"/> - <iso_3166_entry - alpha_2_code="SZ" - alpha_3_code="SWZ" - numeric_code="748" - name="Swaziland" - official_name="Kingdom of Swaziland"/> - <iso_3166_entry - alpha_2_code="SE" - alpha_3_code="SWE" - numeric_code="752" - name="Sweden" - official_name="Kingdom of Sweden"/> - <iso_3166_entry - alpha_2_code="CH" - alpha_3_code="CHE" - numeric_code="756" - name="Switzerland" - official_name="Swiss Confederation"/> - <iso_3166_entry - alpha_2_code="SY" - alpha_3_code="SYR" - numeric_code="760" - name="Syrian Arab Republic"/> - <iso_3166_entry - alpha_2_code="TW" - alpha_3_code="TWN" - numeric_code="158" - common_name="Taiwan" - name="Taiwan, Province of China" - official_name="Taiwan, Province of China"/> - <iso_3166_entry - alpha_2_code="TJ" - alpha_3_code="TJK" - numeric_code="762" - name="Tajikistan" - official_name="Republic of Tajikistan"/> - <iso_3166_entry - alpha_2_code="TZ" - alpha_3_code="TZA" - numeric_code="834" - name="Tanzania, United Republic of" - official_name="United Republic of Tanzania"/> - <iso_3166_entry - alpha_2_code="TH" - alpha_3_code="THA" - numeric_code="764" - name="Thailand" - official_name="Kingdom of Thailand"/> - <iso_3166_entry - alpha_2_code="TL" - alpha_3_code="TLS" - numeric_code="626" - name="Timor-Leste" - official_name="Democratic Republic of Timor-Leste"/> - <iso_3166_entry - alpha_2_code="TG" - alpha_3_code="TGO" - numeric_code="768" - name="Togo" - official_name="Togolese Republic"/> - <iso_3166_entry - alpha_2_code="TK" - alpha_3_code="TKL" - numeric_code="772" - name="Tokelau"/> - <iso_3166_entry - alpha_2_code="TO" - alpha_3_code="TON" - numeric_code="776" - name="Tonga" - official_name="Kingdom of Tonga"/> - <iso_3166_entry - alpha_2_code="TT" - alpha_3_code="TTO" - numeric_code="780" - name="Trinidad and Tobago" - official_name="Republic of Trinidad and Tobago"/> - <iso_3166_entry - alpha_2_code="TN" - alpha_3_code="TUN" - numeric_code="788" - name="Tunisia" - official_name="Republic of Tunisia"/> - <iso_3166_entry - alpha_2_code="TR" - alpha_3_code="TUR" - numeric_code="792" - name="Turkey" - official_name="Republic of Turkey"/> - <iso_3166_entry - alpha_2_code="TM" - alpha_3_code="TKM" - numeric_code="795" - name="Turkmenistan"/> - <iso_3166_entry - alpha_2_code="TC" - alpha_3_code="TCA" - numeric_code="796" - name="Turks and Caicos Islands"/> - <iso_3166_entry - alpha_2_code="TV" - alpha_3_code="TUV" - numeric_code="798" - name="Tuvalu"/> - <iso_3166_entry - alpha_2_code="UG" - alpha_3_code="UGA" - numeric_code="800" - name="Uganda" - official_name="Republic of Uganda"/> - <iso_3166_entry - alpha_2_code="UA" - alpha_3_code="UKR" - numeric_code="804" - name="Ukraine"/> - <iso_3166_entry - alpha_2_code="AE" - alpha_3_code="ARE" - numeric_code="784" - name="United Arab Emirates"/> - <iso_3166_entry - alpha_2_code="GB" - alpha_3_code="GBR" - numeric_code="826" - name="United Kingdom" - official_name="United Kingdom of Great Britain and Northern Ireland"/> - <iso_3166_entry - alpha_2_code="US" - alpha_3_code="USA" - numeric_code="840" - name="United States" - official_name="United States of America"/> - <iso_3166_entry - alpha_2_code="UM" - alpha_3_code="UMI" - numeric_code="581" - name="United States Minor Outlying Islands"/> - <iso_3166_entry - alpha_2_code="UY" - alpha_3_code="URY" - numeric_code="858" - name="Uruguay" - official_name="Eastern Republic of Uruguay"/> - <iso_3166_entry - alpha_2_code="UZ" - alpha_3_code="UZB" - numeric_code="860" - name="Uzbekistan" - official_name="Republic of Uzbekistan"/> - <iso_3166_entry - alpha_2_code="VU" - alpha_3_code="VUT" - numeric_code="548" - name="Vanuatu" - official_name="Republic of Vanuatu"/> - <iso_3166_entry - alpha_2_code="VE" - alpha_3_code="VEN" - numeric_code="862" - common_name="Venezuela" - name="Venezuela, Bolivarian republic of" - official_name="Bolivarian Republic of Venezuela"/> - <iso_3166_entry - alpha_2_code="VN" - alpha_3_code="VNM" - numeric_code="704" - name="Viet Nam" - official_name="Socialist Republic of Viet Nam"/> - <!-- FIXME CHECK OFFICIAL NAME --> - <iso_3166_entry - alpha_2_code="VG" - alpha_3_code="VGB" - numeric_code="092" - name="Virgin Islands, British" - official_name="British Virgin Islands"/> - <iso_3166_entry - alpha_2_code="VI" - alpha_3_code="VIR" - numeric_code="850" - name="Virgin Islands, U.S." - official_name="Virgin Islands of the United States"/> - <iso_3166_entry - alpha_2_code="WF" - alpha_3_code="WLF" - numeric_code="876" - name="Wallis and Futuna"/> - <iso_3166_entry - alpha_2_code="EH" - alpha_3_code="ESH" - numeric_code="732" - name="Western Sahara"/> - <iso_3166_entry - alpha_2_code="YE" - alpha_3_code="YEM" - numeric_code="887" - name="Yemen" - official_name="Republic of Yemen"/> - <iso_3166_entry - alpha_2_code="ZM" - alpha_3_code="ZMB" - numeric_code="894" - name="Zambia" - official_name="Republic of Zambia"/> - <iso_3166_entry - alpha_2_code="ZW" - alpha_3_code="ZWE" - numeric_code="716" - name="Zimbabwe" - official_name="Republic of Zimbabwe"/> - <iso_3166_3_entry - alpha_4_code="BQAQ" - alpha_3_code="ATB" - date_withdrawn="1979" - names="British Antarctic Territory"/> - <iso_3166_3_entry - alpha_4_code="BUMM" - alpha_3_code="BUR" - numeric_code="104" - date_withdrawn="1989-12-05" - names="Burma, Socialist Republic of the Union of"/> - <iso_3166_3_entry - alpha_4_code="BYAA" - alpha_3_code="BYS" - numeric_code="112" - date_withdrawn="1992-06-15" - names="Byelorussian SSR Soviet Socialist Republic"/> - <iso_3166_3_entry - alpha_4_code="CTKI" - alpha_3_code="CTE" - numeric_code="128" - date_withdrawn="1984" - names="Canton and Enderbury Islands"/> - <iso_3166_3_entry - alpha_4_code="CSHH" - alpha_3_code="CSK" - numeric_code="200" - date_withdrawn="1993-06-15" - names="Czechoslovakia, Czechoslovak Socialist Republic"/> - <iso_3166_3_entry - alpha_4_code="DYBJ" - alpha_3_code="DHY" - numeric_code="204" - date_withdrawn="1977" - names="Dahomey"/> - <iso_3166_3_entry - alpha_4_code="NQAQ" - alpha_3_code="ATN" - numeric_code="216" - date_withdrawn="1983" - names="Dronning Maud Land"/> - <iso_3166_3_entry - alpha_4_code="TPTL" - alpha_3_code="TMP" - numeric_code="626" - date_withdrawn="2002-05-20" - names="East Timor" - comment="was Portuguese Timor"/> - <iso_3166_3_entry - alpha_4_code="ET" - alpha_3_code="ETH" - numeric_code="230" - date_withdrawn="1993-07-16" - names="Ethiopia"/> - <iso_3166_3_entry - alpha_4_code="FXFR" - alpha_3_code="FXX" - numeric_code="249" - date_withdrawn="1997-07-14" - names="France, Metropolitan"/> - <iso_3166_3_entry - alpha_4_code="AIDJ" - alpha_3_code="AFI" - numeric_code="262" - date_withdrawn="1977" - names="French Afars and Issas"/> - <iso_3166_3_entry - alpha_4_code="FQHH" - alpha_3_code="ATF" - date_withdrawn="1979" - names="French Southern and Antarctic Territories" - comment="now split between AQ and TF"/> - <iso_3166_3_entry - alpha_4_code="DDDE" - alpha_3_code="DDR" - numeric_code="278" - date_withdrawn="1990-10-30" - names="German Democratic Republic"/> - <iso_3166_3_entry - alpha_4_code="DE" - alpha_3_code="DEU" - numeric_code="280" - date_withdrawn="1990-10-30" - names="Germany, Federal Republic of"/> - <iso_3166_3_entry - alpha_4_code="GEHH" - alpha_3_code="GEL" - numeric_code="296" - date_withdrawn="1979" - names="Gilbert and Ellice Islands" - comment="now split into Kiribati and Tuvalu"/> - <iso_3166_3_entry - alpha_4_code="JTUM" - alpha_3_code="JTN" - numeric_code="396" - date_withdrawn="1986" - names="Johnston Island"/> - <iso_3166_3_entry - alpha_4_code="MIUM" - alpha_3_code="MID" - numeric_code="488" - date_withdrawn="1986" - names="Midway Islands"/> - <iso_3166_3_entry - alpha_4_code="AN" - alpha_3_code="ANT" - numeric_code="532" - date_withdrawn="1993-07-12" - names="Netherlands Antilles"/> - <iso_3166_3_entry - alpha_4_code="NTHH" - alpha_3_code="NTZ" - numeric_code="536" - date_withdrawn="1993-07-12" - names="Neutral Zone" - comment="formerly between Saudi Arabia and Iraq"/> - <iso_3166_3_entry - alpha_4_code="NHVU" - alpha_3_code="NHB" - numeric_code="548" - date_withdrawn="1980" - names="New Hebrides"/> - <iso_3166_3_entry - alpha_4_code="PCHH" - alpha_3_code="PCI" - numeric_code="582" - date_withdrawn="1986" - names="Pacific Islands (trust territory)" - comment="divided into FM, MH, MP, and PW"/> - <iso_3166_3_entry - alpha_4_code="PA" - alpha_3_code="PAN" - numeric_code="590" - date_withdrawn="1993-07-22" - names="Panama, Republic of"/> - <iso_3166_3_entry - alpha_4_code="PZPA" - alpha_3_code="PCZ" - date_withdrawn="1980" - names="Panama Canal Zone"/> - <iso_3166_3_entry - alpha_4_code="RO" - alpha_3_code="ROM" - numeric_code="642" - date_withdrawn="2002-02-01" - names="Romania, Socialist Republic of"/> - <iso_3166_3_entry - alpha_4_code="KN" - alpha_3_code="KNA" - numeric_code="658" - date_withdrawn="1988" - names="St. Kitts-Nevis-Anguilla" - comment="now St. Kitts and Nevis and Anguilla"/> - <iso_3166_3_entry - alpha_4_code="CSXX" - alpha_3_code="SCG" - numeric_code="891" - date_withdrawn="2006-06-05" - names="Serbia and Montenegro"/> - <iso_3166_3_entry - alpha_4_code="SKIN" - alpha_3_code="SKM" - date_withdrawn="1975" - names="Sikkim"/> - <iso_3166_3_entry - alpha_4_code="RHZW" - alpha_3_code="RHO" - numeric_code="716" - date_withdrawn="1980" - names="Southern Rhodesia"/> - <iso_3166_3_entry - alpha_4_code="EH" - alpha_3_code="ESH" - numeric_code="732" - date_withdrawn="1988" - names="Spanish Sahara" - comment="now Western Sahara"/> - <iso_3166_3_entry - alpha_4_code="PUUM" - alpha_3_code="PUS" - numeric_code="849" - date_withdrawn="1986" - names="US Miscellaneous Pacific Islands"/> - <iso_3166_3_entry - alpha_4_code="SUHH" - alpha_3_code="SUN" - numeric_code="810" - date_withdrawn="1992-08-30" - names="USSR, Union of Soviet Socialist Republics"/> - <iso_3166_3_entry - alpha_4_code="HVBF" - alpha_3_code="HVO" - numeric_code="854" - date_withdrawn="1984" - names="Upper Volta, Republic of"/> - <iso_3166_3_entry - alpha_4_code="VA" - alpha_3_code="VAT" - numeric_code="336" - date_withdrawn="1996-04-03" - names="Vatican City State (Holy See)"/> - <iso_3166_3_entry - alpha_4_code="VDVN" - alpha_3_code="VDR" - date_withdrawn="1977" - names="Viet-Nam, Democratic Republic of"/> - <iso_3166_3_entry - alpha_4_code="WKUM" - alpha_3_code="WAK" - numeric_code="872" - date_withdrawn="1986" - names="Wake Island"/> - <iso_3166_3_entry - alpha_4_code="YDYE" - alpha_3_code="YMD" - numeric_code="720" - date_withdrawn="1990-08-14" - names="Yemen, Democratic, People's Democratic Republic of"/> - <iso_3166_3_entry - alpha_4_code="YE" - alpha_3_code="YEM" - numeric_code="891" - date_withdrawn="1990-08-14" - names="Yemen, Yemen Arab Republic"/> - <iso_3166_3_entry - alpha_4_code="YUCS" - alpha_3_code="YUG" - numeric_code="891" - date_withdrawn="1993-07-28" - names="Yugoslavia, Socialist Federal Republic of"/> - <iso_3166_3_entry - alpha_4_code="ZRCD" - alpha_3_code="ZAR" - numeric_code="180" - date_withdrawn="1997-07-14" - names="Zaire, Republic of"/> + <iso_3166_entry + alpha_2_code="AF" + alpha_3_code="AFG" + numeric_code="004" + name="Afghanistan" + official_name="Islamic Republic of Afghanistan"/> + <iso_3166_entry + alpha_2_code="AX" + alpha_3_code="ALA" + numeric_code="248" + name="Åland Islands"/> + <iso_3166_entry + alpha_2_code="AL" + alpha_3_code="ALB" + numeric_code="008" + name="Albania" + official_name="Republic of Albania"/> + <iso_3166_entry + alpha_2_code="DZ" + alpha_3_code="DZA" + numeric_code="012" + name="Algeria" + official_name="People's Democratic Republic of Algeria"/> + <iso_3166_entry + alpha_2_code="AS" + alpha_3_code="ASM" + numeric_code="016" + name="American Samoa"/> + <iso_3166_entry + alpha_2_code="AD" + alpha_3_code="AND" + numeric_code="020" + name="Andorra" + official_name="Principality of Andorra"/> + <iso_3166_entry + alpha_2_code="AO" + alpha_3_code="AGO" + numeric_code="024" + name="Angola" + official_name="Republic of Angola"/> + <iso_3166_entry + alpha_2_code="AI" + alpha_3_code="AIA" + numeric_code="660" + name="Anguilla"/> + <iso_3166_entry + alpha_2_code="AQ" + alpha_3_code="ATA" + numeric_code="010" + name="Antarctica"/> + <iso_3166_entry + alpha_2_code="AG" + alpha_3_code="ATG" + numeric_code="028" + name="Antigua and Barbuda"/> + <iso_3166_entry + alpha_2_code="AR" + alpha_3_code="ARG" + numeric_code="032" + name="Argentina" + official_name="Argentine Republic"/> + <iso_3166_entry + alpha_2_code="AM" + alpha_3_code="ARM" + numeric_code="051" + name="Armenia" + official_name="Republic of Armenia"/> + <iso_3166_entry + alpha_2_code="AW" + alpha_3_code="ABW" + numeric_code="533" + name="Aruba"/> + <iso_3166_entry + alpha_2_code="AU" + alpha_3_code="AUS" + numeric_code="036" + name="Australia"/> + <iso_3166_entry + alpha_2_code="AT" + alpha_3_code="AUT" + numeric_code="040" + name="Austria" + official_name="Republic of Austria"/> + <iso_3166_entry + alpha_2_code="AZ" + alpha_3_code="AZE" + numeric_code="031" + name="Azerbaijan" + official_name="Republic of Azerbaijan"/> + <iso_3166_entry + alpha_2_code="BS" + alpha_3_code="BHS" + numeric_code="044" + name="Bahamas" + official_name="Commonwealth of the Bahamas"/> + <iso_3166_entry + alpha_2_code="BH" + alpha_3_code="BHR" + numeric_code="048" + name="Bahrain" + official_name="Kingdom of Bahrain"/> + <iso_3166_entry + alpha_2_code="BD" + alpha_3_code="BGD" + numeric_code="050" + name="Bangladesh" + official_name="People's Republic of Bangladesh"/> + <iso_3166_entry + alpha_2_code="BB" + alpha_3_code="BRB" + numeric_code="052" + name="Barbados"/> + <iso_3166_entry + alpha_2_code="BY" + alpha_3_code="BLR" + numeric_code="112" + name="Belarus" + official_name="Republic of Belarus"/> + <iso_3166_entry + alpha_2_code="BE" + alpha_3_code="BEL" + numeric_code="056" + name="Belgium" + official_name="Kingdom of Belgium"/> + <iso_3166_entry + alpha_2_code="BZ" + alpha_3_code="BLZ" + numeric_code="084" + name="Belize"/> + <iso_3166_entry + alpha_2_code="BJ" + alpha_3_code="BEN" + numeric_code="204" + name="Benin" + official_name="Republic of Benin"/> + <iso_3166_entry + alpha_2_code="BM" + alpha_3_code="BMU" + numeric_code="060" + name="Bermuda"/> + <iso_3166_entry + alpha_2_code="BT" + alpha_3_code="BTN" + numeric_code="064" + name="Bhutan" + official_name="Kingdom of Bhutan"/> + <iso_3166_entry + alpha_2_code="BO" + alpha_3_code="BOL" + numeric_code="068" + common_name="Bolivia" + name="Bolivia, Plurinational State of" + official_name="Plurinational State of Bolivia"/> + <iso_3166_entry + alpha_2_code="BQ" + alpha_3_code="BES" + numeric_code="535" + name="Bonaire, Saint Eustatius and Saba" + official_name="Bonaire, Saint Eustatius and Saba"/> + <iso_3166_entry + alpha_2_code="BA" + alpha_3_code="BIH" + numeric_code="070" + name="Bosnia and Herzegovina" + official_name="Republic of Bosnia and Herzegovina"/> + <iso_3166_entry + alpha_2_code="BW" + alpha_3_code="BWA" + numeric_code="072" + name="Botswana" + official_name="Republic of Botswana"/> + <iso_3166_entry + alpha_2_code="BV" + alpha_3_code="BVT" + numeric_code="074" + name="Bouvet Island"/> + <iso_3166_entry + alpha_2_code="BR" + alpha_3_code="BRA" + numeric_code="076" + name="Brazil" + official_name="Federative Republic of Brazil"/> + <iso_3166_entry + alpha_2_code="IO" + alpha_3_code="IOT" + numeric_code="086" + name="British Indian Ocean Territory"/> + <iso_3166_entry + alpha_2_code="BN" + alpha_3_code="BRN" + numeric_code="096" + name="Brunei Darussalam"/> + <iso_3166_entry + alpha_2_code="BG" + alpha_3_code="BGR" + numeric_code="100" + name="Bulgaria" + official_name="Republic of Bulgaria"/> + <iso_3166_entry + alpha_2_code="BF" + alpha_3_code="BFA" + numeric_code="854" + name="Burkina Faso"/> + <iso_3166_entry + alpha_2_code="BI" + alpha_3_code="BDI" + numeric_code="108" + name="Burundi" + official_name="Republic of Burundi"/> + <iso_3166_entry + alpha_2_code="KH" + alpha_3_code="KHM" + numeric_code="116" + name="Cambodia" + official_name="Kingdom of Cambodia"/> + <iso_3166_entry + alpha_2_code="CM" + alpha_3_code="CMR" + numeric_code="120" + name="Cameroon" + official_name="Republic of Cameroon"/> + <iso_3166_entry + alpha_2_code="CA" + alpha_3_code="CAN" + numeric_code="124" + name="Canada"/> + <iso_3166_entry + alpha_2_code="CV" + alpha_3_code="CPV" + numeric_code="132" + name="Cape Verde" + official_name="Republic of Cape Verde"/> + <iso_3166_entry + alpha_2_code="KY" + alpha_3_code="CYM" + numeric_code="136" + name="Cayman Islands"/> + <iso_3166_entry + alpha_2_code="CF" + alpha_3_code="CAF" + numeric_code="140" + name="Central African Republic"/> + <iso_3166_entry + alpha_2_code="TD" + alpha_3_code="TCD" + numeric_code="148" + name="Chad" + official_name="Republic of Chad"/> + <iso_3166_entry + alpha_2_code="CL" + alpha_3_code="CHL" + numeric_code="152" + name="Chile" + official_name="Republic of Chile"/> + <iso_3166_entry + alpha_2_code="CN" + alpha_3_code="CHN" + numeric_code="156" + name="China" + official_name="People's Republic of China"/> + <iso_3166_entry + alpha_2_code="CX" + alpha_3_code="CXR" + numeric_code="162" + name="Christmas Island"/> + <iso_3166_entry + alpha_2_code="CC" + alpha_3_code="CCK" + numeric_code="166" + name="Cocos (Keeling) Islands"/> + <iso_3166_entry + alpha_2_code="CO" + alpha_3_code="COL" + numeric_code="170" + name="Colombia" + official_name="Republic of Colombia"/> + <iso_3166_entry + alpha_2_code="KM" + alpha_3_code="COM" + numeric_code="174" + name="Comoros" + official_name="Union of the Comoros"/> + <iso_3166_entry + alpha_2_code="CG" + alpha_3_code="COG" + numeric_code="178" + name="Congo" + official_name="Republic of the Congo"/> + <iso_3166_entry + alpha_2_code="CD" + alpha_3_code="COD" + numeric_code="180" + name="Congo, The Democratic Republic of the"/> + <iso_3166_entry + alpha_2_code="CK" + alpha_3_code="COK" + numeric_code="184" + name="Cook Islands"/> + <iso_3166_entry + alpha_2_code="CR" + alpha_3_code="CRI" + numeric_code="188" + name="Costa Rica" + official_name="Republic of Costa Rica"/> + <iso_3166_entry + alpha_2_code="CI" + alpha_3_code="CIV" + numeric_code="384" + name="Côte d'Ivoire" + official_name="Republic of Côte d'Ivoire"/> + <iso_3166_entry + alpha_2_code="HR" + alpha_3_code="HRV" + numeric_code="191" + name="Croatia" + official_name="Republic of Croatia"/> + <iso_3166_entry + alpha_2_code="CU" + alpha_3_code="CUB" + numeric_code="192" + name="Cuba" + official_name="Republic of Cuba"/> + <iso_3166_entry + alpha_2_code="CW" + alpha_3_code="CUW" + numeric_code="531" + name="Curaçao" + official_name="Curaçao"/> + <iso_3166_entry + alpha_2_code="CY" + alpha_3_code="CYP" + numeric_code="196" + name="Cyprus" + official_name="Republic of Cyprus"/> + <iso_3166_entry + alpha_2_code="CZ" + alpha_3_code="CZE" + numeric_code="203" + name="Czech Republic"/> + <iso_3166_entry + alpha_2_code="DK" + alpha_3_code="DNK" + numeric_code="208" + name="Denmark" + official_name="Kingdom of Denmark"/> + <iso_3166_entry + alpha_2_code="DJ" + alpha_3_code="DJI" + numeric_code="262" + name="Djibouti" + official_name="Republic of Djibouti"/> + <iso_3166_entry + alpha_2_code="DM" + alpha_3_code="DMA" + numeric_code="212" + name="Dominica" + official_name="Commonwealth of Dominica"/> + <iso_3166_entry + alpha_2_code="DO" + alpha_3_code="DOM" + numeric_code="214" + name="Dominican Republic"/> + <iso_3166_entry + alpha_2_code="EC" + alpha_3_code="ECU" + numeric_code="218" + name="Ecuador" + official_name="Republic of Ecuador"/> + <iso_3166_entry + alpha_2_code="EG" + alpha_3_code="EGY" + numeric_code="818" + name="Egypt" + official_name="Arab Republic of Egypt"/> + <iso_3166_entry + alpha_2_code="SV" + alpha_3_code="SLV" + numeric_code="222" + name="El Salvador" + official_name="Republic of El Salvador"/> + <iso_3166_entry + alpha_2_code="GQ" + alpha_3_code="GNQ" + numeric_code="226" + name="Equatorial Guinea" + official_name="Republic of Equatorial Guinea"/> + <iso_3166_entry + alpha_2_code="ER" + alpha_3_code="ERI" + numeric_code="232" + name="Eritrea"/> + <iso_3166_entry + alpha_2_code="EE" + alpha_3_code="EST" + numeric_code="233" + name="Estonia" + official_name="Republic of Estonia"/> + <iso_3166_entry + alpha_2_code="ET" + alpha_3_code="ETH" + numeric_code="231" + name="Ethiopia" + official_name="Federal Democratic Republic of Ethiopia"/> + <iso_3166_entry + alpha_2_code="FK" + alpha_3_code="FLK" + numeric_code="238" + name="Falkland Islands (Malvinas)"/> + <iso_3166_entry + alpha_2_code="FO" + alpha_3_code="FRO" + numeric_code="234" + name="Faroe Islands"/> + <iso_3166_entry + alpha_2_code="FJ" + alpha_3_code="FJI" + numeric_code="242" + name="Fiji" + official_name="Republic of the Fiji Islands"/> + <iso_3166_entry + alpha_2_code="FI" + alpha_3_code="FIN" + numeric_code="246" + name="Finland" + official_name="Republic of Finland"/> + <iso_3166_entry + alpha_2_code="FR" + alpha_3_code="FRA" + numeric_code="250" + name="France" + official_name="French Republic"/> + <iso_3166_entry + alpha_2_code="GF" + alpha_3_code="GUF" + numeric_code="254" + name="French Guiana"/> + <iso_3166_entry + alpha_2_code="PF" + alpha_3_code="PYF" + numeric_code="258" + name="French Polynesia"/> + <iso_3166_entry + alpha_2_code="TF" + alpha_3_code="ATF" + numeric_code="260" + name="French Southern Territories"/> + <iso_3166_entry + alpha_2_code="GA" + alpha_3_code="GAB" + numeric_code="266" + name="Gabon" + official_name="Gabonese Republic"/> + <iso_3166_entry + alpha_2_code="GM" + alpha_3_code="GMB" + numeric_code="270" + name="Gambia" + official_name="Republic of the Gambia"/> + <iso_3166_entry + alpha_2_code="GE" + alpha_3_code="GEO" + numeric_code="268" + name="Georgia"/> + <iso_3166_entry + alpha_2_code="DE" + alpha_3_code="DEU" + numeric_code="276" + name="Germany" + official_name="Federal Republic of Germany"/> + <iso_3166_entry + alpha_2_code="GH" + alpha_3_code="GHA" + numeric_code="288" + name="Ghana" + official_name="Republic of Ghana"/> + <iso_3166_entry + alpha_2_code="GI" + alpha_3_code="GIB" + numeric_code="292" + name="Gibraltar"/> + <iso_3166_entry + alpha_2_code="GR" + alpha_3_code="GRC" + numeric_code="300" + name="Greece" + official_name="Hellenic Republic"/> + <iso_3166_entry + alpha_2_code="GL" + alpha_3_code="GRL" + numeric_code="304" + name="Greenland"/> + <iso_3166_entry + alpha_2_code="GD" + alpha_3_code="GRD" + numeric_code="308" + name="Grenada"/> + <iso_3166_entry + alpha_2_code="GP" + alpha_3_code="GLP" + numeric_code="312" + name="Guadeloupe"/> + <iso_3166_entry + alpha_2_code="GU" + alpha_3_code="GUM" + numeric_code="316" + name="Guam"/> + <iso_3166_entry + alpha_2_code="GT" + alpha_3_code="GTM" + numeric_code="320" + name="Guatemala" + official_name="Republic of Guatemala"/> + <iso_3166_entry + alpha_2_code="GG" + alpha_3_code="GGY" + numeric_code="831" + name="Guernsey"/> + <iso_3166_entry + alpha_2_code="GN" + alpha_3_code="GIN" + numeric_code="324" + name="Guinea" + official_name="Republic of Guinea"/> + <iso_3166_entry + alpha_2_code="GW" + alpha_3_code="GNB" + numeric_code="624" + name="Guinea-Bissau" + official_name="Republic of Guinea-Bissau"/> + <iso_3166_entry + alpha_2_code="GY" + alpha_3_code="GUY" + numeric_code="328" + name="Guyana" + official_name="Republic of Guyana"/> + <iso_3166_entry + alpha_2_code="HT" + alpha_3_code="HTI" + numeric_code="332" + name="Haiti" + official_name="Republic of Haiti"/> + <iso_3166_entry + alpha_2_code="HM" + alpha_3_code="HMD" + numeric_code="334" + name="Heard Island and McDonald Islands"/> + <iso_3166_entry + alpha_2_code="VA" + alpha_3_code="VAT" + numeric_code="336" + name="Holy See (Vatican City State)"/> + <iso_3166_entry + alpha_2_code="HN" + alpha_3_code="HND" + numeric_code="340" + name="Honduras" + official_name="Republic of Honduras"/> + <iso_3166_entry + alpha_2_code="HK" + alpha_3_code="HKG" + numeric_code="344" + name="Hong Kong" + official_name="Hong Kong Special Administrative Region of China"/> + <iso_3166_entry + alpha_2_code="HU" + alpha_3_code="HUN" + numeric_code="348" + name="Hungary" + official_name="Republic of Hungary"/> + <iso_3166_entry + alpha_2_code="IS" + alpha_3_code="ISL" + numeric_code="352" + name="Iceland" + official_name="Republic of Iceland"/> + <iso_3166_entry + alpha_2_code="IN" + alpha_3_code="IND" + numeric_code="356" + name="India" + official_name="Republic of India"/> + <iso_3166_entry + alpha_2_code="ID" + alpha_3_code="IDN" + numeric_code="360" + name="Indonesia" + official_name="Republic of Indonesia"/> + <iso_3166_entry + alpha_2_code="IR" + alpha_3_code="IRN" + numeric_code="364" + name="Iran, Islamic Republic of" + official_name="Islamic Republic of Iran"/> + <iso_3166_entry + alpha_2_code="IQ" + alpha_3_code="IRQ" + numeric_code="368" + name="Iraq" + official_name="Republic of Iraq"/> + <iso_3166_entry + alpha_2_code="IE" + alpha_3_code="IRL" + numeric_code="372" + name="Ireland"/> + <iso_3166_entry + alpha_2_code="IM" + alpha_3_code="IMN" + numeric_code="833" + name="Isle of Man"/> + <iso_3166_entry + alpha_2_code="IL" + alpha_3_code="ISR" + numeric_code="376" + name="Israel" + official_name="State of Israel"/> + <iso_3166_entry + alpha_2_code="IT" + alpha_3_code="ITA" + numeric_code="380" + name="Italy" + official_name="Italian Republic"/> + <iso_3166_entry + alpha_2_code="JM" + alpha_3_code="JAM" + numeric_code="388" + name="Jamaica"/> + <iso_3166_entry + alpha_2_code="JP" + alpha_3_code="JPN" + numeric_code="392" + name="Japan"/> + <iso_3166_entry + alpha_2_code="JE" + alpha_3_code="JEY" + numeric_code="832" + name="Jersey"/> + <iso_3166_entry + alpha_2_code="JO" + alpha_3_code="JOR" + numeric_code="400" + name="Jordan" + official_name="Hashemite Kingdom of Jordan"/> + <iso_3166_entry + alpha_2_code="KZ" + alpha_3_code="KAZ" + numeric_code="398" + name="Kazakhstan" + official_name="Republic of Kazakhstan"/> + <iso_3166_entry + alpha_2_code="KE" + alpha_3_code="KEN" + numeric_code="404" + name="Kenya" + official_name="Republic of Kenya"/> + <iso_3166_entry + alpha_2_code="KI" + alpha_3_code="KIR" + numeric_code="296" + name="Kiribati" + official_name="Republic of Kiribati"/> + <iso_3166_entry + alpha_2_code="KP" + alpha_3_code="PRK" + numeric_code="408" + name="Korea, Democratic People's Republic of" + official_name="Democratic People's Republic of Korea"/> + <iso_3166_entry + alpha_2_code="KR" + alpha_3_code="KOR" + numeric_code="410" + name="Korea, Republic of"/> + <iso_3166_entry + alpha_2_code="KW" + alpha_3_code="KWT" + numeric_code="414" + name="Kuwait" + official_name="State of Kuwait"/> + <iso_3166_entry + alpha_2_code="KG" + alpha_3_code="KGZ" + numeric_code="417" + name="Kyrgyzstan" + official_name="Kyrgyz Republic"/> + <iso_3166_entry + alpha_2_code="LA" + alpha_3_code="LAO" + numeric_code="418" + name="Lao People's Democratic Republic"/> + <iso_3166_entry + alpha_2_code="LV" + alpha_3_code="LVA" + numeric_code="428" + name="Latvia" + official_name="Republic of Latvia"/> + <iso_3166_entry + alpha_2_code="LB" + alpha_3_code="LBN" + numeric_code="422" + name="Lebanon" + official_name="Lebanese Republic"/> + <iso_3166_entry + alpha_2_code="LS" + alpha_3_code="LSO" + numeric_code="426" + name="Lesotho" + official_name="Kingdom of Lesotho"/> + <iso_3166_entry + alpha_2_code="LR" + alpha_3_code="LBR" + numeric_code="430" + name="Liberia" + official_name="Republic of Liberia"/> + <iso_3166_entry + alpha_2_code="LY" + alpha_3_code="LBY" + numeric_code="434" + common_name="Libya" + name="Libyan Arab Jamahiriya" + official_name="Socialist People's Libyan Arab Jamahiriya"/> + <iso_3166_entry + alpha_2_code="LI" + alpha_3_code="LIE" + numeric_code="438" + name="Liechtenstein" + official_name="Principality of Liechtenstein"/> + <iso_3166_entry + alpha_2_code="LT" + alpha_3_code="LTU" + numeric_code="440" + name="Lithuania" + official_name="Republic of Lithuania"/> + <iso_3166_entry + alpha_2_code="LU" + alpha_3_code="LUX" + numeric_code="442" + name="Luxembourg" + official_name="Grand Duchy of Luxembourg"/> + <iso_3166_entry + alpha_2_code="MO" + alpha_3_code="MAC" + numeric_code="446" + name="Macao" + official_name="Macao Special Administrative Region of China"/> + <iso_3166_entry + alpha_2_code="MK" + alpha_3_code="MKD" + numeric_code="807" + name="Macedonia, Republic of" + official_name="The Former Yugoslav Republic of Macedonia"/> + <iso_3166_entry + alpha_2_code="MG" + alpha_3_code="MDG" + numeric_code="450" + name="Madagascar" + official_name="Republic of Madagascar"/> + <iso_3166_entry + alpha_2_code="MW" + alpha_3_code="MWI" + numeric_code="454" + name="Malawi" + official_name="Republic of Malawi"/> + <iso_3166_entry + alpha_2_code="MY" + alpha_3_code="MYS" + numeric_code="458" + name="Malaysia"/> + <iso_3166_entry + alpha_2_code="MV" + alpha_3_code="MDV" + numeric_code="462" + name="Maldives" + official_name="Republic of Maldives"/> + <iso_3166_entry + alpha_2_code="ML" + alpha_3_code="MLI" + numeric_code="466" + name="Mali" + official_name="Republic of Mali"/> + <iso_3166_entry + alpha_2_code="MT" + alpha_3_code="MLT" + numeric_code="470" + name="Malta" + official_name="Republic of Malta"/> + <iso_3166_entry + alpha_2_code="MH" + alpha_3_code="MHL" + numeric_code="584" + name="Marshall Islands" + official_name="Republic of the Marshall Islands"/> + <iso_3166_entry + alpha_2_code="MQ" + alpha_3_code="MTQ" + numeric_code="474" + name="Martinique"/> + <iso_3166_entry + alpha_2_code="MR" + alpha_3_code="MRT" + numeric_code="478" + name="Mauritania" + official_name="Islamic Republic of Mauritania"/> + <iso_3166_entry + alpha_2_code="MU" + alpha_3_code="MUS" + numeric_code="480" + name="Mauritius" + official_name="Republic of Mauritius"/> + <iso_3166_entry + alpha_2_code="YT" + alpha_3_code="MYT" + numeric_code="175" + name="Mayotte"/> + <iso_3166_entry + alpha_2_code="MX" + alpha_3_code="MEX" + numeric_code="484" + name="Mexico" + official_name="United Mexican States"/> + <iso_3166_entry + alpha_2_code="FM" + alpha_3_code="FSM" + numeric_code="583" + name="Micronesia, Federated States of" + official_name="Federated States of Micronesia"/> + <iso_3166_entry + alpha_2_code="MD" + alpha_3_code="MDA" + numeric_code="498" + common_name="Moldova" + name="Moldova, Republic of" + official_name="Republic of Moldova"/> + <iso_3166_entry + alpha_2_code="MC" + alpha_3_code="MCO" + numeric_code="492" + name="Monaco" + official_name="Principality of Monaco"/> + <iso_3166_entry + alpha_2_code="MN" + alpha_3_code="MNG" + numeric_code="496" + name="Mongolia"/> + <iso_3166_entry + alpha_2_code="ME" + alpha_3_code="MNE" + numeric_code="499" + name="Montenegro" + official_name="Montenegro"/> + <iso_3166_entry + alpha_2_code="MS" + alpha_3_code="MSR" + numeric_code="500" + name="Montserrat"/> + <iso_3166_entry + alpha_2_code="MA" + alpha_3_code="MAR" + numeric_code="504" + name="Morocco" + official_name="Kingdom of Morocco"/> + <iso_3166_entry + alpha_2_code="MZ" + alpha_3_code="MOZ" + numeric_code="508" + name="Mozambique" + official_name="Republic of Mozambique"/> + <iso_3166_entry + alpha_2_code="MM" + alpha_3_code="MMR" + numeric_code="104" + name="Myanmar" + official_name="Union of Myanmar"/> + <iso_3166_entry + alpha_2_code="NA" + alpha_3_code="NAM" + numeric_code="516" + name="Namibia" + official_name="Republic of Namibia"/> + <iso_3166_entry + alpha_2_code="NR" + alpha_3_code="NRU" + numeric_code="520" + name="Nauru" + official_name="Republic of Nauru"/> + <iso_3166_entry + alpha_2_code="NP" + alpha_3_code="NPL" + numeric_code="524" + name="Nepal" + official_name="Federal Democratic Republic of Nepal"/> + <iso_3166_entry + alpha_2_code="NL" + alpha_3_code="NLD" + numeric_code="528" + name="Netherlands" + official_name="Kingdom of the Netherlands"/> + <iso_3166_entry + alpha_2_code="NC" + alpha_3_code="NCL" + numeric_code="540" + name="New Caledonia"/> + <iso_3166_entry + alpha_2_code="NZ" + alpha_3_code="NZL" + numeric_code="554" + name="New Zealand"/> + <iso_3166_entry + alpha_2_code="NI" + alpha_3_code="NIC" + numeric_code="558" + name="Nicaragua" + official_name="Republic of Nicaragua"/> + <iso_3166_entry + alpha_2_code="NE" + alpha_3_code="NER" + numeric_code="562" + name="Niger" + official_name="Republic of the Niger"/> + <iso_3166_entry + alpha_2_code="NG" + alpha_3_code="NGA" + numeric_code="566" + name="Nigeria" + official_name="Federal Republic of Nigeria"/> + <iso_3166_entry + alpha_2_code="NU" + alpha_3_code="NIU" + numeric_code="570" + name="Niue" + official_name="Republic of Niue"/> + <iso_3166_entry + alpha_2_code="NF" + alpha_3_code="NFK" + numeric_code="574" + name="Norfolk Island"/> + <iso_3166_entry + alpha_2_code="MP" + alpha_3_code="MNP" + numeric_code="580" + name="Northern Mariana Islands" + official_name="Commonwealth of the Northern Mariana Islands"/> + <iso_3166_entry + alpha_2_code="NO" + alpha_3_code="NOR" + numeric_code="578" + name="Norway" + official_name="Kingdom of Norway"/> + <iso_3166_entry + alpha_2_code="OM" + alpha_3_code="OMN" + numeric_code="512" + name="Oman" + official_name="Sultanate of Oman"/> + <iso_3166_entry + alpha_2_code="PK" + alpha_3_code="PAK" + numeric_code="586" + name="Pakistan" + official_name="Islamic Republic of Pakistan"/> + <iso_3166_entry + alpha_2_code="PW" + alpha_3_code="PLW" + numeric_code="585" + name="Palau" + official_name="Republic of Palau"/> + <iso_3166_entry + alpha_2_code="PS" + alpha_3_code="PSE" + numeric_code="275" + name="Palestinian Territory, Occupied" + official_name="Occupied Palestinian Territory"/> + <iso_3166_entry + alpha_2_code="PA" + alpha_3_code="PAN" + numeric_code="591" + name="Panama" + official_name="Republic of Panama"/> + <iso_3166_entry + alpha_2_code="PG" + alpha_3_code="PNG" + numeric_code="598" + name="Papua New Guinea"/> + <iso_3166_entry + alpha_2_code="PY" + alpha_3_code="PRY" + numeric_code="600" + name="Paraguay" + official_name="Republic of Paraguay"/> + <iso_3166_entry + alpha_2_code="PE" + alpha_3_code="PER" + numeric_code="604" + name="Peru" + official_name="Republic of Peru"/> + <iso_3166_entry + alpha_2_code="PH" + alpha_3_code="PHL" + numeric_code="608" + name="Philippines" + official_name="Republic of the Philippines"/> + <iso_3166_entry + alpha_2_code="PN" + alpha_3_code="PCN" + numeric_code="612" + name="Pitcairn"/> + <iso_3166_entry + alpha_2_code="PL" + alpha_3_code="POL" + numeric_code="616" + name="Poland" + official_name="Republic of Poland"/> + <iso_3166_entry + alpha_2_code="PT" + alpha_3_code="PRT" + numeric_code="620" + name="Portugal" + official_name="Portuguese Republic"/> + <iso_3166_entry + alpha_2_code="PR" + alpha_3_code="PRI" + numeric_code="630" + name="Puerto Rico"/> + <iso_3166_entry + alpha_2_code="QA" + alpha_3_code="QAT" + numeric_code="634" + name="Qatar" + official_name="State of Qatar"/> + <iso_3166_entry + alpha_2_code="RE" + alpha_3_code="REU" + numeric_code="638" + name="Reunion"/> + <iso_3166_entry + alpha_2_code="RO" + alpha_3_code="ROU" + numeric_code="642" + name="Romania"/> + <iso_3166_entry + alpha_2_code="RU" + alpha_3_code="RUS" + numeric_code="643" + name="Russian Federation"/> + <iso_3166_entry + alpha_2_code="RW" + alpha_3_code="RWA" + numeric_code="646" + name="Rwanda" + official_name="Rwandese Republic"/> + <iso_3166_entry + alpha_2_code="BL" + alpha_3_code="BLM" + numeric_code="652" + name="Saint Barthélemy"/> + <iso_3166_entry + alpha_2_code="SH" + alpha_3_code="SHN" + numeric_code="654" + name="Saint Helena, Ascension and Tristan da Cunha"/> + <iso_3166_entry + alpha_2_code="KN" + alpha_3_code="KNA" + numeric_code="659" + name="Saint Kitts and Nevis"/> + <iso_3166_entry + alpha_2_code="LC" + alpha_3_code="LCA" + numeric_code="662" + name="Saint Lucia"/> + <iso_3166_entry + alpha_2_code="MF" + alpha_3_code="MAF" + numeric_code="663" + name="Saint Martin (French part)"/> + <iso_3166_entry + alpha_2_code="PM" + alpha_3_code="SPM" + numeric_code="666" + name="Saint Pierre and Miquelon"/> + <iso_3166_entry + alpha_2_code="VC" + alpha_3_code="VCT" + numeric_code="670" + name="Saint Vincent and the Grenadines"/> + <iso_3166_entry + alpha_2_code="WS" + alpha_3_code="WSM" + numeric_code="882" + name="Samoa" + official_name="Independent State of Samoa"/> + <iso_3166_entry + alpha_2_code="SM" + alpha_3_code="SMR" + numeric_code="674" + name="San Marino" + official_name="Republic of San Marino"/> + <iso_3166_entry + alpha_2_code="ST" + alpha_3_code="STP" + numeric_code="678" + name="Sao Tome and Principe" + official_name="Democratic Republic of Sao Tome and Principe"/> + <iso_3166_entry + alpha_2_code="SA" + alpha_3_code="SAU" + numeric_code="682" + name="Saudi Arabia" + official_name="Kingdom of Saudi Arabia"/> + <iso_3166_entry + alpha_2_code="SN" + alpha_3_code="SEN" + numeric_code="686" + name="Senegal" + official_name="Republic of Senegal"/> + <iso_3166_entry + alpha_2_code="RS" + alpha_3_code="SRB" + numeric_code="688" + name="Serbia" + official_name="Republic of Serbia"/> + <iso_3166_entry + alpha_2_code="SC" + alpha_3_code="SYC" + numeric_code="690" + name="Seychelles" + official_name="Republic of Seychelles"/> + <iso_3166_entry + alpha_2_code="SL" + alpha_3_code="SLE" + numeric_code="694" + name="Sierra Leone" + official_name="Republic of Sierra Leone"/> + <iso_3166_entry + alpha_2_code="SG" + alpha_3_code="SGP" + numeric_code="702" + name="Singapore" + official_name="Republic of Singapore"/> + <iso_3166_entry + alpha_2_code="SX" + alpha_3_code="SXM" + numeric_code="702" + name="Sint Maarten" + official_name="Sint Maarten (Dutch part)"/> + <iso_3166_entry + alpha_2_code="SK" + alpha_3_code="SVK" + numeric_code="703" + name="Slovakia" + official_name="Slovak Republic"/> + <iso_3166_entry + alpha_2_code="SI" + alpha_3_code="SVN" + numeric_code="705" + name="Slovenia" + official_name="Republic of Slovenia"/> + <iso_3166_entry + alpha_2_code="SB" + alpha_3_code="SLB" + numeric_code="090" + name="Solomon Islands"/> + <iso_3166_entry + alpha_2_code="SO" + alpha_3_code="SOM" + numeric_code="706" + name="Somalia" + official_name="Somali Republic"/> + <iso_3166_entry + alpha_2_code="ZA" + alpha_3_code="ZAF" + numeric_code="710" + name="South Africa" + official_name="Republic of South Africa"/> + <iso_3166_entry + alpha_2_code="GS" + alpha_3_code="SGS" + numeric_code="239" + name="South Georgia and the South Sandwich Islands"/> + <iso_3166_entry + alpha_2_code="ES" + alpha_3_code="ESP" + numeric_code="724" + name="Spain" + official_name="Kingdom of Spain"/> + <iso_3166_entry + alpha_2_code="LK" + alpha_3_code="LKA" + numeric_code="144" + name="Sri Lanka" + official_name="Democratic Socialist Republic of Sri Lanka"/> + <iso_3166_entry + alpha_2_code="SD" + alpha_3_code="SDN" + numeric_code="736" + name="Sudan" + official_name="Republic of the Sudan"/> + <iso_3166_entry + alpha_2_code="SR" + alpha_3_code="SUR" + numeric_code="740" + name="Suriname" + official_name="Republic of Suriname"/> + <iso_3166_entry + alpha_2_code="SJ" + alpha_3_code="SJM" + numeric_code="744" + name="Svalbard and Jan Mayen"/> + <iso_3166_entry + alpha_2_code="SZ" + alpha_3_code="SWZ" + numeric_code="748" + name="Swaziland" + official_name="Kingdom of Swaziland"/> + <iso_3166_entry + alpha_2_code="SE" + alpha_3_code="SWE" + numeric_code="752" + name="Sweden" + official_name="Kingdom of Sweden"/> + <iso_3166_entry + alpha_2_code="CH" + alpha_3_code="CHE" + numeric_code="756" + name="Switzerland" + official_name="Swiss Confederation"/> + <iso_3166_entry + alpha_2_code="SY" + alpha_3_code="SYR" + numeric_code="760" + name="Syrian Arab Republic"/> + <iso_3166_entry + alpha_2_code="TW" + alpha_3_code="TWN" + numeric_code="158" + common_name="Taiwan" + name="Taiwan, Province of China" + official_name="Taiwan, Province of China"/> + <iso_3166_entry + alpha_2_code="TJ" + alpha_3_code="TJK" + numeric_code="762" + name="Tajikistan" + official_name="Republic of Tajikistan"/> + <iso_3166_entry + alpha_2_code="TZ" + alpha_3_code="TZA" + numeric_code="834" + name="Tanzania, United Republic of" + official_name="United Republic of Tanzania"/> + <iso_3166_entry + alpha_2_code="TH" + alpha_3_code="THA" + numeric_code="764" + name="Thailand" + official_name="Kingdom of Thailand"/> + <iso_3166_entry + alpha_2_code="TL" + alpha_3_code="TLS" + numeric_code="626" + name="Timor-Leste" + official_name="Democratic Republic of Timor-Leste"/> + <iso_3166_entry + alpha_2_code="TG" + alpha_3_code="TGO" + numeric_code="768" + name="Togo" + official_name="Togolese Republic"/> + <iso_3166_entry + alpha_2_code="TK" + alpha_3_code="TKL" + numeric_code="772" + name="Tokelau"/> + <iso_3166_entry + alpha_2_code="TO" + alpha_3_code="TON" + numeric_code="776" + name="Tonga" + official_name="Kingdom of Tonga"/> + <iso_3166_entry + alpha_2_code="TT" + alpha_3_code="TTO" + numeric_code="780" + name="Trinidad and Tobago" + official_name="Republic of Trinidad and Tobago"/> + <iso_3166_entry + alpha_2_code="TN" + alpha_3_code="TUN" + numeric_code="788" + name="Tunisia" + official_name="Republic of Tunisia"/> + <iso_3166_entry + alpha_2_code="TR" + alpha_3_code="TUR" + numeric_code="792" + name="Turkey" + official_name="Republic of Turkey"/> + <iso_3166_entry + alpha_2_code="TM" + alpha_3_code="TKM" + numeric_code="795" + name="Turkmenistan"/> + <iso_3166_entry + alpha_2_code="TC" + alpha_3_code="TCA" + numeric_code="796" + name="Turks and Caicos Islands"/> + <iso_3166_entry + alpha_2_code="TV" + alpha_3_code="TUV" + numeric_code="798" + name="Tuvalu"/> + <iso_3166_entry + alpha_2_code="UG" + alpha_3_code="UGA" + numeric_code="800" + name="Uganda" + official_name="Republic of Uganda"/> + <iso_3166_entry + alpha_2_code="UA" + alpha_3_code="UKR" + numeric_code="804" + name="Ukraine"/> + <iso_3166_entry + alpha_2_code="AE" + alpha_3_code="ARE" + numeric_code="784" + name="United Arab Emirates"/> + <iso_3166_entry + alpha_2_code="GB" + alpha_3_code="GBR" + numeric_code="826" + name="United Kingdom" + official_name="United Kingdom of Great Britain and Northern Ireland"/> + <iso_3166_entry + alpha_2_code="US" + alpha_3_code="USA" + numeric_code="840" + name="United States" + official_name="United States of America"/> + <iso_3166_entry + alpha_2_code="UM" + alpha_3_code="UMI" + numeric_code="581" + name="United States Minor Outlying Islands"/> + <iso_3166_entry + alpha_2_code="UY" + alpha_3_code="URY" + numeric_code="858" + name="Uruguay" + official_name="Eastern Republic of Uruguay"/> + <iso_3166_entry + alpha_2_code="UZ" + alpha_3_code="UZB" + numeric_code="860" + name="Uzbekistan" + official_name="Republic of Uzbekistan"/> + <iso_3166_entry + alpha_2_code="VU" + alpha_3_code="VUT" + numeric_code="548" + name="Vanuatu" + official_name="Republic of Vanuatu"/> + <iso_3166_entry + alpha_2_code="VE" + alpha_3_code="VEN" + numeric_code="862" + common_name="Venezuela" + name="Venezuela, Bolivarian republic of" + official_name="Bolivarian Republic of Venezuela"/> + <iso_3166_entry + alpha_2_code="VN" + alpha_3_code="VNM" + numeric_code="704" + name="Viet Nam" + official_name="Socialist Republic of Viet Nam"/> + <!-- FIXME CHECK OFFICIAL NAME --> + <iso_3166_entry + alpha_2_code="VG" + alpha_3_code="VGB" + numeric_code="092" + name="Virgin Islands, British" + official_name="British Virgin Islands"/> + <iso_3166_entry + alpha_2_code="VI" + alpha_3_code="VIR" + numeric_code="850" + name="Virgin Islands, U.S." + official_name="Virgin Islands of the United States"/> + <iso_3166_entry + alpha_2_code="WF" + alpha_3_code="WLF" + numeric_code="876" + name="Wallis and Futuna"/> + <iso_3166_entry + alpha_2_code="EH" + alpha_3_code="ESH" + numeric_code="732" + name="Western Sahara"/> + <iso_3166_entry + alpha_2_code="YE" + alpha_3_code="YEM" + numeric_code="887" + name="Yemen" + official_name="Republic of Yemen"/> + <iso_3166_entry + alpha_2_code="ZM" + alpha_3_code="ZMB" + numeric_code="894" + name="Zambia" + official_name="Republic of Zambia"/> + <iso_3166_entry + alpha_2_code="ZW" + alpha_3_code="ZWE" + numeric_code="716" + name="Zimbabwe" + official_name="Republic of Zimbabwe"/> + <iso_3166_3_entry + alpha_4_code="BQAQ" + alpha_3_code="ATB" + date_withdrawn="1979" + names="British Antarctic Territory"/> + <iso_3166_3_entry + alpha_4_code="BUMM" + alpha_3_code="BUR" + numeric_code="104" + date_withdrawn="1989-12-05" + names="Burma, Socialist Republic of the Union of"/> + <iso_3166_3_entry + alpha_4_code="BYAA" + alpha_3_code="BYS" + numeric_code="112" + date_withdrawn="1992-06-15" + names="Byelorussian SSR Soviet Socialist Republic"/> + <iso_3166_3_entry + alpha_4_code="CTKI" + alpha_3_code="CTE" + numeric_code="128" + date_withdrawn="1984" + names="Canton and Enderbury Islands"/> + <iso_3166_3_entry + alpha_4_code="CSHH" + alpha_3_code="CSK" + numeric_code="200" + date_withdrawn="1993-06-15" + names="Czechoslovakia, Czechoslovak Socialist Republic"/> + <iso_3166_3_entry + alpha_4_code="DYBJ" + alpha_3_code="DHY" + numeric_code="204" + date_withdrawn="1977" + names="Dahomey"/> + <iso_3166_3_entry + alpha_4_code="NQAQ" + alpha_3_code="ATN" + numeric_code="216" + date_withdrawn="1983" + names="Dronning Maud Land"/> + <iso_3166_3_entry + alpha_4_code="TPTL" + alpha_3_code="TMP" + numeric_code="626" + date_withdrawn="2002-05-20" + names="East Timor" + comment="was Portuguese Timor"/> + <iso_3166_3_entry + alpha_4_code="ET" + alpha_3_code="ETH" + numeric_code="230" + date_withdrawn="1993-07-16" + names="Ethiopia"/> + <iso_3166_3_entry + alpha_4_code="FXFR" + alpha_3_code="FXX" + numeric_code="249" + date_withdrawn="1997-07-14" + names="France, Metropolitan"/> + <iso_3166_3_entry + alpha_4_code="AIDJ" + alpha_3_code="AFI" + numeric_code="262" + date_withdrawn="1977" + names="French Afars and Issas"/> + <iso_3166_3_entry + alpha_4_code="FQHH" + alpha_3_code="ATF" + date_withdrawn="1979" + names="French Southern and Antarctic Territories" + comment="now split between AQ and TF"/> + <iso_3166_3_entry + alpha_4_code="DDDE" + alpha_3_code="DDR" + numeric_code="278" + date_withdrawn="1990-10-30" + names="German Democratic Republic"/> + <iso_3166_3_entry + alpha_4_code="DE" + alpha_3_code="DEU" + numeric_code="280" + date_withdrawn="1990-10-30" + names="Germany, Federal Republic of"/> + <iso_3166_3_entry + alpha_4_code="GEHH" + alpha_3_code="GEL" + numeric_code="296" + date_withdrawn="1979" + names="Gilbert and Ellice Islands" + comment="now split into Kiribati and Tuvalu"/> + <iso_3166_3_entry + alpha_4_code="JTUM" + alpha_3_code="JTN" + numeric_code="396" + date_withdrawn="1986" + names="Johnston Island"/> + <iso_3166_3_entry + alpha_4_code="MIUM" + alpha_3_code="MID" + numeric_code="488" + date_withdrawn="1986" + names="Midway Islands"/> + <iso_3166_3_entry + alpha_4_code="AN" + alpha_3_code="ANT" + numeric_code="532" + date_withdrawn="1993-07-12" + names="Netherlands Antilles"/> + <iso_3166_3_entry + alpha_4_code="NTHH" + alpha_3_code="NTZ" + numeric_code="536" + date_withdrawn="1993-07-12" + names="Neutral Zone" + comment="formerly between Saudi Arabia and Iraq"/> + <iso_3166_3_entry + alpha_4_code="NHVU" + alpha_3_code="NHB" + numeric_code="548" + date_withdrawn="1980" + names="New Hebrides"/> + <iso_3166_3_entry + alpha_4_code="PCHH" + alpha_3_code="PCI" + numeric_code="582" + date_withdrawn="1986" + names="Pacific Islands (trust territory)" + comment="divided into FM, MH, MP, and PW"/> + <iso_3166_3_entry + alpha_4_code="PA" + alpha_3_code="PAN" + numeric_code="590" + date_withdrawn="1993-07-22" + names="Panama, Republic of"/> + <iso_3166_3_entry + alpha_4_code="PZPA" + alpha_3_code="PCZ" + date_withdrawn="1980" + names="Panama Canal Zone"/> + <iso_3166_3_entry + alpha_4_code="RO" + alpha_3_code="ROM" + numeric_code="642" + date_withdrawn="2002-02-01" + names="Romania, Socialist Republic of"/> + <iso_3166_3_entry + alpha_4_code="KN" + alpha_3_code="KNA" + numeric_code="658" + date_withdrawn="1988" + names="St. Kitts-Nevis-Anguilla" + comment="now St. Kitts and Nevis and Anguilla"/> + <iso_3166_3_entry + alpha_4_code="CSXX" + alpha_3_code="SCG" + numeric_code="891" + date_withdrawn="2006-06-05" + names="Serbia and Montenegro"/> + <iso_3166_3_entry + alpha_4_code="SKIN" + alpha_3_code="SKM" + date_withdrawn="1975" + names="Sikkim"/> + <iso_3166_3_entry + alpha_4_code="RHZW" + alpha_3_code="RHO" + numeric_code="716" + date_withdrawn="1980" + names="Southern Rhodesia"/> + <iso_3166_3_entry + alpha_4_code="EH" + alpha_3_code="ESH" + numeric_code="732" + date_withdrawn="1988" + names="Spanish Sahara" + comment="now Western Sahara"/> + <iso_3166_3_entry + alpha_4_code="PUUM" + alpha_3_code="PUS" + numeric_code="849" + date_withdrawn="1986" + names="US Miscellaneous Pacific Islands"/> + <iso_3166_3_entry + alpha_4_code="SUHH" + alpha_3_code="SUN" + numeric_code="810" + date_withdrawn="1992-08-30" + names="USSR, Union of Soviet Socialist Republics"/> + <iso_3166_3_entry + alpha_4_code="HVBF" + alpha_3_code="HVO" + numeric_code="854" + date_withdrawn="1984" + names="Upper Volta, Republic of"/> + <iso_3166_3_entry + alpha_4_code="VA" + alpha_3_code="VAT" + numeric_code="336" + date_withdrawn="1996-04-03" + names="Vatican City State (Holy See)"/> + <iso_3166_3_entry + alpha_4_code="VDVN" + alpha_3_code="VDR" + date_withdrawn="1977" + names="Viet-Nam, Democratic Republic of"/> + <iso_3166_3_entry + alpha_4_code="WKUM" + alpha_3_code="WAK" + numeric_code="872" + date_withdrawn="1986" + names="Wake Island"/> + <iso_3166_3_entry + alpha_4_code="YDYE" + alpha_3_code="YMD" + numeric_code="720" + date_withdrawn="1990-08-14" + names="Yemen, Democratic, People's Democratic Republic of"/> + <iso_3166_3_entry + alpha_4_code="YE" + alpha_3_code="YEM" + numeric_code="891" + date_withdrawn="1990-08-14" + names="Yemen, Yemen Arab Republic"/> + <iso_3166_3_entry + alpha_4_code="YUCS" + alpha_3_code="YUG" + numeric_code="891" + date_withdrawn="1993-07-28" + names="Yugoslavia, Socialist Federal Republic of"/> + <iso_3166_3_entry + alpha_4_code="ZRCD" + alpha_3_code="ZAR" + numeric_code="180" + date_withdrawn="1997-07-14" + names="Zaire, Republic of"/> </iso_3166_entries> diff --git a/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml b/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml index 223cc2e47..4d598ca62 100644 --- a/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml +++ b/examples/contacts-example/src/main/resources/countries/iso_3166_2.xml @@ -56,10668 +56,10668 @@ Source: <http://www.iso.org/iso/country_codes/background_on_iso_3166/iso_3166-2. ]> <iso_3166_2_entries> - <!-- Andorra --> - <iso_3166_country code="AD"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="AD-07" name="Andorra la Vella"/> - <iso_3166_2_entry - code="AD-02" name="Canillo"/> - <iso_3166_2_entry - code="AD-03" name="Encamp"/> - <iso_3166_2_entry - code="AD-08" name="Escaldes-Engordany"/> - <iso_3166_2_entry - code="AD-04" name="La Massana"/> - <iso_3166_2_entry - code="AD-05" name="Ordino"/> - <iso_3166_2_entry - code="AD-06" name="Sant Julià de Lòria"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United Arab Emirates --> - <iso_3166_country code="AE"> - <iso_3166_subset type="Emirate"> - <iso_3166_2_entry - code="AE-AZ" name="Abū Ȥaby [Abu Dhabi]"/> - <iso_3166_2_entry - code="AE-AJ" name="'Ajmān"/> - <iso_3166_2_entry - code="AE-FU" name="Al Fujayrah"/> - <iso_3166_2_entry - code="AE-SH" name="Ash Shāriqah"/> - <iso_3166_2_entry - code="AE-DU" name="Dubayy"/> - <iso_3166_2_entry - code="AE-RK" name="Ra’s al Khaymah"/> - <iso_3166_2_entry - code="AE-UQ" name="Umm al Qaywayn"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Afghanistan --> - <iso_3166_country code="AF"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AF-BDS" name="Badakhshān"/> - <iso_3166_2_entry - code="AF-BDG" name="Bādghīs"/> - <iso_3166_2_entry - code="AF-BGL" name="Baghlān"/> - <iso_3166_2_entry - code="AF-BAL" name="Balkh"/> - <iso_3166_2_entry - code="AF-BAM" name="Bāmīān"/> - <iso_3166_2_entry - code="AF-DAY" name="Dāykondī"/> - <iso_3166_2_entry - code="AF-FRA" name="Farāh"/> - <iso_3166_2_entry - code="AF-FYB" name="Fāryāb"/> - <iso_3166_2_entry - code="AF-GHA" name="Ghaznī"/> - <iso_3166_2_entry - code="AF-GHO" name="Ghowr"/> - <iso_3166_2_entry - code="AF-HEL" name="Helmand"/> - <iso_3166_2_entry - code="AF-HER" name="Herāt"/> - <iso_3166_2_entry - code="AF-JOW" name="Jowzjān"/> - <iso_3166_2_entry - code="AF-KAB" name="Kābul [Kābol]"/> - <iso_3166_2_entry - code="AF-KAN" name="Kandahār"/> - <iso_3166_2_entry - code="AF-KAP" name="Kāpīsā"/> - <iso_3166_2_entry - code="AF-KHO" name="Khowst"/> - <iso_3166_2_entry - code="AF-KNR" name="Konar [Kunar]"/> - <iso_3166_2_entry - code="AF-KDZ" name="Kondoz [Kunduz]"/> - <iso_3166_2_entry - code="AF-LAG" name="Laghmān"/> - <iso_3166_2_entry - code="AF-LOW" name="Lowgar"/> - <iso_3166_2_entry - code="AF-NAN" name="Nangrahār [Nangarhār]"/> - <iso_3166_2_entry - code="AF-NIM" name="Nīmrūz"/> - <iso_3166_2_entry - code="AF-NUR" name="Nūrestān"/> - <iso_3166_2_entry - code="AF-ORU" name="Orūzgān [Urūzgān]"/> - <iso_3166_2_entry - code="AF-PAN" name="Panjshīr"/> - <iso_3166_2_entry - code="AF-PIA" name="Paktīā"/> - <iso_3166_2_entry - code="AF-PKA" name="Paktīkā"/> - <iso_3166_2_entry - code="AF-PAR" name="Parwān"/> - <iso_3166_2_entry - code="AF-SAM" name="Samangān"/> - <iso_3166_2_entry - code="AF-SAR" name="Sar-e Pol"/> - <iso_3166_2_entry - code="AF-TAK" name="Takhār"/> - <iso_3166_2_entry - code="AF-WAR" name="Wardak [Wardag]"/> - <iso_3166_2_entry - code="AF-ZAB" name="Zābol [Zābul]"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Antigua and Barbuda --> - <iso_3166_country code="AG"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="AG-03" name="Saint George"/> - <iso_3166_2_entry - code="AG-04" name="Saint John"/> - <iso_3166_2_entry - code="AG-05" name="Saint Mary"/> - <iso_3166_2_entry - code="AG-06" name="Saint Paul"/> - <iso_3166_2_entry - code="AG-07" name="Saint Peter"/> - <iso_3166_2_entry - code="AG-08" name="Saint Philip"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="AG-10" name="Barbuda"/> - <iso_3166_2_entry - code="AG-11" name="Redonda"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Albania --> - <iso_3166_country code="AL"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="AL-01" name="Berat"/> - <iso_3166_2_entry - code="AL-09" name="Dibër"/> - <iso_3166_2_entry - code="AL-02" name="Durrës"/> - <iso_3166_2_entry - code="AL-03" name="Elbasan"/> - <iso_3166_2_entry - code="AL-04" name="Fier"/> - <iso_3166_2_entry - code="AL-05" name="Gjirokastër"/> - <iso_3166_2_entry - code="AL-06" name="Korçë"/> - <iso_3166_2_entry - code="AL-07" name="Kukës"/> - <iso_3166_2_entry - code="AL-08" name="Lezhë"/> - <iso_3166_2_entry - code="AL-10" name="Shkodër"/> - <iso_3166_2_entry - code="AL-11" name="Tiranë"/> - <iso_3166_2_entry - code="AL-12" name="Vlorë"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="AL-BR" name="Berat" parent="01"/> - <iso_3166_2_entry - code="AL-BU" name="Bulqizë" parent="09"/> - <iso_3166_2_entry - code="AL-DL" name="Delvinë" parent="12"/> - <iso_3166_2_entry - code="AL-DV" name="Devoll" parent="06"/> - <iso_3166_2_entry - code="AL-DI" name="Dibër" parent="09"/> - <iso_3166_2_entry - code="AL-DR" name="Durrës" parent="02"/> - <iso_3166_2_entry - code="AL-EL" name="Elbasan" parent="03"/> - <iso_3166_2_entry - code="AL-FR" name="Fier" parent="04"/> - <iso_3166_2_entry - code="AL-GR" name="Gramsh" parent="03"/> - <iso_3166_2_entry - code="AL-GJ" name="Gjirokastër" parent="05"/> - <iso_3166_2_entry - code="AL-HA" name="Has" parent="07"/> - <iso_3166_2_entry - code="AL-KA" name="Kavajë" parent="11"/> - <iso_3166_2_entry - code="AL-ER" name="Kolonjë" parent="06"/> - <iso_3166_2_entry - code="AL-KO" name="Korçë" parent="06"/> - <iso_3166_2_entry - code="AL-KR" name="Krujë" parent="02"/> - <iso_3166_2_entry - code="AL-KC" name="Kuçovë" parent="01"/> - <iso_3166_2_entry - code="AL-KU" name="Kukës" parent="07"/> - <iso_3166_2_entry - code="AL-KB" name="Kurbin" parent="08"/> - <iso_3166_2_entry - code="AL-LE" name="Lezhë" parent="08"/> - <iso_3166_2_entry - code="AL-LB" name="Librazhd" parent="03"/> - <iso_3166_2_entry - code="AL-LU" name="Lushnjë" parent="04"/> - <iso_3166_2_entry - code="AL-MM" name="Malësi e Madhe" parent="10"/> - <iso_3166_2_entry - code="AL-MK" name="Mallakastër" parent="04"/> - <iso_3166_2_entry - code="AL-MT" name="Mat" parent="09"/> - <iso_3166_2_entry - code="AL-MR" name="Mirditë" parent="08"/> - <iso_3166_2_entry - code="AL-PQ" name="Peqin" parent="03"/> - <iso_3166_2_entry - code="AL-PR" name="Përmet" parent="05"/> - <iso_3166_2_entry - code="AL-PG" name="Pogradec" parent="06"/> - <iso_3166_2_entry - code="AL-PU" name="Pukë" parent="10"/> - <iso_3166_2_entry - code="AL-SR" name="Sarandë" parent="12"/> - <iso_3166_2_entry - code="AL-SK" name="Skrapar" parent="01"/> - <iso_3166_2_entry - code="AL-SH" name="Shkodër" parent="10"/> - <iso_3166_2_entry - code="AL-TE" name="Tepelenë" parent="05"/> - <iso_3166_2_entry - code="AL-TR" name="Tiranë" parent="11"/> - <iso_3166_2_entry - code="AL-TP" name="Tropojë" parent="07"/> - <iso_3166_2_entry - code="AL-VL" name="Vlorë" parent="12"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Armenia --> - <iso_3166_country code="AM"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AM-ER" name="Erevan"/> - <iso_3166_2_entry - code="AM-AG" name="Aragacotn"/> - <iso_3166_2_entry - code="AM-AR" name="Ararat"/> - <iso_3166_2_entry - code="AM-AV" name="Armavir"/> - <iso_3166_2_entry - code="AM-GR" name="Gegarkunik'"/> - <iso_3166_2_entry - code="AM-KT" name="Kotayk'"/> - <iso_3166_2_entry - code="AM-LO" name="Lory"/> - <iso_3166_2_entry - code="AM-SH" name="Sirak"/> - <iso_3166_2_entry - code="AM-SU" name="Syunik'"/> - <iso_3166_2_entry - code="AM-TV" name="Tavus"/> - <iso_3166_2_entry - code="AM-VD" name="Vayoc Jor"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Angola --> - <iso_3166_country code="AO"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AO-BGO" name="Bengo"/> - <iso_3166_2_entry - code="AO-BGU" name="Benguela"/> - <iso_3166_2_entry - code="AO-BIE" name="Bié"/> - <iso_3166_2_entry - code="AO-CAB" name="Cabinda"/> - <iso_3166_2_entry - code="AO-CCU" name="Cuando-Cubango"/> - <iso_3166_2_entry - code="AO-CNO" name="Cuanza Norte"/> - <iso_3166_2_entry - code="AO-CUS" name="Cuanza Sul"/> - <iso_3166_2_entry - code="AO-CNN" name="Cunene"/> - <iso_3166_2_entry - code="AO-HUA" name="Huambo"/> - <iso_3166_2_entry - code="AO-HUI" name="Huíla"/> - <iso_3166_2_entry - code="AO-LUA" name="Luanda"/> - <iso_3166_2_entry - code="AO-LNO" name="Lunda Norte"/> - <iso_3166_2_entry - code="AO-LSU" name="Lunda Sul"/> - <iso_3166_2_entry - code="AO-MAL" name="Malange"/> - <iso_3166_2_entry - code="AO-MOX" name="Moxico"/> - <iso_3166_2_entry - code="AO-NAM" name="Namibe"/> - <iso_3166_2_entry - code="AO-UIG" name="Uíge"/> - <iso_3166_2_entry - code="AO-ZAI" name="Zaire"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Argentina --> - <iso_3166_country code="AR"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="AR-C" name="Ciudad Autónoma de Buenos Aires"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="AR-B" name="Buenos Aires"/> - <iso_3166_2_entry - code="AR-K" name="Catamarca"/> - <iso_3166_2_entry - code="AR-X" name="Cordoba"/> - <iso_3166_2_entry - code="AR-W" name="Corrientes"/> - <iso_3166_2_entry - code="AR-H" name="Chaco"/> - <iso_3166_2_entry - code="AR-U" name="Chubut"/> - <iso_3166_2_entry - code="AR-E" name="Entre Rios"/> - <iso_3166_2_entry - code="AR-P" name="Formosa"/> - <iso_3166_2_entry - code="AR-Y" name="Jujuy"/> - <iso_3166_2_entry - code="AR-L" name="La Pampa"/> - <iso_3166_2_entry - code="AR-M" name="Mendoza"/> - <iso_3166_2_entry - code="AR-N" name="Misiones"/> - <iso_3166_2_entry - code="AR-Q" name="Neuquen"/> - <iso_3166_2_entry - code="AR-R" name="Rio Negro"/> - <iso_3166_2_entry - code="AR-A" name="Salta"/> - <iso_3166_2_entry - code="AR-J" name="San Juan"/> - <iso_3166_2_entry - code="AR-D" name="San Luis"/> - <iso_3166_2_entry - code="AR-Z" name="Santa Cruz"/> - <iso_3166_2_entry - code="AR-S" name="Santa Fe"/> - <iso_3166_2_entry - code="AR-G" name="Santiago del Estero"/> - <iso_3166_2_entry - code="AR-V" name="Tierra del Fuego"/> - <iso_3166_2_entry - code="AR-T" name="Tucuman"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Austria --> - <iso_3166_country code="AT"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="AT-1" name="Burgenland"/> - <iso_3166_2_entry - code="AT-2" name="Kärnten"/> - <iso_3166_2_entry - code="AT-3" name="Niederösterreich"/> - <iso_3166_2_entry - code="AT-4" name="Oberösterreich"/> - <iso_3166_2_entry - code="AT-5" name="Salzburg"/> - <iso_3166_2_entry - code="AT-6" name="Steiermark"/> - <iso_3166_2_entry - code="AT-7" name="Tirol"/> - <iso_3166_2_entry - code="AT-8" name="Vorarlberg"/> - <iso_3166_2_entry - code="AT-9" name="Wien"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Australia --> - <iso_3166_country code="AU"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="AU-NSW" name="New South Wales"/> - <iso_3166_2_entry - code="AU-QLD" name="Queensland"/> - <iso_3166_2_entry - code="AU-SA" name="South Australia"/> - <iso_3166_2_entry - code="AU-TAS" name="Tasmania"/> - <iso_3166_2_entry - code="AU-VIC" name="Victoria"/> - <iso_3166_2_entry - code="AU-WA" name="Western Australia"/> - </iso_3166_subset> - <iso_3166_subset type="Territory"> - <iso_3166_2_entry - code="AU-ACT" name="Australian Capital Territory"/> - <iso_3166_2_entry - code="AU-NT" name="Northern Territory"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Azerbaijan --> - <iso_3166_country code="AZ"> - <iso_3166_subset type="Autonomous republic"> - <iso_3166_2_entry - code="AZ NX" name="Naxçıvan"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="AZ-AB" name="Əli Bayramlı"/> - <iso_3166_2_entry - code="AZ-BA" name="Bakı"/> - <iso_3166_2_entry - code="AZ-GA" name="Gəncə"/> - <iso_3166_2_entry - code="AZ-LA" name="Lənkəran"/> - <iso_3166_2_entry - code="AZ-MI" name="Mingəçevir"/> - <iso_3166_2_entry - code="AZ-NA" name="Naftalan"/> - <iso_3166_2_entry - code="AZ-SA" name="Şəki"/> - <iso_3166_2_entry - code="AZ-SM" name="Sumqayıt"/> - <iso_3166_2_entry - code="AZ-SS" name="Şuşa"/> - <iso_3166_2_entry - code="AZ-XA" name="Xankəndi"/> - <iso_3166_2_entry - code="AZ-YE" name="Yevlax"/> - </iso_3166_subset> - <iso_3166_subset type="Rayon"> - <iso_3166_2_entry - code="AZ-ABS" name="Abşeron"/> - <iso_3166_2_entry - code="AZ-AGC" name="Ağcabədi"/> - <iso_3166_2_entry - code="AZ-AGM" name="Ağdam"/> - <iso_3166_2_entry - code="AZ-AGS" name="Ağdaş"/> - <iso_3166_2_entry - code="AZ-AGA" name="Ağstafa"/> - <iso_3166_2_entry - code="AZ-AGU" name="Ağsu"/> - <iso_3166_2_entry - code="AZ-AST" name="Astara"/> - <iso_3166_2_entry - code="AZ-BAB" name="Babək" parent="NX"/> - <iso_3166_2_entry - code="AZ-BAL" name="Balakən"/> - <iso_3166_2_entry - code="AZ-BAR" name="Bərdə"/> - <iso_3166_2_entry - code="AZ-BEY" name="Beyləqan"/> - <iso_3166_2_entry - code="AZ-BIL" name="Biləsuvar"/> - <iso_3166_2_entry - code="AZ-CAB" name="Cəbrayıl"/> - <iso_3166_2_entry - code="AZ-CAL" name="Cəlilabab"/> - <iso_3166_2_entry - code="AZ-CUL" name="Culfa" parent="NX"/> - <iso_3166_2_entry - code="AZ-DAS" name="Daşkəsən"/> - <iso_3166_2_entry - code="AZ-DAV" name="Dəvəçi"/> - <iso_3166_2_entry - code="AZ-FUZ" name="Füzuli"/> - <iso_3166_2_entry - code="AZ-GAD" name="Gədəbəy"/> - <iso_3166_2_entry - code="AZ-GOR" name="Goranboy"/> - <iso_3166_2_entry - code="AZ-GOY" name="Göyçay"/> - <iso_3166_2_entry - code="AZ-HAC" name="Hacıqabul"/> - <iso_3166_2_entry - code="AZ-IMI" name="İmişli"/> - <iso_3166_2_entry - code="AZ-ISM" name="İsmayıllı"/> - <iso_3166_2_entry - code="AZ-KAL" name="Kəlbəcər"/> - <iso_3166_2_entry - code="AZ-KUR" name="Kürdəmir"/> - <iso_3166_2_entry - code="AZ-LAC" name="Laçın"/> - <iso_3166_2_entry - code="AZ-LAN" name="Lənkəran"/> - <iso_3166_2_entry - code="AZ-LER" name="Lerik"/> - <iso_3166_2_entry - code="AZ-MAS" name="Masallı"/> - <iso_3166_2_entry - code="AZ-NEF" name="Neftçala"/> - <iso_3166_2_entry - code="AZ-OGU" name="Oğuz"/> - <iso_3166_2_entry - code="AZ-ORD" name="Ordubad" parent="NX"/> - <iso_3166_2_entry - code="AZ-QAB" name="Qəbələ"/> - <iso_3166_2_entry - code="AZ-QAX" name="Qax"/> - <iso_3166_2_entry - code="AZ-QAZ" name="Qazax"/> - <iso_3166_2_entry - code="AZ-QOB" name="Qobustan"/> - <iso_3166_2_entry - code="AZ-QBA" name="Quba"/> - <iso_3166_2_entry - code="AZ-QBI" name="Qubadlı"/> - <iso_3166_2_entry - code="AZ-QUS" name="Qusar"/> - <iso_3166_2_entry - code="AZ-SAT" name="Saatlı"/> - <iso_3166_2_entry - code="AZ-SAB" name="Sabirabad"/> - <iso_3166_2_entry - code="AZ-SAD" name="Sədərək" parent="NX"/> - <iso_3166_2_entry - code="AZ-SAH" name="Şahbuz" parent="NX"/> - <iso_3166_2_entry - code="AZ-SAK" name="Şəki"/> - <iso_3166_2_entry - code="AZ-SAL" name="Salyan"/> - <iso_3166_2_entry - code="AZ-SMI" name="Şamaxı"/> - <iso_3166_2_entry - code="AZ-SKR" name="Şəmkir"/> - <iso_3166_2_entry - code="AZ-SMX" name="Samux"/> - <iso_3166_2_entry - code="AZ-SAR" name="Şərur" parent="NX"/> - <iso_3166_2_entry - code="AZ-SIY" name="Siyəzən"/> - <iso_3166_2_entry - code="AZ-SUS" name="Şuşa"/> - <iso_3166_2_entry - code="AZ-TAR" name="Tərtər"/> - <iso_3166_2_entry - code="AZ-TOV" name="Tovuz"/> - <iso_3166_2_entry - code="AZ-UCA" name="Ucar"/> - <iso_3166_2_entry - code="AZ-XAC" name="Xaçmaz"/> - <iso_3166_2_entry - code="AZ-XAN" name="Xanlar"/> - <iso_3166_2_entry - code="AZ-XIZ" name="Xızı"/> - <iso_3166_2_entry - code="AZ-XCI" name="Xocalı"/> - <iso_3166_2_entry - code="AZ-XVD" name="Xocavənd"/> - <iso_3166_2_entry - code="AZ-YAR" name="Yardımlı"/> - <iso_3166_2_entry - code="AZ-YEV" name="Yevlax"/> - <iso_3166_2_entry - code="AZ-ZAN" name="Zəngilan"/> - <iso_3166_2_entry - code="AZ-ZAQ" name="Zaqatala"/> - <iso_3166_2_entry - code="AZ-ZAR" name="Zərdab"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bosnia-Herzegovina --> - <iso_3166_country code="BA"> - <iso_3166_subset type="Entity"> - <iso_3166_2_entry - code="BA-BIH" name="Federacija Bosne i Hercegovine"/> - <iso_3166_2_entry - code="BA-SRP" name="Republika Srpska"/> - </iso_3166_subset> - <iso_3166_subset type="Canton"> - <iso_3166_2_entry - code="BA-05" name="Bosansko-podrinjski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-07" name="Hercegovačko-neretvanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-10" name="Kanton br. 10 (Livanjski kanton)" parent="BIH"/> - <iso_3166_2_entry - code="BA-09" name="Kanton Sarajevo" parent="BIH"/> - <iso_3166_2_entry - code="BA-02" name="Posavski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-06" name="Srednjobosanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-03" name="Tuzlanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-01" name="Unsko-sanski kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-08" name="Zapadnohercegovački kanton" parent="BIH"/> - <iso_3166_2_entry - code="BA-04" name="Zeničko-dobojski kanton" parent="BIH"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BA-BRC" name="Brčko distrikt"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Barbados --> - <iso_3166_country code="BB"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="BB-01" name="Christ Church"/> - <iso_3166_2_entry - code="BB-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="BB-03" name="Saint George"/> - <iso_3166_2_entry - code="BB-04" name="Saint James"/> - <iso_3166_2_entry - code="BB-05" name="Saint John"/> - <iso_3166_2_entry - code="BB-06" name="Saint Joseph"/> - <iso_3166_2_entry - code="BB-07" name="Saint Lucy"/> - <iso_3166_2_entry - code="BB-08" name="Saint Michael"/> - <iso_3166_2_entry - code="BB-09" name="Saint Peter"/> - <iso_3166_2_entry - code="BB-10" name="Saint Philip"/> - <iso_3166_2_entry - code="BB-11" name="Saint Thomas"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bangladesh --> - <iso_3166_country code="BD"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="BD 1" name="Barisal bibhag"/> - <iso_3166_2_entry - code="BD 2" name="Chittagong bibhag"/> - <iso_3166_2_entry - code="BD 3" name="Dhaka bibhag"/> - <iso_3166_2_entry - code="BD 4" name="Khulna bibhag"/> - <iso_3166_2_entry - code="BD 5" name="Rajshahi bibhag"/> - <iso_3166_2_entry - code="BD 6" name="Sylhet bibhag"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BD-05" name="Bagerhat zila" parent="4"/> - <iso_3166_2_entry - code="BD-01" name="Bandarban zila" parent="2"/> - <iso_3166_2_entry - code="BD-02" name="Barguna zila" parent="1"/> - <iso_3166_2_entry - code="BD-06" name="Barisal zila" parent="1"/> - <iso_3166_2_entry - code="BD-07" name="Bhola zila" parent="1"/> - <iso_3166_2_entry - code="BD-03" name="Bogra zila" parent="5"/> - <iso_3166_2_entry - code="BD-04" name="Brahmanbaria zila" parent="2"/> - <iso_3166_2_entry - code="BD-09" name="Chandpur zila" parent="2"/> - <iso_3166_2_entry - code="BD-10" name="Chittagong zila" parent="2"/> - <iso_3166_2_entry - code="BD-12" name="Chuadanga zila" parent="4"/> - <iso_3166_2_entry - code="BD-08" name="Comilla zila" parent="2"/> - <iso_3166_2_entry - code="BD-11" name="Cox's Bazar zila" parent="2"/> - <iso_3166_2_entry - code="BD-13" name="Dhaka zila" parent="3"/> - <iso_3166_2_entry - code="BD-14" name="Dinajpur zila" parent="5"/> - <iso_3166_2_entry - code="BD-15" name="Faridpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-16" name="Feni zila" parent="2"/> - <iso_3166_2_entry - code="BD-19" name="Gaibandha zila" parent="5"/> - <iso_3166_2_entry - code="BD-18" name="Gazipur zila" parent="3"/> - <iso_3166_2_entry - code="BD-17" name="Gopalganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-20" name="Habiganj zila" parent="6"/> - <iso_3166_2_entry - code="BD-24" name="Jaipurhat zila" parent="5"/> - <iso_3166_2_entry - code="BD-21" name="Jamalpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-22" name="Jessore zila" parent="4"/> - <iso_3166_2_entry - code="BD-25" name="Jhalakati zila" parent="1"/> - <iso_3166_2_entry - code="BD-23" name="Jhenaidah zila" parent="4"/> - <iso_3166_2_entry - code="BD-29" name="Khagrachari zila" parent="2"/> - <iso_3166_2_entry - code="BD-27" name="Khulna zila" parent="4"/> - <iso_3166_2_entry - code="BD-26" name="Kishorganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-28" name="Kurigram zila" parent="5"/> - <iso_3166_2_entry - code="BD-30" name="Kushtia zila" parent="4"/> - <iso_3166_2_entry - code="BD-31" name="Lakshmipur zila" parent="2"/> - <iso_3166_2_entry - code="BD-32" name="Lalmonirhat zila" parent="5"/> - <iso_3166_2_entry - code="BD-36" name="Madaripur zila" parent="3"/> - <iso_3166_2_entry - code="BD-37" name="Magura zila" parent="4"/> - <iso_3166_2_entry - code="BD-33" name="Manikganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-39" name="Meherpur zila" parent="4"/> - <iso_3166_2_entry - code="BD-38" name="Moulvibazar zila" parent="6"/> - <iso_3166_2_entry - code="BD-35" name="Munshiganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-34" name="Mymensingh zila" parent="3"/> - <iso_3166_2_entry - code="BD-48" name="Naogaon zila" parent="5"/> - <iso_3166_2_entry - code="BD-43" name="Narail zila" parent="4"/> - <iso_3166_2_entry - code="BD-40" name="Narayanganj zila" parent="3"/> - <iso_3166_2_entry - code="BD-42" name="Narsingdi zila" parent="3"/> - <iso_3166_2_entry - code="BD-44" name="Natore zila" parent="5"/> - <iso_3166_2_entry - code="BD-45" name="Nawabganj zila" parent="5"/> - <iso_3166_2_entry - code="BD-41" name="Netrakona zila" parent="3"/> - <iso_3166_2_entry - code="BD-46" name="Nilphamari zila" parent="5"/> - <iso_3166_2_entry - code="BD-47" name="Noakhali zila" parent="2"/> - <iso_3166_2_entry - code="BD-49" name="Pabna zila" parent="5"/> - <iso_3166_2_entry - code="BD-52" name="Panchagarh zila" parent="5"/> - <iso_3166_2_entry - code="BD-51" name="Patuakhali zila" parent="1"/> - <iso_3166_2_entry - code="BD-50" name="Pirojpur zila" parent="1"/> - <iso_3166_2_entry - code="BD-53" name="Rajbari zila" parent="3"/> - <iso_3166_2_entry - code="BD-54" name="Rajshahi zila" parent="5"/> - <iso_3166_2_entry - code="BD-56" name="Rangamati zila" parent="2"/> - <iso_3166_2_entry - code="BD-55" name="Rangpur zila" parent="5"/> - <iso_3166_2_entry - code="BD-58" name="Satkhira zila" parent="4"/> - <iso_3166_2_entry - code="BD-62" name="Shariatpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-57" name="Sherpur zila" parent="3"/> - <iso_3166_2_entry - code="BD-59" name="Sirajganj zila" parent="5"/> - <iso_3166_2_entry - code="BD-61" name="Sunamganj zila" parent="6"/> - <iso_3166_2_entry - code="BD-60" name="Sylhet zila" parent="6"/> - <iso_3166_2_entry - code="BD-63" name="Tangail zila" parent="3"/> - <iso_3166_2_entry - code="BD-64" name="Thakurgaon zila" parent="5"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Belgium --> - <iso_3166_country code="BE"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="BE-VAN" name="Antwerpen"/> - <iso_3166_2_entry - code="BE-WBR" name="Brabant Wallon"/> - <iso_3166_2_entry - code="BE-BRU" name="Brussels-Capital Region"/> - <iso_3166_2_entry - code="BE-WHT" name="Hainaut"/> - <iso_3166_2_entry - code="BE-WLG" name="Liege"/> - <iso_3166_2_entry - code="BE-VLI" name="Limburg"/> - <iso_3166_2_entry - code="BE-WLX" name="Luxembourg"/> - <iso_3166_2_entry - code="BE-WNA" name="Namur"/> - <iso_3166_2_entry - code="BE-VOV" name="Oost-Vlaanderen"/> - <iso_3166_2_entry - code="BE-VBR" name="Vlaams-Brabant"/> - <iso_3166_2_entry - code="BE-VWV" name="West-Vlaanderen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Burkina-Faso --> - <iso_3166_country code="BF"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="BF-01" name="Boucle du Mouhoun"/> - <iso_3166_2_entry - code="BF-02" name="Cascades"/> - <iso_3166_2_entry - code="BF-03" name="Centre"/> - <iso_3166_2_entry - code="BF-04" name="Centre-Est"/> - <iso_3166_2_entry - code="BF-05" name="Centre-Nord"/> - <iso_3166_2_entry - code="BF-06" name="Centre-Ouest"/> - <iso_3166_2_entry - code="BF-07" name="Centre-Sud"/> - <iso_3166_2_entry - code="BF-08" name="Est"/> - <iso_3166_2_entry - code="BF-09" name="Hauts-Bassins"/> - <iso_3166_2_entry - code="BF-10" name="Nord"/> - <iso_3166_2_entry - code="BF-11" name="Plateau-Central"/> - <iso_3166_2_entry - code="BF-12" name="Sahel"/> - <iso_3166_2_entry - code="BF-13" name="Sud-Ouest"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="BF-BAL" name="Balé" parent="01"/> - <iso_3166_2_entry - code="BF-BAM" name="Bam" parent="05"/> - <iso_3166_2_entry - code="BF-BAN" name="Banwa" parent="01"/> - <iso_3166_2_entry - code="BF-BAZ" name="Bazèga" parent="07"/> - <iso_3166_2_entry - code="BF-BGR" name="Bougouriba" parent="13"/> - <iso_3166_2_entry - code="BF-BLG" name="Boulgou" parent="04"/> - <iso_3166_2_entry - code="BF-BLK" name="Boulkiemdé" parent="06"/> - <iso_3166_2_entry - code="BF-COM" name="Comoé" parent="02"/> - <iso_3166_2_entry - code="BF-GAN" name="Ganzourgou" parent="11"/> - <iso_3166_2_entry - code="BF-GNA" name="Gnagna" parent="08"/> - <iso_3166_2_entry - code="BF-GOU" name="Gourma" parent="08"/> - <iso_3166_2_entry - code="BF-HOU" name="Houet" parent="09"/> - <iso_3166_2_entry - code="BF-IOB" name="Ioba" parent="13"/> - <iso_3166_2_entry - code="BF-KAD" name="Kadiogo" parent="03"/> - <iso_3166_2_entry - code="BF-KEN" name="Kénédougou" parent="09"/> - <iso_3166_2_entry - code="BF-KMD" name="Komondjari" parent="08"/> - <iso_3166_2_entry - code="BF-KMP" name="Kompienga" parent="08"/> - <iso_3166_2_entry - code="BF-KOS" name="Kossi" parent="01"/> - <iso_3166_2_entry - code="BF-KOP" name="Koulpélogo" parent="04"/> - <iso_3166_2_entry - code="BF-KOT" name="Kouritenga" parent="04"/> - <iso_3166_2_entry - code="BF-KOW" name="Kourwéogo" parent="11"/> - <iso_3166_2_entry - code="BF-LER" name="Léraba" parent="02"/> - <iso_3166_2_entry - code="BF-LOR" name="Loroum" parent="10"/> - <iso_3166_2_entry - code="BF-MOU" name="Mouhoun" parent="01"/> - <iso_3166_2_entry - code="BF-NAO" name="Naouri" parent="07"/> - <iso_3166_2_entry - code="BF-NAM" name="Namentenga" parent="05"/> - <iso_3166_2_entry - code="BF-NAY" name="Nayala" parent="01"/> - <iso_3166_2_entry - code="BF-NOU" name="Noumbiel" parent="13"/> - <iso_3166_2_entry - code="BF-OUB" name="Oubritenga" parent="11"/> - <iso_3166_2_entry - code="BF-OUD" name="Oudalan" parent="12"/> - <iso_3166_2_entry - code="BF-PAS" name="Passoré" parent="10"/> - <iso_3166_2_entry - code="BF-PON" name="Poni" parent="13"/> - <iso_3166_2_entry - code="BF-SNG" name="Sanguié" parent="06"/> - <iso_3166_2_entry - code="BF-SMT" name="Sanmatenga" parent="05"/> - <iso_3166_2_entry - code="BF-SEN" name="Séno" parent="12"/> - <iso_3166_2_entry - code="BF-SIS" name="Sissili" parent="06"/> - <iso_3166_2_entry - code="BF-SOM" name="Soum" parent="12"/> - <iso_3166_2_entry - code="BF-SOR" name="Sourou" parent="01"/> - <iso_3166_2_entry - code="BF-TAP" name="Tapoa" parent="08"/> - <iso_3166_2_entry - code="BF-TUI" name="Tui" parent="09"/> - <iso_3166_2_entry - code="BF-YAG" name="Yagha" parent="12"/> - <iso_3166_2_entry - code="BF-YAT" name="Yatenga" parent="10"/> - <iso_3166_2_entry - code="BF-ZIR" name="Ziro" parent="06"/> - <iso_3166_2_entry - code="BF-ZON" name="Zondoma" parent="10"/> - <iso_3166_2_entry - code="BF-ZOU" name="Zoundwéogo" parent="07"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bulgaria --> - <iso_3166_country code="BG"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="BG-01" name="Blagoevgrad"/> - <iso_3166_2_entry - code="BG-02" name="Burgas"/> - <iso_3166_2_entry - code="BG-08" name="Dobrich"/> - <iso_3166_2_entry - code="BG-07" name="Gabrovo"/> - <iso_3166_2_entry - code="BG-26" name="Haskovo"/> - <iso_3166_2_entry - code="BG-09" name="Kardzhali"/> - <iso_3166_2_entry - code="BG-10" name="Kyustendil"/> - <iso_3166_2_entry - code="BG-11" name="Lovech"/> - <iso_3166_2_entry - code="BG-12" name="Montana"/> - <iso_3166_2_entry - code="BG-13" name="Pazardzhik"/> - <iso_3166_2_entry - code="BG-14" name="Pernik"/> - <iso_3166_2_entry - code="BG-15" name="Pleven"/> - <iso_3166_2_entry - code="BG-16" name="Plovdiv"/> - <iso_3166_2_entry - code="BG-17" name="Razgrad"/> - <iso_3166_2_entry - code="BG-18" name="Ruse"/> - <iso_3166_2_entry - code="BG-27" name="Shumen"/> - <iso_3166_2_entry - code="BG-19" name="Silistra"/> - <iso_3166_2_entry - code="BG-20" name="Sliven"/> - <iso_3166_2_entry - code="BG-21" name="Smolyan"/> - <iso_3166_2_entry - code="BG-23" name="Sofia"/> - <iso_3166_2_entry - code="BG-22" name="Sofia-Grad"/> - <iso_3166_2_entry - code="BG-24" name="Stara Zagora"/> - <iso_3166_2_entry - code="BG-25" name="Targovishte"/> - <iso_3166_2_entry - code="BG-03" name="Varna"/> - <iso_3166_2_entry - code="BG-04" name="Veliko Tarnovo"/> - <iso_3166_2_entry - code="BG-05" name="Vidin"/> - <iso_3166_2_entry - code="BG-06" name="Vratsa"/> - <iso_3166_2_entry - code="BG-28" name="Yambol"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bahrain --> - <iso_3166_country code="BH"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="BH-13" name="Al Manāmah (Al ‘Āşimah)"/> - <iso_3166_2_entry - code="BH-14" name="Al Janūbīyah"/> - <iso_3166_2_entry - code="BH-15" name="Al Muḩarraq"/> - <iso_3166_2_entry - code="BH-16" name="Al Wusţá"/> - <iso_3166_2_entry - code="BH-17" name="Ash Shamālīyah"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Burundi --> - <iso_3166_country code="BI"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="BI-BB" name="Bubanza"/> - <iso_3166_2_entry - code="BI-BM" name="Bujumbura Mairie"/> - <iso_3166_2_entry - code="BI-BL" name="Bujumbura Rural"/> - <iso_3166_2_entry - code="BI-BR" name="Bururi"/> - <iso_3166_2_entry - code="BI-CA" name="Cankuzo"/> - <iso_3166_2_entry - code="BI-CI" name="Cibitoke"/> - <iso_3166_2_entry - code="BI-GI" name="Gitega"/> - <iso_3166_2_entry - code="BI-KR" name="Karuzi"/> - <iso_3166_2_entry - code="BI-KY" name="Kayanza"/> - <iso_3166_2_entry - code="BI-KI" name="Kirundo"/> - <iso_3166_2_entry - code="BI-MA" name="Makamba"/> - <iso_3166_2_entry - code="BI-MU" name="Muramvya"/> - <iso_3166_2_entry - code="BI-MW" name="Mwaro"/> - <iso_3166_2_entry - code="BI-NG" name="Ngozi"/> - <iso_3166_2_entry - code="BI-RT" name="Rutana"/> - <iso_3166_2_entry - code="BI-RY" name="Ruyigi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Benin --> - <iso_3166_country code="BJ"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="BJ-AL" name="Alibori"/> - <iso_3166_2_entry - code="BJ-AK" name="Atakora"/> - <iso_3166_2_entry - code="BJ-AQ" name="Atlantique"/> - <iso_3166_2_entry - code="BJ-BO" name="Borgou"/> - <iso_3166_2_entry - code="BJ-CO" name="Collines"/> - <iso_3166_2_entry - code="BJ-DO" name="Donga"/> - <iso_3166_2_entry - code="BJ-KO" name="Kouffo"/> - <iso_3166_2_entry - code="BJ-LI" name="Littoral"/> - <iso_3166_2_entry - code="BJ-MO" name="Mono"/> - <iso_3166_2_entry - code="BJ-OU" name="Ouémé"/> - <iso_3166_2_entry - code="BJ-PL" name="Plateau"/> - <iso_3166_2_entry - code="BJ-ZO" name="Zou"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Barthélemy --> - <iso_3166_country code="BL"/> - <!-- Brunei Darussalam --> - <iso_3166_country code="BN"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BN-BE" name="Belait"/> - <iso_3166_2_entry - code="BN-BM" name="Brunei-Muara"/> - <iso_3166_2_entry - code="BN-TE" name="Temburong"/> - <iso_3166_2_entry - code="BN-TU" name="Tutong"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bolivia --> - <iso_3166_country code="BO"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="BO-H" name="Chuquisaca"/> - <iso_3166_2_entry - code="BO-C" name="Cochabamba"/> - <iso_3166_2_entry - code="BO-B" name="El Beni"/> - <iso_3166_2_entry - code="BO-L" name="La Paz"/> - <iso_3166_2_entry - code="BO-O" name="Oruro"/> - <iso_3166_2_entry - code="BO-N" name="Pando"/> - <iso_3166_2_entry - code="BO-P" name="Potosí"/> - <iso_3166_2_entry - code="BO-S" name="Santa Cruz"/> - <iso_3166_2_entry - code="BO-T" name="Tarija"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Brazil --> - <iso_3166_country code="BR"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="BR-AC" name="Acre"/> - <iso_3166_2_entry - code="BR-AL" name="Alagoas"/> - <iso_3166_2_entry - code="BR-AM" name="Amazonas"/> - <iso_3166_2_entry - code="BR-AP" name="Amapá"/> - <iso_3166_2_entry - code="BR-BA" name="Bahia"/> - <iso_3166_2_entry - code="BR-CE" name="Ceará"/> - <iso_3166_2_entry - code="BR-ES" name="Espírito Santo"/> - <iso_3166_2_entry - code="BR-FN" name="Fernando de Noronha"/> - <iso_3166_2_entry - code="BR-GO" name="Goiás"/> - <iso_3166_2_entry - code="BR-MA" name="Maranhão"/> - <iso_3166_2_entry - code="BR-MG" name="Minas Gerais"/> - <iso_3166_2_entry - code="BR-MS" name="Mato Grosso do Sul"/> - <iso_3166_2_entry - code="BR-MT" name="Mato Grosso"/> - <iso_3166_2_entry - code="BR-PA" name="Pará"/> - <iso_3166_2_entry - code="BR-PB" name="Paraíba"/> - <iso_3166_2_entry - code="BR-PE" name="Pernambuco"/> - <iso_3166_2_entry - code="BR-PI" name="Piauí"/> - <iso_3166_2_entry - code="BR-PR" name="Paraná"/> - <iso_3166_2_entry - code="BR-RJ" name="Rio de Janeiro"/> - <iso_3166_2_entry - code="BR-RN" name="Rio Grande do Norte"/> - <iso_3166_2_entry - code="BR-RO" name="Rondônia"/> - <iso_3166_2_entry - code="BR-RR" name="Roraima"/> - <iso_3166_2_entry - code="BR-RS" name="Rio Grande do Sul"/> - <iso_3166_2_entry - code="BR-SC" name="Santa Catarina"/> - <iso_3166_2_entry - code="BR-SE" name="Sergipe"/> - <iso_3166_2_entry - code="BR-SP" name="São Paulo"/> - <iso_3166_2_entry - code="BR-TO" name="Tocantins"/> - </iso_3166_subset> - <iso_3166_subset type="Federal District"> - <iso_3166_2_entry - code="BR-DF" name="Distrito Federal"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bahamas --> - <iso_3166_country code="BS"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BS-AC" name="Acklins Islands"/> - <iso_3166_2_entry - code="BS-BY" name="Berry Islands"/> - <iso_3166_2_entry - code="BS-BI" name="Bimini and Cat Cay"/> - <iso_3166_2_entry - code="BS-BP" name="Black Point"/> - <iso_3166_2_entry - code="BS-CI" name="Cat Island"/> - <iso_3166_2_entry - code="BS-CO" name="Central Abaco"/> - <iso_3166_2_entry - code="BS-CS" name="Central Andros"/> - <iso_3166_2_entry - code="BS-CE" name="Central Eleuthera"/> - <iso_3166_2_entry - code="BS-FP" name="City of Freeport"/> - <iso_3166_2_entry - code="BS-CK" name="Crooked Island and Long Cay"/> - <iso_3166_2_entry - code="BS-EG" name="East Grand Bahama"/> - <iso_3166_2_entry - code="BS-EX" name="Exuma"/> - <iso_3166_2_entry - code="BS-GC" name="Grand Cay"/> - <iso_3166_2_entry - code="BS-GT" name="Green Turtle Cay"/> - <iso_3166_2_entry - code="BS-HI" name="Harbour Island"/> - <iso_3166_2_entry - code="BS-HT" name="Hope Town"/> - <iso_3166_2_entry - code="BS-IN" name="Inagua"/> - <iso_3166_2_entry - code="BS-LI" name="Long Island"/> - <iso_3166_2_entry - code="BS-MC" name="Mangrove Cay"/> - <iso_3166_2_entry - code="BS-MG" name="Mayaguana"/> - <iso_3166_2_entry - code="BS-MI" name="Moore's Island"/> - <iso_3166_2_entry - code="BS-NO" name="North Abaco"/> - <iso_3166_2_entry - code="BS-NS" name="North Andros"/> - <iso_3166_2_entry - code="BS-NE" name="North Eleuthera"/> - <iso_3166_2_entry - code="BS-RI" name="Ragged Island"/> - <iso_3166_2_entry - code="BS-RC" name="Rum Cay"/> - <iso_3166_2_entry - code="BS-SS" name="San Salvador"/> - <iso_3166_2_entry - code="BS-SO" name="South Abaco"/> - <iso_3166_2_entry - code="BS-SA" name="South Andros"/> - <iso_3166_2_entry - code="BS-SE" name="South Eleuthera"/> - <iso_3166_2_entry - code="BS-SW" name="Spanish Wells"/> - <iso_3166_2_entry - code="BS-WG" name="West Grand Bahama"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Bhutan --> - <iso_3166_country code="BT"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BT-33" name="Bumthang"/> - <iso_3166_2_entry - code="BT-12" name="Chhukha"/> - <iso_3166_2_entry - code="BT-22" name="Dagana"/> - <iso_3166_2_entry - code="BT-GA" name="Gasa"/> - <iso_3166_2_entry - code="BT-13" name="Ha"/> - <iso_3166_2_entry - code="BT-44" name="Lhuentse"/> - <iso_3166_2_entry - code="BT-42" name="Monggar"/> - <iso_3166_2_entry - code="BT-11" name="Paro"/> - <iso_3166_2_entry - code="BT-43" name="Pemagatshel"/> - <iso_3166_2_entry - code="BT-23" name="Punakha"/> - <iso_3166_2_entry - code="BT-45" name="Samdrup Jongkha"/> - <iso_3166_2_entry - code="BT-14" name="Samtee"/> - <iso_3166_2_entry - code="BT-31" name="Sarpang"/> - <iso_3166_2_entry - code="BT-15" name="Thimphu"/> - <iso_3166_2_entry - code="BT-41" name="Trashigang"/> - <iso_3166_2_entry - code="BT-TY" name="Trashi Yangtse"/> - <iso_3166_2_entry - code="BT-32" name="Trongsa"/> - <iso_3166_2_entry - code="BT-21" name="Tsirang"/> - <iso_3166_2_entry - code="BT-24" name="Wangdue Phodrang"/> - <iso_3166_2_entry - code="BT-34" name="Zhemgang"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Botswana --> - <iso_3166_country code="BW"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BW-CE" name="Central"/> - <iso_3166_2_entry - code="BW-GH" name="Ghanzi"/> - <iso_3166_2_entry - code="BW-KG" name="Kgalagadi"/> - <iso_3166_2_entry - code="BW-KL" name="Kgatleng"/> - <iso_3166_2_entry - code="BW-KW" name="Kweneng"/> - <iso_3166_2_entry - code="BW-NG" name="Ngamiland"/> - <iso_3166_2_entry - code="BW-NE" name="North-East"/> - <iso_3166_2_entry - code="BW-NW" name="North-West (Botswana)"/> - <iso_3166_2_entry - code="BW-SE" name="South-East"/> - <iso_3166_2_entry - code="BW-SO" name="Southern (Botswana)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Belarus --> - <iso_3166_country code="BY"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="BY-HM" name="Horad Minsk"/> - </iso_3166_subset> - <iso_3166_subset type="Oblast"> - <!-- ISO 3166-2 gives several Romanised versions of the names; here we choose the GOST be version --> - <iso_3166_2_entry - code="BY-BR" name="Brèsckaja voblasc'"/> - <iso_3166_2_entry - code="BY-HO" name="Homel'skaja voblasc'"/> - <iso_3166_2_entry - code="BY-HR" name="Hrodzenskaja voblasc'"/> - <iso_3166_2_entry - code="BY-MA" name="Mahilëuskaja voblasc'"/> - <iso_3166_2_entry - code="BY-MI" name="Minskaja voblasc'"/> - <iso_3166_2_entry - code="BY-VI" name="Vicebskaja voblasc'"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Belize --> - <iso_3166_country code="BZ"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="BZ-BZ" name="Belize"/> - <iso_3166_2_entry - code="BZ-CY" name="Cayo"/> - <iso_3166_2_entry - code="BZ-CZL" name="Corozal"/> - <iso_3166_2_entry - code="BZ-OW" name="Orange Walk"/> - <iso_3166_2_entry - code="BZ-SC" name="Stann Creek"/> - <iso_3166_2_entry - code="BZ-TOL" name="Toledo"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Canada --> - <iso_3166_country code="CA"> - <!-- sub-region codes for Canadian provinces and territories --> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CA-AB" name="Alberta"/> - <iso_3166_2_entry - code="CA-BC" name="British Columbia"/> - <iso_3166_2_entry - code="CA-MB" name="Manitoba"/> - <iso_3166_2_entry - code="CA-NB" name="New Brunswick"/> - <iso_3166_2_entry - code="CA-NL" name="Newfoundland and Labrador"/> - <iso_3166_2_entry - code="CA-NS" name="Nova Scotia"/> - <iso_3166_2_entry - code="CA-ON" name="Ontario"/> - <iso_3166_2_entry - code="CA-PE" name="Prince Edward Island"/> - <iso_3166_2_entry - code="CA-QC" name="Quebec"/> - <iso_3166_2_entry - code="CA-SK" name="Saskatchewan"/> - </iso_3166_subset> - <iso_3166_subset type="Territory"> - <iso_3166_2_entry - code="CA-NT" name="Northwest Territories"/> - <iso_3166_2_entry - code="CA-NU" name="Nunavut"/> - <iso_3166_2_entry - code="CA-YT" name="Yukon Territory"/> - </iso_3166_subset> - </iso_3166_country> - <!-- The Democratic Republic of Congo --> - <iso_3166_country code="CD"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="CD-KN" name="Kinshasa"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CD-BN" name="Bandundu"/> - <iso_3166_2_entry - code="CD-BC" name="Bas-Congo"/> - <iso_3166_2_entry - code="CD-EQ" name="Équateur"/> - <iso_3166_2_entry - code="CD-HC" name="Haut-Congo"/> - <iso_3166_2_entry - code="CD-KW" name="Kasai-Occidental"/> - <iso_3166_2_entry - code="CD-KE" name="Kasai-Oriental"/> - <iso_3166_2_entry - code="CD-KA" name="Katanga"/> - <iso_3166_2_entry - code="CD-MA" name="Maniema"/> - <iso_3166_2_entry - code="CD-NK" name="Nord-Kivu"/> - <iso_3166_2_entry - code="CD-OR" name="Orientale"/> - <iso_3166_2_entry - code="CD-SK" name="Sud-Kivu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Central African Republic --> - <iso_3166_country code="CF"> - <iso_3166_subset type="Commune"> - <iso_3166_2_entry - code="CF-BGF" name="Bangui"/> - </iso_3166_subset> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="CF-BB" name="Bamingui-Bangoran"/> - <iso_3166_2_entry - code="CF-BK" name="Basse-Kotto"/> - <iso_3166_2_entry - code="CF-HK" name="Haute-Kotto"/> - <iso_3166_2_entry - code="CF-HM" name="Haut-Mbomou"/> - <iso_3166_2_entry - code="CF-KG" name="Kémo-Gribingui"/> - <iso_3166_2_entry - code="CF-LB" name="Lobaye"/> - <iso_3166_2_entry - code="CF-HS" name="Haute-Sangha / Mambéré-Kadéï"/> - <iso_3166_2_entry - code="CF-MB" name="Mbomou"/> - <iso_3166_2_entry - code="CF-NM" name="Nana-Mambéré"/> - <iso_3166_2_entry - code="CF-MP" name="Ombella-M'poko"/> - <iso_3166_2_entry - code="CF-UK" name="Ouaka"/> - <iso_3166_2_entry - code="CF-AC" name="Ouham"/> - <iso_3166_2_entry - code="CF-OP" name="Ouham-Pendé"/> - <iso_3166_2_entry - code="CF-VR" name="Vakaga"/> - </iso_3166_subset> - <iso_3166_subset type="Economic Prefecture"> - <iso_3166_2_entry - code="CF-KB" name="Gribingui"/> - <iso_3166_2_entry - code="CF-SE" name="Sangha"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Congo --> - <iso_3166_country code="CG"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CG-11" name="Bouenza"/> - <iso_3166_2_entry - code="CG-8" name="Cuvette"/> - <iso_3166_2_entry - code="CG-15" name="Cuvette-Ouest"/> - <iso_3166_2_entry - code="CG-5" name="Kouilou"/> - <iso_3166_2_entry - code="CG-2" name="Lékoumou"/> - <iso_3166_2_entry - code="CG-7" name="Likouala"/> - <iso_3166_2_entry - code="CG-9" name="Niari"/> - <iso_3166_2_entry - code="CG-14" name="Plateaux"/> - <iso_3166_2_entry - code="CG-12" name="Pool"/> - <iso_3166_2_entry - code="CG-13" name="Sangha"/> - </iso_3166_subset> - <iso_3166_subset type="Capital District"> - <iso_3166_2_entry - code="CG-BZV" name="Brazzaville"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Switzerland --> - <iso_3166_country code="CH"> - <iso_3166_subset type="Canton"> - <iso_3166_2_entry - code="CH-AG" name="Aargau"/> - <iso_3166_2_entry - code="CH-AI" name="Appenzell Innerrhoden"/> - <iso_3166_2_entry - code="CH-AR" name="Appenzell Ausserrhoden"/> - <iso_3166_2_entry - code="CH-BE" name="Bern"/> - <iso_3166_2_entry - code="CH-BL" name="Basel-Landschaft"/> - <iso_3166_2_entry - code="CH-BS" name="Basel-Stadt"/> - <iso_3166_2_entry - code="CH-FR" name="Fribourg"/> - <iso_3166_2_entry - code="CH-GE" name="Genève"/> - <iso_3166_2_entry - code="CH-GL" name="Glarus"/> - <iso_3166_2_entry - code="CH-GR" name="Graubünden"/> - <iso_3166_2_entry - code="CH-JU" name="Jura"/> - <iso_3166_2_entry - code="CH-LU" name="Luzern"/> - <iso_3166_2_entry - code="CH-NE" name="Neuchâtel"/> - <iso_3166_2_entry - code="CH-NW" name="Nidwalden"/> - <iso_3166_2_entry - code="CH-OW" name="Obwalden"/> - <iso_3166_2_entry - code="CH-SG" name="Sankt Gallen"/> - <iso_3166_2_entry - code="CH-SH" name="Schaffhausen"/> - <iso_3166_2_entry - code="CH-SO" name="Solothurn"/> - <iso_3166_2_entry - code="CH-SZ" name="Schwyz"/> - <iso_3166_2_entry - code="CH-TG" name="Thurgau"/> - <iso_3166_2_entry - code="CH-TI" name="Ticino"/> - <iso_3166_2_entry - code="CH-UR" name="Uri"/> - <iso_3166_2_entry - code="CH-VD" name="Vaud"/> - <iso_3166_2_entry - code="CH-VS" name="Valais"/> - <iso_3166_2_entry - code="CH-ZG" name="Zug"/> - <iso_3166_2_entry - code="CH-ZH" name="Zürich"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cote D'ivoire --> - <iso_3166_country code="CI"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CI-06" name="18 Montagnes (Région des)"/> - <iso_3166_2_entry - code="CI-16" name="Agnébi (Région de l')"/> - <iso_3166_2_entry - code="CI-17" name="Bafing (Région du)"/> - <iso_3166_2_entry - code="CI-09" name="Bas-Sassandra (Région du)"/> - <iso_3166_2_entry - code="CI-10" name="Denguélé (Région du)"/> - <iso_3166_2_entry - code="CI-18" name="Fromager (Région du)"/> - <iso_3166_2_entry - code="CI-02" name="Haut-Sassandra (Région du)"/> - <iso_3166_2_entry - code="CI-07" name="Lacs (Région des)"/> - <iso_3166_2_entry - code="CI-01" name="Lagunes (Région des)"/> - <iso_3166_2_entry - code="CI-12" name="Marahoué (Région de la)"/> - <iso_3166_2_entry - code="CI-19" name="Moyen-Cavally (Région du)"/> - <iso_3166_2_entry - code="CI-05" name="Moyen-Comoé (Région du)"/> - <iso_3166_2_entry - code="CI-11" name="Nzi-Comoé (Région)"/> - <iso_3166_2_entry - code="CI-03" name="Savanes (Région des)"/> - <iso_3166_2_entry - code="CI-15" name="Sud-Bandama (Région du)"/> - <iso_3166_2_entry - code="CI-13" name="Sud-Comoé (Région du)"/> - <iso_3166_2_entry - code="CI-04" name="Vallée du Bandama (Région de la)"/> - <iso_3166_2_entry - code="CI-14" name="Worodouqou (Région du)"/> - <iso_3166_2_entry - code="CI-08" name="Zanzan (Région du)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Chile --> - <iso_3166_country code="CL"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CL-AI" name="Aisén del General Carlos Ibáñez del Campo"/> - <iso_3166_2_entry - code="CL-AN" name="Antofagasta"/> - <iso_3166_2_entry - code="CL-AR" name="Araucanía"/> - <iso_3166_2_entry - code="CL-AP" name="Arica y Parinacota"/> - <iso_3166_2_entry - code="CL-AT" name="Atacama"/> - <iso_3166_2_entry - code="CL-BI" name="Bío-Bío"/> - <iso_3166_2_entry - code="CL-CO" name="Coquimbo"/> - <iso_3166_2_entry - code="CL-LI" name="Libertador General Bernardo O'Higgins"/> - <iso_3166_2_entry - code="CL-LL" name="Los Lagos"/> - <iso_3166_2_entry - code="CL-LR" name="Los Ríos"/> - <iso_3166_2_entry - code="CL-MA" name="Magallanes y Antártica Chilena"/> - <iso_3166_2_entry - code="CL-ML" name="Maule"/> - <iso_3166_2_entry - code="CL-RM" name="Región Metropolitana de Santiago"/> - <iso_3166_2_entry - code="CL-TA" name="Tarapacá"/> - <iso_3166_2_entry - code="CL-VS" name="Valparaíso"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cameroon --> - <iso_3166_country code="CM"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CM-AD" name="Adamaoua"/> - <iso_3166_2_entry - code="CM-CE" name="Centre"/> - <iso_3166_2_entry - code="CM-ES" name="East"/> - <iso_3166_2_entry - code="CM-EN" name="Far North"/> - <iso_3166_2_entry - code="CM-LT" name="Littoral"/> - <iso_3166_2_entry - code="CM-NO" name="North"/> - <iso_3166_2_entry - code="CM-NW" name="North-West (Cameroon)"/> - <iso_3166_2_entry - code="CM-SU" name="South"/> - <iso_3166_2_entry - code="CM-SW" name="South-West"/> - <iso_3166_2_entry - code="CM-OU" name="West"/> - </iso_3166_subset> - </iso_3166_country> - <!-- China --> - <iso_3166_country code="CN"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="CN-11" name="Beijing"/> - <iso_3166_2_entry - code="CN-50" name="Chongqing"/> - <iso_3166_2_entry - code="CN-31" name="Shanghai"/> - <iso_3166_2_entry - code="CN-12" name="Tianjin"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CN-34" name="Anhui"/> - <iso_3166_2_entry - code="CN-35" name="Fujian"/> - <iso_3166_2_entry - code="CN-62" name="Gansu"/> - <iso_3166_2_entry - code="CN-44" name="Guangdong"/> - <iso_3166_2_entry - code="CN-52" name="Guizhou"/> - <iso_3166_2_entry - code="CN-46" name="Hainan"/> - <iso_3166_2_entry - code="CN-13" name="Hebei"/> - <iso_3166_2_entry - code="CN-23" name="Heilongjiang"/> - <iso_3166_2_entry - code="CN-41" name="Henan"/> - <iso_3166_2_entry - code="CN-42" name="Hubei"/> - <iso_3166_2_entry - code="CN-43" name="Hunan"/> - <iso_3166_2_entry - code="CN-32" name="Jiangsu"/> - <iso_3166_2_entry - code="CN-36" name="Jiangxi"/> - <iso_3166_2_entry - code="CN-22" name="Jilin"/> - <iso_3166_2_entry - code="CN-21" name="Liaoning"/> - <iso_3166_2_entry - code="CN-63" name="Qinghai"/> - <iso_3166_2_entry - code="CN-61" name="Shaanxi"/> - <iso_3166_2_entry - code="CN-37" name="Shandong"/> - <iso_3166_2_entry - code="CN-14" name="Shanxi"/> - <iso_3166_2_entry - code="CN-51" name="Sichuan"/> - <iso_3166_2_entry - code="CN-71" name="Taiwan"/> - <iso_3166_2_entry - code="CN-53" name="Yunnan"/> - <iso_3166_2_entry - code="CN-33" name="Zhejiang"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous region"> - <iso_3166_2_entry - code="CN-45" name="Guangxi"/> - <iso_3166_2_entry - code="CN-15" name="Nei Mongol"/> - <iso_3166_2_entry - code="CN-64" name="Ningxia"/> - <iso_3166_2_entry - code="CN-65" name="Xinjiang"/> - <iso_3166_2_entry - code="CN-54" name="Xizang"/> - </iso_3166_subset> - <iso_3166_subset type="Special administrative region"> - <iso_3166_2_entry - code="CN-91" name="Xianggang (Hong-Kong)"/> - <iso_3166_2_entry - code="CN-92" name="Aomen (Macau)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Colombia --> - <iso_3166_country code="CO"> - <iso_3166_subset type="Capital district"> - <iso_3166_2_entry - code="CO-DC" name="Distrito Capital de Bogotá"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="CO-AMA" name="Amazonas"/> - <iso_3166_2_entry - code="CO-ANT" name="Antioquia"/> - <iso_3166_2_entry - code="CO-ARA" name="Arauca"/> - <iso_3166_2_entry - code="CO-ATL" name="Atlántico"/> - <iso_3166_2_entry - code="CO-BOL" name="Bolívar"/> - <iso_3166_2_entry - code="CO-BOY" name="Boyacá"/> - <iso_3166_2_entry - code="CO-CAL" name="Caldas"/> - <iso_3166_2_entry - code="CO-CAQ" name="Caquetá"/> - <iso_3166_2_entry - code="CO-CAS" name="Casanare"/> - <iso_3166_2_entry - code="CO-CAU" name="Cauca"/> - <iso_3166_2_entry - code="CO-CES" name="Cesar"/> - <iso_3166_2_entry - code="CO-CHO" name="Chocó"/> - <iso_3166_2_entry - code="CO-COR" name="Córdoba"/> - <iso_3166_2_entry - code="CO-CUN" name="Cundinamarca"/> - <iso_3166_2_entry - code="CO-GUA" name="Guainía"/> - <iso_3166_2_entry - code="CO-GUV" name="Guaviare"/> - <iso_3166_2_entry - code="CO-HUI" name="Huila"/> - <iso_3166_2_entry - code="CO-LAG" name="La Guajira"/> - <iso_3166_2_entry - code="CO-MAG" name="Magdalena"/> - <iso_3166_2_entry - code="CO-MET" name="Meta"/> - <iso_3166_2_entry - code="CO-NAR" name="Nariño"/> - <iso_3166_2_entry - code="CO-NSA" name="Norte de Santander"/> - <iso_3166_2_entry - code="CO-PUT" name="Putumayo"/> - <iso_3166_2_entry - code="CO-QUI" name="Quindío"/> - <iso_3166_2_entry - code="CO-RIS" name="Risaralda"/> - <iso_3166_2_entry - code="CO-SAP" name="San Andrés, Providencia y Santa Catalina"/> - <iso_3166_2_entry - code="CO-SAN" name="Santander"/> - <iso_3166_2_entry - code="CO-SUC" name="Sucre"/> - <iso_3166_2_entry - code="CO-TOL" name="Tolima"/> - <iso_3166_2_entry - code="CO-VAC" name="Valle del Cauca"/> - <iso_3166_2_entry - code="CO-VAU" name="Vaupés"/> - <iso_3166_2_entry - code="CO-VID" name="Vichada"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Costa Rica --> - <iso_3166_country code="CR"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CR-A" name="Alajuela"/> - <iso_3166_2_entry - code="CR-C" name="Cartago"/> - <iso_3166_2_entry - code="CR-G" name="Guanacaste"/> - <iso_3166_2_entry - code="CR-H" name="Heredia"/> - <iso_3166_2_entry - code="CR-L" name="Limón"/> - <iso_3166_2_entry - code="CR-P" name="Puntarenas"/> - <iso_3166_2_entry - code="CR-SJ" name="San José"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cuba --> - <iso_3166_country code="CU"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="CU-09" name="Camagüey"/> - <iso_3166_2_entry - code="CU-08" name="Ciego de Ávila"/> - <iso_3166_2_entry - code="CU-06" name="Cienfuegos"/> - <iso_3166_2_entry - code="CU-03" name="Ciudad de La Habana"/> - <iso_3166_2_entry - code="CU-12" name="Granma"/> - <iso_3166_2_entry - code="CU-14" name="Guantánamo"/> - <iso_3166_2_entry - code="CU-11" name="Holguín"/> - <iso_3166_2_entry - code="CU-02" name="La Habana"/> - <iso_3166_2_entry - code="CU-10" name="Las Tunas"/> - <iso_3166_2_entry - code="CU-04" name="Matanzas"/> - <iso_3166_2_entry - code="CU-01" name="Pinar del Rio"/> - <iso_3166_2_entry - code="CU-07" name="Sancti Spíritus"/> - <iso_3166_2_entry - code="CU-13" name="Santiago de Cuba"/> - <iso_3166_2_entry - code="CU-05" name="Villa Clara"/> - </iso_3166_subset> - <iso_3166_subset type="Special municipality"> - <iso_3166_2_entry - code="CU-99" name="Isla de la Juventud"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cape Verde --> - <iso_3166_country code="CV"> - <iso_3166_subset type="Geographical region"> - <iso_3166_2_entry - code="CV B" name="Ilhas de Barlavento"/> - <iso_3166_2_entry - code="CV S" name="Ilhas de Sotavento"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="CV-BV" name="Boa Vista" parent="B"/> - <iso_3166_2_entry - code="CV-BR" name="Brava" parent="S"/> - <iso_3166_2_entry - code="CV-MA" name="Maio" parent="S"/> - <iso_3166_2_entry - code="CV-MO" name="Mosteiros" parent="S"/> - <iso_3166_2_entry - code="CV-PA" name="Paul" parent="B"/> - <iso_3166_2_entry - code="CV-PN" name="Porto Novo" parent="B"/> - <iso_3166_2_entry - code="CV-PR" name="Praia" parent="S"/> - <iso_3166_2_entry - code="CV-RB" name="Ribeira Brava" parent="B"/> - <iso_3166_2_entry - code="CV-RG" name="Ribeira Grande" parent="B"/> - <iso_3166_2_entry - code="CV-RS" name="Ribeira Grande de Santiago" parent="S"/> - <iso_3166_2_entry - code="CV-SL" name="Sal" parent="B"/> - <iso_3166_2_entry - code="CV-CA" name="Santa Catarina" parent="S"/> - <iso_3166_2_entry - code="CV-CF" name="Santa Catarina de Fogo" parent="S"/> - <iso_3166_2_entry - code="CV-CR" name="Santa Cruz" parent="S"/> - <iso_3166_2_entry - code="CV-SD" name="São Domingos" parent="S"/> - <iso_3166_2_entry - code="CV-SF" name="São Filipe" parent="S"/> - <iso_3166_2_entry - code="CV-SL" name="São Lourenço dos Órgãos" parent="S"/> - <iso_3166_2_entry - code="CV-SM" name="São Miguel" parent="S"/> - <iso_3166_2_entry - code="CV-SS" name="São Salvador do Mundo" parent="S"/> - <iso_3166_2_entry - code="CV-SV" name="São Vicente" parent="B"/> - <iso_3166_2_entry - code="CV-TA" name="Tarrafal" parent="S"/> - <iso_3166_2_entry - code="CV-TS" name="Tarrafal de São Nicolau" parent="S"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cyprus --> - <iso_3166_country code="CY"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="CY-04" name="Ammóchostos"/> - <iso_3166_2_entry - code="CY-06" name="Kerýneia"/> - <iso_3166_2_entry - code="CY-03" name="Lárnaka"/> - <iso_3166_2_entry - code="CY-01" name="Lefkosía"/> - <iso_3166_2_entry - code="CY-02" name="Lemesós"/> - <iso_3166_2_entry - code="CY-05" name="Páfos"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Czech Republic --> - <iso_3166_country code="CZ"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="CZ-JC" name="Jihočeský kraj"/> - <iso_3166_2_entry - code="CZ-JM" name="Jihomoravský kraj"/> - <iso_3166_2_entry - code="CZ-KA" name="Karlovarský kraj"/> - <iso_3166_2_entry - code="CZ-KR" name="Královéhradecký kraj"/> - <iso_3166_2_entry - code="CZ-LI" name="Liberecký kraj"/> - <iso_3166_2_entry - code="CZ-MO" name="Moravskoslezský kraj"/> - <iso_3166_2_entry - code="CZ-OL" name="Olomoucký kraj"/> - <iso_3166_2_entry - code="CZ-PA" name="Pardubický kraj"/> - <iso_3166_2_entry - code="CZ-PL" name="Plzeňský kraj"/> - <iso_3166_2_entry - code="CZ-PR" name="Praha, hlavní město"/> - <iso_3166_2_entry - code="CZ-ST" name="Středočeský kraj"/> - <iso_3166_2_entry - code="CZ-US" name="Ústecký kraj"/> - <iso_3166_2_entry - code="CZ-VY" name="Vysočina"/> - <iso_3166_2_entry - code="CZ-ZL" name="Zlínský kraj"/> - </iso_3166_subset> - <iso_3166_subset type="district"> - <iso_3166_2_entry - code="CZ-201" name="Benešov" parent="ST"/> - <iso_3166_2_entry - code="CZ-202" name="Beroun" parent="ST"/> - <iso_3166_2_entry - code="CZ-621" name="Blansko" parent="JM"/> - <iso_3166_2_entry - code="CZ-622" name="Brno-město" parent="JM"/> - <iso_3166_2_entry - code="CZ-623" name="Brno-venkov" parent="JM"/> - <iso_3166_2_entry - code="CZ-801" name="Bruntál" parent="MO"/> - <iso_3166_2_entry - code="CZ-624" name="Břeclav" parent="JM"/> - <iso_3166_2_entry - code="CZ-511" name="Česká Lípa" parent="LI"/> - <iso_3166_2_entry - code="CZ-311" name="České Budějovice" parent="JC"/> - <iso_3166_2_entry - code="CZ-312" name="Český Krumlov" parent="JC"/> - <iso_3166_2_entry - code="CZ-421" name="Děčín" parent="US"/> - <iso_3166_2_entry - code="CZ-321" name="Domažlice" parent="PL"/> - <iso_3166_2_entry - code="CZ-802" name="Frýdek Místek" parent="MO"/> - <iso_3166_2_entry - code="CZ-611" name="Havlíčkův Brod" parent="VY"/> - <iso_3166_2_entry - code="CZ-625" name="Hodonín" parent="JM"/> - <iso_3166_2_entry - code="CZ-521" name="Hradec Králové" parent="KR"/> - <iso_3166_2_entry - code="CZ-411" name="Cheb" parent="KA"/> - <iso_3166_2_entry - code="CZ-422" name="Chomutov" parent="US"/> - <iso_3166_2_entry - code="CZ-531" name="Chrudim" parent="PA"/> - <iso_3166_2_entry - code="CZ-512" name="Jablonec nad Nisou" parent="LI"/> - <iso_3166_2_entry - code="CZ-711" name="Jeseník" parent="OL"/> - <iso_3166_2_entry - code="CZ-522" name="Jičín" parent="KR"/> - <iso_3166_2_entry - code="CZ-612" name="Jihlava" parent="VY"/> - <iso_3166_2_entry - code="CZ-313" name="Jindřichův Hradec" parent="JC"/> - <iso_3166_2_entry - code="CZ-412" name="Karlovy Vary" parent="KA"/> - <iso_3166_2_entry - code="CZ-803" name="Karviná" parent="MO"/> - <iso_3166_2_entry - code="CZ-203" name="Kladno" parent="ST"/> - <iso_3166_2_entry - code="CZ-322" name="Klatovy" parent="PL"/> - <iso_3166_2_entry - code="CZ-204" name="Kolín" parent="ST"/> - <iso_3166_2_entry - code="CZ-721" name="Kromĕříž" parent="ZL"/> - <iso_3166_2_entry - code="CZ-205" name="Kutná Hora" parent="ST"/> - <iso_3166_2_entry - code="CZ-513" name="Liberec" parent="LI"/> - <iso_3166_2_entry - code="CZ-423" name="Litoměřice" parent="US"/> - <iso_3166_2_entry - code="CZ-424" name="Louny" parent="US"/> - <iso_3166_2_entry - code="CZ-206" name="Mělník" parent="ST"/> - <iso_3166_2_entry - code="CZ-207" name="Mladá Boleslav" parent="ST"/> - <iso_3166_2_entry - code="CZ-425" name="Most" parent="US"/> - <iso_3166_2_entry - code="CZ-523" name="Náchod" parent="KR"/> - <iso_3166_2_entry - code="CZ-804" name="Nový Jičín" parent="MO"/> - <iso_3166_2_entry - code="CZ-208" name="Nymburk" parent="ST"/> - <iso_3166_2_entry - code="CZ-712" name="Olomouc" parent="OL"/> - <iso_3166_2_entry - code="CZ-805" name="Opava" parent="MO"/> - <iso_3166_2_entry - code="CZ-806" name="Ostrava město" parent="MO"/> - <iso_3166_2_entry - code="CZ-532" name="Pardubice" parent="PA"/> - <iso_3166_2_entry - code="CZ-613" name="Pelhřimov" parent="VY"/> - <iso_3166_2_entry - code="CZ-314" name="Písek" parent="JC"/> - <iso_3166_2_entry - code="CZ-324" name="Plzeň jih" parent="PL"/> - <iso_3166_2_entry - code="CZ-323" name="Plzeň město" parent="PL"/> - <iso_3166_2_entry - code="CZ-325" name="Plzeň sever" parent="PL"/> - <iso_3166_2_entry - code="CZ-101" name="Praha 1" parent="PR"/> - <iso_3166_2_entry - code="CZ-102" name="Praha 2" parent="PR"/> - <iso_3166_2_entry - code="CZ-103" name="Praha 3" parent="PR"/> - <iso_3166_2_entry - code="CZ-104" name="Praha 4" parent="PR"/> - <iso_3166_2_entry - code="CZ-105" name="Praha 5" parent="PR"/> - <iso_3166_2_entry - code="CZ-106" name="Praha 6" parent="PR"/> - <iso_3166_2_entry - code="CZ-107" name="Praha 7" parent="PR"/> - <iso_3166_2_entry - code="CZ-108" name="Praha 8" parent="PR"/> - <iso_3166_2_entry - code="CZ-109" name="Praha 9" parent="PR"/> - <iso_3166_2_entry - code="CZ-10A" name="Praha 10" parent="PR"/> - <iso_3166_2_entry - code="CZ-10B" name="Praha 11" parent="PR"/> - <iso_3166_2_entry - code="CZ-10C" name="Praha 12" parent="PR"/> - <iso_3166_2_entry - code="CZ-10D" name="Praha 13" parent="PR"/> - <iso_3166_2_entry - code="CZ-10E" name="Praha 14" parent="PR"/> - <iso_3166_2_entry - code="CZ-10F" name="Praha 15" parent="PR"/> - <iso_3166_2_entry - code="CZ-209" name="Praha východ" parent="ST"/> - <iso_3166_2_entry - code="CZ-20A" name="Praha západ" parent="ST"/> - <iso_3166_2_entry - code="CZ-315" name="Prachatice" parent="JC"/> - <iso_3166_2_entry - code="CZ-713" name="Prostĕjov" parent="OL"/> - <iso_3166_2_entry - code="CZ-714" name="Přerov" parent="OL"/> - <iso_3166_2_entry - code="CZ-20B" name="Příbram" parent="ST"/> - <iso_3166_2_entry - code="CZ-20C" name="Rakovník" parent="ST"/> - <iso_3166_2_entry - code="CZ-326" name="Rokycany" parent="PL"/> - <iso_3166_2_entry - code="CZ-524" name="Rychnov nad Kněžnou" parent="KR"/> - <iso_3166_2_entry - code="CZ-514" name="Semily" parent="LI"/> - <iso_3166_2_entry - code="CZ-413" name="Sokolov" parent="KA"/> - <iso_3166_2_entry - code="CZ-316" name="Strakonice" parent="JC"/> - <iso_3166_2_entry - code="CZ-533" name="Svitavy" parent="PA"/> - <iso_3166_2_entry - code="CZ-715" name="Šumperk" parent="OL"/> - <iso_3166_2_entry - code="CZ-317" name="Tábor" parent="JC"/> - <iso_3166_2_entry - code="CZ-327" name="Tachov" parent="PL"/> - <iso_3166_2_entry - code="CZ-426" name="Teplice" parent="US"/> - <iso_3166_2_entry - code="CZ-525" name="Trutnov" parent="KR"/> - <iso_3166_2_entry - code="CZ-614" name="Třebíč" parent="VY"/> - <iso_3166_2_entry - code="CZ-722" name="Uherské Hradištĕ" parent="ZL"/> - <iso_3166_2_entry - code="CZ-427" name="Ústí nad Labem" parent="US"/> - <iso_3166_2_entry - code="CZ-534" name="Ústí nad Orlicí" parent="PA"/> - <iso_3166_2_entry - code="CZ-723" name="Vsetín" parent="ZL"/> - <iso_3166_2_entry - code="CZ-626" name="Vyškov" parent="JM"/> - <iso_3166_2_entry - code="CZ-724" name="Zlín" parent="ZL"/> - <iso_3166_2_entry - code="CZ-627" name="Znojmo" parent="JM"/> - <iso_3166_2_entry - code="CZ-615" name="Žd’ár nad Sázavou" parent="VY"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Germany --> - <iso_3166_country code="DE"> - <iso_3166_subset type="State"> - <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> - <iso_3166_2_entry - code="DE-BW" name="Baden-Württemberg"/> - <iso_3166_2_entry - code="DE-BY" name="Bayern"/> - <iso_3166_2_entry - code="DE-HB" name="Bremen"/> - <iso_3166_2_entry - code="DE-HH" name="Hamburg"/> - <iso_3166_2_entry - code="DE-HE" name="Hessen"/> - <iso_3166_2_entry - code="DE-NI" name="Niedersachsen"/> - <iso_3166_2_entry - code="DE-NW" name="Nordrhein-Westfalen"/> - <iso_3166_2_entry - code="DE-RP" name="Rheinland-Pfalz"/> - <iso_3166_2_entry - code="DE-SL" name="Saarland"/> - <iso_3166_2_entry - code="DE-SH" name="Schleswig-Holstein"/> - <iso_3166_2_entry - code="DE-BE" name="Berlin"/> - <iso_3166_2_entry - code="DE-BB" name="Brandenburg"/> - <iso_3166_2_entry - code="DE-MV" name="Mecklenburg-Vorpommern"/> - <iso_3166_2_entry - code="DE-SN" name="Sachsen"/> - <iso_3166_2_entry - code="DE-ST" name="Sachsen-Anhalt"/> - <iso_3166_2_entry - code="DE-TH" name="Thüringen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Djibouti --> - <iso_3166_country code="DJ"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="DJ-AS" name="Ali Sabieh"/> - <iso_3166_2_entry - code="DJ-AR" name="Arta"/> - <iso_3166_2_entry - code="DJ-DI" name="Dikhil"/> - <iso_3166_2_entry - code="DJ-OB" name="Obock"/> - <iso_3166_2_entry - code="DJ-TA" name="Tadjourah"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="DJ-DJ" name="Djibouti"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Denmark --> - <iso_3166_country code="DK"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="DK-81" name="Nordjylland"/> - <iso_3166_2_entry - code="DK-82" name="Midtjylland"/> - <iso_3166_2_entry - code="DK-83" name="Syddanmark"/> - <iso_3166_2_entry - code="DK-84" name="Hovedstaden"/> - <iso_3166_2_entry - code="DK-85" name="Sjælland"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Dominica --> - <iso_3166_country code="DM"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="DM-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="DM-03" name="Saint David"/> - <iso_3166_2_entry - code="DM-04" name="Saint George"/> - <iso_3166_2_entry - code="DM-05" name="Saint John"/> - <iso_3166_2_entry - code="DM-06" name="Saint Joseph"/> - <iso_3166_2_entry - code="DM-07" name="Saint Luke"/> - <iso_3166_2_entry - code="DM-08" name="Saint Mark"/> - <iso_3166_2_entry - code="DM-09" name="Saint Patrick"/> - <iso_3166_2_entry - code="DM-10" name="Saint Paul"/> - <iso_3166_2_entry - code="DM-01" name="Saint Peter"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Dominican Republic --> - <iso_3166_country code="DO"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="DO-01" name="Distrito Nacional (Santo Domingo)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="DO-02" name="Azua"/> - <iso_3166_2_entry - code="DO-03" name="Bahoruco"/> - <iso_3166_2_entry - code="DO-04" name="Barahona"/> - <iso_3166_2_entry - code="DO-05" name="Dajabón"/> - <iso_3166_2_entry - code="DO-06" name="Duarte"/> - <iso_3166_2_entry - code="DO-08" name="El Seybo [El Seibo]"/> - <iso_3166_2_entry - code="DO-09" name="Espaillat"/> - <iso_3166_2_entry - code="DO-30" name="Hato Mayor"/> - <iso_3166_2_entry - code="DO-10" name="Independencia"/> - <iso_3166_2_entry - code="DO-11" name="La Altagracia"/> - <iso_3166_2_entry - code="DO-07" name="La Estrelleta [Elías Piña]"/> - <iso_3166_2_entry - code="DO-12" name="La Romana"/> - <iso_3166_2_entry - code="DO-13" name="La Vega"/> - <iso_3166_2_entry - code="DO-14" name="María Trinidad Sánchez"/> - <iso_3166_2_entry - code="DO-28" name="Monseñor Nouel"/> - <iso_3166_2_entry - code="DO-15" name="Monte Cristi"/> - <iso_3166_2_entry - code="DO-29" name="Monte Plata"/> - <iso_3166_2_entry - code="DO-16" name="Pedernales"/> - <iso_3166_2_entry - code="DO-17" name="Peravia"/> - <iso_3166_2_entry - code="DO-18" name="Puerto Plata"/> - <iso_3166_2_entry - code="DO-19" name="Salcedo"/> - <iso_3166_2_entry - code="DO-20" name="Samaná"/> - <iso_3166_2_entry - code="DO-21" name="San Cristóbal"/> - <iso_3166_2_entry - code="DO-22" name="San Juan"/> - <iso_3166_2_entry - code="DO-23" name="San Pedro de Macorís"/> - <iso_3166_2_entry - code="DO-24" name="Sánchez Ramírez"/> - <iso_3166_2_entry - code="DO-25" name="Santiago"/> - <iso_3166_2_entry - code="DO-26" name="Santiago Rodríguez"/> - <iso_3166_2_entry - code="DO-27" name="Valverde"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Algeria --> - <iso_3166_country code="DZ"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="DZ-01" name="Adrar"/> - <iso_3166_2_entry - code="DZ-44" name="Aïn Defla"/> - <iso_3166_2_entry - code="DZ-46" name="Aïn Témouchent"/> - <iso_3166_2_entry - code="DZ-16" name="Alger"/> - <iso_3166_2_entry - code="DZ-23" name="Annaba"/> - <iso_3166_2_entry - code="DZ-05" name="Batna"/> - <iso_3166_2_entry - code="DZ-08" name="Béchar"/> - <iso_3166_2_entry - code="DZ-06" name="Béjaïa"/> - <iso_3166_2_entry - code="DZ-07" name="Biskra"/> - <iso_3166_2_entry - code="DZ-09" name="Blida"/> - <iso_3166_2_entry - code="DZ-34" name="Bordj Bou Arréridj"/> - <iso_3166_2_entry - code="DZ-10" name="Bouira"/> - <iso_3166_2_entry - code="DZ-35" name="Boumerdès"/> - <iso_3166_2_entry - code="DZ-02" name="Chlef"/> - <iso_3166_2_entry - code="DZ-25" name="Constantine"/> - <iso_3166_2_entry - code="DZ-17" name="Djelfa"/> - <iso_3166_2_entry - code="DZ-32" name="El Bayadh"/> - <iso_3166_2_entry - code="DZ-39" name="El Oued"/> - <iso_3166_2_entry - code="DZ-36" name="El Tarf"/> - <iso_3166_2_entry - code="DZ-47" name="Ghardaïa"/> - <iso_3166_2_entry - code="DZ-24" name="Guelma"/> - <iso_3166_2_entry - code="DZ-33" name="Illizi"/> - <iso_3166_2_entry - code="DZ-18" name="Jijel"/> - <iso_3166_2_entry - code="DZ-40" name="Khenchela"/> - <iso_3166_2_entry - code="DZ-03" name="Laghouat"/> - <iso_3166_2_entry - code="DZ-29" name="Mascara"/> - <iso_3166_2_entry - code="DZ-26" name="Médéa"/> - <iso_3166_2_entry - code="DZ-43" name="Mila"/> - <iso_3166_2_entry - code="DZ-27" name="Mostaganem"/> - <iso_3166_2_entry - code="DZ-28" name="Msila"/> - <iso_3166_2_entry - code="DZ-45" name="Naama"/> - <iso_3166_2_entry - code="DZ-31" name="Oran"/> - <iso_3166_2_entry - code="DZ-30" name="Ouargla"/> - <iso_3166_2_entry - code="DZ-04" name="Oum el Bouaghi"/> - <iso_3166_2_entry - code="DZ-48" name="Relizane"/> - <iso_3166_2_entry - code="DZ-20" name="Saïda"/> - <iso_3166_2_entry - code="DZ-19" name="Sétif"/> - <iso_3166_2_entry - code="DZ-22" name="Sidi Bel Abbès"/> - <iso_3166_2_entry - code="DZ-21" name="Skikda"/> - <iso_3166_2_entry - code="DZ-41" name="Souk Ahras"/> - <iso_3166_2_entry - code="DZ-11" name="Tamanghasset"/> - <iso_3166_2_entry - code="DZ-12" name="Tébessa"/> - <iso_3166_2_entry - code="DZ-14" name="Tiaret"/> - <iso_3166_2_entry - code="DZ-37" name="Tindouf"/> - <iso_3166_2_entry - code="DZ-42" name="Tipaza"/> - <iso_3166_2_entry - code="DZ-38" name="Tissemsilt"/> - <iso_3166_2_entry - code="DZ-15" name="Tizi Ouzou"/> - <iso_3166_2_entry - code="DZ-13" name="Tlemcen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ecuador --> - <iso_3166_country code="EC"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="EC-A" name="Azuay"/> - <iso_3166_2_entry - code="EC-B" name="Bolívar"/> - <iso_3166_2_entry - code="EC-F" name="Cañar"/> - <iso_3166_2_entry - code="EC-C" name="Carchi"/> - <iso_3166_2_entry - code="EC-X" name="Cotopaxi"/> - <iso_3166_2_entry - code="EC-H" name="Chimborazo"/> - <iso_3166_2_entry - code="EC-O" name="El Oro"/> - <iso_3166_2_entry - code="EC-E" name="Esmeraldas"/> - <iso_3166_2_entry - code="EC-W" name="Galápagos"/> - <iso_3166_2_entry - code="EC-G" name="Guayas"/> - <iso_3166_2_entry - code="EC-I" name="Imbabura"/> - <iso_3166_2_entry - code="EC-L" name="Loja"/> - <iso_3166_2_entry - code="EC-R" name="Los Ríos"/> - <iso_3166_2_entry - code="EC-M" name="Manabí"/> - <iso_3166_2_entry - code="EC-S" name="Morona-Santiago"/> - <iso_3166_2_entry - code="EC-N" name="Napo"/> - <iso_3166_2_entry - code="EC-D" name="Orellana"/> - <iso_3166_2_entry - code="EC-Y" name="Pastaza"/> - <iso_3166_2_entry - code="EC-P" name="Pichincha"/> - <iso_3166_2_entry - code="EC-SE" name="Santa Elena"/> - <iso_3166_2_entry - code="EC-SD" name="Santo Domingo de los Tsáchilas"/> - <iso_3166_2_entry - code="EC-U" name="Sucumbíos"/> - <iso_3166_2_entry - code="EC-T" name="Tungurahua"/> - <iso_3166_2_entry - code="EC-Z" name="Zamora-Chinchipe"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Estonia --> - <iso_3166_country code="EE"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="EE-37" name="Harjumaa"/> - <iso_3166_2_entry - code="EE-39" name="Hiiumaa"/> - <iso_3166_2_entry - code="EE-44" name="Ida-Virumaa"/> - <iso_3166_2_entry - code="EE-49" name="Jõgevamaa"/> - <iso_3166_2_entry - code="EE-51" name="Järvamaa"/> - <iso_3166_2_entry - code="EE-57" name="Läänemaa"/> - <iso_3166_2_entry - code="EE-59" name="Lääne-Virumaa"/> - <iso_3166_2_entry - code="EE-65" name="Põlvamaa"/> - <iso_3166_2_entry - code="EE-67" name="Pärnumaa"/> - <iso_3166_2_entry - code="EE-70" name="Raplamaa"/> - <iso_3166_2_entry - code="EE-74" name="Saaremaa"/> - <iso_3166_2_entry - code="EE-78" name="Tartumaa"/> - <iso_3166_2_entry - code="EE-82" name="Valgamaa"/> - <iso_3166_2_entry - code="EE-84" name="Viljandimaa"/> - <iso_3166_2_entry - code="EE-86" name="Võrumaa"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Egypt --> - <iso_3166_country code="EG"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="EG-DK" name="Ad Daqahlīyah"/> - <iso_3166_2_entry - code="EG-BA" name="Al Bahr al Ahmar"/> - <iso_3166_2_entry - code="EG-BH" name="Al Buhayrah"/> - <iso_3166_2_entry - code="EG-FYM" name="Al Fayyūm"/> - <iso_3166_2_entry - code="EG-GH" name="Al Gharbīyah"/> - <iso_3166_2_entry - code="EG-ALX" name="Al Iskandarīyah"/> - <iso_3166_2_entry - code="EG-IS" name="Al Ismā`īlīyah"/> - <iso_3166_2_entry - code="EG-GZ" name="Al Jīzah"/> - <iso_3166_2_entry - code="EG-MNF" name="Al Minūfīyah"/> - <iso_3166_2_entry - code="EG-MN" name="Al Minyā"/> - <iso_3166_2_entry - code="EG-C" name="Al Qāhirah"/> - <iso_3166_2_entry - code="EG-KB" name="Al Qalyūbīyah"/> - <iso_3166_2_entry - code="EG-WAD" name="Al Wādī al Jadīd"/> - <iso_3166_2_entry - code="EG-SU" name="As Sādis min Uktūbar"/> - <iso_3166_2_entry - code="EG-SHR" name="Ash Sharqīyah"/> - <iso_3166_2_entry - code="EG-SUZ" name="As Suways"/> - <iso_3166_2_entry - code="EG-ASN" name="Aswān"/> - <iso_3166_2_entry - code="EG-AST" name="Asyūt"/> - <iso_3166_2_entry - code="EG-BNS" name="Banī Suwayf"/> - <iso_3166_2_entry - code="EG-PTS" name="Būr Sa`īd"/> - <iso_3166_2_entry - code="EG-DT" name="Dumyāt"/> - <iso_3166_2_entry - code="EG-HU" name="Ḩulwān"/> - <iso_3166_2_entry - code="EG-JS" name="Janūb Sīnā'"/> - <iso_3166_2_entry - code="EG-KFS" name="Kafr ash Shaykh"/> - <iso_3166_2_entry - code="EG-MT" name="Matrūh"/> - <iso_3166_2_entry - code="EG-KN" name="Qinā"/> - <iso_3166_2_entry - code="EG-SIN" name="Shamal Sīnā'"/> - <iso_3166_2_entry - code="EG-SHG" name="Sūhāj"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Eritrea --> - <iso_3166_country code="ER"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ER-AN" name="Anseba"/> - <iso_3166_2_entry - code="ER-DU" name="Debub"/> - <iso_3166_2_entry - code="ER-DK" name="Debubawi Keyih Bahri [Debub-Keih-Bahri]"/> - <iso_3166_2_entry - code="ER-GB" name="Gash-Barka"/> - <iso_3166_2_entry - code="ER-MA" name="Maakel [Maekel]"/> - <iso_3166_2_entry - code="ER-SK" name="Semenawi Keyih Bahri [Semien-Keih-Bahri]"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Spain --> - <iso_3166_country code="ES"> - <iso_3166_subset type="Autonomous community"> - <iso_3166_2_entry - code="ES-AN" name="Andalucía"/> - <iso_3166_2_entry - code="ES-AR" name="Aragón"/> - <iso_3166_2_entry - code="ES-AS" name="Asturias, Principado de"/> - <iso_3166_2_entry - code="ES-CN" name="Canarias"/> - <iso_3166_2_entry - code="ES-CB" name="Cantabria"/> - <iso_3166_2_entry - code="ES-CM" name="Castilla-La Mancha"/> - <iso_3166_2_entry - code="ES-CL" name="Castilla y León"/> - <iso_3166_2_entry - code="ES-CT" name="Catalunya"/> - <iso_3166_2_entry - code="ES-EX" name="Extremadura"/> - <iso_3166_2_entry - code="ES-GA" name="Galicia"/> - <iso_3166_2_entry - code="ES-PM" name="Illes Balears"/> - <iso_3166_2_entry - code="ES-RI" name="La Rioja"/> - <iso_3166_2_entry - code="ES-MD" name="Madrid, Comunidad de"/> - <iso_3166_2_entry - code="ES-MC" name="Murcia, Región de"/> - <iso_3166_2_entry - code="ES-NC" name="Navarra, Comunidad Foral de / Nafarroako Foru Komunitatea"/> - <iso_3166_2_entry - code="ES-PV" name="País Vasco / Euskal Herria"/> - <iso_3166_2_entry - code="ES-VC" name="Valenciana, Comunidad / Valenciana, Comunitat "/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ES-C" name="A Coruña" parent="GA"/> - <iso_3166_2_entry - code="ES-VI" name="Álava" parent="PV"/> - <iso_3166_2_entry - code="ES-AB" name="Albacete" parent="CM"/> - <iso_3166_2_entry - code="ES-A" name="Alicante" parent="VC"/> - <iso_3166_2_entry - code="ES-AL" name="Almería" parent="AN"/> - <iso_3166_2_entry - code="ES-O" name="Asturias" parent="AS"/> - <iso_3166_2_entry - code="ES-AV" name="Ávila" parent="CL"/> - <iso_3166_2_entry - code="ES-BA" name="Badajoz" parent="EX"/> - <iso_3166_2_entry - code="ES-IB" name="Balears" parent="IB"/> - <iso_3166_2_entry - code="ES-B" name="Barcelona" parent="CT"/> - <iso_3166_2_entry - code="ES-BU" name="Burgos" parent="CL"/> - <iso_3166_2_entry - code="ES-CC" name="Cáceres" parent="EX"/> - <iso_3166_2_entry - code="ES-CA" name="Cádiz" parent="AN"/> - <iso_3166_2_entry - code="ES-S" name="Cantabria" parent="CB"/> - <iso_3166_2_entry - code="ES-CS" name="Castellón" parent="VC"/> - <iso_3166_2_entry - code="ES-CR" name="Ciudad Real" parent="CM"/> - <iso_3166_2_entry - code="ES-CO" name="Córdoba" parent="AN"/> - <iso_3166_2_entry - code="ES-CU" name="Cuenca" parent="CM"/> - <iso_3166_2_entry - code="ES-GI" name="Girona" parent="CT"/> - <iso_3166_2_entry - code="ES-GR" name="Granada" parent="AN"/> - <iso_3166_2_entry - code="ES-GU" name="Guadalajara" parent="CM"/> - <iso_3166_2_entry - code="ES-SS" name="Guipúzcoa / Gipuzkoa" parent="PV"/> - <iso_3166_2_entry - code="ES-H" name="Huelva" parent="AN"/> - <iso_3166_2_entry - code="ES-HU" name="Huesca" parent="AR"/> - <iso_3166_2_entry - code="ES-J" name="Jaén" parent="AN"/> - <iso_3166_2_entry - code="ES-LO" name="La Rioja" parent="RI"/> - <iso_3166_2_entry - code="ES-GC" name="Las Palmas" parent="CN"/> - <iso_3166_2_entry - code="ES-LE" name="León" parent="CL"/> - <iso_3166_2_entry - code="ES-L" name="Lleida" parent="CT"/> - <iso_3166_2_entry - code="ES-LU" name="Lugo" parent="GA"/> - <iso_3166_2_entry - code="ES-M" name="Madrid" parent="MD"/> - <iso_3166_2_entry - code="ES-MA" name="Málaga" parent="AN"/> - <iso_3166_2_entry - code="ES-MU" name="Murcia" parent="MC"/> - <iso_3166_2_entry - code="ES-NA" name="Navarra / Nafarroa" parent="NC"/> - <iso_3166_2_entry - code="ES-OR" name="Ourense" parent="GA"/> - <iso_3166_2_entry - code="ES-P" name="Palencia" parent="CL"/> - <iso_3166_2_entry - code="ES-PO" name="Pontevedra" parent="GA"/> - <iso_3166_2_entry - code="ES-SA" name="Salamanca" parent="CL"/> - <iso_3166_2_entry - code="ES-TF" name="Santa Cruz de Tenerife" parent="CN"/> - <iso_3166_2_entry - code="ES-SG" name="Segovia" parent="CL"/> - <iso_3166_2_entry - code="ES-SE" name="Sevilla" parent="AN"/> - <iso_3166_2_entry - code="ES-SO" name="Soria" parent="CL"/> - <iso_3166_2_entry - code="ES-T" name="Tarragona" parent="CT"/> - <iso_3166_2_entry - code="ES-TE" name="Teruel" parent="AR"/> - <iso_3166_2_entry - code="ES-TO" name="Toledo" parent="CM"/> - <iso_3166_2_entry - code="ES-V" name="Valencia / València" parent="VC"/> - <iso_3166_2_entry - code="ES-VA" name="Valladolid" parent="CL"/> - <iso_3166_2_entry - code="ES-BI" name="Vizcayaa / Bizkaia" parent="PV"/> - <iso_3166_2_entry - code="ES-ZA" name="Zamora" parent="CL"/> - <iso_3166_2_entry - code="ES-Z" name="Zaragoza" parent="AR"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous city"> - <iso_3166_2_entry - code="ES-CE" name="Ceuta"/> - <iso_3166_2_entry - code="ES-ML" name="Melilla"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ethiopia --> - <iso_3166_country code="ET"> - <iso_3166_subset type="Administration"> - <iso_3166_2_entry - code="ET-AA" name="Ādīs Ābeba"/> - <iso_3166_2_entry - code="ET-DD" name="Dirē Dawa"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="ET-AF" name="Āfar"/> - <iso_3166_2_entry - code="ET-AM" name="Āmara"/> - <iso_3166_2_entry - code="ET-BE" name="Bīnshangul Gumuz"/> - <iso_3166_2_entry - code="ET-GA" name="Gambēla Hizboch"/> - <iso_3166_2_entry - code="ET-HA" name="Hārerī Hizb"/> - <iso_3166_2_entry - code="ET-OR" name="Oromīya"/> - <iso_3166_2_entry - code="ET-SO" name="Sumalē"/> - <iso_3166_2_entry - code="ET-TI" name="Tigray"/> - <iso_3166_2_entry - code="ET-SN" name="YeDebub Bihēroch Bihēreseboch na Hizboch"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Finland --> - <iso_3166_country code="FI"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="FI-AL" name="Ahvenanmaan lääni"/> - <iso_3166_2_entry - code="FI-ES" name="Etelä-Suomen lääni"/> - <iso_3166_2_entry - code="FI-IS" name="Itä-Suomen lääni"/> - <iso_3166_2_entry - code="FI-LL" name="Lapin lääni"/> - <iso_3166_2_entry - code="FI-LS" name="Länsi-Suomen lääni"/> - <iso_3166_2_entry - code="FI-OL" name="Oulun lääni"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Fiji --> - <iso_3166_country code="FJ"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="FJ-C" name="Central"/> - <iso_3166_2_entry - code="FJ-E" name="Eastern"/> - <iso_3166_2_entry - code="FJ-N" name="Northern"/> - <iso_3166_2_entry - code="FJ-W" name="Western"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="FJ-R" name="Rotuma"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Federated States of Micronesia --> - <iso_3166_country code="FM"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="FM-TRK" name="Chuuk"/> - <iso_3166_2_entry - code="FM-KSA" name="Kosrae"/> - <iso_3166_2_entry - code="FM-PNI" name="Pohnpei"/> - <iso_3166_2_entry - code="FM-YAP" name="Yap"/> - </iso_3166_subset> - </iso_3166_country> - <!-- France --> - <iso_3166_country code="FR"> - <iso_3166_subset type="Metropolitan region"> - <iso_3166_2_entry - code="FR-A" name="Alsace"/> - <iso_3166_2_entry - code="FR-B" name="Aquitaine"/> - <iso_3166_2_entry - code="FR-C" name="Auvergne"/> - <iso_3166_2_entry - code="FR-P" name="Basse-Normandie"/> - <iso_3166_2_entry - code="FR-D" name="Bourgogne"/> - <iso_3166_2_entry - code="FR-E" name="Bretagne"/> - <iso_3166_2_entry - code="FR-F" name="Centre"/> - <iso_3166_2_entry - code="FR-G" name="Champagne-Ardenne"/> - <iso_3166_2_entry - code="FR-H" name="Corse"/> - <iso_3166_2_entry - code="FR-I" name="Franche-Comté"/> - <iso_3166_2_entry - code="FR-Q" name="Haute-Normandie"/> - <iso_3166_2_entry - code="FR-J" name="Île-de-France"/> - <iso_3166_2_entry - code="FR-K" name="Languedoc-Roussillon"/> - <iso_3166_2_entry - code="FR-L" name="Limousin"/> - <iso_3166_2_entry - code="FR-M" name="Lorraine"/> - <iso_3166_2_entry - code="FR-N" name="Midi-Pyrénées"/> - <iso_3166_2_entry - code="FR-O" name="Nord - Pas-de-Calais"/> - <iso_3166_2_entry - code="FR-R" name="Pays de la Loire"/> - <iso_3166_2_entry - code="FR-S" name="Picardie"/> - <iso_3166_2_entry - code="FR-T" name="Poitou-Charentes"/> - <iso_3166_2_entry - code="FR-U" name="Provence-Alpes-Côte d'Azur"/> - <iso_3166_2_entry - code="FR-V" name="Rhône-Alpes"/> - </iso_3166_subset> - <iso_3166_subset type="Overseas region/department"> - <iso_3166_2_entry - code="FR-GP" name="Guadeloupe"/> - <iso_3166_2_entry - code="FR-GF" name="Guyane"/> - <iso_3166_2_entry - code="FR-MQ" name="Martinique"/> - <iso_3166_2_entry - code="FR-RE" name="Réunion"/> - </iso_3166_subset> - <iso_3166_subset type="Metropolitan department"> - <iso_3166_2_entry - code="FR-01" name="Ain" parent="V"/> - <iso_3166_2_entry - code="FR-02" name="Aisne" parent="S"/> - <iso_3166_2_entry - code="FR-03" name="Allier" parent="C"/> - <iso_3166_2_entry - code="FR-04" name="Alpes-de-Haute-Provence" parent="U"/> - <iso_3166_2_entry - code="FR-06" name="Alpes-Maritimes" parent="U"/> - <iso_3166_2_entry - code="FR-07" name="Ardèche" parent="V"/> - <iso_3166_2_entry - code="FR-08" name="Ardennes" parent="G"/> - <iso_3166_2_entry - code="FR-09" name="Ariège" parent="N"/> - <iso_3166_2_entry - code="FR-10" name="Aube" parent="G"/> - <iso_3166_2_entry - code="FR-11" name="Aude" parent="K"/> - <iso_3166_2_entry - code="FR-12" name="Aveyron" parent="N"/> - <iso_3166_2_entry - code="FR-67" name="Bas-Rhin" parent="A"/> - <iso_3166_2_entry - code="FR-13" name="Bouches-du-Rhône" parent="U"/> - <iso_3166_2_entry - code="FR-14" name="Calvados" parent="P"/> - <iso_3166_2_entry - code="FR-15" name="Cantal" parent="C"/> - <iso_3166_2_entry - code="FR-16" name="Charente" parent="T"/> - <iso_3166_2_entry - code="FR-17" name="Charente-Maritime" parent="T"/> - <iso_3166_2_entry - code="FR-18" name="Cher" parent="F"/> - <iso_3166_2_entry - code="FR-19" name="Corrèze" parent="L"/> - <iso_3166_2_entry - code="FR-2A" name="Corse-du-Sud" parent="H"/> - <iso_3166_2_entry - code="FR-21" name="Côte-d'Or" parent="D"/> - <iso_3166_2_entry - code="FR-22" name="Côtes-d'Armor" parent="E"/> - <iso_3166_2_entry - code="FR-23" name="Creuse" parent="L"/> - <iso_3166_2_entry - code="FR-79" name="Deux-Sèvres" parent="T"/> - <iso_3166_2_entry - code="FR-24" name="Dordogne" parent="B"/> - <iso_3166_2_entry - code="FR-25" name="Doubs" parent="I"/> - <iso_3166_2_entry - code="FR-26" name="Drôme" parent="V"/> - <iso_3166_2_entry - code="FR-91" name="Essonne" parent="J"/> - <iso_3166_2_entry - code="FR-27" name="Eure" parent="Q"/> - <iso_3166_2_entry - code="FR-28" name="Eure-et-Loir" parent="F"/> - <iso_3166_2_entry - code="FR-29" name="Finistère" parent="E"/> - <iso_3166_2_entry - code="FR-30" name="Gard" parent="K"/> - <iso_3166_2_entry - code="FR-32" name="Gers" parent="N"/> - <iso_3166_2_entry - code="FR-33" name="Gironde" parent="B"/> - <iso_3166_2_entry - code="FR-2B" name="Haute-Corse" parent="H"/> - <iso_3166_2_entry - code="FR-31" name="Haute-Garonne" parent="N"/> - <iso_3166_2_entry - code="FR-43" name="Haute-Loire" parent="C"/> - <iso_3166_2_entry - code="FR-52" name="Haute-Marne" parent="G"/> - <iso_3166_2_entry - code="FR-05" name="Hautes-Alpes" parent="U"/> - <iso_3166_2_entry - code="FR-70" name="Haute-Saône" parent="I"/> - <iso_3166_2_entry - code="FR-74" name="Haute-Savoie" parent="V"/> - <iso_3166_2_entry - code="FR-65" name="Hautes-Pyrénées" parent="N"/> - <iso_3166_2_entry - code="FR-87" name="Haute-Vienne" parent="L"/> - <iso_3166_2_entry - code="FR-68" name="Haut-Rhin" parent="A"/> - <iso_3166_2_entry - code="FR-92" name="Hauts-de-Seine" parent="J"/> - <iso_3166_2_entry - code="FR-34" name="Hérault" parent="K"/> - <iso_3166_2_entry - code="FR-35" name="Ille-et-Vilaine" parent="E"/> - <iso_3166_2_entry - code="FR-36" name="Indre" parent="F"/> - <iso_3166_2_entry - code="FR-37" name="Indre-et-Loire" parent="F"/> - <iso_3166_2_entry - code="FR-38" name="Isère" parent="V"/> - <iso_3166_2_entry - code="FR-39" name="Jura" parent="I"/> - <iso_3166_2_entry - code="FR-40" name="Landes" parent="B"/> - <iso_3166_2_entry - code="FR-41" name="Loir-et-Cher" parent="F"/> - <iso_3166_2_entry - code="FR-42" name="Loire" parent="V"/> - <iso_3166_2_entry - code="FR-44" name="Loire-Atlantique" parent="R"/> - <iso_3166_2_entry - code="FR-45" name="Loiret" parent="F"/> - <iso_3166_2_entry - code="FR-46" name="Lot" parent="N"/> - <iso_3166_2_entry - code="FR-47" name="Lot-et-Garonne" parent="B"/> - <iso_3166_2_entry - code="FR-48" name="Lozère" parent="K"/> - <iso_3166_2_entry - code="FR-49" name="Maine-et-Loire" parent="R"/> - <iso_3166_2_entry - code="FR-50" name="Manche" parent="P"/> - <iso_3166_2_entry - code="FR-51" name="Marne" parent="G"/> - <iso_3166_2_entry - code="FR-53" name="Mayenne" parent="R"/> - <iso_3166_2_entry - code="FR-54" name="Meurthe-et-Moselle" parent="M"/> - <iso_3166_2_entry - code="FR-55" name="Meuse" parent="M"/> - <iso_3166_2_entry - code="FR-56" name="Morbihan" parent="E"/> - <iso_3166_2_entry - code="FR-57" name="Moselle" parent="M"/> - <iso_3166_2_entry - code="FR-58" name="Nièvre" parent="D"/> - <iso_3166_2_entry - code="FR-59" name="Nord" parent="O"/> - <iso_3166_2_entry - code="FR-60" name="Oise" parent="S"/> - <iso_3166_2_entry - code="FR-61" name="Orne" parent="P"/> - <iso_3166_2_entry - code="FR-75" name="Paris" parent="J"/> - <iso_3166_2_entry - code="FR-62" name="Pas-de-Calais" parent="O"/> - <iso_3166_2_entry - code="FR-63" name="Puy-de-Dôme" parent="C"/> - <iso_3166_2_entry - code="FR-64" name="Pyrénées-Atlantiques" parent="B"/> - <iso_3166_2_entry - code="FR-66" name="Pyrénées-Orientales" parent="K"/> - <iso_3166_2_entry - code="FR-69" name="Rhône" parent="V"/> - <iso_3166_2_entry - code="FR-71" name="Saône-et-Loire" parent="D"/> - <iso_3166_2_entry - code="FR-72" name="Sarthe" parent="R"/> - <iso_3166_2_entry - code="FR-73" name="Savoie" parent="V"/> - <iso_3166_2_entry - code="FR-77" name="Seine-et-Marne" parent="J"/> - <iso_3166_2_entry - code="FR-76" name="Seine-Maritime" parent="Q"/> - <iso_3166_2_entry - code="FR-93" name="Seine-Saint-Denis" parent="J"/> - <iso_3166_2_entry - code="FR-80" name="Somme" parent="S"/> - <iso_3166_2_entry - code="FR-81" name="Tarn" parent="N"/> - <iso_3166_2_entry - code="FR-82" name="Tarn-et-Garonne" parent="N"/> - <iso_3166_2_entry - code="FR-90" name="Territoire de Belfort" parent="I"/> - <iso_3166_2_entry - code="FR-94" name="Val-de-Marne" parent="J"/> - <iso_3166_2_entry - code="FR-95" name="Val d'Oise" parent="J"/> - <iso_3166_2_entry - code="FR-83" name="Var" parent="U"/> - <iso_3166_2_entry - code="FR-84" name="Vaucluse" parent="U"/> - <iso_3166_2_entry - code="FR-85" name="Vendée" parent="R"/> - <iso_3166_2_entry - code="FR-86" name="Vienne" parent="T"/> - <iso_3166_2_entry - code="FR-88" name="Vosges" parent="M"/> - <iso_3166_2_entry - code="FR-89" name="Yonne" parent="D"/> - <iso_3166_2_entry - code="FR-78" name="Yvelines" parent="J"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="FR-CP" name="Clipperton"/> - </iso_3166_subset> - <iso_3166_subset type="Overseas territorial collectivity"> - <iso_3166_2_entry - code="FR-YT" name="Mayotte"/> - <iso_3166_2_entry - code="FR-NC" name="Nouvelle-Calédonie"/> - <iso_3166_2_entry - code="FR-PF" name="Polynésie française"/> - <iso_3166_2_entry - code="FR-BL" name="Saint-Barthélemy"/> - <iso_3166_2_entry - code="FR-MF" name="Saint-Martin"/> - <iso_3166_2_entry - code="FR-PM" name="Saint-Pierre-et-Miquelon"/> - <iso_3166_2_entry - code="FR-TF" name="Terres australes françaises"/> - <iso_3166_2_entry - code="FR-WF" name="Wallis-et-Futuna"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Gabon --> - <iso_3166_country code="GA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GA-1" name="Estuaire"/> - <iso_3166_2_entry - code="GA-2" name="Haut-Ogooué"/> - <iso_3166_2_entry - code="GA-3" name="Moyen-Ogooué"/> - <iso_3166_2_entry - code="GA-4" name="Ngounié"/> - <iso_3166_2_entry - code="GA-5" name="Nyanga"/> - <iso_3166_2_entry - code="GA-6" name="Ogooué-Ivindo"/> - <iso_3166_2_entry - code="GA-7" name="Ogooué-Lolo"/> - <iso_3166_2_entry - code="GA-8" name="Ogooué-Maritime"/> - <iso_3166_2_entry - code="GA-9" name="Woleu-Ntem"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United Kingdom --> - <iso_3166_country code="GB"> - <iso_3166_subset type="Country"> - <iso_3166_2_entry - code="GB ENG" name="England"/> - <iso_3166_2_entry - code="GB SCT" name="Scotland"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GB NIR" name="Northern Ireland"/> - </iso_3166_subset> - <iso_3166_subset type="Principality"> - <iso_3166_2_entry - code="GB WLS" name="Wales"/> - </iso_3166_subset> - <iso_3166_subset type="Included for completeness"> - <iso_3166_2_entry - code="GB EAW" name="England and Wales"/> - <iso_3166_2_entry - code="GB GBN" name="Great Britain"/> - <iso_3166_2_entry - code="GB UKM" name="United Kingdom"/> - </iso_3166_subset> - <iso_3166_subset type="Two-tier county"> - <iso_3166_2_entry - code="GB-BKM" name="Buckinghamshire"/> - <iso_3166_2_entry - code="GB-CAM" name="Cambridgeshire"/> - <iso_3166_2_entry - code="GB-CMA" name="Cumbria"/> - <iso_3166_2_entry - code="GB-DBY" name="Derbyshire"/> - <iso_3166_2_entry - code="GB-DEV" name="Devon"/> - <iso_3166_2_entry - code="GB-DOR" name="Dorset"/> - <iso_3166_2_entry - code="GB-ESX" name="East Sussex"/> - <iso_3166_2_entry - code="GB-ESS" name="Essex"/> - <iso_3166_2_entry - code="GB-GLS" name="Gloucestershire"/> - <iso_3166_2_entry - code="GB-HAM" name="Hampshire"/> - <iso_3166_2_entry - code="GB-HRT" name="Hertfordshire"/> - <iso_3166_2_entry - code="GB-KEN" name="Kent"/> - <iso_3166_2_entry - code="GB-LAN" name="Lancashire"/> - <iso_3166_2_entry - code="GB-LEC" name="Leicestershire"/> - <iso_3166_2_entry - code="GB-LIN" name="Lincolnshire"/> - <iso_3166_2_entry - code="GB-NFK" name="Norfolk"/> - <iso_3166_2_entry - code="GB-NYK" name="North Yorkshire"/> - <iso_3166_2_entry - code="GB-NTH" name="Northamptonshire"/> - <iso_3166_2_entry - code="GB-NTT" name="Nottinghamshire"/> - <iso_3166_2_entry - code="GB-OXF" name="Oxfordshire"/> - <iso_3166_2_entry - code="GB-SOM" name="Somerset"/> - <iso_3166_2_entry - code="GB-STS" name="Staffordshire"/> - <iso_3166_2_entry - code="GB-SFK" name="Suffolk"/> - <iso_3166_2_entry - code="GB-SRY" name="Surrey"/> - <iso_3166_2_entry - code="GB-WAR" name="Warwickshire"/> - <iso_3166_2_entry - code="GB-WSX" name="West Sussex"/> - <iso_3166_2_entry - code="GB-WOR" name="Worcestershire"/> - </iso_3166_subset> - <iso_3166_subset type="London borough"> - <iso_3166_2_entry - code="GB-BDG" name="Barking and Dagenham"/> - <iso_3166_2_entry - code="GB-BNE" name="Barnet"/> - <iso_3166_2_entry - code="GB-BEX" name="Bexley"/> - <iso_3166_2_entry - code="GB-BEN" name="Brent"/> - <iso_3166_2_entry - code="GB-BRY" name="Bromley"/> - <iso_3166_2_entry - code="GB-CMD" name="Camden"/> - <iso_3166_2_entry - code="GB-CRY" name="Croydon"/> - <iso_3166_2_entry - code="GB-EAL" name="Ealing"/> - <iso_3166_2_entry - code="GB-ENF" name="Enfield"/> - <iso_3166_2_entry - code="GB-GRE" name="Greenwich"/> - <iso_3166_2_entry - code="GB-HCK" name="Hackney"/> - <iso_3166_2_entry - code="GB-HMF" name="Hammersmith and Fulham"/> - <iso_3166_2_entry - code="GB-HRY" name="Haringey"/> - <iso_3166_2_entry - code="GB-HRW" name="Harrow"/> - <iso_3166_2_entry - code="GB-HAV" name="Havering"/> - <iso_3166_2_entry - code="GB-HIL" name="Hillingdon"/> - <iso_3166_2_entry - code="GB-HNS" name="Hounslow"/> - <iso_3166_2_entry - code="GB-ISL" name="Islington"/> - <iso_3166_2_entry - code="GB-KEC" name="Kensington and Chelsea"/> - <iso_3166_2_entry - code="GB-KTT" name="Kingston upon Thames"/> - <iso_3166_2_entry - code="GB-LBH" name="Lambeth"/> - <iso_3166_2_entry - code="GB-LEW" name="Lewisham"/> - <iso_3166_2_entry - code="GB-MRT" name="Merton"/> - <iso_3166_2_entry - code="GB-NWM" name="Newham"/> - <iso_3166_2_entry - code="GB-RDB" name="Redbridge"/> - <iso_3166_2_entry - code="GB-RIC" name="Richmond upon Thames"/> - <iso_3166_2_entry - code="GB-SWK" name="Southwark"/> - <iso_3166_2_entry - code="GB-STN" name="Sutton"/> - <iso_3166_2_entry - code="GB-TWH" name="Tower Hamlets"/> - <iso_3166_2_entry - code="GB-WFT" name="Waltham Forest"/> - <iso_3166_2_entry - code="GB-WND" name="Wandsworth"/> - <iso_3166_2_entry - code="GB-WSM" name="Westminster"/> - </iso_3166_subset> - <iso_3166_subset type="Metropolitan district"> - <iso_3166_2_entry - code="GB-BNS" name="Barnsley"/> - <iso_3166_2_entry - code="GB-BIR" name="Birmingham"/> - <iso_3166_2_entry - code="GB-BOL" name="Bolton"/> - <iso_3166_2_entry - code="GB-BRD" name="Bradford"/> - <iso_3166_2_entry - code="GB-BUR" name="Bury"/> - <iso_3166_2_entry - code="GB-CLD" name="Calderdale"/> - <iso_3166_2_entry - code="GB-COV" name="Coventry"/> - <iso_3166_2_entry - code="GB-DNC" name="Doncaster"/> - <iso_3166_2_entry - code="GB-DUD" name="Dudley"/> - <iso_3166_2_entry - code="GB-GAT" name="Gateshead"/> - <iso_3166_2_entry - code="GB-KIR" name="Kirklees"/> - <iso_3166_2_entry - code="GB-KWL" name="Knowsley"/> - <iso_3166_2_entry - code="GB-LDS" name="Leeds"/> - <iso_3166_2_entry - code="GB-LIV" name="Liverpool"/> - <iso_3166_2_entry - code="GB-MAN" name="Manchester"/> - <iso_3166_2_entry - code="GB-NET" name="Newcastle upon Tyne"/> - <iso_3166_2_entry - code="GB-NTY" name="North Tyneside"/> - <iso_3166_2_entry - code="GB-OLD" name="Oldham"/> - <iso_3166_2_entry - code="GB-RCH" name="Rochdale"/> - <iso_3166_2_entry - code="GB-ROT" name="Rotherham"/> - <iso_3166_2_entry - code="GB-SHN" name="St. Helens"/> - <iso_3166_2_entry - code="GB-SLF" name="Salford"/> - <iso_3166_2_entry - code="GB-SAW" name="Sandwell"/> - <iso_3166_2_entry - code="GB-SFT" name="Sefton"/> - <iso_3166_2_entry - code="GB-SHF" name="Sheffield"/> - <iso_3166_2_entry - code="GB-SOL" name="Solihull"/> - <iso_3166_2_entry - code="GB-STY" name="South Tyneside"/> - <iso_3166_2_entry - code="GB-SKP" name="Stockport"/> - <iso_3166_2_entry - code="GB-SND" name="Sunderland"/> - <iso_3166_2_entry - code="GB-TAM" name="Tameside"/> - <iso_3166_2_entry - code="GB-TRF" name="Trafford"/> - <iso_3166_2_entry - code="GB-WKF" name="Wakefield"/> - <iso_3166_2_entry - code="GB-WLL" name="Walsall"/> - <iso_3166_2_entry - code="GB-WGN" name="Wigan"/> - <iso_3166_2_entry - code="GB-WRL" name="Wirral"/> - <iso_3166_2_entry - code="GB-WLV" name="Wolverhampton"/> - </iso_3166_subset> - <iso_3166_subset type="City corporation"> - <iso_3166_2_entry - code="GB-LND" name="London, City of"/> - </iso_3166_subset> - <iso_3166_subset type="Council area"> - <iso_3166_2_entry - code="GB-ABE" name="Aberdeen City"/> - <iso_3166_2_entry - code="GB-ABD" name="Aberdeenshire"/> - <iso_3166_2_entry - code="GB-ANS" name="Angus"/> - <iso_3166_2_entry - code="GB-AGB" name="Argyll and Bute"/> - <iso_3166_2_entry - code="GB-CLK" name="Clackmannanshire"/> - <iso_3166_2_entry - code="GB-DGY" name="Dumfries and Galloway"/> - <iso_3166_2_entry - code="GB-DND" name="Dundee City"/> - <iso_3166_2_entry - code="GB-EAY" name="East Ayrshire"/> - <iso_3166_2_entry - code="GB-EDU" name="East Dunbartonshire"/> - <iso_3166_2_entry - code="GB-ELN" name="East Lothian"/> - <iso_3166_2_entry - code="GB-ERW" name="East Renfrewshire"/> - <iso_3166_2_entry - code="GB-EDH" name="Edinburgh, City of"/> - <iso_3166_2_entry - code="GB-ELS" name="Eilean Siar"/> - <iso_3166_2_entry - code="GB-FAL" name="Falkirk"/> - <iso_3166_2_entry - code="GB-FIF" name="Fife"/> - <iso_3166_2_entry - code="GB-GLG" name="Glasgow City"/> - <iso_3166_2_entry - code="GB-HED" name="Highland"/> - <iso_3166_2_entry - code="GB-IVC" name="Inverclyde"/> - <iso_3166_2_entry - code="GB-MLN" name="Midlothian"/> - <iso_3166_2_entry - code="GB-MRY" name="Moray"/> - <iso_3166_2_entry - code="GB-NAY" name="North Ayrshire"/> - <iso_3166_2_entry - code="GB-NLK" name="North Lanarkshire"/> - <iso_3166_2_entry - code="GB-ORR" name="Orkney Islands"/> - <iso_3166_2_entry - code="GB-PKN" name="Perth and Kinross"/> - <iso_3166_2_entry - code="GB-RFW" name="Renfrewshire"/> - <iso_3166_2_entry - code="GB-SCB" name="Scottish Borders, The"/> - <iso_3166_2_entry - code="GB-ZET" name="Shetland Islands"/> - <iso_3166_2_entry - code="GB-SAY" name="South Ayrshire"/> - <iso_3166_2_entry - code="GB-SLK" name="South Lanarkshire"/> - <iso_3166_2_entry - code="GB-STG" name="Stirling"/> - <iso_3166_2_entry - code="GB-WDU" name="West Dunbartonshire"/> - <iso_3166_2_entry - code="GB-WLN" name="West Lothian"/> - </iso_3166_subset> - <iso_3166_subset type="District council area"> - <iso_3166_2_entry - code="GB-ANT" name="Antrim"/> - <iso_3166_2_entry - code="GB-ARD" name="Ards"/> - <iso_3166_2_entry - code="GB-ARM" name="Armagh"/> - <iso_3166_2_entry - code="GB-BLA" name="Ballymena"/> - <iso_3166_2_entry - code="GB-BLY" name="Ballymoney"/> - <iso_3166_2_entry - code="GB-BNB" name="Banbridge"/> - <iso_3166_2_entry - code="GB-BFS" name="Belfast"/> - <iso_3166_2_entry - code="GB-CKF" name="Carrickfergus"/> - <iso_3166_2_entry - code="GB-CSR" name="Castlereagh"/> - <iso_3166_2_entry - code="GB-CLR" name="Coleraine"/> - <iso_3166_2_entry - code="GB-CKT" name="Cookstown"/> - <iso_3166_2_entry - code="GB-CGV" name="Craigavon"/> - <iso_3166_2_entry - code="GB-DRY" name="Derry"/> - <iso_3166_2_entry - code="GB-DOW" name="Down"/> - <iso_3166_2_entry - code="GB-DGN" name="Dungannon"/> - <iso_3166_2_entry - code="GB-FER" name="Fermanagh"/> - <iso_3166_2_entry - code="GB-LRN" name="Larne"/> - <iso_3166_2_entry - code="GB-LMV" name="Limavady"/> - <iso_3166_2_entry - code="GB-LSB" name="Lisburn"/> - <iso_3166_2_entry - code="GB-MFT" name="Magherafelt"/> - <iso_3166_2_entry - code="GB-MYL" name="Moyle"/> - <iso_3166_2_entry - code="GB-NYM" name="Newry and Mourne"/> - <iso_3166_2_entry - code="GB-NTA" name="Newtownabbey"/> - <iso_3166_2_entry - code="GB-NDN" name="North Down"/> - <iso_3166_2_entry - code="GB-OMH" name="Omagh"/> - <iso_3166_2_entry - code="GB-STB" name="Strabane"/> - </iso_3166_subset> - <iso_3166_subset type="Unitary authority (England)"> - <iso_3166_2_entry - code="GB-BAS" name="Bath and North East Somerset"/> - <iso_3166_2_entry - code="GB-BBD" name="Blackburn with Darwen"/> - <iso_3166_2_entry - code="GB-BDF" name="Bedford"/> - <iso_3166_2_entry - code="GB-BPL" name="Blackpool"/> - <iso_3166_2_entry - code="GB-BMH" name="Bournemouth"/> - <iso_3166_2_entry - code="GB-BRC" name="Bracknell Forest"/> - <iso_3166_2_entry - code="GB-BNH" name="Brighton and Hove"/> - <iso_3166_2_entry - code="GB-BST" name="Bristol, City of"/> - <iso_3166_2_entry - code="GB-CBF" name="Central Bedfordshire"/> - <iso_3166_2_entry - code="GB-CHE" name="Cheshire East"/> - <iso_3166_2_entry - code="GB-CHW" name="Cheshire West and Chester"/> - <iso_3166_2_entry - code="GB-CON" name="Cornwall"/> - <iso_3166_2_entry - code="GB-DAL" name="Darlington"/> - <iso_3166_2_entry - code="GB-DER" name="Derby"/> - <iso_3166_2_entry - code="GB-DUR" name="Durham"/> - <iso_3166_2_entry - code="GB-ERY" name="East Riding of Yorkshire"/> - <iso_3166_2_entry - code="GB-HAL" name="Halton"/> - <iso_3166_2_entry - code="GB-HPL" name="Hartlepool"/> - <iso_3166_2_entry - code="GB-HEF" name="Herefordshire"/> - <iso_3166_2_entry - code="GB-IOW" name="Isle of Wight"/> - <iso_3166_2_entry - code="GB-KHL" name="Kingston upon Hull"/> - <iso_3166_2_entry - code="GB-LCE" name="Leicester"/> - <iso_3166_2_entry - code="GB-LUT" name="Luton"/> - <iso_3166_2_entry - code="GB-MDW" name="Medway"/> - <iso_3166_2_entry - code="GB-MDB" name="Middlesbrough"/> - <iso_3166_2_entry - code="GB-MIK" name="Milton Keynes"/> - <iso_3166_2_entry - code="GB-NEL" name="North East Lincolnshire"/> - <iso_3166_2_entry - code="GB-NLN" name="North Lincolnshire"/> - <iso_3166_2_entry - code="GB-NSM" name="North Somerset"/> - <iso_3166_2_entry - code="GB-NBL" name="Northumberland"/> - <iso_3166_2_entry - code="GB-NGM" name="Nottingham"/> - <iso_3166_2_entry - code="GB-PTE" name="Peterborough"/> - <iso_3166_2_entry - code="GB-PLY" name="Plymouth"/> - <iso_3166_2_entry - code="GB-POL" name="Poole"/> - <iso_3166_2_entry - code="GB-POR" name="Portsmouth"/> - <iso_3166_2_entry - code="GB-RDG" name="Reading"/> - <iso_3166_2_entry - code="GB-RCC" name="Redcar and Cleveland"/> - <iso_3166_2_entry - code="GB-RUT" name="Rutland"/> - <iso_3166_2_entry - code="GB-SHR" name="Shropshire"/> - <iso_3166_2_entry - code="GB-SLG" name="Slough"/> - <iso_3166_2_entry - code="GB-SGC" name="South Gloucestershire"/> - <iso_3166_2_entry - code="GB-STH" name="Southampton"/> - <iso_3166_2_entry - code="GB-SOS" name="Southend-on-Sea"/> - <iso_3166_2_entry - code="GB-STT" name="Stockton-on-Tees"/> - <iso_3166_2_entry - code="GB-STE" name="Stoke-on-Trent"/> - <iso_3166_2_entry - code="GB-SWD" name="Swindon"/> - <iso_3166_2_entry - code="GB-TFW" name="Telford and Wrekin"/> - <iso_3166_2_entry - code="GB-THR" name="Thurrock"/> - <iso_3166_2_entry - code="GB-TOB" name="Torbay"/> - <iso_3166_2_entry - code="GB-WRT" name="Warrington"/> - <iso_3166_2_entry - code="GB-WBX" name="West Berkshire"/> - <iso_3166_2_entry - code="GB-WNM" name="Windsor and Maidenhead"/> - <iso_3166_2_entry - code="GB-WOK" name="Wokingham"/> - <iso_3166_2_entry - code="GB-YOR" name="York"/> - </iso_3166_subset> - <iso_3166_subset type="Unitary authority (Wales)"> - <iso_3166_2_entry - code="GB-BGW" name="Blaenau Gwent"/> - <iso_3166_2_entry - code="GB-BGE" name="Bridgend;Pen-y-bont ar Ogwr"/> - <iso_3166_2_entry - code="GB-CAY" name="Caerphilly;Caerffili"/> - <iso_3166_2_entry - code="GB-CRF" name="Cardiff;Caerdydd"/> - <iso_3166_2_entry - code="GB-CMN" name="Carmarthenshire;Sir Gaerfyrddin"/> - <iso_3166_2_entry - code="GB-CGN" name="Ceredigion;Sir Ceredigion"/> - <iso_3166_2_entry - code="GB-CWY" name="Conwy"/> - <iso_3166_2_entry - code="GB-DEN" name="Denbighshire;Sir Ddinbych"/> - <iso_3166_2_entry - code="GB-FLN" name="Flintshire;Sir y Fflint"/> - <iso_3166_2_entry - code="GB-GWN" name="Gwynedd"/> - <iso_3166_2_entry - code="GB-AGY" name="Isle of Anglesey;Sir Ynys Môn"/> - <iso_3166_2_entry - code="GB-MTY" name="Merthyr Tydfil;Merthyr Tudful"/> - <iso_3166_2_entry - code="GB-MON" name="Monmouthshire;Sir Fynwy"/> - <iso_3166_2_entry - code="GB-NTL" name="Neath Port Talbot;Castell-nedd Port Talbot"/> - <iso_3166_2_entry - code="GB-NWP" name="Newport;Casnewydd"/> - <iso_3166_2_entry - code="GB-PEM" name="Pembrokeshire;Sir Benfro"/> - <iso_3166_2_entry - code="GB-POW" name="Powys"/> - <iso_3166_2_entry - code="GB-RCT" name="Rhondda, Cynon, Taff;Rhondda, Cynon,Taf"/> - <iso_3166_2_entry - code="GB-SWA" name="Swansea;Abertawe"/> - <iso_3166_2_entry - code="GB-TOF" name="Torfaen;Tor-faen"/> - <iso_3166_2_entry - code="GB-VGL" name="Vale of Glamorgan, The;Bro Morgannwg"/> - <iso_3166_2_entry - code="GB-WRX" name="Wrexham;Wrecsam"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Grenada --> - <iso_3166_country code="GD"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="GD-01" name="Saint Andrew"/> - <iso_3166_2_entry - code="GD-02" name="Saint David"/> - <iso_3166_2_entry - code="GD-03" name="Saint George"/> - <iso_3166_2_entry - code="GD-04" name="Saint John"/> - <iso_3166_2_entry - code="GD-05" name="Saint Mark"/> - <iso_3166_2_entry - code="GD-06" name="Saint Patrick"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="GD-10" name="Southern Grenadine Islands"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Georgia --> - <iso_3166_country code="GE"> - <iso_3166_subset type="Autonomous republic"> - <iso_3166_2_entry - code="GE-AB" name="Abkhazia"/> - <iso_3166_2_entry - code="GE-AJ" name="Ajaria"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="GE-TB" name="T’bilisi"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GE-GU" name="Guria"/> - <iso_3166_2_entry - code="GE-IM" name="Imeret’i"/> - <iso_3166_2_entry - code="GE-KA" name="Kakhet’i"/> - <iso_3166_2_entry - code="GE-KK" name="K’vemo K’art’li"/> - <iso_3166_2_entry - code="GE-MM" name="Mts’khet’a-Mt’ianet’i"/> - <iso_3166_2_entry - code="GE-RL" name="Racha-Lech’khumi-K’vemo Svanet’i"/> - <iso_3166_2_entry - code="GE-SZ" name="Samegrelo-Zemo Svanet’i"/> - <iso_3166_2_entry - code="GE-SJ" name="Samts’khe-Javakhet’i"/> - <iso_3166_2_entry - code="GE-SK" name="Shida K’art’li"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guernsey --> - <iso_3166_country code="GG"> - </iso_3166_country> - <!-- Ghana --> - <iso_3166_country code="GH"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GH-AH" name="Ashanti"/> - <iso_3166_2_entry - code="GH-BA" name="Brong-Ahafo"/> - <iso_3166_2_entry - code="GH-CP" name="Central"/> - <iso_3166_2_entry - code="GH-EP" name="Eastern"/> - <iso_3166_2_entry - code="GH-AA" name="Greater Accra"/> - <iso_3166_2_entry - code="GH-NP" name="Northern"/> - <iso_3166_2_entry - code="GH-UE" name="Upper East"/> - <iso_3166_2_entry - code="GH-UW" name="Upper West"/> - <iso_3166_2_entry - code="GH-TV" name="Volta"/> - <iso_3166_2_entry - code="GH-WP" name="Western"/> - </iso_3166_subset> - <!-- Greenland --> - <iso_3166_country code="GL"/> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="GL-KU" name="Kommune Kujalleq"/> - <iso_3166_2_entry - code="GL-SM" name="Kommuneqarfik Sermersooq"/> - <iso_3166_2_entry - code="GL-QA" name="Qaasuitsup Kommunia"/> - <iso_3166_2_entry - code="GL-QE" name="Qeqqata Kommunia"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Gambia --> - <iso_3166_country code="GM"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="GM-L" name="Lower River"/> - <iso_3166_2_entry - code="GM-M" name="Central River"/> - <iso_3166_2_entry - code="GM-N" name="North Bank"/> - <iso_3166_2_entry - code="GM-U" name="Upper River"/> - <iso_3166_2_entry - code="GM-W" name="Western"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="GM-B" name="Banjul"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guinea --> - <iso_3166_country code="GN"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="GN-B" name="Boké"/> - <iso_3166_2_entry - code="GN-F" name="Faranah"/> - <iso_3166_2_entry - code="GN-K" name="Kankan"/> - <iso_3166_2_entry - code="GN-D" name="Kindia"/> - <iso_3166_2_entry - code="GN-L" name="Labé"/> - <iso_3166_2_entry - code="GN-M" name="Mamou"/> - <iso_3166_2_entry - code="GN-N" name="Nzérékoré"/> - </iso_3166_subset> - <iso_3166_subset type="Special zone"> - <iso_3166_2_entry - code="GN C" name="Conakry"/> - </iso_3166_subset> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="GN-BE" name="Beyla" parent="N"/> - <iso_3166_2_entry - code="GN-BF" name="Boffa" parent="B"/> - <iso_3166_2_entry - code="GN-BK" name="Boké" parent="B"/> - <iso_3166_2_entry - code="GN-CO" name="Coyah" parent="D"/> - <iso_3166_2_entry - code="GN-DB" name="Dabola" parent="F"/> - <iso_3166_2_entry - code="GN-DL" name="Dalaba" parent="M"/> - <iso_3166_2_entry - code="GN-DI" name="Dinguiraye" parent="F"/> - <iso_3166_2_entry - code="GN-DU" name="Dubréka" parent="D"/> - <iso_3166_2_entry - code="GN-FA" name="Faranah" parent="F"/> - <iso_3166_2_entry - code="GN-FO" name="Forécariah" parent="D"/> - <iso_3166_2_entry - code="GN-FR" name="Fria" parent="B"/> - <iso_3166_2_entry - code="GN-GA" name="Gaoual" parent="B"/> - <iso_3166_2_entry - code="GN-GU" name="Guékédou" parent="N"/> - <iso_3166_2_entry - code="GN-KA" name="Kankan" parent="K"/> - <iso_3166_2_entry - code="GN-KE" name="Kérouané" parent="K"/> - <iso_3166_2_entry - code="GN-KD" name="Kindia" parent="D"/> - <iso_3166_2_entry - code="GN-KS" name="Kissidougou" parent="F"/> - <iso_3166_2_entry - code="GN-KB" name="Koubia" parent="L"/> - <iso_3166_2_entry - code="GN-KN" name="Koundara" parent="B"/> - <iso_3166_2_entry - code="GN-KO" name="Kouroussa" parent="K"/> - <iso_3166_2_entry - code="GN-LA" name="Labé" parent="L"/> - <iso_3166_2_entry - code="GN-LE" name="Lélouma" parent="L"/> - <iso_3166_2_entry - code="GN-LO" name="Lola" parent="N"/> - <iso_3166_2_entry - code="GN-MC" name="Macenta" parent="N"/> - <iso_3166_2_entry - code="GN-ML" name="Mali" parent="L"/> - <iso_3166_2_entry - code="GN-MM" name="Mamou" parent="M"/> - <iso_3166_2_entry - code="GN-MD" name="Mandiana" parent="K"/> - <iso_3166_2_entry - code="GN-NZ" name="Nzérékoré" parent="N"/> - <iso_3166_2_entry - code="GN-PI" name="Pita" parent="M"/> - <iso_3166_2_entry - code="GN-SI" name="Siguiri" parent="K"/> - <iso_3166_2_entry - code="GN-TE" name="Télimélé" parent="D"/> - <iso_3166_2_entry - code="GN-TO" name="Tougué" parent="L"/> - <iso_3166_2_entry - code="GN-YO" name="Yomou" parent="N"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Equatorial Guinea --> - <iso_3166_country code="GQ"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GQ-C" name="Región Continental"/> - <iso_3166_2_entry - code="GQ-I" name="Región Insular"/> - <iso_3166_2_entry - code="GQ-AN" name="Annobón"/> - <iso_3166_2_entry - code="GQ-BN" name="Bioko Norte"/> - <iso_3166_2_entry - code="GQ-BS" name="Bioko Sur"/> - <iso_3166_2_entry - code="GQ-CS" name="Centro Sur"/> - <iso_3166_2_entry - code="GQ-KN" name="Kié-Ntem"/> - <iso_3166_2_entry - code="GQ-LI" name="Litoral"/> - <iso_3166_2_entry - code="GQ-WN" name="Wele-Nzás"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Greece --> - <iso_3166_country code="GR"> - <iso_3166_subset type="Administrative region"> - <iso_3166_2_entry - code="GR-A" name="Anatoliki Makedonia kai Thraki"/> - <iso_3166_2_entry - code="GR-I" name="Attiki"/> - <iso_3166_2_entry - code="GR-G" name="Dytiki Ellada"/> - <iso_3166_2_entry - code="GR-C" name="Dytiki Makedonia"/> - <iso_3166_2_entry - code="GR-F" name="Ionia Nisia"/> - <iso_3166_2_entry - code="GR-D" name="Ipeiros"/> - <iso_3166_2_entry - code="GR-B" name="Kentriki Makedonia"/> - <iso_3166_2_entry - code="GR-M" name="Kriti"/> - <iso_3166_2_entry - code="GR-L" name="Notio Aigaio"/> - <iso_3166_2_entry - code="GR-J" name="Peloponnisos"/> - <iso_3166_2_entry - code="GR-H" name="Sterea Ellada"/> - <iso_3166_2_entry - code="GR-E" name="Thessalia"/> - <iso_3166_2_entry - code="GR-K" name="Voreio Aigaio"/> - </iso_3166_subset> - <iso_3166_subset type="Self-governed part"> - <iso_3166_2_entry - code="GR-69" name="Agio Oros"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="GR-13" name="Achaïa" parent="G"/> - <iso_3166_2_entry - code="GR-01" name="Aitolia kai Akarnania" parent="G"/> - <iso_3166_2_entry - code="GR-11" name="Argolida" parent="J"/> - <iso_3166_2_entry - code="GR-12" name="Arkadia" parent="J"/> - <iso_3166_2_entry - code="GR-31" name="Arta" parent="F"/> - <iso_3166_2_entry - code="GR-A1" name="Attiki" parent="I"/> - <iso_3166_2_entry - code="GR-64" name="Chalkidiki" parent="B"/> - <iso_3166_2_entry - code="GR-94" name="Chania" parent="M"/> - <iso_3166_2_entry - code="GR-85" name="Chios" parent="K"/> - <iso_3166_2_entry - code="GR-81" name="Dodekanisos" parent="L"/> - <iso_3166_2_entry - code="GR-52" name="Drama" parent="A"/> - <iso_3166_2_entry - code="GR-71" name="Evros" parent="A"/> - <iso_3166_2_entry - code="GR-05" name="Evrytania" parent="H"/> - <iso_3166_2_entry - code="GR-04" name="Evvoias" parent="H"/> - <iso_3166_2_entry - code="GR-63" name="Florina" parent="C"/> - <iso_3166_2_entry - code="GR-07" name="Fokida" parent="H"/> - <iso_3166_2_entry - code="GR-06" name="Fthiotida" parent="H"/> - <iso_3166_2_entry - code="GR-51" name="Grevena" parent="C"/> - <iso_3166_2_entry - code="GR-14" name="Ileia" parent="G"/> - <iso_3166_2_entry - code="GR-53" name="Imathia" parent="B"/> - <iso_3166_2_entry - code="GR-33" name="Ioannina" parent="D"/> - <iso_3166_2_entry - code="GR-91" name="Irakleio" parent="M"/> - <iso_3166_2_entry - code="GR-41" name="Karditsa" parent="E"/> - <iso_3166_2_entry - code="GR-56" name="Kastoria" parent="C"/> - <iso_3166_2_entry - code="GR-55" name="Kavala" parent="A"/> - <iso_3166_2_entry - code="GR-23" name="Kefallonia" parent="F"/> - <iso_3166_2_entry - code="GR-22" name="Kerkyra" parent="F"/> - <iso_3166_2_entry - code="GR-57" name="Kilkis" parent="B"/> - <iso_3166_2_entry - code="GR-15" name="Korinthia" parent="J"/> - <iso_3166_2_entry - code="GR-58" name="Kozani" parent="C"/> - <iso_3166_2_entry - code="GR-82" name="Kyklades" parent="L"/> - <iso_3166_2_entry - code="GR-16" name="Lakonia" parent="J"/> - <iso_3166_2_entry - code="GR-42" name="Larisa" parent="E"/> - <iso_3166_2_entry - code="GR-92" name="Lasithi" parent="M"/> - <iso_3166_2_entry - code="GR-24" name="Lefkada" parent="F"/> - <iso_3166_2_entry - code="GR-83" name="Lesvos" parent="K"/> - <iso_3166_2_entry - code="GR-43" name="Magnisia" parent="E"/> - <iso_3166_2_entry - code="GR-17" name="Messinia" parent="J"/> - <iso_3166_2_entry - code="GR-59" name="Pella" parent="B"/> - <iso_3166_2_entry - code="GR-61" name="Pieria" parent="B"/> - <iso_3166_2_entry - code="GR-34" name="Preveza" parent="D"/> - <iso_3166_2_entry - code="GR-93" name="Rethymno" parent="M"/> - <iso_3166_2_entry - code="GR-73" name="Rodopi" parent="A"/> - <iso_3166_2_entry - code="GR-84" name="Samos" parent="K"/> - <iso_3166_2_entry - code="GR-62" name="Serres" parent="B"/> - <iso_3166_2_entry - code="GR-32" name="Thesprotia" parent="D"/> - <iso_3166_2_entry - code="GR-54" name="Thessaloniki" parent="B"/> - <iso_3166_2_entry - code="GR-44" name="Trikala" parent="E"/> - <iso_3166_2_entry - code="GR-03" name="Voiotia" parent="H"/> - <iso_3166_2_entry - code="GR-72" name="Xanthi" parent="A"/> - <iso_3166_2_entry - code="GR-21" name="Zakynthos" parent="F"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guatemala --> - <iso_3166_country code="GT"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="GT-AV" name="Alta Verapaz"/> - <iso_3166_2_entry - code="GT-BV" name="Baja Verapaz"/> - <iso_3166_2_entry - code="GT-CM" name="Chimaltenango"/> - <iso_3166_2_entry - code="GT-CQ" name="Chiquimula"/> - <iso_3166_2_entry - code="GT-PR" name="El Progreso"/> - <iso_3166_2_entry - code="GT-ES" name="Escuintla"/> - <iso_3166_2_entry - code="GT-GU" name="Guatemala"/> - <iso_3166_2_entry - code="GT-HU" name="Huehuetenango"/> - <iso_3166_2_entry - code="GT-IZ" name="Izabal"/> - <iso_3166_2_entry - code="GT-JA" name="Jalapa"/> - <iso_3166_2_entry - code="GT-JU" name="Jutiapa"/> - <iso_3166_2_entry - code="GT-PE" name="Petén"/> - <iso_3166_2_entry - code="GT-QZ" name="Quetzaltenango"/> - <iso_3166_2_entry - code="GT-QC" name="Quiché"/> - <iso_3166_2_entry - code="GT-RE" name="Retalhuleu"/> - <iso_3166_2_entry - code="GT-SA" name="Sacatepéquez"/> - <iso_3166_2_entry - code="GT-SM" name="San Marcos"/> - <iso_3166_2_entry - code="GT-SR" name="Santa Rosa"/> - <iso_3166_2_entry - code="GT-SO" name="Sololá"/> - <iso_3166_2_entry - code="GT-SU" name="Suchitepéquez"/> - <iso_3166_2_entry - code="GT-TO" name="Totonicapán"/> - <iso_3166_2_entry - code="GT-ZA" name="Zacapa"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guinea-Bissau --> - <iso_3166_country code="GW"> - <iso_3166_subset type="Autonomous sector"> - <iso_3166_2_entry - code="GW-BS" name="Bissau"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="GW-L" name="Leste"/> - <iso_3166_2_entry - code="GW-N" name="Norte"/> - <iso_3166_2_entry - code="GW-S" name="Sul"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GW-BA" name="Bafatá" parent="L"/> - <iso_3166_2_entry - code="GW-BM" name="Biombo" parent="N"/> - <iso_3166_2_entry - code="GW-BL" name="Bolama" parent="S"/> - <iso_3166_2_entry - code="GW-CA" name="Cacheu" parent="N"/> - <iso_3166_2_entry - code="GW-GA" name="Gabú" parent="L"/> - <iso_3166_2_entry - code="GW-OI" name="Oio" parent="N"/> - <iso_3166_2_entry - code="GW-QU" name="Quinara" parent="S"/> - <iso_3166_2_entry - code="GW-TO" name="Tombali" parent="S"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Guyana --> - <iso_3166_country code="GY"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="GY-BA" name="Barima-Waini"/> - <iso_3166_2_entry - code="GY-CU" name="Cuyuni-Mazaruni"/> - <iso_3166_2_entry - code="GY-DE" name="Demerara-Mahaica"/> - <iso_3166_2_entry - code="GY-EB" name="East Berbice-Corentyne"/> - <iso_3166_2_entry - code="GY-ES" name="Essequibo Islands-West Demerara"/> - <iso_3166_2_entry - code="GY-MA" name="Mahaica-Berbice"/> - <iso_3166_2_entry - code="GY-PM" name="Pomeroon-Supenaam"/> - <iso_3166_2_entry - code="GY-PT" name="Potaro-Siparuni"/> - <iso_3166_2_entry - code="GY-UD" name="Upper Demerara-Berbice"/> - <iso_3166_2_entry - code="GY-UT" name="Upper Takutu-Upper Essequibo"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Honduras --> - <iso_3166_country code="HN"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="HN-AT" name="Atlántida"/> - <iso_3166_2_entry - code="HN-CL" name="Colón"/> - <iso_3166_2_entry - code="HN-CM" name="Comayagua"/> - <iso_3166_2_entry - code="HN-CP" name="Copán"/> - <iso_3166_2_entry - code="HN-CR" name="Cortés"/> - <iso_3166_2_entry - code="HN-CH" name="Choluteca"/> - <iso_3166_2_entry - code="HN-EP" name="El Paraíso"/> - <iso_3166_2_entry - code="HN-FM" name="Francisco Morazán"/> - <iso_3166_2_entry - code="HN-GD" name="Gracias a Dios"/> - <iso_3166_2_entry - code="HN-IN" name="Intibucá"/> - <iso_3166_2_entry - code="HN-IB" name="Islas de la Bahía"/> - <iso_3166_2_entry - code="HN-LP" name="La Paz"/> - <iso_3166_2_entry - code="HN-LE" name="Lempira"/> - <iso_3166_2_entry - code="HN-OC" name="Ocotepeque"/> - <iso_3166_2_entry - code="HN-OL" name="Olancho"/> - <iso_3166_2_entry - code="HN-SB" name="Santa Bárbara"/> - <iso_3166_2_entry - code="HN-VA" name="Valle"/> - <iso_3166_2_entry - code="HN-YO" name="Yoro"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Croatia --> - <iso_3166_country code="HR"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="HR-21" name="Grad Zagreb"/> - </iso_3166_subset> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="HR-07" name="Bjelovarsko-bilogorska županija"/> - <iso_3166_2_entry - code="HR-12" name="Brodsko-posavska županija"/> - <iso_3166_2_entry - code="HR-19" name="Dubrovačko-neretvanska županija"/> - <iso_3166_2_entry - code="HR-18" name="Istarska županija"/> - <iso_3166_2_entry - code="HR-04" name="Karlovačka županija"/> - <iso_3166_2_entry - code="HR-06" name="Koprivničko-križevačka županija"/> - <iso_3166_2_entry - code="HR-02" name="Krapinsko-zagorska županija"/> - <iso_3166_2_entry - code="HR-09" name="Ličko-senjska županija"/> - <iso_3166_2_entry - code="HR-20" name="Međimurska županija"/> - <iso_3166_2_entry - code="HR-14" name="Osječko-baranjska županija"/> - <iso_3166_2_entry - code="HR-11" name="Požeško-slavonska županija"/> - <iso_3166_2_entry - code="HR-08" name="Primorsko-goranska županija"/> - <iso_3166_2_entry - code="HR-03" name="Sisačko-moslavačka županija"/> - <iso_3166_2_entry - code="HR-17" name="Splitsko-dalmatinska županija"/> - <iso_3166_2_entry - code="HR-15" name="Šibensko-kninska županija"/> - <iso_3166_2_entry - code="HR-05" name="Varaždinska županija"/> - <iso_3166_2_entry - code="HR-10" name="Virovitičko-podravska županija"/> - <iso_3166_2_entry - code="HR-16" name="Vukovarsko-srijemska županija"/> - <iso_3166_2_entry - code="HR-13" name="Zadarska županija"/> - <iso_3166_2_entry - code="HR-01" name="Zagrebačka županija"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Haiti --> - <iso_3166_country code="HT"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="HT-AR" name="Artibonite"/> - <iso_3166_2_entry - code="HT-CE" name="Centre"/> - <iso_3166_2_entry - code="HT-GA" name="Grande-Anse"/> - <iso_3166_2_entry - code="HT-ND" name="Nord"/> - <iso_3166_2_entry - code="HT-NE" name="Nord-Est"/> - <iso_3166_2_entry - code="HT-NO" name="Nord-Ouest"/> - <iso_3166_2_entry - code="HT-OU" name="Ouest"/> - <iso_3166_2_entry - code="HT-SD" name="Sud"/> - <iso_3166_2_entry - code="HT-SE" name="Sud-Est"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Hungary --> - <iso_3166_country code="HU"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="HU-BK" name="Bács-Kiskun"/> - <iso_3166_2_entry - code="HU-BA" name="Baranya"/> - <iso_3166_2_entry - code="HU-BE" name="Békés"/> - <iso_3166_2_entry - code="HU-BZ" name="Borsod-Abaúj-Zemplén"/> - <iso_3166_2_entry - code="HU-CS" name="Csongrád"/> - <iso_3166_2_entry - code="HU-FE" name="Fejér"/> - <iso_3166_2_entry - code="HU-GS" name="Győr-Moson-Sopron"/> - <iso_3166_2_entry - code="HU-HB" name="Hajdú-Bihar"/> - <iso_3166_2_entry - code="HU-HE" name="Heves"/> - <iso_3166_2_entry - code="HU-JN" name="Jász-Nagykun-Szolnok"/> - <iso_3166_2_entry - code="HU-KE" name="Komárom-Esztergom"/> - <iso_3166_2_entry - code="HU-NO" name="Nógrád"/> - <iso_3166_2_entry - code="HU-PE" name="Pest"/> - <iso_3166_2_entry - code="HU-SO" name="Somogy"/> - <iso_3166_2_entry - code="HU-SZ" name="Szabolcs-Szatmár-Bereg"/> - <iso_3166_2_entry - code="HU-TO" name="Tolna"/> - <iso_3166_2_entry - code="HU-VA" name="Vas"/> - <iso_3166_2_entry - code="HU-VE" name="Veszprém (county)"/> - <iso_3166_2_entry - code="HU-ZA" name="Zala"/> - </iso_3166_subset> - <iso_3166_subset type="City with county rights"> - <iso_3166_2_entry - code="HU-BC" name="Békéscsaba"/> - <iso_3166_2_entry - code="HU-DE" name="Debrecen"/> - <iso_3166_2_entry - code="HU-DU" name="Dunaújváros"/> - <iso_3166_2_entry - code="HU-EG" name="Eger"/> - <iso_3166_2_entry - code="HU-ER" name="Érd"/> - <iso_3166_2_entry - code="HU-GY" name="Győr"/> - <iso_3166_2_entry - code="HU-HV" name="Hódmezővásárhely"/> - <iso_3166_2_entry - code="HU-KV" name="Kaposvár"/> - <iso_3166_2_entry - code="HU-KM" name="Kecskemét"/> - <iso_3166_2_entry - code="HU-MI" name="Miskolc"/> - <iso_3166_2_entry - code="HU-NK" name="Nagykanizsa"/> - <iso_3166_2_entry - code="HU-NY" name="Nyíregyháza"/> - <iso_3166_2_entry - code="HU-PS" name="Pécs"/> - <iso_3166_2_entry - code="HU-ST" name="Salgótarján"/> - <iso_3166_2_entry - code="HU-SN" name="Sopron"/> - <iso_3166_2_entry - code="HU-SD" name="Szeged"/> - <iso_3166_2_entry - code="HU-SF" name="Székesfehérvár"/> - <iso_3166_2_entry - code="HU-SS" name="Szekszárd"/> - <iso_3166_2_entry - code="HU-SK" name="Szolnok"/> - <iso_3166_2_entry - code="HU-SH" name="Szombathely"/> - <iso_3166_2_entry - code="HU-TB" name="Tatabánya"/> - <iso_3166_2_entry - code="HU-VM" name="Veszprém"/> - <iso_3166_2_entry - code="HU-ZE" name="Zalaegerszeg"/> - </iso_3166_subset> - <iso_3166_subset type="Capital city"> - <iso_3166_2_entry - code="HU-BU" name="Budapest"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Indonesia --> - <iso_3166_country code="ID"> - <iso_3166_subset type="Geographical unit"> - <iso_3166_2_entry - code="ID-JW" name="Jawa"/> - <iso_3166_2_entry - code="ID-KA" name="Kalimantan"/> - <iso_3166_2_entry - code="ID-MA" name="Maluku"/> - <iso_3166_2_entry - code="ID-NU" name="Nusa Tenggara"/> - <iso_3166_2_entry - code="ID-IJ" name="Papua"/> - <iso_3166_2_entry - code="ID-SL" name="Sulawesi"/> - <iso_3166_2_entry - code="ID-SM" name="Sumatera"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous Province"> - <iso_3166_2_entry - code="ID-AC" name="Aceh" parent="SM"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ID-BA" name="Bali" parent="NU"/> - <iso_3166_2_entry - code="ID-BB" name="Bangka Belitung" parent="SM"/> - <iso_3166_2_entry - code="ID-BT" name="Banten" parent="JW"/> - <iso_3166_2_entry - code="ID-BE" name="Bengkulu" parent="SM"/> - <iso_3166_2_entry - code="ID-GO" name="Gorontalo" parent="SL"/> - <iso_3166_2_entry - code="ID-JA" name="Jambi" parent="SM"/> - <iso_3166_2_entry - code="ID-JB" name="Jawa Barat" parent="JW"/> - <iso_3166_2_entry - code="ID-JT" name="Jawa Tengah" parent="JW"/> - <iso_3166_2_entry - code="ID-JI" name="Jawa Timur" parent="JW"/> - <iso_3166_2_entry - code="ID-KB" name="Kalimantan Barat" parent="KA"/> - <iso_3166_2_entry - code="ID-KT" name="Kalimantan Tengah" parent="KA"/> - <iso_3166_2_entry - code="ID-KS" name="Kalimantan Selatan" parent="KA"/> - <iso_3166_2_entry - code="ID-KI" name="Kalimantan Timur" parent="KA"/> - <iso_3166_2_entry - code="ID-KR" name="Kepulauan Riau" parent="SM"/> - <iso_3166_2_entry - code="ID-LA" name="Lampung" parent="SM"/> - <iso_3166_2_entry - code="ID-MA" name="Maluku" parent="MA"/> - <iso_3166_2_entry - code="ID-MU" name="Maluku Utara" parent="MA"/> - <iso_3166_2_entry - code="ID-NB" name="Nusa Tenggara Barat" parent="NU"/> - <iso_3166_2_entry - code="ID-NT" name="Nusa Tenggara Timur" parent="NU"/> - <iso_3166_2_entry - code="ID-PA" name="Papua" parent="IJ"/> - <iso_3166_2_entry - code="ID-PB" name="Papua Barat" parent="IJ"/> - <iso_3166_2_entry - code="ID-RI" name="Riau" parent="SM"/> - <iso_3166_2_entry - code="ID-SR" name="Sulawesi Barat" parent="SL"/> - <iso_3166_2_entry - code="ID-SN" name="Sulawesi Selatan" parent="SL"/> - <iso_3166_2_entry - code="ID-ST" name="Sulawesi Tengah" parent="SL"/> - <iso_3166_2_entry - code="ID-SG" name="Sulawesi Tenggara" parent="SL"/> - <iso_3166_2_entry - code="ID-SA" name="Sulawesi Utara" parent="SL"/> - <iso_3166_2_entry - code="ID-SB" name="Sumatra Barat" parent="SM"/> - <iso_3166_2_entry - code="ID-SS" name="Sumatra Selatan" parent="SM"/> - <iso_3166_2_entry - code="ID-SU" name="Sumatera Utara" parent="SM"/> - </iso_3166_subset> - <iso_3166_subset type="Special District"> - <iso_3166_2_entry - code="ID-JK" name="Jakarta Raya" parent="JW"/> - </iso_3166_subset> - <iso_3166_subset type="Special Region"> - <iso_3166_2_entry - code="ID-YO" name="Yogyakarta" parent="JW"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ireland --> - <iso_3166_country code="IE"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="IE-C" name="Connacht"/> - <iso_3166_2_entry - code="IE-L" name="Leinster"/> - <iso_3166_2_entry - code="IE-M" name="Munster"/> - <iso_3166_2_entry - code="IE-U" name="Ulster"/> - </iso_3166_subset> - <iso_3166_subset type="County"> - <!-- Ireland uses Car Registration codes for Counties as ISO 3166-2 regions --> - <iso_3166_2_entry - code="IE-CW" name="Carlow" parent="L"/> - <iso_3166_2_entry - code="IE-CN" name="Cavan" parent="U"/> - <iso_3166_2_entry - code="IE-CE" name="Clare" parent="M"/> - <iso_3166_2_entry - code="IE-C" name="Cork" parent="M"/> - <iso_3166_2_entry - code="IE-DL" name="Donegal" parent="U"/> - <iso_3166_2_entry - code="IE-D" name="Dublin" parent="L"/> - <iso_3166_2_entry - code="IE-G" name="Galway" parent="C"/> - <iso_3166_2_entry - code="IE-KY" name="Kerry" parent="M"/> - <iso_3166_2_entry - code="IE-KE" name="Kildare" parent="L"/> - <iso_3166_2_entry - code="IE-KK" name="Kilkenny" parent="L"/> - <iso_3166_2_entry - code="IE-LS" name="Laois" parent="L"/> - <iso_3166_2_entry - code="IE-LM" name="Leitrim" parent="C"/> - <iso_3166_2_entry - code="IE-LK" name="Limerick" parent="M"/> - <iso_3166_2_entry - code="IE-LD" name="Longford" parent="L"/> - <iso_3166_2_entry - code="IE-LH" name="Louth" parent="L"/> - <iso_3166_2_entry - code="IE-MO" name="Mayo" parent="C"/> - <iso_3166_2_entry - code="IE-MH" name="Meath" parent="L"/> - <iso_3166_2_entry - code="IE-MN" name="Monaghan" parent="U"/> - <iso_3166_2_entry - code="IE-OY" name="Offaly" parent="L"/> - <iso_3166_2_entry - code="IE-RN" name="Roscommon" parent="C"/> - <iso_3166_2_entry - code="IE-SO" name="Sligo" parent="C"/> - <iso_3166_2_entry - code="IE-TA" name="Tipperary" parent="M"/> - <iso_3166_2_entry - code="IE-WD" name="Waterford" parent="M"/> - <iso_3166_2_entry - code="IE-WH" name="Westmeath" parent="L"/> - <iso_3166_2_entry - code="IE-WX" name="Wexford" parent="L"/> - <iso_3166_2_entry - code="IE-WW" name="Wicklow" parent="L"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Israel --> - <iso_3166_country code="IL"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="IL-D" name="HaDarom"/> - <iso_3166_2_entry - code="IL-M" name="HaMerkaz"/> - <iso_3166_2_entry - code="IL-Z" name="HaZafon"/> - <iso_3166_2_entry - code="IL-HA" name="Hefa"/> - <iso_3166_2_entry - code="IL-TA" name="Tel-Aviv"/> - <iso_3166_2_entry - code="IL-JM" name="Yerushalayim Al Quds"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Isle of Man --> - <iso_3166_country code="IM"/> - <!-- India --> - <iso_3166_country code="IN"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="IN-AP" name="Andhra Pradesh"/> - <iso_3166_2_entry - code="IN-AR" name="Arunāchal Pradesh"/> - <iso_3166_2_entry - code="IN-AS" name="Assam"/> - <iso_3166_2_entry - code="IN-BR" name="Bihār"/> - <iso_3166_2_entry - code="IN-CT" name="Chhattīsgarh"/> - <iso_3166_2_entry - code="IN-GA" name="Goa"/> - <iso_3166_2_entry - code="IN-GJ" name="Gujarāt"/> - <iso_3166_2_entry - code="IN-HR" name="Haryāna"/> - <iso_3166_2_entry - code="IN-HP" name="Himāchal Pradesh"/> - <iso_3166_2_entry - code="IN-JK" name="Jammu and Kashmīr"/> - <iso_3166_2_entry - code="IN-JH" name="Jharkhand"/> - <iso_3166_2_entry - code="IN-KA" name="Karnātaka"/> - <iso_3166_2_entry - code="IN-KL" name="Kerala"/> - <iso_3166_2_entry - code="IN-MP" name="Madhya Pradesh"/> - <iso_3166_2_entry - code="IN-MH" name="Mahārāshtra"/> - <iso_3166_2_entry - code="IN-MN" name="Manipur"/> - <iso_3166_2_entry - code="IN-ML" name="Meghālaya"/> - <iso_3166_2_entry - code="IN-MZ" name="Mizoram"/> - <iso_3166_2_entry - code="IN-NL" name="Nāgāland"/> - <iso_3166_2_entry - code="IN-OR" name="Orissa"/> - <iso_3166_2_entry - code="IN-PB" name="Punjab"/> - <iso_3166_2_entry - code="IN-RJ" name="Rājasthān"/> - <iso_3166_2_entry - code="IN-SK" name="Sikkim"/> - <iso_3166_2_entry - code="IN-TN" name="Tamil Nādu"/> - <iso_3166_2_entry - code="IN-TR" name="Tripura"/> - <iso_3166_2_entry - code="IN-UL" name="Uttaranchal"/> - <iso_3166_2_entry - code="IN-UP" name="Uttar Pradesh"/> - <iso_3166_2_entry - code="IN-WB" name="West Bengal"/> - </iso_3166_subset> - <iso_3166_subset type="Union territory"> - <iso_3166_2_entry - code="IN-AN" name="Andaman and Nicobar Islands"/> - <iso_3166_2_entry - code="IN-CH" name="Chandīgarh"/> - <iso_3166_2_entry - code="IN-DN" name="Dādra and Nagar Haveli"/> - <iso_3166_2_entry - code="IN-DD" name="Damān and Diu"/> - <iso_3166_2_entry - code="IN-DL" name="Delhi"/> - <iso_3166_2_entry - code="IN-LD" name="Lakshadweep"/> - <iso_3166_2_entry - code="IN-PY" name="Pondicherry"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Iraq --> - <iso_3166_country code="IQ"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="IQ-AN" name="Al Anbar"/> - <iso_3166_2_entry - code="IQ-BA" name="Al Basrah"/> - <iso_3166_2_entry - code="IQ-MU" name="Al Muthanna"/> - <iso_3166_2_entry - code="IQ-QA" name="Al Qadisiyah"/> - <iso_3166_2_entry - code="IQ-NA" name="An Najef"/> - <iso_3166_2_entry - code="IQ-AR" name="Arbil"/> - <iso_3166_2_entry - code="IQ-SW" name="As Sulaymaniyah"/> - <iso_3166_2_entry - code="IQ-TS" name="At Ta'mim"/> - <iso_3166_2_entry - code="IQ-BB" name="Babil"/> - <iso_3166_2_entry - code="IQ-BG" name="Baghdad"/> - <iso_3166_2_entry - code="IQ-DA" name="Dahuk"/> - <iso_3166_2_entry - code="IQ-DQ" name="Dhi Qar"/> - <iso_3166_2_entry - code="IQ-DI" name="Diyala"/> - <iso_3166_2_entry - code="IQ-KA" name="Karbala'"/> - <iso_3166_2_entry - code="IQ-MA" name="Maysan"/> - <iso_3166_2_entry - code="IQ-NI" name="Ninawa"/> - <iso_3166_2_entry - code="IQ-SD" name="Salah ad Din"/> - <iso_3166_2_entry - code="IQ-WA" name="Wasit"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Iran --> - <iso_3166_country code="IR"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="IR-03" name="Ardabīl"/> - <iso_3166_2_entry - code="IR-02" name="Āzarbāyjān-e Gharbī"/> - <iso_3166_2_entry - code="IR-01" name="Āzarbāyjān-e Sharqī"/> - <iso_3166_2_entry - code="IR-06" name="Būshehr"/> - <iso_3166_2_entry - code="IR-08" name="Chahār Mahāll va Bakhtīārī"/> - <iso_3166_2_entry - code="IR-04" name="Eşfahān"/> - <iso_3166_2_entry - code="IR-14" name="Fārs"/> - <iso_3166_2_entry - code="IR-19" name="Gīlān"/> - <iso_3166_2_entry - code="IR-27" name="Golestān"/> - <iso_3166_2_entry - code="IR-24" name="Hamadān"/> - <iso_3166_2_entry - code="IR-23" name="Hormozgān"/> - <iso_3166_2_entry - code="IR-05" name="Īlām"/> - <iso_3166_2_entry - code="IR-15" name="Kermān"/> - <iso_3166_2_entry - code="IR-17" name="Kermānshāh"/> - <iso_3166_2_entry - code="IR-29" name="Khorāsān-e Janūbī"/> - <iso_3166_2_entry - code="IR-30" name="Khorāsān-e Razavī"/> - <iso_3166_2_entry - code="IR-31" name="Khorāsān-e Shemālī"/> - <iso_3166_2_entry - code="IR-10" name="Khūzestān"/> - <iso_3166_2_entry - code="IR-18" name="Kohgīlūyeh va Būyer Ahmad"/> - <iso_3166_2_entry - code="IR-16" name="Kordestān"/> - <iso_3166_2_entry - code="IR-20" name="Lorestān"/> - <iso_3166_2_entry - code="IR-22" name="Markazī"/> - <iso_3166_2_entry - code="IR-21" name="Māzandarān"/> - <iso_3166_2_entry - code="IR-28" name="Qazvīn"/> - <iso_3166_2_entry - code="IR-26" name="Qom"/> - <iso_3166_2_entry - code="IR-12" name="Semnān"/> - <iso_3166_2_entry - code="IR-13" name="Sīstān va Balūchestān"/> - <iso_3166_2_entry - code="IR-07" name="Tehrān"/> - <iso_3166_2_entry - code="IR-25" name="Yazd"/> - <iso_3166_2_entry - code="IR-11" name="Zanjān"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Iceland --> - <iso_3166_country code="IS"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="IS-7" name="Austurland"/> - <iso_3166_2_entry - code="IS-1" name="Höfuðborgarsvæðið"/> - <iso_3166_2_entry - code="IS-6" name="Norðurland eystra"/> - <iso_3166_2_entry - code="IS-5" name="Norðurland vestra"/> - <iso_3166_2_entry - code="IS-8" name="Suðurland"/> - <iso_3166_2_entry - code="IS-2" name="Suðurnes"/> - <iso_3166_2_entry - code="IS-4" name="Vestfirðir"/> - <iso_3166_2_entry - code="IS-3" name="Vesturland"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="IS-0" name="Reykjavík"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Italy --> - <iso_3166_country code="IT"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="IT-65" name="Abruzzo"/> - <iso_3166_2_entry - code="IT-77" name="Basilicata"/> - <iso_3166_2_entry - code="IT-78" name="Calabria"/> - <iso_3166_2_entry - code="IT-72" name="Campania"/> - <iso_3166_2_entry - code="IT-45" name="Emilia-Romagna"/> - <iso_3166_2_entry - code="IT-36" name="Friuli-Venezia Giulia"/> - <iso_3166_2_entry - code="IT-62" name="Lazio"/> - <iso_3166_2_entry - code="IT-42" name="Liguria"/> - <iso_3166_2_entry - code="IT-25" name="Lombardia"/> - <iso_3166_2_entry - code="IT-57" name="Marche"/> - <iso_3166_2_entry - code="IT-67" name="Molise"/> - <iso_3166_2_entry - code="IT-21" name="Piemonte"/> - <iso_3166_2_entry - code="IT-75" name="Puglia"/> - <iso_3166_2_entry - code="IT-88" name="Sardegna"/> - <iso_3166_2_entry - code="IT-82" name="Sicilia"/> - <iso_3166_2_entry - code="IT-52" name="Toscana"/> - <iso_3166_2_entry - code="IT-32" name="Trentino-Alto Adige"/> - <iso_3166_2_entry - code="IT-55" name="Umbria"/> - <iso_3166_2_entry - code="IT-23" name="Valle d'Aosta"/> - <iso_3166_2_entry - code="IT-34" name="Veneto"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="IT-AG" name="Agrigento" parent="82"/> - <iso_3166_2_entry - code="IT-AL" name="Alessandria" parent="21"/> - <iso_3166_2_entry - code="IT-AN" name="Ancona" parent="57"/> - <iso_3166_2_entry - code="IT-AO" name="Aosta" parent="23"/> - <iso_3166_2_entry - code="IT-AR" name="Arezzo" parent="52"/> - <iso_3166_2_entry - code="IT-AP" name="Ascoli Piceno" parent="57"/> - <iso_3166_2_entry - code="IT-AT" name="Asti" parent="21"/> - <iso_3166_2_entry - code="IT-AV" name="Avellino" parent="72"/> - <iso_3166_2_entry - code="IT-BA" name="Bari" parent="75"/> - <iso_3166_2_entry - code="IT-BT" name="Barletta-Andria-Trani" parent="75"/> - <iso_3166_2_entry - code="IT-BL" name="Belluno" parent="34"/> - <iso_3166_2_entry - code="IT-BN" name="Benevento" parent="72"/> - <iso_3166_2_entry - code="IT-BG" name="Bergamo" parent="25"/> - <iso_3166_2_entry - code="IT-BI" name="Biella" parent="21"/> - <iso_3166_2_entry - code="IT-BO" name="Bologna" parent="45"/> - <iso_3166_2_entry - code="IT-BZ" name="Bolzano" parent="32"/> - <iso_3166_2_entry - code="IT-BS" name="Brescia" parent="25"/> - <iso_3166_2_entry - code="IT-BR" name="Brindisi" parent="75"/> - <iso_3166_2_entry - code="IT-CA" name="Cagliari" parent="88"/> - <iso_3166_2_entry - code="IT-CL" name="Caltanissetta" parent="82"/> - <iso_3166_2_entry - code="IT-CB" name="Campobasso" parent="67"/> - <iso_3166_2_entry - code="IT-CI" name="Carbonia-Iglesias" parent="88"/> - <iso_3166_2_entry - code="IT-CE" name="Caserta" parent="72"/> - <iso_3166_2_entry - code="IT-CT" name="Catania" parent="82"/> - <iso_3166_2_entry - code="IT-CZ" name="Catanzaro" parent="78"/> - <iso_3166_2_entry - code="IT-CH" name="Chieti" parent="65"/> - <iso_3166_2_entry - code="IT-CO" name="Como" parent="25"/> - <iso_3166_2_entry - code="IT-CS" name="Cosenza" parent="78"/> - <iso_3166_2_entry - code="IT-CR" name="Cremona" parent="25"/> - <iso_3166_2_entry - code="IT-KR" name="Crotone" parent="78"/> - <iso_3166_2_entry - code="IT-CN" name="Cuneo" parent="21"/> - <iso_3166_2_entry - code="IT-EN" name="Enna" parent="82"/> - <iso_3166_2_entry - code="IT-FM" name="Fermo" parent="57"/> - <iso_3166_2_entry - code="IT-FE" name="Ferrara" parent="45"/> - <iso_3166_2_entry - code="IT-FI" name="Firenze" parent="52"/> - <iso_3166_2_entry - code="IT-FG" name="Foggia" parent="75"/> - <iso_3166_2_entry - code="IT-FC" name="Forlì-Cesena" parent="45"/> - <iso_3166_2_entry - code="IT-FR" name="Frosinone" parent="62"/> - <iso_3166_2_entry - code="IT-GE" name="Genova" parent="42"/> - <iso_3166_2_entry - code="IT-GO" name="Gorizia" parent="36"/> - <iso_3166_2_entry - code="IT-GR" name="Grosseto" parent="52"/> - <iso_3166_2_entry - code="IT-IM" name="Imperia" parent="42"/> - <iso_3166_2_entry - code="IT-IS" name="Isernia" parent="67"/> - <iso_3166_2_entry - code="IT-SP" name="La Spezia" parent="42"/> - <iso_3166_2_entry - code="IT-AQ" name="L'Aquila" parent="65"/> - <iso_3166_2_entry - code="IT-LT" name="Latina" parent="62"/> - <iso_3166_2_entry - code="IT-LE" name="Lecce" parent="75"/> - <iso_3166_2_entry - code="IT-LC" name="Lecco" parent="25"/> - <iso_3166_2_entry - code="IT-LI" name="Livorno" parent="52"/> - <iso_3166_2_entry - code="IT-LO" name="Lodi" parent="25"/> - <iso_3166_2_entry - code="IT-LU" name="Lucca" parent="52"/> - <iso_3166_2_entry - code="IT-SC" name="Macerata" parent="57"/> - <iso_3166_2_entry - code="IT-MN" name="Mantova" parent="25"/> - <iso_3166_2_entry - code="IT-MS" name="Massa-Carrara" parent="52"/> - <iso_3166_2_entry - code="IT-MT" name="Matera" parent="77"/> - <iso_3166_2_entry - code="IT-VS" name="Medio Campidano" parent="88"/> - <iso_3166_2_entry - code="IT-ME" name="Messina" parent="82"/> - <iso_3166_2_entry - code="IT-MI" name="Milano" parent="25"/> - <iso_3166_2_entry - code="IT-MO" name="Modena" parent="45"/> - <iso_3166_2_entry - code="IT-MB" name="Monza e Brianza" parent="25"/> - <iso_3166_2_entry - code="IT-NA" name="Napoli" parent="72"/> - <iso_3166_2_entry - code="IT-NO" name="Novara" parent="21"/> - <iso_3166_2_entry - code="IT-NU" name="Nuoro" parent="88"/> - <iso_3166_2_entry - code="IT-OG" name="Ogliastra" parent="88"/> - <iso_3166_2_entry - code="IT-OT" name="Olbia-Tempio" parent="88"/> - <iso_3166_2_entry - code="IT-OR" name="Oristano" parent="88"/> - <iso_3166_2_entry - code="IT-PD" name="Padova" parent="34"/> - <iso_3166_2_entry - code="IT-PA" name="Palermo" parent="82"/> - <iso_3166_2_entry - code="IT-PR" name="Parma" parent="45"/> - <iso_3166_2_entry - code="IT-PV" name="Pavia" parent="25"/> - <iso_3166_2_entry - code="IT-PG" name="Perugia" parent="55"/> - <iso_3166_2_entry - code="IT-PU" name="Pesaro e Urbino" parent="57"/> - <iso_3166_2_entry - code="IT-PE" name="Pescara" parent="65"/> - <iso_3166_2_entry - code="IT-PC" name="Piacenza" parent="45"/> - <iso_3166_2_entry - code="IT-PI" name="Pisa" parent="52"/> - <iso_3166_2_entry - code="IT-PT" name="Pistoia" parent="52"/> - <iso_3166_2_entry - code="IT-PN" name="Pordenone" parent="36"/> - <iso_3166_2_entry - code="IT-PZ" name="Potenza" parent="77"/> - <iso_3166_2_entry - code="IT-PO" name="Prato" parent="52"/> - <iso_3166_2_entry - code="IT-RG" name="Ragusa" parent="82"/> - <iso_3166_2_entry - code="IT-RA" name="Ravenna" parent="45"/> - <iso_3166_2_entry - code="IT-RC" name="Reggio Calabria" parent="78"/> - <iso_3166_2_entry - code="IT-RE" name="Reggio Emilia" parent="45"/> - <iso_3166_2_entry - code="IT-RI" name="Rieti" parent="62"/> - <iso_3166_2_entry - code="IT-RN" name="Rimini" parent="45"/> - <iso_3166_2_entry - code="IT-RM" name="Roma" parent="62"/> - <iso_3166_2_entry - code="IT-RO" name="Rovigo" parent="34"/> - <iso_3166_2_entry - code="IT-SA" name="Salerno" parent="72"/> - <iso_3166_2_entry - code="IT-SS" name="Sassari" parent="88"/> - <iso_3166_2_entry - code="IT-SV" name="Savona" parent="42"/> - <iso_3166_2_entry - code="IT-SI" name="Siena" parent="52"/> - <iso_3166_2_entry - code="IT-SR" name="Siracusa" parent="82"/> - <iso_3166_2_entry - code="IT-SO" name="Sondrio" parent="25"/> - <iso_3166_2_entry - code="IT-TA" name="Taranto" parent="75"/> - <iso_3166_2_entry - code="IT-TE" name="Teramo" parent="65"/> - <iso_3166_2_entry - code="IT-TR" name="Terni" parent="55"/> - <iso_3166_2_entry - code="IT-TO" name="Torino" parent="21"/> - <iso_3166_2_entry - code="IT-TP" name="Trapani" parent="82"/> - <iso_3166_2_entry - code="IT-TN" name="Trento" parent="32"/> - <iso_3166_2_entry - code="IT-TV" name="Treviso" parent="34"/> - <iso_3166_2_entry - code="IT-TS" name="Trieste" parent="36"/> - <iso_3166_2_entry - code="IT-UD" name="Udine" parent="36"/> - <iso_3166_2_entry - code="IT-VA" name="Varese" parent="25"/> - <iso_3166_2_entry - code="IT-VE" name="Venezia" parent="34"/> - <iso_3166_2_entry - code="IT-VB" name="Verbano-Cusio-Ossola" parent="21"/> - <iso_3166_2_entry - code="IT-VC" name="Vercelli" parent="21"/> - <iso_3166_2_entry - code="IT-VR" name="Verona" parent="34"/> - <iso_3166_2_entry - code="IT-VV" name="Vibo Valentia" parent="78"/> - <iso_3166_2_entry - code="IT-VI" name="Vicenza" parent="34"/> - <iso_3166_2_entry - code="IT-VT" name="Viterbo" parent="62"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Jersey --> - <iso_3166_country code="JE"/> - <!-- Jamaica --> - <iso_3166_country code="JM"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="JM-13" name="Clarendon"/> - <iso_3166_2_entry - code="JM-09" name="Hanover"/> - <iso_3166_2_entry - code="JM-01" name="Kingston"/> - <iso_3166_2_entry - code="JM-12" name="Manchester"/> - <iso_3166_2_entry - code="JM-04" name="Portland"/> - <iso_3166_2_entry - code="JM-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="JM-06" name="Saint Ann"/> - <iso_3166_2_entry - code="JM-14" name="Saint Catherine"/> - <iso_3166_2_entry - code="JM-11" name="Saint Elizabeth"/> - <iso_3166_2_entry - code="JM-08" name="Saint James"/> - <iso_3166_2_entry - code="JM-05" name="Saint Mary"/> - <iso_3166_2_entry - code="JM-03" name="Saint Thomas"/> - <iso_3166_2_entry - code="JM-07" name="Trelawny"/> - <iso_3166_2_entry - code="JM-10" name="Westmoreland"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Jordan --> - <iso_3166_country code="JO"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="JO-AJ" name="`Ajlun"/> - <iso_3166_2_entry - code="JO-AQ" name="Al `Aqabah"/> - <iso_3166_2_entry - code="JO-BA" name="Al Balqā'"/> - <iso_3166_2_entry - code="JO-KA" name="Al Karak"/> - <iso_3166_2_entry - code="JO-MA" name="Al Mafraq"/> - <iso_3166_2_entry - code="JO-AM" name="Amman"/> - <iso_3166_2_entry - code="JO-AT" name="Aţ Ţafīlah"/> - <iso_3166_2_entry - code="JO-AZ" name="Az Zarqā'"/> - <iso_3166_2_entry - code="JO-JR" name="Irbid"/> - <iso_3166_2_entry - code="JO-JA" name="Jarash"/> - <iso_3166_2_entry - code="JO-MN" name="Ma`ān"/> - <iso_3166_2_entry - code="JO-MD" name="Mādabā"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Japan --> - <iso_3166_country code="JP"> - <iso_3166_subset type="Prefecture"> - <!-- Japan uses Prefectures for its ISO 3166-2 regions --> - <!-- Data taken from http://fotw.digibel.be/flags/jp-prefe.html --> - <iso_3166_2_entry - code="JP-23" name="Aichi"/> - <iso_3166_2_entry - code="JP-05" name="Akita"/> - <iso_3166_2_entry - code="JP-02" name="Aomori"/> - <iso_3166_2_entry - code="JP-12" name="Chiba"/> - <iso_3166_2_entry - code="JP-38" name="Ehime"/> - <iso_3166_2_entry - code="JP-18" name="Fukui"/> - <iso_3166_2_entry - code="JP-40" name="Fukuoka"/> - <iso_3166_2_entry - code="JP-07" name="Fukushima"/> - <iso_3166_2_entry - code="JP-21" name="Gifu"/> - <iso_3166_2_entry - code="JP-10" name="Gunma"/> - <iso_3166_2_entry - code="JP-34" name="Hiroshima"/> - <iso_3166_2_entry - code="JP-01" name="Hokkaido"/> - <iso_3166_2_entry - code="JP-28" name="Hyogo"/> - <iso_3166_2_entry - code="JP-08" name="Ibaraki"/> - <iso_3166_2_entry - code="JP-17" name="Ishikawa"/> - <iso_3166_2_entry - code="JP-03" name="Iwate"/> - <iso_3166_2_entry - code="JP-37" name="Kagawa"/> - <iso_3166_2_entry - code="JP-46" name="Kagoshima"/> - <iso_3166_2_entry - code="JP-14" name="Kanagawa"/> - <iso_3166_2_entry - code="JP-39" name="Kochi"/> - <iso_3166_2_entry - code="JP-43" name="Kumamoto"/> - <iso_3166_2_entry - code="JP-26" name="Kyoto"/> - <iso_3166_2_entry - code="JP-24" name="Mie"/> - <iso_3166_2_entry - code="JP-04" name="Miyagi"/> - <iso_3166_2_entry - code="JP-45" name="Miyazaki"/> - <iso_3166_2_entry - code="JP-20" name="Nagano"/> - <iso_3166_2_entry - code="JP-42" name="Nagasaki"/> - <iso_3166_2_entry - code="JP-29" name="Nara"/> - <iso_3166_2_entry - code="JP-15" name="Niigata"/> - <iso_3166_2_entry - code="JP-44" name="Oita"/> - <iso_3166_2_entry - code="JP-33" name="Okayama"/> - <iso_3166_2_entry - code="JP-47" name="Okinawa"/> - <iso_3166_2_entry - code="JP-27" name="Osaka"/> - <iso_3166_2_entry - code="JP-41" name="Saga"/> - <iso_3166_2_entry - code="JP-11" name="Saitama"/> - <iso_3166_2_entry - code="JP-25" name="Shiga"/> - <iso_3166_2_entry - code="JP-32" name="Shimane"/> - <iso_3166_2_entry - code="JP-22" name="Shizuoka"/> - <iso_3166_2_entry - code="JP-09" name="Tochigi"/> - <iso_3166_2_entry - code="JP-36" name="Tokushima"/> - <iso_3166_2_entry - code="JP-13" name="Tokyo"/> - <iso_3166_2_entry - code="JP-31" name="Tottori"/> - <iso_3166_2_entry - code="JP-16" name="Toyama"/> - <iso_3166_2_entry - code="JP-30" name="Wakayama"/> - <iso_3166_2_entry - code="JP-06" name="Yamagata"/> - <iso_3166_2_entry - code="JP-35" name="Yamaguchi"/> - <iso_3166_2_entry - code="JP-19" name="Yamanashi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kenya --> - <iso_3166_country code="KE"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KE-110" name="Nairobi Municipality"/> - <iso_3166_2_entry - code="KE-200" name="Central"/> - <iso_3166_2_entry - code="KE-300" name="Coast"/> - <iso_3166_2_entry - code="KE-400" name="Eastern"/> - <iso_3166_2_entry - code="KE-500" name="North-Eastern Kaskazini Mashariki"/> - <iso_3166_2_entry - code="KE-700" name="Rift Valley"/> - <iso_3166_2_entry - code="KE-900" name="Western Magharibi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kyrgystan --> - <iso_3166_country code="KG"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="KG-GB" name="Bishkek"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="KG-B" name="Batken"/> - <iso_3166_2_entry - code="KG-C" name="Chü"/> - <iso_3166_2_entry - code="KG-J" name="Jalal-Abad"/> - <iso_3166_2_entry - code="KG-N" name="Naryn"/> - <iso_3166_2_entry - code="KG-O" name="Osh"/> - <iso_3166_2_entry - code="KG-T" name="Talas"/> - <iso_3166_2_entry - code="KG-Y" name="Ysyk-Köl"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Cambodia --> - <iso_3166_country code="KH"> - <iso_3166_subset type="Autonomous municipality"> - <iso_3166_2_entry - code="KH-23" name="Krong Kaeb"/> - <iso_3166_2_entry - code="KH-24" name="Krong Pailin"/> - <iso_3166_2_entry - code="KH-18" name="Krong Preah Sihanouk"/> - <iso_3166_2_entry - code="KH-12" name="Phnom Penh"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KH-2" name="Battambang"/> - <iso_3166_2_entry - code="KH-1" name="Banteay Mean Chey"/> - <iso_3166_2_entry - code="KH-3" name="Kampong Cham"/> - <iso_3166_2_entry - code="KH-4" name="Kampong Chhnang"/> - <iso_3166_2_entry - code="KH-5" name="Kampong Speu"/> - <iso_3166_2_entry - code="KH-6" name="Kampong Thom"/> - <iso_3166_2_entry - code="KH-7" name="Kampot"/> - <iso_3166_2_entry - code="KH-8" name="Kandal"/> - <iso_3166_2_entry - code="KH-9" name="Kach Kong"/> - <iso_3166_2_entry - code="KH-10" name="Krachoh"/> - <iso_3166_2_entry - code="KH-11" name="Mondol Kiri"/> - <iso_3166_2_entry - code="KH-22" name="Otdar Mean Chey"/> - <iso_3166_2_entry - code="KH-15" name="Pousaat"/> - <iso_3166_2_entry - code="KH-13" name="Preah Vihear"/> - <iso_3166_2_entry - code="KH-14" name="Prey Veaeng"/> - <iso_3166_2_entry - code="KH-16" name="Rotanak Kiri"/> - <iso_3166_2_entry - code="KH-17" name="Siem Reab"/> - <iso_3166_2_entry - code="KH-19" name="Stueng Traeng"/> - <iso_3166_2_entry - code="KH-20" name="Svaay Rieng"/> - <iso_3166_2_entry - code="KH-21" name="Taakaev"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kiribati --> - <iso_3166_country code="KI"> - <iso_3166_subset type="Island group"> - <iso_3166_2_entry - code="KI-G" name="Gilbert Islands"/> - <iso_3166_2_entry - code="KI-L" name="Line Islands"/> - <iso_3166_2_entry - code="KI-P" name="Phoenix Islands"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Kitts and Nevis --> - <iso_3166_country code="KN"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="KN-K" name="Saint Kitts"/> - <iso_3166_2_entry - code="KN-N" name="Nevis"/> - </iso_3166_subset> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="KN-01" name="Christ Church Nichola Town" parent="K"/> - <iso_3166_2_entry - code="KN-02" name="Saint Anne Sandy Point" parent="K"/> - <iso_3166_2_entry - code="KN-03" name="Saint George Basseterre" parent="K"/> - <iso_3166_2_entry - code="KN-04" name="Saint George Gingerland" parent="N"/> - <iso_3166_2_entry - code="KN-05" name="Saint James Windward" parent="N"/> - <iso_3166_2_entry - code="KN-06" name="Saint John Capisterre" parent="K"/> - <iso_3166_2_entry - code="KN-07" name="Saint John Figtree" parent="N"/> - <iso_3166_2_entry - code="KN-08" name="Saint Mary Cayon" parent="K"/> - <iso_3166_2_entry - code="KN-09" name="Saint Paul Capisterre" parent="K"/> - <iso_3166_2_entry - code="KN-10" name="Saint Paul Charlestown" parent="N"/> - <iso_3166_2_entry - code="KN-11" name="Saint Peter Basseterre" parent="K"/> - <iso_3166_2_entry - code="KN-12" name="Saint Thomas Lowland" parent="N"/> - <iso_3166_2_entry - code="KN-13" name="Saint Thomas Middle Island" parent="K"/> - <iso_3166_2_entry - code="KN-15" name="Trinity Palmetto Point" parent="K"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Comorros --> - <iso_3166_country code="KM"> - <iso_3166_subset type="Island"> - <iso_3166_2_entry - code="KM-A" name="Andjouân (Anjwān)"/> - <iso_3166_2_entry - code="KM-G" name="Andjazîdja (Anjazījah)"/> - <iso_3166_2_entry - code="KM-M" name="Moûhîlî (Mūhīlī)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- North Korea --> - <iso_3166_country code="KP"> - <iso_3166_subset type="Capital city"> - <iso_3166_2_entry - code="KP-01" name="P’yŏngyang"/> - </iso_3166_subset> - <iso_3166_subset type="Special city"> - <iso_3166_2_entry - code="KP-13" name="Nasŏn (Najin-Sŏnbong)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KP-02" name="P’yŏngan-namdo"/> - <iso_3166_2_entry - code="KP-03" name="P’yŏngan-bukto"/> - <iso_3166_2_entry - code="KP-04" name="Chagang-do"/> - <iso_3166_2_entry - code="KP-05" name="Hwanghae-namdo"/> - <iso_3166_2_entry - code="KP-06" name="Hwanghae-bukto"/> - <iso_3166_2_entry - code="KP-07" name="Kangwŏn-do"/> - <iso_3166_2_entry - code="KP-08" name="Hamgyŏng-namdo"/> - <iso_3166_2_entry - code="KP-09" name="Hamgyŏng-bukto"/> - <iso_3166_2_entry - code="KP-10" name="Yanggang-do"/> - </iso_3166_subset> - </iso_3166_country> - <!-- South Korea --> - <iso_3166_country code="KR"> - <iso_3166_subset type="Capital Metropolitan City"> - <iso_3166_2_entry - code="KR-11" name="Seoul Teugbyeolsi"/> - </iso_3166_subset> - <iso_3166_subset type="Metropolitan cities"> - <iso_3166_2_entry - code="KR-26" name="Busan Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-27" name="Daegu Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-30" name="Daejeon Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-29" name="Gwangju Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-28" name="Incheon Gwang'yeogsi"/> - <iso_3166_2_entry - code="KR-31" name="Ulsan Gwang'yeogsi"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="KR-43" name="Chungcheongbukdo"/> - <iso_3166_2_entry - code="KR-44" name="Chungcheongnamdo"/> - <iso_3166_2_entry - code="KR-42" name="Gang'weondo"/> - <iso_3166_2_entry - code="KR-41" name="Gyeonggido"/> - <iso_3166_2_entry - code="KR-47" name="Gyeongsangbukdo"/> - <iso_3166_2_entry - code="KR-48" name="Gyeongsangnamdo"/> - <iso_3166_2_entry - code="KR-49" name="Jejudo"/> - <iso_3166_2_entry - code="KR-45" name="Jeonrabukdo"/> - <iso_3166_2_entry - code="KR-46" name="Jeonranamdo"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kuwait --> - <iso_3166_country code="KW"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="KW-AH" name="Al Ahmadi"/> - <iso_3166_2_entry - code="KW-FA" name="Al Farwānīyah"/> - <iso_3166_2_entry - code="KW-JA" name="Al Jahrah"/> - <iso_3166_2_entry - code="KW-KU" name="Al Kuwayt"/> - <iso_3166_2_entry - code="KW-HA" name="Hawallī"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Kazakhstan --> - <iso_3166_country code="KZ"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="KZ-ALA" name="Almaty"/> - <iso_3166_2_entry - code="KZ-AST" name="Astana"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="KZ-ALM" name="Almaty oblysy"/> - <iso_3166_2_entry - code="KZ-AKM" name="Aqmola oblysy"/> - <iso_3166_2_entry - code="KZ-AKT" name="Aqtöbe oblysy"/> - <iso_3166_2_entry - code="KZ-ATY" name="Atyraū oblysy"/> - <iso_3166_2_entry - code="KZ-ZAP" name="Batys Quzaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-MAN" name="Mangghystaū oblysy"/> - <iso_3166_2_entry - code="KZ-YUZ" name="Ongtüstik Qazaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-PAV" name="Pavlodar oblysy"/> - <iso_3166_2_entry - code="KZ-KAR" name="Qaraghandy oblysy"/> - <iso_3166_2_entry - code="KZ-KUS" name="Qostanay oblysy"/> - <iso_3166_2_entry - code="KZ-KZY" name="Qyzylorda oblysy"/> - <iso_3166_2_entry - code="KZ-VOS" name="Shyghys Qazaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-SEV" name="Soltüstik Quzaqstan oblysy"/> - <iso_3166_2_entry - code="KZ-ZHA" name="Zhambyl oblysy"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Laos --> - <iso_3166_country code="LA"> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="LA-VT" name="Vientiane"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="LA-AT" name="Attapu"/> - <iso_3166_2_entry - code="LA-BK" name="Bokèo"/> - <iso_3166_2_entry - code="LA-BL" name="Bolikhamxai"/> - <iso_3166_2_entry - code="LA-CH" name="Champasak"/> - <iso_3166_2_entry - code="LA-HO" name="Houaphan"/> - <iso_3166_2_entry - code="LA-KH" name="Khammouan"/> - <iso_3166_2_entry - code="LA-LM" name="Louang Namtha"/> - <iso_3166_2_entry - code="LA-LP" name="Louangphabang"/> - <iso_3166_2_entry - code="LA-OU" name="Oudômxai"/> - <iso_3166_2_entry - code="LA-PH" name="Phôngsali"/> - <iso_3166_2_entry - code="LA-SL" name="Salavan"/> - <iso_3166_2_entry - code="LA-SV" name="Savannakhét"/> - <iso_3166_2_entry - code="LA-VI" name="Vientiane"/> - <iso_3166_2_entry - code="LA-XA" name="Xaignabouli"/> - <iso_3166_2_entry - code="LA-XE" name="Xékong"/> - <iso_3166_2_entry - code="LA-XI" name="Xiangkhoang"/> - </iso_3166_subset> - <iso_3166_subset type="Special zone"> - <iso_3166_2_entry - code="LA-XN" name="Xiasômboun"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Liechtenstein --> - <iso_3166_country code="LI"> - <iso_3166_subset type="Commune"> - <iso_3166_2_entry - code="LI-01" name="Balzers"/> - <iso_3166_2_entry - code="LI-02" name="Eschen"/> - <iso_3166_2_entry - code="LI-03" name="Gamprin"/> - <iso_3166_2_entry - code="LI-04" name="Mauren"/> - <iso_3166_2_entry - code="LI-05" name="Planken"/> - <iso_3166_2_entry - code="LI-06" name="Ruggell"/> - <iso_3166_2_entry - code="LI-07" name="Schaan"/> - <iso_3166_2_entry - code="LI-08" name="Schellenberg"/> - <iso_3166_2_entry - code="LI-09" name="Triesen"/> - <iso_3166_2_entry - code="LI-10" name="Triesenberg"/> - <iso_3166_2_entry - code="LI-11" name="Vaduz"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Lebanon --> - <iso_3166_country code="LB"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="LB-AK" name="Aakkâr"/> - <iso_3166_2_entry - code="LB-BH" name="Baalbek-Hermel"/> - <iso_3166_2_entry - code="LB-BI" name="Béqaa"/> - <iso_3166_2_entry - code="LB-BA" name="Beyrouth"/> - <iso_3166_2_entry - code="LB-AS" name="Liban-Nord"/> - <iso_3166_2_entry - code="LB-JA" name="Liban-Sud"/> - <iso_3166_2_entry - code="LB-JL" name="Mont-Liban"/> - <iso_3166_2_entry - code="LB-NA" name="Nabatîyé"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sri Lanka --> - <iso_3166_country code="LK"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="LK-1" name="Basnāhira paḷāta"/> - <iso_3166_2_entry - code="LK-3" name="Dakuṇu paḷāta"/> - <iso_3166_2_entry - code="LK-2" name="Madhyama paḷāta"/> - <iso_3166_2_entry - code="LK-5" name="Næ̆gĕnahira paḷāta"/> - <iso_3166_2_entry - code="LK-9" name="Sabaragamuva paḷāta"/> - <iso_3166_2_entry - code="LK-7" name="Uturumæ̆da paḷāta"/> - <iso_3166_2_entry - code="LK-4" name="Uturu paḷāta"/> - <iso_3166_2_entry - code="LK-8" name="Ūva paḷāta"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="LK-52" name="Ampāara" parent="5"/> - <iso_3166_2_entry - code="LK-71" name="Anurādhapura" parent="7"/> - <iso_3166_2_entry - code="LK-81" name="Badulla" parent="8"/> - <iso_3166_2_entry - code="LK-51" name="Maḍakalapuva" parent="5"/> - <iso_3166_2_entry - code="LK-11" name="Kŏḷamba" parent="1"/> - <iso_3166_2_entry - code="LK-31" name="Gālla" parent="3"/> - <iso_3166_2_entry - code="LK-12" name="Gampaha" parent="1"/> - <iso_3166_2_entry - code="LK-33" name="Hambantŏṭa" parent="3"/> - <iso_3166_2_entry - code="LK-41" name="Yāpanaya" parent="4"/> - <iso_3166_2_entry - code="LK-13" name="Kaḷutara" parent="1"/> - <iso_3166_2_entry - code="LK-21" name="Mahanuvara" parent="2"/> - <iso_3166_2_entry - code="LK-92" name="Kægalla" parent="9"/> - <iso_3166_2_entry - code="LK-42" name="Kilinŏchchi" parent="4"/> - <iso_3166_2_entry - code="LK-61" name="Kuruṇægala" parent="6"/> - <iso_3166_2_entry - code="LK-43" name="Mannārama" parent="4"/> - <iso_3166_2_entry - code="LK-22" name="Mātale" parent="2"/> - <iso_3166_2_entry - code="LK-32" name="Mātara" parent="3"/> - <iso_3166_2_entry - code="LK-82" name="Mŏṇarāgala" parent="8"/> - <iso_3166_2_entry - code="LK-45" name="Mulativ" parent="4"/> - <iso_3166_2_entry - code="LK-23" name="Nuvara Ĕliya" parent="2"/> - <iso_3166_2_entry - code="LK-72" name="Pŏḷŏnnaruva" parent="7"/> - <iso_3166_2_entry - code="LK-62" name="Puttalama" parent="6"/> - <iso_3166_2_entry - code="LK-91" name="Ratnapura" parent="9"/> - <iso_3166_2_entry - code="LK-53" name="Trikuṇāmalaya" parent="5"/> - <iso_3166_2_entry - code="LK-44" name="Vavuniyāva" parent="4"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Liberia --> - <iso_3166_country code="LR"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="LR-BM" name="Bomi"/> - <iso_3166_2_entry - code="LR-BG" name="Bong"/> - <iso_3166_2_entry - code="LR-GB" name="Grand Bassa"/> - <iso_3166_2_entry - code="LR-CM" name="Grand Cape Mount"/> - <iso_3166_2_entry - code="LR-GG" name="Grand Gedeh"/> - <iso_3166_2_entry - code="LR-GK" name="Grand Kru"/> - <iso_3166_2_entry - code="LR-LO" name="Lofa"/> - <iso_3166_2_entry - code="LR-MG" name="Margibi"/> - <iso_3166_2_entry - code="LR-MY" name="Maryland"/> - <iso_3166_2_entry - code="LR-MO" name="Montserrado"/> - <iso_3166_2_entry - code="LR-NI" name="Nimba"/> - <iso_3166_2_entry - code="LR-RI" name="Rivercess"/> - <iso_3166_2_entry - code="LR-SI" name="Sinoe"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Lesotho --> - <iso_3166_country code="LS"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="LS-D" name="Berea"/> - <iso_3166_2_entry - code="LS-B" name="Butha-Buthe"/> - <iso_3166_2_entry - code="LS-C" name="Leribe"/> - <iso_3166_2_entry - code="LS-E" name="Mafeteng"/> - <iso_3166_2_entry - code="LS-A" name="Maseru"/> - <iso_3166_2_entry - code="LS-F" name="Mohale's Hoek"/> - <iso_3166_2_entry - code="LS-J" name="Mokhotlong"/> - <iso_3166_2_entry - code="LS-H" name="Qacha's Nek"/> - <iso_3166_2_entry - code="LS-G" name="Quthing"/> - <iso_3166_2_entry - code="LS-K" name="Thaba-Tseka"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Lithuania --> - <iso_3166_country code="LT"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="LT-AL" name="Alytaus Apskritis"/> - <iso_3166_2_entry - code="LT-KU" name="Kauno Apskritis"/> - <iso_3166_2_entry - code="LT-KL" name="Klaipėdos Apskritis"/> - <iso_3166_2_entry - code="LT-MR" name="Marijampolės Apskritis"/> - <iso_3166_2_entry - code="LT-PN" name="Panevėžio Apskritis"/> - <iso_3166_2_entry - code="LT-SA" name="Šiaulių Apskritis"/> - <iso_3166_2_entry - code="LT-TA" name="Tauragés Apskritis"/> - <iso_3166_2_entry - code="LT-TE" name="Telšių Apskritis"/> - <iso_3166_2_entry - code="LT-UT" name="Utenos Apskritis"/> - <iso_3166_2_entry - code="LT-VL" name="Vilniaus Apskritis"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Luxembourg --> - <iso_3166_country code="LU"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="LU-D" name="Diekirch"/> - <iso_3166_2_entry - code="LU-G" name="Grevenmacher"/> - <iso_3166_2_entry - code="LU-L" name="Luxembourg"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Latvia --> - <iso_3166_country code="LV"> - <iso_3166_subset type="District"> - <!-- We should probably add a "District" suffix here, but is it "Rajon" --> - <!-- or "Apriņķis"? --> - <iso_3166_2_entry - code="LV-AI" name="Aizkraukle"/> - <iso_3166_2_entry - code="LV-AL" name="Alūksne"/> - <iso_3166_2_entry - code="LV-BL" name="Balvi"/> - <iso_3166_2_entry - code="LV-BU" name="Bauska"/> - <iso_3166_2_entry - code="LV-CE" name="Cēsis"/> - <iso_3166_2_entry - code="LV-DA" name="Daugavpils"/> - <iso_3166_2_entry - code="LV-DO" name="Dobele"/> - <iso_3166_2_entry - code="LV-GU" name="Gulbene"/> - <iso_3166_2_entry - code="LV-JK" name="Jēkabpils"/> - <iso_3166_2_entry - code="LV-JL" name="Jelgava"/> - <iso_3166_2_entry - code="LV-KR" name="Krāslava"/> - <iso_3166_2_entry - code="LV-KU" name="Kuldīga"/> - <iso_3166_2_entry - code="LV-LE" name="Liepāja"/> - <iso_3166_2_entry - code="LV-LM" name="Limbaži"/> - <iso_3166_2_entry - code="LV-LU" name="Ludza"/> - <iso_3166_2_entry - code="LV-MA" name="Madona"/> - <iso_3166_2_entry - code="LV-OG" name="Ogre"/> - <iso_3166_2_entry - code="LV-PR" name="Preiļi"/> - <iso_3166_2_entry - code="LV-RE" name="Rēzekne"/> - <iso_3166_2_entry - code="LV-RI" name="Rīga"/> - <iso_3166_2_entry - code="LV-SA" name="Saldus"/> - <iso_3166_2_entry - code="LV-TA" name="Talsi"/> - <iso_3166_2_entry - code="LV-TU" name="Tukums"/> - <iso_3166_2_entry - code="LV-VK" name="Valka"/> - <iso_3166_2_entry - code="LV-VM" name="Valmiera"/> - <iso_3166_2_entry - code="LV-VE" name="Ventspils"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="LV-DGV" name="Daugavpils"/> - <iso_3166_2_entry - code="LV-JEL" name="Jelgava"/> - <iso_3166_2_entry - code="LV-JUR" name="Jūrmala"/> - <iso_3166_2_entry - code="LV-LPX" name="Liepāja"/> - <iso_3166_2_entry - code="LV-REZ" name="Rēzekne"/> - <iso_3166_2_entry - code="LV-RIX" name="Rīga"/> - <iso_3166_2_entry - code="LV-VEN" name="Ventspils"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Libya --> - <iso_3166_country code="LY"> - <iso_3166_subset type="Popularates"> - <iso_3166_2_entry - code="LY-BU" name="Al Buţnān"/> - <iso_3166_2_entry - code="LY-JA" name="Al Jabal al Akhḑar"/> - <iso_3166_2_entry - code="LY-JG" name="Al Jabal al Gharbī"/> - <iso_3166_2_entry - code="LY-JI" name="Al Jifārah"/> - <iso_3166_2_entry - code="LY-JU" name="Al Jufrah"/> - <iso_3166_2_entry - code="LY-KF" name="Al Kufrah"/> - <iso_3166_2_entry - code="LY-MJ" name="Al Marj"/> - <iso_3166_2_entry - code="LY-MB" name="Al Marqab"/> - <iso_3166_2_entry - code="LY-WA" name="Al Wāḩāt"/> - <iso_3166_2_entry - code="LY-NQ" name="An Nuqaţ al Khams"/> - <iso_3166_2_entry - code="LY-ZA" name="Az Zāwiyah"/> - <iso_3166_2_entry - code="LY-BA" name="Banghāzī"/> - <iso_3166_2_entry - code="LY-DR" name="Darnah"/> - <iso_3166_2_entry - code="LY-GT" name="Ghāt"/> - <iso_3166_2_entry - code="LY-JB" name="Jaghbūb"/> - <iso_3166_2_entry - code="LY-MI" name="Mişrātah"/> - <iso_3166_2_entry - code="LY-MQ" name="Murzuq"/> - <iso_3166_2_entry - code="LY-NL" name="Nālūt"/> - <iso_3166_2_entry - code="LY-SB" name="Sabhā"/> - <iso_3166_2_entry - code="LY-SR" name="Surt"/> - <iso_3166_2_entry - code="LY-TB" name="Ţarābulus"/> - <iso_3166_2_entry - code="LY-WD" name="Wādī al Ḩayāt"/> - <iso_3166_2_entry - code="LY-WS" name="Wādī ash Shāţiʾ"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Morocco --> - <iso_3166_country code="MA"> - <iso_3166_subset type="Economic region"> - <iso_3166_2_entry - code="MA 09" name="Chaouia-Ouardigha"/> - <iso_3166_2_entry - code="MA 10" name="Doukhala-Abda"/> - <iso_3166_2_entry - code="MA 05" name="Fès-Boulemane"/> - <iso_3166_2_entry - code="MA 02" name="Gharb-Chrarda-Beni Hssen"/> - <iso_3166_2_entry - code="MA 08" name="Grand Casablanca"/> - <iso_3166_2_entry - code="MA 14" name="Guelmim-Es Smara"/> - <iso_3166_2_entry - code="MA 15" name="Laâyoune-Boujdour-Sakia el Hamra"/> - <iso_3166_2_entry - code="MA 04" name="L'Oriental"/> - <iso_3166_2_entry - code="MA 11" name="Marrakech-Tensift-Al Haouz"/> - <iso_3166_2_entry - code="MA 06" name="Meknès-Tafilalet"/> - <iso_3166_2_entry - code="MA 16" name="Oued ed Dahab-Lagouira"/> - <iso_3166_2_entry - code="MA 07" name="Rabat-Salé-Zemmour-Zaer"/> - <iso_3166_2_entry - code="MA 13" name="Sous-Massa-Draa"/> - <iso_3166_2_entry - code="MA 12" name="Tadla-Azilal"/> - <iso_3166_2_entry - code="MA 01" name="Tanger-Tétouan"/> - <iso_3166_2_entry - code="MA 03" name="Taza-Al Hoceima-Taounate"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="MA-HAO" name="Al Haouz" parent="11"/> - <iso_3166_2_entry - code="MA-HOC" name="Al Hoceïma" parent="03"/> - <iso_3166_2_entry - code="MA-ASZ" name="Assa-Zag" parent="14"/> - <iso_3166_2_entry - code="MA-AZI" name="Azilal" parent="12"/> - <iso_3166_2_entry - code="MA-BEM" name="Beni Mellal" parent="12"/> - <iso_3166_2_entry - code="MA-BES" name="Ben Slimane" parent="09"/> - <iso_3166_2_entry - code="MA-BER" name="Berkane" parent="04"/> - <iso_3166_2_entry - code="MA-BOD" name="Boujdour (EH)" parent="15"/> - <iso_3166_2_entry - code="MA-BOM" name="Boulemane" parent="05"/> - <iso_3166_2_entry - code="MA-CHE" name="Chefchaouen" parent="01"/> - <iso_3166_2_entry - code="MA-CHI" name="Chichaoua" parent="11"/> - <iso_3166_2_entry - code="MA-CHT" name="Chtouka-Ait Baha" parent="13"/> - <iso_3166_2_entry - code="MA-HAJ" name="El Hajeb" parent="06"/> - <iso_3166_2_entry - code="MA-JDI" name="El Jadida" parent="10"/> - <iso_3166_2_entry - code="MA-ERR" name="Errachidia" parent="06"/> - <iso_3166_2_entry - code="MA-ESI" name="Essaouira" parent="11"/> - <iso_3166_2_entry - code="MA-ESM" name="Es Smara (EH)" parent="14"/> - <iso_3166_2_entry - code="MA-FIG" name="Figuig" parent="04"/> - <iso_3166_2_entry - code="MA-GUE" name="Guelmim" parent="14"/> - <iso_3166_2_entry - code="MA-IFR" name="Ifrane" parent="06"/> - <iso_3166_2_entry - code="MA-JRA" name="Jrada" parent="04"/> - <iso_3166_2_entry - code="MA-KES" name="Kelaat es Sraghna" parent="11"/> - <iso_3166_2_entry - code="MA-KEN" name="Kénitra" parent="02"/> - <iso_3166_2_entry - code="MA-KHE" name="Khemisaet" parent="07"/> - <iso_3166_2_entry - code="MA-KHN" name="Khenifra" parent="06"/> - <iso_3166_2_entry - code="MA-KHO" name="Khouribga" parent="09"/> - <iso_3166_2_entry - code="MA-LAA" name="Laâyoune (EH)" parent="15"/> - <iso_3166_2_entry - code="MA-LAP" name="Larache" parent="01"/> - <iso_3166_2_entry - code="MA-MED" name="Médiouna" parent="08"/> - <iso_3166_2_entry - code="MA-MOU" name="Moulay Yacoub" parent="05"/> - <iso_3166_2_entry - code="MA-NAD" name="Nador" parent="04"/> - <iso_3166_2_entry - code="MA-NOU" name="Nouaceur" parent="08"/> - <iso_3166_2_entry - code="MA-OUA" name="Ouarzazate" parent="13"/> - <iso_3166_2_entry - code="MA-OUD" name="Oued ed Dahab (EH)" parent="16"/> - <iso_3166_2_entry - code="MA-SAF" name="Safi" parent="10"/> - <iso_3166_2_entry - code="MA-SEF" name="Sefrou" parent="05"/> - <iso_3166_2_entry - code="MA-SET" name="Settat" parent="09"/> - <iso_3166_2_entry - code="MA-SIK" name="Sidl Kacem" parent="02"/> - <iso_3166_2_entry - code="MA-TNT" name="Tan-Tan" parent="14"/> - <iso_3166_2_entry - code="MA-TAO" name="Taounate" parent="03"/> - <iso_3166_2_entry - code="MA-TAI" name="Taourirt" parent="04"/> - <iso_3166_2_entry - code="MA-TAR" name="Taroudant" parent="13"/> - <iso_3166_2_entry - code="MA-TAT" name="Tata" parent="14"/> - <iso_3166_2_entry - code="MA-TAZ" name="Taza" parent="03"/> - <iso_3166_2_entry - code="MA-TIZ" name="Tiznit" parent="13"/> - <iso_3166_2_entry - code="MA-ZAG" name="Zagora" parent="13"/> - </iso_3166_subset> - <iso_3166_subset type="Prefecture"> - <iso_3166_2_entry - code="MA-AGD" name="Agadir-Ida-Outanane" parent="13"/> - <iso_3166_2_entry - code="MA-AOU" name="Aousserd" parent="16"/> - <iso_3166_2_entry - code="MA-CAS" name="Casablanca [Dar el Beïda]" parent="08"/> - <iso_3166_2_entry - code="MA-FAH" name="Fahs-Beni Makada" parent="01"/> - <iso_3166_2_entry - code="MA-FES" name="Fès-Dar-Dbibegh" parent="05"/> - <iso_3166_2_entry - code="MA-INE" name="Inezgane-Ait Melloul" parent="13"/> - <iso_3166_2_entry - code="MA-MMD" name="Marrakech-Medina" parent="11"/> - <iso_3166_2_entry - code="MA-MMN" name="Marrakech-Menara" parent="11"/> - <iso_3166_2_entry - code="MA-MEK" name="Meknès" parent="06"/> - <iso_3166_2_entry - code="MA-MOH" name="Mohammadia" parent="08"/> - <iso_3166_2_entry - code="MA-OUJ" name="Oujda-Angad" parent="04"/> - <iso_3166_2_entry - code="MA-RAB" name="Rabat" parent="07"/> - <iso_3166_2_entry - code="MA-SAL" name="Salé" parent="07"/> - <iso_3166_2_entry - code="MA-SYB" name="Sidi Youssef Ben Ali" parent="11"/> - <iso_3166_2_entry - code="MA-SKH" name="Skhirate-Témara" parent="07"/> - <iso_3166_2_entry - code="MA-TNG" name="Tanger-Assilah" parent="01"/> - <iso_3166_2_entry - code="MA-TET" name="Tétouan" parent="01"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Moldova --> - <iso_3166_country code="MD"> - <iso_3166_subset type="Autonomous territorial unit"> - <iso_3166_2_entry - code="MD-GA" name="Găgăuzia, Unitatea teritorială autonomă"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MD-BA" name="Bălți"/> - <iso_3166_2_entry - code="MD-BD" name="Tighina"/> - <iso_3166_2_entry - code="MD-CU" name="Chișinău"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MD-AN" name="Anenii Noi"/> - <iso_3166_2_entry - code="MD-BS" name="Basarabeasca"/> - <iso_3166_2_entry - code="MD-BR" name="Briceni"/> - <iso_3166_2_entry - code="MD-CA" name="Cahul"/> - <iso_3166_2_entry - code="MD-CT" name="Cantemir"/> - <iso_3166_2_entry - code="MD-CL" name="Călărași"/> - <iso_3166_2_entry - code="MD-CS" name="Căușeni"/> - <iso_3166_2_entry - code="MD-CM" name="Cimișlia"/> - <iso_3166_2_entry - code="MD-CR" name="Criuleni"/> - <iso_3166_2_entry - code="MD-DO" name="Dondușeni"/> - <iso_3166_2_entry - code="MD-DR" name="Drochia"/> - <iso_3166_2_entry - code="MD-DU" name="Dubăsari"/> - <iso_3166_2_entry - code="MD-ED" name="Edineț"/> - <iso_3166_2_entry - code="MD-FA" name="Fălești"/> - <iso_3166_2_entry - code="MD-FL" name="Florești"/> - <iso_3166_2_entry - code="MD-GL" name="Glodeni"/> - <iso_3166_2_entry - code="MD-HI" name="Hîncești"/> - <iso_3166_2_entry - code="MD-IA" name="Ialoveni"/> - <iso_3166_2_entry - code="MD-LE" name="Leova"/> - <iso_3166_2_entry - code="MD-NI" name="Nisporeni"/> - <iso_3166_2_entry - code="MD-OC" name="Ocnița"/> - <iso_3166_2_entry - code="MD-OR" name="Orhei"/> - <iso_3166_2_entry - code="MD-RE" name="Rezina"/> - <iso_3166_2_entry - code="MD-RI" name="Rîșcani"/> - <iso_3166_2_entry - code="MD-SI" name="Sîngerei"/> - <iso_3166_2_entry - code="MD-SO" name="Soroca"/> - <iso_3166_2_entry - code="MD-ST" name="Strășeni"/> - <iso_3166_2_entry - code="MD-SD" name="Șoldănești"/> - <iso_3166_2_entry - code="MD-SV" name="Ștefan Vodă"/> - <iso_3166_2_entry - code="MD-TA" name="Taraclia"/> - <iso_3166_2_entry - code="MD-TE" name="Telenești"/> - <iso_3166_2_entry - code="MD-UN" name="Ungheni"/> - </iso_3166_subset> - <iso_3166_subset type="Territorial unit"> - <iso_3166_2_entry - code="MD-SN" name="Stînga Nistrului, unitatea teritorială din"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Montenegro --> - <iso_3166_country code="ME"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="ME-01" name="Andrijevica"/> - <iso_3166_2_entry - code="ME-02" name="Bar"/> - <iso_3166_2_entry - code="ME-03" name="Berane"/> - <iso_3166_2_entry - code="ME-04" name="Bijelo Polje"/> - <iso_3166_2_entry - code="ME-05" name="Budva"/> - <iso_3166_2_entry - code="ME-06" name="Cetinje"/> - <iso_3166_2_entry - code="ME-07" name="Danilovgrad"/> - <iso_3166_2_entry - code="ME-08" name="Herceg-Novi"/> - <iso_3166_2_entry - code="ME-09" name="Kolašin"/> - <iso_3166_2_entry - code="ME-10" name="Kotor"/> - <iso_3166_2_entry - code="ME-11" name="Mojkovac"/> - <iso_3166_2_entry - code="ME-12" name="Nikšić"/> - <iso_3166_2_entry - code="ME-13" name="Plav"/> - <iso_3166_2_entry - code="ME-14" name="Pljevlja"/> - <iso_3166_2_entry - code="ME-15" name="Plužine"/> - <iso_3166_2_entry - code="ME-16" name="Podgorica"/> - <iso_3166_2_entry - code="ME-17" name="Rožaje"/> - <iso_3166_2_entry - code="ME-18" name="Šavnik"/> - <iso_3166_2_entry - code="ME-19" name="Tivat"/> - <iso_3166_2_entry - code="ME-20" name="Ulcinj"/> - <iso_3166_2_entry - code="ME-21" name="Žabljak"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Martin (French part) --> - <iso_3166_country code="MF"/> - <!-- Madagascar --> - <iso_3166_country code="MG"> - <iso_3166_subset type="Autonomous province"> - <iso_3166_2_entry - code="MG-T" name="Antananarivo"/> - <iso_3166_2_entry - code="MG-D" name="Antsiranana"/> - <iso_3166_2_entry - code="MG-F" name="Fianarantsoa"/> - <iso_3166_2_entry - code="MG-M" name="Mahajanga"/> - <iso_3166_2_entry - code="MG-A" name="Toamasina"/> - <iso_3166_2_entry - code="MG-U" name="Toliara"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Marshall Islands --> - <iso_3166_country code="MH"> - <iso_3166_subset type="Chains (of islands)"> - <iso_3166_2_entry - code="MH-L" name="Ralik chain"/> - <iso_3166_2_entry - code="MH-T" name="Ratak chain"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="MH-ALL" name="Ailinglaplap" parent="L"/> - <iso_3166_2_entry - code="MH-ALK" name="Ailuk" parent="T"/> - <iso_3166_2_entry - code="MH-ARN" name="Arno" parent="T"/> - <iso_3166_2_entry - code="MH-AUR" name="Aur" parent="T"/> - <iso_3166_2_entry - code="MH-EBO" name="Ebon" parent="L"/> - <iso_3166_2_entry - code="MH-ENI" name="Enewetak" parent="L"/> - <iso_3166_2_entry - code="MH-JAB" name="Jabat" parent="L"/> - <iso_3166_2_entry - code="MH-JAL" name="Jaluit" parent="L"/> - <iso_3166_2_entry - code="MH-KIL" name="Kili" parent="L"/> - <iso_3166_2_entry - code="MH-KWA" name="Kwajalein" parent="L"/> - <iso_3166_2_entry - code="MH-LAE" name="Lae" parent="L"/> - <iso_3166_2_entry - code="MH-LIB" name="Lib" parent="L"/> - <iso_3166_2_entry - code="MH-LIK" name="Likiep" parent="T"/> - <iso_3166_2_entry - code="MH-MAJ" name="Majuro" parent="T"/> - <iso_3166_2_entry - code="MH-MAL" name="Maloelap" parent="T"/> - <iso_3166_2_entry - code="MH-MEJ" name="Mejit" parent="T"/> - <iso_3166_2_entry - code="MH-MIL" name="Mili" parent="T"/> - <iso_3166_2_entry - code="MH-NMK" name="Namdrik" parent="L"/> - <iso_3166_2_entry - code="MH-NMU" name="Namu" parent="L"/> - <iso_3166_2_entry - code="MH-RON" name="Rongelap" parent="L"/> - <iso_3166_2_entry - code="MH-UJA" name="Ujae" parent="L"/> - <iso_3166_2_entry - code="MH-UTI" name="Utirik" parent="T"/> - <iso_3166_2_entry - code="MH-WTN" name="Wotho" parent="L"/> - <iso_3166_2_entry - code="MH-WTJ" name="Wotje" parent="T"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Macedonia --> - <iso_3166_country code="MK"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="MK-01" name="Aerodrom"/> - <iso_3166_2_entry - code="MK-02" name="Aračinovo"/> - <iso_3166_2_entry - code="MK-03" name="Berovo"/> - <iso_3166_2_entry - code="MK-04" name="Bitola"/> - <iso_3166_2_entry - code="MK-05" name="Bogdanci"/> - <iso_3166_2_entry - code="MK-06" name="Bogovinje"/> - <iso_3166_2_entry - code="MK-07" name="Bosilovo"/> - <iso_3166_2_entry - code="MK-08" name="Brvenica"/> - <iso_3166_2_entry - code="MK-09" name="Butel"/> - <iso_3166_2_entry - code="MK-77" name="Centar"/> - <iso_3166_2_entry - code="MK-78" name="Centar Župa"/> - <iso_3166_2_entry - code="MK-79" name="Čair"/> - <iso_3166_2_entry - code="MK-80" name="Čaška"/> - <iso_3166_2_entry - code="MK-81" name="Češinovo-Obleševo"/> - <iso_3166_2_entry - code="MK-82" name="Čučer Sandevo"/> - <iso_3166_2_entry - code="MK-21" name="Debar"/> - <iso_3166_2_entry - code="MK-22" name="Debarca"/> - <iso_3166_2_entry - code="MK-23" name="Delčevo"/> - <iso_3166_2_entry - code="MK-25" name="Demir Hisar"/> - <iso_3166_2_entry - code="MK-24" name="Demir Kapija"/> - <iso_3166_2_entry - code="MK-26" name="Dojran"/> - <iso_3166_2_entry - code="MK-27" name="Dolneni"/> - <iso_3166_2_entry - code="MK-28" name="Drugovo"/> - <iso_3166_2_entry - code="MK-17" name="Gazi Baba"/> - <iso_3166_2_entry - code="MK-18" name="Gevgelija"/> - <iso_3166_2_entry - code="MK-29" name="Gjorče Petrov"/> - <iso_3166_2_entry - code="MK-19" name="Gostivar"/> - <iso_3166_2_entry - code="MK-20" name="Gradsko"/> - <iso_3166_2_entry - code="MK-34" name="Ilinden"/> - <iso_3166_2_entry - code="MK-35" name="Jegunovce"/> - <iso_3166_2_entry - code="MK-37" name="Karbinci"/> - <iso_3166_2_entry - code="MK-38" name="Karpoš"/> - <iso_3166_2_entry - code="MK-36" name="Kavadarci"/> - <iso_3166_2_entry - code="MK-40" name="Kičevo"/> - <iso_3166_2_entry - code="MK-39" name="Kisela Voda"/> - <iso_3166_2_entry - code="MK-42" name="Kočani"/> - <iso_3166_2_entry - code="MK-41" name="Konče"/> - <iso_3166_2_entry - code="MK-43" name="Kratovo"/> - <iso_3166_2_entry - code="MK-44" name="Kriva Palanka"/> - <iso_3166_2_entry - code="MK-45" name="Krivogaštani"/> - <iso_3166_2_entry - code="MK-46" name="Kruševo"/> - <iso_3166_2_entry - code="MK-47" name="Kumanovo"/> - <iso_3166_2_entry - code="MK-48" name="Lipkovo"/> - <iso_3166_2_entry - code="MK-49" name="Lozovo"/> - <iso_3166_2_entry - code="MK-51" name="Makedonska Kamenica"/> - <iso_3166_2_entry - code="MK-52" name="Makedonski Brod"/> - <iso_3166_2_entry - code="MK-50" name="Mavrovo-i-Rostuša"/> - <iso_3166_2_entry - code="MK-53" name="Mogila"/> - <iso_3166_2_entry - code="MK-54" name="Negotino"/> - <iso_3166_2_entry - code="MK-55" name="Novaci"/> - <iso_3166_2_entry - code="MK-56" name="Novo Selo"/> - <iso_3166_2_entry - code="MK-58" name="Ohrid"/> - <iso_3166_2_entry - code="MK-57" name="Oslomej"/> - <iso_3166_2_entry - code="MK-60" name="Pehčevo"/> - <iso_3166_2_entry - code="MK-59" name="Petrovec"/> - <iso_3166_2_entry - code="MK-61" name="Plasnica"/> - <iso_3166_2_entry - code="MK-62" name="Prilep"/> - <iso_3166_2_entry - code="MK-63" name="Probištip"/> - <iso_3166_2_entry - code="MK-64" name="Radoviš"/> - <iso_3166_2_entry - code="MK-65" name="Rankovce"/> - <iso_3166_2_entry - code="MK-66" name="Resen"/> - <iso_3166_2_entry - code="MK-67" name="Rosoman"/> - <iso_3166_2_entry - code="MK-68" name="Saraj"/> - <iso_3166_2_entry - code="MK-83" name="Štip"/> - <iso_3166_2_entry - code="MK-84" name="Šuto Orizari"/> - <iso_3166_2_entry - code="MK-70" name="Sopište"/> - <iso_3166_2_entry - code="MK-71" name="Staro Nagoričane"/> - <iso_3166_2_entry - code="MK-72" name="Struga"/> - <iso_3166_2_entry - code="MK-73" name="Strumica"/> - <iso_3166_2_entry - code="MK-74" name="Studeničani"/> - <iso_3166_2_entry - code="MK-69" name="Sveti Nikole"/> - <iso_3166_2_entry - code="MK-75" name="Tearce"/> - <iso_3166_2_entry - code="MK-76" name="Tetovo"/> - <iso_3166_2_entry - code="MK-10" name="Valandovo"/> - <iso_3166_2_entry - code="MK-11" name="Vasilevo"/> - <iso_3166_2_entry - code="MK-13" name="Veles"/> - <iso_3166_2_entry - code="MK-12" name="Vevčani"/> - <iso_3166_2_entry - code="MK-14" name="Vinica"/> - <iso_3166_2_entry - code="MK-15" name="Vraneštica"/> - <iso_3166_2_entry - code="MK-16" name="Vrapčište"/> - <iso_3166_2_entry - code="MK-31" name="Zajas"/> - <iso_3166_2_entry - code="MK-32" name="Zelenikovo"/> - <iso_3166_2_entry - code="MK-30" name="Želino"/> - <iso_3166_2_entry - code="MK-33" name="Zrnovci"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mali --> - <iso_3166_country code="ML"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="ML-BK0" name="Bamako"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="ML-7" name="Gao"/> - <iso_3166_2_entry - code="ML-1" name="Kayes"/> - <iso_3166_2_entry - code="ML-8" name="Kidal"/> - <iso_3166_2_entry - code="ML-2" name="Koulikoro"/> - <iso_3166_2_entry - code="ML-5" name="Mopti"/> - <iso_3166_2_entry - code="ML-4" name="Ségou"/> - <iso_3166_2_entry - code="ML-3" name="Sikasso"/> - <iso_3166_2_entry - code="ML-6" name="Tombouctou"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Myanmar --> - <iso_3166_country code="MM"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="MM-07" name="Ayeyarwady"/> - <iso_3166_2_entry - code="MM-02" name="Bago"/> - <iso_3166_2_entry - code="MM-03" name="Magway"/> - <iso_3166_2_entry - code="MM-04" name="Mandalay"/> - <iso_3166_2_entry - code="MM-01" name="Sagaing"/> - <iso_3166_2_entry - code="MM-05" name="Tanintharyi"/> - <iso_3166_2_entry - code="MM-06" name="Yangon"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="MM-14" name="Chin"/> - <iso_3166_2_entry - code="MM-11" name="Kachin"/> - <iso_3166_2_entry - code="MM-12" name="Kayah"/> - <iso_3166_2_entry - code="MM-13" name="Kayin"/> - <iso_3166_2_entry - code="MM-15" name="Mon"/> - <iso_3166_2_entry - code="MM-16" name="Rakhine"/> - <iso_3166_2_entry - code="MM-17" name="Shan"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mongolia --> - <iso_3166_country code="MN"> - <iso_3166_subset type="Province"> - <!-- Different transliterations possible, is there an official one? --> - <iso_3166_2_entry - code="MN-073" name="Arhangay"/> - <iso_3166_2_entry - code="MN-069" name="Bayanhongor"/> - <iso_3166_2_entry - code="MN-071" name="Bayan-Ölgiy"/> - <iso_3166_2_entry - code="MN-067" name="Bulgan"/> - <iso_3166_2_entry - code="MN-061" name="Dornod"/> - <iso_3166_2_entry - code="MN-063" name="Dornogovi"/> - <iso_3166_2_entry - code="MN-059" name="Dundgovi"/> - <iso_3166_2_entry - code="MN-057" name="Dzavhan"/> - <iso_3166_2_entry - code="MN-065" name="Govi-Altay"/> - <iso_3166_2_entry - code="MN-039" name="Hentiy"/> - <iso_3166_2_entry - code="MN-043" name="Hovd"/> - <iso_3166_2_entry - code="MN-041" name="Hövsgöl"/> - <iso_3166_2_entry - code="MN-053" name="Ömnögovi"/> - <iso_3166_2_entry - code="MN-055" name="Övörhangay"/> - <iso_3166_2_entry - code="MN-049" name="Selenge"/> - <iso_3166_2_entry - code="MN-051" name="Sühbaatar"/> - <iso_3166_2_entry - code="MN-047" name="Töv"/> - <iso_3166_2_entry - code="MN-046" name="Uvs"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="MN-1" name="Ulanbaatar"/> - <iso_3166_2_entry - code="MN-037" name="Darhan uul"/> - <iso_3166_2_entry - code="MN-064" name="Govi-Sumber"/> - <iso_3166_2_entry - code="MN-035" name="Orhon"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Macao --> - <iso_3166_country code="MO"/> - <!-- Mauritania --> - <iso_3166_country code="MR"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MR-NKC" name="Nouakchott"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="MR-07" name="Adrar"/> - <iso_3166_2_entry - code="MR-03" name="Assaba"/> - <iso_3166_2_entry - code="MR-05" name="Brakna"/> - <iso_3166_2_entry - code="MR-08" name="Dakhlet Nouadhibou"/> - <iso_3166_2_entry - code="MR-04" name="Gorgol"/> - <iso_3166_2_entry - code="MR-10" name="Guidimaka"/> - <iso_3166_2_entry - code="MR-01" name="Hodh ech Chargui"/> - <iso_3166_2_entry - code="MR-02" name="Hodh el Charbi"/> - <iso_3166_2_entry - code="MR-12" name="Inchiri"/> - <iso_3166_2_entry - code="MR-09" name="Tagant"/> - <iso_3166_2_entry - code="MR-11" name="Tiris Zemmour"/> - <iso_3166_2_entry - code="MR-06" name="Trarza"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Malta --> - <iso_3166_country code="MT"> - <iso_3166_subset type="Local council"> - <iso_3166_2_entry - code="MT-01" name="Attard"/> - <iso_3166_2_entry - code="MT-02" name="Balzan"/> - <iso_3166_2_entry - code="MT-03" name="Birgu"/> - <iso_3166_2_entry - code="MT-04" name="Birkirkara"/> - <iso_3166_2_entry - code="MT-05" name="Birżebbuġa"/> - <iso_3166_2_entry - code="MT-06" name="Bormla"/> - <iso_3166_2_entry - code="MT-07" name="Dingli"/> - <iso_3166_2_entry - code="MT-08" name="Fgura"/> - <iso_3166_2_entry - code="MT-09" name="Floriana"/> - <iso_3166_2_entry - code="MT-10" name="Fontana"/> - <iso_3166_2_entry - code="MT-11" name="Gudja"/> - <iso_3166_2_entry - code="MT-12" name="Gżira"/> - <iso_3166_2_entry - code="MT-13" name="Għajnsielem"/> - <iso_3166_2_entry - code="MT-14" name="Għarb"/> - <iso_3166_2_entry - code="MT-15" name="Għargħur"/> - <iso_3166_2_entry - code="MT-16" name="Għasri"/> - <iso_3166_2_entry - code="MT-17" name="Għaxaq"/> - <iso_3166_2_entry - code="MT-18" name="Ħamrun"/> - <iso_3166_2_entry - code="MT-19" name="Iklin"/> - <iso_3166_2_entry - code="MT-20" name="Isla"/> - <iso_3166_2_entry - code="MT-21" name="Kalkara"/> - <iso_3166_2_entry - code="MT-22" name="Kerċem"/> - <iso_3166_2_entry - code="MT-23" name="Kirkop"/> - <iso_3166_2_entry - code="MT-24" name="Lija"/> - <iso_3166_2_entry - code="MT-25" name="Luqa"/> - <iso_3166_2_entry - code="MT-26" name="Marsa"/> - <iso_3166_2_entry - code="MT-27" name="Marsaskala"/> - <iso_3166_2_entry - code="MT-28" name="Marsaxlokk"/> - <iso_3166_2_entry - code="MT-29" name="Mdina"/> - <iso_3166_2_entry - code="MT-30" name="Mellieħa"/> - <iso_3166_2_entry - code="MT-31" name="Mġarr"/> - <iso_3166_2_entry - code="MT-32" name="Mosta"/> - <iso_3166_2_entry - code="MT-33" name="Mqabba"/> - <iso_3166_2_entry - code="MT-34" name="Msida"/> - <iso_3166_2_entry - code="MT-35" name="Mtarfa"/> - <iso_3166_2_entry - code="MT-36" name="Munxar"/> - <iso_3166_2_entry - code="MT-37" name="Nadur"/> - <iso_3166_2_entry - code="MT-38" name="Naxxar"/> - <iso_3166_2_entry - code="MT-39" name="Paola"/> - <iso_3166_2_entry - code="MT-40" name="Pembroke"/> - <iso_3166_2_entry - code="MT-41" name="Pietà"/> - <iso_3166_2_entry - code="MT-42" name="Qala"/> - <iso_3166_2_entry - code="MT-43" name="Qormi"/> - <iso_3166_2_entry - code="MT-44" name="Qrendi"/> - <iso_3166_2_entry - code="MT-45" name="Rabat Għawdex"/> - <iso_3166_2_entry - code="MT-46" name="Rabat Malta"/> - <iso_3166_2_entry - code="MT-47" name="Safi"/> - <iso_3166_2_entry - code="MT-48" name="San Ġiljan"/> - <iso_3166_2_entry - code="MT-49" name="San Ġwann"/> - <iso_3166_2_entry - code="MT-50" name="San Lawrenz"/> - <iso_3166_2_entry - code="MT-51" name="San Pawl il-Baħar"/> - <iso_3166_2_entry - code="MT-52" name="Sannat"/> - <iso_3166_2_entry - code="MT-53" name="Santa Luċija"/> - <iso_3166_2_entry - code="MT-54" name="Santa Venera"/> - <iso_3166_2_entry - code="MT-55" name="Siġġiewi"/> - <iso_3166_2_entry - code="MT-56" name="Sliema"/> - <iso_3166_2_entry - code="MT-57" name="Swieqi"/> - <iso_3166_2_entry - code="MT-58" name="Ta’ Xbiex"/> - <iso_3166_2_entry - code="MT-59" name="Tarxien"/> - <iso_3166_2_entry - code="MT-60" name="Valletta"/> - <iso_3166_2_entry - code="MT-61" name="Xagħra"/> - <iso_3166_2_entry - code="MT-62" name="Xewkija"/> - <iso_3166_2_entry - code="MT-63" name="Xgħajra"/> - <iso_3166_2_entry - code="MT-64" name="Żabbar"/> - <iso_3166_2_entry - code="MT-65" name="Żebbuġ Għawdex"/> - <iso_3166_2_entry - code="MT-66" name="Żebbuġ Malta"/> - <iso_3166_2_entry - code="MT-67" name="Żejtun"/> - <iso_3166_2_entry - code="MT-68" name="Żurrieq"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mauritius --> - <iso_3166_country code="MU"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MU-BR" name="Beau Bassin-Rose Hill"/> - <iso_3166_2_entry - code="MU-CU" name="Curepipe"/> - <iso_3166_2_entry - code="MU-PU" name="Port Louis"/> - <iso_3166_2_entry - code="MU-QB" name="Quatre Bornes"/> - <iso_3166_2_entry - code="MU-VP" name="Vacoas-Phoenix"/> - </iso_3166_subset> - <iso_3166_subset type="Dependency"> - <iso_3166_2_entry - code="MU-AG" name="Agalega Islands"/> - <iso_3166_2_entry - code="MU-CC" name="Cargados Carajos Shoals"/> - <iso_3166_2_entry - code="MU-RO" name="Rodrigues Island"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MU-BL" name="Black River"/> - <iso_3166_2_entry - code="MU-FL" name="Flacq"/> - <iso_3166_2_entry - code="MU-GP" name="Grand Port"/> - <iso_3166_2_entry - code="MU-MO" name="Moka"/> - <iso_3166_2_entry - code="MU-PA" name="Pamplemousses"/> - <iso_3166_2_entry - code="MU-PW" name="Plaines Wilhems"/> - <iso_3166_2_entry - code="MU-PL" name="Port Louis"/> - <iso_3166_2_entry - code="MU-RP" name="Rivière du Rempart"/> - <iso_3166_2_entry - code="MU-SA" name="Savanne"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Maldives --> - <iso_3166_country code="MV"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MV-MLE" name="Male"/> - </iso_3166_subset> - <iso_3166_subset type="Atoll"> - <iso_3166_2_entry - code="MV-02" name="Alif"/> - <iso_3166_2_entry - code="MV-20" name="Baa"/> - <iso_3166_2_entry - code="MV-17" name="Dhaalu"/> - <iso_3166_2_entry - code="MV-14" name="Faafu"/> - <iso_3166_2_entry - code="MV-27" name="Gaafu Aliff"/> - <iso_3166_2_entry - code="MV-28" name="Gaafu Daalu"/> - <iso_3166_2_entry - code="MV-29" name="Gnaviyani"/> - <iso_3166_2_entry - code="MV-07" name="Haa Alif"/> - <iso_3166_2_entry - code="MV-23" name="Haa Dhaalu"/> - <iso_3166_2_entry - code="MV-26" name="Kaafu"/> - <iso_3166_2_entry - code="MV-05" name="Laamu"/> - <iso_3166_2_entry - code="MV-03" name="Lhaviyani"/> - <iso_3166_2_entry - code="MV-12" name="Meemu"/> - <iso_3166_2_entry - code="MV-25" name="Noonu"/> - <iso_3166_2_entry - code="MV-13" name="Raa"/> - <iso_3166_2_entry - code="MV-01" name="Seenu"/> - <iso_3166_2_entry - code="MV-24" name="Shaviyani"/> - <iso_3166_2_entry - code="MV-08" name="Thaa"/> - <iso_3166_2_entry - code="MV-04" name="Vaavu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Malawi --> - <iso_3166_country code="MW"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="MW C" name="Central Region"/> - <iso_3166_2_entry - code="MW N" name="Northern Region"/> - <iso_3166_2_entry - code="MW S" name="Southern Region"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="MW-BA" name="Balaka" parent="S"/> - <iso_3166_2_entry - code="MW-BL" name="Blantyre" parent="S"/> - <iso_3166_2_entry - code="MW-CK" name="Chikwawa" parent="S"/> - <iso_3166_2_entry - code="MW-CR" name="Chiradzulu" parent="S"/> - <iso_3166_2_entry - code="MW-CT" name="Chitipa" parent="N"/> - <iso_3166_2_entry - code="MW-DE" name="Dedza" parent="C"/> - <iso_3166_2_entry - code="MW-DO" name="Dowa" parent="C"/> - <iso_3166_2_entry - code="MW-KR" name="Karonga" parent="N"/> - <iso_3166_2_entry - code="MW-KS" name="Kasungu" parent="C"/> - <iso_3166_2_entry - code="MW-LK" name="Likoma" parent="N"/> - <iso_3166_2_entry - code="MW-LI" name="Lilongwe" parent="C"/> - <iso_3166_2_entry - code="MW-MH" name="Machinga" parent="S"/> - <iso_3166_2_entry - code="MW-MG" name="Mangochi" parent="S"/> - <iso_3166_2_entry - code="MW-MC" name="Mchinji" parent="C"/> - <iso_3166_2_entry - code="MW-MU" name="Mulanje" parent="S"/> - <iso_3166_2_entry - code="MW-MW" name="Mwanza" parent="S"/> - <iso_3166_2_entry - code="MW-MZ" name="Mzimba" parent="N"/> - <iso_3166_2_entry - code="MW-NE" name="Neno" parent="N"/> - <iso_3166_2_entry - code="MW-NB" name="Nkhata Bay" parent="N"/> - <iso_3166_2_entry - code="MW-NK" name="Nkhotakota" parent="C"/> - <iso_3166_2_entry - code="MW-NS" name="Nsanje" parent="S"/> - <iso_3166_2_entry - code="MW-NU" name="Ntcheu" parent="C"/> - <iso_3166_2_entry - code="MW-NI" name="Ntchisi" parent="C"/> - <iso_3166_2_entry - code="MW-PH" name="Phalombe" parent="S"/> - <iso_3166_2_entry - code="MW-RU" name="Rumphi" parent="N"/> - <iso_3166_2_entry - code="MW-SA" name="Salima" parent="C"/> - <iso_3166_2_entry - code="MW-TH" name="Thyolo" parent="S"/> - <iso_3166_2_entry - code="MW-ZO" name="Zomba" parent="S"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mexico --> - <iso_3166_country code="MX"> - <iso_3166_subset type="Federal district"> - <iso_3166_2_entry - code="MX-DIF" name="Distrito Federal"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="MX-AGU" name="Aguascalientes"/> - <iso_3166_2_entry - code="MX-BCN" name="Baja California"/> - <iso_3166_2_entry - code="MX-BCS" name="Baja California Sur"/> - <iso_3166_2_entry - code="MX-CAM" name="Campeche"/> - <iso_3166_2_entry - code="MX-COA" name="Coahuila"/> - <iso_3166_2_entry - code="MX-COL" name="Colima"/> - <iso_3166_2_entry - code="MX-CHP" name="Chiapas"/> - <iso_3166_2_entry - code="MX-CHH" name="Chihuahua"/> - <iso_3166_2_entry - code="MX-DUR" name="Durango"/> - <iso_3166_2_entry - code="MX-GUA" name="Guanajuato"/> - <iso_3166_2_entry - code="MX-GRO" name="Guerrero"/> - <iso_3166_2_entry - code="MX-HID" name="Hidalgo"/> - <iso_3166_2_entry - code="MX-JAL" name="Jalisco"/> - <iso_3166_2_entry - code="MX-MEX" name="México"/> - <iso_3166_2_entry - code="MX-MIC" name="Michoacán"/> - <iso_3166_2_entry - code="MX-MOR" name="Morelos"/> - <iso_3166_2_entry - code="MX-NAY" name="Nayarit"/> - <iso_3166_2_entry - code="MX-NLE" name="Nuevo León"/> - <iso_3166_2_entry - code="MX-OAX" name="Oaxaca"/> - <iso_3166_2_entry - code="MX-PUE" name="Puebla"/> - <iso_3166_2_entry - code="MX-QUE" name="Querétaro"/> - <iso_3166_2_entry - code="MX-ROO" name="Quintana Roo"/> - <iso_3166_2_entry - code="MX-SLP" name="San Luis Potosí"/> - <iso_3166_2_entry - code="MX-SIN" name="Sinaloa"/> - <iso_3166_2_entry - code="MX-SON" name="Sonora"/> - <iso_3166_2_entry - code="MX-TAB" name="Tabasco"/> - <iso_3166_2_entry - code="MX-TAM" name="Tamaulipas"/> - <iso_3166_2_entry - code="MX-TLA" name="Tlaxcala"/> - <iso_3166_2_entry - code="MX-VER" name="Veracruz"/> - <iso_3166_2_entry - code="MX-YUC" name="Yucatán"/> - <iso_3166_2_entry - code="MX-ZAC" name="Zacatecas"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Malaysia --> - <iso_3166_country code="MY"> - <iso_3166_subset type="Federal Territories"> - <iso_3166_2_entry - code="MY-14" name="Wilayah Persekutuan Kuala Lumpur"/> - <iso_3166_2_entry - code="MY-15" name="Wilayah Persekutuan Labuan"/> - <iso_3166_2_entry - code="MY-16" name="Wilayah Persekutuan Putrajaya"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="MY-01" name="Johor"/> - <iso_3166_2_entry - code="MY-02" name="Kedah"/> - <iso_3166_2_entry - code="MY-03" name="Kelantan"/> - <iso_3166_2_entry - code="MY-04" name="Melaka"/> - <iso_3166_2_entry - code="MY-05" name="Negeri Sembilan"/> - <iso_3166_2_entry - code="MY-06" name="Pahang"/> - <iso_3166_2_entry - code="MY-08" name="Perak"/> - <iso_3166_2_entry - code="MY-09" name="Perlis"/> - <iso_3166_2_entry - code="MY-07" name="Pulau Pinang"/> - <iso_3166_2_entry - code="MY-12" name="Sabah"/> - <iso_3166_2_entry - code="MY-13" name="Sarawak"/> - <iso_3166_2_entry - code="MY-10" name="Selangor"/> - <iso_3166_2_entry - code="MY-11" name="Terengganu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Mozambique --> - <iso_3166_country code="MZ"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="MZ-MPM" name="Maputo (city)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="MZ-P" name="Cabo Delgado"/> - <iso_3166_2_entry - code="MZ-G" name="Gaza"/> - <iso_3166_2_entry - code="MZ-I" name="Inhambane"/> - <iso_3166_2_entry - code="MZ-B" name="Manica"/> - <iso_3166_2_entry - code="MZ-L" name="Maputo"/> - <iso_3166_2_entry - code="MZ-N" name="Numpula"/> - <iso_3166_2_entry - code="MZ-A" name="Niassa"/> - <iso_3166_2_entry - code="MZ-S" name="Sofala"/> - <iso_3166_2_entry - code="MZ-T" name="Tete"/> - <iso_3166_2_entry - code="MZ-Q" name="Zambezia"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Namibia --> - <iso_3166_country code="NA"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="NA-CA" name="Caprivi"/> - <iso_3166_2_entry - code="NA-ER" name="Erongo"/> - <iso_3166_2_entry - code="NA-HA" name="Hardap"/> - <iso_3166_2_entry - code="NA-KA" name="Karas"/> - <iso_3166_2_entry - code="NA-KH" name="Khomas"/> - <iso_3166_2_entry - code="NA-KU" name="Kunene"/> - <iso_3166_2_entry - code="NA-OW" name="Ohangwena"/> - <iso_3166_2_entry - code="NA-OK" name="Okavango"/> - <iso_3166_2_entry - code="NA-OH" name="Omaheke"/> - <iso_3166_2_entry - code="NA-OS" name="Omusati"/> - <iso_3166_2_entry - code="NA-ON" name="Oshana"/> - <iso_3166_2_entry - code="NA-OT" name="Oshikoto"/> - <iso_3166_2_entry - code="NA-OD" name="Otjozondjupa"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Niger --> - <iso_3166_country code="NE"> - <iso_3166_subset type="Capital District"> - <iso_3166_2_entry - code="NE-8" name="Niamey"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="NE-1" name="Agadez"/> - <iso_3166_2_entry - code="NE-2" name="Diffa"/> - <iso_3166_2_entry - code="NE-3" name="Dosso"/> - <iso_3166_2_entry - code="NE-4" name="Maradi"/> - <iso_3166_2_entry - code="NE-5" name="Tahoua"/> - <iso_3166_2_entry - code="NE-6" name="Tillabéri"/> - <iso_3166_2_entry - code="NE-7" name="Zinder"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nigeria --> - <iso_3166_country code="NG"> - <iso_3166_subset type="Capital Territory"> - <iso_3166_2_entry - code="NG-FC" name="Abuja Capital Territory"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="NG-AB" name="Abia"/> - <iso_3166_2_entry - code="NG-AD" name="Adamawa"/> - <iso_3166_2_entry - code="NG-AK" name="Akwa Ibom"/> - <iso_3166_2_entry - code="NG-AN" name="Anambra"/> - <iso_3166_2_entry - code="NG-BA" name="Bauchi"/> - <iso_3166_2_entry - code="NG-BY" name="Bayelsa"/> - <iso_3166_2_entry - code="NG-BE" name="Benue"/> - <iso_3166_2_entry - code="NG-BO" name="Borno"/> - <iso_3166_2_entry - code="NG-CR" name="Cross River"/> - <iso_3166_2_entry - code="NG-DE" name="Delta"/> - <iso_3166_2_entry - code="NG-EB" name="Ebonyi"/> - <iso_3166_2_entry - code="NG-ED" name="Edo"/> - <iso_3166_2_entry - code="NG-EK" name="Ekiti"/> - <iso_3166_2_entry - code="NG-EN" name="Enugu"/> - <iso_3166_2_entry - code="NG-GO" name="Gombe"/> - <iso_3166_2_entry - code="NG-IM" name="Imo"/> - <iso_3166_2_entry - code="NG-JI" name="Jigawa"/> - <iso_3166_2_entry - code="NG-KD" name="Kaduna"/> - <iso_3166_2_entry - code="NG-KN" name="Kano"/> - <iso_3166_2_entry - code="NG-KT" name="Katsina"/> - <iso_3166_2_entry - code="NG-KE" name="Kebbi"/> - <iso_3166_2_entry - code="NG-KO" name="Kogi"/> - <iso_3166_2_entry - code="NG-KW" name="Kwara"/> - <iso_3166_2_entry - code="NG-LA" name="Lagos"/> - <iso_3166_2_entry - code="NG-NA" name="Nassarawa"/> - <iso_3166_2_entry - code="NG-NI" name="Niger"/> - <iso_3166_2_entry - code="NG-OG" name="Ogun"/> - <iso_3166_2_entry - code="NG-ON" name="Ondo"/> - <iso_3166_2_entry - code="NG-OS" name="Osun"/> - <iso_3166_2_entry - code="NG-OY" name="Oyo"/> - <iso_3166_2_entry - code="NG-PL" name="Plateau"/> - <iso_3166_2_entry - code="NG-RI" name="Rivers"/> - <iso_3166_2_entry - code="NG-SO" name="Sokoto"/> - <iso_3166_2_entry - code="NG-TA" name="Taraba"/> - <iso_3166_2_entry - code="NG-YO" name="Yobe"/> - <iso_3166_2_entry - code="NG-ZA" name="Zamfara"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nicaragua --> - <iso_3166_country code="NI"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="NI-BO" name="Boaco"/> - <iso_3166_2_entry - code="NI-CA" name="Carazo"/> - <iso_3166_2_entry - code="NI-CI" name="Chinandega"/> - <iso_3166_2_entry - code="NI-CO" name="Chontales"/> - <iso_3166_2_entry - code="NI-ES" name="Estelí"/> - <iso_3166_2_entry - code="NI-GR" name="Granada"/> - <iso_3166_2_entry - code="NI-JI" name="Jinotega"/> - <iso_3166_2_entry - code="NI-LE" name="León"/> - <iso_3166_2_entry - code="NI-MD" name="Madriz"/> - <iso_3166_2_entry - code="NI-MN" name="Managua"/> - <iso_3166_2_entry - code="NI-MS" name="Masaya"/> - <iso_3166_2_entry - code="NI-MT" name="Matagalpa"/> - <iso_3166_2_entry - code="NI-NS" name="Nueva Segovia"/> - <iso_3166_2_entry - code="NI-SJ" name="Río San Juan"/> - <iso_3166_2_entry - code="NI-RI" name="Rivas"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous Region"> - <iso_3166_2_entry - code="NI-AN" name="Atlántico Norte"/> - <iso_3166_2_entry - code="NI-AS" name="Atlántico Sur"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Netherlands --> - <iso_3166_country code="NL"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="NL-DR" name="Drenthe"/> - <iso_3166_2_entry - code="NL-FL" name="Flevoland"/> - <iso_3166_2_entry - code="NL-FR" name="Friesland"/> - <iso_3166_2_entry - code="NL-GE" name="Gelderland"/> - <iso_3166_2_entry - code="NL-GR" name="Groningen"/> - <iso_3166_2_entry - code="NL-LI" name="Limburg"/> - <iso_3166_2_entry - code="NL-NB" name="Noord-Brabant"/> - <iso_3166_2_entry - code="NL-NH" name="Noord-Holland"/> - <iso_3166_2_entry - code="NL-OV" name="Overijssel"/> - <iso_3166_2_entry - code="NL-UT" name="Utrecht"/> - <iso_3166_2_entry - code="NL-ZE" name="Zeeland"/> - <iso_3166_2_entry - code="NL-ZH" name="Zuid-Holland"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Norway --> - <iso_3166_country code="NO"> - <iso_3166_subset type="County"> - <!-- Derived from http://geotags.com/geo/DMS3.html --> - <!-- See also Country code 'SJ' for Jan Mayen & Svalbard --> - <iso_3166_2_entry - code="NO-02" name="Akershus"/> - <iso_3166_2_entry - code="NO-09" name="Aust-Agder"/> - <iso_3166_2_entry - code="NO-06" name="Buskerud"/> - <iso_3166_2_entry - code="NO-20" name="Finnmark"/> - <iso_3166_2_entry - code="NO-04" name="Hedmark"/> - <iso_3166_2_entry - code="NO-12" name="Hordaland"/> - <iso_3166_2_entry - code="NO-15" name="Møre og Romsdal"/> - <iso_3166_2_entry - code="NO-18" name="Nordland"/> - <iso_3166_2_entry - code="NO-17" name="Nord-Trøndelag"/> - <iso_3166_2_entry - code="NO-05" name="Oppland"/> - <iso_3166_2_entry - code="NO-03" name="Oslo"/> - <iso_3166_2_entry - code="NO-11" name="Rogaland"/> - <iso_3166_2_entry - code="NO-14" name="Sogn og Fjordane"/> - <iso_3166_2_entry - code="NO-16" name="Sør-Trøndelag"/> - <iso_3166_2_entry - code="NO-08" name="Telemark"/> - <iso_3166_2_entry - code="NO-19" name="Troms"/> - <iso_3166_2_entry - code="NO-10" name="Vest-Agder"/> - <iso_3166_2_entry - code="NO-07" name="Vestfold"/> - <iso_3166_2_entry - code="NO-01" name="Østfold"/> - <iso_3166_2_entry - code="NO-22" name="Jan Mayen"/> - <iso_3166_2_entry - code="NO-21" name="Svalbard"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nepal --> - <iso_3166_country code="NP"> - <iso_3166_subset type="Development region"> - <iso_3166_2_entry - code="NP-1" name="Madhyamanchal"/> - <iso_3166_2_entry - code="NP-2" name="Madhya Pashchimanchal"/> - <iso_3166_2_entry - code="NP-3" name="Pashchimanchal"/> - <iso_3166_2_entry - code="NP-4" name="Purwanchal"/> - <iso_3166_2_entry - code="NP-5" name="Sudur Pashchimanchal"/> - </iso_3166_subset> - <iso_3166_subset type="zone"> - <iso_3166_2_entry - code="NP-BA" name="Bagmati" parent="1"/> - <iso_3166_2_entry - code="NP-BH" name="Bheri" parent="2"/> - <iso_3166_2_entry - code="NP-DH" name="Dhawalagiri" parent="3"/> - <iso_3166_2_entry - code="NP-GA" name="Gandaki" parent="3"/> - <iso_3166_2_entry - code="NP-JA" name="Janakpur" parent="1"/> - <iso_3166_2_entry - code="NP-KA" name="Karnali" parent="2"/> - <iso_3166_2_entry - code="NP-KO" name="Kosi" parent="4"/> - <iso_3166_2_entry - code="NP-LU" name="Lumbini" parent="3"/> - <iso_3166_2_entry - code="NP-MA" name="Mahakali" parent="5"/> - <iso_3166_2_entry - code="NP-ME" name="Mechi" parent="4"/> - <iso_3166_2_entry - code="NP-NA" name="Narayani" parent="1"/> - <iso_3166_2_entry - code="NP-RA" name="Rapti" parent="2"/> - <iso_3166_2_entry - code="NP-SA" name="Sagarmatha" parent="4"/> - <iso_3166_2_entry - code="NP-SE" name="Seti" parent="5"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Nauru --> - <iso_3166_country code="NR"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="NR-01" name="Aiwo"/> - <iso_3166_2_entry - code="NR-02" name="Anabar"/> - <iso_3166_2_entry - code="NR-03" name="Anetan"/> - <iso_3166_2_entry - code="NR-04" name="Anibare"/> - <iso_3166_2_entry - code="NR-05" name="Baiti"/> - <iso_3166_2_entry - code="NR-06" name="Boe"/> - <iso_3166_2_entry - code="NR-07" name="Buada"/> - <iso_3166_2_entry - code="NR-08" name="Denigomodu"/> - <iso_3166_2_entry - code="NR-09" name="Ewa"/> - <iso_3166_2_entry - code="NR-10" name="Ijuw"/> - <iso_3166_2_entry - code="NR-11" name="Meneng"/> - <iso_3166_2_entry - code="NR-12" name="Nibok"/> - <iso_3166_2_entry - code="NR-13" name="Uaboe"/> - <iso_3166_2_entry - code="NR-14" name="Yaren"/> - </iso_3166_subset> - </iso_3166_country> - <!-- New Zealand --> - <iso_3166_country code="NZ"> - <iso_3166_subset type="Island"> - <iso_3166_2_entry - code="NZ-N" name="North Island"/> - <iso_3166_2_entry - code="NZ-S" name="South Island"/> - </iso_3166_subset> - <iso_3166_subset type="Regional council"> - <iso_3166_2_entry - code="NZ-AUK" name="Auckland" parent="N"/> - <iso_3166_2_entry - code="NZ-BOP" name="Bay of Plenty" parent="N"/> - <iso_3166_2_entry - code="NZ-CAN" name="Canterbury" parent="S"/> - <iso_3166_2_entry - code="NZ-HKB" name="Hawke's Bay" parent="N"/> - <iso_3166_2_entry - code="NZ-MWT" name="Manawatu-Wanganui" parent="N"/> - <iso_3166_2_entry - code="NZ-NTL" name="Northland" parent="N"/> - <iso_3166_2_entry - code="NZ-OTA" name="Otago" parent="S"/> - <iso_3166_2_entry - code="NZ-STL" name="Southland" parent="S"/> - <iso_3166_2_entry - code="NZ-TKI" name="Taranaki" parent="N"/> - <iso_3166_2_entry - code="NZ-WKO" name="Waikato" parent="N"/> - <iso_3166_2_entry - code="NZ-WGN" name="Wellington" parent="N"/> - <iso_3166_2_entry - code="NZ-WTC" name="West Coast" parent="S"/> - </iso_3166_subset> - <iso_3166_subset type="Unitary authority"> - <iso_3166_2_entry - code="NZ-GIS" name="Gisborne District" parent="N"/> - <iso_3166_2_entry - code="NZ-MBH" name="Marlborough District" parent="S"/> - <iso_3166_2_entry - code="NZ-NSN" name="Nelson City" parent="S"/> - <iso_3166_2_entry - code="NZ-TAS" name="Tasman District" parent="S"/> - </iso_3166_subset> - <iso_3166_subset type="Special island authority"> - <iso_3166_2_entry - code="NZ-CIT" name="Chatham Islands Territory"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Oman --> - <iso_3166_country code="OM"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="OM-DA" name="Ad Dākhilīya"/> - <iso_3166_2_entry - code="OM-BA" name="Al Bāţinah"/> - <iso_3166_2_entry - code="OM-WU" name="Al Wusţá"/> - <iso_3166_2_entry - code="OM-SH" name="Ash Sharqīyah"/> - <iso_3166_2_entry - code="OM-ZA" name="Az̧ Z̧āhirah"/> - </iso_3166_subset> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="OM-BU" name="Al Buraymī"/> - <iso_3166_2_entry - code="OM-MA" name="Masqaţ"/> - <iso_3166_2_entry - code="OM-MU" name="Musandam"/> - <iso_3166_2_entry - code="OM-ZU" name="Z̧ufār"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Panama --> - <iso_3166_country code="PA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PA-1" name="Bocas del Toro"/> - <iso_3166_2_entry - code="PA-4" name="Chiriquí"/> - <iso_3166_2_entry - code="PA-2" name="Coclé"/> - <iso_3166_2_entry - code="PA-3" name="Colón"/> - <iso_3166_2_entry - code="PA-5" name="Darién"/> - <iso_3166_2_entry - code="PA-6" name="Herrera"/> - <iso_3166_2_entry - code="PA-7" name="Los Santos"/> - <iso_3166_2_entry - code="PA-8" name="Panamá"/> - <iso_3166_2_entry - code="PA-9" name="Veraguas"/> - </iso_3166_subset> - <iso_3166_subset type="Indigenous region"> - <iso_3166_2_entry - code="PA-EM" name="Emberá"/> - <iso_3166_2_entry - code="PA-KY" name="Kuna Yala"/> - <iso_3166_2_entry - code="PA-NB" name="Ngöbe-Buglé"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Peru --> - <iso_3166_country code="PE"> - <iso_3166_subset type="Constitutional province"> - <iso_3166_2_entry - code="PE-CAL" name="El Callao"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="PE-LMA" name="Municipalidad Metropolitana de Lima"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="PE-AMA" name="Amazonas"/> - <iso_3166_2_entry - code="PE-ANC" name="Ancash"/> - <iso_3166_2_entry - code="PE-APU" name="Apurímac"/> - <iso_3166_2_entry - code="PE-ARE" name="Arequipa"/> - <iso_3166_2_entry - code="PE-AYA" name="Ayacucho"/> - <iso_3166_2_entry - code="PE-CAJ" name="Cajamarca"/> - <iso_3166_2_entry - code="PE-CUS" name="Cusco [Cuzco]"/> - <iso_3166_2_entry - code="PE-HUV" name="Huancavelica"/> - <iso_3166_2_entry - code="PE-HUC" name="Huánuco"/> - <iso_3166_2_entry - code="PE-ICA" name="Ica"/> - <iso_3166_2_entry - code="PE-JUN" name="Junín"/> - <iso_3166_2_entry - code="PE-LAL" name="La Libertad"/> - <iso_3166_2_entry - code="PE-LAM" name="Lambayeque"/> - <iso_3166_2_entry - code="PE-LIM" name="Lima"/> - <iso_3166_2_entry - code="PE-LOR" name="Loreto"/> - <iso_3166_2_entry - code="PE-MDD" name="Madre de Dios"/> - <iso_3166_2_entry - code="PE-MOQ" name="Moquegua"/> - <iso_3166_2_entry - code="PE-PAS" name="Pasco"/> - <iso_3166_2_entry - code="PE-PIU" name="Piura"/> - <iso_3166_2_entry - code="PE-PUN" name="Puno"/> - <iso_3166_2_entry - code="PE-SAM" name="San Martín"/> - <iso_3166_2_entry - code="PE-TAC" name="Tacna"/> - <iso_3166_2_entry - code="PE-TUM" name="Tumbes"/> - <iso_3166_2_entry - code="PE-UCA" name="Ucayali"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Papua New Guinea --> - <iso_3166_country code="PG"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="PG-NCD" name="National Capital District (Port Moresby)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PG-CPM" name="Central"/> - <iso_3166_2_entry - code="PG-CPK" name="Chimbu"/> - <iso_3166_2_entry - code="PG-EHG" name="Eastern Highlands"/> - <iso_3166_2_entry - code="PG-EBR" name="East New Britain"/> - <iso_3166_2_entry - code="PG-ESW" name="East Sepik"/> - <iso_3166_2_entry - code="PG-EPW" name="Enga"/> - <iso_3166_2_entry - code="PG-GPK" name="Gulf"/> - <iso_3166_2_entry - code="PG-MPM" name="Madang"/> - <iso_3166_2_entry - code="PG-MRL" name="Manus"/> - <iso_3166_2_entry - code="PG-MBA" name="Milne Bay"/> - <iso_3166_2_entry - code="PG-MPL" name="Morobe"/> - <iso_3166_2_entry - code="PG-NIK" name="New Ireland"/> - <iso_3166_2_entry - code="PG-NPP" name="Northern"/> - <iso_3166_2_entry - code="PG-NSA" name="North Solomons"/> - <iso_3166_2_entry - code="PG-SAN" name="Sandaun"/> - <iso_3166_2_entry - code="PG-SHM" name="Southern Highlands"/> - <iso_3166_2_entry - code="PG-WPD" name="Western"/> - <iso_3166_2_entry - code="PG-WHM" name="Western Highlands"/> - <iso_3166_2_entry - code="PG-WBK" name="West New Britain"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Phillipines --> - <iso_3166_country code="PH"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="PH-14" name="Autonomous Region in Muslim Mindanao (ARMM)"/> - <iso_3166_2_entry - code="PH-05" name="Bicol (Region V)"/> - <iso_3166_2_entry - code="PH-02" name="Cagayan Valley (Region II)"/> - <iso_3166_2_entry - code="PH-40" name="CALABARZON (Region IV-A)"/> - <iso_3166_2_entry - code="PH-13" name="Caraga (Region XIII)"/> - <iso_3166_2_entry - code="PH-03" name="Central Luzon (Region III)"/> - <iso_3166_2_entry - code="PH-07" name="Central Visayas (Region VII)"/> - <iso_3166_2_entry - code="PH-15" name="Cordillera Administrative Region (CAR)"/> - <iso_3166_2_entry - code="PH-08" name="Eastern Visayas (Region VIII)"/> - <iso_3166_2_entry - code="PH-01" name="Ilocos (Region I)"/> - <iso_3166_2_entry - code="PH-41" name="MIMAROPA (Region IV-B)"/> - <iso_3166_2_entry - code="PH-00" name="National Capital Region"/> - <iso_3166_2_entry - code="PH-10" name="Northern Mindanao (Region X)"/> - <iso_3166_2_entry - code="PH-12" name="Soccsksargen (Region XII)"/> - <iso_3166_2_entry - code="PH-06" name="Western Visayas (Region VI)"/> - <iso_3166_2_entry - code="PH-09" name="Zamboanga Peninsula (Region IX)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PH-ABR" name="Abra" parent="15"/> - <iso_3166_2_entry - code="PH-AGN" name="Agusan del Norte" parent="13"/> - <iso_3166_2_entry - code="PH-AGS" name="Agusan del Sur" parent="13"/> - <iso_3166_2_entry - code="PH-AKL" name="Aklan" parent="06"/> - <iso_3166_2_entry - code="PH-ALB" name="Albay" parent="05"/> - <iso_3166_2_entry - code="PH-ANT" name="Antique" parent="06"/> - <iso_3166_2_entry - code="PH-APA" name="Apayao" parent="15"/> - <iso_3166_2_entry - code="PH-AUR" name="Aurora" parent="03"/> - <iso_3166_2_entry - code="PH-BAS" name="Basilan" parent="09"/> - <iso_3166_2_entry - code="PH-BAN" name="Batasn" parent="03"/> - <iso_3166_2_entry - code="PH-BTN" name="Batanes" parent="02"/> - <iso_3166_2_entry - code="PH-BTG" name="Batangas" parent="40"/> - <iso_3166_2_entry - code="PH-BEN" name="Benguet" parent="15"/> - <iso_3166_2_entry - code="PH-BIL" name="Biliran" parent="08"/> - <iso_3166_2_entry - code="PH-BOH" name="Bohol" parent="07"/> - <iso_3166_2_entry - code="PH-BUK" name="Bukidnon" parent="10"/> - <iso_3166_2_entry - code="PH-BUL" name="Bulacan" parent="03"/> - <iso_3166_2_entry - code="PH-CAG" name="Cagayan" parent="02"/> - <iso_3166_2_entry - code="PH-CAN" name="Camarines Norte" parent="05"/> - <iso_3166_2_entry - code="PH-CAS" name="Camarines Sur" parent="05"/> - <iso_3166_2_entry - code="PH-CAM" name="Camiguin" parent="10"/> - <iso_3166_2_entry - code="PH-CAP" name="Capiz" parent="06"/> - <iso_3166_2_entry - code="PH-CAT" name="Catanduanes" parent="05"/> - <iso_3166_2_entry - code="PH-CAV" name="Cavite" parent="40"/> - <iso_3166_2_entry - code="PH-CEB" name="Cebu" parent="07"/> - <iso_3166_2_entry - code="PH-COM" name="Compostela Valley" parent="11"/> - <iso_3166_2_entry - code="PH-DAV" name="Davao del Norte" parent="11"/> - <iso_3166_2_entry - code="PH-DAS" name="Davao del Sur" parent="11"/> - <iso_3166_2_entry - code="PH-DAO" name="Davao Oriental" parent="11"/> - <iso_3166_2_entry - code="PH-DIN" name="Dinagat Islands" parent="13"/> - <iso_3166_2_entry - code="PH-EAS" name="Eastern Samar" parent="08"/> - <iso_3166_2_entry - code="PH-GUI" name="Guimaras" parent="06"/> - <iso_3166_2_entry - code="PH-IFU" name="Ifugao" parent="15"/> - <iso_3166_2_entry - code="PH-ILN" name="Ilocos Norte" parent="01"/> - <iso_3166_2_entry - code="PH-ILS" name="Ilocos Sur" parent="01"/> - <iso_3166_2_entry - code="PH-ILI" name="Iloilo" parent="06"/> - <iso_3166_2_entry - code="PH-ISA" name="Isabela" parent="02"/> - <iso_3166_2_entry - code="PH-KAL" name="Kalinga-Apayso" parent="15"/> - <iso_3166_2_entry - code="PH-LAG" name="Laguna" parent="40"/> - <iso_3166_2_entry - code="PH-LAN" name="Lanao del Norte" parent="12"/> - <iso_3166_2_entry - code="PH-LAS" name="Lanao del Sur" parent="14"/> - <iso_3166_2_entry - code="PH-LUN" name="La Union" parent="01"/> - <iso_3166_2_entry - code="PH-LEY" name="Leyte" parent="08"/> - <iso_3166_2_entry - code="PH-MAG" name="Maguindanao" parent="14"/> - <iso_3166_2_entry - code="PH-MAD" name="Marinduque" parent="41"/> - <iso_3166_2_entry - code="PH-MAS" name="Masbate" parent="05"/> - <iso_3166_2_entry - code="PH-MDC" name="Mindoro Occidental" parent="41"/> - <iso_3166_2_entry - code="PH-MDR" name="Mindoro Oriental" parent="41"/> - <iso_3166_2_entry - code="PH-MSC" name="Misamis Occidental" parent="10"/> - <iso_3166_2_entry - code="PH-MSR" name="Misamis Oriental" parent="10"/> - <iso_3166_2_entry - code="PH-MOU" name="Mountain Province" parent="15"/> - <iso_3166_2_entry - code="PH-NEC" name="Negroe Occidental" parent="06"/> - <iso_3166_2_entry - code="PH-NER" name="Negros Oriental" parent="07"/> - <iso_3166_2_entry - code="PH-NCO" name="North Cotabato" parent="12"/> - <iso_3166_2_entry - code="PH-NSA" name="Northern Samar" parent="08"/> - <iso_3166_2_entry - code="PH-NUE" name="Nueva Ecija" parent="03"/> - <iso_3166_2_entry - code="PH-NUV" name="Nueva Vizcaya" parent="02"/> - <iso_3166_2_entry - code="PH-PLW" name="Palawan" parent="41"/> - <iso_3166_2_entry - code="PH-PAM" name="Pampanga" parent="03"/> - <iso_3166_2_entry - code="PH-PAN" name="Pangasinan" parent="01"/> - <iso_3166_2_entry - code="PH-QUE" name="Quezon" parent="40"/> - <iso_3166_2_entry - code="PH-QUI" name="Quirino" parent="02"/> - <iso_3166_2_entry - code="PH-RIZ" name="Rizal" parent="40"/> - <iso_3166_2_entry - code="PH-ROM" name="Romblon" parent="41"/> - <iso_3166_2_entry - code="PH-SAR" name="Sarangani" parent="11"/> - <iso_3166_2_entry - code="PH-SIG" name="Siquijor" parent="07"/> - <iso_3166_2_entry - code="PH-SOR" name="Sorsogon" parent="05"/> - <iso_3166_2_entry - code="PH-SCO" name="South Cotabato" parent="11"/> - <iso_3166_2_entry - code="PH-SLE" name="Southern Leyte" parent="08"/> - <iso_3166_2_entry - code="PH-SUK" name="Sultan Kudarat" parent="12"/> - <iso_3166_2_entry - code="PH-SLU" name="Sulu" parent="14"/> - <iso_3166_2_entry - code="PH-SUN" name="Surigao del Norte" parent="13"/> - <iso_3166_2_entry - code="PH-SUR" name="Surigao del Sur" parent="13"/> - <iso_3166_2_entry - code="PH-TAR" name="Tarlac" parent="03"/> - <iso_3166_2_entry - code="PH-TAW" name="Tawi-Tawi" parent="14"/> - <iso_3166_2_entry - code="PH-WSA" name="Western Samar" parent="08"/> - <iso_3166_2_entry - code="PH-ZMB" name="Zambales" parent="03"/> - <iso_3166_2_entry - code="PH-ZAN" name="Zamboanga del Norte" parent="09"/> - <iso_3166_2_entry - code="PH-ZAS" name="Zamboanga del Sur" parent="09"/> - <iso_3166_2_entry - code="PH-ZSI" name="Zamboanga Sibugay" parent="09"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Pakistan --> - <iso_3166_country code="PK"> - <iso_3166_subset type="Capital territory"> - <iso_3166_2_entry - code="PK-IS" name="Islamabad"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PK-BA" name="Balochistan"/> - <iso_3166_2_entry - code="PK-NW" name="North-West Frontier"/> - <iso_3166_2_entry - code="PK-PB" name="Punjab"/> - <iso_3166_2_entry - code="PK-SD" name="Sindh"/> - </iso_3166_subset> - <iso_3166_subset type="Area"> - <iso_3166_2_entry - code="PK-TA" name="Federally Administered Tribal Areas"/> - <iso_3166_2_entry - code="PK-JK" name="Azad Kashmir"/> - <iso_3166_2_entry - code="PK-NA" name="Northern Areas"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Poland --> - <iso_3166_country code="PL"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="PL-DS" name="Dolnośląskie"/> - <iso_3166_2_entry - code="PL-KP" name="Kujawsko-pomorskie"/> - <iso_3166_2_entry - code="PL-LU" name="Lubelskie"/> - <iso_3166_2_entry - code="PL-LB" name="Lubuskie"/> - <iso_3166_2_entry - code="PL-LD" name="Łódzkie"/> - <iso_3166_2_entry - code="PL-MA" name="Małopolskie"/> - <iso_3166_2_entry - code="PL-MZ" name="Mazowieckie"/> - <iso_3166_2_entry - code="PL-OP" name="Opolskie"/> - <iso_3166_2_entry - code="PL-PK" name="Podkarpackie"/> - <iso_3166_2_entry - code="PL-PD" name="Podlaskie"/> - <iso_3166_2_entry - code="PL-PM" name="Pomorskie"/> - <iso_3166_2_entry - code="PL-SL" name="Śląskie"/> - <iso_3166_2_entry - code="PL-SK" name="Świętokrzyskie"/> - <iso_3166_2_entry - code="PL-WN" name="Warmińsko-mazurskie"/> - <iso_3166_2_entry - code="PL-WP" name="Wielkopolskie"/> - <iso_3166_2_entry - code="PL-ZP" name="Zachodniopomorskie"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Palestinian Territory, Occupied --> - <iso_3166_country code="PS"/> - <!-- Portugal --> - <iso_3166_country code="PT"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="PT-01" name="Aveiro"/> - <iso_3166_2_entry - code="PT-02" name="Beja"/> - <iso_3166_2_entry - code="PT-03" name="Braga"/> - <iso_3166_2_entry - code="PT-04" name="Bragança"/> - <iso_3166_2_entry - code="PT-05" name="Castelo Branco"/> - <iso_3166_2_entry - code="PT-06" name="Coimbra"/> - <iso_3166_2_entry - code="PT-07" name="Évora"/> - <iso_3166_2_entry - code="PT-08" name="Faro"/> - <iso_3166_2_entry - code="PT-09" name="Guarda"/> - <iso_3166_2_entry - code="PT-10" name="Leiria"/> - <iso_3166_2_entry - code="PT-11" name="Lisboa"/> - <iso_3166_2_entry - code="PT-12" name="Portalegre"/> - <iso_3166_2_entry - code="PT-13" name="Porto"/> - <iso_3166_2_entry - code="PT-14" name="Santarém"/> - <iso_3166_2_entry - code="PT-15" name="Setúbal"/> - <iso_3166_2_entry - code="PT-16" name="Viana do Castelo"/> - <iso_3166_2_entry - code="PT-17" name="Vila Real"/> - <iso_3166_2_entry - code="PT-18" name="Viseu"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous region"> - <iso_3166_2_entry - code="PT-20" name="Região Autónoma dos Açores"/> - <iso_3166_2_entry - code="PT-30" name="Região Autónoma da Madeira"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Palau --> - <iso_3166_country code="PW"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="PW-002" name="Aimeliik"/> - <iso_3166_2_entry - code="PW-004" name="Airai"/> - <iso_3166_2_entry - code="PW-010" name="Angaur"/> - <iso_3166_2_entry - code="PW-050" name="Hatobohei"/> - <iso_3166_2_entry - code="PW-100" name="Kayangel"/> - <iso_3166_2_entry - code="PW-150" name="Koror"/> - <iso_3166_2_entry - code="PW-212" name="Melekeok"/> - <iso_3166_2_entry - code="PW-214" name="Ngaraard"/> - <iso_3166_2_entry - code="PW-218" name="Ngarchelong"/> - <iso_3166_2_entry - code="PW-222" name="Ngardmau"/> - <iso_3166_2_entry - code="PW-224" name="Ngatpang"/> - <iso_3166_2_entry - code="PW-226" name="Ngchesar"/> - <iso_3166_2_entry - code="PW-227" name="Ngeremlengui"/> - <iso_3166_2_entry - code="PW-228" name="Ngiwal"/> - <iso_3166_2_entry - code="PW-350" name="Peleliu"/> - <iso_3166_2_entry - code="PW-370" name="Sonsorol"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Paraguay --> - <iso_3166_country code="PY"> - <iso_3166_subset type="Capital district"> - <iso_3166_2_entry - code="PY-ASU" name="Asunción"/> - </iso_3166_subset> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="PY-16" name="Alto Paraguay"/> - <iso_3166_2_entry - code="PY-10" name="Alto Paraná"/> - <iso_3166_2_entry - code="PY-13" name="Amambay"/> - <iso_3166_2_entry - code="PY-19" name="Boquerón"/> - <iso_3166_2_entry - code="PY-5" name="Caaguazú"/> - <iso_3166_2_entry - code="PY-6" name="Caazapá"/> - <iso_3166_2_entry - code="PY-14" name="Canindeyú"/> - <iso_3166_2_entry - code="PY-11" name="Central"/> - <iso_3166_2_entry - code="PY-1" name="Concepción"/> - <iso_3166_2_entry - code="PY-3" name="Cordillera"/> - <iso_3166_2_entry - code="PY-4" name="Guairá"/> - <iso_3166_2_entry - code="PY-7" name="Itapúa"/> - <iso_3166_2_entry - code="PY-8" name="Misiones"/> - <iso_3166_2_entry - code="PY-12" name="Ñeembucú"/> - <iso_3166_2_entry - code="PY-9" name="Paraguarí"/> - <iso_3166_2_entry - code="PY-15" name="Presidente Hayes"/> - <iso_3166_2_entry - code="PY-2" name="San Pedro"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Qatar --> - <iso_3166_country code="QA"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="QA-DA" name="Ad Dawhah"/> - <iso_3166_2_entry - code="QA-GH" name="Al Ghuwayriyah"/> - <iso_3166_2_entry - code="QA-JU" name="Al Jumayliyah"/> - <iso_3166_2_entry - code="QA-KH" name="Al Khawr"/> - <iso_3166_2_entry - code="QA-WA" name="Al Wakrah"/> - <iso_3166_2_entry - code="QA-RA" name="Ar Rayyan"/> - <iso_3166_2_entry - code="QA-JB" name="Jariyan al Batnah"/> - <iso_3166_2_entry - code="QA-MS" name="Madinat ash Shamal"/> - <iso_3166_2_entry - code="QA-US" name="Umm Salal"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Romania --> - <iso_3166_country code="RO"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="RO-AB" name="Alba"/> - <iso_3166_2_entry - code="RO-AR" name="Arad"/> - <iso_3166_2_entry - code="RO-AG" name="Argeș"/> - <iso_3166_2_entry - code="RO-BC" name="Bacău"/> - <iso_3166_2_entry - code="RO-BH" name="Bihor"/> - <iso_3166_2_entry - code="RO-BN" name="Bistrița-Năsăud"/> - <iso_3166_2_entry - code="RO-BT" name="Botoșani"/> - <iso_3166_2_entry - code="RO-BV" name="Brașov"/> - <iso_3166_2_entry - code="RO-BR" name="Brăila"/> - <iso_3166_2_entry - code="RO-BZ" name="Buzău"/> - <iso_3166_2_entry - code="RO-CS" name="Caraș-Severin"/> - <iso_3166_2_entry - code="RO-CL" name="Călărași"/> - <iso_3166_2_entry - code="RO-CJ" name="Cluj"/> - <iso_3166_2_entry - code="RO-CT" name="Constanța"/> - <iso_3166_2_entry - code="RO-CV" name="Covasna"/> - <iso_3166_2_entry - code="RO-DB" name="Dâmbovița"/> - <iso_3166_2_entry - code="RO-DJ" name="Dolj"/> - <iso_3166_2_entry - code="RO-GL" name="Galați"/> - <iso_3166_2_entry - code="RO-GR" name="Giurgiu"/> - <iso_3166_2_entry - code="RO-GJ" name="Gorj"/> - <iso_3166_2_entry - code="RO-HR" name="Harghita"/> - <iso_3166_2_entry - code="RO-HD" name="Hunedoara"/> - <iso_3166_2_entry - code="RO-IL" name="Ialomița"/> - <iso_3166_2_entry - code="RO-IS" name="Iași"/> - <iso_3166_2_entry - code="RO-IF" name="Ilfov"/> - <iso_3166_2_entry - code="RO-MM" name="Maramureș"/> - <iso_3166_2_entry - code="RO-MH" name="Mehedinți"/> - <iso_3166_2_entry - code="RO-MS" name="Mureș"/> - <iso_3166_2_entry - code="RO-NT" name="Neamț"/> - <iso_3166_2_entry - code="RO-OT" name="Olt"/> - <iso_3166_2_entry - code="RO-PH" name="Prahova"/> - <iso_3166_2_entry - code="RO-SM" name="Satu Mare"/> - <iso_3166_2_entry - code="RO-SJ" name="Sălaj"/> - <iso_3166_2_entry - code="RO-SB" name="Sibiu"/> - <iso_3166_2_entry - code="RO-SV" name="Suceava"/> - <iso_3166_2_entry - code="RO-TR" name="Teleorman"/> - <iso_3166_2_entry - code="RO-TM" name="Timiș"/> - <iso_3166_2_entry - code="RO-TL" name="Tulcea"/> - <iso_3166_2_entry - code="RO-VS" name="Vaslui"/> - <iso_3166_2_entry - code="RO-VL" name="Vâlcea"/> - <iso_3166_2_entry - code="RO-VN" name="Vrancea"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="RO-B" name="București"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Serbia --> - <iso_3166_country code="RS"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="RS-00" name="Beograd"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous province"> - <iso_3166_2_entry - code="RS KM" name="Kosovo-Metohija"/> - <iso_3166_2_entry - code="RS VO" name="Vojvodina"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="RS-14" name="Borski okrug"/> - <iso_3166_2_entry - code="RS-11" name="Braničevski okrug"/> - <iso_3166_2_entry - code="RS-23" name="Jablanički okrug"/> - <iso_3166_2_entry - code="RS-06" name="Južnobački okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-04" name="Južnobanatski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-09" name="Kolubarski okrug"/> - <iso_3166_2_entry - code="RS-25" name="Kosovski okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-28" name="Kosovsko-Mitrovački okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-29" name="Kosovsko-Pomoravski okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-08" name="Mačvanski okrug"/> - <iso_3166_2_entry - code="RS-17" name="Moravički okrug"/> - <iso_3166_2_entry - code="RS-20" name="Nišavski okrug"/> - <iso_3166_2_entry - code="RS-24" name="Pčinjski okrug"/> - <iso_3166_2_entry - code="RS-26" name="Pećki okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-22" name="Pirotski okrug"/> - <iso_3166_2_entry - code="RS-10" name="Podunavski okrug"/> - <iso_3166_2_entry - code="RS-13" name="Pomoravski okrug"/> - <iso_3166_2_entry - code="RS-27" name="Prizrenski okrug" parent="KM"/> - <iso_3166_2_entry - code="RS-19" name="Rasinski okrug"/> - <iso_3166_2_entry - code="RS-18" name="Raški okrug"/> - <iso_3166_2_entry - code="RS-01" name="Severnobački okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-03" name="Severnobanatski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-02" name="Srednjebanatski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-07" name="Sremski okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-12" name="Šumadijski okrug"/> - <iso_3166_2_entry - code="RS-21" name="Toplički okrug"/> - <iso_3166_2_entry - code="RS-15" name="Zaječarski okrug"/> - <iso_3166_2_entry - code="RS-05" name="Zapadnobački okrug" parent="VO"/> - <iso_3166_2_entry - code="RS-16" name="Zlatiborski okrug"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Russia --> - <iso_3166_country code="RU"> - <!-- The ISO 3166-2 entries give romanised versions according to two standards, --> - <!-- GOST (1983) and Russian BGN/PCGN (1947). --> - <!-- Here the BGN entry is listed , since it was listed first in the ISO document --> - <!-- Localize to Cyrillic anyway in the po files. --> - <iso_3166_subset type="Republic"> - <iso_3166_2_entry - code="RU-AD" name="Adygeya, Respublika"/> - <iso_3166_2_entry - code="RU-AL" name="Altay, Respublika"/> - <iso_3166_2_entry - code="RU-BA" name="Bashkortostan, Respublika"/> - <iso_3166_2_entry - code="RU-BU" name="Buryatiya, Respublika"/> - <iso_3166_2_entry - code="RU-CE" name="Chechenskaya Respublika"/> - <iso_3166_2_entry - code="RU-CU" name="Chuvashskaya Respublika"/> - <iso_3166_2_entry - code="RU-DA" name="Dagestan, Respublika"/> - <iso_3166_2_entry - code="RU-IN" name="Respublika Ingushetiya"/> - <iso_3166_2_entry - code="RU-KB" name="Kabardino-Balkarskaya Respublika"/> - <iso_3166_2_entry - code="RU-KL" name="Kalmykiya, Respublika"/> - <iso_3166_2_entry - code="RU-KC" name="Karachayevo-Cherkesskaya Respublika"/> - <iso_3166_2_entry - code="RU-KR" name="Kareliya, Respublika"/> - <iso_3166_2_entry - code="RU-KK" name="Khakasiya, Respublika"/> - <iso_3166_2_entry - code="RU-KO" name="Komi, Respublika"/> - <iso_3166_2_entry - code="RU-ME" name="Mariy El, Respublika"/> - <iso_3166_2_entry - code="RU-MO" name="Mordoviya, Respublika"/> - <iso_3166_2_entry - code="RU-SA" name="Sakha, Respublika [Yakutiya]"/> - <iso_3166_2_entry - code="RU-SE" name="Severnaya Osetiya-Alaniya, Respublika"/> - <iso_3166_2_entry - code="RU-TA" name="Tatarstan, Respublika"/> - <iso_3166_2_entry - code="RU-TY" name="Tyva, Respublika [Tuva]"/> - <iso_3166_2_entry - code="RU-UD" name="Udmurtskaya Respublika"/> - </iso_3166_subset> - <iso_3166_subset type="Administrative Territory"> - <iso_3166_2_entry - code="RU-ALT" name="Altayskiy kray"/> - <iso_3166_2_entry - code="RU-KAM" name="Kamchatskiy kray"/> - <iso_3166_2_entry - code="RU-KHA" name="Khabarovskiy kray"/> - <iso_3166_2_entry - code="RU-KDA" name="Krasnodarskiy kray"/> - <iso_3166_2_entry - code="RU-KYA" name="Krasnoyarskiy kray"/> - <iso_3166_2_entry - code="RU-PER" name="Permskiy kray"/> - <iso_3166_2_entry - code="RU-PRI" name="Primorskiy kray"/> - <iso_3166_2_entry - code="RU-STA" name="Stavropol'skiy kray"/> - <iso_3166_2_entry - code="RU-ZAB" name="Zabajkal'skij kraj"/> - </iso_3166_subset> - <iso_3166_subset type="Administrative Region"> - <iso_3166_2_entry - code="RU-AMU" name="Amurskaya oblast'"/> - <iso_3166_2_entry - code="RU-ARK" name="Arkhangel'skaya oblast'"/> - <iso_3166_2_entry - code="RU-AST" name="Astrakhanskaya oblast'"/> - <iso_3166_2_entry - code="RU-BEL" name="Belgorodskaya oblast'"/> - <iso_3166_2_entry - code="RU-BRY" name="Bryanskaya oblast'"/> - <iso_3166_2_entry - code="RU-CHE" name="Chelyabinskaya oblast'"/> - <iso_3166_2_entry - code="RU-IRK" name="Irkutiskaya oblast'"/> - <iso_3166_2_entry - code="RU-IVA" name="Ivanovskaya oblast'"/> - <iso_3166_2_entry - code="RU-KGD" name="Kaliningradskaya oblast'"/> - <iso_3166_2_entry - code="RU-KLU" name="Kaluzhskaya oblast'"/> - <iso_3166_2_entry - code="RU-KEM" name="Kemerovskaya oblast'"/> - <iso_3166_2_entry - code="RU-KIR" name="Kirovskaya oblast'"/> - <iso_3166_2_entry - code="RU-KOS" name="Kostromskaya oblast'"/> - <iso_3166_2_entry - code="RU-KGN" name="Kurganskaya oblast'"/> - <iso_3166_2_entry - code="RU-KRS" name="Kurskaya oblast'"/> - <iso_3166_2_entry - code="RU-LEN" name="Leningradskaya oblast'"/> - <iso_3166_2_entry - code="RU-LIP" name="Lipetskaya oblast'"/> - <iso_3166_2_entry - code="RU-MAG" name="Magadanskaya oblast'"/> - <iso_3166_2_entry - code="RU-MOS" name="Moskovskaya oblast'"/> - <iso_3166_2_entry - code="RU-MUR" name="Murmanskaya oblast'"/> - <iso_3166_2_entry - code="RU-NIZ" name="Nizhegorodskaya oblast'"/> - <iso_3166_2_entry - code="RU-NGR" name="Novgorodskaya oblast'"/> - <iso_3166_2_entry - code="RU-NVS" name="Novosibirskaya oblast'"/> - <iso_3166_2_entry - code="RU-OMS" name="Omskaya oblast'"/> - <iso_3166_2_entry - code="RU-ORE" name="Orenburgskaya oblast'"/> - <iso_3166_2_entry - code="RU-ORL" name="Orlovskaya oblast'"/> - <iso_3166_2_entry - code="RU-PNZ" name="Penzenskaya oblast'"/> - <iso_3166_2_entry - code="RU-PSK" name="Pskovskaya oblast'"/> - <iso_3166_2_entry - code="RU-ROS" name="Rostovskaya oblast'"/> - <iso_3166_2_entry - code="RU-RYA" name="Ryazanskaya oblast'"/> - <iso_3166_2_entry - code="RU-SAK" name="Sakhalinskaya oblast'"/> - <iso_3166_2_entry - code="RU-SAM" name="Samaraskaya oblast'"/> - <iso_3166_2_entry - code="RU-SAR" name="Saratovskaya oblast'"/> - <iso_3166_2_entry - code="RU-SMO" name="Smolenskaya oblast'"/> - <iso_3166_2_entry - code="RU-SVE" name="Sverdlovskaya oblast'"/> - <iso_3166_2_entry - code="RU-TAM" name="Tambovskaya oblast'"/> - <iso_3166_2_entry - code="RU-TOM" name="Tomskaya oblast'"/> - <iso_3166_2_entry - code="RU-TUL" name="Tul'skaya oblast'"/> - <iso_3166_2_entry - code="RU-TVE" name="Tverskaya oblast'"/> - <iso_3166_2_entry - code="RU-TYU" name="Tyumenskaya oblast'"/> - <iso_3166_2_entry - code="RU-ULY" name="Ul'yanovskaya oblast'"/> - <iso_3166_2_entry - code="RU-VLA" name="Vladimirskaya oblast'"/> - <iso_3166_2_entry - code="RU-VGG" name="Volgogradskaya oblast'"/> - <iso_3166_2_entry - code="RU-VLG" name="Vologodskaya oblast'"/> - <iso_3166_2_entry - code="RU-VOR" name="Voronezhskaya oblast'"/> - <iso_3166_2_entry - code="RU-YAR" name="Yaroslavskaya oblast'"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous City"> - <iso_3166_2_entry - code="RU-MOW" name="Moskva"/> - <iso_3166_2_entry - code="RU-SPE" name="Sankt-Peterburg"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous Region"> - <iso_3166_2_entry - code="RU-YEV" name="Yevreyskaya avtonomnaya oblast'"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous District"> - <iso_3166_2_entry - code="RU-CHU" name="Chukotskiy avtonomnyy okrug"/> - <iso_3166_2_entry - code="RU-KHM" name="Khanty-Mansiysky avtonomnyy okrug-Yugra"/> - <iso_3166_2_entry - code="RU-NEN" name="Nenetskiy avtonomnyy okrug"/> - <iso_3166_2_entry - code="RU-YAN" name="Yamalo-Nenetskiy avtonomnyy okrug"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Rwanda --> - <iso_3166_country code="RW"> - <iso_3166_subset type="Town council"> - <iso_3166_2_entry - code="RW-01" name="Ville de Kigali"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="RW-02" name="Est"/> - <iso_3166_2_entry - code="RW-03" name="Nord"/> - <iso_3166_2_entry - code="RW-04" name="Ouest"/> - <iso_3166_2_entry - code="RW-05" name="Sud"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saudi Arabia --> - <iso_3166_country code="SA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="SA-11" name="Al Bāhah"/> - <iso_3166_2_entry - code="SA-08" name="Al Ḥudūd ash Shamāliyah"/> - <iso_3166_2_entry - code="SA-12" name="Al Jawf"/> - <iso_3166_2_entry - code="SA-03" name="Al Madīnah"/> - <iso_3166_2_entry - code="SA-05" name="Al Qaşīm"/> - <iso_3166_2_entry - code="SA-01" name="Ar Riyāḍ"/> - <iso_3166_2_entry - code="SA-04" name="Ash Sharqīyah"/> - <iso_3166_2_entry - code="SA-14" name="`Asīr"/> - <iso_3166_2_entry - code="SA-06" name="Ḥā'il"/> - <iso_3166_2_entry - code="SA-09" name="Jīzan"/> - <iso_3166_2_entry - code="SA-02" name="Makkah"/> - <iso_3166_2_entry - code="SA-10" name="Najrān"/> - <iso_3166_2_entry - code="SA-07" name="Tabūk"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Solomon Islands --> - <iso_3166_country code="SB"> - <iso_3166_subset type="Capital territory"> - <iso_3166_2_entry - code="SB-CT" name="Capital Territory (Honiara)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="SB-CE" name="Central"/> - <iso_3166_2_entry - code="SB-CH" name="Choiseul"/> - <iso_3166_2_entry - code="SB-GU" name="Guadalcanal"/> - <iso_3166_2_entry - code="SB-IS" name="Isabel"/> - <iso_3166_2_entry - code="SB-MK" name="Makira"/> - <iso_3166_2_entry - code="SB-ML" name="Malaita"/> - <iso_3166_2_entry - code="SB-RB" name="Rennell and Bellona"/> - <iso_3166_2_entry - code="SB-TE" name="Temotu"/> - <iso_3166_2_entry - code="SB-WE" name="Western"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Seychelles --> - <iso_3166_country code="SC"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="SC-01" name="Anse aux Pins"/> - <iso_3166_2_entry - code="SC-02" name="Anse Boileau"/> - <iso_3166_2_entry - code="SC-03" name="Anse Etoile"/> - <iso_3166_2_entry - code="SC-04" name="Anse Louis"/> - <iso_3166_2_entry - code="SC-05" name="Anse Royale"/> - <iso_3166_2_entry - code="SC-06" name="Baie Lazare"/> - <iso_3166_2_entry - code="SC-07" name="Baie Sainte Anne"/> - <iso_3166_2_entry - code="SC-08" name="Beau Vallon"/> - <iso_3166_2_entry - code="SC-09" name="Bel Air"/> - <iso_3166_2_entry - code="SC-10" name="Bel Ombre"/> - <iso_3166_2_entry - code="SC-11" name="Cascade"/> - <iso_3166_2_entry - code="SC-12" name="Glacis"/> - <iso_3166_2_entry - code="SC-13" name="Grand Anse Mahe"/> - <iso_3166_2_entry - code="SC-14" name="Grand Anse Praslin"/> - <iso_3166_2_entry - code="SC-15" name="La Digue"/> - <iso_3166_2_entry - code="SC-16" name="English River"/> - <iso_3166_2_entry - code="SC-24" name="Les Mamelles"/> - <iso_3166_2_entry - code="SC-17" name="Mont Buxton"/> - <iso_3166_2_entry - code="SC-18" name="Mont Fleuri"/> - <iso_3166_2_entry - code="SC-19" name="Plaisance"/> - <iso_3166_2_entry - code="SC-20" name="Pointe Larue"/> - <iso_3166_2_entry - code="SC-21" name="Port Glaud"/> - <iso_3166_2_entry - code="SC-25" name="Roche Caiman"/> - <iso_3166_2_entry - code="SC-22" name="Saint Louis"/> - <iso_3166_2_entry - code="SC-23" name="Takamaka"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sudan --> - <iso_3166_country code="SD"> - <iso_3166_subset type="state"> - <iso_3166_2_entry - code="SD-26" name="Al Baḩr al Aḩmar"/> - <iso_3166_2_entry - code="SD-18" name="Al Buḩayrāt"/> - <iso_3166_2_entry - code="SD-07" name="Al Jazīrah"/> - <iso_3166_2_entry - code="SD-03" name="Al Kharţūm"/> - <iso_3166_2_entry - code="SD-06" name="Al Qaḑārif"/> - <iso_3166_2_entry - code="SD-22" name="Al Waḩdah"/> - <iso_3166_2_entry - code="SD-04" name="An Nīl"/> - <iso_3166_2_entry - code="SD-08" name="An Nīl al Abyaḑ"/> - <iso_3166_2_entry - code="SD-24" name="An Nīl al Azraq"/> - <iso_3166_2_entry - code="SD-01" name="Ash Shamālīyah"/> - <iso_3166_2_entry - code="SD-23" name="A‘ālī an Nīl"/> - <iso_3166_2_entry - code="SD-17" name="Baḩr al Jabal"/> - <iso_3166_2_entry - code="SD-16" name="Gharb al Istiwā'īyah"/> - <iso_3166_2_entry - code="SD-14" name="Gharb Baḩr al Ghazāl"/> - <iso_3166_2_entry - code="SD-12" name="Gharb Dārfūr"/> - <iso_3166_2_entry - code="SD-11" name="Janūb Dārfūr"/> - <iso_3166_2_entry - code="SD-13" name="Janūb Kurdufān"/> - <iso_3166_2_entry - code="SD-20" name="Jūnqalī"/> - <iso_3166_2_entry - code="SD-05" name="Kassalā"/> - <iso_3166_2_entry - code="SD-15" name="Shamāl Baḩr al Ghazāl"/> - <iso_3166_2_entry - code="SD-02" name="Shamāl Dārfūr"/> - <iso_3166_2_entry - code="SD-09" name="Shamāl Kurdufān"/> - <iso_3166_2_entry - code="SD-19" name="Sharq al Istiwā'īyah"/> - <iso_3166_2_entry - code="SD-25" name="Sinnār"/> - <iso_3166_2_entry - code="SD-21" name="Wārāb"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sweden --> - <iso_3166_country code="SE"> - <iso_3166_subset type="County"> - <iso_3166_2_entry - code="SE-K" name="Blekinge län"/> - <iso_3166_2_entry - code="SE-W" name="Dalarnas län"/> - <iso_3166_2_entry - code="SE-I" name="Gotlands län"/> - <iso_3166_2_entry - code="SE-X" name="Gävleborgs län"/> - <iso_3166_2_entry - code="SE-N" name="Hallands län"/> - <iso_3166_2_entry - code="SE-Z" name="Jämtlande län"/> - <iso_3166_2_entry - code="SE-F" name="Jönköpings län"/> - <iso_3166_2_entry - code="SE-H" name="Kalmar län"/> - <iso_3166_2_entry - code="SE-G" name="Kronobergs län"/> - <iso_3166_2_entry - code="SE-BD" name="Norrbottens län"/> - <iso_3166_2_entry - code="SE-M" name="Skåne län"/> - <iso_3166_2_entry - code="SE-AB" name="Stockholms län"/> - <iso_3166_2_entry - code="SE-D" name="Södermanlands län"/> - <iso_3166_2_entry - code="SE-C" name="Uppsala län"/> - <iso_3166_2_entry - code="SE-S" name="Värmlands län"/> - <iso_3166_2_entry - code="SE-AC" name="Västerbottens län"/> - <iso_3166_2_entry - code="SE-Y" name="Västernorrlands län"/> - <iso_3166_2_entry - code="SE-U" name="Västmanlands län"/> - <iso_3166_2_entry - code="SE-Q" name="Västra Götalands län"/> - <iso_3166_2_entry - code="SE-T" name="Örebro län"/> - <iso_3166_2_entry - code="SE-E" name="Östergötlands län"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Singapore --> - <iso_3166_country code="SG"> - <iso_3166_subset type="district"> - <iso_3166_2_entry - code="SG-01" name="Central Singapore"/> - <iso_3166_2_entry - code="SG-02" name="North East"/> - <iso_3166_2_entry - code="SG-03" name="North West"/> - <iso_3166_2_entry - code="SG-04" name="South East"/> - <iso_3166_2_entry - code="SG-05" name="South West"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Helena, Ascension and Tristan da Cunha --> - <iso_3166_country code="SH"> - </iso_3166_country> - <!-- Slovenia --> - <iso_3166_country code="SI"> - <iso_3166_subset type="Municipalities"> - <iso_3166_2_entry - code="SI-001" name="Ajdovščina"/> - <iso_3166_2_entry - code="SI-195" name="Apače"/> - <iso_3166_2_entry - code="SI-002" name="Beltinci"/> - <iso_3166_2_entry - code="SI-148" name="Benedikt"/> - <iso_3166_2_entry - code="SI-149" name="Bistrica ob Sotli"/> - <iso_3166_2_entry - code="SI-003" name="Bled"/> - <iso_3166_2_entry - code="SI-150" name="Bloke"/> - <iso_3166_2_entry - code="SI-004" name="Bohinj"/> - <iso_3166_2_entry - code="SI-005" name="Borovnica"/> - <iso_3166_2_entry - code="SI-006" name="Bovec"/> - <iso_3166_2_entry - code="SI-151" name="Braslovče"/> - <iso_3166_2_entry - code="SI-007" name="Brda"/> - <iso_3166_2_entry - code="SI-008" name="Brezovica"/> - <iso_3166_2_entry - code="SI-009" name="Brežice"/> - <iso_3166_2_entry - code="SI-152" name="Cankova"/> - <iso_3166_2_entry - code="SI-011" name="Celje"/> - <iso_3166_2_entry - code="SI-012" name="Cerklje na Gorenjskem"/> - <iso_3166_2_entry - code="SI-013" name="Cerknica"/> - <iso_3166_2_entry - code="SI-014" name="Cerkno"/> - <iso_3166_2_entry - code="SI-153" name="Cerkvenjak"/> - <iso_3166_2_entry - code="SI-196" name="Cirkulane"/> - <iso_3166_2_entry - code="SI-015" name="Črenšovci"/> - <iso_3166_2_entry - code="SI-016" name="Črna na Koroškem"/> - <iso_3166_2_entry - code="SI-017" name="Črnomelj"/> - <iso_3166_2_entry - code="SI-018" name="Destrnik"/> - <iso_3166_2_entry - code="SI-019" name="Divača"/> - <iso_3166_2_entry - code="SI-154" name="Dobje"/> - <iso_3166_2_entry - code="SI-020" name="Dobrepolje"/> - <iso_3166_2_entry - code="SI-155" name="Dobrna"/> - <iso_3166_2_entry - code="SI-021" name="Dobrova-Polhov Gradec"/> - <iso_3166_2_entry - code="SI-156" name="Dobrovnik/Dobronak"/> - <iso_3166_2_entry - code="SI-022" name="Dol pri Ljubljani"/> - <iso_3166_2_entry - code="SI-157" name="Dolenjske Toplice"/> - <iso_3166_2_entry - code="SI-023" name="Domžale"/> - <iso_3166_2_entry - code="SI-024" name="Dornava"/> - <iso_3166_2_entry - code="SI-025" name="Dravograd"/> - <iso_3166_2_entry - code="SI-026" name="Duplek"/> - <iso_3166_2_entry - code="SI-027" name="Gorenja vas-Poljane"/> - <iso_3166_2_entry - code="SI-028" name="Gorišnica"/> - <iso_3166_2_entry - code="SI-207" name="Gorje"/> - <iso_3166_2_entry - code="SI-029" name="Gornja Radgona"/> - <iso_3166_2_entry - code="SI-030" name="Gornji Grad"/> - <iso_3166_2_entry - code="SI-031" name="Gornji Petrovci"/> - <iso_3166_2_entry - code="SI-158" name="Grad"/> - <iso_3166_2_entry - code="SI-032" name="Grosuplje"/> - <iso_3166_2_entry - code="SI-159" name="Hajdina"/> - <iso_3166_2_entry - code="SI-160" name="Hoče-Slivnica"/> - <iso_3166_2_entry - code="SI-161" name="Hodoš/Hodos"/> - <iso_3166_2_entry - code="SI-162" name="Horjul"/> - <iso_3166_2_entry - code="SI-034" name="Hrastnik"/> - <iso_3166_2_entry - code="SI-035" name="Hrpelje-Kozina"/> - <iso_3166_2_entry - code="SI-036" name="Idrija"/> - <iso_3166_2_entry - code="SI-037" name="Ig"/> - <iso_3166_2_entry - code="SI-038" name="Ilirska Bistrica"/> - <iso_3166_2_entry - code="SI-039" name="Ivančna Gorica"/> - <iso_3166_2_entry - code="SI-040" name="Izola/Isola"/> - <iso_3166_2_entry - code="SI-041" name="Jesenice"/> - <iso_3166_2_entry - code="SI-163" name="Jezersko"/> - <iso_3166_2_entry - code="SI-042" name="Juršinci"/> - <iso_3166_2_entry - code="SI-043" name="Kamnik"/> - <iso_3166_2_entry - code="SI-044" name="Kanal"/> - <iso_3166_2_entry - code="SI-045" name="Kidričevo"/> - <iso_3166_2_entry - code="SI-046" name="Kobarid"/> - <iso_3166_2_entry - code="SI-047" name="Kobilje"/> - <iso_3166_2_entry - code="SI-048" name="Kočevje"/> - <iso_3166_2_entry - code="SI-049" name="Komen"/> - <iso_3166_2_entry - code="SI-164" name="Komenda"/> - <iso_3166_2_entry - code="SI-050" name="Koper/Capodistria"/> - <iso_3166_2_entry - code="SI-197" name="Kosanjevica na Krki"/> - <iso_3166_2_entry - code="SI-165" name="Kostel"/> - <iso_3166_2_entry - code="SI-051" name="Kozje"/> - <iso_3166_2_entry - code="SI-052" name="Kranj"/> - <iso_3166_2_entry - code="SI-053" name="Kranjska Gora"/> - <iso_3166_2_entry - code="SI-166" name="Križevci"/> - <iso_3166_2_entry - code="SI-054" name="Krško"/> - <iso_3166_2_entry - code="SI-055" name="Kungota"/> - <iso_3166_2_entry - code="SI-056" name="Kuzma"/> - <iso_3166_2_entry - code="SI-057" name="Laško"/> - <iso_3166_2_entry - code="SI-058" name="Lenart"/> - <iso_3166_2_entry - code="SI-059" name="Lendava/Lendva"/> - <iso_3166_2_entry - code="SI-060" name="Litija"/> - <iso_3166_2_entry - code="SI-061" name="Ljubljana"/> - <iso_3166_2_entry - code="SI-062" name="Ljubno"/> - <iso_3166_2_entry - code="SI-063" name="Ljutomer"/> - <iso_3166_2_entry - code="SI-208" name="Log-Dragomer"/> - <iso_3166_2_entry - code="SI-064" name="Logatec"/> - <iso_3166_2_entry - code="SI-065" name="Loška dolina"/> - <iso_3166_2_entry - code="SI-066" name="Loški Potok"/> - <iso_3166_2_entry - code="SI-167" name="Lovrenc na Pohorju"/> - <iso_3166_2_entry - code="SI-067" name="Luče"/> - <iso_3166_2_entry - code="SI-068" name="Lukovica"/> - <iso_3166_2_entry - code="SI-069" name="Majšperk"/> - <iso_3166_2_entry - code="SI-198" name="Makole"/> - <iso_3166_2_entry - code="SI-070" name="Maribor"/> - <iso_3166_2_entry - code="SI-168" name="Markovci"/> - <iso_3166_2_entry - code="SI-071" name="Medvode"/> - <iso_3166_2_entry - code="SI-072" name="Mengeš"/> - <iso_3166_2_entry - code="SI-073" name="Metlika"/> - <iso_3166_2_entry - code="SI-074" name="Mežica"/> - <iso_3166_2_entry - code="SI-169" name="Miklavž na Dravskem polju"/> - <iso_3166_2_entry - code="SI-075" name="Miren-Kostanjevica"/> - <iso_3166_2_entry - code="SI-170" name="Mirna Peč"/> - <iso_3166_2_entry - code="SI-076" name="Mislinja"/> - <iso_3166_2_entry - code="SI-199" name="Mokronog-Trebelno"/> - <iso_3166_2_entry - code="SI-077" name="Moravče"/> - <iso_3166_2_entry - code="SI-078" name="Moravske Toplice"/> - <iso_3166_2_entry - code="SI-079" name="Mozirje"/> - <iso_3166_2_entry - code="SI-080" name="Murska Sobota"/> - <iso_3166_2_entry - code="SI-081" name="Muta"/> - <iso_3166_2_entry - code="SI-082" name="Naklo"/> - <iso_3166_2_entry - code="SI-083" name="Nazarje"/> - <iso_3166_2_entry - code="SI-084" name="Nova Gorica"/> - <iso_3166_2_entry - code="SI-085" name="Novo mesto"/> - <iso_3166_2_entry - code="SI-086" name="Odranci"/> - <iso_3166_2_entry - code="SI-171" name="Oplotnica"/> - <iso_3166_2_entry - code="SI-087" name="Ormož"/> - <iso_3166_2_entry - code="SI-088" name="Osilnica"/> - <iso_3166_2_entry - code="SI-089" name="Pesnica"/> - <iso_3166_2_entry - code="SI-090" name="Piran/Pirano"/> - <iso_3166_2_entry - code="SI-091" name="Pivka"/> - <iso_3166_2_entry - code="SI-092" name="Podčetrtek"/> - <iso_3166_2_entry - code="SI-172" name="Podlehnik"/> - <iso_3166_2_entry - code="SI-093" name="Podvelka"/> - <iso_3166_2_entry - code="SI-200" name="Poljčane"/> - <iso_3166_2_entry - code="SI-173" name="Polzela"/> - <iso_3166_2_entry - code="SI-094" name="Postojna"/> - <iso_3166_2_entry - code="SI-174" name="Prebold"/> - <iso_3166_2_entry - code="SI-095" name="Preddvor"/> - <iso_3166_2_entry - code="SI-175" name="Prevalje"/> - <iso_3166_2_entry - code="SI-096" name="Ptuj"/> - <iso_3166_2_entry - code="SI-097" name="Puconci"/> - <iso_3166_2_entry - code="SI-098" name="Rače-Fram"/> - <iso_3166_2_entry - code="SI-099" name="Radeče"/> - <iso_3166_2_entry - code="SI-100" name="Radenci"/> - <iso_3166_2_entry - code="SI-101" name="Radlje ob Dravi"/> - <iso_3166_2_entry - code="SI-102" name="Radovljica"/> - <iso_3166_2_entry - code="SI-103" name="Ravne na Koroškem"/> - <iso_3166_2_entry - code="SI-176" name="Razkrižje"/> - <iso_3166_2_entry - code="SI-209" name="Rečica ob Savinji"/> - <iso_3166_2_entry - code="SI-201" name="Renče-Vogrsko"/> - <iso_3166_2_entry - code="SI-104" name="Ribnica"/> - <iso_3166_2_entry - code="SI-177" name="Ribnica na Pohorju"/> - <iso_3166_2_entry - code="SI-106" name="Rogaška Slatina"/> - <iso_3166_2_entry - code="SI-105" name="Rogašovci"/> - <iso_3166_2_entry - code="SI-107" name="Rogatec"/> - <iso_3166_2_entry - code="SI-108" name="Ruše"/> - <iso_3166_2_entry - code="SI-178" name="Selnica ob Dravi"/> - <iso_3166_2_entry - code="SI-109" name="Semič"/> - <iso_3166_2_entry - code="SI-110" name="Sevnica"/> - <iso_3166_2_entry - code="SI-111" name="Sežana"/> - <iso_3166_2_entry - code="SI-112" name="Slovenj Gradec"/> - <iso_3166_2_entry - code="SI-113" name="Slovenska Bistrica"/> - <iso_3166_2_entry - code="SI-114" name="Slovenske Konjice"/> - <iso_3166_2_entry - code="SI-179" name="Sodražica"/> - <iso_3166_2_entry - code="SI-180" name="Solčava"/> - <iso_3166_2_entry - code="SI-202" name="Središče ob Dravi"/> - <iso_3166_2_entry - code="SI-115" name="Starče"/> - <iso_3166_2_entry - code="SI-203" name="Straža"/> - <iso_3166_2_entry - code="SI-181" name="Sveta Ana"/> - <iso_3166_2_entry - code="SI-204" name="Sveta Trojica v Slovenskih Goricah"/> - <iso_3166_2_entry - code="SI-182" name="Sveta Andraž v Slovenskih Goricah"/> - <iso_3166_2_entry - code="SI-116" name="Sveti Jurij"/> - <iso_3166_2_entry - code="SI-210" name="Sveti Jurij v Slovenskih Goricah"/> - <iso_3166_2_entry - code="SI-205" name="Sveti Tomaž"/> - <iso_3166_2_entry - code="SI-033" name="Šalovci"/> - <iso_3166_2_entry - code="SI-183" name="Šempeter-Vrtojba"/> - <iso_3166_2_entry - code="SI-117" name="Šenčur"/> - <iso_3166_2_entry - code="SI-118" name="Šentilj"/> - <iso_3166_2_entry - code="SI-119" name="Šentjernej"/> - <iso_3166_2_entry - code="SI-120" name="Šentjur"/> - <iso_3166_2_entry - code="SI-211" name="Šentrupert"/> - <iso_3166_2_entry - code="SI-121" name="Škocjan"/> - <iso_3166_2_entry - code="SI-122" name="Škofja Loka"/> - <iso_3166_2_entry - code="SI-123" name="Škofljica"/> - <iso_3166_2_entry - code="SI-124" name="Šmarje pri Jelšah"/> - <iso_3166_2_entry - code="SI-206" name="Šmarjeske Topliče"/> - <iso_3166_2_entry - code="SI-125" name="Šmartno ob Paki"/> - <iso_3166_2_entry - code="SI-194" name="Šmartno pri Litiji"/> - <iso_3166_2_entry - code="SI-126" name="Šoštanj"/> - <iso_3166_2_entry - code="SI-127" name="Štore"/> - <iso_3166_2_entry - code="SI-184" name="Tabor"/> - <iso_3166_2_entry - code="SI-010" name="Tišina"/> - <iso_3166_2_entry - code="SI-128" name="Tolmin"/> - <iso_3166_2_entry - code="SI-129" name="Trbovlje"/> - <iso_3166_2_entry - code="SI-130" name="Trebnje"/> - <iso_3166_2_entry - code="SI-185" name="Trnovska vas"/> - <iso_3166_2_entry - code="SI-186" name="Trzin"/> - <iso_3166_2_entry - code="SI-131" name="Tržič"/> - <iso_3166_2_entry - code="SI-132" name="Turnišče"/> - <iso_3166_2_entry - code="SI-133" name="Velenje"/> - <iso_3166_2_entry - code="SI-187" name="Velika Polana"/> - <iso_3166_2_entry - code="SI-134" name="Velike Lašče"/> - <iso_3166_2_entry - code="SI-188" name="Veržej"/> - <iso_3166_2_entry - code="SI-135" name="Videm"/> - <iso_3166_2_entry - code="SI-136" name="Vipava"/> - <iso_3166_2_entry - code="SI-137" name="Vitanje"/> - <iso_3166_2_entry - code="SI-138" name="Vodice"/> - <iso_3166_2_entry - code="SI-139" name="Vojnik"/> - <iso_3166_2_entry - code="SI-189" name="Vransko"/> - <iso_3166_2_entry - code="SI-140" name="Vrhnika"/> - <iso_3166_2_entry - code="SI-141" name="Vuzenica"/> - <iso_3166_2_entry - code="SI-142" name="Zagorje ob Savi"/> - <iso_3166_2_entry - code="SI-143" name="Zavrč"/> - <iso_3166_2_entry - code="SI-144" name="Zreče"/> - <iso_3166_2_entry - code="SI-190" name="Žalec"/> - <iso_3166_2_entry - code="SI-146" name="Železniki"/> - <iso_3166_2_entry - code="SI-191" name="Žetale"/> - <iso_3166_2_entry - code="SI-147" name="Žiri"/> - <iso_3166_2_entry - code="SI-192" name="Žirovnica"/> - <iso_3166_2_entry - code="SI-193" name="Žužemberk"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Slovakia --> - <iso_3166_country code="SK"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="SK-BC" name="Banskobystrický kraj"/> - <iso_3166_2_entry - code="SK-BL" name="Bratislavský kraj"/> - <iso_3166_2_entry - code="SK-KI" name="Košický kraj"/> - <iso_3166_2_entry - code="SK-NJ" name="Nitriansky kraj"/> - <iso_3166_2_entry - code="SK-PV" name="Prešovský kraj"/> - <iso_3166_2_entry - code="SK-TC" name="Trenčiansky kraj"/> - <iso_3166_2_entry - code="SK-TA" name="Trnavský kraj"/> - <iso_3166_2_entry - code="SK-ZI" name="Žilinský kraj"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sierra Leone --> - <iso_3166_country code="SL"> - <iso_3166_subset type="Area"> - <iso_3166_2_entry - code="SL-W" name="Western Area (Freetown)"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="SL-E" name="Eastern"/> - <iso_3166_2_entry - code="SL-N" name="Northern"/> - <iso_3166_2_entry - code="SL-S" name="Southern (Sierra Leone)"/> - </iso_3166_subset> - </iso_3166_country> - <!-- San Marino --> - <iso_3166_country code="SM"> - <iso_3166_subset type="Municipalities"> - <iso_3166_2_entry - code="SM-01" name="Acquaviva"/> - <iso_3166_2_entry - code="SM-06" name="Borgo Maggiore"/> - <iso_3166_2_entry - code="SM-02" name="Chiesanuova"/> - <iso_3166_2_entry - code="SM-03" name="Domagnano"/> - <iso_3166_2_entry - code="SM-04" name="Faetano"/> - <iso_3166_2_entry - code="SM-05" name="Fiorentino"/> - <iso_3166_2_entry - code="SM-08" name="Montegiardino"/> - <iso_3166_2_entry - code="SM-07" name="San Marino"/> - <iso_3166_2_entry - code="SM-09" name="Serravalle"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Senegal --> - <iso_3166_country code="SN"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="SN-DK" name="Dakar"/> - <iso_3166_2_entry - code="SN-DB" name="Diourbel"/> - <iso_3166_2_entry - code="SN-FK" name="Fatick"/> - <iso_3166_2_entry - code="SN-KA" name="Kaffrine"/> - <iso_3166_2_entry - code="SN-KL" name="Kaolack"/> - <iso_3166_2_entry - code="SN-KE" name="Kédougou"/> - <iso_3166_2_entry - code="SN-KD" name="Kolda"/> - <iso_3166_2_entry - code="SN-LG" name="Louga"/> - <iso_3166_2_entry - code="SN-MT" name="Matam"/> - <iso_3166_2_entry - code="SN-SL" name="Saint-Louis"/> - <iso_3166_2_entry - code="SN-SE" name="Sédhiou"/> - <iso_3166_2_entry - code="SN-TC" name="Tambacounda"/> - <iso_3166_2_entry - code="SN-TH" name="Thiès"/> - <iso_3166_2_entry - code="SN-ZG" name="Ziguinchor"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Somalia --> - <iso_3166_country code="SO"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="SO-AW" name="Awdal"/> - <iso_3166_2_entry - code="SO-BK" name="Bakool"/> - <iso_3166_2_entry - code="SO-BN" name="Banaadir"/> - <iso_3166_2_entry - code="SO-BR" name="Bari"/> - <iso_3166_2_entry - code="SO-BY" name="Bay"/> - <iso_3166_2_entry - code="SO-GA" name="Galguduud"/> - <iso_3166_2_entry - code="SO-GE" name="Gedo"/> - <iso_3166_2_entry - code="SO-HI" name="Hiirsan"/> - <iso_3166_2_entry - code="SO-JD" name="Jubbada Dhexe"/> - <iso_3166_2_entry - code="SO-JH" name="Jubbada Hoose"/> - <iso_3166_2_entry - code="SO-MU" name="Mudug"/> - <iso_3166_2_entry - code="SO-NU" name="Nugaal"/> - <iso_3166_2_entry - code="SO-SA" name="Saneag"/> - <iso_3166_2_entry - code="SO-SD" name="Shabeellaha Dhexe"/> - <iso_3166_2_entry - code="SO-SH" name="Shabeellaha Hoose"/> - <iso_3166_2_entry - code="SO-SO" name="Sool"/> - <iso_3166_2_entry - code="SO-TO" name="Togdheer"/> - <iso_3166_2_entry - code="SO-WO" name="Woqooyi Galbeed"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Suriname --> - <iso_3166_country code="SR"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="SR-BR" name="Brokopondo"/> - <iso_3166_2_entry - code="SR-CM" name="Commewijne"/> - <iso_3166_2_entry - code="SR-CR" name="Coronie"/> - <iso_3166_2_entry - code="SR-MA" name="Marowijne"/> - <iso_3166_2_entry - code="SR-NI" name="Nickerie"/> - <iso_3166_2_entry - code="SR-PR" name="Para"/> - <iso_3166_2_entry - code="SR-PM" name="Paramaribo"/> - <iso_3166_2_entry - code="SR-SA" name="Saramacca"/> - <iso_3166_2_entry - code="SR-SI" name="Sipaliwini"/> - <iso_3166_2_entry - code="SR-WA" name="Wanica"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Sao Tome and Principe --> - <iso_3166_country code="ST"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="ST-P" name="Príncipe"/> - <iso_3166_2_entry - code="ST-S" name="São Tomé"/> - </iso_3166_subset> - </iso_3166_country> - <!-- El Salvador --> - <iso_3166_country code="SV"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="SV-AH" name="Ahuachapán"/> - <iso_3166_2_entry - code="SV-CA" name="Cabañas"/> - <iso_3166_2_entry - code="SV-CU" name="Cuscatlán"/> - <iso_3166_2_entry - code="SV-CH" name="Chalatenango"/> - <iso_3166_2_entry - code="SV-LI" name="La Libertad"/> - <iso_3166_2_entry - code="SV-PA" name="La Paz"/> - <iso_3166_2_entry - code="SV-UN" name="La Unión"/> - <iso_3166_2_entry - code="SV-MO" name="Morazán"/> - <iso_3166_2_entry - code="SV-SM" name="San Miguel"/> - <iso_3166_2_entry - code="SV-SS" name="San Salvador"/> - <iso_3166_2_entry - code="SV-SA" name="Santa Ana"/> - <iso_3166_2_entry - code="SV-SV" name="San Vicente"/> - <iso_3166_2_entry - code="SV-SO" name="Sonsonate"/> - <iso_3166_2_entry - code="SV-US" name="Usulután"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Syria --> - <iso_3166_country code="SY"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="SY-HA" name="Al Hasakah"/> - <iso_3166_2_entry - code="SY-LA" name="Al Ladhiqiyah"/> - <iso_3166_2_entry - code="SY-QU" name="Al Qunaytirah"/> - <iso_3166_2_entry - code="SY-RA" name="Ar Raqqah"/> - <iso_3166_2_entry - code="SY-SU" name="As Suwayda'"/> - <iso_3166_2_entry - code="SY-DR" name="Dar'a"/> - <iso_3166_2_entry - code="SY-DY" name="Dayr az Zawr"/> - <iso_3166_2_entry - code="SY-DI" name="Dimashq"/> - <iso_3166_2_entry - code="SY-HL" name="Halab"/> - <iso_3166_2_entry - code="SY-HM" name="Hamah"/> - <iso_3166_2_entry - code="SY-HI" name="Homs"/> - <iso_3166_2_entry - code="SY-ID" name="Idlib"/> - <iso_3166_2_entry - code="SY-RD" name="Rif Dimashq"/> - <iso_3166_2_entry - code="SY-TA" name="Tartus"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Swaziland --> - <iso_3166_country code="SZ"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="SZ-HH" name="Hhohho"/> - <iso_3166_2_entry - code="SZ-LU" name="Lubombo"/> - <iso_3166_2_entry - code="SZ-MA" name="Manzini"/> - <iso_3166_2_entry - code="SZ-SH" name="Shiselweni"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Chad --> - <iso_3166_country code="TD"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TD-BA" name="Al Baṭḩah"/> - <iso_3166_2_entry - code="TD-LC" name="Al Buḩayrah"/> - <iso_3166_2_entry - code="TD-BG" name="Baḩr al Ghazāl"/> - <iso_3166_2_entry - code="TD-BO" name="Būrkū"/> - <iso_3166_2_entry - code="TD-HL" name="Ḥajjar Lamīs"/> - <iso_3166_2_entry - code="TD-EN" name="Innīdī"/> - <iso_3166_2_entry - code="TD-KA" name="Kānim"/> - <iso_3166_2_entry - code="TD-LO" name="Lūqūn al Gharbī"/> - <iso_3166_2_entry - code="TD-LR" name="Lūqūn ash Sharqī"/> - <iso_3166_2_entry - code="TD-ND" name="Madīnat Injamīnā"/> - <iso_3166_2_entry - code="TD-MA" name="Māndūl"/> - <iso_3166_2_entry - code="TD-MO" name="Māyū Kībbī al Gharbī"/> - <iso_3166_2_entry - code="TD-ME" name="Māyū Kībbī ash Sharqī"/> - <iso_3166_2_entry - code="TD-GR" name="Qīrā"/> - <iso_3166_2_entry - code="TD-SA" name="Salāmāt"/> - <iso_3166_2_entry - code="TD-MC" name="Shārī al Awsaṭ"/> - <iso_3166_2_entry - code="TD-CB" name="Shārī Bāqirmī"/> - <iso_3166_2_entry - code="TD-SI" name="Sīlā"/> - <iso_3166_2_entry - code="TD-TA" name="Tānjilī"/> - <iso_3166_2_entry - code="TD-TI" name="Tibastī"/> - <iso_3166_2_entry - code="TD-OD" name="Waddāy"/> - <iso_3166_2_entry - code="TD-WF" name="Wādī Fīrā"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Togo --> - <iso_3166_country code="TG"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TG-C" name="Région du Centre"/> - <iso_3166_2_entry - code="TG-K" name="Région de la Kara"/> - <iso_3166_2_entry - code="TG-M" name="Région Maritime"/> - <iso_3166_2_entry - code="TG-P" name="Région des Plateaux"/> - <iso_3166_2_entry - code="TG-S" name="Région des Savannes"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Thailand --> - <iso_3166_country code="TH"> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="TH-10" name="Krung Thep Maha Nakhon Bangkok"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="TH-S" name="Phatthaya"/> - <iso_3166_2_entry - code="TH-37" name="Amnat Charoen"/> - <iso_3166_2_entry - code="TH-15" name="Ang Thong"/> - <iso_3166_2_entry - code="TH-31" name="Buri Ram"/> - <iso_3166_2_entry - code="TH-24" name="Chachoengsao"/> - <iso_3166_2_entry - code="TH-18" name="Chai Nat"/> - <iso_3166_2_entry - code="TH-36" name="Chaiyaphum"/> - <iso_3166_2_entry - code="TH-22" name="Chanthaburi"/> - <iso_3166_2_entry - code="TH-50" name="Chiang Mai"/> - <iso_3166_2_entry - code="TH-57" name="Chiang Rai"/> - <iso_3166_2_entry - code="TH-20" name="Chon Buri"/> - <iso_3166_2_entry - code="TH-86" name="Chumphon"/> - <iso_3166_2_entry - code="TH-46" name="Kalasin"/> - <iso_3166_2_entry - code="TH-62" name="Kamphaeng Phet"/> - <iso_3166_2_entry - code="TH-71" name="Kanchanaburi"/> - <iso_3166_2_entry - code="TH-40" name="Khon Kaen"/> - <iso_3166_2_entry - code="TH-81" name="Krabi"/> - <iso_3166_2_entry - code="TH-52" name="Lampang"/> - <iso_3166_2_entry - code="TH-51" name="Lamphun"/> - <iso_3166_2_entry - code="TH-42" name="Loei"/> - <iso_3166_2_entry - code="TH-16" name="Lop Buri"/> - <iso_3166_2_entry - code="TH-58" name="Mae Hong Son"/> - <iso_3166_2_entry - code="TH-44" name="Maha Sarakham"/> - <iso_3166_2_entry - code="TH-49" name="Mukdahan"/> - <iso_3166_2_entry - code="TH-26" name="Nakhon Nayok"/> - <iso_3166_2_entry - code="TH-73" name="Nakhon Pathom"/> - <iso_3166_2_entry - code="TH-48" name="Nakhon Phanom"/> - <iso_3166_2_entry - code="TH-30" name="Nakhon Ratchasima"/> - <iso_3166_2_entry - code="TH-60" name="Nakhon Sawan"/> - <iso_3166_2_entry - code="TH-80" name="Nakhon Si Thammarat"/> - <iso_3166_2_entry - code="TH-55" name="Nan"/> - <iso_3166_2_entry - code="TH-96" name="Narathiwat"/> - <iso_3166_2_entry - code="TH-39" name="Nong Bua Lam Phu"/> - <iso_3166_2_entry - code="TH-43" name="Nong Khai"/> - <iso_3166_2_entry - code="TH-12" name="Nonthaburi"/> - <iso_3166_2_entry - code="TH-13" name="Pathum Thani"/> - <iso_3166_2_entry - code="TH-94" name="Pattani"/> - <iso_3166_2_entry - code="TH-82" name="Phangnga"/> - <iso_3166_2_entry - code="TH-93" name="Phatthalung"/> - <iso_3166_2_entry - code="TH-56" name="Phayao"/> - <iso_3166_2_entry - code="TH-67" name="Phetchabun"/> - <iso_3166_2_entry - code="TH-76" name="Phetchaburi"/> - <iso_3166_2_entry - code="TH-66" name="Phichit"/> - <iso_3166_2_entry - code="TH-65" name="Phitsanulok"/> - <iso_3166_2_entry - code="TH-54" name="Phrae"/> - <iso_3166_2_entry - code="TH-14" name="Phra Nakhon Si Ayutthaya"/> - <iso_3166_2_entry - code="TH-83" name="Phuket"/> - <iso_3166_2_entry - code="TH-25" name="Prachin Buri"/> - <iso_3166_2_entry - code="TH-77" name="Prachuap Khiri Khan"/> - <iso_3166_2_entry - code="TH-85" name="Ranong"/> - <iso_3166_2_entry - code="TH-70" name="Ratchaburi"/> - <iso_3166_2_entry - code="TH-21" name="Rayong"/> - <iso_3166_2_entry - code="TH-45" name="Roi Et"/> - <iso_3166_2_entry - code="TH-27" name="Sa Kaeo"/> - <iso_3166_2_entry - code="TH-47" name="Sakon Nakhon"/> - <iso_3166_2_entry - code="TH-11" name="Samut Prakan"/> - <iso_3166_2_entry - code="TH-74" name="Samut Sakhon"/> - <iso_3166_2_entry - code="TH-75" name="Samut Songkhram"/> - <iso_3166_2_entry - code="TH-19" name="Saraburi"/> - <iso_3166_2_entry - code="TH-91" name="Satun"/> - <iso_3166_2_entry - code="TH-17" name="Sing Buri"/> - <iso_3166_2_entry - code="TH-33" name="Si Sa Ket"/> - <iso_3166_2_entry - code="TH-90" name="Songkhla"/> - <iso_3166_2_entry - code="TH-64" name="Sukhothai"/> - <iso_3166_2_entry - code="TH-72" name="Suphan Buri"/> - <iso_3166_2_entry - code="TH-84" name="Surat Thani"/> - <iso_3166_2_entry - code="TH-32" name="Surin"/> - <iso_3166_2_entry - code="TH-63" name="Tak"/> - <iso_3166_2_entry - code="TH-92" name="Trang"/> - <iso_3166_2_entry - code="TH-23" name="Trat"/> - <iso_3166_2_entry - code="TH-34" name="Ubon Ratchathani"/> - <iso_3166_2_entry - code="TH-41" name="Udon Thani"/> - <iso_3166_2_entry - code="TH-61" name="Uthai Thani"/> - <iso_3166_2_entry - code="TH-53" name="Uttaradit"/> - <iso_3166_2_entry - code="TH-95" name="Yala"/> - <iso_3166_2_entry - code="TH-35" name="Yasothon"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tajikistan --> - <iso_3166_country code="TJ"> - <iso_3166_subset type="Autonomous region"> - <iso_3166_2_entry - code="TJ-GB" name="Gorno-Badakhshan"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TJ-KT" name="Khatlon"/> - <iso_3166_2_entry - code="TJ-SU" name="Sughd"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Timor Leste --> - <iso_3166_country code="TL"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="TL-AL" name="Aileu"/> - <iso_3166_2_entry - code="TL-AN" name="Ainaro"/> - <iso_3166_2_entry - code="TL-BA" name="Baucau"/> - <iso_3166_2_entry - code="TL-BO" name="Bobonaro"/> - <iso_3166_2_entry - code="TL-CO" name="Cova Lima"/> - <iso_3166_2_entry - code="TL-DI" name="Dili"/> - <iso_3166_2_entry - code="TL-ER" name="Ermera"/> - <iso_3166_2_entry - code="TL-LA" name="Lautem"/> - <iso_3166_2_entry - code="TL-LI" name="Liquiça"/> - <iso_3166_2_entry - code="TL-MT" name="Manatuto"/> - <iso_3166_2_entry - code="TL-MF" name="Manufahi"/> - <iso_3166_2_entry - code="TL-OE" name="Oecussi"/> - <iso_3166_2_entry - code="TL-VI" name="Viqueque"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Turkmenistan --> - <iso_3166_country code="TM"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TM-A" name="Ahal"/> - <iso_3166_2_entry - code="TM-B" name="Balkan"/> - <iso_3166_2_entry - code="TM-D" name="Daşoguz"/> - <iso_3166_2_entry - code="TM-L" name="Lebap"/> - <iso_3166_2_entry - code="TM-M" name="Mary"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="TM-S" name="Aşgabat"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tunisia --> - <iso_3166_country code="TN"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="TN-31" name="Béja"/> - <iso_3166_2_entry - code="TN-13" name="Ben Arous"/> - <iso_3166_2_entry - code="TN-23" name="Bizerte"/> - <iso_3166_2_entry - code="TN-81" name="Gabès"/> - <iso_3166_2_entry - code="TN-71" name="Gafsa"/> - <iso_3166_2_entry - code="TN-32" name="Jendouba"/> - <iso_3166_2_entry - code="TN-41" name="Kairouan"/> - <iso_3166_2_entry - code="TN-42" name="Kasserine"/> - <iso_3166_2_entry - code="TN-73" name="Kebili"/> - <iso_3166_2_entry - code="TN-12" name="L'Ariana"/> - <iso_3166_2_entry - code="TN-33" name="Le Kef"/> - <iso_3166_2_entry - code="TN-53" name="Mahdia"/> - <iso_3166_2_entry - code="TN-14" name="La Manouba"/> - <iso_3166_2_entry - code="TN-82" name="Medenine"/> - <iso_3166_2_entry - code="TN-52" name="Monastir"/> - <iso_3166_2_entry - code="TN-21" name="Nabeul"/> - <iso_3166_2_entry - code="TN-61" name="Sfax"/> - <iso_3166_2_entry - code="TN-43" name="Sidi Bouzid"/> - <iso_3166_2_entry - code="TN-34" name="Siliana"/> - <iso_3166_2_entry - code="TN-51" name="Sousse"/> - <iso_3166_2_entry - code="TN-83" name="Tataouine"/> - <iso_3166_2_entry - code="TN-72" name="Tozeur"/> - <iso_3166_2_entry - code="TN-11" name="Tunis"/> - <iso_3166_2_entry - code="TN-22" name="Zaghouan"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tonga --> - <iso_3166_country code="TO"> - <iso_3166_subset type="Division"> - <iso_3166_2_entry - code="TO-01" name="'Eua"/> - <iso_3166_2_entry - code="TO-02" name="Ha'apai"/> - <iso_3166_2_entry - code="TO-03" name="Niuas"/> - <iso_3166_2_entry - code="TO-04" name="Tongatapu"/> - <iso_3166_2_entry - code="TO-05" name="Vava'u"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Turkey --> - <iso_3166_country code="TR"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="TR-01" name="Adana"/> - <iso_3166_2_entry - code="TR-02" name="Adıyaman"/> - <iso_3166_2_entry - code="TR-03" name="Afyon"/> - <iso_3166_2_entry - code="TR-04" name="Ağrı"/> - <iso_3166_2_entry - code="TR-68" name="Aksaray"/> - <iso_3166_2_entry - code="TR-05" name="Amasya"/> - <iso_3166_2_entry - code="TR-06" name="Ankara"/> - <iso_3166_2_entry - code="TR-07" name="Antalya"/> - <iso_3166_2_entry - code="TR-75" name="Ardahan"/> - <iso_3166_2_entry - code="TR-08" name="Artvin"/> - <iso_3166_2_entry - code="TR-09" name="Aydın"/> - <iso_3166_2_entry - code="TR-10" name="Balıkesir"/> - <iso_3166_2_entry - code="TR-74" name="Bartın"/> - <iso_3166_2_entry - code="TR-72" name="Batman"/> - <iso_3166_2_entry - code="TR-69" name="Bayburt"/> - <iso_3166_2_entry - code="TR-11" name="Bilecik"/> - <iso_3166_2_entry - code="TR-12" name="Bingöl"/> - <iso_3166_2_entry - code="TR-13" name="Bitlis"/> - <iso_3166_2_entry - code="TR-14" name="Bolu"/> - <iso_3166_2_entry - code="TR-15" name="Burdur"/> - <iso_3166_2_entry - code="TR-16" name="Bursa"/> - <iso_3166_2_entry - code="TR-17" name="Çanakkale"/> - <iso_3166_2_entry - code="TR-18" name="Çankırı"/> - <iso_3166_2_entry - code="TR-19" name="Çorum"/> - <iso_3166_2_entry - code="TR-20" name="Denizli"/> - <iso_3166_2_entry - code="TR-21" name="Diyarbakır"/> - <iso_3166_2_entry - code="TR-81" name="Düzce"/> - <iso_3166_2_entry - code="TR-22" name="Edirne"/> - <iso_3166_2_entry - code="TR-23" name="Elazığ"/> - <iso_3166_2_entry - code="TR-24" name="Erzincan"/> - <iso_3166_2_entry - code="TR-25" name="Erzurum"/> - <iso_3166_2_entry - code="TR-26" name="Eskişehir"/> - <iso_3166_2_entry - code="TR-27" name="Gaziantep"/> - <iso_3166_2_entry - code="TR-28" name="Giresun"/> - <iso_3166_2_entry - code="TR-29" name="Gümüşhane"/> - <iso_3166_2_entry - code="TR-30" name="Hakkâri"/> - <iso_3166_2_entry - code="TR-31" name="Hatay"/> - <iso_3166_2_entry - code="TR-76" name="Iğdır"/> - <iso_3166_2_entry - code="TR-32" name="Isparta"/> - <iso_3166_2_entry - code="TR-33" name="İçel"/> - <iso_3166_2_entry - code="TR-34" name="İstanbul"/> - <iso_3166_2_entry - code="TR-35" name="İzmir"/> - <iso_3166_2_entry - code="TR-46" name="Kahramanmaraş"/> - <iso_3166_2_entry - code="TR-78" name="Karabük"/> - <iso_3166_2_entry - code="TR-70" name="Karaman"/> - <iso_3166_2_entry - code="TR-36" name="Kars"/> - <iso_3166_2_entry - code="TR-37" name="Kastamonu"/> - <iso_3166_2_entry - code="TR-38" name="Kayseri"/> - <iso_3166_2_entry - code="TR-71" name="Kırıkkale"/> - <iso_3166_2_entry - code="TR-39" name="Kırklareli"/> - <iso_3166_2_entry - code="TR-40" name="Kırşehir"/> - <iso_3166_2_entry - code="TR-79" name="Kilis"/> - <iso_3166_2_entry - code="TR-41" name="Kocaeli"/> - <iso_3166_2_entry - code="TR-42" name="Konya"/> - <iso_3166_2_entry - code="TR-43" name="Kütahya"/> - <iso_3166_2_entry - code="TR-44" name="Malatya"/> - <iso_3166_2_entry - code="TR-45" name="Manisa"/> - <iso_3166_2_entry - code="TR-47" name="Mardin"/> - <iso_3166_2_entry - code="TR-48" name="Muğla"/> - <iso_3166_2_entry - code="TR-49" name="Muş"/> - <iso_3166_2_entry - code="TR-50" name="Nevşehir"/> - <iso_3166_2_entry - code="TR-51" name="Niğde"/> - <iso_3166_2_entry - code="TR-52" name="Ordu"/> - <iso_3166_2_entry - code="TR-80" name="Osmaniye"/> - <iso_3166_2_entry - code="TR-53" name="Rize"/> - <iso_3166_2_entry - code="TR-54" name="Sakarya"/> - <iso_3166_2_entry - code="TR-55" name="Samsun"/> - <iso_3166_2_entry - code="TR-56" name="Siirt"/> - <iso_3166_2_entry - code="TR-57" name="Sinop"/> - <iso_3166_2_entry - code="TR-58" name="Sivas"/> - <iso_3166_2_entry - code="TR-63" name="Şanlıurfa"/> - <iso_3166_2_entry - code="TR-73" name="Şırnak"/> - <iso_3166_2_entry - code="TR-59" name="Tekirdağ"/> - <iso_3166_2_entry - code="TR-60" name="Tokat"/> - <iso_3166_2_entry - code="TR-61" name="Trabzon"/> - <iso_3166_2_entry - code="TR-62" name="Tunceli"/> - <iso_3166_2_entry - code="TR-64" name="Uşak"/> - <iso_3166_2_entry - code="TR-65" name="Van"/> - <iso_3166_2_entry - code="TR-77" name="Yalova"/> - <iso_3166_2_entry - code="TR-66" name="Yozgat"/> - <iso_3166_2_entry - code="TR-67" name="Zonguldak"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Trinidad and Tobago --> - <iso_3166_country code="TT"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TT-CTT" name="Couva-Tabaquite-Talparo"/> - <iso_3166_2_entry - code="TT-DMN" name="Diego Martin"/> - <iso_3166_2_entry - code="TT-ETO" name="Eastern Tobago"/> - <iso_3166_2_entry - code="TT-PED" name="Penal-Debe"/> - <iso_3166_2_entry - code="TT-PRT" name="Princes Town"/> - <iso_3166_2_entry - code="TT-RCM" name="Rio Claro-Mayaro"/> - <iso_3166_2_entry - code="TT-SGE" name="Sangre Grande"/> - <iso_3166_2_entry - code="TT-SJL" name="San Juan-Laventille"/> - <iso_3166_2_entry - code="TT-SIP" name="Siparia"/> - <iso_3166_2_entry - code="TT-TUP" name="Tunapuna-Piarco"/> - <iso_3166_2_entry - code="TT-WTO" name="Western Tobago"/> - </iso_3166_subset> - <iso_3166_subset type="Borough"> - <iso_3166_2_entry - code="TT-ARI" name="Arima"/> - <iso_3166_2_entry - code="TT-CHA" name="Chaguanas"/> - <iso_3166_2_entry - code="TT-PTF" name="Point Fortin"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="TT-POS" name="Port of Spain"/> - <iso_3166_2_entry - code="TT-SFO" name="San Fernando"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tuvalu --> - <iso_3166_country code="TV"> - <iso_3166_subset type="Town council"> - <iso_3166_2_entry - code="TV-FUN" name="Funafuti"/> - </iso_3166_subset> - <iso_3166_subset type="Island council"> - <iso_3166_2_entry - code="TV-NMG" name="Nanumanga"/> - <iso_3166_2_entry - code="TV-NMA" name="Nanumea"/> - <iso_3166_2_entry - code="TV-NIT" name="Niutao"/> - <iso_3166_2_entry - code="TV-NIU" name="Nui"/> - <iso_3166_2_entry - code="TV-NKF" name="Nukufetau"/> - <iso_3166_2_entry - code="TV-NKL" name="Nukulaelae"/> - <iso_3166_2_entry - code="TV-VAI" name="Vaitupu"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Taiwan --> - <iso_3166_country code="TW"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="TW-CHA" name="Changhua"/> - <iso_3166_2_entry - code="TW-CYQ" name="Chiayi"/> - <iso_3166_2_entry - code="TW-HSQ" name="Hsinchu"/> - <iso_3166_2_entry - code="TW-HUA" name="Hualien"/> - <iso_3166_2_entry - code="TW-ILA" name="Ilan"/> - <iso_3166_2_entry - code="TW-KHQ" name="Kaohsiung"/> - <iso_3166_2_entry - code="TW-MIA" name="Miaoli"/> - <iso_3166_2_entry - code="TW-NAN" name="Nantou"/> - <iso_3166_2_entry - code="TW-PEN" name="Penghu"/> - <iso_3166_2_entry - code="TW-PIF" name="Pingtung"/> - <iso_3166_2_entry - code="TW-TXQ" name="Taichung"/> - <iso_3166_2_entry - code="TW-TNQ" name="Tainan"/> - <iso_3166_2_entry - code="TW-TPQ" name="Taipei"/> - <iso_3166_2_entry - code="TW-TTT" name="Taitung"/> - <iso_3166_2_entry - code="TW-TAO" name="Taoyuan"/> - <iso_3166_2_entry - code="TW-YUN" name="Yunlin"/> - </iso_3166_subset> - <iso_3166_subset type="Municipality"> - <iso_3166_2_entry - code="TW-CYI" name="Chiay City"/> - <iso_3166_2_entry - code="TW-HSZ" name="Hsinchui City"/> - <iso_3166_2_entry - code="TW-KEE" name="Keelung City"/> - <iso_3166_2_entry - code="TW-TXG" name="Taichung City"/> - <iso_3166_2_entry - code="TW-TNN" name="Tainan City"/> - </iso_3166_subset> - <iso_3166_subset type="Special Municipality"> - <iso_3166_2_entry - code="TW-KHH" name="Kaohsiung City"/> - <iso_3166_2_entry - code="TW-TPE" name="Taipei City"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Tanzania --> - <iso_3166_country code="TZ"> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="TZ-01" name="Arusha"/> - <iso_3166_2_entry - code="TZ-02" name="Dar-es-Salaam"/> - <iso_3166_2_entry - code="TZ-03" name="Dodoma"/> - <iso_3166_2_entry - code="TZ-04" name="Iringa"/> - <iso_3166_2_entry - code="TZ-05" name="Kagera"/> - <iso_3166_2_entry - code="TZ-06" name="Kaskazini Pemba"/> - <iso_3166_2_entry - code="TZ-07" name="Kaskazini Unguja"/> - <iso_3166_2_entry - code="TZ-08" name="Kigoma"/> - <iso_3166_2_entry - code="TZ-09" name="Kilimanjaro"/> - <iso_3166_2_entry - code="TZ-10" name="Kusini Pemba"/> - <iso_3166_2_entry - code="TZ-11" name="Kusini Unguja"/> - <iso_3166_2_entry - code="TZ-12" name="Lindi"/> - <iso_3166_2_entry - code="TZ-26" name="Manyara"/> - <iso_3166_2_entry - code="TZ-13" name="Mara"/> - <iso_3166_2_entry - code="TZ-14" name="Mbeya"/> - <iso_3166_2_entry - code="TZ-15" name="Mjini Magharibi"/> - <iso_3166_2_entry - code="TZ-16" name="Morogoro"/> - <iso_3166_2_entry - code="TZ-17" name="Mtwara"/> - <iso_3166_2_entry - code="TZ-18" name="Mwanza"/> - <iso_3166_2_entry - code="TZ-19" name="Pwani"/> - <iso_3166_2_entry - code="TZ-20" name="Rukwa"/> - <iso_3166_2_entry - code="TZ-21" name="Ruvuma"/> - <iso_3166_2_entry - code="TZ-22" name="Shinyanga"/> - <iso_3166_2_entry - code="TZ-23" name="Singida"/> - <iso_3166_2_entry - code="TZ-24" name="Tabora"/> - <iso_3166_2_entry - code="TZ-25" name="Tanga"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Ukraine --> - <iso_3166_country code="UA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="UA-71" name="Cherkas'ka Oblast'"/> - <iso_3166_2_entry - code="UA-74" name="Chernihivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-77" name="Chernivets'ka Oblast'"/> - <iso_3166_2_entry - code="UA-12" name="Dnipropetrovs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-14" name="Donets'ka Oblast'"/> - <iso_3166_2_entry - code="UA-26" name="Ivano-Frankivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-63" name="Kharkivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-65" name="Khersons'ka Oblast'"/> - <iso_3166_2_entry - code="UA-68" name="Khmel'nyts'ka Oblast'"/> - <iso_3166_2_entry - code="UA-35" name="Kirovohrads'ka Oblast'"/> - <iso_3166_2_entry - code="UA-32" name="Kyïvs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-09" name="Luhans'ka Oblast'"/> - <iso_3166_2_entry - code="UA-46" name="L'vivs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-48" name="Mykolaïvs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-51" name="Odes'ka Oblast'"/> - <iso_3166_2_entry - code="UA-53" name="Poltavs'ka Oblast'"/> - <iso_3166_2_entry - code="UA-56" name="Rivnens'ka Oblast'"/> - <iso_3166_2_entry - code="UA-59" name="Sums 'ka Oblast'"/> - <iso_3166_2_entry - code="UA-61" name="Ternopil's'ka Oblast'"/> - <iso_3166_2_entry - code="UA-05" name="Vinnyts'ka Oblast'"/> - <iso_3166_2_entry - code="UA-07" name="Volyns'ka Oblast'"/> - <iso_3166_2_entry - code="UA-21" name="Zakarpats'ka Oblast'"/> - <iso_3166_2_entry - code="UA-23" name="Zaporiz'ka Oblast'"/> - <iso_3166_2_entry - code="UA-18" name="Zhytomyrs'ka Oblast'"/> - </iso_3166_subset> - <iso_3166_subset type="Autonomous republic"> - <iso_3166_2_entry - code="UA-43" name="Respublika Krym"/> - </iso_3166_subset> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="UA-30" name="Kyïvs'ka mis'ka rada"/> - <iso_3166_2_entry - code="UA-40" name="Sevastopol"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Uganda --> - <iso_3166_country code="UG"> - <iso_3166_subset type="Geographical region"> - <iso_3166_2_entry - code="UG-C" name="Central"/> - <iso_3166_2_entry - code="UG-E" name="Eastern"/> - <iso_3166_2_entry - code="UG-N" name="Northern"/> - <iso_3166_2_entry - code="UG-W" name="Western"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="UG-317" name="Abim" parent="N"/> - <iso_3166_2_entry - code="UG-301" name="Adjumani" parent="N"/> - <iso_3166_2_entry - code="UG-314" name="Amolatar" parent="N"/> - <iso_3166_2_entry - code="UG-216" name="Amuria" parent="E"/> - <iso_3166_2_entry - code="UG-319" name="Amuru" parent="N"/> - <iso_3166_2_entry - code="UG-302" name="Apac" parent="N"/> - <iso_3166_2_entry - code="UG-303" name="Arua" parent="N"/> - <iso_3166_2_entry - code="UG-217" name="Budaka" parent="E"/> - <iso_3166_2_entry - code="UG-223" name="Bududa" parent="E"/> - <iso_3166_2_entry - code="UG-201" name="Bugiri" parent="E"/> - <iso_3166_2_entry - code="UG-224" name="Bukedea" parent="E"/> - <iso_3166_2_entry - code="UG-218" name="Bukwa" parent="E"/> - <iso_3166_2_entry - code="UG-419" name="Buliisa" parent="W"/> - <iso_3166_2_entry - code="UG-401" name="Bundibugyo" parent="W"/> - <iso_3166_2_entry - code="UG-402" name="Bushenyi" parent="W"/> - <iso_3166_2_entry - code="UG-202" name="Busia" parent="E"/> - <iso_3166_2_entry - code="UG-219" name="Butaleja" parent="E"/> - <iso_3166_2_entry - code="UG-318" name="Dokolo" parent="N"/> - <iso_3166_2_entry - code="UG-304" name="Gulu" parent="N"/> - <iso_3166_2_entry - code="UG-403" name="Hoima" parent="W"/> - <iso_3166_2_entry - code="UG-416" name="Ibanda" parent="W"/> - <iso_3166_2_entry - code="UG-203" name="Iganga" parent="E"/> - <iso_3166_2_entry - code="UG-417" name="Isingiro" parent="W"/> - <iso_3166_2_entry - code="UG-204" name="Jinja" parent="E"/> - <iso_3166_2_entry - code="UG-315" name="Kaabong" parent="N"/> - <iso_3166_2_entry - code="UG-404" name="Kabale" parent="W"/> - <iso_3166_2_entry - code="UG-405" name="Kabarole" parent="W"/> - <iso_3166_2_entry - code="UG-213" name="Kaberamaido" parent="E"/> - <iso_3166_2_entry - code="UG-101" name="Kalangala" parent="C"/> - <iso_3166_2_entry - code="UG-220" name="Kaliro" parent="E"/> - <iso_3166_2_entry - code="UG-102" name="Kampala" parent="C"/> - <iso_3166_2_entry - code="UG-205" name="Kamuli" parent="E"/> - <iso_3166_2_entry - code="UG-413" name="Kamwenge" parent="W"/> - <iso_3166_2_entry - code="UG-414" name="Kanungu" parent="W"/> - <iso_3166_2_entry - code="UG-206" name="Kapchorwa" parent="E"/> - <iso_3166_2_entry - code="UG-406" name="Kasese" parent="W"/> - <iso_3166_2_entry - code="UG-207" name="Katakwi" parent="E"/> - <iso_3166_2_entry - code="UG-112" name="Kayunga" parent="C"/> - <iso_3166_2_entry - code="UG-407" name="Kibaale" parent="W"/> - <iso_3166_2_entry - code="UG-103" name="Kiboga" parent="C"/> - <iso_3166_2_entry - code="UG-418" name="Kiruhura" parent="W"/> - <iso_3166_2_entry - code="UG-408" name="Kisoro" parent="W"/> - <iso_3166_2_entry - code="UG-305" name="Kitgum" parent="N"/> - <iso_3166_2_entry - code="UG-316" name="Koboko" parent="N"/> - <iso_3166_2_entry - code="UG-306" name="Kotido" parent="N"/> - <iso_3166_2_entry - code="UG-208" name="Kumi" parent="E"/> - <iso_3166_2_entry - code="UG-415" name="Kyenjojo" parent="W"/> - <iso_3166_2_entry - code="UG-307" name="Lira" parent="N"/> - <iso_3166_2_entry - code="UG-104" name="Luwero" parent="C"/> - <iso_3166_2_entry - code="UG-116" name="Lyantonde" parent="C"/> - <iso_3166_2_entry - code="UG-221" name="Manafwa" parent="E"/> - <iso_3166_2_entry - code="UG-320" name="Maracha" parent="N"/> - <iso_3166_2_entry - code="UG-105" name="Masaka" parent="C"/> - <iso_3166_2_entry - code="UG-409" name="Masindi" parent="W"/> - <iso_3166_2_entry - code="UG-214" name="Mayuge" parent="E"/> - <iso_3166_2_entry - code="UG-209" name="Mbale" parent="E"/> - <iso_3166_2_entry - code="UG-410" name="Mbarara" parent="W"/> - <iso_3166_2_entry - code="UG-114" name="Mityana" parent="C"/> - <iso_3166_2_entry - code="UG-308" name="Moroto" parent="N"/> - <iso_3166_2_entry - code="UG-309" name="Moyo" parent="N"/> - <iso_3166_2_entry - code="UG-106" name="Mpigi" parent="C"/> - <iso_3166_2_entry - code="UG-107" name="Mubende" parent="C"/> - <iso_3166_2_entry - code="UG-108" name="Mukono" parent="C"/> - <iso_3166_2_entry - code="UG-311" name="Nakapiripirit" parent="N"/> - <iso_3166_2_entry - code="UG-115" name="Nakaseke" parent="C"/> - <iso_3166_2_entry - code="UG-109" name="Nakasongola" parent="C"/> - <iso_3166_2_entry - code="UG-222" name="Namutumba" parent="E"/> - <iso_3166_2_entry - code="UG-310" name="Nebbi" parent="N"/> - <iso_3166_2_entry - code="UG-411" name="Ntungamo" parent="W"/> - <iso_3166_2_entry - code="UG-321" name="Oyam" parent="N"/> - <iso_3166_2_entry - code="UG-312" name="Pader" parent="N"/> - <iso_3166_2_entry - code="UG-210" name="Pallisa" parent="E"/> - <iso_3166_2_entry - code="UG-110" name="Rakai" parent="C"/> - <iso_3166_2_entry - code="UG-412" name="Rukungiri" parent="W"/> - <iso_3166_2_entry - code="UG-111" name="Sembabule" parent="C"/> - <iso_3166_2_entry - code="UG-215" name="Sironko" parent="E"/> - <iso_3166_2_entry - code="UG-211" name="Soroti" parent="E"/> - <iso_3166_2_entry - code="UG-212" name="Tororo" parent="E"/> - <iso_3166_2_entry - code="UG-113" name="Wakiso" parent="C"/> - <iso_3166_2_entry - code="UG-313" name="Yumbe" parent="N"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United States Minor Outlying Islands --> - <iso_3166_country code="UM"> - <iso_3166_subset type="Territory"> - <iso_3166_2_entry - code="UM-81" name="Baker Island"/> - <iso_3166_2_entry - code="UM-84" name="Howland Island"/> - <iso_3166_2_entry - code="UM-86" name="Jarvis Island"/> - <iso_3166_2_entry - code="UM-67" name="Johnston Atoll"/> - <iso_3166_2_entry - code="UM-89" name="Kingman Reef"/> - <iso_3166_2_entry - code="UM-71" name="Midway Islands"/> - <iso_3166_2_entry - code="UM-76" name="Navassa Island"/> - <iso_3166_2_entry - code="UM-95" name="Palmyra Atoll"/> - <iso_3166_2_entry - code="UM-79" name="Wake Island"/> - </iso_3166_subset> - </iso_3166_country> - <!-- United States --> - <iso_3166_country code="US"> - <iso_3166_subset type="State"> - <!-- US ISO 3166-2 system (from one example) appears to be based on USPS State --> - <!-- and territory codes, which follow: --> - <!-- Note US-UM: Outlying Islands have their own subregion in 'UM' --> - <iso_3166_2_entry - code="US-AL" name="Alabama"/> - <iso_3166_2_entry - code="US-AK" name="Alaska"/> - <iso_3166_2_entry - code="US-AZ" name="Arizona"/> - <iso_3166_2_entry - code="US-AR" name="Arkansas"/> - <iso_3166_2_entry - code="US-CA" name="California"/> - <iso_3166_2_entry - code="US-CO" name="Colorado"/> - <iso_3166_2_entry - code="US-CT" name="Connecticut"/> - <iso_3166_2_entry - code="US-DE" name="Delaware"/> - <iso_3166_2_entry - code="US-FL" name="Florida"/> - <iso_3166_2_entry - code="US-GA" name="Georgia"/> - <iso_3166_2_entry - code="US-HI" name="Hawaii"/> - <iso_3166_2_entry - code="US-ID" name="Idaho"/> - <iso_3166_2_entry - code="US-IL" name="Illinois"/> - <iso_3166_2_entry - code="US-IN" name="Indiana"/> - <iso_3166_2_entry - code="US-IA" name="Iowa"/> - <iso_3166_2_entry - code="US-KS" name="Kansas"/> - <iso_3166_2_entry - code="US-KY" name="Kentucky"/> - <iso_3166_2_entry - code="US-LA" name="Louisiana"/> - <iso_3166_2_entry - code="US-ME" name="Maine"/> - <iso_3166_2_entry - code="US-MD" name="Maryland"/> - <iso_3166_2_entry - code="US-MA" name="Massachusetts"/> - <iso_3166_2_entry - code="US-MI" name="Michigan"/> - <iso_3166_2_entry - code="US-MN" name="Minnesota"/> - <iso_3166_2_entry - code="US-MS" name="Mississippi"/> - <iso_3166_2_entry - code="US-MO" name="Missouri"/> - <iso_3166_2_entry - code="US-MT" name="Montana"/> - <iso_3166_2_entry - code="US-NE" name="Nebraska"/> - <iso_3166_2_entry - code="US-NV" name="Nevada"/> - <iso_3166_2_entry - code="US-NH" name="New Hampshire"/> - <iso_3166_2_entry - code="US-NJ" name="New Jersey"/> - <iso_3166_2_entry - code="US-NM" name="New Mexico"/> - <iso_3166_2_entry - code="US-NY" name="New York"/> - <iso_3166_2_entry - code="US-NC" name="North Carolina"/> - <iso_3166_2_entry - code="US-ND" name="North Dakota"/> - <iso_3166_2_entry - code="US-OH" name="Ohio"/> - <iso_3166_2_entry - code="US-OK" name="Oklahoma"/> - <iso_3166_2_entry - code="US-OR" name="Oregon"/> - <iso_3166_2_entry - code="US-PA" name="Pennsylvania"/> - <iso_3166_2_entry - code="US-RI" name="Rhode Island"/> - <iso_3166_2_entry - code="US-SC" name="South Carolina"/> - <iso_3166_2_entry - code="US-SD" name="South Dakota"/> - <iso_3166_2_entry - code="US-TN" name="Tennessee"/> - <iso_3166_2_entry - code="US-TX" name="Texas"/> - <iso_3166_2_entry - code="US-UT" name="Utah"/> - <iso_3166_2_entry - code="US-VT" name="Vermont"/> - <iso_3166_2_entry - code="US-VA" name="Virginia"/> - <iso_3166_2_entry - code="US-WA" name="Washington"/> - <iso_3166_2_entry - code="US-WV" name="West Virginia"/> - <iso_3166_2_entry - code="US-WI" name="Wisconsin"/> - <iso_3166_2_entry - code="US-WY" name="Wyoming"/> - </iso_3166_subset> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="US-DC" name="District of Columbia"/> - </iso_3166_subset> - <iso_3166_subset type="Outlying area"> - <iso_3166_2_entry - code="US-AS" name="American Samoa"/> - <iso_3166_2_entry - code="US-GU" name="Guam"/> - <iso_3166_2_entry - code="US-MP" name="Northern Mariana Islands"/> - <iso_3166_2_entry - code="US-PR" name="Puerto Rico"/> - <iso_3166_2_entry - code="US-UM" name="United States Minor Outlying Islands"/> - <iso_3166_2_entry - code="US-VI" name="Virgin Islands"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Uruguay --> - <iso_3166_country code="UY"> - <iso_3166_subset type="Department"> - <iso_3166_2_entry - code="UY-AR" name="Artigas"/> - <iso_3166_2_entry - code="UY-CA" name="Canelones"/> - <iso_3166_2_entry - code="UY-CL" name="Cerro Largo"/> - <iso_3166_2_entry - code="UY-CO" name="Colonia"/> - <iso_3166_2_entry - code="UY-DU" name="Durazno"/> - <iso_3166_2_entry - code="UY-FS" name="Flores"/> - <iso_3166_2_entry - code="UY-FD" name="Florida"/> - <iso_3166_2_entry - code="UY-LA" name="Lavalleja"/> - <iso_3166_2_entry - code="UY-MA" name="Maldonado"/> - <iso_3166_2_entry - code="UY-MO" name="Montevideo"/> - <iso_3166_2_entry - code="UY-PA" name="Paysandú"/> - <iso_3166_2_entry - code="UY-RN" name="Río Negro"/> - <iso_3166_2_entry - code="UY-RV" name="Rivera"/> - <iso_3166_2_entry - code="UY-RO" name="Rocha"/> - <iso_3166_2_entry - code="UY-SA" name="Salto"/> - <iso_3166_2_entry - code="UY-SJ" name="San José"/> - <iso_3166_2_entry - code="UY-SO" name="Soriano"/> - <iso_3166_2_entry - code="UY-TA" name="Tacuarembó"/> - <iso_3166_2_entry - code="UY-TT" name="Treinta y Tres"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Uzbekistan --> - <iso_3166_country code="UZ"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="UZ-TK" name="Toshkent"/> - </iso_3166_subset> - <iso_3166_subset type="Region"> - <iso_3166_2_entry - code="UZ-AN" name="Andijon"/> - <iso_3166_2_entry - code="UZ-BU" name="Buxoro"/> - <iso_3166_2_entry - code="UZ-FA" name="Farg'ona"/> - <iso_3166_2_entry - code="UZ-JI" name="Jizzax"/> - <iso_3166_2_entry - code="UZ-NG" name="Namangan"/> - <iso_3166_2_entry - code="UZ-NW" name="Navoiy"/> - <iso_3166_2_entry - code="UZ-QA" name="Qashqadaryo"/> - <iso_3166_2_entry - code="UZ-SA" name="Samarqand"/> - <iso_3166_2_entry - code="UZ-SI" name="Sirdaryo"/> - <iso_3166_2_entry - code="UZ-SU" name="Surxondaryo"/> - <iso_3166_2_entry - code="UZ-TO" name="Toshkent"/> - <iso_3166_2_entry - code="UZ-XO" name="Xorazm"/> - </iso_3166_subset> - <iso_3166_subset type="Republic"> - <iso_3166_2_entry - code="UZ-QR" name="Qoraqalpog'iston Respublikasi"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Saint Vincent and the Grenadines --> - <iso_3166_country code="VC"> - <iso_3166_subset type="Parish"> - <iso_3166_2_entry - code="VC-01" name="Charlotte"/> - <iso_3166_2_entry - code="VC-06" name="Grenadines"/> - <iso_3166_2_entry - code="VC-02" name="Saint Andrew"/> - <iso_3166_2_entry - code="VC-03" name="Saint David"/> - <iso_3166_2_entry - code="VC-04" name="Saint George"/> - <iso_3166_2_entry - code="VC-05" name="Saint Patrick"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Venezuela --> - <iso_3166_country code="VE"> - <iso_3166_subset type="Federal Dependency"> - <iso_3166_2_entry - code="VE-W" name="Dependencias Federales"/> - </iso_3166_subset> - <iso_3166_subset type="Federal District"> - <iso_3166_2_entry - code="VE-A" name="Distrito Federal"/> - </iso_3166_subset> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="VE-Z" name="Amazonas"/> - <iso_3166_2_entry - code="VE-B" name="Anzoátegui"/> - <iso_3166_2_entry - code="VE-C" name="Apure"/> - <iso_3166_2_entry - code="VE-D" name="Aragua"/> - <iso_3166_2_entry - code="VE-E" name="Barinas"/> - <iso_3166_2_entry - code="VE-F" name="Bolívar"/> - <iso_3166_2_entry - code="VE-G" name="Carabobo"/> - <iso_3166_2_entry - code="VE-H" name="Cojedes"/> - <iso_3166_2_entry - code="VE-Y" name="Delta Amacuro"/> - <iso_3166_2_entry - code="VE-I" name="Falcón"/> - <iso_3166_2_entry - code="VE-J" name="Guárico"/> - <iso_3166_2_entry - code="VE-K" name="Lara"/> - <iso_3166_2_entry - code="VE-L" name="Mérida"/> - <iso_3166_2_entry - code="VE-M" name="Miranda"/> - <iso_3166_2_entry - code="VE-N" name="Monagas"/> - <iso_3166_2_entry - code="VE-O" name="Nueva Esparta"/> - <iso_3166_2_entry - code="VE-P" name="Portuguesa"/> - <iso_3166_2_entry - code="VE-R" name="Sucre"/> - <iso_3166_2_entry - code="VE-S" name="Táchira"/> - <iso_3166_2_entry - code="VE-T" name="Trujillo"/> - <iso_3166_2_entry - code="VE-X" name="Vargas"/> - <iso_3166_2_entry - code="VE-U" name="Yaracuy"/> - <iso_3166_2_entry - code="VE-V" name="Zulia"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Viet Nam --> - <iso_3166_country code="VN"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="VN-44" name="An Giang"/> - <iso_3166_2_entry - code="VN-43" name="Bà Rịa - Vũng Tàu"/> - <iso_3166_2_entry - code="VN-53" name="Bắc Kạn"/> - <iso_3166_2_entry - code="VN-54" name="Bắc Giang"/> - <iso_3166_2_entry - code="VN-55" name="Bạc Liêu"/> - <iso_3166_2_entry - code="VN-56" name="Bắc Ninh"/> - <iso_3166_2_entry - code="VN-50" name="Bến Tre"/> - <iso_3166_2_entry - code="VN-31" name="Bình Định"/> - <iso_3166_2_entry - code="VN-57" name="Bình Dương"/> - <iso_3166_2_entry - code="VN-58" name="Bình Phước"/> - <iso_3166_2_entry - code="VN-40" name="Bình Thuận"/> - <iso_3166_2_entry - code="VN-59" name="Cà Mau"/> - <iso_3166_2_entry - code="VN-48" name="Cần Thơ"/> - <iso_3166_2_entry - code="VN-04" name="Cao Bằng"/> - <iso_3166_2_entry - code="VN-60" name="Đà Nẵng, thành phố"/> - <iso_3166_2_entry - code="VN-33" name="Đắc Lắk"/> - <iso_3166_2_entry - code="VN-72" name="Đắk Nông"/> - <iso_3166_2_entry - code="VN-71" name="Điện Biên"/> - <iso_3166_2_entry - code="VN-39" name="Đồng Nai"/> - <iso_3166_2_entry - code="VN-45" name="Đồng Tháp"/> - <iso_3166_2_entry - code="VN-30" name="Gia Lai"/> - <iso_3166_2_entry - code="VN-03" name="Hà Giang"/> - <iso_3166_2_entry - code="VN-63" name="Hà Nam"/> - <iso_3166_2_entry - code="VN-64" name="Hà Nội, thủ đô"/> - <iso_3166_2_entry - code="VN-15" name="Hà Tây"/> - <iso_3166_2_entry - code="VN-23" name="Hà Tỉnh"/> - <iso_3166_2_entry - code="VN-61" name="Hải Duong"/> - <iso_3166_2_entry - code="VN-62" name="Hải Phòng, thành phố"/> - <iso_3166_2_entry - code="VN-73" name="Hậu Giang"/> - <iso_3166_2_entry - code="VN-14" name="Hoà Bình"/> - <iso_3166_2_entry - code="VN-65" name="Hồ Chí Minh, thành phố [Sài Gòn]"/> - <iso_3166_2_entry - code="VN-66" name="Hưng Yên"/> - <iso_3166_2_entry - code="VN-34" name="Khánh Hòa"/> - <iso_3166_2_entry - code="VN-47" name="Kiên Giang"/> - <iso_3166_2_entry - code="VN-28" name="Kon Tum"/> - <iso_3166_2_entry - code="VN-01" name="Lai Châu"/> - <iso_3166_2_entry - code="VN-35" name="Lâm Đồng"/> - <iso_3166_2_entry - code="VN-09" name="Lạng Sơn"/> - <iso_3166_2_entry - code="VN-02" name="Lào Cai"/> - <iso_3166_2_entry - code="VN-41" name="Long An"/> - <iso_3166_2_entry - code="VN-67" name="Nam Định"/> - <iso_3166_2_entry - code="VN-22" name="Nghệ An"/> - <iso_3166_2_entry - code="VN-18" name="Ninh Bình"/> - <iso_3166_2_entry - code="VN-36" name="Ninh Thuận"/> - <iso_3166_2_entry - code="VN-68" name="Phú Thọ"/> - <iso_3166_2_entry - code="VN-32" name="Phú Yên"/> - <iso_3166_2_entry - code="VN-24" name="Quảng Bình"/> - <iso_3166_2_entry - code="VN-27" name="Quảng Nam"/> - <iso_3166_2_entry - code="VN-29" name="Quảng Ngãi"/> - <iso_3166_2_entry - code="VN-13" name="Quảng Ninh"/> - <iso_3166_2_entry - code="VN-25" name="Quảng Trị"/> - <iso_3166_2_entry - code="VN-52" name="Sóc Trăng"/> - <iso_3166_2_entry - code="VN-05" name="Sơn La"/> - <iso_3166_2_entry - code="VN-37" name="Tây Ninh"/> - <iso_3166_2_entry - code="VN-20" name="Thái Bình"/> - <iso_3166_2_entry - code="VN-69" name="Thái Nguyên"/> - <iso_3166_2_entry - code="VN-21" name="Thanh Hóa"/> - <iso_3166_2_entry - code="VN-26" name="Thừa Thiên-Huế"/> - <iso_3166_2_entry - code="VN-46" name="Tiền Giang"/> - <iso_3166_2_entry - code="VN-51" name="Trà Vinh"/> - <iso_3166_2_entry - code="VN-07" name="Tuyên Quang"/> - <iso_3166_2_entry - code="VN-49" name="Vĩnh Long"/> - <iso_3166_2_entry - code="VN-70" name="Vĩnh Phúc"/> - <iso_3166_2_entry - code="VN-06" name="Yên Bái"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Vanuatu --> - <iso_3166_country code="VU"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="VU-MAP" name="Malampa"/> - <iso_3166_2_entry - code="VU-PAM" name="Pénama"/> - <iso_3166_2_entry - code="VU-SAM" name="Sanma"/> - <iso_3166_2_entry - code="VU-SEE" name="Shéfa"/> - <iso_3166_2_entry - code="VU-TAE" name="Taféa"/> - <iso_3166_2_entry - code="VU-TOB" name="Torba"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Samoa --> - <iso_3166_country code="WS"> - <iso_3166_subset type="District"> - <iso_3166_2_entry - code="WS-AA" name="A'ana"/> - <iso_3166_2_entry - code="WS-AL" name="Aiga-i-le-Tai"/> - <iso_3166_2_entry - code="WS-AT" name="Atua"/> - <iso_3166_2_entry - code="WS-FA" name="Fa'asaleleaga"/> - <iso_3166_2_entry - code="WS-GE" name="Gaga'emauga"/> - <iso_3166_2_entry - code="WS-GI" name="Gagaifomauga"/> - <iso_3166_2_entry - code="WS-PA" name="Palauli"/> - <iso_3166_2_entry - code="WS-SA" name="Satupa'itea"/> - <iso_3166_2_entry - code="WS-TU" name="Tuamasaga"/> - <iso_3166_2_entry - code="WS-VF" name="Va'a-o-Fonoti"/> - <iso_3166_2_entry - code="WS-VS" name="Vaisigano"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Yemen --> - <iso_3166_country code="YE"> - <iso_3166_subset type="Governorate"> - <iso_3166_2_entry - code="YE-AB" name="Abyān"/> - <iso_3166_2_entry - code="YE-AD" name="'Adan"/> - <iso_3166_2_entry - code="YE-DA" name="Aḑ Ḑāli‘"/> - <iso_3166_2_entry - code="YE-BA" name="Al Bayḑā'"/> - <iso_3166_2_entry - code="YE-MU" name="Al Ḩudaydah"/> - <iso_3166_2_entry - code="YE-JA" name="Al Jawf"/> - <iso_3166_2_entry - code="YE-MR" name="Al Mahrah"/> - <iso_3166_2_entry - code="YE-MW" name="Al Maḩwīt"/> - <iso_3166_2_entry - code="YE-AM" name="'Amrān"/> - <iso_3166_2_entry - code="YE-DH" name="Dhamār"/> - <iso_3166_2_entry - code="YE-HD" name="Ḩaḑramawt"/> - <iso_3166_2_entry - code="YE-HJ" name="Ḩajjah"/> - <iso_3166_2_entry - code="YE-IB" name="Ibb"/> - <iso_3166_2_entry - code="YE-LA" name="Laḩij"/> - <iso_3166_2_entry - code="YE-MA" name="Ma'rib"/> - <iso_3166_2_entry - code="YE-RA" name="Raymah"/> - <iso_3166_2_entry - code="YE-SD" name="Şa'dah"/> - <iso_3166_2_entry - code="YE-SN" name="Şan'ā'"/> - <iso_3166_2_entry - code="YE-SH" name="Shabwah"/> - <iso_3166_2_entry - code="YE-TA" name="Tā'izz"/> - </iso_3166_subset> - </iso_3166_country> - <!-- South Africa --> - <iso_3166_country code="ZA"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ZA-EC" name="Eastern Cape"/> - <iso_3166_2_entry - code="ZA-FS" name="Free State"/> - <iso_3166_2_entry - code="ZA-GT" name="Gauteng"/> - <iso_3166_2_entry - code="ZA-NL" name="Kwazulu-Natal"/> - <iso_3166_2_entry - code="ZA-LP" name="Limpopo"/> - <iso_3166_2_entry - code="ZA-MP" name="Mpumalanga"/> - <iso_3166_2_entry - code="ZA-NC" name="Northern Cape"/> - <iso_3166_2_entry - code="ZA-NW" name="North-West (South Africa)"/> - <iso_3166_2_entry - code="ZA-WC" name="Western Cape"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Zambia --> - <iso_3166_country code="ZM"> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ZM-02" name="Central"/> - <iso_3166_2_entry - code="ZM-08" name="Copperbelt"/> - <iso_3166_2_entry - code="ZM-03" name="Eastern"/> - <iso_3166_2_entry - code="ZM-04" name="Luapula"/> - <iso_3166_2_entry - code="ZM-09" name="Lusaka"/> - <iso_3166_2_entry - code="ZM-05" name="Northern"/> - <iso_3166_2_entry - code="ZM-06" name="North-Western"/> - <iso_3166_2_entry - code="ZM-07" name="Southern (Zambia)"/> - <iso_3166_2_entry - code="ZM-01" name="Western"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Zimbabwe --> - <iso_3166_country code="ZW"> - <iso_3166_subset type="City"> - <iso_3166_2_entry - code="ZW-BU" name="Bulawayo"/> - <iso_3166_2_entry - code="ZW-HA" name="Harare"/> - </iso_3166_subset> - <iso_3166_subset type="Province"> - <iso_3166_2_entry - code="ZW-MA" name="Manicaland"/> - <iso_3166_2_entry - code="ZW-MC" name="Mashonaland Central"/> - <iso_3166_2_entry - code="ZW-ME" name="Mashonaland East"/> - <iso_3166_2_entry - code="ZW-MW" name="Mashonaland West"/> - <iso_3166_2_entry - code="ZW-MV" name="Masvingo"/> - <iso_3166_2_entry - code="ZW-MN" name="Matabeleland North"/> - <iso_3166_2_entry - code="ZW-MS" name="Matabeleland South"/> - <iso_3166_2_entry - code="ZW-MI" name="Midlands"/> - </iso_3166_subset> - </iso_3166_country> + <!-- Andorra --> + <iso_3166_country code="AD"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="AD-07" name="Andorra la Vella"/> + <iso_3166_2_entry + code="AD-02" name="Canillo"/> + <iso_3166_2_entry + code="AD-03" name="Encamp"/> + <iso_3166_2_entry + code="AD-08" name="Escaldes-Engordany"/> + <iso_3166_2_entry + code="AD-04" name="La Massana"/> + <iso_3166_2_entry + code="AD-05" name="Ordino"/> + <iso_3166_2_entry + code="AD-06" name="Sant Julià de Lòria"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United Arab Emirates --> + <iso_3166_country code="AE"> + <iso_3166_subset type="Emirate"> + <iso_3166_2_entry + code="AE-AZ" name="Abū Ȥaby [Abu Dhabi]"/> + <iso_3166_2_entry + code="AE-AJ" name="'Ajmān"/> + <iso_3166_2_entry + code="AE-FU" name="Al Fujayrah"/> + <iso_3166_2_entry + code="AE-SH" name="Ash Shāriqah"/> + <iso_3166_2_entry + code="AE-DU" name="Dubayy"/> + <iso_3166_2_entry + code="AE-RK" name="Ra’s al Khaymah"/> + <iso_3166_2_entry + code="AE-UQ" name="Umm al Qaywayn"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Afghanistan --> + <iso_3166_country code="AF"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AF-BDS" name="Badakhshān"/> + <iso_3166_2_entry + code="AF-BDG" name="Bādghīs"/> + <iso_3166_2_entry + code="AF-BGL" name="Baghlān"/> + <iso_3166_2_entry + code="AF-BAL" name="Balkh"/> + <iso_3166_2_entry + code="AF-BAM" name="Bāmīān"/> + <iso_3166_2_entry + code="AF-DAY" name="Dāykondī"/> + <iso_3166_2_entry + code="AF-FRA" name="Farāh"/> + <iso_3166_2_entry + code="AF-FYB" name="Fāryāb"/> + <iso_3166_2_entry + code="AF-GHA" name="Ghaznī"/> + <iso_3166_2_entry + code="AF-GHO" name="Ghowr"/> + <iso_3166_2_entry + code="AF-HEL" name="Helmand"/> + <iso_3166_2_entry + code="AF-HER" name="Herāt"/> + <iso_3166_2_entry + code="AF-JOW" name="Jowzjān"/> + <iso_3166_2_entry + code="AF-KAB" name="Kābul [Kābol]"/> + <iso_3166_2_entry + code="AF-KAN" name="Kandahār"/> + <iso_3166_2_entry + code="AF-KAP" name="Kāpīsā"/> + <iso_3166_2_entry + code="AF-KHO" name="Khowst"/> + <iso_3166_2_entry + code="AF-KNR" name="Konar [Kunar]"/> + <iso_3166_2_entry + code="AF-KDZ" name="Kondoz [Kunduz]"/> + <iso_3166_2_entry + code="AF-LAG" name="Laghmān"/> + <iso_3166_2_entry + code="AF-LOW" name="Lowgar"/> + <iso_3166_2_entry + code="AF-NAN" name="Nangrahār [Nangarhār]"/> + <iso_3166_2_entry + code="AF-NIM" name="Nīmrūz"/> + <iso_3166_2_entry + code="AF-NUR" name="Nūrestān"/> + <iso_3166_2_entry + code="AF-ORU" name="Orūzgān [Urūzgān]"/> + <iso_3166_2_entry + code="AF-PAN" name="Panjshīr"/> + <iso_3166_2_entry + code="AF-PIA" name="Paktīā"/> + <iso_3166_2_entry + code="AF-PKA" name="Paktīkā"/> + <iso_3166_2_entry + code="AF-PAR" name="Parwān"/> + <iso_3166_2_entry + code="AF-SAM" name="Samangān"/> + <iso_3166_2_entry + code="AF-SAR" name="Sar-e Pol"/> + <iso_3166_2_entry + code="AF-TAK" name="Takhār"/> + <iso_3166_2_entry + code="AF-WAR" name="Wardak [Wardag]"/> + <iso_3166_2_entry + code="AF-ZAB" name="Zābol [Zābul]"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Antigua and Barbuda --> + <iso_3166_country code="AG"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="AG-03" name="Saint George"/> + <iso_3166_2_entry + code="AG-04" name="Saint John"/> + <iso_3166_2_entry + code="AG-05" name="Saint Mary"/> + <iso_3166_2_entry + code="AG-06" name="Saint Paul"/> + <iso_3166_2_entry + code="AG-07" name="Saint Peter"/> + <iso_3166_2_entry + code="AG-08" name="Saint Philip"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="AG-10" name="Barbuda"/> + <iso_3166_2_entry + code="AG-11" name="Redonda"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Albania --> + <iso_3166_country code="AL"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="AL-01" name="Berat"/> + <iso_3166_2_entry + code="AL-09" name="Dibër"/> + <iso_3166_2_entry + code="AL-02" name="Durrës"/> + <iso_3166_2_entry + code="AL-03" name="Elbasan"/> + <iso_3166_2_entry + code="AL-04" name="Fier"/> + <iso_3166_2_entry + code="AL-05" name="Gjirokastër"/> + <iso_3166_2_entry + code="AL-06" name="Korçë"/> + <iso_3166_2_entry + code="AL-07" name="Kukës"/> + <iso_3166_2_entry + code="AL-08" name="Lezhë"/> + <iso_3166_2_entry + code="AL-10" name="Shkodër"/> + <iso_3166_2_entry + code="AL-11" name="Tiranë"/> + <iso_3166_2_entry + code="AL-12" name="Vlorë"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="AL-BR" name="Berat" parent="01"/> + <iso_3166_2_entry + code="AL-BU" name="Bulqizë" parent="09"/> + <iso_3166_2_entry + code="AL-DL" name="Delvinë" parent="12"/> + <iso_3166_2_entry + code="AL-DV" name="Devoll" parent="06"/> + <iso_3166_2_entry + code="AL-DI" name="Dibër" parent="09"/> + <iso_3166_2_entry + code="AL-DR" name="Durrës" parent="02"/> + <iso_3166_2_entry + code="AL-EL" name="Elbasan" parent="03"/> + <iso_3166_2_entry + code="AL-FR" name="Fier" parent="04"/> + <iso_3166_2_entry + code="AL-GR" name="Gramsh" parent="03"/> + <iso_3166_2_entry + code="AL-GJ" name="Gjirokastër" parent="05"/> + <iso_3166_2_entry + code="AL-HA" name="Has" parent="07"/> + <iso_3166_2_entry + code="AL-KA" name="Kavajë" parent="11"/> + <iso_3166_2_entry + code="AL-ER" name="Kolonjë" parent="06"/> + <iso_3166_2_entry + code="AL-KO" name="Korçë" parent="06"/> + <iso_3166_2_entry + code="AL-KR" name="Krujë" parent="02"/> + <iso_3166_2_entry + code="AL-KC" name="Kuçovë" parent="01"/> + <iso_3166_2_entry + code="AL-KU" name="Kukës" parent="07"/> + <iso_3166_2_entry + code="AL-KB" name="Kurbin" parent="08"/> + <iso_3166_2_entry + code="AL-LE" name="Lezhë" parent="08"/> + <iso_3166_2_entry + code="AL-LB" name="Librazhd" parent="03"/> + <iso_3166_2_entry + code="AL-LU" name="Lushnjë" parent="04"/> + <iso_3166_2_entry + code="AL-MM" name="Malësi e Madhe" parent="10"/> + <iso_3166_2_entry + code="AL-MK" name="Mallakastër" parent="04"/> + <iso_3166_2_entry + code="AL-MT" name="Mat" parent="09"/> + <iso_3166_2_entry + code="AL-MR" name="Mirditë" parent="08"/> + <iso_3166_2_entry + code="AL-PQ" name="Peqin" parent="03"/> + <iso_3166_2_entry + code="AL-PR" name="Përmet" parent="05"/> + <iso_3166_2_entry + code="AL-PG" name="Pogradec" parent="06"/> + <iso_3166_2_entry + code="AL-PU" name="Pukë" parent="10"/> + <iso_3166_2_entry + code="AL-SR" name="Sarandë" parent="12"/> + <iso_3166_2_entry + code="AL-SK" name="Skrapar" parent="01"/> + <iso_3166_2_entry + code="AL-SH" name="Shkodër" parent="10"/> + <iso_3166_2_entry + code="AL-TE" name="Tepelenë" parent="05"/> + <iso_3166_2_entry + code="AL-TR" name="Tiranë" parent="11"/> + <iso_3166_2_entry + code="AL-TP" name="Tropojë" parent="07"/> + <iso_3166_2_entry + code="AL-VL" name="Vlorë" parent="12"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Armenia --> + <iso_3166_country code="AM"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AM-ER" name="Erevan"/> + <iso_3166_2_entry + code="AM-AG" name="Aragacotn"/> + <iso_3166_2_entry + code="AM-AR" name="Ararat"/> + <iso_3166_2_entry + code="AM-AV" name="Armavir"/> + <iso_3166_2_entry + code="AM-GR" name="Gegarkunik'"/> + <iso_3166_2_entry + code="AM-KT" name="Kotayk'"/> + <iso_3166_2_entry + code="AM-LO" name="Lory"/> + <iso_3166_2_entry + code="AM-SH" name="Sirak"/> + <iso_3166_2_entry + code="AM-SU" name="Syunik'"/> + <iso_3166_2_entry + code="AM-TV" name="Tavus"/> + <iso_3166_2_entry + code="AM-VD" name="Vayoc Jor"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Angola --> + <iso_3166_country code="AO"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AO-BGO" name="Bengo"/> + <iso_3166_2_entry + code="AO-BGU" name="Benguela"/> + <iso_3166_2_entry + code="AO-BIE" name="Bié"/> + <iso_3166_2_entry + code="AO-CAB" name="Cabinda"/> + <iso_3166_2_entry + code="AO-CCU" name="Cuando-Cubango"/> + <iso_3166_2_entry + code="AO-CNO" name="Cuanza Norte"/> + <iso_3166_2_entry + code="AO-CUS" name="Cuanza Sul"/> + <iso_3166_2_entry + code="AO-CNN" name="Cunene"/> + <iso_3166_2_entry + code="AO-HUA" name="Huambo"/> + <iso_3166_2_entry + code="AO-HUI" name="Huíla"/> + <iso_3166_2_entry + code="AO-LUA" name="Luanda"/> + <iso_3166_2_entry + code="AO-LNO" name="Lunda Norte"/> + <iso_3166_2_entry + code="AO-LSU" name="Lunda Sul"/> + <iso_3166_2_entry + code="AO-MAL" name="Malange"/> + <iso_3166_2_entry + code="AO-MOX" name="Moxico"/> + <iso_3166_2_entry + code="AO-NAM" name="Namibe"/> + <iso_3166_2_entry + code="AO-UIG" name="Uíge"/> + <iso_3166_2_entry + code="AO-ZAI" name="Zaire"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Argentina --> + <iso_3166_country code="AR"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="AR-C" name="Ciudad Autónoma de Buenos Aires"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="AR-B" name="Buenos Aires"/> + <iso_3166_2_entry + code="AR-K" name="Catamarca"/> + <iso_3166_2_entry + code="AR-X" name="Cordoba"/> + <iso_3166_2_entry + code="AR-W" name="Corrientes"/> + <iso_3166_2_entry + code="AR-H" name="Chaco"/> + <iso_3166_2_entry + code="AR-U" name="Chubut"/> + <iso_3166_2_entry + code="AR-E" name="Entre Rios"/> + <iso_3166_2_entry + code="AR-P" name="Formosa"/> + <iso_3166_2_entry + code="AR-Y" name="Jujuy"/> + <iso_3166_2_entry + code="AR-L" name="La Pampa"/> + <iso_3166_2_entry + code="AR-M" name="Mendoza"/> + <iso_3166_2_entry + code="AR-N" name="Misiones"/> + <iso_3166_2_entry + code="AR-Q" name="Neuquen"/> + <iso_3166_2_entry + code="AR-R" name="Rio Negro"/> + <iso_3166_2_entry + code="AR-A" name="Salta"/> + <iso_3166_2_entry + code="AR-J" name="San Juan"/> + <iso_3166_2_entry + code="AR-D" name="San Luis"/> + <iso_3166_2_entry + code="AR-Z" name="Santa Cruz"/> + <iso_3166_2_entry + code="AR-S" name="Santa Fe"/> + <iso_3166_2_entry + code="AR-G" name="Santiago del Estero"/> + <iso_3166_2_entry + code="AR-V" name="Tierra del Fuego"/> + <iso_3166_2_entry + code="AR-T" name="Tucuman"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Austria --> + <iso_3166_country code="AT"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="AT-1" name="Burgenland"/> + <iso_3166_2_entry + code="AT-2" name="Kärnten"/> + <iso_3166_2_entry + code="AT-3" name="Niederösterreich"/> + <iso_3166_2_entry + code="AT-4" name="Oberösterreich"/> + <iso_3166_2_entry + code="AT-5" name="Salzburg"/> + <iso_3166_2_entry + code="AT-6" name="Steiermark"/> + <iso_3166_2_entry + code="AT-7" name="Tirol"/> + <iso_3166_2_entry + code="AT-8" name="Vorarlberg"/> + <iso_3166_2_entry + code="AT-9" name="Wien"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Australia --> + <iso_3166_country code="AU"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="AU-NSW" name="New South Wales"/> + <iso_3166_2_entry + code="AU-QLD" name="Queensland"/> + <iso_3166_2_entry + code="AU-SA" name="South Australia"/> + <iso_3166_2_entry + code="AU-TAS" name="Tasmania"/> + <iso_3166_2_entry + code="AU-VIC" name="Victoria"/> + <iso_3166_2_entry + code="AU-WA" name="Western Australia"/> + </iso_3166_subset> + <iso_3166_subset type="Territory"> + <iso_3166_2_entry + code="AU-ACT" name="Australian Capital Territory"/> + <iso_3166_2_entry + code="AU-NT" name="Northern Territory"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Azerbaijan --> + <iso_3166_country code="AZ"> + <iso_3166_subset type="Autonomous republic"> + <iso_3166_2_entry + code="AZ NX" name="Naxçıvan"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="AZ-AB" name="Əli Bayramlı"/> + <iso_3166_2_entry + code="AZ-BA" name="Bakı"/> + <iso_3166_2_entry + code="AZ-GA" name="Gəncə"/> + <iso_3166_2_entry + code="AZ-LA" name="Lənkəran"/> + <iso_3166_2_entry + code="AZ-MI" name="Mingəçevir"/> + <iso_3166_2_entry + code="AZ-NA" name="Naftalan"/> + <iso_3166_2_entry + code="AZ-SA" name="Şəki"/> + <iso_3166_2_entry + code="AZ-SM" name="Sumqayıt"/> + <iso_3166_2_entry + code="AZ-SS" name="Şuşa"/> + <iso_3166_2_entry + code="AZ-XA" name="Xankəndi"/> + <iso_3166_2_entry + code="AZ-YE" name="Yevlax"/> + </iso_3166_subset> + <iso_3166_subset type="Rayon"> + <iso_3166_2_entry + code="AZ-ABS" name="Abşeron"/> + <iso_3166_2_entry + code="AZ-AGC" name="Ağcabədi"/> + <iso_3166_2_entry + code="AZ-AGM" name="Ağdam"/> + <iso_3166_2_entry + code="AZ-AGS" name="Ağdaş"/> + <iso_3166_2_entry + code="AZ-AGA" name="Ağstafa"/> + <iso_3166_2_entry + code="AZ-AGU" name="Ağsu"/> + <iso_3166_2_entry + code="AZ-AST" name="Astara"/> + <iso_3166_2_entry + code="AZ-BAB" name="Babək" parent="NX"/> + <iso_3166_2_entry + code="AZ-BAL" name="Balakən"/> + <iso_3166_2_entry + code="AZ-BAR" name="Bərdə"/> + <iso_3166_2_entry + code="AZ-BEY" name="Beyləqan"/> + <iso_3166_2_entry + code="AZ-BIL" name="Biləsuvar"/> + <iso_3166_2_entry + code="AZ-CAB" name="Cəbrayıl"/> + <iso_3166_2_entry + code="AZ-CAL" name="Cəlilabab"/> + <iso_3166_2_entry + code="AZ-CUL" name="Culfa" parent="NX"/> + <iso_3166_2_entry + code="AZ-DAS" name="Daşkəsən"/> + <iso_3166_2_entry + code="AZ-DAV" name="Dəvəçi"/> + <iso_3166_2_entry + code="AZ-FUZ" name="Füzuli"/> + <iso_3166_2_entry + code="AZ-GAD" name="Gədəbəy"/> + <iso_3166_2_entry + code="AZ-GOR" name="Goranboy"/> + <iso_3166_2_entry + code="AZ-GOY" name="Göyçay"/> + <iso_3166_2_entry + code="AZ-HAC" name="Hacıqabul"/> + <iso_3166_2_entry + code="AZ-IMI" name="İmişli"/> + <iso_3166_2_entry + code="AZ-ISM" name="İsmayıllı"/> + <iso_3166_2_entry + code="AZ-KAL" name="Kəlbəcər"/> + <iso_3166_2_entry + code="AZ-KUR" name="Kürdəmir"/> + <iso_3166_2_entry + code="AZ-LAC" name="Laçın"/> + <iso_3166_2_entry + code="AZ-LAN" name="Lənkəran"/> + <iso_3166_2_entry + code="AZ-LER" name="Lerik"/> + <iso_3166_2_entry + code="AZ-MAS" name="Masallı"/> + <iso_3166_2_entry + code="AZ-NEF" name="Neftçala"/> + <iso_3166_2_entry + code="AZ-OGU" name="Oğuz"/> + <iso_3166_2_entry + code="AZ-ORD" name="Ordubad" parent="NX"/> + <iso_3166_2_entry + code="AZ-QAB" name="Qəbələ"/> + <iso_3166_2_entry + code="AZ-QAX" name="Qax"/> + <iso_3166_2_entry + code="AZ-QAZ" name="Qazax"/> + <iso_3166_2_entry + code="AZ-QOB" name="Qobustan"/> + <iso_3166_2_entry + code="AZ-QBA" name="Quba"/> + <iso_3166_2_entry + code="AZ-QBI" name="Qubadlı"/> + <iso_3166_2_entry + code="AZ-QUS" name="Qusar"/> + <iso_3166_2_entry + code="AZ-SAT" name="Saatlı"/> + <iso_3166_2_entry + code="AZ-SAB" name="Sabirabad"/> + <iso_3166_2_entry + code="AZ-SAD" name="Sədərək" parent="NX"/> + <iso_3166_2_entry + code="AZ-SAH" name="Şahbuz" parent="NX"/> + <iso_3166_2_entry + code="AZ-SAK" name="Şəki"/> + <iso_3166_2_entry + code="AZ-SAL" name="Salyan"/> + <iso_3166_2_entry + code="AZ-SMI" name="Şamaxı"/> + <iso_3166_2_entry + code="AZ-SKR" name="Şəmkir"/> + <iso_3166_2_entry + code="AZ-SMX" name="Samux"/> + <iso_3166_2_entry + code="AZ-SAR" name="Şərur" parent="NX"/> + <iso_3166_2_entry + code="AZ-SIY" name="Siyəzən"/> + <iso_3166_2_entry + code="AZ-SUS" name="Şuşa"/> + <iso_3166_2_entry + code="AZ-TAR" name="Tərtər"/> + <iso_3166_2_entry + code="AZ-TOV" name="Tovuz"/> + <iso_3166_2_entry + code="AZ-UCA" name="Ucar"/> + <iso_3166_2_entry + code="AZ-XAC" name="Xaçmaz"/> + <iso_3166_2_entry + code="AZ-XAN" name="Xanlar"/> + <iso_3166_2_entry + code="AZ-XIZ" name="Xızı"/> + <iso_3166_2_entry + code="AZ-XCI" name="Xocalı"/> + <iso_3166_2_entry + code="AZ-XVD" name="Xocavənd"/> + <iso_3166_2_entry + code="AZ-YAR" name="Yardımlı"/> + <iso_3166_2_entry + code="AZ-YEV" name="Yevlax"/> + <iso_3166_2_entry + code="AZ-ZAN" name="Zəngilan"/> + <iso_3166_2_entry + code="AZ-ZAQ" name="Zaqatala"/> + <iso_3166_2_entry + code="AZ-ZAR" name="Zərdab"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bosnia-Herzegovina --> + <iso_3166_country code="BA"> + <iso_3166_subset type="Entity"> + <iso_3166_2_entry + code="BA-BIH" name="Federacija Bosne i Hercegovine"/> + <iso_3166_2_entry + code="BA-SRP" name="Republika Srpska"/> + </iso_3166_subset> + <iso_3166_subset type="Canton"> + <iso_3166_2_entry + code="BA-05" name="Bosansko-podrinjski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-07" name="Hercegovačko-neretvanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-10" name="Kanton br. 10 (Livanjski kanton)" parent="BIH"/> + <iso_3166_2_entry + code="BA-09" name="Kanton Sarajevo" parent="BIH"/> + <iso_3166_2_entry + code="BA-02" name="Posavski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-06" name="Srednjobosanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-03" name="Tuzlanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-01" name="Unsko-sanski kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-08" name="Zapadnohercegovački kanton" parent="BIH"/> + <iso_3166_2_entry + code="BA-04" name="Zeničko-dobojski kanton" parent="BIH"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BA-BRC" name="Brčko distrikt"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Barbados --> + <iso_3166_country code="BB"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="BB-01" name="Christ Church"/> + <iso_3166_2_entry + code="BB-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="BB-03" name="Saint George"/> + <iso_3166_2_entry + code="BB-04" name="Saint James"/> + <iso_3166_2_entry + code="BB-05" name="Saint John"/> + <iso_3166_2_entry + code="BB-06" name="Saint Joseph"/> + <iso_3166_2_entry + code="BB-07" name="Saint Lucy"/> + <iso_3166_2_entry + code="BB-08" name="Saint Michael"/> + <iso_3166_2_entry + code="BB-09" name="Saint Peter"/> + <iso_3166_2_entry + code="BB-10" name="Saint Philip"/> + <iso_3166_2_entry + code="BB-11" name="Saint Thomas"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bangladesh --> + <iso_3166_country code="BD"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="BD 1" name="Barisal bibhag"/> + <iso_3166_2_entry + code="BD 2" name="Chittagong bibhag"/> + <iso_3166_2_entry + code="BD 3" name="Dhaka bibhag"/> + <iso_3166_2_entry + code="BD 4" name="Khulna bibhag"/> + <iso_3166_2_entry + code="BD 5" name="Rajshahi bibhag"/> + <iso_3166_2_entry + code="BD 6" name="Sylhet bibhag"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BD-05" name="Bagerhat zila" parent="4"/> + <iso_3166_2_entry + code="BD-01" name="Bandarban zila" parent="2"/> + <iso_3166_2_entry + code="BD-02" name="Barguna zila" parent="1"/> + <iso_3166_2_entry + code="BD-06" name="Barisal zila" parent="1"/> + <iso_3166_2_entry + code="BD-07" name="Bhola zila" parent="1"/> + <iso_3166_2_entry + code="BD-03" name="Bogra zila" parent="5"/> + <iso_3166_2_entry + code="BD-04" name="Brahmanbaria zila" parent="2"/> + <iso_3166_2_entry + code="BD-09" name="Chandpur zila" parent="2"/> + <iso_3166_2_entry + code="BD-10" name="Chittagong zila" parent="2"/> + <iso_3166_2_entry + code="BD-12" name="Chuadanga zila" parent="4"/> + <iso_3166_2_entry + code="BD-08" name="Comilla zila" parent="2"/> + <iso_3166_2_entry + code="BD-11" name="Cox's Bazar zila" parent="2"/> + <iso_3166_2_entry + code="BD-13" name="Dhaka zila" parent="3"/> + <iso_3166_2_entry + code="BD-14" name="Dinajpur zila" parent="5"/> + <iso_3166_2_entry + code="BD-15" name="Faridpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-16" name="Feni zila" parent="2"/> + <iso_3166_2_entry + code="BD-19" name="Gaibandha zila" parent="5"/> + <iso_3166_2_entry + code="BD-18" name="Gazipur zila" parent="3"/> + <iso_3166_2_entry + code="BD-17" name="Gopalganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-20" name="Habiganj zila" parent="6"/> + <iso_3166_2_entry + code="BD-24" name="Jaipurhat zila" parent="5"/> + <iso_3166_2_entry + code="BD-21" name="Jamalpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-22" name="Jessore zila" parent="4"/> + <iso_3166_2_entry + code="BD-25" name="Jhalakati zila" parent="1"/> + <iso_3166_2_entry + code="BD-23" name="Jhenaidah zila" parent="4"/> + <iso_3166_2_entry + code="BD-29" name="Khagrachari zila" parent="2"/> + <iso_3166_2_entry + code="BD-27" name="Khulna zila" parent="4"/> + <iso_3166_2_entry + code="BD-26" name="Kishorganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-28" name="Kurigram zila" parent="5"/> + <iso_3166_2_entry + code="BD-30" name="Kushtia zila" parent="4"/> + <iso_3166_2_entry + code="BD-31" name="Lakshmipur zila" parent="2"/> + <iso_3166_2_entry + code="BD-32" name="Lalmonirhat zila" parent="5"/> + <iso_3166_2_entry + code="BD-36" name="Madaripur zila" parent="3"/> + <iso_3166_2_entry + code="BD-37" name="Magura zila" parent="4"/> + <iso_3166_2_entry + code="BD-33" name="Manikganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-39" name="Meherpur zila" parent="4"/> + <iso_3166_2_entry + code="BD-38" name="Moulvibazar zila" parent="6"/> + <iso_3166_2_entry + code="BD-35" name="Munshiganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-34" name="Mymensingh zila" parent="3"/> + <iso_3166_2_entry + code="BD-48" name="Naogaon zila" parent="5"/> + <iso_3166_2_entry + code="BD-43" name="Narail zila" parent="4"/> + <iso_3166_2_entry + code="BD-40" name="Narayanganj zila" parent="3"/> + <iso_3166_2_entry + code="BD-42" name="Narsingdi zila" parent="3"/> + <iso_3166_2_entry + code="BD-44" name="Natore zila" parent="5"/> + <iso_3166_2_entry + code="BD-45" name="Nawabganj zila" parent="5"/> + <iso_3166_2_entry + code="BD-41" name="Netrakona zila" parent="3"/> + <iso_3166_2_entry + code="BD-46" name="Nilphamari zila" parent="5"/> + <iso_3166_2_entry + code="BD-47" name="Noakhali zila" parent="2"/> + <iso_3166_2_entry + code="BD-49" name="Pabna zila" parent="5"/> + <iso_3166_2_entry + code="BD-52" name="Panchagarh zila" parent="5"/> + <iso_3166_2_entry + code="BD-51" name="Patuakhali zila" parent="1"/> + <iso_3166_2_entry + code="BD-50" name="Pirojpur zila" parent="1"/> + <iso_3166_2_entry + code="BD-53" name="Rajbari zila" parent="3"/> + <iso_3166_2_entry + code="BD-54" name="Rajshahi zila" parent="5"/> + <iso_3166_2_entry + code="BD-56" name="Rangamati zila" parent="2"/> + <iso_3166_2_entry + code="BD-55" name="Rangpur zila" parent="5"/> + <iso_3166_2_entry + code="BD-58" name="Satkhira zila" parent="4"/> + <iso_3166_2_entry + code="BD-62" name="Shariatpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-57" name="Sherpur zila" parent="3"/> + <iso_3166_2_entry + code="BD-59" name="Sirajganj zila" parent="5"/> + <iso_3166_2_entry + code="BD-61" name="Sunamganj zila" parent="6"/> + <iso_3166_2_entry + code="BD-60" name="Sylhet zila" parent="6"/> + <iso_3166_2_entry + code="BD-63" name="Tangail zila" parent="3"/> + <iso_3166_2_entry + code="BD-64" name="Thakurgaon zila" parent="5"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Belgium --> + <iso_3166_country code="BE"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="BE-VAN" name="Antwerpen"/> + <iso_3166_2_entry + code="BE-WBR" name="Brabant Wallon"/> + <iso_3166_2_entry + code="BE-BRU" name="Brussels-Capital Region"/> + <iso_3166_2_entry + code="BE-WHT" name="Hainaut"/> + <iso_3166_2_entry + code="BE-WLG" name="Liege"/> + <iso_3166_2_entry + code="BE-VLI" name="Limburg"/> + <iso_3166_2_entry + code="BE-WLX" name="Luxembourg"/> + <iso_3166_2_entry + code="BE-WNA" name="Namur"/> + <iso_3166_2_entry + code="BE-VOV" name="Oost-Vlaanderen"/> + <iso_3166_2_entry + code="BE-VBR" name="Vlaams-Brabant"/> + <iso_3166_2_entry + code="BE-VWV" name="West-Vlaanderen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Burkina-Faso --> + <iso_3166_country code="BF"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="BF-01" name="Boucle du Mouhoun"/> + <iso_3166_2_entry + code="BF-02" name="Cascades"/> + <iso_3166_2_entry + code="BF-03" name="Centre"/> + <iso_3166_2_entry + code="BF-04" name="Centre-Est"/> + <iso_3166_2_entry + code="BF-05" name="Centre-Nord"/> + <iso_3166_2_entry + code="BF-06" name="Centre-Ouest"/> + <iso_3166_2_entry + code="BF-07" name="Centre-Sud"/> + <iso_3166_2_entry + code="BF-08" name="Est"/> + <iso_3166_2_entry + code="BF-09" name="Hauts-Bassins"/> + <iso_3166_2_entry + code="BF-10" name="Nord"/> + <iso_3166_2_entry + code="BF-11" name="Plateau-Central"/> + <iso_3166_2_entry + code="BF-12" name="Sahel"/> + <iso_3166_2_entry + code="BF-13" name="Sud-Ouest"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="BF-BAL" name="Balé" parent="01"/> + <iso_3166_2_entry + code="BF-BAM" name="Bam" parent="05"/> + <iso_3166_2_entry + code="BF-BAN" name="Banwa" parent="01"/> + <iso_3166_2_entry + code="BF-BAZ" name="Bazèga" parent="07"/> + <iso_3166_2_entry + code="BF-BGR" name="Bougouriba" parent="13"/> + <iso_3166_2_entry + code="BF-BLG" name="Boulgou" parent="04"/> + <iso_3166_2_entry + code="BF-BLK" name="Boulkiemdé" parent="06"/> + <iso_3166_2_entry + code="BF-COM" name="Comoé" parent="02"/> + <iso_3166_2_entry + code="BF-GAN" name="Ganzourgou" parent="11"/> + <iso_3166_2_entry + code="BF-GNA" name="Gnagna" parent="08"/> + <iso_3166_2_entry + code="BF-GOU" name="Gourma" parent="08"/> + <iso_3166_2_entry + code="BF-HOU" name="Houet" parent="09"/> + <iso_3166_2_entry + code="BF-IOB" name="Ioba" parent="13"/> + <iso_3166_2_entry + code="BF-KAD" name="Kadiogo" parent="03"/> + <iso_3166_2_entry + code="BF-KEN" name="Kénédougou" parent="09"/> + <iso_3166_2_entry + code="BF-KMD" name="Komondjari" parent="08"/> + <iso_3166_2_entry + code="BF-KMP" name="Kompienga" parent="08"/> + <iso_3166_2_entry + code="BF-KOS" name="Kossi" parent="01"/> + <iso_3166_2_entry + code="BF-KOP" name="Koulpélogo" parent="04"/> + <iso_3166_2_entry + code="BF-KOT" name="Kouritenga" parent="04"/> + <iso_3166_2_entry + code="BF-KOW" name="Kourwéogo" parent="11"/> + <iso_3166_2_entry + code="BF-LER" name="Léraba" parent="02"/> + <iso_3166_2_entry + code="BF-LOR" name="Loroum" parent="10"/> + <iso_3166_2_entry + code="BF-MOU" name="Mouhoun" parent="01"/> + <iso_3166_2_entry + code="BF-NAO" name="Naouri" parent="07"/> + <iso_3166_2_entry + code="BF-NAM" name="Namentenga" parent="05"/> + <iso_3166_2_entry + code="BF-NAY" name="Nayala" parent="01"/> + <iso_3166_2_entry + code="BF-NOU" name="Noumbiel" parent="13"/> + <iso_3166_2_entry + code="BF-OUB" name="Oubritenga" parent="11"/> + <iso_3166_2_entry + code="BF-OUD" name="Oudalan" parent="12"/> + <iso_3166_2_entry + code="BF-PAS" name="Passoré" parent="10"/> + <iso_3166_2_entry + code="BF-PON" name="Poni" parent="13"/> + <iso_3166_2_entry + code="BF-SNG" name="Sanguié" parent="06"/> + <iso_3166_2_entry + code="BF-SMT" name="Sanmatenga" parent="05"/> + <iso_3166_2_entry + code="BF-SEN" name="Séno" parent="12"/> + <iso_3166_2_entry + code="BF-SIS" name="Sissili" parent="06"/> + <iso_3166_2_entry + code="BF-SOM" name="Soum" parent="12"/> + <iso_3166_2_entry + code="BF-SOR" name="Sourou" parent="01"/> + <iso_3166_2_entry + code="BF-TAP" name="Tapoa" parent="08"/> + <iso_3166_2_entry + code="BF-TUI" name="Tui" parent="09"/> + <iso_3166_2_entry + code="BF-YAG" name="Yagha" parent="12"/> + <iso_3166_2_entry + code="BF-YAT" name="Yatenga" parent="10"/> + <iso_3166_2_entry + code="BF-ZIR" name="Ziro" parent="06"/> + <iso_3166_2_entry + code="BF-ZON" name="Zondoma" parent="10"/> + <iso_3166_2_entry + code="BF-ZOU" name="Zoundwéogo" parent="07"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bulgaria --> + <iso_3166_country code="BG"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="BG-01" name="Blagoevgrad"/> + <iso_3166_2_entry + code="BG-02" name="Burgas"/> + <iso_3166_2_entry + code="BG-08" name="Dobrich"/> + <iso_3166_2_entry + code="BG-07" name="Gabrovo"/> + <iso_3166_2_entry + code="BG-26" name="Haskovo"/> + <iso_3166_2_entry + code="BG-09" name="Kardzhali"/> + <iso_3166_2_entry + code="BG-10" name="Kyustendil"/> + <iso_3166_2_entry + code="BG-11" name="Lovech"/> + <iso_3166_2_entry + code="BG-12" name="Montana"/> + <iso_3166_2_entry + code="BG-13" name="Pazardzhik"/> + <iso_3166_2_entry + code="BG-14" name="Pernik"/> + <iso_3166_2_entry + code="BG-15" name="Pleven"/> + <iso_3166_2_entry + code="BG-16" name="Plovdiv"/> + <iso_3166_2_entry + code="BG-17" name="Razgrad"/> + <iso_3166_2_entry + code="BG-18" name="Ruse"/> + <iso_3166_2_entry + code="BG-27" name="Shumen"/> + <iso_3166_2_entry + code="BG-19" name="Silistra"/> + <iso_3166_2_entry + code="BG-20" name="Sliven"/> + <iso_3166_2_entry + code="BG-21" name="Smolyan"/> + <iso_3166_2_entry + code="BG-23" name="Sofia"/> + <iso_3166_2_entry + code="BG-22" name="Sofia-Grad"/> + <iso_3166_2_entry + code="BG-24" name="Stara Zagora"/> + <iso_3166_2_entry + code="BG-25" name="Targovishte"/> + <iso_3166_2_entry + code="BG-03" name="Varna"/> + <iso_3166_2_entry + code="BG-04" name="Veliko Tarnovo"/> + <iso_3166_2_entry + code="BG-05" name="Vidin"/> + <iso_3166_2_entry + code="BG-06" name="Vratsa"/> + <iso_3166_2_entry + code="BG-28" name="Yambol"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bahrain --> + <iso_3166_country code="BH"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="BH-13" name="Al Manāmah (Al ‘Āşimah)"/> + <iso_3166_2_entry + code="BH-14" name="Al Janūbīyah"/> + <iso_3166_2_entry + code="BH-15" name="Al Muḩarraq"/> + <iso_3166_2_entry + code="BH-16" name="Al Wusţá"/> + <iso_3166_2_entry + code="BH-17" name="Ash Shamālīyah"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Burundi --> + <iso_3166_country code="BI"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="BI-BB" name="Bubanza"/> + <iso_3166_2_entry + code="BI-BM" name="Bujumbura Mairie"/> + <iso_3166_2_entry + code="BI-BL" name="Bujumbura Rural"/> + <iso_3166_2_entry + code="BI-BR" name="Bururi"/> + <iso_3166_2_entry + code="BI-CA" name="Cankuzo"/> + <iso_3166_2_entry + code="BI-CI" name="Cibitoke"/> + <iso_3166_2_entry + code="BI-GI" name="Gitega"/> + <iso_3166_2_entry + code="BI-KR" name="Karuzi"/> + <iso_3166_2_entry + code="BI-KY" name="Kayanza"/> + <iso_3166_2_entry + code="BI-KI" name="Kirundo"/> + <iso_3166_2_entry + code="BI-MA" name="Makamba"/> + <iso_3166_2_entry + code="BI-MU" name="Muramvya"/> + <iso_3166_2_entry + code="BI-MW" name="Mwaro"/> + <iso_3166_2_entry + code="BI-NG" name="Ngozi"/> + <iso_3166_2_entry + code="BI-RT" name="Rutana"/> + <iso_3166_2_entry + code="BI-RY" name="Ruyigi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Benin --> + <iso_3166_country code="BJ"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="BJ-AL" name="Alibori"/> + <iso_3166_2_entry + code="BJ-AK" name="Atakora"/> + <iso_3166_2_entry + code="BJ-AQ" name="Atlantique"/> + <iso_3166_2_entry + code="BJ-BO" name="Borgou"/> + <iso_3166_2_entry + code="BJ-CO" name="Collines"/> + <iso_3166_2_entry + code="BJ-DO" name="Donga"/> + <iso_3166_2_entry + code="BJ-KO" name="Kouffo"/> + <iso_3166_2_entry + code="BJ-LI" name="Littoral"/> + <iso_3166_2_entry + code="BJ-MO" name="Mono"/> + <iso_3166_2_entry + code="BJ-OU" name="Ouémé"/> + <iso_3166_2_entry + code="BJ-PL" name="Plateau"/> + <iso_3166_2_entry + code="BJ-ZO" name="Zou"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Barthélemy --> + <iso_3166_country code="BL"/> + <!-- Brunei Darussalam --> + <iso_3166_country code="BN"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BN-BE" name="Belait"/> + <iso_3166_2_entry + code="BN-BM" name="Brunei-Muara"/> + <iso_3166_2_entry + code="BN-TE" name="Temburong"/> + <iso_3166_2_entry + code="BN-TU" name="Tutong"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bolivia --> + <iso_3166_country code="BO"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="BO-H" name="Chuquisaca"/> + <iso_3166_2_entry + code="BO-C" name="Cochabamba"/> + <iso_3166_2_entry + code="BO-B" name="El Beni"/> + <iso_3166_2_entry + code="BO-L" name="La Paz"/> + <iso_3166_2_entry + code="BO-O" name="Oruro"/> + <iso_3166_2_entry + code="BO-N" name="Pando"/> + <iso_3166_2_entry + code="BO-P" name="Potosí"/> + <iso_3166_2_entry + code="BO-S" name="Santa Cruz"/> + <iso_3166_2_entry + code="BO-T" name="Tarija"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Brazil --> + <iso_3166_country code="BR"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="BR-AC" name="Acre"/> + <iso_3166_2_entry + code="BR-AL" name="Alagoas"/> + <iso_3166_2_entry + code="BR-AM" name="Amazonas"/> + <iso_3166_2_entry + code="BR-AP" name="Amapá"/> + <iso_3166_2_entry + code="BR-BA" name="Bahia"/> + <iso_3166_2_entry + code="BR-CE" name="Ceará"/> + <iso_3166_2_entry + code="BR-ES" name="Espírito Santo"/> + <iso_3166_2_entry + code="BR-FN" name="Fernando de Noronha"/> + <iso_3166_2_entry + code="BR-GO" name="Goiás"/> + <iso_3166_2_entry + code="BR-MA" name="Maranhão"/> + <iso_3166_2_entry + code="BR-MG" name="Minas Gerais"/> + <iso_3166_2_entry + code="BR-MS" name="Mato Grosso do Sul"/> + <iso_3166_2_entry + code="BR-MT" name="Mato Grosso"/> + <iso_3166_2_entry + code="BR-PA" name="Pará"/> + <iso_3166_2_entry + code="BR-PB" name="Paraíba"/> + <iso_3166_2_entry + code="BR-PE" name="Pernambuco"/> + <iso_3166_2_entry + code="BR-PI" name="Piauí"/> + <iso_3166_2_entry + code="BR-PR" name="Paraná"/> + <iso_3166_2_entry + code="BR-RJ" name="Rio de Janeiro"/> + <iso_3166_2_entry + code="BR-RN" name="Rio Grande do Norte"/> + <iso_3166_2_entry + code="BR-RO" name="Rondônia"/> + <iso_3166_2_entry + code="BR-RR" name="Roraima"/> + <iso_3166_2_entry + code="BR-RS" name="Rio Grande do Sul"/> + <iso_3166_2_entry + code="BR-SC" name="Santa Catarina"/> + <iso_3166_2_entry + code="BR-SE" name="Sergipe"/> + <iso_3166_2_entry + code="BR-SP" name="São Paulo"/> + <iso_3166_2_entry + code="BR-TO" name="Tocantins"/> + </iso_3166_subset> + <iso_3166_subset type="Federal District"> + <iso_3166_2_entry + code="BR-DF" name="Distrito Federal"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bahamas --> + <iso_3166_country code="BS"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BS-AC" name="Acklins Islands"/> + <iso_3166_2_entry + code="BS-BY" name="Berry Islands"/> + <iso_3166_2_entry + code="BS-BI" name="Bimini and Cat Cay"/> + <iso_3166_2_entry + code="BS-BP" name="Black Point"/> + <iso_3166_2_entry + code="BS-CI" name="Cat Island"/> + <iso_3166_2_entry + code="BS-CO" name="Central Abaco"/> + <iso_3166_2_entry + code="BS-CS" name="Central Andros"/> + <iso_3166_2_entry + code="BS-CE" name="Central Eleuthera"/> + <iso_3166_2_entry + code="BS-FP" name="City of Freeport"/> + <iso_3166_2_entry + code="BS-CK" name="Crooked Island and Long Cay"/> + <iso_3166_2_entry + code="BS-EG" name="East Grand Bahama"/> + <iso_3166_2_entry + code="BS-EX" name="Exuma"/> + <iso_3166_2_entry + code="BS-GC" name="Grand Cay"/> + <iso_3166_2_entry + code="BS-GT" name="Green Turtle Cay"/> + <iso_3166_2_entry + code="BS-HI" name="Harbour Island"/> + <iso_3166_2_entry + code="BS-HT" name="Hope Town"/> + <iso_3166_2_entry + code="BS-IN" name="Inagua"/> + <iso_3166_2_entry + code="BS-LI" name="Long Island"/> + <iso_3166_2_entry + code="BS-MC" name="Mangrove Cay"/> + <iso_3166_2_entry + code="BS-MG" name="Mayaguana"/> + <iso_3166_2_entry + code="BS-MI" name="Moore's Island"/> + <iso_3166_2_entry + code="BS-NO" name="North Abaco"/> + <iso_3166_2_entry + code="BS-NS" name="North Andros"/> + <iso_3166_2_entry + code="BS-NE" name="North Eleuthera"/> + <iso_3166_2_entry + code="BS-RI" name="Ragged Island"/> + <iso_3166_2_entry + code="BS-RC" name="Rum Cay"/> + <iso_3166_2_entry + code="BS-SS" name="San Salvador"/> + <iso_3166_2_entry + code="BS-SO" name="South Abaco"/> + <iso_3166_2_entry + code="BS-SA" name="South Andros"/> + <iso_3166_2_entry + code="BS-SE" name="South Eleuthera"/> + <iso_3166_2_entry + code="BS-SW" name="Spanish Wells"/> + <iso_3166_2_entry + code="BS-WG" name="West Grand Bahama"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Bhutan --> + <iso_3166_country code="BT"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BT-33" name="Bumthang"/> + <iso_3166_2_entry + code="BT-12" name="Chhukha"/> + <iso_3166_2_entry + code="BT-22" name="Dagana"/> + <iso_3166_2_entry + code="BT-GA" name="Gasa"/> + <iso_3166_2_entry + code="BT-13" name="Ha"/> + <iso_3166_2_entry + code="BT-44" name="Lhuentse"/> + <iso_3166_2_entry + code="BT-42" name="Monggar"/> + <iso_3166_2_entry + code="BT-11" name="Paro"/> + <iso_3166_2_entry + code="BT-43" name="Pemagatshel"/> + <iso_3166_2_entry + code="BT-23" name="Punakha"/> + <iso_3166_2_entry + code="BT-45" name="Samdrup Jongkha"/> + <iso_3166_2_entry + code="BT-14" name="Samtee"/> + <iso_3166_2_entry + code="BT-31" name="Sarpang"/> + <iso_3166_2_entry + code="BT-15" name="Thimphu"/> + <iso_3166_2_entry + code="BT-41" name="Trashigang"/> + <iso_3166_2_entry + code="BT-TY" name="Trashi Yangtse"/> + <iso_3166_2_entry + code="BT-32" name="Trongsa"/> + <iso_3166_2_entry + code="BT-21" name="Tsirang"/> + <iso_3166_2_entry + code="BT-24" name="Wangdue Phodrang"/> + <iso_3166_2_entry + code="BT-34" name="Zhemgang"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Botswana --> + <iso_3166_country code="BW"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BW-CE" name="Central"/> + <iso_3166_2_entry + code="BW-GH" name="Ghanzi"/> + <iso_3166_2_entry + code="BW-KG" name="Kgalagadi"/> + <iso_3166_2_entry + code="BW-KL" name="Kgatleng"/> + <iso_3166_2_entry + code="BW-KW" name="Kweneng"/> + <iso_3166_2_entry + code="BW-NG" name="Ngamiland"/> + <iso_3166_2_entry + code="BW-NE" name="North-East"/> + <iso_3166_2_entry + code="BW-NW" name="North-West (Botswana)"/> + <iso_3166_2_entry + code="BW-SE" name="South-East"/> + <iso_3166_2_entry + code="BW-SO" name="Southern (Botswana)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Belarus --> + <iso_3166_country code="BY"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="BY-HM" name="Horad Minsk"/> + </iso_3166_subset> + <iso_3166_subset type="Oblast"> + <!-- ISO 3166-2 gives several Romanised versions of the names; here we choose the GOST be version --> + <iso_3166_2_entry + code="BY-BR" name="Brèsckaja voblasc'"/> + <iso_3166_2_entry + code="BY-HO" name="Homel'skaja voblasc'"/> + <iso_3166_2_entry + code="BY-HR" name="Hrodzenskaja voblasc'"/> + <iso_3166_2_entry + code="BY-MA" name="Mahilëuskaja voblasc'"/> + <iso_3166_2_entry + code="BY-MI" name="Minskaja voblasc'"/> + <iso_3166_2_entry + code="BY-VI" name="Vicebskaja voblasc'"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Belize --> + <iso_3166_country code="BZ"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="BZ-BZ" name="Belize"/> + <iso_3166_2_entry + code="BZ-CY" name="Cayo"/> + <iso_3166_2_entry + code="BZ-CZL" name="Corozal"/> + <iso_3166_2_entry + code="BZ-OW" name="Orange Walk"/> + <iso_3166_2_entry + code="BZ-SC" name="Stann Creek"/> + <iso_3166_2_entry + code="BZ-TOL" name="Toledo"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Canada --> + <iso_3166_country code="CA"> + <!-- sub-region codes for Canadian provinces and territories --> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CA-AB" name="Alberta"/> + <iso_3166_2_entry + code="CA-BC" name="British Columbia"/> + <iso_3166_2_entry + code="CA-MB" name="Manitoba"/> + <iso_3166_2_entry + code="CA-NB" name="New Brunswick"/> + <iso_3166_2_entry + code="CA-NL" name="Newfoundland and Labrador"/> + <iso_3166_2_entry + code="CA-NS" name="Nova Scotia"/> + <iso_3166_2_entry + code="CA-ON" name="Ontario"/> + <iso_3166_2_entry + code="CA-PE" name="Prince Edward Island"/> + <iso_3166_2_entry + code="CA-QC" name="Quebec"/> + <iso_3166_2_entry + code="CA-SK" name="Saskatchewan"/> + </iso_3166_subset> + <iso_3166_subset type="Territory"> + <iso_3166_2_entry + code="CA-NT" name="Northwest Territories"/> + <iso_3166_2_entry + code="CA-NU" name="Nunavut"/> + <iso_3166_2_entry + code="CA-YT" name="Yukon Territory"/> + </iso_3166_subset> + </iso_3166_country> + <!-- The Democratic Republic of Congo --> + <iso_3166_country code="CD"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="CD-KN" name="Kinshasa"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CD-BN" name="Bandundu"/> + <iso_3166_2_entry + code="CD-BC" name="Bas-Congo"/> + <iso_3166_2_entry + code="CD-EQ" name="Équateur"/> + <iso_3166_2_entry + code="CD-HC" name="Haut-Congo"/> + <iso_3166_2_entry + code="CD-KW" name="Kasai-Occidental"/> + <iso_3166_2_entry + code="CD-KE" name="Kasai-Oriental"/> + <iso_3166_2_entry + code="CD-KA" name="Katanga"/> + <iso_3166_2_entry + code="CD-MA" name="Maniema"/> + <iso_3166_2_entry + code="CD-NK" name="Nord-Kivu"/> + <iso_3166_2_entry + code="CD-OR" name="Orientale"/> + <iso_3166_2_entry + code="CD-SK" name="Sud-Kivu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Central African Republic --> + <iso_3166_country code="CF"> + <iso_3166_subset type="Commune"> + <iso_3166_2_entry + code="CF-BGF" name="Bangui"/> + </iso_3166_subset> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="CF-BB" name="Bamingui-Bangoran"/> + <iso_3166_2_entry + code="CF-BK" name="Basse-Kotto"/> + <iso_3166_2_entry + code="CF-HK" name="Haute-Kotto"/> + <iso_3166_2_entry + code="CF-HM" name="Haut-Mbomou"/> + <iso_3166_2_entry + code="CF-KG" name="Kémo-Gribingui"/> + <iso_3166_2_entry + code="CF-LB" name="Lobaye"/> + <iso_3166_2_entry + code="CF-HS" name="Haute-Sangha / Mambéré-Kadéï"/> + <iso_3166_2_entry + code="CF-MB" name="Mbomou"/> + <iso_3166_2_entry + code="CF-NM" name="Nana-Mambéré"/> + <iso_3166_2_entry + code="CF-MP" name="Ombella-M'poko"/> + <iso_3166_2_entry + code="CF-UK" name="Ouaka"/> + <iso_3166_2_entry + code="CF-AC" name="Ouham"/> + <iso_3166_2_entry + code="CF-OP" name="Ouham-Pendé"/> + <iso_3166_2_entry + code="CF-VR" name="Vakaga"/> + </iso_3166_subset> + <iso_3166_subset type="Economic Prefecture"> + <iso_3166_2_entry + code="CF-KB" name="Gribingui"/> + <iso_3166_2_entry + code="CF-SE" name="Sangha"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Congo --> + <iso_3166_country code="CG"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CG-11" name="Bouenza"/> + <iso_3166_2_entry + code="CG-8" name="Cuvette"/> + <iso_3166_2_entry + code="CG-15" name="Cuvette-Ouest"/> + <iso_3166_2_entry + code="CG-5" name="Kouilou"/> + <iso_3166_2_entry + code="CG-2" name="Lékoumou"/> + <iso_3166_2_entry + code="CG-7" name="Likouala"/> + <iso_3166_2_entry + code="CG-9" name="Niari"/> + <iso_3166_2_entry + code="CG-14" name="Plateaux"/> + <iso_3166_2_entry + code="CG-12" name="Pool"/> + <iso_3166_2_entry + code="CG-13" name="Sangha"/> + </iso_3166_subset> + <iso_3166_subset type="Capital District"> + <iso_3166_2_entry + code="CG-BZV" name="Brazzaville"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Switzerland --> + <iso_3166_country code="CH"> + <iso_3166_subset type="Canton"> + <iso_3166_2_entry + code="CH-AG" name="Aargau"/> + <iso_3166_2_entry + code="CH-AI" name="Appenzell Innerrhoden"/> + <iso_3166_2_entry + code="CH-AR" name="Appenzell Ausserrhoden"/> + <iso_3166_2_entry + code="CH-BE" name="Bern"/> + <iso_3166_2_entry + code="CH-BL" name="Basel-Landschaft"/> + <iso_3166_2_entry + code="CH-BS" name="Basel-Stadt"/> + <iso_3166_2_entry + code="CH-FR" name="Fribourg"/> + <iso_3166_2_entry + code="CH-GE" name="Genève"/> + <iso_3166_2_entry + code="CH-GL" name="Glarus"/> + <iso_3166_2_entry + code="CH-GR" name="Graubünden"/> + <iso_3166_2_entry + code="CH-JU" name="Jura"/> + <iso_3166_2_entry + code="CH-LU" name="Luzern"/> + <iso_3166_2_entry + code="CH-NE" name="Neuchâtel"/> + <iso_3166_2_entry + code="CH-NW" name="Nidwalden"/> + <iso_3166_2_entry + code="CH-OW" name="Obwalden"/> + <iso_3166_2_entry + code="CH-SG" name="Sankt Gallen"/> + <iso_3166_2_entry + code="CH-SH" name="Schaffhausen"/> + <iso_3166_2_entry + code="CH-SO" name="Solothurn"/> + <iso_3166_2_entry + code="CH-SZ" name="Schwyz"/> + <iso_3166_2_entry + code="CH-TG" name="Thurgau"/> + <iso_3166_2_entry + code="CH-TI" name="Ticino"/> + <iso_3166_2_entry + code="CH-UR" name="Uri"/> + <iso_3166_2_entry + code="CH-VD" name="Vaud"/> + <iso_3166_2_entry + code="CH-VS" name="Valais"/> + <iso_3166_2_entry + code="CH-ZG" name="Zug"/> + <iso_3166_2_entry + code="CH-ZH" name="Zürich"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cote D'ivoire --> + <iso_3166_country code="CI"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CI-06" name="18 Montagnes (Région des)"/> + <iso_3166_2_entry + code="CI-16" name="Agnébi (Région de l')"/> + <iso_3166_2_entry + code="CI-17" name="Bafing (Région du)"/> + <iso_3166_2_entry + code="CI-09" name="Bas-Sassandra (Région du)"/> + <iso_3166_2_entry + code="CI-10" name="Denguélé (Région du)"/> + <iso_3166_2_entry + code="CI-18" name="Fromager (Région du)"/> + <iso_3166_2_entry + code="CI-02" name="Haut-Sassandra (Région du)"/> + <iso_3166_2_entry + code="CI-07" name="Lacs (Région des)"/> + <iso_3166_2_entry + code="CI-01" name="Lagunes (Région des)"/> + <iso_3166_2_entry + code="CI-12" name="Marahoué (Région de la)"/> + <iso_3166_2_entry + code="CI-19" name="Moyen-Cavally (Région du)"/> + <iso_3166_2_entry + code="CI-05" name="Moyen-Comoé (Région du)"/> + <iso_3166_2_entry + code="CI-11" name="Nzi-Comoé (Région)"/> + <iso_3166_2_entry + code="CI-03" name="Savanes (Région des)"/> + <iso_3166_2_entry + code="CI-15" name="Sud-Bandama (Région du)"/> + <iso_3166_2_entry + code="CI-13" name="Sud-Comoé (Région du)"/> + <iso_3166_2_entry + code="CI-04" name="Vallée du Bandama (Région de la)"/> + <iso_3166_2_entry + code="CI-14" name="Worodouqou (Région du)"/> + <iso_3166_2_entry + code="CI-08" name="Zanzan (Région du)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Chile --> + <iso_3166_country code="CL"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CL-AI" name="Aisén del General Carlos Ibáñez del Campo"/> + <iso_3166_2_entry + code="CL-AN" name="Antofagasta"/> + <iso_3166_2_entry + code="CL-AR" name="Araucanía"/> + <iso_3166_2_entry + code="CL-AP" name="Arica y Parinacota"/> + <iso_3166_2_entry + code="CL-AT" name="Atacama"/> + <iso_3166_2_entry + code="CL-BI" name="Bío-Bío"/> + <iso_3166_2_entry + code="CL-CO" name="Coquimbo"/> + <iso_3166_2_entry + code="CL-LI" name="Libertador General Bernardo O'Higgins"/> + <iso_3166_2_entry + code="CL-LL" name="Los Lagos"/> + <iso_3166_2_entry + code="CL-LR" name="Los Ríos"/> + <iso_3166_2_entry + code="CL-MA" name="Magallanes y Antártica Chilena"/> + <iso_3166_2_entry + code="CL-ML" name="Maule"/> + <iso_3166_2_entry + code="CL-RM" name="Región Metropolitana de Santiago"/> + <iso_3166_2_entry + code="CL-TA" name="Tarapacá"/> + <iso_3166_2_entry + code="CL-VS" name="Valparaíso"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cameroon --> + <iso_3166_country code="CM"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CM-AD" name="Adamaoua"/> + <iso_3166_2_entry + code="CM-CE" name="Centre"/> + <iso_3166_2_entry + code="CM-ES" name="East"/> + <iso_3166_2_entry + code="CM-EN" name="Far North"/> + <iso_3166_2_entry + code="CM-LT" name="Littoral"/> + <iso_3166_2_entry + code="CM-NO" name="North"/> + <iso_3166_2_entry + code="CM-NW" name="North-West (Cameroon)"/> + <iso_3166_2_entry + code="CM-SU" name="South"/> + <iso_3166_2_entry + code="CM-SW" name="South-West"/> + <iso_3166_2_entry + code="CM-OU" name="West"/> + </iso_3166_subset> + </iso_3166_country> + <!-- China --> + <iso_3166_country code="CN"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="CN-11" name="Beijing"/> + <iso_3166_2_entry + code="CN-50" name="Chongqing"/> + <iso_3166_2_entry + code="CN-31" name="Shanghai"/> + <iso_3166_2_entry + code="CN-12" name="Tianjin"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CN-34" name="Anhui"/> + <iso_3166_2_entry + code="CN-35" name="Fujian"/> + <iso_3166_2_entry + code="CN-62" name="Gansu"/> + <iso_3166_2_entry + code="CN-44" name="Guangdong"/> + <iso_3166_2_entry + code="CN-52" name="Guizhou"/> + <iso_3166_2_entry + code="CN-46" name="Hainan"/> + <iso_3166_2_entry + code="CN-13" name="Hebei"/> + <iso_3166_2_entry + code="CN-23" name="Heilongjiang"/> + <iso_3166_2_entry + code="CN-41" name="Henan"/> + <iso_3166_2_entry + code="CN-42" name="Hubei"/> + <iso_3166_2_entry + code="CN-43" name="Hunan"/> + <iso_3166_2_entry + code="CN-32" name="Jiangsu"/> + <iso_3166_2_entry + code="CN-36" name="Jiangxi"/> + <iso_3166_2_entry + code="CN-22" name="Jilin"/> + <iso_3166_2_entry + code="CN-21" name="Liaoning"/> + <iso_3166_2_entry + code="CN-63" name="Qinghai"/> + <iso_3166_2_entry + code="CN-61" name="Shaanxi"/> + <iso_3166_2_entry + code="CN-37" name="Shandong"/> + <iso_3166_2_entry + code="CN-14" name="Shanxi"/> + <iso_3166_2_entry + code="CN-51" name="Sichuan"/> + <iso_3166_2_entry + code="CN-71" name="Taiwan"/> + <iso_3166_2_entry + code="CN-53" name="Yunnan"/> + <iso_3166_2_entry + code="CN-33" name="Zhejiang"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous region"> + <iso_3166_2_entry + code="CN-45" name="Guangxi"/> + <iso_3166_2_entry + code="CN-15" name="Nei Mongol"/> + <iso_3166_2_entry + code="CN-64" name="Ningxia"/> + <iso_3166_2_entry + code="CN-65" name="Xinjiang"/> + <iso_3166_2_entry + code="CN-54" name="Xizang"/> + </iso_3166_subset> + <iso_3166_subset type="Special administrative region"> + <iso_3166_2_entry + code="CN-91" name="Xianggang (Hong-Kong)"/> + <iso_3166_2_entry + code="CN-92" name="Aomen (Macau)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Colombia --> + <iso_3166_country code="CO"> + <iso_3166_subset type="Capital district"> + <iso_3166_2_entry + code="CO-DC" name="Distrito Capital de Bogotá"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="CO-AMA" name="Amazonas"/> + <iso_3166_2_entry + code="CO-ANT" name="Antioquia"/> + <iso_3166_2_entry + code="CO-ARA" name="Arauca"/> + <iso_3166_2_entry + code="CO-ATL" name="Atlántico"/> + <iso_3166_2_entry + code="CO-BOL" name="Bolívar"/> + <iso_3166_2_entry + code="CO-BOY" name="Boyacá"/> + <iso_3166_2_entry + code="CO-CAL" name="Caldas"/> + <iso_3166_2_entry + code="CO-CAQ" name="Caquetá"/> + <iso_3166_2_entry + code="CO-CAS" name="Casanare"/> + <iso_3166_2_entry + code="CO-CAU" name="Cauca"/> + <iso_3166_2_entry + code="CO-CES" name="Cesar"/> + <iso_3166_2_entry + code="CO-CHO" name="Chocó"/> + <iso_3166_2_entry + code="CO-COR" name="Córdoba"/> + <iso_3166_2_entry + code="CO-CUN" name="Cundinamarca"/> + <iso_3166_2_entry + code="CO-GUA" name="Guainía"/> + <iso_3166_2_entry + code="CO-GUV" name="Guaviare"/> + <iso_3166_2_entry + code="CO-HUI" name="Huila"/> + <iso_3166_2_entry + code="CO-LAG" name="La Guajira"/> + <iso_3166_2_entry + code="CO-MAG" name="Magdalena"/> + <iso_3166_2_entry + code="CO-MET" name="Meta"/> + <iso_3166_2_entry + code="CO-NAR" name="Nariño"/> + <iso_3166_2_entry + code="CO-NSA" name="Norte de Santander"/> + <iso_3166_2_entry + code="CO-PUT" name="Putumayo"/> + <iso_3166_2_entry + code="CO-QUI" name="Quindío"/> + <iso_3166_2_entry + code="CO-RIS" name="Risaralda"/> + <iso_3166_2_entry + code="CO-SAP" name="San Andrés, Providencia y Santa Catalina"/> + <iso_3166_2_entry + code="CO-SAN" name="Santander"/> + <iso_3166_2_entry + code="CO-SUC" name="Sucre"/> + <iso_3166_2_entry + code="CO-TOL" name="Tolima"/> + <iso_3166_2_entry + code="CO-VAC" name="Valle del Cauca"/> + <iso_3166_2_entry + code="CO-VAU" name="Vaupés"/> + <iso_3166_2_entry + code="CO-VID" name="Vichada"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Costa Rica --> + <iso_3166_country code="CR"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CR-A" name="Alajuela"/> + <iso_3166_2_entry + code="CR-C" name="Cartago"/> + <iso_3166_2_entry + code="CR-G" name="Guanacaste"/> + <iso_3166_2_entry + code="CR-H" name="Heredia"/> + <iso_3166_2_entry + code="CR-L" name="Limón"/> + <iso_3166_2_entry + code="CR-P" name="Puntarenas"/> + <iso_3166_2_entry + code="CR-SJ" name="San José"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cuba --> + <iso_3166_country code="CU"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="CU-09" name="Camagüey"/> + <iso_3166_2_entry + code="CU-08" name="Ciego de Ávila"/> + <iso_3166_2_entry + code="CU-06" name="Cienfuegos"/> + <iso_3166_2_entry + code="CU-03" name="Ciudad de La Habana"/> + <iso_3166_2_entry + code="CU-12" name="Granma"/> + <iso_3166_2_entry + code="CU-14" name="Guantánamo"/> + <iso_3166_2_entry + code="CU-11" name="Holguín"/> + <iso_3166_2_entry + code="CU-02" name="La Habana"/> + <iso_3166_2_entry + code="CU-10" name="Las Tunas"/> + <iso_3166_2_entry + code="CU-04" name="Matanzas"/> + <iso_3166_2_entry + code="CU-01" name="Pinar del Rio"/> + <iso_3166_2_entry + code="CU-07" name="Sancti Spíritus"/> + <iso_3166_2_entry + code="CU-13" name="Santiago de Cuba"/> + <iso_3166_2_entry + code="CU-05" name="Villa Clara"/> + </iso_3166_subset> + <iso_3166_subset type="Special municipality"> + <iso_3166_2_entry + code="CU-99" name="Isla de la Juventud"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cape Verde --> + <iso_3166_country code="CV"> + <iso_3166_subset type="Geographical region"> + <iso_3166_2_entry + code="CV B" name="Ilhas de Barlavento"/> + <iso_3166_2_entry + code="CV S" name="Ilhas de Sotavento"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="CV-BV" name="Boa Vista" parent="B"/> + <iso_3166_2_entry + code="CV-BR" name="Brava" parent="S"/> + <iso_3166_2_entry + code="CV-MA" name="Maio" parent="S"/> + <iso_3166_2_entry + code="CV-MO" name="Mosteiros" parent="S"/> + <iso_3166_2_entry + code="CV-PA" name="Paul" parent="B"/> + <iso_3166_2_entry + code="CV-PN" name="Porto Novo" parent="B"/> + <iso_3166_2_entry + code="CV-PR" name="Praia" parent="S"/> + <iso_3166_2_entry + code="CV-RB" name="Ribeira Brava" parent="B"/> + <iso_3166_2_entry + code="CV-RG" name="Ribeira Grande" parent="B"/> + <iso_3166_2_entry + code="CV-RS" name="Ribeira Grande de Santiago" parent="S"/> + <iso_3166_2_entry + code="CV-SL" name="Sal" parent="B"/> + <iso_3166_2_entry + code="CV-CA" name="Santa Catarina" parent="S"/> + <iso_3166_2_entry + code="CV-CF" name="Santa Catarina de Fogo" parent="S"/> + <iso_3166_2_entry + code="CV-CR" name="Santa Cruz" parent="S"/> + <iso_3166_2_entry + code="CV-SD" name="São Domingos" parent="S"/> + <iso_3166_2_entry + code="CV-SF" name="São Filipe" parent="S"/> + <iso_3166_2_entry + code="CV-SL" name="São Lourenço dos Órgãos" parent="S"/> + <iso_3166_2_entry + code="CV-SM" name="São Miguel" parent="S"/> + <iso_3166_2_entry + code="CV-SS" name="São Salvador do Mundo" parent="S"/> + <iso_3166_2_entry + code="CV-SV" name="São Vicente" parent="B"/> + <iso_3166_2_entry + code="CV-TA" name="Tarrafal" parent="S"/> + <iso_3166_2_entry + code="CV-TS" name="Tarrafal de São Nicolau" parent="S"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cyprus --> + <iso_3166_country code="CY"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="CY-04" name="Ammóchostos"/> + <iso_3166_2_entry + code="CY-06" name="Kerýneia"/> + <iso_3166_2_entry + code="CY-03" name="Lárnaka"/> + <iso_3166_2_entry + code="CY-01" name="Lefkosía"/> + <iso_3166_2_entry + code="CY-02" name="Lemesós"/> + <iso_3166_2_entry + code="CY-05" name="Páfos"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Czech Republic --> + <iso_3166_country code="CZ"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="CZ-JC" name="Jihočeský kraj"/> + <iso_3166_2_entry + code="CZ-JM" name="Jihomoravský kraj"/> + <iso_3166_2_entry + code="CZ-KA" name="Karlovarský kraj"/> + <iso_3166_2_entry + code="CZ-KR" name="Královéhradecký kraj"/> + <iso_3166_2_entry + code="CZ-LI" name="Liberecký kraj"/> + <iso_3166_2_entry + code="CZ-MO" name="Moravskoslezský kraj"/> + <iso_3166_2_entry + code="CZ-OL" name="Olomoucký kraj"/> + <iso_3166_2_entry + code="CZ-PA" name="Pardubický kraj"/> + <iso_3166_2_entry + code="CZ-PL" name="Plzeňský kraj"/> + <iso_3166_2_entry + code="CZ-PR" name="Praha, hlavní město"/> + <iso_3166_2_entry + code="CZ-ST" name="Středočeský kraj"/> + <iso_3166_2_entry + code="CZ-US" name="Ústecký kraj"/> + <iso_3166_2_entry + code="CZ-VY" name="Vysočina"/> + <iso_3166_2_entry + code="CZ-ZL" name="Zlínský kraj"/> + </iso_3166_subset> + <iso_3166_subset type="district"> + <iso_3166_2_entry + code="CZ-201" name="Benešov" parent="ST"/> + <iso_3166_2_entry + code="CZ-202" name="Beroun" parent="ST"/> + <iso_3166_2_entry + code="CZ-621" name="Blansko" parent="JM"/> + <iso_3166_2_entry + code="CZ-622" name="Brno-město" parent="JM"/> + <iso_3166_2_entry + code="CZ-623" name="Brno-venkov" parent="JM"/> + <iso_3166_2_entry + code="CZ-801" name="Bruntál" parent="MO"/> + <iso_3166_2_entry + code="CZ-624" name="Břeclav" parent="JM"/> + <iso_3166_2_entry + code="CZ-511" name="Česká Lípa" parent="LI"/> + <iso_3166_2_entry + code="CZ-311" name="České Budějovice" parent="JC"/> + <iso_3166_2_entry + code="CZ-312" name="Český Krumlov" parent="JC"/> + <iso_3166_2_entry + code="CZ-421" name="Děčín" parent="US"/> + <iso_3166_2_entry + code="CZ-321" name="Domažlice" parent="PL"/> + <iso_3166_2_entry + code="CZ-802" name="Frýdek Místek" parent="MO"/> + <iso_3166_2_entry + code="CZ-611" name="Havlíčkův Brod" parent="VY"/> + <iso_3166_2_entry + code="CZ-625" name="Hodonín" parent="JM"/> + <iso_3166_2_entry + code="CZ-521" name="Hradec Králové" parent="KR"/> + <iso_3166_2_entry + code="CZ-411" name="Cheb" parent="KA"/> + <iso_3166_2_entry + code="CZ-422" name="Chomutov" parent="US"/> + <iso_3166_2_entry + code="CZ-531" name="Chrudim" parent="PA"/> + <iso_3166_2_entry + code="CZ-512" name="Jablonec nad Nisou" parent="LI"/> + <iso_3166_2_entry + code="CZ-711" name="Jeseník" parent="OL"/> + <iso_3166_2_entry + code="CZ-522" name="Jičín" parent="KR"/> + <iso_3166_2_entry + code="CZ-612" name="Jihlava" parent="VY"/> + <iso_3166_2_entry + code="CZ-313" name="Jindřichův Hradec" parent="JC"/> + <iso_3166_2_entry + code="CZ-412" name="Karlovy Vary" parent="KA"/> + <iso_3166_2_entry + code="CZ-803" name="Karviná" parent="MO"/> + <iso_3166_2_entry + code="CZ-203" name="Kladno" parent="ST"/> + <iso_3166_2_entry + code="CZ-322" name="Klatovy" parent="PL"/> + <iso_3166_2_entry + code="CZ-204" name="Kolín" parent="ST"/> + <iso_3166_2_entry + code="CZ-721" name="Kromĕříž" parent="ZL"/> + <iso_3166_2_entry + code="CZ-205" name="Kutná Hora" parent="ST"/> + <iso_3166_2_entry + code="CZ-513" name="Liberec" parent="LI"/> + <iso_3166_2_entry + code="CZ-423" name="Litoměřice" parent="US"/> + <iso_3166_2_entry + code="CZ-424" name="Louny" parent="US"/> + <iso_3166_2_entry + code="CZ-206" name="Mělník" parent="ST"/> + <iso_3166_2_entry + code="CZ-207" name="Mladá Boleslav" parent="ST"/> + <iso_3166_2_entry + code="CZ-425" name="Most" parent="US"/> + <iso_3166_2_entry + code="CZ-523" name="Náchod" parent="KR"/> + <iso_3166_2_entry + code="CZ-804" name="Nový Jičín" parent="MO"/> + <iso_3166_2_entry + code="CZ-208" name="Nymburk" parent="ST"/> + <iso_3166_2_entry + code="CZ-712" name="Olomouc" parent="OL"/> + <iso_3166_2_entry + code="CZ-805" name="Opava" parent="MO"/> + <iso_3166_2_entry + code="CZ-806" name="Ostrava město" parent="MO"/> + <iso_3166_2_entry + code="CZ-532" name="Pardubice" parent="PA"/> + <iso_3166_2_entry + code="CZ-613" name="Pelhřimov" parent="VY"/> + <iso_3166_2_entry + code="CZ-314" name="Písek" parent="JC"/> + <iso_3166_2_entry + code="CZ-324" name="Plzeň jih" parent="PL"/> + <iso_3166_2_entry + code="CZ-323" name="Plzeň město" parent="PL"/> + <iso_3166_2_entry + code="CZ-325" name="Plzeň sever" parent="PL"/> + <iso_3166_2_entry + code="CZ-101" name="Praha 1" parent="PR"/> + <iso_3166_2_entry + code="CZ-102" name="Praha 2" parent="PR"/> + <iso_3166_2_entry + code="CZ-103" name="Praha 3" parent="PR"/> + <iso_3166_2_entry + code="CZ-104" name="Praha 4" parent="PR"/> + <iso_3166_2_entry + code="CZ-105" name="Praha 5" parent="PR"/> + <iso_3166_2_entry + code="CZ-106" name="Praha 6" parent="PR"/> + <iso_3166_2_entry + code="CZ-107" name="Praha 7" parent="PR"/> + <iso_3166_2_entry + code="CZ-108" name="Praha 8" parent="PR"/> + <iso_3166_2_entry + code="CZ-109" name="Praha 9" parent="PR"/> + <iso_3166_2_entry + code="CZ-10A" name="Praha 10" parent="PR"/> + <iso_3166_2_entry + code="CZ-10B" name="Praha 11" parent="PR"/> + <iso_3166_2_entry + code="CZ-10C" name="Praha 12" parent="PR"/> + <iso_3166_2_entry + code="CZ-10D" name="Praha 13" parent="PR"/> + <iso_3166_2_entry + code="CZ-10E" name="Praha 14" parent="PR"/> + <iso_3166_2_entry + code="CZ-10F" name="Praha 15" parent="PR"/> + <iso_3166_2_entry + code="CZ-209" name="Praha východ" parent="ST"/> + <iso_3166_2_entry + code="CZ-20A" name="Praha západ" parent="ST"/> + <iso_3166_2_entry + code="CZ-315" name="Prachatice" parent="JC"/> + <iso_3166_2_entry + code="CZ-713" name="Prostĕjov" parent="OL"/> + <iso_3166_2_entry + code="CZ-714" name="Přerov" parent="OL"/> + <iso_3166_2_entry + code="CZ-20B" name="Příbram" parent="ST"/> + <iso_3166_2_entry + code="CZ-20C" name="Rakovník" parent="ST"/> + <iso_3166_2_entry + code="CZ-326" name="Rokycany" parent="PL"/> + <iso_3166_2_entry + code="CZ-524" name="Rychnov nad Kněžnou" parent="KR"/> + <iso_3166_2_entry + code="CZ-514" name="Semily" parent="LI"/> + <iso_3166_2_entry + code="CZ-413" name="Sokolov" parent="KA"/> + <iso_3166_2_entry + code="CZ-316" name="Strakonice" parent="JC"/> + <iso_3166_2_entry + code="CZ-533" name="Svitavy" parent="PA"/> + <iso_3166_2_entry + code="CZ-715" name="Šumperk" parent="OL"/> + <iso_3166_2_entry + code="CZ-317" name="Tábor" parent="JC"/> + <iso_3166_2_entry + code="CZ-327" name="Tachov" parent="PL"/> + <iso_3166_2_entry + code="CZ-426" name="Teplice" parent="US"/> + <iso_3166_2_entry + code="CZ-525" name="Trutnov" parent="KR"/> + <iso_3166_2_entry + code="CZ-614" name="Třebíč" parent="VY"/> + <iso_3166_2_entry + code="CZ-722" name="Uherské Hradištĕ" parent="ZL"/> + <iso_3166_2_entry + code="CZ-427" name="Ústí nad Labem" parent="US"/> + <iso_3166_2_entry + code="CZ-534" name="Ústí nad Orlicí" parent="PA"/> + <iso_3166_2_entry + code="CZ-723" name="Vsetín" parent="ZL"/> + <iso_3166_2_entry + code="CZ-626" name="Vyškov" parent="JM"/> + <iso_3166_2_entry + code="CZ-724" name="Zlín" parent="ZL"/> + <iso_3166_2_entry + code="CZ-627" name="Znojmo" parent="JM"/> + <iso_3166_2_entry + code="CZ-615" name="Žd’ár nad Sázavou" parent="VY"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Germany --> + <iso_3166_country code="DE"> + <iso_3166_subset type="State"> + <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> + <iso_3166_2_entry + code="DE-BW" name="Baden-Württemberg"/> + <iso_3166_2_entry + code="DE-BY" name="Bayern"/> + <iso_3166_2_entry + code="DE-HB" name="Bremen"/> + <iso_3166_2_entry + code="DE-HH" name="Hamburg"/> + <iso_3166_2_entry + code="DE-HE" name="Hessen"/> + <iso_3166_2_entry + code="DE-NI" name="Niedersachsen"/> + <iso_3166_2_entry + code="DE-NW" name="Nordrhein-Westfalen"/> + <iso_3166_2_entry + code="DE-RP" name="Rheinland-Pfalz"/> + <iso_3166_2_entry + code="DE-SL" name="Saarland"/> + <iso_3166_2_entry + code="DE-SH" name="Schleswig-Holstein"/> + <iso_3166_2_entry + code="DE-BE" name="Berlin"/> + <iso_3166_2_entry + code="DE-BB" name="Brandenburg"/> + <iso_3166_2_entry + code="DE-MV" name="Mecklenburg-Vorpommern"/> + <iso_3166_2_entry + code="DE-SN" name="Sachsen"/> + <iso_3166_2_entry + code="DE-ST" name="Sachsen-Anhalt"/> + <iso_3166_2_entry + code="DE-TH" name="Thüringen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Djibouti --> + <iso_3166_country code="DJ"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="DJ-AS" name="Ali Sabieh"/> + <iso_3166_2_entry + code="DJ-AR" name="Arta"/> + <iso_3166_2_entry + code="DJ-DI" name="Dikhil"/> + <iso_3166_2_entry + code="DJ-OB" name="Obock"/> + <iso_3166_2_entry + code="DJ-TA" name="Tadjourah"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="DJ-DJ" name="Djibouti"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Denmark --> + <iso_3166_country code="DK"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="DK-81" name="Nordjylland"/> + <iso_3166_2_entry + code="DK-82" name="Midtjylland"/> + <iso_3166_2_entry + code="DK-83" name="Syddanmark"/> + <iso_3166_2_entry + code="DK-84" name="Hovedstaden"/> + <iso_3166_2_entry + code="DK-85" name="Sjælland"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Dominica --> + <iso_3166_country code="DM"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="DM-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="DM-03" name="Saint David"/> + <iso_3166_2_entry + code="DM-04" name="Saint George"/> + <iso_3166_2_entry + code="DM-05" name="Saint John"/> + <iso_3166_2_entry + code="DM-06" name="Saint Joseph"/> + <iso_3166_2_entry + code="DM-07" name="Saint Luke"/> + <iso_3166_2_entry + code="DM-08" name="Saint Mark"/> + <iso_3166_2_entry + code="DM-09" name="Saint Patrick"/> + <iso_3166_2_entry + code="DM-10" name="Saint Paul"/> + <iso_3166_2_entry + code="DM-01" name="Saint Peter"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Dominican Republic --> + <iso_3166_country code="DO"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="DO-01" name="Distrito Nacional (Santo Domingo)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="DO-02" name="Azua"/> + <iso_3166_2_entry + code="DO-03" name="Bahoruco"/> + <iso_3166_2_entry + code="DO-04" name="Barahona"/> + <iso_3166_2_entry + code="DO-05" name="Dajabón"/> + <iso_3166_2_entry + code="DO-06" name="Duarte"/> + <iso_3166_2_entry + code="DO-08" name="El Seybo [El Seibo]"/> + <iso_3166_2_entry + code="DO-09" name="Espaillat"/> + <iso_3166_2_entry + code="DO-30" name="Hato Mayor"/> + <iso_3166_2_entry + code="DO-10" name="Independencia"/> + <iso_3166_2_entry + code="DO-11" name="La Altagracia"/> + <iso_3166_2_entry + code="DO-07" name="La Estrelleta [Elías Piña]"/> + <iso_3166_2_entry + code="DO-12" name="La Romana"/> + <iso_3166_2_entry + code="DO-13" name="La Vega"/> + <iso_3166_2_entry + code="DO-14" name="María Trinidad Sánchez"/> + <iso_3166_2_entry + code="DO-28" name="Monseñor Nouel"/> + <iso_3166_2_entry + code="DO-15" name="Monte Cristi"/> + <iso_3166_2_entry + code="DO-29" name="Monte Plata"/> + <iso_3166_2_entry + code="DO-16" name="Pedernales"/> + <iso_3166_2_entry + code="DO-17" name="Peravia"/> + <iso_3166_2_entry + code="DO-18" name="Puerto Plata"/> + <iso_3166_2_entry + code="DO-19" name="Salcedo"/> + <iso_3166_2_entry + code="DO-20" name="Samaná"/> + <iso_3166_2_entry + code="DO-21" name="San Cristóbal"/> + <iso_3166_2_entry + code="DO-22" name="San Juan"/> + <iso_3166_2_entry + code="DO-23" name="San Pedro de Macorís"/> + <iso_3166_2_entry + code="DO-24" name="Sánchez Ramírez"/> + <iso_3166_2_entry + code="DO-25" name="Santiago"/> + <iso_3166_2_entry + code="DO-26" name="Santiago Rodríguez"/> + <iso_3166_2_entry + code="DO-27" name="Valverde"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Algeria --> + <iso_3166_country code="DZ"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="DZ-01" name="Adrar"/> + <iso_3166_2_entry + code="DZ-44" name="Aïn Defla"/> + <iso_3166_2_entry + code="DZ-46" name="Aïn Témouchent"/> + <iso_3166_2_entry + code="DZ-16" name="Alger"/> + <iso_3166_2_entry + code="DZ-23" name="Annaba"/> + <iso_3166_2_entry + code="DZ-05" name="Batna"/> + <iso_3166_2_entry + code="DZ-08" name="Béchar"/> + <iso_3166_2_entry + code="DZ-06" name="Béjaïa"/> + <iso_3166_2_entry + code="DZ-07" name="Biskra"/> + <iso_3166_2_entry + code="DZ-09" name="Blida"/> + <iso_3166_2_entry + code="DZ-34" name="Bordj Bou Arréridj"/> + <iso_3166_2_entry + code="DZ-10" name="Bouira"/> + <iso_3166_2_entry + code="DZ-35" name="Boumerdès"/> + <iso_3166_2_entry + code="DZ-02" name="Chlef"/> + <iso_3166_2_entry + code="DZ-25" name="Constantine"/> + <iso_3166_2_entry + code="DZ-17" name="Djelfa"/> + <iso_3166_2_entry + code="DZ-32" name="El Bayadh"/> + <iso_3166_2_entry + code="DZ-39" name="El Oued"/> + <iso_3166_2_entry + code="DZ-36" name="El Tarf"/> + <iso_3166_2_entry + code="DZ-47" name="Ghardaïa"/> + <iso_3166_2_entry + code="DZ-24" name="Guelma"/> + <iso_3166_2_entry + code="DZ-33" name="Illizi"/> + <iso_3166_2_entry + code="DZ-18" name="Jijel"/> + <iso_3166_2_entry + code="DZ-40" name="Khenchela"/> + <iso_3166_2_entry + code="DZ-03" name="Laghouat"/> + <iso_3166_2_entry + code="DZ-29" name="Mascara"/> + <iso_3166_2_entry + code="DZ-26" name="Médéa"/> + <iso_3166_2_entry + code="DZ-43" name="Mila"/> + <iso_3166_2_entry + code="DZ-27" name="Mostaganem"/> + <iso_3166_2_entry + code="DZ-28" name="Msila"/> + <iso_3166_2_entry + code="DZ-45" name="Naama"/> + <iso_3166_2_entry + code="DZ-31" name="Oran"/> + <iso_3166_2_entry + code="DZ-30" name="Ouargla"/> + <iso_3166_2_entry + code="DZ-04" name="Oum el Bouaghi"/> + <iso_3166_2_entry + code="DZ-48" name="Relizane"/> + <iso_3166_2_entry + code="DZ-20" name="Saïda"/> + <iso_3166_2_entry + code="DZ-19" name="Sétif"/> + <iso_3166_2_entry + code="DZ-22" name="Sidi Bel Abbès"/> + <iso_3166_2_entry + code="DZ-21" name="Skikda"/> + <iso_3166_2_entry + code="DZ-41" name="Souk Ahras"/> + <iso_3166_2_entry + code="DZ-11" name="Tamanghasset"/> + <iso_3166_2_entry + code="DZ-12" name="Tébessa"/> + <iso_3166_2_entry + code="DZ-14" name="Tiaret"/> + <iso_3166_2_entry + code="DZ-37" name="Tindouf"/> + <iso_3166_2_entry + code="DZ-42" name="Tipaza"/> + <iso_3166_2_entry + code="DZ-38" name="Tissemsilt"/> + <iso_3166_2_entry + code="DZ-15" name="Tizi Ouzou"/> + <iso_3166_2_entry + code="DZ-13" name="Tlemcen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ecuador --> + <iso_3166_country code="EC"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="EC-A" name="Azuay"/> + <iso_3166_2_entry + code="EC-B" name="Bolívar"/> + <iso_3166_2_entry + code="EC-F" name="Cañar"/> + <iso_3166_2_entry + code="EC-C" name="Carchi"/> + <iso_3166_2_entry + code="EC-X" name="Cotopaxi"/> + <iso_3166_2_entry + code="EC-H" name="Chimborazo"/> + <iso_3166_2_entry + code="EC-O" name="El Oro"/> + <iso_3166_2_entry + code="EC-E" name="Esmeraldas"/> + <iso_3166_2_entry + code="EC-W" name="Galápagos"/> + <iso_3166_2_entry + code="EC-G" name="Guayas"/> + <iso_3166_2_entry + code="EC-I" name="Imbabura"/> + <iso_3166_2_entry + code="EC-L" name="Loja"/> + <iso_3166_2_entry + code="EC-R" name="Los Ríos"/> + <iso_3166_2_entry + code="EC-M" name="Manabí"/> + <iso_3166_2_entry + code="EC-S" name="Morona-Santiago"/> + <iso_3166_2_entry + code="EC-N" name="Napo"/> + <iso_3166_2_entry + code="EC-D" name="Orellana"/> + <iso_3166_2_entry + code="EC-Y" name="Pastaza"/> + <iso_3166_2_entry + code="EC-P" name="Pichincha"/> + <iso_3166_2_entry + code="EC-SE" name="Santa Elena"/> + <iso_3166_2_entry + code="EC-SD" name="Santo Domingo de los Tsáchilas"/> + <iso_3166_2_entry + code="EC-U" name="Sucumbíos"/> + <iso_3166_2_entry + code="EC-T" name="Tungurahua"/> + <iso_3166_2_entry + code="EC-Z" name="Zamora-Chinchipe"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Estonia --> + <iso_3166_country code="EE"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="EE-37" name="Harjumaa"/> + <iso_3166_2_entry + code="EE-39" name="Hiiumaa"/> + <iso_3166_2_entry + code="EE-44" name="Ida-Virumaa"/> + <iso_3166_2_entry + code="EE-49" name="Jõgevamaa"/> + <iso_3166_2_entry + code="EE-51" name="Järvamaa"/> + <iso_3166_2_entry + code="EE-57" name="Läänemaa"/> + <iso_3166_2_entry + code="EE-59" name="Lääne-Virumaa"/> + <iso_3166_2_entry + code="EE-65" name="Põlvamaa"/> + <iso_3166_2_entry + code="EE-67" name="Pärnumaa"/> + <iso_3166_2_entry + code="EE-70" name="Raplamaa"/> + <iso_3166_2_entry + code="EE-74" name="Saaremaa"/> + <iso_3166_2_entry + code="EE-78" name="Tartumaa"/> + <iso_3166_2_entry + code="EE-82" name="Valgamaa"/> + <iso_3166_2_entry + code="EE-84" name="Viljandimaa"/> + <iso_3166_2_entry + code="EE-86" name="Võrumaa"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Egypt --> + <iso_3166_country code="EG"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="EG-DK" name="Ad Daqahlīyah"/> + <iso_3166_2_entry + code="EG-BA" name="Al Bahr al Ahmar"/> + <iso_3166_2_entry + code="EG-BH" name="Al Buhayrah"/> + <iso_3166_2_entry + code="EG-FYM" name="Al Fayyūm"/> + <iso_3166_2_entry + code="EG-GH" name="Al Gharbīyah"/> + <iso_3166_2_entry + code="EG-ALX" name="Al Iskandarīyah"/> + <iso_3166_2_entry + code="EG-IS" name="Al Ismā`īlīyah"/> + <iso_3166_2_entry + code="EG-GZ" name="Al Jīzah"/> + <iso_3166_2_entry + code="EG-MNF" name="Al Minūfīyah"/> + <iso_3166_2_entry + code="EG-MN" name="Al Minyā"/> + <iso_3166_2_entry + code="EG-C" name="Al Qāhirah"/> + <iso_3166_2_entry + code="EG-KB" name="Al Qalyūbīyah"/> + <iso_3166_2_entry + code="EG-WAD" name="Al Wādī al Jadīd"/> + <iso_3166_2_entry + code="EG-SU" name="As Sādis min Uktūbar"/> + <iso_3166_2_entry + code="EG-SHR" name="Ash Sharqīyah"/> + <iso_3166_2_entry + code="EG-SUZ" name="As Suways"/> + <iso_3166_2_entry + code="EG-ASN" name="Aswān"/> + <iso_3166_2_entry + code="EG-AST" name="Asyūt"/> + <iso_3166_2_entry + code="EG-BNS" name="Banī Suwayf"/> + <iso_3166_2_entry + code="EG-PTS" name="Būr Sa`īd"/> + <iso_3166_2_entry + code="EG-DT" name="Dumyāt"/> + <iso_3166_2_entry + code="EG-HU" name="Ḩulwān"/> + <iso_3166_2_entry + code="EG-JS" name="Janūb Sīnā'"/> + <iso_3166_2_entry + code="EG-KFS" name="Kafr ash Shaykh"/> + <iso_3166_2_entry + code="EG-MT" name="Matrūh"/> + <iso_3166_2_entry + code="EG-KN" name="Qinā"/> + <iso_3166_2_entry + code="EG-SIN" name="Shamal Sīnā'"/> + <iso_3166_2_entry + code="EG-SHG" name="Sūhāj"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Eritrea --> + <iso_3166_country code="ER"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ER-AN" name="Anseba"/> + <iso_3166_2_entry + code="ER-DU" name="Debub"/> + <iso_3166_2_entry + code="ER-DK" name="Debubawi Keyih Bahri [Debub-Keih-Bahri]"/> + <iso_3166_2_entry + code="ER-GB" name="Gash-Barka"/> + <iso_3166_2_entry + code="ER-MA" name="Maakel [Maekel]"/> + <iso_3166_2_entry + code="ER-SK" name="Semenawi Keyih Bahri [Semien-Keih-Bahri]"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Spain --> + <iso_3166_country code="ES"> + <iso_3166_subset type="Autonomous community"> + <iso_3166_2_entry + code="ES-AN" name="Andalucía"/> + <iso_3166_2_entry + code="ES-AR" name="Aragón"/> + <iso_3166_2_entry + code="ES-AS" name="Asturias, Principado de"/> + <iso_3166_2_entry + code="ES-CN" name="Canarias"/> + <iso_3166_2_entry + code="ES-CB" name="Cantabria"/> + <iso_3166_2_entry + code="ES-CM" name="Castilla-La Mancha"/> + <iso_3166_2_entry + code="ES-CL" name="Castilla y León"/> + <iso_3166_2_entry + code="ES-CT" name="Catalunya"/> + <iso_3166_2_entry + code="ES-EX" name="Extremadura"/> + <iso_3166_2_entry + code="ES-GA" name="Galicia"/> + <iso_3166_2_entry + code="ES-PM" name="Illes Balears"/> + <iso_3166_2_entry + code="ES-RI" name="La Rioja"/> + <iso_3166_2_entry + code="ES-MD" name="Madrid, Comunidad de"/> + <iso_3166_2_entry + code="ES-MC" name="Murcia, Región de"/> + <iso_3166_2_entry + code="ES-NC" name="Navarra, Comunidad Foral de / Nafarroako Foru Komunitatea"/> + <iso_3166_2_entry + code="ES-PV" name="País Vasco / Euskal Herria"/> + <iso_3166_2_entry + code="ES-VC" name="Valenciana, Comunidad / Valenciana, Comunitat "/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ES-C" name="A Coruña" parent="GA"/> + <iso_3166_2_entry + code="ES-VI" name="Álava" parent="PV"/> + <iso_3166_2_entry + code="ES-AB" name="Albacete" parent="CM"/> + <iso_3166_2_entry + code="ES-A" name="Alicante" parent="VC"/> + <iso_3166_2_entry + code="ES-AL" name="Almería" parent="AN"/> + <iso_3166_2_entry + code="ES-O" name="Asturias" parent="AS"/> + <iso_3166_2_entry + code="ES-AV" name="Ávila" parent="CL"/> + <iso_3166_2_entry + code="ES-BA" name="Badajoz" parent="EX"/> + <iso_3166_2_entry + code="ES-IB" name="Balears" parent="IB"/> + <iso_3166_2_entry + code="ES-B" name="Barcelona" parent="CT"/> + <iso_3166_2_entry + code="ES-BU" name="Burgos" parent="CL"/> + <iso_3166_2_entry + code="ES-CC" name="Cáceres" parent="EX"/> + <iso_3166_2_entry + code="ES-CA" name="Cádiz" parent="AN"/> + <iso_3166_2_entry + code="ES-S" name="Cantabria" parent="CB"/> + <iso_3166_2_entry + code="ES-CS" name="Castellón" parent="VC"/> + <iso_3166_2_entry + code="ES-CR" name="Ciudad Real" parent="CM"/> + <iso_3166_2_entry + code="ES-CO" name="Córdoba" parent="AN"/> + <iso_3166_2_entry + code="ES-CU" name="Cuenca" parent="CM"/> + <iso_3166_2_entry + code="ES-GI" name="Girona" parent="CT"/> + <iso_3166_2_entry + code="ES-GR" name="Granada" parent="AN"/> + <iso_3166_2_entry + code="ES-GU" name="Guadalajara" parent="CM"/> + <iso_3166_2_entry + code="ES-SS" name="Guipúzcoa / Gipuzkoa" parent="PV"/> + <iso_3166_2_entry + code="ES-H" name="Huelva" parent="AN"/> + <iso_3166_2_entry + code="ES-HU" name="Huesca" parent="AR"/> + <iso_3166_2_entry + code="ES-J" name="Jaén" parent="AN"/> + <iso_3166_2_entry + code="ES-LO" name="La Rioja" parent="RI"/> + <iso_3166_2_entry + code="ES-GC" name="Las Palmas" parent="CN"/> + <iso_3166_2_entry + code="ES-LE" name="León" parent="CL"/> + <iso_3166_2_entry + code="ES-L" name="Lleida" parent="CT"/> + <iso_3166_2_entry + code="ES-LU" name="Lugo" parent="GA"/> + <iso_3166_2_entry + code="ES-M" name="Madrid" parent="MD"/> + <iso_3166_2_entry + code="ES-MA" name="Málaga" parent="AN"/> + <iso_3166_2_entry + code="ES-MU" name="Murcia" parent="MC"/> + <iso_3166_2_entry + code="ES-NA" name="Navarra / Nafarroa" parent="NC"/> + <iso_3166_2_entry + code="ES-OR" name="Ourense" parent="GA"/> + <iso_3166_2_entry + code="ES-P" name="Palencia" parent="CL"/> + <iso_3166_2_entry + code="ES-PO" name="Pontevedra" parent="GA"/> + <iso_3166_2_entry + code="ES-SA" name="Salamanca" parent="CL"/> + <iso_3166_2_entry + code="ES-TF" name="Santa Cruz de Tenerife" parent="CN"/> + <iso_3166_2_entry + code="ES-SG" name="Segovia" parent="CL"/> + <iso_3166_2_entry + code="ES-SE" name="Sevilla" parent="AN"/> + <iso_3166_2_entry + code="ES-SO" name="Soria" parent="CL"/> + <iso_3166_2_entry + code="ES-T" name="Tarragona" parent="CT"/> + <iso_3166_2_entry + code="ES-TE" name="Teruel" parent="AR"/> + <iso_3166_2_entry + code="ES-TO" name="Toledo" parent="CM"/> + <iso_3166_2_entry + code="ES-V" name="Valencia / València" parent="VC"/> + <iso_3166_2_entry + code="ES-VA" name="Valladolid" parent="CL"/> + <iso_3166_2_entry + code="ES-BI" name="Vizcayaa / Bizkaia" parent="PV"/> + <iso_3166_2_entry + code="ES-ZA" name="Zamora" parent="CL"/> + <iso_3166_2_entry + code="ES-Z" name="Zaragoza" parent="AR"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous city"> + <iso_3166_2_entry + code="ES-CE" name="Ceuta"/> + <iso_3166_2_entry + code="ES-ML" name="Melilla"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ethiopia --> + <iso_3166_country code="ET"> + <iso_3166_subset type="Administration"> + <iso_3166_2_entry + code="ET-AA" name="Ādīs Ābeba"/> + <iso_3166_2_entry + code="ET-DD" name="Dirē Dawa"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="ET-AF" name="Āfar"/> + <iso_3166_2_entry + code="ET-AM" name="Āmara"/> + <iso_3166_2_entry + code="ET-BE" name="Bīnshangul Gumuz"/> + <iso_3166_2_entry + code="ET-GA" name="Gambēla Hizboch"/> + <iso_3166_2_entry + code="ET-HA" name="Hārerī Hizb"/> + <iso_3166_2_entry + code="ET-OR" name="Oromīya"/> + <iso_3166_2_entry + code="ET-SO" name="Sumalē"/> + <iso_3166_2_entry + code="ET-TI" name="Tigray"/> + <iso_3166_2_entry + code="ET-SN" name="YeDebub Bihēroch Bihēreseboch na Hizboch"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Finland --> + <iso_3166_country code="FI"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="FI-AL" name="Ahvenanmaan lääni"/> + <iso_3166_2_entry + code="FI-ES" name="Etelä-Suomen lääni"/> + <iso_3166_2_entry + code="FI-IS" name="Itä-Suomen lääni"/> + <iso_3166_2_entry + code="FI-LL" name="Lapin lääni"/> + <iso_3166_2_entry + code="FI-LS" name="Länsi-Suomen lääni"/> + <iso_3166_2_entry + code="FI-OL" name="Oulun lääni"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Fiji --> + <iso_3166_country code="FJ"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="FJ-C" name="Central"/> + <iso_3166_2_entry + code="FJ-E" name="Eastern"/> + <iso_3166_2_entry + code="FJ-N" name="Northern"/> + <iso_3166_2_entry + code="FJ-W" name="Western"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="FJ-R" name="Rotuma"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Federated States of Micronesia --> + <iso_3166_country code="FM"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="FM-TRK" name="Chuuk"/> + <iso_3166_2_entry + code="FM-KSA" name="Kosrae"/> + <iso_3166_2_entry + code="FM-PNI" name="Pohnpei"/> + <iso_3166_2_entry + code="FM-YAP" name="Yap"/> + </iso_3166_subset> + </iso_3166_country> + <!-- France --> + <iso_3166_country code="FR"> + <iso_3166_subset type="Metropolitan region"> + <iso_3166_2_entry + code="FR-A" name="Alsace"/> + <iso_3166_2_entry + code="FR-B" name="Aquitaine"/> + <iso_3166_2_entry + code="FR-C" name="Auvergne"/> + <iso_3166_2_entry + code="FR-P" name="Basse-Normandie"/> + <iso_3166_2_entry + code="FR-D" name="Bourgogne"/> + <iso_3166_2_entry + code="FR-E" name="Bretagne"/> + <iso_3166_2_entry + code="FR-F" name="Centre"/> + <iso_3166_2_entry + code="FR-G" name="Champagne-Ardenne"/> + <iso_3166_2_entry + code="FR-H" name="Corse"/> + <iso_3166_2_entry + code="FR-I" name="Franche-Comté"/> + <iso_3166_2_entry + code="FR-Q" name="Haute-Normandie"/> + <iso_3166_2_entry + code="FR-J" name="Île-de-France"/> + <iso_3166_2_entry + code="FR-K" name="Languedoc-Roussillon"/> + <iso_3166_2_entry + code="FR-L" name="Limousin"/> + <iso_3166_2_entry + code="FR-M" name="Lorraine"/> + <iso_3166_2_entry + code="FR-N" name="Midi-Pyrénées"/> + <iso_3166_2_entry + code="FR-O" name="Nord - Pas-de-Calais"/> + <iso_3166_2_entry + code="FR-R" name="Pays de la Loire"/> + <iso_3166_2_entry + code="FR-S" name="Picardie"/> + <iso_3166_2_entry + code="FR-T" name="Poitou-Charentes"/> + <iso_3166_2_entry + code="FR-U" name="Provence-Alpes-Côte d'Azur"/> + <iso_3166_2_entry + code="FR-V" name="Rhône-Alpes"/> + </iso_3166_subset> + <iso_3166_subset type="Overseas region/department"> + <iso_3166_2_entry + code="FR-GP" name="Guadeloupe"/> + <iso_3166_2_entry + code="FR-GF" name="Guyane"/> + <iso_3166_2_entry + code="FR-MQ" name="Martinique"/> + <iso_3166_2_entry + code="FR-RE" name="Réunion"/> + </iso_3166_subset> + <iso_3166_subset type="Metropolitan department"> + <iso_3166_2_entry + code="FR-01" name="Ain" parent="V"/> + <iso_3166_2_entry + code="FR-02" name="Aisne" parent="S"/> + <iso_3166_2_entry + code="FR-03" name="Allier" parent="C"/> + <iso_3166_2_entry + code="FR-04" name="Alpes-de-Haute-Provence" parent="U"/> + <iso_3166_2_entry + code="FR-06" name="Alpes-Maritimes" parent="U"/> + <iso_3166_2_entry + code="FR-07" name="Ardèche" parent="V"/> + <iso_3166_2_entry + code="FR-08" name="Ardennes" parent="G"/> + <iso_3166_2_entry + code="FR-09" name="Ariège" parent="N"/> + <iso_3166_2_entry + code="FR-10" name="Aube" parent="G"/> + <iso_3166_2_entry + code="FR-11" name="Aude" parent="K"/> + <iso_3166_2_entry + code="FR-12" name="Aveyron" parent="N"/> + <iso_3166_2_entry + code="FR-67" name="Bas-Rhin" parent="A"/> + <iso_3166_2_entry + code="FR-13" name="Bouches-du-Rhône" parent="U"/> + <iso_3166_2_entry + code="FR-14" name="Calvados" parent="P"/> + <iso_3166_2_entry + code="FR-15" name="Cantal" parent="C"/> + <iso_3166_2_entry + code="FR-16" name="Charente" parent="T"/> + <iso_3166_2_entry + code="FR-17" name="Charente-Maritime" parent="T"/> + <iso_3166_2_entry + code="FR-18" name="Cher" parent="F"/> + <iso_3166_2_entry + code="FR-19" name="Corrèze" parent="L"/> + <iso_3166_2_entry + code="FR-2A" name="Corse-du-Sud" parent="H"/> + <iso_3166_2_entry + code="FR-21" name="Côte-d'Or" parent="D"/> + <iso_3166_2_entry + code="FR-22" name="Côtes-d'Armor" parent="E"/> + <iso_3166_2_entry + code="FR-23" name="Creuse" parent="L"/> + <iso_3166_2_entry + code="FR-79" name="Deux-Sèvres" parent="T"/> + <iso_3166_2_entry + code="FR-24" name="Dordogne" parent="B"/> + <iso_3166_2_entry + code="FR-25" name="Doubs" parent="I"/> + <iso_3166_2_entry + code="FR-26" name="Drôme" parent="V"/> + <iso_3166_2_entry + code="FR-91" name="Essonne" parent="J"/> + <iso_3166_2_entry + code="FR-27" name="Eure" parent="Q"/> + <iso_3166_2_entry + code="FR-28" name="Eure-et-Loir" parent="F"/> + <iso_3166_2_entry + code="FR-29" name="Finistère" parent="E"/> + <iso_3166_2_entry + code="FR-30" name="Gard" parent="K"/> + <iso_3166_2_entry + code="FR-32" name="Gers" parent="N"/> + <iso_3166_2_entry + code="FR-33" name="Gironde" parent="B"/> + <iso_3166_2_entry + code="FR-2B" name="Haute-Corse" parent="H"/> + <iso_3166_2_entry + code="FR-31" name="Haute-Garonne" parent="N"/> + <iso_3166_2_entry + code="FR-43" name="Haute-Loire" parent="C"/> + <iso_3166_2_entry + code="FR-52" name="Haute-Marne" parent="G"/> + <iso_3166_2_entry + code="FR-05" name="Hautes-Alpes" parent="U"/> + <iso_3166_2_entry + code="FR-70" name="Haute-Saône" parent="I"/> + <iso_3166_2_entry + code="FR-74" name="Haute-Savoie" parent="V"/> + <iso_3166_2_entry + code="FR-65" name="Hautes-Pyrénées" parent="N"/> + <iso_3166_2_entry + code="FR-87" name="Haute-Vienne" parent="L"/> + <iso_3166_2_entry + code="FR-68" name="Haut-Rhin" parent="A"/> + <iso_3166_2_entry + code="FR-92" name="Hauts-de-Seine" parent="J"/> + <iso_3166_2_entry + code="FR-34" name="Hérault" parent="K"/> + <iso_3166_2_entry + code="FR-35" name="Ille-et-Vilaine" parent="E"/> + <iso_3166_2_entry + code="FR-36" name="Indre" parent="F"/> + <iso_3166_2_entry + code="FR-37" name="Indre-et-Loire" parent="F"/> + <iso_3166_2_entry + code="FR-38" name="Isère" parent="V"/> + <iso_3166_2_entry + code="FR-39" name="Jura" parent="I"/> + <iso_3166_2_entry + code="FR-40" name="Landes" parent="B"/> + <iso_3166_2_entry + code="FR-41" name="Loir-et-Cher" parent="F"/> + <iso_3166_2_entry + code="FR-42" name="Loire" parent="V"/> + <iso_3166_2_entry + code="FR-44" name="Loire-Atlantique" parent="R"/> + <iso_3166_2_entry + code="FR-45" name="Loiret" parent="F"/> + <iso_3166_2_entry + code="FR-46" name="Lot" parent="N"/> + <iso_3166_2_entry + code="FR-47" name="Lot-et-Garonne" parent="B"/> + <iso_3166_2_entry + code="FR-48" name="Lozère" parent="K"/> + <iso_3166_2_entry + code="FR-49" name="Maine-et-Loire" parent="R"/> + <iso_3166_2_entry + code="FR-50" name="Manche" parent="P"/> + <iso_3166_2_entry + code="FR-51" name="Marne" parent="G"/> + <iso_3166_2_entry + code="FR-53" name="Mayenne" parent="R"/> + <iso_3166_2_entry + code="FR-54" name="Meurthe-et-Moselle" parent="M"/> + <iso_3166_2_entry + code="FR-55" name="Meuse" parent="M"/> + <iso_3166_2_entry + code="FR-56" name="Morbihan" parent="E"/> + <iso_3166_2_entry + code="FR-57" name="Moselle" parent="M"/> + <iso_3166_2_entry + code="FR-58" name="Nièvre" parent="D"/> + <iso_3166_2_entry + code="FR-59" name="Nord" parent="O"/> + <iso_3166_2_entry + code="FR-60" name="Oise" parent="S"/> + <iso_3166_2_entry + code="FR-61" name="Orne" parent="P"/> + <iso_3166_2_entry + code="FR-75" name="Paris" parent="J"/> + <iso_3166_2_entry + code="FR-62" name="Pas-de-Calais" parent="O"/> + <iso_3166_2_entry + code="FR-63" name="Puy-de-Dôme" parent="C"/> + <iso_3166_2_entry + code="FR-64" name="Pyrénées-Atlantiques" parent="B"/> + <iso_3166_2_entry + code="FR-66" name="Pyrénées-Orientales" parent="K"/> + <iso_3166_2_entry + code="FR-69" name="Rhône" parent="V"/> + <iso_3166_2_entry + code="FR-71" name="Saône-et-Loire" parent="D"/> + <iso_3166_2_entry + code="FR-72" name="Sarthe" parent="R"/> + <iso_3166_2_entry + code="FR-73" name="Savoie" parent="V"/> + <iso_3166_2_entry + code="FR-77" name="Seine-et-Marne" parent="J"/> + <iso_3166_2_entry + code="FR-76" name="Seine-Maritime" parent="Q"/> + <iso_3166_2_entry + code="FR-93" name="Seine-Saint-Denis" parent="J"/> + <iso_3166_2_entry + code="FR-80" name="Somme" parent="S"/> + <iso_3166_2_entry + code="FR-81" name="Tarn" parent="N"/> + <iso_3166_2_entry + code="FR-82" name="Tarn-et-Garonne" parent="N"/> + <iso_3166_2_entry + code="FR-90" name="Territoire de Belfort" parent="I"/> + <iso_3166_2_entry + code="FR-94" name="Val-de-Marne" parent="J"/> + <iso_3166_2_entry + code="FR-95" name="Val d'Oise" parent="J"/> + <iso_3166_2_entry + code="FR-83" name="Var" parent="U"/> + <iso_3166_2_entry + code="FR-84" name="Vaucluse" parent="U"/> + <iso_3166_2_entry + code="FR-85" name="Vendée" parent="R"/> + <iso_3166_2_entry + code="FR-86" name="Vienne" parent="T"/> + <iso_3166_2_entry + code="FR-88" name="Vosges" parent="M"/> + <iso_3166_2_entry + code="FR-89" name="Yonne" parent="D"/> + <iso_3166_2_entry + code="FR-78" name="Yvelines" parent="J"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="FR-CP" name="Clipperton"/> + </iso_3166_subset> + <iso_3166_subset type="Overseas territorial collectivity"> + <iso_3166_2_entry + code="FR-YT" name="Mayotte"/> + <iso_3166_2_entry + code="FR-NC" name="Nouvelle-Calédonie"/> + <iso_3166_2_entry + code="FR-PF" name="Polynésie française"/> + <iso_3166_2_entry + code="FR-BL" name="Saint-Barthélemy"/> + <iso_3166_2_entry + code="FR-MF" name="Saint-Martin"/> + <iso_3166_2_entry + code="FR-PM" name="Saint-Pierre-et-Miquelon"/> + <iso_3166_2_entry + code="FR-TF" name="Terres australes françaises"/> + <iso_3166_2_entry + code="FR-WF" name="Wallis-et-Futuna"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Gabon --> + <iso_3166_country code="GA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GA-1" name="Estuaire"/> + <iso_3166_2_entry + code="GA-2" name="Haut-Ogooué"/> + <iso_3166_2_entry + code="GA-3" name="Moyen-Ogooué"/> + <iso_3166_2_entry + code="GA-4" name="Ngounié"/> + <iso_3166_2_entry + code="GA-5" name="Nyanga"/> + <iso_3166_2_entry + code="GA-6" name="Ogooué-Ivindo"/> + <iso_3166_2_entry + code="GA-7" name="Ogooué-Lolo"/> + <iso_3166_2_entry + code="GA-8" name="Ogooué-Maritime"/> + <iso_3166_2_entry + code="GA-9" name="Woleu-Ntem"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United Kingdom --> + <iso_3166_country code="GB"> + <iso_3166_subset type="Country"> + <iso_3166_2_entry + code="GB ENG" name="England"/> + <iso_3166_2_entry + code="GB SCT" name="Scotland"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GB NIR" name="Northern Ireland"/> + </iso_3166_subset> + <iso_3166_subset type="Principality"> + <iso_3166_2_entry + code="GB WLS" name="Wales"/> + </iso_3166_subset> + <iso_3166_subset type="Included for completeness"> + <iso_3166_2_entry + code="GB EAW" name="England and Wales"/> + <iso_3166_2_entry + code="GB GBN" name="Great Britain"/> + <iso_3166_2_entry + code="GB UKM" name="United Kingdom"/> + </iso_3166_subset> + <iso_3166_subset type="Two-tier county"> + <iso_3166_2_entry + code="GB-BKM" name="Buckinghamshire"/> + <iso_3166_2_entry + code="GB-CAM" name="Cambridgeshire"/> + <iso_3166_2_entry + code="GB-CMA" name="Cumbria"/> + <iso_3166_2_entry + code="GB-DBY" name="Derbyshire"/> + <iso_3166_2_entry + code="GB-DEV" name="Devon"/> + <iso_3166_2_entry + code="GB-DOR" name="Dorset"/> + <iso_3166_2_entry + code="GB-ESX" name="East Sussex"/> + <iso_3166_2_entry + code="GB-ESS" name="Essex"/> + <iso_3166_2_entry + code="GB-GLS" name="Gloucestershire"/> + <iso_3166_2_entry + code="GB-HAM" name="Hampshire"/> + <iso_3166_2_entry + code="GB-HRT" name="Hertfordshire"/> + <iso_3166_2_entry + code="GB-KEN" name="Kent"/> + <iso_3166_2_entry + code="GB-LAN" name="Lancashire"/> + <iso_3166_2_entry + code="GB-LEC" name="Leicestershire"/> + <iso_3166_2_entry + code="GB-LIN" name="Lincolnshire"/> + <iso_3166_2_entry + code="GB-NFK" name="Norfolk"/> + <iso_3166_2_entry + code="GB-NYK" name="North Yorkshire"/> + <iso_3166_2_entry + code="GB-NTH" name="Northamptonshire"/> + <iso_3166_2_entry + code="GB-NTT" name="Nottinghamshire"/> + <iso_3166_2_entry + code="GB-OXF" name="Oxfordshire"/> + <iso_3166_2_entry + code="GB-SOM" name="Somerset"/> + <iso_3166_2_entry + code="GB-STS" name="Staffordshire"/> + <iso_3166_2_entry + code="GB-SFK" name="Suffolk"/> + <iso_3166_2_entry + code="GB-SRY" name="Surrey"/> + <iso_3166_2_entry + code="GB-WAR" name="Warwickshire"/> + <iso_3166_2_entry + code="GB-WSX" name="West Sussex"/> + <iso_3166_2_entry + code="GB-WOR" name="Worcestershire"/> + </iso_3166_subset> + <iso_3166_subset type="London borough"> + <iso_3166_2_entry + code="GB-BDG" name="Barking and Dagenham"/> + <iso_3166_2_entry + code="GB-BNE" name="Barnet"/> + <iso_3166_2_entry + code="GB-BEX" name="Bexley"/> + <iso_3166_2_entry + code="GB-BEN" name="Brent"/> + <iso_3166_2_entry + code="GB-BRY" name="Bromley"/> + <iso_3166_2_entry + code="GB-CMD" name="Camden"/> + <iso_3166_2_entry + code="GB-CRY" name="Croydon"/> + <iso_3166_2_entry + code="GB-EAL" name="Ealing"/> + <iso_3166_2_entry + code="GB-ENF" name="Enfield"/> + <iso_3166_2_entry + code="GB-GRE" name="Greenwich"/> + <iso_3166_2_entry + code="GB-HCK" name="Hackney"/> + <iso_3166_2_entry + code="GB-HMF" name="Hammersmith and Fulham"/> + <iso_3166_2_entry + code="GB-HRY" name="Haringey"/> + <iso_3166_2_entry + code="GB-HRW" name="Harrow"/> + <iso_3166_2_entry + code="GB-HAV" name="Havering"/> + <iso_3166_2_entry + code="GB-HIL" name="Hillingdon"/> + <iso_3166_2_entry + code="GB-HNS" name="Hounslow"/> + <iso_3166_2_entry + code="GB-ISL" name="Islington"/> + <iso_3166_2_entry + code="GB-KEC" name="Kensington and Chelsea"/> + <iso_3166_2_entry + code="GB-KTT" name="Kingston upon Thames"/> + <iso_3166_2_entry + code="GB-LBH" name="Lambeth"/> + <iso_3166_2_entry + code="GB-LEW" name="Lewisham"/> + <iso_3166_2_entry + code="GB-MRT" name="Merton"/> + <iso_3166_2_entry + code="GB-NWM" name="Newham"/> + <iso_3166_2_entry + code="GB-RDB" name="Redbridge"/> + <iso_3166_2_entry + code="GB-RIC" name="Richmond upon Thames"/> + <iso_3166_2_entry + code="GB-SWK" name="Southwark"/> + <iso_3166_2_entry + code="GB-STN" name="Sutton"/> + <iso_3166_2_entry + code="GB-TWH" name="Tower Hamlets"/> + <iso_3166_2_entry + code="GB-WFT" name="Waltham Forest"/> + <iso_3166_2_entry + code="GB-WND" name="Wandsworth"/> + <iso_3166_2_entry + code="GB-WSM" name="Westminster"/> + </iso_3166_subset> + <iso_3166_subset type="Metropolitan district"> + <iso_3166_2_entry + code="GB-BNS" name="Barnsley"/> + <iso_3166_2_entry + code="GB-BIR" name="Birmingham"/> + <iso_3166_2_entry + code="GB-BOL" name="Bolton"/> + <iso_3166_2_entry + code="GB-BRD" name="Bradford"/> + <iso_3166_2_entry + code="GB-BUR" name="Bury"/> + <iso_3166_2_entry + code="GB-CLD" name="Calderdale"/> + <iso_3166_2_entry + code="GB-COV" name="Coventry"/> + <iso_3166_2_entry + code="GB-DNC" name="Doncaster"/> + <iso_3166_2_entry + code="GB-DUD" name="Dudley"/> + <iso_3166_2_entry + code="GB-GAT" name="Gateshead"/> + <iso_3166_2_entry + code="GB-KIR" name="Kirklees"/> + <iso_3166_2_entry + code="GB-KWL" name="Knowsley"/> + <iso_3166_2_entry + code="GB-LDS" name="Leeds"/> + <iso_3166_2_entry + code="GB-LIV" name="Liverpool"/> + <iso_3166_2_entry + code="GB-MAN" name="Manchester"/> + <iso_3166_2_entry + code="GB-NET" name="Newcastle upon Tyne"/> + <iso_3166_2_entry + code="GB-NTY" name="North Tyneside"/> + <iso_3166_2_entry + code="GB-OLD" name="Oldham"/> + <iso_3166_2_entry + code="GB-RCH" name="Rochdale"/> + <iso_3166_2_entry + code="GB-ROT" name="Rotherham"/> + <iso_3166_2_entry + code="GB-SHN" name="St. Helens"/> + <iso_3166_2_entry + code="GB-SLF" name="Salford"/> + <iso_3166_2_entry + code="GB-SAW" name="Sandwell"/> + <iso_3166_2_entry + code="GB-SFT" name="Sefton"/> + <iso_3166_2_entry + code="GB-SHF" name="Sheffield"/> + <iso_3166_2_entry + code="GB-SOL" name="Solihull"/> + <iso_3166_2_entry + code="GB-STY" name="South Tyneside"/> + <iso_3166_2_entry + code="GB-SKP" name="Stockport"/> + <iso_3166_2_entry + code="GB-SND" name="Sunderland"/> + <iso_3166_2_entry + code="GB-TAM" name="Tameside"/> + <iso_3166_2_entry + code="GB-TRF" name="Trafford"/> + <iso_3166_2_entry + code="GB-WKF" name="Wakefield"/> + <iso_3166_2_entry + code="GB-WLL" name="Walsall"/> + <iso_3166_2_entry + code="GB-WGN" name="Wigan"/> + <iso_3166_2_entry + code="GB-WRL" name="Wirral"/> + <iso_3166_2_entry + code="GB-WLV" name="Wolverhampton"/> + </iso_3166_subset> + <iso_3166_subset type="City corporation"> + <iso_3166_2_entry + code="GB-LND" name="London, City of"/> + </iso_3166_subset> + <iso_3166_subset type="Council area"> + <iso_3166_2_entry + code="GB-ABE" name="Aberdeen City"/> + <iso_3166_2_entry + code="GB-ABD" name="Aberdeenshire"/> + <iso_3166_2_entry + code="GB-ANS" name="Angus"/> + <iso_3166_2_entry + code="GB-AGB" name="Argyll and Bute"/> + <iso_3166_2_entry + code="GB-CLK" name="Clackmannanshire"/> + <iso_3166_2_entry + code="GB-DGY" name="Dumfries and Galloway"/> + <iso_3166_2_entry + code="GB-DND" name="Dundee City"/> + <iso_3166_2_entry + code="GB-EAY" name="East Ayrshire"/> + <iso_3166_2_entry + code="GB-EDU" name="East Dunbartonshire"/> + <iso_3166_2_entry + code="GB-ELN" name="East Lothian"/> + <iso_3166_2_entry + code="GB-ERW" name="East Renfrewshire"/> + <iso_3166_2_entry + code="GB-EDH" name="Edinburgh, City of"/> + <iso_3166_2_entry + code="GB-ELS" name="Eilean Siar"/> + <iso_3166_2_entry + code="GB-FAL" name="Falkirk"/> + <iso_3166_2_entry + code="GB-FIF" name="Fife"/> + <iso_3166_2_entry + code="GB-GLG" name="Glasgow City"/> + <iso_3166_2_entry + code="GB-HED" name="Highland"/> + <iso_3166_2_entry + code="GB-IVC" name="Inverclyde"/> + <iso_3166_2_entry + code="GB-MLN" name="Midlothian"/> + <iso_3166_2_entry + code="GB-MRY" name="Moray"/> + <iso_3166_2_entry + code="GB-NAY" name="North Ayrshire"/> + <iso_3166_2_entry + code="GB-NLK" name="North Lanarkshire"/> + <iso_3166_2_entry + code="GB-ORR" name="Orkney Islands"/> + <iso_3166_2_entry + code="GB-PKN" name="Perth and Kinross"/> + <iso_3166_2_entry + code="GB-RFW" name="Renfrewshire"/> + <iso_3166_2_entry + code="GB-SCB" name="Scottish Borders, The"/> + <iso_3166_2_entry + code="GB-ZET" name="Shetland Islands"/> + <iso_3166_2_entry + code="GB-SAY" name="South Ayrshire"/> + <iso_3166_2_entry + code="GB-SLK" name="South Lanarkshire"/> + <iso_3166_2_entry + code="GB-STG" name="Stirling"/> + <iso_3166_2_entry + code="GB-WDU" name="West Dunbartonshire"/> + <iso_3166_2_entry + code="GB-WLN" name="West Lothian"/> + </iso_3166_subset> + <iso_3166_subset type="District council area"> + <iso_3166_2_entry + code="GB-ANT" name="Antrim"/> + <iso_3166_2_entry + code="GB-ARD" name="Ards"/> + <iso_3166_2_entry + code="GB-ARM" name="Armagh"/> + <iso_3166_2_entry + code="GB-BLA" name="Ballymena"/> + <iso_3166_2_entry + code="GB-BLY" name="Ballymoney"/> + <iso_3166_2_entry + code="GB-BNB" name="Banbridge"/> + <iso_3166_2_entry + code="GB-BFS" name="Belfast"/> + <iso_3166_2_entry + code="GB-CKF" name="Carrickfergus"/> + <iso_3166_2_entry + code="GB-CSR" name="Castlereagh"/> + <iso_3166_2_entry + code="GB-CLR" name="Coleraine"/> + <iso_3166_2_entry + code="GB-CKT" name="Cookstown"/> + <iso_3166_2_entry + code="GB-CGV" name="Craigavon"/> + <iso_3166_2_entry + code="GB-DRY" name="Derry"/> + <iso_3166_2_entry + code="GB-DOW" name="Down"/> + <iso_3166_2_entry + code="GB-DGN" name="Dungannon"/> + <iso_3166_2_entry + code="GB-FER" name="Fermanagh"/> + <iso_3166_2_entry + code="GB-LRN" name="Larne"/> + <iso_3166_2_entry + code="GB-LMV" name="Limavady"/> + <iso_3166_2_entry + code="GB-LSB" name="Lisburn"/> + <iso_3166_2_entry + code="GB-MFT" name="Magherafelt"/> + <iso_3166_2_entry + code="GB-MYL" name="Moyle"/> + <iso_3166_2_entry + code="GB-NYM" name="Newry and Mourne"/> + <iso_3166_2_entry + code="GB-NTA" name="Newtownabbey"/> + <iso_3166_2_entry + code="GB-NDN" name="North Down"/> + <iso_3166_2_entry + code="GB-OMH" name="Omagh"/> + <iso_3166_2_entry + code="GB-STB" name="Strabane"/> + </iso_3166_subset> + <iso_3166_subset type="Unitary authority (England)"> + <iso_3166_2_entry + code="GB-BAS" name="Bath and North East Somerset"/> + <iso_3166_2_entry + code="GB-BBD" name="Blackburn with Darwen"/> + <iso_3166_2_entry + code="GB-BDF" name="Bedford"/> + <iso_3166_2_entry + code="GB-BPL" name="Blackpool"/> + <iso_3166_2_entry + code="GB-BMH" name="Bournemouth"/> + <iso_3166_2_entry + code="GB-BRC" name="Bracknell Forest"/> + <iso_3166_2_entry + code="GB-BNH" name="Brighton and Hove"/> + <iso_3166_2_entry + code="GB-BST" name="Bristol, City of"/> + <iso_3166_2_entry + code="GB-CBF" name="Central Bedfordshire"/> + <iso_3166_2_entry + code="GB-CHE" name="Cheshire East"/> + <iso_3166_2_entry + code="GB-CHW" name="Cheshire West and Chester"/> + <iso_3166_2_entry + code="GB-CON" name="Cornwall"/> + <iso_3166_2_entry + code="GB-DAL" name="Darlington"/> + <iso_3166_2_entry + code="GB-DER" name="Derby"/> + <iso_3166_2_entry + code="GB-DUR" name="Durham"/> + <iso_3166_2_entry + code="GB-ERY" name="East Riding of Yorkshire"/> + <iso_3166_2_entry + code="GB-HAL" name="Halton"/> + <iso_3166_2_entry + code="GB-HPL" name="Hartlepool"/> + <iso_3166_2_entry + code="GB-HEF" name="Herefordshire"/> + <iso_3166_2_entry + code="GB-IOW" name="Isle of Wight"/> + <iso_3166_2_entry + code="GB-KHL" name="Kingston upon Hull"/> + <iso_3166_2_entry + code="GB-LCE" name="Leicester"/> + <iso_3166_2_entry + code="GB-LUT" name="Luton"/> + <iso_3166_2_entry + code="GB-MDW" name="Medway"/> + <iso_3166_2_entry + code="GB-MDB" name="Middlesbrough"/> + <iso_3166_2_entry + code="GB-MIK" name="Milton Keynes"/> + <iso_3166_2_entry + code="GB-NEL" name="North East Lincolnshire"/> + <iso_3166_2_entry + code="GB-NLN" name="North Lincolnshire"/> + <iso_3166_2_entry + code="GB-NSM" name="North Somerset"/> + <iso_3166_2_entry + code="GB-NBL" name="Northumberland"/> + <iso_3166_2_entry + code="GB-NGM" name="Nottingham"/> + <iso_3166_2_entry + code="GB-PTE" name="Peterborough"/> + <iso_3166_2_entry + code="GB-PLY" name="Plymouth"/> + <iso_3166_2_entry + code="GB-POL" name="Poole"/> + <iso_3166_2_entry + code="GB-POR" name="Portsmouth"/> + <iso_3166_2_entry + code="GB-RDG" name="Reading"/> + <iso_3166_2_entry + code="GB-RCC" name="Redcar and Cleveland"/> + <iso_3166_2_entry + code="GB-RUT" name="Rutland"/> + <iso_3166_2_entry + code="GB-SHR" name="Shropshire"/> + <iso_3166_2_entry + code="GB-SLG" name="Slough"/> + <iso_3166_2_entry + code="GB-SGC" name="South Gloucestershire"/> + <iso_3166_2_entry + code="GB-STH" name="Southampton"/> + <iso_3166_2_entry + code="GB-SOS" name="Southend-on-Sea"/> + <iso_3166_2_entry + code="GB-STT" name="Stockton-on-Tees"/> + <iso_3166_2_entry + code="GB-STE" name="Stoke-on-Trent"/> + <iso_3166_2_entry + code="GB-SWD" name="Swindon"/> + <iso_3166_2_entry + code="GB-TFW" name="Telford and Wrekin"/> + <iso_3166_2_entry + code="GB-THR" name="Thurrock"/> + <iso_3166_2_entry + code="GB-TOB" name="Torbay"/> + <iso_3166_2_entry + code="GB-WRT" name="Warrington"/> + <iso_3166_2_entry + code="GB-WBX" name="West Berkshire"/> + <iso_3166_2_entry + code="GB-WNM" name="Windsor and Maidenhead"/> + <iso_3166_2_entry + code="GB-WOK" name="Wokingham"/> + <iso_3166_2_entry + code="GB-YOR" name="York"/> + </iso_3166_subset> + <iso_3166_subset type="Unitary authority (Wales)"> + <iso_3166_2_entry + code="GB-BGW" name="Blaenau Gwent"/> + <iso_3166_2_entry + code="GB-BGE" name="Bridgend;Pen-y-bont ar Ogwr"/> + <iso_3166_2_entry + code="GB-CAY" name="Caerphilly;Caerffili"/> + <iso_3166_2_entry + code="GB-CRF" name="Cardiff;Caerdydd"/> + <iso_3166_2_entry + code="GB-CMN" name="Carmarthenshire;Sir Gaerfyrddin"/> + <iso_3166_2_entry + code="GB-CGN" name="Ceredigion;Sir Ceredigion"/> + <iso_3166_2_entry + code="GB-CWY" name="Conwy"/> + <iso_3166_2_entry + code="GB-DEN" name="Denbighshire;Sir Ddinbych"/> + <iso_3166_2_entry + code="GB-FLN" name="Flintshire;Sir y Fflint"/> + <iso_3166_2_entry + code="GB-GWN" name="Gwynedd"/> + <iso_3166_2_entry + code="GB-AGY" name="Isle of Anglesey;Sir Ynys Môn"/> + <iso_3166_2_entry + code="GB-MTY" name="Merthyr Tydfil;Merthyr Tudful"/> + <iso_3166_2_entry + code="GB-MON" name="Monmouthshire;Sir Fynwy"/> + <iso_3166_2_entry + code="GB-NTL" name="Neath Port Talbot;Castell-nedd Port Talbot"/> + <iso_3166_2_entry + code="GB-NWP" name="Newport;Casnewydd"/> + <iso_3166_2_entry + code="GB-PEM" name="Pembrokeshire;Sir Benfro"/> + <iso_3166_2_entry + code="GB-POW" name="Powys"/> + <iso_3166_2_entry + code="GB-RCT" name="Rhondda, Cynon, Taff;Rhondda, Cynon,Taf"/> + <iso_3166_2_entry + code="GB-SWA" name="Swansea;Abertawe"/> + <iso_3166_2_entry + code="GB-TOF" name="Torfaen;Tor-faen"/> + <iso_3166_2_entry + code="GB-VGL" name="Vale of Glamorgan, The;Bro Morgannwg"/> + <iso_3166_2_entry + code="GB-WRX" name="Wrexham;Wrecsam"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Grenada --> + <iso_3166_country code="GD"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="GD-01" name="Saint Andrew"/> + <iso_3166_2_entry + code="GD-02" name="Saint David"/> + <iso_3166_2_entry + code="GD-03" name="Saint George"/> + <iso_3166_2_entry + code="GD-04" name="Saint John"/> + <iso_3166_2_entry + code="GD-05" name="Saint Mark"/> + <iso_3166_2_entry + code="GD-06" name="Saint Patrick"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="GD-10" name="Southern Grenadine Islands"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Georgia --> + <iso_3166_country code="GE"> + <iso_3166_subset type="Autonomous republic"> + <iso_3166_2_entry + code="GE-AB" name="Abkhazia"/> + <iso_3166_2_entry + code="GE-AJ" name="Ajaria"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="GE-TB" name="T’bilisi"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GE-GU" name="Guria"/> + <iso_3166_2_entry + code="GE-IM" name="Imeret’i"/> + <iso_3166_2_entry + code="GE-KA" name="Kakhet’i"/> + <iso_3166_2_entry + code="GE-KK" name="K’vemo K’art’li"/> + <iso_3166_2_entry + code="GE-MM" name="Mts’khet’a-Mt’ianet’i"/> + <iso_3166_2_entry + code="GE-RL" name="Racha-Lech’khumi-K’vemo Svanet’i"/> + <iso_3166_2_entry + code="GE-SZ" name="Samegrelo-Zemo Svanet’i"/> + <iso_3166_2_entry + code="GE-SJ" name="Samts’khe-Javakhet’i"/> + <iso_3166_2_entry + code="GE-SK" name="Shida K’art’li"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guernsey --> + <iso_3166_country code="GG"> + </iso_3166_country> + <!-- Ghana --> + <iso_3166_country code="GH"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GH-AH" name="Ashanti"/> + <iso_3166_2_entry + code="GH-BA" name="Brong-Ahafo"/> + <iso_3166_2_entry + code="GH-CP" name="Central"/> + <iso_3166_2_entry + code="GH-EP" name="Eastern"/> + <iso_3166_2_entry + code="GH-AA" name="Greater Accra"/> + <iso_3166_2_entry + code="GH-NP" name="Northern"/> + <iso_3166_2_entry + code="GH-UE" name="Upper East"/> + <iso_3166_2_entry + code="GH-UW" name="Upper West"/> + <iso_3166_2_entry + code="GH-TV" name="Volta"/> + <iso_3166_2_entry + code="GH-WP" name="Western"/> + </iso_3166_subset> + <!-- Greenland --> + <iso_3166_country code="GL"/> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="GL-KU" name="Kommune Kujalleq"/> + <iso_3166_2_entry + code="GL-SM" name="Kommuneqarfik Sermersooq"/> + <iso_3166_2_entry + code="GL-QA" name="Qaasuitsup Kommunia"/> + <iso_3166_2_entry + code="GL-QE" name="Qeqqata Kommunia"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Gambia --> + <iso_3166_country code="GM"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="GM-L" name="Lower River"/> + <iso_3166_2_entry + code="GM-M" name="Central River"/> + <iso_3166_2_entry + code="GM-N" name="North Bank"/> + <iso_3166_2_entry + code="GM-U" name="Upper River"/> + <iso_3166_2_entry + code="GM-W" name="Western"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="GM-B" name="Banjul"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guinea --> + <iso_3166_country code="GN"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="GN-B" name="Boké"/> + <iso_3166_2_entry + code="GN-F" name="Faranah"/> + <iso_3166_2_entry + code="GN-K" name="Kankan"/> + <iso_3166_2_entry + code="GN-D" name="Kindia"/> + <iso_3166_2_entry + code="GN-L" name="Labé"/> + <iso_3166_2_entry + code="GN-M" name="Mamou"/> + <iso_3166_2_entry + code="GN-N" name="Nzérékoré"/> + </iso_3166_subset> + <iso_3166_subset type="Special zone"> + <iso_3166_2_entry + code="GN C" name="Conakry"/> + </iso_3166_subset> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="GN-BE" name="Beyla" parent="N"/> + <iso_3166_2_entry + code="GN-BF" name="Boffa" parent="B"/> + <iso_3166_2_entry + code="GN-BK" name="Boké" parent="B"/> + <iso_3166_2_entry + code="GN-CO" name="Coyah" parent="D"/> + <iso_3166_2_entry + code="GN-DB" name="Dabola" parent="F"/> + <iso_3166_2_entry + code="GN-DL" name="Dalaba" parent="M"/> + <iso_3166_2_entry + code="GN-DI" name="Dinguiraye" parent="F"/> + <iso_3166_2_entry + code="GN-DU" name="Dubréka" parent="D"/> + <iso_3166_2_entry + code="GN-FA" name="Faranah" parent="F"/> + <iso_3166_2_entry + code="GN-FO" name="Forécariah" parent="D"/> + <iso_3166_2_entry + code="GN-FR" name="Fria" parent="B"/> + <iso_3166_2_entry + code="GN-GA" name="Gaoual" parent="B"/> + <iso_3166_2_entry + code="GN-GU" name="Guékédou" parent="N"/> + <iso_3166_2_entry + code="GN-KA" name="Kankan" parent="K"/> + <iso_3166_2_entry + code="GN-KE" name="Kérouané" parent="K"/> + <iso_3166_2_entry + code="GN-KD" name="Kindia" parent="D"/> + <iso_3166_2_entry + code="GN-KS" name="Kissidougou" parent="F"/> + <iso_3166_2_entry + code="GN-KB" name="Koubia" parent="L"/> + <iso_3166_2_entry + code="GN-KN" name="Koundara" parent="B"/> + <iso_3166_2_entry + code="GN-KO" name="Kouroussa" parent="K"/> + <iso_3166_2_entry + code="GN-LA" name="Labé" parent="L"/> + <iso_3166_2_entry + code="GN-LE" name="Lélouma" parent="L"/> + <iso_3166_2_entry + code="GN-LO" name="Lola" parent="N"/> + <iso_3166_2_entry + code="GN-MC" name="Macenta" parent="N"/> + <iso_3166_2_entry + code="GN-ML" name="Mali" parent="L"/> + <iso_3166_2_entry + code="GN-MM" name="Mamou" parent="M"/> + <iso_3166_2_entry + code="GN-MD" name="Mandiana" parent="K"/> + <iso_3166_2_entry + code="GN-NZ" name="Nzérékoré" parent="N"/> + <iso_3166_2_entry + code="GN-PI" name="Pita" parent="M"/> + <iso_3166_2_entry + code="GN-SI" name="Siguiri" parent="K"/> + <iso_3166_2_entry + code="GN-TE" name="Télimélé" parent="D"/> + <iso_3166_2_entry + code="GN-TO" name="Tougué" parent="L"/> + <iso_3166_2_entry + code="GN-YO" name="Yomou" parent="N"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Equatorial Guinea --> + <iso_3166_country code="GQ"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GQ-C" name="Región Continental"/> + <iso_3166_2_entry + code="GQ-I" name="Región Insular"/> + <iso_3166_2_entry + code="GQ-AN" name="Annobón"/> + <iso_3166_2_entry + code="GQ-BN" name="Bioko Norte"/> + <iso_3166_2_entry + code="GQ-BS" name="Bioko Sur"/> + <iso_3166_2_entry + code="GQ-CS" name="Centro Sur"/> + <iso_3166_2_entry + code="GQ-KN" name="Kié-Ntem"/> + <iso_3166_2_entry + code="GQ-LI" name="Litoral"/> + <iso_3166_2_entry + code="GQ-WN" name="Wele-Nzás"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Greece --> + <iso_3166_country code="GR"> + <iso_3166_subset type="Administrative region"> + <iso_3166_2_entry + code="GR-A" name="Anatoliki Makedonia kai Thraki"/> + <iso_3166_2_entry + code="GR-I" name="Attiki"/> + <iso_3166_2_entry + code="GR-G" name="Dytiki Ellada"/> + <iso_3166_2_entry + code="GR-C" name="Dytiki Makedonia"/> + <iso_3166_2_entry + code="GR-F" name="Ionia Nisia"/> + <iso_3166_2_entry + code="GR-D" name="Ipeiros"/> + <iso_3166_2_entry + code="GR-B" name="Kentriki Makedonia"/> + <iso_3166_2_entry + code="GR-M" name="Kriti"/> + <iso_3166_2_entry + code="GR-L" name="Notio Aigaio"/> + <iso_3166_2_entry + code="GR-J" name="Peloponnisos"/> + <iso_3166_2_entry + code="GR-H" name="Sterea Ellada"/> + <iso_3166_2_entry + code="GR-E" name="Thessalia"/> + <iso_3166_2_entry + code="GR-K" name="Voreio Aigaio"/> + </iso_3166_subset> + <iso_3166_subset type="Self-governed part"> + <iso_3166_2_entry + code="GR-69" name="Agio Oros"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="GR-13" name="Achaïa" parent="G"/> + <iso_3166_2_entry + code="GR-01" name="Aitolia kai Akarnania" parent="G"/> + <iso_3166_2_entry + code="GR-11" name="Argolida" parent="J"/> + <iso_3166_2_entry + code="GR-12" name="Arkadia" parent="J"/> + <iso_3166_2_entry + code="GR-31" name="Arta" parent="F"/> + <iso_3166_2_entry + code="GR-A1" name="Attiki" parent="I"/> + <iso_3166_2_entry + code="GR-64" name="Chalkidiki" parent="B"/> + <iso_3166_2_entry + code="GR-94" name="Chania" parent="M"/> + <iso_3166_2_entry + code="GR-85" name="Chios" parent="K"/> + <iso_3166_2_entry + code="GR-81" name="Dodekanisos" parent="L"/> + <iso_3166_2_entry + code="GR-52" name="Drama" parent="A"/> + <iso_3166_2_entry + code="GR-71" name="Evros" parent="A"/> + <iso_3166_2_entry + code="GR-05" name="Evrytania" parent="H"/> + <iso_3166_2_entry + code="GR-04" name="Evvoias" parent="H"/> + <iso_3166_2_entry + code="GR-63" name="Florina" parent="C"/> + <iso_3166_2_entry + code="GR-07" name="Fokida" parent="H"/> + <iso_3166_2_entry + code="GR-06" name="Fthiotida" parent="H"/> + <iso_3166_2_entry + code="GR-51" name="Grevena" parent="C"/> + <iso_3166_2_entry + code="GR-14" name="Ileia" parent="G"/> + <iso_3166_2_entry + code="GR-53" name="Imathia" parent="B"/> + <iso_3166_2_entry + code="GR-33" name="Ioannina" parent="D"/> + <iso_3166_2_entry + code="GR-91" name="Irakleio" parent="M"/> + <iso_3166_2_entry + code="GR-41" name="Karditsa" parent="E"/> + <iso_3166_2_entry + code="GR-56" name="Kastoria" parent="C"/> + <iso_3166_2_entry + code="GR-55" name="Kavala" parent="A"/> + <iso_3166_2_entry + code="GR-23" name="Kefallonia" parent="F"/> + <iso_3166_2_entry + code="GR-22" name="Kerkyra" parent="F"/> + <iso_3166_2_entry + code="GR-57" name="Kilkis" parent="B"/> + <iso_3166_2_entry + code="GR-15" name="Korinthia" parent="J"/> + <iso_3166_2_entry + code="GR-58" name="Kozani" parent="C"/> + <iso_3166_2_entry + code="GR-82" name="Kyklades" parent="L"/> + <iso_3166_2_entry + code="GR-16" name="Lakonia" parent="J"/> + <iso_3166_2_entry + code="GR-42" name="Larisa" parent="E"/> + <iso_3166_2_entry + code="GR-92" name="Lasithi" parent="M"/> + <iso_3166_2_entry + code="GR-24" name="Lefkada" parent="F"/> + <iso_3166_2_entry + code="GR-83" name="Lesvos" parent="K"/> + <iso_3166_2_entry + code="GR-43" name="Magnisia" parent="E"/> + <iso_3166_2_entry + code="GR-17" name="Messinia" parent="J"/> + <iso_3166_2_entry + code="GR-59" name="Pella" parent="B"/> + <iso_3166_2_entry + code="GR-61" name="Pieria" parent="B"/> + <iso_3166_2_entry + code="GR-34" name="Preveza" parent="D"/> + <iso_3166_2_entry + code="GR-93" name="Rethymno" parent="M"/> + <iso_3166_2_entry + code="GR-73" name="Rodopi" parent="A"/> + <iso_3166_2_entry + code="GR-84" name="Samos" parent="K"/> + <iso_3166_2_entry + code="GR-62" name="Serres" parent="B"/> + <iso_3166_2_entry + code="GR-32" name="Thesprotia" parent="D"/> + <iso_3166_2_entry + code="GR-54" name="Thessaloniki" parent="B"/> + <iso_3166_2_entry + code="GR-44" name="Trikala" parent="E"/> + <iso_3166_2_entry + code="GR-03" name="Voiotia" parent="H"/> + <iso_3166_2_entry + code="GR-72" name="Xanthi" parent="A"/> + <iso_3166_2_entry + code="GR-21" name="Zakynthos" parent="F"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guatemala --> + <iso_3166_country code="GT"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="GT-AV" name="Alta Verapaz"/> + <iso_3166_2_entry + code="GT-BV" name="Baja Verapaz"/> + <iso_3166_2_entry + code="GT-CM" name="Chimaltenango"/> + <iso_3166_2_entry + code="GT-CQ" name="Chiquimula"/> + <iso_3166_2_entry + code="GT-PR" name="El Progreso"/> + <iso_3166_2_entry + code="GT-ES" name="Escuintla"/> + <iso_3166_2_entry + code="GT-GU" name="Guatemala"/> + <iso_3166_2_entry + code="GT-HU" name="Huehuetenango"/> + <iso_3166_2_entry + code="GT-IZ" name="Izabal"/> + <iso_3166_2_entry + code="GT-JA" name="Jalapa"/> + <iso_3166_2_entry + code="GT-JU" name="Jutiapa"/> + <iso_3166_2_entry + code="GT-PE" name="Petén"/> + <iso_3166_2_entry + code="GT-QZ" name="Quetzaltenango"/> + <iso_3166_2_entry + code="GT-QC" name="Quiché"/> + <iso_3166_2_entry + code="GT-RE" name="Retalhuleu"/> + <iso_3166_2_entry + code="GT-SA" name="Sacatepéquez"/> + <iso_3166_2_entry + code="GT-SM" name="San Marcos"/> + <iso_3166_2_entry + code="GT-SR" name="Santa Rosa"/> + <iso_3166_2_entry + code="GT-SO" name="Sololá"/> + <iso_3166_2_entry + code="GT-SU" name="Suchitepéquez"/> + <iso_3166_2_entry + code="GT-TO" name="Totonicapán"/> + <iso_3166_2_entry + code="GT-ZA" name="Zacapa"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guinea-Bissau --> + <iso_3166_country code="GW"> + <iso_3166_subset type="Autonomous sector"> + <iso_3166_2_entry + code="GW-BS" name="Bissau"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="GW-L" name="Leste"/> + <iso_3166_2_entry + code="GW-N" name="Norte"/> + <iso_3166_2_entry + code="GW-S" name="Sul"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GW-BA" name="Bafatá" parent="L"/> + <iso_3166_2_entry + code="GW-BM" name="Biombo" parent="N"/> + <iso_3166_2_entry + code="GW-BL" name="Bolama" parent="S"/> + <iso_3166_2_entry + code="GW-CA" name="Cacheu" parent="N"/> + <iso_3166_2_entry + code="GW-GA" name="Gabú" parent="L"/> + <iso_3166_2_entry + code="GW-OI" name="Oio" parent="N"/> + <iso_3166_2_entry + code="GW-QU" name="Quinara" parent="S"/> + <iso_3166_2_entry + code="GW-TO" name="Tombali" parent="S"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Guyana --> + <iso_3166_country code="GY"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="GY-BA" name="Barima-Waini"/> + <iso_3166_2_entry + code="GY-CU" name="Cuyuni-Mazaruni"/> + <iso_3166_2_entry + code="GY-DE" name="Demerara-Mahaica"/> + <iso_3166_2_entry + code="GY-EB" name="East Berbice-Corentyne"/> + <iso_3166_2_entry + code="GY-ES" name="Essequibo Islands-West Demerara"/> + <iso_3166_2_entry + code="GY-MA" name="Mahaica-Berbice"/> + <iso_3166_2_entry + code="GY-PM" name="Pomeroon-Supenaam"/> + <iso_3166_2_entry + code="GY-PT" name="Potaro-Siparuni"/> + <iso_3166_2_entry + code="GY-UD" name="Upper Demerara-Berbice"/> + <iso_3166_2_entry + code="GY-UT" name="Upper Takutu-Upper Essequibo"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Honduras --> + <iso_3166_country code="HN"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="HN-AT" name="Atlántida"/> + <iso_3166_2_entry + code="HN-CL" name="Colón"/> + <iso_3166_2_entry + code="HN-CM" name="Comayagua"/> + <iso_3166_2_entry + code="HN-CP" name="Copán"/> + <iso_3166_2_entry + code="HN-CR" name="Cortés"/> + <iso_3166_2_entry + code="HN-CH" name="Choluteca"/> + <iso_3166_2_entry + code="HN-EP" name="El Paraíso"/> + <iso_3166_2_entry + code="HN-FM" name="Francisco Morazán"/> + <iso_3166_2_entry + code="HN-GD" name="Gracias a Dios"/> + <iso_3166_2_entry + code="HN-IN" name="Intibucá"/> + <iso_3166_2_entry + code="HN-IB" name="Islas de la Bahía"/> + <iso_3166_2_entry + code="HN-LP" name="La Paz"/> + <iso_3166_2_entry + code="HN-LE" name="Lempira"/> + <iso_3166_2_entry + code="HN-OC" name="Ocotepeque"/> + <iso_3166_2_entry + code="HN-OL" name="Olancho"/> + <iso_3166_2_entry + code="HN-SB" name="Santa Bárbara"/> + <iso_3166_2_entry + code="HN-VA" name="Valle"/> + <iso_3166_2_entry + code="HN-YO" name="Yoro"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Croatia --> + <iso_3166_country code="HR"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="HR-21" name="Grad Zagreb"/> + </iso_3166_subset> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="HR-07" name="Bjelovarsko-bilogorska županija"/> + <iso_3166_2_entry + code="HR-12" name="Brodsko-posavska županija"/> + <iso_3166_2_entry + code="HR-19" name="Dubrovačko-neretvanska županija"/> + <iso_3166_2_entry + code="HR-18" name="Istarska županija"/> + <iso_3166_2_entry + code="HR-04" name="Karlovačka županija"/> + <iso_3166_2_entry + code="HR-06" name="Koprivničko-križevačka županija"/> + <iso_3166_2_entry + code="HR-02" name="Krapinsko-zagorska županija"/> + <iso_3166_2_entry + code="HR-09" name="Ličko-senjska županija"/> + <iso_3166_2_entry + code="HR-20" name="Međimurska županija"/> + <iso_3166_2_entry + code="HR-14" name="Osječko-baranjska županija"/> + <iso_3166_2_entry + code="HR-11" name="Požeško-slavonska županija"/> + <iso_3166_2_entry + code="HR-08" name="Primorsko-goranska županija"/> + <iso_3166_2_entry + code="HR-03" name="Sisačko-moslavačka županija"/> + <iso_3166_2_entry + code="HR-17" name="Splitsko-dalmatinska županija"/> + <iso_3166_2_entry + code="HR-15" name="Šibensko-kninska županija"/> + <iso_3166_2_entry + code="HR-05" name="Varaždinska županija"/> + <iso_3166_2_entry + code="HR-10" name="Virovitičko-podravska županija"/> + <iso_3166_2_entry + code="HR-16" name="Vukovarsko-srijemska županija"/> + <iso_3166_2_entry + code="HR-13" name="Zadarska županija"/> + <iso_3166_2_entry + code="HR-01" name="Zagrebačka županija"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Haiti --> + <iso_3166_country code="HT"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="HT-AR" name="Artibonite"/> + <iso_3166_2_entry + code="HT-CE" name="Centre"/> + <iso_3166_2_entry + code="HT-GA" name="Grande-Anse"/> + <iso_3166_2_entry + code="HT-ND" name="Nord"/> + <iso_3166_2_entry + code="HT-NE" name="Nord-Est"/> + <iso_3166_2_entry + code="HT-NO" name="Nord-Ouest"/> + <iso_3166_2_entry + code="HT-OU" name="Ouest"/> + <iso_3166_2_entry + code="HT-SD" name="Sud"/> + <iso_3166_2_entry + code="HT-SE" name="Sud-Est"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Hungary --> + <iso_3166_country code="HU"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="HU-BK" name="Bács-Kiskun"/> + <iso_3166_2_entry + code="HU-BA" name="Baranya"/> + <iso_3166_2_entry + code="HU-BE" name="Békés"/> + <iso_3166_2_entry + code="HU-BZ" name="Borsod-Abaúj-Zemplén"/> + <iso_3166_2_entry + code="HU-CS" name="Csongrád"/> + <iso_3166_2_entry + code="HU-FE" name="Fejér"/> + <iso_3166_2_entry + code="HU-GS" name="Győr-Moson-Sopron"/> + <iso_3166_2_entry + code="HU-HB" name="Hajdú-Bihar"/> + <iso_3166_2_entry + code="HU-HE" name="Heves"/> + <iso_3166_2_entry + code="HU-JN" name="Jász-Nagykun-Szolnok"/> + <iso_3166_2_entry + code="HU-KE" name="Komárom-Esztergom"/> + <iso_3166_2_entry + code="HU-NO" name="Nógrád"/> + <iso_3166_2_entry + code="HU-PE" name="Pest"/> + <iso_3166_2_entry + code="HU-SO" name="Somogy"/> + <iso_3166_2_entry + code="HU-SZ" name="Szabolcs-Szatmár-Bereg"/> + <iso_3166_2_entry + code="HU-TO" name="Tolna"/> + <iso_3166_2_entry + code="HU-VA" name="Vas"/> + <iso_3166_2_entry + code="HU-VE" name="Veszprém (county)"/> + <iso_3166_2_entry + code="HU-ZA" name="Zala"/> + </iso_3166_subset> + <iso_3166_subset type="City with county rights"> + <iso_3166_2_entry + code="HU-BC" name="Békéscsaba"/> + <iso_3166_2_entry + code="HU-DE" name="Debrecen"/> + <iso_3166_2_entry + code="HU-DU" name="Dunaújváros"/> + <iso_3166_2_entry + code="HU-EG" name="Eger"/> + <iso_3166_2_entry + code="HU-ER" name="Érd"/> + <iso_3166_2_entry + code="HU-GY" name="Győr"/> + <iso_3166_2_entry + code="HU-HV" name="Hódmezővásárhely"/> + <iso_3166_2_entry + code="HU-KV" name="Kaposvár"/> + <iso_3166_2_entry + code="HU-KM" name="Kecskemét"/> + <iso_3166_2_entry + code="HU-MI" name="Miskolc"/> + <iso_3166_2_entry + code="HU-NK" name="Nagykanizsa"/> + <iso_3166_2_entry + code="HU-NY" name="Nyíregyháza"/> + <iso_3166_2_entry + code="HU-PS" name="Pécs"/> + <iso_3166_2_entry + code="HU-ST" name="Salgótarján"/> + <iso_3166_2_entry + code="HU-SN" name="Sopron"/> + <iso_3166_2_entry + code="HU-SD" name="Szeged"/> + <iso_3166_2_entry + code="HU-SF" name="Székesfehérvár"/> + <iso_3166_2_entry + code="HU-SS" name="Szekszárd"/> + <iso_3166_2_entry + code="HU-SK" name="Szolnok"/> + <iso_3166_2_entry + code="HU-SH" name="Szombathely"/> + <iso_3166_2_entry + code="HU-TB" name="Tatabánya"/> + <iso_3166_2_entry + code="HU-VM" name="Veszprém"/> + <iso_3166_2_entry + code="HU-ZE" name="Zalaegerszeg"/> + </iso_3166_subset> + <iso_3166_subset type="Capital city"> + <iso_3166_2_entry + code="HU-BU" name="Budapest"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Indonesia --> + <iso_3166_country code="ID"> + <iso_3166_subset type="Geographical unit"> + <iso_3166_2_entry + code="ID-JW" name="Jawa"/> + <iso_3166_2_entry + code="ID-KA" name="Kalimantan"/> + <iso_3166_2_entry + code="ID-MA" name="Maluku"/> + <iso_3166_2_entry + code="ID-NU" name="Nusa Tenggara"/> + <iso_3166_2_entry + code="ID-IJ" name="Papua"/> + <iso_3166_2_entry + code="ID-SL" name="Sulawesi"/> + <iso_3166_2_entry + code="ID-SM" name="Sumatera"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous Province"> + <iso_3166_2_entry + code="ID-AC" name="Aceh" parent="SM"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ID-BA" name="Bali" parent="NU"/> + <iso_3166_2_entry + code="ID-BB" name="Bangka Belitung" parent="SM"/> + <iso_3166_2_entry + code="ID-BT" name="Banten" parent="JW"/> + <iso_3166_2_entry + code="ID-BE" name="Bengkulu" parent="SM"/> + <iso_3166_2_entry + code="ID-GO" name="Gorontalo" parent="SL"/> + <iso_3166_2_entry + code="ID-JA" name="Jambi" parent="SM"/> + <iso_3166_2_entry + code="ID-JB" name="Jawa Barat" parent="JW"/> + <iso_3166_2_entry + code="ID-JT" name="Jawa Tengah" parent="JW"/> + <iso_3166_2_entry + code="ID-JI" name="Jawa Timur" parent="JW"/> + <iso_3166_2_entry + code="ID-KB" name="Kalimantan Barat" parent="KA"/> + <iso_3166_2_entry + code="ID-KT" name="Kalimantan Tengah" parent="KA"/> + <iso_3166_2_entry + code="ID-KS" name="Kalimantan Selatan" parent="KA"/> + <iso_3166_2_entry + code="ID-KI" name="Kalimantan Timur" parent="KA"/> + <iso_3166_2_entry + code="ID-KR" name="Kepulauan Riau" parent="SM"/> + <iso_3166_2_entry + code="ID-LA" name="Lampung" parent="SM"/> + <iso_3166_2_entry + code="ID-MA" name="Maluku" parent="MA"/> + <iso_3166_2_entry + code="ID-MU" name="Maluku Utara" parent="MA"/> + <iso_3166_2_entry + code="ID-NB" name="Nusa Tenggara Barat" parent="NU"/> + <iso_3166_2_entry + code="ID-NT" name="Nusa Tenggara Timur" parent="NU"/> + <iso_3166_2_entry + code="ID-PA" name="Papua" parent="IJ"/> + <iso_3166_2_entry + code="ID-PB" name="Papua Barat" parent="IJ"/> + <iso_3166_2_entry + code="ID-RI" name="Riau" parent="SM"/> + <iso_3166_2_entry + code="ID-SR" name="Sulawesi Barat" parent="SL"/> + <iso_3166_2_entry + code="ID-SN" name="Sulawesi Selatan" parent="SL"/> + <iso_3166_2_entry + code="ID-ST" name="Sulawesi Tengah" parent="SL"/> + <iso_3166_2_entry + code="ID-SG" name="Sulawesi Tenggara" parent="SL"/> + <iso_3166_2_entry + code="ID-SA" name="Sulawesi Utara" parent="SL"/> + <iso_3166_2_entry + code="ID-SB" name="Sumatra Barat" parent="SM"/> + <iso_3166_2_entry + code="ID-SS" name="Sumatra Selatan" parent="SM"/> + <iso_3166_2_entry + code="ID-SU" name="Sumatera Utara" parent="SM"/> + </iso_3166_subset> + <iso_3166_subset type="Special District"> + <iso_3166_2_entry + code="ID-JK" name="Jakarta Raya" parent="JW"/> + </iso_3166_subset> + <iso_3166_subset type="Special Region"> + <iso_3166_2_entry + code="ID-YO" name="Yogyakarta" parent="JW"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ireland --> + <iso_3166_country code="IE"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="IE-C" name="Connacht"/> + <iso_3166_2_entry + code="IE-L" name="Leinster"/> + <iso_3166_2_entry + code="IE-M" name="Munster"/> + <iso_3166_2_entry + code="IE-U" name="Ulster"/> + </iso_3166_subset> + <iso_3166_subset type="County"> + <!-- Ireland uses Car Registration codes for Counties as ISO 3166-2 regions --> + <iso_3166_2_entry + code="IE-CW" name="Carlow" parent="L"/> + <iso_3166_2_entry + code="IE-CN" name="Cavan" parent="U"/> + <iso_3166_2_entry + code="IE-CE" name="Clare" parent="M"/> + <iso_3166_2_entry + code="IE-C" name="Cork" parent="M"/> + <iso_3166_2_entry + code="IE-DL" name="Donegal" parent="U"/> + <iso_3166_2_entry + code="IE-D" name="Dublin" parent="L"/> + <iso_3166_2_entry + code="IE-G" name="Galway" parent="C"/> + <iso_3166_2_entry + code="IE-KY" name="Kerry" parent="M"/> + <iso_3166_2_entry + code="IE-KE" name="Kildare" parent="L"/> + <iso_3166_2_entry + code="IE-KK" name="Kilkenny" parent="L"/> + <iso_3166_2_entry + code="IE-LS" name="Laois" parent="L"/> + <iso_3166_2_entry + code="IE-LM" name="Leitrim" parent="C"/> + <iso_3166_2_entry + code="IE-LK" name="Limerick" parent="M"/> + <iso_3166_2_entry + code="IE-LD" name="Longford" parent="L"/> + <iso_3166_2_entry + code="IE-LH" name="Louth" parent="L"/> + <iso_3166_2_entry + code="IE-MO" name="Mayo" parent="C"/> + <iso_3166_2_entry + code="IE-MH" name="Meath" parent="L"/> + <iso_3166_2_entry + code="IE-MN" name="Monaghan" parent="U"/> + <iso_3166_2_entry + code="IE-OY" name="Offaly" parent="L"/> + <iso_3166_2_entry + code="IE-RN" name="Roscommon" parent="C"/> + <iso_3166_2_entry + code="IE-SO" name="Sligo" parent="C"/> + <iso_3166_2_entry + code="IE-TA" name="Tipperary" parent="M"/> + <iso_3166_2_entry + code="IE-WD" name="Waterford" parent="M"/> + <iso_3166_2_entry + code="IE-WH" name="Westmeath" parent="L"/> + <iso_3166_2_entry + code="IE-WX" name="Wexford" parent="L"/> + <iso_3166_2_entry + code="IE-WW" name="Wicklow" parent="L"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Israel --> + <iso_3166_country code="IL"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="IL-D" name="HaDarom"/> + <iso_3166_2_entry + code="IL-M" name="HaMerkaz"/> + <iso_3166_2_entry + code="IL-Z" name="HaZafon"/> + <iso_3166_2_entry + code="IL-HA" name="Hefa"/> + <iso_3166_2_entry + code="IL-TA" name="Tel-Aviv"/> + <iso_3166_2_entry + code="IL-JM" name="Yerushalayim Al Quds"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Isle of Man --> + <iso_3166_country code="IM"/> + <!-- India --> + <iso_3166_country code="IN"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="IN-AP" name="Andhra Pradesh"/> + <iso_3166_2_entry + code="IN-AR" name="Arunāchal Pradesh"/> + <iso_3166_2_entry + code="IN-AS" name="Assam"/> + <iso_3166_2_entry + code="IN-BR" name="Bihār"/> + <iso_3166_2_entry + code="IN-CT" name="Chhattīsgarh"/> + <iso_3166_2_entry + code="IN-GA" name="Goa"/> + <iso_3166_2_entry + code="IN-GJ" name="Gujarāt"/> + <iso_3166_2_entry + code="IN-HR" name="Haryāna"/> + <iso_3166_2_entry + code="IN-HP" name="Himāchal Pradesh"/> + <iso_3166_2_entry + code="IN-JK" name="Jammu and Kashmīr"/> + <iso_3166_2_entry + code="IN-JH" name="Jharkhand"/> + <iso_3166_2_entry + code="IN-KA" name="Karnātaka"/> + <iso_3166_2_entry + code="IN-KL" name="Kerala"/> + <iso_3166_2_entry + code="IN-MP" name="Madhya Pradesh"/> + <iso_3166_2_entry + code="IN-MH" name="Mahārāshtra"/> + <iso_3166_2_entry + code="IN-MN" name="Manipur"/> + <iso_3166_2_entry + code="IN-ML" name="Meghālaya"/> + <iso_3166_2_entry + code="IN-MZ" name="Mizoram"/> + <iso_3166_2_entry + code="IN-NL" name="Nāgāland"/> + <iso_3166_2_entry + code="IN-OR" name="Orissa"/> + <iso_3166_2_entry + code="IN-PB" name="Punjab"/> + <iso_3166_2_entry + code="IN-RJ" name="Rājasthān"/> + <iso_3166_2_entry + code="IN-SK" name="Sikkim"/> + <iso_3166_2_entry + code="IN-TN" name="Tamil Nādu"/> + <iso_3166_2_entry + code="IN-TR" name="Tripura"/> + <iso_3166_2_entry + code="IN-UL" name="Uttaranchal"/> + <iso_3166_2_entry + code="IN-UP" name="Uttar Pradesh"/> + <iso_3166_2_entry + code="IN-WB" name="West Bengal"/> + </iso_3166_subset> + <iso_3166_subset type="Union territory"> + <iso_3166_2_entry + code="IN-AN" name="Andaman and Nicobar Islands"/> + <iso_3166_2_entry + code="IN-CH" name="Chandīgarh"/> + <iso_3166_2_entry + code="IN-DN" name="Dādra and Nagar Haveli"/> + <iso_3166_2_entry + code="IN-DD" name="Damān and Diu"/> + <iso_3166_2_entry + code="IN-DL" name="Delhi"/> + <iso_3166_2_entry + code="IN-LD" name="Lakshadweep"/> + <iso_3166_2_entry + code="IN-PY" name="Pondicherry"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Iraq --> + <iso_3166_country code="IQ"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="IQ-AN" name="Al Anbar"/> + <iso_3166_2_entry + code="IQ-BA" name="Al Basrah"/> + <iso_3166_2_entry + code="IQ-MU" name="Al Muthanna"/> + <iso_3166_2_entry + code="IQ-QA" name="Al Qadisiyah"/> + <iso_3166_2_entry + code="IQ-NA" name="An Najef"/> + <iso_3166_2_entry + code="IQ-AR" name="Arbil"/> + <iso_3166_2_entry + code="IQ-SW" name="As Sulaymaniyah"/> + <iso_3166_2_entry + code="IQ-TS" name="At Ta'mim"/> + <iso_3166_2_entry + code="IQ-BB" name="Babil"/> + <iso_3166_2_entry + code="IQ-BG" name="Baghdad"/> + <iso_3166_2_entry + code="IQ-DA" name="Dahuk"/> + <iso_3166_2_entry + code="IQ-DQ" name="Dhi Qar"/> + <iso_3166_2_entry + code="IQ-DI" name="Diyala"/> + <iso_3166_2_entry + code="IQ-KA" name="Karbala'"/> + <iso_3166_2_entry + code="IQ-MA" name="Maysan"/> + <iso_3166_2_entry + code="IQ-NI" name="Ninawa"/> + <iso_3166_2_entry + code="IQ-SD" name="Salah ad Din"/> + <iso_3166_2_entry + code="IQ-WA" name="Wasit"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Iran --> + <iso_3166_country code="IR"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="IR-03" name="Ardabīl"/> + <iso_3166_2_entry + code="IR-02" name="Āzarbāyjān-e Gharbī"/> + <iso_3166_2_entry + code="IR-01" name="Āzarbāyjān-e Sharqī"/> + <iso_3166_2_entry + code="IR-06" name="Būshehr"/> + <iso_3166_2_entry + code="IR-08" name="Chahār Mahāll va Bakhtīārī"/> + <iso_3166_2_entry + code="IR-04" name="Eşfahān"/> + <iso_3166_2_entry + code="IR-14" name="Fārs"/> + <iso_3166_2_entry + code="IR-19" name="Gīlān"/> + <iso_3166_2_entry + code="IR-27" name="Golestān"/> + <iso_3166_2_entry + code="IR-24" name="Hamadān"/> + <iso_3166_2_entry + code="IR-23" name="Hormozgān"/> + <iso_3166_2_entry + code="IR-05" name="Īlām"/> + <iso_3166_2_entry + code="IR-15" name="Kermān"/> + <iso_3166_2_entry + code="IR-17" name="Kermānshāh"/> + <iso_3166_2_entry + code="IR-29" name="Khorāsān-e Janūbī"/> + <iso_3166_2_entry + code="IR-30" name="Khorāsān-e Razavī"/> + <iso_3166_2_entry + code="IR-31" name="Khorāsān-e Shemālī"/> + <iso_3166_2_entry + code="IR-10" name="Khūzestān"/> + <iso_3166_2_entry + code="IR-18" name="Kohgīlūyeh va Būyer Ahmad"/> + <iso_3166_2_entry + code="IR-16" name="Kordestān"/> + <iso_3166_2_entry + code="IR-20" name="Lorestān"/> + <iso_3166_2_entry + code="IR-22" name="Markazī"/> + <iso_3166_2_entry + code="IR-21" name="Māzandarān"/> + <iso_3166_2_entry + code="IR-28" name="Qazvīn"/> + <iso_3166_2_entry + code="IR-26" name="Qom"/> + <iso_3166_2_entry + code="IR-12" name="Semnān"/> + <iso_3166_2_entry + code="IR-13" name="Sīstān va Balūchestān"/> + <iso_3166_2_entry + code="IR-07" name="Tehrān"/> + <iso_3166_2_entry + code="IR-25" name="Yazd"/> + <iso_3166_2_entry + code="IR-11" name="Zanjān"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Iceland --> + <iso_3166_country code="IS"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="IS-7" name="Austurland"/> + <iso_3166_2_entry + code="IS-1" name="Höfuðborgarsvæðið"/> + <iso_3166_2_entry + code="IS-6" name="Norðurland eystra"/> + <iso_3166_2_entry + code="IS-5" name="Norðurland vestra"/> + <iso_3166_2_entry + code="IS-8" name="Suðurland"/> + <iso_3166_2_entry + code="IS-2" name="Suðurnes"/> + <iso_3166_2_entry + code="IS-4" name="Vestfirðir"/> + <iso_3166_2_entry + code="IS-3" name="Vesturland"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="IS-0" name="Reykjavík"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Italy --> + <iso_3166_country code="IT"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="IT-65" name="Abruzzo"/> + <iso_3166_2_entry + code="IT-77" name="Basilicata"/> + <iso_3166_2_entry + code="IT-78" name="Calabria"/> + <iso_3166_2_entry + code="IT-72" name="Campania"/> + <iso_3166_2_entry + code="IT-45" name="Emilia-Romagna"/> + <iso_3166_2_entry + code="IT-36" name="Friuli-Venezia Giulia"/> + <iso_3166_2_entry + code="IT-62" name="Lazio"/> + <iso_3166_2_entry + code="IT-42" name="Liguria"/> + <iso_3166_2_entry + code="IT-25" name="Lombardia"/> + <iso_3166_2_entry + code="IT-57" name="Marche"/> + <iso_3166_2_entry + code="IT-67" name="Molise"/> + <iso_3166_2_entry + code="IT-21" name="Piemonte"/> + <iso_3166_2_entry + code="IT-75" name="Puglia"/> + <iso_3166_2_entry + code="IT-88" name="Sardegna"/> + <iso_3166_2_entry + code="IT-82" name="Sicilia"/> + <iso_3166_2_entry + code="IT-52" name="Toscana"/> + <iso_3166_2_entry + code="IT-32" name="Trentino-Alto Adige"/> + <iso_3166_2_entry + code="IT-55" name="Umbria"/> + <iso_3166_2_entry + code="IT-23" name="Valle d'Aosta"/> + <iso_3166_2_entry + code="IT-34" name="Veneto"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="IT-AG" name="Agrigento" parent="82"/> + <iso_3166_2_entry + code="IT-AL" name="Alessandria" parent="21"/> + <iso_3166_2_entry + code="IT-AN" name="Ancona" parent="57"/> + <iso_3166_2_entry + code="IT-AO" name="Aosta" parent="23"/> + <iso_3166_2_entry + code="IT-AR" name="Arezzo" parent="52"/> + <iso_3166_2_entry + code="IT-AP" name="Ascoli Piceno" parent="57"/> + <iso_3166_2_entry + code="IT-AT" name="Asti" parent="21"/> + <iso_3166_2_entry + code="IT-AV" name="Avellino" parent="72"/> + <iso_3166_2_entry + code="IT-BA" name="Bari" parent="75"/> + <iso_3166_2_entry + code="IT-BT" name="Barletta-Andria-Trani" parent="75"/> + <iso_3166_2_entry + code="IT-BL" name="Belluno" parent="34"/> + <iso_3166_2_entry + code="IT-BN" name="Benevento" parent="72"/> + <iso_3166_2_entry + code="IT-BG" name="Bergamo" parent="25"/> + <iso_3166_2_entry + code="IT-BI" name="Biella" parent="21"/> + <iso_3166_2_entry + code="IT-BO" name="Bologna" parent="45"/> + <iso_3166_2_entry + code="IT-BZ" name="Bolzano" parent="32"/> + <iso_3166_2_entry + code="IT-BS" name="Brescia" parent="25"/> + <iso_3166_2_entry + code="IT-BR" name="Brindisi" parent="75"/> + <iso_3166_2_entry + code="IT-CA" name="Cagliari" parent="88"/> + <iso_3166_2_entry + code="IT-CL" name="Caltanissetta" parent="82"/> + <iso_3166_2_entry + code="IT-CB" name="Campobasso" parent="67"/> + <iso_3166_2_entry + code="IT-CI" name="Carbonia-Iglesias" parent="88"/> + <iso_3166_2_entry + code="IT-CE" name="Caserta" parent="72"/> + <iso_3166_2_entry + code="IT-CT" name="Catania" parent="82"/> + <iso_3166_2_entry + code="IT-CZ" name="Catanzaro" parent="78"/> + <iso_3166_2_entry + code="IT-CH" name="Chieti" parent="65"/> + <iso_3166_2_entry + code="IT-CO" name="Como" parent="25"/> + <iso_3166_2_entry + code="IT-CS" name="Cosenza" parent="78"/> + <iso_3166_2_entry + code="IT-CR" name="Cremona" parent="25"/> + <iso_3166_2_entry + code="IT-KR" name="Crotone" parent="78"/> + <iso_3166_2_entry + code="IT-CN" name="Cuneo" parent="21"/> + <iso_3166_2_entry + code="IT-EN" name="Enna" parent="82"/> + <iso_3166_2_entry + code="IT-FM" name="Fermo" parent="57"/> + <iso_3166_2_entry + code="IT-FE" name="Ferrara" parent="45"/> + <iso_3166_2_entry + code="IT-FI" name="Firenze" parent="52"/> + <iso_3166_2_entry + code="IT-FG" name="Foggia" parent="75"/> + <iso_3166_2_entry + code="IT-FC" name="Forlì-Cesena" parent="45"/> + <iso_3166_2_entry + code="IT-FR" name="Frosinone" parent="62"/> + <iso_3166_2_entry + code="IT-GE" name="Genova" parent="42"/> + <iso_3166_2_entry + code="IT-GO" name="Gorizia" parent="36"/> + <iso_3166_2_entry + code="IT-GR" name="Grosseto" parent="52"/> + <iso_3166_2_entry + code="IT-IM" name="Imperia" parent="42"/> + <iso_3166_2_entry + code="IT-IS" name="Isernia" parent="67"/> + <iso_3166_2_entry + code="IT-SP" name="La Spezia" parent="42"/> + <iso_3166_2_entry + code="IT-AQ" name="L'Aquila" parent="65"/> + <iso_3166_2_entry + code="IT-LT" name="Latina" parent="62"/> + <iso_3166_2_entry + code="IT-LE" name="Lecce" parent="75"/> + <iso_3166_2_entry + code="IT-LC" name="Lecco" parent="25"/> + <iso_3166_2_entry + code="IT-LI" name="Livorno" parent="52"/> + <iso_3166_2_entry + code="IT-LO" name="Lodi" parent="25"/> + <iso_3166_2_entry + code="IT-LU" name="Lucca" parent="52"/> + <iso_3166_2_entry + code="IT-SC" name="Macerata" parent="57"/> + <iso_3166_2_entry + code="IT-MN" name="Mantova" parent="25"/> + <iso_3166_2_entry + code="IT-MS" name="Massa-Carrara" parent="52"/> + <iso_3166_2_entry + code="IT-MT" name="Matera" parent="77"/> + <iso_3166_2_entry + code="IT-VS" name="Medio Campidano" parent="88"/> + <iso_3166_2_entry + code="IT-ME" name="Messina" parent="82"/> + <iso_3166_2_entry + code="IT-MI" name="Milano" parent="25"/> + <iso_3166_2_entry + code="IT-MO" name="Modena" parent="45"/> + <iso_3166_2_entry + code="IT-MB" name="Monza e Brianza" parent="25"/> + <iso_3166_2_entry + code="IT-NA" name="Napoli" parent="72"/> + <iso_3166_2_entry + code="IT-NO" name="Novara" parent="21"/> + <iso_3166_2_entry + code="IT-NU" name="Nuoro" parent="88"/> + <iso_3166_2_entry + code="IT-OG" name="Ogliastra" parent="88"/> + <iso_3166_2_entry + code="IT-OT" name="Olbia-Tempio" parent="88"/> + <iso_3166_2_entry + code="IT-OR" name="Oristano" parent="88"/> + <iso_3166_2_entry + code="IT-PD" name="Padova" parent="34"/> + <iso_3166_2_entry + code="IT-PA" name="Palermo" parent="82"/> + <iso_3166_2_entry + code="IT-PR" name="Parma" parent="45"/> + <iso_3166_2_entry + code="IT-PV" name="Pavia" parent="25"/> + <iso_3166_2_entry + code="IT-PG" name="Perugia" parent="55"/> + <iso_3166_2_entry + code="IT-PU" name="Pesaro e Urbino" parent="57"/> + <iso_3166_2_entry + code="IT-PE" name="Pescara" parent="65"/> + <iso_3166_2_entry + code="IT-PC" name="Piacenza" parent="45"/> + <iso_3166_2_entry + code="IT-PI" name="Pisa" parent="52"/> + <iso_3166_2_entry + code="IT-PT" name="Pistoia" parent="52"/> + <iso_3166_2_entry + code="IT-PN" name="Pordenone" parent="36"/> + <iso_3166_2_entry + code="IT-PZ" name="Potenza" parent="77"/> + <iso_3166_2_entry + code="IT-PO" name="Prato" parent="52"/> + <iso_3166_2_entry + code="IT-RG" name="Ragusa" parent="82"/> + <iso_3166_2_entry + code="IT-RA" name="Ravenna" parent="45"/> + <iso_3166_2_entry + code="IT-RC" name="Reggio Calabria" parent="78"/> + <iso_3166_2_entry + code="IT-RE" name="Reggio Emilia" parent="45"/> + <iso_3166_2_entry + code="IT-RI" name="Rieti" parent="62"/> + <iso_3166_2_entry + code="IT-RN" name="Rimini" parent="45"/> + <iso_3166_2_entry + code="IT-RM" name="Roma" parent="62"/> + <iso_3166_2_entry + code="IT-RO" name="Rovigo" parent="34"/> + <iso_3166_2_entry + code="IT-SA" name="Salerno" parent="72"/> + <iso_3166_2_entry + code="IT-SS" name="Sassari" parent="88"/> + <iso_3166_2_entry + code="IT-SV" name="Savona" parent="42"/> + <iso_3166_2_entry + code="IT-SI" name="Siena" parent="52"/> + <iso_3166_2_entry + code="IT-SR" name="Siracusa" parent="82"/> + <iso_3166_2_entry + code="IT-SO" name="Sondrio" parent="25"/> + <iso_3166_2_entry + code="IT-TA" name="Taranto" parent="75"/> + <iso_3166_2_entry + code="IT-TE" name="Teramo" parent="65"/> + <iso_3166_2_entry + code="IT-TR" name="Terni" parent="55"/> + <iso_3166_2_entry + code="IT-TO" name="Torino" parent="21"/> + <iso_3166_2_entry + code="IT-TP" name="Trapani" parent="82"/> + <iso_3166_2_entry + code="IT-TN" name="Trento" parent="32"/> + <iso_3166_2_entry + code="IT-TV" name="Treviso" parent="34"/> + <iso_3166_2_entry + code="IT-TS" name="Trieste" parent="36"/> + <iso_3166_2_entry + code="IT-UD" name="Udine" parent="36"/> + <iso_3166_2_entry + code="IT-VA" name="Varese" parent="25"/> + <iso_3166_2_entry + code="IT-VE" name="Venezia" parent="34"/> + <iso_3166_2_entry + code="IT-VB" name="Verbano-Cusio-Ossola" parent="21"/> + <iso_3166_2_entry + code="IT-VC" name="Vercelli" parent="21"/> + <iso_3166_2_entry + code="IT-VR" name="Verona" parent="34"/> + <iso_3166_2_entry + code="IT-VV" name="Vibo Valentia" parent="78"/> + <iso_3166_2_entry + code="IT-VI" name="Vicenza" parent="34"/> + <iso_3166_2_entry + code="IT-VT" name="Viterbo" parent="62"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Jersey --> + <iso_3166_country code="JE"/> + <!-- Jamaica --> + <iso_3166_country code="JM"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="JM-13" name="Clarendon"/> + <iso_3166_2_entry + code="JM-09" name="Hanover"/> + <iso_3166_2_entry + code="JM-01" name="Kingston"/> + <iso_3166_2_entry + code="JM-12" name="Manchester"/> + <iso_3166_2_entry + code="JM-04" name="Portland"/> + <iso_3166_2_entry + code="JM-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="JM-06" name="Saint Ann"/> + <iso_3166_2_entry + code="JM-14" name="Saint Catherine"/> + <iso_3166_2_entry + code="JM-11" name="Saint Elizabeth"/> + <iso_3166_2_entry + code="JM-08" name="Saint James"/> + <iso_3166_2_entry + code="JM-05" name="Saint Mary"/> + <iso_3166_2_entry + code="JM-03" name="Saint Thomas"/> + <iso_3166_2_entry + code="JM-07" name="Trelawny"/> + <iso_3166_2_entry + code="JM-10" name="Westmoreland"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Jordan --> + <iso_3166_country code="JO"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="JO-AJ" name="`Ajlun"/> + <iso_3166_2_entry + code="JO-AQ" name="Al `Aqabah"/> + <iso_3166_2_entry + code="JO-BA" name="Al Balqā'"/> + <iso_3166_2_entry + code="JO-KA" name="Al Karak"/> + <iso_3166_2_entry + code="JO-MA" name="Al Mafraq"/> + <iso_3166_2_entry + code="JO-AM" name="Amman"/> + <iso_3166_2_entry + code="JO-AT" name="Aţ Ţafīlah"/> + <iso_3166_2_entry + code="JO-AZ" name="Az Zarqā'"/> + <iso_3166_2_entry + code="JO-JR" name="Irbid"/> + <iso_3166_2_entry + code="JO-JA" name="Jarash"/> + <iso_3166_2_entry + code="JO-MN" name="Ma`ān"/> + <iso_3166_2_entry + code="JO-MD" name="Mādabā"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Japan --> + <iso_3166_country code="JP"> + <iso_3166_subset type="Prefecture"> + <!-- Japan uses Prefectures for its ISO 3166-2 regions --> + <!-- Data taken from http://fotw.digibel.be/flags/jp-prefe.html --> + <iso_3166_2_entry + code="JP-23" name="Aichi"/> + <iso_3166_2_entry + code="JP-05" name="Akita"/> + <iso_3166_2_entry + code="JP-02" name="Aomori"/> + <iso_3166_2_entry + code="JP-12" name="Chiba"/> + <iso_3166_2_entry + code="JP-38" name="Ehime"/> + <iso_3166_2_entry + code="JP-18" name="Fukui"/> + <iso_3166_2_entry + code="JP-40" name="Fukuoka"/> + <iso_3166_2_entry + code="JP-07" name="Fukushima"/> + <iso_3166_2_entry + code="JP-21" name="Gifu"/> + <iso_3166_2_entry + code="JP-10" name="Gunma"/> + <iso_3166_2_entry + code="JP-34" name="Hiroshima"/> + <iso_3166_2_entry + code="JP-01" name="Hokkaido"/> + <iso_3166_2_entry + code="JP-28" name="Hyogo"/> + <iso_3166_2_entry + code="JP-08" name="Ibaraki"/> + <iso_3166_2_entry + code="JP-17" name="Ishikawa"/> + <iso_3166_2_entry + code="JP-03" name="Iwate"/> + <iso_3166_2_entry + code="JP-37" name="Kagawa"/> + <iso_3166_2_entry + code="JP-46" name="Kagoshima"/> + <iso_3166_2_entry + code="JP-14" name="Kanagawa"/> + <iso_3166_2_entry + code="JP-39" name="Kochi"/> + <iso_3166_2_entry + code="JP-43" name="Kumamoto"/> + <iso_3166_2_entry + code="JP-26" name="Kyoto"/> + <iso_3166_2_entry + code="JP-24" name="Mie"/> + <iso_3166_2_entry + code="JP-04" name="Miyagi"/> + <iso_3166_2_entry + code="JP-45" name="Miyazaki"/> + <iso_3166_2_entry + code="JP-20" name="Nagano"/> + <iso_3166_2_entry + code="JP-42" name="Nagasaki"/> + <iso_3166_2_entry + code="JP-29" name="Nara"/> + <iso_3166_2_entry + code="JP-15" name="Niigata"/> + <iso_3166_2_entry + code="JP-44" name="Oita"/> + <iso_3166_2_entry + code="JP-33" name="Okayama"/> + <iso_3166_2_entry + code="JP-47" name="Okinawa"/> + <iso_3166_2_entry + code="JP-27" name="Osaka"/> + <iso_3166_2_entry + code="JP-41" name="Saga"/> + <iso_3166_2_entry + code="JP-11" name="Saitama"/> + <iso_3166_2_entry + code="JP-25" name="Shiga"/> + <iso_3166_2_entry + code="JP-32" name="Shimane"/> + <iso_3166_2_entry + code="JP-22" name="Shizuoka"/> + <iso_3166_2_entry + code="JP-09" name="Tochigi"/> + <iso_3166_2_entry + code="JP-36" name="Tokushima"/> + <iso_3166_2_entry + code="JP-13" name="Tokyo"/> + <iso_3166_2_entry + code="JP-31" name="Tottori"/> + <iso_3166_2_entry + code="JP-16" name="Toyama"/> + <iso_3166_2_entry + code="JP-30" name="Wakayama"/> + <iso_3166_2_entry + code="JP-06" name="Yamagata"/> + <iso_3166_2_entry + code="JP-35" name="Yamaguchi"/> + <iso_3166_2_entry + code="JP-19" name="Yamanashi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kenya --> + <iso_3166_country code="KE"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KE-110" name="Nairobi Municipality"/> + <iso_3166_2_entry + code="KE-200" name="Central"/> + <iso_3166_2_entry + code="KE-300" name="Coast"/> + <iso_3166_2_entry + code="KE-400" name="Eastern"/> + <iso_3166_2_entry + code="KE-500" name="North-Eastern Kaskazini Mashariki"/> + <iso_3166_2_entry + code="KE-700" name="Rift Valley"/> + <iso_3166_2_entry + code="KE-900" name="Western Magharibi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kyrgystan --> + <iso_3166_country code="KG"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="KG-GB" name="Bishkek"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="KG-B" name="Batken"/> + <iso_3166_2_entry + code="KG-C" name="Chü"/> + <iso_3166_2_entry + code="KG-J" name="Jalal-Abad"/> + <iso_3166_2_entry + code="KG-N" name="Naryn"/> + <iso_3166_2_entry + code="KG-O" name="Osh"/> + <iso_3166_2_entry + code="KG-T" name="Talas"/> + <iso_3166_2_entry + code="KG-Y" name="Ysyk-Köl"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Cambodia --> + <iso_3166_country code="KH"> + <iso_3166_subset type="Autonomous municipality"> + <iso_3166_2_entry + code="KH-23" name="Krong Kaeb"/> + <iso_3166_2_entry + code="KH-24" name="Krong Pailin"/> + <iso_3166_2_entry + code="KH-18" name="Krong Preah Sihanouk"/> + <iso_3166_2_entry + code="KH-12" name="Phnom Penh"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KH-2" name="Battambang"/> + <iso_3166_2_entry + code="KH-1" name="Banteay Mean Chey"/> + <iso_3166_2_entry + code="KH-3" name="Kampong Cham"/> + <iso_3166_2_entry + code="KH-4" name="Kampong Chhnang"/> + <iso_3166_2_entry + code="KH-5" name="Kampong Speu"/> + <iso_3166_2_entry + code="KH-6" name="Kampong Thom"/> + <iso_3166_2_entry + code="KH-7" name="Kampot"/> + <iso_3166_2_entry + code="KH-8" name="Kandal"/> + <iso_3166_2_entry + code="KH-9" name="Kach Kong"/> + <iso_3166_2_entry + code="KH-10" name="Krachoh"/> + <iso_3166_2_entry + code="KH-11" name="Mondol Kiri"/> + <iso_3166_2_entry + code="KH-22" name="Otdar Mean Chey"/> + <iso_3166_2_entry + code="KH-15" name="Pousaat"/> + <iso_3166_2_entry + code="KH-13" name="Preah Vihear"/> + <iso_3166_2_entry + code="KH-14" name="Prey Veaeng"/> + <iso_3166_2_entry + code="KH-16" name="Rotanak Kiri"/> + <iso_3166_2_entry + code="KH-17" name="Siem Reab"/> + <iso_3166_2_entry + code="KH-19" name="Stueng Traeng"/> + <iso_3166_2_entry + code="KH-20" name="Svaay Rieng"/> + <iso_3166_2_entry + code="KH-21" name="Taakaev"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kiribati --> + <iso_3166_country code="KI"> + <iso_3166_subset type="Island group"> + <iso_3166_2_entry + code="KI-G" name="Gilbert Islands"/> + <iso_3166_2_entry + code="KI-L" name="Line Islands"/> + <iso_3166_2_entry + code="KI-P" name="Phoenix Islands"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Kitts and Nevis --> + <iso_3166_country code="KN"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="KN-K" name="Saint Kitts"/> + <iso_3166_2_entry + code="KN-N" name="Nevis"/> + </iso_3166_subset> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="KN-01" name="Christ Church Nichola Town" parent="K"/> + <iso_3166_2_entry + code="KN-02" name="Saint Anne Sandy Point" parent="K"/> + <iso_3166_2_entry + code="KN-03" name="Saint George Basseterre" parent="K"/> + <iso_3166_2_entry + code="KN-04" name="Saint George Gingerland" parent="N"/> + <iso_3166_2_entry + code="KN-05" name="Saint James Windward" parent="N"/> + <iso_3166_2_entry + code="KN-06" name="Saint John Capisterre" parent="K"/> + <iso_3166_2_entry + code="KN-07" name="Saint John Figtree" parent="N"/> + <iso_3166_2_entry + code="KN-08" name="Saint Mary Cayon" parent="K"/> + <iso_3166_2_entry + code="KN-09" name="Saint Paul Capisterre" parent="K"/> + <iso_3166_2_entry + code="KN-10" name="Saint Paul Charlestown" parent="N"/> + <iso_3166_2_entry + code="KN-11" name="Saint Peter Basseterre" parent="K"/> + <iso_3166_2_entry + code="KN-12" name="Saint Thomas Lowland" parent="N"/> + <iso_3166_2_entry + code="KN-13" name="Saint Thomas Middle Island" parent="K"/> + <iso_3166_2_entry + code="KN-15" name="Trinity Palmetto Point" parent="K"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Comorros --> + <iso_3166_country code="KM"> + <iso_3166_subset type="Island"> + <iso_3166_2_entry + code="KM-A" name="Andjouân (Anjwān)"/> + <iso_3166_2_entry + code="KM-G" name="Andjazîdja (Anjazījah)"/> + <iso_3166_2_entry + code="KM-M" name="Moûhîlî (Mūhīlī)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- North Korea --> + <iso_3166_country code="KP"> + <iso_3166_subset type="Capital city"> + <iso_3166_2_entry + code="KP-01" name="P’yŏngyang"/> + </iso_3166_subset> + <iso_3166_subset type="Special city"> + <iso_3166_2_entry + code="KP-13" name="Nasŏn (Najin-Sŏnbong)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KP-02" name="P’yŏngan-namdo"/> + <iso_3166_2_entry + code="KP-03" name="P’yŏngan-bukto"/> + <iso_3166_2_entry + code="KP-04" name="Chagang-do"/> + <iso_3166_2_entry + code="KP-05" name="Hwanghae-namdo"/> + <iso_3166_2_entry + code="KP-06" name="Hwanghae-bukto"/> + <iso_3166_2_entry + code="KP-07" name="Kangwŏn-do"/> + <iso_3166_2_entry + code="KP-08" name="Hamgyŏng-namdo"/> + <iso_3166_2_entry + code="KP-09" name="Hamgyŏng-bukto"/> + <iso_3166_2_entry + code="KP-10" name="Yanggang-do"/> + </iso_3166_subset> + </iso_3166_country> + <!-- South Korea --> + <iso_3166_country code="KR"> + <iso_3166_subset type="Capital Metropolitan City"> + <iso_3166_2_entry + code="KR-11" name="Seoul Teugbyeolsi"/> + </iso_3166_subset> + <iso_3166_subset type="Metropolitan cities"> + <iso_3166_2_entry + code="KR-26" name="Busan Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-27" name="Daegu Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-30" name="Daejeon Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-29" name="Gwangju Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-28" name="Incheon Gwang'yeogsi"/> + <iso_3166_2_entry + code="KR-31" name="Ulsan Gwang'yeogsi"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="KR-43" name="Chungcheongbukdo"/> + <iso_3166_2_entry + code="KR-44" name="Chungcheongnamdo"/> + <iso_3166_2_entry + code="KR-42" name="Gang'weondo"/> + <iso_3166_2_entry + code="KR-41" name="Gyeonggido"/> + <iso_3166_2_entry + code="KR-47" name="Gyeongsangbukdo"/> + <iso_3166_2_entry + code="KR-48" name="Gyeongsangnamdo"/> + <iso_3166_2_entry + code="KR-49" name="Jejudo"/> + <iso_3166_2_entry + code="KR-45" name="Jeonrabukdo"/> + <iso_3166_2_entry + code="KR-46" name="Jeonranamdo"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kuwait --> + <iso_3166_country code="KW"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="KW-AH" name="Al Ahmadi"/> + <iso_3166_2_entry + code="KW-FA" name="Al Farwānīyah"/> + <iso_3166_2_entry + code="KW-JA" name="Al Jahrah"/> + <iso_3166_2_entry + code="KW-KU" name="Al Kuwayt"/> + <iso_3166_2_entry + code="KW-HA" name="Hawallī"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Kazakhstan --> + <iso_3166_country code="KZ"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="KZ-ALA" name="Almaty"/> + <iso_3166_2_entry + code="KZ-AST" name="Astana"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="KZ-ALM" name="Almaty oblysy"/> + <iso_3166_2_entry + code="KZ-AKM" name="Aqmola oblysy"/> + <iso_3166_2_entry + code="KZ-AKT" name="Aqtöbe oblysy"/> + <iso_3166_2_entry + code="KZ-ATY" name="Atyraū oblysy"/> + <iso_3166_2_entry + code="KZ-ZAP" name="Batys Quzaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-MAN" name="Mangghystaū oblysy"/> + <iso_3166_2_entry + code="KZ-YUZ" name="Ongtüstik Qazaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-PAV" name="Pavlodar oblysy"/> + <iso_3166_2_entry + code="KZ-KAR" name="Qaraghandy oblysy"/> + <iso_3166_2_entry + code="KZ-KUS" name="Qostanay oblysy"/> + <iso_3166_2_entry + code="KZ-KZY" name="Qyzylorda oblysy"/> + <iso_3166_2_entry + code="KZ-VOS" name="Shyghys Qazaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-SEV" name="Soltüstik Quzaqstan oblysy"/> + <iso_3166_2_entry + code="KZ-ZHA" name="Zhambyl oblysy"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Laos --> + <iso_3166_country code="LA"> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="LA-VT" name="Vientiane"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="LA-AT" name="Attapu"/> + <iso_3166_2_entry + code="LA-BK" name="Bokèo"/> + <iso_3166_2_entry + code="LA-BL" name="Bolikhamxai"/> + <iso_3166_2_entry + code="LA-CH" name="Champasak"/> + <iso_3166_2_entry + code="LA-HO" name="Houaphan"/> + <iso_3166_2_entry + code="LA-KH" name="Khammouan"/> + <iso_3166_2_entry + code="LA-LM" name="Louang Namtha"/> + <iso_3166_2_entry + code="LA-LP" name="Louangphabang"/> + <iso_3166_2_entry + code="LA-OU" name="Oudômxai"/> + <iso_3166_2_entry + code="LA-PH" name="Phôngsali"/> + <iso_3166_2_entry + code="LA-SL" name="Salavan"/> + <iso_3166_2_entry + code="LA-SV" name="Savannakhét"/> + <iso_3166_2_entry + code="LA-VI" name="Vientiane"/> + <iso_3166_2_entry + code="LA-XA" name="Xaignabouli"/> + <iso_3166_2_entry + code="LA-XE" name="Xékong"/> + <iso_3166_2_entry + code="LA-XI" name="Xiangkhoang"/> + </iso_3166_subset> + <iso_3166_subset type="Special zone"> + <iso_3166_2_entry + code="LA-XN" name="Xiasômboun"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Liechtenstein --> + <iso_3166_country code="LI"> + <iso_3166_subset type="Commune"> + <iso_3166_2_entry + code="LI-01" name="Balzers"/> + <iso_3166_2_entry + code="LI-02" name="Eschen"/> + <iso_3166_2_entry + code="LI-03" name="Gamprin"/> + <iso_3166_2_entry + code="LI-04" name="Mauren"/> + <iso_3166_2_entry + code="LI-05" name="Planken"/> + <iso_3166_2_entry + code="LI-06" name="Ruggell"/> + <iso_3166_2_entry + code="LI-07" name="Schaan"/> + <iso_3166_2_entry + code="LI-08" name="Schellenberg"/> + <iso_3166_2_entry + code="LI-09" name="Triesen"/> + <iso_3166_2_entry + code="LI-10" name="Triesenberg"/> + <iso_3166_2_entry + code="LI-11" name="Vaduz"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Lebanon --> + <iso_3166_country code="LB"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="LB-AK" name="Aakkâr"/> + <iso_3166_2_entry + code="LB-BH" name="Baalbek-Hermel"/> + <iso_3166_2_entry + code="LB-BI" name="Béqaa"/> + <iso_3166_2_entry + code="LB-BA" name="Beyrouth"/> + <iso_3166_2_entry + code="LB-AS" name="Liban-Nord"/> + <iso_3166_2_entry + code="LB-JA" name="Liban-Sud"/> + <iso_3166_2_entry + code="LB-JL" name="Mont-Liban"/> + <iso_3166_2_entry + code="LB-NA" name="Nabatîyé"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sri Lanka --> + <iso_3166_country code="LK"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="LK-1" name="Basnāhira paḷāta"/> + <iso_3166_2_entry + code="LK-3" name="Dakuṇu paḷāta"/> + <iso_3166_2_entry + code="LK-2" name="Madhyama paḷāta"/> + <iso_3166_2_entry + code="LK-5" name="Næ̆gĕnahira paḷāta"/> + <iso_3166_2_entry + code="LK-9" name="Sabaragamuva paḷāta"/> + <iso_3166_2_entry + code="LK-7" name="Uturumæ̆da paḷāta"/> + <iso_3166_2_entry + code="LK-4" name="Uturu paḷāta"/> + <iso_3166_2_entry + code="LK-8" name="Ūva paḷāta"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="LK-52" name="Ampāara" parent="5"/> + <iso_3166_2_entry + code="LK-71" name="Anurādhapura" parent="7"/> + <iso_3166_2_entry + code="LK-81" name="Badulla" parent="8"/> + <iso_3166_2_entry + code="LK-51" name="Maḍakalapuva" parent="5"/> + <iso_3166_2_entry + code="LK-11" name="Kŏḷamba" parent="1"/> + <iso_3166_2_entry + code="LK-31" name="Gālla" parent="3"/> + <iso_3166_2_entry + code="LK-12" name="Gampaha" parent="1"/> + <iso_3166_2_entry + code="LK-33" name="Hambantŏṭa" parent="3"/> + <iso_3166_2_entry + code="LK-41" name="Yāpanaya" parent="4"/> + <iso_3166_2_entry + code="LK-13" name="Kaḷutara" parent="1"/> + <iso_3166_2_entry + code="LK-21" name="Mahanuvara" parent="2"/> + <iso_3166_2_entry + code="LK-92" name="Kægalla" parent="9"/> + <iso_3166_2_entry + code="LK-42" name="Kilinŏchchi" parent="4"/> + <iso_3166_2_entry + code="LK-61" name="Kuruṇægala" parent="6"/> + <iso_3166_2_entry + code="LK-43" name="Mannārama" parent="4"/> + <iso_3166_2_entry + code="LK-22" name="Mātale" parent="2"/> + <iso_3166_2_entry + code="LK-32" name="Mātara" parent="3"/> + <iso_3166_2_entry + code="LK-82" name="Mŏṇarāgala" parent="8"/> + <iso_3166_2_entry + code="LK-45" name="Mulativ" parent="4"/> + <iso_3166_2_entry + code="LK-23" name="Nuvara Ĕliya" parent="2"/> + <iso_3166_2_entry + code="LK-72" name="Pŏḷŏnnaruva" parent="7"/> + <iso_3166_2_entry + code="LK-62" name="Puttalama" parent="6"/> + <iso_3166_2_entry + code="LK-91" name="Ratnapura" parent="9"/> + <iso_3166_2_entry + code="LK-53" name="Trikuṇāmalaya" parent="5"/> + <iso_3166_2_entry + code="LK-44" name="Vavuniyāva" parent="4"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Liberia --> + <iso_3166_country code="LR"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="LR-BM" name="Bomi"/> + <iso_3166_2_entry + code="LR-BG" name="Bong"/> + <iso_3166_2_entry + code="LR-GB" name="Grand Bassa"/> + <iso_3166_2_entry + code="LR-CM" name="Grand Cape Mount"/> + <iso_3166_2_entry + code="LR-GG" name="Grand Gedeh"/> + <iso_3166_2_entry + code="LR-GK" name="Grand Kru"/> + <iso_3166_2_entry + code="LR-LO" name="Lofa"/> + <iso_3166_2_entry + code="LR-MG" name="Margibi"/> + <iso_3166_2_entry + code="LR-MY" name="Maryland"/> + <iso_3166_2_entry + code="LR-MO" name="Montserrado"/> + <iso_3166_2_entry + code="LR-NI" name="Nimba"/> + <iso_3166_2_entry + code="LR-RI" name="Rivercess"/> + <iso_3166_2_entry + code="LR-SI" name="Sinoe"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Lesotho --> + <iso_3166_country code="LS"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="LS-D" name="Berea"/> + <iso_3166_2_entry + code="LS-B" name="Butha-Buthe"/> + <iso_3166_2_entry + code="LS-C" name="Leribe"/> + <iso_3166_2_entry + code="LS-E" name="Mafeteng"/> + <iso_3166_2_entry + code="LS-A" name="Maseru"/> + <iso_3166_2_entry + code="LS-F" name="Mohale's Hoek"/> + <iso_3166_2_entry + code="LS-J" name="Mokhotlong"/> + <iso_3166_2_entry + code="LS-H" name="Qacha's Nek"/> + <iso_3166_2_entry + code="LS-G" name="Quthing"/> + <iso_3166_2_entry + code="LS-K" name="Thaba-Tseka"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Lithuania --> + <iso_3166_country code="LT"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="LT-AL" name="Alytaus Apskritis"/> + <iso_3166_2_entry + code="LT-KU" name="Kauno Apskritis"/> + <iso_3166_2_entry + code="LT-KL" name="Klaipėdos Apskritis"/> + <iso_3166_2_entry + code="LT-MR" name="Marijampolės Apskritis"/> + <iso_3166_2_entry + code="LT-PN" name="Panevėžio Apskritis"/> + <iso_3166_2_entry + code="LT-SA" name="Šiaulių Apskritis"/> + <iso_3166_2_entry + code="LT-TA" name="Tauragés Apskritis"/> + <iso_3166_2_entry + code="LT-TE" name="Telšių Apskritis"/> + <iso_3166_2_entry + code="LT-UT" name="Utenos Apskritis"/> + <iso_3166_2_entry + code="LT-VL" name="Vilniaus Apskritis"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Luxembourg --> + <iso_3166_country code="LU"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="LU-D" name="Diekirch"/> + <iso_3166_2_entry + code="LU-G" name="Grevenmacher"/> + <iso_3166_2_entry + code="LU-L" name="Luxembourg"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Latvia --> + <iso_3166_country code="LV"> + <iso_3166_subset type="District"> + <!-- We should probably add a "District" suffix here, but is it "Rajon" --> + <!-- or "Apriņķis"? --> + <iso_3166_2_entry + code="LV-AI" name="Aizkraukle"/> + <iso_3166_2_entry + code="LV-AL" name="Alūksne"/> + <iso_3166_2_entry + code="LV-BL" name="Balvi"/> + <iso_3166_2_entry + code="LV-BU" name="Bauska"/> + <iso_3166_2_entry + code="LV-CE" name="Cēsis"/> + <iso_3166_2_entry + code="LV-DA" name="Daugavpils"/> + <iso_3166_2_entry + code="LV-DO" name="Dobele"/> + <iso_3166_2_entry + code="LV-GU" name="Gulbene"/> + <iso_3166_2_entry + code="LV-JK" name="Jēkabpils"/> + <iso_3166_2_entry + code="LV-JL" name="Jelgava"/> + <iso_3166_2_entry + code="LV-KR" name="Krāslava"/> + <iso_3166_2_entry + code="LV-KU" name="Kuldīga"/> + <iso_3166_2_entry + code="LV-LE" name="Liepāja"/> + <iso_3166_2_entry + code="LV-LM" name="Limbaži"/> + <iso_3166_2_entry + code="LV-LU" name="Ludza"/> + <iso_3166_2_entry + code="LV-MA" name="Madona"/> + <iso_3166_2_entry + code="LV-OG" name="Ogre"/> + <iso_3166_2_entry + code="LV-PR" name="Preiļi"/> + <iso_3166_2_entry + code="LV-RE" name="Rēzekne"/> + <iso_3166_2_entry + code="LV-RI" name="Rīga"/> + <iso_3166_2_entry + code="LV-SA" name="Saldus"/> + <iso_3166_2_entry + code="LV-TA" name="Talsi"/> + <iso_3166_2_entry + code="LV-TU" name="Tukums"/> + <iso_3166_2_entry + code="LV-VK" name="Valka"/> + <iso_3166_2_entry + code="LV-VM" name="Valmiera"/> + <iso_3166_2_entry + code="LV-VE" name="Ventspils"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="LV-DGV" name="Daugavpils"/> + <iso_3166_2_entry + code="LV-JEL" name="Jelgava"/> + <iso_3166_2_entry + code="LV-JUR" name="Jūrmala"/> + <iso_3166_2_entry + code="LV-LPX" name="Liepāja"/> + <iso_3166_2_entry + code="LV-REZ" name="Rēzekne"/> + <iso_3166_2_entry + code="LV-RIX" name="Rīga"/> + <iso_3166_2_entry + code="LV-VEN" name="Ventspils"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Libya --> + <iso_3166_country code="LY"> + <iso_3166_subset type="Popularates"> + <iso_3166_2_entry + code="LY-BU" name="Al Buţnān"/> + <iso_3166_2_entry + code="LY-JA" name="Al Jabal al Akhḑar"/> + <iso_3166_2_entry + code="LY-JG" name="Al Jabal al Gharbī"/> + <iso_3166_2_entry + code="LY-JI" name="Al Jifārah"/> + <iso_3166_2_entry + code="LY-JU" name="Al Jufrah"/> + <iso_3166_2_entry + code="LY-KF" name="Al Kufrah"/> + <iso_3166_2_entry + code="LY-MJ" name="Al Marj"/> + <iso_3166_2_entry + code="LY-MB" name="Al Marqab"/> + <iso_3166_2_entry + code="LY-WA" name="Al Wāḩāt"/> + <iso_3166_2_entry + code="LY-NQ" name="An Nuqaţ al Khams"/> + <iso_3166_2_entry + code="LY-ZA" name="Az Zāwiyah"/> + <iso_3166_2_entry + code="LY-BA" name="Banghāzī"/> + <iso_3166_2_entry + code="LY-DR" name="Darnah"/> + <iso_3166_2_entry + code="LY-GT" name="Ghāt"/> + <iso_3166_2_entry + code="LY-JB" name="Jaghbūb"/> + <iso_3166_2_entry + code="LY-MI" name="Mişrātah"/> + <iso_3166_2_entry + code="LY-MQ" name="Murzuq"/> + <iso_3166_2_entry + code="LY-NL" name="Nālūt"/> + <iso_3166_2_entry + code="LY-SB" name="Sabhā"/> + <iso_3166_2_entry + code="LY-SR" name="Surt"/> + <iso_3166_2_entry + code="LY-TB" name="Ţarābulus"/> + <iso_3166_2_entry + code="LY-WD" name="Wādī al Ḩayāt"/> + <iso_3166_2_entry + code="LY-WS" name="Wādī ash Shāţiʾ"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Morocco --> + <iso_3166_country code="MA"> + <iso_3166_subset type="Economic region"> + <iso_3166_2_entry + code="MA 09" name="Chaouia-Ouardigha"/> + <iso_3166_2_entry + code="MA 10" name="Doukhala-Abda"/> + <iso_3166_2_entry + code="MA 05" name="Fès-Boulemane"/> + <iso_3166_2_entry + code="MA 02" name="Gharb-Chrarda-Beni Hssen"/> + <iso_3166_2_entry + code="MA 08" name="Grand Casablanca"/> + <iso_3166_2_entry + code="MA 14" name="Guelmim-Es Smara"/> + <iso_3166_2_entry + code="MA 15" name="Laâyoune-Boujdour-Sakia el Hamra"/> + <iso_3166_2_entry + code="MA 04" name="L'Oriental"/> + <iso_3166_2_entry + code="MA 11" name="Marrakech-Tensift-Al Haouz"/> + <iso_3166_2_entry + code="MA 06" name="Meknès-Tafilalet"/> + <iso_3166_2_entry + code="MA 16" name="Oued ed Dahab-Lagouira"/> + <iso_3166_2_entry + code="MA 07" name="Rabat-Salé-Zemmour-Zaer"/> + <iso_3166_2_entry + code="MA 13" name="Sous-Massa-Draa"/> + <iso_3166_2_entry + code="MA 12" name="Tadla-Azilal"/> + <iso_3166_2_entry + code="MA 01" name="Tanger-Tétouan"/> + <iso_3166_2_entry + code="MA 03" name="Taza-Al Hoceima-Taounate"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="MA-HAO" name="Al Haouz" parent="11"/> + <iso_3166_2_entry + code="MA-HOC" name="Al Hoceïma" parent="03"/> + <iso_3166_2_entry + code="MA-ASZ" name="Assa-Zag" parent="14"/> + <iso_3166_2_entry + code="MA-AZI" name="Azilal" parent="12"/> + <iso_3166_2_entry + code="MA-BEM" name="Beni Mellal" parent="12"/> + <iso_3166_2_entry + code="MA-BES" name="Ben Slimane" parent="09"/> + <iso_3166_2_entry + code="MA-BER" name="Berkane" parent="04"/> + <iso_3166_2_entry + code="MA-BOD" name="Boujdour (EH)" parent="15"/> + <iso_3166_2_entry + code="MA-BOM" name="Boulemane" parent="05"/> + <iso_3166_2_entry + code="MA-CHE" name="Chefchaouen" parent="01"/> + <iso_3166_2_entry + code="MA-CHI" name="Chichaoua" parent="11"/> + <iso_3166_2_entry + code="MA-CHT" name="Chtouka-Ait Baha" parent="13"/> + <iso_3166_2_entry + code="MA-HAJ" name="El Hajeb" parent="06"/> + <iso_3166_2_entry + code="MA-JDI" name="El Jadida" parent="10"/> + <iso_3166_2_entry + code="MA-ERR" name="Errachidia" parent="06"/> + <iso_3166_2_entry + code="MA-ESI" name="Essaouira" parent="11"/> + <iso_3166_2_entry + code="MA-ESM" name="Es Smara (EH)" parent="14"/> + <iso_3166_2_entry + code="MA-FIG" name="Figuig" parent="04"/> + <iso_3166_2_entry + code="MA-GUE" name="Guelmim" parent="14"/> + <iso_3166_2_entry + code="MA-IFR" name="Ifrane" parent="06"/> + <iso_3166_2_entry + code="MA-JRA" name="Jrada" parent="04"/> + <iso_3166_2_entry + code="MA-KES" name="Kelaat es Sraghna" parent="11"/> + <iso_3166_2_entry + code="MA-KEN" name="Kénitra" parent="02"/> + <iso_3166_2_entry + code="MA-KHE" name="Khemisaet" parent="07"/> + <iso_3166_2_entry + code="MA-KHN" name="Khenifra" parent="06"/> + <iso_3166_2_entry + code="MA-KHO" name="Khouribga" parent="09"/> + <iso_3166_2_entry + code="MA-LAA" name="Laâyoune (EH)" parent="15"/> + <iso_3166_2_entry + code="MA-LAP" name="Larache" parent="01"/> + <iso_3166_2_entry + code="MA-MED" name="Médiouna" parent="08"/> + <iso_3166_2_entry + code="MA-MOU" name="Moulay Yacoub" parent="05"/> + <iso_3166_2_entry + code="MA-NAD" name="Nador" parent="04"/> + <iso_3166_2_entry + code="MA-NOU" name="Nouaceur" parent="08"/> + <iso_3166_2_entry + code="MA-OUA" name="Ouarzazate" parent="13"/> + <iso_3166_2_entry + code="MA-OUD" name="Oued ed Dahab (EH)" parent="16"/> + <iso_3166_2_entry + code="MA-SAF" name="Safi" parent="10"/> + <iso_3166_2_entry + code="MA-SEF" name="Sefrou" parent="05"/> + <iso_3166_2_entry + code="MA-SET" name="Settat" parent="09"/> + <iso_3166_2_entry + code="MA-SIK" name="Sidl Kacem" parent="02"/> + <iso_3166_2_entry + code="MA-TNT" name="Tan-Tan" parent="14"/> + <iso_3166_2_entry + code="MA-TAO" name="Taounate" parent="03"/> + <iso_3166_2_entry + code="MA-TAI" name="Taourirt" parent="04"/> + <iso_3166_2_entry + code="MA-TAR" name="Taroudant" parent="13"/> + <iso_3166_2_entry + code="MA-TAT" name="Tata" parent="14"/> + <iso_3166_2_entry + code="MA-TAZ" name="Taza" parent="03"/> + <iso_3166_2_entry + code="MA-TIZ" name="Tiznit" parent="13"/> + <iso_3166_2_entry + code="MA-ZAG" name="Zagora" parent="13"/> + </iso_3166_subset> + <iso_3166_subset type="Prefecture"> + <iso_3166_2_entry + code="MA-AGD" name="Agadir-Ida-Outanane" parent="13"/> + <iso_3166_2_entry + code="MA-AOU" name="Aousserd" parent="16"/> + <iso_3166_2_entry + code="MA-CAS" name="Casablanca [Dar el Beïda]" parent="08"/> + <iso_3166_2_entry + code="MA-FAH" name="Fahs-Beni Makada" parent="01"/> + <iso_3166_2_entry + code="MA-FES" name="Fès-Dar-Dbibegh" parent="05"/> + <iso_3166_2_entry + code="MA-INE" name="Inezgane-Ait Melloul" parent="13"/> + <iso_3166_2_entry + code="MA-MMD" name="Marrakech-Medina" parent="11"/> + <iso_3166_2_entry + code="MA-MMN" name="Marrakech-Menara" parent="11"/> + <iso_3166_2_entry + code="MA-MEK" name="Meknès" parent="06"/> + <iso_3166_2_entry + code="MA-MOH" name="Mohammadia" parent="08"/> + <iso_3166_2_entry + code="MA-OUJ" name="Oujda-Angad" parent="04"/> + <iso_3166_2_entry + code="MA-RAB" name="Rabat" parent="07"/> + <iso_3166_2_entry + code="MA-SAL" name="Salé" parent="07"/> + <iso_3166_2_entry + code="MA-SYB" name="Sidi Youssef Ben Ali" parent="11"/> + <iso_3166_2_entry + code="MA-SKH" name="Skhirate-Témara" parent="07"/> + <iso_3166_2_entry + code="MA-TNG" name="Tanger-Assilah" parent="01"/> + <iso_3166_2_entry + code="MA-TET" name="Tétouan" parent="01"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Moldova --> + <iso_3166_country code="MD"> + <iso_3166_subset type="Autonomous territorial unit"> + <iso_3166_2_entry + code="MD-GA" name="Găgăuzia, Unitatea teritorială autonomă"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MD-BA" name="Bălți"/> + <iso_3166_2_entry + code="MD-BD" name="Tighina"/> + <iso_3166_2_entry + code="MD-CU" name="Chișinău"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MD-AN" name="Anenii Noi"/> + <iso_3166_2_entry + code="MD-BS" name="Basarabeasca"/> + <iso_3166_2_entry + code="MD-BR" name="Briceni"/> + <iso_3166_2_entry + code="MD-CA" name="Cahul"/> + <iso_3166_2_entry + code="MD-CT" name="Cantemir"/> + <iso_3166_2_entry + code="MD-CL" name="Călărași"/> + <iso_3166_2_entry + code="MD-CS" name="Căușeni"/> + <iso_3166_2_entry + code="MD-CM" name="Cimișlia"/> + <iso_3166_2_entry + code="MD-CR" name="Criuleni"/> + <iso_3166_2_entry + code="MD-DO" name="Dondușeni"/> + <iso_3166_2_entry + code="MD-DR" name="Drochia"/> + <iso_3166_2_entry + code="MD-DU" name="Dubăsari"/> + <iso_3166_2_entry + code="MD-ED" name="Edineț"/> + <iso_3166_2_entry + code="MD-FA" name="Fălești"/> + <iso_3166_2_entry + code="MD-FL" name="Florești"/> + <iso_3166_2_entry + code="MD-GL" name="Glodeni"/> + <iso_3166_2_entry + code="MD-HI" name="Hîncești"/> + <iso_3166_2_entry + code="MD-IA" name="Ialoveni"/> + <iso_3166_2_entry + code="MD-LE" name="Leova"/> + <iso_3166_2_entry + code="MD-NI" name="Nisporeni"/> + <iso_3166_2_entry + code="MD-OC" name="Ocnița"/> + <iso_3166_2_entry + code="MD-OR" name="Orhei"/> + <iso_3166_2_entry + code="MD-RE" name="Rezina"/> + <iso_3166_2_entry + code="MD-RI" name="Rîșcani"/> + <iso_3166_2_entry + code="MD-SI" name="Sîngerei"/> + <iso_3166_2_entry + code="MD-SO" name="Soroca"/> + <iso_3166_2_entry + code="MD-ST" name="Strășeni"/> + <iso_3166_2_entry + code="MD-SD" name="Șoldănești"/> + <iso_3166_2_entry + code="MD-SV" name="Ștefan Vodă"/> + <iso_3166_2_entry + code="MD-TA" name="Taraclia"/> + <iso_3166_2_entry + code="MD-TE" name="Telenești"/> + <iso_3166_2_entry + code="MD-UN" name="Ungheni"/> + </iso_3166_subset> + <iso_3166_subset type="Territorial unit"> + <iso_3166_2_entry + code="MD-SN" name="Stînga Nistrului, unitatea teritorială din"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Montenegro --> + <iso_3166_country code="ME"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="ME-01" name="Andrijevica"/> + <iso_3166_2_entry + code="ME-02" name="Bar"/> + <iso_3166_2_entry + code="ME-03" name="Berane"/> + <iso_3166_2_entry + code="ME-04" name="Bijelo Polje"/> + <iso_3166_2_entry + code="ME-05" name="Budva"/> + <iso_3166_2_entry + code="ME-06" name="Cetinje"/> + <iso_3166_2_entry + code="ME-07" name="Danilovgrad"/> + <iso_3166_2_entry + code="ME-08" name="Herceg-Novi"/> + <iso_3166_2_entry + code="ME-09" name="Kolašin"/> + <iso_3166_2_entry + code="ME-10" name="Kotor"/> + <iso_3166_2_entry + code="ME-11" name="Mojkovac"/> + <iso_3166_2_entry + code="ME-12" name="Nikšić"/> + <iso_3166_2_entry + code="ME-13" name="Plav"/> + <iso_3166_2_entry + code="ME-14" name="Pljevlja"/> + <iso_3166_2_entry + code="ME-15" name="Plužine"/> + <iso_3166_2_entry + code="ME-16" name="Podgorica"/> + <iso_3166_2_entry + code="ME-17" name="Rožaje"/> + <iso_3166_2_entry + code="ME-18" name="Šavnik"/> + <iso_3166_2_entry + code="ME-19" name="Tivat"/> + <iso_3166_2_entry + code="ME-20" name="Ulcinj"/> + <iso_3166_2_entry + code="ME-21" name="Žabljak"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Martin (French part) --> + <iso_3166_country code="MF"/> + <!-- Madagascar --> + <iso_3166_country code="MG"> + <iso_3166_subset type="Autonomous province"> + <iso_3166_2_entry + code="MG-T" name="Antananarivo"/> + <iso_3166_2_entry + code="MG-D" name="Antsiranana"/> + <iso_3166_2_entry + code="MG-F" name="Fianarantsoa"/> + <iso_3166_2_entry + code="MG-M" name="Mahajanga"/> + <iso_3166_2_entry + code="MG-A" name="Toamasina"/> + <iso_3166_2_entry + code="MG-U" name="Toliara"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Marshall Islands --> + <iso_3166_country code="MH"> + <iso_3166_subset type="Chains (of islands)"> + <iso_3166_2_entry + code="MH-L" name="Ralik chain"/> + <iso_3166_2_entry + code="MH-T" name="Ratak chain"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="MH-ALL" name="Ailinglaplap" parent="L"/> + <iso_3166_2_entry + code="MH-ALK" name="Ailuk" parent="T"/> + <iso_3166_2_entry + code="MH-ARN" name="Arno" parent="T"/> + <iso_3166_2_entry + code="MH-AUR" name="Aur" parent="T"/> + <iso_3166_2_entry + code="MH-EBO" name="Ebon" parent="L"/> + <iso_3166_2_entry + code="MH-ENI" name="Enewetak" parent="L"/> + <iso_3166_2_entry + code="MH-JAB" name="Jabat" parent="L"/> + <iso_3166_2_entry + code="MH-JAL" name="Jaluit" parent="L"/> + <iso_3166_2_entry + code="MH-KIL" name="Kili" parent="L"/> + <iso_3166_2_entry + code="MH-KWA" name="Kwajalein" parent="L"/> + <iso_3166_2_entry + code="MH-LAE" name="Lae" parent="L"/> + <iso_3166_2_entry + code="MH-LIB" name="Lib" parent="L"/> + <iso_3166_2_entry + code="MH-LIK" name="Likiep" parent="T"/> + <iso_3166_2_entry + code="MH-MAJ" name="Majuro" parent="T"/> + <iso_3166_2_entry + code="MH-MAL" name="Maloelap" parent="T"/> + <iso_3166_2_entry + code="MH-MEJ" name="Mejit" parent="T"/> + <iso_3166_2_entry + code="MH-MIL" name="Mili" parent="T"/> + <iso_3166_2_entry + code="MH-NMK" name="Namdrik" parent="L"/> + <iso_3166_2_entry + code="MH-NMU" name="Namu" parent="L"/> + <iso_3166_2_entry + code="MH-RON" name="Rongelap" parent="L"/> + <iso_3166_2_entry + code="MH-UJA" name="Ujae" parent="L"/> + <iso_3166_2_entry + code="MH-UTI" name="Utirik" parent="T"/> + <iso_3166_2_entry + code="MH-WTN" name="Wotho" parent="L"/> + <iso_3166_2_entry + code="MH-WTJ" name="Wotje" parent="T"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Macedonia --> + <iso_3166_country code="MK"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="MK-01" name="Aerodrom"/> + <iso_3166_2_entry + code="MK-02" name="Aračinovo"/> + <iso_3166_2_entry + code="MK-03" name="Berovo"/> + <iso_3166_2_entry + code="MK-04" name="Bitola"/> + <iso_3166_2_entry + code="MK-05" name="Bogdanci"/> + <iso_3166_2_entry + code="MK-06" name="Bogovinje"/> + <iso_3166_2_entry + code="MK-07" name="Bosilovo"/> + <iso_3166_2_entry + code="MK-08" name="Brvenica"/> + <iso_3166_2_entry + code="MK-09" name="Butel"/> + <iso_3166_2_entry + code="MK-77" name="Centar"/> + <iso_3166_2_entry + code="MK-78" name="Centar Župa"/> + <iso_3166_2_entry + code="MK-79" name="Čair"/> + <iso_3166_2_entry + code="MK-80" name="Čaška"/> + <iso_3166_2_entry + code="MK-81" name="Češinovo-Obleševo"/> + <iso_3166_2_entry + code="MK-82" name="Čučer Sandevo"/> + <iso_3166_2_entry + code="MK-21" name="Debar"/> + <iso_3166_2_entry + code="MK-22" name="Debarca"/> + <iso_3166_2_entry + code="MK-23" name="Delčevo"/> + <iso_3166_2_entry + code="MK-25" name="Demir Hisar"/> + <iso_3166_2_entry + code="MK-24" name="Demir Kapija"/> + <iso_3166_2_entry + code="MK-26" name="Dojran"/> + <iso_3166_2_entry + code="MK-27" name="Dolneni"/> + <iso_3166_2_entry + code="MK-28" name="Drugovo"/> + <iso_3166_2_entry + code="MK-17" name="Gazi Baba"/> + <iso_3166_2_entry + code="MK-18" name="Gevgelija"/> + <iso_3166_2_entry + code="MK-29" name="Gjorče Petrov"/> + <iso_3166_2_entry + code="MK-19" name="Gostivar"/> + <iso_3166_2_entry + code="MK-20" name="Gradsko"/> + <iso_3166_2_entry + code="MK-34" name="Ilinden"/> + <iso_3166_2_entry + code="MK-35" name="Jegunovce"/> + <iso_3166_2_entry + code="MK-37" name="Karbinci"/> + <iso_3166_2_entry + code="MK-38" name="Karpoš"/> + <iso_3166_2_entry + code="MK-36" name="Kavadarci"/> + <iso_3166_2_entry + code="MK-40" name="Kičevo"/> + <iso_3166_2_entry + code="MK-39" name="Kisela Voda"/> + <iso_3166_2_entry + code="MK-42" name="Kočani"/> + <iso_3166_2_entry + code="MK-41" name="Konče"/> + <iso_3166_2_entry + code="MK-43" name="Kratovo"/> + <iso_3166_2_entry + code="MK-44" name="Kriva Palanka"/> + <iso_3166_2_entry + code="MK-45" name="Krivogaštani"/> + <iso_3166_2_entry + code="MK-46" name="Kruševo"/> + <iso_3166_2_entry + code="MK-47" name="Kumanovo"/> + <iso_3166_2_entry + code="MK-48" name="Lipkovo"/> + <iso_3166_2_entry + code="MK-49" name="Lozovo"/> + <iso_3166_2_entry + code="MK-51" name="Makedonska Kamenica"/> + <iso_3166_2_entry + code="MK-52" name="Makedonski Brod"/> + <iso_3166_2_entry + code="MK-50" name="Mavrovo-i-Rostuša"/> + <iso_3166_2_entry + code="MK-53" name="Mogila"/> + <iso_3166_2_entry + code="MK-54" name="Negotino"/> + <iso_3166_2_entry + code="MK-55" name="Novaci"/> + <iso_3166_2_entry + code="MK-56" name="Novo Selo"/> + <iso_3166_2_entry + code="MK-58" name="Ohrid"/> + <iso_3166_2_entry + code="MK-57" name="Oslomej"/> + <iso_3166_2_entry + code="MK-60" name="Pehčevo"/> + <iso_3166_2_entry + code="MK-59" name="Petrovec"/> + <iso_3166_2_entry + code="MK-61" name="Plasnica"/> + <iso_3166_2_entry + code="MK-62" name="Prilep"/> + <iso_3166_2_entry + code="MK-63" name="Probištip"/> + <iso_3166_2_entry + code="MK-64" name="Radoviš"/> + <iso_3166_2_entry + code="MK-65" name="Rankovce"/> + <iso_3166_2_entry + code="MK-66" name="Resen"/> + <iso_3166_2_entry + code="MK-67" name="Rosoman"/> + <iso_3166_2_entry + code="MK-68" name="Saraj"/> + <iso_3166_2_entry + code="MK-83" name="Štip"/> + <iso_3166_2_entry + code="MK-84" name="Šuto Orizari"/> + <iso_3166_2_entry + code="MK-70" name="Sopište"/> + <iso_3166_2_entry + code="MK-71" name="Staro Nagoričane"/> + <iso_3166_2_entry + code="MK-72" name="Struga"/> + <iso_3166_2_entry + code="MK-73" name="Strumica"/> + <iso_3166_2_entry + code="MK-74" name="Studeničani"/> + <iso_3166_2_entry + code="MK-69" name="Sveti Nikole"/> + <iso_3166_2_entry + code="MK-75" name="Tearce"/> + <iso_3166_2_entry + code="MK-76" name="Tetovo"/> + <iso_3166_2_entry + code="MK-10" name="Valandovo"/> + <iso_3166_2_entry + code="MK-11" name="Vasilevo"/> + <iso_3166_2_entry + code="MK-13" name="Veles"/> + <iso_3166_2_entry + code="MK-12" name="Vevčani"/> + <iso_3166_2_entry + code="MK-14" name="Vinica"/> + <iso_3166_2_entry + code="MK-15" name="Vraneštica"/> + <iso_3166_2_entry + code="MK-16" name="Vrapčište"/> + <iso_3166_2_entry + code="MK-31" name="Zajas"/> + <iso_3166_2_entry + code="MK-32" name="Zelenikovo"/> + <iso_3166_2_entry + code="MK-30" name="Želino"/> + <iso_3166_2_entry + code="MK-33" name="Zrnovci"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mali --> + <iso_3166_country code="ML"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="ML-BK0" name="Bamako"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="ML-7" name="Gao"/> + <iso_3166_2_entry + code="ML-1" name="Kayes"/> + <iso_3166_2_entry + code="ML-8" name="Kidal"/> + <iso_3166_2_entry + code="ML-2" name="Koulikoro"/> + <iso_3166_2_entry + code="ML-5" name="Mopti"/> + <iso_3166_2_entry + code="ML-4" name="Ségou"/> + <iso_3166_2_entry + code="ML-3" name="Sikasso"/> + <iso_3166_2_entry + code="ML-6" name="Tombouctou"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Myanmar --> + <iso_3166_country code="MM"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="MM-07" name="Ayeyarwady"/> + <iso_3166_2_entry + code="MM-02" name="Bago"/> + <iso_3166_2_entry + code="MM-03" name="Magway"/> + <iso_3166_2_entry + code="MM-04" name="Mandalay"/> + <iso_3166_2_entry + code="MM-01" name="Sagaing"/> + <iso_3166_2_entry + code="MM-05" name="Tanintharyi"/> + <iso_3166_2_entry + code="MM-06" name="Yangon"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="MM-14" name="Chin"/> + <iso_3166_2_entry + code="MM-11" name="Kachin"/> + <iso_3166_2_entry + code="MM-12" name="Kayah"/> + <iso_3166_2_entry + code="MM-13" name="Kayin"/> + <iso_3166_2_entry + code="MM-15" name="Mon"/> + <iso_3166_2_entry + code="MM-16" name="Rakhine"/> + <iso_3166_2_entry + code="MM-17" name="Shan"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mongolia --> + <iso_3166_country code="MN"> + <iso_3166_subset type="Province"> + <!-- Different transliterations possible, is there an official one? --> + <iso_3166_2_entry + code="MN-073" name="Arhangay"/> + <iso_3166_2_entry + code="MN-069" name="Bayanhongor"/> + <iso_3166_2_entry + code="MN-071" name="Bayan-Ölgiy"/> + <iso_3166_2_entry + code="MN-067" name="Bulgan"/> + <iso_3166_2_entry + code="MN-061" name="Dornod"/> + <iso_3166_2_entry + code="MN-063" name="Dornogovi"/> + <iso_3166_2_entry + code="MN-059" name="Dundgovi"/> + <iso_3166_2_entry + code="MN-057" name="Dzavhan"/> + <iso_3166_2_entry + code="MN-065" name="Govi-Altay"/> + <iso_3166_2_entry + code="MN-039" name="Hentiy"/> + <iso_3166_2_entry + code="MN-043" name="Hovd"/> + <iso_3166_2_entry + code="MN-041" name="Hövsgöl"/> + <iso_3166_2_entry + code="MN-053" name="Ömnögovi"/> + <iso_3166_2_entry + code="MN-055" name="Övörhangay"/> + <iso_3166_2_entry + code="MN-049" name="Selenge"/> + <iso_3166_2_entry + code="MN-051" name="Sühbaatar"/> + <iso_3166_2_entry + code="MN-047" name="Töv"/> + <iso_3166_2_entry + code="MN-046" name="Uvs"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="MN-1" name="Ulanbaatar"/> + <iso_3166_2_entry + code="MN-037" name="Darhan uul"/> + <iso_3166_2_entry + code="MN-064" name="Govi-Sumber"/> + <iso_3166_2_entry + code="MN-035" name="Orhon"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Macao --> + <iso_3166_country code="MO"/> + <!-- Mauritania --> + <iso_3166_country code="MR"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MR-NKC" name="Nouakchott"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="MR-07" name="Adrar"/> + <iso_3166_2_entry + code="MR-03" name="Assaba"/> + <iso_3166_2_entry + code="MR-05" name="Brakna"/> + <iso_3166_2_entry + code="MR-08" name="Dakhlet Nouadhibou"/> + <iso_3166_2_entry + code="MR-04" name="Gorgol"/> + <iso_3166_2_entry + code="MR-10" name="Guidimaka"/> + <iso_3166_2_entry + code="MR-01" name="Hodh ech Chargui"/> + <iso_3166_2_entry + code="MR-02" name="Hodh el Charbi"/> + <iso_3166_2_entry + code="MR-12" name="Inchiri"/> + <iso_3166_2_entry + code="MR-09" name="Tagant"/> + <iso_3166_2_entry + code="MR-11" name="Tiris Zemmour"/> + <iso_3166_2_entry + code="MR-06" name="Trarza"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Malta --> + <iso_3166_country code="MT"> + <iso_3166_subset type="Local council"> + <iso_3166_2_entry + code="MT-01" name="Attard"/> + <iso_3166_2_entry + code="MT-02" name="Balzan"/> + <iso_3166_2_entry + code="MT-03" name="Birgu"/> + <iso_3166_2_entry + code="MT-04" name="Birkirkara"/> + <iso_3166_2_entry + code="MT-05" name="Birżebbuġa"/> + <iso_3166_2_entry + code="MT-06" name="Bormla"/> + <iso_3166_2_entry + code="MT-07" name="Dingli"/> + <iso_3166_2_entry + code="MT-08" name="Fgura"/> + <iso_3166_2_entry + code="MT-09" name="Floriana"/> + <iso_3166_2_entry + code="MT-10" name="Fontana"/> + <iso_3166_2_entry + code="MT-11" name="Gudja"/> + <iso_3166_2_entry + code="MT-12" name="Gżira"/> + <iso_3166_2_entry + code="MT-13" name="Għajnsielem"/> + <iso_3166_2_entry + code="MT-14" name="Għarb"/> + <iso_3166_2_entry + code="MT-15" name="Għargħur"/> + <iso_3166_2_entry + code="MT-16" name="Għasri"/> + <iso_3166_2_entry + code="MT-17" name="Għaxaq"/> + <iso_3166_2_entry + code="MT-18" name="Ħamrun"/> + <iso_3166_2_entry + code="MT-19" name="Iklin"/> + <iso_3166_2_entry + code="MT-20" name="Isla"/> + <iso_3166_2_entry + code="MT-21" name="Kalkara"/> + <iso_3166_2_entry + code="MT-22" name="Kerċem"/> + <iso_3166_2_entry + code="MT-23" name="Kirkop"/> + <iso_3166_2_entry + code="MT-24" name="Lija"/> + <iso_3166_2_entry + code="MT-25" name="Luqa"/> + <iso_3166_2_entry + code="MT-26" name="Marsa"/> + <iso_3166_2_entry + code="MT-27" name="Marsaskala"/> + <iso_3166_2_entry + code="MT-28" name="Marsaxlokk"/> + <iso_3166_2_entry + code="MT-29" name="Mdina"/> + <iso_3166_2_entry + code="MT-30" name="Mellieħa"/> + <iso_3166_2_entry + code="MT-31" name="Mġarr"/> + <iso_3166_2_entry + code="MT-32" name="Mosta"/> + <iso_3166_2_entry + code="MT-33" name="Mqabba"/> + <iso_3166_2_entry + code="MT-34" name="Msida"/> + <iso_3166_2_entry + code="MT-35" name="Mtarfa"/> + <iso_3166_2_entry + code="MT-36" name="Munxar"/> + <iso_3166_2_entry + code="MT-37" name="Nadur"/> + <iso_3166_2_entry + code="MT-38" name="Naxxar"/> + <iso_3166_2_entry + code="MT-39" name="Paola"/> + <iso_3166_2_entry + code="MT-40" name="Pembroke"/> + <iso_3166_2_entry + code="MT-41" name="Pietà"/> + <iso_3166_2_entry + code="MT-42" name="Qala"/> + <iso_3166_2_entry + code="MT-43" name="Qormi"/> + <iso_3166_2_entry + code="MT-44" name="Qrendi"/> + <iso_3166_2_entry + code="MT-45" name="Rabat Għawdex"/> + <iso_3166_2_entry + code="MT-46" name="Rabat Malta"/> + <iso_3166_2_entry + code="MT-47" name="Safi"/> + <iso_3166_2_entry + code="MT-48" name="San Ġiljan"/> + <iso_3166_2_entry + code="MT-49" name="San Ġwann"/> + <iso_3166_2_entry + code="MT-50" name="San Lawrenz"/> + <iso_3166_2_entry + code="MT-51" name="San Pawl il-Baħar"/> + <iso_3166_2_entry + code="MT-52" name="Sannat"/> + <iso_3166_2_entry + code="MT-53" name="Santa Luċija"/> + <iso_3166_2_entry + code="MT-54" name="Santa Venera"/> + <iso_3166_2_entry + code="MT-55" name="Siġġiewi"/> + <iso_3166_2_entry + code="MT-56" name="Sliema"/> + <iso_3166_2_entry + code="MT-57" name="Swieqi"/> + <iso_3166_2_entry + code="MT-58" name="Ta’ Xbiex"/> + <iso_3166_2_entry + code="MT-59" name="Tarxien"/> + <iso_3166_2_entry + code="MT-60" name="Valletta"/> + <iso_3166_2_entry + code="MT-61" name="Xagħra"/> + <iso_3166_2_entry + code="MT-62" name="Xewkija"/> + <iso_3166_2_entry + code="MT-63" name="Xgħajra"/> + <iso_3166_2_entry + code="MT-64" name="Żabbar"/> + <iso_3166_2_entry + code="MT-65" name="Żebbuġ Għawdex"/> + <iso_3166_2_entry + code="MT-66" name="Żebbuġ Malta"/> + <iso_3166_2_entry + code="MT-67" name="Żejtun"/> + <iso_3166_2_entry + code="MT-68" name="Żurrieq"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mauritius --> + <iso_3166_country code="MU"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MU-BR" name="Beau Bassin-Rose Hill"/> + <iso_3166_2_entry + code="MU-CU" name="Curepipe"/> + <iso_3166_2_entry + code="MU-PU" name="Port Louis"/> + <iso_3166_2_entry + code="MU-QB" name="Quatre Bornes"/> + <iso_3166_2_entry + code="MU-VP" name="Vacoas-Phoenix"/> + </iso_3166_subset> + <iso_3166_subset type="Dependency"> + <iso_3166_2_entry + code="MU-AG" name="Agalega Islands"/> + <iso_3166_2_entry + code="MU-CC" name="Cargados Carajos Shoals"/> + <iso_3166_2_entry + code="MU-RO" name="Rodrigues Island"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MU-BL" name="Black River"/> + <iso_3166_2_entry + code="MU-FL" name="Flacq"/> + <iso_3166_2_entry + code="MU-GP" name="Grand Port"/> + <iso_3166_2_entry + code="MU-MO" name="Moka"/> + <iso_3166_2_entry + code="MU-PA" name="Pamplemousses"/> + <iso_3166_2_entry + code="MU-PW" name="Plaines Wilhems"/> + <iso_3166_2_entry + code="MU-PL" name="Port Louis"/> + <iso_3166_2_entry + code="MU-RP" name="Rivière du Rempart"/> + <iso_3166_2_entry + code="MU-SA" name="Savanne"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Maldives --> + <iso_3166_country code="MV"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MV-MLE" name="Male"/> + </iso_3166_subset> + <iso_3166_subset type="Atoll"> + <iso_3166_2_entry + code="MV-02" name="Alif"/> + <iso_3166_2_entry + code="MV-20" name="Baa"/> + <iso_3166_2_entry + code="MV-17" name="Dhaalu"/> + <iso_3166_2_entry + code="MV-14" name="Faafu"/> + <iso_3166_2_entry + code="MV-27" name="Gaafu Aliff"/> + <iso_3166_2_entry + code="MV-28" name="Gaafu Daalu"/> + <iso_3166_2_entry + code="MV-29" name="Gnaviyani"/> + <iso_3166_2_entry + code="MV-07" name="Haa Alif"/> + <iso_3166_2_entry + code="MV-23" name="Haa Dhaalu"/> + <iso_3166_2_entry + code="MV-26" name="Kaafu"/> + <iso_3166_2_entry + code="MV-05" name="Laamu"/> + <iso_3166_2_entry + code="MV-03" name="Lhaviyani"/> + <iso_3166_2_entry + code="MV-12" name="Meemu"/> + <iso_3166_2_entry + code="MV-25" name="Noonu"/> + <iso_3166_2_entry + code="MV-13" name="Raa"/> + <iso_3166_2_entry + code="MV-01" name="Seenu"/> + <iso_3166_2_entry + code="MV-24" name="Shaviyani"/> + <iso_3166_2_entry + code="MV-08" name="Thaa"/> + <iso_3166_2_entry + code="MV-04" name="Vaavu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Malawi --> + <iso_3166_country code="MW"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="MW C" name="Central Region"/> + <iso_3166_2_entry + code="MW N" name="Northern Region"/> + <iso_3166_2_entry + code="MW S" name="Southern Region"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="MW-BA" name="Balaka" parent="S"/> + <iso_3166_2_entry + code="MW-BL" name="Blantyre" parent="S"/> + <iso_3166_2_entry + code="MW-CK" name="Chikwawa" parent="S"/> + <iso_3166_2_entry + code="MW-CR" name="Chiradzulu" parent="S"/> + <iso_3166_2_entry + code="MW-CT" name="Chitipa" parent="N"/> + <iso_3166_2_entry + code="MW-DE" name="Dedza" parent="C"/> + <iso_3166_2_entry + code="MW-DO" name="Dowa" parent="C"/> + <iso_3166_2_entry + code="MW-KR" name="Karonga" parent="N"/> + <iso_3166_2_entry + code="MW-KS" name="Kasungu" parent="C"/> + <iso_3166_2_entry + code="MW-LK" name="Likoma" parent="N"/> + <iso_3166_2_entry + code="MW-LI" name="Lilongwe" parent="C"/> + <iso_3166_2_entry + code="MW-MH" name="Machinga" parent="S"/> + <iso_3166_2_entry + code="MW-MG" name="Mangochi" parent="S"/> + <iso_3166_2_entry + code="MW-MC" name="Mchinji" parent="C"/> + <iso_3166_2_entry + code="MW-MU" name="Mulanje" parent="S"/> + <iso_3166_2_entry + code="MW-MW" name="Mwanza" parent="S"/> + <iso_3166_2_entry + code="MW-MZ" name="Mzimba" parent="N"/> + <iso_3166_2_entry + code="MW-NE" name="Neno" parent="N"/> + <iso_3166_2_entry + code="MW-NB" name="Nkhata Bay" parent="N"/> + <iso_3166_2_entry + code="MW-NK" name="Nkhotakota" parent="C"/> + <iso_3166_2_entry + code="MW-NS" name="Nsanje" parent="S"/> + <iso_3166_2_entry + code="MW-NU" name="Ntcheu" parent="C"/> + <iso_3166_2_entry + code="MW-NI" name="Ntchisi" parent="C"/> + <iso_3166_2_entry + code="MW-PH" name="Phalombe" parent="S"/> + <iso_3166_2_entry + code="MW-RU" name="Rumphi" parent="N"/> + <iso_3166_2_entry + code="MW-SA" name="Salima" parent="C"/> + <iso_3166_2_entry + code="MW-TH" name="Thyolo" parent="S"/> + <iso_3166_2_entry + code="MW-ZO" name="Zomba" parent="S"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mexico --> + <iso_3166_country code="MX"> + <iso_3166_subset type="Federal district"> + <iso_3166_2_entry + code="MX-DIF" name="Distrito Federal"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="MX-AGU" name="Aguascalientes"/> + <iso_3166_2_entry + code="MX-BCN" name="Baja California"/> + <iso_3166_2_entry + code="MX-BCS" name="Baja California Sur"/> + <iso_3166_2_entry + code="MX-CAM" name="Campeche"/> + <iso_3166_2_entry + code="MX-COA" name="Coahuila"/> + <iso_3166_2_entry + code="MX-COL" name="Colima"/> + <iso_3166_2_entry + code="MX-CHP" name="Chiapas"/> + <iso_3166_2_entry + code="MX-CHH" name="Chihuahua"/> + <iso_3166_2_entry + code="MX-DUR" name="Durango"/> + <iso_3166_2_entry + code="MX-GUA" name="Guanajuato"/> + <iso_3166_2_entry + code="MX-GRO" name="Guerrero"/> + <iso_3166_2_entry + code="MX-HID" name="Hidalgo"/> + <iso_3166_2_entry + code="MX-JAL" name="Jalisco"/> + <iso_3166_2_entry + code="MX-MEX" name="México"/> + <iso_3166_2_entry + code="MX-MIC" name="Michoacán"/> + <iso_3166_2_entry + code="MX-MOR" name="Morelos"/> + <iso_3166_2_entry + code="MX-NAY" name="Nayarit"/> + <iso_3166_2_entry + code="MX-NLE" name="Nuevo León"/> + <iso_3166_2_entry + code="MX-OAX" name="Oaxaca"/> + <iso_3166_2_entry + code="MX-PUE" name="Puebla"/> + <iso_3166_2_entry + code="MX-QUE" name="Querétaro"/> + <iso_3166_2_entry + code="MX-ROO" name="Quintana Roo"/> + <iso_3166_2_entry + code="MX-SLP" name="San Luis Potosí"/> + <iso_3166_2_entry + code="MX-SIN" name="Sinaloa"/> + <iso_3166_2_entry + code="MX-SON" name="Sonora"/> + <iso_3166_2_entry + code="MX-TAB" name="Tabasco"/> + <iso_3166_2_entry + code="MX-TAM" name="Tamaulipas"/> + <iso_3166_2_entry + code="MX-TLA" name="Tlaxcala"/> + <iso_3166_2_entry + code="MX-VER" name="Veracruz"/> + <iso_3166_2_entry + code="MX-YUC" name="Yucatán"/> + <iso_3166_2_entry + code="MX-ZAC" name="Zacatecas"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Malaysia --> + <iso_3166_country code="MY"> + <iso_3166_subset type="Federal Territories"> + <iso_3166_2_entry + code="MY-14" name="Wilayah Persekutuan Kuala Lumpur"/> + <iso_3166_2_entry + code="MY-15" name="Wilayah Persekutuan Labuan"/> + <iso_3166_2_entry + code="MY-16" name="Wilayah Persekutuan Putrajaya"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="MY-01" name="Johor"/> + <iso_3166_2_entry + code="MY-02" name="Kedah"/> + <iso_3166_2_entry + code="MY-03" name="Kelantan"/> + <iso_3166_2_entry + code="MY-04" name="Melaka"/> + <iso_3166_2_entry + code="MY-05" name="Negeri Sembilan"/> + <iso_3166_2_entry + code="MY-06" name="Pahang"/> + <iso_3166_2_entry + code="MY-08" name="Perak"/> + <iso_3166_2_entry + code="MY-09" name="Perlis"/> + <iso_3166_2_entry + code="MY-07" name="Pulau Pinang"/> + <iso_3166_2_entry + code="MY-12" name="Sabah"/> + <iso_3166_2_entry + code="MY-13" name="Sarawak"/> + <iso_3166_2_entry + code="MY-10" name="Selangor"/> + <iso_3166_2_entry + code="MY-11" name="Terengganu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Mozambique --> + <iso_3166_country code="MZ"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="MZ-MPM" name="Maputo (city)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="MZ-P" name="Cabo Delgado"/> + <iso_3166_2_entry + code="MZ-G" name="Gaza"/> + <iso_3166_2_entry + code="MZ-I" name="Inhambane"/> + <iso_3166_2_entry + code="MZ-B" name="Manica"/> + <iso_3166_2_entry + code="MZ-L" name="Maputo"/> + <iso_3166_2_entry + code="MZ-N" name="Numpula"/> + <iso_3166_2_entry + code="MZ-A" name="Niassa"/> + <iso_3166_2_entry + code="MZ-S" name="Sofala"/> + <iso_3166_2_entry + code="MZ-T" name="Tete"/> + <iso_3166_2_entry + code="MZ-Q" name="Zambezia"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Namibia --> + <iso_3166_country code="NA"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="NA-CA" name="Caprivi"/> + <iso_3166_2_entry + code="NA-ER" name="Erongo"/> + <iso_3166_2_entry + code="NA-HA" name="Hardap"/> + <iso_3166_2_entry + code="NA-KA" name="Karas"/> + <iso_3166_2_entry + code="NA-KH" name="Khomas"/> + <iso_3166_2_entry + code="NA-KU" name="Kunene"/> + <iso_3166_2_entry + code="NA-OW" name="Ohangwena"/> + <iso_3166_2_entry + code="NA-OK" name="Okavango"/> + <iso_3166_2_entry + code="NA-OH" name="Omaheke"/> + <iso_3166_2_entry + code="NA-OS" name="Omusati"/> + <iso_3166_2_entry + code="NA-ON" name="Oshana"/> + <iso_3166_2_entry + code="NA-OT" name="Oshikoto"/> + <iso_3166_2_entry + code="NA-OD" name="Otjozondjupa"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Niger --> + <iso_3166_country code="NE"> + <iso_3166_subset type="Capital District"> + <iso_3166_2_entry + code="NE-8" name="Niamey"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="NE-1" name="Agadez"/> + <iso_3166_2_entry + code="NE-2" name="Diffa"/> + <iso_3166_2_entry + code="NE-3" name="Dosso"/> + <iso_3166_2_entry + code="NE-4" name="Maradi"/> + <iso_3166_2_entry + code="NE-5" name="Tahoua"/> + <iso_3166_2_entry + code="NE-6" name="Tillabéri"/> + <iso_3166_2_entry + code="NE-7" name="Zinder"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nigeria --> + <iso_3166_country code="NG"> + <iso_3166_subset type="Capital Territory"> + <iso_3166_2_entry + code="NG-FC" name="Abuja Capital Territory"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="NG-AB" name="Abia"/> + <iso_3166_2_entry + code="NG-AD" name="Adamawa"/> + <iso_3166_2_entry + code="NG-AK" name="Akwa Ibom"/> + <iso_3166_2_entry + code="NG-AN" name="Anambra"/> + <iso_3166_2_entry + code="NG-BA" name="Bauchi"/> + <iso_3166_2_entry + code="NG-BY" name="Bayelsa"/> + <iso_3166_2_entry + code="NG-BE" name="Benue"/> + <iso_3166_2_entry + code="NG-BO" name="Borno"/> + <iso_3166_2_entry + code="NG-CR" name="Cross River"/> + <iso_3166_2_entry + code="NG-DE" name="Delta"/> + <iso_3166_2_entry + code="NG-EB" name="Ebonyi"/> + <iso_3166_2_entry + code="NG-ED" name="Edo"/> + <iso_3166_2_entry + code="NG-EK" name="Ekiti"/> + <iso_3166_2_entry + code="NG-EN" name="Enugu"/> + <iso_3166_2_entry + code="NG-GO" name="Gombe"/> + <iso_3166_2_entry + code="NG-IM" name="Imo"/> + <iso_3166_2_entry + code="NG-JI" name="Jigawa"/> + <iso_3166_2_entry + code="NG-KD" name="Kaduna"/> + <iso_3166_2_entry + code="NG-KN" name="Kano"/> + <iso_3166_2_entry + code="NG-KT" name="Katsina"/> + <iso_3166_2_entry + code="NG-KE" name="Kebbi"/> + <iso_3166_2_entry + code="NG-KO" name="Kogi"/> + <iso_3166_2_entry + code="NG-KW" name="Kwara"/> + <iso_3166_2_entry + code="NG-LA" name="Lagos"/> + <iso_3166_2_entry + code="NG-NA" name="Nassarawa"/> + <iso_3166_2_entry + code="NG-NI" name="Niger"/> + <iso_3166_2_entry + code="NG-OG" name="Ogun"/> + <iso_3166_2_entry + code="NG-ON" name="Ondo"/> + <iso_3166_2_entry + code="NG-OS" name="Osun"/> + <iso_3166_2_entry + code="NG-OY" name="Oyo"/> + <iso_3166_2_entry + code="NG-PL" name="Plateau"/> + <iso_3166_2_entry + code="NG-RI" name="Rivers"/> + <iso_3166_2_entry + code="NG-SO" name="Sokoto"/> + <iso_3166_2_entry + code="NG-TA" name="Taraba"/> + <iso_3166_2_entry + code="NG-YO" name="Yobe"/> + <iso_3166_2_entry + code="NG-ZA" name="Zamfara"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nicaragua --> + <iso_3166_country code="NI"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="NI-BO" name="Boaco"/> + <iso_3166_2_entry + code="NI-CA" name="Carazo"/> + <iso_3166_2_entry + code="NI-CI" name="Chinandega"/> + <iso_3166_2_entry + code="NI-CO" name="Chontales"/> + <iso_3166_2_entry + code="NI-ES" name="Estelí"/> + <iso_3166_2_entry + code="NI-GR" name="Granada"/> + <iso_3166_2_entry + code="NI-JI" name="Jinotega"/> + <iso_3166_2_entry + code="NI-LE" name="León"/> + <iso_3166_2_entry + code="NI-MD" name="Madriz"/> + <iso_3166_2_entry + code="NI-MN" name="Managua"/> + <iso_3166_2_entry + code="NI-MS" name="Masaya"/> + <iso_3166_2_entry + code="NI-MT" name="Matagalpa"/> + <iso_3166_2_entry + code="NI-NS" name="Nueva Segovia"/> + <iso_3166_2_entry + code="NI-SJ" name="Río San Juan"/> + <iso_3166_2_entry + code="NI-RI" name="Rivas"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous Region"> + <iso_3166_2_entry + code="NI-AN" name="Atlántico Norte"/> + <iso_3166_2_entry + code="NI-AS" name="Atlántico Sur"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Netherlands --> + <iso_3166_country code="NL"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="NL-DR" name="Drenthe"/> + <iso_3166_2_entry + code="NL-FL" name="Flevoland"/> + <iso_3166_2_entry + code="NL-FR" name="Friesland"/> + <iso_3166_2_entry + code="NL-GE" name="Gelderland"/> + <iso_3166_2_entry + code="NL-GR" name="Groningen"/> + <iso_3166_2_entry + code="NL-LI" name="Limburg"/> + <iso_3166_2_entry + code="NL-NB" name="Noord-Brabant"/> + <iso_3166_2_entry + code="NL-NH" name="Noord-Holland"/> + <iso_3166_2_entry + code="NL-OV" name="Overijssel"/> + <iso_3166_2_entry + code="NL-UT" name="Utrecht"/> + <iso_3166_2_entry + code="NL-ZE" name="Zeeland"/> + <iso_3166_2_entry + code="NL-ZH" name="Zuid-Holland"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Norway --> + <iso_3166_country code="NO"> + <iso_3166_subset type="County"> + <!-- Derived from http://geotags.com/geo/DMS3.html --> + <!-- See also Country code 'SJ' for Jan Mayen & Svalbard --> + <iso_3166_2_entry + code="NO-02" name="Akershus"/> + <iso_3166_2_entry + code="NO-09" name="Aust-Agder"/> + <iso_3166_2_entry + code="NO-06" name="Buskerud"/> + <iso_3166_2_entry + code="NO-20" name="Finnmark"/> + <iso_3166_2_entry + code="NO-04" name="Hedmark"/> + <iso_3166_2_entry + code="NO-12" name="Hordaland"/> + <iso_3166_2_entry + code="NO-15" name="Møre og Romsdal"/> + <iso_3166_2_entry + code="NO-18" name="Nordland"/> + <iso_3166_2_entry + code="NO-17" name="Nord-Trøndelag"/> + <iso_3166_2_entry + code="NO-05" name="Oppland"/> + <iso_3166_2_entry + code="NO-03" name="Oslo"/> + <iso_3166_2_entry + code="NO-11" name="Rogaland"/> + <iso_3166_2_entry + code="NO-14" name="Sogn og Fjordane"/> + <iso_3166_2_entry + code="NO-16" name="Sør-Trøndelag"/> + <iso_3166_2_entry + code="NO-08" name="Telemark"/> + <iso_3166_2_entry + code="NO-19" name="Troms"/> + <iso_3166_2_entry + code="NO-10" name="Vest-Agder"/> + <iso_3166_2_entry + code="NO-07" name="Vestfold"/> + <iso_3166_2_entry + code="NO-01" name="Østfold"/> + <iso_3166_2_entry + code="NO-22" name="Jan Mayen"/> + <iso_3166_2_entry + code="NO-21" name="Svalbard"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nepal --> + <iso_3166_country code="NP"> + <iso_3166_subset type="Development region"> + <iso_3166_2_entry + code="NP-1" name="Madhyamanchal"/> + <iso_3166_2_entry + code="NP-2" name="Madhya Pashchimanchal"/> + <iso_3166_2_entry + code="NP-3" name="Pashchimanchal"/> + <iso_3166_2_entry + code="NP-4" name="Purwanchal"/> + <iso_3166_2_entry + code="NP-5" name="Sudur Pashchimanchal"/> + </iso_3166_subset> + <iso_3166_subset type="zone"> + <iso_3166_2_entry + code="NP-BA" name="Bagmati" parent="1"/> + <iso_3166_2_entry + code="NP-BH" name="Bheri" parent="2"/> + <iso_3166_2_entry + code="NP-DH" name="Dhawalagiri" parent="3"/> + <iso_3166_2_entry + code="NP-GA" name="Gandaki" parent="3"/> + <iso_3166_2_entry + code="NP-JA" name="Janakpur" parent="1"/> + <iso_3166_2_entry + code="NP-KA" name="Karnali" parent="2"/> + <iso_3166_2_entry + code="NP-KO" name="Kosi" parent="4"/> + <iso_3166_2_entry + code="NP-LU" name="Lumbini" parent="3"/> + <iso_3166_2_entry + code="NP-MA" name="Mahakali" parent="5"/> + <iso_3166_2_entry + code="NP-ME" name="Mechi" parent="4"/> + <iso_3166_2_entry + code="NP-NA" name="Narayani" parent="1"/> + <iso_3166_2_entry + code="NP-RA" name="Rapti" parent="2"/> + <iso_3166_2_entry + code="NP-SA" name="Sagarmatha" parent="4"/> + <iso_3166_2_entry + code="NP-SE" name="Seti" parent="5"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Nauru --> + <iso_3166_country code="NR"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="NR-01" name="Aiwo"/> + <iso_3166_2_entry + code="NR-02" name="Anabar"/> + <iso_3166_2_entry + code="NR-03" name="Anetan"/> + <iso_3166_2_entry + code="NR-04" name="Anibare"/> + <iso_3166_2_entry + code="NR-05" name="Baiti"/> + <iso_3166_2_entry + code="NR-06" name="Boe"/> + <iso_3166_2_entry + code="NR-07" name="Buada"/> + <iso_3166_2_entry + code="NR-08" name="Denigomodu"/> + <iso_3166_2_entry + code="NR-09" name="Ewa"/> + <iso_3166_2_entry + code="NR-10" name="Ijuw"/> + <iso_3166_2_entry + code="NR-11" name="Meneng"/> + <iso_3166_2_entry + code="NR-12" name="Nibok"/> + <iso_3166_2_entry + code="NR-13" name="Uaboe"/> + <iso_3166_2_entry + code="NR-14" name="Yaren"/> + </iso_3166_subset> + </iso_3166_country> + <!-- New Zealand --> + <iso_3166_country code="NZ"> + <iso_3166_subset type="Island"> + <iso_3166_2_entry + code="NZ-N" name="North Island"/> + <iso_3166_2_entry + code="NZ-S" name="South Island"/> + </iso_3166_subset> + <iso_3166_subset type="Regional council"> + <iso_3166_2_entry + code="NZ-AUK" name="Auckland" parent="N"/> + <iso_3166_2_entry + code="NZ-BOP" name="Bay of Plenty" parent="N"/> + <iso_3166_2_entry + code="NZ-CAN" name="Canterbury" parent="S"/> + <iso_3166_2_entry + code="NZ-HKB" name="Hawke's Bay" parent="N"/> + <iso_3166_2_entry + code="NZ-MWT" name="Manawatu-Wanganui" parent="N"/> + <iso_3166_2_entry + code="NZ-NTL" name="Northland" parent="N"/> + <iso_3166_2_entry + code="NZ-OTA" name="Otago" parent="S"/> + <iso_3166_2_entry + code="NZ-STL" name="Southland" parent="S"/> + <iso_3166_2_entry + code="NZ-TKI" name="Taranaki" parent="N"/> + <iso_3166_2_entry + code="NZ-WKO" name="Waikato" parent="N"/> + <iso_3166_2_entry + code="NZ-WGN" name="Wellington" parent="N"/> + <iso_3166_2_entry + code="NZ-WTC" name="West Coast" parent="S"/> + </iso_3166_subset> + <iso_3166_subset type="Unitary authority"> + <iso_3166_2_entry + code="NZ-GIS" name="Gisborne District" parent="N"/> + <iso_3166_2_entry + code="NZ-MBH" name="Marlborough District" parent="S"/> + <iso_3166_2_entry + code="NZ-NSN" name="Nelson City" parent="S"/> + <iso_3166_2_entry + code="NZ-TAS" name="Tasman District" parent="S"/> + </iso_3166_subset> + <iso_3166_subset type="Special island authority"> + <iso_3166_2_entry + code="NZ-CIT" name="Chatham Islands Territory"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Oman --> + <iso_3166_country code="OM"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="OM-DA" name="Ad Dākhilīya"/> + <iso_3166_2_entry + code="OM-BA" name="Al Bāţinah"/> + <iso_3166_2_entry + code="OM-WU" name="Al Wusţá"/> + <iso_3166_2_entry + code="OM-SH" name="Ash Sharqīyah"/> + <iso_3166_2_entry + code="OM-ZA" name="Az̧ Z̧āhirah"/> + </iso_3166_subset> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="OM-BU" name="Al Buraymī"/> + <iso_3166_2_entry + code="OM-MA" name="Masqaţ"/> + <iso_3166_2_entry + code="OM-MU" name="Musandam"/> + <iso_3166_2_entry + code="OM-ZU" name="Z̧ufār"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Panama --> + <iso_3166_country code="PA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PA-1" name="Bocas del Toro"/> + <iso_3166_2_entry + code="PA-4" name="Chiriquí"/> + <iso_3166_2_entry + code="PA-2" name="Coclé"/> + <iso_3166_2_entry + code="PA-3" name="Colón"/> + <iso_3166_2_entry + code="PA-5" name="Darién"/> + <iso_3166_2_entry + code="PA-6" name="Herrera"/> + <iso_3166_2_entry + code="PA-7" name="Los Santos"/> + <iso_3166_2_entry + code="PA-8" name="Panamá"/> + <iso_3166_2_entry + code="PA-9" name="Veraguas"/> + </iso_3166_subset> + <iso_3166_subset type="Indigenous region"> + <iso_3166_2_entry + code="PA-EM" name="Emberá"/> + <iso_3166_2_entry + code="PA-KY" name="Kuna Yala"/> + <iso_3166_2_entry + code="PA-NB" name="Ngöbe-Buglé"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Peru --> + <iso_3166_country code="PE"> + <iso_3166_subset type="Constitutional province"> + <iso_3166_2_entry + code="PE-CAL" name="El Callao"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="PE-LMA" name="Municipalidad Metropolitana de Lima"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="PE-AMA" name="Amazonas"/> + <iso_3166_2_entry + code="PE-ANC" name="Ancash"/> + <iso_3166_2_entry + code="PE-APU" name="Apurímac"/> + <iso_3166_2_entry + code="PE-ARE" name="Arequipa"/> + <iso_3166_2_entry + code="PE-AYA" name="Ayacucho"/> + <iso_3166_2_entry + code="PE-CAJ" name="Cajamarca"/> + <iso_3166_2_entry + code="PE-CUS" name="Cusco [Cuzco]"/> + <iso_3166_2_entry + code="PE-HUV" name="Huancavelica"/> + <iso_3166_2_entry + code="PE-HUC" name="Huánuco"/> + <iso_3166_2_entry + code="PE-ICA" name="Ica"/> + <iso_3166_2_entry + code="PE-JUN" name="Junín"/> + <iso_3166_2_entry + code="PE-LAL" name="La Libertad"/> + <iso_3166_2_entry + code="PE-LAM" name="Lambayeque"/> + <iso_3166_2_entry + code="PE-LIM" name="Lima"/> + <iso_3166_2_entry + code="PE-LOR" name="Loreto"/> + <iso_3166_2_entry + code="PE-MDD" name="Madre de Dios"/> + <iso_3166_2_entry + code="PE-MOQ" name="Moquegua"/> + <iso_3166_2_entry + code="PE-PAS" name="Pasco"/> + <iso_3166_2_entry + code="PE-PIU" name="Piura"/> + <iso_3166_2_entry + code="PE-PUN" name="Puno"/> + <iso_3166_2_entry + code="PE-SAM" name="San Martín"/> + <iso_3166_2_entry + code="PE-TAC" name="Tacna"/> + <iso_3166_2_entry + code="PE-TUM" name="Tumbes"/> + <iso_3166_2_entry + code="PE-UCA" name="Ucayali"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Papua New Guinea --> + <iso_3166_country code="PG"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="PG-NCD" name="National Capital District (Port Moresby)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PG-CPM" name="Central"/> + <iso_3166_2_entry + code="PG-CPK" name="Chimbu"/> + <iso_3166_2_entry + code="PG-EHG" name="Eastern Highlands"/> + <iso_3166_2_entry + code="PG-EBR" name="East New Britain"/> + <iso_3166_2_entry + code="PG-ESW" name="East Sepik"/> + <iso_3166_2_entry + code="PG-EPW" name="Enga"/> + <iso_3166_2_entry + code="PG-GPK" name="Gulf"/> + <iso_3166_2_entry + code="PG-MPM" name="Madang"/> + <iso_3166_2_entry + code="PG-MRL" name="Manus"/> + <iso_3166_2_entry + code="PG-MBA" name="Milne Bay"/> + <iso_3166_2_entry + code="PG-MPL" name="Morobe"/> + <iso_3166_2_entry + code="PG-NIK" name="New Ireland"/> + <iso_3166_2_entry + code="PG-NPP" name="Northern"/> + <iso_3166_2_entry + code="PG-NSA" name="North Solomons"/> + <iso_3166_2_entry + code="PG-SAN" name="Sandaun"/> + <iso_3166_2_entry + code="PG-SHM" name="Southern Highlands"/> + <iso_3166_2_entry + code="PG-WPD" name="Western"/> + <iso_3166_2_entry + code="PG-WHM" name="Western Highlands"/> + <iso_3166_2_entry + code="PG-WBK" name="West New Britain"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Phillipines --> + <iso_3166_country code="PH"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="PH-14" name="Autonomous Region in Muslim Mindanao (ARMM)"/> + <iso_3166_2_entry + code="PH-05" name="Bicol (Region V)"/> + <iso_3166_2_entry + code="PH-02" name="Cagayan Valley (Region II)"/> + <iso_3166_2_entry + code="PH-40" name="CALABARZON (Region IV-A)"/> + <iso_3166_2_entry + code="PH-13" name="Caraga (Region XIII)"/> + <iso_3166_2_entry + code="PH-03" name="Central Luzon (Region III)"/> + <iso_3166_2_entry + code="PH-07" name="Central Visayas (Region VII)"/> + <iso_3166_2_entry + code="PH-15" name="Cordillera Administrative Region (CAR)"/> + <iso_3166_2_entry + code="PH-08" name="Eastern Visayas (Region VIII)"/> + <iso_3166_2_entry + code="PH-01" name="Ilocos (Region I)"/> + <iso_3166_2_entry + code="PH-41" name="MIMAROPA (Region IV-B)"/> + <iso_3166_2_entry + code="PH-00" name="National Capital Region"/> + <iso_3166_2_entry + code="PH-10" name="Northern Mindanao (Region X)"/> + <iso_3166_2_entry + code="PH-12" name="Soccsksargen (Region XII)"/> + <iso_3166_2_entry + code="PH-06" name="Western Visayas (Region VI)"/> + <iso_3166_2_entry + code="PH-09" name="Zamboanga Peninsula (Region IX)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PH-ABR" name="Abra" parent="15"/> + <iso_3166_2_entry + code="PH-AGN" name="Agusan del Norte" parent="13"/> + <iso_3166_2_entry + code="PH-AGS" name="Agusan del Sur" parent="13"/> + <iso_3166_2_entry + code="PH-AKL" name="Aklan" parent="06"/> + <iso_3166_2_entry + code="PH-ALB" name="Albay" parent="05"/> + <iso_3166_2_entry + code="PH-ANT" name="Antique" parent="06"/> + <iso_3166_2_entry + code="PH-APA" name="Apayao" parent="15"/> + <iso_3166_2_entry + code="PH-AUR" name="Aurora" parent="03"/> + <iso_3166_2_entry + code="PH-BAS" name="Basilan" parent="09"/> + <iso_3166_2_entry + code="PH-BAN" name="Batasn" parent="03"/> + <iso_3166_2_entry + code="PH-BTN" name="Batanes" parent="02"/> + <iso_3166_2_entry + code="PH-BTG" name="Batangas" parent="40"/> + <iso_3166_2_entry + code="PH-BEN" name="Benguet" parent="15"/> + <iso_3166_2_entry + code="PH-BIL" name="Biliran" parent="08"/> + <iso_3166_2_entry + code="PH-BOH" name="Bohol" parent="07"/> + <iso_3166_2_entry + code="PH-BUK" name="Bukidnon" parent="10"/> + <iso_3166_2_entry + code="PH-BUL" name="Bulacan" parent="03"/> + <iso_3166_2_entry + code="PH-CAG" name="Cagayan" parent="02"/> + <iso_3166_2_entry + code="PH-CAN" name="Camarines Norte" parent="05"/> + <iso_3166_2_entry + code="PH-CAS" name="Camarines Sur" parent="05"/> + <iso_3166_2_entry + code="PH-CAM" name="Camiguin" parent="10"/> + <iso_3166_2_entry + code="PH-CAP" name="Capiz" parent="06"/> + <iso_3166_2_entry + code="PH-CAT" name="Catanduanes" parent="05"/> + <iso_3166_2_entry + code="PH-CAV" name="Cavite" parent="40"/> + <iso_3166_2_entry + code="PH-CEB" name="Cebu" parent="07"/> + <iso_3166_2_entry + code="PH-COM" name="Compostela Valley" parent="11"/> + <iso_3166_2_entry + code="PH-DAV" name="Davao del Norte" parent="11"/> + <iso_3166_2_entry + code="PH-DAS" name="Davao del Sur" parent="11"/> + <iso_3166_2_entry + code="PH-DAO" name="Davao Oriental" parent="11"/> + <iso_3166_2_entry + code="PH-DIN" name="Dinagat Islands" parent="13"/> + <iso_3166_2_entry + code="PH-EAS" name="Eastern Samar" parent="08"/> + <iso_3166_2_entry + code="PH-GUI" name="Guimaras" parent="06"/> + <iso_3166_2_entry + code="PH-IFU" name="Ifugao" parent="15"/> + <iso_3166_2_entry + code="PH-ILN" name="Ilocos Norte" parent="01"/> + <iso_3166_2_entry + code="PH-ILS" name="Ilocos Sur" parent="01"/> + <iso_3166_2_entry + code="PH-ILI" name="Iloilo" parent="06"/> + <iso_3166_2_entry + code="PH-ISA" name="Isabela" parent="02"/> + <iso_3166_2_entry + code="PH-KAL" name="Kalinga-Apayso" parent="15"/> + <iso_3166_2_entry + code="PH-LAG" name="Laguna" parent="40"/> + <iso_3166_2_entry + code="PH-LAN" name="Lanao del Norte" parent="12"/> + <iso_3166_2_entry + code="PH-LAS" name="Lanao del Sur" parent="14"/> + <iso_3166_2_entry + code="PH-LUN" name="La Union" parent="01"/> + <iso_3166_2_entry + code="PH-LEY" name="Leyte" parent="08"/> + <iso_3166_2_entry + code="PH-MAG" name="Maguindanao" parent="14"/> + <iso_3166_2_entry + code="PH-MAD" name="Marinduque" parent="41"/> + <iso_3166_2_entry + code="PH-MAS" name="Masbate" parent="05"/> + <iso_3166_2_entry + code="PH-MDC" name="Mindoro Occidental" parent="41"/> + <iso_3166_2_entry + code="PH-MDR" name="Mindoro Oriental" parent="41"/> + <iso_3166_2_entry + code="PH-MSC" name="Misamis Occidental" parent="10"/> + <iso_3166_2_entry + code="PH-MSR" name="Misamis Oriental" parent="10"/> + <iso_3166_2_entry + code="PH-MOU" name="Mountain Province" parent="15"/> + <iso_3166_2_entry + code="PH-NEC" name="Negroe Occidental" parent="06"/> + <iso_3166_2_entry + code="PH-NER" name="Negros Oriental" parent="07"/> + <iso_3166_2_entry + code="PH-NCO" name="North Cotabato" parent="12"/> + <iso_3166_2_entry + code="PH-NSA" name="Northern Samar" parent="08"/> + <iso_3166_2_entry + code="PH-NUE" name="Nueva Ecija" parent="03"/> + <iso_3166_2_entry + code="PH-NUV" name="Nueva Vizcaya" parent="02"/> + <iso_3166_2_entry + code="PH-PLW" name="Palawan" parent="41"/> + <iso_3166_2_entry + code="PH-PAM" name="Pampanga" parent="03"/> + <iso_3166_2_entry + code="PH-PAN" name="Pangasinan" parent="01"/> + <iso_3166_2_entry + code="PH-QUE" name="Quezon" parent="40"/> + <iso_3166_2_entry + code="PH-QUI" name="Quirino" parent="02"/> + <iso_3166_2_entry + code="PH-RIZ" name="Rizal" parent="40"/> + <iso_3166_2_entry + code="PH-ROM" name="Romblon" parent="41"/> + <iso_3166_2_entry + code="PH-SAR" name="Sarangani" parent="11"/> + <iso_3166_2_entry + code="PH-SIG" name="Siquijor" parent="07"/> + <iso_3166_2_entry + code="PH-SOR" name="Sorsogon" parent="05"/> + <iso_3166_2_entry + code="PH-SCO" name="South Cotabato" parent="11"/> + <iso_3166_2_entry + code="PH-SLE" name="Southern Leyte" parent="08"/> + <iso_3166_2_entry + code="PH-SUK" name="Sultan Kudarat" parent="12"/> + <iso_3166_2_entry + code="PH-SLU" name="Sulu" parent="14"/> + <iso_3166_2_entry + code="PH-SUN" name="Surigao del Norte" parent="13"/> + <iso_3166_2_entry + code="PH-SUR" name="Surigao del Sur" parent="13"/> + <iso_3166_2_entry + code="PH-TAR" name="Tarlac" parent="03"/> + <iso_3166_2_entry + code="PH-TAW" name="Tawi-Tawi" parent="14"/> + <iso_3166_2_entry + code="PH-WSA" name="Western Samar" parent="08"/> + <iso_3166_2_entry + code="PH-ZMB" name="Zambales" parent="03"/> + <iso_3166_2_entry + code="PH-ZAN" name="Zamboanga del Norte" parent="09"/> + <iso_3166_2_entry + code="PH-ZAS" name="Zamboanga del Sur" parent="09"/> + <iso_3166_2_entry + code="PH-ZSI" name="Zamboanga Sibugay" parent="09"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Pakistan --> + <iso_3166_country code="PK"> + <iso_3166_subset type="Capital territory"> + <iso_3166_2_entry + code="PK-IS" name="Islamabad"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PK-BA" name="Balochistan"/> + <iso_3166_2_entry + code="PK-NW" name="North-West Frontier"/> + <iso_3166_2_entry + code="PK-PB" name="Punjab"/> + <iso_3166_2_entry + code="PK-SD" name="Sindh"/> + </iso_3166_subset> + <iso_3166_subset type="Area"> + <iso_3166_2_entry + code="PK-TA" name="Federally Administered Tribal Areas"/> + <iso_3166_2_entry + code="PK-JK" name="Azad Kashmir"/> + <iso_3166_2_entry + code="PK-NA" name="Northern Areas"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Poland --> + <iso_3166_country code="PL"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="PL-DS" name="Dolnośląskie"/> + <iso_3166_2_entry + code="PL-KP" name="Kujawsko-pomorskie"/> + <iso_3166_2_entry + code="PL-LU" name="Lubelskie"/> + <iso_3166_2_entry + code="PL-LB" name="Lubuskie"/> + <iso_3166_2_entry + code="PL-LD" name="Łódzkie"/> + <iso_3166_2_entry + code="PL-MA" name="Małopolskie"/> + <iso_3166_2_entry + code="PL-MZ" name="Mazowieckie"/> + <iso_3166_2_entry + code="PL-OP" name="Opolskie"/> + <iso_3166_2_entry + code="PL-PK" name="Podkarpackie"/> + <iso_3166_2_entry + code="PL-PD" name="Podlaskie"/> + <iso_3166_2_entry + code="PL-PM" name="Pomorskie"/> + <iso_3166_2_entry + code="PL-SL" name="Śląskie"/> + <iso_3166_2_entry + code="PL-SK" name="Świętokrzyskie"/> + <iso_3166_2_entry + code="PL-WN" name="Warmińsko-mazurskie"/> + <iso_3166_2_entry + code="PL-WP" name="Wielkopolskie"/> + <iso_3166_2_entry + code="PL-ZP" name="Zachodniopomorskie"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Palestinian Territory, Occupied --> + <iso_3166_country code="PS"/> + <!-- Portugal --> + <iso_3166_country code="PT"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="PT-01" name="Aveiro"/> + <iso_3166_2_entry + code="PT-02" name="Beja"/> + <iso_3166_2_entry + code="PT-03" name="Braga"/> + <iso_3166_2_entry + code="PT-04" name="Bragança"/> + <iso_3166_2_entry + code="PT-05" name="Castelo Branco"/> + <iso_3166_2_entry + code="PT-06" name="Coimbra"/> + <iso_3166_2_entry + code="PT-07" name="Évora"/> + <iso_3166_2_entry + code="PT-08" name="Faro"/> + <iso_3166_2_entry + code="PT-09" name="Guarda"/> + <iso_3166_2_entry + code="PT-10" name="Leiria"/> + <iso_3166_2_entry + code="PT-11" name="Lisboa"/> + <iso_3166_2_entry + code="PT-12" name="Portalegre"/> + <iso_3166_2_entry + code="PT-13" name="Porto"/> + <iso_3166_2_entry + code="PT-14" name="Santarém"/> + <iso_3166_2_entry + code="PT-15" name="Setúbal"/> + <iso_3166_2_entry + code="PT-16" name="Viana do Castelo"/> + <iso_3166_2_entry + code="PT-17" name="Vila Real"/> + <iso_3166_2_entry + code="PT-18" name="Viseu"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous region"> + <iso_3166_2_entry + code="PT-20" name="Região Autónoma dos Açores"/> + <iso_3166_2_entry + code="PT-30" name="Região Autónoma da Madeira"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Palau --> + <iso_3166_country code="PW"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="PW-002" name="Aimeliik"/> + <iso_3166_2_entry + code="PW-004" name="Airai"/> + <iso_3166_2_entry + code="PW-010" name="Angaur"/> + <iso_3166_2_entry + code="PW-050" name="Hatobohei"/> + <iso_3166_2_entry + code="PW-100" name="Kayangel"/> + <iso_3166_2_entry + code="PW-150" name="Koror"/> + <iso_3166_2_entry + code="PW-212" name="Melekeok"/> + <iso_3166_2_entry + code="PW-214" name="Ngaraard"/> + <iso_3166_2_entry + code="PW-218" name="Ngarchelong"/> + <iso_3166_2_entry + code="PW-222" name="Ngardmau"/> + <iso_3166_2_entry + code="PW-224" name="Ngatpang"/> + <iso_3166_2_entry + code="PW-226" name="Ngchesar"/> + <iso_3166_2_entry + code="PW-227" name="Ngeremlengui"/> + <iso_3166_2_entry + code="PW-228" name="Ngiwal"/> + <iso_3166_2_entry + code="PW-350" name="Peleliu"/> + <iso_3166_2_entry + code="PW-370" name="Sonsorol"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Paraguay --> + <iso_3166_country code="PY"> + <iso_3166_subset type="Capital district"> + <iso_3166_2_entry + code="PY-ASU" name="Asunción"/> + </iso_3166_subset> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="PY-16" name="Alto Paraguay"/> + <iso_3166_2_entry + code="PY-10" name="Alto Paraná"/> + <iso_3166_2_entry + code="PY-13" name="Amambay"/> + <iso_3166_2_entry + code="PY-19" name="Boquerón"/> + <iso_3166_2_entry + code="PY-5" name="Caaguazú"/> + <iso_3166_2_entry + code="PY-6" name="Caazapá"/> + <iso_3166_2_entry + code="PY-14" name="Canindeyú"/> + <iso_3166_2_entry + code="PY-11" name="Central"/> + <iso_3166_2_entry + code="PY-1" name="Concepción"/> + <iso_3166_2_entry + code="PY-3" name="Cordillera"/> + <iso_3166_2_entry + code="PY-4" name="Guairá"/> + <iso_3166_2_entry + code="PY-7" name="Itapúa"/> + <iso_3166_2_entry + code="PY-8" name="Misiones"/> + <iso_3166_2_entry + code="PY-12" name="Ñeembucú"/> + <iso_3166_2_entry + code="PY-9" name="Paraguarí"/> + <iso_3166_2_entry + code="PY-15" name="Presidente Hayes"/> + <iso_3166_2_entry + code="PY-2" name="San Pedro"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Qatar --> + <iso_3166_country code="QA"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="QA-DA" name="Ad Dawhah"/> + <iso_3166_2_entry + code="QA-GH" name="Al Ghuwayriyah"/> + <iso_3166_2_entry + code="QA-JU" name="Al Jumayliyah"/> + <iso_3166_2_entry + code="QA-KH" name="Al Khawr"/> + <iso_3166_2_entry + code="QA-WA" name="Al Wakrah"/> + <iso_3166_2_entry + code="QA-RA" name="Ar Rayyan"/> + <iso_3166_2_entry + code="QA-JB" name="Jariyan al Batnah"/> + <iso_3166_2_entry + code="QA-MS" name="Madinat ash Shamal"/> + <iso_3166_2_entry + code="QA-US" name="Umm Salal"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Romania --> + <iso_3166_country code="RO"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="RO-AB" name="Alba"/> + <iso_3166_2_entry + code="RO-AR" name="Arad"/> + <iso_3166_2_entry + code="RO-AG" name="Argeș"/> + <iso_3166_2_entry + code="RO-BC" name="Bacău"/> + <iso_3166_2_entry + code="RO-BH" name="Bihor"/> + <iso_3166_2_entry + code="RO-BN" name="Bistrița-Năsăud"/> + <iso_3166_2_entry + code="RO-BT" name="Botoșani"/> + <iso_3166_2_entry + code="RO-BV" name="Brașov"/> + <iso_3166_2_entry + code="RO-BR" name="Brăila"/> + <iso_3166_2_entry + code="RO-BZ" name="Buzău"/> + <iso_3166_2_entry + code="RO-CS" name="Caraș-Severin"/> + <iso_3166_2_entry + code="RO-CL" name="Călărași"/> + <iso_3166_2_entry + code="RO-CJ" name="Cluj"/> + <iso_3166_2_entry + code="RO-CT" name="Constanța"/> + <iso_3166_2_entry + code="RO-CV" name="Covasna"/> + <iso_3166_2_entry + code="RO-DB" name="Dâmbovița"/> + <iso_3166_2_entry + code="RO-DJ" name="Dolj"/> + <iso_3166_2_entry + code="RO-GL" name="Galați"/> + <iso_3166_2_entry + code="RO-GR" name="Giurgiu"/> + <iso_3166_2_entry + code="RO-GJ" name="Gorj"/> + <iso_3166_2_entry + code="RO-HR" name="Harghita"/> + <iso_3166_2_entry + code="RO-HD" name="Hunedoara"/> + <iso_3166_2_entry + code="RO-IL" name="Ialomița"/> + <iso_3166_2_entry + code="RO-IS" name="Iași"/> + <iso_3166_2_entry + code="RO-IF" name="Ilfov"/> + <iso_3166_2_entry + code="RO-MM" name="Maramureș"/> + <iso_3166_2_entry + code="RO-MH" name="Mehedinți"/> + <iso_3166_2_entry + code="RO-MS" name="Mureș"/> + <iso_3166_2_entry + code="RO-NT" name="Neamț"/> + <iso_3166_2_entry + code="RO-OT" name="Olt"/> + <iso_3166_2_entry + code="RO-PH" name="Prahova"/> + <iso_3166_2_entry + code="RO-SM" name="Satu Mare"/> + <iso_3166_2_entry + code="RO-SJ" name="Sălaj"/> + <iso_3166_2_entry + code="RO-SB" name="Sibiu"/> + <iso_3166_2_entry + code="RO-SV" name="Suceava"/> + <iso_3166_2_entry + code="RO-TR" name="Teleorman"/> + <iso_3166_2_entry + code="RO-TM" name="Timiș"/> + <iso_3166_2_entry + code="RO-TL" name="Tulcea"/> + <iso_3166_2_entry + code="RO-VS" name="Vaslui"/> + <iso_3166_2_entry + code="RO-VL" name="Vâlcea"/> + <iso_3166_2_entry + code="RO-VN" name="Vrancea"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="RO-B" name="București"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Serbia --> + <iso_3166_country code="RS"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="RS-00" name="Beograd"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous province"> + <iso_3166_2_entry + code="RS KM" name="Kosovo-Metohija"/> + <iso_3166_2_entry + code="RS VO" name="Vojvodina"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="RS-14" name="Borski okrug"/> + <iso_3166_2_entry + code="RS-11" name="Braničevski okrug"/> + <iso_3166_2_entry + code="RS-23" name="Jablanički okrug"/> + <iso_3166_2_entry + code="RS-06" name="Južnobački okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-04" name="Južnobanatski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-09" name="Kolubarski okrug"/> + <iso_3166_2_entry + code="RS-25" name="Kosovski okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-28" name="Kosovsko-Mitrovački okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-29" name="Kosovsko-Pomoravski okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-08" name="Mačvanski okrug"/> + <iso_3166_2_entry + code="RS-17" name="Moravički okrug"/> + <iso_3166_2_entry + code="RS-20" name="Nišavski okrug"/> + <iso_3166_2_entry + code="RS-24" name="Pčinjski okrug"/> + <iso_3166_2_entry + code="RS-26" name="Pećki okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-22" name="Pirotski okrug"/> + <iso_3166_2_entry + code="RS-10" name="Podunavski okrug"/> + <iso_3166_2_entry + code="RS-13" name="Pomoravski okrug"/> + <iso_3166_2_entry + code="RS-27" name="Prizrenski okrug" parent="KM"/> + <iso_3166_2_entry + code="RS-19" name="Rasinski okrug"/> + <iso_3166_2_entry + code="RS-18" name="Raški okrug"/> + <iso_3166_2_entry + code="RS-01" name="Severnobački okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-03" name="Severnobanatski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-02" name="Srednjebanatski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-07" name="Sremski okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-12" name="Šumadijski okrug"/> + <iso_3166_2_entry + code="RS-21" name="Toplički okrug"/> + <iso_3166_2_entry + code="RS-15" name="Zaječarski okrug"/> + <iso_3166_2_entry + code="RS-05" name="Zapadnobački okrug" parent="VO"/> + <iso_3166_2_entry + code="RS-16" name="Zlatiborski okrug"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Russia --> + <iso_3166_country code="RU"> + <!-- The ISO 3166-2 entries give romanised versions according to two standards, --> + <!-- GOST (1983) and Russian BGN/PCGN (1947). --> + <!-- Here the BGN entry is listed , since it was listed first in the ISO document --> + <!-- Localize to Cyrillic anyway in the po files. --> + <iso_3166_subset type="Republic"> + <iso_3166_2_entry + code="RU-AD" name="Adygeya, Respublika"/> + <iso_3166_2_entry + code="RU-AL" name="Altay, Respublika"/> + <iso_3166_2_entry + code="RU-BA" name="Bashkortostan, Respublika"/> + <iso_3166_2_entry + code="RU-BU" name="Buryatiya, Respublika"/> + <iso_3166_2_entry + code="RU-CE" name="Chechenskaya Respublika"/> + <iso_3166_2_entry + code="RU-CU" name="Chuvashskaya Respublika"/> + <iso_3166_2_entry + code="RU-DA" name="Dagestan, Respublika"/> + <iso_3166_2_entry + code="RU-IN" name="Respublika Ingushetiya"/> + <iso_3166_2_entry + code="RU-KB" name="Kabardino-Balkarskaya Respublika"/> + <iso_3166_2_entry + code="RU-KL" name="Kalmykiya, Respublika"/> + <iso_3166_2_entry + code="RU-KC" name="Karachayevo-Cherkesskaya Respublika"/> + <iso_3166_2_entry + code="RU-KR" name="Kareliya, Respublika"/> + <iso_3166_2_entry + code="RU-KK" name="Khakasiya, Respublika"/> + <iso_3166_2_entry + code="RU-KO" name="Komi, Respublika"/> + <iso_3166_2_entry + code="RU-ME" name="Mariy El, Respublika"/> + <iso_3166_2_entry + code="RU-MO" name="Mordoviya, Respublika"/> + <iso_3166_2_entry + code="RU-SA" name="Sakha, Respublika [Yakutiya]"/> + <iso_3166_2_entry + code="RU-SE" name="Severnaya Osetiya-Alaniya, Respublika"/> + <iso_3166_2_entry + code="RU-TA" name="Tatarstan, Respublika"/> + <iso_3166_2_entry + code="RU-TY" name="Tyva, Respublika [Tuva]"/> + <iso_3166_2_entry + code="RU-UD" name="Udmurtskaya Respublika"/> + </iso_3166_subset> + <iso_3166_subset type="Administrative Territory"> + <iso_3166_2_entry + code="RU-ALT" name="Altayskiy kray"/> + <iso_3166_2_entry + code="RU-KAM" name="Kamchatskiy kray"/> + <iso_3166_2_entry + code="RU-KHA" name="Khabarovskiy kray"/> + <iso_3166_2_entry + code="RU-KDA" name="Krasnodarskiy kray"/> + <iso_3166_2_entry + code="RU-KYA" name="Krasnoyarskiy kray"/> + <iso_3166_2_entry + code="RU-PER" name="Permskiy kray"/> + <iso_3166_2_entry + code="RU-PRI" name="Primorskiy kray"/> + <iso_3166_2_entry + code="RU-STA" name="Stavropol'skiy kray"/> + <iso_3166_2_entry + code="RU-ZAB" name="Zabajkal'skij kraj"/> + </iso_3166_subset> + <iso_3166_subset type="Administrative Region"> + <iso_3166_2_entry + code="RU-AMU" name="Amurskaya oblast'"/> + <iso_3166_2_entry + code="RU-ARK" name="Arkhangel'skaya oblast'"/> + <iso_3166_2_entry + code="RU-AST" name="Astrakhanskaya oblast'"/> + <iso_3166_2_entry + code="RU-BEL" name="Belgorodskaya oblast'"/> + <iso_3166_2_entry + code="RU-BRY" name="Bryanskaya oblast'"/> + <iso_3166_2_entry + code="RU-CHE" name="Chelyabinskaya oblast'"/> + <iso_3166_2_entry + code="RU-IRK" name="Irkutiskaya oblast'"/> + <iso_3166_2_entry + code="RU-IVA" name="Ivanovskaya oblast'"/> + <iso_3166_2_entry + code="RU-KGD" name="Kaliningradskaya oblast'"/> + <iso_3166_2_entry + code="RU-KLU" name="Kaluzhskaya oblast'"/> + <iso_3166_2_entry + code="RU-KEM" name="Kemerovskaya oblast'"/> + <iso_3166_2_entry + code="RU-KIR" name="Kirovskaya oblast'"/> + <iso_3166_2_entry + code="RU-KOS" name="Kostromskaya oblast'"/> + <iso_3166_2_entry + code="RU-KGN" name="Kurganskaya oblast'"/> + <iso_3166_2_entry + code="RU-KRS" name="Kurskaya oblast'"/> + <iso_3166_2_entry + code="RU-LEN" name="Leningradskaya oblast'"/> + <iso_3166_2_entry + code="RU-LIP" name="Lipetskaya oblast'"/> + <iso_3166_2_entry + code="RU-MAG" name="Magadanskaya oblast'"/> + <iso_3166_2_entry + code="RU-MOS" name="Moskovskaya oblast'"/> + <iso_3166_2_entry + code="RU-MUR" name="Murmanskaya oblast'"/> + <iso_3166_2_entry + code="RU-NIZ" name="Nizhegorodskaya oblast'"/> + <iso_3166_2_entry + code="RU-NGR" name="Novgorodskaya oblast'"/> + <iso_3166_2_entry + code="RU-NVS" name="Novosibirskaya oblast'"/> + <iso_3166_2_entry + code="RU-OMS" name="Omskaya oblast'"/> + <iso_3166_2_entry + code="RU-ORE" name="Orenburgskaya oblast'"/> + <iso_3166_2_entry + code="RU-ORL" name="Orlovskaya oblast'"/> + <iso_3166_2_entry + code="RU-PNZ" name="Penzenskaya oblast'"/> + <iso_3166_2_entry + code="RU-PSK" name="Pskovskaya oblast'"/> + <iso_3166_2_entry + code="RU-ROS" name="Rostovskaya oblast'"/> + <iso_3166_2_entry + code="RU-RYA" name="Ryazanskaya oblast'"/> + <iso_3166_2_entry + code="RU-SAK" name="Sakhalinskaya oblast'"/> + <iso_3166_2_entry + code="RU-SAM" name="Samaraskaya oblast'"/> + <iso_3166_2_entry + code="RU-SAR" name="Saratovskaya oblast'"/> + <iso_3166_2_entry + code="RU-SMO" name="Smolenskaya oblast'"/> + <iso_3166_2_entry + code="RU-SVE" name="Sverdlovskaya oblast'"/> + <iso_3166_2_entry + code="RU-TAM" name="Tambovskaya oblast'"/> + <iso_3166_2_entry + code="RU-TOM" name="Tomskaya oblast'"/> + <iso_3166_2_entry + code="RU-TUL" name="Tul'skaya oblast'"/> + <iso_3166_2_entry + code="RU-TVE" name="Tverskaya oblast'"/> + <iso_3166_2_entry + code="RU-TYU" name="Tyumenskaya oblast'"/> + <iso_3166_2_entry + code="RU-ULY" name="Ul'yanovskaya oblast'"/> + <iso_3166_2_entry + code="RU-VLA" name="Vladimirskaya oblast'"/> + <iso_3166_2_entry + code="RU-VGG" name="Volgogradskaya oblast'"/> + <iso_3166_2_entry + code="RU-VLG" name="Vologodskaya oblast'"/> + <iso_3166_2_entry + code="RU-VOR" name="Voronezhskaya oblast'"/> + <iso_3166_2_entry + code="RU-YAR" name="Yaroslavskaya oblast'"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous City"> + <iso_3166_2_entry + code="RU-MOW" name="Moskva"/> + <iso_3166_2_entry + code="RU-SPE" name="Sankt-Peterburg"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous Region"> + <iso_3166_2_entry + code="RU-YEV" name="Yevreyskaya avtonomnaya oblast'"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous District"> + <iso_3166_2_entry + code="RU-CHU" name="Chukotskiy avtonomnyy okrug"/> + <iso_3166_2_entry + code="RU-KHM" name="Khanty-Mansiysky avtonomnyy okrug-Yugra"/> + <iso_3166_2_entry + code="RU-NEN" name="Nenetskiy avtonomnyy okrug"/> + <iso_3166_2_entry + code="RU-YAN" name="Yamalo-Nenetskiy avtonomnyy okrug"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Rwanda --> + <iso_3166_country code="RW"> + <iso_3166_subset type="Town council"> + <iso_3166_2_entry + code="RW-01" name="Ville de Kigali"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="RW-02" name="Est"/> + <iso_3166_2_entry + code="RW-03" name="Nord"/> + <iso_3166_2_entry + code="RW-04" name="Ouest"/> + <iso_3166_2_entry + code="RW-05" name="Sud"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saudi Arabia --> + <iso_3166_country code="SA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="SA-11" name="Al Bāhah"/> + <iso_3166_2_entry + code="SA-08" name="Al Ḥudūd ash Shamāliyah"/> + <iso_3166_2_entry + code="SA-12" name="Al Jawf"/> + <iso_3166_2_entry + code="SA-03" name="Al Madīnah"/> + <iso_3166_2_entry + code="SA-05" name="Al Qaşīm"/> + <iso_3166_2_entry + code="SA-01" name="Ar Riyāḍ"/> + <iso_3166_2_entry + code="SA-04" name="Ash Sharqīyah"/> + <iso_3166_2_entry + code="SA-14" name="`Asīr"/> + <iso_3166_2_entry + code="SA-06" name="Ḥā'il"/> + <iso_3166_2_entry + code="SA-09" name="Jīzan"/> + <iso_3166_2_entry + code="SA-02" name="Makkah"/> + <iso_3166_2_entry + code="SA-10" name="Najrān"/> + <iso_3166_2_entry + code="SA-07" name="Tabūk"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Solomon Islands --> + <iso_3166_country code="SB"> + <iso_3166_subset type="Capital territory"> + <iso_3166_2_entry + code="SB-CT" name="Capital Territory (Honiara)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="SB-CE" name="Central"/> + <iso_3166_2_entry + code="SB-CH" name="Choiseul"/> + <iso_3166_2_entry + code="SB-GU" name="Guadalcanal"/> + <iso_3166_2_entry + code="SB-IS" name="Isabel"/> + <iso_3166_2_entry + code="SB-MK" name="Makira"/> + <iso_3166_2_entry + code="SB-ML" name="Malaita"/> + <iso_3166_2_entry + code="SB-RB" name="Rennell and Bellona"/> + <iso_3166_2_entry + code="SB-TE" name="Temotu"/> + <iso_3166_2_entry + code="SB-WE" name="Western"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Seychelles --> + <iso_3166_country code="SC"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="SC-01" name="Anse aux Pins"/> + <iso_3166_2_entry + code="SC-02" name="Anse Boileau"/> + <iso_3166_2_entry + code="SC-03" name="Anse Etoile"/> + <iso_3166_2_entry + code="SC-04" name="Anse Louis"/> + <iso_3166_2_entry + code="SC-05" name="Anse Royale"/> + <iso_3166_2_entry + code="SC-06" name="Baie Lazare"/> + <iso_3166_2_entry + code="SC-07" name="Baie Sainte Anne"/> + <iso_3166_2_entry + code="SC-08" name="Beau Vallon"/> + <iso_3166_2_entry + code="SC-09" name="Bel Air"/> + <iso_3166_2_entry + code="SC-10" name="Bel Ombre"/> + <iso_3166_2_entry + code="SC-11" name="Cascade"/> + <iso_3166_2_entry + code="SC-12" name="Glacis"/> + <iso_3166_2_entry + code="SC-13" name="Grand Anse Mahe"/> + <iso_3166_2_entry + code="SC-14" name="Grand Anse Praslin"/> + <iso_3166_2_entry + code="SC-15" name="La Digue"/> + <iso_3166_2_entry + code="SC-16" name="English River"/> + <iso_3166_2_entry + code="SC-24" name="Les Mamelles"/> + <iso_3166_2_entry + code="SC-17" name="Mont Buxton"/> + <iso_3166_2_entry + code="SC-18" name="Mont Fleuri"/> + <iso_3166_2_entry + code="SC-19" name="Plaisance"/> + <iso_3166_2_entry + code="SC-20" name="Pointe Larue"/> + <iso_3166_2_entry + code="SC-21" name="Port Glaud"/> + <iso_3166_2_entry + code="SC-25" name="Roche Caiman"/> + <iso_3166_2_entry + code="SC-22" name="Saint Louis"/> + <iso_3166_2_entry + code="SC-23" name="Takamaka"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sudan --> + <iso_3166_country code="SD"> + <iso_3166_subset type="state"> + <iso_3166_2_entry + code="SD-26" name="Al Baḩr al Aḩmar"/> + <iso_3166_2_entry + code="SD-18" name="Al Buḩayrāt"/> + <iso_3166_2_entry + code="SD-07" name="Al Jazīrah"/> + <iso_3166_2_entry + code="SD-03" name="Al Kharţūm"/> + <iso_3166_2_entry + code="SD-06" name="Al Qaḑārif"/> + <iso_3166_2_entry + code="SD-22" name="Al Waḩdah"/> + <iso_3166_2_entry + code="SD-04" name="An Nīl"/> + <iso_3166_2_entry + code="SD-08" name="An Nīl al Abyaḑ"/> + <iso_3166_2_entry + code="SD-24" name="An Nīl al Azraq"/> + <iso_3166_2_entry + code="SD-01" name="Ash Shamālīyah"/> + <iso_3166_2_entry + code="SD-23" name="A‘ālī an Nīl"/> + <iso_3166_2_entry + code="SD-17" name="Baḩr al Jabal"/> + <iso_3166_2_entry + code="SD-16" name="Gharb al Istiwā'īyah"/> + <iso_3166_2_entry + code="SD-14" name="Gharb Baḩr al Ghazāl"/> + <iso_3166_2_entry + code="SD-12" name="Gharb Dārfūr"/> + <iso_3166_2_entry + code="SD-11" name="Janūb Dārfūr"/> + <iso_3166_2_entry + code="SD-13" name="Janūb Kurdufān"/> + <iso_3166_2_entry + code="SD-20" name="Jūnqalī"/> + <iso_3166_2_entry + code="SD-05" name="Kassalā"/> + <iso_3166_2_entry + code="SD-15" name="Shamāl Baḩr al Ghazāl"/> + <iso_3166_2_entry + code="SD-02" name="Shamāl Dārfūr"/> + <iso_3166_2_entry + code="SD-09" name="Shamāl Kurdufān"/> + <iso_3166_2_entry + code="SD-19" name="Sharq al Istiwā'īyah"/> + <iso_3166_2_entry + code="SD-25" name="Sinnār"/> + <iso_3166_2_entry + code="SD-21" name="Wārāb"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sweden --> + <iso_3166_country code="SE"> + <iso_3166_subset type="County"> + <iso_3166_2_entry + code="SE-K" name="Blekinge län"/> + <iso_3166_2_entry + code="SE-W" name="Dalarnas län"/> + <iso_3166_2_entry + code="SE-I" name="Gotlands län"/> + <iso_3166_2_entry + code="SE-X" name="Gävleborgs län"/> + <iso_3166_2_entry + code="SE-N" name="Hallands län"/> + <iso_3166_2_entry + code="SE-Z" name="Jämtlande län"/> + <iso_3166_2_entry + code="SE-F" name="Jönköpings län"/> + <iso_3166_2_entry + code="SE-H" name="Kalmar län"/> + <iso_3166_2_entry + code="SE-G" name="Kronobergs län"/> + <iso_3166_2_entry + code="SE-BD" name="Norrbottens län"/> + <iso_3166_2_entry + code="SE-M" name="Skåne län"/> + <iso_3166_2_entry + code="SE-AB" name="Stockholms län"/> + <iso_3166_2_entry + code="SE-D" name="Södermanlands län"/> + <iso_3166_2_entry + code="SE-C" name="Uppsala län"/> + <iso_3166_2_entry + code="SE-S" name="Värmlands län"/> + <iso_3166_2_entry + code="SE-AC" name="Västerbottens län"/> + <iso_3166_2_entry + code="SE-Y" name="Västernorrlands län"/> + <iso_3166_2_entry + code="SE-U" name="Västmanlands län"/> + <iso_3166_2_entry + code="SE-Q" name="Västra Götalands län"/> + <iso_3166_2_entry + code="SE-T" name="Örebro län"/> + <iso_3166_2_entry + code="SE-E" name="Östergötlands län"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Singapore --> + <iso_3166_country code="SG"> + <iso_3166_subset type="district"> + <iso_3166_2_entry + code="SG-01" name="Central Singapore"/> + <iso_3166_2_entry + code="SG-02" name="North East"/> + <iso_3166_2_entry + code="SG-03" name="North West"/> + <iso_3166_2_entry + code="SG-04" name="South East"/> + <iso_3166_2_entry + code="SG-05" name="South West"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Helena, Ascension and Tristan da Cunha --> + <iso_3166_country code="SH"> + </iso_3166_country> + <!-- Slovenia --> + <iso_3166_country code="SI"> + <iso_3166_subset type="Municipalities"> + <iso_3166_2_entry + code="SI-001" name="Ajdovščina"/> + <iso_3166_2_entry + code="SI-195" name="Apače"/> + <iso_3166_2_entry + code="SI-002" name="Beltinci"/> + <iso_3166_2_entry + code="SI-148" name="Benedikt"/> + <iso_3166_2_entry + code="SI-149" name="Bistrica ob Sotli"/> + <iso_3166_2_entry + code="SI-003" name="Bled"/> + <iso_3166_2_entry + code="SI-150" name="Bloke"/> + <iso_3166_2_entry + code="SI-004" name="Bohinj"/> + <iso_3166_2_entry + code="SI-005" name="Borovnica"/> + <iso_3166_2_entry + code="SI-006" name="Bovec"/> + <iso_3166_2_entry + code="SI-151" name="Braslovče"/> + <iso_3166_2_entry + code="SI-007" name="Brda"/> + <iso_3166_2_entry + code="SI-008" name="Brezovica"/> + <iso_3166_2_entry + code="SI-009" name="Brežice"/> + <iso_3166_2_entry + code="SI-152" name="Cankova"/> + <iso_3166_2_entry + code="SI-011" name="Celje"/> + <iso_3166_2_entry + code="SI-012" name="Cerklje na Gorenjskem"/> + <iso_3166_2_entry + code="SI-013" name="Cerknica"/> + <iso_3166_2_entry + code="SI-014" name="Cerkno"/> + <iso_3166_2_entry + code="SI-153" name="Cerkvenjak"/> + <iso_3166_2_entry + code="SI-196" name="Cirkulane"/> + <iso_3166_2_entry + code="SI-015" name="Črenšovci"/> + <iso_3166_2_entry + code="SI-016" name="Črna na Koroškem"/> + <iso_3166_2_entry + code="SI-017" name="Črnomelj"/> + <iso_3166_2_entry + code="SI-018" name="Destrnik"/> + <iso_3166_2_entry + code="SI-019" name="Divača"/> + <iso_3166_2_entry + code="SI-154" name="Dobje"/> + <iso_3166_2_entry + code="SI-020" name="Dobrepolje"/> + <iso_3166_2_entry + code="SI-155" name="Dobrna"/> + <iso_3166_2_entry + code="SI-021" name="Dobrova-Polhov Gradec"/> + <iso_3166_2_entry + code="SI-156" name="Dobrovnik/Dobronak"/> + <iso_3166_2_entry + code="SI-022" name="Dol pri Ljubljani"/> + <iso_3166_2_entry + code="SI-157" name="Dolenjske Toplice"/> + <iso_3166_2_entry + code="SI-023" name="Domžale"/> + <iso_3166_2_entry + code="SI-024" name="Dornava"/> + <iso_3166_2_entry + code="SI-025" name="Dravograd"/> + <iso_3166_2_entry + code="SI-026" name="Duplek"/> + <iso_3166_2_entry + code="SI-027" name="Gorenja vas-Poljane"/> + <iso_3166_2_entry + code="SI-028" name="Gorišnica"/> + <iso_3166_2_entry + code="SI-207" name="Gorje"/> + <iso_3166_2_entry + code="SI-029" name="Gornja Radgona"/> + <iso_3166_2_entry + code="SI-030" name="Gornji Grad"/> + <iso_3166_2_entry + code="SI-031" name="Gornji Petrovci"/> + <iso_3166_2_entry + code="SI-158" name="Grad"/> + <iso_3166_2_entry + code="SI-032" name="Grosuplje"/> + <iso_3166_2_entry + code="SI-159" name="Hajdina"/> + <iso_3166_2_entry + code="SI-160" name="Hoče-Slivnica"/> + <iso_3166_2_entry + code="SI-161" name="Hodoš/Hodos"/> + <iso_3166_2_entry + code="SI-162" name="Horjul"/> + <iso_3166_2_entry + code="SI-034" name="Hrastnik"/> + <iso_3166_2_entry + code="SI-035" name="Hrpelje-Kozina"/> + <iso_3166_2_entry + code="SI-036" name="Idrija"/> + <iso_3166_2_entry + code="SI-037" name="Ig"/> + <iso_3166_2_entry + code="SI-038" name="Ilirska Bistrica"/> + <iso_3166_2_entry + code="SI-039" name="Ivančna Gorica"/> + <iso_3166_2_entry + code="SI-040" name="Izola/Isola"/> + <iso_3166_2_entry + code="SI-041" name="Jesenice"/> + <iso_3166_2_entry + code="SI-163" name="Jezersko"/> + <iso_3166_2_entry + code="SI-042" name="Juršinci"/> + <iso_3166_2_entry + code="SI-043" name="Kamnik"/> + <iso_3166_2_entry + code="SI-044" name="Kanal"/> + <iso_3166_2_entry + code="SI-045" name="Kidričevo"/> + <iso_3166_2_entry + code="SI-046" name="Kobarid"/> + <iso_3166_2_entry + code="SI-047" name="Kobilje"/> + <iso_3166_2_entry + code="SI-048" name="Kočevje"/> + <iso_3166_2_entry + code="SI-049" name="Komen"/> + <iso_3166_2_entry + code="SI-164" name="Komenda"/> + <iso_3166_2_entry + code="SI-050" name="Koper/Capodistria"/> + <iso_3166_2_entry + code="SI-197" name="Kosanjevica na Krki"/> + <iso_3166_2_entry + code="SI-165" name="Kostel"/> + <iso_3166_2_entry + code="SI-051" name="Kozje"/> + <iso_3166_2_entry + code="SI-052" name="Kranj"/> + <iso_3166_2_entry + code="SI-053" name="Kranjska Gora"/> + <iso_3166_2_entry + code="SI-166" name="Križevci"/> + <iso_3166_2_entry + code="SI-054" name="Krško"/> + <iso_3166_2_entry + code="SI-055" name="Kungota"/> + <iso_3166_2_entry + code="SI-056" name="Kuzma"/> + <iso_3166_2_entry + code="SI-057" name="Laško"/> + <iso_3166_2_entry + code="SI-058" name="Lenart"/> + <iso_3166_2_entry + code="SI-059" name="Lendava/Lendva"/> + <iso_3166_2_entry + code="SI-060" name="Litija"/> + <iso_3166_2_entry + code="SI-061" name="Ljubljana"/> + <iso_3166_2_entry + code="SI-062" name="Ljubno"/> + <iso_3166_2_entry + code="SI-063" name="Ljutomer"/> + <iso_3166_2_entry + code="SI-208" name="Log-Dragomer"/> + <iso_3166_2_entry + code="SI-064" name="Logatec"/> + <iso_3166_2_entry + code="SI-065" name="Loška dolina"/> + <iso_3166_2_entry + code="SI-066" name="Loški Potok"/> + <iso_3166_2_entry + code="SI-167" name="Lovrenc na Pohorju"/> + <iso_3166_2_entry + code="SI-067" name="Luče"/> + <iso_3166_2_entry + code="SI-068" name="Lukovica"/> + <iso_3166_2_entry + code="SI-069" name="Majšperk"/> + <iso_3166_2_entry + code="SI-198" name="Makole"/> + <iso_3166_2_entry + code="SI-070" name="Maribor"/> + <iso_3166_2_entry + code="SI-168" name="Markovci"/> + <iso_3166_2_entry + code="SI-071" name="Medvode"/> + <iso_3166_2_entry + code="SI-072" name="Mengeš"/> + <iso_3166_2_entry + code="SI-073" name="Metlika"/> + <iso_3166_2_entry + code="SI-074" name="Mežica"/> + <iso_3166_2_entry + code="SI-169" name="Miklavž na Dravskem polju"/> + <iso_3166_2_entry + code="SI-075" name="Miren-Kostanjevica"/> + <iso_3166_2_entry + code="SI-170" name="Mirna Peč"/> + <iso_3166_2_entry + code="SI-076" name="Mislinja"/> + <iso_3166_2_entry + code="SI-199" name="Mokronog-Trebelno"/> + <iso_3166_2_entry + code="SI-077" name="Moravče"/> + <iso_3166_2_entry + code="SI-078" name="Moravske Toplice"/> + <iso_3166_2_entry + code="SI-079" name="Mozirje"/> + <iso_3166_2_entry + code="SI-080" name="Murska Sobota"/> + <iso_3166_2_entry + code="SI-081" name="Muta"/> + <iso_3166_2_entry + code="SI-082" name="Naklo"/> + <iso_3166_2_entry + code="SI-083" name="Nazarje"/> + <iso_3166_2_entry + code="SI-084" name="Nova Gorica"/> + <iso_3166_2_entry + code="SI-085" name="Novo mesto"/> + <iso_3166_2_entry + code="SI-086" name="Odranci"/> + <iso_3166_2_entry + code="SI-171" name="Oplotnica"/> + <iso_3166_2_entry + code="SI-087" name="Ormož"/> + <iso_3166_2_entry + code="SI-088" name="Osilnica"/> + <iso_3166_2_entry + code="SI-089" name="Pesnica"/> + <iso_3166_2_entry + code="SI-090" name="Piran/Pirano"/> + <iso_3166_2_entry + code="SI-091" name="Pivka"/> + <iso_3166_2_entry + code="SI-092" name="Podčetrtek"/> + <iso_3166_2_entry + code="SI-172" name="Podlehnik"/> + <iso_3166_2_entry + code="SI-093" name="Podvelka"/> + <iso_3166_2_entry + code="SI-200" name="Poljčane"/> + <iso_3166_2_entry + code="SI-173" name="Polzela"/> + <iso_3166_2_entry + code="SI-094" name="Postojna"/> + <iso_3166_2_entry + code="SI-174" name="Prebold"/> + <iso_3166_2_entry + code="SI-095" name="Preddvor"/> + <iso_3166_2_entry + code="SI-175" name="Prevalje"/> + <iso_3166_2_entry + code="SI-096" name="Ptuj"/> + <iso_3166_2_entry + code="SI-097" name="Puconci"/> + <iso_3166_2_entry + code="SI-098" name="Rače-Fram"/> + <iso_3166_2_entry + code="SI-099" name="Radeče"/> + <iso_3166_2_entry + code="SI-100" name="Radenci"/> + <iso_3166_2_entry + code="SI-101" name="Radlje ob Dravi"/> + <iso_3166_2_entry + code="SI-102" name="Radovljica"/> + <iso_3166_2_entry + code="SI-103" name="Ravne na Koroškem"/> + <iso_3166_2_entry + code="SI-176" name="Razkrižje"/> + <iso_3166_2_entry + code="SI-209" name="Rečica ob Savinji"/> + <iso_3166_2_entry + code="SI-201" name="Renče-Vogrsko"/> + <iso_3166_2_entry + code="SI-104" name="Ribnica"/> + <iso_3166_2_entry + code="SI-177" name="Ribnica na Pohorju"/> + <iso_3166_2_entry + code="SI-106" name="Rogaška Slatina"/> + <iso_3166_2_entry + code="SI-105" name="Rogašovci"/> + <iso_3166_2_entry + code="SI-107" name="Rogatec"/> + <iso_3166_2_entry + code="SI-108" name="Ruše"/> + <iso_3166_2_entry + code="SI-178" name="Selnica ob Dravi"/> + <iso_3166_2_entry + code="SI-109" name="Semič"/> + <iso_3166_2_entry + code="SI-110" name="Sevnica"/> + <iso_3166_2_entry + code="SI-111" name="Sežana"/> + <iso_3166_2_entry + code="SI-112" name="Slovenj Gradec"/> + <iso_3166_2_entry + code="SI-113" name="Slovenska Bistrica"/> + <iso_3166_2_entry + code="SI-114" name="Slovenske Konjice"/> + <iso_3166_2_entry + code="SI-179" name="Sodražica"/> + <iso_3166_2_entry + code="SI-180" name="Solčava"/> + <iso_3166_2_entry + code="SI-202" name="Središče ob Dravi"/> + <iso_3166_2_entry + code="SI-115" name="Starče"/> + <iso_3166_2_entry + code="SI-203" name="Straža"/> + <iso_3166_2_entry + code="SI-181" name="Sveta Ana"/> + <iso_3166_2_entry + code="SI-204" name="Sveta Trojica v Slovenskih Goricah"/> + <iso_3166_2_entry + code="SI-182" name="Sveta Andraž v Slovenskih Goricah"/> + <iso_3166_2_entry + code="SI-116" name="Sveti Jurij"/> + <iso_3166_2_entry + code="SI-210" name="Sveti Jurij v Slovenskih Goricah"/> + <iso_3166_2_entry + code="SI-205" name="Sveti Tomaž"/> + <iso_3166_2_entry + code="SI-033" name="Šalovci"/> + <iso_3166_2_entry + code="SI-183" name="Šempeter-Vrtojba"/> + <iso_3166_2_entry + code="SI-117" name="Šenčur"/> + <iso_3166_2_entry + code="SI-118" name="Šentilj"/> + <iso_3166_2_entry + code="SI-119" name="Šentjernej"/> + <iso_3166_2_entry + code="SI-120" name="Šentjur"/> + <iso_3166_2_entry + code="SI-211" name="Šentrupert"/> + <iso_3166_2_entry + code="SI-121" name="Škocjan"/> + <iso_3166_2_entry + code="SI-122" name="Škofja Loka"/> + <iso_3166_2_entry + code="SI-123" name="Škofljica"/> + <iso_3166_2_entry + code="SI-124" name="Šmarje pri Jelšah"/> + <iso_3166_2_entry + code="SI-206" name="Šmarjeske Topliče"/> + <iso_3166_2_entry + code="SI-125" name="Šmartno ob Paki"/> + <iso_3166_2_entry + code="SI-194" name="Šmartno pri Litiji"/> + <iso_3166_2_entry + code="SI-126" name="Šoštanj"/> + <iso_3166_2_entry + code="SI-127" name="Štore"/> + <iso_3166_2_entry + code="SI-184" name="Tabor"/> + <iso_3166_2_entry + code="SI-010" name="Tišina"/> + <iso_3166_2_entry + code="SI-128" name="Tolmin"/> + <iso_3166_2_entry + code="SI-129" name="Trbovlje"/> + <iso_3166_2_entry + code="SI-130" name="Trebnje"/> + <iso_3166_2_entry + code="SI-185" name="Trnovska vas"/> + <iso_3166_2_entry + code="SI-186" name="Trzin"/> + <iso_3166_2_entry + code="SI-131" name="Tržič"/> + <iso_3166_2_entry + code="SI-132" name="Turnišče"/> + <iso_3166_2_entry + code="SI-133" name="Velenje"/> + <iso_3166_2_entry + code="SI-187" name="Velika Polana"/> + <iso_3166_2_entry + code="SI-134" name="Velike Lašče"/> + <iso_3166_2_entry + code="SI-188" name="Veržej"/> + <iso_3166_2_entry + code="SI-135" name="Videm"/> + <iso_3166_2_entry + code="SI-136" name="Vipava"/> + <iso_3166_2_entry + code="SI-137" name="Vitanje"/> + <iso_3166_2_entry + code="SI-138" name="Vodice"/> + <iso_3166_2_entry + code="SI-139" name="Vojnik"/> + <iso_3166_2_entry + code="SI-189" name="Vransko"/> + <iso_3166_2_entry + code="SI-140" name="Vrhnika"/> + <iso_3166_2_entry + code="SI-141" name="Vuzenica"/> + <iso_3166_2_entry + code="SI-142" name="Zagorje ob Savi"/> + <iso_3166_2_entry + code="SI-143" name="Zavrč"/> + <iso_3166_2_entry + code="SI-144" name="Zreče"/> + <iso_3166_2_entry + code="SI-190" name="Žalec"/> + <iso_3166_2_entry + code="SI-146" name="Železniki"/> + <iso_3166_2_entry + code="SI-191" name="Žetale"/> + <iso_3166_2_entry + code="SI-147" name="Žiri"/> + <iso_3166_2_entry + code="SI-192" name="Žirovnica"/> + <iso_3166_2_entry + code="SI-193" name="Žužemberk"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Slovakia --> + <iso_3166_country code="SK"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="SK-BC" name="Banskobystrický kraj"/> + <iso_3166_2_entry + code="SK-BL" name="Bratislavský kraj"/> + <iso_3166_2_entry + code="SK-KI" name="Košický kraj"/> + <iso_3166_2_entry + code="SK-NJ" name="Nitriansky kraj"/> + <iso_3166_2_entry + code="SK-PV" name="Prešovský kraj"/> + <iso_3166_2_entry + code="SK-TC" name="Trenčiansky kraj"/> + <iso_3166_2_entry + code="SK-TA" name="Trnavský kraj"/> + <iso_3166_2_entry + code="SK-ZI" name="Žilinský kraj"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sierra Leone --> + <iso_3166_country code="SL"> + <iso_3166_subset type="Area"> + <iso_3166_2_entry + code="SL-W" name="Western Area (Freetown)"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="SL-E" name="Eastern"/> + <iso_3166_2_entry + code="SL-N" name="Northern"/> + <iso_3166_2_entry + code="SL-S" name="Southern (Sierra Leone)"/> + </iso_3166_subset> + </iso_3166_country> + <!-- San Marino --> + <iso_3166_country code="SM"> + <iso_3166_subset type="Municipalities"> + <iso_3166_2_entry + code="SM-01" name="Acquaviva"/> + <iso_3166_2_entry + code="SM-06" name="Borgo Maggiore"/> + <iso_3166_2_entry + code="SM-02" name="Chiesanuova"/> + <iso_3166_2_entry + code="SM-03" name="Domagnano"/> + <iso_3166_2_entry + code="SM-04" name="Faetano"/> + <iso_3166_2_entry + code="SM-05" name="Fiorentino"/> + <iso_3166_2_entry + code="SM-08" name="Montegiardino"/> + <iso_3166_2_entry + code="SM-07" name="San Marino"/> + <iso_3166_2_entry + code="SM-09" name="Serravalle"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Senegal --> + <iso_3166_country code="SN"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="SN-DK" name="Dakar"/> + <iso_3166_2_entry + code="SN-DB" name="Diourbel"/> + <iso_3166_2_entry + code="SN-FK" name="Fatick"/> + <iso_3166_2_entry + code="SN-KA" name="Kaffrine"/> + <iso_3166_2_entry + code="SN-KL" name="Kaolack"/> + <iso_3166_2_entry + code="SN-KE" name="Kédougou"/> + <iso_3166_2_entry + code="SN-KD" name="Kolda"/> + <iso_3166_2_entry + code="SN-LG" name="Louga"/> + <iso_3166_2_entry + code="SN-MT" name="Matam"/> + <iso_3166_2_entry + code="SN-SL" name="Saint-Louis"/> + <iso_3166_2_entry + code="SN-SE" name="Sédhiou"/> + <iso_3166_2_entry + code="SN-TC" name="Tambacounda"/> + <iso_3166_2_entry + code="SN-TH" name="Thiès"/> + <iso_3166_2_entry + code="SN-ZG" name="Ziguinchor"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Somalia --> + <iso_3166_country code="SO"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="SO-AW" name="Awdal"/> + <iso_3166_2_entry + code="SO-BK" name="Bakool"/> + <iso_3166_2_entry + code="SO-BN" name="Banaadir"/> + <iso_3166_2_entry + code="SO-BR" name="Bari"/> + <iso_3166_2_entry + code="SO-BY" name="Bay"/> + <iso_3166_2_entry + code="SO-GA" name="Galguduud"/> + <iso_3166_2_entry + code="SO-GE" name="Gedo"/> + <iso_3166_2_entry + code="SO-HI" name="Hiirsan"/> + <iso_3166_2_entry + code="SO-JD" name="Jubbada Dhexe"/> + <iso_3166_2_entry + code="SO-JH" name="Jubbada Hoose"/> + <iso_3166_2_entry + code="SO-MU" name="Mudug"/> + <iso_3166_2_entry + code="SO-NU" name="Nugaal"/> + <iso_3166_2_entry + code="SO-SA" name="Saneag"/> + <iso_3166_2_entry + code="SO-SD" name="Shabeellaha Dhexe"/> + <iso_3166_2_entry + code="SO-SH" name="Shabeellaha Hoose"/> + <iso_3166_2_entry + code="SO-SO" name="Sool"/> + <iso_3166_2_entry + code="SO-TO" name="Togdheer"/> + <iso_3166_2_entry + code="SO-WO" name="Woqooyi Galbeed"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Suriname --> + <iso_3166_country code="SR"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="SR-BR" name="Brokopondo"/> + <iso_3166_2_entry + code="SR-CM" name="Commewijne"/> + <iso_3166_2_entry + code="SR-CR" name="Coronie"/> + <iso_3166_2_entry + code="SR-MA" name="Marowijne"/> + <iso_3166_2_entry + code="SR-NI" name="Nickerie"/> + <iso_3166_2_entry + code="SR-PR" name="Para"/> + <iso_3166_2_entry + code="SR-PM" name="Paramaribo"/> + <iso_3166_2_entry + code="SR-SA" name="Saramacca"/> + <iso_3166_2_entry + code="SR-SI" name="Sipaliwini"/> + <iso_3166_2_entry + code="SR-WA" name="Wanica"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Sao Tome and Principe --> + <iso_3166_country code="ST"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="ST-P" name="Príncipe"/> + <iso_3166_2_entry + code="ST-S" name="São Tomé"/> + </iso_3166_subset> + </iso_3166_country> + <!-- El Salvador --> + <iso_3166_country code="SV"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="SV-AH" name="Ahuachapán"/> + <iso_3166_2_entry + code="SV-CA" name="Cabañas"/> + <iso_3166_2_entry + code="SV-CU" name="Cuscatlán"/> + <iso_3166_2_entry + code="SV-CH" name="Chalatenango"/> + <iso_3166_2_entry + code="SV-LI" name="La Libertad"/> + <iso_3166_2_entry + code="SV-PA" name="La Paz"/> + <iso_3166_2_entry + code="SV-UN" name="La Unión"/> + <iso_3166_2_entry + code="SV-MO" name="Morazán"/> + <iso_3166_2_entry + code="SV-SM" name="San Miguel"/> + <iso_3166_2_entry + code="SV-SS" name="San Salvador"/> + <iso_3166_2_entry + code="SV-SA" name="Santa Ana"/> + <iso_3166_2_entry + code="SV-SV" name="San Vicente"/> + <iso_3166_2_entry + code="SV-SO" name="Sonsonate"/> + <iso_3166_2_entry + code="SV-US" name="Usulután"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Syria --> + <iso_3166_country code="SY"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="SY-HA" name="Al Hasakah"/> + <iso_3166_2_entry + code="SY-LA" name="Al Ladhiqiyah"/> + <iso_3166_2_entry + code="SY-QU" name="Al Qunaytirah"/> + <iso_3166_2_entry + code="SY-RA" name="Ar Raqqah"/> + <iso_3166_2_entry + code="SY-SU" name="As Suwayda'"/> + <iso_3166_2_entry + code="SY-DR" name="Dar'a"/> + <iso_3166_2_entry + code="SY-DY" name="Dayr az Zawr"/> + <iso_3166_2_entry + code="SY-DI" name="Dimashq"/> + <iso_3166_2_entry + code="SY-HL" name="Halab"/> + <iso_3166_2_entry + code="SY-HM" name="Hamah"/> + <iso_3166_2_entry + code="SY-HI" name="Homs"/> + <iso_3166_2_entry + code="SY-ID" name="Idlib"/> + <iso_3166_2_entry + code="SY-RD" name="Rif Dimashq"/> + <iso_3166_2_entry + code="SY-TA" name="Tartus"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Swaziland --> + <iso_3166_country code="SZ"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="SZ-HH" name="Hhohho"/> + <iso_3166_2_entry + code="SZ-LU" name="Lubombo"/> + <iso_3166_2_entry + code="SZ-MA" name="Manzini"/> + <iso_3166_2_entry + code="SZ-SH" name="Shiselweni"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Chad --> + <iso_3166_country code="TD"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TD-BA" name="Al Baṭḩah"/> + <iso_3166_2_entry + code="TD-LC" name="Al Buḩayrah"/> + <iso_3166_2_entry + code="TD-BG" name="Baḩr al Ghazāl"/> + <iso_3166_2_entry + code="TD-BO" name="Būrkū"/> + <iso_3166_2_entry + code="TD-HL" name="Ḥajjar Lamīs"/> + <iso_3166_2_entry + code="TD-EN" name="Innīdī"/> + <iso_3166_2_entry + code="TD-KA" name="Kānim"/> + <iso_3166_2_entry + code="TD-LO" name="Lūqūn al Gharbī"/> + <iso_3166_2_entry + code="TD-LR" name="Lūqūn ash Sharqī"/> + <iso_3166_2_entry + code="TD-ND" name="Madīnat Injamīnā"/> + <iso_3166_2_entry + code="TD-MA" name="Māndūl"/> + <iso_3166_2_entry + code="TD-MO" name="Māyū Kībbī al Gharbī"/> + <iso_3166_2_entry + code="TD-ME" name="Māyū Kībbī ash Sharqī"/> + <iso_3166_2_entry + code="TD-GR" name="Qīrā"/> + <iso_3166_2_entry + code="TD-SA" name="Salāmāt"/> + <iso_3166_2_entry + code="TD-MC" name="Shārī al Awsaṭ"/> + <iso_3166_2_entry + code="TD-CB" name="Shārī Bāqirmī"/> + <iso_3166_2_entry + code="TD-SI" name="Sīlā"/> + <iso_3166_2_entry + code="TD-TA" name="Tānjilī"/> + <iso_3166_2_entry + code="TD-TI" name="Tibastī"/> + <iso_3166_2_entry + code="TD-OD" name="Waddāy"/> + <iso_3166_2_entry + code="TD-WF" name="Wādī Fīrā"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Togo --> + <iso_3166_country code="TG"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TG-C" name="Région du Centre"/> + <iso_3166_2_entry + code="TG-K" name="Région de la Kara"/> + <iso_3166_2_entry + code="TG-M" name="Région Maritime"/> + <iso_3166_2_entry + code="TG-P" name="Région des Plateaux"/> + <iso_3166_2_entry + code="TG-S" name="Région des Savannes"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Thailand --> + <iso_3166_country code="TH"> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="TH-10" name="Krung Thep Maha Nakhon Bangkok"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="TH-S" name="Phatthaya"/> + <iso_3166_2_entry + code="TH-37" name="Amnat Charoen"/> + <iso_3166_2_entry + code="TH-15" name="Ang Thong"/> + <iso_3166_2_entry + code="TH-31" name="Buri Ram"/> + <iso_3166_2_entry + code="TH-24" name="Chachoengsao"/> + <iso_3166_2_entry + code="TH-18" name="Chai Nat"/> + <iso_3166_2_entry + code="TH-36" name="Chaiyaphum"/> + <iso_3166_2_entry + code="TH-22" name="Chanthaburi"/> + <iso_3166_2_entry + code="TH-50" name="Chiang Mai"/> + <iso_3166_2_entry + code="TH-57" name="Chiang Rai"/> + <iso_3166_2_entry + code="TH-20" name="Chon Buri"/> + <iso_3166_2_entry + code="TH-86" name="Chumphon"/> + <iso_3166_2_entry + code="TH-46" name="Kalasin"/> + <iso_3166_2_entry + code="TH-62" name="Kamphaeng Phet"/> + <iso_3166_2_entry + code="TH-71" name="Kanchanaburi"/> + <iso_3166_2_entry + code="TH-40" name="Khon Kaen"/> + <iso_3166_2_entry + code="TH-81" name="Krabi"/> + <iso_3166_2_entry + code="TH-52" name="Lampang"/> + <iso_3166_2_entry + code="TH-51" name="Lamphun"/> + <iso_3166_2_entry + code="TH-42" name="Loei"/> + <iso_3166_2_entry + code="TH-16" name="Lop Buri"/> + <iso_3166_2_entry + code="TH-58" name="Mae Hong Son"/> + <iso_3166_2_entry + code="TH-44" name="Maha Sarakham"/> + <iso_3166_2_entry + code="TH-49" name="Mukdahan"/> + <iso_3166_2_entry + code="TH-26" name="Nakhon Nayok"/> + <iso_3166_2_entry + code="TH-73" name="Nakhon Pathom"/> + <iso_3166_2_entry + code="TH-48" name="Nakhon Phanom"/> + <iso_3166_2_entry + code="TH-30" name="Nakhon Ratchasima"/> + <iso_3166_2_entry + code="TH-60" name="Nakhon Sawan"/> + <iso_3166_2_entry + code="TH-80" name="Nakhon Si Thammarat"/> + <iso_3166_2_entry + code="TH-55" name="Nan"/> + <iso_3166_2_entry + code="TH-96" name="Narathiwat"/> + <iso_3166_2_entry + code="TH-39" name="Nong Bua Lam Phu"/> + <iso_3166_2_entry + code="TH-43" name="Nong Khai"/> + <iso_3166_2_entry + code="TH-12" name="Nonthaburi"/> + <iso_3166_2_entry + code="TH-13" name="Pathum Thani"/> + <iso_3166_2_entry + code="TH-94" name="Pattani"/> + <iso_3166_2_entry + code="TH-82" name="Phangnga"/> + <iso_3166_2_entry + code="TH-93" name="Phatthalung"/> + <iso_3166_2_entry + code="TH-56" name="Phayao"/> + <iso_3166_2_entry + code="TH-67" name="Phetchabun"/> + <iso_3166_2_entry + code="TH-76" name="Phetchaburi"/> + <iso_3166_2_entry + code="TH-66" name="Phichit"/> + <iso_3166_2_entry + code="TH-65" name="Phitsanulok"/> + <iso_3166_2_entry + code="TH-54" name="Phrae"/> + <iso_3166_2_entry + code="TH-14" name="Phra Nakhon Si Ayutthaya"/> + <iso_3166_2_entry + code="TH-83" name="Phuket"/> + <iso_3166_2_entry + code="TH-25" name="Prachin Buri"/> + <iso_3166_2_entry + code="TH-77" name="Prachuap Khiri Khan"/> + <iso_3166_2_entry + code="TH-85" name="Ranong"/> + <iso_3166_2_entry + code="TH-70" name="Ratchaburi"/> + <iso_3166_2_entry + code="TH-21" name="Rayong"/> + <iso_3166_2_entry + code="TH-45" name="Roi Et"/> + <iso_3166_2_entry + code="TH-27" name="Sa Kaeo"/> + <iso_3166_2_entry + code="TH-47" name="Sakon Nakhon"/> + <iso_3166_2_entry + code="TH-11" name="Samut Prakan"/> + <iso_3166_2_entry + code="TH-74" name="Samut Sakhon"/> + <iso_3166_2_entry + code="TH-75" name="Samut Songkhram"/> + <iso_3166_2_entry + code="TH-19" name="Saraburi"/> + <iso_3166_2_entry + code="TH-91" name="Satun"/> + <iso_3166_2_entry + code="TH-17" name="Sing Buri"/> + <iso_3166_2_entry + code="TH-33" name="Si Sa Ket"/> + <iso_3166_2_entry + code="TH-90" name="Songkhla"/> + <iso_3166_2_entry + code="TH-64" name="Sukhothai"/> + <iso_3166_2_entry + code="TH-72" name="Suphan Buri"/> + <iso_3166_2_entry + code="TH-84" name="Surat Thani"/> + <iso_3166_2_entry + code="TH-32" name="Surin"/> + <iso_3166_2_entry + code="TH-63" name="Tak"/> + <iso_3166_2_entry + code="TH-92" name="Trang"/> + <iso_3166_2_entry + code="TH-23" name="Trat"/> + <iso_3166_2_entry + code="TH-34" name="Ubon Ratchathani"/> + <iso_3166_2_entry + code="TH-41" name="Udon Thani"/> + <iso_3166_2_entry + code="TH-61" name="Uthai Thani"/> + <iso_3166_2_entry + code="TH-53" name="Uttaradit"/> + <iso_3166_2_entry + code="TH-95" name="Yala"/> + <iso_3166_2_entry + code="TH-35" name="Yasothon"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tajikistan --> + <iso_3166_country code="TJ"> + <iso_3166_subset type="Autonomous region"> + <iso_3166_2_entry + code="TJ-GB" name="Gorno-Badakhshan"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TJ-KT" name="Khatlon"/> + <iso_3166_2_entry + code="TJ-SU" name="Sughd"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Timor Leste --> + <iso_3166_country code="TL"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="TL-AL" name="Aileu"/> + <iso_3166_2_entry + code="TL-AN" name="Ainaro"/> + <iso_3166_2_entry + code="TL-BA" name="Baucau"/> + <iso_3166_2_entry + code="TL-BO" name="Bobonaro"/> + <iso_3166_2_entry + code="TL-CO" name="Cova Lima"/> + <iso_3166_2_entry + code="TL-DI" name="Dili"/> + <iso_3166_2_entry + code="TL-ER" name="Ermera"/> + <iso_3166_2_entry + code="TL-LA" name="Lautem"/> + <iso_3166_2_entry + code="TL-LI" name="Liquiça"/> + <iso_3166_2_entry + code="TL-MT" name="Manatuto"/> + <iso_3166_2_entry + code="TL-MF" name="Manufahi"/> + <iso_3166_2_entry + code="TL-OE" name="Oecussi"/> + <iso_3166_2_entry + code="TL-VI" name="Viqueque"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Turkmenistan --> + <iso_3166_country code="TM"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TM-A" name="Ahal"/> + <iso_3166_2_entry + code="TM-B" name="Balkan"/> + <iso_3166_2_entry + code="TM-D" name="Daşoguz"/> + <iso_3166_2_entry + code="TM-L" name="Lebap"/> + <iso_3166_2_entry + code="TM-M" name="Mary"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="TM-S" name="Aşgabat"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tunisia --> + <iso_3166_country code="TN"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="TN-31" name="Béja"/> + <iso_3166_2_entry + code="TN-13" name="Ben Arous"/> + <iso_3166_2_entry + code="TN-23" name="Bizerte"/> + <iso_3166_2_entry + code="TN-81" name="Gabès"/> + <iso_3166_2_entry + code="TN-71" name="Gafsa"/> + <iso_3166_2_entry + code="TN-32" name="Jendouba"/> + <iso_3166_2_entry + code="TN-41" name="Kairouan"/> + <iso_3166_2_entry + code="TN-42" name="Kasserine"/> + <iso_3166_2_entry + code="TN-73" name="Kebili"/> + <iso_3166_2_entry + code="TN-12" name="L'Ariana"/> + <iso_3166_2_entry + code="TN-33" name="Le Kef"/> + <iso_3166_2_entry + code="TN-53" name="Mahdia"/> + <iso_3166_2_entry + code="TN-14" name="La Manouba"/> + <iso_3166_2_entry + code="TN-82" name="Medenine"/> + <iso_3166_2_entry + code="TN-52" name="Monastir"/> + <iso_3166_2_entry + code="TN-21" name="Nabeul"/> + <iso_3166_2_entry + code="TN-61" name="Sfax"/> + <iso_3166_2_entry + code="TN-43" name="Sidi Bouzid"/> + <iso_3166_2_entry + code="TN-34" name="Siliana"/> + <iso_3166_2_entry + code="TN-51" name="Sousse"/> + <iso_3166_2_entry + code="TN-83" name="Tataouine"/> + <iso_3166_2_entry + code="TN-72" name="Tozeur"/> + <iso_3166_2_entry + code="TN-11" name="Tunis"/> + <iso_3166_2_entry + code="TN-22" name="Zaghouan"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tonga --> + <iso_3166_country code="TO"> + <iso_3166_subset type="Division"> + <iso_3166_2_entry + code="TO-01" name="'Eua"/> + <iso_3166_2_entry + code="TO-02" name="Ha'apai"/> + <iso_3166_2_entry + code="TO-03" name="Niuas"/> + <iso_3166_2_entry + code="TO-04" name="Tongatapu"/> + <iso_3166_2_entry + code="TO-05" name="Vava'u"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Turkey --> + <iso_3166_country code="TR"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="TR-01" name="Adana"/> + <iso_3166_2_entry + code="TR-02" name="Adıyaman"/> + <iso_3166_2_entry + code="TR-03" name="Afyon"/> + <iso_3166_2_entry + code="TR-04" name="Ağrı"/> + <iso_3166_2_entry + code="TR-68" name="Aksaray"/> + <iso_3166_2_entry + code="TR-05" name="Amasya"/> + <iso_3166_2_entry + code="TR-06" name="Ankara"/> + <iso_3166_2_entry + code="TR-07" name="Antalya"/> + <iso_3166_2_entry + code="TR-75" name="Ardahan"/> + <iso_3166_2_entry + code="TR-08" name="Artvin"/> + <iso_3166_2_entry + code="TR-09" name="Aydın"/> + <iso_3166_2_entry + code="TR-10" name="Balıkesir"/> + <iso_3166_2_entry + code="TR-74" name="Bartın"/> + <iso_3166_2_entry + code="TR-72" name="Batman"/> + <iso_3166_2_entry + code="TR-69" name="Bayburt"/> + <iso_3166_2_entry + code="TR-11" name="Bilecik"/> + <iso_3166_2_entry + code="TR-12" name="Bingöl"/> + <iso_3166_2_entry + code="TR-13" name="Bitlis"/> + <iso_3166_2_entry + code="TR-14" name="Bolu"/> + <iso_3166_2_entry + code="TR-15" name="Burdur"/> + <iso_3166_2_entry + code="TR-16" name="Bursa"/> + <iso_3166_2_entry + code="TR-17" name="Çanakkale"/> + <iso_3166_2_entry + code="TR-18" name="Çankırı"/> + <iso_3166_2_entry + code="TR-19" name="Çorum"/> + <iso_3166_2_entry + code="TR-20" name="Denizli"/> + <iso_3166_2_entry + code="TR-21" name="Diyarbakır"/> + <iso_3166_2_entry + code="TR-81" name="Düzce"/> + <iso_3166_2_entry + code="TR-22" name="Edirne"/> + <iso_3166_2_entry + code="TR-23" name="Elazığ"/> + <iso_3166_2_entry + code="TR-24" name="Erzincan"/> + <iso_3166_2_entry + code="TR-25" name="Erzurum"/> + <iso_3166_2_entry + code="TR-26" name="Eskişehir"/> + <iso_3166_2_entry + code="TR-27" name="Gaziantep"/> + <iso_3166_2_entry + code="TR-28" name="Giresun"/> + <iso_3166_2_entry + code="TR-29" name="Gümüşhane"/> + <iso_3166_2_entry + code="TR-30" name="Hakkâri"/> + <iso_3166_2_entry + code="TR-31" name="Hatay"/> + <iso_3166_2_entry + code="TR-76" name="Iğdır"/> + <iso_3166_2_entry + code="TR-32" name="Isparta"/> + <iso_3166_2_entry + code="TR-33" name="İçel"/> + <iso_3166_2_entry + code="TR-34" name="İstanbul"/> + <iso_3166_2_entry + code="TR-35" name="İzmir"/> + <iso_3166_2_entry + code="TR-46" name="Kahramanmaraş"/> + <iso_3166_2_entry + code="TR-78" name="Karabük"/> + <iso_3166_2_entry + code="TR-70" name="Karaman"/> + <iso_3166_2_entry + code="TR-36" name="Kars"/> + <iso_3166_2_entry + code="TR-37" name="Kastamonu"/> + <iso_3166_2_entry + code="TR-38" name="Kayseri"/> + <iso_3166_2_entry + code="TR-71" name="Kırıkkale"/> + <iso_3166_2_entry + code="TR-39" name="Kırklareli"/> + <iso_3166_2_entry + code="TR-40" name="Kırşehir"/> + <iso_3166_2_entry + code="TR-79" name="Kilis"/> + <iso_3166_2_entry + code="TR-41" name="Kocaeli"/> + <iso_3166_2_entry + code="TR-42" name="Konya"/> + <iso_3166_2_entry + code="TR-43" name="Kütahya"/> + <iso_3166_2_entry + code="TR-44" name="Malatya"/> + <iso_3166_2_entry + code="TR-45" name="Manisa"/> + <iso_3166_2_entry + code="TR-47" name="Mardin"/> + <iso_3166_2_entry + code="TR-48" name="Muğla"/> + <iso_3166_2_entry + code="TR-49" name="Muş"/> + <iso_3166_2_entry + code="TR-50" name="Nevşehir"/> + <iso_3166_2_entry + code="TR-51" name="Niğde"/> + <iso_3166_2_entry + code="TR-52" name="Ordu"/> + <iso_3166_2_entry + code="TR-80" name="Osmaniye"/> + <iso_3166_2_entry + code="TR-53" name="Rize"/> + <iso_3166_2_entry + code="TR-54" name="Sakarya"/> + <iso_3166_2_entry + code="TR-55" name="Samsun"/> + <iso_3166_2_entry + code="TR-56" name="Siirt"/> + <iso_3166_2_entry + code="TR-57" name="Sinop"/> + <iso_3166_2_entry + code="TR-58" name="Sivas"/> + <iso_3166_2_entry + code="TR-63" name="Şanlıurfa"/> + <iso_3166_2_entry + code="TR-73" name="Şırnak"/> + <iso_3166_2_entry + code="TR-59" name="Tekirdağ"/> + <iso_3166_2_entry + code="TR-60" name="Tokat"/> + <iso_3166_2_entry + code="TR-61" name="Trabzon"/> + <iso_3166_2_entry + code="TR-62" name="Tunceli"/> + <iso_3166_2_entry + code="TR-64" name="Uşak"/> + <iso_3166_2_entry + code="TR-65" name="Van"/> + <iso_3166_2_entry + code="TR-77" name="Yalova"/> + <iso_3166_2_entry + code="TR-66" name="Yozgat"/> + <iso_3166_2_entry + code="TR-67" name="Zonguldak"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Trinidad and Tobago --> + <iso_3166_country code="TT"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TT-CTT" name="Couva-Tabaquite-Talparo"/> + <iso_3166_2_entry + code="TT-DMN" name="Diego Martin"/> + <iso_3166_2_entry + code="TT-ETO" name="Eastern Tobago"/> + <iso_3166_2_entry + code="TT-PED" name="Penal-Debe"/> + <iso_3166_2_entry + code="TT-PRT" name="Princes Town"/> + <iso_3166_2_entry + code="TT-RCM" name="Rio Claro-Mayaro"/> + <iso_3166_2_entry + code="TT-SGE" name="Sangre Grande"/> + <iso_3166_2_entry + code="TT-SJL" name="San Juan-Laventille"/> + <iso_3166_2_entry + code="TT-SIP" name="Siparia"/> + <iso_3166_2_entry + code="TT-TUP" name="Tunapuna-Piarco"/> + <iso_3166_2_entry + code="TT-WTO" name="Western Tobago"/> + </iso_3166_subset> + <iso_3166_subset type="Borough"> + <iso_3166_2_entry + code="TT-ARI" name="Arima"/> + <iso_3166_2_entry + code="TT-CHA" name="Chaguanas"/> + <iso_3166_2_entry + code="TT-PTF" name="Point Fortin"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="TT-POS" name="Port of Spain"/> + <iso_3166_2_entry + code="TT-SFO" name="San Fernando"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tuvalu --> + <iso_3166_country code="TV"> + <iso_3166_subset type="Town council"> + <iso_3166_2_entry + code="TV-FUN" name="Funafuti"/> + </iso_3166_subset> + <iso_3166_subset type="Island council"> + <iso_3166_2_entry + code="TV-NMG" name="Nanumanga"/> + <iso_3166_2_entry + code="TV-NMA" name="Nanumea"/> + <iso_3166_2_entry + code="TV-NIT" name="Niutao"/> + <iso_3166_2_entry + code="TV-NIU" name="Nui"/> + <iso_3166_2_entry + code="TV-NKF" name="Nukufetau"/> + <iso_3166_2_entry + code="TV-NKL" name="Nukulaelae"/> + <iso_3166_2_entry + code="TV-VAI" name="Vaitupu"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Taiwan --> + <iso_3166_country code="TW"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="TW-CHA" name="Changhua"/> + <iso_3166_2_entry + code="TW-CYQ" name="Chiayi"/> + <iso_3166_2_entry + code="TW-HSQ" name="Hsinchu"/> + <iso_3166_2_entry + code="TW-HUA" name="Hualien"/> + <iso_3166_2_entry + code="TW-ILA" name="Ilan"/> + <iso_3166_2_entry + code="TW-KHQ" name="Kaohsiung"/> + <iso_3166_2_entry + code="TW-MIA" name="Miaoli"/> + <iso_3166_2_entry + code="TW-NAN" name="Nantou"/> + <iso_3166_2_entry + code="TW-PEN" name="Penghu"/> + <iso_3166_2_entry + code="TW-PIF" name="Pingtung"/> + <iso_3166_2_entry + code="TW-TXQ" name="Taichung"/> + <iso_3166_2_entry + code="TW-TNQ" name="Tainan"/> + <iso_3166_2_entry + code="TW-TPQ" name="Taipei"/> + <iso_3166_2_entry + code="TW-TTT" name="Taitung"/> + <iso_3166_2_entry + code="TW-TAO" name="Taoyuan"/> + <iso_3166_2_entry + code="TW-YUN" name="Yunlin"/> + </iso_3166_subset> + <iso_3166_subset type="Municipality"> + <iso_3166_2_entry + code="TW-CYI" name="Chiay City"/> + <iso_3166_2_entry + code="TW-HSZ" name="Hsinchui City"/> + <iso_3166_2_entry + code="TW-KEE" name="Keelung City"/> + <iso_3166_2_entry + code="TW-TXG" name="Taichung City"/> + <iso_3166_2_entry + code="TW-TNN" name="Tainan City"/> + </iso_3166_subset> + <iso_3166_subset type="Special Municipality"> + <iso_3166_2_entry + code="TW-KHH" name="Kaohsiung City"/> + <iso_3166_2_entry + code="TW-TPE" name="Taipei City"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Tanzania --> + <iso_3166_country code="TZ"> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="TZ-01" name="Arusha"/> + <iso_3166_2_entry + code="TZ-02" name="Dar-es-Salaam"/> + <iso_3166_2_entry + code="TZ-03" name="Dodoma"/> + <iso_3166_2_entry + code="TZ-04" name="Iringa"/> + <iso_3166_2_entry + code="TZ-05" name="Kagera"/> + <iso_3166_2_entry + code="TZ-06" name="Kaskazini Pemba"/> + <iso_3166_2_entry + code="TZ-07" name="Kaskazini Unguja"/> + <iso_3166_2_entry + code="TZ-08" name="Kigoma"/> + <iso_3166_2_entry + code="TZ-09" name="Kilimanjaro"/> + <iso_3166_2_entry + code="TZ-10" name="Kusini Pemba"/> + <iso_3166_2_entry + code="TZ-11" name="Kusini Unguja"/> + <iso_3166_2_entry + code="TZ-12" name="Lindi"/> + <iso_3166_2_entry + code="TZ-26" name="Manyara"/> + <iso_3166_2_entry + code="TZ-13" name="Mara"/> + <iso_3166_2_entry + code="TZ-14" name="Mbeya"/> + <iso_3166_2_entry + code="TZ-15" name="Mjini Magharibi"/> + <iso_3166_2_entry + code="TZ-16" name="Morogoro"/> + <iso_3166_2_entry + code="TZ-17" name="Mtwara"/> + <iso_3166_2_entry + code="TZ-18" name="Mwanza"/> + <iso_3166_2_entry + code="TZ-19" name="Pwani"/> + <iso_3166_2_entry + code="TZ-20" name="Rukwa"/> + <iso_3166_2_entry + code="TZ-21" name="Ruvuma"/> + <iso_3166_2_entry + code="TZ-22" name="Shinyanga"/> + <iso_3166_2_entry + code="TZ-23" name="Singida"/> + <iso_3166_2_entry + code="TZ-24" name="Tabora"/> + <iso_3166_2_entry + code="TZ-25" name="Tanga"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Ukraine --> + <iso_3166_country code="UA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="UA-71" name="Cherkas'ka Oblast'"/> + <iso_3166_2_entry + code="UA-74" name="Chernihivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-77" name="Chernivets'ka Oblast'"/> + <iso_3166_2_entry + code="UA-12" name="Dnipropetrovs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-14" name="Donets'ka Oblast'"/> + <iso_3166_2_entry + code="UA-26" name="Ivano-Frankivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-63" name="Kharkivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-65" name="Khersons'ka Oblast'"/> + <iso_3166_2_entry + code="UA-68" name="Khmel'nyts'ka Oblast'"/> + <iso_3166_2_entry + code="UA-35" name="Kirovohrads'ka Oblast'"/> + <iso_3166_2_entry + code="UA-32" name="Kyïvs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-09" name="Luhans'ka Oblast'"/> + <iso_3166_2_entry + code="UA-46" name="L'vivs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-48" name="Mykolaïvs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-51" name="Odes'ka Oblast'"/> + <iso_3166_2_entry + code="UA-53" name="Poltavs'ka Oblast'"/> + <iso_3166_2_entry + code="UA-56" name="Rivnens'ka Oblast'"/> + <iso_3166_2_entry + code="UA-59" name="Sums 'ka Oblast'"/> + <iso_3166_2_entry + code="UA-61" name="Ternopil's'ka Oblast'"/> + <iso_3166_2_entry + code="UA-05" name="Vinnyts'ka Oblast'"/> + <iso_3166_2_entry + code="UA-07" name="Volyns'ka Oblast'"/> + <iso_3166_2_entry + code="UA-21" name="Zakarpats'ka Oblast'"/> + <iso_3166_2_entry + code="UA-23" name="Zaporiz'ka Oblast'"/> + <iso_3166_2_entry + code="UA-18" name="Zhytomyrs'ka Oblast'"/> + </iso_3166_subset> + <iso_3166_subset type="Autonomous republic"> + <iso_3166_2_entry + code="UA-43" name="Respublika Krym"/> + </iso_3166_subset> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="UA-30" name="Kyïvs'ka mis'ka rada"/> + <iso_3166_2_entry + code="UA-40" name="Sevastopol"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Uganda --> + <iso_3166_country code="UG"> + <iso_3166_subset type="Geographical region"> + <iso_3166_2_entry + code="UG-C" name="Central"/> + <iso_3166_2_entry + code="UG-E" name="Eastern"/> + <iso_3166_2_entry + code="UG-N" name="Northern"/> + <iso_3166_2_entry + code="UG-W" name="Western"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="UG-317" name="Abim" parent="N"/> + <iso_3166_2_entry + code="UG-301" name="Adjumani" parent="N"/> + <iso_3166_2_entry + code="UG-314" name="Amolatar" parent="N"/> + <iso_3166_2_entry + code="UG-216" name="Amuria" parent="E"/> + <iso_3166_2_entry + code="UG-319" name="Amuru" parent="N"/> + <iso_3166_2_entry + code="UG-302" name="Apac" parent="N"/> + <iso_3166_2_entry + code="UG-303" name="Arua" parent="N"/> + <iso_3166_2_entry + code="UG-217" name="Budaka" parent="E"/> + <iso_3166_2_entry + code="UG-223" name="Bududa" parent="E"/> + <iso_3166_2_entry + code="UG-201" name="Bugiri" parent="E"/> + <iso_3166_2_entry + code="UG-224" name="Bukedea" parent="E"/> + <iso_3166_2_entry + code="UG-218" name="Bukwa" parent="E"/> + <iso_3166_2_entry + code="UG-419" name="Buliisa" parent="W"/> + <iso_3166_2_entry + code="UG-401" name="Bundibugyo" parent="W"/> + <iso_3166_2_entry + code="UG-402" name="Bushenyi" parent="W"/> + <iso_3166_2_entry + code="UG-202" name="Busia" parent="E"/> + <iso_3166_2_entry + code="UG-219" name="Butaleja" parent="E"/> + <iso_3166_2_entry + code="UG-318" name="Dokolo" parent="N"/> + <iso_3166_2_entry + code="UG-304" name="Gulu" parent="N"/> + <iso_3166_2_entry + code="UG-403" name="Hoima" parent="W"/> + <iso_3166_2_entry + code="UG-416" name="Ibanda" parent="W"/> + <iso_3166_2_entry + code="UG-203" name="Iganga" parent="E"/> + <iso_3166_2_entry + code="UG-417" name="Isingiro" parent="W"/> + <iso_3166_2_entry + code="UG-204" name="Jinja" parent="E"/> + <iso_3166_2_entry + code="UG-315" name="Kaabong" parent="N"/> + <iso_3166_2_entry + code="UG-404" name="Kabale" parent="W"/> + <iso_3166_2_entry + code="UG-405" name="Kabarole" parent="W"/> + <iso_3166_2_entry + code="UG-213" name="Kaberamaido" parent="E"/> + <iso_3166_2_entry + code="UG-101" name="Kalangala" parent="C"/> + <iso_3166_2_entry + code="UG-220" name="Kaliro" parent="E"/> + <iso_3166_2_entry + code="UG-102" name="Kampala" parent="C"/> + <iso_3166_2_entry + code="UG-205" name="Kamuli" parent="E"/> + <iso_3166_2_entry + code="UG-413" name="Kamwenge" parent="W"/> + <iso_3166_2_entry + code="UG-414" name="Kanungu" parent="W"/> + <iso_3166_2_entry + code="UG-206" name="Kapchorwa" parent="E"/> + <iso_3166_2_entry + code="UG-406" name="Kasese" parent="W"/> + <iso_3166_2_entry + code="UG-207" name="Katakwi" parent="E"/> + <iso_3166_2_entry + code="UG-112" name="Kayunga" parent="C"/> + <iso_3166_2_entry + code="UG-407" name="Kibaale" parent="W"/> + <iso_3166_2_entry + code="UG-103" name="Kiboga" parent="C"/> + <iso_3166_2_entry + code="UG-418" name="Kiruhura" parent="W"/> + <iso_3166_2_entry + code="UG-408" name="Kisoro" parent="W"/> + <iso_3166_2_entry + code="UG-305" name="Kitgum" parent="N"/> + <iso_3166_2_entry + code="UG-316" name="Koboko" parent="N"/> + <iso_3166_2_entry + code="UG-306" name="Kotido" parent="N"/> + <iso_3166_2_entry + code="UG-208" name="Kumi" parent="E"/> + <iso_3166_2_entry + code="UG-415" name="Kyenjojo" parent="W"/> + <iso_3166_2_entry + code="UG-307" name="Lira" parent="N"/> + <iso_3166_2_entry + code="UG-104" name="Luwero" parent="C"/> + <iso_3166_2_entry + code="UG-116" name="Lyantonde" parent="C"/> + <iso_3166_2_entry + code="UG-221" name="Manafwa" parent="E"/> + <iso_3166_2_entry + code="UG-320" name="Maracha" parent="N"/> + <iso_3166_2_entry + code="UG-105" name="Masaka" parent="C"/> + <iso_3166_2_entry + code="UG-409" name="Masindi" parent="W"/> + <iso_3166_2_entry + code="UG-214" name="Mayuge" parent="E"/> + <iso_3166_2_entry + code="UG-209" name="Mbale" parent="E"/> + <iso_3166_2_entry + code="UG-410" name="Mbarara" parent="W"/> + <iso_3166_2_entry + code="UG-114" name="Mityana" parent="C"/> + <iso_3166_2_entry + code="UG-308" name="Moroto" parent="N"/> + <iso_3166_2_entry + code="UG-309" name="Moyo" parent="N"/> + <iso_3166_2_entry + code="UG-106" name="Mpigi" parent="C"/> + <iso_3166_2_entry + code="UG-107" name="Mubende" parent="C"/> + <iso_3166_2_entry + code="UG-108" name="Mukono" parent="C"/> + <iso_3166_2_entry + code="UG-311" name="Nakapiripirit" parent="N"/> + <iso_3166_2_entry + code="UG-115" name="Nakaseke" parent="C"/> + <iso_3166_2_entry + code="UG-109" name="Nakasongola" parent="C"/> + <iso_3166_2_entry + code="UG-222" name="Namutumba" parent="E"/> + <iso_3166_2_entry + code="UG-310" name="Nebbi" parent="N"/> + <iso_3166_2_entry + code="UG-411" name="Ntungamo" parent="W"/> + <iso_3166_2_entry + code="UG-321" name="Oyam" parent="N"/> + <iso_3166_2_entry + code="UG-312" name="Pader" parent="N"/> + <iso_3166_2_entry + code="UG-210" name="Pallisa" parent="E"/> + <iso_3166_2_entry + code="UG-110" name="Rakai" parent="C"/> + <iso_3166_2_entry + code="UG-412" name="Rukungiri" parent="W"/> + <iso_3166_2_entry + code="UG-111" name="Sembabule" parent="C"/> + <iso_3166_2_entry + code="UG-215" name="Sironko" parent="E"/> + <iso_3166_2_entry + code="UG-211" name="Soroti" parent="E"/> + <iso_3166_2_entry + code="UG-212" name="Tororo" parent="E"/> + <iso_3166_2_entry + code="UG-113" name="Wakiso" parent="C"/> + <iso_3166_2_entry + code="UG-313" name="Yumbe" parent="N"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United States Minor Outlying Islands --> + <iso_3166_country code="UM"> + <iso_3166_subset type="Territory"> + <iso_3166_2_entry + code="UM-81" name="Baker Island"/> + <iso_3166_2_entry + code="UM-84" name="Howland Island"/> + <iso_3166_2_entry + code="UM-86" name="Jarvis Island"/> + <iso_3166_2_entry + code="UM-67" name="Johnston Atoll"/> + <iso_3166_2_entry + code="UM-89" name="Kingman Reef"/> + <iso_3166_2_entry + code="UM-71" name="Midway Islands"/> + <iso_3166_2_entry + code="UM-76" name="Navassa Island"/> + <iso_3166_2_entry + code="UM-95" name="Palmyra Atoll"/> + <iso_3166_2_entry + code="UM-79" name="Wake Island"/> + </iso_3166_subset> + </iso_3166_country> + <!-- United States --> + <iso_3166_country code="US"> + <iso_3166_subset type="State"> + <!-- US ISO 3166-2 system (from one example) appears to be based on USPS State --> + <!-- and territory codes, which follow: --> + <!-- Note US-UM: Outlying Islands have their own subregion in 'UM' --> + <iso_3166_2_entry + code="US-AL" name="Alabama"/> + <iso_3166_2_entry + code="US-AK" name="Alaska"/> + <iso_3166_2_entry + code="US-AZ" name="Arizona"/> + <iso_3166_2_entry + code="US-AR" name="Arkansas"/> + <iso_3166_2_entry + code="US-CA" name="California"/> + <iso_3166_2_entry + code="US-CO" name="Colorado"/> + <iso_3166_2_entry + code="US-CT" name="Connecticut"/> + <iso_3166_2_entry + code="US-DE" name="Delaware"/> + <iso_3166_2_entry + code="US-FL" name="Florida"/> + <iso_3166_2_entry + code="US-GA" name="Georgia"/> + <iso_3166_2_entry + code="US-HI" name="Hawaii"/> + <iso_3166_2_entry + code="US-ID" name="Idaho"/> + <iso_3166_2_entry + code="US-IL" name="Illinois"/> + <iso_3166_2_entry + code="US-IN" name="Indiana"/> + <iso_3166_2_entry + code="US-IA" name="Iowa"/> + <iso_3166_2_entry + code="US-KS" name="Kansas"/> + <iso_3166_2_entry + code="US-KY" name="Kentucky"/> + <iso_3166_2_entry + code="US-LA" name="Louisiana"/> + <iso_3166_2_entry + code="US-ME" name="Maine"/> + <iso_3166_2_entry + code="US-MD" name="Maryland"/> + <iso_3166_2_entry + code="US-MA" name="Massachusetts"/> + <iso_3166_2_entry + code="US-MI" name="Michigan"/> + <iso_3166_2_entry + code="US-MN" name="Minnesota"/> + <iso_3166_2_entry + code="US-MS" name="Mississippi"/> + <iso_3166_2_entry + code="US-MO" name="Missouri"/> + <iso_3166_2_entry + code="US-MT" name="Montana"/> + <iso_3166_2_entry + code="US-NE" name="Nebraska"/> + <iso_3166_2_entry + code="US-NV" name="Nevada"/> + <iso_3166_2_entry + code="US-NH" name="New Hampshire"/> + <iso_3166_2_entry + code="US-NJ" name="New Jersey"/> + <iso_3166_2_entry + code="US-NM" name="New Mexico"/> + <iso_3166_2_entry + code="US-NY" name="New York"/> + <iso_3166_2_entry + code="US-NC" name="North Carolina"/> + <iso_3166_2_entry + code="US-ND" name="North Dakota"/> + <iso_3166_2_entry + code="US-OH" name="Ohio"/> + <iso_3166_2_entry + code="US-OK" name="Oklahoma"/> + <iso_3166_2_entry + code="US-OR" name="Oregon"/> + <iso_3166_2_entry + code="US-PA" name="Pennsylvania"/> + <iso_3166_2_entry + code="US-RI" name="Rhode Island"/> + <iso_3166_2_entry + code="US-SC" name="South Carolina"/> + <iso_3166_2_entry + code="US-SD" name="South Dakota"/> + <iso_3166_2_entry + code="US-TN" name="Tennessee"/> + <iso_3166_2_entry + code="US-TX" name="Texas"/> + <iso_3166_2_entry + code="US-UT" name="Utah"/> + <iso_3166_2_entry + code="US-VT" name="Vermont"/> + <iso_3166_2_entry + code="US-VA" name="Virginia"/> + <iso_3166_2_entry + code="US-WA" name="Washington"/> + <iso_3166_2_entry + code="US-WV" name="West Virginia"/> + <iso_3166_2_entry + code="US-WI" name="Wisconsin"/> + <iso_3166_2_entry + code="US-WY" name="Wyoming"/> + </iso_3166_subset> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="US-DC" name="District of Columbia"/> + </iso_3166_subset> + <iso_3166_subset type="Outlying area"> + <iso_3166_2_entry + code="US-AS" name="American Samoa"/> + <iso_3166_2_entry + code="US-GU" name="Guam"/> + <iso_3166_2_entry + code="US-MP" name="Northern Mariana Islands"/> + <iso_3166_2_entry + code="US-PR" name="Puerto Rico"/> + <iso_3166_2_entry + code="US-UM" name="United States Minor Outlying Islands"/> + <iso_3166_2_entry + code="US-VI" name="Virgin Islands"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Uruguay --> + <iso_3166_country code="UY"> + <iso_3166_subset type="Department"> + <iso_3166_2_entry + code="UY-AR" name="Artigas"/> + <iso_3166_2_entry + code="UY-CA" name="Canelones"/> + <iso_3166_2_entry + code="UY-CL" name="Cerro Largo"/> + <iso_3166_2_entry + code="UY-CO" name="Colonia"/> + <iso_3166_2_entry + code="UY-DU" name="Durazno"/> + <iso_3166_2_entry + code="UY-FS" name="Flores"/> + <iso_3166_2_entry + code="UY-FD" name="Florida"/> + <iso_3166_2_entry + code="UY-LA" name="Lavalleja"/> + <iso_3166_2_entry + code="UY-MA" name="Maldonado"/> + <iso_3166_2_entry + code="UY-MO" name="Montevideo"/> + <iso_3166_2_entry + code="UY-PA" name="Paysandú"/> + <iso_3166_2_entry + code="UY-RN" name="Río Negro"/> + <iso_3166_2_entry + code="UY-RV" name="Rivera"/> + <iso_3166_2_entry + code="UY-RO" name="Rocha"/> + <iso_3166_2_entry + code="UY-SA" name="Salto"/> + <iso_3166_2_entry + code="UY-SJ" name="San José"/> + <iso_3166_2_entry + code="UY-SO" name="Soriano"/> + <iso_3166_2_entry + code="UY-TA" name="Tacuarembó"/> + <iso_3166_2_entry + code="UY-TT" name="Treinta y Tres"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Uzbekistan --> + <iso_3166_country code="UZ"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="UZ-TK" name="Toshkent"/> + </iso_3166_subset> + <iso_3166_subset type="Region"> + <iso_3166_2_entry + code="UZ-AN" name="Andijon"/> + <iso_3166_2_entry + code="UZ-BU" name="Buxoro"/> + <iso_3166_2_entry + code="UZ-FA" name="Farg'ona"/> + <iso_3166_2_entry + code="UZ-JI" name="Jizzax"/> + <iso_3166_2_entry + code="UZ-NG" name="Namangan"/> + <iso_3166_2_entry + code="UZ-NW" name="Navoiy"/> + <iso_3166_2_entry + code="UZ-QA" name="Qashqadaryo"/> + <iso_3166_2_entry + code="UZ-SA" name="Samarqand"/> + <iso_3166_2_entry + code="UZ-SI" name="Sirdaryo"/> + <iso_3166_2_entry + code="UZ-SU" name="Surxondaryo"/> + <iso_3166_2_entry + code="UZ-TO" name="Toshkent"/> + <iso_3166_2_entry + code="UZ-XO" name="Xorazm"/> + </iso_3166_subset> + <iso_3166_subset type="Republic"> + <iso_3166_2_entry + code="UZ-QR" name="Qoraqalpog'iston Respublikasi"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Saint Vincent and the Grenadines --> + <iso_3166_country code="VC"> + <iso_3166_subset type="Parish"> + <iso_3166_2_entry + code="VC-01" name="Charlotte"/> + <iso_3166_2_entry + code="VC-06" name="Grenadines"/> + <iso_3166_2_entry + code="VC-02" name="Saint Andrew"/> + <iso_3166_2_entry + code="VC-03" name="Saint David"/> + <iso_3166_2_entry + code="VC-04" name="Saint George"/> + <iso_3166_2_entry + code="VC-05" name="Saint Patrick"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Venezuela --> + <iso_3166_country code="VE"> + <iso_3166_subset type="Federal Dependency"> + <iso_3166_2_entry + code="VE-W" name="Dependencias Federales"/> + </iso_3166_subset> + <iso_3166_subset type="Federal District"> + <iso_3166_2_entry + code="VE-A" name="Distrito Federal"/> + </iso_3166_subset> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="VE-Z" name="Amazonas"/> + <iso_3166_2_entry + code="VE-B" name="Anzoátegui"/> + <iso_3166_2_entry + code="VE-C" name="Apure"/> + <iso_3166_2_entry + code="VE-D" name="Aragua"/> + <iso_3166_2_entry + code="VE-E" name="Barinas"/> + <iso_3166_2_entry + code="VE-F" name="Bolívar"/> + <iso_3166_2_entry + code="VE-G" name="Carabobo"/> + <iso_3166_2_entry + code="VE-H" name="Cojedes"/> + <iso_3166_2_entry + code="VE-Y" name="Delta Amacuro"/> + <iso_3166_2_entry + code="VE-I" name="Falcón"/> + <iso_3166_2_entry + code="VE-J" name="Guárico"/> + <iso_3166_2_entry + code="VE-K" name="Lara"/> + <iso_3166_2_entry + code="VE-L" name="Mérida"/> + <iso_3166_2_entry + code="VE-M" name="Miranda"/> + <iso_3166_2_entry + code="VE-N" name="Monagas"/> + <iso_3166_2_entry + code="VE-O" name="Nueva Esparta"/> + <iso_3166_2_entry + code="VE-P" name="Portuguesa"/> + <iso_3166_2_entry + code="VE-R" name="Sucre"/> + <iso_3166_2_entry + code="VE-S" name="Táchira"/> + <iso_3166_2_entry + code="VE-T" name="Trujillo"/> + <iso_3166_2_entry + code="VE-X" name="Vargas"/> + <iso_3166_2_entry + code="VE-U" name="Yaracuy"/> + <iso_3166_2_entry + code="VE-V" name="Zulia"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Viet Nam --> + <iso_3166_country code="VN"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="VN-44" name="An Giang"/> + <iso_3166_2_entry + code="VN-43" name="Bà Rịa - Vũng Tàu"/> + <iso_3166_2_entry + code="VN-53" name="Bắc Kạn"/> + <iso_3166_2_entry + code="VN-54" name="Bắc Giang"/> + <iso_3166_2_entry + code="VN-55" name="Bạc Liêu"/> + <iso_3166_2_entry + code="VN-56" name="Bắc Ninh"/> + <iso_3166_2_entry + code="VN-50" name="Bến Tre"/> + <iso_3166_2_entry + code="VN-31" name="Bình Định"/> + <iso_3166_2_entry + code="VN-57" name="Bình Dương"/> + <iso_3166_2_entry + code="VN-58" name="Bình Phước"/> + <iso_3166_2_entry + code="VN-40" name="Bình Thuận"/> + <iso_3166_2_entry + code="VN-59" name="Cà Mau"/> + <iso_3166_2_entry + code="VN-48" name="Cần Thơ"/> + <iso_3166_2_entry + code="VN-04" name="Cao Bằng"/> + <iso_3166_2_entry + code="VN-60" name="Đà Nẵng, thành phố"/> + <iso_3166_2_entry + code="VN-33" name="Đắc Lắk"/> + <iso_3166_2_entry + code="VN-72" name="Đắk Nông"/> + <iso_3166_2_entry + code="VN-71" name="Điện Biên"/> + <iso_3166_2_entry + code="VN-39" name="Đồng Nai"/> + <iso_3166_2_entry + code="VN-45" name="Đồng Tháp"/> + <iso_3166_2_entry + code="VN-30" name="Gia Lai"/> + <iso_3166_2_entry + code="VN-03" name="Hà Giang"/> + <iso_3166_2_entry + code="VN-63" name="Hà Nam"/> + <iso_3166_2_entry + code="VN-64" name="Hà Nội, thủ đô"/> + <iso_3166_2_entry + code="VN-15" name="Hà Tây"/> + <iso_3166_2_entry + code="VN-23" name="Hà Tỉnh"/> + <iso_3166_2_entry + code="VN-61" name="Hải Duong"/> + <iso_3166_2_entry + code="VN-62" name="Hải Phòng, thành phố"/> + <iso_3166_2_entry + code="VN-73" name="Hậu Giang"/> + <iso_3166_2_entry + code="VN-14" name="Hoà Bình"/> + <iso_3166_2_entry + code="VN-65" name="Hồ Chí Minh, thành phố [Sài Gòn]"/> + <iso_3166_2_entry + code="VN-66" name="Hưng Yên"/> + <iso_3166_2_entry + code="VN-34" name="Khánh Hòa"/> + <iso_3166_2_entry + code="VN-47" name="Kiên Giang"/> + <iso_3166_2_entry + code="VN-28" name="Kon Tum"/> + <iso_3166_2_entry + code="VN-01" name="Lai Châu"/> + <iso_3166_2_entry + code="VN-35" name="Lâm Đồng"/> + <iso_3166_2_entry + code="VN-09" name="Lạng Sơn"/> + <iso_3166_2_entry + code="VN-02" name="Lào Cai"/> + <iso_3166_2_entry + code="VN-41" name="Long An"/> + <iso_3166_2_entry + code="VN-67" name="Nam Định"/> + <iso_3166_2_entry + code="VN-22" name="Nghệ An"/> + <iso_3166_2_entry + code="VN-18" name="Ninh Bình"/> + <iso_3166_2_entry + code="VN-36" name="Ninh Thuận"/> + <iso_3166_2_entry + code="VN-68" name="Phú Thọ"/> + <iso_3166_2_entry + code="VN-32" name="Phú Yên"/> + <iso_3166_2_entry + code="VN-24" name="Quảng Bình"/> + <iso_3166_2_entry + code="VN-27" name="Quảng Nam"/> + <iso_3166_2_entry + code="VN-29" name="Quảng Ngãi"/> + <iso_3166_2_entry + code="VN-13" name="Quảng Ninh"/> + <iso_3166_2_entry + code="VN-25" name="Quảng Trị"/> + <iso_3166_2_entry + code="VN-52" name="Sóc Trăng"/> + <iso_3166_2_entry + code="VN-05" name="Sơn La"/> + <iso_3166_2_entry + code="VN-37" name="Tây Ninh"/> + <iso_3166_2_entry + code="VN-20" name="Thái Bình"/> + <iso_3166_2_entry + code="VN-69" name="Thái Nguyên"/> + <iso_3166_2_entry + code="VN-21" name="Thanh Hóa"/> + <iso_3166_2_entry + code="VN-26" name="Thừa Thiên-Huế"/> + <iso_3166_2_entry + code="VN-46" name="Tiền Giang"/> + <iso_3166_2_entry + code="VN-51" name="Trà Vinh"/> + <iso_3166_2_entry + code="VN-07" name="Tuyên Quang"/> + <iso_3166_2_entry + code="VN-49" name="Vĩnh Long"/> + <iso_3166_2_entry + code="VN-70" name="Vĩnh Phúc"/> + <iso_3166_2_entry + code="VN-06" name="Yên Bái"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Vanuatu --> + <iso_3166_country code="VU"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="VU-MAP" name="Malampa"/> + <iso_3166_2_entry + code="VU-PAM" name="Pénama"/> + <iso_3166_2_entry + code="VU-SAM" name="Sanma"/> + <iso_3166_2_entry + code="VU-SEE" name="Shéfa"/> + <iso_3166_2_entry + code="VU-TAE" name="Taféa"/> + <iso_3166_2_entry + code="VU-TOB" name="Torba"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Samoa --> + <iso_3166_country code="WS"> + <iso_3166_subset type="District"> + <iso_3166_2_entry + code="WS-AA" name="A'ana"/> + <iso_3166_2_entry + code="WS-AL" name="Aiga-i-le-Tai"/> + <iso_3166_2_entry + code="WS-AT" name="Atua"/> + <iso_3166_2_entry + code="WS-FA" name="Fa'asaleleaga"/> + <iso_3166_2_entry + code="WS-GE" name="Gaga'emauga"/> + <iso_3166_2_entry + code="WS-GI" name="Gagaifomauga"/> + <iso_3166_2_entry + code="WS-PA" name="Palauli"/> + <iso_3166_2_entry + code="WS-SA" name="Satupa'itea"/> + <iso_3166_2_entry + code="WS-TU" name="Tuamasaga"/> + <iso_3166_2_entry + code="WS-VF" name="Va'a-o-Fonoti"/> + <iso_3166_2_entry + code="WS-VS" name="Vaisigano"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Yemen --> + <iso_3166_country code="YE"> + <iso_3166_subset type="Governorate"> + <iso_3166_2_entry + code="YE-AB" name="Abyān"/> + <iso_3166_2_entry + code="YE-AD" name="'Adan"/> + <iso_3166_2_entry + code="YE-DA" name="Aḑ Ḑāli‘"/> + <iso_3166_2_entry + code="YE-BA" name="Al Bayḑā'"/> + <iso_3166_2_entry + code="YE-MU" name="Al Ḩudaydah"/> + <iso_3166_2_entry + code="YE-JA" name="Al Jawf"/> + <iso_3166_2_entry + code="YE-MR" name="Al Mahrah"/> + <iso_3166_2_entry + code="YE-MW" name="Al Maḩwīt"/> + <iso_3166_2_entry + code="YE-AM" name="'Amrān"/> + <iso_3166_2_entry + code="YE-DH" name="Dhamār"/> + <iso_3166_2_entry + code="YE-HD" name="Ḩaḑramawt"/> + <iso_3166_2_entry + code="YE-HJ" name="Ḩajjah"/> + <iso_3166_2_entry + code="YE-IB" name="Ibb"/> + <iso_3166_2_entry + code="YE-LA" name="Laḩij"/> + <iso_3166_2_entry + code="YE-MA" name="Ma'rib"/> + <iso_3166_2_entry + code="YE-RA" name="Raymah"/> + <iso_3166_2_entry + code="YE-SD" name="Şa'dah"/> + <iso_3166_2_entry + code="YE-SN" name="Şan'ā'"/> + <iso_3166_2_entry + code="YE-SH" name="Shabwah"/> + <iso_3166_2_entry + code="YE-TA" name="Tā'izz"/> + </iso_3166_subset> + </iso_3166_country> + <!-- South Africa --> + <iso_3166_country code="ZA"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ZA-EC" name="Eastern Cape"/> + <iso_3166_2_entry + code="ZA-FS" name="Free State"/> + <iso_3166_2_entry + code="ZA-GT" name="Gauteng"/> + <iso_3166_2_entry + code="ZA-NL" name="Kwazulu-Natal"/> + <iso_3166_2_entry + code="ZA-LP" name="Limpopo"/> + <iso_3166_2_entry + code="ZA-MP" name="Mpumalanga"/> + <iso_3166_2_entry + code="ZA-NC" name="Northern Cape"/> + <iso_3166_2_entry + code="ZA-NW" name="North-West (South Africa)"/> + <iso_3166_2_entry + code="ZA-WC" name="Western Cape"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Zambia --> + <iso_3166_country code="ZM"> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ZM-02" name="Central"/> + <iso_3166_2_entry + code="ZM-08" name="Copperbelt"/> + <iso_3166_2_entry + code="ZM-03" name="Eastern"/> + <iso_3166_2_entry + code="ZM-04" name="Luapula"/> + <iso_3166_2_entry + code="ZM-09" name="Lusaka"/> + <iso_3166_2_entry + code="ZM-05" name="Northern"/> + <iso_3166_2_entry + code="ZM-06" name="North-Western"/> + <iso_3166_2_entry + code="ZM-07" name="Southern (Zambia)"/> + <iso_3166_2_entry + code="ZM-01" name="Western"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Zimbabwe --> + <iso_3166_country code="ZW"> + <iso_3166_subset type="City"> + <iso_3166_2_entry + code="ZW-BU" name="Bulawayo"/> + <iso_3166_2_entry + code="ZW-HA" name="Harare"/> + </iso_3166_subset> + <iso_3166_subset type="Province"> + <iso_3166_2_entry + code="ZW-MA" name="Manicaland"/> + <iso_3166_2_entry + code="ZW-MC" name="Mashonaland Central"/> + <iso_3166_2_entry + code="ZW-ME" name="Mashonaland East"/> + <iso_3166_2_entry + code="ZW-MW" name="Mashonaland West"/> + <iso_3166_2_entry + code="ZW-MV" name="Masvingo"/> + <iso_3166_2_entry + code="ZW-MN" name="Matabeleland North"/> + <iso_3166_2_entry + code="ZW-MS" name="Matabeleland South"/> + <iso_3166_2_entry + code="ZW-MI" name="Midlands"/> + </iso_3166_subset> + </iso_3166_country> </iso_3166_2_entries> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml index aaf03602a..0acf58880 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml @@ -8,44 +8,44 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutAuthorView"> - <children> - <HBox spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <children> - <ImageView fitHeight="200.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true" - HBox.hgrow="ALWAYS"> - <image> - <Image url="@profile_manuel.png"/> - </image> - </ImageView> - <VBox alignment="CENTER" layoutX="184.0" layoutY="50.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <Label text="Manuel Mauky"> - <font> - <Font size="24.0"/> - </font> - </Label> - <Hyperlink onAction="#openBlog" text="www.lestard.eu"> - <font> - <Font size="14.0"/> - </font> - </Hyperlink> - <Hyperlink onAction="#openTwitter" text="\@manuel_mauky"> - <font> - <Font size="14.0"/> - </font> - </Hyperlink> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> - </padding> - </VBox> - </children> - <padding> - <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> - </padding> - </HBox> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutAuthorView"> + <children> + <HBox spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <children> + <ImageView fitHeight="200.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true" + HBox.hgrow="ALWAYS"> + <image> + <Image url="@profile_manuel.png"/> + </image> + </ImageView> + <VBox alignment="CENTER" layoutX="184.0" layoutY="50.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <Label text="Manuel Mauky"> + <font> + <Font size="24.0"/> + </font> + </Label> + <Hyperlink onAction="#openBlog" text="www.lestard.eu"> + <font> + <Font size="14.0"/> + </font> + </Hyperlink> + <Hyperlink onAction="#openTwitter" text="\@manuel_mauky"> + <font> + <Font size="14.0"/> + </font> + </Hyperlink> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + </padding> + </VBox> + </children> + <padding> + <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> + </padding> + </HBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml index 4cd7bd6d4..be8bca1f9 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml @@ -9,37 +9,37 @@ <?import javafx.scene.layout.*?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.about.AboutView"> - <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <HBox> - <children> - <Text fill="DIMGREY" strokeType="OUTSIDE" strokeWidth="0.0" text="%about.title"> - <font> - <Font size="24.0" /> - </font> - </Text> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> - </padding> - </HBox> - <Separator /> - <VBox spacing="10.0" style="-fx-background-color: white;" VBox.vgrow="ALWAYS"> - <children> - <Label maxHeight="-Infinity" maxWidth="-Infinity" text="%about.description" wrapText="true" VBox.vgrow="ALWAYS" /> - <Label text="%about.libraries.label" /> - <HyperlinkLabel fx:id="librariesLabel" /> - </children> - <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> - </padding> - <VBox.margin> - <Insets /> - </VBox.margin> - </VBox> - <Hyperlink onAction="#openAuthorPage" text="About the Author" /> - </children> - </VBox> - </children> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <HBox> + <children> + <Text fill="DIMGREY" strokeType="OUTSIDE" strokeWidth="0.0" text="%about.title"> + <font> + <Font size="24.0" /> + </font> + </Text> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> + </padding> + </HBox> + <Separator /> + <VBox spacing="10.0" style="-fx-background-color: white;" VBox.vgrow="ALWAYS"> + <children> + <Label maxHeight="-Infinity" maxWidth="-Infinity" text="%about.description" wrapText="true" VBox.vgrow="ALWAYS" /> + <Label text="%about.libraries.label" /> + <HyperlinkLabel fx:id="librariesLabel" /> + </children> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> + </padding> + <VBox.margin> + <Insets /> + </VBox.margin> + </VBox> + <Hyperlink onAction="#openAuthorPage" text="About the Author" /> + </children> + </VBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml index 5b1eff064..c29c29710 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml @@ -2,9 +2,9 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addcontact.AddContactDialogView"> - <children> - <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0" fx:id="contactDialogView" - source="../contactdialog/ContactDialogView.fxml"/> - </children> + <children> + <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0" fx:id="contactDialogView" + source="../contactdialog/ContactDialogView.fxml"/> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml index 60d71fc10..8e395b903 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml @@ -16,45 +16,45 @@ <?import javafx.scene.layout.VBox?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormView"> - <children> - <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" - style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> - </columnConstraints> - <rowConstraints> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - </rowConstraints> - <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> - </padding> - <VBox.margin> - <Insets/> - </VBox.margin> - <children> - <Label text="%addressform.street.label"/> - <Label text="%addressform.postalcode.label" GridPane.rowIndex="1"/> - <Label text="%addressform.city.label" GridPane.rowIndex="2"/> - <TextField fx:id="streetInput" promptText="%addressform.street.prompt" GridPane.columnIndex="1"/> - <TextField fx:id="postalcodeInput" promptText="%addressform.postalcode.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="1"/> - <TextField fx:id="cityInput" promptText="%addressform.city.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="2"/> - <Label fx:id="countryLabel" text="%addressform.country.label" GridPane.rowIndex="3"/> - <Label fx:id="subdivisionLabel" text="%addressform.subdivision.label" GridPane.rowIndex="4"/> - <ComboBox fx:id="federalStateInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="4"/> - <ComboBox fx:id="countryInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/> - <ProgressIndicator fx:id="loadingIndicator" GridPane.columnIndex="2" GridPane.rowIndex="3"/> - </children> - </GridPane> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormView"> + <children> + <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" + style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <columnConstraints> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> + </columnConstraints> + <rowConstraints> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + </rowConstraints> + <padding> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> + </padding> + <VBox.margin> + <Insets/> + </VBox.margin> + <children> + <Label text="%addressform.street.label"/> + <Label text="%addressform.postalcode.label" GridPane.rowIndex="1"/> + <Label text="%addressform.city.label" GridPane.rowIndex="2"/> + <TextField fx:id="streetInput" promptText="%addressform.street.prompt" GridPane.columnIndex="1"/> + <TextField fx:id="postalcodeInput" promptText="%addressform.postalcode.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="1"/> + <TextField fx:id="cityInput" promptText="%addressform.city.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="2"/> + <Label fx:id="countryLabel" text="%addressform.country.label" GridPane.rowIndex="3"/> + <Label fx:id="subdivisionLabel" text="%addressform.subdivision.label" GridPane.rowIndex="4"/> + <ComboBox fx:id="federalStateInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="4"/> + <ComboBox fx:id="countryInput" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/> + <ProgressIndicator fx:id="loadingIndicator" GridPane.columnIndex="2" GridPane.rowIndex="3"/> + </children> + </GridPane> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml index 6573bf30a..dab916677 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml @@ -15,46 +15,46 @@ <?import javafx.scene.text.Text?> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView"> - <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <children> - <HBox> - <children> - <Text fx:id="titleText" fill="dimgray" strokeType="OUTSIDE" strokeWidth="0.0" - text="contact dialog"> - <font> - <Font size="24.0"/> - </font> - <HBox.margin> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </HBox.margin> - </Text> - </children> - </HBox> - <Separator/> - <Pagination fx:id="formPagination" maxPageIndicatorCount="2" pageCount="2" - style="-fx-background-color: white;" VBox.vgrow="ALWAYS"/> - <Separator/> - <HBox alignment="CENTER_RIGHT" spacing="5.0"> - <children> - <Button id="previousButton" fx:id="previousButton" mnemonicParsing="false" onAction="#previous" - text="%common.previous"/> - <Button id="nextButton" fx:id="nextButton" defaultButton="true" mnemonicParsing="false" - onAction="#next" text="%common.next"/> - <Button id="okButton" fx:id="okButton" defaultButton="true" mnemonicParsing="false" - onAction="#ok" prefWidth="80.0" text="%common.ok"> - <HBox.margin> - <Insets/> - </HBox.margin> - </Button> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> - </padding> - </HBox> - </children> - </VBox> - </children> + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactdialog.ContactDialogView"> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <children> + <HBox> + <children> + <Text fx:id="titleText" fill="dimgray" strokeType="OUTSIDE" strokeWidth="0.0" + text="contact dialog"> + <font> + <Font size="24.0"/> + </font> + <HBox.margin> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </HBox.margin> + </Text> + </children> + </HBox> + <Separator/> + <Pagination fx:id="formPagination" maxPageIndicatorCount="2" pageCount="2" + style="-fx-background-color: white;" VBox.vgrow="ALWAYS"/> + <Separator/> + <HBox alignment="CENTER_RIGHT" spacing="5.0"> + <children> + <Button id="previousButton" fx:id="previousButton" mnemonicParsing="false" onAction="#previous" + text="%common.previous"/> + <Button id="nextButton" fx:id="nextButton" defaultButton="true" mnemonicParsing="false" + onAction="#next" text="%common.next"/> + <Button id="okButton" fx:id="okButton" defaultButton="true" mnemonicParsing="false" + onAction="#ok" prefWidth="80.0" text="%common.ok"> + <HBox.margin> + <Insets/> + </HBox.margin> + </Button> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + </padding> + </HBox> + </children> + </VBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml index 1b131e31e..6febba9c8 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml @@ -16,65 +16,65 @@ <?import javafx.scene.layout.VBox?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormView"> - <children> - <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" - style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> - </columnConstraints> - <rowConstraints> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - </rowConstraints> - <children> - <Label text="%contactform.firstname.label" GridPane.halignment="RIGHT"/> - <Label text="%contactform.lastname.label" GridPane.halignment="RIGHT" GridPane.rowIndex="1"/> - <Label text="%contactform.title.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT"/> - <Label text="%contactform.role.label" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/> - <Label text="%contactform.department.label" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/> - <Label text="%contactform.email.label" GridPane.halignment="RIGHT" GridPane.rowIndex="5"/> - <Label text="%contactform.phonenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" - GridPane.rowIndex="6"/> - <Label text="%contactform.mobilenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" - GridPane.rowIndex="5"/> - <Separator GridPane.columnSpan="4" GridPane.rowIndex="4"/> - <Label text="%contactform.birthday.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" - GridPane.rowIndex="1"/> - <TextField id="firstnameInput" fx:id="firstnameInput" promptText="%contactform.firstname.prompt" - GridPane.columnIndex="1"/> - <TextField fx:id="titleInput" promptText="%contactform.title.prompt" GridPane.columnIndex="3"/> - <TextField id="lastnameInput" fx:id="lastnameInput" promptText="%contactform.lastname.prompt" - GridPane.columnIndex="1" GridPane.rowIndex="1"/> - <TextField fx:id="roleInput" promptText="%contactform.role.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="2"/> - <TextField fx:id="departmentInput" promptText="%contactform.department.prompt" GridPane.columnIndex="1" - GridPane.rowIndex="3"/> - <TextField id="emailInput" fx:id="emailInput" promptText="%contactform.email.prompt" - GridPane.columnIndex="1" GridPane.rowIndex="5"/> - <TextField fx:id="mobileNumberInput" promptText="%contactform.mobilenumber.prompt" - GridPane.columnIndex="3" GridPane.rowIndex="5"/> - <TextField fx:id="phoneNumberInput" promptText="%contactform.phonenumber.prompt" - GridPane.columnIndex="3" GridPane.rowIndex="6"/> - <DatePicker fx:id="birthdayInput" promptText="%contactform.birthday.prompt" GridPane.columnIndex="3" - GridPane.rowIndex="1"/> - </children> - <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> - </padding> - <VBox.margin> - <Insets/> - </VBox.margin> - </GridPane> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.contactform.ContactFormView"> + <children> + <GridPane hgap="4.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" + style="-fx-background-color: white;" vgap="4.0" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <columnConstraints> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/> + </columnConstraints> + <rowConstraints> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + </rowConstraints> + <children> + <Label text="%contactform.firstname.label" GridPane.halignment="RIGHT"/> + <Label text="%contactform.lastname.label" GridPane.halignment="RIGHT" GridPane.rowIndex="1"/> + <Label text="%contactform.title.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT"/> + <Label text="%contactform.role.label" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/> + <Label text="%contactform.department.label" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/> + <Label text="%contactform.email.label" GridPane.halignment="RIGHT" GridPane.rowIndex="5"/> + <Label text="%contactform.phonenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" + GridPane.rowIndex="6"/> + <Label text="%contactform.mobilenumber.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" + GridPane.rowIndex="5"/> + <Separator GridPane.columnSpan="4" GridPane.rowIndex="4"/> + <Label text="%contactform.birthday.label" GridPane.columnIndex="2" GridPane.halignment="RIGHT" + GridPane.rowIndex="1"/> + <TextField id="firstnameInput" fx:id="firstnameInput" promptText="%contactform.firstname.prompt" + GridPane.columnIndex="1"/> + <TextField fx:id="titleInput" promptText="%contactform.title.prompt" GridPane.columnIndex="3"/> + <TextField id="lastnameInput" fx:id="lastnameInput" promptText="%contactform.lastname.prompt" + GridPane.columnIndex="1" GridPane.rowIndex="1"/> + <TextField fx:id="roleInput" promptText="%contactform.role.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="2"/> + <TextField fx:id="departmentInput" promptText="%contactform.department.prompt" GridPane.columnIndex="1" + GridPane.rowIndex="3"/> + <TextField id="emailInput" fx:id="emailInput" promptText="%contactform.email.prompt" + GridPane.columnIndex="1" GridPane.rowIndex="5"/> + <TextField fx:id="mobileNumberInput" promptText="%contactform.mobilenumber.prompt" + GridPane.columnIndex="3" GridPane.rowIndex="5"/> + <TextField fx:id="phoneNumberInput" promptText="%contactform.phonenumber.prompt" + GridPane.columnIndex="3" GridPane.rowIndex="6"/> + <DatePicker fx:id="birthdayInput" promptText="%contactform.birthday.prompt" GridPane.columnIndex="3" + GridPane.rowIndex="1"/> + </children> + <padding> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0"/> + </padding> + <VBox.margin> + <Insets/> + </VBox.margin> + </GridPane> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml index 7756b9e97..efa0c16c1 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml @@ -14,37 +14,37 @@ <?import javafx.scene.layout.VBox?> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="50.0" minWidth="100.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.detail.DetailView"> - <children> - <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <VBox maxHeight="1.7976931348623157E308" spacing="3.0" VBox.vgrow="ALWAYS"> - <children> - <Label fx:id="nameLabel" style="-fx-text-fill: dimgrey; -fx-font-size: 20;" text="name" /> - <Label fx:id="birthdayLabel" text="birthday" /> - <Label fx:id="roleDepartmentLabel" text="role/department" /> - <Hyperlink fx:id="emailHyperlink" onAction="#mailAction" text="email address" /> - <Label fx:id="phoneLabel" text="phone number" /> - <Label fx:id="mobileLabel" text="mobile number" /> - <Separator prefWidth="200.0" /> - <Label fx:id="streetLabel" text="street" /> - <Label fx:id="cityPostalCodeLabel" text="city (postalcode)" /> - <Label fx:id="countrySubdivisionLabel" text="country / subdivision" /> - </children> - <padding> - <Insets bottom="2.0" left="2.0" right="2.0" top="2.0" /> - </padding> - </VBox> - <Separator /> - <HBox alignment="CENTER" spacing="5.0"> - <children> - <Button fx:id="editButton" mnemonicParsing="false" onAction="#editAction" text="%common.edit" /> - <Button fx:id="removeButton" mnemonicParsing="false" onAction="#removeAction" text="%common.remove" /> - </children> - <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> - </padding> - </HBox> - </children> - </VBox> - </children> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <VBox maxHeight="1.7976931348623157E308" spacing="3.0" VBox.vgrow="ALWAYS"> + <children> + <Label fx:id="nameLabel" style="-fx-text-fill: dimgrey; -fx-font-size: 20;" text="name" /> + <Label fx:id="birthdayLabel" text="birthday" /> + <Label fx:id="roleDepartmentLabel" text="role/department" /> + <Hyperlink fx:id="emailHyperlink" onAction="#mailAction" text="email address" /> + <Label fx:id="phoneLabel" text="phone number" /> + <Label fx:id="mobileLabel" text="mobile number" /> + <Separator prefWidth="200.0" /> + <Label fx:id="streetLabel" text="street" /> + <Label fx:id="cityPostalCodeLabel" text="city (postalcode)" /> + <Label fx:id="countrySubdivisionLabel" text="country / subdivision" /> + </children> + <padding> + <Insets bottom="2.0" left="2.0" right="2.0" top="2.0" /> + </padding> + </VBox> + <Separator /> + <HBox alignment="CENTER" spacing="5.0"> + <children> + <Button fx:id="editButton" mnemonicParsing="false" onAction="#editAction" text="%common.edit" /> + <Button fx:id="removeButton" mnemonicParsing="false" onAction="#removeAction" text="%common.remove" /> + </children> + <padding> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> + </padding> + </HBox> + </children> + </VBox> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml index 56d76a332..5e105a527 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml @@ -2,9 +2,9 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogView"> - <children> - <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0" fx:id="contactDialogView" - source="../contactdialog/ContactDialogView.fxml"/> - </children> + <children> + <fx:include AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0" fx:id="contactDialogView" + source="../contactdialog/ContactDialogView.fxml"/> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml index ad71b78e2..f0edc11a7 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml @@ -5,27 +5,27 @@ <?import javafx.scene.layout.*?> <VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.main.MainView"> - <children> - <fx:include source="../menu/MenuView.fxml" resources="menu"/> - <fx:include source="../toolbar/ToolbarView.fxml"/> - <SplitPane dividerPositions="0.7" VBox.vgrow="ALWAYS"> - <items> - <AnchorPane> - <children> - <fx:include source="../master/MasterView.fxml" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"/> - </children> - </AnchorPane> - <AnchorPane> - <children> - <fx:include source="../detail/DetailView.fxml" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"/> - </children> - </AnchorPane> - </items> - </SplitPane> - </children> + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.main.MainView"> + <children> + <fx:include source="../menu/MenuView.fxml" resources="menu"/> + <fx:include source="../toolbar/ToolbarView.fxml"/> + <SplitPane dividerPositions="0.7" VBox.vgrow="ALWAYS"> + <items> + <AnchorPane> + <children> + <fx:include source="../master/MasterView.fxml" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"/> + </children> + </AnchorPane> + <AnchorPane> + <children> + <fx:include source="../detail/DetailView.fxml" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"/> + </children> + </AnchorPane> + </items> + </SplitPane> + </children> </VBox> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml index 849d9dd01..9a50cbac7 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml @@ -10,50 +10,50 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane minHeight="50.0" minWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.master.MasterView"> - <children> - <TableView id="masterContactTable" fx:id="contactTable" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <columns> - <TableColumn prefWidth="75.0" text="%master.table.firstname"> - <cellValueFactory> - <PropertyValueFactory property="firstname"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.lastname"> - <cellValueFactory> - <PropertyValueFactory property="lastname"/> - </cellValueFactory> - </TableColumn> - <TableColumn text="%master.table.email"> - <cellValueFactory> - <PropertyValueFactory property="emailAddress"/> - </cellValueFactory> - </TableColumn> - <TableColumn text="%master.table.age"> - <cellValueFactory> - <PropertyValueFactory property="age"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.city"> - <cellValueFactory> - <PropertyValueFactory property="city"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.postalcode"> - <cellValueFactory> - <PropertyValueFactory property="postalCode"/> - </cellValueFactory> - </TableColumn> - <TableColumn prefWidth="75.0" text="%master.table.street"> - <cellValueFactory> - <PropertyValueFactory property="street"/> - </cellValueFactory> - </TableColumn> - </columns> - <columnResizePolicy> - <TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/> - </columnResizePolicy> - </TableView> - </children> + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.master.MasterView"> + <children> + <TableView id="masterContactTable" fx:id="contactTable" AnchorPane.bottomAnchor="0.0" + AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <columns> + <TableColumn prefWidth="75.0" text="%master.table.firstname"> + <cellValueFactory> + <PropertyValueFactory property="firstname"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.lastname"> + <cellValueFactory> + <PropertyValueFactory property="lastname"/> + </cellValueFactory> + </TableColumn> + <TableColumn text="%master.table.email"> + <cellValueFactory> + <PropertyValueFactory property="emailAddress"/> + </cellValueFactory> + </TableColumn> + <TableColumn text="%master.table.age"> + <cellValueFactory> + <PropertyValueFactory property="age"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.city"> + <cellValueFactory> + <PropertyValueFactory property="city"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.postalcode"> + <cellValueFactory> + <PropertyValueFactory property="postalCode"/> + </cellValueFactory> + </TableColumn> + <TableColumn prefWidth="75.0" text="%master.table.street"> + <cellValueFactory> + <PropertyValueFactory property="street"/> + </cellValueFactory> + </TableColumn> + </columns> + <columnResizePolicy> + <TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/> + </columnResizePolicy> + </TableView> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml index 2e77c1b52..abab1b1ba 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml @@ -5,29 +5,29 @@ <?import javafx.scene.control.*?> <AnchorPane maxHeight="-Infinity" maxWidth="+Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.menu.MenuView"> - <children> - <MenuBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <menus> - <Menu mnemonicParsing="false" text="%menu.file"> - <items> - <MenuItem mnemonicParsing="false" onAction="#close" text="%menu.file.close"/> - </items> - </Menu> - <Menu mnemonicParsing="false" text="%menu.edit"> - <items> - <MenuItem fx:id="removeMenuItem" mnemonicParsing="false" onAction="#remove" - text="%menu.edit.removecontact"/> - </items> - </Menu> - <Menu mnemonicParsing="false" text="%menu.help"> - <items> - <MenuItem mnemonicParsing="false" onAction="#about" text="%menu.help.about"/> - </items> - </Menu> - </menus> - </MenuBar> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.menu.MenuView"> + <children> + <MenuBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <menus> + <Menu mnemonicParsing="false" text="%menu.file"> + <items> + <MenuItem mnemonicParsing="false" onAction="#close" text="%menu.file.close"/> + </items> + </Menu> + <Menu mnemonicParsing="false" text="%menu.edit"> + <items> + <MenuItem fx:id="removeMenuItem" mnemonicParsing="false" onAction="#remove" + text="%menu.edit.removecontact"/> + </items> + </Menu> + <Menu mnemonicParsing="false" text="%menu.help"> + <items> + <MenuItem mnemonicParsing="false" onAction="#about" text="%menu.help.about"/> + </items> + </Menu> + </menus> + </MenuBar> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml index c610202b5..0cf2a805c 100644 --- a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml +++ b/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml @@ -8,15 +8,15 @@ <?import javafx.scene.layout.AnchorPane?> <AnchorPane maxHeight="-Infinity" maxWidth="+Infinity" minHeight="-Infinity" minWidth="-Infinity" - xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.toolbar.ToolbarView"> - <children> - <ToolBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <items> - <Button id="addNewContactButton" fx:id="addNewContactButton" mnemonicParsing="false" - onAction="#addNewContact" text="%toolbar.addcontactbutton"/> - </items> - </ToolBar> - </children> + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" + fx:controller="de.saxsys.mvvmfx.examples.contacts.ui.toolbar.ToolbarView"> + <children> + <ToolBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + AnchorPane.topAnchor="0.0"> + <items> + <Button id="addNewContactButton" fx:id="addNewContactButton" mnemonicParsing="false" + onAction="#addNewContact" text="%toolbar.addcontactbutton"/> + </items> + </ToolBar> + </children> </AnchorPane> diff --git a/examples/contacts-example/src/main/resources/logback.xml b/examples/contacts-example/src/main/resources/logback.xml index 49a3cf906..33f425f22 100644 --- a/examples/contacts-example/src/main/resources/logback.xml +++ b/examples/contacts-example/src/main/resources/logback.xml @@ -1,23 +1,23 @@ <configuration> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> - </encoder> - </appender> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> - <logger name="org.jboss.weld" level="INFO"/> + <logger name="org.jboss.weld" level="INFO"/> - <!-- log level for the mvvmfx framework--> - <logger name="de.saxsys.mvvmfx" level="INFO"/> + <!-- log level for the mvvmfx framework--> + <logger name="de.saxsys.mvvmfx" level="INFO"/> - <!-- log level for our application --> - <logger name="de.saxsys.mvvmfx.contacts" level="DEBUG"/> + <!-- log level for our application --> + <logger name="de.saxsys.mvvmfx.contacts" level="DEBUG"/> - <!-- Strictly speaking, the level attribute is not necessary since --> - <!-- the level of the root level is set to DEBUG by default. --> - <root level="DEBUG"> - <appender-ref ref="STDOUT"/> - </root> + <!-- Strictly speaking, the level attribute is not necessary since --> + <!-- the level of the root level is set to DEBUG by default. --> + <root level="DEBUG"> + <appender-ref ref="STDOUT"/> + </root> </configuration> \ No newline at end of file diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java index 51db84123..f48d27b03 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/AppTestFxIT.java @@ -13,34 +13,34 @@ @Ignore public class AppTestFxIT extends FxRobot { - @Before - public void setupApp() throws Exception { + @Before + public void setupApp() throws Exception { - FxToolkit.registerPrimaryStage(); + FxToolkit.registerPrimaryStage(); - FxToolkit.setupApplication(App.class); - } + FxToolkit.setupApplication(App.class); + } - @Test - public void testAddNewContact() { + @Test + public void testAddNewContact() { - clickOn("#addNewContactButton"); + clickOn("#addNewContactButton"); - clickOn("#firstnameInput"); - write("luke"); + clickOn("#firstnameInput"); + write("luke"); - clickOn("#lastnameInput"); - write("skywalker"); + clickOn("#lastnameInput"); + write("skywalker"); - clickOn("#emailInput"); - write("luke.skywalker@example.org"); + clickOn("#emailInput"); + write("luke.skywalker@example.org"); - clickOn("#nextButton"); + clickOn("#nextButton"); - clickOn("#okButton"); + clickOn("#okButton"); - verifyThat("#masterContactTable", hasTableCell("luke")); - verifyThat("#masterContactTable", hasTableCell("skywalker")); - verifyThat("#masterContactTable", hasTableCell("luke.skywalker@example.org")); - } + verifyThat("#masterContactTable", hasTableCell("luke")); + verifyThat("#masterContactTable", hasTableCell("skywalker")); + verifyThat("#masterContactTable", hasTableCell("luke.skywalker@example.org")); + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java index a8048b99b..7be203e6f 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/CountrySelectorIntegrationTest.java @@ -22,140 +22,140 @@ @RunWith(JfxRunner.class) public class CountrySelectorIntegrationTest { - private CountrySelector countrySelector; + private CountrySelector countrySelector; - @Before - public void setup() { - countrySelector = new CountrySelector(); - } + @Before + public void setup() { + countrySelector = new CountrySelector(); + } - @Test - public void testXmlConverterForCountry() throws FileNotFoundException { - XmlConverter<Country> converter = new XmlConverter<>("iso_3166_entry", Country.class); + @Test + public void testXmlConverterForCountry() throws FileNotFoundException { + XmlConverter<Country> converter = new XmlConverter<>("iso_3166_entry", Country.class); - String iso_3166_xml = this.getClass().getResource("/countries/iso_3166.xml").getFile(); + String iso_3166_xml = this.getClass().getResource("/countries/iso_3166.xml").getFile(); - assertThat(iso_3166_xml).isNotNull(); + assertThat(iso_3166_xml).isNotNull(); - converter.initialize(new FileInputStream(iso_3166_xml)); + converter.initialize(new FileInputStream(iso_3166_xml)); - Country country = converter.get(); - assertThat(country).isNotNull(); - } + Country country = converter.get(); + assertThat(country).isNotNull(); + } - @Test - public void testXmlConverterForSubdivision() throws Exception { - XmlConverter<CountrySelector.ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", - CountrySelector.ISO3166_2_CountryEntity.class); + @Test + public void testXmlConverterForSubdivision() throws Exception { + XmlConverter<CountrySelector.ISO3166_2_CountryEntity> converter = new XmlConverter<>("iso_3166_country", + CountrySelector.ISO3166_2_CountryEntity.class); - String iso_3166_2_xml = this.getClass().getResource("/countries/iso_3166_2.xml").getFile(); + String iso_3166_2_xml = this.getClass().getResource("/countries/iso_3166_2.xml").getFile(); - assertThat(iso_3166_2_xml).isNotNull(); + assertThat(iso_3166_2_xml).isNotNull(); - converter.initialize(new FileInputStream(iso_3166_2_xml)); + converter.initialize(new FileInputStream(iso_3166_2_xml)); - CountrySelector.ISO3166_2_CountryEntity entity = converter.get(); + CountrySelector.ISO3166_2_CountryEntity entity = converter.get(); - assertThat(entity).isNotNull(); - assertThat(entity.code).isNotNull().isEqualTo("DE"); + assertThat(entity).isNotNull(); + assertThat(entity.code).isNotNull().isEqualTo("DE"); - assertThat(entity.subsets).isNotNull().hasSize(1); - assertThat(entity.subsets.get(0).subdivisionType).isEqualTo("State"); + assertThat(entity.subsets).isNotNull().hasSize(1); + assertThat(entity.subsets.get(0).subdivisionType).isEqualTo("State"); - List<CountrySelector.ISO3166_2_EntryEntity> entryList = entity.subsets.get(0).entryList; + List<CountrySelector.ISO3166_2_EntryEntity> entryList = entity.subsets.get(0).entryList; - assertThat(entryList).isNotNull().hasSize(16); + assertThat(entryList).isNotNull().hasSize(16); - CountrySelector.ISO3166_2_EntryEntity entry = entryList.get(0); + CountrySelector.ISO3166_2_EntryEntity entry = entryList.get(0); - assertThat(entry.code).isEqualTo("DE-BW"); - assertThat(entry.name).isEqualTo("Baden-Württemberg"); - } + assertThat(entry.code).isEqualTo("DE-BW"); + assertThat(entry.name).isEqualTo("Baden-Württemberg"); + } - @Test - public void testLoadSubdivisions() throws Exception { - runBlocked(countrySelector::init); + @Test + public void testLoadSubdivisions() throws Exception { + runBlocked(countrySelector::init); - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - assertThat(countrySelector.subdivisions()).isEmpty(); + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + assertThat(countrySelector.subdivisions()).isEmpty(); - countrySelector.setCountry(new Country("Germany", "DE")); + countrySelector.setCountry(new Country("Germany", "DE")); - assertThat(countrySelector.subdivisionLabel()).hasValue("State"); - assertThat(countrySelector.subdivisions()).hasSize(16); + assertThat(countrySelector.subdivisionLabel()).hasValue("State"); + assertThat(countrySelector.subdivisions()).hasSize(16); - countrySelector.setCountry(null); + countrySelector.setCountry(null); - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - assertThat(countrySelector.subdivisions()).isEmpty(); + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + assertThat(countrySelector.subdivisions()).isEmpty(); - } + } - @Test - public void testLoadCountries() throws InterruptedException, ExecutionException, TimeoutException { - runBlocked(countrySelector::init); + @Test + public void testLoadCountries() throws InterruptedException, ExecutionException, TimeoutException { + runBlocked(countrySelector::init); - assertThat(countrySelector.availableCountries()).hasSize(3); - assertThat(getCountryNames(countrySelector.availableCountries())).contains("Germany", "Austria", "Switzerland"); + assertThat(countrySelector.availableCountries()).hasSize(3); + assertThat(getCountryNames(countrySelector.availableCountries())).contains("Germany", "Austria", "Switzerland"); - assertThat(countrySelector.subdivisions()).isEmpty(); - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + assertThat(countrySelector.subdivisions()).isEmpty(); + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - Country germany = getCountryByName(countrySelector.availableCountries(), "Germany"); + Country germany = getCountryByName(countrySelector.availableCountries(), "Germany"); - assertThat(germany).isNotNull(); + assertThat(germany).isNotNull(); - countrySelector.setCountry(germany); + countrySelector.setCountry(germany); - assertThat(countrySelector.subdivisions()).hasSize(16); - assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Sachsen", "Bayern", "Hessen"); // only - // test - // some - // examples. - assertThat(countrySelector.subdivisionLabel()).hasValue("State"); + assertThat(countrySelector.subdivisions()).hasSize(16); + assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Sachsen", "Bayern", "Hessen"); // only + // test + // some + // examples. + assertThat(countrySelector.subdivisionLabel()).hasValue("State"); - Country switzerland = getCountryByName(countrySelector.availableCountries(), "Switzerland"); + Country switzerland = getCountryByName(countrySelector.availableCountries(), "Switzerland"); - countrySelector.setCountry(switzerland); + countrySelector.setCountry(switzerland); - assertThat(countrySelector.subdivisions()).hasSize(26); - assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Zürich", "Jura", "Bern"); - assertThat(countrySelector.subdivisionLabel()).hasValue("Canton"); + assertThat(countrySelector.subdivisions()).hasSize(26); + assertThat(getSubdivisionNames(countrySelector.subdivisions())).contains("Zürich", "Jura", "Bern"); + assertThat(countrySelector.subdivisionLabel()).hasValue("Canton"); - countrySelector.setCountry(null); + countrySelector.setCountry(null); - assertThat(countrySelector.subdivisions()).isEmpty(); - assertThat(countrySelector.subdivisionLabel()).hasNullValue(); - } + assertThat(countrySelector.subdivisions()).isEmpty(); + assertThat(countrySelector.subdivisionLabel()).hasNullValue(); + } - private void runBlocked(Runnable function) { - CompletableFuture<Boolean> blocker = new CompletableFuture<>(); + private void runBlocked(Runnable function) { + CompletableFuture<Boolean> blocker = new CompletableFuture<>(); - countrySelector.inProgressProperty().addListener((obs, oldV, newV) -> { - if (!newV) { - blocker.complete(true); - } - }); + countrySelector.inProgressProperty().addListener((obs, oldV, newV) -> { + if (!newV) { + blocker.complete(true); + } + }); - Platform.runLater(function); + Platform.runLater(function); - try { - blocker.get(5, TimeUnit.SECONDS); - } catch (Exception e) { - e.printStackTrace(); - } - } + try { + blocker.get(5, TimeUnit.SECONDS); + } catch (Exception e) { + e.printStackTrace(); + } + } - private Country getCountryByName(List<Country> countries, String name) { - return countries.stream().filter(country -> country.getName().equals(name)).findFirst().orElse(null); - } + private Country getCountryByName(List<Country> countries, String name) { + return countries.stream().filter(country -> country.getName().equals(name)).findFirst().orElse(null); + } - private List<String> getSubdivisionNames(List<Subdivision> subdivisions) { - return subdivisions.stream().map(Subdivision::getName).collect(Collectors.toList()); - } + private List<String> getSubdivisionNames(List<Subdivision> subdivisions) { + return subdivisions.stream().map(Subdivision::getName).collect(Collectors.toList()); + } + + private List<String> getCountryNames(List<Country> countries) { + return countries.stream().map(Country::getName).collect(Collectors.toList()); + } - private List<String> getCountryNames(List<Country> countries) { - return countries.stream().map(Country::getName).collect(Collectors.toList()); - } - } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java index 85e87e5d2..6c7f48358 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/BirthdayValidatorTest.java @@ -21,41 +21,41 @@ public class BirthdayValidatorTest { - private ValidationStatus result; - private ObjectProperty<LocalDate> value = new SimpleObjectProperty<>(); + private ValidationStatus result; + private ObjectProperty<LocalDate> value = new SimpleObjectProperty<>(); - @Before - public void setup() { - ZonedDateTime now = ZonedDateTime - .of(LocalDate.of(2014, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); + @Before + public void setup() { + ZonedDateTime now = ZonedDateTime + .of(LocalDate.of(2014, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); - CentralClock.setFixedClock(now); + CentralClock.setFixedClock(now); - Validator validator = new BirthdayValidator(value); + Validator validator = new BirthdayValidator(value); - result = validator.getValidationStatus(); - } + result = validator.getValidationStatus(); + } - @Test - public void testBirthdayInThePast() { - LocalDate now = LocalDate.now(CentralClock.getClock()); - LocalDate birthday = now.minusYears(20); + @Test + public void testBirthdayInThePast() { + LocalDate now = LocalDate.now(CentralClock.getClock()); + LocalDate birthday = now.minusYears(20); - value.set(birthday); + value.set(birthday); - assertThat(result.isValid()).isTrue(); - } + assertThat(result.isValid()).isTrue(); + } - @Test - public void testBirthdayInTheFuture() { + @Test + public void testBirthdayInTheFuture() { - LocalDate now = LocalDate.now(CentralClock.getClock()); + LocalDate now = LocalDate.now(CentralClock.getClock()); - LocalDate birthday = now.plusDays(1); + LocalDate birthday = now.plusDays(1); + + value.set(birthday); + assertThat(result.isValid()).isFalse(); + assertThat(result.getErrorMessages()).hasSize(1); + } - value.set(birthday); - assertThat(result.isValid()).isFalse(); - assertThat(result.getErrorMessages()).hasSize(1); - } - } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java index a1e1fba5d..dd3b7fbcf 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/EmailAddressValidatorTest.java @@ -14,34 +14,34 @@ public class EmailAddressValidatorTest { - private ValidationStatus result; - private StringProperty value = new SimpleStringProperty(); + private ValidationStatus result; + private StringProperty value = new SimpleStringProperty(); - @Before - public void setup() { - Validator validator = new EmailValidator(value); + @Before + public void setup() { + Validator validator = new EmailValidator(value); - result = validator.getValidationStatus(); - } + result = validator.getValidationStatus(); + } - @Test - public void testValidationOfEmail() { - assertThat(result.isValid()).isFalse(); + @Test + public void testValidationOfEmail() { + assertThat(result.isValid()).isFalse(); - value.set("darthvader@imperium.org"); - assertThat(result.isValid()).isTrue(); + value.set("darthvader@imperium.org"); + assertThat(result.isValid()).isTrue(); - value.set("darthvader.imperium.org"); // wrong email format - assertThat(result.isValid()).isFalse(); + value.set("darthvader.imperium.org"); // wrong email format + assertThat(result.isValid()).isFalse(); - value.set(null); - assertThat(result.isValid()).isFalse(); + value.set(null); + assertThat(result.isValid()).isFalse(); - value.set(""); - assertThat(result.isValid()).isFalse(); + value.set(""); + assertThat(result.isValid()).isFalse(); + + value.set(" "); + assertThat(result.isValid()).isFalse(); + } - value.set(" "); - assertThat(result.isValid()).isFalse(); - } - } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java index d753f926e..cbb2e2242 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/model/validation/PhoneNumberValidatorTest.java @@ -14,34 +14,34 @@ public class PhoneNumberValidatorTest { - private ValidationStatus result; - private StringProperty value = new SimpleStringProperty(); - - @Before - public void setup() { - Validator validator = new PhoneValidator(value, "error message"); - - result = validator.getValidationStatus(); - } - - @Test - public void testPhoneNumber() { - // phone number is not mandatory - value.set(""); - assertThat(result.isValid()).isTrue(); - value.set(null); - assertThat(result.isValid()).isTrue(); - value.set(" "); - assertThat(result.isValid()).isTrue(); - - value.set("012345678"); - assertThat(result.isValid()).isTrue(); - - value.set("+49 1234 324541"); - assertThat(result.isValid()).isTrue(); - - value.set("abc"); - assertThat(result.isValid()).isFalse(); - } - + private ValidationStatus result; + private StringProperty value = new SimpleStringProperty(); + + @Before + public void setup() { + Validator validator = new PhoneValidator(value, "error message"); + + result = validator.getValidationStatus(); + } + + @Test + public void testPhoneNumber() { + // phone number is not mandatory + value.set(""); + assertThat(result.isValid()).isTrue(); + value.set(null); + assertThat(result.isValid()).isTrue(); + value.set(" "); + assertThat(result.isValid()).isTrue(); + + value.set("012345678"); + assertThat(result.isValid()).isTrue(); + + value.set("+49 1234 324541"); + assertThat(result.isValid()).isTrue(); + + value.set("abc"); + assertThat(result.isValid()).isFalse(); + } + } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java index ca59e0bfa..b6a65472d 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutViewModelTest.java @@ -14,56 +14,56 @@ public class AboutViewModelTest { - private static final String MY_COOL_LIB_NAME = "my cool library"; - private static final String MY_COOL_LIB_URL = "http://my-cool-library.example.org"; + private static final String MY_COOL_LIB_NAME = "my cool library"; + private static final String MY_COOL_LIB_URL = "http://my-cool-library.example.org"; - private static final String OTHER_FX_NAME = "otherFX"; - private static final String OTHER_FX_URL = "http://otherfx.example.org"; + private static final String OTHER_FX_NAME = "otherFX"; + private static final String OTHER_FX_URL = "http://otherfx.example.org"; - private AboutViewModel viewModel; + private AboutViewModel viewModel; - private Consumer<String> onLinkClickedHandler; + private Consumer<String> onLinkClickedHandler; - @SuppressWarnings("unchecked") - @Before - public void setup() { - viewModel = new AboutViewModel(); + @SuppressWarnings("unchecked") + @Before + public void setup() { + viewModel = new AboutViewModel(); - onLinkClickedHandler = mock(Consumer.class); - viewModel.onLinkClickedHandler = onLinkClickedHandler; - } + onLinkClickedHandler = mock(Consumer.class); + viewModel.onLinkClickedHandler = onLinkClickedHandler; + } - @Test - public void testLibrariesLabel() { + @Test + public void testLibrariesLabel() { - ReadOnlyStringProperty libraries = viewModel.librariesLabelTextProperty(); + ReadOnlyStringProperty libraries = viewModel.librariesLabelTextProperty(); - assertThat(libraries).hasValue(""); + assertThat(libraries).hasValue(""); - viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); + viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); - assertThat(libraries).hasValue("- [my cool library]\n"); + assertThat(libraries).hasValue("- [my cool library]\n"); - viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); - assertThat(libraries).hasValue("- [my cool library]\n- [otherFX]\n"); - } + viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); + assertThat(libraries).hasValue("- [my cool library]\n- [otherFX]\n"); + } - @Test - public void testOnLinkClicked() { + @Test + public void testOnLinkClicked() { - viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); - viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); + viewModel.libraryLinkMap.put(MY_COOL_LIB_NAME, MY_COOL_LIB_URL); + viewModel.libraryLinkMap.put(OTHER_FX_NAME, OTHER_FX_URL); - viewModel.onLinkClicked(MY_COOL_LIB_NAME); + viewModel.onLinkClicked(MY_COOL_LIB_NAME); - verify(onLinkClickedHandler).accept(MY_COOL_LIB_URL); + verify(onLinkClickedHandler).accept(MY_COOL_LIB_URL); - viewModel.onLinkClicked(OTHER_FX_NAME); - verify(onLinkClickedHandler).accept(OTHER_FX_URL); + viewModel.onLinkClicked(OTHER_FX_NAME); + verify(onLinkClickedHandler).accept(OTHER_FX_URL); - viewModel.onLinkClicked("something else"); + viewModel.onLinkClicked("something else"); + + verifyNoMoreInteractions(onLinkClickedHandler); + } - verifyNoMoreInteractions(onLinkClickedHandler); - } - } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java index 3eac015b3..06d8ea6d1 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormViewModelTest.java @@ -23,173 +23,173 @@ public class AddressFormViewModelTest { - private static final String SUBDIVISION_DEFAULT_LABEL = "default_subdivision_label"; + private static final String SUBDIVISION_DEFAULT_LABEL = "default_subdivision_label"; - private AddressFormViewModel viewModel; + private AddressFormViewModel viewModel; - private CountrySelector countrySelector; + private CountrySelector countrySelector; - private Country germany = new Country("Germany", "DE"); - private Country austria = new Country("Austria", "AU"); + private Country germany = new Country("Germany", "DE"); + private Country austria = new Country("Austria", "AU"); - private StringProperty subdivisionLabel = new SimpleStringProperty(); + private StringProperty subdivisionLabel = new SimpleStringProperty(); - private ObservableList<Country> availableCountries = FXCollections.observableArrayList(); - private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); + private ObservableList<Country> availableCountries = FXCollections.observableArrayList(); + private ObservableList<Subdivision> subdivisions = FXCollections.observableArrayList(); - private ContactDialogScope scope; + private ContactDialogScope scope; - @Before - public void setup() { - availableCountries.addAll(germany, austria); + @Before + public void setup() { + availableCountries.addAll(germany, austria); - // sadly the ResourceBundle.getString method is final so we can't use mockito - ResourceBundle resourceBundle = new ListResourceBundle() { - @Override - protected Object[][] getContents() { - return new Object[][]{ - {SUBDIVISION_LABEL_KEY, SUBDIVISION_DEFAULT_LABEL} - }; - } - }; - countrySelector = mock(CountrySelector.class); - when(countrySelector.inProgressProperty()).thenReturn(new SimpleBooleanProperty()); - when(countrySelector.subdivisionLabel()).thenReturn(subdivisionLabel); - when(countrySelector.availableCountries()).thenReturn(availableCountries); - when(countrySelector.subdivisions()).thenReturn(subdivisions); + // sadly the ResourceBundle.getString method is final so we can't use mockito + ResourceBundle resourceBundle = new ListResourceBundle() { + @Override + protected Object[][] getContents() { + return new Object[][]{ + {SUBDIVISION_LABEL_KEY, SUBDIVISION_DEFAULT_LABEL} + }; + } + }; + countrySelector = mock(CountrySelector.class); + when(countrySelector.inProgressProperty()).thenReturn(new SimpleBooleanProperty()); + when(countrySelector.subdivisionLabel()).thenReturn(subdivisionLabel); + when(countrySelector.availableCountries()).thenReturn(availableCountries); + when(countrySelector.subdivisions()).thenReturn(subdivisions); - // when "germany" is selected, fill in the subdivisions of germany ... - doAnswer(invocation -> { - helper_fillCountrySelectorWithGermanSubdivisions(); - return null; - }).when(countrySelector).setCountry(germany); + // when "germany" is selected, fill in the subdivisions of germany ... + doAnswer(invocation -> { + helper_fillCountrySelectorWithGermanSubdivisions(); + return null; + }).when(countrySelector).setCountry(germany); - // ... same for austria - doAnswer(invocation -> { - helper_fillCountrySelectorWithAustrianSubdivisions(); - return null; - }).when(countrySelector).setCountry(austria); + // ... same for austria + doAnswer(invocation -> { + helper_fillCountrySelectorWithAustrianSubdivisions(); + return null; + }).when(countrySelector).setCountry(austria); - // when nothing is selected, clear the subdivisions list. - doAnswer(invocation -> { - subdivisions.clear(); - return null; - }).when(countrySelector).setCountry(null); + // when nothing is selected, clear the subdivisions list. + doAnswer(invocation -> { + subdivisions.clear(); + return null; + }).when(countrySelector).setCountry(null); - scope = new ContactDialogScope(); + scope = new ContactDialogScope(); - viewModel = new AddressFormViewModel(); - viewModel.dialogScope = scope; - viewModel.resourceBundle = resourceBundle; - viewModel.countrySelector = countrySelector; - } + viewModel = new AddressFormViewModel(); + viewModel.dialogScope = scope; + viewModel.resourceBundle = resourceBundle; + viewModel.countrySelector = countrySelector; + } - @Test - public void testSubdivisionLabel() { - viewModel.initSubdivisionLabel(); - - assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); - - subdivisionLabel.set("Bundesland"); - assertThat(viewModel.subdivisionLabel()).hasValue("Bundesland"); - - subdivisionLabel.set(null); - assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); - - subdivisionLabel.set(""); - assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); - } - - @Test - public void testCountryAndFederalStateLists() throws Exception { - viewModel.initialize(); - - assertThat(viewModel.countriesList()).hasSize(3).contains(NOTHING_SELECTED_MARKER, "Austria", "Germany"); - assertThat(viewModel.countriesList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); - assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); - - assertThat(viewModel.selectedCountryProperty()).hasValue(NOTHING_SELECTED_MARKER); - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - - viewModel.selectedCountryProperty().set("Germany"); - - assertThat(viewModel.subdivisionsList()).hasSize(17).contains(NOTHING_SELECTED_MARKER, "Sachsen", "Berlin", - "Bayern"); // test sample - assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - - viewModel.selectedSubdivisionProperty().set("Sachsen"); - - viewModel.selectedCountryProperty().set("Austria"); - - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - assertThat(viewModel.subdivisionsList()).hasSize(10).contains(NOTHING_SELECTED_MARKER, "Wien", "Tirol", - "Salzburg"); - assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); - - viewModel.selectedSubdivisionProperty().set("Wien"); - - viewModel.selectedCountryProperty().set(NOTHING_SELECTED_MARKER); - assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); - - assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); - } - - @Test - public void testCreateListWithNothingSelectedMarker() { - ObservableList<String> sourceList = FXCollections.observableArrayList(); - - ObservableList<String> target = AddressFormViewModel - .createListWithNothingSelectedMarker(sourceList); - - assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); - - sourceList.add("test"); - assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "test"); - - sourceList.add("temp"); - assertThat(target).hasSize(3).containsExactly(NOTHING_SELECTED_MARKER, "test", "temp"); - - sourceList.remove("test"); - assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "temp"); - - sourceList.clear(); - assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); - } - - private void helper_fillCountrySelectorWithGermanSubdivisions() { - subdivisions.clear(); - - subdivisions.add(new Subdivision("Baden-Württemberg", "BW", germany)); - subdivisions.add(new Subdivision("Bayern", "BY", germany)); - subdivisions.add(new Subdivision("Berlin", "BE", germany)); - subdivisions.add(new Subdivision("Brandenburg", "BB", germany)); - subdivisions.add(new Subdivision("Bremen", "HB", germany)); - subdivisions.add(new Subdivision("Hamburg", "HH", germany)); - subdivisions.add(new Subdivision("Hessen", "HE", germany)); - subdivisions.add(new Subdivision("Mecklemburg-Vorpommern", "MV", germany)); - subdivisions.add(new Subdivision("Niedersachsen", "NI", germany)); - subdivisions.add(new Subdivision("Nordrhein-Westfalen", "NW", germany)); - subdivisions.add(new Subdivision("Rheinland-Pfalz", "RP", germany)); - subdivisions.add(new Subdivision("Saarland", "SL", germany)); - subdivisions.add(new Subdivision("Sachsen", "SN", germany)); - subdivisions.add(new Subdivision("Sachsen-Anhalt", "ST", germany)); - subdivisions.add(new Subdivision("Schleswig-Holstein", "SH", germany)); - subdivisions.add(new Subdivision("Thüringen", "TH", germany)); - } + @Test + public void testSubdivisionLabel() { + viewModel.initSubdivisionLabel(); + + assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); + + subdivisionLabel.set("Bundesland"); + assertThat(viewModel.subdivisionLabel()).hasValue("Bundesland"); + + subdivisionLabel.set(null); + assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); + + subdivisionLabel.set(""); + assertThat(viewModel.subdivisionLabel()).hasValue(SUBDIVISION_DEFAULT_LABEL); + } + + @Test + public void testCountryAndFederalStateLists() throws Exception { + viewModel.initialize(); + + assertThat(viewModel.countriesList()).hasSize(3).contains(NOTHING_SELECTED_MARKER, "Austria", "Germany"); + assertThat(viewModel.countriesList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); + assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); + + assertThat(viewModel.selectedCountryProperty()).hasValue(NOTHING_SELECTED_MARKER); + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + + viewModel.selectedCountryProperty().set("Germany"); + + assertThat(viewModel.subdivisionsList()).hasSize(17).contains(NOTHING_SELECTED_MARKER, "Sachsen", "Berlin", + "Bayern"); // test sample + assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + + viewModel.selectedSubdivisionProperty().set("Sachsen"); + + viewModel.selectedCountryProperty().set("Austria"); + + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + assertThat(viewModel.subdivisionsList()).hasSize(10).contains(NOTHING_SELECTED_MARKER, "Wien", "Tirol", + "Salzburg"); + assertThat(viewModel.subdivisionsList().get(0)).isEqualTo(NOTHING_SELECTED_MARKER); + + viewModel.selectedSubdivisionProperty().set("Wien"); + + viewModel.selectedCountryProperty().set(NOTHING_SELECTED_MARKER); + assertThat(viewModel.selectedSubdivisionProperty()).hasValue(NOTHING_SELECTED_MARKER); + + assertThat(viewModel.subdivisionsList()).hasSize(1).contains(NOTHING_SELECTED_MARKER); + } + + @Test + public void testCreateListWithNothingSelectedMarker() { + ObservableList<String> sourceList = FXCollections.observableArrayList(); + + ObservableList<String> target = AddressFormViewModel + .createListWithNothingSelectedMarker(sourceList); + + assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); + + sourceList.add("test"); + assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "test"); + + sourceList.add("temp"); + assertThat(target).hasSize(3).containsExactly(NOTHING_SELECTED_MARKER, "test", "temp"); + + sourceList.remove("test"); + assertThat(target).hasSize(2).containsExactly(NOTHING_SELECTED_MARKER, "temp"); + + sourceList.clear(); + assertThat(target).hasSize(1).contains(NOTHING_SELECTED_MARKER); + } + + private void helper_fillCountrySelectorWithGermanSubdivisions() { + subdivisions.clear(); + + subdivisions.add(new Subdivision("Baden-Württemberg", "BW", germany)); + subdivisions.add(new Subdivision("Bayern", "BY", germany)); + subdivisions.add(new Subdivision("Berlin", "BE", germany)); + subdivisions.add(new Subdivision("Brandenburg", "BB", germany)); + subdivisions.add(new Subdivision("Bremen", "HB", germany)); + subdivisions.add(new Subdivision("Hamburg", "HH", germany)); + subdivisions.add(new Subdivision("Hessen", "HE", germany)); + subdivisions.add(new Subdivision("Mecklemburg-Vorpommern", "MV", germany)); + subdivisions.add(new Subdivision("Niedersachsen", "NI", germany)); + subdivisions.add(new Subdivision("Nordrhein-Westfalen", "NW", germany)); + subdivisions.add(new Subdivision("Rheinland-Pfalz", "RP", germany)); + subdivisions.add(new Subdivision("Saarland", "SL", germany)); + subdivisions.add(new Subdivision("Sachsen", "SN", germany)); + subdivisions.add(new Subdivision("Sachsen-Anhalt", "ST", germany)); + subdivisions.add(new Subdivision("Schleswig-Holstein", "SH", germany)); + subdivisions.add(new Subdivision("Thüringen", "TH", germany)); + } - private void helper_fillCountrySelectorWithAustrianSubdivisions() { - subdivisions.clear(); + private void helper_fillCountrySelectorWithAustrianSubdivisions() { + subdivisions.clear(); - subdivisions.add(new Subdivision("Burgenland", "Bgld.", austria)); - subdivisions.add(new Subdivision("Kärnten", "Ktn.", austria)); - subdivisions.add(new Subdivision("Niederösterreich", "NÖ", austria)); - subdivisions.add(new Subdivision("Oberösterreich", "OÖ", austria)); - subdivisions.add(new Subdivision("Salzburg", "Sbg.", austria)); - subdivisions.add(new Subdivision("Steiermark", "Stmk.", austria)); - subdivisions.add(new Subdivision("Tirol", "T", austria)); - subdivisions.add(new Subdivision("Vorarlberg", "Vbg.", austria)); - subdivisions.add(new Subdivision("Wien", "W", austria)); - } + subdivisions.add(new Subdivision("Burgenland", "Bgld.", austria)); + subdivisions.add(new Subdivision("Kärnten", "Ktn.", austria)); + subdivisions.add(new Subdivision("Niederösterreich", "NÖ", austria)); + subdivisions.add(new Subdivision("Oberösterreich", "OÖ", austria)); + subdivisions.add(new Subdivision("Salzburg", "Sbg.", austria)); + subdivisions.add(new Subdivision("Steiermark", "Stmk.", austria)); + subdivisions.add(new Subdivision("Tirol", "T", austria)); + subdivisions.add(new Subdivision("Vorarlberg", "Vbg.", austria)); + subdivisions.add(new Subdivision("Wien", "W", austria)); + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java index d81476afd..268dd6562 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogViewModelTest.java @@ -9,125 +9,125 @@ public class ContactDialogViewModelTest { - private ContactDialogViewModel viewModel; + private ContactDialogViewModel viewModel; - private ContactDialogScope scope; + private ContactDialogScope scope; - private BooleanProperty contactFormValid; - private BooleanProperty addressFormValid; + private BooleanProperty contactFormValid; + private BooleanProperty addressFormValid; - @Before - public void setup() { - scope = new ContactDialogScope(); - contactFormValid = scope.contactFormValidProperty(); - addressFormValid = scope.addressFormValidProperty(); + @Before + public void setup() { + scope = new ContactDialogScope(); + contactFormValid = scope.contactFormValidProperty(); + addressFormValid = scope.addressFormValidProperty(); - viewModel = new ContactDialogViewModel(); - viewModel.dialogScope = scope; - viewModel.initialize(); - } + viewModel = new ContactDialogViewModel(); + viewModel.dialogScope = scope; + viewModel.initialize(); + } - @Test - public void testValid() { - addressFormValid.set(true); - contactFormValid.set(true); + @Test + public void testValid() { + addressFormValid.set(true); + contactFormValid.set(true); - assertThat(viewModel.validProperty()).isTrue(); + assertThat(viewModel.validProperty()).isTrue(); - addressFormValid.set(false); - assertThat(viewModel.validProperty()).isFalse(); + addressFormValid.set(false); + assertThat(viewModel.validProperty()).isFalse(); - addressFormValid.set(true); - assertThat(viewModel.validProperty()).isTrue(); + addressFormValid.set(true); + assertThat(viewModel.validProperty()).isTrue(); - contactFormValid.set(false); - assertThat(viewModel.validProperty()).isFalse(); + contactFormValid.set(false); + assertThat(viewModel.validProperty()).isFalse(); - contactFormValid.set(true); - assertThat(viewModel.validProperty()).isTrue(); - } + contactFormValid.set(true); + assertThat(viewModel.validProperty()).isTrue(); + } - @Test - public void testWorkflow() { - assertThat(viewModel.dialogPageProperty()).hasValue(0); + @Test + public void testWorkflow() { + assertThat(viewModel.dialogPageProperty()).hasValue(0); - contactFormValid.set(false); - addressFormValid.set(false); + contactFormValid.set(false); + addressFormValid.set(false); - // add button is invisible and disabled - assertThat(viewModel.okButtonVisibleProperty()).isFalse(); - assertThat(viewModel.okButtonDisabledProperty()).isTrue(); + // add button is invisible and disabled + assertThat(viewModel.okButtonVisibleProperty()).isFalse(); + assertThat(viewModel.okButtonDisabledProperty()).isTrue(); - // next button is visible but disabled - assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); - assertThat(viewModel.nextButtonDisabledProperty()).isTrue(); + // next button is visible but disabled + assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); + assertThat(viewModel.nextButtonDisabledProperty()).isTrue(); - // previous button is invisible and disabled - assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); - assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); + // previous button is invisible and disabled + assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); + assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - // now we enter all mandatory values into the form and it is now valid - contactFormValid.set(true); + // now we enter all mandatory values into the form and it is now valid + contactFormValid.set(true); - // add button is still invisible and disabled - assertThat(viewModel.okButtonVisibleProperty()).isFalse(); - assertThat(viewModel.okButtonDisabledProperty()).isTrue(); + // add button is still invisible and disabled + assertThat(viewModel.okButtonVisibleProperty()).isFalse(); + assertThat(viewModel.okButtonDisabledProperty()).isTrue(); - // next button is visible and now also enabled - assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + // next button is visible and now also enabled + assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - // previous button is invisible and disabled - assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); - assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); + // previous button is invisible and disabled + assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); + assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - // lets go to the next page - viewModel.nextAction(); + // lets go to the next page + viewModel.nextAction(); - assertThat(viewModel.dialogPageProperty()).hasValue(1); + assertThat(viewModel.dialogPageProperty()).hasValue(1); - // add button is now visible but still disabled - assertThat(viewModel.okButtonVisibleProperty()).isTrue(); - assertThat(viewModel.okButtonDisabledProperty()).isTrue(); + // add button is now visible but still disabled + assertThat(viewModel.okButtonVisibleProperty()).isTrue(); + assertThat(viewModel.okButtonDisabledProperty()).isTrue(); - // next button is invisible and enabled - assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + // next button is invisible and enabled + assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - // previous button is now visible but still disabled - assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); - assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); + // previous button is now visible but still disabled + assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); + assertThat(viewModel.previousButtonDisabledProperty()).isTrue(); - // lets enter valid address informations... - addressFormValid.set(true); + // lets enter valid address informations... + addressFormValid.set(true); - // add button is still visible and now also enabled - assertThat(viewModel.okButtonVisibleProperty()).isTrue(); - assertThat(viewModel.okButtonDisabledProperty()).isFalse(); + // add button is still visible and now also enabled + assertThat(viewModel.okButtonVisibleProperty()).isTrue(); + assertThat(viewModel.okButtonDisabledProperty()).isFalse(); - // next button is invisible and enabled - assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + // next button is invisible and enabled + assertThat(viewModel.nextButtonVisibleProperty()).isFalse(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); - // previous button is still visible and now also enabled - assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); - assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); + // previous button is still visible and now also enabled + assertThat(viewModel.previousButtonVisibleProperty()).isTrue(); + assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); - // lets go back to the previous page. The address form is still valid. - viewModel.previousAction(); - assertThat(viewModel.dialogPageProperty()).hasValue(0); + // lets go back to the previous page. The address form is still valid. + viewModel.previousAction(); + assertThat(viewModel.dialogPageProperty()).hasValue(0); - // add button is invisible again and but still enabled - assertThat(viewModel.okButtonVisibleProperty()).isFalse(); - assertThat(viewModel.okButtonDisabledProperty()).isFalse(); + // add button is invisible again and but still enabled + assertThat(viewModel.okButtonVisibleProperty()).isFalse(); + assertThat(viewModel.okButtonDisabledProperty()).isFalse(); - // next button is visible again and still enabled - assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); - assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + // next button is visible again and still enabled + assertThat(viewModel.nextButtonVisibleProperty()).isTrue(); + assertThat(viewModel.nextButtonDisabledProperty()).isFalse(); + + // previous button is now invisible but stays enabled + assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); + assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); + } - // previous button is now invisible but stays enabled - assertThat(viewModel.previousButtonVisibleProperty()).isFalse(); - assertThat(viewModel.previousButtonDisabledProperty()).isFalse(); - } - } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java index 60bb137c3..6107d71c3 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactFormViewModelTest.java @@ -10,45 +10,45 @@ public class ContactFormViewModelTest { - private ContactFormViewModel viewModel; + private ContactFormViewModel viewModel; - @Before - public void setup() { - viewModel = new ContactFormViewModel(); - } + @Before + public void setup() { + viewModel = new ContactFormViewModel(); + } - @Test - public void testFirstname() { + @Test + public void testFirstname() { - assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); - assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); + assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); + assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); - viewModel.firstnameProperty().set("Horst"); + viewModel.firstnameProperty().set("Horst"); - assertThat(viewModel.firstnameValidation().validProperty()).isTrue(); - assertThat(viewModel.firstnameValidation().getErrorMessages()).isEmpty(); + assertThat(viewModel.firstnameValidation().validProperty()).isTrue(); + assertThat(viewModel.firstnameValidation().getErrorMessages()).isEmpty(); - viewModel.firstnameProperty().setValue(""); - assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); - assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); - } + viewModel.firstnameProperty().setValue(""); + assertThat(viewModel.firstnameValidation().getErrorMessages()).hasSize(1); + assertThat(viewModel.firstnameValidation().validProperty()).isFalse(); + } - @Test - public void testEmail() { - GCVerifier.forceGC(); + @Test + public void testEmail() { + GCVerifier.forceGC(); - assertThat(viewModel.emailValidation().getMessages()).hasSize(2); - assertThat(viewModel.emailValidation().validProperty()).isFalse(); + assertThat(viewModel.emailValidation().getMessages()).hasSize(2); + assertThat(viewModel.emailValidation().validProperty()).isFalse(); - viewModel.emailProperty().set("Something"); + viewModel.emailProperty().set("Something"); - assertThat(viewModel.emailValidation().getMessages()).hasSize(1); - assertThat(viewModel.emailValidation().validProperty()).isFalse(); + assertThat(viewModel.emailValidation().getMessages()).hasSize(1); + assertThat(viewModel.emailValidation().validProperty()).isFalse(); - viewModel.emailProperty().set("test@example.org"); + viewModel.emailProperty().set("test@example.org"); - assertThat(viewModel.emailValidation().getMessages()).isEmpty(); - assertThat(viewModel.emailValidation().validProperty()).isTrue(); - } + assertThat(viewModel.emailValidation().getMessages()).isEmpty(); + assertThat(viewModel.emailValidation().validProperty()).isTrue(); + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java index 0c9b869f1..bad440ab4 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModelTest.java @@ -18,161 +18,161 @@ public class DetailViewModelTest { - private DetailViewModel viewModel; + private DetailViewModel viewModel; - private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(); - private Contact luke; - private Contact obi; + private final ObjectProperty<Contact> selectedContact = new SimpleObjectProperty<>(); + private Contact luke; + private Contact obi; - private Repository repository; + private Repository repository; - @Before - public void setup() { - MasterDetailScope masterViewModelMock = mock(MasterDetailScope.class); + @Before + public void setup() { + MasterDetailScope masterViewModelMock = mock(MasterDetailScope.class); - when(masterViewModelMock.selectedContactProperty()).thenReturn(selectedContact); + when(masterViewModelMock.selectedContactProperty()).thenReturn(selectedContact); - viewModel = new DetailViewModel(); - viewModel.mdScope = masterViewModelMock; + viewModel = new DetailViewModel(); + viewModel.mdScope = masterViewModelMock; - repository = mock(Repository.class); - viewModel.repository = repository; + repository = mock(Repository.class); + viewModel.repository = repository; - viewModel.initialize(); + viewModel.initialize(); - luke = new Contact(); - obi = new Contact(); - } + luke = new Contact(); + obi = new Contact(); + } - @Test - public void testRemoveAction() { - selectedContact.set(null); - assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isTrue(); - selectedContact.set(luke); - assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isFalse(); - viewModel.getRemoveCommand().execute(); - verify(repository).delete(luke); - } + @Test + public void testRemoveAction() { + selectedContact.set(null); + assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isTrue(); + selectedContact.set(luke); + assertThat(viewModel.getRemoveCommand().notExecutableProperty()).isFalse(); + viewModel.getRemoveCommand().execute(); + verify(repository).delete(luke); + } - @Test - public void testNameLabelText() { - luke.setFirstname("Luke"); - luke.setLastname("Skywalker"); + @Test + public void testNameLabelText() { + luke.setFirstname("Luke"); + luke.setLastname("Skywalker"); - obi.setFirstname("Obi-Wan"); - obi.setLastname("Kenobi"); - obi.setTitle("Master"); + obi.setFirstname("Obi-Wan"); + obi.setLastname("Kenobi"); + obi.setTitle("Master"); - selectedContact.set(null); + selectedContact.set(null); - assertThat(viewModel.nameLabelTextProperty()).hasValue(""); + assertThat(viewModel.nameLabelTextProperty()).hasValue(""); - selectedContact.set(luke); + selectedContact.set(luke); - assertThat(viewModel.nameLabelTextProperty()).hasValue("Luke Skywalker"); + assertThat(viewModel.nameLabelTextProperty()).hasValue("Luke Skywalker"); - selectedContact.set(obi); + selectedContact.set(obi); - assertThat(viewModel.nameLabelTextProperty()).hasValue("Master Obi-Wan Kenobi"); - } + assertThat(viewModel.nameLabelTextProperty()).hasValue("Master Obi-Wan Kenobi"); + } - @Test - public void testBirthdayLabelText() { - luke.setBirthday(LocalDate.of(1951, 9, 25)); - obi.setBirthday(null); + @Test + public void testBirthdayLabelText() { + luke.setBirthday(LocalDate.of(1951, 9, 25)); + obi.setBirthday(null); - selectedContact.set(null); - assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); + selectedContact.set(null); + assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); - selectedContact.set(luke); - assertThat(viewModel.birthdayLabelTextProperty()).hasValue("1951-09-25"); + selectedContact.set(luke); + assertThat(viewModel.birthdayLabelTextProperty()).hasValue("1951-09-25"); - selectedContact.set(obi); - assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); + selectedContact.set(obi); + assertThat(viewModel.birthdayLabelTextProperty()).hasValue(""); - } + } - @Test - public void testRoleDepartmentLabelText() { - luke.setRole("Pilot"); - luke.setDepartment("Rebel Alliance"); + @Test + public void testRoleDepartmentLabelText() { + luke.setRole("Pilot"); + luke.setDepartment("Rebel Alliance"); - obi.setRole("Jedi"); - obi.setDepartment(null); + obi.setRole("Jedi"); + obi.setDepartment(null); - selectedContact.set(null); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); + selectedContact.set(null); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); - selectedContact.set(luke); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Pilot / Rebel Alliance"); + selectedContact.set(luke); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Pilot / Rebel Alliance"); - selectedContact.set(obi); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Jedi"); + selectedContact.set(obi); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Jedi"); - luke.setRole(null); // the galactic war is over now so he isn't a pilot anymore ;-) + luke.setRole(null); // the galactic war is over now so he isn't a pilot anymore ;-) - selectedContact.set(luke); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Rebel Alliance"); + selectedContact.set(luke); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue("Rebel Alliance"); - obi.setRole(""); - obi.setDepartment(""); + obi.setRole(""); + obi.setDepartment(""); - selectedContact.set(obi); - assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); - } + selectedContact.set(obi); + assertThat(viewModel.roleDepartmentLabelTextProperty()).hasValue(""); + } - @Test - public void testEmailLabelText() { - luke.setEmailAddress("luke@rebel-alliance.com"); + @Test + public void testEmailLabelText() { + luke.setEmailAddress("luke@rebel-alliance.com"); - obi.setEmailAddress(null); + obi.setEmailAddress(null); - selectedContact.set(null); - assertThat(viewModel.emailLabelTextProperty()).hasValue(""); + selectedContact.set(null); + assertThat(viewModel.emailLabelTextProperty()).hasValue(""); - selectedContact.set(luke); - assertThat(viewModel.emailLabelTextProperty()).hasValue("luke@rebel-alliance.com"); + selectedContact.set(luke); + assertThat(viewModel.emailLabelTextProperty()).hasValue("luke@rebel-alliance.com"); - selectedContact.set(obi); - assertThat(viewModel.emailLabelTextProperty()).hasValue(""); - } + selectedContact.set(obi); + assertThat(viewModel.emailLabelTextProperty()).hasValue(""); + } - @Test - public void testPhoneLabelText() { - luke.setPhoneNumber(null); - obi.setPhoneNumber("0123456789"); + @Test + public void testPhoneLabelText() { + luke.setPhoneNumber(null); + obi.setPhoneNumber("0123456789"); - selectedContact.set(null); - assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); + selectedContact.set(null); + assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); - selectedContact.set(luke); - assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); + selectedContact.set(luke); + assertThat(viewModel.phoneLabelTextProperty()).hasValue(""); - selectedContact.set(obi); - assertThat(viewModel.phoneLabelTextProperty()).hasValue("0123456789"); + selectedContact.set(obi); + assertThat(viewModel.phoneLabelTextProperty()).hasValue("0123456789"); - luke.setPhoneNumber("+49 123 456 789"); - selectedContact.set(luke); - assertThat(viewModel.phoneLabelTextProperty()).hasValue("+49 123 456 789"); - } + luke.setPhoneNumber("+49 123 456 789"); + selectedContact.set(luke); + assertThat(viewModel.phoneLabelTextProperty()).hasValue("+49 123 456 789"); + } - @Test - public void testMobileLabelText() { - luke.setMobileNumber(null); - obi.setMobileNumber("0123456789"); + @Test + public void testMobileLabelText() { + luke.setMobileNumber(null); + obi.setMobileNumber("0123456789"); - selectedContact.set(null); - assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); + selectedContact.set(null); + assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); - selectedContact.set(luke); - assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); + selectedContact.set(luke); + assertThat(viewModel.mobileLabelTextProperty()).hasValue(""); - selectedContact.set(obi); - assertThat(viewModel.mobileLabelTextProperty()).hasValue("0123456789"); + selectedContact.set(obi); + assertThat(viewModel.mobileLabelTextProperty()).hasValue("0123456789"); + + luke.setMobileNumber("+49 123 456 789"); + selectedContact.set(luke); + assertThat(viewModel.mobileLabelTextProperty()).hasValue("+49 123 456 789"); + } - luke.setMobileNumber("+49 123 456 789"); - selectedContact.set(luke); - assertThat(viewModel.mobileLabelTextProperty()).hasValue("+49 123 456 789"); - } - } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java index e66919f79..d93ce97b7 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogViewModelTest.java @@ -17,40 +17,40 @@ public class EditContactDialogViewModelTest { - private EditContactDialogViewModel viewModel; + private EditContactDialogViewModel viewModel; - private Repository repository; + private Repository repository; - private ContactDialogViewModel contactDialogViewModel; + private ContactDialogViewModel contactDialogViewModel; - private ContactDialogScope scope; + private ContactDialogScope scope; - @Before - public void setup() { - scope = new ContactDialogScope(); + @Before + public void setup() { + scope = new ContactDialogScope(); - // sadly the ResourceBundle.getString method is final so we can't use mockito - ResourceBundle resourceBundle = new ListResourceBundle() { - @Override - protected Object[][] getContents() { - return new Object[][]{ - {TITLE_LABEL_KEY, "default_subdivision_label"} - }; - } - }; + // sadly the ResourceBundle.getString method is final so we can't use mockito + ResourceBundle resourceBundle = new ListResourceBundle() { + @Override + protected Object[][] getContents() { + return new Object[][]{ + {TITLE_LABEL_KEY, "default_subdivision_label"} + }; + } + }; - viewModel = new EditContactDialogViewModel(); - viewModel.dialogScope = scope; + viewModel = new EditContactDialogViewModel(); + viewModel.dialogScope = scope; - viewModel.defaultResourceBundle = resourceBundle; + viewModel.defaultResourceBundle = resourceBundle; - repository = mock(Repository.class); - viewModel.repository = repository; + repository = mock(Repository.class); + viewModel.repository = repository; - contactDialogViewModel = mock(ContactDialogViewModel.class); - when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); + contactDialogViewModel = mock(ContactDialogViewModel.class); + when(contactDialogViewModel.validProperty()).thenReturn(new SimpleBooleanProperty(true)); - when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); - } + when(contactDialogViewModel.titleTextProperty()).thenReturn(new SimpleStringProperty()); + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java index 8d9debe49..5d09ac2b0 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterTableViewModelTest.java @@ -15,20 +15,20 @@ public class MasterTableViewModelTest { - @Test - public void testCalculationOfAge() { + @Test + public void testCalculationOfAge() { - ZonedDateTime now = ZonedDateTime - .of(LocalDate.of(2010, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); // 2010-01-01T00:00 + ZonedDateTime now = ZonedDateTime + .of(LocalDate.of(2010, Month.JANUARY, 1), LocalTime.of(0, 0), ZoneId.systemDefault()); // 2010-01-01T00:00 - CentralClock.setFixedClock(now); + CentralClock.setFixedClock(now); - Contact contact = new Contact(); - contact.setBirthday(LocalDate.of(1987, Month.DECEMBER, 13)); + Contact contact = new Contact(); + contact.setBirthday(LocalDate.of(1987, Month.DECEMBER, 13)); - MasterTableViewModel tableViewModel = new MasterTableViewModel(contact); + MasterTableViewModel tableViewModel = new MasterTableViewModel(contact); - assertThat(tableViewModel.ageProperty().get()).isEqualTo(22); - } + assertThat(tableViewModel.ageProperty().get()).isEqualTo(22); + } } diff --git a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java index c641d305d..add9a8ca7 100644 --- a/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java +++ b/examples/contacts-example/src/test/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterViewModelTest.java @@ -24,146 +24,146 @@ @SuppressWarnings("unchecked") public class MasterViewModelTest { - private MasterViewModel viewModel; - private MasterDetailScope mdScope; + private MasterViewModel viewModel; + private MasterDetailScope mdScope; - private Repository repository; - private Contact contact1; - private Contact contact2; - private Contact contact3; + private Repository repository; + private Contact contact1; + private Contact contact2; + private Contact contact3; - private Consumer<MasterTableViewModel> onSelectConsumer; + private Consumer<MasterTableViewModel> onSelectConsumer; - @Before - public void setup() { - repository = new InmemoryRepository(); - viewModel = new MasterViewModel(); - mdScope = new MasterDetailScope(); + @Before + public void setup() { + repository = new InmemoryRepository(); + viewModel = new MasterViewModel(); + mdScope = new MasterDetailScope(); - viewModel.mdScope = mdScope; - viewModel.repository = repository; + viewModel.mdScope = mdScope; + viewModel.repository = repository; - contact1 = ContactFactory.createRandomContact(); - contact2 = ContactFactory.createRandomContact(); - contact3 = ContactFactory.createRandomContact(); + contact1 = ContactFactory.createRandomContact(); + contact2 = ContactFactory.createRandomContact(); + contact3 = ContactFactory.createRandomContact(); - repository.save(contact1); - repository.save(contact2); - repository.save(contact3); + repository.save(contact1); + repository.save(contact2); + repository.save(contact3); - onSelectConsumer = mock(Consumer.class); - viewModel.setOnSelect(onSelectConsumer); - } + onSelectConsumer = mock(Consumer.class); + viewModel.setOnSelect(onSelectConsumer); + } - @Test - public void testSelectContact() { - viewModel.initialize(); + @Test + public void testSelectContact() { + viewModel.initialize(); + + assertThat(viewModel.selectedTableRowProperty()).hasNullValue(); + assertThat(mdScope.selectedContactProperty()).hasNullValue(); + + MasterTableViewModel firstRow = viewModel.getContactList().get(0); + + viewModel.selectedTableRowProperty().set(firstRow); + + assertThat(mdScope.selectedContactProperty()).hasNotNullValue(); + assertThat(mdScope.selectedContactProperty().get().getId()).isEqualTo(firstRow.getId()); + + viewModel.selectedTableRowProperty().set(null); + + assertThat(mdScope.selectedContactProperty()).hasNullValue(); + } + + /** + * When no item is selected before an update then after the update still no + * item should be selected. + */ + @Test + public void testUpdateContactListNoSelection() { + viewModel.initialize(); + viewModel.selectedTableRowProperty().set(null); + + assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); + + viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); + + verify(onSelectConsumer, never()).accept(any()); + } + + /** + * When the contactList is updated and the item that was selected before the + * update is still available in the repository (i.e. it wasn't removed) this + * item should still be selected after the update. + */ + @Test + public void testUpdateContactListSelectionPersistsAfterUpdate() { + viewModel.initialize(); + assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); + + MasterTableViewModel row2 = findTableViewModelForContact(contact2); + + viewModel.selectedTableRowProperty().set(row2); + + repository.delete(contact1); // Not the selected contact + + viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); + + assertThat(getContactIdsInTable()).contains(contact2.getId(), contact3.getId()) + .doesNotContain(contact1.getId()); + + verify(onSelectConsumer).accept(row2); + } + + /** + * When the contactList is updated and the item that was selected before the + * update is now not available in the repository anymore (because it was + * removed) then no item should be selected. + */ + @Test + public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { + viewModel.initialize(); + MasterTableViewModel row2 = findTableViewModelForContact(contact2); + + viewModel.selectedTableRowProperty().set(row2); + + repository.delete(contact2); // The selected contact + + viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); + + assertThat(getContactIdsInTable()).contains(contact1.getId(), contact3.getId()) + .doesNotContain(contact2.getId()); + + verify(onSelectConsumer).accept(null); + } + + /** + * This helper extracts the IDs of all Contact rows in that are shown in the + * TableView. + * + * The TableView doesn't directly show instances of + * {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} but instead + * contains instances of + * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel}. + * + * Every + * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} + * has an ID attribute corresponding to the ID of the contact that is shown. + * This method extracts these IDs and returns them as List. This way we can + * verify what Contacts are shown in the Table. + */ + private List<String> getContactIdsInTable() { + return viewModel.getContactList().stream().map(MasterTableViewModel::getId).collect( + Collectors.toList()); + } + + /** + * Returns the + * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} + * for the given {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} + * from the contact list. + */ + private MasterTableViewModel findTableViewModelForContact(Contact contact) { + return viewModel.getContactList().stream().filter(row -> row.getId().equals(contact.getId())).findFirst().get(); + } - assertThat(viewModel.selectedTableRowProperty()).hasNullValue(); - assertThat(mdScope.selectedContactProperty()).hasNullValue(); - - MasterTableViewModel firstRow = viewModel.getContactList().get(0); - - viewModel.selectedTableRowProperty().set(firstRow); - - assertThat(mdScope.selectedContactProperty()).hasNotNullValue(); - assertThat(mdScope.selectedContactProperty().get().getId()).isEqualTo(firstRow.getId()); - - viewModel.selectedTableRowProperty().set(null); - - assertThat(mdScope.selectedContactProperty()).hasNullValue(); - } - - /** - * When no item is selected before an update then after the update still no - * item should be selected. - */ - @Test - public void testUpdateContactListNoSelection() { - viewModel.initialize(); - viewModel.selectedTableRowProperty().set(null); - - assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); - - viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); - - verify(onSelectConsumer, never()).accept(any()); - } - - /** - * When the contactList is updated and the item that was selected before the - * update is still available in the repository (i.e. it wasn't removed) this - * item should still be selected after the update. - */ - @Test - public void testUpdateContactListSelectionPersistsAfterUpdate() { - viewModel.initialize(); - assertThat(getContactIdsInTable()).contains(contact1.getId(), contact2.getId(), contact3.getId()); - - MasterTableViewModel row2 = findTableViewModelForContact(contact2); - - viewModel.selectedTableRowProperty().set(row2); - - repository.delete(contact1); // Not the selected contact - - viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); - - assertThat(getContactIdsInTable()).contains(contact2.getId(), contact3.getId()) - .doesNotContain(contact1.getId()); - - verify(onSelectConsumer).accept(row2); - } - - /** - * When the contactList is updated and the item that was selected before the - * update is now not available in the repository anymore (because it was - * removed) then no item should be selected. - */ - @Test - public void testUpdateContactListNoSelectionWhenSelectedItemIsRemoved() { - viewModel.initialize(); - MasterTableViewModel row2 = findTableViewModelForContact(contact2); - - viewModel.selectedTableRowProperty().set(row2); - - repository.delete(contact2); // The selected contact - - viewModel.onContactsUpdateEvent(new ContactsUpdatedEvent()); - - assertThat(getContactIdsInTable()).contains(contact1.getId(), contact3.getId()) - .doesNotContain(contact2.getId()); - - verify(onSelectConsumer).accept(null); - } - - /** - * This helper extracts the IDs of all Contact rows in that are shown in the - * TableView. - * - * The TableView doesn't directly show instances of - * {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} but instead - * contains instances of - * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel}. - * - * Every - * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} - * has an ID attribute corresponding to the ID of the contact that is shown. - * This method extracts these IDs and returns them as List. This way we can - * verify what Contacts are shown in the Table. - */ - private List<String> getContactIdsInTable() { - return viewModel.getContactList().stream().map(MasterTableViewModel::getId).collect( - Collectors.toList()); - } - - /** - * Returns the - * {@link de.saxsys.mvvmfx.examples.contacts.ui.master.MasterTableViewModel} - * for the given {@link de.saxsys.mvvmfx.examples.contacts.model.Contact} - * from the contact list. - */ - private MasterTableViewModel findTableViewModelForContact(Contact contact) { - return viewModel.getContactList().stream().filter(row -> row.getId().equals(contact.getId())).findFirst().get(); - } - } diff --git a/examples/contacts-example/src/test/resources/countries/iso_3166.xml b/examples/contacts-example/src/test/resources/countries/iso_3166.xml index b96e5e416..7e68fb37b 100644 --- a/examples/contacts-example/src/test/resources/countries/iso_3166.xml +++ b/examples/contacts-example/src/test/resources/countries/iso_3166.xml @@ -23,22 +23,22 @@ ]> <iso_3166_entries> - <iso_3166_entry - alpha_2_code="AT" - alpha_3_code="AUT" - numeric_code="040" - name="Austria" - official_name="Republic of Austria"/> - <iso_3166_entry - alpha_2_code="DE" - alpha_3_code="DEU" - numeric_code="276" - name="Germany" - official_name="Federal Republic of Germany"/> - <iso_3166_entry - alpha_2_code="CH" - alpha_3_code="CHE" - numeric_code="756" - name="Switzerland" - official_name="Swiss Confederation"/> + <iso_3166_entry + alpha_2_code="AT" + alpha_3_code="AUT" + numeric_code="040" + name="Austria" + official_name="Republic of Austria"/> + <iso_3166_entry + alpha_2_code="DE" + alpha_3_code="DEU" + numeric_code="276" + name="Germany" + official_name="Federal Republic of Germany"/> + <iso_3166_entry + alpha_2_code="CH" + alpha_3_code="CHE" + numeric_code="756" + name="Switzerland" + official_name="Swiss Confederation"/> </iso_3166_entries> \ No newline at end of file diff --git a/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml b/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml index f5f94af38..7e4f5ba66 100644 --- a/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml +++ b/examples/contacts-example/src/test/resources/countries/iso_3166_2.xml @@ -20,122 +20,122 @@ ]> <iso_3166_2_entries> - <!-- Germany --> - <iso_3166_country code="DE"> - <iso_3166_subset type="State"> - <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> - <iso_3166_2_entry - code="DE-BW" name="Baden-Württemberg"/> - <iso_3166_2_entry - code="DE-BY" name="Bayern"/> - <iso_3166_2_entry - code="DE-HB" name="Bremen"/> - <iso_3166_2_entry - code="DE-HH" name="Hamburg"/> - <iso_3166_2_entry - code="DE-HE" name="Hessen"/> - <iso_3166_2_entry - code="DE-NI" name="Niedersachsen"/> - <iso_3166_2_entry - code="DE-NW" name="Nordrhein-Westfalen"/> - <iso_3166_2_entry - code="DE-RP" name="Rheinland-Pfalz"/> - <iso_3166_2_entry - code="DE-SL" name="Saarland"/> - <iso_3166_2_entry - code="DE-SH" name="Schleswig-Holstein"/> - <iso_3166_2_entry - code="DE-BE" name="Berlin"/> - <iso_3166_2_entry - code="DE-BB" name="Brandenburg"/> - <iso_3166_2_entry - code="DE-MV" name="Mecklenburg-Vorpommern"/> - <iso_3166_2_entry - code="DE-SN" name="Sachsen"/> - <iso_3166_2_entry - code="DE-ST" name="Sachsen-Anhalt"/> - <iso_3166_2_entry - code="DE-TH" name="Thüringen"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Austria --> - <iso_3166_country code="AT"> - <iso_3166_subset type="State"> - <iso_3166_2_entry - code="AT-1" name="Burgenland"/> - <iso_3166_2_entry - code="AT-2" name="Kärnten"/> - <iso_3166_2_entry - code="AT-3" name="Niederösterreich"/> - <iso_3166_2_entry - code="AT-4" name="Oberösterreich"/> - <iso_3166_2_entry - code="AT-5" name="Salzburg"/> - <iso_3166_2_entry - code="AT-6" name="Steiermark"/> - <iso_3166_2_entry - code="AT-7" name="Tirol"/> - <iso_3166_2_entry - code="AT-8" name="Vorarlberg"/> - <iso_3166_2_entry - code="AT-9" name="Wien"/> - </iso_3166_subset> - </iso_3166_country> - <!-- Switzerland --> - <iso_3166_country code="CH"> - <iso_3166_subset type="Canton"> - <iso_3166_2_entry - code="CH-AG" name="Aargau"/> - <iso_3166_2_entry - code="CH-AI" name="Appenzell Innerrhoden"/> - <iso_3166_2_entry - code="CH-AR" name="Appenzell Ausserrhoden"/> - <iso_3166_2_entry - code="CH-BE" name="Bern"/> - <iso_3166_2_entry - code="CH-BL" name="Basel-Landschaft"/> - <iso_3166_2_entry - code="CH-BS" name="Basel-Stadt"/> - <iso_3166_2_entry - code="CH-FR" name="Fribourg"/> - <iso_3166_2_entry - code="CH-GE" name="Genève"/> - <iso_3166_2_entry - code="CH-GL" name="Glarus"/> - <iso_3166_2_entry - code="CH-GR" name="Graubünden"/> - <iso_3166_2_entry - code="CH-JU" name="Jura"/> - <iso_3166_2_entry - code="CH-LU" name="Luzern"/> - <iso_3166_2_entry - code="CH-NE" name="Neuchâtel"/> - <iso_3166_2_entry - code="CH-NW" name="Nidwalden"/> - <iso_3166_2_entry - code="CH-OW" name="Obwalden"/> - <iso_3166_2_entry - code="CH-SG" name="Sankt Gallen"/> - <iso_3166_2_entry - code="CH-SH" name="Schaffhausen"/> - <iso_3166_2_entry - code="CH-SO" name="Solothurn"/> - <iso_3166_2_entry - code="CH-SZ" name="Schwyz"/> - <iso_3166_2_entry - code="CH-TG" name="Thurgau"/> - <iso_3166_2_entry - code="CH-TI" name="Ticino"/> - <iso_3166_2_entry - code="CH-UR" name="Uri"/> - <iso_3166_2_entry - code="CH-VD" name="Vaud"/> - <iso_3166_2_entry - code="CH-VS" name="Valais"/> - <iso_3166_2_entry - code="CH-ZG" name="Zug"/> - <iso_3166_2_entry - code="CH-ZH" name="Zürich"/> - </iso_3166_subset> - </iso_3166_country> + <!-- Germany --> + <iso_3166_country code="DE"> + <iso_3166_subset type="State"> + <!-- Germany uses the Bundeslander codes for ISO 3166-2 codes (any others?) --> + <iso_3166_2_entry + code="DE-BW" name="Baden-Württemberg"/> + <iso_3166_2_entry + code="DE-BY" name="Bayern"/> + <iso_3166_2_entry + code="DE-HB" name="Bremen"/> + <iso_3166_2_entry + code="DE-HH" name="Hamburg"/> + <iso_3166_2_entry + code="DE-HE" name="Hessen"/> + <iso_3166_2_entry + code="DE-NI" name="Niedersachsen"/> + <iso_3166_2_entry + code="DE-NW" name="Nordrhein-Westfalen"/> + <iso_3166_2_entry + code="DE-RP" name="Rheinland-Pfalz"/> + <iso_3166_2_entry + code="DE-SL" name="Saarland"/> + <iso_3166_2_entry + code="DE-SH" name="Schleswig-Holstein"/> + <iso_3166_2_entry + code="DE-BE" name="Berlin"/> + <iso_3166_2_entry + code="DE-BB" name="Brandenburg"/> + <iso_3166_2_entry + code="DE-MV" name="Mecklenburg-Vorpommern"/> + <iso_3166_2_entry + code="DE-SN" name="Sachsen"/> + <iso_3166_2_entry + code="DE-ST" name="Sachsen-Anhalt"/> + <iso_3166_2_entry + code="DE-TH" name="Thüringen"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Austria --> + <iso_3166_country code="AT"> + <iso_3166_subset type="State"> + <iso_3166_2_entry + code="AT-1" name="Burgenland"/> + <iso_3166_2_entry + code="AT-2" name="Kärnten"/> + <iso_3166_2_entry + code="AT-3" name="Niederösterreich"/> + <iso_3166_2_entry + code="AT-4" name="Oberösterreich"/> + <iso_3166_2_entry + code="AT-5" name="Salzburg"/> + <iso_3166_2_entry + code="AT-6" name="Steiermark"/> + <iso_3166_2_entry + code="AT-7" name="Tirol"/> + <iso_3166_2_entry + code="AT-8" name="Vorarlberg"/> + <iso_3166_2_entry + code="AT-9" name="Wien"/> + </iso_3166_subset> + </iso_3166_country> + <!-- Switzerland --> + <iso_3166_country code="CH"> + <iso_3166_subset type="Canton"> + <iso_3166_2_entry + code="CH-AG" name="Aargau"/> + <iso_3166_2_entry + code="CH-AI" name="Appenzell Innerrhoden"/> + <iso_3166_2_entry + code="CH-AR" name="Appenzell Ausserrhoden"/> + <iso_3166_2_entry + code="CH-BE" name="Bern"/> + <iso_3166_2_entry + code="CH-BL" name="Basel-Landschaft"/> + <iso_3166_2_entry + code="CH-BS" name="Basel-Stadt"/> + <iso_3166_2_entry + code="CH-FR" name="Fribourg"/> + <iso_3166_2_entry + code="CH-GE" name="Genève"/> + <iso_3166_2_entry + code="CH-GL" name="Glarus"/> + <iso_3166_2_entry + code="CH-GR" name="Graubünden"/> + <iso_3166_2_entry + code="CH-JU" name="Jura"/> + <iso_3166_2_entry + code="CH-LU" name="Luzern"/> + <iso_3166_2_entry + code="CH-NE" name="Neuchâtel"/> + <iso_3166_2_entry + code="CH-NW" name="Nidwalden"/> + <iso_3166_2_entry + code="CH-OW" name="Obwalden"/> + <iso_3166_2_entry + code="CH-SG" name="Sankt Gallen"/> + <iso_3166_2_entry + code="CH-SH" name="Schaffhausen"/> + <iso_3166_2_entry + code="CH-SO" name="Solothurn"/> + <iso_3166_2_entry + code="CH-SZ" name="Schwyz"/> + <iso_3166_2_entry + code="CH-TG" name="Thurgau"/> + <iso_3166_2_entry + code="CH-TI" name="Ticino"/> + <iso_3166_2_entry + code="CH-UR" name="Uri"/> + <iso_3166_2_entry + code="CH-VD" name="Vaud"/> + <iso_3166_2_entry + code="CH-VS" name="Valais"/> + <iso_3166_2_entry + code="CH-ZG" name="Zug"/> + <iso_3166_2_entry + code="CH-ZH" name="Zürich"/> + </iso_3166_subset> + </iso_3166_country> </iso_3166_2_entries> From 3e50cc780e32caadd5558616045f18d3e0f2a89a Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Tue, 22 Mar 2016 09:52:34 +0100 Subject: [PATCH 62/96] #366: model wrapper has a method to update all default values to the current model values so that subsequent reset calls will reset all values to the current model values. --- .../mvvmfx/utils/mapping/ModelWrapper.java | 87 +++++--- .../utils/mapping/ModelWrapperTest.java | 188 +++++++++++------- 2 files changed, 171 insertions(+), 104 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index faa05b93c..a6400acd7 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -15,18 +15,6 @@ ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.BiConsumer; -import java.util.function.Function; -import java.util.function.Supplier; - import de.saxsys.mvvmfx.utils.mapping.accessorfunctions.BooleanGetter; import de.saxsys.mvvmfx.utils.mapping.accessorfunctions.BooleanPropertyAccessor; import de.saxsys.mvvmfx.utils.mapping.accessorfunctions.BooleanSetter; @@ -51,6 +39,20 @@ import de.saxsys.mvvmfx.utils.mapping.accessorfunctions.StringGetter; import de.saxsys.mvvmfx.utils.mapping.accessorfunctions.StringPropertyAccessor; import de.saxsys.mvvmfx.utils.mapping.accessorfunctions.StringSetter; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.function.Supplier; + import eu.lestard.doc.Beta; import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; @@ -252,8 +254,7 @@ public class ModelWrapper<M> { private final ReadOnlyBooleanWrapper dirtyFlag = new ReadOnlyBooleanWrapper(); private final ReadOnlyBooleanWrapper diffFlag = new ReadOnlyBooleanWrapper(); - - + /** * This interface defines the operations that are possible for each field of a wrapped class. * @@ -271,14 +272,16 @@ private interface PropertyField<T, M, R extends Property<T>> { void reload(M wrappedObject); void resetToDefault(); - + + void updateDefault(final M wrappedObject); + R getProperty(); - + /** * Determines if the value in the model object and the property field are different or not. - * + * * This method is used to implement the {@link #differentProperty()} flag. - * + * * @param wrappedObject * the wrapped model object * @return <code>false</code> if both the wrapped model object and the property field have the same value, @@ -295,7 +298,7 @@ private interface PropertyField<T, M, R extends Property<T>> { */ private class FxPropertyField<T, R extends Property<T>> implements PropertyField<T, M, R> { - private final T defaultValue; + private T defaultValue; private final Function<M, Property<T>> accessor; private final R targetProperty; @@ -327,7 +330,12 @@ public void reload(M wrappedObject) { public void resetToDefault() { targetProperty.setValue(defaultValue); } - + + @Override + public void updateDefault(final M wrappedObject) { + defaultValue = accessor.apply(wrappedObject).getValue(); + } + @Override public R getProperty() { return targetProperty; @@ -351,7 +359,7 @@ public boolean isDifferent(M wrappedObject) { private class BeanPropertyField<T, R extends Property<T>> implements PropertyField<T, M, R> { private final R targetProperty; - private final T defaultValue; + private T defaultValue; private final Function<M, T> getter; private final BiConsumer<M, T> setter; @@ -385,7 +393,12 @@ public void reload(M wrappedObject) { public void resetToDefault() { targetProperty.setValue(defaultValue); } - + + @Override + public void updateDefault(final M wrappedObject) { + defaultValue = getter.apply(wrappedObject); + } + @Override public R getProperty() { return targetProperty; @@ -411,7 +424,7 @@ public boolean isDifferent(M wrappedObject) { private class FxListPropertyField<E, T extends ObservableList<E>, R extends Property<T>> implements PropertyField<T, M, R> { - private final List<E> defaultValue; + private List<E> defaultValue; private final ListPropertyAccessor<M, E> accessor; private final ListProperty<E> targetProperty = new SimpleListProperty<>(FXCollections.observableArrayList()); @@ -440,7 +453,12 @@ public void reload(M wrappedObject) { public void resetToDefault() { targetProperty.setAll(defaultValue); } - + + @Override + public void updateDefault(final M wrappedObject) { + defaultValue = new ArrayList<>(accessor.apply(wrappedObject).getValue()); + } + @Override public R getProperty() { return (R) targetProperty; @@ -470,7 +488,7 @@ private class BeanListPropertyField<E, T extends ObservableList<E>, R extends Pr private final ListGetter<M, E> getter; private final ListSetter<M, E> setter; - private final List<E> defaultValue; + private List<E> defaultValue; private final ListProperty<E> targetProperty = new SimpleListProperty<>(FXCollections.observableArrayList()); public BeanListPropertyField(ListGetter<M, E> getter, ListSetter<M, E> setter) { @@ -499,7 +517,12 @@ public void reload(M wrappedObject) { public void resetToDefault() { targetProperty.setAll(defaultValue); } - + + @Override + public void updateDefault(final M wrappedObject) { + defaultValue = new ArrayList<>(getter.apply(wrappedObject)); + } + @Override public R getProperty() { return (R) targetProperty; @@ -567,7 +590,17 @@ public void reset() { calculateDifferenceFlag(); } - + + /** + * Loads values from wrapped object again and sets the current value s default. Subsequent calls to {@link #reset()} + * will rest the values to this new default. + */ + public void updateDefaults() { + for (final PropertyField<?, M, ?> field : fields) { + field.updateDefault(model); + } + } + /** * Take the current value of each property field and write it into the wrapped model element. * <p> diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java index d96a3639d..909f3b4d4 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java @@ -15,220 +15,221 @@ ******************************************************************************/ package de.saxsys.mvvmfx.utils.mapping; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +import java.util.Arrays; + import javafx.beans.property.IntegerProperty; import javafx.beans.property.ListProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; -import org.junit.Test; -import java.util.Arrays; +public class ModelWrapperTest { -import static org.assertj.core.api.Assertions.assertThat; -public class ModelWrapperTest { - - @Test public void testWithGetterAndSetter() { Person person = new Person(); person.setName("horst"); person.setAge(32); person.setNicknames(Arrays.asList("captain")); - + ModelWrapper<Person> personWrapper = new ModelWrapper<>(person); - + final StringProperty nameProperty = personWrapper.field(Person::getName, Person::setName); final IntegerProperty ageProperty = personWrapper.field(Person::getAge, Person::setAge); final ListProperty<String> nicknamesProperty = personWrapper.field(Person::getNicknames, Person::setNicknames); - + assertThat(nameProperty.getValue()).isEqualTo("horst"); assertThat(ageProperty.getValue()).isEqualTo(32); assertThat(nicknamesProperty.getValue()).containsOnly("captain"); - - + + nameProperty.setValue("hugo"); ageProperty.setValue(33); nicknamesProperty.add("player"); - + // still the old values assertThat(person.getName()).isEqualTo("horst"); assertThat(person.getAge()).isEqualTo(32); assertThat(person.getNicknames()).containsOnly("captain"); - - + + personWrapper.commit(); - + // now the new values are reflected in the wrapped person assertThat(person.getName()).isEqualTo("hugo"); assertThat(person.getAge()).isEqualTo(33); assertThat(person.getNicknames()).containsOnly("captain", "player"); - - - + + + nameProperty.setValue("luise"); ageProperty.setValue(15); nicknamesProperty.setValue(FXCollections.observableArrayList("student")); - + personWrapper.reset(); - + assertThat(nameProperty.getValue()).isEqualTo(null); assertThat(ageProperty.getValue()).isEqualTo(0); assertThat(nicknamesProperty.getValue().size()).isEqualTo(0); - + // the wrapped object has still the values from the last commit. assertThat(person.getName()).isEqualTo("hugo"); assertThat(person.getAge()).isEqualTo(33); assertThat(person.getNicknames()).containsOnly("captain", "player"); - - + + personWrapper.reload(); // now the properties have the values from the wrapped object assertThat(nameProperty.getValue()).isEqualTo("hugo"); assertThat(ageProperty.getValue()).isEqualTo(33); assertThat(nicknamesProperty.get()).containsOnly("captain", "player"); - - + + Person otherPerson = new Person(); otherPerson.setName("gisela"); otherPerson.setAge(23); otherPerson.setNicknames(Arrays.asList("referee")); - + personWrapper.set(otherPerson); personWrapper.reload(); - + assertThat(nameProperty.getValue()).isEqualTo("gisela"); assertThat(ageProperty.getValue()).isEqualTo(23); assertThat(nicknamesProperty.getValue()).containsOnly("referee"); - + nameProperty.setValue("georg"); ageProperty.setValue(24); nicknamesProperty.setValue(FXCollections.observableArrayList("spectator")); - + personWrapper.commit(); - + // old person has still the old values assertThat(person.getName()).isEqualTo("hugo"); assertThat(person.getAge()).isEqualTo(33); assertThat(person.getNicknames()).containsOnly("captain", "player"); - + // new person has the new values assertThat(otherPerson.getName()).isEqualTo("georg"); assertThat(otherPerson.getAge()).isEqualTo(24); assertThat(otherPerson.getNicknames()).containsOnly("spectator"); - + } - - + + @Test public void testWithJavaFXPropertiesField() { PersonFX person = new PersonFX(); person.setName("horst"); person.setAge(32); person.setNicknames(Arrays.asList("captain")); - + ModelWrapper<PersonFX> personWrapper = new ModelWrapper<>(person); - - + + final StringProperty nameProperty = personWrapper.field(PersonFX::nameProperty); final IntegerProperty ageProperty = personWrapper.field(PersonFX::ageProperty); final ListProperty<String> nicknamesProperty = personWrapper.field(PersonFX::nicknamesProperty); - + assertThat(nameProperty.getValue()).isEqualTo("horst"); assertThat(ageProperty.getValue()).isEqualTo(32); assertThat(nicknamesProperty.getValue()).containsOnly("captain"); - - + + nameProperty.setValue("hugo"); ageProperty.setValue(33); nicknamesProperty.add("player"); - + // still the old values assertThat(person.getName()).isEqualTo("horst"); assertThat(person.getAge()).isEqualTo(32); assertThat(person.getNicknames()).containsOnly("captain"); - - + + personWrapper.commit(); - + // now the new values are reflected in the wrapped person assertThat(person.getName()).isEqualTo("hugo"); assertThat(person.getAge()).isEqualTo(33); assertThat(person.getNicknames()).containsOnly("captain", "player"); - - - + + + nameProperty.setValue("luise"); ageProperty.setValue(15); nicknamesProperty.setValue(FXCollections.observableArrayList("student")); - + personWrapper.reset(); - + assertThat(nameProperty.getValue()).isEqualTo(null); assertThat(ageProperty.getValue()).isEqualTo(0); assertThat(nicknamesProperty.getValue()).isEmpty(); - + // the wrapped object has still the values from the last commit. assertThat(person.getName()).isEqualTo("hugo"); assertThat(person.getAge()).isEqualTo(33); assertThat(person.getNicknames()).containsOnly("captain", "player"); - - + + personWrapper.reload(); // now the properties have the values from the wrapped object assertThat(nameProperty.getValue()).isEqualTo("hugo"); assertThat(ageProperty.getValue()).isEqualTo(33); assertThat(nicknamesProperty.get()).containsOnly("captain", "player"); - - + + PersonFX otherPerson = new PersonFX(); otherPerson.setName("gisela"); otherPerson.setAge(23); otherPerson.setNicknames(Arrays.asList("referee")); - + personWrapper.set(otherPerson); personWrapper.reload(); - + assertThat(nameProperty.getValue()).isEqualTo("gisela"); assertThat(ageProperty.getValue()).isEqualTo(23); assertThat(nicknamesProperty.get()).containsOnly("referee"); - + nameProperty.setValue("georg"); ageProperty.setValue(24); nicknamesProperty.setValue(FXCollections.observableArrayList("spectator")); - + personWrapper.commit(); - + // old person has still the old values assertThat(person.getName()).isEqualTo("hugo"); assertThat(person.getAge()).isEqualTo(33); assertThat(person.getNicknames()).containsOnly("captain", "player"); - + // new person has the new values assertThat(otherPerson.getName()).isEqualTo("georg"); assertThat(otherPerson.getAge()).isEqualTo(24); } - + @Test public void testIdentifiedFields() { Person person = new Person(); person.setName("horst"); person.setAge(32); person.setNicknames(Arrays.asList("captain")); - + ModelWrapper<Person> personWrapper = new ModelWrapper<>(); - + final StringProperty nameProperty = personWrapper.field("name", Person::getName, Person::setName); final IntegerProperty ageProperty = personWrapper.field("age", Person::getAge, Person::setAge); final ListProperty<String> nicknamesProperty = personWrapper.field("nicknames", Person::getNicknames, Person::setNicknames); - - + + final StringProperty nameProperty2 = personWrapper.field("name", Person::getName, Person::setName); final IntegerProperty ageProperty2 = personWrapper.field("age", Person::getAge, Person::setAge); final ListProperty<String> nicknamesProperty2 = personWrapper.field("nicknames", Person::getNicknames, Person::setNicknames); - - + + assertThat(nameProperty).isSameAs(nameProperty2); assertThat(ageProperty).isSameAs(ageProperty2); assertThat(nicknamesProperty).isSameAs(nicknamesProperty2); @@ -407,17 +408,17 @@ public void testDifferentFlag() { nicknames.add("captain"); // duplicate captain assertThat(personWrapper.isDifferent()).isTrue(); - + person.getNicknames().add("captain"); // now both have 2x "captain" but the modelWrapper has no chance to realize this change in the model element... // ... for this reason the different flag will still be true assertThat(personWrapper.isDifferent()).isTrue(); - + // ... but if we add another value to the nickname-Property, the modelWrapper can react to this change person.getNicknames().add("other"); nicknames.add("other"); assertThat(personWrapper.isDifferent()).isFalse(); - - + + nicknames.add("player"); assertThat(personWrapper.isDifferent()).isTrue(); @@ -478,7 +479,7 @@ public void testDifferentFlagWithFxProperties() { nicknames.add("captain"); assertThat(personWrapper.isDifferent()).isFalse(); - + person.getNicknames().add("captain"); // duplicate value nicknames.add("captain"); assertThat(personWrapper.isDifferent()).isFalse(); @@ -488,13 +489,13 @@ public void testDifferentFlagWithFxProperties() { person.getNicknames().add("player"); assertThat(personWrapper.isDifferent()).isTrue(); // still true because the modelWrapper can't detect the change in the model - + person.setName("luise"); name.set("luise"); // this triggers the recalculation of the different-flag which will now detect the previous change to the nicknames list assertThat(personWrapper.isDifferent()).isFalse(); - - - + + + nicknames.setValue(FXCollections.observableArrayList("spectator")); assertThat(personWrapper.isDifferent()).isTrue(); @@ -514,7 +515,40 @@ public void testDifferentFlagWithFxProperties() { assertThat(personWrapper.isDifferent()).isTrue(); } + @Test + public void defaultValuesCanBeUpdatedToCurrentValues(){ + final Person person = new Person(); + person.setName("horst"); + person.setAge(32); + person.setNicknames(Arrays.asList("captain")); + + final ModelWrapper<Person> cut = new ModelWrapper<>(person); + + final StringProperty nameField = cut.field(Person::getName, Person::setName, person.getName()); + nameField.set("test"); + cut.commit(); + cut.updateDefaults(); + cut.reset(); + assertThat(person.getName()).isEqualTo("test"); + assertThat(nameField.get()).isEqualTo("test"); + + final IntegerProperty ageField = cut.field(Person::getAge, Person::setAge, person.getAge()); + ageField.set(42); + cut.commit(); + cut.updateDefaults(); + cut.reset(); + assertThat(person.getAge()).isEqualTo(42); + assertThat(ageField.get()).isEqualTo(42); + + final ListProperty<String> nicknames = cut.field(Person::getNicknames, Person::setNicknames, person.getNicknames()); + nicknames.add("myname"); + nicknames.remove("captain"); + cut.commit(); + cut.updateDefaults(); + cut.reset(); + assertThat(person.getNicknames()).containsExactly("myname"); + assertThat(nicknames.get()).containsExactly("myname"); + } - } From 94e7ac1309e148da8cdd5af4145b0fb74910143c Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Tue, 22 Mar 2016 10:00:41 +0100 Subject: [PATCH 63/96] #366: typos --- .../java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index a6400acd7..7044184f9 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -592,8 +592,8 @@ public void reset() { } /** - * Loads values from wrapped object again and sets the current value s default. Subsequent calls to {@link #reset()} - * will rest the values to this new default. + * Loads values from wrapped object again and sets the current value as default. Subsequent calls to {@link #reset()} + * will reset the values to this new default. */ public void updateDefaults() { for (final PropertyField<?, M, ?> field : fields) { From 471ad8cb781534e2173c9333230f3dd313a6a1ea Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 22 Mar 2016 11:22:19 +0100 Subject: [PATCH 64/96] Renamed the new method and extended Javadoc --- .../mvvmfx/utils/mapping/ModelWrapper.java | 40 +++++++++++++++++-- .../utils/mapping/ModelWrapperTest.java | 7 ++-- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index 7044184f9..390bd606e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -592,10 +592,44 @@ public void reset() { } /** - * Loads values from wrapped object again and sets the current value as default. Subsequent calls to {@link #reset()} - * will reset the values to this new default. + * Use all values that are currently present in the wrapped model object as new default values for respective field. + * This overrides/updates the values that were set during the initialization of the field mappings. + * <p> + * Subsequent calls to {@link #reset()} will reset the values to this new default values. + * <p> + * Usage example: + * <pre> + * ModelWrapper{@code<Person>} wrapper = new ModelWrapper{@code<>}(); + * + * wrapper.field(Person::getName, Person::setName, "oldDefault"); + * + * Person p = new Person(); + * wrapper.set(p); + * + * + * p.setName("Luise"); + * + * wrapper.useCurrentValuesAsDefaults(); // now "Luise" is the default value for the name field. + * + * + * name.set("Hugo"); + * wrapper.commit(); + * + * name.get(); // Hugo + * p.getName(); // Hugo + * + * + * wrapper.reset(); // reset to the new defaults + * name.get(); // Luise + * + * wrapper.commit(); // put values from properties to the wrapped model object + * p.getName(); // Luise + * + * + * </pre> + * */ - public void updateDefaults() { + public void useCurrentValuesAsDefaults() { for (final PropertyField<?, M, ?> field : fields) { field.updateDefault(model); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java index 909f3b4d4..c08768ee2 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java @@ -527,7 +527,7 @@ public void defaultValuesCanBeUpdatedToCurrentValues(){ final StringProperty nameField = cut.field(Person::getName, Person::setName, person.getName()); nameField.set("test"); cut.commit(); - cut.updateDefaults(); + cut.useCurrentValuesAsDefaults(); cut.reset(); assertThat(person.getName()).isEqualTo("test"); assertThat(nameField.get()).isEqualTo("test"); @@ -535,7 +535,7 @@ public void defaultValuesCanBeUpdatedToCurrentValues(){ final IntegerProperty ageField = cut.field(Person::getAge, Person::setAge, person.getAge()); ageField.set(42); cut.commit(); - cut.updateDefaults(); + cut.useCurrentValuesAsDefaults(); cut.reset(); assertThat(person.getAge()).isEqualTo(42); assertThat(ageField.get()).isEqualTo(42); @@ -544,11 +544,10 @@ public void defaultValuesCanBeUpdatedToCurrentValues(){ nicknames.add("myname"); nicknames.remove("captain"); cut.commit(); - cut.updateDefaults(); + cut.useCurrentValuesAsDefaults(); cut.reset(); assertThat(person.getNicknames()).containsExactly("myname"); assertThat(nicknames.get()).containsExactly("myname"); } - } From 35106121b322229aa02f4394f971871385e4bad5 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 22 Mar 2016 17:19:15 +0100 Subject: [PATCH 65/96] add equals and hashcode to ValidationMessage class. #364 --- mvvmfx/pom.xml | 6 +++++ .../utils/validation/ValidationMessage.java | 26 +++++++++++++++++-- pom.xml | 7 +++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/mvvmfx/pom.xml b/mvvmfx/pom.xml index 338ffd2b1..d6e536132 100644 --- a/mvvmfx/pom.xml +++ b/mvvmfx/pom.xml @@ -87,6 +87,12 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>nl.jqno.equalsverifier</groupId> + <artifactId>equalsverifier</artifactId> + <scope>test</scope> + </dependency> + </dependencies> diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java index 8eb42060b..842a6e229 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/validation/ValidationMessage.java @@ -15,6 +15,8 @@ ******************************************************************************/ package de.saxsys.mvvmfx.utils.validation; +import java.util.Objects; + /** * This class represents a single validation message for an error or a warning. It consists of a string message and a * {@link Severity}. @@ -28,8 +30,8 @@ public class ValidationMessage { private final Severity severity; public ValidationMessage(Severity severity, String message) { - this.message = message; - this.severity = severity; + this.severity = Objects.requireNonNull(severity); + this.message = Objects.requireNonNull(message); } @@ -56,4 +58,24 @@ public String toString() { ", severity=" + severity + '}'; } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || !(o instanceof ValidationMessage)) + return false; + + ValidationMessage that = (ValidationMessage) o; + + return message.equals(that.message) && severity == that.severity; + + } + + @Override + public int hashCode() { + int result = message.hashCode(); + result = 31 * result + severity.hashCode(); + return result; + } } diff --git a/pom.xml b/pom.xml index 4fd035463..60d1ddbf5 100644 --- a/pom.xml +++ b/pom.xml @@ -207,6 +207,13 @@ <artifactId>logback-classic</artifactId> <version>1.1.3</version> </dependency> + + <dependency> + <groupId>nl.jqno.equalsverifier</groupId> + <artifactId>equalsverifier</artifactId> + <version>2.0.1</version> + </dependency> + </dependencies> </dependencyManagement> From c7206b512a74458ffe1060429a98a6ba5efd5560 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Thu, 24 Mar 2016 14:50:43 +0100 Subject: [PATCH 66/96] Add Test for equals and hashcode method of ValidationMessage class --- .../validation/ValidationMessageTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationMessageTest.java diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationMessageTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationMessageTest.java new file mode 100644 index 000000000..d0e7abd12 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/validation/ValidationMessageTest.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright 2015 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ +package de.saxsys.mvvmfx.utils.validation; + +import nl.jqno.equalsverifier.EqualsVerifier; +import nl.jqno.equalsverifier.Warning; +import org.junit.Test; + +public class ValidationMessageTest { + + /** + * Verify that the {@link ValidationMessage} class implements the + * {@link Object#equals(Object)} and {@link Object#hashCode()} methods + * correctly. + */ + @Test + public void testEqualsAndHashcode() { + + EqualsVerifier.forClass(ValidationMessage.class) + .suppress(Warning.STRICT_INHERITANCE) // others can create subclasses but it's their task to properly override equals and hashcode + .suppress(Warning.NULL_FIELDS) // class is immutable and checks arguments for non-null in the constructor + .verify(); + + } + +} From 355394964390dad717776de4701876144b0d5d77 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Thu, 24 Mar 2016 16:44:42 +0100 Subject: [PATCH 67/96] make DefaultNotificationCenter public and show in a test case how to reset notification centers --- .../DefaultNotificationCenter.java | 2 +- .../ResetNotificationCenterTest.java | 86 +++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ResetNotificationCenterTest.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java index 674bfd2c4..17d3aa111 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java @@ -30,7 +30,7 @@ * @author sialcasa * */ -class DefaultNotificationCenter implements NotificationCenter { +public class DefaultNotificationCenter implements NotificationCenter { private static final Logger LOG = LoggerFactory.getLogger(DefaultNotificationCenter.class); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ResetNotificationCenterTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ResetNotificationCenterTest.java new file mode 100644 index 000000000..235dd9165 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ResetNotificationCenterTest.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright 2016 Alexander Casall, Manuel Mauky + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ +package de.saxsys.mvvmfx.utils.notifications; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.junit.Assert.fail; + +/** + * This test case is used to see how you can reset the notification center + * for unit tests. + * + * In this example we have two test cases that both are publishing the same message key. + * However in the setup method we are defining a subscriber for this message key that will fail when it is called more then once. + * + * To get this tests green we need to reset the notification center for each test so that each test has a fresh notification center instance. + * This is done in the tearDown method. + * + */ +public class ResetNotificationCenterTest { + + + private static final String MY_MESSAGE = "myMessage"; + private AtomicBoolean wasCalled = new AtomicBoolean(false); + + @Before + public void setup() { + NotificationCenter notificationCenter = NotificationCenterFactory.getNotificationCenter(); + + notificationCenter.subscribe(MY_MESSAGE, (key, payload) -> { + if(wasCalled.get()) { + fail("subsciber is called more then once"); + } else { + wasCalled.set(true); + } + }); + } + + + /** + * This is the important part. If we wouldn't replace the notification center instance, + * one of the test cases would fail. + * By replacing the instance we assure that each test uses a fresh notification center. + */ + @After + public void tearDown() { + + NotificationCenterFactory.setNotificationCenter(new DefaultNotificationCenter()); + + } + + + @Test + public void testOne() { + + NotificationCenter notificationCenter = NotificationCenterFactory.getNotificationCenter(); + + notificationCenter.publish(MY_MESSAGE); + + } + + @Test + public void testTwo() { + + NotificationCenter notificationCenter = NotificationCenterFactory.getNotificationCenter(); + + notificationCenter.publish(MY_MESSAGE); + } +} From 2243f76fc9638e912a5e3b8008c92062ff5be266 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Fri, 1 Apr 2016 16:14:51 +0200 Subject: [PATCH 68/96] move fxml files of big examples into java packages and add maven configuration for this resources change --- examples/books-example/pom.xml | 9 +++++++++ .../mvvmfx/examples/books/BookListItemView.fxml | 0 .../de/saxsys/mvvmfx/examples/books/MainView.fxml | 0 .../de/saxsys/mvvmfx/examples/books/style.css | 0 examples/contacts-example/pom.xml | 7 +++++++ .../examples/contacts/ui/about/AboutAuthorView.fxml | 0 .../examples/contacts/ui/about/AboutView.fxml | 0 .../examples/contacts/ui/about/profile_manuel.png | Bin .../ui/addcontact/AddContactDialogView.fxml | 0 .../contacts/ui/addressform/AddressFormView.fxml | 0 .../ui/contactdialog/ContactDialogView.fxml | 0 .../contacts/ui/contactform/ContactFormView.fxml | 0 .../examples/contacts/ui/detail/DetailView.fxml | 0 .../ui/editcontact/EditContactDialogView.fxml | 0 .../mvvmfx/examples/contacts/ui/main/MainView.fxml | 0 .../examples/contacts/ui/master/MasterView.fxml | 0 .../mvvmfx/examples/contacts/ui/menu/MenuView.fxml | 0 .../examples/contacts/ui/toolbar/ToolbarView.fxml | 0 examples/todomvc-example/pom.xml | 9 +++++++++ .../saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml | 0 .../examples/todomvc/ui/additems/AddItemsView.fxml | 0 .../examples/todomvc/ui/additems/additems.css | 0 .../examples/todomvc/ui/controls/ControlsView.fxml | 0 .../examples/todomvc/ui/item/ItemOverviewView.fxml | 0 .../mvvmfx/examples/todomvc/ui/item/ItemView.fxml | 0 .../mvvmfx/examples/todomvc/ui/item/itemview.css | 0 .../de/saxsys/mvvmfx/examples/todomvc/ui/main.css | 0 27 files changed, 25 insertions(+) rename examples/books-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/books/BookListItemView.fxml (100%) rename examples/books-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/books/MainView.fxml (100%) rename examples/books-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/books/style.css (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/about/profile_manuel.png (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml (100%) rename examples/contacts-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/additems/additems.css (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/item/itemview.css (100%) rename examples/todomvc-example/src/main/{resources => java}/de/saxsys/mvvmfx/examples/todomvc/ui/main.css (100%) diff --git a/examples/books-example/pom.xml b/examples/books-example/pom.xml index 522fac64d..d7630f618 100644 --- a/examples/books-example/pom.xml +++ b/examples/books-example/pom.xml @@ -17,6 +17,15 @@ <maven.compiler.target>1.8</maven.compiler.target> </properties> + <!-- use resource files (fxml, css) from the java directory --> + <build> + <resources> + <resource> + <directory>src/main/java</directory> + </resource> + </resources> + </build> + <dependencies> <dependency> <groupId>de.saxsys</groupId> diff --git a/examples/books-example/src/main/resources/de/saxsys/mvvmfx/examples/books/BookListItemView.fxml b/examples/books-example/src/main/java/de/saxsys/mvvmfx/examples/books/BookListItemView.fxml similarity index 100% rename from examples/books-example/src/main/resources/de/saxsys/mvvmfx/examples/books/BookListItemView.fxml rename to examples/books-example/src/main/java/de/saxsys/mvvmfx/examples/books/BookListItemView.fxml diff --git a/examples/books-example/src/main/resources/de/saxsys/mvvmfx/examples/books/MainView.fxml b/examples/books-example/src/main/java/de/saxsys/mvvmfx/examples/books/MainView.fxml similarity index 100% rename from examples/books-example/src/main/resources/de/saxsys/mvvmfx/examples/books/MainView.fxml rename to examples/books-example/src/main/java/de/saxsys/mvvmfx/examples/books/MainView.fxml diff --git a/examples/books-example/src/main/resources/de/saxsys/mvvmfx/examples/books/style.css b/examples/books-example/src/main/java/de/saxsys/mvvmfx/examples/books/style.css similarity index 100% rename from examples/books-example/src/main/resources/de/saxsys/mvvmfx/examples/books/style.css rename to examples/books-example/src/main/java/de/saxsys/mvvmfx/examples/books/style.css diff --git a/examples/contacts-example/pom.xml b/examples/contacts-example/pom.xml index 4eaadcdae..b892859f1 100644 --- a/examples/contacts-example/pom.xml +++ b/examples/contacts-example/pom.xml @@ -27,8 +27,15 @@ </configuration> </plugin> </plugins> + + <resources> + <resource> + <directory>src/main/java</directory> + </resource> + </resources> </build> + <dependencies> <dependency> <groupId>de.saxsys</groupId> diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutAuthorView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/AboutView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/profile_manuel.png b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/profile_manuel.png similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/about/profile_manuel.png rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/about/profile_manuel.png diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addcontact/AddContactDialogView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/addressform/AddressFormView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactform/ContactFormView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/editcontact/EditContactDialogView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/master/MasterView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/menu/MenuView.fxml diff --git a/examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml similarity index 100% rename from examples/contacts-example/src/main/resources/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml rename to examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.fxml diff --git a/examples/todomvc-example/pom.xml b/examples/todomvc-example/pom.xml index dce3f747f..12806818d 100644 --- a/examples/todomvc-example/pom.xml +++ b/examples/todomvc-example/pom.xml @@ -11,6 +11,15 @@ <artifactId>todomvc-example</artifactId> + <!-- use resource files (fxml, css) from the java directory --> + <build> + <resources> + <resource> + <directory>src/main/java</directory> + </resource> + </resources> + </build> + <dependencies> <dependency> <groupId>de.saxsys</groupId> diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/MainView.fxml diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/AddItemsView.fxml diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/additems.css b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/additems.css similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/additems/additems.css rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/additems/additems.css diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/controls/ControlsView.fxml diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemOverviewView.fxml diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/ItemView.fxml diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/itemview.css b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/itemview.css similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/item/itemview.css rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/item/itemview.css diff --git a/examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/main.css b/examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/main.css similarity index 100% rename from examples/todomvc-example/src/main/resources/de/saxsys/mvvmfx/examples/todomvc/ui/main.css rename to examples/todomvc-example/src/main/java/de/saxsys/mvvmfx/examples/todomvc/ui/main.css From 18562ae95c2f8f74fa2902332cbfdf166ad562f2 Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Tue, 5 Apr 2016 15:11:20 +0200 Subject: [PATCH 69/96] #372: model wrapper uses property to store model instance and updates data when model instance changes --- .../mvvmfx/utils/mapping/ModelWrapper.java | 55 +++++++++++++------ .../utils/mapping/ModelWrapperTest.java | 35 +++++++++++- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index 7044184f9..b157ef841 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -540,9 +540,25 @@ public boolean isDifferent(M wrappedObject) { private final Set<PropertyField<?, M, ?>> fields = new HashSet<>(); private final Map<String, PropertyField<?, M, ?>> identifiedFields = new HashMap<>(); - private M model; - - + private ObjectProperty<M> model; + + + /** + * Create a new instance of {@link ModelWrapper} that wraps the instance of the Model class wrapped by the property. + * Updates all data when the model isntance changes. + * + * @param model + * the element of the model that will be wrapped. + */ + public ModelWrapper(ObjectProperty<M> model) { + this.model = model; + reload(); + this.model.addListener((observable, oldValue, newValue) -> { + reload(); + updateDefaults(); + }); + } + /** * Create a new instance of {@link ModelWrapper} that wraps the given instance of the Model class. * @@ -550,8 +566,7 @@ public boolean isDifferent(M wrappedObject) { * the element of the model that will be wrapped. */ public ModelWrapper(M model) { - set(model); - reload(); + this(new SimpleObjectProperty<M>(model)); } /** @@ -559,6 +574,7 @@ public ModelWrapper(M model) { * that should be wrapped afterwards with the {@link #set(Object)} method. */ public ModelWrapper() { + this(new SimpleObjectProperty<M>()); } /** @@ -568,16 +584,23 @@ public ModelWrapper() { * the element of the model that will be wrapped. */ public void set(M model) { - this.model = model; + this.model.set(model); } /** * @return the wrapped model element if one was defined, otherwise <code>null</code>. */ public M get() { + return model.get(); + } + + /** + * @return property holding the model instance wrapped by this model wrapper instance. + */ + public ObjectProperty<M> modelProperty() { return model; } - + /** * Resets all defined fields to their default values. If no default value was defined <code>null</code> will be used * instead. @@ -597,7 +620,7 @@ public void reset() { */ public void updateDefaults() { for (final PropertyField<?, M, ?> field : fields) { - field.updateDefault(model); + field.updateDefault(model.get()); } } @@ -610,8 +633,8 @@ public void updateDefaults() { * state of the wrapped model element. */ public void commit() { - if (model != null) { - fields.forEach(field -> field.commit(model)); + if (model.get() != null) { + fields.forEach(field -> field.commit(model.get())); dirtyFlag.set(false); @@ -628,8 +651,8 @@ public void commit() { * defined property fields. */ public void reload() { - if (model != null) { - fields.forEach(field -> field.reload(model)); + if (model.get() != null) { + fields.forEach(field -> field.reload(model.get())); dirtyFlag.set(false); calculateDifferenceFlag(); @@ -644,9 +667,9 @@ private void propertyWasChanged() { } private void calculateDifferenceFlag() { - if (model != null) { + if (model.get() != null) { final Optional<PropertyField<?, M, ?>> optional = fields.stream() - .filter(field -> field.isDifferent(model)) + .filter(field -> field.isDifferent(model.get())) .findAny(); diffFlag.set(optional.isPresent()); @@ -1140,8 +1163,8 @@ public <E> ListProperty<E> field(String identifier, ListPropertyAccessor<M, E> a private <T, R extends Property<T>> R add(PropertyField<T, M, R> field) { fields.add(field); - if (model != null) { - field.reload(model); + if (model.get() != null) { + field.reload(model.get()); } return field.getProperty(); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java index 909f3b4d4..47f9bfe11 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java @@ -23,6 +23,7 @@ import javafx.beans.property.IntegerProperty; import javafx.beans.property.ListProperty; +import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; @@ -550,5 +551,37 @@ public void defaultValuesCanBeUpdatedToCurrentValues(){ assertThat(nicknames.get()).containsExactly("myname"); } - + @Test + public void valuesShouldBeUpdatedWhenModelInstanceChanges() { + final Person person1 = new Person(); + person1.setName("horst"); + person1.setAge(32); + person1.setNicknames(Arrays.asList("captain")); + final Person person2 = new Person(); + person2.setName("dieter"); + person2.setAge(42); + person2.setNicknames(Arrays.asList("robin")); + + final SimpleObjectProperty<Person> modelProp = new SimpleObjectProperty<>(person1); + + final ModelWrapper<Person> cut = new ModelWrapper<>(modelProp); + + final StringProperty nameField = cut.field(Person::getName, Person::setName, person1.getName()); + final IntegerProperty ageField = cut.field(Person::getAge, Person::setAge, person1.getAge()); + final ListProperty<String> nicknames = cut.field(Person::getNicknames, Person::setNicknames, person1.getNicknames()); + + assertThat(nameField.get()).isEqualTo(person1.getName()); + assertThat(ageField.get()).isEqualTo(person1.getAge()); + assertThat(nicknames.get()).containsExactlyElementsOf(person1.getNicknames()); + + modelProp.set(person2); + assertThat(nameField.get()).isEqualTo(person2.getName()); + assertThat(ageField.get()).isEqualTo(person2.getAge()); + assertThat(nicknames.get()).containsExactlyElementsOf(person2.getNicknames()); + + cut.reset(); + assertThat(nameField.get()).isEqualTo(person2.getName()); + assertThat(ageField.get()).isEqualTo(person2.getAge()); + assertThat(nicknames.get()).containsExactlyElementsOf(person2.getNicknames()); + } } From 449306598f3dec4e29050ad3c051260981549e65 Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Tue, 5 Apr 2016 15:12:17 +0200 Subject: [PATCH 70/96] #372: typos --- .../java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index b157ef841..3aa3dd51e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -545,10 +545,10 @@ public boolean isDifferent(M wrappedObject) { /** * Create a new instance of {@link ModelWrapper} that wraps the instance of the Model class wrapped by the property. - * Updates all data when the model isntance changes. + * Updates all data when the model instance changes. * * @param model - * the element of the model that will be wrapped. + * the property of the model element that will be wrapped. */ public ModelWrapper(ObjectProperty<M> model) { this.model = model; From 6ada4c5c0025372eb40d8b9e432ab19f8435fc28 Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Tue, 5 Apr 2016 15:13:11 +0200 Subject: [PATCH 71/96] #372: refactoring --- .../java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index 3aa3dd51e..aa9d2598e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -540,7 +540,7 @@ public boolean isDifferent(M wrappedObject) { private final Set<PropertyField<?, M, ?>> fields = new HashSet<>(); private final Map<String, PropertyField<?, M, ?>> identifiedFields = new HashMap<>(); - private ObjectProperty<M> model; + private final ObjectProperty<M> model; /** @@ -566,7 +566,7 @@ public ModelWrapper(ObjectProperty<M> model) { * the element of the model that will be wrapped. */ public ModelWrapper(M model) { - this(new SimpleObjectProperty<M>(model)); + this(new SimpleObjectProperty<>(model)); } /** @@ -574,7 +574,7 @@ public ModelWrapper(M model) { * that should be wrapped afterwards with the {@link #set(Object)} method. */ public ModelWrapper() { - this(new SimpleObjectProperty<M>()); + this(new SimpleObjectProperty<>()); } /** From c3ff7302fc1ded0242d8fbb95bd9ec81fe6ce7a2 Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Tue, 5 Apr 2016 15:23:17 +0200 Subject: [PATCH 72/96] Merge branch 'develop' into 372_change_model_in_model_wrapper_instance Conflicts: mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapperTest.java --- .../main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index a42385778..be8aa5fc3 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -555,7 +555,7 @@ public ModelWrapper(ObjectProperty<M> model) { reload(); this.model.addListener((observable, oldValue, newValue) -> { reload(); - updateDefaults(); + useCurrentValuesAsDefaults(); }); } From f8d9a5dc82c09ce12361bd83ac30b32a86e1b9bf Mon Sep 17 00:00:00 2001 From: Denny Israel <denny.israel@saxsys.de> Date: Mon, 11 Apr 2016 09:12:39 +0200 Subject: [PATCH 73/96] 376: use LinkedHashSet to guarantee deterministic update order when committing or reloading --- .../java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java index 390bd606e..31a2a965b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java @@ -43,7 +43,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; @@ -537,7 +537,7 @@ public boolean isDifferent(M wrappedObject) { } } - private final Set<PropertyField<?, M, ?>> fields = new HashSet<>(); + private final Set<PropertyField<?, M, ?>> fields = new LinkedHashSet<>(); private final Map<String, PropertyField<?, M, ?>> identifiedFields = new HashMap<>(); private M model; From 21928c0cb10adc323995079c17b397979c3cddb3 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Mon, 18 Apr 2016 10:33:14 +0200 Subject: [PATCH 74/96] Removed private constructor of DefaultNotificationCenter #369 --- .../mvvmfx/utils/notifications/DefaultNotificationCenter.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java index 17d3aa111..a9af4e4ea 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java @@ -34,9 +34,6 @@ public class DefaultNotificationCenter implements NotificationCenter { private static final Logger LOG = LoggerFactory.getLogger(DefaultNotificationCenter.class); - DefaultNotificationCenter() { - } - private final ObserverMap globalObservers = new ObserverMap(); private final ChannelObserverMap channelObserverMap = new ChannelObserverMap(); From 01195077fa1a58b69da0e959b6eade45715190aa Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Fri, 29 Apr 2016 11:17:41 +0200 Subject: [PATCH 75/96] First Scope Concept implementation --- .../de/saxsys/mvvmfx/FluentViewLoader.java | 448 +++++++------ .../java/de/saxsys/mvvmfx/ScopeStore.java | 63 -- .../de/saxsys/mvvmfx/internal/Context.java | 42 ++ .../saxsys/mvvmfx/internal/InjectContext.java | 16 + .../internal/viewloader/FxmlViewLoader.java | 607 ++++++++++-------- .../internal/viewloader/JavaViewLoader.java | 331 +++++----- .../viewloader/ViewLoaderReflectionUtils.java | 601 +++++++++-------- .../{TestScope.java => TestScope1.java} | 2 +- .../viewloader/example/TestScope2.java | 5 + .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 77 +-- .../saxsys/mvvmfx/scopes/ScopedFxmlViewA.java | 10 +- .../saxsys/mvvmfx/scopes/ScopedFxmlViewB.java | 9 +- .../saxsys/mvvmfx/scopes/ScopedFxmlViewC.java | 38 ++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewD.java | 11 + .../mvvmfx/scopes/ScopedViewModelA.java | 51 +- .../mvvmfx/scopes/ScopedViewModelB.java | 53 +- .../mvvmfx/scopes/ScopedViewModelC.java | 12 + .../mvvmfx/scopes/ScopedViewModelD.java | 12 + .../saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml | 4 +- .../saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml | 4 + .../saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml | 6 + .../saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml | 6 + 22 files changed, 1291 insertions(+), 1117 deletions(-) delete mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java rename mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/{TestScope.java => TestScope1.java} (95%) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java index 9c9ad86a2..80ec1b96d 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java @@ -1,11 +1,12 @@ package de.saxsys.mvvmfx; +import java.util.ResourceBundle; + +import de.saxsys.mvvmfx.internal.Context; import de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader; import de.saxsys.mvvmfx.internal.viewloader.JavaViewLoader; import de.saxsys.mvvmfx.internal.viewloader.ResourceBundleManager; -import java.util.ResourceBundle; - /** * Fluent API for loading Views. <br> * @@ -34,224 +35,271 @@ * </pre> * * - * This class is implemented as a Step-Builder. You can choose between {@link FxmlView} and {@link JavaView} with the - * first method call. After that you will only get builder-methods that are suitable for the view type you have chosen. + * This class is implemented as a Step-Builder. You can choose between + * {@link FxmlView} and {@link JavaView} with the first method call. After that + * you will only get builder-methods that are suitable for the view type you + * have chosen. * * @author manuel.mauky */ public class FluentViewLoader { - - /** - * This class is the builder step to load a java based view. It is accessed from the {@link FluentViewLoader} with - * the method {@link FluentViewLoader#javaView(Class)}. - * - * @param <ViewType> - * the generic type of the View that should be loaded. This type has to implement - * {@link de.saxsys.mvvmfx.JavaView}. - * @param <ViewModelType> - * the generic type of the ViewModel. This type has to implement {@link de.saxsys.mvvmfx.ViewModel}. - */ - public static class JavaViewStep<ViewType extends JavaView<? extends ViewModelType>, ViewModelType extends ViewModel> { - - private Class<? extends ViewType> viewType; - private ResourceBundle resourceBundle; - - private ViewModelType viewModel; + + /** + * This class is the builder step to load a java based view. It is accessed + * from the {@link FluentViewLoader} with the method + * {@link FluentViewLoader#javaView(Class)}. + * + * @param <ViewType> + * the generic type of the View that should be loaded. This type + * has to implement {@link de.saxsys.mvvmfx.JavaView}. + * @param <ViewModelType> + * the generic type of the ViewModel. This type has to implement + * {@link de.saxsys.mvvmfx.ViewModel}. + */ + public static class JavaViewStep<ViewType extends JavaView<? extends ViewModelType>, ViewModelType extends ViewModel> { + + private final Class<? extends ViewType> viewType; + private ResourceBundle resourceBundle; + + private ViewModelType viewModel; private ViewType codeBehind; - - JavaViewStep(Class<? extends ViewType> viewType) { - this.viewType = viewType; - } + private Context context; + + JavaViewStep(Class<? extends ViewType> viewType) { + this.viewType = viewType; + } + + public JavaViewStep<ViewType, ViewModelType> context(Context context) { + this.context = context; + return this; + } + + /** + * Provide a {@link ResourceBundle} that is used while loading this + * view. Note: It is possible to provide a global application-wide + * resourceBundle via + * {@link MvvmFX#setGlobalResourceBundle(ResourceBundle)} method. + * + * If there is a global resourceBundle set it will be merged with the + * resourceBundle provided by this builder method. The resourceBundle + * provided by this method will have a higher priority then the global + * one which means that if there are duplicate keys, the values of the + * global resourceBundle will be overwritten and the values of this + * resourceBundle will be used. + * + * @param resourceBundle + * the resource bundle that is used while loading the view. + * @return this instance of the builder step. + */ + public JavaViewStep<ViewType, ViewModelType> resourceBundle(ResourceBundle resourceBundle) { + this.resourceBundle = resourceBundle; + return this; + } - /** - * Provide a {@link ResourceBundle} that is used while loading this view. - * Note: It is possible to provide a global application-wide resourceBundle via {@link MvvmFX#setGlobalResourceBundle(ResourceBundle)} method. - * - * If there is a global resourceBundle set it will be merged with the resourceBundle provided by this builder method. - * The resourceBundle provided by this method will have a higher priority then the global one which means that if there - * are duplicate keys, the values of the global resourceBundle will be overwritten and the values of this resourceBundle will be used. - * - * @param resourceBundle - * the resource bundle that is used while loading the view. - * @return this instance of the builder step. - */ - public JavaViewStep<ViewType, ViewModelType> resourceBundle(ResourceBundle resourceBundle) { - this.resourceBundle = resourceBundle; - return this; - } - - /** - * This param is used to define an existing viewModel instance to be used when loading the view.<br> - * - * A typical use case is when you like to have two or more views that are sharing the same viewModel. - * - * @param viewModel - * the viewModel instance that is used to load the java view. - * @return this instance of the builder step. - */ - public JavaViewStep<ViewType, ViewModelType> viewModel(ViewModelType viewModel) { - this.viewModel = viewModel; - return this; - } + /** + * This param is used to define an existing viewModel instance to be + * used when loading the view.<br> + * + * A typical use case is when you like to have two or more views that + * are sharing the same viewModel. + * + * @param viewModel + * the viewModel instance that is used to load the java view. + * @return this instance of the builder step. + */ + public JavaViewStep<ViewType, ViewModelType> viewModel(ViewModelType viewModel) { + this.viewModel = viewModel; + return this; + } /** - * This param is used to define an existing instance of the codeBehind class that is used instead of creating a - * new one while loading. <br> + * This param is used to define an existing instance of the codeBehind + * class that is used instead of creating a new one while loading. <br> * * This can be useful when creating custom controls. * * @param codeBehind - * the codeBehind instance that is used to load this java view. + * the codeBehind instance that is used to load this java + * view. * @return this instance of the builder step. */ public JavaViewStep<ViewType, ViewModelType> codeBehind(ViewType codeBehind) { this.codeBehind = codeBehind; return this; } - - /** - * The final step of the Fluent API. This method loads the view based on the given params. - * - * @return a view tuple containing the loaded view. - */ - public ViewTuple<ViewType, ViewModelType> load() { - JavaViewLoader javaViewLoader = new JavaViewLoader(); - - return javaViewLoader.loadJavaViewTuple(viewType, ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), viewModel, codeBehind); - } + /** + * The final step of the Fluent API. This method loads the view based on + * the given params. + * + * @return a view tuple containing the loaded view. + */ + public ViewTuple<ViewType, ViewModelType> load() { + JavaViewLoader javaViewLoader = new JavaViewLoader(); + + return javaViewLoader.loadJavaViewTuple(viewType, + ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), viewModel, codeBehind, + context); + } + + } + + /** + * This class is the builder step to load a fxml based view. It is accessed + * from the {@link FluentViewLoader} with the method + * {@link FluentViewLoader#fxmlView(Class)}. + * + * @param <ViewType> + * the generic type of the View that should be loaded. This type + * has to implement {@link de.saxsys.mvvmfx.FxmlView}. + * @param <ViewModelType> + * the generic type of the ViewModel. This type has to implement + * {@link de.saxsys.mvvmfx.ViewModel}. + */ + public static class FxmlViewStep<ViewType extends FxmlView<? extends ViewModelType>, ViewModelType extends ViewModel> { + + private final Class<? extends ViewType> viewType; + private ResourceBundle resourceBundle; + private Object root; + private ViewType codeBehind; + private ViewModelType viewModel; + private Context context; + + FxmlViewStep(Class<? extends ViewType> viewType) { + this.viewType = viewType; + } + + public FxmlViewStep<ViewType, ViewModelType> context(Context context) { + this.context = context; + return this; + } + + /** + * Provide a {@link ResourceBundle} that is used while loading this + * view. Note: It is possible to provide a global application-wide + * resourceBundle via + * {@link MvvmFX#setGlobalResourceBundle(ResourceBundle)} method. + * + * If there is a global resourceBundle set it will be merged with the + * resourceBundle provided by this builder method. The resourceBundle + * provided by this method will have a higher priority then the global + * one which means that if there are duplicate keys, the values of the + * global resourceBundle will be overwritten and the values of this + * resourceBundle will be used. + * + * @param resourceBundle + * the resource bundle that is used while loading the view. + * @return this instance of the builder step. + */ + public FxmlViewStep<ViewType, ViewModelType> resourceBundle(ResourceBundle resourceBundle) { + this.resourceBundle = resourceBundle; + return this; + } + + /** + * This param is used to define a JavaFX node that is used as the root + * element when loading the fxml file. <br> + * + * This can be useful when creating custom controls with the fx:root + * element. + * + * @param root + * the root element that is used to load the fxml file. + * @return this instance of the builder step. + */ + public FxmlViewStep<ViewType, ViewModelType> root(Object root) { + this.root = root; + return this; + } + + /** + * This param is used to define an existing instance of the codeBehind + * class that is used instead of creating a new one while loading. <br> + * + * This can be useful when creating custom controls with the fx:root + * element. + * + * @param codeBehind + * the codeBehind instance that is used to load the fxml + * file. + * @return this instance of the builder step. + */ + public FxmlViewStep<ViewType, ViewModelType> codeBehind(ViewType codeBehind) { + this.codeBehind = codeBehind; + return this; + } + + /** + * This param is used to define an existing viewModel instance to be + * used when loading the view.<br> + * + * A typical use case is when you like to have two or more views that + * are sharing the same viewModel. + * + * @param viewModel + * the viewModel instance that is used to load the fxml file. + * @return this instance of the builder step. + */ + public FxmlViewStep<ViewType, ViewModelType> viewModel(ViewModelType viewModel) { + this.viewModel = viewModel; + return this; + } + + /** + * The final step of the Fluent API. This method loads the view based on + * the given params. + * + * @return a view tuple containing the loaded view. + */ + public ViewTuple<ViewType, ViewModelType> load() { + FxmlViewLoader fxmlViewLoader = new FxmlViewLoader(); + + return fxmlViewLoader.loadFxmlViewTuple(viewType, + ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), codeBehind, root, viewModel, + context); + } + } + + /** + * This method is the entry point of the Fluent API to load a java based + * view. + * + * @param viewType + * the type of the view that should be loaded. + * @param <ViewType> + * the type of the View that should be loaded. This type has to + * implement {@link de.saxsys.mvvmfx.JavaView}. + * @param <ViewModelType> + * the type of the ViewModel. This type has to implement + * {@link de.saxsys.mvvmfx.ViewModel}. + * + * @return a builder step that can be further configured and then load the + * actual view. + */ + public static <ViewType extends JavaView<? extends ViewModelType>, ViewModelType extends ViewModel> JavaViewStep<ViewType, ViewModelType> javaView( + Class<? extends ViewType> viewType) { + return new JavaViewStep<>(viewType); + } + /** + * This method is the entry point of the Fluent API to load a fxml based + * View. + * + * @param viewType + * the type of the view that should be loaded. + * @param <ViewType> + * the generic type of the View that should be loaded. This type + * has to implement {@link de.saxsys.mvvmfx.FxmlView}. + * @param <ViewModelType> + * the generic type of the ViewModel. This type has to implement + * {@link de.saxsys.mvvmfx.ViewModel}. + * + * @return a builder step that can be further configured and then load the + * actual view. + */ + public static <ViewType extends FxmlView<? extends ViewModelType>, ViewModelType extends ViewModel> FxmlViewStep<ViewType, ViewModelType> fxmlView( + Class<? extends ViewType> viewType) { + return new FxmlViewStep<>(viewType); } - - /** - * This class is the builder step to load a fxml based view. It is accessed from the {@link FluentViewLoader} with - * the method {@link FluentViewLoader#fxmlView(Class)}. - * - * @param <ViewType> - * the generic type of the View that should be loaded. This type has to implement - * {@link de.saxsys.mvvmfx.FxmlView}. - * @param <ViewModelType> - * the generic type of the ViewModel. This type has to implement {@link de.saxsys.mvvmfx.ViewModel}. - */ - public static class FxmlViewStep<ViewType extends FxmlView<? extends ViewModelType>, ViewModelType extends ViewModel> { - - private Class<? extends ViewType> viewType; - private ResourceBundle resourceBundle; - private Object root; - private ViewType codeBehind; - private ViewModelType viewModel; - FxmlViewStep(Class<? extends ViewType> viewType) { - this.viewType = viewType; - } - - /** - * Provide a {@link ResourceBundle} that is used while loading this view. - * Note: It is possible to provide a global application-wide resourceBundle via {@link MvvmFX#setGlobalResourceBundle(ResourceBundle)} method. - * - * If there is a global resourceBundle set it will be merged with the resourceBundle provided by this builder method. - * The resourceBundle provided by this method will have a higher priority then the global one which means that if there - * are duplicate keys, the values of the global resourceBundle will be overwritten and the values of this resourceBundle will be used. - * - * @param resourceBundle - * the resource bundle that is used while loading the view. - * @return this instance of the builder step. - */ - public FxmlViewStep<ViewType, ViewModelType> resourceBundle(ResourceBundle resourceBundle) { - this.resourceBundle = resourceBundle; - return this; - } - - /** - * This param is used to define a JavaFX node that is used as the root element when loading the fxml file. <br> - * - * This can be useful when creating custom controls with the fx:root element. - * - * @param root - * the root element that is used to load the fxml file. - * @return this instance of the builder step. - */ - public FxmlViewStep<ViewType, ViewModelType> root(Object root) { - this.root = root; - return this; - } - - /** - * This param is used to define an existing instance of the codeBehind class that is used instead of creating a - * new one while loading. <br> - * - * This can be useful when creating custom controls with the fx:root element. - * - * @param codeBehind - * the codeBehind instance that is used to load the fxml file. - * @return this instance of the builder step. - */ - public FxmlViewStep<ViewType, ViewModelType> codeBehind(ViewType codeBehind) { - this.codeBehind = codeBehind; - return this; - } - - /** - * This param is used to define an existing viewModel instance to be used when loading the view.<br> - * - * A typical use case is when you like to have two or more views that are sharing the same viewModel. - * - * @param viewModel - * the viewModel instance that is used to load the fxml file. - * @return this instance of the builder step. - */ - public FxmlViewStep<ViewType, ViewModelType> viewModel(ViewModelType viewModel) { - this.viewModel = viewModel; - return this; - } - - /** - * The final step of the Fluent API. This method loads the view based on the given params. - * - * @return a view tuple containing the loaded view. - */ - public ViewTuple<ViewType, ViewModelType> load() { - FxmlViewLoader fxmlViewLoader = new FxmlViewLoader(); - - return fxmlViewLoader.loadFxmlViewTuple(viewType, ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), codeBehind, root, viewModel); - } - } - - - /** - * This method is the entry point of the Fluent API to load a java based view. - * - * @param viewType - * the type of the view that should be loaded. - * @param <ViewType> - * the type of the View that should be loaded. This type has to implement - * {@link de.saxsys.mvvmfx.JavaView}. - * @param <ViewModelType> - * the type of the ViewModel. This type has to implement {@link de.saxsys.mvvmfx.ViewModel}. - * - * @return a builder step that can be further configured and then load the actual view. - */ - public static <ViewType extends JavaView<? extends ViewModelType>, ViewModelType extends ViewModel> - JavaViewStep<ViewType, ViewModelType> javaView(Class<? extends ViewType> viewType) { - return new JavaViewStep<>(viewType); - } - - /** - * This method is the entry point of the Fluent API to load a fxml based View. - * - * @param viewType - * the type of the view that should be loaded. - * @param <ViewType> - * the generic type of the View that should be loaded. This type has to implement - * {@link de.saxsys.mvvmfx.FxmlView}. - * @param <ViewModelType> - * the generic type of the ViewModel. This type has to implement {@link de.saxsys.mvvmfx.ViewModel}. - * - * @return a builder step that can be further configured and then load the actual view. - */ - public static <ViewType extends FxmlView<? extends ViewModelType>, ViewModelType extends ViewModel> - FxmlViewStep<ViewType, ViewModelType> fxmlView(Class<? extends ViewType> viewType) { - return new FxmlViewStep<>(viewType); - } - } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java deleted file mode 100644 index bfabcfdc7..000000000 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeStore.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright 2015 Alexander Casall, Manuel Mauky - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ -package de.saxsys.mvvmfx; - -import java.util.Map; - -import de.saxsys.mvvmfx.internal.WeakValueHashMap; -import de.saxsys.mvvmfx.internal.viewloader.DependencyInjector; - -/** - * Scope Store. - * - * @author alexander.casall - * - */ -public class ScopeStore { - - private ScopeStore() { - } - - private final Map<String, Scope> scopes = new WeakValueHashMap(); - - private static final ScopeStore INSTANCE = new ScopeStore(); - - public static ScopeStore getInstance() { - return INSTANCE; - } - - public <V extends Scope> V getScope(Class<V> scopeType) { - return getScope(scopeType, ""); - } - - public <V extends Scope> V getScope(Class<V> scopeType, String id) { - String mapId = scopeType.getName() + id.trim(); - - - if (!getInstance().scopes.containsKey(mapId)) { - V scope = getInstance().createScopeInstance(scopeType); - getInstance().scopes.put(mapId, scope); - } - - final V v = (V) getInstance().scopes.get(mapId); - - return v; - } - - private <V extends Scope> V createScopeInstance(Class<V> scopeType) { - return DependencyInjector.getInstance().getInstanceOf(scopeType); - } -} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java new file mode 100644 index 000000000..1af6ed062 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java @@ -0,0 +1,42 @@ +package de.saxsys.mvvmfx.internal; + +import java.util.HashMap; +import java.util.Map; + +import de.saxsys.mvvmfx.Scope; + +public class Context { + + private Map<Class<? extends Scope>, Object> scopeContext; + + public Context() { + this(new HashMap<>()); + } + + protected Context(Map<Class<? extends Scope>, Object> scopeContext) { + this.scopeContext = scopeContext; + } + + /** + * @return the scopeBottich + */ + public Map<Class<? extends Scope>, Object> getScopeBottich() { + return scopeContext; + } + + /** + * @param scopeBottich + * the scopeBottich to set + */ + public void setScopeBottich(Map<Class<? extends Scope>, Object> scopeBottich) { + this.scopeContext = scopeBottich; + } + + public Context copy() { + Map<Class<? extends Scope>, Object> scopeContextCopy = new HashMap<>(); + scopeContextCopy.putAll(scopeContext); + Context contextCopy = new Context(scopeContextCopy); + return contextCopy; + } + +} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java new file mode 100644 index 000000000..1679252c8 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java @@ -0,0 +1,16 @@ +package de.saxsys.mvvmfx.internal; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author alexander.casall + * + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface InjectContext { +} \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 78f4c94e6..fcf918d71 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -15,300 +15,337 @@ ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; +import java.io.IOException; +import java.net.URL; +import java.util.ResourceBundle; +import java.util.function.Consumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.internal.Context; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.util.Callback; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.URL; -import java.util.Optional; -import java.util.ResourceBundle; -import java.util.function.Consumer; /** - * This viewLoader is used to load views that are implementing {@link de.saxsys.mvvmfx.FxmlView}. + * This viewLoader is used to load views that are implementing + * {@link de.saxsys.mvvmfx.FxmlView}. * * @author manuel.mauky */ public class FxmlViewLoader { - - private static final Logger LOG = LoggerFactory.getLogger(FxmlViewLoader.class); - - /** - * Load the viewTuple by it`s ViewType. - * - * @param viewType - * the type of the view to be loaded. - * @param resourceBundle - * the resourceBundle that is passed to the {@link javafx.fxml.FXMLLoader}. - * @param codeBehind - * the controller instance that is passed to the {@link javafx.fxml.FXMLLoader} - * @param root - * the root object that is passed to the {@link javafx.fxml.FXMLLoader} - * @param viewModel - * the viewModel instance that is used when loading the viewTuple. - * @param <ViewType> - * the generic type of the view. - * @param <ViewModelType> - * the generic type of the viewModel. - * @return the loaded ViewTuple. - */ - public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( - Class<? extends ViewType> viewType, ResourceBundle resourceBundle, ViewType codeBehind, Object root, - ViewModelType viewModel) { - final String pathToFXML = createFxmlPath(viewType); - return loadFxmlViewTuple(pathToFXML, resourceBundle, codeBehind, root, viewModel); - } - - /** - * This method is used to create a String with the path to the FXML file for a given View class. - * - * This is done by taking the package of the view class (if any) and replace "." with "/". After that the Name of - * the class and the file ending ".fxml" is appended. - * - * Example: de.saxsys.myapp.ui.MainView as view class will be transformed to "/de/saxsys/myapp/ui/MainView.fxml" - * - * Example 2: MainView (located in the default package) will be transformed to "/MainView.fxml" - * - * @param viewType - * the view class type. - * @return the path to the fxml file as string. - */ - private String createFxmlPath(Class<?> viewType) { - final StringBuilder pathBuilder = new StringBuilder(); - - pathBuilder.append("/"); - - if (viewType.getPackage() != null) { - pathBuilder.append(viewType.getPackage().getName().replaceAll("\\.", "/")); - pathBuilder.append("/"); - } - - pathBuilder.append(viewType.getSimpleName()); - pathBuilder.append(".fxml"); - - return pathBuilder.toString(); - } - - /** - * Load the viewTuple by the path of the fxml file. - * - * @param resource - * the string path to the fxml file that is loaded. - * @param resourceBundle - * the resourceBundle that is passed to the {@link javafx.fxml.FXMLLoader}. - * @param codeBehind - * the controller instance that is passed to the {@link javafx.fxml.FXMLLoader} - * @param root - * the root object that is passed to the {@link javafx.fxml.FXMLLoader} - * @param viewModel - * the viewModel instance that is used when loading the viewTuple. - * @param <ViewType> - * the generic type of the view. - * @param <ViewModelType> - * the generic type of the viewModel. - * @return the loaded ViewTuple. - */ - public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( - final String resource, ResourceBundle resourceBundle, final ViewType codeBehind, final Object root, - ViewModelType viewModel) { - try { - - final FXMLLoader loader = createFxmlLoader(resource, resourceBundle, codeBehind, root, viewModel); - - loader.load(); - - final ViewType loadedController = loader.getController(); - final Parent loadedRoot = loader.getRoot(); - - if (loadedController == null) { - throw new IOException("Could not load the controller for the View " + resource - + " maybe your missed the fx:controller in your fxml?"); - } - - - // the actually used ViewModel instance. We need this so we can return it in the ViewTuple - ViewModelType actualViewModel; - - // if no existing viewModel was provided... - if (viewModel == null) { - // ... we try to find the created ViewModel from the codeBehind. - // this is only possible when the codeBehind has a field for the VM and the VM was injected - actualViewModel = ViewLoaderReflectionUtils.getExistingViewModel(loadedController); - - // otherwise we create a new ViewModel. This is needed because the ViewTuple has to contain a VM even if - // the codeBehind doesn't need one - if (actualViewModel == null) { - actualViewModel = ViewLoaderReflectionUtils.createViewModel(loadedController); - - - // it is possible that no viewModel could be created (f.e. when no generic VM type was specified) - // otherwise we need to initialize the created ViewModel instance. - if(actualViewModel != null) { - ViewLoaderReflectionUtils.initializeViewModel(actualViewModel); - } - } - } else { - actualViewModel = viewModel; - } - if (actualViewModel != null) { - ViewLoaderReflectionUtils.injectScope(actualViewModel); - } - - return new ViewTuple<>(loadedController, loadedRoot, actualViewModel); - - } catch (final IOException ex) { - throw new RuntimeException(ex); - } - } - - - private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View codeBehind, Object root, - ViewModel viewModel) - throws IOException { - // Load FXML file - final URL location = FxmlViewLoader.class.getResource(resource); - if (location == null) { - throw new IOException("Error loading FXML - can't load from given resourcepath: " + resource); - } - - final FXMLLoader fxmlLoader = new FXMLLoader(); - - fxmlLoader.setRoot(root); - fxmlLoader.setResources(resourceBundle); - fxmlLoader.setLocation(location); - - // when the user provides a viewModel but no codeBehind, we need to use the custom controller factory. - // in all other cases the default factory can be used. - if (viewModel != null && codeBehind == null) { - fxmlLoader.setControllerFactory(new ControllerFactoryForCustomViewModel(viewModel, resourceBundle)); - } else { - fxmlLoader.setControllerFactory(new DefaultControllerFactory(resourceBundle)); - } - - // When the user provides a codeBehind instance we take care of the injection of the viewModel to this - // controller here. - if (codeBehind != null) { - fxmlLoader.setController(codeBehind); - - if (viewModel == null) { - handleInjection(codeBehind, resourceBundle); - } else { - handleInjection(codeBehind, resourceBundle, viewModel); - } - } - - return fxmlLoader; - } - - /** - * This controller factory will try to create and inject a viewModel instance to every requested controller that is - * a view. - */ - private static class DefaultControllerFactory implements Callback<Class<?>, Object> { - private final ResourceBundle resourceBundle; - - public DefaultControllerFactory(ResourceBundle resourceBundle) { - this.resourceBundle = resourceBundle; - } - - @Override - public Object call(Class<?> type) { - Object controller = DependencyInjector.getInstance().getInstanceOf(type); - - if (controller instanceof View) { - View codeBehind = (View) controller; - - handleInjection(codeBehind, resourceBundle); - } - - return controller; - } - } - - - private static void handleInjection(View codeBehind, ResourceBundle resourceBundle) { - ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); - - Consumer<ViewModel> newVmConsumer = viewModel -> { - ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - ViewLoaderReflectionUtils.injectScope(viewModel); - ViewLoaderReflectionUtils.initializeViewModel(viewModel); - }; - - ViewLoaderReflectionUtils.createAndInjectViewModel(codeBehind, newVmConsumer); - } - - private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, ViewModel viewModel) { - ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); - - if (viewModel != null) { - ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - ViewLoaderReflectionUtils.injectScope(viewModel); - - ViewLoaderReflectionUtils.injectViewModel(codeBehind, viewModel); - } - } - - /** - * A controller factory that is used for the special case where the user provides an existing viewModel to be used - * while loading. - * - * This factory will use this existing viewModel instance for injection of the <strong>first</strong> view that is - * requested from this factory. For all later requests this factory will work the same way as the default factory - * {@link de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader.DefaultControllerFactory}. - * - * The problem we are facing here is the following: The user wants to load a specific View with a specific ViewModel - * instance. But this root View (fxml file) can declare other sub views. Only the root View has to get the existing - * ViewModel instance, all other sub Views have to get their ViewModels via the default way (i.e. - * DependencyInjection or a new instance every time). - * - * But, from the perspective of the controller factory, when a View instance is requested, we can't know if this is - * the root View or a sub View. How do we know when to use the existing ViewModel instance? - * - * To fix this we depend on the standard JavaFX behaviour of the {@link FXMLLoader}: The first instance that the - * FXMLLoader will request from the controller factory will always be the controller for the root fxml file. In this - * case we can use the existing ViewModel. All subsequent requests will be handled with the default behaviour. - */ - private static class ControllerFactoryForCustomViewModel implements Callback<Class<?>, Object> { - - private boolean customViewModelInjected = false; - - private final ViewModel customViewModel; - - private final ResourceBundle resourceBundle; - - public ControllerFactoryForCustomViewModel(ViewModel customViewModel, ResourceBundle resourceBundle) { - this.customViewModel = customViewModel; - this.resourceBundle = resourceBundle; - } - - @Override - public Object call(Class<?> type) { - Object controller = DependencyInjector.getInstance().getInstanceOf(type); - - if (controller instanceof View) { - View codeBehind = (View) controller; - - if (!customViewModelInjected) { - ResourceBundleInjector.injectResourceBundle(customViewModel, resourceBundle); - ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); - - ViewLoaderReflectionUtils.injectViewModel(codeBehind, customViewModel); - - - customViewModelInjected = true; - return codeBehind; - } - - handleInjection(codeBehind, resourceBundle); - } - - return controller; - } - } + + private static final Logger LOG = LoggerFactory.getLogger(FxmlViewLoader.class); + + /** + * Load the viewTuple by it`s ViewType. + * + * @param viewType + * the type of the view to be loaded. + * @param resourceBundle + * the resourceBundle that is passed to the + * {@link javafx.fxml.FXMLLoader}. + * @param codeBehind + * the controller instance that is passed to the + * {@link javafx.fxml.FXMLLoader} + * @param root + * the root object that is passed to the + * {@link javafx.fxml.FXMLLoader} + * @param viewModel + * the viewModel instance that is used when loading the + * viewTuple. + * @param <ViewType> + * the generic type of the view. + * @param <ViewModelType> + * the generic type of the viewModel. + * @return the loaded ViewTuple. + */ + public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( + Class<? extends ViewType> viewType, ResourceBundle resourceBundle, ViewType codeBehind, Object root, + ViewModelType viewModel, Context context) { + final String pathToFXML = createFxmlPath(viewType); + return loadFxmlViewTuple(pathToFXML, resourceBundle, codeBehind, root, viewModel, context); + } + + /** + * This method is used to create a String with the path to the FXML file for + * a given View class. + * + * This is done by taking the package of the view class (if any) and replace + * "." with "/". After that the Name of the class and the file ending + * ".fxml" is appended. + * + * Example: de.saxsys.myapp.ui.MainView as view class will be transformed to + * "/de/saxsys/myapp/ui/MainView.fxml" + * + * Example 2: MainView (located in the default package) will be transformed + * to "/MainView.fxml" + * + * @param viewType + * the view class type. + * @return the path to the fxml file as string. + */ + private String createFxmlPath(Class<?> viewType) { + final StringBuilder pathBuilder = new StringBuilder(); + + pathBuilder.append("/"); + + if (viewType.getPackage() != null) { + pathBuilder.append(viewType.getPackage().getName().replaceAll("\\.", "/")); + pathBuilder.append("/"); + } + + pathBuilder.append(viewType.getSimpleName()); + pathBuilder.append(".fxml"); + + return pathBuilder.toString(); + } + + /** + * Load the viewTuple by the path of the fxml file. + * + * @param resource + * the string path to the fxml file that is loaded. + * @param resourceBundle + * the resourceBundle that is passed to the + * {@link javafx.fxml.FXMLLoader}. + * @param codeBehind + * the controller instance that is passed to the + * {@link javafx.fxml.FXMLLoader} + * @param root + * the root object that is passed to the + * {@link javafx.fxml.FXMLLoader} + * @param viewModel + * the viewModel instance that is used when loading the + * viewTuple. + * @param <ViewType> + * the generic type of the view. + * @param <ViewModelType> + * the generic type of the viewModel. + * @return the loaded ViewTuple. + */ + public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( + final String resource, ResourceBundle resourceBundle, final ViewType codeBehind, final Object root, + ViewModelType viewModel, Context parentContext) { + try { + + // FIXME woanders hin + Context context = parentContext == null ? new Context() : parentContext.copy(); + + final FXMLLoader loader = createFxmlLoader(resource, resourceBundle, codeBehind, root, viewModel, context); + + loader.load(); + + final ViewType loadedController = loader.getController(); + final Parent loadedRoot = loader.getRoot(); + + if (loadedController == null) { + throw new IOException("Could not load the controller for the View " + resource + + " maybe your missed the fx:controller in your fxml?"); + } + + // the actually used ViewModel instance. We need this so we can + // return it in the ViewTuple + ViewModelType actualViewModel; + + // FIXME CONTEXT + + // if no existing viewModel was provided... + if (viewModel == null) { + // ... we try to find the created ViewModel from the codeBehind. + // this is only possible when the codeBehind has a field for the + // VM and the VM was injected + actualViewModel = ViewLoaderReflectionUtils.getExistingViewModel(loadedController); + + // otherwise we create a new ViewModel. This is needed because + // the ViewTuple has to contain a VM even if + // the codeBehind doesn't need one + if (actualViewModel == null) { + actualViewModel = ViewLoaderReflectionUtils.createViewModel(loadedController); + + // it is possible that no viewModel could be created (f.e. + // when no generic VM type was specified) + // otherwise we need to initialize the created ViewModel + // instance. + if (actualViewModel != null) { + ViewLoaderReflectionUtils.initializeViewModel(actualViewModel); + } + } + } else { + actualViewModel = viewModel; + } + if (actualViewModel != null) { + ViewLoaderReflectionUtils.injectScope(actualViewModel, context); + } + + return new ViewTuple<>(loadedController, loadedRoot, actualViewModel); + + } catch (final IOException ex) { + throw new RuntimeException(ex); + } + } + + private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View codeBehind, Object root, + ViewModel viewModel, Context context) throws IOException { + // Load FXML file + final URL location = FxmlViewLoader.class.getResource(resource); + if (location == null) { + throw new IOException("Error loading FXML - can't load from given resourcepath: " + resource); + } + + final FXMLLoader fxmlLoader = new FXMLLoader(); + + fxmlLoader.setRoot(root); + fxmlLoader.setResources(resourceBundle); + fxmlLoader.setLocation(location); + + // when the user provides a viewModel but no codeBehind, we need to use + // the custom controller factory. + // in all other cases the default factory can be used. + if (viewModel != null && codeBehind == null) { + fxmlLoader + .setControllerFactory(new ControllerFactoryForCustomViewModel(viewModel, resourceBundle, context)); + } else { + fxmlLoader.setControllerFactory(new DefaultControllerFactory(resourceBundle, context)); + } + + // When the user provides a codeBehind instance we take care of the + // injection of the viewModel to this + // controller here. + if (codeBehind != null) { + fxmlLoader.setController(codeBehind); + + if (viewModel == null) { + handleInjection(codeBehind, resourceBundle, context); + } else { + handleInjection(codeBehind, resourceBundle, viewModel, context); + } + } + + return fxmlLoader; + } + + /** + * This controller factory will try to create and inject a viewModel + * instance to every requested controller that is a view. + */ + private static class DefaultControllerFactory implements Callback<Class<?>, Object> { + private final ResourceBundle resourceBundle; + private final Context context; + + public DefaultControllerFactory(ResourceBundle resourceBundle, Context context) { + this.resourceBundle = resourceBundle; + this.context = context; + } + + @Override + public Object call(Class<?> type) { + Object controller = DependencyInjector.getInstance().getInstanceOf(type); + + if (controller instanceof View) { + View codeBehind = (View) controller; + + handleInjection(codeBehind, resourceBundle, context); + } + + return controller; + } + } + + private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, Context context) { + ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); + + Consumer<ViewModel> newVmConsumer = viewModel -> { + ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); + ViewLoaderReflectionUtils.injectScope(viewModel, context); + ViewLoaderReflectionUtils.initializeViewModel(viewModel); + }; + + ViewLoaderReflectionUtils.createAndInjectViewModel(codeBehind, newVmConsumer); + ViewLoaderReflectionUtils.injectContext(codeBehind, context); + } + + private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, ViewModel viewModel, + Context context) { + ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); + + if (viewModel != null) { + ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); + ViewLoaderReflectionUtils.injectScope(viewModel, context); + ViewLoaderReflectionUtils.injectViewModel(codeBehind, viewModel); + ViewLoaderReflectionUtils.injectContext(codeBehind, context); + } + } + + /** + * A controller factory that is used for the special case where the user + * provides an existing viewModel to be used while loading. + * + * This factory will use this existing viewModel instance for injection of + * the <strong>first</strong> view that is requested from this factory. For + * all later requests this factory will work the same way as the default + * factory + * {@link de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader.DefaultControllerFactory} + * . + * + * The problem we are facing here is the following: The user wants to load a + * specific View with a specific ViewModel instance. But this root View + * (fxml file) can declare other sub views. Only the root View has to get + * the existing ViewModel instance, all other sub Views have to get their + * ViewModels via the default way (i.e. DependencyInjection or a new + * instance every time). + * + * But, from the perspective of the controller factory, when a View instance + * is requested, we can't know if this is the root View or a sub View. How + * do we know when to use the existing ViewModel instance? + * + * To fix this we depend on the standard JavaFX behaviour of the + * {@link FXMLLoader}: The first instance that the FXMLLoader will request + * from the controller factory will always be the controller for the root + * fxml file. In this case we can use the existing ViewModel. All subsequent + * requests will be handled with the default behaviour. + */ + private static class ControllerFactoryForCustomViewModel implements Callback<Class<?>, Object> { + + private boolean customViewModelInjected = false; + + private final ViewModel customViewModel; + + private final ResourceBundle resourceBundle; + + private final Context context; + + public ControllerFactoryForCustomViewModel(ViewModel customViewModel, ResourceBundle resourceBundle, + Context context) { + this.customViewModel = customViewModel; + this.resourceBundle = resourceBundle; + this.context = context; + } + + @Override + public Object call(Class<?> type) { + Object controller = DependencyInjector.getInstance().getInstanceOf(type); + + if (controller instanceof View) { + View codeBehind = (View) controller; + + if (!customViewModelInjected) { + ResourceBundleInjector.injectResourceBundle(customViewModel, resourceBundle); + ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); + + ViewLoaderReflectionUtils.injectViewModel(codeBehind, customViewModel); + + customViewModelInjected = true; + return codeBehind; + } + + handleInjection(codeBehind, resourceBundle, context); + } + + return controller; + } + } } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 928e5b915..20a8cada4 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -15,13 +15,6 @@ ******************************************************************************/ package de.saxsys.mvvmfx.internal.viewloader; -import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.ViewTuple; -import javafx.fxml.Initializable; -import javafx.scene.Parent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -30,69 +23,85 @@ import java.util.List; import java.util.ResourceBundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.internal.Context; +import javafx.fxml.Initializable; +import javafx.scene.Parent; + /** - * This viewLoader is used to load views that are implementing {@link de.saxsys.mvvmfx.JavaView}. + * This viewLoader is used to load views that are implementing + * {@link de.saxsys.mvvmfx.JavaView}. * * @author manuel.mauky */ public class JavaViewLoader { - private static final Logger LOG = LoggerFactory.getLogger(JavaViewLoader.class); - - - private static final String NAMING_CONVENTION_RESOURCES_IDENTIFIER = "resources"; - private static final String NAMING_CONVENTION_INITIALIZE_IDENTIFIER = "initialize"; - - /** - * Loads the java written view of the given type and injects the ViewModel for this view. <br> - * If the given view type implements the {@link javafx.fxml.Initializable} interface the "initialize" method of this - * interface will be invoked. When this is not the case an implicit initialization will be done that is working - * similar to the way the {@link javafx.fxml.FXMLLoader} is working. <br> - * When there is a <strong>public</strong> no-args method named "initialize" is available this method will be - * called. When there is a <strong>public</strong> field of type {@link java.util.ResourceBundle} named "resources" - * is available this field will get the provided ResourceBundle injected. <br> - * The "initialize" method (whether from the {@link javafx.fxml.Initializable} interface or implicit) will be - * invoked <strong>after</strong> the viewModel was injected. This way the user can create bindings to the viewModel - * in the initialize method. - * - * @param viewType - * class of the view. - * @param resourceBundle - * optional ResourceBundle that will be injected into the view. - * @param existingViewModel - * the viewModel instance that is used to load the view. - * @param <ViewType> - * the generic type of the view. - * @param <ViewModelType> - * the generic type of the viewModel. - * - * @return a fully loaded and initialized instance of the view. - */ - public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadJavaViewTuple( - Class<? extends ViewType> - viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel, ViewType codeBehind) { - DependencyInjector injectionFacade = DependencyInjector.getInstance(); - - final ViewType view = codeBehind == null ? injectionFacade.getInstanceOf(viewType) : codeBehind; - - if (!(view instanceof Parent)) { - throw new IllegalArgumentException("Can not load java view! The view class has to extend from " - + Parent.class.getName() + " or one of it's subclasses"); - } - + private static final Logger LOG = LoggerFactory.getLogger(JavaViewLoader.class); + + private static final String NAMING_CONVENTION_RESOURCES_IDENTIFIER = "resources"; + private static final String NAMING_CONVENTION_INITIALIZE_IDENTIFIER = "initialize"; + + /** + * Loads the java written view of the given type and injects the ViewModel + * for this view. <br> + * If the given view type implements the {@link javafx.fxml.Initializable} + * interface the "initialize" method of this interface will be invoked. When + * this is not the case an implicit initialization will be done that is + * working similar to the way the {@link javafx.fxml.FXMLLoader} is working. + * <br> + * When there is a <strong>public</strong> no-args method named "initialize" + * is available this method will be called. When there is a + * <strong>public</strong> field of type {@link java.util.ResourceBundle} + * named "resources" is available this field will get the provided + * ResourceBundle injected. <br> + * The "initialize" method (whether from the + * {@link javafx.fxml.Initializable} interface or implicit) will be invoked + * <strong>after</strong> the viewModel was injected. This way the user can + * create bindings to the viewModel in the initialize method. + * + * @param viewType + * class of the view. + * @param resourceBundle + * optional ResourceBundle that will be injected into the view. + * @param existingViewModel + * the viewModel instance that is used to load the view. + * @param <ViewType> + * the generic type of the view. + * @param <ViewModelType> + * the generic type of the viewModel. + * + * @return a fully loaded and initialized instance of the view. + */ + public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadJavaViewTuple( + Class<? extends ViewType> viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel, + ViewType codeBehind, Context parentContext) { + + // FIXME woanders hin + Context context = parentContext == null ? new Context() : parentContext.copy(); + + DependencyInjector injectionFacade = DependencyInjector.getInstance(); + + final ViewType view = codeBehind == null ? injectionFacade.getInstanceOf(viewType) : codeBehind; + + if (!(view instanceof Parent)) { + throw new IllegalArgumentException("Can not load java view! The view class has to extend from " + + Parent.class.getName() + " or one of it's subclasses"); + } ViewModelType viewModel = null; - // when no viewmodel was provided by the user... - if (existingViewModel == null) { + if (existingViewModel == null) { // ... we create a new one (if possible) viewModel = ViewLoaderReflectionUtils.createViewModel(view); - } else { + } else { viewModel = existingViewModel; } - - ResourceBundleInjector.injectResourceBundle(view, resourceBundle); + ResourceBundleInjector.injectResourceBundle(view, resourceBundle); // if no ViewModel is available... if (viewModel == null) { @@ -100,114 +109,120 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi final List<Field> viewModelFields = ViewLoaderReflectionUtils.getViewModelFields(viewType); - if(!viewModelFields.isEmpty()) { - throw new RuntimeException("The given view of type <" + view.getClass() + "> has no generic viewModel type declared but tries to inject a viewModel."); + if (!viewModelFields.isEmpty()) { + throw new RuntimeException("The given view of type <" + view.getClass() + + "> has no generic viewModel type declared but tries to inject a viewModel."); } - } else { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - - - // if the user has provided an existing ViewModel, we will not (re-)initialize this existing instance - if(existingViewModel == null) { - ViewLoaderReflectionUtils.injectScope(viewModel); - ViewLoaderReflectionUtils.initializeViewModel(viewModel); - } - + + // if the user has provided an existing ViewModel, we will not + // (re-)initialize this existing instance + if (existingViewModel == null) { + ViewLoaderReflectionUtils.injectScope(viewModel, context); + ViewLoaderReflectionUtils.initializeViewModel(viewModel); + } + ViewLoaderReflectionUtils.injectViewModel(view, viewModel); } - if (view instanceof Initializable) { - Initializable initializable = (Initializable) view; - initializable.initialize(null, resourceBundle); - } else { - injectResourceBundle(view, resourceBundle); - callInitialize(view); - } - - return new ViewTuple<>(view, (Parent) view, viewModel); - } - - /** - * This method is trying to invoke the initialize method of the given view by reflection. This is done to meet the - * conventions of the {@link javafx.fxml.FXMLLoader}. The conventions say that when there is a - * <strong>public</strong> no-args method with the simple name "initialize" and the class does not implement the - * {@link javafx.fxml.Initializable} interface, the initialize method will be invoked. <br> - * This method is package scoped for better testability. - * - * @param view - * the view instance of which the initialize method will be invoked. - * @param <ViewModelType> - * the generic type of the view. - */ - <ViewModelType extends ViewModel> void callInitialize(View<? extends ViewModelType> view) { - try { - final Method initializeMethod = view.getClass().getMethod(NAMING_CONVENTION_INITIALIZE_IDENTIFIER); - - AccessController.doPrivileged((PrivilegedAction) () -> { - try { - return initializeMethod.invoke(view); - } catch (InvocationTargetException e) { - LOG.warn("The '{}' method of the view {} has thrown an exception!", - NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view); - - Throwable cause = e.getCause(); - if (cause instanceof RuntimeException) { - throw (RuntimeException) cause; - } else { - throw new RuntimeException(cause); - } - } catch (IllegalAccessException e) { - LOG.warn("Can't invoke the '{}' method of the view {} because it is not accessible", - NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view); - } - return null; - }); - - } catch (NoSuchMethodException e) { - // This exception means that there is no initialize method declared. - // While it's possible that the user has no such method by design, - // normally and in most cases you need an initialize method in your view (either with Initialize interface - // or implicit). - // So it's likely that the user has misspelled the method name or uses a wrong naming convention. - // For this reason we give the user the log message. - LOG.debug("There is no '{}' method declared at the view {}", NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view); - } - } - - /** - * Injects the given ResourceBundle into the given view using reflection. This is done to meet the conventions of - * the {@link javafx.fxml.FXMLLoader}. The resourceBundle is only injected when there is a <strong>public</strong> - * field of the type {@link java.util.ResourceBundle} named "resources". <br> - * This method is package scoped for better testability. - * - * @param view - * the view instance that gets the resourceBundle injected. - * @param resourceBundle - * the resourceBundle instance that will be injected. - * @param <ViewModelType> - * the generic type of the view. - */ - <ViewModelType extends ViewModel> void injectResourceBundle(View<? extends ViewModelType> view, - ResourceBundle resourceBundle) { - try { - Field resourcesField = view.getClass().getField(NAMING_CONVENTION_RESOURCES_IDENTIFIER); - - if (resourcesField.getType().isAssignableFrom(ResourceBundle.class)) { - resourcesField.set(view, resourceBundle); - } - } catch (NoSuchFieldException e) { - // This exception means that there is no field for the ResourceBundle. - // This is no exceptional case but is normal when you don't need a resourceBundle in a specific view. - // Therefore it's save to silently catch the exception. - } catch (IllegalAccessException e) { - LOG.warn("Can't inject the ResourceBundle into the view {} because the field isn't accessible", view); - } - - - } - - + Initializable initializable = (Initializable) view; + initializable.initialize(null, resourceBundle); + } else { + injectResourceBundle(view, resourceBundle); + callInitialize(view); + } + + return new ViewTuple<>(view, (Parent) view, viewModel); + } + + /** + * This method is trying to invoke the initialize method of the given view + * by reflection. This is done to meet the conventions of the + * {@link javafx.fxml.FXMLLoader}. The conventions say that when there is a + * <strong>public</strong> no-args method with the simple name "initialize" + * and the class does not implement the {@link javafx.fxml.Initializable} + * interface, the initialize method will be invoked. <br> + * This method is package scoped for better testability. + * + * @param view + * the view instance of which the initialize method will be + * invoked. + * @param <ViewModelType> + * the generic type of the view. + */ + <ViewModelType extends ViewModel> void callInitialize(View<? extends ViewModelType> view) { + try { + final Method initializeMethod = view.getClass().getMethod(NAMING_CONVENTION_INITIALIZE_IDENTIFIER); + + AccessController.doPrivileged((PrivilegedAction) () -> { + try { + return initializeMethod.invoke(view); + } catch (InvocationTargetException e) { + LOG.warn("The '{}' method of the view {} has thrown an exception!", + NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view); + + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + throw new RuntimeException(cause); + } + } catch (IllegalAccessException e) { + LOG.warn("Can't invoke the '{}' method of the view {} because it is not accessible", + NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view); + } + return null; + }); + + } catch (NoSuchMethodException e) { + // This exception means that there is no initialize method declared. + // While it's possible that the user has no such method by design, + // normally and in most cases you need an initialize method in your + // view (either with Initialize interface + // or implicit). + // So it's likely that the user has misspelled the method name or + // uses a wrong naming convention. + // For this reason we give the user the log message. + LOG.debug("There is no '{}' method declared at the view {}", NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view); + } + } + + /** + * Injects the given ResourceBundle into the given view using reflection. + * This is done to meet the conventions of the + * {@link javafx.fxml.FXMLLoader}. The resourceBundle is only injected when + * there is a <strong>public</strong> field of the type + * {@link java.util.ResourceBundle} named "resources". <br> + * This method is package scoped for better testability. + * + * @param view + * the view instance that gets the resourceBundle injected. + * @param resourceBundle + * the resourceBundle instance that will be injected. + * @param <ViewModelType> + * the generic type of the view. + */ + <ViewModelType extends ViewModel> void injectResourceBundle(View<? extends ViewModelType> view, + ResourceBundle resourceBundle) { + try { + Field resourcesField = view.getClass().getField(NAMING_CONVENTION_RESOURCES_IDENTIFIER); + + if (resourcesField.getType().isAssignableFrom(ResourceBundle.class)) { + resourcesField.set(view, resourceBundle); + } + } catch (NoSuchFieldException e) { + // This exception means that there is no field for the + // ResourceBundle. + // This is no exceptional case but is normal when you don't need a + // resourceBundle in a specific view. + // Therefore it's save to silently catch the exception. + } catch (IllegalAccessException e) { + LOG.warn("Can't inject the ResourceBundle into the view {} because the field isn't accessible", view); + } + + } + } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 47b86a768..fa3c0888c 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -22,320 +22,365 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.function.Consumer; import java.util.stream.Collectors; -import net.jodah.typetools.TypeResolver; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.Scope; -import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.internal.Context; +import de.saxsys.mvvmfx.internal.InjectContext; +import net.jodah.typetools.TypeResolver; /** - * This class encapsulates reflection related utility operations specific for loading of views. + * This class encapsulates reflection related utility operations specific for + * loading of views. * * @author manuel.mauky */ public class ViewLoaderReflectionUtils { - - - - /** - * Returns the {@link java.lang.reflect.Field} of the viewModel for a given view type and viewModel type. If there - * is no annotated field for the viewModel in the view the returned Optional will be empty. - * - * @param viewType - * the type of the view - * @param viewModelType - * the type of the viewModel - * @return an Optional that contains the Field when the field exists. - */ - public static Optional<Field> getViewModelField(Class<? extends View> viewType, Class<?> viewModelType) { - List<Field> allViewModelFields = getViewModelFields(viewType); - - if (allViewModelFields.isEmpty()) { - return Optional.empty(); - } - - if (allViewModelFields.size() > 1) { - throw new RuntimeException("The View <" + viewType + "> may only define one viewModel but there were <" - + allViewModelFields.size() + "> viewModel fields with the @InjectViewModel annotation!"); - } - - Field field = allViewModelFields.get(0); - - if (!ViewModel.class.isAssignableFrom(field.getType())) { - throw new RuntimeException( - "The View <" - + viewType - + "> has a field annotated with @InjectViewModel but the type of the field doesn't implement the 'ViewModel' interface!"); - } - - if (!field.getType().isAssignableFrom(viewModelType)) { - throw new RuntimeException( - "The View <" - + viewType - + "> has a field annotated with @InjectViewModel but the type of the field doesn't match the generic ViewModel type of the View class. " - + "The declared generic type is <" + viewModelType - + "> but the actual type of the field is <" + field.getType() + ">."); - } - - return Optional.of(field); - } - - public static List<Field> getScopeFields(Class<?> viewModelType) { - final List<Field> allScopeFields = getFieldsWithAnnotation(viewModelType, InjectScope.class); - - allScopeFields - .stream() - .forEach( - field -> { - if (!Scope.class.isAssignableFrom(field.getType())) { - throw new RuntimeException( - "The ViewModel <" - + viewModelType - + "> has a field annotated with @InjectScope but the type of the field doesn't implement the 'Scope' interface!"); - } - }); - - return allScopeFields; - } - - - /** - * Returns a list of all {@link Field}s of ViewModels for a given view type that are annotated with - * {@link InjectViewModel}. - * - * @param viewType - * the type of the view. - * @return a list of fields. - */ - public static List<Field> getViewModelFields(Class<? extends View> viewType) { + + /** + * Returns the {@link java.lang.reflect.Field} of the viewModel for a given + * view type and viewModel type. If there is no annotated field for the + * viewModel in the view the returned Optional will be empty. + * + * @param viewType + * the type of the view + * @param viewModelType + * the type of the viewModel + * @return an Optional that contains the Field when the field exists. + */ + public static Optional<Field> getViewModelField(Class<? extends View> viewType, Class<?> viewModelType) { + List<Field> allViewModelFields = getViewModelFields(viewType); + + if (allViewModelFields.isEmpty()) { + return Optional.empty(); + } + + if (allViewModelFields.size() > 1) { + throw new RuntimeException("The View <" + viewType + "> may only define one viewModel but there were <" + + allViewModelFields.size() + "> viewModel fields with the @InjectViewModel annotation!"); + } + + Field field = allViewModelFields.get(0); + + if (!ViewModel.class.isAssignableFrom(field.getType())) { + throw new RuntimeException("The View <" + viewType + + "> has a field annotated with @InjectViewModel but the type of the field doesn't implement the 'ViewModel' interface!"); + } + + if (!field.getType().isAssignableFrom(viewModelType)) { + throw new RuntimeException("The View <" + viewType + + "> has a field annotated with @InjectViewModel but the type of the field doesn't match the generic ViewModel type of the View class. " + + "The declared generic type is <" + viewModelType + "> but the actual type of the field is <" + + field.getType() + ">."); + } + + return Optional.of(field); + } + + public static List<Field> getScopeFields(Class<?> viewModelType) { + final List<Field> allScopeFields = getFieldsWithAnnotation(viewModelType, InjectScope.class); + + allScopeFields.stream().forEach(field -> { + if (!Scope.class.isAssignableFrom(field.getType())) { + throw new RuntimeException("The ViewModel <" + viewModelType + + "> has a field annotated with @InjectScope but the type of the field doesn't implement the 'Scope' interface!"); + } + }); + + return allScopeFields; + } + + private static Optional<Field> getContextField(Class<? extends View> viewType) { + List<Field> allViewModelFields = getContextFields(viewType); + + if (allViewModelFields.isEmpty()) { + return Optional.empty(); + } + + if (allViewModelFields.size() > 1) { + throw new RuntimeException("The View <" + viewType + "> may only define one Context but there were <" + + allViewModelFields.size() + "> Context fields with the @InjectContext annotation!"); + } + + Field field = allViewModelFields.get(0); + + if (!field.getType().isAssignableFrom(Context.class)) { + throw new RuntimeException("The View <" + viewType + + "> has a field annotated with @InjectContext but the type of the field doesn't match the type Context. " + + "The actual type of the field is <" + field.getType() + ">."); + } + + return Optional.of(field); + } + + private static List<Field> getContextFields(Class<? extends View> viewType) { + return getFieldsWithAnnotation(viewType, InjectContext.class); + } + + /** + * Returns a list of all {@link Field}s of ViewModels for a given view type + * that are annotated with {@link InjectViewModel}. + * + * @param viewType + * the type of the view. + * @return a list of fields. + */ + public static List<Field> getViewModelFields(Class<? extends View> viewType) { return getFieldsWithAnnotation(viewType, InjectViewModel.class); - } + } + private static <T, A extends Annotation> List<Field> getFieldsWithAnnotation(Class<T> classType, + Class<A> annotationType) { + return ReflectionUtils.getFieldsFromClassHierarchy(classType) + .stream() + .filter(field -> field.isAnnotationPresent(annotationType)) + .collect(Collectors.toList()); + } - - private static <T, A extends Annotation> List<Field> getFieldsWithAnnotation(Class<T> classType, Class<A> annotationType) { - return ReflectionUtils.getFieldsFromClassHierarchy(classType).stream() - .filter(field -> field.isAnnotationPresent(annotationType)) - .collect(Collectors.toList()); + /** + * This method is used to get the ViewModel instance of a given + * view/codeBehind. + * + * @param view + * the view instance where the viewModel will be looked for. + * @param <ViewType> + * the generic type of the View + * @param <ViewModelType> + * the generic type of the ViewModel + * @return the ViewModel instance or null if no viewModel could be found. + */ + @SuppressWarnings("unchecked") + public static <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewModelType getExistingViewModel( + ViewType view) { + final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); + Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModelType); + if (fieldOptional.isPresent()) { + Field field = fieldOptional.get(); + return ReflectionUtils.accessField(field, () -> (ViewModelType) field.get(view), + "Can't get the viewModel of type <" + viewModelType + ">"); + } else { + return null; + } } - - - - /** - * This method is used to get the ViewModel instance of a given view/codeBehind. - * - * @param view - * the view instance where the viewModel will be looked for. - * @param <ViewType> - * the generic type of the View - * @param <ViewModelType> - * the generic type of the ViewModel - * @return the ViewModel instance or null if no viewModel could be found. - */ - @SuppressWarnings("unchecked") - public static <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewModelType getExistingViewModel( - ViewType view) { - final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); - Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModelType); - if (fieldOptional.isPresent()) { - Field field = fieldOptional.get(); - return ReflectionUtils - .accessField(field, () -> (ViewModelType) field.get(view), "Can't get the viewModel of type <" - + viewModelType + ">"); - } else { - return null; - } - } - - /** - * Injects the given viewModel instance into the given view. The injection will only happen when the class of the - * given view has a viewModel field that fulfills all requirements for the viewModel injection (matching types, no - * viewModel already existing ...). - * - * @param view - * @param viewModel - */ - public static void injectViewModel(final View view, ViewModel viewModel) { - if (viewModel == null) { - return; - } - final Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModel.getClass()); - if (fieldOptional.isPresent()) { - Field field = fieldOptional.get(); - ReflectionUtils.accessField(field, () -> { - Object existingViewModel = field.get(view); - if (existingViewModel == null) { - field.set(view, viewModel); - } - }, "Can't inject ViewModel of type <" + viewModel.getClass() - + "> into the view <" + view + ">"); - } - } - - /** - * This method is used to create and inject the ViewModel for a given View instance. - * - * The following checks are done: - * <ul> - * <li>Check whether the View class specifies a ViewModel type as generic type.</li> - * <li>Check whether the View has a field with a matching ViewModel type and the annotation {@link InjectViewModel}. - * </li> - * - * <li>Check whether field in the view instance already contains a ViewModel instance. In this case nothing will - * happen to the existing ViewModel instance.</li> - * - * </ul> - * - * If a suitable field was found a new ViewModel instance will be created and injected into the field. After that - * the given Consumer function will be applied with the injected ViewModel instance as argument. - * - * @param view - * the view instance. - * @param <V> - * the generic type of the View. - * @param <VM> - * the generic type of the ViewModel. - * @param newVmConsumer - * a Consumer function that is applied when a new ViewModel instance is created. - * - * @throws RuntimeException - * if there is a ViewModel field in the View with the {@link InjectViewModel} annotation whose type - * doesn't match the generic ViewModel type from the View class. - */ - @SuppressWarnings("unchecked") - public static <V extends View<? extends VM>, VM extends ViewModel> void createAndInjectViewModel( - final V view, Consumer<ViewModel> newVmConsumer) { - final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); - - if (viewModelType == ViewModel.class) { - // if no viewModel can be created, we have to check if the user has tried to inject a ViewModel + + /** + * Injects the given viewModel instance into the given view. The injection + * will only happen when the class of the given view has a viewModel field + * that fulfills all requirements for the viewModel injection (matching + * types, no viewModel already existing ...). + * + * @param view + * @param viewModel + */ + public static void injectViewModel(final View view, ViewModel viewModel) { + if (viewModel == null) { + return; + } + final Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModel.getClass()); + if (fieldOptional.isPresent()) { + Field field = fieldOptional.get(); + ReflectionUtils.accessField(field, () -> { + Object existingViewModel = field.get(view); + if (existingViewModel == null) { + field.set(view, viewModel); + } + }, "Can't inject ViewModel of type <" + viewModel.getClass() + "> into the view <" + view + ">"); + } + } + + /** + * This method is used to create and inject the ViewModel for a given View + * instance. + * + * The following checks are done: + * <ul> + * <li>Check whether the View class specifies a ViewModel type as generic + * type.</li> + * <li>Check whether the View has a field with a matching ViewModel type and + * the annotation {@link InjectViewModel}.</li> + * + * <li>Check whether field in the view instance already contains a ViewModel + * instance. In this case nothing will happen to the existing ViewModel + * instance.</li> + * + * </ul> + * + * If a suitable field was found a new ViewModel instance will be created + * and injected into the field. After that the given Consumer function will + * be applied with the injected ViewModel instance as argument. + * + * @param view + * the view instance. + * @param <V> + * the generic type of the View. + * @param <VM> + * the generic type of the ViewModel. + * @param newVmConsumer + * a Consumer function that is applied when a new ViewModel + * instance is created. + * + * @throws RuntimeException + * if there is a ViewModel field in the View with the + * {@link InjectViewModel} annotation whose type doesn't match + * the generic ViewModel type from the View class. + */ + @SuppressWarnings("unchecked") + public static <V extends View<? extends VM>, VM extends ViewModel> void createAndInjectViewModel(final V view, + Consumer<ViewModel> newVmConsumer) { + final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); + + if (viewModelType == ViewModel.class) { + // if no viewModel can be created, we have to check if the user has + // tried to inject a ViewModel final List<Field> viewModelFields = ViewLoaderReflectionUtils.getViewModelFields(view.getClass()); - if(!viewModelFields.isEmpty()) { - throw new RuntimeException("The given view of type <" + view.getClass() + "> has no generic viewModel type declared but tries to inject a viewModel."); + if (!viewModelFields.isEmpty()) { + throw new RuntimeException("The given view of type <" + view.getClass() + + "> has no generic viewModel type declared but tries to inject a viewModel."); } - return; - } - if (viewModelType == TypeResolver.Unknown.class) { - return; - } - - final Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModelType); - if (fieldOptional.isPresent()) { - Field field = fieldOptional.get(); - - ReflectionUtils.accessField(field, () -> { - Object existingViewModel = field.get(view); - - if (existingViewModel == null) { - final Object newViewModel = DependencyInjector.getInstance().getInstanceOf(viewModelType); - - field.set(view, newViewModel); - - newVmConsumer.accept((ViewModel) newViewModel); - } - }, "Can't inject ViewModel of type <" + viewModelType - + "> into the view <" + view + ">"); - - } - } - - static void injectScope(Object viewModel) { - List<Field> scopeFields = getScopeFields(viewModel.getClass()); - - scopeFields.forEach(scopeField -> { - ReflectionUtils.accessField(scopeField, - () -> injectScopeIntoField(scopeField, viewModel), + return; + } + if (viewModelType == TypeResolver.Unknown.class) { + return; + } + + final Optional<Field> fieldOptional = getViewModelField(view.getClass(), viewModelType); + if (fieldOptional.isPresent()) { + Field field = fieldOptional.get(); + + ReflectionUtils.accessField(field, () -> { + Object existingViewModel = field.get(view); + + if (existingViewModel == null) { + final Object newViewModel = DependencyInjector.getInstance().getInstanceOf(viewModelType); + + field.set(view, newViewModel); + + newVmConsumer.accept((ViewModel) newViewModel); + } + }, "Can't inject ViewModel of type <" + viewModelType + "> into the view <" + view + ">"); + + } + } + + static void injectScope(Object viewModel, Context context) { + + // FIXME + + List<Field> scopeFields = getScopeFields(viewModel.getClass()); + + scopeFields.forEach(scopeField -> { + ReflectionUtils.accessField(scopeField, () -> injectScopeIntoField(scopeField, viewModel, context), "Can't inject Scope into ViewModel <" + viewModel.getClass() + ">"); - }); - } + }); + } - static Object injectScopeIntoField(Field scopeField, Object viewModel) throws IllegalAccessException { + public static void injectContext(View codeBehind, Context context) { + + Optional<Field> contextField = getContextField(codeBehind.getClass()); + + if (contextField.isPresent()) { + Field field = contextField.get(); + ReflectionUtils.accessField(field, () -> { + field.set(codeBehind, context); + }, "Can't inject Context into the view <" + codeBehind + ">"); + } + } + + static Object injectScopeIntoField(Field scopeField, Object viewModel, Context context) + throws IllegalAccessException { Class<? extends Scope> scopeType = (Class<? extends Scope>) scopeField.getType(); + // FIXME final InjectScope[] annotations = scopeField.getAnnotationsByType(InjectScope.class); - if(annotations.length != 1) { - throw new RuntimeException("A field to inject a Scope into should have exactly one @InjectScope annotation " + - "but the viewModel <" + viewModel + "> has a field that violates this rule."); + if (annotations.length != 1) { + throw new RuntimeException("A field to inject a Scope into should have exactly one @InjectScope annotation " + + "but the viewModel <" + viewModel + "> has a field that violates this rule."); } - Object newScope; + Map<Class<? extends Scope>, Object> scopeBottich = context.getScopeBottich(); + Object newScope = scopeBottich.get(scopeType); - final String annotationValue = annotations[0].value(); - - if(annotationValue == null || annotationValue.trim().isEmpty()) { - newScope = ScopeStore.getInstance().getScope(scopeType); - } else { - newScope = ScopeStore.getInstance().getScope(scopeType, annotationValue); + if (newScope == null) { + scopeBottich.put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); + newScope = scopeBottich.get(scopeType); } + if (!newScope.getClass().equals(scopeType)) { + throw new IllegalStateException("something went wrong..."); + } scopeField.set(viewModel, newScope); return newScope; } - - /** - * Creates a viewModel instance for a View type. The type of the view is determined by the given view instance. - * - * For the creation of the viewModel the {@link DependencyInjector} is used. - * - * @param view - * the view instance that is used to find out the type of the ViewModel - * @param <ViewType> - * the generic view type - * @param <ViewModelType> - * the generic viewModel type - * @return the viewModel instance or <code>null</code> if the viewModel type can't be found or the viewModel can't - * be created. - */ - @SuppressWarnings("unchecked") - public static <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewModelType createViewModel( - ViewType view) { - final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); - if (viewModelType == ViewModel.class) { - return null; - } - if (TypeResolver.Unknown.class == viewModelType) { - return null; - } - return (ViewModelType) DependencyInjector.getInstance().getInstanceOf(viewModelType); - } - - - /** - * If a ViewModel has a method with the signature <code>public void initialize()</code> it will be invoked. If no - * such method is available nothing happens. - * - * @param viewModel - * the viewModel that's initialize method (if available) will be invoked. - * @param <ViewModelType> - * the generic type of the ViewModel. - */ - public static <ViewModelType extends ViewModel> void initializeViewModel(ViewModelType viewModel) { - if(viewModel == null) { - return; - } - try { - final Method initMethod = viewModel.getClass().getMethod("initialize"); - - AccessController.doPrivileged((PrivilegedAction) () -> { - try { - return initMethod.invoke(viewModel); - } catch (InvocationTargetException | IllegalAccessException e) { - throw new IllegalStateException("mvvmFX wasn't able to call the initialize method of ViewModel [" - + viewModel + "].", e); - } - }); - } catch (NoSuchMethodException e) { - // it's perfectly fine that a ViewModel has no initialize method. - } - } + + /** + * Creates a viewModel instance for a View type. The type of the view is + * determined by the given view instance. + * + * For the creation of the viewModel the {@link DependencyInjector} is used. + * + * @param view + * the view instance that is used to find out the type of the + * ViewModel + * @param <ViewType> + * the generic view type + * @param <ViewModelType> + * the generic viewModel type + * @return the viewModel instance or <code>null</code> if the viewModel type + * can't be found or the viewModel can't be created. + */ + @SuppressWarnings("unchecked") + public static <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewModelType createViewModel( + ViewType view) { + final Class<?> viewModelType = TypeResolver.resolveRawArgument(View.class, view.getClass()); + if (viewModelType == ViewModel.class) { + return null; + } + if (TypeResolver.Unknown.class == viewModelType) { + return null; + } + return (ViewModelType) DependencyInjector.getInstance().getInstanceOf(viewModelType); + } + + /** + * If a ViewModel has a method with the signature + * <code>public void initialize()</code> it will be invoked. If no such + * method is available nothing happens. + * + * @param viewModel + * the viewModel that's initialize method (if available) will be + * invoked. + * @param <ViewModelType> + * the generic type of the ViewModel. + */ + public static <ViewModelType extends ViewModel> void initializeViewModel(ViewModelType viewModel) { + if (viewModel == null) { + return; + } + try { + final Method initMethod = viewModel.getClass().getMethod("initialize"); + + AccessController.doPrivileged((PrivilegedAction) () -> { + try { + return initMethod.invoke(viewModel); + } catch (InvocationTargetException | IllegalAccessException e) { + throw new IllegalStateException( + "mvvmFX wasn't able to call the initialize method of ViewModel [" + viewModel + "].", e); + } + }); + } catch (NoSuchMethodException e) { + // it's perfectly fine that a ViewModel has no initialize method. + } + } + } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope1.java similarity index 95% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope1.java index 1df4c900e..e7f8d924f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope1.java @@ -19,7 +19,7 @@ import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; -public class TestScope implements Scope { +public class TestScope1 implements Scope { public BooleanProperty someProperty = new SimpleBooleanProperty(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java new file mode 100644 index 000000000..8be91591d --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java @@ -0,0 +1,5 @@ +package de.saxsys.mvvmfx.internal.viewloader.example; + +public class TestScope2 { + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index 9020e4fad..e343099d2 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -1,68 +1,61 @@ package de.saxsys.mvvmfx.scopes; - -import de.saxsys.mvvmfx.FluentViewLoader; +import org.junit.Assert; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; +import de.saxsys.mvvmfx.FluentViewLoader; public class ScopeTest { - @Test - public void testJavaScopedView() throws Exception { + @Test + public void testJavaScopedView() throws Exception { - final ScopedViewModelA viewModelA = FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); - final ScopedViewModelB viewModelB = FluentViewLoader.javaView(ScopedJavaViewB.class).load().getViewModel(); + // FIXME JAVA TESTS - verifyScopes(viewModelA, viewModelB); - } + // final ScopedViewModelA viewModelA = + // FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); + // final ScopedViewModelB viewModelB = + // FluentViewLoader.javaView(ScopedJavaViewB.class).load().getViewModel(); + // + // verifyScopes(viewModelA, viewModelB); + } @Test public void testFxmlScopedView() throws Exception { - final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class).load().getCodeBehind(); + final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) + .load() + .getCodeBehind(); final ScopedViewModelA viewModelA = parentView.subviewAController.viewModel; final ScopedViewModelB viewModelB = parentView.subviewBController.viewModel; - verifyScopes(viewModelA, viewModelB); - } - - - private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB) { - assertThat(viewModelA.injectedScope1).isNotNull(); - assertThat(viewModelA.injectedScope2).isNotNull(); - assertThat(viewModelA.injectedScope3).isNotNull(); - assertThat(viewModelA.lazyScope1).isNotNull(); - assertThat(viewModelA.lazyScope2).isNotNull(); - assertThat(viewModelA.lazyScope3).isNotNull(); - + ScopedViewModelC viewModelCinA = parentView.subviewAController.subviewCController.viewModel; + ScopedViewModelD viewModelDinA = parentView.subviewAController.subviewCController.subViewDController.viewModel; + ScopedViewModelD viewModelDinAWithoutContext = parentView.subviewAController.subviewCController.subViewDWithoutContextController.viewModel; - assertThat(viewModelA.injectedScope1).isEqualTo(viewModelA.lazyScope1); - assertThat(viewModelA.injectedScope2).isEqualTo(viewModelA.lazyScope2); - assertThat(viewModelA.injectedScope3).isEqualTo(viewModelA.lazyScope3); + ScopedViewModelC viewModelCinB = parentView.subviewBController.subviewCController.viewModel; + ScopedViewModelD viewModelDinB = parentView.subviewBController.subviewCController.subViewDController.viewModel; + ScopedViewModelD viewModelDinBWithoutContext = parentView.subviewBController.subviewCController.subViewDWithoutContextController.viewModel; + verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB, + viewModelDinAWithoutContext, viewModelDinBWithoutContext); + } - assertThat(viewModelB.injectedScope1).isNotNull(); - assertThat(viewModelB.injectedScope2).isNotNull(); - assertThat(viewModelB.injectedScope3).isNotNull(); - assertThat(viewModelB.lazyScope1).isNotNull(); - assertThat(viewModelB.lazyScope2).isNotNull(); - assertThat(viewModelB.lazyScope3).isNotNull(); - + private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB, ScopedViewModelC viewModelCinA, + ScopedViewModelC viewModelCinB, ScopedViewModelD viewModelDinA, ScopedViewModelD viewModelDinB, + ScopedViewModelD viewModelDinAWithoutContext, ScopedViewModelD viewModelDinBWithoutContext) { - assertThat(viewModelB.injectedScope1).isEqualTo(viewModelB.lazyScope1); - assertThat(viewModelB.injectedScope2).isEqualTo(viewModelB.lazyScope2); - assertThat(viewModelB.injectedScope3).isEqualTo(viewModelB.lazyScope3); + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinAWithoutContext.injectedScope1); + Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); + Assert.assertEquals(viewModelA.injectedScope1, viewModelDinA.injectedScope1); + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinBWithoutContext.injectedScope1); + Assert.assertEquals(viewModelB.injectedScope1, viewModelCinB.injectedScope1); + Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); - assertThat(viewModelA.injectedScope1).isEqualTo(viewModelB.injectedScope1); - assertThat(viewModelA.injectedScope2).isEqualTo(viewModelB.injectedScope2); - assertThat(viewModelA.injectedScope3).isEqualTo(viewModelB.injectedScope3); - assertThat(viewModelA.lazyScope1).isEqualTo(viewModelB.lazyScope1); - assertThat(viewModelA.lazyScope2).isEqualTo(viewModelB.lazyScope2); - assertThat(viewModelA.lazyScope3).isEqualTo(viewModelB.lazyScope3); + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelCinB); + Assert.assertNotEquals(viewModelB.injectedScope1, viewModelCinA); } - } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java index 7d1b2045d..082522f06 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java @@ -17,7 +17,7 @@ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; - +import javafx.fxml.FXML; /** * This class is used as example View class that uses FXML. @@ -25,6 +25,10 @@ * @author alexander.casall */ public class ScopedFxmlViewA implements FxmlView<ScopedViewModelA> { - @InjectViewModel - public ScopedViewModelA viewModel; + + @InjectViewModel + public ScopedViewModelA viewModel; + + @FXML + public ScopedFxmlViewC subviewCController; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java index f7e1e2664..580d2a494 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java @@ -17,7 +17,7 @@ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; - +import javafx.fxml.FXML; /** * This class is used as example View class that uses FXML. @@ -25,7 +25,10 @@ * @author alexander.casall */ public class ScopedFxmlViewB implements FxmlView<ScopedViewModelB> { - @InjectViewModel + + @InjectViewModel public ScopedViewModelB viewModel; - + + @FXML + public ScopedFxmlViewC subviewCController; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java new file mode 100644 index 000000000..870bedb35 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java @@ -0,0 +1,38 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.internal.Context; +import de.saxsys.mvvmfx.internal.InjectContext; +import javafx.fxml.FXML; +import javafx.scene.layout.VBox; + +public class ScopedFxmlViewC implements FxmlView<ScopedViewModelC> { + + @InjectViewModel + ScopedViewModelC viewModel; + + @FXML + VBox root; + + @InjectContext + Context context; + + ScopedFxmlViewD subViewDController; + ScopedFxmlViewD subViewDWithoutContextController; + + public void initialize() { + ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load = FluentViewLoader.fxmlView(ScopedFxmlViewD.class) + .context(context) + .load(); + root.getChildren().add(load.getView()); + subViewDController = load.getCodeBehind(); + + ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load2 = FluentViewLoader.fxmlView(ScopedFxmlViewD.class).load(); + root.getChildren().add(load2.getView()); + subViewDWithoutContextController = load2.getCodeBehind(); + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java new file mode 100644 index 000000000..1e02dd304 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ScopedFxmlViewD implements FxmlView<ScopedViewModelD> { + + @InjectViewModel + ScopedViewModelD viewModel; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index bc40150b4..6163a7240 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -16,56 +16,25 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.value.ChangeListener; /** * * @author alexander.casall */ public class ScopedViewModelA implements ViewModel { - - @InjectScope - public TestScope injectedScope1; - - @InjectScope("coolId2") - public TestScope injectedScope2; - - @InjectScope("coolId3") - public TestScope injectedScope3; - - public final TestScope lazyScope1; - public final TestScope lazyScope2; - public final TestScope lazyScope3; + @InjectScope + public TestScope1 injectedScope1; + + private final BooleanProperty reference = new SimpleBooleanProperty(); + + public void initialize() { + // Create Potential Memory Leaks + injectedScope1.someProperty.addListener((observable, oldValue, newValue) -> reference.set(newValue)); + } - private final BooleanProperty reference = new SimpleBooleanProperty(); - - public ScopedViewModelA() { - ScopeStore scopeStore = ScopeStore.getInstance(); - lazyScope1 = scopeStore.getScope(TestScope.class); - lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); - lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); - } - - public void initialize() { - // Create Potential Memory Leaks - injectedScope1.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - injectedScope2.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - injectedScope3.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - lazyScope1.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - lazyScope2.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - lazyScope3.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - } - } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java index 24c277bf0..6103816f4 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java @@ -16,57 +16,26 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.ScopeStore; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.value.ChangeListener; /** * * @author alexander.casall - * + * */ public class ScopedViewModelB implements ViewModel { - - @InjectScope - public TestScope injectedScope1; - - @InjectScope("coolId2") - public TestScope injectedScope2; - - @InjectScope("coolId3") - public TestScope injectedScope3; - - public final TestScope lazyScope1; - public final TestScope lazyScope2; - public final TestScope lazyScope3; + @InjectScope + public TestScope1 injectedScope1; + + private final BooleanProperty reference = new SimpleBooleanProperty(); + + public void initialize() { + // Create Potential Memory Leaks + injectedScope1.someProperty.addListener((observable, oldValue, newValue) -> reference.set(newValue)); + } - private final BooleanProperty reference = new SimpleBooleanProperty(); - - public ScopedViewModelB() { - ScopeStore scopeStore = ScopeStore.getInstance(); - lazyScope1 = scopeStore.getScope(TestScope.class); - lazyScope2 = scopeStore.getScope(TestScope.class, "coolId2"); - lazyScope3 = scopeStore.getScope(TestScope.class, "coolId3"); - } - - public void initialize() { - // Create Potential Memory Leaks - injectedScope1.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - injectedScope2.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - injectedScope3.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - lazyScope1.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - lazyScope2.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - lazyScope3.someProperty - .addListener((observable, oldValue, newValue) -> reference.set(newValue)); - } - } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java new file mode 100644 index 000000000..de1066461 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; + +public class ScopedViewModelC implements ViewModel { + + @InjectScope + public TestScope1 injectedScope1; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java new file mode 100644 index 000000000..92ebd8515 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; + +public class ScopedViewModelD implements ViewModel { + + @InjectScope + public TestScope1 injectedScope1; + +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml index 534458eec..40cf5c449 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml @@ -2,5 +2,7 @@ <?import javafx.scene.layout.VBox?> <VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewA"> - +<children> + <fx:include fx:id="subviewC" source="ScopedFxmlViewC.fxml"/> +</children> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml index 9e3438afb..6520f081a 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml @@ -3,4 +3,8 @@ <?import javafx.scene.layout.VBox?> <VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewB"> +<children> + <fx:include fx:id="subviewC" source="ScopedFxmlViewC.fxml"/> +</children> + </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml new file mode 100644 index 000000000..ddae2b531 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewC" fx:id="root"> + +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml new file mode 100644 index 000000000..ecf9b5cc4 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewD"> + +</VBox> From e97a1b06d6892fde663f2de32ed254d010e2c307 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Fri, 29 Apr 2016 11:41:26 +0200 Subject: [PATCH 76/96] Nullchecks in tests --- .../java/de/saxsys/mvvmfx/scopes/ScopeTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index e343099d2..05e39ae66 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -46,13 +46,22 @@ private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewMode ScopedViewModelC viewModelCinB, ScopedViewModelD viewModelDinA, ScopedViewModelD viewModelDinB, ScopedViewModelD viewModelDinAWithoutContext, ScopedViewModelD viewModelDinBWithoutContext) { - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinAWithoutContext.injectedScope1); + Assert.assertNotNull(viewModelA); + Assert.assertNotNull(viewModelB); + Assert.assertNotNull(viewModelCinA); + Assert.assertNotNull(viewModelCinB); + Assert.assertNotNull(viewModelDinA); + Assert.assertNotNull(viewModelDinB); + Assert.assertNotNull(viewModelDinAWithoutContext); + Assert.assertNotNull(viewModelDinBWithoutContext); + Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); Assert.assertEquals(viewModelA.injectedScope1, viewModelDinA.injectedScope1); + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinAWithoutContext.injectedScope1); - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinBWithoutContext.injectedScope1); Assert.assertEquals(viewModelB.injectedScope1, viewModelCinB.injectedScope1); Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinBWithoutContext.injectedScope1); Assert.assertNotEquals(viewModelA.injectedScope1, viewModelCinB); Assert.assertNotEquals(viewModelB.injectedScope1, viewModelCinA); From f9afc6499bd6d467102087726b9fd820adc00ce6 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 2 May 2016 09:29:23 +0200 Subject: [PATCH 77/96] @ScopeProvider that can be used on ViewModel Classes to declare which instances should get created on this Component level --- .../mvvmfx/{internal => }/InjectContext.java | 2 +- .../java/de/saxsys/mvvmfx/ScopeProvider.java | 12 +++++++++ .../de/saxsys/mvvmfx/internal/Context.java | 10 ++++++- .../internal/viewloader/FxmlViewLoader.java | 6 ++--- .../internal/viewloader/JavaViewLoader.java | 2 +- .../viewloader/ViewLoaderReflectionUtils.java | 27 +++++++++++++++---- .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 22 ++++++++------- .../saxsys/mvvmfx/scopes/ScopedFxmlViewC.java | 5 +++- .../mvvmfx/scopes/ScopedViewModelA.java | 2 ++ 9 files changed, 66 insertions(+), 22 deletions(-) rename mvvmfx/src/main/java/de/saxsys/mvvmfx/{internal => }/InjectContext.java (89%) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectContext.java similarity index 89% rename from mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java rename to mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectContext.java index 1679252c8..fb1e52262 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/InjectContext.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/InjectContext.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.internal; +package de.saxsys.mvvmfx; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java new file mode 100644 index 000000000..5b0823ea8 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ScopeProvider { + Class<? extends Scope>[] scopes(); +} \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java index 1af6ed062..ef7bfb1c6 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java @@ -9,11 +9,19 @@ public class Context { private Map<Class<? extends Scope>, Object> scopeContext; + /** + * Gets private in future + */ + @Deprecated public Context() { this(new HashMap<>()); } - protected Context(Map<Class<? extends Scope>, Object> scopeContext) { + /** + * Gets private in future + */ + @Deprecated + public Context(Map<Class<? extends Scope>, Object> scopeContext) { this.scopeContext = scopeContext; } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index fcf918d71..09a995cbd 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -178,7 +178,7 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi actualViewModel = viewModel; } if (actualViewModel != null) { - ViewLoaderReflectionUtils.injectScope(actualViewModel, context); + ViewLoaderReflectionUtils.createAndInjectScopes(actualViewModel, context); } return new ViewTuple<>(loadedController, loadedRoot, actualViewModel); @@ -260,7 +260,7 @@ private static void handleInjection(View codeBehind, ResourceBundle resourceBund Consumer<ViewModel> newVmConsumer = viewModel -> { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - ViewLoaderReflectionUtils.injectScope(viewModel, context); + ViewLoaderReflectionUtils.createAndInjectScopes(viewModel, context); ViewLoaderReflectionUtils.initializeViewModel(viewModel); }; @@ -274,7 +274,7 @@ private static void handleInjection(View codeBehind, ResourceBundle resourceBund if (viewModel != null) { ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle); - ViewLoaderReflectionUtils.injectScope(viewModel, context); + ViewLoaderReflectionUtils.createAndInjectScopes(viewModel, context); ViewLoaderReflectionUtils.injectViewModel(codeBehind, viewModel); ViewLoaderReflectionUtils.injectContext(codeBehind, context); } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 20a8cada4..97422a607 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -120,7 +120,7 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi // if the user has provided an existing ViewModel, we will not // (re-)initialize this existing instance if (existingViewModel == null) { - ViewLoaderReflectionUtils.injectScope(viewModel, context); + ViewLoaderReflectionUtils.createAndInjectScopes(viewModel, context); ViewLoaderReflectionUtils.initializeViewModel(viewModel); } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index fa3c0888c..a8dff6ffc 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -27,12 +27,13 @@ import java.util.function.Consumer; import java.util.stream.Collectors; +import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.Context; -import de.saxsys.mvvmfx.internal.InjectContext; import net.jodah.typetools.TypeResolver; /** @@ -269,10 +270,24 @@ public static <V extends View<? extends VM>, VM extends ViewModel> void createAn } } - static void injectScope(Object viewModel, Context context) { + static void createAndInjectScopes(Object viewModel, Context context) { - // FIXME + // FIXME CLEANUP!!! + Class<? extends Object> viewModelClass = viewModel.getClass(); + + for (Annotation annotation : viewModelClass.getDeclaredAnnotations()) { + if (annotation.annotationType().isAssignableFrom(ScopeProvider.class)) { + ScopeProvider provider = (ScopeProvider) annotation; + Class<? extends Scope>[] scopes = provider.scopes(); + for (int i = 0; i < scopes.length; i++) { + Class<? extends Scope> scopeType = scopes[i]; + // Overrides existing scopes!!!! + context.getScopeBottich().put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); + } + } + } + // Inject List<Field> scopeFields = getScopeFields(viewModel.getClass()); scopeFields.forEach(scopeField -> { @@ -310,8 +325,10 @@ static Object injectScopeIntoField(Field scopeField, Object viewModel, Context c Object newScope = scopeBottich.get(scopeType); if (newScope == null) { - scopeBottich.put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); - newScope = scopeBottich.get(scopeType); + // TODO Modify Stacktrace to get the Injectionpoint of the Scope + throw new IllegalStateException( + "A scope was requested but no @ScopeProvider found in the hirarchy. Declare it like this: @ScopeProvider(" + + scopeType.getName() + ")"); } if (!newScope.getClass().equals(scopeType)) { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index 05e39ae66..d31385e0c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -32,19 +32,25 @@ public void testFxmlScopedView() throws Exception { ScopedViewModelC viewModelCinA = parentView.subviewAController.subviewCController.viewModel; ScopedViewModelD viewModelDinA = parentView.subviewAController.subviewCController.subViewDController.viewModel; - ScopedViewModelD viewModelDinAWithoutContext = parentView.subviewAController.subviewCController.subViewDWithoutContextController.viewModel; ScopedViewModelC viewModelCinB = parentView.subviewBController.subviewCController.viewModel; ScopedViewModelD viewModelDinB = parentView.subviewBController.subviewCController.subViewDController.viewModel; - ScopedViewModelD viewModelDinBWithoutContext = parentView.subviewBController.subviewCController.subViewDWithoutContextController.viewModel; - verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB, - viewModelDinAWithoutContext, viewModelDinBWithoutContext); + verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB); + } + + @Test(expected = Exception.class) + public void testErrorWhenNoScopeProviderFound() { + + final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) + .load() + .getCodeBehind(); + + parentView.subviewAController.subviewCController.loadWrongScopedView(); } private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB, ScopedViewModelC viewModelCinA, - ScopedViewModelC viewModelCinB, ScopedViewModelD viewModelDinA, ScopedViewModelD viewModelDinB, - ScopedViewModelD viewModelDinAWithoutContext, ScopedViewModelD viewModelDinBWithoutContext) { + ScopedViewModelC viewModelCinB, ScopedViewModelD viewModelDinA, ScopedViewModelD viewModelDinB) { Assert.assertNotNull(viewModelA); Assert.assertNotNull(viewModelB); @@ -52,16 +58,12 @@ private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewMode Assert.assertNotNull(viewModelCinB); Assert.assertNotNull(viewModelDinA); Assert.assertNotNull(viewModelDinB); - Assert.assertNotNull(viewModelDinAWithoutContext); - Assert.assertNotNull(viewModelDinBWithoutContext); Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); Assert.assertEquals(viewModelA.injectedScope1, viewModelDinA.injectedScope1); - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinAWithoutContext.injectedScope1); Assert.assertEquals(viewModelB.injectedScope1, viewModelCinB.injectedScope1); Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelDinBWithoutContext.injectedScope1); Assert.assertNotEquals(viewModelA.injectedScope1, viewModelCinB); Assert.assertNotEquals(viewModelB.injectedScope1, viewModelCinA); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java index 870bedb35..4b18e974e 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java @@ -2,10 +2,10 @@ import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.ViewTuple; import de.saxsys.mvvmfx.internal.Context; -import de.saxsys.mvvmfx.internal.InjectContext; import javafx.fxml.FXML; import javafx.scene.layout.VBox; @@ -30,6 +30,9 @@ public void initialize() { root.getChildren().add(load.getView()); subViewDController = load.getCodeBehind(); + } + + public void loadWrongScopedView() { ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load2 = FluentViewLoader.fxmlView(ScopedFxmlViewD.class).load(); root.getChildren().add(load2.getView()); subViewDWithoutContextController = load2.getCodeBehind(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 6163a7240..5da9db855 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -16,6 +16,7 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import javafx.beans.property.BooleanProperty; @@ -25,6 +26,7 @@ * * @author alexander.casall */ +@ScopeProvider(scopes = { TestScope1.class }) public class ScopedViewModelA implements ViewModel { @InjectScope From fefface3e06ed9783d813731cb0d23430e9e3aab Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 2 May 2016 12:54:27 +0200 Subject: [PATCH 78/96] Renaming --- .../java/de/saxsys/mvvmfx/internal/Context.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java index ef7bfb1c6..da7c956a0 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java @@ -7,7 +7,7 @@ public class Context { - private Map<Class<? extends Scope>, Object> scopeContext; + private final Map<Class<? extends Scope>, Object> scopeContext; /** * Gets private in future @@ -28,18 +28,16 @@ public Context(Map<Class<? extends Scope>, Object> scopeContext) { /** * @return the scopeBottich */ - public Map<Class<? extends Scope>, Object> getScopeBottich() { + public Map<Class<? extends Scope>, Object> getScopeContext() { return scopeContext; } /** - * @param scopeBottich - * the scopeBottich to set + * Private! + * + * @return */ - public void setScopeBottich(Map<Class<? extends Scope>, Object> scopeBottich) { - this.scopeContext = scopeBottich; - } - + @Deprecated public Context copy() { Map<Class<? extends Scope>, Object> scopeContextCopy = new HashMap<>(); scopeContextCopy.putAll(scopeContext); From 57869a36b8596898af777c03899b92b22fa365d2 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 2 May 2016 13:33:19 +0200 Subject: [PATCH 79/96] Visibility of Context + provideScope method for view loader --- .../main/java/de/saxsys/mvvmfx/Context.java | 5 ++ .../de/saxsys/mvvmfx/FluentViewLoader.java | 21 ++++++-- .../{Context.java => Impl_Context.java} | 23 +++------ .../internal/viewloader/FxmlViewLoader.java | 49 ++++++++++++++----- .../internal/viewloader/JavaViewLoader.java | 28 +++++++++-- .../viewloader/ViewLoaderReflectionUtils.java | 13 ++--- .../viewloader/example/TestScope2.java | 4 +- .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 3 ++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewC.java | 14 +++++- .../mvvmfx/scopes/ScopedViewModelD.java | 4 ++ 10 files changed, 117 insertions(+), 47 deletions(-) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/Context.java rename mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/{Context.java => Impl_Context.java} (60%) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/Context.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Context.java new file mode 100644 index 000000000..8345b1750 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/Context.java @@ -0,0 +1,5 @@ +package de.saxsys.mvvmfx; + +public interface Context { + +} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java index 80ec1b96d..e3add68b8 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java @@ -1,8 +1,9 @@ package de.saxsys.mvvmfx; +import java.util.Arrays; +import java.util.List; import java.util.ResourceBundle; -import de.saxsys.mvvmfx.internal.Context; import de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader; import de.saxsys.mvvmfx.internal.viewloader.JavaViewLoader; import de.saxsys.mvvmfx.internal.viewloader.ResourceBundleManager; @@ -64,6 +65,7 @@ public static class JavaViewStep<ViewType extends JavaView<? extends ViewModelTy private ViewModelType viewModel; private ViewType codeBehind; private Context context; + private List<Scope> providedScopes; JavaViewStep(Class<? extends ViewType> viewType) { this.viewType = viewType; @@ -74,6 +76,11 @@ public JavaViewStep<ViewType, ViewModelType> context(Context context) { return this; } + public JavaViewStep<ViewType, ViewModelType> providedScopes(Scope... providedScopes) { + this.providedScopes = Arrays.asList(providedScopes); + return this; + } + /** * Provide a {@link ResourceBundle} that is used while loading this * view. Note: It is possible to provide a global application-wide @@ -138,8 +145,8 @@ public ViewTuple<ViewType, ViewModelType> load() { JavaViewLoader javaViewLoader = new JavaViewLoader(); return javaViewLoader.loadJavaViewTuple(viewType, - ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), viewModel, codeBehind, - context); + ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), viewModel, codeBehind, context, + providedScopes); } } @@ -164,6 +171,7 @@ public static class FxmlViewStep<ViewType extends FxmlView<? extends ViewModelTy private ViewType codeBehind; private ViewModelType viewModel; private Context context; + private List<Scope> providedScopes; FxmlViewStep(Class<? extends ViewType> viewType) { this.viewType = viewType; @@ -174,6 +182,11 @@ public FxmlViewStep<ViewType, ViewModelType> context(Context context) { return this; } + public FxmlViewStep<ViewType, ViewModelType> providedScopes(Scope... providedScopes) { + this.providedScopes = Arrays.asList(providedScopes); + return this; + } + /** * Provide a {@link ResourceBundle} that is used while loading this * view. Note: It is possible to provide a global application-wide @@ -256,7 +269,7 @@ public ViewTuple<ViewType, ViewModelType> load() { return fxmlViewLoader.loadFxmlViewTuple(viewType, ResourceBundleManager.getInstance().mergeWithGlobal(resourceBundle), codeBehind, root, viewModel, - context); + context, providedScopes); } } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java similarity index 60% rename from mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java rename to mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java index da7c956a0..62df4eba2 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Context.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java @@ -3,31 +3,21 @@ import java.util.HashMap; import java.util.Map; +import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.Scope; -public class Context { +public class Impl_Context implements Context { private final Map<Class<? extends Scope>, Object> scopeContext; - /** - * Gets private in future - */ - @Deprecated - public Context() { + public Impl_Context() { this(new HashMap<>()); } - /** - * Gets private in future - */ - @Deprecated - public Context(Map<Class<? extends Scope>, Object> scopeContext) { + protected Impl_Context(Map<Class<? extends Scope>, Object> scopeContext) { this.scopeContext = scopeContext; } - /** - * @return the scopeBottich - */ public Map<Class<? extends Scope>, Object> getScopeContext() { return scopeContext; } @@ -37,11 +27,10 @@ public Map<Class<? extends Scope>, Object> getScopeContext() { * * @return */ - @Deprecated - public Context copy() { + public Impl_Context copy() { Map<Class<? extends Scope>, Object> scopeContextCopy = new HashMap<>(); scopeContextCopy.putAll(scopeContext); - Context contextCopy = new Context(scopeContextCopy); + Impl_Context contextCopy = new Impl_Context(scopeContextCopy); return contextCopy; } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 09a995cbd..1d771f14b 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -17,15 +17,18 @@ import java.io.IOException; import java.net.URL; +import java.util.List; import java.util.ResourceBundle; import java.util.function.Consumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import de.saxsys.mvvmfx.Context; +import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.internal.Context; +import de.saxsys.mvvmfx.internal.Impl_Context; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.util.Callback; @@ -65,9 +68,10 @@ public class FxmlViewLoader { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( Class<? extends ViewType> viewType, ResourceBundle resourceBundle, ViewType codeBehind, Object root, - ViewModelType viewModel, Context context) { + ViewModelType viewModel, Context context, List<Scope> providedScopes) { + final String pathToFXML = createFxmlPath(viewType); - return loadFxmlViewTuple(pathToFXML, resourceBundle, codeBehind, root, viewModel, context); + return loadFxmlViewTuple(pathToFXML, resourceBundle, codeBehind, root, viewModel, context, providedScopes); } /** @@ -129,11 +133,30 @@ private String createFxmlPath(Class<?> viewType) { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( final String resource, ResourceBundle resourceBundle, final ViewType codeBehind, final Object root, - ViewModelType viewModel, Context parentContext) { + ViewModelType viewModel, Context parentContext, List<Scope> providedScopes) { try { - // FIXME woanders hin - Context context = parentContext == null ? new Context() : parentContext.copy(); + // FIXME Refactoring + woanders hin --> Duplicated Code in + // JavaViewLoader + Impl_Context context = null; + + if (parentContext == null) { + context = new Impl_Context(); + } else { + if (parentContext instanceof Impl_Context) { + context = (Impl_Context) parentContext; + } + } + + final Impl_Context finalContext = context; + + if (providedScopes != null) { + providedScopes.forEach(scope -> { + finalContext.getScopeContext().put(scope.getClass(), scope); + }); + } + + ////////////////////////////////////////////////////////////////////// final FXMLLoader loader = createFxmlLoader(resource, resourceBundle, codeBehind, root, viewModel, context); @@ -189,7 +212,7 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi } private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View codeBehind, Object root, - ViewModel viewModel, Context context) throws IOException { + ViewModel viewModel, Impl_Context context) throws IOException { // Load FXML file final URL location = FxmlViewLoader.class.getResource(resource); if (location == null) { @@ -234,9 +257,9 @@ private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBund */ private static class DefaultControllerFactory implements Callback<Class<?>, Object> { private final ResourceBundle resourceBundle; - private final Context context; + private final Impl_Context context; - public DefaultControllerFactory(ResourceBundle resourceBundle, Context context) { + public DefaultControllerFactory(ResourceBundle resourceBundle, Impl_Context context) { this.resourceBundle = resourceBundle; this.context = context; } @@ -255,7 +278,7 @@ public Object call(Class<?> type) { } } - private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, Context context) { + private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, Impl_Context context) { ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); Consumer<ViewModel> newVmConsumer = viewModel -> { @@ -269,7 +292,7 @@ private static void handleInjection(View codeBehind, ResourceBundle resourceBund } private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, ViewModel viewModel, - Context context) { + Impl_Context context) { ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); if (viewModel != null) { @@ -316,10 +339,10 @@ private static class ControllerFactoryForCustomViewModel implements Callback<Cla private final ResourceBundle resourceBundle; - private final Context context; + private final Impl_Context context; public ControllerFactoryForCustomViewModel(ViewModel customViewModel, ResourceBundle resourceBundle, - Context context) { + Impl_Context context) { this.customViewModel = customViewModel; this.resourceBundle = resourceBundle; this.context = context; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 97422a607..504c2e209 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -26,9 +26,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import de.saxsys.mvvmfx.Context; +import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.internal.Context; +import de.saxsys.mvvmfx.internal.Impl_Context; import javafx.fxml.Initializable; import javafx.scene.Parent; @@ -77,10 +79,28 @@ public class JavaViewLoader { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadJavaViewTuple( Class<? extends ViewType> viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel, - ViewType codeBehind, Context parentContext) { + ViewType codeBehind, Context parentContext, List<Scope> providedScopes) { - // FIXME woanders hin - Context context = parentContext == null ? new Context() : parentContext.copy(); + // FIXME REFACTORING + DUPLICATED CODE IN FXMLVIEWLOADER!!!!!!! + Impl_Context context = null; + + if (parentContext == null) { + context = new Impl_Context(); + } else { + if (parentContext instanceof Impl_Context) { + context = (Impl_Context) parentContext; + } + } + + final Impl_Context finalContext = context; + + if (providedScopes != null) { + providedScopes.forEach(scope -> { + finalContext.getScopeContext().put(scope.getClass(), scope); + }); + } + ////////////// + //////////////////////////// DependencyInjector injectionFacade = DependencyInjector.getInstance(); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index a8dff6ffc..9c93953ca 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -27,13 +27,14 @@ import java.util.function.Consumer; import java.util.stream.Collectors; +import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.Context; +import de.saxsys.mvvmfx.internal.Impl_Context; import net.jodah.typetools.TypeResolver; /** @@ -270,7 +271,7 @@ public static <V extends View<? extends VM>, VM extends ViewModel> void createAn } } - static void createAndInjectScopes(Object viewModel, Context context) { + static void createAndInjectScopes(Object viewModel, Impl_Context context) { // FIXME CLEANUP!!! Class<? extends Object> viewModelClass = viewModel.getClass(); @@ -282,7 +283,7 @@ static void createAndInjectScopes(Object viewModel, Context context) { for (int i = 0; i < scopes.length; i++) { Class<? extends Scope> scopeType = scopes[i]; // Overrides existing scopes!!!! - context.getScopeBottich().put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); + context.getScopeContext().put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); } } } @@ -296,7 +297,7 @@ static void createAndInjectScopes(Object viewModel, Context context) { }); } - public static void injectContext(View codeBehind, Context context) { + public static void injectContext(View codeBehind, Impl_Context context) { Optional<Field> contextField = getContextField(codeBehind.getClass()); @@ -308,7 +309,7 @@ public static void injectContext(View codeBehind, Context context) { } } - static Object injectScopeIntoField(Field scopeField, Object viewModel, Context context) + static Object injectScopeIntoField(Field scopeField, Object viewModel, Impl_Context context) throws IllegalAccessException { Class<? extends Scope> scopeType = (Class<? extends Scope>) scopeField.getType(); @@ -321,7 +322,7 @@ static Object injectScopeIntoField(Field scopeField, Object viewModel, Context c + "but the viewModel <" + viewModel + "> has a field that violates this rule."); } - Map<Class<? extends Scope>, Object> scopeBottich = context.getScopeBottich(); + Map<Class<? extends Scope>, Object> scopeBottich = context.getScopeContext(); Object newScope = scopeBottich.get(scopeType); if (newScope == null) { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java index 8be91591d..fa4593450 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/internal/viewloader/example/TestScope2.java @@ -1,5 +1,7 @@ package de.saxsys.mvvmfx.internal.viewloader.example; -public class TestScope2 { +import de.saxsys.mvvmfx.Scope; + +public class TestScope2 implements Scope { } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index d31385e0c..a6b81283c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -67,6 +67,9 @@ private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewMode Assert.assertNotEquals(viewModelA.injectedScope1, viewModelCinB); Assert.assertNotEquals(viewModelB.injectedScope1, viewModelCinA); + + Assert.assertNotNull(viewModelDinB.injectedScope2); + } } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java index 4b18e974e..350854064 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java @@ -1,11 +1,13 @@ package de.saxsys.mvvmfx.scopes; +import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.internal.Context; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope2; import javafx.fxml.FXML; import javafx.scene.layout.VBox; @@ -26,10 +28,10 @@ public class ScopedFxmlViewC implements FxmlView<ScopedViewModelC> { public void initialize() { ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load = FluentViewLoader.fxmlView(ScopedFxmlViewD.class) .context(context) + .providedScopes(new TestScope2()) .load(); root.getChildren().add(load.getView()); subViewDController = load.getCodeBehind(); - } public void loadWrongScopedView() { @@ -38,4 +40,12 @@ public void loadWrongScopedView() { subViewDWithoutContextController = load2.getCodeBehind(); } + public void loadCorrectScopedView() { + ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load2 = FluentViewLoader.fxmlView(ScopedFxmlViewD.class) + .providedScopes(new TestScope1(), new TestScope2()) + .load(); + root.getChildren().add(load2.getView()); + subViewDWithoutContextController = load2.getCodeBehind(); + } + } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java index 92ebd8515..3e589ab22 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java @@ -3,10 +3,14 @@ import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope2; public class ScopedViewModelD implements ViewModel { @InjectScope public TestScope1 injectedScope1; + @InjectScope + public TestScope2 injectedScope2; + } From ec8a8f71a4e4609b32f6934007d28856dbe8d9cf Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 2 May 2016 13:41:34 +0200 Subject: [PATCH 80/96] Refactoring --- .../internal/viewloader/FxmlViewLoader.java | 22 ++----------- .../internal/viewloader/JavaViewLoader.java | 21 ++---------- .../viewloader/ViewLoaderScopeUtils.java | 33 +++++++++++++++++++ 3 files changed, 37 insertions(+), 39 deletions(-) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 1d771f14b..02e31a3f7 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -136,26 +136,8 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi ViewModelType viewModel, Context parentContext, List<Scope> providedScopes) { try { - // FIXME Refactoring + woanders hin --> Duplicated Code in - // JavaViewLoader - Impl_Context context = null; - - if (parentContext == null) { - context = new Impl_Context(); - } else { - if (parentContext instanceof Impl_Context) { - context = (Impl_Context) parentContext; - } - } - - final Impl_Context finalContext = context; - - if (providedScopes != null) { - providedScopes.forEach(scope -> { - finalContext.getScopeContext().put(scope.getClass(), scope); - }); - } - + // FIXME Woanders hin? + Impl_Context context = ViewLoaderScopeUtils.prepareContext(parentContext, providedScopes); ////////////////////////////////////////////////////////////////////// final FXMLLoader loader = createFxmlLoader(resource, resourceBundle, codeBehind, root, viewModel, context); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 504c2e209..8b020d153 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -81,25 +81,8 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi Class<? extends ViewType> viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel, ViewType codeBehind, Context parentContext, List<Scope> providedScopes) { - // FIXME REFACTORING + DUPLICATED CODE IN FXMLVIEWLOADER!!!!!!! - Impl_Context context = null; - - if (parentContext == null) { - context = new Impl_Context(); - } else { - if (parentContext instanceof Impl_Context) { - context = (Impl_Context) parentContext; - } - } - - final Impl_Context finalContext = context; - - if (providedScopes != null) { - providedScopes.forEach(scope -> { - finalContext.getScopeContext().put(scope.getClass(), scope); - }); - } - ////////////// + // FIXME Woanders hin?! + Impl_Context context = ViewLoaderScopeUtils.prepareContext(parentContext, providedScopes); //////////////////////////// DependencyInjector injectionFacade = DependencyInjector.getInstance(); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java new file mode 100644 index 000000000..e18fbc032 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java @@ -0,0 +1,33 @@ +package de.saxsys.mvvmfx.internal.viewloader; + +import java.util.List; + +import de.saxsys.mvvmfx.Context; +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.internal.Impl_Context; + +public class ViewLoaderScopeUtils { + + public static Impl_Context prepareContext(Context parentContext, List<Scope> providedScopes) { + Impl_Context context = null; + + if (parentContext == null) { + context = new Impl_Context(); + } else { + if (parentContext instanceof Impl_Context) { + context = (Impl_Context) parentContext; + } + } + + final Impl_Context finalContext = context; + + if (providedScopes != null) { + providedScopes.forEach(scope -> { + finalContext.getScopeContext().put(scope.getClass(), scope); + }); + } + + return context; + } + +} From a234e534a5152ae271960348c5950cb6fa6cfcbb Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Mon, 2 May 2016 15:33:49 +0200 Subject: [PATCH 81/96] removed ScopeProvider --- .../java/de/saxsys/mvvmfx/ScopeProvider.java | 12 ------------ .../viewloader/ViewLoaderReflectionUtils.java | 16 ---------------- .../viewloader/ViewLoaderScopeUtils.java | 1 - .../java/de/saxsys/mvvmfx/scopes/ScopeTest.java | 2 ++ .../saxsys/mvvmfx/scopes/ScopedViewModelA.java | 2 -- .../mvvmfx/scopes/ScopesFxmlParentView.java | 3 +-- 6 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java deleted file mode 100644 index 5b0823ea8..000000000 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.saxsys.mvvmfx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ScopeProvider { - Class<? extends Scope>[] scopes(); -} \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 9c93953ca..24fa701b3 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -32,7 +32,6 @@ import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.Scope; -import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.Impl_Context; import net.jodah.typetools.TypeResolver; @@ -273,21 +272,6 @@ public static <V extends View<? extends VM>, VM extends ViewModel> void createAn static void createAndInjectScopes(Object viewModel, Impl_Context context) { - // FIXME CLEANUP!!! - Class<? extends Object> viewModelClass = viewModel.getClass(); - - for (Annotation annotation : viewModelClass.getDeclaredAnnotations()) { - if (annotation.annotationType().isAssignableFrom(ScopeProvider.class)) { - ScopeProvider provider = (ScopeProvider) annotation; - Class<? extends Scope>[] scopes = provider.scopes(); - for (int i = 0; i < scopes.length; i++) { - Class<? extends Scope> scopeType = scopes[i]; - // Overrides existing scopes!!!! - context.getScopeContext().put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); - } - } - } - // Inject List<Field> scopeFields = getScopeFields(viewModel.getClass()); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java index e18fbc032..9d309a895 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java @@ -26,7 +26,6 @@ public static Impl_Context prepareContext(Context parentContext, List<Scope> pro finalContext.getScopeContext().put(scope.getClass(), scope); }); } - return context; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index a6b81283c..e5feda756 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; public class ScopeTest { @@ -24,6 +25,7 @@ public void testJavaScopedView() throws Exception { public void testFxmlScopedView() throws Exception { final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) + .providedScopes(new TestScope1()) .load() .getCodeBehind(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 5da9db855..6163a7240 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -16,7 +16,6 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import javafx.beans.property.BooleanProperty; @@ -26,7 +25,6 @@ * * @author alexander.casall */ -@ScopeProvider(scopes = { TestScope1.class }) public class ScopedViewModelA implements ViewModel { @InjectScope diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java index f5bc4b175..94f04a3b7 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java @@ -1,9 +1,8 @@ package de.saxsys.mvvmfx.scopes; -import javafx.fxml.FXML; - import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.ViewModel; +import javafx.fxml.FXML; public class ScopesFxmlParentView implements FxmlView<ViewModel> { @FXML From 62ac27dfd886cce860a79b4a5788970f7a1af305 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Mon, 2 May 2016 18:21:32 +0200 Subject: [PATCH 82/96] Created an example for the scopes --- examples/mini-examples/pom.xml | 1 + examples/mini-examples/scopes-example/pom.xml | 36 +++++++ .../mvvmfx/examples/scopesexample/App.java | 45 ++++++++ .../scopesexample/model/Document.java | 36 +++++++ .../model/DocumentRepository.java | 33 ++++++ .../examples/scopesexample/model/Entity.java | 32 ++++++ .../examples/scopesexample/ui/MainView.fxml | 18 ++++ .../examples/scopesexample/ui/MainView.java | 62 +++++++++++ .../scopesexample/ui/MainViewModel.java | 63 +++++++++++ .../ui/documentdetails/DetailsScope.java | 19 ++++ .../documentdetails/DocumentDetailsView.fxml | 35 ++++++ .../documentdetails/DocumentDetailsView.java | 36 +++++++ .../DocumentDetailsViewModel.java | 85 +++++++++++++++ .../descriptionedit/DescriptionEditView.fxml | 18 ++++ .../descriptionedit/DescriptionEditView.java | 25 +++++ .../DescriptionEditViewModel.java | 48 +++++++++ .../ui/overview/OverviewScope.java | 18 ++++ .../ui/overview/OverviewView.fxml | 13 +++ .../ui/overview/OverviewView.java | 7 ++ .../ui/overview/OverviewViewModel.java | 8 ++ .../overview/detail/OverviewDetailView.fxml | 33 ++++++ .../overview/detail/OverviewDetailView.java | 43 ++++++++ .../detail/OverviewDetailViewModel.java | 73 +++++++++++++ .../overview/master/OverviewMasterView.fxml | 16 +++ .../overview/master/OverviewMasterView.java | 48 +++++++++ .../master/OverviewMasterViewModel.java | 101 ++++++++++++++++++ 26 files changed, 952 insertions(+) create mode 100644 examples/mini-examples/scopes-example/pom.xml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Document.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/DocumentRepository.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Entity.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.fxml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DetailsScope.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.fxml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsViewModel.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.fxml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditViewModel.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewScope.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewViewModel.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.fxml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailViewModel.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.fxml create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.java create mode 100644 examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterViewModel.java diff --git a/examples/mini-examples/pom.xml b/examples/mini-examples/pom.xml index a1e2525e0..4a5f3a60e 100644 --- a/examples/mini-examples/pom.xml +++ b/examples/mini-examples/pom.xml @@ -20,6 +20,7 @@ <module>helloworld</module> <module>helloworld-without-fxml</module> <module>welcome-example</module> + <module>scopes-example</module> </modules> diff --git a/examples/mini-examples/scopes-example/pom.xml b/examples/mini-examples/scopes-example/pom.xml new file mode 100644 index 000000000..d60d2863a --- /dev/null +++ b/examples/mini-examples/scopes-example/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>mini-examples</artifactId> + <groupId>de.saxsys.mvvmfx</groupId> + <version>1.5.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>scopes-example</artifactId> + + <!-- use resource files (fxml, css) from the java directory --> + <build> + <resources> + <resource> + <directory>src/main/java</directory> + </resource> + </resources> + </build> + + <dependencies> + <dependency> + <groupId>de.saxsys</groupId> + <artifactId>mvvmfx</artifactId> + </dependency> + <dependency> + <groupId>eu.lestard</groupId> + <artifactId>easy-di</artifactId> + <version>0.3.0</version> + </dependency> + </dependencies> + + +</project> \ No newline at end of file diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java new file mode 100644 index 000000000..6fb281470 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java @@ -0,0 +1,45 @@ +package de.saxsys.mvvmfx.examples.scopesexample; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.MvvmFX; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import de.saxsys.mvvmfx.examples.scopesexample.model.DocumentRepository; +import de.saxsys.mvvmfx.examples.scopesexample.ui.MainView; +import de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewScope; +import eu.lestard.easydi.EasyDI; +import javafx.application.Application; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +public class App extends Application { + + + public static void main(String[] args) { + launch(args); + } + + + @Override + public void start(Stage primaryStage) throws Exception { + + EasyDI easyDI = new EasyDI(); + DocumentRepository repository = easyDI.getInstance(DocumentRepository.class); + + repository.persist(new Document("Test1")); + repository.persist(new Document("Test2")); + repository.persist(new Document("Test3")); + + MvvmFX.setCustomDependencyInjector(easyDI::getInstance); + + Parent root = FluentViewLoader.fxmlView(MainView.class) + + // TODO: Not very nice. + .providedScopes(new OverviewScope()) + .load().getView(); + + + primaryStage.setScene(new Scene(root, 1200, 800)); + primaryStage.show(); + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Document.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Document.java new file mode 100644 index 000000000..9bcda4836 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Document.java @@ -0,0 +1,36 @@ +package de.saxsys.mvvmfx.examples.scopesexample.model; + +public class Document extends Entity { + + private String title; + + private String description; + + public Document(String title) { + this.title = title; + } + + public Document() { + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return title; + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/DocumentRepository.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/DocumentRepository.java new file mode 100644 index 000000000..ba67b639b --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/DocumentRepository.java @@ -0,0 +1,33 @@ +package de.saxsys.mvvmfx.examples.scopesexample.model; + +import javax.inject.Singleton; +import java.util.*; + +@Singleton +public class DocumentRepository { + + + private Map<String, Document> entities = new HashMap<>(); + + + public Optional<Document> findById(String id) { + return Optional.ofNullable(entities.get(id)); + } + + public Collection<Document> findAll() { + return entities.values(); + } + + public void persist(Document document) { + entities.put(document.getId(), document); + } + + public void remove(Document document) { + remove(document.getId()); + } + + public void remove(String id) { + entities.remove(id); + } + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Entity.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Entity.java new file mode 100644 index 000000000..82ec790fc --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/model/Entity.java @@ -0,0 +1,32 @@ +package de.saxsys.mvvmfx.examples.scopesexample.model; + +import java.util.UUID; + +public abstract class Entity { + + private final String id; + + public Entity() { + id = UUID.randomUUID().toString(); + } + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Entity entity = (Entity) o; + + return id != null ? id.equals(entity.id) : entity.id == null; + + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.fxml new file mode 100644 index 000000000..77167cd3e --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.fxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.TabPane?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.VBox?> + +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.scopesexample.ui.MainView"> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <AnchorPane> + <fx:include source="overview/OverviewView.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /> + </AnchorPane> + <TabPane fx:id="mainTabPane" tabClosingPolicy="ALL_TABS" VBox.vgrow="ALWAYS" /> + </children> + </VBox> + </children> +</AnchorPane> diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java new file mode 100644 index 000000000..bcf38b099 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java @@ -0,0 +1,62 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.DocumentDetailsView; +import javafx.application.Platform; +import javafx.collections.ListChangeListener; +import javafx.fxml.FXML; +import javafx.scene.Parent; +import javafx.scene.control.Tab; +import javafx.scene.control.TabPane; + +public class MainView implements FxmlView<MainViewModel> { + @FXML + public TabPane mainTabPane; + + @InjectViewModel + private MainViewModel viewModel; + + public void initialize() { + + Tab emptyTabPlaceholder = new Tab("Empty"); + emptyTabPlaceholder.setClosable(false); + + mainTabPane.getTabs().add(emptyTabPlaceholder); + + mainTabPane.getTabs().addListener((ListChangeListener<Tab>) c -> { + while(c.next()) { + + if(mainTabPane.getTabs().isEmpty()) { + Platform.runLater(() -> mainTabPane.getTabs().add(emptyTabPlaceholder)); + } else { + if(mainTabPane.getTabs().contains(emptyTabPlaceholder) && mainTabPane.getTabs().size() > 1) { + Platform.runLater(() -> mainTabPane.getTabs().remove(emptyTabPlaceholder)); + } + } + } + }); + + viewModel.onOpenDocument((title, scopes) -> { + + + Parent root = FluentViewLoader.fxmlView(DocumentDetailsView.class) + .providedScopes(scopes.toArray(new Scope[]{})) + .load() + .getView(); + + Tab tab = new Tab(); + tab.setText(title); + tab.setClosable(true); + tab.setContent(root); + + + + mainTabPane.getTabs().add(tab); + }); + } + + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java new file mode 100644 index 000000000..84295cfb2 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java @@ -0,0 +1,63 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.MvvmFX; +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import de.saxsys.mvvmfx.examples.scopesexample.model.DocumentRepository; +import de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.DetailsScope; +import de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewScope; +import de.saxsys.mvvmfx.utils.notifications.NotificationCenter; + +import javax.inject.Provider; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.function.BiConsumer; + +public class MainViewModel implements ViewModel { + + public static final String MESSAGE_OPEN_DOCUMENT = "MainViewModel.open_document"; + private final DocumentRepository repository; + private Provider<DetailsScope> detailsScopeProvider; + + private NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); + private BiConsumer<String, List<Scope>> openTabConsumer; + + + @InjectScope + private OverviewScope overviewScope; + + public MainViewModel(DocumentRepository repository, Provider<DetailsScope> detailsScopeProvider) { + this.repository = repository; + this.detailsScopeProvider = detailsScopeProvider; + + notificationCenter.subscribe(MESSAGE_OPEN_DOCUMENT, (k,v) -> { + if(v.length == 1 && v[0] instanceof String) { + String documentId = (String) v[0]; + + openDocument(documentId); + } + }); + } + + private void openDocument(String id) { + + Optional<Document> documentOptional = repository.findById(id); + + documentOptional.ifPresent(document -> { + if(openTabConsumer != null) { + final DetailsScope detailScope = detailsScopeProvider.get(); + detailScope.documentProperty().setValue(document); + + openTabConsumer.accept(document.getTitle(), Arrays.asList(detailScope, overviewScope)); + } + }); + } + + + public void onOpenDocument(BiConsumer<String, List<Scope>> openTabConsumer) { + this.openTabConsumer = openTabConsumer; + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DetailsScope.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DetailsScope.java new file mode 100644 index 000000000..e6f870a59 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DetailsScope.java @@ -0,0 +1,19 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails; + +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; + +public class DetailsScope implements Scope { + + public static final String UPDATE = "DetailsScope.UPDATE"; + + + private ObjectProperty<Document> document = new SimpleObjectProperty<>(); + + public ObjectProperty<Document> documentProperty() { + return document; + } + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.fxml new file mode 100644 index 000000000..5fa0d81ad --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.fxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.Separator?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.text.Font?> + +<VBox alignment="TOP_RIGHT" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.DocumentDetailsView"> + <children> + <Label maxWidth="1.7976931348623157E308" text="Document Details" textAlignment="CENTER"> + <font> + <Font size="24.0" /> + </font> + </Label> + <Separator maxWidth="1.7976931348623157E308" /> + <Label fx:id="titleLabel" maxWidth="1.7976931348623157E308" text="Title"> + <font> + <Font size="36.0" /> + </font> + </Label> + <Label fx:id="descriptionLabel" maxWidth="1.7976931348623157E308" text="Description"> + <font> + <Font size="36.0" /> + </font> + </Label> + <Label fx:id="isSelectedLabel" maxWidth="1.7976931348623157E308" text=""> + <font> + <Font size="36.0" /> + </font> + </Label> + <fx:include source="descriptionedit/DescriptionEditView.fxml" /> + <Separator maxWidth="1.7976931348623157E308" /> + <fx:include source="../overview/OverviewView.fxml" /> + </children> +</VBox> diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.java new file mode 100644 index 000000000..7d509d45d --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsView.java @@ -0,0 +1,36 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import javafx.beans.binding.Bindings; +import javafx.fxml.FXML; +import javafx.scene.control.Label; + +public class DocumentDetailsView implements FxmlView<DocumentDetailsViewModel> { + + @FXML + public Label titleLabel; + + @FXML + public Label descriptionLabel; + + @FXML + public Label isSelectedLabel; + + + @InjectViewModel + private DocumentDetailsViewModel viewModel; + + + public void initialize() { + titleLabel.textProperty().bindBidirectional(viewModel.titleProperty()); + descriptionLabel.textProperty().bindBidirectional(viewModel.descriptionProperty()); + + isSelectedLabel.textProperty().bind( + Bindings + .when(viewModel.isSelectedProperty()) + .then("This Document is selected") + .otherwise("This Document is not selected")); + } + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsViewModel.java new file mode 100644 index 000000000..30526d890 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/DocumentDetailsViewModel.java @@ -0,0 +1,85 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import de.saxsys.mvvmfx.examples.scopesexample.model.DocumentRepository; +import de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewScope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +public class DocumentDetailsViewModel implements ViewModel { + + private StringProperty title = new SimpleStringProperty(); + private StringProperty description = new SimpleStringProperty(); + + private BooleanProperty isSelected = new SimpleBooleanProperty(); + + + @InjectScope + private DetailsScope scope; + + @InjectScope + private OverviewScope overviewScope; + + + private final DocumentRepository repository; + + public DocumentDetailsViewModel(DocumentRepository repository) { + this.repository = repository; + } + + public void initialize() { + isSelected.bind(scope.documentProperty().isEqualTo(overviewScope.selectedDocumentProperty())); + + + scope.documentProperty().addListener((observable, oldValue, newValue) -> { + update(newValue); + }); + + scope.subscribe(DetailsScope.UPDATE, (k,v) -> update()); + + overviewScope.subscribe(OverviewScope.UPDATE, (k,v) -> { + + Document updatedDocument = overviewScope.selectedDocumentProperty().get(); + Document thisDocument = scope.documentProperty().get(); + + if(updatedDocument != null && thisDocument != null) { + if(updatedDocument.equals(thisDocument)) { + update(); + } + } + }); + + update(); + } + + private void update() { + update(scope.documentProperty().get()); + } + + private void update(Document document) { + if(document == null) { + title.setValue(""); + description.setValue(""); + } else { + title.setValue(document.getTitle()); + description.setValue(document.getDescription()); + } + } + + public StringProperty titleProperty() { + return title; + } + + public StringProperty descriptionProperty() { + return description; + } + + + public BooleanProperty isSelectedProperty() { + return isSelected; + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.fxml new file mode 100644 index 000000000..7fe8fc0e2 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.fxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.TextArea?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.VBox?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.descriptionedit.DescriptionEditView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <TextArea fx:id="description" VBox.vgrow="ALWAYS" /> + <Button mnemonicParsing="false" onAction="#save" text="Save Description" /> + </children> + </VBox> + </children> +</AnchorPane> diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.java new file mode 100644 index 000000000..b71eebc13 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditView.java @@ -0,0 +1,25 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.descriptionedit; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import javafx.fxml.FXML; +import javafx.scene.control.TextArea; + +public class DescriptionEditView implements FxmlView<DescriptionEditViewModel> { + + @FXML + public TextArea description; + + @InjectViewModel + private DescriptionEditViewModel viewModel; + + + public void initialize() { + description.textProperty().bindBidirectional(viewModel.descriptionProperty()); + } + + + public void save() { + viewModel.save(); + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditViewModel.java new file mode 100644 index 000000000..1709291a7 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/documentdetails/descriptionedit/DescriptionEditViewModel.java @@ -0,0 +1,48 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.descriptionedit; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.DetailsScope; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +public class DescriptionEditViewModel implements ViewModel { + + + private StringProperty description = new SimpleStringProperty(); + + + @InjectScope + private DetailsScope detailsScope; + + public void initialize() { + detailsScope.documentProperty().addListener((observable, oldValue, newValue) -> { + update(newValue); + }); + + detailsScope.subscribe(DetailsScope.UPDATE, (k,v) -> update(detailsScope.documentProperty().get())); + + update(detailsScope.documentProperty().get()); + } + + private void update(Document document) { + if(document == null) { + description.set(""); + } else { + description.set(document.getDescription()); + } + } + + public void save() { + Document document = detailsScope.documentProperty().get(); + + document.setDescription(description.get()); + detailsScope.publish(DetailsScope.UPDATE); + } + + public StringProperty descriptionProperty() { + return description; + } + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewScope.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewScope.java new file mode 100644 index 000000000..e1c3b7843 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewScope.java @@ -0,0 +1,18 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview; + +import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; + +public class OverviewScope implements Scope { + + public static final String UPDATE = "OverviewScope.update"; + + private ObjectProperty<Document> selectedDocument = new SimpleObjectProperty<>(); + + public ObjectProperty<Document> selectedDocumentProperty() { + return selectedDocument; + } + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml new file mode 100644 index 000000000..c14fe52bc --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.HBox?> + +<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <fx:include HBox.hgrow="ALWAYS" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" source="master/OverviewMasterView.fxml" /> + <fx:include HBox.hgrow="ALWAYS" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" source="detail/OverviewDetailView.fxml" /> + </HBox> + </children> +</AnchorPane> diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.java new file mode 100644 index 000000000..3d266664a --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.java @@ -0,0 +1,7 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview; + +import de.saxsys.mvvmfx.FxmlView; + +public class OverviewView implements FxmlView<OverviewViewModel> { + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewViewModel.java new file mode 100644 index 000000000..8e40e6b1e --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewViewModel.java @@ -0,0 +1,8 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview; + +import de.saxsys.mvvmfx.ViewModel; + + +public class OverviewViewModel implements ViewModel { + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.fxml new file mode 100644 index 000000000..0037afcf8 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.fxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.TextField?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.text.Font?> + +<VBox alignment="TOP_RIGHT" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.scopesexample.ui.overview.detail.OverviewDetailView"> + <children> + <HBox fx:id="displayBlock"> + <children> + <Label fx:id="titleLabel" maxWidth="1.7976931348623157E308" text="Title" HBox.hgrow="ALWAYS"> + <font> + <Font size="36.0" /> + </font> + </Label> + <Button mnemonicParsing="false" onAction="#edit" text="Edit" /> + </children> + </HBox> + <HBox fx:id="editBlock"> + <children> + <TextField fx:id="titleField" layoutY="53.0" maxWidth="1.7976931348623157E308"> + <font> + <Font size="36.0" /> + </font> + </TextField> + <Button mnemonicParsing="false" onAction="#save" text="Save" /> + </children> + </HBox> + </children> +</VBox> diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.java new file mode 100644 index 000000000..136e4acd2 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailView.java @@ -0,0 +1,43 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview.detail; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.HBox; + +public class OverviewDetailView implements FxmlView<OverviewDetailViewModel> { + + @FXML + public TextField titleField; + @FXML + public Label titleLabel; + + + @FXML + public HBox displayBlock; + @FXML + public HBox editBlock; + + @InjectViewModel + private OverviewDetailViewModel viewModel; + + public void initialize() { + titleField.textProperty().bindBidirectional(viewModel.titleProperty()); + titleLabel.textProperty().bind(viewModel.titleProperty()); + + displayBlock.visibleProperty().bind(viewModel.editModeProperty().not()); + displayBlock.managedProperty().bind(viewModel.editModeProperty().not()); + editBlock.visibleProperty().bind(viewModel.editModeProperty()); + editBlock.managedProperty().bind(viewModel.editModeProperty()); + } + + public void edit() { + viewModel.edit(); + } + + public void save() { + viewModel.save(); + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailViewModel.java new file mode 100644 index 000000000..72cab78e4 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/detail/OverviewDetailViewModel.java @@ -0,0 +1,73 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview.detail; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import de.saxsys.mvvmfx.examples.scopesexample.model.DocumentRepository; +import de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewScope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +public class OverviewDetailViewModel implements ViewModel { + + private StringProperty title = new SimpleStringProperty(); + + private BooleanProperty editMode = new SimpleBooleanProperty(false); + + @InjectScope + private OverviewScope scope; + + private final DocumentRepository repository; + + public OverviewDetailViewModel(DocumentRepository repository) { + this.repository = repository; + } + + + public void initialize() { + scope.selectedDocumentProperty().addListener((observable, oldValue, newValue) -> { + refresh(); + }); + + scope.subscribe(OverviewScope.UPDATE, (k,v) -> { + refresh(); + }); + } + + private void refresh() { + Document document = scope.selectedDocumentProperty().get(); + if(document == null) { + title.setValue(""); + } else { + title.setValue(document.getTitle()); + } + } + + public void edit() { + editMode.set(!editMode.getValue()); + } + + + public void save() { + Document document = scope.selectedDocumentProperty().get(); + + document.setTitle(titleProperty().get()); + + repository.persist(document); + + scope.publish(OverviewScope.UPDATE); + + editMode.setValue(false); + } + + public StringProperty titleProperty() { + return title; + } + + public BooleanProperty editModeProperty() { + return editMode; + } + +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.fxml new file mode 100644 index 000000000..c6e1417ed --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.fxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.ListView?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> + +<VBox minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.saxsys.mvvmfx.examples.scopesexample.ui.overview.master.OverviewMasterView"> + <children> + <ListView fx:id="documentList" maxHeight="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="50.0" VBox.vgrow="ALWAYS" /> + <HBox> + <Button mnemonicParsing="false" onAction="#newDocument" text="New" /> + <Button mnemonicParsing="false" onAction="#refresh" text="Refresh" /> + </HBox> + </children> +</VBox> diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.java new file mode 100644 index 000000000..c2a27e7f7 --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterView.java @@ -0,0 +1,48 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview.master; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import javafx.fxml.FXML; +import javafx.scene.control.ListView; + +public class OverviewMasterView implements FxmlView<OverviewMasterViewModel> { + + @FXML + public ListView<Document> documentList; + + @InjectViewModel + private OverviewMasterViewModel viewModel; + + + public void initialize() { + documentList.setItems(viewModel.documents()); + + viewModel.onSelectionChanged(newSelectedDocument -> { + if(newSelectedDocument == null) { + documentList.getSelectionModel().clearSelection(); + } else { + documentList.getSelectionModel().select(newSelectedDocument); + } + }); + + documentList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { + viewModel.changeSelection(newValue); + }); + + + documentList.setOnMouseClicked(event -> { + if(event.getClickCount() > 1) { + viewModel.open(); + } + }); + } + + public void newDocument() { + viewModel.addNewDocument(); + } + + public void refresh() { + viewModel.refresh(); + } +} diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterViewModel.java new file mode 100644 index 000000000..1ab7677af --- /dev/null +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/master/OverviewMasterViewModel.java @@ -0,0 +1,101 @@ +package de.saxsys.mvvmfx.examples.scopesexample.ui.overview.master; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.MvvmFX; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.model.Document; +import de.saxsys.mvvmfx.examples.scopesexample.model.DocumentRepository; +import de.saxsys.mvvmfx.examples.scopesexample.ui.MainViewModel; +import de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewScope; +import de.saxsys.mvvmfx.utils.notifications.NotificationCenter; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; + +import java.util.Collection; +import java.util.function.Consumer; + +public class OverviewMasterViewModel implements ViewModel { + + + private ObservableList<Document> documents = FXCollections.observableArrayList(); + private ObjectProperty<Document> selectedDocument = new SimpleObjectProperty<>(); + + private Consumer<Document> selectionChangedConsumer; + + @InjectScope + private OverviewScope scope; + + private DocumentRepository repository; + + private NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); + + public OverviewMasterViewModel(DocumentRepository repository) { + this.repository = repository; + } + + public void initialize() { + + scope.selectedDocumentProperty().bindBidirectional(selectedDocument); + + + scope.subscribe(OverviewScope.UPDATE, (k,v) -> { + Collection<Document> all = repository.findAll(); + + + final Document previouslySelectedDocument = selectedDocument.get(); + + documents.clear(); + documents.addAll(all); + + if(documents.contains(previouslySelectedDocument)) { + if(selectionChangedConsumer != null) { + selectionChangedConsumer.accept(previouslySelectedDocument); + selectedDocument.setValue(previouslySelectedDocument); + } + } else { + selectedDocument.setValue(null); + } + + }); + + refresh(); + } + + public void onSelectionChanged(Consumer<Document> consumer) { + selectionChangedConsumer = consumer; + } + + public void changeSelection(Document newSelectedDocument) { + selectedDocument.setValue(newSelectedDocument); + } + + public void open() { + if(selectedDocument.get() != null) { + notificationCenter.publish(MainViewModel.MESSAGE_OPEN_DOCUMENT, selectedDocument.get().getId()); + } + } + + public void refresh() { + scope.publish(OverviewScope.UPDATE); + } + + public void addNewDocument() { + Document document = new Document(); + document.setTitle("unnamed"); + + repository.persist(document); + + refresh(); + } + + public ObservableList<Document> documents() { + return documents; + } + + public ObjectProperty<Document> selectedDocumentProperty() { + return selectedDocument; + } + +} From ac8328d72f6661f5b3935a80408a4b5dbb44a4c2 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 3 May 2016 15:22:20 +0200 Subject: [PATCH 83/96] Revert "removed ScopeProvider" This reverts commit a234e534a5152ae271960348c5950cb6fa6cfcbb. --- .../java/de/saxsys/mvvmfx/ScopeProvider.java | 12 ++++++++++++ .../viewloader/ViewLoaderReflectionUtils.java | 16 ++++++++++++++++ .../viewloader/ViewLoaderScopeUtils.java | 1 + .../java/de/saxsys/mvvmfx/scopes/ScopeTest.java | 2 -- .../saxsys/mvvmfx/scopes/ScopedViewModelA.java | 2 ++ .../mvvmfx/scopes/ScopesFxmlParentView.java | 3 ++- 6 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java new file mode 100644 index 000000000..5b0823ea8 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ScopeProvider.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ScopeProvider { + Class<? extends Scope>[] scopes(); +} \ No newline at end of file diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 24fa701b3..9c93953ca 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -32,6 +32,7 @@ import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.Impl_Context; import net.jodah.typetools.TypeResolver; @@ -272,6 +273,21 @@ public static <V extends View<? extends VM>, VM extends ViewModel> void createAn static void createAndInjectScopes(Object viewModel, Impl_Context context) { + // FIXME CLEANUP!!! + Class<? extends Object> viewModelClass = viewModel.getClass(); + + for (Annotation annotation : viewModelClass.getDeclaredAnnotations()) { + if (annotation.annotationType().isAssignableFrom(ScopeProvider.class)) { + ScopeProvider provider = (ScopeProvider) annotation; + Class<? extends Scope>[] scopes = provider.scopes(); + for (int i = 0; i < scopes.length; i++) { + Class<? extends Scope> scopeType = scopes[i]; + // Overrides existing scopes!!!! + context.getScopeContext().put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); + } + } + } + // Inject List<Field> scopeFields = getScopeFields(viewModel.getClass()); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java index 9d309a895..e18fbc032 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java @@ -26,6 +26,7 @@ public static Impl_Context prepareContext(Context parentContext, List<Scope> pro finalContext.getScopeContext().put(scope.getClass(), scope); }); } + return context; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index e5feda756..a6b81283c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import de.saxsys.mvvmfx.FluentViewLoader; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; public class ScopeTest { @@ -25,7 +24,6 @@ public void testJavaScopedView() throws Exception { public void testFxmlScopedView() throws Exception { final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) - .providedScopes(new TestScope1()) .load() .getCodeBehind(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 6163a7240..5da9db855 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -16,6 +16,7 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import javafx.beans.property.BooleanProperty; @@ -25,6 +26,7 @@ * * @author alexander.casall */ +@ScopeProvider(scopes = { TestScope1.class }) public class ScopedViewModelA implements ViewModel { @InjectScope diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java index 94f04a3b7..f5bc4b175 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java @@ -1,8 +1,9 @@ package de.saxsys.mvvmfx.scopes; +import javafx.fxml.FXML; + import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.ViewModel; -import javafx.fxml.FXML; public class ScopesFxmlParentView implements FxmlView<ViewModel> { @FXML From dfdd9d73d7fa97500a425c0797cb8fa0888fbee9 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 3 May 2016 17:54:44 +0200 Subject: [PATCH 84/96] Extended Test cases for Scopes --- .../de/saxsys/mvvmfx/FluentViewLoader.java | 2 + .../internal/viewloader/FxmlViewLoader.java | 7 ++- .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 48 ++++++++++++++++--- .../saxsys/mvvmfx/scopes/ScopedFxmlViewA.java | 12 +++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewB.java | 12 +++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewD.java | 8 ++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewE.java | 29 +++++++++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewF.java | 19 ++++++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewG.java | 20 ++++++++ .../mvvmfx/scopes/ScopedViewModelA.java | 7 +++ .../mvvmfx/scopes/ScopedViewModelB.java | 8 ++++ .../mvvmfx/scopes/ScopedViewModelE.java | 22 +++++++++ .../mvvmfx/scopes/ScopedViewModelF.java | 19 ++++++++ .../mvvmfx/scopes/ScopedViewModelG.java | 21 ++++++++ .../de/saxsys/mvvmfx/scopes/TestScope3.java | 10 ++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml | 1 + .../saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml | 1 + .../saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml | 8 ++++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml | 6 +++ .../saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml | 6 +++ 20 files changed, 259 insertions(+), 7 deletions(-) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java index e3add68b8..c687f79ef 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java @@ -183,6 +183,8 @@ public FxmlViewStep<ViewType, ViewModelType> context(Context context) { } public FxmlViewStep<ViewType, ViewModelType> providedScopes(Scope... providedScopes) { + + // TODO: add scopes instead of reinitialization this.providedScopes = Arrays.asList(providedScopes); return this; } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 02e31a3f7..2f1fc1ec4 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -183,7 +183,12 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi actualViewModel = viewModel; } if (actualViewModel != null) { - ViewLoaderReflectionUtils.createAndInjectScopes(actualViewModel, context); + // TODO: Create Testcase for this corner case: + // If this view is the root view (the one that is loaded with the FluentViewLoader) + // but in the view there is no injection of the ViewModel + // only in this case the scope has to be injected here, + // If the viewModel was already injected in the View, it has it's scopes already injected +// ViewLoaderReflectionUtils.createAndInjectScopes(actualViewModel, context); } return new ViewTuple<>(loadedController, loadedRoot, actualViewModel); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index a6b81283c..140959a94 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -5,6 +5,8 @@ import de.saxsys.mvvmfx.FluentViewLoader; +import static org.assertj.core.api.Assertions.assertThat; + public class ScopeTest { @Test @@ -36,6 +38,34 @@ public void testFxmlScopedView() throws Exception { ScopedViewModelC viewModelCinB = parentView.subviewBController.subviewCController.viewModel; ScopedViewModelD viewModelDinB = parentView.subviewBController.subviewCController.subViewDController.viewModel; + + ScopedViewModelE viewModel_A_E = parentView.subviewAController.subviewEController.viewModel; + ScopedViewModelF viewModel_A_E_F = parentView.subviewAController.subviewEController.subviewFController.viewModel; + ScopedViewModelG viewModel_A_E_G = parentView.subviewAController.subviewEController.subviewGController.viewModel; + + ScopedViewModelE viewModel_B_E = parentView.subviewBController.subviewEController.viewModel; + ScopedViewModelF viewModel_B_E_F = parentView.subviewBController.subviewEController.subviewFController.viewModel; + ScopedViewModelG viewModel_B_E_G = parentView.subviewBController.subviewEController.subviewGController.viewModel; + + + Assert.assertNotNull(viewModel_A_E); + Assert.assertNotNull(viewModel_A_E_F); + Assert.assertNotNull(viewModel_A_E_G); + Assert.assertNotNull(viewModel_B_E); + Assert.assertNotNull(viewModel_B_E_F); + Assert.assertNotNull(viewModel_B_E_G); + + + Assert.assertNotEquals(viewModel_A_E.testScope3, viewModel_B_E.testScope3); + + Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_F.testScope3); + Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_G.testScope3); + + Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_F.testScope3); + Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_G.testScope3); + + + verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB); } @@ -59,17 +89,23 @@ private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewMode Assert.assertNotNull(viewModelDinA); Assert.assertNotNull(viewModelDinB); + Assert.assertNotNull(viewModelA.injectedScope1); + Assert.assertNotNull(viewModelB.injectedScope1); + Assert.assertNotNull(viewModelCinA.injectedScope1); + Assert.assertNotNull(viewModelCinB.injectedScope1); + Assert.assertNotNull(viewModelDinA.injectedScope1); + Assert.assertNotNull(viewModelDinA.injectedScope2); + Assert.assertNotNull(viewModelDinB.injectedScope1); + Assert.assertNotNull(viewModelDinB.injectedScope2); + + + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelB.injectedScope1); + Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); Assert.assertEquals(viewModelA.injectedScope1, viewModelDinA.injectedScope1); Assert.assertEquals(viewModelB.injectedScope1, viewModelCinB.injectedScope1); Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelCinB); - Assert.assertNotEquals(viewModelB.injectedScope1, viewModelCinA); - - Assert.assertNotNull(viewModelDinB.injectedScope2); - } - } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java index 082522f06..9d67eb037 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java @@ -31,4 +31,16 @@ public class ScopedFxmlViewA implements FxmlView<ScopedViewModelA> { @FXML public ScopedFxmlViewC subviewCController; + + @FXML + public ScopedFxmlViewE subviewEController; + + + public ScopedFxmlViewA() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + } } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java index 580d2a494..59a0ace4c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java @@ -31,4 +31,16 @@ public class ScopedFxmlViewB implements FxmlView<ScopedViewModelB> { @FXML public ScopedFxmlViewC subviewCController; + + @FXML + public ScopedFxmlViewE subviewEController; + + + public ScopedFxmlViewB() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + } } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java index 1e02dd304..c635dfdaa 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java @@ -2,9 +2,17 @@ import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; +import javafx.fxml.FXML; +import javafx.scene.layout.VBox; public class ScopedFxmlViewD implements FxmlView<ScopedViewModelD> { + @FXML + public ScopedFxmlViewF subviewFController; + + @FXML + public ScopedFxmlViewG subviewGController; + @InjectViewModel ScopedViewModelD viewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java new file mode 100644 index 000000000..9ea6dab72 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java @@ -0,0 +1,29 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectContext; +import de.saxsys.mvvmfx.InjectViewModel; +import javafx.fxml.FXML; + +public class ScopedFxmlViewE implements FxmlView<ScopedViewModelE> { + + + @FXML + public ScopedFxmlViewF subviewFController; + + @FXML + public ScopedFxmlViewG subviewGController; + + + @InjectViewModel + public ScopedViewModelE viewModel; + + + public ScopedFxmlViewE() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java new file mode 100644 index 000000000..24a2b3638 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java @@ -0,0 +1,19 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ScopedFxmlViewF implements FxmlView<ScopedViewModelF> { + + @InjectViewModel + public ScopedViewModelF viewModel; + + + public ScopedFxmlViewF() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java new file mode 100644 index 000000000..076a8b0cd --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java @@ -0,0 +1,20 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ScopedFxmlViewG implements FxmlView<ScopedViewModelG> { + + + @InjectViewModel + public ScopedViewModelG viewModel; + + + public ScopedFxmlViewG() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java index 5da9db855..5b0047ed2 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java @@ -34,7 +34,14 @@ public class ScopedViewModelA implements ViewModel { private final BooleanProperty reference = new SimpleBooleanProperty(); + + public ScopedViewModelA() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + // Create Potential Memory Leaks injectedScope1.someProperty.addListener((observable, oldValue, newValue) -> reference.set(newValue)); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java index 6103816f4..e5374d00a 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java @@ -16,6 +16,7 @@ package de.saxsys.mvvmfx.scopes; import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import javafx.beans.property.BooleanProperty; @@ -26,6 +27,7 @@ * @author alexander.casall * */ +@ScopeProvider(scopes = {TestScope1.class}) public class ScopedViewModelB implements ViewModel { @InjectScope @@ -33,7 +35,13 @@ public class ScopedViewModelB implements ViewModel { private final BooleanProperty reference = new SimpleBooleanProperty(); + public ScopedViewModelB() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + // Create Potential Memory Leaks injectedScope1.someProperty.addListener((observable, oldValue, newValue) -> reference.set(newValue)); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java new file mode 100644 index 000000000..9b635d906 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java @@ -0,0 +1,22 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; +import de.saxsys.mvvmfx.ViewModel; + +@ScopeProvider(scopes = {TestScope3.class}) +public class ScopedViewModelE implements ViewModel{ + + @InjectScope + public TestScope3 testScope3; + + + public ScopedViewModelE() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + System.out.println("scope:" + System.identityHashCode(testScope3)); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java new file mode 100644 index 000000000..391fb95ee --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java @@ -0,0 +1,19 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; + +public class ScopedViewModelF implements ViewModel{ + + @InjectScope + public TestScope3 testScope3; + + public ScopedViewModelF() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + System.out.println("scope:" + System.identityHashCode(testScope3)); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java new file mode 100644 index 000000000..c1c3e58c4 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java @@ -0,0 +1,21 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; + +public class ScopedViewModelG implements ViewModel{ + + @InjectScope + public TestScope3 testScope3; + + + public ScopedViewModelG() { + System.out.println("new " + this.getClass().getSimpleName() + "()"); + } + + public void initialize() { + System.out.println(this.getClass().getSimpleName() + ".initialize()"); + System.out.println("scope:" + System.identityHashCode(testScope3)); + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java new file mode 100644 index 000000000..023f7594a --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java @@ -0,0 +1,10 @@ +package de.saxsys.mvvmfx.scopes; + +import de.saxsys.mvvmfx.Scope; + +public class TestScope3 implements Scope { + + public TestScope3() { + System.out.println("new " + this.getClass().getSimpleName() + "(), "+ System.identityHashCode(this)); + } +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml index 40cf5c449..dedd2eac1 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml @@ -4,5 +4,6 @@ <VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewA"> <children> <fx:include fx:id="subviewC" source="ScopedFxmlViewC.fxml"/> + <fx:include fx:id="subviewE" source="ScopedFxmlViewE.fxml"/> </children> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml index 6520f081a..8f2ed4c54 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml @@ -5,6 +5,7 @@ <children> <fx:include fx:id="subviewC" source="ScopedFxmlViewC.fxml"/> + <fx:include fx:id="subviewE" source="ScopedFxmlViewE.fxml"/> </children> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml new file mode 100644 index 000000000..3ad3ffd12 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewE"> + <fx:include fx:id="subviewF" source="ScopedFxmlViewF.fxml"/> + <fx:include fx:id="subviewG" source="ScopedFxmlViewG.fxml"/> + +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml new file mode 100644 index 000000000..f7f414294 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewF"> + +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml new file mode 100644 index 000000000..f7a889cfe --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewG"> + +</VBox> From d68075dcf935094a9a3c2b7d91c5e818f741aead Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 3 May 2016 17:56:49 +0200 Subject: [PATCH 85/96] Refactoring of the Scopes example project --- .../saxsys/mvvmfx/examples/scopesexample/App.java | 3 --- .../examples/scopesexample/ui/MainView.java | 15 ++++++++++----- .../examples/scopesexample/ui/MainViewModel.java | 12 +++--------- .../scopesexample/ui/overview/OverviewView.fxml | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java index 6fb281470..2262b25ab 100644 --- a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/App.java @@ -33,9 +33,6 @@ public void start(Stage primaryStage) throws Exception { MvvmFX.setCustomDependencyInjector(easyDI::getInstance); Parent root = FluentViewLoader.fxmlView(MainView.class) - - // TODO: Not very nice. - .providedScopes(new OverviewScope()) .load().getView(); diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java index bcf38b099..ee73200c2 100644 --- a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainView.java @@ -1,10 +1,8 @@ package de.saxsys.mvvmfx.examples.scopesexample.ui; -import de.saxsys.mvvmfx.FluentViewLoader; -import de.saxsys.mvvmfx.FxmlView; -import de.saxsys.mvvmfx.InjectViewModel; -import de.saxsys.mvvmfx.Scope; +import de.saxsys.mvvmfx.*; import de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.DocumentDetailsView; +import de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewScope; import javafx.application.Platform; import javafx.collections.ListChangeListener; import javafx.fxml.FXML; @@ -12,6 +10,8 @@ import javafx.scene.control.Tab; import javafx.scene.control.TabPane; + + public class MainView implements FxmlView<MainViewModel> { @FXML public TabPane mainTabPane; @@ -19,6 +19,9 @@ public class MainView implements FxmlView<MainViewModel> { @InjectViewModel private MainViewModel viewModel; + @InjectContext + private Context context; + public void initialize() { Tab emptyTabPlaceholder = new Tab("Empty"); @@ -39,10 +42,12 @@ public void initialize() { } }); - viewModel.onOpenDocument((title, scopes) -> { + viewModel.onOpenDocument((title, scopes) -> { + Parent root = FluentViewLoader.fxmlView(DocumentDetailsView.class) + .context(context) .providedScopes(scopes.toArray(new Scope[]{})) .load() .getView(); diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java index 84295cfb2..d7b33df83 100644 --- a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/MainViewModel.java @@ -1,9 +1,6 @@ package de.saxsys.mvvmfx.examples.scopesexample.ui; -import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.MvvmFX; -import de.saxsys.mvvmfx.Scope; -import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.*; import de.saxsys.mvvmfx.examples.scopesexample.model.Document; import de.saxsys.mvvmfx.examples.scopesexample.model.DocumentRepository; import de.saxsys.mvvmfx.examples.scopesexample.ui.documentdetails.DetailsScope; @@ -16,6 +13,7 @@ import java.util.Optional; import java.util.function.BiConsumer; +@ScopeProvider(scopes = {OverviewScope.class}) public class MainViewModel implements ViewModel { public static final String MESSAGE_OPEN_DOCUMENT = "MainViewModel.open_document"; @@ -25,10 +23,6 @@ public class MainViewModel implements ViewModel { private NotificationCenter notificationCenter = MvvmFX.getNotificationCenter(); private BiConsumer<String, List<Scope>> openTabConsumer; - - @InjectScope - private OverviewScope overviewScope; - public MainViewModel(DocumentRepository repository, Provider<DetailsScope> detailsScopeProvider) { this.repository = repository; this.detailsScopeProvider = detailsScopeProvider; @@ -51,7 +45,7 @@ private void openDocument(String id) { final DetailsScope detailScope = detailsScopeProvider.get(); detailScope.documentProperty().setValue(document); - openTabConsumer.accept(document.getTitle(), Arrays.asList(detailScope, overviewScope)); + openTabConsumer.accept(document.getTitle(), Arrays.asList(detailScope)); } }); } diff --git a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml index c14fe52bc..890ed2f48 100644 --- a/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml +++ b/examples/mini-examples/scopes-example/src/main/java/de/saxsys/mvvmfx/examples/scopesexample/ui/overview/OverviewView.fxml @@ -3,7 +3,7 @@ <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.HBox?> -<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> +<AnchorPane fx:controller="de.saxsys.mvvmfx.examples.scopesexample.ui.overview.OverviewView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> <children> <HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <fx:include HBox.hgrow="ALWAYS" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" source="master/OverviewMasterView.fxml" /> From 9d9d1ac900a6ae5f4c572dd18c8900155c382fb7 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Wed, 11 May 2016 15:11:14 +0200 Subject: [PATCH 86/96] Fix #382. Add missing maven configuration for #373 --- examples/books-example/pom.xml | 3 +++ examples/contacts-example/pom.xml | 3 +++ examples/todomvc-example/pom.xml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/examples/books-example/pom.xml b/examples/books-example/pom.xml index d7630f618..7998faa35 100644 --- a/examples/books-example/pom.xml +++ b/examples/books-example/pom.xml @@ -23,6 +23,9 @@ <resource> <directory>src/main/java</directory> </resource> + <resource> + <directory>src/main/resources</directory> + </resource> </resources> </build> diff --git a/examples/contacts-example/pom.xml b/examples/contacts-example/pom.xml index b892859f1..dd51d8747 100644 --- a/examples/contacts-example/pom.xml +++ b/examples/contacts-example/pom.xml @@ -32,6 +32,9 @@ <resource> <directory>src/main/java</directory> </resource> + <resource> + <directory>src/main/resources</directory> + </resource> </resources> </build> diff --git a/examples/todomvc-example/pom.xml b/examples/todomvc-example/pom.xml index 12806818d..aa8ebe2f8 100644 --- a/examples/todomvc-example/pom.xml +++ b/examples/todomvc-example/pom.xml @@ -17,6 +17,9 @@ <resource> <directory>src/main/java</directory> </resource> + <resource> + <directory>src/main/resources</directory> + </resource> </resources> </build> From 39a766df8534e1607d456c2dbd8be907786a66c2 Mon Sep 17 00:00:00 2001 From: Alexander Casall <alexander.casall@gmail.com> Date: Fri, 13 May 2016 10:46:22 +0200 Subject: [PATCH 87/96] Scopes gets Injected to manually created ViewModel Instances --- .../mvvmfx/internal/viewloader/FxmlViewLoader.java | 10 +++++++--- .../mvvmfx/internal/viewloader/JavaViewLoader.java | 2 +- .../test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java | 12 ++++-------- .../de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java | 2 ++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index 2f1fc1ec4..eff56453e 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -181,14 +181,18 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi } } else { actualViewModel = viewModel; + ViewLoaderReflectionUtils.createAndInjectScopes(actualViewModel, context); } if (actualViewModel != null) { // TODO: Create Testcase for this corner case: - // If this view is the root view (the one that is loaded with the FluentViewLoader) + // If this view is the root view (the one that is loaded with + // the FluentViewLoader) // but in the view there is no injection of the ViewModel // only in this case the scope has to be injected here, - // If the viewModel was already injected in the View, it has it's scopes already injected -// ViewLoaderReflectionUtils.createAndInjectScopes(actualViewModel, context); + // If the viewModel was already injected in the View, it has + // it's scopes already injected + // ViewLoaderReflectionUtils.createAndInjectScopes(actualViewModel, + // context); } return new ViewTuple<>(loadedController, loadedRoot, actualViewModel); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 8b020d153..148fd1921 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -122,8 +122,8 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi // if the user has provided an existing ViewModel, we will not // (re-)initialize this existing instance + ViewLoaderReflectionUtils.createAndInjectScopes(viewModel, context); if (existingViewModel == null) { - ViewLoaderReflectionUtils.createAndInjectScopes(viewModel, context); ViewLoaderReflectionUtils.initializeViewModel(viewModel); } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java index 140959a94..c8af3d286 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java @@ -5,8 +5,6 @@ import de.saxsys.mvvmfx.FluentViewLoader; -import static org.assertj.core.api.Assertions.assertThat; - public class ScopeTest { @Test @@ -14,6 +12,9 @@ public void testJavaScopedView() throws Exception { // FIXME JAVA TESTS + // Muss äquivalent zum FXML-Test sein und auch den Concern des Manuell + // erstellten ViewModels testen + // final ScopedViewModelA viewModelA = // FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); // final ScopedViewModelB viewModelB = @@ -38,7 +39,6 @@ public void testFxmlScopedView() throws Exception { ScopedViewModelC viewModelCinB = parentView.subviewBController.subviewCController.viewModel; ScopedViewModelD viewModelDinB = parentView.subviewBController.subviewCController.subViewDController.viewModel; - ScopedViewModelE viewModel_A_E = parentView.subviewAController.subviewEController.viewModel; ScopedViewModelF viewModel_A_E_F = parentView.subviewAController.subviewEController.subviewFController.viewModel; ScopedViewModelG viewModel_A_E_G = parentView.subviewAController.subviewEController.subviewGController.viewModel; @@ -47,7 +47,6 @@ public void testFxmlScopedView() throws Exception { ScopedViewModelF viewModel_B_E_F = parentView.subviewBController.subviewEController.subviewFController.viewModel; ScopedViewModelG viewModel_B_E_G = parentView.subviewBController.subviewEController.subviewGController.viewModel; - Assert.assertNotNull(viewModel_A_E); Assert.assertNotNull(viewModel_A_E_F); Assert.assertNotNull(viewModel_A_E_G); @@ -55,7 +54,6 @@ public void testFxmlScopedView() throws Exception { Assert.assertNotNull(viewModel_B_E_F); Assert.assertNotNull(viewModel_B_E_G); - Assert.assertNotEquals(viewModel_A_E.testScope3, viewModel_B_E.testScope3); Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_F.testScope3); @@ -64,8 +62,6 @@ public void testFxmlScopedView() throws Exception { Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_F.testScope3); Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_G.testScope3); - - verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB); } @@ -98,7 +94,6 @@ private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewMode Assert.assertNotNull(viewModelDinB.injectedScope1); Assert.assertNotNull(viewModelDinB.injectedScope2); - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelB.injectedScope1); Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); @@ -108,4 +103,5 @@ private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewMode Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); } + } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java index 350854064..e341248d7 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java @@ -26,7 +26,9 @@ public class ScopedFxmlViewC implements FxmlView<ScopedViewModelC> { ScopedFxmlViewD subViewDWithoutContextController; public void initialize() { + ScopedViewModelD scopedViewModelD = new ScopedViewModelD(); ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load = FluentViewLoader.fxmlView(ScopedFxmlViewD.class) + .viewModel(scopedViewModelD) .context(context) .providedScopes(new TestScope2()) .load(); From 13a7fece119f7d6388ea9028c9b6c24f8818fd93 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Fri, 13 May 2016 12:07:34 +0200 Subject: [PATCH 88/96] move test files for scopes into own sub directory --- .../de/saxsys/mvvmfx/scopes/ScopeTest.java | 111 ------------------ .../mvvmfx/scopes/ScopedViewModelD.java | 16 --- .../scopes/example1/Example1Scope1.java | 11 ++ .../scopes/example1/Example1Scope2.java | 11 ++ .../Example1Scope3.java} | 6 +- .../scopes/example1/Example1ScopesTest.java | 98 ++++++++++++++++ .../{ => example1/views}/ScopedFxmlViewA.java | 2 +- .../{ => example1/views}/ScopedFxmlViewB.java | 2 +- .../{ => example1/views}/ScopedFxmlViewC.java | 18 +-- .../{ => example1/views}/ScopedFxmlViewD.java | 5 +- .../{ => example1/views}/ScopedFxmlViewE.java | 3 +- .../{ => example1/views}/ScopedFxmlViewF.java | 2 +- .../{ => example1/views}/ScopedFxmlViewG.java | 2 +- .../{ => example1/views}/ScopedJavaViewA.java | 2 +- .../{ => example1/views}/ScopedJavaViewB.java | 2 +- .../views}/ScopedViewModelA.java | 8 +- .../views}/ScopedViewModelB.java | 8 +- .../views}/ScopedViewModelC.java | 6 +- .../example1/views/ScopedViewModelD.java | 16 +++ .../views}/ScopedViewModelE.java | 7 +- .../views}/ScopedViewModelF.java | 5 +- .../views}/ScopedViewModelG.java | 5 +- .../views}/ScopesFxmlParentView.java | 2 +- .../{ => example1/views}/ScopedFxmlViewA.fxml | 2 +- .../{ => example1/views}/ScopedFxmlViewB.fxml | 2 +- .../{ => example1/views}/ScopedFxmlViewC.fxml | 2 +- .../{ => example1/views}/ScopedFxmlViewD.fxml | 2 +- .../{ => example1/views}/ScopedFxmlViewE.fxml | 2 +- .../{ => example1/views}/ScopedFxmlViewF.fxml | 2 +- .../{ => example1/views}/ScopedFxmlViewG.fxml | 2 +- .../views}/ScopesFxmlParentView.fxml | 2 +- 31 files changed, 188 insertions(+), 176 deletions(-) delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java delete mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope1.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope2.java rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{TestScope3.java => example1/Example1Scope3.java} (55%) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1ScopesTest.java rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewA.java (96%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewB.java (96%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewC.java (74%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewD.java (76%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewE.java (88%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewF.java (89%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewG.java (89%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedJavaViewA.java (95%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedJavaViewB.java (95%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedViewModelA.java (88%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedViewModelB.java (88%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedViewModelC.java (50%) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelD.java rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedViewModelE.java (71%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedViewModelF.java (75%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedViewModelG.java (75%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopesFxmlParentView.java (85%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewA.fxml (86%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewB.fxml (86%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewC.fxml (70%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewD.fxml (75%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewE.fxml (85%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewF.fxml (75%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopedFxmlViewG.fxml (75%) rename mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/{ => example1/views}/ScopesFxmlParentView.fxml (85%) diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java deleted file mode 100644 index 140959a94..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopeTest.java +++ /dev/null @@ -1,111 +0,0 @@ -package de.saxsys.mvvmfx.scopes; - -import org.junit.Assert; -import org.junit.Test; - -import de.saxsys.mvvmfx.FluentViewLoader; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ScopeTest { - - @Test - public void testJavaScopedView() throws Exception { - - // FIXME JAVA TESTS - - // final ScopedViewModelA viewModelA = - // FluentViewLoader.javaView(ScopedJavaViewA.class).load().getViewModel(); - // final ScopedViewModelB viewModelB = - // FluentViewLoader.javaView(ScopedJavaViewB.class).load().getViewModel(); - // - // verifyScopes(viewModelA, viewModelB); - } - - @Test - public void testFxmlScopedView() throws Exception { - - final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) - .load() - .getCodeBehind(); - - final ScopedViewModelA viewModelA = parentView.subviewAController.viewModel; - final ScopedViewModelB viewModelB = parentView.subviewBController.viewModel; - - ScopedViewModelC viewModelCinA = parentView.subviewAController.subviewCController.viewModel; - ScopedViewModelD viewModelDinA = parentView.subviewAController.subviewCController.subViewDController.viewModel; - - ScopedViewModelC viewModelCinB = parentView.subviewBController.subviewCController.viewModel; - ScopedViewModelD viewModelDinB = parentView.subviewBController.subviewCController.subViewDController.viewModel; - - - ScopedViewModelE viewModel_A_E = parentView.subviewAController.subviewEController.viewModel; - ScopedViewModelF viewModel_A_E_F = parentView.subviewAController.subviewEController.subviewFController.viewModel; - ScopedViewModelG viewModel_A_E_G = parentView.subviewAController.subviewEController.subviewGController.viewModel; - - ScopedViewModelE viewModel_B_E = parentView.subviewBController.subviewEController.viewModel; - ScopedViewModelF viewModel_B_E_F = parentView.subviewBController.subviewEController.subviewFController.viewModel; - ScopedViewModelG viewModel_B_E_G = parentView.subviewBController.subviewEController.subviewGController.viewModel; - - - Assert.assertNotNull(viewModel_A_E); - Assert.assertNotNull(viewModel_A_E_F); - Assert.assertNotNull(viewModel_A_E_G); - Assert.assertNotNull(viewModel_B_E); - Assert.assertNotNull(viewModel_B_E_F); - Assert.assertNotNull(viewModel_B_E_G); - - - Assert.assertNotEquals(viewModel_A_E.testScope3, viewModel_B_E.testScope3); - - Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_F.testScope3); - Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_G.testScope3); - - Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_F.testScope3); - Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_G.testScope3); - - - - verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB); - } - - @Test(expected = Exception.class) - public void testErrorWhenNoScopeProviderFound() { - - final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) - .load() - .getCodeBehind(); - - parentView.subviewAController.subviewCController.loadWrongScopedView(); - } - - private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB, ScopedViewModelC viewModelCinA, - ScopedViewModelC viewModelCinB, ScopedViewModelD viewModelDinA, ScopedViewModelD viewModelDinB) { - - Assert.assertNotNull(viewModelA); - Assert.assertNotNull(viewModelB); - Assert.assertNotNull(viewModelCinA); - Assert.assertNotNull(viewModelCinB); - Assert.assertNotNull(viewModelDinA); - Assert.assertNotNull(viewModelDinB); - - Assert.assertNotNull(viewModelA.injectedScope1); - Assert.assertNotNull(viewModelB.injectedScope1); - Assert.assertNotNull(viewModelCinA.injectedScope1); - Assert.assertNotNull(viewModelCinB.injectedScope1); - Assert.assertNotNull(viewModelDinA.injectedScope1); - Assert.assertNotNull(viewModelDinA.injectedScope2); - Assert.assertNotNull(viewModelDinB.injectedScope1); - Assert.assertNotNull(viewModelDinB.injectedScope2); - - - Assert.assertNotEquals(viewModelA.injectedScope1, viewModelB.injectedScope1); - - Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); - Assert.assertEquals(viewModelA.injectedScope1, viewModelDinA.injectedScope1); - - Assert.assertEquals(viewModelB.injectedScope1, viewModelCinB.injectedScope1); - Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); - - } -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java deleted file mode 100644 index 3e589ab22..000000000 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelD.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.saxsys.mvvmfx.scopes; - -import de.saxsys.mvvmfx.InjectScope; -import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope2; - -public class ScopedViewModelD implements ViewModel { - - @InjectScope - public TestScope1 injectedScope1; - - @InjectScope - public TestScope2 injectedScope2; - -} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope1.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope1.java new file mode 100644 index 000000000..db9e36a48 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope1.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes.example1; + +import de.saxsys.mvvmfx.Scope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; + +public class Example1Scope1 implements Scope { + + public BooleanProperty someProperty = new SimpleBooleanProperty(); + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope2.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope2.java new file mode 100644 index 000000000..dbd114a90 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope2.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes.example1; + +import de.saxsys.mvvmfx.Scope; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; + +public class Example1Scope2 implements Scope { + + public BooleanProperty someProperty = new SimpleBooleanProperty(); + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope3.java similarity index 55% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope3.java index 023f7594a..a096c1563 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/TestScope3.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1Scope3.java @@ -1,10 +1,10 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1; import de.saxsys.mvvmfx.Scope; -public class TestScope3 implements Scope { +public class Example1Scope3 implements Scope { - public TestScope3() { + public Example1Scope3() { System.out.println("new " + this.getClass().getSimpleName() + "(), "+ System.identityHashCode(this)); } } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1ScopesTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1ScopesTest.java new file mode 100644 index 000000000..f22d7ce25 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/Example1ScopesTest.java @@ -0,0 +1,98 @@ +package de.saxsys.mvvmfx.scopes.example1; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.scopes.example1.views.*; +import org.junit.Assert; +import org.junit.Test; + +public class Example1ScopesTest { + + + @Test + public void testFxmlScopedView() throws Exception { + + final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) + .load() + .getCodeBehind(); + + final ScopedViewModelA viewModelA = parentView.subviewAController.viewModel; + final ScopedViewModelB viewModelB = parentView.subviewBController.viewModel; + + ScopedViewModelC viewModelCinA = parentView.subviewAController.subviewCController.viewModel; + ScopedViewModelD viewModelDinA = parentView.subviewAController.subviewCController.subViewDController.viewModel; + + ScopedViewModelC viewModelCinB = parentView.subviewBController.subviewCController.viewModel; + ScopedViewModelD viewModelDinB = parentView.subviewBController.subviewCController.subViewDController.viewModel; + + + ScopedViewModelE viewModel_A_E = parentView.subviewAController.subviewEController.viewModel; + ScopedViewModelF viewModel_A_E_F = parentView.subviewAController.subviewEController.subviewFController.viewModel; + ScopedViewModelG viewModel_A_E_G = parentView.subviewAController.subviewEController.subviewGController.viewModel; + + ScopedViewModelE viewModel_B_E = parentView.subviewBController.subviewEController.viewModel; + ScopedViewModelF viewModel_B_E_F = parentView.subviewBController.subviewEController.subviewFController.viewModel; + ScopedViewModelG viewModel_B_E_G = parentView.subviewBController.subviewEController.subviewGController.viewModel; + + + Assert.assertNotNull(viewModel_A_E); + Assert.assertNotNull(viewModel_A_E_F); + Assert.assertNotNull(viewModel_A_E_G); + Assert.assertNotNull(viewModel_B_E); + Assert.assertNotNull(viewModel_B_E_F); + Assert.assertNotNull(viewModel_B_E_G); + + + Assert.assertNotEquals(viewModel_A_E.testScope3, viewModel_B_E.testScope3); + + Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_F.testScope3); + Assert.assertEquals(viewModel_A_E.testScope3, viewModel_A_E_G.testScope3); + + Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_F.testScope3); + Assert.assertEquals(viewModel_B_E.testScope3, viewModel_B_E_G.testScope3); + + + + verifyScopes(viewModelA, viewModelB, viewModelCinA, viewModelCinB, viewModelDinA, viewModelDinB); + } + + @Test(expected = Exception.class) + public void testErrorWhenNoScopeProviderFound() { + + final ScopesFxmlParentView parentView = FluentViewLoader.fxmlView(ScopesFxmlParentView.class) + .load() + .getCodeBehind(); + + parentView.subviewAController.subviewCController.loadWrongScopedView(); + } + + private void verifyScopes(ScopedViewModelA viewModelA, ScopedViewModelB viewModelB, ScopedViewModelC viewModelCinA, + ScopedViewModelC viewModelCinB, ScopedViewModelD viewModelDinA, ScopedViewModelD viewModelDinB) { + + Assert.assertNotNull(viewModelA); + Assert.assertNotNull(viewModelB); + Assert.assertNotNull(viewModelCinA); + Assert.assertNotNull(viewModelCinB); + Assert.assertNotNull(viewModelDinA); + Assert.assertNotNull(viewModelDinB); + + Assert.assertNotNull(viewModelA.injectedScope1); + Assert.assertNotNull(viewModelB.injectedScope1); + Assert.assertNotNull(viewModelCinA.injectedScope1); + Assert.assertNotNull(viewModelCinB.injectedScope1); + Assert.assertNotNull(viewModelDinA.injectedScope1); + Assert.assertNotNull(viewModelDinA.injectedScope2); + Assert.assertNotNull(viewModelDinB.injectedScope1); + Assert.assertNotNull(viewModelDinB.injectedScope2); + + + Assert.assertNotEquals(viewModelA.injectedScope1, viewModelB.injectedScope1); + + Assert.assertEquals(viewModelA.injectedScope1, viewModelCinA.injectedScope1); + Assert.assertEquals(viewModelA.injectedScope1, viewModelDinA.injectedScope1); + + Assert.assertEquals(viewModelB.injectedScope1, viewModelCinB.injectedScope1); + Assert.assertEquals(viewModelB.injectedScope1, viewModelDinB.injectedScope1); + + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewA.java similarity index 96% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewA.java index 9d67eb037..cecb536c5 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewA.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewB.java similarity index 96% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewB.java index 59a0ace4c..ab6e11108 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewB.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewC.java similarity index 74% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewC.java index 350854064..c75de84ab 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewC.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.FluentViewLoader; @@ -8,27 +8,29 @@ import de.saxsys.mvvmfx.ViewTuple; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; import de.saxsys.mvvmfx.internal.viewloader.example.TestScope2; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope1; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope2; import javafx.fxml.FXML; import javafx.scene.layout.VBox; public class ScopedFxmlViewC implements FxmlView<ScopedViewModelC> { @InjectViewModel - ScopedViewModelC viewModel; + public ScopedViewModelC viewModel; @FXML - VBox root; + public VBox root; @InjectContext - Context context; + public Context context; - ScopedFxmlViewD subViewDController; - ScopedFxmlViewD subViewDWithoutContextController; + public ScopedFxmlViewD subViewDController; + public ScopedFxmlViewD subViewDWithoutContextController; public void initialize() { ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load = FluentViewLoader.fxmlView(ScopedFxmlViewD.class) .context(context) - .providedScopes(new TestScope2()) + .providedScopes(new Example1Scope2()) .load(); root.getChildren().add(load.getView()); subViewDController = load.getCodeBehind(); @@ -42,7 +44,7 @@ public void loadWrongScopedView() { public void loadCorrectScopedView() { ViewTuple<ScopedFxmlViewD, ScopedViewModelD> load2 = FluentViewLoader.fxmlView(ScopedFxmlViewD.class) - .providedScopes(new TestScope1(), new TestScope2()) + .providedScopes(new Example1Scope1(), new Example1Scope2()) .load(); root.getChildren().add(load2.getView()); subViewDWithoutContextController = load2.getCodeBehind(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewD.java similarity index 76% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewD.java index c635dfdaa..1833322e7 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewD.java @@ -1,9 +1,8 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; import javafx.fxml.FXML; -import javafx.scene.layout.VBox; public class ScopedFxmlViewD implements FxmlView<ScopedViewModelD> { @@ -14,6 +13,6 @@ public class ScopedFxmlViewD implements FxmlView<ScopedViewModelD> { public ScopedFxmlViewG subviewGController; @InjectViewModel - ScopedViewModelD viewModel; + public ScopedViewModelD viewModel; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewE.java similarity index 88% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewE.java index 9ea6dab72..e2f51786f 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewE.java @@ -1,7 +1,6 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.FxmlView; -import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectViewModel; import javafx.fxml.FXML; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewF.java similarity index 89% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewF.java index 24a2b3638..3b87c5c9c 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewF.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewG.java similarity index 89% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewG.java index 076a8b0cd..94e1f5bdb 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewG.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.FxmlView; import de.saxsys.mvvmfx.InjectViewModel; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedJavaViewA.java similarity index 95% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedJavaViewA.java index e5c4a86a0..8de2fd999 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedJavaViewA.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.JavaView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedJavaViewB.java similarity index 95% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedJavaViewB.java index 1a3b2a2ad..35567e1b2 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedJavaViewB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedJavaViewB.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.JavaView; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelA.java similarity index 88% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelA.java index 5b0047ed2..15c9d10b0 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelA.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelA.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope1; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -26,11 +26,11 @@ * * @author alexander.casall */ -@ScopeProvider(scopes = { TestScope1.class }) +@ScopeProvider(scopes = { Example1Scope1.class }) public class ScopedViewModelA implements ViewModel { @InjectScope - public TestScope1 injectedScope1; + public Example1Scope1 injectedScope1; private final BooleanProperty reference = new SimpleBooleanProperty(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelB.java similarity index 88% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelB.java index e5374d00a..d51106cdd 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelB.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelB.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope1; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -27,11 +27,11 @@ * @author alexander.casall * */ -@ScopeProvider(scopes = {TestScope1.class}) +@ScopeProvider(scopes = {Example1Scope1.class}) public class ScopedViewModelB implements ViewModel { @InjectScope - public TestScope1 injectedScope1; + public Example1Scope1 injectedScope1; private final BooleanProperty reference = new SimpleBooleanProperty(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelC.java similarity index 50% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelC.java index de1066461..b66f2d6b8 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelC.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelC.java @@ -1,12 +1,12 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.viewloader.example.TestScope1; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope1; public class ScopedViewModelC implements ViewModel { @InjectScope - public TestScope1 injectedScope1; + public Example1Scope1 injectedScope1; } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelD.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelD.java new file mode 100644 index 000000000..b501e7b96 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelD.java @@ -0,0 +1,16 @@ +package de.saxsys.mvvmfx.scopes.example1.views; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope1; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope2; + +public class ScopedViewModelD implements ViewModel { + + @InjectScope + public Example1Scope1 injectedScope1; + + @InjectScope + public Example1Scope2 injectedScope2; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelE.java similarity index 71% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelE.java index 9b635d906..ddf0d01b5 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelE.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelE.java @@ -1,14 +1,15 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope3; -@ScopeProvider(scopes = {TestScope3.class}) +@ScopeProvider(scopes = {Example1Scope3.class}) public class ScopedViewModelE implements ViewModel{ @InjectScope - public TestScope3 testScope3; + public Example1Scope3 testScope3; public ScopedViewModelE() { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelF.java similarity index 75% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelF.java index 391fb95ee..5fe9ad767 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelF.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelF.java @@ -1,12 +1,13 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope3; public class ScopedViewModelF implements ViewModel{ @InjectScope - public TestScope3 testScope3; + public Example1Scope3 testScope3; public ScopedViewModelF() { System.out.println("new " + this.getClass().getSimpleName() + "()"); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelG.java similarity index 75% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelG.java index c1c3e58c4..43c825441 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopedViewModelG.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopedViewModelG.java @@ -1,12 +1,13 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import de.saxsys.mvvmfx.InjectScope; import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example1.Example1Scope3; public class ScopedViewModelG implements ViewModel{ @InjectScope - public TestScope3 testScope3; + public Example1Scope3 testScope3; public ScopedViewModelG() { diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopesFxmlParentView.java similarity index 85% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopesFxmlParentView.java index f5bc4b175..fdaa30a19 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example1/views/ScopesFxmlParentView.java @@ -1,4 +1,4 @@ -package de.saxsys.mvvmfx.scopes; +package de.saxsys.mvvmfx.scopes.example1.views; import javafx.fxml.FXML; diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewA.fxml similarity index 86% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewA.fxml index dedd2eac1..2626f85ec 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewA.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewA.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewA"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewA"> <children> <fx:include fx:id="subviewC" source="ScopedFxmlViewC.fxml"/> <fx:include fx:id="subviewE" source="ScopedFxmlViewE.fxml"/> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewB.fxml similarity index 86% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewB.fxml index 8f2ed4c54..efccbe690 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewB.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewB.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewB"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewB"> <children> <fx:include fx:id="subviewC" source="ScopedFxmlViewC.fxml"/> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewC.fxml similarity index 70% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewC.fxml index ddae2b531..8a35d7de7 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewC.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewC.fxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewC" fx:id="root"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewC" fx:id="root"> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewD.fxml similarity index 75% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewD.fxml index ecf9b5cc4..6d7505a4c 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewD.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewD.fxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewD"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewD"> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewE.fxml similarity index 85% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewE.fxml index 3ad3ffd12..eb65dd04a 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewE.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewE.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewE"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewE"> <fx:include fx:id="subviewF" source="ScopedFxmlViewF.fxml"/> <fx:include fx:id="subviewG" source="ScopedFxmlViewG.fxml"/> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewF.fxml similarity index 75% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewF.fxml index f7f414294..182873258 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewF.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewF.fxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewF"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewF"> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewG.fxml similarity index 75% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewG.fxml index f7a889cfe..cacfae17e 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopedFxmlViewG.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopedFxmlViewG.fxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopedFxmlViewG"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopedFxmlViewG"> </VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopesFxmlParentView.fxml similarity index 85% rename from mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml rename to mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopesFxmlParentView.fxml index d0a4a08ea..6631ff6e2 100644 --- a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/ScopesFxmlParentView.fxml +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example1/views/ScopesFxmlParentView.fxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> -<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.ScopesFxmlParentView"> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example1.views.ScopesFxmlParentView"> <children> <fx:include fx:id="subviewA" source="ScopedFxmlViewA.fxml"/> <fx:include fx:id="subviewB" source="ScopedFxmlViewB.fxml"/> From 74567b5582ce7daec0b5ae1e42264d39020ebd8f Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Fri, 13 May 2016 12:11:30 +0200 Subject: [PATCH 89/96] Add failing test case for scopes inconsitencies --- .../scopes/example2/Example2Scope1.java | 6 +++ .../scopes/example2/Example2ScopesTest.java | 39 +++++++++++++++++++ .../scopes/example2/views/ScopedViewA.java | 12 ++++++ .../scopes/example2/views/ScopedViewB.java | 11 ++++++ .../scopes/example2/views/ScopedViewC.java | 10 +++++ .../example2/views/ScopedViewModelA.java | 6 +++ .../example2/views/ScopedViewModelB.java | 14 +++++++ .../example2/views/ScopedViewModelC.java | 14 +++++++ .../scopes/example2/views/ScopedViewA.fxml | 9 +++++ .../scopes/example2/views/ScopedViewB.fxml | 7 ++++ .../scopes/example2/views/ScopedViewC.fxml | 7 ++++ 11 files changed, 135 insertions(+) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2Scope1.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2ScopesTest.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelA.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelB.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelC.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.fxml diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2Scope1.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2Scope1.java new file mode 100644 index 000000000..ffa4db4f2 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2Scope1.java @@ -0,0 +1,6 @@ +package de.saxsys.mvvmfx.scopes.example2; + +import de.saxsys.mvvmfx.Scope; + +public class Example2Scope1 implements Scope { +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2ScopesTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2ScopesTest.java new file mode 100644 index 000000000..7f62ee51c --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/Example2ScopesTest.java @@ -0,0 +1,39 @@ +package de.saxsys.mvvmfx.scopes.example2; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.scopes.example2.views.ScopedViewA; +import de.saxsys.mvvmfx.scopes.example2.views.ScopedViewB; +import de.saxsys.mvvmfx.scopes.example2.views.ScopedViewC; +import de.saxsys.mvvmfx.scopes.example2.views.ScopedViewModelA; +import org.junit.Ignore; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + + +@Ignore +public class Example2ScopesTest { + + @Test + public void test() { + try { + ViewTuple<ScopedViewA, ScopedViewModelA> viewTuple = FluentViewLoader.fxmlView(ScopedViewA.class).load(); + + fail("Expected an exception because in branch C there is no scope provider defined"); + } catch (Exception e) { + assertThat(getRootCause(e)).hasMessageContaining("scope").hasMessageContaining("ScopeProvider"); + } + } + + + private static Throwable getRootCause(Throwable e) { + if(e.getCause() == null) { + return e; + } else { + return getRootCause(e.getCause()); + } + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.java new file mode 100644 index 000000000..e84daf4bb --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx.scopes.example2.views; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ScopedViewA implements FxmlView<ScopedViewModelA> { + public ScopedViewB subviewBController; + public ScopedViewC subviewCController; + + @InjectViewModel + public ScopedViewModelA viewModelA; +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.java new file mode 100644 index 000000000..7dd702afc --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes.example2.views; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ScopedViewB implements FxmlView<ScopedViewModelB> { + + @InjectViewModel + public ScopedViewModelB viewModel; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.java new file mode 100644 index 000000000..3510ad1b8 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.java @@ -0,0 +1,10 @@ +package de.saxsys.mvvmfx.scopes.example2.views; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ScopedViewC implements FxmlView<ScopedViewModelC> { + + @InjectViewModel + public ScopedViewModelC viewModel; +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelA.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelA.java new file mode 100644 index 000000000..9f1b52f7c --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelA.java @@ -0,0 +1,6 @@ +package de.saxsys.mvvmfx.scopes.example2.views; + +import de.saxsys.mvvmfx.ViewModel; + +public class ScopedViewModelA implements ViewModel { +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelB.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelB.java new file mode 100644 index 000000000..76809be5b --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelB.java @@ -0,0 +1,14 @@ +package de.saxsys.mvvmfx.scopes.example2.views; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example2.Example2Scope1; + +@ScopeProvider(scopes = {Example2Scope1.class}) +public class ScopedViewModelB implements ViewModel { + + @InjectScope + public Example2Scope1 scope; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelC.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelC.java new file mode 100644 index 000000000..90da48517 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewModelC.java @@ -0,0 +1,14 @@ +package de.saxsys.mvvmfx.scopes.example2.views; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example2.Example2Scope1; + + +public class ScopedViewModelC implements ViewModel { + + + @InjectScope + public Example2Scope1 scope; +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.fxml new file mode 100644 index 000000000..b4936f821 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewA.fxml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example2.views.ScopedViewA"> +<children> + <fx:include fx:id="subviewB" source="ScopedViewB.fxml"/> + <fx:include fx:id="subviewC" source="ScopedViewC.fxml"/> +</children> +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.fxml new file mode 100644 index 000000000..41a516941 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewB.fxml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example2.views.ScopedViewB"> +<children> +</children> +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.fxml new file mode 100644 index 000000000..579ff0b93 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example2/views/ScopedViewC.fxml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.VBox?> +<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="de.saxsys.mvvmfx.scopes.example2.views.ScopedViewC"> +<children> +</children> +</VBox> From 89f27621ebfda3d693f6d234838fe39e45bbc46c Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Tue, 17 May 2016 13:57:21 +0200 Subject: [PATCH 90/96] Add another example to reproduce failing behaviour of scopes When the ViewModel that acts as ScopeProvider isn't injected into it's view, the ScopeProvider is ignored. --- .../mvvmfx/scopes/example3/Example3Scope.java | 6 +++++ .../mvvmfx/scopes/example3/Example3Test.java | 22 +++++++++++++++++++ .../scopes/example3/views/MainView.java | 7 ++++++ .../scopes/example3/views/MainViewModel.java | 9 ++++++++ .../example3/views/content/ContentView.java | 11 ++++++++++ .../views/content/ContentViewModel.java | 12 ++++++++++ .../scopes/example3/views/menu/MenuView.java | 10 +++++++++ .../example3/views/menu/MenuViewModel.java | 12 ++++++++++ .../scopes/example3/views/MainView.fxml | 11 ++++++++++ .../example3/views/content/ContentView.fxml | 13 +++++++++++ .../scopes/example3/views/menu/MenuView.fxml | 10 +++++++++ 11 files changed, 123 insertions(+) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Scope.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Test.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainViewModel.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentViewModel.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuViewModel.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/MainView.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.fxml diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Scope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Scope.java new file mode 100644 index 000000000..f2a2a6e16 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Scope.java @@ -0,0 +1,6 @@ +package de.saxsys.mvvmfx.scopes.example3; + +import de.saxsys.mvvmfx.Scope; + +public class Example3Scope implements Scope { +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Test.java new file mode 100644 index 000000000..e1373e799 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/Example3Test.java @@ -0,0 +1,22 @@ +package de.saxsys.mvvmfx.scopes.example3; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.scopes.example3.views.MainView; +import de.saxsys.mvvmfx.scopes.example3.views.MainViewModel; +import org.junit.Ignore; +import org.junit.Test; + +@Ignore("Ignore until fixed") +public class Example3Test { + + @Test + public void test() { + + ViewTuple<MainView, MainViewModel> viewTuple = FluentViewLoader.fxmlView(MainView.class).load(); + + + + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainView.java new file mode 100644 index 000000000..51b5eca4a --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainView.java @@ -0,0 +1,7 @@ +package de.saxsys.mvvmfx.scopes.example3.views; + +import de.saxsys.mvvmfx.FxmlView; + +public class MainView implements FxmlView<MainViewModel> { + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainViewModel.java new file mode 100644 index 000000000..bfcdd2e55 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/MainViewModel.java @@ -0,0 +1,9 @@ +package de.saxsys.mvvmfx.scopes.example3.views; + +import de.saxsys.mvvmfx.ScopeProvider; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example3.Example3Scope; + +@ScopeProvider(scopes = {Example3Scope.class}) +public class MainViewModel implements ViewModel { +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.java new file mode 100644 index 000000000..e1d1c8d96 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes.example3.views.content; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ContentView implements FxmlView<ContentViewModel> { + + @InjectViewModel + public ContentViewModel viewModel; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentViewModel.java new file mode 100644 index 000000000..30f92abbf --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/content/ContentViewModel.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx.scopes.example3.views.content; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example3.Example3Scope; + +public class ContentViewModel implements ViewModel { + + @InjectScope + public Example3Scope scope; + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.java new file mode 100644 index 000000000..8aba7b5b8 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.java @@ -0,0 +1,10 @@ +package de.saxsys.mvvmfx.scopes.example3.views.menu; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class MenuView implements FxmlView<MenuViewModel> { + + @InjectViewModel + public MenuViewModel viewModel; +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuViewModel.java new file mode 100644 index 000000000..3ebddd6f8 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuViewModel.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx.scopes.example3.views.menu; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.scopes.example3.Example3Scope; + +public class MenuViewModel implements ViewModel { + + @InjectScope + public Example3Scope scope; + +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/MainView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/MainView.fxml new file mode 100644 index 000000000..cc6b6c86f --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/MainView.fxml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.scopes.example3.views.MainView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <fx:include source="menu/MenuView.fxml"/> + <fx:include source="content/ContentView.fxml"/> + </children> +</AnchorPane> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.fxml new file mode 100644 index 000000000..d89fdcba6 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/content/ContentView.fxml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.layout.VBox?> + + +<VBox fx:controller="de.saxsys.mvvmfx.scopes.example3.views.content.ContentView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <Label text="Label" /> + <Button mnemonicParsing="false" text="Button" /> + </children> +</VBox> diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.fxml new file mode 100644 index 000000000..0821df0af --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example3/views/menu/MenuView.fxml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.scopes.example3.views.menu.MenuView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> + <children> + + </children> +</AnchorPane> From aea6a101be1488423bec285502394a1f04532b03 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Mon, 23 May 2016 15:13:52 +0200 Subject: [PATCH 91/96] Fix for #384. Change "executable" parameter of DelegateCommand to type ObservableValue<Boolean> --- .../utils/commands/DelegateCommand.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/DelegateCommand.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/DelegateCommand.java index d369e1a05..75192c7b6 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/DelegateCommand.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/commands/DelegateCommand.java @@ -18,9 +18,11 @@ import java.util.function.Supplier; import javafx.application.Platform; +import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.ReadOnlyBooleanWrapper; import javafx.beans.value.ObservableBooleanValue; +import javafx.beans.value.ObservableValue; import javafx.concurrent.Service; import javafx.concurrent.Task; import eu.lestard.doc.Beta; @@ -74,19 +76,19 @@ public DelegateCommand(final Supplier<Action> actionSupplier, boolean inBackgrou } /** - * Creates a command with a condition about the executability by using the #executableBinding parameter. + * Creates a command with a condition about the executability by using the 'executableObservable' parameter. * * @param actionSupplier * a function that returns a new Action which should be executed - * @param executableBinding + * @param executableObservable * which defines whether the {@link Command} can execute */ - public DelegateCommand(final Supplier<Action> actionSupplier, ObservableBooleanValue executableBinding) { - this(actionSupplier, executableBinding, false); + public DelegateCommand(final Supplier<Action> actionSupplier, ObservableValue<Boolean> executableObservable) { + this(actionSupplier, executableObservable, false); } /** - * Creates a command with a condition about the executability by using the #executableBinding parameter. Pass a + * Creates a command with a condition about the executability by using the 'executableObservable' parameter. Pass a * <code>true</code> to the #inBackground parameter to run the {@link Command} in a background thread. * * <b>IF YOU USE THE BACKGROUND THREAD: </b> don't forget to return to the UI-thread by using @@ -94,17 +96,22 @@ public DelegateCommand(final Supplier<Action> actionSupplier, ObservableBooleanV * * @param actionSupplier * a function that returns a new Action which should be executed - * @param executableBinding + * @param executableObservable * which defines whether the {@link Command} can execute * @param inBackground * defines whether the execution {@link #execute()} is performed in a background thread or not */ - public DelegateCommand(final Supplier<Action> actionSupplier, ObservableBooleanValue executableBinding, + public DelegateCommand(final Supplier<Action> actionSupplier, ObservableValue<Boolean> executableObservable, boolean inBackground) { this.actionSupplier = actionSupplier; this.inBackground = inBackground; - if (executableBinding != null) { - executable.bind(runningProperty().not().and(executableBinding)); + if (executableObservable != null) { + executable.bind(Bindings.createBooleanBinding(() -> { + final boolean isRunning = runningProperty().get(); + final boolean isExecutable = executableObservable.getValue(); + + return !isRunning && isExecutable; + }, runningProperty(), executableObservable)); } } From c62961faebb1fdc575efc1e0d56e6db6386f041e Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Fri, 27 May 2016 13:38:15 +0200 Subject: [PATCH 92/96] Fix memory leak in viewmodel - view communication --- .../main/java/de/saxsys/mvvmfx/ViewModel.java | 8 +- .../DefaultNotificationCenter.java | 106 ++++++------ .../DefaultNotificationCenterTest.java | 21 +-- .../NotificationTestHelperTest.java | 2 +- .../viewmodel/MemoryLeakOnViewModelTest.java | 157 ++++++++++++++++++ .../viewmodel/MemoryLeakView.java | 23 +++ .../viewmodel/MemoryLeakViewModel.java | 13 ++ .../{ => viewmodel}/ViewModelTest.java | 11 +- .../ViewModelWithoutUiThreadTest.java | 2 +- 9 files changed, 267 insertions(+), 76 deletions(-) create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakOnViewModelTest.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakViewModel.java rename mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/{ => viewmodel}/ViewModelTest.java (90%) rename mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/{ => viewmodel}/ViewModelWithoutUiThreadTest.java (96%) diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java index fe3cbbff2..e7fcfbce7 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/ViewModel.java @@ -61,7 +61,7 @@ public interface ViewModel { * to be send */ default void publish(String messageName, Object... payload) { - MvvmFX.getNotificationCenter().publish(this, messageName, payload); + MvvmFX.getNotificationCenter().publish(System.identityHashCode(this), messageName, payload); } /** @@ -74,7 +74,7 @@ default void publish(String messageName, Object... payload) { * which should execute when the notification occurs */ default void subscribe(String messageName, NotificationObserver observer) { - MvvmFX.getNotificationCenter().subscribe(this, messageName, observer); + MvvmFX.getNotificationCenter().subscribe(System.identityHashCode(this), messageName, observer); } /** @@ -86,7 +86,7 @@ default void subscribe(String messageName, NotificationObserver observer) { * to remove */ default void unsubscribe(String messageName, NotificationObserver observer) { - MvvmFX.getNotificationCenter().unsubscribe(this, messageName, observer); + MvvmFX.getNotificationCenter().unsubscribe(System.identityHashCode(this), messageName, observer); } /** @@ -96,6 +96,6 @@ default void unsubscribe(String messageName, NotificationObserver observer) { * to be removed */ default void unsubscribe(NotificationObserver observer) { - MvvmFX.getNotificationCenter().unsubscribe(this, observer); + MvvmFX.getNotificationCenter().unsubscribe(System.identityHashCode(this), observer); } } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java index a9af4e4ea..419b09f51 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright 2013 Alexander Casall - * + * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,39 +19,39 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; /** * Default implementation of {@link NotificationCenter}. - * + * * @author sialcasa - * + * */ public class DefaultNotificationCenter implements NotificationCenter { - + private static final Logger LOG = LoggerFactory.getLogger(DefaultNotificationCenter.class); - + private final ObserverMap globalObservers = new ObserverMap(); private final ChannelObserverMap channelObserverMap = new ChannelObserverMap(); - + @Override public void subscribe(String messageName, NotificationObserver observer) { addObserver(messageName, observer, globalObservers); } - + @Override public void unsubscribe(String messageName, NotificationObserver observer) { removeObserversForMessageName(messageName, observer, globalObservers); } - + @Override public void unsubscribe(NotificationObserver observer) { removeObserverFromObserverMap(observer, globalObservers); } - + @Override public void publish(String messageName, Object... payload) { publish(messageName, payload, globalObservers); @@ -61,25 +61,25 @@ public void publish(String messageName, Object... payload) { * This notification will be send to the UI-Thread (if the UI-toolkit was bootstrapped). * If no UI-Toolkit is available the notification will be directly published. This is typically the case in unit tests. * - * @param channel the channel - * @param messageName the message to sent - * @param payload additional arguments to the message + * @param channel the channel + * @param messageName the message to sent + * @param payload additional arguments to the message */ @Override public void publish(Object channel, String messageName, Object[] payload) { - if(channelObserverMap.containsKey(channel)) { + if (channelObserverMap.containsKey(channel)) { final ObserverMap observerMap = channelObserverMap.get(channel); - + if (Platform.isFxApplicationThread()) { publish(messageName, payload, observerMap); } else { try { Platform.runLater(() -> publish(messageName, payload, observerMap)); - } catch(IllegalStateException e) { + } catch (IllegalStateException e) { // If the toolkit isn't initialized yet we will publish the notification directly. // In most cases this means that we are in a unit test and not JavaFX application is running. - if(e.getMessage().equals("Toolkit not initialized")) { + if (e.getMessage().equals("Toolkit not initialized")) { publish(messageName, payload, observerMap); } else { throw e; @@ -88,30 +88,30 @@ public void publish(Object channel, String messageName, Object[] payload) { } } } - - + + @Override public void subscribe(Object channel, String messageName, NotificationObserver observer) { - if(!channelObserverMap.containsKey(channel)) { + if (!channelObserverMap.containsKey(channel)) { channelObserverMap.put(channel, new ObserverMap()); } - + final ObserverMap observerMap = channelObserverMap.get(channel); addObserver(messageName, observer, observerMap); } - + @Override public void unsubscribe(Object channel, String messageName, NotificationObserver observer) { - if(channelObserverMap.containsKey(channel)) { + if (channelObserverMap.containsKey(channel)) { final ObserverMap observerMap = channelObserverMap.get(channel); removeObserversForMessageName(messageName, observer, observerMap); } } - - + + @Override public void unsubscribe(Object channel, NotificationObserver observer) { - if(channelObserverMap.containsKey(channel)){ + if (channelObserverMap.containsKey(channel)) { ObserverMap observerMap = channelObserverMap.get(channel); removeObserverFromObserverMap(observer, observerMap); } @@ -120,48 +120,47 @@ public void unsubscribe(Object channel, NotificationObserver observer) { /* * Helper */ - + private void publish(String messageName, Object[] payload, ObserverMap observerMap) { Collection<NotificationObserver> notificationReceivers = observerMap.get(messageName); if (notificationReceivers != null) { - + // make a copy to prevent ConcurrentModificationException if inside of an observer a new observer is subscribed. - final Collection<NotificationObserver> copy = new ArrayList<>(notificationReceivers); - - for (NotificationObserver observer : copy) { + + for (NotificationObserver observer : notificationReceivers) { observer.receivedNotification(messageName, payload); } } } - + private void addObserver(String messageName, NotificationObserver observer, ObserverMap observerMap) { - if(!observerMap.containsKey(messageName)) { - observerMap.put(messageName, new ArrayList<>()); + if (!observerMap.containsKey(messageName)) { + // use CopyOnWriteArrayList to prevent ConcurrentModificationException if inside of an observer a new observer is subscribed. + observerMap.put(messageName, new CopyOnWriteArrayList<>()); } - + final List<NotificationObserver> observers = observerMap.get(messageName); - - if(observers.contains(observer)) { - LOG.warn("Subscribe the observer ["+ observer + "] for the message [" + messageName + - "], but the same observer was already added for this message in the past."); + + if (observers.contains(observer)) { + LOG.warn("Subscribe the observer [" + observer + "] for the message [" + messageName + + "], but the same observer was already added for this message in the past."); } observers.add(observer); } - - - + + private void removeObserverFromObserverMap(NotificationObserver observer, ObserverMap observerMap) { for (String key : observerMap.keySet()) { final List<NotificationObserver> observers = observerMap.get(key); - + observers.removeIf(actualObserver -> actualObserver.equals(observer)); } } - + private void removeObserversForMessageName(String messageName, NotificationObserver observer, - ObserverMap observerMap) { - - if(observerMap.containsKey(messageName)) { + ObserverMap observerMap) { + + if (observerMap.containsKey(messageName)) { final List<NotificationObserver> observers = observerMap.get(messageName); observers.removeIf(actualObserver -> actualObserver.equals(observer)); if (observers.size() == 0) { @@ -169,15 +168,12 @@ private void removeObserversForMessageName(String messageName, NotificationObser } } } - + @SuppressWarnings("serial") private class ObserverMap extends HashMap<String, List<NotificationObserver>> { } - + @SuppressWarnings("serial") private class ChannelObserverMap extends HashMap<Object, ObserverMap> { } - - - } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenterTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenterTest.java index 22fb8bb4e..b3576a807 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenterTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenterTest.java @@ -40,15 +40,15 @@ public class DefaultNotificationCenterTest { private NotificationCenter defaultCenter; - DummyNotificationObserver observer1; - DummyNotificationObserver observer2; - DummyNotificationObserver observer3; + NotificationObserver observer1; + NotificationObserver observer2; + NotificationObserver observer3; @Before public void init() { - observer1 = Mockito.mock(DummyNotificationObserver.class); - observer2 = Mockito.mock(DummyNotificationObserver.class); - observer3 = Mockito.mock(DummyNotificationObserver.class); + observer1 = Mockito.mock(NotificationObserver.class); + observer2 = Mockito.mock(NotificationObserver.class); + observer3 = Mockito.mock(NotificationObserver.class); defaultCenter = new DefaultNotificationCenter(); } @@ -177,12 +177,5 @@ public void observerForViewModelIsCalledFromUiThread() throws InterruptedExcepti assertThat(wasCalledOnUiThread).isTrue(); } - - private class DummyNotificationObserver implements NotificationObserver { - @Override - public void receivedNotification(String key, Object... payload) { - - } - } - + } diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java index e623014fa..cf532e97e 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/NotificationTestHelperTest.java @@ -78,7 +78,7 @@ public void globalNotificationCenter() { @Test public void publishOnOtherThread() { - NotificationTestHelper helper = new NotificationTestHelper(50l); + NotificationTestHelper helper = new NotificationTestHelper(150l); NotificationCenter notificationCenter = new DefaultNotificationCenter(); diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakOnViewModelTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakOnViewModelTest.java new file mode 100644 index 000000000..8af5ccaf7 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakOnViewModelTest.java @@ -0,0 +1,157 @@ +package de.saxsys.mvvmfx.utils.notifications.viewmodel; + +import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.testingutils.GCVerifier; +import de.saxsys.mvvmfx.testingutils.jfxrunner.JfxRunner; +import de.saxsys.mvvmfx.utils.notifications.NotificationObserver; +import javafx.application.Platform; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.assertj.core.api.Assertions.assertThat; + + +/** + * This test verifies that the communication between View and ViewModel + * via notifications doesn't introduce memory leaks. + */ +@RunWith(JfxRunner.class) +public class MemoryLeakOnViewModelTest { + + + /** + * A more complex and realistic test to verify that both + * the View and the ViewModel can be garbage collected. + */ + @Test + public void testViewModelWithViewCommunication() { + + MemoryLeakViewModel viewModel = new MemoryLeakViewModel(); + + MemoryLeakView view = new MemoryLeakView(); + view.viewModel = viewModel; + + view.init(); + + GCVerifier.forceGC(); + + viewModel.actionThatPublishes(); + + waitForUiThread(); + + + assertThat(view.counter.get()).isEqualTo(1); + + GCVerifier viewVerifier = GCVerifier.create(view); + GCVerifier viewModelVerifier = GCVerifier.create(viewModel); + + + viewModel = null; + view = null; + + + viewModelVerifier.verify("ViewModel cannot be GCed"); + viewVerifier.verify("View cannot be GCed"); + } + + /** + * A simple test to verify that the ViewModel instance can be + * garbage collected. + */ + @Test + public void testViewModelCommunication() { + + ViewModel vm = new ViewModel() {}; + + AtomicInteger counter = new AtomicInteger(); + + vm.subscribe("test", (k, v) -> counter.incrementAndGet()); + + GCVerifier.forceGC(); + + + vm.publish("test"); + + + waitForUiThread(); + + + assertThat(counter.get()).isEqualTo(1); + + + GCVerifier verifier = GCVerifier.create(vm); + + + vm = null; + + verifier.verify("VM cannot be GCed"); + } + + + /** + * By using a new instance of a (static) class as observer, + * there is no leak possible by the observer. + * + * This test ensures that there is no leak from using the ViewModel instance + * as channel object. + */ + @Test + public void testStaticObserverDoesntCreateMemoryLeak() { + + ViewModel vm = new ViewModel() {}; + + StaticObserver.counter.set(0); + + + vm.subscribe("test", new StaticObserver()); + + GCVerifier.forceGC(); + + vm.publish("test"); + + waitForUiThread(); + + assertThat(StaticObserver.counter.get()).isEqualTo(1); + + + GCVerifier verifier = GCVerifier.create(vm); + + + vm = null; + + verifier.verify("VM cannot be GCed"); + } + + private static class StaticObserver implements NotificationObserver { + + static AtomicInteger counter = new AtomicInteger(); + + + @Override + public void receivedNotification(String key, Object... payload) { + StaticObserver.counter.incrementAndGet(); + } + } + + + /** + * This method is used to wait until the UI thread has done all work that was queued via + * {@link Platform#runLater(Runnable)}. + */ + private void waitForUiThread() { + CompletableFuture<Void> future = new CompletableFuture<>(); + Platform.runLater(() -> future.complete(null)); + try { + future.get(1l, TimeUnit.SECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + throw new IllegalStateException(e); + } + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakView.java new file mode 100644 index 000000000..7306c1d73 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakView.java @@ -0,0 +1,23 @@ +package de.saxsys.mvvmfx.utils.notifications.viewmodel; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.utils.notifications.NotificationObserver; +import de.saxsys.mvvmfx.utils.notifications.WeakNotificationObserver; + +import java.util.concurrent.atomic.AtomicInteger; + +public class MemoryLeakView implements FxmlView<MemoryLeakViewModel> { + + + public MemoryLeakViewModel viewModel; + + public AtomicInteger counter = new AtomicInteger(); + + private NotificationObserver observer = (k, v) -> { + counter.incrementAndGet(); + }; + + public void init() { + viewModel.subscribe(MemoryLeakViewModel.MESSAGE_NAME, new WeakNotificationObserver(observer)); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakViewModel.java new file mode 100644 index 000000000..268afc765 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/MemoryLeakViewModel.java @@ -0,0 +1,13 @@ +package de.saxsys.mvvmfx.utils.notifications.viewmodel; + +import de.saxsys.mvvmfx.ViewModel; + +public class MemoryLeakViewModel implements ViewModel { + + public static final String MESSAGE_NAME = "test"; + + + public void actionThatPublishes() { + publish(MESSAGE_NAME); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/ViewModelTest.java similarity index 90% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/ViewModelTest.java index ad175b637..b425c421b 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/ViewModelTest.java @@ -13,11 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.utils.notifications; +package de.saxsys.mvvmfx.utils.notifications.viewmodel; import de.saxsys.mvvmfx.MvvmFX; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.testingutils.jfxrunner.JfxRunner; +import de.saxsys.mvvmfx.utils.notifications.DefaultNotificationCenter; +import de.saxsys.mvvmfx.utils.notifications.DefaultNotificationCenterTest; +import de.saxsys.mvvmfx.utils.notifications.NotificationCenterFactory; +import de.saxsys.mvvmfx.utils.notifications.NotificationObserver; import javafx.application.Platform; import org.junit.Before; import org.junit.Test; @@ -29,6 +33,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +/** + * This test verifies the communication via notifications between the View and ViewModel. + */ @RunWith(JfxRunner.class) public class ViewModelTest { @@ -47,6 +54,8 @@ public void init() { observer3 = Mockito.mock(DummyNotificationObserver.class); viewModel = new ViewModel() { }; + + NotificationCenterFactory.setNotificationCenter(new DefaultNotificationCenter()); } @Test diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/ViewModelWithoutUiThreadTest.java similarity index 96% rename from mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java rename to mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/ViewModelWithoutUiThreadTest.java index 081939318..52385d1e9 100644 --- a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/ViewModelWithoutUiThreadTest.java +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/ViewModelWithoutUiThreadTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ -package de.saxsys.mvvmfx.utils.notifications; +package de.saxsys.mvvmfx.utils.notifications.viewmodel; import de.saxsys.mvvmfx.ViewModel; import org.junit.Test; From d7cc886d3fbbd3e769117b75dcd8947d07f0e3a5 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Mon, 30 May 2016 17:00:56 +0200 Subject: [PATCH 93/96] Implemented a WeakNotificationObserver that can be used to prevent memory leaks --- .../mvvmfx/testingutils/GCVerifier.java | 13 +- .../DefaultNotificationCenter.java | 33 ++- .../WeakNotificationObserver.java | 104 ++++++++++ .../notifications/MemoryLeakGlobalTest.java | 164 +++++++++++++++ .../viewmodel/WeakNotificationsTest.java | 190 ++++++++++++++++++ 5 files changed, 496 insertions(+), 8 deletions(-) create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/WeakNotificationObserver.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/MemoryLeakGlobalTest.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/WeakNotificationsTest.java diff --git a/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java b/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java index 1ab1a5d15..9242fbda3 100644 --- a/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java +++ b/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/GCVerifier.java @@ -48,11 +48,20 @@ public static GCVerifier create(Object instance) { public void verify(String message) { forceGC(); - - if (reference.get() != null) { + + if (!isAvailableForGC()) { throw new AssertionError(message); } } + + /** + * @return <code>true</code> if the object is available + */ + public boolean isAvailableForGC() { + forceGC(); + + return reference.get() == null; + } public void verify() { verify("Expected the given object [" + objectName + "] to be available for Garbage Collection but it isn't"); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java index 419b09f51..7af4cbb1a 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java @@ -121,7 +121,7 @@ public void unsubscribe(Object channel, NotificationObserver observer) { * Helper */ - private void publish(String messageName, Object[] payload, ObserverMap observerMap) { + private static void publish(String messageName, Object[] payload, ObserverMap observerMap) { Collection<NotificationObserver> notificationReceivers = observerMap.get(messageName); if (notificationReceivers != null) { @@ -133,7 +133,7 @@ private void publish(String messageName, Object[] payload, ObserverMap observerM } } - private void addObserver(String messageName, NotificationObserver observer, ObserverMap observerMap) { + private static void addObserver(String messageName, NotificationObserver observer, ObserverMap observerMap) { if (!observerMap.containsKey(messageName)) { // use CopyOnWriteArrayList to prevent ConcurrentModificationException if inside of an observer a new observer is subscribed. observerMap.put(messageName, new CopyOnWriteArrayList<>()); @@ -149,20 +149,41 @@ private void addObserver(String messageName, NotificationObserver observer, Obse } - private void removeObserverFromObserverMap(NotificationObserver observer, ObserverMap observerMap) { + private static void removeObserverFromObserverMap(NotificationObserver observer, ObserverMap observerMap) { for (String key : observerMap.keySet()) { final List<NotificationObserver> observers = observerMap.get(key); - observers.removeIf(actualObserver -> actualObserver.equals(observer)); + removeObserverFromObserverList(observer, observers); } } - private void removeObserversForMessageName(String messageName, NotificationObserver observer, + private static void removeObserverFromObserverList(NotificationObserver observer, List<NotificationObserver> observerList) { + observerList.removeIf(actualObserver -> actualObserver.equals(observer)); + + observerList.removeIf(actualObserver -> { + if(actualObserver instanceof WeakNotificationObserver) { + WeakNotificationObserver weakObserver = (WeakNotificationObserver) actualObserver; + + NotificationObserver wrappedObserver = weakObserver.getWrappedObserver(); + + if(wrappedObserver == null) { // if reference was GCed we can remove the weakObserver + return true; + } else { + return wrappedObserver.equals(observer); + } + } + + return false; + }); + } + + private static void removeObserversForMessageName(String messageName, NotificationObserver observer, ObserverMap observerMap) { if (observerMap.containsKey(messageName)) { final List<NotificationObserver> observers = observerMap.get(messageName); - observers.removeIf(actualObserver -> actualObserver.equals(observer)); + removeObserverFromObserverList(observer, observers); + if (observers.size() == 0) { observerMap.remove(messageName); } diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/WeakNotificationObserver.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/WeakNotificationObserver.java new file mode 100644 index 000000000..cd13a66d5 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/WeakNotificationObserver.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright 2016 Alexander Casall, Manuel Mauky + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ +package de.saxsys.mvvmfx.utils.notifications; + +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; +import java.util.Objects; + + +/** + * + * This class is a wrapper of a {@link NotificationObserver} that only + * holds a weak reference to the observer. + * <p> + * When using normal {@link NotificationObserver} in combination with the global {@link NotificationObserver} + * the notification center will hold a reference to the observer as long as it isn't unregistered. + * The observer itself will most likely hold a reference to the parent class which can prevent + * the parent class from being garbage collected. + * In many use cases this is not a problem but in some situations this can cause memory leaks. + * + * + * <p> + * For such situations this class can be used as a Wrapper around the normal notification observer. + * The usage should look like this: + * + * <pre> + * + * public class MyClass { + * + * private NotificationObserver observer; + * + * ... + * + * public void someMethod() { + * observer = (key, payload) -> { + * // do something when observer is called. + * + * }; + * + * notificationCenter.subscribe("some_topic", new WeakNotificationObserver(observer)); + * } + * } + * </pre> + * + * The example shows the following steps: + * + * <ul> + * <li>Create a field for your observer of type {@link NotificationObserver}</li> + * <li>Create an instance of your observer, for example as a lambda.</li> + * <li>subscribe to a topic by creating a new instance of {@link WeakNotificationObserver} + * and pass the normal observer as constructor argument</li> + * </ul> + * + * It's important to hold a hard reference to the normal observer in your class. This can be done + * by creating a field for the observer. This way you prevent the observer from being garbage collected to early. + * Creating a local variable in the body of a method will <strong>not</strong> work! + * <p> + * + * Using the pattern mentioned above will: + * <ul> + * <li>prevent the observer from being garbage collected to early</li> + * <li>allow the garbage collector to collect the parent class as soon as it isn't references in other places</li> + * </ul> + * + * @author manuel.mauky + */ +public final class WeakNotificationObserver implements NotificationObserver { + + private final Reference<NotificationObserver> reference; + + public WeakNotificationObserver(NotificationObserver notificationObserver) { + reference = new WeakReference<>(Objects.requireNonNull(notificationObserver)); + } + + @Override + public void receivedNotification(String key, Object... payload) { + NotificationObserver observer = reference.get(); + if (observer != null) { + observer.receivedNotification(key, payload); + } + } + + /** + * @return the reference of the wrapped {@link NotificationObserver}. + * If the wrapped observer was already garbage collected, this returns <code>null</code> + */ + NotificationObserver getWrappedObserver() { + return reference.get(); + } + +} \ No newline at end of file diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/MemoryLeakGlobalTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/MemoryLeakGlobalTest.java new file mode 100644 index 000000000..415dba909 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/MemoryLeakGlobalTest.java @@ -0,0 +1,164 @@ +package de.saxsys.mvvmfx.utils.notifications; + +import de.saxsys.mvvmfx.testingutils.GCVerifier; +import org.junit.After; +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicInteger; + +import static org.assertj.core.api.Assertions.assertThat; + + +/** + * This test case shows how to use {@link WeakNotificationObserver} + * to prevent memory leaks due to the notification center. + */ +public class MemoryLeakGlobalTest { + + + @After + public void tearDown() { + NotificationCenterFactory.setNotificationCenter(new DefaultNotificationCenter()); + } + + /** + * This shows how a memory leak is introduced by using the notification center + * directly with a plain observer. + * + * @see #testMemoryLeak() + * + */ + public static class Subject1 { + public AtomicInteger counter = new AtomicInteger(); + + public void setup() { + NotificationCenterFactory.getNotificationCenter() + .subscribe("test", (k,p) -> counter.incrementAndGet()); + + } + } + + /** + * @see Subject1 + */ + @Test + public void testMemoryLeak() { + Subject1 subject = new Subject1(); + + subject.setup(); + + GCVerifier.forceGC(); + + assertThat(subject.counter.get()).isEqualTo(0); + + + NotificationCenterFactory.getNotificationCenter() + .publish("test"); + + assertThat(subject.counter.get()).isEqualTo(1); + + GCVerifier verifier = GCVerifier.create(subject); + + + subject = null; + + // subject creates a memory leak because a hard reference was used. + assertThat(verifier.isAvailableForGC()).isFalse(); + } + + /** + * This shows how a memory leak is fixed by using + * a {@link WeakNotificationObserver} and a hard reference to the wrapped + * observer in a field of the subject class. + * + * + * @see #testMemoryLeakFixed() + * + */ + static class Subject2 { + public AtomicInteger counter = new AtomicInteger(); + + private NotificationObserver observer = (k,p) -> counter.incrementAndGet(); + + public void setup() { + NotificationCenterFactory.getNotificationCenter() + .subscribe("test", new WeakNotificationObserver(observer)); + + } + } + + + /** + * @see Subject2 + */ + @Test + public void testMemoryLeakFixed() { + Subject2 subject = new Subject2(); + + subject.setup(); + + GCVerifier.forceGC(); + + assertThat(subject.counter.get()).isEqualTo(0); + + + NotificationCenterFactory.getNotificationCenter() + .publish("test"); + + assertThat(subject.counter.get()).isEqualTo(1); + + GCVerifier verifier = GCVerifier.create(subject); + + + subject = null; + + // subject creates a memory leak because a hard reference was used. + assertThat(verifier.isAvailableForGC()).isTrue(); + } + + /** + * This shows how to <strong>not</strong> fix a memory leak. + * In the subject a {@link WeakNotificationObserver} was used + * but no reference to the wrapped observer was keeped. Instead an inline lambda is used as observer. + * <p /> + * The problem is that this way the wrapped observer will be prematurely garbage + * collected while the subject instance is still alive. + * + * + * @see #testInlineWeakObserverIsPrematurelyCollected() + */ + static class Subject3 { + public AtomicInteger counter = new AtomicInteger(); + + public void setup() { + NotificationCenterFactory.getNotificationCenter() + .subscribe("test", new WeakNotificationObserver((k, p) -> counter.incrementAndGet())); + + } + } + + /** + * @see Subject3 + */ + @Test + public void testInlineWeakObserverIsPrematurelyCollected() { + Subject3 subject = new Subject3(); + + subject.setup(); + + GCVerifier.forceGC(); + + + assertThat(subject.counter.get()).isEqualTo(0); + + + NotificationCenterFactory.getNotificationCenter() + .publish("test"); + + // The observer is already garbage collected. + // For this reason the counter wasn't increased. + assertThat(subject.counter.get()).isEqualTo(0); + } + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/WeakNotificationsTest.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/WeakNotificationsTest.java new file mode 100644 index 000000000..deb36f076 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/notifications/viewmodel/WeakNotificationsTest.java @@ -0,0 +1,190 @@ +package de.saxsys.mvvmfx.utils.notifications.viewmodel; + +import de.saxsys.mvvmfx.testingutils.jfxrunner.JfxRunner; +import de.saxsys.mvvmfx.utils.notifications.*; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; + +/** + * This test is used to verify the usage of the {@link WeakNotificationObserver}. + * To do this most test cases of {@link DefaultNotificationCenterTest} + * are reproduced with the weak variant of notifications. + */ +@RunWith(JfxRunner.class) +public class WeakNotificationsTest { + + + private static final String TEST_NOTIFICATION = "test_notification"; + private static final String TEST_NOTIFICATION_2 = TEST_NOTIFICATION + "shouldnotget"; + private static final Object[] OBJECT_ARRAY_FOR_NOTIFICATION = new String[]{"test"}; + + private NotificationCenter defaultCenter; + + NotificationObserver observer1; + NotificationObserver observer2; + NotificationObserver observer3; + + @Before + public void init() { + observer1 = Mockito.mock(NotificationObserver.class); + observer2 = Mockito.mock(NotificationObserver.class); + observer3 = Mockito.mock(NotificationObserver.class); + defaultCenter = new DefaultNotificationCenter(); + } + + @Test + public void weakObserverCanBeDirectlyUnsubscribed() throws Exception { + WeakNotificationObserver weakObserver1 = new WeakNotificationObserver(observer1); + + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + defaultCenter.unsubscribe(TEST_NOTIFICATION, weakObserver1); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + } + + @Test + public void weakObserverCanBeUnsubscibedByWrappedObserver() throws Exception { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + + defaultCenter.unsubscribe(TEST_NOTIFICATION, observer1); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + } + + + + + + + + + + @Test + public void addObserverToDefaultNotificationCenterAndPostNotification() throws Exception { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1).receivedNotification(TEST_NOTIFICATION); + } + + @Test + public void addObserverToDefaultNotificationCenterAndPostObjectNotification() throws Exception { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.publish(TEST_NOTIFICATION, OBJECT_ARRAY_FOR_NOTIFICATION); + Mockito.verify(observer1).receivedNotification(TEST_NOTIFICATION, OBJECT_ARRAY_FOR_NOTIFICATION); + } + + @Test + public void addAndRemoveObserverToDefaultNotificationCenterAndPostNotification() throws Exception { + WeakNotificationObserver weakObserver1 = new WeakNotificationObserver(observer1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + WeakNotificationObserver weakObserver2 = new WeakNotificationObserver(observer2); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver2); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer3)); + defaultCenter.unsubscribe(weakObserver1); + defaultCenter.unsubscribe(weakObserver2); + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + Mockito.verify(observer2, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + Mockito.verify(observer3).receivedNotification(TEST_NOTIFICATION); + } + + @Test + public void addAndRemoveWeakObserverToDefaultNotificationCenterAndPostNotification() throws Exception { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer2)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer3)); + defaultCenter.unsubscribe(observer1); + defaultCenter.unsubscribe(observer2); + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + Mockito.verify(observer2, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + Mockito.verify(observer3).receivedNotification(TEST_NOTIFICATION); + } + + @Test + public void addObserversToDefaultNotificationCenterAndPostNotification() throws Exception { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION_2, new WeakNotificationObserver(observer2)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer3)); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.only()).receivedNotification(TEST_NOTIFICATION); + Mockito.verify(observer2, Mockito.never()).receivedNotification(TEST_NOTIFICATION_2); + Mockito.verify(observer3, Mockito.only()).receivedNotification(TEST_NOTIFICATION); + } + + + @Test + public void subscribeSameObserverMultipleTimes() { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.times(2)).receivedNotification(TEST_NOTIFICATION); + } + + @Test + public void unsubscribeObserverThatWasSubscribedMultipleTimes() { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + + defaultCenter.unsubscribe(observer1); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + } + + @Test + public void unsubscribeWeakObserverThatWasSubscribedMultipleTimes() { + WeakNotificationObserver weakObserver1 = new WeakNotificationObserver(observer1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + + defaultCenter.unsubscribe(weakObserver1); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + } + + + /** + * This is the same as {@link #unsubscribeObserverThatWasSubscribedMultipleTimes()} with the + * difference that here we use the overloaded unsubscribe method {@link NotificationCenter#unsubscribe(String, NotificationObserver)} that takes + * the message key as first parameter. + */ + @Test + public void unsubscribeObserverThatWasSubscribedMultipleTimesViaMessageName() { + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + defaultCenter.subscribe(TEST_NOTIFICATION, new WeakNotificationObserver(observer1)); + + defaultCenter.unsubscribe(TEST_NOTIFICATION, observer1); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + } + + /** + * This is the same as {@link #unsubscribeObserverThatWasSubscribedMultipleTimes()} with the + * difference that here we use the overloaded unsubscribe method {@link NotificationCenter#unsubscribe(String, NotificationObserver)} that takes + * the message key as first parameter. + */ + @Test + public void unsubscribeWeakObserverThatWasSubscribedMultipleTimesViaMessageName() { + WeakNotificationObserver weakObserver1 = new WeakNotificationObserver(observer1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + defaultCenter.subscribe(TEST_NOTIFICATION, weakObserver1); + + defaultCenter.unsubscribe(TEST_NOTIFICATION, weakObserver1); + + defaultCenter.publish(TEST_NOTIFICATION); + Mockito.verify(observer1, Mockito.never()).receivedNotification(TEST_NOTIFICATION); + } +} From 4edf7073c8ba8538df6cfeede0200311dfad9abb Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Wed, 1 Jun 2016 18:05:42 +0200 Subject: [PATCH 94/96] Refactoring and more tests for scopes --- .../mvvmfx/testingutils/FxTestingUtils.java | 30 +++++++++++ .../de/saxsys/mvvmfx/FluentViewLoader.java | 17 +++++- .../saxsys/mvvmfx/internal/ContextImpl.java | 28 ++++++++++ .../saxsys/mvvmfx/internal/Impl_Context.java | 37 ------------- .../internal/viewloader/FxmlViewLoader.java | 24 ++++----- .../internal/viewloader/JavaViewLoader.java | 7 +-- .../viewloader/ViewLoaderReflectionUtils.java | 13 +++-- .../viewloader/ViewLoaderScopeUtils.java | 27 +++++----- .../scopes/example4/views/ChildView.java | 26 +++++++++ .../scopes/example4/views/ChildViewModel.java | 21 ++++++++ .../scopes/example4/views/DialogScope.java | 11 ++++ .../scopes/example4/views/DialogView.java | 10 ++++ .../example4/views/DialogViewModel.java | 18 +++++++ .../scopes/example4/views/Example4Test.java | 54 +++++++++++++++++++ .../scopes/example4/views/ParentView.java | 10 ++++ .../example4/views/ParentViewModel.java | 6 +++ .../mvvmfx/scopes/example5/Example5Scope.java | 6 +++ .../mvvmfx/scopes/example5/Example5Test.java | 28 ++++++++++ .../saxsys/mvvmfx/scopes/example5/MyView.java | 12 +++++ .../mvvmfx/scopes/example5/MyViewModel.java | 11 ++++ .../scopes/example4/views/ChildView.fxml | 7 +++ .../scopes/example4/views/DialogView.fxml | 7 +++ .../scopes/example4/views/ParentView.fxml | 11 ++++ .../saxsys/mvvmfx/scopes/example5/MyView.fxml | 7 +++ 24 files changed, 352 insertions(+), 76 deletions(-) create mode 100644 mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/FxTestingUtils.java create mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/ContextImpl.java delete mode 100644 mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildViewModel.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogScope.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogViewModel.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/Example4Test.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentViewModel.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Scope.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Test.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyView.java create mode 100644 mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyViewModel.java create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ChildView.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/DialogView.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ParentView.fxml create mode 100644 mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example5/MyView.fxml diff --git a/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/FxTestingUtils.java b/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/FxTestingUtils.java new file mode 100644 index 000000000..84101b7fa --- /dev/null +++ b/mvvmfx-testing-utils/src/main/java/de/saxsys/mvvmfx/testingutils/FxTestingUtils.java @@ -0,0 +1,30 @@ +package de.saxsys.mvvmfx.testingutils; + +import javafx.application.Platform; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class FxTestingUtils { + + + public static void waitForUiThread(long timeout) { + CompletableFuture<Void> future = new CompletableFuture<>(); + + Platform.runLater(() -> { + future.complete(null); + }); + + try { + future.get(timeout+50, TimeUnit.MILLISECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + e.printStackTrace(); + } + } + + public static void waitForUiThread() { + waitForUiThread(0); + } +} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java index c687f79ef..9df55f7a6 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/FluentViewLoader.java @@ -1,6 +1,7 @@ package de.saxsys.mvvmfx; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.ResourceBundle; @@ -65,7 +66,7 @@ public static class JavaViewStep<ViewType extends JavaView<? extends ViewModelTy private ViewModelType viewModel; private ViewType codeBehind; private Context context; - private List<Scope> providedScopes; + private Collection<Scope> providedScopes; JavaViewStep(Class<? extends ViewType> viewType) { this.viewType = viewType; @@ -81,6 +82,13 @@ public JavaViewStep<ViewType, ViewModelType> providedScopes(Scope... providedSco return this; } + public JavaViewStep<ViewType, ViewModelType> providedScopes(Collection<Scope> providedScopes) { + this.providedScopes = providedScopes; + return this; + } + + + /** * Provide a {@link ResourceBundle} that is used while loading this * view. Note: It is possible to provide a global application-wide @@ -171,7 +179,7 @@ public static class FxmlViewStep<ViewType extends FxmlView<? extends ViewModelTy private ViewType codeBehind; private ViewModelType viewModel; private Context context; - private List<Scope> providedScopes; + private Collection<Scope> providedScopes; FxmlViewStep(Class<? extends ViewType> viewType) { this.viewType = viewType; @@ -189,6 +197,11 @@ public FxmlViewStep<ViewType, ViewModelType> providedScopes(Scope... providedSco return this; } + public FxmlViewStep<ViewType, ViewModelType> providedScopes(Collection<Scope> providedScopes) { + this.providedScopes = providedScopes; + return this; + } + /** * Provide a {@link ResourceBundle} that is used while loading this * view. Note: It is possible to provide a global application-wide diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/ContextImpl.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/ContextImpl.java new file mode 100644 index 000000000..396215a62 --- /dev/null +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/ContextImpl.java @@ -0,0 +1,28 @@ +package de.saxsys.mvvmfx.internal; + +import java.util.HashMap; +import java.util.Map; + +import de.saxsys.mvvmfx.Context; +import de.saxsys.mvvmfx.Scope; + +public class ContextImpl implements Context { + + private final Map<Class<? extends Scope>, Object> scopeContext; + + public ContextImpl() { + this(new HashMap<>()); + } + + private ContextImpl(Map<Class<? extends Scope>, Object> scopeContext) { + this.scopeContext = scopeContext; + } + + public void addScopeToContext(Scope scope) { + scopeContext.put(scope.getClass(), scope); + } + + public <T extends Scope> Object getScope(Class<T> scopeType) { + return scopeContext.get(scopeType); + } +} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java deleted file mode 100644 index 62df4eba2..000000000 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/Impl_Context.java +++ /dev/null @@ -1,37 +0,0 @@ -package de.saxsys.mvvmfx.internal; - -import java.util.HashMap; -import java.util.Map; - -import de.saxsys.mvvmfx.Context; -import de.saxsys.mvvmfx.Scope; - -public class Impl_Context implements Context { - - private final Map<Class<? extends Scope>, Object> scopeContext; - - public Impl_Context() { - this(new HashMap<>()); - } - - protected Impl_Context(Map<Class<? extends Scope>, Object> scopeContext) { - this.scopeContext = scopeContext; - } - - public Map<Class<? extends Scope>, Object> getScopeContext() { - return scopeContext; - } - - /** - * Private! - * - * @return - */ - public Impl_Context copy() { - Map<Class<? extends Scope>, Object> scopeContextCopy = new HashMap<>(); - scopeContextCopy.putAll(scopeContext); - Impl_Context contextCopy = new Impl_Context(scopeContextCopy); - return contextCopy; - } - -} diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java index eff56453e..ed8f282d6 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/FxmlViewLoader.java @@ -17,7 +17,7 @@ import java.io.IOException; import java.net.URL; -import java.util.List; +import java.util.Collection; import java.util.ResourceBundle; import java.util.function.Consumer; @@ -28,7 +28,7 @@ import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.internal.Impl_Context; +import de.saxsys.mvvmfx.internal.ContextImpl; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.util.Callback; @@ -68,7 +68,7 @@ public class FxmlViewLoader { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( Class<? extends ViewType> viewType, ResourceBundle resourceBundle, ViewType codeBehind, Object root, - ViewModelType viewModel, Context context, List<Scope> providedScopes) { + ViewModelType viewModel, Context context, Collection<Scope> providedScopes) { final String pathToFXML = createFxmlPath(viewType); return loadFxmlViewTuple(pathToFXML, resourceBundle, codeBehind, root, viewModel, context, providedScopes); @@ -133,11 +133,11 @@ private String createFxmlPath(Class<?> viewType) { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadFxmlViewTuple( final String resource, ResourceBundle resourceBundle, final ViewType codeBehind, final Object root, - ViewModelType viewModel, Context parentContext, List<Scope> providedScopes) { + ViewModelType viewModel, Context parentContext, Collection<Scope> providedScopes) { try { // FIXME Woanders hin? - Impl_Context context = ViewLoaderScopeUtils.prepareContext(parentContext, providedScopes); + ContextImpl context = ViewLoaderScopeUtils.prepareContext(parentContext, providedScopes); ////////////////////////////////////////////////////////////////////// final FXMLLoader loader = createFxmlLoader(resource, resourceBundle, codeBehind, root, viewModel, context); @@ -203,7 +203,7 @@ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends Vi } private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View codeBehind, Object root, - ViewModel viewModel, Impl_Context context) throws IOException { + ViewModel viewModel, ContextImpl context) throws IOException { // Load FXML file final URL location = FxmlViewLoader.class.getResource(resource); if (location == null) { @@ -248,9 +248,9 @@ private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBund */ private static class DefaultControllerFactory implements Callback<Class<?>, Object> { private final ResourceBundle resourceBundle; - private final Impl_Context context; + private final ContextImpl context; - public DefaultControllerFactory(ResourceBundle resourceBundle, Impl_Context context) { + public DefaultControllerFactory(ResourceBundle resourceBundle, ContextImpl context) { this.resourceBundle = resourceBundle; this.context = context; } @@ -269,7 +269,7 @@ public Object call(Class<?> type) { } } - private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, Impl_Context context) { + private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, ContextImpl context) { ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); Consumer<ViewModel> newVmConsumer = viewModel -> { @@ -283,7 +283,7 @@ private static void handleInjection(View codeBehind, ResourceBundle resourceBund } private static void handleInjection(View codeBehind, ResourceBundle resourceBundle, ViewModel viewModel, - Impl_Context context) { + ContextImpl context) { ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle); if (viewModel != null) { @@ -330,10 +330,10 @@ private static class ControllerFactoryForCustomViewModel implements Callback<Cla private final ResourceBundle resourceBundle; - private final Impl_Context context; + private final ContextImpl context; public ControllerFactoryForCustomViewModel(ViewModel customViewModel, ResourceBundle resourceBundle, - Impl_Context context) { + ContextImpl context) { this.customViewModel = customViewModel; this.resourceBundle = resourceBundle; this.context = context; diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java index 148fd1921..7ab26f884 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/JavaViewLoader.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Collection; import java.util.List; import java.util.ResourceBundle; @@ -30,7 +31,7 @@ import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.ViewTuple; -import de.saxsys.mvvmfx.internal.Impl_Context; +import de.saxsys.mvvmfx.internal.ContextImpl; import javafx.fxml.Initializable; import javafx.scene.Parent; @@ -79,10 +80,10 @@ public class JavaViewLoader { */ public <ViewType extends View<? extends ViewModelType>, ViewModelType extends ViewModel> ViewTuple<ViewType, ViewModelType> loadJavaViewTuple( Class<? extends ViewType> viewType, ResourceBundle resourceBundle, final ViewModelType existingViewModel, - ViewType codeBehind, Context parentContext, List<Scope> providedScopes) { + ViewType codeBehind, Context parentContext, Collection<Scope> providedScopes) { // FIXME Woanders hin?! - Impl_Context context = ViewLoaderScopeUtils.prepareContext(parentContext, providedScopes); + ContextImpl context = ViewLoaderScopeUtils.prepareContext(parentContext, providedScopes); //////////////////////////// DependencyInjector injectionFacade = DependencyInjector.getInstance(); diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java index 9c93953ca..755a4e453 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderReflectionUtils.java @@ -34,7 +34,7 @@ import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; -import de.saxsys.mvvmfx.internal.Impl_Context; +import de.saxsys.mvvmfx.internal.ContextImpl; import net.jodah.typetools.TypeResolver; /** @@ -271,7 +271,7 @@ public static <V extends View<? extends VM>, VM extends ViewModel> void createAn } } - static void createAndInjectScopes(Object viewModel, Impl_Context context) { + static void createAndInjectScopes(Object viewModel, ContextImpl context) { // FIXME CLEANUP!!! Class<? extends Object> viewModelClass = viewModel.getClass(); @@ -283,7 +283,7 @@ static void createAndInjectScopes(Object viewModel, Impl_Context context) { for (int i = 0; i < scopes.length; i++) { Class<? extends Scope> scopeType = scopes[i]; // Overrides existing scopes!!!! - context.getScopeContext().put(scopeType, DependencyInjector.getInstance().getInstanceOf(scopeType)); + context.addScopeToContext(DependencyInjector.getInstance().getInstanceOf(scopeType)); } } } @@ -297,7 +297,7 @@ static void createAndInjectScopes(Object viewModel, Impl_Context context) { }); } - public static void injectContext(View codeBehind, Impl_Context context) { + public static void injectContext(View codeBehind, ContextImpl context) { Optional<Field> contextField = getContextField(codeBehind.getClass()); @@ -309,7 +309,7 @@ public static void injectContext(View codeBehind, Impl_Context context) { } } - static Object injectScopeIntoField(Field scopeField, Object viewModel, Impl_Context context) + static Object injectScopeIntoField(Field scopeField, Object viewModel, ContextImpl context) throws IllegalAccessException { Class<? extends Scope> scopeType = (Class<? extends Scope>) scopeField.getType(); @@ -322,8 +322,7 @@ static Object injectScopeIntoField(Field scopeField, Object viewModel, Impl_Cont + "but the viewModel <" + viewModel + "> has a field that violates this rule."); } - Map<Class<? extends Scope>, Object> scopeBottich = context.getScopeContext(); - Object newScope = scopeBottich.get(scopeType); + Object newScope = context.getScope(scopeType); if (newScope == null) { // TODO Modify Stacktrace to get the Injectionpoint of the Scope diff --git a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java index e18fbc032..c914391db 100644 --- a/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java +++ b/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ViewLoaderScopeUtils.java @@ -1,30 +1,27 @@ package de.saxsys.mvvmfx.internal.viewloader; -import java.util.List; +import java.util.Collection; import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.Scope; -import de.saxsys.mvvmfx.internal.Impl_Context; +import de.saxsys.mvvmfx.internal.ContextImpl; -public class ViewLoaderScopeUtils { +class ViewLoaderScopeUtils { - public static Impl_Context prepareContext(Context parentContext, List<Scope> providedScopes) { - Impl_Context context = null; + static ContextImpl prepareContext(Context parentContext, Collection<Scope> providedScopes) { + ContextImpl context = null; - if (parentContext == null) { - context = new Impl_Context(); + if (parentContext == null || !(parentContext instanceof ContextImpl)) { + context = new ContextImpl(); } else { - if (parentContext instanceof Impl_Context) { - context = (Impl_Context) parentContext; - } + context = (ContextImpl) parentContext; } - final Impl_Context finalContext = context; - if (providedScopes != null) { - providedScopes.forEach(scope -> { - finalContext.getScopeContext().put(scope.getClass(), scope); - }); + + for (Scope scope : providedScopes) { + context.addScopeToContext(scope); + } } return context; diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildView.java new file mode 100644 index 000000000..b1b538524 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildView.java @@ -0,0 +1,26 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.*; + +public class ChildView implements FxmlView<ChildViewModel> { + + @InjectViewModel + ChildViewModel viewModel; + + + public DialogView dialogView; + + @InjectContext + Context context; + + public void initialize() { + viewModel.subscribe(ChildViewModel.OPEN_DIALOG_MESSAGE, (k,payload) -> { + ViewTuple<DialogView, DialogViewModel> viewTuple = FluentViewLoader.fxmlView(DialogView.class) + .context(context) + .load(); + + dialogView = viewTuple.getCodeBehind(); + }); + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildViewModel.java new file mode 100644 index 000000000..534e584d9 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ChildViewModel.java @@ -0,0 +1,21 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; +import de.saxsys.mvvmfx.ViewModel; + +@ScopeProvider(scopes = DialogScope.class) +public class ChildViewModel implements ViewModel { + + public static final String OPEN_DIALOG_MESSAGE = "ChildViewModel.OPEN_DIALOG_MESSAGE"; + + + @InjectScope + public DialogScope dialogScope; + + public void openDialog() { + dialogScope.someValue.set("something"); + + publish(OPEN_DIALOG_MESSAGE); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogScope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogScope.java new file mode 100644 index 000000000..585bec76d --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogScope.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.Scope; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +public class DialogScope implements Scope { + + StringProperty someValue = new SimpleStringProperty(); + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogView.java new file mode 100644 index 000000000..9e7563916 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogView.java @@ -0,0 +1,10 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class DialogView implements FxmlView<DialogViewModel> { + + @InjectViewModel + DialogViewModel viewModel; +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogViewModel.java new file mode 100644 index 000000000..983a1abc1 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/DialogViewModel.java @@ -0,0 +1,18 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; +import de.saxsys.mvvmfx.ViewModel; + + +public class DialogViewModel implements ViewModel { + + public static String scopeValueOnInitialization; + + @InjectScope + DialogScope scope; + + public void initialize() { + scopeValueOnInitialization = scope.someValue.getValue(); + } +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/Example4Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/Example4Test.java new file mode 100644 index 000000000..3c2fdf750 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/Example4Test.java @@ -0,0 +1,54 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import com.cedarsoft.test.utils.CatchAllExceptionsRule; +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.testingutils.FxTestingUtils; +import de.saxsys.mvvmfx.testingutils.jfxrunner.JfxRunner; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(JfxRunner.class) +public class Example4Test { + + + // Rule to get exceptions from the JavaFX Thread into the JUnit thread + @Rule + public CatchAllExceptionsRule catchAllExceptionsRule = new CatchAllExceptionsRule(); + + + @Test + public void test() { + + ViewTuple<ChildView, ChildViewModel> viewTuple = FluentViewLoader.fxmlView(ChildView.class).load(); + + ChildView codeBehind = viewTuple.getCodeBehind(); + ChildViewModel viewModel = viewTuple.getViewModel(); + + DialogScope dialogScopeFromChildVM = viewModel.dialogScope; + + assertThat(codeBehind.dialogView).isNull(); + + + + viewModel.openDialog(); + + + FxTestingUtils.waitForUiThread(); + + + assertThat(codeBehind.dialogView).isNotNull(); + + DialogView dialogView = codeBehind.dialogView; + DialogViewModel dialogViewModel = dialogView.viewModel; + + DialogScope dialogScopeFromDialogVM = dialogViewModel.scope; + + assertThat(dialogScopeFromDialogVM).isEqualTo(dialogScopeFromChildVM); + } + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentView.java new file mode 100644 index 000000000..d2b1fa343 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentView.java @@ -0,0 +1,10 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class ParentView implements FxmlView<ParentViewModel> { + + @InjectViewModel + ParentViewModel viewModel; +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentViewModel.java new file mode 100644 index 000000000..67dc6e8c9 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example4/views/ParentViewModel.java @@ -0,0 +1,6 @@ +package de.saxsys.mvvmfx.scopes.example4.views; + +import de.saxsys.mvvmfx.ViewModel; + +public class ParentViewModel implements ViewModel { +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Scope.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Scope.java new file mode 100644 index 000000000..7d1e8333d --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Scope.java @@ -0,0 +1,6 @@ +package de.saxsys.mvvmfx.scopes.example5; + +import de.saxsys.mvvmfx.Scope; + +public class Example5Scope implements Scope { +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Test.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Test.java new file mode 100644 index 000000000..8d0410153 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/Example5Test.java @@ -0,0 +1,28 @@ +package de.saxsys.mvvmfx.scopes.example5; + +import de.saxsys.mvvmfx.FluentViewLoader; +import de.saxsys.mvvmfx.ViewTuple; +import de.saxsys.mvvmfx.testingutils.jfxrunner.JfxRunner; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(JfxRunner.class) +public class Example5Test { + + @Test + public void test() { + + Example5Scope scope = new Example5Scope(); + + ViewTuple<MyView, MyViewModel> viewTuple = FluentViewLoader.fxmlView(MyView.class) + .providedScopes(scope) + .load(); + + assertThat(viewTuple.getViewModel().scope).isEqualTo(scope); + + + } + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyView.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyView.java new file mode 100644 index 000000000..96c95daa5 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyView.java @@ -0,0 +1,12 @@ +package de.saxsys.mvvmfx.scopes.example5; + +import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; + +public class MyView implements FxmlView<MyViewModel> { + + @InjectViewModel + private MyViewModel viewModel; + + +} diff --git a/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyViewModel.java b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyViewModel.java new file mode 100644 index 000000000..9ea92e578 --- /dev/null +++ b/mvvmfx/src/test/java/de/saxsys/mvvmfx/scopes/example5/MyViewModel.java @@ -0,0 +1,11 @@ +package de.saxsys.mvvmfx.scopes.example5; + +import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ViewModel; + +public class MyViewModel implements ViewModel { + + @InjectScope + public Example5Scope scope; + +} diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ChildView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ChildView.fxml new file mode 100644 index 000000000..d8c2f9232 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ChildView.fxml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.scopes.example4.views.ChildView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> +</AnchorPane> \ No newline at end of file diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/DialogView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/DialogView.fxml new file mode 100644 index 000000000..95f6fb429 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/DialogView.fxml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.scopes.example4.views.DialogView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> +</AnchorPane> \ No newline at end of file diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ParentView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ParentView.fxml new file mode 100644 index 000000000..c83854a06 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example4/views/ParentView.fxml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.scopes.example4.views.ParentView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <fx:include source="menu/MenuView.fxml"/> + <fx:include source="content/ContentView.fxml"/> + </children> +</AnchorPane> \ No newline at end of file diff --git a/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example5/MyView.fxml b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example5/MyView.fxml new file mode 100644 index 000000000..65aade882 --- /dev/null +++ b/mvvmfx/src/test/resources/de/saxsys/mvvmfx/scopes/example5/MyView.fxml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.AnchorPane?> + + +<AnchorPane fx:controller="de.saxsys.mvvmfx.scopes.example5.MyView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> +</AnchorPane> \ No newline at end of file From a7b7e85121b54b25002feaba110c98259da4ced6 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Wed, 1 Jun 2016 18:20:54 +0200 Subject: [PATCH 95/96] fixed contacts example with new scope implementation --- .../ui/contactdialog/ContactDialogView.java | 13 +++++++++++-- .../examples/contacts/ui/detail/DetailView.java | 6 ++++++ .../contacts/ui/detail/DetailViewModel.java | 2 ++ .../mvvmfx/examples/contacts/ui/main/MainView.java | 3 +++ .../examples/contacts/ui/main/MainViewModel.java | 3 +++ .../examples/contacts/ui/toolbar/ToolbarView.java | 4 +++- .../contacts/ui/toolbar/ToolbarViewModel.java | 8 ++++++++ 7 files changed, 36 insertions(+), 3 deletions(-) diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java index 2aa5d0e29..fb00da16d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/contactdialog/ContactDialogView.java @@ -2,8 +2,10 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.ViewTuple; import de.saxsys.mvvmfx.examples.contacts.ui.addressform.AddressFormView; @@ -36,12 +38,19 @@ public class ContactDialogView implements FxmlView<ContactDialogViewModel> { @InjectViewModel private ContactDialogViewModel viewModel; + @InjectContext + private Context context; + public void initialize() { ViewTuple<ContactFormView, ContactFormViewModel> contactFormTuple = FluentViewLoader - .fxmlView(ContactFormView.class).load(); + .fxmlView(ContactFormView.class) + .context(context) + .load(); ViewTuple<AddressFormView, AddressFormViewModel> addressFormTuple = FluentViewLoader - .fxmlView(AddressFormView.class).load(); + .fxmlView(AddressFormView.class) + .context(context) + .load(); formPagination.getStyleClass().add("invisible-pagination-control"); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java index 762213a91..7add8f06f 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailView.java @@ -4,8 +4,10 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import de.saxsys.mvvmfx.Context; import de.saxsys.mvvmfx.FluentViewLoader; import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectContext; import de.saxsys.mvvmfx.InjectViewModel; import de.saxsys.mvvmfx.ViewTuple; import de.saxsys.mvvmfx.examples.contacts.ui.editcontact.EditContactDialogView; @@ -41,6 +43,9 @@ public class DetailView implements FxmlView<DetailViewModel> { private Command editCommand; private Command mailCommand; + @InjectContext + private Context context; + public void initialize() { removeCommand = viewModel.getRemoveCommand(); editCommand = viewModel.getEditCommand(); @@ -77,6 +82,7 @@ public void initialize() { viewModel.subscribe(DetailViewModel.OPEN_EDIT_CONTACT_DIALOG, (key, payload) -> { ViewTuple<EditContactDialogView, EditContactDialogViewModel> load = FluentViewLoader .fxmlView(EditContactDialogView.class) + .context(context) .load(); Parent view = load.getView(); Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java index 5133732d5..29ec36df2 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/detail/DetailViewModel.java @@ -8,6 +8,7 @@ import javax.inject.Inject; import de.saxsys.mvvmfx.InjectScope; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; import de.saxsys.mvvmfx.examples.contacts.model.Address; import de.saxsys.mvvmfx.examples.contacts.model.Contact; @@ -26,6 +27,7 @@ import javafx.beans.property.ReadOnlyStringProperty; import javafx.beans.property.ReadOnlyStringWrapper; +@ScopeProvider(scopes = ContactDialogScope.class) public class DetailViewModel implements ViewModel { public static final String OPEN_EDIT_CONTACT_DIALOG = "open_edit_contact"; diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java index f8d6f8cb3..fd8cf720a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainView.java @@ -1,7 +1,10 @@ package de.saxsys.mvvmfx.examples.contacts.ui.main; import de.saxsys.mvvmfx.FxmlView; +import de.saxsys.mvvmfx.InjectViewModel; public class MainView implements FxmlView<MainViewModel> { + @InjectViewModel + private MainViewModel viewModel; } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java index b95b2e514..8f6e78a8a 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/main/MainViewModel.java @@ -1,7 +1,10 @@ package de.saxsys.mvvmfx.examples.contacts.ui.main; +import de.saxsys.mvvmfx.ScopeProvider; import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.MasterDetailScope; +@ScopeProvider(scopes = MasterDetailScope.class) public class MainViewModel implements ViewModel { } diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java index 06dbab4fd..57707d18d 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarView.java @@ -34,7 +34,9 @@ public void initialize() { @FXML public void addNewContact() { ViewTuple<AddContactDialogView, AddContactDialogViewModel> load = FluentViewLoader - .fxmlView(AddContactDialogView.class).load(); + .fxmlView(AddContactDialogView.class) + .providedScopes(viewModel.getScopesForAddDialog()) + .load(); Parent view = load.getView(); Stage showDialog = DialogHelper.showDialog(view, primaryStage, "/contacts.css"); load.getCodeBehind().setDisplayingStage(showDialog); diff --git a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java index 6e1162b14..fbba55514 100644 --- a/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java +++ b/examples/contacts-example/src/main/java/de/saxsys/mvvmfx/examples/contacts/ui/toolbar/ToolbarViewModel.java @@ -1,7 +1,15 @@ package de.saxsys.mvvmfx.examples.contacts.ui.toolbar; +import de.saxsys.mvvmfx.Scope; import de.saxsys.mvvmfx.ViewModel; +import de.saxsys.mvvmfx.examples.contacts.ui.scopes.ContactDialogScope; + +import java.util.Collections; +import java.util.List; public class ToolbarViewModel implements ViewModel { + public List<Scope> getScopesForAddDialog() { + return Collections.singletonList(new ContactDialogScope()); + } } From 547fb176fb94ca18469c77b37d27d41d90f14c38 Mon Sep 17 00:00:00 2001 From: Manuel Mauky <manuel.mauky@saxsys.de> Date: Wed, 1 Jun 2016 18:57:24 +0200 Subject: [PATCH 96/96] update version numbers to 1.5.0 #392 --- README.md | 6 +++--- examples/books-example/pom.xml | 2 +- examples/contacts-example/pom.xml | 2 +- examples/mini-examples/fx-root-example/pom.xml | 2 +- examples/mini-examples/helloworld-without-fxml/pom.xml | 2 +- examples/mini-examples/helloworld/pom.xml | 2 +- examples/mini-examples/pom.xml | 2 +- examples/mini-examples/scopes-example/pom.xml | 2 +- examples/mini-examples/synchronizefx-example/pom.xml | 2 +- examples/mini-examples/welcome-example/pom.xml | 2 +- examples/pom.xml | 2 +- examples/todomvc-example/pom.xml | 2 +- mvvmfx-archetype/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 2 +- mvvmfx-cdi/pom.xml | 2 +- mvvmfx-guice/pom.xml | 2 +- mvvmfx-testing-utils/pom.xml | 2 +- mvvmfx-utils/pom.xml | 2 +- mvvmfx/pom.xml | 2 +- pom.xml | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f983bbfd4..ad71a3af8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is the stable release that can be used in production. <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx</artifactId> - <version>1.4.1</version> + <version>1.5.0</version> </dependency> ``` @@ -32,7 +32,7 @@ Here we make bug fixes for the current stable release. <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx</artifactId> - <version>1.4.2-SNAPSHOT</version> + <version>1.5.1-SNAPSHOT</version> </dependency> ``` @@ -44,7 +44,7 @@ Here we develop new features. This release is unstable and shouldn't be used in <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </dependency> ``` diff --git a/examples/books-example/pom.xml b/examples/books-example/pom.xml index 7998faa35..bbe285bc4 100644 --- a/examples/books-example/pom.xml +++ b/examples/books-example/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys.mvvmfx</groupId> <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/contacts-example/pom.xml b/examples/contacts-example/pom.xml index dd51d8747..654c2b88b 100644 --- a/examples/contacts-example/pom.xml +++ b/examples/contacts-example/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>de.saxsys.mvvmfx</groupId> <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <artifactId>contacts-example</artifactId> diff --git a/examples/mini-examples/fx-root-example/pom.xml b/examples/mini-examples/fx-root-example/pom.xml index a9a8190d7..28a92fe6e 100644 --- a/examples/mini-examples/fx-root-example/pom.xml +++ b/examples/mini-examples/fx-root-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/helloworld-without-fxml/pom.xml b/examples/mini-examples/helloworld-without-fxml/pom.xml index bc2ff487f..71f3019c6 100644 --- a/examples/mini-examples/helloworld-without-fxml/pom.xml +++ b/examples/mini-examples/helloworld-without-fxml/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/helloworld/pom.xml b/examples/mini-examples/helloworld/pom.xml index f894c1b73..9d262bf5e 100644 --- a/examples/mini-examples/helloworld/pom.xml +++ b/examples/mini-examples/helloworld/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/pom.xml b/examples/mini-examples/pom.xml index 4a5f3a60e..af8292bfb 100644 --- a/examples/mini-examples/pom.xml +++ b/examples/mini-examples/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> <packaging>pom</packaging> diff --git a/examples/mini-examples/scopes-example/pom.xml b/examples/mini-examples/scopes-example/pom.xml index d60d2863a..1296d55ad 100644 --- a/examples/mini-examples/scopes-example/pom.xml +++ b/examples/mini-examples/scopes-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/synchronizefx-example/pom.xml b/examples/mini-examples/synchronizefx-example/pom.xml index 1d2ad72b7..dc4a396b2 100644 --- a/examples/mini-examples/synchronizefx-example/pom.xml +++ b/examples/mini-examples/synchronizefx-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/mini-examples/welcome-example/pom.xml b/examples/mini-examples/welcome-example/pom.xml index b72b556fe..2f99a4812 100644 --- a/examples/mini-examples/welcome-example/pom.xml +++ b/examples/mini-examples/welcome-example/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mini-examples</artifactId> <groupId>de.saxsys.mvvmfx</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/pom.xml b/examples/pom.xml index 768c21f03..712070df6 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <groupId>de.saxsys.mvvmfx</groupId> diff --git a/examples/todomvc-example/pom.xml b/examples/todomvc-example/pom.xml index aa8ebe2f8..bc97398a0 100644 --- a/examples/todomvc-example/pom.xml +++ b/examples/todomvc-example/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys.mvvmfx</groupId> <artifactId>examples</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/mvvmfx-archetype/pom.xml b/mvvmfx-archetype/pom.xml index 4c99b9c5f..d4a713ee7 100644 --- a/mvvmfx-archetype/pom.xml +++ b/mvvmfx-archetype/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> diff --git a/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml b/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml index ed66cfda2..dd84e1e26 100644 --- a/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml +++ b/mvvmfx-archetype/src/main/resources/archetype-resources/pom.xml @@ -16,7 +16,7 @@ <dependency> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> <type>pom</type> <scope>import</scope> </dependency> diff --git a/mvvmfx-cdi/pom.xml b/mvvmfx-cdi/pom.xml index 5cdb4d869..a36e1cf40 100644 --- a/mvvmfx-cdi/pom.xml +++ b/mvvmfx-cdi/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <artifactId>mvvmfx-cdi</artifactId> diff --git a/mvvmfx-guice/pom.xml b/mvvmfx-guice/pom.xml index 546ba6513..d12b86a71 100644 --- a/mvvmfx-guice/pom.xml +++ b/mvvmfx-guice/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <artifactId>mvvmfx-guice</artifactId> diff --git a/mvvmfx-testing-utils/pom.xml b/mvvmfx-testing-utils/pom.xml index 8443aaebd..4f8cb81ed 100644 --- a/mvvmfx-testing-utils/pom.xml +++ b/mvvmfx-testing-utils/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mvvmfx-parent</artifactId> <groupId>de.saxsys</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/mvvmfx-utils/pom.xml b/mvvmfx-utils/pom.xml index bfd0b4205..bd0323a13 100644 --- a/mvvmfx-utils/pom.xml +++ b/mvvmfx-utils/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>mvvmfx-parent</artifactId> <groupId>de.saxsys</groupId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/mvvmfx/pom.xml b/mvvmfx/pom.xml index d6e536132..d00ce1c44 100644 --- a/mvvmfx/pom.xml +++ b/mvvmfx/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> </parent> <artifactId>mvvmfx</artifactId> diff --git a/pom.xml b/pom.xml index 60d1ddbf5..cea6c6657 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ <groupId>de.saxsys</groupId> <artifactId>mvvmfx-parent</artifactId> <packaging>pom</packaging> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.0</version> <name>mvvmFX parent</name> <description>Application Framework for MVVM with JavaFX.</description> <url>http://www.saxsys.de</url>