@Override public void activeOntologyChanged() { OBDAModel obdaModel = controller.getActiveOBDAModel(); TargetQueryVocabularyValidator validator = new TargetQueryValidator(obdaModel); mappingPanel.setOBDAModel(obdaModel); mappingPanel.setTargetQueryValidator(validator); datasourceSelector.setDatasourceController(obdaModel); }
@Override protected void initialiseOWLView() throws Exception { // Retrieve the editor kit. final OWLEditorKit editor = getOWLEditorKit(); controller = (OBDAModelManager) editor.get(OBDAModelImpl.class.getName()); controller.addListener(this); OBDAModel obdaModel = controller.getActiveOBDAModel(); TargetQueryVocabularyValidator validator = new TargetQueryValidator(obdaModel); // Init the Mapping Manager panel. mappingPanel = new MappingManagerPanel(obdaModel, validator); editor .getOWLWorkspace() .getOWLSelectionModel() .addListener( new OWLSelectionModelListener() { @Override public void selectionChanged() throws Exception { OWLEntity entity = editor.getOWLWorkspace().getOWLSelectionModel().getSelectedEntity(); if (entity == null) return; if (!entity.isTopEntity()) { String shortf = entity.getIRI().getFragment(); if (shortf == null) { String iri = entity.getIRI().toString(); shortf = iri.substring(iri.lastIndexOf("/")); } mappingPanel.setFilter("pred:" + shortf); } else { mappingPanel.setFilter(""); } } }); datasourceSelector = new DatasourceSelector(controller.getActiveOBDAModel()); datasourceSelector.addDatasourceListListener(mappingPanel); // Construt the layout of the panel. JPanel selectorPanel = new JPanel(); selectorPanel.setLayout(new GridBagLayout()); JLabel label = new JLabel("Select datasource: "); label.setFont(new Font("Dialog", Font.BOLD, 12)); label.setForeground(new Color(53, 113, 163)); // label.setBackground(new java.awt.Color(153, 153, 153)); // label.setFont(new java.awt.Font("Arial", 1, 11)); // label.setForeground(new java.awt.Color(153, 153, 153)); label.setPreferredSize(new Dimension(119, 14)); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new Insets(5, 5, 5, 5); selectorPanel.add(label, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(5, 5, 5, 5); selectorPanel.add(datasourceSelector, gridBagConstraints); selectorPanel.setBorder(new TitledBorder("Datasource selection")); mappingPanel.setBorder(new TitledBorder("Mapping manager")); setLayout(new BorderLayout()); add(mappingPanel, BorderLayout.CENTER); add(selectorPanel, BorderLayout.NORTH); }