Skip to content

Commit

Permalink
Improvements regarding renaming and other
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Jan 9, 2024
1 parent a92e5f5 commit 3276f2c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ public void editMediaPartialDivision(Map.Entry<LogicalDivision, MediaPartial> me
* @return True if enabled
*/
public boolean isEnabled() {
return !addMediaPartialDivisions().isEmpty();
return !getMediaPartialChildDivisionsOfSelection().isEmpty();
}

/**
* Get the child divisions of use "mediaPartial" of the current selection.
*
* @return The divisions as selected items list
*/
public List<SelectItem> addMediaPartialDivisions() {
public List<SelectItem> getMediaPartialChildDivisionsOfSelection() {
List<SelectItem> mediaPartialDivisions = new ArrayList<>();
Pair<PhysicalDivision, LogicalDivision> lastSelection = dataEditor.getGalleryPanel().getLastSelection();
if (Objects.nonNull(lastSelection) && MediaUtil.isAudioOrVideo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@
let initMediaFormattedTime = function () {
let mediaElement = document.querySelector('#imagePreviewForm\\:mediaDetailMediaContainer video, #imagePreviewForm\\:mediaDetailMediaContainer audio');

let formattedTime = document.createElement('div');
formattedTime.setAttribute("id", "mediaFormattedTime");
mediaElement.after(formattedTime);
if( mediaElement ) {
if(mediaElement.tagName == 'VIDEO') {
mediaElement.style.maxWidth = '700px';
}

formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime);
mediaElement.addEventListener("timeupdate", function () {
formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime);
});
let formattedTime = document.createElement('div');
formattedTime.setAttribute("id", "mediaFormattedTime");
mediaElement.after(formattedTime);

const jumpButtons = document.getElementsByClassName("media-formatted-time-jump-button");
Array.from(jumpButtons).forEach(function (jumpButton) {
jumpButton.addEventListener('click', function () {
mediaElement.pause();
let jumpMilliseconds = parseInt(this.getAttribute("data-media-formatted-time-jump-milliseconds"));
mediaElement.currentTime = ((mediaElement.currentTime * 1000) + jumpMilliseconds) / 1000;
formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime);
mediaElement.addEventListener("timeupdate", function () {
formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime);
});
});

const jumpButtons = document.getElementsByClassName("media-formatted-time-jump-button");
Array.from(jumpButtons).forEach(function (jumpButton) {
jumpButton.addEventListener('click', function () {
mediaElement.pause();
let jumpMilliseconds = parseInt(this.getAttribute("data-media-formatted-time-jump-milliseconds"));
mediaElement.currentTime = ((mediaElement.currentTime * 1000) + jumpMilliseconds) / 1000;
formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime);
});
});
}
};

initMediaFormattedTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
<p:outputPanel styleClass="dialogFieldWrapper">

<p:outputPanel
styleClass="#{(DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialDivisions.size() gt 1)?'':'hidden'}">
styleClass="#{(DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialChildDivisionsOfSelection.size() gt 1)?'':'hidden'}">
<p:outputLabel for="type" value="Typ"/>
<p:selectOneMenu id="type" value="#{DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialForm.type}">
<f:selectItems value="#{DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialDivisions}"/>
<f:selectItems value="#{DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialChildDivisionsOfSelection}"/>
</p:selectOneMenu>
</p:outputPanel>
<p:outputPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
type="button"
onclick="metadataEditor.gallery.mediaPartial.togglePlay(this, '#{mediaPartialDivision.value.begin}', '#{mediaPartialDivision.value.extent}')"/>
<p:commandButton styleClass="editMediaView secondary"
onstart="metadataEditor.gallery.mediaPartial.setMediaDuration()"
onclick="metadataEditor.gallery.mediaPartial.setMediaDuration()"
action="#{DataEditorForm.galleryPanel.mediaPartialsPanel.editMediaPartialDivision(mediaPartialDivision)}"
icon="fa fa-pencil-square-o"
oncomplete="PF('addMediaPartialDialog').show();"/>
<p:commandButton styleClass="deleteMediaView secondary"
onstart="metadataEditor.gallery.mediaPartial.setMediaDuration()"
onclick="metadataEditor.gallery.mediaPartial.setMediaDuration()"
action="#{DataEditorForm.galleryPanel.mediaPartialsPanel.deleteMediaPartialDivision(mediaPartialDivision)}"
update="imagePreviewForm:mediaPartialList,imagePreviewForm:thumbnailStripe,metadataAccordion:logicalMetadataWrapperPanel,logicalTree,physicalTree"
icon="fa fa-trash"/>
Expand All @@ -71,7 +71,7 @@

<p:commandButton id="addMediaPartial"
icon="fa fa-plus"
onstart="metadataEditor.gallery.mediaPartial.setMediaDuration()"
onclick="metadataEditor.gallery.mediaPartial.setMediaDuration()"
action="#{DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialForm.clean}"
styleClass="secondary"
oncomplete="PF('addMediaPartialDialog').show();">
Expand Down

0 comments on commit 3276f2c

Please sign in to comment.