Newer
Older
/* EntryEdit.java
*
* created: Fri Oct 9 1998
*
* This file is part of Artemis
*
* Copyright(C) 1998,1999,2000,2001 Genome Research Limited
*
* This program 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 2
* of the License, or(at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/EntryEdit.java,v 1.82 2009-09-24 12:42:16 tjc Exp $
*/
package uk.ac.sanger.artemis.components;
import uk.ac.sanger.artemis.*;
import uk.ac.sanger.artemis.chado.ChadoTransactionManager;
import uk.ac.sanger.artemis.components.alignment.BamView;
import uk.ac.sanger.artemis.components.alignment.FileSelectionDialog;
import uk.ac.sanger.artemis.components.variant.VCFview;
import uk.ac.sanger.artemis.editor.BigPane;
import uk.ac.sanger.artemis.editor.FastaTextPane;
import uk.ac.sanger.artemis.editor.HitInfo;
import uk.ac.sanger.artemis.sequence.SequenceChangeEvent;
import uk.ac.sanger.artemis.sequence.SequenceChangeListener;
import uk.ac.sanger.artemis.util.OutOfRangeException;
import uk.ac.sanger.artemis.util.ReadOnlyException;
import uk.ac.sanger.artemis.util.DatabaseDocument;
import uk.ac.sanger.artemis.util.Document;
import uk.ac.sanger.artemis.io.DatabaseInferredFeature;
import uk.ac.sanger.artemis.io.DocumentEntryFactory;
import uk.ac.sanger.artemis.io.EntryInformationException;
import uk.ac.sanger.artemis.io.GenbankTblOutputStream;
import uk.ac.sanger.artemis.io.IndexFastaStream;
import uk.ac.sanger.artemis.io.InvalidRelationException;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import com.sshtools.j2ssh.sftp.FileAttributes;
import java.util.Arrays;
/**
* Each object of this class is used to edit an EntryGroup object.
*
* @author Kim Rutherford
* @version $Id: EntryEdit.java,v 1.82 2009-09-24 12:42:16 tjc Exp $
/** */
private static final long serialVersionUID = 1L;
/** The shortcut for Delete Selected Features. */
final static KeyStroke SAVE_DEFAULT_KEY =
KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); // InputEvent.CTRL_MASK);
/**
* A vector containing the Entry objects that this
* EntryEdit object knows about.
**/
private EntryGroup entry_group;
/**
* Created by the constructor to pass to those objects
* that are interested in GotoEvents.
**/
private GotoEventSource goto_event_source;
private final JMenuBar menu_bar = new JMenuBar();
private final JMenu file_menu = new JMenu("File");
private EntryGroupDisplay group_display;
private FeatureDisplay one_line_per_entry_display;
private FeatureDisplay feature_display;
private FeatureDisplay base_display;
private BasePlotGroup base_plot_group;
private FeatureList feature_list;
/** This Object contains the current selection. */
private Selection selection = null;
/** Alignment panel */
private VCFview vcfView;
/**
* The EntrySourceVector reference that is created in the constructor.
**/
private EntrySourceVector entry_sources;
private ChadoTransactionManager ctm = new ChadoTransactionManager();
private static org.apache.log4j.Logger logger4j =
org.apache.log4j.Logger.getLogger(EntryEdit.class);
/**
* Create a new EntryEdit object and JFrame.
* @param entry_group The EntryGroup object that this component is editing.
*/
public EntryEdit(final EntryGroup entry_group)
{
super("Artemis Entry Edit");
entry_group.ref();
this.entry_group = entry_group;
// XXX add a InputStreamProgressListener
this.entry_sources = Utilities.getEntrySources(this, null);
this.goto_event_source = new SimpleGotoEventSource(getEntryGroup());
selection = new Selection(null);
getEntryGroup().addFeatureChangeListener(selection);
getEntryGroup().addEntryChangeListener(selection);
getEntryGroup().addEntryGroupChangeListener(this);
getEntryGroup().addEntryChangeListener(this);
final Box box_panel = Box.createVerticalBox();
final Box xBox = Box.createHorizontalBox();
group_display = new EntryGroupDisplay(this);
xBox.add(group_display);
box_panel.add(xBox);
if(getEntryGroup().getDefaultEntry() != null)
{
final String name = getEntryGroup().getDefaultEntry().getName();
if(name != null)
setTitle("Artemis Entry Edit: " + name);
if(getEntryGroup().getDefaultEntry().getEMBLEntry() instanceof DatabaseDocumentEntry)
getEntryGroup().addFeatureChangeListener(ctm);
getEntryGroup().addEntryChangeListener(ctm);
getEntryGroup().getBases().addSequenceChangeListener(ctm, 0);
ctm.setEntryGroup(getEntryGroup());
if(!getEntryGroup().getDefaultEntry().getEMBLEntry().isReadOnly())
{
commitButton = new CommitButton();
getEntryGroup().addFeatureChangeListener(commitButton);
getEntryGroup().addEntryChangeListener(commitButton);
getEntryGroup().getBases().addSequenceChangeListener(commitButton, 0);
xBox.add(commitButton);
}
if(DatabaseDocument.CHADO_INFER_CDS)
DatabaseInferredFeature.addListenersToEntryGroup(getEntryGroup());
//final int font_height;
//final int font_base_line;
font_base_line = fm.getMaxAscent();
}
else
{
font_height = -1;
font_base_line = -1;
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
closeEntryEdit();
}
});
getContentPane().setLayout(new BorderLayout());
getContentPane().add(box_panel, "North");
menu_bar.setFont(default_font);
new SelectionInfoDisplay(getEntryGroup(), getSelection());
box_panel.add(selection_info);
final boolean entry_buttons_option =
Options.getOptions().getPropertyTruthValue("show_entry_buttons");
group_display.setVisible(entry_buttons_option);
final JPanel mainPanel = new JPanel(new BorderLayout());
// set minimum size - this is then the smallest the split
// pane divider can make this panel
mainPanel.setMinimumSize(new Dimension(100,100));
final Box main_box_panel = Box.createVerticalBox();
mainPanel.add(main_box_panel, BorderLayout.NORTH);
base_plot_group =
new BasePlotGroup(getEntryGroup(), this, getSelection(),
getGotoEventSource());
bamPanel = new JPanel();
vcfPanel = new JPanel();
ngSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
bamPanel, vcfPanel);
ngSplitPane.setBorder(null);
Dimension minimumSize = new Dimension(0, 0);
bamPanel.setMinimumSize(minimumSize);
vcfPanel.setMinimumSize(minimumSize);
lowerSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
setNGDivider();
final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
splitPane.setDividerSize(0);
splitPane.setResizeWeight(0.);
// lookseq read alignment
LookSeqPanel lookseqPanel = null;
JScrollPane jspLookSeq = null;
if(Options.getOptions().getProperty("lookseq") != null)
{
lookseqPanel = new LookSeqPanel();
jspLookSeq = new JScrollPane(lookseqPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jspLookSeq.setPreferredSize(new Dimension(jspLookSeq.getPreferredSize().width, 200));
jspLookSeq.setVisible(false);
main_box_panel.add(jspLookSeq);
}
one_line_per_entry_display =
new FeatureDisplay(getEntryGroup(), getSelection(),
getGotoEventSource(), base_plot_group);
// read alignment panel
one_line_per_entry_display.setShowLabels(false);
one_line_per_entry_display.setOneLinePerEntry(true);
// one line per entry expander button
final JButton one_line_display_button = new JButton(">>");
final Box one_line_button_box_across = setExpanderButton(one_line_display_button);
one_line_display_button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
if(one_line_per_entry_display.isVisible())
one_line_display_button.setText(">>");
else
one_line_display_button.setText("<<");
one_line_per_entry_display.setVisible(!one_line_per_entry_display.isVisible());
validate();
}
});
main_box_panel.add(one_line_button_box_across);
main_box_panel.add(one_line_per_entry_display);
feature_display =
new FeatureDisplay(getEntryGroup(), getSelection(),
getGotoEventSource(), base_plot_group);
final Options options = Options.getOptions();
if(options.getProperty("overview_feature_labels") != null)
{
final boolean option_value =
options.getPropertyTruthValue("overview_feature_labels");
feature_display.setShowLabels(option_value);
}
if(options.getProperty("overview_one_line_per_entry") != null)
{
final boolean option_value =
options.getPropertyTruthValue("overview_one_line_per_entry");
feature_display.setOneLinePerEntry(option_value);
}
feature_display.addDisplayAdjustmentListener(base_plot_group);
feature_display.addDisplayAdjustmentListener(one_line_per_entry_display);
one_line_per_entry_display.addDisplayAdjustmentListener(feature_display);
// feature display expander button
final JButton feature_display_button = new JButton("<<");
final Box feature_display_button_box_across = setExpanderButton(feature_display_button);
feature_display_button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
if(feature_display.isVisible())
feature_display_button.setText(">>");
else
feature_display_button.setText("<<");
feature_display.setVisible(!feature_display.isVisible());
}
});
main_box_panel.add(feature_display_button_box_across);
main_box_panel.add(feature_display);
base_display =
new FeatureDisplay(getEntryGroup(), getSelection(),
getGotoEventSource(), base_plot_group);
base_display.setShowLabels(false);
base_display.setScaleFactor(0);
// base display expander button
final JButton base_display_button = new JButton("<<");
final Box base_display_button_box_across = setExpanderButton(base_display_button);
base_display_button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
if(base_display.isVisible())
base_display_button.setText(">>");
else
base_display_button.setText("<<");
base_display.setVisible(!base_display.isVisible());
}
});
main_box_panel.add(base_display_button_box_across);
main_box_panel.add(base_display);
final boolean show_base_view;
if(Options.getOptions().getProperty("show_base_view") != null)
show_base_view =
Options.getOptions().getPropertyTruthValue("show_base_view");
else
show_base_view = true;
if(!show_base_view)
base_display_button.setText(">>");
feature_list =
new FeatureList(getEntryGroup(), getSelection(),
getGotoEventSource(), base_plot_group);
jsp_feature_list = new JScrollPane(feature_list);
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
final Box box_across = setExpanderButton(scroll_button);
scroll_button.addActionListener(new ActionListener()
{
private int hgt = 0;
public void actionPerformed(ActionEvent event)
{
Dimension dim = getSize();
if(jsp_feature_list.isVisible())
{
Dimension dim_box = box_across.getPreferredSize();
jsp_feature_list.setVisible(false);
box_across.setPreferredSize(new Dimension(dim.width, dim_box.height));
scroll_button.setText(">>");
hgt = jsp_feature_list.getSize().height;
}
else
{
if(hgt == 0)
hgt = getEntryGroup().getAllFeaturesCount() *
feature_list.getLineHeight();
jsp_feature_list.setPreferredSize(new Dimension(dim.width,hgt));
jsp_feature_list.setVisible(true);
scroll_button.setText("<<");
}
pack();
}
});
if(Options.getOptions().getPropertyTruthValue("show_list"))
{
scroll_button.setText("<<");
mainPanel.add(jsp_feature_list, "Center");
getContentPane().add(splitPane, BorderLayout.CENTER);
pack();
ClassLoader cl = this.getClass().getClassLoader();
ImageIcon icon = new ImageIcon(cl.getResource("images/icon.gif"));
if(icon != null)
{
//oolkit toolkit = Toolkit.getDefaultToolkit();
final Image icon_image = icon.getImage();
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(icon_image, 0);
try
{
tracker.waitForAll();
setIconImage(icon_image);
}
catch(InterruptedException e)
{
// ignore and continue
}
}
final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int screen_height = screen.height;
int screen_width = screen.width;
final int hgt = getEntryGroup().getAllFeaturesCount() *
feature_list.getLineHeight();
feature_list.setPreferredSize(new Dimension(getSize().width*4,hgt));
jsp_feature_list.getVerticalScrollBar().setUnitIncrement(feature_list.getLineHeight());
if(System.getProperty("bam") != null)
{
SwingWorker worker = new SwingWorker()
{
public Object construct()
{
EntryEdit.this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
String ngs[] = System.getProperty("bam").split("[\\s,]");
FileSelectionDialog fileChooser = new FileSelectionDialog(ngs);
List<String> listBams = fileChooser.getFiles(".*\\.bam$");
List<String> vcfFiles = fileChooser.getFiles(VCFview.VCFFILE_SUFFIX);
loadBamAndVcf(listBams, vcfFiles);
EntryEdit.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
return null;
}
};
worker.start();
private Box setExpanderButton(final JButton butt)
{
butt.setMargin(new Insets(0,1,0,1));
butt.setPreferredSize(new Dimension( butt.getPreferredSize().width,9));
butt.setBorderPainted(false);
butt.setFont(new Font("SansSerif", Font.BOLD, 9));
final Box box_across = Box.createHorizontalBox();
box_across.add(butt);
box_across.add(Box.createHorizontalGlue());
return box_across;
}
public void resetScrolls()
{
base_display.setFirstBase(1);
base_display.fixScrollbar();
feature_display.setFirstBase(1);
feature_display.fixScrollbar();
one_line_per_entry_display.setFirstBase(1);
one_line_per_entry_display.fixScrollbar();
}
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
/**
*
* Retrieve the feature list object.
*
*/
protected FeatureList getFeatureList()
{
return feature_list;
}
/**
*
* Retrieve the base display object.
*
*/
protected FeatureDisplay getBaseDisplay()
{
return base_display;
}
/**
*
* Retrieve the one line per entry object.
*
*/
protected FeatureDisplay getOneLinePerEntryDisplay()
{
return one_line_per_entry_display;
}
/**
*
* Retrieve the base plot display object.
*
*/
protected BasePlotGroup getBasePlotGroup()
{
return base_plot_group;
}
}
protected JPanel getJamView()
{
protected JPanel getVcfPanel()
{
return vcfPanel;
}
protected JPanel getVcfView()
{
return vcfView;
}
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
/**
*
* Retrieve the entry group display object.
*
*/
protected EntryGroupDisplay getEntryGroupDisplay()
{
return group_display;
}
/**
*
* Retrieve the selection info display object.
*
*/
protected SelectionInfoDisplay getSelectionInfoDisplay()
{
return selection_info;
}
/**
*
* Retrieve the feature display object.
*
*/
protected FeatureDisplay getFeatureDisplay()
{
return feature_display;
}
/**
* If there are no unsaved changes, close this EntryEdit. Otherwise ask
* the user first.
**/
private void closeEntryEdit()
{
if(getEntryGroup().hasUnsavedChanges() &&
getEntryGroup().refCount() == 1)
{
final YesNoDialog yes_no_dialog =
new YesNoDialog(EntryEdit.this,
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
if(!yes_no_dialog.getResult())
return;
}
entryEditFinished();
}
/**
* This method sends an GotoEvent to all the GotoEvent listeners that will
* make the start of the first selected Feature or FeatureSegment visible.
**/
public void makeSelectionVisible()
{
final Marker first_base = getSelection().getStartBaseOfSelection();
final GotoEvent new_event = new GotoEvent(this, first_base);
getGotoEventSource().sendGotoEvent(new_event);
}
/**
* Return an object that implements the GotoEventSource interface, and is
* the controlling object for Goto events associated with this object.
**/
public GotoEventSource getGotoEventSource()
{
return goto_event_source;
}
/**
* Return the EntryGroup object that was passed to the constructor.
**/
public EntryGroup getEntryGroup()
{
return entry_group;
}
/**
* Returns a Selection object containing the selected features/exons.
**/
public Selection getSelection()
{
return selection;
}
/**
* Implementation of the EntryGroupChangeListener interface. We listen to
* EntryGroupChange events so that we can update the File menu when the
* EntryGroup changes.
**/
public void entryGroupChanged(final EntryGroupChangeEvent event)
{
switch(event.getType())
{
case EntryGroupChangeEvent.ENTRY_ADDED:
case EntryGroupChangeEvent.ENTRY_DELETED:
makeFileMenu();
break;
}
}
/**
* Implementation of the EntryChangeListener interface. We listen to
* EntryChange events so that we can update the File menu when an Entry
* changes.
**/
public void entryChanged(final EntryChangeEvent event)
{
if(event.getType() == EntryChangeEvent.NAME_CHANGED)
makeFileMenu();
}
/* private members: */
/**
* This method arranges for the EntryEdit JFrame to go away. This EntryEdit
* object was created by the main program, so the main program must be the
* one to delete us.
**/
private void entryEditFinished()
{
setVisible(false);
// chado transaction manager
getEntryGroup().removeFeatureChangeListener(ctm);
getEntryGroup().removeEntryChangeListener(ctm);
getEntryGroup().removeEntryChangeListener(commitButton);
getEntryGroup().removeFeatureChangeListener(selection);
getEntryGroup().removeEntryChangeListener(selection);
getEntryGroup().removeEntryGroupChangeListener(this);
getEntryGroup().removeEntryChangeListener(this);
getEntryGroup().unref();
//getEntryGroup().getBases().getSequence().clear();
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
}
/**
* Write the default Entry in the EntryGroup to the file it came from.
**/
private void saveDefaultEntry()
{
if(getEntryGroup().getDefaultEntry() == null)
new MessageDialog(EntryEdit.this, "There is no default entry");
else
saveEntry(entry_group.getDefaultEntry(), true, false, true,
DocumentEntryFactory.ANY_FORMAT);
}
/**
* Save the given entry, prompting for a file name if necessary.
* @param include_diana_extensions If true then any diana additions to
* the embl file format will be included in the output, otherwise they
* will be removed. Also possible problems that would cause an entry to
* bounce from the EMBL submission process will be flagged if this is
* true.
* @param ask_for_name If true then always prompt for a new filename,
* otherwise prompt only when the entry name is not set.
* @param keep_new_name If ask_for_name is true a file will be written with
* the new name the user selects - if keep_new_name is true as well, then
* the entry will have it's name set to the new name, otherwise it will
* be used for this save and then discarded.
* @param destination_type Should be one of EMBL_FORMAT, GENBANK_FORMAT or
* ANY_FORMAT. If ANY_FORMAT then the Entry will be saved in the
* same format it was created, otherwise it will be saved in the given
* format.
**/
void saveEntry(final Entry entry,
final boolean include_diana_extensions,
final boolean ask_for_name, final boolean keep_new_name,
final int destination_type)
saveEntry(entry, include_diana_extensions,
ask_for_name, keep_new_name,
destination_type, true);
}
void saveEntry(final Entry entry,
final boolean include_diana_extensions,
final boolean ask_for_name, final boolean keep_new_name,
final int destination_type, final boolean useSwingWorker)
{
if(!include_diana_extensions)
{
if(displaySaveWarnings(entry))
return;
}
if(destination_type != DocumentEntryFactory.ANY_FORMAT &&
entry.getHeaderText() != null)
{
final YesNoDialog yes_no_dialog =
new YesNoDialog(this, "header section will be lost. continue?");
if(!yes_no_dialog.getResult())
return;
}
// if(!System.getProperty("os.arch").equals("alpha"))
// {
if(entry.getEMBLEntry().getSequence() instanceof IndexFastaStream)
{
JOptionPane.showMessageDialog(null,
entry.getName()+" is an indexed sequence.\n"+
"This cannot be written out.",
"Write Option Not Available",
JOptionPane.WARNING_MESSAGE);
return;
}
if(useSwingWorker)
{
SwingWorker worker = new SwingWorker()
{
public Object construct()
{
final EntryFileDialog file_dialog = new EntryFileDialog(
EntryEdit.this, false);
file_dialog.saveEntry(entry, include_diana_extensions, ask_for_name,
keep_new_name, destination_type);
return null;
}
};
worker.start();
}
else
{
final EntryFileDialog file_dialog = new EntryFileDialog(this,
false);
file_dialog.saveEntry(entry, include_diana_extensions, ask_for_name,
keep_new_name, destination_type);
// }
// else
// alphaBug(entry, include_diana_extensions, ask_for_name,
// keep_new_name, destination_type);
/* private boolean isHeaderEMBL(String header)
{
StringReader reader = new StringReader(header);
BufferedReader buff_reader = new BufferedReader(reader);
try
{
if(!buff_reader.readLine().startsWith("ID"))
return false;
}
catch(IOException ioe){}
return true;
/**
* Save the changes to all the Entry objects in the entry_group back to
* where the they came from.
**/
public void saveAllEntries()
{
SwingWorker worker = new SwingWorker()
{
public Object construct()
{
final int entry_group_size = entry_group.size();
for(int entry_index = 0; entry_index < entry_group_size;
++entry_index)
saveEntry(entry_group.elementAt(entry_index), true, false, true,
DocumentEntryFactory.ANY_FORMAT, false);
return null;
}
};
worker.start();
}
/**
* Check the given Entry for invalid EMBL features(such as CDS features
* without a stop codon) then display a FeatureListFrame list the problem
* features.
* @return true if and only if the save should be aborted.
**/
private boolean displaySaveWarnings(final Entry entry)
{
final FeatureVector invalid_starts = entry.checkFeatureStartCodons();
final FeatureVector invalid_stops = entry.checkFeatureStopCodons();
final FeatureVector invalid_keys = entry.checkForNonEMBLKeys();
final FeatureVector duplicate_features = entry.checkForEMBLDuplicates();
final FeatureVector overlapping_cds_features =
entry.checkForOverlappingCDSs();
final FeatureVector missing_qualifier_features =
entry.checkForMissingQualifiers();
// this predicate will filter out those features that aren't in the
// entry we are trying to save
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
public boolean testPredicate(final Feature feature)
{
if(feature.getEntry() == entry)
return true;
else
return false;
}
};
String entry_name = entry.getName();
if(entry_name == null)
entry_name = "no name";
final FilteredEntryGroup filtered_entry_group =
new FilteredEntryGroup(getEntryGroup(), predicate,
"features from " + entry_name);
if(invalid_starts.size() + invalid_stops.size() +
invalid_keys.size() + duplicate_features.size() +
overlapping_cds_features.size() > 0)
{
final YesNoDialog yes_no_dialog =
new YesNoDialog(this,
"warning: some features may have problems. " +
"continue with save?");
if(!yes_no_dialog.getResult())
{
getSelection().clear();
if(invalid_starts.size() > 0)
{
getSelection().add(invalid_starts);
ViewMenu.showBadStartCodons(this,
getSelection(),
filtered_entry_group,
getGotoEventSource(),
base_plot_group);
}
if(invalid_stops.size() > 0)
{
getSelection().add(invalid_stops);
ViewMenu.showBadStopCodons(this, getSelection(),
filtered_entry_group,
getGotoEventSource(),
base_plot_group);
}
if(invalid_keys.size() > 0)
{
getSelection().add(invalid_keys);
ViewMenu.showNonEMBLKeys(this, getSelection(),
filtered_entry_group,
getGotoEventSource(),
base_plot_group);
}
if(duplicate_features.size() > 0)
{
getSelection().add(duplicate_features);
ViewMenu.showDuplicatedFeatures(this, getSelection(),
filtered_entry_group,
getGotoEventSource(),
base_plot_group);
}
if(overlapping_cds_features.size() > 0)
{
getSelection().add(overlapping_cds_features);
ViewMenu.showOverlappingCDSs(this, getSelection(),
filtered_entry_group,
getGotoEventSource(),
base_plot_group);
}
if(missing_qualifier_features.size() > 0)
{
getSelection().add(missing_qualifier_features);
ViewMenu.showMissingQualifierFeatures(this, getSelection(),
filtered_entry_group,
getGotoEventSource(),
base_plot_group);
}
return true;
}
}