<plugin id="Tuto07LoaderForExternalData">

    <requirement id="servicesReg" />

    <extension implements="::fwServices::registry::AppConfig">
        <id>tutoLoaderExternalDataConfig</id>
        <type>parameters</type>
        <config>


            <!-- The root data object in TutoConfigurations is a ::fwData::Composite. because it has to manage several objects-->
            <object type="::fwData::Composite">

                <!--
                    Graphical user interface manager. The identifier (id) of the container is 900, it's a wxWidgets id. In the tag <menus> we specify the identifiers of different services for the
                    different menus. In this tutorial, only one service (::gui::aspect::IMenu type) is created. This application have 2 menu one to open/save image and one to load/save extra data.
                    There are FW4SPL identifiers.
                -->
                <service uid="myFrame" type="::fwGui::IFrameSrv" impl="::gui::frame::DefaultFrame" autoConnect="no">
                    <gui>
                        <frame>
                            <name>Tuto07LoaderForExternalData</name>
                            <icon>Bundles/Tuto07LoaderForExternalData_0-1/tuto.ico</icon>
                        </frame>
                        <menuBar />
                    </gui>
                    <registry>
                        <menuBar sid="myMenuBar" start="yes" />
                        <view sid="myRenderingTuto" start="yes" />
                    </registry>
                </service>

                <service uid="myMenuBar" type="::fwGui::IMenuBarSrv" impl="::gui::aspect::DefaultMenuBarSrv" autoConnect="no">
                    <gui>
                        <layout>
                            <menu name="File" />
                            <menu name="External data" />
                        </layout>
                    </gui>
                    <registry>
                        <menu sid="menu_File" start="yes" />
                        <menu sid="menu_ExternalData" start="yes" />
                    </registry>
                </service>

                <!-- This service define the file menu -->
                <service uid="menu_File" type="::fwGui::IMenuSrv" impl="::gui::aspect::DefaultMenuSrv" autoConnect="no">
                    <gui>
                        <layout>
                            <menuItem name="Open image" shortcut="Ctrl+O" />
                            <menuItem name="Save image" shortcut="Ctrl+S" />
                            <separator />
                            <menuItem name="Save all data (External data + image)" />
                            <separator />
                            <menuItem name="Quit" specialAction="QUIT" shortcut="Ctrl+Q" />
                        </layout>
                    </gui>
                    <registry>
                        <menuItem sid="action_openFile" start="yes" />
                        <menuItem sid="action_SaveFile" start="yes" />
                        <menuItem sid="action_SaveAll" start="yes" />
                        <menuItem sid="action_quit" start="yes" />
                    </registry>
                </service>

                <!-- This service define the External menu -->
                <service uid="menu_ExternalData" type="::fwGui::IMenuSrv" impl="::gui::aspect::DefaultMenuSrv" autoConnect="no">
                    <gui>
                        <layout>
                            <menuItem name="Import External data (*.us file)" />
                            <menuItem name="Load External data" />
                            <menuItem name="Save External data" />
                        </layout>
                    </gui>
                    <registry>
                        <menuItem sid="ActionLoadExternalData" start="yes" />
                        <menuItem sid="ActionLoadExternalDataNative" start="yes" />
                        <menuItem sid="ActionSaveExternalData" start="yes" />
                    </registry>
                </service>

                <!--
                    This service (::gui::action::QuitAction) is a generic action that will close the application when the user click on the menuItem "Quit". It's possible to associate with this kind
                    of service (::fwGui::IActionSrv) specific attributes to configure their style, shortcut... (Note: In this tutorial, there is an attribute specialAction with the value "QUIT". On MS
                    Windows, there's no impact. But on Mac OS, this value installs the menuItem in the system menu bar, and on Linux this value installs the default 'Quit' system icon in the
                    menuItem.) The attribute "shortcut" is set with the value "Ctrl+Q" to close the application with this specific shortcut.
                -->
                <service uid="action_quit" type="::fwGui::IActionSrv" impl="::gui::action::QuitAction" autoConnect="no" />

                <service uid="action_SaveAll" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                    <start uid="saveAllData" />
                </service>

                <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="saveAllData" autoConnect="no">
                    <type mode="writer" />
                    <selection mode="include" />
                    <addSelection service="::ioAtoms::SWriter" />
                </service>

                <!--  a ::fwData::Image. -->
                <item key="tutoLoaderExternalDataImage">
                    <object type="::fwData::Image">
                        <!--
                            The first service (::gui::action::StarterActionService) is a generic action. In the configuration of this service, we specify the id of the services to be started and
                            updated (start and update methods) when user click on the menuItem "Open image". In this tutorial, ::gui::action::StarterActionService service starts and updates the
                            service with the uid "myReaderPathFile".
                        -->
                        <service uid="action_openFile" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="myReaderPathFile" />
                        </service>
                        <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="myReaderPathFile" autoConnect="no">
                            <type mode="reader" />
                        </service>

                        <!--
                            The other service (::gui::action::StarterActionService) is a generic action. In the configuration of this service, we specify the id of the services to be started and
                            updated (start and update methods) when user click on the menuItem "save image". In this tutorial, ::gui::action::StarterActionService service starts and updates the
                            service with the uid "myWriterPathFile".
                        -->
                        <service uid="action_SaveFile" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="myWriterPathFile" />
                        </service>
                        <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="myWriterPathFile" autoConnect="no">
                            <type mode="writer" />
                        </service>

                        <!-- This service (::vtkSimpleNegato::RendererService) is a 3D visualization service of medical images.-->
                        <service impl="::vtkSimpleNegato::RendererService" type="::fwRender::IRender" uid="myRenderingTuto" autoConnect="yes" />

                    </object>
                </item>

                <!--  a ::fwData::Composite uses to store extra information. -->
                <item key="ExternalData">
                    <object type="::fwData::Composite">
                        <service impl="::ioTuto::ExternalDataReaderService" type="::io::IReader" uid="loadExternalData" autoConnect="no">
                        </service>
                        <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="loadExternalDataNative" autoConnect="no">
                            <type mode="reader" />
                            <selection mode="include" />
                            <addSelection service="::ioAtoms::SReader" />
                        </service>
                        <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="saveExternalData" autoConnect="no">
                            <type mode="writer" />
                            <selection mode="include" />
                            <addSelection service="::ioAtoms::SWriter" />
                        </service>

                        <service uid="ActionLoadExternalData" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="loadExternalData" />
                        </service>

                        <service uid="ActionSaveExternalData" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="saveExternalData" />
                        </service>
                        <service uid="ActionLoadExternalDataNative" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="loadExternalDataNative" />
                        </service>
                    </object>
                </item>

                <!-- Definition of the starting and closing order of the different services.-->
                <start uid="myFrame" />

            </object>

        </config>
    </extension>








    <extension implements="::fwServices::registry::AppConfig">
        <id>tutoLoaderExternalDataImageOnlyConfig</id>
        <type>parameters</type>
        <config>


            <!-- The root data object in TutoConfigurations is a ::fwData::Composite. because it has to manage several objects -->
            <object type="::fwData::Composite">
            
                <!--
                    Graphical user interface manager. The identifier (id) of the container is 900, it's a wxWidgets id. In the tag <menus> we specify the identifiers of different services for the
                    different menus. In this tutorial, only one service (::gui::aspect::IMenu type) is created. This application have 2 menu one to open/save image and one to load/save extra data.
                    There are FW4SPL identifiers.
                -->

                <service uid="myFrame" type="::fwGui::IFrameSrv" impl="::gui::frame::DefaultFrame" autoConnect="no">
                    <gui>
                        <frame>
                            <name>Tuto07LoaderForExternalData</name>
                            <icon>Bundles/Tuto07LoaderForExternalData_0-1/tuto.ico</icon>
                        </frame>
                        <menuBar />
                    </gui>
                    <registry>
                        <menuBar sid="myMenuBar" start="yes" />
                        <view sid="myRenderingTuto" start="yes" />
                    </registry>
                </service>

                <service uid="myMenuBar" type="::fwGui::IMenuBarSrv" impl="::gui::aspect::DefaultMenuBarSrv" autoConnect="no">
                    <gui>
                        <layout>
                            <menu name="File" />
                        </layout>
                    </gui>
                    <registry>
                        <menu sid="menu_File" start="yes" />
                    </registry>
                </service>

                <!-- This service define the file menu -->
                <service uid="menu_File" type="::fwGui::IMenuSrv" impl="::gui::aspect::DefaultMenuSrv" autoConnect="no">
                    <gui>
                        <layout>
                            <menuItem name="Open image" shortcut="Ctrl+O" />
                            <menuItem name="Save image" shortcut="Ctrl+S" />
                            <separator />
                            <menuItem name="Quit" specialAction="QUIT" shortcut="Ctrl+Q" />
                        </layout>
                    </gui>
                    <registry>
                        <menuItem sid="action_openFile" start="yes" />
                        <menuItem sid="action_SaveFile" start="yes" />
                        <menuItem sid="action_quit" start="yes" />
                    </registry>
                </service>


                <!--
                    This service (::gui::action::QuitAction) is a generic action that will close the application when the user click on the menuItem "Quit". It's possible to associate with this kind
                    of service (::fwGui::IActionSrv) specific attributes to configure their style, shortcut... (Note: In this tutorial, there is an attribute specialAction with the value "QUIT". On MS
                    Windows, there's no impact. But on Mac OS, this value installs the menuItem in the system menu bar, and on Linux this value installs the default 'Quit' system icon in the
                    menuItem.) The attribute "shortcut" is set with the value "Ctrl+Q" to close the application with this specific shortcut.
                -->
                <service uid="action_quit" type="::fwGui::IActionSrv" impl="::gui::action::QuitAction" autoConnect="no" />


                <!--  a ::fwData::Image. -->
                <item key="tutoLoaderExternalDataImage">
                    <object type="::fwData::Image">
                        <!--
                            The first service (::gui::action::StarterActionService) is a generic action. In the configuration of this service, we specify the id of the services to be started and
                            updated (start and update methods) when user click on the menuItem "Open image". In this tutorial, ::gui::action::StarterActionService service starts and updates the
                            service with the uid "myReaderPathFile".
                        -->
                        <service uid="action_openFile" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="myReaderPathFile" />
                        </service>
                        <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="myReaderPathFile" autoConnect="no">
                            <type mode="reader" />
                        </service>
                        <service impl="::ctrlSelection::wrapper::ImageWrapperSrv" type="::ctrlSelection::IWrapperSrv" uid="newOBject2newImage" autoConnect="yes" />

                        <!--
                            The other service (::gui::action::StarterActionService) is a generic action. In the configuration of this service, we specify the id of the services to be started and
                            updated (start and update methods) when user click on the menuItem "save image". In this tutorial, ::gui::action::StarterActionService service starts and updates the
                            service with the uid "myWriterPathFile".
                        -->
                        <service uid="action_SaveFile" type="::fwGui::IActionSrv" impl="::gui::action::StarterActionService" autoConnect="no">
                            <start uid="myWriterPathFile" />
                        </service>
                        <service impl="::uiIO::editor::IOSelectorService" type="::gui::editor::IDialogEditor" uid="myWriterPathFile" autoConnect="no">
                            <type mode="writer" />
                        </service>

                        <!-- This service (::vtkSimpleNegato::RendererService) is a 3D visualization service of medical images. -->
                        <service impl="::vtkSimpleNegato::RendererService" type="::fwRender::IRender" uid="myRenderingTuto" autoConnect="yes" />

                    </object>
                </item>

                <!-- Definition of the starting and closing order of the different services. -->
                <start uid="myFrame" />
                <start uid="newOBject2newImage" />

            </object>

        </config>
    </extension>
</plugin>
