@Override public void frameArrived(MessageObjectFrame frame) { Object obj = frame.getObject(); if (obj instanceof CellInfo[]) { _infos = (CellInfo[]) obj; _list.removeAll(); int systemIndex = -1; TreeSet<String> sorted = new TreeSet<>(); for (CellInfo cellInfo : _infos) { sorted.add(cellInfo.getCellName()); } Iterator<String> it = sorted.iterator(); for (int i = 0; it.hasNext(); i++) { String name = it.next(); _list.add(name); if (name.equals("System")) { systemIndex = i; } } if (systemIndex > -1) { _cellPanel.showCell(_infos[systemIndex], _domainNode.getAddress()); _commandPanel.showCell(_infos[systemIndex], _domainNode.getAddress() + ":System"); _list.select("System"); } } }
public void showDomain(CellDomainNode domainNode) { _topLabel.setText(">>> " + domainNode.getName() + " <<<"); _domainNode = domainNode; _cellPanel.clear(); _commandPanel.clear(); updateDomain(); }
@Override public void itemStateChanged(ItemEvent event) { ItemSelectable sel = event.getItemSelectable(); Object[] obj = sel.getSelectedObjects(); if ((obj == null) || (obj.length == 0)) { return; } String cellName = obj[0].toString(); int i = 0; for (; (i < _infos.length) && (!_infos[i].getCellName().equals(cellName)); i++) {} if (i == _infos.length) { System.out.println("No more in list : " + cellName); return; } _cellPanel.showCell(_infos[i], _domainNode.getAddress()); _commandPanel.showCell(_infos[i], _domainNode.getAddress() + ":" + cellName); _cards.show(_cardPanel, _cellMode); }
private void updateDomain() { if (_domainNode == null) { return; } _connection.send(_domainNode.getAddress(), "getcellinfos", this); }