1.1 --- a/modules/lib.charting/src/org/aiotrade/lib/charting/view/ChartView.scala Sun Nov 08 01:05:06 2009 +0800
1.2 +++ b/modules/lib.charting/src/org/aiotrade/lib/charting/view/ChartView.scala Sun Nov 08 04:27:59 2009 +0800
1.3 @@ -78,7 +78,7 @@
1.4 *
1.5 * @author Caoyuan Deng
1.6 */
1.7 -abstract class ChartView(protected var controller: ChartingController, protected var mainSer: TSer) extends {
1.8 +abstract class ChartView(protected var controller: ChartingController, protected var mainSer: TSer, empty: Boolean) extends {
1.9 val AXISX_HEIGHT = 12
1.10 val AXISY_WIDTH = 50
1.11 val CONTROL_HEIGHT = 12
1.12 @@ -106,16 +106,17 @@
1.13
1.14 private var componentAdapter: ComponentAdapter = _
1.15 private var interactive = true
1.16 - private var pinned = false;
1.17 + private var pinned = false
1.18 private val observableHelper = new ChangeObservableHelper
1.19 protected val serChangeListener = new MySerChangeListener
1.20
1.21 - def this() = this(null, null)
1.22 -
1.23 - if (controller != null && mainSer != null) {
1.24 + if (!empty) {
1.25 init(controller, mainSer)
1.26 }
1.27
1.28 + def this(controller: ChartingController, mainSer: TSer) = this(controller, mainSer, false)
1.29 + def this() = this(null, null, true)
1.30 +
1.31 def init(controller: ChartingController, mainSer: TSer) {
1.32 this.controller = controller
1.33 this.masterSer = controller.getMasterSer
1.34 @@ -158,7 +159,7 @@
1.35 protected def initComponents: Unit
1.36
1.37 private def createBasisComponents {
1.38 - setDoubleBuffered(true);
1.39 + setDoubleBuffered(true)
1.40
1.41 /**
1.42 * !NOTICE
1.43 @@ -181,19 +182,15 @@
1.44 override protected def paintComponent(g: Graphics) {
1.45 val width = getWidth
1.46 val height = getHeight
1.47 - var comps = getComponents.iterator
1.48 - while (comps.hasNext) {
1.49 - val c = comps.next
1.50 - if (c.isInstanceOf[Pane]) {
1.51 - c.setBounds(0, 0, width, height)
1.52 - }
1.53 + for (c <- getComponents if c.isInstanceOf[Pane]) {
1.54 + c.setBounds(0, 0, width, height)
1.55 }
1.56 }
1.57 - };
1.58 - mainLayeredPane.setPreferredSize(new Dimension(10, (10 - 10 / 6.18).intValue))
1.59 + }
1.60 + mainLayeredPane.setPreferredSize(new Dimension(10, (10 - 10 / 6.18).toInt))
1.61 mainLayeredPane.add(mainChartPane, JLayeredPane.DEFAULT_LAYER)
1.62
1.63 - glassPane.setPreferredSize(new Dimension(10, (10 - 10 / 6.18).intValue))
1.64 + glassPane.setPreferredSize(new Dimension(10, (10 - 10 / 6.18).toInt))
1.65
1.66 axisXPane.setPreferredSize(new Dimension(10, AXISX_HEIGHT))
1.67 axisYPane.setPreferredSize(new Dimension(AXISY_WIDTH, 10))
1.68 @@ -268,8 +265,8 @@
1.69 */
1.70 computeMaxMin
1.71 if (maxValue != oldMaxValue || minValue != oldMinValue) {
1.72 - oldMaxValue = maxValue;
1.73 - oldMinValue = minValue;
1.74 + oldMaxValue = maxValue
1.75 + oldMinValue = minValue
1.76 notifyObserversChanged(classOf[ChartValidityObserver[Any]])
1.77 }
1.78 }
2.1 --- a/modules/lib.charting/src/org/aiotrade/lib/charting/view/IndicatorChartView.scala Sun Nov 08 01:05:06 2009 +0800
2.2 +++ b/modules/lib.charting/src/org/aiotrade/lib/charting/view/IndicatorChartView.scala Sun Nov 08 04:27:59 2009 +0800
2.3 @@ -51,18 +51,12 @@
2.4 *
2.5 * @author Caoyuan Deng
2.6 */
2.7 -class IndicatorChartView(controller: ChartingController, mainSer: TSer) extends ChartView {
2.8 +class IndicatorChartView(controller: ChartingController, mainSer: TSer, empty: Boolean)
2.9 +extends ChartView(controller, mainSer, empty) {
2.10
2.11 - def this() = this(null, null)
2.12 + def this(controller: ChartingController, mainSer: TSer) = this(controller, mainSer, false)
2.13 + def this() = this(null, null, true)
2.14
2.15 - if (controller != null && mainSer != null) {
2.16 - init(controller, mainSer)
2.17 - }
2.18 -
2.19 - override def init(controller: ChartingController, mainSer: TSer) {
2.20 - super.init(controller, mainSer)
2.21 - }
2.22 -
2.23 /**
2.24 * Layout of IndicatorView
2.25 *
3.1 --- a/modules/lib.charting/src/org/aiotrade/lib/charting/view/PopupIndicatorChartView.scala Sun Nov 08 01:05:06 2009 +0800
3.2 +++ b/modules/lib.charting/src/org/aiotrade/lib/charting/view/PopupIndicatorChartView.scala Sun Nov 08 04:27:59 2009 +0800
3.3 @@ -40,17 +40,11 @@
3.4 *
3.5 * @author Caoyuan Deng
3.6 */
3.7 -class PopupIndicatorChartView(controller: ChartingController, mainSer: TSer) extends IndicatorChartView {
3.8 -
3.9 - def this() = this(null, null)
3.10 -
3.11 - if (controller != null && mainSer != null) {
3.12 - init(controller, mainSer)
3.13 - }
3.14 -
3.15 - override def init(controller: ChartingController, mainSer: TSer) {
3.16 - super.init(controller, mainSer)
3.17 - }
3.18 +class PopupIndicatorChartView(controller: ChartingController, mainSer: TSer, empty: Boolean)
3.19 +extends IndicatorChartView(controller, mainSer, empty) {
3.20 +
3.21 + def this(controller: ChartingController, mainSer: TSer) = this(controller, mainSer, false)
3.22 + def this() = this(null, null, true)
3.23
3.24 override protected def initComponents {
3.25 xControlPane = new XControlPane(this, mainChartPane)
4.1 --- a/modules/lib.chartview/src/org/aiotrade/lib/chartview/AbstractQuoteChartView.scala Sun Nov 08 01:05:06 2009 +0800
4.2 +++ b/modules/lib.chartview/src/org/aiotrade/lib/chartview/AbstractQuoteChartView.scala Sun Nov 08 04:27:59 2009 +0800
4.3 @@ -70,17 +70,14 @@
4.4
4.5 }
4.6
4.7 -abstract class AbstractQuoteChartView(controller: ChartingController, quoteSer: QuoteSer, empty: Boolean) extends ChartView with WithQuoteChart {
4.8 +abstract class AbstractQuoteChartView(controller: ChartingController, quoteSer: QuoteSer, empty: Boolean)
4.9 +extends ChartView(controller, quoteSer, empty) with WithQuoteChart {
4.10 import AbstractQuoteChartView._
4.11
4.12 private var quoteChart: QuoteChart = _
4.13 protected var maxVolume, minVolume: Float = _
4.14 protected var sec: Sec = _
4.15
4.16 - if (!empty) {
4.17 - init(controller, quoteSer)
4.18 - }
4.19 -
4.20 def this(controller: ChartingController, quoteSer: QuoteSer) = this(controller, quoteSer, false)
4.21 def this() = this(null, null, true)
4.22
5.1 --- a/modules/lib.chartview/src/org/aiotrade/lib/chartview/AnalysisQuoteChartView.scala Sun Nov 08 01:05:06 2009 +0800
5.2 +++ b/modules/lib.chartview/src/org/aiotrade/lib/chartview/AnalysisQuoteChartView.scala Sun Nov 08 04:27:59 2009 +0800
5.3 @@ -67,7 +67,8 @@
5.4 quoteChartType = AbstractQuoteChartView.internal_switchAllQuoteChartType(quoteChartType, tpe)
5.5 }
5.6 }
5.7 -class AnalysisQuoteChartView(controller: ChartingController, quoteSer: QuoteSer, empty: Boolean) extends AbstractQuoteChartView with WithDrawingPane {
5.8 +class AnalysisQuoteChartView(controller: ChartingController, quoteSer: QuoteSer, empty: Boolean)
5.9 +extends AbstractQuoteChartView(controller, quoteSer, empty) with WithDrawingPane {
5.10 import AnalysisQuoteChartView._
5.11
5.12 private var compareIndicatorToChart: HashMap[QuoteCompareIndicator, QuoteChart] = _
5.13 @@ -82,14 +83,9 @@
5.14 */
5.15 private val withDrawingPaneHelper: WithDrawingPaneHelper = new WithDrawingPaneHelper(this)
5.16
5.17 - if (!empty) {
5.18 - init(controller, quoteSer)
5.19 - }
5.20 -
5.21 + def this(controller: ChartingController, quoteSer: QuoteSer) = this(controller, quoteSer, false)
5.22 def this() = this(null, null, true)
5.23
5.24 - def this(controller: ChartingController, quoteSer: QuoteSer) = this(controller, quoteSer, false)
5.25 -
5.26 override def init(controller: ChartingController, quoteSer: TSer) {
5.27 super.init(controller, quoteSer)
5.28
6.1 --- a/modules/lib.chartview/src/org/aiotrade/lib/chartview/RealTimeQuoteChartView.scala Sun Nov 08 01:05:06 2009 +0800
6.2 +++ b/modules/lib.chartview/src/org/aiotrade/lib/chartview/RealTimeQuoteChartView.scala Sun Nov 08 04:27:59 2009 +0800
6.3 @@ -63,7 +63,8 @@
6.4
6.5 }
6.6
6.7 -class RealTimeQuoteChartView(controller: ChartingController, quoteSer: QuoteSer, empty: Boolean) extends AbstractQuoteChartView {
6.8 +class RealTimeQuoteChartView(controller: ChartingController, quoteSer: QuoteSer, empty: Boolean)
6.9 +extends AbstractQuoteChartView(controller, quoteSer, empty) {
6.10 import RealTimeQuoteChartView._
6.11
6.12 private var prevClose = Null.Float
6.13 @@ -72,14 +73,9 @@
6.14 private val cal = Calendar.getInstance
6.15 private var market: Market = _
6.16
6.17 - if (!empty) {
6.18 - init(controller, quoteSer)
6.19 - }
6.20 -
6.21 + def this(controller: ChartingController, quoteSer: QuoteSer) = this(controller, quoteSer, false)
6.22 def this() = this(null, null, true)
6.23
6.24 - def this(controller: ChartingController, quoteSer: QuoteSer) = this(controller, quoteSer, false)
6.25 -
6.26 override def init(controller: ChartingController, mainSer: TSer) {
6.27 super.init(controller, mainSer)
6.28