Skip to content

Commit

Permalink
topcat: fix TAP load window to stay open by default
Browse files Browse the repository at this point in the history
All table load dialogues by default are disposed when a table is loaded,
but you can change this behaviour with the "Stay Open" option.
For TAP it's usually pretty annoying for it to keep closing, so set
it pinned open by default.  Maybe I should do this for some other
load dialogues too?
  • Loading branch information
mbtaylor authored and mmpcn committed Nov 27, 2014
1 parent 848821b commit 6e93c2d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions topcat/src/docs/sun253.xml
Expand Up @@ -20306,6 +20306,9 @@ introduced since the last version:
MultiCone button in the main Control Window toolbar.
MultiCone is now for most purposes deprecated.</li>
<li>Fixed bug reversing cube and sphere navigation help buttons.</li>
<li>Fixed TAP load dialogue so that by default it stays open after a
table is loaded (the <label>Stay Open</label> option is set true
by default).</li>
</ul>
</p></dd>

Expand Down
14 changes: 14 additions & 0 deletions topcat/src/main/uk/ac/starlink/topcat/TableLoadDialogWindow.java
Expand Up @@ -46,6 +46,7 @@ public TableLoadDialogWindow( Component parent, TableLoadDialog tld,
new ToggleButtonModel( "Stay Open", ResourceIcon.KEEP_OPEN,
"Keep window open even after " +
"successful load" );
stayOpenModel_.setSelected( isPinnedDflt( tld ) );
getToolBar().add( stayOpenModel_.createToolbarButton() );
getToolBar().addSeparator();
JMenu windowMenu = getWindowMenu();
Expand Down Expand Up @@ -127,4 +128,17 @@ public void endSequence( boolean cancelled ) {
/* Perform asynchronous table loading. */
controlWin.runLoading( loader, loadClient, tld_.getIcon() );
}

/**
* Determines whether the window associated with a given load dialogue
* should be pinned open by default.
*
* @param tld load dialogue
* @return if false, window will disappear when a load is complete;
* if true, it will stay posted
*/
private static boolean isPinnedDflt( TableLoadDialog tld ) {
String cname = tld.getClass().getName();
return cname.endsWith( "TapTableLoadDialog" );
}
}

0 comments on commit 6e93c2d

Please sign in to comment.