Скачать презентацию
Идет загрузка презентации. Пожалуйста, подождите
Презентация была опубликована 10 лет назад пользователемАлиса Терёхина
1 Where OO meets the GUI for.NET Its new, its different, its still just ABL Session 135 Peter Judge Principal Software Engineer OpenEdge Development
2 © 2009 Progress Software Corporation. All rights reserved. What is the GUI for.NET? ABL Code Classes Procedures Built-in objects OE Architect Visual Designer WinForms Controls & components Microsoft UltraControls 3 rd -party 2
3 © 2009 Progress Software Corporation. All rights reserved. Who does what? OpenEdge Built-in Progress.* classes do the ABL-to-.NET talking All ABL classes inherit Progress.Lang.Object -All.NET classes inherit System.Object … which also inherits Progress.Lang.Object You Composition of UI UI logic Business logic procedures or classes (on AppServer) 3
4 © 2009 Progress Software Corporation. All rights reserved. Building blocks used by Demo OOABL Classes MainForm ItemUserControl DepartmentDataObject CustomerDataObject SalesrepDataObject.NET Controls OpenEdge built-ins Progress.Windows.Form Progress.Windows.UserControl Progress.Data.BindingSource Microsoft System.Windows.Forms TextBox & Label DataGridView TreeView SplitContainer Panel GroupBox Sports2000 4
5 © 2009 Progress Software Corporation. All rights reserved. If you can read this, we survived the demo 5
6 © 2009 Progress Software Corporation. All rights reserved. Form design Start with static nodes Easy resizing & layout Multiple UI elements share ABL data Compose complex controls: ABL User Controls 6
7 © 2009 Progress Software Corporation. All rights reserved. ProBindingSource: Binding UI controls to ProDataSet data Set DataSource, DataMember on dataGridOrder Set BindingSourceProp on Item detail UserControl edtItemNum:DataBindings:Add(new Binding( "Text", BindingSourceProp, "eOrder.eOrderLine.eItem.ItemNum")). dataGridOrder:DataMember = "eOrder". dataGridOrder:DataSource = bsCustomer. ucItems1:BindingSourceProp = bsCustomer. eCustomer eOrder eOrderLine eItem ItemNum ProDataSet 7
8 © 2009 Progress Software Corporation. All rights reserved. Interacting with the.NET UI: Handling UI events 8 method private InitializeComponent(): /* lotsa stuff */ treeView1:NodeMouseClick:subscribe(treeView1_NodeMouseClick). method private void treeview1_NodeMouseClick( sender as System.Object, e as TreeNodeMouseClickEventArgs ): System.EventArgs System.Windows.Forms. MouseEventArgs System.Windows.Forms. TreeNodeMouseClickEventArgs Empty : System.EventArgs Button : MouseButtons Clicks : integer Node : TreeNode
9 © 2009 Progress Software Corporation. All rights reserved. Interacting with the.NET UI: tree node click event handler Everythings an object e:Node - Just Like Any Other Node Object Chained calls Call ABL node creation method Using USING Makes Life Easier! using System.Windows.Forms.*. method private void tree1_NodeMouseClick( sender as System.Object, e as TreeNodeMouseClickEventArgs ): /* Deal with top level (zero-based) */ if e:Node:Level eq 0 then do: cNodeName = e:Node:Name. /* only create the children once. */ if e:Node:Nodes:Count eq 0 then case cNodeName: when 'CustomerNode' then do: CreateCustomerNodes(). DecorateCustomerNodes(). end./* customer */ 8
10 © 2009 Progress Software Corporation. All rights reserved. CreateCustomerNodes() method oData contains filled ProDataSet DatasetHandle property same as handle variable BindingSource uses ProDataSet Nodes property collection of Node objects Query stuff is all standard ABL Can work on new node def var oParent, oNode as TreeNode. oData = GetCustomerData(). hBuffer = oData:DatasetHandle :get-buffer-handle('eCustomer'). bsCustomer:Handle = oData:DatasetHandle. oParent = treeView1:Nodes:Item['CustomerNode']. /* create ABL query, set buffers */ hQuery:query-prepare ('preselect each eCustomer by Name'). hQuery:query-open(). hQuery:get-first(). do while hBuffer:available: cKey = hBuffer::CustNum. cText = hBuffer::Name. oNode = oParent:Nodes:Add(cKey, cText). oNode:Tag = 'Some extra info'. 10
11 © 2009 Progress Software Corporation. All rights reserved. DecorateCustomerNodes() method Get node by name or by index Zero-based counting Standard ABL query finds data to manipulate.NET UI Node colour based on business rules def var oCustomerNodes as TreeNodeCollection. oCustomerNodes = treeView1:Nodes['CustomerNode']:Nodes. do iLoop = 0 to oCustomerNodes:Count - 1: oNode = oCustomerNodes[iLoop]. /* hBuffer from oData, as earlier */ hBuffer:find-unique( ' where CustNum = ' + quoter(oNode:Name)). dPercent = hBuffer::Balance / hBuffer::CreditLimit * 100. if dPercent > 90 then oNode:BackColor = System.Drawing.Color:Red. 11
12 © 2009 Progress Software Corporation. All rights reserved. Customer data binding One BindingSource binds to one ProDataSet providing multi-level data to UI controls Automaticlinked navigation via ProDataSet data-relations WICKED cool, no? Customer BindingSource Orders OrderLines Items 12
13 © 2009 Progress Software Corporation. All rights reserved. ProBindingSource: Binding UI controls to an ABL query Not using ProDataSets? Use a query instead Can even query PDS data Always single- level to UI Provides data to multiple controls Salesrep BindingSource create query hQuery. hQuery:query-prepare('for each eSalesrep'). bsSalesrep:Handle = hQuery. create query hQuery. hQuery:query-prepare('for each eSalesrep'). bsSalesrep:Handle = hQuery. 13
14 © 2009 Progress Software Corporation. All rights reserved. Sorting the DataGridView Standard event handler signature Sorting location depends on control, could be on grid or BindingSource Identity is not equality Build standard ABL query off event args Easily make this generic method void BindingSource_SortRequest( sender as System.Object, e as Progress.Data.SortRequestEventArgs): if sender:Equals(bsSalesrep) then do: hQuery = bsSalesrep:Handle. cSortBy = ' by ' + e:FieldName. if not e:Ascending then cSortBy = cSortBy + ' desc '. hQuery:query-prepare ('for each eSalesrep ' + cSortBy). hQuery:query-open(). end. end method. method void BindingSource_SortRequest( sender as System.Object, e as Progress.Data.SortRequestEventArgs): if sender:Equals(bsSalesrep) then do: hQuery = bsSalesrep:Handle. cSortBy = ' by ' + e:FieldName. if not e:Ascending then cSortBy = cSortBy + ' desc '. hQuery:query-prepare ('for each eSalesrep ' + cSortBy). hQuery:query-open(). end. end method. 14
15 © 2009 Progress Software Corporation. All rights reserved. Alternate controls: same data, same business logic, much prettier, different & more features Microsoft controls do the basics Vendor-specific functionality Grouping, multi-column sorting, multi-level browsing Filters, aggregates Themes / skins 15 Presentation layer design opportunity: OERA, MVP et al
16 © 2009 Progress Software Corporation. All rights reserved. What you see is.NET, what you get is ABL.NET … Paints stuff on screen Fires UI events : Click, Resize, Sort ABL … Works with data -Temp-tables, queries, ProDataSets -Built-in ProBindingSource talks both ways Handles UI events Invokes methods & classes, set properties -Same on all types: OO ABL and.NET 16
17 © 2009 Progress Software Corporation. All rights reserved. Where can I learn more? Right here at ExchangeOnlineOhNine Shelley Chases Introducing OpenEdge GUI for.NET Alex Herbstritts Advanced OO Techniques Niels Bredegaards Tales from the Trenches: Using the GUI for.NET OpenEdge Documentations Getting Started books Object Oriented Programming Introducing the OpenEdge Architect Visual Designer GUI for.NET Mapping Reference GUI for.NET Programming OpenEdge Architect : Class browser, help files, etc Progress Communities discussions (forums) 3 rd party control vendors documentation, support, forums MSDN 17
18 © 2009 Progress Software Corporation. All rights reserved. Conclusion Pretty easy, right? Its Just ABL … and youre all experts in ABL From the ABL, you dont care if its.NET 18
19 © 2009 Progress Software Corporation. All rights reserved. Peter Judge Principal Software Engineer, OpenEdge Development 19
Еще похожие презентации в нашем архиве:
© 2024 MyShared Inc.
All rights reserved.