use of com.servoy.j2db.persistence.IPersist in project servoy-client by Servoy.
the class JSPortal method setY.
/**
* @see com.servoy.j2db.scripting.solutionmodel.JSComponent#setY(int)
*/
@Override
@JSSetter
public void setY(int y) {
int yDif = y - getY();
Iterator<IPersist> allObjects = getBaseComponent(true).getAllObjects();
while (allObjects.hasNext()) {
IPersist persist = allObjects.next();
if (persist instanceof BaseComponent) {
BaseComponent baseComponent = (BaseComponent) persist;
Point location = baseComponent.getLocation();
((BaseComponent) persist).setLocation(new Point(location.x, location.y + yDif));
}
}
super.setY(y);
}
use of com.servoy.j2db.persistence.IPersist in project servoy-client by Servoy.
the class JSSolutionModel method getParentContainer.
private IJSParent<?> getParentContainer(IPersist persist) {
IJSParent<?> parent = null;
List<AbstractContainer> parentHierarchy = new ArrayList<AbstractContainer>();
IPersist currentParent = persist.getParent();
while (currentParent != null) {
if (currentParent instanceof AbstractContainer) {
parentHierarchy.add(0, (AbstractContainer) currentParent);
}
if (currentParent instanceof Form)
break;
currentParent = currentParent.getParent();
}
for (AbstractContainer container : parentHierarchy) {
if (container instanceof LayoutContainer) {
parent = new JSLayoutContainer(parent, application, (LayoutContainer) persist);
}
if (container instanceof Form) {
parent = instantiateForm((Form) container, false);
}
}
return parent;
}
use of com.servoy.j2db.persistence.IPersist in project servoy-client by Servoy.
the class JSTabPanel method getTabs.
/**
* Returns an array of JSTab instances holding the tabs of the tab panel.
*
* @sample
* var tabPanel = form.newTabPanel('tabs', 10, 10, 620, 460);
* tabPanel.newTab('tab1', 'Child Two', childOne);
* tabPanel.newTab('tab2', 'Child Two', childTwo);
* var tabs = tabPanel.getTabs();
* for (var i=0; i<tabs.length; i++)
* application.output("Tab " + i + " has text " + tabs[i].text);
*
* @return An array of JSTab instances representing all tabs of this tabpanel.
*/
@JSFunction
public JSTab[] getTabs() {
ArrayList<JSTab> labels = new ArrayList<JSTab>();
Iterator<IPersist> tabs = getBaseComponent(false).getTabs();
while (tabs.hasNext()) {
Tab tab = (Tab) tabs.next();
labels.add(new JSTab(this, tab, application, false));
}
return labels.toArray(new JSTab[labels.size()]);
}
use of com.servoy.j2db.persistence.IPersist in project servoy-client by Servoy.
the class PersistHelper method hasOverrideChildren.
/**
* Example if a superform has a tabPanel with a tab, and a derived form adds another tab to the tabpannel then hasOverrideChildren(derivedTabPanel) returns true
*/
public static boolean hasOverrideChildren(IPersist persist) {
if (persist instanceof ISupportChilds && persist instanceof ISupportExtendsID) {
ISupportChilds p = (ISupportChilds) persist;
ISupportChilds superPersist = (ISupportChilds) PersistHelper.getSuperPersist((ISupportExtendsID) persist);
if (superPersist == null) {
return false;
}
for (IPersist child : Utils.iterate(p.getAllObjects())) {
if (child instanceof ISupportExtendsID && !PersistHelper.isOverrideElement((ISupportExtendsID) child)) {
// is is an etra child element compared to it's super child elements
return true;
} else if (((AbstractBase) child).hasOverrideProperties()) {
return true;
}
}
}
return false;
}
use of com.servoy.j2db.persistence.IPersist in project servoy-client by Servoy.
the class PersistHelper method getOverrideHierarchy.
/**
* Get the override hierarchy of this element as list [self, super, super.super, ...]
*/
public static List<AbstractBase> getOverrideHierarchy(ISupportExtendsID persist) {
List<AbstractBase> overrideHierarchy = new ArrayList<AbstractBase>(3);
IPersist superPersist = persist;
while (superPersist instanceof ISupportExtendsID) {
overrideHierarchy.add((AbstractBase) superPersist);
superPersist = getSuperPersist((ISupportExtendsID) superPersist);
}
return overrideHierarchy;
}
Aggregations