public final class MultiViewFactory extends Object
Modifier and Type | Field and Description |
---|---|
static MultiViewElement |
BLANK_ELEMENT
A utility singleton instance of MultiViewElement that does nothing.
|
static Action |
NOOP_CLOSE_ACTION
a utility noop action instance to be used when no special handling is
required in createUnsafeCloseState() method.
|
Modifier and Type | Method and Description |
---|---|
static CloneableTopComponent |
createCloneableMultiView(MultiViewDescription[] descriptions,
MultiViewDescription defaultDesc)
Creates and returns new instance of cloneable top component with
multi views.
|
static CloneableTopComponent |
createCloneableMultiView(MultiViewDescription[] descriptions,
MultiViewDescription defaultDesc,
CloseOperationHandler closeHandler)
Creates and returns new instance of cloneable top component with
multi views.
|
static TopComponent |
createMultiView(MultiViewDescription[] descriptions,
MultiViewDescription defaultDesc)
Creates and returns new instance of top component with
multi views.
|
static TopComponent |
createMultiView(MultiViewDescription[] descriptions,
MultiViewDescription defaultDesc,
CloseOperationHandler closeHandler)
Creates and returns new instance of top component with
multi views.
|
static CloseOperationState |
createUnsafeCloseState(String warningId,
Action proceedAction,
Action discardAction)
Utility method for MultiViewElements to create a CloseOperationState instance
that warns about possible data loss.
|
public static final MultiViewElement BLANK_ELEMENT
public static final Action NOOP_CLOSE_ACTION
public static TopComponent createMultiView(MultiViewDescription[] descriptions, MultiViewDescription defaultDesc)
Please see MultiViews.createMultiView(java.lang.String, T)
for loosely coupled variant
of this method which may be more suitable for modular environment.
descriptions
- array of descriptions of tabs in the multiview.defaultDesc
- the initial selection, one of the descriptions array values.public static TopComponent createMultiView(MultiViewDescription[] descriptions, MultiViewDescription defaultDesc, CloseOperationHandler closeHandler)
Please see MultiViews.createMultiView(java.lang.String, T)
for loosely coupled variant
of this method which may be more suitable for modular environment.
descriptions
- array of descriptions of tabs in the multiview.defaultDesc
- the initial selection, one of the descriptions array values.closeHandler
- handles closing of the multiview component, useful when any of the embedded elements can be in modified state and closing would cause a dataloss..public static CloneableTopComponent createCloneableMultiView(MultiViewDescription[] descriptions, MultiViewDescription defaultDesc)
Please see MultiViews.createCloneableMultiView(java.lang.String, T)
for loosely coupled variant
of this method which may be more suitable for modular environment.
descriptions
- array of descriptions of tabs in the multiview.defaultDesc
- the initial selection, one of the descriptions array values.public static CloneableTopComponent createCloneableMultiView(MultiViewDescription[] descriptions, MultiViewDescription defaultDesc, CloseOperationHandler closeHandler)
Please see MultiViews.createCloneableMultiView(java.lang.String, T)
for loosely coupled variant
of this method which may be more suitable for modular environment.
descriptions
- array of descriptions of tabs in the multiview.defaultDesc
- the initial selection, one of the descriptions array values.closeHandler
- handles closing of the multiview component, useful when any of the embedded elements can be in modified state and closing would cause a dataloss..public static CloseOperationState createUnsafeCloseState(String warningId, Action proceedAction, Action discardAction)
There is a default implementation of CloseOperationHandler
. It
uses warningId
of all elements with unsafe close state to
select the unique ones. These unique elements are then presented in a
question box and user can decide to save or discard them. The user
friendly message in such dialog is taken from
proceedAction.getValue(Action.LONG_DESCRIPTION)
, if present.
warningId
- an id that identifies the problem,
the CloseOperationHandler used in the component should know about the warning's meaning and handle appropriatelyproceedAction
- will be performed when the CloseOperationHandler decides that closing the component is ok and changes are to be saved.discardAction
- will be performed when the CloseOperationHandler decides that the nonsaved data shall be discarded