Hi,
I have an interface with 4 labels, 4 textfields and some buttons like "Add", "modify, "next", etc. The user will enter name, first name, birth date, etc. After clicking the button "add", the information that he has entered will be added on rdf file. The "next" (in french "Suivant") button didn't work. When i click on "next" button, nothing appears on textfields. There is nothing in the textfields.
Can you help me please?
Thanks.
Code:
//ActionAdd
public class ActionAjoutPersonne extends Onto implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
Onto f;
f = new Onto();
for(int i=0;i<4;i++)
{
tabTF[i].getText();
Resource p1 = model.createResource(uriBase+tabTF[0].getText());
p1.addProperty(RDF.type, f.personne);
if (i==0)
{
p1.addProperty(f.aPourPrenom, tabTF[i].getText());
}
if (i==1)
{
p1.addProperty(f.aPourNom, tabTF[i].getText());
}
if (i==2)
{
p1.addProperty(f.aDateNaiss, tabTF[i].getText());
}
if (i==3)
{
if (tabTF[i].getText().equals("F"))
{
p1.addProperty(f.aGenre, tabTF[i].getText());
p1.addProperty(RDF.type, f.femme);
}
else
if (tabTF[i].getText().equals("H"))
{
p1.addProperty(f.aGenre, tabTF[i].getText());
p1.addProperty(RDF.type, f.homme);
}
}
StringWriter sw = new StringWriter();
model.write(sw, "RDF/XML-ABBREV");
String owlCode = sw.toString();
File file = new File("d:/teste20.rdf");
try{
FileWriter fw = new FileWriter(file);
fw.write(owlCode);
fw.close();
} catch(FileNotFoundException fnfe){
fnfe.printStackTrace();}
catch(IOException ioe){
ioe.printStackTrace();
}
}
}
}
//ActionNext
class ActionSuivant extends Onto implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
Onto s = new Onto();
int indice=1;
String []M= new String [10];
//Read RDF File
InputStream in = FileManager.get().open("d:\teste20.rdf");
if (in == null)
{
throw new IllegalArgumentException("File: " + "d:\teste20.rdf" + " not found");
}
s.model.read(in, null);
//Search instances of Personne Class
ExtendedIterator instances=s.personne.listInstances();
indice++;
for(int p=0;p<10;p++) //10 instances
{
while (instances.hasNext())
{
Individual thisInstance = (Individual) instances.next();
M[p]= thisInstance.getLocalName();
if(p==indice)
{ tabTF[0].setText((thisInstance.getPropertyResourceValue(s.aPourPrenom)).toString());
tabTF[1].setText((thisInstance.getPropertyResourceValue(s.aPourNom)).toString());
tabTF[2].setText((thisInstance.getPropertyResourceValue(s.aDateNaiss)).toString());
}
}
}
}
}
}