From: jprocter Date: Mon, 21 Apr 2008 17:27:08 +0000 (+0000) Subject: added centre annotation labels menu entry (and commented out SeqSearch web service... X-Git-Tag: Release_2_4~108 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fd29e047719a470cf304c5a41abfff5c1eac3ee8;p=jalview.git added centre annotation labels menu entry (and commented out SeqSearch web service handler builder code) --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 92bd7b6..8d003ef 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -53,6 +53,7 @@ import org.apache.log4j.*; *
  • SHOW_QUALITY show alignment quality annotation *
  • SHOW_ANNOTATIONS show alignment annotation rows *
  • SHOW_CONSERVATION show alignment conservation annotation + *
  • CENTRE_COLUMN_LABELS centre the labels at each column in a displayed annotation row *
  • DEFAULT_COLOUR default colour scheme to apply for a new alignment *
  • DEFAULT_FILE_FORMAT file format used to save *
  • STARTUP_FILE file loaded on startup (may be a fully qualified url) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 6e7b15d..f536382 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -68,6 +68,8 @@ public class AlignFrame */ String fileName = null; + + /** * Creates a new AlignFrame object. @@ -531,6 +533,7 @@ public class AlignFrame conservationMenuItem.setSelected(av.getConservationSelected()); seqLimits.setSelected(av.getShowJVSuffix()); idRightAlign.setSelected(av.rightAlignIds); + centreColumnLabelsMenuItem.setState(av.centreColumnLabels); renderGapsMenuItem.setSelected(av.renderGaps); wrapMenuItem.setSelected(av.wrapAlignment); scaleAbove.setVisible(av.wrapAlignment); @@ -2187,6 +2190,12 @@ public class AlignFrame alignPanel.paintAlignment(true); } + public void centreColumnLabels_actionPerformed(ActionEvent e) + { + viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState(); + alignPanel.paintAlignment(true); + } + /** @@ -3454,6 +3463,7 @@ public class AlignFrame // TODO: refactor to allow list of AbstractName/Handler bindings to be stored or retrieved from elsewhere Vector msaws = (Vector) Discoverer.services.get("MsaWS"); Vector secstrpr = (Vector) Discoverer.services.get("SecStrPred"); + Vector seqsrch = (Vector) Discoverer.services.get("SeqSearch"); // TODO: move GUI generation code onto service implementation - so a client instance attaches itself to the GUI with method call like jalview.ws.MsaWSClient.bind(servicehandle, Desktop.instance, alignframe) Vector wsmenu = new Vector(); final AlignFrame af = this; @@ -3538,6 +3548,80 @@ public class AlignFrame secstrmenu.add(method); } wsmenu.add(secstrmenu); +/* } + if (seqsrch!=null) + { + // Add any secondary structure prediction services + final JMenu seqsrchmenu = new JMenu("Sequence Database Search"); + Hashtable dbsrchs = new Hashtable(); + JMenu defmenu; + dbsrchs.put("", defmenu = new JMenu("Default Database")); + for (int i = 0, j = seqsrch.size(); i < j; i++) + { + final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) + seqsrch.elementAt(i); + + String dbs[] = null; + try { + dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases(); + } catch (Exception e) + { + jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e); + continue; + } + JMenuItem method; + // do default entry + defmenu.add(method = new JMenuItem(sh.getName())); + method.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + // use same input gatherer as for secondary structure prediction + // we could actually parameterise the gatherer method here... + AlignmentView msa = gatherSeqOrMsaForSecStrPrediction(); + new jalview.ws.SeqSearchWSClient(sh, title, msa, null, + viewport.getAlignment().getDataset(), + af); + } + } + ); + // add entry for each database the service supports + for (int db=0; dbs!=null && db 0)) { - int charOffset = (av.charWidth - - fm.charWidth(row.annotations[column]. - displayCharacter.charAt( - 0))) / 2; + int charOffset = (av.getCentreColumnLabels()) ? ((av.charWidth - + fm.charsWidth(row.annotations[column]. + displayCharacter.toCharArray(),0, + row.annotations[column]. + displayCharacter.length())) / 2) + : (av.charWidth - fm.charWidth(row.annotations[column]. + displayCharacter.charAt(0))) / 2; if (row.annotations[column].colour == null) g.setColor(Color.black); diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index b67ee7e..1bc0b72 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -146,6 +146,7 @@ public class GAlignFrame JMenu formatMenu = new JMenu(); JMenu selectMenu = new JMenu(); protected JCheckBoxMenuItem idRightAlign = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem centreColumnLabelsMenuItem = new JCheckBoxMenuItem(); protected JMenuItem gatherViews = new JMenuItem(); protected JMenuItem expandViews = new JMenuItem(); JMenuItem pageSetup = new JMenuItem(); @@ -936,6 +937,17 @@ public class GAlignFrame scaleRight_actionPerformed(e); } }); + centreColumnLabelsMenuItem.setVisible(true); + centreColumnLabelsMenuItem.setState(false); + centreColumnLabelsMenuItem.setText("Centre Column Labels"); + centreColumnLabelsMenuItem.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + centreColumnLabels_actionPerformed(e); + } + }); + modifyPID.setText("Modify Identity Threshold..."); modifyPID.addActionListener(new java.awt.event.ActionListener() { @@ -1414,6 +1426,7 @@ public class GAlignFrame formatMenu.add(viewTextMenuItem); formatMenu.add(colourTextMenuItem); formatMenu.add(renderGapsMenuItem); + formatMenu.add(centreColumnLabelsMenuItem); selectMenu.add(findMenuItem); selectMenu.addSeparator(); selectMenu.add(selectAllSequenceMenuItem); @@ -1423,10 +1436,12 @@ public class GAlignFrame selectMenu.add(deleteGroups); } + protected void centreColumnLabels_actionPerformed(ActionEvent e) + { + } + protected void showProducts_actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - } protected void buildSortByAnnotationScoresMenu()