use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.
the class Engine method setAsync.
/**
* Do we ask the XHR object to be asynchronous? (Default: true)
* @param async False to become synchronous (not recommended)
* @see <a href="http://getahead.org/dwr/browser/engine/options">Options documentation</a>
*/
public void setAsync(boolean async) {
ScriptBuffer script = new ScriptBuffer();
script.appendScript("dwr.engine.setAsync(").appendData(async).appendScript(");");
addScript(script);
}
use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.
the class Engine method setPollType.
/**
* Set the preferred polling type.
* @param newPollType One of {@link #XMLHttpRequest}, {@link #IFrame} or {@link #ScriptTag}
* @see <a href="http://getahead.org/dwr/browser/engine/options">Options documentation</a>
*/
public void setPollType(int newPollType) {
ScriptBuffer script = new ScriptBuffer();
script.appendScript("dwr.engine.setPollUsingComet(").appendData(newPollType).appendScript(");");
addScript(script);
}
use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.
the class Util method removeNode.
/**
* Sets a CSS style on an element
* @param elementId The HTML element to update (by id)
*/
public void removeNode(String elementId) {
ScriptBuffer script = new ScriptBuffer();
script.appendScript("dwr.util._temp = dwr.util.byId(").appendData(elementId).appendScript("); ").appendScript("if (dwr.util._temp) { dwr.util._temp.parentNode.removeChild(dwr.util._temp); dwr.util._temp = null; }");
addScript(script);
}
use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.
the class Util method setStyle.
/**
* Sets a CSS style on an element
* @param elementId The HTML element to update (by id)
* @param selector The CSS selector to update
* @param value The new value for the CSS class on the given element
*/
public void setStyle(String elementId, String selector, String value) {
ScriptBuffer script = new ScriptBuffer();
script.appendScript("dwr.util.byId(").appendData(elementId).appendScript(").style.").appendScript(selector).appendScript("=").appendData(value).appendScript(";");
addScript(script);
}
use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.
the class DwrConvertTag method doStartTag.
@Override
public int doStartTag() throws JspException {
ServletContext servletContext = pageContext.getServletContext();
Container container = (Container) servletContext.getAttribute("DwrContainer");
if (container == null)
throw new JspException("Can't find 'DwrContainer' in servlet context");
ConverterManager converterManager = (ConverterManager) container.getBean(ConverterManager.class.getName());
final ScriptBuffer scriptBuffer = new ScriptBuffer();
scriptBuffer.appendScript("return ");
scriptBuffer.appendData(obj);
WebContextBuilder webContextBuilder = (WebContextBuilder) servletContext.getAttribute(WebContextBuilder.class.getName());
try {
webContextBuilder.set((HttpServletRequest) pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse(), null, servletContext, container);
JspWriter out = pageContext.getOut();
out.write("function() {");
out.write(ScriptBufferUtil.createOutput(scriptBuffer, converterManager));
out.write(";}()");
} catch (IOException e) {
throw new JspException("Error writing tag content", e);
} catch (MarshallException e) {
throw new JspException("Error marshalling object data", e);
} finally {
webContextBuilder.unset();
}
return EVAL_PAGE;
}
Aggregations