use of org.yamcs.studio.archive.ArchivePanel.IndexChunkSpec in project yamcs-studio by yamcs.
the class Timeline method paintComponent.
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (image == null) {
image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D big = image.createGraphics();
big.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR));
big.fillRect(0, 0, getWidth(), getHeight());
big.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
// big.clearRect(0, 0, getWidth(),getHeight());
big.setColor(BLUEISH);
for (IndexChunkSpec pkt : tmspec) {
int x1 = zoom.convertInstantToPixel(pkt.startInstant);
int x2 = zoom.convertInstantToPixel(pkt.stopInstant);
int width = (x2 - x1 <= 1) ? 1 : x2 - x1 - 1;
big.fillRect(x1 - leftDelta, 0, width, getHeight());
}
}
g.drawImage(image, 0, 0, this);
}
use of org.yamcs.studio.archive.ArchivePanel.IndexChunkSpec in project yamcs-studio by yamcs.
the class IndexBox method redrawTmPanel.
void redrawTmPanel(IndexLineSpec pkt) {
IndexLine indexLine = pkt.assocIndexLine;
indexLine.setOpaque(false);
final int stopx = zoom.getPixels();
final Insets in = indexLine.getInsets();
final int panelw = zoom.getPixels();
JLabel pktlab;
Font font = null;
// , count = 0;
int x1, y = 0;
indexLine.removeAll();
// debugLog("redrawTmPanel() "+pkt.name+" mark 1");
// set labels
x1 = 10;
indexLine.setBackground(Color.RED);
do {
pktlab = new JLabel(pkt.lineName);
pktlab.setForeground(PACKET_LABEL_COLOR);
if (font == null) {
font = pktlab.getFont();
font = font.deriveFont((float) (font.getSize() - 3));
}
pktlab.setFont(font);
pktlab.setBounds(x1 + in.left, in.top, pktlab.getPreferredSize().width, pktlab.getPreferredSize().height);
indexLine.add(pktlab);
if (y == 0) {
y = in.top + pktlab.getSize().height;
indexLine.setPreferredSize(new Dimension(panelw, y + tmRowHeight + in.bottom));
indexLine.setMinimumSize(indexLine.getPreferredSize());
indexLine.setMaximumSize(indexLine.getPreferredSize());
}
x1 += 600;
} while (x1 < panelw - pktlab.getSize().width);
TreeSet<IndexChunkSpec> ts = tmData.get(pkt.lineName);
if (ts != null) {
Timeline tmt = new Timeline(this, pkt, ts, zoom, in.left);
tmt.setBounds(in.left, y, stopx, tmRowHeight);
indexLine.add(tmt);
}
// centerPanel.setPreferredSize(new Dimension(panelw, centerPanel.getPreferredSize().height));
// centerPanel.setMaximumSize(centerPanel.getPreferredSize());
indexLine.revalidate();
indexLine.repaint();
// System.out.println("indexLine.preferred size: "+indexLine.getPreferredSize());
}
use of org.yamcs.studio.archive.ArchivePanel.IndexChunkSpec in project yamcs-studio by yamcs.
the class IndexBox method receiveArchiveRecords.
public void receiveArchiveRecords(List<ArchiveRecord> records) {
String[] nameparts;
synchronized (tmData) {
for (ArchiveRecord r : records) {
// debugLog(r.packet+"\t"+r.num+"\t"+new Date(r.first)+"\t"+new Date(r.last));
NamedObjectId id = r.getId();
String grpName = null;
String shortName = null;
// split the id into group->name
if (!id.hasNamespace()) {
int idx = id.getName().lastIndexOf("/");
if (idx != -1) {
grpName = id.getName().substring(0, idx + 1);
shortName = id.getName().substring(idx + 1);
}
}
if (grpName == null) {
nameparts = id.getName().split("[_\\.]", 2);
if (nameparts.length > 1) {
grpName = nameparts[0];
shortName = nameparts[1].replaceFirst("INST_", "").replaceFirst("Tlm_Pkt_", "");
} else {
grpName = "";
shortName = id.getName();
}
}
if (!tmData.containsKey(id.getName())) {
tmData.put(id.getName(), new TreeSet<IndexChunkSpec>());
}
TreeSet<IndexChunkSpec> al = tmData.get(id.getName());
String info = r.hasInfo() ? r.getInfo() : null;
IndexChunkSpec tnew = new IndexChunkSpec(r.getFirst(), r.getLast(), r.getNum(), info);
IndexChunkSpec told = al.floor(tnew);
if ((told == null) || (mergeTime == -1) || (!told.merge(tnew, mergeTime))) {
al.add(tnew);
}
if (!allPackets.containsKey(id.getName())) {
IndexLineSpec pkt = new IndexLineSpec(id.getName(), grpName, shortName);
allPackets.put(id.getName(), pkt);
ArrayList<IndexLineSpec> plvec;
if ((plvec = groups.get(grpName)) == null) {
plvec = new ArrayList<>();
groups.put(grpName, plvec);
}
plvec.add(pkt);
}
}
titleLabel.setText(name);
}
}
Aggregations