List of usage examples for org.apache.wicket.ajax AjaxRequestTarget appendJavaScript
void appendJavaScript(CharSequence javascript);
If the javascript needs to do something asynchronously (i.e.
From source file:$.ModalPanel.java
License:Apache License
public void hide(AjaxRequestTarget target) { target.appendJavaScript("$('#" + this.getMarkupId(true) + "').modal('hide')"); }
From source file:au.org.theark.core.web.form.AbstractModalDetailForm.java
License:Open Source License
public void onEditSave(AjaxRequestTarget target, Form<?> form) { onSave(target);/*from ww w . j av a 2 s .c o m*/ target.add(arkCrudContainerVo.getDetailPanelContainer()); String s = "jQuery('form#" + form.getMarkupId() + "').cleanDirty();"; target.appendJavaScript(s); target.focusComponent(feedbackPanel); }
From source file:au.org.theark.core.web.form.HistoryAjaxBehavior.java
License:Open Source License
/** * Registers a new entry in the history if this request is not triggered by back/forward buttons * /*from www. jav a 2s . c o m*/ * @param target * the current request target * @param component * the component which triggered this Ajax request */ public void registerAjaxEvent(final AjaxRequestTarget target, final Component component) { if (RequestCycle.get().getRequest().getRequestParameters() .getParameterValue(HistoryAjaxBehavior.HISTORY_ITEM_PARAM).isNull()) { target.appendJavaScript("HistoryManager.addHistoryEntry('" + component.getId() + "');"); } }
From source file:au.org.theark.lims.web.component.button.brady.biospecimen.PrintBiospecimenStrawLabelButton.java
License:Open Source License
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (barcodeLabel != null) { StringBuffer sb = new StringBuffer(); if (numberModel == null) { barcodesToPrint = 1;//from www . java 2s . c o m } else { barcodesToPrint = (Number) numberModel.getObject(); } for (int i = 0; i < barcodesToPrint.intValue(); i++) { sb.append(iLimsAdminService.createBiospecimenLabelTemplate(biospecimen, barcodeLabel)); sb.append("%0A"); } this.tsplString = sb.toString(); if (tsplString == null || tsplString.isEmpty()) { this.error("There was an error when attempting to print the straw barcode for: " + biospecimen.getBiospecimenUid()); log.error("There was an error when attempting to print the straw barcode for: " + biospecimen.getBiospecimenUid()); } else { log.debug(tsplString); target.appendJavaScript( "printBarcode(\"" + barcodeLabel.getBarcodePrinterName() + "\",\"" + tsplString + "\");"); onPostSubmit(target, form); } } }
From source file:au.org.theark.lims.web.component.button.zebra.biocollection.PrintBioCollectionLabelButton.java
License:Open Source License
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (barcodeLabel != null) { StringBuffer sb = new StringBuffer(); if (numberModel == null) { barcodesToPrint = 1;//from ww w .j a v a 2 s . c o m } else { barcodesToPrint = (Number) numberModel.getObject(); } for (int i = 0; i < barcodesToPrint.intValue(); i++) { sb.append(iLimsAdminService.createBioCollectionLabelTemplate(bioCollection, barcodeLabel)); sb.append("%0A"); } this.zplString = sb.toString(); if (zplString == null || zplString.isEmpty()) { this.error("There was an error when attempting to print the barcode for: " + bioCollection.getBiocollectionUid()); log.error("There was an error when attempting to print the barcode for: " + bioCollection.getBiocollectionUid()); } else { log.debug(zplString); target.appendJavaScript( "printBarcode(\"" + barcodeLabel.getBarcodePrinterName() + "\",\"" + zplString + "\");"); onPostSubmit(target, form); } } }
From source file:au.org.theark.lims.web.component.button.zebra.biocollection.PrintBiospecimensForBioCollectionButton.java
License:Open Source License
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (barcodeLabel != null) { List<Biospecimen> biospecimenList = iLimsService.getBiospecimenByBioCollection(bioCollection); if (numberModel == null) { barcodesToPrint = 1;/*from ww w . java 2s . co m*/ } else { barcodesToPrint = (Number) numberModel.getObject(); } StringBuffer sb = new StringBuffer(); for (Biospecimen biospecimen : biospecimenList) { biospecimen.setBarcoded(true); for (int i = 0; i < barcodesToPrint.intValue(); i++) { sb.append(iLimsAdminService.createBiospecimenLabelTemplate(biospecimen, barcodeLabel)); sb.append("%0A"); } } this.zplString = sb.toString(); if (zplString == null || zplString.isEmpty()) { this.error("There was an error when attempting to print the biospecimen barcodes for: " + bioCollection.getBiocollectionUid()); log.error("There was an error when attempting to print the biospecimen barcodes for: " + bioCollection.getBiocollectionUid()); } else { log.debug(zplString); target.appendJavaScript( "printBarcode(\"" + barcodeLabel.getBarcodePrinterName() + "\",\"" + zplString + "\");"); onPostSubmit(target, form); } } }
From source file:au.org.theark.lims.web.component.button.zebra.biospecimen.PrintBiospecimenLabelButton.java
License:Open Source License
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (barcodeLabel != null) { StringBuffer sb = new StringBuffer(); if (numberModel == null) { barcodesToPrint = 1;/* w ww. j av a 2 s .com*/ log.warn("number model was null - set to 1"); } else { barcodesToPrint = (Number) numberModel.getObject(); log.warn("number model aka barcodes to print = " + barcodesToPrint); } for (int i = 0; i < barcodesToPrint.intValue(); i++) { sb.append(iLimsAdminService.createBiospecimenLabelTemplate(biospecimen, barcodeLabel)); sb.append("%0A"); log.warn("have done this many barcodes in for loop = " + i); } zplString = sb.toString(); log.warn("so zpl string looks like this; " + zplString); if (zplString == null || zplString.isEmpty()) { this.error("There was an error when attempting to print the barcode for: " + biospecimen.getBiospecimenUid()); log.error("There was an error when attempting to print the barcode for: " + biospecimen.getBiospecimenUid()); } else { log.warn("printer = " + barcodeLabel.getBarcodePrinterName()); target.appendJavaScript( "printBarcode(\"" + barcodeLabel.getBarcodePrinterName() + "\",\"" + zplString + "\");"); onPostSubmit(target, form); } } }
From source file:au.org.theark.registry.web.component.invoice.ProcessResultListPanel.java
License:Open Source License
private AjaxLink buildLink(final Process process) { ArkBusyAjaxLink link = new ArkBusyAjaxLink("processLink") { @Override/*from ww w . j av a 2 s.c om*/ public void onClick(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); //subject.getLinkSubjectStudy().setStudy(iArkCommonService.getStudy(sessionStudyId)); //ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); //POPUP FOR DETAILS //target.appendJavaScript("alert('popup for process details');"); arkCrudContainerVO = new ArkCrudContainerVO(); ProcessContainerForm processContainerForm = new ProcessContainerForm("content", new CompoundPropertyModel<Process>(process)); //add(processContainerForm); processDetailPanel = new ProcessDetailPanel("detailContainer", feedBackPanel, arkCrudContainerVO, processContainerForm); processDetailPanel.initialisePanel(); //processContainerForm.add(processDetailPanel); DetailPanel dp = new DetailPanel("content", feedBackPanel, arkCrudContainerVO, containerForm); dp.initialisePanel(); PageableListView<Pipeline> listView = null; SearchPanel sp = new SearchPanel("content", feedBackPanel, listView, containerForm, arkCrudContainerVO); sp.initialisePanel(); //target.appendJavaScript("alert('Process : " + process.getName() + "');"); List<ProcessInput> list = iArkCommonService.getProcessInputsForProcess(process); StringBuilder processInputDetails = new StringBuilder(); for (Iterator iterator = list.iterator(); iterator.hasNext();) { ProcessInput processInput = (ProcessInput) iterator.next(); processInputDetails.append("FileHash: "); processInputDetails.append(processInput.getInputFileHash()); processInputDetails.append("<br>"); processInputDetails.append("Input Location: "); processInputDetails.append(processInput.getinputFileLocation()); processInputDetails.append("<br>"); processInputDetails.append("File type: "); processInputDetails.append(processInput.getInputFileType()); processInputDetails.append("<br>"); processInputDetails.append("Input Kept: "); processInputDetails.append(processInput.getInputKept()); processInputDetails.append("<br>"); processInputDetails.append("Input Server: "); processInputDetails.append(processInput.getInputServer()); } target.appendJavaScript("alert('ProcessInput Details : " + processInputDetails + "');"); List<ProcessOutput> list2 = iArkCommonService.getProcessOutputsForProcess(process); StringBuilder processOutputDetails = new StringBuilder(); for (Iterator iterator = list2.iterator(); iterator.hasNext();) { ProcessOutput processOutput = (ProcessOutput) iterator.next(); processOutputDetails.append("File Location: "); processOutputDetails.append(processOutput.getOutputFileLocation()); processOutputDetails.append("<br>"); processOutputDetails.append("File Hash: "); processOutputDetails.append(processOutput.getOutputFileHash()); processOutputDetails.append("<br>"); processOutputDetails.append("File type: "); processOutputDetails.append(processOutput.getOutputFileType()); processOutputDetails.append("<br>"); processOutputDetails.append("Output Kept: "); processOutputDetails.append(processOutput.getOutputKept()); processOutputDetails.append("<br>"); processOutputDetails.append("Output Server: "); processOutputDetails.append(processOutput.getOutputServer()); } target.appendJavaScript("alert('ProcessOutput Details : " + processOutputDetails + "');"); // Set the modalWindow title and content //modalWindow.setTitle("Edit Process Details"); //modalWindow.setContent(new EmptyPanel("content")); modalWindow.show(target); // arkCrudContainerVO.getDetailPanelContainer().replaceWith(processDetailPanel); ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); } }; Label nameLinkLabel = new Label("process", process.getName()); link.add(nameLinkLabel); return link; }
From source file:au.org.theark.report.web.component.dataextraction.form.DetailForm.java
License:Open Source License
public void initialiseDetailForm() { arkCrudContainerVO.getDetailPanelFormContainer().add(modalWindow); searchIdTxtFld = new TextField<String>(Constants.SEARCH_ID); searchIdTxtFld.setEnabled(false);//from w w w . j a v a 2 s . co m searchNameTxtFld = new TextField<String>(Constants.SEARCH_NAME); searchNameTxtFld.add(new ArkDefaultFormFocusBehavior()); modalContentPanel = new EmptyPanel("content"); initIncludeGeno(); initDemographicFieldsModulePalette(); initBiospecimenFieldsModulePalette(); initBiocollectionFieldsModulePalette(); initPhenoDataSetFieldDisplaysModulePalette(); initSubjectCustomFieldDisplaysModulePalette(); initBiospecimenCustomFieldDisplaysModulePalette(); initBiocollectionCustomFieldDisplaysModulePalette(); initConsentStatusFieldsModulePalette(); arkCrudContainerVO.getDetailPanelFormContainer().add(subjectListFileUploadField); arkCrudContainerVO.getDetailPanelFormContainer().add(new AjaxLink("downloadSubjectList") { @Override public void onClick(AjaxRequestTarget target) { // TODO Auto-generated method stub target.appendJavaScript("alert('Link clicked');"); } }); clearButton = new AjaxButton("clearButton") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { subjectListFileUploadField.clearInput(); target.add(subjectListFileUploadField); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { subjectListFileUploadField.clearInput(); target.add(subjectListFileUploadField); } }; clearButton.add(new AttributeModifier("title", new Model<String>("Clear Attachment"))); addDetailFormComponents(); attachValidators(); }
From source file:au.org.theark.report.web.component.dataextraction.SearchResultListPanel.java
License:Open Source License
private AjaxButton buildRunSearchButton(final Search search) { AjaxButton ajaxButton = new AjaxButton(au.org.theark.report.web.Constants.RUN_BATCH_QUERY) { private static final long serialVersionUID = 1L; @Override// w w w . j a v a2 s . c om protected void onSubmit(AjaxRequestTarget target, Form<?> form) { //TODO ASAP : this will be replaced by call to job //iArkCommonService.runSearch(search.getId()); try { SecurityUtils.getSubject(); search.setStartTime(new java.util.Date(System.currentTimeMillis())); search.setStatus("RUNNING"); search.setFinishTime(null); iArkCommonService.update(search); String currentUser = SecurityUtils.getSubject().getPrincipals().getPrimaryPrincipal() .toString(); DataExtractionUploadExecutor task = new DataExtractionUploadExecutor(iArkCommonService, search.getId(), currentUser);//, studyId); task.run(); target.add(SearchResultListPanel.this); target.appendJavaScript( "alert('Data files are being created as a background job. You may download when complete.');"); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("TODO: decent logging and handling" + e.getMessage()); e.printStackTrace(); } finally { } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { this.error("Unexpected Error: Could not process download request"); }; @Override public boolean isVisible() { //TODO return correct status return search.getStatus() != null && !search.getStatus().equalsIgnoreCase("RUNNING"); //return search.getStatus() != null && search.getStatus().equalsIgnoreCase("READY TO RUN") || true; } }; //ajaxButton.setVisible(true); ajaxButton.setDefaultFormProcessing(false); //log.warn("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n how many times is this run?"); //TODO move back //if (upload.getPayload() == null) //if (data == null) //ajaxButton.setVisible(false); return ajaxButton; }