Revision 135
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.api/src/main/java/org/gvsig/googlemaps/swing/api/StreetViewPreferences.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.googlemaps.swing.api; |
24 | 24 |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
25 | 27 |
import org.gvsig.tools.swing.api.Component; |
26 | 28 |
|
27 | 29 |
|
... | ... | |
30 | 32 |
* |
31 | 33 |
*/ |
32 | 34 |
public interface StreetViewPreferences extends Component { |
33 |
|
|
35 |
enum PanelAction{SHOW_DISCLAIMER}; |
|
34 | 36 |
/** |
35 | 37 |
* @return the API key |
36 | 38 |
*/ |
37 | 39 |
String getApiKey(); |
38 | 40 |
|
41 |
public void addActionListener(ActionListener listener); |
|
42 |
|
|
43 |
public void removeActionListener(ActionListener listener); |
|
44 |
|
|
45 |
public boolean isSelectedAction(PanelAction action); |
|
39 | 46 |
} |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.api/src/main/java/org/gvsig/googlemaps/swing/api/GoogleMapsConfigDataParameters.java | ||
---|---|---|
48 | 48 |
* @return String |
49 | 49 |
*/ |
50 | 50 |
public URL getGoogleMapsURL(); |
51 |
|
|
52 |
/** |
|
53 |
* Gets the URL to request url disclaimer |
|
54 |
* @return String |
|
55 |
*/ |
|
56 |
public URL getDisclaimerURL(); |
|
51 | 57 |
} |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/DefaultGoogleMapsConfigDataParameters.java | ||
---|---|---|
18 | 18 |
private static final String APIKEY = "apiKey"; |
19 | 19 |
private static final String ZOOMLVL = "zoomLvl"; |
20 | 20 |
private static final String URL = "url"; |
21 |
private static final String DISCLAIMER_URL = "disclaimerURL"; |
|
21 | 22 |
|
22 | 23 |
|
23 | 24 |
private static final Logger logger = LoggerFactory |
... | ... | |
91 | 92 |
return url; |
92 | 93 |
} |
93 | 94 |
|
95 |
@Override |
|
96 |
public java.net.URL getDisclaimerURL() { |
|
97 |
return (URL)config.getDynValue(DISCLAIMER_URL); |
|
98 |
} |
|
99 |
|
|
94 | 100 |
} |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/DefaultGoogleMapsParametersPanelController.java | ||
---|---|---|
32 | 32 |
import javax.swing.ComboBoxModel; |
33 | 33 |
import javax.swing.DefaultComboBoxModel; |
34 | 34 |
import javax.swing.JComponent; |
35 |
import javax.swing.event.HyperlinkEvent; |
|
36 |
import javax.swing.event.HyperlinkListener; |
|
35 | 37 |
|
36 | 38 |
import org.gvsig.fmap.dal.DALLocator; |
37 | 39 |
import org.gvsig.fmap.dal.DataParameters; |
... | ... | |
103 | 105 |
lblZoomLvl.setToolTipText(i18nManager.getTranslation(lblZoomLvl.getToolTipText())); |
104 | 106 |
//txtDisclaimer.setText(i18nManager.getTranslation(txtDisclaimer.getText())); |
105 | 107 |
txtDisclaimer.setText(i18nManager.getTranslation("_google_maps_disclaimer")); |
106 |
txtDisclaimer.addMouseListener(new MouseListener() { |
|
108 |
txtURLDisclaimer.setText(i18nManager.getTranslation("_google_disclaimer_url")); |
|
109 |
txtURLDisclaimer.addHyperlinkListener(new HyperlinkListener() { |
|
107 | 110 |
|
108 | 111 |
|
109 | 112 |
@Override |
110 |
public void mouseReleased(MouseEvent e) { |
|
111 |
// TODO Auto-generated method stub |
|
113 |
public void hyperlinkUpdate(HyperlinkEvent event) { |
|
114 |
if (!event.getInputEvent().isConsumed() && |
|
115 |
event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)){ |
|
116 |
event.getInputEvent().consume(); |
|
117 |
selectedAction=GoogleMapsParametersPanel.PanelAction.SHOW_DISCLAIMER; |
|
118 |
listeners.fireActionEvent(new ActionEvent(DefaultGoogleMapsParametersPanelController.this, 0, "disclaimer")); |
|
119 |
event.getInputEvent().consume(); |
|
120 |
} |
|
112 | 121 |
|
113 | 122 |
} |
114 |
|
|
115 |
@Override |
|
116 |
public void mousePressed(MouseEvent e) { |
|
117 |
// TODO Auto-generated method stub |
|
118 |
|
|
119 |
} |
|
120 |
|
|
121 |
@Override |
|
122 |
public void mouseExited(MouseEvent e) { |
|
123 |
// TODO Auto-generated method stub |
|
124 |
|
|
125 |
} |
|
126 |
|
|
127 |
@Override |
|
128 |
public void mouseEntered(MouseEvent e) { |
|
129 |
// TODO Auto-generated method stub |
|
130 |
|
|
131 |
} |
|
132 |
|
|
133 |
@Override |
|
134 |
public void mouseClicked(MouseEvent e) { |
|
135 |
selectedAction=GoogleMapsParametersPanel.PanelAction.SHOW_DISCLAIMER; |
|
136 |
listeners.fireActionEvent(new ActionEvent(DefaultGoogleMapsParametersPanelController.this, 0, "disclaimer")); |
|
137 |
} |
|
138 | 123 |
}); |
139 | 124 |
|
140 | 125 |
if(showCrsWarning){ |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/DefaultGoogleMapsParametersPanelView.xml | ||
---|---|---|
24 | 24 |
</at> |
25 | 25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
26 | 26 |
</super> |
27 |
<at name="id">/home/paco/projects/externals/gvsig-desktop/gvSIG_v2.1/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/DefaultGoogleMapsParametersPanelView.xml</at>
|
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at>
|
|
27 |
<at name="id">/home/daniel/projects/externals/gvSIG/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/DefaultGoogleMapsParametersPanelView.xml</at>
|
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,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:4DLU:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at>
|
|
29 | 29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE</at> |
30 | 30 |
<at name="components"> |
31 | 31 |
<object classname="java.util.LinkedList"> |
... | ... | |
484 | 484 |
<at name="cellconstraints"> |
485 | 485 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
486 | 486 |
<at name="column">2</at> |
487 |
<at name="row">12</at>
|
|
487 |
<at name="row">14</at>
|
|
488 | 488 |
<at name="colspan">5</at> |
489 | 489 |
<at name="rowspan">1</at> |
490 | 490 |
<at name="halign">default</at> |
... | ... | |
578 | 578 |
</object> |
579 | 579 |
</at> |
580 | 580 |
</item> |
581 |
<item > |
|
582 |
<at name="value"> |
|
583 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
584 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
585 |
<at name="cellconstraints"> |
|
586 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
587 |
<at name="column">2</at> |
|
588 |
<at name="row">12</at> |
|
589 |
<at name="colspan">5</at> |
|
590 |
<at name="rowspan">1</at> |
|
591 |
<at name="halign">default</at> |
|
592 |
<at name="valign">default</at> |
|
593 |
<at name="insets" object="insets">0,0,0,0</at> |
|
594 |
</object> |
|
595 |
</at> |
|
596 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
597 |
</super> |
|
598 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
599 |
<at name="beanclass">javax.swing.JEditorPane</at> |
|
600 |
<at name="beanproperties"> |
|
601 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
602 |
<at name="classname">javax.swing.JEditorPane</at> |
|
603 |
<at name="properties"> |
|
604 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
605 |
<at name="border"> |
|
606 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
607 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
608 |
<at name="name">border</at> |
|
609 |
</super> |
|
610 |
<at name="borders"> |
|
611 |
<object classname="java.util.LinkedList"> |
|
612 |
<item > |
|
613 |
<at name="value"> |
|
614 |
<object classname="com.jeta.forms.store.properties.EmptyBorderProperty"> |
|
615 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
616 |
<at name="name">border</at> |
|
617 |
</super> |
|
618 |
<at name="top">0</at> |
|
619 |
<at name="left">0</at> |
|
620 |
<at name="bottom">0</at> |
|
621 |
<at name="right">0</at> |
|
622 |
</object> |
|
623 |
</at> |
|
624 |
</item> |
|
625 |
</object> |
|
626 |
</at> |
|
627 |
</object> |
|
628 |
</at> |
|
629 |
<at name="selectionStart">16</at> |
|
630 |
<at name="autoscrolls">false</at> |
|
631 |
<at name="opaque">false</at> |
|
632 |
<at name="editable">false</at> |
|
633 |
<at name="name">txtURLDisclaimer</at> |
|
634 |
<at name="width">914</at> |
|
635 |
<at name="selectionEnd">16</at> |
|
636 |
<at name="text"><html> |
|
637 |
<head> |
|
638 |
|
|
639 |
</head> |
|
640 |
<body> |
|
641 |
_url_disclaimer |
|
642 |
</body> |
|
643 |
</html> |
|
644 |
</at> |
|
645 |
<at name="contentType">text/html</at> |
|
646 |
<at name="scollBars"> |
|
647 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
648 |
<at name="name">scollBars</at> |
|
649 |
<at name="verticalpolicy">21</at> |
|
650 |
<at name="horizontalpolicy">31</at> |
|
651 |
<at name="border"> |
|
652 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
653 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
654 |
<at name="name">border</at> |
|
655 |
</super> |
|
656 |
<at name="borders"> |
|
657 |
<object classname="java.util.LinkedList"> |
|
658 |
<item > |
|
659 |
<at name="value"> |
|
660 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
661 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
662 |
<at name="name">border</at> |
|
663 |
</super> |
|
664 |
</object> |
|
665 |
</at> |
|
666 |
</item> |
|
667 |
</object> |
|
668 |
</at> |
|
669 |
</object> |
|
670 |
</at> |
|
671 |
</object> |
|
672 |
</at> |
|
673 |
<at name="height">17</at> |
|
674 |
</object> |
|
675 |
</at> |
|
676 |
</object> |
|
677 |
</at> |
|
678 |
</object> |
|
679 |
</at> |
|
680 |
</item> |
|
581 | 681 |
</object> |
582 | 682 |
</at> |
583 | 683 |
<at name="properties"> |
... | ... | |
635 | 735 |
<at name="cellpainters"> |
636 | 736 |
<object classname="com.jeta.forms.store.support.Matrix"> |
637 | 737 |
<at name="rows"> |
638 |
<object classname="[Ljava.lang.Object;" size="13">
|
|
738 |
<object classname="[Ljava.lang.Object;" size="15">
|
|
639 | 739 |
<at name="item" index="0"> |
640 | 740 |
<object classname="[Ljava.lang.Object;" size="7"/> |
641 | 741 |
</at> |
... | ... | |
675 | 775 |
<at name="item" index="12"> |
676 | 776 |
<object classname="[Ljava.lang.Object;" size="7"/> |
677 | 777 |
</at> |
778 |
<at name="item" index="13"> |
|
779 |
<object classname="[Ljava.lang.Object;" size="7"/> |
|
780 |
</at> |
|
781 |
<at name="item" index="14"> |
|
782 |
<object classname="[Ljava.lang.Object;" size="7"/> |
|
783 |
</at> |
|
678 | 784 |
</object> |
679 | 785 |
</at> |
680 | 786 |
</object> |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/DefaultGoogleMapsParametersPanelView.java | ||
---|---|---|
29 | 29 |
JTextField txtZoomLvl = new JTextField(); |
30 | 30 |
JEditorPane txtDisclaimer = new JEditorPane(); |
31 | 31 |
JEditorPane txtCrsWarning = new JEditorPane(); |
32 |
JEditorPane txtURLDisclaimer = new JEditorPane(); |
|
32 | 33 |
|
33 | 34 |
/** |
34 | 35 |
* Default constructor |
... | ... | |
120 | 121 |
public JPanel createPanel() |
121 | 122 |
{ |
122 | 123 |
JPanel jpanel1 = new JPanel(); |
123 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
|
|
124 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,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:4DLU:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
|
|
124 | 125 |
CellConstraints cc = new CellConstraints(); |
125 | 126 |
jpanel1.setLayout(formlayout1); |
126 | 127 |
|
... | ... | |
174 | 175 |
txtCrsWarning.setText("<html>\n <head>\n \n </head>\n <body>\n <font color=\"red\">_crs_warning</font>\n </body>\n</html>\n"); |
175 | 176 |
EmptyBorder emptyborder2 = new EmptyBorder(0,0,0,0); |
176 | 177 |
txtCrsWarning.setBorder(emptyborder2); |
177 |
jpanel1.add(txtCrsWarning,cc.xywh(2,12,5,1));
|
|
178 |
jpanel1.add(txtCrsWarning,cc.xywh(2,14,5,1));
|
|
178 | 179 |
|
179 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 }); |
|
180 |
txtURLDisclaimer.setAutoscrolls(false); |
|
181 |
txtURLDisclaimer.setContentType("text/html"); |
|
182 |
txtURLDisclaimer.setEditable(false); |
|
183 |
txtURLDisclaimer.setName("txtURLDisclaimer"); |
|
184 |
txtURLDisclaimer.setOpaque(false); |
|
185 |
txtURLDisclaimer.setSelectionEnd(16); |
|
186 |
txtURLDisclaimer.setSelectionStart(16); |
|
187 |
txtURLDisclaimer.setText("<html>\n <head>\n \n </head>\n <body>\n _url_disclaimer\n </body>\n</html>\n"); |
|
188 |
EmptyBorder emptyborder3 = new EmptyBorder(0,0,0,0); |
|
189 |
txtURLDisclaimer.setBorder(emptyborder3); |
|
190 |
jpanel1.add(txtURLDisclaimer,cc.xywh(2,12,5,1)); |
|
191 |
|
|
192 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }); |
|
180 | 193 |
return jpanel1; |
181 | 194 |
} |
182 | 195 |
|
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.swing/org.gvsig.googlemaps.swing.impl/src/main/java/org/gvsig/googlemaps/swing/impl/JStreetViewPreferencesController.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.googlemaps.swing.impl; |
24 | 24 |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
25 | 27 |
import java.util.Locale; |
26 | 28 |
|
27 | 29 |
import javax.swing.JComponent; |
30 |
import javax.swing.event.HyperlinkEvent; |
|
31 |
import javax.swing.event.HyperlinkListener; |
|
28 | 32 |
|
29 |
import org.gvsig.googlemaps.lib.api.GoogleMapsLocator; |
|
30 | 33 |
import org.gvsig.googlemaps.swing.api.StreetViewPreferences; |
31 | 34 |
import org.gvsig.tools.ToolsLocator; |
35 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
36 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
32 | 37 |
|
33 | 38 |
|
34 | 39 |
/** |
... | ... | |
37 | 42 |
*/ |
38 | 43 |
public class JStreetViewPreferencesController extends JStreetViewPreferencesView implements StreetViewPreferences { |
39 | 44 |
|
45 |
private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
46 |
private PanelAction selectedAction=null; |
|
40 | 47 |
/** |
41 | 48 |
* |
42 | 49 |
*/ |
... | ... | |
72 | 79 |
return this; |
73 | 80 |
} |
74 | 81 |
|
82 |
public void addActionListener(ActionListener listener) { |
|
83 |
listeners.addActionListener(listener); |
|
84 |
} |
|
85 |
|
|
86 |
public void removeActionListener(ActionListener listener) { |
|
87 |
listeners.removeActionListener(listener); |
|
88 |
} |
|
89 |
|
|
75 | 90 |
private void translate() { |
76 | 91 |
apiKeyLbl.setText(ToolsLocator.getI18nManager().getTranslation(apiKeyLbl.getText())); |
77 | 92 |
disclaimerText.setText(ToolsLocator.getI18nManager().getTranslation("_google_street_view_disclaimer")); |
93 |
disclaimerText.addHyperlinkListener(new HyperlinkListener() { |
|
94 |
|
|
95 |
@Override |
|
96 |
public void hyperlinkUpdate(HyperlinkEvent event) { |
|
97 |
if (!event.getInputEvent().isConsumed() && |
|
98 |
event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)){ |
|
99 |
event.getInputEvent().consume(); |
|
100 |
selectedAction=StreetViewPreferences.PanelAction.SHOW_DISCLAIMER; |
|
101 |
listeners.fireActionEvent(new ActionEvent(JStreetViewPreferencesController.this, 0, "disclaimer")); |
|
102 |
} |
|
103 |
|
|
104 |
} |
|
105 |
}); |
|
78 | 106 |
} |
79 | 107 |
|
80 | 108 |
/* (non-Javadoc) |
... | ... | |
88 | 116 |
super.setLocale(l); |
89 | 117 |
} |
90 | 118 |
|
119 |
@Override |
|
120 |
public boolean isSelectedAction(PanelAction action) { |
|
121 |
return action.equals(this.selectedAction); |
|
122 |
} |
|
123 |
|
|
91 | 124 |
} |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.streetview/src/main/resources-plugin/plugin-persistence.def | ||
---|---|---|
11 | 11 |
<field name="apiKey" type="string" classOfValue="" mandatory="false"> |
12 | 12 |
<description></description> |
13 | 13 |
</field> |
14 |
<field name="disclaimerURL" defaultValue="https://developers.google.com/maps/terms#1-your-relationship-with-google" type="url" mandatory="false"> |
|
15 |
<description></description> |
|
16 |
</field> |
|
14 | 17 |
</fields> |
15 | 18 |
</class> |
16 | 19 |
</classes> |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.streetview/src/main/java/org/gvsig/googlemaps/app/streetview/GoogleStreetViewPreferencePage.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.googlemaps.app.streetview; |
24 | 24 |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
import java.net.URISyntaxException; |
|
28 |
import java.net.URL; |
|
29 |
|
|
25 | 30 |
import javax.swing.ImageIcon; |
26 | 31 |
import javax.swing.JPanel; |
27 | 32 |
|
28 | 33 |
import org.gvsig.andami.IconThemeHelper; |
29 | 34 |
import org.gvsig.andami.PluginServices; |
35 |
import org.gvsig.andami.PluginsLocator; |
|
36 |
import org.gvsig.andami.PluginsManager; |
|
30 | 37 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
31 | 38 |
import org.gvsig.andami.preferences.StoreException; |
32 | 39 |
import org.gvsig.googlemaps.lib.api.GoogleMapsLocator; |
... | ... | |
36 | 43 |
import org.gvsig.tools.ToolsLocator; |
37 | 44 |
import org.gvsig.tools.dynobject.DynObject; |
38 | 45 |
import org.gvsig.tools.i18n.I18nManager; |
46 |
import org.slf4j.Logger; |
|
47 |
import org.slf4j.LoggerFactory; |
|
39 | 48 |
|
40 | 49 |
|
41 | 50 |
/** |
... | ... | |
43 | 52 |
* |
44 | 53 |
*/ |
45 | 54 |
public class GoogleStreetViewPreferencePage extends AbstractPreferencePage { |
46 |
|
|
55 |
private static final Logger logger = LoggerFactory |
|
56 |
.getLogger(GoogleStreetViewPreferencePage.class); |
|
47 | 57 |
/** |
48 | 58 |
* |
49 | 59 |
*/ |
... | ... | |
51 | 61 |
protected String id; |
52 | 62 |
private StreetViewPreferences preferencesPanel = null; |
53 | 63 |
private DynObject props; |
64 |
private URL disclaimerURL; |
|
54 | 65 |
|
55 | 66 |
|
56 | 67 |
/** |
... | ... | |
64 | 75 |
initializeValues(); |
65 | 76 |
|
66 | 77 |
preferencesPanel = swingManager.createStreetViewPreferencesPanel( GoogleMapsLocator.getManager().getStreetViewApiKey()); |
78 |
preferencesPanel.addActionListener(new ActionListener() { |
|
67 | 79 |
|
80 |
|
|
81 |
@Override |
|
82 |
public void actionPerformed(ActionEvent event) { |
|
83 |
StreetViewPreferences panel = (StreetViewPreferences) event.getSource(); |
|
84 |
if (panel.isSelectedAction(StreetViewPreferences.PanelAction.SHOW_DISCLAIMER)) { |
|
85 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
|
86 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
87 |
try { |
|
88 |
pluginManager.desktopBrowse(disclaimerURL.toURI()); |
|
89 |
} catch (URISyntaxException e) { |
|
90 |
logger.warn("Couldn't browse to: "+disclaimerURL.toString()); |
|
91 |
} |
|
92 |
} |
|
93 |
} |
|
94 |
}); |
|
68 | 95 |
add(preferencesPanel.asJComponent()); |
69 | 96 |
} |
70 | 97 |
|
... | ... | |
101 | 128 |
PluginServices ps = PluginServices.getPluginServices(this); |
102 | 129 |
props = ps.getPluginProperties(); |
103 | 130 |
String apiKey = (String) props.getDynValue(GoogleStreetViewExtension.PERSIST_GOOGLEMAPSAPIKEY_KEY); |
104 |
|
|
131 |
disclaimerURL = (URL)props.getDynValue(GoogleStreetViewExtension.PERSIST_DISCLAIMER_URL); |
|
105 | 132 |
GoogleMapsLocator.getManager().setStreetViewApiKey(apiKey); |
106 | 133 |
|
107 | 134 |
} |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.streetview/src/main/java/org/gvsig/googlemaps/app/streetview/GoogleStreetViewExtension.java | ||
---|---|---|
51 | 51 |
.getLogger(GoogleStreetViewExtension.class); |
52 | 52 |
|
53 | 53 |
public static final String PERSIST_GOOGLEMAPSAPIKEY_KEY = "apiKey"; |
54 |
public static final String PERSIST_DISCLAIMER_URL = "disclaimerURL"; |
|
54 | 55 |
|
55 | 56 |
/* (non-Javadoc) |
56 | 57 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String) |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.mainplugin/src/main/java/org/gvsig/googlemaps/app/mainplugin/GoogleMapsService.java | ||
---|---|---|
82 | 82 |
parametersPanel=GoogleMapsSwingLocator.getManager().createGoogleMapsParametersPanel(configParams); |
83 | 83 |
parametersPanel.addActionListener(new ActionListener() { |
84 | 84 |
|
85 |
|
|
86 | 85 |
@Override |
87 | 86 |
public void actionPerformed(ActionEvent event) { |
88 | 87 |
GoogleMapsParametersPanel panel = (GoogleMapsParametersPanel) event.getSource(); |
89 | 88 |
if (panel.isSelectedAction(GoogleMapsParametersPanel.PanelAction.SHOW_DISCLAIMER)) { |
90 | 89 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
91 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
92 |
String disclaimerURL=i18nManager.getTranslation("_disclaimer_url"); |
|
93 | 90 |
try { |
94 |
pluginManager.desktopBrowse(new URI(disclaimerURL));
|
|
91 |
pluginManager.desktopBrowse(configParams.getDisclaimerURL().toURI());
|
|
95 | 92 |
} catch (URISyntaxException e) { |
96 |
log.warn("Couldn't browse to: "+disclaimerURL);
|
|
93 |
log.warn("Couldn't browse to: "+configParams.getDisclaimerURL().toString());
|
|
97 | 94 |
} |
98 | 95 |
} |
99 | 96 |
} |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.mainplugin/src/main/resources-plugin/plugin-persistence.def | ||
---|---|---|
17 | 17 |
<field name="url" defaultValue="http://maps.google.com/maps/api/staticmap?" type="url" mandatory="false"> |
18 | 18 |
<description></description> |
19 | 19 |
</field> |
20 |
<field name="disclaimerURL" defaultValue="https://developers.google.com/maps/terms#1-your-relationship-with-google" type="url" mandatory="false"> |
|
21 |
<description></description> |
|
22 |
</field> |
|
20 | 23 |
</fields> |
21 | 24 |
</class> |
22 | 25 |
</classes> |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
14 | 14 |
_zoom_lvl_tooltip=Nivel de zoom m\u00e1ximo permitido. Puede depender de la zona y el tipo de mapa. |
15 | 15 |
_zoom_lvl_not_valid=Nivel de zoom no v\u00e1lido |
16 | 16 |
_api_key_needed=La clave del API es necesaria |
17 |
_google_maps_disclaimer=<html>Esta herramienta hace uso de la API de mapas est\u00e1ticos de Google Maps.<br> Es posible que para realizar un uso correcto de ella deba de solicitar una clave de acceso a Google.<br> Puede encontrar m\u00e1s informaci\u00f3n sobre los t\u00e9rminos de uso en: <br><a href="https://developers.google.com/maps/terms#1-your-relationship-with-google">https://developers.google.com/maps/</a></html>
|
|
18 |
_disclaimer_url=https://developers.google.com/maps/terms#1-your-relationship-with-google
|
|
17 |
_google_maps_disclaimer=<html>Esta herramienta hace uso de la API de mapas est\u00e1ticos de Google Maps.<br> Es posible que para realizar un uso correcto de ella deba de solicitar una clave de acceso a Google.<br> Puede encontrar m\u00e1s informaci\u00f3n sobre los t\u00e9rminos de uso en: <br></html> |
|
18 |
_google_disclaimer_url=<a href="https://developers.google.com/maps/terms#1-your-relationship-with-google">https://developers.google.com/maps/</a>
|
|
19 | 19 |
|
20 | 20 |
_crs_warning=La proyecci\u00f3n de la vista no es la adecuada para cargar capas de este servicio. |
org.gvsig.googlemaps/trunk/org.gvsig.googlemaps/org.gvsig.googlemaps.app/org.gvsig.googlemaps.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
14 | 14 |
_zoom_lvl_tooltip=Maximum zoom level. Depends on zone and map type. |
15 | 15 |
_zoom_lvl_not_valid=Not valid zoom level |
16 | 16 |
_api_key_needed=An API key is needed |
17 |
_google_maps_disclaimer=<html>This tool uses Google Static Maps API.<br> For its proper use, an API key should be requested to Google.<br> More information about its terms of use can be found at: <br><a href="https://developers.google.com/maps/terms#1-your-relationship-with-google">https://developers.google.com/maps/</a></html> |
|
18 |
_disclaimer_url=https://developers.google.com/maps/terms#1-your-relationship-with-google |
|
19 |
|
|
17 |
_google_maps_disclaimer=<html>This tool uses Google Static Maps API.<br> For its proper use, an API key should be requested to Google.<br> More information about its terms of use can be found at: <br></html> |
|
18 |
_google_disclaimer_url=<a href="https://developers.google.com/maps/terms#1-your-relationship-with-google">https://developers.google.com/maps/</a> |
|
20 | 19 |
_crs_warning=The projection of the view is not appropriate to load layers of this service. |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.app/org.gvsig.bingmaps.app.mainplugin/src/main/resources-plugin/plugin-persistence.def | ||
---|---|---|
14 | 14 |
<field name="mapUrlPattern" type="string" defaultValue="http://dev.virtualearth.net/REST/V1/Imagery/Metadata/{MAPTYPE}?mapVersion=v1&format=jpeg&output=xml&key={KEY}"> |
15 | 15 |
<description></description> |
16 | 16 |
</field> |
17 |
<field name="disclaimerURL" defaultValue="https://developers.bing.com/maps/terms#1-your-relationship-with-bing" type="url" mandatory="false"> |
|
18 |
<description></description> |
|
19 |
</field> |
|
17 | 20 |
</fields> |
18 | 21 |
</class> |
19 | 22 |
</classes> |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.app/org.gvsig.bingmaps.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
11 | 11 |
_zoom_lvl_not_valid=Nivel de zoom no v\u00e1lido |
12 | 12 |
_api_key_needed=La clave del API es necesaria |
13 | 13 |
_bing_maps_disclaimer=<html>Esta herramienta hace uso de la API de Bing Maps.<br> Es posible que para realizar un uso correcto de ella deba de solicitar una clave de acceso a Bing.<br> Puede encontrar m\u00e1s informaci\u00f3n sobre los t\u00e9rminos de uso en: <br><a href="https://www.microsoft.com/maps/product/terms.html">https://www.microsoft.com/maps/product/terms.html</a></html> |
14 |
_disclaimer_url=https://developers.bing.com/maps/terms#1-your-relationship-with-bing |
|
15 | 14 |
|
16 | 15 |
#MapTypes |
17 | 16 |
_aerial=A\u00e9reo |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.app/org.gvsig.bingmaps.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
11 | 11 |
_zoom_lvl_not_valid=Not valid zoom level |
12 | 12 |
_api_key_needed=An API key is needed |
13 | 13 |
_bing_maps_disclaimer=<html>This tool uses Bing Maps API.<br> For its proper use, an API key should be requested to Bing.<br> More information about its terms of use can be found at: <br><a href="https://developers.bing.com/maps/terms#1-your-relationship-with-bing">https://developers.bing.com/maps/</a></html> |
14 |
_disclaimer_url=https://developers.bing.com/maps/terms#1-your-relationship-with-bing |
|
15 | 14 |
|
16 | 15 |
#MapTypes |
17 | 16 |
_aerial=Aerial |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.app/org.gvsig.bingmaps.app.mainplugin/src/main/java/org/gvsig/bingmaps/app/mainplugin/BingMapsService.java | ||
---|---|---|
89 | 89 |
BingMapsParametersPanel panel = (BingMapsParametersPanel) event.getSource(); |
90 | 90 |
if (panel.isSelectedAction(BingMapsParametersPanel.PanelAction.SHOW_DISCLAIMER)) { |
91 | 91 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
92 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
93 |
String disclaimerURL=i18nManager.getTranslation("_disclaimer_url"); |
|
94 | 92 |
try { |
95 |
pluginManager.desktopBrowse(new URI(disclaimerURL));
|
|
93 |
pluginManager.desktopBrowse(configParams.getDisclaimerURL().toURI());
|
|
96 | 94 |
} catch (URISyntaxException e) { |
97 |
log.warn("Couldn't browse to: "+disclaimerURL);
|
|
95 |
log.warn("Couldn't browse to: "+configParams.getDisclaimerURL().toString());
|
|
98 | 96 |
} |
99 | 97 |
} |
100 | 98 |
} |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.swing/org.gvsig.bingmaps.swing.api/src/main/java/org/gvsig/bingmaps/swing/api/BingMapsConfigDataParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.bingmaps.swing.api; |
2 | 2 |
|
3 |
import java.net.URL; |
|
4 |
|
|
3 | 5 |
import org.gvsig.tools.dynobject.DynObject; |
4 | 6 |
|
5 | 7 |
|
... | ... | |
33 | 35 |
* @return String |
34 | 36 |
*/ |
35 | 37 |
public String getBingMapsURLMapPattern(); |
38 |
|
|
39 |
/** |
|
40 |
* Gets the URL to request url disclaimer |
|
41 |
* @return String |
|
42 |
*/ |
|
43 |
public URL getDisclaimerURL(); |
|
36 | 44 |
} |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.swing/org.gvsig.bingmaps.swing.impl/src/main/java/org/gvsig/bingmaps/swing/impl/DefaultBingMapsParametersPanelController.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import java.awt.event.ActionEvent; |
26 | 26 |
import java.awt.event.ActionListener; |
27 |
import java.awt.event.MouseEvent; |
|
28 |
import java.awt.event.MouseListener; |
|
29 | 27 |
|
30 | 28 |
import javax.swing.ComboBoxModel; |
31 | 29 |
import javax.swing.DefaultComboBoxModel; |
32 | 30 |
import javax.swing.JComponent; |
31 |
import javax.swing.event.HyperlinkEvent; |
|
32 |
import javax.swing.event.HyperlinkListener; |
|
33 | 33 |
|
34 | 34 |
import org.apache.commons.lang3.StringUtils; |
35 | 35 |
import org.gvsig.bingmaps.lib.api.BingMapsLocator; |
... | ... | |
99 | 99 |
cboMapTypes.setToolTipText(i18nManager.getTranslation(cboMapTypes.getToolTipText())); |
100 | 100 |
txtAPIKey.setToolTipText(i18nManager.getTranslation(txtAPIKey.getToolTipText())); |
101 | 101 |
txtDisclaimer.setText(i18nManager.getTranslation("_bing_maps_disclaimer")); |
102 |
txtDisclaimer.addMouseListener(new MouseListener() {
|
|
102 |
txtDisclaimer.addHyperlinkListener(new HyperlinkListener() {
|
|
103 | 103 |
|
104 | 104 |
|
105 | 105 |
@Override |
106 |
public void mouseReleased(MouseEvent e) { |
|
107 |
// TODO Auto-generated method stub |
|
106 |
public void hyperlinkUpdate(HyperlinkEvent event) { |
|
107 |
if (!event.getInputEvent().isConsumed() && |
|
108 |
event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)){ |
|
109 |
event.getInputEvent().consume(); |
|
110 |
selectedAction=BingMapsParametersPanel.PanelAction.SHOW_DISCLAIMER; |
|
111 |
listeners.fireActionEvent(new ActionEvent(DefaultBingMapsParametersPanelController.this, 0, "disclaimer")); |
|
112 |
event.getInputEvent().consume(); |
|
113 |
} |
|
108 | 114 |
|
109 | 115 |
} |
116 |
}); |
|
110 | 117 |
|
111 |
@Override |
|
112 |
public void mousePressed(MouseEvent e) { |
|
113 |
// TODO Auto-generated method stub |
|
114 | 118 |
|
115 |
} |
|
116 |
|
|
117 |
@Override |
|
118 |
public void mouseExited(MouseEvent e) { |
|
119 |
// TODO Auto-generated method stub |
|
120 |
|
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public void mouseEntered(MouseEvent e) { |
|
125 |
// TODO Auto-generated method stub |
|
126 |
|
|
127 |
} |
|
128 |
|
|
129 |
@Override |
|
130 |
public void mouseClicked(MouseEvent e) { |
|
131 |
selectedAction=BingMapsParametersPanel.PanelAction.SHOW_DISCLAIMER; |
|
132 |
listeners.fireActionEvent(new ActionEvent(DefaultBingMapsParametersPanelController.this, 0, "disclaimer")); |
|
133 |
} |
|
134 |
}); |
|
135 | 119 |
if(showCrsWarning){ |
136 | 120 |
StringBuilder builder = new StringBuilder(); |
137 | 121 |
builder.append("<html><font color=\"red\">"); |
org.gvsig.bingmaps/trunk/org.gvsig.bingmaps/org.gvsig.bingmaps.swing/org.gvsig.bingmaps.swing.impl/src/main/java/org/gvsig/bingmaps/swing/impl/DefaultBingMapsConfigDataParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.bingmaps.swing.impl; |
2 | 2 |
|
3 |
import java.net.URL; |
|
4 |
|
|
3 | 5 |
import org.gvsig.bingmaps.swing.api.BingMapsConfigDataParameters; |
4 | 6 |
import org.gvsig.tools.dynobject.DynObject; |
5 | 7 |
import org.slf4j.Logger; |
... | ... | |
15 | 17 |
|
16 | 18 |
private static final String URL_PATTERN = "mapUrlPattern"; |
17 | 19 |
private static final String APIKEY = "apiKey"; |
20 |
private static final String DISCLAIMER_URL = "disclaimerURL"; |
|
18 | 21 |
|
19 | 22 |
private static final Logger logger = LoggerFactory |
20 | 23 |
.getLogger(DefaultBingMapsConfigDataParameters.class); |
... | ... | |
62 | 65 |
return urlPattern; |
63 | 66 |
} |
64 | 67 |
|
68 |
@Override |
|
69 |
public java.net.URL getDisclaimerURL() { |
|
70 |
return (URL)config.getDynValue(DISCLAIMER_URL); |
|
71 |
} |
|
72 |
|
|
65 | 73 |
} |
Also available in: Unified diff