use of org.sablo.websocket.IWindow in project servoy-client by Servoy.
the class NGClientWebsocketSession method sendRedirect.
public void sendRedirect(final String redirectUrl) {
IWindow curr = CurrentWindow.safeGet();
CurrentWindow.runForWindow(curr != null && redirectUrl != null ? curr : new NGClientWebsocketSessionWindows(client.getWebsocketSession()), new Runnable() {
@Override
public void run() {
Map<String, Object> detail = new HashMap<>();
String htmlfilePath = Settings.getInstance().getProperty("servoy.webclient.pageexpired.page");
if (htmlfilePath != null)
detail.put("viewUrl", htmlfilePath);
if (redirectUrl != null)
detail.put("redirectUrl", redirectUrl);
getClientService("$sessionService").executeAsyncServiceCall("expireSession", new Object[] { detail });
}
});
}
use of org.sablo.websocket.IWindow in project servoy-client by Servoy.
the class WebFormUI method destroy.
@Override
public void destroy() {
if (dataAdapterList != null)
dataAdapterList.destroy();
Collection<WebComponent> componentsList = new ArrayList<WebComponent>(getComponents());
for (WebComponent c : componentsList) {
c.dispose();
}
clearComponents();
cleanupListeners();
IWindow window = CurrentWindow.safeGet();
if (window != null)
window.unregisterContainer(this);
}
use of org.sablo.websocket.IWindow in project servoy-client by Servoy.
the class RuntimeWebComponent method isApiFunctionEnabled.
protected boolean isApiFunctionEnabled(String functionName) {
boolean isLocationOrSize = "getLocationX".equals(functionName) || "getLocationY".equals(functionName) || "getWidth".equals(functionName) || "getHeight".equals(functionName);
if (isLocationOrSize) {
// if parent form not visible, don't call api, let it get from the model on the server
Container parent = component.getParent();
while (parent != null) {
if (parent instanceof WebFormUI) {
boolean isFormVisible = false;
IWindow currentWindow = CurrentWindow.safeGet();
if (currentWindow instanceof INGClientWindow) {
isFormVisible = ((INGClientWindow) currentWindow).hasForm(parent.getName());
}
if (isFormVisible) {
// it is reported to be still on the client
// but do check also if it is not about to be hidden, by having
// formVisible already set to false in the controller
isFormVisible = ((WebFormUI) parent).getController().isFormVisible();
}
if (!isFormVisible) {
return false;
}
// if this form is in designer mode then it has to go to the client to get the current size/location
if (((WebFormUI) parent).getController().getDesignModeCallbacks() != null)
return true;
break;
}
parent = parent.getParent();
}
// if it is not table view (it can have columns moved/resize) and not anchored, no need to call api, let it get from the model on the server
FormElement fe = component.getFormElement();
if (fe.isLegacy() && fe.getPersistIfAvailable() instanceof ISupportAnchors && (fe.getForm().getView() != FormController.TABLE_VIEW && fe.getForm().getView() != FormController.LOCKED_TABLE_VIEW)) {
// ((ISupportAnchors)fe.getPersistIfAvailable()).getAnchors();
int anchor = Utils.getAsInteger(component.getProperty(StaticContentSpecLoader.PROPERTY_ANCHORS.getPropertyName()));
if ((anchor == 0 || anchor == (IAnchorConstants.NORTH + IAnchorConstants.WEST))) {
return false;
}
}
}
return true;
}
use of org.sablo.websocket.IWindow in project servoy-client by Servoy.
the class WebFormController method destroy.
@Override
public void destroy() {
if (isFormVisible() && application.isSolutionLoaded()) {
destroyOnHide = true;
} else {
try {
unload();
if (formUI != null) {
formUI.destroy();
formUI = null;
}
super.destroy();
IWindow window = CurrentWindow.safeGet();
if (window instanceof INGClientWindow && application.isSolutionLoaded()) {
((INGClientWindow) window).destroyForm(getName());
}
if (getBasicFormManager() != null)
getBasicFormManager().removeFormController(this);
} finally {
application.getFlattenedSolution().deregisterLiveForm(form, namedInstance);
}
}
}
Aggregations