package edu.sdsc.mbt; import edu.sdsc.mbt.viewables.StylesPreferences; import edu.sdsc.mbt.viewers.GLViewerImpl.*; import edu.sdsc.sirius.dialogs.*; public class ResidueLabelComponent extends AnnotationComponent { public Residue residue; public String label; public Atom reference; private int TYPE = AnnotationComponentRegistry.TYPE_RESIDUE_LABEL; public float[] color = new float[]{ 1.0f, 1.0f, 1.0f }; public int dataType = LabelDialog.TYPE_NAME; public int font = LabelGeometry.MEDIUM_FONT; public ResidueLabelComponent(Residue residue, int dataType, int font, String label){ this.residue = residue; this.dataType = dataType; this.label = label; if (label != null){ dataType = LabelDialog.TYPE_CUSTOM; } if (font > -1) this.font = font; if (residue.centerAtom == null){ reference = residue.getAtom(0); } else{ reference = residue.centerAtom; } } public ResidueLabelComponent(Residue residue, int dataType, int font, String label, boolean selected, float[] color){ this.residue = residue; this.dataType = dataType; this.label = label; if (label != null){ dataType = LabelDialog.TYPE_CUSTOM; } if (font > -1) this.font = font; if (residue.centerAtom == null){ reference = residue.getAtom(0); } else{ reference = residue.centerAtom; } this.selected = selected; this.color = color; } public int getType(){ return TYPE; } public int getLabelType(){ return this.dataType; } public String getText(){ if (dataType == LabelDialog.TYPE_CUSTOM){ return label; } return residue.getCompoundCode() + residue.getResidueId(); } public float[] getColor(){ if (selected){ return StylesPreferences.selectionColor; } else{ return color; } } public float[] getSetColor(){ return color; } public int getFont(){ return font; } public void setFont(int font){ this.font = font; } private boolean selected = false; private boolean visible = true; public void setSelected(boolean selected){ this.selected = selected; } public boolean getSelected(){ return selected; } public final boolean getVisible() { return visible; } public final void setVisible(boolean visible) { this.visible = visible; } }