project report on family tree generator in java

62
A PROJECT REPORT ON Family Tree Generator In partial fulfillment of B. Tech IV Year (Computer Science Engineering) Session 2012-13 Submitted To: Submitted by: Prof. Virendra Soni Priyanka Rajpurohit 1

Upload: priyanka05aiesec

Post on 08-Nov-2014

185 views

Category:

Documents


21 download

DESCRIPTION

The project Family Tree Generator gives the user the ability to track back to his ancestral roots, know and preserve the information in the most structured and well organized manner.The project report consist of -IntroductionLiterature SurveyRequirement SpecificationArchitectural DesignTest PlanningWork DistributionResultsConclusion & Future WorkGlossaryReferences

TRANSCRIPT

Page 1: Project Report on Family Tree Generator in JAVA

A

PROJECT REPORT

ON

Family Tree Generator

In partial fulfillment of

B. Tech IV Year (Computer Science Engineering)

Session 2012-13

Submitted To: Submitted by:

Prof. Virendra Soni Priyanka Rajpurohit

Professor IV Year / VII Sem

Department of Computer Science Engineering

JIET School of Engineering & Technology for Girls

Jodhpur

1

Page 2: Project Report on Family Tree Generator in JAVA

Certificate

This is to certify that the Major Project entitled Family Tree Generator has been carried

out by the student of college JIET School of Engineering & Technology for Girls,

Jodhpur under my guidance and supervision in partial fulfillment of the degree of Bachelor

of Technology in Computer Science Engineering of Rajasthan Technical University, Kota

during the academic year 2012-13.

Team:

Priyanka Rajpurohit

Date: 25/10/2012

Place: JIET-SETG, Jodhpur

Signature of Guide Signature of HOD------------------------- ------------------------Name of Guide Prof. Mamta Garg

Assistant Professor Head of Department,Department of CSE Department of CSE,

JIET-SETG JIET-SETG

2

Page 3: Project Report on Family Tree Generator in JAVA

Acknowledgment

This project involved the collection and analysis of information from a wide variety of sources and the efforts of many people beyond me. Thus it would not have been possible to achieve the results reported in this document without their help, support and encouragement.

I am highly indebted to Prof. Virendra Soni professor of computer science department, for their timely guidance and constant supervision as well as for providing necessary information regarding the minor project & also for their support in completing the minor project.

Priyanka RajpurohitOctober 25, 2012

3

Page 4: Project Report on Family Tree Generator in JAVA

Abstract

A strong family relationship can make changes in any one’s life!!! Any family has its share of challenges in life – the children grow up, move out, change jobs, and move to different communities. Other routine events are various births, deaths, marriages, and illnesses etc. that restructure the family. It is a fact that families are a major force in the development of society. But with today’s busy lifestyles, somehow the family members tend to drift apart and these bonds become less strong. Each person that is born is granted the gift of life by their parents. This gift of life is a link to their ancestors who lived before them. From the beginning of time people have sensed a need to belong. It is noteworthy that even the Bible contains lists of genealogy. People felt it was significant to be able to trace their lineage to Adam, Noah, Abraham, David and so on.

Genealogy is a unique and personalized form of history. It is passed from one generation to the next via written and oral history. Without this connection to our ancestors we would have little knowledge of our culture or how we fit in. You will also come to understand more about your purpose in life.

The project Family Tree Generator gives the user the ability to track back to his ancestral roots, know and preserve the information in the most structured and well organized manner.

Information concerning your family history is useful to medical professionals. It helps them determine whether you or other family members have increased risk for various hereditary diseases or genetic illnesses. Doctors monitor medical issues such as heart problems, dia-betes, strokes and cancer with this data.

As you research your ancestral roots you will increase your skills in a number of areas. Your organizational skills will be sharpened as you take notes in a loose leaf binder and cat-egorize information. Compiling your family tree is a priceless legacy for future generations.

4

Page 5: Project Report on Family Tree Generator in JAVA

Table of Contents

Certificate........................................................................................ 2

Acknowledgment............................................................................ 3

Abstract........................................................................................... 4

Table of Contents........................................................................... 5

1. Introduction............................................................................ 6

2. Literature Survey.................................................................... 8

3. Requirement Specification....................................................10

4. Architectural Design..............................................................13

5. Test Planning..........................................................................33

6. Work Distribution...................................................................37

7. Results....................................................................................38

8. Conclusion & Future Work.....................................................44

Glossary............................................................................................ 45

References......................................................................................... 46

5

Page 6: Project Report on Family Tree Generator in JAVA

1. Introduction

A family tree generator or a family tree builder (FTB) is genealogy software that creates family trees. A family tree generator keeps a track of the ancestral hierarchy of the user’s family. The software would generate a family tree that assists family historians in tracking, organizing, and sharing the family history.The software is based on Java programming language, the interfaces are built to be user friendly and simple in nature yet provide with valuable information regarding the user’s family history.It is possible to view three generations at a time. User can save his/her family tree that can be viewed, edited or updated later. So, the user can take his time to build the family tree with all the details leisurely.It is also possible to add not just the basic details like First Name, Last Name, Married Sur-name, and Gender but also detailed description of that family member- his qualification, in-terests, current profile, achievements, traits, etc can also be written in the paragraph section. This section provides the user to add as much as details of the person possible.It is exceptionally rewarding to be able to trace your ancestral roots. Through discovering your roots you become aware of who you are as a person.The Java Development Kit (JDK) is an Oracle Corporation product aimed at Java develop-ers. Since the introduction of Java, it has been by far the most widely used Java Software Development Kit (SDK).

