/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
- *
- * Jalview 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
+ *
+ * Jalview 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 Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
/**
* Jalview Desktop
- *
- *
+ *
+ *
* @author $author$
* @version $Revision: 1.155 $
*/
* Answers an 'application scope' singleton instance of this class. Separate
* SwingJS 'applets' running in the same browser page will each have a
* distinct instance of Desktop.
- *
+ *
* @return
*/
public static Desktop getInstance()
if (!Platform.isJS())
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/**
* Answers true if user preferences to enable experimental features is True
* (on), else false
- *
+ *
* @return
*/
public boolean showExperimental()
/**
* recover the last known dimensions for a jalview window
- *
+ *
* @param windowName
* - empty string is desktop, all other windows have unique prefix
* @return null or last known dimensions scaled to current geometry (if last
// /**
// * Add an internal frame to the Jalview desktop that is allowed to be resized,
// * has a minimum size of 300px and might or might not be visible
-// *
+// *
// * @param frame
// * Frame to show
// * @param title
// /**
// * Add an internal frame to the Jalview desktop that is visible, has a minimum
// * size of 300px, and may or may not be resizable
-// *
+// *
// * @param frame
// * Frame to show
// * @param title
/**
* Adds and opens the given frame to the desktop that is visible, allowed to
* resize, and has a 300px minimum width.
- *
+ *
* @param frame
* Frame to show
* @param title
final JInternalFrame frame, String title, int w, int h)
{
// 58 classes
-
- addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h,
+
+ addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h,
FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300);
}
/**
* Add an internal frame to the Jalview desktop that may optionally be
* visible, resizable, and allowed to be any size
- *
+ *
* @param frame
* Frame to show
* @param title
int w, int h, boolean resizable, boolean ignoreMinSize)
{
// 15 classes call this method directly.
-
+
// TODO: allow callers to determine X and Y position of frame (eg. via
// bounds object).
// TODO: consider fixing method to update entries in the window submenu with
}
// These can now by put into a single int flag, if desired:
-
+
public final static boolean FRAME_MAKE_VISIBLE = true;
public final static boolean FRAME_NOT_VISIBLE = false;
public final static boolean FRAME_ALLOW_ANY_SIZE = true;
public final static boolean FRAME_SET_MIN_SIZE_300 = false;
-
+
private void addFrame(JInternalFrame frame,
boolean makeVisible, boolean resizable,
boolean ignoreMinSize)
{
openFrameCount++;
-
+
boolean isEmbedded = (Platform.getEmbeddedAttribute(frame, "id") != null);
boolean hasEmbeddedSize = (Platform.getDimIfEmbedded(frame, -1, -1) != null);
// Web page embedding allows us to ignore minimum size
ignoreMinSize |= hasEmbeddedSize;
-
+
if (!ignoreMinSize)
{
// Set default dimension for Alignment Frame window.
} else {
frame.setMinimumSize(
new Dimension(DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT));
-
+
}
}
}
/*
- * add an entry for the new frame in the Window menu
+ * add an entry for the new frame in the Window menu
* (and remove it when the frame is closed)
*/
final JMenuItem menuItem = new JMenuItem(frame.getTitle());
/**
* Add key bindings to a JInternalFrame so that Ctrl-W and Cmd-W will close
* the window
- *
+ *
* @param frame
*/
private static void setKeyBindings(JInternalFrame frame)
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* Shows a dialog for input of a URL at which to retrieve alignment data
- *
+ *
* @param viewport
*/
@Override
else
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/**
* Opens the CutAndPaste window for the user to paste an alignment in to
- *
+ *
* @param viewPanel
* - if not null, the pasted alignment is added to the current
* alignment; if null, to a new alignment window
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
* Returns the html text for the About screen, including any available version
* number, build details, author details and citation reference, but without
* the enclosing {@code html} tags
- *
+ *
* @return
*/
public String getAboutMessage()
else
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/*
* (non-Javadoc)
- *
+ *
* @seejalview.jbgui.GDesktop#garbageCollect_actionPerformed(java.awt.event.
* ActionEvent)
*/
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.ActionEvent
* )
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GDesktop#showConsole_actionPerformed(java.awt.event.ActionEvent
* )
/**
* control whether the java console is visible or not
- *
+ *
* @param selected
*/
void showConsole(boolean selected)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
}
/**
- *
+ *
* @param alignmentId
* - if null, all sets are returned
* @return all AlignmentPanels concerning the alignmentId sequence set
/**
* get all the viewports on an alignment.
- *
+ *
* @param sequenceSetId
* unique alignment id (may be null - all viewports returned in that
* case)
/**
* Explode the views in the given frame into separate AlignFrame
- *
+ *
* @param af
*/
public static void explodeViews(AlignFrame af)
* identifier back in to this frame as additional views, and close the
* expanded views. Note the expanded frames may themselves have multiple
* views. We take the lot.
- *
+ *
* @param source
*/
public void gatherViews(AlignFrame source)
/**
* Checks the given url to see if it gives a response indicating that the user
* should be informed of a new questionnaire.
- *
+ *
* @param url
*/
public void checkForQuestionnaire(String url)
* Proxy class for JDesktopPane which optionally displays the current memory
* usage and highlights the desktop area with a red bar if free memory runs
* low.
- *
+ *
* @author AMW
*/
public class MyDesktopPane extends JDesktopPane implements Runnable
/**
* Accessor method to quickly get all the AlignmentFrames loaded.
- *
+ *
* @return an array of AlignFrame, or null if none found
*/
public static AlignFrame[] getAlignFrames()
/**
* Returns an array of any AppJmol frames in the Desktop (or null if none).
- *
+ *
* @return
*/
public GStructureViewer[] getJmols()
/*
* We allow only one console at a time, so that AlignFrame menu option
* 'Calculate | Run Groovy script' is unambiguous.
- * Disable 'Groovy Console', and enable 'Run script', when the console is
+ * Disable 'Groovy Console', and enable 'Run script', when the console is
* opened, and the reverse when it is closed
*/
Window window = (Window) groovyConsole.getFrame();
/**
* Enable or disable 'Run Groovy script' in AlignFrame calculate menus
- *
+ *
* @param enabled
* true if Groovy console is open
*/
/*
* (non-Javadoc)
- *
+ *
* @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
*/
@Override
progressBars.put(Long.valueOf(id), addProgressPanel(message));
}
}
-
+
@Override
public void removeProgressBar(long id)
{
/*
* (non-Javadoc)
- *
+ *
* @see jalview.gui.IProgressIndicator#registerHandler(long,
* jalview.gui.IProgressIndicatorHandler)
*/
}
/**
- *
+ *
* @return true if any progress bars are still active
*/
@Override
* This will return the first AlignFrame holding the given viewport instance.
* It will break if there are more than one AlignFrames viewing a particular
* av.
- *
+ *
* @param viewport
* @return alignFrame for viewport
*/
/**
* check if jalview GUI is being operated programmatically
- *
+ *
* @return inBatchMode
*/
public boolean isInBatchMode()
/**
* set flag if jalview GUI is being operated programmatically
- *
+ *
* @param inBatchMode
*/
public void setInBatchMode(boolean inBatchMode)
// JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
System.out.println("loading services");
-
+
/** @j2sIgnore */
{
// todo: changesupport handlers need to be transferred
}
if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true))
{
- tasks.add(jalview.ws.slivkaws.SlivkaWSDiscoverer.getInstance().startDiscoverer());
+ tasks.add(jalview.ws2.slivka.SlivkaWSDiscoverer.getInstance().startDiscoverer());
}
if (blocking)
{
/**
* called to check if the service discovery process completed successfully.
- *
+ *
* @param evt
*/
protected void JalviewServicesChanged(PropertyChangeEvent evt)
/*
* JalviewDialog jd =new JalviewDialog() {
- *
+ *
* @Override protected void cancelPressed() { // TODO
* Auto-generated method stub
- *
+ *
* }@Override protected void okPressed() { // TODO
* Auto-generated method stub
- *
+ *
* }@Override protected void raiseClosed() { // TODO
* Auto-generated method stub
- *
+ *
* } }; jd.initDialogFrame(new
* JLabel("<html><table width=\"450\"><tr><td>" + ermsg +
* "<br/>It may be that you have invalid JABA URLs in your web service preferences,"
* " Tools->Preferences dialog box to change them.</td></tr></table></html>"
* ), true, true, "Web Service Configuration Problem", 450,
* 400);
- *
+ *
* jd.waitForInput();
*/
JvOptionPane.showConfirmDialog(desktopPane,
* start a thread to open a URL in the configured browser. Pops up a warning
* dialog to the user if there is an exception when calling out to the browser
* to open the URL.
- *
+ *
* @param url
*/
public static void showUrl(final String url)
/**
* Like showUrl but allows progress handler to be specified
- *
+ *
* @param url
* @param progress
* (null) or object implementing IProgressIndicator
/**
* static hyperlink handler proxy method for use by Jalview's internal windows
- *
+ *
* @param e
*/
public static void hyperlinkUpdate(HyperlinkEvent e)
/**
* add another dialog thread to the queue
- *
+ *
* @param prompter
*/
public void addDialogThread(final Runnable prompter)
* Outputs an image of the desktop to file in EPS format, after prompting the
* user for choice of Text or Lineart character rendering (unless a preference
* has been set). The file name is generated as
- *
+ *
* <pre>
* Jalview_snapshot_nnnnn.eps where nnnnn is the current timestamp in milliseconds
* </pre>
* and location last time the view was expanded (if any). However it does not
* remember the split pane divider location - this is set to match the
* 'exploding' frame.
- *
+ *
* @param sf
*/
public void explodeViews(SplitFrame sf)
* AlignmentPanel objects, including their AlignmentViewports, so the
* cdna/protein relationships between the viewports is carried over to the
* new split frames.
- *
+ *
* explodedGeometry holds the (x, y) position of the previously exploded
* SplitFrame, and the (width, height) of the AlignFrame component
*/
* Gather expanded split frames, sharing the same pairs of sequence set ids,
* back into the given SplitFrame as additional views. Note that the gathered
* frames may themselves have multiple views.
- *
+ *
* @param source
*/
public void gatherViews(GSplitFrame source)
/**
* handles the payload of a drag and drop event.
- *
+ *
* TODO refactor to desktop utilities class
- *
+ *
* @param files
* - Data source strings extracted from the drop event
* @param protocols
* for either Jmol or Chimera) which are currently open. This may optionally
* be restricted to viewers of a specified class, or viewers linked to a
* specified alignment panel.
- *
+ *
* @param apanel
* if not null, only return viewers linked to this panel
* @param structureViewerClass