Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-544

ZK 6.0 TreeDataEvent types could use Java 1.5 enums instead of ints

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 6.0.0
    • Components

      TreeDataEvent types are currently represented as integers. I think it would be a good idea to convert this to Java 1.5 enums in ZK 6.0.

      public class TreeDataEvent<E> {
        public static final int CONTENTS_CHANGED = 0;
        public static final int INTERVAL_ADDED = 1;
        public static final int INTERVAL_REMOVED = 2;
        public static final int STRUCTURE_CHANGED = 3;
        ...
      }
      

      could be changed to

      public class TreeDataEvent<E> {
        public static enum Type {
          CONTENTS_CHANGED,
          INTERVAL_ADDED,
          INTERVAL_REMOVED,
          STRUCTURE_CHANGED
        }
        ...
      }
      

      This would make the method signature of fireEvent in AbstractTreeModel much better, because type/indexFrom/indexTo parameters would no longer be confused with each other:

      public void fireEvent(E node, int indexFrom, int indexTo, int evtType) // Three consecutive integers are confusing
      

      vs

      public void fireEvent(E node, int indexFrom, int indexTo, TreeDataEvent.Type evtType)
      

            Unassigned Unassigned
            gekkio gekkio
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: