@@ -704,15 +704,33 @@ public void propagateDirectionality(BidirPort root) {
704
704
* Called by XMLReader and copy routines. Default behaviour is no-op.
705
705
* @param data Structure containing state to load (module-defined elements)
706
706
*/
707
- public void dataIn (HashMap <String , String > data ) {}
707
+ public void dataIn (HashMap <String , String > data ) {
708
+ if (data .containsKey ("label" )) {
709
+ label = data .get ("label" );
710
+ }
711
+ if (data .containsKey ("label_size" )) {
712
+ String sizeStr = data .get ("label_size" );
713
+ try {
714
+ labelSize = Integer .parseInt (sizeStr );
715
+ } catch (NumberFormatException e ) {
716
+ System .err .println ("Warning: unable to parse label_size:" );
717
+ e .printStackTrace ();
718
+ }
719
+ }
720
+ }
708
721
709
722
/**
710
723
* Fill a string-string hash map with module-specific data for retrieval with dataIn.
711
724
* Called by XMLWriter and the copy routines. Default behaviour is to return null, indicating that no relevant
712
725
* data is contained in the module.
713
726
* @return A filled hash map structure, or null if no state is stored
714
727
*/
715
- public HashMap <String , String > dataOut () { return null ; }
728
+ public HashMap <String , String > dataOut () {
729
+ HashMap <String , String > dataMap = new HashMap <>();
730
+ dataMap .put ("label" , label );
731
+ dataMap .put ("label_size" , Integer .toString (labelSize ));
732
+ return dataMap ;
733
+ }
716
734
717
735
public enum AvailableModules {
718
736
// Enum members should not be renamed!
0 commit comments