Skip to content

Instantly share code, notes, and snippets.

@ubiquitousthey
Created March 8, 2012 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ubiquitousthey/2003245 to your computer and use it in GitHub Desktop.
Save ubiquitousthey/2003245 to your computer and use it in GitHub Desktop.
Class to support rendering an enumeration.
enum ECGRhythms implements {
NORMAL_SINUS_RHYTHM("Normal sinus rhythm",1),
PACEMAKER("Pacemaker",2),
FREQUENT_PVCS("Frequent PVCs",3),
ATRIAL_FIBRILLATION("Atrial fibrillation", 5),
OTHER("Other", 6);
String display;
int value;
ECGRhythms(String display, int value) {
this.display = display;
this.value = value;
}
static List<ECGRhythms> asList() {
return Arrays.asList(ECGRhythms.values());
}
public int getValue() {
return this.value;
}
}
public class Demo {
ValueListBox<ECGRhythm> vlb;
void demo() {
vlb = new ValueListBox<ECGRhythms>(
new ToStringRenderer<ECGRhythms>());
vlb.setAcceptableValues(ECGRhythm.asList());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment