1 package org.telscenter.pas.otrunk.skeleton.controllers;
2
3 import java.util.Iterator;
4
5 import org.concord.framework.otrunk.DefaultOTController;
6 import org.concord.framework.otrunk.OTObjectList;
7 import org.concord.framework.otrunk.OTObjectService;
8 import org.concord.otrunk.view.OTFolderObject;
9 import org.telscenter.pas.beans.PasStep;
10 import org.telscenter.pas.hint.Hint;
11 import org.telscenter.pas.otrunk.skeleton.OTPasHint;
12 import org.telscenter.pas.otrunk.skeleton.OTPasStep;
13 import org.telscenter.pas.properties.HintSet;
14
15 public class OTPasStepController extends DefaultOTController {
16
17 public void loadRealObject(Object realObject) {
18 PasStep step = (PasStep) realObject;
19 OTPasStep otStep = (OTPasStep) otObject;
20
21
22
23
24
25 step.setTitle(otStep.getTitle());
26
27
28 step.setAuthorNotes(otStep.getAuthorNotes());
29
30
31 step.setHoverString(otStep.getHoverString());
32
33
34 OTObjectList otHintList = otStep.getHintList();
35
36 HintSet hintSet = new HintSet();
37
38 for(int i=0; i<otHintList.size(); i++){
39 OTPasHint otHint = (OTPasHint) otHintList.get(i);
40 Hint newHint = new Hint();
41 newHint.setText(otHint.getText());
42 hintSet.add(newHint);
43 }
44 step.setHintSet(hintSet);
45 }
46
47 public void registerRealObject(Object arg0) {
48 }
49
50 public void saveRealObject(Object realObject) {
51 PasStep pasStep = (PasStep) realObject;
52 OTPasStep otPasStep = (OTPasStep) otObject;
53
54 otPasStep.setTitle(pasStep.getTitle());
55 otPasStep.setAuthorNotes(pasStep.getAuthorNotes());
56 otPasStep.setHoverString(pasStep.getHoverString());
57
58 HintSet hintSet = pasStep.getHintSet();
59
60 if( hintSet != null ) {
61 OTObjectList otHintList = otPasStep.getHintList();
62
63
64
65
66
67 otHintList.removeAll();
68
69 OTObjectService objService = otObject.getOTObjectService();
70 for (Hint hint : hintSet) {
71 try {
72 OTPasHint otHint = (OTPasHint) objService.createObject(OTPasHint.class);
73 otHint.setText(hint.getText());
74 otHintList.add(otHint);
75 } catch (Exception e) {
76 e.printStackTrace();
77 }
78 }
79
80 }
81
82
83
84 }
85
86 }