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

XMLWordPrintable

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Normal
    • None
    • Affects Version/s: 6.0.0
    • Component/s: Components
    • None

      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)
      

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

              Created:
              Updated: