INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. Open the window with the specified name. The name may be a special target name of _self, _parent, _top, or _blank. An empty or null name is set to the default. The special target names are relati
(
final WebWindow opener, final String windowName, final String defaultName)
| 1131 | * @return the new window |
| 1132 | */ |
| 1133 | public WebWindow openTargetWindow( |
| 1134 | final WebWindow opener, final String windowName, final String defaultName) { |
| 1135 | |
| 1136 | WebAssert.notNull("opener", opener); |
| 1137 | WebAssert.notNull("defaultName", defaultName); |
| 1138 | |
| 1139 | String windowToOpen = windowName; |
| 1140 | if (windowToOpen == null || windowToOpen.isEmpty()) { |
| 1141 | windowToOpen = defaultName; |
| 1142 | } |
| 1143 | |
| 1144 | WebWindow webWindow = resolveWindow(opener, windowToOpen); |
| 1145 | |
| 1146 | if (webWindow == null) { |
| 1147 | if (TARGET_BLANK.equals(windowToOpen)) { |
| 1148 | windowToOpen = ""; |
| 1149 | } |
| 1150 | webWindow = new TopLevelWindow(windowToOpen, this); |
| 1151 | } |
| 1152 | |
| 1153 | if (webWindow instanceof TopLevelWindow window && webWindow != opener.getTopWindow()) { |
| 1154 | window.setOpener(opener); |
| 1155 | } |
| 1156 | |
| 1157 | return webWindow; |
| 1158 | } |
| 1159 | |
| 1160 | private WebWindow resolveWindow(final WebWindow opener, final String name) { |
| 1161 | if (name == null || name.isEmpty() || TARGET_SELF.equals(name)) { |
no test coverage detected