Module org.praxislive.code
Package org.praxislive.code
Class CodeContainer<D extends CodeContainerDelegate>
- java.lang.Object
-
- org.praxislive.code.CodeComponent<D>
-
- org.praxislive.code.CodeContainer<D>
-
- Type Parameters:
D
- wrapped delegate base type
- All Implemented Interfaces:
Component
,Container
,Lookup.Provider
public class CodeContainer<D extends CodeContainerDelegate> extends CodeComponent<D> implements Container
A CodeContainer is a Container instance that is rewritable at runtime. The CodeContainer itself remains constant, but passes most responsibility to aCodeContainer.Context
wrapping aCodeContainerDelegate
(user code). This component handles switching from one context to the next. A CodeComponent cannot be created directly - seeCodeFactory
.The CodeContainer supports a property for proxying ports of child components on to the parent. This is automatically added when the
CodeContainerDelegate.ProxyPorts
annotation is used on theinit()
method of the delegate.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CodeContainer.Connector<D extends CodeContainerDelegate>
CodeConnector subclass for CodeContainers.static class
CodeContainer.Context<D extends CodeContainerDelegate>
CodeContext subclass for CodeContainers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream<String>
children()
Get a Stream of the child IDs that this container makes publicly visible.ComponentAddress
getAddress(Component child)
Get the address for the provided child component, or null if the component is not a child of this container.Component
getChild(String id)
Get child component with specific ID.ComponentInfo
getInfo()
Get the ComponentInfo object for this component.Lookup
getLookup()
Get the Lookup from this Provider.Port
getPort(String id)
Get the Port with the given ID, or null if it does not exist.void
hierarchyChanged()
Notify the component that a change has happened in its component hierarchy.-
Methods inherited from class org.praxislive.code.CodeComponent
getControl, getParent, parentNotify
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.praxislive.core.Component
getControl, getParent, parentNotify
-
-
-
-
Method Detail
-
children
public Stream<String> children()
Description copied from interface:Container
Get a Stream of the child IDs that this container makes publicly visible. Containers may have hidden children that can be returned fromContainer.getChild(java.lang.String)
but are not listed here. All IDs returned should correspond to valid components, and (if provided) match the implementation ofContainerProtocol
.A Stream is returned allowing flexibility in implementation.
-
getAddress
public ComponentAddress getAddress(Component child)
Description copied from interface:Container
Get the address for the provided child component, or null if the component is not a child of this container.- Specified by:
getAddress
in interfaceContainer
- Parameters:
child
- component- Returns:
- address, or null of component is not a child of this container.
-
getChild
public Component getChild(String id)
Description copied from interface:Container
Get child component with specific ID.
-
getInfo
public ComponentInfo getInfo()
Description copied from interface:Component
Get the ComponentInfo object for this component.- Specified by:
getInfo
in interfaceComponent
- Overrides:
getInfo
in classCodeComponent<D extends CodeContainerDelegate>
- Returns:
- ComponentInfo
-
getPort
public Port getPort(String id)
Description copied from interface:Component
Get the Port with the given ID, or null if it does not exist.- Specified by:
getPort
in interfaceComponent
- Overrides:
getPort
in classCodeComponent<D extends CodeContainerDelegate>
- Returns:
- Port or null
-
getLookup
public Lookup getLookup()
Description copied from interface:Lookup.Provider
Get the Lookup from this Provider.- Specified by:
getLookup
in interfaceLookup.Provider
- Returns:
- lookup
-
hierarchyChanged
public void hierarchyChanged()
Description copied from interface:Component
Notify the component that a change has happened in its component hierarchy. For example its direct parent or an ancestor has changed. This method will be called after parentNotify() if the result of an immediate parent change.- Specified by:
hierarchyChanged
in interfaceComponent
- Overrides:
hierarchyChanged
in classCodeComponent<D extends CodeContainerDelegate>
-
-