use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method __setAutosize.
@Signature(@Arg("value"))
protected Memory __setAutosize(Environment env, Memory... args) {
ComponentProperties properties = SwingExtension.getProperties(getComponent());
properties.setAutoSize(args[0].toBoolean());
return Memory.NULL;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method __setPadding.
@Signature(@Arg(value = "value", type = HintType.ARRAY))
protected Memory __setPadding(Environment env, Memory... args) {
ComponentProperties properties = SwingExtension.getProperties(getComponent());
if (properties == null)
return Memory.NULL;
int[] v = args[0].toValue(ArrayMemory.class).toIntArray();
if (v.length == 1) {
int size = v[0];
properties.setPadding(size, size, size, size);
} else if (v.length == 2) {
int ver = v[0];
int hor = v[1];
properties.setPadding(ver, hor, ver, hor);
} else if (v.length == 3) {
int top = v[0];
int hor = v[1];
int bottom = v[2];
properties.setPadding(top, hor, bottom, hor);
} else if (v.length > 3) {
int top = v[0];
int right = v[1];
int bottom = v[2];
int left = v[3];
properties.setPadding(top, right, bottom, left);
}
return Memory.NULL;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method trigger.
@Signature({ @Arg("name") })
public Memory trigger(Environment env, Memory... args) throws Throwable {
ComponentProperties properties = SwingExtension.getProperties(getComponent());
if (args.length == 1) {
properties.triggerEvent(args[0].toString().toLowerCase());
} else {
Memory[] passed = new Memory[args.length - 1];
System.arraycopy(args, 1, passed, 0, args.length - 1);
properties.triggerEvent(args[0].toString().toLowerCase(), passed);
}
return Memory.NULL;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method __setAlign.
@Signature(@Arg("value"))
protected Memory __setAlign(Environment env, Memory... args) {
ComponentProperties properties = SwingExtension.getProperties(getComponent());
properties.setAlign(Align.valueOf(args[0].toString().toUpperCase()));
return Memory.NULL;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method __setAnchors.
@Signature(@Arg("value"))
protected Memory __setAnchors(Environment env, Memory... args) {
ComponentProperties data = SwingExtension.getProperties(getComponent());
data.anchors.clear();
if (args[0].isArray()) {
ForeachIterator iterator = args[0].getNewIterator(env, false, false);
while (iterator.next()) {
Anchor anchor = Anchor.valueOf(iterator.getValue().toString().toUpperCase());
if (anchor == null)
env.exception(env.trace(), "Invalid anchor value - " + iterator.getValue());
data.anchors.add(anchor);
}
} else {
Anchor anchor = Anchor.valueOf(args[0].toString().toUpperCase());
if (anchor == null)
env.exception(env.trace(), "Invalid anchor value - " + args[0]);
}
if (getComponent().getParent() != null) {
LayoutManager layout = getComponent().getParent().getLayout();
if (!(layout instanceof XYLayout))
env.exception(env.trace(), "Layout must be an instance of XYLayout");
}
return Memory.NULL;
}
Aggregations