Changeset 1983


Ignore:
Timestamp:
12/29/06 14:01:47 (13 years ago)
Author:
chris
Message:

Browser:
1) primitive cache toggling added. Currently unable
to warn if the dataset is too large to read entirely
into RAM, but is otherwise functional.

Location:
trunk/loci/plugins/browser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/browser/CustomWindow.java

    r1981 r1983  
    6060  protected LociDataBrowser db; 
    6161  protected CacheIndicator zIndicator,tIndicator; 
    62   private OptionsWindow ow; 
     62  protected OptionsWindow ow; 
    6363  private String zString = Z_STRING; 
    6464  private String tString = T_STRING; 
  • trunk/loci/plugins/browser/LociDataBrowser.java

    r1982 r1983  
    250250     
    251251    IJ.showMessage(msg); 
     252  } 
     253   
     254  public void toggleCache(boolean cached) { 
     255    if(cached) { 
     256      if(!virtual) { 
     257        cw.ow.dispose(); 
     258        cw.dispose(); 
     259        virtual = true; 
     260        run(""); 
     261      } 
     262    } 
     263    else { 
     264      if(virtual) { 
     265        cw.ow.dispose(); 
     266        cw.dispose(); 
     267        virtual = false; 
     268        run(""); 
     269      } 
     270    } 
    252271  } 
    253272 
  • trunk/loci/plugins/browser/OptionsWindow.java

    r1981 r1983  
    5959  /** CheckBoxes to indicate which axes to store.*/ 
    6060  private JCheckBox zCheck,tCheck,cCheck; 
     61   
     62  /** CheckBoxes to control if caching is on or off */ 
     63  private JCheckBox cacheToggle; 
    6164 
    6265  /** Spinners for slice storage.*/ 
     
    275278    JLabel midL = new JLabel("Mid Priority:"); 
    276279    JLabel lowL = new JLabel("Low Priority:"); 
     280    JLabel genL = new JLabel("\u00B7" + "General Controls" + "\u00B7"); 
    277281 
    278282    JPanel typePanel = new JPanel(); 
     
    288292    priorPanel.setBackground(Color.darkGray); 
    289293    priorL.setForeground(Color.lightGray); 
     294    JPanel genPanel = new JPanel(); 
     295    genPanel.add(genL); 
     296    genPanel.setBackground(Color.darkGray); 
     297    genL.setForeground(Color.lightGray); 
    290298 
    291299    zCheck = new JCheckBox("Z"); 
     
    300308    tCheck.addItemListener(this); 
    301309    cCheck.addItemListener(this); 
     310     
     311    cacheToggle = new JCheckBox("Cache Images (on/off)"); 
     312    cacheToggle.setSelected(cw.db.virtual); 
     313    cacheToggle.addItemListener(this); 
     314     
    302315 
    303316    String[] modes = {"Crosshair", "Rectangle", "Cross/Rect"}; 
     
    343356      TAB + ",pref," + TAB + ",pref:grow," + TAB + ",pref:grow," + TAB, 
    344357      "pref,pref,pref,pref," + TAB + ",pref,pref,pref,pref,pref," 
    345       + TAB + ",pref," + TAB + ",pref,pref,pref," + TAB + ",pref"); 
     358      + TAB + ",pref," + TAB + ",pref,pref,pref," + TAB + ",pref," + TAB + ",pref," + TAB + ",pref"); 
    346359    cachePane.setLayout(layout3); 
    347360    CellConstraints cc3 = new CellConstraints(); 
     
    373386    cachePane.add(lowL,cc3.xyw(2,16,3)); 
    374387    cachePane.add(lowBox,cc3.xy(6,16)); 
    375     cachePane.add(resetBtn,cc3.xyw(2,18,5,"right,center")); 
     388    cachePane.add(genPanel,cc3.xyw(1,18,7)); 
     389    cachePane.add(cacheToggle,cc3.xyw(2,20,5,"left,center")); 
     390    cachePane.add(resetBtn,cc3.xyw(2,22,5,"right,center")); 
    376391 
    377392    if(!cw.db.virtual) enableCache(false); 
     
    820835        return; 
    821836      } 
     837      else if (source == cacheToggle) { 
     838        if(e.getStateChange() == ItemEvent.DESELECTED) { 
     839          cw.db.toggleCache(false); 
     840        } 
     841        else { 
     842          cw.db.toggleCache(true); 
     843        } 
     844      } 
    822845 
    823846      int zState = 0x00,tState = 0x00,cState = 0x00; 
Note: See TracChangeset for help on using the changeset viewer.