The JDK has as its primary components a collection of programming tools, including:

appletviewer – this tool can be used to run and debug Java applets without a web browser

apt – the annotation-processing tool[2]

extcheck – a utility which can detect JAR-file conflicts idlj – the IDL-to-Java compiler. This utility generates Java bindings from a

given Java IDL file. java – the loader for Java applications. This tool is an interpreter and can interpret

the class files generated by the javaccompiler. Now a single launcher is used for both development and deployment. The old deployment launcher, jre, no longer-comes with Sun JDK, and instead it has been replaced by this new java loader.

javac – the Java compiler, which converts source code into Java bytecode javadoc – the documentation generator, which automatically generates documenta-

tion from source code comments jar – the archiver, which packages related class libraries into a single JAR file. This

tool also helps manage JAR files. javah – the C header and stub generator, used to write native methods javap – the class file disassembler javaws – the Java Web Start launcher for JNLP applications JConsole – Java Monitoring and Management Console jdb – the debugger jhat – Java Heap Analysis Tool (experimental) jinfo – This utility gets configuration information from a running Java process or

crash dump. (experimental)

6

Page 7: Project Report on Family Tree Generator in JAVA

jmap – This utility outputs the memory map for Java and can print shared object memory maps or heap memory details of a given process or core dump. (experimen-tal)

jps – Java Virtual Machine Process Status Tool lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system. (experimental)

jrunscript – Java command-line script shell. jstack – utility which prints Java stack traces of Java threads (experimental) jstat – Java Virtual Machine statistics monitoring tool (experimental) jstatd – jstat daemon (experimental) keytool – tool for manipulating the keystore pack200 – JAR compression tool policytool – the policy creation and management tool, which can determine policy

for a Java runtime, specifying which permissions are available for code from various sources

VisualVM – visual tool integrating several command-line JDK tools and light-weight[clarification needed] performance and memory profiling capabilities

wsimport – generates portable JAX-WS artifacts for invoking a web service. xjc – Part of the Java API for XML Binding (JAXB) API. It accepts an XML

schema and generates Java classes.

7

Page 8: Project Report on Family Tree Generator in JAVA

2. Literature Survey

A family tree, or pedigree chart, doesn't represent family relationships in a conventional tree structure. The more detailed family trees used in medicine and social work are known as genograms. Genealogy software is computer software used to record, organize, and publish genealogical data.

Features

At a minimum, genealogy software collects the date and place of an individual's birth, marriage, and death, and stores the relationships of individuals to their parents, spouses, and children. Some programs are more flexible than others in allowing for the input of children born out of wedlock or for varying types of spousal relationships. Additionally, most genealogy programs handle additional events in an individual's life, notes, photographs and multimedia, and source citations. Genealogy software programs can produce a variety of graphical charts and text reports, such as pedigree charts, ahnentafel reports, and Register reports. Some desktop applications generate HTML pages for web publishing; there are stand-alone web applications, as well. Most genealogy programs can import and export using the GEDCOM standard.

Some programs include additional fields relevant to particular religions. Others focus on certain geographical regions. For example, having a field for the family's coat of arms is only relevant if the family comes from a part of the world that uses them.

While most programs and applications are desktop-based, there are a number of web-based products in the genealogy software market.

Many genealogy applications focus on data management in that they allow users to manage all the information they collect on individuals, families, and events. Other tools available to the genealogist include research management tools, mapping tools, charting programs, and web-publishing programs.

Sharing

Most genealogy software allows export of data in GEDCOM format, which can then be shared with people using different genealogy software. Some genealogy applications use GEDCOM internally and therefore work directly with GEDCOM data. Certain programs allow the user to restrict what information is shared, usually by removing information about living people for privacy reasons.

Abstract Window Toolkit (AWT)A generic Abstract Window Toolkit (AWT) container object is a component that can con-tain other AWT components.Components added to a container are tracked in a list. The order of the list will define the components' front-to-back stacking order within the container. If no index is specified when adding a component to a container, it will be added to the end of the list (and hence to the bottom of the stacking order).

8

Page 9: Project Report on Family Tree Generator in JAVA

Class Container

java.lang.Object java.awt.Component java.awt.ContainerAll Implemented Interfaces:ImageObserver, MenuContainer, SerializableDirect Known Subclasses:BasicSplitPaneDivider, CellRendererPane, DefaultTreeCellEditor.EditorContainer, JComponent, Panel, ScrollPane, Window

Swing: User Interfaces in Java

Java has a fairly rich framework for creating user interfaces "out of the box". That framework is called Swing. Before learning Swing, it's worth making sure that you really understand the following:

the basic concepts of object-oriented programming (e.g. the notion of classes, object creation, inheritance);

