private void handleKeyEventForFamily(Event event, Family family) {
long time = isLive() ? getTime() : getElapsedTime();
Entry logEntry = new Entry(time);
char startKey = String.valueOf(family.getStartKey()).toLowerCase()
.charAt(0);
char endKey = String.valueOf(family.getEndKey()).toLowerCase()
.charAt(0);
char keyPressed = String.valueOf(event.character).toLowerCase().charAt(
0);
if (keyPressed == startKey || keyPressed == endKey) {
String name = family.getName();
logEntry.setName(name);
// fillFamily(family);
Stack<Entry> logEntries = family.getLogEntries();
if (keyPressed == startKey) {
if (family.isPunctual()) {
logEntry.setType(TYPE.PUNCTUAL);
} else {
logEntry.setType(TYPE.START);
}
if (!family.isPunctual()) {
if (logEntries.empty()) {
addLogEntry(logEntry);
} else {
if (logEntries.peek().getType() != TYPE.START) {
addLogEntry(logEntry);
clearErrorMessage();
} else {
showSameEntryTypeError(logEntry);
}
}
} else {
addLogEntry(logEntry);
}
} else if (keyPressed == endKey) {
if (!family.isPunctual()) {
logEntry.setType(TYPE.END);
if (logEntries.empty()) {
showFirstLogEntryError(logEntry);
} else {
if (logEntries.peek().getType() != TYPE.END) {
addLogEntry(logEntry);