Package snap.view
Class ViewOwner
java.lang.Object
snap.props.PropObject
snap.view.ViewOwner
- All Implemented Interfaces:
PropChange.DoChange
- Direct Known Subclasses:
ColorPanel
,DefaultConsole
,DevPane
,DevPaneConsole
,DevPaneExceptions
,DevPaneFiles
,DevPaneGraphics
,DevPaneViewOwners
,DevPaneViews
,ExceptionReporter
,FilePanel
,FormBuilder
,GameController
,GameController.ToolBar
,RecentFiles
,ScanPane
,SpellCheckPanel
,TextPane
,WebSitePane
A base controller class that manages a UI View (usually loaded from a snp UI file).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final ViewEvent.Type
static final String
static final ViewEvent.Type
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addKeyActionFilter
(String aName, String aKey) Registers an event filter to send event with given name to owner.respondUI() on key press for key description.void
addKeyActionHandler
(String aName, String aKey) Registers an event handler to send event with given name to owner.respondUI() on key press for key description.void
addViewEventHandler
(Object anObj, EventListener aListener, ViewEvent.Type... theTypes) Adds an event handler (for given types) to view for given name or view.void
beep()
Plays a beep.protected void
Whether this ViewOwner should suppress the next automatic reset that normally happens after respondUI.protected View
createUI()
Creates the top level view for this class.protected View
createUIForClass
(Class<?> aClass) Creates the top level view for given class.void
dispatchEventToOwner
(ViewEvent anEvent) Sends an event to this ViewOwner through processEvent method.void
enableEvents
(Object anObj, ViewEvent.Type... theTypes) Deprecated.void
fireActionEventForObject
(Object anObj, ViewEvent parentEvent) Triggers and action event for a UI view (name or view).getEnv()
Returns the ViewEnv for this owner.Returns the first focus UI view for when window/dialog is made visible.Returns an image with given name or path from this class.Returns the native object for the UI (JComponent).getToggleGroup
(String aName) Return the toggle group for the given name (creating if needed).getUI()
Returns top level view.<T extends View>
TReturns top level view as given class.protected Object
Returns the UI source.Returns the specific child view for given object (name, event or view).<T> T
Returns the specific child view with the given name as the given class.boolean
getViewBoolValue
(Object anObj) Returns the boolean value for a given name or UI view.float
getViewFloatValue
(Object anObj) Returns the float value for a given name or UI view.int
getViewIntValue
(Object anObj) Returns the int value for a given name or UI view.List<?>
getViewItems
(Object anObj) Returns the items for a given name or UI view.int
getViewSelIndex
(Object anObj) Returns the selected index for given name or UI view.getViewSelItem
(Object anObj) Returns the selected item for given name or UI view.getViewStringValue
(Object anObj) Returns the string value for a given name or UI view.getViewText
(Object anObj) Returns the text value for a given name or UI view.getViewValue
(Object anObj) Returns the object value for a given name or UI view.Returns the Window to manage this ViewOwner's window.protected void
Called when ViewOwner is first shown.protected void
initUI()
Initializes the UI panel.protected void
initWindow
(WindowView aWindow) Initialize window.protected void
A wrapper to call resetUI() properly so resulting view action events are ignored.protected void
invokeRespondUI
(ViewEvent anEvent) A wrapper to call respondUI() properly so resulting view action events are ignored.protected boolean
Returns whether current thread is event thread.boolean
Returns whether send event facility is disabled (so controls can be updated without triggering response).boolean
Returns whether ViewOwner UI is showing.boolean
isUISet()
Returns whether UI has been set.boolean
isViewDisabled
(Object anObj) Returns whether given name or UI view is disabled.boolean
isViewEnabled
(Object anObj) Returns whether given name or UI view is enabled.boolean
isViewVisible
(Object anObj) Returns whether given name or UI view is visible.boolean
Returns whether Window has been created (happens when first accessed).boolean
Returns whether window is visible.void
requestFocus
(Object anObj) Focuses given UI view (name or view).void
Resets UI later.protected void
resetUI()
Reset UI controls.protected void
Respond to UI controls.void
runDelayed
(Runnable aRunnable, int aDelay) Runs the runnable after the given delay in milliseconds.void
Runs the given runnable in the next event.void
setFirstFocus
(Object anObj) Sets the first focus UI view.boolean
setSendEventDisabled
(boolean aFlag) Sets whether send event facility is disabled (so controls can be updated without triggering response).protected void
setShowing
(boolean aValue) Sets whether ViewOwner UI is showing.void
setViewDisabled
(Object anObj, boolean aValue) Sets whether given name or UI view is disabled.void
setViewEnabled
(Object anObj, boolean aValue) Sets whether given name or UI view is enabled.void
setViewItems
(Object anObj, Object[] theItems) Sets the items for a given name or UI view.void
setViewItems
(Object anObj, List<?> theItems) Sets the items for a given name or UI view.void
setViewSelIndex
(Object anObj, int aValue) Sets the selected index for given name or UI view.void
setViewSelItem
(Object anObj, Object anItem) Sets the selected item for given name or UI view.void
setViewText
(Object anObj, String aValue) Sets the object value for a given name or UI view.void
setViewValue
(Object anObj, Object aValue) Sets the object value for a given name or UI view.void
setViewVisible
(Object anObj, boolean aValue) Sets whether given name or UI view is visible.void
setWindowVisible
(boolean aValue) Sets whether window is visible.Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, clone, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, getPropValue, initProps, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValue, setPropValues, toString, toStringProps
-
Field Details
-
Showing_Prop
- See Also:
-
Action
-
KeyPress
-
KeyRelease
-
KeyType
-
MousePress
-
MouseDrag
-
MouseRelease
-
MouseEnter
-
MouseMove
-
MouseExit
-
DragEnter
-
DragOver
-
DragExit
-
DragDrop
-
DragGesture
-
WinClose
-
KeyEvents
-
MouseEvents
-
DragEvents
-
-
Constructor Details
-
ViewOwner
public ViewOwner()Constructor. -
ViewOwner
Constructor with given View for UI.
-
-
Method Details
-
isUISet
public boolean isUISet()Returns whether UI has been set. -
getUI
Returns top level view. -
getUI
Returns top level view as given class. -
createUI
Creates the top level view for this class. -
createUIForClass
Creates the top level view for given class. -
getUISource
Returns the UI source. -
initUI
protected void initUI()Initializes the UI panel. -
getFirstFocus
Returns the first focus UI view for when window/dialog is made visible. -
setFirstFocus
Sets the first focus UI view. -
isShowing
public boolean isShowing()Returns whether ViewOwner UI is showing. -
setShowing
protected void setShowing(boolean aValue) Sets whether ViewOwner UI is showing. -
initShowing
protected void initShowing()Called when ViewOwner is first shown. -
getNative
Returns the native object for the UI (JComponent). -
getView
Returns the specific child view for given object (name, event or view). -
getView
Returns the specific child view with the given name as the given class. -
getViewValue
Returns the object value for a given name or UI view. -
setViewValue
Sets the object value for a given name or UI view. -
getViewStringValue
Returns the string value for a given name or UI view. -
getViewBoolValue
Returns the boolean value for a given name or UI view. -
getViewIntValue
Returns the int value for a given name or UI view. -
getViewFloatValue
Returns the float value for a given name or UI view. -
getViewText
Returns the text value for a given name or UI view. -
setViewText
Sets the object value for a given name or UI view. -
getViewItems
Returns the items for a given name or UI view. -
setViewItems
Sets the items for a given name or UI view. -
setViewItems
Sets the items for a given name or UI view. -
getViewSelIndex
Returns the selected index for given name or UI view. -
setViewSelIndex
Sets the selected index for given name or UI view. -
getViewSelItem
Returns the selected item for given name or UI view. -
setViewSelItem
Sets the selected item for given name or UI view. -
isViewEnabled
Returns whether given name or UI view is enabled. -
setViewEnabled
Sets whether given name or UI view is enabled. -
isViewDisabled
Returns whether given name or UI view is disabled. -
setViewDisabled
Sets whether given name or UI view is disabled. -
isViewVisible
Returns whether given name or UI view is visible. -
setViewVisible
Sets whether given name or UI view is visible. -
addViewEventHandler
Adds an event handler (for given types) to view for given name or view. -
getImage
Returns an image with given name or path from this class. -
getToggleGroup
Return the toggle group for the given name (creating if needed). -
resetUI
protected void resetUI()Reset UI controls. -
respondUI
Respond to UI controls. -
resetLater
public void resetLater()Resets UI later. -
cancelReset
protected void cancelReset()Whether this ViewOwner should suppress the next automatic reset that normally happens after respondUI. -
invokeResetUI
protected void invokeResetUI()A wrapper to call resetUI() properly so resulting view action events are ignored. -
invokeRespondUI
A wrapper to call respondUI() properly so resulting view action events are ignored. -
dispatchEventToOwner
Sends an event to this ViewOwner through processEvent method. -
fireActionEventForObject
Triggers and action event for a UI view (name or view). -
isSendEventDisabled
public boolean isSendEventDisabled()Returns whether send event facility is disabled (so controls can be updated without triggering response). -
setSendEventDisabled
public boolean setSendEventDisabled(boolean aFlag) Sets whether send event facility is disabled (so controls can be updated without triggering response). -
addKeyActionFilter
Registers an event filter to send event with given name to owner.respondUI() on key press for key description. Key description is in Swing KeyStroke string format. -
addKeyActionHandler
Registers an event handler to send event with given name to owner.respondUI() on key press for key description. Key description is in Swing KeyStroke string format. -
requestFocus
Focuses given UI view (name or view). -
isWindowSet
public boolean isWindowSet()Returns whether Window has been created (happens when first accessed). -
getWindow
Returns the Window to manage this ViewOwner's window. -
initWindow
Initialize window. -
isWindowVisible
public boolean isWindowVisible()Returns whether window is visible. -
setWindowVisible
public void setWindowVisible(boolean aValue) Sets whether window is visible. -
isEventThread
protected boolean isEventThread()Returns whether current thread is event thread. -
runLater
Runs the given runnable in the next event. -
runDelayed
Runs the runnable after the given delay in milliseconds. -
beep
public void beep()Plays a beep. -
getEnv
Returns the ViewEnv for this owner. -
enableEvents
Deprecated.
-