Skip to content

Commit 8707ce7

Browse files
committed
fix: same font size for row like in the header
- resolves #132
1 parent 72f30f0 commit 8707ce7

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
4242
import com.intellij.ui.AnActionButton
4343
import com.intellij.ui.AppIcon
4444
import com.intellij.ui.JBColor
45+
import com.intellij.ui.RelativeFont
4546
import com.intellij.ui.ToolbarDecorator
4647
import com.intellij.ui.components.JBTextField
4748
import com.intellij.ui.components.dialog
@@ -643,20 +644,20 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
643644

644645
override fun getTableCellRendererComponent(table: JTable?, value: Any?, selected: Boolean, focus: Boolean, row: Int, column: Int): Component {
645646
super.getTableCellRendererComponent(table, value, selected, focus, row, column).apply {
646-
border = JBUI.Borders.empty(10)
647+
border = JBUI.Borders.empty(8, 8)
647648
}
648649
return this
649650
}
650651
}
651652
}
652653
}
653654

654-
private class WorkspaceNameColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
655+
private inner class WorkspaceNameColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
655656
override fun valueOf(workspace: WorkspaceAgentModel?): String? {
656657
return workspace?.name
657658
}
658659

659-
override fun getComparator(): Comparator<WorkspaceAgentModel>? {
660+
override fun getComparator(): Comparator<WorkspaceAgentModel> {
660661
return Comparator { a, b ->
661662
if (a === b) 0
662663
if (a == null) -1
@@ -673,20 +674,21 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
673674
if (value is String) {
674675
text = value
675676
}
676-
font = JBFont.h3().asBold()
677-
border = JBUI.Borders.empty()
677+
678+
font = RelativeFont.BOLD.derive(this@CoderWorkspacesStepView.tableOfWorkspaces.tableHeader.font)
679+
border = JBUI.Borders.empty(0, 8)
678680
return this
679681
}
680682
}
681683
}
682684
}
683685

684-
private class WorkspaceTemplateNameColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
686+
private inner class WorkspaceTemplateNameColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
685687
override fun valueOf(workspace: WorkspaceAgentModel?): String? {
686688
return workspace?.templateName
687689
}
688690

689-
override fun getComparator(): java.util.Comparator<WorkspaceAgentModel>? {
691+
override fun getComparator(): java.util.Comparator<WorkspaceAgentModel> {
690692
return Comparator { a, b ->
691693
if (a === b) 0
692694
if (a == null) -1
@@ -697,7 +699,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
697699
}
698700

699701
override fun getRenderer(item: WorkspaceAgentModel?): TableCellRenderer {
700-
val simpleH3 = JBFont.h3()
702+
val simpleH3 = this@CoderWorkspacesStepView.tableOfWorkspaces.tableHeader.font
701703

702704
val h3AttributesWithUnderlining = simpleH3.attributes as MutableMap<TextAttribute, Any>
703705
h3AttributesWithUnderlining[TextAttribute.UNDERLINE] = UNDERLINE_ON
@@ -708,7 +710,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
708710
if (value is String) {
709711
text = value
710712
}
711-
border = JBUI.Borders.empty()
713+
border = JBUI.Borders.empty(0, 8)
712714

713715
if (table.getClientProperty(MOUSE_OVER_TEMPLATE_NAME_COLUMN_ON_ROW) != null) {
714716
val mouseOverRow = table.getClientProperty(MOUSE_OVER_TEMPLATE_NAME_COLUMN_ON_ROW) as Int
@@ -724,7 +726,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
724726
}
725727
}
726728

727-
private class WorkspaceVersionColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
729+
private inner class WorkspaceVersionColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
728730
override fun valueOf(workspace: WorkspaceAgentModel?): String? {
729731
return workspace?.status?.label
730732
}
@@ -736,20 +738,20 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
736738
if (value is String) {
737739
text = value
738740
}
739-
font = JBFont.h3()
740-
border = JBUI.Borders.empty()
741+
font = this@CoderWorkspacesStepView.tableOfWorkspaces.tableHeader.font
742+
border = JBUI.Borders.empty(0, 8)
741743
return this
742744
}
743745
}
744746
}
745747
}
746748

747-
private class WorkspaceStatusColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
749+
private inner class WorkspaceStatusColumnInfo(columnName: String) : ColumnInfo<WorkspaceAgentModel, String>(columnName) {
748750
override fun valueOf(workspace: WorkspaceAgentModel?): String? {
749751
return workspace?.agentStatus?.label
750752
}
751753

752-
override fun getComparator(): java.util.Comparator<WorkspaceAgentModel>? {
754+
override fun getComparator(): java.util.Comparator<WorkspaceAgentModel> {
753755
return Comparator { a, b ->
754756
if (a === b) 0
755757
if (a == null) -1
@@ -766,8 +768,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
766768
if (value is String) {
767769
text = value
768770
}
769-
font = JBFont.h3()
770-
border = JBUI.Borders.empty()
771+
font = this@CoderWorkspacesStepView.tableOfWorkspaces.tableHeader.font
772+
border = JBUI.Borders.empty(0, 8)
771773
foreground = (table.model as ListTableModel<WorkspaceAgentModel>).getRowValue(row).statusColor()
772774
return this
773775
}

0 commit comments

Comments
 (0)