Changes between Version 34 and Version 35 of PRO_LIB_CORE_TUTORIAL
- Timestamp:
- 07/09/09 19:21:30 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PRO_LIB_CORE_TUTORIAL
v34 v35 158 158 So, this is actually a Java method which returns a RwProp of Integer. The previously awkward return statement is now more clear: it instructs the ProBean of the ProObject to create a new ValueProperty with the name ''width'' which has a value of type ''Integer''. Other Properties are created in a similar fashion as is described later.[[BR]] 159 159 Thus, when you want to set or get the value of this Property you just use the set() and get() methods like in the demoCode() method above. 160 You can also initialize the value properties like in the example below, though you should note that the init value must be constant. 161 {{{ 162 ... 163 RwProp<Integer> width() { 164 return getBean().makeValueProp("width", Integer.class, 5); 165 } 166 ... 167 }}} 160 168 * '''FinalProperty<T>''':[[BR]] 161 169 This Property is somewhat analogical to the '''final''' fields in Java. You can set the value of a FinalProperty only once, though not it's not mandatory to do it in the constructor of the ProObject.[[BR]] … … 460 468 @Override 461 469 protected ProList<ResourceRef> computeSource() { 462 try { 470 if (openBooksPalette().get().firstSelectedItem() != null 471 && openBooksPalette().get().firstSelectedItem().get() != null) { 463 472 Book parentBook = ((OpenBooksPalette.BookItem) 464 473 openBooksPalette().get().firstSelectedItem() 465 474 .get()).book().get(); 466 475 return parentBook.children().get(); 467 } catch (NullPointerException e){476 } else { 468 477 return EmptyProList.get(ResourceRef.class); 469 478 } … … 518 527 * And also makes sure that other Meddles cannot "own" the same jesus(). [[BR]] 519 528 These two things actually mean that that ''each Meddle has its oooown... peeeersonal... jeeesus'' (:[[BR]] 520 Another thing to mention it is not mandatory to manually declare ParentProperties in @Owned ProObjects if you don't want to use the parent link but guarantee that the ProObjects is @Owned only by one parent. Currently the ProLib doesn't work like that though it will be fixed very soon because this should be true. 529 Another thing to mention it is not mandatory to manually declare ParentProperties in @Owned ProObjects if you don't want to use the parent link but guarantee that the ProObjects is @Owned only by one parent. Currently the ProLib doesn't work like that though it will be fixed very soon because this should be true.[[BR]] 530 Also note that though ProLib automatically sets the ParentProperties with correct values, it happens at a later stage, after the creation of the ProObject instance, so if you use the ParentProperty inside the ProObject's constructor, for instance, PArentProperty will still be null. And this is normal! You should have this in mind and write code which takes into consideration both cases and acts adequately. 521 531 522 532 == @Shared & ProUtil.clone() ==