use of org.protege.editor.owl.client.diff.model.ChangeType 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