/** @return the owl class */ @SuppressWarnings("unchecked") public OWLEntity getOWLClass() { if (facetClassView.getSelectedIndex() > -1) { OWLEntity p = ((VariableListItem<OWLEntity>) facetClassView.getSelectedValue()).getItem(); return p; } return null; }
/** @param k k */ public OWLEntitySelector(OWLEditorKit k) { super(new BorderLayout()); kit = k; facetClasses.addAll(LocalityChecker.collectEntities(k.getOWLModelManager().getOntologies())); facetClassView.setCellRenderer(new RenderableObjectCellRenderer(kit)); facetClassView.setModel(facetClassesModel); setOK(false); facetClassesModel.init(); JScrollPane spobjf = ComponentFactory.createScrollPane(facetClassView); spobjf.setBorder(ComponentFactory.createTitledBorder("Entity selection")); this.add(spobjf); facetClassView.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { // then status is OK OWLEntitySelector.this.setOK(true); } } }); }
/** clear the view */ public void clear() { facetClassView.getSelectionModel().clearSelection(); }