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

Summary

Maintainability
F
2 wks
Test Coverage

File Grid.java has 1280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Grid.java

    Purpose:

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

    Grid has 90 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Grid extends MeshElement {
        private static final Logger log = LoggerFactory.getLogger(Grid.class);
        private static final long serialVersionUID = 20091111L;
    
        private static final String ATTR_ON_INIT_RENDER_POSTED = "org.zkoss.zul.Grid.onInitLaterPosted";
    Severity: Major
    Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 1 day to fix

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

          public void setModel(ListModel<?> model) {
              //ZK-3514: speed up
              if (_model != null && _model != model) {
                  int threshold = Utils.getIntAttribute(this, "org.zkoss.zul.invalidateThreshold", 10, true);
                  int diff = Math.abs((model != null ? model.getSize() : 0) - _model.getSize());
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Grid.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 service has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

          public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
              final String cmd = request.getCommand();
              if (cmd.equals(Events.ON_DATA_LOADING)) {
                  Events.postEvent(DataLoadingEvent.getDataLoadingEvent(request, preloadSize()));
              } else if (inPagingMold() && cmd.equals(ZulEvents.ON_PAGE_SIZE)) {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Grid.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 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/Grid.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 Rows) {
                  if (_rows != null && _rows != newChild)
                      throw new UiException("Only one rows child is allowed: " + this
                              + "\nNote: rows is created automatically if live data");
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Grid.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 onListDataChange has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          private void onListDataChange(ListDataEvent event) {
              int type = event.getType();
              // ZK-4549: should ignore before handling sorting
              if (getAttribute(Attributes.BEFORE_MODEL_ITEMS_RENDERED) != null
                      && (type == ListDataEvent.INTERVAL_ADDED || type == ListDataEvent.INTERVAL_REMOVED))
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Grid.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 setModel has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void setModel(ListModel<?> model) {
              //ZK-3514: speed up
              if (_model != null && _model != model) {
                  int threshold = Utils.getIntAttribute(this, "org.zkoss.zul.invalidateThreshold", 10, true);
                  int diff = Math.abs((model != null ? model.getSize() : 0) - _model.getSize());
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Grid.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 Rows) {
                    if (super.insertBefore(newChild, refChild)) {
                        _rows = (Rows) newChild;
                        return true;
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Grid.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 afterUnmarshal has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            private void afterUnmarshal(int cnt) {
                for (Iterator it = getChildren().iterator(); it.hasNext();) {
                    final Object child = it.next();
                    if (child instanceof Rows) {
                        _rows = (Rows) child;
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Grid.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 doInitRenderer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private void doInitRenderer() {
                if (getPage() == null)
                    return;
                final Renderer renderer = new Renderer();
                try {
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Grid.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 setRowRenderer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public void setRowRenderer(RowRenderer<?> renderer) {
                if (_renderer != renderer) {
                    _renderer = renderer;
        
                    if (_model != null) {
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Grid.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 service has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
                final String cmd = request.getCommand();
                if (cmd.equals(Events.ON_DATA_LOADING)) {
                    Events.postEvent(DataLoadingEvent.getDataLoadingEvent(request, preloadSize()));
                } else if (inPagingMold() && cmd.equals(ZulEvents.ON_PAGE_SIZE)) {
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 2 hrs to fix

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

                  public void onEvent(Event event) throws Exception {
                      if (_modelInitListener != null) {
                          Grid.this.removeEventListener("onInitModel", _modelInitListener);
                          _modelInitListener = null;
                      }
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Grid.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 setMold has a Cognitive Complexity of 15 (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/Grid.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 renderProperties has a Cognitive Complexity of 14 (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, "oddRowSclass", _scOddRow);
          
          
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Grid.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 doInitRenderer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void doInitRenderer() {
                  if (getPage() == null)
                      return;
                  final Renderer renderer = new Renderer();
                  try {
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 1 hr to fix

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

                    /*package*/ @SuppressWarnings("unchecked")
                    void render(Row row, int index) throws Throwable {
                        if (row.isLoaded())
                            return; //nothing to do
            
            
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 1 hr to fix

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

                  public Object clone() {
                      final Grid clone = (Grid) super.clone();
                      clone.init();
              
                      // remove cached listeners
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Grid.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 onEvent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                      public void onEvent(Event event) {
                          if (_rows != null && _model != null && inPagingMold()) {
                              //theoretically, _rows shall not be null if _model is not null when
                              //this method is called. But, just in case -- if sent manually
                              final Paginal pgi = getPaginal();
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Grid.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 onListDataChange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void onListDataChange(ListDataEvent event) {
                      int type = event.getType();
                      // ZK-4549: should ignore before handling sorting
                      if (getAttribute(Attributes.BEFORE_MODEL_ITEMS_RENDERED) != null
                              && (type == ListDataEvent.INTERVAL_ADDED || type == ListDataEvent.INTERVAL_REMOVED))
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 1 hr to fix

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

                        /*package*/ @SuppressWarnings("unchecked")
                        void render(Row row, int index) throws Throwable {
                            if (row.isLoaded())
                                return; //nothing to do
                
                
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Grid.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 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public Object clone() {
                        final Grid clone = (Grid) super.clone();
                        clone.init();
                
                        // remove cached listeners
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 1 hr to fix

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

                      public boolean removeChild(Component child) {
                          if (_paging == child && _pgi == child && inPagingMold())
                              throw new IllegalStateException(
                                      "The paging component cannot be removed manually. It is removed automatically when changing the mold");
                          //Feature 1906110: prevent developers from removing it accidently
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Grid.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 insertBefore has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public boolean insertBefore(Component newChild, Component refChild) {
                          if (newChild instanceof Rows) {
                              if (super.insertBefore(newChild, refChild)) {
                                  _rows = (Rows) newChild;
                                  return true;
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Grid.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/Grid.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) {
                                  if (event instanceof PagingEvent) {
                                      PagingEvent pe = (PagingEvent) event;
                                      int pgsz = pe.getPageable().getPageSize();
                                      int actpg = pe.getActivePage();
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Grid.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 onPageAttached has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public void onPageAttached(Page newpage, Page oldpage) {
                              super.onPageAttached(newpage, oldpage);
                              if (oldpage == null) {
                                  Executions.getCurrent().setAttribute("zkoss.Grid.deferInitModel_" + getUuid(), Boolean.TRUE);
                                  //prepare a right moment to init Grid(must be as early as possible)
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Grid.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 setMold has 27 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/Grid.java - About 1 hr to fix

                        Method renderProperties has 26 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, "oddRowSclass", _scOddRow);
                        
                        
                        Severity: Minor
                        Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 1 hr to fix

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

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

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

                                private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
                                    s.defaultReadObject();
                            
                                    _model = (ListModel) s.readObject();
                                    didDeserialize(_model);
                            Severity: Minor
                            Found in zul/src/main/java/org/zkoss/zul/Grid.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 init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private void init() {
                                    _heads = new AbstractCollection<Component>() {
                                        public int size() {
                                            int sz = getChildren().size();
                                            if (_rows != null)
                            Severity: Minor
                            Found in zul/src/main/java/org/zkoss/zul/Grid.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 (cols != null) {
                                                        for (Component column : cols.getChildren()) {
                                                            ((Column) column).setSortDirection("natural");
                                                        }
                                                    }
                            Severity: Major
                            Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (m.getActivePage() >= 0) { //min page index is 0
                                                          pgi.setActivePage(m.getActivePage());
                                                      } else {
                                                          m.setActivePage(pgi.getActivePage());
                                                      }
                              Severity: Major
                              Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if (m.getPageSize() > 0) { //min page size is 1
                                                            pgi.setPageSize(m.getPageSize());
                                                        } else {
                                                            m.setPageSize(pgi.getPageSize());
                                                        }
                                Severity: Major
                                Found in zul/src/main/java/org/zkoss/zul/Grid.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/Grid.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 onPageDetached has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public void onPageDetached(Page page) {
                                          super.onPageDetached(page);
                                          if (_model != null && _dataListener != null)
                                              _model.removeListDataListener(_dataListener);
                                          if (_model instanceof PageableModel && _pgListener != null)
                                  Severity: Minor
                                  Found in zul/src/main/java/org/zkoss/zul/Grid.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 initDataListener has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private void initDataListener() {
                                          if (_dataListener == null)
                                              _dataListener = new ListDataListener() {
                                                  public void onChange(ListDataEvent event) {
                                                      // ZK-1864: share listmodelist cause un-predictable reload
                                  Severity: Minor
                                  Found in zul/src/main/java/org/zkoss/zul/Grid.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 true;
                                  Severity: Major
                                  Found in zul/src/main/java/org/zkoss/zul/Grid.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/Grid.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

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

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

                                            private static boolean doSort(Grid grid) {
                                                Columns cols = grid.getColumns();
                                                if (!grid.isAutosort() || cols == null)
                                                    return false;
                                                for (Iterator it = cols.getChildren().iterator(); it.hasNext();) {
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.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 renderItems has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public void renderItems(Set<? extends Row> rows) {
                                                if (_model == null) { //just in case that application developers might change it
                                                    if (log.isDebugEnabled())
                                                        log.debug("No model no render");
                                                    return;
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.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 getDataLoader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            /*package*/ DataLoader getDataLoader() {
                                                if (_dataLoader == null) {
                                                    _rod = evalRod();
                                                    final String loadercls = Library.getProperty("org.zkoss.zul.grid.DataLoader.class");
                                                    try {
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.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 renderAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public void renderAll() {
                                                if (_model == null)
                                                    return;
                                        
                                                _renderAll = true;
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.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 2 locations. 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: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 2 hrs to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2898..2931

                                        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 182.

                                        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

                                                    if (type == ListDataEvent.STRUCTURE_CHANGED && _model instanceof Sortable && _cols != null) { //ZK-1704 added null check for _cols
                                                        Sortable<Object> smodel = cast(_model);
                                                        List<Column> cols = cast(_cols.getChildren());
                                                        boolean found = false;
                                                        for (Column col : cols) {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 2 other locations - About 2 hrs to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2656..2675
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 1598..1617

                                        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

                                                        if (inPagingMold()) {
                                                            if (_model instanceof PageableModel)
                                                                ((PageableModel) _model).addPagingEventListener((PagingListener) _pgListener);
                                                            //B30-2129667, B36-2782751, (ROD) exception when zul applyProperties
                                                            //must update paginal totalSize or exception in setActivePage
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 2 hrs to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2361..2385

                                        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

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

                                                        if (_model != null) {
                                                            _model.removeListDataListener(_dataListener);
                                                            if (_model instanceof PageableModel && _pgListener != null)
                                                                ((PageableModel) _model).removePagingEventListener((PagingListener) _pgListener);
                                                            GroupsModel groupsModel = getGroupsModel();
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 2 hrs to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2326..2349

                                        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 136.

                                        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

                                            static {
                                                _properties.put("_currentTop", new IntegerPropertyAccess() {
                                                    public void setValue(Component cmp, Integer currentTop) {
                                                        ((Grid) cmp)._currentTop = currentTop;
                                                    }
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 2 hrs to fix
                                        zul/src/main/java/org/zkoss/zul/Rating.java on lines 249..277

                                        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 133.

                                        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 (_rows != null && _model != null && inPagingMold()) {
                                                        //theoretically, _rows shall not be null if _model is not null when
                                                        //this method is called. But, just in case -- if sent manually
                                                        final Paginal pgi = getPaginal();
                                                        int pgsz = pgi.getPageSize();
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 2 hrs to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1332..1349

                                        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 130.

                                        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 onAfterRender() {
                                                if (inPagingMold() && _model instanceof Pageable) {
                                                    Pageable m = (Pageable) _model;
                                                    if (m.getPageSize() > 0) { //min page size is 1
                                                        _pgi.setPageSize(m.getPageSize());
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 4037..4052

                                        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 103.

                                        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 (clone._model != null) {
                                                    if (clone._model instanceof ComponentCloneListener) {
                                                        final ListModel model = (ListModel) ((ComponentCloneListener) clone._model).willClone(clone);
                                                        if (model != null)
                                                            clone._model = model;
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3196..3211

                                        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 102.

                                        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 static boolean doSort(Grid grid) {
                                                Columns cols = grid.getColumns();
                                                if (!grid.isAutosort() || cols == null)
                                                    return false;
                                                for (Iterator it = cols.getChildren().iterator(); it.hasNext();) {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2443..2455

                                        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 102.

                                        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 (getAttribute(ATTR_ON_INIT_RENDER_POSTED) == null) {
                                                            getDataLoader().syncModel(-1, -1); //we have to recreate all
                                                        } else {
                                                            //bug# 3039282, we need to resyncModel if not in a defer mode
                                                            final Execution exec = Executions.getCurrent();
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2491..2501

                                        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 102.

                                        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<Component> _it = getChildren().listIterator();
                                        
                                                public boolean hasNext() {
                                                    while (_it.hasNext()) {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 3061..3086

                                        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

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

                                            /*package*/ DataLoader getDataLoader() {
                                                if (_dataLoader == null) {
                                                    _rod = evalRod();
                                                    final String loadercls = Library.getProperty("org.zkoss.zul.grid.DataLoader.class");
                                                    try {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3046..3059

                                        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 97.

                                        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 onPageDetached(Page page) {
                                                super.onPageDetached(page);
                                                if (_model != null && _dataListener != null)
                                                    _model.removeListDataListener(_dataListener);
                                                if (_model instanceof PageableModel && _pgListener != null)
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3090..3099

                                        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 96.

                                        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 (_rows != null)
                                                            --sz;
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 262..279

                                        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.grid.autoSort";
                                                Object val = getAttribute(attr, true);
                                                if (val == null)
                                                    val = Library.getProperty(attr);
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 2 other locations - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3426..3433
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 2726..2733

                                        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

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

                                                if (_model != null && _model != model) {
                                                    int threshold = Utils.getIntAttribute(this, "org.zkoss.zul.invalidateThreshold", 10, true);
                                                    int diff = Math.abs((model != null ? model.getSize() : 0) - _model.getSize());
                                                    if (diff > threshold)
                                                        invalidate();
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2311..2316

                                        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 80.

                                        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 addPagingListener(Paginal pgi) {
                                                if (_pgListener == null)
                                                    _pgListener = new PGListener();
                                                pgi.addEventListener(ZulEvents.ON_PAGING, _pgListener);
                                                if (_model instanceof PageableModel) {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1359..1370

                                        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 80.

                                        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.grid.preloadSize", sz, true)) < 0)
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 2 other locations - About 1 hr to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3448..3455
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 2154..2161

                                        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

                                            public boolean isVflex() {
                                                final String vflex = getVflex();
                                                if ("true".equals(vflex) || "min".equals(vflex)) {
                                                    return true;
                                                }
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 55 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 630..639

                                        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 67.

                                        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 (!toload.isEmpty()) {
                                                            int bfcnt = cnt / 3;
                                                            for (Iterator<Row> e = toload.iterator(); bfcnt > 0 && e.hasNext(); --bfcnt, --cnt) {
                                                                items.add(e.next());
                                                            }
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 55 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3845..3850

                                        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

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

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

                                        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 setOddRowSclass(String scls) {
                                                if (scls != null && scls.length() == 0)
                                                    scls = null;
                                                if (!Objects.equals(_scOddRow, scls)) {
                                                    _scOddRow = scls;
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.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/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
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 819..826

                                        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

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

                                                    } else if (child instanceof Frozen) {
                                                        _frozen = (Frozen) child;
                                                        if (--cnt == 0)
                                                            break;
                                                    } else if (child instanceof Foot) {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 2 other locations - About 50 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 741..749
                                        zul/src/main/java/org/zkoss/zul/Treeitem.java on lines 619..627

                                        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 5 locations. Consider refactoring.
                                        Open

                                                /*package*/ 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/Grid.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/Listbox.java on lines 2798..2808
                                        zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 712..722
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 2394..2404

                                        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 setVisibleRows(int visibleRows) throws WrongValueException {
                                                checkBeforeSetRows();
                                        
                                                if (visibleRows < 0)
                                                    throw new WrongValueException("Illegal rows: " + visibleRows);
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 40 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 776..786

                                        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 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/Grid.java and 2 other locations - About 40 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1373..1379
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 673..679

                                        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/Grid.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/Iframe.java on lines 71..78
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 598..605
                                        zul/src/main/java/org/zkoss/zul/Tree.java on lines 921..928

                                        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

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

                                                if (_dataLoader != null) {
                                                    s.writeInt(_dataLoader.getOffset());
                                                    s.writeInt(_dataLoader.getLimit());
                                                } else {
                                                    s.writeInt(0);
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 40 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3252..3258

                                        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

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

                                            private void postOnPagingInitRender() {
                                                if (getAttribute(ATTR_ON_PAGING_INIT_RENDERER_POSTED) == null
                                                        && getAttribute(ATTR_ON_INIT_RENDER_POSTED) == null) { // B50-ZK-345
                                                    setAttribute(ATTR_ON_PAGING_INIT_RENDERER_POSTED, Boolean.TRUE);
                                                    Events.postEvent("onPagingInitRender", this, null);
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 35 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2604..2610

                                        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 3 locations. Consider refactoring.
                                        Open

                                            private static Label newRenderLabel(String value) {
                                                final Label label = new Label(value != null && value.length() > 0 ? value : " ");
                                                label.setPre(true); //to make sure &nbsp; is generated, and then occupies some space
                                                return label;
                                            }
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 2 other locations - About 35 mins to fix
                                        zkbind/src/main/java/org/zkoss/bind/impl/BindRowRenderer.java on lines 143..147
                                        zul/src/main/java/org/zkoss/zul/impl/GridDataLoader.java on lines 256..260

                                        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

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

                                            private int initRodSize() {
                                                int sz = Utils.getIntAttribute(this, "org.zkoss.zul.grid.initRodSize", INIT_LIMIT, true);
                                                if ((sz) < 0)
                                                    throw new UiException("nonnegative is required: " + sz);
                                                return sz;
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 35 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3465..3470

                                        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_TOP_PAD)) {
                                        Severity: Major
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 4 other locations - About 35 mins to fix
                                        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
                                        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/Grid.java and 3 other locations - About 35 mins to fix
                                        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
                                        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

                                                try {
                                                    for (final Row row : rows)
                                                        renderer.render(row, row.getIndex());
                                                } catch (Throwable ex) {
                                                    renderer.doCatch(ex);
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 35 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2882..2889

                                        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 (!(_renderer instanceof RowRendererExt)
                                                            || (((RowRendererExt) _renderer).getControls() & RowRendererExt.DETACH_ON_RENDER) != 0) { //detach (default)
                                                        cell.detach();
                                                    }
                                        Severity: Minor
                                        Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 30 mins to fix
                                        zul/src/main/java/org/zkoss/zul/Listbox.java on lines 2744..2748

                                        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 40.

                                        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