use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class FormLookupPanel method createFormPanel.
private FormController createFormPanel() {
FormManager fm = (FormManager) application.getFormManager();
FormController fp = fm.getFormController(formName, this);
if (fp != null) {
IFormUIInternal ui = fp.getFormUI();
if (ui instanceof Component) {
add((Component) ui, BorderLayout.CENTER);
// just to be sure the cardlayout of main panel does return them as not visible
ui.setComponentVisible(true);
// delegate readOnly, really set it once from the form manager state
fp.setReadOnly(fm.isFormReadOnly(formName));
Container con = getParent();
if (con != null && (con instanceof ITabPaneAlike) && !con.isEnabled()) {
// reaply the isEnabled state of the tabpanel to its child tabs (tabs are added after enabled state is set); only if the tabpanel is disabled
this.setEnabled(con.isEnabled());
}
while (con != null) {
if (con instanceof IFormUIInternal) {
fp.getUndoManager().setFormUndoManager(((IFormUIInternal) con).getUndoManager());
break;
}
con = con.getParent();
}
// invalidate later so that everything is first visible (like the datamodel of a tableview)
application.invokeLater(new Runnable() {
public void run() {
validate();
}
});
}
}
return fp;
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class FormLookupPanel method notifyVisible.
/**
* This method must be called on the event thread
*/
public boolean notifyVisible(boolean visible, List invokeLaterRunnables) {
Component[] childs = getComponents();
if (childs.length == 1) {
IFormUIInternal ui = (IFormUIInternal) childs[0];
FormController child = ui.getController();
return child.notifyVisible(visible, invokeLaterRunnables);
}
return true;
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class SpecialSplitPane method showFoundSet.
private void showFoundSet(FormLookupPanel flp, IRecordInternal parentState, List<SortColumn> sort) {
deregisterSelectionListeners();
if (!flp.isReady())
return;
try {
FormController fp = flp.getFormPanel();
if (fp != null && flp.getRelationName() != null) {
IFoundSetInternal relatedFoundSet = parentState == null ? null : parentState.getRelatedFoundSet(flp.getRelationName(), sort);
registerSelectionListeners(parentState, flp.getRelationName());
fp.loadData(relatedFoundSet, null);
}
} catch (RuntimeException re) {
application.handleException("Error setting the foundset of the relation " + flp.getRelationName() + " on the tab with form " + flp.getFormName(), re);
throw re;
}
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class SpecialTabPanel method addTab.
public boolean addTab(IForm formController, String formName, String tabname, String tabText, String tooltip, String iconURL, String fg, String bg, String relationName, RelatedFoundSet relatedFs, int idx) {
// on the form that the tabpanel is placed on
if (formController != null) {
Container parent = getParent();
while (!(parent instanceof SwingForm) && parent != null) {
parent = parent.getParent();
}
if (parent != null) {
FormController parentFormController = ((SwingForm) parent).getController();
if (parentFormController != null && parentFormController.equals(formController)) {
return false;
}
}
}
FormLookupPanel flp = (FormLookupPanel) createFormLookupPanel(tabname, relationName, formName);
if (formController != null)
flp.setReadOnly(formController.isReadOnly());
Icon icon = null;
if (// $NON-NLS-1$
iconURL != null && !"".equals(iconURL)) {
try {
URL url = new URL(iconURL);
icon = new ImageIcon(url);
} catch (Exception e) {
Debug.error(e);
}
}
int tabIndex = idx;
if (tabIndex == -1 || tabIndex >= enclosingComponent.getTabCount()) {
tabIndex = enclosingComponent.getTabCount();
addTab(application.getI18NMessageIfPrefixed(tabText), icon, flp, application.getI18NMessageIfPrefixed(tooltip));
} else {
insertTab(application.getI18NMessageIfPrefixed(tabText), icon, flp, application.getI18NMessageIfPrefixed(tooltip), tabIndex);
}
if (fg != null)
setTabForegroundAt(tabIndex, PersistHelper.createColor(fg));
if (bg != null)
setTabBackgroundAt(tabIndex, PersistHelper.createColor(bg));
if (relatedFs != null && enclosingComponent.getSelectedComponent() == flp) {
FormController fp = flp.getFormPanel();
if (fp != null && flp.getRelationName() != null && flp.getRelationName().equals(relationName)) {
fp.loadData(relatedFs, null);
}
}
return true;
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class WebTabPanel method addTab.
public boolean addTab(IForm formController, String formName, String tabname, String tabText, String tabtooltip, String iconURL, String fg, String bg, String relationName, RelatedFoundSet relatedFs, int idx) {
if (formController != null) {
// to make sure we don't have recursion on adding a tab, to a tabpanel, that is based
// on the form that the tabpanel is placed on
WebForm webForm = findParent(WebForm.class);
if (webForm != null) {
FormController parentFormController = webForm.getController();
if (parentFormController != null && parentFormController.equals(formController)) {
return false;
}
}
}
WebTabFormLookup flp = (WebTabFormLookup) createFormLookupPanel(tabname, relationName, formName);
if (formController != null)
flp.setReadOnly(formController.isReadOnly());
FlattenedSolution fl = application.getFlattenedSolution();
int mediaId = -1;
if (iconURL != null && !"".equals(iconURL)) {
Media media = fl.getMedia(iconURL.replaceAll("media:///", ""));
if (media != null)
mediaId = media.getID();
if (mediaId == -1) {
Debug.warn("Form '" + formController.getName() + "' with tabpanel '" + this.name + "' has tabicon for tab '" + tabname + "'in with icon media url : " + iconURL + " not found");
}
}
byte[] iconData = (mediaId == -1 ? null : ComponentFactory.loadIcon(fl, new Integer(mediaId)));
int count = allTabs.size();
int tabIndex = idx;
if (tabIndex == -1 || tabIndex >= count) {
tabIndex = count;
}
insertTab(application.getI18NMessageIfPrefixed(tabText), iconData, flp, application.getI18NMessageIfPrefixed(tabtooltip), tabIndex, true);
if (fg != null)
setTabForegroundAt(tabIndex, PersistHelper.createColor(fg));
if (bg != null)
setTabBackgroundAt(tabIndex, PersistHelper.createColor(bg));
// from the relatedFs - which is already in the relationName param
if (relatedFs != null && currentForm == flp) {
FormController fp = flp.getWebForm().getController();
if (fp != null && flp.getRelationName() != null && flp.getRelationName().equals(relationName)) {
fp.loadData(relatedFs, null);
}
}
return true;
}
Aggregations