java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/media/MediaPage.java
... ...
@@ -135,11 +135,8 @@ public class MediaPage extends Composite {
135 135
@UiHandler("mediaAddButton")
136 136
public void handleMediaAddButtonClick(ClickEvent e) {
137 137
popupHolder.clear();
138
- final DesktopMediaUploadPopup popup = new DesktopMediaUploadPopup(videos -> {
139
- manageMediaModel.addVideos(videos, eventDto -> updateMedia());
140
- }, images -> {
141
- manageMediaModel.addImages(images, eventDto -> updateMedia());
142
- });
138
+ final DesktopMediaUploadPopup popup = new DesktopMediaUploadPopup(
139
+ (images, videos) -> manageMediaModel.addImagesAndVideos(images, videos, eventDto -> updateMedia()));
143 140
popupHolder.add(popup);
144 141
popup.center();
145 142
}
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/uploadpopup/DesktopMediaUploadPopup.java
... ...
@@ -1,7 +1,7 @@
1 1
package com.sap.sailing.gwt.home.desktop.partials.uploadpopup;
2 2
3 3
import java.util.List;
4
-import java.util.function.Consumer;
4
+import java.util.function.BiConsumer;
5 5
6 6
import com.sap.sailing.gwt.home.desktop.partials.media.MediaPageResources;
7 7
import com.sap.sailing.gwt.ui.shared.AbstractMediaUploadPopup;
... ...
@@ -10,14 +10,14 @@ import com.sap.sse.gwt.client.media.VideoDTO;
10 10
11 11
public class DesktopMediaUploadPopup extends AbstractMediaUploadPopup {
12 12
13
- public DesktopMediaUploadPopup(Consumer<List<VideoDTO>> updateVideos, Consumer<List<ImageDTO>> updateImages) {
14
- super(updateVideos, updateImages);
13
+ public DesktopMediaUploadPopup(BiConsumer<List<ImageDTO>, List<VideoDTO>> updateImagesAndVideos) {
14
+ super(updateImagesAndVideos);
15 15
MediaPageResources.INSTANCE.css().ensureInjected();
16 16
addStyleName(MediaPageResources.INSTANCE.css().popup());
17 17
}
18 18
19 19
@Override
20
- protected void updateFileName(String fileName) {
20
+ protected String getTitleFromFileName(String fileName) {
21 21
if (fileName == null) {
22 22
fileName = "";
23 23
}
... ...
@@ -27,7 +27,6 @@ public class DesktopMediaUploadPopup extends AbstractMediaUploadPopup {
27 27
} else {
28 28
name = fileName;
29 29
}
30
- titleTextBox.setValue(name);
31
- fileNameInput.setValue(fileName);
30
+ return name;
32 31
}
33 32
}
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/mobile/partials/uploadpopup/MobileMediaUploadPopup.java
... ...
@@ -1,7 +1,7 @@
1 1
package com.sap.sailing.gwt.home.mobile.partials.uploadpopup;
2 2
3 3
import java.util.List;
4
-import java.util.function.Consumer;
4
+import java.util.function.BiConsumer;
5 5
6 6
import com.sap.sailing.gwt.home.mobile.places.event.media.MediaViewResources;
7 7
import com.sap.sailing.gwt.ui.shared.AbstractMediaUploadPopup;
... ...
@@ -10,15 +10,14 @@ import com.sap.sse.gwt.client.media.VideoDTO;
10 10
11 11
public class MobileMediaUploadPopup extends AbstractMediaUploadPopup {
12 12
13
- public MobileMediaUploadPopup(Consumer<List<VideoDTO>> updateVideos, Consumer<List<ImageDTO>> updateImages) {
14
- super(updateVideos, updateImages);
13
+ public MobileMediaUploadPopup(BiConsumer<List<ImageDTO>, List<VideoDTO>> updateImagesAndVideos) {
14
+ super(updateImagesAndVideos);
15 15
MediaViewResources.INSTANCE.css().ensureInjected();
16 16
addStyleName(MediaViewResources.INSTANCE.css().popup());
17 17
}
18 18
19 19
@Override
20
- protected void updateFileName(String fileName) {
21
- titleTextBox.setValue("");
22
- fileNameInput.setValue("");
20
+ protected String getTitleFromFileName(String fileName) {
21
+ return "";
23 22
}
24 23
}
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/mobile/places/event/media/MediaViewImpl.java
... ...
@@ -59,11 +59,8 @@ public class MediaViewImpl extends AbstractEventView<MediaView.Presenter> implem
59 59
MediaViewResources.INSTANCE.css().ensureInjected();
60 60
setViewContent(uiBinder.createAndBindUi(this));
61 61
MediaPageResources.INSTANCE.css().ensureInjected();
62
- mobileMediaUploadPopup = new MobileMediaUploadPopup(videos -> {
63
- manageMediaModel.addVideos(videos, eventDto -> updateMedia());
64
- }, image -> {
65
- manageMediaModel.addImages(image, eventDto -> updateMedia());
66
- });
62
+ mobileMediaUploadPopup = new MobileMediaUploadPopup(
63
+ (images, videos) -> manageMediaModel.addImagesAndVideos(images, videos, eventDto -> updateMedia()));
67 64
addMediaButtonUi.addClickHandler(new ClickHandler() {
68 65
@Override
69 66
public void onClick(ClickEvent event) {
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/ImageDialog.java
... ...
@@ -230,7 +230,7 @@ public abstract class ImageDialog extends DataEntryDialog<List<ImageResizingTask
230 230
}
231 231
232 232
private String getSizeErrorMessage(String fileName, MediaTagConstants mediaTag, StringMessages stringMessages) {
233
- String errorMessage = stringMessages.imageSizeError(fileName + "(" + mediaTag.getName() + ")", mediaTag.getMinWidth(),
233
+ String errorMessage = stringMessages.imageSizeError(fileName + " (" + mediaTag.getName() + ")", mediaTag.getMinWidth(),
234 234
mediaTag.getMaxWidth(), mediaTag.getMinHeight(), mediaTag.getMaxHeight());
235 235
return errorMessage;
236 236
}
... ...
@@ -375,12 +375,12 @@ public abstract class ImageDialog extends DataEntryDialog<List<ImageResizingTask
375 375
for (final MediaTagConstants mediaTag : mediaTags) {
376 376
if (imageNeedsResizeForTag(image, mediaTag)) {
377 377
resizeTags.add(mediaTag);
378
- fileInfoText.setText(fileInfoText.getText() + " - " + stringMessages.resize());
378
+ fileInfoText.setText(fileInfoText.getText() + " - " + stringMessages.resize() + " (" + mediaTag.name() + ")");
379 379
}
380 380
}
381 381
for (final MediaTagConstants mediaTag : notCheckedMediaTags) {
382 382
if (imageNeedsResizeForTag(image, mediaTag)) {
383
- fileInfoText.setText(fileInfoText.getText() + " - " + stringMessages.resize());
383
+ fileInfoText.setText(fileInfoText.getText() + " - " + stringMessages.resize() + " (" + mediaTag.name() + ")");
384 384
fileInfoText.setStyleName("errorLabel");
385 385
}
386 386
}
... ...
@@ -408,9 +408,7 @@ public abstract class ImageDialog extends DataEntryDialog<List<ImageResizingTask
408 408
if (additionalWidget != null) {
409 409
panel.add(additionalWidget);
410 410
}
411
-
412 411
Grid grid = new Grid(10, 2);
413
-
414 412
grid.setWidget(0, 0, new Label(stringMessages.createdAt() + ":"));
415 413
grid.setWidget(0, 1, createdAtLabel);
416 414
grid.setWidget(1, 0, new HTML("&nbsp;"));
... ...
@@ -420,20 +418,16 @@ public abstract class ImageDialog extends DataEntryDialog<List<ImageResizingTask
420 418
grid.setWidget(3, 0, new Label(stringMessages.fileUpload() + ":"));
421 419
grid.setWidget(3, 1, fileInfoVPanel);
422 420
grid.setWidget(4, 0, new HTML("&nbsp;"));
423
-
424 421
grid.setWidget(5, 0, new Label(stringMessages.title() + ":"));
425 422
grid.setWidget(5, 1, titleTextBox);
426 423
grid.setWidget(6, 0, new Label(stringMessages.subtitle() + ":"));
427 424
grid.setWidget(6, 1, subtitleTextBox);
428 425
grid.setWidget(7, 0, new Label(stringMessages.copyright() + ":"));
429 426
grid.setWidget(7, 1, copyrightTextBox);
430
-
431 427
grid.setWidget(8, 0, new HTML("&nbsp;"));
432 428
grid.setWidget(9, 0, new Label(stringMessages.tags() + ":"));
433 429
grid.setWidget(9, 1, tagsListEditor);
434
-
435 430
panel.add(grid);
436
-
437 431
return panel;
438 432
}
439 433
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/AbstractMediaUploadPopup.java
... ...
@@ -3,8 +3,10 @@ package com.sap.sailing.gwt.ui.shared;
3 3
import java.util.ArrayList;
4 4
import java.util.Collections;
5 5
import java.util.Date;
6
+import java.util.HashMap;
6 7
import java.util.List;
7
-import java.util.function.Consumer;
8
+import java.util.Map;
9
+import java.util.function.BiConsumer;
8 10
import java.util.logging.Level;
9 11
import java.util.logging.Logger;
10 12
... ...
@@ -63,8 +65,7 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
63 65
protected final StringMessages i18n = StringMessages.INSTANCE;
64 66
protected final SharedHomeResources sharedHomeResources = SharedHomeResources.INSTANCE;
65 67
66
- private final Consumer<List<VideoDTO>> updateVideos;
67
- private final Consumer<List<ImageDTO>> updateImages;
68
+ private final BiConsumer<List<ImageDTO>, List<VideoDTO>> updateImagesAndVideos;
68 69
69 70
protected final FileUpload upload;
70 71
protected final Button uploadButton;
... ...
@@ -72,18 +73,18 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
72 73
protected final TextBox fileNameInput;
73 74
protected final TextBox urlInput;
74 75
protected final FlowPanel files;
75
- protected final TextBox titleTextBox;
76
- protected final TextBox subtitleTextBox;
77
- protected final TextBox copyrightTextBox;
78
- protected final ListBox mimeTypeListBox;
76
+ //protected final TextBox titleTextBox;
79 77
private final FlowPanel fileExistingPanel;
80 78
private final Button saveButton;
81 79
private FlowPanel progressOverlay;
82 80
private final List<String> uriList = new ArrayList<>();
81
+ private final Map<String, MimeType> mimeTypeList = new HashMap<>();
82
+ private final Map<String, String> titleList = new HashMap<>();
83
+ private final Map<String, String> subTitleList = new HashMap<>();
84
+ private final Map<String, String> copyrightList = new HashMap<>();
83 85
84
- public AbstractMediaUploadPopup(Consumer<List<VideoDTO>> updateVideos, Consumer<List<ImageDTO>> updateImages) {
85
- this.updateVideos = updateVideos;
86
- this.updateImages = updateImages;
86
+ public AbstractMediaUploadPopup(BiConsumer<List<ImageDTO>, List<VideoDTO>> updateImagesAndVideos) {
87
+ this.updateImagesAndVideos = updateImagesAndVideos;
87 88
sharedHomeResources.sharedHomeCss().ensureInjected();
88 89
addStyleName(sharedHomeResources.sharedHomeCss().popup());
89 90
setTitle(i18n.upload());
... ...
@@ -149,7 +150,6 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
149 150
urlInput.addChangeHandler(new ChangeHandler() {
150 151
@Override
151 152
public void onChange(ChangeEvent event) {
152
- selectMimeTypeInBox(getMimeType(urlInput.getValue()));
153 153
checkSaveButton();
154 154
}
155 155
});
... ...
@@ -162,39 +162,6 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
162 162
fileExistingPanel = new FlowPanel();
163 163
fileExistingPanel.add(new Label("-- " + i18n.noMediaSelected() + " --"));
164 164
metaDataPanel.add(fileExistingPanel);
165
- final Label detailsSubTitle = new Label(i18n.details());
166
- detailsSubTitle.addStyleName(sharedHomeResources.sharedHomeCss().subTitle());
167
- metaDataPanel.add(detailsSubTitle);
168
- final Label titleLabel = new Label(i18n.title());
169
- titleLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
170
- metaDataPanel.add(titleLabel);
171
- titleTextBox = new TextBox();
172
- titleTextBox.addStyleName(sharedHomeResources.sharedHomeCss().input());
173
- metaDataPanel.add(titleTextBox);
174
- final FlowPanel advancedContent = new FlowPanel();
175
- final CollapsablePanel collapsableAdvancedPanel = new CollapsablePanel(i18n.advanced(), true);
176
- collapsableAdvancedPanel.setContent(advancedContent);
177
- collapsableAdvancedPanel.setWidth("100%");
178
- metaDataPanel.add(collapsableAdvancedPanel);
179
- final Label subtitleLabel = new Label(i18n.subtitle());
180
- subtitleLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
181
- advancedContent.add(subtitleLabel);
182
- subtitleTextBox = new TextBox();
183
- subtitleTextBox.addStyleName(sharedHomeResources.sharedHomeCss().input());
184
- advancedContent.add(subtitleTextBox);
185
- final Label copyrightLabel = new Label(i18n.copyright());
186
- copyrightLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
187
- advancedContent.add(copyrightLabel);
188
- copyrightTextBox = new TextBox();
189
- copyrightTextBox.addStyleName(sharedHomeResources.sharedHomeCss().input());
190
- advancedContent.add(copyrightTextBox);
191
- final Label mimeTypeListLabel = new Label(i18n.mimeType());
192
- mimeTypeListLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
193
- advancedContent.add(mimeTypeListLabel);
194
- mimeTypeListBox = new ListBox();
195
- mimeTypeListBox.addStyleName(sharedHomeResources.sharedHomeCss().select());
196
- initMediaTypes();
197
- advancedContent.add(mimeTypeListBox);
198 165
final FlowPanel buttonGroup = new FlowPanel();
199 166
buttonGroup.addStyleName(sharedHomeResources.sharedHomeCss().buttonGroup());
200 167
buttonGroup.addStyleName(sharedHomeResources.sharedHomeCss().right());
... ...
@@ -245,7 +212,10 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
245 212
add(content);
246 213
}
247 214
248
- private void initMediaTypes() {
215
+ abstract protected String getTitleFromFileName(String fileName);
216
+
217
+ private ListBox initMediaTypes() {
218
+ final ListBox mimeTypeListBox = new ListBox();
249 219
mimeTypeListBox.addItem(MimeType.unknown.name());
250 220
for (MimeType mimeType : MimeType.values()) {
251 221
if (mimeType != MimeType.unknown) {
... ...
@@ -253,9 +223,11 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
253 223
}
254 224
}
255 225
mimeTypeListBox.setSelectedIndex(0);
226
+ mimeTypeListBox.addStyleName(sharedHomeResources.sharedHomeCss().select());
227
+ return mimeTypeListBox;
256 228
}
257 229
258
- private void selectMimeTypeInBox(MimeType mimeType) {
230
+ private void selectMimeTypeInBox(ListBox mimeTypeListBox, MimeType mimeType) {
259 231
for (int i = 0; i < mimeTypeListBox.getItemCount(); i++) {
260 232
if (mimeType.name().equals(mimeTypeListBox.getValue(i))) {
261 233
mimeTypeListBox.setSelectedIndex(i);
... ...
@@ -382,10 +354,6 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
382 354
private void cleanFormElements() {
383 355
fileNameInput.setValue("");
384 356
urlInput.setValue("");
385
- titleTextBox.setValue("");
386
- subtitleTextBox.setValue("");
387
- copyrightTextBox.setValue("");
388
- mimeTypeListBox.setSelectedIndex(0);
389 357
// progressOverlay.setVisible(false);
390 358
}
391 359
... ...
@@ -395,7 +363,8 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
395 363
private void addMedia() {
396 364
List<ImageDTO> imageList = new ArrayList<>();
397 365
List<VideoDTO> videoList = new ArrayList<>();
398
- for (String uri: uriList) {
366
+ for (int i = 0; i < uriList.size(); i++) {
367
+ String uri = uriList.get(i);
399 368
final String uploadUrl;
400 369
if (uri == null) {
401 370
uploadUrl = "";
... ...
@@ -421,7 +390,7 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
421 390
url = uploadUrl;
422 391
}
423 392
if (!url.isEmpty()) {
424
- final MimeType mimeType = detectMimeTypeFromUrl(url);
393
+ final MimeType mimeType = mimeTypeList.get(url);
425 394
hide();
426 395
if (mimeType.mediaType == MediaType.image) {
427 396
GWT.log("add image " + url);
... ...
@@ -437,20 +406,14 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
437 406
Notification.notify(i18n.invalidURL(), NotificationType.ERROR);
438 407
}
439 408
}
440
- if (!imageList.isEmpty() && !videoList.isEmpty()) {
441
- Notification.notify(i18n.cannotUploadVideosAndImagesTogether(), NotificationType.ERROR);
442
- } else if (!imageList.isEmpty()) {
443
- updateImages.accept(imageList);
444
- } else if (!videoList.isEmpty()) {
445
- updateVideos.accept(videoList);
446
- }
409
+ updateImagesAndVideos.accept(imageList, videoList);
447 410
}
448 411
449 412
private ImageDTO createImage(String url) {
450 413
final ImageDTO image = new ImageDTO(url, new Date());
451
- image.setTitle(titleTextBox.getValue());
452
- image.setSubtitle(subtitleTextBox.getValue());
453
- image.setCopyright(copyrightTextBox.getValue());
414
+ image.setTitle(titleList.get(url));
415
+ image.setSubtitle(subTitleList.get(url));
416
+ image.setCopyright(copyrightList.get(url));
454 417
Iterable<String> defaultTags = Collections.singletonList(MediaTagConstants.GALLERY.getName());
455 418
image.setTags(defaultTags);
456 419
return image;
... ...
@@ -458,9 +421,9 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
458 421
459 422
private VideoDTO createVideo(String url, String thumbnailUrl, MimeType mimeType) {
460 423
final VideoDTO video = new VideoDTO(url, mimeType, new Date());
461
- video.setTitle(titleTextBox.getValue());
462
- video.setSubtitle(subtitleTextBox.getValue());
463
- video.setCopyright(copyrightTextBox.getValue());
424
+ video.setTitle(titleList.get(url));
425
+ video.setSubtitle(subTitleList.get(url));
426
+ video.setCopyright(copyrightList.get(url));
464 427
video.setThumbnailRef(thumbnailUrl);
465 428
Iterable<String> defaultTags = Collections.singletonList(MediaTagConstants.GALLERY.getName());
466 429
video.setTags(defaultTags);
... ...
@@ -522,6 +485,8 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
522 485
}
523 486
}
524 487
}
488
+ uriList.clear();
489
+ mimeTypeList.clear();
525 490
}
526 491
527 492
/**
... ...
@@ -541,21 +506,93 @@ public abstract class AbstractMediaUploadPopup extends DialogBox {
541 506
// fileNameInput.setEnabled(false);
542 507
urlInput.setEnabled(true);
543 508
}
509
+
510
+ private void setCollapsebleFilePanelHeader(final CollapsablePanel collapsebleFilePanel, final String fileName, final MimeType mimeType) {
511
+ String header;
512
+ if (fileName != null && !fileName.isEmpty() && mimeType != null) {
513
+ header = fileName + " (" + mimeType.name() + ")";
514
+ } else if (mimeType != null) {
515
+ header = mimeType.name();
516
+ } else {
517
+ header = "n/a";
518
+ }
519
+ collapsebleFilePanel.getHeaderTextAccessor().setText(header);
520
+ }
544 521
545 522
private void addUri(String uri, String fileName) {
546 523
this.uriList.add(uri);
547
- files.add(new Label(fileName));
524
+ final MimeType mimeType = detectMimeTypeFromUrl(uri);
525
+ this.mimeTypeList.put(uri, mimeType);
526
+ final String title = getTitleFromFileName(fileName);
527
+ this.titleList.put(uri, title);
528
+ final VerticalPanel vPanel = new VerticalPanel();
529
+ final CollapsablePanel collapsebleFilePanel = new CollapsablePanel(fileName, true);
530
+ setCollapsebleFilePanelHeader(collapsebleFilePanel, titleList.get(uri), mimeTypeList.get(uri));
531
+ collapsebleFilePanel.setContent(vPanel);
532
+ collapsebleFilePanel.setWidth("100%");
533
+ final Label fileNameLabel = new Label(fileName);
534
+ fileNameLabel.addStyleName(sharedHomeResources.sharedHomeCss().subTitle());
535
+ //vPanel.add(fileNameLabel);
536
+ final Label titleLabel = new Label(i18n.title());
537
+ titleLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
538
+ vPanel.add(titleLabel);
539
+ TextBox titleTextBox = new TextBox();
540
+ titleTextBox.addStyleName(sharedHomeResources.sharedHomeCss().input());
541
+ titleTextBox.setText(title);
542
+ titleTextBox.addChangeHandler(new ChangeHandler() {
543
+ @Override
544
+ public void onChange(ChangeEvent event) {
545
+ titleList.put(uri, titleTextBox.getValue());
546
+ setCollapsebleFilePanelHeader(collapsebleFilePanel, titleList.get(uri), mimeTypeList.get(uri));
547
+ }
548
+ });
549
+ vPanel.add(titleTextBox);
550
+ final Label subtitleLabel = new Label(i18n.subtitle());
551
+ subtitleLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
552
+ vPanel.add(subtitleLabel);
553
+ TextBox subtitleTextBox = new TextBox();
554
+ subtitleTextBox.addChangeHandler(new ChangeHandler() {
555
+ @Override
556
+ public void onChange(ChangeEvent event) {
557
+ subTitleList.put(uri, subtitleTextBox.getValue());
558
+ }
559
+ });
560
+ subtitleTextBox.addStyleName(sharedHomeResources.sharedHomeCss().input());
561
+ vPanel.add(subtitleTextBox);
562
+ final Label copyrightLabel = new Label(i18n.copyright());
563
+ copyrightLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
564
+ vPanel.add(copyrightLabel);
565
+ TextBox copyrightTextBox = new TextBox();
566
+ copyrightTextBox.addChangeHandler(new ChangeHandler() {
567
+ @Override
568
+ public void onChange(ChangeEvent event) {
569
+ copyrightList.put(uri, copyrightTextBox.getValue());
570
+ }
571
+ });
572
+ copyrightTextBox.addStyleName(sharedHomeResources.sharedHomeCss().input());
573
+ vPanel.add(copyrightTextBox);
574
+ final Label mimeTypeListLabel = new Label(i18n.mimeType());
575
+ mimeTypeListLabel.addStyleName(sharedHomeResources.sharedHomeCss().label());
576
+ vPanel.add(mimeTypeListLabel);
577
+ final ListBox mediaTypeListBox = initMediaTypes();
578
+ mediaTypeListBox.addChangeHandler(new ChangeHandler() {
579
+ @Override
580
+ public void onChange(ChangeEvent event) {
581
+ final MimeType mimeType = MimeType.byName(mediaTypeListBox.getSelectedItemText());
582
+ mimeTypeList.put(uri, mimeType);
583
+ setCollapsebleFilePanelHeader(collapsebleFilePanel, titleList.get(uri), mimeTypeList.get(uri));
584
+ }
585
+ });
586
+ selectMimeTypeInBox(mediaTypeListBox, getMimeType(uri));
587
+ vPanel.add(mediaTypeListBox);
588
+ files.add(collapsebleFilePanel);
548 589
fileExistingPanel.setVisible(false);
549 590
saveButton.setEnabled(true);
550 591
// fileNameInput.setEnabled(true);
551 592
urlInput.setEnabled(false);
552
- selectMimeTypeInBox(getMimeType(uri));
553
- updateFileName(fileName);
554 593
checkSaveButton();
555 594
}
556 595
557
- abstract protected void updateFileName(String fileName);
558
-
559 596
private void checkSaveButton() {
560 597
boolean urlInputNotEmpty = urlInput.getValue() != null && !urlInput.getValue().trim().isEmpty();
561 598
boolean uriNotEmpty = !uriList.isEmpty();
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/ManageMediaModel.java
... ...
@@ -129,7 +129,21 @@ public class ManageMediaModel {
129 129
updateEventDto(eventDto, callback);
130 130
});
131 131
}
132
-
132
+
133
+ public void addImagesAndVideos(List<ImageDTO> imageList, List<VideoDTO> videoList, Consumer<EventDTO> callback) {
134
+ loadEventData(eventDto -> {
135
+ for (ImageDTO image: imageList) {
136
+ eventDto.getImages().add(image);
137
+ mediaDto.addPhoto(new SailingImageDTO(null, image));
138
+ }
139
+ for (VideoDTO video: videoList) {
140
+ eventDto.getVideos().add(video);
141
+ mediaDto.addVideo(new SailingVideoDTO(null, video));
142
+ }
143
+ updateEventDto(eventDto, callback);
144
+ });
145
+ }
146
+
133 147
public void reloadMedia(Consumer<EventDTO> callback) {
134 148
loadEventData(eventDto -> {
135 149
setVideos(eventDto.getVideos());
java/com.sap.sailing.www/.gitignore
... ...
@@ -1,2 +1,3 @@
1 1
/bin
2 2
/filestorage/
3
+/tmp/
java/com.sap.sse.gwt/src/com/sap/sse/gwt/client/dialog/DataEntryDialog.java
... ...
@@ -5,6 +5,7 @@ import java.util.Date;
5 5
import java.util.List;
6 6
import java.util.function.Supplier;
7 7
8
+import com.google.gwt.core.client.GWT;
8 9
import com.google.gwt.core.client.Scheduler;
9 10
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
10 11
import com.google.gwt.dom.client.Element;
... ...
@@ -38,6 +39,7 @@ import com.google.gwt.user.client.ui.SuggestBox;
38 39
import com.google.gwt.user.client.ui.SuggestOracle;
39 40
import com.google.gwt.user.client.ui.TextArea;
40 41
import com.google.gwt.user.client.ui.TextBox;
42
+import com.google.gwt.user.client.ui.VerticalPanel;
41 43
import com.google.gwt.user.client.ui.Widget;
42 44
import com.google.gwt.user.datepicker.client.DateBox;
43 45
import com.sap.sse.common.Color;
... ...
@@ -47,6 +49,7 @@ import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
47 49
import com.sap.sse.gwt.client.controls.GenericListBox;
48 50
import com.sap.sse.gwt.client.controls.GenericListBox.ValueBuilder;
49 51
import com.sap.sse.gwt.client.controls.IntegerBox;
52
+import com.sap.sse.gwt.client.panels.HorizontalFlowPanel;
50 53
51 54
/**
52 55
* An abstract data entry dialog class, capturing data of type <code>T</code>, with generic OK/Cancel buttons, title and
... ...
@@ -65,6 +68,7 @@ public abstract class DataEntryDialog<T> {
65 68
private final Button okButton;
66 69
private final Button cancelButton;
67 70
private final HTML statusLabel;
71
+ private final FlowPanel errorListPanel;
68 72
private final FlowPanel panelForAdditionalWidget;
69 73
private final DockPanel buttonPanel;
70 74
private final FlowPanel rightButtonPanel;
... ...
@@ -139,6 +143,8 @@ public abstract class DataEntryDialog<T> {
139 143
statusLabel = new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;"));
140 144
statusLabel.ensureDebugId("StatusLabel");
141 145
dialogFPanel.add(statusLabel);
146
+ errorListPanel = new FlowPanel();
147
+ dialogFPanel.add(errorListPanel);
142 148
if (message != null) {
143 149
Label messageLabel = new Label(message);
144 150
messageLabel.addStyleName("dialogMessageLabel");
... ...
@@ -222,13 +228,25 @@ public abstract class DataEntryDialog<T> {
222 228
*/
223 229
@Override
224 230
public void onSuccess(String errorMessage) {
231
+ errorListPanel.clear();
225 232
boolean invalidState = errorMessage != null && !errorMessage.isEmpty();
226 233
if (invalidState != dialogInInvalidState) {
227 234
onInvalidStateChanged(invalidState);
228 235
}
229 236
if (invalidState) {
230
- statusLabel.setHTML(SafeHtmlUtils.fromString(errorMessage));
231
- statusLabel.setStyleName("errorLabel");
237
+ String[] errors = errorMessage.split("\\r?\\n|\\r");
238
+ if (errors.length > 1) {
239
+ for (int i=0; i< errors.length; i++) {
240
+ GWT.log(i + " - " + errors[i]);
241
+ HTML errorLabel = new HTML(SafeHtmlUtils.fromString(errors[i]));
242
+ errorLabel.setStyleName("errorLabel");
243
+ errorListPanel.add(errorLabel);
244
+ }
245
+ statusLabel.setHTML(SafeHtmlUtils.fromSafeConstant("&nbsp;"));
246
+ } else {
247
+ statusLabel.setHTML(SafeHtmlUtils.fromString(errorMessage));
248
+ statusLabel.setStyleName("errorLabel");
249
+ }
232 250
getOkButton().setEnabled(false);
233 251
} else {
234 252
statusLabel.setHTML(SafeHtmlUtils.fromSafeConstant("&nbsp;"));
wiki/howto/onboarding.md
... ...
@@ -233,5 +233,10 @@ When a file has "wrong line endings" (line endings are different to what is conf
233 233
234 234
See [RaceCommittee App](/wiki/info/mobile/racecommittee-app) for more information regarding the mobile app.
235 235
236
+### Java on ARM based Mac troubleshooting
237
+
238
+Irritating behavior can occur on ARM-based processors, such as on a MacBook. There are some problems, especially with graphical functions. There are cases where javax.imageio.ImageIO, javax.imageio.ImageReader or java.awt.graphics2D stops responding without error message.
239
+In such cases it might help to set AWT to headless mode (`-Djava.awt.headless=true`, see [stackoverflow](https://stackoverflow.com/questions/13796611/imageio-read-with-mac for more information)).
240
+
236 241
### GWT Browser Plugin
237 242
Install the GWT Browser Plugin for the GWT Development mode. As of 2016-08-31 Firefox is the only browser supporting the GWT plugin, you have to download Firefox version 24 for it to work. The Plugin can be found on this page: [https://code.google.com/archive/p/google-web-toolkit/downloads](https://code.google.com/archive/p/google-web-toolkit/downloads)