tab_counter++;
}
};
// modal dialog init: custom buttons and a "close" callback reseting the form inside
final Dialog dialog = $("#dialog").as(Ui).dialog(Dialog.Options.create().autoOpen(false).modal(true)//
.buttons(Buttons.create() //
.define("Add", new Function() {
public boolean f(Event e) {
addTab.f((Element) null);
$("#dialog").as(Ui).dialog().close();
return false;
}
}) //
.define("Cancel", new Function() {
public boolean f(Event e) {
$("#dialog").as(Ui).dialog().close();
return false;
}
})));
dialog.bind(Dialog.Event.open, new Function() {
public void f(Element e) {
tab_title_input.focus();
};
})//
.bind(Dialog.Event.close, new Function() {
public void f(Element e) {
FormElement form = $("form", dialog.elements()[0]).elements()[0].cast();
form.reset();
};
});
// addTab button: just opens the dialog
$("#add_tab").as(Ui).button().click(new Function() {
public boolean f(Event e) {
dialog.open();
return false;
};
});
}