use of com.servoy.j2db.smart.MainPanel in project servoy-client by Servoy.
the class DebugJ2DBClient method destroyForm.
/**
* @param formController
* @return
*/
private void destroyForm(IFormController formController) {
refreshI18NMessages(true);
if (formController.isFormVisible()) {
IFoundSetInternal foundSet = formController.getFormModel();
if (foundSet instanceof FoundSet) {
((FoundSet) foundSet).refresh();
}
String name = null;
if (formController.getForm() != null)
name = formController.getForm().getName();
if (name == null)
name = formController.getName();
if (getFormManager().getCurrentForm() == formController) {
formController.destroy();
getFormManager().showFormInCurrentContainer(name);
} else {
SwingForm swingForm = (SwingForm) formController.getFormUI();
Container container = swingForm.getParent();
boolean isNavigator = false;
boolean isWindow = false;
boolean isLookupPanel = false;
if (container instanceof MainPanel) {
isNavigator = ((MainPanel) container).getNavigator() == formController;
} else if (container instanceof FormLookupPanel) {
isLookupPanel = true;
} else {
while (container != null && !(container instanceof FormWindow)) {
container = container.getParent();
}
if (container instanceof FormWindow) {
isWindow = true;
}
}
formController.destroy();
if (isLookupPanel) {
FormLookupPanel flp = (FormLookupPanel) container;
FormController newFormController = flp.getFormPanel();
if (newFormController != null) {
// deleted in developer ?
newFormController.loadData(foundSet, null);
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
newFormController.notifyVisible(true, invokeLaterRunnables);
Utils.invokeLater(this, invokeLaterRunnables);
}
} else if (isNavigator) {
// TODO isNavigator check will always be false for NGClient?
FormController navigator = ((FormManager) getFormManager()).getFormController(name, container);
if (navigator != null) {
navigator.loadData(foundSet, null);
List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
navigator.notifyVisible(true, invokeLaterRunnables);
Utils.invokeLater(this, invokeLaterRunnables);
}
mainPanel.setNavigator(navigator);
} else if (isWindow) {
// TODO isWindow check will always be false for NGClient?
FormWindow w = (FormWindow) container;
((FormManager) getFormManager()).showFormInMainPanel(name, w.getMainContainer(), w.getTitle(), false, w.getName());
}
}
} else {
formController.destroy();
}
return;
}
use of com.servoy.j2db.smart.MainPanel in project servoy-client by Servoy.
the class DataTextEditor method prepareForTextToolbarHandling.
private void prepareForTextToolbarHandling() {
addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
setTextToolBarComponent(null);
}
public void focusGained(FocusEvent e) {
if (eventExecutor.getValidationEnabled()) {
setTextToolBarComponent(enclosedComponent);
}
// else find mode...
}
});
addHierarchyListener(new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) == HierarchyEvent.PARENT_CHANGED) {
// get the new text toolbar to be used
Container parent = getParent();
while (parent != null && !(parent instanceof MainPanel)) {
parent = parent.getParent();
}
if (parent instanceof MainPanel) {
parentWindow = (SwingRuntimeWindow) application.getRuntimeWindowManager().getWindow(((MainPanel) parent).getContainerName());
} else {
parentWindow = null;
}
}
}
});
}
Aggregations