保存表项的状态
我有一个要求,当用户已经查看表中的该项目时,我需要标记该表项目。 它就像收件箱中的电子邮件一样。当用户阅读邮件时,字体将更改为正常。我需要实施同样的方式。为此,我在表格中使用了 Font。现在我需要保存表项的状态。当应用程序重新启动时,用户已经查看过的表项应该被视为已查看项。我的意思是普通字体。有什么办法可以保存表项的状态吗?
谢谢 巴努
I have one requirement that I need to mark the table item when the user has already viewed that item in the table.
It is exactly like emails in the inbox. when the user reads the mail, the font will be changed to normal. The same way I need to implement. For that I used Font for the table. Now i need to save the state for the table item. When the application restarts, the table item which the user has already viewed should be seen as viewed item. I mean normal font. Is ther any way to save the state for the table item?
Thanks
Bhanu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一种选择 - 如果我们只谈论很少的数据,例如指向最后读取项目的指针 - 您可以使用视图状态。请参阅
IViewPart.init(IViewSite site, IMemento memento)
和IViewPart.saveState(IMemento memento)
。如果您有大量数据,则此方法不是很有用,因为存储效率很低。An alternative - if we are only talking very little data, e.g. a pointer to the last read item - you can use the view state. See
IViewPart.init(IViewSite site, IMemento memento)
andIViewPart.saveState(IMemento memento)
. This method is not very useful if you have lots of data as the storage is rather ineffective.如果您的捆绑包激活器子类为
org.eclipse.ui.plugin.AbstractUIPlugin
或org.eclipse.core.runtime.Plugin
,您可以使用org.eclipse.core。 runtime.Plugin.getStateLocation()
获取插件状态位置。您可以使用 java.io.File 和 FileReader/FileWriter 跨会话存储信息。有关此插件如何存储对话框设置的示例,请参阅 org.eclipse.ui.plugin.AbstractUIPlugin.saveDialogSettings()。If your bundle activator subclasses
org.eclipse.ui.plugin.AbstractUIPlugin
ororg.eclipse.core.runtime.Plugin
you can useorg.eclipse.core.runtime.Plugin.getStateLocation()
to get your plugin state location. You can usejava.io.File
and FileReader/FileWriter to store information there across sessions. Seeorg.eclipse.ui.plugin.AbstractUIPlugin.saveDialogSettings()
for an example of how a this plugin stores dialog settings there.