Пример #1
0
 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
   SWRLImp imp = getImp(rowIndex);
   if (columnIndex == COL_EXPRESSION) {
     String text = (String) aValue;
     try {
       imp.setExpression(text);
       if (!isSuitable(imp)) {
         ProtegeUI.getModalDialogFactory()
             .showMessageDialog(
                 owlModel,
                 "The replacing rule no longer fits the selection\n"
                     + "criteria of this rules list, and will therefore no\n"
                     + "longer be visible here.  But no reason to panic: It\n"
                     + "should still show up on the SWRL tab.");
       }
     } catch (Exception ex) {
       Log.getLogger().warning("Exception caught defining rule " + ex);
     }
   } else if (columnIndex == COL_NAME) {
     String newName = (String) aValue;
     if (owlModel.isValidResourceName(newName, imp)) {
       RDFResource resource = owlModel.getRDFResource(newName);
       if (resource != null) {
         if (!imp.equals(resource)) {
           ProtegeUI.getModalDialogFactory()
               .showErrorMessageDialog(
                   owlModel, "The name " + newName + " is already used in this ontology.");
         }
       } else {
         imp = (SWRLImp) imp.rename(newName);
         setImp(rowIndex, imp);
       }
     } else
       ProtegeUI.getModalDialogFactory()
           .showErrorMessageDialog(owlModel, newName + " is not a valid rule name.");
   } else if (columnIndex == COL_ENABLED) {
     Boolean enabled = (Boolean) aValue;
     if (enabled.booleanValue()) imp.enable();
     else imp.disable();
   } // if
 } // setValueAt