public NewInputPopup() {
   super(
       TestScenarioAltedImages.INSTANCE.RuleAsset(), TestScenarioConstants.INSTANCE.NewInput());
   List<String> varsInScope = scenario.getFactNamesInScope(currentEx, false);
   // now we do modifies & retracts
   if (varsInScope.size() > 0) {
     addAttribute(
         TestScenarioConstants.INSTANCE.CallAMethodOnAFactScenario(),
         new CallMethodFactPanel(varsInScope));
   }
 }
Example #2
0
  protected void showAddFieldPopup(final Widget w) {
    final FormStylePopup popup =
        new FormStylePopup(
            TestScenarioAltedImages.INSTANCE.Wizard(),
            TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke());
    ListBox box = new ListBox();
    box.addItem("...");

    for (int i = 0; i < fieldCompletionTexts.length; i++) {
      box.addItem(fieldCompletionTexts[i], fieldCompletionValues[i]);
    }

    box.setSelectedIndex(0);

    popup.addAttribute(TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke(), box);
    box.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            mCall.setState(ActionCallMethod.TYPE_DEFINED);
            ListBox sourceW = (ListBox) event.getSource();
            final String methodName = sourceW.getItemText(sourceW.getSelectedIndex());
            final String methodNameWithParams = sourceW.getValue(sourceW.getSelectedIndex());

            mCall.setMethodName(methodName);

            oracle.getMethodParams(
                variableClass,
                methodNameWithParams,
                new Callback<List<String>>() {
                  @Override
                  public void callback(final List<String> fieldList) {
                    // String fieldType = oracle.getFieldType( variableClass, fieldName );
                    int i = 0;
                    for (String fieldParameter : fieldList) {
                      mCall.addFieldValue(
                          new CallFieldValue(methodName, String.valueOf(i), fieldParameter));
                      i++;
                    }

                    parent.renderEditor();
                    popup.hide();
                  }
                });
          }
        });

    popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
    popup.show();
  }
Example #3
0
  private Widget getSetterLabel() {
    HorizontalPanel horiz = new HorizontalPanel();

    if (mCall.getState() == ActionCallMethod.TYPE_UNDEFINED) {
      Image edit = TestScenarioAltedImages.INSTANCE.AddFieldToFact();
      edit.setTitle(TestScenarioConstants.INSTANCE.AddAnotherFieldToThisSoYouCanSetItsValue());

      edit.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              Image w = (Image) event.getSource();
              showAddFieldPopup(w);
            }
          });

      horiz.add(
          new SmallLabel(
              HumanReadable.getActionDisplayName("call")
                  + " ["
                  + mCall.getVariable()
                  + "]")); // NON-NLS
      horiz.add(edit);
    } else {
      horiz.add(
          new SmallLabel(
              HumanReadable.getActionDisplayName("call")
                  + " ["
                  + mCall.getVariable()
                  + "."
                  + mCall.getMethodName()
                  + "]")); // NON-NLS
    }

    return horiz;
  }