mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-11 14:50:56 +00:00
Improve Height of the TabPanel and ensure the map gets information about
being resized when shown.
This commit is contained in:
1 parent
df8cd08de3
commit
559e09316c
3 files changed
+36
-4
No files matched your search
Executable → Regular
+11
-1
@@ -8,6 +8,8 @@ import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
@@ -57,11 +59,19 @@ public class AdminConsole implements EntryPoint, ErrorReporter, EventRefresher {
|
||||
eventDisplayers.add(windPanel);
|
||||
windPanel.setSize("90%", "90%");
|
||||
tabPanel.add(windPanel, stringConstants.wind(), false);
|
||||
RaceMapPanel raceMapPanel = new RaceMapPanel(sailingService, this, this, stringConstants);
|
||||
final RaceMapPanel raceMapPanel = new RaceMapPanel(sailingService, this, this, stringConstants);
|
||||
eventDisplayers.add(raceMapPanel);
|
||||
raceMapPanel.setSize("90%", "90%");
|
||||
tabPanel.add(raceMapPanel, stringConstants.map(), false);
|
||||
tabPanel.selectTab(0);
|
||||
tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Integer> event) {
|
||||
if(raceMapPanel.isVisible()) {
|
||||
raceMapPanel.onResize();
|
||||
}
|
||||
}
|
||||
});
|
||||
fillEvents();
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
+21
-3
@@ -43,6 +43,8 @@ import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.ProvidesResize;
|
||||
import com.google.gwt.user.client.ui.RequiresResize;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
@@ -54,7 +56,7 @@ import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
|
||||
public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListener {
|
||||
public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListener, ProvidesResize, RequiresResize {
|
||||
private final StringConstants stringConstants;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final ErrorReporter errorReporter;
|
||||
@@ -105,6 +107,7 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
grid.setSize("100%", "100%");
|
||||
grid.getColumnFormatter().setWidth(0, "20%");
|
||||
grid.getColumnFormatter().setWidth(1, "80%");
|
||||
grid.getCellFormatter().setHeight(1, 1, "100%");
|
||||
loadMapsAPI();
|
||||
raceListBox = new ListBox();
|
||||
raceList = new ArrayList<Pair<EventDAO, RaceDAO>>();
|
||||
@@ -187,7 +190,7 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
map.addControl(new MenuMapTypeControl());
|
||||
// Add the map to the HTML host page
|
||||
grid.setWidget(1, 1, map);
|
||||
map.setSize("100%", "500px");
|
||||
map.setSize("100%", "100%");
|
||||
map.setScrollWheelZoomEnabled(true);
|
||||
map.setContinuousZoom(true);
|
||||
map.addMapZoomEndHandler(new MapZoomEndHandler() {
|
||||
@@ -520,5 +523,20 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.user.client.ui.RequiresResize#onResize()
|
||||
*/
|
||||
@Override
|
||||
public void onResize() {
|
||||
//handle what is required by @link{ProvidesResize}
|
||||
Widget child = getWidget();
|
||||
if (child instanceof RequiresResize)
|
||||
((RequiresResize) child).onResize();
|
||||
//and ensure the map (indirect child) is also informed about resize
|
||||
if(this.map != null){
|
||||
this.map.onResize();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+4
@@ -32,3 +32,7 @@ h1 {
|
||||
#closeButton {
|
||||
margin: 15px 6px 6px;
|
||||
}
|
||||
|
||||
.gwt-TabPanelBottom {
|
||||
height: 100%;
|
||||
}
|
||||
Reference in new issue
Block a user