[[BackLinksMenu]] [[TicketQuery(summary=RESOURCES_EXPORT_IMPORT_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]] = Analysis = ^(Give as much as possible of the needed information for designing and implementing the task in the following sections.)^ == Overview == The resource palette consist of only frame contents (Discussion with Milo : And here we will have advanced 'mode' with the other resources again...). These frames include all the frames which can be inserted without the browser frame. All The resources can be imported and exported as while exporting, the elements are exported in the corresponding format(if jpg, in jpg; if pdf in pdf; if sjrb, in sjrb and so on). The other goal of this revision is to support import multiple files at once. == Task requirements == * Add support for selecting multiple items in the file dialogs * This should allow importing a lot of image or other media resources at once. * Create an ability for importing any resource. * The "Import" from resources palette should open a file dialog * The file dialog dropdown should have 1 entry - All files (*.*) - This is for now, later "Image", "Audio", etc things should be added. * The tooltip should say "Import any kind of supported resource, folder or zip with resources." * When a folder is selected the button should not change to "Open" like it does in the other file dialogs. Import should be available instead, which should allow import of a folder with resources * zip files should be scanned for resources and they should be added to the list with the resources. This should be done carefully, because Sophie internal resources are in zips too. * For both, folder and zip, only their supported contents should be added. But if the user has selected an unsupported file, he should be warned by a message box. If multiple files are selected and part of them are unsupported the user should be notified about them, and the supported ones should be imported. * Add support feature * Every resource is exported in the corresponding format (Discussion with Milo : No, here we can save resources to our format or other formats, the file save dialog will give us choices, and the DND will export will depend on where we drop : word/notepad/Desktop...). * The "Import" from resources palette should open a file dialog with "All files" entry and correct name suggested. (the same name as the resource) * (Optional) Multiple export should only ask for folder to export the resources. Not required for this revision * Texts and comments are exported in rtf format (Discussion with Milo : Here again we will export to our format or some other depending on the DND target/choosen in the File save dialog). * All the imported resources are not inserted on the page work area but only in the resources palette and can be inserted in the page by drag and drop (Drag and drop is not part of this task). * (optioanal) Resources can be exported and imported by drag and drop * Change the filters in the resources palette - replace them with icons, see implementation idea * Remove pages, frames and templates from this view * Add icon filters for * text * image * audio * video * pdf * script * Take in mind that other things will be needed in future - flash for example == Task result == Source code == Implementation idea == * Make file dialog to support multiple selection and provide a logic that will handle it. * Add new file dialog that can open files and directories. When the user select something: 1 If it is a file, try to open it 1.2 If it is a zip file, decompress it and go to 1 2 If it is a directory list its files 2.1 If there are only files go to 1 2.2 If there are directories go to 2 * Create something like ResourceManipuationProvider, which will be used for easier and centralized import of resources, for example with it will be registered the corresponding insert menus and will be used for both inserting resources with frames and importing them. * Modify the FileDialogInput to work with folders. * Add logic for decompressing or browsing zip files * Try to fix the RTF export/import of the text to take in mind styles (optional because it could be time taking). [[Image(resources.jpg)]] == Related == APP_RESOURCE_LIST_IMPORT_EXPORT_R0 [[BR]] APP_RESOURCE_LIST_IMPORT_EXPORT_R1 == How to demo == 1. Create a book 2. Go to insert menu, choose Image..., and select 2 images in jpeg format by using ctrl+click and notice they are inserted at the one and same time. 3. Export one of the pictures and notice it is exported in jpeg format. 4. Insert a text frame. 5. Export the text frame and notice it is in rtf format. 6. Choose insert -> Any resource 8. Select the folder and click insert. Notice all the familiar format files from the folder are inserted. = Design = * We need to enable the FileDialog to use the mode JFileChooser.FILES_AND)DIRECTORIES when the dialog is shown with multy-select enabled. Every time the dialog is shown with enabled multy select we will be able to choose both directories and multiple files. Another change is that FileDialogInput.FileContainer should return list of all files in the directoriy trees choosed flatten. Importing of all kind of resources from files will be done with FileDialogs with multiple selection enabled. * Importing resources: Importing of resources has to have one centralized logic. There are three kinds of import - importing resource, importing resource and inserting frame for it and inserting frame for already imported resource. * ResourceImportManager: * The manager will handle importing of resources some of the routines while importing are the same so the manager will be abstract class with default implementations for them. Every importable resource will have implementation of the manager. The implementations will provide some meta data needed for the import and methods for creating the resource and retrieving its data from different sources like files for example. The managers are immutable and generic for the resource data type (For example ImmImage for image resource). Methods of the ResourceImportManager are: * {{{String getImportRole()}}} : Abstract method which provides import role, these roles are used for retrieving the right manager for the right resource import. For example when we import image we have something like import image role. * {{{String getResourceKind()}}} : Abstract method that provides the kind of the resource of the manager. * {{{ResourceRefR4 generateChildRef()}}} : Method using generics to create good child reference for the right resource kind... Not needed but helps a lot for readable refs. * {{{List retrieveResourceInfo(ResourceImportProvider provider)}}} : That method have default implementation. = Implementation = ^(Describe and link the implementation results here (from the wiki or the repository).)^ = Testing = ^(Place the testing results here.)^ = Comments = ^(Write comments for this or later revisions here.)