use of com.servoy.j2db.util.ITabPaneAlike 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.util.ITabPaneAlike in project servoy-client by Servoy.
the class SwingForm method getFormContext.
public JSDataSet getFormContext() {
SwingForm current = this;
FormLookupPanel currentLookupPanel = null;
SpecialTabPanel currentTabPanel = null;
String currentBeanName = null;
SpecialSplitPane currentSplitPane = null;
IDataSet set = new BufferedDataSet(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$
new String[] { "containername", "formname", "tabpanel/splitpane/accordion/beanname", "tabname", "tabindex", "tabindex1based" }, new ArrayList<Object[]>());
set.addRow(new Object[] { null, current.formController.getName(), null, null, null, null });
Container parent = getParent();
while (parent != null) {
if (parent instanceof SpecialTabPanel) {
currentTabPanel = (SpecialTabPanel) parent;
} else if (parent instanceof SpecialSplitPane) {
currentSplitPane = (SpecialSplitPane) parent;
} else if (parent instanceof FormLookupPanel) {
currentLookupPanel = (FormLookupPanel) parent;
} else if (parent instanceof IServoyAwareBean && parent instanceof IComponent) {
currentBeanName = ((IComponent) parent).getName();
} else if (parent instanceof SwingForm) {
current = (SwingForm) parent;
if (currentTabPanel != null) {
ITabPaneAlike panel = currentTabPanel.getEnclosingComponent();
int index = -1;
String tabName = null;
if (currentLookupPanel != null) {
index = panel.getTabIndex(currentLookupPanel);
if (index != -1) {
tabName = panel.getNameAt(index);
}
}
set.addRow(0, new Object[] { null, current.formController.getName(), currentTabPanel.getName(), tabName, new Integer(index), new Integer(index + 1) });
} else if (currentBeanName != null) {
set.addRow(0, new Object[] { null, current.formController.getName(), currentBeanName, null, null, null });
} else if (currentSplitPane != null) {
int idx = currentLookupPanel != null && currentLookupPanel.equals(currentSplitPane.getLeftForm()) ? 0 : 1;
set.addRow(0, new Object[] { null, current.formController.getName(), currentSplitPane.getName(), currentSplitPane.getTabNameAt(idx), new Integer(idx + 1), new Integer(idx + 1) });
} else {
set.addRow(0, new Object[] { null, current.formController.getName(), null, null, null, null });
}
currentBeanName = null;
currentTabPanel = null;
currentLookupPanel = null;
currentSplitPane = null;
} else if (parent instanceof MainPanel) {
String containerName = ((MainPanel) parent).getContainerName();
if (containerName != null) {
for (int i = 0; i < set.getRowCount(); i++) {
set.getRow(i)[0] = containerName;
}
}
return new JSDataSet(formController.getApplication(), set);
}
parent = parent.getParent();
}
return new JSDataSet(formController.getApplication(), set);
}
Aggregations