basic Java syntax: how to call methods, how to create loops etc; interfaces, in the programming sense.

Essentially, because the Swing framework is highly object-oriented. It contains various classes that extend one another, and the notion of extending a base class to add required functionality to that class is key to user interface programming in Java (and indeed in other languages). Another key part of Swing programming is the notion of listeners: classes or components that "listen out for" a particular event happening such as a button being clicked. And listeners are generally implemented as Java interfaces (in the programming sense), so they're also an important notion to understand.

In any GUI-based program, a lot of the functionality comes from responding to events: mouse clicks, button clicks, key presses etc. So the first challenge with GUI programming is often turning the program flow that we have in our head into an event-based flow. The basic idea of an event-based approach is that:

most of the time, our program does nothing; the "system" will call routines that we have written when "interesting things" happen

(mouse clicks etc). add a button to our window; wait for the user to click the button; when the user clicks a button, pop up a message.

9

Page 10: Project Report on Family Tree Generator in JAVA

3. Requirement Specification

GENERAL DESCRIPTION

1. Product perspective: - the software “family tree “enables the user to build his/her family tree.

2. Product features :-the product is so designed so that it can fulfill the following requirementsa) Add details like name, birth surname, married surname and gender.b) Adding personal and random details like qualification, interests, current profile,

achievements, traits, etc c) Adding father, mother, spouse and children optionsd) Saving the generated family tree.

3. General constraints:- Software –Java JDK Language used Java

Disk Space Requirements for JDK

JDK Req.

Development Tools, including Java FX SDK 245 MB

Source Code 27 MB

Public Java Runtime Environment 124 MB

And 32 bit platform- Pentium 2 266 MHz processor. 4. Specific function:-

a) Functional requirement :-

i. Functional requirement number 1:-1) Introduction :-the add feature of family tree is to add a new family member in the family

tree with his details- First name, birth surname, married surname, gender , etc.2) Input, processing, outputs :-when the user uses the add functionality of the software

family tree generator he/she will be able to enter the family member in the family tree. The details in the family tree include first name, birth surname, married surname, gender. By using the text boxes in the software the user will be able to save the inserted the details.

ii. Functional requirement number 2:-1) Introduction :- to be able to add personal details of a family member other than first

name, birth surname, married surname, gender.

10

Page 11: Project Report on Family Tree Generator in JAVA

2) Input, processing, outputs : - when the user uses the add functionality of the software family tree he/she will be able to add personal and random details like qualification, interests, current profile, achievements, traits, etc. by using the paragraph field.

iii. Functional requirement number 3:-1) Introduction:- to be able to add father, mother, spouse and children to a family member2) Input, processing, outputs: - by using the add father, add mother, add spouse, add child

functionalities of the software the user will be able to add father, mother, spouse and children to a family member.

iv. Functional requirement number 4:-

1) Introduction: -to be able to save the family tree so generated by the user, or open an existing family tree to edit or update it.

2) Input, processing, outputs:- by using save option in the menu and the open option the user will be able to save, edit or update the family tree so created.

b) Performance requirement The performance of our product is at its best when it is working offline, as the response time will be much faster. If the product is accessed via internet, the performance is limited by the connection speed. The only unforeseen limitation is that of web server response.

c) Design constraints The software address book undergoes through various framework activities:CommunicationPlanningModelingConstructionDeployment

d) Testing The software will be tested module by module. Each module is integrated and system testing is performed. The software product will be tested for all functionalities.

e) External interface requirement User interface:-the input from the user will be through keyboard or mouse click. The user will navigate from the software by clicking on icons. The icon will give appropriate response to the input.Hardware:-RAM (2GB)Software: - Java JDK

11

Page 12: Project Report on Family Tree Generator in JAVA

Use case diagram: -

12

Edit current person

Add Father

Add Mother

Add Child

Add Spouse

Make new family tree

Open existing family tree

Page 13: Project Report on Family Tree Generator in JAVA

4. Architectural Design

Functional Description

A family tree generator generates a family tree using Graphic User Interface (GUI).

To edit any detail the edit mode needs to be selected, and then edit current person option

should be clicked. Its takes details of the family members-

first name,

birth surname,

married surname,

gender, etc.

Any other miscellaneous detail related to the person can be added in the ‘paragraph’

section.

To add a new member related to the ‘current person’, following options are available-

Add Father

Add Mother

Add Spouse

Add Child

A hierarchical family is shown using 3 panels- that means 3 generations can be seen at a

time.

13

Page 14: Project Report on Family Tree Generator in JAVA

Functional Block Diagram

14

MDI

SELECT MODE

EDIT VIEW

Create new tree

Create new family tree

Open an existing family tree

Open an existing family tree

Edit current person

Add MotherAdd Father Add Spouse Add Child

Enter details viz. First name, gender, birth surname, paragraph,

etc.

UPDATE

SAVE

EXITEXIT BLOCK

SELECTION BLOCK

Page 15: Project Report on Family Tree Generator in JAVA

Functional Partitions

Module Name:

1. SELECTION BLOCK

Functional Block Diagram

