/*...............................................................................................................*/ boolean selected(Taxa taxa, int it, int myColumn) { if (taxa.getSelected(it)) { return true; } if (table != null && myColumn >= 0) { if (table.isCellSelectedAnyWay(myColumn, it)) return true; } return false; }
/** * A request for the MesquiteModule to perform a command. It is passed two strings, the name of * the command and the arguments. This should be overridden by any module that wants to respond to * a command. */ public Object doCommand(String commandName, String arguments, CommandChecker checker) { if (checker.compare(MesquiteModule.class, null, null, commandName, "paint")) { MesquiteInteger io = new MesquiteInteger(0); int column = MesquiteInteger.fromString(arguments, io); int row = MesquiteInteger.fromString(arguments, io); if (MesquiteInteger.isCombinable(row)) { if (!MesquiteLong.isCombinable(currentColor)) removeColor(row, true); else setColor(row, (int) currentColor); } } else if (checker.compare( this.getClass(), "Sets the color to be used to paint cells", "[name of color]", commandName, "setColor")) { int bc = ColorDistribution.standardColorNames.indexOf(parser.getFirstToken(arguments)); if (bc >= 0 && MesquiteLong.isCombinable(bc)) { removeColor.setValue(false); currentColor = bc; savedColor = bc; colorString = "Color " + ColorDistribution.standardColorNames.getValue(bc); } } else if (checker.compare( this.getClass(), "Sets the color of selected taxa", "[name of color]", commandName, "setColorSelected")) { int bc = ColorDistribution.standardColorNames.indexOf(parser.getFirstToken(arguments)); if (bc >= 0 && MesquiteLong.isCombinable(bc)) { for (int it = 0; it < taxa.getNumTaxa(); it++) if (taxa.getSelected(it)) setColor(it, bc); } } else if (checker.compare( this.getClass(), "Removes color from all the cells", null, commandName, "removeAllColor")) { removeAllColor(true); } else if (checker.compare( this.getClass(), "Sets the paint brush so that it removes colors from any cells touched", null, commandName, "removeColor")) { if (StringUtil.blank(arguments)) removeColor.setValue(!removeColor.getValue()); else removeColor.toggleValue(parser.getFirstToken(arguments)); if (removeColor.getValue()) { colorString = "Remove color"; currentColor = MesquiteLong.unassigned; } else { colorString = "Color " + ColorDistribution.standardColorNames.getValue((int) currentColor); currentColor = savedColor; } } else return super.doCommand(commandName, arguments, checker); return null; }