Search in sources :

Example 1 with ChangeMode

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;
}
Also used : ChangeMode(org.protege.editor.owl.client.diff.model.ChangeMode)

Example 2 with ChangeMode

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;
}
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

ChangeMode (org.protege.editor.owl.client.diff.model.ChangeMode)2 Date (java.util.Date)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