Modified:
trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/TriageScreen.java
trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/entry/ClinicRegistrationEntry.java
Log:
Implement singleton patterns for triage and clinic entry screen.
Modified: trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/TriageScreen.java
===================================================================
--- trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/TriageScreen.java 2011-11-16 06:05:30 UTC (rev 6177)
+++ trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/TriageScreen.java 2011-11-16 06:07:10 UTC (rev 6178)
@@ -95,14 +95,14 @@
if (triageScreenList.size() < AppConstants.MAX_TRIAGE_TABS)
triageScreenList.add(triageScreen = new TriageScreen());
else
- // returns last instance of UnfiledDocuments from list
+ // returns last instance of TriageScreen from list
triageScreen = triageScreenList
.get(AppConstants.MAX_TRIAGE_TABS - 1);
return triageScreen;
}
- public static boolean removeInstance(TriageScreen unfiledDocuments) {
- return triageScreenList.remove(unfiledDocuments);
+ public static boolean removeInstance(TriageScreen triageScreen) {
+ return triageScreenList.remove(triageScreen);
}
public TriageScreen() {
Modified: trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/entry/ClinicRegistrationEntry.java
===================================================================
--- trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/entry/ClinicRegistrationEntry.java 2011-11-16 06:05:30 UTC (rev 6177)
+++ trunk/ui/gwt/src/main/java/org/freemedsoftware/gwt/client/screen/entry/ClinicRegistrationEntry.java 2011-11-16 06:07:10 UTC (rev 6178)
@@ -26,7 +26,9 @@
import static org.freemedsoftware.gwt.client.i18n.I18nUtil._;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import org.freemedsoftware.gwt.client.EntryScreenInterface;
import org.freemedsoftware.gwt.client.HashSetter;
@@ -73,6 +75,26 @@
protected CustomTextArea wNotes = null;
+ protected static List<ClinicRegistrationEntry> clinicRegistrationEntryScreenList = null;
+
+ public static ClinicRegistrationEntry getInstance() {
+ ClinicRegistrationEntry clinicRegistrationEntryScreen = null;
+
+ if (clinicRegistrationEntryScreenList == null)
+ clinicRegistrationEntryScreenList = new ArrayList<ClinicRegistrationEntry>();
+ if (clinicRegistrationEntryScreenList.size() < AppConstants.MAX_CLINIC_REGISTRATION_TABS)
+ clinicRegistrationEntryScreenList.add(clinicRegistrationEntryScreen = new ClinicRegistrationEntry());
+ else
+ // returns last instance of ClinicRegistrationEntry from list
+ clinicRegistrationEntryScreen = clinicRegistrationEntryScreenList
+ .get(AppConstants.MAX_CLINIC_REGISTRATION_TABS - 1);
+ return clinicRegistrationEntryScreen;
+ }
+
+ public static boolean removeInstance(ClinicRegistrationEntry clinicRegistrationEntryScreen) {
+ return clinicRegistrationEntryScreenList.remove(clinicRegistrationEntryScreen);
+ }
+
public ClinicRegistrationEntry() {
final VerticalPanel verticalPanel = new VerticalPanel();
initWidget(verticalPanel);
@@ -114,7 +136,7 @@
flexTable.setWidget(pos, 1, wDateOfBirth);
pos++;
- final Label ageLabel = new Label(_("Age (if no date of birth)"));
+ final Label ageLabel = new Label(_("Age in Years (if no date of birth)"));
flexTable.setWidget(pos, 0, ageLabel);
wAge = new CustomTextBox();
wAge.setHashMapping("age");