/** * 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; } }
public String getExplanationForRow(int ic) { if (observedStates != null && observedStates.getParentData() != null) { captureCharacterDataFromObservedStates(); Associable tInfo = data.getTaxaInfo(false); if (tInfo == null) return null; return "Notes: " + tInfo.toString(ic); } return null; }
/*.................................................................................................................*/ void zapData(CharacterData data, int it) { Taxa taxa = data.getTaxa(); if (it < 0 || it >= taxa.getNumTaxa()) return; Associable tInfo = data.getTaxaInfo(false); int myColumn = -1; if (getEmployer() instanceof ListModule) { myColumn = ((ListModule) getEmployer()).getMyColumn(this); } if (tInfo != null) tInfo.deassignAssociated(it); for (int ic = 0; ic < data.getNumChars(); ic++) data.deassign(ic, it); data.notifyListeners(this, new Notification(MesquiteListener.DATA_CHANGED)); outputInvalid(); parametersChanged(); }
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; }
void setNote(int row, String s) { if (tInfo == null) return; tInfo.setAssociatedObject(MolecularData.genBankNumberRef, row, s); }