From: <os...@us...> - 2013-01-09 17:07:22
|
Revision: 8805 http://sourceforge.net/p/oorexx/code-0/8805 Author: osims Date: 2013-01-09 17:07:20 +0000 (Wed, 09 Jan 2013) Log Message: ----------- Various minor updates - comment out or delete 'say's, remove commented-out code, etc. Modified Paths: -------------- ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductListView.rex ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelsData.rex ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductView.rex Removed Paths: ------------- ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelData.rex Modified: ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductListView.rex =================================================================== --- ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductListView.rex 2013-01-09 16:11:55 UTC (rev 8804) +++ ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductListView.rex 2013-01-09 17:07:20 UTC (rev 8805) @@ -36,7 +36,7 @@ /*----------------------------------------------------------------------------*/ /* ooDialog User Guide - Exercise07 - ProductListView v02-00 21Aug12 + ProductListView v02-00 09Jan13 ------------- The view of a list of products. @@ -71,6 +71,8 @@ v01-00 06Jun12: First version v02-00 21Aug12: Modified to use the Model-View Framework. Comment "Ex07" shows where changes from Ex06 have been made. + 09Jan13: 'Say' instructions commented out or removed. + Standalone operation removed (not now needed). = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ ::CLASS ProductListView SUBCLASS RcView PUBLIC @@ -120,11 +122,7 @@ forward class (super) continue -- Ex07: required to get Model's data modelData = RESULT -- Ex07: model's data returned by super --say "ProductListView-activate-01: root =" root - if rootDlg = "SA" then do -- If standalone operation required - rootDlg = self -- To pass on to children - self~execute("SHOWTOP","IDI_PRODLIST_DLGICON") - end - else self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_PRODLIST_DLGICON") + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_PRODLIST_DLGICON") return self -- Ex07 @@ -204,11 +202,6 @@ --say "ProductListView-showProduct-03; root =" root objectMgr = .local~my.ObjectMgr objectMgr~showModel("ProductModel", info~text, rootDlg) --Ex07 - --.local~my.idProductData = .ProductData~newInstance -- create a ProductData instance - --.local~my.idProductModel = .ProductModel~newInstance -- create a ProductModel instance - --.local~my.idProductData~activate - --.local~my.idProductModel~activate - --.ProductView~newInstance(rootDlg,"CU003") --say "ProductListView-showProduct-04: after startProductView" self~disableControl("IDC_PRODLIST_SHOWPRODUCT") end @@ -219,12 +212,11 @@ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD loadList expose lvProducts modelData -- Ex07 - say "ProductListView-loadList-01: dataArray =" modelData -- Ex07 + --say "ProductListView-loadList-01: dataArray =" modelData -- Ex07 rows = modelData[count] -- Ex07 - number of rows arrData = modelData[records] - say "ProductListView-loadList-02:Dims =" arrData~dimension(1) arrData~dimension(2) + --say "ProductListView-loadList-02:Dims =" arrData~dimension(1) arrData~dimension(2) do i = 1 to rows - say "ProductListView-loadList-03: arr[i,1] =" arrData[i,1] -- Change file price to display format (i.e. cents to dollars.cents): displayPrice = (arrData[i,3]/100)~format(,2) lvProducts~addRow( , ,arrData[i,1], arrData[i,2], displayPrice, arrData[i,4]) Deleted: ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelData.rex =================================================================== --- ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelData.rex 2013-01-09 16:11:55 UTC (rev 8804) +++ ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelData.rex 2013-01-09 17:07:20 UTC (rev 8805) @@ -1,171 +0,0 @@ -/*----------------------------------------------------------------------------*/ -/* */ -/* Copyright (c) 2011-2013 Rexx Language Association. All rights reserved. */ -/* */ -/* This program and the accompanying materials are made available under */ -/* the terms of the Common Public License v1.0 which accompanies this */ -/* distribution. A copy is also available at the following address: */ -/* http://www.oorexx.org/license.html */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in */ -/* the documentation and/or other materials provided with the distribution. */ -/* */ -/* Neither the name of Rexx Language Association nor the names */ -/* of its contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ -/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ -/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ -/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ -/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ -/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ -/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ -/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ -/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* */ -/*----------------------------------------------------------------------------*/ -/* ooDialog User Guide - Exercise 04b: The ProductModel and ProductData Classes v00-03 08Aug11 - - Contains: classes "ProductModel", "ProductResource", and "ProductDT". - Pre-requisites: None. - - Outstanding Problems: - None. - - Changes: - v00-02: 21Jly11 - v00-03: Correct "return" statement not in right place (typo in code!!) - Renamed the ProductDT attributes (initial "prod" deemed extraneous) - - 26Aug11: added some comments - no change to function. -------------------------------------------------------------------------------*/ - - -/*////////////////////////////////////////////////////////////////////////////// - ============================================================================== - ProductModel v00-02 12Jly11 - ------------ - The "model" part of the Product component. - - interface productModel{ - aProductModel newInstance() -- Class method. - null activate() - aProductDT query() - }; - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ - -::CLASS ProductModel PUBLIC - -/*---------------------------------------------------------------------------- - Class Methods - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - ::METHOD newInstance CLASS PUBLIC - -- Creates an instance and returns it. - aProductModel = self~new - return aProductModel - - -/*---------------------------------------------------------------------------- - Instance Methods - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - ::METHOD activate PUBLIC - -- Gets its data from ProductData. - expose data - idProductData = .local~my.idProductData - data = idProductData~getData - - - ::METHOD query PUBLIC - -- Returns data requested (no argument = return all) - expose data - say "ProductModel-query." - return data -/*============================================================================*/ - - -/*////////////////////////////////////////////////////////////////////////////// - ============================================================================== - ProductData v01-00 20Jly11 - ------------ - The "data" part of the Product component. - [interface (idl format)] - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ - -::CLASS ProductData PUBLIC - -/*---------------------------------------------------------------------------- - Class Methods - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - ::METHOD newInstance CLASS PUBLIC - aProductData = self~new - return aProductData - - -/*---------------------------------------------------------------------------- - Instance Methods - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - ::METHOD activate PUBLIC - expose data - data = .ProductDT~new - data~number = "CF300/X" - data~name = "Widget Box" - data~price = "2895" - data~uom = "6" - data~description = "A 10 litre case with flat sides capable of holding quite a lot of stuff." - data~size = "M" - return - - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - ::METHOD getData PUBLIC - expose data - say "ProductData-getData." - return data - -/*============================================================================*/ - - - -/*////////////////////////////////////////////////////////////////////////////// - ============================================================================== - ProductDT - A business data type for Product data. v00-02 07Aug11 - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ - -::CLASS ProductDT PUBLIC - - -- dtName XML Name Description - -- --------- ---------- ------------------------------- - -- ProductDT product - ::ATTRIBUTE number -- number Product Number - ::ATTRIBUTE name -- name Product Description - ::ATTRIBUTE price -- price Product Price (rightmost two digits are 100ths of currency unit) ---::ATTRIBUTE currency -- currency Three-letter currency code - ::ATTRIBUTE uom -- uom Product Unit of Measure - ::ATTRIBUTE description -- descrip Product Description - ::ATTRIBUTE size -- size Produce Size Category (S/M/L) - - ::METHOD list PUBLIC - expose number name price uom description size - say "---------------" - say "ProductDT-List:" - say "Number: " number "Name:" name - say "Price:" price "UOM:" uom "Size:" size - say "Description:" description - say "---------------" -/*============================================================================*/ \ No newline at end of file Modified: ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelsData.rex =================================================================== --- ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelsData.rex 2013-01-09 16:11:55 UTC (rev 8804) +++ ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductModelsData.rex 2013-01-09 17:07:20 UTC (rev 8805) @@ -35,7 +35,7 @@ /* */ /*----------------------------------------------------------------------------*/ /* ooDialog User Guide - Exercise 07: v00-04 21Aug11 + Exercise 07: v02-00 09Jan13 The ProductModel, ProductListModel, and ProductData Classes @@ -52,6 +52,7 @@ Renamed the ProductDT attributes (initial "prod" deemed extraneous) - 26Aug11: added some comments - no change to function. v00-04 21Aug12: ProducListModel added. Modified to fit the MV Framework. + v02-00 13Jan12: Ex07: Some 'say' instructions removed or commented out. ------------------------------------------------------------------------------*/ @@ -101,7 +102,7 @@ -- self~myData (super's attribute) is a DT. So ask the data component for its -- directory version of the data (an attribute of ProductData). expose prodData - say "ProductModel-query-01: prodData =" prodData + --say "ProductModel-query-01: prodData =" prodData dir = .directory~new return prodData /*============================================================================*/ @@ -128,7 +129,7 @@ self~wantList = .true -- set super's attribute forward class (super) continue id = RESULT - say "ProductListModel-newInstance-01: id =" id + --say "ProductListModel-newInstance-01: id =" id return id @@ -140,7 +141,7 @@ expose arrData use strict arg data self~myData = data - say "ProductListModel-init-01: myData =" self~myData + --say "ProductListModel-init-01: myData =" self~myData return self ::METHOD query PUBLIC @@ -148,7 +149,7 @@ query - returns an array of all Product data. In MVF this method is invoked by the RcView (or ResView) superclass. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - say "ProductListModel-query-01." + --say "ProductListModel-query-01." return self~myData /*============================================================================*/ @@ -196,19 +197,13 @@ expose filename numRecords filename = "Product\ProductFile.txt"; columns = 6 numRecords = self~init:super(filename, columns) - say "ProductData-init-01: numRecords:" numRecords - /* - if numRecords > 0 then do - say "ProductData-init-02: Array is:" - say self~fileArray~tostring - end - */ + --say "ProductData-init-01: numRecords:" numRecords return self /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD getData PUBLIC -- ???? Use the DT??? expose data - say "ProductData-getData-01." + --say "ProductData-getData-01." return data /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductView.rex =================================================================== --- ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductView.rex 2013-01-09 16:11:55 UTC (rev 8804) +++ ooDialog/trunk/examples/userGuide/exercises/Exercise07/Product/ProductView.rex 2013-01-09 17:07:20 UTC (rev 8805) @@ -35,7 +35,7 @@ /* */ /*----------------------------------------------------------------------------*/ /* ooDialog User Guide - Exercise 06: ProductView.rex - The ProductView component v01-01 06Jum12 + Exercise 07: ProductView.rex - The ProductView component v02-00 09Jan13 Contains: classes "ProductView", "AboutDialog", and "HRSpv". @@ -51,6 +51,8 @@ Changes: v01-00 03Jun12: First version for Exercise05. v01-01 06Jun12: Minor changes for Exercise06. + v02-00 09Jan12: Removed stand-alone operation, plus some comments. + Method 'getData' removed (now redundant). ------------------------------------------------------------------------------*/ @@ -65,7 +67,7 @@ /*////////////////////////////////////////////////////////////////////////////// ============================================================================== - ProductView v01-01 06Jun12 + ProductView v02-00 09Jan13 ----------- The "view" part of the Product component. Now designed to operate from its own folder. Should be invoked from immediately outside the Product folder. @@ -73,7 +75,9 @@ Changes: v01-00 03Jun12: First version. - v01-01 06Jun12: Minor changes for Exercise06. + v01-01 06Jun12: Minor changes for Exercise06. + v02-00 09Jan13: Removed stand-alone startup (not now needed), plus some + comments. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ @@ -90,11 +94,7 @@ say ".ProductView-newInstance-01: model, rootDlg =" idModel rootDlg .Application~addToConstDir("Product\ProductView.h") -- Create an instance of ProductView and show it: - --dlg = .ProductView~new("Product\res\ProductView.dll", IDD_PRODUCT_VIEW) dlg = self~new("Product\res\ProductView.dll", IDD_PRODUCT_VIEW) - -- Check super (temp debug): - -- x = self~fred:super(); say "x =" x - say ".ProductView-newInstance-02: dlg =" dlg dlg~activate(idModel, rootDlg) --Ex07 return dlg --Ex07 @@ -109,22 +109,19 @@ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD init - --say "ProductView-init-01." forward class (super) continue /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD activate UNGUARDED expose prodData - use arg idModel, rootDlg, prodData --Ex07- note: prodData is a ProductDT. - say "ProductView-activate-01. idModel, rootDlg =" idModel rootDlg + use arg idModel, rootDlg, prodData --Ex07- note: prodData is a ProductDT. forward class (super) continue -- MVF: required to get Model's data dirdata = RESULT -- MVF: model's data returned by super - prodData = dirData[DT] - say "ProductView-activate-02: rootDlg, prodData =" rootDlg prodData + prodData = dirData[DT] -- dirData is a directory - 'DT' + -- for 'DataType' is in the directory. self~dialogState = "closable" - if rootDlg = "SA" then self~execute("SHOWTOP","IDI_PROD_DLGICON") --ADDED FOR EXERCISE06. - else self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_PROD_DLGICON") --ADDED FOR EXERCISE06. + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_PROD_DLGICON") return @@ -154,7 +151,6 @@ prodControls[ecProdPrice]~connectCharEvent(onChar) prodControls[ecUOM]~connectCharEvent(onChar) - --prodData = self~getData -- Gets data from ProductModel into prodData self~showData -- Show the data /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -189,17 +185,14 @@ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD print UNGUARDED - -- say "ProductView-print-01" ans = MessageDialog(.HRSpv~printMsg) /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD close UNGUARDED - --say "ProductView-close-01" return self~cancel:super /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD about UNGUARDED - --say "ProductView-about-01" dlg = .AboutDialog~new("ProductView.dll", IDD_PRODUCT_VIEW_ABOUT) dlg~execute("SHOWTOP") @@ -259,6 +252,7 @@ self~dialogState = "closable" prodData = newProdData + say "ProductView-saveChanges: new values are:" prodData~list return @@ -298,20 +292,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - --::METHOD getData -- Ex07 makes this method redundant - -- Get data from the ProductModel: - --expose prodData - --say "ProductView-getData-01." - -- idProductModel = .local~my.idProductModel - -- prodData = idProductModel~query -- prodData is of type ProductDT - -- return prodData - - - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ::METHOD showData -- Transfrom data (where necessary) to display format, and then disable controls. expose prodControls prodData - say "ProductView-showData-01: prodData =" prodData -- Set data in controls: prodControls[ecProdNo]~setText( prodData~number ) prodControls[ecProdName]~setText( prodData~name ) |