public void AddRange(IViewHandler[] value)
 {
     if (value == null) {
         throw new ArgumentNullException ("Value null");
     }
     arrayList.AddRange (value);
 }
        internal ComponentActionDispatcher(IComponentModel componentModel, MethodInfo methodToExecute, object[] parameters, IViewHandler viewHandler, MethodInfo methodToResponse)
        {
            this.componentModel = componentModel;
            this.methodToExecute = methodToExecute;
            this.parameters = parameters;
            this.viewHandler = viewHandler;
            this.methodToResponse = methodToResponse;

            threadStart = new ThreadStart (CallBackExecuteRedirectView);
            thread = new Thread (threadStart);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Registers a view handler
 /// </summary>
 /// <param name="handler">Handler to register</param>
 /// <param name="viewHandlerId">Optional ID, so the handler can later be re-identified if needed</param>
 /// <param name="replaceHandlersWithMatchingId">If true (default) then current registered handlers with identical ID will be replaced</param>
 /// <remarks>Document handlers are objects that are given a chance to handle views when they need launching.</remarks>
 public static void RegisterViewHandler(IViewHandler handler, string viewHandlerId = "", bool replaceHandlersWithMatchingId = true)
 {
     if (string.IsNullOrEmpty(viewHandlerId)) viewHandlerId = Guid.NewGuid().ToString();
     if (_viewHandlers == null) _viewHandlers = new Dictionary<string, IViewHandler>();
     if (_viewHandlers.ContainsKey(viewHandlerId))
     {
         if (replaceHandlersWithMatchingId)
             _viewHandlers[viewHandlerId] = handler;
     }
     else
         _viewHandlers.Add(viewHandlerId, handler);
 }
Exemplo n.º 4
0
    /// <summary>
    /// 创建 PartialRenderAdapter 实例
    /// </summary>
    /// <param name="urlHelper">用于产生 URL 的 URL 帮助器</param>
    /// <param name="viewContext">当前视图上下文</param>
    /// <param name="viewHandler">当前视图处理程序</param>
    public PartialViewAdapter( ViewContext viewContext, JumonyUrlHelper urlHelper, IViewHandler viewHandler )
      : base( viewContext.HttpContext, viewHandler )
    {
      if ( viewContext == null )
        throw new ArgumentNullException( "viewContext" );

      if ( urlHelper == null )
        throw new ArgumentNullException( "urlHelper" );

      if ( viewHandler == null )
        throw new ArgumentNullException( "viewHandler" );

      ViewContext = viewContext;
      ViewHandler = viewHandler;
      Url = urlHelper;

    }
Exemplo n.º 5
0
        /// <summary>
        /// 创建 PartialRenderAdapter 实例
        /// </summary>
        /// <param name="view">需要渲染部分视图的宿主视图</param>
        public PartialRenderAdapter( ViewContext viewContext, JumonyUrlHelper urlHelper, IViewHandler viewHandler )
        {
            if ( viewContext == null )
            throw new ArgumentNullException( "viewContext" );

              if ( urlHelper == null )
            throw new ArgumentNullException( "urlHelper" );

              if ( viewHandler == null )
            throw new ArgumentNullException( "viewHandler" );

              ViewContext = viewContext;
              ViewHandler = viewHandler;
              Url = urlHelper;

              var wrapper = viewHandler as IHandlerWrapper;
              if ( wrapper != null )
            _partialExecutors = GetPartialExecutors( wrapper.Handler.GetType() );
              else
            _partialExecutors = GetPartialExecutors( viewHandler.GetType() );
        }
Exemplo n.º 6
0
        /// <summary>Closes the view associated with the provided model.</summary>
        /// <param name="model">Model associated with the view that is to be closed</param>
        /// <remarks>This only works if the model is only used with a single view. This will not work (or work unpredictably) for models that are shared across views.</remarks>
        public static void CloseViewForModel(object model)
        {
            if (_viewHandlers == null) return;

            var handlers = new IViewHandler[_viewHandlers.Values.Count];
            _viewHandlers.Values.CopyTo(handlers, 0);
            foreach (var handler in handlers)
                handler.CloseViewForModel(model);
        }
Exemplo n.º 7
0
        public static void MapShadowProperty(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.SetEnvironment(EnvironmentKeys.View.Shadow, virtualView.GetShadow(), false);
        }
Exemplo n.º 8
0
        public static void MapOverlayProperty(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.Overlay(virtualView.GetOverlay());
        }
Exemplo n.º 9
0
        public static void Redraw(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.Invalidate();
        }
Exemplo n.º 10
0
        public static void MapColorProperty(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.Color(virtualView.GetColor(Color.Transparent));
        }
 public bool Contains(IViewHandler value)
 {
     return arrayList.Contains (value);
 }
Exemplo n.º 12
0
 public static void MapBackgroundColor(IViewHandler handler, IView view)
 {
     (handler.NativeView as NativeView)?.UpdateBackgroundColor(view);
 }
		/// <summary>
		/// Removes a view handler from this binding
		/// </summary>
		public void RemoveHandler(IViewHandler handler)
		{
			_handlers.Remove(handler);

			if (_handlers.Count == 0 && _bindingEmpty != null)
			{
				_bindingEmpty (this);
			}
		}
 public int IndexOf(IViewHandler value)
 {
     return arrayList.IndexOf (value);
 }
Exemplo n.º 15
0
 public static NativeView?GetWrappedNativeView(this IViewHandler viewHandler) =>
 (NativeView?)(viewHandler.ContainerView ?? viewHandler.NativeView);
 public ResponseMethodDTO Execute(string methodName, object[] parameters, IViewHandler viewHandler)
 {
     return this.Execute (methodName, parameters, true, viewHandler, true);
 }
Exemplo n.º 17
0
 public static void MapColorProperty(IViewHandler viewHandler, Text virtualView)
 {
 }
 public void Remove(IViewHandler value)
 {
     arrayList.Remove (value);
 }
Exemplo n.º 19
0
        private void bindViewHandler(IViewHandler handler)
        {
            unbindViewHandler();

            this.viewHandler = handler;
            this.viewHandler.NextPageDisplay += viewHandler_NextPageDisplay;
            this.viewHandler.PreviousPageDisplay += viewHandler_PreviousPageDisplay;
            this.viewHandler.Display += viewHandler_Display;
        }
 public void Insert(int index, IViewHandler value)
 {
     arrayList.Insert (index, value);
 }
Exemplo n.º 21
0
 public static void MapFrame(IViewHandler handler, IView view)
 {
     handler.SetFrame(view.Frame);
 }
		public void RemoveViewHandler(IViewHandler handler)
		{
			_handlers.Remove(handler);

			foreach(object container in _containers)
			{
				_registry.GetBinding(container).RemoveHandler(handler);
			}

			if (_handlerRemove != null)
			{
				_handlerRemove (handler);
			}
		}
 public int Add(IViewHandler value)
 {
     return arrayList.Add (value);
 }
        private ResponseMethodDTO ExecuteRedirectView(MethodInfo methodToExecute, object[] parameters, IViewHandler viewHandler, MethodInfo methodToResponse)
        {
            ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO) FactoryDTO.Instance.Create (CreateDTO.ResponseMethod);
            try {
                object ret = methodToExecute.Invoke (this, parameters);
                responseMethodDTO.MethodResult = ret;
                responseMethodDTO.SetExecutionSuccess (true);
                if (VirtualMethod != null) {
                    VirtualMethod (responseMethodDTO);
                    VirtualMethod = null;
                }
                //Beta Implementation
                //
                if (!ViewHandlerCollection.Contains (viewHandler)) {
                    ViewHandlerCollection.Add (viewHandler);
                    logger.Debug ("A new view has been added to View Cache");
                }
                else {
                    logger.Debug ("This view has already been registered at View Cache.");
                }
                //
                //End

                methodToResponse.Invoke (viewHandler, new object[] {responseMethodDTO});
            }
            catch (TargetInvocationException exception) {
                this.MapException (exception);
            }
            return responseMethodDTO;
        }
 public static void MapDrawable(IViewHandler handler, IGraphicsView graphicsView)
 {
 }
