mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
kotlin_ui_dsl_version_2.md: move V1/2 section to bottom
This commit is contained in:
parent
5e1db0d970
commit
bcc7cd4d89
@ -13,27 +13,6 @@ It supports many core Swing components and custom components widely used in JetB
|
||||
|
||||
The library is written in [Kotlin](kotlin.md) and makes it easy to develop user interfaces like dialogs and settings by using declarative syntax.
|
||||
|
||||
## Version 1 and 2 Comparison
|
||||
|
||||
In UI DSL version 2, some crucial problems from version 1 have been fixed, so porting is highly desirable.
|
||||
See [](#migration-from-version-1) on how to port existing UI DSL code from version 1 to version 2 API.
|
||||
Version 1 is deprecated and will be removed in future platform releases.
|
||||
|
||||
The following significant changes were made:
|
||||
|
||||
- Reduced API, which allows conceiving API easier and faster.
|
||||
Example: there were 5 overloaded methods `Cell.checkBox()` in version 1, now only one method remains.
|
||||
Functionality for binding properties is extracted into `Cell<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 mostly based on interfaces, because it's easier to learn API by grouped methods.
|
||||
Only a small part of 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](#placeholder) that allows replacing components at runtime after content is shown.
|
||||
|
||||
## UI DSL Examples
|
||||
|
||||
It is highly recommended taking a look at the UI DSL demo available via <menupath>Tools | Internal Actions | UI | UI DSL Showcase</menupath> (see [Internal Actions](internal_actions_intro.md) if not available in your IDE instance).
|
||||
@ -446,7 +425,28 @@ buttonsGroup(title = "radioButton:") {
|
||||
}.bind(model::radioButtonColor)
|
||||
```
|
||||
|
||||
## Migration from Version 1
|
||||
## Version 1 and 2 Comparison
|
||||
|
||||
In UI DSL version 2, some crucial problems from version 1 have been fixed, so porting is highly desirable.
|
||||
See [](#migration-from-version-1) on how to port existing UI DSL code from version 1 to version 2 API.
|
||||
Version 1 is deprecated and will be removed in future platform releases.
|
||||
|
||||
The following significant changes were made:
|
||||
|
||||
- Reduced API, which allows conceiving API easier and faster.
|
||||
Example: there were 5 overloaded methods `Cell.checkBox()` in version 1, now only one method remains.
|
||||
Functionality for binding properties is extracted into `Cell<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 mostly based on interfaces, because it's easier to learn API by grouped methods.
|
||||
Only a small part of 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](#placeholder) that allows replacing components at runtime after content is shown.
|
||||
|
||||
### Migration from Version 1
|
||||
|
||||
New API is very similar to the old one and covers almost all functionality now, so moving to the new version can be done quickly.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user