Пример #1
0
 public void actionPerformed(ActionEvent e) {
   if (_widget.isEditable()) {
     Collection selections =
         DisplayUtilities.pickInstances(
             (Component) _widget, _widget.getAllowedClses(), _dialogTitle);
     if ((null != selections) && (selections.size() != 0)) {
       _widget.addValues(selections);
     }
   }
 }
Пример #2
0
  private boolean containInstance(Instance sel, Slot slot, Instance instance) {
    if (itsInstance == null) return false;
    Collection instances = sel.getOwnSlotValues(slot);
    Iterator i = instances.iterator();
    while (i.hasNext()) {

      Instance tmpInstance = (Instance) i.next();
      if (tmpInstance.equals(instance)) return true;
    }
    return false;
  }
Пример #3
0
  public Collection search() {
    if (specification.getType() == null) return null;
    String slotType = specification.getType();
    if (!slotType.toLowerCase().equals("cls")) return null;

    // Here we first test the function based on the simplest Instance cases
    ArrayList resultInstances = new ArrayList();
    Collection instances = itsInstances;
    Iterator i = instances.iterator();
    Slot slot = itsWidget.getKB().getSlot(specification.getName());
    while (i.hasNext()) {
      Instance instance = (Instance) i.next();
      if (testInstance(getTestIndex(specification.getConstraint()), instance, slot))
        resultInstances.add(instance);
    }
    return resultInstances;
  }
Пример #4
0
 // This is used for Query test
 public Collection search(Collection instances, Slot slot, String operation, Object obj) {
   ArrayList resultInstances = new ArrayList();
   Iterator i = instances.iterator();
   String value = (String) (((Instance) obj).getBrowserText());
   while (i.hasNext()) {
     Instance instance = (Instance) i.next();
     if (testInstance(getTestIndex(operation), instance, slot, value))
       resultInstances.add(instance);
   }
   return resultInstances;
 }