Module Dependencies: Input Dependencies: Actionlistener; view is the default mode.

Output Dependencies: Swing class to disable or enable the buttons/panel when view or edit mode is selected respectively.

2. EXIT BLOCK

Functional Block Diagram

Module Dependencies: Input Dependencies: Actionlistener, click event

Output Dependencies: NA

3. MDI

Functional Block Diagram

15

EXIT

Page 16: Project Report on Family Tree Generator in JAVA

Module Dependencies: Input Dependencies: java.lang.String- to add mother/father/spouse/child, details en-

tered by the user

Output Dependencies: class FamilyMember to get all the details entered by the user

Data structures and types used Array Int String Boolean

16

Page 17: Project Report on Family Tree Generator in JAVA

Data Description

Data Flow Diagram

17

Edit/view

Select mode

Create new family tree

Open existing tree

Edit Details

Save/update

Exit

Edit/view

Edit/view

Edit

Edi

Edit

Open file

Edit/view

Page 18: Project Report on Family Tree Generator in JAVA

Flow Chart

18

Start

Select mode

Create/ open

family tree

Create/ open

family tree

Enter file name

Enter file name

Edit details

View family tree

Update/Save

Stop

View family tree

Edit Vie

Open

Open

Create

Create

found

found

Not found

Not found

Page 19: Project Report on Family Tree Generator in JAVA

User Interface Design

User Interface

19

--File Mode Help

Edit Current Person

Add Father Add Mother Add Child

On editing the Current Person

Page 20: Project Report on Family Tree Generator in JAVA

Module Description

Module Name:

Selection Module & GUI

Family Member

Family Member List

Class Name:

1. FamilyMember- Provide definition of FamilyMember class.

2. FamilyMemberGUI- To demonstrate a family tree using a GUI

3. FamilyMemeberList- Provide definition of FamilyMember class to handle family member arrays.

Class Functions, declaration & returns value

1. Class FamilyMember-

getFirstName

public java.lang.String getFirstName()Gets the first nameReturns: a String specifying the first name

getBirthSurname

public java.lang.String getBirthSurname()Gets the surname at birthReturns: a String specifying the surname at birth

getMarriedSurname

public java.lang.String getMarriedSurname()Gets the married surnameReturns: a String specifying the married surname

getGender

public boolean getGender()Gets the genderReturns: a boolean specifying the gender

getParagraph

public java.lang.String getParagraph()

20

Page 21: Project Report on Family Tree Generator in JAVA

Gets the short paragraphReturns: a String specifying the short paragraph about family member

setFirstName

public void setFirstName(java.lang.String firstNm)Sets the first nameParameters: firstNm - the first name

setBirthSurname

public void setBirthSurname(java.lang.String birthNm)Sets the surname at birthParameters: birthNm - the surname at birth

setMarriedSurname

public void setMarriedSurname(java.lang.String marriedNm)Sets the married surnameParameters: marriedNm - the married surname

setGender

public void setGender(boolean fe)Sets the gender (true - if person is a female, false - if person is a male)

setParagraph

public void setParagraph(java.lang.String para)Sets the short paragraphParameters: para - the short paragraph about a family member

addSpouse

public void addSpouse(FamilyMember sp)Add a spouse to the family memberParameters: sp - a family member

addFather

public void addFather(FamilyMember fa)Add a father to the family memberParameters: fa - a family member

addMother

public void addMother(FamilyMember mo)Add a mother to the family memberParameters: mo - a family member

getSpouseFirstName

public java.lang.String getSpouseFirstName()Get the first name of the spouse if the spouse existsReturns: the first name of the spouse otherwise an empty string

getSpouseBirthName

public java.lang.String getSpouseBirthName()

21

Page 22: Project Report on Family Tree Generator in JAVA

Get the birth surname of the spouse if the spouse existsReturns: the spouse birth surname otherwise an empty string

getFatherFirstName

public java.lang.String getFatherFirstName()Get the first name of the father if the father existsReturns: the father first name otherwise an empty string

getMotherFirstName

public java.lang.String getMotherFirstName()Get the first name of the mother if the mother existsReturns: the mother first name otherwise an empty string

addChild

public void addChild(FamilyMember c)Add a child to the family memberParameters: c - a family member

getFullName

public java.lang.String getFullName()Get the full name of the family memberReturns: first name and birth surname if married surname's length <= 0 otherwise first name, married surname and birth surname

getMotherFullName

public java.lang.String getMotherFullName()Get the full name of mother if mother existsReturns: the full name of mother otherwise an empty string

getFatherFullName

public java.lang.String getFatherFullName()Get the full name of father if father existsReturns: the full name of father otherwise an empty string

getSpouseFullName

public java.lang.String getSpouseFullName()Get the full name of spouse if spouse existsReturns: the full name of spouse otherwise an empty string

getFatherParagraph

public java.lang.String getFatherParagraph()Get the paragraph of father if father existsReturns: the paragraph of father otherwise an empty string

getMotherParagraph

public java.lang.String getMotherParagraph()Get the paragraph of mother if mother existsReturns: the paragraph of mother otherwise an empty string

22

Page 23: Project Report on Family Tree Generator in JAVA

