001    /*
002     * $Id: FrameDirtyInfo.java,v 1.8 2012/02/19 17:35:44 davep Exp $
003     *
004     * This file is part of McIDAS-V
005     *
006     * Copyright 2007-2012
007     * Space Science and Engineering Center (SSEC)
008     * University of Wisconsin - Madison
009     * 1225 W. Dayton Street, Madison, WI 53706, USA
010     * https://www.ssec.wisc.edu/mcidas
011     * 
012     * All Rights Reserved
013     * 
014     * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
015     * some McIDAS-V source code is based on IDV and VisAD source code.  
016     * 
017     * McIDAS-V is free software; you can redistribute it and/or modify
018     * it under the terms of the GNU Lesser Public License as published by
019     * the Free Software Foundation; either version 3 of the License, or
020     * (at your option) any later version.
021     * 
022     * McIDAS-V is distributed in the hope that it will be useful,
023     * but WITHOUT ANY WARRANTY; without even the implied warranty of
024     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
025     * GNU Lesser Public License for more details.
026     * 
027     * You should have received a copy of the GNU Lesser Public License
028     * along with this program.  If not, see http://www.gnu.org/licenses.
029     */
030    
031    package edu.wisc.ssec.mcidasv.data;
032    
033    
034    /**
035     * Class FrameDirtyInfo Holds the state of
036     * the frame components from McIdas-X
037     */
038    public class FrameDirtyInfo {
039            
040            /** Which frame number is this for */
041            public int frameNumber = 0;
042    
043        /** Dirty status of each component */
044        public boolean dirtyImage = false;
045        public boolean dirtyGraphics = false;
046        public boolean dirtyColorTable = false;
047    
048        /**
049         * Constructor
050         */
051        public FrameDirtyInfo() {}
052    
053        /**
054         * Copy constructor
055         *
056         * @param that The FrameDirtyInfo to copy
057         *
058         */
059        public FrameDirtyInfo(FrameDirtyInfo that) {
060            this.frameNumber     = that.frameNumber;
061            this.dirtyImage      = that.dirtyImage;
062            this.dirtyGraphics   = that.dirtyGraphics;
063            this.dirtyColorTable = that.dirtyColorTable;
064        }
065    
066        /**
067         * Constructor
068         */
069        public FrameDirtyInfo( int frameNumber, boolean isDirtyImage, boolean isDirtyGraphics, boolean isDirtyColorTable) {
070            this.frameNumber     = frameNumber;
071            this.dirtyImage      = isDirtyImage;
072            this.dirtyGraphics   = isDirtyGraphics;
073            this.dirtyColorTable = isDirtyColorTable;
074        }
075    
076        /**
077         * Get the frameNumber property.
078         *
079         * @return The frameNumber property.
080         */
081        public int getFrameNumber() {
082            return this.frameNumber;
083        }
084        
085        /**
086         * Get the dirtyImage property.
087         *
088         * @return The dirtyImage property.
089         */
090        public boolean getDirtyImage() {
091            return this.dirtyImage;
092        }
093    
094        /**
095         * Get the dirtyGraphics property.
096         *
097         * @return The dirtyGraphics property.
098         */
099        public boolean getDirtyGraphics() {
100            return this.dirtyGraphics;
101        }
102    
103    
104        /**
105         * Get the dirtyColorTable property.
106         *
107         * @return The dirtyColorTable property.
108         */
109        public boolean getDirtyColorTable() {
110            return this.dirtyColorTable;
111        }
112    
113        /**
114         * Set the frameNumber property.
115         *
116         * @param newValue The new vaue for the frameNumber property.
117         */
118        public void setFrameNumber(int newValue) {
119            this.frameNumber = newValue;
120        }
121        
122        /**
123         * Set the dirtyImage property.
124         *
125         * @param newValue The new vaue for the dirtyImage property.
126         */
127        public void setDirtyImage(boolean newValue) {
128            this.dirtyImage = newValue;
129        }
130    
131        /**
132         * Set the dirtyGraphics property.
133         *
134         * @param newValue The new vaue for the dirtyGraphics property.
135         */
136        public void setDirtyGraphics(boolean newValue) {
137            this.dirtyGraphics = newValue;
138        }
139    
140        /**
141         * Set the dirtyColorTable property.
142         *
143         * @param newValue The new vaue for the dirtyColorTable property.
144         */
145        public void setDirtyColorTable(boolean newValue) {
146            this.dirtyColorTable = newValue;
147        }
148    
149        /**
150         * Get a String representation of this object
151         * @return a string representation
152         */
153        public String toString() {
154            boolean clean = true;
155            StringBuffer buf = new StringBuffer();
156            buf.append("frame ");
157            buf.append(this.frameNumber);
158            buf.append(": ");
159            if (this.dirtyImage) {
160                    if (clean) buf.append("dirty ");
161                    else buf.append (", ");
162                    clean = false;
163                    buf.append("image");
164            }
165            if (this.dirtyGraphics) {
166                    if (clean) buf.append("dirty ");
167                    else buf.append (", ");
168                    clean = false;
169                    buf.append("graphics");
170            }
171            if (this.dirtyColorTable) {
172                    if (clean) buf.append("dirty ");
173                    else buf.append (", ");
174                    clean = false;
175                    buf.append("colortable");
176            }
177            if (clean) buf.append("clean");
178            return buf.toString();
179        }
180    
181    }