use of com.codename1.rad.models.Property.Name in project CodenameOne by codenameone.
the class Resources method readTimeline.
Timeline readTimeline(DataInputStream input) throws IOException {
int duration = input.readInt();
int width = input.readInt();
int height = input.readInt();
AnimationObject[] animations = new AnimationObject[input.readShort()];
int alen = animations.length;
for (int iter = 0; iter < alen; iter++) {
String name = input.readUTF();
int startTime = input.readInt();
int animDuration = input.readInt();
int x = input.readInt();
int y = input.readInt();
Image i = getImage(name);
if (i == null) {
animations[iter] = AnimationObject.createAnimationImage(name, this, x, y);
} else {
animations[iter] = AnimationObject.createAnimationImage(i, x, y);
}
animations[iter].setStartTime(startTime);
animations[iter].setEndTime(startTime + animDuration);
int frameDelay = input.readInt();
if (frameDelay > -1) {
int frameWidth = input.readInt();
int frameHeight = input.readInt();
animations[iter].defineFrames(frameWidth, frameHeight, frameDelay);
}
if (input.readBoolean()) {
animations[iter].defineMotionX(input.readInt(), startTime, animDuration, x, input.readInt());
}
if (input.readBoolean()) {
animations[iter].defineMotionY(input.readInt(), startTime, animDuration, y, input.readInt());
}
if (input.readBoolean()) {
animations[iter].defineWidth(input.readInt(), startTime, animDuration, input.readInt(), input.readInt());
}
if (input.readBoolean()) {
animations[iter].defineHeight(input.readInt(), startTime, animDuration, input.readInt(), input.readInt());
}
if (input.readBoolean()) {
animations[iter].defineOpacity(input.readInt(), startTime, animDuration, input.readInt(), input.readInt());
}
if (input.readBoolean()) {
animations[iter].defineOrientation(input.readInt(), startTime, animDuration, input.readInt(), input.readInt());
}
}
Timeline tl = Timeline.createTimeline(duration, animations, new Dimension(width, height));
return tl;
}
use of com.codename1.rad.models.Property.Name in project CodenameOne by codenameone.
the class LazyValueC method showForm.
/**
* This method is equivalent to the internal navigation behavior, it adds
* functionality such as the back command into the given form resource and
* shows it. If the source command is the back command the showBack() method
* will run.
*
* @param resourceName the name of the resource for the form to show
* @param sourceCommand the command of the resource (may be null)
* @return the form thats being shown, notice that you can still manipulate
* some states of the form before it actually appears
*/
public Form showForm(String resourceName, Command sourceCommand) {
Form f = (Form) createContainer(fetchResourceFile(), resourceName);
showForm(f, sourceCommand, null);
return f;
}
use of com.codename1.rad.models.Property.Name in project CodenameOne by codenameone.
the class Table method getPropertyValue.
/**
* {@inheritDoc}
*/
public Object getPropertyValue(String name) {
if (name.equals("data")) {
String[][] result = new String[((DefaultTableModel) model).data.size()][];
for (int iter = 0; iter < result.length; iter++) {
Object[] o = ((DefaultTableModel) model).data.get(iter);
String[] arr = new String[o.length];
result[iter] = arr;
for (int ai = 0; ai < arr.length; ai++) {
Object current = o[ai];
if (current instanceof String) {
arr[ai] = (String) current;
} else {
if (current != null) {
arr[iter] = current.toString();
}
}
}
}
return result;
}
if (name.equals("header")) {
return ((DefaultTableModel) model).columnNames;
}
return null;
}
use of com.codename1.rad.models.Property.Name in project CodenameOne by codenameone.
the class LazyValueC method createComponentType.
Component createComponentType(String name) throws IllegalAccessException, InstantiationException, RuntimeException {
Class c = (Class) getComponentRegistry().get(name);
Component cmp = createComponentInstance(name, c);
if (cmp == null) {
if (c == null) {
throw new RuntimeException("Component not found use UIBuilder.registerCustomComponent(" + name + ", class);");
}
cmp = (Component) c.newInstance();
}
return cmp;
}
use of com.codename1.rad.models.Property.Name in project CodenameOne by codenameone.
the class LazyValueC method postCreateComponents.
/**
* Invoked after the components were created to allow properties that require the entire
* tree to exist to update the component. This is useful for properties that point
* at other components.
*/
private void postCreateComponents(DataInputStream in, Container parent, Resources res) throws Exception {
// finds the component whose properties need to update
String name = in.readUTF();
Component lastComponent = null;
while (name.length() > 0) {
if (lastComponent == null || !lastComponent.getName().equals(name)) {
lastComponent = findByName(name, parent);
}
Component c = lastComponent;
int property = in.readInt();
modifyingProperty(c, property);
switch(property) {
case PROPERTY_COMMAND_LEGACY:
{
readCommand(in, c, parent, res, true);
break;
}
case PROPERTY_COMMAND:
{
readCommand(in, c, parent, res, false);
break;
}
case PROPERTY_LABEL_FOR:
c.setLabelForComponent((Label) findByName(in.readUTF(), parent));
break;
case PROPERTY_LEAD_COMPONENT:
((Container) c).setLeadComponent(findByName(in.readUTF(), parent));
break;
case PROPERTY_NEXT_FOCUS_UP:
c.setNextFocusUp(findByName(in.readUTF(), parent));
break;
case PROPERTY_NEXT_FOCUS_DOWN:
c.setNextFocusDown(findByName(in.readUTF(), parent));
break;
case PROPERTY_NEXT_FOCUS_LEFT:
c.setNextFocusLeft(findByName(in.readUTF(), parent));
break;
case PROPERTY_NEXT_FOCUS_RIGHT:
c.setNextFocusRight(findByName(in.readUTF(), parent));
break;
}
name = in.readUTF();
}
}
Aggregations