Removed Old Version of Kotlin UI DSL
Comparison with Current Kotlin UI DSL
The current Kotlin UI DSL fixes some crucial problems of the old version. See Migration on how to port existing UI DSL code from the old version to the current one.
The following significant changes were made:
Reduced API, which allows conceiving API easier and faster. Example: there were five overloaded methods
Cell.checkBox()in the old version, now only one method remains. Functionality for binding properties is extracted intoCell<T>.bindSelected()methods.UI DSL became stricter, so the available API in every context is much smaller. Example: code like
row { row {is forbidden now.Structured API is mostly based on interfaces because it's easier to learn API by grouped methods. Only a small part of the API is implemented as extensions.
KDoc is widely used.
MIG layout is fully removed from the new UI DSL and replaced by
GridLayout. Because MIG layout is an external library, it's hard to fix bugs there (e.g., there are layout problems when components become invisible) and extend its functionality. Fixed focus ring cropping problems: when components are placed near the panel border focus ring could be cropped if panel insets do not specify enough space.Implemented Placeholder that allows replacing components at runtime after content is shown.
Migration
The current API is very similar to the old one and covers almost all of its functionality, so moving to the current version can be done quickly.
The old version was located in the com.intellij.ui.layout package.
The current version is located in the com.intellij.ui.dsl.builder package.
Migration Steps
Having a screenshot or live version of the initial components layout can help
Remove imports of old UI DSL starting with
com.intellij.ui.layoutGo to the place where the panel is created and import the current UI DSL
com.intellij.ui.dsl.buildersuggested by IntelliJ IDEAUpdate non-compilable code, according to the following table.
Old Kotlin UI DSL | Kotlin UI DSL |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| For previous left cell use |
| Do not use custom gaps if possible |
| Not needed, this gap is set by default |
|
|
|
|
|
|
|
|