Search in sources :

Example 36 with ObjectMemory

use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.

the class ObjectInvokeHelper method unsetProperty.

public static void unsetProperty(Memory object, String property, Environment env, TraceInfo trace, PropertyCallCache callCache, int cacheIndex) throws Throwable {
    object = object.toValue();
    if (!object.isObject()) {
        env.error(trace, Messages.ERR_CANNOT_GET_PROPERTY_OF_NON_OBJECT.fetch(property));
    }
    IObject iObject = ((ObjectMemory) object).value;
    iObject.getReflection().unsetProperty(env, trace, iObject, property, callCache, cacheIndex);
}
Also used : IObject(php.runtime.lang.IObject) ObjectMemory(php.runtime.memory.ObjectMemory)

Example 37 with ObjectMemory

use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.

the class ObjectInvokeHelper method emptyProperty.

public static Memory emptyProperty(Memory object, String property, Environment env, TraceInfo trace, PropertyCallCache callCache, int cacheIndex) throws Throwable {
    object = object.toValue();
    if (!object.isObject()) {
        return Memory.NULL;
    //env.error(trace, Messages.ERR_CANNOT_GET_PROPERTY_OF_NON_OBJECT.fetch(property));
    }
    IObject iObject = ((ObjectMemory) object).value;
    return iObject.getReflection().emptyProperty(env, trace, iObject, property);
}
Also used : IObject(php.runtime.lang.IObject) ObjectMemory(php.runtime.memory.ObjectMemory)

Example 38 with ObjectMemory

use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.

the class UITree method __getSelectedNodes.

@Signature
protected Memory __getSelectedNodes(Environment env, Memory... args) {
    ArrayMemory r = new ArrayMemory();
    TreePath[] paths = component.getContent().getSelectionPaths();
    if (paths == null)
        return r.toConstant();
    for (TreePath p : paths) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) p.getLastPathComponent();
        r.add(new ObjectMemory(new WrapTreeNode(env, node)));
    }
    return r.toArray();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) ObjectMemory(php.runtime.memory.ObjectMemory)

Example 39 with ObjectMemory

use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.

the class UIAbstractButton method getSelectedButtons.

@Signature(@Arg("buttonGroup"))
public static Memory getSelectedButtons(Environment env, Memory... args) {
    ButtonGroup group = SwingExtension.getOrCreateButtonGroup(args[0].toString());
    if (group == null)
        return new ArrayMemory().toConstant();
    Object[] selected = group.getSelection().getSelectedObjects();
    ArrayMemory result = new ArrayMemory();
    if (selected != null)
        for (Object btn : selected) {
            result.add(new ObjectMemory(UIElement.of(env, (Component) btn)));
        }
    return result.toConstant();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) ObjectMemory(php.runtime.memory.ObjectMemory)

Example 40 with ObjectMemory

use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.

the class UIAbstractButton method getButtons.

@Signature(@Arg("buttonGroup"))
public static Memory getButtons(Environment env, Memory... args) {
    ButtonGroup group = SwingExtension.getOrCreateButtonGroup(args[0].toString());
    if (group == null)
        return new ArrayMemory().toConstant();
    ArrayMemory result = new ArrayMemory();
    for (AbstractButton btn : Collections.list(group.getElements())) {
        result.add(new ObjectMemory(UIElement.of(env, btn)));
    }
    return result.toConstant();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) ObjectMemory(php.runtime.memory.ObjectMemory)

Aggregations

ObjectMemory (php.runtime.memory.ObjectMemory)55 ArrayMemory (php.runtime.memory.ArrayMemory)24 Memory (php.runtime.Memory)19 ClassEntity (php.runtime.reflection.ClassEntity)17 StringMemory (php.runtime.memory.StringMemory)14 IObject (php.runtime.lang.IObject)11 Invoker (php.runtime.invoke.Invoker)6 LongMemory (php.runtime.memory.LongMemory)6 Environment (php.runtime.env.Environment)5 MethodEntity (php.runtime.reflection.MethodEntity)5 Calendar (java.util.Calendar)4 Closure (php.runtime.lang.Closure)4 Locale (java.util.Locale)3 Test (org.junit.Test)3 WrapLocale (php.runtime.ext.core.classes.util.WrapLocale)3 PropertyEntity (php.runtime.reflection.PropertyEntity)3 AbstractFunctionEntity (php.runtime.reflection.support.AbstractFunctionEntity)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Date (java.util.Date)2 TimeZone (java.util.TimeZone)2