}
public TranslationEditPage(final Locale targetLocale) {
super();
final IModel translationModel;
{
TranslateBean translateBean;
final GeoServerApplication application = getGeoServerApplication();
translateBean = (TranslateBean) application.getMetaData(TRANSLATION_BEAN);
if (translateBean == null) {
TranslationController controller = getController();
Map<Locale, Map<String, String>> translatedResources;
translatedResources = controller.getTranslatedResources();
// default locale is keyed by null
Locale baseLocale = null;
translateBean = new TranslateBean(baseLocale, translatedResources);
application.setMetaData(TRANSLATION_BEAN, translateBean);
}
translateBean.setTargetLanguage(targetLocale);
// translationModel = new Model(translateBean);
translationModel = new LoadableDetachableModel() {
private static final long serialVersionUID = 1L;
@Override
protected Object load() {
final Application application = getApplication();
TranslateBean translateState = (TranslateBean) application
.getMetaData(TRANSLATION_BEAN);
return translateState;
}
};
}
setModel(translationModel);
add(toolbar());
add(filter());
add(translateForm = new Form("translateForm"));
translateForm
.add(keyTreePanel = new ResourceKeyTreePanel("keyTreePanel", translationModel));
translateForm.add(translationPanel = new TranslationResourcePanel("resourcePanel",
translationModel));
add(changeUILocale());
final IModel currentKeyModel = new PropertyModel(translationModel, "currentKey");
keyTreePanel.getTree().add(new AjaxFormSubmitBehavior(translateForm, "onclick") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(final AjaxRequestTarget target) {
String selectedNodeKey = keyTreePanel.getSelectedNodeKey();
currentKeyModel.setObject(selectedNodeKey);
translationPanel.refresh(target);
}
@Override
protected void onError(final AjaxRequestTarget target) {