Example #1
0
  public void load(Object value) {
    ensureIconFlagsLoaded();

    if (value instanceof Frame) {
      Frame frameValue = (Frame) value;
      if (!(frameValue.isEditable())) {
        setGrayedText(true);
      }
      if (frameValue.isDeleted()) {
        setMainIcon(null);
        setMainText("<deleted frame>");
      } else if (frameValue instanceof Cls) {
        loadCls((Cls) value);
      } else if (frameValue instanceof Slot) {
        loadSlot((Slot) value);
      } else if (frameValue instanceof Facet) {
        loadFacet((Facet) value);
      } else if (frameValue instanceof SimpleInstance) {
        loadInstance((Instance) value);
      }
    } else {
      setMainIcon(null);
      setMainText(value.toString());
    }
  }
 public void testUndoCreateSlot() {
   Slot slot = createSlot();
   String name = slot.getName();
   assertNotNull("name", name);
   Frame frame = getFrame(name);
   assertEquals("created", slot, frame);
   assertTrue("can undo", _frameStore.canUndo());
   _frameStore.undo();
   frame = getFrame(name);
   assertNull("undone", frame);
   _frameStore.redo();
   frame = getFrame(name);
   assertEquals("recreated", frame.getName(), name);
 }
 public void testUndocreateCls() {
   Cls cls = createCls();
   String name = cls.getName();
   assertNotNull("name", name);
   Frame frame = getFrame(name);
   assertEquals("created", cls, frame);
   assertTrue("can undo", _frameStore.canUndo());
   _frameStore.undo();
   frame = getFrame(name);
   assertNull("undone", frame);
   _frameStore.redo();
   frame = getFrame(name);
   assertEquals("recreated", frame.getName(), name);
 }
 @Override
 public Collection<FrameWithBrowserText> run() throws ProtegeException {
   List<FrameWithBrowserText> framesWithBrowserText = new ArrayList<FrameWithBrowserText>();
   addRequestsToFrameCalculator(frame);
   Collection values = getValues();
   for (Iterator iterator = values.iterator(); iterator.hasNext(); ) {
     Object value = iterator.next();
     if (value instanceof Frame) {
       Frame valueFrame = (Frame) value;
       framesWithBrowserText.add(
           new FrameWithBrowserText(
               valueFrame, valueFrame.getBrowserText(), ((Instance) valueFrame).getDirectTypes()));
       addRequestsToFrameCalculator(valueFrame);
     } else {
       framesWithBrowserText.add(new FrameWithBrowserText(null, value.toString(), null));
     }
   }
   Collections.sort(framesWithBrowserText, new FrameWithBrowserTextComparator());
   return framesWithBrowserText;
 }
 protected Collection getValues() {
   return directValues ? frame.getDirectOwnSlotValues(slot) : frame.getOwnSlotValues(slot);
 }