Exemplo n.º 26
0
    /// <summary>
    /// 获取 HTML 渲染代理
    /// </summary>
    /// <remarks>
    /// 默认的渲染代理包含一个:
    /// 1. 部分视图渲染代理,处理 &lt;partial&gt; 标签
    /// </remarks>
    /// <returns>HTML 渲染代理列表</returns>
    public virtual IList<IHtmlRenderAdapter> GetRenderAdapters( IViewHandler handler )
    {

      var result = new List<IHtmlRenderAdapter>()
      {
        new PartialViewAdapter( ViewContext, Url, handler ),
      };

      var customRenderAdapters = handler as ICustomRenderAdapters;
      if ( customRenderAdapters != null )
        result.AddRange( customRenderAdapters.GetCustomRenderAdapters() );

      return result;
    }
Exemplo n.º 27
0
 public static void MapPoints(IViewHandler handler, Polyline polygon)
 {
 }
Exemplo n.º 28
0
 public static void MapText(IViewHandler handler, ILabel label)
 {
 }
Exemplo n.º 29
0
        public static void MapContentProperty(IViewHandler viewHandler, ContentView virtualView)
        {
            var nativeView = (BView)viewHandler.NativeView;

            nativeView.View = virtualView.Content;
        }
Exemplo n.º 30
0
 public static void MapIsEnabled(IViewHandler handler, IView view)
 {
     (handler.NativeView as NativeView)?.UpdateIsEnabled(view);
 }
