use of org.protege.editor.owl.client.diff.model.ChangeMode in project protege-client by protegeproject.
the class ChangeDetailsTableCellRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
ChangeMode mode = LogDiff.getChangeMode((OWLOntologyChange) value);
if (value instanceof OWLAxiomChange) {
OWLAxiom ax = ((OWLAxiomChange) value).getAxiom();
JComponent c = (JComponent) owlCellRenderer.getTableCellRendererComponent(table, ax, isSelected, hasFocus, row, column);
setBackground(table, mode, c, isSelected);
c.setToolTipText(modelManager.getRendering(ax));
return c;
} else if (value instanceof AnnotationChange) {
OWLAxiom ax = getAnnotationAssertionAxiom((AnnotationChange) value);
JComponent c = (JComponent) owlCellRenderer.getTableCellRendererComponent(table, ax, isSelected, hasFocus, row, column);
setBackground(table, mode, c, isSelected);
c.setToolTipText(modelManager.getRendering(ax));
return c;
} else if (value instanceof ImportChange) {
OWLImportsDeclaration decl = ((ImportChange) value).getImportDeclaration();
JComponent c = (JComponent) owlCellRenderer.getTableCellRendererComponent(table, decl.getIRI(), isSelected, hasFocus, row, column);
setBackground(table, mode, c, isSelected);
c.setToolTipText(modelManager.getRendering(decl.getIRI()));
return c;
} else if (value instanceof SetOntologyID) {
IRI newIri = ((SetOntologyID) value).getNewOntologyID().getOntologyIRI().get();
setText("New IRI: " + newIri);
setToolTipText(modelManager.getRendering(newIri));
}
setBackground(table, mode, this, isSelected);
setFont(table.getFont());
return this;
}
use of org.protege.editor.owl.client.diff.model.ChangeMode in project protege-client by protegeproject.
the class ChangesTableCellRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
// coordinates passed to the renderer are in view coordinate system after sorting, so they need converting to model coordinates before accessing the model
int modelRow = table.convertRowIndexToModel(row);
ChangeMode mode = (ChangeMode) table.getModel().getValueAt(modelRow, ChangesTableModel.Column.MODE.ordinal());
ChangeType type = (ChangeType) table.getModel().getValueAt(modelRow, ChangesTableModel.Column.CHANGE_TYPE.ordinal());
if (value instanceof OWLObject) {
Component c = owlCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
setBackground(table, type, mode, c, isSelected);
return c;
}
if (value instanceof Boolean) {
if ((Boolean) value) {
return getIconLabel(table, type, mode, GuiUtils.WARNING_ICON_FILENAME, isSelected, true);
} else {
value = null;
}
}
if (value != null && value instanceof Review) {
Review review = (Review) value;
switch(review.getStatus()) {
case ACCEPTED:
return getIconLabel(table, type, mode, GuiUtils.REVIEW_ACCEPTED_ICON_FILENAME, isSelected, review.isCommitted());
case REJECTED:
return getIconLabel(table, type, mode, GuiUtils.REVIEW_REJECTED_ICON_FILENAME, isSelected, review.isCommitted());
case PENDING:
default:
value = "";
}
}
if (value instanceof Date) {
setText(GuiUtils.getFormattedDate((Date) value));
} else {
setText(value != null ? value.toString() : "");
}
setBackground(table, type, mode, this, isSelected);
setFont(table.getFont());
return this;
}
Aggregations