Class ReportViewer
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
-
- com.inductiveautomation.reporting.components.ReportViewer
-
- All Implemented Interfaces:
DynamicPropertyProvider
,LocaleListener
,MutableDynamicPropertyProvider
,StyleProvider
,ComponentLifecycle
,ExtensibleComponent
,QualityMonitor
,VisionComponent
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
public class ReportViewer extends AbstractVisionPanel implements ExtensibleComponent
filename: ReportViewer.java author: Perry The ReportViewer component allows the display of a Report in an Ignition Client Window. Implements DynamicPropertyProvider to override the default component inheritance of MutableDynamicPropertyProvider as Report-specific Properties originate from the ReportDataSourceConfig object's ReportParameters. ReportParameters should be configured in the ReportDataEditor of a given Report.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ReportViewer.ControlsPanel
protected class
ReportViewer.ReportLoader
ReportLoader is the background process that runs to collect the data for a report without blocking the UI thread.-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CAT_REPORTING
protected ReportViewer.ControlsPanel
controls
protected javax.swing.JPopupMenu
popupMenu
-
Fields inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
antialias, context, cursorCode, dynamicProps
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle
COMPONENT_RUNNING
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface com.inductiveautomation.ignition.client.model.LocaleListener
LOCAL_CHANGE_EVENT
-
Fields inherited from interface com.inductiveautomation.vision.api.client.binding.MutableDynamicPropertyProvider
RESERVED_SET_KEY
-
Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.VisionComponent
COMPONENT_LOCKED, COMPONENT_PERMISSIONS, COMPONENT_SECURITY, COMPONENT_TRANSLATIONS
-
-
Constructor Summary
Constructors Constructor Description ReportViewer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
bulkSetValues(java.util.Map<java.lang.String,java.lang.Object> map)
protected boolean
checkExpirationAccess()
java.awt.Color
getBackground()
Gets the background color of this component.byte[]
getBytesPDF()
Allows scripts to get the bytes in PDF format.byte[]
getBytesPNG()
Allows scripts to get the bytes in png format.int
getCurrentPage()
java.util.TreeMap<java.lang.String,DynamicPropertyDescriptor>
getDynamicProps()
java.util.Map<java.lang.String,ExtensionFunction>
getExtensionFunctions()
int
getPageCount()
java.awt.Color
getPanelBackground()
DynamicPropertyDescriptor[]
getProperties()
java.lang.Object
getPropertyValue(java.lang.String name)
java.lang.String
getReportPath()
java.lang.String
getSuggestedFilename()
float
getZoomFactor()
protected javax.swing.JPopupMenu
initMenu()
boolean
isFitPanel()
boolean
isPropertyDefined(java.lang.String name)
boolean
isReportLoading()
boolean
isShowControls()
void
loadReport()
loadReport() starts most of the checking and loading duties for the ReportViewer.void
localeChanged(java.util.Locale newLocale)
void
onShutdown()
Subclasses should override this to provide shutdown logic.void
onStartup()
We override these PropertyProvider methods to expose the ReportResource's parameters as custom properties in the Property Editor, but we don't want the names to be editable outside of the ReportData configuration panel.void
print()
void
print(java.lang.String printerName)
void
print(java.lang.String printerName, boolean showDialog)
java.lang.String
saveAsHTML(java.lang.String fname, boolean continuous)
java.lang.String
saveAsPDF(java.lang.String fname)
java.lang.String
saveAsPNG(java.lang.String fname)
java.lang.String
saveAsXls(java.lang.String fname)
Deprecated.java.lang.String
saveAsXlsx(java.lang.String filename)
saves theRMDocument
in xlsx format to the supplied file name.void
setBackground(java.awt.Color bg)
void
setCurrentPage(int pageNumber)
void
setDynamicProps(java.util.TreeMap<java.lang.String,DynamicPropertyDescriptor> map)
void
setExtensionFunctions(java.util.Map<java.lang.String,ExtensionFunction> map)
void
setFitPanel(boolean fitPanel)
void
setForeground(java.awt.Color fg)
void
setPageCount(int unused)
void
setPanelBackground(java.awt.Color panelBackground)
void
setPropertyValue(java.lang.String name, java.lang.Object value)
The Property (aka Report Parameter) values can be set from the Property editor to override the default value.void
setPropertyValueQuiet(java.lang.String name, java.lang.Object value)
Sets the property value without reloading the report.void
setReportLoading(boolean reportLoading)
void
setReportPath(java.lang.String reportPath)
void
setShowControls(boolean show)
void
setSuggestedFilename(java.lang.String suggestedFilename)
void
setZoomFactor(float zoomFactor)
void
updateControlVisibility()
-
Methods inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
getAppContext, getCursorCode, getDataQuality, getQuality, getStyles, getToolTipText, initStyleListener, isAntialias, isComponentRunning, paintChildren, paintComponent, paintOverlayOverChildren, setAntialias, setCursorCode, setDataQuality, setName, setQuality, setStyles, setToolTipText, setVisible, shutdownComponent, startupComponent, translate, updateQuality
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle
getAppContext, shutdownComponent, startupComponent
-
-
-
-
Field Detail
-
CAT_REPORTING
public static final java.lang.String CAT_REPORTING
- See Also:
- Constant Field Values
-
popupMenu
protected javax.swing.JPopupMenu popupMenu
-
controls
protected ReportViewer.ControlsPanel controls
-
-
Method Detail
-
onStartup
public void onStartup()
We override these PropertyProvider methods to expose the ReportResource's parameters as custom properties in the Property Editor, but we don't want the names to be editable outside of the ReportData configuration panel. Otherwise, AbstractVisionPanel implements MutableDynamicPropertyProvider which would allow Custom Properties panels.- Overrides:
onStartup
in classAbstractVisionPanel
-
onShutdown
public void onShutdown()
Description copied from class:AbstractVisionPanel
Subclasses should override this to provide shutdown logic.- Overrides:
onShutdown
in classAbstractVisionPanel
-
getProperties
public DynamicPropertyDescriptor[] getProperties()
- Specified by:
getProperties
in interfaceDynamicPropertyProvider
- Overrides:
getProperties
in classAbstractVisionPanel
-
getDynamicProps
public java.util.TreeMap<java.lang.String,DynamicPropertyDescriptor> getDynamicProps()
- Specified by:
getDynamicProps
in interfaceMutableDynamicPropertyProvider
- Overrides:
getDynamicProps
in classAbstractVisionPanel
-
setDynamicProps
public void setDynamicProps(@Nullable java.util.TreeMap<java.lang.String,DynamicPropertyDescriptor> map)
- Specified by:
setDynamicProps
in interfaceMutableDynamicPropertyProvider
- Overrides:
setDynamicProps
in classAbstractVisionPanel
-
setPropertyValue
public void setPropertyValue(java.lang.String name, java.lang.Object value) throws java.lang.ClassCastException
The Property (aka Report Parameter) values can be set from the Property editor to override the default value. Property names are based on the Report Data panel Parameter names. These properties can be null/empty, but if a default is not specified the key won't get run in the report.- Specified by:
setPropertyValue
in interfaceDynamicPropertyProvider
- Overrides:
setPropertyValue
in classAbstractVisionPanel
- Throws:
java.lang.ClassCastException
-
setPropertyValueQuiet
public void setPropertyValueQuiet(java.lang.String name, java.lang.Object value) throws java.lang.ClassCastException
Sets the property value without reloading the report. Used by the report converter- Throws:
java.lang.ClassCastException
-
bulkSetValues
public void bulkSetValues(java.util.Map<java.lang.String,java.lang.Object> map)
-
getPropertyValue
public java.lang.Object getPropertyValue(java.lang.String name)
- Specified by:
getPropertyValue
in interfaceDynamicPropertyProvider
- Overrides:
getPropertyValue
in classAbstractVisionPanel
-
isPropertyDefined
public boolean isPropertyDefined(java.lang.String name)
- Specified by:
isPropertyDefined
in interfaceDynamicPropertyProvider
- Overrides:
isPropertyDefined
in classAbstractVisionPanel
-
isReportLoading
public boolean isReportLoading()
-
setReportLoading
public void setReportLoading(boolean reportLoading)
-
getReportPath
public java.lang.String getReportPath()
-
setReportPath
public void setReportPath(java.lang.String reportPath)
-
loadReport
public void loadReport()
loadReport() starts most of the checking and loading duties for the ReportViewer. If the context has loaded and there is a reportPath entered, it will try to find the resource, show the loading animation pane, and call the SwingWorker to handle the RDP calls to collect the data configuration, update the Component's property (aka parameter) list, and finally run/draw the report.
-
setBackground
public void setBackground(java.awt.Color bg)
- Overrides:
setBackground
in classjavax.swing.JComponent
-
getBackground
public java.awt.Color getBackground()
Gets the background color of this component.- Overrides:
getBackground
in classjava.awt.Component
-
setForeground
public void setForeground(java.awt.Color fg)
- Overrides:
setForeground
in classjavax.swing.JComponent
-
getExtensionFunctions
public java.util.Map<java.lang.String,ExtensionFunction> getExtensionFunctions()
- Specified by:
getExtensionFunctions
in interfaceExtensibleComponent
-
setExtensionFunctions
public void setExtensionFunctions(java.util.Map<java.lang.String,ExtensionFunction> map)
- Specified by:
setExtensionFunctions
in interfaceExtensibleComponent
-
localeChanged
public void localeChanged(java.util.Locale newLocale)
- Specified by:
localeChanged
in interfaceLocaleListener
- Overrides:
localeChanged
in classAbstractVisionPanel
-
getZoomFactor
public float getZoomFactor()
-
setZoomFactor
public void setZoomFactor(float zoomFactor)
-
isFitPanel
public boolean isFitPanel()
-
setFitPanel
public void setFitPanel(boolean fitPanel)
-
getCurrentPage
public int getCurrentPage()
-
setCurrentPage
public void setCurrentPage(int pageNumber)
-
getPageCount
public int getPageCount()
-
setPageCount
public void setPageCount(int unused)
-
initMenu
protected javax.swing.JPopupMenu initMenu()
-
print
public void print()
-
print
public void print(java.lang.String printerName)
-
print
public void print(java.lang.String printerName, boolean showDialog)
-
getBytesPDF
@Nullable public byte[] getBytesPDF()
Allows scripts to get the bytes in PDF format. Useful for emailing or saving to a database.- Returns:
- Bytes of report in PDF format, or null if trial is expired.
-
getBytesPNG
@Nullable public byte[] getBytesPNG()
Allows scripts to get the bytes in png format. Useful for emailing or saving to a database.- Returns:
- Bytes of report in png format, or null if trial is expired.
-
saveAsPDF
public java.lang.String saveAsPDF(java.lang.String fname)
-
saveAsHTML
@Nullable public java.lang.String saveAsHTML(java.lang.String fname, boolean continuous)
-
saveAsPNG
public java.lang.String saveAsPNG(java.lang.String fname)
-
saveAsXls
@Deprecated public java.lang.String saveAsXls(java.lang.String fname)
Deprecated.
-
saveAsXlsx
public java.lang.String saveAsXlsx(java.lang.String filename)
saves theRMDocument
in xlsx format to the supplied file name.- Parameters:
filename
- the filename to save to- Returns:
- the path to the saved file or
null
if the action was unsuccessful or canceled
-
checkExpirationAccess
protected boolean checkExpirationAccess()
-
getPanelBackground
public java.awt.Color getPanelBackground()
-
setPanelBackground
public void setPanelBackground(java.awt.Color panelBackground)
-
setSuggestedFilename
public void setSuggestedFilename(java.lang.String suggestedFilename)
-
getSuggestedFilename
public java.lang.String getSuggestedFilename()
-
isShowControls
public boolean isShowControls()
-
setShowControls
public void setShowControls(boolean show)
-
updateControlVisibility
public void updateControlVisibility()
-
-