List of usage examples for org.apache.wicket.model AbstractReadOnlyModel AbstractReadOnlyModel
AbstractReadOnlyModel
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoCollectionListForm.java
License:Open Source License
/** * //from w ww . j a v a 2s . c o m * @param iModel * @return the pageableListView of PhenoCollection */ public DataView<PhenoDataSetCollection> buildDataView( ArkDataProvider2<PhenoDataCollectionVO, PhenoDataSetCollection> PhenoCollectionProvider) { DataView<PhenoDataSetCollection> PhenoCollectionDataView = new DataView<PhenoDataSetCollection>( "PhenoDataSetCollectionList", PhenoCollectionProvider) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final Item<PhenoDataSetCollection> item) { item.setOutputMarkupId(true); // DO NOT store the item.getModelObject! Checking it is ok... final PhenoDataSetCollection PhenoCollection = item.getModelObject(); idLbl = new Label("phenoDataSetCollection.id", String.valueOf(PhenoCollection.getId())); questionnaireLbl = new Label("phenoDataSetCollection.questionnaire", PhenoCollection.getQuestionnaire().getName()); ArkBusyAjaxLink link = new ArkBusyAjaxLink("link") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { PhenoDataSetCollection phenoDataSetCollection = (PhenoDataSetCollection) (getParent() .getDefaultModelObject()); CompoundPropertyModel<PhenoDataCollectionVO> newModel = new CompoundPropertyModel<PhenoDataCollectionVO>( new PhenoDataCollectionVO()); newModel.getObject().setPhenoDataSetCollection(phenoDataSetCollection); showModalWindow(target, newModel); } }; link.add(questionnaireLbl); // nameLbl = new Label("PhenoCollection.name", PhenoCollection.getName()); descriptionLbl = new Label("phenoDataSetCollection.description", PhenoCollection.getDescription()); statusLbl = new Label("phenoDataSetCollection.status", PhenoCollection.getStatus().getName()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(au.org.theark.core.Constants.DD_MM_YYYY); recordDateLbl = new Label("phenoDataSetCollection.recordDate", simpleDateFormat.format(PhenoCollection.getRecordDate())); if (PhenoCollection.getReviewedDate() == null) { reviewedDateLbl = new Label("phenoDataSetCollection.reviewedDate", ""); } else { reviewedDateLbl = new Label("phenoDataSetCollection.reviewedDate", simpleDateFormat.format(PhenoCollection.getReviewedDate())); } item.add(idLbl); item.add(link); // item.add(nameLbl); item.add(descriptionLbl); item.add(statusLbl); item.add(recordDateLbl); item.add(reviewedDateLbl); item.add(new AttributeModifier("class", new AbstractReadOnlyModel() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return PhenoCollectionDataView; }
From source file:au.org.theark.phenotypic.web.component.phenodataupload.SearchResultListPanel.java
License:Open Source License
/** * /* w w w . j a v a 2 s.com*/ * @param iModel * @return the pageableListView of Upload */ @SuppressWarnings("unchecked") public PageableListView<Upload> buildPageableListView(IModel iModel) { PageableListView<Upload> sitePageableListView = new PageableListView<Upload>(Constants.RESULT_LIST, iModel, iArkCommonService.getUserConfig(Constants.CONFIG_ROWS_PER_PAGE).getIntValue()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<Upload> item) { Upload upload = item.getModelObject(); // The ID if (upload.getId() != null) { // Add the id component here item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_ID, upload.getId().toString())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_ID, "")); } // / The filename if (upload.getFilename() != null) { // Add the id component here item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FILENAME, upload.getFilename())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FILENAME, "")); } // File Format if (upload.getFileFormat() != null) { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FILE_FORMAT, upload.getFileFormat().getName())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FILE_FORMAT, "")); } // UserId if (upload.getUserId() != null) { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_USER_ID, upload.getUserId())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_USER_ID, "")); } // Start time if (upload.getStartTime() != null) { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_START_TIME, upload.getStartTime().toString())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_START_TIME, "")); } // Finish time if (upload.getFinishTime() != null) { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FINISH_TIME, upload.getFinishTime().toString())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_FINISH_TIME, "")); } if (upload.getUploadStatus() != null && upload.getUploadStatus().getShortMessage() != null) { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_UPLOAD_STATUS_NAME, upload.getUploadStatus().getShortMessage())); } else { item.add(new Label(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_UPLOAD_STATUS_NAME, "")); } // Download file link button item.add(buildDownloadButton(upload)); // Download upload report button item.add(buildDownloadReportButton(upload)); // Delete the upload file // item.add(buildDeleteButton(upload)); // For the alternative stripes item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return sitePageableListView; }
From source file:au.org.theark.phenotypic.web.component.phenofielduploader.SearchResultListPanel.java
License:Open Source License
/** * //from w ww. ja v a2 s. c om * @param iModel * @return the pageableListView of Upload */ public PageableListView<Upload> buildPageableListView(IModel iModel) { PageableListView<Upload> sitePageableListView = new PageableListView<Upload>(Constants.RESULT_LIST, iModel, iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue()) { @Override protected void populateItem(final ListItem<Upload> item) { Upload upload = item.getModelObject(); // The ID if (upload.getId() != null) { // Add the id component here item.add(new Label(Constants.UPLOADVO_UPLOAD_ID, upload.getId().toString())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_ID, "")); } // / The filename if (upload.getFilename() != null) { // Add the id component here item.add(new Label(Constants.UPLOADVO_UPLOAD_FILENAME, upload.getFilename())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_FILENAME, "")); } // File Format if (upload.getFileFormat() != null) { item.add(new Label(Constants.UPLOADVO_UPLOAD_FILE_FORMAT, upload.getFileFormat().getName())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_FILE_FORMAT, "")); } // UserId if (upload.getUserId() != null) { item.add(new Label(Constants.UPLOADVO_UPLOAD_USER_ID, upload.getUserId())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_USER_ID, "")); } // Start time if (upload.getStartTime() != null) { item.add(new Label(Constants.UPLOADVO_UPLOAD_START_TIME, upload.getStartTime().toString())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_START_TIME, "")); } // Finish time if (upload.getFinishTime() != null) { item.add(new Label(Constants.UPLOADVO_UPLOAD_FINISH_TIME, upload.getFinishTime().toString())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_FINISH_TIME, "")); } if (upload.getUploadStatus() != null && upload.getUploadStatus().getShortMessage() != null) { item.add(new Label(Constants.UPLOADVO_UPLOAD_UPLOAD_STATUS_NAME, upload.getUploadStatus().getShortMessage())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_UPLOAD_STATUS_NAME, "")); } // Download file link button item.add(buildDownloadButton(upload)); // Download upload report button item.add(buildDownloadReportButton(upload)); // For the alternative stripes item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return sitePageableListView; }
From source file:au.org.theark.registry.web.component.invoice.ProcessResultListPanel.java
License:Open Source License
/** * //from ww w . ja v a 2 s . c o m * @param iModel * @return the pageableListView of Upload */ @SuppressWarnings("unchecked") public PageableListView<Process> buildPageableListView(IModel iModel) { PageableListView<Process> pageableListView = new PageableListView<Process>(Constants.RESULT_LIST, iModel, iArkCommonService.getUserConfig(Constants.CONFIG_ROWS_PER_PAGE).getIntValue()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<Process> item) { Process p = item.getModelObject(); // The ID if (p.getId() != null) { // Add the id component here item.add(new Label("id", p.getId().toString())); } else { item.add(new Label("id", "")); } // / The filename if (p.getName() != null) { // Add the id component here item.add(new Label("name", p.getName())); } else { item.add(new Label("name", "")); } // File Format if (p.getDescription() != null) { item.add(new Label("description", p.getDescription())); } else { item.add(new Label("description", "")); } // For the alternative stripes item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return pageableListView; }
From source file:au.org.theark.registry.web.component.invoice.ProcessResultListPanel.java
License:Open Source License
@SuppressWarnings("serial") public DataView<Process> buildDataView(ArkDataProvider<Process, IArkCommonService> subjectProvider) { DataView<Process> dataView = new DataView<Process>(Constants.RESULT_LIST, subjectProvider) { @Override/*from w w w . j ava 2 s .c om*/ protected void populateItem(final Item<Process> item) { Process process = item.getModelObject(); if (process != null && process.getId() != null) { item.add(new Label("id", process.getId().toString())); } else { item.add(new Label("id", "")); } item.add(buildLink(item.getModelObject())); //item.add(new Label("name", item.getModelObject().getName())); if (process != null && process.getDescription() != null) { item.add(new Label("description", process.getDescription())); } else { item.add(new Label("description", "")); } if (process != null && process.getStartTime() != null) { item.add(new Label("startTime", process.getStartTime().toString())); } else { item.add(new Label("startTime", "")); } if (process != null && process.getEndTime() != null) { item.add(new Label("endTime", process.getEndTime().toString())); } else { item.add(new Label("endTime", "")); } if (process != null && process.getCommand() != null) { item.add(new Label("command", process.getCommand().getName())); } else { item.add(new Label("command", "")); } // List<Command> commandList = iArkCommonService.getCommands(); // ChoiceRenderer<Command> defaultChoiceRenderer = new ChoiceRenderer<Command>(Constants.NAME, Constants.ID); // DropDownChoice<Command> commandChoice = new DropDownChoice<Command>("command", commandList, defaultChoiceRenderer); // item.add(commandChoice); item.add(new AttributeModifier(Constants.CLASS, new AbstractReadOnlyModel() { @Override public String getObject() { return (item.getIndex() % 2 == 1) ? Constants.EVEN : Constants.ODD; } })); } }; return dataView; }
From source file:au.org.theark.registry.web.component.invoice.SearchResultListPanel.java
License:Open Source License
/** * /*from w w w. ja v a 2 s . c o m*/ * @param iModel * @return the pageableListView of Upload */ @SuppressWarnings("unchecked") public PageableListView<Pipeline> buildPageableListView(IModel iModel) { PageableListView<Pipeline> pageableListView = new PageableListView<Pipeline>(Constants.RESULT_LIST, iModel, iArkCommonService.getUserConfig(Constants.CONFIG_ROWS_PER_PAGE).getIntValue()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<Pipeline> item) { Pipeline p = item.getModelObject(); // The ID if (p.getId() != null) { // Add the id component here item.add(new Label("id", p.getId().toString())); } else { item.add(new Label("id", "")); } // / The filename if (p.getName() != null) { // Add the id component here item.add(new Label("name", p.getName())); } else { item.add(new Label("name", "")); } // File Format if (p.getDescription() != null) { item.add(new Label("description", p.getDescription())); } else { item.add(new Label("description", "")); } // For the alternative stripes item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return pageableListView; }
From source file:au.org.theark.registry.web.component.invoice.SearchResultListPanel.java
License:Open Source License
@SuppressWarnings("serial") public DataView<Pipeline> buildDataView(ArkDataProvider<Pipeline, IArkCommonService> subjectProvider) { DataView<Pipeline> studyCompDataView = new DataView<Pipeline>(Constants.RESULT_LIST, subjectProvider) { @Override/*from w w w . ja va2s . c om*/ protected void populateItem(final Item<Pipeline> item) { Pipeline pipeline = item.getModelObject(); if (pipeline != null && pipeline.getId() != null) { item.add(new Label("id", pipeline.getId().toString())); } else { item.add(new Label("id", "")); } item.add(buildLink(item.getModelObject())); //item.add(new Label("name", item.getModelObject().getName())); if (pipeline != null && pipeline.getDescription() != null) { item.add(new Label("description", pipeline.getDescription())); } else { item.add(new Label("description", "")); } item.add(new AttributeModifier(Constants.CLASS, new AbstractReadOnlyModel() { @Override public String getObject() { return (item.getIndex() % 2 == 1) ? Constants.EVEN : Constants.ODD; } })); } }; return studyCompDataView; }
From source file:au.org.theark.report.web.component.dataextraction.filter.form.QueryFilterForm.java
License:Open Source License
/** * @return the listEditor of Biospecimens to aliquot *///w ww.j av a 2 s. c om public AbstractListEditor<QueryFilterVO> buildListEditor() { listEditor = new AbstractListEditor<QueryFilterVO>("queryFilterVOs", new PropertyModel(getModelObject(), "queryFilterVOs")) { private static final long serialVersionUID = 1L; @SuppressWarnings("serial") @Override protected void onPopulateItem(final ListItem<QueryFilterVO> item) { item.setOutputMarkupId(true); item.add(new Label("row", "" + (item.getIndex() + 1))); if (copyQueryFilter) { item.getModelObject().setFieldCategory(queryFilterVoToCopy.getFieldCategory()); item.getModelObject().setQueryFilter(queryFilterVoToCopy.getQueryFilter()); item.getModelObject().getQueryFilter() .setValue(queryFilterVoToCopy.getQueryFilter().getValue()); item.getModelObject().getQueryFilter() .setSecondValue(queryFilterVoToCopy.getQueryFilter().getSecondValue()); } initFieldCategoryDdc(item); initFieldDdc(item); initOperatorDdc(item); valueTxtFld = new TextField<String>("value", new PropertyModel(item.getModelObject(), "queryFilter.value")); valueTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { /* we may want to perform some live validation based on the type of field we are selecting */ log.info("onchange of VALUE"); target.add(feedbackPanel); } }); item.add(valueTxtFld); // Copy button allows entire row details to be copied item.add(new AjaxEditorButton(Constants.COPY) { private static final long serialVersionUID = 1L; @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(feedbackPanel); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { QueryFilterVO queryFilterVO = new QueryFilterVO(); try { PropertyUtils.copyProperties(queryFilterVO, getItem().getModelObject()); PropertyUtils.copyProperties(queryFilterVoToCopy, getItem().getModelObject()); queryFilterVoToCopy.getQueryFilter().setId(null); queryFilterVO.getQueryFilter().setId(null); copyQueryFilter = true; listEditor.addItem(queryFilterVO); target.add(form); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } }.setDefaultFormProcessing(false)); item.add(new AjaxEditorButton(Constants.DELETE) { private static final long serialVersionUID = 1L; @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(feedbackPanel); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { iArkCommonService.deleteQueryFilter(item.getModelObject().getQueryFilter()); listEditor.removeItem(item); target.add(form); } }.setDefaultFormProcessing(false).setVisible(item.getIndex() >= 0)); item.add(new AttributeModifier(Constants.CLASS, new AbstractReadOnlyModel() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? Constants.EVEN : Constants.ODD; } })); } }; return listEditor; }
From source file:au.org.theark.report.web.component.dataextraction.SearchResultListPanel.java
License:Open Source License
/** * /*from www.j a v a 2 s. co m*/ * @param iModel * @param searchContainer * @return */ public PageableListView<Search> buildPageableListView(IModel iModel) { PageableListView<Search> sitePageableListView = new PageableListView<Search>("searchList", iModel, iArkCommonService.getUserConfig(Constants.CONFIG_ROWS_PER_PAGE).getIntValue()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<Search> item) { Search search = item.getModelObject(); /* The Search ID */ if (search.getId() != null) { // Add the study Component Key here item.add(new Label("search.id", search.getId().toString())); } else { item.add(new Label("search.id", "")); } if (search.getStatus() != null) { // Add the study Component Key here item.add(new Label("search.status", ArkString.toSentenceCase(search.getStatus()))); } else { item.add(new Label("search.status", "")); } if (search.getStartTime() != null) { item.add(new Label("search.startTime", dateFormat.format(search.getStartTime()))); } else { item.add(new Label("search.startTime", "")); } if (search.getFinishTime() != null) { item.add(new Label("search.finishTime", dateFormat.format(search.getFinishTime()))); } else { item.add(new Label("search.finishTime", "")); } /* Search Name Link */ item.add(buildLink(search)); item.add(buildDownloadButton(search)); item.add(buildRunSearchButton(search)); /* The Search Name if (search.getName() != null) { item.add(new Label("search.name", search.getName())); } else { item.add(new Label("search.name", "no name given")); } */ // TODO when displaying text escape any special characters /* Description * if (search.getDescription() != null) { item.add(new Label("search.description", search.getDescription()));// the ID here must match the ones in mark-up } else { item.add(new Label("search.description", ""));// the ID here must match the ones in mark-up }*/ /* For the alternative stripes */ item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return sitePageableListView; }
From source file:au.org.theark.report.web.component.searchresult.SearchResultPanel.java
License:Open Source License
/** * //from w ww.j a v a 2 s . co m * @param iModel * @return the pageableListView of Upload */ public PageableListView<SearchResult> buildPageableListView(IModel iModel) { PageableListView<SearchResult> sitePageableListView = new PageableListView<SearchResult>( Constants.RESULT_LIST, iModel, iArkCommonService.getUserConfig(Constants.CONFIG_CUSTOM_FIELDS_PER_PAGE).getIntValue()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<SearchResult> item) { SearchResult searchResult = item.getModelObject(); // The ID if (searchResult.getId() != null) { // Add the id component here item.add(new Label("searchResult.id", searchResult.getId().toString())); } else { item.add(new Label("searchResult.id", "")); } // / The filename if (searchResult.getFilename() != null) { // Add the id component here item.add(new Label("searchResult.fileName", searchResult.getFilename())); } else { item.add(new Label("searchResult.fileName", "")); } // File Format if (searchResult.getFileFormat() != null) { item.add(new Label("searchResult.fileFormat", searchResult.getFileFormat().getName())); } else { item.add(new Label("searchResult.fileFormat", "")); } // UserId if (searchResult.getUserId() != null) { item.add(new Label("searchResult.userId", searchResult.getUserId())); } else { item.add(new Label("searchResult.userId", "")); } // Start time if (searchResult.getStartTime() != null) { item.add(new Label("searchResult.startTime", searchResult.getStartTime().toString())); } else { item.add(new Label("searchResult.startTime", "")); } // Finish time if (searchResult.getFinishTime() != null) { item.add(new Label("searchResult.finishTime", searchResult.getFinishTime().toString())); } else { item.add(new Label("searchResult.finishTime", "")); } /* if (searchResult.getUploadStatus() != null && searchResult.getUploadStatus().getShortMessage()!=null) { item.add(new Label(Constants.UPLOADVO_UPLOAD_UPLOAD_STATUS_NAME, searchResult.getUploadStatus().getShortMessage())); } else { item.add(new Label(Constants.UPLOADVO_UPLOAD_UPLOAD_STATUS_NAME, "")); } */ // Download file link button item.add(buildDownloadButton(searchResult)); // For the alternative stripes item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; return sitePageableListView; }