ReadOnlyForms
From Protege Wiki
Revision as of 17:38, July 8, 2008 by TaniaTudorache (talk | contribs) (New page: * Making slot-widgets read-only programmatically * Below is a snippet of code that shows how to make a slot widget from a class form read-only by using the API. The example uses the Newsp...)
- Making slot-widgets read-only programmatically *
Below is a snippet of code that shows how to make a slot widget from a class form read-only by using the API. The example uses the Newspaper ontology - it will show the form for "Destination Mars" instance of class "Article" and make the "page_number" slot widget read-only.
Cls article = kb.getCls("Article"); Slot pageNo = kb.getSlot("page_number"); Instance inst = kb.getInstance("instance_00044"); // "Destination Mars" //this is the actual code ClsWidget clsWidget = prj.getDesignTimeClsWidget(article); SlotWidget slotWidget = clsWidget.getSlotWidget(pageNo); ((AbstractSlotWidget)slotWidget).setReadOnlyWidget(true); prj.show(inst);
The code above changes the form of class Article, so all instances of Article that you will display will have the page_number slot widget read-only.