mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[github] Fix PR timeline width
Switch to proper vertical layout and restrict width via layout constraint GitOrigin-RevId: 06cca3ba2be7aa07c53dc84cf7698837dcb98801
This commit is contained in:
committed by
intellij-monorepo-bot
parent
69dac70e6b
commit
60d40172e8
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.github.pullrequest
|
||||
|
||||
import com.intellij.ide.DataManager
|
||||
@@ -130,21 +130,19 @@ internal class GHPREditorProvider : FileEditorProvider, DumbAware {
|
||||
layout = MigLayout(LC().gridGap("0", "0")
|
||||
.insets("0", "0", "0", "0")
|
||||
.fillX()
|
||||
.flowY()).apply {
|
||||
columnConstraints = AC().fill().size("0:$maxWidth:$maxWidth")
|
||||
}
|
||||
.flowY(),
|
||||
AC().size(":$maxWidth:$maxWidth").gap("push"))
|
||||
|
||||
emptyText.clear()
|
||||
|
||||
add(header, CC().width("0:$maxWidth:$maxWidth"))
|
||||
add(timeline, CC().width("0:$maxWidth:$maxWidth"))
|
||||
add(loadingIcon, CC().width("0:$maxWidth:$maxWidth").hideMode(2).alignX("center"))
|
||||
add(header)
|
||||
add(timeline, CC().growX().minWidth(""))
|
||||
add(loadingIcon, CC().hideMode(2).alignX("center"))
|
||||
|
||||
with(context.commentService) {
|
||||
if (canComment()) {
|
||||
val commentServiceAdapter = GHPRCommentServiceAdapter.create(this, dataProvider)
|
||||
add(createCommentField(project, commentServiceAdapter, avatarIconsProvider, context.currentUser),
|
||||
CC().width("0:$maxWidth:$maxWidth"))
|
||||
add(createCommentField(project, commentServiceAdapter, avatarIconsProvider, context.currentUser), CC().growX())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-11
@@ -1,14 +1,11 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.github.pullrequest.comment.ui
|
||||
|
||||
import com.intellij.ide.plugins.newui.VerticalLayout
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.ui.ClickListener
|
||||
import com.intellij.ui.components.panels.VerticalLayout
|
||||
import com.intellij.util.ui.JBInsets
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.MacUIUtil
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.util.ui.*
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel
|
||||
import org.jetbrains.plugins.github.pullrequest.avatars.GHAvatarIconsProvider
|
||||
import org.jetbrains.plugins.github.ui.util.SingleValueModel
|
||||
@@ -23,7 +20,7 @@ import javax.swing.event.ListDataListener
|
||||
|
||||
class GHPRReviewThreadCommentsPanel(private val commentsModel: ListModel<GHPRReviewCommentModel>,
|
||||
private val avatarIconsProvider: GHAvatarIconsProvider)
|
||||
: JPanel(VerticalLayout(8)) {
|
||||
: JPanel(VerticalLayout(UI.scale(8))) {
|
||||
|
||||
private val foldModel = SingleValueModel(true)
|
||||
private val foldThreshold = 2
|
||||
@@ -54,7 +51,7 @@ class GHPRReviewThreadCommentsPanel(private val commentsModel: ListModel<GHPRRev
|
||||
|
||||
override fun intervalAdded(e: ListDataEvent) {
|
||||
for (i in e.index0..e.index1) {
|
||||
add(GHPRReviewCommentComponent(avatarIconsProvider, commentsModel.getElementAt(i)), i + 1)
|
||||
add(GHPRReviewCommentComponent(avatarIconsProvider, commentsModel.getElementAt(i)), VerticalLayout.FILL_HORIZONTAL, i + 1)
|
||||
}
|
||||
validate()
|
||||
repaint()
|
||||
@@ -67,11 +64,11 @@ class GHPRReviewThreadCommentsPanel(private val commentsModel: ListModel<GHPRRev
|
||||
})
|
||||
foldModel.addValueChangedListener { updateFolding() }
|
||||
|
||||
add(GHPRReviewCommentComponent(avatarIconsProvider, commentsModel.getElementAt(0)))
|
||||
add(unfoldButtonPanel)
|
||||
add(GHPRReviewCommentComponent(avatarIconsProvider, commentsModel.getElementAt(0)), VerticalLayout.FILL_HORIZONTAL)
|
||||
add(unfoldButtonPanel, VerticalLayout.FILL_HORIZONTAL)
|
||||
|
||||
for (i in 1 until commentsModel.size) {
|
||||
add(GHPRReviewCommentComponent(avatarIconsProvider, commentsModel.getElementAt(i)))
|
||||
add(GHPRReviewCommentComponent(avatarIconsProvider, commentsModel.getElementAt(i)), VerticalLayout.FILL_HORIZONTAL)
|
||||
}
|
||||
updateFolding()
|
||||
|
||||
|
||||
+6
-5
@@ -1,9 +1,10 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.timeline
|
||||
|
||||
import com.intellij.ui.components.panels.VerticalLayout
|
||||
import com.intellij.ide.plugins.newui.VerticalLayout
|
||||
import com.intellij.util.ui.ComponentWithEmptyText
|
||||
import com.intellij.util.ui.StatusText
|
||||
import com.intellij.util.ui.UI
|
||||
import org.jetbrains.plugins.github.pullrequest.comment.ui.GHPRReviewThreadModel
|
||||
import java.awt.Graphics
|
||||
import javax.swing.JComponent
|
||||
@@ -12,7 +13,7 @@ import javax.swing.event.ListDataEvent
|
||||
import javax.swing.event.ListDataListener
|
||||
|
||||
class GHPRReviewThreadsPanel(model: GHPRReviewThreadsModel, private val threadComponentFactory: (GHPRReviewThreadModel) -> JComponent)
|
||||
: JPanel(VerticalLayout(12)), ComponentWithEmptyText {
|
||||
: JPanel(VerticalLayout(UI.scale(12))), ComponentWithEmptyText {
|
||||
|
||||
private val statusText = object : StatusText(this) {
|
||||
init {
|
||||
@@ -36,7 +37,7 @@ class GHPRReviewThreadsPanel(model: GHPRReviewThreadsModel, private val threadCo
|
||||
|
||||
override fun intervalAdded(e: ListDataEvent) {
|
||||
for (i in e.index0..e.index1) {
|
||||
add(threadComponentFactory(model.getElementAt(i)), i)
|
||||
add(threadComponentFactory(model.getElementAt(i)), VerticalLayout.FILL_HORIZONTAL, i)
|
||||
}
|
||||
revalidate()
|
||||
repaint()
|
||||
@@ -49,7 +50,7 @@ class GHPRReviewThreadsPanel(model: GHPRReviewThreadsModel, private val threadCo
|
||||
})
|
||||
|
||||
for (i in 0 until model.size) {
|
||||
add(threadComponentFactory(model.getElementAt(i)), i)
|
||||
add(threadComponentFactory(model.getElementAt(i)), VerticalLayout.FILL_HORIZONTAL, i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.timeline
|
||||
|
||||
import com.intellij.ide.plugins.newui.VerticalLayout
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.ui.ColorUtil
|
||||
import com.intellij.ui.JBColor
|
||||
import com.intellij.ui.components.panels.VerticalLayout
|
||||
import com.intellij.ui.paint.LinePainter2D
|
||||
import com.intellij.util.ui.*
|
||||
import org.jetbrains.plugins.github.api.data.pullrequest.timeline.GHPRTimelineItem
|
||||
@@ -19,7 +19,7 @@ import javax.swing.event.ListDataListener
|
||||
|
||||
class GHPRTimelineComponent(private val model: ListModel<GHPRTimelineItem>,
|
||||
private val itemComponentFactory: GHPRTimelineItemComponentFactory)
|
||||
: JPanel(VerticalLayout(20)), ComponentWithEmptyText {
|
||||
: JPanel(VerticalLayout(UI.scale(20))), ComponentWithEmptyText {
|
||||
|
||||
private val emptyText = object : StatusText(this) {
|
||||
override fun isStatusVisible() = model.size == 0
|
||||
@@ -46,7 +46,7 @@ class GHPRTimelineComponent(private val model: ListModel<GHPRTimelineItem>,
|
||||
|
||||
override fun intervalAdded(e: ListDataEvent) {
|
||||
for (i in e.index0..e.index1) {
|
||||
add(itemComponentFactory.createComponent(model.getElementAt(i)), i)
|
||||
add(itemComponentFactory.createComponent(model.getElementAt(i)), VerticalLayout.FILL_HORIZONTAL, i)
|
||||
}
|
||||
revalidate()
|
||||
repaint()
|
||||
@@ -59,7 +59,7 @@ class GHPRTimelineComponent(private val model: ListModel<GHPRTimelineItem>,
|
||||
})
|
||||
|
||||
for (i in 0 until model.size) {
|
||||
add(itemComponentFactory.createComponent(model.getElementAt(i)), i)
|
||||
add(itemComponentFactory.createComponent(model.getElementAt(i)), VerticalLayout.FILL_HORIZONTAL, i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user