Esempio n. 1
0
 void reset() {
   noActionButton.setSelected(true);
   accepted = false;
   rejected = false;
   notesText.setText("");
   papa.reset();
 }
Esempio n. 2
0
 private void doneButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_doneButtonActionPerformed
   Context currCtxt = Context.current;
   if (accepted) {
     try {
       String sourceContextName = propDef.ktd.domTh.languageName;
       Context sourceCtxt = Library.findOrCreateContext(sourceContextName);
       if (propDef.ktd.domTh.addressTerms) {
         sourceCtxt.updateDomTheoryAdr(); // loads it on sourceCtxt
       } else {
         sourceCtxt.updateDomTheoryRef();
       }
       KinTermDef newDef = new KinTermDef(propDef.kinTerm);
       newDef.comments = FamilyPanel.convertBannedCharacters(notesText.getText());
       newDef.definitions = propDef.ktd.definitions;
       newDef.expandClauses(sourceCtxt);
       makePCStrings(newDef, propDef.eqc.sigString);
       updateCBPtrs(newDef);
       newDef.makeSigStrings();
       dt.addTerm(newDef);
       Context.AcceptedDefPtr ptr;
       ptr = new Context.AcceptedDefPtr(propDef.kinTerm, UDate.today(), "false", newDef.comments);
       ptr.postToHistory(learningHistory);
       // Move all dyads for this kinTerm to "Defined" category.
       TreeMap<String, ArrayList<Object>> dyads;
       dyads = (TreeMap<String, ArrayList<Object>>) dt.dyadsUndefined.remove(newDef.kinTerm);
       dt.dyadsDefined.put(newDef.kinTerm, dyads);
       SIL_Edit.edWin.chart.dirty = true;
       //  Set up auto-def for this KTD
       TreeMap<String, ArrayList<Context.CB_Ptr>>
           autoDef = // autoDef: kinType => AList of Context.CB_Ptrs
           (dt.addressTerms ? currCtxt.autoDefAdr : currCtxt.autoDefRef);
       for (Object o : newDef.expandedDefs) {
         ClauseBody cb = (ClauseBody) o;
         String kinType = cb.pcString;
         if (autoDef.get(kinType) == null) {
           autoDef.put(kinType, new ArrayList<Context.CB_Ptr>());
         }
         ArrayList<Context.CB_Ptr> defList = autoDef.get(kinType);
         defList.add(new Context.CB_Ptr(newDef.kinTerm, cb.seqNmbr));
       }
       //                Context.current = currCtxt;  // It was reset by updates to SourceCtxt
       String msg =
           "Would you like to apply this new definition to all\n"
               + "Ego/Alter pairs that it fits?";
       int decision =
           JOptionPane.showConfirmDialog(
               this, msg, "Apply Definition?", JOptionPane.YES_NO_OPTION);
       if (decision == JOptionPane.YES_OPTION) {
         SIL_Edit.edWin.applyDef(newDef, dt);
       }
       //  Mark this suggestion as processed and update menu
       papa.markProcessed(suggNmbr);
       papa.reset();
     } catch (Exception exc) {
       String msg = "While fleshing out a KTD for " + propDef.kinTerm;
       msg += "\nhit internal error: " + exc;
       MainPane.displayError(msg, "Internal Error", JOptionPane.ERROR_MESSAGE);
     }
   } else if (rejected) {
     Context.RejectedPropDefPtr reject =
         new Context.RejectedPropDefPtr(
             propDef.kinTerm,
             UDate.today(),
             "false",
             FamilyPanel.convertBannedCharacters(notesText.getText()),
             propDef.eqc.sigString,
             propDef.eqc.prototype.languageName,
             propDef.eqc.prototype.kinTerm);
     reject.postToHistory(learningHistory);
     papa.markProcessed(suggNmbr);
     papa.reset();
   }
   reset();
 } // GEN-LAST:event_doneButtonActionPerformed