Class JFCPie

All Implemented Interfaces:
Serializable, Cloneable, org.jfree.chart.labels.PieToolTipGenerator, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, AjaxableComponent, Arrangeable, Badgeable, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable

@Component public class JFCPie extends Container implements Arrangeable, org.jfree.chart.labels.PieToolTipGenerator, AjaxableComponent, Cloneable, Serializable
This class implements the pie chart object, using the JFreeChart library
See Also:
GCApi:
component
  • Field Details

    • FACTORY_PATH

      public static final String FACTORY_PATH
      Defines the path that must be used by Factory.make(java.lang.String, java.lang.Object)
      See Also:
    • _imageGate

      protected ConcreteGate _imageGate
    • _mapGate

      protected ConcreteGate _mapGate
    • _version

      protected long _version
    • _width

      protected int _width
    • _height

      protected int _height
    • _interiorGap

      protected double _interiorGap
    • _ddd

      protected boolean _ddd
    • _shadow

      protected boolean _shadow
    • _legend

      protected boolean _legend
    • _legendFont

      protected overit.geocall.charts.ChartFont _legendFont
    • _legendBox

      protected overit.geocall.charts.ChartLegendBox _legendBox
    • _itemSize

      protected double _itemSize
    • _titleFont

      protected overit.geocall.charts.ChartFont _titleFont
    • _serie

      protected overit.geocall.charts.Serie _serie
    • _explodes

      protected ListAttribute _explodes
    • _labels

      protected ListAttribute _labels
    • _tooltips

      protected ListAttribute _tooltips
    • _event

      protected String _event
    • _param

      protected String _param
    • _itemLabelFormat

      protected String _itemLabelFormat
    • _itemTooltipFormat

      protected String _itemTooltipFormat
    • itemAltFormat

      protected String itemAltFormat
    • removeAreaTooltip

      protected boolean removeAreaTooltip
    • _antiAlias

      protected boolean _antiAlias
    • _itemLabels

      protected ListAttribute _itemLabels
      Labels used for the elements of the chart. A ListAttribute in which every element, separated from the others by the | character, represents the label of an element of the data serie
    • _itemTooltips

      protected ListAttribute _itemTooltips
      Tooltip messages used for the elements of the chart. The tooltip will appear when the user stay with the cursor on an element of the chart. A ListAttribute in which every element, separated from the others by the | character, represents the message that will appear as a tooltip for the element
    • _itemLabelFont

      protected overit.geocall.charts.ChartFont _itemLabelFont
    • _itemLabelBox

      protected overit.geocall.charts.ChartLabelBox _itemLabelBox
    • _itemEvent

      protected String _itemEvent
    • _itemParam

      protected String _itemParam
    • _alJFCMessages

      protected ArrayList _alJFCMessages
    • _format

      protected int _format
    • _cs

      protected JFCStyle _cs
  • Constructor Details

    • JFCPie

      public JFCPie()
  • Method Details

    • generateToolTip

      public String generateToolTip(org.jfree.data.general.PieDataset pd, Comparable key)
      Specified by:
      generateToolTip in interface org.jfree.chart.labels.PieToolTipGenerator
    • getBaseFields

      protected Object[] getBaseFields(int v)
    • invalidateCurrentRaw

      protected void invalidateCurrentRaw()
    • getJFCStyle

      protected JFCStyle getJFCStyle()
    • setJFCStyle

      public void setJFCStyle(JFCStyle cs)
      Sets the JFCStyle used to draw the pie chart elements
      Parameters:
      cs - The style used to draw the elements of the chart
    • getCopy

      public JFCPie getCopy()
      Clones the JFCPie object
      Returns:
      A clone of the object
    • setRING

      public void setRING(String s)
      Defines if the chart will be a ring chart, and the size of the ring's section
      Parameters:
      s - A double value that defines the size of the ring's section. If the value is 0 (that is the default value), the chart will be a pie chart, otherwise it will be a ring chart
    • setFORMAT

      public void setFORMAT(String s)
      Defines the format of the image that will be created
      Parameters:
      s - JFCRaw.PNG to create a PNG image, JFCRaw.JPEG to create a JPEG image. The default value is JFCRaw.PNG
    • setITEMLABELFORMAT

      public void setITEMLABELFORMAT(String s)
      Sets the TextFormat used for the labels of the elements of the chart
      Parameters:
      s - A string that defines the format used for the labels. The pie chart has only a single serie of data, therefore the format is unique.
    • setITEMLABELS

      public void setITEMLABELS(String s)
      Sets the labels used for the elements of the chart
      Parameters:
      s - A ListAttribute in which every element, separated from the others by the | character, represents the label of an element of the data serie.
    • getItemLabels

      public ListAttribute getItemLabels()
      Returns the labels used for the elements of the chart.
      Returns:
      The ListAttribute that contains the labels used for the elements of the chart.
    • setITEMTOOLTIPFORMAT

      public void setITEMTOOLTIPFORMAT(String s)
      Sets the TextFormat used for the tooltip message that appears when the user stay with the cursor on an element of the chart
      Parameters:
      s - A string that defines the format used for the tooltip messages. The pie chart has only a single serie of data, therefore the format is unique.
    • setITEMALTFORMAT

      public void setITEMALTFORMAT(String s)
      Sets the TextFormat used for the alternative text attributes that appears into the area element of the graph (it's used for accessibility).
      Parameters:
      s - A ListAttribute in which every element, separated from the others by the | character, represents the format used for the alt attribute of the area elements of the graph.
    • setITEMTOOLTIPS

      public void setITEMTOOLTIPS(String s)
      Sets the tooltip messages used for the elements of the chart. The tooltip will appear when the user stay with the cursor on an element of the chart
      Parameters:
      s - A ListAttribute in which every element, separated from the others by the | character, represents the message that will appear as a tooltip for the element of the data serie
    • getItemTooltips

      public ListAttribute getItemTooltips()
      Returns the tooltip messages used for the elements of the chart.
      Returns:
      The ListAttribute that contains the tooltip messages used for the elements of the chart.
    • setITEMEVENT

      public void setITEMEVENT(String s)
      Sets the name of the event triggered when the user clicks on an element of the chart
      Parameters:
      s - A string that represents the name of an event. The pie chart has only a single serie of data, therefore the event is unique
    • setITEMPARAM

      public void setITEMPARAM(String s)
      Sets the param for the event triggered when the user clicks on an element of the chart
      Parameters:
      s - A string that represents the param for the event. The pie chart has only a single serie of data, therefore there can be only one event, with only one parameter
    • setDDD

      public void setDDD(String s)
      Defines if the chart will have a three dimensional design or not
      Parameters:
      s - A string that represents a boolean value ("true" or "1", "false" or "0").
      If the string is not recognized as a boolean value, it will be used the default value, that is false
    • setSHADOW

      public void setSHADOW(String s)
      Defines if the chart will have a shadow or not
      Parameters:
      s - A string that represents a boolean value ("true" or "1", "false" or "0").
      If the string is not recognized as a boolean value, it will be used the default one, that is true
    • setLEGEND

      public void setLEGEND(String s)
      Defines if the chart will have the legend box or not
      Parameters:
      s - A string that represents a boolean value ("true" or "1", "false" or "0").
      If the string is not recognized as a boolean value, it will be used the default one, that is true
    • setLEGENDFONT

      public void setLEGENDFONT(String s)
      Sets the font used for the element of the legend box
      Parameters:
      s - A string that defines the font, with the format: name,variant,dimension,color.
      The possible values for the variation of the font are: i (italic) and b (bold). It is possible to use both the values, like ib or bi to obtain the font both bold and italic.
      The format for the color is described in the JFCStyle class.
      You can omit some values, in which case you fall back to the default ones. The default font setting is: Tahoma,plain,12,#000000
    • setTITLEFONT

      public void setTITLEFONT(String s)
      Sets the font used for the title of the chart
      Parameters:
      s - A string that defines the font, with the format: name,variant,dimension,color. See setLEGENDFONT(java.lang.String)
    • setLEGENDBOX

      public void setLEGENDBOX(String s)
      Defines the characteristics of the legend box
      Parameters:
      s - A string that defines the format.
      It must be composed by a serie of strings, separated by the comma, with the following meaning: position,background color,border thickness,border color.
      The possible values for the position are: t (top), b (bottom), l (left), r (right).
      The format for the colors is described in the JFCStyle class.
      The thickness value must be a number.
      You can omit some values, in which case you fall back to the default ones
    • setITEMSIZE

      public void setITEMSIZE(String s)
      Defines the size of the legend items
      Parameters:
      s - s A double value that defines the size of the items of the legend. The default value is 6.
    • setLABELS

      public void setLABELS(String s)
      Sets the labels used in the legend box
      Parameters:
      s - A ListAttribute in which every element, separated from the others by the | character, represents the label that will appear in the legend box
    • getLabels

      public ListAttribute getLabels()
      Returns the labels used in the legend box
      Returns:
      The ListAttribute that contains the labels used in the legend box
    • setTOOLTIPS

      public void setTOOLTIPS(String s)
      Sets the tooltip messages used for the elements of the legend box. The tooltip will appear when the user stay with the cursor on an element of the legend box
      Parameters:
      s - A ListAttribute in which every element, separated from the others by the | character, represents the message that will appear as a tooltip for the element of the legend box
    • getTooltips

      public ListAttribute getTooltips()
      Returns the tooltip messages used for the elements of the legend box
      Returns:
      The ListAttribute that contains the tooltip messages used for the elements of the legend box
    • setEVENT

      public void setEVENT(String s)
      Sets the name of the event triggered when the user clicks on an element of the legend box
      Parameters:
      s - A string that represents the name of an event
    • setPARAM

      public void setPARAM(String s)
      Sets the param for the event triggered when the user clicks on an element of the legend box
      Parameters:
      s - A string that represents the param for the event
    • getEvent

      public String getEvent()
      Returns the name of the event triggered when the user clicks on an element of the legend box
      Returns:
      The string that represents the name of the event
    • setVALUES

      public void setVALUES(String vals)
      Sets the values of the data serie of the chart
      Parameters:
      vals - A ListAttribute in which every element, separated from the others by the | character, represents one value of the data serie
    • setSerie

      public void setSerie(overit.geocall.charts.Serie s)
      Sets the data Serie of the chart
      Parameters:
      s - The data serie that contains the values of the chart
    • setEXPLODES

      public void setEXPLODES(String vals)
      Defines which are the elements of the pie chart that must be exploded
      Parameters:
      vals - A ListAttribute in which every element, separated from the others by the | character, represents the exploded state of the corresponding item. To explode an item the exploded state must be set to 1.
      If the number of the elements of the ListAttribute is less then the number of the items of the data serie, the last value will be replicated for all the remaining items.
    • getExplodes

      public ListAttribute getExplodes()
      Returns the ListAttribute that contains the exploded state of the elements of the pie chart
      Returns:
      The exploded state of the element of the pie chart
    • setWIDTH

      public void setWIDTH(String s)
      Sets the width of the chart
      Parameters:
      s - The width of the chart, expressed in pixel. The default value is 400
    • setINTERIORGAP

      public void setINTERIORGAP(String s)
      Sets the interior gap, the space between the edges of the pie chartand the plot area itself (the region where the section labels appear)
      Parameters:
      s - The gap as a percentage of the available drawing space
    • setHEIGHT

      public void setHEIGHT(String s)
      Sets the height of the chart
      Parameters:
      s - The height of the chart, expressed in pixel. THe default value is 300
    • setITEMLABELFONT

      public void setITEMLABELFONT(String s)
      Sets the font used for the label of the items of the chart
      Parameters:
      s - A string that defines the font, with the format: name,variant,dimension,color. See setLEGENDFONT(java.lang.String)
    • setITEMLABELBOX

      public void setITEMLABELBOX(String s)
      Defines the characteristics of the label boxes
      Parameters:
      s - A string in the format: background-color,shadow color,border thickness,link thickness,link color.
      The format for the colors is described in the JFCStyle class.
      The thickness values must be numbers.
      You can omit some values, in which case you fall back to the default ones
    • setANTIALIAS

      public void setANTIALIAS(String b)
      Controls anti alias in chart rendering
      Parameters:
      b - A string that represents a boolean value ("true" or "1", "false" or "0").
      If the string is not recognized as a boolean value, it will be used the default value, that is true
    • ARIADESCRIPTION

      public void ARIADESCRIPTION(String s)
      Sets the aria-description attribute.
      Parameters:
      s - the aria-description attribute to be set.
    • setup

      protected void setup()
      Description copied from class: Component
      Setup the Component
      Overrides:
      setup in class Component
    • getHiddenHtml

      public org.apache.ecs.Element getHiddenHtml(Object generationhandle, EntitySet es)
      Description copied from interface: Arrangeable
      Returns the hidden but active html part of an hidden component
      Specified by:
      getHiddenHtml in interface Arrangeable
      Parameters:
      generationhandle - the unique generatin handle
      es - the page entity set
      Returns:
      The html code of the hidden part of the component
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es)
      Description copied from class: Container
      Returns the html code of the Container
      Overrides:
      getHtml in class Container
      Parameters:
      es - The EntitySet to which the element belong
      Returns:
      The html code of the Container
    • getGenerationHandle

      public Object getGenerationHandle()
      Description copied from interface: Arrangeable
      Returns the object to generate when the Arrangeable element is composed by more than one element
      Specified by:
      getGenerationHandle in interface Arrangeable
      Returns:
      The Object to generate
    • getDescriptionHtml

      public org.apache.ecs.Element getDescriptionHtml(Object generationhandle, EntitySet es)
      Description copied from interface: Arrangeable
      Returns the html code that represents the component description i.e. the formatted label of the field
      Specified by:
      getDescriptionHtml in interface Arrangeable
      Parameters:
      generationhandle - the unique generatin handle
      es - the page entity set
      Returns:
      The html code of the label of the field
    • prepareGates

      protected void prepareGates()
    • getImageGate

      protected ConcreteGate getImageGate()
    • getMapGate

      protected ConcreteGate getMapGate()
    • getPieChart

      public org.jfree.chart.JFreeChart getPieChart()
      Creates the pie chart
      Returns:
      The JFreeChart instance of the pie chart
    • getChartName

      protected String getChartName()
    • getFrameHtml

      public org.apache.ecs.Element getFrameHtml(overit.geocall.ux.servlet.processor.Change c, EntitySet es)
      Description copied from interface: AjaxableComponent
      Defines the html part of the element that changes when an Ajax interaction occurs
      Specified by:
      getFrameHtml in interface AjaxableComponent
      Parameters:
      c - The Change object that defines the specific morphing type for the element
      es - The EntitySet to which the element belongs
      Returns:
      The html part of the element that changes when an Ajax interaction occurs
    • getContentHtml

      public org.apache.ecs.Element getContentHtml(Object generationhandle, EntitySet es)
      Description copied from interface: Arrangeable
      Returns the html code that represents the active part of the component, i.e. the field and the validation scripts
      Specified by:
      getContentHtml in interface Arrangeable
      Parameters:
      generationhandle - the unique generatin handle
      es - the page entity set
      Returns:
      The html code of the component
    • getJFCMessages

      protected ArrayList getJFCMessages()
    • getMessages

      protected static org.apache.ecs.Element getMessages(ArrayList messages, EntitySet es)
    • changed

      public void changed(overit.geocall.ux.servlet.processor.Change change)
      Description copied from interface: AjaxableComponent
      Defines the morphing of the element that occurs when there is an Ajax interaction
      Specified by:
      changed in interface AjaxableComponent
      Parameters:
      change - The Change object that defines the specific morphing type for the element
    • getDefaultChange

      public overit.geocall.ux.servlet.processor.Change getDefaultChange()
      Description copied from interface: AjaxableComponent
      Defines the default Change object for the element
      Specified by:
      getDefaultChange in interface AjaxableComponent
      Returns:
      The default Change object that defines the default morphing type of the element
    • buildSetupScript

      public void buildSetupScript(StringBuilder sb)
      Description copied from class: Component
      Every component can add a script to the StringBuilder, script executed when the component is created.
      Overrides:
      buildSetupScript in class Component
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • onExplode

      public boolean onExplode(HashGetter hg)
      Changes (explodes or reduce) the exploded status of the desired item, maintaining unchanged the explode status of the other items
      Parameters:
      hg - The HashGetter that contains the number of the element to explode or reduce
      Returns:
      false
    • onSingleExplode

      public boolean onSingleExplode(HashGetter hg)
      Changes (explodes or reduce) the exploded status of the desired item, setting to "not exploded" the status of all the other items
      Parameters:
      hg - The HashGetter that contains the number of the element to explode or reduce
      Returns:
      false
    • onLabel

      public boolean onLabel(HashGetter hg)
      Shows the label of the desired element
      Parameters:
      hg - The HashGetter that contains the number of the element
      Returns:
      true
    • onSingleLabel

      public boolean onSingleLabel(HashGetter hg)
      Shows the label of the desired element and hides all the other labels
      Parameters:
      hg - The HashGetter that contains the number of the element
      Returns:
      true