From 0a42813e439bdca415355bd7fc37e684b342f99f Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Fri, 13 Dec 2024 11:45:54 +0100 Subject: [PATCH] (#137) Only show sharing icon when appropriate --- .../instrument/instrument_list.xhtml | 14 +++++++---- .../QuinCe/data/Instrument/Instrument.java | 22 ++++++++++++++++++ .../QuinCe/web/Instrument/BeanInstrument.java | 23 +++++++++++++++++++ .../web/Instrument/InstrumentListBean.java | 15 ++++++------ 4 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 WebApp/src/uk/ac/exeter/QuinCe/web/Instrument/BeanInstrument.java diff --git a/WebApp/WebContent/instrument/instrument_list.xhtml b/WebApp/WebContent/instrument/instrument_list.xhtml index 769a7814b..eb4db3a12 100644 --- a/WebApp/WebContent/instrument/instrument_list.xhtml +++ b/WebApp/WebContent/instrument/instrument_list.xhtml @@ -230,10 +230,16 @@ - - - + + + + + + + + datasetCounts; - private List filteredInstruments; + private List filteredInstruments; private LinkedHashMap userNames; @@ -69,7 +69,7 @@ public class InstrumentListBean extends BaseManagedBean { /** * The ID of the instrument chosen from the instrument list */ - private Instrument chosenInstrument = null; + private BeanInstrument chosenInstrument = null; private int shareAction = Integer.MIN_VALUE; @@ -94,15 +94,16 @@ public String start() { * * @return The instruments owned by the current user */ - public List getInstrumentList() { - return getInstruments(); + public List getInstrumentList() { + return getInstruments().stream().map(i -> new BeanInstrument(i, getUser())) + .toList(); } - public List getFilteredInstruments() { + public List getFilteredInstruments() { return filteredInstruments; } - public void setFilteredInstruments(List filteredInstruments) { + public void setFilteredInstruments(List filteredInstruments) { this.filteredInstruments = filteredInstruments; } @@ -157,7 +158,7 @@ public long getChosenInstrument() { * The instrument ID */ public void setChosenInstrument(long chosenInstrument) { - for (Instrument instrument : getInstruments()) { + for (BeanInstrument instrument : getInstrumentList()) { if (instrument.getId() == chosenInstrument) { this.chosenInstrument = instrument; setCurrentInstrumentId(instrument.getId());