@@ -70,9 +70,7 @@ public void setDeleteListener(ISectorTableDeleteListener listener) {
7070 }
7171
7272 private AmpAutocompleteFieldPanel <AmpSector > searchSectors ;
73- private AmpClassificationConfiguration sectorClassification ;
7473 public AmpAutocompleteFieldPanel <AmpSector > getSearchSectors () { return this .searchSectors ; }
75- public AmpClassificationConfiguration getClassfication () { return this .sectorClassification ; }
7674
7775 private IModel <Set <AmpActivitySector >> setModel ;
7876 public IModel <Set <AmpActivitySector >> getSetModel () { return this .setModel ; }
@@ -102,10 +100,6 @@ public void triggerUpdateEvent(Set<AmpActivitySector> selectedSectors,
102100 }
103101 updateListener .onUpdate (sectorsByClassification );
104102 }
105- List <AmpSector > newChoices = (List <AmpSector >)searchSectors .getModelParams ().get (AmpSectorSearchModel .PARAM .NEW_CHOICES );
106- extracted (newChoices );
107-
108-
109103 }
110104
111105 /**
@@ -202,7 +196,6 @@ public AmpSectorsFormTableFeature(String id, String fmName,
202196 throws Exception {
203197 super (id , am , fmName , false , true );
204198 setModel = new PropertyModel <Set <AmpActivitySector >>(am , "sectors" );
205- this .sectorClassification = sectorClassification ;
206199 if (setModel .getObject () == null ) setModel .setObject (new HashSet <AmpActivitySector >());
207200 if (sectorClassification .getDescription () != null ) addInfoText (sectorClassification .getDescription ());
208201
@@ -415,42 +408,34 @@ public Collection<AmpSector> getChoices(String input) {
415408
416409 Collection <AmpSector > choices = super .getChoices (input );
417410 Set <AmpSector > choices2 = new HashSet <>(choices );
418- // List<AmpSector> newChoices = (List<AmpSector>)searchSectors.getModelParams().get(AmpSectorSearchModel.PARAM.NEW_CHOICES);
419- // List<AmpSector> sectorChoices = (List<AmpSector>)searchSectors.getModelParams().get(AmpSectorSearchModel.PARAM.SECTOR_CHOICES);
420- // if (newChoices!=null)
421- // {
422- // choices= newChoices;
423- // choices2= new HashSet<>(newChoices);
424- // }
411+
425412 logger .info ("Choices here: " + choices );
426- searchSectors .getModelParams ().put (AmpSectorSearchModel .PARAM .NEW_CHOICES , choices );
413+
414+
427415
428416
429417 if (sectorClassification .getName ().equals (AmpClassificationConfiguration .SECONDARY_CLASSIFICATION_CONFIGURATION_NAME )) {
430- List <AmpActivitySector > selectedSectors = (List <AmpActivitySector >) searchSectors .getModelParams ().get (AmpSectorSearchModel .PARAM .DST_SECTOR_SELECTED );
431418
432- if (selectedSectors != null ) {
419+ List <AmpActivitySector > selectedSectors = (List <AmpActivitySector >) this .getModelParams ().get (AmpSectorSearchModel .PARAM .DST_SECTOR_SELECTED );
420+
421+ if (selectedSectors != null ) {
433422 for (AmpSector choice : choices2 ) {
434- for (AmpActivitySector ampActivitySector : selectedSectors ) {
435- if (Objects .equals (choice .getAmpSectorId (), ampActivitySector .getSectorId ().getAmpSectorId ())) {
423+ for (AmpActivitySector ampActivitySector : selectedSectors )
424+ {
425+ if (Objects .equals (choice .getAmpSectorId (), ampActivitySector .getSectorId ().getAmpSectorId ()))
426+ {
436427 choices .remove (choice );
437428 break ;
438429 }
439430 }
440431 }
441432 }
442- }
443-
444-
445433
446-
447- extracted (choices );
434+ }
448435
449436 return choices ;
450437 }
451438
452-
453-
454439 @ Override
455440 public Integer getChoiceLevel (AmpSector choice ) {
456441 int i = 0 ;
@@ -484,47 +469,6 @@ public Integer getChoiceLevel(AmpSector choice) {
484469
485470 add (this .searchSectors );
486471
487-
488-
489-
490- }
491-
492- public void extracted (Collection <AmpSector > choices ) {
493- if (sectorClassification .getName ().equals (AmpClassificationConfiguration .SECONDARY_CLASSIFICATION_CONFIGURATION_NAME )) {
494- AjaxRequestTarget target = RequestCycle .get ().find (AjaxRequestTarget .class );
495-
496- if (choices .size ()==1 )
497- {
498- for (AmpSector secondarySector : choices ) {
499- AmpActivitySector newSector = new AmpActivitySector ();
500- newSector .setSectorId (secondarySector );
501- newSector .setActivityId (setModel .getObject ().iterator ().next ().getActivityId ()); // Assuming activityId is the same
502- newSector .setClassificationConfig (sectorClassification );
503- searchSectors .getModelParams ().computeIfAbsent (AmpSectorSearchModel .PARAM .DST_SECTOR_SELECTED ,
504- k -> new ArrayList <>());
505- ((List <AmpActivitySector >)searchSectors .getModelParams ().get (AmpSectorSearchModel .PARAM .DST_SECTOR_SELECTED )).add (newSector );
506-
507- setModel .getObject ().add (newSector );
508- }
509-
510- target .add (list .getParent ());
511-
512- }
513-
514- List <AmpSector > srcSectorSelected = (List <AmpSector >)searchSectors .getModelParams ().get (AmpSectorSearchModel .PARAM .SRC_SECTOR_SELECTED );
515-
516- updateBasedOnData (srcSectorSelected );
517-
518- logger .info ("Target: " +target );
519- if (target != null ) {
520- target .add (searchSectors );
521- // triggerUpdateEvent(setModel.getObject(), sectorClassification);
522- target .add (this );
523- // refreshTable(target);
524- }
525-
526-
527- }
528472 }
529473
530474
0 commit comments