I have an entity called FLUX_MESSAGES_LOG and then created a screen with timer. The table gets populated real-time by a tcp service with data.
on my screen that has a timer and the table linked to the datasource, every record in the entity creates about 50 records in the table. I’m not sure why this is happening.
my xml descriptor is as follows:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
caption="msg://caption"
class="com.company.flux.gui.fix.Fixview"
messagesPack="com.company.flux.gui.fix">
<dsContext>
<collectionDatasource id="fixmessageDs"
class="com.company.flux.entity.MessagesLog">
<query>
<![CDATA[select e from flux$MessagesLog e order by e.time desc]]>
</query>
</collectionDatasource>
</dsContext>
<timers>
<timer autostart="true"
delay="3000"
onTimer="refreshData"
repeating="true"/>
</timers>
<layout>
<table id="fixmessageTable"
height="500px"
width="100%">
<columns>
<column id="time"/>
<column id="beginstring"/>
<column id="sendercompid"/>
<column id="targetcompid"/>
<column id="session_qualifier"/>
<column id="text"/>
</columns>
<rows datasource="fixmessageDs"/>
</table>
</layout>
</window>
and my controller is as follows:
package com.company.flux.gui.fix;
import com.haulmont.cuba.gui.components.AbstractWindow;
import com.haulmont.cuba.gui.components.Timer;
import com.haulmont.cuba.gui.data.CollectionDatasource;
import javax.inject.Inject;
/**
* @author Francis
*/
public class Fixview extends AbstractWindow {
@Inject
private CollectionDatasource fixmessageDs;
public void refreshData(Timer timer) {
fixmessageDs.refresh();
}
}