use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method __setGroup.
@Signature(@Arg("value"))
protected Memory __setGroup(Environment env, Memory... args) {
ComponentProperties properties = SwingExtension.getProperties(getComponent());
properties.setGroups(args[0].toString());
return Memory.NULL;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIScrollPanel method __setAutosize.
@Signature(@Arg("value"))
protected Memory __setAutosize(Environment env, Memory... args) {
ComponentProperties properties = SwingExtension.getProperties(component.getContent());
properties.setAutoSize(args[0].toBoolean());
return Memory.NULL;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIContainer method getComponents.
protected java.util.List<Component> getComponents(Container where, String group) {
java.util.List<Component> result = new ArrayList<Component>();
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)) {
result.add(el);
}
if (el instanceof Container) {
result.addAll(getComponents((Container) el, group));
}
}
return result;
}
use of org.develnext.jphp.swing.ComponentProperties in project jphp by jphp-compiler.
the class UIElement method on.
@Signature({ @Arg("name"), @Arg("callback"), @Arg(value = "group", optional = @Optional("general")) })
public Memory on(Environment env, Memory... args) {
Invoker invoker = Invoker.valueOf(env, null, args[1]);
if (invoker == null) {
env.exception(env.trace(), "Argument 2 must be callable");
return Memory.NULL;
}
String name = args[0].toString().toLowerCase();
EventProvider eventProvider = SwingExtension.isAllowedEventType(getComponent(), name);
invoker.setTrace(env.trace());
if (eventProvider == null) {
if (allowedEvents == null || !allowedEvents.contains(name))
throw new IllegalArgumentException("Unknown event type - " + args[0]);
//env.exception(env.trace(), "Unknown event type - " + args[0]);
}
onBindEvent(env, name, invoker);
ComponentProperties properties = SwingExtension.getProperties(getComponent(), true);
properties.updateEvents(env);
getEventContainer().addEvent(name, args[2].toString(), invoker);
return Memory.NULL;
}
Aggregations