column for the backbone atoms in the PDB file will be extracted as annotation lines shown on the alignment.
<p><em>Default structure viewer</em> - choose JMOL or CHIMERA for viewing 3D structures.
<p><em>Path to Chimera program</em> - Optional, as Jalview will search standard installation paths for Windows, Linux or MacOS.
-If you have installed Chimera in a non-standard location, you can specify it here. Enter the full path to the Chimera executable program.
+If you have installed Chimera in a non-standard location, you can specify it here, by entering the full path to the Chimera executable program.
+Double-click this field to open a file chooser dialog.
<p><a name="connections"><strong>"Connections"
Preferences tab</strong></a></p>
label.structure_viewer = Default structure viewer
label.chimera_path = Path to Chimera program
label.chimera_path_tip = Jalview will try standard locations, plus any path entered here.
-label.invalid_path = File not found or not executable
+label.invalid_chimera_path = Chimera path not found or not executable
label.min_colour = Minimum Colour
label.max_colour = Maximum Colour
label.use_original_colours = Use Original Colours
label.select_eps_character_rendering_style = Select EPS character rendering style
label.invert_selection = Invert Selection
label.optimise_order = Optimise Order
-label.seq_sort_by_score = Seq sort by Score
+label.seq_sort_by_score = Sequence sort by Score
label.load_colours = Load Colours
label.save_colours = Save Colours
label.fetch_das_features = Fetch DAS Features
label.rest_client_submit = {0} using {1}
label.fetch_retrieve_from =Retrieve from {0}</html>
label.fetch_retrieve_from_all_sources = Retrieve from all {0} sources in {1}<br>First is :{2}<html>
-label.feature_settings_click_drag = <html>Click/drag feature types up or down to change render order.<br/>Double click to select columns containing feature in alignment/current selection<br/>Pressing Alt will select columns outside features rather than inside<br/>Pressing Shift to modify current selection (rather than clear current selection)<br/>Press CTRL or Command/Meta to toggle columns in/outside features<br/></html>
+#label.feature_settings_click_drag = <html>Click/drag feature types up or down to change render order.<br/>Double click to select columns containing feature in alignment/current selection<br/>Pressing Alt will select columns outside features rather than inside<br/>Pressing Shift to modify current selection (rather than clear current selection)<br/>Press CTRL or Command/Meta to toggle columns in/outside features<br/></html>
+label.feature_settings_click_drag = Drag up or down to change render order.<br/>Double click to select columns containing feature.
+label.transparency_tip = Adjust transparency to 'see through' feature colours.
label.opt_and_params_further_details = see further details by right-clicking
label.opt_and_params_show_brief_desc_image_link = <html>Click to show brief description<br><img src="{0}"/> Right click for further information.</html>
label.opt_and_params_show_brief_desc = <html>Click to show brief description<br></html>
label.rest_client_submit = {0} utilizando {1}
label.fetch_retrieve_from =Recuperar de {0}
label.fetch_retrieve_from_all_sources = Recuperar de todas las fuentes {0} en {1}<br>La primera es :{2}
-label.feature_settings_click_drag = Haga clic o arrastre los tipos de las características hacia arriba o hacia abajo para cambiar el orden de visualización.<br/>Haga doble clic para seleccionar las columnas que contienen las características del alineamiento/selección actual.<br/>Presionando Alt seleccionará las columnas exteriores a las características en lugar de las interiores<br/>Presione Shift para modificar la selección actual (en lugar de borrarla)<br/>Presione CTRL o Command/Meta para cambiar las columans externas o internas a las características<br/>
+label.feature_settings_click_drag = Haga clic o arrastre los tipos de las características hacia arriba o hacia abajo para cambiar el orden de visualización.<br/>Haga doble clic para seleccionar las columnas que contienen las características del alineamiento/selección actual.<br/>
label.opt_and_params_further_details = ver los detalles adicionales haciendo clic en el botón derecho
label.opt_and_params_show_brief_desc_image_link = Haga clic para ver una descripción breve<br><img src="{0}"/>Haga clic en el botón derecho para obtener información adicional.
label.opt_and_params_show_brief_desc = Haga clic para ver una descripción breve<br>
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
public class HiddenSequences
{
alignment.deleteSequence(sequence);
}
- public Vector showAll(
+ public List<SequenceI> showAll(
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- Vector revealedSeqs = new Vector();
+ List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
for (int i = 0; i < hiddenSequences.length; i++)
{
if (hiddenSequences[i] != null)
{
- Vector tmp = showSequence(i, hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
+ List<SequenceI> tmp = showSequence(i, hiddenRepSequences);
+ for (SequenceI seq : tmp)
{
- revealedSeqs.addElement(tmp.elementAt(t));
+ revealedSeqs.add(seq);
}
}
}
return revealedSeqs;
}
- public Vector showSequence(int alignmentIndex,
+ public List<SequenceI> showSequence(int alignmentIndex,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- Vector revealedSeqs = new Vector();
+ List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
if (repSequence != null && hiddenRepSequences != null
&& hiddenRepSequences.containsKey(repSequence))
{
hiddenRepSequences.remove(repSequence);
- revealedSeqs.addElement(repSequence);
+ revealedSeqs.add(repSequence);
}
int start = adjustForHiddenSeqs(alignmentIndex - 1);
{
if (seq.getLength() > 0)
{
- revealedSeqs.addElement(seq);
+ revealedSeqs.add(seq);
asequences.add(alignmentIndex, seq);
}
else
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.gui.Help.HelpId;
import jalview.io.JalviewFileChooser;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
import java.util.List;
import java.util.Vector;
+import javax.help.HelpSetException;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.Icon;
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());
}
}
});
- table.setToolTipText(JvSwingUtils
- .wrapTooltip(true, MessageManager.getString("label.feature_settings_click_drag")));
+// table.setToolTipText(JvSwingUtils.wrapTooltip(true,
+// MessageManager.getString("label.feature_settings_click_drag")));
scrollPane.setViewportView(table);
dassourceBrowser = new DasSourceBrowser(this);
|| ((Boolean) fr.featureGroups.get(group)).booleanValue())
{
if (group != null)
+ {
checkGroupState(group);
+ }
type = tmpfeatures[index].getType();
if (!visibleChecks.contains(type))
{
if (fr.renderOrder != null)
{
if (!handlingUpdate)
+ {
fr.findAllFeatures(groupChanged != null); // prod to update
+ }
// colourschemes. but don't
// affect display
// First add the checks in the previous render order,
{
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()
public void orderByAvWidth()
{
if (table == null || table.getModel() == null)
+ {
return;
+ }
Object[][] data = ((FeatureTableModel) table.getModel()).getData();
float[] width = new float[data.length];
float[] awidth;
width[i] = 0;
}
if (max < width[i])
+ {
max = width[i];
+ }
}
boolean sort = false;
for (int i = 0; i < width.length; i++)
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();
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
{
sortByDens(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();
+ }
+ }
+ });
cancel.setFont(JvSwingUtils.getLabelFont());
cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
});
transparency.setMaximum(70);
+ transparency.setToolTipText(MessageManager
+ .getString("label.transparency_tip"));
fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
fetchDAS.addActionListener(new ActionListener()
{
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);
import java.net.URL;
+import javax.help.BadIDException;
import javax.help.HelpBroker;
import javax.help.HelpSet;
import javax.help.HelpSetException;
*/
public class Help
{
+ public enum HelpId
+ {
+ Home("home"), SequenceFeatureSettings("seqfeatures.settings");
+
+ private String id;
+
+ private HelpId(String loc)
+ {
+ this.id = loc;
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.id;
+ }
+ }
private static final long HALF_A_MO = 500; // half a second
*
* This is a workaround for issue JAL-914 - both Desktop and AlignFrame
* responding to F1 key, resulting in duplicate help windows opened.
+ * @param id TODO
*
* @throws HelpSetException
*/
- public static void showHelpWindow() throws HelpSetException
+ public static void showHelpWindow(HelpId id) throws HelpSetException
{
long timeNow = System.currentTimeMillis();
HelpSet hs = new HelpSet(cl, url);
HelpBroker hb = hs.createHelpBroker();
- hb.setCurrentID("home");
+ try
+ {
+ hb.setCurrentID(id.toString());
+ } catch (BadIDException bad)
+ {
+ System.out.println("Bad help link: " + id.toString()
+ + ": must match a target in help.jhm");
+ throw bad;
+ }
hb.setDisplayed(true);
}
}
+
+ public static void showHelpWindow() throws HelpSetException
+ {
+ showHelpWindow(HelpId.Home);
+ }
}
@Override
public void actionPerformed(ActionEvent e)
{
- if (chimeraPath.getText().trim().length() > 0)
- {
- File f = new File(chimeraPath.getText());
- if (!f.canExecute())
- {
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.getString("label.invalid_path"),
- MessageManager.getString("label.invalid_name"),
- JOptionPane.ERROR_MESSAGE);
- }
- }
+ validateChimeraPath();
}
});
*/
public void ok_actionPerformed(ActionEvent e)
{
+ if (!validateSettings())
+ {
+ return;
+ }
+
/*
* Save Visual settings
*/
}
/**
+ * Do any necessary validation before saving settings.
+ *
+ * @return
+ */
+ private boolean validateSettings()
+ {
+ if (!validateStructure())
+ {
+ structureTab.requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean validateStructure()
+ {
+ return validateChimeraPath();
+
+ }
+ /**
* DOCUMENT ME!
*/
public void startupFileTextfield_mouseClicked()
userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
}
+ /**
+ * Returns true if chimera path is to a valid executable, else show an error
+ * dialog.
+ */
+ private boolean validateChimeraPath()
+ {
+ if (chimeraPath.getText().trim().length() > 0)
+ {
+ File f = new File(chimeraPath.getText());
+ if (!f.canExecute())
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.invalid_chimera_path"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ }
+ return true;
+ }
+
}
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
protected JCheckBox showNpTooltip = new JCheckBox();
/*
- * Annotations tab components
+ * Structure tab and components
*/
+ protected JPanel structureTab;
+
protected JCheckBox structFromPdb = new JCheckBox();
protected JCheckBox useRnaView = new JCheckBox();
*/
private void jbInit() throws Exception
{
- JTabbedPane tabbedPane = new JTabbedPane();
+ final JTabbedPane tabbedPane = new JTabbedPane();
this.setLayout(new BorderLayout());
JPanel okCancelPanel = initOkCancelPanel();
this.add(tabbedPane, BorderLayout.CENTER);
*/
wsTab.setLayout(new BorderLayout());
tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
+
+ /*
+ * Handler to validate a tab before leaving it - currently only for
+ * Structure.
+ */
+ tabbedPane.addChangeListener(new ChangeListener()
+ {
+ private Component lastTab;
+
+ @Override
+ public void stateChanged(ChangeEvent e)
+ {
+ if (lastTab == structureTab
+ && tabbedPane.getSelectedComponent() != structureTab)
+ {
+ if (!validateStructure())
+ {
+ tabbedPane.setSelectedComponent(structureTab);
+ return;
+ }
+ }
+ lastTab = tabbedPane.getSelectedComponent();
+ }
+
+ });
}
/**
*/
private JPanel initStructureTab()
{
- JPanel structureTab = new JPanel();
+ structureTab = new JPanel();
+
structureTab.setBorder(new TitledBorder(MessageManager
.getString("label.structure_options")));
structureTab.setLayout(null);
chimeraPath.setFont(verdana11);
chimeraPath.setText("");
chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
+ chimeraPath.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ if (e.getClickCount() == 2)
+ {
+ String chosen = openFileChooser();
+ if (chosen != null)
+ {
+ chimeraPath.setText(chosen);
+ }
+ }
+ }
+ });
structureTab.add(chimeraPath);
+ structureTab.addFocusListener(new FocusAdapter()
+ {
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ validateStructure(e);
+ }
+
+ });
return structureTab;
}
/**
+ * Show a dialog for the user to choose a file. Returns the chosen path, or
+ * null on Cancel.
+ *
+ * @return
+ */
+ protected String openFileChooser()
+ {
+ String choice = null;
+ JFileChooser chooser = new JFileChooser();
+
+ // chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(MessageManager
+ .getString("label.open_local_file"));
+ chooser.setToolTipText(MessageManager.getString("action.open"));
+
+ int value = chooser.showOpenDialog(this);
+
+ if (value == JFileChooser.APPROVE_OPTION)
+ {
+ choice = chooser.getSelectedFile().getPath();
+ }
+ return choice;
+ }
+
+ /**
+ * Validate the structure tab preferences; if invalid, set focus on this tab.
+ *
+ * @param e
+ */
+ protected boolean validateStructure(FocusEvent e)
+ {
+ if (!validateStructure())
+ {
+ e.getComponent().requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean validateStructure()
+ {
+ return false;
+ }
+
+ /**
* Initialises the Visual tabbed panel.
*
* @return
*/
package jalview.viewmodel;
-import jalview.analysis.AAFrequency;
import jalview.analysis.Conservation;
import jalview.api.AlignCalcManagerI;
import jalview.api.AlignViewportI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.schemes.Blosum62ColourScheme;
-import jalview.schemes.ClustalxColourScheme;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.ResidueProperties;
AlignmentAnnotation alignmentAnnotation)
{
if (!alignmentAnnotation.autoCalculated)
+ {
return false;
+ }
if (calculator.workingInvolvedWith(alignmentAnnotation))
{
// System.err.println("grey out ("+alignmentAnnotation.label+")");
selectionGroup = new SequenceGroup();
selectionGroup.setEndRes(alignment.getWidth() - 1);
}
- Vector tmp = alignment.getHiddenSequences().showAll(
+ List<SequenceI> tmp = alignment.getHiddenSequences().showAll(
hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
+ for (SequenceI seq : tmp)
{
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ selectionGroup.addSequence(seq, false);
+ setSequenceAnnotationsVisible(seq, true);
}
hasHiddenRows = false;
public void showSequence(int index)
{
- Vector tmp = alignment.getHiddenSequences().showSequence(index,
+ List<SequenceI> tmp = alignment.getHiddenSequences().showSequence(
+ index,
hiddenRepSequences);
if (tmp.size() > 0)
{
selectionGroup.setEndRes(alignment.getWidth() - 1);
}
- for (int t = 0; t < tmp.size(); t++)
+ for (SequenceI seq : tmp)
{
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ selectionGroup.addSequence(seq, false);
+ setSequenceAnnotationsVisible(seq, true);
}
// JBPNote: refactor: only update flag if we modified visiblity (used to
// do this regardless)
for (int i = 0; i < seq.length; i++)
{
alignment.getHiddenSequences().hideSequence(seq[i]);
+ setSequenceAnnotationsVisible(seq[i], false);
}
hasHiddenRows = true;
firePropertyChange("alignment", null, alignment.getSequences());
}
}
+ /**
+ * Set visibility for any annotations for the given sequence.
+ *
+ * @param sequenceI
+ */
+ protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
+ boolean visible)
+ {
+ for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation())
+ {
+ if (ann.sequenceRef == sequenceI)
+ {
+ ann.visible = visible;
+ }
+ }
+ }
+
public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
{
int sSize = sg.getSize();
--- /dev/null
+package jalview.gui;
+
+import static org.junit.Assert.assertTrue;
+import jalview.gui.Help.HelpId;
+
+import java.net.URL;
+
+import javax.help.HelpSet;
+import javax.help.HelpSetException;
+import javax.help.Map;
+
+import org.junit.Test;
+
+public class HelpTest
+{
+ @Test
+ public void checkHelpTargets() throws HelpSetException
+ {
+ ClassLoader cl = Desktop.class.getClassLoader();
+ URL url = HelpSet.findHelpSet(cl, "help/help"); // $NON-NLS-$
+ HelpSet hs = new HelpSet(cl, url);
+ Map targets = hs.getLocalMap();
+
+ for (HelpId id : HelpId.values())
+ {
+ String target = id.toString();
+ assertTrue("Unmatched target enum: " + target,
+ targets.isValidID(target, hs));
+ }
+
+ }
+}