- java.lang.Object
-
- org.tentackle.fx.FxControlDelegate
-
- All Implemented Interfaces:
FxControl
- Direct Known Subclasses:
FxComponentDelegate,FxContainerDelegate
public abstract class FxControlDelegate extends java.lang.Object implements FxControl
Base implementation for all fx delegates.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description FxControlDelegate()Creates a control delegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddModelToViewListener(ModelToViewListener listener)Adds a model-to-view listener.
The listener will be invoked before the binding operation.
If the control is a container, the listener will be invoked if any of the container's components get updated.voidaddViewToModelListener(ViewToModelListener listener)Adds a view-to-model listener.
The listener will be invoked after the binding operation.
If the control is a container, the listener will be invoked if any of the container's components update the model.javafx.beans.property.ReadOnlyBooleanPropertychangeableProperty()Gets the changaeble property.protected javafx.beans.property.ReadOnlyBooleanWrappercreateChangeableProperty(boolean changeable)Creates the changeable property.voidfireModelToViewListeners()Fires all model-to-view listeners.voidfireViewToModelListeners()Fires all model-to-view listeners.FxControlDelegategetDelegate()Gets the lazily created component delegate.java.lang.StringgetHelpUrl()Gets the online-help URL.java.util.Collection<ModelToViewListener>getModelToViewListeners()Gets the model-to-view listeners with lazy collection creation.java.util.Collection<ViewToModelListener>getViewToModelListeners()Gets the view-to-model listeners with lazy collection creation.booleanisBindable()Determines whether this container is bindable.booleanisChangeable()Returns if this control is changeable.booleanisContainerChangeableIgnored()Returns whether setContainerChangeable is ignored by this control.protected booleanisControlChangeable()Gets the last intended changeability for this control.
Might differ from effective changeability if container changed its changeability.booleanisViewModified()Returns whether the user has modified the view since the lastFxControl.updateView().voidremoveModelToViewListener(ModelToViewListener listener)Removes a model-to-view listener.voidremoveViewToModelListener(ViewToModelListener listener)Removes a view-to-model listener.voidsetBindable(boolean bindable)Sets whether this control is bindable, i.e.voidsetChangeable(boolean changeable)Set the control to be changeable.
This is a unified abstraction and will be translated to setEditable or setDisabled, whatever is appropriate to this control.voidsetContainerChangableIgnored(boolean containerChangeableIgnored)Sets whether to ignore setContainerChangeable.voidsetHelpUrl(java.lang.String helpUrl)Sets the online-help URL.
If a help url is set, a browser will be launched to show that url if there is no help url for the control the help was requested for.voidsetViewModified(boolean viewModified)Sets whether the view has been modified.voidshowHelp()Displays online help if configured.protected voidupdateChangeable(boolean changeable)Updates other properties if changeable is bound to something else.javafx.beans.property.BooleanPropertyviewModifiedProperty()Gets the viewModified property.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tentackle.fx.FxControl
getParentContainer, invalidateSavedView, saveView, setContainerChangeable, toGenericString, triggerViewModified, updateModel, updateView
-
-
-
-
Method Detail
-
getDelegate
public FxControlDelegate getDelegate()
Description copied from interface:FxControlGets the lazily created component delegate.- Specified by:
getDelegatein interfaceFxControl- Returns:
- the delegate
-
setViewModified
public void setViewModified(boolean viewModified)
Description copied from interface:FxControlSets whether the view has been modified.- Specified by:
setViewModifiedin interfaceFxControl- Parameters:
viewModified- true if user has modified the visual representation
-
isViewModified
public boolean isViewModified()
Description copied from interface:FxControlReturns whether the user has modified the view since the lastFxControl.updateView().- Specified by:
isViewModifiedin interfaceFxControl- Returns:
- true if user changed the visual representation
-
viewModifiedProperty
public javafx.beans.property.BooleanProperty viewModifiedProperty()
Description copied from interface:FxControlGets the viewModified property.- Specified by:
viewModifiedPropertyin interfaceFxControl- Returns:
- the property
-
setChangeable
public void setChangeable(boolean changeable)
Description copied from interface:FxControlSet the control to be changeable.
This is a unified abstraction and will be translated to setEditable or setDisabled, whatever is appropriate to this control.- Specified by:
setChangeablein interfaceFxControl- Parameters:
changeable- true the user can edit the data, false if show only
-
isControlChangeable
protected boolean isControlChangeable()
Gets the last intended changeability for this control.
Might differ from effective changeability if container changed its changeability.- Returns:
- the control's changeability regardless of the effective changeability
-
isChangeable
public boolean isChangeable()
Description copied from interface:FxControlReturns if this control is changeable.- Specified by:
isChangeablein interfaceFxControl- Returns:
- true the user can edit the data, false if show only
-
changeableProperty
public javafx.beans.property.ReadOnlyBooleanProperty changeableProperty()
Description copied from interface:FxControlGets the changaeble property.- Specified by:
changeablePropertyin interfaceFxControl- Returns:
- the property
-
updateChangeable
protected void updateChangeable(boolean changeable)
Updates other properties if changeable is bound to something else.- Parameters:
changeable- the flag
-
createChangeableProperty
protected javafx.beans.property.ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable)
Creates the changeable property.- Parameters:
changeable- the initial value- Returns:
- the property
-
setContainerChangableIgnored
public void setContainerChangableIgnored(boolean containerChangeableIgnored)
Description copied from interface:FxControlSets whether to ignore setContainerChangeable.- Specified by:
setContainerChangableIgnoredin interfaceFxControl- Parameters:
containerChangeableIgnored- true if ignore, default is false
-
isContainerChangeableIgnored
public boolean isContainerChangeableIgnored()
Description copied from interface:FxControlReturns whether setContainerChangeable is ignored by this control.- Specified by:
isContainerChangeableIgnoredin interfaceFxControl- Returns:
- true if ignore
-
setBindable
public void setBindable(boolean bindable)
Description copied from interface:FxControlSets whether this control is bindable, i.e. should be checked within a binding hierarchy.- Specified by:
setBindablein interfaceFxControl- Parameters:
bindable- true if bindable, else not eligible for the binding process
-
isBindable
public boolean isBindable()
Description copied from interface:FxControlDetermines whether this container is bindable.- Specified by:
isBindablein interfaceFxControl- Returns:
- true if bindable, else not eligible for the binding process
-
setHelpUrl
public void setHelpUrl(java.lang.String helpUrl)
Description copied from interface:FxControlSets the online-help URL.
If a help url is set, a browser will be launched to show that url if there is no help url for the control the help was requested for.- Specified by:
setHelpUrlin interfaceFxControl- Parameters:
helpUrl- the help url
-
getHelpUrl
public java.lang.String getHelpUrl()
Description copied from interface:FxControlGets the online-help URL.- Specified by:
getHelpUrlin interfaceFxControl- Returns:
- the help url, default is null
-
showHelp
public void showHelp()
Description copied from interface:FxControlDisplays online help if configured.
-
addModelToViewListener
public void addModelToViewListener(ModelToViewListener listener)
Description copied from interface:FxControlAdds a model-to-view listener.
The listener will be invoked before the binding operation.
If the control is a container, the listener will be invoked if any of the container's components get updated.- Specified by:
addModelToViewListenerin interfaceFxControl- Parameters:
listener- the value listener to add
-
removeModelToViewListener
public void removeModelToViewListener(ModelToViewListener listener)
Description copied from interface:FxControlRemoves a model-to-view listener.- Specified by:
removeModelToViewListenerin interfaceFxControl- Parameters:
listener- the value listener to remove
-
addViewToModelListener
public void addViewToModelListener(ViewToModelListener listener)
Description copied from interface:FxControlAdds a view-to-model listener.
The listener will be invoked after the binding operation.
If the control is a container, the listener will be invoked if any of the container's components update the model.- Specified by:
addViewToModelListenerin interfaceFxControl- Parameters:
listener- the value listener to add
-
removeViewToModelListener
public void removeViewToModelListener(ViewToModelListener listener)
Description copied from interface:FxControlRemoves a view-to-model listener.- Specified by:
removeViewToModelListenerin interfaceFxControl- Parameters:
listener- the value listener to remove
-
getModelToViewListeners
public java.util.Collection<ModelToViewListener> getModelToViewListeners()
Gets the model-to-view listeners with lazy collection creation.- Returns:
- the listeners, never null
-
fireModelToViewListeners
public void fireModelToViewListeners()
Fires all model-to-view listeners.
-
getViewToModelListeners
public java.util.Collection<ViewToModelListener> getViewToModelListeners()
Gets the view-to-model listeners with lazy collection creation.- Returns:
- the listeners, never null
-
fireViewToModelListeners
public void fireViewToModelListeners()
Fires all model-to-view listeners.
-
-