Skip to content

Commit feff1bf

Browse files
Refactored code
1 parent cafa5d4 commit feff1bf

16 files changed

+243
-141
lines changed

src/com/magento/idea/magento2plugin/actions/generation/NewEavAttributeAction.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
16
package com.magento.idea.magento2plugin.actions.generation;
27

38
import com.intellij.ide.IdeView;
@@ -21,8 +26,8 @@ public NewEavAttributeAction() {
2126
}
2227

2328
@Override
24-
public void actionPerformed(@NotNull AnActionEvent e) {
25-
final DataContext dataContext = e.getDataContext();
29+
public void actionPerformed(final @NotNull AnActionEvent event) {
30+
final DataContext dataContext = event.getDataContext();
2631
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
2732
if (view == null) {
2833
return;

src/com/magento/idea/magento2plugin/actions/generation/data/EavEntityDataInterface.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.magento.idea.magento2plugin.actions.generation.data;
22

3+
@SuppressWarnings({"PMD.UnnecessaryModifier"})
34
public interface EavEntityDataInterface {
45
public String getCode();
56

Lines changed: 76 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,171 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
16
package com.magento.idea.magento2plugin.actions.generation.data;
27

38
import com.magento.idea.magento2plugin.magento.packages.eav.EavEntities;
49

10+
@SuppressWarnings({"PMD.TooManyFields"})
511
public class ProductEntityData implements EavEntityDataInterface {
612
private String group;
713
private String code;
814
private String type;
915
private String label;
1016
private String input;
11-
private String source = null;
17+
private String source;
1218
private String scope;
13-
private boolean isRequired = false;
14-
private boolean isUsedInGrid = false;
15-
private boolean isVisibleInGrid = false;
16-
private boolean isFilterableInGrid = false;
17-
private boolean isVisible = true;
18-
private boolean isHtmlAllowedOnFront = false;
19-
private boolean isVisibleOnFront = false;
20-
private int sortOrder = 0;
19+
private boolean required;
20+
private boolean usedInGrid;
21+
private boolean visibleInGrid;
22+
private boolean filterableInGrid;
23+
private boolean visible;
24+
private boolean htmlAllowedOnFront;
25+
private boolean visibleOnFront;
26+
private int sortOrder;
2127

2228
private String dataPatchName;
2329
private String namespace;
2430
private String directory;
2531
private String moduleName;
2632

27-
public void setGroup(String group) {
33+
public ProductEntityData() {
34+
this.required = false;
35+
this.usedInGrid = false;
36+
this.visibleInGrid = false;
37+
this.filterableInGrid = false;
38+
this.visible = true;
39+
this.htmlAllowedOnFront = false;
40+
this.visibleOnFront = false;
41+
this.sortOrder = 0;
42+
}
43+
44+
public void setGroup(final String group) {
2845
this.group = group;
2946
}
3047

31-
public void setCode(String code) {
48+
public void setCode(final String code) {
3249
this.code = code;
3350
}
3451

35-
public void setType(String type) {
52+
public void setType(final String type) {
3653
this.type = type;
3754
}
3855

39-
public void setLabel(String label) {
56+
public void setLabel(final String label) {
4057
this.label = label;
4158
}
4259

43-
public void setInput(String input) {
60+
public void setInput(final String input) {
4461
this.input = input;
4562
}
4663

47-
public void setSource(String source) {
64+
public void setSource(final String source) {
4865
this.source = source;
4966
}
5067

51-
public void setScope(String scope) {
68+
public void setScope(final String scope) {
5269
this.scope = scope;
5370
}
5471

55-
public void setRequired(boolean required) {
56-
isRequired = required;
72+
public void setRequired(final boolean required) {
73+
this.required = required;
5774
}
5875

59-
public void setUsedInGrid(boolean usedInGrid) {
60-
isUsedInGrid = usedInGrid;
76+
public void setUsedInGrid(final boolean usedInGrid) {
77+
this.usedInGrid = usedInGrid;
6178
}
6279

63-
public void setVisibleInGrid(boolean visibleInGrid) {
64-
isVisibleInGrid = visibleInGrid;
80+
public void setVisibleInGrid(final boolean visibleInGrid) {
81+
this.visibleInGrid = visibleInGrid;
6582
}
6683

67-
public void setFilterableInGrid(boolean filterableInGrid) {
68-
isFilterableInGrid = filterableInGrid;
84+
public void setFilterableInGrid(final boolean filterableInGrid) {
85+
this.filterableInGrid = filterableInGrid;
6986
}
7087

71-
public void setVisible(boolean visible) {
72-
isVisible = visible;
88+
public void setVisible(final boolean visible) {
89+
this.visible = visible;
7390
}
7491

75-
public void setHtmlAllowedOnFront(boolean htmlAllowedOnFront) {
76-
isHtmlAllowedOnFront = htmlAllowedOnFront;
92+
public void setHtmlAllowedOnFront(final boolean htmlAllowedOnFront) {
93+
this.htmlAllowedOnFront = htmlAllowedOnFront;
7794
}
7895

79-
public void setVisibleOnFront(boolean visibleOnFront) {
80-
isVisibleOnFront = visibleOnFront;
96+
public void setVisibleOnFront(final boolean visibleOnFront) {
97+
this.visibleOnFront = visibleOnFront;
8198
}
8299

83-
public void setSortOrder(int sortOrder) {
100+
public void setSortOrder(final int sortOrder) {
84101
this.sortOrder = sortOrder;
85102
}
86103

87-
public void setDataPatchName(String dataPatchName) {
104+
public void setDataPatchName(final String dataPatchName) {
88105
this.dataPatchName = dataPatchName;
89106
}
90107

91-
public void setNamespace(String namespace) {
108+
public void setNamespace(final String namespace) {
92109
this.namespace = namespace;
93110
}
94111

95-
public void setDirectory(String directory) {
112+
public void setDirectory(final String directory) {
96113
this.directory = directory;
97114
}
98115

99-
public void setModuleName(String moduleName) {
116+
public void setModuleName(final String moduleName) {
100117
this.moduleName = moduleName;
101118
}
102119

120+
@Override
103121
public String getCode() {
104122
return code;
105123
}
106124

125+
@Override
107126
public String getType() {
108127
return type;
109128
}
110129

130+
@Override
111131
public String getLabel() {
112132
return label;
113133
}
114134

135+
@Override
115136
public String getInput() {
116137
return input;
117138
}
118139

119-
public String getGroup() {
120-
return group;
121-
}
122-
140+
@Override
123141
public String getNamespace() {
124142
return namespace;
125143
}
126144

145+
@Override
127146
public String getModuleName() {
128147
return moduleName;
129148
}
130149

150+
@Override
131151
public String getDirectory() {
132152
return directory;
133153
}
134154

155+
@Override
135156
public String getDataPatchName() {
136157
return dataPatchName;
137158
}
138159

160+
@Override
161+
public String getEntityClass() {
162+
return EavEntities.PRODUCT.getEntityClass();
163+
}
164+
165+
public String getGroup() {
166+
return group;
167+
}
168+
139169
public String getSource() {
140170
return source;
141171
}
@@ -145,39 +175,34 @@ public String getScope() {
145175
}
146176

147177
public boolean isRequired() {
148-
return isRequired;
178+
return required;
149179
}
150180

151181
public boolean isUsedInGrid() {
152-
return isUsedInGrid;
182+
return usedInGrid;
153183
}
154184

155185
public boolean isVisibleInGrid() {
156-
return isVisibleInGrid;
186+
return visibleInGrid;
157187
}
158188

159189
public boolean isFilterableInGrid() {
160-
return isFilterableInGrid;
190+
return filterableInGrid;
161191
}
162192

163193
public boolean isVisible() {
164-
return isVisible;
194+
return visible;
165195
}
166196

167197
public boolean isHtmlAllowedOnFront() {
168-
return isHtmlAllowedOnFront;
198+
return htmlAllowedOnFront;
169199
}
170200

171201
public boolean isVisibleOnFront() {
172-
return isVisibleOnFront;
202+
return visibleOnFront;
173203
}
174204

175205
public int getSortOrder() {
176206
return sortOrder;
177207
}
178-
179-
@Override
180-
public String getEntityClass() {
181-
return EavEntities.PRODUCT.getEntityClass();
182-
}
183208
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
</constraints>
119119
<properties/>
120120
</component>
121-
<component id="40617" class="javax.swing.JCheckBox" binding="isRequiredCheckBox" default-binding="true">
121+
<component id="40617" class="javax.swing.JCheckBox" binding="requiredCheckBox" default-binding="true">
122122
<constraints>
123123
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
124124
</constraints>
@@ -144,7 +144,7 @@
144144
<text value="10"/>
145145
</properties>
146146
</component>
147-
<component id="aff93" class="javax.swing.JCheckBox" binding="isVisibleInGridCheckBox" default-binding="true">
147+
<component id="aff93" class="javax.swing.JCheckBox" binding="visibleInGridCheckBox" default-binding="true">
148148
<constraints>
149149
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
150150
</constraints>
@@ -153,15 +153,15 @@
153153
<text value="Is visible in grid"/>
154154
</properties>
155155
</component>
156-
<component id="fb245" class="javax.swing.JCheckBox" binding="isFilterableInGridCheckBox" default-binding="true">
156+
<component id="fb245" class="javax.swing.JCheckBox" binding="filterableInGridCheckBox" default-binding="true">
157157
<constraints>
158158
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
159159
</constraints>
160160
<properties>
161161
<text value="Is filterable in grid"/>
162162
</properties>
163163
</component>
164-
<component id="d83ba" class="javax.swing.JCheckBox" binding="isUsedInGridGridCheckBox">
164+
<component id="d83ba" class="javax.swing.JCheckBox" binding="usedInGridGridCheckBox">
165165
<constraints>
166166
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
167167
</constraints>
@@ -181,7 +181,7 @@
181181
<text value="Visible"/>
182182
</properties>
183183
</component>
184-
<component id="51e87" class="javax.swing.JCheckBox" binding="isHtmlAllowedOnCheckBox" default-binding="true">
184+
<component id="51e87" class="javax.swing.JCheckBox" binding="htmlAllowedOnCheckBox" default-binding="true">
185185
<constraints>
186186
<grid row="4" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
187187
</constraints>

0 commit comments

Comments
 (0)