Ignore:
Timestamp:
2009-01-01T18:28:53+01:00 (16 years ago)
Author:
stoecker
Message:

removed tab stop usage

Location:
applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java

    r12707 r12778  
    4040 */
    4141public class UploadDataGui extends javax.swing.JFrame {
    42  
    43  String tagging;   
    44  String Descriptionfield; 
     42
     43 String tagging;
     44 String Descriptionfield;
    4545 String urlDescription;
    4646 String urlTags;
     
    4848 String PassWord;
    4949 //GpxData gpxData;
    50          
     50
    5151        public static final String API_VERSION = "0.5";
    5252        private static final String BASE64_ENC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    5353        private static final String BOUNDARY = "----------------------------d10f7aa230e8";
    5454        private static final String LINE_END = "\r\n";
    55      
     55
    5656        boolean dfield;
    5757        boolean taggy;
     
    6060        boolean pass;
    6161        boolean publicheck;
    62      
     62
    6363        DateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");
    64         Date date = new Date();   
     64        Date date = new Date();
    6565        String datename = dateFormat.format(date);
    66  
     66
    6767    /** Creates new form UploadDataGui */
    6868    public UploadDataGui() {
     
    7070    }
    7171
    72  
     72
    7373    /** This method is called from within the constructor to
    7474     * initialize the form.
     
    142142
    143143
    144        
    145         Container contentPane = getContentPane();
    146         contentPane.setLayout(new GridBagLayout());
    147         GridBagConstraints c = new GridBagConstraints();
    148 
    149         c.gridx = 0;
    150         c.gridy = 0;
    151         c.gridwidth = 2;
    152         c.fill = 1;
    153         contentPane.add(OutputDisplay, c);
    154 
    155         c.gridwidth = 1;
    156         c.gridy = 1;
    157         contentPane.add(jLabel3, c);
    158         c.gridx = 1;
    159         contentPane.add(tagfield, c);
    160 
    161         c.gridy = 2; c.gridx = 0;
    162         contentPane.add(jLabel1, c);
    163         c.gridx = 1;
    164         contentPane.add(descriptionfield, c);
    165 
    166         c.gridy = 3; c.gridx = 0;
    167         contentPane.add(jLabel2, c);
    168         c.gridx = 1;
    169         contentPane.add(PublicTrace, c);
    170 
    171         c.gridy = 4; c.gridx = 0;
    172         contentPane.add(CancelButton, c);
    173         c.gridx = 1;
    174         contentPane.add(OkButton, c);
     144
     145    Container contentPane = getContentPane();
     146    contentPane.setLayout(new GridBagLayout());
     147    GridBagConstraints c = new GridBagConstraints();
     148
     149    c.gridx = 0;
     150    c.gridy = 0;
     151    c.gridwidth = 2;
     152    c.fill = 1;
     153    contentPane.add(OutputDisplay, c);
     154
     155    c.gridwidth = 1;
     156    c.gridy = 1;
     157    contentPane.add(jLabel3, c);
     158    c.gridx = 1;
     159    contentPane.add(tagfield, c);
     160
     161    c.gridy = 2; c.gridx = 0;
     162    contentPane.add(jLabel1, c);
     163    c.gridx = 1;
     164    contentPane.add(descriptionfield, c);
     165
     166    c.gridy = 3; c.gridx = 0;
     167    contentPane.add(jLabel2, c);
     168    c.gridx = 1;
     169    contentPane.add(PublicTrace, c);
     170
     171    c.gridy = 4; c.gridx = 0;
     172    contentPane.add(CancelButton, c);
     173    c.gridx = 1;
     174    contentPane.add(OkButton, c);
    175175
    176176        pack();
     
    181181public void upload(String username, String password, String Descriptionfield, String tagging , GpxData gpxData ) throws IOException {
    182182        OutputDisplay.setText("Starting to upload selected file to openstreetmap.org");
    183    
     183
    184184    try {
    185        
     185
    186186        urlDescription = Descriptionfield.replaceAll("\\.;&?,/","_");
    187187        if (urlDescription == null || urlDescription.length() == 0) {
    188188             OutputDisplay.setText("No description provided .Please provide some description . For the time being ignore the exception error ");
    189            
     189
    190190        }
    191191           urlTags = tagging.replaceAll("\\\\.;&?,/","_");
    192      
    193        
     192
     193
    194194        URL url = new URL("http://www.openstreetmap.org/api/" + API_VERSION + "/gpx/create");
    195195            System.err.println("url: " + url);
     
    212212        writeContentDisposition(out, "public", "1");
    213213           } else {
    214         writeContentDisposition(out, "public", "0");   
     214        writeContentDisposition(out, "public", "0");
    215215           }
    216216        out.writeBytes("--" + BOUNDARY + "--" + LINE_END);
    217217        out.flush();
    218      
     218
    219219        int returnCode = connect.getResponseCode();
    220220            String returnMsg = connect.getResponseMessage();
    221221            System.err.println(returnCode);
    222222            OutputDisplay.setText(returnMsg);
    223         if (returnCode != 200) { 
     223        if (returnCode != 200) {
    224224            if (connect.getHeaderField("Error") != null)
    225225               returnMsg += "\n" + connect.getHeaderField("Error");
     
    228228        out.close();
    229229        connect.disconnect();
    230        
    231         } catch(UnsupportedEncodingException ignore) { 
     230
     231        } catch(UnsupportedEncodingException ignore) {
    232232        } catch (MalformedURLException e) {
    233233                OutputDisplay.setText("Cant Upload .");
    234234                e.printStackTrace();
    235235    }
    236  
     236
    237237}
    238238
     
    246246
    247247private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
    248      GpxData gpxData; 
    249        
    250         UserName  =  Main.pref.get("osm-server.username");   
     248     GpxData gpxData;
     249
     250        UserName  =  Main.pref.get("osm-server.username");
    251251        PassWord =   Main.pref.get("osm-server.password");
    252        
     252
    253253        if(Main.map == null || Main.map.mapView == null ||Main.map.mapView.getActiveLayer() == null ||
    254254                !(Main.map.mapView.getActiveLayer() instanceof GpxLayer)){
     
    260260        gpxData = ((GpxLayer)Main.map.mapView.getActiveLayer()).data;
    261261                System.out.println(Descriptionfield);
    262         try { 
     262        try {
    263263                upload(UserName,PassWord,Descriptionfield ,tagging ,gpxData) ;
    264264        } catch (IOException ex) {
    265265                Logger.getLogger(UploadDataGui.class.getName()).log(Level.SEVERE, null, ex);
    266     }     
    267    
     266    }
     267
    268268}//GEN-LAST:event_OkButtonActionPerformed
    269269
     
    276276    if (evt.getStateChange() == ItemEvent.SELECTED) {
    277277        publicheck = true;
    278          
     278
    279279    }
    280280}//GEN-LAST:event_PublicTraceItemStateChanged
     
    284284     JTextField Descsel = (JTextField)evt.getSource();
    285285        Descriptionfield =  Descsel.getText();
    286    
     286
    287287}//GEN-LAST:event_descriptionfieldFocusLost
    288288
     
    291291     JTextField Tagsel = (JTextField)evt.getSource();
    292292        tagging =  Tagsel.getText();
    293    
     293
    294294}//GEN-LAST:event_tagfieldFocusLost
    295295
     
    300300        out.writeBytes(LINE_END);
    301301        out.writeBytes(value + LINE_END);
    302        
     302
    303303    }
    304304
    305305    private void writeContentDispositionGpxData(DataOutputStream out, String name, GpxData gpxData ) throws IOException {
    306    
     306
    307307        out.writeBytes("--" + BOUNDARY + LINE_END);
    308308        out.writeBytes("Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + datename +".gpx" + "\"" + LINE_END);
     
    310310        out.writeBytes("Content-Type: application/octet-stream" + LINE_END);
    311311        out.writeBytes(LINE_END);
    312          
     312
    313313        OutputDisplay.setText("Transferring data to server");
    314314            new GpxWriter(out).write(gpxData);
    315315        out.flush();
    316         out.writeBytes(LINE_END); 
    317      
    318     }
    319    
    320  // Taken from Christof Dallermassal java class : 
     316        out.writeBytes(LINE_END);
     317
     318    }
     319
     320 // Taken from Christof Dallermassal java class :
    321321public String encodeBase64(String s) {
    322322        StringBuilder out = new StringBuilder();
     
    328328            out.append(l>1 ? BASE64_ENC.charAt((buf.charAt(1) & 0x0f) << 2 | (l==2 ? 0 : (buf.charAt(2) & 0xc0) >> 6)) : '=');
    329329            out.append(l>2 ? BASE64_ENC.charAt(buf.charAt(2) & 0x3f) : '=');
    330            
     330
    331331        }
    332332        return out.toString();
    333         }   
     333        }
    334334
    335335    // Variables declaration - do not modify//GEN-BEGIN:variables
  • applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java

    r12588 r12778  
    22 *  Copyright by Subhodip Biswas
    33 *  This program is free software and licensed under GPL.
    4  * 
     4 *
    55 */
    66
Note: See TracChangeset for help on using the changeset viewer.