(final Form newForm, boolean reverse)
| 1538 | /// |
| 1539 | /// - `newForm`: the Form to Display |
| 1540 | void setCurrent(final Form newForm, boolean reverse) { |
| 1541 | if (edt == null) { |
| 1542 | throw new IllegalStateException("Initialize must be invoked before setCurrent!"); |
| 1543 | } |
| 1544 | |
| 1545 | if (!isEdt()) { |
| 1546 | // when not running callSerially executes synchronously and would recurse here forever (#4811) |
| 1547 | if (!codenameOneRunning) { |
| 1548 | throw new IllegalStateException("Display.setCurrent must be invoked after Codename One has started running. Call it from start() or via callSerially."); |
| 1549 | } |
| 1550 | callSerially(new RunnableWrapper(newForm, null, reverse)); |
| 1551 | return; |
| 1552 | } |
| 1553 | |
| 1554 | Form current = impl.getCurrentForm(); |
| 1555 | |
| 1556 | if (autoFoldVKBOnFormSwitch && !(newForm instanceof Dialog)) { |
| 1557 | setShowVirtualKeyboard(false); |
| 1558 | } |
| 1559 | |
| 1560 | if (current == newForm) { //NOPMD CompareObjectsWithEquals |
| 1561 | current.revalidate(); |
| 1562 | current.repaint(); |
| 1563 | current.onShowCompletedImpl(); |
| 1564 | return; |
| 1565 | } |
| 1566 | |
| 1567 | if (impl.isEditingText()) { |
| 1568 | switch (showDuringEdit) { |
| 1569 | case SHOW_DURING_EDIT_ALLOW_DISCARD: |
| 1570 | break; |
| 1571 | case SHOW_DURING_EDIT_ALLOW_SAVE: |
| 1572 | impl.saveTextEditingState(); |
| 1573 | break; |
| 1574 | case SHOW_DURING_EDIT_EXCEPTION: |
| 1575 | throw new IllegalStateException("Show during edit"); |
| 1576 | case SHOW_DURING_EDIT_IGNORE: |
| 1577 | return; |
| 1578 | case SHOW_DURING_EDIT_SET_AS_NEXT: |
| 1579 | impl.setCurrentForm(newForm); |
| 1580 | return; |
| 1581 | default: |
| 1582 | break; |
| 1583 | } |
| 1584 | } |
| 1585 | |
| 1586 | if (current != null) { |
| 1587 | if (current.isInitialized()) { |
| 1588 | current.deinitializeImpl(); |
| 1589 | } else { |
| 1590 | Form fg = getCurrentUpcoming(); |
| 1591 | if (fg != current) { //NOPMD CompareObjectsWithEquals |
| 1592 | if (fg.isInitialized()) { |
| 1593 | fg.deinitializeImpl(); |
| 1594 | } |
| 1595 | } |
| 1596 | } |
| 1597 | } |
nothing calls this directly
no test coverage detected