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
1 change: 1 addition & 0 deletions .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def main() -> None:
"UW_UNCOND_WAIT",
"SIC_INNER_SHOULD_BE_STATIC_ANON",
"SS_SHOULD_BE_STATIC",
"UPM_UNCALLED_PRIVATE_METHOD",
"RV_CHECK_FOR_POSITIVE_INDEXOF",
}

Expand Down
6 changes: 0 additions & 6 deletions CodenameOne/src/com/codename1/io/CacheMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,6 @@ public Vector getKeysInCache() {
return r;
}

private Vector fetchFromStorageCache(int offset) {
Vector v = getStorageCacheContent();
Object[] arr = (Object[]) v.elementAt(offset);
return (Vector) Storage.getInstance().readObject("$CACHE$" + cachePrefix + arr[1].toString());
}

/**
* Clears the storage cache
*/
Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/io/ConnectionRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2704,10 +2704,6 @@ public void downloadImageToFileSystem(String file, SuccessCallback<Image> onSucc
downloadImageToFileSystem(file, onSuccess, onFail, true);
}

private void downloadImage(final SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) {
downloadImage(onSuccess, onFail, true);
}

private void downloadImage(final SuccessCallback<Image> onSuccess, final FailureCallback<Image> onFail, boolean useCache) {
setReadResponseForErrors(false);
if (useCache) {
Expand Down
10 changes: 0 additions & 10 deletions CodenameOne/src/com/codename1/ui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -2476,16 +2476,6 @@ public boolean hasDragOccured() {
return dragOccured;
}

private int[] pointerEvent(int off, int[] event) {
int[] peX = new int[(event.length - 1) / 2];
int offset = 0;
for (int iter = off; iter < (event.length - 1); iter += 2) {
peX[offset] = event[iter];
offset++;
}
return peX;
}

/**
* Returns true for a case where the EDT has nothing at all to do
*/
Expand Down
12 changes: 0 additions & 12 deletions CodenameOne/src/com/codename1/ui/Graphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,18 +553,6 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc
impl.drawArc(nativeGraphics, xTranslate + x, yTranslate + y, width, height, startAngle, arcAngle);
}

private void drawStringImpl(String str, int x, int y) {
// remove a commonly used trick to create a spacer label from the paint queue
if (str.length() == 0 || (str.length() == 1 && str.charAt(0) == ' ')) {
return;
}
if (!(current instanceof CustomFont)) {
impl.drawString(nativeGraphics, str, x + xTranslate, y + yTranslate);
} else {
current.drawString(this, str, x, y);
}
}

/**
* Draw a string using the current font and color in the x,y coordinates. The font is drawn
* from the top position and not the baseline.
Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/ui/InputComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ protected InputComponent() {
}

// varags calls are significantly slower in java
private static int max(int a, int b, int c) {
return Math.max(Math.max(a, b), c);
}

private static int max(int a, int b, int c, int d) {
return Math.max(Math.max(Math.max(a, b), c), d);
}
Expand Down
12 changes: 0 additions & 12 deletions CodenameOne/src/com/codename1/ui/LinearGradientPaint.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ public LinearGradientPaint(double startX, double startY, double endX, double end
this.endY = endY;
}

private static double findAngle(double x1, double y1, double x2, double y2) {
return MathUtil.atan((y2 - y1) / (x2 - x1));
}

private static double scaleX(double theta, double x) {
return x / Math.cos(theta);
}

private static double scaleY(double theta, double y) {
return y / Math.sin(theta);
}

/**
* Paints linear gradient in the given bounds.
*
Expand Down
6 changes: 0 additions & 6 deletions CodenameOne/src/com/codename1/ui/TextSelection.java
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,6 @@ private boolean isVerticallyCoveredByBounds(Component cmp, Rectangle bounds) {
return false;
}

private boolean shouldCoverToEndOfLine(Span span, Rectangle bounds) {
int spy = span.getBounds().getY();
int sph = span.getBounds().getHeight();
return spy + 2 * sph / 3 > bounds.getY() && spy + sph <= bounds.getY() + bounds.getHeight();
}

private void updateSnappedSelectedBounds() {
snappedSelectedBounds.setBounds(selectedBounds.getX(), selectedBounds.getY(), selectedBounds.getWidth(), selectedBounds.getHeight());
for (Span span : selectedSpans) {
Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/ui/UIFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,6 @@ private static int centerBehaviour(String behaviour) {
return BorderLayout.CENTER_BEHAVIOR_SCALE;
}

private static boolean grow(String grow) {
return "true".equalsIgnoreCase(grow);
}

private static int align(String align) {
if ("left".equals(align)) {
return Component.LEFT;
Expand Down
36 changes: 0 additions & 36 deletions CodenameOne/src/com/codename1/ui/URLImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,42 +341,6 @@ private boolean platformSupportsImageLoadingOffEdt() {
return CN.isSimulator() || !CN.getPlatformName().equals("ios");
}

private void loadImageFromStorageURLToStorage(final String targetKey) {
imageLoader.run(new Runnable() {
public void run() {
try {
if (!Objects.equals(url, targetKey)) {
InputStream input = Storage.getInstance().createInputStream(url);
OutputStream output = Storage.getInstance().createOutputStream(targetKey);
Util.copy(input, output);
}
runAndWait(new Runnable() {
public void run() {
try {
Image value = Image.createImage(Storage.getInstance().createInputStream(targetKey));
DownloadCompleted onComplete = new DownloadCompleted();
onComplete.setSourceImage(value);
onComplete.actionPerformed(new ActionEvent(value));
} catch (Exception ex) {
if (exceptionHandler != null) {
exceptionHandler.onError(URLImage.this, ex);
} else {
Log.e(new RuntimeException(ex.toString()));
}
}
}
});
} catch (Exception t) {
if (exceptionHandler != null) {
exceptionHandler.onError(URLImage.this, t);
} else {
Log.e(new RuntimeException(t.toString()));
}
}
}
});
}

private void loadImageFromLocalUrl(final String targetKey, final boolean useFileSystemStorage) {
imageLoader.run(new Runnable() {
public void run() {
Expand Down
20 changes: 0 additions & 20 deletions CodenameOne/src/com/codename1/ui/geom/GeneralPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,6 @@ private static class Iterator implements PathIterator {
GeneralPath p;

Transform transform;
private final float[] buf = new float[2];

/**
* Constructs a new GeneralPath.Iterator for given general path
Expand Down Expand Up @@ -3249,25 +3248,6 @@ public void next() {
typeIndex++;
}

private void transformSegmentInPlace() {
if (isDone()) {
// awt.4B=Iterator out of bounds
throw new IndexOutOfBoundsException("Path done"); //$NON-NLS-1$
}
if (transform == null) {
return;
}
int type = p.types[typeIndex];
int count = GeneralPath.pointShift[type];
for (int i = 0; i < count; i += 2) {
buf[0] = p.points[pointIndex + i];
buf[1] = p.points[pointIndex + i + 1];
transform.transformPoint(buf, buf);
p.points[pointIndex + i] = buf[0];
p.points[pointIndex + i + 1] = buf[1];
}
}

public int currentSegment(double[] coords) {
float[] fcoords = createFloatArrayFromPool(6);
try {
Expand Down
62 changes: 4 additions & 58 deletions CodenameOne/src/com/codename1/ui/html/HTMLComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
* @author Ofir Leitner
* @deprecated this component includes some customizability advantages but its probably better for 99% of the use
* cases to use the WebBrowser Component from the Components package. That component works with the native
* browser when applicable which is a far superior approach.
* browser when applicable, which is a far superior approach.
*/
public class HTMLComponent extends Container implements ActionListener, IOCallback {
/**
* If true a full screen width will be assumed, this helps to make less internal components as text is aggregated to long labels
* If true, a full screen width will be assumed, this helps to make less internal components as text is aggregated to long labels
* If false, then the width is flexible, but every word will be rendered as a separate label.
* Note that if false, RTL texts will display in
*/
Expand Down Expand Up @@ -2072,56 +2072,7 @@ Vector getWords(String text, int align, boolean returnComps) {
private Vector showText(String text, int align) {
return getWords(text, align, true);
}

/**
* Shows the given text. This method breaks lines as necessary and adds the text either as regular labels or links.
*
* @param text The text to display
* @param align The current horizontal alignment
*/
private Vector showTextFixedWidth(String text, int align) {
Vector comps = new Vector();
if ((text == null) || (text.equals(""))) {
return comps; //no text to show
}
int spaceW = width - x;

Vector words = getWords(text, align, false);

if (words.size() > 0) {
int w = 0;
StringBuilder wordStr = new StringBuilder();
if ((CSSParser.isWhiteSpace(text.charAt(0))) && (curLine.getComponentCount() != 0)) { //leading space is trimmed if it is in the first component of the line
wordStr.append(" "); //leading space
}

while (w < words.size()) {
String nextWord = (String) words.elementAt(w);
String space = "";
if ((wordStr.length() > 0) && (!wordStr.toString().equals(" "))) {
space = " ";
}
if (font.stringWidth(wordStr.toString() + space + nextWord) > spaceW - 2) {
comps.addElement(addString(wordStr.toString(), align));
newLineIfNotEmpty(align);
spaceW = width - x;
wordStr.setLength(0);
wordStr.append(nextWord);
} else {
wordStr.append(space).append(nextWord);
}
w++;
}
if (CSSParser.isWhiteSpace(text.charAt(text.length() - 1))) {
wordStr.append(" "); //trailing space
}

comps.addElement(addString(wordStr.toString(), align));
}

return comps;
}


/**
* Adds the given text to the container as a label or a link.
* The string given here does not need line breaking as this was calculated before in the calling method.
Expand Down Expand Up @@ -2926,12 +2877,7 @@ private void processTag(HTMLElement element, int align) {
if (preTagCount != 0) {
comps = showPreTagText(text, curAlign);
} else {

if (FIXED_WIDTH) {
comps = showTextFixedWidth(text, curAlign);
} else {
comps = showText(text, curAlign);
}
comps = showText(text, curAlign);
}
if (loadCSS) {
child.setAssociatedComponents(comps);
Expand Down
10 changes: 0 additions & 10 deletions CodenameOne/src/com/codename1/ui/layouts/LayeredLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,6 @@ private static int getOuterPreferredH(Component cmp) {
return cmp.getPreferredH() + s.getVerticalMargins();
}

private static int getInnerHeight(Component cmp) {
Style s = cmp.getStyle();
return cmp.getHeight() - s.getPaddingTop() - s.getPaddingBottom();
}

private static int getInnerPreferredH(Component cmp) {
Style s = cmp.getStyle();
return cmp.getPreferredH() - s.getPaddingTop() - s.getPaddingBottom();
}

private static int getOuterWidth(Component cmp) {
Style s = cmp.getStyle();
return cmp.getWidth() + s.getHorizontalMargins();
Expand Down
19 changes: 0 additions & 19 deletions CodenameOne/src/com/codename1/ui/layouts/LayoutStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,25 +281,6 @@ private int getCBRBPadding(Component c, int position) {
return 0;
}

private int getInset(Component c, int position) {
int insetLeft = c.getStyle().getMarginLeftNoRTL();
int insetTop = c.getStyle().getMarginTop();
int insetRight = c.getStyle().getMarginRightNoRTL();
int insetBottom = c.getStyle().getMarginBottom();
switch (position) {
case GroupLayout.NORTH:
return insetTop;
case GroupLayout.SOUTH:
return insetBottom;
case GroupLayout.EAST:
return insetRight;
case GroupLayout.WEST:
return insetLeft;
default:
throw new IllegalArgumentException("Illegal argument position: " + position);
}
}

// Fix component alignment to work with labels etc when doing bidi
/*private boolean isLeftAligned(Label button, int position) {
if (position == GroupLayout.WEST) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ public final int getMaximumWidth(int sz) {
return Display.getInstance().getDisplayWidth();
}

private boolean isMaxSet(Component c) {
return false;
}

public final ContainerWrapper getParent() {
Container p = c.getParent();
return p != null ? new CodenameOneMiGContainerWrapper(p) : null;
Expand Down Expand Up @@ -344,4 +340,3 @@ public int getContentBias() {
return c instanceof TextArea || (Boolean.TRUE.equals(c.getClientProperty("migLayout.dynamicAspectRatio"))) ? LayoutUtil.HORIZONTAL : -1;
}
}

Loading
Loading