private void unsetLocalContext() { if (form.grdList().getSelectedRow() != null && form.grdList().getSelectedRow().getValue() != null && form.grdList().getSelectedRow().getValue() instanceof PrinterVo) { if (form.grdList().getSelectedRow().getValue().equals(form.getLocalContext().getDefaultPrinter())) { form.getLocalContext().setDefaultPrinter(null); } if (form.grdList().getSelectedRow().getValue().equals(form.getLocalContext().getDesignatedPrinterForNewResults())) { form.getLocalContext().setDesignatedPrinterForNewResults(null); } if (form.grdList().getSelectedRow().getValue().equals(form.getLocalContext().getDesignatedPrinterForOCSOrder())) { form.getLocalContext().setDesignatedPrinterForOCSOrder(null); } } }
private String getPrinter(DischargeDetailsRefVo dischargeDetails) { if(dischargeDetails == null || dischargeDetails.getID_DischargeDetails() == null) throw new CodingRuntimeException("DischargeDetailsRefVo is null or id not provided for getPrinter"); DomainFactory factory = getDomainFactory(); DischargeDetails doDD = (DischargeDetails)factory.getDomainObject(DischargeDetails.class,dischargeDetails.getID_DischargeDetails()); if (doDD.getDischargingWard() != null) { Location doLoc = (Location)factory.getDomainObject(Location.class,doDD.getDischargingWard().getId()); PrinterVo voDefaultPrinter = LocationFullVoAssembler.create(doLoc).getDefaultPrinter(); return voDefaultPrinter != null ? voDefaultPrinter.getName() : ""; } return ""; }
public PrinterVo getPrinter(IPrinter printer) { if (printer == null) throw new CodingRuntimeException("printer cannot be null in method getPrinter"); DomainFactory factory = getDomainFactory(); return PrinterVoAssembler.create((Printer) factory.getDomainObject(Printer.class, printer.getIPrinterId())); }
@Override protected void onCcPrintersValueChanged() throws PresentationLogicException { IPrinter[] printers = form.ccPrinters().getPrinters(); if ( printers != null) { form.grdSearch().getRows().clear(); ArrayList<IPrinter> configuredPrinters = new ArrayList<IPrinter>(); for (int i = 0; i <form.grdList().getRows().size(); i++) { configuredPrinters.add(form.grdList().getRows().get(i).getValue()); } grdSearchRow row; for (int i = 0; i < printers.length; i++) { boolean alreadyConfigured = false; for (int j = 0; j < configuredPrinters.size(); j++) { if (printers[i].getIPrinterId() == configuredPrinters.get(j).getIPrinterId()) { alreadyConfigured = true; break; } } if (!alreadyConfigured) { row = form.grdSearch().getRows().newRow(); PrinterVo value = new PrinterVo(printers[i].getIPrinterId(), printers[i].getIPrinterRecordVersion()); value.setID_Printer(printers[i].getIPrinterId() != 0 ? printers[i].getIPrinterId() : null); value.setName(printers[i].getIPrinterName()); value.setActive(true); row.setcolItems(printers[i].getIPrinterName()); row.setValue(value); } } form.ccPrinters().clear(); } }