Java Doc for ColorDistributionParameter.java in  » Profiler » ejp » ejp » presenter » api » filters » parameters » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Profiler » ejp » ejp.presenter.api.filters.parameters 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   ejp.presenter.api.filters.parameters.AbstractParameter
      ejp.presenter.api.filters.parameters.ColorDistributionParameter

ColorDistributionParameter
public class ColorDistributionParameter extends AbstractParameter implements ActionListener,ChangeListener(Code)
A color distribution parameter, which associates a color to every value in the [0, 1] interval. The interval is actually split into by a user-provided divider and a color can be associated to every sub-range. A convenience system allows to automatically build up a gradient of colors between the first and the last ones.

Known issue : due to Swing's error #4497301, the combo box might not be selectable the second time the dialog is showed. There is currently no acceptable workaround to this. The solution used here consists on limiting the count of rows to a maximum.
author:
   Sebastien Vauclair
version:
   1.0


Inner Class :protected class ColorsDisplay extends JPanel
Inner Class :protected class ComboItem
Inner Class :protected class ComboCellRenderer extends DefaultListCellRenderer

Field Summary
final public static  StringCOLORS_SEPARATOR
     Separator character between colors in text descriptions.
final public static  DecimalFormatDECIMAL_FORMAT
     Decimal numbers formatter used to render percents.
final protected  ColorsDisplaycdSamples
     Panel that displays current color distribution.
final protected  ArrayListcolors
     Current list of colors.
protected  intdivisions
     Number of divisions.
protected  booleandivisionsUpdatedIsWorking
     Avoids reentrancy into divisionsUpdated().
final protected  JComboBoxjcbIntervals
     Intervals combo box.
final protected  JSpinnerjsDivisions
     Divisions spinner.
protected  booleanreadOnly
     Current read-only state of the parameter.
final protected  SpinnerNumberModelspinnerModel
     Spinner model.

Constructor Summary
public  ColorDistributionParameter(String aName, String aTitle, String aToolTipText)
     Creates a new color distribution parameter instance.

Method Summary
public  voidactionPerformed(ActionEvent aEvent)
     Called when an interval is selected in combo box.
protected  voidbuildGradient()
     Builds up a gradient between the first and last colors.
public  ColorcolorForRatio(double aRatio)
     Gets the color currently associated to a real number.
Parameters:
  aRatio - a double value in the [0, 1]interval.
protected  voiddivisionsUpdated()
     Updates graphical representation of color intervals.
public  Color[]getColorsValue()
     Get current value of the parameter.
public  ObjectgetValue()
     Gets value as an object.
public  StringgetValueAsText()
     Gets value as text.

Colors are exported as integers using Color.getRGB().

public  voidsetReadOnly()
     Sets the paramter as read-only.
public  voidsetValue(Object aObject)
     Sets value from object.
public  voidsetValue(Color[] aColors)
     Sets value from a color array.
public  voidsetValueAsText(String aTextValue)
     Sets value from text.
public  voidstateChanged(ChangeEvent aEvent)
     Called when the spinner's value is considered as changed.
protected  voidupdateDivisions(int aNewDivisions)
     Updates all fields to match a new divisions number.
protected  voidupdateSelectedColor()
     Updates combo box to render currently selected colors.

Field Detail
COLORS_SEPARATOR
final public static String COLORS_SEPARATOR(Code)
Separator character between colors in text descriptions.



DECIMAL_FORMAT
final public static DecimalFormat DECIMAL_FORMAT(Code)
Decimal numbers formatter used to render percents.



cdSamples
final protected ColorsDisplay cdSamples(Code)
Panel that displays current color distribution.



colors
final protected ArrayList colors(Code)
Current list of colors.