getSpouseParagraph

public java.lang.String getSpouseParagraph()Get the paragraph of spouse if spouse existsReturns: the paragraph of spouse otherwise an empty string

getChildParagraph

public java.lang.String getChildParagraph(int i)Get the paragraph of the ith childParameters:i - the index number of the children array listReturns: the paragraph of the ith child

getFatherMarriedName

public java.lang.String getFatherMarriedName()Get the married surname of the fatherReturns: the married surname of the father

getFatherBirthSurname

public java.lang.String getFatherBirthSurname()Get the birth surname of the fatherReturns: the birth surname of the father

getMotherBirthSurname

public java.lang.String getMotherBirthSurname()Get the birth surname of the motherReturns: the birth surname of the mother

getMotherMarriedSurname

public java.lang.String getMotherMarriedSurname()Get the married surname of the motherReturns: the married surname of the mother

getSpouseMarriedSurname

public java.lang.String getSpouseMarriedSurname()Get the married surname of the spouseReturns: the married surname of the spouse

set

public void set(FamilyMember a)Set a family member to the current family memberParameters: a - a family member

getFather

public FamilyMember getFather()Get the fatherReturns: the father

getMother

public FamilyMember getMother()Get the mother

23

Page 24: Project Report on Family Tree Generator in JAVA

Returns: the mother

getSpouse

public FamilyMember getSpouse()

Get the spouseReturns: the spouse

getChild

public FamilyMember getChild(int i)Get the ith childParameters: i - the index number of the children array listReturns: the ith child

getChildrenSize

public int getChildrenSize()Get the size of the childrenReturns: the number of children

getChildFullName

public java.lang.String getChildFullName(int i)Get the ith child's full nameParameters: i - the index number of the children array listReturns: the ith child's full name

getChildBirthSurname

public java.lang.String getChildBirthSurname(int i)Get the birth surname of the ith childParameters: i - the index number of the children array listReturns: the ith child's birth surname

getChildMarriedSurname

public java.lang.String getChildMarriedSurname(int i)Get the ith child's married surnameParameters: i - the index number of the children array listReturns: the ith child's married surname

hasSpouse

public boolean hasSpouse()Get a boolean value whether a spouse existsReturns: true if spouse exists otherwise false

hasMother

public boolean hasMother()Get a boolean value whether a mother existsReturns: true if mother exists otherwise false

hasFather

public boolean hasFather()

24

Page 25: Project Report on Family Tree Generator in JAVA

Gets a boolean value whether a father existsReturns: true if father exists otherwise false

setFatherFirstName

public void setFatherFirstName(java.lang.String firstNm)Set the first name of the fatherParameters: firstNm - the first name

setMotherFirstName

public void setMotherFirstName(java.lang.String firstNm)Set the first name of the motherParameters: firstNm - the first name

setSpouseFirstName

public void setSpouseFirstName(java.lang.String firstNm)Set the first name of the spouseParameters: firstNm - the first name

setFatherBirthName

public void setFatherBirthName(java.lang.String birthNm)Set the birth surname of the fatherParameters: birthNm - the birth surname

setMotherBirthName

public void setMotherBirthName(java.lang.String birthNm)Set the birth surname of the motherParameters: birthNm - the birth surname

setSpouseBirthName

public void setSpouseBirthName(java.lang.String birthNm)Set the birth surname of the spouseParameters: birthNm - the birth surname

setFatherMarriedName

public void setFatherMarriedName(java.lang.String marriedNm)Set the married surname of the fatherParameters: marriedNm - the married surname

setMotherMarriedName

public void setMotherMarriedName(java.lang.String marriedNm)Set the married surname of the motherParameters: marriedNm - the married surname

setSpouseMarriedName

public void setSpouseMarriedName(java.lang.String marriedNm)Set the married surname of the spouseParameters: marriedNm - the married surname

25

Page 26: Project Report on Family Tree Generator in JAVA

setFatherParagraph

public void setFatherParagraph(java.lang.String para)Set the paragraph of the fatherParameters: para - the paragraph

setMotherParagraph

public void setMotherParagraph(java.lang.String para)Set the paragraph of the motherParameters: para - the paragraph

setSpouseParagraph

public void setSpouseParagraph(java.lang.String para)Set the paragraph of the spouseParameters: para - the paragraph

2. Class FamilyMemberGUI-

repaintGUI

public void repaintGUI()Method to repaint the GUI by setting up the correct immediate relatives of the current family member in a tree

main

public static void main(java.lang.String[] args)Main method of FamilyMemberGUI

3. Class FamilyMemberList-

add

public void add(FamilyMember c)Adds a family member to arrayParameters: c - a family member

get

public FamilyMember get(int i)Get a family member based on the index numberParameters: i - the index number of the family member array listReturns: the ith family member of the children array list

size

public int size()Get the size of the family member listReturns: an integer size of the children array list

26

Page 27: Project Report on Family Tree Generator in JAVA

Pseudo code

Module Name-

Selection Module & GUI

1. if exit item is clicked, quit program System.exit(0);2. edit mode is selected and make top panel buttons enabled

