mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-31 08:17:16 +00:00
Work commit for Marcus Kammer to fix CSS issues.
This commit is contained in:
1 parent
f02ddeae41
commit
02fe9f0939
9 files changed
+393
-649
No files matched your search
@@ -307,4 +307,70 @@ img.openColumn {
|
||||
|
||||
.browserOptimizedMessage {
|
||||
padding: 15px 0px;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Begin CSS for WindowBox component:
|
||||
******************************************************************************/
|
||||
|
||||
.gwt-extras-WindowBox .dialogMiddleCenter {
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls {
|
||||
position: absolute;
|
||||
top: -50px;
|
||||
right: 2px;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a {
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 18px;
|
||||
width: 17px;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-close {
|
||||
background: transparent url(images/closeButton.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-close:hover {
|
||||
background: transparent url(images/closeButton.png) right top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-minimize {
|
||||
/*display: block;
|
||||
height: 12px;
|
||||
width: 12px;*/
|
||||
background: transparent url(images/min-4panel.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-minimize:hover {
|
||||
/*display: block;
|
||||
height: 12px;
|
||||
width: 12px;*/
|
||||
background: transparent url(images/min-4panel.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-minimize:hover {
|
||||
background: transparent url(images/min-4panel.png) right top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-maximize {
|
||||
/*display: block;
|
||||
height: 12px;
|
||||
width: 12px;*/
|
||||
background: transparent url(images/min-4panel.png) left bottom no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-maximize:hover {
|
||||
background: transparent url(images/min-4panel.png) right bottom no-repeat;
|
||||
}
|
||||
/*******************************************************************************
|
||||
* End of CSS for WindowBox component.
|
||||
******************************************************************************/
|
||||
|
||||
+162
-95
@@ -37,21 +37,25 @@ import com.sap.sailing.gwt.ui.client.Timer.PlayModes;
|
||||
import com.sap.sailing.gwt.ui.client.Timer.PlayStates;
|
||||
import com.sap.sailing.gwt.ui.client.media.MediaSelectionDialog.MediaSelectionListener;
|
||||
import com.sap.sailing.gwt.ui.client.media.popup.PopupWindowPlayer;
|
||||
import com.sap.sailing.gwt.ui.client.media.popup.PopupWindowPlayer.PopupCloseListener;
|
||||
import com.sap.sailing.gwt.ui.client.media.popup.VideoWindowPlayer;
|
||||
import com.sap.sailing.gwt.ui.client.media.shared.MediaPlayer;
|
||||
import com.sap.sailing.gwt.ui.client.media.shared.VideoPlayer;
|
||||
import com.sap.sailing.gwt.ui.client.shared.media.MediaTrack;
|
||||
import com.sap.sailing.gwt.ui.client.shared.media.MediaTrack.MediaType;
|
||||
import com.sap.sailing.gwt.ui.client.shared.media.MediaTrack.MimeType;
|
||||
import com.sap.sailing.gwt.ui.client.shared.media.MediaTrack.Status;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceTimesInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.UserDTO;
|
||||
|
||||
public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlayStateListener, TimeListener,
|
||||
public class MediaSelector implements /* RaceTimesInfoProviderListener, */PlayStateListener, TimeListener,
|
||||
AsyncCallback<Collection<MediaTrack>>, MediaSelectionListener, CloseHandler<Window>, ClosingHandler {
|
||||
|
||||
private final CheckBox toggleMediaButton;
|
||||
private final Button manageMediaButton;
|
||||
private final Button addMediaButton;
|
||||
|
||||
private final Button marcusStylingButton;
|
||||
|
||||
private final MediaSelectionDialog mediaSelectionDialog;
|
||||
|
||||
private final Map<MediaTrack, MediaPlayer> videoPlayers = new HashMap<MediaTrack, MediaPlayer>();
|
||||
@@ -70,7 +74,9 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
private double currentPlaybackSpeed = 1.0d;
|
||||
private PlayStates currentPlayState = PlayStates.Paused;
|
||||
|
||||
public MediaSelector(RegattaAndRaceIdentifier selectedRaceIdentifier, RaceTimesInfoProvider raceTimesInfoProvider, Timer raceTimer, MediaServiceAsync mediaService, StringMessages stringMessages, ErrorReporter errorReporter, UserDTO user) {
|
||||
public MediaSelector(RegattaAndRaceIdentifier selectedRaceIdentifier, RaceTimesInfoProvider raceTimesInfoProvider,
|
||||
Timer raceTimer, MediaServiceAsync mediaService, StringMessages stringMessages,
|
||||
ErrorReporter errorReporter, UserDTO user) {
|
||||
this.raceIdentifier = selectedRaceIdentifier;
|
||||
this.raceTimesInfoProvider = raceTimesInfoProvider;
|
||||
this.raceTimer = raceTimer;
|
||||
@@ -78,15 +84,15 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
this.stringMessages = stringMessages;
|
||||
this.errorReporter = errorReporter;
|
||||
this.user = user;
|
||||
|
||||
|
||||
Window.addCloseHandler(this);
|
||||
Window.addWindowClosingHandler(this);
|
||||
|
||||
mediaSelectionDialog = new MediaSelectionDialog(this);
|
||||
|
||||
mediaSelectionDialog = new MediaSelectionDialog(this);
|
||||
|
||||
manageMediaButton = new Button();
|
||||
manageMediaButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (mediaSelectionDialog.isShowing()) {
|
||||
@@ -102,14 +108,15 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
switch (mediaTrack.mimeType.mediaType) {
|
||||
case video:
|
||||
reachableVideoTracks.add(mediaTrack);
|
||||
case audio: //intentional fall through
|
||||
case audio: // intentional fall through
|
||||
reachableAudioTracks.add(mediaTrack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean showAddButton = MediaSelector.this.user != null;
|
||||
mediaSelectionDialog.show(reachableVideoTracks , playingVideoTracks, reachableAudioTracks, playingAudioTrack, showAddButton, toggleMediaButton);
|
||||
mediaSelectionDialog.show(reachableVideoTracks, playingVideoTracks, reachableAudioTracks,
|
||||
playingAudioTrack, showAddButton, toggleMediaButton);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -117,7 +124,6 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
manageMediaButton.getElement().getStyle().setFloat(Style.Float.LEFT);
|
||||
manageMediaButton.setTitle("Configure Media");
|
||||
|
||||
|
||||
toggleMediaButton = new CheckBox("Audio & Video");
|
||||
toggleMediaButton.addStyleName("raceBoardNavigation-innerElement");
|
||||
toggleMediaButton.getElement().getStyle().setFloat(Style.Float.LEFT);
|
||||
@@ -135,51 +141,86 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
addMediaButton = new Button("Add", new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Date defaultStartTime = new Date(getRaceStartTime());
|
||||
MediaTrackDialog dialog = new MediaTrackDialog(defaultStartTime, MediaSelector.this.stringMessages, new DialogCallback<MediaTrack>() {
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
// no op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ok(final MediaTrack mediaTrack) {
|
||||
MediaSelector.this.mediaService.addMediaTrack(mediaTrack, new AsyncCallback<String>() {
|
||||
MediaTrackDialog dialog = new MediaTrackDialog(defaultStartTime, MediaSelector.this.stringMessages,
|
||||
new DialogCallback<MediaTrack>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void cancel() {
|
||||
// no op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String dbId) {
|
||||
mediaTrack.dbId = dbId;
|
||||
videoSelected(mediaTrack);
|
||||
public void ok(final MediaTrack mediaTrack) {
|
||||
MediaSelector.this.mediaService.addMediaTrack(mediaTrack, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String dbId) {
|
||||
mediaTrack.dbId = dbId;
|
||||
videoSelected(mediaTrack);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
marcusStylingButton = new Button("Marcus", new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
MediaTrack videoTrack = new MediaTrack();
|
||||
boolean showSynchControls = true;
|
||||
videoTrack.durationInMillis = 990000;
|
||||
videoTrack.mimeType = MimeType.ogv;
|
||||
videoTrack.startTime = new Date(1352032110000l);
|
||||
videoTrack.status = Status.REACHABLE;
|
||||
videoTrack.title = "Marcus - Test";
|
||||
videoTrack.url = "http://ftp.realtvgroup.com/matchrace/programm/121104/121104_kleines_finale.mp4";
|
||||
new VideoEmbeddedPlayer(videoTrack, getRaceStartTime(), showSynchControls,
|
||||
MediaSelector.this.raceTimer, MediaSelector.this.mediaService,
|
||||
MediaSelector.this.errorReporter, new PopupCloseListener() {
|
||||
|
||||
@Override
|
||||
public void popupClosed() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}, new PopoutListener() {
|
||||
|
||||
@Override
|
||||
public void popoutVideo(MediaTrack videoTrack) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
setWidgetsVisible(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean isPotentiallyPlayable(MediaTrack mediaTrack) {
|
||||
return MediaTrack.Status.REACHABLE.equals(mediaTrack.status) || MediaTrack.Status.UNDEFINED.equals(mediaTrack.status);
|
||||
return MediaTrack.Status.REACHABLE.equals(mediaTrack.status)
|
||||
|| MediaTrack.Status.UNDEFINED.equals(mediaTrack.status);
|
||||
}
|
||||
|
||||
private void setStatus(final MediaTrack mediaTrack) {
|
||||
if (!mediaTrack.isYoutube()) {
|
||||
Audio audio = Audio.createIfSupported();
|
||||
if (audio != null) {
|
||||
if (audio != null) {
|
||||
AudioElement mediaReachableTester = audio.getAudioElement();
|
||||
addLoadMetadataHandler(mediaReachableTester, mediaTrack);
|
||||
mediaReachableTester.setPreload(MediaElement.PRELOAD_METADATA);
|
||||
@@ -193,37 +234,43 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
native void addLoadMetadataHandler(MediaElement mediaElement, MediaTrack mediaTrack) /*-{
|
||||
var that = this;
|
||||
mediaElement.addEventListener('loadedmetadata', function() {
|
||||
that.@com.sap.sailing.gwt.ui.client.media.MediaSelector::loadedmetadata(Lcom/sap/sailing/gwt/ui/client/shared/media/MediaTrack;)(mediaTrack);
|
||||
});
|
||||
mediaElement.addEventListener('error', function() {
|
||||
that.@com.sap.sailing.gwt.ui.client.media.MediaSelector::mediaError(Lcom/sap/sailing/gwt/ui/client/shared/media/MediaTrack;)(mediaTrack);
|
||||
});
|
||||
native void addLoadMetadataHandler(MediaElement mediaElement, MediaTrack mediaTrack) /*-{
|
||||
var that = this;
|
||||
mediaElement
|
||||
.addEventListener(
|
||||
'loadedmetadata',
|
||||
function() {
|
||||
that.@com.sap.sailing.gwt.ui.client.media.MediaSelector::loadedmetadata(Lcom/sap/sailing/gwt/ui/client/shared/media/MediaTrack;)(mediaTrack);
|
||||
});
|
||||
mediaElement
|
||||
.addEventListener(
|
||||
'error',
|
||||
function() {
|
||||
that.@com.sap.sailing.gwt.ui.client.media.MediaSelector::mediaError(Lcom/sap/sailing/gwt/ui/client/shared/media/MediaTrack;)(mediaTrack);
|
||||
});
|
||||
}-*/;
|
||||
|
||||
|
||||
public void loadedmetadata(MediaTrack mediaTrack) {
|
||||
mediaTrack.status = Status.REACHABLE;
|
||||
}
|
||||
|
||||
|
||||
public void mediaError(MediaTrack mediaTrack) {
|
||||
mediaTrack.status = Status.NOT_REACHABLE;
|
||||
}
|
||||
|
||||
private void playDefault() {
|
||||
MediaTrack defaultVideo = getDefaultVideo();
|
||||
if (defaultVideo != null) {
|
||||
videoSelected(defaultVideo );
|
||||
}
|
||||
MediaTrack defaultAudio = getDefaultAudio();
|
||||
if (defaultAudio != null) {
|
||||
audioChanged(defaultAudio);
|
||||
}
|
||||
MediaTrack defaultVideo = getDefaultVideo();
|
||||
if (defaultVideo != null) {
|
||||
videoSelected(defaultVideo);
|
||||
}
|
||||
MediaTrack defaultAudio = getDefaultAudio();
|
||||
if (defaultAudio != null) {
|
||||
audioChanged(defaultAudio);
|
||||
}
|
||||
}
|
||||
|
||||
private MediaTrack getDefaultAudio() {
|
||||
//TODO: implement a better heuristic than just taking the first to come
|
||||
// TODO: implement a better heuristic than just taking the first to come
|
||||
for (MediaTrack mediaTrack : mediaTracks) {
|
||||
if (MediaType.audio.equals(mediaTrack.mimeType.mediaType) && isPotentiallyPlayable(mediaTrack)) {
|
||||
return mediaTrack;
|
||||
@@ -245,7 +292,6 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void playStateChanged(PlayStates playState, PlayModes playMode) {
|
||||
this.currentPlayState = playState;
|
||||
@@ -255,7 +301,7 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
startPlaying();
|
||||
break;
|
||||
case Paused:
|
||||
//fall through to Stopped
|
||||
// fall through to Stopped
|
||||
case Stopped:
|
||||
pausePlaying();
|
||||
default:
|
||||
@@ -276,7 +322,7 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
videoPlayer.setPlaybackSpeed(this.currentPlaybackSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void pausePlaying() {
|
||||
if (activeAudioPlayer != null) {
|
||||
activeAudioPlayer.pauseMedia();
|
||||
@@ -316,8 +362,7 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
setWidgetsVisible(false);
|
||||
errorReporter
|
||||
.reportError("Remote Procedure Call getMediaTracksForRace(...) - Failure: " + caught.getMessage());
|
||||
errorReporter.reportError("Remote Procedure Call getMediaTracksForRace(...) - Failure: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -334,8 +379,8 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
manageMediaButton.setVisible(isVisible);
|
||||
toggleMediaButton.setVisible(isVisible);
|
||||
}
|
||||
|
||||
//@Override
|
||||
|
||||
// @Override
|
||||
public void _raceTimesInfosReceived(Map<RegattaAndRaceIdentifier, RaceTimesInfoDTO> raceTimesInfo) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -343,20 +388,22 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
|
||||
@Override
|
||||
public void audioChanged(MediaTrack audioTrack) {
|
||||
if (activeAudioPlayer != null) { // --> then reset active audio player
|
||||
|
||||
if (activeAudioPlayer != null) { // --> then reset active audio player
|
||||
|
||||
if (activeAudioPlayer.getMediaTrack() == audioTrack) {
|
||||
return; //nothing changed
|
||||
return; // nothing changed
|
||||
}
|
||||
|
||||
if (videoPlayers.containsKey(activeAudioPlayer.getMediaTrack())) { //pre-change audioPlayer is one of the videoPlayers
|
||||
|
||||
if (videoPlayers.containsKey(activeAudioPlayer.getMediaTrack())) { // pre-change audioPlayer is one of the
|
||||
// videoPlayers
|
||||
activeAudioPlayer.setMuted(true);
|
||||
} else { //pre-change audioPlayer is a dedicated audio-only player
|
||||
} else { // pre-change audioPlayer is a dedicated audio-only player
|
||||
activeAudioPlayer.destroy();
|
||||
}
|
||||
activeAudioPlayer = null;
|
||||
}
|
||||
if ((audioTrack != null) && audioTrack.isYoutube()) { // --> Youtube videos can't be played for audio-only. So add a video player first.
|
||||
if ((audioTrack != null) && audioTrack.isYoutube()) { // --> Youtube videos can't be played for audio-only. So
|
||||
// add a video player first.
|
||||
videoSelected(audioTrack);
|
||||
mediaSelectionDialog.selectVideo(audioTrack);
|
||||
}
|
||||
@@ -367,46 +414,64 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
} else {
|
||||
assignNewAudioPlayer(audioTrack);
|
||||
}
|
||||
|
||||
|
||||
updateToggleButton();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void videoSelected(final MediaTrack videoTrack) {
|
||||
MediaPlayer playingVideo = videoPlayers.get(videoTrack);
|
||||
if (playingVideo == null) {
|
||||
PopupWindowPlayer.PopupCloseListener popupCloseListener = new PopupWindowPlayer.PopupCloseListener() {
|
||||
final PopupWindowPlayer.PopupCloseListener popupCloseListener = new PopupWindowPlayer.PopupCloseListener() {
|
||||
@Override
|
||||
public void popupClosed() {
|
||||
videoDeselected(videoTrack);
|
||||
}
|
||||
};
|
||||
PopoutListener popoutListener = new PopoutListener() {
|
||||
|
||||
@Override
|
||||
public void popoutVideo(MediaTrack videoTrack) {
|
||||
videoDeselected(videoTrack);
|
||||
VideoPlayer popupPlayer = new VideoWindowPlayer(videoTrack, popupCloseListener);
|
||||
registerVideo(videoTrack, popupPlayer);
|
||||
}
|
||||
};
|
||||
|
||||
final VideoPlayer popupPlayer;
|
||||
|
||||
|
||||
boolean showSynchControls = this.user != null;
|
||||
if (videoTrack.isYoutube()) {
|
||||
// popupPlayer = new YoutubeWindowPlayer(videoTrack, popCloseListener);
|
||||
popupPlayer = new YoutubeEmbeddedPlayer(videoTrack, getRaceStartTime(), showSynchControls, raceTimer, mediaService, errorReporter, popupCloseListener);
|
||||
// popupPlayer = new YoutubeWindowPlayer(videoTrack, popCloseListener);
|
||||
popupPlayer = new YoutubeEmbeddedPlayer(videoTrack, getRaceStartTime(), showSynchControls, raceTimer,
|
||||
mediaService, errorReporter, popupCloseListener, popoutListener);
|
||||
} else {
|
||||
// popupPlayer = new VideoWindowPlayer(videoTrack, popCloseListener);
|
||||
popupPlayer = new VideoEmbeddedPlayer(videoTrack, getRaceStartTime(), showSynchControls, raceTimer, mediaService, errorReporter, popupCloseListener);
|
||||
// popupPlayer = new VideoWindowPlayer(videoTrack, popCloseListener);
|
||||
popupPlayer = new VideoEmbeddedPlayer(videoTrack, getRaceStartTime(), showSynchControls, raceTimer,
|
||||
mediaService, errorReporter, popupCloseListener, popoutListener);
|
||||
}
|
||||
videoPlayers.put(videoTrack, popupPlayer);
|
||||
if ((activeAudioPlayer != null) && (activeAudioPlayer.getMediaTrack() == videoTrack)) { //selected video track has been playing as audio-only
|
||||
activeAudioPlayer.pauseMedia();
|
||||
activeAudioPlayer = popupPlayer;
|
||||
popupPlayer.setMuted(false);
|
||||
} else {
|
||||
popupPlayer.setMuted(true);
|
||||
}
|
||||
synchPlayState(popupPlayer);
|
||||
registerVideo(videoTrack, popupPlayer);
|
||||
} else {
|
||||
//nothing changed
|
||||
// nothing changed
|
||||
}
|
||||
|
||||
|
||||
updateToggleButton();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void registerVideo(final MediaTrack videoTrack, final VideoPlayer popupPlayer) {
|
||||
videoPlayers.put(videoTrack, popupPlayer);
|
||||
if ((activeAudioPlayer != null) && (activeAudioPlayer.getMediaTrack() == videoTrack)) { // selected video track
|
||||
// has been playing as
|
||||
// audio-only
|
||||
activeAudioPlayer.pauseMedia();
|
||||
activeAudioPlayer = popupPlayer;
|
||||
popupPlayer.setMuted(false);
|
||||
} else {
|
||||
popupPlayer.setMuted(true);
|
||||
}
|
||||
synchPlayState(popupPlayer);
|
||||
}
|
||||
|
||||
private long getRaceStartTime() {
|
||||
@@ -419,7 +484,8 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
MediaPlayer removedVideoPlayer = videoPlayers.remove(videoTrack);
|
||||
if (removedVideoPlayer != null) {
|
||||
removedVideoPlayer.destroy();
|
||||
if (removedVideoPlayer == activeAudioPlayer) { //in case this video has been the sound source, replace the video player with a dedicated audio player
|
||||
if (removedVideoPlayer == activeAudioPlayer) { // in case this video has been the sound source, replace the
|
||||
// video player with a dedicated audio player
|
||||
if (removedVideoPlayer.getMediaTrack().isYoutube()) {
|
||||
assignNewAudioPlayer(null);
|
||||
} else {
|
||||
@@ -429,9 +495,9 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
}
|
||||
|
||||
updateToggleButton();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void updateToggleButton() {
|
||||
toggleMediaButton.setValue((activeAudioPlayer != null) || (!videoPlayers.isEmpty()));
|
||||
}
|
||||
@@ -439,13 +505,13 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
private void assignNewAudioPlayer(MediaTrack audioTrack) {
|
||||
if (audioTrack != null) {
|
||||
activeAudioPlayer = new AudioPlayer(audioTrack);
|
||||
|
||||
|
||||
synchPlayState(activeAudioPlayer);
|
||||
} else {
|
||||
activeAudioPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void synchPlayState(final MediaPlayer mediaPlayer) {
|
||||
mediaPlayer.setPlaybackSpeed(currentPlaybackSpeed);
|
||||
mediaPlayer.raceTimeChanged(this.currentRaceTime);
|
||||
@@ -460,7 +526,7 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
}
|
||||
break;
|
||||
case Paused:
|
||||
//fall through to Stopped
|
||||
// fall through to Stopped
|
||||
case Stopped:
|
||||
if (!mediaPlayer.isMediaPaused()) {
|
||||
mediaPlayer.pauseMedia();
|
||||
@@ -471,7 +537,7 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
}
|
||||
|
||||
public Widget[] widgets() {
|
||||
return new Widget[] {toggleMediaButton, manageMediaButton, addMediaButton};
|
||||
return new Widget[] { toggleMediaButton, manageMediaButton, addMediaButton, marcusStylingButton };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -486,7 +552,8 @@ public class MediaSelector implements /*RaceTimesInfoProviderListener,*/ PlaySta
|
||||
|
||||
private void clear() {
|
||||
if (activeAudioPlayer != null) {
|
||||
videoPlayers.remove(activeAudioPlayer); //just to ensure that a potentially audio-playing video player is not destroyed a second time in the following video loop.
|
||||
videoPlayers.remove(activeAudioPlayer); // just to ensure that a potentially audio-playing video player is
|
||||
// not destroyed a second time in the following video loop.
|
||||
activeAudioPlayer.destroy();
|
||||
activeAudioPlayer = null;
|
||||
}
|
||||
|
||||
+39
-34
@@ -2,29 +2,31 @@ package com.sap.sailing.gwt.ui.client.media;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.ToggleButton;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class MediaSynchControl {
|
||||
|
||||
private static final int FAST = 1000;
|
||||
private static final int SLOW = 100;
|
||||
|
||||
private final HorizontalPanel mainPanel;
|
||||
private final HorizontalPanel buttonPanel;
|
||||
|
||||
private final FlowPanel mainPanel;
|
||||
private final FlowPanel buttonPanel;
|
||||
private final MediaSynchAdapter mediaSynchAdapter;
|
||||
private final TextBox offsetEdit;
|
||||
private final ToggleButton lockButton;
|
||||
private final CheckBox lockToggle;
|
||||
|
||||
public MediaSynchControl(MediaSynchAdapter mediaSynchListener) {
|
||||
this.mediaSynchAdapter = mediaSynchListener;
|
||||
mainPanel = new HorizontalPanel();
|
||||
buttonPanel = new HorizontalPanel();
|
||||
mainPanel = new FlowPanel();
|
||||
buttonPanel = new FlowPanel();
|
||||
Button fastRewindButton = new Button("<p>-1s <<</p>", new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -61,16 +63,21 @@ public class MediaSynchControl {
|
||||
discard();
|
||||
}
|
||||
});
|
||||
|
||||
lockButton = new ToggleButton("Locked", "Unlocked", new ClickHandler() {
|
||||
|
||||
lockToggle = new CheckBox("Locked");
|
||||
lockToggle
|
||||
.setTitle("Uncheck to decouple video from race. Use video controls to adjust video/race synchronization. Re-check when finished.");
|
||||
lockToggle.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setLocked(!isLocked());
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
setLocked(isLocked());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
offsetEdit = new TextBox();
|
||||
|
||||
|
||||
buttonPanel.add(fastRewindButton);
|
||||
buttonPanel.add(slowRewindButton);
|
||||
buttonPanel.add(new Label("Offset:"));
|
||||
@@ -80,11 +87,11 @@ public class MediaSynchControl {
|
||||
buttonPanel.add(saveButton);
|
||||
buttonPanel.add(discardButton);
|
||||
mainPanel.add(buttonPanel);
|
||||
mainPanel.add(lockButton);
|
||||
mainPanel.add(lockToggle);
|
||||
|
||||
setLocked(true);
|
||||
lockToggle.setValue(true);
|
||||
updateOffset();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void discard() {
|
||||
@@ -97,26 +104,24 @@ public class MediaSynchControl {
|
||||
}
|
||||
|
||||
private void setLocked(boolean isLocked) {
|
||||
if (isLocked != this.isLocked()) {
|
||||
for (int i = 0; i < buttonPanel.getWidgetCount(); i++) {
|
||||
Widget widget = buttonPanel.getWidget(i);
|
||||
if (widget instanceof FocusWidget) {
|
||||
((FocusWidget) widget).setEnabled(isLocked());
|
||||
}
|
||||
for (int i = 0; i < buttonPanel.getWidgetCount(); i++) {
|
||||
Widget widget = buttonPanel.getWidget(i);
|
||||
if (widget instanceof FocusWidget) {
|
||||
((FocusWidget) widget).setEnabled(isLocked());
|
||||
}
|
||||
mediaSynchAdapter.setControlsVisible(!isLocked());
|
||||
|
||||
mediaSynchAdapter.pauseMedia();
|
||||
mediaSynchAdapter.pauseRace();
|
||||
if (isLocked()) {
|
||||
mediaSynchAdapter.updateOffset();
|
||||
}
|
||||
updateOffset();
|
||||
}
|
||||
mediaSynchAdapter.setControlsVisible(!isLocked());
|
||||
|
||||
mediaSynchAdapter.pauseMedia();
|
||||
mediaSynchAdapter.pauseRace();
|
||||
if (isLocked()) {
|
||||
mediaSynchAdapter.updateOffset();
|
||||
}
|
||||
updateOffset();
|
||||
}
|
||||
|
||||
private boolean isLocked() {
|
||||
return !lockButton.isDown();
|
||||
return lockToggle.getValue();
|
||||
}
|
||||
|
||||
private void fastForward() {
|
||||
@@ -134,7 +139,7 @@ public class MediaSynchControl {
|
||||
private void fastRewind() {
|
||||
changeOffsetBy(-FAST);
|
||||
}
|
||||
|
||||
|
||||
private void changeOffsetBy(int delta) {
|
||||
mediaSynchAdapter.changeOffsetBy(delta);
|
||||
updateOffset();
|
||||
@@ -147,5 +152,5 @@ public class MediaSynchControl {
|
||||
public Widget widget() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.sap.sailing.gwt.ui.client.media;
|
||||
|
||||
import com.sap.sailing.gwt.ui.client.shared.media.MediaTrack;
|
||||
|
||||
public interface PopoutListener {
|
||||
|
||||
void popoutVideo(MediaTrack videoTrack);
|
||||
|
||||
}
|
||||
+14
-9
@@ -7,8 +7,8 @@ import com.google.gwt.event.logical.shared.CloseHandler;
|
||||
import com.google.gwt.media.client.MediaBase;
|
||||
import com.google.gwt.media.client.Video;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.PopupPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.MediaServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
@@ -29,22 +29,21 @@ public class VideoEmbeddedPlayer extends AbstractEmbeddedMediaPlayer implements
|
||||
private final Timer raceTimer;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final PopupCloseListener popupCloseListener;
|
||||
private final PopoutListener popoutListener;
|
||||
|
||||
public VideoEmbeddedPlayer(MediaTrack videoTrack, long raceStartTimeMillis, boolean showSynchControls, Timer raceTimer, MediaServiceAsync mediaService, ErrorReporter errorReporter, PopupCloseListener popCloseListener) {
|
||||
public VideoEmbeddedPlayer(final MediaTrack videoTrack, long raceStartTimeMillis, boolean showSynchControls, Timer raceTimer, MediaServiceAsync mediaService, ErrorReporter errorReporter, PopupCloseListener popCloseListener, PopoutListener popoutListener) {
|
||||
super(videoTrack);
|
||||
this.raceTimer = raceTimer;
|
||||
this.mediaService = mediaService;
|
||||
this.errorReporter = errorReporter;
|
||||
this.popoutListener = popoutListener;
|
||||
backupVideoTrack = new MediaTrack(videoTrack.dbId, videoTrack.title, videoTrack.url, videoTrack.startTime, videoTrack.durationInMillis, videoTrack.mimeType);
|
||||
|
||||
|
||||
this.raceStartTimeMillis = raceStartTimeMillis;
|
||||
this.popupCloseListener = popCloseListener;
|
||||
|
||||
this.dialogBox = new WindowBox(false, false, true, true);
|
||||
dialogBox.setText(videoTrack.title);
|
||||
dialogBox.setTitle(videoTrack.toString());
|
||||
|
||||
FlowPanel rootPanel = new FlowPanel();
|
||||
if (mediaControl != null) {
|
||||
|
||||
|
||||
@@ -54,17 +53,23 @@ public class VideoEmbeddedPlayer extends AbstractEmbeddedMediaPlayer implements
|
||||
// SimplePanel videoFrameHolder = new SimplePanel();
|
||||
// videoFrameHolder.add(videoFrame);
|
||||
|
||||
VerticalPanel rootPanel = new VerticalPanel();
|
||||
if (showSynchControls) {
|
||||
|
||||
mediaSynchControl = new MediaSynchControl(this);
|
||||
rootPanel.add(mediaSynchControl.widget());
|
||||
}
|
||||
rootPanel.add(mediaControl);
|
||||
dialogBox.setWidget(rootPanel);
|
||||
}
|
||||
|
||||
this.dialogBox = new WindowBox(videoTrack.title, videoTrack.toString(), rootPanel, new WindowBox.PopoutHandler() {
|
||||
|
||||
@Override
|
||||
public void popout() {
|
||||
VideoEmbeddedPlayer.this.popoutListener.popoutVideo(videoTrack);
|
||||
|
||||
}
|
||||
});
|
||||
dialogBox.addCloseHandler(this);
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
+14
-9
@@ -5,8 +5,8 @@ import java.util.Date;
|
||||
import com.google.gwt.event.logical.shared.CloseEvent;
|
||||
import com.google.gwt.event.logical.shared.CloseHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.PopupPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.MediaServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
@@ -29,21 +29,19 @@ public class YoutubeEmbeddedPlayer extends AbstractMediaPlayer implements VideoP
|
||||
private final ErrorReporter errorReporter;
|
||||
private final PopupCloseListener popupCloseListener;
|
||||
private final YoutubeVideoControl videoControl;
|
||||
private final PopoutListener popoutListener;
|
||||
|
||||
public YoutubeEmbeddedPlayer(MediaTrack videoTrack, long raceStartTimeMillis, boolean showSynchControls, Timer raceTimer, MediaServiceAsync mediaService, ErrorReporter errorReporter, PopupCloseListener popupCloseListener) {
|
||||
public YoutubeEmbeddedPlayer(final MediaTrack videoTrack, long raceStartTimeMillis, boolean showSynchControls, Timer raceTimer, MediaServiceAsync mediaService, ErrorReporter errorReporter, PopupCloseListener popupCloseListener, PopoutListener popoutListener) {
|
||||
super(videoTrack);
|
||||
this.raceTimer = raceTimer;
|
||||
this.raceStartTimeMillis = raceStartTimeMillis;
|
||||
this.popupCloseListener = popupCloseListener;
|
||||
this.mediaService = mediaService;
|
||||
this.errorReporter = errorReporter;
|
||||
this.popoutListener = popoutListener;
|
||||
backupVideoTrack = new MediaTrack(null, videoTrack.title, videoTrack.url, videoTrack.startTime, videoTrack.durationInMillis, videoTrack.mimeType);
|
||||
|
||||
this.dialogBox = new WindowBox(false, false, true, true);
|
||||
dialogBox.setText(videoTrack.title);
|
||||
dialogBox.setTitle(videoTrack.toString());
|
||||
|
||||
VerticalPanel rootPanel = new VerticalPanel();
|
||||
FlowPanel rootPanel = new FlowPanel();
|
||||
if (showSynchControls) {
|
||||
mediaSynchControl = new MediaSynchControl(this);
|
||||
rootPanel.add(mediaSynchControl.widget());
|
||||
@@ -51,9 +49,16 @@ public class YoutubeEmbeddedPlayer extends AbstractMediaPlayer implements VideoP
|
||||
|
||||
videoControl = new YoutubeVideoControl(videoTrack.url);
|
||||
rootPanel.add(videoControl.widget());
|
||||
dialogBox.setWidget(rootPanel);
|
||||
|
||||
this.dialogBox = new WindowBox(videoTrack.title, videoTrack.toString(), rootPanel, new WindowBox.PopoutHandler() {
|
||||
|
||||
@Override
|
||||
public void popout() {
|
||||
YoutubeEmbeddedPlayer.this.popoutListener.popoutVideo(videoTrack);
|
||||
|
||||
}
|
||||
});
|
||||
dialogBox.addCloseHandler(this);
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Default CSS for the clazzes.org gwt-extras Project
|
||||
*
|
||||
* defines default values for all widgets in this project.
|
||||
******************************************************************************/
|
||||
|
||||
.gwt-drag-hint {
|
||||
color: grey;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.gwt-extras-search {
|
||||
color: black;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.gwt-extras-search-hint {
|
||||
color: silver;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.gwt-extras-search-suggest {
|
||||
background-color: white;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.gwt-extras-search-suggest .item {
|
||||
color: black;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.gwt-extras-search-suggest .item-selected {
|
||||
color: black;
|
||||
background-color: silver;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.gwt-extras-input {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.gwt-extras-input-invalid {
|
||||
background-color: #FFADAD;
|
||||
border-color: red;
|
||||
}
|
||||
|
||||
.gwt-extras-InputBox {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.gwt-extras-InputBox-invalid {
|
||||
background-color: #FFADAD;
|
||||
border-color: red;
|
||||
}
|
||||
|
||||
.gwt-extras-Spinbox {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
table .gwt-extras-Spinbox, table .gwt-extras-Spinbox th, table .gwt-extras-Spinbox td {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
padding: 0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
a.gwt-extras-Spinbox-button {
|
||||
display: block;
|
||||
padding: 0;
|
||||
width: 1em;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
background: buttonface;
|
||||
text-decoration: none;
|
||||
font-size: 0.65em;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
a.gwt-extras-Spinbox-button:link, a.gwt-extras-Spinbox-button:hover, a.gwt-extras-Spinbox-button:visited {
|
||||
color: black;
|
||||
border: outset 1.5px buttonface;
|
||||
}
|
||||
|
||||
a.gwt-extras-Spinbox-button:active {
|
||||
color: black;
|
||||
border: inset 1.5px buttonface;
|
||||
}
|
||||
|
||||
|
||||
.gwt-extras-DisclosurePopout-popout {
|
||||
background-color: white;
|
||||
border: solid 1px black;
|
||||
}
|
||||
|
||||
.gwt-extras-DisclosurePopout-header {
|
||||
background-color: white;
|
||||
padding: 1px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .dialogMiddleCenter {
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls {
|
||||
position: absolute;
|
||||
top: -50px;
|
||||
right: 2px;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a {
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 18px;
|
||||
width: 17px;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-close {
|
||||
background: transparent url(images/closeButton.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-close:hover {
|
||||
background: transparent url(images/closeButton.png) right top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-minimize {
|
||||
/*display: block;
|
||||
height: 12px;
|
||||
width: 12px;*/
|
||||
background: transparent url(images/min-4panel.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-minimize:hover {
|
||||
/*display: block;
|
||||
height: 12px;
|
||||
width: 12px;*/
|
||||
background: transparent url(images/min-4panel.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-minimize:hover {
|
||||
background: transparent url(images/min-4panel.png) right top no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-maximize {
|
||||
/*display: block;
|
||||
height: 12px;
|
||||
width: 12px;*/
|
||||
background: transparent url(images/min-4panel.png) left bottom no-repeat;
|
||||
}
|
||||
|
||||
.gwt-extras-WindowBox .gwt-extras-dialog-controls a.gwt-extras-dialog-maximize:hover {
|
||||
background: transparent url(images/min-4panel.png) right bottom no-repeat;
|
||||
}
|
||||
+86
-339
@@ -19,7 +19,6 @@ package com.sap.sailing.gwt.ui.client.shared.controls.dialog;
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.NativeEvent;
|
||||
import com.google.gwt.dom.client.Style.Cursor;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -28,13 +27,6 @@ import com.google.gwt.event.dom.client.DomEvent;
|
||||
import com.google.gwt.event.dom.client.MouseDownEvent;
|
||||
import com.google.gwt.event.dom.client.MouseMoveEvent;
|
||||
import com.google.gwt.event.dom.client.MouseUpEvent;
|
||||
import com.google.gwt.event.logical.shared.HasOpenHandlers;
|
||||
import com.google.gwt.event.logical.shared.OpenEvent;
|
||||
import com.google.gwt.event.logical.shared.OpenHandler;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
import com.google.gwt.resources.client.CssResource.NotStrict;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.Event;
|
||||
@@ -46,13 +38,11 @@ import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.PopupPanel;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.shared.controls.slider.SliderBar;
|
||||
|
||||
/**
|
||||
* Extension of the standard GWT DialogBox to provide a more "window"-like functionality. By default, the WindowBox has
|
||||
* two control-buttons in the top right corner of the header, which allow the box to be reduced to it's header
|
||||
* ("minimize") or the whole box to be hidden ("close"). The visiblity of these controls can be toggled seperately with
|
||||
* {@link #setMinimizeIconVisible(boolean)} and {@link #setCloseIconVisible(boolean)} respectively. <br>
|
||||
* Extension of the standard GWT DialogBox to provide a more "window"-like functionality. The WindowBox has
|
||||
* two control-buttons in the top right corner of the header, which allow the box to be turned into a dedicated browser window
|
||||
* ("popout") or the whole box to be closed. <br>
|
||||
* <br>
|
||||
* The WindowBox relies on the css settings of {@link DialogBox} for styling of the border and header. It also uses the
|
||||
* following classes to style the additional elements:
|
||||
@@ -77,25 +67,17 @@ import com.sap.sailing.gwt.ui.client.shared.controls.slider.SliderBar;
|
||||
* and vice-versa
|
||||
* </pre>
|
||||
*/
|
||||
public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
|
||||
/**
|
||||
* A {@link ClientBundle} that provides images for {@link SliderBar}.
|
||||
*/
|
||||
public static interface WindowBoxStyles extends ClientBundle {
|
||||
public static final WindowBoxStyles INSTANCE = GWT.create(WindowBoxStyles.class);
|
||||
|
||||
@NotStrict
|
||||
@Source("WindowBox.css")
|
||||
CssResource windowBoxCss();
|
||||
public class WindowBox extends DialogBox {
|
||||
|
||||
public interface PopoutHandler {
|
||||
void popout();
|
||||
}
|
||||
|
||||
private static final int MIN_WIDTH = 100;
|
||||
private static final int MIN_HEIGHT = 100;
|
||||
private static final int MIN_WIDTH = 50;
|
||||
private static final int MIN_HEIGHT = 50;
|
||||
|
||||
private FlowPanel container;
|
||||
// private FlowPanel content;
|
||||
private FlowPanel controls;
|
||||
private FlowPanel controlsPanel;
|
||||
private Anchor close;
|
||||
private Anchor minimize;
|
||||
|
||||
@@ -106,10 +88,7 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
private int minHeight = MIN_HEIGHT;
|
||||
|
||||
private int dragMode;
|
||||
|
||||
private boolean resizable;
|
||||
|
||||
private boolean minimized;
|
||||
private PopoutHandler popoutHandler;
|
||||
|
||||
/**
|
||||
* Static helper method to change the cursor for a given element when resizing is enabled.
|
||||
@@ -163,117 +142,13 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
element.getStyle().setCursor(cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DialogBoxEx which is permanent (no auto-hide), non-modal, has a "minimize"- and "close"-button in the
|
||||
* top-right corner and is not resizeable. The dialog box should not be shown until a child widget has been added
|
||||
* using {@link #add(com.google.gwt.user.client.ui.IsWidget)}. <br>
|
||||
* <br>
|
||||
* This is the equivalent for calling <code>DialogBoxEx(false, false, true, false)</code>.
|
||||
*
|
||||
* @see WindowBox#DialogBoxEx(boolean, boolean, boolean, boolean)
|
||||
*/
|
||||
public WindowBox() {
|
||||
this(false, false, true, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DialogBoxEx which is permanent, non-modal, has a "minimize"- and "close"-button and is optionally
|
||||
* resizeable. The dialog box should not be shown until a child widget has been added using
|
||||
* {@link #setWidget(Widget)}.
|
||||
*
|
||||
* @see WindowBox#DialogBoxEx(boolean, boolean, boolean, boolean)
|
||||
*
|
||||
* @param resizeable
|
||||
* <code>true</code> to allow resizing by dragging the borders
|
||||
*/
|
||||
public WindowBox(boolean resizeable) {
|
||||
this(false, false, true, true, resizeable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DialogBoxEx which is permanent and nonmodal, optionally resizeable and/or has a "minimize"- and
|
||||
* "close"-button. The dialog box should not be shown until a child widget has been added using
|
||||
* {@link #setWidget(Widget)}.
|
||||
*
|
||||
* @see WindowBox#DialogBoxEx(boolean, boolean, boolean, boolean)
|
||||
*
|
||||
* @param resizeable
|
||||
* <code>true</code> to allow resizing by dragging the borders
|
||||
* @param showCloseIcon
|
||||
* <code>true</code> to show "close"-icon in the top right corner of the header
|
||||
*/
|
||||
public WindowBox(boolean showCloseIcon, boolean resizeable) {
|
||||
this(false, false, true, showCloseIcon, resizeable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DialogBoxEx which is permanent and nonmodal, optionally resizeable and/or has a "minimize"- and
|
||||
* "close"-button. The dialog box should not be shown until a child widget has been added using
|
||||
* {@link #setWidget(Widget)}.
|
||||
*
|
||||
* @see WindowBox#DialogBoxEx(boolean, boolean, boolean, boolean)
|
||||
*
|
||||
* @param showMinimizeIcon
|
||||
* <code>true</code> to show "minimize"-icon int the top right corner of the header
|
||||
* @param resizeable
|
||||
* <code>true</code> to allow resizing by dragging the borders
|
||||
* @param showCloseIcon
|
||||
* <code>true</code> to show "close"-icon in the top right corner of the header
|
||||
*/
|
||||
public WindowBox(boolean showMinimizeIcon, boolean showCloseIcon, boolean resizeable) {
|
||||
this(false, false, showMinimizeIcon, showCloseIcon, resizeable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DialogBoxEx which is permanent, optionally modal, resizeable and/or has a "minimize"- and
|
||||
* "close"-button. The dialog box should not be shown until a child widget has been added using
|
||||
* {@link #setWidget(Widget)}.
|
||||
*
|
||||
* @param modal
|
||||
* <code>true</code> if keyboard and mouse events for widgets not contained by the dialog should be
|
||||
* ignored
|
||||
* @param showMinimizeIcon
|
||||
* <code>true</code> to show "minimize"-icon int the top right corner of the header
|
||||
* @param resizeable
|
||||
* <code>true</code> to allow resizing by dragging the borders
|
||||
* @param showCloseIcon
|
||||
* <code>true</code> to show "close"-icon in the top right corner of the header
|
||||
*/
|
||||
public WindowBox(boolean modal, boolean showMinimizeIcon, boolean showCloseIcon, boolean resizeable) {
|
||||
this(false, modal, showMinimizeIcon, showCloseIcon, resizeable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty DialogBoxEx with all configuration options. The dialog box should not be shown until a child
|
||||
* widget has been added using {@link #setWidget(Widget)}.
|
||||
*
|
||||
* @see DialogBox#DialogBox()
|
||||
* @see DialogBox#DialogBox(boolean)
|
||||
* @see DialogBox#DialogBox(boolean, boolean)
|
||||
* @see DialogBox#DialogBox(boolean, boolean, boolean)
|
||||
*
|
||||
* @param autoHide
|
||||
* <code>true</code> if the dialog should be automatically hidden when the user clicks outside of it
|
||||
* @param modal
|
||||
* <code>true</code> if keyboard and mouse events for widgets not contained by the dialog should be
|
||||
* ignored
|
||||
* @param showMinimizeIcon
|
||||
* <code>true</code> to show "minimize"-icon int the top right corner of the header
|
||||
* @param showCloseIcon
|
||||
* <code>true</code> to show "close"-icon in the top right corner of the header
|
||||
* @param resizeable
|
||||
* <code>true</code> to allow resizing by dragging the borders
|
||||
*/
|
||||
public WindowBox(boolean autoHide, boolean modal, boolean showMinimizeIcon, boolean showCloseIcon,
|
||||
boolean resizeable) {
|
||||
super(autoHide, modal);
|
||||
|
||||
WindowBoxStyles.INSTANCE.windowBoxCss().ensureInjected();
|
||||
public WindowBox(String title, String titleTooltip, Widget content, PopoutHandler popoutHandler) {
|
||||
super(false, false);
|
||||
this.popoutHandler = popoutHandler;
|
||||
|
||||
this.setStyleName("gwt-extras-WindowBox", true);
|
||||
|
||||
this.container = new FlowPanel();
|
||||
this.container.addStyleName("gwt-extras-dialog-container");
|
||||
|
||||
// this.content = new FlowPanel();
|
||||
|
||||
@@ -284,27 +159,28 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
onCloseClick(event);
|
||||
}
|
||||
});
|
||||
setCloseIconVisible(showCloseIcon);
|
||||
|
||||
this.minimize = new Anchor();
|
||||
this.minimize.setStyleName("gwt-extras-dialog-minimize");
|
||||
this.minimize.addClickHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent event) {
|
||||
onMinimizeClick(event);
|
||||
onPopoutClick(event);
|
||||
}
|
||||
});
|
||||
setMinimizeIconVisible(showMinimizeIcon);
|
||||
|
||||
Grid ctrlGrid = new Grid(1, 2);
|
||||
ctrlGrid.setWidget(0, 0, this.minimize);
|
||||
ctrlGrid.setWidget(0, 1, this.close);
|
||||
|
||||
this.controls = new FlowPanel();
|
||||
this.controls.setStyleName("gwt-extras-dialog-controls");
|
||||
this.controls.add(ctrlGrid);
|
||||
this.controlsPanel = new FlowPanel();
|
||||
this.controlsPanel.setStyleName("gwt-extras-dialog-controls");
|
||||
this.controlsPanel.add(ctrlGrid);
|
||||
this.dragMode = -1;
|
||||
|
||||
setTitle(titleTooltip);
|
||||
setText(title);
|
||||
setWidget(content);
|
||||
|
||||
this.resizable = resizeable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -328,35 +204,14 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
* @param dragMode
|
||||
*/
|
||||
protected void updateCursor(int dragMode) {
|
||||
if (this.resizable) {
|
||||
updateCursor(dragMode, this.getElement());
|
||||
updateCursor(dragMode, this.getElement());
|
||||
|
||||
com.google.gwt.dom.client.Element top = this.getCellElement(0, 1);
|
||||
com.google.gwt.dom.client.Element top = this.getCellElement(0, 1);
|
||||
updateCursor(dragMode, top);
|
||||
|
||||
top = Element.as(top.getFirstChild());
|
||||
if (top != null)
|
||||
updateCursor(dragMode, top);
|
||||
|
||||
top = Element.as(top.getFirstChild());
|
||||
if (top != null)
|
||||
updateCursor(dragMode, top);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the dialog box is mouse-resizeable
|
||||
*
|
||||
* @return <code>true</code> if the user can resize the dialog with the mouse
|
||||
*/
|
||||
public boolean isResizable() {
|
||||
return this.resizable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dialog box to be resizeable by the user
|
||||
*
|
||||
* @param resizable
|
||||
* <code>true</code> if the user can resize the dialog with the mouse
|
||||
*/
|
||||
public void setResizable(boolean resizable) {
|
||||
this.resizable = resizable;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -369,35 +224,33 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
|
||||
// If we're not yet dragging, only trigger mouse events if the event occurs
|
||||
// in the caption wrapper
|
||||
if (this.resizable) {
|
||||
switch (event.getTypeInt()) {
|
||||
case Event.ONMOUSEDOWN:
|
||||
case Event.ONMOUSEUP:
|
||||
case Event.ONMOUSEMOVE:
|
||||
case Event.ONMOUSEOVER:
|
||||
case Event.ONMOUSEOUT:
|
||||
switch (event.getTypeInt()) {
|
||||
case Event.ONMOUSEDOWN:
|
||||
case Event.ONMOUSEUP:
|
||||
case Event.ONMOUSEMOVE:
|
||||
case Event.ONMOUSEOVER:
|
||||
case Event.ONMOUSEOUT:
|
||||
|
||||
if (this.dragMode >= 0 || calcDragMode(event.getClientX(), event.getClientY()) >= 0) {
|
||||
// paste'n'copy from Widget.onBrowserEvent
|
||||
switch (DOM.eventGetType(event)) {
|
||||
case Event.ONMOUSEOVER:
|
||||
// Only fire the mouse over event if it's coming from outside this
|
||||
// widget.
|
||||
case Event.ONMOUSEOUT:
|
||||
// Only fire the mouse out event if it's leaving this
|
||||
// widget.
|
||||
Element related = event.getRelatedEventTarget().cast();
|
||||
if (related != null && getElement().isOrHasChild(related)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
if (this.dragMode >= 0 || calcDragMode(event.getClientX(), event.getClientY()) >= 0) {
|
||||
// paste'n'copy from Widget.onBrowserEvent
|
||||
switch (DOM.eventGetType(event)) {
|
||||
case Event.ONMOUSEOVER:
|
||||
// Only fire the mouse over event if it's coming from outside this
|
||||
// widget.
|
||||
case Event.ONMOUSEOUT:
|
||||
// Only fire the mouse out event if it's leaving this
|
||||
// widget.
|
||||
Element related = event.getRelatedEventTarget().cast();
|
||||
if (related != null && getElement().isOrHasChild(related)) {
|
||||
return;
|
||||
}
|
||||
DomEvent.fireNativeEvent(event, this, this.getElement());
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (this.dragMode < 0)
|
||||
this.updateCursor(this.dragMode);
|
||||
DomEvent.fireNativeEvent(event, this, this.getElement());
|
||||
return;
|
||||
}
|
||||
if (this.dragMode < 0)
|
||||
this.updateCursor(this.dragMode);
|
||||
}
|
||||
|
||||
super.onBrowserEvent(event);
|
||||
@@ -435,9 +288,9 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
* information)
|
||||
*/
|
||||
protected int calcDragMode(int clientX, int clientY) {
|
||||
|
||||
|
||||
int tolerance = 5;
|
||||
|
||||
|
||||
com.google.gwt.dom.client.Element resize = this.getCellElement(2, 2).getParentElement();
|
||||
int xr = this.getRelX(resize, clientX);
|
||||
int yr = this.getRelY(resize, clientY);
|
||||
@@ -455,38 +308,34 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
w = resize.getClientWidth();
|
||||
h = resize.getClientHeight();
|
||||
|
||||
if ((xr >= 0 && xr <= w && yr >= -tolerance && yr <= h) || (yr >= 0 && yr <= h && xr >= 0 && xr <= w + tolerance))
|
||||
if ((xr >= 0 && xr <= w && yr >= -tolerance && yr <= h)
|
||||
|| (yr >= 0 && yr <= h && xr >= 0 && xr <= w + tolerance))
|
||||
return 6;
|
||||
|
||||
/* resize = this.getCellElement(0, 2).getParentElement();
|
||||
xr = this.getRelX(resize, clientX);
|
||||
yr = this.getRelY(resize, clientY);
|
||||
|
||||
w = resize.getClientWidth();
|
||||
h = resize.getClientHeight();
|
||||
|
||||
if ((xr >= 0 && xr <= w && yr >= 0 && yr <= h + tolerance) || (yr >= 0 && yr <= h && xr >= -tolerance && xr <= w))
|
||||
return 2;
|
||||
|
||||
resize = this.getCellElement(0, 0).getParentElement();
|
||||
xr = this.getRelX(resize, clientX);
|
||||
yr = this.getRelY(resize, clientY);
|
||||
|
||||
w = resize.getClientWidth();
|
||||
h = resize.getClientHeight();
|
||||
|
||||
if ((xr >= 0 && xr <= w && yr >= 0 && yr <= h + tolerance) || (yr >= 0 && yr <= h && xr >= 0 && xr <= w + tolerance))
|
||||
return 0;
|
||||
|
||||
resize = this.getCellElement(0, 1).getParentElement();
|
||||
xr = this.getRelX(resize, clientX);
|
||||
yr = this.getRelY(resize, clientY);
|
||||
|
||||
w = resize.getClientWidth();
|
||||
h = resize.getClientHeight();
|
||||
|
||||
if (yr >= 0 && yr <= h)
|
||||
return 1;*/
|
||||
/*
|
||||
* resize = this.getCellElement(0, 2).getParentElement(); xr = this.getRelX(resize, clientX); yr =
|
||||
* this.getRelY(resize, clientY);
|
||||
*
|
||||
* w = resize.getClientWidth(); h = resize.getClientHeight();
|
||||
*
|
||||
* if ((xr >= 0 && xr <= w && yr >= 0 && yr <= h + tolerance) || (yr >= 0 && yr <= h && xr >= -tolerance && xr
|
||||
* <= w)) return 2;
|
||||
*
|
||||
* resize = this.getCellElement(0, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr =
|
||||
* this.getRelY(resize, clientY);
|
||||
*
|
||||
* w = resize.getClientWidth(); h = resize.getClientHeight();
|
||||
*
|
||||
* if ((xr >= 0 && xr <= w && yr >= 0 && yr <= h + tolerance) || (yr >= 0 && yr <= h && xr >= 0 && xr <= w +
|
||||
* tolerance)) return 0;
|
||||
*
|
||||
* resize = this.getCellElement(0, 1).getParentElement(); xr = this.getRelX(resize, clientX); yr =
|
||||
* this.getRelY(resize, clientY);
|
||||
*
|
||||
* w = resize.getClientWidth(); h = resize.getClientHeight();
|
||||
*
|
||||
* if (yr >= 0 && yr <= h) return 1;
|
||||
*/
|
||||
|
||||
resize = this.getCellElement(1, 0).getParentElement();
|
||||
xr = this.getRelX(resize, clientX);
|
||||
@@ -581,10 +430,9 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
protected void beginDragging(MouseDownEvent event) {
|
||||
int dm = -1;
|
||||
|
||||
if (this.resizable && !this.minimized)
|
||||
dm = this.calcDragMode(event.getClientX(), event.getClientY());
|
||||
|
||||
if (this.resizable && dm >= 0) {
|
||||
if (dm >= 0) {
|
||||
this.dragMode = dm;
|
||||
|
||||
DOM.setCapture(getElement());
|
||||
@@ -606,7 +454,7 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
*/
|
||||
@Override
|
||||
protected void continueDragging(MouseMoveEvent event) {
|
||||
if (this.dragMode >= 0 && this.resizable) {
|
||||
if (this.dragMode >= 0) {
|
||||
this.updateCursor(this.dragMode);
|
||||
|
||||
int dx = event.getClientX() - this.dragX;
|
||||
@@ -618,10 +466,8 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
dragResizeWidget(this, dx, dy);
|
||||
} else {
|
||||
// this updates the cursor when dragging is NOT activated
|
||||
if (!this.minimized) {
|
||||
int dm = calcDragMode(event.getClientX(), event.getClientY());
|
||||
this.updateCursor(dm);
|
||||
}
|
||||
super.continueDragging(event);
|
||||
}
|
||||
}
|
||||
@@ -634,7 +480,6 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
*/
|
||||
@Override
|
||||
protected void onPreviewNativeEvent(NativePreviewEvent event) {
|
||||
if (this.resizable) {
|
||||
// We need to preventDefault() on mouseDown events (outside of the
|
||||
// DialogBox content) to keep text from being selected when it
|
||||
// is dragged.
|
||||
@@ -644,7 +489,6 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
&& calcDragMode(nativeEvent.getClientX(), nativeEvent.getClientY()) >= 0) {
|
||||
nativeEvent.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
super.onPreviewNativeEvent(event);
|
||||
}
|
||||
@@ -656,7 +500,7 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
*/
|
||||
@Override
|
||||
protected void endDragging(MouseUpEvent event) {
|
||||
if (this.dragMode >= 0 && this.resizable) {
|
||||
if (this.dragMode >= 0) {
|
||||
DOM.releaseCapture(getElement());
|
||||
|
||||
this.dragX = event.getClientX() - this.dragX;
|
||||
@@ -679,7 +523,7 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
public void setWidget(Widget widget) {
|
||||
if (this.container.getWidgetCount() == 0) {
|
||||
// setup
|
||||
this.container.add(this.controls);
|
||||
this.container.add(this.controlsPanel);
|
||||
// this.container.add(this.content);
|
||||
super.setWidget(this.container);
|
||||
} else {
|
||||
@@ -715,33 +559,6 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
return this.container.remove(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the "close"-button should appear in the top right corner of the header
|
||||
*
|
||||
* @param visible
|
||||
* <code>true</code> if a "close"-button should be shown
|
||||
*/
|
||||
public void setCloseIconVisible(boolean visible) {
|
||||
this.close.setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the "minimize"-button should appear in the top right corner of the header
|
||||
*
|
||||
* @param visible
|
||||
* <code>true</code> if a "minimize"-button should be shown
|
||||
*/
|
||||
public void setMinimizeIconVisible(boolean visible) {
|
||||
this.minimize.setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the FlowPanel that contains the controls. More controls can be added directly to this.
|
||||
*/
|
||||
public FlowPanel getControlPanel() {
|
||||
return this.controls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the close icon is clicked. The default implementation hides the dialog box.
|
||||
*
|
||||
@@ -758,80 +575,10 @@ public class WindowBox extends DialogBox implements HasOpenHandlers<WindowBox> {
|
||||
* @param event
|
||||
* The {@link ClickEvent} to handle
|
||||
*/
|
||||
protected void onMinimizeClick(ClickEvent event) {
|
||||
Widget widget = getWidget();
|
||||
|
||||
if (widget == null)
|
||||
return;
|
||||
|
||||
boolean visible = widget.isVisible();
|
||||
|
||||
int offsetWidth = widget.getOffsetWidth();
|
||||
|
||||
widget.setVisible(!visible);
|
||||
this.minimized = visible;
|
||||
|
||||
if (visible) {
|
||||
this.container.setWidth(offsetWidth + "px");
|
||||
this.minimize.setStyleName("gwt-extras-dialog-maximize");
|
||||
} else {
|
||||
this.container.setWidth(null);
|
||||
this.minimize.setStyleName("gwt-extras-dialog-minimize");
|
||||
protected void onPopoutClick(ClickEvent event) {
|
||||
if (popoutHandler != null) {
|
||||
popoutHandler.popout();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.logical.shared.HasOpenHandlers#addOpenHandler(com.google.gwt.event.logical.shared.OpenHandler
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public HandlerRegistration addOpenHandler(OpenHandler<WindowBox> handler) {
|
||||
return addHandler(handler, OpenEvent.getType());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.user.client.ui.DialogBox#show()
|
||||
*/
|
||||
@Override
|
||||
public void show() {
|
||||
boolean fireOpen = !isShowing();
|
||||
super.show();
|
||||
if (fireOpen) {
|
||||
OpenEvent.fire(this, this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum width to which this widget can be resized by the user, if resizing is enabled. If the value is
|
||||
* invalid, it is reset to {@link #MIN_WIDTH}
|
||||
*
|
||||
* @param minWidth
|
||||
* A positive int value
|
||||
*/
|
||||
public void setMinWidth(int minWidth) {
|
||||
if (minWidth < 1)
|
||||
minWidth = MIN_WIDTH;
|
||||
|
||||
this.minWidth = minWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum height to which this widget can be resized by the user, if resizing is enabled. If the value is
|
||||
* invalid, it is reset to {@link #MIN_WIDTH}
|
||||
*
|
||||
* @param minHeight
|
||||
* A positive int value
|
||||
*/
|
||||
public void setMinHeight(int minHeight) {
|
||||
if (minHeight < 1)
|
||||
minHeight = MIN_HEIGHT;
|
||||
|
||||
this.minHeight = minHeight;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -181,8 +181,8 @@ public class RaceBoardPanel extends SimplePanel implements RegattaDisplayer, Rac
|
||||
}
|
||||
|
||||
private void addMediaSelectorToNavigationMenu() {
|
||||
MediaSelector mediaSelector = new MediaSelector(errorReporter);
|
||||
raceTimesInfoProvider.addRaceTimesInfoProviderListener(mediaSelector);
|
||||
MediaSelector mediaSelector = new MediaSelector(selectedRaceIdentifier, raceTimesInfoProvider, timer, mediaService, stringMessages, errorReporter, this.user);
|
||||
// raceTimesInfoProvider.addRaceTimesInfoProviderListener(mediaSelector);
|
||||
timer.addPlayStateListener(mediaSelector);
|
||||
timer.addTimeListener(mediaSelector);
|
||||
mediaService.getMediaTracksForRace(selectedRaceIdentifier, mediaSelector);
|
||||
|
||||
Reference in new issue
Block a user