@@ -100,9 +100,6 @@ public class PacketTableView extends AnchorPane implements EventHandler<ActionEv
100100 final KeyCombination pasteCombination = new KeyCodeCombination (KeyCode .V , KeyCombination .CONTROL_DOWN );
101101 private List <Profile > copiedProfiles = new ArrayList <>();
102102 private String profileName ;
103- int numOfStreamLoaded = 0 ;
104- int numOfEnabledStream = 0 ;
105- private boolean doUpdate = false ;
106103 ContextMenu rightClickMenu ;
107104 private File loadedProfile ;
108105 private DialogWindow streamWindow ;
@@ -303,7 +300,6 @@ private void handleStreamTableAction(StreamTableAction action) {
303300 * @param type
304301 */
305302 public void handleAddPacket (String streamName , StreamBuilderType type ) {
306- doUpdate = false ;
307303 TableProfileStream newRow = new TableProfileStream ();
308304 newRow .setName (streamName );
309305 tabledata .getStreamsList ().add (newRow );
@@ -511,7 +507,8 @@ private void saveChangesToYamlFile(Profile[] profiles) throws JsonProcessingExce
511507 String yamlData = trafficProfile .convertTrafficProfileToYaml (profiles );
512508 FileUtils .writeStringToFile (new File (tabledata .getYamlFileName ()), yamlData );
513509 streamPacketTableView .setItems (FXCollections .observableArrayList (tabledata .getStreamsList ()));
514- if (tableUpdateHandler != null && doUpdate ) {
510+ if (tableUpdateHandler != null ) {
511+ tableUpdateHandler .onStreamTableChanged ();
515512 tableUpdateHandler .onStreamUpdated ();
516513 }
517514 }
@@ -604,21 +601,9 @@ public List<TableProfileStream> getPacketDataList() {
604601 */
605602 public void setPacketData (TableProfile tableData ) {
606603 this .tabledata = tableData ;
607- numOfStreamLoaded = 0 ;
608- doUpdate = false ;
609- updateNumberOfEnabledStream ();
610604 streamPacketTableView .setItems (FXCollections .observableArrayList (tableData .getStreamsList ()));
611605 }
612606
613- private void updateNumberOfEnabledStream () {
614- numOfEnabledStream = 0 ;
615- for (Profile profile : tabledata .getProfiles ()) {
616- if (profile .getStream ().isEnabled ()) {
617- numOfEnabledStream ++;
618- }
619- }
620- }
621-
622607 /**
623608 *
624609 * @return
@@ -747,7 +732,6 @@ private Optional<String> askUserToEnterStreamName(String dialogTitle, String def
747732 */
748733 public Profile [] loadStreamTable (File fileToLoad ) throws Exception {
749734 this .loadedProfile = fileToLoad ;
750- doUpdate = false ;
751735 Profile [] profileList ;
752736 this .profileName = fileToLoad .getName ();
753737 try {
@@ -780,9 +764,6 @@ private void handleExportToYaml() {
780764 public void stateChanged (int index , boolean newValue ) {
781765 try {
782766 if (!streamEditingWindowOpen ) {
783- if (++numOfStreamLoaded > numOfEnabledStream ) {
784- doUpdate = true ;
785- }
786767 tabledata .getProfiles ().get (index ).getStream ().setEnabled (newValue );
787768 saveChangesToYamlFile (tabledata .getProfiles ().toArray (new Profile [tabledata .getProfiles ().size ()]));
788769 loadStreamTable (loadedProfile );
0 commit comments