Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@
$column
#end
#end
#if (${ACTION_COLUMN})
<actionsColumn name="actions" class="${ACTION_COLUMN}">
<settings>
<indexField>${ID_FIELD_NAME}</indexField>
</settings>
</actionsColumn>
#end
</columns>
</listing>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class UiComponentGridData {
private final String acl;
private final String dataProviderName;
private final String dataProviderPath;
private final String entityName;
private final UiComponentGridToolbarData gridToolbarData;
private final List<Map<String, String>> columns;

Expand Down Expand Up @@ -51,6 +52,7 @@ public UiComponentGridData(
acl,
dataProviderName,
dataProviderPath,
null,
gridToolbarData,
new ArrayList<>()
);
Expand All @@ -66,6 +68,7 @@ public UiComponentGridData(
* @param acl String
* @param dataProviderName String
* @param dataProviderPath String
* @param entityName String
* @param gridToolbarData UiComponentGridToolbarData
* @param columns List
*/
Expand All @@ -77,6 +80,7 @@ public UiComponentGridData(
final String acl,
final String dataProviderName,
final String dataProviderPath,
final String entityName,
final UiComponentGridToolbarData gridToolbarData,
final List<Map<String, String>> columns
) {
Expand All @@ -87,6 +91,7 @@ public UiComponentGridData(
this.acl = acl;
this.dataProviderName = dataProviderName;
this.dataProviderPath = dataProviderPath;
this.entityName = entityName;
this.gridToolbarData = gridToolbarData;
this.columns = columns;
}
Expand Down Expand Up @@ -154,6 +159,15 @@ public String getDataProviderPath() {
return dataProviderPath;
}

/**
* Get entity name.
*
* @return String
*/
public String getEntityName() {
return entityName;
}

/**
* Get ID field name.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
public class UiComponentFormLayoutDtoConverter extends UiComponentFormFileData
implements DataObjectConverter {

private final static String SUBMIT_ACTION_NAME = "Save";
private static final String SUBMIT_ACTION_NAME = "Save";

/**
* Ui Component form layout DTO converter.
*
* @param generationContextData EntityCreatorContextData
* @param newEntityDialogData NewEntityDialogData
*/
public UiComponentFormLayoutDtoConverter(
final @NotNull EntityCreatorContextData generationContextData,
final @NotNull NewEntityDialogData newEntityDialogData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public UiComponentGridDtoConverter(
newEntityDialogData.getAclId(),
newEntityDialogData.getEntityName().concat("DataProvider"),
UiComponentDataProviderFile.DIRECTORY,
newEntityDialogData.getEntityName(),
new UiComponentGridToolbarDtoConverter(generationContextData, newEntityDialogData),
generationContextData.getEntityProps()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,8 @@ private void generateDataModelFile() {
private void generatePreferenceForInterface() {
new PreferenceDiXmlGenerator(new PreferenceDiXmFileData(
getModuleName(),
new DataModelInterfaceFile(
getDtoInterfaceName()
).getNamespaceBuilder(getModuleName()).getClassFqn(),
new DataModelFile(
getDtoModelName()
).getNamespaceBuilder(getModuleName()).getClassFqn(),
new DataModelInterfaceFile(getModuleName(), getDtoInterfaceName()).getClassFqn(),
new DataModelFile(getModuleName(), getDtoModelName()).getClassFqn(),
"base"
), project).generate(OverrideClassByAPreferenceAction.ACTION_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import com.magento.idea.magento2plugin.magento.packages.PropertiesTypes;
import com.magento.idea.magento2plugin.magento.packages.database.TableEngines;
import com.magento.idea.magento2plugin.magento.packages.database.TableResources;
import com.magento.idea.magento2plugin.magento.packages.uiComponent.FormElementType;
import com.magento.idea.magento2plugin.magento.packages.uicomponent.FormElementType;
import com.magento.idea.magento2plugin.stubs.indexes.xml.MenuIndex;
import com.magento.idea.magento2plugin.ui.FilteredComboBox;
import com.magento.idea.magento2plugin.ui.table.TableGroupWrapper;
Expand Down Expand Up @@ -378,6 +378,10 @@ private void generateNewEntityFiles(final @NotNull ActionEvent event) {
buttonOK.setEnabled(false);
buttonCancel.setEnabled(false);

if (propertyTable.isEditing()) {
propertyTable.getCellEditor().stopCellEditing();
}

new ProcessWorker(
this::onOK,
this::releaseDialogAfterGeneration,
Expand Down Expand Up @@ -443,9 +447,9 @@ private EntityCreatorContextData getEntityCreatorContextData(
final String actionsPathPrefix = dialogData.getRoute() + File.separator
+ FirstLetterToLowercaseUtil.convert(entityName) + File.separator;
final NamespaceBuilder dtoModelNamespace =
new DataModelFile(dtoClassName).getNamespaceBuilder(moduleName);
new DataModelFile(moduleName, dtoClassName).getNamespaceBuilder();
final NamespaceBuilder dtoInterfaceNamespace =
new DataModelInterfaceFile(dtoInterfaceClassName).getNamespaceBuilder(moduleName);
new DataModelInterfaceFile(moduleName, dtoInterfaceClassName).getNamespaceBuilder();

final NamespaceBuilder formViewNamespaceBuilder =
new NamespaceBuilder(
Expand Down Expand Up @@ -518,7 +522,7 @@ private List<UiComponentFormFieldsetData> getFieldSets() {
*/
private List<UiComponentFormButtonData> getButtons() {
final List<UiComponentFormButtonData> buttons = new ArrayList<>();
final String directory = "Block/Form";
final String directory = "Block/Form/" + entityName.getText().trim();

final NamespaceBuilder namespaceBuilderSave = new NamespaceBuilder(
moduleName,
Expand Down Expand Up @@ -600,9 +604,9 @@ private List<UiComponentFormFieldData> getFields() {
final String dataType = model.getValueAt(count, 1).toString();

final String label = Arrays.stream(name.split("_")).map(
string -> string.substring(0, 1).toUpperCase(Locale.getDefault())
+ string.substring(1)).collect(Collectors.joining(" ")
);
string -> string.substring(0, 1).toUpperCase(Locale.getDefault())
+ string.substring(1)).collect(Collectors.joining(" ")
);
final String sortOrder = String.valueOf(count).concat("0");
final String fieldset = "general";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBoxTableRenderer;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.magento.idea.magento2plugin.actions.generation.NewUiComponentFormAction;
import com.magento.idea.magento2plugin.actions.generation.data.AclXmlData;
import com.magento.idea.magento2plugin.actions.generation.data.ControllerFileData;
Expand Down Expand Up @@ -47,7 +46,7 @@
import com.magento.idea.magento2plugin.magento.packages.Areas;
import com.magento.idea.magento2plugin.magento.packages.File;
import com.magento.idea.magento2plugin.magento.packages.HttpMethod;
import com.magento.idea.magento2plugin.magento.packages.uiComponent.FormElementType;
import com.magento.idea.magento2plugin.magento.packages.uicomponent.FormElementType;
import com.magento.idea.magento2plugin.ui.FilteredComboBox;
import com.magento.idea.magento2plugin.ui.table.ComboBoxEditor;
import com.magento.idea.magento2plugin.ui.table.DeleteRowButton;
Expand All @@ -72,7 +71,6 @@
import javax.swing.KeyStroke;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import org.jetbrains.annotations.NotNull;

@SuppressWarnings({
"PMD.TooManyFields",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import com.google.common.base.CaseFormat;
import com.magento.idea.magento2plugin.actions.generation.data.code.ClassPropertyData;
import org.apache.commons.lang.StringUtils;
import javax.swing.table.DefaultTableModel;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.DefaultTableModel;
import org.apache.commons.lang.StringUtils;

public final class ClassPropertyFormatterUtil {

Expand All @@ -27,8 +27,8 @@ public static List<String> formatProperties(final DefaultTableModel table) {
final List<String> properties = new ArrayList<>();

for (int index = 0; index < table.getRowCount(); index++) {
String name = table.getValueAt(index, 0).toString();
String type = table.getValueAt(index, 1).toString();
final String name = table.getValueAt(index, 0).toString();
final String type = table.getValueAt(index, 1).toString();

properties.add(ClassPropertyFormatterUtil.formatSingleProperty(name, type));
}
Expand Down
Loading