defaultType = prefs_.compileNotebookOptions().getValue().getType();
if (StringUtil.isNullOrEmpty(defaultType))
defaultType = CompileNotebookOptions.TYPE_DEFAULT;
}
CompileNotebookOptionsDialog dialog = new CompileNotebookOptionsDialog(
getId(),
defaultTitle,
defaultAuthor,
defaultType,
new OperationWithInput<CompileNotebookOptions>()
{
@Override
public void execute(CompileNotebookOptions input)
{
server_.createNotebook(
input,
new SimpleRequestCallback<CompileNotebookResult>()
{
@Override
public void onResponseReceived(CompileNotebookResult response)
{
if (response.getSucceeded())
{
executeOnSuccess.execute();
}
else
{
globalDisplay_.showErrorMessage(
"Unable to Compile Notebook",
response.getFailureMessage());
}
}
});
// save options for this document
HashMap<String, String> changedProperties = new HashMap<String, String>();
changedProperties.put(NOTEBOOK_TITLE, input.getNotebookTitle());
changedProperties.put(NOTEBOOK_AUTHOR, input.getNotebookAuthor());
changedProperties.put(NOTEBOOK_TYPE, input.getNotebookType());
docUpdateSentinel_.modifyProperties(changedProperties, null);
// save global prefs
CompileNotebookPrefs prefs = CompileNotebookPrefs.create(
input.getNotebookAuthor(),
input.getNotebookType());
if (!CompileNotebookPrefs.areEqual(
prefs,
prefs_.compileNotebookOptions().getValue()))
{
prefs_.compileNotebookOptions().setGlobalValue(prefs);
prefs_.writeUIPrefs();
}
}
}
);
dialog.showModal();
}