Revision 93

View differences:

org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingBehavior.java
206 206
    serviceStack.add(service);
207 207
  }
208 208

  
209
  public void mouseClicked(MouseEvent e) {
210
    ViewPort vp = editingContext.getMapControl().getViewPort();
211
    if (getActiveService() != null) {
212
      if (currentParam != null) {
213
        List<TYPE> typesOfParam = currentParam.getTypes();
214
        if (typesOfParam.contains(TYPE.LIST_POSITIONS) || typesOfParam.contains(TYPE.POSITION)) {
215
          if(typesOfParam.contains(TYPE.LIST_POSITIONS)){
216
            if (e.getClickCount() == 2) {
217
              finishService();
218
              return;
219
            }
220
          }
221
          Point point;
222
          point = vp.convertToMapPoint(e.getX(), e.getY());
223
          try {
224
            getActiveService().setValue(point);
225
          }
226
          catch (VectorEditingException ex) {
227
            logger.error("Invalid value %s", new Object[] { point });
228
          }
229
        }
230
        if (typesOfParam.contains(TYPE.SELECTION)) {
231
          // Do nothing
232
        }
233
        getNextParameter();
234
      }
235
    }
236
  }
237

  
238 209
  private void finishService() {
239 210
    EditingService lastService = serviceStack.pop();
240 211
    try {
......
273 244
    getNextParameter();
274 245
  }
275 246

  
247
  public void mouseClicked(MouseEvent e) {
248
    ViewPort vp = editingContext.getMapControl().getViewPort();
249
    if (getActiveService() != null) {
250
      if (currentParam != null) {
251
        List<TYPE> typesOfParam = currentParam.getTypes();
252
        if (typesOfParam.contains(TYPE.LIST_POSITIONS) || typesOfParam.contains(TYPE.POSITION)) {
253
          if(typesOfParam.contains(TYPE.LIST_POSITIONS)){
254
            if (e.getClickCount() == 2) {
255
              finishService();
256
              return;
257
            }
258
          }
259
          Point point;
260
          point = vp.convertToMapPoint(e.getX(), e.getY());
261
          try {
262
            getActiveService().setValue(point);
263
          }
264
          catch (VectorEditingException ex) {
265
            logger.error("Invalid value %s", new Object[] { point });
266
          }
267
        }
268
        if (typesOfParam.contains(TYPE.SELECTION)) {
269
          // Do nothing
270
        }
271
        getNextParameter();
272
      }
273
    }
274
  }
275
  
276 276
  public void mouseEntered(MouseEvent e) throws BehaviorException {}
277 277

  
278 278
  public void mouseMoved(MouseEvent e) throws BehaviorException {
......
348 348
          getActiveService().stop();
349 349
        }
350 350
        catch (StopServiceException e) {
351
          // TODO Auto-generated catch block
351
          logger.error("Can't stop " + getActiveService().getName(), e);
352 352
        }
353 353
        cleanBehavior();
354 354
      }
......
406 406
                .setValue(featureStore.getFeatureSelection().clone());
407 407
          }
408 408
          catch (InvalidEntryException e) {
409
            // TODO Auto-generated catch block
410
            e.printStackTrace();
409
            showConsoleMessage(i18nManager.getTranslation("invalid_option"));
411 410
          }
412 411
          catch (Exception e) {
413
//            getActiveService().stop();
414
//            cleanBehavior();
412
            cleanBehavior();
415 413
            logger.error("Can't access to selecction.", e);
416 414
          }
417 415
        }
418 416
      }
419 417
      if (!insertedValue) {
420
//        throw new InvalidEntryException(null);
421
        //TODO
418
        showConsoleMessage(i18nManager.getTranslation("invalid_option"));
422 419
      }
423 420
      getNextParameter();
424 421
    }
......
486 483
    }
487 484
  }
488 485

  
489
  public void enableSelection(boolean enableSelection) {
486
  private void enableSelection(boolean enableSelection) {
490 487
     editingContext.enableSelection(enableSelection);
491 488
  }
492 489
}

Also available in: Unified diff