Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add privacy policy info about statistics #253

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,20 +1,71 @@
package com.vaadin.plugin.ui.settings

import com.intellij.ide.BrowserUtil
import com.intellij.ui.ColorUtil
import com.intellij.ui.HyperlinkAdapter
import com.intellij.ui.JBColor
import com.intellij.ui.components.JBCheckBox
import com.intellij.ui.scale.JBUIScale.scale
import com.intellij.util.ui.FormBuilder
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.SwingHelper
import com.intellij.util.ui.UIUtil
import java.awt.GridBagConstraints
import java.awt.GridBagLayout
import javax.swing.JComponent
import javax.swing.JPanel
import javax.swing.event.HyperlinkEvent
import javax.swing.text.html.HTMLDocument

/** Supports creating and managing a [JPanel] for the Settings Dialog. */
class VaadinSettingsComponent {
val panel: JPanel
private val sendUsageStatistics = JBCheckBox("Send usage statistics")

init {
val pane = JPanel(GridBagLayout())
val viewer = SwingHelper.createHtmlViewer(true, null, JBColor.WHITE, JBColor.BLACK)
viewer.isOpaque = false
viewer.isFocusable = false
UIUtil.doNotScrollToCaret(viewer)
viewer.addHyperlinkListener(
object : HyperlinkAdapter() {
override fun hyperlinkActivated(e: HyperlinkEvent) {
e.url?.let { BrowserUtil.browse(it) }
}
})
viewer.text =
"<html><body>" +
"Help us improve Vaadin plugin by sending anonymous usage statistics. <br/><br/>" +
"Please note that this will not include personal data or any sensitive information, <br/>" +
"such as source code, file names, etc. The data sent complies with the <a href=\"https://vaadin.com/privacy-policy\">Vaadin Privacy Policy</a>." +
"</html></body>"
val styleSheet = (viewer.document as HTMLDocument).styleSheet
styleSheet.addRule(
"body {font-size: " +
UIUtil.getFontSize(UIUtil.FontSize.SMALL) +
"; color: #" +
ColorUtil.toHex(UIUtil.getContextHelpForeground()) +
";}")
pane.add(
viewer,
GridBagConstraints(
0,
GridBagConstraints.RELATIVE,
1,
1,
1.0,
0.0,
GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH,
JBUI.insets(0, scale(24), 0, 0),
0,
0))

panel =
FormBuilder.createFormBuilder()
.addComponent(sendUsageStatistics, 1)
.addTooltip("Help us improve Vaadin plugin by sending anonymous usage statistics")
.addComponent(pane)
.addComponentFillVertically(JPanel(), 0)
.panel
}
Expand Down
Loading