X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FFeatureSettings.java;h=c23ad26832f934a19453f3947a06d5a4fc5be9ca;hb=373a0f23b37fdd3c40d3ebb4a3c9120f5773bb45;hp=da7bc57dac7c2bf846f5e01a9e16b3524311fcb6;hpb=3e254f5c4099b90ce6db323cacf945c8ddeeba1d;p=jalview.git
diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java
old mode 100755
new mode 100644
index da7bc57..c23ad26
--- a/src/jalview/gui/FeatureSettings.java
+++ b/src/jalview/gui/FeatureSettings.java
@@ -1,46 +1,93 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-import java.util.List;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-
-import jalview.analysis.AlignmentSorter;
import jalview.bin.Cache;
-import jalview.commands.OrderCommand;
-import jalview.datamodel.*;
-import jalview.io.*;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.Help.HelpId;
+import jalview.io.JalviewFileChooser;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import jalview.ws.dbsources.das.api.jalviewSourceI;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.help.HelpSetException;
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JDialog;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+
public class FeatureSettings extends JPanel
{
DasSourceBrowser dassourceBrowser;
@@ -57,6 +104,8 @@ public class FeatureSettings extends JPanel
Object[][] originalData;
+ private float originalTransparency;
+
final JInternalFrame frame;
JScrollPane scrollPane = new JScrollPane();
@@ -73,8 +122,8 @@ public class FeatureSettings extends JPanel
{
this.af = af;
fr = af.getFeatureRenderer();
-
- transparency.setMaximum(100 - (int) (fr.transparency * 100));
+ // allow transparency to be recovered
+ transparency.setMaximum(100 - (int) ((originalTransparency=fr.getTransparency()) * 100));
try
{
@@ -84,7 +133,19 @@ public class FeatureSettings extends JPanel
ex.printStackTrace();
}
- table = new JTable();
+ table = new JTable() {
+ @Override
+ public String getToolTipText(MouseEvent e) {
+ if (table.columnAtPoint(e.getPoint()) == 0) {
+ /*
+ * Tooltip for feature name only
+ */
+ return JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.feature_settings_click_drag"));
+ }
+ return null;
+ }
+ };
table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
table.setFont(new Font("Verdana", Font.PLAIN, 12));
table.setDefaultRenderer(Color.class, new ColorRenderer());
@@ -100,10 +161,31 @@ public class FeatureSettings extends JPanel
public void mousePressed(MouseEvent evt)
{
selectedRow = table.rowAtPoint(evt.getPoint());
- if (javax.swing.SwingUtilities.isRightMouseButton(evt))
+ if (SwingUtilities.isRightMouseButton(evt))
{
popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
- table.getValueAt(selectedRow, 1), fr.minmax, evt.getX(),
+ table.getValueAt(selectedRow, 1), fr.getMinMax(),
+ evt.getX(), evt.getY());
+ }
+ else if (evt.getClickCount() == 2)
+ {
+ fr.ap.alignFrame.avc.markColumnsContainingFeatures(
+ evt.isAltDown(), evt.isShiftDown() || evt.isMetaDown(),
+ evt.isMetaDown(),
+ (String) table.getValueAt(selectedRow, 0));
+ }
+ }
+
+ // isPopupTrigger fires on mouseReleased on Mac
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ selectedRow = table.rowAtPoint(evt.getPoint());
+ if (evt.isPopupTrigger())
+ {
+ popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0),
+ table.getValueAt(selectedRow, 1), fr.getMinMax(),
+ evt.getX(),
evt.getY());
}
}
@@ -133,14 +215,14 @@ public class FeatureSettings extends JPanel
}
}
});
-
+// table.setToolTipText(JvSwingUtils.wrapTooltip(true,
+// MessageManager.getString("label.feature_settings_click_drag")));
scrollPane.setViewportView(table);
dassourceBrowser = new DasSourceBrowser(this);
dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER);
- if (af.getViewport().featuresDisplayed == null
- || fr.renderOrder == null)
+ if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder())
{
fr.findAllFeatures(true); // display everything!
}
@@ -167,11 +249,15 @@ public class FeatureSettings extends JPanel
frame.setContentPane(this);
if (new jalview.util.Platform().isAMac())
{
- Desktop.addInternalFrame(frame, "Sequence Feature Settings", 475, 480);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.sequence_feature_settings"),
+ 475, 480);
}
else
{
- Desktop.addInternalFrame(frame, "Sequence Feature Settings", 400, 450);
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("label.sequence_feature_settings"),
+ 400, 450);
}
frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
@@ -189,8 +275,11 @@ public class FeatureSettings extends JPanel
protected void popupSort(final int selectedRow, final String type,
final Object typeCol, final Hashtable minmax, int x, int y)
{
- JPopupMenu men = new JPopupMenu("Settings for " + type);
- JMenuItem scr = new JMenuItem("Sort by Score");
+ JPopupMenu men = new JPopupMenu(MessageManager.formatMessage(
+ "label.settings_for_param", new String[]
+ { type }));
+ JMenuItem scr = new JMenuItem(
+ MessageManager.getString("label.sort_by_score"));
men.add(scr);
final FeatureSettings me = this;
scr.addActionListener(new ActionListener()
@@ -198,18 +287,19 @@ public class FeatureSettings extends JPanel
public void actionPerformed(ActionEvent e)
{
- me.sortByScore(new String[]
+ me.af.avc.sortAlignmentByFeatureScore(new String[]
{ type });
}
});
- JMenuItem dens = new JMenuItem("Sort by Density");
+ JMenuItem dens = new JMenuItem(
+ MessageManager.getString("label.sort_by_density"));
dens.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- me.sortByDens(new String[]
+ me.af.avc.sortAlignmentByFeatureDensity(new String[]
{ type });
}
@@ -292,6 +382,32 @@ public class FeatureSettings extends JPanel
});
}
}
+ JMenuItem selCols = new JMenuItem(
+ MessageManager.getString("label.select_columns_containing"));
+ selCols.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false,
+ false, type);
+ }
+ });
+ JMenuItem clearCols = new JMenuItem(
+ MessageManager.getString("label.select_columns_not_containing"));
+ clearCols.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false,
+ false, type);
+ }
+ });
+ men.add(selCols);
+ men.add(clearCols);
men.show(table, x, y);
}
@@ -307,23 +423,19 @@ public class FeatureSettings extends JPanel
synchronized public void setTableData()
{
- if (fr.featureGroups == null)
- {
- fr.featureGroups = new Hashtable();
- }
Vector allFeatures = new Vector();
Vector allGroups = new Vector();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+ for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
{
- if (af.getViewport().alignment.getSequenceAt(i).getDatasetSequence()
- .getSequenceFeatures() == null)
+ if (af.getViewport().getAlignment().getSequenceAt(i)
+ .getDatasetSequence().getSequenceFeatures() == null)
{
continue;
}
- tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+ tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
.getDatasetSequence().getSequenceFeatures();
int index = 0;
@@ -341,10 +453,7 @@ public class FeatureSettings extends JPanel
if (!allGroups.contains(group))
{
allGroups.addElement(group);
- if (group != null)
- {
- checkGroupState(group);
- }
+ checkGroupState(group);
}
}
@@ -362,21 +471,14 @@ public class FeatureSettings extends JPanel
}
/**
+ * Synchronise gui group list and check visibility of group
*
* @param group
- * @return true if group has been seen before and is already added to set.
+ * @return true if group is visible
*/
private boolean checkGroupState(String group)
{
- boolean visible;
- if (fr.featureGroups.containsKey(group))
- {
- visible = ((Boolean) fr.featureGroups.get(group)).booleanValue();
- }
- else
- {
- visible = true; // new group is always made visible
- }
+ boolean visible = fr.checkGroupVisibility(group, true);
if (groupPanel == null)
{
@@ -397,10 +499,8 @@ public class FeatureSettings extends JPanel
if (alreadyAdded)
{
- return true;
+ return visible;
}
-
- fr.featureGroups.put(group, new Boolean(visible));
final String grp = group;
final JCheckBox check = new JCheckBox(group, visible);
check.setFont(new Font("Serif", Font.BOLD, 12));
@@ -408,9 +508,8 @@ public class FeatureSettings extends JPanel
{
public void itemStateChanged(ItemEvent evt)
{
- fr.featureGroups.put(check.getText(),
- new Boolean(check.isSelected()));
- af.alignPanel.seqPanel.seqCanvas.repaint();
+ fr.setGroupVisibility(check.getText(), check.isSelected());
+ af.alignPanel.getSeqPanel().seqCanvas.repaint();
if (af.alignPanel.overviewPanel != null)
{
af.alignPanel.overviewPanel.updateOverviewImage();
@@ -421,7 +520,7 @@ public class FeatureSettings extends JPanel
}
});
groupPanel.add(check);
- return false;
+ return visible;
}
boolean resettingTable = false;
@@ -444,10 +543,10 @@ public class FeatureSettings extends JPanel
// Find out which features should be visible depending on which groups
// are selected / deselected
// and recompute average width ordering
- for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+ for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
{
- tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+ tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
.getDatasetSequence().getSequenceFeatures();
if (tmpfeatures == null)
{
@@ -465,11 +564,8 @@ public class FeatureSettings extends JPanel
continue;
}
- if (group == null || fr.featureGroups.get(group) == null
- || ((Boolean) fr.featureGroups.get(group)).booleanValue())
+ if (group == null || checkGroupState(group))
{
- if (group != null)
- checkGroupState(group);
type = tmpfeatures[index].getType();
if (!visibleChecks.contains(type))
{
@@ -504,17 +600,20 @@ public class FeatureSettings extends JPanel
Object[][] data = new Object[fSize][3];
int dataIndex = 0;
- if (fr.renderOrder != null)
+ if (fr.hasRenderOrder())
{
if (!handlingUpdate)
+ {
fr.findAllFeatures(groupChanged != null); // prod to update
- // colourschemes. but don't
- // affect display
- // First add the checks in the previous render order,
- // in case the window has been closed and reopened
- for (int ro = fr.renderOrder.length - 1; ro > -1; ro--)
+ // colourschemes. but don't
+ // affect display
+ // First add the checks in the previous render order,
+ // in case the window has been closed and reopened
+ }
+ List frl = fr.getRenderOrder();
+ for (int ro = frl.size() - 1; ro > -1; ro--)
{
- type = fr.renderOrder[ro];
+ type = frl.get(ro);
if (!visibleChecks.contains(type))
{
@@ -523,8 +622,8 @@ public class FeatureSettings extends JPanel
data[dataIndex][0] = type;
data[dataIndex][1] = fr.getFeatureStyle(type);
- data[dataIndex][2] = new Boolean(
- af.getViewport().featuresDisplayed.containsKey(type));
+ data[dataIndex][2] = new Boolean(af.getViewport()
+ .getFeaturesDisplayed().isVisible(type));
dataIndex++;
visibleChecks.removeElement(type);
}
@@ -542,7 +641,7 @@ public class FeatureSettings extends JPanel
if (data[dataIndex][1] == null)
{
// "Colour has been updated in another view!!"
- fr.renderOrder = null;
+ fr.clearRenderOrder();
return;
}
@@ -564,8 +663,8 @@ public class FeatureSettings extends JPanel
if (groupPanel != null)
{
- groupPanel.setLayout(new GridLayout(fr.featureGroups.size() / 4 + 1,
- 4));
+ groupPanel.setLayout(new GridLayout(
+ fr.getFeatureGroupsSize() / 4 + 1, 4));
groupPanel.validate();
bigPanel.add(groupPanel, BorderLayout.NORTH);
@@ -588,12 +687,18 @@ public class FeatureSettings extends JPanel
{
order[i] = fr.getOrder(data[i][0].toString());
if (order[i] < 0)
+ {
order[i] = fr.setOrder(data[i][0].toString(), i / order.length);
+ }
if (i > 1)
+ {
sort = sort || order[i - 1] > order[i];
+ }
}
if (sort)
+ {
jalview.util.QuickSort.sort(order, data);
+ }
}
void load()
@@ -603,8 +708,8 @@ public class FeatureSettings extends JPanel
{ "fc" }, new String[]
{ "Sequence Feature Colours" }, "Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Load Feature Colours");
- chooser.setToolTipText("Load");
+ chooser.setDialogTitle(MessageManager.getString("label.load_feature_colours"));
+ chooser.setToolTipText(MessageManager.getString("action.load"));
int value = chooser.showOpenDialog(this);
@@ -618,7 +723,7 @@ public class FeatureSettings extends JPanel
file), "UTF-8");
jalview.schemabinding.version2.JalviewUserColours jucs = new jalview.schemabinding.version2.JalviewUserColours();
- jucs = (jalview.schemabinding.version2.JalviewUserColours) jucs
+ jucs = jucs
.unmarshal(in);
for (int i = jucs.getColourCount() - 1; i >= 0; i--)
@@ -701,8 +806,8 @@ public class FeatureSettings extends JPanel
{ "fc" }, new String[]
{ "Sequence Feature Colours" }, "Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Save Feature Colour Scheme");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(MessageManager.getString("label.save_feature_colours"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
@@ -716,13 +821,14 @@ public class FeatureSettings extends JPanel
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(choice), "UTF-8"));
- Enumeration e = fr.featureColours.keys();
- float[] sortOrder = new float[fr.featureColours.size()];
- String[] sortTypes = new String[fr.featureColours.size()];
+ Set fr_colours = fr.getAllFeatureColours();
+ Iterator e = fr_colours.iterator();
+ float[] sortOrder = new float[fr_colours.size()];
+ String[] sortTypes = new String[fr_colours.size()];
int i = 0;
- while (e.hasMoreElements())
+ while (e.hasNext())
{
- sortTypes[i] = e.nextElement().toString();
+ sortTypes[i] = e.next().toString();
sortOrder[i] = fr.getOrder(sortTypes[i]);
i++;
}
@@ -784,7 +890,9 @@ public class FeatureSettings extends JPanel
public void orderByAvWidth()
{
if (table == null || table.getModel() == null)
+ {
return;
+ }
Object[][] data = ((FeatureTableModel) table.getModel()).getData();
float[] width = new float[data.length];
float[] awidth;
@@ -806,7 +914,9 @@ public class FeatureSettings extends JPanel
width[i] = 0;
}
if (max < width[i])
+ {
max = width[i];
+ }
}
boolean sort = false;
for (int i = 0; i < width.length; i++)
@@ -826,11 +936,15 @@ public class FeatureSettings extends JPanel
fr.setOrder(data[i][0].toString(), width[i]); // store for later
}
if (i > 0)
+ {
sort = sort || width[i - 1] > width[i];
+ }
}
if (sort)
+ {
jalview.util.QuickSort.sort(width, data);
// update global priority order
+ }
updateFeatureRenderer(data, false);
table.repaint();
@@ -898,7 +1012,9 @@ public class FeatureSettings extends JPanel
JButton sortByDens = new JButton();
- JPanel transbuttons = new JPanel(new GridLayout(4, 1));
+ JButton help = new JButton();
+
+ JPanel transbuttons = new JPanel(new GridLayout(5, 1));
private void jbInit() throws Exception
{
@@ -907,7 +1023,7 @@ public class FeatureSettings extends JPanel
dasSettingsPane.setLayout(borderLayout3);
bigPanel.setLayout(borderLayout4);
invert.setFont(JvSwingUtils.getLabelFont());
- invert.setText("Invert Selection");
+ invert.setText(MessageManager.getString("label.invert_selection"));
invert.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -916,7 +1032,7 @@ public class FeatureSettings extends JPanel
}
});
optimizeOrder.setFont(JvSwingUtils.getLabelFont());
- optimizeOrder.setText("Optimise Order");
+ optimizeOrder.setText(MessageManager.getString("label.optimise_order"));
optimizeOrder.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -925,35 +1041,68 @@ public class FeatureSettings extends JPanel
}
});
sortByScore.setFont(JvSwingUtils.getLabelFont());
- sortByScore.setText("Seq sort by Score");
+ sortByScore
+ .setText(MessageManager.getString("label.seq_sort_by_score"));
sortByScore.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- sortByScore(null);
+ af.avc.sortAlignmentByFeatureScore(null);
}
});
sortByDens.setFont(JvSwingUtils.getLabelFont());
- sortByDens.setText("Seq Sort by density");
+ sortByDens.setText(MessageManager
+ .getString("label.sequence_sort_by_density"));
sortByDens.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- sortByDens(null);
+ af.avc.sortAlignmentByFeatureDensity(null);
+ }
+ });
+ help.setFont(JvSwingUtils.getLabelFont());
+ help.setText(MessageManager.getString("action.help"));
+ help.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ Help.showHelpWindow(HelpId.SequenceFeatureSettings);
+ } catch (HelpSetException e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ });
+ help.setFont(JvSwingUtils.getLabelFont());
+ help.setText(MessageManager.getString("action.help"));
+ help.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ Help.showHelpWindow(HelpId.SequenceFeatureSettings);
+ } catch (HelpSetException e1)
+ {
+ e1.printStackTrace();
+ }
}
});
cancel.setFont(JvSwingUtils.getLabelFont());
- cancel.setText("Cancel");
+ cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
+ fr.setTransparency(originalTransparency);
updateFeatureRenderer(originalData);
close();
}
});
ok.setFont(JvSwingUtils.getLabelFont());
- ok.setText("OK");
+ ok.setText(MessageManager.getString("action.ok"));
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -962,7 +1111,7 @@ public class FeatureSettings extends JPanel
}
});
loadColours.setFont(JvSwingUtils.getLabelFont());
- loadColours.setText("Load Colours");
+ loadColours.setText(MessageManager.getString("label.load_colours"));
loadColours.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -971,7 +1120,7 @@ public class FeatureSettings extends JPanel
}
});
saveColours.setFont(JvSwingUtils.getLabelFont());
- saveColours.setText("Save Colours");
+ saveColours.setText(MessageManager.getString("label.save_colours"));
saveColours.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -983,13 +1132,15 @@ public class FeatureSettings extends JPanel
{
public void stateChanged(ChangeEvent evt)
{
- fr.setTransparency((float) (100 - transparency.getValue()) / 100f);
+ fr.setTransparency((100 - transparency.getValue()) / 100f);
af.alignPanel.paintAlignment(true);
}
});
transparency.setMaximum(70);
- fetchDAS.setText("Fetch DAS Features");
+ transparency.setToolTipText(MessageManager
+ .getString("label.transparency_tip"));
+ fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
fetchDAS.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -997,7 +1148,7 @@ public class FeatureSettings extends JPanel
fetchDAS_actionPerformed(e);
}
});
- saveDAS.setText("Save as default");
+ saveDAS.setText(MessageManager.getString("action.save_as_default"));
saveDAS.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -1008,7 +1159,7 @@ public class FeatureSettings extends JPanel
dasButtonPanel.setBorder(BorderFactory.createEtchedBorder());
dasSettingsPane.setBorder(null);
cancelDAS.setEnabled(false);
- cancelDAS.setText("Cancel Fetch");
+ cancelDAS.setText(MessageManager.getString("action.cancel_fetch"));
cancelDAS.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -1017,13 +1168,16 @@ public class FeatureSettings extends JPanel
}
});
this.add(tabbedPane, java.awt.BorderLayout.CENTER);
- tabbedPane.addTab("Feature Settings", settingsPane);
- tabbedPane.addTab("DAS Settings", dasSettingsPane);
+ tabbedPane.addTab(MessageManager.getString("label.feature_settings"), settingsPane);
+ tabbedPane.addTab(MessageManager.getString("label.das_settings"), dasSettingsPane);
bigPanel.add(transPanel, java.awt.BorderLayout.SOUTH);
transbuttons.add(optimizeOrder);
transbuttons.add(invert);
transbuttons.add(sortByScore);
transbuttons.add(sortByDens);
+ transbuttons.add(help);
+ JPanel sliderPanel = new JPanel();
+ sliderPanel.add(transparency);
transPanel.add(transparency);
transPanel.add(transbuttons);
buttonPanel.add(ok);
@@ -1039,130 +1193,6 @@ public class FeatureSettings extends JPanel
settingsPane.add(buttonPanel, java.awt.BorderLayout.SOUTH);
}
- protected void sortByDens(String[] typ)
- {
- sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY);
- }
-
- protected void sortBy(String[] typ, String methodText, final String method)
- {
- if (typ == null)
- {
- typ = getDisplayedFeatureTypes();
- }
- String gps[] = null;
- gps = getDisplayedFeatureGroups();
- if (typ != null)
- {
- ArrayList types = new ArrayList();
- for (int i = 0; i < typ.length; i++)
- {
- if (typ[i] != null)
- {
- types.add(typ[i]);
- }
- typ = new String[types.size()];
- types.toArray(typ);
- }
- }
- if (gps != null)
- {
- ArrayList grps = new ArrayList();
-
- for (int i = 0; i < gps.length; i++)
- {
- if (gps[i] != null)
- {
- grps.add(gps[i]);
- }
- }
- gps = new String[grps.size()];
- grps.toArray(gps);
- }
- AlignmentPanel alignPanel = af.alignPanel;
- AlignmentI al = alignPanel.av.getAlignment();
-
- int start, stop;
- SequenceGroup sg = alignPanel.av.getSelectionGroup();
- if (sg != null)
- {
- start = sg.getStartRes();
- stop = sg.getEndRes();
- }
- else
- {
- start = 0;
- stop = al.getWidth();
- }
- SequenceI[] oldOrder = al.getSequencesArray();
- AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method);
- af.addHistoryItem(new OrderCommand(methodText, oldOrder, alignPanel.av
- .getAlignment()));
- alignPanel.paintAlignment(true);
-
- }
-
- protected void sortByScore(String[] typ)
- {
- sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE);
- }
-
- private String[] getDisplayedFeatureTypes()
- {
- String[] typ = null;
- if (fr != null)
- {
- synchronized (fr.renderOrder)
- {
- typ = new String[fr.renderOrder.length];
- System.arraycopy(fr.renderOrder, 0, typ, 0, typ.length);
- for (int i = 0; i < typ.length; i++)
- {
- if (af.viewport.featuresDisplayed.get(typ[i]) == null)
- {
- typ[i] = null;
- }
- }
- }
- }
- return typ;
- }
-
- private String[] getDisplayedFeatureGroups()
- {
- String[] gps = null;
- if (fr != null)
- {
-
- if (fr.featureGroups != null)
- {
- Enumeration en = fr.featureGroups.keys();
- gps = new String[fr.featureColours.size()];
- int g = 0;
- boolean valid = false;
- while (en.hasMoreElements())
- {
- String gp = (String) en.nextElement();
- Boolean on = (Boolean) fr.featureGroups.get(gp);
- if (on != null && on.booleanValue())
- {
- valid = true;
- gps[g++] = gp;
- }
- }
- while (g < gps.length)
- {
- gps[g++] = null;
- }
- if (!valid)
- {
- return null;
- }
- }
- }
- return gps;
- }
-
public void fetchDAS_actionPerformed(ActionEvent e)
{
fetchDAS.setEnabled(false);
@@ -1184,7 +1214,7 @@ public class FeatureSettings extends JPanel
{
SequenceI[] dataset, seqs;
int iSize;
- AlignViewport vp = af.getViewport();
+ AlignmentViewport vp = af.getViewport();
if (vp.getSelectionGroup() != null
&& vp.getSelectionGroup().getSize() > 0)
{
@@ -1255,7 +1285,8 @@ public class FeatureSettings extends JPanel
public void fetchDasFeatures(Vector sources, boolean block)
{
initDasSources();
- List resolved = dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
+ List resolved = dassourceBrowser.sourceRegistry
+ .resolveSourceNicknames(sources);
if (resolved.size() == 0)
{
resolved = dassourceBrowser.getSelectedSources();
@@ -1311,11 +1342,15 @@ public class FeatureSettings extends JPanel
public void noDasSourceActive()
{
complete();
- JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- "No das sources were selected.\n"
- + "Please select some sources and\n" + " try again.",
- "No Sources Selected", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane
+ .showInternalConfirmDialog(
+ Desktop.desktop,
+ MessageManager
+ .getString("label.no_das_sources_selected_warn"),
+ MessageManager
+ .getString("label.no_das_sources_selected_title"),
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.INFORMATION_MESSAGE);
}
// ///////////////////////////////////////////////////////////////////////
@@ -1329,7 +1364,7 @@ public class FeatureSettings extends JPanel
}
private String[] columnNames =
- { "Feature Type", "Colour", "Display" };
+ { MessageManager.getString("label.feature_type"), MessageManager.getString("action.colour"), MessageManager.getString("label.display") };
private Object[][] data;
@@ -1594,7 +1629,7 @@ class FeatureIcon implements Icon
// width/g.getFontMetrics().stringWidth("Label"),
// height/g.getFontMetrics().getHeight())));
- g.drawString("Label", 0, 0);
+ g.drawString(MessageManager.getString("label.label"), 0, 0);
}
else