From: M. S. G. <sga...@us...> - 2003-12-18 18:04:01
|
Update of /cvsroot/gallery/gallery_remote/com/gallery/GalleryRemote In directory sc8-pr-cvs1:/tmp/cvs-serv1928 Modified Files: MainFrame.java Log Message: Made the dirty flag ('*' in title) display more consistently. I didn't add or remove any place where we were setting or clearing the flag, I just refactored it into a central method where I force the UI to update any time the flag changes. Index: MainFrame.java =================================================================== RCS file: /cvsroot/gallery/gallery_remote/com/gallery/GalleryRemote/MainFrame.java,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- MainFrame.java 10 Dec 2003 17:34:35 -0000 1.91 +++ MainFrame.java 18 Dec 2003 18:03:58 -0000 1.92 @@ -311,7 +311,7 @@ updateGalleryParams(); // We've been initalized, we are now clean. - m_isDirty = false; + setDirtyFlag(false); } @@ -394,6 +394,16 @@ resetUIState(); } + /** + * <p>This method updates the dirty flag and also causes the UI + * to be updated to reflect the new state. + * + * @param newDirtyState the new state (true means the document is dirty). + */ + private void setDirtyFlag (boolean newDirtyState) { + m_isDirty = newDirtyState; + resetUIState(); + } void resetUIState() { SwingUtilities.invokeLater(new Runnable() { @@ -607,7 +617,7 @@ } // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } public void addPictures( Picture[] pictures, boolean select) { @@ -638,7 +648,7 @@ } // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } private void selectAddedPictures(Object[] objects, int index) { @@ -682,7 +692,7 @@ getCurrentAlbum().sortPicturesAlphabetically(); // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } @@ -739,7 +749,7 @@ }.start(); // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } public void slideshow() { @@ -788,7 +798,7 @@ getCurrentAlbum().removePictures( indices ); // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); if (reselect != null) { jPicturesList.setSelectedValue(reselect, true); @@ -820,7 +830,7 @@ jPicturesList.setSelectedIndices(reselect); // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } @@ -848,7 +858,7 @@ jPicturesList.setSelectedIndices(reselect); // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } public void selectNextPicture() { @@ -973,7 +983,7 @@ deleteSelectedPictures(); // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } public void doCopy() { @@ -988,7 +998,7 @@ } // We've been modified, we are now dirty. - m_isDirty = true; + setDirtyFlag(true); } @@ -1336,7 +1346,7 @@ m_lastOpenedFile = null; // We've been logged out, we are now clean. - m_isDirty = false; + setDirtyFlag(false); } else { // login may have failed and caused getComm to be null. GalleryComm comm = getCurrentGallery().getComm(jStatusBar); @@ -1423,7 +1433,7 @@ m_lastOpenedFile = null; // We've been reset, we are now clean. - m_isDirty = false; + setDirtyFlag(false); updateAlbumCombo(); resetUIState(); @@ -1454,7 +1464,7 @@ saveMRUItem(m_lastOpenedFile); // We've been saved, we are now clean. - m_isDirty = false; + setDirtyFlag(false); } } @@ -1469,7 +1479,7 @@ saveState(m_lastOpenedFile); // We've been saved, we are now clean. - m_isDirty = false; + setDirtyFlag(false); } /** |