| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.coderazzi.filters.gui.CustomChoice
public abstract class CustomChoice
Class to specify a custom filter in the choices list.
 
A custom choice allows to specify custom filters that can be selected as a
 choice in the filter editor. A custom choice is associated always to a text,
 which the user can input to select the given choice.
 
It is also possible to specify how the custom filter is rendered; by
 default it is displayed the icon -if provided-, and the text, unless the user
 provides a custom renderer.
 
The order of the custom choices on the choices list can be modified with the precedence attribute. By default, custom choices are sorted by their textual representation. If a precedence is given, lower values are displayed first.
| Field Summary | |
|---|---|
static int | 
DEFAULT_PRECEDENCE
 | 
static CustomChoice | 
MATCH_ALL
Empty filter, returns all entries.  | 
static int | 
MATCH_ALL_PRECEDENCE
 | 
static CustomChoice | 
MATCH_EMPTY
Special empty filter, returns all entries with null or empty values.  | 
| Constructor Summary | |
|---|---|
CustomChoice(String representation)
Creates a custom choice without associated icon, and with default precedence, to be handled exclusively as text.  | 
|
CustomChoice(String representation,
             Icon icon)
Creates a custom choice with associated icon and default precedence.  | 
|
CustomChoice(String representation,
             Icon icon,
             int precedence)
Full constructor.  | 
|
| Method Summary | |
|---|---|
static CustomChoice | 
create(Object choice)
Creates a CustomChoice that matches the given object; its stringfied format is the representation shown to the user.  | 
static CustomChoice | 
create(Object choice,
       String repr)
Creates a CustomChoice that matches the given object, with the provided representation. The choice can be a Pattern instance, in which case it is 
 performed a complete regular expression match. | 
static Set<CustomChoice> | 
createSet(Collection choices)
Creates a set of CustomChoice instances, one for each provided choice.  | 
static Set<CustomChoice> | 
createSet(Object[] choices)
Creates a set of CustomChoice instances, one for each provided choice.  | 
 void | 
decorateComponent(IFilterEditor editor,
                  boolean isSelected,
                  JComponent c,
                  Graphics g)
Decorates the choice on the given editor.  | 
 Color | 
getBackground(IFilterEditor editor,
              boolean isSelected)
Returns the background color, or null to use the default one.  | 
abstract  RowFilter | 
getFilter(IFilterEditor editor)
Returns the associated filter.  | 
 Font | 
getFont(IFilterEditor editor,
        boolean isSelected)
Returns the font, or null to use the default one.  | 
 Color | 
getForeground(IFilterEditor editor,
              boolean isSelected)
Returns the foreground color, or null to use the default one.  | 
 Icon | 
getIcon()
Returns the associated icon, if any.  | 
 int | 
getPrecedence()
Returns the precedence value.  | 
 String | 
getRepresentation()
Returns the associated string.  | 
 void | 
setIcon(Icon icon)
Sets the associated icon.  | 
 void | 
setPrecedence(int precedence)
Sets the precedence value.  | 
 void | 
setRepresentation(String representation)
Sets the representation value.  | 
 String | 
toString()
Returns the string representation of the filter.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final int DEFAULT_PRECEDENCE
public static final int MATCH_ALL_PRECEDENCE
public static final CustomChoice MATCH_ALL
public static final CustomChoice MATCH_EMPTY
| Constructor Detail | 
|---|
public CustomChoice(String representation, Icon icon, int precedence)
public CustomChoice(String representation)
public CustomChoice(String representation, Icon icon)
| Method Detail | 
|---|
public static Set<CustomChoice> createSet(Object[] choices)
public static Set<CustomChoice> createSet(Collection choices)
public static CustomChoice create(Object choice)
public static CustomChoice create(Object choice, String repr)
Pattern instance, in which case it is 
 performed a complete regular expression match.
public Color getBackground(IFilterEditor editor, boolean isSelected)
editor - the editor where the choice is usedisSelected - true if the choice is selected
public Color getForeground(IFilterEditor editor, boolean isSelected)
editor - the editor where the choice is usedisSelected - true if the choice is selected
public Font getFont(IFilterEditor editor, boolean isSelected)
editor - the editor where the choice is usedisSelected - true if the choice is selected
public Icon getIcon()
public void setIcon(Icon icon)
public void decorateComponent(IFilterEditor editor, boolean isSelected, JComponent c, Graphics g)
editor - the editor where the choice is usedisSelected - true if the choice is selectedc - the component to decorateg - the decoration contextpublic int getPrecedence()
public void setPrecedence(int precedence)
public String getRepresentation()
public void setRepresentation(String representation)
public abstract RowFilter getFilter(IFilterEditor editor)
public final String toString()
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||