public void ReplaceMaster(IBareForm <HTMLElement> newForm) { var maybeMaster = _adapted.Master; _adapted.ReplaceMaster(newForm); _callback(this, newForm, maybeMaster); }
private PopupInfo( IFormCanvas <HTMLElement> canvas, IBareForm <HTMLElement> form, IFormView <HTMLElement> formView) { Canvas = canvas; Form = form; FormView = formView; }
private void RemovePopupImpl(IBareForm <HTMLElement> frm) { if (_parent != null) { _parent.RemovePopupImpl(frm); return; } _popups.Remove(frm); TryPutFocusOnTopMostForm(); }
private void AddPopupImpl(IBareForm <HTMLElement> frm) { if (_parent != null) { _parent.AddPopupImpl(frm); return; } var x = _popups.AddPopup(frm); TryPutFocusOnForm(x); }
public void Remove(IBareForm <HTMLElement> frm) { Logger.Debug(GetType(), "Remove() form={0} _masterFormView={1} isMaster?={2}", frm, _masterFormView, frm.View == _masterFormView); if (frm.View == _masterFormView) { ClearMaster(); //if there's popup it keeps focus return; } RemovePopupImpl(frm); }
public void Remove(IBareForm <HTMLElement> frm) { var maybeFrm = _popups.FirstOrDefault(x => x.FormView == frm.View); if (maybeFrm != null) { maybeFrm.Canvas.Unrender(); _popups.Remove(maybeFrm); return; } Logger.Error(GetType(), "Remove() form was not shown. Popups={0} failing!", _popups.PrettyToString()); throw new Exception(string.Format("form was not shown {0}", frm)); }
public static void RenderForm(this IFormCanvas <HTMLElement> self, IBareForm <HTMLElement> form, Action beforeShow) { Debug($"RenderForm() form into canvas: title={form.Title}, type={form.GetType().FullName}"); var handlers = form.ExternalEventsHandlers; self.UserCancel = handlers.OnUserCancel; self.Body = BuildBody(form.View); self.Actions = form.View.Actions.Select(x => x.Widget); beforeShow(); Handlers.Set(self, handlers); self.Show(); Logger.Debug(typeof(FormCanvasExtensions), "RenderForm() ending"); }
public void ClearMaster() { Logger.Debug(GetType(), "ClearMaster() _masterFormView={0} _masterAdaptedView={1}", _masterFormView, _masterAdaptedView); if (_masterAdaptedView != null) { _masterCanvas.Hide(); _masterAdaptedView = null; } if (_masterFormView == null) { return; } _masterCanvas.Unrender(); _masterFormView = null; _masterForm = null; }
public IFormCanvas <HTMLElement> AddPopup(IBareForm <HTMLElement> newForm) { Logger.Debug(GetType(), "AddPopup() {0}", newForm); var newCanvas = _popupCanvasProvider.Provide(); newCanvas.RenderForm( newForm, () => { if (_popups.Any(x => x.FormView == newForm.View)) { Logger.Error(GetType(), "AddPopup() form was already added. popups={0} failing!", _popups.PrettyToString()); throw new Exception(string.Format("form was already added {0}", newForm)); } _popups.Add(PopupInfo.Create(newCanvas, newForm, newForm.View)); }); newCanvas.Title = newForm.Title; (newForm as IOnShownNeedingForm <HTMLElement>)?.OnShown(); return(newCanvas); }
public void ReplaceMaster(IBareForm <HTMLElement> newForm) { var isSame = newForm.View == _masterFormView; Logger.Debug(GetType(), "ReplaceMaster() with {0}. Same as now?{0}", newForm, isSame); ClearMaster(); _masterCanvas.RenderForm( newForm, () => { _masterFormView = newForm.View; _masterForm = newForm; }); _masterCanvas.Title = newForm.Title; //don't steal focus from popup (if any) if (MaybeGetTopMostDialog() == null) { TryPutFocusOnForm(_masterCanvas); } (newForm as IOnShownNeedingForm <HTMLElement>)?.OnShown(); }
public static PopupInfo Create( IFormCanvas <HTMLElement> canvas, IBareForm <HTMLElement> form, IFormView <HTMLElement> formView) => new PopupInfo(canvas, form, formView);
public void AddPopup(IBareForm <HTMLElement> newForm) => AddPopupImpl(newForm);
public void Remove(IBareForm <HTMLElement> frm) { _adapted.Remove(frm); _callback(this, null, frm); }
public void AddPopup(IBareForm <HTMLElement> newForm) { _adapted.AddPopup(newForm); _callback(this, newForm, null); }