merged
authorMarkus Kienleitner <mkienleitner@student.tugraz.at>
Fri, 17 Feb 2012 17:33:45 +0100
changeset 4205fedfcbdefbd2
parent 4203 dbdcbb4df54d
parent 4204 11d23edb3e90
child 4207 1dd3663f9ca2
child 4209 74118eb61cbe
merged
     1.1 --- a/src/java/isac/wsdialog/RlbLearn.drl	Fri Feb 17 16:14:47 2012 +0100
     1.2 +++ b/src/java/isac/wsdialog/RlbLearn.drl	Fri Feb 17 17:33:45 2012 +0100
     1.3 @@ -44,8 +44,8 @@
     1.4  
     1.5  rule "UI_CLOSE_WORKSHEET AND no worksheet is open"
     1.6    when
     1.7 -    WorksheetDialogRLB(request == EUIElement.UI_CLOSE_WORKSHEET, session.getWSDialogManager().numberOpenedWSDialoges() == 0)
     1.8 -    $wsd : WorksheetDialogRLB()
     1.9 +    WorksheetDialog(request == EUIElement.UI_CLOSE_WORKSHEET, session.getWSDialogManager().numberOpenedWSDialoges() == 0)
    1.10 +    $wsd : WorksheetDialog()
    1.11    then
    1.12       $wsd.getCalcTree().destruct();
    1.13       session.getWSDialogManager().closeWSDialog($wsd.getWorksheetID());
    1.14 @@ -55,8 +55,8 @@
    1.15  
    1.16  rule "UI_CLOSE_WORKSHEET AND at least on worksheet is open"
    1.17    when
    1.18 -    WorksheetDialogRLB(request == EUIElement.UI_CLOSE_WORKSHEET, session.getWSDialogManager().numberOpenedWSDialoges() != 0)
    1.19 -    $wsd : WorksheetDialogRLB()
    1.20 +    WorksheetDialog(request == EUIElement.UI_CLOSE_WORKSHEET, session.getWSDialogManager().numberOpenedWSDialoges() != 0)
    1.21 +    $wsd : WorksheetDialog()
    1.22    then
    1.23       $wsd.getCalcTree().destruct();
    1.24       session.getWSDialogManager().closeWSDialog($wsd.getWorksheetID());
    1.25 @@ -65,7 +65,7 @@
    1.26  
    1.27  rule "UI_ACTIVE_WORKSHEET set into Context"
    1.28    when 
    1.29 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_ACTIVE_WORKSHEET)
    1.30 +    $wsd : WorksheetDialog(request == EUIElement.UI_ACTIVE_WORKSHEET)
    1.31    then
    1.32      session.getWSDialogManager().setActiveWSDialog($wsd.getWorksheetID());
    1.33      $wsd.notifyContextPresenter();
    1.34 @@ -75,35 +75,35 @@
    1.35  
    1.36  rule DIALOGPHASE_IDLE
    1.37    when 
    1.38 -    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.39 +    $wsd : WorksheetDialog(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.40    then
    1.41       throw new DialogProtocolException(request, $wsd.getPhase());
    1.42  end
    1.43  
    1.44  rule "DIALOGPHASE_SPECIFY AND request.ordinal() < UI_DUMMY_FIRST_SPECIFY.ordinal()"
    1.45    when 
    1.46 -    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.47 +    $wsd : WorksheetDialog(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.48    then
    1.49       throw new DialogProtocolException(request, $wsd.getPhase());
    1.50  end
    1.51  
    1.52  rule "DIALOGPHASE_SPECIFY AND request.ordinal() > UI_DUMMY_LAST_SPECIFY.ordinal()"
    1.53    when 
    1.54 -    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.55 +    $wsd : WorksheetDialog(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.56    then
    1.57       throw new DialogProtocolException(request, $wsd.getPhase());
    1.58  end
    1.59  
    1.60  rule "DIALOGPHASE_SOLVE AND request.ordinal() < UI_DUMMY_FIRST_SOLVE.ordinal()"
    1.61    when 
    1.62 -    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.63 +    $wsd : WorksheetDialog(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.64    then
    1.65       throw new DialogProtocolException(request, $wsd.getPhase());
    1.66  end
    1.67  
    1.68  rule "DIALOGPHASE_SOLVE AND request.ordinal() > UI_DUMMY_LAST_SOLVE.ordinal()"
    1.69    when 
    1.70 -    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.71 +    $wsd : WorksheetDialog(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    1.72    then
    1.73       throw new DialogProtocolException(request, $wsd.getPhase());
    1.74  end
    1.75 @@ -114,7 +114,7 @@
    1.76  
    1.77  rule UI_SOLVE_SHOW_CALCHEAD
    1.78    when
    1.79 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SHOW_CALCHEAD)
    1.80 +    $wsd : WorksheetDialog(request == EUIElement.UI_SOLVE_SHOW_CALCHEAD)
    1.81    then
    1.82      $wsd.startSpecifying((CalcHead) context_formula.getElement());
    1.83  end
    1.84 @@ -124,7 +124,7 @@
    1.85  rule UI_SPECIFY_EDIT_ACTIVE_FORMULA_COMPLETE
    1.86    dialect "java"
    1.87    when
    1.88 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_EDIT_ACTIVE_FORMULA_COMPLETE)
    1.89 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_EDIT_ACTIVE_FORMULA_COMPLETE)
    1.90    then
    1.91      CalcHead ch_to_check = (CalcHead)((UserActionOnCalcElement) action).getCalcElement();
    1.92      calc_head = $wsd.getCalcTree().checkCalcHead(ch_to_check);
    1.93 @@ -136,7 +136,7 @@
    1.94  rule UI_SPECIFY_COMPLETE_CALCHEAD
    1.95    dialect "java"
    1.96    when
    1.97 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_COMPLETE_CALCHEAD, !calc_head.isComplete())
    1.98 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_COMPLETE_CALCHEAD, !calc_head.isComplete())
    1.99    then
   1.100      calc_head = $wsd.getCalcTree().completeCalcHead();
   1.101      $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_COMPLETE_CALCHEAD,EUIContext.UI_CONTEXT_CALCHEAD, user_language,calc_head));
   1.102 @@ -145,7 +145,7 @@
   1.103  rule UI_SPECIFY_COMPLETE_RELATE
   1.104    dialect "java"
   1.105    when
   1.106 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_COMPLETE_RELATE)
   1.107 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_COMPLETE_RELATE)
   1.108    then
   1.109      throw new DialogNotImplementedException(request, $wsd.getPhase());
   1.110  end
   1.111 @@ -155,7 +155,7 @@
   1.112  rule UI_SPECIFY_CHECK_CALCHEAD
   1.113    dialect "java"
   1.114    when
   1.115 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CHECK_CALCHEAD)
   1.116 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_CHECK_CALCHEAD)
   1.117    then
   1.118      CalcHead ch_to_check = (CalcHead) ((UserActionOnCalcElement) action).getCalcElement();
   1.119      calc_head = $wsd.getCalcTree().checkCalcHead(ch_to_check);
   1.120 @@ -167,7 +167,7 @@
   1.121  rule UI_SPECIFY_COMPLETE_STEPWISE
   1.122    dialect "java"
   1.123    when
   1.124 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_COMPLETE_STEPWISE, !calc_head.isComplete())
   1.125 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_COMPLETE_STEPWISE, !calc_head.isComplete())
   1.126    then
   1.127      calc_head = $wsd.getCalcTree().nextSpecify();
   1.128      $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_COMPLETE_STEPWISE,EUIContext.UI_CONTEXT_CALCHEAD, user_language,calc_head));
   1.129 @@ -178,7 +178,7 @@
   1.130  rule UI_SPECIFY_CLOSE_CALCHEAD
   1.131    dialect "java"
   1.132    when
   1.133 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CLOSE_CALCHEAD)
   1.134 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_CLOSE_CALCHEAD)
   1.135    then
   1.136      $wsd.doUIAction(new UIAction(EUIElement.UI_SPECIFY_CLOSE_CALCHEAD,EUIContext.UI_CONTEXT_SWITCH_PHASES, user_language));
   1.137      $wsd.setPhase($wsd.DIALOGPHASE_SOLVE);
   1.138 @@ -189,7 +189,7 @@
   1.139  rule UI_SPECIFY_RESET
   1.140    dialect "java"
   1.141    when
   1.142 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_RESET)
   1.143 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_RESET)
   1.144    then
   1.145      $wsd.getCalcTree().resetCalcHead();
   1.146      calc_head = $wsd.getCalcTree().modelProblem();
   1.147 @@ -202,9 +202,9 @@
   1.148    dialect "java"
   1.149    salience( 1 )
   1.150    when
   1.151 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, !calc_head.isComplete())
   1.152 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, !calc_head.isComplete())
   1.153  
   1.154 -    WorksheetDialogRLB(!calc_head.isComplete())
   1.155 +    WorksheetDialog(!calc_head.isComplete())
   1.156    then
   1.157      calc_head = $wsd.getCalcTree().completeCalcHead();
   1.158  
   1.159 @@ -213,7 +213,7 @@
   1.160  rule "UI_SPECIFY_CALCULATE_ALL and  !calc_head.isComplete() 2nd check"
   1.161    dialect "java"
   1.162    when
   1.163 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, !calc_head.isComplete())
   1.164 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, !calc_head.isComplete())
   1.165    then
   1.166      $wsd.getCalcTree().resetCalcHead();
   1.167      calc_head = $wsd.getCalcTree().completeCalcHead();
   1.168 @@ -224,7 +224,7 @@
   1.169  rule "UI_SPECIFY_CALCULATE_ALL and  calc_head.isComplete()"
   1.170    dialect "java"
   1.171    when
   1.172 -    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, calc_head.isComplete())
   1.173 +    $wsd : WorksheetDialog(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, calc_head.isComplete())
   1.174    then
   1.175      $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_CALCULATE_ALL,EUIContext.UI_CONTEXT_CALCHEAD, user_language, calc_head));
   1.176      $wsd.doUIAction(new UIAction(EUIElement.UI_SPECIFY_CLOSE_CALCHEAD,EUIContext.UI_CONTEXT_SWITCH_PHASES, user_language));
   1.177 @@ -236,9 +236,9 @@
   1.178  rule NextButtonOnCalcHead
   1.179      dialect "java"
   1.180      when
   1.181 -        WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_1 &&
   1.182 +        WorksheetDialog(request == EUIElement.UI_SOLVE_CALCULATE_1 &&
   1.183                             active_formula_.onCalcHead())
   1.184 -        $wsd : WorksheetDialogRLB()
   1.185 +        $wsd : WorksheetDialog()
   1.186      then
   1.187          $wsd.getCalcTree().completeCalcHead();
   1.188          try{
   1.189 @@ -256,9 +256,9 @@
   1.190  rule NextButtonNotOnCalcHead
   1.191    dialect "java"
   1.192      when
   1.193 -        WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_1 &&
   1.194 +        WorksheetDialog(request == EUIElement.UI_SOLVE_CALCULATE_1 &&
   1.195                             !active_formula_.onCalcHead())
   1.196 -        $wsd : WorksheetDialogRLB()
   1.197 +        $wsd : WorksheetDialog()
   1.198      then
   1.199          $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   1.200                    DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_SOLVE_CALCULATE_1);
   1.201 @@ -268,8 +268,8 @@
   1.202  rule AutoButton
   1.203    dialect "java"
   1.204    when
   1.205 -    WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_ALL)
   1.206 -    $wsd : WorksheetDialogRLB()
   1.207 +    WorksheetDialog(request == EUIElement.UI_SOLVE_CALCULATE_ALL)
   1.208 +    $wsd : WorksheetDialog()
   1.209     then
   1.210      $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   1.211                DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_SOLVE_CALCULATE_ALL);
   1.212 @@ -280,15 +280,15 @@
   1.213  
   1.214  rule UI_SOLVE_CALCULATE_SUBPROBLEM
   1.215    when
   1.216 -    WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_SUBPROBLEM)
   1.217 -    $wsd : WorksheetDialogRLB()
   1.218 +    WorksheetDialog(request == EUIElement.UI_SOLVE_CALCULATE_SUBPROBLEM)
   1.219 +    $wsd : WorksheetDialog()
   1.220    then
   1.221      $wsd.getCalcTree().autoCalculate(IToCalc.SCOPE_SUBPROBLEM, 0);
   1.222  end
   1.223  
   1.224  rule UI_SOLVE_EDIT_ACTIVE_FORMULA
   1.225    when
   1.226 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA)
   1.227 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA)
   1.228    then
   1.229      $wsd.getUi_control_listener().doUIAction(new UIAction(EUIElement.UI_DO_EDIT_FORMULA,EUIContext.UI_CONTEXT_ONEELEMENT, user_language));
   1.230  end
   1.231 @@ -297,7 +297,7 @@
   1.232  rule "UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE and formula.getPosition() == null"
   1.233    when
   1.234      //CalcFormula formula = ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement());
   1.235 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition() == null)
   1.236 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition() == null)
   1.237    then
   1.238      $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   1.239                DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_DO_APPEND_FORMULA, 
   1.240 @@ -309,7 +309,7 @@
   1.241  rule "UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE and formula.getPosition() != null"
   1.242    when
   1.243      //CalcFormula formula = ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement());
   1.244 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition() != null)
   1.245 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition() != null)
   1.246    then
   1.247      $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   1.248                DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_DO_EDIT_FORMULA,
   1.249 @@ -320,14 +320,14 @@
   1.250  
   1.251  rule UI_SOLVE_APPEND_USER_FORMULA
   1.252    when
   1.253 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_APPEND_USER_FORMULA)
   1.254 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_APPEND_USER_FORMULA)
   1.255    then
   1.256      $wsd.getUi_control_listener().doUIAction(new UIAction(EUIElement.UI_DO_APPEND_FORMULA,EUIContext.UI_CONTEXT_ONEELEMENT, user_language));
   1.257  end
   1.258  
   1.259  rule UI_SOLVE_MOVE_ACTIVE_FORMULA
   1.260    when
   1.261 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_MOVE_ACTIVE_FORMULA)
   1.262 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_MOVE_ACTIVE_FORMULA)
   1.263    then
   1.264      UserActionOnPosition uaop = (UserActionOnPosition) action;
   1.265      Position activePosition = uaop.getPosition();
   1.266 @@ -337,7 +337,7 @@
   1.267  
   1.268  rule UI_SOLVE_CHANGE_CONTEXT_FORMULA
   1.269    when
   1.270 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CHANGE_CONTEXT_FORMULA, ((UserActionOnPosition) action).getPosition() != null)
   1.271 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_CHANGE_CONTEXT_FORMULA, ((UserActionOnPosition) action).getPosition() != null)
   1.272    then
   1.273      $wsd.setContextFormula(new CalcIterator(((CalcTree)$wsd.getCalcTree()), ((UserActionOnPosition) action).getPosition()));
   1.274      $wsd.notifyContextPresenter();
   1.275 @@ -345,14 +345,14 @@
   1.276  
   1.277  rule UI_SOLVE_GET_PROPOSED_TACTIC
   1.278    when
   1.279 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_GET_PROPOSED_TACTIC)
   1.280 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_GET_PROPOSED_TACTIC)
   1.281    then
   1.282      throw new DialogNotImplementedException(request, $wsd.getPhase());
   1.283  end
   1.284  
   1.285  rule UI_SOLVE_GET_APPLICABLE_TACTICS
   1.286    when
   1.287 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_GET_APPLICABLE_TACTICS)
   1.288 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_GET_APPLICABLE_TACTICS)
   1.289    then
   1.290      $wsd.sendApplicableTacticsToWorksheet(context_formula);
   1.291      $wsd.doUIAction(new UIAction(EUIElement.UI_SOLVE_SHOW_APPLICABLE_TACTICS,EUIContext.UI_CONTEXT_ONEELEMENT, user_language));
   1.292 @@ -361,7 +361,7 @@
   1.293  rule UI_SOLVE_SET_NEXT_TACTIC
   1.294    dialect "java"
   1.295    when
   1.296 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SET_NEXT_TACTIC)
   1.297 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_SET_NEXT_TACTIC)
   1.298    then
   1.299      UserActionOnCalcElement uaoce = (UserActionOnCalcElement)action;
   1.300  
   1.301 @@ -376,14 +376,14 @@
   1.302  
   1.303  rule UI_SOLVE_HELP_ENTERING_FORMULA
   1.304    when
   1.305 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_HELP_ENTERING_FORMULA)
   1.306 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_HELP_ENTERING_FORMULA)
   1.307    then
   1.308      throw new DialogNotImplementedException(request, $wsd.getPhase());
   1.309  end
   1.310  
   1.311  rule UI_SOLVE_SHOW_ASSUMPTIONS
   1.312    when
   1.313 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SHOW_ASSUMPTIONS)
   1.314 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_SHOW_ASSUMPTIONS)
   1.315    then
   1.316      Assumptions asm = context_formula.getAssumptions();
   1.317      $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SOLVE_SHOW_ASSUMPTIONS,EUIContext.UI_CONTEXT_CALCELEMENTS, user_language, asm));
   1.318 @@ -391,15 +391,15 @@
   1.319  
   1.320  rule UI_SOLVE_SHOW_INTERMEDIATE_STEPS
   1.321    when
   1.322 -    WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SHOW_INTERMEDIATE_STEPS)
   1.323 -    $wsd : WorksheetDialogRLB()
   1.324 +    WorksheetDialog(request == EUIElement.UI_SOLVE_SHOW_INTERMEDIATE_STEPS)
   1.325 +    $wsd : WorksheetDialog()
   1.326    then
   1.327      $wsd.getCalcTree().intermediateSteps(context_formula);
   1.328  end
   1.329  
   1.330  rule UI_SOLVE_TACTIC_APPLIED
   1.331    when
   1.332 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_TACTIC_APPLIED)
   1.333 +    $wsd:WorksheetDialog(request == EUIElement.UI_SOLVE_TACTIC_APPLIED)
   1.334    then
   1.335      Tactic ta = context_formula.getTactic();
   1.336      $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SOLVE_TACTIC_APPLIED,EUIContext.UI_CONTEXT_CALCELEMENTS, user_language, ta));
   1.337 @@ -407,7 +407,7 @@
   1.338  
   1.339  rule UI_SPECIFY_OPEN_CALCHEAD
   1.340    when
   1.341 -    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_OPEN_CALCHEAD)
   1.342 +    $wsd:WorksheetDialog(request == EUIElement.UI_SPECIFY_OPEN_CALCHEAD)
   1.343    then
   1.344      System.out.println("Pressed!");
   1.345  end
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/java/isac/wsdialog/RlbLearnRLB.drl	Fri Feb 17 17:33:45 2012 +0100
     2.3 @@ -0,0 +1,413 @@
     2.4 +//Application of these rules can be watched by an Eclipse plug-in.
     2.5 +//These rules are compiled when 'new RlbBuilder' is executed.
     2.6 +
     2.7 +package isac.wsdialog
     2.8 +
     2.9 +import isac.useractions.EUIElement
    2.10 +import isac.bridge.CalcTree;
    2.11 +import isac.bridge.CalcIterator;
    2.12 +import isac.interfaces.IToCalc;
    2.13 +import isac.util.AutoCalculateException;
    2.14 +import isac.util.tactics.Tactic;
    2.15 +import isac.interfaces.ICalcIterator;
    2.16 +import isac.session.Session;
    2.17 +import isac.util.formulae.ContextUnknown;
    2.18 +import isac.util.formulae.CalcHead;
    2.19 +import isac.util.formulae.CalcFormula;
    2.20 +import isac.util.formulae.Assumptions;
    2.21 +import isac.useractions.IUserAction;
    2.22 +import isac.useractions.UserActionOnCalcElement;
    2.23 +import isac.useractions.UIActionOnCalcElement;
    2.24 +import isac.useractions.UserActionOnPosition;
    2.25 +import isac.useractions.EUIContext;
    2.26 +import isac.users.UserLanguage;
    2.27 +import isac.useractions.UIAction;
    2.28 +import isac.useractions.UserAction;
    2.29 +import isac.users.LogItem.DialogTypes;
    2.30 +import isac.users.User;
    2.31 +import isac.util.formulae.Position;
    2.32 +
    2.33 +//allows to access over all rules:
    2.34 +global EUIElement request;
    2.35 +global Session session;
    2.36 +global ICalcIterator context_formula;
    2.37 +global IUserAction action;
    2.38 +global UserLanguage user_language;
    2.39 +global CalcHead calc_head;
    2.40 +global User user;
    2.41 +global String worksheet_id;
    2.42 +
    2.43 +//NOTE: If suddenly occur a curious error, try to clean and build the project!
    2.44 +
    2.45 +//these comments refer to WorksheetDialg#notifyUserAction:
    2.46 +//------------- 1 switch case -------------- CLOSE WS
    2.47 +
    2.48 +rule "UI_CLOSE_WORKSHEET AND no worksheet is open"
    2.49 +  when
    2.50 +    WorksheetDialogRLB(request == EUIElement.UI_CLOSE_WORKSHEET, session.getWSDialogManager().numberOpenedWSDialoges() == 0)
    2.51 +    $wsd : WorksheetDialogRLB()
    2.52 +  then
    2.53 +     $wsd.getCalcTree().destruct();
    2.54 +     session.getWSDialogManager().closeWSDialog($wsd.getWorksheetID());
    2.55 +     $wsd.removeNextAndAutoButtonForWorksheet();
    2.56 +     session.getContextPresenter().presentContext(new ContextUnknown());
    2.57 +end
    2.58 +
    2.59 +rule "UI_CLOSE_WORKSHEET AND at least on worksheet is open"
    2.60 +  when
    2.61 +    WorksheetDialogRLB(request == EUIElement.UI_CLOSE_WORKSHEET, session.getWSDialogManager().numberOpenedWSDialoges() != 0)
    2.62 +    $wsd : WorksheetDialogRLB()
    2.63 +  then
    2.64 +     $wsd.getCalcTree().destruct();
    2.65 +     session.getWSDialogManager().closeWSDialog($wsd.getWorksheetID());
    2.66 +     session.getContextPresenter().presentContext( new ContextUnknown());
    2.67 +end
    2.68 +
    2.69 +rule "UI_ACTIVE_WORKSHEET set into Context"
    2.70 +  when 
    2.71 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_ACTIVE_WORKSHEET)
    2.72 +  then
    2.73 +    session.getWSDialogManager().setActiveWSDialog($wsd.getWorksheetID());
    2.74 +    $wsd.notifyContextPresenter();
    2.75 +end
    2.76 +
    2.77 +//------------- 2 switch case -------------- PHASE
    2.78 +
    2.79 +rule DIALOGPHASE_IDLE
    2.80 +  when 
    2.81 +    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    2.82 +  then
    2.83 +     throw new DialogProtocolException(request, $wsd.getPhase());
    2.84 +end
    2.85 +
    2.86 +rule "DIALOGPHASE_SPECIFY AND request.ordinal() < UI_DUMMY_FIRST_SPECIFY.ordinal()"
    2.87 +  when 
    2.88 +    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    2.89 +  then
    2.90 +     throw new DialogProtocolException(request, $wsd.getPhase());
    2.91 +end
    2.92 +
    2.93 +rule "DIALOGPHASE_SPECIFY AND request.ordinal() > UI_DUMMY_LAST_SPECIFY.ordinal()"
    2.94 +  when 
    2.95 +    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
    2.96 +  then
    2.97 +     throw new DialogProtocolException(request, $wsd.getPhase());
    2.98 +end
    2.99 +
   2.100 +rule "DIALOGPHASE_SOLVE AND request.ordinal() < UI_DUMMY_FIRST_SOLVE.ordinal()"
   2.101 +  when 
   2.102 +    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
   2.103 +  then
   2.104 +     throw new DialogProtocolException(request, $wsd.getPhase());
   2.105 +end
   2.106 +
   2.107 +rule "DIALOGPHASE_SOLVE AND request.ordinal() > UI_DUMMY_LAST_SOLVE.ordinal()"
   2.108 +  when 
   2.109 +    $wsd : WorksheetDialogRLB(phase == IWorksheetDialog.DIALOGPHASE_IDLE)
   2.110 +  then
   2.111 +     throw new DialogProtocolException(request, $wsd.getPhase());
   2.112 +end
   2.113 +
   2.114 +//------------- 3 switch case -------------- handle IUserAction's 
   2.115 +
   2.116 +// #in solve-phase request open a CalcHead by context-menu
   2.117 +
   2.118 +rule UI_SOLVE_SHOW_CALCHEAD
   2.119 +  when
   2.120 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SHOW_CALCHEAD)
   2.121 +  then
   2.122 +    $wsd.startSpecifying((CalcHead) context_formula.getElement());
   2.123 +end
   2.124 +
   2.125 +// #Enter pressed after typing formula
   2.126 +
   2.127 +rule UI_SPECIFY_EDIT_ACTIVE_FORMULA_COMPLETE
   2.128 +  dialect "java"
   2.129 +  when
   2.130 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_EDIT_ACTIVE_FORMULA_COMPLETE)
   2.131 +  then
   2.132 +    CalcHead ch_to_check = (CalcHead)((UserActionOnCalcElement) action).getCalcElement();
   2.133 +    calc_head = $wsd.getCalcTree().checkCalcHead(ch_to_check);
   2.134 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_CHECK_CALCHEAD,EUIContext.UI_CONTEXT_CALCHEAD, user_language, calc_head));
   2.135 +end
   2.136 +
   2.137 +// #Complete pressed
   2.138 +
   2.139 +rule UI_SPECIFY_COMPLETE_CALCHEAD
   2.140 +  dialect "java"
   2.141 +  when
   2.142 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_COMPLETE_CALCHEAD, !calc_head.isComplete())
   2.143 +  then
   2.144 +    calc_head = $wsd.getCalcTree().completeCalcHead();
   2.145 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_COMPLETE_CALCHEAD,EUIContext.UI_CONTEXT_CALCHEAD, user_language,calc_head));
   2.146 +end
   2.147 +
   2.148 +rule UI_SPECIFY_COMPLETE_RELATE
   2.149 +  dialect "java"
   2.150 +  when
   2.151 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_COMPLETE_RELATE)
   2.152 +  then
   2.153 +    throw new DialogNotImplementedException(request, $wsd.getPhase());
   2.154 +end
   2.155 +
   2.156 +// #check pressed
   2.157 +
   2.158 +rule UI_SPECIFY_CHECK_CALCHEAD
   2.159 +  dialect "java"
   2.160 +  when
   2.161 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CHECK_CALCHEAD)
   2.162 +  then
   2.163 +    CalcHead ch_to_check = (CalcHead) ((UserActionOnCalcElement) action).getCalcElement();
   2.164 +    calc_head = $wsd.getCalcTree().checkCalcHead(ch_to_check);
   2.165 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_CHECK_CALCHEAD,EUIContext.UI_CONTEXT_CALCHEAD, user_language, calc_head));
   2.166 +end
   2.167 +
   2.168 +// #next pressed
   2.169 +
   2.170 +rule UI_SPECIFY_COMPLETE_STEPWISE
   2.171 +  dialect "java"
   2.172 +  when
   2.173 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_COMPLETE_STEPWISE, !calc_head.isComplete())
   2.174 +  then
   2.175 +    calc_head = $wsd.getCalcTree().nextSpecify();
   2.176 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_COMPLETE_STEPWISE,EUIContext.UI_CONTEXT_CALCHEAD, user_language,calc_head));
   2.177 +end
   2.178 +
   2.179 +// #close pressed
   2.180 +
   2.181 +rule UI_SPECIFY_CLOSE_CALCHEAD
   2.182 +  dialect "java"
   2.183 +  when
   2.184 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CLOSE_CALCHEAD)
   2.185 +  then
   2.186 +    $wsd.doUIAction(new UIAction(EUIElement.UI_SPECIFY_CLOSE_CALCHEAD,EUIContext.UI_CONTEXT_SWITCH_PHASES, user_language));
   2.187 +    $wsd.setPhase($wsd.DIALOGPHASE_SOLVE);
   2.188 +end
   2.189 +
   2.190 +// #reset pressed
   2.191 +
   2.192 +rule UI_SPECIFY_RESET
   2.193 +  dialect "java"
   2.194 +  when
   2.195 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_RESET)
   2.196 +  then
   2.197 +    $wsd.getCalcTree().resetCalcHead();
   2.198 +    calc_head = $wsd.getCalcTree().modelProblem();
   2.199 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_RESET,EUIContext.UI_CONTEXT_CALCHEAD, user_language, calc_head));
   2.200 +end
   2.201 +
   2.202 +// #auto pressed
   2.203 +
   2.204 +rule "UI_SPECIFY_CALCULATE_ALL and  !calc_head.isComplete()"
   2.205 +  dialect "java"
   2.206 +  salience( 1 )
   2.207 +  when
   2.208 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, !calc_head.isComplete())
   2.209 +
   2.210 +    WorksheetDialogRLB(!calc_head.isComplete())
   2.211 +  then
   2.212 +    calc_head = $wsd.getCalcTree().completeCalcHead();
   2.213 +
   2.214 +end
   2.215 +
   2.216 +rule "UI_SPECIFY_CALCULATE_ALL and  !calc_head.isComplete() 2nd check"
   2.217 +  dialect "java"
   2.218 +  when
   2.219 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, !calc_head.isComplete())
   2.220 +  then
   2.221 +    $wsd.getCalcTree().resetCalcHead();
   2.222 +    calc_head = $wsd.getCalcTree().completeCalcHead();
   2.223 +end
   2.224 +
   2.225 +// #auto pressed
   2.226 +
   2.227 +rule "UI_SPECIFY_CALCULATE_ALL and  calc_head.isComplete()"
   2.228 +  dialect "java"
   2.229 +  when
   2.230 +    $wsd : WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_CALCULATE_ALL, calc_head.isComplete())
   2.231 +  then
   2.232 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SPECIFY_CALCULATE_ALL,EUIContext.UI_CONTEXT_CALCHEAD, user_language, calc_head));
   2.233 +    $wsd.doUIAction(new UIAction(EUIElement.UI_SPECIFY_CLOSE_CALCHEAD,EUIContext.UI_CONTEXT_SWITCH_PHASES, user_language));
   2.234 +    $wsd.startSolving();
   2.235 +end
   2.236 +
   2.237 +       
   2.238 +// -------------------------------------------------> BEGIN next and auto button
   2.239 +rule NextButtonOnCalcHead
   2.240 +    dialect "java"
   2.241 +    when
   2.242 +        WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_1 &&
   2.243 +                           active_formula_.onCalcHead())
   2.244 +        $wsd : WorksheetDialogRLB()
   2.245 +    then
   2.246 +        $wsd.getCalcTree().completeCalcHead();
   2.247 +        try{
   2.248 +          $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   2.249 +                  DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_SOLVE_CALCULATE_1);
   2.250 +          ((CalcTree)$wsd.getCalcTree()).startSolving();
   2.251 +        }
   2.252 +        catch (AutoCalculateException e1) {
   2.253 +          e1.printStackTrace();
   2.254 +        }
   2.255 +        System.out.println( "NextButtonOnCalcHead" );
   2.256 +end
   2.257 +
   2.258 +// **NOT** onCalchead
   2.259 +rule NextButtonNotOnCalcHead
   2.260 +  dialect "java"
   2.261 +    when
   2.262 +        WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_1 &&
   2.263 +                           !active_formula_.onCalcHead())
   2.264 +        $wsd : WorksheetDialogRLB()
   2.265 +    then
   2.266 +        $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   2.267 +                  DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_SOLVE_CALCULATE_1);
   2.268 +        $wsd.getCalcTree().autoCalculate(IToCalc.SCOPE_CALCULATION, 1);
   2.269 +end
   2.270 +
   2.271 +rule AutoButton
   2.272 +  dialect "java"
   2.273 +  when
   2.274 +    WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_ALL)
   2.275 +    $wsd : WorksheetDialogRLB()
   2.276 +   then
   2.277 +    $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   2.278 +              DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_SOLVE_CALCULATE_ALL);
   2.279 +    $wsd.getCalcTree().autoCalculate(IToCalc.SCOPE_CALCULATION, 0);
   2.280 +end
   2.281 +
   2.282 +//------------------------------------------------------------------------------
   2.283 +
   2.284 +rule UI_SOLVE_CALCULATE_SUBPROBLEM
   2.285 +  when
   2.286 +    WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CALCULATE_SUBPROBLEM)
   2.287 +    $wsd : WorksheetDialogRLB()
   2.288 +  then
   2.289 +    $wsd.getCalcTree().autoCalculate(IToCalc.SCOPE_SUBPROBLEM, 0);
   2.290 +end
   2.291 +
   2.292 +rule UI_SOLVE_EDIT_ACTIVE_FORMULA
   2.293 +  when
   2.294 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA)
   2.295 +  then
   2.296 +    $wsd.getUi_control_listener().doUIAction(new UIAction(EUIElement.UI_DO_EDIT_FORMULA,EUIContext.UI_CONTEXT_ONEELEMENT, user_language));
   2.297 +end
   2.298 +
   2.299 +//APPEND FORMULA
   2.300 +rule "UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE and formula.getPosition() == null"
   2.301 +  when
   2.302 +    //CalcFormula formula = ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement());
   2.303 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition() == null)
   2.304 +  then
   2.305 +    $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   2.306 +              DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_DO_APPEND_FORMULA, 
   2.307 +              context_formula.getElement().toString(), ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).toString());
   2.308 +    $wsd.getCalcTree().appendFormula(((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()));
   2.309 +end
   2.310 +
   2.311 +//REPLACE FORMULA   
   2.312 +rule "UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE and formula.getPosition() != null"
   2.313 +  when
   2.314 +    //CalcFormula formula = ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement());
   2.315 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_EDIT_ACTIVE_FORMULA_COMPLETE, ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition() != null)
   2.316 +  then
   2.317 +    $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   2.318 +              DialogTypes.WORKSHEET, "", "", $wsd.active_formula_.getPosition(), EUIElement.UI_DO_EDIT_FORMULA,
   2.319 +              context_formula.getElement().toString(), ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).toString());
   2.320 +    $wsd.setActiveFormula(new CalcIterator(((CalcTree)$wsd.getCalcTree()), ((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()).getPosition()));
   2.321 +    $wsd.getCalcTree().replaceFormula(((CalcFormula) ((UserActionOnCalcElement) action).getCalcElement()));
   2.322 +end
   2.323 +
   2.324 +rule UI_SOLVE_APPEND_USER_FORMULA
   2.325 +  when
   2.326 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_APPEND_USER_FORMULA)
   2.327 +  then
   2.328 +    $wsd.getUi_control_listener().doUIAction(new UIAction(EUIElement.UI_DO_APPEND_FORMULA,EUIContext.UI_CONTEXT_ONEELEMENT, user_language));
   2.329 +end
   2.330 +
   2.331 +rule UI_SOLVE_MOVE_ACTIVE_FORMULA
   2.332 +  when
   2.333 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_MOVE_ACTIVE_FORMULA)
   2.334 +  then
   2.335 +    UserActionOnPosition uaop = (UserActionOnPosition) action;
   2.336 +    Position activePosition = uaop.getPosition();
   2.337 +    ICalcIterator iterator = new CalcIterator((CalcTree)$wsd.getCalcTree(), activePosition );
   2.338 +    $wsd.getCalcTree().moveActiveFormula(iterator);
   2.339 +end
   2.340 +
   2.341 +rule UI_SOLVE_CHANGE_CONTEXT_FORMULA
   2.342 +  when
   2.343 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_CHANGE_CONTEXT_FORMULA, ((UserActionOnPosition) action).getPosition() != null)
   2.344 +  then
   2.345 +    $wsd.setContextFormula(new CalcIterator(((CalcTree)$wsd.getCalcTree()), ((UserActionOnPosition) action).getPosition()));
   2.346 +    $wsd.notifyContextPresenter();
   2.347 +end
   2.348 +
   2.349 +rule UI_SOLVE_GET_PROPOSED_TACTIC
   2.350 +  when
   2.351 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_GET_PROPOSED_TACTIC)
   2.352 +  then
   2.353 +    throw new DialogNotImplementedException(request, $wsd.getPhase());
   2.354 +end
   2.355 +
   2.356 +rule UI_SOLVE_GET_APPLICABLE_TACTICS
   2.357 +  when
   2.358 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_GET_APPLICABLE_TACTICS)
   2.359 +  then
   2.360 +    $wsd.sendApplicableTacticsToWorksheet(context_formula);
   2.361 +    $wsd.doUIAction(new UIAction(EUIElement.UI_SOLVE_SHOW_APPLICABLE_TACTICS,EUIContext.UI_CONTEXT_ONEELEMENT, user_language));
   2.362 +end
   2.363 +
   2.364 +rule UI_SOLVE_SET_NEXT_TACTIC
   2.365 +  dialect "java"
   2.366 +  when
   2.367 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SET_NEXT_TACTIC)
   2.368 +  then
   2.369 +    UserActionOnCalcElement uaoce = (UserActionOnCalcElement)action;
   2.370 +
   2.371 +    $wsd.buildLogItem($wsd.active_formula_.onCalcHead(), user.getUsername(), session.getId(), worksheet_id,
   2.372 +              DialogTypes.WORKSHEET, "", ((Tactic) uaoce.getCalcElement()).showToBeginner(), 
   2.373 +              $wsd.active_formula_.getPosition(), EUIElement.UI_SOLVE_SET_NEXT_TACTIC);
   2.374 +
   2.375 +    $wsd.getCalcTree().moveActiveFormula(new CalcIterator(((CalcTree)$wsd.getCalcTree()), uaoce.getPosition()));
   2.376 +    $wsd.getCalcTree().setNextTactic((Tactic) uaoce.getCalcElement());
   2.377 +    $wsd.getCalcTree().autoCalculate(IToCalc.SCOPE_CALCULATION, 1);
   2.378 +end
   2.379 +
   2.380 +rule UI_SOLVE_HELP_ENTERING_FORMULA
   2.381 +  when
   2.382 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_HELP_ENTERING_FORMULA)
   2.383 +  then
   2.384 +    throw new DialogNotImplementedException(request, $wsd.getPhase());
   2.385 +end
   2.386 +
   2.387 +rule UI_SOLVE_SHOW_ASSUMPTIONS
   2.388 +  when
   2.389 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SHOW_ASSUMPTIONS)
   2.390 +  then
   2.391 +    Assumptions asm = context_formula.getAssumptions();
   2.392 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SOLVE_SHOW_ASSUMPTIONS,EUIContext.UI_CONTEXT_CALCELEMENTS, user_language, asm));
   2.393 +end
   2.394 +
   2.395 +rule UI_SOLVE_SHOW_INTERMEDIATE_STEPS
   2.396 +  when
   2.397 +    WorksheetDialogRLB(request == EUIElement.UI_SOLVE_SHOW_INTERMEDIATE_STEPS)
   2.398 +    $wsd : WorksheetDialogRLB()
   2.399 +  then
   2.400 +    $wsd.getCalcTree().intermediateSteps(context_formula);
   2.401 +end
   2.402 +
   2.403 +rule UI_SOLVE_TACTIC_APPLIED
   2.404 +  when
   2.405 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SOLVE_TACTIC_APPLIED)
   2.406 +  then
   2.407 +    Tactic ta = context_formula.getTactic();
   2.408 +    $wsd.doUIAction(new UIActionOnCalcElement(EUIElement.UI_SOLVE_TACTIC_APPLIED,EUIContext.UI_CONTEXT_CALCELEMENTS, user_language, ta));
   2.409 +end
   2.410 +
   2.411 +rule UI_SPECIFY_OPEN_CALCHEAD
   2.412 +  when
   2.413 +    $wsd:WorksheetDialogRLB(request == EUIElement.UI_SPECIFY_OPEN_CALCHEAD)
   2.414 +  then
   2.415 +    System.out.println("Pressed!");
   2.416 +end
     3.1 --- a/src/java/isac/wsdialog/WorksheetDialogRLB.java	Fri Feb 17 16:14:47 2012 +0100
     3.2 +++ b/src/java/isac/wsdialog/WorksheetDialogRLB.java	Fri Feb 17 17:33:45 2012 +0100
     3.3 @@ -38,6 +38,8 @@
     3.4  
     3.5  import org.apache.log4j.Logger;
     3.6  import org.drools.KnowledgeBase;
     3.7 +import org.drools.logger.KnowledgeRuntimeLogger;
     3.8 +import org.drools.logger.KnowledgeRuntimeLoggerFactory;
     3.9  import org.drools.runtime.StatefulKnowledgeSession;
    3.10  
    3.11  /**
    3.12 @@ -180,12 +182,10 @@
    3.13          dialog_.writeToDB(log_item_);
    3.14      }
    3.15  
    3.16 -    @Override
    3.17      public String getWorksheetID() {
    3.18          return worksheet_id_;
    3.19      }
    3.20  
    3.21 -    @Override
    3.22      public IToCalc getCalcTree() {
    3.23          return calc_tree_;
    3.24      }
    3.25 @@ -281,7 +281,6 @@
    3.26          } catch (RemoteException e) {
    3.27              e.printStackTrace();
    3.28          }
    3.29 -
    3.30      }
    3.31  
    3.32      /**
    3.33 @@ -456,6 +455,7 @@
    3.34       * 
    3.35       */
    3.36      public void calcResponse(CalcEvent event) throws RemoteException {
    3.37 +
    3.38          if (event instanceof CalcChanged) {
    3.39              CalcChanged ccevent = (CalcChanged) event;
    3.40              worksheet_ready_ = false;        
    3.41 @@ -539,17 +539,16 @@
    3.42                  }
    3.43              }
    3.44          } else {// CalcMessage
    3.45 -            // TODO.WN0710 pass on to gui via UIAction
    3.46 -          logger.fatal("calcResponse : CalcMessage -> " + ((CalcMessage )event).getText());
    3.47            
    3.48             for(int i = 0; i < datachange_listeners_.size(); i++)
    3.49              ((IToDialog) datachange_listeners_.elementAt(i)).calcResponse(event);
    3.50             
    3.51 +          logger.fatal("calcResponse : CalcMessage -> " + ((CalcMessage )event).getText());
    3.52            //LogItem false                
    3.53 +
    3.54            log_item_.completeWithError(((CalcMessage )event).getText());
    3.55            dialog_.writeToDB(log_item_);
    3.56       
    3.57 -          
    3.58  //UL          user_logger_.logCalcMessage(worksheet_id_, active_formula_
    3.59  //UL                    .toSMLString(), ((CalcMessage) event).getText());
    3.60          }
    3.61 @@ -682,7 +681,6 @@
    3.62       * @throws RemoteException
    3.63       * 
    3.64       */
    3.65 -    @Override
    3.66      public boolean notifyUserAction(IUserAction action)
    3.67              throws DialogProtocolException, RemoteException {
    3.68          
    3.69 @@ -692,11 +690,19 @@
    3.70          if (logger.isInfoEnabled())
    3.71              logger.info(" WS->DG: notifyUserAction request= " + request);       
    3.72  
    3.73 -        rlb_ = new RlbBuilder(WorksheetDialogRLB.class, "RlbLearn.drl");
    3.74 +        /* ATTENTION use the right class and ruleset!!!! */
    3.75 +        rlb_ = new RlbBuilder(WorksheetDialogRLB.class, "RlbLearnRLB.drl");
    3.76          //here serveral rule sets could be invoked (according to many
    3.77          // errors, to timeout, etc.)
    3.78          kbase_ = rlb_.getKnowledgeBase();
    3.79          ksession_ = kbase_.newStatefulKnowledgeSession();
    3.80 +        
    3.81 +        /* LOGGING RULES */
    3.82 +        // Remove comment to use LOGGER
    3.83 +        //KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger( ksession_, "./LOGFILE_Worksheetdialog" );
    3.84 +        
    3.85 +
    3.86 +        //application could be restricted by priorities etc.
    3.87  
    3.88          //This allows to have the same code in rules as in original Java object.
    3.89          //setGlobal makes thes variables accessible over all rules.
    3.90 @@ -715,6 +721,10 @@
    3.91          ksession_.fireAllRules();
    3.92          //application could be restricted by priorities etc.
    3.93          
    3.94 +        // Remove comment to use LOGGER
    3.95 +        //logger.close();
    3.96 +        ksession_.dispose();
    3.97 +        
    3.98          return true;
    3.99      }
   3.100      
   3.101 @@ -905,8 +915,8 @@
   3.102       * 
   3.103       */
   3.104      public Context initContext(ContextType type) {
   3.105 -        System.out.println("In WorksheetDialog::initContext() : type is "
   3.106 -                + type);
   3.107 +//        System.out.println("In WorksheetDialog::initContext() : type is "
   3.108 +//                + type);
   3.109  
   3.110          Context current_context = new ContextUnknown();
   3.111  
   3.112 @@ -927,7 +937,7 @@
   3.113              break;
   3.114          }
   3.115  
   3.116 -        System.out.println("current context:" + current_context);
   3.117 +//        System.out.println("current context:" + current_context);
   3.118  
   3.119          if (current_context == null)
   3.120              return new ContextUnknown();
   3.121 @@ -1103,5 +1113,4 @@
   3.122      log_item_ = new LogItem(user_name, session_id, ws_id, dialog_type, step_arg_1,
   3.123                          step_arg_2, pos, formula_from,formula_to, chosen_step);
   3.124    }   
   3.125 -
   3.126  }