Revision 1740
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.vectorediting.swing.api.EditingSwingLibrary |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/contextmenu/EditingContextMenu.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 |
|
|
25 |
package org.gvsig.vectorediting.swing.api.contextmenu; |
|
26 |
|
|
27 |
import java.awt.Component; |
|
28 |
|
|
29 |
/** |
|
30 |
* @author llmarques |
|
31 |
* |
|
32 |
*/ |
|
33 |
public interface EditingContextMenu { |
|
34 |
|
|
35 |
/** |
|
36 |
* @param mapControl |
|
37 |
* @param x |
|
38 |
* @param y |
|
39 |
*/ |
|
40 |
public void show(Component mapControl, int x, int y); |
|
41 |
|
|
42 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/contextmenu/AcceptValueListener.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 |
|
|
25 |
/* gvSIG. Desktop Geographic Information System. |
|
26 |
* |
|
27 |
* Copyright ? 2007-2014 gvSIG Association |
|
28 |
* |
|
29 |
* This program is free software; you can redistribute it and/or |
|
30 |
* modify it under the terms of the GNU General Public License |
|
31 |
* as published by the Free Software Foundation; either version 2 |
|
32 |
* of the License, or (at your option) any later version. |
|
33 |
* |
|
34 |
* This program is distributed in the hope that it will be useful, |
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
37 |
* GNU General Public License for more details. |
|
38 |
* |
|
39 |
* You should have received a copy of the GNU General Public License |
|
40 |
* along with this program; if not, write to the Free Software |
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
42 |
* MA 02110-1301, USA. |
|
43 |
* |
|
44 |
* For any additional information, do not hesitate to contact us |
|
45 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
46 |
*/ |
|
47 |
package org.gvsig.vectorediting.swing.api.contextmenu; |
|
48 |
|
|
49 |
/** |
|
50 |
* @author llmarques |
|
51 |
* |
|
52 |
*/ |
|
53 |
public interface AcceptValueListener { |
|
54 |
|
|
55 |
public void acceptValue(Object value); |
|
56 |
|
|
57 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingSwingLocator.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 |
|
|
25 |
package org.gvsig.vectorediting.swing.api; |
|
26 |
|
|
27 |
import org.gvsig.tools.locator.BaseLocator; |
|
28 |
import org.gvsig.tools.locator.Locator; |
|
29 |
import org.gvsig.tools.locator.LocatorException; |
|
30 |
|
|
31 |
public class EditingSwingLocator extends BaseLocator { |
|
32 |
|
|
33 |
private static final String LOCATOR_NAME = "EditingSwingLocator"; |
|
34 |
|
|
35 |
public static final String MANAGER_NAME = "VectorEditingSwing.manager"; |
|
36 |
|
|
37 |
private static final String MANAGER_DESCRIPTION = |
|
38 |
"Editing Swing Manager of gvSIG"; |
|
39 |
|
|
40 |
private static final EditingSwingLocator instance = |
|
41 |
new EditingSwingLocator(); |
|
42 |
|
|
43 |
private EditingSwingLocator() { |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* Return the singleton instance. |
|
49 |
* |
|
50 |
* @return the singleton instance |
|
51 |
*/ |
|
52 |
public static EditingSwingLocator getInstance() { |
|
53 |
return instance; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public String getLocatorName() { |
|
58 |
return LOCATOR_NAME; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Return a reference to EditingSwingManager. |
|
63 |
* |
|
64 |
* @return a reference to EditingSwingManager |
|
65 |
* @throws LocatorException |
|
66 |
* if there is no access to the class or the class |
|
67 |
* cannot be instantiated |
|
68 |
* @see Locator#get(String) |
|
69 |
*/ |
|
70 |
public static EditingSwingManager getSwingManager() throws LocatorException { |
|
71 |
return (EditingSwingManager) getInstance().get(MANAGER_NAME); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the EditingSwingLocator interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the EeditingSwingManager interface |
|
79 |
*/ |
|
80 |
public static void registerManager(Class clazz) { |
|
81 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
82 |
} |
|
83 |
|
|
84 |
public static void registerDefaultManager(Class clazz) { |
|
85 |
getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
86 |
} |
|
87 |
|
|
88 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingSwingLibrary.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 |
|
|
25 |
package org.gvsig.vectorediting.swing.api; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.DALLibrary; |
|
28 |
import org.gvsig.fmap.geom.GeometryLibrary; |
|
29 |
import org.gvsig.tools.library.AbstractLibrary; |
|
30 |
import org.gvsig.tools.library.LibraryException; |
|
31 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
32 |
|
|
33 |
public class EditingSwingLibrary extends AbstractLibrary { |
|
34 |
|
|
35 |
@Override |
|
36 |
public void doRegistration() { |
|
37 |
registerAsAPI(EditingSwingLibrary.class); |
|
38 |
require(DALLibrary.class); |
|
39 |
require(GeometryLibrary.class); |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
protected void doInitialize() throws LibraryException { |
|
44 |
// TODO Auto-generated method stub |
|
45 |
|
|
46 |
} |
|
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 |
|
|
59 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/console/EditingConsole.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2015 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 |
|
|
25 |
package org.gvsig.vectorediting.swing.api.console; |
|
26 |
|
|
27 |
import org.gvsig.utils.console.ResponseListener; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author llmarques |
|
33 |
* |
|
34 |
*/ |
|
35 |
public interface EditingConsole { |
|
36 |
|
|
37 |
/** |
|
38 |
* Gets response text typed by user |
|
39 |
* |
|
40 |
* @return |
|
41 |
*/ |
|
42 |
public String getResponseText(); |
|
43 |
|
|
44 |
/** |
|
45 |
* Clears console |
|
46 |
*/ |
|
47 |
public void clear(); |
|
48 |
|
|
49 |
/** |
|
50 |
* Adds text to console |
|
51 |
* |
|
52 |
* @param text |
|
53 |
*/ |
|
54 |
public void addText(String text); |
|
55 |
|
|
56 |
/** |
|
57 |
* Add text that is taken like text typed by user |
|
58 |
* |
|
59 |
* @param responseText |
|
60 |
*/ |
|
61 |
public void addResponseText(String responseText); |
|
62 |
|
|
63 |
/** |
|
64 |
* Adds the listener |
|
65 |
* |
|
66 |
* @param listener |
|
67 |
*/ |
|
68 |
public void addResponseListener(ResponseListener listener); |
|
69 |
|
|
70 |
/** |
|
71 |
* Removes the listener |
|
72 |
* |
|
73 |
* @param listener |
|
74 |
*/ |
|
75 |
public void removeResponseListener(ResponseListener listener); |
|
76 |
|
|
77 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingSwingManager.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 |
|
|
25 |
package org.gvsig.vectorediting.swing.api; |
|
26 |
|
|
27 |
import java.awt.Component; |
|
28 |
import java.util.List; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
31 |
import org.gvsig.tools.service.Manager; |
|
32 |
import org.gvsig.utils.console.ResponseListener; |
|
33 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter; |
|
34 |
import org.gvsig.vectorediting.swing.api.console.EditingConsole; |
|
35 |
import org.gvsig.vectorediting.swing.api.contextmenu.AcceptValueListener; |
|
36 |
import org.gvsig.vectorediting.swing.api.contextmenu.EditingContextMenu; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author gvSIG team. |
|
40 |
*/ |
|
41 |
public interface EditingSwingManager extends Manager { |
|
42 |
|
|
43 |
/** |
|
44 |
* @param mapControl |
|
45 |
* @return |
|
46 |
*/ |
|
47 |
EditingContext getEditingContext(MapControl mapControl); |
|
48 |
|
|
49 |
/** |
|
50 |
* |
|
51 |
* @param mapControl |
|
52 |
*/ |
|
53 |
public void registerEditingContext(MapControl mapControl); |
|
54 |
|
|
55 |
/** |
|
56 |
* |
|
57 |
* @param layerName |
|
58 |
* @return |
|
59 |
*/ |
|
60 |
int showPanelExportOrDiscard(MapControl parent, String layerName); |
|
61 |
|
|
62 |
/** |
|
63 |
* |
|
64 |
* @param layerName |
|
65 |
* @return |
|
66 |
*/ |
|
67 |
int showPanelSaveOrDiscard(MapControl parent, String layerName); |
|
68 |
|
|
69 |
/** |
|
70 |
* Gets an instance of current parameter contextual menu. To show it, invoke |
|
71 |
* {@link EditingContextMenu#show(java.awt.Component, int, int)}. |
|
72 |
* |
|
73 |
* @param parent |
|
74 |
* of contextual menu |
|
75 |
* @param parameter |
|
76 |
* to build contextual menu according to it types. |
|
77 |
* @return contextual menu of parameter |
|
78 |
*/ |
|
79 |
EditingContextMenu getContextualMenu(Component parent, |
|
80 |
AcceptValueListener listener, EditingServiceParameter parameter); |
|
81 |
|
|
82 |
/** |
|
83 |
* Gets and instance of {@link EditingConsole}. |
|
84 |
* The response listener will receive the response typed |
|
85 |
* by user when ENTER key is pressed. |
|
86 |
* |
|
87 |
* @param listener |
|
88 |
* Object that will received the response |
|
89 |
* @return An instance of {@link EditingConsole} |
|
90 |
*/ |
|
91 |
EditingConsole getEditingConsole(ResponseListener listener); |
|
92 |
|
|
93 |
/** |
|
94 |
* Gets and instance of {@link EditingConsole}. |
|
95 |
* Response listener list will receive the response |
|
96 |
* typed by user when ENTER key is pressed. |
|
97 |
* |
|
98 |
* @param listener |
|
99 |
* Object that will received the response |
|
100 |
* @return An instance of {@link EditingConsole} |
|
101 |
*/ |
|
102 |
EditingConsole getEditingConsole(List<ResponseListener> liteners); |
|
103 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/src/main/java/org/gvsig/vectorediting/swing/api/EditingContext.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 |
|
|
25 |
package org.gvsig.vectorediting.swing.api; |
|
26 |
|
|
27 |
import java.lang.ref.WeakReference; |
|
28 |
|
|
29 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
30 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
31 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
|
32 |
import org.gvsig.tools.observer.Observable; |
|
33 |
|
|
34 |
public interface EditingContext extends Observable { |
|
35 |
|
|
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; |
|
40 |
static final String DEFAULT_TOOL = "default_tool"; |
|
41 |
|
|
42 |
static final String CHANGE_SELECTED_TOOL_NOTIFICATION = "EditingContext.changeSelectedTool"; |
|
43 |
static final String REFRESH_TOOLS_NOTIFICATION = "EditingContext.refreshTools"; |
|
44 |
static final String EXPORT_LAYER_NOTIFICATION = "EditingContext.exportLayer"; |
|
45 |
/** |
|
46 |
* Activates service as of name and {@link MapControl} |
|
47 |
* |
|
48 |
* @param name |
|
49 |
* of service |
|
50 |
* @param mapControl |
|
51 |
* of |
|
52 |
*/ |
|
53 |
public void activateService(String name); |
|
54 |
|
|
55 |
/** |
|
56 |
* @deprecated Use {@link EditingContext#beginEdition(FLyrVect)} |
|
57 |
*/ |
|
58 |
public void beginEdition(FLyrVect layer, Behavior[] additionalBehaviors); |
|
59 |
|
|
60 |
/** |
|
61 |
* Begins edition of a layer |
|
62 |
* |
|
63 |
* @param layer |
|
64 |
* to begin edition |
|
65 |
*/ |
|
66 |
public void beginEdition(FLyrVect layer); |
|
67 |
|
|
68 |
/** |
|
69 |
* Ends edition of a layer |
|
70 |
* |
|
71 |
* @param layer |
|
72 |
* to end edition |
|
73 |
*/ |
|
74 |
public void endEdition(FLyrVect layer); |
|
75 |
|
|
76 |
/** |
|
77 |
* Gets mapControl object. It is referenced by {@link WeakReference}. |
|
78 |
* |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public MapControl getMapControl(); |
|
82 |
|
|
83 |
/** |
|
84 |
* |
|
85 |
* @param name |
|
86 |
* @return |
|
87 |
*/ |
|
88 |
public boolean isServiceCompatible(String name); |
|
89 |
|
|
90 |
/** |
|
91 |
* Updates the weak reference at editing context. |
|
92 |
* |
|
93 |
* @param mapControl |
|
94 |
*/ |
|
95 |
public void setMapControl(MapControl mapControl); |
|
96 |
|
|
97 |
|
|
98 |
public Behavior[] getDefaultBehaviors(); |
|
99 |
|
|
100 |
public void setDefaultBehaviors(Behavior[] defaultBehaviors); |
|
101 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.vectorediting.swing.api</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.vectorediting.swing.api</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.vectorediting.swing</artifactId> |
|
10 |
<version>1.0.97</version> |
|
11 |
</parent> |
|
12 |
<build> |
|
13 |
<plugins> |
|
14 |
<plugin> |
|
15 |
<groupId>org.apache.maven.plugins</groupId> |
|
16 |
<artifactId>maven-jar-plugin</artifactId> |
|
17 |
<configuration> |
|
18 |
</configuration> |
|
19 |
<executions> |
|
20 |
<!-- Generates a jar file only with the test classes --> |
|
21 |
<execution> |
|
22 |
<goals> |
|
23 |
<goal>test-jar</goal> |
|
24 |
</goals> |
|
25 |
</execution> |
|
26 |
</executions> |
|
27 |
</plugin> |
|
28 |
</plugins> |
|
29 |
</build> |
|
30 |
<dependencies> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.vectorediting.lib.api</artifactId> |
|
34 |
</dependency> |
|
35 |
</dependencies> |
|
36 |
</project> |
|
0 | 37 |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.vectorediting.swing</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>org.gvsig.vectorediting.swing</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.vectorediting</artifactId> |
|
11 |
<version>1.0.97</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
|
|
15 |
<modules> |
|
16 |
<module>org.gvsig.vectorediting.swing.api</module> |
|
17 |
<module>org.gvsig.vectorediting.swing.impl</module> |
|
18 |
</modules> |
|
19 |
</project> |
|
20 |
|
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 2 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.vectorediting"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
==== |
|
2 |
gvSIG. Desktop Geographic Information System. |
|
3 |
|
|
4 |
Copyright (C) 2007-2012 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 |
|
|
25 |
Put into this folder the resources needed by your test classes. |
|
26 |
|
|
27 |
This folder is added to the Tests classpath, so you can load any resources |
|
28 |
through the ClassLoader. |
|
29 |
|
|
30 |
By default, in this folder you can find an example of log4j configuration, |
|
31 |
prepared to log messages through the console, so logging works when you |
|
32 |
run your tests classes. |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.vectorediting.swing.impl.DefaultEditingSwingLibrary |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingBehavior.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 |
|
|
25 |
package org.gvsig.vectorediting.swing.impl; |
|
26 |
|
|
27 |
import java.awt.Color; |
|
28 |
import java.awt.Graphics; |
|
29 |
import java.awt.Image; |
|
30 |
import java.awt.event.MouseEvent; |
|
31 |
import java.awt.geom.Point2D; |
|
32 |
import java.awt.image.BufferedImage; |
|
33 |
import java.util.Iterator; |
|
34 |
import java.util.Set; |
|
35 |
|
|
36 |
import javax.swing.SwingUtilities; |
|
37 |
|
|
38 |
import org.slf4j.Logger; |
|
39 |
import org.slf4j.LoggerFactory; |
|
40 |
|
|
41 |
import org.gvsig.fmap.geom.Geometry; |
|
42 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
43 |
import org.gvsig.fmap.geom.primitive.Point; |
|
44 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
45 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
46 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
|
47 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
|
48 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
49 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
50 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
|
51 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener; |
|
52 |
import org.gvsig.tools.ToolsLocator; |
|
53 |
import org.gvsig.tools.exception.BaseException; |
|
54 |
import org.gvsig.tools.i18n.I18nManager; |
|
55 |
import org.gvsig.vectorediting.lib.api.DrawingStatus; |
|
56 |
import org.gvsig.vectorediting.lib.api.DrawingStatus.Status; |
|
57 |
import org.gvsig.vectorediting.lib.api.EditingService; |
|
58 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter; |
|
59 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter.TYPE; |
|
60 |
import org.gvsig.vectorediting.lib.api.exceptions.CreateEditingBehaviorException; |
|
61 |
import org.gvsig.vectorediting.lib.api.exceptions.VectorEditingException; |
|
62 |
import org.gvsig.vectorediting.swing.api.EditingSwingLocator; |
|
63 |
import org.gvsig.vectorediting.swing.api.EditingSwingManager; |
|
64 |
import org.gvsig.vectorediting.swing.api.contextmenu.AcceptValueListener; |
|
65 |
import org.gvsig.vectorediting.swing.api.contextmenu.EditingContextMenu; |
|
66 |
|
|
67 |
public class DefaultEditingBehavior extends Behavior { |
|
68 |
|
|
69 |
private static final Logger logger = LoggerFactory |
|
70 |
.getLogger(DefaultEditingBehavior.class); |
|
71 |
|
|
72 |
private DefaultEditingContext editingContext; |
|
73 |
|
|
74 |
private Point adjustedPoint; |
|
75 |
|
|
76 |
private static final Image imageCursor = new BufferedImage(32, 32, |
|
77 |
BufferedImage.TYPE_INT_ARGB); |
|
78 |
static { |
|
79 |
Graphics g = imageCursor.getGraphics(); |
|
80 |
int size1 = 15; |
|
81 |
int x = 16; |
|
82 |
int y = 16; |
|
83 |
g.setColor(Color.MAGENTA); |
|
84 |
g.drawLine((x - size1), (y), (x + size1), (y)); |
|
85 |
g.drawLine((x), (y - size1), (x), (y + size1)); |
|
86 |
g.drawRect((x - 6), (y - 6), 12, 12); |
|
87 |
g.drawRect((x - 3), (y - 3), 6, 6); |
|
88 |
} |
|
89 |
|
|
90 |
public DefaultEditingBehavior(DefaultEditingContext editingContext) |
|
91 |
throws CreateEditingBehaviorException { |
|
92 |
|
|
93 |
if (editingContext.getMapControl() != null) { |
|
94 |
this.editingContext = editingContext; |
|
95 |
setMapControl(editingContext.getMapControl()); |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
99 |
@Override |
|
100 |
public ToolListener getListener() { |
|
101 |
return new ToolListener() { |
|
102 |
|
|
103 |
public boolean cancelDrawing() { |
|
104 |
return false; |
|
105 |
} |
|
106 |
|
|
107 |
public Image getImageCursor() { |
|
108 |
return imageCursor; |
|
109 |
} |
|
110 |
}; |
|
111 |
} |
|
112 |
|
|
113 |
@Override |
|
114 |
public void mouseClicked(MouseEvent e) { |
|
115 |
ViewPort vp = editingContext.getMapControl().getViewPort(); |
|
116 |
EditingServiceParameter currentParam = editingContext.getCurrentParam(); |
|
117 |
EditingService activeService = editingContext.getActiveService(); |
|
118 |
|
|
119 |
if ((activeService != null) && (currentParam != null)) { |
|
120 |
|
|
121 |
if (SwingUtilities.isLeftMouseButton(e)) { |
|
122 |
|
|
123 |
Set<TYPE> typesOfParam = currentParam.getTypes(); |
|
124 |
|
|
125 |
if (typesOfParam.contains(TYPE.LIST_POSITIONS)) { |
|
126 |
if (e.getClickCount() == 2) { |
|
127 |
editingContext.finishService(); |
|
128 |
return; |
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
Point point = null; |
|
133 |
Point2D point2D = getMapControl().getMapAdjustedPoint(); |
|
134 |
if (point2D == null) { |
|
135 |
point2D = getMapControl().getAdjustedPoint(); |
|
136 |
point = vp.convertToMapPoint(point2D); |
|
137 |
} else { |
|
138 |
try { |
|
139 |
point = |
|
140 |
GeometryLocator.getGeometryManager().createPoint( |
|
141 |
point2D.getX(), point2D.getY(), |
|
142 |
Geometry.SUBTYPES.GEOM2D); |
|
143 |
} catch (BaseException ex) { |
|
144 |
logger.warn("Can't create point geometry from " |
|
145 |
+ point2D.toString()); |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
try { |
|
150 |
editingContext.getActiveService().setValue(point); |
|
151 |
} catch (VectorEditingException ex) { |
|
152 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
153 |
editingContext.showConsoleMessage(i18nManager |
|
154 |
.getTranslation("invalid_option")); |
|
155 |
} |
|
156 |
|
|
157 |
editingContext.getNextParameter(); |
|
158 |
|
|
159 |
} else if (SwingUtilities.isRightMouseButton(e)) { |
|
160 |
|
|
161 |
EditingSwingManager swingManager = |
|
162 |
EditingSwingLocator.getSwingManager(); |
|
163 |
|
|
164 |
EditingContextMenu contextMenu = |
|
165 |
swingManager.getContextualMenu(getMapControl(), |
|
166 |
new AcceptValueListener() { |
|
167 |
|
|
168 |
public void acceptValue(Object value) { |
|
169 |
editingContext.textEntered((String) value); |
|
170 |
|
|
171 |
} |
|
172 |
}, currentParam); |
|
173 |
|
|
174 |
contextMenu.show(getMapControl(), e.getX(), e.getY()); |
|
175 |
} |
|
176 |
} |
|
177 |
} |
|
178 |
|
|
179 |
@Override |
|
180 |
public void mouseEntered(MouseEvent e) throws BehaviorException { |
|
181 |
} |
|
182 |
|
|
183 |
@Override |
|
184 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
185 |
ViewPort vp = editingContext.getMapControl().getViewPort(); |
|
186 |
adjustedPoint = vp.convertToMapPoint(e.getX(), e.getY()); |
|
187 |
} |
|
188 |
|
|
189 |
@Override |
|
190 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
|
191 |
} |
|
192 |
|
|
193 |
@Override |
|
194 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
|
195 |
} |
|
196 |
|
|
197 |
@Override |
|
198 |
@SuppressWarnings("rawtypes") |
|
199 |
public void paintComponent(MapControlDrawer mapControlDrawer) { |
|
200 |
super.paintComponent(mapControlDrawer); |
|
201 |
|
|
202 |
if ((editingContext.getActiveService() == null) |
|
203 |
|| (adjustedPoint == null)) { |
|
204 |
return; |
|
205 |
} |
|
206 |
|
|
207 |
DrawingStatus helperGeo = null; |
|
208 |
|
|
209 |
try { |
|
210 |
helperGeo = |
|
211 |
editingContext.getActiveService().getDrawingStatus( |
|
212 |
adjustedPoint); |
|
213 |
} catch (VectorEditingException e) { |
|
214 |
logger.info("An error ocurred when draw service geometries", e); |
|
215 |
} |
|
216 |
|
|
217 |
if (helperGeo != null) { |
|
218 |
for (Iterator iterator = helperGeo.getStatus().iterator(); iterator |
|
219 |
.hasNext();) { |
|
220 |
Status status = (Status) iterator.next(); |
|
221 |
ISymbol symbol = status.getSymbol(); |
|
222 |
if (symbol == null) { |
|
223 |
symbol = |
|
224 |
MapControlLocator.getMapControlManager() |
|
225 |
.getAxisReferenceSymbol(); |
|
226 |
} |
|
227 |
if (symbol instanceof ITextSymbol) { |
|
228 |
((ITextSymbol) symbol).setText(status.getText()); |
|
229 |
} |
|
230 |
editingContext.getMapControl().getMapControlDrawer() |
|
231 |
.draw(status.getGeometry(), symbol); |
|
232 |
} |
|
233 |
} |
|
234 |
} |
|
235 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/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 |
|
|
25 |
package org.gvsig.vectorediting.swing.impl; |
|
26 |
|
|
27 |
import java.awt.Image; |
|
28 |
import java.awt.event.MouseEvent; |
|
29 |
import java.awt.event.MouseWheelEvent; |
|
30 |
|
|
31 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
32 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
|
33 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
34 |
import org.gvsig.fmap.mapcontrol.tools.CompoundBehavior; |
|
35 |
import org.gvsig.fmap.mapcontrol.tools.PointSelectionListener; |
|
36 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
|
37 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.IBehavior; |
|
38 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior; |
|
39 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior; |
|
40 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener; |
|
41 |
|
|
42 |
public class EditingCompoundBehavior extends CompoundBehavior { |
|
43 |
|
|
44 |
private enum Mode { |
|
45 |
EDITING, SELECTION |
|
46 |
}; |
|
47 |
|
|
48 |
private Mode mode = Mode.EDITING; |
|
49 |
private IBehavior editing; |
|
50 |
private IBehavior selection; |
|
51 |
|
|
52 |
public final static int EDITING_INDEX = 0; |
|
53 |
public final static int SELECTION_INDEX = 1; |
|
54 |
|
|
55 |
public EditingCompoundBehavior(IBehavior editing) { |
|
56 |
super(new Behavior[0]); |
|
57 |
this.editing = editing; |
|
58 |
|
|
59 |
this.selection = null; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public void addMapBehavior(Behavior mt, boolean draw) { |
|
64 |
if (mt instanceof MouseWheelBehavior) { |
|
65 |
return; |
|
66 |
} |
|
67 |
throw new UnsupportedOperationException(); |
|
68 |
} |
|
69 |
|
|
70 |
@Override |
|
71 |
public void removeMapBehavior(Behavior mt) { |
|
72 |
throw new UnsupportedOperationException(); |
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public boolean containsBehavior(Behavior mt) { |
|
77 |
return ((mt == this.editing) || (mt == this.selection)); |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public Behavior getBehavior(int index) { |
|
82 |
switch (index) { |
|
83 |
case EDITING_INDEX: |
|
84 |
return (Behavior) this.editing; |
|
85 |
case SELECTION_INDEX: |
|
86 |
return (Behavior) this.selection; |
|
87 |
default: |
|
88 |
throw new IndexOutOfBoundsException(); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public boolean isDrawnBehavior(int index) { |
|
94 |
switch (mode) { |
|
95 |
case EDITING: |
|
96 |
return index == EDITING_INDEX; |
|
97 |
case SELECTION: |
|
98 |
return index == SELECTION_INDEX; |
|
99 |
default: |
|
100 |
return false; |
|
101 |
} |
|
102 |
} |
|
103 |
|
|
104 |
@Override |
|
105 |
public void setDrawnBehavior(int index, boolean draw) { |
|
106 |
switch (index) { |
|
107 |
case EDITING_INDEX: |
|
108 |
if (draw) { |
|
109 |
mode = Mode.EDITING; |
|
110 |
} else { |
|
111 |
mode = Mode.SELECTION; |
|
112 |
} |
|
113 |
break; |
|
114 |
case SELECTION_INDEX: |
|
115 |
if (draw) { |
|
116 |
mode = Mode.SELECTION; |
|
117 |
} else { |
|
118 |
mode = Mode.EDITING; |
|
119 |
} |
|
120 |
break; |
|
121 |
default: |
|
122 |
throw new IndexOutOfBoundsException(); |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
@Override |
|
127 |
public int size() { |
|
128 |
return 2; |
|
129 |
} |
|
130 |
|
|
131 |
@Override |
|
132 |
public Image getImageCursor() { |
|
133 |
switch (mode) { |
|
134 |
default: |
|
135 |
case EDITING: |
|
136 |
return this.editing.getImageCursor(); |
|
137 |
case SELECTION: |
|
138 |
return this.selection.getImageCursor(); |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
142 |
@Override |
|
143 |
public void mouseClicked(MouseEvent e) throws BehaviorException { |
|
144 |
switch (mode) { |
|
145 |
default: |
|
146 |
case EDITING: |
|
147 |
this.editing.mouseClicked(e); |
|
148 |
break; |
|
149 |
case SELECTION: |
|
150 |
this.selection.mouseClicked(e); |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
@Override |
|
155 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
|
156 |
switch (mode) { |
|
157 |
default: |
|
158 |
case EDITING: |
|
159 |
this.editing.mouseDragged(e); |
|
160 |
break; |
|
161 |
case SELECTION: |
|
162 |
this.selection.mouseDragged(e); |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
@Override |
|
167 |
public void mouseEntered(MouseEvent e) throws BehaviorException { |
|
168 |
switch (mode) { |
|
169 |
default: |
|
170 |
case EDITING: |
|
171 |
this.editing.mouseEntered(e); |
|
172 |
break; |
|
173 |
case SELECTION: |
|
174 |
this.selection.mouseEntered(e); |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
@Override |
|
179 |
public void mouseExited(MouseEvent e) throws BehaviorException { |
|
180 |
switch (mode) { |
|
181 |
default: |
|
182 |
case EDITING: |
|
183 |
this.editing.mouseExited(e); |
|
184 |
break; |
|
185 |
case SELECTION: |
|
186 |
this.selection.mouseExited(e); |
|
187 |
} |
|
188 |
} |
|
189 |
|
|
190 |
@Override |
|
191 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
192 |
switch (mode) { |
|
193 |
default: |
|
194 |
case EDITING: |
|
195 |
this.editing.mouseMoved(e); |
|
196 |
break; |
|
197 |
case SELECTION: |
|
198 |
this.selection.mouseMoved(e); |
|
199 |
} |
|
200 |
} |
|
201 |
|
|
202 |
@Override |
|
203 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
|
204 |
switch (mode) { |
|
205 |
default: |
|
206 |
case EDITING: |
|
207 |
this.editing.mousePressed(e); |
|
208 |
break; |
|
209 |
case SELECTION: |
|
210 |
this.selection.mousePressed(e); |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
@Override |
|
215 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
|
216 |
switch (mode) { |
|
217 |
default: |
|
218 |
case EDITING: |
|
219 |
this.editing.mouseReleased(e); |
|
220 |
break; |
|
221 |
case SELECTION: |
|
222 |
this.selection.mouseReleased(e); |
|
223 |
} |
|
224 |
} |
|
225 |
|
|
226 |
@Override |
|
227 |
public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException { |
|
228 |
switch (mode) { |
|
229 |
default: |
|
230 |
case EDITING: |
|
231 |
this.editing.mouseWheelMoved(e); |
|
232 |
break; |
|
233 |
case SELECTION: |
|
234 |
this.selection.mouseWheelMoved(e); |
|
235 |
} |
|
236 |
} |
|
237 |
|
|
238 |
|
|
239 |
public void paintComponent(MapControlDrawer renderer, boolean clean) { |
|
240 |
if(clean){ |
|
241 |
clean(renderer); |
|
242 |
} |
|
243 |
paintComponent(renderer); |
|
244 |
} |
|
245 |
|
|
246 |
@Override |
|
247 |
public void paintComponent(MapControlDrawer renderer) { |
|
248 |
switch (mode) { |
|
249 |
default: |
|
250 |
case EDITING: |
|
251 |
this.editing.paintComponent(renderer); |
|
252 |
break; |
|
253 |
case SELECTION: |
|
254 |
this.selection.paintComponent(renderer); |
|
255 |
} |
|
256 |
} |
|
257 |
|
|
258 |
@Override |
|
259 |
public void setListener(ToolListener listener) { |
|
260 |
if (listener != null) { |
|
261 |
throw new UnsupportedOperationException( |
|
262 |
"CompoundBehavior does not have listeners"); |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
266 |
@Override |
|
267 |
public ToolListener getListener() { |
|
268 |
return null; |
|
269 |
} |
|
270 |
|
|
271 |
@Override |
|
272 |
public void setMapControl(MapControl mc) { |
|
273 |
this.editing.setMapControl(mc); |
|
274 |
|
|
275 |
if (this.selection == null) { |
|
276 |
if (mc != null) { |
|
277 |
PointSelectionListener psl = new PointSelectionListener(mc); |
|
278 |
this.selection = |
|
279 |
new CompoundBehavior( |
|
280 |
new Behavior[] { new PointBehavior(psl) }); |
|
281 |
this.selection.setMapControl(mc); |
|
282 |
} |
|
283 |
} else { |
|
284 |
this.selection.setMapControl(mc); |
|
285 |
} |
|
286 |
} |
|
287 |
|
|
288 |
} |
org.gvsig.vectorediting/tags/org.gvsig.vectorediting-1.0.97/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/contextmenu/DynamicEditingPointPanelView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/contextmenu/DynamicEditingPointPanelView.xml</at> |
|
28 |
<at name="path">datos/devel/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/contextmenu/DynamicEditingPointPanelView.xml</at> |
|
29 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
|
30 |
<at name="colspecs">FILL:4DLU:NONE,FILL:8DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
|
31 |
<at name="components"> |
|
32 |
<object classname="java.util.LinkedList"> |
|
33 |
<item > |
|
34 |
<at name="value"> |
|
35 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
36 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
37 |
<at name="cellconstraints"> |
|
38 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
39 |
<at name="column">2</at> |
|
40 |
<at name="row">2</at> |
|
41 |
<at name="colspan">4</at> |
|
42 |
<at name="rowspan">1</at> |
|
43 |
<at name="halign">default</at> |
|
44 |
<at name="valign">default</at> |
|
45 |
<at name="insets" object="insets">0,0,0,0</at> |
|
46 |
</object> |
|
47 |
</at> |
|
48 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
49 |
</super> |
|
50 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
51 |
<at name="beanclass">javax.swing.JRadioButton</at> |
|
52 |
<at name="beanproperties"> |
|
53 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
54 |
<at name="classname">javax.swing.JRadioButton</at> |
|
55 |
<at name="properties"> |
|
56 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
57 |
<at name="border"> |
|
58 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
59 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
60 |
<at name="name">border</at> |
|
61 |
</super> |
|
62 |
<at name="borders"> |
|
63 |
<object classname="java.util.LinkedList"> |
|
64 |
<item > |
|
65 |
<at name="value"> |
|
66 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
67 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
68 |
<at name="name">border</at> |
|
69 |
</super> |
|
70 |
</object> |
|
71 |
</at> |
|
72 |
</item> |
|
73 |
</object> |
|
74 |
</at> |
|
75 |
</object> |
|
76 |
</at> |
|
77 |
<at name="actionCommand">_Use_a_point_previously_captured</at> |
|
78 |
<at name="buttonGroup"> |
|
79 |
<object classname="com.jeta.forms.store.properties.ButtonGroupProperty"> |
|
80 |
<at name="name">buttonGroup</at> |
|
81 |
<at name="groupname">1</at> |
|
82 |
</object> |
|
83 |
</at> |
|
84 |
<at name="name">rdbUseAPointPreviouslyCaptured</at> |
|
85 |
<at name="width">713</at> |
|
86 |
<at name="text">_Use_a_point_previously_captured</at> |
|
87 |
<at name="height">16</at> |
|
88 |
</object> |
|
89 |
</at> |
|
90 |
</object> |
|
91 |
</at> |
|
92 |
</object> |
|
93 |
</at> |
|
94 |
</item> |
|
95 |
<item > |
|
96 |
<at name="value"> |
|
97 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
98 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
99 |
<at name="cellconstraints"> |
|
100 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
101 |
<at name="column">3</at> |
|
102 |
<at name="row">4</at> |
|
103 |
<at name="colspan">3</at> |
|
104 |
<at name="rowspan">1</at> |
|
105 |
<at name="halign">default</at> |
|
106 |
<at name="valign">default</at> |
|
107 |
<at name="insets" object="insets">0,0,0,0</at> |
|
108 |
</object> |
|
109 |
</at> |
|
110 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
111 |
</super> |
|
112 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
113 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
114 |
<at name="beanproperties"> |
|
115 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
116 |
<at name="classname">javax.swing.JComboBox</at> |
|
117 |
<at name="properties"> |
|
118 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
119 |
<at name="border"> |
|
120 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
121 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
122 |
<at name="name">border</at> |
|
123 |
</super> |
|
124 |
<at name="borders"> |
|
125 |
<object classname="java.util.LinkedList"> |
|
126 |
<item > |
|
127 |
<at name="value"> |
|
128 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
129 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
130 |
<at name="name">border</at> |
|
131 |
</super> |
|
132 |
</object> |
|
133 |
</at> |
|
134 |
</item> |
|
135 |
</object> |
|
136 |
</at> |
|
137 |
</object> |
|
138 |
</at> |
|
139 |
<at name="name">cboCapturedPoints</at> |
|
140 |
<at name="width">699</at> |
|
141 |
<at name="items"> |
|
142 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
143 |
<at name="name">items</at> |
|
144 |
</object> |
|
145 |
</at> |
|
146 |
<at name="height">20</at> |
|
147 |
</object> |
|
148 |
</at> |
|
149 |
</object> |
|
150 |
</at> |
|
151 |
</object> |
|
152 |
</at> |
|
153 |
</item> |
|
154 |
<item > |
|
155 |
<at name="value"> |
|
156 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
157 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
158 |
<at name="cellconstraints"> |
|
159 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
160 |
<at name="column">2</at> |
|
161 |
<at name="row">6</at> |
|
162 |
<at name="colspan">4</at> |
|
163 |
<at name="rowspan">1</at> |
|
164 |
<at name="halign">default</at> |
|
165 |
<at name="valign">default</at> |
|
166 |
<at name="insets" object="insets">0,0,0,0</at> |
|
167 |
</object> |
|
168 |
</at> |
|
169 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
170 |
</super> |
|
171 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
172 |
<at name="beanclass">javax.swing.JRadioButton</at> |
|
173 |
<at name="beanproperties"> |
|
174 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
175 |
<at name="classname">javax.swing.JRadioButton</at> |
|
176 |
<at name="properties"> |
|
177 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
178 |
<at name="border"> |
|
179 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
180 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
181 |
<at name="name">border</at> |
|
182 |
</super> |
|
183 |
<at name="borders"> |
|
184 |
<object classname="java.util.LinkedList"> |
|
185 |
<item > |
|
186 |
<at name="value"> |
|
187 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
188 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
189 |
<at name="name">border</at> |
|
190 |
</super> |
|
191 |
</object> |
|
192 |
</at> |
|
193 |
</item> |
|
194 |
</object> |
|
195 |
</at> |
|
196 |
</object> |
|
197 |
</at> |
|
198 |
<at name="actionCommand">_Enter_the_coordinates_manually</at> |
|
199 |
<at name="buttonGroup"> |
|
200 |
<object classname="com.jeta.forms.store.properties.ButtonGroupProperty"> |
|
201 |
<at name="name">buttonGroup</at> |
|
202 |
<at name="groupname">1</at> |
|
203 |
</object> |
|
204 |
</at> |
|
205 |
<at name="name">rdbEnterTheCoordinatesManually</at> |
|
206 |
<at name="width">713</at> |
|
207 |
<at name="text">_Enter_the_coordinates_manually</at> |
Also available in: Unified diff