Changes for page WebObjects with Scala
Last modified by Ravi Mendis on 2011/05/10 02:10
From version 199.1
edited by Ravi Mendis
on 2009/09/16 19:00
on 2009/09/16 19:00
Change comment:
There is no comment for this version
To version 196.1
edited by Ravi Mendis
on 2009/09/16 19:03
on 2009/09/16 19:03
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -63,7 +63,7 @@ 63 63 64 64 {{/code}} 65 65 66 -=== Compacted imports === 66 +==== Compacted imports ==== 67 67 68 68 Two lines in Java is compacted into one in Scala. 69 69 ... ... @@ -86,7 +86,7 @@ 86 86 87 87 == WOComponents in Scala == 88 88 89 -=== Compact Constructors === 89 +==== Compact Constructors ==== 90 90 91 91 Scala allows for simpler use of multi-valued constructors than Java. 92 92 ... ... @@ -110,7 +110,7 @@ 110 110 111 111 {{/code}} 112 112 113 -=== Simplified Exception Handling === 113 +==== Simplified Exception Handling ==== 114 114 115 115 Scala doesn't force you to catch exceptions unlike in Java. 116 116 In addition, the syntax employs Scala's very powerful pattern matching to handle different exceptions. ... ... @@ -119,16 +119,16 @@ 119 119 120 120 {{code}} 121 121 122 - 123 - 124 - 125 - 126 - 127 - 128 - 129 - 130 - 131 - 122 +try { 123 + EditPageInterface epi = D2W.factory().editPageForNewObjectWithEntityNamed(_manipulatedEntityName, session()); 124 + epi.setNextPage(context().page()); 125 + nextPage = (WOComponent) epi; 126 +} catch (IllegalArgumentException e) { 127 + ErrorPageInterface epf = D2W.factory().errorPage(session()); 128 + epf.setMessage(e.toString()); 129 + epf.setNextPage(context().page()); 130 + nextPage = (WOComponent) epf; 131 +} 132 132 133 133 {{/code}} 134 134 ... ... @@ -136,18 +136,18 @@ 136 136 137 137 {{code}} 138 138 139 - 140 - 141 - 142 - 143 - 144 - 139 +try { 140 + var epi: EditPageInterface = D2W.factory.editPageForNewObjectWithEntityNamed(_manipulatedEntityName, session) 141 + epi.setNextPage(context.page) 142 + nextPage = epi.asInstanceOf[WOComponent] 143 +} catch { 144 + case e: IllegalArgumentException => { 145 145 var epf: ErrorPageInterface = D2W.factory.errorPage(session) 146 146 epf.setMessage(e.toString) 147 147 epf.setNextPage(context.page) 148 148 nextPage = epf.asInstanceOf[WOComponent] 149 - 150 - 149 + } 150 +} 151 151 152 152 {{/code}} 153 153