Mercurial > hg > ismi-richfaces
changeset 72:70207f24937e
cleaned displayAuthor. added filter for witnesses with scans.
author | casties |
---|---|
date | Tue, 22 Dec 2015 20:07:13 +0100 |
parents | 38dc1f0e2451 |
children | ebd008b2e6ba |
files | src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java src/main/java/de/mpiwg/itgroup/ismi/utils/templates/TitleTemplate.java src/main/webapp/search/displayAuthor.xhtml |
diffstat | 3 files changed, 64 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Thu Dec 17 17:31:07 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Tue Dec 22 20:07:13 2015 +0100 @@ -7,6 +7,7 @@ import javax.faces.model.SelectItem; import org.apache.log4j.Logger; +import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import de.mpiwg.itgroup.ismi.auxObjects.SelectItem0; @@ -30,6 +31,7 @@ //Witness elements protected List<SelectItem0> witnessItems = new ArrayList<SelectItem0>(); protected Long selectedWitnessId; + protected boolean showWitnessesWithScans = false; //Title elements protected Long selectedTitleId; @@ -61,10 +63,21 @@ //****** getting witnesses ********************** long startWitness = System.currentTimeMillis(); - List<Entity> list = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); - for(Entity src : list){ - SelectItem0 item = new SelectItem0(src.getId(), src.getOwnValue() + " [" + src.getId() + "]", true); + List<Entity> list = new ArrayList<Entity>(); + List<Entity> allwits = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); + for (Entity witness : allwits) { + if (this.showWitnessesWithScans) { + List<Entity> codices = getWrapper().getTargetsForSourceRelation(witness.getId(), is_part_of, CODEX, 1); + Entity codex = codices.get(0); + // TODO: look at DIGITALIZATION + Attribute pub = getWrapper().getAttributeByName(codex.getId(), "public"); + if (pub == null || ! pub.getValue().equals("true")) { + continue; + } + } + SelectItem0 item = new SelectItem0(witness.getId(), witness.getOwnValue() + " [" + witness.getId() + "]", true); this.witnessItems.add(item); + list.add(witness); } if(list.size() > 0){ @@ -193,6 +206,13 @@ } + + public void changeShowWitnessesWithScans() { + if (this.selectedTitleId != null) { + showTitle(this.selectedTitleId); + } + } + public int getWitnessItemsSize() { if(witnessItems != null) return witnessItems.size(); @@ -226,4 +246,12 @@ public void setSelectedTitleId(Long selectedTitleId) { this.selectedTitleId = selectedTitleId; } + + public boolean isShowWitnessesWithScans() { + return showWitnessesWithScans; + } + + public void setShowWitnessesWithScans(boolean showWitnessesWithScans) { + this.showWitnessesWithScans = showWitnessesWithScans; + } }
--- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/TitleTemplate.java Thu Dec 17 17:31:07 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/TitleTemplate.java Tue Dec 22 20:07:13 2015 +0100 @@ -9,7 +9,6 @@ import org.mpi.openmind.cache.WrapperService; import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; -import org.mpi.openmind.repository.bo.Relation; import org.mpi.openmind.repository.utils.RomanizationLoC; import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar; @@ -57,6 +56,7 @@ Attribute att = null; Long entId = entity.getId(); + this.ov = entity.getOwnValue(); //attributes this.fullTitle = om.getAttributeOVByName(entId, "full_title", useRomanization);
--- a/src/main/webapp/search/displayAuthor.xhtml Thu Dec 17 17:31:07 2015 +0100 +++ b/src/main/webapp/search/displayAuthor.xhtml Tue Dec 22 20:07:13 2015 +0100 @@ -145,7 +145,7 @@ <!-- Titles --> - <h:panelGrid id="titlesPanel" style="width: 100%;"> + <h:panelGrid id="titlesPanel" style="width:100%;"> <a name="titles" /> <h:outputText @@ -182,10 +182,10 @@ <h:panelGrid id="titlePanel" columns="1" style="width: 100%;" rendered="#{Session.displayAuthor.selectedTitleId != null}"> - <h:commandButton value="edit or view this title" - action="#{Session.displayAuthor.actionEditTitle}" - rendered="#{Session.canEdit}" /> - + <h:outputText + value="Title [#{Session.displayAuthor.selectedTitleId}]: #{Session.displayAuthor.title.ov}" + styleClass="titlePanel" /> + <h:panelGrid columns="2" styleClass="displayPanel" columnClasses="displayPanelColumn01,displayPanelColumn02"> @@ -283,14 +283,30 @@ </h:panelGrid> + <h:commandButton value="edit this title" + action="#{Session.displayAuthor.actionEditTitle}" + rendered="#{Session.canEdit}" /> + + <!-- no WITNESS --> + <h:outputText value="No known witnesses" + rendered="#{empty Session.displayAuthor.witnessItems}" + styleClass="titlePanel" /> + <!-- WITNESS --> - <h:panelGrid id="witnessesPanel"> + <h:panelGrid id="witnessesPanel" style="width:100%;" rendered="#{!empty Session.displayAuthor.witnessItems}"> <a name="witnesses" /> <h:outputText value="Witnesses (#{Session.displayAuthor.witnessItemsSize})" rendered="#{!empty Session.displayAuthor.witnessItems}" styleClass="titlePanel" /> + <h:panelGrid columns="3"> + <h:selectBooleanCheckbox value="#{Session.displayAuthor.showWitnessesWithScans}"/> + <h:outputText value="Show only witnesses with scans"/> + <h:commandButton value="Change" + action="#{Session.displayAuthor.changeShowWitnessesWithScans}"/> + </h:panelGrid> + <h:panelGrid columns="1" rendered="#{(!empty Session.displayAuthor.witnessItems) and Session.user != null}"> <h:commandLink value="Make all public" @@ -321,10 +337,10 @@ <h:panelGrid id="witnessPanel" columns="1" style="width: 100%;" rendered="#{Session.displayAuthor.selectedWitnessId != null}"> - <h:commandButton value="edit or view this witness" - action="#{Session.displayAuthor.actionEditWitness}" - rendered="#{Session.canEdit}" /> - + <h:outputText + value="Witness [#{Session.displayAuthor.selectedWitnessId}]: #{Session.displayAuthor.witness.ov}" + styleClass="titlePanel" /> + <h:panelGrid columns="2" styleClass="displayPanel" columnClasses="displayPanelColumn01,displayPanelColumn02"> @@ -381,10 +397,8 @@ escape="false" /> </h:column> </h:dataTable> - </h:panelGrid> - <h:outputText value="Witness Read by" /> <h:panelGrid columns="1"> <h:dataTable var="item" style="border:none;" @@ -427,7 +441,7 @@ rendered="#{!empty Session.displayAuthor.witness.referenceList}" /> <h:panelGrid columns="1" rendered="#{!empty Session.displayAuthor.witness.referenceList}"> - <rich:dataTable var="item" style="border:none;width: 700px;" + <rich:dataTable var="item" style="border:none; width:700px;" value="#{Session.displayAuthor.witness.referenceList}" rendered="#{!empty Session.displayAuthor.witness.referenceList}" rowKeyVar="cnt"> @@ -457,6 +471,11 @@ </h:panelGrid> </h:panelGrid> + + <h:commandButton value="edit this witness" + action="#{Session.displayAuthor.actionEditWitness}" + rendered="#{Session.canEdit}" /> + </h:panelGrid>