Additional colors (after index divisions are kept in memory for possible later usage.




divisions
protected int divisions(Code)
Number of divisions.

number of divisions = number of colors - 1.




divisionsUpdatedIsWorking
protected boolean divisionsUpdatedIsWorking(Code)
Avoids reentrancy into divisionsUpdated().



jcbIntervals
final protected JComboBox jcbIntervals(Code)
Intervals combo box.



jsDivisions
final protected JSpinner jsDivisions(Code)
Divisions spinner.



readOnly
protected boolean readOnly(Code)
Current read-only state of the parameter.



spinnerModel
final protected SpinnerNumberModel spinnerModel(Code)
Spinner model.




Constructor Detail
ColorDistributionParameter
public ColorDistributionParameter(String aName, String aTitle, String aToolTipText)(Code)
Creates a new color distribution parameter instance.
Parameters:
  aName - the parameter's name.
Parameters:
  aTitle - parameter's caption.
Parameters:
  aToolTipText - a tool-tip text.




Method Detail
actionPerformed
public void actionPerformed(ActionEvent aEvent)(Code)
Called when an interval is selected in combo box.



buildGradient
protected void buildGradient()(Code)
Builds up a gradient between the first and last colors.



colorForRatio
public Color colorForRatio(double aRatio)(Code)
Gets the color currently associated to a real number.
Parameters:
  aRatio - a double value in the [0, 1]interval. the associated Color value.



divisionsUpdated
protected void divisionsUpdated()(Code)
Updates graphical representation of color intervals.

Uses divisions and colors.




getColorsValue
public Color[] getColorsValue()(Code)
Get current value of the parameter. a Color[] value.



getValue
public Object getValue()(Code)
Gets value as an object.



getValueAsText
public String getValueAsText()(Code)
Gets value as text.

Colors are exported as integers using Color.getRGB(). They are separated by COLORS_SEPARATOR character.




setReadOnly
public void setReadOnly()(Code)
Sets the paramter as read-only.

Locks divisions spinner and no longer popups a color selection dialog when an interval is selected.




setValue
public void setValue(Object aObject) throws ClassCastException(Code)
Sets value from object. Wrapper to setValue(Color[]).



setValue
public void setValue(Color[] aColors)(Code)
Sets value from a color array. Updates divisions and intervals values.
Parameters:
  aColors - a non-empty Color[] value.



setValueAsText
public void setValueAsText(String aTextValue) throws NumberFormatException, IllegalStateException(Code)
Sets value from text.

Input text is first tokenized using COLORS_SEPARATOR, then each token is processed using Color.decode(String).
exception:
  NumberFormatException - if a number cannot be parsed to a color.
exception:
  IllegalStateException - if an error occurs in the tokenizer.




stateChanged
public void stateChanged(ChangeEvent aEvent)(Code)
Called when the spinner's value is considered as changed.

Updates intervals.




updateDivisions
protected void updateDivisions(int aNewDivisions)(Code)
Updates all fields to match a new divisions number.

When the number of divisions grows, previously selected colors are used or if there are none, last color is repeated.

This method updates fields and calls divisionsUpdated() to update the graphical representation.
Parameters:
  aNewDivisions - new int value.




updateSelectedColor
protected void updateSelectedColor()(Code)
Updates combo box to render currently selected colors.

This must be done because of an error in Swing's Metal UI, which does call the renderer for the selected item but then overrides the foreground color.




Fields inherited from ejp.presenter.api.filters.parameters.AbstractParameter
final public static int LABEL_WIDTH(Code)(Java Doc)
protected Dialog dialog(Code)(Java Doc)
final public String name(Code)(Java Doc)
final protected JPanel panel(Code)(Java Doc)
protected int y(Code)(Java Doc)

Methods inherited from ejp.presenter.api.filters.parameters.AbstractParameter
final protected void addLine(String aTitle, String aToolTipText, JComponent aComponent1, JComponent aComponent2)(Code)(Java Doc)
public JPanel getPanel()(Code)(Java Doc)
abstract public Object getValue()(Code)(Java Doc)
abstract public String getValueAsText()(Code)(Java Doc)
public void setDialog(Dialog aDialog)(Code)(Java Doc)
abstract public void setReadOnly()(Code)(Java Doc)
abstract public void setValue(Object aObject) throws ClassCastException(Code)(Java Doc)
abstract public void setValueAsText(String aTextValue) throws IllegalArgumentException(Code)(Java Doc)
final public void showInTestFrame()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.