X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=374f0eab3d8b5625289414d1786f0bb81afa7d4d;hb=76b6b31c53b099a3034e0622ec78d4c2b455a309;hp=fdb19d59b47f40eb262db50cf9a79852409be71b;hpb=5874ca652d08909c74d422552eb03a996112316d;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index fdb19d5..374f0ea 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -48,6 +48,7 @@ public class Desktop extends jalview.jbgui.GDesktop public static Object [] jalviewClipboard; + static int fileLoadingCount= 0; /** * Creates a new Desktop object. @@ -80,7 +81,8 @@ public class Desktop extends jalview.jbgui.GDesktop setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); desktop = new JDesktopPane(); desktop.setBackground(Color.white); - setContentPane(desktop); + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(desktop, BorderLayout.CENTER); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); // This line prevents Windows Look&Feel resizing all new windows to maximum @@ -341,7 +343,7 @@ public class Desktop extends jalview.jbgui.GDesktop * * @param e DOCUMENT ME! */ - public void inputLocalFileMenuItem_actionPerformed(jalview.datamodel.AlignmentI alignment) + public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport) { JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty( "LAST_DIRECTORY"), @@ -377,8 +379,8 @@ public class Desktop extends jalview.jbgui.GDesktop format = new IdentifyFile().Identify(choice, FormatAdapter.FILE); } - if (alignment != null) - new FileLoader().LoadFile(alignment, choice, FormatAdapter.FILE, format); + if (viewport != null) + new FileLoader().LoadFile(viewport, choice, FormatAdapter.FILE, format); else new FileLoader().LoadFile(choice, FormatAdapter.FILE, format); } @@ -391,15 +393,16 @@ public class Desktop extends jalview.jbgui.GDesktop * * @param e DOCUMENT ME! */ - public void inputURLMenuItem_actionPerformed(jalview.datamodel.AlignmentI alignment) + public void inputURLMenuItem_actionPerformed(AlignViewport viewport) { // This construct allows us to have a wider textfield // for viewing JLabel label = new JLabel("Enter URL of Input File"); final JComboBox history = new JComboBox(); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(label, BorderLayout.NORTH); - panel.add(history, BorderLayout.CENTER); + + JPanel panel = new JPanel(new GridLayout(2,1)); + panel.add(label); + panel.add(history); history.setPreferredSize(new Dimension(400,20)); history.setEditable(true); history.addItem("http://www."); @@ -432,8 +435,8 @@ public class Desktop extends jalview.jbgui.GDesktop if (url.toLowerCase().endsWith(".jar")) { - if (alignment != null) - new FileLoader().LoadFile(alignment, url, FormatAdapter.URL, "Jalview"); + if (viewport != null) + new FileLoader().LoadFile(viewport, url, FormatAdapter.URL, "Jalview"); else new FileLoader().LoadFile(url, FormatAdapter.URL, "Jalview"); } @@ -451,8 +454,8 @@ public class Desktop extends jalview.jbgui.GDesktop return; } - if (alignment != null) - new FileLoader().LoadFile(alignment, url, FormatAdapter.URL, format); + if (viewport != null) + new FileLoader().LoadFile(viewport, url, FormatAdapter.URL, format); else new FileLoader().LoadFile(url, FormatAdapter.URL, format); } @@ -463,10 +466,10 @@ public class Desktop extends jalview.jbgui.GDesktop * * @param e DOCUMENT ME! */ - public void inputTextboxMenuItem_actionPerformed(jalview.datamodel.AlignmentI alignment) + public void inputTextboxMenuItem_actionPerformed(AlignViewport viewport) { CutAndPasteTransfer cap = new CutAndPasteTransfer(); - cap.setForInput(alignment); + cap.setForInput(viewport); Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500); } @@ -510,7 +513,7 @@ public class Desktop extends jalview.jbgui.GDesktop "\nFor all issues relating to Jalview, email help@jalview.org" + "\n\nIf you use JalView, please cite:" + "\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"" + - "\nBioinformatics, 2004 12;426-7."); + "\nBioinformatics, 2004 20;426-7."); JOptionPane.showInternalMessageDialog(Desktop.desktop, @@ -623,7 +626,44 @@ public class Desktop extends jalview.jbgui.GDesktop public void inputSequence_actionPerformed(ActionEvent e) { - SequenceFetcher sf = new SequenceFetcher(null); + new SequenceFetcher(null); + } + + JPanel progressPanel; + + public void startLoading(final String fileName) + { + if (fileLoadingCount == 0) + { + progressPanel = new JPanel(new BorderLayout()); + JProgressBar progressBar = new JProgressBar(); + progressBar.setIndeterminate(true); + + progressPanel.add(new JLabel("Loading File: " + fileName + " "), + BorderLayout.WEST); + + progressPanel.add(progressBar, BorderLayout.CENTER); + + instance.getContentPane().add(progressPanel, BorderLayout.SOUTH); + } + fileLoadingCount++; + validate(); + } + + public void stopLoading() + { + fileLoadingCount--; + if (fileLoadingCount < 1) + { + if(progressPanel!=null) + { + this.getContentPane().remove(progressPanel); + progressPanel = null; + } + fileLoadingCount = 0; + } + validate(); } + }