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();
}
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;
}
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);
}
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;
}
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();
}
Aggregations