public interface FormContextI extends BreadcrumbContextI, de.ipcon.swing.ToastDisplayI, L10nApplicatorI, SchemaLocaleChangeListenerI
These contexts can be hierarchically linked together. This allows for the representation of complex data connections. For example, it can be used for true sub-forms within their own windows.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.ThreadLocal<DefaultBreadcrumbFinder> |
BREADCRUMB_FINDER_FOR_THREAD |
| Modifier and Type | Method and Description |
|---|---|
void |
addFormContextListener(FormContextListenerI l) |
void |
addSubContext(FormContextI a) |
void |
afterSave() |
default boolean |
anyContextHasLocalizedAttribute()
Convenience method to check if any context in the hierarchy (including this one)
contains a form element that has a localized attribute.
|
default boolean |
anyContextMatches(java.util.function.Predicate<FormContextI> filter)
Checks if at least one context in the hierarchy matches the given predicate.
|
void |
appendThisAndAllSubContexts(java.util.List<FormContextI> l) |
default java.lang.String |
applyL10n(java.lang.String s) |
void |
applyScriptParameters(java.util.Map m) |
void |
beforeSave() |
boolean |
boWasChangedExternally() |
VisibilityI |
cacheVisibility(VisibilityI v) |
void |
clearCachedVisibility() |
void |
clearTransaction() |
void |
close() |
FormContextI |
createSubFormContext() |
void |
disableConflictCheckDuringSave()
Don't ignore conflicts during saving anymore if previously enabled.
|
void |
enableConflictCheckDuringSave()
Registers a default
FormContextSaveHandlerI that doesn't ignore conflicts during saving. |
static DefaultBreadcrumbFinder |
enterBreadcrumb(FormContextI ftx)
Establishes a new breadcrumb context for the current thread and returns the associated finder.
|
static void |
exitBreadcrumb(FormContextI ftx)
Clears the breadcrumb context for the current thread.
|
default java.util.List<FormContextI> |
findContexts(java.util.function.Predicate<FormContextI> filter)
Finds and returns all contexts in the hierarchy that match the given predicate.
|
default FormElementI |
findNearestParentElement(java.lang.Class<? extends FormElementI> ofType)
searches upwards through the form context for the next parent of the given type, and returns it.
|
default FormElementI |
findOnlyFormElement(java.lang.Class<? extends FormElementI> ofType)
Find and return the only form element of the given type in the entire form context.
|
default void |
forEachContext(java.util.function.Consumer<FormContextI> action)
Traverses this context and all sub-contexts recursively, performing the given action.
|
default boolean |
formElementHasLocalizedAttribute()
Internal check for a single context to see if its element is locale-aware
and currently has a localized attribute.
|
java.util.LinkedHashMap |
getAllActionsOfKind(int kind) |
FormElementI |
getAt(java.lang.String n) |
Transaction.Savepoint |
getBeforeUserChangesSavepoint() |
BO |
getBO() |
BO |
getBO(boolean _synchronized) |
BOLoaderI |
getBOLoader() |
BO[] |
getBOs() |
default BO |
getContextBO()
Gets the associated business object for this specific context, returning the value directly.
|
ClientContextI |
getCtx() |
DBManEventProviderI |
getEventProvider() |
FormElementI |
getFormElement() |
java.awt.Component |
getIconContextObject() |
javax.swing.JRootPane |
getJRootPane() |
EntityI |
getLowestCommonDenominateEntity() |
FormElementI |
getNamedElement(java.lang.String n) |
FormContextI |
getParent() |
default BreadcrumbContextI |
getParentBreadcrumbContext()
Gets the parent context of the current context, returning the value directly.
|
java.lang.String |
getPath() |
void |
getPath(java.lang.StringBuilder s) |
default FormContextI |
getRoot()
Retrieves the top-level
FormContextI (i.e. the one with no parent). |
javax.swing.RootPaneContainer |
getRootPaneContainer() |
FormContextSaveHandlerI |
getSaveHandler() |
BeanShellScript |
getScript() |
java.util.Map |
getScriptParameters() |
java.util.List<FormContextI> |
getSubContexts() |
java.util.Iterator<FormContextI> |
getSubContextsIterator() |
FormContextI[] |
getThisAndAllSubContextsAsArray() |
Transaction |
getTransaction() |
VisibilityI |
getVisibility() |
boolean |
hasCachedVisibility() |
boolean |
hasScript() |
boolean |
hasUnsavedFormData() |
boolean |
hasUnsavedUserData() |
void |
initScript() |
void |
invalidateAllSubContextsCache() |
boolean |
isClosed() |
default boolean |
isRoot()
Checks if this is the top-level context (no parent).
|
boolean |
isSyncEventHandlingPaused()
If true, then {link #sync()} calls for this element should be ignored, e.g. because the form is currently saving.
|
void |
mdiActivate(MDIElementI me) |
void |
mdiClose(MDIElementI me) |
void |
mdiDeactivate(MDIElementI me) |
void |
mdiOpen(MDIElementI me) |
boolean |
pauseFiringNewProcs()
Creates a token to pause updating the GUI with changes in the Transaction for a while.
|
void |
refreshBO(FormContextI _realFtx,
java.lang.String _propertyname,
boolean _transactionControl,
boolean _autoCreate,
electric.xml.Element _confRoot) |
void |
refreshForms()
Refreshes the form-parts that belong to this FormContextI and all subforms that belong to
any subcontext of this FormContextI.
|
void |
refreshForms(int from)
Refreshes the form-parts that belong to this FormContextI and all subforms that belong to
any subcontext of this FormContextI.
|
void |
refreshForms(int from,
long onlyBOId,
long ifNotSince)
Refreshes the form-parts that belong to this FormContextI and all subforms that belong to
any subcontext of this FormContextI.
|
void |
refreshFormsFromInitialViewRefresh()
Refreshes the form-parts that belong to this FormContextI and all subforms that belong to
any subcontext of this FormContextI in the context of an initial view refresh.
|
void |
refreshView()
Only refreshes the window titles and other 'outside' stuff, not the form itself or parts of it.
|
void |
removeAllFormContextListeners() |
void |
removeFormContextListener(FormContextListenerI l) |
void |
removeSubContext(FormContextI a) |
boolean |
replaceDetailViewBO(BO bo)
Updates the form context to point to a new primary Business Object (BO) for the detail view.
|
void |
resetBOWasChangedExternally() |
boolean |
resumeFiringNewProcs()
Resumes updates to the GUI after a previous call of pauseFiringNewProcs(),
unless updates are inh, due to changes in the Transaction for a while.
|
boolean |
saveFormData() |
boolean |
saveFormData(boolean willCloseRightAfter) |
default void |
schemaLocaleChanged(java.util.Locale oldLocale,
java.util.Locale newLocale) |
void |
setBeforeUserChangesSavepoint(Transaction.Savepoint _sp) |
boolean |
setBO(BO bo) |
void |
setBOLoader(BOLoaderI bol) |
void |
setEditable(boolean b) |
void |
setEditable(boolean b,
boolean dontRefresh) |
void |
setFormElement(FormElementI j) |
void |
setJRootPane(javax.swing.JRootPane rp) |
void |
setLowestCommonDenominateEntity(EntityI ent) |
void |
setNamedElement(java.lang.String n,
FormElementI e) |
void |
setParent(FormContextI a) |
void |
setRootPaneContainer(javax.swing.RootPaneContainer rpc) |
void |
setSaveHandler(FormContextSaveHandlerI sh) |
void |
setScript(BeanShellScript b) |
void |
setTransaction(Transaction tx) |
void |
setVisibilityTransient() |
void |
startListeningNewProcs()
internal
|
void |
sync()
Synchronize the data of the form and the model
|
boolean |
tryFocus()
Attempts to set the keyboard focus to an appropriate component within this
form context.
|
findFirstBO, findFirstBOOfType, findFirstBOWhere, findParentBOstatic final java.lang.ThreadLocal<DefaultBreadcrumbFinder> BREADCRUMB_FINDER_FOR_THREAD
static DefaultBreadcrumbFinder enterBreadcrumb(FormContextI ftx)
This method should be called before a form element's attribute accessor (getter, setter, etc.) is called to enable breadcrumb navigation in the form contexts of the current view/UI.
It retrieves the thread-local finder, initializing a new one if it doesn't exist. It then
sets the provided FormContextI as the starting context for the finder, but only if
the finder's context is not already set. This prevents overwriting an existing context, which
is crucial for nested accessor calls, as only the initial starting point in the structure
shall be the starting point of the breadcrumb navigation.
Moreover, the ThreadLocal is by choice not an InheritableThreadLocal, as any threads that are spawned off the accessor should be ignorant of the breadcrumb navigation. They may run in parallel or longer than the parent thread, posing the risk of the parent thread being reused for a new accessor call that changes the value of the InheritableThreadLocal for the spawned thread, thus creating a false Breadcrumb navigation for that child thread.
If the context is successfully set, this method also updates the thread-local
finder in the Breadcrumb convenience class, providing a static entry point
for forms to access the current breadcrumb context finder.
ftx - The FormContextI instance associated with the current form element.DefaultBreadcrumbFinder instance associated with the current thread.static void exitBreadcrumb(FormContextI ftx)
This method should be called after a form element's attribute accessor call has
ended (preferably in a finally block) to clear the thread-local context. It
retrieves the finder for the current thread and attempts to clear its context, but
only if it matches the provided FormContextI instance. This prevents
unintended side effects in nested contexts by ensuring only the correct context is
cleared.
ftx - The FormContextI instance for which the breadcrumb context for
the current thread is to be cleared.default java.lang.String applyL10n(java.lang.String s)
applyL10n in interface L10nApplicatorIClientContextI getCtx()
java.awt.Component getIconContextObject()
FormContextI getParent()
void setParent(FormContextI a)
default boolean isRoot()
true if this is the root; false otherwise.default FormContextI getRoot()
FormContextI (i.e. the one with no parent).
Groovy Note: Use the explicit getRoot() notation to
avoid implicit conflicts with isRoot().
java.lang.String getPath()
void getPath(java.lang.StringBuilder s)
FormElementI getNamedElement(java.lang.String n)
void setNamedElement(java.lang.String n,
FormElementI e)
FormElementI getAt(java.lang.String n)
FormContextI createSubFormContext()
void addSubContext(FormContextI a)
void removeSubContext(FormContextI a)
java.util.List<FormContextI> getSubContexts()
java.util.Iterator<FormContextI> getSubContextsIterator()
FormContextI[] getThisAndAllSubContextsAsArray()
void appendThisAndAllSubContexts(java.util.List<FormContextI> l)
void invalidateAllSubContextsCache()
default void forEachContext(java.util.function.Consumer<FormContextI> action)
action - The operation to perform on each context in the hierarchy.default java.util.List<FormContextI> findContexts(java.util.function.Predicate<FormContextI> filter)
filter - The condition to check against each context.default boolean anyContextMatches(java.util.function.Predicate<FormContextI> filter)
Utilizes the cached array returned by getThisAndAllSubContextsAsArray()
for performance. This method returns immediately upon finding the first match.
filter - The condition to check against each context.true if any context matches the filter; false otherwise.default boolean anyContextHasLocalizedAttribute()
true if a localized attribute is found in the hierarchy.default boolean formElementHasLocalizedAttribute()
default void schemaLocaleChanged(java.util.Locale oldLocale,
java.util.Locale newLocale)
schemaLocaleChanged in interface SchemaLocaleChangeListenerIEntityI getLowestCommonDenominateEntity()
void setLowestCommonDenominateEntity(EntityI ent)
BO getBO()
BO getBO(boolean _synchronized)
boolean setBO(BO bo)
boolean replaceDetailViewBO(BO bo)
This method determines if the provided bo is different from the currently
active one. If a change is detected, it updates the internal reference.
Usage Note: Callers should use the return value to decide if subsequent actions (like repainting the UI or firing event listeners) are necessary.
bo - The new Business Object to set as the active detail.true if the internal state was changed (i.e. the new bo
was different from the previous one); false if they were identical
and no update occurred.BO[] getBOs()
void setEditable(boolean b)
void setEditable(boolean b,
boolean dontRefresh)
javax.swing.JRootPane getJRootPane()
void setJRootPane(javax.swing.JRootPane rp)
void setRootPaneContainer(javax.swing.RootPaneContainer rpc)
javax.swing.RootPaneContainer getRootPaneContainer()
void setFormElement(FormElementI j)
FormElementI getFormElement()
default FormElementI findOnlyFormElement(java.lang.Class<? extends FormElementI> ofType)
ofType - the type of form element to look fordefault FormElementI findNearestParentElement(java.lang.Class<? extends FormElementI> ofType)
ofType - the type of form element to look fordefault BreadcrumbContextI getParentBreadcrumbContext()
BreadcrumbContextIgetParentBreadcrumbContext in interface BreadcrumbContextInull if there is no parent.default BO getContextBO()
BreadcrumbContextIgetContextBO in interface BreadcrumbContextInull if this context has no business object.VisibilityI cacheVisibility(VisibilityI v)
void setVisibilityTransient()
boolean hasCachedVisibility()
VisibilityI getVisibility()
void clearCachedVisibility()
void mdiOpen(MDIElementI me)
void mdiClose(MDIElementI me)
void mdiActivate(MDIElementI me)
void mdiDeactivate(MDIElementI me)
java.util.LinkedHashMap getAllActionsOfKind(int kind)
void initScript()
void setScript(BeanShellScript b)
BeanShellScript getScript()
boolean hasScript()
java.util.Map getScriptParameters()
void applyScriptParameters(java.util.Map m)
void setTransaction(Transaction tx)
Transaction getTransaction()
void clearTransaction()
void setBOLoader(BOLoaderI bol)
BOLoaderI getBOLoader()
boolean pauseFiringNewProcs()
boolean resumeFiringNewProcs()
void startListeningNewProcs()
FormContextSaveHandlerI getSaveHandler()
void setSaveHandler(FormContextSaveHandlerI sh)
boolean hasUnsavedFormData()
boolean hasUnsavedUserData()
boolean boWasChangedExternally()
void resetBOWasChangedExternally()
void sync()
boolean isSyncEventHandlingPaused()
void beforeSave()
void afterSave()
boolean saveFormData(boolean willCloseRightAfter)
boolean saveFormData()
with parameter falsevoid enableConflictCheckDuringSave()
FormContextSaveHandlerI that doesn't ignore conflicts during saving. Activate ins forms with [Tabbed]View conflictPolicy="ASK"
void disableConflictCheckDuringSave()
void refreshView()
Basically only part of the API because of internal reasons (the MDIManager needs access).
void refreshForms()
void refreshForms(int from)
from - An integer representing the source of the refreshForms request.
May be one of FormElementI.REFRESH_FROM_USER or
FormElementI.REFRESH_FROM_TRANSACTION.
Defaults to FormElementI.REFRESH_FROM_USER.void refreshForms(int from,
long onlyBOId,
long ifNotSince)
from - An integer representing the source of the refreshForms request.
May be one of FormElementI.REFRESH_FROM_USER or
FormElementI.REFRESH_FROM_TRANSACTION.
Defaults to FormElementI.REFRESH_FROM_USER.onlyBOId - A long. If specified and positive, the refresh will only be done for
the Business Object (BO) having the given Id.
Defaults to 0, meaning no specific BO ID filter.ifNotSince - A long specifying a point in time (in milliseconds since epoch).
A refresh will only be performed if the internally stored last refresh
time is earlier (smaller) than this given time.
Defaults to System.currentTimeMillis().void refreshFormsFromInitialViewRefresh()
boolean tryFocus()
The specific component that receives focus (if any) and the criteria for success are determined by the implementation. This method might recursively delegate the focus attempt to sub-contexts.
true if focus was successfully requested by a component
within this context, false otherwise.void close()
boolean isClosed()
void addFormContextListener(FormContextListenerI l)
void removeFormContextListener(FormContextListenerI l)
void removeAllFormContextListeners()
DBManEventProviderI getEventProvider()
Transaction.Savepoint getBeforeUserChangesSavepoint()
void setBeforeUserChangesSavepoint(Transaction.Savepoint _sp)
void refreshBO(FormContextI _realFtx, java.lang.String _propertyname, boolean _transactionControl, boolean _autoCreate, electric.xml.Element _confRoot)
Copyright © 2000-2026 OAshi S.à r.l. All Rights Reserved.