Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,10 @@ public void showPopupDialog(Component c) {
* This is ignored if there isn't enough space
*/
public void showPopupDialog(Component c, boolean bias) {
Form f = c == null ? null : c.getComponentForm(); // PMD Fix: BrokenNullCheck
if (c == null) {
throw new IllegalArgumentException("Component cannot be null");
}
Form f = c.getComponentForm(); // PMD Fix: BrokenNullCheck
if (f != null && !formMode && !f.getContentPane().contains(c)) {
setFormMode(true);
}
Expand Down Expand Up @@ -664,6 +667,9 @@ public void showPopupDialog(Rectangle rect) {
* This is ignored if there isn't enough space
*/
public void showPopupDialog(Rectangle rect, boolean bias) {
if (rect == null) {
throw new IllegalArgumentException("rect cannot be null");
}
Form f = Display.getInstance().getCurrent();
Rectangle origRect = rect;
rect = new Rectangle(rect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5812,7 +5812,7 @@ public void captureAudio(final MediaRecorderBuilder recordingOptions, final com.
if (!builder.isRedirectToAudioBuffer() && builder.getMimeType() == null) {
builder.mimeType("audio/wav");
}
System.out.println("in captureAudio " + recordingOptions.isRedirectToAudioBuffer());
System.out.println("in captureAudio " + builder.isRedirectToAudioBuffer());
final AudioRecorderComponent cmp = new AudioRecorderComponent(builder);
final Sheet sheet = new Sheet(null, "Record Audio");
sheet.getContentPane().setLayout(new com.codename1.ui.layouts.BorderLayout());
Expand Down Expand Up @@ -5997,8 +5997,10 @@ public void run() {
Log.e(ex);
}
}
Image im = Image.createImage(data, 0, data.length);
b.setIcon(im);
if (data != null) {
Image im = Image.createImage(data, 0, data.length);
b.setIcon(im);
}
}
});

Expand Down
6 changes: 3 additions & 3 deletions CodenameOne/src/com/codename1/l10n/SimpleDateFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ String readMonth(String source, int ofs, String token, boolean adjacent) {
*/
int parseMonth(String month, int offset) throws ParseException {
if (month == null) {
throwInvalid("month", offset);
return throwInvalid("month", offset);
}
if (month.length() < 3) {
return (parseNumber(month, offset, "month", 1, 12) - 1) + Calendar.JANUARY;
Expand Down Expand Up @@ -1066,7 +1066,7 @@ String readTimeZone(String source, int ofs) {
*/
int parseTimeZone(String source, int ofs, TimeZoneResult res) throws ParseException {
if (source == null) {
throwInvalid("timezone", ofs);
return throwInvalid("timezone", ofs);
}
char tzSign = source.charAt(0);
if (tzSign == 'z' || tzSign == 'Z') {
Expand All @@ -1076,7 +1076,7 @@ int parseTimeZone(String source, int ofs, TimeZoneResult res) throws ParseExcept
if (tzSign == SIGN_NEGATIVE || tzSign == SIGN_POSITIVE) {
source = readSubstring(source, 1);
if (source == null) {
throwInvalid("timezone", ofs);
return throwInvalid("timezone", ofs);
}
// set the index to point to divider between hours
// and minutes. Hour can be one or two digits, minutes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ public List getChildren(String name) {
}
node = tmp;
}
if (node == null) {
if (oldList) {
return new java.util.Vector();
} else {
return new ArrayList();
}
}
node = ((Map) node).get(name);
if (node == null) {
if (oldList) {
Expand Down
24 changes: 14 additions & 10 deletions CodenameOne/src/com/codename1/ui/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -1430,20 +1430,22 @@ public Container getLayeredPane(Class c, boolean top) {
// is in progress.... We could end up adding a whole bunch of layered panes
// by accident
for (Component cmp : layeredPaneImpl.getChildrenAsList(true)) {
if (cmp.getClientProperty("cn1$_cls") == null) {
if (cmp != null && cmp.getClientProperty("cn1$_cls") == null) {
return (Container) cmp;
}
}
}
String n = c.getName();
String n = c != null ? c.getName() : null;
// NOTE: We need to use getChildrenAsList(true) rather than simply iterating
// over layeredPaneImpl because the latter won't find components while an animation
// is in progress.... We could end up adding a whole bunch of layered panes
// by accident
java.util.List<Component> children = layeredPaneImpl.getChildrenAsList(true);
for (Component cmp : children) {
if (n.equals(cmp.getClientProperty("cn1$_cls"))) {
return (Container) cmp;
if (n != null) {
for (Component cmp : children) {
if (cmp != null && n.equals(cmp.getClientProperty("cn1$_cls"))) {
return (Container) cmp;
}
}
}

Expand Down Expand Up @@ -1491,20 +1493,22 @@ public Container getLayeredPane(Class c, int zIndex) {
// is in progress.... We could end up adding a whole bunch of layered panes
// by accident
for (Component cmp : layeredPaneImpl.getChildrenAsList(true)) {
if (cmp.getClientProperty("cn1$_cls") == null) {
if (cmp != null && cmp.getClientProperty("cn1$_cls") == null) {
return (Container) cmp;
}
}
}
String n = c.getName();
String n = c != null ? c.getName() : null;
// NOTE: We need to use getChildrenAsList(true) rather than simply iterating
// over layeredPaneImpl because the latter won't find components while an animation
// is in progress.... We could end up adding a whole bunch of layered panes
// by accident
java.util.List<Component> children = layeredPaneImpl.getChildrenAsList(true);
for (Component cmp : children) {
if (n.equals(cmp.getClientProperty("cn1$_cls"))) {
return (Container) cmp;
if (n != null) {
for (Component cmp : children) {
if (cmp != null && n.equals(cmp.getClientProperty("cn1$_cls"))) {
return (Container) cmp;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,9 @@ public Transition copy(boolean reverse) {
case TYPE_PULSATE_DIALOG:
retVal = createDialogPulsate();
break;
default:
retVal = CommonTransitions.createEmpty();
break;
}
retVal.linearMotion = linearMotion;
return retVal;
Expand Down
20 changes: 14 additions & 6 deletions CodenameOne/src/com/codename1/ui/plaf/DefaultLookAndFeel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1612,17 +1612,25 @@ private void drawComponent(Graphics g, Label l, Image icon, Image stateIcon, int
g.fillShape(path);
if (bgColor != strokeColor) {
g.setColor(strokeColor);
int alpha2 = g.concatenateAlpha(badgeStyle.getFgAlpha());
g.drawShape(path, new Stroke(1, Stroke.CAP_SQUARE, Stroke.JOIN_MITER, 1f));
g.setAlpha(alpha2);
if (badgeStyle != null) {
int alpha2 = g.concatenateAlpha(badgeStyle.getFgAlpha());
g.drawShape(path, new Stroke(1, Stroke.CAP_SQUARE, Stroke.JOIN_MITER, 1f));
g.setAlpha(alpha2);
} else {
g.drawShape(path, new Stroke(1, Stroke.CAP_SQUARE, Stroke.JOIN_MITER, 1f));
}
}


g.setColor(fgColor);
g.setFont(badgeFont);
int alpha2 = g.concatenateAlpha(badgeStyle.getFgAlpha());
g.drawString(badgeText, rect.getX() + rect.getWidth() / 2 - badgeTextWidth / 2, rect.getY() + badgePaddingTop);
g.setAlpha(alpha2);
if (badgeStyle != null) {
int alpha2 = g.concatenateAlpha(badgeStyle.getFgAlpha());
g.drawString(badgeText, rect.getX() + rect.getWidth() / 2 - badgeTextWidth / 2, rect.getY() + badgePaddingTop);
g.setAlpha(alpha2);
} else {
g.drawString(badgeText, rect.getX() + rect.getWidth() / 2 - badgeTextWidth / 2, rect.getY() + badgePaddingTop);
}


g.setColor(col);
Expand Down
6 changes: 3 additions & 3 deletions CodenameOne/src/com/codename1/ui/spinner/SpinnerNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public void addSelectionListener(SelectionListener l) {
public void removeSelectionListener(SelectionListener l) {
if (selectionListeners != null) {
selectionListeners.remove(l);
}
if (selectionListeners.isEmpty()) {
selectionListeners = null;
if (selectionListeners.isEmpty()) {
selectionListeners = null;
}
}
}

Expand Down
Loading