zul/src/main/java/org/zkoss/zul/Tree.java

Summary

Maintainability
F
1 mo
Test Coverage

File Tree.java has 2159 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Tree.java

    Purpose:

    Description:
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 5 days to fix

    Tree has 158 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @SuppressWarnings("serial")
    public class Tree extends MeshElement {
        private static final Logger log = LoggerFactory.getLogger(Tree.class);
        private static final String ATTR_ON_INIT_RENDER_POSTED = "org.zkoss.zul.Tree.onInitLaterPosted";
        public static final int DEFAULT_THROTTLE_MILLIS = 300;
    Severity: Major
    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 days to fix

      Method service has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings({ "rawtypes", "unchecked" })
          public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
              final String cmd = request.getCommand();
              boolean isSelModel = _model instanceof Selectable;
              if (cmd.equals(Events.ON_SELECT)) {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 days to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method onEvent has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

              public void onEvent(Event event) {
                  if (inPagingMold() && event instanceof PagingEvent) {
                      PagingEvent pe = (PagingEvent) event;
                      if (_model instanceof Pageable) {
                          ((Pageable) _model).setPageSize(pe.getPageable().getPageSize());
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method setModel has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
      Open

          public void setModel(TreeModel<?> model) {
              if (model != null) {
                  if (!(model instanceof TreeSelectableModel))
                      throw new UiException(model.getClass() + " must implement " + TreeSelectableModel.class);
      
      
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method onTreeDataChange has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

          private void onTreeDataChange(TreeDataEvent event) {
              final int type = event.getType();
              final int[] path = event.getPath();
              final Component target = path != null ? getChildByPath(path) : null;
              switch (type) {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 7 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method service has 188 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @SuppressWarnings({ "rawtypes", "unchecked" })
          public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
              final String cmd = request.getCommand();
              boolean isSelModel = _model instanceof Selectable;
              if (cmd.equals(Events.ON_SELECT)) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 7 hrs to fix

        Method getVisibleItemsDFS has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

            private <T extends Component> boolean getVisibleItemsDFS(List<T> list, Map<Treeitem, Boolean> map, int[] data) {
                for (T cmp : list) {
                    if (cmp instanceof Treeitem) {
                        if (data[4] >= data[0])
                            return false; // full
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 6 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method afterUnmarshal has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

            private void afterUnmarshal(int cnt, int cntSel) {
                if (cnt != 0) {
                    for (Component child : getChildren()) {
                        if (child instanceof Treecols) {
                            _treecols = (Treecols) child;
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 6 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method setPaginal has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public void setPaginal(Paginal pgi) {
                if (!Objects.equals(pgi, _pgi)) {
                    final Paginal old = _pgi;
                    _pgi = pgi; //assign before detach paging, since removeChild assumes it
        
        
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method beforeChildAdded has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            public void beforeChildAdded(Component newChild, Component refChild) {
                if (newChild instanceof Treecols) {
                    if (_treecols != null && _treecols != newChild)
                        throw new UiException("Only one treecols is allowed: " + this);
                } else if (newChild instanceof Treefoot) {
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method renderProperties has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
                super.renderProperties(renderer);
        
                render(renderer, "name", _name);
                if (_rows > 0)
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method setMold has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public void setMold(String mold) {
                final String old = getMold();
                if (!Objects.equals(old, mold)) {
                    super.setMold(mold);
                    //we have to change model before detaching paging,
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method renderChildren0 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            private void renderChildren0(Renderer renderer, Treechildren parent, Treeitem ti, Object childNode, int i)
                    throws Throwable {
                renderer.render(ti, childNode, i);
                Object v = ti.getAttribute(Attributes.MODEL_RENDERAS);
                if (v != null) { //a new item is created to replace the existent one
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method onTreeDataChange has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void onTreeDataChange(TreeDataEvent event) {
                final int type = event.getType();
                final int[] path = event.getPath();
                final Component target = path != null ? getChildByPath(path) : null;
                switch (type) {
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

          Method insertBefore has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              public boolean insertBefore(Component newChild, Component refChild) {
                  if (newChild instanceof Treecols) {
                      if (super.insertBefore(newChild, refChild)) {
                          _treecols = (Treecols) newChild;
                          return true;
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method onEvent has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public void onEvent(Event event) {
                      if (inPagingMold() && event instanceof PagingEvent) {
                          PagingEvent pe = (PagingEvent) event;
                          if (_model instanceof Pageable) {
                              ((Pageable) _model).setPageSize(pe.getPageable().getPageSize());
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 hrs to fix

            Method getVisibleIndexOfItem0 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                private int getVisibleIndexOfItem0(Treeitem item, boolean inclusive) {
                    // ZK-2539: use vector instead of recursive calls to avoid stack overflow
                    // when number of tree items is huge.
                    Vector<Treeitem> items = new Vector<Treeitem>();
                    int count = 0;
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public void render(Treeitem ti, final Object node, final int index) {
                        Tree tree = ti.getTree();
                        final Template tm = tree.getTemplate("model");
                        if (tm == null) {
                            Treecell tc = new Treecell(Objects.toString(node));
            Severity: Major
            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

              Method updateHeadercmTristate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void updateHeadercmTristate(Set<?> partialSelections) {
                      if (getTreecols() != null) {
                          boolean treecolShouldBePartial = false;
                          int numberOfChild = 0,
                                  selectedChild = 0;
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method renderItemByPath has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public Treeitem renderItemByPath(int[] path) {
                      if (path == null || path.length == 0)
                          return null;
                      // Start from root-Tree
                      Treeitem ti = null;
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method renderProperties has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
                      super.renderProperties(renderer);
              
                      render(renderer, "name", _name);
                      if (_rows > 0)
              Severity: Major
              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

                Method renderChangedItem has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                        @SuppressWarnings("unchecked")
                        private void renderChangedItem(Treeitem item, Object node, int index) throws Throwable {
                            if (!_rendered && (_renderer instanceof RendererCtrl)) {
                                ((RendererCtrl) _renderer).doTry();
                                _ctrled = true;
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method setModel has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void setModel(TreeModel<?> model) {
                        if (model != null) {
                            if (!(model instanceof TreeSelectableModel))
                                throw new UiException(model.getClass() + " must implement " + TreeSelectableModel.class);
                
                
                Severity: Major
                Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 hrs to fix

                  Method setMultiple has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public void setMultiple(boolean multiple) {
                          if (_multiple != multiple) {
                              _multiple = multiple;
                              if (!_multiple && _selItems.size() > 1) {
                                  final Treeitem item = getSelectedItem();
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method clone has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @SuppressWarnings("unchecked")
                      public Object clone() {
                          int cntSel = _selItems.size();
                  
                          final Tree clone = (Tree) super.clone();
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method renderChangedItem has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          @SuppressWarnings("unchecked")
                          private void renderChangedItem(Treeitem item, Object node, int index) throws Throwable {
                              if (!_rendered && (_renderer instanceof RendererCtrl)) {
                                  ((RendererCtrl) _renderer).doTry();
                                  _ctrled = true;
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                    Method onTreechildrenRemoved has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        /*package*/ void onTreechildrenRemoved(Treechildren tchs) {
                            if (tchs == null || tchs.getParent() == this)
                                return; //already being processed by onChildRemoved
                    
                            //main the selected status
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Method selectItem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public void selectItem(Treeitem item) {
                            if (item == null) {
                                clearSelection();
                            } else {
                                if (item.getTree() != this)
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Method renderChangedItem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private void renderChangedItem(Treeitem item, Object node) {
                            /*
                             * After modified the node in tree model, if node is leaf,
                             * its treechildren is needed to be dropped.
                             */
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Method afterUnmarshal has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private void afterUnmarshal(int cnt, int cntSel) {
                            if (cnt != 0) {
                                for (Component child : getChildren()) {
                                    if (child instanceof Treecols) {
                                        _treecols = (Treecols) child;
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                      Method renderChildren0 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private void renderChildren0(Renderer renderer, Treechildren parent, Treeitem ti, Object childNode, int i)
                                  throws Throwable {
                              renderer.render(ti, childNode, i);
                              Object v = ti.getAttribute(Attributes.MODEL_RENDERAS);
                              if (v != null) { //a new item is created to replace the existent one
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                        Method removeItemFromSelection has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public void removeItemFromSelection(Treeitem item) {
                                if (item.getTree() != this)
                                    throw new UiException("Not a child: " + item);
                        
                                if (item.isSelected()) {
                        Severity: Minor
                        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Method getVisibleIndexOfItem0 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private int getVisibleIndexOfItem0(Treeitem item, boolean inclusive) {
                                // ZK-2539: use vector instead of recursive calls to avoid stack overflow
                                // when number of tree items is huge.
                                Vector<Treeitem> items = new Vector<Treeitem>();
                                int count = 0;
                        Severity: Minor
                        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                          Method setMold has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public void setMold(String mold) {
                                  final String old = getMold();
                                  if (!Objects.equals(old, mold)) {
                                      super.setMold(mold);
                                      //we have to change model before detaching paging,
                          Severity: Minor
                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                            Method insertBefore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public boolean insertBefore(Component newChild, Component refChild) {
                                    if (newChild instanceof Treecols) {
                                        if (super.insertBefore(newChild, refChild)) {
                                            _treecols = (Treecols) newChild;
                                            return true;
                            Severity: Minor
                            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                              Method addVisibleItemCount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  void addVisibleItemCount(int count) {
                                      if (inPagingMold()) {
                                          Paginal pgi = getPaginal();
                                          int totalSize = pgi.getTotalSize() + count;
                                          //ZK-3173: if visible item count reduces, active page might exceed max page count
                              Severity: Minor
                              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Method getVisibleItemsDFS has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private <T extends Component> boolean getVisibleItemsDFS(List<T> list, Map<Treeitem, Boolean> map, int[] data) {
                                      for (T cmp : list) {
                                          if (cmp instanceof Treeitem) {
                                              if (data[4] >= data[0])
                                                  return false; // full
                              Severity: Minor
                              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                                Method clone has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @SuppressWarnings("unchecked")
                                    public Object clone() {
                                        int cntSel = _selItems.size();
                                
                                        final Tree clone = (Tree) super.clone();
                                Severity: Minor
                                Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                                  Method setPaginal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public void setPaginal(Paginal pgi) {
                                          if (!Objects.equals(pgi, _pgi)) {
                                              final Paginal old = _pgi;
                                              _pgi = pgi; //assign before detach paging, since removeChild assumes it
                                  
                                  
                                  Severity: Minor
                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                                    Method onEvent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                            public void onEvent(Event event) {
                                                //Bug ZK-1622: reset anchor position after changing page
                                                _anchorTop = 0;
                                                _anchorLeft = 0;
                                                if (event instanceof PagingEvent) {
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Method updateHeadercmTristate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private void updateHeadercmTristate(Set<?> partialSelections) {
                                            if (getTreecols() != null) {
                                                boolean treecolShouldBePartial = false;
                                                int numberOfChild = 0,
                                                        selectedChild = 0;
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

                                      Method init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private void init() {
                                              _selItems = new LinkedHashSet<Treeitem>(4);
                                              _heads = new AbstractCollection<Component>() {
                                                  public int size() {
                                                      int sz = getChildren().size();
                                      Severity: Minor
                                      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 55 mins to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method renderItem0 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private void renderItem0(Renderer renderer, Treeitem item, Object node) throws Throwable {
                                              if (item.isLoaded()) //all direct children are loaded
                                                  return;
                                      
                                              /*
                                      Severity: Minor
                                      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 55 mins to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                              public void render(Treeitem ti, final Object node, final int index) {
                                                  Tree tree = ti.getTree();
                                                  final Template tm = tree.getTemplate("model");
                                                  if (tm == null) {
                                                      Treecell tc = new Treecell(Objects.toString(node));
                                      Severity: Minor
                                      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 55 mins to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if (item.isOpen()) {
                                                                  if (!getVisibleItemsDFS(item.getChildren(), map, data)) {
                                                                      return false;
                                                                  } else {
                                                                      // the children may be visible.
                                      Severity: Major
                                      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                        Method onAfterRender has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public void onAfterRender() {
                                                if (inPagingMold() && _model instanceof Pageable) {
                                                    Pageable m = (Pageable) _model;
                                                    if (m.getPageSize() > 0) { //min page size is 1
                                                        _pgi.setPageSize(m.getPageSize());
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Method fixNewChild has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            private void fixNewChild(Treeitem item) {
                                                if (item.isSelected()) {
                                                    if (_sel != null && !_multiple) {
                                                        item.setSelectedDirectly(false);
                                                        item.invalidate();
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                if (m.getActivePage() < 0) { //check for invalid value, min page index is 0
                                                                    m.setActivePage(_pgi.getActivePage());
                                                                }
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                      if (i < start) {
                                                                          i++;
                                                                          continue;
                                                                      }
                                          Severity: Major
                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    if (data[1] < data[2]) {
                                                                        // count the rendered item
                                                                        data[4]++;
                                                                        map.put(item, Boolean.TRUE);
                                                                    }
                                            Severity: Major
                                            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                              Method setActivePage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public void setActivePage(Treeitem item) {
                                                      if (item.isRealVisible() && item.getTree() == this && isVisible()) {
                                                          int index = getVisibleIndexOfItem(item);
                                                          if (index != -1) {
                                                              final Paginal pgi = getPaginal();
                                              Severity: Minor
                                              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                          if (i >= end) {
                                                                              if (sortedIndex.isEmpty()) {
                                                                                  break;
                                                                              } else {
                                                                                  start = sortedIndex.removeFirst() * size;
                                              Severity: Major
                                              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                                Method onEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                        public void onEvent(Event event) throws Exception {
                                                            if (_modelInitListener != null) {
                                                                Tree.this.removeEventListener("onInitModel", _modelInitListener);
                                                                _modelInitListener = null;
                                                            }
                                                Severity: Minor
                                                Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                                Cognitive Complexity

                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                A method's cognitive complexity is based on a few simple rules:

                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                • Code is considered more complex when "flow breaking structures are nested"

                                                Further reading

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                            if (!ti.isOpen() && ti.getDesktop() != null) {
                                                                                ti.getChildren().clear();
                                                                                ti.setRendered(false);
                                                                                ti.setLoaded(false);
                                                                            }
                                                Severity: Major
                                                Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          if (m.getPageSize() <= 0) { //check for invalid value, min page size is 1
                                                                              m.setPageSize(_pgi.getPageSize());
                                                                          }
                                                  Severity: Major
                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                                    Method addItemToSelection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        public void addItemToSelection(Treeitem item) {
                                                            if (item.getTree() != this)
                                                                throw new UiException("Not a child: " + item);
                                                    
                                                            if (!item.isSelected()) {
                                                    Severity: Minor
                                                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                                    Cognitive Complexity

                                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                    A method's cognitive complexity is based on a few simple rules:

                                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                    • Code is considered more complex for each "break in the linear flow of the code"
                                                    • Code is considered more complex when "flow breaking structures are nested"

                                                    Further reading

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            if (cols != null) {
                                                                                for (Component treecol : cols.getChildren()) {
                                                                                    ((Treecol) treecol).setSortDirection("natural");
                                                                                }
                                                                            }
                                                    Severity: Major
                                                    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 45 mins to fix

                                                      Consider simplifying this complex logical expression.
                                                      Open

                                                                      if (!_multiple || (!paging && isAllRendered() && (curSeldItems == null || curSeldItems.size() <= 1))) {
                                                                          final Treeitem item = curSeldItems != null && curSeldItems.size() > 0
                                                                                  ? curSeldItems.iterator().next() : null;
                                                                          selectItem(item);
                                                                          if (_model instanceof TreeSelectableModel) {
                                                      Severity: Major
                                                      Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 40 mins to fix

                                                        Method renderChildren0 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            private void renderChildren0(Renderer renderer, Treechildren parent, Treeitem ti, Object childNode, int i)
                                                        Severity: Minor
                                                        Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Method onPageAttached has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              public void onPageAttached(Page newpage, Page oldpage) {
                                                                  super.onPageAttached(newpage, oldpage);
                                                                  if (oldpage == null) {
                                                                      //prepare a right moment to init Tree(must be as early as possible)
                                                                      this.addEventListener("onInitModel", _modelInitListener = new ModelInitListener());
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Method onChildRemoved has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              public void onChildRemoved(Component child) {
                                                                  if (child instanceof Treecols) {
                                                                      _treecols = null;
                                                                  } else if (child instanceof Treefoot) {
                                                                      _treefoot = null;
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Method getPath0 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              private int[] getPath0(Treechildren parent, int index) {
                                                                  List<Integer> path = new LinkedList<Integer>();
                                                                  path.add(index);
                                                                  Component p = parent;
                                                                  while (true) {
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Method render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                                  @SuppressWarnings("unchecked")
                                                                  private void render(Treeitem item, Object node, int index) throws Throwable {
                                                                      if (!_rendered && (_renderer instanceof RendererCtrl)) {
                                                                          ((RendererCtrl) _renderer).doTry();
                                                                          _ctrled = true;
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Method fixSelectedSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              private void fixSelectedSet() {
                                                                  _sel = null;
                                                                  _selItems.clear();
                                                                  for (Treeitem item : getItems()) {
                                                                      if (item.isSelected()) {
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Method fixSelected has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              private boolean fixSelected() {
                                                                  Treeitem sel = null;
                                                                  switch (_selItems.size()) {
                                                                  case 1:
                                                                      sel = _selItems.iterator().next();
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Method renderTree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              private void renderTree() {
                                                                  if (_treechildren == null) {
                                                                      Treechildren children = new Treechildren();
                                                                      children.setParent(this);
                                                                  } else {
                                                          Severity: Minor
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return false;
                                                          Severity: Major
                                                          Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return true;
                                                            Severity: Major
                                                            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return true;
                                                              Severity: Major
                                                              Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            return;
                                                                Severity: Major
                                                                Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 30 mins to fix

                                                                  Method selectAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      public void selectAll() {
                                                                          if (!_multiple)
                                                                              throw new UiException("Appliable only to the multiple seltype: " + this);
                                                                  
                                                                          //we don't invoke getItemCount first because it is slow!
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 25 mins to fix

                                                                  Cognitive Complexity

                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                  Further reading

                                                                  Method doSort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      private static boolean doSort(Tree tree) {
                                                                          Treecols cols = tree.getTreecols();
                                                                          if (!tree.isAutosort() || cols == null)
                                                                              return false;
                                                                          for (Component c : cols.getChildren()) {
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 25 mins to fix

                                                                  Cognitive Complexity

                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                  Further reading

                                                                  Method getActivePage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      @Override
                                                                      public int getActivePage() {
                                                                          if (hasAttribute(ATTR_ON_INIT_RENDER_POSTED) && _model instanceof Pageable) {
                                                                              if (((Pageable) _model).getActivePage() >= 0) { //min page index is 0
                                                                                  return ((Pageable) _model).getActivePage();
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 25 mins to fix

                                                                  Cognitive Complexity

                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                  Further reading

                                                                  Identical blocks of code found in 3 locations. Consider refactoring.
                                                                  Open

                                                                              if (_model instanceof Sortable) {
                                                                                  final Sortable<Object> smodel = cast(_model);
                                                                                  final List<Treecol> cols = cast(_treecols.getChildren());
                                                                                  boolean found = false;
                                                                                  for (final Treecol col : cols) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 2 other locations - About 2 hrs to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1134..1153
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2656..2675

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 150.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                          public void onEvent(Event event) {
                                                                              //Bug ZK-1622: reset anchor position after changing page
                                                                              _anchorTop = 0;
                                                                              _anchorLeft = 0;
                                                                              if (event instanceof PagingEvent) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 2 hrs to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1302..1322

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 148.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      public void setMultiple(boolean multiple) {
                                                                          if (_multiple != multiple) {
                                                                              _multiple = multiple;
                                                                              if (!_multiple && _selItems.size() > 1) {
                                                                                  final Treeitem item = getSelectedItem();
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 1 hr to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 753..773

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 126.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      private class Iter implements Iterator<Component> {
                                                                          private final ListIterator<? extends Component> _it = getChildren().listIterator();
                                                                  
                                                                          public boolean hasNext() {
                                                                              while (_it.hasNext()) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 1 hr to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1903..1928

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 99.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                          _heads = new AbstractCollection<Component>() {
                                                                              public int size() {
                                                                                  int sz = getChildren().size();
                                                                                  if (_treechildren != null)
                                                                                      --sz;
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 1 hr to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 281..298

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 88.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                              if (tm == null) {
                                                                                  Treecell tc = new Treecell(Objects.toString(node));
                                                                                  Treerow tr = null;
                                                                                  ti.setValue(node);
                                                                                  if (ti.getTreerow() == null) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 1 hr to fix
                                                                  zkbind/src/main/java/org/zkoss/bind/impl/BindTreeitemRenderer.java on lines 46..58

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 88.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 3 locations. Consider refactoring.
                                                                  Open

                                                                      /*package*/ boolean isAutosort() {
                                                                          String attr = "org.zkoss.zul.tree.autoSort";
                                                                          Object val = getAttribute(attr, true);
                                                                          if (val == null)
                                                                              val = Library.getProperty(attr);
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 2 other locations - About 1 hr to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1485..1492
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3426..3433

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 83.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                          } else if (newChild instanceof Paging) {
                                                                              if (_paging != null && _paging != newChild)
                                                                                  throw new UiException("Only one paging is allowed: " + this);
                                                                              if (_pgi != null)
                                                                                  throw new UiException("External paging cannot coexist with child paging");
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 1 hr to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1668..1677

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 82.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 3 locations. Consider refactoring.
                                                                  Open

                                                                      private int preloadSize() {
                                                                          final String size = (String) getAttribute("pre-load-size");
                                                                          int sz = size != null ? Integer.parseInt(size) : _preloadsz;
                                                                  
                                                                          if ((sz = Utils.getIntAttribute(this, "org.zkoss.zul.tree.preloadSize", sz, true)) < 0)
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 2 other locations - About 1 hr to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1503..1510
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3448..3455

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 75.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                              if (pgi != null) {
                                                                                  int pgsz = pgi.getPageSize();
                                                                                  from = pgi.getActivePage() * pgsz;
                                                                                  to = from + pgsz; // excluded
                                                                              } else {
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 55 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3670..3677

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 64.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      private void smartUpdateSelection() {
                                                                          final StringBuffer sb = new StringBuffer(80);
                                                                          for (Treeitem item : _selItems) {
                                                                              if (sb.length() > 0)
                                                                                  sb.append(',');
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 50 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1072..1080

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 61.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 3 locations. Consider refactoring.
                                                                  Open

                                                                      private boolean isIgnoreSortWhenChanged() {
                                                                          String attr = "org.zkoss.zul.tree.autoSort";
                                                                          Object val = getAttribute(attr, true);
                                                                          if (val == null)
                                                                              val = Library.getProperty(attr);
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 2 other locations - About 50 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1530..1536
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3475..3481

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 61.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 19 locations. Consider refactoring.
                                                                  Open

                                                                      public void setName(String name) {
                                                                          if (name != null && name.length() == 0)
                                                                              name = null;
                                                                          if (!Objects.equals(_name, name)) {
                                                                              _name = name;
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 18 other locations - About 50 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlBasedComponent.java on lines 323..330
                                                                  zul/src/main/java/org/zkoss/zul/Area.java on lines 110..117
                                                                  zul/src/main/java/org/zkoss/zul/Box.java on lines 129..136
                                                                  zul/src/main/java/org/zkoss/zul/Box.java on lines 185..192
                                                                  zul/src/main/java/org/zkoss/zul/Box.java on lines 250..257
                                                                  zul/src/main/java/org/zkoss/zul/Calendar.java on lines 237..244
                                                                  zul/src/main/java/org/zkoss/zul/Checkbox.java on lines 225..232
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1332..1339
                                                                  zul/src/main/java/org/zkoss/zul/Layout.java on lines 40..47
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 827..834
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1483..1490
                                                                  zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 276..283
                                                                  zul/src/main/java/org/zkoss/zul/Script.java on lines 105..113
                                                                  zul/src/main/java/org/zkoss/zul/Script.java on lines 211..219
                                                                  zul/src/main/java/org/zkoss/zul/Selectbox.java on lines 191..198
                                                                  zul/src/main/java/org/zkoss/zul/Slider.java on lines 375..382
                                                                  zul/src/main/java/org/zkoss/zul/Style.java on lines 119..126
                                                                  zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 403..411

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 60.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                          } else if (newChild instanceof Paging) {
                                                                              refChild = null; //the last: paging
                                                                              if (super.insertBefore(newChild, refChild)) {
                                                                                  _pgi = _paging = (Paging) newChild;
                                                                                  return true;
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 50 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1789..1798

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 58.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      private <T> Set<T> collectUnselectedObjects(Set<T> previousSelection, Set<T> currentSelection) {
                                                                          Set<T> prevSeldItems = previousSelection != null ? new LinkedHashSet<T>(previousSelection)
                                                                                  : new LinkedHashSet<T>();
                                                                          if (currentSelection != null && prevSeldItems.size() > 0)
                                                                              prevSeldItems.removeAll(currentSelection);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 45 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3502..3508

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 55.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 5 locations. Consider refactoring.
                                                                  Open

                                                                          private void doCatch(Throwable ex) {
                                                                              if (_ctrled) {
                                                                                  try {
                                                                                      ((RendererCtrl) _renderer).doCatch(ex);
                                                                                  } catch (Throwable t) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 4 other locations - About 40 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Combobox.java on lines 660..670
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1224..1234
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2798..2808
                                                                  zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 712..722

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 52.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                              if (paging && (!isCheckmarkDeselectOther() || (isCheckmarkDeselectOther() && selectAll))) {
                                                                                  // use toArray() to prevent java.util.ConcurrentModificationException
                                                                                  for (Object item : realPrevSeldItems.toArray()) {
                                                                                      int index = ((Treeitem) item).getIndex();
                                                                                      if (index >= to || index < from)
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 40 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3680..3687

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 52.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      public void setRows(int rows) throws WrongValueException {
                                                                          checkBeforeSetRows();
                                                                  
                                                                          if (rows < 0)
                                                                              throw new WrongValueException("Illegal rows: " + rows);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 40 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 512..522

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 52.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                                  if (sel < 0 || sel < begin || sel >= end) { //not in selection range
                                                                                      sel = size > oldsize ? (end - 1) : begin;
                                                                                  }
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 40 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3620..3622

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 50.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 3 locations. Consider refactoring.
                                                                  Open

                                                                      private void removePagingListener(Paginal pgi) {
                                                                          if (_model instanceof PageableModel) {
                                                                              ((PageableModel) _model).removePagingEventListener((PagingListener) _pgListener);
                                                                          }
                                                                          pgi.removeEventListener(ZulEvents.ON_PAGING, _pgListener);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 2 other locations - About 40 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 691..697
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1373..1379

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 48.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 5 locations. Consider refactoring.
                                                                  Open

                                                                      public void setInnerWidth(String innerWidth) {
                                                                          if (innerWidth == null)
                                                                              innerWidth = "100%";
                                                                          if (!_innerWidth.equals(innerWidth)) {
                                                                              _innerWidth = innerWidth;
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 4 other locations - About 40 mins to fix
                                                                  zhtml/src/main/java/org/zkoss/zhtml/impl/ContentTag.java on lines 53..60
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1000..1007
                                                                  zul/src/main/java/org/zkoss/zul/Iframe.java on lines 71..78
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 598..605

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 48.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      private boolean isCheckmarkDeselectOther() {
                                                                          if (_ckDeselectOther == null) //ok to race
                                                                              _ckDeselectOther = Boolean
                                                                                      .valueOf("true".equals(Library.getProperty("org.zkoss.zul.tree.checkmarkDeselectOthers")));
                                                                          return Utils.testAttribute(this, "org.zkoss.zul.tree.checkmarkDeselectOthers", _ckDeselectOther.booleanValue(), true);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3486..3491

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 47.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                              SelectEvent evt = new SelectEvent(Events.ON_SELECT, this, curSeldItems, prevSeldItems, unselectedItems,
                                                                                      selectedObjects, prevSeldObjects, unselectedObjects,
                                                                                      desktop.getComponentByUuidIfAny((String) data.get("reference")), null, AuRequests.parseKeys(data));
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3813..3815

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 46.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                              if (control != null) {
                                                                                  Clients.response(new AuInvoke(this, "$doService", new Object[] { cmd, new JSONAware() {
                                                                                      public String toJSONString() {
                                                                                          return String.valueOf(control.isSelectAll());
                                                                                      }
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3931..3937

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 45.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 5 locations. Consider refactoring.
                                                                  Open

                                                                          } else if (cmd.equals(Events.ON_SCROLL_POS)) {
                                                                              final Map<String, Object> data = request.getData();
                                                                              _currentTop = AuRequests.getInt(data, "top", 0);
                                                                              _currentLeft = AuRequests.getInt(data, "left", 0);
                                                                          } else if (cmd.equals(Events.ON_ANCHOR_POS)) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 4 other locations - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1848..1852
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3633..3637
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3629..3633
                                                                  zul/src/main/java/org/zkoss/zul/Tree.java on lines 2978..2982

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 44.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 5 locations. Consider refactoring.
                                                                  Open

                                                                          } else if (cmd.equals(Events.ON_ANCHOR_POS)) {
                                                                              final Map<String, Object> data = request.getData();
                                                                              _anchorTop = AuRequests.getInt(data, "top", 0);
                                                                              _anchorLeft = AuRequests.getInt(data, "left", 0);
                                                                          } else if (cmd.equals(Events.ON_CHECK_SELECT_ALL) && isSelModel) {
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 4 other locations - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 1848..1852
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3633..3637
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3629..3633
                                                                  zul/src/main/java/org/zkoss/zul/Tree.java on lines 2974..2978

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 44.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 4 locations. Consider refactoring.
                                                                  Open

                                                                          if (_model instanceof PageableModel && _pgListener != null) {
                                                                              ((PageableModel) _model).removePagingEventListener((PagingListener) _pgListener);
                                                                              ((PageableModel) _model).addPagingEventListener((PagingListener) _pgListener);
                                                                          }
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 3 other locations - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 318..321
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3080..3083
                                                                  zul/src/main/java/org/zkoss/zul/Tree.java on lines 296..299

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 44.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 4 locations. Consider refactoring.
                                                                  Open

                                                                          if (_model instanceof PageableModel && _pgListener != null) {
                                                                              ((PageableModel) _model).removePagingEventListener((PagingListener) _pgListener);
                                                                              ((PageableModel) _model).addPagingEventListener((PagingListener) _pgListener);
                                                                          }
                                                                  Severity: Major
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 3 other locations - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Grid.java on lines 318..321
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3080..3083
                                                                  zul/src/main/java/org/zkoss/zul/Tree.java on lines 2032..2035

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 44.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                              if (_model != null && paging) {
                                                                                  prevSeldItems = null;
                                                                                  unselectedItems = null;
                                                                              } else {
                                                                                  unselectedItems = collectUnselectedObjects(realPrevSeldItems, curSeldItems);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 35 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3790..3795

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 44.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      public void setSeltype(String seltype) throws WrongValueException {
                                                                          if ("single".equals(seltype))
                                                                              setMultiple(false);
                                                                          else if ("multiple".equals(seltype))
                                                                              setMultiple(true);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 30 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Listbox.java on lines 730..737

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 42.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                  Open

                                                                      private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                                                                          s.defaultWriteObject();
                                                                  
                                                                          willSerialize(_model);
                                                                          Serializables.smartWrite(s, _model);
                                                                  Severity: Minor
                                                                  Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 30 mins to fix
                                                                  zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 756..763

                                                                  Duplicated Code

                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                  Tuning

                                                                  This issue has a mass of 42.

                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                  Refactorings

                                                                  Further Reading

                                                                  There are no issues that match your filters.

                                                                  Category
                                                                  Status