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

    Details

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

      Description

      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)
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: