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);
}
}
use of com.servoy.j2db.FormController in project servoy-client by Servoy.
the class SwingFormManager method fillScriptMenu.
// fill the scripts menu
@Override
public void fillScriptMenu() {
JMenu menu = getScriptMenu();
// Remove old script methods.
menu.removeAll();
FlattenedSolution sol = getApplication().getFlattenedSolution();
if (sol.getSolution() == null)
return;
List<ScriptMenuItem> globalMenus = new ArrayList<ScriptMenuItem>();
int menuCount = 1;
Iterator<ScriptMethod> globalMethods = sol.getScriptMethods(true);
while (globalMethods.hasNext()) {
ScriptMethod sm = globalMethods.next();
ScriptMenuItem item = getScriptMenuItem(sm, new FunctionDefinition(ScriptVariable.SCOPES_DOT_PREFIX + sm.getScopeName(), sm.getName()), menuCount);
if (item != null) {
globalMenus.add(item);
if (menuCount > 0 && menuCount < 9) {
menuCount++;
} else {
menuCount = -1;
}
// just break after 50, doesn't make sense to have more in the menu..
if (globalMenus.size() > 50)
break;
}
}
JMenu globalMenu = menu;
if (// if big create sub menu for global methods
globalMenus.size() > 20) {
globalMenu = new JMenu(Messages.getString("servoy.formManager.menuGlobalMethods"));
menu.add(globalMenu);
}
Iterator<ScriptMenuItem> it = globalMenus.iterator();
while (it.hasNext()) {
ScriptMenuItem item = it.next();
globalMenu.add(item);
}
boolean insertSeparator = menu.getMenuComponentCount() > 0;
FormController fp = getCurrentMainShowingFormController();
if (fp != null) {
int nformmethods = 0;
Form form = fp.getForm();
Iterator<ScriptMethod> formMethods = form.getScriptMethods(true);
while (formMethods.hasNext()) {
ScriptMethod sm = formMethods.next();
ScriptMenuItem item = getScriptMenuItem(sm, new FunctionDefinition(form.getName(), sm.getName()), -1);
if (item != null) {
if (insertSeparator) {
menu.add(new JSeparator());
insertSeparator = false;
}
nformmethods++;
menu.add(item);
}
}
if (form.getDataSource() != null) {
insertSeparator |= nformmethods > 0;
Iterator<ScriptMethod> foundsetMethods = fp.getApplication().getFlattenedSolution().getFoundsetMethods(fp.getDataSource(), true);
while (foundsetMethods.hasNext()) {
ScriptMethod sm = foundsetMethods.next();
ScriptMenuItem item = getScriptMenuItem(sm, new FunctionDefinition(form.getName(), sm.getName()), -1);
if (item != null) {
if (insertSeparator) {
menu.add(new JSeparator());
insertSeparator = false;
}
menu.add(item);
}
}
}
}
menu.setEnabled(menu.getMenuComponentCount() > 0);
}
Aggregations