use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class MobileFormLayout method getBodyElementsForRecordView.
public static List<ISupportBounds> getBodyElementsForRecordView(FlattenedSolution editingFlattenedSolution, Form flattenedForm) {
List<ISupportBounds> elements = new ArrayList<ISupportBounds>();
Set<String> groups = new HashSet<String>();
for (IPersist persist : flattenedForm.getAllObjectsAsList()) {
if (persist instanceof ISupportExtendsID && PersistHelper.isOverrideOrphanElement((ISupportExtendsID) persist)) {
// skip orphaned overrides
continue;
}
if (persist instanceof IFormElement && persist instanceof AbstractBase) {
String groupID = ((IFormElement) persist).getGroupID();
if (groupID == null) {
if (persist instanceof Portal && ((Portal) persist).isMobileInsetList()) {
// inset list
elements.add(((Portal) persist));
} else // tabpanel: list elements or navtab
if (((AbstractBase) persist).getCustomMobileProperty(IMobileProperties.HEADER_ITEM.propertyName) == null && ((AbstractBase) persist).getCustomMobileProperty(IMobileProperties.FOOTER_ITEM.propertyName) == null) {
// regular item
elements.add((ISupportBounds) (persist instanceof IFlattenedPersistWrapper ? ((IFlattenedPersistWrapper<?>) persist).getWrappedPersist() : persist));
}
} else if (groups.add(groupID)) {
elements.add(new FormElementGroup(groupID, editingFlattenedSolution, FlattenedForm.getWrappedForm(flattenedForm)));
}
}
}
// sort by y-position
Collections.sort(elements, PositionComparator.YX_BOUNDS_COMPARATOR);
return elements;
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method getOnDropMethodID.
private int getOnDropMethodID() {
int onDropID = 0;
if (cellview instanceof Portal) {
Portal cellviewPortal = (Portal) cellview;
onDropID = cellviewPortal.getOnDropMethodID();
} else {
onDropID = fc.getForm().getOnDropMethodID();
}
return onDropID;
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method onDrag.
public int onDrag(JSDNDEvent event) {
int onDragID = 0;
if (cellview instanceof Portal) {
Portal cellviewPortal = (Portal) cellview;
onDragID = cellviewPortal.getOnDragMethodID();
} else {
onDragID = fc.getForm().getOnDragMethodID();
}
if (onDragID > 0) {
// $NON-NLS-1$
Object dragReturn = fc.executeFunction(Integer.toString(onDragID), new Object[] { event }, false, null, false, "onDragMethodID");
if (dragReturn instanceof Number)
return ((Number) dragReturn).intValue();
}
return DRAGNDROP.NONE;
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method onDragOver.
public boolean onDragOver(JSDNDEvent event) {
int onDragOverID = 0;
if (cellview instanceof Portal) {
Portal cellviewPortal = (Portal) cellview;
onDragOverID = cellviewPortal.getOnDragOverMethodID();
} else {
onDragOverID = fc.getForm().getOnDragOverMethodID();
}
if (onDragOverID > 0) {
// $NON-NLS-1$
Object dragOverReturn = fc.executeFunction(Integer.toString(onDragOverID), new Object[] { event }, false, null, false, "onDragOverMethodID");
if (dragOverReturn instanceof Boolean)
return ((Boolean) dragOverReturn).booleanValue();
}
return getOnDropMethodID() > 0;
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method createComponents.
private void createComponents(final IApplication app, final Form form, final AbstractBase view, final IDataProviderLookup dataProviderLookup, final IScriptExecuter el, final int viewStartY, final int viewEndY, final ItemAdd output) {
List<IPersist> elements = ComponentFactory.sortElementsOnPositionAndGroup(view.getAllObjectsAsList());
int startX = 0;
for (int i = 0; i < elements.size(); i++) {
IPersist element = elements.get(i);
if (element instanceof Field || element instanceof GraphicalComponent || element instanceof Bean) {
if (!isListViewMode()) {
if (element instanceof GraphicalComponent && ((GraphicalComponent) element).getLabelFor() != null) {
if (isInView(cellview, ((GraphicalComponent) element).getLabelFor())) {
labelsFor.put(((GraphicalComponent) element).getLabelFor(), element);
}
continue;
}
}
Point l = ((IFormElement) element).getLocation();
if (l == null) {
// unknown where to add
continue;
}
if (l.y >= viewStartY && l.y < viewEndY) {
IComponent c = ComponentFactory.createComponent(app, form, element, dataProviderLookup, el, false);
if (cellview instanceof Portal && c instanceof IScriptableProvider) {
IScriptable s = ((IScriptableProvider) c).getScriptObject();
if (s instanceof ISupportOnRenderCallback && ((ISupportOnRenderCallback) s).getRenderEventExecutor() != null)
ComponentFactoryHelper.addPortalOnRenderCallback((Portal) cellview, ((ISupportOnRenderCallback) s).getRenderEventExecutor(), element, fc != null ? fc.getScriptExecuter() : null);
}
initializeComponent((Component) c, view, element);
output.add(element, (Component) c);
if (!isListViewMode()) {
// reset location.x as defined in this order, elements are ordered by location.x which is modified in drag-n-drop
Point loc = c.getLocation();
if (loc != null) {
c.setLocation(new Point(startX, loc.y));
}
Dimension csize = c.getSize();
startX += (csize != null) ? csize.width : ((IFormElement) element).getSize().width;
}
}
}
}
}
Aggregations