Changeset 532


Ignore:
Timestamp:
10/13/05 14:09:23 (15 years ago)
Author:
curtis
Message:

More progress on streamlined, multitask-oriented GUI.

Location:
trunk/loci/visbio
Files:
1 added
17 edited

Legend:

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

    r531 r532  
    2727import com.jgoodies.forms.layout.CellConstraints; 
    2828import com.jgoodies.forms.layout.FormLayout; 
    29 import java.awt.BorderLayout; 
    30 import java.awt.Font; 
     29import java.awt.*; 
    3130import java.awt.event.ActionListener; 
    3231import java.awt.event.ActionEvent; 
    3332import javax.swing.*; 
     33import javax.swing.border.EmptyBorder; 
    3434 
    3535/** BioTask is a panel representing a particular VisBio task. */ 
     
    7474    stop.setEnabled(false); 
    7575    setLayout(new BorderLayout()); 
     76    setBorder(new EmptyBorder(0, 0, 5, 0)); 
    7677    PanelBuilder builder = new PanelBuilder(new FormLayout( 
    7778      "pref:grow, 3dlu, pref:grow, 3dlu, pref", "pref, pref" 
     
    123124 
    124125 
     126  // -- Component API methods -- 
     127 
     128  public Dimension getMaximumSize() { 
     129    Dimension max = super.getMaximumSize(); 
     130    Dimension pref = super.getPreferredSize(); 
     131    return new Dimension(max.width, pref.height); 
     132  } 
     133 
     134 
    125135  // -- ActionListener methods -- 
    126136 
  • trunk/loci/visbio/ConsoleManager.java

    r465 r532  
    100100 
    101101 
     102  // -- Menu commands -- 
     103 
     104  /** Displays the given output console window. */ 
     105  public void windowConsole(String console) { 
     106    WindowManager wm = (WindowManager) bio.getManager(WindowManager.class); 
     107    if (console.equals("err")) wm.showWindow(err.getWindow()); 
     108    else if (console.equals("out")) wm.showWindow(out.getWindow()); 
     109  } 
     110 
     111 
    102112  // -- LogicManager API methods -- 
    103113 
     
    134144    if (src == out) frame = out.getWindow(); 
    135145    else if (src == err) frame = err.getWindow(); 
    136     if (frame != null && !frame.isVisible()) frame.show(); 
     146    if (frame != null && !frame.isVisible()) { 
     147      WindowManager wm = (WindowManager) bio.getManager(WindowManager.class); 
     148      wm.showWindow(frame); 
     149    } 
    137150  } 
    138151 
     
    142155  /** Adds data-related GUI components to VisBio. */ 
    143156  private void doGUI() { 
    144     bio.setSplashStatus("Initializing console logic"); 
     157    bio.setSplashStatus("Initializing console windows"); 
    145158    out = new OutputConsole("Output Console"); 
    146159    err = new OutputConsole("Error Console", "errors.log"); 
     
    177190  } 
    178191 
    179  
    180   // -- Menu commands -- 
    181  
    182   /** Displays the given output console window. */ 
    183   public void windowConsole(String console) { 
    184     if (console.equals("err")) err.show(); 
    185     else if (console.equals("out")) out.show(); 
    186   } 
    187  
    188192} 
  • trunk/loci/visbio/SystemManager.java

    r531 r532  
    2525 
    2626import com.jgoodies.plaf.LookUtils; 
    27 import java.awt.event.ActionEvent; 
    28 import java.awt.event.ActionListener; 
     27import java.awt.event.*; 
    2928import java.io.*; 
    3029import java.util.Vector; 
    31 import javax.swing.Timer; 
     30import javax.swing.*; 
    3231import loci.visbio.help.HelpManager; 
    3332import visad.util.Util; 
     
    4342  // -- Control panel -- 
    4443 
    45   /** System control panel. */ 
     44  /** System information control panel. */ 
    4645  private SystemControls systemControls; 
     46 
     47  /** JFrame containing system information control panel. */ 
     48  private JFrame systemFrame; 
    4749 
    4850 
     
    163165 
    164166 
     167  // -- Menu commands -- 
     168 
     169  /** Displays the system information window. */ 
     170  public void showSystemInfo() { 
     171    WindowManager wm = (WindowManager) bio.getManager(WindowManager.class); 
     172    wm.showWindow(systemFrame); 
     173  } 
     174 
     175 
    165176  // -- LogicManager API methods -- 
    166177 
     
    175186 
    176187  /** Gets the number of tasks required to initialize this logic manager. */ 
    177   public int getTasks() { return 2; } 
     188  public int getTasks() { return 3; } 
    178189 
    179190 
     
    202213  private void doGUI() { 
    203214    // control panel 
    204     bio.setSplashStatus("Initializing system information logic"); 
     215    bio.setSplashStatus("Initializing system information window"); 
    205216    systemControls = new SystemControls(this); 
    206 //    PanelManager pm = (PanelManager) bio.getManager(PanelManager.class); 
    207 //    pm.addPanel(systemControls); 
     217    systemFrame = new JFrame("System Information"); 
     218    systemFrame.getContentPane().add(systemControls); 
     219 
     220    // register system information window with window manager 
     221    WindowManager wm = (WindowManager) bio.getManager(WindowManager.class); 
     222    wm.addWindow(systemFrame); 
     223 
     224    // menu items 
     225    bio.setSplashStatus(null); 
     226    JMenuItem system = bio.addMenuItem("Window", "System information", 
     227      "loci.visbio.SystemManager.showSystemInfo", 'i'); 
     228    system.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0)); 
     229    bio.addMenuSeparator("Window"); 
    208230 
    209231    // help window 
     
    225247  public static void gc() { 
    226248    try { 
    227       System.gc(); 
    228       Thread.sleep(100); 
    229       System.runFinalization(); 
    230       Thread.sleep(100); 
    231       System.gc(); 
    232       Thread.sleep(100); 
    233       System.runFinalization(); 
    234       Thread.sleep(100); 
     249      for (int i=0; i<2; i++) { 
     250        System.gc(); 
     251        Thread.sleep(100); 
     252        System.runFinalization(); 
     253        Thread.sleep(100); 
     254      } 
    235255    } 
    236256    catch (InterruptedException exc) { exc.printStackTrace(); } 
  • trunk/loci/visbio/TaskControls.java

    r531 r532  
    5050    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); 
    5151    pane.setBorder(new EmptyBorder(5, 5, 5, 5)); 
     52    pane.add(Box.createVerticalGlue()); 
    5253 
    5354    // scroll pane 
     
    6263 
    6364  /** Adds a task to the tasks pane. */ 
    64   public void addTask(BioTask task) { pane.add(task); } 
     65  public void addTask(BioTask task) { pane.add(task, 0); } 
    6566 
    6667  /** Removes a task from the tasks pane. */ 
  • trunk/loci/visbio/TaskManager.java

    r531 r532  
    2323 
    2424package loci.visbio; 
     25 
     26import loci.visbio.help.HelpManager; 
    2527 
    2628/** TaskManager is the manager encapsulating VisBio's data transform logic. */ 
     
    6769 
    6870  /** Gets the number of tasks required to initialize this logic manager. */ 
    69   public int getTasks() { return 1; } 
     71  public int getTasks() { return 2; } 
    7072 
    7173 
     
    7577  private void doGUI() { 
    7678    // control panel 
    77     bio.setSplashStatus("Initializing task management logic"); 
     79    bio.setSplashStatus("Initializing task management"); 
    7880    taskControls = new TaskControls(this); 
    7981    PanelManager pm = (PanelManager) bio.getManager(PanelManager.class); 
    8082    pm.addPanel(taskControls, 1, 1, 1, 1, "350", "200:grow"); 
     83 
     84    // help topics 
     85    bio.setSplashStatus(null); 
     86    HelpManager hm = (HelpManager) bio.getManager(HelpManager.class); 
     87    hm.addHelpTopic("Control panels/Tasks panel", "tasks_panel.html"); 
    8188  } 
    8289 
  • trunk/loci/visbio/VisBio.java

    r531 r532  
    4646 
    4747  /** Application version. */ 
    48   public static final String VERSION = "v3.12"; 
     48  public static final String VERSION = "v3.15"; 
    4949 
    5050  /** Application author. */ 
  • trunk/loci/visbio/VisBioFrame.java

    r531 r532  
    131131        new HelpManager(this), 
    132132        new PanelManager(this), 
    133         new TaskManager(this), 
    134133        new DataManager(this), 
    135134        new MathManager(this), 
     
    137136        new DisplayManager(this), 
    138137        new OverlayManager(this), 
     138        new TaskManager(this), 
    139139        new SystemManager(this), 
    140140        new ConsoleManager(this), 
  • trunk/loci/visbio/data/DataManager.java

    r531 r532  
    273273          return; 
    274274        } 
    275         task.setStoppable(false); 
    276         task.setStatus("Creating dataset"); 
    277         TaskListener tl = new TaskListener() { 
    278           public void taskUpdated(TaskEvent e) { 
    279             int val = e.getProgressValue(); 
    280             int max = e.getProgressMaximum(); 
    281             String msg = e.getStatusMessage(); 
    282             task.setStatus(val, max, msg); 
    283           } 
    284         }; 
    285         Dataset dataset = new Dataset(dirName, pattern, 
    286           fp.getFiles(), lengths, dims, Float.NaN, Float.NaN, Float.NaN, tl); 
    287         task.setCompleted(); 
    288         addData(dataset); 
     275        createDataset(dirName, pattern, fp.getFiles(), 
     276          lengths, dims, Float.NaN, Float.NaN, Float.NaN, task); 
    289277      } 
    290278    }.start(); 
     279  } 
     280 
     281  /** 
     282   * Creates a dataset, updating the given task object as things progress. 
     283   * If no task object is given, a new one is created to use. 
     284   */ 
     285  public void createDataset(String name, String pattern, 
     286    String[] ids, int[] lengths, String[] dims, 
     287    float width, float height, float step, BioTask bioTask) 
     288  { 
     289    if (bioTask == null) { 
     290      TaskManager tm = (TaskManager) bio.getManager(TaskManager.class); 
     291      bioTask = tm.createTask(name + " dataset"); 
     292    } 
     293    final BioTask task = bioTask; 
     294    task.setStoppable(false); 
     295    task.setStatus("Creating dataset"); 
     296    TaskListener tl = new TaskListener() { 
     297      public void taskUpdated(TaskEvent e) { 
     298        int val = e.getProgressValue(); 
     299        int max = e.getProgressMaximum(); 
     300        String msg = e.getStatusMessage(); 
     301        task.setStatus(val, max, msg); 
     302      } 
     303    }; 
     304    Dataset dataset = new Dataset(name, pattern, 
     305      ids, lengths, dims, width, height, step, tl); 
     306    task.setCompleted(); 
     307    addData(dataset); 
    291308  } 
    292309 
  • trunk/loci/visbio/data/Dataset.java

    r531 r532  
    230230    // create dataset import dialog if it doesn't already exist 
    231231    if (datasetImporter == null) { 
    232       datasetImporter = new DatasetPane(SwingUtil.getVisBioFileChooser()); 
     232      datasetImporter = new DatasetPane(dm, SwingUtil.getVisBioFileChooser()); 
    233233    } 
    234234 
     
    254254 
    255255    // get file pattern from dataset import dialog 
    256     int rval = datasetImporter.showDialog(parent); 
    257     return rval == DatasetPane.APPROVE_OPTION ? 
    258       datasetImporter.getDataset() : null; 
     256    datasetImporter.showDialog(parent); 
     257 
     258    // dataset import dialog will add the resultant dataset to the Data panel 
     259    return null;  
    259260  } 
    260261 
  • trunk/loci/visbio/data/DatasetPane.java

    r529 r532  
    3535import javax.swing.event.DocumentEvent; 
    3636import javax.swing.event.DocumentListener; 
    37 import loci.visbio.TaskEvent; 
    38 import loci.visbio.TaskListener; 
    3937import loci.visbio.util.*; 
    4038import visad.VisADException; 
     
    4543 * for importing a multidimensional data series into VisBio. 
    4644 */ 
    47 public class DatasetPane extends WizardPane 
    48   implements DocumentListener, TaskListener 
    49 { 
     45public class DatasetPane extends WizardPane implements DocumentListener { 
    5046 
    5147  // -- Constants -- 
     
    10197  // -- Other fields -- 
    10298 
     99  /** Associate data manager. */ 
     100  private DataManager dm; 
     101 
    103102  /** File pattern. */ 
    104103  private FilePattern fp; 
     
    113112  private int nameId; 
    114113 
    115   /** Saved event when Finish button is clicked. */ 
    116   private ActionEvent finishEvent; 
    117  
    118114 
    119115  // -- Constructor -- 
    120116 
    121117  /** Creates a file group import dialog. */ 
    122   public DatasetPane() { this(SwingUtil.getVisBioFileChooser()); } 
     118  public DatasetPane(DataManager dm) { 
     119    this(dm, SwingUtil.getVisBioFileChooser()); 
     120  } 
    123121 
    124122  /** Creates a file group import dialog with the given file chooser. */ 
    125   public DatasetPane(JFileChooser fileChooser) { 
     123  public DatasetPane(DataManager dm, JFileChooser fileChooser) { 
    126124    super("Import data"); 
     125    this.dm = dm; 
    127126    fileBox = fileChooser; 
    128127 
     
    251250      }.start(); 
    252251    } 
    253     else if (command.equals("ok")) { 
     252    else if (command.equals("ok")) { // Finish 
    254253      // check parameters 
     254      final String name = nameField.getText(); 
     255      final String pattern = groupField.getText(); 
     256      final int[] lengths = fp.getCount(); 
     257      final String[] files = fp.getFiles(); 
     258      int len = lengths.length; 
    255259      boolean use = useMicrons.isSelected(); 
    256260      float width = Float.NaN, height = Float.NaN, step = Float.NaN; 
     
    278282        } 
    279283      } 
    280  
    281       // finish up 
    282       pleaseWait("Reading files..."); 
    283       disableButtons(); 
    284       finishEvent = e; 
     284      final float mw = width; 
     285      final float mh = height; 
     286      final float sd = step; 
     287 
     288      // compile information on dimensional types 
     289      boolean b = dimBox.isEnabled(); 
     290      final String[] dims = new String[b ? len + 1 : len]; 
     291      for (int i=0; i<len; i++) { 
     292        dims[i] = (String) widgets[i].getSelectedItem(); 
     293      } 
     294      if (b) dims[len] = (String) dimBox.getSelectedItem(); 
     295 
     296      // construct data object 
     297      super.actionPerformed(e); 
    285298      new Thread("VisBio-FinishDatasetThread") { 
    286         public void run() { finish(); } 
     299        public void run() { 
     300          dm.createDataset(name, pattern, 
     301            files, lengths, dims, mw, mh, sd, null); 
     302        } 
    287303      }.start(); 
    288304    } 
     
    301317  /** Gives notification that a portion of the document has been removed. */ 
    302318  public void removeUpdate(DocumentEvent e) { checkText(); } 
    303  
    304  
    305   // -- TaskListener API methods -- 
    306  
    307   /** Updates progress bar to match status of dataset construction. */ 
    308   public void taskUpdated(TaskEvent e) { 
    309     final int value = e.getProgressValue(); 
    310     final int maximum = e.getProgressMaximum(); 
    311     final String message = e.getStatusMessage(); 
    312     Util.invoke(false, new Runnable() { 
    313       public void run() { 
    314         waitLabel.setText(message); 
    315         progress.setIndeterminate(false); 
    316         progress.setMaximum(maximum); 
    317         progress.setValue(value); 
    318       } 
    319     }); 
    320   } 
    321319 
    322320 
     
    349347  } 
    350348 
    351   /** Updates the "please wait" message and progress bar. */ 
    352   protected void setWaitProgress() { 
    353   } 
    354  
    355349  /** Builds the dataset pane's second page. */ 
    356350  protected void buildPage() { 
     
    484478  } 
    485479 
    486   /** Constructs a dataset based on the dataset pane's settings. */ 
    487   protected void finish() { 
    488     String pattern = groupField.getText(); 
    489     int[] lengths = fp.getCount(); 
    490     String[] files = fp.getFiles(); 
    491     int len = lengths.length; 
    492  
    493     // compile information on dimensional types 
    494     boolean b = dimBox.isEnabled(); 
    495     String[] dims = new String[b ? len + 1 : len]; 
    496     for (int i=0; i<len; i++) { 
    497       dims[i] = (String) widgets[i].getSelectedItem(); 
    498     } 
    499     if (b) dims[len] = (String) dimBox.getSelectedItem(); 
    500  
    501     // compile micron information 
    502     boolean use = useMicrons.isEnabled(); 
    503     float width = Float.NaN, height = Float.NaN, step = Float.NaN; 
    504     try { 
    505       width = use ? Float.parseFloat(micronWidth.getText()) : Float.NaN; 
    506       height = use ? Float.parseFloat(micronHeight.getText()) : Float.NaN; 
    507       step = use ? Float.parseFloat(micronStep.getText()) : Float.NaN; 
    508     } 
    509     catch (NumberFormatException exc) { } 
    510  
    511     // construct data object 
    512     data = new Dataset(nameField.getText(), groupField.getText(), 
    513       files, lengths, dims, width, height, step, this); 
    514  
    515     Util.invoke(false, new Runnable() { 
    516       public void run() { sendFinishEvent(); } 
    517     }); 
    518   } 
    519  
    520   protected void sendFinishEvent() { super.actionPerformed(finishEvent); } 
    521  
    522480  /** Toggles availability of micron-related widgets. */ 
    523481  protected void toggleMicronPanel(boolean on) { 
  • trunk/loci/visbio/help/control_panels.html

    r308 r532  
    1313  </li> 
    1414  <li> 
     15    The <a href="tasks_panel.html">Tasks panel</a> shows the operations that 
     16    VisBio is currently performing, with the ability to halt tasks if desired. 
     17  </li> 
     18  <li> 
    1519    The <a href="system_panel.html">System panel</a> shows technical 
    1620    information about your computer system, with controls to adjust VisBio's 
     
    1923</ul> 
    2024 
    21 When you first run VisBio, these panels are visible as tabs in the main 
    22 window. Alternatively, you can set each control panel to float in its own 
    23 window frame by checking "Floating control windows" in the VisBio options 
    24 ("Options..." from the "File" menu). When in this mode, VisBio instead shows a 
    25 button for each control panel, which brings up that panel in its own window 
    26 when clicked. 
     25When you first run VisBio, the Data, Displays and Tasks panels are visible in 
     26the main window. The System panel can be accessed by choosing "System 
     27information" from the "Window" menu. 
    2728 
    2829<br><h3>See also:</h3> 
     
    3334  <li><a href="displays_panel.html">Displays panel</a> 
    3435    - controls for visualizing data</li> 
     36  <li><a href="tasks_panel.html">Tasks panel</a> 
     37    - controls for managing operations</li> 
    3538  <li><a href="system_panel.html">System panel</a> 
    3639    - controls for inspecting system information</li> 
  • trunk/loci/visbio/help/data_panel.html

    r308 r532  
    5555  <li><a href="export_data.html">Exporting data to disk</a> 
    5656    - to save a data object to files on disk</li> 
     57  <li><a href="export_imagej.html">Exporting data directly to ImageJ</a> 
     58    - to open a data object within ImageJ</li> 
    5759  <li><a href="upload_ome.html">Uploading to an OME database</a> 
    5860    - to upload a data object to an OME database</li> 
  • trunk/loci/visbio/help/system_panel.html

    r298 r532  
    44statistics about your computer such as operating system version, Java Virtual 
    55Machine version, and optional installed libraries, as well as a report on 
    6 VisBio's current memory use. 
     6VisBio's current memory use. To access it, choose "System information" from the 
     7"Window" menu. 
    78 
    89<p>The "Dump all" button prints all Java system properties to the 
  • trunk/loci/visbio/help/thumbnails.html

    r455 r532  
    1111these thumbnails in memory at once. It does this in the background, so that you 
    1212can begin visualizing your data even before all thumbnails have been computed. 
    13 You can see how far along the computation is from the progress bar in the main 
    14 VisBio window. You can stop the computation process by clicking the "Stop" 
    15 button next the progress bar, if you wish to conserve memory or CPU use. 
     13You can see how far along the computation is from the progress bar in the 
     14<a href="tasks_panel.html">Tasks panel</a>. You can stop the computation 
     15process by clicking the "Stop" button next the progress bar, if you wish to 
     16conserve memory or CPU use. 
    1617 
    1718<p>When visualizing data, VisBio has a "lo-res" mode and a "hi-res" mode. In 
     
    3435Since the thumbnails' memory footprint is much smaller than it would be at 
    3536full resolution, VisBio gives you both efficient memory use and realtime 
    36 animation at the expense of an initial thumbnail loading time. 
     37animation at the expense of an initial thumbnail loading time and lower 
     38animation resolution. 
    3739 
    3840<p>The default thumbnail resolution is 96 x 96 pixels. You can adjust these 
     
    6365  <li><a href="data_panel.html">Data panel</a> 
    6466    - controls for managing data</li> 
     67  <li><a href="tasks_panel.html">Tasks panel</a> 
     68    - controls for managing operations</li> 
    6569</ul> 
    6670 
  • trunk/loci/visbio/help/upload_ome.html

    r301 r532  
    1313<p><img src="login-to-ome.png" alt="OME login dialog"> 
    1414 
    15 <p>Click the "Ok" button, and the VisBio status bar will report the status of 
    16 the upload process as it progresses. If there are any problems during upload, 
    17 they will be reported in VisBio's "Error console" window. 
     15<p>Click the "Ok" button, and the <a href="tasks_panel.html">Tasks panel</a> 
     16will report the status of the upload process as it progresses. If there are any 
     17problems during upload, they will be reported in VisBio's "Error console" 
     18window. 
    1819 
    1920<br><h3>See also:</h3> 
     
    2627  <li><a href="data_panel.html">Data panel</a> 
    2728    - controls for managing data</li> 
     29  <li><a href="tasks_panel.html">Tasks panel</a> 
     30    - controls for managing operations</li> 
    2831</ul> 
    2932 
  • trunk/loci/visbio/view/DisplayManager.java

    r531 r532  
    228228      "how quitting VisBio also quits ImageJ", true); 
    229229 
    230  
    231230    // help topics 
    232231    bio.setSplashStatus(null); 
  • trunk/loci/visbio/whatsnew.txt

    r531 r532  
    1 v3.12 - Not yet released 
     1v3.15 - Not yet released 
    22 
    33- ADDED: Separate task tracking for each background task VisBio is performing 
Note: See TracChangeset for help on using the changeset viewer.