Changes between Version 1 and Version 2 of Fr:Help/Preferences/ImportExport


Ignore:
Timestamp:
2020-05-14T10:31:35+02:00 (4 years ago)
Author:
leni
Comment:

adjusted to revision 11 : #18830

Legend:

Unmodified
Added
Removed
Modified
  • Fr:Help/Preferences/ImportExport

    v1 v2  
    1 [[TranslatedPages(revision=10)]]
     1[[TranslatedPages(revision=11)]]
    22= Fichiers XML de configuration personnalisés pour JOSM =
    33== Exemples (Voir les commentaires dans les XML) ==
     
    7474}}}
    7575
    76 === Variables, boîtes à messages et questions à l'utilisateur ===
    77 {{{#!xml
    78 <config>
    79   <ask var="r" text="Choose something, please!" options="0;1;2"/>
    80   <messagebox text="You choose ${r}" type="i"/>
    81   <if test="${r==0}">
    82      <messagebox text="r=0!"/>
    83   </if>
    84   <else>
    85      <messagebox text="no, r!=0 - r=${r} actually!"/>
    86   </else>
    87   <if test="${r==1 || r==2}">
    88      <messagebox text="r=1 or 2!"/>
    89   </if>
    90   <if test="${r!=2 && r!=0}">
    91     <messagebox text="It is not 0, it is not 2 , so it is = 1!"/>
    92   </if>
    93   <if test="${r!=2}">
    94     <break/>
    95   </if>
    96   <ask var="r" text="Choose something, please!" options="A;B"/>
    97   <messagebox text="You choose button number ${r}" type="i"/>
    98 </config>
    99 }}}
    100 
    101 === API JavaScript ===
    102 {{{#!xml
    103 <config>
    104 <script><![CDATA[
    105   API.messageBox('i','Hello!');
    106   txt = API.askText("Enter something...");
    107   i = API.askOption("Select background color","red;green;black");
    108   if (i==0) API.pref['color.background']="#770000";
    109   if (i==1) API.pref['color.background']="#007700";
    110   if (i==2) API.pref['color.background']="#000000";
    111   color = API.pref['color.background'];
    112   API.messageBox('i',"<html><span color='"+color+"'> You entered "+txt+"</span></html>");
    113   if ( API.askOption("Do you want to test downloading and plugins?","") == 0 ) {
    114      // "" in askOption means Yes/No dialog
    115      API.downloadFile("http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar",
    116           "1/2/a.jar","cache");
    117      API.downloadAndUnpackFile("http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar",
    118           "1/2a/a.jar","cache");
    119      if( API.askOption("Do you want to delete downloaded files?","") == 0) {
    120         API.deleteFile("1","cache");
    121      }
    122      API.pluginInstall("AlignWays");
    123      if( API.askOption("Do you want to uninstall utilsplugin2","") == 0) {
    124         API.pluginUninstall("utilsplugin2");
    125         }
    126    }
    127    importPackage(org.openstreetmap.josm.data);
    128    CustomConfigurator.exportPreferencesKeysByPatternToFile ("e:/config.xml", true, ".*");
    129    //println(JSON.stringify(API.prefs)); // JSON works only on JDK1.7 //println(JSON.stringify(API.fragments)); // JSON works only on JDK1.7 ]]>
    130 </script>
    131 </config>
    132 }}}
    133 
    13476== Voir également ==
    135 
    136 * Discussion sur le développement : #4421
     77* Discussion sur le développement : #4421, #18830
    13778* La version originale de cette page en [wiki:/Help/Preferences/ImportExport anglais]