An offers file name should contain the date of the offer creation, the project conserved part and the offer version
+ * + * @since 1.0.0 + * +*/ +class OfferFileNameFormatter { + + /** + * Returns an offer file name in this schema: + * + * Q_The confirmation dialog requests the users confirmation about specific processes that will follow. + * E.g before deleting the user should be asked if he really wants to do that
+ * + * @since 1.0.0 + * +*/ +class ConfirmationDialog extends Window{ + + Button confirm + Button decline + private HorizontalLayout buttonLayout + private Label descriptionLabel + private String descriptionText + private VerticalLayout content + + + ConfirmationDialog(String description){ + center() + // Disable the close button + setClosable(false) + + descriptionText = description + + init() + addListeners() + + content.addComponents(descriptionLabel, buttonLayout) + content.setComponentAlignment(buttonLayout, Alignment.MIDDLE_RIGHT) + + setContent(content) + } + + private void init(){ + confirm = new Button("Confirm") + decline = new Button("Decline") + + descriptionLabel = new Label(descriptionText) + + this.setCaptionAsHtml(true) + this.caption = " Are you sure? " + + + this.setResizable(false) + + content = new VerticalLayout() + content.setMargin(true) + + buttonLayout = new HorizontalLayout() + buttonLayout.addComponents(decline, confirm) + } + + private void addListeners(){ + confirm.addClickListener({ + close() + }) + + decline.addClickListener({ + close() + }) + } + +} \ No newline at end of file diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/GridUtils.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/GridUtils.groovy index e3a0c5b94..cecfea8e7 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/GridUtils.groovy +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/GridUtils.groovy @@ -7,6 +7,8 @@ import com.vaadin.ui.Grid import com.vaadin.ui.TextField import com.vaadin.ui.components.grid.HeaderRow import com.vaadin.ui.themes.ValoTheme +import life.qbic.business.logging.Logger +import life.qbic.business.logging.Logging import org.apache.commons.lang3.StringUtils import java.time.LocalDate @@ -20,6 +22,8 @@ import java.time.chrono.ChronoLocalDate */ class GridUtils { + private static Logging log = Logger.getLogger(this.class) + /** * Provides a filter field into a header row of a grid for a given column. * @@ -53,7 +57,8 @@ class GridUtils { /** * Provides a filter field into a header row of a grid for a given column of type Date. * - * The current implementation filters a date column based on a picked date + * The current implementation filters a date column based on a picked date. If no date is provided, + * the filter does not apply. * * @param dataProvider The grid's {@link ListDataProvider} * @param column The date column to add the filter to @@ -64,9 +69,15 @@ class GridUtils { HeaderRow headerRow) { DateField dateFilterField = new DateField() dateFilterField.addValueChangeListener(event -> { - dataProvider.addFilter(element -> - isSameDate(dateFilterField.getValue(), column.getValueProvider().apply(element)) - ) + dataProvider.addFilter(element -> { + LocalDate filterValue = dateFilterField.getValue() + Date columnValue = column.getValueProvider().apply(element) + if (filterValue) { + return isSameDate(filterValue, columnValue) + } else { + return true // when no filter argument is provided + } + }) }) dateFilterField.addStyleName(ValoTheme.DATEFIELD_TINY) @@ -75,11 +86,14 @@ class GridUtils { } private static boolean isSameDate(LocalDate localDate, Date date){ - try{ + try { Date dateFromLocal = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) return dateFromLocal == date - }catch(Exception ignore){ + } catch(Exception unexpected) { + log.error("Unexpected exception for $localDate and $date") + log.debug("Unexpected exception for $localDate and $date", unexpected) return false } } + } diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/Resettable.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/Resettable.groovy new file mode 100644 index 000000000..b2b88c228 --- /dev/null +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/Resettable.groovy @@ -0,0 +1,17 @@ +package life.qbic.portal.offermanager.components + +/** + * Reset graphical input elements + * + * A class that inherits the Resettable interface indicates, that + * it supports full reset of graphical input field elements. + * + * @since 1.0.0 + */ +interface Resettable { + + /** + * Resets all input elements of an graphical user interface + */ + void reset() +} diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/create/CreateAffiliationView.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/create/CreateAffiliationView.groovy index 2f7acdfc6..c00ab4e6b 100644 --- a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/create/CreateAffiliationView.groovy +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/create/CreateAffiliationView.groovy @@ -25,7 +25,7 @@ import life.qbic.portal.offermanager.components.AppViewModel * @since: 1.0.0 */ @Log4j2 -class CreateAffiliationView extends VerticalLayout { +class CreateAffiliationView extends FormLayout { final public AppViewModel sharedViewModel final public CreateAffiliationViewModel createAffiliationViewModel private final CreateAffiliationController controller @@ -54,6 +54,11 @@ class CreateAffiliationView extends VerticalLayout { } private void initLayout() { + final Label label = new Label("Create A New Affiliation") + + label.addStyleName(ValoTheme.LABEL_HUGE) + this.addComponent(label) + this.organisationBox = new ComboBox<>("Organisation Name") organisationBox.setPlaceholder("Name of the organisation") organisationBox.setDescription("Select or enter new name of the organisation e.g. Universität Tübingen.") diff --git a/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/search/SearchAffiliationView.groovy b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/search/SearchAffiliationView.groovy new file mode 100644 index 000000000..f802bf5e7 --- /dev/null +++ b/offer-manager-app/src/main/groovy/life/qbic/portal/offermanager/components/affiliation/search/SearchAffiliationView.groovy @@ -0,0 +1,172 @@ +package life.qbic.portal.offermanager.components.affiliation.search + +import com.vaadin.data.provider.DataProvider +import com.vaadin.data.provider.ListDataProvider +import com.vaadin.icons.VaadinIcons +import com.vaadin.ui.FormLayout +import com.vaadin.ui.Grid +import com.vaadin.ui.Label +import com.vaadin.ui.Panel +import com.vaadin.ui.TextArea +import com.vaadin.ui.components.grid.HeaderRow +import com.vaadin.ui.themes.ValoTheme +import groovy.util.logging.Log4j2 +import life.qbic.datamodel.dtos.business.Affiliation +import life.qbic.portal.offermanager.components.GridUtils + +/** + *This view provides functionality for searching for affiliations.
+ * + * @since 1.0.0 + */ +@Log4j2 +class SearchAffiliationView extends FormLayout{ + + private final SearchAffiliationViewModel viewModel + + private GridDetermines state of the view. Listens to data events.
+ * + * @since 1.0.0 + */ +class SearchAffiliationViewModel { + + /** + * A list of available affiliations. All items are of class {@link Affiliation} + */ + ObservableList affiliations + @Bindable OptionalThis is some outro text. It has changed!!
-