/** * Gets background color for cell for row ic. Override it if you want to change the color from the * default. */ public Color getBackgroundColorOfCell(int it, boolean selected) { if (observedStates == null) { doCalcs(); if (observedStates == null) return null; } if (observedStates.getParentData() != null) { captureCharacterDataFromObservedStates(); Associable tInfo = data.getTaxaInfo(false); NameReference genBankColor = NameReference.getNameReference("genbankcolor"); Object obj = tInfo.getAssociatedObject(genBankColor, it); // not saved to file if (obj instanceof Color) return (Color) obj; } if (bits == null || it < 0 || it > bits.getSize()) return null; String note = getNote(it); if (selected) { if (bits.isBitOn(it)) return ColorDistribution.darkGreen; else return ColorDistribution.darkRed; } else if (bits.isBitOn(it)) { if (StringUtil.blank(note)) return ColorDistribution.veryLightGreen; if (!(note.equalsIgnoreCase("x"))) return ColorDistribution.lightGreenYellowish; return ColorDistribution.lightGreenYellow; } else { if (StringUtil.blank(note)) return ColorDistribution.brown; if (!(note.equalsIgnoreCase("x"))) { return Color.red; } return ColorDistribution.lightRed; } }
String getNote(int row) { if (tInfo == null) return null; Object obj = tInfo.getAssociatedObject(MolecularData.genBankNumberRef, row); if (obj == null || !(obj instanceof String)) return null; return (String) obj; }