else if( e.getSource() == modes[0]){ addFather.setEnabled(true);

addMother.setEnabled(true); addSpouse.setEnabled(true); addChild.setEnabled(true); editCurrent.setEnabled(true); }3. viewable mode is selected and make top panel buttons enabled and make bottom panel

invisible else if( e.getSource() == modes[1]){

addFather.setEnabled(false); addMother.setEnabled(false); addSpouse.setEnabled(false); addChild.setEnabled(false); editCurrent.setEnabled(false); bottomPanel.setVisible(false); }4. else if if open is clicked open file dialog and open file and repaint GUI

( e.getSource() == openItem){ openFile(); repaintGUI(); }5. else if save is clicked, open file dialog and save tree to a file

( e.getSource() == save){ saveFile(); }6. else if userguide is click open a dialog

( e.getSource() == userguide){ JOptionPane.showMessageDialog(FamilyMemberGUI.this, "Look for User

Guide”); }7. else if about is click open a dialog

( e.getSource() == about){ showMessageDialog(FamilyMemberGUI.this, "Family Tree 2001\nCopyright (c) 2012\nB306 Minor Project, Semester 7, 2012\nBy Priyanka Rajpurohit\nEmail: [email protected]");

}8. else if father button is clicked, make him as the current person. Repaint GUI

( e.getSource() == fatherButton){ paragraphArea.setText(current.getFatherParagraph()); current = current.getFather();

27

Page 28: Project Report on Family Tree Generator in JAVA

repaintGUI(); }9. else if mother button is clicked, make her as the current person. Repaint GUI10. else if spouse button is clicked, make him/her as the current person. Repaint GUI.

Repaint GUI()

Method to repaint the GUI by setting up the correct immediate relatives of the current family member in a tree

1. if father exists then set the father button with correct member

