Documentation of 'org.jplot2d.element.impl.PlotImpl' Java class
PlotImpl
org.jplot2d.element.impl

Class PlotImpl

    • Constructor Detail

      • PlotImpl

        public PlotImpl()
      • PlotImpl

        public PlotImpl(LegendEx legend)
    • Method Detail

      • getShortId

        public java.lang.String getShortId()
        Description copied from interface: PlotEx
        Returns the short id of this plot. The short id is composed of series of ids concatenated with dots. The 1st id is the id of this element, the 2nd id is the id of the parent of this element, etc, until but not include the root plot.
        Specified by:
        getShortId in interface PlotEx
        Returns:
        the short id of this plot.
      • getId

        public java.lang.String getId()
        Description copied from interface: Element
        Returns the id string of this element
        Specified by:
        getId in interface Element
        Returns:
        the id string
      • getInvokeStepFormParent

        public InvokeStep getInvokeStepFormParent()
        Description copied from interface: ElementEx
        Return the invoke step to get this object from its parent.
        Specified by:
        getInvokeStepFormParent in interface ElementEx
        Returns:
        the invoke step
      • getMooringMap

        public java.util.Map<Element,Element> getMooringMap()
        Description copied from interface: ComponentEx
        Returns a map to tell why this component cannot be removed from its container. The key is the moored element, required by its value.
        Specified by:
        getMooringMap in interface ComponentEx
        Overrides:
        getMooringMap in class ComponentImpl
        Returns:
        a map. The key is the element required by its value.
      • getContainerSize

        public java.awt.geom.Dimension2D getContainerSize()
        Description copied from interface: Plot
        Returns the container size in device coordinate system.
        Specified by:
        getContainerSize in interface Plot
        Returns:
        the container size
      • setContainerSize

        public void setContainerSize(java.awt.geom.Dimension2D size)
        Description copied from interface: Plot
        Sets the container size. The container size is given in device coordinate system and used by size mode to derive paper size and scale. The default value is 640x480 pixels.

        If the size mode is null when calling this method, an IllegalStateException will be thrown.

        Specified by:
        setContainerSize in interface Plot
      • getSizeMode

        public SizeMode getSizeMode()
        Description copied from interface: Plot
        Returns the size mode of this plot.
        Specified by:
        getSizeMode in interface Plot
        Returns:
      • setSizeMode

        public void setSizeMode(SizeMode sizeMode)
        Description copied from interface: Plot
        Sets a size mode to manage the size and scale of this plot according to its container size. The mode must be set when displaying a plot in a swing/swt component.
        Specified by:
        setSizeMode in interface Plot
      • getLocation

        public java.awt.geom.Point2D getLocation()
        Description copied from interface: Plot
        Gets the location of this plot in its parent plot. The origin of a plot is the bottom-left corner of the content box (the intersect point of left axis and bottom axis). For root plot, the returned value is always (0,0)
        Specified by:
        getLocation in interface PComponent
        Specified by:
        getLocation in interface Plot
        Returns:
        an instance of Point representing the base point of this plot
      • setLocation

        public final void setLocation(java.awt.geom.Point2D p)
        Description copied from interface: Plot
        Moves this plot to a new location. The new location is specified by point and is given in the parent's paper coordinate space.

        Notice: This method should be called when the parent plot's layout director does not manage subplots, such as SimpleLayoutDirector, otherwise the location will be overwrite by the layout director.

        For root plot, this method has no effect.

        Specified by:
        setLocation in interface Plot
      • setLocation

        public void setLocation(double locX,
                                double locY)
        Specified by:
        setLocation in interface Plot
      • getSize

        public java.awt.geom.Dimension2D getSize()
        Description copied from interface: PComponent
        Returns the paper size of this component.
        Specified by:
        getSize in interface PComponent
        Returns:
      • setSize

        public final void setSize(java.awt.geom.Dimension2D size)
        Description copied from interface: Plot
        Sets the paper size of this plot. This method only take effect when size mode is null. Otherwise the size is decided by size mode.
        Specified by:
        setSize in interface Plot
        Parameters:
        size - the paper size
      • setSize

        public void setSize(double width,
                            double height)
        Description copied from interface: Plot
        Sets the paper size of this plot. This method only take effect when size mode is null. Otherwise the size is decided by size mode.

        For subplot, the size is set by layout manager.

        Specified by:
        setSize in interface Plot
        Parameters:
        width - the paper width
        height - the paper height
      • getBounds

        public java.awt.geom.Rectangle2D getBounds()
        Description copied from interface: PComponent
        Returns the paper bounds relative to its location. The units of bounds is pt (1/72 inch)
        Specified by:
        getBounds in interface PComponent
        Overrides:
        getBounds in class ComponentImpl
        Returns:
        the paper bounds of this component.
      • getScale

        public double getScale()
        Description copied from interface: Plot
        Returns the scale of this plot. The scale is ratio device size to paper size.
        Specified by:
        getScale in interface Plot
        Returns:
        the scale of this plot
      • setScale

        public void setScale(double scale)
        Description copied from interface: Plot
        Sets scale of this plot. This method only take effect when size mode is null. Otherwise the scale is decided by size mode.
        Specified by:
        setScale in interface Plot
        Parameters:
        scale - the scale
      • getPaperTransform

        public PaperTransform getPaperTransform()
        Description copied from interface: PComponent
        Returns the paper transform of this component, which can be used to convert between device coordinate and paper coordinate of this component. The original point of paper coordinate is the location point of this component.

        Returns null if the component is not added to a plot or not laid out

        Specified by:
        getPaperTransform in interface PComponent
        Overrides:
        getPaperTransform in class ComponentImpl
        Returns:
        the paper transform of this component
      • getMargin

        public PlotMarginEx getMargin()
        Description copied from interface: Plot
        Returns the margin area of this plot.
        Specified by:
        getMargin in interface PlotEx
        Specified by:
        getMargin in interface Plot
        Returns:
      • getLayoutDirector

        public LayoutDirector getLayoutDirector()
        Description copied from interface: Plot
        Gets the layout director for this plot.
        Specified by:
        getLayoutDirector in interface Plot
        Returns:
        the layout director for this plot.
      • setLayoutDirector

        public void setLayoutDirector(LayoutDirector director)
        Description copied from interface: Plot
        Sets the layout director for this plot.
        Specified by:
        setLayoutDirector in interface Plot
        Parameters:
        director - the layout director
      • getConstraint

        public java.lang.Object getConstraint(Plot subplot)
        Description copied from interface: Plot
        Returns the constraint of the specified subplot in the current LayoutManager.
        Specified by:
        getConstraint in interface Plot
        Parameters:
        subplot - The subplot whose constraint is being set
        Returns:
        the constraint
      • setConstraint

        public void setConstraint(Plot subplot,
                                  java.lang.Object constraint)
        Description copied from interface: Plot
        Sets the constraint of the specified subplot in the current LayoutManager.
        Specified by:
        setConstraint in interface Plot
        Parameters:
        subplot - The subplot whose constraint is being set
        constraint - the constraint
      • getContentConstrant

        public java.awt.geom.Dimension2D getContentConstrant()
        Description copied from interface: PlotEx
        Returns the contents constraint of this plot.
        Specified by:
        getContentConstrant in interface PlotEx
        Returns:
        the contents constraint
      • setContentConstrant

        public void setContentConstrant(java.awt.geom.Dimension2D constraint)
        Description copied from interface: PlotEx
        Impose contents constraint on this plot. This method is called by a plot's layout director, when laying out subplots of the plot.
        Specified by:
        setContentConstrant in interface PlotEx
        Parameters:
        constraint - the contents constraint
      • isValid

        public boolean isValid()
        Description copied from interface: PlotEx
        Determines whether this plot is valid. A plot is valid when it is correctly sized and positioned within its parent plot and all its axes, titles, legend and subplot are also valid.
        Specified by:
        isValid in interface PlotEx
        Returns:
        true if the component is valid, false otherwise
        See Also:
        PlotEx.validate(), PlotEx.invalidate()
      • invalidate

        public void invalidate()
        Description copied from interface: PlotEx
        Invalidates this component. This component and all parents above it are marked as needing to be laid out. This method can be called often, so it needs to execute quickly.
        Specified by:
        invalidate in interface PlotEx
        See Also:
        PlotEx.validate()
      • isRerenderNeeded

        public boolean isRerenderNeeded()
        Description copied from interface: PlotEx
        Returns the flag that indicate if this plot is needed to be re-rendered. This flag will control if rendering process is executed by all renderers of a RenderEnvironment.
        Specified by:
        isRerenderNeeded in interface PlotEx
        Returns:
        the flag that indicate if this plot is needed to be re-rendered
      • setRerenderNeeded

        public void setRerenderNeeded(boolean flag)
        Description copied from interface: PlotEx
        Mark or clear the flag that indicate this plot artifact need to be re-rendered. Any component changes which do not require redraw and require re-render the plot can call this method. eg, when a cacheable component removed.
        Specified by:
        setRerenderNeeded in interface PlotEx
        Parameters:
        flag - the flag that indicate this plot artifact need to be re-rendered
      • setNotifier

        public void setNotifier(Notifier notifier)
        Description copied from interface: PlotEx
        Sets a notifier to receive all notice messages.
        Specified by:
        setNotifier in interface PlotEx
      • notify

        public void notify(Notice msg)
        Description copied from interface: ElementEx
        Element call this method to notify message to its parent.
        Specified by:
        notify in interface ElementEx
        Overrides:
        notify in class ElementImpl
        Parameters:
        msg - the notice message
      • getPreferredContentSize

        public java.awt.geom.Dimension2D getPreferredContentSize()
        Description copied from interface: Plot
        Returns the the preferred content area size.
        Specified by:
        getPreferredContentSize in interface Plot
        Returns:
        the the preferred content area size
      • setPreferredContentSize

        public void setPreferredContentSize(java.awt.geom.Dimension2D size)
        Description copied from interface: Plot
        Sets the preferred content area size
        Specified by:
        setPreferredContentSize in interface Plot
        Parameters:
        size - the size in Dimension2D
      • setPreferredContentSize

        public void setPreferredContentSize(double width,
                                            double height)
        Description copied from interface: Plot
        Sets the preferred content area size
        Specified by:
        setPreferredContentSize in interface Plot
        Parameters:
        width - the width
        height - the height
      • getContentSize

        public java.awt.geom.Dimension2D getContentSize()
        Description copied from interface: Plot
        Returns the size of content area.
        Specified by:
        getContentSize in interface Plot
        Returns:
        the size of content area.
      • setContentSize

        public void setContentSize(java.awt.geom.Dimension2D csize)
        Description copied from interface: PlotEx
        Sets the content size by layout director. All layers in this plot have the same viewport size.

        The layout manager guarantee this method is called after setting plot margin, and no matter if the content size is changed.

        Specified by:
        setContentSize in interface PlotEx
        Parameters:
        csize - the content size
      • getComponents

        public ComponentEx[] getComponents()
        Description copied from interface: ContainerEx
        Returns the components in this container.
        Specified by:
        getComponents in interface ContainerEx
        Returns:
        an array of sub-components
      • getLegend

        public LegendEx getLegend()
        Description copied from interface: Plot
        Returns the legend of this plot.
        Specified by:
        getLegend in interface PlotEx
        Specified by:
        getLegend in interface Plot
        Returns:
        the legend of this plot
      • getTitle

        public TitleEx getTitle(int index)
        Description copied from interface: Plot
        Gets the nth title in this plot.
        Specified by:
        getTitle in interface Plot
        Returns:
        the nth title in this plot
      • getTitles

        public TitleEx[] getTitles()
        Description copied from interface: Plot
        Returns all titles in the order of added.
        Specified by:
        getTitles in interface PlotEx
        Specified by:
        getTitles in interface Plot
        Returns:
        all titles
      • addTitle

        public void addTitle(Title title)
        Specified by:
        addTitle in interface Plot
      • getXAxis

        public AxisEx getXAxis(int index)
        Specified by:
        getXAxis in interface Plot
      • getYAxis

        public AxisEx getYAxis(int index)
        Specified by:
        getYAxis in interface Plot
      • addXAxis

        public void addXAxis(Axis axis)
        Specified by:
        addXAxis in interface Plot
      • addYAxis

        public void addYAxis(Axis axis)
        Specified by:
        addYAxis in interface Plot
      • removeXAxis

        public void removeXAxis(Axis axis)
        Description copied from interface: Plot
        Removes the specified X axis from this plot if it is present.
        Specified by:
        removeXAxis in interface Plot
        Parameters:
        axis - the X axis to be removed
      • removeYAxis

        public void removeYAxis(Axis axis)
        Description copied from interface: Plot
        Removes the specified Y axis from this plot if it is present.
        Specified by:
        removeYAxis in interface Plot
        Parameters:
        axis - the Y axis to be removed
      • getLayer

        public Layer getLayer(int index)
        Description copied from interface: Plot
        Gets the nth layer in this plot.
        Specified by:
        getLayer in interface Plot
        Returns:
        the nth layer in this plot
      • getLayers

        public LayerEx[] getLayers()
        Description copied from interface: Plot
        Returns all layers in the order of added.
        Specified by:
        getLayers in interface PlotEx
        Specified by:
        getLayers in interface Plot
        Returns:
        all layers
      • addLayer

        public void addLayer(Layer layer)
        Description copied from interface: Plot
        Add a layer to this plot. The layer will not associate with any axis range manager. Before the layer associate axis transform by Layer.setAxesTransform(AxisTransform, AxisTransform), all its subcomponents are invisible.
        Specified by:
        addLayer in interface Plot
        Parameters:
        layer - the layer to be added
      • addLayer

        public void addLayer(Layer layer,
                             AxisTransform xRangeManager,
                             AxisTransform yRangeManager)
        Description copied from interface: Plot
        Add a layer to this plot. The layer will associate with the given X/Y axis range manager to control which part show in the plot viewport.
        Specified by:
        addLayer in interface Plot
        Parameters:
        layer - the layer to be added
        xRangeManager - the x axis range manager
        yRangeManager - the y axis range manager
      • getSubplot

        public PlotEx getSubplot(int i)
        Description copied from interface: Plot
        Gets the nth subplot in this plot.
        Specified by:
        getSubplot in interface Plot
        Parameters:
        i - the index of the component to get.
        Returns:
        the nth subplot in this subplot
      • getSubplots

        public PlotEx[] getSubplots()
        Description copied from interface: Plot
        Gets the nth subplot in this plot.
        Specified by:
        getSubplots in interface PlotEx
        Specified by:
        getSubplots in interface Plot
        Returns:
        the nth subplot in this plot
      • addSubplot

        public void addSubplot(Plot subplot,
                               java.lang.Object constraint)
        Description copied from interface: Plot
        Add a subplot with a constraint to this plot.
        Specified by:
        addSubplot in interface Plot
        Parameters:
        subplot - the subplot to be added
        constraint - an object expressing layout constraints
      • setSubplotConstraint

        public void setSubplotConstraint(Plot subplot,
                                         java.lang.Object constraint)
        Description copied from interface: Plot
        Set a new layout constraint for the given subplot.
        Specified by:
        setSubplotConstraint in interface Plot
        Parameters:
        subplot - the subplot
        constraint - an object expressing layout constraints
      • removeSubplot

        public void removeSubplot(Plot subplot)
        Description copied from interface: Plot
        remove the specified subplot from this plot.
        Specified by:
        removeSubplot in interface Plot
      • canContribute

        public boolean canContribute()
        Description copied from interface: ComponentEx
        Returns true if this component can contribute visible parts to plot rendering artifact when this component is visible. Subcomponents are not considered.
        Specified by:
        canContribute in interface ComponentEx
        Overrides:
        canContribute in class ComponentImpl
        Returns:
        the indicator
      • copyStructureCascade

        public PlotImpl copyStructureCascade(java.util.Map<ElementEx,ElementEx> orig2copyMap)
        Description copied from interface: PlotEx
        Create a structural copy of this plot, without linking layer and axis transform.
        Specified by:
        copyStructureCascade in interface PlotEx
      • copyFrom

        public void copyFrom(ElementEx src)
        Description copied from interface: ElementEx
        Copies all properties from given src to this element. Notice properties of sub-elements are not copied over.
        Specified by:
        copyFrom in interface ElementEx
        Overrides:
        copyFrom in class ComponentImpl
        Parameters:
        src - the src
      • linkLayerAndAxisTransform

        public static void linkLayerAndAxisTransform(PlotEx plot,
                                                     java.util.Map<ElementEx,ElementEx> orig2copyMap)
        Deep search layers to find the copy whoes range manager not been linked, and set for them.
        Parameters:
        plot - the plot to be copied
        orig2copyMap -
      • draw

        public void draw(java.awt.Graphics2D g)
        Description copied from interface: ComponentEx
        Draw this component only. All its children is not drawn.
        Specified by:
        draw in interface ComponentEx
        Overrides:
        draw in class ContainerImpl
        Parameters:
        g - to the Graphics2D drawing. The transformation of this component is not applied.
      • commit

        public void commit()
        Description copied from interface: PlotEx
        Apply all pending changes on this plot. After this method is called, all axis range and layout are valid.
        Specified by:
        commit in interface PlotEx
      • zoomXRange

        public void zoomXRange(double start,
                               double end)
        Description copied from interface: Plot
        Zoom the given range to entire X axis. The behavior is like, creating a temporary AxisRangeLockGroup to group all AxisRangeLockGroups which zoomable are true in this plot, and zoom the range on it.
        Specified by:
        zoomXRange in interface Plot
        Parameters:
        start - the normalized start
        end - the normalized end
      • zoomYRange

        public void zoomYRange(double start,
                               double end)
        Description copied from interface: Plot
        Zoom the given range to entire Y axis. The behavior is like, creating a temporary AxisRangeLockGroup to group all AxisRangeLockGroups which zoomable are true in this plot, and zoom the range on it.
        Specified by:
        zoomYRange in interface Plot
        Parameters:
        start - the normalized start
        end - the normalized end
      • adaptiveZoomX

        public void adaptiveZoomX()
        Description copied from interface: Plot
        Adaptive zoom the x range for all axes in this plot. Only axes whoes AxisRangeLockGroups is zoomable are zoomed.
        Specified by:
        adaptiveZoomX in interface Plot
      • adaptiveZoomY

        public void adaptiveZoomY()
        Description copied from interface: Plot
        Adaptive zoom the y range for all axes in this plot. Only axes whoes AxisRangeLockGroups is zoomable are zoomed.
        Specified by:
        adaptiveZoomY in interface Plot

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.