/* * iDART: The Intelligent Dispensing of Antiretroviral Treatment * Copyright (C) 2006 Cell-Life * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version * 2 for more details. * * You should have received a copy of the GNU General Public License version 2 * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.celllife.idart.gui.reportParameters; import model.manager.reports.NonEkapaPatientsReport; import org.apache.log4j.Logger; import org.celllife.idart.commonobjects.CommonObjects; import org.celllife.idart.gui.platform.GenericReportGui; import org.celllife.idart.gui.utils.ResourceUtils; import org.celllife.idart.gui.utils.iDartColor; import org.celllife.idart.gui.utils.iDartFont; import org.celllife.idart.gui.utils.iDartImage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.hibernate.Session; /** */ public class NonEkapaPatientsReportGUI extends GenericReportGui { private Group grpClinicSelection; private Label lblClinic; private CCombo cmbClinic; /** * Constructor * * @param parent * Shell * @param hSession * Session */ public NonEkapaPatientsReportGUI(Shell parent, Session hSession) { super(parent, hSession, REPORTTYPE_CLINICMANAGEMENT); } /** * This method initializes newMonthlyStockOverview */ @Override protected void createShell() { String shellTxt = "Patients not in eKapa"; Rectangle bounds = new Rectangle(100, 50, 600, 427); buildShell(shellTxt, bounds); // create the composites } protected void createMyGroups() { createGrpClinicSelection(); } /** * This method initializes compHeader * */ @Override protected void createCompHeader() { String headerTxt = "Patients not in eKapa"; iDartImage icoImage = iDartImage.REPORT_PATIENTDEFAULTERS; buildCompdHeader(headerTxt, icoImage); } /** * This method initializes grpClinicSelection * */ private void createGrpClinicSelection() { grpClinicSelection = new Group(getShell(), SWT.NONE); grpClinicSelection.setText("Down Referral Clinic"); grpClinicSelection.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); grpClinicSelection.setBounds(new org.eclipse.swt.graphics.Rectangle( 140, 90, 320, 65)); lblClinic = new Label(grpClinicSelection, SWT.NONE); lblClinic.setBounds(new Rectangle(7, 25, 143, 20)); lblClinic.setText("Select Down Referral Clinic"); lblClinic.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); cmbClinic = new CCombo(grpClinicSelection, SWT.BORDER); cmbClinic.setBounds(new Rectangle(154, 24, 160, 20)); cmbClinic.setEditable(false); cmbClinic.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); cmbClinic.setBackground(ResourceUtils.getColor(iDartColor.WHITE)); CommonObjects.populateClinics(getHSession(), cmbClinic); } /** * This method initializes compButtons * */ @Override protected void createCompButtons() { } @Override protected void cmdViewReportWidgetSelected() { if (cmbClinic.getText().equals("")) { MessageBox missing = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK); missing.setText("No Clinic Was Selected"); missing .setMessage("No clinic was selected. Please select a clinic by looking through the list of available clinics."); missing.open(); } else { NonEkapaPatientsReport report = new NonEkapaPatientsReport( getShell(), cmbClinic.getText()); viewReport(report); } } /** * This method is called when the user presses "Close" button * */ @Override protected void cmdCloseWidgetSelected() { this.getShell().dispose(); } @Override protected void setLogger() { setLog(Logger.getLogger(this.getClass())); } }