Documentation of 'jas2.hist.JASHist' Java class
JASHist
jas2.hist

Class JASHist

  • All Implemented Interfaces:
    JASPlotMouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable


    public class JASHist
    extends javax.swing.JComponent
    implements JASPlotMouseListener
    JASHist is the main component used for plotting histograms, scatterplots etc. The type of display produced depends on the DataSource hooked to the component. If the data source is observable, then the JASHist will update as it receives notifications from the data source. JASHist supports overlaying of data and fitting of functions (to 1D histograms).
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int BEVEL_IN 
      static int BEVEL_OUT 
      static int ETCHED 
      static int LEGEND_ALWAYS 
      static int LEGEND_AUTOMATIC 
      static int LEGEND_NEVER 
      static int LINE 
      static int NONE 
      static int SHADOW 
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      JASHist()
      Create a new JASHist component with no initial data source
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      JASHistData addData(DataSource ds)
      Add a DataSource to the plot.
      static void addFitListener(FitListener fitListener)
      Add a FitListener that will receive notifications about the status of fits being performed by the plot
      void addNotify()
      Overrides addNotify in JComponent Starts listening for changes in data
      void copy()
      Copies the plot to the clipboard
      void deselected() 
      void destroy()
      Removes and detaches all data from the plot, but doesn't set up the plot for further use.
      void fillFunctionMenu(javax.swing.JMenu menu)
      Fills the appropriate Function menu items into a user provided menu.
      void fillSliceMenu(javax.swing.JMenu menu)
      Fills the appriate Slice/Projection menu items into a user provided menu.
      java.util.Enumeration get1DFunctions()
      Get the set of Functions currently attached to the plot
      boolean getAllowPopupMenus() 
      boolean getAllowUserInteraction()
      Test if user direct user interaction with the plot is allowed
      java.awt.Color getBackground()
      Get the background color.
      DataArea getDataArea() 
      javax.swing.border.Border getDataAreaBorder() 
      int getDataAreaBorderType()
      Get the current data area border type
      java.awt.Color getDataAreaColor()
      Return the current data area background color
      java.util.Enumeration getDataSources()
      Get the set of data sources currently attached to the plot.
      Legend getLegend() 
      int getNumberOfDataSources()
      Get the number of data sources attached to the plot
      int getShowLegend()
      Get the current setting of the showLegend property
      boolean getShowStatistics() 
      StatisticsBlock getStats() 
      java.lang.String getTitle()
      Get the text of the title.
      Title getTitleObject()
      Actually get the Title object.
      JASHistAxis getXAxis()
      Gets the X axis
      JASHistAxis[] getYAxes()
      Get an array containing all of the Y Axes
      JASHistAxis getYAxis()
      Gets the default Y Axis
      JASHistAxis getYAxis(int index)
      Gets either Y Axis.
      boolean isChanged() 
      void mouseEventNotify(java.awt.event.MouseEvent e) 
      void removeAllData()
      Removes and detaches all data and sets up the plot for further use.
      void removeNotify()
      Overrides removeNotify in JComponent Stops listening for changes in data
      void saveAs()
      Pops up a dialog asking the user to choose a file/format to save the plot.
      void setAllowPopupMenus(boolean allow) 
      void setAllowUserInteraction(boolean allow)
      Controls whether end users are allowed to directly interact with the plot by way of popup menus or "clicking and dragging".
      void setBackground(java.awt.Color c)
      Set the color used to paint the background (but not the data area)
      void setDataAreaBorder(javax.swing.border.Border b) 
      void setDataAreaBorderType(int type)
      Set the border to place around the data area
      void setDataAreaColor(java.awt.Color c)
      Set the color used to paint the background of the data area
      void setForegroundColor(java.awt.Color c)
      Sets the current foreground color, used by default as the color for the axis, labels, title, legend etc.
      void setLegend(Legend newLegend) 
      void setShowLegend(int legend)
      Set when the legend will be shown.
      void setShowStatistics(boolean show) 
      void setStats(StatisticsBlock newStats) 
      void setTitle(java.lang.String newValue)
      Set the text of the title
      void setTitleObject(Title newTitle)
      Actually set the Title object.
      void showProperties()
      Pops up the Properties dialog box for this plot
      void showProperties(byte axis)
      Pops up the properties dialog box for this plot with the specified axis tab initially open
      boolean supportsProperties() 
      void writeXML(java.io.Writer w, boolean snapshot)
      Writes the histogram, scatterplot etc that we are displaying as XML.
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getPeer, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JASHist

        public JASHist()
        Create a new JASHist component with no initial data source
    • Method Detail

      • getDataArea

        public DataArea getDataArea()
      • supportsProperties

        public boolean supportsProperties()
        Returns:
        true if a call to showProperties can currently be honoured
        See Also:
        showProperties()
      • showProperties

        public void showProperties()
        Pops up the Properties dialog box for this plot
        See Also:
        showProperties(byte)
      • showProperties

        public void showProperties(byte axis)
        Pops up the properties dialog box for this plot with the specified axis tab initially open
        Parameters:
        axis - The axis tab to opened (defined??)
        See Also:
        showProperties()
      • addNotify

        public void addNotify()
        Overrides addNotify in JComponent Starts listening for changes in data
        Overrides:
        addNotify in class javax.swing.JComponent
      • removeNotify

        public void removeNotify()
        Overrides removeNotify in JComponent Stops listening for changes in data
        Overrides:
        removeNotify in class javax.swing.JComponent
      • writeXML

        public void writeXML(java.io.Writer w,
                             boolean snapshot)
        Writes the histogram, scatterplot etc that we are displaying as XML.
        Parameters:
        pw - A PrintWriter to send the output to
        snapshot - A snapshot of the current data is stored if true, otherwise a reference to the datasource
        See Also:
        XML How To
      • getAllowUserInteraction

        public boolean getAllowUserInteraction()
        Test if user direct user interaction with the plot is allowed
        Returns:
        True if user interaction is currently allowed
        See Also:
        setAllowUserInteraction(boolean)
      • setAllowUserInteraction

        public void setAllowUserInteraction(boolean allow)
        Controls whether end users are allowed to directly interact with the plot by way of popup menus or "clicking and dragging". By default user interaction is allowed. If no
        Parameters:
        allow - True if user interactions are to be allowed.
      • getAllowPopupMenus

        public boolean getAllowPopupMenus()
      • setAllowPopupMenus

        public void setAllowPopupMenus(boolean allow)
      • setShowStatistics

        public void setShowStatistics(boolean show)
      • getShowStatistics

        public boolean getShowStatistics()
      • setBackground

        public void setBackground(java.awt.Color c)
        Set the color used to paint the background (but not the data area)
        Overrides:
        setBackground in class javax.swing.JComponent
        Parameters:
        c - The new Color to use, or null to set the background to be transparent
        See Also:
        setDataAreaColor(Color), setForegroundColor(Color)
      • getBackground

        public java.awt.Color getBackground()
        Get the background color.
        Overrides:
        getBackground in class java.awt.Component
      • setForegroundColor

        public void setForegroundColor(java.awt.Color c)
        Sets the current foreground color, used by default as the color for the axis, labels, title, legend etc. By default the foreground color of the plots container is used
        Parameters:
        c - The new foreground color
      • getDataAreaColor

        public java.awt.Color getDataAreaColor()
        Return the current data area background color
        Returns:
        The current data area background color
        See Also:
        setDataAreaColor(Color)
      • setDataAreaColor

        public void setDataAreaColor(java.awt.Color c)
        Set the color used to paint the background of the data area
        Parameters:
        c - The new color to be used to paint the data area background, or null`to set the bacground back to the default value
        See Also:
        setBackground(Color), JComponent.setForeground(Color)
      • setDataAreaBorderType

        public void setDataAreaBorderType(int type)
        Set the border to place around the data area
        Parameters:
        type - One of NONE,BEVEL_IN,BEVEL_OUT,ETCHED,LINE,SHADOW
      • getDataAreaBorderType

        public int getDataAreaBorderType()
        Get the current data area border type
        Returns:
        One of NONE,BEVEL_IN,BEVEL_OUT,ETCHED,LINE,SHADOW,OTHER
      • setDataAreaBorder

        public void setDataAreaBorder(javax.swing.border.Border b)
      • getDataAreaBorder

        public javax.swing.border.Border getDataAreaBorder()
      • getXAxis

        public JASHistAxis getXAxis()
        Gets the X axis
        Returns:
        The current X axis
      • getYAxis

        public JASHistAxis getYAxis()
        Gets the default Y Axis
        Returns:
        The current default Y Axis
        See Also:
        getYAxis(int)
      • getYAxis

        public JASHistAxis getYAxis(int index)
        Gets either Y Axis.
        Parameters:
        index - The axis to get, 0 = left (default), 1 = right
        Returns:
        The requested Axis
      • getYAxes

        public JASHistAxis[] getYAxes()
        Get an array containing all of the Y Axes
      • setShowLegend

        public void setShowLegend(int legend)
        Set when the legend will be shown. By default the option is set to LEGEND_AUTOMATIC, which means that the legend will be shown whenever there is more than one DataSource attached to the plot.
        Parameters:
        legend - One of LEGEND_NEVER,LEGEND_AUTOMATIC,LEGEND_ALWAYS
      • getShowLegend

        public int getShowLegend()
        Get the current setting of the showLegend property
        Returns:
        The current settign of showLegend
        See Also:
        setShowLegend(int)
      • addData

        public JASHistData addData(DataSource ds)
                            throws jas2.hist.DataManagerException
        Add a DataSource to the plot.
        Parameters:
        ds - The DataSource to add
        Throws:
        DataManagerException - If the subclass of DataSource is unrecognized or if the new DataSource is incompatible with previously added DataSources.
      • getDataSources

        public java.util.Enumeration getDataSources()
        Get the set of data sources currently attached to the plot. Note that despite the name of this routine it does not return an Enumeration of DataSources, but rather an Enumeration of JASHistData objects, from which the DataSource can be obtained, for example:
         Enumeration  e = hPlot.getDataSources();
         while (e.hasMoreElements())
         {
            JASHistData data = (JASHistData) e.nextElement();
            DataSource source = data.getDataSource();
         }
         
        Returns:
        An Enumeration of the JASHistData objects
        See Also:
        JASHistData, JASHistData.getDataSource()
      • getNumberOfDataSources

        public int getNumberOfDataSources()
        Get the number of data sources attached to the plot
      • get1DFunctions

        public java.util.Enumeration get1DFunctions()
        Get the set of Functions currently attached to the plot
        Returns:
        An Enumeration of the Functions, or null if the current DataSources do not support functions
      • destroy

        public void destroy()
        Removes and detaches all data from the plot, but doesn't set up the plot for further use. Call this method if you aren't going to be using the plot object any more. Call removeAllData() to remove all data and set up the plot for further use.
      • removeAllData

        public void removeAllData()
        Removes and detaches all data and sets up the plot for further use. The method destroy() is less expensive and should be used if the plot will not be used any more.
      • fillFunctionMenu

        public void fillFunctionMenu(javax.swing.JMenu menu)
        Fills the appropriate Function menu items into a user provided menu. This routine can be used to make a function fitting menu available to an external application without having to rewrite a bunch of code already contained in JASHist
        Parameters:
        menu - The menu to which the items will be added
      • fillSliceMenu

        public void fillSliceMenu(javax.swing.JMenu menu)
        Fills the appriate Slice/Projection menu items into a user provided menu. This routine can be used to make a function fitting menu available to an external application without having to rewrite a bunch of code already contained in JASHist
        Parameters:
        menu - The menu to which the items will be added
      • getTitle

        public java.lang.String getTitle()
        Get the text of the title.
        Returns:
        A String containing the text of the title, or null if there is no title at present
        See Also:
        getTitleObject()
      • getTitleObject

        public Title getTitleObject()
        Actually get the Title object.
        Returns:
        The current title, or null if there is no title
      • setTitleObject

        public void setTitleObject(Title newTitle)
        Actually set the Title object.
        Parameters:
        newTitle - The new title object
      • setTitle

        public void setTitle(java.lang.String newValue)
        Set the text of the title
        Parameters:
        newValue - pass null to remove the title
      • isChanged

        public boolean isChanged()
      • addFitListener

        public static void addFitListener(FitListener fitListener)
        Add a FitListener that will receive notifications about the status of fits being performed by the plot
        Parameters:
        fitListener - The FitListener to add
      • deselected

        public void deselected()
      • getLegend

        public Legend getLegend()
      • setLegend

        public void setLegend(Legend newLegend)
      • saveAs

        public void saveAs()
        Pops up a dialog asking the user to choose a file/format to save the plot.
      • copy

        public void copy()
        Copies the plot to the clipboard

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.