Commit baf57e45 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Some Form base; If a resource was not found in a suite then do a traditional...

Some Form base; If a resource was not found in a suite then do a traditional classpath search for it.
parent 1a0f3f47
......@@ -54,6 +54,11 @@ More detailed changes:
* Corrected bug in `__CanSetPrintStream__` where if it were set to itself
then it could lead to infinite recursion, instead if this kind of
stream is attempted to be set it will use the target.
* If a resource was not found, do a traditional search of the classpath
for the given resource. This technically is not valid, however some
games use the wrong class when looking up resources. Note that the
current suite will always be searched first to maintain the correct
behavior.
* Implemented `java.io.InputStream`.
* Implemented `java.util.EventObject`.
* Implemented `java.util.Hashtable`.
......
......@@ -13,6 +13,7 @@ package java.lang;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.ResourceAccess;
import cc.squirreljme.runtime.cldc.asm.StaticMethod;
import cc.squirreljme.runtime.cldc.asm.SuiteAccess;
import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import cc.squirreljme.runtime.cldc.lang.ClassData;
import java.io.InputStream;
......@@ -226,7 +227,19 @@ public final class Class<T>
}
// Open the resource, perhaps
return ResourceInputStream.open(injar, want);
InputStream rv = ResourceInputStream.open(injar, want);
if (rv != null)
return rv;
// Otherwise, do a traditional back to front search for the resource
// since it might be in another JAR
String[] classpath = SuiteAccess.currentClassPath();
for (int i = classpath.length - 1; i >= 0; i--)
if (null != (rv = ResourceInputStream.open(classpath[i], want)))
return rv;
// Not found
return null;
}
/**
......
......@@ -18,6 +18,7 @@ import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.TabbedPane;
import javax.microedition.lcdui.TextBox;
......@@ -86,7 +87,22 @@ public enum DrawingMethod
public final void paint(Displayable __d, State __s, Graphics __g,
int __w, int __h)
{
__g.drawString("FORM", 0, 0, 0);
Form form = (Form)__d;
// Number of entries
int n = form.size();
// Working base coordinates for each item
int dx = 0,
dy = 0;
// Draw each entry
for (int i = 0; i < n; i++)
{
// Get item here
Item item = form.get(i);
}
}
},
......
......@@ -146,9 +146,18 @@ public class Form
throw new todo.TODO();
}
public Item get(int __a)
/**
* Returns the given form item.
*
* @param __i The index to get.
* @return The item.
* @throws IndexOutOfBoundsException If the index is not within range.
* @since 2019/05/19
*/
public Item get(int __i)
throws IndexOutOfBoundsException
{
throw new todo.TODO();
return this._items.get(__i);
}
/**
......@@ -201,9 +210,15 @@ public class Form
throw new todo.TODO();
}
/**
* Returns the number of items in the form.
*
* @return The number of form items.
* @since 2109/05/19
*/
public int size()
{
throw new todo.TODO();
return this._items.size();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment