Skip to content

Commit 3d37faa

Browse files
authored
Merge pull request #484 from bohdan-harniuk/entity-manager-form-ux-improvements
Added ui components tab toggling
2 parents d150ec8 + 0da4503 commit 3d37faa

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewEntityDialog.form

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,16 @@
137137
</vspacer>
138138
</children>
139139
</grid>
140-
<grid id="e3309" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
140+
<grid id="e3309" binding="uiComponentsPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
141141
<margin top="10" left="10" bottom="0" right="10"/>
142142
<constraints>
143143
<tabbedpane title="Admin UI Components"/>
144144
</constraints>
145-
<properties/>
146-
<border type="none" title=""/>
145+
<properties>
146+
<preferredSize width="483" height="230"/>
147+
<requestFocusEnabled value="false"/>
148+
</properties>
149+
<border type="none"/>
147150
<children>
148151
<component id="3c721" class="javax.swing.JTextField" binding="route">
149152
<constraints>

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewEntityDialog.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public class NewEntityDialog extends AbstractDialog {
196196
private static final String GRID_NAME = "Grit Name";
197197
private static final String IDENTIFIER = "Identifier";
198198
private static final String SORT_ORDER = "Sort Order";
199+
private static final String UI_COMPONENTS_TAB_NAME = "Admin UI Components";
199200

200201
@FieldValidation(rule = RuleRegistry.NOT_EMPTY, message = {NotEmptyRule.MESSAGE, FORM_NAME})
201202
@FieldValidation(rule = RuleRegistry.IDENTIFIER, message = {IdentifierRule.MESSAGE})
@@ -221,6 +222,7 @@ public class NewEntityDialog extends AbstractDialog {
221222
private JTextPane exampleAclId;
222223
private JTextPane exampleFormName;
223224
private JTextPane exampleGridName;
225+
private JPanel uiComponentsPanel;
224226
private JTextField observerName;
225227

226228
/**
@@ -269,6 +271,10 @@ protected void textChanged(final @NotNull DocumentEvent event) {
269271
autoCompleteIdentifiers();
270272
}
271273
});
274+
275+
toggleUiComponentsPanel();
276+
277+
createUiComponent.addItemListener(event -> toggleUiComponentsPanel());
272278
}
273279

274280
/**
@@ -1399,4 +1405,16 @@ private void autoCompleteIdentifiers() {
13991405
menuIdentifier.setText(getModuleName().concat("::management"));
14001406
menuTitle.setText(entityNameLabel.concat(" Management"));
14011407
}
1408+
1409+
/**
1410+
* Resolve ui components panel state.
1411+
*/
1412+
private void toggleUiComponentsPanel() {
1413+
if (createUiComponent.isSelected()) {
1414+
tabbedPane1.add(uiComponentsPanel, 1);
1415+
tabbedPane1.setTitleAt(1, UI_COMPONENTS_TAB_NAME);
1416+
} else {
1417+
tabbedPane1.remove(1);
1418+
}
1419+
}
14021420
}

0 commit comments

Comments
 (0)