From 9b7f4c47fe016da44f404933a9be746c034665d8 Mon Sep 17 00:00:00 2001 From: Marco Zanon Date: Sun, 24 Jun 2012 16:30:11 +0000 Subject: [PATCH] Made Integer/Long comparisons happen through intValue()/longValue() methods. --- .../com/marcozanon/macaco/attic/web/ui/MWebColor.java | 2 +- .../com/marcozanon/macaco/attic/web/ui/MWebTable.java | 10 +++++----- .../marcozanon/macaco/attic/web/ui/MWebTextBox.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/java/com/marcozanon/macaco/attic/web/ui/MWebColor.java b/src/java/com/marcozanon/macaco/attic/web/ui/MWebColor.java index aa886ff..546d976 100644 --- a/src/java/com/marcozanon/macaco/attic/web/ui/MWebColor.java +++ b/src/java/com/marcozanon/macaco/attic/web/ui/MWebColor.java @@ -20,7 +20,7 @@ public class MWebColor extends MObject { if (null == color) { throw new IllegalArgumentException("Invalid 'color': null."); } - else if ((color < 0) || (color > 0xFFFFFF)) { + else if ((color.intValue() < 0) || (color.intValue() > 0xFFFFFF)) { throw new IllegalArgumentException(String.format("Invalid 'color': %s.", color)); } // diff --git a/src/java/com/marcozanon/macaco/attic/web/ui/MWebTable.java b/src/java/com/marcozanon/macaco/attic/web/ui/MWebTable.java index 2332d94..25b9f4f 100644 --- a/src/java/com/marcozanon/macaco/attic/web/ui/MWebTable.java +++ b/src/java/com/marcozanon/macaco/attic/web/ui/MWebTable.java @@ -173,7 +173,7 @@ public abstract class MWebTable extends MWebDirectWidget { this.selectedPage = 1; return; } - else if ((null != selectedPage) && ((selectedPage < 1) || (selectedPage > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) { + else if ((null != selectedPage) && ((selectedPage.intValue() < 1) || (selectedPage.intValue() > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) { throw new IllegalArgumentException(String.format("Invalid 'selectedPage': %s: out of range.", selectedPage)); } // @@ -210,10 +210,10 @@ public abstract class MWebTable extends MWebDirectWidget { else if (0 == this.getRowCount()) { this.setSelectedPage(null); } - else if (selectedPage < 1) { + else if (selectedPage.intValue() < 1) { this.setSelectedPage(1); } - else if (selectedPage > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())) { + else if (selectedPage.intValue() > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())) { this.setSelectedPage((int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())); } } @@ -248,8 +248,8 @@ public abstract class MWebTable extends MWebDirectWidget { int lastRow = this.getRowCount() - 1; Integer selectedPage = this.getSelectedPage(); if (null != selectedPage) { - firstRow = (selectedPage - 1) * this.getRowsPerPage(); - lastRow = Math.min((selectedPage * this.getRowsPerPage()) - 1, lastRow); + firstRow = (selectedPage.intValue() - 1) * this.getRowsPerPage(); + lastRow = Math.min((selectedPage.intValue() * this.getRowsPerPage()) - 1, lastRow); } LinkedList> tmpRowSubset = new LinkedList>(); for (int r = firstRow; r < (lastRow + 1); r++) { diff --git a/src/java/com/marcozanon/macaco/attic/web/ui/MWebTextBox.java b/src/java/com/marcozanon/macaco/attic/web/ui/MWebTextBox.java index 339cb03..eb18d1c 100644 --- a/src/java/com/marcozanon/macaco/attic/web/ui/MWebTextBox.java +++ b/src/java/com/marcozanon/macaco/attic/web/ui/MWebTextBox.java @@ -126,7 +126,7 @@ public abstract class MWebTextBox extends MWebDirectWidget { } protected void setMaximumLength(Integer maximumLength, boolean refreshMode) { - if ((null != maximumLength) && (0 > maximumLength)) { + if ((null != maximumLength) && (0 > maximumLength.intValue())) { throw new IllegalArgumentException("Invalid 'maximumLength': negative number."); } // -- 2.30.2