MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / showModal

Method showModal

CodenameOne/src/com/codename1/ui/Form.java:2734–2812  ·  view source on GitHub ↗
(int top, int bottom, int left, int right, boolean includeTitle, boolean modal, boolean reverse)

Source from the content-addressed store, hash-verified

2732 ///
2733 /// - `modal`: indictes if this is a modal or modeless dialog true for modal dialogs
2734 void showModal(int top, int bottom, int left, int right, boolean includeTitle, boolean modal, boolean reverse) {
2735 Display.getInstance().flushEdt();
2736 if (previousForm == null) {
2737 previousForm = Display.getInstance().getCurrent();
2738 // special case for application opening with a dialog before any form is shown
2739 if (previousForm == null) {
2740 previousForm = new Form();
2741 previousForm.show();
2742 } else {
2743 if (previousForm instanceof Dialog) {
2744 Dialog previousDialog = (Dialog) previousForm;
2745 if (previousDialog.isDisposed()) {
2746 previousForm = Display.getInstance().getCurrentUpcoming();
2747 }
2748 }
2749 }
2750 }
2751
2752 previousForm.tint = true;
2753 Painter p = getStyle().getBgPainter();
2754 if (top > 0 || bottom > 0 || left > 0 || right > 0) {
2755 if (!title.isVisible()) {
2756 includeTitle = false;
2757 }
2758 Style titleStyle = title.getStyle();
2759 titleStyle.removeListeners();
2760
2761 Style contentStyle = contentPane.getUnselectedStyle();
2762 contentStyle.removeListeners();
2763
2764 if (includeTitle) {
2765 titleStyle.setMargin(Component.TOP, top, false);
2766 titleStyle.setMargin(Component.BOTTOM, 0, false);
2767 titleStyle.setMargin(Component.LEFT, left, false);
2768 titleStyle.setMargin(Component.RIGHT, right, false);
2769
2770 contentStyle.setMargin(Component.TOP, 0, false);
2771 contentStyle.setMargin(Component.BOTTOM, bottom, false);
2772 contentStyle.setMargin(Component.LEFT, left, false);
2773 contentStyle.setMargin(Component.RIGHT, right, false);
2774 } else {
2775 titleStyle.setMargin(Component.TOP, 0, false);
2776 titleStyle.setMargin(Component.BOTTOM, 0, false);
2777 titleStyle.setMargin(Component.LEFT, 0, false);
2778 titleStyle.setMargin(Component.RIGHT, 0, false);
2779
2780 contentStyle.setMargin(Component.TOP, top, false);
2781 contentStyle.setMargin(Component.BOTTOM, bottom, false);
2782 contentStyle.setMargin(Component.LEFT, left, false);
2783 contentStyle.setMargin(Component.RIGHT, right, false);
2784 }
2785 titleStyle.setMarginUnit(null);
2786 contentStyle.setMarginUnit(null);
2787 initDialogBgPainter(p, previousForm);
2788 revalidate();
2789 } else {
2790 // If the keyboard was opened the top/bottom/left/right calculations
2791 // may be zeroes right now, but this will change when the keyboard

Callers 1

showDialogMethod · 0.95

Calls 15

getInstanceMethod · 0.95
isDisposedMethod · 0.95
removeListenersMethod · 0.95
setMarginMethod · 0.95
setMarginUnitMethod · 0.95
initDialogBgPainterMethod · 0.95
initFocusedMethod · 0.95
initLafMethod · 0.95
getUIManagerMethod · 0.95
initComponentImplMethod · 0.95

Tested by

no test coverage detected