improved css
This commit is contained in:
parent
bec8e3afc6
commit
bba75e70b8
|
@ -24,6 +24,7 @@ import com.google.gwt.uibinder.client.UiBinder;
|
|||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.RadioButton;
|
||||
|
@ -58,7 +59,7 @@ public class MapView extends Composite {
|
|||
HTMLPanel panelBaseLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel theMap;
|
||||
HTMLPanel theMapPanel;
|
||||
|
||||
@UiField
|
||||
DropdownButton linkMap;
|
||||
|
@ -67,6 +68,8 @@ public class MapView extends Composite {
|
|||
HorizontalPanel coordinatePanel;
|
||||
|
||||
private LightOpenLayerMap lightOLSM;
|
||||
|
||||
private HTML attributionDiv = null;
|
||||
|
||||
private String theMapId = null;
|
||||
|
||||
|
@ -79,9 +82,9 @@ public class MapView extends Composite {
|
|||
public MapView(Coordinate centerTo, int zoom, String internalMapWidth, String internalMapHeight) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
theMapId = "map" + Random.nextInt();
|
||||
theMap.getElement().setId(theMapId);
|
||||
theMap.setWidth(internalMapWidth);
|
||||
theMap.setHeight(internalMapHeight);
|
||||
theMapPanel.getElement().setId(theMapId);
|
||||
theMapPanel.setWidth(internalMapWidth);
|
||||
theMapPanel.setHeight(internalMapHeight);
|
||||
|
||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||
|
||||
|
@ -101,7 +104,7 @@ public class MapView extends Composite {
|
|||
});
|
||||
}
|
||||
|
||||
public void setBaseLayers() {
|
||||
protected void setBaseLayers() {
|
||||
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||
|
||||
if(listBaseLayers==null)
|
||||
|
@ -117,15 +120,15 @@ public class MapView extends Composite {
|
|||
radio.setText(baseMapLayer.getName());
|
||||
if(i==0) {
|
||||
radio.setValue(true, false);
|
||||
setMapAttribution(baseMapLayer);
|
||||
}
|
||||
|
||||
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
//applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
|
||||
lightOLSM.changeBaseMap(baseMapLayer);
|
||||
|
||||
setMapAttribution(baseMapLayer);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -137,6 +140,22 @@ public class MapView extends Composite {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private void setMapAttribution(BaseMapLayer baseMapLayer) {
|
||||
|
||||
if(attributionDiv!=null)
|
||||
theMapPanel.remove(attributionDiv);
|
||||
|
||||
String attributionHTML = "<div class='map-internal-credits'><div class='map-internal-credits-container'>"
|
||||
+ baseMapLayer.getAttribution() + "</div></div>";
|
||||
attributionDiv = new HTML();
|
||||
|
||||
// THE OSM Contributors are automatically added by gwt-ol, others ones not.
|
||||
if (!baseMapLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
|
||||
attributionDiv.setHTML(attributionHTML);
|
||||
theMapPanel.add(attributionDiv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setMapSize() {
|
||||
|
@ -144,8 +163,8 @@ public class MapView extends Composite {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
int width = theMap.getParent().getOffsetWidth();
|
||||
int height = theMap.getParent().getOffsetHeight();
|
||||
int width = theMapPanel.getParent().getOffsetWidth();
|
||||
int height = theMapPanel.getParent().getOffsetHeight();
|
||||
if (width == 0)
|
||||
width = 300;
|
||||
|
||||
|
@ -153,7 +172,7 @@ public class MapView extends Composite {
|
|||
height = 300;
|
||||
|
||||
GWT.log("Internal Map w: " + width + ", h: " + height);
|
||||
theMap.setSize(width + "px", height + "px");
|
||||
theMapPanel.setSize(width + "px", height + "px");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
</ui:style>
|
||||
<g:HTMLPanel addStyleNames="map-style">
|
||||
<g:HTMLPanel ui:field="theMap" addStyleNames="internalMap">
|
||||
<g:HTMLPanel ui:field="theMapPanel" addStyleNames="internal-map">
|
||||
<b:DropdownButton type="LINK" title="Select the Map"
|
||||
addStyleNames="baseLayersMapLink" ui:field="linkMap">
|
||||
addStyleNames="base-internal-layers-maplink" ui:field="linkMap">
|
||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
|
|
|
@ -372,8 +372,26 @@ body {
|
|||
margin: 0px 0px;
|
||||
padding: 2px 4px;
|
||||
background: white;
|
||||
border-radius: 4px 0 0;
|
||||
}
|
||||
|
||||
.map-internal-credits {
|
||||
width: 100%;
|
||||
max-height: 25px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.map-internal-credits-container {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
display: block;
|
||||
padding: 2px 4px;
|
||||
background: white;
|
||||
border-radius: 4px 0 0;
|
||||
}
|
||||
|
||||
|
||||
.map-layers-radio {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
@ -391,7 +409,7 @@ body {
|
|||
|
||||
/************ INTERNAL MAP***************/
|
||||
|
||||
.internalMap {
|
||||
.internal-map {
|
||||
height: 280px;
|
||||
display: inline-block;
|
||||
margin: 0 auto;
|
||||
|
@ -406,22 +424,22 @@ body {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.baseLayersMapLink {
|
||||
.base-internal-layers-maplink {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
left: 40px;
|
||||
left: 45px;
|
||||
top: 40px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.baseLayersMapLink .btn-link {
|
||||
.base-internal-layers-maplink .btn-link {
|
||||
/*border: 1px solid #eee;*/
|
||||
border: 1px solid #005580;
|
||||
/*background-color: #fcfcfc;*/
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
.baseLayersMapLink .btn-link:hover, .inner-toolbar .btn-link:focus {
|
||||
.base-internal-layers-maplink .btn-link:hover, .inner-toolbar .btn-link:focus {
|
||||
background-color: #f3f3f3 !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue