@@ -0,0 +1,1854 @@
+/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage studio.ui;%0A%0Aimport java.util.List;%0Aimport javax.swing.JOptionPane;%0Aimport javax.swing.SwingWorker;%0Aimport javax.swing.table.TableModel;%0Aimport kx.c;%0Aimport studio.kdb.DictTableModel;%0Aimport studio.kdb.K.Dict;%0Aimport studio.kdb.K.Flip;%0Aimport studio.kdb.K.KBase;%0Aimport studio.kdb.K.KList;%0Aimport studio.kdb.KTableModel;%0A%0A/**%0A *%0A * @author vidyser%0A */%0Apublic class SubscribeWorker extends SwingWorker %7B%0A%0A    private final c c;%0A    private final String tableName;%0A    private final QGrid grid;%0A%0A    public SubscribeWorker(QGrid grid, kx.c c, String tableName) %7B%0A        this.grid = grid;%0A        this.c = c;%0A        this.tableName = tableName;%0A    %7D%0A%0A    public c getC() %7B%0A        return c;%0A    %7D%0A%0A    @Override%0A    protected Object doInBackground() throws Exception %7B%0A        try %7B%0A            Object r;%0A            while (!isCancelled()) %7B%0A                r = c.k();%0A                System.out.println(%22recieved response%22);%0A                publish(r);%0A                System.out.println(%22cont listening%22);%0A            %7D%0A        %7D catch (Throwable ex) %7B%0A            ex.printStackTrace();%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    protected void process(List chunks) %7B%0A        for (Object next : chunks) %7B%0A            if (next instanceof KList) %7B%0A                KBase update = ((KList) next).at(2);%0A                grid.append(update);%0A                grid.getWa().resizeAllColumns();%0A            %7D else %7B%0A                System.out.println(%22error while processing result:%22 + next);%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void done() %7B%0A        if(isCancelled()) return;%0A        JOptionPane.showMessageDialog(null, %22Error while subscribing table%22, %22Subscribing %22 + tableName, JOptionPane.WARNING_MESSAGE);%0A    %7D%0A%7D%0A

add sub worker