Caplin Trader 4.8.0

Class: module:br/component/Frame

module:br/component/Frame

Instances of Frame are used to wrap components before they are displayed on the screen. They are created automatically by whatever code is controlling the view and passed in to the component that they are displaying.

Frame is an abstract class. The specific implementations will interface with some sort of layout manager.

Constructor

new module:br/component/Frame()

Methods

close()

This is a method for the component to call if it wishes to be closed.

Implementations of Frame for layout managers that are prepared to remove panels should override this method and ensure that they fire the appropriate events.

If a frame is closed in response to this method, then a close event will be fired.

setComponentModified()

Allows the component to indicate that state that it would serialize has changed.

Implementations of Frame for layout managers that can persist state should override this method.

setContent(contentElement)

Allows the component to set an html element that contains the dom content of this component. May only be called once.
Parameters:
Name Type Description
contentElement

setPreferredSize()

Allows the component to request that it be given a particular amount of room. This is only a request, if the frame is resized in response to this method, then a resize event will be fired.

Implementations of Frame for layout managers that can allow visual components to be resized should override this method.

setTitle()

Sets the title of this frame.

Implementations of Frame for layout managers that display the title should override this method.

Events

attach

This event must be raised after the content element has been attached to the DOM.

The state must be updated to one of HIDDEN, MINIMIZED, MAXIMIZED or NORMAL before this event is fired, and width and height should be set.

This event will only be fired once.

It allows the component to do any calculations that need to take sizes into account.

blur

This event should be raised if the layout manager supports focusing/activating a component and this frame has been inactivated.

isFocused should be updated before this event is fired.

close

This event must be raised when the component is closed and will not be used again.

It should be raised after the frame has been removed from the DOM. If the content of the frame is visible at the time of close, it should be preceded by a hide event.

The state must be updated to CLOSED after this event has fired.

This event will only be fired once.

It allows the component to do cleanup.

focus

This event should be raised if the layout manager supports focusing/activating a component and this frame has been activated.

isFocused should be updated before this event is fired.

hide

This event should be raised if the contents of this frame are no longer visible after previously being visible.

It should be raised immediately before a close event if the contents were visible before closing. If in its minimized form the content is not visible, it should be raised immediately after a minimize event.

Width and height should be set, and isContentVisible must be set to false before this event is fired.

It allows the component to pause long running resources.

maximize

This event should be raised if the layout manager supports minimize/maximize/restore and this frame has been maximized.

If maximizing the frame causes the content to become newly visible, a show must be fired afterwards. If maximizing causes the content to change size, a resize event should be fired afterwards.

The state must be updated to MAXIMIZED before this event is fired.

minimize

This event should be raised if the layout manager supports minimize/maximize/restore and the this frame has been minimized.

If minimizing the frame causes the content to no longer be visible, a hide must be fired afterwards. If minimizing causes the content to change size, a resize event should be fired afterwards.

The state must be updated to MINIMIZED before this event is fired. If the content is no longer visible, isContentVisible should be set before this event is fired.

resize

This event should be raised whenever the component is resized. A component becoming invisible is not a resize.

If the resize is due to a minimize (if the minimized form has visible content), maximise or restore, it should be fired after that event.

Frame.width and Frame.height should be set to the new values before the event is raised.

restore

This event should be raised if the layout manager supports minimize/maximize/restore and the this frame has been restored.

If restoring the frame causes the content to become newly visible, a show must be fired afterwards. If restoring causes the content to change size, a resize event should be fired afterwards.

The state must be updated to NORMAL before this event is fired. If the content is newly visible, isContentVisible should be set before this event is fired.

show

This event should be raised whenever the contents of the frame are becoming visible after previously not being visible.

It should be raised immediately after an attach event if the attach occurs somewhere that should be visible. If in its minimized form the contents of the frame are not visible, then when the frame is restored or maximised, then a show event should be raised after the restore or maximise event.

If a component is resized prior to becoming visible, the show event should occur after the resize.

For example - a component is normal size, then minimized so that the content becomes invisible. The sequence of events is:

  1. minimize
  2. hide

Then, the component is maximised, making the content visible, but also changing its size:

  1. maximize
  2. resize
  3. show

The state must be updated to one of MINIMIZED, MAXIMIZED or NORMAL before this event is fired, and width and height should be set. isContentVisible must be set to true before this event is fired.

It allows the component to resume or start long running resources.