Formatted the code
This commit is contained in:
@@ -174,7 +174,8 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
final Item saveTblitem = getContainerDataSource().addItem(swModType.getName());
|
final Item saveTblitem = getContainerDataSource().addItem(swModType.getName());
|
||||||
final Label mandatoryLabel = createMandatoryLabel(isMandatory);
|
final Label mandatoryLabel = createMandatoryLabel(isMandatory);
|
||||||
final Label typeName = HawkbitCommonUtil.getFormatedLabel(swModType.getName());
|
final Label typeName = HawkbitCommonUtil.getFormatedLabel(swModType.getName());
|
||||||
final VerticalLayout verticalLayout = createSoftModuleLayout(swModType,distributionSet, alreadyAssignedSwModules);
|
final VerticalLayout verticalLayout = createSoftModuleLayout(swModType, distributionSet,
|
||||||
|
alreadyAssignedSwModules);
|
||||||
|
|
||||||
saveTblitem.getItemProperty(SOFT_TYPE_MANDATORY).setValue(mandatoryLabel);
|
saveTblitem.getItemProperty(SOFT_TYPE_MANDATORY).setValue(mandatoryLabel);
|
||||||
saveTblitem.getItemProperty(SOFT_TYPE_NAME).setValue(typeName);
|
saveTblitem.getItemProperty(SOFT_TYPE_NAME).setValue(typeName);
|
||||||
@@ -184,7 +185,7 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
|
|
||||||
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet,
|
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet,
|
||||||
final Set<SoftwareModule> alreadyAssignedSwModules) {
|
final Set<SoftwareModule> alreadyAssignedSwModules) {
|
||||||
final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(),alreadyAssignedSwModules);
|
final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(), alreadyAssignedSwModules);
|
||||||
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
|
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
|
||||||
unAssignedSw);
|
unAssignedSw);
|
||||||
manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
|
manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
|
||||||
@@ -205,21 +206,23 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType,
|
||||||
private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType,DistributionSet distributionSet, Set<SoftwareModule> alreadyAssignedSwModules){
|
final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) {
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
final VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
for (final SoftwareModule sw : alreadyAssignedSwModules) {
|
for (final SoftwareModule sw : alreadyAssignedSwModules) {
|
||||||
if (swModType.getKey().equals(sw.getType().getKey())) {
|
if (swModType.getKey().equals(sw.getType().getKey())) {
|
||||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
horizontalLayout.setSizeFull();
|
horizontalLayout.setSizeFull();
|
||||||
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||||
final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
|
final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
|
||||||
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
||||||
reassignSoftModule.addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules));
|
reassignSoftModule
|
||||||
String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion());
|
.addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules));
|
||||||
|
final String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(),
|
||||||
|
sw.getVersion());
|
||||||
softwareModule.setValue(softwareModNameVersion);
|
softwareModule.setValue(softwareModNameVersion);
|
||||||
softwareModule.setDescription(softwareModNameVersion);
|
softwareModule.setDescription(softwareModNameVersion);
|
||||||
softwareModule.setId(sw.getName()+"-label");
|
softwareModule.setId(sw.getName() + "-label");
|
||||||
horizontalLayout.addComponent(softwareModule);
|
horizontalLayout.addComponent(softwareModule);
|
||||||
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
||||||
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission() && !isTargetAssigned
|
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission() && !isTargetAssigned
|
||||||
|
|||||||
@@ -148,8 +148,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
||||||
item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(SOFT_MODULE)
|
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
||||||
.setValue(createSoftModuleLayout(entry.getValue().toString()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,21 +204,20 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
||||||
final Item item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
final Item item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(SOFT_MODULE)
|
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
||||||
.setValue(createSoftModuleLayout(entry.getValue().toString()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createSoftModuleLayout(String softwareModuleName){
|
private VerticalLayout createSoftModuleLayout(final String softwareModuleName) {
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
final VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
horizontalLayout.setSizeFull();
|
horizontalLayout.setSizeFull();
|
||||||
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||||
final Button reassignSoftModule = assignSoftModuleButton(softwareModuleName);
|
final Button reassignSoftModule = assignSoftModuleButton(softwareModuleName);
|
||||||
softwareModule.setValue(softwareModuleName);
|
softwareModule.setValue(softwareModuleName);
|
||||||
softwareModule.setDescription(softwareModuleName);
|
softwareModule.setDescription(softwareModuleName);
|
||||||
softwareModule.setId(softwareModuleName+"-label");
|
softwareModule.setId(softwareModuleName + "-label");
|
||||||
horizontalLayout.addComponent(softwareModule);
|
horizontalLayout.addComponent(softwareModule);
|
||||||
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
horizontalLayout.setExpandRatio(softwareModule, 1f);
|
||||||
horizontalLayout.addComponent(reassignSoftModule);
|
horizontalLayout.addComponent(reassignSoftModule);
|
||||||
|
|||||||
Reference in New Issue
Block a user