Esempio n. 1
0
 private void btn_createActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btn_createActionPerformed
   System.out.println(ontClass);
   Individual temp =
       Ontology.getOntModel()
           .createIndividual(Ontology.getNameSpace() + txt_search.getText(), ontClass);
   all_individuals.add(temp);
   individuals.add(temp);
   model.fireTableDataChanged();
 } // GEN-LAST:event_btn_createActionPerformed
Esempio n. 2
0
  public Search(
      final java.awt.Frame parent,
      boolean modal,
      final OntClass ontClass,
      final OntProperty ontTarget,
      final JTextField txtField) {
    super(parent, modal);
    initComponents();
    this.parent = (SaveImage) parent;
    this.ontClass = ontClass;
    individuals = new ArrayList<>();
    all_individuals = new ArrayList<>();
    for (NodeIterator i =
            ontClass.listPropertyValues(
                Ontology.getOntModel().getProperty(Ontology.getNameSpace() + "lbl_netbeans"));
        i.hasNext(); ) {
      title_class.setText(i.next().toString());
    }
    this.txtField = txtField;
    model = new InstancesTable();
    tbl_individuals.setModel(model);
    for (ExtendedIterator<? extends OntResource> i = ontClass.listInstances(); i.hasNext(); ) {
      Individual inst = (Individual) i.next();
      if (inst.getNameSpace() != null) {
        individuals.add(inst);
        all_individuals.add(inst);
      }
    }

    tbl_individuals.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
              JTable target = (JTable) e.getSource();
              int row = target.getSelectedRow();
              temp = ((SaveImage) parent).getContentFields().get(ontTarget.toString());
              temp.setIndividual(individuals.get(row));
              temp.getField().setText(individuals.get(row).getLocalName());
            }
          }
        });
  }