Revision 3907
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/BusquedaCatastralSwingManager.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api; |
|
24 |
|
|
25 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException; |
|
26 |
|
|
27 |
/** |
|
28 |
* This class is responsible of the management of the library's business logic. |
|
29 |
* It is the library's main entry point, and provides all the services to manage |
|
30 |
* {@link WebMapService}s. |
|
31 |
* |
|
32 |
* @see WebMapService |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public interface BusquedaCatastralSwingManager { |
|
37 |
|
|
38 |
BusquedaCatastralConsultaCatastralPanel createConsultaCatastralPanel()throws BusquedaCatastralException; |
|
39 |
} |
|
40 |
|
|
41 |
|
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/BusquedaCatastralConsultaCatastralPanel.java | ||
---|---|---|
1 |
package org.gvsig.busquedacatastral.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionListener; |
|
4 |
|
|
5 |
import org.cresques.cts.IProjection; |
|
6 |
import org.gvsig.busquedacatastral.lib.api.QueryCatastral; |
|
7 |
import org.gvsig.busquedacatastral.lib.api.ReferenciaCatastral; |
|
8 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralObtainingDataException; |
|
9 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralObtainingPointException; |
|
10 |
import org.gvsig.fmap.geom.primitive.Point; |
|
11 |
import org.gvsig.tools.dynobject.DynObject; |
|
12 |
import org.gvsig.tools.swing.api.Component; |
|
13 |
|
|
14 |
|
|
15 |
/** |
|
16 |
* A panel to create a QueryCatastral to consult catastro for data |
|
17 |
* @author dmartinezizquierdo |
|
18 |
* |
|
19 |
*/ |
|
20 |
public interface BusquedaCatastralConsultaCatastralPanel extends Component{ |
|
21 |
enum PanelAction{CANCEL, FOCUSTOPOINT, SHOWDATA, DELETEPOINTS}; |
|
22 |
|
|
23 |
public void deleteCache(); |
|
24 |
|
|
25 |
public Point getPoint(IProjection projection) throws BusquedaCatastralObtainingPointException; |
|
26 |
|
|
27 |
public ReferenciaCatastral getSelectedReferenciaCatastral(); |
|
28 |
|
|
29 |
public DynObject getDatosCatastrales()throws BusquedaCatastralObtainingDataException; |
|
30 |
|
|
31 |
public void setQuery(QueryCatastral query); |
|
32 |
|
|
33 |
public void clear(); |
|
34 |
|
|
35 |
public boolean isSelectedAction(PanelAction action); |
|
36 |
|
|
37 |
public void addActionListener(ActionListener listener); |
|
38 |
|
|
39 |
public void removeActionListener(ActionListener listener); |
|
40 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/exceptions/BusquedaCatastralSwingException.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api.exceptions; |
|
24 |
|
|
25 |
|
|
26 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException; |
|
27 |
import org.gvsig.tools.exception.BaseException; |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* @author gvSIG team. |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class BusquedaCatastralSwingException extends BusquedaCatastralException { |
|
35 |
|
|
36 |
/** |
|
37 |
* |
|
38 |
*/ |
|
39 |
private static final long serialVersionUID = -1043709801185809443L; |
|
40 |
|
|
41 |
private static final String MESSAGE = |
|
42 |
"An error has been produced in the Busqueda Catastral Swing library"; |
|
43 |
|
|
44 |
private static final String KEY = "_WasteException"; |
|
45 |
|
|
46 |
/** |
|
47 |
* Constructor to be used in rare cases, usually you must create a new child |
|
48 |
* exception class for each case. |
|
49 |
* <strong>Don't use this constructor in child classes.</strong> |
|
50 |
*/ |
|
51 |
public BusquedaCatastralSwingException() { |
|
52 |
super(MESSAGE, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* Constructor to be used in rare cases, usually you must create a new child |
|
57 |
* exception class for each case. |
|
58 |
* <p> |
|
59 |
* <strong>Don't use this constructor in child classes.</strong> |
|
60 |
* </p> |
|
61 |
* |
|
62 |
* @param cause |
|
63 |
* the original cause of the exception |
|
64 |
*/ |
|
65 |
public BusquedaCatastralSwingException(Exception cause) { |
|
66 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* @see BaseException#BaseException(String, String, long) |
|
71 |
* @param message |
|
72 |
* the default messageFormat to describe the exception |
|
73 |
* @param key |
|
74 |
* the key to use to search a localized messageFormnata |
|
75 |
* @param code |
|
76 |
* the unique code to identify the exception |
|
77 |
*/ |
|
78 |
protected BusquedaCatastralSwingException(String message, String key, long code) { |
|
79 |
super(message, key, code); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
84 |
* @param message |
|
85 |
* the default messageFormat to describe the exception |
|
86 |
* @param cause |
|
87 |
* the original cause of the exception |
|
88 |
* @param key |
|
89 |
* the key to use to search a localized messageFormnata |
|
90 |
* @param code |
|
91 |
* the unique code to identify the exception |
|
92 |
*/ |
|
93 |
protected BusquedaCatastralSwingException(String message, Throwable cause, |
|
94 |
String key, long code) { |
|
95 |
super(message, cause, key, code); |
|
96 |
} |
|
97 |
|
|
98 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/exceptions/BusquedaCatastralCreatingPanelException.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api.exceptions; |
|
24 |
|
|
25 |
public class BusquedaCatastralCreatingPanelException extends BusquedaCatastralSwingException { |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
private static final long serialVersionUID = 8201868527295813900L; |
|
32 |
|
|
33 |
private static final String MESSAGE = |
|
34 |
"An error has been produced creating panel"; |
|
35 |
|
|
36 |
private static final String KEY = "_BusquedaCatastralCreatingPanelException"; |
|
37 |
|
|
38 |
public BusquedaCatastralCreatingPanelException(Throwable ex) { |
|
39 |
super(MESSAGE, ex, KEY, serialVersionUID); |
|
40 |
} |
|
41 |
|
|
42 |
public BusquedaCatastralCreatingPanelException(String message, Throwable ex) { |
|
43 |
super(message, ex, KEY, serialVersionUID); |
|
44 |
} |
|
45 |
|
|
46 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/exceptions/BusquedaCatastralObtainingDataException.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api.exceptions; |
|
24 |
|
|
25 |
public class BusquedaCatastralObtainingDataException extends BusquedaCatastralSwingException { |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
private static final long serialVersionUID = 8201868527295813900L; |
|
32 |
|
|
33 |
private static final String MESSAGE = |
|
34 |
"An error has been produced obtaining data"; |
|
35 |
|
|
36 |
private static final String KEY = "_BusquedaCatastralObtainingDataException"; |
|
37 |
|
|
38 |
public BusquedaCatastralObtainingDataException(Throwable ex) { |
|
39 |
super(MESSAGE, ex, KEY, serialVersionUID); |
|
40 |
} |
|
41 |
|
|
42 |
public BusquedaCatastralObtainingDataException(String message, Throwable ex) { |
|
43 |
super(message, ex, KEY, serialVersionUID); |
|
44 |
} |
|
45 |
|
|
46 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/exceptions/BusquedaCatastralObtainingPointException.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api.exceptions; |
|
24 |
|
|
25 |
public class BusquedaCatastralObtainingPointException extends BusquedaCatastralSwingException { |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
private static final long serialVersionUID = 8201868527295813900L; |
|
32 |
|
|
33 |
private static final String MESSAGE = |
|
34 |
"An error has been produced obtaining point"; |
|
35 |
|
|
36 |
private static final String KEY = "_BusquedaCatastralObtainingPointException"; |
|
37 |
|
|
38 |
public BusquedaCatastralObtainingPointException(Throwable ex) { |
|
39 |
super(MESSAGE, ex, KEY, serialVersionUID); |
|
40 |
} |
|
41 |
|
|
42 |
public BusquedaCatastralObtainingPointException(String message, Throwable ex) { |
|
43 |
super(message, ex, KEY, serialVersionUID); |
|
44 |
} |
|
45 |
|
|
46 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/BusquedaCatastralSwingLocator.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api; |
|
24 |
|
|
25 |
import org.gvsig.tools.locator.BaseLocator; |
|
26 |
import org.gvsig.tools.locator.Locator; |
|
27 |
import org.gvsig.tools.locator.LocatorException; |
|
28 |
|
|
29 |
/** |
|
30 |
* This locator is the entry point for the BusquedaCatastral Swing library, |
|
31 |
* providing access to all services through the |
|
32 |
* {@link BusquedaCatastralSwingManager} . |
|
33 |
* |
|
34 |
* @author gvSIG team |
|
35 |
* @version $Id$ |
|
36 |
*/ |
|
37 |
public class BusquedaCatastralSwingLocator extends BaseLocator { |
|
38 |
|
|
39 |
private static final String LOCATOR_NAME = "BusquedaCatastral.swinglocator"; |
|
40 |
|
|
41 |
/** |
|
42 |
* WebMap manager name. |
|
43 |
*/ |
|
44 |
public static final String MANAGER_NAME = "BusquedaCatastral.swingmanager"; |
|
45 |
|
|
46 |
/** |
|
47 |
* WebMap manager description. |
|
48 |
*/ |
|
49 |
public static final String MANAGER_DESCRIPTION = "Busqueda Catastral Swing Manager"; |
|
50 |
|
|
51 |
|
|
52 |
/** |
|
53 |
* Unique instance. |
|
54 |
*/ |
|
55 |
private static final BusquedaCatastralSwingLocator INSTANCE = |
|
56 |
new BusquedaCatastralSwingLocator(); |
|
57 |
|
|
58 |
/** |
|
59 |
* Return the singleton instance. |
|
60 |
* |
|
61 |
* @return the singleton instance |
|
62 |
*/ |
|
63 |
public static BusquedaCatastralSwingLocator getInstance() { |
|
64 |
return INSTANCE; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Return the Locator's name. |
|
69 |
* |
|
70 |
* @return a String with the Locator's name |
|
71 |
*/ |
|
72 |
public final String getLocatorName() { |
|
73 |
return LOCATOR_NAME; |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Return a reference to the Manager. |
|
78 |
* |
|
79 |
* @return a reference to the Manager |
|
80 |
* @throws LocatorException |
|
81 |
* if there is no access to the class or the class cannot be |
|
82 |
* instantiated |
|
83 |
* @see Locator#get(String) |
|
84 |
*/ |
|
85 |
public static BusquedaCatastralSwingManager getManager() throws LocatorException { |
|
86 |
return (BusquedaCatastralSwingManager) getInstance().get(MANAGER_NAME); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Registers the Class implementing the WebMapManager interface. |
|
91 |
* |
|
92 |
* @param clazz |
|
93 |
* implementing the WebMapManager interface |
|
94 |
*/ |
|
95 |
public static void registerManager( |
|
96 |
Class<? extends BusquedaCatastralSwingManager> clazz) { |
|
97 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
98 |
} |
|
99 |
|
|
100 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/java/org/gvsig/busquedacatastral/swing/api/BusquedaCatastralSwingLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2016 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.busquedacatastral.swing.api; |
|
24 |
|
|
25 |
import org.gvsig.tools.library.AbstractLibrary; |
|
26 |
import org.gvsig.tools.library.LibraryException; |
|
27 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
28 |
|
|
29 |
/** |
|
30 |
* Library for swing components for busqueda catastral |
|
31 |
* |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class BusquedaCatastralSwingLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsAPI(BusquedaCatastralSwingLibrary.class); |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
protected void doInitialize() throws LibraryException { |
|
44 |
// Do nothing |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void doPostInitialize() throws LibraryException { |
|
49 |
// Validate there is any implementation registered. |
|
50 |
BusquedaCatastralSwingManager manager = BusquedaCatastralSwingLocator.getManager(); |
|
51 |
if (manager == null) { |
|
52 |
throw new ReferenceNotRegisteredException( |
|
53 |
BusquedaCatastralSwingLocator.MANAGER_NAME, BusquedaCatastralSwingLocator.getInstance()); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.busquedacatastral.swing.api.BusquedaCatastralSwingLibrary |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.api/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.busquedacatastral.swing</artifactId> |
|
6 |
<version>1.0.82</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.busquedacatastral.swing.api</artifactId> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
|
|
11 |
<build> |
|
12 |
<plugins> |
|
13 |
<plugin> |
|
14 |
<groupId>org.apache.maven.plugins</groupId> |
|
15 |
<artifactId>maven-jar-plugin</artifactId> |
|
16 |
<configuration> |
|
17 |
</configuration> |
|
18 |
<executions> |
|
19 |
<!-- Generates a jar file only with the test classes --> |
|
20 |
<execution> |
|
21 |
<goals> |
|
22 |
<goal>test-jar</goal> |
|
23 |
</goals> |
|
24 |
</execution> |
|
25 |
</executions> |
|
26 |
</plugin> |
|
27 |
</plugins> |
|
28 |
</build> |
|
29 |
|
|
30 |
<dependencies> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.busquedacatastral.lib.api</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
44 |
<scope>compile</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.gvsig</groupId> |
|
48 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
49 |
<scope>compile</scope> |
|
50 |
</dependency> |
|
51 |
</dependencies> |
|
52 |
</project> |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.busquedacatastral</artifactId> |
|
6 |
<version>1.0.82</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.busquedacatastral.swing</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>org.gvsig.busquedacatastral.swing</name> |
|
11 |
<modules> |
|
12 |
<module>org.gvsig.busquedacatastral.swing.api</module> |
|
13 |
<module>org.gvsig.busquedacatastral.swing.impl</module> |
|
14 |
</modules> |
|
15 |
</project> |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/DynObjectCellRenderer.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2015 DiSiD Technologies S.L.L. All rights reserved. |
|
3 |
* |
|
4 |
* Project : DiSiD org.gvsig.lrs.swing.impl |
|
5 |
* SVN Id : $Id$ |
|
6 |
*/ |
|
7 |
package org.gvsig.busquedacatastral.swing.impl; |
|
8 |
|
|
9 |
import java.awt.Component; |
|
10 |
|
|
11 |
import javax.swing.DefaultListCellRenderer; |
|
12 |
import javax.swing.JLabel; |
|
13 |
import javax.swing.JList; |
|
14 |
import javax.swing.ListCellRenderer; |
|
15 |
|
|
16 |
import org.apache.commons.lang3.StringUtils; |
|
17 |
import org.gvsig.tools.dynobject.DynObject; |
|
18 |
import org.slf4j.Logger; |
|
19 |
import org.slf4j.LoggerFactory; |
|
20 |
|
|
21 |
public class DynObjectCellRenderer implements ListCellRenderer<DynObject>{ |
|
22 |
|
|
23 |
private String renderedField; |
|
24 |
private String[] renderedFields; |
|
25 |
private String separator; |
|
26 |
|
|
27 |
/** |
|
28 |
* Default Constructor |
|
29 |
* @param renderedField indicates which field from the DynObject must be rendered |
|
30 |
*/ |
|
31 |
public DynObjectCellRenderer(String renderedField){ |
|
32 |
this.renderedField=renderedField; |
|
33 |
} |
|
34 |
|
|
35 |
public DynObjectCellRenderer(String[] renderedFields, String separator){ |
|
36 |
this.renderedFields=renderedFields; |
|
37 |
this.separator=separator; |
|
38 |
} |
|
39 |
|
|
40 |
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer(); |
|
41 |
private static final Logger logger = LoggerFactory.getLogger(DynObjectCellRenderer.class); |
|
42 |
|
|
43 |
@Override |
|
44 |
public Component getListCellRendererComponent( |
|
45 |
JList<? extends DynObject> list, DynObject value, int index, |
|
46 |
boolean isSelected, boolean cellHasFocus) { |
|
47 |
|
|
48 |
JLabel renderer = |
|
49 |
(JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
50 |
|
|
51 |
if (value!=null){ |
|
52 |
String text=getText(value); |
|
53 |
renderer.setText(text); |
|
54 |
}else{ |
|
55 |
renderer.setText(""); |
|
56 |
} |
|
57 |
|
|
58 |
return renderer; |
|
59 |
} |
|
60 |
|
|
61 |
private String getText(DynObject dynObject){ |
|
62 |
String text=""; |
|
63 |
if (StringUtils.isNotEmpty(renderedField)){ |
|
64 |
text=(String)dynObject.getDynValue(renderedField); |
|
65 |
}else if (renderedFields!=null){ |
|
66 |
for(String fieldName:renderedFields){ |
|
67 |
if (StringUtils.isNotEmpty(text)){ |
|
68 |
text+=separator; |
|
69 |
} |
|
70 |
text+=(String)dynObject.getDynValue(fieldName); |
|
71 |
} |
|
72 |
} |
|
73 |
return text; |
|
74 |
|
|
75 |
} |
|
76 |
|
|
77 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.82/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/DefaultBusquedaCatastralConsultaCatastralPanelController.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2015 DiSiD Technologies S.L.L. All rights reserved. |
|
3 |
* |
|
4 |
* Project : DiSiD org.gvsig.lrs.swing.impl |
|
5 |
* SVN Id : $Id$ |
|
6 |
*/ |
|
7 |
package org.gvsig.busquedacatastral.swing.impl; |
|
8 |
|
|
9 |
import java.awt.Dimension; |
|
10 |
import java.awt.event.ActionEvent; |
|
11 |
import java.awt.event.ActionListener; |
|
12 |
import java.awt.event.ItemEvent; |
|
13 |
import java.awt.event.ItemListener; |
|
14 |
import java.awt.event.KeyEvent; |
|
15 |
import java.awt.event.KeyListener; |
|
16 |
import java.io.IOException; |
|
17 |
import java.util.List; |
|
18 |
import java.util.Locale; |
|
19 |
|
|
20 |
import javax.swing.ComboBoxModel; |
|
21 |
import javax.swing.DefaultComboBoxModel; |
|
22 |
import javax.swing.DefaultListCellRenderer; |
|
23 |
import javax.swing.DefaultListModel; |
|
24 |
import javax.swing.JComponent; |
|
25 |
import javax.swing.JList; |
|
26 |
import javax.swing.JOptionPane; |
|
27 |
import javax.swing.ListCellRenderer; |
|
28 |
import javax.swing.ListSelectionModel; |
|
29 |
import javax.swing.Timer; |
|
30 |
import javax.swing.event.ListSelectionEvent; |
|
31 |
import javax.swing.event.ListSelectionListener; |
|
32 |
|
|
33 |
import org.apache.commons.lang3.StringUtils; |
|
34 |
import org.cresques.cts.ICoordTrans; |
|
35 |
import org.cresques.cts.IProjection; |
|
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
|
38 |
|
|
39 |
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralLocator; |
|
40 |
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager; |
|
41 |
import org.gvsig.busquedacatastral.lib.api.QueryCatastral; |
|
42 |
import org.gvsig.busquedacatastral.lib.api.QueryCatastral.TipoQuery; |
|
43 |
import org.gvsig.busquedacatastral.lib.api.ReferenciaCatastral; |
|
44 |
import org.gvsig.busquedacatastral.lib.api.SRSCatastro; |
|
45 |
import org.gvsig.busquedacatastral.lib.api.TipoVia; |
|
46 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException; |
|
47 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralInvalidQueryException; |
|
48 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralInvalidSRSException; |
|
49 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException; |
|
50 |
import org.gvsig.busquedacatastral.swing.api.BusquedaCatastralConsultaCatastralPanel; |
|
51 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralCreatingPanelException; |
|
52 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralObtainingDataException; |
|
53 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralObtainingPointException; |
|
54 |
import org.gvsig.fmap.crs.CRSFactory; |
|
55 |
import org.gvsig.fmap.geom.primitive.Point; |
|
56 |
import org.gvsig.tools.ToolsLocator; |
|
57 |
import org.gvsig.tools.dynobject.DynObject; |
|
58 |
import org.gvsig.tools.exception.BaseException; |
|
59 |
import org.gvsig.tools.i18n.I18nManager; |
|
60 |
import org.gvsig.tools.locator.LocatorException; |
|
61 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
62 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
63 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
64 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
65 |
|
|
66 |
public class DefaultBusquedaCatastralConsultaCatastralPanelController extends DefaultBusquedaCatastralConsultaCatastralPanelView implements BusquedaCatastralConsultaCatastralPanel{ |
|
67 |
|
|
68 |
/** |
|
69 |
* |
|
70 |
*/ |
|
71 |
private static final long serialVersionUID = -9145489136943076981L; |
|
72 |
|
|
73 |
private static final Logger logger = LoggerFactory.getLogger(DefaultBusquedaCatastralConsultaCatastralPanelController.class); |
|
74 |
|
|
75 |
private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
76 |
|
|
77 |
private QueryCatastral queryCatastral; |
|
78 |
|
|
79 |
private PanelAction selectedPanelAction; |
|
80 |
|
|
81 |
private List<ReferenciaCatastral> referenciasCatastrales; |
|
82 |
|
|
83 |
private ReferenciaCatastral selectedReferenciaCatastral; |
|
84 |
|
|
85 |
public DefaultBusquedaCatastralConsultaCatastralPanelController() throws BusquedaCatastralException{ |
|
86 |
super(); |
|
87 |
try { |
|
88 |
initComponents(); |
|
89 |
} catch (BusquedaCatastralRemoteServiceException e) { |
|
90 |
throw e; |
|
91 |
} catch (Exception e) { |
|
92 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
93 |
throw new BusquedaCatastralCreatingPanelException(i18nManager.getTranslation("_error_creando_panel_busqueda_catastral"),e); |
|
94 |
} |
|
95 |
translate(); |
|
96 |
} |
|
97 |
|
|
98 |
public void addActionListener(ActionListener listener) { |
|
99 |
listeners.addActionListener(listener); |
|
100 |
} |
|
101 |
|
|
102 |
public void removeActionListener(ActionListener listener) { |
|
103 |
listeners.removeActionListener(listener); |
|
104 |
} |
|
105 |
|
|
106 |
private void translate() { |
|
107 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
108 |
|
|
109 |
lblReferenciaCatastral.setText(i18nManager.getTranslation(lblReferenciaCatastral.getText())); |
|
110 |
lblLocalizacion.setText(i18nManager.getTranslation(lblLocalizacion.getText())); |
|
111 |
lblProvincia.setText(i18nManager.getTranslation(lblProvincia.getText())); |
|
112 |
lblMunicipio.setText(i18nManager.getTranslation(lblMunicipio.getText())); |
|
113 |
btnMunicipios.setText(i18nManager.getTranslation(btnMunicipios.getText())); |
|
114 |
lblUrbanos.setText(i18nManager.getTranslation(lblUrbanos.getText())); |
|
115 |
lblVia.setText(i18nManager.getTranslation(lblVia.getText())); |
|
116 |
btnVias.setText(i18nManager.getTranslation(btnVias.getText())); |
|
117 |
lblNumero.setText(i18nManager.getTranslation(lblNumero.getText())); |
|
118 |
btnNumeros.setText(i18nManager.getTranslation(btnNumeros.getText())); |
|
119 |
lblBloque.setText(i18nManager.getTranslation(lblBloque.getText())); |
|
120 |
lblEscalera.setText(i18nManager.getTranslation(lblEscalera.getText())); |
|
121 |
lblPlanta.setText(i18nManager.getTranslation(lblPlanta.getText())); |
|
122 |
lblPuerta.setText(i18nManager.getTranslation(lblPuerta.getText())); |
|
123 |
lblRusticos.setText(i18nManager.getTranslation(lblRusticos.getText())); |
|
124 |
lblPoligono.setText(i18nManager.getTranslation(lblPoligono.getText())); |
|
125 |
lblParcela.setText(i18nManager.getTranslation(lblParcela.getText())); |
|
126 |
btnBorrarCache.setText(i18nManager.getTranslation(btnBorrarCache.getText())); |
|
127 |
btnBuscar.setText(i18nManager.getTranslation(btnBuscar.getText())); |
|
128 |
btnVerDatos.setText(i18nManager.getTranslation(btnVerDatos.getText())); |
|
129 |
btnLocalizar.setText(i18nManager.getTranslation(btnLocalizar.getText())); |
|
130 |
btnCancelar.setText(i18nManager.getTranslation(btnCancelar.getText())); |
|
131 |
btnBorrarPuntos.setText(i18nManager.getTranslation(btnBorrarPuntos.getText())); |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* |
|
136 |
*/ |
|
137 |
public void setLocate(Locale locale) { |
|
138 |
Locale l = super.getLocale(); |
|
139 |
if (!l.equals(locale)) { |
|
140 |
translate(); |
|
141 |
} |
|
142 |
super.setLocale(locale); |
|
143 |
} |
|
144 |
|
|
145 |
|
|
146 |
private void initComponents() throws BusquedaCatastralException{ |
|
147 |
final BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
148 |
this.queryCatastral=busquedaCatastralManager.createQuery(); |
|
149 |
//Adds a control listener to call enable controls when a rdbtn or txt is modified. |
|
150 |
addEnableControlsListeners(); |
|
151 |
|
|
152 |
// Modelos del combo de provincias |
|
153 |
List<DynObject> provincias = busquedaCatastralManager.getProvincias(); |
|
154 |
String[] fieldNames = new String[]{BusquedaCatastralManager.CAMPO_PROVINCIA_ETIQUETA, BusquedaCatastralManager.CAMPO_PROVINCIA_CODIGO}; |
|
155 |
ComboBoxModel<DynObject> provinciasModel= new DynObjectComboBoxModel(provincias,fieldNames); |
|
156 |
|
|
157 |
// Renderer para combo de provincias |
|
158 |
ListCellRenderer<DynObject> provinciasCellRenderer = new DynObjectCellRenderer(BusquedaCatastralManager.CAMPO_PROVINCIA_ETIQUETA); |
|
159 |
// asignaci?n de renderers y modelos |
|
160 |
cmbProvincia.setRenderer(provinciasCellRenderer); |
|
161 |
cmbProvincia.setModel(provinciasModel); |
|
162 |
|
|
163 |
// listener del combo de provincias |
|
164 |
cmbProvincia.addItemListener(new ItemListener() { |
|
165 |
|
|
166 |
public void itemStateChanged(ItemEvent e) { |
|
167 |
Object item = e.getItem(); |
|
168 |
if (item instanceof DynObject) { |
|
169 |
DynObject provincia = (DynObject) item; |
|
170 |
updateProvincia(provincia); |
|
171 |
enableControls(); |
|
172 |
} |
|
173 |
} |
|
174 |
}); |
|
175 |
|
|
176 |
//ComboBox tipo Via |
|
177 |
ComboBoxModel<TipoVia> tiposViasModel = |
|
178 |
new DefaultComboBoxModel<TipoVia>(TipoVia.values()); |
|
179 |
cmbTipoVia.setModel(tiposViasModel); |
|
180 |
cmbTipoVia.setRenderer(new TipoViaCellRenderer()); |
|
181 |
cmbTipoVia.addItemListener(new ItemListener() { |
|
182 |
|
|
183 |
public void itemStateChanged(ItemEvent e) { |
|
184 |
Object item = e.getItem(); |
|
185 |
if (item instanceof TipoVia) { |
|
186 |
TipoVia tipoVia = (TipoVia) item; |
|
187 |
updateTipoVia(tipoVia); |
|
188 |
enableControls(); |
|
189 |
} |
|
190 |
} |
|
191 |
}); |
|
192 |
|
|
193 |
//Button Listeners |
|
194 |
this.btnBorrarCache.addActionListener(new ActionListener() { |
|
195 |
public void actionPerformed(ActionEvent e) { |
|
196 |
deleteCache(); |
|
197 |
} |
|
198 |
}); |
|
199 |
|
|
200 |
this.btnBuscar.addActionListener(new ActionListener() { |
|
201 |
public void actionPerformed(ActionEvent e) { |
|
202 |
buscarReferenciasCatastrales(); |
|
203 |
} |
|
204 |
}); |
|
205 |
|
|
206 |
this.btnLocalizar.addActionListener(new ActionListener() { |
|
207 |
public void actionPerformed(ActionEvent e) { |
|
208 |
selectedPanelAction=PanelAction.FOCUSTOPOINT; |
|
209 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "accept")); |
|
210 |
} |
|
211 |
}); |
|
212 |
|
|
213 |
this.btnBorrarPuntos.addActionListener(new ActionListener() { |
|
214 |
public void actionPerformed(ActionEvent e) { |
|
215 |
selectedPanelAction=PanelAction.DELETEPOINTS; |
|
216 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "accept")); |
|
217 |
} |
|
218 |
}); |
|
219 |
|
|
220 |
//this is not implemented yet |
|
221 |
this.btnVerDatos.setVisible(false); |
|
222 |
this.btnVerDatos.addActionListener(new ActionListener() { |
|
223 |
public void actionPerformed(ActionEvent e) { |
|
224 |
selectedPanelAction=PanelAction.SHOWDATA; |
|
225 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "accept")); |
|
226 |
} |
|
227 |
}); |
|
228 |
|
|
229 |
this.btnCancelar.addActionListener(new ActionListener() { |
|
230 |
public void actionPerformed(ActionEvent e) { |
|
231 |
selectedPanelAction=PanelAction.CANCEL; |
|
232 |
doClose(); |
|
233 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "cancel")); |
|
234 |
} |
|
235 |
}); |
|
236 |
|
|
237 |
listReferenciasCatastrales.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|
238 |
listReferenciasCatastrales.setModel(new ReferenciaCatastralListModel(referenciasCatastrales)); |
|
239 |
listReferenciasCatastrales.setCellRenderer(new ReferenciaCatastralCellRenderer()); |
|
240 |
listReferenciasCatastrales.addListSelectionListener(new ListSelectionListener() { |
|
241 |
@Override |
|
242 |
public void valueChanged(ListSelectionEvent e) { |
|
243 |
if (e.getSource() instanceof JList){ |
|
244 |
selectedReferenciaCatastral=(ReferenciaCatastral)listReferenciasCatastrales.getSelectedValue(); |
|
245 |
enableControls(); |
|
246 |
} |
|
247 |
} |
|
248 |
}); |
|
249 |
|
|
250 |
addBusquedasButtonListeners(); |
|
251 |
clear(); |
|
252 |
enableControls(); |
|
253 |
} |
|
254 |
|
|
255 |
private void enableControls(){ |
|
256 |
boolean referenciaCatastral=rbtnReferenciaCatastral.isSelected(); |
|
257 |
|
|
258 |
boolean provincia=rbtnLocalizacion.isSelected(); |
|
259 |
boolean municipios=provincia && cmbProvincia.getSelectedItem()!=null; |
|
260 |
boolean urbanos=rbtnLocalizacion.isSelected(); |
|
261 |
boolean rusticos=rbtnLocalizacion.isSelected(); |
|
262 |
|
|
263 |
boolean tipoVia=urbanos && rbtnUrbanos.isSelected() && municipios&&StringUtils.isNotEmpty(txtMunicipio.getText()); |
|
264 |
boolean vias=urbanos && rbtnUrbanos.isSelected()&&municipios&&StringUtils.isNotEmpty(txtMunicipio.getText()); |
|
265 |
boolean numeros=vias && StringUtils.isNotEmpty(txtVia.getText()); |
|
266 |
boolean opcionales=numeros && StringUtils.isNotEmpty(txtNumero.getText()); |
|
267 |
boolean poligono=rusticos && rbtnRusticos.isSelected() && municipios && StringUtils.isNotEmpty(txtMunicipio.getText()); |
|
268 |
|
|
269 |
txtReferenciaCatastral.setEnabled(referenciaCatastral); |
|
270 |
cmbProvincia.setEnabled(provincia); |
|
271 |
txtMunicipio.setEnabled(false); |
|
272 |
btnMunicipios.setEnabled(municipios); |
|
273 |
rbtnRusticos.setEnabled(rusticos); |
|
274 |
rbtnUrbanos.setEnabled(urbanos); |
|
275 |
cmbTipoVia.setEnabled(tipoVia); |
|
276 |
txtVia.setEnabled(false); |
|
277 |
btnVias.setEnabled(vias); |
|
278 |
txtNumero.setEnabled(numeros); |
|
279 |
btnNumeros.setEnabled(numeros); |
|
280 |
txtBloque.setEnabled(opcionales); |
|
281 |
txtEscalera.setEnabled(opcionales); |
|
282 |
txtPlanta.setEnabled(opcionales); |
|
283 |
txtPuerta.setEnabled(opcionales); |
|
284 |
txtPoligono.setEnabled(poligono); |
|
285 |
txtParcela.setEnabled(poligono); |
|
286 |
|
|
287 |
boolean buscar=( |
|
288 |
( referenciaCatastral && StringUtils.isNotEmpty(txtReferenciaCatastral.getText()) ) || |
|
289 |
( opcionales ) || |
|
290 |
( poligono && StringUtils.isNotEmpty(txtPoligono.getText()) && StringUtils.isNotEmpty(txtParcela.getText())) |
|
291 |
); |
|
292 |
btnBuscar.setEnabled(buscar); |
|
293 |
|
|
294 |
boolean rcSeleccionada=selectedReferenciaCatastral!=null; |
|
295 |
btnLocalizar.setEnabled(rcSeleccionada); |
|
296 |
btnVerDatos.setEnabled(rcSeleccionada); |
|
297 |
} |
|
298 |
|
|
299 |
private void doClose() { |
|
300 |
this.setVisible(false); |
|
301 |
} |
|
302 |
|
|
303 |
|
|
304 |
public JComponent asJComponent() { |
|
305 |
return this; |
|
306 |
} |
|
307 |
|
|
308 |
private boolean isValidQuery(QueryCatastral query){ |
|
309 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
310 |
try { |
|
311 |
queryCatastral.validateQuery(); |
|
312 |
} catch (BusquedaCatastralInvalidQueryException e) { |
|
313 |
logger.error("Error invalid query", e); |
|
314 |
JOptionPane.showMessageDialog( |
|
315 |
null, |
|
316 |
new StringBuilder().append(i18nManager.getTranslation("_error_invalid_query")) |
|
317 |
.append(":").append(e.getLocalizedMessage()), |
|
318 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
319 |
return false; |
|
320 |
} |
|
321 |
return true; |
|
322 |
} |
|
323 |
|
|
324 |
private void buscarReferenciasCatastrales(){ |
|
325 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
326 |
getDatosFormulario(); |
|
327 |
if (isValidQuery(queryCatastral)){ |
|
328 |
final SimpleTaskStatus taskStatus = |
|
329 |
ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus(i18nManager.getTranslation("progress")); |
|
330 |
Thread task = new Thread(new Runnable() { |
|
331 |
@Override |
|
332 |
public void run() { |
|
333 |
try { |
|
334 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
335 |
referenciasCatastrales = busquedaCatastralManager.getReferenciasCatastrales(queryCatastral); |
|
336 |
listReferenciasCatastrales.setCellRenderer(new ReferenciaCatastralCellRenderer()); |
|
337 |
listReferenciasCatastrales.setModel(new ReferenciaCatastralListModel((List<ReferenciaCatastral>)referenciasCatastrales)); |
|
338 |
taskStatus.terminate(); |
|
339 |
|
|
340 |
} catch (BusquedaCatastralException e) { |
|
341 |
taskStatus.abort(); |
|
342 |
logger.error("Error referencias catastrales", e); |
|
343 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
344 |
JOptionPane.showMessageDialog( |
|
345 |
null, |
|
346 |
new StringBuilder().append(i18nManager.getTranslation("_error_obtaining_data")) |
|
347 |
.append(":").append(e.getLocalizedMessage()), |
|
348 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
349 |
} |
|
350 |
} |
|
351 |
}); |
|
352 |
task.start(); |
|
353 |
|
|
354 |
final StringBuilder loadingDataStrBuilder=new StringBuilder(); |
|
355 |
loadingDataStrBuilder.append(i18nManager.getTranslation("_loading_data")); |
|
356 |
listReferenciasCatastrales.setCellRenderer(new DefaultListCellRenderer()); |
|
357 |
int delay = 1000; //milliseconds |
|
358 |
ActionListener taskPerformer = new ActionListener() { |
|
359 |
public void actionPerformed(ActionEvent evt) { |
|
360 |
if(taskStatus.isRunning()){ |
|
361 |
loadingDataStrBuilder.append("."); |
|
362 |
DefaultListModel<String> model=new DefaultListModel<String>(); |
|
363 |
model.addElement(loadingDataStrBuilder.toString()); |
|
364 |
listReferenciasCatastrales.setModel(model); |
|
365 |
} |
|
366 |
} |
|
367 |
}; |
|
368 |
new Timer(delay, taskPerformer).start(); |
|
369 |
|
|
370 |
} |
|
371 |
|
|
372 |
} |
|
373 |
|
|
374 |
private void getDatosFormulario(){ |
|
375 |
if (rbtnReferenciaCatastral.isSelected()){ |
|
376 |
if (queryCatastral.getTipoQuery()==null){ |
|
377 |
queryCatastral.setTipoQuery(TipoQuery.POR_RC); |
|
378 |
} |
|
379 |
} |
|
380 |
if (rbtnLocalizacion.isSelected()){ |
|
381 |
if (queryCatastral.getTipoQuery()==null){ |
|
382 |
queryCatastral.setTipoQuery(TipoQuery.POR_LOCALIZACION); |
|
383 |
} |
|
384 |
} |
|
385 |
|
|
386 |
queryCatastral.setNumero(txtNumero.getText()); |
|
387 |
queryCatastral.setReferenciaCatastral(txtReferenciaCatastral.getText()); |
|
388 |
queryCatastral.setBloque(txtBloque.getText()); |
|
389 |
queryCatastral.setEscalera(txtEscalera.getText()); |
|
390 |
queryCatastral.setPlanta(txtPlanta.getText()); |
|
391 |
queryCatastral.setPuerta(txtPuerta.getText()); |
|
392 |
queryCatastral.setPoligono(txtPoligono.getText()); |
|
393 |
queryCatastral.setParcela(txtParcela.getText()); |
|
394 |
|
|
395 |
} |
|
396 |
|
|
397 |
@Override |
|
398 |
public void setQuery(QueryCatastral query) { |
|
399 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
400 |
|
|
401 |
if (isValidQuery(queryCatastral)){ |
|
402 |
this.queryCatastral=query; |
|
403 |
}else{ |
|
404 |
return; |
|
405 |
} |
|
406 |
if(StringUtils.isNotEmpty(query.getReferenciaCatastral())){ |
|
407 |
txtReferenciaCatastral.setText(query.getReferenciaCatastral()); |
|
408 |
rbtnReferenciaCatastral.setSelected(true); |
|
409 |
}else{ |
|
410 |
txtReferenciaCatastral.setText(""); |
|
411 |
rbtnLocalizacion.setSelected(true); |
|
412 |
} |
|
413 |
cmbProvincia.setSelectedItem(query.getProvincia()); |
|
414 |
if(query.getMunicipio()!=null){ |
|
415 |
txtMunicipio.setText((String)query.getMunicipio().getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_ETIQUETA)); |
|
416 |
}else{ |
|
417 |
txtMunicipio.setText(""); |
|
418 |
} |
|
419 |
if (query.getTipoParcela()!=null){ |
|
420 |
if (QueryCatastral.TipoParcela.RUSTICA.equals(query.getTipoParcela())){ |
|
421 |
rbtnRusticos.setSelected(true); |
|
422 |
}else if (QueryCatastral.TipoParcela.URBANA.equals(query.getTipoParcela())){ |
|
423 |
rbtnUrbanos.setSelected(true); |
|
424 |
} |
|
425 |
} |
|
426 |
cmbTipoVia.setSelectedItem(query.getTipoVia()); |
|
427 |
if(query.getVia()!=null){ |
|
428 |
txtVia.setText((String)query.getVia().getDynValue(BusquedaCatastralManager.CAMPO_VIA_ETIQUETA)); |
|
429 |
}else{ |
|
430 |
txtVia.setText(""); |
|
431 |
} |
|
432 |
if(query.getNumero()!=null){ |
|
433 |
txtNumero.setText((String)query.getNumero()); |
|
434 |
}else{ |
|
435 |
txtNumero.setText(""); |
|
436 |
} |
|
437 |
if(query.getBloque()!=null){ |
|
438 |
txtBloque.setText((String)query.getBloque()); |
|
439 |
}else{ |
|
440 |
txtBloque.setText(""); |
|
441 |
} |
|
442 |
if(query.getEscalera()!=null){ |
|
443 |
txtEscalera.setText((String)query.getEscalera()); |
|
444 |
}else{ |
|
445 |
txtEscalera.setText(""); |
|
446 |
} |
|
447 |
if(query.getPlanta()!=null){ |
|
448 |
txtPlanta.setText((String)query.getPlanta()); |
|
449 |
}else{ |
|
450 |
txtPlanta.setText(""); |
|
451 |
} |
|
452 |
if(query.getPuerta()!=null){ |
|
453 |
txtPuerta.setText((String)query.getPuerta()); |
|
454 |
}else{ |
|
455 |
txtPuerta.setText(""); |
|
456 |
} |
|
457 |
if(query.getPoligono()!=null){ |
|
458 |
txtPoligono.setText((String)query.getPoligono()); |
|
459 |
}else{ |
|
460 |
txtPoligono.setText(""); |
|
461 |
} |
|
462 |
if(query.getParcela()!=null){ |
|
463 |
txtParcela.setText((String)query.getParcela()); |
|
464 |
}else{ |
|
465 |
txtParcela.setText(""); |
|
466 |
} |
|
467 |
} |
|
468 |
|
|
469 |
@Override |
|
470 |
public void clear() { |
|
471 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
472 |
this.queryCatastral=busquedaCatastralManager.createQuery(); |
|
473 |
|
|
474 |
txtReferenciaCatastral.setText(""); |
|
475 |
rbtnReferenciaCatastral.setSelected(true); |
|
476 |
|
|
477 |
cmbProvincia.setSelectedIndex(-1); |
|
478 |
txtMunicipio.setText(""); |
|
479 |
cmbTipoVia.setSelectedIndex(-1); |
|
480 |
txtVia.setText(""); |
|
481 |
txtNumero.setText(""); |
|
482 |
txtBloque.setText(""); |
|
483 |
txtEscalera.setText(""); |
|
484 |
txtPlanta.setText(""); |
|
485 |
txtPuerta.setText(""); |
|
486 |
txtPoligono.setText(""); |
|
487 |
txtParcela.setText(""); |
|
488 |
} |
|
489 |
|
|
490 |
private void updateProvincia(DynObject provincia) { |
|
491 |
queryCatastral.setProvincia(provincia); |
|
492 |
} |
|
493 |
|
|
494 |
private void updateTipoVia(TipoVia tipoVia) { |
|
495 |
queryCatastral.setTipoVia(tipoVia); |
|
496 |
} |
|
497 |
|
|
498 |
|
|
499 |
/* (non-Javadoc) |
|
500 |
* @see javax.swing.JComponent#getPreferredSize() |
|
501 |
*/ |
|
502 |
@Override |
|
503 |
public Dimension getPreferredSize() { |
|
504 |
return new Dimension(750, 400); |
|
505 |
} |
|
506 |
|
|
507 |
@Override |
|
508 |
public void deleteCache() { |
|
509 |
try { |
|
510 |
BusquedaCatastralLocator.getManager().deleteCache(); |
|
511 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
512 |
JOptionPane.showMessageDialog( |
|
513 |
null, |
|
514 |
new StringBuilder().append(i18nManager.getTranslation("_cache_delete_ok")), |
|
515 |
i18nManager.getTranslation("info"), JOptionPane.ERROR_MESSAGE); |
|
516 |
} catch (LocatorException | IOException e) { |
|
517 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
518 |
logger.warn("Error deleting cache for busqueda catastral", e); |
|
519 |
JOptionPane.showMessageDialog( |
|
520 |
null, |
|
521 |
new StringBuilder().append(i18nManager.getTranslation("_error_borrando_cache")), |
|
522 |
i18nManager.getTranslation("info"), JOptionPane.INFORMATION_MESSAGE); |
|
523 |
} |
|
524 |
} |
|
525 |
|
|
526 |
@Override |
|
527 |
public Point getPoint(IProjection projection) throws BusquedaCatastralObtainingPointException { |
|
528 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
529 |
SRSCatastro srs=null; |
|
530 |
Point point=null; |
|
531 |
if (projection!=null){ |
|
532 |
srs=SRSCatastro.getCatastroByCod(projection.getAbrev()); |
|
533 |
} |
|
534 |
try { |
|
535 |
point=busquedaCatastralManager.getPoint(selectedReferenciaCatastral, srs); |
|
536 |
} catch (BusquedaCatastralRemoteServiceException e) { |
|
537 |
logger.error("Error getting point", e); |
|
538 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
539 |
JOptionPane.showMessageDialog( |
|
540 |
null, |
|
541 |
new StringBuilder().append(i18nManager.getTranslation("_error_accessing_catastrial_server")) |
|
542 |
.append(":").append(e.getLocalizedMessage()), |
|
543 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
544 |
|
|
545 |
} catch (BusquedaCatastralInvalidSRSException e) { |
|
546 |
//If it is a SRS problem, we try it with default SRS |
|
547 |
try { |
|
548 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
549 |
logger.warn("SRS error. Retrying with default SRS", e); |
|
550 |
JOptionPane.showMessageDialog( |
|
551 |
null, |
|
552 |
new StringBuilder().append(i18nManager.getTranslation("_proyeccion_no_valida_se_usara_valor_por_defecto")) |
|
553 |
.append(":").append(SRSCatastro.getDefaultSRS().getLabel()), |
|
554 |
i18nManager.getTranslation("warning"), JOptionPane.WARNING_MESSAGE); |
|
555 |
point=busquedaCatastralManager.getPoint(selectedReferenciaCatastral, SRSCatastro.getDefaultSRS()); |
|
556 |
try{ |
|
557 |
IProjection projecionSource=CRSFactory.getCRS(SRSCatastro.getDefaultSRS().getCod()); |
|
558 |
ICoordTrans coord_trans=projecionSource.getCT(projection); |
|
559 |
point.reProject(coord_trans); |
|
560 |
} catch (Exception ex) { |
|
561 |
throw new BusquedaCatastralObtainingPointException( |
|
562 |
i18nManager.getTranslation("_error_reprojecting_point"),ex); |
|
563 |
} |
|
564 |
|
|
565 |
} catch (BusquedaCatastralException e1) { |
|
566 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
567 |
throw new BusquedaCatastralObtainingPointException( |
|
568 |
i18nManager.getTranslation("_error_obteniendo_el_punto_para_ref_catastral")+":"+selectedReferenciaCatastral.getRC(),e1); |
|
569 |
} |
|
570 |
} catch (BusquedaCatastralException e) { |
|
571 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
572 |
throw new BusquedaCatastralObtainingPointException( |
|
573 |
i18nManager.getTranslation("_error_obteniendo_el_punto_para_ref_catastral")+":"+selectedReferenciaCatastral.getRC(),e); |
|
574 |
} |
|
575 |
return point; |
|
576 |
} |
|
577 |
|
|
578 |
@Override |
|
579 |
public DynObject getDatosCatastrales()throws BusquedaCatastralObtainingDataException { |
|
580 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
581 |
try { |
|
582 |
DynObject datosCatastrales = busquedaCatastralManager.getDatosCatastrales(selectedReferenciaCatastral.getRC()); |
|
583 |
return datosCatastrales; |
|
584 |
} catch (BusquedaCatastralException e) { |
|
585 |
throw new BusquedaCatastralObtainingDataException(e); |
|
586 |
} |
|
587 |
} |
|
588 |
|
|
589 |
@Override |
|
590 |
public boolean isSelectedAction(PanelAction action) { |
|
591 |
if(selectedPanelAction!=null){ |
|
592 |
return selectedPanelAction.equals(action); |
|
593 |
}else{ |
|
594 |
return false; |
|
595 |
} |
|
596 |
} |
|
597 |
|
|
598 |
public ReferenciaCatastral getSelectedReferenciaCatastral(){ |
|
599 |
return selectedReferenciaCatastral; |
|
600 |
} |
|
601 |
|
|
602 |
/** |
|
603 |
* Adds listeners to busqueda buttons |
|
604 |
*/ |
|
605 |
private void addBusquedasButtonListeners(){ |
|
606 |
final WindowManager winManager = ToolsSwingLocator.getWindowManager(); |
|
607 |
|
|
608 |
btnMunicipios.addActionListener(new ActionListener() { |
|
609 |
@Override |
|
610 |
public void actionPerformed(ActionEvent e) { |
|
611 |
try { |
|
612 |
final BusquedaMunicipiosPanelController municipiosPanel=new BusquedaMunicipiosPanelController(queryCatastral); |
|
613 |
municipiosPanel.addActionListener(new ActionListener() { |
|
614 |
@Override |
|
615 |
public void actionPerformed(ActionEvent e) { |
|
616 |
if (municipiosPanel.isCanceled()){ |
|
617 |
return; |
|
618 |
}else{ |
|
619 |
DynObject municipio=municipiosPanel.getSelected(); |
|
620 |
if (municipio!=null){ |
|
621 |
queryCatastral.setMunicipio(municipio); |
|
622 |
txtMunicipio.setText((String)municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_ETIQUETA)); |
|
623 |
enableControls(); |
|
624 |
} |
|
625 |
} |
|
626 |
} |
|
627 |
}); |
|
628 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
629 |
winManager.showWindow(municipiosPanel.asJComponent(), i18nManager.getTranslation("_busqueda_municipios"), |
|
630 |
WindowManager.MODE.WINDOW); |
|
631 |
} catch (BusquedaCatastralRemoteServiceException e1) { |
|
632 |
logger.error("Error getting point", e); |
|
633 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
634 |
JOptionPane.showMessageDialog( |
|
635 |
null, |
|
636 |
new StringBuilder().append(i18nManager.getTranslation("_error_accesing_catastral_server")) |
|
637 |
.append(":").append(e1.getLocalizedMessage()), |
|
638 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
639 |
} catch (BaseException e1) { |
|
640 |
logger.error("Error getting point", e); |
|
641 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
642 |
JOptionPane.showMessageDialog( |
|
643 |
null, |
|
644 |
new StringBuilder().append(i18nManager.getTranslation("_error_getting_municipios")) |
|
645 |
.append(":").append(e1.getLocalizedMessage()), |
|
646 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
647 |
} |
|
648 |
} |
|
649 |
}); |
|
650 |
|
|
651 |
|
|
652 |
btnVias.addActionListener(new ActionListener() { |
|
653 |
@Override |
|
654 |
public void actionPerformed(ActionEvent e) { |
|
655 |
try { |
|
656 |
final BusquedaViasPanelController viasPanel=new BusquedaViasPanelController(queryCatastral); |
|
657 |
viasPanel.addActionListener(new ActionListener() { |
|
658 |
@Override |
|
659 |
public void actionPerformed(ActionEvent e) { |
|
660 |
if (viasPanel.isCanceled()){ |
|
661 |
return; |
|
662 |
}else{ |
|
663 |
DynObject via=viasPanel.getSelected(); |
|
664 |
if (via!=null){ |
|
665 |
queryCatastral.setVia(via); |
|
666 |
txtVia.setText((String)via.getDynValue(BusquedaCatastralManager.CAMPO_VIA_ETIQUETA)); |
|
667 |
updateTipoVia(via); |
|
668 |
enableControls(); |
|
669 |
} |
|
670 |
} |
|
671 |
} |
|
672 |
}); |
|
673 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
674 |
winManager.showWindow(viasPanel.asJComponent(), i18nManager.getTranslation("_busqueda_vias"), |
|
675 |
WindowManager.MODE.WINDOW); |
|
676 |
} catch (BusquedaCatastralCreatingPanelException e1) { |
|
677 |
logger.error("Error getting vias", e); |
|
678 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
679 |
JOptionPane.showMessageDialog( |
|
680 |
null, |
|
681 |
new StringBuilder().append(i18nManager.getTranslation("_error_getting_vias")) |
|
682 |
.append(":").append(e1.getLocalizedMessage()), |
|
683 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
684 |
} |
|
685 |
} |
|
686 |
}); |
|
687 |
|
|
688 |
|
|
689 |
btnNumeros.addActionListener(new ActionListener() { |
|
690 |
@Override |
|
691 |
public void actionPerformed(ActionEvent e) { |
|
692 |
try { |
|
693 |
final BusquedaNumerosPanelController numerosPanel=new BusquedaNumerosPanelController(queryCatastral); |
|
694 |
numerosPanel.addActionListener(new ActionListener() { |
|
695 |
@Override |
|
696 |
public void actionPerformed(ActionEvent e) { |
|
697 |
if (numerosPanel.isCanceled()){ |
|
698 |
return; |
|
699 |
}else{ |
|
700 |
String numero=numerosPanel.getSelected(); |
|
701 |
if (StringUtils.isNotEmpty(numero)){ |
|
702 |
queryCatastral.setNumero(numero); |
|
703 |
txtNumero.setText(numero); |
|
704 |
enableControls(); |
|
705 |
} |
|
706 |
} |
|
707 |
} |
|
708 |
}); |
|
709 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
710 |
winManager.showWindow(numerosPanel.asJComponent(), i18nManager.getTranslation("_busqueda_numeros"), |
|
711 |
WindowManager.MODE.WINDOW); |
|
712 |
} catch (BusquedaCatastralCreatingPanelException e1) { |
|
713 |
logger.error("Error getting numeros", e); |
|
714 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
715 |
JOptionPane.showMessageDialog( |
|
716 |
null, |
|
717 |
new StringBuilder().append(i18nManager.getTranslation("_error_getting_numeros")) |
|
718 |
.append(":").append(e1.getLocalizedMessage()), |
|
719 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
720 |
} |
|
721 |
} |
|
722 |
}); |
|
723 |
|
|
724 |
} |
|
725 |
|
|
726 |
private void updateTipoVia(DynObject via){ |
|
727 |
if (via!=null){ |
|
728 |
String tipoViaAbrev=(String) via.getDynValue(BusquedaCatastralManager.CAMPO_VIA_TIPOVIA); |
|
729 |
TipoVia tipoVia=TipoVia.getTipoViaByAbrev(tipoViaAbrev); |
|
730 |
cmbTipoVia.setSelectedItem(tipoVia); |
|
731 |
} |
|
732 |
} |
|
733 |
|
|
734 |
/** |
|
735 |
* Adds enable controls actions to radio buttons and text fields. |
|
736 |
*/ |
|
737 |
private void addEnableControlsListeners(){ |
|
738 |
rbtnReferenciaCatastral.addActionListener(new ActionListener() { |
|
739 |
@Override |
|
740 |
public void actionPerformed(ActionEvent e) { |
|
741 |
enableControls(); |
|
742 |
if (rbtnReferenciaCatastral.isSelected()){ |
|
743 |
queryCatastral.setTipoQuery(QueryCatastral.TipoQuery.POR_RC); |
|
744 |
} |
|
745 |
} |
|
746 |
}); |
|
747 |
|
|
748 |
rbtnLocalizacion.addActionListener(new ActionListener() { |
|
749 |
@Override |
|
750 |
public void actionPerformed(ActionEvent e) { |
|
751 |
enableControls(); |
|
752 |
if (rbtnLocalizacion.isSelected()){ |
|
753 |
queryCatastral.setTipoQuery(QueryCatastral.TipoQuery.POR_LOCALIZACION); |
|
754 |
} |
|
755 |
} |
|
756 |
}); |
|
757 |
|
|
758 |
rbtnRusticos.addActionListener(new ActionListener() { |
|
759 |
@Override |
|
760 |
public void actionPerformed(ActionEvent e) { |
|
761 |
enableControls(); |
|
762 |
if(rbtnRusticos.isSelected()){ |
|
763 |
queryCatastral.setTipoParcela(QueryCatastral.TipoParcela.RUSTICA); |
|
764 |
} |
|
765 |
} |
|
766 |
}); |
|
767 |
|
|
768 |
rbtnUrbanos.addActionListener(new ActionListener() { |
|
769 |
@Override |
|
770 |
public void actionPerformed(ActionEvent e) { |
|
771 |
enableControls(); |
|
772 |
if(rbtnUrbanos.isSelected()){ |
|
773 |
queryCatastral.setTipoParcela(QueryCatastral.TipoParcela.URBANA); |
|
774 |
} |
|
775 |
} |
|
776 |
}); |
|
777 |
|
|
778 |
txtReferenciaCatastral.addKeyListener(new KeyListener() { |
|
779 |
@Override |
|
780 |
public void keyTyped(KeyEvent e) { |
|
781 |
// Do nothing |
|
782 |
} |
|
783 |
|
|
784 |
@Override |
|
785 |
public void keyReleased(KeyEvent e) { |
|
786 |
enableControls(); |
|
787 |
|
|
788 |
} |
|
789 |
|
|
790 |
@Override |
|
791 |
public void keyPressed(KeyEvent e) { |
|
792 |
// Do nothing |
|
793 |
} |
|
794 |
}); |
|
795 |
|
|
796 |
txtMunicipio.addKeyListener(new KeyListener() { |
|
797 |
@Override |
|
798 |
public void keyTyped(KeyEvent e) { |
|
799 |
// Do nothing |
|
800 |
} |
|
801 |
|
|
802 |
@Override |
|
803 |
public void keyReleased(KeyEvent e) { |
|
804 |
enableControls(); |
|
805 |
|
|
806 |
} |
|
807 |
|
|
808 |
@Override |
|
809 |
public void keyPressed(KeyEvent e) { |
|
810 |
// Do nothing |
|
811 |
} |
|
812 |
}); |
|
813 |
|
|
814 |
txtVia.addKeyListener(new KeyListener() { |
Also available in: Unified diff