Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ikayaki.gui.FittedComboBoxRenderer Class Reference

List of all members.

Public Member Functions

 FittedComboBoxRenderer (JComponent fitToComponent)
 FittedComboBoxRenderer (JComponent fitToComponent, String delimiter, String regexp)
int getFitLimit ()
void setFitLimit (int fitLimit)
Override Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
int fitValue (Object value)
int fitValue (Object value, int fitLimit)

Private Attributes

JComponent fitToComponent
int fitLimit = -1
String delimiter
String delimiterRegexp

Detailed Description

Fits the contents of a ComboBox list to a components width by shortening the text. Especially useful for showing long file paths in a narrow list.

Author:
Esko Luontola

Definition at line 35 of file FittedComboBoxRenderer.java.


Constructor & Destructor Documentation

ikayaki.gui.FittedComboBoxRenderer.FittedComboBoxRenderer JComponent  fitToComponent  ) 
 

Creates a FittedComboBoxRenderer that will fit the list items to the width of a component. The list items' string values will be split using the "\" character.

Parameters:
fitToComponent the component to whose width the list items will be fit to.
Exceptions:
NullPointerException if fitToComponent is null.

Definition at line 50 of file FittedComboBoxRenderer.java.

References ikayaki.gui.null.

ikayaki.gui.FittedComboBoxRenderer.FittedComboBoxRenderer JComponent  fitToComponent,
String  delimiter,
String  regexp
 

Creates a FittedComboBoxRenderer that will fit the list items to the width of a component. The list items' string values will be split using the specified pattern.

Parameters:
fitToComponent the component to whose width the list items will be fit to.
delimiter the string with which to join the parts after they have been split.
regexp a regular expression of the delimiter with which to split the text into parts.
Exceptions:
NullPointerException if any of the parameters is null.

Definition at line 68 of file FittedComboBoxRenderer.java.

References ikayaki.gui.null.


Member Function Documentation

int ikayaki.gui.FittedComboBoxRenderer.fitValue Object  value,
int  fitLimit
 

Fits the specified object to this component. After this method call the possibly shortened string value of the object will be the text in this renderer component. Tells how many parts were removed from the text.

Parameters:
value the object whose toString() value to fit into this renderer component.
fitLimit the fixed number parts to chop off the value, or -1 to detect it automatically.
Returns:
the number of parts that were chopped off the value.

Definition at line 124 of file FittedComboBoxRenderer.java.

References ikayaki.gui.FittedComboBoxRenderer.delimiter, ikayaki.gui.FittedComboBoxRenderer.delimiterRegexp, ikayaki.gui.FittedComboBoxRenderer.fitToComponent, ikayaki.gui.null, and ikayaki.gui.value.

int ikayaki.gui.FittedComboBoxRenderer.fitValue Object  value  ) 
 

Fits the specified object to this component. After this method call the possibly shortened string value of the object will be the text in this renderer component. Tells how much had to be removed from the string value before it did fit.

Parameters:
value the object whose toString() value to fit into this renderer component.
Returns:
the number of parts that were chopped off the value.

Definition at line 112 of file FittedComboBoxRenderer.java.

References ikayaki.gui.value.

Referenced by ikayaki.gui.FittedComboBoxRenderer.getListCellRendererComponent().

int ikayaki.gui.FittedComboBoxRenderer.getFitLimit  ) 
 

Returns the number of parts that will be chopped of the text, or -1 if it is being detected automatically.

Definition at line 80 of file FittedComboBoxRenderer.java.

References ikayaki.gui.FittedComboBoxRenderer.fitLimit.

Override Component ikayaki.gui.FittedComboBoxRenderer.getListCellRendererComponent JList  list,
Object  value,
int  index,
boolean  isSelected,
boolean  cellHasFocus
 

Definition at line 93 of file FittedComboBoxRenderer.java.

References ikayaki.gui.FittedComboBoxRenderer.fitLimit, ikayaki.gui.FittedComboBoxRenderer.fitValue(), and ikayaki.gui.value.

Here is the call graph for this function:

void ikayaki.gui.FittedComboBoxRenderer.setFitLimit int  fitLimit  ) 
 

Sets the number of parts that should be chopped of the text.

Parameters:
fitLimit a fixed number of parts to chop off, or -1 to detected it automatically.

Definition at line 89 of file FittedComboBoxRenderer.java.


Member Data Documentation

String ikayaki.gui.FittedComboBoxRenderer.delimiter [private]
 

Definition at line 40 of file FittedComboBoxRenderer.java.

Referenced by ikayaki.gui.FittedComboBoxRenderer.fitValue().

String ikayaki.gui.FittedComboBoxRenderer.delimiterRegexp [private]
 

Definition at line 41 of file FittedComboBoxRenderer.java.

Referenced by ikayaki.gui.FittedComboBoxRenderer.fitValue().

int ikayaki.gui.FittedComboBoxRenderer.fitLimit = -1 [private]
 

Definition at line 38 of file FittedComboBoxRenderer.java.

Referenced by ikayaki.gui.FittedComboBoxRenderer.getFitLimit(), and ikayaki.gui.FittedComboBoxRenderer.getListCellRendererComponent().

JComponent ikayaki.gui.FittedComboBoxRenderer.fitToComponent [private]
 

Definition at line 37 of file FittedComboBoxRenderer.java.

Referenced by ikayaki.gui.FittedComboBoxRenderer.fitValue().


The documentation for this class was generated from the following file:
Generated on Fri May 6 16:00:51 2005 for Squid by  doxygen 1.4.1