use of com.servoy.j2db.server.headlessclient.MainPage in project servoy-client by Servoy.
the class WebDataSubmitLink method renderHead.
/**
* @see org.apache.wicket.markup.html.IHeaderContributor#renderHead(org.apache.wicket.markup.html.IHeaderResponse)
*/
public void renderHead(IHeaderResponse response) {
List<CharSequence> lst = strippedText.getJavascriptUrls();
for (int i = 0; i < lst.size(); i++) {
response.renderJavascriptReference(lst.get(i).toString());
}
lst = strippedText.getJavascriptScripts();
for (int i = 0; i < lst.size(); i++) {
// $NON-NLS-1$
response.renderJavascript(lst.get(i), "js_" + getMarkupId() + lst.get(i).hashCode());
}
lst = strippedText.getLinkTags();
for (int i = 0; i < lst.size(); i++) {
response.renderString(lst.get(i));
}
lst = strippedText.getStyles();
for (CharSequence style : lst) {
response.renderString(CSS_OPEN_TAG + style + CSS_CLOSE_TAG);
}
IValueMap map = strippedText.getBodyAttributes();
if (map != null && map.size() > 0) {
String onLoad = null;
Iterator<String> iterator = map.keySet().iterator();
while (iterator.hasNext()) {
String attributeName = iterator.next();
if (// $NON-NLS-1$
attributeName.equalsIgnoreCase("onload")) {
onLoad = map.getString(attributeName);
iterator.remove();
break;
}
}
if (onLoad != null) {
response.renderOnLoadJavascript(onLoad);
}
Page findPage = findPage();
if (findPage instanceof MainPage) {
((MainPage) findPage).addBodyAttributes(map);
}
}
}
use of com.servoy.j2db.server.headlessclient.MainPage in project servoy-client by Servoy.
the class WebEventExecutor method handleEvent.
/**
* @param type
* @param target
* @param comp
* @param webModifiers
* @param mouseLocation
* @param page
*/
private void handleEvent(EventType type, AjaxRequestTarget target, Component comp, int webModifiers, Point mouseLocation, Point absoluteMouseLocation, Page page) {
// process model changes from web components
WebClientSession.get().getWebClient().executeEvents();
Component renderScriptProvider = comp;
ISupplyFocusChildren<?> componentWithChildren = renderScriptProvider.findParent(ISupplyFocusChildren.class);
if (componentWithChildren != null)
renderScriptProvider = (Component) componentWithChildren;
if (renderScriptProvider instanceof WrapperContainer)
renderScriptProvider = ((WrapperContainer) renderScriptProvider).getDelegate();
RenderEventExecutor renderEventExecutor = null;
if (renderScriptProvider instanceof IScriptableProvider) {
IScriptable s = ((IScriptableProvider) renderScriptProvider).getScriptObject();
if (s instanceof ISupportOnRenderCallback) {
renderEventExecutor = ((ISupportOnRenderCallback) s).getRenderEventExecutor();
if (!renderEventExecutor.hasRenderCallback())
renderEventExecutor = null;
}
}
if (type == EventType.focusGained || type == EventType.action || type == EventType.focusLost) {
if (type == EventType.focusGained || type == EventType.action) {
((MainPage) page).setFocusedComponent(comp);
} else {
((MainPage) page).setFocusedComponent(null);
}
if (renderEventExecutor != null) {
renderEventExecutor.setRenderStateChanged();
// if component's onRender did not change any properties, don't add it to the target
if (renderScriptProvider instanceof ISupportOnRender && WebOnRenderHelper.doRender((ISupportOnRender) renderScriptProvider)) {
target.addComponent(renderScriptProvider);
}
}
}
if (type == EventType.focusLost || setSelectedIndex(comp, target, convertModifiers(webModifiers), type == EventType.focusGained || type == EventType.action)) {
if (skipFireFocusGainedCommand && type.equals(JSEvent.EventType.focusGained)) {
skipFireFocusGainedCommand = false;
} else {
switch(type) {
case action:
fireActionCommand(false, comp, convertModifiers(webModifiers), mouseLocation);
break;
case focusGained:
fireEnterCommands(false, comp, convertModifiers(webModifiers));
break;
case focusLost:
fireLeaveCommands(comp, false, convertModifiers(webModifiers));
break;
case doubleClick:
fireDoubleclickCommand(false, comp, convertModifiers(webModifiers), mouseLocation);
break;
case rightClick:
// if right click, mark the meta flag as it is on the smart client
fireRightclickCommand(false, comp, convertModifiers(webModifiers | 8), null, mouseLocation, absoluteMouseLocation);
break;
case none:
case dataChange:
case form:
case onDrag:
case onDragOver:
case onDrop:
}
}
}
}
use of com.servoy.j2db.server.headlessclient.MainPage in project servoy-client by Servoy.
the class WebDataField method fireOnRender.
public void fireOnRender(boolean force) {
if (!isIgnoreOnRender && scriptable != null) {
boolean isFocused = false;
IMainContainer currentContainer = ((FormManager) application.getFormManager()).getCurrentContainer();
if (currentContainer instanceof MainPage) {
isFocused = this.equals(((MainPage) currentContainer).getFocusedComponent());
}
if (force)
scriptable.getRenderEventExecutor().setRenderStateChanged();
scriptable.getRenderEventExecutor().fireOnRender(isFocused);
}
}
use of com.servoy.j2db.server.headlessclient.MainPage in project servoy-client by Servoy.
the class WebDataHtmlArea method fireOnRender.
public void fireOnRender(boolean force) {
if (scriptable != null) {
boolean isFocused = false;
IMainContainer currentContainer = ((FormManager) application.getFormManager()).getCurrentContainer();
if (currentContainer instanceof MainPage) {
isFocused = this.equals(((MainPage) currentContainer).getFocusedComponent());
}
if (force)
scriptable.getRenderEventExecutor().setRenderStateChanged();
scriptable.getRenderEventExecutor().fireOnRender(isFocused);
}
}
use of com.servoy.j2db.server.headlessclient.MainPage in project servoy-client by Servoy.
the class WebDataListBox method fireOnRender.
public void fireOnRender(boolean force) {
if (scriptable != null) {
boolean isFocused = false;
IMainContainer currentContainer = ((FormManager) application.getFormManager()).getCurrentContainer();
if (currentContainer instanceof MainPage) {
isFocused = this.equals(((MainPage) currentContainer).getFocusedComponent());
}
if (force)
scriptable.getRenderEventExecutor().setRenderStateChanged();
scriptable.getRenderEventExecutor().fireOnRender(isFocused);
}
}
Aggregations