(current.getFather() != null){ fatherButton.setVisible(true);

fatherButton.setText(current.getFatherFullName()); } else{ if father does not exist then hide father button fatherButton.setVisible(false); }2. if(current.getMother() != null){ // if mother exists then set the mother button with correct member else{ motherButton.setVisible(false); // mother does not exist then hide mother button }

3. if spouse exists then set the spouse button with correct member (current.getSpouse() != null) else if spouse does not exist then hide spouse button 4. set the current button with the current family member5. current button is set to yellow background6. update paragraph for the current family member 7. remove child buttons as there are abitrary no. of children for a family member for(int i = 0; i < childButton.length; i++){ childPanel.remove(childButton[i]); }8. remove child panel to start afresh familyPanel.remove(childPanel); 9. create new child panel childPanel = new JPanel(); childPanel.setLayout(new FlowLayout());10. create [children size] no. of child buttons11. create [children size] no. of child buttons childButton = new JButton[current.getChildrenSize()]; 12. each child button gets a child name for(int i=0; i<current.getChildrenSize(); i++){ childButton[i] = new JButton(current.getChildFullName(i)); 13. each child button gets an action listener childButton[i].addActionListener(new ActionListener() {

28

Page 29: Project Report on Family Tree Generator in JAVA

for (int i=0; i<childButton.length; i++){ if (e.getSource() == childButton[i]){ // if a certain child button is pressed paragraphArea.setText(current.getChildParagraph(i)); // updates the paragraph for particular child current = current.getChild(i); // make child as the current person repaintGUI(); // repaint the GUI for immediate relatives } } }14. make first name textfield (at bottom panel) get the current person's first name15. make birth name get the current person's birth surname16. make married name get the current person's married surname17. make paragraph get the current person's paragraph.

Family Member1. Default constructor

public FamilyMember(){ father = mother = spouse = null; children = new FamilyMemberList(); firstName = birthSurname = marriedSurname = paragraph = ""; female = false; }

2. FamilyMember constructor{ setFirstName(firstNm); setBirthSurname(birthNm); marriedSurname = ""; setParagraph(para); female = fe; father = mother = spouse = null; children = new FamilyMemberList(); }

3. Get first name public String getFirstName(){ return firstName; }

4. Get the surname at birth5. Get the married surname6. Get the gender7. Get the short paragraph8. Set the first name

public void setFirstName(String firstNm){ firstName = firstNm; }

9. Set the surname at birth public void setBirthSurname(String birthNm){

birthSurname = birthNm;

29

Page 30: Project Report on Family Tree Generator in JAVA

}10. Set the married surname11. Set the gender12. Set the short paragraph13. Add a spouse to the family member

public void addSpouse(FamilyMember sp){ spouse = sp; }

14. Add a father to the family member15. Add a mother to the family member16. Get the first name of the spouse if the spouse exists

public String getSpouseFirstName(){ if(spouse != null) return spouse.getFirstName(); return ""; }

17. Get the birth surname of the spouse if the spouse exists public String getSpouseBirthName(){

if(spouse != null) return spouse.getBirthSurname(); return ""; }

18. Get the first name of the father if the father exists19. Get the first name of the mother if the mother exists20. Add a child to the family member

public void addChild(FamilyMember c){ children.add(c); }

21. Get the full name of the family member@return first name and birth surname if married surname's length <= 0otherwise first name, married surname and birth surname

public String getFullName(){ if(marriedSurname == "" || marriedSurname.length() <= 0) return firstName + ' ' + birthSurname; else return firstName + ' ' + marriedSurname + " (nee " + birthSurname + ")"; }

22. Get the full name of mother if mother exists @return the full name of mother otherwise an empty string23. Get the full name of father if father exists24. Get the full name of spouse if spouse exists(Similarly define for all family members)

Family Member List

1. Children array list private ArrayList childrenList = new ArrayList();

30

Page 31: Project Report on Family Tree Generator in JAVA

2. Add a family member to array, c is a family member public void add(FamilyMember c) { childrenList.add(c); }3. Get a family member based on the index number; I is the index number of the family member array listSo, return the ith family member of the children array list public FamilyMember get(int i) { return (FamilyMember)childrenList.get(i); }4. Get the size of the family member list & return an integer size of the children array list public int size() { return childrenList.size(); }

31

Page 32: Project Report on Family Tree Generator in JAVA

5. Test Planning

System test:-

System passing Criteria

Overview of System test for family tree generator: - Testing is the process of executing the program with intent of finding an error. A good test case is one that has a high probabil-ity of finding as-yet undiscovered errors. A successful test is one that uncovers a yet-to-be-discovered error. System testing tests a completely integrated system to verify that it meets its requirements.

First of all the user selects the mode- either view or edit. When view mode is selected the lower panel, edit current person, add father, add mother,

add spouse, add child buttons are disabled. When the user selects the edit mode the user can edit and update the family members. Later on, the appropriate details of a particular user are to be updated and displayed prop-

erly. All these requirements are to be satisfied in order to pass the system.

Functionality Test:-

Functions are tested by feeding the input and examining the output, and internal program structure is rarely considered.In Functional testing we need to check that each component is functioning as expected or not, so it is also called as “Component Testing”. Functional testing is to testing the func-tionality of the software application under test. Basically, it is to check the basic functional-ity mentioned in the functional specification document. Also check whether software appli-cation is meeting the user expectations. We can also say that checking the behavior of the software application against test specification.

Requirement ID / Test ID

Module/ Class Features

1 FamilyMemberGUI This class demonstrates a family tree using a GUI

2 FamilyMember This class provides definiton of FamilyMember

3 FamilyMemberList This class provides definition of FamilyMember class to handle family member arrays

Test setup:-

32

Page 33: Project Report on Family Tree Generator in JAVA

Hardware:-

The basic requirements for hardware are a normal PC setup that may be as described be-low:

User interface : Keyboard and Mouse. Processor : Pentium 2 266 MHz or higher. RAM : 240 MB or more. Hard disk : 2 GB or more.

Software:-

Operating System: Windows 2000, XP, Vista, 7. JAVA JDK

Test Configuration

Execution of test case is done with the various stepwise checking of modules and various functions.

First of all the users have to pass the select mode test through which user will be able to either view or edit a family tree.

User interface consists of panel where details need to be filled in like the first name, birth surname, married surname, gender, etc.

The user will fill the details of the current person which are to be displayed on the user friendly interface.

User should also be able to add random miscellaneous details of the current user in the paragraph section.

After the complete entries made by user and updated, the updates should be viewed then and there.

Other options like add father, add mother, add spouse and add child should also work properly displaying details in the correct panel.

Test case specifications:-

Test Case: 1

Objectives: - The test case will cover the check to see whether the whole GUI module is functioning properly or not.

Module /Class /Function

Module: GUIClass: FamilyMemberGUI

Test Configuration

Steps to be followed to run this test case are:1) User should be able to view the interface when the application is launched.2) 3 menu labels- file, mode and help should be visible3) User should be able to use the options present in these menus.

Expected Output or Results:-

The user should be able to launch the application and view the options- buttons, menus and frames.

33

Page 34: Project Report on Family Tree Generator in JAVA

Test Case: 2

Objectives: - The test case will cover the check to see whether the whole selection module is functioning properly or not.

Module /Class /Function

Module: Selection Class: FamilyMemberGUI

Test Configuration

Steps to be followed to run this test case are:1) Click on the mode menu and click on the view radio button to select the view mode.

The user should be able to open an existing family tree. User should be able to create a new family tree but should be unable to edit it. User should not be able to edit the family tree opened. User should be able to exit the application.

2) Click on the mode menu and click on the edit radio button to select the edit mode. User should be able to create a new family tree User should be able to open an existing family tree User should be able to edit, update the family tree User should be able to save the family tree. User should be able to exit the application.

Expected Output or Results:-

The user should be able to select and work appropriately with the modes- edit and view.

Test Case: 3

Objectives: - The test case will cover the check to see whether the MemberMember module is functioning properly or not.

Module /Class /Function

Module: Member MemberClass: MemberMember

Test Configuration

Steps to be followed to run this test case are:1) User should be able to get the details of an existing family tree or newly created family

tree - first name, surname, gender, short paragraph, etc of the entire family member.2) User should be able to set the details of an existing family tree or newly created family

tree- first name, surname, gender, short paragraph, etc of all the family members.3) User should be able to add father, mother, spouse and child of the family members.4) User should be able to get all the details (if exist) of the family tree- all the 3 generations

