Browse Source

Simplify boolean expressions

tags/8.2.0.alpha2
Ahmed Ashour 6 years ago
parent
commit
03349e8c66

+ 1
- 1
client/src/main/java/com/vaadin/client/DateTimeService.java View File



public static int getNumberOfDaysInMonth(Date date) { public static int getNumberOfDaysInMonth(Date date) {
final int month = date.getMonth(); final int month = date.getMonth();
if (month == 1 && true == isLeapYear(date)) {
if (month == 1 && isLeapYear(date)) {
return 29; return 29;
} }
return maxDaysInMonth[month]; return maxDaysInMonth[month];

+ 1
- 1
client/src/main/java/com/vaadin/client/VTooltip.java View File

Element element = Element.as(event.getEventTarget()); Element element = Element.as(event.getEventTarget());


// We can ignore move event if it's handled by move or over already // We can ignore move event if it's handled by move or over already
if (currentElement == element && handledByFocus == true) {
if (currentElement == element && handledByFocus) {
return; return;
} }



+ 1
- 1
client/src/main/java/com/vaadin/client/ui/dd/VOr.java View File

for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
VAcceptCriterion crit = VAnd.getCriteria(drag, configuration, i); VAcceptCriterion crit = VAnd.getCriteria(drag, configuration, i);
crit.accept(drag, configuration.getChildUIDL(i), this); crit.accept(drag, configuration.getChildUIDL(i), this);
if (accepted == true) {
if (accepted) {
callback.accepted(drag); callback.accepted(drag);
return; return;
} }

+ 2
- 2
client/src/main/java/com/vaadin/client/widgets/Grid.java View File

* if the editor handler is not set * if the editor handler is not set
*/ */
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
if (enabled == false && state != State.INACTIVE) {
if (!enabled && state != State.INACTIVE) {
throw new IllegalStateException( throw new IllegalStateException(
"Cannot disable: editor is in edit mode"); "Cannot disable: editor is in edit mode");
} else if (enabled == true && getHandler() == null) {
} else if (enabled && getHandler() == null) {
throw new IllegalStateException( throw new IllegalStateException(
"Cannot enable: EditorHandler not set"); "Cannot enable: EditorHandler not set");
} }

+ 2
- 2
compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java View File

* if the editor handler is not set * if the editor handler is not set
*/ */
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
if (enabled == false && state != State.INACTIVE) {
if (!enabled && state != State.INACTIVE) {
throw new IllegalStateException( throw new IllegalStateException(
"Cannot disable: editor is in edit mode"); "Cannot disable: editor is in edit mode");
} else if (enabled == true && getHandler() == null) {
} else if (enabled && getHandler() == null) {
throw new IllegalStateException( throw new IllegalStateException(
"Cannot enable: EditorHandler not set"); "Cannot enable: EditorHandler not set");
} }

+ 5
- 5
compatibility-server/src/main/java/com/vaadin/v7/data/util/MethodProperty.java View File

} }
if (j == c.length) { if (j == c.length) {


// all paramteters matched
if (found == true) {
// all parameters matched
if (found) {
throw new MethodException(this, throw new MethodException(this,
"Could not uniquely identify " + getMethodName "Could not uniquely identify " + getMethodName
+ "-method"); + "-method");
} }
} }
} }
if (found != true) {
if (!found) {
throw new MethodException(this, throw new MethodException(this,
"Could not find " + getMethodName + "-method"); "Could not find " + getMethodName + "-method");
} }
if (j == c.length) { if (j == c.length) {


// all parameters match // all parameters match
if (found == true) {
if (found) {
throw new MethodException(this, throw new MethodException(this,
"Could not identify unique " + setMethodName "Could not identify unique " + setMethodName
+ "-method"); + "-method");
} }
} }
} }
if (found != true) {
if (!found) {
throw new MethodException(this, throw new MethodException(this,
"Could not identify " + setMethodName + "-method"); "Could not identify " + setMethodName + "-method");
} }

+ 2
- 2
compatibility-server/src/main/java/com/vaadin/v7/ui/NativeSelect.java View File

@Override @Override
public void setMultiSelect(boolean multiSelect) public void setMultiSelect(boolean multiSelect)
throws UnsupportedOperationException { throws UnsupportedOperationException {
if (multiSelect == true) {
if (multiSelect) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"Multiselect not supported"); "Multiselect not supported");
} }
@Override @Override
public void setNewItemsAllowed(boolean allowNewOptions) public void setNewItemsAllowed(boolean allowNewOptions)
throws UnsupportedOperationException { throws UnsupportedOperationException {
if (allowNewOptions == true) {
if (allowNewOptions) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"newItemsAllowed not supported"); "newItemsAllowed not supported");
} }

+ 1
- 1
server/src/main/java/com/vaadin/server/JsonPaintTarget.java View File



@Override @Override
public String getJsonPresentation() { public String getJsonPresentation() {
return "\"" + name + "\":" + (value == true ? "true" : "false");
return "\"" + name + "\":" + (value ? "true" : "false");
} }


} }

Loading…
Cancel
Save