private void fillGraphCombo() { try { RrdDb rrdDb = new RrdDb(sourcePath, true); try { RrdDef rrdDef = rrdDb.getRrdDef(); final DsDef[] dsDefs = rrdDef.getDsDefs(); final ArcDef[] arcDefs = rrdDef.getArcDefs(); GraphComboItem[] items = new GraphComboItem[rrdDef.getDsCount() * rrdDef.getArcCount()]; int selectedItem = -1; for (int i = 0, k = 0; i < rrdDef.getDsCount(); i++) { for (int j = 0; j < rrdDef.getArcCount(); k++, j++) { String description = dsDefs[i].dump() + " " + arcDefs[j].dump(); items[k] = new GraphComboItem(description, i, j); if (i == dsIndex && j == arcIndex) { selectedItem = k; } } } graphCombo.setModel(new DefaultComboBoxModel(items)); graphCombo.setSelectedIndex(selectedItem); } finally { rrdDb.close(); } } catch (Exception e) { Util.error(this, e); } }
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new RrdNode(rrd)); int dsCount = rrd.getRrdDef().getDsCount(); int arcCount = rrd.getRrdDef().getArcCount(); for (int dsIndex = 0; dsIndex < dsCount; dsIndex++) { DefaultMutableTreeNode dsNode =
Header(RrdDb parentDb, RrdDef rrdDef) throws IOException { this.parentDb = parentDb; String initSignature = null; if(rrdDef != null) { version = rrdDef.getVersion(); initSignature = SIGNATURE + ", " + VERSIONS[version - 1]; } else { initSignature = DEFAULT_SIGNATURE; } signature = new RrdString<>(this); // NOT constant, may be cached step = new RrdLong<>(this, true); // constant, may be cached dsCount = new RrdInt<>(this, true); // constant, may be cached arcCount = new RrdInt<>(this, true); // constant, may be cached lastUpdateTime = new RrdLong<>(this); if (rrdDef != null) { signature.set(initSignature); step.set(rrdDef.getStep()); dsCount.set(rrdDef.getDsCount()); arcCount.set(rrdDef.getArcCount()); lastUpdateTime.set(rrdDef.getStartTime()); } }
Header(RrdDb parentDb, RrdDef rrdDef) throws IOException { this.parentDb = parentDb; String initSignature = null; if(rrdDef != null) { version = rrdDef.getVersion(); initSignature = SIGNATURE + ", " + VERSIONS[ version - 1]; } else { initSignature = DEFAULT_SIGNATURE; } signature = new RrdString(this); // NOT constant, may be cached step = new RrdLong(this, true); // constant, may be cached dsCount = new RrdInt(this, true); // constant, may be cached arcCount = new RrdInt(this, true); // constant, may be cached lastUpdateTime = new RrdLong(this); if (rrdDef != null) { signature.set(initSignature); step.set(rrdDef.getStep()); dsCount.set(rrdDef.getDsCount()); arcCount.set(rrdDef.getArcCount()); lastUpdateTime.set(rrdDef.getStartTime()); } }