Exemplo n.º 31
0
        public static void MapTextProperty(IViewHandler viewHandler, Button virtualButton)
        {
            var nativeButton = (WPFButton)viewHandler.NativeView;

            nativeButton.Content = virtualButton.Text;
        }
Exemplo n.º 32
0
 public static void MapAutomationId(IViewHandler handler, IView view)
 {
     (handler.NativeView as NativeView)?.UpdateAutomationId(view);
 }
Exemplo n.º 33
0
 public void AddHandler(IViewHandler handler) {
   _handlers.Add(handler);
 }
Exemplo n.º 34
0
        public static void MapBackgroundColor(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.Background(virtualView.GetBackgroundColor(Color.Transparent));
        }
Exemplo n.º 35
0
 public static void MapTextColor(IViewHandler handler, IEntry entry)
 {
 }
Exemplo n.º 36
0
        public static void MapBorderProperty(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.Border(virtualView.GetBorder());
        }
Exemplo n.º 37
0
 public static void MapIsPassword(IViewHandler handler, IEntry entry)
 {
 }
Exemplo n.º 38
0
        public static void MapClipShapeProperty(IViewHandler viewHandler, View virtualView)
        {
            var control = viewHandler as SkiaControl;

            control.ClipShape(virtualView.GetClipShape());
        }
Exemplo n.º 39
0
 public static void MapHorizontalTextAlignment(IViewHandler handler, IEntry entry)
 {
 }
Exemplo n.º 40
0
 public static void MapAnchorY(IViewHandler handler, IView view)
 {
     handler.GetWrappedNativeView()?.UpdateTransformation(view);
 }
Exemplo n.º 41
0
 public static void MapIsTextPredictionEnabled(IViewHandler handler, IEntry entry)
 {
 }
Exemplo n.º 42
0
        /// <summary>
        /// Closes all currently open views.
        /// </summary>
        public static void CloseAllViews()
        {
            if (_viewHandlers == null) return;

            var handlers = new IViewHandler[_viewHandlers.Values.Count];
            _viewHandlers.Values.CopyTo(handlers, 0);
            foreach (var handler in handlers)
                handler.CloseAllViews();
        }
Exemplo n.º 43
0
 public static void MapFont(IViewHandler handler, IEntry entry)
 {
 }
		public void AddViewHandler(IViewHandler handler)
		{
			if (_handlers.Contains(handler))
				return;

			_handlers.Add(handler);

			// Add new handler to our containers
			if (_fallbackContainer != null) 
			{
				_registry.GetBinding (_fallbackContainer).AddHandler (handler);
			} 
			else 
			{
				foreach (object container in _containers) 
				{
					_registry.AddContainer (container).AddHandler (handler);
				}
			}

			if (_handlerAdd != null)
			{
				_handlerAdd (handler);
			}
		}
Exemplo n.º 45
0
 public static void MapReturnType(IViewHandler handler, IEntry entry)
 {
 }
Exemplo n.º 46
0
 /*Servicio ejecutor*/
 public ResponseMethodDTO Execute(string componentName, string methodName, object[] parameters, bool redirect, IViewHandler viewHandler, bool block)
 {
     IComponentModel componentModel = this.GetComponentByName (componentName);
     return componentModel.Execute (methodName, parameters, redirect, viewHandler, block);
 }
