use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class WebDataRenderer method getParentViewBgColor.
private String getParentViewBgColor() {
if (parentView != null) {
String rowBGColorCalculation = parentView.getRowBGColorScript();
IRecordInternal rec = (IRecordInternal) getDefaultModelObject();
if (rec != null && rec.getRawData() != null) {
IFoundSetInternal parentFoundSet = rec.getParentFoundSet();
int recIndex = parentFoundSet.getSelectedIndex();
boolean isSelected = recIndex == parentFoundSet.getRecordIndex(rec);
if (rowBGColorCalculation != null) {
Object bg_color = null;
if (rec.getRawData().containsCalculation(rowBGColorCalculation)) {
// data renderer is always on the selected index.
bg_color = parentFoundSet.getCalculationValue(rec, rowBGColorCalculation, Utils.arrayMerge(new Object[] { new Integer(recIndex), new Boolean(isSelected), null, null, Boolean.FALSE }, Utils.parseJSExpressions(parentView.getRowBGColorArgs())), null);
} else {
try {
FormController currentForm = dataAdapterList.getFormController();
bg_color = currentForm.executeFunction(rowBGColorCalculation, Utils.arrayMerge(new Object[] { new Integer(parentFoundSet.getSelectedIndex()), new Boolean(isSelected), null, null, currentForm.getName(), rec, Boolean.FALSE }, Utils.parseJSExpressions(parentView.getRowBGColorArgs())), true, null, true, null);
} catch (Exception ex) {
Debug.error(ex);
}
}
if (bg_color != null && !(bg_color.toString().trim().length() == 0) && !(bg_color instanceof Undefined)) {
return bg_color.toString();
}
}
if (parentView instanceof ISupportRowStyling) {
ISupportRowStyling parentViewWithRowStyling = (ISupportRowStyling) parentView;
IStyleSheet ss = parentViewWithRowStyling.getRowStyleSheet();
IStyleRule style = isSelected ? parentViewWithRowStyling.getRowSelectedStyle() : null;
if (style != null && style.getAttributeCount() == 0)
style = null;
if (style == null) {
style = (recIndex % 2 == 0) ? parentViewWithRowStyling.getRowEvenStyle() : parentViewWithRowStyling.getRowOddStyle();
}
if (ss != null && style != null) {
return PersistHelper.createColorString(ss.getBackground(style));
}
}
}
}
return null;
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class WebTabPanel method notifyVisible.
public void notifyVisible(boolean visible, List<Runnable> invokeLaterRunnables) {
if (currentForm == null && allTabs.size() > 0) {
WebTabHolder holder = allTabs.get(0);
setCurrentForm(holder.getPanel(), -1, invokeLaterRunnables);
}
if (currentForm != null && currentForm.getWebForm() != null) {
FormController controller = currentForm.getWebForm().getController();
// this is not needed when closing
if (visible && parentData != null) {
showFoundSet(currentForm, parentData, controller.getDefaultSortColumns());
// Test if current one is there
if (currentForm.isReady()) {
if (WebTabPanel.this.get(currentForm.getWebForm().getId()) != null) {
// replace it
WebTabPanel.this.replace(currentForm.getWebForm());
} else {
// else add it
WebTabPanel.this.add(currentForm.getWebForm());
}
recomputeTabSequence();
}
}
controller.notifyVisible(visible, invokeLaterRunnables);
}
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class WebSplitPane method notifyResized.
public void notifyResized() {
for (int i = 0; i < 2; i++) {
if (webTabs[i] != null && webTabs[i].getPanel().isReady()) {
WebForm webForm = webTabs[i].getPanel().getWebForm();
FormController controller = webForm.getController();
if (controller != null && webForm.isFormWidthHeightChanged()) {
controller.notifyResized();
webForm.clearFormWidthHeightChangedFlag();
}
}
}
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class WebSplitPane method notifyVisibleForm.
private boolean notifyVisibleForm(boolean visible, int tabIdx, List<Runnable> invokeLaterRunnables) {
if (webTabs[tabIdx] != null) {
WebTabFormLookup fl = webTabs[tabIdx].getPanel();
FormController controller = fl.getWebForm().getController();
// this is not needed when closing
if (visible) {
if (parentData != null)
showFoundSet(fl, parentData, controller.getDefaultSortColumns());
// Test if current one is there
if (fl.isReady()) {
if (splitComponents[tabIdx].get(fl.getWebForm().getId()) != null) {
// replace it
splitComponents[tabIdx].replace(fl.getWebForm());
} else {
// else add it
splitComponents[tabIdx].add(fl.getWebForm());
}
FormController fc = fl.getWebForm().getController();
if (tabIdx == 1 && webTabs[0] != null)
fc.recomputeTabSequence(leftPanelLastTabIndex);
else
fc.recomputeTabSequence(tabSequenceIndex);
}
}
return controller.notifyVisible(visible, invokeLaterRunnables);
}
return false;
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class WebSplitPane method showFoundSet.
private void showFoundSet(WebTabFormLookup flp, IRecordInternal parentState, List<SortColumn> sort) {
deregisterSelectionListeners();
if (!flp.isReady())
return;
FormController fp = flp.getWebForm().getController();
if (fp != null && flp.getRelationName() != null) {
IFoundSetInternal relatedFoundset = parentState == null ? null : parentState.getRelatedFoundSet(flp.getRelationName(), sort);
registerSelectionListeners(parentState, flp.getRelationName());
fp.loadData(relatedFoundset, null);
}
}
Aggregations