We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
虽然这不是一个完整的解决方案,但它可能有助于指导您更接近可行的解决方案。我同意前面的海报,可以在代码中添加挂钩,这在大型项目中变得难以管理。此外,如果您错过了应用程序的一部分并来检查数据,则每次用户使用该组件时都会有一个空白区域。
相反,您可以直接侦听由 UI 中的每个组件生成的 AWTEvents。这很容易成为数据挖掘的源信息。以下代码向您展示了如何完成此操作:
在本例中,我监听了鼠标事件。这些似乎是最有用的,因为它们可以告诉您用户单击了什么。从这里开始,您需要计算出需要收集的内容,以便构建用户点击内容的图片。我也对用户没有点击的内容感兴趣。
围绕使用此技术的自动化 UI 测试有很多工作。 Abbot 和 FEST 是我用过的例子。您可能想看看他们如何处理 AWTEvents,以防有任何帮助。
Whilst this isn't a complete solution, it might help guide you closer to something workable. I agree with the previous poster, that it is possible to add hooks into your code, this becomes unmanageable on a large project. Also if you miss a part of the application and come to examine the data, you'll have a blank space each time the user uses that component.
Instead you can listen directly to AWTEvents which are generated by every component in the UI. This could easily be the source information for your data mining. The following code shows you how this is done:
In this case I have listened to Mouse Events. These seem to be the most useful as they can tell you what the user clicked on. From here, you'll need to work out what you need to collect in order to build up a picture of what the user clicked on. I would also be interested in what the user didn't click on as well.
There is lots of work surrounding automated UI testing which uses this technique. Abbot and FEST are examples I have used. You might want to look at how they process AWTEvents in case there is anything helpful there.
好吧,您首先希望以某种方式收到使用情况统计信息。那么您打算让您的应用程序连接到数据库吗?您是否打算使用另一个应用程序来处理使用情况统计信息?简而言之,我将创建一个像这样的函数
void LogUsage(this object id or handle name/caption text etc)
并让该函数处理处理统计使用情况的所有处理。当然,您需要做一些/某种工作,例如将此功能添加到 onClicks、编辑更改等,但这应该相当简单。特别是如果您的 LogUsage 函数仅采用唯一的内容(例如名称)并将其用于统计信息。
LogUsage 功能还可以管理远程连接并清除自上次传输以来可能存储的任何缓存。
简单地说,如果您创建了一个接受该对象的 LogUsage 函数,那么您总是会获取该名称。您可以轻松地在整个程序中复制/粘贴此行
LogUsage(this);
编辑
-我还注意到你正在寻找建议:我会按照我上面说的做;一个简单的 LogUsage 函数,它接受参数(例如对象)并获取名称(例如 btnLogin),然后将该名称处理到某种文件中。显然,您首先会将此文件加载到某种映射或数组中,首先检查它是否存在。如果没有,只需单击 1 次(或使用)即可将其添加到列表中。如果存在,则会增加其使用点。显然,您不想在文本框等中的 OnChange 方法上调用 LogUsage,但可能会调用所有 onFocus、Clicks 或您真正想要跟踪的任何内容。
最后,您可能会收到发送给您的类似 btnLogin (5) 的内容,表明用户单击了 btnLogin 5 次。
处理所有这些收到的数据是另一项工作,这就是为什么我肯定会将其发送到数据库而不是接收电子邮件或充满使用统计文件的服务器目录。无论哪种方式,您都需要一些东西来处理它并将其转换为图表或可排序的使用统计数据等。
Well, you would first expect to receive the usage statistics somehow. So are you going to have your app connect to a database? Are you going to have another app that process the usage statistics? In short, I would create a function like this
void LogUsage(this object id or handle name/caption text etc)
and let that function handle all the processing of handling statistical usage. Of course you will need to do /some/ kind of work such as add this function to onClicks, edits changes etc, but that should be fairly simple. Especially if your LogUsage function just takes something unique (like the name) and uses that for the statistics.
The LogUsage function can also then manage connecting remotely and clearing any cache it may have stored since its last transmit.
Simply stated, if you created a LogUsage function that accepts the object, and you always grab the name. You could just easily copy/paste this line throughout your program
LogUsage(this);
Edit-
I also noticed you are looking for suggestions: I would do what I said above; a simple LogUsage function that accepts a param such as the object, and grab the name, eg - btnLogin, and then processes that name into some kind of file. You would obviously first load this file into some kind of map or array, check to see if it exists first. If not it adds it to the list with 1 click (or usage). If it exists, it increments its usage point. You will obviously not want to call LogUsage on the OnChange method in a textbox etc, but probably all onFocus, Clicks, or whatever you are really wanting to keep track of.
In the end, you might end up with something like btnLogin (5) that is sent to you, indicating that the user clicked on btnLogin 5 times.
Handling all this received data is another endeavor, which is why I would definitely have it sent to a database rather than receiving, say an email or a server directory full of files of usage statistics. Either way, you will need something to process it and turn it into graphs or sortable usage statistics etc..
Netbeans 和 Eclipse 都有收集 UI 统计数据的机制,但我不知道使用这些基于其平台的应用程序有多么容易。
Netbeans and Eclipse both have mechanisms for collecting UI statistics but I have no idea how easy it is to use these outwith applications based on their platforms.
嗯,据我所知,我从未见过任何类型的 Swing 应用程序自动收集使用情况统计信息。
在我看来,实现此类功能的最简单方法是使用 Look'n'feel :这样,每个组件将透明地关联到最合适的记录器(将监听 JCheckBox 进行检查,而 JSCrollBar 将具有其滚动记录)。
您可能会考虑向Kirill Grouchnikov询问该功能,但我什至担心Substance 没有实现它。
Well, as far as I know, I've never seen any kind of usage statistics automatic gathering for Swing applications.
To my mind, the easiest way to implement such a feature would be to use look'n'feel : this way, each component will transparently be associated to the best fitting loggers (a JCheckBox will be listened for checks, while a JSCrollBar would have its scroll logged).
You may think about asking Kirill Grouchnikov about that feature, but I fear even Substance does not implement it.