This service can be accessed from the caplin.core.ServiceRegistry, using the alias
caplin.layout-service
.
There is no default implementation for this service.
This interface uses emitr allowing services implementing this interface to trigger events.
Attributes | Name and Description |
---|---|
|
caplin.layout.LayoutService()
|
Attributes | Name and Description |
---|---|
<static>
|
caplin.layout.LayoutService.EVENT_NAMES
A map of events that services implementing this interface will trigger. |
Attributes | Name and Description |
---|---|
|
void
close(caplin.layout.Layout layout)
Closes the given layout, removing it from the view and from the list of open layouts. |
|
void
dispose(caplin.layout.Layout layout)
Disposes the given layout, removing it from the list of available layouts. |
|
Array
getAvailable()
Returns an array of all layouts that the user has available to them. |
|
Array
getOpen()
Returns an array of all layouts that the user currently has open. |
|
caplin.layout.Layout
getSelected()
Returns the currently selected layout. |
|
Array
getTemplates()
Returns an array of all templates that are available to the user. |
|
void
open(caplin.layout.Layout layout)
Opens the given layout, adding it to the application and the list of open layouts. |
|
void
openNew(caplin.layout.LayoutTemplate layoutTemplate)
Creates and opens a new layout, adding it to the application and the list of open layouts. |
|
void
save(caplin.layout.Layout layout)
Saves the given layout. |
|
void
saveAs(caplin.layout.Layout layout, String name)
Saves the given layout under a new name. |
|
void
select(caplin.layout.Layout layout)
Selects the given layout. |
►
caplin.layout.LayoutService()
►
<static>
caplin.layout.LayoutService.EVENT_NAMES
A map of events that services implementing this interface will trigger.
Contains the following events:
Triggered when a layout is selected.
caplin.layout.Layout | layout | The selected layout. |
caplin.layout.Layout | layout | The closed layout. |
caplin.layout.Layout | layout | The opened layout. |
Number | index | The index of the opened layout. |
caplin.layout.Layout | layout | The disposed layout. |
caplin.layout.Layout | layout | The created layout. |
caplin.layout.Layout | layout | The saved layout. |
►
void
close(caplin.layout.Layout layout)
Closes the given layout, removing it from the view and from the list of open layouts. This is where the implementation would typically trigger caplin.layout.LayoutService.EVENT_NAMES.SELECTED on a different layout, if the current selected layout is being closed.
Method will raise a caplin.layout.LayoutService.EVENT_NAMES.CLOSED event with the closed layout as the only argument.
caplin.layout.Layout | layout | The layout to close. |
►
void
dispose(caplin.layout.Layout layout)
Disposes the given layout, removing it from the list of available layouts.
Will raise a caplin.layout.LayoutService.EVENT_NAMES.DISPOSED event with the disposed layout as the only argument.
caplin.layout.Layout | layout | The layout to disposed. |
►
Array
getAvailable()
Returns an array of all layouts that the user has available to them.
►
Array
getOpen()
Returns an array of all layouts that the user currently has open.
►
caplin.layout.Layout
getSelected()
Returns the currently selected layout.
►
Array
getTemplates()
Returns an array of all templates that are available to the user.
►
void
open(caplin.layout.Layout layout)
Opens the given layout, adding it to the application and the list of open layouts.
Method will raise a caplin.layout.LayoutService.EVENT_NAMES.OPENED event with the opened layout as the only argument.
caplin.layout.Layout | layout | The layout to open. |
►
void
openNew(caplin.layout.LayoutTemplate layoutTemplate)
Creates and opens a new layout, adding it to the application and the list of open layouts. This new layout will not be in the list of available layouts until it has been saved. This method will create a blank layout by default, but may optionally be passed a caplin.layout.LayoutTemplate which the new layout will be a copy of.
caplin.layout.LayoutTemplate | layoutTemplate | (optional) The template that will be copied to create a new layout |
►
void
save(caplin.layout.Layout layout)
Saves the given layout. Raises an error if called with a layout that isn't writable (see caplin.layout.Layout#isWritable).
caplin.layout.Layout | layout | The layout to be saved. |
►
void
saveAs(caplin.layout.Layout layout, String name)
Saves the given layout under a new name. This creates a copy of the given layout in its current state, reverts the original back to its last saved state, and then swaps the new layout for the old layout in the list of open layouts.
caplin.layout.Layout | layout | The layout to be saved. |
String | name | The desired name for the newly created layout. |
►
void
select(caplin.layout.Layout layout)
Selects the given layout. This will typically bring it to the front, and allow context sensitive actions to be performed on it.
Method will raise a caplin.layout.LayoutService.EVENT_NAMES.SELECTED event with the selected layout as the only argument.
caplin.layout.Layout | layout | The layout to select. |