/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview 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 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview 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 Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
import jalview.datamodel.*;
import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
/**
* DOCUMENT ME!
{
this.ap = ap;
this.av = ap.av;
+ if (ap != null && ap.seqPanel != null && ap.seqPanel.seqCanvas != null
+ && ap.seqPanel.seqCanvas.fr != null)
+ {
+ transferSettings(ap.seqPanel.seqCanvas.fr);
+ }
}
public class FeatureRendererSettings implements Cloneable
this.featureOrder = fr.featureOrder;
}
+ /**
+ * update from another feature renderer
+ *
+ * @param fr
+ * settings to copy
+ */
public void transferSettings(FeatureRenderer fr)
{
FeatureRendererSettings frs = new FeatureRendererSettings(fr);
// copy over the displayed feature settings
if (fr.av != null)
{
- if (fr.av.featuresDisplayed != null)
+ if (fr.av.getFeaturesDisplayed() != null)
{
// update display settings
- if (av.featuresDisplayed == null)
+ if (av.getFeaturesDisplayed() == null)
{
- av.featuresDisplayed = new Hashtable(fr.av.featuresDisplayed);
+ av.setFeaturesDisplayed(new Hashtable(fr.av.getFeaturesDisplayed()));
}
else
{
- av.featuresDisplayed.clear();
- Enumeration en = fr.av.featuresDisplayed.keys();
+ av.getFeaturesDisplayed().clear();
+ Enumeration en = fr.av.getFeaturesDisplayed().keys();
while (en.hasMoreElements())
{
- av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
+ av.getFeaturesDisplayed().put(en.nextElement(), Boolean.TRUE);
}
}
fm = g.getFontMetrics();
}
- if (av.featuresDisplayed == null || renderOrder == null
+ if (av.getFeaturesDisplayed() == null || renderOrder == null
|| newFeatureAdded)
{
findAllFeatures();
- if (av.featuresDisplayed.size() < 1)
+ if (av.getFeaturesDisplayed().size() < 1)
{
return;
}
{
type = renderOrder[renderIndex];
- if (type == null || !av.featuresDisplayed.containsKey(type))
+ if (type == null || !av.getFeaturesDisplayed().containsKey(type))
{
continue;
}
findingFeatures = true;
- if (av.featuresDisplayed == null)
+ if (av.getFeaturesDisplayed() == null)
{
- av.featuresDisplayed = new Hashtable();
+ av.setFeaturesDisplayed(new Hashtable());
}
allfeatures = new Vector();
int index = 0;
while (index < features.length)
{
- if (!av.featuresDisplayed.containsKey(features[index].getType()))
+ if (!av.getFeaturesDisplayed().containsKey(features[index].getType()))
{
if (featureGroups.containsKey(features[index].getType()))
{
// this is a new feature type on the alignment. Mark it for
// display.
- av.featuresDisplayed.put(features[index].getType(),
+ av.getFeaturesDisplayed().put(features[index].getType(),
new Integer(getColour(features[index].getType())
.getRGB()));
setOrder(features[index].getType(), 0);
return ((GraduatedColor) fc).getMaxColor();
}
}
- throw new Error("Implementation Error: Unrecognised render object "
- + fc.getClass() + " for features of type " + featureType);
+ throw new Error(MessageManager.formatMessage("error.implementation_error_unrecognised_render_object_for_features_type", new String[]{fc.getClass().toString(),featureType}));
}
/**
return ((GraduatedColor) fc).findColor(feature);
}
}
- throw new Error("Implementation Error: Unrecognised render object "
- + fc.getClass() + " for features of type " + feature.getType());
+ throw new Error(MessageManager.formatMessage("error.implementation_error_unrecognised_render_object_for_features_type", new String[]{fc.getClass().toString(),feature.getType()}));
}
private boolean showFeature(SequenceFeature sequenceFeature)
if (fcol instanceof Color)
{
Color col = JColorChooser.showDialog(Desktop.desktop,
- "Select Feature Colour", ((Color) fcol));
+ MessageManager.getString("label.select_feature_colour"), ((Color) fcol));
if (col != null)
{
fcol = col;
{
panel = new JPanel(new GridLayout(4, 1));
tmp = new JPanel();
- tmp.add(new JLabel("Select Feature: "));
+ tmp.add(new JLabel(MessageManager.getString("label.select_feature")));
overlaps = new JComboBox();
for (int i = 0; i < features.length; i++)
{
tmp = new JPanel();
panel.add(tmp);
- tmp.add(new JLabel("Name: ", JLabel.RIGHT));
+ tmp.add(new JLabel(MessageManager.getString("label.name"), JLabel.RIGHT));
tmp.add(name);
tmp = new JPanel();
panel.add(tmp);
- tmp.add(new JLabel("Group: ", JLabel.RIGHT));
+ tmp.add(new JLabel(MessageManager.getString("label.group") + ":",
+ JLabel.RIGHT));
tmp.add(source);
tmp = new JPanel();
panel.add(tmp);
- tmp.add(new JLabel("Colour: ", JLabel.RIGHT));
+ tmp.add(new JLabel(MessageManager.getString("label.colour"),
+ JLabel.RIGHT));
tmp.add(colour);
colour.setPreferredSize(new Dimension(150, 15));
colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9));
bigPanel.add(panel, BorderLayout.NORTH);
panel = new JPanel();
- panel.add(new JLabel("Description: ", JLabel.RIGHT));
+ panel.add(new JLabel(MessageManager.getString("label.description"),
+ JLabel.RIGHT));
description.setFont(JvSwingUtils.getTextAreaFont());
description.setLineWrap(true);
panel.add(new JScrollPane(description));
bigPanel.add(panel, BorderLayout.SOUTH);
panel = new JPanel();
- panel.add(new JLabel(" Start:", JLabel.RIGHT));
+ panel.add(new JLabel(MessageManager.getString("label.start"),
+ JLabel.RIGHT));
panel.add(start);
- panel.add(new JLabel(" End:", JLabel.RIGHT));
+ panel.add(new JLabel(MessageManager.getString("label.end"),
+ JLabel.RIGHT));
panel.add(end);
bigPanel.add(panel, BorderLayout.CENTER);
}
{ "OK", "Cancel" };
}
- String title = newFeatures ? "Create New Sequence Feature(s)"
- : "Amend/Delete Features for " + sequences[0].getName();
+ String title = newFeatures ? MessageManager.getString("label.create_new_sequence_features")
+ : MessageManager.formatMessage("label.amend_delete_features", new String[]{sequences[0].getName()});
int reply = JOptionPane.showInternalOptionDialog(Desktop.desktop,
bigPanel, title, JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE, null, options, "OK");
+ JOptionPane.QUESTION_MESSAGE, null, options, MessageManager.getString("action.ok"));
jalview.io.FeaturesFile ffile = new jalview.io.FeaturesFile();
sf.description = lastDescriptionAdded;
setColour(sf.type, fcol);
- av.featuresDisplayed.put(sf.type, getColour(sf.type));
+ av.getFeaturesDisplayed().put(sf.type, getColour(sf.type));
try
{
ffile.parseDescriptionHTML(features[i], false);
}
- if (av.featuresDisplayed == null)
+ if (av.getFeaturesDisplayed() == null)
{
- av.featuresDisplayed = new Hashtable();
+ av.setFeaturesDisplayed(new Hashtable());
}
if (lastFeatureGroupAdded != null)
featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
}
setColour(lastFeatureAdded, fcol);
- av.featuresDisplayed.put(lastFeatureAdded,
+ av.getFeaturesDisplayed().put(lastFeatureAdded,
getColour(lastFeatureAdded));
findAllFeatures(false);
{
if (visibleNew)
{
- if (av.featuresDisplayed != null)
+ if (av.getFeaturesDisplayed() != null)
{
- av.featuresDisplayed.clear();
+ av.getFeaturesDisplayed().clear();
}
else
{
- av.featuresDisplayed = new Hashtable();
+ av.setFeaturesDisplayed(new Hashtable());
}
}
if (data == null)
// interface object
if (((Boolean) data[i][2]).booleanValue())
{
- av.featuresDisplayed.put(type, new Integer(getColour(type)
+ av.getFeaturesDisplayed().put(type, new Integer(getColour(type)
.getRGB()));
}