package org.yaac.client.ui;
import javax.inject.Inject;
import org.yaac.client.ui.EditorPropertyPanel.CloseBtnHandler;
import org.yaac.shared.property.PropertyInfo;
import com.google.gwt.user.client.ui.PopupPanel;
/**
* @author Max Zhu (thebbsky@gmail.com)
*
* dialog manager
*/
public class EditorPropertyManager {
/**
* @author Max Zhu (thebbsky@gmail.com)
*
*/
public static interface PropertyEditCallback {
void onEditSuccess(PropertyInfo newInfo);
}
private PopupPanel popup;
private final EditorPropertyPanel popupPanel;
@Inject
EditorPropertyManager(EditorPropertyPanel popupPanel) {
this.popupPanel = popupPanel;
popup = new PopupPanel();
popup.setAnimationEnabled(true);
popup.setGlassEnabled(true);
popup.setAutoHideEnabled(false);
popup.setSize("640px", "480px");
popup.add(this.popupPanel);
popupPanel.setCloseHandler(new CloseBtnHandler() {
@Override
public void onCloseBtnClick() {
popup.hide();
}
});
}
public void edit(String keyString, PropertyInfo info, PropertyEditCallback callback) {
popupPanel.edit(keyString, info, callback);
popup.center();
}
}