Search in sources :

Example 6 with ComponentProperties

use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.

the class UIElement method __debugInfo.

@Signature
public Memory __debugInfo(Environment env, Memory... args) {
    ArrayMemory result = new ArrayMemory();
    result.refOfIndex("uid").assign(getComponent().getName());
    result.refOfIndex("position").assign(ArrayMemory.ofIntegers(getComponent().getX(), getComponent().getY()));
    result.refOfIndex("size").assign(ArrayMemory.ofIntegers(getComponent().getWidth(), getComponent().getHeight()));
    ComponentProperties properties = SwingExtension.getProperties(getComponent());
    if (properties.getOriginGroups() != null)
        result.refOfIndex("group").assign(properties.getOriginGroups());
    return result.toConstant();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) ComponentProperties(org.develnext.jphp.swing.ComponentProperties)

Example 7 with ComponentProperties

use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.

the class UIAbstractButton method __setButtonGroup.

@Signature(@Arg("value"))
protected Memory __setButtonGroup(Environment env, Memory... args) {
    ComponentProperties properties = SwingExtension.getProperties(getComponent());
    properties.setData("buttonGroup", args[0].toString());
    ButtonGroup group = SwingExtension.getOrCreateButtonGroup(args[0].toString());
    group.add(getAbstractButton());
    return Memory.NULL;
}
Also used : ComponentProperties(org.develnext.jphp.swing.ComponentProperties)

Example 8 with ComponentProperties

use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.

the class UIAbstractButton method __getButtonGroup.

@Signature
protected Memory __getButtonGroup(Environment env, Memory... args) {
    ComponentProperties properties = SwingExtension.getProperties(getComponent());
    String val = properties.getData("buttonGroup", String.class);
    if (val == null)
        return Memory.CONST_EMPTY_STRING;
    return new StringMemory(val);
}
Also used : ComponentProperties(org.develnext.jphp.swing.ComponentProperties) StringMemory(php.runtime.memory.StringMemory)

Example 9 with ComponentProperties

use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.

the class UIContainer method getComponent.

protected Component getComponent(Container where, String group) {
    if (where instanceof JFrame)
        where = ((JFrame) where).getRootPane();
    int count = where instanceof JMenu ? ((JMenu) where).getItemCount() : where.getComponentCount();
    for (int i = 0; i < count; i++) {
        Component el = where instanceof JMenu ? ((JMenu) where).getItem(i) : where.getComponent(i);
        if (el == null)
            continue;
        ComponentProperties properties = SwingExtension.getProperties(el);
        if (properties != null && properties.hasGroup(group)) {
            return el;
        }
        if (el instanceof Container) {
            Component r = getComponent((Container) el, group);
            if (r != null)
                return r;
        }
    }
    return null;
}
Also used : ComponentProperties(org.develnext.jphp.swing.ComponentProperties)

Example 10 with ComponentProperties

use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.

the class UIElement method __getAnchors.

@Signature
protected Memory __getAnchors(Environment env, Memory... args) {
    ArrayMemory result = new ArrayMemory();
    ComponentProperties properties = SwingExtension.getProperties(getComponent());
    if (properties != null)
        for (Anchor anchor : properties.anchors) {
            result.add(new StringMemory(anchor.name()));
        }
    return result.toConstant();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) Anchor(org.develnext.jphp.swing.misc.Anchor) ComponentProperties(org.develnext.jphp.swing.ComponentProperties) StringMemory(php.runtime.memory.StringMemory)

Aggregations

ComponentProperties (org.develnext.jphp.swing.ComponentProperties)14 ArrayMemory (php.runtime.memory.ArrayMemory)4 StringMemory (php.runtime.memory.StringMemory)3 Anchor (org.develnext.jphp.swing.misc.Anchor)2 ArrayList (java.util.ArrayList)1 XYLayout (org.develnext.jphp.swing.XYLayout)1 EventProvider (org.develnext.jphp.swing.event.EventProvider)1 Memory (php.runtime.Memory)1 Invoker (php.runtime.invoke.Invoker)1 ForeachIterator (php.runtime.lang.ForeachIterator)1 LongMemory (php.runtime.memory.LongMemory)1 ObjectMemory (php.runtime.memory.ObjectMemory)1