Package dk.gtz.graphedit.viewmodel
Class ViewModelProjectResource
java.lang.Object
dk.gtz.graphedit.viewmodel.ViewModelProjectResource
- All Implemented Interfaces:
IFocusable
,javafx.beans.Observable
,javafx.beans.property.Property<ViewModelProjectResource>
,javafx.beans.property.ReadOnlyProperty<ViewModelProjectResource>
,javafx.beans.value.ObservableValue<ViewModelProjectResource>
,javafx.beans.value.WritableValue<ViewModelProjectResource>
public class ViewModelProjectResource
extends Object
implements IFocusable, javafx.beans.property.Property<ViewModelProjectResource>
View model representation of
ModelProjectResource
.
Full file-on-disk model. Will include everything a graphedit project file needs-
Constructor Summary
ConstructorsConstructorDescriptionViewModelProjectResource
(ModelProjectResource projectResource, ISyntaxFactory syntaxFactory) Constructs a new view model project resource based on the provided model project resourceViewModelProjectResource
(javafx.beans.property.MapProperty<String, String> metadata, ViewModelGraph syntax) Constructs a new view model project resource based on provided metadata and view model graph -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFocusListener
(Runnable focusEventHandler) Add an event listener for when the focus is stolenvoid
addListener
(javafx.beans.InvalidationListener listener) void
addListener
(javafx.beans.value.ChangeListener<? super ViewModelProjectResource> listener) void
addView
(IProjectResourceView viewer) Add a new view that displays this project resource.void
bind
(javafx.beans.value.ObservableValue<? extends ViewModelProjectResource> observable) void
bindBidirectional
(javafx.beans.property.Property<ViewModelProjectResource> other) void
focus()
Steal the focusgetBean()
getName()
Get the syntax name metadata field if it exists.Get the associated undo systemgetValue()
getViews()
Get the full list of views that are viewing this project resourceboolean
isBound()
metadata()
Get the metadata map propertyvoid
removeListener
(javafx.beans.InvalidationListener listener) void
removeListener
(javafx.beans.value.ChangeListener<? super ViewModelProjectResource> listener) void
removeView
(IProjectResourceView viewer) Remove a view that displays this project resource.void
setValue
(ViewModelProjectResource value) syntax()
Get the syntax graphtoModel()
Constructs a new model project resource instance based on the current view model valuesvoid
unbind()
void
unbindBidirectional
(javafx.beans.property.Property<ViewModelProjectResource> other) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javafx.beans.value.ObservableValue
flatMap, map, orElse, when
-
Constructor Details
-
ViewModelProjectResource
Constructs a new view model project resource based on the provided model project resource- Parameters:
projectResource
- The model project resource to base onsyntaxFactory
- The associated syntax factory
-
ViewModelProjectResource
public ViewModelProjectResource(javafx.beans.property.MapProperty<String, String> metadata, ViewModelGraph syntax) Constructs a new view model project resource based on provided metadata and view model graph- Parameters:
metadata
- A map of metadata, useful for storing properties that aren't necessarily part of the specificationsyntax
- The graph containing the model
-
-
Method Details
-
getUndoSystem
Get the associated undo system- Returns:
- An undo system
-
toModel
Constructs a new model project resource instance based on the current view model values- Returns:
- a new model project resource instance
-
addFocusListener
Description copied from interface:IFocusable
Add an event listener for when the focus is stolen- Specified by:
addFocusListener
in interfaceIFocusable
- Parameters:
focusEventHandler
- the handler to call
-
focus
public void focus()Description copied from interface:IFocusable
Steal the focus- Specified by:
focus
in interfaceIFocusable
-
metadata
Get the metadata map property- Returns:
- a mapping of strings to strings
-
getSyntaxName
Get the syntax name metadata field if it exists.- Returns:
- optionally a string with the name of the syntax. empty if is not present in the metadata field
-
syntax
Get the syntax graph- Returns:
- a view model graph
-
addView
Add a new view that displays this project resource.- Parameters:
viewer
- the tab that is currently viewing this project resource
-
removeView
Remove a view that displays this project resource. If the provided view is not present, the list remains unchanged.- Parameters:
viewer
- the tab that is currently viewing this project resource
-
getViews
Get the full list of views that are viewing this project resource- Returns:
- a list of tabs.
-
getBean
- Specified by:
getBean
in interfacejavafx.beans.property.ReadOnlyProperty<ViewModelProjectResource>
-
getName
- Specified by:
getName
in interfacejavafx.beans.property.ReadOnlyProperty<ViewModelProjectResource>
-
addListener
public void addListener(javafx.beans.value.ChangeListener<? super ViewModelProjectResource> listener) - Specified by:
addListener
in interfacejavafx.beans.value.ObservableValue<ViewModelProjectResource>
-
removeListener
public void removeListener(javafx.beans.value.ChangeListener<? super ViewModelProjectResource> listener) - Specified by:
removeListener
in interfacejavafx.beans.value.ObservableValue<ViewModelProjectResource>
-
getValue
- Specified by:
getValue
in interfacejavafx.beans.value.ObservableValue<ViewModelProjectResource>
- Specified by:
getValue
in interfacejavafx.beans.value.WritableValue<ViewModelProjectResource>
-
addListener
public void addListener(javafx.beans.InvalidationListener listener) - Specified by:
addListener
in interfacejavafx.beans.Observable
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener) - Specified by:
removeListener
in interfacejavafx.beans.Observable
-
setValue
- Specified by:
setValue
in interfacejavafx.beans.value.WritableValue<ViewModelProjectResource>
-
bind
- Specified by:
bind
in interfacejavafx.beans.property.Property<ViewModelProjectResource>
-
unbind
public void unbind()- Specified by:
unbind
in interfacejavafx.beans.property.Property<ViewModelProjectResource>
-
isBound
public boolean isBound()- Specified by:
isBound
in interfacejavafx.beans.property.Property<ViewModelProjectResource>
-
bindBidirectional
- Specified by:
bindBidirectional
in interfacejavafx.beans.property.Property<ViewModelProjectResource>
-
unbindBidirectional
- Specified by:
unbindBidirectional
in interfacejavafx.beans.property.Property<ViewModelProjectResource>
-