Revision 159

View differences:

org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingBehavior.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.app.mainplugin 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.api;
8 26

  
9 27
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
......
15 33
 * @author gvSIG team.
16 34
 *
17 35
 */
18
public interface EditingBehavior extends IBehavior{
36
public interface EditingBehavior extends IBehavior {
19 37

  
20
  /**
21
   * Activates service as of name service. If there was a instance of service with this name   
22
   * 
23
   * @param name service of tool.
24
   */
25
  void activateService(String name);
38
    /**
39
     * Activates service as of name service. If there was a instance of service
40
     * with this name
41
     * 
42
     * @param name
43
     *            service of tool.
44
     */
45
    void activateService(String name);
26 46

  
27
  /**
28
   * Cleans behavior, deleting the active service and the current parameter.  
29
   * 
30
   */
31
  void cleanBehavior();
32
  
33
  /**
34
   * 
35
   * @param name
36
   * @return
37
   */
38
  public boolean isServiceCompatible(String name) throws ServiceInformationException;
39
  
40
  /**
41
   * 
42
   * @param response
43
   */
44
  public void textEntered(String response);
45
  
46
  /**
47
   * 
48
   * @param layer
49
   */
50
  public void setCurrentLayer(FLyrVect layer);
47
    /**
48
     * Cleans behavior, deleting the active service and the current parameter.
49
     * 
50
     */
51
    void cleanBehavior();
52

  
53
    /**
54
     * 
55
     * @param name
56
     * @return
57
     */
58
    public boolean isServiceCompatible(String name)
59
        throws ServiceInformationException;
60

  
61
    /**
62
     * 
63
     * @param response
64
     */
65
    public void textEntered(String response);
66

  
67
    /**
68
     * 
69
     * @param layer
70
     */
71
    public void setCurrentLayer(FLyrVect layer);
51 72
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingSwingManager.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.api 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.api;
8 26

  
9 27
import org.gvsig.fmap.mapcontrol.MapControl;
......
14 32
 */
15 33
public interface EditingSwingManager extends Manager {
16 34

  
17
  /**
18
   * @param mapControl
19
   * @return
20
   */
21
  EditingContext getEditingContext(MapControl mapControl);
22
  
23
  /**
24
   * 
25
   * @param mapControl
26
   */
27
  public void registerEditingContext(MapControl mapControl);
28
  
29
  /**
30
   * 
31
   * @param layerName
32
   * @return
33
   */
34
  int showPanelExportOrDiscard(MapControl parent, String layerName);
35
  
36
  /**
37
   * 
38
   * @param layerName
39
   * @return
40
   */
41
  int showPanelSaveOrDiscard(MapControl parent, String layerName);
35
    /**
36
     * @param mapControl
37
     * @return
38
     */
39
    EditingContext getEditingContext(MapControl mapControl);
42 40

  
41
    /**
42
     * 
43
     * @param mapControl
44
     */
45
    public void registerEditingContext(MapControl mapControl);
46

  
47
    /**
48
     * 
49
     * @param layerName
50
     * @return
51
     */
52
    int showPanelExportOrDiscard(MapControl parent, String layerName);
53

  
54
    /**
55
     * 
56
     * @param layerName
57
     * @return
58
     */
59
    int showPanelSaveOrDiscard(MapControl parent, String layerName);
60

  
43 61
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingContext.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.api 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.api;
8 26

  
9 27
import java.lang.ref.WeakReference;
......
13 31
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
14 32
import org.gvsig.tools.observer.Observable;
15 33

  
16
public interface EditingContext extends Observable{
17
  
18
  static final int CANCEL = 0;
19
  static final int DISCARD_CHANGES = 1;
20
  static final int EXPORT_LAYER = 2;
21
  static final int SAVE_CHANGES = 3;
34
public interface EditingContext extends Observable {
22 35

  
23
  /**
24
   * Activates service as of name and {@link MapControl}
25
   * 
26
   * @param name of service
27
   * @param mapControl of
28
   */
29
  public void activateService(String name);
36
    static final int CANCEL = 0;
37
    static final int DISCARD_CHANGES = 1;
38
    static final int EXPORT_LAYER = 2;
39
    static final int SAVE_CHANGES = 3;
30 40

  
31
  /**
32
   * Begins edition of a layer with the {@link MapControl} received as parameter.
33
   * 
34
   * @param layer to begin edition
35
   * @param mapControl necessary to add listeners, console... See
36
   *          {@link EditingBehavior}.
37
   */
38
  public void beginEdition(FLyrVect layer, Behavior[] additionalBehaviors);
39
  
40
  /**
41
   * 
42
   * @param enableSelection
43
   */
44
  public void enableSelection(boolean enableSelection);
41
    /**
42
     * Activates service as of name and {@link MapControl}
43
     * 
44
     * @param name
45
     *            of service
46
     * @param mapControl
47
     *            of
48
     */
49
    public void activateService(String name);
45 50

  
46
  /**
47
   * Ends edition of a layer with the {@link MapControl} received as parameter.
51
    /**
52
     * Begins edition of a layer with the {@link MapControl} received as
53
     * parameter.
54
     * 
55
     * @param layer
56
     *            to begin edition
57
     * @param mapControl
58
     *            necessary to add listeners, console... See
59
     *            {@link EditingBehavior}.
60
     */
61
    public void beginEdition(FLyrVect layer, Behavior[] additionalBehaviors);
62

  
63
    /**
64
     * 
65
     * @param enableSelection
66
     */
67
    public void enableSelection(boolean enableSelection);
68

  
69
    /**
70
     * Ends edition of a layer with the {@link MapControl} received as
71
     * parameter.
72
     * 
73
     * @param layer
74
     *            to end edition
75
     * @param mapControl
76
     *            necessary to delete observers, stop drawing, obtain
77
     *            {@link EditingBehavior}...
78
     */
79
    public void endEdition(FLyrVect layer);
80

  
81
    /**
82
     * Gets mapControl object. It is referenced by {@link WeakReference}.
83
     * 
84
     * @return
85
     */
86
    public MapControl getMapControl();
87

  
88
    /**
89
     * 
90
     * @param name
91
     * @return
92
     */
93
    public boolean isServiceCompatible(String name);
94

  
95
    /**
48 96
   * 
49
   * @param layer to end edition
50
   * @param mapControl necessary to delete observers, stop drawing, obtain
51
   *          {@link EditingBehavior}...
52 97
   */
53
  public void endEdition(FLyrVect layer);
54
  
55
  /**
56
   * Gets mapControl object. It is referenced by {@link WeakReference}. 
57
   * 
58
   * @return 
59
   */
60
  public MapControl getMapControl();
61
  
62
  /**
63
   * 
64
   * @param name
65
   * @return
66
   */
67
  public boolean isServiceCompatible(String name);
68
  
69
  /**
70
   * 
71
   */
72
  public void refreshMenusAndToolBars();
73
  
74
  /**
75
   * Updates the weak reference at editing context.
76
   * 
77
   * @param mapControl
78
   */
79
  public void setMapControl(MapControl mapControl);
98
    public void refreshMenusAndToolBars();
80 99

  
81
  /**
82
   * Shows text at console.
83
   * 
84
   * @param text to be showed.
85
   */
86
  public void showConsoleMessage(String text);
87
 }
100
    /**
101
     * Updates the weak reference at editing context.
102
     * 
103
     * @param mapControl
104
     */
105
    public void setMapControl(MapControl mapControl);
106

  
107
    /**
108
     * Shows text at console.
109
     * 
110
     * @param text
111
     *            to be showed.
112
     */
113
    public void showConsoleMessage(String text);
114
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingSwingLocator.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.api 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.api;
8 26

  
9 27
import org.gvsig.tools.locator.BaseLocator;
10 28
import org.gvsig.tools.locator.Locator;
11 29
import org.gvsig.tools.locator.LocatorException;
12 30

  
13

  
14 31
public class EditingSwingLocator extends BaseLocator {
15 32

  
16
  private static final String LOCATOR_NAME = "EditingSwingLocator";
33
    private static final String LOCATOR_NAME = "EditingSwingLocator";
17 34

  
18
  public static final String MANAGER_NAME = "VectorEditingSwing.manager";
35
    public static final String MANAGER_NAME = "VectorEditingSwing.manager";
19 36

  
20
  private static final String MANAGER_DESCRIPTION = "Editing Swing Manager of gvSIG";
37
    private static final String MANAGER_DESCRIPTION =
38
        "Editing Swing Manager of gvSIG";
21 39

  
22
  private static final EditingSwingLocator instance = new EditingSwingLocator();
40
    private static final EditingSwingLocator instance =
41
        new EditingSwingLocator();
23 42

  
24
  private EditingSwingLocator() {
43
    private EditingSwingLocator() {
25 44

  
26
  }
45
    }
27 46

  
28
  /**
29
   * Return the singleton instance.
30
   * 
31
   * @return the singleton instance
32
   */
33
  public static EditingSwingLocator getInstance() {
34
    return instance;
35
  }
47
    /**
48
     * Return the singleton instance.
49
     * 
50
     * @return the singleton instance
51
     */
52
    public static EditingSwingLocator getInstance() {
53
        return instance;
54
    }
36 55

  
37
  public String getLocatorName() {
38
    return LOCATOR_NAME;
39
  }
56
    public String getLocatorName() {
57
        return LOCATOR_NAME;
58
    }
40 59

  
41
  /**
42
   * Return a reference to EditingSwingManager.
43
   * 
44
   * @return a reference to EditingSwingManager
45
   * @throws LocatorException if there is no access to the class or the class
46
   *           cannot be instantiated
47
   * @see Locator#get(String)
48
   */
49
  public static EditingSwingManager getSwingManager() throws LocatorException {
50
    return (EditingSwingManager) getInstance().get(MANAGER_NAME);
51
  }
60
    /**
61
     * Return a reference to EditingSwingManager.
62
     * 
63
     * @return a reference to EditingSwingManager
64
     * @throws LocatorException
65
     *             if there is no access to the class or the class
66
     *             cannot be instantiated
67
     * @see Locator#get(String)
68
     */
69
    public static EditingSwingManager getSwingManager() throws LocatorException {
70
        return (EditingSwingManager) getInstance().get(MANAGER_NAME);
71
    }
52 72

  
53
  /**
54
   * Registers the Class implementing the EditingSwingLocator interface.
55
   * 
56
   * @param clazz implementing the EeditingSwingManager interface
57
   */
58
  public static void registerManager(Class clazz) {
59
    getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
60
  }
73
    /**
74
     * Registers the Class implementing the EditingSwingLocator interface.
75
     * 
76
     * @param clazz
77
     *            implementing the EeditingSwingManager interface
78
     */
79
    public static void registerManager(Class clazz) {
80
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
81
    }
61 82

  
62
  public static void registerDefaultManager(Class clazz) {
63
    getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
64
  }
83
    public static void registerDefaultManager(Class clazz) {
84
        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
85
    }
65 86

  
66 87
}
67

  
68

  
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingSwingLibrary.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.api 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.api;
8 26

  
9 27
import org.gvsig.fmap.dal.DALLibrary;
......
12 30
import org.gvsig.tools.library.LibraryException;
13 31
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
14 32

  
15

  
16 33
public class EditingSwingLibrary extends AbstractLibrary {
17 34

  
18
  @Override
19
  public void doRegistration() {
20
      registerAsAPI(EditingSwingLibrary.class);
21
      require(DALLibrary.class);
22
      require(GeometryLibrary.class);
23
  }
24
  
25
  @Override
26
  protected void doInitialize() throws LibraryException {
27
    // TODO Auto-generated method stub
28
    
29
  }
35
    @Override
36
    public void doRegistration() {
37
        registerAsAPI(EditingSwingLibrary.class);
38
        require(DALLibrary.class);
39
        require(GeometryLibrary.class);
40
    }
30 41

  
31
  @Override
32
  protected void doPostInitialize() throws LibraryException {
33
    EditingSwingManager manager = EditingSwingLocator.getSwingManager();
34
    if (manager == null) {
35
        throw new ReferenceNotRegisteredException(
36
            EditingSwingLocator.MANAGER_NAME, EditingSwingLocator
37
                .getInstance());
42
    @Override
43
    protected void doInitialize() throws LibraryException {
44
        // TODO Auto-generated method stub
45

  
38 46
    }
39
    
40
  }
41 47

  
48
    @Override
49
    protected void doPostInitialize() throws LibraryException {
50
        EditingSwingManager manager = EditingSwingLocator.getSwingManager();
51
        if (manager == null) {
52
            throw new ReferenceNotRegisteredException(
53
                EditingSwingLocator.MANAGER_NAME,
54
                EditingSwingLocator.getInstance());
55
        }
56

  
57
    }
58

  
42 59
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingSwingLibrary.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.impl 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.impl;
8 26

  
9 27
import org.gvsig.fmap.dal.DALLibrary;
......
18 36

  
19 37
public class DefaultEditingSwingLibrary extends AbstractLibrary {
20 38

  
21
  @Override
22
  public void doRegistration() {
23
    registerAsImplementationOf(EditingSwingLibrary.class);
24
    require(DALLibrary.class);
25
    require(MapControlLibrary.class);
26
    require(GeometryLibrary.class);
27
  }
39
    @Override
40
    public void doRegistration() {
41
        registerAsImplementationOf(EditingSwingLibrary.class);
42
        require(DALLibrary.class);
43
        require(MapControlLibrary.class);
44
        require(GeometryLibrary.class);
45
    }
28 46

  
29
  @Override
30
  protected void doInitialize() throws LibraryException {
31
    EditingSwingLocator.registerManager(DefaultEditingSwingManager.class);
32
  }
47
    @Override
48
    protected void doInitialize() throws LibraryException {
49
        EditingSwingLocator.registerManager(DefaultEditingSwingManager.class);
50
    }
33 51

  
34
  @Override
35
  protected void doPostInitialize() throws LibraryException {
36
      
37
      MapControlManager mapControlManager =
38
          MapControlLocator.getMapControlManager();
52
    @Override
53
    protected void doPostInitialize() throws LibraryException {
39 54

  
40
      mapControlManager
41
          .addMapControlCreationListener(new DefaultMapCreationListener());
42
  }
55
        MapControlManager mapControlManager =
56
            MapControlLocator.getMapControlManager();
43 57

  
58
        mapControlManager
59
            .addMapControlCreationListener(new DefaultMapCreationListener());
60
    }
61

  
44 62
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/SelectionBehavior.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
1 25
package org.gvsig.vectorediting.swing.impl;
2 26

  
3
import java.awt.Image;
4 27
import java.awt.event.MouseEvent;
5 28
import java.awt.event.MouseWheelEvent;
6 29

  
7
import org.gvsig.fmap.mapcontrol.MapControl;
8
import org.gvsig.fmap.mapcontrol.MapControlDrawer;
9 30
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
10 31
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
11 32
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener;
12 33

  
13 34
public class SelectionBehavior extends Behavior {
14 35

  
15
	public ToolListener getListener() {
16
		// TODO Auto-generated method stub
17
		return null;
18
	}
36
    public ToolListener getListener() {
37
        // TODO Auto-generated method stub
38
        return null;
39
    }
19 40

  
20
	public void mouseClicked(MouseEvent e) throws BehaviorException {
21
		int clickWithShiftDown = MouseEvent.SHIFT_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
22
	    int ctrlDown = MouseEvent.CTRL_DOWN_MASK;
23
	    if ((e.getModifiersEx() & (clickWithShiftDown | ctrlDown)) == clickWithShiftDown) {
41
    public void mouseClicked(MouseEvent e) throws BehaviorException {
42
        int clickWithShiftDown =
43
            MouseEvent.SHIFT_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
44
        int ctrlDown = MouseEvent.CTRL_DOWN_MASK;
45
        if ((e.getModifiersEx() & (clickWithShiftDown | ctrlDown)) == clickWithShiftDown) {
24 46

  
25
	    }
47
        }
26 48

  
27
	}
49
    }
28 50

  
29
	public void mouseEntered(MouseEvent e) throws BehaviorException {
30
		// TODO Auto-generated method stub
51
    public void mouseEntered(MouseEvent e) throws BehaviorException {
52
        // TODO Auto-generated method stub
31 53

  
32
	}
54
    }
33 55

  
34
	public void mouseExited(MouseEvent e) throws BehaviorException {
35
		// TODO Auto-generated method stub
56
    public void mouseExited(MouseEvent e) throws BehaviorException {
57
        // TODO Auto-generated method stub
36 58

  
37
	}
59
    }
38 60

  
39
	public void mousePressed(MouseEvent e) throws BehaviorException {
40
		// TODO Auto-generated method stub
61
    public void mousePressed(MouseEvent e) throws BehaviorException {
62
        // TODO Auto-generated method stub
41 63

  
42
	}
64
    }
43 65

  
44
	public void mouseReleased(MouseEvent e) throws BehaviorException {
45
		// TODO Auto-generated method stub
66
    public void mouseReleased(MouseEvent e) throws BehaviorException {
67
        // TODO Auto-generated method stub
46 68

  
47
	}
69
    }
48 70

  
49
	public void mouseDragged(MouseEvent e) throws BehaviorException {
50
		// TODO Auto-generated method stub
71
    public void mouseDragged(MouseEvent e) throws BehaviorException {
72
        // TODO Auto-generated method stub
51 73

  
52
	}
74
    }
53 75

  
54
	public void mouseMoved(MouseEvent e) throws BehaviorException {
55
		// TODO Auto-generated method stub
76
    public void mouseMoved(MouseEvent e) throws BehaviorException {
77
        // TODO Auto-generated method stub
56 78

  
57
	}
79
    }
58 80

  
59
	public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
60
		// TODO Auto-generated method stub
81
    public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
82
        // TODO Auto-generated method stub
61 83

  
62
	}
84
    }
63 85

  
64 86
}
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
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3 3
 *
4
 * Project  : DiSiD org.gvsig.vectorediting.lib.impl
5
 * SVN Id   : $Id$
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.impl;
8 26

  
9 27
import java.awt.Color;
......
519 537
        editingContext.enableSelection(enableSelection);
520 538
    }
521 539

  
522
    public boolean isServiceCompatible(String name) throws ServiceInformationException{
540
    public boolean isServiceCompatible(String name)
541
        throws ServiceInformationException {
523 542
        EditingManager manager = EditingLocator.getManager();
524 543
        EditingServiceInfo serviceInfo = manager.getServiceInfo(name);
525 544
        GeometryType geoType = null;
......
527 546
        for (EditingService editingService : serviceStack) {
528 547
            if (editingService.next().getTypes()
529 548
                .contains(EditingServiceParameter.TYPE.GEOMETRY)) {
530
                
549

  
531 550
                int geometryType = editingService.next().getGeometryType();
532 551
                int subType = -1;
533 552
                try {
534
                    subType = currentLayer.getFeatureStore().getDefaultFeatureType()
535
                        .getDefaultGeometryAttribute().getGeomType()
536
                        .getSubType();
537
                    geoType = geomManager.getGeometryType(geometryType, subType);
553
                    subType =
554
                        currentLayer.getFeatureStore().getDefaultFeatureType()
555
                            .getDefaultGeometryAttribute().getGeomType()
556
                            .getSubType();
557
                    geoType =
558
                        geomManager.getGeometryType(geometryType, subType);
538 559
                } catch (Exception e) {
539
                    
540
                    String msg = String.format("Problems getting default feature"
541
                        + " type of %1$s or getting geometry type of %2$s %3$s",
542
                        currentLayer.getName(),
543
                        geometryType,
544
                        subType);
545
                    
560

  
561
                    String msg =
562
                        String
563
                            .format(
564
                                "Problems getting default feature"
565
                                    + " type of %1$s or getting geometry type of %2$s %3$s",
566
                                currentLayer.getName(), geometryType, subType);
567

  
546 568
                    throw new ServiceInformationException(msg, e);
547 569
                }
548 570

  
549
                return serviceInfo.isCompatibleWith(geoType) && serviceInfo.createsNewGeometries();
571
                return serviceInfo.isCompatibleWith(geoType)
572
                    && serviceInfo.createsNewGeometries();
550 573
            }
551 574
        }
552 575

  
......
555 578
                currentLayer.getFeatureStore().getDefaultFeatureType()
556 579
                    .getDefaultGeometryAttribute().getGeomType();
557 580
        } catch (DataException e) {
558
            String msg = String.format("Problems getting default "
559
                + "feature type of %1$s", currentLayer.getName());
560
            throw new ServiceInformationException(msg,e);
581
            String msg =
582
                String.format("Problems getting default "
583
                    + "feature type of %1$s", currentLayer.getName());
584
            throw new ServiceInformationException(msg, e);
561 585
        }
562 586

  
563 587
        return serviceInfo.isCompatibleWith(geoType);
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/EditingCompoundBehavior.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
1 25
package org.gvsig.vectorediting.swing.impl;
2 26

  
3 27
import java.awt.Image;
......
11 35
import org.gvsig.fmap.mapcontrol.tools.PointSelectionListener;
12 36
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
13 37
import org.gvsig.fmap.mapcontrol.tools.Behavior.IBehavior;
14
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
15 38
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior;
16 39
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
17 40
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener;
18 41

  
19 42
public class EditingCompoundBehavior extends CompoundBehavior {
20 43

  
21
	private enum Mode {
22
		EDITING, SELECTION
23
	};
44
    private enum Mode {
45
        EDITING, SELECTION
46
    };
24 47

  
25
	private Mode mode = Mode.EDITING;
26
	private IBehavior editing;
27
	private IBehavior selection;
28
	private IBehavior zoom;
48
    private Mode mode = Mode.EDITING;
49
    private IBehavior editing;
50
    private IBehavior selection;
51
    private IBehavior zoom;
29 52

  
30
	public final static int EDITING_INDEX = 0;
31
	public final static int SELECTION_INDEX = 1;
53
    public final static int EDITING_INDEX = 0;
54
    public final static int SELECTION_INDEX = 1;
32 55

  
33
	public EditingCompoundBehavior(IBehavior editing) {
34
		super(new Behavior[0]);
35
		this.editing = editing;
56
    public EditingCompoundBehavior(IBehavior editing) {
57
        super(new Behavior[0]);
58
        this.editing = editing;
36 59

  
37
		this.selection = null;
38
		this.zoom = new MouseWheelBehavior();
39
	}
60
        this.selection = null;
61
        this.zoom = new MouseWheelBehavior();
62
    }
40 63

  
41
	public void addMapBehavior(Behavior mt, boolean draw) {
42
		if (mt instanceof MouseWheelBehavior) {
43
			return;
44
		}
45
		throw new UnsupportedOperationException();
46
	}
64
    public void addMapBehavior(Behavior mt, boolean draw) {
65
        if (mt instanceof MouseWheelBehavior) {
66
            return;
67
        }
68
        throw new UnsupportedOperationException();
69
    }
47 70

  
48
	public void removeMapBehavior(Behavior mt) {
49
		throw new UnsupportedOperationException();
50
	}
71
    public void removeMapBehavior(Behavior mt) {
72
        throw new UnsupportedOperationException();
73
    }
51 74

  
52
	public boolean containsBehavior(Behavior mt) {
53
		return (mt == this.editing || mt == this.selection);
54
	}
75
    public boolean containsBehavior(Behavior mt) {
76
        return (mt == this.editing || mt == this.selection);
77
    }
55 78

  
56
	public Behavior getBehavior(int index) {
57
		switch (index) {
58
		case EDITING_INDEX:
59
			return (Behavior) this.editing;
60
		case SELECTION_INDEX:
61
			return (Behavior) this.selection;
62
		default:
63
			throw new IndexOutOfBoundsException();
64
		}
65
	}
79
    public Behavior getBehavior(int index) {
80
        switch (index) {
81
        case EDITING_INDEX:
82
            return (Behavior) this.editing;
83
        case SELECTION_INDEX:
84
            return (Behavior) this.selection;
85
        default:
86
            throw new IndexOutOfBoundsException();
87
        }
88
    }
66 89

  
67
	public boolean isDrawnBehavior(int index) {
68
		switch (mode) {
69
		case EDITING:
70
			return index == EDITING_INDEX;
71
		case SELECTION:
72
			return index == SELECTION_INDEX;
73
		default:
74
			return false;
75
		}
76
	}
90
    public boolean isDrawnBehavior(int index) {
91
        switch (mode) {
92
        case EDITING:
93
            return index == EDITING_INDEX;
94
        case SELECTION:
95
            return index == SELECTION_INDEX;
96
        default:
97
            return false;
98
        }
99
    }
77 100

  
78
	public void setDrawnBehavior(int index, boolean draw) {
79
		switch (index) {
80
		case EDITING_INDEX:
81
			if (draw) {
82
				mode = Mode.EDITING;
83
			} else {
84
				mode = Mode.SELECTION;
85
			}
86
			break;
87
		case SELECTION_INDEX:
88
			if (draw) {
89
				mode = Mode.SELECTION;
90
			} else {
91
				mode = Mode.EDITING;
92
			}
93
			break;
94
		default:
95
			throw new IndexOutOfBoundsException();
96
		}
97
	}
101
    public void setDrawnBehavior(int index, boolean draw) {
102
        switch (index) {
103
        case EDITING_INDEX:
104
            if (draw) {
105
                mode = Mode.EDITING;
106
            } else {
107
                mode = Mode.SELECTION;
108
            }
109
            break;
110
        case SELECTION_INDEX:
111
            if (draw) {
112
                mode = Mode.SELECTION;
113
            } else {
114
                mode = Mode.EDITING;
115
            }
116
            break;
117
        default:
118
            throw new IndexOutOfBoundsException();
119
        }
120
    }
98 121

  
99
	public int size() {
100
		return 2;
101
	}
122
    public int size() {
123
        return 2;
124
    }
102 125

  
103
	public Image getImageCursor() {
104
		switch (mode) {
105
		default:
106
		case EDITING:
107
			return this.editing.getImageCursor();
108
		case SELECTION:
109
			return this.selection.getImageCursor();
110
		}
111
	}
126
    public Image getImageCursor() {
127
        switch (mode) {
128
        default:
129
        case EDITING:
130
            return this.editing.getImageCursor();
131
        case SELECTION:
132
            return this.selection.getImageCursor();
133
        }
134
    }
112 135

  
113
	public void mouseClicked(MouseEvent e) throws BehaviorException {
114
		switch (mode) {
115
		default:
116
		case EDITING:
117
			this.editing.mouseClicked(e);
118
			break;
119
		case SELECTION:
120
			this.selection.mouseClicked(e);
121
		}
122
		this.zoom.mouseClicked(e);
123
	}
136
    public void mouseClicked(MouseEvent e) throws BehaviorException {
137
        switch (mode) {
138
        default:
139
        case EDITING:
140
            this.editing.mouseClicked(e);
141
            break;
142
        case SELECTION:
143
            this.selection.mouseClicked(e);
144
        }
145
        this.zoom.mouseClicked(e);
146
    }
124 147

  
125
	public void mouseDragged(MouseEvent e) throws BehaviorException {
126
		switch (mode) {
127
		default:
128
		case EDITING:
129
			this.editing.mouseDragged(e);
130
			break;
131
		case SELECTION:
132
			this.selection.mouseDragged(e);
133
		}
134
		this.zoom.mouseDragged(e);
135
	}
148
    public void mouseDragged(MouseEvent e) throws BehaviorException {
149
        switch (mode) {
150
        default:
151
        case EDITING:
152
            this.editing.mouseDragged(e);
153
            break;
154
        case SELECTION:
155
            this.selection.mouseDragged(e);
156
        }
157
        this.zoom.mouseDragged(e);
158
    }
136 159

  
137
	public void mouseEntered(MouseEvent e) throws BehaviorException {
138
		switch (mode) {
139
		default:
140
		case EDITING:
141
			this.editing.mouseEntered(e);
142
			break;
143
		case SELECTION:
144
			this.selection.mouseEntered(e);
145
		}
146
		this.zoom.mouseEntered(e);
147
	}
160
    public void mouseEntered(MouseEvent e) throws BehaviorException {
161
        switch (mode) {
162
        default:
163
        case EDITING:
164
            this.editing.mouseEntered(e);
165
            break;
166
        case SELECTION:
167
            this.selection.mouseEntered(e);
168
        }
169
        this.zoom.mouseEntered(e);
170
    }
148 171

  
149
	public void mouseExited(MouseEvent e) throws BehaviorException {
150
		switch (mode) {
151
		default:
152
		case EDITING:
153
			this.editing.mouseExited(e);
154
			break;
155
		case SELECTION:
156
			this.selection.mouseExited(e);
157
		}
158
		this.zoom.mouseExited(e);
159
	}
172
    public void mouseExited(MouseEvent e) throws BehaviorException {
173
        switch (mode) {
174
        default:
175
        case EDITING:
176
            this.editing.mouseExited(e);
177
            break;
178
        case SELECTION:
179
            this.selection.mouseExited(e);
180
        }
181
        this.zoom.mouseExited(e);
182
    }
160 183

  
161
	public void mouseMoved(MouseEvent e) throws BehaviorException {
162
		switch (mode) {
163
		default:
164
		case EDITING:
165
			this.editing.mouseMoved(e);
166
			break;
167
		case SELECTION:
168
			this.selection.mouseMoved(e);
169
		}
170
		this.zoom.mouseMoved(e);
171
	}
184
    public void mouseMoved(MouseEvent e) throws BehaviorException {
185
        switch (mode) {
186
        default:
187
        case EDITING:
188
            this.editing.mouseMoved(e);
189
            break;
190
        case SELECTION:
191
            this.selection.mouseMoved(e);
192
        }
193
        this.zoom.mouseMoved(e);
194
    }
172 195

  
173
	public void mousePressed(MouseEvent e) throws BehaviorException {
174
		switch (mode) {
175
		default:
176
		case EDITING:
177
			this.editing.mousePressed(e);
178
			break;
179
		case SELECTION:
180
			this.selection.mousePressed(e);
181
		}
182
		this.zoom.mousePressed(e);
183
	}
196
    public void mousePressed(MouseEvent e) throws BehaviorException {
197
        switch (mode) {
198
        default:
199
        case EDITING:
200
            this.editing.mousePressed(e);
201
            break;
202
        case SELECTION:
203
            this.selection.mousePressed(e);
204
        }
205
        this.zoom.mousePressed(e);
206
    }
184 207

  
185
	public void mouseReleased(MouseEvent e) throws BehaviorException {
186
		switch (mode) {
187
		default:
188
		case EDITING:
189
			this.editing.mouseReleased(e);
190
			break;
191
		case SELECTION:
192
			this.selection.mouseReleased(e);
193
		}
194
		this.zoom.mouseReleased(e);
195
	}
208
    public void mouseReleased(MouseEvent e) throws BehaviorException {
209
        switch (mode) {
210
        default:
211
        case EDITING:
212
            this.editing.mouseReleased(e);
213
            break;
214
        case SELECTION:
215
            this.selection.mouseReleased(e);
216
        }
217
        this.zoom.mouseReleased(e);
218
    }
196 219

  
197
	public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
198
		switch (mode) {
199
		default:
200
		case EDITING:
201
			this.editing.mouseWheelMoved(e);
202
			break;
203
		case SELECTION:
204
			this.selection.mouseWheelMoved(e);
205
		}
206
		this.zoom.mouseWheelMoved(e);
207
	}
220
    public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
221
        switch (mode) {
222
        default:
223
        case EDITING:
224
            this.editing.mouseWheelMoved(e);
225
            break;
226
        case SELECTION:
227
            this.selection.mouseWheelMoved(e);
228
        }
229
        this.zoom.mouseWheelMoved(e);
230
    }
208 231

  
209
	public void paintComponent(MapControlDrawer renderer) {
210
		switch (mode) {
211
		default:
212
		case EDITING:
213
			this.editing.paintComponent(renderer);
214
			break;
215
		case SELECTION:
216
			this.selection.paintComponent(renderer);
217
		}
218
		this.zoom.paintComponent(renderer);
219
	}
232
    public void paintComponent(MapControlDrawer renderer) {
233
        switch (mode) {
234
        default:
235
        case EDITING:
236
            this.editing.paintComponent(renderer);
237
            break;
238
        case SELECTION:
239
            this.selection.paintComponent(renderer);
240
        }
241
        this.zoom.paintComponent(renderer);
242
    }
220 243

  
221
	public void setListener(ToolListener listener) {
222
		if (listener != null) {
223
			throw new UnsupportedOperationException(
224
					"CompoundBehavior does not have listeners");
225
		}
226
	}
244
    public void setListener(ToolListener listener) {
245
        if (listener != null) {
246
            throw new UnsupportedOperationException(
247
                "CompoundBehavior does not have listeners");
248
        }
249
    }
227 250

  
228
	public ToolListener getListener() {
229
		return null;
230
	}
251
    public ToolListener getListener() {
252
        return null;
253
    }
231 254

  
232
	public void setMapControl(MapControl mc) {
233
		this.editing.setMapControl(mc);
234
		this.zoom.setMapControl(mc);
255
    public void setMapControl(MapControl mc) {
256
        this.editing.setMapControl(mc);
257
        this.zoom.setMapControl(mc);
235 258

  
236
		if (this.selection == null){
237
			if (mc !=null) {
238
				PointSelectionListener psl = new PointSelectionListener(mc);
239
				this.selection = new CompoundBehavior(new Behavior[] {
240
						new PointBehavior(psl) });
241
				this.selection.setMapControl(mc);
242
			}
243
		} else {
244
			this.selection.setMapControl(mc);
245
		}
246
	}
259
        if (this.selection == null) {
260
            if (mc != null) {
261
                PointSelectionListener psl = new PointSelectionListener(mc);
262
                this.selection =
263
                    new CompoundBehavior(
264
                        new Behavior[] { new PointBehavior(psl) });
265
                this.selection.setMapControl(mc);
266
            }
267
        } else {
268
            this.selection.setMapControl(mc);
269
        }
270
    }
247 271

  
248 272
}
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingSwingManager.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3 3
 *
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.impl
5
 * SVN Id   : $Id$
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.impl;
8 26

  
9 27
import java.awt.BorderLayout;
......
44 62

  
45 63
    public EditingContext getEditingContext(MapControl mapControl) {
46 64
        MapContext mapContext = mapControl.getMapContext();
47
        
65

  
48 66
        if (editingContexts.containsKey(mapContext)) {
49 67
            EditingContext editingContext = editingContexts.get(mapContext);
50
            
51
            if(editingContext.getMapControl() != null){
68

  
69
            if (editingContext.getMapControl() != null) {
52 70
                return editingContext;
53 71
            } else {
54 72
                editingContexts.remove(mapContext);
55 73
            }
56
            
74

  
57 75
        }
58 76
        return null;
59 77
    }
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingContext.java
1
/*
2
 * Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
3
 * 
4
 * Project  : DiSiD org.gvsig.vectorediting.swing.impl 
5
 * SVN Id   : $Id$
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
6 23
 */
24

  
7 25
package org.gvsig.vectorediting.swing.impl;
8 26

  
9 27
import java.awt.BorderLayout;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff