Search in sources :

Example 1 with ISOMeter

use of org.jpos.iso.gui.ISOMeter in project jPOS by jpos.

the class ISOMeterFactory method create.

public JComponent create(UI ui, Element e) {
    ISOChannelPanel icp = null;
    try {
        Object obj = NameRegistrar.get(e.getAttributeValue("idref"));
        if (obj instanceof ISOChannel) {
            icp = new ISOChannelPanel((ISOChannel) obj, e.getText());
        } else if (obj instanceof Observable) {
            icp = new ISOChannelPanel(e.getText());
            ((Observable) obj).addObserver(icp);
        }
        ISOMeter meter = icp.getISOMeter();
        if ("false".equals(e.getAttributeValue("scroll")))
            meter.setScroll(false);
        String protect = e.getAttributeValue("protect");
        if (protect != null)
            icp.setProtectFields(ISOUtil.toIntArray(protect));
        String wipe = e.getAttributeValue("wipe");
        if (wipe != null)
            icp.setWipeFields(ISOUtil.toIntArray(wipe));
        String refresh = e.getAttributeValue("refresh");
        if (refresh != null)
            meter.setRefresh(Integer.parseInt(refresh));
    } catch (Exception ex) {
        ex.printStackTrace();
        return new JLabel(ex.getMessage());
    }
    return icp;
}
Also used : ISOMeter(org.jpos.iso.gui.ISOMeter) ISOChannelPanel(org.jpos.iso.gui.ISOChannelPanel) ISOChannel(org.jpos.iso.ISOChannel) Observable(java.util.Observable)

Aggregations

Observable (java.util.Observable)1 ISOChannel (org.jpos.iso.ISOChannel)1 ISOChannelPanel (org.jpos.iso.gui.ISOChannelPanel)1 ISOMeter (org.jpos.iso.gui.ISOMeter)1