001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.samples.daytrader.client;
018    
019    import java.util.Date;
020    import java.math.BigDecimal;
021    import org.apache.geronimo.samples.daytrader.*;
022    
023    public class TradeStreamerQuoteDataBean extends QuoteDataBean {
024    
025            private BigDecimal auditPrice;
026            private double auditVolume;
027            private Date lastUpdate;
028            private ChangeModel changeModel;
029            private AuditModel auditPriceModel;
030            private AuditModel auditVolumeModel;
031    
032            /**
033             * Gets the price
034             * @return Returns a BigDecimal
035             */
036            public BigDecimal getAuditPrice() {
037                    return auditPrice;
038            }
039    
040            /**
041             * Sets the price
042             * @param price The price to set
043             */
044            public void setAuditPrice(BigDecimal auditPrice) {
045                    this.auditPrice = auditPrice;
046                    setAuditPriceModel(auditPrice);
047            }
048    
049            /**
050             * Gets the volume
051             * @return Returns a BigDecimal
052             */
053            public double getAuditVolume() {
054                    return auditVolume;
055            }
056    
057            /**
058             * Sets the volume
059             * @param volume The volume to set
060             */
061            public void setAuditVolume(double auditVolume) {
062                    this.auditVolume = auditVolume;
063                    setAuditVolumeModel(auditVolume);
064            }
065    
066            /**
067             * Gets the last update date of the quote
068             * @return Returns the last update date
069             */
070            public Date getLastUpdate() {
071                    return lastUpdate;
072            }
073    
074            /**
075             * Sets the change since open
076             * Overridden to provide model class for JTable to render
077             */
078            public void setChange(double change) {
079                    changeModel = new ChangeModel(change);
080                    super.setChange(change);
081            }
082    
083            /**
084             * Gets the change model since open
085             * @return the change model
086             */
087            public ChangeModel getChangeModel() {
088                    return changeModel;
089            }
090    
091            /**
092             * Gets the audit price model
093             * @return the audit price model
094             */
095            public AuditModel getAuditPriceModel() {
096                    return auditPriceModel;
097            }
098    
099            /**
100             * Sets the audit price model
101             * @param price the audit price
102             */
103            public void setAuditPriceModel(BigDecimal aPrice) {
104                    if (auditPriceModel != null) {
105                            auditPriceModel.setAuditPrice(aPrice);
106                    }
107                    else {
108                            auditPriceModel = new AuditModel(aPrice);
109                    }
110            }
111    
112            /**
113             * Gets the audit volume model
114             * @return the audit volume model
115             */
116            public AuditModel getAuditVolumeModel() {
117                    return auditVolumeModel;
118            }
119    
120            /**
121             * Sets the audit volume model
122             * @param volume the audit volume
123             */
124            public void setAuditVolumeModel(double aVolume) {
125                    if (auditVolumeModel != null) {
126                            auditVolumeModel.setAuditVolume(aVolume);
127                    }
128                    else {
129                            auditVolumeModel = new AuditModel(aVolume);
130                    }
131            }
132    
133            /**
134             * Sets the last update date of the quote
135             * @param lastUpdate the last update date of the quote
136             */
137            public void setLastUpdate(Date lastUpdate) {
138                    this.lastUpdate = lastUpdate;
139            }
140    
141            public String toString() {
142                    return "\n\tAudit Quote Data for: " + getSymbol() +
143                            //"\n\t\t   statsOrder: " + getStatsOrder() +
144                            "\n\t\t       volume: " + getVolume() +
145                            "\n\t\t        price: " + getPrice() +
146                            "\n\t\t audit volume: " + getAuditVolume() +
147                            "\n\t\t  audit price: " + getAuditPrice();
148            }
149    }