Package com.illumon.iris.console.utils
Class LivePivotWidget
java.lang.Object
com.illumon.util.referencecounting.ReferenceCounted
com.illumon.iris.db.util.liveness.LivenessArtifact
com.illumon.iris.console.utils.LivePivotWidget
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,Deflatable<LivePivotWidget>
,CloseableWidget
,ContextAwareLiveWidget<LivePivotWidget>
,LiveWidget<LivePivotWidget>
,LiveWidgetAclFilterable<LivePivotWidget>
,LivenessManager
,LivenessNode
,LivenessReferent
,Serializable
public class LivePivotWidget extends LivenessArtifact implements ContextAwareLiveWidget<LivePivotWidget>, Serializable, CloseableWidget, LiveWidgetAclFilterable<LivePivotWidget>
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LivePivotWidget.Aggregation
static class
LivePivotWidget.ColumnSortType
static class
LivePivotWidget.Options
Deprecated.This class has been replaced by PivotOptions and will be removed in a future release.static class
LivePivotWidget.RowSortType
-
Constructor Summary
Constructors Constructor Description LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, PivotOptions options, Function<Object,Object> colorFormat, Function<Object,Object> columnNameTransform)
This constructor is used to create the widget.LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, PivotOptions options, Function<Object,Object> colorFormat, Function<Object,Object> columnNameTransform, Comparable<?>[] userRowOrder, Comparable<?>[] userColumnOrder)
This constructor is used to create the widget.LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, PivotOptions options, Function<Object,Object> colorFormat, Map<String,Function<Object,Object>> colorFormats, Function<Object,Object> columnNameTransform)
This constructor is used to create the widget.LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, PivotOptions options, Function<Object,Object> colorFormat, Map<String,Function<Object,Object>> colorFormats, Function<Object,Object> columnNameTransform, Comparable<?>[] userRowColumnOrder, Comparable<?>[] userColumnOrder)
This constructor is used to create the widget.LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String valueColumn, LivePivotWidget.Aggregation aggregation, PivotOptions options)
This constructor is used to create the widget. -
Method Summary
Modifier and Type Method Description LivePivotWidget
applyAcls(com.fishlib.auth.UserContext userContext, RemoteQueryProcessor remoteQueryProcessor, String name)
This method should apply ACLs to all tables in the widget.Inflatable<LivePivotWidget>
deflate(ExportedObjectClient client)
Convert this object into an Inflatable suitable for serialization.protected void
destroy()
Attempt to release (destructively when necessary) resources held by this object.void
dropReference()
Drop a previously-retained reference to this referent.Function<Object,Object>
getColorFormat()
Map<String,Function<Object,Object>>
getColorFormats()
Function<Object,Object>
getColumnNameTransform()
JComponent
getComponent(AsyncPanel dataPanel, String viewId, Object view, String title, Object irisWidgetSupportObject, com.fishlib.io.logger.Logger log)
Gets the UI component.String
getName()
Gets the name of the Live Widget.QueryProcessorConnection
getProcessorConnection()
gets the processor connection.int
getSessionId()
Gets the session ID for console widgets.WeakReference<? extends LivenessReferent>
getWeakReference()
Get aWeakReference
to this referent.static LiveWidget<LivePivotWidget>
getWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String unitColumn, LivePivotWidget.Aggregation aggregation, PivotOptions options)
void
initializeTransientFieldsForLiveness()
Package-private forSerializable
sub-classes to use inreadObject
only.void
onClose()
protected void
onReferenceCountAtZero()
Callback method that will be invoked when the reference count returns to zero.void
setName(String name)
Sets the name of the Live Widget.void
setProcessorConnection(QueryProcessorConnection processorConnection)
Sets the processor connection.void
setSessionId(int sessionId)
Sets the session ID for console widgets.LivePivotWidget
skipAcls()
This method is called in the case that ACLs should be skipped.boolean
tryManage(LivenessReferent referent)
Attempt to add the specified referent to this manager.boolean
tryRetainReference()
If this referent is "live", behave asLivenessReferent.retainReference()
and return true.Methods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanage
Methods inherited from class com.illumon.util.referencecounting.ReferenceCounted
append, decrementReferenceCount, incrementReferenceCount, resetReferenceCount, toString, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
getReferentDescription, retainReference
Methods inherited from interface com.illumon.iris.db.tables.utils.LiveWidget
getComponent, updateTelemetryInfo
-
Constructor Details
-
LivePivotWidget
public LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String valueColumn, LivePivotWidget.Aggregation aggregation, @NotNull PivotOptions options)This constructor is used to create the widget.- Parameters:
tableToPivot
- the table to pivotrows
- the key columns for the rowscolumnTitleColumn
- the column used as a title for each columnvalueColumn
- the column containing the value of interestaggregation
- how to aggregate the dataoptions
- a struct of booleans that control how the widget presents the data
-
LivePivotWidget
public LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, @NotNull PivotOptions options, Function<Object,Object> colorFormat, Function<Object,Object> columnNameTransform)This constructor is used to create the widget.- Parameters:
tableToPivot
- the table to pivotrows
- the key columns for the rowscolumnTitleColumn
- the column used as a title for each columnvalueColumns
- the columns containing the values of interestaggregation
- how to aggregate the dataoptions
- a struct that control how the widget presents the datacolorFormat
- an optional function for creating heatmap colorscolumnNameTransform
- an optional function for transforming column names
-
LivePivotWidget
public LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, @NotNull PivotOptions options, Function<Object,Object> colorFormat, Function<Object,Object> columnNameTransform, Comparable<?>[] userRowOrder, Comparable<?>[] userColumnOrder)This constructor is used to create the widget.- Parameters:
tableToPivot
- the table to pivotrows
- the key columns for the rowscolumnTitleColumn
- the column used as a title for each columnvalueColumns
- the columns containing the values of interestaggregation
- how to aggregate the dataoptions
- a struct that control how the widget presents the datacolorFormat
- an optional function for creating heatmap colorscolumnNameTransform
- an optional function for transforming column namesuserRowOrder
- A custom order for row-columns
-
LivePivotWidget
public LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, @NotNull PivotOptions options, Function<Object,Object> colorFormat, Map<String,Function<Object,Object>> colorFormats, Function<Object,Object> columnNameTransform)This constructor is used to create the widget.- Parameters:
tableToPivot
- the table to pivotrows
- the key columns for the rowscolumnTitleColumn
- the column used as a title for each columnvalueColumns
- the columns containing the values of interestaggregation
- how to aggregate the dataoptions
- a struct that control how the widget presents the datacolorFormat
- an optional function for creating heatmap colorscolorFormats
- an optional map of columns to functions for creating heatmap colorscolumnNameTransform
- an optional function for transforming column names
-
LivePivotWidget
public LivePivotWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String[] valueColumns, String[] filterColumns, String[] requiredFilterColumns, LivePivotWidget.Aggregation aggregation, @NotNull PivotOptions options, Function<Object,Object> colorFormat, Map<String,Function<Object,Object>> colorFormats, Function<Object,Object> columnNameTransform, Comparable<?>[] userRowColumnOrder, Comparable<?>[] userColumnOrder)This constructor is used to create the widget.- Parameters:
tableToPivot
- the table to pivotrows
- the key columns for the rowscolumnTitleColumn
- the column used as a title for each columnvalueColumns
- the columns containing the values of interestaggregation
- how to aggregate the dataoptions
- a struct that control how the widget presents the datacolorFormat
- an optional function for creating heatmap colorscolorFormats
- an optional map of columns to functions for creating heatmap colorscolumnNameTransform
- an optional function for transforming column namesuserRowColumnOrder
- a user specified row column ordering
-
-
Method Details
-
onClose
public void onClose()- Specified by:
onClose
in interfaceCloseableWidget
-
getColorFormat
-
getColorFormats
-
getColumnNameTransform
-
applyAcls
public LivePivotWidget applyAcls(com.fishlib.auth.UserContext userContext, RemoteQueryProcessor remoteQueryProcessor, String name)Description copied from interface:LiveWidgetAclFilterable
This method should apply ACLs to all tables in the widget. For each table in the widget, this method should call:
t = RemoteDatabase.applyAcls(t, userContext, remoteQueryProcessor, name);
- Specified by:
applyAcls
in interfaceLiveWidgetAclFilterable<LivePivotWidget>
- Parameters:
userContext
- the user contextremoteQueryProcessor
- the remote queryname
- the name of the widget
-
skipAcls
Description copied from interface:LiveWidgetAclFilterable
This method is called in the case that ACLs should be skipped.- Specified by:
skipAcls
in interfaceLiveWidgetAclFilterable<LivePivotWidget>
-
setName
Description copied from interface:ContextAwareLiveWidget
Sets the name of the Live Widget.- Specified by:
setName
in interfaceContextAwareLiveWidget<LivePivotWidget>
- Parameters:
name
- the name of the Live Widget
-
getName
Description copied from interface:ContextAwareLiveWidget
Gets the name of the Live Widget.- Specified by:
getName
in interfaceContextAwareLiveWidget<LivePivotWidget>
- Returns:
- the name of the Live Widget
-
setProcessorConnection
Description copied from interface:ContextAwareLiveWidget
Sets the processor connection.- Specified by:
setProcessorConnection
in interfaceContextAwareLiveWidget<LivePivotWidget>
- Parameters:
processorConnection
- the processor connection
-
getProcessorConnection
Description copied from interface:ContextAwareLiveWidget
gets the processor connection.- Specified by:
getProcessorConnection
in interfaceContextAwareLiveWidget<LivePivotWidget>
- Returns:
- the processor connection
-
setSessionId
public void setSessionId(int sessionId)Description copied from interface:ContextAwareLiveWidget
Sets the session ID for console widgets.- Specified by:
setSessionId
in interfaceContextAwareLiveWidget<LivePivotWidget>
- Parameters:
sessionId
- the session ID
-
getSessionId
public int getSessionId()Description copied from interface:ContextAwareLiveWidget
Gets the session ID for console widgets.- Specified by:
getSessionId
in interfaceContextAwareLiveWidget<LivePivotWidget>
- Returns:
- the session ID
-
deflate
Description copied from interface:Deflatable
Convert this object into an Inflatable suitable for serialization.- Specified by:
deflate
in interfaceDeflatable<LivePivotWidget>
- Parameters:
client
- the ExportedObjectClient we are deflating for.- Returns:
- an Inflatable for serializing to the client
-
getWidget
public static LiveWidget<LivePivotWidget> getWidget(Table tableToPivot, String[] rows, String columnTitleColumn, String unitColumn, LivePivotWidget.Aggregation aggregation, PivotOptions options) -
getComponent
public JComponent getComponent(AsyncPanel dataPanel, String viewId, Object view, String title, Object irisWidgetSupportObject, com.fishlib.io.logger.Logger log)Description copied from interface:LiveWidget
Gets the UI component.- Specified by:
getComponent
in interfaceLiveWidget<LivePivotWidget>
- Parameters:
dataPanel
- data panelviewId
- view idview
- viewtitle
- titleirisWidgetSupportObject
- widget support objectlog
- log- Returns:
- UI component
-
initializeTransientFieldsForLiveness
Package-private forSerializable
sub-classes to use inreadObject
only. Public to allow unit tests in another package to work around mock issues where the constructor is never invoked. -
tryRetainReference
public final boolean tryRetainReference()Description copied from interface:LivenessReferent
If this referent is "live", behave asLivenessReferent.retainReference()
and return true. Otherwise, returns false rather than throwing an exception.- Specified by:
tryRetainReference
in interfaceLivenessReferent
- Returns:
- True if this referent was retained, false otherwise
-
dropReference
public final void dropReference()Description copied from interface:LivenessReferent
Drop a previously-retained reference to this referent.- Specified by:
dropReference
in interfaceLivenessReferent
-
getWeakReference
Description copied from interface:LivenessReferent
Get aWeakReference
to this referent. This may be cached, or newly created.- Specified by:
getWeakReference
in interfaceLivenessReferent
- Returns:
- A new or cached reference to this referent
-
tryManage
Description copied from interface:LivenessManager
Attempt to add the specified referent to this manager.- Specified by:
tryManage
in interfaceLivenessManager
- Parameters:
referent
- The referent to add- Returns:
- Whether the referent was in fact added
-
destroy
protected void destroy()Attempt to release (destructively when necessary) resources held by this object. This may render the object unusable for subsequent operations. Implementations should be sure to call super.destroy().
This is intended to only ever be used as a side effect of decreasing the reference count to 0.
-
onReferenceCountAtZero
protected final void onReferenceCountAtZero()Description copied from class:ReferenceCounted
Callback method that will be invoked when the reference count returns to zero.- Specified by:
onReferenceCountAtZero
in classReferenceCounted
-