org.jclarion.clarion.swing.gui.NetworkQueue Maven / Gradle / Ivy
package org.jclarion.clarion.swing.gui;
import org.jclarion.clarion.ClarionBool;
import org.jclarion.clarion.ClarionNumber;
import org.jclarion.clarion.ClarionObject;
import org.jclarion.clarion.ClarionQueue;
import org.jclarion.clarion.ClarionQueueEvent;
import org.jclarion.clarion.ClarionQueueListener;
import org.jclarion.clarion.ClarionString;
import org.jclarion.clarion.control.ListColumn;
public class NetworkQueue implements ClarionQueueListener,NetworkMetaData
{
private ClarionQueue queue;
private boolean modified=true;
private int colCount=0;
public NetworkQueue(ClarionQueue queue,String format,ClarionObject mark)
{
ListColumn lc[] = ListColumn.construct(format);
this.queue=queue;
queue.addListener(this);
if (lc!=null && lc.length>0) {
ListColumn last = lc[lc.length-1];
colCount = last.getFieldNumber();
if (last.isColor()) colCount+=4;
if (last.isTree()) colCount+=1;
if (last.isStyle()) colCount+=1;
if (last.isIcon() || last.isTransparantIcon()) colCount+=1;
} else {
for (int scan=1;scan<=queue.getVariableCount();scan++) {
ClarionObject o = queue.flatWhat(scan);
if (o==null) break;
colCount++;
}
}
if (mark!=null) {
int pos = mark.intValue();
if (pos>colCount) colCount=pos;
}
}
@Override
public void queueModified(ClarionQueueEvent event)
{
modified=true;
}
public boolean isModified() {
return modified;
}
@Override
public Object getMetaData() {
if (!modified) return null;
// encoding is:
// 1 : colcount
// x : current buffer
// r : row data
int rec = queue.records();
int size = 1 + colCount*(1+rec);
Object result[] = new Object[size];
result[0]=colCount;
for (int scan=1;scan<=colCount;scan++) {
result[scan]=queue.flatWhat(scan);
}
for (int scan=1;scan<=rec;scan++) {
ClarionObject co[] = queue.getRecord(scan);
for (int c=0;cnew_records;scan--) {
base.get(scan);
base.delete();
}
return base;
}
public void dispose()
{
queue.removeListener(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy