1 package eu
.etaxonomy
.cdm
.io
.xper
;
5 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationController
;
6 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
7 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
8 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
9 import eu
.etaxonomy
.cdm
.io
.xper
.AdaptaterCdmXper
;
10 import fr_jussieu_snv_lis
.Xper
;
11 import fr_jussieu_snv_lis
.edition
.XPDisplay
;
12 import fr_jussieu_snv_lis
.utils
.Utils
;
14 public class TestAdapterCdmXper
{
18 public TestAdapterCdmXper(){
20 DbSchemaValidation dbSchemaValidation
= DbSchemaValidation
.VALIDATE
;
21 ICdmDataSource datasource
= CdmDestinations
.cdm_test_local_xper();
23 final CdmApplicationController appCtr
= CdmApplicationController
.NewInstance(datasource
, dbSchemaValidation
);
26 Thread t
= new Thread() {
34 public static void xperloadDataFromCdm(){
35 // create a new empty base and load data from CDM
36 if(Xper
.getCdmApplicationController() != null){
38 Xper
.getMainframe().newBase("baseTest");
39 // specify that the current base is not new (needed to be able to add images)
40 Utils
.isNewBase
= false;
41 // use the current directory as working directory for Xper2
42 XPDisplay
.getControler().getBase().setPathName(System
.getProperty("user.dir") + Utils
.sep
);
43 // create a _thumbnail directory to store thumbnails
44 new File(System
.getProperty("user.dir") + Utils
.sep
+ "images" + Utils
.sep
+ "_thumbnails").mkdirs();
45 // delete the variable create by default and update the frame
46 XPDisplay
.getControler().getBase().deleteVariable(XPDisplay
.getControler().getBase().getVariableAt(0));
47 XPDisplay
.displayNbVariable();
48 XPDisplay
.getControler().displayJifVarTree();
50 AdaptaterCdmXper adapterCdmXper
= new AdaptaterCdmXper();
51 Utils
.cdmAdapter
= adapterCdmXper
;
53 if (Utils
.currentBase
!= null) {
54 // adaptaterCdmXper.createWorkingSet();
55 adapterCdmXper
.load();
57 XPDisplay
.displayNbVariable();
58 XPDisplay
.getControler().displayJifVarTree();
66 public static void main(String
[] args
) {
67 System
.out
.println("cdm start");
68 new TestAdapterCdmXper();
69 System
.out
.println("cdm started :::");
71 while(!Utils
.xperReady
){
74 System
.out
.println("start load data");
75 // display a loading gif
76 Utils
.displayLoadingGif(true);
77 // load the data from CDM
79 xperloadDataFromCdm();
80 // undisplay a loading gif
81 Utils
.displayLoadingGif(false);
82 System
.out
.println("stop load data");
83 System
.out
.println("start generate thumbnails");
84 // generate all thumbnails (a loading gif is automatically displayed
85 Utils
.generateThumbnailsFromURLImage(XPDisplay
.getControler().getBase().getAllResources());
86 System
.out
.println("stop generate thumbnails");