public void ready(final YuiContext Y) {
final Console console1 = Y.newConsole(ConsoleConfig.create());
console1.render();
Button b1 = Y.newButton(ButtonConfig.create().label("loadScript1")).render(parent).cast();
b1.on("click", new EventCallback() {
@Override
public void call(EventFacade e) {
Y.Get().js(GWT.getModuleBaseURL()+"testfiles/script1.js");
}
}).cast();
Button b2 = Y.newButton(ButtonConfig.create().label("loadcss1")).render(parent).cast();
b2.on("click", new EventCallback() {
@Override
public void call(EventFacade e) {
Y.Get().css(GWT.getModuleBaseURL()+"testfiles/css1.css");
}
});
//now try to load a non existing file - catch the error using the normal callback for accessing the error
Button b3 = Y.newButton(ButtonConfig.create().label("nonExisting1")).render(parent).cast();
b3.on("click", new EventCallback() {
@Override
public void call(EventFacade e) {
Y.Get().css(GWT.getModuleBaseURL()+"testfiles/jsNotExists123.css", GetConfig.create(), new GetCallback() {
@Override
public void call(JsArray err_, Transaction tx) {
JsArray<GetError> err = (JsArray<GetError>)err_;
Window.alert("error count: "+err.length()+" - first error: "+
err.get(0).error());
}
});
};
});
//or, the same as as above but using the Get's options object for registering an onFailure listener:
Button b4 = Y.newButton(ButtonConfig.create().label("nonExisting2")).render(parent).cast();
b4.on("click", new EventCallback() {
@Override
public void call(EventFacade e) {
Y.Get().css(GWT.getModuleBaseURL()+"testfiles/jsNotExists123.css", GetConfig.create().onFailure(new GetOptionsCallback() {
@Override