/** * 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(); }
public void doCalcs() { if (bits != null) bits.clearAllBits(); if (taxa == null) return; if (bits == null) bits = new Bits(taxa.getNumTaxa()); else bits.resetSize(taxa.getNumTaxa()); if (observedStates == null) { tInfo = null; observedStates = matrixSourceTask.getCurrentMatrix(taxa); if (observedStates != null) { captureCharacterDataFromObservedStates(); if (data != null) tInfo = data.getTaxaInfo(true); } } if (observedStates == null) return; for (int it = 0; it < taxa.getNumTaxa(); it++) { if (hasData(it)) bits.setBit(it); } }
/*.................................................................................................................*/ private void recordSourceProject() { MesquiteString s = new MesquiteString(); s.setValue(getProject().getHomeFileName()); if (!QueryDialogs.queryString( containerOfModule(), "Name to Stamp", "Indicate source file name to stamp on matrix rows", s)) return; int numMatrices = getProject().getNumberCharMatrices(); NameReference sourceRef = NameReference.getNameReference("SourceFile"); for (int im = 0; im < numMatrices; im++) { CharacterData data = getProject().getCharacterMatrix(im); Taxa taxa = data.getTaxa(); Associable tInfo = data.getTaxaInfo(true); boolean anySelected = taxa.anySelected(); for (int it = 0; it < taxa.getNumTaxa(); it++) { if (data.hasDataForTaxon(it) && (!anySelected || taxa.getSelected(it))) tInfo.setAssociatedObject(sourceRef, it, s.getValue()); } } }