Changeset 50


Ignore:
Timestamp:
10/07/04 16:03:03 (15 years ago)
Author:
curtis
Message:

Add generic status bar for reporting progress on various tasks.

Location:
trunk/loci/visbio
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/ConsoleManager.java

    r24 r50  
    114114  /** Adds data-related GUI components to VisBio. */ 
    115115  private void doGUI() { 
    116     bio.setStatus("Initializing console logic"); 
     116    bio.setSplashStatus("Initializing console logic"); 
    117117    out = new OutputConsole("Output Console"); 
    118118    err = new OutputConsole("Error Console", "errors.log"); 
     
    131131 
    132132    // options menu 
    133     bio.setStatus(null); 
     133    bio.setSplashStatus(null); 
    134134    OptionManager om = (OptionManager) bio.getManager(OptionManager.class); 
    135135    om.addBooleanOption("General", DEBUG_MODE, 'd', 
  • trunk/loci/visbio/ExitManager.java

    r2 r50  
    7171  private void doGUI() { 
    7272    // close action 
    73     bio.setStatus("Initializing shutdown logic"); 
     73    bio.setSplashStatus("Initializing shutdown logic"); 
    7474    bio.setDefaultCloseOperation(VisBioFrame.DO_NOTHING_ON_CLOSE); 
    7575    bio.addWindowListener(this); 
    7676 
    7777    // file menu 
    78     bio.setStatus(null); 
     78    bio.setSplashStatus(null); 
    7979    if (!VisBioFrame.MAC_OS_X) { 
    8080      bio.addMenuSeparator("File"); 
  • trunk/loci/visbio/PanelManager.java

    r31 r50  
    164164  /** Adds base control panel GUI components to VisBio. */ 
    165165  private void doGUI() { 
    166     bio.setStatus("Initializing control panel logic"); 
     166    bio.setSplashStatus("Initializing control panel logic"); 
    167167    panels = new Vector(); 
    168168    floatWindows = new Vector(); 
     
    177177 
    178178    // options menu 
    179     bio.setStatus(null); 
     179    bio.setSplashStatus(null); 
    180180    OptionManager om = (OptionManager) bio.getManager(OptionManager.class); 
    181181    om.addBooleanOption("General", FLOATING, 'f', 
  • trunk/loci/visbio/SystemManager.java

    r18 r50  
    180180  private void doGUI() { 
    181181    // control panel 
    182     bio.setStatus("Initializing system information logic"); 
     182    bio.setSplashStatus("Initializing system information logic"); 
    183183    systemControls = new SystemControls(this); 
    184184    PanelManager pm = (PanelManager) bio.getManager(PanelManager.class); 
     
    186186 
    187187    // help window 
    188     bio.setStatus(null); 
     188    bio.setSplashStatus(null); 
    189189    HelpManager hm = (HelpManager) bio.getManager(HelpManager.class); 
    190190    hm.addHelpTopic("System", "system.html"); 
  • trunk/loci/visbio/VisBioFrame.java

    r31 r50  
    2424package loci.visbio; 
    2525 
     26import java.awt.BorderLayout; 
     27import java.awt.Container; 
     28 
    2629import java.awt.event.ActionEvent; 
    2730 
     
    3134import java.util.Vector; 
    3235 
     36import javax.swing.JButton; 
     37import javax.swing.JPanel; 
     38import javax.swing.JProgressBar; 
     39 
     40import javax.swing.border.BevelBorder; 
     41import javax.swing.border.CompoundBorder; 
     42 
    3343import loci.visbio.data.DataManager; 
    3444 
    3545import loci.visbio.help.HelpManager; 
    3646 
    37 import loci.visbio.measure.AnnManager; 
     47//import loci.visbio.measure.AnnManager; 
    3848 
    3949import loci.visbio.ome.OMEManager; 
     
    7181  /** Associated splash screen. */ 
    7282  protected SplashScreen ss; 
     83 
     84  /** Status bar. */ 
     85  protected JProgressBar status; 
     86 
     87  /** Stop button for various operations. */ 
     88  protected JButton stop; 
    7389 
    7490 
     
    93109    getMenu("Window"); 
    94110    getMenu("Help"); 
     111 
     112    // create status bar 
     113    status = new JProgressBar(); 
     114    status.setStringPainted(true); 
     115    status.setToolTipText("Reports status of VisBio operations"); 
     116    status.setBorder(new BevelBorder(BevelBorder.RAISED)); 
     117 
     118    // create stop button 
     119    stop = new JButton("Stop"); 
     120    if (!LAFUtil.isMacLookAndFeel()) stop.setMnemonic('s'); 
     121    stop.setToolTipText("Stops the currently reported VisBio operation"); 
     122    stop.setBorder(new CompoundBorder( 
     123      new BevelBorder(BevelBorder.RAISED), stop.getBorder())); 
     124    stop.setPreferredSize(stop.getPreferredSize()); // force constant size 
     125 
     126    // add status bar and stop button 
     127    JPanel statusPanel = new JPanel(); 
     128    statusPanel.setLayout(new BorderLayout()); 
     129    statusPanel.add(status, BorderLayout.CENTER); 
     130    statusPanel.add(stop, BorderLayout.EAST); 
     131    Container c = getContentPane(); 
     132    c.setLayout(new BorderLayout()); 
     133    c.add(statusPanel, BorderLayout.SOUTH); 
     134    resetStatus(); 
    95135 
    96136    // create logic managers 
     
    108148      new OMEManager(this), 
    109149      new DisplayManager(this), 
    110       new AnnManager(this), 
     150      //new AnnManager(this), 
    111151      new SystemManager(this), 
    112152      new ConsoleManager(this), 
     
    119159    // add logic managers 
    120160    for (int i=0; i<lm.length; i++) addManager(lm[i]); 
    121     setStatus("Finishing"); 
     161    setSplashStatus("Finishing"); 
    122162 
    123163    // read configuration file 
     
    159199 
    160200  /** Updates the splash screen to report the given status message. */ 
    161   public void setStatus(String s) { 
     201  public void setSplashStatus(String s) { 
    162202    if (ss == null) return; 
    163203    if (s != null) ss.setText(s + "..."); 
     
    204244   * This method executes action commands of the form 
    205245   * 
    206    *   "loci.visbio.data.DataManager.fileOpenSeries(param)" 
     246   *   "loci.visbio.data.DataManager.importData(param)" 
    207247   * 
    208248   * by stripping off the fully qualified class name, checking VisBio's 
     
    244284  } 
    245285 
     286  /** Gets the status bar's progress bar. */ 
     287  public JProgressBar getProgressBar() { return status; } 
     288 
     289  /** Gets the status bar's stop button. */ 
     290  public JButton getStopButton() { return stop; } 
     291 
     292  /** Resets status bar to an idle state. */ 
     293  public void resetStatus() { 
     294    status.setString(VisBio.TITLE + " " + VisBio.VERSION); 
     295    status.setStringPainted(true); 
     296    status.setIndeterminate(false); 
     297    status.setValue(0); 
     298    stop.setEnabled(false); 
     299  } 
     300 
    246301 
    247302  // -- ActionListener API methods -- 
  • trunk/loci/visbio/WindowManager.java

    r31 r50  
    256256  protected void doGUI() { 
    257257    // window listener 
    258     bio.setStatus("Initializing windowing logic"); 
     258    bio.setSplashStatus("Initializing windowing logic"); 
    259259    docker = new Docker(); 
    260260    docker.addWindow(bio); 
     
    262262 
    263263    // options menu 
    264     bio.setStatus(null); 
     264    bio.setSplashStatus(null); 
    265265    OptionManager om = (OptionManager) bio.getManager(OptionManager.class); 
    266266    om.addBooleanOption("General", DOCKING, 'd', 
  • trunk/loci/visbio/bugs.txt

    r37 r50  
    3131  - Use java.awt.FileDialog on Mac OS X? 
    3232 
     33  - Add -Dsun.java2d.opengl=true to options, and add option to toggle it 
     34    (Java 1.5+ only) 
  • trunk/loci/visbio/data/DataControls.java

    r44 r50  
    4343import javax.swing.event.TreeSelectionListener; 
    4444 
    45 import javax.swing.tree.DefaultMutableTreeNode; 
    46 import javax.swing.tree.DefaultTreeModel; 
    47 import javax.swing.tree.DefaultTreeSelectionModel; 
    48 import javax.swing.tree.TreePath; 
    49 import javax.swing.tree.TreeSelectionModel; 
    50  
    51 import loci.visbio.BioDropHandler; 
    52 import loci.visbio.ControlPanel; 
    53 import loci.visbio.LogicManager; 
    54 import loci.visbio.VisBioFrame; 
    55 import loci.visbio.WindowManager; 
     45import javax.swing.tree.*; 
     46 
     47import loci.visbio.*; 
    5648 
    5749import loci.visbio.ome.OMEManager; 
     50 
     51import loci.visbio.state.StateManager; 
    5852 
    5953import loci.visbio.util.LAFUtil; 
     
    9892  /** Data information display panel. */ 
    9993  private JEditorPane dataInfo; 
    100  
    101   /** Progress bar for reporting thumbnail loading status. */ 
    102   private JProgressBar thumbProgress; 
    103  
    104   /** Button for starting and stopping background thumbnail generation. */ 
    105   private JButton thumbGen; 
    10694 
    10795  /** New 2D display menu item for Displays popup menu. */ 
     
    187175    SwingUtil.configureScrollPane(infoPane); 
    188176 
    189     // data thumbnail progress bar 
    190     thumbProgress = new JProgressBar(); 
    191     thumbProgress.setString("     Thumbnail generation progress     "); 
    192     thumbProgress.setStringPainted(true); 
    193     thumbProgress.setValue(0); 
    194     thumbProgress.setToolTipText( 
    195       "Reports status of the selected data's thumbnails"); 
    196  
    197     // data thumbnail generation button 
    198     thumbGen = new JButton("Generate"); 
    199     if (!LAFUtil.isMacLookAndFeel()) thumbGen.setMnemonic('g'); 
    200     thumbGen.setToolTipText("Starts or stops background thumbnail generation"); 
    201  
    202177    doDataInfo(null); 
    203178 
     
    231206    PanelBuilder builder = new PanelBuilder(new FormLayout( 
    232207      "pref:grow, 3dlu, pref", 
    233       "fill:pref, 5dlu, fill:150dlu:grow, 3dlu, pref")); 
     208      "fill:pref, 5dlu, fill:0:grow")); 
    234209    builder.setDefaultDialogBorder(); 
    235210    CellConstraints cc = new CellConstraints(); 
     
    237212    builder.add(buttons, cc.xy(3, 1)); 
    238213    builder.add(infoPane, cc.xyw(1, 3, 3)); 
    239     builder.add(thumbProgress, cc.xy(1, 5)); 
    240     builder.add(thumbGen, cc.xy(3, 5)); 
    241214    controls.add(builder.getPanel()); 
    242215 
     
    338311    wm.showWindow(frame); 
    339312  } 
    340  
    341   /** Gets progress bar for reporting current progress on operations. */ 
    342   public JProgressBar getProgressBar() { return thumbProgress; } 
    343313 
    344314 
     
    529499    dataInfo.setText(sb.toString()); 
    530500 
    531     // link in thumbnail progress bar and generation button 
    532     boolean gen = false; 
    533     if (data != null) { 
    534       if (thumbHandler != null) thumbHandler.setControls(null, null); 
    535       ThumbnailHandler th = data.getThumbHandler(); 
    536       if (th == null) { 
    537         thumbProgress.setValue(0); 
    538         thumbProgress.setString("No thumbnails."); 
    539       } 
    540       else { 
    541         th.setControls(thumbProgress, thumbGen); 
    542         gen = true; 
    543       } 
    544       thumbHandler = th; 
    545     } 
    546     thumbGen.setEnabled(gen); 
    547  
    548501    // toggle button availability 
    549502    boolean isData = data != null; 
     
    556509    export.setEnabled(data instanceof Dataset); 
    557510    removeData.setEnabled(isData); 
     511 
     512    VisBioFrame bio = lm.getVisBio(); 
     513    StateManager sm = (StateManager) bio.getManager(StateManager.class); 
     514    if (sm.isRestoring()) return; // no touching progress bar during restore 
     515 
     516    // link in thumbnail progress bar and generation button 
     517    if (data == null) bio.resetStatus(); 
     518    else { 
     519      if (thumbHandler != null) thumbHandler.setControls(null, null); 
     520 
     521      ThumbnailHandler th = data.getThumbHandler(); 
     522      if (th == null) bio.resetStatus(); 
     523      else { 
     524        JProgressBar thumbProgress = bio.getProgressBar(); 
     525        JButton thumbGen = bio.getStopButton(); 
     526        th.setControls(thumbProgress, thumbGen); 
     527        thumbGen.setEnabled(true); 
     528      } 
     529      thumbHandler = th; 
     530    } 
    558531  } 
    559532 
  • trunk/loci/visbio/data/DataManager.java

    r37 r50  
    130130  public DataControls getControlPanel() { return dataControls; } 
    131131 
     132  /** Gets a list of data transforms present in the tree. */ 
     133  public Vector getDataList() { 
     134    Vector v = new Vector(); 
     135    buildDataList(dataControls.getDataRoot(), v); 
     136    return v; 
     137  } 
     138 
    132139 
    133140  // -- LogicManager API methods -- 
     
    152159  /** Writes the current state to the given OME-CA XML object. */ 
    153160  public void saveState(OMEElement ome) throws SaveException { 
    154     Vector v = buildDataList(); 
     161    Vector v = getDataList(); 
    155162    int len = v.size(); 
    156163 
     
    228235 
    229236    // merge old and new transform lists 
    230     Vector vo = buildDataList(); 
     237    Vector vo = getDataList(); 
    231238    StateManager.mergeStates(vo, vn); 
    232239 
     
    252259  private void doGUI() { 
    253260    // control panel 
    254     bio.setStatus("Initializing data logic"); 
     261    bio.setSplashStatus("Initializing data logic"); 
    255262    dataControls = new DataControls(this); 
    256263    PanelManager pm = (PanelManager) bio.getManager(PanelManager.class); 
     
    258265 
    259266    // data transform registration 
    260     bio.setStatus(null); 
     267    bio.setSplashStatus(null); 
    261268    transformTypes = new Vector(); 
    262269    transformLabels = new Vector(); 
     
    269276 
    270277    // menu items 
    271     bio.setStatus(null); 
     278    bio.setSplashStatus(null); 
    272279    bio.addMenuItem("File", "Import data...", 
    273280      "loci.visbio.data.DataManager.importData", 'i'); 
     
    275282 
    276283    // help window 
    277     bio.setStatus(null); 
     284    bio.setSplashStatus(null); 
    278285    HelpManager hm = (HelpManager) bio.getManager(HelpManager.class); 
    279286    hm.addHelpTopic("Data", "data.html"); 
    280287 
    281288    // load QuickTime now instead of causing a hiccup later 
    282     bio.setStatus("Initializing QuickTime logic"); 
     289    bio.setSplashStatus("Initializing QuickTime logic"); 
    283290    try { Class.forName("visad.data.qt.QTForm"); } 
    284291    catch (Exception exc) { exc.printStackTrace(); } 
    285   } 
    286  
    287   /** Creates a list of data transforms present in the tree. */ 
    288   private Vector buildDataList() { 
    289     Vector v = new Vector(); 
    290     buildDataList(dataControls.getDataRoot(), v); 
    291     return v; 
    292292  } 
    293293 
  • trunk/loci/visbio/data/Dataset.java

    r38 r50  
    271271    } 
    272272    if (!(d instanceof FlatField)) { 
    273       String name = d == null ? "null" : d.getClass().getName(); 
     273      String className = d == null ? "null" : d.getClass().getName(); 
    274274      System.err.println("Data chunk #" + (imgIndex + 1) + " from file " + 
    275         filename + " is not an image (" + name + ")"); 
     275        filename + " is not an image (" + className + ")"); 
    276276      return null; 
    277277    } 
  • trunk/loci/visbio/data/ThumbnailHandler.java

    r30 r50  
    247247          } 
    248248          else { 
    249             toggle.setText("Generate"); 
     249            toggle.setText("Go"); 
    250250            if (!LAFUtil.isMacLookAndFeel()) toggle.setMnemonic('g'); 
    251251          } 
  • trunk/loci/visbio/help/HelpManager.java

    r34 r50  
    103103  /** Adds help-related GUI components to VisBio. */ 
    104104  private void doGUI() { 
    105     bio.setStatus("Initializing help logic"); 
     105    bio.setSplashStatus("Initializing help logic"); 
    106106    topics = new Vector(); 
    107107    help = new HelpWindow(); 
     
    110110 
    111111    // help menu 
    112     bio.setStatus(null); 
     112    bio.setSplashStatus(null); 
    113113 
    114114    addHelpTopic("Help", "Overview", "overview.html"); 
  • trunk/loci/visbio/ome/OMEManager.java

    r2 r50  
    373373  private void doGUI() { 
    374374    // upload panel 
    375     bio.setStatus("Initializing OME logic"); 
     375    bio.setSplashStatus("Initializing OME logic"); 
    376376    DataManager dm = (DataManager) bio.getManager(DataManager.class); 
    377     uploadPanel = new OMEUploadPane(this, 
    378       dm.getControlPanel().getProgressBar()); 
     377    uploadPanel = new OMEUploadPane(this, bio.getProgressBar()); 
    379378 
    380379    // help window 
    381     bio.setStatus(null); 
     380    bio.setSplashStatus(null); 
    382381    HelpManager hm = (HelpManager) bio.getManager(HelpManager.class); 
    383382    if (hm != null) hm.addHelpTopic("Uploading to OME", "ome.html"); 
  • trunk/loci/visbio/state/OptionManager.java

    r8 r50  
    216216  private void doGUI() { 
    217217    // options menu 
    218     bio.setStatus("Initializing options logic"); 
     218    bio.setSplashStatus("Initializing options logic"); 
    219219  } 
    220220 
  • trunk/loci/visbio/state/StateManager.java

    r2 r50  
    3636import javax.swing.JMenuItem; 
    3737import javax.swing.JOptionPane; 
     38import javax.swing.JProgressBar; 
     39import javax.swing.SwingUtilities; 
    3840 
    3941import loci.ome.xml.OMEElement; 
     
    169171    int rval = stateBox.showOpenDialog(bio); 
    170172    if (rval == JFileChooser.APPROVE_OPTION) { 
    171       WindowManager wm = (WindowManager) bio.getManager(WindowManager.class); 
     173      final WindowManager wm = (WindowManager) 
     174        bio.getManager(WindowManager.class); 
    172175      wm.setWaitCursor(true); 
    173       restoreState(stateBox.getSelectedFile()); 
    174       wm.setWaitCursor(false); 
     176      JProgressBar status = bio.getProgressBar(); 
     177      status.setString("Restoring state..."); 
     178      status.setIndeterminate(true); 
     179      Thread restoreThread = new Thread(new Runnable() { 
     180        public void run() { 
     181          restoreState(stateBox.getSelectedFile()); 
     182          SwingUtilities.invokeLater(new Runnable() { 
     183            public void run() { 
     184              bio.resetStatus(); 
     185              wm.setWaitCursor(false); 
     186            } 
     187          }); 
     188        } 
     189      }); 
     190      restoreThread.start(); 
    175191    } 
    176192  } 
     
    290306  private void doGUI() { 
    291307    // save state file chooser 
    292     bio.setStatus("Initializing state logic"); 
     308    bio.setSplashStatus("Initializing state logic"); 
    293309    stateBox = new JFileChooser(); 
    294310    stateBox.addChoosableFileFilter(new ExtensionFileFilter( 
     
    296312 
    297313    // edit menu 
    298     bio.setStatus(null); 
     314    bio.setSplashStatus(null); 
    299315    editUndo = bio.addMenuItem("Edit", "Undo", 
    300316      "loci.visbio.state.StateManager.editUndo", 'u'); 
     
    308324 
    309325    // undo logic variables 
    310     bio.setStatus(null); 
     326    bio.setSplashStatus(null); 
    311327    undoStates = new Stack(); 
    312328    redoStates = new Stack(); 
  • trunk/loci/visbio/util/SwingUtil.java

    r41 r50  
    4343 
    4444import javax.swing.filechooser.FileFilter; 
    45  
    46 import loci.visbio.VisBioFrame; 
    4745 
    4846import visad.util.ComboFileFilter; 
  • trunk/loci/visbio/whatsnew.txt

    r43 r50  
    22 
    33- ADDED: Preliminary support for Zeiss ZVI file format 
     4- ADDED: Comprehensive state support (save/restore/undo/redo) in XML 
     5 
     6- FIXED: Mac OS X menu bar behaves much better 
    47 
    58 
Note: See TracChangeset for help on using the changeset viewer.