Search in sources :

Example 1 with ITableAttributeCellEditorRenderer

use of de.janrufmonitor.ui.jface.application.rendering.ITableAttributeCellEditorRenderer in project janrufmonitor by tbrandt77.

the class TableCellModifier method modify.

public void modify(Object element, String column, Object value) {
    if (element instanceof Item)
        element = ((Item) element).getData();
    ITableCellRenderer r = RendererRegistry.getInstance().getRenderer(column);
    if (r instanceof ITableAttributeCellEditorRenderer && ((ITableAttributeCellEditorRenderer) r).getAttribute() != null) {
        if (element instanceof ICall) {
            ICall c = ((ICall) element);
            IAttribute cAtt = c.getAttribute(((ITableAttributeCellEditorRenderer) r).getAttribute().getName());
            if (cAtt != null && value instanceof String) {
                if (cAtt.getValue().equalsIgnoreCase((String) value)) {
                    return;
                }
            }
            IAttribute att = ((ITableAttributeCellEditorRenderer) r).getAttribute();
            ((ITableAttributeCellEditorRenderer) r).applyAttributeChanges(c, att, value);
            if (this.m_ac.getController() instanceof IExtendedApplicationController) {
                ((IExtendedApplicationController) this.m_ac.getController()).updateElement(c, false);
            } else {
                this.m_ac.getController().updateElement(c);
            }
        }
        if (element instanceof ICaller) {
            ICaller c = ((ICaller) element);
            IAttribute cAtt = c.getAttribute(((ITableAttributeCellEditorRenderer) r).getAttribute().getName());
            if (cAtt != null && value instanceof String) {
                if (cAtt.getValue().equalsIgnoreCase((String) value)) {
                    return;
                }
            }
            IAttribute att = ((ITableAttributeCellEditorRenderer) r).getAttribute();
            ((ITableAttributeCellEditorRenderer) r).applyAttributeChanges(c, att, value);
            if (this.m_ac.getController() instanceof IExtendedApplicationController) {
                ((IExtendedApplicationController) this.m_ac.getController()).updateElement(c, false);
            } else {
                this.m_ac.getController().updateElement(c);
            }
        }
    }
    this.m_v.refresh();
}
Also used : Item(org.eclipse.swt.widgets.Item) ITableCellRenderer(de.janrufmonitor.ui.jface.application.rendering.ITableCellRenderer) ICaller(de.janrufmonitor.framework.ICaller) ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute) ITableAttributeCellEditorRenderer(de.janrufmonitor.ui.jface.application.rendering.ITableAttributeCellEditorRenderer)

Aggregations

IAttribute (de.janrufmonitor.framework.IAttribute)1 ICall (de.janrufmonitor.framework.ICall)1 ICaller (de.janrufmonitor.framework.ICaller)1 ITableAttributeCellEditorRenderer (de.janrufmonitor.ui.jface.application.rendering.ITableAttributeCellEditorRenderer)1 ITableCellRenderer (de.janrufmonitor.ui.jface.application.rendering.ITableCellRenderer)1 Item (org.eclipse.swt.widgets.Item)1