at a time.

34

Page 35: Project Report on Family Tree Generator in JAVA

Expected Output or Results:-

Details of all the family members should be set and fetched by the user.

Test Case: 4

Objectives: - The test case will cover the check to see whether the Family List module is functioning properly or not.

Module /Class /Function

Module: Family ListClass: FamilyList

Test Configuration

Steps to be followed to run this test case are:1) In order to check whether the family member array is functioning properly, a family

member is added to the array.2) User should be able to get all the details of that family member.3) Now, add child to the current person, and one more child.4) Both the children should be displayed below the current user’s panel.5) To test again, we may use different set of inputs and then observe the results obtained.

Expected Output or Results

The output obtained depends on the family member array created by the user. The family member is retrieved successfully.

Test Passing Criteria

All the inputs must be correct and should satisfy a normal family relational tree. There is no room for second marriages, although the details of second marriage can be added but the first marriage details then has to be removed. Although the divorcee or single parent is allowed in the family tree.

Test Passing Criteria

1. The user should enter valid real life relations.2. The user should not enter the details of two or more marriages in a single family tree as

the application does not support it.

35

Page 36: Project Report on Family Tree Generator in JAVA

6. Work Distribution

Name of function/ module

Start Date End DateResponsible Person

1.Designing of user interface 15-09-2012 22-09-2012

Priyanka Rajpurohit

2. RepaintGUI() 15-09-2012 22-09-2012Priyanka Rajpurohit

3. FamilyMember 23-09-2012 30-09-2012Priyanka Rajpurohit

4. FamilyMemberGUI 1-10-2012 7-10-2012Priyanka Rajpurohit

5. FamilyMemberList 8-10-2012 14-10-2012Priyanka Rajpurohit

6.Module Integration & testing 15-10-2012 20-10-2012

Priyanka Rajpurohit

36

Page 37: Project Report on Family Tree Generator in JAVA

7. Results

First user interface

Selecting Edit mode

37

Page 38: Project Report on Family Tree Generator in JAVA

Using Edit current person option

New family member added to the tree

38

Page 39: Project Report on Family Tree Generator in JAVA

Using Add Father option

Using Add Mother option

39

Page 40: Project Report on Family Tree Generator in JAVA

Updated family tree

Using Add Spouse option

40

Page 41: Project Report on Family Tree Generator in JAVA

Using Add Child option

Generated Family Tree

41

Page 42: Project Report on Family Tree Generator in JAVA

42

Page 43: Project Report on Family Tree Generator in JAVA

Test Status Report

S.No. Module Name Status (Pass/Fail)Error Status (Fixed/Open)

Remarks

1 Repaint Pass Fixed When repainted the child panel was still visible to remove it I used familyPanel.remove(childPanel) before new JPanel()

2. FamilyMemberGUI Pass Fixed Use actionlistiner interface when performing action on button. I resolve it by implementing ActionListiner Interface.

3. FamilyMemberList Pass Fixed No error

4. FamilyMember Pass Fixed I got error as I didn’t initialize father=mother=spouse=null in the constructor.

43

Page 44: Project Report on Family Tree Generator in JAVA

8. Conclusion & Future Work

The family tree generator is a user friendly application that is attracts the buyer as its difficult to maintain the family history and record in a hard book style, as their preservation is much of a doubt and even if typed and preserved as a softcopy, is not much readable and easy to use and deduce facts from it. Hence, such an application in which preservation as well as readability is assured becomes a necessity.The family tree generator so created isn’t restricted to one side of the family branch, as in it will show you your dad’s father tree with your grandfather, great grandfather and mother, etc but it will also show your maternal grandpa and grandma. This feature doesn’t depend on the gender of a person but it depends on who the ‘current person’ is. So, you can take place of your grandfather and see how it feels to have son like your father!

Genealogy is a very diverse field; it doesn’t just restrict to family ties but can be very helpful in determining the genetic disorders, diseases or any hereditary warnings. Information concerning your family history is thus useful to medical professionals. It helps them determine whether you or other family members have increased risk for various hereditary diseases or genetic illnesses. Doctors monitor medical issues such as heart problems, diabetes, strokes and cancer with this data. Hence, it’s not just a have fun kind of application but can prove to be of vital importance in future. We can work in this aspect- by applying an algorithm to determine which are the high risk diseases for a family and what precautions should be taken by them.

44

Page 45: Project Report on Family Tree Generator in JAVA

Glossary

Abbreviation Description

GUI Graphic User Interface

MDI Multiple Document Interface

Container class

A class that is used to contain other java objects. They contain methods for adding and removing objects, as well as ways to iterate through them

awt Abstract Windowing Toolkit

JDK Java Development Kit

45

Page 46: Project Report on Family Tree Generator in JAVA

References

1. Java Swing , 2nd Edition - O'Reilly Media2. Family Tree by Martin Smales3. docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html4. www.myheritage.com/5. familytreeproject.codeplex.com/6. Core Java, Vol. 2: Advanced Features, 8th Edition- Cay S. Horstmann, Garry

Cornell

46