From: gmungoc Date: Wed, 19 Sep 2018 14:26:17 +0000 (+0100) Subject: Merge branch 'develop' into features/JAL-3010ontologyFeatureSettings X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=19273dc7a1f9695ded523b670362e0cab31958fb;hp=-c;p=jalview.git Merge branch 'develop' into features/JAL-3010ontologyFeatureSettings Conflicts: src/jalview/gui/FeatureSettings.java src/jalview/gui/FeatureTypeSettings.java --- 19273dc7a1f9695ded523b670362e0cab31958fb diff --combined src/jalview/bin/Jalview.java index 2f5da61,3270144..c41f291 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@@ -70,7 -70,14 +70,14 @@@ import groovy.util.GroovyScriptEngine /** * Main class for Jalview Application
*
- * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview + * start with: java -classpath "$PATH_TO_LIB$/*:$PATH_TO_CLASSES$" \ + * jalview.bin.Jalview + * + * or on Windows: java -classpath "$PATH_TO_LIB$/*;$PATH_TO_CLASSES$" \ + * jalview.bin.Jalview jalview.bin.Jalview + * + * (ensure -classpath arg is quoted to avoid shell expansion of '*' and do not + * embellish '*' to e.g. '*.jar') * * @author $author$ * @version $Revision$ @@@ -149,7 -156,6 +156,6 @@@ public class Jalvie af.setProgressBar(MessageManager .getString("status.das_features_being_retrived"), id); af.featureSettings_actionPerformed(null); - af.featureSettings.fetchDasFeatures(dasSources, true); af.setProgressBar(null, id); synchronized (us) { @@@ -265,7 -271,7 +271,7 @@@ { error.printStackTrace(); System.out.println("\nEssential logging libraries not found." - + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview"); + + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview"); System.exit(0); } @@@ -320,7 -326,7 +326,7 @@@ * configure 'full' SO model if preferences say to, * else use the default (SO Lite) */ - if (Cache.getDefault("USE_FULL_SO", false)) + if (Cache.getDefault("USE_FULL_SO", true)) { SequenceOntologyFactory.setInstance(new SequenceOntology()); } diff --combined src/jalview/gui/AlignFrame.java index 82f9018,94b38ed..62f8891 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@@ -5305,6 -5305,10 +5305,10 @@@ public class AlignFrame extends GAlignF { if (avc.createGroup()) { + if (applyAutoAnnotationSettings.isSelected()) + { + alignPanel.updateAnnotation(true, false); + } alignPanel.alignmentChanged(); } } @@@ -5517,23 -5521,22 +5521,23 @@@ } /** - * Hides columns containing (or not containing) a specified feature, provided - * that would not leave all columns hidden + * Hides columns containing (or not containing) the specified feature(s), + * provided that would not leave all columns hidden * - * @param featureType * @param columnsContaining + * @param featureTypes + * * @return */ - public boolean hideFeatureColumns(String featureType, - boolean columnsContaining) + public boolean hideFeatureColumns(boolean columnsContaining, + String... featureTypes) { boolean notForHiding = avc.markColumnsContainingFeatures( - columnsContaining, false, false, featureType); + columnsContaining, false, false, featureTypes); if (notForHiding) { if (avc.markColumnsContainingFeatures(!columnsContaining, false, - false, featureType)) + false, featureTypes)) { getViewport().hideSelectedColumns(); return true; diff --combined src/jalview/gui/FeatureSettings.java index 5f06439,1358c8f..a53d730 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@@ -27,21 -27,16 +27,18 @@@ import jalview.datamodel.SequenceI import jalview.datamodel.features.FeatureMatcherI; import jalview.datamodel.features.FeatureMatcherSet; import jalview.datamodel.features.FeatureMatcherSetI; +import jalview.datamodel.ontology.OntologyI; import jalview.gui.Help.HelpId; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; +import jalview.io.gff.SequenceOntologyFactory; import jalview.schemabinding.version2.Filter; import jalview.schemabinding.version2.JalviewUserColours; import jalview.schemabinding.version2.MatcherSet; import jalview.schemes.FeatureColour; import jalview.util.MessageManager; import jalview.util.Platform; - import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; - import jalview.ws.DasSequenceFeatureFetcher; - import jalview.ws.dbsources.das.api.jalviewSourceI; import java.awt.BorderLayout; import java.awt.Color; @@@ -67,7 -62,6 +64,7 @@@ import java.io.FileOutputStream import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; @@@ -77,7 -71,6 +74,6 @@@ import java.util.Iterator import java.util.List; import java.util.Map; import java.util.Set; - import java.util.Vector; import javax.help.HelpSetException; import javax.swing.AbstractCellEditor; @@@ -98,22 -91,17 +94,21 @@@ import javax.swing.JScrollPane import javax.swing.JSlider; import javax.swing.JTable; import javax.swing.ListSelectionModel; +import javax.swing.RowFilter; 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; import javax.swing.table.TableColumn; +import javax.swing.table.TableRowSorter; public class FeatureSettings extends JPanel implements FeatureSettingsControllerI { + private static final Font VERDANA_12 = new Font("Verdana", Font.PLAIN, 12); + private static final String SEQUENCE_FEATURE_COLOURS = MessageManager .getString("label.sequence_feature_colours"); @@@ -134,12 -122,6 +129,6 @@@ private static final int MIN_HEIGHT = 400; - DasSourceBrowser dassourceBrowser; - - DasSequenceFeatureFetcher dasFeatureFetcher; - - JPanel dasSettingsPane = new JPanel(); - final FeatureRenderer fr; public final AlignFrame af; @@@ -170,12 -152,12 +159,6 @@@ int selectedRow = -1; -- JButton fetchDAS = new JButton(); -- -- JButton saveDAS = new JButton(); -- -- JButton cancelDAS = new JButton(); -- boolean resettingTable = false; /* @@@ -188,17 -170,6 +171,17 @@@ */ Map typeWidth = null; + /* + * if true, 'child' feature types are not displayed + */ + JCheckBox summaryView; + + /* + * those feature types that do not have a parent feature type present + * (as determined by an Ontology relationship) + */ + List topLevelTypes; + /** * Constructor * @@@ -216,8 -187,6 +199,8 @@@ originalFilters = new HashMap<>(fr.getFeatureFilters()); // shallow copy + topLevelTypes = new ArrayList<>(); + try { jbInit(); @@@ -226,73 -195,6 +209,69 @@@ ex.printStackTrace(); } + initTable(); + + scrollPane.setViewportView(table); + - dassourceBrowser = new DasSourceBrowser(this); - dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER); - + if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder()) + { + fr.findAllFeatures(true); // display everything! + } + + discoverAllFeatureData(); + final PropertyChangeListener change; + final FeatureSettings fs = this; + fr.addPropertyChangeListener(change = new PropertyChangeListener() + { + @Override + public void propertyChange(PropertyChangeEvent evt) + { + if (!fs.resettingTable && !fs.handlingUpdate) + { + fs.handlingUpdate = true; + fs.resetTable(null); + // new groups may be added with new sequence feature types only + fs.handlingUpdate = false; + } + } + }); + + frame = new JInternalFrame(); + frame.setContentPane(this); + if (Platform.isAMac()) + { + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 600, 480); + } + else + { + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 600, 450); + } + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); + + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() + { + @Override + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + fr.removePropertyChangeListener(change); - dassourceBrowser.fs = null; + }; + }); + frame.setLayer(JLayeredPane.PALETTE_LAYER); + inConstruction = false; + } + + /** + * Constructs and configures the JTable which displays columns of data for + * each feature type + */ + protected void initTable() + { table = new JTable() { @Override @@@ -303,13 -205,7 +282,13 @@@ switch (column) { case TYPE_COLUMN: - tip = JvSwingUtils.wrapTooltip(true, MessageManager + /* + * drag to reorder not enabled in Summary View + */ + tip = summaryView.isSelected() + ? MessageManager.getString( + "label.feature_settings_select_columns") + : JvSwingUtils.wrapTooltip(true, MessageManager .getString("label.feature_settings_click_drag")); break; case FILTER_COLUMN: @@@ -326,9 -222,12 +305,9 @@@ return tip; } }; - table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12)); - table.setFont(new Font("Verdana", Font.PLAIN, 12)); + table.getTableHeader().setFont(VERDANA_12); + table.setFont(VERDANA_12); - // table.setDefaultRenderer(Color.class, new ColorRenderer()); - // table.setDefaultEditor(Color.class, new ColorEditor(this)); - // table.setDefaultEditor(FeatureColour.class, new ColorEditor(this)); table.setDefaultRenderer(FeatureColour.class, new ColorRenderer()); @@@ -355,16 -254,16 +334,16 @@@ if (evt.isPopupTrigger()) { Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN); - popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(), - evt.getY()); + popupMenu(selectedRow, type, colour, evt.getX(), evt.getY()); } else if (evt.getClickCount() == 2) { boolean invertSelection = evt.isAltDown(); boolean toggleSelection = Platform.isControlDown(evt); boolean extendSelection = evt.isShiftDown(); + String[] terms = getTermsInScope(type); fr.ap.alignFrame.avc.markColumnsContainingFeatures( - invertSelection, extendSelection, toggleSelection, type); + invertSelection, extendSelection, toggleSelection, terms); } } @@@ -377,7 -276,8 +356,7 @@@ { String type = (String) table.getValueAt(selectedRow, TYPE_COLUMN); Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN); - popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(), - evt.getY()); + popupMenu(selectedRow, type, colour, evt.getX(), evt.getY()); } } }); @@@ -388,44 -288,89 +367,44 @@@ public void mouseDragged(MouseEvent evt) { int newRow = table.rowAtPoint(evt.getPoint()); - if (newRow != selectedRow && selectedRow != -1 && newRow != -1) - { - /* - * reposition 'selectedRow' to 'newRow' (the dragged to location) - * this could be more than one row away for a very fast drag action - * so just swap it with adjacent rows until we get it there - */ - Object[][] data = ((FeatureTableModel) table.getModel()) - .getData(); - int direction = newRow < selectedRow ? -1 : 1; - for (int i = selectedRow; i != newRow; i += direction) - { - Object[] temp = data[i]; - data[i] = data[i + direction]; - data[i + direction] = temp; - } - updateFeatureRenderer(data); - table.repaint(); - selectedRow = newRow; - } + dragRow(newRow); } }); - // table.setToolTipText(JvSwingUtils.wrapTooltip(true, - // MessageManager.getString("label.feature_settings_click_drag"))); - scrollPane.setViewportView(table); + } - if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder()) + /** + * Answers an array consisting of the given type, and also (if 'Summary View' + * is selected), any child terms in the sequence ontology + * + * @param type + * @return + */ + protected String[] getTermsInScope(String type) + { + if (!summaryView.isSelected()) { - fr.findAllFeatures(true); // display everything! + return new String[] { type }; } - discoverAllFeatureData(); - final PropertyChangeListener change; - final FeatureSettings fs = this; - fr.addPropertyChangeListener(change = new PropertyChangeListener() - { - @Override - public void propertyChange(PropertyChangeEvent evt) - { - if (!fs.resettingTable && !fs.handlingUpdate) - { - fs.handlingUpdate = true; - fs.resetTable(null); - // new groups may be added with new sequence feature types only - fs.handlingUpdate = false; - } - } + List terms = new ArrayList<>(); + terms.add(type); - }); + OntologyI so = SequenceOntologyFactory.getInstance(); - frame = new JInternalFrame(); - frame.setContentPane(this); - if (Platform.isAMac()) - { - Desktop.addInternalFrame(frame, - MessageManager.getString("label.sequence_feature_settings"), - 600, 480); - } - else + Object[][] data = ((FeatureTableModel) table.getModel()).getData(); + for (Object[] row : data) { - Desktop.addInternalFrame(frame, - MessageManager.getString("label.sequence_feature_settings"), - 600, 450); + String type2 = (String) row[TYPE_COLUMN]; + if (!type2.equals(type) && so.isA(type2, type)) + { + terms.add(type2); + } } - frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); - - frame.addInternalFrameListener( - new javax.swing.event.InternalFrameAdapter() - { - @Override - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) - { - fr.removePropertyChangeListener(change); - }; - }); - frame.setLayer(JLayeredPane.PALETTE_LAYER); - inConstruction = false; + return terms.toArray(new String[terms.size()]); } - protected void popupSort(final int rowSelected, final String type, - final Object typeCol, final Map minmax, int x, - int y) + protected void popupMenu(final int rowSelected, final String type, + final Object typeCol, int x, int y) { final FeatureColourI featureColour = (FeatureColourI) typeCol; @@@ -438,23 -383,29 +417,23 @@@ final FeatureSettings me = this; scr.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - me.af.avc - .sortAlignmentByFeatureScore(Arrays.asList(new String[] - { type })); + String[] types = getTermsInScope(type); + me.af.avc.sortAlignmentByFeatureScore(Arrays.asList(types)); } - }); JMenuItem dens = new JMenuItem( MessageManager.getString("label.sort_by_density")); dens.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - me.af.avc - .sortAlignmentByFeatureDensity(Arrays.asList(new String[] - { type })); + String[] types = getTermsInScope(type); + me.af.avc.sortAlignmentByFeatureDensity(Arrays.asList(types)); } - }); men.add(dens); @@@ -518,6 -469,7 +497,6 @@@ } } } - }); JMenuItem selCols = new JMenuItem( @@@ -527,9 -479,8 +506,9 @@@ @Override public void actionPerformed(ActionEvent arg0) { + String[] types = getTermsInScope(type); fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false, - false, type); + false, types); } }); JMenuItem clearCols = new JMenuItem(MessageManager @@@ -539,9 -490,8 +518,9 @@@ @Override public void actionPerformed(ActionEvent arg0) { + String[] types = getTermsInScope(type); fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false, - false, type); + false, types); } }); JMenuItem hideCols = new JMenuItem( @@@ -551,8 -501,7 +530,8 @@@ @Override public void actionPerformed(ActionEvent arg0) { - fr.ap.alignFrame.hideFeatureColumns(type, true); + String[] types = getTermsInScope(type); + fr.ap.alignFrame.hideFeatureColumns(true, types); } }); JMenuItem hideOtherCols = new JMenuItem( @@@ -562,8 -511,7 +541,8 @@@ @Override public void actionPerformed(ActionEvent arg0) { - fr.ap.alignFrame.hideFeatureColumns(type, false); + String[] types = getTermsInScope(type); + fr.ap.alignFrame.hideFeatureColumns(false, types); } }); men.add(selCols); @@@ -678,7 -626,6 +657,7 @@@ */ Set types = seq.getFeatures().getFeatureTypesForGroups(true, visibleGroups.toArray(new String[visibleGroups.size()])); + for (String type : types) { displayableTypes.add(type); @@@ -697,13 -644,6 +676,13 @@@ } } + /* + * enable 'Summary View' if some types are sub-types of others + */ + Set parents = SequenceOntologyFactory.getInstance() + .getParentTerms(displayableTypes); + summaryView.setEnabled(parents.size() < displayableTypes.size()); + Object[][] data = new Object[displayableTypes.size()][COLUMN_COUNT]; int dataIndex = 0; @@@ -726,6 -666,7 +705,6 @@@ { continue; } - data[dataIndex][TYPE_COLUMN] = type; data[dataIndex][COLOUR_COLUMN] = fr.getFeatureStyle(type); FeatureMatcherSetI featureFilter = fr.getFeatureFilter(type); @@@ -777,43 -718,7 +756,43 @@@ updateOriginalData(data); } - table.setModel(new FeatureTableModel(data)); + /* + * recreate the table model + */ + FeatureTableModel dataModel = new FeatureTableModel(data); + table.setModel(dataModel); + + /* + * we want to be able to filter out rows for sub-types, but not to sort + * rows, so have to add a RowFilter to a disabled TableRowSorter (!) + */ + final TableRowSorter sorter = new TableRowSorter<>( + dataModel); + for (int i = 0; i < table.getColumnCount(); i++) + { + sorter.setSortable(i, false); + } + + /* + * filter rows to only top-level Ontology types if requested + */ + sorter.setRowFilter(new RowFilter() + { + @Override + public boolean include( + Entry entry) + { + if (!summaryView.isSelected()) + { + return true; + } + int row = entry.getIdentifier(); // this is model, not view, row number + String featureType = (String) entry.getModel().getData()[row][TYPE_COLUMN]; + return parents.contains(featureType); + } + }); + table.setRowSorter(sorter); + table.getColumnModel().getColumn(0).setPreferredWidth(200); groupPanel.setLayout( @@@ -1238,8 -1143,6 +1217,6 @@@ JPanel settingsPane = new JPanel(); settingsPane.setLayout(new BorderLayout()); - dasSettingsPane.setLayout(new BorderLayout()); - JPanel bigPanel = new JPanel(); bigPanel.setLayout(new BorderLayout()); @@@ -1391,58 -1294,12 +1368,26 @@@ } }); + summaryView = new JCheckBox( + MessageManager.getString("label.summary_view")); + summaryView + .setToolTipText( + MessageManager.getString("label.summary_view_tip")); + summaryView.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + resetTable(null); + } + }); + transparency.setMaximum(70); transparency.setToolTipText( MessageManager.getString("label.transparency_tip")); - fetchDAS.setText(MessageManager.getString("label.fetch_das_features")); - fetchDAS.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - fetchDAS_actionPerformed(e); - } - }); - saveDAS.setText(MessageManager.getString("action.save_as_default")); - saveDAS.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - saveDAS_actionPerformed(e); - } - }); - - JPanel dasButtonPanel = new JPanel(); - dasButtonPanel.setBorder(BorderFactory.createEtchedBorder()); - dasSettingsPane.setBorder(null); - cancelDAS.setEnabled(false); - cancelDAS.setText(MessageManager.getString("action.cancel_fetch")); - cancelDAS.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - cancelDAS_actionPerformed(e); - } - }); - JPanel transPanel = new JPanel(new GridLayout(1, 2)); - bigPanel.add(transPanel, BorderLayout.SOUTH); + JPanel lowerPanel = new JPanel(new GridLayout(1, 2)); + bigPanel.add(lowerPanel, BorderLayout.SOUTH); JPanel transbuttons = new JPanel(new GridLayout(5, 1)); transbuttons.add(optimizeOrder); @@@ -1450,12 -1307,8 +1395,12 @@@ transbuttons.add(sortByScore); transbuttons.add(sortByDens); transbuttons.add(help); + JPanel transPanel = new JPanel(new GridLayout(3, 1)); + transPanel.add(summaryView); + transPanel.add(new JLabel(" Colour transparency" + ":")); transPanel.add(transparency); - transPanel.add(transbuttons); + lowerPanel.add(transPanel); + lowerPanel.add(transbuttons); JPanel buttonPanel = new JPanel(); buttonPanel.add(ok); @@@ -1463,225 -1316,11 +1408,64 @@@ buttonPanel.add(loadColours); buttonPanel.add(saveColours); bigPanel.add(scrollPane, BorderLayout.CENTER); - dasSettingsPane.add(dasButtonPanel, BorderLayout.SOUTH); - dasButtonPanel.add(fetchDAS); - dasButtonPanel.add(cancelDAS); - dasButtonPanel.add(saveDAS); settingsPane.add(bigPanel, BorderLayout.CENTER); settingsPane.add(buttonPanel, BorderLayout.SOUTH); this.add(settingsPane); } - public void fetchDAS_actionPerformed(ActionEvent e) - { - fetchDAS.setEnabled(false); - cancelDAS.setEnabled(true); - dassourceBrowser.setGuiEnabled(false); - Vector selectedSources = dassourceBrowser - .getSelectedSources(); - doDasFeatureFetch(selectedSources, true, true); - } - - /** - * get the features from selectedSources for all or the current selection - * - * @param selectedSources - * @param checkDbRefs - * @param promptFetchDbRefs - */ - private void doDasFeatureFetch(List selectedSources, - boolean checkDbRefs, boolean promptFetchDbRefs) - { - SequenceI[] dataset, seqs; - int iSize; - AlignmentViewport vp = af.getViewport(); - if (vp.getSelectionGroup() != null - && vp.getSelectionGroup().getSize() > 0) - { - iSize = vp.getSelectionGroup().getSize(); - dataset = new SequenceI[iSize]; - seqs = vp.getSelectionGroup().getSequencesInOrder(vp.getAlignment()); - } - else - { - iSize = vp.getAlignment().getHeight(); - seqs = vp.getAlignment().getSequencesArray(); - } - - dataset = new SequenceI[iSize]; - for (int i = 0; i < iSize; i++) - { - dataset[i] = seqs[i].getDatasetSequence(); - } - - cancelDAS.setEnabled(true); - dasFeatureFetcher = new jalview.ws.DasSequenceFeatureFetcher(dataset, - this, selectedSources, checkDbRefs, promptFetchDbRefs); - af.getViewport().setShowSequenceFeatures(true); - af.showSeqFeatures.setSelected(true); - } - - /** - * blocking call to initialise the das source browser - */ - public void initDasSources() - { - dassourceBrowser.initDasSources(); - } - - /** - * examine the current list of das sources and return any matching the given - * nicknames in sources - * - * @param sources - * Vector of Strings to resolve to DAS source nicknames. - * @return sources that are present in source list. - */ - public List resolveSourceNicknames(Vector sources) - { - return dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources); - } - - /** - * get currently selected das sources. ensure you have called initDasSources - * before calling this. - * - * @return vector of selected das source nicknames - */ - public Vector getSelectedSources() - { - return dassourceBrowser.getSelectedSources(); - } - - /** - * properly initialise DAS fetcher and then initiate a new thread to fetch - * features from the named sources (rather than any turned on by default) - * - * @param sources - * @param block - * if true then runs in same thread, otherwise passes to the Swing - * executor - */ - public void fetchDasFeatures(Vector sources, boolean block) - { - initDasSources(); - List resolved = dassourceBrowser.sourceRegistry - .resolveSourceNicknames(sources); - if (resolved.size() == 0) - { - resolved = dassourceBrowser.getSelectedSources(); - } - if (resolved.size() > 0) - { - final List dassources = resolved; - fetchDAS.setEnabled(false); - // cancelDAS.setEnabled(true); doDasFetch does this. - Runnable fetcher = new Runnable() - { - - @Override - public void run() - { - doDasFeatureFetch(dassources, true, false); - - } - }; - if (block) - { - fetcher.run(); - } - else - { - SwingUtilities.invokeLater(fetcher); - } - } - } - - public void saveDAS_actionPerformed(ActionEvent e) - { - dassourceBrowser - .saveProperties(jalview.bin.Cache.applicationProperties); - } - - public void complete() - { - fetchDAS.setEnabled(true); - cancelDAS.setEnabled(false); - dassourceBrowser.setGuiEnabled(true); - - } - - public void cancelDAS_actionPerformed(ActionEvent e) - { - if (dasFeatureFetcher != null) - { - dasFeatureFetcher.cancel(); - } - complete(); - } - - public void noDasSourceActive() - { - complete(); - JvOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.getString("label.no_das_sources_selected_warn"), - MessageManager.getString("label.no_das_sources_selected_title"), - JvOptionPane.DEFAULT_OPTION, JvOptionPane.INFORMATION_MESSAGE); - } - + /** + * Reorders features by 'dragging' selectedRow to 'newRow' + * + * @param newRow + */ + protected void dragRow(int newRow) + { + if (summaryView.isSelected()) + { + // no drag while in summary view + return; + } + + if (newRow != selectedRow && selectedRow != -1 && newRow != -1) + { + /* + * reposition 'selectedRow' to 'newRow' (the dragged to location) + * this could be more than one row away for a very fast drag action + * so just swap it with adjacent rows until we get it there + */ + Object[][] data = ((FeatureTableModel) table.getModel()) + .getData(); + int direction = newRow < selectedRow ? -1 : 1; + for (int i = selectedRow; i != newRow; i += direction) + { + Object[] temp = data[i]; + data[i] = data[i + direction]; + data[i + direction] = temp; + } + updateFeatureRenderer(data); + table.repaint(); + selectedRow = newRow; + } + } + + protected void refreshTable() + { + Object[][] data = ((FeatureTableModel) table.getModel()).getData(); + for (Object[] row : data) + { + String type = (String) row[TYPE_COLUMN]; + FeatureColourI colour = fr.getFeatureColours().get(type); + FeatureMatcherSetI filter = fr.getFeatureFilter(type); + if (filter == null) + { + filter = new FeatureMatcherSet(); + } + row[COLOUR_COLUMN] = colour; + row[FILTER_COLUMN] = filter; + } + repaint(); + } + // /////////////////////////////////////////////////////////////////////// // http://java.sun.com/docs/books/tutorial/uiswing/components/table.html // /////////////////////////////////////////////////////////////////////// @@@ -1749,58 -1388,20 +1533,57 @@@ return v == null ? null : v.getClass(); } + /** + * Answers true for all columns except Feature Type + */ @Override public boolean isCellEditable(int row, int col) { - return col == 0 ? false : true; + return col != TYPE_COLUMN; } + /** + * Sets the value in the model for a given row and column. If Visibility + * (Show/Hide) is being set, and the table is in Summary View, then it is + * set also on any sub-types of the row's feature type. + */ @Override public void setValueAt(Object value, int row, int col) { data[row][col] = value; fireTableCellUpdated(row, col); + if (summaryView.isSelected() && col == SHOW_COLUMN) + { + setSubtypesVisibility(row, (Boolean) value); + } updateFeatureRenderer(data); } + /** + * Sets the visibility of any feature types which are sub-types of the type + * in the given row of the table + * + * @param row + * @param value + */ + protected void setSubtypesVisibility(int row, Boolean value) + { + String type = (String) data[row][TYPE_COLUMN]; + OntologyI so = SequenceOntologyFactory.getInstance(); + + for (int r = 0; r < data.length; r++) + { + if (r != row) + { + String type2 = (String) data[r][TYPE_COLUMN]; + if (so.isA(type2, type)) + { + data[r][SHOW_COLUMN] = value; + fireTableCellUpdated(r, SHOW_COLUMN); + } + } + } + } - } class ColorRenderer extends JLabel implements TableCellRenderer @@@ -2013,7 -1614,7 +1796,7 @@@ String type; - JButton button; + JButton colourButton; JColorChooser colorChooser; @@@ -2030,13 -1631,13 +1813,13 @@@ // which is a button. // This button brings up the color chooser dialog, // which is the editor from the user's point of view. - button = new JButton(); - button.setActionCommand(EDIT); - button.addActionListener(this); - button.setBorderPainted(false); + colourButton = new JButton(); + colourButton.setActionCommand(EDIT); + colourButton.addActionListener(this); + colourButton.setBorderPainted(false); // Set up the dialog that the button brings up. colorChooser = new JColorChooser(); - dialog = JColorChooser.createDialog(button, + dialog = JColorChooser.createDialog(colourButton, MessageManager.getString("label.select_colour"), true, // modal colorChooser, this, // OK button handler null); // no CANCEL button handler @@@ -2056,7 -1657,7 +1839,7 @@@ if (currentColor.isSimpleColour()) { // bring up simple color chooser - button.setBackground(currentColor.getColour()); + colourButton.setBackground(currentColor.getColour()); colorChooser.setColor(currentColor.getColour()); dialog.setVisible(true); } @@@ -2064,13 -1665,17 +1847,12 @@@ { // bring up graduated chooser. chooser = new FeatureTypeSettings(me.fr, type); - /** - * @j2sNative - */ - { - chooser.setRequestFocusEnabled(true); - chooser.requestFocus(); - } + chooser.setRequestFocusEnabled(true); + chooser.requestFocus(); chooser.addActionListener(this); - chooser.showTab(true); + // Make the renderer reappear. + fireEditingStopped(); } - // Make the renderer reappear. - fireEditingStopped(); } else { @@@ -2089,7 -1694,16 +1871,7 @@@ * (or filters!) are already set in FeatureRenderer, so just * update table data without triggering updateFeatureRenderer */ - currentColor = fr.getFeatureColours().get(type); - FeatureMatcherSetI currentFilter = me.fr.getFeatureFilter(type); - if (currentFilter == null) - { - currentFilter = new FeatureMatcherSet(); - } - Object[] data = ((FeatureTableModel) table.getModel()) - .getData()[rowSelected]; - data[COLOUR_COLUMN] = currentColor; - data[FILTER_COLUMN] = currentFilter; + refreshTable(); } fireEditingStopped(); me.table.validate(); @@@ -2111,24 -1725,24 +1893,24 @@@ currentColor = (FeatureColourI) value; this.rowSelected = row; type = me.table.getValueAt(row, TYPE_COLUMN).toString(); - button.setOpaque(true); - button.setBackground(me.getBackground()); + colourButton.setOpaque(true); + colourButton.setBackground(me.getBackground()); if (!currentColor.isSimpleColour()) { JLabel btn = new JLabel(); - btn.setSize(button.getSize()); + btn.setSize(colourButton.getSize()); FeatureSettings.renderGraduatedColor(btn, currentColor); - button.setBackground(btn.getBackground()); - button.setIcon(btn.getIcon()); - button.setText(btn.getText()); + colourButton.setBackground(btn.getBackground()); + colourButton.setIcon(btn.getIcon()); + colourButton.setText(btn.getText()); } else { - button.setText(""); - button.setIcon(null); - button.setBackground(currentColor.getColour()); + colourButton.setText(""); + colourButton.setIcon(null); + colourButton.setBackground(currentColor.getColour()); } - return button; + return colourButton; } } @@@ -2149,7 -1763,7 +1931,7 @@@ String type; - JButton button; + JButton filterButton; protected static final String EDIT = "edit"; @@@ -2158,10 -1772,10 +1940,10 @@@ public FilterEditor(FeatureSettings me) { this.me = me; - button = new JButton(); - button.setActionCommand(EDIT); - button.addActionListener(this); - button.setBorderPainted(false); + filterButton = new JButton(); + filterButton.setActionCommand(EDIT); + filterButton.addActionListener(this); + filterButton.setBorderPainted(false); } /** @@@ -2170,7 -1784,7 +1952,7 @@@ @Override public void actionPerformed(ActionEvent e) { - if (button == e.getSource()) + if (filterButton == e.getSource()) { FeatureTypeSettings chooser = new FeatureTypeSettings(me.fr, type); chooser.addActionListener(this); @@@ -2183,17 -1797,26 +1965,16 @@@ chooser.getWidth(), chooser.getHeight()); chooser.validate(); } - chooser.showTab(false); fireEditingStopped(); } else if (e.getSource() instanceof Component) { - /* * after OK in variable colour dialog, any changes to filter * (or colours!) are already set in FeatureRenderer, so just * update table data without triggering updateFeatureRenderer */ - FeatureColourI currentColor = fr.getFeatureColours().get(type); - currentFilter = me.fr.getFeatureFilter(type); - if (currentFilter == null) - { - currentFilter = new FeatureMatcherSet(); - } - Object[] data = ((FeatureTableModel) table.getModel()) - .getData()[rowSelected]; - data[COLOUR_COLUMN] = currentColor; - data[FILTER_COLUMN] = currentFilter; + refreshTable(); fireEditingStopped(); me.table.validate(); } @@@ -2212,20 -1835,18 +1993,20 @@@ currentFilter = (FeatureMatcherSetI) value; this.rowSelected = row; type = me.table.getValueAt(row, TYPE_COLUMN).toString(); - button.setOpaque(true); - button.setBackground(me.getBackground()); - button.setText(currentFilter.toString()); - button.setToolTipText(currentFilter.toString()); - button.setIcon(null); - return button; + filterButton.setOpaque(true); + filterButton.setBackground(me.getBackground()); + filterButton.setText(currentFilter.toString()); + filterButton.setToolTipText(currentFilter.toString()); + filterButton.setIcon(null); + return filterButton; } } } class FeatureIcon implements Icon { + private static final Font VERDANA_9 = new Font("Verdana", Font.PLAIN, 9); + FeatureColourI gcol; Color backg; @@@ -2280,7 -1901,7 +2061,7 @@@ // need an icon here. g.setColor(gcol.getMaxColour()); - g.setFont(new Font("Verdana", Font.PLAIN, 9)); + g.setFont(VERDANA_9); // g.setFont(g.getFont().deriveFont( // AffineTransform.getScaleInstance( diff --combined src/jalview/gui/FeatureTypeSettings.java index c71d878,c572798..7aef644 --- a/src/jalview/gui/FeatureTypeSettings.java +++ b/src/jalview/gui/FeatureTypeSettings.java @@@ -29,7 -29,6 +29,7 @@@ import jalview.datamodel.features.Featu import jalview.datamodel.features.FeatureMatcherI; import jalview.datamodel.features.FeatureMatcherSet; import jalview.datamodel.features.FeatureMatcherSetI; +import jalview.io.gff.SequenceOntologyFactory; import jalview.schemes.FeatureColour; import jalview.util.ColorUtils; import jalview.util.MessageManager; @@@ -50,11 -49,7 +50,11 @@@ import java.awt.event.MouseAdapter import java.awt.event.MouseEvent; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@@ -67,7 -62,6 +67,6 @@@ import javax.swing.JLabel import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JSlider; - import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.LineBorder; @@@ -112,7 -106,8 +111,8 @@@ public class FeatureTypeSettings extend /* * FeatureRenderer holds colour scheme and filters for feature types */ - private final FeatureRenderer fr; // todo refactor to allow interface type here + private final FeatureRenderer fr; // todo refactor to allow interface type + // here /* * the view panel to update when settings change @@@ -123,11 -118,10 +123,11 @@@ /* * the colour and filters to reset to on Cancel + * (including feature sub-types if modified) */ - private final FeatureColourI originalColour; + private Map originalColours; - private final FeatureMatcherSetI originalFilter; + private Map originalFilters; /* * set flag to true when setting values programmatically, @@@ -161,7 -155,12 +161,12 @@@ private JRadioButton graduatedColour = new JRadioButton(); - private JPanel singleColour = new JPanel(); + /** + * colours and filters are shown in tabbed view or single content pane + */ + JPanel coloursPanel, filtersPanel; + + JPanel singleColour = new JPanel(); private JPanel minColour = new JPanel(); @@@ -205,27 -204,8 +210,22 @@@ */ private List filters; - // set white normally, black to debug layout - private Color debugBorderColour = Color.white; - private JPanel chooseFiltersPanel; - private JTabbedPane tabbedPane; - + /* + * feature types present in Feature Renderer which are + * sub-types of the one this editor is acting on + */ + private final List subTypes; + + /* + * if true, filter or colour settings are also applied to + * any feature sub-types in the Sequence Ontology + */ + private boolean applyFiltersToSubtypes; + + private boolean applyColourToSubtypes; + /** * Constructor * @@@ -251,28 -231,8 +251,28 @@@ this.fr = frender; this.featureType = theType; ap = fr.ap; - originalFilter = fr.getFeatureFilter(theType); - originalColour = fr.getFeatureColours().get(theType); + + /* + * determine sub-types (if any) of this feature type + */ + List types = fr.getRenderOrder(); + subTypes = SequenceOntologyFactory.getInstance() + .getChildTerms(this.featureType, types); + Collections.sort(subTypes); // sort for ease of reading in tooltip + + /* + * save original colours and filters for this feature type + * and any sub-types, to restore on Cancel + */ + originalFilters = new HashMap<>(); + originalFilters.put(theType, fr.getFeatureFilter(theType)); + originalColours = new HashMap<>(); + originalColours.put(theType, fr.getFeatureColours().get(theType)); + for (String child : subTypes) + { + originalFilters.put(child, fr.getFeatureFilter(child)); + originalColours.put(child, fr.getFeatureColours().get(child)); + } adjusting = true; @@@ -296,7 -256,7 +296,7 @@@ String title = MessageManager .formatMessage("label.display_settings_for", new String[] { theType }); - initDialogFrame(this, true, blocking, title, 600, 360); + initDialogFrame(this, true, blocking, title, 500, 500); waitForInput(); } @@@ -443,8 -403,6 +443,6 @@@ private void initialise() { this.setLayout(new BorderLayout()); - tabbedPane = new JTabbedPane(); - this.add(tabbedPane, BorderLayout.CENTER); /* * an ActionListener that applies colour changes @@@ -459,18 -417,16 +457,16 @@@ }; /* - * first tab: colour options + * first panel/tab: colour options */ JPanel coloursPanel = initialiseColoursPanel(); - tabbedPane.addTab(MessageManager.getString("action.colour"), - coloursPanel); + this.add(coloursPanel, BorderLayout.NORTH); /* - * second tab: filter options + * second panel/tab: filter options */ JPanel filtersPanel = initialiseFiltersPanel(); - tabbedPane.addTab(MessageManager.getString("label.filters"), - filtersPanel); + this.add(filtersPanel, BorderLayout.CENTER); JPanel okCancelPanel = initialiseOkCancelPanel(); @@@ -776,24 -732,18 +772,27 @@@ private JPanel initialiseColoursPanel() { JPanel colourByPanel = new JPanel(); + colourByPanel.setBackground(Color.white); colourByPanel.setLayout(new BoxLayout(colourByPanel, BoxLayout.Y_AXIS)); + JvSwingUtils.createTitledBorder(colourByPanel, + MessageManager.getString("action.colour"), true); /* + * option to apply colour to sub-types as well (if there are any) + */ + if (!subTypes.isEmpty()) + { + applyColourToSubtypes = false; + colourByPanel.add(initSubtypesPanel(false)); + } + + /* * simple colour radio button and colour picker */ JPanel simpleColourPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); simpleColourPanel.setBackground(Color.white); - JvSwingUtils.createTitledBorder(simpleColourPanel, - MessageManager.getString("label.simple"), true); + // JvSwingUtils.createTitledBorder(simpleColourPanel, + // MessageManager.getString("label.simple"), true); colourByPanel.add(simpleColourPanel); simpleColour = new JRadioButton( @@@ -811,7 -761,7 +810,7 @@@ } }); - + singleColour.setFont(JvSwingUtils.getLabelFont()); singleColour.setBorder(BorderFactory.createLineBorder(Color.black)); singleColour.setPreferredSize(new Dimension(40, 20)); @@@ -884,46 -834,6 +883,46 @@@ return colourByPanel; } + /** + * Constructs and returns a panel with a checkbox for the option to apply any + * changes also to sub-types of the feature type + * + * @return + */ + protected JPanel initSubtypesPanel(final boolean forFilters) + { + JPanel toSubtypes = new JPanel(new FlowLayout(FlowLayout.LEFT)); + toSubtypes.setBackground(Color.WHITE); + JCheckBox applyToSubtypesCB = new JCheckBox(MessageManager + .formatMessage("label.apply_to_subtypes", featureType)); + applyToSubtypesCB.setToolTipText(getSubtypesTooltip()); + applyToSubtypesCB.addActionListener(new ActionListener() + { + /* + * reset and reapply settings on toggle of checkbox + */ + @Override + public void actionPerformed(ActionEvent e) + { + if (forFilters) + { + applyFiltersToSubtypes = applyToSubtypesCB.isSelected(); + restoreOriginalFilters(); + filtersChanged(); + } + else + { + applyColourToSubtypes = applyToSubtypesCB.isSelected(); + restoreOriginalColours(); + colourChanged(true); + } + } + }); + toSubtypes.add(applyToSubtypesCB); + + return toSubtypes; + } + private void showColourChooser(JPanel colourPanel, String key) { Color col = JColorChooser.showDialog(this, @@@ -938,9 -848,9 +937,9 @@@ } /** - * Constructs and sets the selected colour options as the colour for the feature - * type, and repaints the alignment, and optionally the Overview and/or - * structure viewer if open + * Constructs and sets the selected colour options as the colour for the + * feature type, and repaints the alignment, and optionally the Overview + * and/or structure viewer if open * * @param updateStructsAndOverview */ @@@ -963,17 -873,9 +962,17 @@@ FeatureColourI acg = makeColourFromInputs(); /* - * save the colour, and repaint stuff + * save the colour, and set on subtypes if selected */ fr.setColour(featureType, acg); + if (applyColourToSubtypes) + { + for (String child : subTypes) + { + fr.setColour(child, acg); + } + } + refreshFeatureSettings(); ap.paintAlignment(updateStructsAndOverview, updateStructsAndOverview); updateColoursTab(); @@@ -1091,14 -993,9 +1090,14 @@@ @Override protected void raiseClosed() { + refreshFeatureSettings(); + } + + protected void refreshFeatureSettings() + { if (this.featureSettings != null) { - featureSettings.actionPerformed(new ActionEvent(this, 0, "CLOSED")); + featureSettings.actionPerformed(new ActionEvent(this, 0, "REFRESH")); } } @@@ -1113,34 -1010,16 +1112,34 @@@ /** * Action on Cancel is to restore colour scheme and filters as they were when - * the dialog was opened + * the dialog was opened (including any feature sub-types that may have been + * changed) */ @Override public void cancelPressed() { - fr.setColour(featureType, originalColour); - fr.setFeatureFilter(featureType, originalFilter); + restoreOriginalColours(); + restoreOriginalFilters(); ap.paintAlignment(true, true); } + protected void restoreOriginalFilters() + { + for (Entry entry : originalFilters + .entrySet()) + { + fr.setFeatureFilter(entry.getKey(), entry.getValue()); + } + } + + protected void restoreOriginalColours() + { + for (Entry entry : originalColours.entrySet()) + { + fr.setColour(entry.getKey(), entry.getValue()); + } + } + /** * Action on text entry of a threshold value */ @@@ -1185,8 -1064,8 +1184,8 @@@ /** * Converts the slider value to its absolute value by dividing by the - * scaleFactor. Rounding errors are squashed by forcing min/max of slider range - * to the actual min/max of feature score range + * scaleFactor. Rounding errors are squashed by forcing min/max of slider + * range to the actual min/max of feature score range * * @return */ @@@ -1209,11 -1088,11 +1208,11 @@@ } /** - * A helper method to build the drop-down choice of attributes for a feature. If - * 'withRange' is true, then Score, and any attributes with a min-max range, are - * added. If 'withText' is true, Label and any known attributes are added. This - * allows 'categorical numerical' attributes e.g. codon position to be coloured - * by text. + * A helper method to build the drop-down choice of attributes for a feature. + * If 'withRange' is true, then Score, and any attributes with a min-max + * range, are added. If 'withText' is true, Label and any known attributes are + * added. This allows 'categorical numerical' attributes e.g. codon position + * to be coloured by text. *

* Where metadata is available with a description for an attribute, that is * added as a tooltip. @@@ -1279,25 -1158,11 +1278,25 @@@ { filters = new ArrayList<>(); + JPanel outerPanel = new JPanel(); + outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS)); + outerPanel.setBackground(Color.white); + + /* + * option to apply colour to sub-types as well (if there are any) + */ + if (!subTypes.isEmpty()) + { + applyFiltersToSubtypes = false; + outerPanel.add(initSubtypesPanel(true)); + } + JPanel filtersPanel = new JPanel(); filtersPanel.setLayout(new BoxLayout(filtersPanel, BoxLayout.Y_AXIS)); filtersPanel.setBackground(Color.white); JvSwingUtils.createTitledBorder(filtersPanel, MessageManager.getString("label.filters"), true); + outerPanel.add(filtersPanel); JPanel andOrPanel = initialiseAndOrPanel(); filtersPanel.add(andOrPanel); @@@ -1310,7 -1175,7 +1309,7 @@@ chooseFiltersPanel.setBackground(Color.white); filtersPanel.add(chooseFiltersPanel); - return filtersPanel; + return outerPanel; } /** @@@ -1320,12 -1185,8 +1319,15 @@@ */ private JPanel initialiseAndOrPanel() { - JPanel andOrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel andOrPanel = new JPanel(new BorderLayout()); andOrPanel.setBackground(Color.white); - JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - andOrPanel.add(panel1, BorderLayout.WEST); - panel1.setBackground(Color.white); - panel1.setBorder(BorderFactory.createLineBorder(debugBorderColour)); ++//<<<<<<< HEAD ++// JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); ++// andOrPanel.add(panel1, BorderLayout.WEST); ++// panel1.setBackground(Color.white); ++// panel1.setBorder(BorderFactory.createLineBorder(debugBorderColour)); ++//======= ++//>>>>>>> refs/heads/develop andFilters = new JRadioButton(MessageManager.getString("label.and")); orFilters = new JRadioButton(MessageManager.getString("label.or")); ActionListener actionListener = new ActionListener() @@@ -1342,33 -1203,14 +1344,33 @@@ andOr.add(andFilters); andOr.add(orFilters); andFilters.setSelected(true); - panel1.add( + andOrPanel.add( new JLabel(MessageManager.getString("label.join_conditions"))); - panel1.add(andFilters); - panel1.add(orFilters); + andOrPanel.add(andFilters); + andOrPanel.add(orFilters); + return andOrPanel; } /** + * Builds a tooltip for the 'Apply to subtypes' checkbox with a list of + * subtypes of this feature type + * + * @return + */ + protected String getSubtypesTooltip() + { + StringBuilder sb = new StringBuilder(20 * subTypes.size()); + sb.append(MessageManager.getString("label.apply_also_to")); + for (String child : subTypes) + { + sb.append("
").append(child); + } + String tooltip = JvSwingUtils.wrapTooltip(true, sb.toString()); + return tooltip; + } + + /** * Refreshes the display to show any filters currently configured for the * selected feature type (editable, with 'remove' option), plus one extra row * for adding a condition. This should be called after a filter has been @@@ -1427,7 -1269,6 +1429,6 @@@ for (FeatureMatcherI filter : filters) { JPanel row = addFilter(filter, attNames, filterIndex); - row.setBorder(BorderFactory.createLineBorder(debugBorderColour)); chooseFiltersPanel.add(row); filterIndex++; } @@@ -1439,7 -1280,8 +1440,8 @@@ /** * A helper method that constructs a row (panel) with one filter condition: *

    - *
  • a drop-down list of Label, Score and attribute names to choose from
  • + *
  • a drop-down list of Label, Score and attribute names to choose + * from
  • *
  • a drop-down list of conditions to choose from
  • *
  • a text field for input of a match pattern
  • *
  • optionally, a 'remove' button
  • @@@ -1637,8 -1479,8 +1639,8 @@@ * @param selectedCondition * @param patternField */ - private void setNumericHints(String attName, - Condition selectedCondition, JTextField patternField) + private void setNumericHints(String attName, Condition selectedCondition, + JTextField patternField) { patternField.setToolTipText(""); @@@ -1672,11 -1514,11 +1674,11 @@@ } /** - * Populates the drop-down list of comparison conditions for the given attribute - * name. The conditions added depend on the datatype of the attribute values. - * The supplied condition is set as the selected item in the list, provided it - * is in the list. If the pattern is now invalid (non-numeric pattern for a - * numeric condition), it is cleared. + * Populates the drop-down list of comparison conditions for the given + * attribute name. The conditions added depend on the datatype of the + * attribute values. The supplied condition is set as the selected item in the + * list, provided it is in the list. If the pattern is now invalid + * (non-numeric pattern for a numeric condition), it is cleared. * * @param attName * @param cond @@@ -1755,12 -1597,12 +1757,12 @@@ } /** - * Answers true unless a numeric condition has been selected with a non-numeric - * value. Sets the value field to RED with a tooltip if in error. + * Answers true unless a numeric condition has been selected with a + * non-numeric value. Sets the value field to RED with a tooltip if in error. *

    - * If the pattern is expected but is empty, this method returns false, but does - * not mark the field as invalid. This supports selecting an attribute for a new - * condition before a match pattern has been entered. + * If the pattern is expected but is empty, this method returns false, but + * does not mark the field as invalid. This supports selecting an attribute + * for a new condition before a match pattern has been entered. * * @param value * @param condCombo @@@ -1806,14 -1648,15 +1808,15 @@@ /** * Constructs a filter condition from the given input fields, and replaces the - * condition at filterIndex with the new one. Does nothing if the pattern field - * is blank (unless the match condition is one that doesn't require a pattern, - * e.g. 'Is present'). Answers true if the filter was updated, else false. + * condition at filterIndex with the new one. Does nothing if the pattern + * field is blank (unless the match condition is one that doesn't require a + * pattern, e.g. 'Is present'). Answers true if the filter was updated, else + * false. *

    * This method may update the tooltip on the filter value field to show the - * value range, if a numeric condition is selected. This ensures the tooltip is - * updated when a numeric valued attribute is chosen on the last 'add a filter' - * row. + * value range, if a numeric condition is selected. This ensures the tooltip + * is updated when a numeric valued attribute is chosen on the last 'add a + * filter' row. * * @param attCombo * @param condCombo @@@ -1861,17 -1704,6 +1864,6 @@@ } /** - * Makes the dialog visible, at the Feature Colour tab or at the Filters tab - * - * @param coloursTab - */ - public void showTab(boolean coloursTab) - { - setVisible(true); - tabbedPane.setSelectedIndex(coloursTab ? 0 : 1); - } - - /** * Action on any change to feature filtering, namely *

      *
    • change of selected attribute
    • @@@ -1879,8 -1711,8 +1871,8 @@@ *
    • change of match pattern
    • *
    • removal of a condition
    • *
    - * The inputs are parsed into a combined filter and this is set for the feature - * type, and the alignment redrawn. + * The inputs are parsed into a combined filter and this is set for the + * feature type, and the alignment redrawn. */ protected void filtersChanged() { @@@ -1912,15 -1744,6 +1904,15 @@@ * (note this might now be an empty filter with no conditions) */ fr.setFeatureFilter(featureType, combined.isEmpty() ? null : combined); + if (applyFiltersToSubtypes) + { + for (String child : subTypes) + { + fr.setFeatureFilter(child, combined.isEmpty() ? null : combined); + } + } + + refreshFeatureSettings(); ap.paintAlignment(true, true); updateFiltersTab(); diff --combined src/jalview/gui/SequenceFetcher.java index 53ce80c,8754fbb..0982dcc --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@@ -34,7 -34,6 +34,6 @@@ import jalview.io.gff.SequenceOntologyI import jalview.util.DBRefUtils; import jalview.util.MessageManager; import jalview.util.Platform; - import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@@ -111,10 -110,6 +110,6 @@@ public class SequenceFetcher extends JP private static jalview.ws.SequenceFetcher sfetch = null; - private static long lastDasSourceRegistry = -3; - - private static DasSourceRegistryI dasRegistry = null; - private static boolean _initingFetcher = false; private static Thread initingThread = null; @@@ -165,11 -160,7 +160,7 @@@ Thread.currentThread().hashCode()); } } - if (sfetch == null || dasRegistry != Cache.getDasSourceRegistry() - || lastDasSourceRegistry != (Cache.getDasSourceRegistry() - .getDasRegistryURL() - + Cache.getDasSourceRegistry().getLocalSourceString()) - .hashCode()) + if (sfetch == null) { _initingFetcher = true; initingThread = Thread.currentThread(); @@@ -183,16 -174,12 +174,12 @@@ "status.init_sequence_database_fetchers"), Thread.currentThread().hashCode()); } - dasRegistry = Cache.getDasSourceRegistry(); - dasRegistry.refreshSources(); jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher(); if (guiWindow != null) { guiWindow.setProgressBar(null, Thread.currentThread().hashCode()); } - lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() - + dasRegistry.getLocalSourceString()).hashCode(); sfetch = sf; _initingFetcher = false; initingThread = null; @@@ -564,15 -551,10 +551,10 @@@ dbeg.setText(MessageManager.formatMessage("label.example_query_param", new String[] { eq })); + // TODO this should be a property of the SequenceFetcher whether commas are and + // colons are allowed in the IDs... + boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); - for (DbSourceProxy dbs : database.getSelectedSources()) - { - if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) - { - enablePunct = false; - break; - } - } replacePunctuation.setEnabled(enablePunct); } catch (Exception ex) @@@ -1047,7 -1029,7 +1029,7 @@@ } if (Cache.getDefault("HIDE_INTRONS", true)) { - af.hideFeatureColumns(SequenceOntologyI.EXON, false); + af.hideFeatureColumns(false, SequenceOntologyI.EXON); } if (newAlframes != null) {