Exemplo n.º 47
0
 public static void MapClearButtonVisibility(IViewHandler handler, IEntry entry)
 {
 }
 /*Executor commander !*/
 public ResponseMethodDTO Execute(string methodName, object[] parameters, bool redirect, IViewHandler viewHandler, bool block)
 {
     /*Existen cosas que siempre deben de buscarse*/
     MethodInfo methodToExecute = this.GetMethodToExecute (methodName, parameters);
     ComponentMethodAttribute componentMethodAttribute = this.GetComponentAttributes (methodToExecute);
     /*Primero discernimos si es bloqueante o no lo es*/
     if (block) {
         //Operaciones que son bloqueantes
         if (redirect) {
             MethodInfo methodToResponse ;
             Type viewType;
             if (viewHandler == null) {
                 //FIX: Aún se podria mejorar esta invocación.
                 viewType = this.GetViewType (componentMethodAttribute);
                 methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute);
                 return ExecuteRedirectNewView (methodToExecute, parameters, viewType, methodToResponse);
             }
             else {
                 //Redirigimos a la que nos pide
                 viewType = viewHandler.GetType ();
                 methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute);
                 return ExecuteRedirectView (methodToExecute, parameters, viewHandler, methodToResponse);
             }
         }
         else {
             //No necesitamos información sobre la vista, ni el response.
             //No se va a ejecutar.
             return ExecuteNoRedirect (methodToExecute, parameters);
         }
     }
     else {
         ComponentActionDispatcher componentActionDispatcher;
         //Operaciones bloqueantes, envolver en un hilo
         if (redirect) {
             MethodInfo methodToResponse;
             Type viewType;
             if (viewHandler == null) {
                 //Exception handling ¿¿
                 viewType = this.GetViewType (componentMethodAttribute);
                 methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute);
                 componentActionDispatcher = new ComponentActionDispatcher (this, methodToExecute, parameters, viewType, methodToResponse);
                 try {
                     componentActionDispatcher.Do ();
                 }
                 catch (TargetInvocationException exception) {
                     this.MapException (exception);
                 }
                 return componentActionDispatcher.ResponseMethodDTO;
             }
             else {
                 viewType = viewHandler.GetType ();
                 methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute);
                 componentActionDispatcher = new ComponentActionDispatcher (this, methodToExecute, parameters, viewHandler, methodToResponse);
                 try {
                     componentActionDispatcher.Do ();
                 }
                 catch (TargetInvocationException exception) {
                     this.MapException (exception);
                 }
                 return componentActionDispatcher.ResponseMethodDTO;
             }
         }
         else {
             componentActionDispatcher = new ComponentActionDispatcher (this, methodToExecute, parameters);
             try {
                 componentActionDispatcher.Do ();
             }
             catch (TargetInvocationException exception) {
                 this.MapException (exception);
             }
             return componentActionDispatcher.ResponseMethodDTO;
         }
     }
     //return null;
 }
Exemplo n.º 49
0
 public static void MapCharacterSpacing(IViewHandler handler, IEntry entry)
 {
 }
		/*============================================================================*/
		/* Public Functions                                                           */
		/*============================================================================*/

		/// <summary>
		/// Adds a view handler to this binding
		/// </summary>
		/// <param name="handler">Handler.</param>
		public void AddHandler(IViewHandler handler)
		{
			if (_handlers.Contains (handler))
				return;
			_handlers.Add(handler);
		}
Exemplo n.º 51
0
 public static void MapKeyboard(IViewHandler handler, IEntry entry)
 {
 }
Exemplo n.º 52
0
 public HandlerToRendererShim(IViewHandler vh)
 {
     ViewHandler = vh;
 }
Exemplo n.º 53
0
 public static void MapCharacterSpacing(IViewHandler handler, ILabel label)
 {
 }
Exemplo n.º 54
0
 /// <summary>
 /// 处理 HTML 文档
 /// </summary>
 protected virtual void ProcessScope( IViewHandler handler )
 {
   handler.ProcessScope( CreateViewContext(), Scope, Url );
 }
 public void CopyTo(IViewHandler[] array, int index)
 {
     arrayList.CopyTo (array, index);
 }