use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method onDragEnd.
public void onDragEnd(JSDNDEvent event) {
int onDragEndID = 0;
if (cellview instanceof Portal) {
Portal cellviewPortal = (Portal) cellview;
onDragEndID = cellviewPortal.getOnDragEndMethodID();
} else {
onDragEndID = fc.getForm().getOnDragEndMethodID();
}
if (onDragEndID > 0) {
// $NON-NLS-1$
fc.executeFunction(Integer.toString(onDragEndID), new Object[] { event }, false, null, false, "onDragEndMethodID");
}
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method initializeComponent.
@SuppressWarnings("nls")
private void initializeComponent(final Component c, AbstractBase view, IPersist element) {
if (dal != null && dal.isDestroyed()) {
Debug.error("Trying to initialize a component: " + c + " of " + view + " element: " + element + " that is in a destroyed tableview", new RuntimeException());
return;
}
if (// Don't know any other place for this
view instanceof Portal && c instanceof IDisplayData) {
String id = ((IDisplayData) c).getDataProviderID();
if (id != null && !ScopesUtils.isVariableScope(id) && id.startsWith(((Portal) view).getRelationName() + '.')) {
((IDisplayData) c).setDataProviderID(id.substring(((Portal) cellview).getRelationName().length() + 1));
}
}
if (!isListViewMode() && c instanceof WebDataCheckBox) {
// $NON-NLS-1$
((WebDataCheckBox) c).setText("");
}
if (element != null) {
// apply to this cell the state of the columnIdentifier IComponent, do keep the location that is set by the tableview when creating these components the first time.
// for listview this is the location to use.
Point loc = ((IComponent) c).getLocation();
int height = ((IComponent) c).getSize().height;
PropertyCopy.copyElementProps((IComponent) elementToColumnIdentifierComponent.get(element), (IComponent) c);
if (!isListViewMode()) {
((IComponent) c).setLocation(loc);
// it shouldn't be possible to change the height
if (c instanceof IScriptableProvider) {
IScriptable so = ((IScriptableProvider) c).getScriptObject();
if (so instanceof IRuntimeComponent) {
IRuntimeComponent ic = (IRuntimeComponent) so;
if (ic.getHeight() != height) {
ic.setSize(ic.getWidth(), height);
}
}
}
}
} else {
// $NON-NLS-1$
Debug.log("Cannot find the IPersist element for cell " + c.getMarkupId());
}
if (c instanceof IDisplayData) {
IDisplayData cdd = (IDisplayData) c;
if (!(dal != null && dal.getFormScope() != null && cdd.getDataProviderID() != null && // skip for form variables
dal.getFormScope().get(cdd.getDataProviderID()) != Scriptable.NOT_FOUND)) {
cdd.setValidationEnabled(validationEnabled);
}
} else if (c instanceof IDisplayRelatedData) {
((IDisplayRelatedData) c).setValidationEnabled(validationEnabled);
} else if (c instanceof IServoyAwareBean) {
((IServoyAwareBean) c).setValidationEnabled(validationEnabled);
}
addClassToCellComponent(c);
if (// the check could be extended against IDelegate<?>
c instanceof WebDataCompositeTextField) {
Object delegate = ((WebDataCompositeTextField) c).getDelegate();
if (delegate instanceof Component) {
// make sure that this class is added accordingly in TemplateGenerator as a style selector containing relevant properties
addClassToCellComponent((Component) delegate);
}
}
if (c instanceof ISupportValueList) {
ISupportValueList idVl = (ISupportValueList) elementToColumnIdentifierComponent.get(element);
IValueList list;
if (idVl != null && (list = idVl.getValueList()) != null) {
ValueList valuelist = application.getFlattenedSolution().getValueList(list.getName());
if (valuelist != null && valuelist.getValueListType() == IValueListConstants.CUSTOM_VALUES) {
((ISupportValueList) c).setValueList(list);
}
}
}
applyClientProperties(c, element);
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class SortableCellViewHeaders method isReorderableOrResizable.
private boolean isReorderableOrResizable() {
if (// $NON-NLS-1$
Utils.getAsBoolean(application.getRuntimeProperties().get("useAJAX"))) {
boolean isReorderable = false;
boolean isResizable = false;
Iterator<IPersist> iter = cellview.getAllObjects();
while (iter.hasNext()) {
IPersist element = iter.next();
if (element instanceof ISupportAnchors) {
int anchors = ((ISupportAnchors) element).getAnchors();
isResizable = ((anchors & IAnchorConstants.EAST) == IAnchorConstants.EAST) && ((anchors & IAnchorConstants.WEST) == IAnchorConstants.WEST);
isResizable = isResizable && (!(cellview instanceof Portal) || ((Portal) cellview).getResizable());
if (isResizable)
return true;
isReorderable = !(((anchors & IAnchorConstants.NORTH) == IAnchorConstants.NORTH) && ((anchors & IAnchorConstants.SOUTH) == IAnchorConstants.SOUTH));
isReorderable = isReorderable && (!(cellview instanceof Portal) || ((Portal) cellview).getReorderable());
if (isReorderable)
return true;
}
}
}
return false;
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class FlattenedSolution method getDataproviderLookup.
public IDataProviderLookup getDataproviderLookup(IFoundSetManagerInternal foundSetManager, final IPersist p) {
IDataProviderLookup retval = null;
synchronized (this) {
if (dataProviderLookups == null)
dataProviderLookups = new HashMap<IPersist, IDataProviderLookup>();
retval = dataProviderLookups.get(p);
if (retval != null)
return retval;
}
if (p instanceof Form) {
ITable t = null;
try {
if (foundSetManager == null) {
t = getTable(((Form) p).getDataSource());
} else {
t = foundSetManager.getTable(((Form) p).getDataSource());
}
} catch (RepositoryException e) {
Debug.error(e);
}
retval = new FormAndTableDataProviderLookup(this, (Form) p, t);
} else if (p instanceof Portal) {
ITable t = null;
Relation[] relations = getRelationSequence(((Portal) p).getRelationName());
if (relations == null) {
return null;
}
t = getTable(relations[relations.length - 1].getForeignDataSource());
retval = new FormAndTableDataProviderLookup(this, (Form) p.getParent(), t);
} else // solution
{
retval = new IDataProviderLookup() {
public IDataProvider getDataProvider(String id) throws RepositoryException {
return getGlobalDataProvider(id);
}
public Table getTable() throws RepositoryException {
return null;
}
};
}
synchronized (this) {
dataProviderLookups.put(p, retval);
}
return retval;
}
use of com.servoy.j2db.persistence.Portal in project servoy-client by Servoy.
the class ComponentFactory method createComponentEx.
protected static IComponent createComponentEx(IApplication application, Form form, IPersist meta, IDataProviderLookup dataProviderLookup, IScriptExecuter el, boolean printing) {
IComponent comp = null;
switch(meta.getTypeID()) {
case IRepository.FIELDS:
comp = createField(application, form, (Field) meta, dataProviderLookup, el, printing);
break;
case IRepository.GRAPHICALCOMPONENTS:
comp = createGraphicalComponent(application, form, (GraphicalComponent) meta, el, dataProviderLookup);
break;
case IRepository.RECTSHAPES:
comp = createRectangle(application, form, (RectShape) meta);
break;
case IRepository.PORTALS:
comp = createPortal(application, form, (Portal) meta, dataProviderLookup, el, printing);
break;
case IRepository.PARTS:
comp = createPart(application, (Part) meta);
break;
case IRepository.TABPANELS:
TabPanel tabPanelMeta = (TabPanel) meta;
int orient = tabPanelMeta.getTabOrientation();
if (orient == TabPanel.SPLIT_HORIZONTAL || orient == TabPanel.SPLIT_VERTICAL)
comp = createSplitPane(application, form, tabPanelMeta, el);
else
comp = createTabPanel(application, form, tabPanelMeta, el);
break;
case IRepository.BEANS:
comp = createBean(application, form, (Bean) meta, null);
break;
case IRepository.WEBCOMPONENTS:
comp = createWebComponentPlaceholder(application, form, (WebComponent) meta);
break;
default:
Debug.error("ComponentFactory:unkown type " + meta.getTypeID() + ", uuid: " + meta.getUUID() + ", parent:" + meta.getParent());
IStandardLabel label = application.getItemFactory().createLabel(getWebID(form, meta), "ComponentFactory:unkown type " + meta.getTypeID());
label.setSize(new Dimension(200, 20));
comp = label;
}
if (comp instanceof JComponent) {
((JComponent) comp).putClientProperty("Id", ComponentFactory.getWebID(form, meta));
}
return comp;
}
Aggregations