Marko Zadravec
Marko Zadravec

Reputation: 8730

Eclipse Scout modal view error

I am working in new Scout Neon and I am starting to get error :

Assertion error: Property 'modal' cannot be changed because Form is already showing

My forms has properties :

@Override
protected int getConfiguredModalityHint() {

   return MODALITY_HINT_MODELESS;
}

@Override
protected int getConfiguredDisplayHint() {

   return DISPLAY_HINT_VIEW;
}

@Override
protected String getConfiguredDisplayViewId() {

  return VIEW_ID_CENTER;
}

What I did wrong?

EDIT : Marko


I add page in MyOutline witch extends from AbstractOutline

public class MyOutline extends AbstractOutline {

  @Override
  protected String getConfiguredTitle() {

    return TEXTS.get("MyOutline");
  }

  @Override
  protected void execCreateChildPages(final List<IPage<?>> pageList) {

    final MyPage myPage = new MyPage();

    pageList.add(myPage);
    super.execCreateChildPages(pageList);
  }
}

MyPage is only a wrapper page for form.

public class MyPage extends AbstractPageWithNodes {

  @Override
  protected boolean getConfiguredLeaf() {

    return true;
  }

  @Override
  protected boolean getConfiguredTableVisible() {

    return false;
  }

  @Override
  protected String getConfiguredTitle() {

    return TEXTS.get("MyPage");
  }  

  @Override
  protected Class<? extends IForm> getConfiguredDetailForm() {

    return MyForm.class;
  }
} 

and my form is nothing spacial :

@FormData(value = MyFormData.class, sdkCommand = FormData.SdkCommand.CREATE)

public class MyForm extends AbstractForm {

  /**
   * Method start Form for adding new person.
   */
  public void startNew() {

    this.startInternal(new NewHandler());
  }

  @Override
  protected boolean getConfiguredAskIfNeedSave() {

    return false;
  }

  @Override
  protected int getConfiguredModalityHint() {

    return MODALITY_HINT_MODELESS;
  }

  @Override
  protected int getConfiguredDisplayHint() {

    return DISPLAY_HINT_VIEW;
  }

  @Override
  protected String getConfiguredDisplayViewId() {

    return VIEW_ID_CENTER;
  }

  public MainBox getMainBox() {
 ...

But when I want to open this Page (on start application is not opened on this page), (and I do not do anything else before) I get error.

 2016-01-22 11:13:56,236 ERROR scout-model-thread-11 'Processing JSON request' o.e.scout.rt.platform.exception.ExceptionHandler -  
 org.eclipse.scout.rt.platform.util.Assertions$AssertionException: Assertion error: Property 'modal' cannot be changed because Form is already showing 
at org.eclipse.scout.rt.platform.util.Assertions.fail(Assertions.java:581) ~[org.eclipse.scout.rt.platform-5.2.0.M4.jar:5.2.0.M4]
at org.eclipse.scout.rt.platform.util.Assertions.assertFalse(Assertions.java:192) ~[org.eclipse.scout.rt.platform-5.2.0.M4.jar:5.2.0.M4]
at org.eclipse.scout.rt.client.ui.form.AbstractForm.setModal(AbstractForm.java:2700) ~[org.eclipse.scout.rt.client-5.2.0.M4.jar:5.2.0.M4]
at org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPage.decorateDetailForm(AbstractPage.java:692) ~[org.eclipse.scout.rt.client-5.2.0.M4.jar:5.2.0.M4]

Upvotes: 0

Views: 143

Answers (1)

Marko Zadravec
Marko Zadravec

Reputation: 8730

I found solution for my problem.

in my constructor in form I have :

public PersonsExtensionFieldForm() {
    this.startInternal(new NewHandler());
}

witch is ok, when you open form from other form with for example button click.

But when you put form in page as Detail form you need to have

 public PersonsExtensionFieldForm() {
    this.setHandler(new NewHandler());
 }

Upvotes: 0

Related Questions