Constructors Summary |
---|
public InEntry(Frame frame, String title, boolean modal)
super(frame, title, modal);
try {
setup();
add(panel1);
pack();
}
catch (Exception e) {
e.printStackTrace();
}
this.setSize(410,291);
Dimension frmSize = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((frmSize.width - getSize().width)/2, (frmSize.height - getSize().height)/2);
// validate();
|
public InEntry(Frame frame)
this(frame, "", false);
|
public InEntry(Frame frame, boolean modal)
this(frame, "", modal);
|
public InEntry(Frame frame, String title)
this(frame, title, false);
|
Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent e)
String command = e.getActionCommand();
if(command.equals("OK")) createIndividual();
if(command.equals("Update")) updateIndividual();
if(command.equals("Cancel"))
{
cancel = true;
dispose();
}
if(command.equals("Child Of >>")) setChildOfField();
if(command.equals("Married To >>")) setParentOfField();
if(command.equals("Individual >>")) setIndividualFields();
|
void | createIndividual()
Family family;
String testSex = new String();
int notComplete = 0;
String error = new String();
testSex = textField3.getText().toUpperCase();
if(textField1.getText().length() == 0) {
notComplete = 1;
error = new String("Need to input first name");
}
else {
if(parentReturned != null) {
if(testSex.equals("M")) {
if(parentReturned.getHusband() != null) {
notComplete = 1;
error = error + "\nHusband for family already exists";
}
}
else {
if(testSex.equals("F")) {
if(parentReturned.getWife() != null) {
notComplete = 1;
error = error + "\nWife for family already exists";
}
}
}
}
}
if(textField7.getText().length() == 0) {
if(textField2.getText().length() == 0) {
notComplete = 1;
error = error + "\nNeed childOf or parentOf";
}
}
if(textField3.getText().length() == 0) {
error = error + "\nNeed to enter sex";
notComplete = 1;
}
else {
if(!testSex.equals("M") && !testSex.equals("F")) {
notComplete = 1;
error = error + "\nSex must be m or f";
}
}
if(newFamily == true && testSex.equals("F")) {
notComplete = 1;
error = error + "\nCreation of new family must start with \nhusband";
}
if(notComplete == 0) {
if(newIndividual) {
person = new Individual();
if(textField7.getText().length() == 0) {
if(testSex.equals("F") && textField6.getText().length() != 0)
person.setFamilyName(textField6.getText());
else
person.setFamilyName(textField2.getText());
}
else person.setFamilyName(textField7.getText());
person.setGivenNames(textField1.getText());
person.setSex(testSex);
}
dispose();
}
else {
errorDlg = new ErrorDialog((Frame)getParent(),true);
errorDlg.setMessage(error);
Dimension frmSize = getParent().getSize();
Point loc = getParent().getLocation();
errorDlg.setLocation((frmSize.width - 253)/ 2 + loc.x, (frmSize.height - 192) / 2 + loc.y);
errorDlg.setVisible(true);
}
|
void | createListDialog()
listDlg = new ListDialog((Frame)getParent());
Dimension frmSize = getSize();
Point loc = getLocation();
listDlg.setLocation((frmSize.width - 180)/ 2 + loc.x, (frmSize.height - 300) / 2 + loc.y);
listDlg.setModal(true);
listDlg.setMenu(false);
|
boolean | getCancel()
return cancel;
|
Family | getChild()
return childReturned;
|
Individual | getIndividual()
return person;
|
boolean | getNewFamily()
return newFamily;
|
Family | getParentOf()
return parentReturned;
|
boolean | isChild()
if(childReturned != null) {
if(newIndividual) return true;
else return false;
}
else return false;
|
boolean | isNewIndividual()
return newIndividual;
|
boolean | isParent()
if(parentReturned != null) return true;
else return false;
|
void | keyPressed()
newFamily = true;
parentReturned = null;
|
void | setChildOfField()
createListDialog();
listDlg.setTitle("Child of...");
listDlg.createFamilyList(list);
listDlg.setVisible(true);
childReturned = listDlg.getFamily();
if(childReturned != null) textField7.setText(childReturned.getHusband().getFamilyName());
if(textField2.getText().length() > 0) {
textField3.setText("F");
textField6.setText(textField7.getText());
}
else
textField6.setText("");
|
void | setInList(java.util.Hashtable list)
people = list;
|
void | setIndividualFields()
Family family;
String test;
createListDialog();
listDlg.setTitle("Individuals...");
listDlg.createIndividualList(people);
listDlg.setVisible(true);
person = listDlg.getIndividual();
if(person != null) {
newFamily = true;
parentReturned = null;
newIndividual = false;
textField1.setText(person.getGivenNames());
family = person.getChildOf();
if(family != null) textField7.setText(family.getHusband().getFamilyName());
textField3.setText(person.getSex());
test = person.getSex();
if(test.equals("M")) textField2.setText(person.getFamilyName());
button1.setLabel("Update");
}
|
void | setList(java.util.Hashtable list)
this.list = list;
|
void | setParentOfField()
createListDialog();
listDlg.setTitle("Married To...");
listDlg.createSinglesList(list);
listDlg.setVisible(true);
parentReturned = listDlg.getFamily();
if(parentReturned != null)
{
textField2.setText(parentReturned.getHusband().getFamilyName());
newFamily = false;
}
if(textField7.getText().length() > 0) {
textField3.setText("F");
textField6.setText(textField7.getText());
}
if(textField3.getText().toUpperCase().equals("F"))
textField6.setEditable(true);
|
public void | setup()
this.setTitle("Individual Detail Entry...");
label1.setText("First Names");
label2.setText("Child Of");
label3.setText("Sex");
label4.setText("Date of Birth");
label6.setText("Date of Death");
label7.setText("Parent Of");
label8.setText("Maiden Name");
textField2.addKeyListener(new textEventHandler(this));
textField3.addTextListener(this);
textField6.setEditable(false);
textField7.setEditable(false);
button1.setLabel("OK");
button1.addActionListener(this);
button2.setLabel("Cancel");
button2.addActionListener(this);
button3.setLabel("Child Of >>");
button3.addActionListener(this);
button4.setLabel("Married To >>");
button4.addActionListener(this);
button5.setLabel("Individual >>");
button5.addActionListener(this);
gridLayout1.setRows(10);
gridLayout1.setHgap(5);
gridLayout1.setColumns(2);
gridLayout1.setVgap(5);
panel1.setLayout(gridLayout1);
panel1.add(label1, null);
panel1.add(textField1, null);
panel1.add(label2, null);
panel1.add(textField7, null);
panel1.add(label7, null);
panel1.add(textField2, null);
panel1.add(button5, null);
panel1.add(button3, null);
panel1.add(button4, null);
panel1.add(label5, null);
panel1.add(label3, null);
panel1.add(textField3, null);
panel1.add(label8, null);
panel1.add(textField6, null);
panel1.add(label4, null);
panel1.add(textField4, null);
panel1.add(label6, null);
panel1.add(textField5, null);
panel1.add(button1, null);
panel1.add(button2, null);
this.addWindowListener(new InEntry_windowEvent(this));
|
public void | textValueChanged(java.awt.event.TextEvent e)
String testSex = textField3.getText().toUpperCase();
if(testSex.equals("F") && textField2.getText().length() != 0)
textField6.setEditable(true);
else textField6.setEditable(false);
validate();
|
void | this_windowClosing(java.awt.event.WindowEvent ee)
dispose();
|
void | updateIndividual()
if(textField1.getText().length() > 0) person.setGivenNames(textField1.getText());
dispose();
|