/* * Jalview - A Sequence Alignment Editor and Viewer * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package jalview.datamodel; import jalview.analysis.*; import jalview.datamodel.*; import jalview.schemes.*; import java.util.*; public class SuperGroup { String groupName; boolean displayBoxes; boolean displayText; boolean colourText; public ColourSchemeI cs; Vector sequenceGroups = new Vector(); public SuperGroup() { groupName = "Super group"; this.displayBoxes = true; this.displayText = true; this.colourText = false; cs = null; } public SuperGroup(String groupName, ColourSchemeI scheme, boolean displayBoxes, boolean displayText, boolean colourText) { this.groupName = groupName; this.displayBoxes = displayBoxes; this.displayText = displayText; this.colourText = colourText; this.cs = scheme; } public String getName() { return groupName; } public void setName(String name) { groupName = name; } public void addGroup(SequenceGroup sg) { if (!sequenceGroups.contains(sg)) { sequenceGroups.addElement(sg); } } public void addOrRemove(SequenceGroup sg) { if (sequenceGroups.contains(sg)) { deleteGroup(sg); } else { addGroup(sg); } } public void deleteGroup(SequenceGroup sg) { sequenceGroups.removeElement(sg); } public void setSuperGroupProperties(SequenceGroup sg) { cs = sg.cs; colourText = sg.colourText; displayText = sg.displayText; displayBoxes = sg.displayBoxes; for (int i = 0; i < sequenceGroups.size(); i++) { SequenceGroup temp = (SequenceGroup) sequenceGroups.elementAt(i); temp.cs = sg.cs; temp.colourText = sg.colourText; temp.displayText = sg.displayText; temp.displayBoxes = sg.displayBoxes; } } public int getSize() { return sequenceGroups.size(); } public SequenceGroup getGroupeAt(int i) { return (SequenceGroup) sequenceGroups.elementAt(i); } }