Interface WorkbenchActivity
-
- All Superinterfaces:
Activity,ContextSensitiveActivity,org.uberfire.security.Resource,org.uberfire.security.authz.RuntimeFeatureResource,org.uberfire.security.authz.RuntimeResource
- All Known Subinterfaces:
WorkbenchClientEditorActivity,WorkbenchEditorActivity,WorkbenchScreenActivity
- All Known Implementing Classes:
AbstractWorkbenchActivity,AbstractWorkbenchClientEditorActivity,AbstractWorkbenchEditorActivity,AbstractWorkbenchScreenActivity
@JsType public interface WorkbenchActivity extends ContextSensitiveActivity
WorkbenchActivity and its subinterfaces define the interface between UberFire framework behaviour and application-defined behaviour.In the model-view-presenter (MVP) sense, an Activity is essentially an application-provided Presenter: it has a view (its widget) and it defines a set of operations that can affect that view.
Applications can implement an Activity interface directly, they can subclass one of the abstract Activity implementations that come with the framework, or they may rely on UberFire's annotation processors to generate Activity implementations from annotated Java objects.
For example, to define a new Screen in an application, you can implement
WorkbenchScreenActivity, extendAbstractWorkbenchScreenActivity, or annotate a class withWorkbenchScreenand follow the rules associated with that annotation.Similarly for
WorkbenchEditorActivity,AbstractWorkbenchEditorActivityandWorkbenchEditor;PerspectiveActivity,AbstractWorkbenchPerspectiveActivity, andWorkbenchPerspective; and so on.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StringcontextId()org.uberfire.workbench.model.PositiongetDefaultPosition()Specifies custom positioning for this activity's view when the request to launch it comes without specific positioning information of its own.voidgetMenus(Consumer<org.uberfire.workbench.model.menu.Menus> menusConsumer)org.uberfire.mvp.PlaceRequestgetOwningPlace()Returns the PlaceRequest for the perspective that this activity should always be displayed in.StringgetTitle()com.google.gwt.user.client.ui.IsWidgetgetTitleDecoration()default com.google.gwt.dom.client.ElementgetTitleDecorationElement()org.uberfire.workbench.model.toolbar.ToolBargetToolBar()com.google.gwt.user.client.ui.IsWidgetgetWidget()default com.google.gwt.dom.client.ElementgetWidgetElement()voidonFocus()Invoked by the UberFire framework when this activity is the current activity in the current panel.voidonLostFocus()Invoked by the UberFire framework when this activity is no longer the current activity in the current panel.booleanonMayClose()Invoked by the framework before this activity is closed, unless the framework has been told to "force close" the activity.default intpreferredHeight()Returns the amount of space that should be allocated to this activity if a new Workbench Panel is created when first displaying it.default intpreferredWidth()Returns the amount of space that should be allocated to this activity if a new Workbench Panel is created when first displaying it.
-
-
-
Method Detail
-
onMayClose
boolean onMayClose()
Invoked by the framework before this activity is closed, unless the framework has been told to "force close" the activity.The activity can cancel the close operation by returning
falsefrom this method. This is most often used for implementing a "save before closing" workflow.- Returns:
- true if the activity is ready to be closed; false if it should remain open.
- See Also:
PlaceManager.closeAllPlaces(),PlaceManager.closePlace(PlaceRequest),PlaceManager.closePlace(String)
-
getDefaultPosition
org.uberfire.workbench.model.Position getDefaultPosition()
Specifies custom positioning for this activity's view when the request to launch it comes without specific positioning information of its own. For a newly launching activity, when this method returns a non-null value, UberFire will attempt to create a new panel for this activity and add that new panel as a child of the current perspective's root panel. The activity's view will then be added to the new panel.If this method returns null, UberFire will attempt to add this activity's view directly to the root panel.
Developers of cross-application reusable components should use caution with this feature. If the component declares a default position that is not supported by the root panel the application uses, the application's root panel could throw a ClassCastException when the framework attempts to create the child panel at the given position.
- Returns:
- the Position to add a new child panel to the root that accommodates this activity's view, or null if this activity's view should be added directly to the root panel.
-
getOwningPlace
org.uberfire.mvp.PlaceRequest getOwningPlace()
Returns the PlaceRequest for the perspective that this activity should always be displayed in. When the PlaceManager is asked to go to this activity, it will switching to the owning perspective first, and then show this activity in it.- Returns:
- the owning perspective's place request, or null if this activity can appear in any perspective.
-
onFocus
void onFocus()
Invoked by the UberFire framework when this activity is the current activity in the current panel. Activities may choose to make their UI more prominent, or begin refreshing their data more aggressively when they are focused.
-
onLostFocus
void onLostFocus()
Invoked by the UberFire framework when this activity is no longer the current activity in the current panel. Typically undoes changes made in the correspondingonFocus()call.
-
getTitle
String getTitle()
-
getTitleDecoration
@JsIgnore com.google.gwt.user.client.ui.IsWidget getTitleDecoration()
-
getTitleDecorationElement
default com.google.gwt.dom.client.Element getTitleDecorationElement()
-
getWidget
@JsIgnore com.google.gwt.user.client.ui.IsWidget getWidget()
-
getWidgetElement
default com.google.gwt.dom.client.Element getWidgetElement()
-
getMenus
void getMenus(Consumer<org.uberfire.workbench.model.menu.Menus> menusConsumer)
-
getToolBar
org.uberfire.workbench.model.toolbar.ToolBar getToolBar()
-
contextId
String contextId()
-
preferredHeight
default int preferredHeight()
Returns the amount of space that should be allocated to this activity if a new Workbench Panel is created when first displaying it. Has no effect when the activity is added to a pre-existing panel, including the case where the activity is added to a panel as part of a default perspective layout.- Returns:
- the height, in pixels, that should be allocated for a new panel created to house this activity. -1 (default) means no particular height is preferred, and the framework can choose a default height.
-
preferredWidth
default int preferredWidth()
Returns the amount of space that should be allocated to this activity if a new Workbench Panel is created when first displaying it. Has no effect when the activity is added to a pre-existing panel, including the case where the activity is added to a panel as part of a default perspective layout.- Returns:
- the width, in pixels, that should be allocated for a new panel created to house this activity. -1 (default) means no particular width is preferred, and the framework can choose a default width.
-
-