for (final QueryResult qr : resultQueryEvaluator) {
if (!(qr instanceof BooleanResult) && (qr.size() > 0))
tablesOccur = true;
}
JSplitPane splitPane_result = null;
if (tablesOccur) {
final JCheckBox cb_prefixes = new JCheckBox("Use prefixes", true);
cb_prefixes.setSelected(usePrefixes.isTrue());
cb_prefixes.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
// set boolean flag...
if (e.getStateChange() == ItemEvent.SELECTED) {
usePrefixes.setValue(true);
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
usePrefixes.setValue(false);
}
if (prefixInstance != null)
prefixInstance.setStatus(usePrefixes.isTrue());
resultpanel.removeAll();
try {
ResultPanelHelper.setupResultPanel(resultpanel, resultQueryEvaluator, debugViewerCreator, materializationInfo, inferenceRules, ruleApplicationsForMaterialization, errorsInOntology, usePrefixes, prefixInstance, contentPane );
} catch(Exception exception){
System.err.println("Should only occurr if it already occurred before:\n"+exception);
exception.printStackTrace();
}
contentPane.validate();
}
});
final JPanel prefixesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 0));
prefixesPanel.add(cb_prefixes);
if(buttonSuperPanel!=null){
buttonSuperPanel.add(prefixesPanel, BorderLayout.SOUTH);
} else {
buttonpanel.add(prefixesPanel);
}
if (usePrefixes.isTrue()) {
final JPanel pPanel = new JPanel(new BorderLayout());
final JLabel info = new JLabel();
info.setText("Prefixes:");
final JPanel infoPanel = new JPanel(new FlowLayout(
FlowLayout.LEFT));
infoPanel.add(info);
pPanel.add(infoPanel, BorderLayout.NORTH);
final LuposDocument document = new LuposDocument();
final LuposJTextPane ta_prefixes = new LuposJTextPane(document);
document.init(TurtleParser.createILuposParser(new LuposDocumentReader(document)), false);
// just to get all prefixes before displaying them...
for(QueryResult qr: resultQueryEvaluator){
qr.toString(prefixInstance);
}
if(errorsInOntology!=null){
errorsInOntology.toString(prefixInstance);
}
ta_prefixes.setText(prefixInstance.getPrefixString("", "").toString());
ta_prefixes.setEditable(false);
final JScrollPane scroll = new JScrollPane(ta_prefixes);
pPanel.add(scroll, BorderLayout.CENTER);
splitPane_result = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane_result.setOneTouchExpandable(true);
splitPane_result.setContinuousLayout(true);
splitPane_result.setTopComponent(pPanel);
splitPane_result.setResizeWeight(0.15);
resultpanel.add(splitPane_result, BorderLayout.CENTER);
}
}
// --- output result table - end ---
// final JScrollPane sp_result = new JScrollPane(resultTable);
final QueryResult[] toDisplay;
if(errorsInOntology!=null){
toDisplay = new QueryResult[1+resultQueryEvaluator.length];
toDisplay[0] = errorsInOntology;
System.arraycopy(resultQueryEvaluator, 0, toDisplay, 1, resultQueryEvaluator.length);
} else {
toDisplay = resultQueryEvaluator;
}
final JScrollPane scrollpane = new JScrollPane(ShowResult.getResultPanel(errorsInOntology!=null, toDisplay, prefixInstance, resultOrder, null));
if (usePrefixes.isTrue() && tablesOccur) {
splitPane_result.setBottomComponent(scrollpane);
} else {
resultpanel.add(scrollpane, BorderLayout.CENTER);
}
ResultPanelHelper.updateButtonPanelSize(layout, resultpanel, contentPane.getSize(), buttonpanel, buttonPanelInference);