this.locale = locale;
}
- protected Locale getLocaleReference() {
- return this.locale;
- }
-
public Locale getLocale() {
- return (Locale)this.getLocaleReference().clone();
+ return this.locale;
}
/* Time zone */
Date y = null;
for (String dateFormat: this.getDateFormatsReference()) {
try {
- y = this.getDateFromStringByParameters(x, dateFormat, this.getLocaleReference(), this.getTimeZoneReference());
+ y = this.getDateFromStringByParameters(x, dateFormat, this.getLocale(), this.getTimeZoneReference());
return y;
}
catch (MFormatConversionException exception) {
}
public String getStringFromDate(Date x) {
- return this.getStringFromDateByParameters(x, this.getDefaultDateFormat(), this.getLocaleReference(), this.getTimeZoneReference());
+ return this.getStringFromDateByParameters(x, this.getDefaultDateFormat(), this.getLocale(), this.getTimeZoneReference());
}
/* Helper methods */
this.locale = locale;
}
- protected Locale getLocaleReference() {
- return this.locale;
- }
-
public Locale getLocale() {
- return (Locale)this.getLocaleReference().clone();
+ return this.locale;
}
/* Conversion */
BigDecimal y = null;
for (String numberFormat: this.getNumberFormatsReference()) {
try {
- y = this.getNumberFromStringByParameters(x, numberFormat, this.getLocaleReference());
+ y = this.getNumberFromStringByParameters(x, numberFormat, this.getLocale());
return y;
}
catch (MFormatConversionException exception) {
}
public String getStringFromNumber(BigDecimal x) {
- return this.getStringFromNumberByParameters(x, this.getDefaultNumberFormat(), this.getLocaleReference());
+ return this.getStringFromNumberByParameters(x, this.getDefaultNumberFormat(), this.getLocale());
}
}
package com.marcozanon.macaco.json;
+import com.marcozanon.macaco.text.MText;
import java.util.LinkedList;
public class MJsonArray extends MJsonValue {
}
public void setValue(int index, MJsonValue x) {
- if ((index < 0) || (index > (this.getValueCount() - 1))) {
+ if ((0 > index) || ((this.getValueCount() - 1) < index)) {
throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
}
if (null == x) {
}
public MJsonValue getValue(int index) {
- if ((index < 0) || (index > (this.getValueCount() - 1))) {
+ if ((0 > index) || ((this.getValueCount() - 1) < index)) {
throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
}
//
}
public void removeValue(int index) {
- if ((index < 0) || (index > (this.getValueCount() - 1))) {
+ if ((0 > index) || ((this.getValueCount() - 1) < index)) {
throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
}
//
throw new IllegalArgumentException("Invalid 'x': null.");
}
//
- if ((x.length() < 2) || ('[' != x.charAt(0))) {
+ if ((2 > x.length()) || ('[' != x.charAt(0))) {
return 0;
}
int position = x.indexOf("]", 1);
- while (position > -1) {
+ while (-1 < position) {
try {
MJsonArray testValue = new MJsonArray();
testValue.parseString(x.substring(0, position + 1));
}
public void parseString(String x) throws MInvalidValueJsonException {
- if (null == x) {
- throw new IllegalArgumentException("Invalid 'x': null.");
+ if (MText.isBlank(x)) {
+ throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
- if ((x.length() < 2) || ('[' != x.charAt(0)) || (']' != x.charAt(x.length() - 1))) {
+ if ((2 > x.length()) || ('[' != x.charAt(0)) || (']' != x.charAt(x.length() - 1))) {
throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: must begin and end with square brackets.", x));
}
String y = x.substring(1, x.length() - 1);
int parsingPosition = 0;
MJsonArray.ParsingMode parsingMode = MJsonArray.ParsingMode.START;
- while ((parsingPosition < y.length()) && (MJsonArray.ParsingMode.ERROR != parsingMode)) {
+ while ((y.length() > parsingPosition) && (MJsonArray.ParsingMode.ERROR != parsingMode)) {
int c = y.codePointAt(parsingPosition);
switch (parsingMode) {
case START:
}
else {
int offset = 0;
- if ((offset = MJsonNull.getTokenLength(y.substring(parsingPosition))) > 0) {
+ if (0 < (offset = MJsonNull.getTokenLength(y.substring(parsingPosition)))) {
this.addValue(new MJsonNull(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonBoolean.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonBoolean.getTokenLength(y.substring(parsingPosition)))) {
this.addValue(new MJsonBoolean(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonNumber.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonNumber.getTokenLength(y.substring(parsingPosition)))) {
this.addValue(new MJsonNumber(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonString.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonString.getTokenLength(y.substring(parsingPosition)))) {
this.addValue(new MJsonString(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonArray.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonArray.getTokenLength(y.substring(parsingPosition)))) {
this.addValue(new MJsonArray(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonObject.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonObject.getTokenLength(y.substring(parsingPosition)))) {
this.addValue(new MJsonObject(y.substring(parsingPosition, parsingPosition + offset)));
}
- if (offset > 0) {
+ if (0 < offset) {
parsingPosition += offset;
parsingMode = MJsonArray.ParsingMode.POST_VALUE;
}
public String getJsonValue() {
StringBuilder s = new StringBuilder("");
s.append("[");
- for (int i = 0; i < this.getValueCount(); i++) {
- if (i > 0) {
+ for (int i = 0; this.getValueCount() > i; i++) {
+ if (0 < i) {
s.append(", ");
}
s.append(this.getValuesReference().get(i).getJsonValue());
this.value = new BigDecimal(x.toString());
}
- protected BigDecimal getValueReference() {
- return this.value;
- }
-
public BigDecimal getValue() {
- return new BigDecimal(this.getValueReference().toString());
+ return this.value;
}
/* Parsers */
int position = 0;
int validPosition = 0;
BigDecimal y = null;
- while (position < x.length()) {
+ while (x.length() > position) {
if (' ' == x.charAt(position)) {
break;
}
/* Formatter */
public String getJsonValue() {
- return this.getValueReference().toString();
+ return this.getValue().toString();
}
}
throw new IllegalArgumentException("Invalid 'x': null.");
}
//
- if ((x.length() < 2) || ('{' != x.charAt(0))) {
+ if ((2 > x.length()) || ('{' != x.charAt(0))) {
return 0;
}
int position = x.indexOf("}", 1);
- while (position > -1) {
+ while (-1 < position) {
try {
MJsonObject testValue = new MJsonObject();
testValue.parseString(x.substring(0, position + 1));
}
public void parseString(String x) throws MInvalidValueJsonException {
- if (null == x) {
- throw new IllegalArgumentException("Invalid 'x': null.");
+ if (MText.isBlank(x)) {
+ throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
- if ((x.length() < 2) || ('{' != x.charAt(0)) || ('}' != x.charAt(x.length() - 1))) {
+ if ((2 > x.length()) || ('{' != x.charAt(0)) || ('}' != x.charAt(x.length() - 1))) {
throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: must begin and end with curly brackets.", x));
}
String y = x.substring(1, x.length() - 1);
int parsingPosition = 0;
MJsonObject.ParsingMode parsingMode = MJsonObject.ParsingMode.START;
String lastKey = "";
- while ((parsingPosition < y.length()) && (MJsonObject.ParsingMode.ERROR != parsingMode)) {
+ while ((y.length() > parsingPosition) && (MJsonObject.ParsingMode.ERROR != parsingMode)) {
int c = y.codePointAt(parsingPosition);
switch (parsingMode) {
case START:
}
else {
int offset = MJsonString.getTokenLength(y.substring(parsingPosition));
- if (offset > 0) {
+ if (0 < offset) {
lastKey = (new MJsonString(y.substring(parsingPosition, parsingPosition + offset))).getValue();
parsingPosition += offset;
parsingMode = MJsonObject.ParsingMode.POST_NAME;
}
else {
int offset = 0;
- if ((offset = MJsonNull.getTokenLength(y.substring(parsingPosition))) > 0) {
+ if (0 < (offset = MJsonNull.getTokenLength(y.substring(parsingPosition)))) {
this.setValue(lastKey, new MJsonNull(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonBoolean.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonBoolean.getTokenLength(y.substring(parsingPosition)))) {
this.setValue(lastKey, new MJsonBoolean(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonNumber.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonNumber.getTokenLength(y.substring(parsingPosition)))) {
this.setValue(lastKey, new MJsonNumber(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonString.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonString.getTokenLength(y.substring(parsingPosition)))) {
this.setValue(lastKey, new MJsonString(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonArray.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonArray.getTokenLength(y.substring(parsingPosition)))) {
this.setValue(lastKey, new MJsonArray(y.substring(parsingPosition, parsingPosition + offset)));
}
- else if ((offset = MJsonObject.getTokenLength(y.substring(parsingPosition))) > 0) {
+ else if (0 < (offset = MJsonObject.getTokenLength(y.substring(parsingPosition)))) {
this.setValue(lastKey, new MJsonObject(y.substring(parsingPosition, parsingPosition + offset)));
}
- if (offset > 0) {
+ if (0 < offset) {
lastKey = "";
parsingPosition += offset;
parsingMode = MJsonObject.ParsingMode.POST_VALUE;
s.append("{");
int k = 0;
for (String key: this.getValuesReference().keySet()) {
- if (k > 0) {
+ if (0 < k) {
s.append(", ");
}
s.append("\"" + MJsonString.getEscapedString(key, false) + "\"");
}
//
StringBuilder y = new StringBuilder();
- for (int i = 0; i < x.length(); i++) {
+ for (int i = 0; x.length() > i; i++) {
int c = x.codePointAt(i);
if (extendedEscapeMode) {
- if (c <= 0x00001F) { // control Ascii character (0x000000-0x00001F)
+ if (0x00001F >= c) { // control Ascii character (0x000000-0x00001F)
y.append("\\u" + String.format("%4H", c).replace(" ", "0"));
}
- else if (c <= 0x00007F) { // non-control Ascii character (0x000020-0x00007F)
+ else if (0x00007F >= c) { // non-control Ascii character (0x000020-0x00007F)
if ('"' == c) {
y.append("\\\"");
}
y.appendCodePoint(c);
}
}
- else if (c <= 0x00FFFF) { // non-Ascii Bmp character (0x000080-0x00FFFF)
+ else if (0x00FFFF >= c) { // non-Ascii Bmp character (0x000080-0x00FFFF)
y.append("\\u" + String.format("%4H", c).replace(" ", "0"));
}
else { // non-Bmp character (0x010000-0x10FFFF)
else if ('\t' == c) {
y.append("\\t");
}
- else if (c <= 0x00001F) { // non-special control Ascii character (0x000000-0x00001F)
+ else if (0x00001F >= c) { // non-special control Ascii character (0x000000-0x00001F)
y.append("\\u" + String.format("%4H", c).replace(" ", "0"));
}
else {
y.appendCodePoint(c);
- if (c >= 0x010000) {
+ if (0x010000 <= c) {
i++;
}
}
}
//
StringBuilder y = new StringBuilder();
- for (int i = 0; i < x.length(); i++) {
+ for (int i = 0; x.length() > i; i++) {
if (x.indexOf("\\\"", i) == i) {
y.append("\"");
i++;
try {
ch = Integer.parseInt(x.substring(i + 2, i + 2 + 4), 16);
i += 5;
- if ((ch >= 0xD800) && (ch <= 0xDBFF)) {
+ if ((0xD800 <= ch) && (0xDBFF >= ch)) {
i++;
if (x.indexOf("\\u", i) != i) {
throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
try {
cl = Integer.parseInt(x.substring(i + 2, i + 2 + 4), 16);
i += 5;
- if ((cl <= 0xDC00) || (cl >= 0xDFFF)) {
+ if ((0xDC00 >= cl) || (0xDFFF <= cl)) {
throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
}
- int c = ((ch -0xD800) << 10) + (cl - 0xDC00) + 0x010000;
+ int c = ((ch - 0xD800) << 10) + (cl - 0xDC00) + 0x010000;
y.appendCodePoint(c);
}
catch (NumberFormatException exception) {
}
else {
int c = x.codePointAt(i);
- if (c >= 0x010000) {
+ if (0x010000 <= c) {
i++;
}
y.appendCodePoint(c);
throw new IllegalArgumentException("Invalid 'x': null.");
}
//
- if ((x.length() < 2) || ('"' != x.charAt(0))) {
+ if ((2 > x.length()) || ('"' != x.charAt(0))) {
return 0;
}
if ('"' == x.charAt(1)) {
}
String y = x.substring(1);
int quotationMarkPosition = 0;
- while ((quotationMarkPosition = y.indexOf("\"", quotationMarkPosition + 1)) > -1) {
+ while (-1 < (quotationMarkPosition = y.indexOf("\"", quotationMarkPosition + 1))) {
int c = 0;
StringBuilder s = new StringBuilder("");
while ((c <= quotationMarkPosition) && (y.substring(quotationMarkPosition - c, quotationMarkPosition).equals(s.toString()))) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
- if ((x.length() < 2) || ('"' != x.charAt(0)) || ('"' != x.charAt(x.length() - 1))) {
+ if ((2 > x.length()) || ('"' != x.charAt(0)) || ('"' != x.charAt(x.length() - 1))) {
throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
}
String y = x.substring(1, x.length() - 1);
- if (y.replaceAll("\\\\\"", "__").indexOf("\"") > -1) {
+ if (-1 < y.replaceAll("\\\\\"", "__").indexOf("\"")) {
throw new MInvalidValueJsonException(String.format("Invalid 'x': %s: not a Json string.", x));
}
this.setValue(MJsonString.getUnescapedString(y));
/* File */
- public String getFile() {
+ protected String getFile() {
return this.file;
}
try {
// prepare the statement
preparedStatement = this.getConnectionReference().prepareStatement(statement, PreparedStatement.RETURN_GENERATED_KEYS);
- for (int p = 0; p < parameters.size(); p++) {
+ for (int p = 0; parameters.size() > p; p++) {
preparedStatement.setObject(p + 1, parameters.get(p));
}
// execute the statement and parse the results
while (this.getResultSetReference().next()) {
ResultSetMetaData resultSetMetaData = this.getResultSetReference().getMetaData();
LinkedHashMap<String, Object> record = new LinkedHashMap<String, Object>();
- for (int f = 0; f < resultSetMetaData.getColumnCount(); f++) {
+ for (int f = 0; resultSetMetaData.getColumnCount() > f; f++) {
String field = resultSetMetaData.getColumnLabel(f + 1);
record.put(field, this.getResultSetReference().getObject(field));
}
/* Utility methods */
public static String repeat(String x, int times) {
- if (times < 1) {
+ if (1 > times) {
throw new IllegalArgumentException(String.format("Invalid 'times': %s.", times));
}
//
if ("script".equalsIgnoreCase(tagName)) {
throw new SAXException(String.format("Tag not allowed: %s.", tagName));
}
- for (int a = 0; a < attributes.getLength(); a++) {
+ for (int a = 0; attributes.getLength() > a; a++) {
if (attributes.getLocalName(a).toLowerCase().startsWith("on")) {
throw new SAXException(String.format("Attribute not allowed: %s.", attributes.getLocalName(a)));
}
}
catch (UnsupportedEncodingException exception) { // cannot happen
}
- catch (IOException exception) { // cannot happen, put here not to bypass UnsupportedEncodingException
+ catch (IOException exception) { // cannot happen; put here not to bypass UnsupportedEncodingException
}
// also convert named entities to numeric entities
return MText.getXhtmlNumericEntitiesString(text);
/* File */
- public String getFile() {
+ protected String getFile() {
return this.file;
}
/* Locale */
- public Locale getBasicLocale() {
+ protected Locale getBasicLocale() {
return this.basicLocale;
}
byte[] responseContent = null;
if (ajaxMode) {
try {
- MJsonObject returnValue = null;
- returnValue = new MJsonObject();
+ MJsonObject returnValue = new MJsonObject();
returnValue.setValue("errorMode", new MJsonNumber("" + MWebApplicationServlet.ErrorMode.CLEAN.ordinal()));
MJsonString jsonParameter = new MJsonString();
jsonParameter.setValue(new String(content, MInformation.TEXT_ENCODING));
if (MWebApplicationServlet.ErrorMode.DEBUG == errorMode) {
if (ajaxMode) {
try {
- MJsonObject returnValue = null;
- returnValue = new MJsonObject();
+ MJsonObject returnValue = new MJsonObject();
returnValue.setValue("errorMode", new MJsonNumber("" + errorMode.ordinal()));
MJsonString jsonParameter = new MJsonString();
if (null != content.getMessage()) {
StringBuilder content = new StringBuilder("");
content.append(String.format("<span class=\"MWebBreadcrumbPrefix %s\">%s</span>", customClasses, MText.getXhtmlEscapedString(this.getPrefix())));
LinkedList<String> viewBreadcrumbs = this.getViewReference().getBrowserPageReference().getViewBreadcrumbs();
- for (int t = 0; t < viewBreadcrumbs.size(); t++) {
+ for (int t = 0; viewBreadcrumbs.size() > t; t++) {
content.append(" ");
- if (t > 0) {
+ if (0 < t) {
content.append("» ");
}
- if (t < (viewBreadcrumbs.size() - 1)) {
+ if ((viewBreadcrumbs.size() - 1) > t) {
String onItemSelectionFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onItemSelection', {'viewCount': '%s'});", this.getId(), viewBreadcrumbs.size() - 1 - t);
content.append(String.format("<span class=\"MWebBreadcrumbItem %s\" onclick=\"%s\">%s</span>", customClasses, onItemSelectionFunction, MText.getXhtmlEscapedString(viewBreadcrumbs.get(t))));
}
import java.util.Date;
import java.util.LinkedList;
import java.util.Random;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
public abstract class MWebBrowserPage extends MObject {
}
protected void setStoppingViewThreadCount(int stoppingViewThreadCount) {
- if (stoppingViewThreadCount < 0) {
+ if (0 > stoppingViewThreadCount) {
throw new IllegalArgumentException(String.format("Invalid 'stoppingViewThreadCount': %s.", stoppingViewThreadCount));
}
//
}
protected void unloadViewThreads(Object lastViewThreadReturnValue, int viewThreadCount, MWebView replacingView) throws MViewNotUnloadableWebException {
- if ((null == lastViewThreadReturnValue) && (viewThreadCount < 1) && (null == replacingView)) {
+ if ((null == lastViewThreadReturnValue) && (1 > viewThreadCount) && (null == replacingView)) {
throw new IllegalArgumentException("Invalid call mode: (null, < 1, null).");
}
- if (viewThreadCount < 1) {
+ if (1 > viewThreadCount) {
throw new IllegalArgumentException(String.format("Invalid 'viewThreadCount': %s.", viewThreadCount));
}
else if ((this.getViewThreadCount() <= viewThreadCount) && (null == replacingView)) {
if (null == color) {
throw new IllegalArgumentException("Invalid 'color': null.");
}
- else if ((color.intValue() < 0) || (color.intValue() > 0xFFFFFF)) {
+ else if ((0 > color.intValue()) || (0xFFFFFF < color.intValue())) {
throw new IllegalArgumentException(String.format("Invalid 'color': %s.", color));
}
//
package com.marcozanon.macaco.web.ui;
import com.marcozanon.macaco.text.MText;
-import java.util.LinkedHashMap;
public class MWebExtendedTextBox extends MWebTextBox {
//
this.setWidth(new MWebMeasure(100, MWebMeasure.Unit.PERCENT)); // manual override
//
- if (rowCount < 1) {
+ if (1 > rowCount) {
throw new IllegalArgumentException(String.format("Invalid 'rowCount': %s.", rowCount));
}
- if (columnCount < 1) {
+ if (1 > columnCount) {
throw new IllegalArgumentException(String.format("Invalid 'columnCount': %s.", columnCount));
}
//
}
public MWebGridLayoutCell getCellReference(int rowIndex, int columnIndex) {
- if ((rowIndex < 0) || (rowIndex > (this.getCellsReference().length - 1))) {
+ if ((0 > rowIndex) || ((this.getCellsReference().length - 1) < rowIndex)) {
throw new IllegalArgumentException(String.format("Invalid 'rowIndex': %s.", rowIndex));
}
- if ((columnIndex < 0) || (columnIndex > (this.getCellsReference()[0].length - 1))) {
+ if ((0 > columnIndex) || ((this.getCellsReference()[0].length - 1) < columnIndex)) {
throw new IllegalArgumentException(String.format("Invalid 'columnIndex': %s.", columnIndex));
}
//
protected void setView(MWebView view) throws MUniqueWidgetIdNotAvailableWebException {
super.setView(view);
//
- for (int r = 0; r < this.getRowCount(); r++) {
- for (int c = 0; c < this.getColumnCount(); c++) {
+ for (int r = 0; this.getRowCount() > r; r++) {
+ for (int c = 0; this.getColumnCount() > c; c++) {
this.getCellReference(r, c).setView(view);
}
}
return super.getDisplayWidgetReferenceById(id);
}
catch (MDisplayWidgetNotFoundWebException exception) {
- for (int r = 0; r < this.getRowCount(); r++) {
- for (int c = 0; c < this.getColumnCount(); c++) {
+ for (int r = 0; this.getRowCount() > r; r++) {
+ for (int c = 0; this.getColumnCount() > c; c++) {
try {
return this.getCellReference(r, c).getDisplayWidgetReferenceById(id);
}
/* Refresh */
protected boolean isCellRefreshable(int rowIndex, int columnIndex) {
- if ((rowIndex < 0) || (rowIndex > (this.getCellsReference().length - 1))) {
+ if ((0 > rowIndex) || ((this.getCellsReference().length - 1) < rowIndex)) {
throw new IllegalArgumentException(String.format("Invalid 'rowIndex': %s.", rowIndex));
}
- if ((columnIndex < 0) || (columnIndex > (this.getCellsReference()[0].length - 1))) {
+ if ((0 > columnIndex) || ((this.getCellsReference()[0].length - 1) < columnIndex)) {
throw new IllegalArgumentException(String.format("Invalid 'columnIndex': %s.", columnIndex));
}
//
cellsRefreshableMode[r][c] = 1;
int rs = this.getCellReference(r, c).getRowSpan();
int cs = this.getCellReference(r, c).getColumnSpan();
- if ((rs > 1) || (cs > 1)) {
- for (int rsi = r + 1; rsi <= Math.min(rowIndex, r + rs - 1); rsi++) {
- for (int csi = c + 1; csi <= Math.min(columnIndex, c + cs - 1); csi++) {
+ if ((1 < rs) || (1 < cs)) {
+ for (int rsi = r + 1; Math.min(rowIndex, r + rs - 1) >= rsi; rsi++) {
+ for (int csi = c + 1; Math.min(columnIndex, c + cs - 1) >= csi; csi++) {
cellsRefreshableMode[rsi][csi] = -1;
}
}
}
StringBuilder content = new StringBuilder("");
content.append(String.format("<table class=\"MWebGridLayoutTable %s\" style=\"display: inline-table;\" id=\"%s\">", customClasses, this.getId()));
- for (int r = 0; r < this.getRowCount(); r++) {
+ for (int r = 0; this.getRowCount() > r; r++) {
content.append(String.format("<tr class=\"MWebGridLayoutRow %s\">", customClasses));
- for (int c = 0; c < this.getColumnCount(); c++) {
+ for (int c = 0; this.getColumnCount() > c; c++) {
String displayedMode = "";
if (!this.isCellRefreshable(r, c)) {
displayedMode = "display: none;";
content.append("</table>");
this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content.toString())));
//
- for (int r = 0; r < this.getRowCount(); r++) {
- for (int c = 0; c < this.getColumnCount(); c++) {
+ for (int r = 0; this.getRowCount() > r; r++) {
+ for (int c = 0; this.getColumnCount() > c; c++) {
this.getCellReference(r, c).onRefresh();
}
}
/* Span */
public void setRowSpan(int rowSpan) {
- if (rowSpan < 1) {
+ if (1 > rowSpan) {
throw new IllegalArgumentException("Invalid 'rowSpan': must be > 1.");
}
//
}
public void setColumnSpan(int columnSpan) {
- if (columnSpan < 1) {
+ if (1 > columnSpan) {
throw new IllegalArgumentException("Invalid 'columnSpan': must be > 1.");
}
//
}
protected void setRowsPerPage(int rowsPerPage, boolean refreshMode) {
- if (rowsPerPage < 1) {
+ if (1 > rowsPerPage) {
throw new IllegalArgumentException(String.format("Invalid 'rowsPerPage': %s: must be positive.", rowsPerPage));
}
//
this.selectedPage = 1;
return;
}
- else if ((null != selectedPage) && ((selectedPage.intValue() < 1) || (selectedPage.intValue() > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
+ else if ((null != selectedPage) && ((1 > selectedPage.intValue()) || (selectedPage.intValue() > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
throw new IllegalArgumentException(String.format("Invalid 'selectedPage': %s: out of range.", selectedPage));
}
//
return super.getDisplayWidgetReferenceById(id);
}
catch (MDisplayWidgetNotFoundWebException exception) {
- for (MWebTableCell columnHeadersCell: this.getColumnHeadersReference().values()) {
+ for (MWebTableCell columnHeaderCell: this.getColumnHeadersReference().values()) {
try {
- return columnHeadersCell.getDisplayWidgetReferenceById(id);
+ return columnHeaderCell.getDisplayWidgetReferenceById(id);
}
catch (MDisplayWidgetNotFoundWebException exception2) {
}
content.append(String.format("<option value=\"\" %s>*</option>", selectedMode));
int rowCount = this.getRowCount();
int rowsPerPage = this.getRowsPerPage();
- if (rowCount > 0) {
+ if (0 < rowCount) {
int p = 0;
int firstRow = 0;
int lastRow = 0;
- for (p = 1; p <= (int)Math.ceil((float)rowCount / (float)rowsPerPage); p++) {
+ for (p = 1; (int)Math.ceil((float)rowCount / (float)rowsPerPage) >= p; p++) {
firstRow = (p - 1) * rowsPerPage;
lastRow = Math.min((p * rowsPerPage) - 1, rowCount - 1);
if ((null != selectedPage) && (selectedPage.intValue() == p)) {
if (null == selectedPage) {
throw new MUnexpectedMessageWebException("Invalid message: selected page parameter not available.");
}
- else if ((!MText.isEmpty(selectedPage)) && ((Integer.parseInt(selectedPage) < 1) || (Integer.parseInt(selectedPage) > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
+ else if ((!MText.isEmpty(selectedPage)) && ((1 > Integer.parseInt(selectedPage)) || (Integer.parseInt(selectedPage) > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected page parameter out of range.", selectedPage));
}
this.onPageSelection(selectedPage);
catch (MViewThreadStoppingWebRuntimeException exception) {
break;
}
- catch (Exception exception) { // any other exception, put here not to bypass MViewThreadStoppingWebRuntimeException
+ catch (Exception exception) { // any other exception; put here not to bypass MViewThreadStoppingWebRuntimeException
try {
this.getBrowserPageReference().setLastViewThreadException(exception);
}
}
public void setDownloader(int index, MWebDownloader downloader) throws MUniqueWidgetIdNotAvailableWebException {
- if ((index < 0) || (index > (this.getDownloadersReference().size() - 1))) {
+ if ((0 > index) || ((this.getDownloadersReference().size() - 1) < index)) {
throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
}
if (null == downloader) {
}
public MWebDownloader getDownloaderReference(int index) {
- if ((index < 0) || (index > (this.getDownloadersReference().size() - 1))) {
+ if ((0 > index) || ((this.getDownloadersReference().size() - 1) < index)) {
throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
}
//
}
public void removeDownloader(int index) {
- if ((index < 0) || (index > (this.getDownloadersReference().size() - 1))) {
+ if ((0 > index) || ((this.getDownloadersReference().size() - 1) < index)) {
throw new IllegalArgumentException(String.format("Invalid 'index': %s: out of range.", index));
}
//
border: 1px solid #8a8a8a;
}
-/* Datetime box */
-
-.MWebDatetimeBox {
- color: #444444;
- background-color: #ffffff;
- border: 1px solid #444444;
-}
-.MWebDatetimeBox[disabled] {
- color: #8a8a8a;
- background-color: #cccccc;
- border: 1px solid #8a8a8a;
-}
-
/* Extended text box */
.MWebExtendedTextBox {
border: 1px solid #444444;
}
-/* Time box */
-
-.MWebTimeBox {
- color: #444444;
- background-color: #ffffff;
- border: 1px solid #444444;
-}
-.MWebTimeBox[disabled] {
- color: #8a8a8a;
- background-color: #cccccc;
- border: 1px solid #8a8a8a;
-}
-
/* Uploader */
.MWebUploader {
var n = 0;
for (p in x) {
n++;
- if (n > 1) {
+ if (1 < n) {
string += ', ';
}
string += this.encode(x[p]);
var n = 0;
for (var p in x) {
n++;
- if (n > 1) {
+ if (1 < n) {
string += ', ';
}
string += this.encodeString(p) + ': ' + this.encode(x[p]);
else if ('\t' == x[c]) {
string += '\\t';
}
- else if (x[c] <= 0x001F) { // non-special control Ascii character
+ else if (0x001F >= x[c]) { // non-special control Ascii character
var s = x.charCodeAt(c).toString(16).toUpperCase();
- while (s.length < 4) {
+ while (4 > s.length) {
s = '0' + s;
}
string += '\\u' + s;
}
var i = $('m_notificationArea');
if (null != i) {
- if (i.style.opacity < 0.1) {
+ if (0.1 > i.style.opacity) {
clearInterval(this.interval);
this.interval = null;
i.style.display = 'none';