Search in sources :

Example 1 with Review

use of org.protege.editor.owl.client.diff.model.Review 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;
}
Also used : OWLObject(org.semanticweb.owlapi.model.OWLObject) ChangeType(org.protege.editor.owl.client.diff.model.ChangeType) Review(org.protege.editor.owl.client.diff.model.Review) Date(java.util.Date) ChangeMode(org.protege.editor.owl.client.diff.model.ChangeMode)

Aggregations

Date (java.util.Date)1 ChangeMode (org.protege.editor.owl.client.diff.model.ChangeMode)1 ChangeType (org.protege.editor.owl.client.diff.model.ChangeType)1 Review (org.protege.editor.owl.client.diff.model.Review)1 OWLObject (org.semanticweb.owlapi.model.OWLObject)1