1
1
package com.coder.gateway.views
2
2
3
+ import com.coder.gateway.CoderGatewayBundle
3
4
import com.intellij.ide.IdeBundle
5
+ import com.intellij.openapi.ui.panel.ComponentPanelBuilder
4
6
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
7
+ import com.intellij.ui.IconManager
5
8
import com.intellij.ui.SeparatorComponent
6
- import com.intellij.ui.components.DialogPanel
7
9
import com.intellij.ui.components.panels.VerticalLayout
10
+ import com.intellij.ui.dsl.builder.BottomGap
11
+ import com.intellij.ui.dsl.builder.TopGap
12
+ import com.intellij.ui.dsl.builder.panel
13
+ import com.intellij.ui.dsl.gridLayout.HorizontalAlign
14
+ import com.intellij.util.ui.JBFont
8
15
import com.intellij.util.ui.JBUI
9
16
import com.intellij.util.ui.components.BorderLayoutPanel
10
17
import com.jetbrains.gateway.api.GatewayUI
11
18
import java.awt.Component
12
19
import javax.swing.JButton
13
20
import javax.swing.JPanel
14
21
15
- class CoderGatewayLoginView ( hgap : Int , vgap : Int ) : BorderLayoutPanel(hgap, vgap ) {
22
+ class CoderGatewayLoginView : BorderLayoutPanel () {
16
23
init {
17
24
initView()
18
25
}
19
26
20
27
private fun initView () {
28
+ background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
21
29
addToCenter(createLoginComponent())
22
30
addToBottom(createBackComponent())
23
31
}
24
32
25
33
private fun createLoginComponent (): Component {
26
- return DialogPanel ()
34
+ return panel {
35
+ indent {
36
+ row {
37
+ label(CoderGatewayBundle .message(" gateway.connector.view.login.header.text" )).applyToComponent {
38
+ font = JBFont .h3().asBold()
39
+ icon = IconManager .getInstance().getIcon(" coder_logo_16.svg" , CoderGatewayLoginView ::class .java)
40
+ }
41
+ }.topGap(TopGap .SMALL ).bottomGap(BottomGap .MEDIUM )
42
+ row {
43
+ cell(ComponentPanelBuilder .createCommentComponent(CoderGatewayBundle .message(" gateway.connector.view.login.comment.text" ), false , - 1 , true ))
44
+ }
45
+ row {
46
+ browserLink(CoderGatewayBundle .message(" gateway.connector.view.login.documentation.action" ), " https://coder.com/docs/coder/latest/workspaces" )
47
+ }.bottomGap(BottomGap .MEDIUM )
48
+ row {
49
+ label(CoderGatewayBundle .message(" gateway.connector.view.login.url.label" ))
50
+ textField().resizableColumn().horizontalAlign(HorizontalAlign .FILL ).applyToComponent {
51
+ text = " https://dev.coder.com"
52
+ }
53
+ button(CoderGatewayBundle .message(" gateway.connector.view.login.connect.action" ), {}).applyToComponent {
54
+ background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
55
+ border = JBUI .Borders .empty(3 , 3 , 3 , 3 )
56
+ }
57
+ cell()
58
+ }
59
+ }
60
+ }.apply {
61
+ background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
62
+ }
27
63
}
28
64
29
65
private fun createBackComponent (): Component {
@@ -33,11 +69,14 @@ class CoderGatewayLoginView(hgap: Int, vgap: Int) : BorderLayoutPanel(hgap, vgap
33
69
border = JBUI .Borders .empty(6 , 24 , 6 , 0 )
34
70
addToLeft(JButton (IdeBundle .message(" button.back" )).apply {
35
71
border = JBUI .Borders .empty(3 , 3 , 3 , 3 )
72
+ background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
36
73
addActionListener {
37
74
GatewayUI .Companion .getInstance().reset()
38
75
}
39
76
})
77
+ background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
40
78
})
79
+ background = WelcomeScreenUIManager .getMainAssociatedComponentBackground()
41
80
}
42
81
}
43
82
0 commit comments