UI DSL: Remove the disableMagic flag which serves no purpose

GitOrigin-RevId: 1177cf57ed4941335e154218ec3d54e9e82549e5
This commit is contained in:
Dmitry Jemerov
2019-09-05 10:58:56 +00:00
committed by intellij-monorepo-bot
parent 02fe3ef53c
commit 7540948e0c
5 changed files with 6 additions and 12 deletions
@@ -26,9 +26,6 @@ enum class LCFlags {
*/
fill, fillX, fillY,
// temp flag, will be removed or renamed later
disableMagic,
lcWrap,
debug
@@ -17,7 +17,7 @@ import com.intellij.ui.components.DialogPanel
* `ToolbarDecorator` and `JBScrollPane` (use [Row.scrollPane]) components automatically have [Row.grow] and [Row.push].
*/
inline fun panel(vararg constraints: LCFlags, title: String? = null, init: LayoutBuilder.() -> Unit): DialogPanel {
val builder = createLayoutBuilder(isUseMagic = !constraints.contains(LCFlags.disableMagic))
val builder = createLayoutBuilder()
builder.init()
val panel = DialogPanel(title, layout = null)
@@ -9,8 +9,8 @@ import javax.swing.JComponent
@PublishedApi
@JvmOverloads
internal fun createLayoutBuilder(isUseMagic: Boolean = true): LayoutBuilder {
return LayoutBuilder(MigLayoutBuilder(createIntelliJSpacingConfiguration(), isUseMagic = isUseMagic))
internal fun createLayoutBuilder(isUseMagic: Boolean = true /* preserved for API compatibility */): LayoutBuilder {
return LayoutBuilder(MigLayoutBuilder(createIntelliJSpacingConfiguration()))
}
interface LayoutBuilderImpl {
@@ -13,10 +13,7 @@ import java.awt.Container
import javax.swing.ButtonGroup
import javax.swing.JComponent
internal class MigLayoutBuilder(
val spacing: SpacingConfiguration,
val isUseMagic: Boolean = true
) : LayoutBuilderImpl {
internal class MigLayoutBuilder(val spacing: SpacingConfiguration) : LayoutBuilderImpl {
companion object {
private var hRelatedGap = -1
private var vRelatedGap = -1
@@ -188,7 +185,7 @@ internal class MigLayoutBuilder(
}
// if constraint specified only for rows 0 and 1, MigLayout will use constraint 1 for any rows with index 1+ (see LayoutUtil.getIndexSafe - use last element if index > size)
// so, we set for each row to make sure that constraints from previous row will be not applied
rowConstraints.align(if (isUseMagic) "baseline" else "top", rowIndex)
rowConstraints.align("baseline", rowIndex)
}
if (index >= row.rightIndex) {
@@ -134,7 +134,7 @@ open class MultipleFileMergeDialog(
}
override fun createCenterPanel(): JComponent {
return panel(LCFlags.disableMagic) {
return panel {
row {
descriptionLabel()
}