All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.cambio.openehr.view.renderers.DataValueCellVORenderer Maven / Gradle / Ivy

There is a newer version: 1.3.26
Show newest version
package se.cambio.openehr.view.renderers;

import org.openehr.rm.datatypes.basic.DataValue;
import se.cambio.openehr.view.util.DataValueCellVO;
import se.cambio.openehr.view.util.FormatConverter;

import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;

/**
 * User: Iago.Corbal
 * Date: 2013-11-17
 * Time: 12:50
 */
public class DataValueCellVORenderer extends DefaultTableCellRenderer {

    @Override
    public void setValue(Object value) {
        DataValueCellVO dvCellVO = null;
        DataValue dv = null;
        if (value instanceof DataValueCellVO) {
            dvCellVO = (DataValueCellVO) value;
            dv = dvCellVO.getDv();
        }
        if (dv != null) {
            String dvStr = FormatConverter.getReadableValue(dv);
            setText(dvStr);
            setToolTipText(dvStr);
            //setIcon(null);
        } else {
            setText(null);
            setToolTipText(null);
            setIcon(null);
        }
        if (dvCellVO != null && dvCellVO.isMandatory() && dv == null) {
            setBorder(BorderFactory.createLineBorder(Color.RED));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy