mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
Merge remote-tracking branch 'server/gwt' into gwt
This commit is contained in:
commit
203ca3b1c2
9 files changed
+61
-10
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
public interface UserAgentChecker {
|
||||
|
||||
public enum UserAgentTypes{ DESKTOP, MOBILE }
|
||||
|
||||
public final UserAgentCheckerImpl INSTANCE = new UserAgentCheckerImpl();
|
||||
|
||||
public UserAgentTypes checkUserAgent(String userAgent);
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
|
||||
public class UserAgentCheckerImpl implements UserAgentChecker {
|
||||
|
||||
private static final String[] MOBILE_SPECIFIC_SUBSTRING = { "iPhone", "Android", "MIDP", "Opera Mobi", "iPad",
|
||||
"Opera Mini", "BlackBerry", "HP iPAQ", "IEMobile", "MSIEMobile", "Windows Phone", "HTC", "LG", "MOT",
|
||||
"Nokia", "Symbian", "Fennec", "Maemo", "Tear", "Midori", "armv", "Windows CE", "WindowsCE", "Smartphone",
|
||||
"240x320", "176x220", "320x320", "160x160", "webOS", "Palm", "Sagem", "Samsung", "SGH", "SIE",
|
||||
"SonyEricsson", "MMP", "UCWEB" };
|
||||
|
||||
@Override
|
||||
public UserAgentTypes checkUserAgent(String userAgent) {
|
||||
UserAgentTypes agentType = UserAgentTypes.DESKTOP;
|
||||
for (String mobile : MOBILE_SPECIFIC_SUBSTRING) {
|
||||
if (userAgent.contains(mobile) || userAgent.contains(mobile.toUpperCase())
|
||||
|| userAgent.contains(mobile.toLowerCase())) {
|
||||
agentType = UserAgentTypes.MOBILE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return agentType;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-3
@@ -72,6 +72,8 @@ import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialog;
|
||||
import com.sap.sailing.gwt.ui.shared.panels.BusyIndicator;
|
||||
import com.sap.sailing.gwt.ui.shared.panels.SimpleBusyIndicator;
|
||||
|
||||
/**
|
||||
* ChartPanel is a GWT panel that can show one sort of competitor data (e.g. current speed over ground, windward distance to
|
||||
@@ -149,9 +151,8 @@ implements CompetitorSelectionChangeListener, RaceSelectionChangeListener, TimeL
|
||||
}
|
||||
loadingPanel = new AbsolutePanel();
|
||||
loadingPanel.setSize(width + "px", height + "px");
|
||||
Anchor a = new Anchor(new SafeHtmlBuilder().appendHtmlConstant("<img src=\"/gwt/images/ajax-loader.gif\"/>")
|
||||
.toSafeHtml());
|
||||
loadingPanel.add(a, width / 2 - 32 / 2, height / 2 - 32 - 2);
|
||||
BusyIndicator busyIndicator = new SimpleBusyIndicator(true, 1);
|
||||
loadingPanel.add(busyIndicator, width / 2 - 32 / 2, height / 2 - 32 - 2);
|
||||
chartPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
|
||||
chartPanel.setSpacing(5);
|
||||
legendPanel = new FlowPanel();
|
||||
|
||||
+5
-1
@@ -4,6 +4,7 @@ import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.cell.client.ActionCell;
|
||||
import com.google.gwt.cell.client.ActionCell.Delegate;
|
||||
import com.google.gwt.cell.client.ValueUpdater;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.EventTarget;
|
||||
import com.google.gwt.dom.client.NativeEvent;
|
||||
@@ -12,6 +13,7 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
|
||||
public class ExpandCollapseButtonCell extends AbstractCell<SafeHtml> {
|
||||
|
||||
private static final LeaderboardResources RESOURCES = GWT.create(LeaderboardResources.class);
|
||||
|
||||
private final SafeHtml html;
|
||||
private final Delegate<SafeHtml> delegate;
|
||||
@@ -27,8 +29,10 @@ public class ExpandCollapseButtonCell extends AbstractCell<SafeHtml> {
|
||||
super("click", "keydown");
|
||||
this.column = column;
|
||||
this.delegate = delegate;
|
||||
|
||||
String src = column.isExpanded() ? RESOURCES.magnifierSlashedIcon().getSafeUri().asString() : RESOURCES.magnifierIcon().getSafeUri().asString();
|
||||
this.html = new SafeHtmlBuilder().appendHtmlConstant(
|
||||
"<input class=\"valignMiddle magnifier\" type=\"image\" src=\"/gwt/images/"+(column.isExpanded()?"magnifier_slashed":"magnifier")+".png\" />").toSafeHtml();
|
||||
"<input class=\"valignMiddle magnifier\" type=\"image\" src=\"" + src + "\" />").toSafeHtml();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -860,7 +860,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
contentPanel = new VerticalPanel();
|
||||
headerPanel = new DockPanel();
|
||||
DockPanel toolbarPanel = new DockPanel();
|
||||
busyIndicator = new SimpleBusyIndicator();
|
||||
busyIndicator = new SimpleBusyIndicator(false, 0.8f);
|
||||
if (!isEmbedded) {
|
||||
toolbarPanel.add(busyIndicator, DockPanel.WEST);
|
||||
}
|
||||
|
||||
+6
@@ -16,4 +16,10 @@ interface LeaderboardResources extends ClientBundle {
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/chart.png")
|
||||
ImageResource chartIcon();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/magnifier.png")
|
||||
ImageResource magnifierIcon();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/magnifier_slashed.png")
|
||||
ImageResource magnifierSlashedIcon();
|
||||
}
|
||||
+9
-5
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.gwt.ui.shared.panels;
|
||||
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
public class SimpleBusyIndicator extends BusyIndicator {
|
||||
@@ -11,16 +12,21 @@ public class SimpleBusyIndicator extends BusyIndicator {
|
||||
* The busy indicator component is a circling GIF.
|
||||
*/
|
||||
public SimpleBusyIndicator() {
|
||||
this(false);
|
||||
this(false, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SimpleBusyIndicator with a custom <code>busy</code> state.<br />
|
||||
* The busy indicator component is a circling GIF.
|
||||
*
|
||||
* @param busy Sets the busy state of the BusyIndicator
|
||||
* @param scale Scales the displayed image. 1.0 is 100%, 0.50 is 50%, ...
|
||||
*/
|
||||
public SimpleBusyIndicator(boolean busy) {
|
||||
busyIndicator = new Image(RESOURCES.busyIndicatorCircle());
|
||||
public SimpleBusyIndicator(boolean busy, float scale) {
|
||||
ImageResource resource = RESOURCES.busyIndicatorCircle();
|
||||
busyIndicator = new Image(resource.getSafeUri());
|
||||
busyIndicator.setStyleName(STYLE_NAME_PREFIX + "busyIndicatorCircle");
|
||||
busyIndicator.setPixelSize((int) (resource.getWidth() * scale), (int) (resource.getHeight() * scale));
|
||||
add(busyIndicator);
|
||||
setBusy(busy);
|
||||
}
|
||||
@@ -29,8 +35,6 @@ public class SimpleBusyIndicator extends BusyIndicator {
|
||||
public void setBusy(boolean busy) {
|
||||
this.busy = busy;
|
||||
busyIndicator.setVisible(busy);
|
||||
// Element elem = busyIndicator.getElement();
|
||||
// DOM.setStyleAttribute(elem, "visibility", busy ? "visible" : "hidden");
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user