Beispiel #1
0
            override public void Tile(BT.Tile tile)
            {
                tileTable [tile.UniqueKey] = tile;

                if (!renderStylesDone)
                {
                    //KNV: Using static_stylesheet for now. Replace with TileCanvas logic later:
                    Write(static_stylesheet);

/*
 *                              Write ("<style type=\"text/css\" media=\"screen\">");
 *                              TileCanvas.RenderStyles (this);
 *                              Write ("</style>");
 */
                    renderStylesDone = true;
                }

                if (tile != null)
                {
                    if (tile is BT.TileHitCollection)
                    {
                        PrefetchSnippetsForNetworkHits((BT.TileHitCollection)tile);
                    }

                    tile.Render(this);
                }
            }
		public abstract void Tile (Tile tile);
Beispiel #3
0
		private void OnTileChanged (Tile tile)
		{
			ScheduleRender ();
		}
Beispiel #4
0
		private void PaintTile (Tile tile)
		{
			TileCanvasRenderContext ctx;
			ctx = new TileCanvasRenderContext (this, 
							   tile);

			// IMPORTANT!  The <meta> tag has to be in the first
			// chunk written to the stream or else the encoding
			// will be wrong!
			ctx.Write ("<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n");

       			ctx.Write ("<style type=\"text/css\" media=\"screen\">\n");
			RenderStyles (ctx);
			ctx.Write ("</style>\n"); 

			ctx.Write ("</head>\n");

			if (tile != null) {
				tile.Render (ctx);
			}

			ctx.Write ("</html>");
		}
Beispiel #5
0
			override public void Tile (Tile tile)
			{
				canvas.CacheTile (tile);
				tile.Render (this);
			}
Beispiel #6
0
			public TileCanvasRenderContext (TileCanvas _canvas, Tile _tile)
			{
				canvas = _canvas;
				tileMain = _tile;
				canvas.CacheTile (tileMain);
			}
Beispiel #7
0
		private void CacheTile (Tile tile)
		{
			tileTable [tile.UniqueKey] = tile;
			tile.SetChangedHandler (new TileChangedHandler (OnTileChanged));
		}
			public HitTilePair (Hit _hit, Tile _tile)
			{
				hit = _hit;
				tile = _tile;
			}
		public bool Add (Hit hit, Tile tile)
		{
			bool changed = false;
			
			HitTilePair pair = new HitTilePair (hit, tile);
			int i = all_hits.BinarySearch (pair);
			all_hits.Insert (i < 0 ? ~i : i, pair);
			if (i == 0 || i < LastDisplayed) {
				Changed ();
				changed = true;
			}

			if (SourceIsDisplayable (hit)) {
				if (InsertDisplayable (pair))
					changed = true;
			}

			return changed;
		}
Beispiel #10
0
        public void dispatchAction(string sessId, string actionString)
        {
            string tile_id = null, action = null;
            bool   actionDone = false;

            //if (actionString.StartsWith ("dynaction:"))  {

            bufferRenderContext b = ((Resp)sessionResp[sessId]).bufferContext;

            if (b != null)
            {
                actionDone = b.DoAction(actionString);
            }
            //}

            if (actionDone)
            {
                return;
            }

            if (actionString.StartsWith("action:"))
            {
                int pos1 = "action:".Length;
                int pos2 = actionString.IndexOf("!");

                if (pos2 <= 0)
                {
                    return;
                }

                tile_id = actionString.Substring(pos1, pos2 - pos1);
                action  = actionString.Substring(pos2 + 1);

                log.Debug("WebBackEnd tile_id: {0}, action: {1}", tile_id, action);

                BT.Tile t = ((Resp)sessionResp[sessId]).GetTile(tile_id);

                if (t == null)
                {
                    return;
                }

                MethodInfo info = t.GetType().GetMethod(action,
                                                        BindingFlags.Public | BindingFlags.NonPublic |
                                                        BindingFlags.Instance, null,
                                                        CallingConventions.Any, new Type[] {}, null);

                if (info == null)
                {
                    log.Warn("WebBackEnd:dispatchAction couldn't find method called {0}", action);
                    return;
                }

                object[] attrs = info.GetCustomAttributes(false);
                foreach (object attr in attrs)
                {
                    if (attr is BT.TileActionAttribute)
                    {
                        info.Invoke(t, null);
                        return;
                    }
                }
                log.Warn("WebBackEnd:dispatchAction {0} does not have the TileAction attribute", t);
            }

            string command     = null;
            string commandArgs = null;

            if (actionString.StartsWith("http://") || actionString.StartsWith("file://"))
            {
                command     = "gnome-open";
                commandArgs = "'" + actionString + "'";
            }
            else if (actionString.StartsWith("mailto:"))
            {
                command     = "evolution";
                commandArgs = actionString;
            }

            if (command != null)
            {
                Process p = new Process();
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.FileName        = command;
                if (commandArgs != null)
                {
                    //if (args != null)
                    p.StartInfo.Arguments = commandArgs;
                }
                try {
                    p.Start();
                }
                catch { }
            }
        }