wiki:APP_RESOURCE_LIST_IMPORT_EXPORT_R1

Version 5 (modified by george, 16 years ago) (diff)

--

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=APP_RESOURCE_LIST_IMPORT_EXPORT_R1, 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|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

The goal of this revision is to support import multiple files at once. Optionally, it should allow opening of multiple books at once.

Task requirements

  • Create support for selecting multiple items in the file dialogs
    • This should allow inserting a lot of images or other media at once and optionally multi book opening.
  • Create a menu item in the insert menu that says "Any resource"
    • The file dialog dropdown should have 1 entry - All files (*.*)
    • 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. Insert 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

Task result

Code.

Implementation idea

  • Make file dialog to support multiple selection and provide a logic that will handle it. See JFileChooser#setMultiSelectionEnabled(selected:boolean) and JFileChooser#getSelectedFiles() : File[]
  • Add new file dialog that can open files and directories (JFileChooser#setFileSelectionModel(JFileChooser.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

APP_RESOURCE_LIST_IMPORT_EXPORT_R0

How to demo

  1. Create a book
  2. Go to TestResources folder or download attached zip here
  3. Extract the zip
  4. Go to insert menu, choose Image..., and select 2 images by using ctrl+click
  5. Click insert
  6. Go to page 2
  7. Choose insert -> Any resource
  8. Select the folder and click insert.

Design

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.)